cbfs: correct types used for accessing files

In commit 72a8e5e751 the
Makefile's were updated to use named types for cbfs
file addition. However, the call sites were not checked to
ensure the types matched. Correct all call sites to use the
named types.

Change-Id: Ib9fa693ef517e3196a3f04e9c06db52a9116fee7
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9195
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
This commit is contained in:
Aaron Durbin 2015-03-31 20:33:53 -05:00 committed by Aaron Durbin
parent 2a567eeb1d
commit a30f7e667c
15 changed files with 31 additions and 23 deletions

View File

@ -36,8 +36,8 @@ int read_spd_from_cbfs(u8 *buf, int idx)
size_t min_len = (idx + 1) * SPD_SIZE; size_t min_len = (idx + 1) * SPD_SIZE;
printk(BIOS_DEBUG, "read SPD\n"); printk(BIOS_DEBUG, "read SPD\n");
spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab, spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
&spd_file_len); CBFS_TYPE_SPD, &spd_file_len);
if (!spd_file) if (!spd_file)
printk(BIOS_EMERG, "file [spd.bin] not found in CBFS"); printk(BIOS_EMERG, "file [spd.bin] not found in CBFS");
if (spd_file_len < min_len) if (spd_file_len < min_len)

View File

@ -64,7 +64,8 @@ static u32 get_mrc_cache_region(struct mrc_data_container **mrc_region_ptr)
{ {
size_t region_size; size_t region_size;
*mrc_region_ptr = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, *mrc_region_ptr = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
"mrc.cache", 0xac, "mrc.cache",
CBFS_TYPE_MRC_CACHE,
&region_size); &region_size);
return region_size; return region_size;

View File

@ -74,7 +74,11 @@
#define CBFS_TYPE_VSA 0x51 #define CBFS_TYPE_VSA 0x51
#define CBFS_TYPE_MBI 0x52 #define CBFS_TYPE_MBI 0x52
#define CBFS_TYPE_MICROCODE 0x53 #define CBFS_TYPE_MICROCODE 0x53
#define CBFS_TYPE_FSP 0x60
#define CBFS_TYPE_MRC 0x61
#define CBFS_COMPONENT_CMOS_DEFAULT 0xaa #define CBFS_COMPONENT_CMOS_DEFAULT 0xaa
#define CBFS_TYPE_SPD 0xab
#define CBFS_TYPE_MRC_CACHE 0xac
#define CBFS_COMPONENT_CMOS_LAYOUT 0x01aa #define CBFS_COMPONENT_CMOS_LAYOUT 0x01aa
#define CBFS_HEADER_MAGIC 0x4F524243 #define CBFS_HEADER_MAGIC 0x4F524243

View File

@ -78,8 +78,8 @@ static void copy_spd(struct pei_data *peid)
int spd_index = 0; /* No GPIO selection, force index 0 for now */ int spd_index = 0; /* No GPIO selection, force index 0 for now */
printk(BIOS_DEBUG, "SPD index %d\n", spd_index); printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab, spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
&spd_file_len); CBFS_TYPE_SPD, &spd_file_len);
if (!spd_file) if (!spd_file)
die("SPD data not found."); die("SPD data not found.");

View File

@ -79,8 +79,8 @@ static void copy_spd(struct pei_data *peid)
size_t spd_file_len; size_t spd_file_len;
printk(BIOS_DEBUG, "SPD index %d\n", spd_index); printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab, spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
&spd_file_len); CBFS_TYPE_SPD, &spd_file_len);
if (!spd_file) if (!spd_file)
die("SPD data not found."); die("SPD data not found.");

View File

@ -95,8 +95,8 @@ static void copy_spd(struct pei_data *peid)
int spd_index = get_gpios(gpio_vector); int spd_index = get_gpios(gpio_vector);
printk(BIOS_DEBUG, "spd index %d\n", spd_index); printk(BIOS_DEBUG, "spd index %d\n", spd_index);
spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab, spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
&spd_file_len); CBFS_TYPE_SPD, &spd_file_len);
if (!spd_file) if (!spd_file)
die("SPD data not found."); die("SPD data not found.");

View File

@ -82,8 +82,8 @@ static void copy_spd(struct pei_data *peid)
size_t spd_file_len; size_t spd_file_len;
printk(BIOS_DEBUG, "SPD index %d\n", spd_index); printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab, spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
&spd_file_len); CBFS_TYPE_SPD, &spd_file_len);
if (!spd_file) if (!spd_file)
die("SPD data not found."); die("SPD data not found.");

