mainboard/[g-p]*: Remove copyright notices
[coreboot.git] / src / mainboard / getac / p470 / acpi_tables.c
blobc2a09208858bb677658c582f565257e97525c9d7
1 /*
2 * This file is part of the coreboot project.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; version 2 of
8 * 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.
16 #include <types.h>
17 #include <string.h>
18 #include <console/console.h>
19 #include <arch/acpi.h>
20 #include <device/device.h>
21 #include <southbridge/intel/i82801gx/nvs.h>
23 #include "mainboard.h"
25 void acpi_create_gnvs(global_nvs_t *gnvs)
27 /* Enable COM port(s) */
28 gnvs->cmap = 0x01;
29 gnvs->cmbp = 0x00;
32 static long acpi_create_ecdt(acpi_ecdt_t * ecdt)
34 /* Attention: Make sure these match the values from
35 * the DSDT's ec.asl
37 static const char ec_id[] = "\\_SB.PCI0.LPCB.EC0";
38 int ecdt_len = sizeof(acpi_ecdt_t) + strlen(ec_id) + 1;
40 acpi_header_t *header = &(ecdt->header);
42 memset((void *) ecdt, 0, ecdt_len);
44 /* fill out header fields */
45 memcpy(header->signature, "ECDT", 4);
46 memcpy(header->oem_id, OEM_ID, 6);
47 memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
48 memcpy(header->asl_compiler_id, ASLC, 4);
50 header->length = ecdt_len;
51 header->revision = 1;
53 /* Location of the two EC registers */
54 ecdt->ec_control.space_id = ACPI_ADDRESS_SPACE_IO;
55 ecdt->ec_control.bit_width = 8;
56 ecdt->ec_control.bit_offset = 0;
57 ecdt->ec_control.addrl = 0x66;
58 ecdt->ec_control.addrh = 0;
60 ecdt->ec_data.space_id = ACPI_ADDRESS_SPACE_IO; /* Memory */
61 ecdt->ec_data.bit_width = 8;
62 ecdt->ec_data.bit_offset = 0;
63 ecdt->ec_data.addrl = 0x62;
64 ecdt->ec_data.addrh = 0;
66 ecdt->uid = 1; // Must match _UID of the EC0 node.
68 ecdt->gpe_bit = 23; // SCI interrupt within GPEx_STS
70 memcpy(ecdt->ec_id, ec_id, sizeof(ec_id));
72 header->checksum =
73 acpi_checksum((void *) ecdt, ecdt_len);
75 return header->length;
78 unsigned long mainboard_write_acpi_tables(struct device *device,
79 unsigned long start,
80 acpi_rsdp_t *rsdp)
82 unsigned long current;
83 acpi_header_t *ecdt;
85 current = start;
87 /* Align ACPI tables to 16byte */
88 current = acpi_align_current(current);
90 printk(BIOS_DEBUG, "ACPI: * ECDT\n");
91 ecdt = (acpi_header_t *)current;
92 current += acpi_create_ecdt((acpi_ecdt_t *)current);
93 current = acpi_align_current(current);
94 acpi_add_table(rsdp, ecdt);
96 printk(BIOS_DEBUG, "current = %lx\n", current);
97 return current;