diff mbox

[edk2,v2] MdePkg/IndustryStandard: add definitions for ACPI 6.0 IORT

Message ID 1492585843-10974-1-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit 75ce7ef7cf054e1a266ae0e54c19a1ab66d80c6e
Headers show

Commit Message

Ard Biesheuvel April 19, 2017, 7:10 a.m. UTC
This adds #defines and struct typedefs for the various node types in
the ACPI 6.0 IO Remapping Table (IORT).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
v2: added PDF link to file header
    updated comment style to align with other ACPI header files

 MdePkg/Include/IndustryStandard/IoRemappingTable.h | 183 ++++++++++++++++++++
 1 file changed, 183 insertions(+)

-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Yao, Jiewen April 19, 2017, 7:24 a.m. UTC | #1
Hi Ard
Is there any special reason that we use INT32 instead of UINT32 in EFI_ACPI_6_0_IO_REMAPPING_TABLE?

+  INT32                                   NumNodes;
+  INT32                                   NodeOffset;
+  INT32                                   Reserved;

I am just curious. 

Thank you
Yao Jiewen


> -----Original Message-----

> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard

> Biesheuvel

> Sent: Wednesday, April 19, 2017 3:11 PM

> To: edk2-devel@lists.01.org; Gao, Liming <liming.gao@intel.com>; Kinney,

> Michael D <michael.d.kinney@intel.com>

> Cc: leif.lindholm@linaro.org; Ard Biesheuvel <ard.biesheuvel@linaro.org>

> Subject: [edk2] [PATCH v2] MdePkg/IndustryStandard: add definitions for ACPI

> 6.0 IORT

> 

> This adds #defines and struct typedefs for the various node types in

> the ACPI 6.0 IO Remapping Table (IORT).

> 

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

> v2: added PDF link to file header

>     updated comment style to align with other ACPI header files

> 

>  MdePkg/Include/IndustryStandard/IoRemappingTable.h | 183

> ++++++++++++++++++++

>  1 file changed, 183 insertions(+)

> 

> diff --git a/MdePkg/Include/IndustryStandard/IoRemappingTable.h

> b/MdePkg/Include/IndustryStandard/IoRemappingTable.h

> new file mode 100644

> index 000000000000..310819b03ff5

> --- /dev/null

> +++ b/MdePkg/Include/IndustryStandard/IoRemappingTable.h

> @@ -0,0 +1,183 @@

> +/** @file

> +  ACPI IO Remapping Table (IORT) as specified in ARM spec DEN0049B

> +

> +

> http://infocenter.arm.com/help/topic/com.arm.doc.den0049b/DEN0049B_IO_Re

> mapping_Table.pdf

> +

> +  Copyright (c) 2017, Linaro Limited. All rights reserved.<BR>

> +

> +  This program and the accompanying materials

> +  are licensed and made available under the terms and conditions of the BSD

> License

> +  which accompanies this distribution.  The full text of the license may be

> found at

> +  http://opensource.org/licenses/bsd-license.php

> +

> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS

> OR IMPLIED.

> +**/

> +

> +#ifndef __IO_REMAPPING_TABLE_H__

> +#define __IO_REMAPPING_TABLE_H__

> +

> +#include <IndustryStandard/Acpi.h>

> +

> +#define EFI_ACPI_IO_REMAPPING_TABLE_REVISION        0x0

> +

> +#define EFI_ACPI_IORT_TYPE_ITS_GROUP                0x0

> +#define EFI_ACPI_IORT_TYPE_NAMED_COMP               0x1

> +#define EFI_ACPI_IORT_TYPE_ROOT_COMPLEX             0x2

> +#define EFI_ACPI_IORT_TYPE_SMMUv1v2                 0x3

> +#define EFI_ACPI_IORT_TYPE_SMMUv3                   0x4

> +

> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_CCA           BIT0

> +

> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_TR         BIT0

> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_WA         BIT1

> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_RA         BIT2

> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_AHO        BIT3

> +

> +#define EFI_ACPI_IORT_MEM_ACCESS_FLAGS_CPM          BIT0

> +#define EFI_ACPI_IORT_MEM_ACCESS_FLAGS_DACS         BIT1

> +

> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_v1             0x0

> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_v2             0x1

> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_MMU400         0x2

> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_MMU500         0x3

> +

> +#define EFI_ACPI_IORT_SMMUv1v2_FLAG_DVM             BIT0

> +#define EFI_ACPI_IORT_SMMUv1v2_FLAG_COH_WALK        BIT1

> +

> +#define EFI_ACPI_IORT_SMMUv1v2_INT_FLAG_LEVEL       0x0

> +#define EFI_ACPI_IORT_SMMUv1v2_INT_FLAG_EDGE        0x1

> +

> +#define EFI_ACPI_IORT_SMMUv3_FLAG_COHAC_OVERRIDE    BIT0

