Commit Graph

5 Commits

Author SHA1 Message Date
Red Bear OS 3ba37444a0 acpi-rs: add connect_op_regions() + repair initialize_namespace
Add public connect_op_regions() (ACPICA evrgnini.c): \_SB._REG(space, 1)
per installed handler space plus <device>._REG(space, 1) per device holding
an OpRegion of that space. initialize_namespace() now delegates to it and
its ACPICA-order opening (_INI, _SB._INI) is restored after 0c11c2b5
captured a broken intermediate edit. Completes the _REG wiring begun in
c3a27717 (which delivered the acpid-side call).
2026-07-24 10:01:12 +09:00
Red Bear OS 0c11c2b515 retire pcid-spawner: remove crate, service files, and build wiring
Operator-ratified full retirement — driver-manager superseded
pcid-spawner in every role (boot-time PCI match/claim/spawn, initfs
storage path, hotplug). Removes:
- drivers/pcid-spawner/ crate (source preserved in git history)
- init.d/00_pcid-spawner.service and
  init.initfs.d/40_pcid-spawner-initfs.service
- Cargo workspace member + Makefile bin entries
- 40_drivers.target reference to pcid-spawner-initfs
- the /etc/driver-manager.d/disabled fallback gates on driver-manager
  services (no fallback exists anymore; driver-manager runs
  unconditionally)
2026-07-24 08:47:02 +09:00
Red Bear OS b5f84b44df acpid/acpi-rs: _REG opregion connect + LPIT parse fix + thermal active + PM timer + HW-reduced + GPE dispatch
acpi-rs (vendored fork):
- _REG opregion connect (ACPICA evrgnini.c): run \_SB._REG(space, 1)
  per installed handler after \_INI — firmware gates EC access behind
  this. Device-level _REG for each device holding an OpRegion of an
  installed space. Fills the last big TODO in initialize_namespace.
- RegionSpace: add From<RegionSpace> for u8 (region-space ID for _REG).

acpid:
- LPIT parser BUG FIX: GAS (Generic Address Structure) is 12 bytes
  (4-byte header + 8-byte address); the parser previously read
  entry_trigger/residency/latency/counter_frequency 4 bytes early and
  required length>=48 instead of 56. Fixed offsets, added
  entry_trigger_space_id, and mwait_hint()/best_mwait_hint() for the
  FFH MWAIT hint. Tests rewritten with correct 56-byte layout.
- Thermal active cooling: /scheme/acpi/thermal/<zone>/active evaluates
  _AC0.._AC9 and returns defined trip points (tenths of K).
- ACPI PM timer: pm_timer_read() from FADT pm_timer_block;
  /scheme/acpi/pmtimer endpoint (3.579545 MHz).
- HW-reduced ACPI: Fadt::is_hardware_reduced() (FADT bit 20); skip
  PM1/GPE setup on such platforms.
- General GPE dispatch: enabled_active_gpes() + \_GPE._Lxx/_Exx method
  evaluation (evgpe.c acpi_ev_gpe_detect).
2026-07-22 22:08:23 +09:00
Red Bear OS 6571df7802 acpi-rs: eliminate all AML stubs (resource descriptors, ConnectionField, Match, Index ref)
resource.rs — implement all ~20 stubbed resource descriptor parsers:
  - QWord/DWord/Word AddressSpace, IRQ, DMA, I/O, FixedI/O, FixedDMA
  - StartDependentFunctions, VendorDefined (small+large)
  - GPIOConnection, GenericSerialBus (I2C/SPI/UART subtypes)
  - PinFunction, PinConfiguration, PinGroup, PinGroupFunction, PinGroupConfiguration
  - ExtendedAddressSpace, GenericRegister
  - Both large/small dispatch tables now call real parsers
  - ACPI 6.5 §6.4 coverage complete, cross-referenced with ACPICA amlresrc.h

mod.rs — eliminate 3 remaining stubs:
  - ConnectionField in parse_field_list: namestring + inline buffer forms
  - Opcode::Match: full opcode handler with ResolveBehaviour::ByteData intercept,
    10-arg OpInFlight, do_match executor with 7 match operators
  - ReferenceKind::Index in do_copy_object: merged with Named/Local path

virtio-core: replace arch stubs (aarch64, riscv64) with real Error::Probe returns

