| 1 |
|
| 2 |
|
| 3 |
#include <acpi/acpigen_pci.h> |
| 4 |
#include <amdblocks/ioapic.h> |
| 5 |
#include <amdblocks/data_fabric.h> |
| 6 |
#include <amdblocks/memmap.h> |
| 7 |
#include <amdblocks/root_complex.h> |
| 8 |
#include <amdblocks/smn.h> |
| 9 |
#include <arch/ioapic.h> |
| 10 |
#include <console/console.h> |
| 11 |
#include <device/device.h> |
| 12 |
#include <drivers/amd/opensil/opensil.h> |
| 13 |
#include <types.h> |
| 14 |
|
| 15 |
#define IOHC_IOAPIC_BASE_ADDR_LO 0x2f0 |
| 16 |
|
| 17 |
void read_soc_memmap_resources(struct device *domain, unsigned long *idx) |
| 18 |
{ |
| 19 |
read_lower_soc_memmap_resources(domain, idx); |
| 20 |
|
| 21 |
amd_opensil_add_memmap(domain, idx); |
| 22 |
} |
| 23 |
|
| 24 |
static void genoa_domain_set_resources(struct device *domain) |
| 25 |
{ |
| 26 |
if (domain->downstream->bridge_ctrl & PCI_BRIDGE_CTL_VGA) { |
| 27 |
printk(BIOS_DEBUG, "Setting VGA decoding for domain 0x%x\n", |
| 28 |
dev_get_domain_id(domain)); |
| 29 |
const union df_vga_en vga_en = { |
| 30 |
.ve = 1, |
| 31 |
.dst_fabric_id = get_iohc_fabric_id(domain), |
| 32 |
}; |
| 33 |
data_fabric_broadcast_write32(DF_VGA_EN, vga_en.raw); |
| 34 |
} |
| 35 |
|
| 36 |
pci_domain_set_resources(domain); |
| 37 |
|
| 38 |
|
| 39 |
struct resource *res = probe_resource(domain, IOMMU_IOAPIC_IDX); |
| 40 |
if (res) { |
| 41 |
const uint32_t iohc_misc_base = get_iohc_misc_smn_base(domain); |
| 42 |
uint32_t ioapic_base = smn_read32(iohc_misc_base | IOHC_IOAPIC_BASE_ADDR_LO); |
| 43 |
ioapic_base |= (1 << 0); |
| 44 |
smn_write32(iohc_misc_base | IOHC_IOAPIC_BASE_ADDR_LO, ioapic_base); |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
static const char *genoa_domain_acpi_name(const struct device *domain) |
| 49 |
{ |
| 50 |
const unsigned int domain_id = dev_get_domain_id(domain); |
| 51 |
const char *domain_acpi_names[4] = { |
| 52 |
"S0B0", |
| 53 |
"S0B1", |
| 54 |
"S0B2", |
| 55 |
"S0B3", |
| 56 |
}; |
| 57 |
|
| 58 |
if (domain_id < ARRAY_SIZE(domain_acpi_names)) |
| 59 |
return domain_acpi_names[domain_id]; |
| 60 |
|
| 61 |
return NULL; |
| 62 |
} |
| 63 |
|
| 64 |
struct device_operations genoa_pci_domain_ops = { |
| 65 |
.read_resources = amd_pci_domain_read_resources, |
| 66 |
.set_resources = genoa_domain_set_resources, |
| 67 |
.scan_bus = amd_pci_domain_scan_bus, |
| 68 |
.init = amd_pci_domain_init, |
| 69 |
.acpi_name = genoa_domain_acpi_name, |
| 70 |
.acpi_fill_ssdt = pci_domain_fill_ssdt, |
| 71 |
}; |