20
20
//! default configuration of the crate.
21
21
//!
22
22
//! ### Usage
23
- //! To use the library, you will need to provide an implementation of the `AcpiHandler` trait, which allows the
23
+ //! To use the library, you will need to provide an implementation of the [ `AcpiHandler`] trait, which allows the
24
24
//! library to make requests such as mapping a particular region of physical memory into the virtual address space.
25
25
//!
26
- //! You then need to construct an instance of `AcpiTables`, which can be done in a few ways depending on how much
26
+ //! You then need to construct an instance of [ `AcpiTables`] , which can be done in a few ways depending on how much
27
27
//! information you have:
28
- //! * Use `AcpiTables::from_rsdp` if you have the physical address of the RSDP
29
- //! * Use `AcpiTables::from_rsdt` if you have the physical address of the RSDT/XSDT
30
- //! * Use `AcpiTables::search_for_rsdp_bios` if you don't have the address of either, but **you know you are
31
- //! running on BIOS, not UEFI**
32
- //! * Use `AcpiTables::from_tables_direct` if you are using the library in an unusual setting, such as in usermode,
33
- //! and have a custom method to enumerate and access the tables.
28
+ //! * Use [`AcpiTables::from_rsdp`] if you have the physical address of the RSDP
29
+ //! * Use [`AcpiTables::from_rsdt`] if you have the physical address of the RSDT/XSDT
30
+ //! * Use [`AcpiTables::search_for_rsdp_bios`] if you don't have the address of either, but **you know you are
31
+ //! running on BIOS, not UEFI**
34
32
//!
35
33
//! `AcpiTables` stores the addresses of all of the tables detected on a platform. The SDTs are parsed by this
36
34
//! library, or can be accessed directly with `from_sdt`, while the `DSDT` and any `SSDTs` should be parsed with
37
35
//! `aml`.
38
36
//!
39
37
//! To gather information out of the static tables, a few of the types you should take a look at are:
40
- //! - [`PlatformInfo`](crate::platform::PlatformInfo) parses the FADT and MADT to create a nice view of the
41
- //! processor topology and interrupt controllers on `x86_64`, and the interrupt controllers on other platforms.
42
- //! `AcpiTables::platform_info` is a convenience method for constructing a `PlatformInfo`.
43
- //! - [`HpetInfo`](crate::hpet::HpetInfo) parses the HPET table and tells you how to configure the High
44
- //! Precision Event Timer.
45
- //! - [`PciConfigRegions`](crate::mcfg::PciConfigRegions) parses the MCFG and tells you how PCIe configuration
46
- //! space is mapped into physical memory.
38
+ //! - [`PlatformInfo`] parses the FADT and MADT to create a nice view of the processor topology and interrupt
39
+ //! controllers on `x86_64`, and the interrupt controllers on other platforms.
40
+ //! [`AcpiTables::platform_info`] is a convenience method for constructing a `PlatformInfo`.
41
+ //! - [`HpetInfo`] parses the HPET table and tells you how to configure the High Precision Event Timer.
42
+ //! - [`PciConfigRegions`] parses the MCFG and tells you how PCIe configuration space is mapped into physical
43
+ //! memory.
47
44
48
45
/*
49
46
* Contributing notes (you may find these useful if you're new to contributing to the library):
@@ -206,7 +203,9 @@ where
206
203
{
207
204
/// Create an `AcpiTables` if you have the physical address of the RSDP.
208
205
///
209
- /// ### Safety: Caller must ensure the provided address is valid to read as an RSDP.
206
+ /// ### Safety
207
+ ///
208
+ /// Caller must ensure the provided address is valid to read as an RSDP.
210
209
pub unsafe fn from_rsdp ( handler : H , address : usize ) -> AcpiResult < Self > {
211
210
let rsdp_mapping = unsafe { handler. map_physical_region :: < Rsdp > ( address, mem:: size_of :: < Rsdp > ( ) ) } ;
212
211
rsdp_mapping. validate ( ) ?;
@@ -216,8 +215,12 @@ where
216
215
}
217
216
218
217
/// Search for the RSDP on a BIOS platform. This accesses BIOS-specific memory locations and will probably not
219
- /// work on UEFI platforms. See [Rsdp::search_for_rsdp_bios](rsdp_search::Rsdp::search_for_rsdp_bios) for
218
+ /// work on UEFI platforms. See [` Rsdp::search_for_on_bios`] for details.
220
219
/// details.
220
+ ///
221
+ /// ### Safety
222
+ ///
223
+ /// The caller must ensure that this function is called on BIOS platforms.
221
224
pub unsafe fn search_for_rsdp_bios ( handler : H ) -> AcpiResult < Self > {
222
225
let rsdp_mapping = unsafe { Rsdp :: search_for_on_bios ( handler. clone ( ) ) ? } ;
223
226
// Safety: RSDP has been validated from `Rsdp::search_for_on_bios`
@@ -234,7 +237,9 @@ where
234
237
/// from `from_rsdp` after validation, but can also be used if you've searched for the RSDP manually on a BIOS
235
238
/// system.
236
239
///
237
- /// ### Safety: Caller must ensure that the provided mapping is a fully validated RSDP.
240
+ /// ### Safety
241
+ ///
242
+ /// Caller must ensure that the provided mapping is a fully validated RSDP.
238
243
pub unsafe fn from_validated_rsdp ( handler : H , rsdp_mapping : PhysicalMapping < H , Rsdp > ) -> AcpiResult < Self > {
239
244
let revision = rsdp_mapping. revision ( ) ;
240
245
let root_table_mapping = if revision == 0 {
@@ -259,7 +264,9 @@ where
259
264
260
265
/// Create an `AcpiTables` if you have the physical address of the RSDT/XSDT.
261
266
///
262
- /// ### Safety: Caller must ensure the provided address is valid RSDT/XSDT address.
267
+ /// ### Safety
268
+ ///
269
+ /// Caller must ensure the provided address is valid RSDT/XSDT address.
263
270
pub unsafe fn from_rsdt ( handler : H , revision : u8 , address : usize ) -> AcpiResult < Self > {
264
271
let root_table_mapping = if revision == 0 {
265
272
/*
@@ -404,19 +411,17 @@ where
404
411
Ok ( ( ) )
405
412
}
406
413
407
- /// Convenience method for contructing a [`PlatformInfo`](crate::platform::PlatformInfo). This is one of the
408
- /// first things you should usually do with an `AcpiTables`, and allows to collect helpful information about
409
- /// the platform from the ACPI tables.
414
+ /// Convenience method for contructing a [`PlatformInfo`]. This is one of the first things you should usually do
415
+ /// with an `AcpiTables`, and allows to collect helpful information about the platform from the ACPI tables.
410
416
///
411
- /// Like `platform_info_in`, but uses the global allocator.
417
+ /// Like [ `platform_info_in`](Self::platform_info_in) , but uses the global allocator.
412
418
#[ cfg( feature = "alloc" ) ]
413
419
pub fn platform_info ( & self ) -> AcpiResult < PlatformInfo < alloc:: alloc:: Global > > {
414
420
PlatformInfo :: new ( self )
415
421
}
416
422
417
- /// Convenience method for contructing a [`PlatformInfo`](crate::platform::PlatformInfo). This is one of the
418
- /// first things you should usually do with an `AcpiTables`, and allows to collect helpful information about
419
- /// the platform from the ACPI tables.
423
+ /// Convenience method for contructing a [`PlatformInfo`]. This is one of the first things you should usually do
424
+ /// with an `AcpiTables`, and allows to collect helpful information about the platform from the ACPI tables.
420
425
#[ cfg( feature = "allocator_api" ) ]
421
426
pub fn platform_info_in < A > ( & self , allocator : A ) -> AcpiResult < PlatformInfo < A > >
422
427
where
@@ -457,7 +462,9 @@ impl AmlTable {
457
462
}
458
463
}
459
464
460
- /// ### Safety: Caller must ensure the provided address is valid for being read as an `SdtHeader`.
465
+ /// ### Safety
466
+ ///
467
+ /// Caller must ensure the provided address is valid for being read as an `SdtHeader`.
461
468
unsafe fn read_table < H : AcpiHandler , T : AcpiTable > (
462
469
handler : H ,
463
470
address : usize ,
@@ -480,7 +487,7 @@ where
480
487
handler : H ,
481
488
}
482
489
483
- impl < ' t , H > Iterator for SsdtIterator < ' t , H >
490
+ impl < H > Iterator for SsdtIterator < ' _ , H >
484
491
where
485
492
H : AcpiHandler ,
486
493
{
@@ -528,7 +535,7 @@ where
528
535
handler : H ,
529
536
}
530
537
531
- impl < ' t , H > Iterator for SdtHeaderIterator < ' t , H >
538
+ impl < H > Iterator for SdtHeaderIterator < ' _ , H >
532
539
where
533
540
H : AcpiHandler ,
534
541
{
0 commit comments