2 * Xenio FDT client protocol driver for xen,xen DT node
4 * Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
6 * SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/BaseLib.h>
11 #include <Library/DebugLib.h>
12 #include <Library/UefiDriverEntryPoint.h>
13 #include <Library/UefiBootServicesTableLib.h>
14 #include <Library/XenIoMmioLib.h>
16 #include <Protocol/FdtClient.h>
20 InitializeXenioFdtDxe (
21 IN EFI_HANDLE ImageHandle
,
22 IN EFI_SYSTEM_TABLE
*SystemTable
26 FDT_CLIENT_PROTOCOL
*FdtClient
;
29 UINTN AddressCells
, SizeCells
;
33 Status
= gBS
->LocateProtocol (
34 &gFdtClientProtocolGuid
,
38 ASSERT_EFI_ERROR (Status
);
40 Status
= FdtClient
->FindCompatibleNodeReg (
48 if (EFI_ERROR (Status
)) {
51 "%a: No 'xen,xen' compatible DT node found\n",
54 return EFI_UNSUPPORTED
;
57 ASSERT (AddressCells
== 2);
58 ASSERT (SizeCells
== 2);
59 ASSERT (RegSize
== 2 * sizeof (UINT64
));
62 // Retrieve the reg base from this node and wire it up to the
63 // MMIO flavor of the XenBus root device I/O protocol
65 RegBase
= SwapBytes64 (Reg
[0]);
67 Status
= XenIoMmioInstall (&Handle
, RegBase
);
68 if (EFI_ERROR (Status
)) {
71 "%a: XenIoMmioInstall () failed on a new handle "
79 DEBUG ((DEBUG_INFO
, "Found Xen node with Grant table @ 0x%Lx\n", RegBase
));