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:
Ard Biesheuvel
2016-09-15 14:15:14 +01:00
parent 38ed4a9e3a
commit cfc8d51c0c
6 changed files with 31 additions and 14 deletions

View File

@@ -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;