Felix Held submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Felix Held: Looks good to me, approved Marshall Dawson: Looks good to me, approved
soc/amd/cezanne: Generate PCI GPP ACPI names

We can generate the names, so there is no need to hard code a table.
This will make the code more generic so it can be reused with picasso in
the future.

BUG=b:184766519
TEST=Dump guybrush ACPI table and verify it looks correct.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I5134d1dba4fcb9ce8cc4bfad1c619331a95f3b11
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52870
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M src/soc/amd/cezanne/pcie_gpp.c
1 file changed, 9 insertions(+), 31 deletions(-)

diff --git a/src/soc/amd/cezanne/pcie_gpp.c b/src/soc/amd/cezanne/pcie_gpp.c
index 283470b..58c7761 100644
--- a/src/soc/amd/cezanne/pcie_gpp.c
+++ b/src/soc/amd/cezanne/pcie_gpp.c
@@ -11,43 +11,21 @@
#include <device/pci_ids.h>
#include <device/pciexp.h>
#include <soc/pci_devs.h>
+#include <stdio.h>
+#include <stdlib.h>

static const char *pcie_gpp_acpi_name(const struct device *dev)
{
+ char *name;
+
if (dev->path.type != DEVICE_PATH_PCI)
return NULL;

- switch (dev->path.pci.devfn) {
- case PCIE_GPP_1_0_DEVFN:
- return "GP10";
- case PCIE_GPP_1_1_DEVFN:
- return "GP11";
- case PCIE_GPP_1_2_DEVFN:
- return "GP12";
- case PCIE_GPP_2_0_DEVFN:
- return "GP20";
- case PCIE_GPP_2_1_DEVFN:
- return "GP21";
- case PCIE_GPP_2_2_DEVFN:
- return "GP22";
- case PCIE_GPP_2_3_DEVFN:
- return "GP23";
- case PCIE_GPP_2_4_DEVFN:
- return "GP24";
- case PCIE_GPP_2_5_DEVFN:
- return "GP25";
- case PCIE_GPP_2_6_DEVFN:
- return "GP26";
- case PCIE_ABC_A_DEVFN:
- return "GPPA";
- case PCIE_GPP_B_DEVFN:
- return "GPPB";
- case PCIE_GPP_C_DEVFN:
- return "GPPC";
- default:
- printk(BIOS_ERR, "%s: Unhanded devfn 0x%x\n", __func__, dev->path.pci.devfn);
- return NULL;
- }
+ name = malloc(ACPI_NAME_BUFFER_SIZE);
+ snprintf(name, ACPI_NAME_BUFFER_SIZE, "GP%02x", dev->path.pci.devfn);
+ name[4] = '\0';
+
+ return name;
}

static void acpi_device_write_gpp_pci_dev(const struct device *dev)

To view, visit change 52870. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I5134d1dba4fcb9ce8cc4bfad1c619331a95f3b11
Gerrit-Change-Number: 52870
Gerrit-PatchSet: 10
Gerrit-Owner: Raul Rangel <rrangel@chromium.org>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk@gmail.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd@gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-MessageType: merged