1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Based on acpi.c from coreboot
5 * Copyright (C) 2015, Saket Sinha <saket.sinha89@gmail.com>
6 * Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com>
9 #ifndef __ASM_ACPI_TABLE_H__
10 #define __ASM_ACPI_TABLE_H__
18 struct acpi_global_nvs;
19 struct acpi_madt_ioapic;
20 struct acpi_madt_irqoverride;
21 struct acpi_madt_lapic_nmi;
22 struct acpi_mcfg_mmconfig;
23 struct acpi_table_header;
25 /* These can be used by the target port */
27 int acpi_create_madt_lapics(u32 current);
28 int acpi_create_madt_ioapic(struct acpi_madt_ioapic *ioapic, u8 id,
29 u32 addr, u32 gsi_base);
30 int acpi_create_madt_irqoverride(struct acpi_madt_irqoverride *irqoverride,
31 u8 bus, u8 source, u32 gsirq, u16 flags);
32 int acpi_create_madt_lapic_nmi(struct acpi_madt_lapic_nmi *lapic_nmi,
33 u8 cpu, u16 flags, u8 lint);
34 u32 acpi_fill_madt(u32 current);
35 int acpi_create_mcfg_mmconfig(struct acpi_mcfg_mmconfig *mmconfig, u32 base,
36 u16 seg_nr, u8 start, u8 end);
39 * acpi_write_hpet() - Write out a HPET table
41 * Write out the table for High-Precision Event Timers
43 * @ctx: Current ACPI context
44 * Return: 0 if OK, -ve on error
46 int acpi_write_hpet(struct acpi_ctx *ctx);
49 * acpi_write_dbg2_pci_uart() - Write out a DBG2 table
51 * @ctx: Current ACPI context
52 * @dev: Debug UART device to describe
53 * @access_size: Access size for UART (e.g. ACPI_ACCESS_SIZE_DWORD_ACCESS)
54 * Return: 0 if OK, -ve on error
56 int acpi_write_dbg2_pci_uart(struct acpi_ctx *ctx, struct udevice *dev,
60 * acpi_create_gnvs() - Create a GNVS (Global Non Volatile Storage) table
62 * @gnvs: Table to fill in
63 * Return: 0 if OK, -ve on error
65 int acpi_create_gnvs(struct acpi_global_nvs *gnvs);
68 * acpi_get_rsdp_addr() - get ACPI RSDP table address
70 * This routine returns the ACPI RSDP table address in the system memory.
72 * @return: ACPI RSDP table address
74 ulong acpi_get_rsdp_addr(void);
77 * arch_read_sci_irq_select() - Read the system-control interrupt number
79 * @returns value of IRQ register in the PMC
81 int arch_read_sci_irq_select(void);
84 * arch_write_sci_irq_select() - Set the system-control interrupt number
86 * @scis: New value for IRQ register in the PMC
88 int arch_write_sci_irq_select(uint scis);
91 * arch_madt_sci_irq_polarity() - Return the priority to use for the MADT
93 * @sci: System-control interrupt number
94 * Return: priority to use (MP_IRQ_POLARITY_...)
96 int arch_madt_sci_irq_polarity(int sci);
99 * acpi_create_dmar_drhd() - Create a table for DMA remapping with the IOMMU
101 * See here for the specification
102 * https://software.intel.com/sites/default/files/managed/c5/15/vt-directed-io-spec.pdf
104 * @ctx: ACPI context pointer
105 * @flags: (DRHD_INCLUDE_...)
106 * @segment: PCI segment asscociated with this unit
107 * @bar: Base address of remapping hardware register-set for this unit
109 void acpi_create_dmar_drhd(struct acpi_ctx *ctx, uint flags, uint segment,
113 * acpi_create_dmar_rmrr() - Set up an RMRR
115 * This sets up a Reserved-Memory Region Reporting structure, used to allow
116 * DMA to regions used by devices that the BIOS controls.
118 * @ctx: ACPI context pointer
119 * @segment: PCI segment asscociated with this unit
120 * @bar: Base address of mapping
121 * @limit: End address of mapping
123 void acpi_create_dmar_rmrr(struct acpi_ctx *ctx, uint segment, u64 bar,
127 * acpi_dmar_drhd_fixup() - Set the length of an DRHD
129 * This sets the DRHD length field based on the current ctx->current
131 * @ctx: ACPI context pointer
132 * @base: Address of the start of the DRHD
134 void acpi_dmar_drhd_fixup(struct acpi_ctx *ctx, void *base);
137 * acpi_dmar_rmrr_fixup() - Set the length of an RMRR
139 * This sets the RMRR length field based on the current ctx->current
141 * @ctx: ACPI context pointer
142 * @base: Address of the start of the RMRR
144 void acpi_dmar_rmrr_fixup(struct acpi_ctx *ctx, void *base);
147 * acpi_create_dmar_ds_pci() - Set up a DMAR scope for a PCI device
149 * @ctx: ACPI context pointer
150 * @bdf: PCI device to add
151 * Return: length of mapping in bytes
153 int acpi_create_dmar_ds_pci(struct acpi_ctx *ctx, pci_dev_t bdf);
156 * acpi_create_dmar_ds_pci_br() - Set up a DMAR scope for a PCI bridge
158 * This is used to provide a mapping for a PCI bridge
160 * @ctx: ACPI context pointer
161 * @bdf: PCI device to add
162 * Return: length of mapping in bytes
164 int acpi_create_dmar_ds_pci_br(struct acpi_ctx *ctx, pci_dev_t bdf);
167 * acpi_create_dmar_ds_ioapic() - Set up a DMAR scope for an IOAPIC device
169 * @ctx: ACPI context pointer
170 * @enumeration_id: Enumeration ID (typically 2)
171 * @bdf: PCI device to add
172 * Return: length of mapping in bytes
174 int acpi_create_dmar_ds_ioapic(struct acpi_ctx *ctx, uint enumeration_id,
178 * acpi_create_dmar_ds_msi_hpet() - Set up a DMAR scope for an HPET
180 * Sets up a scope for a High-Precision Event Timer that supports
181 * Message-Signalled Interrupts
183 * @ctx: ACPI context pointer
184 * @enumeration_id: Enumeration ID (typically 0)
185 * @bdf: PCI device to add
186 * Return: length of mapping in bytes
188 int acpi_create_dmar_ds_msi_hpet(struct acpi_ctx *ctx, uint enumeration_id,
192 * acpi_fadt_common() - Handle common parts of filling out an FADT
194 * This sets up the Fixed ACPI Description Table
196 * @fadt: Pointer to place to put FADT
197 * @facs: Pointer to the FACS
198 * @dsdt: Pointer to the DSDT
200 void acpi_fadt_common(struct acpi_fadt *fadt, struct acpi_facs *facs,
204 * intel_acpi_fill_fadt() - Set up the contents of the FADT
206 * This sets up parts of the Fixed ACPI Description Table that are common to
209 * @fadt: Pointer to place to put FADT
211 void intel_acpi_fill_fadt(struct acpi_fadt *fadt);
213 #endif /* !__ACPI__ */
215 #endif /* __ASM_ACPI_TABLE_H__ */