Matthew Garrett has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37991 )
Change subject: Add a doc describing an ACPI device for controlling platform radios. ......................................................................
Add a doc describing an ACPI device for controlling platform radios.
Signed-off-by: Matthew Garrett mjg59@google.com Change-Id: I94dc058825cb147aca0d007d68885d4bfbe580a8 --- M Documentation/acpi/index.md A Documentation/acpi/rfkill.md M src/arch/x86/include/arch/acpi.h 3 files changed, 111 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/37991/1
diff --git a/Documentation/acpi/index.md b/Documentation/acpi/index.md index 8add8db..d10bca5 100644 --- a/Documentation/acpi/index.md +++ b/Documentation/acpi/index.md @@ -9,3 +9,7 @@ ## devicetree
- [Adding devices to a device tree](devicetree.md) + +## Radio device control + +- [Exposing an ACPI device for controlling radios](rfkill.md) diff --git a/Documentation/acpi/rfkill.md b/Documentation/acpi/rfkill.md new file mode 100644 index 0000000..ef54f16 --- /dev/null +++ b/Documentation/acpi/rfkill.md @@ -0,0 +1,106 @@ +# Coreboot platform rfkill control + +## Introduction + +Many devices support platform-level control over integrated radio devices +such as wifi or bluetooth cards. However, the ACPI specification provides +no generic mechanism for operating systems to interact with these platform +interfaces. This has led to a proliferation of vendor-specific control +mechanisms. Coreboot ports to existing platforms tend to mimic those +interfaces and make use of existing drivers, but this doesn't solve the +problem for devices where coreboot is the primary firmware implementation. + +This specification defines an ACPI device that exposes an interface for +controlling any radios defined by the platform. It is intended to allow for +generic OS drivers to be written which will then work on any coreboot +platform that implements this specification. + +## Device specification + +The coreboot rfkill device must be declared with a _HID of "BOOT0001". +It must implement the following ACPI methods: + +### DEVS + +This method provides a list of the supported radios whose state can be +controlledvia this device. It takes no arguments and returns a single +integer. The integer is a bitmask of radio types supported by the device, +defined as follows: + +| Bit | Radio type | +|-----|---------------| +| 0 | Wifi | +| 1 | Bluetooth | +| 2 | Ultra-Wideband| +| 3 | WiMax | +| 4 | WWAN | +| 5 | GPS | +| 6 | FM | +| 7 | NFC | + +### SSTA + +This defines the mutable ("soft") state of all radios in the system. This +method takes no arguments and returns a single integer. The integer is a +bitmask representing radio state using the same values as defined in +DEVS. If a bit is 1 then the radio is enabled. If a bit is 0 then the radio +is not present. If a bit is not set in the value returned by the DEVS method +then the meaning of the bit returned by SSTA is undefined. The state +returned by SSTA can be overridden by the CNTL method. + +### HSTA + +This defines the immutable ("hard") state of all radios in the system. This +method takes no arguments and returns a single integer. The integer is a +bitmask representing radio state using the same values as defined in +DEVS. If a bit is 1 then the radio is enabled. If a bit is 0 then the radio +is disabled. If a bit is not set in the value returned by the DEVS method +then the meaning of the bit returned by HSTA is undefined. The state +returned by HSTA cannot be overridden by the CNTL method. + +### CNTL + +This method takes a single integer as an argument and returns nothing. The +argument is a bitmask representing radio state using the same values as +defined in DEVS. If a bit is 1 then the platform should enable the +corresponding radio. If a bit is 0 then the platform should disable the +corresponding radio. This method only alters the soft radio state, not the +hard radio state. + +### Notifications + +The platform will send a Notify with a value of 0x80 if the state is updated +via any mechanism other than an OS request. The OS should then re-evaluate +the state by calling SSTA and HSTA. + +## Implementation design + +Two types of blocking are defined - "soft" and "hard". Soft state can be +overridden on request by the OS, for example in response to a hotkey +press. Hard state cannot be overridden by the OS, and should correspond to +cases where some external interface has requested that radios be disabled +(for example, a physical switch on the side of the device). Hard and soft +state should be tracked independently - for instance, if a radio is +currently enabled and then disabled via a physical switch being moved, the +state returned by SSTA should still indicate that the radio is enabled while +the state returned by HSTA should indicate that the radio is disabled. If +the OS then requests that the radio be disabled via the CNTL method, SSTA +and HSTA should now both indicate that the radio is disabled. If the +physical switch is now switched back, HSTA should indicate that the radio is +enabled but SSTA should still indicate that the radio is disabled. Only when +the OS requests that the radio be enabled via CNTL should the radio be +re-enabled. + +If the platform alters the radio state (in response to any form of policy +decision or in response to a physical switch), it should update the soft +block state (if the OS can override this decision) or the hard block state +(if the OS cannot override this decision) and then call Notify on the device +with an argument of 0x80. + +If the platform provides more than one radio of a given type, it should +implement an additional rfkill device. Each radio should only be represented +in a single device. + +If an rfkill device should be explicitly tied to a radio device, then the +radio should be exposed in the ACPI device heirarchy and an rfkill device +that controls only that radio implemented as a child of that device. diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h index 68475c1..e87df04 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -64,6 +64,7 @@ /* List of ACPI HID that use the coreboot ACPI ID */ enum coreboot_acpi_ids { COREBOOT_ACPI_ID_CBTABLE = 0x0000, /* BOOT0000 */ + COREBOOT_ACPI_ID_RFKILL = 0x0001, /* BOOT0001 */ COREBOOT_ACPI_ID_MAX = 0xFFFF, /* BOOTFFFF */ };
Matthew Garrett has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37991 )
Change subject: Add a doc describing an ACPI device for controlling platform radios. ......................................................................
Patch Set 1:
https://github.com/mjg59/linux/commit/891df8edf66c8be085b4c690eab9c899011f8d... is a Linux driver for this.
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/37991
to look at the new patch set (#2).
Change subject: Add a doc describing an ACPI device for controlling platform radios. ......................................................................
Add a doc describing an ACPI device for controlling platform radios.
Signed-off-by: Matthew Garrett mjg59@google.com Change-Id: I94dc058825cb147aca0d007d68885d4bfbe580a8 --- M 3rdparty/arm-trusted-firmware M 3rdparty/blobs M 3rdparty/chromeec M 3rdparty/fsp M 3rdparty/libgfxinit M 3rdparty/opensbi M 3rdparty/vboot M Documentation/acpi/index.md A Documentation/acpi/rfkill.md M src/arch/x86/include/arch/acpi.h M util/nvidia/cbootimage 11 files changed, 119 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/37991/2
Hello Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/37991
to look at the new patch set (#3).
Change subject: Add a doc describing an ACPI device for controlling platform radios. ......................................................................
Add a doc describing an ACPI device for controlling platform radios.
Signed-off-by: Matthew Garrett mjg59@google.com Change-Id: I94dc058825cb147aca0d007d68885d4bfbe580a8 --- M Documentation/acpi/index.md A Documentation/acpi/rfkill.md M src/arch/x86/include/arch/acpi.h 3 files changed, 111 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/37991/3
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37991 )
Change subject: Add a doc describing an ACPI device for controlling platform radios. ......................................................................
Patch Set 3:
(8 comments)
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... File Documentation/acpi/rfkill.md:
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 6: bluetooth Bluetooth
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 6: wifi Wi-Fi
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 15: maybe add a comma
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 26: dv missing space?
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 34: | Maybe add a space so that the table end isn't next to the contents
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 47: If a bit is not set in the value returned by the DEVS method The wording of this part confused me. Wouldn't it be simpler to state on the DEVS method:
If a bit is not set, then that type of device is not supported on the platform and the return value of any other method is undefined.
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 47: is not present did you mean `is disabled`?
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 55: as defined in : DEVS. If a bit is 1 then the radio is enabled. If a bit is 0 then the radio : is disabled. This seems to be slightly mixed up. I thought DEVS was about supported devices, and not device status?
I guess you mean that the bit meaning is the same as that of SSTA?
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37991 )
Change subject: Add a doc describing an ACPI device for controlling platform radios. ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37991/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/37991/3//COMMIT_MSG@7 PS3, Line 7: Add a doc describing an ACPI device for controlling platform radios. Doc/acpi: Add rfkill device specification
Hello Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/37991
to look at the new patch set (#4).
Change subject: Doc/acpi: Add rfkill device specification ......................................................................
Doc/acpi: Add rfkill device specification
Signed-off-by: Matthew Garrett mjg59@google.com Change-Id: I94dc058825cb147aca0d007d68885d4bfbe580a8 --- M Documentation/acpi/index.md A Documentation/acpi/rfkill.md M src/arch/x86/include/arch/acpi.h 3 files changed, 113 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/37991/4
Matthew Garrett has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37991 )
Change subject: Doc/acpi: Add rfkill device specification ......................................................................
Patch Set 4:
(8 comments)
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... File Documentation/acpi/rfkill.md:
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 6: wifi
Wi-Fi
Ack
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 6: bluetooth
Bluetooth
Ack
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 15:
maybe add a comma
Ack
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 26: dv
missing space?
Ack
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 34: |
Maybe add a space so that the table end isn't next to the contents
Ack
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 47: If a bit is not set in the value returned by the DEVS method
The wording of this part confused me. Wouldn't it be simpler to state on the DEVS method: […]
Ack
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 47: is not present
did you mean `is disabled`?
Ack
https://review.coreboot.org/c/coreboot/+/37991/3/Documentation/acpi/rfkill.m... PS3, Line 55: as defined in : DEVS. If a bit is 1 then the radio is enabled. If a bit is 0 then the radio : is disabled.
This seems to be slightly mixed up. […]
The bit offsets are defined in DEVS, but in HSTA they refer to radio status rather than presence. Reworded a little in an attempt to make this clearer.
Matthew Garrett has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37991 )
Change subject: Doc/acpi: Add rfkill device specification ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37991/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/37991/3//COMMIT_MSG@7 PS3, Line 7: Add a doc describing an ACPI device for controlling platform radios.
Doc/acpi: Add rfkill device specification
Done
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37991 )
Change subject: Doc/acpi: Add rfkill device specification ......................................................................
Patch Set 4: Code-Review+2
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37991 )
Change subject: Doc/acpi: Add rfkill device specification ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37991/4/Documentation/acpi/rfkill.m... File Documentation/acpi/rfkill.md:
https://review.coreboot.org/c/coreboot/+/37991/4/Documentation/acpi/rfkill.m... PS4, Line 107: heirarchy hierarchy
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37991 )
Change subject: Doc/acpi: Add rfkill device specification ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37991/4/Documentation/acpi/rfkill.m... File Documentation/acpi/rfkill.md:
https://review.coreboot.org/c/coreboot/+/37991/4/Documentation/acpi/rfkill.m... PS4, Line 41: If a bit is not set, then that type of device is not supported on the : platform and the meaning of that bit in the return value or argument of any : other method is undefined. Nit: This language doesn't jive with the below paragraph:
"If the platform provides more than one radio of a given type, it should implement an additional rfkill device. Each radio should only be represented in a single device."
There could be >1 rfkill devices covering different radios so it's not like a given radio isn't supported -- it might just not be covered by this specific device.
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37991 )
Change subject: Doc/acpi: Add rfkill device specification ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37991/4/Documentation/acpi/rfkill.m... File Documentation/acpi/rfkill.md:
https://review.coreboot.org/c/coreboot/+/37991/4/Documentation/acpi/rfkill.m... PS4, Line 21: implement the following ACPI methods It might make sense to use a DSM with functions instead of hardcoded method names. It makes for less readable ACPI code (easier to generate) but perhaps a more flexible implementation.
Stefan Reinauer has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/37991?usp=email )
Change subject: Doc/acpi: Add rfkill device specification ......................................................................
Abandoned