usbscsid/uas: full UAS transport implementation (1006 lines) replacing
stub-heavy version — IUs, pipe detection, stream/non-stream modes,
task tag management, cross-referenced with Linux 7.1 uas.c

initnsmgr: Rc<RefCell<>> -> Arc<Mutex<>> for namespace concurrency safety

xhcid/quirks: fix comment (3 hci_version-dependent entries, not 2)

cargo check -p acpi: clean (3 pre-existing warnings only)
cargo test -p acpi --lib: 5/5 pass
2026-07-22 05:00:29 +09:00
Red Bear OS f315a9be3b acpid + i2c-hidd: Phase 5 (GPE/EC/lid/buttons/fan) + Phase 4.4 (HID descriptor parser)
Phase 5 — Laptop ACPI events (LG Gram 16Z90TP compatibility plan):
- Vendor acpi-rs crate (rev 90cbe88) into base fork with a real
  Opcode::Notify executor; upstream panicked on every Notify opcode,
  which is the backbone of ACPI event flow on real laptop firmware.
  Handler::handle_notify hook added; acpid + amlserde pointed at the
  path dep so every consumer sees the same fork.
- gpe.rs: FADT-driven GPE block register map (status half + enable
  half), write-1-to-clear status bits, read-modify-write enable
  preserving every other GPE's firmware state. PM1 fixed-event bits
  (PWRBTN/SLPBTN/RTC) per ACPI 6.4 §4.8.3.1.
- power_events.rs: init builds the GPE map, discovers the EC via ECDT
  (ACPI 6.4 §5.2.16) with a _HID=PNP0C09 probe fallback over conven-
  tional paths, enables the EC GPE + PM1 fixed events, discovers lid
  and ACPI 4.0 fan devices. handle_sci dispatches PM1 → EC query loop
  (bounded at 32) → AML notification drain, following Linux 7.1
  evgpe.c / ec.c / button.c.
- notifications.rs: shared AmlNotifications queue (parking_lot::Mutex)
  populated by the vendored acpi-rs handle_notify hook, drained by the
  SCI handler and redbear-upower.
- ec.rs: sci_evt_set() and query() exposed on Ec for the SCI handler.
- scheme.rs: new handle kinds Lid, LidState, ButtonDir, Button,
  Notifications, Fan, FanState, FanSpeed with proper dir/file
  separation. Fan _FST on read, _FSL on write (percent clamped 0-100).
- main.rs: subscribes /scheme/irq/{sci_irq} (default 9) on the event
  queue, dispatches SCI events through handle_sci. PowerButton incre-
  ments edge counter and triggers the shutdown path; SleepButton incre-
  ments counter and calls enter_s2idle.
- acpi.rs: AcpiContext gained gpe, ec_device, lid_device, lid_state,
  power_button_events, sleep_button_events, fan_devices fields (all
  RwLock-guarded). evaluate_acpi_method and enter_s2idle changed from
  &mut self to &self (AML mutation goes through RwLock inner state).
- aml_physmem.rs: handle_notify impl pushes onto the shared queue.

Phase 4.4 — HID report descriptor parser (i2c-hidd):
- report_desc.rs: HID 1.11 §6.2.2 descriptor parser + decoder. Global-
  state stack (Push/Pop), usage-min/max expansion, sign-extended
  fields, contact reconstruction (id, tip, x, y). 3 unit tests.
- input.rs: forward_layout_report dispatches descriptor-driven reports
  through forward_decoded: first touching contact → absolute
  MouseEvent; two simultaneous contacts → vertical ScrollEvent (two-
  finger scroll); buttons → ButtonEvent; keyboard-page reports fall
  back to the existing boot-protocol path.
- hid.rs: stream_input_reports parses the descriptor once and uses
  forward_layout_report when layouts are non-empty, otherwise keeps the
  boot-protocol summary path.

Reference: Linux 7.1 drivers/acpi/{evgpeblk.c,evgpe.c,ec.c,button.c}
and drivers/hid/hid-core.c.

All affected crates compile for x86_64-unknown-redox; i2c-hidd 3/3
unit tests pass on host; acpid host-side tests still can't link
(pre-existing libredox limitation — must run via redoxer).
2026-07-21 21:36:07 +09:00