2 * coreboot ACPI Table support
3 * written by Stefan Reinauer <stepan@openbios.org>
4 * ACPI FADT, FACS, and DSDT table support added by
5 * Nick Barker <nick.barker9@btinternet.com>, and those portions
6 * (C) Copyright 2004 Nick Barker
7 * (C) Copyright 2005 Stefan Reinauer
10 #include <console/console.h>
12 #include <arch/acpi.h>
14 extern const unsigned char AmlCode[];
16 unsigned long acpi_fill_mcfg(unsigned long current)
22 unsigned long acpi_fill_slit(unsigned long current)
28 unsigned long acpi_fill_madt(unsigned long current)
34 unsigned long acpi_fill_srat(unsigned long current)
36 /* No NUMA, no SRAT */
40 unsigned long write_acpi_tables(unsigned long start)
42 unsigned long current;
49 /* Align ACPI tables to 16byte */
50 start = ( start + 0x0f ) & -0x10;
53 printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
55 /* We need at least an RSDP and an RSDT Table */
56 rsdp = (acpi_rsdp_t *) current;
57 current += sizeof(acpi_rsdp_t);
58 rsdt = (acpi_rsdt_t *) current;
59 current += sizeof(acpi_rsdt_t);
61 /* clear all table memory */
62 memset((void *)start, 0, current - start);
64 acpi_write_rsdp(rsdp, rsdt, NULL);
65 acpi_write_rsdt(rsdt);
68 * We explicitly add these tables later on:
70 printk(BIOS_DEBUG, "ACPI: * FACS\n");
71 facs = (acpi_facs_t *) current;
72 current += sizeof(acpi_facs_t);
73 acpi_create_facs(facs);
75 dsdt = (acpi_header_t *)current;
76 memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
77 current += dsdt->length;
78 memcpy(dsdt, &AmlCode, dsdt->length);
79 dsdt->checksum = 0; // don't trust intel iasl compiler to get this right
80 dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length);
81 printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
82 printk(BIOS_DEBUG, "ACPI: * FADT\n");
84 fadt = (acpi_fadt_t *) current;
85 current += sizeof(acpi_fadt_t);
87 acpi_create_fadt(fadt,facs,dsdt);
88 acpi_add_table(rsdp,fadt);
90 printk(BIOS_INFO, "ACPI: done.\n");