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:
		
				
					committed by
					
						
						Martin Roth
					
				
			
			
				
	
			
			
			
						parent
						
							33232604a7
						
					
				
				
					commit
					a26dbbd9d0
				
			@@ -44,7 +44,7 @@ static unsigned long igd_write_opregion(device_t dev, unsigned long current,
 | 
			
		||||
	printk(BIOS_DEBUG, "ACPI:    * IGD OpRegion\n");
 | 
			
		||||
	opregion = (igd_opregion_t *)current;
 | 
			
		||||
 | 
			
		||||
	if (!init_igd_opregion(opregion))
 | 
			
		||||
	if (init_igd_opregion(opregion) != CB_SUCCESS)
 | 
			
		||||
		return current;
 | 
			
		||||
 | 
			
		||||
	current += sizeof(igd_opregion_t);
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@
 | 
			
		||||
#include "opregion.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;
 | 
			
		||||
	optionrom_vbt_t *vbt;
 | 
			
		||||
@@ -29,14 +29,14 @@ int init_igd_opregion(igd_opregion_t *opregion)
 | 
			
		||||
 | 
			
		||||
	if (locate_vbt(&vbt_rdev) == CB_ERR) {
 | 
			
		||||
		printk(BIOS_ERR, "VBT not found\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
		return CB_ERR;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	vbt = rdev_mmap_full(&vbt_rdev);
 | 
			
		||||
 | 
			
		||||
	if (!vbt) {
 | 
			
		||||
		printk(BIOS_ERR, "VBT couldn't be read\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
		return CB_ERR;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	memset(opregion, 0, sizeof(igd_opregion_t));
 | 
			
		||||
@@ -51,7 +51,7 @@ int init_igd_opregion(igd_opregion_t *opregion)
 | 
			
		||||
 | 
			
		||||
		if (ext_vbt == NULL) {
 | 
			
		||||
			printk(BIOS_ERR, "Unable to add Ext VBT to cbmem!\n");
 | 
			
		||||
			return 0;
 | 
			
		||||
			return CB_ERR;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		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);
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
	return CB_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,6 @@
 | 
			
		||||
#include <drivers/intel/gma/opregion.h>
 | 
			
		||||
 | 
			
		||||
/* 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_ */
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
#include <stdlib.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;
 | 
			
		||||
	uint32_t vbt_len;
 | 
			
		||||
@@ -46,5 +46,5 @@ int init_igd_opregion(igd_opregion_t *opregion)
 | 
			
		||||
	/* We just assume we're mobile for now */
 | 
			
		||||
	opregion->header.mailboxes = MAILBOXES_MOBILE;
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
	return CB_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user