> +#define EFI_ACPI_IORT_SMMUv3_FLAG_HTTU_OVERRIDE     BIT1

> +

> +#define EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED  0x0

> +#define EFI_ACPI_IORT_ROOT_COMPLEX_ATS_SUPPORTED    0x1

> +

> +#define EFI_ACPI_IORT_ID_MAPPING_FLAGS_SINGLE       BIT0

> +

> +#pragma pack(1)

> +

> +///

> +/// Table header

> +///

> +typedef struct {

> +  EFI_ACPI_DESCRIPTION_HEADER             Header;

> +  INT32                                   NumNodes;

> +  INT32                                   NodeOffset;

> +  INT32                                   Reserved;

> +} EFI_ACPI_6_0_IO_REMAPPING_TABLE;

> +

> +///

> +/// Definition for ID mapping table shared by all node types

> +///

> +typedef struct {

> +  UINT32                                  InputBase;

> +  UINT32                                  NumIds;

> +  UINT32                                  OutputBase;

> +  UINT32                                  OutputReference;

> +  UINT32                                  Flags;

> +} EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE;

> +

> +///

> +/// Node header definition shared by all node types

> +///

> +typedef struct {

> +  UINT8                                   Type;

> +  UINT16                                  Length;

> +  UINT8                                   Revision;

> +  UINT32                                  Reserved;

> +  UINT32                                  NumIdMappings;

> +  UINT32                                  IdReference;

> +} EFI_ACPI_6_0_IO_REMAPPING_NODE;

> +

> +///

> +/// Node type 0: ITS node

> +///

> +typedef struct {

> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

> +

> +  UINT32                                  NumItsIdentifiers;

> +//UINT32

> ItsIdentifiers[NumItsIdentifiers];

> +} EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE;

> +

> +///

> +/// Node type 1: root complex node

> +///

> +typedef struct {

> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

> +

> +  UINT32                                  CacheCoherent;

> +  UINT8                                   AllocationHints;

> +  UINT16                                  Reserved;

> +  UINT8                                   MemoryAccessFlags;

> +

> +  UINT32                                  AtsAttribute;

> +  UINT32                                  PciSegmentNumber;

> +} EFI_ACPI_6_0_IO_REMAPPING_RC_NODE;

> +

> +///

> +/// Node type 2: named component node

> +///

> +typedef struct {

> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

> +

> +  UINT32                                  Flags;

> +  UINT32                                  CacheCoherent;

> +  UINT8                                   AllocationHints;

> +  UINT16                                  Reserved;

> +  UINT8                                   MemoryAccessFlags;

> +  UINT8                                   AddressSizeLimit;

> +//UINT8                                   ObjectName[];

> +} EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE;

> +

> +///

> +/// Node type 3: SMMUv1 or SMMUv2 node

> +///

> +typedef struct {

> +  UINT32                                  Interrupt;

> +  UINT32                                  InterruptFlags;

> +} EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT;

> +

> +typedef struct {

> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

> +

> +  UINT64                                  Base;

> +  UINT64                                  Span;

> +  UINT32                                  Model;

> +  UINT32                                  Flags;

> +  UINT32                                  GlobalInterruptArrayRef;

> +  UINT32                                  NumContextInterrupts;

> +  UINT32                                  ContextInterruptArrayRef;

> +  UINT32                                  NumPmuInterrupts;

> +  UINT32                                  PmuInterruptArrayRef;

> +

> +  UINT32                                  SMMU_NSgIrpt;

> +  UINT32                                  SMMU_NSgIrptFlags;

> +  UINT32                                  SMMU_NSgCfgIrpt;

> +  UINT32                                  SMMU_NSgCfgIrptFlags;

> +

> +//EFI_ACPI_6_0_IO_REMAPPING_SMMU_CTX_INT

> ContextInterrupt[NumContextInterrupts];

> +//EFI_ACPI_6_0_IO_REMAPPING_SMMU_CTX_INT

> PmuInterrupt[NumPmuInterrupts];

> +} EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE;

> +

> +///

> +/// Node type 4: SMMUv4 node

> +///

> +typedef struct {

> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

> +

> +  UINT64                                  Base;

> +  UINT32                                  Flags;

> +  UINT32                                  Reserved;

> +  UINT64                                  VatosAddress;

> +  UINT32                                  Model;

> +  UINT32                                  Event;

> +  UINT32                                  Pri;

> +  UINT32                                  Gerr;

> +  UINT32                                  Sync;

> +} EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE;

> +

> +#pragma pack()

> +

> +#endif

> --

> 2.7.4

> 

> _______________________________________________

> edk2-devel mailing list

> edk2-devel@lists.01.org

> https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel April 19, 2017, 7:46 a.m. UTC | #2
On 19 April 2017 at 08:24, Yao, Jiewen <jiewen.yao@intel.com> wrote:
> Hi Ard

