mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
efi_loader: return efi_status_t from efi_gop_register
All initialization routines should return a status code instead of a boolean. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: Convert warnings to debug() prints] Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
7657152bdd
commit
80ea9b0990
2 changed files with 23 additions and 13 deletions
|
@ -183,7 +183,7 @@ int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
|
||||||
const char *if_typename, int diskid,
|
const char *if_typename, int diskid,
|
||||||
const char *pdevname);
|
const char *pdevname);
|
||||||
/* Called by bootefi to make GOP (graphical) interface available */
|
/* Called by bootefi to make GOP (graphical) interface available */
|
||||||
int efi_gop_register(void);
|
efi_status_t efi_gop_register(void);
|
||||||
/* Called by bootefi to make the network interface available */
|
/* Called by bootefi to make the network interface available */
|
||||||
int efi_net_register(void);
|
int efi_net_register(void);
|
||||||
/* Called by bootefi to make the watchdog available */
|
/* Called by bootefi to make the watchdog available */
|
||||||
|
|
|
@ -125,8 +125,13 @@ efi_status_t EFIAPI gop_blt(struct efi_gop *this, void *buffer,
|
||||||
return EFI_EXIT(EFI_SUCCESS);
|
return EFI_EXIT(EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This gets called from do_bootefi_exec(). */
|
/*
|
||||||
int efi_gop_register(void)
|
* Install graphical output protocol.
|
||||||
|
*
|
||||||
|
* If no supported video device exists this is not considered as an
|
||||||
|
* error.
|
||||||
|
*/
|
||||||
|
efi_status_t efi_gop_register(void)
|
||||||
{
|
{
|
||||||
struct efi_gop_obj *gopobj;
|
struct efi_gop_obj *gopobj;
|
||||||
u32 bpix, col, row;
|
u32 bpix, col, row;
|
||||||
|
@ -136,12 +141,15 @@ int efi_gop_register(void)
|
||||||
|
|
||||||
#ifdef CONFIG_DM_VIDEO
|
#ifdef CONFIG_DM_VIDEO
|
||||||
struct udevice *vdev;
|
struct udevice *vdev;
|
||||||
|
struct video_priv *priv;
|
||||||
|
|
||||||
/* We only support a single video output device for now */
|
/* We only support a single video output device for now */
|
||||||
if (uclass_first_device(UCLASS_VIDEO, &vdev) || !vdev)
|
if (uclass_first_device(UCLASS_VIDEO, &vdev) || !vdev) {
|
||||||
return -1;
|
debug("WARNING: No video device\n");
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
struct video_priv *priv = dev_get_uclass_priv(vdev);
|
priv = dev_get_uclass_priv(vdev);
|
||||||
bpix = priv->bpix;
|
bpix = priv->bpix;
|
||||||
col = video_get_xsize(vdev);
|
col = video_get_xsize(vdev);
|
||||||
row = video_get_ysize(vdev);
|
row = video_get_ysize(vdev);
|
||||||
|
@ -170,13 +178,14 @@ int efi_gop_register(void)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* So far, we only work in 16 or 32 bit mode */
|
/* So far, we only work in 16 or 32 bit mode */
|
||||||
return -1;
|
debug("WARNING: Unsupported video mode\n");
|
||||||
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
gopobj = calloc(1, sizeof(*gopobj));
|
gopobj = calloc(1, sizeof(*gopobj));
|
||||||
if (!gopobj) {
|
if (!gopobj) {
|
||||||
printf("ERROR: Out of memory\n");
|
printf("ERROR: Out of memory\n");
|
||||||
return 1;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hook up to the device list */
|
/* Hook up to the device list */
|
||||||
|
@ -186,8 +195,8 @@ int efi_gop_register(void)
|
||||||
ret = efi_add_protocol(gopobj->parent.handle, &efi_gop_guid,
|
ret = efi_add_protocol(gopobj->parent.handle, &efi_gop_guid,
|
||||||
&gopobj->ops);
|
&gopobj->ops);
|
||||||
if (ret != EFI_SUCCESS) {
|
if (ret != EFI_SUCCESS) {
|
||||||
printf("ERROR: Out of memory\n");
|
printf("ERROR: Failure adding gop protocol\n");
|
||||||
return 1;
|
return ret;
|
||||||
}
|
}
|
||||||
gopobj->ops.query_mode = gop_query_mode;
|
gopobj->ops.query_mode = gop_query_mode;
|
||||||
gopobj->ops.set_mode = gop_set_mode;
|
gopobj->ops.set_mode = gop_set_mode;
|
||||||
|
@ -199,10 +208,11 @@ int efi_gop_register(void)
|
||||||
gopobj->mode.info_size = sizeof(gopobj->info);
|
gopobj->mode.info_size = sizeof(gopobj->info);
|
||||||
|
|
||||||
#ifdef CONFIG_DM_VIDEO
|
#ifdef CONFIG_DM_VIDEO
|
||||||
if (bpix == VIDEO_BPP32) {
|
if (bpix == VIDEO_BPP32)
|
||||||
#else
|
#else
|
||||||
if (bpix == LCD_COLOR32) {
|
if (bpix == LCD_COLOR32)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
/* With 32bit color space we can directly expose the fb */
|
/* With 32bit color space we can directly expose the fb */
|
||||||
gopobj->mode.fb_base = fb_base;
|
gopobj->mode.fb_base = fb_base;
|
||||||
gopobj->mode.fb_size = fb_size;
|
gopobj->mode.fb_size = fb_size;
|
||||||
|
@ -217,5 +227,5 @@ int efi_gop_register(void)
|
||||||
gopobj->bpix = bpix;
|
gopobj->bpix = bpix;
|
||||||
gopobj->fb = fb;
|
gopobj->fb = fb;
|
||||||
|
|
||||||
return 0;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue