mb/google/brya/var/orisa: Update Type C DisplayPort HPD Configuration
[coreboot2.git] / src / acpi / sata.c
blob69b6799313b935749fb35fef04d2cb428fc579a5
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpigen.h>
4 #include <acpi/acpi_sata.h>
6 /* e.g.
7 * generate_sata_ssdt_ports("\_SB.PCI0.SATA", 0x3);
8 * generates:
9 * Scope (\_SB.PCI0.SATA)
10 * {
11 * Device (PR00)
12 * {
13 * Name (_ADR, 0x0000FFFF) // _ADR: Address
14 * }
16 * Device (PR01)
17 * {
18 * Name (_ADR, 0x0001FFFF) // _ADR: Address
19 * }
20 * }
23 void generate_sata_ssdt_ports(const char *scope, uint32_t enable_map)
25 int i;
26 uint32_t bit;
27 char port_name[5] = "PR00";
29 acpigen_write_scope(scope);
31 /* generate a device for every enabled port */
32 for (i = 0; i < 32; i++) {
33 bit = 1 << i;
34 if (!(bit & enable_map))
35 continue;
37 port_name[2] = '0' + i / 10;
38 port_name[3] = '0' + i % 10;
40 acpigen_write_device(port_name);
42 acpigen_write_name_dword("_ADR", 0xffff + i * 0x10000);
43 acpigen_pop_len(); /* close PRT%d */
46 acpigen_pop_len(); /* close scope */