> Is there any special reason that we use INT32 instead of UINT32 in EFI_ACPI_6_0_IO_REMAPPING_TABLE?

>

> +  INT32                                   NumNodes;

> +  INT32                                   NodeOffset;

> +  INT32                                   Reserved;

>

> I am just curious.

>


No, simply an oversight on my part.

I will fix that up before committing.

Thanks,
Ard.


>> -----Original Message-----

>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard

>> Biesheuvel

>> Sent: Wednesday, April 19, 2017 3:11 PM

>> To: edk2-devel@lists.01.org; Gao, Liming <liming.gao@intel.com>; Kinney,

>> Michael D <michael.d.kinney@intel.com>

>> Cc: leif.lindholm@linaro.org; Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> Subject: [edk2] [PATCH v2] MdePkg/IndustryStandard: add definitions for ACPI

>> 6.0 IORT

>>

>> This adds #defines and struct typedefs for the various node types in

>> the ACPI 6.0 IO Remapping Table (IORT).

>>

>> Contributed-under: TianoCore Contribution Agreement 1.0

>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> ---

>> v2: added PDF link to file header

>>     updated comment style to align with other ACPI header files

>>

>>  MdePkg/Include/IndustryStandard/IoRemappingTable.h | 183

>> ++++++++++++++++++++

>>  1 file changed, 183 insertions(+)

>>

>> diff --git a/MdePkg/Include/IndustryStandard/IoRemappingTable.h

>> b/MdePkg/Include/IndustryStandard/IoRemappingTable.h

>> new file mode 100644

>> index 000000000000..310819b03ff5

>> --- /dev/null

>> +++ b/MdePkg/Include/IndustryStandard/IoRemappingTable.h

>> @@ -0,0 +1,183 @@

>> +/** @file

>> +  ACPI IO Remapping Table (IORT) as specified in ARM spec DEN0049B

>> +

>> +

>> http://infocenter.arm.com/help/topic/com.arm.doc.den0049b/DEN0049B_IO_Re

>> mapping_Table.pdf

>> +

>> +  Copyright (c) 2017, Linaro Limited. All rights reserved.<BR>

>> +

>> +  This program and the accompanying materials

>> +  are licensed and made available under the terms and conditions of the BSD

>> License

>> +  which accompanies this distribution.  The full text of the license may be

>> found at

>> +  http://opensource.org/licenses/bsd-license.php

>> +

>> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

>> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS

>> OR IMPLIED.

>> +**/

>> +

>> +#ifndef __IO_REMAPPING_TABLE_H__

>> +#define __IO_REMAPPING_TABLE_H__

>> +

>> +#include <IndustryStandard/Acpi.h>

>> +

>> +#define EFI_ACPI_IO_REMAPPING_TABLE_REVISION        0x0

>> +

>> +#define EFI_ACPI_IORT_TYPE_ITS_GROUP                0x0

>> +#define EFI_ACPI_IORT_TYPE_NAMED_COMP               0x1

>> +#define EFI_ACPI_IORT_TYPE_ROOT_COMPLEX             0x2

>> +#define EFI_ACPI_IORT_TYPE_SMMUv1v2                 0x3

>> +#define EFI_ACPI_IORT_TYPE_SMMUv3                   0x4

>> +

>> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_CCA           BIT0

>> +

>> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_TR         BIT0

>> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_WA         BIT1

>> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_RA         BIT2

>> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_AHO        BIT3

>> +

>> +#define EFI_ACPI_IORT_MEM_ACCESS_FLAGS_CPM          BIT0

>> +#define EFI_ACPI_IORT_MEM_ACCESS_FLAGS_DACS         BIT1

>> +

>> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_v1             0x0

>> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_v2             0x1

>> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_MMU400         0x2

>> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_MMU500         0x3

>> +

>> +#define EFI_ACPI_IORT_SMMUv1v2_FLAG_DVM             BIT0

>> +#define EFI_ACPI_IORT_SMMUv1v2_FLAG_COH_WALK        BIT1

>> +

>> +#define EFI_ACPI_IORT_SMMUv1v2_INT_FLAG_LEVEL       0x0

>> +#define EFI_ACPI_IORT_SMMUv1v2_INT_FLAG_EDGE        0x1

>> +

>> +#define EFI_ACPI_IORT_SMMUv3_FLAG_COHAC_OVERRIDE    BIT0

>> +#define EFI_ACPI_IORT_SMMUv3_FLAG_HTTU_OVERRIDE     BIT1

>> +

>> +#define EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED  0x0

>> +#define EFI_ACPI_IORT_ROOT_COMPLEX_ATS_SUPPORTED    0x1

>> +

>> +#define EFI_ACPI_IORT_ID_MAPPING_FLAGS_SINGLE       BIT0

>> +

>> +#pragma pack(1)

