mb/google/brya/var/orisa: Update Type C DisplayPort HPD Configuration
[coreboot2.git] / src / acpi / acpi_hpet.c
blobfbf852941f64c31af45ae1f5b39f6712da5c8d23
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpi.h>
4 #include <arch/hpet.h>
5 #include <console/console.h>
6 #include <device/device.h>
7 #include <device/mmio.h>
8 #include <version.h>
11 /* http://www.intel.com/hardwaredesign/hpetspec_1.pdf */
12 static void acpi_create_hpet(acpi_hpet_t *hpet)
14 acpi_header_t *header = &(hpet->header);
15 acpi_addr_t *addr = &(hpet->addr);
17 memset((void *)hpet, 0, sizeof(acpi_hpet_t));
19 if (!header)
20 return;
22 /* Fill out header fields. */
23 memcpy(header->signature, "HPET", 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->asl_compiler_revision = asl_revision;
29 header->length = sizeof(acpi_hpet_t);
30 header->revision = get_acpi_table_revision(HPET);
32 /* Fill out HPET address. */
33 addr->space_id = ACPI_ADDRESS_SPACE_MEMORY;
34 addr->bit_width = 64;
35 addr->bit_offset = 0;
36 addr->addrl = HPET_BASE_ADDRESS & 0xffffffff;
37 addr->addrh = ((unsigned long long)HPET_BASE_ADDRESS) >> 32;
39 hpet->id = read32p(HPET_BASE_ADDRESS);
40 hpet->number = 0;
41 hpet->min_tick = CONFIG_HPET_MIN_TICKS;
43 header->checksum = acpi_checksum((void *)hpet, sizeof(acpi_hpet_t));
46 unsigned long acpi_write_hpet(const struct device *device, unsigned long current,
47 acpi_rsdp_t *rsdp)
49 acpi_hpet_t *hpet;
52 * We explicitly add these tables later on:
54 printk(BIOS_DEBUG, "ACPI: * HPET\n");
56 hpet = (acpi_hpet_t *)current;
57 current += sizeof(acpi_hpet_t);
58 current = ALIGN_UP(current, 16);
59 acpi_create_hpet(hpet);
60 acpi_add_table(rsdp, hpet);
62 return current;