static void test_acpi_rsdt_table(test_data *data) { AcpiRsdtDescriptorRev1 *rsdt_table = &data->rsdt_table; uint32_t addr = data->rsdp_table.rsdt_physical_address; uint32_t *tables; int tables_nr; uint8_t checksum; /* read the header */ ACPI_READ_TABLE_HEADER(rsdt_table, addr); ACPI_ASSERT_CMP(rsdt_table->signature, "RSDT"); /* compute the table entries in rsdt */ tables_nr = (rsdt_table->length - sizeof(AcpiRsdtDescriptorRev1)) / sizeof(uint32_t); g_assert_cmpint(tables_nr, >, 0); /* get the addresses of the tables pointed by rsdt */ tables = g_new0(uint32_t, tables_nr); ACPI_READ_ARRAY_PTR(tables, tables_nr, addr); checksum = acpi_checksum((uint8_t *)rsdt_table, rsdt_table->length) + acpi_checksum((uint8_t *)tables, tables_nr * sizeof(uint32_t)); g_assert(!checksum); /* SSDT tables after FADT */ data->rsdt_tables_addr = tables; data->rsdt_tables_nr = tables_nr; }
static void test_acpi_dsdt_table(test_data *data) { AcpiSdtTable dsdt_table; uint32_t addr = le32_to_cpu(data->dsdt_addr); fetch_table(&dsdt_table, addr); ACPI_ASSERT_CMP(dsdt_table.header.signature, "DSDT"); /* Since DSDT isn't in RSDT, add DSDT to ASL test tables list manually */ g_array_append_val(data->tables, dsdt_table); }
static void test_acpi_fadt_table(test_data *data) { AcpiFadtDescriptorRev1 *fadt_table = &data->fadt_table; uint32_t addr; /* FADT table comes first */ addr = data->rsdt_tables_addr[0]; ACPI_READ_TABLE_HEADER(fadt_table, addr); ACPI_READ_FIELD(fadt_table->firmware_ctrl, addr); ACPI_READ_FIELD(fadt_table->dsdt, addr); ACPI_READ_FIELD(fadt_table->model, addr); ACPI_READ_FIELD(fadt_table->reserved1, addr); ACPI_READ_FIELD(fadt_table->sci_int, addr); ACPI_READ_FIELD(fadt_table->smi_cmd, addr); ACPI_READ_FIELD(fadt_table->acpi_enable, addr); ACPI_READ_FIELD(fadt_table->acpi_disable, addr); ACPI_READ_FIELD(fadt_table->S4bios_req, addr); ACPI_READ_FIELD(fadt_table->reserved2, addr); ACPI_READ_FIELD(fadt_table->pm1a_evt_blk, addr); ACPI_READ_FIELD(fadt_table->pm1b_evt_blk, addr); ACPI_READ_FIELD(fadt_table->pm1a_cnt_blk, addr); ACPI_READ_FIELD(fadt_table->pm1b_cnt_blk, addr); ACPI_READ_FIELD(fadt_table->pm2_cnt_blk, addr); ACPI_READ_FIELD(fadt_table->pm_tmr_blk, addr); ACPI_READ_FIELD(fadt_table->gpe0_blk, addr); ACPI_READ_FIELD(fadt_table->gpe1_blk, addr); ACPI_READ_FIELD(fadt_table->pm1_evt_len, addr); ACPI_READ_FIELD(fadt_table->pm1_cnt_len, addr); ACPI_READ_FIELD(fadt_table->pm2_cnt_len, addr); ACPI_READ_FIELD(fadt_table->pm_tmr_len, addr); ACPI_READ_FIELD(fadt_table->gpe0_blk_len, addr); ACPI_READ_FIELD(fadt_table->gpe1_blk_len, addr); ACPI_READ_FIELD(fadt_table->gpe1_base, addr); ACPI_READ_FIELD(fadt_table->reserved3, addr); ACPI_READ_FIELD(fadt_table->plvl2_lat, addr); ACPI_READ_FIELD(fadt_table->plvl3_lat, addr); ACPI_READ_FIELD(fadt_table->flush_size, addr); ACPI_READ_FIELD(fadt_table->flush_stride, addr); ACPI_READ_FIELD(fadt_table->duty_offset, addr); ACPI_READ_FIELD(fadt_table->duty_width, addr); ACPI_READ_FIELD(fadt_table->day_alrm, addr); ACPI_READ_FIELD(fadt_table->mon_alrm, addr); ACPI_READ_FIELD(fadt_table->century, addr); ACPI_READ_FIELD(fadt_table->reserved4, addr); ACPI_READ_FIELD(fadt_table->reserved4a, addr); ACPI_READ_FIELD(fadt_table->reserved4b, addr); ACPI_READ_FIELD(fadt_table->flags, addr); ACPI_ASSERT_CMP(fadt_table->signature, "FACP"); g_assert(!acpi_checksum((uint8_t *)fadt_table, fadt_table->length)); }
static void fadt_fetch_facs_and_dsdt_ptrs(test_data *data) { uint32_t addr; AcpiTableHeader hdr; /* FADT table comes first */ addr = le32_to_cpu(data->rsdt_tables_addr[0]); ACPI_READ_TABLE_HEADER(&hdr, addr); ACPI_ASSERT_CMP(hdr.signature, "FACP"); ACPI_READ_FIELD(data->facs_addr, addr); ACPI_READ_FIELD(data->dsdt_addr, addr); }
static void test_acpi_dsdt_table(test_data *data) { AcpiSdtTable dsdt_table; uint32_t addr = data->fadt_table.dsdt; memset(&dsdt_table, 0, sizeof(dsdt_table)); data->tables = g_array_new(false, true, sizeof(AcpiSdtTable)); test_dst_table(&dsdt_table, addr); ACPI_ASSERT_CMP(dsdt_table.header.signature, "DSDT"); /* Place DSDT first */ g_array_append_val(data->tables, dsdt_table); }
static void test_acpi_facs_table(test_data *data) { AcpiFacsDescriptorRev1 *facs_table = &data->facs_table; uint32_t addr = data->fadt_table.firmware_ctrl; ACPI_READ_FIELD(facs_table->signature, addr); ACPI_READ_FIELD(facs_table->length, addr); ACPI_READ_FIELD(facs_table->hardware_signature, addr); ACPI_READ_FIELD(facs_table->firmware_waking_vector, addr); ACPI_READ_FIELD(facs_table->global_lock, addr); ACPI_READ_FIELD(facs_table->flags, addr); ACPI_READ_ARRAY(facs_table->resverved3, addr); ACPI_ASSERT_CMP(facs_table->signature, "FACS"); }