Skip to content

Commit 88e1c49

Browse files
jsun26intellijinxia
authored andcommitted
HV: add bsp acpi info support
On some occations HV operates relying on host acpi info, we can use a c file to store this data. The data could be hardcoded or use offline tool that run on target first and then generate the file automatically. Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 35f06b8 commit 88e1c49

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed

hypervisor/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ endif
147147

148148
C_SRCS += bsp/$(PLATFORM)/vm_description.c
149149
C_SRCS += bsp/$(PLATFORM)/$(PLATFORM).c
150+
C_SRCS += bsp/$(PLATFORM)/platform_acpi_info.c
150151

151152
ifeq ($(PLATFORM),uefi)
152153
C_SRCS += bsp/$(PLATFORM)/cmdline.c
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
#include <hypervisor.h>
8+
9+
const struct acpi_info host_acpi_info = {
10+
6, /* x86 family: 6 */
11+
0x5C, /* x86 model: 0x5C, ApolloLake */
12+
{
13+
{SPACE_SYSTEM_IO, 20, 0, 3, 0x400}, /* PM1a EVT */
14+
{SPACE_SYSTEM_IO, 0, 0, 0, 0}, /* PM1b EVT */
15+
{SPACE_SYSTEM_IO, 10, 0, 2, 0x404}, /* PM1a CNT */
16+
{SPACE_SYSTEM_IO, 0, 0, 0, 0}, /* PM1b CNT */
17+
{0x05, 0, 0}, /* _S3 Package */
18+
{0x07, 0, 0}, /* _S5 Package */
19+
(uint32_t *)0x7AEDCEFC, /* Wake Vector 32 */
20+
(uint64_t *)0x7AEDCF08 /* Wake Vector 64 */
21+
}
22+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
/* This is a template for uninitialized host_acpi_info,
8+
* we should use a user space tool running on target to generate this file.
9+
*/
10+
11+
#include <hypervisor.h>
12+
13+
const struct acpi_info host_acpi_info = {
14+
-1, /* x86 family */
15+
-1, /* x86 model */
16+
{
17+
{SPACE_SYSTEM_IO, 0, 0, 0, 0}, /* PM1a EVT */
18+
{SPACE_SYSTEM_IO, 0, 0, 0, 0}, /* PM1b EVT */
19+
{SPACE_SYSTEM_IO, 0, 0, 0, 0}, /* PM1a CNT */
20+
{SPACE_SYSTEM_IO, 0, 0, 0, 0}, /* PM1b CNT */
21+
{0, 0, 0}, /* _S3 Package */
22+
{0, 0, 0}, /* _S5 Package */
23+
(uint32_t *)0, /* Wake Vector 32 */
24+
(uint64_t *)0 /* Wake Vector 64 */
25+
}
26+
};

hypervisor/include/public/acrn_common.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,30 @@ struct cpu_px_data {
305305
uint64_t status; /* success indicator */
306306
} __attribute__((aligned(8)));
307307

308+
struct acpi_sx_pkg {
309+
uint8_t val_pm1a;
310+
uint8_t val_pm1b;
311+
uint16_t reserved;
312+
} __attribute__((aligned(8)));
313+
314+
struct pm_s_state_data {
315+
struct acpi_generic_address pm1a_evt;
316+
struct acpi_generic_address pm1b_evt;
317+
struct acpi_generic_address pm1a_cnt;
318+
struct acpi_generic_address pm1b_cnt;
319+
struct acpi_sx_pkg s3_pkg;
320+
struct acpi_sx_pkg s5_pkg;
321+
uint32_t *wake_vector_32;
322+
uint64_t *wake_vector_64;
323+
}__attribute__((aligned(8)));
324+
325+
struct acpi_info {
326+
int16_t x86_family;
327+
int16_t x86_model;
328+
struct pm_s_state_data pm_s_state;
329+
/* TODO: we can add more acpi info field here if needed. */
330+
};
331+
308332
/**
309333
* @brief Info PM command from DM/VHM.
310334
*

0 commit comments

Comments
 (0)