mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
hvmloader: construct SLIT
Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
e9c8ef535b
commit
4677e007d7
2 files changed
+46
-1
No files matched your search
@@ -414,6 +414,12 @@ struct acpi_20_srat_memory {
|
||||
#define ACPI_MEM_AFFIN_HOTPLUGGABLE (1 << 1)
|
||||
#define ACPI_MEM_AFFIN_NONVOLATILE (1 << 2)
|
||||
|
||||
struct acpi_20_slit {
|
||||
struct acpi_header header;
|
||||
uint64_t localities;
|
||||
uint8_t entry[0];
|
||||
};
|
||||
|
||||
/*
|
||||
* Table Signatures.
|
||||
*/
|
||||
@@ -427,6 +433,7 @@ struct acpi_20_srat_memory {
|
||||
#define ACPI_2_0_HPET_SIGNATURE ASCII32('H','P','E','T')
|
||||
#define ACPI_2_0_WAET_SIGNATURE ASCII32('W','A','E','T')
|
||||
#define ACPI_2_0_SRAT_SIGNATURE ASCII32('S','R','A','T')
|
||||
#define ACPI_2_0_SLIT_SIGNATURE ASCII32('S','L','I','T')
|
||||
|
||||
/*
|
||||
* Table revision numbers.
|
||||
@@ -441,6 +448,7 @@ struct acpi_20_srat_memory {
|
||||
#define ACPI_2_0_WAET_REVISION 0x01
|
||||
#define ACPI_1_0_FADT_REVISION 0x01
|
||||
#define ACPI_2_0_SRAT_REVISION 0x01
|
||||
#define ACPI_2_0_SLIT_REVISION 0x01
|
||||
|
||||
#pragma pack ()
|
||||
|
||||
|
||||
@@ -261,6 +261,38 @@ static struct acpi_20_srat *construct_srat(void)
|
||||
return srat;
|
||||
}
|
||||
|
||||
static struct acpi_20_slit *construct_slit(void)
|
||||
{
|
||||
struct acpi_20_slit *slit;
|
||||
unsigned int i, num, size;
|
||||
|
||||
num = nr_vnodes * nr_vnodes;
|
||||
size = sizeof(*slit) + num * sizeof(uint8_t);
|
||||
|
||||
slit = mem_alloc(size, 16);
|
||||
if ( !slit )
|
||||
return NULL;
|
||||
|
||||
memset(slit, 0, size);
|
||||
slit->header.signature = ACPI_2_0_SLIT_SIGNATURE;
|
||||
slit->header.revision = ACPI_2_0_SLIT_REVISION;
|
||||
fixed_strcpy(slit->header.oem_id, ACPI_OEM_ID);
|
||||
fixed_strcpy(slit->header.oem_table_id, ACPI_OEM_TABLE_ID);
|
||||
slit->header.oem_revision = ACPI_OEM_REVISION;
|
||||
slit->header.creator_id = ACPI_CREATOR_ID;
|
||||
slit->header.creator_revision = ACPI_CREATOR_REVISION;
|
||||
|
||||
for ( i = 0; i < num; i++ )
|
||||
slit->entry[i] = vdistance[i];
|
||||
|
||||
slit->localities = nr_vnodes;
|
||||
|
||||
slit->header.length = size;
|
||||
set_checksum(slit, offsetof(struct acpi_header, checksum), size);
|
||||
|
||||
return slit;
|
||||
}
|
||||
|
||||
static int construct_passthrough_tables(unsigned long *table_ptrs,
|
||||
int nr_tables)
|
||||
{
|
||||
@@ -404,15 +436,20 @@ static int construct_secondary_tables(unsigned long *table_ptrs,
|
||||
}
|
||||
}
|
||||
|
||||
/* SRAT */
|
||||
/* SRAT and SLIT */
|
||||
if ( nr_vnodes > 0 )
|
||||
{
|
||||
struct acpi_20_srat *srat = construct_srat();
|
||||
struct acpi_20_slit *slit = construct_slit();
|
||||
|
||||
if ( srat )
|
||||
table_ptrs[nr_tables++] = (unsigned long)srat;
|
||||
else
|
||||
printf("Failed to build SRAT, skipping...\n");
|
||||
if ( slit )
|
||||
table_ptrs[nr_tables++] = (unsigned long)slit;
|
||||
else
|
||||
printf("Failed to build SLIT, skipping...\n");
|
||||
}
|
||||
|
||||
/* Load any additional tables passed through. */
|
||||
|
||||