2 * This file is part of the coreboot project.
4 * Copyright (C) 2017 Advanced Micro Devices, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 #include <bootstate.h>
18 #include <console/console.h>
19 #include <cpu/amd/mtrr.h>
21 #include <device/device.h>
22 #include <device/pci.h>
24 #include <soc/northbridge.h>
25 #include <soc/pci_devs.h>
26 #include <soc/southbridge.h>
27 #include <amdblocks/psp.h>
28 #include <amdblocks/agesawrapper.h>
29 #include <amdblocks/agesawrapper_call.h>
31 struct device_operations cpu_bus_ops
= {
32 .read_resources
= DEVICE_NOOP
,
33 .set_resources
= DEVICE_NOOP
,
34 .enable_resources
= DEVICE_NOOP
,
35 .init
= stoney_init_cpus
,
36 .acpi_fill_ssdt_generator
= generate_cpu_entries
,
39 static const char *soc_acpi_name(const struct device
*dev
)
41 if (dev
->path
.type
== DEVICE_PATH_DOMAIN
)
43 if (dev
->path
.type
!= DEVICE_PATH_PCI
)
46 switch (dev
->path
.pci
.devfn
) {
64 struct device_operations pci_domain_ops
= {
65 .read_resources
= domain_read_resources
,
66 .set_resources
= domain_set_resources
,
67 .enable_resources
= domain_enable_resources
,
68 .scan_bus
= pci_domain_scan_bus
,
69 .ops_pci_bus
= pci_bus_default_ops
,
70 .acpi_name
= soc_acpi_name
,
73 static void enable_dev(device_t dev
)
75 /* Set the operations if it is a special bus type */
76 if (dev
->path
.type
== DEVICE_PATH_DOMAIN
)
77 dev
->ops
= &pci_domain_ops
;
78 else if (dev
->path
.type
== DEVICE_PATH_CPU_CLUSTER
)
79 dev
->ops
= &cpu_bus_ops
;
80 else if (dev
->path
.type
== DEVICE_PATH_PCI
)
84 static void soc_init(void *chip_info
)
86 southbridge_init(chip_info
);
90 static void soc_final(void *chip_info
)
92 southbridge_final(chip_info
);
93 fam15_finalize(chip_info
);
96 struct chip_operations soc_amd_stoneyridge_ops
= {
97 CHIP_NAME("AMD StoneyRidge SOC")
98 .enable_dev
= &enable_dev
,
103 static void earliest_ramstage(void *unused
)
106 if (IS_ENABLED(CONFIG_SOC_AMD_PSP_SELECTABLE_SMU_FW
))
107 psp_load_named_blob(MBOX_BIOS_CMD_SMU_FW2
, "smu_fw2");
110 do_agesawrapper(agesawrapper_amdinitenv
, "amdinitenv");
113 BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE
, BS_ON_ENTRY
, earliest_ramstage
, NULL
);