Skip to content

Commit 87e2cae

Browse files
timw-rivosrbradford
authored andcommitted
acpi_tables: Add Register resource descriptor
Signed-off-by: Tim Wawrzynczak <tim@rivosinc.com>
1 parent 62895ef commit 87e2cae

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/aml.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
extern crate alloc;
88

9-
use crate::{Aml, AmlSink};
9+
use crate::{gas, Aml, AmlSink};
1010
use alloc::string::String;
1111
use alloc::{vec, vec::Vec};
1212

@@ -78,6 +78,7 @@ const ONESOP: u8 = 0xff;
7878
// AML resouce data fields
7979
const IOPORTDESC: u8 = 0x47;
8080
const ENDTAG: u8 = 0x79;
81+
const REGDESC: u8 = 0x82;
8182
const MEMORY32FIXEDDESC: u8 = 0x86;
8283
const DWORDADDRSPACEDESC: u8 = 0x87;
8384
const WORDADDRSPACEDESC: u8 = 0x88;
@@ -772,6 +773,25 @@ impl Aml for Interrupt {
772773
}
773774
}
774775

776+
/// Register resource object
777+
pub struct Register {
778+
reg: gas::GAS,
779+
}
780+
781+
impl Register {
782+
pub fn new(reg: gas::GAS) -> Self {
783+
Self { reg }
784+
}
785+
}
786+
787+
impl Aml for Register {
788+
fn to_aml_bytes(&self, sink: &mut dyn AmlSink) {
789+
sink.byte(REGDESC); /* Register Descriptor */
790+
sink.word(0x12); // length
791+
self.reg.to_aml_bytes(sink);
792+
}
793+
}
794+
775795
/// Device object with its device name and children objects in it.
776796
pub struct Device<'a> {
777797
path: Path,

0 commit comments

Comments
 (0)