/* Read the "reg" property of Node in DeviceTree as a UINT64 base address. */
STATIC RETURN_STATUS GetBaseAddress(IN CONST VOID *DeviceTree, IN INT32 Node, OUT UINT64 *BaseAddress)
/* Read the "reg" property of Node in DeviceTree as a UINT64 base address. */
STATIC RETURN_STATUS GetBaseAddress(IN CONST VOID *DeviceTree, IN INT32 Node, OUT UINT64 *BaseAddress)
{
  CONST CHAR8  *NodeStatus;
  CONST VOID   *RegProp;
  INT32        PropSize;
  NodeStatus = fdt_getprop (DeviceTree, Node, "status", NULL);
  if ((NodeStatus != NULL) && (AsciiStrCmp (NodeStatus, "okay") != 0)) {
    return RETURN_DEVICE_ERROR;
  }
  RegProp = fdt_getprop (DeviceTree, Node, "reg", &PropSize);
  if (RegProp == NULL) {
    return RETURN_NOT_FOUND;
  }
  if (PropSize != 16) {
    return RETURN_BAD_BUFFER_SIZE;
  }
  *BaseAddress = fdt64_to_cpu (ReadUnaligned64 (RegProp));
  return RETURN_SUCCESS;
}