>> +

>> +///

>> +/// Table header

>> +///

>> +typedef struct {

>> +  EFI_ACPI_DESCRIPTION_HEADER             Header;

>> +  INT32                                   NumNodes;

>> +  INT32                                   NodeOffset;

>> +  INT32                                   Reserved;

>> +} EFI_ACPI_6_0_IO_REMAPPING_TABLE;

>> +

>> +///

>> +/// Definition for ID mapping table shared by all node types

>> +///

>> +typedef struct {

>> +  UINT32                                  InputBase;

>> +  UINT32                                  NumIds;

>> +  UINT32                                  OutputBase;

>> +  UINT32                                  OutputReference;

>> +  UINT32                                  Flags;

>> +} EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE;

>> +

>> +///

>> +/// Node header definition shared by all node types

>> +///

>> +typedef struct {

>> +  UINT8                                   Type;

>> +  UINT16                                  Length;

>> +  UINT8                                   Revision;

>> +  UINT32                                  Reserved;

>> +  UINT32                                  NumIdMappings;

>> +  UINT32                                  IdReference;

>> +} EFI_ACPI_6_0_IO_REMAPPING_NODE;

>> +

>> +///

>> +/// Node type 0: ITS node

>> +///

>> +typedef struct {

>> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

>> +

>> +  UINT32                                  NumItsIdentifiers;

>> +//UINT32

>> ItsIdentifiers[NumItsIdentifiers];

>> +} EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE;

>> +

>> +///

>> +/// Node type 1: root complex node

>> +///

>> +typedef struct {

>> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

>> +

>> +  UINT32                                  CacheCoherent;

>> +  UINT8                                   AllocationHints;

>> +  UINT16                                  Reserved;

>> +  UINT8                                   MemoryAccessFlags;

>> +

>> +  UINT32                                  AtsAttribute;

>> +  UINT32                                  PciSegmentNumber;

>> +} EFI_ACPI_6_0_IO_REMAPPING_RC_NODE;

>> +

>> +///

>> +/// Node type 2: named component node

>> +///

>> +typedef struct {

>> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

>> +

>> +  UINT32                                  Flags;

>> +  UINT32                                  CacheCoherent;

>> +  UINT8                                   AllocationHints;

>> +  UINT16                                  Reserved;

>> +  UINT8                                   MemoryAccessFlags;

>> +  UINT8                                   AddressSizeLimit;

>> +//UINT8                                   ObjectName[];

>> +} EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE;

>> +

>> +///

>> +/// Node type 3: SMMUv1 or SMMUv2 node

>> +///

>> +typedef struct {

>> +  UINT32                                  Interrupt;

>> +  UINT32                                  InterruptFlags;

>> +} EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT;

>> +

>> +typedef struct {

>> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

>> +

>> +  UINT64                                  Base;

>> +  UINT64                                  Span;

>> +  UINT32                                  Model;

>> +  UINT32                                  Flags;

>> +  UINT32                                  GlobalInterruptArrayRef;

>> +  UINT32                                  NumContextInterrupts;

>> +  UINT32                                  ContextInterruptArrayRef;

>> +  UINT32                                  NumPmuInterrupts;

>> +  UINT32                                  PmuInterruptArrayRef;

>> +

>> +  UINT32                                  SMMU_NSgIrpt;

>> +  UINT32                                  SMMU_NSgIrptFlags;

>> +  UINT32                                  SMMU_NSgCfgIrpt;

>> +  UINT32                                  SMMU_NSgCfgIrptFlags;

>> +

>> +//EFI_ACPI_6_0_IO_REMAPPING_SMMU_CTX_INT

>> ContextInterrupt[NumContextInterrupts];

>> +//EFI_ACPI_6_0_IO_REMAPPING_SMMU_CTX_INT

>> PmuInterrupt[NumPmuInterrupts];

>> +} EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE;

>> +

>> +///

>> +/// Node type 4: SMMUv4 node

>> +///

>> +typedef struct {

>> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

>> +

>> +  UINT64                                  Base;

>> +  UINT32                                  Flags;

>> +  UINT32                                  Reserved;

>> +  UINT64                                  VatosAddress;

>> +  UINT32                                  Model;

>> +  UINT32                                  Event;

>> +  UINT32                                  Pri;

>> +  UINT32                                  Gerr;

>> +  UINT32                                  Sync;

>> +} EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE;

>> +

>> +#pragma pack()

>> +

>> +#endif

>> --

>> 2.7.4

>>

>> _______________________________________________

>> edk2-devel mailing list

>> edk2-devel@lists.01.org

>> https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Yao, Jiewen April 19, 2017, 8:54 a.m. UTC | #3
Thank you. That makes more sense to me. :)

Reviewed-by: Jiewen.yao@intel.com


Thank you
Yao Jiewen

From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard Biesheuvel

