diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-09-15 14:15:14 +0100 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-09-15 15:31:24 +0100 |
commit | cfc8d51c0cbf97b5e71cfd92dcc6c5760940214f (patch) | |
tree | 8330973059c6b0d3de0daf3d7da1a962ff40f0f6 /ArmVirtPkg/Library | |
parent | 38ed4a9e3a65185e7e7b3c891feab1ddc865fdb5 (diff) | |
download | edk2-platforms-cfc8d51c0cbf97b5e71cfd92dcc6c5760940214f.tar.xz |
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>
Diffstat (limited to 'ArmVirtPkg/Library')
-rw-r--r-- | ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c | 9 | ||||
-rw-r--r-- | ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c b/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c index a1cd2da2d4..64afc4de6b 100644 --- a/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c +++ b/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.c @@ -36,7 +36,8 @@ ArmVirtGicArchLibConstructor ( UINT32 IccSre;
FDT_CLIENT_PROTOCOL *FdtClient;
CONST UINT64 *Reg;
- UINT32 RegElemSize, RegSize;
+ UINT32 RegSize;
+ UINTN AddressCells, SizeCells;
UINTN GicRevision;
EFI_STATUS Status;
UINT64 DistBase, CpuBase, RedistBase;
@@ -47,11 +48,13 @@ ArmVirtGicArchLibConstructor ( GicRevision = 2;
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "arm,cortex-a15-gic",
- (CONST VOID **)&Reg, &RegElemSize, &RegSize);
+ (CONST VOID **)&Reg, &AddressCells, &SizeCells,
+ &RegSize);
if (Status == EFI_NOT_FOUND) {
GicRevision = 3;
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "arm,gic-v3",
- (CONST VOID **)&Reg, &RegElemSize, &RegSize);
+ (CONST VOID **)&Reg, &AddressCells, &SizeCells,
+ &RegSize);
}
if (EFI_ERROR (Status)) {
return Status;
diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c index 377262563e..8ecbe3fb5f 100644 --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c +++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c @@ -122,7 +122,8 @@ QemuFwCfgInitialize ( EFI_STATUS Status;
FDT_CLIENT_PROTOCOL *FdtClient;
CONST UINT64 *Reg;
- UINT32 RegElemSize, RegSize;
+ UINT32 RegSize;
+ UINTN AddressCells, SizeCells;
UINT64 FwCfgSelectorAddress;
UINT64 FwCfgSelectorSize;
UINT64 FwCfgDataAddress;
@@ -135,7 +136,8 @@ QemuFwCfgInitialize ( ASSERT_EFI_ERROR (Status);
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "qemu,fw-cfg-mmio",
- (CONST VOID **)&Reg, &RegElemSize, &RegSize);
+ (CONST VOID **)&Reg, &AddressCells, &SizeCells,
+ &RegSize);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_WARN,
"%a: No 'qemu,fw-cfg-mmio' compatible DT node found (Status == %r)\n",
@@ -143,7 +145,8 @@ QemuFwCfgInitialize ( return EFI_SUCCESS;
}
- ASSERT (RegElemSize == sizeof (UINT64));
+ ASSERT (AddressCells == 2);
+ ASSERT (SizeCells == 2);
ASSERT (RegSize == 2 * sizeof (UINT64));
FwCfgDataAddress = SwapBytes64 (Reg[0]);
|