MonkOS  v0.1
A simple 64-bit operating system (x86_64)
acpi.h File Reference

Advanced configuration and power interface (ACPI) tables. More...

#include <core.h>

Go to the source code of this file.

Data Structures

struct  acpi_hdr
 Header attached to the front of all ACPI tables. More...
 
struct  acpi_fadt
 Fixed ACPI Description Table (FADT) More...
 
struct  acpi_mcfg
 PCI express Mapped Configuration (MCFG) table. More...
 
struct  acpi_mcfg_addr
 MCFG entry, one or more of which appears at the tail of the acpi_mcfg struct. More...
 
struct  acpi_madt
 Multiple APIC description table (MADT). More...
 
struct  acpi_madt_hdr
 MADT entry header. More...
 
struct  acpi_madt_local_apic
 MADT local APIC entry. More...
 
struct  acpi_madt_io_apic
 MADT I/O APIC entry. More...
 
struct  acpi_madt_iso
 MADT Interrupt Source Override (ISO) entry. More...
 
union  acpi_hdr.signature
 

Enumerations

Functions

void acpi_init ()
 Find and parse all available ACPI tables. More...
 
int acpi_version ()
 Return the ACPI version number. More...
 
const struct acpi_fadtacpi_fadt ()
 Return a pointer to the ACPI fixed ACPI description table. More...
 
const struct acpi_madtacpi_madt ()
 Return a pointer to the ACPI multiple APIC description table (MADT). More...
 
const struct acpi_madt_local_apicacpi_next_local_apic (const struct acpi_madt_local_apic *prev)
 Return a pointer to the next Local APIC structure entry in the MADT table. More...
 
const struct acpi_madt_io_apicacpi_next_io_apic (const struct acpi_madt_io_apic *prev)
 Return a pointer to the next I/O APIC structure entry in the MADT table. More...
 
const struct acpi_madt_isoacpi_next_iso (const struct acpi_madt_iso *prev)
 Return a pointer to the next Interrupt Source Override (ISO) structure entry in the MADT table. More...
 
const struct acpi_mcfg_addracpi_next_mcfg_addr (const struct acpi_mcfg_addr *prev)
 Return a pointer to the next Mapped Configuration (MCFG) address entry, used for PCIe. More...
 

Variables

struct acpi_hdr PACKSTRUCT
 

Detailed Description

Advanced configuration and power interface (ACPI) tables.

Definition in file acpi.h.


Data Structure Documentation

struct acpi_hdr

Header attached to the front of all ACPI tables.

Definition at line 18 of file acpi.h.

Data Fields
union acpi_hdr signature
uint32_t length Length of this table including header.
uint8_t revision Revision number, should be 1.
uint8_t checksum Covers entire table.
char oemid[6] Supplied by the OEM.
char oemtableid[8] Supplied by the OEM.
uint32_t oemrevision Supplied by the OEM.
char creatorid[4] Vendor id.
uint32_t creator_revision Revision of this utility.
struct acpi_fadt

Fixed ACPI Description Table (FADT)

Definition at line 39 of file acpi.h.

Data Fields
struct acpi_hdr hdr
uint32_t firmware_ctl Pointer to FACS firmware control block.
uint32_t ptr_dsdt Pointer to DSDT block.
uint8_t reserved1 Not used.
uint8_t pm_profile Preferred power management profile.
uint16_t sci_interrupt SCI interrupt vector.
uint32_t smi_cmdport SMI command port.
uint8_t acpi_enable SMI command to disable SMI ownership.
uint8_t acpi_disable SMI command to re-enable SMI ownership.
uint8_t s4bios_req SMI command to enter S4BIOS state.
uint8_t pstate_ctl SMI command to assume perf state ctl.
uint32_t pm1a_evtblock Port of PM1a event register block.
uint32_t pm1b_evtblock Port of PM1b event register block.
uint32_t pm1a_ctlblock Port of PM1a ctl register block.
uint32_t pm1b_ctlblock Port of PM1b ctl register block.
uint32_t pm2_ctlblock Port of PM2 ctl register block.
uint32_t pmt_ctlblock Port of PM timer ctl register block.
uint32_t gpe0_block Port of general-purpose event 0 reg block.
uint32_t gpe1_block Port of general-purpose event 0 reg block.
uint8_t pm1_evt_len Bytes decoded by pm1*_evtblock.
uint8_t pm1_ctl_len Bytes decoded by pm1*_ctlblock.
uint8_t pm2_ctl_len Bytes decoded by pm2_ctlblock.
uint8_t pmt_ctl_len Bytes decoded by pmt_ctlblock.
uint8_t gpe0_len Bytes decoded by gpe0_block.
uint8_t gpe1_len Bytes decoded by gpe1_block.
uint8_t gpe1_base Offset where gpe1 events start.
uint8_t cstate_ctl SMI command for C state notifications.
uint16_t latency_c2 Worst-case us latency to enter C2 state.
uint16_t latency_c3 Worst-case us latency to enter C3 state.
uint16_t flush_size Cache reads to flush dirty cache.
uint16_t flush_stride Cache width (flush stride)
uint8_t duty_offset Index of P_CNT reg duty cycle setting.
uint8_t duty_width Width of P_CNT reg duty cycle setting.
uint8_t alarm_day RTC RAM index day-of-month alarm: day.
uint8_t alarm_month RTC RAM index day-of-month alarm: month.
uint8_t century RTC RAM index of century.
uint16_t boot_arch Boot architecture flags (ACPI 2.0+)
uint8_t reserved2 Not used.
uint32_t flags Fixed feature flags.
struct acpi_mcfg

PCI express Mapped Configuration (MCFG) table.

Definition at line 87 of file acpi.h.

