ACPI: Add acpigen_write_PTC()

Change-Id: Ibaf2d7105e7a5da8a50ef32b682978ff55fe31e0
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74473
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Kyösti Mälkki 2023-04-17 12:11:03 +03:00
parent d48982acac
commit ddc37d69cb
2 changed files with 21 additions and 11 deletions

View file

@ -711,7 +711,7 @@ void acpigen_write_empty_PCT(void)
acpigen_emit_stream(stream, ARRAY_SIZE(stream)); acpigen_emit_stream(stream, ARRAY_SIZE(stream));
} }
void acpigen_write_empty_PTC(void) void acpigen_write_PTC(uint8_t duty_width, uint8_t duty_offset, uint16_t p_cnt)
{ {
/* /*
Name (_PTC, Package (0x02) Name (_PTC, Package (0x02)
@ -719,31 +719,35 @@ void acpigen_write_empty_PTC(void)
ResourceTemplate () ResourceTemplate ()
{ {
Register (FFixedHW, Register (FFixedHW,
0x00, // Bit Width 0x00, // Duty Width
0x00, // Bit Offset 0x00, // Duty Offset
0x0000000000000000, // Address 0x0000000000000000, // P_CNT IO Address
,) ,)
}, },
ResourceTemplate () ResourceTemplate ()
{ {
Register (FFixedHW, Register (FFixedHW,
0x00, // Bit Width 0x00, // Duty Width
0x00, // Bit Offset 0x00, // Duty Offset
0x0000000000000000, // Address 0x0000000000000000, // P_CNT IO Address
,) ,)
} }
}) })
*/ */
acpi_addr_t addr = { acpi_addr_t addr = {
.space_id = ACPI_ADDRESS_SPACE_FIXED, .bit_width = duty_width,
.bit_width = 0, .bit_offset = duty_offset,
.bit_offset = 0,
.access_size = ACPI_ACCESS_SIZE_UNDEFINED, .access_size = ACPI_ACCESS_SIZE_UNDEFINED,
.addrl = 0, .addrl = p_cnt,
.addrh = 0, .addrh = 0,
}; };
if (addr.addrl != 0)
addr.space_id = ACPI_ADDRESS_SPACE_IO;
else
addr.space_id = ACPI_ADDRESS_SPACE_FIXED;
acpigen_write_name("_PTC"); acpigen_write_name("_PTC");
acpigen_write_package(2); acpigen_write_package(2);
@ -756,6 +760,11 @@ void acpigen_write_empty_PTC(void)
acpigen_pop_len(); acpigen_pop_len();
} }
void acpigen_write_empty_PTC(void)
{
acpigen_write_PTC(0, 0, 0);
}
static void __acpigen_write_method(const char *name, uint8_t flags) static void __acpigen_write_method(const char *name, uint8_t flags)
{ {
acpigen_emit_byte(METHOD_OP); acpigen_emit_byte(METHOD_OP);

View file

@ -431,6 +431,7 @@ void acpigen_write_PPC(u8 nr);
void acpigen_write_PPC_NVS(void); void acpigen_write_PPC_NVS(void);
void acpigen_write_empty_PCT(void); void acpigen_write_empty_PCT(void);
void acpigen_write_empty_PTC(void); void acpigen_write_empty_PTC(void);
void acpigen_write_PTC(uint8_t duty_width, uint8_t duty_offset, uint16_t p_cnt);
void acpigen_write_PRW(u32 wake, u32 level); void acpigen_write_PRW(u32 wake, u32 level);
void acpigen_write_STA(uint8_t status); void acpigen_write_STA(uint8_t status);
void acpigen_write_STA_ext(const char *namestring); void acpigen_write_STA_ext(const char *namestring);