blob: 1b7ff509516498b06c3fe82a838b14fe2d4644cd [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Saket Sinha331141a2015-08-22 12:20:55 +05302/*
3 * Based on acpi.c from coreboot
4 *
5 * Copyright (C) 2015, Saket Sinha <saket.sinha89@gmail.com>
Bin Mengbbcff8d2016-05-07 07:46:22 -07006 * Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com>
Saket Sinha331141a2015-08-22 12:20:55 +05307 */
8
Bin Meng3f047072018-07-18 21:42:17 -07009#ifndef __ASM_ACPI_TABLE_H__
10#define __ASM_ACPI_TABLE_H__
11
Simon Glass858fed12020-04-08 16:57:36 -060012struct acpi_facs;
13struct acpi_fadt;
Bin Mengd9050c62016-06-17 02:13:16 -070014struct acpi_global_nvs;
Simon Glass858fed12020-04-08 16:57:36 -060015struct acpi_madt_ioapic;
16struct acpi_madt_irqoverride;
17struct acpi_madt_lapic_nmi;
18struct acpi_mcfg_mmconfig;
19struct acpi_table_header;
Andy Shevchenko6e84f0872018-11-20 23:52:37 +020020
Saket Sinha331141a2015-08-22 12:20:55 +053021/* These can be used by the target port */
22
Bin Mengb063d5f2016-05-07 07:46:24 -070023void acpi_fill_header(struct acpi_table_header *header, char *signature);
Bin Meng44256b02016-05-07 07:46:25 -070024void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
25 void *dsdt);
Bin Meng3c5234e2016-05-07 07:46:30 -070026int acpi_create_madt_lapics(u32 current);
Bin Meng44256b02016-05-07 07:46:25 -070027int acpi_create_madt_ioapic(struct acpi_madt_ioapic *ioapic, u8 id,
28 u32 addr, u32 gsi_base);
Saket Sinha331141a2015-08-22 12:20:55 +053029int acpi_create_madt_irqoverride(struct acpi_madt_irqoverride *irqoverride,
Bin Meng44256b02016-05-07 07:46:25 -070030 u8 bus, u8 source, u32 gsirq, u16 flags);
31int acpi_create_madt_lapic_nmi(struct acpi_madt_lapic_nmi *lapic_nmi,
32 u8 cpu, u16 flags, u8 lint);
Bin Menga1ec7db2016-05-07 07:46:26 -070033u32 acpi_fill_madt(u32 current);
Andy Shevchenkoc1ae9802017-07-21 22:32:05 +030034int acpi_create_mcfg_mmconfig(struct acpi_mcfg_mmconfig *mmconfig, u32 base,
35 u16 seg_nr, u8 start, u8 end);
36u32 acpi_fill_mcfg(u32 current);
Andy Shevchenko607dbd12019-07-14 19:23:57 +030037u32 acpi_fill_csrt(u32 current);
Simon Glass9ed41e72020-07-07 21:32:05 -060038
39/**
Simon Glass4ffe8b02020-09-22 12:45:09 -060040 * acpi_write_hpet() - Write out a HPET table
41 *
42 * Write out the table for High-Precision Event Timers
43 *
44 * @ctx: Current ACPI context
45 * @return 0 if OK, -ve on error
46 */
47int acpi_write_hpet(struct acpi_ctx *ctx);
48
49/**
Simon Glass95971892020-09-22 12:45:10 -060050 * acpi_write_dbg2_pci_uart() - Write out a DBG2 table
51 *
52 * @ctx: Current ACPI context
53 * @dev: Debug UART device to describe
54 * @access_size: Access size for UART (e.g. ACPI_ACCESS_SIZE_DWORD_ACCESS)
55 * @return 0 if OK, -ve on error
56 */
57int acpi_write_dbg2_pci_uart(struct acpi_ctx *ctx, struct udevice *dev,
58 uint access_size);
59
60/**
Simon Glass9ed41e72020-07-07 21:32:05 -060061 * acpi_create_gnvs() - Create a GNVS (Global Non Volatile Storage) table
62 *
63 * @gnvs: Table to fill in
64 * @return 0 if OK, -ve on error
65 */
66int acpi_create_gnvs(struct acpi_global_nvs *gnvs);
67
Simon Glassca37a392017-01-16 07:03:35 -070068ulong write_acpi_tables(ulong start);
Bin Meng34bc74a2017-04-21 07:24:36 -070069
70/**
Bin Menge1029252018-01-30 05:01:16 -080071 * acpi_get_rsdp_addr() - get ACPI RSDP table address
72 *
73 * This routine returns the ACPI RSDP table address in the system memory.
74 *
75 * @return: ACPI RSDP table address
76 */
77ulong acpi_get_rsdp_addr(void);
Bin Meng3f047072018-07-18 21:42:17 -070078
79#endif /* __ASM_ACPI_TABLE_H__ */