x86: fsp: Drop get_hob_type() and get_hob_length()
PATCH 1/1 x86: fsp: Drop get_hob_type() and get_hob_length()
These two are not worth having separate inline functions as they are really simple, so drop them.
Also changed 'type' parameter of fsp_get_next_hob() from u16 to uint.
Suggested-by Simon Glass <[email protected]>
Signed-off-by Bin Meng <[email protected]>
---
arch/x86/cpu/queensbay/fsp_support.c | 10 +++--- arch/x86/cpu/queensbay/tnc_dram.c | 4 +-- arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h | 36 ++-------------------- .../include/asm/arch-queensbay/fsp/fsp_support.h | 2 +- arch/x86/lib/cmd_hob.c | 6 ++-- 5 files changed, 14 insertions(+), 44 deletions(-)
arch/x86/cpu/queensbay/fsp_support.c +5 -5
@@ -242,7 +242,7 @@ u32 fsp_get_usable_lowmem_top(const void *hob_list)/* * Collect memory ranges */ top =FSP_LOWMEM_BASE ;while (!end_of_hob (hdr)) { -if (get_hob_type (hdr) ==HOB_TYPE_RES_DESC ) { +if (hdr->type ==HOB_TYPE_RES_DESC ) { res_desc = (struct hob_res_desc *)hdr;if (res_desc->type ==RES_SYS_MEM ) { phys_start = res_desc->phys_start;
@@ -271,7 +271,7 @@ u64 fsp_get_usable_highmem_top(const void *hob_list)/* Collect memory ranges */ top =FSP_HIGHMEM_BASE ;while (!end_of_hob (hdr)) { -if (get_hob_type (hdr) ==HOB_TYPE_RES_DESC ) { +if (hdr->type ==HOB_TYPE_RES_DESC ) { res_desc = (struct hob_res_desc *)hdr;if (res_desc->type ==RES_SYS_MEM ) { phys_start = res_desc->phys_start;
@@ -297,7 +297,7 @@ u64 fsp_get_reserved_mem_from_guid(const void *hob_list, u64 *len,/* Collect memory ranges */ while (!end_of_hob (hdr)) { -if (get_hob_type (hdr) ==HOB_TYPE_RES_DESC ) { +if (hdr->type ==HOB_TYPE_RES_DESC ) { res_desc = (struct hob_res_desc *)hdr;if (res_desc->type ==RES_MEM_RESERVED ) {if (compare_guid (&res_desc->owner, guid)) {
@@ -342,7 +342,7 @@ u32 fsp_get_tseg_reserved_mem(const void *hob_list, u32 *len)return base; } -const struct hob_header *fsp_get_next_hob (u16 type,const void *hob_list) +const struct hob_header *fsp_get_next_hob (uint type,const void *hob_list) {const struct hob_header *hdr;
@@ -350,7 +350,7 @@ const struct hob_header *fsp_get_next_hob(u16 type, const void *hob_list)/* Parse the HOB list until end of list or matching type is found */ while (!end_of_hob (hdr)) { -if (get_hob_type (hdr) == type) +if (hdr->type == type)return hdr; hdr =get_next_hob (hdr);
arch/x86/cpu/queensbay/tnc_dram.c +2 -2
@@ -19,7 +19,7 @@ int dram_init(void) hdr = gd->arch.hob_list;while (!end_of_hob (hdr)) { -if (get_hob_type (hdr) ==HOB_TYPE_RES_DESC ) { +if (hdr->type ==HOB_TYPE_RES_DESC ) { res_desc = (struct hob_res_desc *)hdr;if (res_desc->type ==RES_SYS_MEM || res_desc->type ==RES_MEM_RESERVED ) {
@@ -63,7 +63,7 @@ unsigned install_e820_map(unsigned max_entries, struct e820entry *entries) hdr = gd->arch.hob_list;while (!end_of_hob (hdr)) { -if (get_hob_type (hdr) ==HOB_TYPE_RES_DESC ) { +if (hdr->type ==HOB_TYPE_RES_DESC ) { res_desc = (struct hob_res_desc *)hdr; entries[num_entries].addr = res_desc->phys_start; entries[num_entries].size = res_desc->len;
arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h +3 -33
@@ -183,36 +183,6 @@ struct hob_guid { };/** -* get_hob_type() - return the type of a HOB -* -* This macro returns the type field from the HOB header for the -* HOB specified by hob. -* -* @hob: A pointer to a HOB. -* -* @return: HOB type. -*/ -static inline u16 get_hob_type (const struct hob_header *hdr) -{ -return hdr->type; -} - -/** -* get_hob_length() - return the length, in bytes, of a HOB -* -* This macro returns the len field from the HOB header for the -* HOB specified by hob. -* -* @hob: A pointer to a HOB. -* -* @return: HOB length. -*/ -static inline u16 get_hob_length (const struct hob_header *hdr) -{ -return hdr->len; -} - -/** * get_next_hob() - return a pointer to the next HOB in the HOB list * * This macro returns a pointer to HOB that follows the HOB specified by hob
@@ -224,7 +194,7 @@ static inline u16 get_hob_length(const struct hob_header *hdr)*/ static inline const struct hob_header *get_next_hob (const struct hob_header *hdr) { -return (const struct hob_header *)((u32 )hdr +get_hob_length (hdr)); +return (const struct hob_header *)((u32 )hdr + hdr->len); }/**
@@ -241,7 +211,7 @@ static inline const struct hob_header *get_next_hob(const struct hob_header *hdr*/ static inline bool end_of_hob (const struct hob_header *hdr) { -return get_hob_type (hdr) ==HOB_TYPE_EOH ; +return hdr->type ==HOB_TYPE_EOH ; }/**
@@ -273,7 +243,7 @@ static inline void *get_guid_hob_data(const struct hob_header *hdr)*/ static inline u16 get_guid_hob_data_size (const struct hob_header *hdr) { -return get_hob_length (hdr) -sizeof (struct hob_guid ); +return hdr->len -sizeof (struct hob_guid ); }/* FSP specific GUID HOB definitions */
arch/x86/include/asm/arch-queensbay/fsp/fsp_support.h +1 -1
@@ -145,7 +145,7 @@ u32 fsp_get_tseg_reserved_mem(const void *hob_list, u32 *len);* * @retval: A HOB object with matching type; Otherwise NULL. */ -const struct hob_header *fsp_get_next_hob (u16 type,const void *hob_list); +const struct hob_header *fsp_get_next_hob (uint type,const void *hob_list);/** * Returns the next instance of the matched GUID HOB from the starting HOB.
arch/x86/lib/cmd_hob.c +3 -3
@@ -29,7 +29,7 @@ static char *hob_type[] = {int do_hob (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) {const struct hob_header *hdr; -u16 type; +uint type;char *desc;int i =0 ;
@@ -41,7 +41,7 @@ int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])printf ("----|----------|---------------------|----------------\n" );while (!end_of_hob (hdr)) {printf ("%-3d | %08x | " , i, (unsigned int )hdr); - type =get_hob_type (hdr); + type = hdr->type;if (type ==HOB_TYPE_UNUSED ) desc ="*Unused*" ;else if (type ==HOB_TYPE_EOH )
@@ -50,7 +50,7 @@ int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) desc = hob_type[type]; else desc ="*Invalid Type*" ; -printf ("%-19s | %-15d\n" , desc,get_hob_length (hdr)); +printf ("%-19s | %-15d\n" , desc, hdr->len); hdr =get_next_hob (hdr); i++; }
Signature · 1 line
1.8.2.1
PATCH 1/1 x86: fsp: Drop get_hob_type() and get_hob_length()
Quoted 7 lines · Bin Meng
These two are not worth having separate inline functions as they are really simple, so drop them.
Also changed 'type' parameter of
fsp_get_next_hob()from u16 to uint.Suggested-by Simon Glass <[email protected]>Signed-off-by Bin Meng <[email protected]>
Quoted 8 lines
---
arch/x86/cpu/queensbay/fsp_support.c | 10 +++--- arch/x86/cpu/queensbay/tnc_dram.c | 4 +-- arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h | 36 ++-------------------- .../include/asm/arch-queensbay/fsp/fsp_support.h | 2 +- arch/x86/lib/cmd_hob.c | 6 ++-- 5 files changed, 14 insertions(+), 44 deletions(-)
Acked-by Simon Glass <[email protected]>
PATCH 1/1 x86: fsp: Drop get_hob_type() and get_hob_length()
Quoted 10 lines · Simon Glass
Quoted 9 lines · Bin Meng
These two are not worth having separate inline functions as they are really simple, so drop them.
Also changed 'type' parameter of
fsp_get_next_hob()from u16 to uint.Suggested-by Simon Glass <[email protected]>Signed-off-by Bin Meng <[email protected]>---
Quoted 8 lines
Quoted 6 lines
arch/x86/cpu/queensbay/fsp_support.c | 10 +++--- arch/x86/cpu/queensbay/tnc_dram.c | 4 +-- arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h | 36 ++-------------------- .../include/asm/arch-queensbay/fsp/fsp_support.h | 2 +- arch/x86/lib/cmd_hob.c | 6 ++-- 5 files changed, 14 insertions(+), 44 deletions(-)Acked-by Simon Glass <[email protected]>
Applied to u-boot-x86/next, thanks!