cpu/intel: Add socket types
[coreboot2.git] / src / northbridge / intel / gm45 / acpi.c
blob70f0736a8ad56e1a386783d5cf1e754088932a7c
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <types.h>
4 #include <commonlib/helpers.h>
5 #include <console/console.h>
6 #include <acpi/acpi.h>
7 #include <acpi/acpigen.h>
8 #include <device/device.h>
9 #include <device/pci_def.h>
10 #include <device/pci_ops.h>
12 #include "gm45.h"
14 static unsigned long acpi_fill_dmar(unsigned long current)
16 const struct device *dev;
18 dev = pcidev_on_root(3, 0);
19 int me_active = dev && dev->enabled;
21 dev = pcidev_on_root(2, 0);
22 int igd_active = dev && dev->enabled;
24 int stepping = pci_read_config8(pcidev_on_root(0, 0),
25 PCI_CLASS_REVISION);
27 unsigned long tmp = current;
28 current += acpi_create_dmar_drhd_4k(current, 0, 0, IOMMU_BASE1);
29 current += acpi_create_dmar_ds_pci(current, 0, 0x1b, 0);
30 acpi_dmar_drhd_fixup(tmp, current);
32 if (stepping != STEPPING_B2 && igd_active) {
33 tmp = current;
34 current += acpi_create_dmar_drhd_4k(current, 0, 0, IOMMU_BASE2);
35 current += acpi_create_dmar_ds_pci(current, 0, 0x2, 0);
36 current += acpi_create_dmar_ds_pci(current, 0, 0x2, 1);
37 acpi_dmar_drhd_fixup(tmp, current);
40 if (me_active) {
41 tmp = current;
42 current += acpi_create_dmar_drhd_4k(current, 0, 0, IOMMU_BASE3);
43 current += acpi_create_dmar_ds_pci(current, 0, 0x3, 0);
44 current += acpi_create_dmar_ds_pci(current, 0, 0x3, 1);
45 current += acpi_create_dmar_ds_pci(current, 0, 0x3, 2);
46 current += acpi_create_dmar_ds_pci(current, 0, 0x3, 3);
47 acpi_dmar_drhd_fixup(tmp, current);
50 current += acpi_create_dmar_drhd_4k(current, DRHD_INCLUDE_PCI_ALL, 0, IOMMU_BASE4);
52 /* TODO: reserve GTT for 0.2.0 and 0.2.1? */
53 return current;
56 unsigned long northbridge_write_acpi_tables(const struct device *device,
57 unsigned long start,
58 struct acpi_rsdp *rsdp)
60 unsigned long current;
61 acpi_dmar_t *dmar;
63 current = start;
65 printk(BIOS_DEBUG, "ACPI: * DMAR\n");
66 dmar = (acpi_dmar_t *)current;
67 acpi_create_dmar(dmar, 0, acpi_fill_dmar);
68 current += dmar->header.length;
69 current = acpi_align_current(current);
70 acpi_add_table(rsdp, dmar);
72 current = acpi_align_current(current);
74 printk(BIOS_DEBUG, "current = %lx\n", current);
76 return current;