hv: move ACPI related defines/structs to acpi.h

Currently ACPI related defines/structs are scattered across multiple C
source files, move them into acpi.h so that they can be shared and used by
vacpi code (to be added in subsequent commits).

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 14:44:45 -07:00
committed by wenlingz
parent 6ca4095d9c
commit a1ef0ab9d9
4 changed files with 153 additions and 149 deletions

View File

@@ -51,23 +51,6 @@
* When ACRN go FuSa, the platform ACPI data should be fixed and this file is not needed.
*/
#define ACPI_SIG_FACS 0x53434146U /* "FACS" */
#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */
/* FACP field offsets */
#define OFFSET_FACS_ADDR 36U
#define OFFSET_RESET_REGISTER 116U
#define OFFSET_RESET_VALUE 128U
#define OFFSET_FACS_X_ADDR 132U
#define OFFSET_PM1A_EVT 148U
#define OFFSET_PM1A_CNT 172U
/* FACS field offsets */
#define OFFSET_FACS_SIGNATURE 0U
#define OFFSET_FACS_LENGTH 4U
#define OFFSET_WAKE_VECTOR_32 12U
#define OFFSET_WAKE_VECTOR_64 24U
/* get a dword value from given table and its offset */
static inline uint32_t get_acpi_dt_dword(const uint8_t *dt_addr, uint32_t dt_offset)
{
@@ -80,14 +63,6 @@ static inline uint64_t get_acpi_dt_qword(const uint8_t *dt_addr, uint32_t dt_off
return *(uint64_t *)(dt_addr + dt_offset);
}
struct packed_gas {
uint8_t space_id;
uint8_t bit_width;
uint8_t bit_offset;
uint8_t access_size;
uint64_t address;
} __attribute__((packed));
/* get a GAS struct from given table and its offset.
* ACPI table stores packed gas, but it is not guaranteed that
* struct acpi_generic_address is packed, so do not use memcpy in function.

View File

@@ -12,59 +12,12 @@
#include "vtd.h"
#include "acpi.h"
#define ACPI_SIG_DMAR "DMAR"
enum acpi_dmar_type {
ACPI_DMAR_TYPE_HARDWARE_UNIT = 0,
ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,
ACPI_DMAR_TYPE_ROOT_ATS = 2,
ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3,
ACPI_DMAR_TYPE_NAMESPACE = 4,
ACPI_DMAR_TYPE_RESERVED = 5
};
struct acpi_table_dmar {
/* Common ACPI table header */
struct acpi_table_header header;
/* Host address Width */
uint8_t width;
uint8_t flags;
uint8_t reserved[10];
};
/* DMAR subtable header */
struct acpi_dmar_header {
uint16_t type;
uint16_t length;
};
struct acpi_dmar_hardware_unit {
struct acpi_dmar_header header;
uint8_t flags;
uint8_t reserved;
uint16_t segment;
/* register base address */
uint64_t address;
};
struct find_iter_args {
int32_t i;
struct acpi_dmar_hardware_unit *res;
};
struct acpi_dmar_pci_path {
uint8_t device;
uint8_t function;
};
struct acpi_dmar_device_scope {
uint8_t entry_type;
uint8_t length;
uint16_t reserved;
uint8_t enumeration_id;
uint8_t bus;
};
typedef int32_t (*dmar_iter_t)(struct acpi_dmar_header*, void*);
static int32_t dmar_unit_cnt;