Sent: Wednesday, April 19, 2017 3:46 PM
To: Yao, Jiewen <jiewen.yao@intel.com>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; edk2-devel@lists.01.org; leif.lindholm@linaro.org; Gao, Liming <liming.gao@intel.com>
Subject: Re: [edk2] [PATCH v2] MdePkg/IndustryStandard: add definitions for ACPI 6.0 IORT

On 19 April 2017 at 08:24, Yao, Jiewen <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>> wrote:
> Hi Ard

> Is there any special reason that we use INT32 instead of UINT32 in EFI_ACPI_6_0_IO_REMAPPING_TABLE?

>

> +  INT32                                   NumNodes;

> +  INT32                                   NodeOffset;

> +  INT32                                   Reserved;

>

> I am just curious.

>


No, simply an oversight on my part.

I will fix that up before committing.

Thanks,
Ard.


>> -----Original Message-----

>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard

>> Biesheuvel

>> Sent: Wednesday, April 19, 2017 3:11 PM

>> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Kinney,

>> Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>

>> Cc: leif.lindholm@linaro.org<mailto:leif.lindholm@linaro.org>; Ard Biesheuvel <ard.biesheuvel@linaro.org<mailto:ard.biesheuvel@linaro.org>>

>> Subject: [edk2] [PATCH v2] MdePkg/IndustryStandard: add definitions for ACPI

>> 6.0 IORT

>>

>> This adds #defines and struct typedefs for the various node types in

>> the ACPI 6.0 IO Remapping Table (IORT).

>>

>> Contributed-under: TianoCore Contribution Agreement 1.0

>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org<mailto:ard.biesheuvel@linaro.org>>

>> ---

>> v2: added PDF link to file header

>>     updated comment style to align with other ACPI header files

>>

>>  MdePkg/Include/IndustryStandard/IoRemappingTable.h | 183

>> ++++++++++++++++++++

>>  1 file changed, 183 insertions(+)

>>

>> diff --git a/MdePkg/Include/IndustryStandard/IoRemappingTable.h

>> b/MdePkg/Include/IndustryStandard/IoRemappingTable.h

>> new file mode 100644

>> index 000000000000..310819b03ff5

>> --- /dev/null

>> +++ b/MdePkg/Include/IndustryStandard/IoRemappingTable.h

>> @@ -0,0 +1,183 @@

>> +/** @file

>> +  ACPI IO Remapping Table (IORT) as specified in ARM spec DEN0049B

>> +

>> +

>> http://infocenter.arm.com/help/topic/com.arm.doc.den0049b/DEN0049B_IO_Re

>> mapping_Table.pdf

>> +

>> +  Copyright (c) 2017, Linaro Limited. All rights reserved.<BR>

>> +

>> +  This program and the accompanying materials

>> +  are licensed and made available under the terms and conditions of the BSD

>> License

>> +  which accompanies this distribution.  The full text of the license may be

>> found at

>> +  http://opensource.org/licenses/bsd-license.php

>> +

>> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

>> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS

>> OR IMPLIED.

>> +**/

>> +

>> +#ifndef __IO_REMAPPING_TABLE_H__

>> +#define __IO_REMAPPING_TABLE_H__

>> +

>> +#include <IndustryStandard/Acpi.h>

>> +

>> +#define EFI_ACPI_IO_REMAPPING_TABLE_REVISION        0x0

>> +

>> +#define EFI_ACPI_IORT_TYPE_ITS_GROUP                0x0

>> +#define EFI_ACPI_IORT_TYPE_NAMED_COMP               0x1

>> +#define EFI_ACPI_IORT_TYPE_ROOT_COMPLEX             0x2

>> +#define EFI_ACPI_IORT_TYPE_SMMUv1v2                 0x3

>> +#define EFI_ACPI_IORT_TYPE_SMMUv3                   0x4

>> +

>> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_CCA           BIT0

>> +

>> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_TR         BIT0

>> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_WA         BIT1

>> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_RA         BIT2

>> +#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_AHO        BIT3

>> +

>> +#define EFI_ACPI_IORT_MEM_ACCESS_FLAGS_CPM          BIT0

>> +#define EFI_ACPI_IORT_MEM_ACCESS_FLAGS_DACS         BIT1

>> +

>> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_v1             0x0

>> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_v2             0x1

>> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_MMU400         0x2

>> +#define EFI_ACPI_IORT_SMMUv1v2_MODEL_MMU500         0x3

>> +

>> +#define EFI_ACPI_IORT_SMMUv1v2_FLAG_DVM             BIT0

>> +#define EFI_ACPI_IORT_SMMUv1v2_FLAG_COH_WALK        BIT1

>> +

>> +#define EFI_ACPI_IORT_SMMUv1v2_INT_FLAG_LEVEL       0x0

>> +#define EFI_ACPI_IORT_SMMUv1v2_INT_FLAG_EDGE        0x1

>> +

>> +#define EFI_ACPI_IORT_SMMUv3_FLAG_COHAC_OVERRIDE    BIT0

>> +#define EFI_ACPI_IORT_SMMUv3_FLAG_HTTU_OVERRIDE     BIT1

>> +

>> +#define EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED  0x0

>> +#define EFI_ACPI_IORT_ROOT_COMPLEX_ATS_SUPPORTED    0x1

>> +

>> +#define EFI_ACPI_IORT_ID_MAPPING_FLAGS_SINGLE       BIT0

>> +

>> +#pragma pack(1)

>> +

>> +///

>> +/// Table header

>> +///

>> +typedef struct {

>> +  EFI_ACPI_DESCRIPTION_HEADER             Header;

>> +  INT32                                   NumNodes;

>> +  INT32                                   NodeOffset;

>> +  INT32                                   Reserved;

>> +} EFI_ACPI_6_0_IO_REMAPPING_TABLE;

>> +

>> +///

>> +/// Definition for ID mapping table shared by all node types

>> +///

>> +typedef struct {

>> +  UINT32                                  InputBase;

>> +  UINT32                                  NumIds;

>> +  UINT32                                  OutputBase;

>> +  UINT32                                  OutputReference;

>> +  UINT32                                  Flags;

>> +} EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE;

>> +

>> +///

>> +/// Node header definition shared by all node types

>> +///

>> +typedef struct {

>> +  UINT8                                   Type;

>> +  UINT16                                  Length;

>> +  UINT8                                   Revision;

>> +  UINT32                                  Reserved;

>> +  UINT32                                  NumIdMappings;

>> +  UINT32                                  IdReference;

>> +} EFI_ACPI_6_0_IO_REMAPPING_NODE;

>> +

>> +///

>> +/// Node type 0: ITS node

>> +///

>> +typedef struct {

>> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

>> +

>> +  UINT32                                  NumItsIdentifiers;

>> +//UINT32

>> ItsIdentifiers[NumItsIdentifiers];

>> +} EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE;

>> +

>> +///

>> +/// Node type 1: root complex node

>> +///

>> +typedef struct {

>> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

>> +

>> +  UINT32                                  CacheCoherent;

>> +  UINT8                                   AllocationHints;

>> +  UINT16                                  Reserved;

>> +  UINT8                                   MemoryAccessFlags;

>> +

>> +  UINT32                                  AtsAttribute;

>> +  UINT32                                  PciSegmentNumber;

>> +} EFI_ACPI_6_0_IO_REMAPPING_RC_NODE;

>> +

>> +///

>> +/// Node type 2: named component node

>> +///

>> +typedef struct {

>> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

>> +

>> +  UINT32                                  Flags;

>> +  UINT32                                  CacheCoherent;

>> +  UINT8                                   AllocationHints;

>> +  UINT16                                  Reserved;

>> +  UINT8                                   MemoryAccessFlags;

>> +  UINT8                                   AddressSizeLimit;

>> +//UINT8                                   ObjectName[];

>> +} EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE;

>> +

>> +///

>> +/// Node type 3: SMMUv1 or SMMUv2 node

>> +///

>> +typedef struct {

>> +  UINT32                                  Interrupt;

>> +  UINT32                                  InterruptFlags;

>> +} EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT;

>> +

>> +typedef struct {

>> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

>> +

>> +  UINT64                                  Base;

>> +  UINT64                                  Span;

>> +  UINT32                                  Model;

>> +  UINT32                                  Flags;

>> +  UINT32                                  GlobalInterruptArrayRef;

>> +  UINT32                                  NumContextInterrupts;

>> +  UINT32                                  ContextInterruptArrayRef;

>> +  UINT32                                  NumPmuInterrupts;

>> +  UINT32                                  PmuInterruptArrayRef;

>> +

>> +  UINT32                                  SMMU_NSgIrpt;

>> +  UINT32                                  SMMU_NSgIrptFlags;

>> +  UINT32                                  SMMU_NSgCfgIrpt;

>> +  UINT32                                  SMMU_NSgCfgIrptFlags;

>> +

>> +//EFI_ACPI_6_0_IO_REMAPPING_SMMU_CTX_INT

>> ContextInterrupt[NumContextInterrupts];

>> +//EFI_ACPI_6_0_IO_REMAPPING_SMMU_CTX_INT

>> PmuInterrupt[NumPmuInterrupts];

>> +} EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE;

>> +

>> +///

>> +/// Node type 4: SMMUv4 node

>> +///

>> +typedef struct {

>> +  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;

>> +

>> +  UINT64                                  Base;

>> +  UINT32                                  Flags;

>> +  UINT32                                  Reserved;

>> +  UINT64                                  VatosAddress;

>> +  UINT32                                  Model;

>> +  UINT32                                  Event;

>> +  UINT32                                  Pri;

>> +  UINT32                                  Gerr;

>> +  UINT32                                  Sync;

>> +} EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE;

>> +

>> +#pragma pack()

>> +

>> +#endif

>> --

>> 2.7.4

>>

>> _______________________________________________

>> edk2-devel mailing list

>> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>

>> https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel April 20, 2017, 7:29 a.m. UTC | #4
On 19 April 2017 at 09:54, Yao, Jiewen <jiewen.yao@intel.com> wrote:
> Thank you. That makes more sense to me. J

>

>

>

> Reviewed-by: Jiewen.yao@intel.com

>

>


Thanks,

Liming, Michael, any other concerns with this patch?
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Kinney, Michael D April 20, 2017, 2:12 p.m. UTC | #5
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>


Mike

> -----Original Message-----

> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]

> Sent: Thursday, April 20, 2017 12:30 AM

> To: Yao, Jiewen <jiewen.yao@intel.com>; Kinney, Michael D

> <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>

> Cc: edk2-devel@lists.01.org; leif.lindholm@linaro.org

> Subject: Re: [edk2] [PATCH v2] MdePkg/IndustryStandard: add definitions for ACPI

> 6.0 IORT

> 

> On 19 April 2017 at 09:54, Yao, Jiewen <jiewen.yao@intel.com> wrote:

> > Thank you. That makes more sense to me. J

> >

> >

> >

> > Reviewed-by: Jiewen.yao@intel.com

> >

> >

> 

> Thanks,

> 

> Liming, Michael, any other concerns with this patch?

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel April 20, 2017, 2:18 p.m. UTC | #6
On 20 April 2017 at 15:12, Kinney, Michael D <michael.d.kinney@intel.com> wrote:
> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>

>

> Mike

>

>> -----Original Message-----

>> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]

>> Sent: Thursday, April 20, 2017 12:30 AM

>> To: Yao, Jiewen <jiewen.yao@intel.com>; Kinney, Michael D

>> <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>

>> Cc: edk2-devel@lists.01.org; leif.lindholm@linaro.org

>> Subject: Re: [edk2] [PATCH v2] MdePkg/IndustryStandard: add definitions for ACPI

>> 6.0 IORT

>>

>> On 19 April 2017 at 09:54, Yao, Jiewen <jiewen.yao@intel.com> wrote:

>> > Thank you. That makes more sense to me. J

>> >

>> >

>> >

>> > Reviewed-by: Jiewen.yao@intel.com

>> >

>> >


Pushed as 75ce7ef7cf05

Thanks all
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/MdePkg/Include/IndustryStandard/IoRemappingTable.h b/MdePkg/Include/IndustryStandard/IoRemappingTable.h
new file mode 100644
index 000000000000..310819b03ff5
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/IoRemappingTable.h
@@ -0,0 +1,183 @@ 
+/** @file
+  ACPI IO Remapping Table (IORT) as specified in ARM spec DEN0049B
+
+  http://infocenter.arm.com/help/topic/com.arm.doc.den0049b/DEN0049B_IO_Remapping_Table.pdf
+
+  Copyright (c) 2017, Linaro Limited. All rights reserved.<BR>
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+#ifndef __IO_REMAPPING_TABLE_H__
+#define __IO_REMAPPING_TABLE_H__
+
+#include <IndustryStandard/Acpi.h>
+
+#define EFI_ACPI_IO_REMAPPING_TABLE_REVISION        0x0
+
+#define EFI_ACPI_IORT_TYPE_ITS_GROUP                0x0
+#define EFI_ACPI_IORT_TYPE_NAMED_COMP               0x1
+#define EFI_ACPI_IORT_TYPE_ROOT_COMPLEX             0x2
+#define EFI_ACPI_IORT_TYPE_SMMUv1v2                 0x3
+#define EFI_ACPI_IORT_TYPE_SMMUv3                   0x4
+
+#define EFI_ACPI_IORT_MEM_ACCESS_PROP_CCA           BIT0
+
+#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_TR         BIT0
+#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_WA         BIT1
+#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_RA         BIT2
+#define EFI_ACPI_IORT_MEM_ACCESS_PROP_AH_AHO        BIT3
+
+#define EFI_ACPI_IORT_MEM_ACCESS_FLAGS_CPM          BIT0
+#define EFI_ACPI_IORT_MEM_ACCESS_FLAGS_DACS         BIT1
+
+#define EFI_ACPI_IORT_SMMUv1v2_MODEL_v1             0x0
+#define EFI_ACPI_IORT_SMMUv1v2_MODEL_v2             0x1
+#define EFI_ACPI_IORT_SMMUv1v2_MODEL_MMU400         0x2
+#define EFI_ACPI_IORT_SMMUv1v2_MODEL_MMU500         0x3
+
+#define EFI_ACPI_IORT_SMMUv1v2_FLAG_DVM             BIT0
+#define EFI_ACPI_IORT_SMMUv1v2_FLAG_COH_WALK        BIT1
+
+#define EFI_ACPI_IORT_SMMUv1v2_INT_FLAG_LEVEL       0x0
+#define EFI_ACPI_IORT_SMMUv1v2_INT_FLAG_EDGE        0x1
+
+#define EFI_ACPI_IORT_SMMUv3_FLAG_COHAC_OVERRIDE    BIT0
+#define EFI_ACPI_IORT_SMMUv3_FLAG_HTTU_OVERRIDE     BIT1
+
+#define EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED  0x0
+#define EFI_ACPI_IORT_ROOT_COMPLEX_ATS_SUPPORTED    0x1
+
+#define EFI_ACPI_IORT_ID_MAPPING_FLAGS_SINGLE       BIT0
+
+#pragma pack(1)
+
+///
+/// Table header
+///
+typedef struct {
+  EFI_ACPI_DESCRIPTION_HEADER             Header;
+  INT32                                   NumNodes;
+  INT32                                   NodeOffset;
+  INT32                                   Reserved;
+} EFI_ACPI_6_0_IO_REMAPPING_TABLE;
+
+///
+/// Definition for ID mapping table shared by all node types
+///
+typedef struct {
+  UINT32                                  InputBase;
+  UINT32                                  NumIds;
+  UINT32                                  OutputBase;
+  UINT32                                  OutputReference;
+  UINT32                                  Flags;
+} EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE;
+
+///
+/// Node header definition shared by all node types
+///
+typedef struct {
+  UINT8                                   Type;
+  UINT16                                  Length;
+  UINT8                                   Revision;
+  UINT32                                  Reserved;
+  UINT32                                  NumIdMappings;
+  UINT32                                  IdReference;
+} EFI_ACPI_6_0_IO_REMAPPING_NODE;
+
+///
+/// Node type 0: ITS node
+///
+typedef struct {
+  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;
+
+  UINT32                                  NumItsIdentifiers;
+//UINT32                                  ItsIdentifiers[NumItsIdentifiers];
+} EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE;
+
+///
+/// Node type 1: root complex node
+///
+typedef struct {
+  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;
+
+  UINT32                                  CacheCoherent;
+  UINT8                                   AllocationHints;
+  UINT16                                  Reserved;
+  UINT8                                   MemoryAccessFlags;
+
+  UINT32                                  AtsAttribute;
+  UINT32                                  PciSegmentNumber;
+} EFI_ACPI_6_0_IO_REMAPPING_RC_NODE;
+
+///
+/// Node type 2: named component node
+///
+typedef struct {
+  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;
+
+  UINT32                                  Flags;
+  UINT32                                  CacheCoherent;
+  UINT8                                   AllocationHints;
+  UINT16                                  Reserved;
+  UINT8                                   MemoryAccessFlags;
+  UINT8                                   AddressSizeLimit;
+//UINT8                                   ObjectName[];
+} EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE;
+
+///
+/// Node type 3: SMMUv1 or SMMUv2 node
+///
+typedef struct {
+  UINT32                                  Interrupt;
+  UINT32                                  InterruptFlags;
+} EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT;
+
+typedef struct {
+  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;
+
+  UINT64                                  Base;
+  UINT64                                  Span;
+  UINT32                                  Model;
+  UINT32                                  Flags;
+  UINT32                                  GlobalInterruptArrayRef;
+  UINT32                                  NumContextInterrupts;
+  UINT32                                  ContextInterruptArrayRef;
+  UINT32                                  NumPmuInterrupts;
+  UINT32                                  PmuInterruptArrayRef;
+
+  UINT32                                  SMMU_NSgIrpt;
+  UINT32                                  SMMU_NSgIrptFlags;
+  UINT32                                  SMMU_NSgCfgIrpt;
+  UINT32                                  SMMU_NSgCfgIrptFlags;
+
+//EFI_ACPI_6_0_IO_REMAPPING_SMMU_CTX_INT  ContextInterrupt[NumContextInterrupts];
+//EFI_ACPI_6_0_IO_REMAPPING_SMMU_CTX_INT  PmuInterrupt[NumPmuInterrupts];
+} EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE;
+
+///
+/// Node type 4: SMMUv4 node
+///
+typedef struct {
+  EFI_ACPI_6_0_IO_REMAPPING_NODE          Node;
+
+  UINT64                                  Base;
+  UINT32                                  Flags;
+  UINT32                                  Reserved;
+  UINT64                                  VatosAddress;
+  UINT32                                  Model;
+  UINT32                                  Event;
+  UINT32                                  Pri;
+  UINT32                                  Gerr;
+  UINT32                                  Sync;
+} EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE;
+
+#pragma pack()
+
+#endif