Struct Dsdt

Source
pub struct Dsdt { /* private fields */ }

Implementations§

Source§

impl Dsdt

Source

pub fn new() -> Self

Source

pub fn to_bytes(&self) -> Vec<u8>

Source

pub fn add_object(&mut self, obj: &impl DsdtObject)

Source

pub fn add_apic(&mut self)

Add an APIC device to the DSDT with the following ASL code:

Device(\_SB.APIC)
{
    Name(_HID, EISAID("PNP0003"))
    Name(_CRS,
        ResourceTemplate()
        {
            Memory32Fixed(ReadWrite, 0xfee00000, 0x1000)
            Memory32Fixed(ReadWrite, 0xfec00000, 0x1000)
        })
}
Source

pub fn add_uart( &mut self, name: &[u8], ddn: &[u8], uid: u64, io_base: u16, irq: u32, )

Add a 16650A compatible UART to the DSDT with the following ASL code:

Device(<name>)
{
    Name(_HID, EISAID("PNP0501")) // 16550A-compatible COM port
    Name(_DDN, <ddn>)
    Name(_UID, <uid>)
    Name(_CRS, ResourceTemplate()
    {
        IO(Decode16, <io_base>, <io_base>, 1, 8)
        Interrupt(ResourceConsumer, Edge, ActiveHigh, Exclusive)
            {<irq>}
    })
}
Source

pub fn add_mmio_module(&mut self, low: MemoryRange, high: MemoryRange)

Add an ACPI module device to describe the low and high MMIO regions. This is used when PCI is not present so that VMBus can find MMIO space.

Device(\_SB.VMOD)
{
    Name(_HID, "ACPI0004")
    Name(_UID, 0)
    Name(_CRS, ResourceTemplate()
    {
        // Low gap
        QWORDMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
        // Granularity Min          Max T       Translation Range (Length = Max-Min+1)
            0,         <low_min>,   <low_max>,  0,          <dynamic>,,,
            MEM6)   // Name declaration for this descriptor

        // High gap
        QWORDMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
        // Granularity Min          Max T       Translation Range (Length = Max-Min+1)
            0,         <high_min>,  <high_max>, 0,          <dynamic>,,,
            MEM6)   // Name declaration for this descriptor
    })
}
Source

pub fn add_pci( &mut self, low: MemoryRange, high: MemoryRange, legacy_interrupts: &[((u8, Option<u8>), u32)], )

Adds a PCI bus with the specified MMIO ranges.

Device(\_SB.PCI0)
{
    Name(_HID, PNP0A03)
    Name(_CRS, ResourceTemplate()
    {
        WordBusNumber(...) // Bus translation info
        IO(Decode16, 0xcf8, 0xcf8) // IO port
        QWordMemory() // Low gap
        QWordMemory() // High gap
    })
    // PCI routing table
    Name(_PRT, Package{
        Package{<address>, <PCI pin>, 0, <interrupt>},
        ...
    })
}
Source

pub fn add_vmbus(&mut self, in_pci: bool)

Add a VMBUS device to the DSDT.

If in_pci, then enumerate the device under PCI0. Otherwise, enumerate it under the VMOD module created by add_mmio_module.

Device(\_SB.VMOD.VMBS)
{
    Name(STA, 0xF)
    Name(_ADR, 0x00)
    Name(_DDN, "VMBUS")
    Name(_HID, "VMBus")
    Name(_UID, 0)
    Method(_DIS, 0) { And(STA, 0xD, STA) }
    Method(_PS0, 0) { Or(STA, 0xF, STA) }
    Method(_STA, 0)
    {
        return(STA)
    }

    Name(_PS3, 0)
}
Source

pub fn add_rtc(&mut self)

Add an RTC device with the following ASL code:

Device(\_SB.RTC0)
{
    Name(_HID, EISAID("PNP0B00")) // AT real-time clock
    Name(_UID, 0)
    Name(_CRS, ResourceTemplate()
    {
        IO(Decode16, 0x70, 0x70, 0, 0x2)
        Interrupt(ResourceConsumer, Edge, ActiveHigh, Exclusive) {8}
    })
}

Auto Trait Implementations§

§

impl Freeze for Dsdt

§

impl RefUnwindSafe for Dsdt

§

impl Send for Dsdt

§

impl Sync for Dsdt

§

impl Unpin for Dsdt

§

impl UnwindSafe for Dsdt

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more