mainboard/intel/avenuecity_crb: Update full IIO configuration
[coreboot2.git] / src / mainboard / getac / p470 / acpi_tables.c
blob1429b59003cff99b0fc2ca115104bb4423825212
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <string.h>
4 #include <console/console.h>
5 #include <acpi/acpi.h>
6 #include <device/device.h>
8 #include "mainboard.h"
10 static long acpi_create_ecdt(acpi_ecdt_t * ecdt)
12 /* Attention: Make sure these match the values from
13 * the DSDT's ec.asl
15 static const char ec_id[] = "\\_SB.PCI0.LPCB.EC0";
16 int ecdt_len = sizeof(acpi_ecdt_t) + strlen(ec_id) + 1;
18 acpi_header_t *header = &(ecdt->header);
20 memset((void *)ecdt, 0, ecdt_len);
22 /* fill out header fields */
23 memcpy(header->signature, "ECDT", 4);
24 memcpy(header->oem_id, OEM_ID, 6);
25 memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
26 memcpy(header->asl_compiler_id, ASLC, 4);
28 header->length = ecdt_len;
29 header->revision = 1;
31 /* Location of the two EC registers */
32 ecdt->ec_control.space_id = ACPI_ADDRESS_SPACE_IO;
33 ecdt->ec_control.bit_width = 8;
34 ecdt->ec_control.bit_offset = 0;
35 ecdt->ec_control.addrl = 0x66;
36 ecdt->ec_control.addrh = 0;
38 ecdt->ec_data.space_id = ACPI_ADDRESS_SPACE_IO;
39 ecdt->ec_data.bit_width = 8;
40 ecdt->ec_data.bit_offset = 0;
41 ecdt->ec_data.addrl = 0x62;
42 ecdt->ec_data.addrh = 0;
44 ecdt->uid = 1; // Must match _UID of the EC0 node.
46 ecdt->gpe_bit = 23; // SCI interrupt within GPEx_STS
48 memcpy(ecdt->ec_id, ec_id, sizeof(ec_id));
50 header->checksum =
51 acpi_checksum((void *)ecdt, ecdt_len);
53 return header->length;
56 unsigned long mainboard_write_acpi_tables(const struct device *device,
57 unsigned long start,
58 acpi_rsdp_t *rsdp)
60 unsigned long current;
61 acpi_header_t *ecdt;
63 current = start;
65 /* Align ACPI tables to 16byte */
66 current = acpi_align_current(current);
68 printk(BIOS_DEBUG, "ACPI: * ECDT\n");
69 ecdt = (acpi_header_t *)current;
70 current += acpi_create_ecdt((acpi_ecdt_t *)current);
71 current = acpi_align_current(current);
72 acpi_add_table(rsdp, ecdt);
74 printk(BIOS_DEBUG, "current = %lx\n", current);
75 return current;