Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/71998 )
Change subject: soc/amd: introduce and use common amd_cpu_bus_ops struct ......................................................................
soc/amd: introduce and use common amd_cpu_bus_ops struct
The device operations for the CPU bus are identical for all AMD SoCs, so introduce a common device operations struct for this and use it in all AMD SoC's chipset devicetrees as ops for the CPU cluster.
Signed-off-by: Felix Held felix-coreboot@felixheld.de Change-Id: Id32f89b8a33db8dbb747b917eeac3009fbae6631 --- M src/soc/amd/cezanne/chip.c M src/soc/amd/cezanne/chipset.cb M src/soc/amd/common/block/cpu/cpu.c M src/soc/amd/glinda/chip.c M src/soc/amd/glinda/chipset.cb M src/soc/amd/mendocino/chip.c M src/soc/amd/mendocino/chipset_mendocino.cb M src/soc/amd/mendocino/chipset_rembrandt.cb M src/soc/amd/phoenix/chip.c M src/soc/amd/phoenix/chipset.cb M src/soc/amd/picasso/chip.c M src/soc/amd/picasso/chipset.cb M src/soc/amd/stoneyridge/chip.c M src/soc/amd/stoneyridge/chipset_cz.cb M src/soc/amd/stoneyridge/chipset_st.cb 15 files changed, 31 insertions(+), 50 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/98/71998/1
diff --git a/src/soc/amd/cezanne/chip.c b/src/soc/amd/cezanne/chip.c index efef2f1..d480cc5 100644 --- a/src/soc/amd/cezanne/chip.c +++ b/src/soc/amd/cezanne/chip.c @@ -12,13 +12,6 @@ #include <types.h> #include "chip.h"
-struct device_operations cezanne_cpu_bus_ops = { - .read_resources = noop_read_resources, - .set_resources = noop_set_resources, - .init = mp_cpu_bus_init, - .acpi_fill_ssdt = generate_cpu_entries, -}; - static const char *soc_acpi_name(const struct device *dev) { if (dev->path.type == DEVICE_PATH_DOMAIN) diff --git a/src/soc/amd/cezanne/chipset.cb b/src/soc/amd/cezanne/chipset.cb index f0a3d86..691153f 100644 --- a/src/soc/amd/cezanne/chipset.cb +++ b/src/soc/amd/cezanne/chipset.cb @@ -1,6 +1,6 @@ chip soc/amd/cezanne device cpu_cluster 0 on - ops cezanne_cpu_bus_ops + ops amd_cpu_bus_ops end device domain 0 on ops cezanne_pci_domain_ops diff --git a/src/soc/amd/common/block/cpu/cpu.c b/src/soc/amd/common/block/cpu/cpu.c index 7c1daf9..1e1915f 100644 --- a/src/soc/amd/common/block/cpu/cpu.c +++ b/src/soc/amd/common/block/cpu/cpu.c @@ -1,9 +1,18 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <acpi/acpi.h> #include <amdblocks/cpu.h> #include <cpu/cpu.h> +#include <device/device.h>
int get_cpu_count(void) { return 1 + (cpuid_ecx(0x80000008) & 0xff); } + +struct device_operations amd_cpu_bus_ops = { + .read_resources = noop_read_resources, + .set_resources = noop_set_resources, + .init = mp_cpu_bus_init, + .acpi_fill_ssdt = generate_cpu_entries, +}; diff --git a/src/soc/amd/glinda/chip.c b/src/soc/amd/glinda/chip.c index 9e9ee9e..65c9e19 100644 --- a/src/soc/amd/glinda/chip.c +++ b/src/soc/amd/glinda/chip.c @@ -14,13 +14,6 @@ #include <types.h> #include "chip.h"
-struct device_operations glinda_cpu_bus_ops = { - .read_resources = noop_read_resources, - .set_resources = noop_set_resources, - .init = mp_cpu_bus_init, - .acpi_fill_ssdt = generate_cpu_entries, -}; - static const char *soc_acpi_name(const struct device *dev) { if (dev->path.type == DEVICE_PATH_DOMAIN) diff --git a/src/soc/amd/glinda/chipset.cb b/src/soc/amd/glinda/chipset.cb index 3b095aa..d54bae0 100644 --- a/src/soc/amd/glinda/chipset.cb +++ b/src/soc/amd/glinda/chipset.cb @@ -2,7 +2,7 @@
chip soc/amd/glinda device cpu_cluster 0 on - ops glinda_cpu_bus_ops + ops amd_cpu_bus_ops end device domain 0 on ops glinda_pci_domain_ops diff --git a/src/soc/amd/mendocino/chip.c b/src/soc/amd/mendocino/chip.c index 83a485f..fee49a8 100644 --- a/src/soc/amd/mendocino/chip.c +++ b/src/soc/amd/mendocino/chip.c @@ -14,13 +14,6 @@ #include <types.h> #include "chip.h"
-struct device_operations mendocino_cpu_bus_ops = { - .read_resources = noop_read_resources, - .set_resources = noop_set_resources, - .init = mp_cpu_bus_init, - .acpi_fill_ssdt = generate_cpu_entries, -}; - static const char *soc_acpi_name(const struct device *dev) { if (dev->path.type == DEVICE_PATH_DOMAIN) diff --git a/src/soc/amd/mendocino/chipset_mendocino.cb b/src/soc/amd/mendocino/chipset_mendocino.cb index 2900279..2ecb2405 100644 --- a/src/soc/amd/mendocino/chipset_mendocino.cb +++ b/src/soc/amd/mendocino/chipset_mendocino.cb @@ -1,6 +1,6 @@ chip soc/amd/mendocino device cpu_cluster 0 on - ops mendocino_cpu_bus_ops + ops amd_cpu_bus_ops end device domain 0 on ops mendocino_pci_domain_ops diff --git a/src/soc/amd/mendocino/chipset_rembrandt.cb b/src/soc/amd/mendocino/chipset_rembrandt.cb index 2900279..2ecb2405 100644 --- a/src/soc/amd/mendocino/chipset_rembrandt.cb +++ b/src/soc/amd/mendocino/chipset_rembrandt.cb @@ -1,6 +1,6 @@ chip soc/amd/mendocino device cpu_cluster 0 on - ops mendocino_cpu_bus_ops + ops amd_cpu_bus_ops end device domain 0 on ops mendocino_pci_domain_ops diff --git a/src/soc/amd/phoenix/chip.c b/src/soc/amd/phoenix/chip.c index 7f0b93f..ee2c7cc 100644 --- a/src/soc/amd/phoenix/chip.c +++ b/src/soc/amd/phoenix/chip.c @@ -14,13 +14,6 @@ #include <types.h> #include "chip.h"
-struct device_operations phoenix_cpu_bus_ops = { - .read_resources = noop_read_resources, - .set_resources = noop_set_resources, - .init = mp_cpu_bus_init, - .acpi_fill_ssdt = generate_cpu_entries, -}; - static const char *soc_acpi_name(const struct device *dev) { if (dev->path.type == DEVICE_PATH_DOMAIN) diff --git a/src/soc/amd/phoenix/chipset.cb b/src/soc/amd/phoenix/chipset.cb index 0e01439..5c341c8 100644 --- a/src/soc/amd/phoenix/chipset.cb +++ b/src/soc/amd/phoenix/chipset.cb @@ -2,7 +2,7 @@
chip soc/amd/phoenix device cpu_cluster 0 on - ops phoenix_cpu_bus_ops + ops amd_cpu_bus_ops end device domain 0 on ops phoenix_pci_domain_ops diff --git a/src/soc/amd/picasso/chip.c b/src/soc/amd/picasso/chip.c index fc30af9..782c1c3 100644 --- a/src/soc/amd/picasso/chip.c +++ b/src/soc/amd/picasso/chip.c @@ -13,13 +13,6 @@ #include "chip.h" #include <fsp/api.h>
-struct device_operations picasso_cpu_bus_ops = { - .read_resources = noop_read_resources, - .set_resources = noop_set_resources, - .init = mp_cpu_bus_init, - .acpi_fill_ssdt = generate_cpu_entries, -}; - static const char *soc_acpi_name(const struct device *dev) { if (dev->path.type == DEVICE_PATH_DOMAIN) diff --git a/src/soc/amd/picasso/chipset.cb b/src/soc/amd/picasso/chipset.cb index 99b025e..6d6177f 100644 --- a/src/soc/amd/picasso/chipset.cb +++ b/src/soc/amd/picasso/chipset.cb @@ -2,7 +2,7 @@
chip soc/amd/picasso device cpu_cluster 0 on - ops picasso_cpu_bus_ops + ops amd_cpu_bus_ops end device domain 0 on ops picasso_pci_domain_ops diff --git a/src/soc/amd/stoneyridge/chip.c b/src/soc/amd/stoneyridge/chip.c index d8ce224..60bc921 100644 --- a/src/soc/amd/stoneyridge/chip.c +++ b/src/soc/amd/stoneyridge/chip.c @@ -18,13 +18,6 @@
#include "chip.h"
-struct device_operations stoneyridge_cpu_bus_ops = { - .read_resources = noop_read_resources, - .set_resources = noop_set_resources, - .init = mp_cpu_bus_init, - .acpi_fill_ssdt = generate_cpu_entries, -}; - const char *soc_acpi_name(const struct device *dev) { if (dev->path.type == DEVICE_PATH_DOMAIN) diff --git a/src/soc/amd/stoneyridge/chipset_cz.cb b/src/soc/amd/stoneyridge/chipset_cz.cb index dbbbd4d..a3bd85c 100644 --- a/src/soc/amd/stoneyridge/chipset_cz.cb +++ b/src/soc/amd/stoneyridge/chipset_cz.cb @@ -2,7 +2,7 @@
chip soc/amd/stoneyridge device cpu_cluster 0 on - ops stoneyridge_cpu_bus_ops + ops amd_cpu_bus_ops end device domain 0 on ops stoneyridge_pci_domain_ops diff --git a/src/soc/amd/stoneyridge/chipset_st.cb b/src/soc/amd/stoneyridge/chipset_st.cb index 4c244d0..c78da61 100644 --- a/src/soc/amd/stoneyridge/chipset_st.cb +++ b/src/soc/amd/stoneyridge/chipset_st.cb @@ -2,7 +2,7 @@
chip soc/amd/stoneyridge device cpu_cluster 0 on - ops stoneyridge_cpu_bus_ops + ops amd_cpu_bus_ops end device domain 0 on ops stoneyridge_pci_domain_ops