2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
x86: Generate a valid ACPI table
Implement write_acpi_table() to create a minimal working ACPI table.
This includes writing FACS, XSDT, RSDP, FADT, MCFG, MADT, DSDT & SSDT
ACPI table entries.
Use a Kconfig option GENERATE_ACPI_TABLE to tell U-Boot whether we need
actually write the APCI table just like we did for PIRQ routing, MP table
and SFI tables. With ACPI table existence, linux kernel gets control of
power management, thermal management, configuration management and
monitoring in hardware.
Signed-off-by: Saket Sinha <saket.sinha89@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tidied up whitespace and aligned some tabs:
Signed-off-by: Simon Glass <sjg@chromium.org>
2015-08-22 06:50:55 +00:00
|
|
|
/*
|
|
|
|
* Based on acpi.c from coreboot
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015, Saket Sinha <saket.sinha89@gmail.com>
|
2016-05-07 14:46:22 +00:00
|
|
|
* Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com>
|
x86: Generate a valid ACPI table
Implement write_acpi_table() to create a minimal working ACPI table.
This includes writing FACS, XSDT, RSDP, FADT, MCFG, MADT, DSDT & SSDT
ACPI table entries.
Use a Kconfig option GENERATE_ACPI_TABLE to tell U-Boot whether we need
actually write the APCI table just like we did for PIRQ routing, MP table
and SFI tables. With ACPI table existence, linux kernel gets control of
power management, thermal management, configuration management and
monitoring in hardware.
Signed-off-by: Saket Sinha <saket.sinha89@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tidied up whitespace and aligned some tabs:
Signed-off-by: Simon Glass <sjg@chromium.org>
2015-08-22 06:50:55 +00:00
|
|
|
*/
|
|
|
|
|
2018-07-19 04:42:17 +00:00
|
|
|
#ifndef __ASM_ACPI_TABLE_H__
|
|
|
|
#define __ASM_ACPI_TABLE_H__
|
|
|
|
|
2020-09-22 18:45:30 +00:00
|
|
|
#ifndef __ACPI__
|
|
|
|
|
2020-10-31 03:38:53 +00:00
|
|
|
#include <pci.h>
|
|
|
|
|
2020-04-08 22:57:36 +00:00
|
|
|
struct acpi_facs;
|
|
|
|
struct acpi_fadt;
|
2016-06-17 09:13:16 +00:00
|
|
|
struct acpi_global_nvs;
|
2020-04-08 22:57:36 +00:00
|
|
|
struct acpi_madt_ioapic;
|
|
|
|
struct acpi_madt_irqoverride;
|
|
|
|
struct acpi_madt_lapic_nmi;
|
|
|
|
struct acpi_mcfg_mmconfig;
|
|
|
|
struct acpi_table_header;
|
2018-11-20 21:52:37 +00:00
|
|
|
|
x86: Generate a valid ACPI table
Implement write_acpi_table() to create a minimal working ACPI table.
This includes writing FACS, XSDT, RSDP, FADT, MCFG, MADT, DSDT & SSDT
ACPI table entries.
Use a Kconfig option GENERATE_ACPI_TABLE to tell U-Boot whether we need
actually write the APCI table just like we did for PIRQ routing, MP table
and SFI tables. With ACPI table existence, linux kernel gets control of
power management, thermal management, configuration management and
monitoring in hardware.
Signed-off-by: Saket Sinha <saket.sinha89@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tidied up whitespace and aligned some tabs:
Signed-off-by: Simon Glass <sjg@chromium.org>
2015-08-22 06:50:55 +00:00
|
|
|
/* These can be used by the target port */
|
|
|
|
|
2022-03-30 15:49:18 +00:00
|
|
|
void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
|
|
|
|
void *dsdt);
|
2016-05-07 14:46:30 +00:00
|
|
|
int acpi_create_madt_lapics(u32 current);
|
2016-05-07 14:46:25 +00:00
|
|
|
int acpi_create_madt_ioapic(struct acpi_madt_ioapic *ioapic, u8 id,
|
|
|
|
u32 addr, u32 gsi_base);
|
x86: Generate a valid ACPI table
Implement write_acpi_table() to create a minimal working ACPI table.
This includes writing FACS, XSDT, RSDP, FADT, MCFG, MADT, DSDT & SSDT
ACPI table entries.
Use a Kconfig option GENERATE_ACPI_TABLE to tell U-Boot whether we need
actually write the APCI table just like we did for PIRQ routing, MP table
and SFI tables. With ACPI table existence, linux kernel gets control of
power management, thermal management, configuration management and
monitoring in hardware.
Signed-off-by: Saket Sinha <saket.sinha89@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tidied up whitespace and aligned some tabs:
Signed-off-by: Simon Glass <sjg@chromium.org>
2015-08-22 06:50:55 +00:00
|
|
|
int acpi_create_madt_irqoverride(struct acpi_madt_irqoverride *irqoverride,
|
2016-05-07 14:46:25 +00:00
|
|
|
u8 bus, u8 source, u32 gsirq, u16 flags);
|
|
|
|
int acpi_create_madt_lapic_nmi(struct acpi_madt_lapic_nmi *lapic_nmi,
|
|
|
|
u8 cpu, u16 flags, u8 lint);
|
2016-05-07 14:46:26 +00:00
|
|
|
u32 acpi_fill_madt(u32 current);
|
2017-07-21 19:32:05 +00:00
|
|
|
int acpi_create_mcfg_mmconfig(struct acpi_mcfg_mmconfig *mmconfig, u32 base,
|
|
|
|
u16 seg_nr, u8 start, u8 end);
|
2020-07-08 03:32:05 +00:00
|
|
|
|
2020-09-22 18:45:09 +00:00
|
|
|
/**
|
|
|
|
* acpi_write_hpet() - Write out a HPET table
|
|
|
|
*
|
|
|
|
* Write out the table for High-Precision Event Timers
|
|
|
|
*
|
|
|
|
* @ctx: Current ACPI context
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: 0 if OK, -ve on error
|
2020-09-22 18:45:09 +00:00
|
|
|
*/
|
|
|
|
int acpi_write_hpet(struct acpi_ctx *ctx);
|
|
|
|
|
2020-09-22 18:45:10 +00:00
|
|
|
/**
|
|
|
|
* acpi_write_dbg2_pci_uart() - Write out a DBG2 table
|
|
|
|
*
|
|
|
|
* @ctx: Current ACPI context
|
|
|
|
* @dev: Debug UART device to describe
|
|
|
|
* @access_size: Access size for UART (e.g. ACPI_ACCESS_SIZE_DWORD_ACCESS)
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: 0 if OK, -ve on error
|
2020-09-22 18:45:10 +00:00
|
|
|
*/
|
|
|
|
int acpi_write_dbg2_pci_uart(struct acpi_ctx *ctx, struct udevice *dev,
|
|
|
|
uint access_size);
|
|
|
|
|
2020-07-08 03:32:05 +00:00
|
|
|
/**
|
|
|
|
* acpi_create_gnvs() - Create a GNVS (Global Non Volatile Storage) table
|
|
|
|
*
|
|
|
|
* @gnvs: Table to fill in
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: 0 if OK, -ve on error
|
2020-07-08 03:32:05 +00:00
|
|
|
*/
|
|
|
|
int acpi_create_gnvs(struct acpi_global_nvs *gnvs);
|
|
|
|
|
2018-01-30 13:01:16 +00:00
|
|
|
/**
|
|
|
|
* acpi_get_rsdp_addr() - get ACPI RSDP table address
|
|
|
|
*
|
|
|
|
* This routine returns the ACPI RSDP table address in the system memory.
|
|
|
|
*
|
|
|
|
* @return: ACPI RSDP table address
|
|
|
|
*/
|
|
|
|
ulong acpi_get_rsdp_addr(void);
|
2018-07-19 04:42:17 +00:00
|
|
|
|
2020-09-22 18:45:14 +00:00
|
|
|
/**
|
|
|
|
* arch_read_sci_irq_select() - Read the system-control interrupt number
|
|
|
|
*
|
|
|
|
* @returns value of IRQ register in the PMC
|
|
|
|
*/
|
|
|
|
int arch_read_sci_irq_select(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* arch_write_sci_irq_select() - Set the system-control interrupt number
|
|
|
|
*
|
|
|
|
* @scis: New value for IRQ register in the PMC
|
|
|
|
*/
|
|
|
|
int arch_write_sci_irq_select(uint scis);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* arch_madt_sci_irq_polarity() - Return the priority to use for the MADT
|
|
|
|
*
|
|
|
|
* @sci: System-control interrupt number
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: priority to use (MP_IRQ_POLARITY_...)
|
2020-09-22 18:45:14 +00:00
|
|
|
*/
|
|
|
|
int arch_madt_sci_irq_polarity(int sci);
|
|
|
|
|
2020-09-22 18:45:16 +00:00
|
|
|
/**
|
|
|
|
* acpi_create_dmar_drhd() - Create a table for DMA remapping with the IOMMU
|
|
|
|
*
|
|
|
|
* See here for the specification
|
|
|
|
* https://software.intel.com/sites/default/files/managed/c5/15/vt-directed-io-spec.pdf
|
|
|
|
*
|
|
|
|
* @ctx: ACPI context pointer
|
|
|
|
* @flags: (DRHD_INCLUDE_...)
|
|
|
|
* @segment: PCI segment asscociated with this unit
|
|
|
|
* @bar: Base address of remapping hardware register-set for this unit
|
|
|
|
*/
|
|
|
|
void acpi_create_dmar_drhd(struct acpi_ctx *ctx, uint flags, uint segment,
|
|
|
|
u64 bar);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* acpi_create_dmar_rmrr() - Set up an RMRR
|
|
|
|
*
|
|
|
|
* This sets up a Reserved-Memory Region Reporting structure, used to allow
|
|
|
|
* DMA to regions used by devices that the BIOS controls.
|
|
|
|
*
|
|
|
|
* @ctx: ACPI context pointer
|
|
|
|
* @segment: PCI segment asscociated with this unit
|
|
|
|
* @bar: Base address of mapping
|
|
|
|
* @limit: End address of mapping
|
|
|
|
*/
|
|
|
|
void acpi_create_dmar_rmrr(struct acpi_ctx *ctx, uint segment, u64 bar,
|
|
|
|
u64 limit);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* acpi_dmar_drhd_fixup() - Set the length of an DRHD
|
|
|
|
*
|
|
|
|
* This sets the DRHD length field based on the current ctx->current
|
|
|
|
*
|
|
|
|
* @ctx: ACPI context pointer
|
|
|
|
* @base: Address of the start of the DRHD
|
|
|
|
*/
|
|
|
|
void acpi_dmar_drhd_fixup(struct acpi_ctx *ctx, void *base);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* acpi_dmar_rmrr_fixup() - Set the length of an RMRR
|
|
|
|
*
|
|
|
|
* This sets the RMRR length field based on the current ctx->current
|
|
|
|
*
|
|
|
|
* @ctx: ACPI context pointer
|
|
|
|
* @base: Address of the start of the RMRR
|
|
|
|
*/
|
|
|
|
void acpi_dmar_rmrr_fixup(struct acpi_ctx *ctx, void *base);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* acpi_create_dmar_ds_pci() - Set up a DMAR scope for a PCI device
|
|
|
|
*
|
|
|
|
* @ctx: ACPI context pointer
|
|
|
|
* @bdf: PCI device to add
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: length of mapping in bytes
|
2020-09-22 18:45:16 +00:00
|
|
|
*/
|
|
|
|
int acpi_create_dmar_ds_pci(struct acpi_ctx *ctx, pci_dev_t bdf);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* acpi_create_dmar_ds_pci_br() - Set up a DMAR scope for a PCI bridge
|
|
|
|
*
|
|
|
|
* This is used to provide a mapping for a PCI bridge
|
|
|
|
*
|
|
|
|
* @ctx: ACPI context pointer
|
|
|
|
* @bdf: PCI device to add
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: length of mapping in bytes
|
2020-09-22 18:45:16 +00:00
|
|
|
*/
|
|
|
|
int acpi_create_dmar_ds_pci_br(struct acpi_ctx *ctx, pci_dev_t bdf);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* acpi_create_dmar_ds_ioapic() - Set up a DMAR scope for an IOAPIC device
|
|
|
|
*
|
|
|
|
* @ctx: ACPI context pointer
|
|
|
|
* @enumeration_id: Enumeration ID (typically 2)
|
|
|
|
* @bdf: PCI device to add
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: length of mapping in bytes
|
2020-09-22 18:45:16 +00:00
|
|
|
*/
|
|
|
|
int acpi_create_dmar_ds_ioapic(struct acpi_ctx *ctx, uint enumeration_id,
|
|
|
|
pci_dev_t bdf);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* acpi_create_dmar_ds_msi_hpet() - Set up a DMAR scope for an HPET
|
|
|
|
*
|
|
|
|
* Sets up a scope for a High-Precision Event Timer that supports
|
|
|
|
* Message-Signalled Interrupts
|
|
|
|
*
|
|
|
|
* @ctx: ACPI context pointer
|
|
|
|
* @enumeration_id: Enumeration ID (typically 0)
|
|
|
|
* @bdf: PCI device to add
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: length of mapping in bytes
|
2020-09-22 18:45:16 +00:00
|
|
|
*/
|
|
|
|
int acpi_create_dmar_ds_msi_hpet(struct acpi_ctx *ctx, uint enumeration_id,
|
|
|
|
pci_dev_t bdf);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* acpi_fadt_common() - Handle common parts of filling out an FADT
|
|
|
|
*
|
|
|
|
* This sets up the Fixed ACPI Description Table
|
|
|
|
*
|
|
|
|
* @fadt: Pointer to place to put FADT
|
|
|
|
* @facs: Pointer to the FACS
|
|
|
|
* @dsdt: Pointer to the DSDT
|
|
|
|
*/
|
|
|
|
void acpi_fadt_common(struct acpi_fadt *fadt, struct acpi_facs *facs,
|
|
|
|
void *dsdt);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* intel_acpi_fill_fadt() - Set up the contents of the FADT
|
|
|
|
*
|
|
|
|
* This sets up parts of the Fixed ACPI Description Table that are common to
|
|
|
|
* Intel chips
|
|
|
|
*
|
|
|
|
* @fadt: Pointer to place to put FADT
|
|
|
|
*/
|
|
|
|
void intel_acpi_fill_fadt(struct acpi_fadt *fadt);
|
|
|
|
|
2020-09-22 18:45:30 +00:00
|
|
|
#endif /* !__ACPI__ */
|
|
|
|
|
2018-07-19 04:42:17 +00:00
|
|
|
#endif /* __ASM_ACPI_TABLE_H__ */
|