summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2023-05-11 22:22:06 +0200
committerLean Sheng Tan <sheng.tan@9elements.com>2023-05-14 17:51:11 +0000
commitb2f2b53fb2f30b8ba9d87d35b68020994589f048 (patch)
tree876d0a370887324357e2965bc0d258018635e181 /src
parentd1c61a8e70422d746c3096821bb479b2014248f0 (diff)
acpi/acpigen: add comment about byte 0 in acpigen_resource_*word
Since it's not obvious, add comments to acpigen_resource_word, acpigen_resource_dword and acpigen_resource_qword to clarify out what the magic number in byte 0 means. The most significant bit of byte 0 indicates if it is a small or large resource data type. In the case of the MSB being 0, it's a small resource data type (aka type 0), and the other bits encode bit the type and size of the item; if the MSB is 1, it's a large resource data type (aka type 1), and the other bits just encode the type and there are two separate bytes to encode the size. Beware that the large resource's data type values in the ACPI specification don't include the MSB that's set, but only the 7 lower bits. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Ia6a6c9fb1bcde232122bb5899b9a0983ef48e12b Reviewed-on: https://review.coreboot.org/c/coreboot/+/75158 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <inforichland@gmail.com> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/acpi/acpigen.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c
index 9a9f5c52bd..b85acbc9b4 100644
--- a/src/acpi/acpigen.c
+++ b/src/acpi/acpigen.c
@@ -2167,6 +2167,7 @@ void acpigen_get_tx_gpio(const struct acpi_gpio *gpio)
void acpigen_resource_word(u16 res_type, u16 gen_flags, u16 type_flags, u16 gran, u16 range_min,
u16 range_max, u16 translation, u16 length)
{
+ /* Byte 0: Type 1, Large Item Value 0x8: Word Address Space Descriptor */
acpigen_emit_byte(0x88);
/* Byte 1+2: length (0x000d) */
acpigen_emit_byte(0x0d);
@@ -2190,6 +2191,7 @@ void acpigen_resource_word(u16 res_type, u16 gen_flags, u16 type_flags, u16 gran
void acpigen_resource_dword(u16 res_type, u16 gen_flags, u16 type_flags, u32 gran,
u32 range_min, u32 range_max, u32 translation, u32 length)
{
+ /* Byte 0: Type 1, Large Item Value 0x7: DWord Address Space Descriptor */
acpigen_emit_byte(0x87);
/* Byte 1+2: length (0023) */
acpigen_emit_byte(23);
@@ -2219,6 +2221,7 @@ static void acpigen_emit_qword(u64 data)
void acpigen_resource_qword(u16 res_type, u16 gen_flags, u16 type_flags, u64 gran,
u64 range_min, u64 range_max, u64 translation, u64 length)
{
+ /* Byte 0: Type 1, Large Item Value 0xa: QWord Address Space Descriptor */
acpigen_emit_byte(0x8a);
/* Byte 1+2: length (0x002b) */
acpigen_emit_byte(0x2b);