redox-driver-sys: expose TOML quirk loaders to acpid runtime
Promote the four runtime TOML loader families from pub(crate) to pub so consumers (acpid) can call them directly at startup: * read_toml_cpu_bug_entries / parse_cpu_bug_toml / load_cpu_bug_flags * read_toml_clocksource_entries / parse_clocksource_toml / load_clocksource_flags * read_toml_chipset_entries / parse_chipset_toml / load_chipset_flags * read_toml_usb_audio_entries / parse_usb_audio_toml / load_usb_audio_flags These read /etc/quirks.d/*.toml at startup and OR-accumulate the flags. Exposing them makes the quirks system data-driven for any caller, not just compiled-in drivers. The semantics are unchanged; only the visibility bumps from pub(crate)/fn to pub. 2026 Red Bear OS.
This commit is contained in:
@@ -433,7 +433,7 @@ pub const CPU_BUG_FLAG_NAMES: &[(&str, CpuBugFlags)] = &[
|
||||
("X86_BUG_ITS", CpuBugFlags::X86_BUG_ITS),
|
||||
];
|
||||
|
||||
pub(crate) fn read_toml_cpu_bug_entries() -> std::io::Result<Vec<CpuBugQuirkEntry>> {
|
||||
pub fn read_toml_cpu_bug_entries() -> std::io::Result<Vec<CpuBugQuirkEntry>> {
|
||||
let mut entries = Vec::new();
|
||||
for path in sorted_toml_files(QUIRKS_DIR)? {
|
||||
let path_str = path.display().to_string();
|
||||
@@ -456,7 +456,7 @@ pub(crate) fn read_toml_cpu_bug_entries() -> std::io::Result<Vec<CpuBugQuirkEntr
|
||||
Ok(entries)
|
||||
}
|
||||
|
||||
fn parse_cpu_bug_toml(
|
||||
pub fn parse_cpu_bug_toml(
|
||||
doc: &toml::Value,
|
||||
out: &mut Vec<CpuBugQuirkEntry>,
|
||||
path: &str,
|
||||
@@ -502,7 +502,7 @@ fn parse_cpu_bug_toml(
|
||||
|
||||
/// Look up the CPU bug flags for a given CPUID across all
|
||||
/// runtime TOML entries. Returns the OR-accumulated flags.
|
||||
pub(crate) fn load_cpu_bug_flags(
|
||||
pub fn load_cpu_bug_flags(
|
||||
cpuid: &CpuId,
|
||||
vendor_id: u16,
|
||||
) -> CpuBugFlags {
|
||||
@@ -524,7 +524,7 @@ pub const CLOCKSOURCE_FLAG_NAMES: &[(&str, ClocksourceQuirkFlags)] = &[
|
||||
("hpet_broken", ClocksourceQuirkFlags::HPET_BROKEN),
|
||||
];
|
||||
|
||||
pub(crate) fn read_toml_clocksource_entries()
|
||||
pub fn read_toml_clocksource_entries()
|
||||
-> std::io::Result<Vec<ClocksourceQuirkEntry>> {
|
||||
let mut entries = Vec::new();
|
||||
for path in sorted_toml_files(QUIRKS_DIR)? {
|
||||
@@ -548,7 +548,7 @@ pub(crate) fn read_toml_clocksource_entries()
|
||||
Ok(entries)
|
||||
}
|
||||
|
||||
fn parse_clocksource_toml(
|
||||
pub fn parse_clocksource_toml(
|
||||
doc: &toml::Value,
|
||||
out: &mut Vec<ClocksourceQuirkEntry>,
|
||||
path: &str,
|
||||
@@ -603,7 +603,7 @@ fn parse_clocksource_toml(
|
||||
/// Look up the clocksource flags for the given PCI device
|
||||
/// (vendor, device, revision) across all runtime TOML entries.
|
||||
/// Returns the OR-accumulated flags.
|
||||
pub(crate) fn load_clocksource_flags(
|
||||
pub fn load_clocksource_flags(
|
||||
vendor: u16,
|
||||
device: u16,
|
||||
revision: u8,
|
||||
@@ -632,7 +632,7 @@ pub const CHIPSET_FLAG_NAMES: &[(&str, ChipsetQuirkFlags)] = &[
|
||||
("apple_airport_reset", ChipsetQuirkFlags::APPLE_AIRPORT_RESET),
|
||||
];
|
||||
|
||||
pub(crate) fn read_toml_chipset_entries() -> std::io::Result<Vec<ChipsetQuirkEntry>> {
|
||||
pub fn read_toml_chipset_entries() -> std::io::Result<Vec<ChipsetQuirkEntry>> {
|
||||
let mut entries = Vec::new();
|
||||
for path in sorted_toml_files(QUIRKS_DIR)? {
|
||||
let path_str = path.display().to_string();
|
||||
@@ -655,7 +655,7 @@ pub(crate) fn read_toml_chipset_entries() -> std::io::Result<Vec<ChipsetQuirkEnt
|
||||
Ok(entries)
|
||||
}
|
||||
|
||||
fn parse_chipset_toml(
|
||||
pub fn parse_chipset_toml(
|
||||
doc: &toml::Value,
|
||||
out: &mut Vec<ChipsetQuirkEntry>,
|
||||
path: &str,
|
||||
@@ -710,7 +710,7 @@ fn parse_chipset_toml(
|
||||
/// Look up the chipset flags for the given (vendor, device,
|
||||
/// class) tuple across all runtime TOML entries. Returns
|
||||
/// the OR-accumulated flags.
|
||||
pub(crate) fn load_chipset_flags(vendor: u16, device: u16, class: u16) -> ChipsetQuirkFlags {
|
||||
pub fn load_chipset_flags(vendor: u16, device: u16, class: u16) -> ChipsetQuirkFlags {
|
||||
let mut flags = ChipsetQuirkFlags::empty();
|
||||
if let Ok(entries) = read_toml_chipset_entries() {
|
||||
for entry in entries {
|
||||
@@ -754,7 +754,7 @@ pub const USB_AUDIO_FLAG_NAMES: &[(&str, UsbAudioQuirkFlags)] = &[
|
||||
("mixer_capture_linear_vol", UsbAudioQuirkFlags::MIXER_CAPTURE_LINEAR_VOL),
|
||||
];
|
||||
|
||||
pub(crate) fn read_toml_usb_audio_entries() -> std::io::Result<Vec<UsbAudioQuirkEntry>> {
|
||||
pub fn read_toml_usb_audio_entries() -> std::io::Result<Vec<UsbAudioQuirkEntry>> {
|
||||
let mut entries = Vec::new();
|
||||
for path in sorted_toml_files(QUIRKS_DIR)? {
|
||||
let path_str = path.display().to_string();
|
||||
@@ -777,7 +777,7 @@ pub(crate) fn read_toml_usb_audio_entries() -> std::io::Result<Vec<UsbAudioQuirk
|
||||
Ok(entries)
|
||||
}
|
||||
|
||||
fn parse_usb_audio_toml(
|
||||
pub fn parse_usb_audio_toml(
|
||||
doc: &toml::Value,
|
||||
out: &mut Vec<UsbAudioQuirkEntry>,
|
||||
path: &str,
|
||||
@@ -811,7 +811,7 @@ fn parse_usb_audio_toml(
|
||||
|
||||
/// Look up the USB audio flags for the given (vendor, product)
|
||||
/// tuple across all runtime TOML entries.
|
||||
pub(crate) fn load_usb_audio_flags(vendor: u16, product: u16) -> UsbAudioQuirkFlags {
|
||||
pub fn load_usb_audio_flags(vendor: u16, product: u16) -> UsbAudioQuirkFlags {
|
||||
let mut flags = UsbAudioQuirkFlags::empty();
|
||||
if let Ok(entries) = read_toml_usb_audio_entries() {
|
||||
for entry in entries {
|
||||
|
||||
Reference in New Issue
Block a user