Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

kernel: iopmroot bridge driver -- IOPMrootDomain0 node and /dev/iopmroot user client for sleep request, acknowledgement and state

Aperta
#243 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
70/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c

Direzione di ricerca

Start by creating the three new files outlined in the design: the kernel driver src-overlay/sys/dev/iokit/iokit_pmroot.c, the ABI header src-overlay/sys/sys/iopmroot.h, and the config entry src-overlay/conf/files.iopmroot. Implement the IOPMrootDomain0 pseudo-device, /dev/iopmroot user client with the specified ioctl handlers, property publishing, and event subscriptions as described. Validate your work against the acceptance criteria: confirm the node appears in ioreg -c IOPMrootDomain, test the full sleep request/acknowledgement/S3/resume flow in QEMU, and verify that an error acknowledgement cancels sleep.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:power enhancement

Summary

The kernel half of "pmconfigd plays IOPMrootDomain". A new pseudo-driver publishes the node Apple's code looks for, and a character device stands in for RootDomainUserClient.

Design

New src-overlay/sys/dev/iokit/iokit_pmroot.c (~800-1000 LOC), src-overlay/sys/sys/iopmroot.h (ABI), src-overlay/conf/files.iopmroot -- all standard, no module.

  • Node: a newbus pseudo-device IOPMrootDomain0 (child of acpi0 on x86, of nexus0 elsewhere), so iokit_registry.c mints it an id with no registry changes and IOServiceMatching("IOPMrootDomain") matches by class name
  • /dev/iopmroot (root:operator 0660), one open per pmconfigd; the fd carries the K1 listener registration:
    • IOPMROOT_SLEEP{reason} -> records reason/PID, calls acpi_ReqSleepState(sc, suspend_sx)
    • IOPMROOT_ACK{serial, allow|errno} -> acpi_AckSleepState(sc->acpi_clone, ...); an error cancels (clears acpi_next_sstate)
    • IOPMROOT_GETSTATE (sleep supported, clamshell, AC, last sleep/wake reason), IOPMROOT_SETCLAMSHELLSLEEP, IOPMROOT_SETPROP (System Shutdown -> kern.suspend_blocked; SleepDisabled)
  • Subscribes: the K1 listener (Suspend), power_suspend_early (stamp sleep time / UUID), power_resume (wake), acpi_acad_event, acpi_sleep_event / acpi_wakeup_event, and the K3 hook for Lid, Button, CMBAT, Thermal
  • Publishes on the node (via K5): Last Sleep Reason, Wake Reason, Wake Type, AppleClamshellState, AppleClamshellCausesSleep, IOPMSystemSleepType = 2, IOSleepSupported (from hw.acpi.supported_sleep_state), Supported Features, SleepWakeUUID, System Capabilities
  • Emits (via K6): "sleep requested {serial, reason}", "did wake", kIOPMMessageClamshellStateChange, kIOPMMessageSystemPowerEventOccurred (thermal 0xcc)
  • Timestamps: kern.sleeptime / kern.waketime with xnu semantics, which pmconfigd and IOPMGetLastWakeTime read and FreeBSD lacks

The kernel mints the acknowledgement serial even in v1, so it already has its final meaning if R1 moves the fan-out into the kernel.

Acceptance

  • ioreg -c IOPMrootDomain shows the node and its properties
  • a sleep request -> listener message -> IOPMROOT_ACK -> S3 -> resume -> "did wake", in QEMU
  • IOPMROOT_ACK with an error cancels the sleep

K4 in epic nextbsd/nextbsd#490 (E17 Power management). Depends on: nextbsd/nextbsd-kernel#238 (K1), nextbsd/nextbsd-kernel#240 (K3), nextbsd/nextbsd-kernel#241 (K5), nextbsd/nextbsd-kernel#242 (K6).

Plan: https://pkgdemon.github.io/nextbsd-power-management-plan.html · Draft: https://pkgdemon.github.io/nextbsd-e17-tickets.html#k4

Lingua principale
C
Stelle
12
Fork
3
Merge medio
2h 9m
PR unite (30g)
74

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nextbsd/nextbsd-kernel

Tutte le issue di nextbsd/nextbsd-kernel

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.