Data Fields
struct acpi_hdr hdr
uint64_t reserved
struct acpi_mcfg_addr

MCFG entry, one or more of which appears at the tail of the acpi_mcfg struct.

Definition at line 99 of file acpi.h.

Data Fields
uint64_t base Base address of configuration mechanism.
uint16_t seg_group PCI segment group number.
uint8_t bus_start Start PCI bus number.
uint8_t bus_end End PCI bus number.
uint32_t reserved
struct acpi_madt

Multiple APIC description table (MADT).

Definition at line 112 of file acpi.h.

Data Fields
struct acpi_hdr hdr
uint32_t ptr_local_apic Local APIC address.
uint32_t flags APIC flags.
struct acpi_madt_hdr

MADT entry header.

Definition at line 145 of file acpi.h.

Data Fields
uint8_t type acpi_madt_type
uint8_t length Length of IC structure including header.
struct acpi_madt_local_apic

MADT local APIC entry.

Definition at line 155 of file acpi.h.

Data Fields
struct acpi_madt_hdr hdr
uint8_t procid Processor ID.
uint8_t apicid Local APIC ID.
uint32_t flags Local APIC flags (bit 0 = usable)
struct acpi_madt_io_apic

MADT I/O APIC entry.

Definition at line 168 of file acpi.h.

Data Fields
struct acpi_madt_hdr hdr
uint8_t apicid I/O APIC ID.
uint8_t reserved
uint32_t ptr_io_apic I/O APIC address.
uint32_t interrupt_base Interrupt # where interrupts start.
struct acpi_madt_iso

MADT Interrupt Source Override (ISO) entry.

Definition at line 182 of file acpi.h.

Data Fields
struct acpi_madt_hdr hdr
uint8_t bus Must be 0, meaning ISA.
uint8_t source Bus-relative source (IRQ)
uint32_t interrupt Interrupt this soruce will signal.
uint16_t flags MPS INTI flags.
union acpi_hdr.signature

Definition at line 20 of file acpi.h.

Data Fields
char bytes[4] Contains 4-letter table identifier.
uint32_t dword

Enumeration Type Documentation

MADT entry types.

Enumerator
ACPI_MADT_LOCAL_APIC 

Processor Local APIC.

ACPI_MADT_IO_APIC 

I/O APIC.

ACPI_MADT_ISO 

Interrupt Source Override.

ACPI_MADT_NMIS 

NMI Source.

ACPI_MADT_LOCAL_NMI 

Local APIC NMI.

ACPI_MADT_LOCAL_ADDR 

Local APIC Address Override.

ACPI_MADT_IO_SAPIC 

I/O SAPIC.

ACPI_MADT_LOCAL_SAPIC 

Local SAPIC.

ACPI_MADT_PLATFORM_IS 

Platform Interrupt Sources.

ACPI_MADT_LOCAL_X2APIC 

Processor Local x2APIC.

ACPI_MADT_X2APIC_NMI 

Local x2APIC NMI.

ACPI_MADT_GIC 

GIC.

ACPI_MADT_GICD 

GICD.

Definition at line 124 of file acpi.h.

Function Documentation

void acpi_init ( )

Find and parse all available ACPI tables.

Definition at line 281 of file acpi.c.

Referenced by kmain().

int acpi_version ( )

Return the ACPI version number.

Returns
The ACPI version number (1 through 5).

Definition at line 352 of file acpi.c.

const struct acpi_fadt* acpi_fadt ( )

Return a pointer to the ACPI fixed ACPI description table.

Returns
A pointer to the non-extended FADT structure.

Definition at line 358 of file acpi.c.

const struct acpi_madt* acpi_madt ( )

Return a pointer to the ACPI multiple APIC description table (MADT).

Returns
A pointer to the MADT structure.

Definition at line 364 of file acpi.c.

Referenced by cmd_display_apic().

const struct acpi_madt_local_apic* acpi_next_local_apic ( const struct acpi_madt_local_apic prev)

Return a pointer to the next Local APIC structure entry in the MADT table.

Parameters
[in]prevPointer to the local APIC returned by a previous call to this function. Pass NULL for the first call.
Returns
A pointer to a the next local APIC structure, or NULL if none remain.

Definition at line 398 of file acpi.c.

Referenced by cmd_display_apic().

const struct acpi_madt_io_apic* acpi_next_io_apic ( const struct acpi_madt_io_apic prev)

Return a pointer to the next I/O APIC structure entry in the MADT table.

Parameters
[in]prevPointer to the I/O APIC returned by a previous call to this function. Pass NULL for the first call.
Returns
A pointer to a the next I/O APIC structure, or NULL if none remain.

Definition at line 405 of file acpi.c.

Referenced by acpi_init(), and cmd_display_apic().

const struct acpi_madt_iso* acpi_next_iso ( const struct acpi_madt_iso prev)

Return a pointer to the next Interrupt Source Override (ISO) structure entry in the MADT table.

Parameters
[in]prevPointer to the ISO returned by a previous call to this function. Pass NULL for the first call.
Returns
A pointer to a the next ISO structure, or NULL if none remain.

Definition at line 412 of file acpi.c.

Referenced by cmd_display_apic().

const struct acpi_mcfg_addr* acpi_next_mcfg_addr ( const struct acpi_mcfg_addr prev)

Return a pointer to the next Mapped Configuration (MCFG) address entry, used for PCIe.

Parameters
[in]prevPointer to the MCFG entry returned by a previous call to this function. Pass NULL for the first call.
Returns
A pointer to a the next MCFG entry, or NULL if none remain.

Definition at line 419 of file acpi.c.

Referenced by cmd_display_pcie().

Variable Documentation

struct acpi_madt_iso PACKSTRUCT