hv: cosmetic fixes in acpi.h

Minor cosmetic fixes in acpi.h:
 Move and group similar defines together
 Rename RSDP_CHECKSUM_LENGTH to ACPI_RSDP_CHECKSUM_LENGTH
 Add post fix 'U' to define as unsinged int and change code accordingly

Tracked-On: #3601
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
dongshen 2019-08-20 15:56:36 -07:00 committed by wenlingz
parent 216c19f4a0
commit 81e2152af8
2 changed files with 24 additions and 22 deletions

View File

@ -41,7 +41,8 @@ static struct acpi_table_rsdp *found_rsdp(char *base, int32_t length)
{ {
struct acpi_table_rsdp *rsdp, *ret = NULL; struct acpi_table_rsdp *rsdp, *ret = NULL;
uint8_t *cp, sum; uint8_t *cp, sum;
int32_t ofs, idx; int32_t ofs;
uint32_t idx;
/* search on 16-byte boundaries */ /* search on 16-byte boundaries */
for (ofs = 0; ofs < length; ofs += 16) { for (ofs = 0; ofs < length; ofs += 16) {
@ -51,7 +52,7 @@ static struct acpi_table_rsdp *found_rsdp(char *base, int32_t length)
if (strncmp(rsdp->signature, ACPI_SIG_RSDP, strnlen_s(ACPI_SIG_RSDP, 8U)) == 0) { if (strncmp(rsdp->signature, ACPI_SIG_RSDP, strnlen_s(ACPI_SIG_RSDP, 8U)) == 0) {
cp = (uint8_t *)rsdp; cp = (uint8_t *)rsdp;
sum = 0U; sum = 0U;
for (idx = 0; idx < RSDP_CHECKSUM_LENGTH; idx++) { for (idx = 0; idx < ACPI_RSDP_CHECKSUM_LENGTH; idx++) {
sum += *(cp + idx); sum += *(cp + idx);
} }

View File

@ -9,35 +9,36 @@
#include <vm_configurations.h> #include <vm_configurations.h>
#define ACPI_OEM_ID_SIZE 6
#define RSDP_CHECKSUM_LENGTH 20 #define ACPI_RSDP_CHECKSUM_LENGTH 20U
#define ACPI_NAME_SIZE 4U
#define ACPI_MADT_TYPE_LOCAL_APIC 0U
#define ACPI_MADT_TYPE_IOAPIC 1U
#define ACPI_MADT_ENABLED 1U
#define ACPI_OEM_TABLE_ID_SIZE 8
#define ACPI_NAME_SIZE 4U
#define ACPI_OEM_ID_SIZE 6U
#define ACPI_OEM_TABLE_ID_SIZE 8U
#define ACPI_MADT_TYPE_LOCAL_APIC 0U
#define ACPI_MADT_TYPE_IOAPIC 1U
#define ACPI_MADT_ENABLED 1U
/* FACP field offsets */ /* FACP field offsets */
#define OFFSET_FACS_ADDR 36U #define OFFSET_FACS_ADDR 36U
#define OFFSET_RESET_REGISTER 116U #define OFFSET_RESET_REGISTER 116U
#define OFFSET_RESET_VALUE 128U #define OFFSET_RESET_VALUE 128U
#define OFFSET_FACS_X_ADDR 132U #define OFFSET_FACS_X_ADDR 132U
#define OFFSET_PM1A_EVT 148U #define OFFSET_PM1A_EVT 148U
#define OFFSET_PM1A_CNT 172U #define OFFSET_PM1A_CNT 172U
/* FACS field offsets */ /* FACS field offsets */
#define OFFSET_FACS_SIGNATURE 0U #define OFFSET_FACS_SIGNATURE 0U
#define OFFSET_FACS_LENGTH 4U #define OFFSET_FACS_LENGTH 4U
#define OFFSET_WAKE_VECTOR_32 12U #define OFFSET_WAKE_VECTOR_32 12U
#define OFFSET_WAKE_VECTOR_64 24U #define OFFSET_WAKE_VECTOR_64 24U
#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */ #define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */
#define ACPI_SIG_FACS 0x53434146U /* "FACS" */ #define ACPI_SIG_FACS 0x53434146U /* "FACS" */
#define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Ptr */ #define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Ptr */
#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ #define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
#define ACPI_SIG_DMAR "DMAR" #define ACPI_SIG_DMAR "DMAR"
struct packed_gas { struct packed_gas {