Documentation
¶
Overview ¶
Package acpi reads, modifies, and writes ACPI tables.
acpi is designed to support copying individual tables or a blob containing many tables from one spot to another, supporting filtering. For example, one might read tables from /dev/mem, using the RSDP, so as to create an ACPI table blob for use in coreboot. In this case, we only care about checking the signature.
Index ¶
- Variables
- func MethodNames() []string
- func NewRSDP(addr uintptr, length uint) []byte
- func String(t Table) string
- func WriteTables(w io.Writer, tab Table, tabs ...Table) error
- type BiosTable
- type RSDP
- type Raw
- func (r *Raw) Address() int64
- func (r *Raw) CheckSum() uint8
- func (r *Raw) CreatorID() uint32
- func (r *Raw) CreatorRevision() uint32
- func (r *Raw) Data() []byte
- func (r *Raw) Len() uint32
- func (r *Raw) OEMID() string
- func (r *Raw) OEMRevision() uint32
- func (r *Raw) OEMTableID() string
- func (r *Raw) Revision() uint8
- func (r *Raw) Sig() string
- func (r *Raw) TableData() []byte
- type SDT
- type Table
- func GetTable() (string, []Table, error)
- func NewRaw(b []byte) ([]Table, error)
- func RawFromFile(r io.Reader) ([]Table, error)
- func RawFromName(n string) ([]Table, error)
- func RawTablesFromMem() ([]Table, error)
- func RawTablesFromSys() ([]Table, error)
- func ReadRawTable(physAddr int64) (Table, error)
- func ReadTables(n string) ([]Table, error)
- type TableMethod
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultMethod is the name of the default method used to get tables. DefaultMethod = "files" // Methods is the map of all methods implemented for Linux. Methods = map[string]TableMethod{ "files": RawTablesFromSys, "ebda": RawTablesFromMem, } )
var Debug = func(string, ...any) {}
Debug enables various debug prints. External code can set it to, e.g., log.Printf
Functions ¶
func MethodNames ¶ added in v0.7.0
func MethodNames() []string
MethodNames returns the list of supported MethodNames.
Types ¶
type BiosTable ¶ added in v0.7.0
BiosTable contains the information needed to create table images for firmware such as coreboot or oreboot. It hence includes the RSDP, [XR]SDT, and the raw table data. The *SDT is always Tables[0] as in the real tables.
func ReadBiosTables ¶ added in v0.7.0
ReadBiosTables reads tables that are not interpreted by the OS, i.e. it goes straight to memory and gets them there. We optimistically hope the bios has not stomped around in low memory messing around.
type RSDP ¶
type RSDP struct {
// contains filtered or unexported fields
}
RSDP is the v2 version of the ACPI RSDP struct.
func GetRSDP ¶
GetRSDP finds the RSDP pointer and struct. The rsdpgetters must be defined in rsdp_$(GOOS).go, since, e.g.,OSX, BSD, and Linux have some intersections but some unique aspects too, and Plan 9 has nothing in common with any of them.
It is able to use several methods, because there is no consistency about how it is done.
func GetRSDPEBDA ¶ added in v0.7.0
GetRSDPEBDA finds the RSDP in the EBDA.
func GetRSDPEFI ¶ added in v0.7.0
GetRSDPEFI finds the RSDP in the EFI System Table.
func GetRSDPMem ¶ added in v0.7.0
GetRSDPMem is the option of last choice, it just grovels through the e0000-ffff0 area, 16 bytes at a time, trying to find an RSDP. These are well-known addresses for 20+ years.
type Raw ¶
type Raw struct {
// contains filtered or unexported fields
}
Raw is just a table embedded in a []byte. Operations on Raw are for figuring out how to skip a table you don't care about or, possibly, truncating a table and regenerating a checksum.
func (*Raw) CreatorRevision ¶
CreatorRevision returns the table CreatorRevision.
func (*Raw) OEMRevision ¶
OEMRevision returns the table OEMRevision.
type SDT ¶
type SDT struct {
// Table is the SDT itself.
Table
// Addrs is the array of physical addresses in the SDT.
Addrs []int64
// Base is the SDT base, used to generate a new SDT for, e.g, coreboot.
Base int64
}
SDT contains information about tables. It does not differentiate 32- vs 64-bit tables.
func NewSDTAddr ¶ added in v0.7.0
NewSDTAddr returns an SDT, given an address.
type Table ¶ added in v0.7.0
type Table interface {
Sig() string
Len() uint32
Revision() uint8
CheckSum() uint8
OEMID() string
OEMTableID() string
OEMRevision() uint32
CreatorID() uint32
CreatorRevision() uint32
Data() []byte
TableData() []byte
Address() int64
}
Table is an individual ACPI table.
func RawFromFile ¶
RawFromFile reads from an io.Reader and returns a []Table and error if any.
func RawFromName ¶ added in v0.7.0
RawFromName reads a raw []Table in from a named file.
func RawTablesFromMem ¶ added in v0.7.0
RawTablesFromMem reads all the tables from Mem, using the SDT.
func RawTablesFromSys ¶ added in v0.7.0
RawTablesFromSys returns an array of Raw tables, for all ACPI tables available in /sys.
func ReadRawTable ¶ added in v0.7.0
ReadRawTable reads a full table in, given an address.
ReadRawTable uses the io package. This may not always work if the kernel has restrictions on reading memory above the 1M boundary, and the tables are above boundary.
func ReadTables ¶ added in v0.7.0
ReadTables reads tables, given a method name.
type TableMethod ¶ added in v0.7.0
TableMethod defines the type of functions used to read a table.
func Method ¶ added in v0.7.0
func Method(n string) (TableMethod, error)
Method accepts a method name and returns a TableMethod if one exists, or error othewise.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fpdt reads FPDT ACPI table and gets FPDT record information
|
Package fpdt reads FPDT ACPI table and gets FPDT record information |
|
fbpt
Package fbpt reads Firmware Basic Performance Table within ACPI FPDT Table.
|
Package fbpt reads Firmware Basic Performance Table within ACPI FPDT Table. |