Attention is currently required from: Jason Glenesk, Raul Rangel, Matt DeVillier, Fred Reitberger.
Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/69476 )
Change subject: soc/amd/*/root_complex: use FSP HOB iterator functions ......................................................................
soc/amd/*/root_complex: use FSP HOB iterator functions
Use the newly added functions to iterate over the FSP HOBs to report the resources used by FSP to the resource allocator instead of open coding the iteration over the HOBs in the SoC code.
TEST=Patch doesn't change reported resources on Mandolin
Signed-off-by: Felix Held felix-coreboot@felixheld.de Change-Id: I67ca346345c1fa08b008caa885d0a00d2d5afb12 --- M src/soc/amd/cezanne/root_complex.c M src/soc/amd/glinda/root_complex.c M src/soc/amd/mendocino/root_complex.c M src/soc/amd/morgana/root_complex.c M src/soc/amd/picasso/root_complex.c 5 files changed, 32 insertions(+), 47 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/69476/1
diff --git a/src/soc/amd/cezanne/root_complex.c b/src/soc/amd/cezanne/root_complex.c index 5f2024c..31c2e1a 100644 --- a/src/soc/amd/cezanne/root_complex.c +++ b/src/soc/amd/cezanne/root_complex.c @@ -103,7 +103,7 @@ { uint32_t mem_usable = (uintptr_t)cbmem_top(); unsigned int idx = 0; - const struct hob_header *hob = fsp_get_hob_list(); + const struct hob_header *hob_iterator; const struct hob_resource *res; struct resource *gnb_apic;
@@ -148,19 +148,13 @@ gnb_apic->size = 0x00001000; gnb_apic->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
- if (!hob) { + if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS) { printk(BIOS_ERR, "%s incomplete because no HOB list was found\n", __func__); return; }
- for (; hob->type != HOB_TYPE_END_OF_HOB_LIST; hob = fsp_next_hob(hob)) { - - if (hob->type != HOB_TYPE_RESOURCE_DESCRIPTOR) - continue; - - res = fsp_hob_header_to_resource(hob); - + while (fsp_hob_iterator_get_next_resource(&hob_iterator, &res) == CB_SUCCESS) { if (res->type == EFI_RESOURCE_SYSTEM_MEMORY && res->addr < mem_usable) continue; /* 0 through low usable was set above */ if (res->type == EFI_RESOURCE_MEMORY_MAPPED_IO) diff --git a/src/soc/amd/glinda/root_complex.c b/src/soc/amd/glinda/root_complex.c index 16f1bdd..04d0599 100644 --- a/src/soc/amd/glinda/root_complex.c +++ b/src/soc/amd/glinda/root_complex.c @@ -118,7 +118,7 @@ { uint32_t mem_usable = (uintptr_t)cbmem_top(); unsigned int idx = 0; - const struct hob_header *hob = fsp_get_hob_list(); + const struct hob_header *hob_iterator; const struct hob_resource *res; struct resource *gnb_apic;
@@ -163,19 +163,13 @@ gnb_apic->size = 0x00001000; gnb_apic->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
- if (!hob) { + if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS) { printk(BIOS_ERR, "%s incomplete because no HOB list was found\n", __func__); return; }
- for (; hob->type != HOB_TYPE_END_OF_HOB_LIST; hob = fsp_next_hob(hob)) { - - if (hob->type != HOB_TYPE_RESOURCE_DESCRIPTOR) - continue; - - res = fsp_hob_header_to_resource(hob); - + while (fsp_hob_iterator_get_next_resource(&hob_iterator, &res) == CB_SUCCESS) { if (res->type == EFI_RESOURCE_SYSTEM_MEMORY && res->addr < mem_usable) continue; /* 0 through low usable was set above */ if (res->type == EFI_RESOURCE_MEMORY_MAPPED_IO) diff --git a/src/soc/amd/mendocino/root_complex.c b/src/soc/amd/mendocino/root_complex.c index d728516..abc49cf 100644 --- a/src/soc/amd/mendocino/root_complex.c +++ b/src/soc/amd/mendocino/root_complex.c @@ -118,7 +118,7 @@ { uint32_t mem_usable = (uintptr_t)cbmem_top(); unsigned int idx = 0; - const struct hob_header *hob = fsp_get_hob_list(); + const struct hob_header *hob_iterator; const struct hob_resource *res; struct resource *gnb_apic;
@@ -163,19 +163,13 @@ gnb_apic->size = 0x00001000; gnb_apic->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
- if (!hob) { + if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS) { printk(BIOS_ERR, "%s incomplete because no HOB list was found\n", __func__); return; }
- for (; hob->type != HOB_TYPE_END_OF_HOB_LIST; hob = fsp_next_hob(hob)) { - - if (hob->type != HOB_TYPE_RESOURCE_DESCRIPTOR) - continue; - - res = fsp_hob_header_to_resource(hob); - + while (fsp_hob_iterator_get_next_resource(&hob_iterator, &res) == CB_SUCCESS) { if (res->type == EFI_RESOURCE_SYSTEM_MEMORY && res->addr < mem_usable) continue; /* 0 through low usable was set above */ if (res->type == EFI_RESOURCE_MEMORY_MAPPED_IO) diff --git a/src/soc/amd/morgana/root_complex.c b/src/soc/amd/morgana/root_complex.c index 0e6e730..10e5415 100644 --- a/src/soc/amd/morgana/root_complex.c +++ b/src/soc/amd/morgana/root_complex.c @@ -118,7 +118,7 @@ { uint32_t mem_usable = (uintptr_t)cbmem_top(); unsigned int idx = 0; - const struct hob_header *hob = fsp_get_hob_list(); + const struct hob_header *hob_iterator; const struct hob_resource *res; struct resource *gnb_apic;
@@ -163,19 +163,13 @@ gnb_apic->size = 0x00001000; gnb_apic->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
- if (!hob) { + if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS) { printk(BIOS_ERR, "%s incomplete because no HOB list was found\n", __func__); return; }
- for (; hob->type != HOB_TYPE_END_OF_HOB_LIST; hob = fsp_next_hob(hob)) { - - if (hob->type != HOB_TYPE_RESOURCE_DESCRIPTOR) - continue; - - res = fsp_hob_header_to_resource(hob); - + while (fsp_hob_iterator_get_next_resource(&hob_iterator, &res) == CB_SUCCESS) { if (res->type == EFI_RESOURCE_SYSTEM_MEMORY && res->addr < mem_usable) continue; /* 0 through low usable was set above */ if (res->type == EFI_RESOURCE_MEMORY_MAPPED_IO) diff --git a/src/soc/amd/picasso/root_complex.c b/src/soc/amd/picasso/root_complex.c index 4892023..c662320 100644 --- a/src/soc/amd/picasso/root_complex.c +++ b/src/soc/amd/picasso/root_complex.c @@ -103,7 +103,7 @@ { uint32_t mem_usable = (uintptr_t)cbmem_top(); unsigned int idx = 0; - const struct hob_header *hob = fsp_get_hob_list(); + const struct hob_header *hob_iterator; const struct hob_resource *res; struct resource *gnb_apic;
@@ -146,19 +146,12 @@ gnb_apic->size = 0x00001000; gnb_apic->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
- if (!hob) { - printk(BIOS_ERR, "%s incomplete because no HOB list was found\n", - __func__); + if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS) { + printk(BIOS_ERR, "%s incomplete because no HOB list was found\n", __func__); return; }
- for (; hob->type != HOB_TYPE_END_OF_HOB_LIST; hob = fsp_next_hob(hob)) { - - if (hob->type != HOB_TYPE_RESOURCE_DESCRIPTOR) - continue; - - res = fsp_hob_header_to_resource(hob); - + while (fsp_hob_iterator_get_next_resource(&hob_iterator, &res) == CB_SUCCESS) { if (res->type == EFI_RESOURCE_SYSTEM_MEMORY && res->addr < mem_usable) continue; /* 0 through low usable was set above */ if (res->type == EFI_RESOURCE_MEMORY_MAPPED_IO)