View File

@ -80,8 +80,8 @@ static void copy_spd(struct pei_data *peid)
size_t spd_file_len; size_t spd_file_len;
printk(BIOS_DEBUG, "SPD index %d\n", spd_index); printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab, spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
&spd_file_len); CBFS_TYPE_SPD, &spd_file_len);
if (!spd_file) if (!spd_file)
die("SPD data not found."); die("SPD data not found.");

View File

@ -237,8 +237,8 @@ void main(unsigned long bist)
break; break;
} }
spd_data = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab, spd_data = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin",
&spd_file_len); CBFS_TYPE_SPD, &spd_file_len);
if (!spd_data) if (!spd_data)
die("SPD data not found."); die("SPD data not found.");
if (spd_file_len < (spd_index + 1) * 256) if (spd_file_len < (spd_index + 1) * 256)

View File

@ -71,7 +71,9 @@ static u32 get_mrc_cache_region(struct mrc_data_container **mrc_region_ptr)
#else #else
size_t region_size; size_t region_size;
*mrc_region_ptr = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, *mrc_region_ptr = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
"mrc.cache", 0xac, &region_size); "mrc.cache",
CBFS_TYPE_MRC_CACHE,
&region_size);
return region_size; return region_size;
#endif #endif
} }

View File

@ -163,7 +163,7 @@ void sdram_initialize(struct pei_data *pei_data)
/* Locate and call UEFI System Agent binary. */ /* Locate and call UEFI System Agent binary. */
entry = (unsigned long)cbfs_get_file_content( entry = (unsigned long)cbfs_get_file_content(
CBFS_DEFAULT_MEDIA, "mrc.bin", 0xab, NULL); CBFS_DEFAULT_MEDIA, "mrc.bin", CBFS_TYPE_MRC, NULL);
if (entry) { if (entry) {
int rv; int rv;
asm volatile ( asm volatile (

View File

@ -71,7 +71,9 @@ static u32 get_mrc_cache_region(struct mrc_data_container **mrc_region_ptr)
#else #else
size_t region_size; size_t region_size;
*mrc_region_ptr = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, *mrc_region_ptr = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
"mrc.cache", 0xac, &region_size); "mrc.cache",
CBFS_TYPE_MRC_CACHE,
&region_size);
return region_size; return region_size;
#endif #endif

View File

@ -246,9 +246,8 @@ void sdram_initialize(struct pei_data *pei_data)
pei_data->tx_byte = do_putchar; pei_data->tx_byte = do_putchar;
/* Locate and call UEFI System Agent binary. */ /* Locate and call UEFI System Agent binary. */
/* TODO make MRC blob (0xab?) defined in cbfs_core.h. */
entry = cbfs_get_file_content( entry = cbfs_get_file_content(
CBFS_DEFAULT_MEDIA, "mrc.bin", 0xab, NULL); CBFS_DEFAULT_MEDIA, "mrc.bin", CBFS_TYPE_MRC, NULL);
if (entry) { if (entry) {
int rv; int rv;
rv = entry (pei_data); rv = entry (pei_data);

View File

@ -147,8 +147,8 @@ void raminit(struct mrc_params *mp, int prev_sleep_state)
} }
/* Determine if mrc.bin is in the cbfs. */ /* Determine if mrc.bin is in the cbfs. */
if (cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "mrc.bin", 0xab, NULL) == if (cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "mrc.bin", CBFS_TYPE_MRC,
NULL) { NULL) == NULL) {
printk(BIOS_DEBUG, "Couldn't find mrc.bin\n"); printk(BIOS_DEBUG, "Couldn't find mrc.bin\n");
return; return;
} }

View File

@ -86,7 +86,7 @@ void raminit(struct pei_data *pei_data)
/* Determine if mrc.bin is in the cbfs. */ /* Determine if mrc.bin is in the cbfs. */
entry = (pei_wrapper_entry_t)cbfs_get_file_content( entry = (pei_wrapper_entry_t)cbfs_get_file_content(
CBFS_DEFAULT_MEDIA, "mrc.bin", 0xab, NULL); CBFS_DEFAULT_MEDIA, "mrc.bin", CBFS_TYPE_MRC, NULL);
if (entry == NULL) { if (entry == NULL) {
printk(BIOS_DEBUG, "Couldn't find mrc.bin\n"); printk(BIOS_DEBUG, "Couldn't find mrc.bin\n");
return; return;