soc/intel/common/opregion: Use enum cb_err as return value

Return CB_SUCCESS and CB_ERR instead of some integer.
Preparation to merge intel/soc and intel/nb opregion implementations.

Change-Id: Ib99fcfe347b98736979fc82ab3de48bfc6fc7dcd
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-on: https://review.coreboot.org/20220
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Patrick Rudolph 2017-06-15 08:43:11 +02:00 committed by Martin Roth
parent 33232604a7
commit a26dbbd9d0
4 changed files with 9 additions and 9 deletions

View file

@ -44,7 +44,7 @@ static unsigned long igd_write_opregion(device_t dev, unsigned long current,
printk(BIOS_DEBUG, "ACPI: * IGD OpRegion\n"); printk(BIOS_DEBUG, "ACPI: * IGD OpRegion\n");
opregion = (igd_opregion_t *)current; opregion = (igd_opregion_t *)current;
if (!init_igd_opregion(opregion)) if (init_igd_opregion(opregion) != CB_SUCCESS)
return current; return current;
current += sizeof(igd_opregion_t); current += sizeof(igd_opregion_t);

View file

@ -21,7 +21,7 @@
#include "opregion.h" #include "opregion.h"
#include "vbt.h" #include "vbt.h"
int init_igd_opregion(igd_opregion_t *opregion) enum cb_err init_igd_opregion(igd_opregion_t *opregion)
{ {
struct region_device vbt_rdev; struct region_device vbt_rdev;
optionrom_vbt_t *vbt; optionrom_vbt_t *vbt;
@ -29,14 +29,14 @@ int init_igd_opregion(igd_opregion_t *opregion)
if (locate_vbt(&vbt_rdev) == CB_ERR) { if (locate_vbt(&vbt_rdev) == CB_ERR) {
printk(BIOS_ERR, "VBT not found\n"); printk(BIOS_ERR, "VBT not found\n");
return 0; return CB_ERR;
}; };
vbt = rdev_mmap_full(&vbt_rdev); vbt = rdev_mmap_full(&vbt_rdev);
if (!vbt) { if (!vbt) {
printk(BIOS_ERR, "VBT couldn't be read\n"); printk(BIOS_ERR, "VBT couldn't be read\n");
return 0; return CB_ERR;
} }
memset(opregion, 0, sizeof(igd_opregion_t)); memset(opregion, 0, sizeof(igd_opregion_t));
@ -51,7 +51,7 @@ int init_igd_opregion(igd_opregion_t *opregion)
if (ext_vbt == NULL) { if (ext_vbt == NULL) {
printk(BIOS_ERR, "Unable to add Ext VBT to cbmem!\n"); printk(BIOS_ERR, "Unable to add Ext VBT to cbmem!\n");
return 0; return CB_ERR;
} }
memcpy(ext_vbt, vbt, vbt->hdr_vbt_size); memcpy(ext_vbt, vbt, vbt->hdr_vbt_size);
@ -71,5 +71,5 @@ int init_igd_opregion(igd_opregion_t *opregion)
rdev_munmap(&vbt_rdev, vbt); rdev_munmap(&vbt_rdev, vbt);
return 1; return CB_SUCCESS;
} }

View file

@ -19,6 +19,6 @@
#include <drivers/intel/gma/opregion.h> #include <drivers/intel/gma/opregion.h>
/* Loads vbt and initializes opregion. Returns non-zero on success */ /* Loads vbt and initializes opregion. Returns non-zero on success */
int init_igd_opregion(igd_opregion_t *opregion); enum cb_err init_igd_opregion(igd_opregion_t *opregion);
#endif /* _COMMON_OPREGION_H_ */ #endif /* _COMMON_OPREGION_H_ */

View file

@ -19,7 +19,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
int init_igd_opregion(igd_opregion_t *opregion) enum cb_err init_igd_opregion(igd_opregion_t *opregion)
{ {
const optionrom_vbt_t *vbt; const optionrom_vbt_t *vbt;
uint32_t vbt_len; uint32_t vbt_len;
@ -46,5 +46,5 @@ int init_igd_opregion(igd_opregion_t *opregion)
/* We just assume we're mobile for now */ /* We just assume we're mobile for now */
opregion->header.mailboxes = MAILBOXES_MOBILE; opregion->header.mailboxes = MAILBOXES_MOBILE;
return 0; return CB_SUCCESS;
} }