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 <sjg@chromium.org> Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
cb3b2e62ca
commit
b2439aecd3
@ -242,7 +242,7 @@ u32 fsp_get_usable_lowmem_top(const void *hob_list)
|
|||||||
/* * Collect memory ranges */
|
/* * Collect memory ranges */
|
||||||
top = FSP_LOWMEM_BASE;
|
top = FSP_LOWMEM_BASE;
|
||||||
while (!end_of_hob(hdr)) {
|
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;
|
res_desc = (struct hob_res_desc *)hdr;
|
||||||
if (res_desc->type == RES_SYS_MEM) {
|
if (res_desc->type == RES_SYS_MEM) {
|
||||||
phys_start = res_desc->phys_start;
|
phys_start = res_desc->phys_start;
|
||||||
@ -271,7 +271,7 @@ u64 fsp_get_usable_highmem_top(const void *hob_list)
|
|||||||
/* Collect memory ranges */
|
/* Collect memory ranges */
|
||||||
top = FSP_HIGHMEM_BASE;
|
top = FSP_HIGHMEM_BASE;
|
||||||
while (!end_of_hob(hdr)) {
|
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;
|
res_desc = (struct hob_res_desc *)hdr;
|
||||||
if (res_desc->type == RES_SYS_MEM) {
|
if (res_desc->type == RES_SYS_MEM) {
|
||||||
phys_start = res_desc->phys_start;
|
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 */
|
/* Collect memory ranges */
|
||||||
while (!end_of_hob(hdr)) {
|
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;
|
res_desc = (struct hob_res_desc *)hdr;
|
||||||
if (res_desc->type == RES_MEM_RESERVED) {
|
if (res_desc->type == RES_MEM_RESERVED) {
|
||||||
if (compare_guid(&res_desc->owner, guid)) {
|
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;
|
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;
|
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 */
|
/* Parse the HOB list until end of list or matching type is found */
|
||||||
while (!end_of_hob(hdr)) {
|
while (!end_of_hob(hdr)) {
|
||||||
if (get_hob_type(hdr) == type)
|
if (hdr->type == type)
|
||||||
return hdr;
|
return hdr;
|
||||||
|
|
||||||
hdr = get_next_hob(hdr);
|
hdr = get_next_hob(hdr);
|
||||||
|
@ -19,7 +19,7 @@ int dram_init(void)
|
|||||||
|
|
||||||
hdr = gd->arch.hob_list;
|
hdr = gd->arch.hob_list;
|
||||||
while (!end_of_hob(hdr)) {
|
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;
|
res_desc = (struct hob_res_desc *)hdr;
|
||||||
if (res_desc->type == RES_SYS_MEM ||
|
if (res_desc->type == RES_SYS_MEM ||
|
||||||
res_desc->type == RES_MEM_RESERVED) {
|
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;
|
hdr = gd->arch.hob_list;
|
||||||
|
|
||||||
while (!end_of_hob(hdr)) {
|
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;
|
res_desc = (struct hob_res_desc *)hdr;
|
||||||
entries[num_entries].addr = res_desc->phys_start;
|
entries[num_entries].addr = res_desc->phys_start;
|
||||||
entries[num_entries].size = res_desc->len;
|
entries[num_entries].size = res_desc->len;
|
||||||
|
@ -182,36 +182,6 @@ struct hob_guid {
|
|||||||
/* GUID specific data goes here */
|
/* GUID specific data goes here */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
* get_next_hob() - return a pointer to the next HOB in the HOB list
|
||||||
*
|
*
|
||||||
@ -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)
|
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)
|
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)
|
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 */
|
/* FSP specific GUID HOB definitions */
|
||||||
|
@ -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.
|
* @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.
|
* Returns the next instance of the matched GUID HOB from the starting HOB.
|
||||||
|
@ -29,7 +29,7 @@ static char *hob_type[] = {
|
|||||||
int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
{
|
{
|
||||||
const struct hob_header *hdr;
|
const struct hob_header *hdr;
|
||||||
u16 type;
|
uint type;
|
||||||
char *desc;
|
char *desc;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||||||
printf("----|----------|---------------------|----------------\n");
|
printf("----|----------|---------------------|----------------\n");
|
||||||
while (!end_of_hob(hdr)) {
|
while (!end_of_hob(hdr)) {
|
||||||
printf("%-3d | %08x | ", i, (unsigned int)hdr);
|
printf("%-3d | %08x | ", i, (unsigned int)hdr);
|
||||||
type = get_hob_type(hdr);
|
type = hdr->type;
|
||||||
if (type == HOB_TYPE_UNUSED)
|
if (type == HOB_TYPE_UNUSED)
|
||||||
desc = "*Unused*";
|
desc = "*Unused*";
|
||||||
else if (type == HOB_TYPE_EOH)
|
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];
|
desc = hob_type[type];
|
||||||
else
|
else
|
||||||
desc = "*Invalid Type*";
|
desc = "*Invalid Type*";
|
||||||
printf("%-19s | %-15d\n", desc, get_hob_length(hdr));
|
printf("%-19s | %-15d\n", desc, hdr->len);
|
||||||
hdr = get_next_hob(hdr);
|
hdr = get_next_hob(hdr);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user