| 1 |
|
| 2 |
|
| 3 |
#include <acpi/acpigen.h> |
| 4 |
#include <acpi/acpi_sata.h> |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
void generate_sata_ssdt_ports(const char *scope, uint32_t enable_map) |
| 24 |
{ |
| 25 |
int i; |
| 26 |
uint32_t bit; |
| 27 |
char port_name[5] = "PR00"; |
| 28 |
|
| 29 |
acpigen_write_scope(scope); |
| 30 |
|
| 31 |
|
| 32 |
for (i = 0; i < 32; i++) { |
| 33 |
bit = 1 << i; |
| 34 |
if (!(bit & enable_map)) |
| 35 |
continue; |
| 36 |
|
| 37 |
port_name[2] = '0' + i / 10; |
| 38 |
port_name[3] = '0' + i % 10; |
| 39 |
|
| 40 |
acpigen_write_device(port_name); |
| 41 |
|
| 42 |
acpigen_write_name_dword("_ADR", 0xffff + i * 0x10000); |
| 43 |
acpigen_pop_len(); |
| 44 |
} |
| 45 |
|
| 46 |
acpigen_pop_len(); |
| 47 |
} |