1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpigen.h>
4 #include <acpi/acpi_sata.h>
7 * generate_sata_ssdt_ports("\_SB.PCI0.SATA", 0x3);
9 * Scope (\_SB.PCI0.SATA)
13 * Name (_ADR, 0x0000FFFF) // _ADR: Address
18 * Name (_ADR, 0x0001FFFF) // _ADR: Address
23 void generate_sata_ssdt_ports(const char *scope
, uint32_t enable_map
)
27 char port_name
[4] = "PR00";
29 acpigen_write_scope(scope
);
31 /* generate a device for every enabled port */
32 for (i
= 0; i
< 32; i
++) {
34 if (!(bit
& enable_map
))
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 */