This will be useful for writing device specific ACPI tables or DSDT
methods.
Details
Details
- Reviewers
jhb markj - Group Reviewers
bhyve - Commits
- rG9c8a0c311a96: bhyve: save softc of ACPI devices
rG158adced65f8: bhyve: save softc of ACPI devices
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 50652 Build 47543: arc lint + arc unit
Event Timeline
Comment Actions
- update commnent as suggested
- make use of assert
- pass fwcfg_sc as parent to acpi_device_create
usr.sbin/bhyve/acpi_device.h | ||
---|---|---|
31 | But it's not (necessarily) an ACPI device. The type is void * and the one caller passes a device softc. Is "parent" really the right name? Should it just be an opaque "context" field? |
usr.sbin/bhyve/acpi_device.h | ||
---|---|---|
31 | Renaming this parameter is fine but I don't know which word fits best. In C++ this would be solved by inheritance. E.g.: class tpm_device: acpi_device { ... }; The tpm_device inherits from acpi_device. So, in C++ the tpm_device is an acpi_device. My C code uses: struct tpm_device { struct acpi_device *dev, ... }; struct tpm_device tpm_softc; int tpm_init() { acpi_device_create(&tpm_softc.dev, &tpm_softc, ...); ... } int tpm_do_some_stuff(struct acpi_device *dev) { sc = acpi_device_get_parent(dev); ... } |
usr.sbin/bhyve/acpi_device.h | ||
---|---|---|
31 | I'd call it softc (software context) or dev_ctx then. |