config_tools: generate vDSDT according to allocated resources

This patch generates vDSDT for pre-launched VMs based on the scenario
configuration and static allocation results. The vDSDT contains the
following objects.

  * A device object representing the root PCI bus which has the same
    location and name as the object in physical DSDT. This object contains
    device identification objects such as _HID, _CID, _BBN and _UID, the
    _CRS object encoding the bus numbers and PCI hole regions, and the _PRT
    object encoding the routing from vPCI device pins to virtual interrupt
    lines.

  * For each pass-through device assigned to the VM, a device object is
    created based on the AML template of that device in board XML (if
    exists). The _ADR object is rewritten with the vBDF..

v1 -> v2:
  * In order to replace the current static vDSDT, the AML templates in
    board XMLs now include objects that are referenced by other devices as
    well.
  * When TPM is assigned, the corresponding device object in DSDT (if
    exists) will be copied.
  * Add the _S5 control method to vDSDT, as is done in the static DSDT
    sources.
  * The old vDSDT generation routine and the static DSDT sources it uses
    are removed.

v2 -> v3:
  * Only follow 'uses', 'is used by' or 'consumes resources by'
    dependencies.
  * Organize the device objects in vDSDT according to the scopes they are
    in.

Tracked-On: #6287
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao
2021-07-27 16:28:17 +08:00
committed by wenlingz
parent 5c34fd0c56
commit 07c2f604ae
6 changed files with 324 additions and 189 deletions

View File

@@ -1,25 +0,0 @@
/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20190703 (64-bit version)
* Copyright (c) 2000 - 2019 Intel Corporation
*
* Original Table Header:
* Signature "DSDT"
* Length 0x00000051 (81)
* Revision 0x03
* Checksum 0xF0
* OEM ID "ACRN "
* OEM Table ID "ACRNDSDT"
* OEM Revision 0x00000001 (1)
* Compiler ID "INTL"
* Compiler Version 0x20190703 (538511107)
*/
DefinitionBlock ("", "DSDT", 3, "ACRN ", "ACRNDSDT", 0x00000001)
{
Name (_S5, Package ()
{
0x05,
Zero,
})
}

View File

@@ -1,30 +0,0 @@
/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20190703 (64-bit version)
*
* Original Table Header:
* Signature "DSDT"
* Length 0x00000051 (81)
* Revision 0x03
* Checksum 0xF0
* OEM ID "ACRN "
* OEM Table ID "ACRNDSDT"
* OEM Revision 0x00000001 (1)
* Compiler ID "INTL"
* Compiler Version 0x20190703 (538511107)
*/
DefinitionBlock ("", "DSDT", 3, "ACRN ", "ACRNDSDT", 0x00000001)
{
Device (TPM)
{
Name (_HID, "MSFT0101" /* TPM 2.0 Security Device */) // _HID: Hardware ID
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
Memory32Fixed (ReadWrite,
0xFED40000, // Address Base
0x00005000, // Address Length
)
})
}
}

View File

@@ -1,64 +0,0 @@
/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20180105 (64-bit version)
* Copyright (c) 2000 - 2018 Intel Corporation
*
* Original Table Header:
* Signature "DSDT"
* Length 0x00000102 (258)
* Revision 0x03
* Checksum 0x08
* OEM ID "ACRN "
* OEM Table ID "ACRNDSDT"
* OEM Revision 0x00000001 (1)
* Compiler ID "INTL"
* Compiler Version 0x20180105 (538444037)
*/
DefinitionBlock ("", "DSDT", 3, "ACRN ", "ACRNDSDT", 0x00000001)
{
Scope (_SB)
{
Device (OTN1)
{
Name (_ADR, 0x00020000) // _ADR: Address
OperationRegion (TSRT, PCI_Config, Zero, 0x0100)
Field (TSRT, AnyAcc, NoLock, Preserve)
{
DVID, 16,
Offset (0x10),
TADL, 32,
TADH, 32
}
}
Device (PCS2)
{
Name (_HID, "INTC1033") // _HID: Hardware ID
Name (_UID, Zero) // _UID: Unique ID
Method (_STA, 0, NotSerialized) // _STA: Status
{
Return (0x0F)
}
Method (_CRS, 0, Serialized) // _CRS: Current Resource Settings
{
Name (PCSR, ResourceTemplate ()
{
Memory32Fixed (ReadWrite,
0x00000000, // Address Base
0x00000004, // Address Length
_Y00)
Memory32Fixed (ReadWrite,
0x00000000, // Address Base
0x00000004, // Address Length
_Y01)
})
CreateDWordField (PCSR, \_SB.PCS2._CRS._Y00._BAS, MAL0) // _BAS: Base Address
MAL0 = ((^^OTN1.TADL & 0xFFFFF000) + 0x0200)
CreateDWordField (PCSR, \_SB.PCS2._CRS._Y01._BAS, MDL0) // _BAS: Base Address
MDL0 = ((^^OTN1.TADL & 0xFFFFF000) + 0x0204)
Return (PCSR) /* \_SB_.PCS2._CRS.PCSR */
}
}
}
}