📄 tbconvrt.c
字号:
(acpi_physical_address) local_fadt-> V1_pm1a_cnt_blk); acpi_tb_init_generic_address(&local_fadt->xpm1b_cnt_blk, local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt-> V1_pm1b_cnt_blk); acpi_tb_init_generic_address(&local_fadt->xpm2_cnt_blk, local_fadt->pm2_cnt_len, (acpi_physical_address) local_fadt-> V1_pm2_cnt_blk); acpi_tb_init_generic_address(&local_fadt->xpm_tmr_blk, local_fadt->pm_tm_len, (acpi_physical_address) local_fadt-> V1_pm_tmr_blk); acpi_tb_init_generic_address(&local_fadt->xgpe0_blk, 0, (acpi_physical_address) local_fadt-> V1_gpe0_blk); acpi_tb_init_generic_address(&local_fadt->xgpe1_blk, 0, (acpi_physical_address) local_fadt-> V1_gpe1_blk); /* Create separate GAS structs for the PM1 Enable registers */ acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, (u8) ACPI_DIV_2(acpi_gbl_FADT-> pm1_evt_len), (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + ACPI_DIV_2(acpi_gbl_FADT->pm1_evt_len))); /* PM1B is optional; leave null if not present */ if (local_fadt->xpm1b_evt_blk.address) { acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, (u8) ACPI_DIV_2(acpi_gbl_FADT-> pm1_evt_len), (acpi_physical_address) (local_fadt->xpm1b_evt_blk. address + ACPI_DIV_2(acpi_gbl_FADT-> pm1_evt_len))); }}/******************************************************************************* * * FUNCTION: acpi_tb_convert_fadt2 * * PARAMETERS: local_fadt - Pointer to new FADT * original_fadt - Pointer to old FADT * * RETURN: None, populates local_fadt * * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format. * Handles optional "X" fields. * ******************************************************************************/static voidacpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, struct fadt_descriptor_rev2 *original_fadt){ /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ ACPI_MEMCPY(local_fadt, original_fadt, sizeof(struct fadt_descriptor_rev2)); /* * "X" fields are optional extensions to the original V1.0 fields, so * we must selectively expand V1.0 fields if the corresponding X field * is zero. */ if (!(local_fadt->xfirmware_ctrl)) { ACPI_STORE_ADDRESS(local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl); } if (!(local_fadt->Xdsdt)) { ACPI_STORE_ADDRESS(local_fadt->Xdsdt, local_fadt->V1_dsdt); } if (!(local_fadt->xpm1a_evt_blk.address)) { acpi_tb_init_generic_address(&local_fadt->xpm1a_evt_blk, local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); } if (!(local_fadt->xpm1b_evt_blk.address)) { acpi_tb_init_generic_address(&local_fadt->xpm1b_evt_blk, local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); } if (!(local_fadt->xpm1a_cnt_blk.address)) { acpi_tb_init_generic_address(&local_fadt->xpm1a_cnt_blk, local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); } if (!(local_fadt->xpm1b_cnt_blk.address)) { acpi_tb_init_generic_address(&local_fadt->xpm1b_cnt_blk, local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); } if (!(local_fadt->xpm2_cnt_blk.address)) { acpi_tb_init_generic_address(&local_fadt->xpm2_cnt_blk, local_fadt->pm2_cnt_len, (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); } if (!(local_fadt->xpm_tmr_blk.address)) { acpi_tb_init_generic_address(&local_fadt->xpm_tmr_blk, local_fadt->pm_tm_len, (acpi_physical_address) local_fadt->V1_pm_tmr_blk); } if (!(local_fadt->xgpe0_blk.address)) { acpi_tb_init_generic_address(&local_fadt->xgpe0_blk, 0, (acpi_physical_address) local_fadt->V1_gpe0_blk); } if (!(local_fadt->xgpe1_blk.address)) { acpi_tb_init_generic_address(&local_fadt->xgpe1_blk, 0, (acpi_physical_address) local_fadt->V1_gpe1_blk); } /* Create separate GAS structs for the PM1 Enable registers */ acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, (u8) ACPI_DIV_2(acpi_gbl_FADT-> pm1_evt_len), (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + ACPI_DIV_2(acpi_gbl_FADT->pm1_evt_len))); acpi_gbl_xpm1a_enable.address_space_id = local_fadt->xpm1a_evt_blk.address_space_id; /* PM1B is optional; leave null if not present */ if (local_fadt->xpm1b_evt_blk.address) { acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, (u8) ACPI_DIV_2(acpi_gbl_FADT-> pm1_evt_len), (acpi_physical_address) (local_fadt->xpm1b_evt_blk. address + ACPI_DIV_2(acpi_gbl_FADT-> pm1_evt_len))); acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id; }}/******************************************************************************* * * FUNCTION: acpi_tb_convert_table_fadt * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Converts a BIOS supplied ACPI 1.0 FADT to a local * ACPI 2.0 FADT. If the BIOS supplied a 2.0 FADT then it is simply * copied to the local FADT. The ACPI CA software uses this * local FADT. Thus a significant amount of special #ifdef * type codeing is saved. * ******************************************************************************/acpi_status acpi_tb_convert_table_fadt(void){ struct fadt_descriptor_rev2 *local_fadt; struct acpi_table_desc *table_desc; ACPI_FUNCTION_TRACE("tb_convert_table_fadt"); /* * acpi_gbl_FADT is valid. Validate the FADT length. The table must be * at least as long as the version 1.0 FADT */ if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev1)) { ACPI_REPORT_ERROR(("FADT is invalid, too short: 0x%X\n", acpi_gbl_FADT->length)); return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); } /* Allocate buffer for the ACPI 2.0(+) FADT */ local_fadt = ACPI_MEM_CALLOCATE(sizeof(struct fadt_descriptor_rev2)); if (!local_fadt) { return_ACPI_STATUS(AE_NO_MEMORY); } if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { /* Length is too short to be a V2.0 table */ ACPI_REPORT_WARNING(("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); acpi_tb_convert_fadt1(local_fadt, (void *)acpi_gbl_FADT); } else { /* Valid V2.0 table */ acpi_tb_convert_fadt2(local_fadt, acpi_gbl_FADT); } } else { /* Valid V1.0 table */ acpi_tb_convert_fadt1(local_fadt, (void *)acpi_gbl_FADT); } /* Global FADT pointer will point to the new common V2.0 FADT */ acpi_gbl_FADT = local_fadt; acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR); /* Free the original table */ table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next; acpi_tb_delete_single_table(table_desc); /* Install the new table */ table_desc->pointer = ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT); table_desc->allocation = ACPI_MEM_ALLOCATED; table_desc->length = sizeof(struct fadt_descriptor_rev2); /* Dump the entire FADT */ ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Hex dump of common internal FADT, size %d (%X)\n", acpi_gbl_FADT->length, acpi_gbl_FADT->length)); ACPI_DUMP_BUFFER((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length); return_ACPI_STATUS(AE_OK);}/******************************************************************************* * * FUNCTION: acpi_tb_build_common_facs * * PARAMETERS: table_info - Info for currently installed FACS * * RETURN: Status * * DESCRIPTION: Convert ACPI 1.0 and ACPI 2.0 FACS to a common internal * table format. * ******************************************************************************/acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info){ ACPI_FUNCTION_TRACE("tb_build_common_facs"); /* Absolute minimum length is 24, but the ACPI spec says 64 */ if (acpi_gbl_FACS->length < 24) { ACPI_REPORT_ERROR(("Invalid FACS table length: 0x%X\n", acpi_gbl_FACS->length)); return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); } if (acpi_gbl_FACS->length < 64) { ACPI_REPORT_WARNING(("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", acpi_gbl_FACS->length)); } /* Copy fields to the new FACS */ acpi_gbl_common_fACS.global_lock = &(acpi_gbl_FACS->global_lock); if ((acpi_gbl_RSDP->revision < 2) || (acpi_gbl_FACS->length < 32) || (!(acpi_gbl_FACS->xfirmware_waking_vector))) { /* ACPI 1.0 FACS or short table or optional X_ field is zero */ acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, & (acpi_gbl_FACS-> firmware_waking_vector)); acpi_gbl_common_fACS.vector_width = 32; } else { /* ACPI 2.0 FACS with valid X_ field */ acpi_gbl_common_fACS.firmware_waking_vector = &acpi_gbl_FACS->xfirmware_waking_vector; acpi_gbl_common_fACS.vector_width = 64; } return_ACPI_STATUS(AE_OK);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -