mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 14:44:28 +02:00
ArmVirtPkg/FdtClientDxe: report address and size cell count directly
The FDT client protocol methods dealing with "reg" properties return the size of a "reg" element. Currently, we have hardcoded this as '8', since #address-cells == #size-cells == 2 in most cases. However, for different values, have a single 'reg' element size is not unambiguous, since - however unlikely - if #address-cells != #size-cells, we do not know which is which. So before adding more methods to the protocol, fix up this oversight. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
38ed4a9e3a
commit
cfc8d51c0c
@ -159,7 +159,8 @@ FindCompatibleNodeReg (
|
|||||||
IN FDT_CLIENT_PROTOCOL *This,
|
IN FDT_CLIENT_PROTOCOL *This,
|
||||||
IN CONST CHAR8 *CompatibleString,
|
IN CONST CHAR8 *CompatibleString,
|
||||||
OUT CONST VOID **Reg,
|
OUT CONST VOID **Reg,
|
||||||
OUT UINT32 *RegElemSize,
|
OUT UINTN *AddressCells,
|
||||||
|
OUT UINTN *SizeCells,
|
||||||
OUT UINT32 *RegSize
|
OUT UINT32 *RegSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -185,7 +186,8 @@ FindCompatibleNodeReg (
|
|||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
*RegElemSize = 8;
|
*AddressCells = 2;
|
||||||
|
*SizeCells = 2;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,8 @@ EFI_STATUS
|
|||||||
IN FDT_CLIENT_PROTOCOL *This,
|
IN FDT_CLIENT_PROTOCOL *This,
|
||||||
IN CONST CHAR8 *CompatibleString,
|
IN CONST CHAR8 *CompatibleString,
|
||||||
OUT CONST VOID **Reg,
|
OUT CONST VOID **Reg,
|
||||||
OUT UINT32 *RegElemSize,
|
OUT UINTN *AddressCells,
|
||||||
|
OUT UINTN *SizeCells,
|
||||||
OUT UINT32 *RegSize
|
OUT UINT32 *RegSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ ArmVirtGicArchLibConstructor (
|
|||||||
UINT32 IccSre;
|
UINT32 IccSre;
|
||||||
FDT_CLIENT_PROTOCOL *FdtClient;
|
FDT_CLIENT_PROTOCOL *FdtClient;
|
||||||
CONST UINT64 *Reg;
|
CONST UINT64 *Reg;
|
||||||
UINT32 RegElemSize, RegSize;
|
UINT32 RegSize;
|
||||||
|
UINTN AddressCells, SizeCells;
|
||||||
UINTN GicRevision;
|
UINTN GicRevision;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT64 DistBase, CpuBase, RedistBase;
|
UINT64 DistBase, CpuBase, RedistBase;
|
||||||
@ -47,11 +48,13 @@ ArmVirtGicArchLibConstructor (
|
|||||||
|
|
||||||
GicRevision = 2;
|
GicRevision = 2;
|
||||||
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "arm,cortex-a15-gic",
|
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "arm,cortex-a15-gic",
|
||||||
(CONST VOID **)&Reg, &RegElemSize, &RegSize);
|
(CONST VOID **)&Reg, &AddressCells, &SizeCells,
|
||||||
|
&RegSize);
|
||||||
if (Status == EFI_NOT_FOUND) {
|
if (Status == EFI_NOT_FOUND) {
|
||||||
GicRevision = 3;
|
GicRevision = 3;
|
||||||
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "arm,gic-v3",
|
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "arm,gic-v3",
|
||||||
(CONST VOID **)&Reg, &RegElemSize, &RegSize);
|
(CONST VOID **)&Reg, &AddressCells, &SizeCells,
|
||||||
|
&RegSize);
|
||||||
}
|
}
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -122,7 +122,8 @@ QemuFwCfgInitialize (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
FDT_CLIENT_PROTOCOL *FdtClient;
|
FDT_CLIENT_PROTOCOL *FdtClient;
|
||||||
CONST UINT64 *Reg;
|
CONST UINT64 *Reg;
|
||||||
UINT32 RegElemSize, RegSize;
|
UINT32 RegSize;
|
||||||
|
UINTN AddressCells, SizeCells;
|
||||||
UINT64 FwCfgSelectorAddress;
|
UINT64 FwCfgSelectorAddress;
|
||||||
UINT64 FwCfgSelectorSize;
|
UINT64 FwCfgSelectorSize;
|
||||||
UINT64 FwCfgDataAddress;
|
UINT64 FwCfgDataAddress;
|
||||||
@ -135,7 +136,8 @@ QemuFwCfgInitialize (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "qemu,fw-cfg-mmio",
|
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "qemu,fw-cfg-mmio",
|
||||||
(CONST VOID **)&Reg, &RegElemSize, &RegSize);
|
(CONST VOID **)&Reg, &AddressCells, &SizeCells,
|
||||||
|
&RegSize);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((EFI_D_WARN,
|
DEBUG ((EFI_D_WARN,
|
||||||
"%a: No 'qemu,fw-cfg-mmio' compatible DT node found (Status == %r)\n",
|
"%a: No 'qemu,fw-cfg-mmio' compatible DT node found (Status == %r)\n",
|
||||||
@ -143,7 +145,8 @@ QemuFwCfgInitialize (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (RegElemSize == sizeof (UINT64));
|
ASSERT (AddressCells == 2);
|
||||||
|
ASSERT (SizeCells == 2);
|
||||||
ASSERT (RegSize == 2 * sizeof (UINT64));
|
ASSERT (RegSize == 2 * sizeof (UINT64));
|
||||||
|
|
||||||
FwCfgDataAddress = SwapBytes64 (Reg[0]);
|
FwCfgDataAddress = SwapBytes64 (Reg[0]);
|
||||||
|
@ -45,7 +45,8 @@ GetXenArmAcpiRsdp (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
FDT_CLIENT_PROTOCOL *FdtClient;
|
FDT_CLIENT_PROTOCOL *FdtClient;
|
||||||
CONST UINT64 *Reg;
|
CONST UINT64 *Reg;
|
||||||
UINT32 RegElemSize, RegSize;
|
UINT32 RegSize;
|
||||||
|
UINTN AddressCells, SizeCells;
|
||||||
UINT64 RegBase;
|
UINT64 RegBase;
|
||||||
UINT8 Sum;
|
UINT8 Sum;
|
||||||
|
|
||||||
@ -59,13 +60,16 @@ GetXenArmAcpiRsdp (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,guest-acpi",
|
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,guest-acpi",
|
||||||
(CONST VOID **)&Reg, &RegElemSize, &RegSize);
|
(CONST VOID **)&Reg, &AddressCells, &SizeCells,
|
||||||
|
&RegSize);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((EFI_D_WARN, "%a: No 'xen,guest-acpi' compatible DT node found\n",
|
DEBUG ((EFI_D_WARN, "%a: No 'xen,guest-acpi' compatible DT node found\n",
|
||||||
__FUNCTION__));
|
__FUNCTION__));
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASSERT (AddressCells == 2);
|
||||||
|
ASSERT (SizeCells == 2);
|
||||||
ASSERT (RegSize == 2 * sizeof (UINT64));
|
ASSERT (RegSize == 2 * sizeof (UINT64));
|
||||||
|
|
||||||
RegBase = SwapBytes64(Reg[0]);
|
RegBase = SwapBytes64(Reg[0]);
|
||||||
|
@ -31,7 +31,8 @@ InitializeXenioFdtDxe (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
FDT_CLIENT_PROTOCOL *FdtClient;
|
FDT_CLIENT_PROTOCOL *FdtClient;
|
||||||
CONST UINT64 *Reg;
|
CONST UINT64 *Reg;
|
||||||
UINT32 RegElemSize, RegSize;
|
UINT32 RegSize;
|
||||||
|
UINTN AddressCells, SizeCells;
|
||||||
EFI_HANDLE Handle;
|
EFI_HANDLE Handle;
|
||||||
UINT64 RegBase;
|
UINT64 RegBase;
|
||||||
|
|
||||||
@ -40,14 +41,17 @@ InitializeXenioFdtDxe (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,xen",
|
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,xen",
|
||||||
(CONST VOID **)&Reg, &RegElemSize, &RegSize);
|
(CONST VOID **)&Reg, &AddressCells, &SizeCells,
|
||||||
|
&RegSize);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((EFI_D_WARN, "%a: No 'xen,xen' compatible DT node found\n",
|
DEBUG ((EFI_D_WARN, "%a: No 'xen,xen' compatible DT node found\n",
|
||||||
__FUNCTION__));
|
__FUNCTION__));
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (RegSize == 16);
|
ASSERT (AddressCells == 2);
|
||||||
|
ASSERT (SizeCells == 2);
|
||||||
|
ASSERT (RegSize == 2 * sizeof (UINT64));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve the reg base from this node and wire it up to the
|
// Retrieve the reg base from this node and wire it up to the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user