]> git.proxmox.com Git - mirror_edk2.git/blame - ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.c
BaseTools/Capsule: Do not support -o with --dump-info
[mirror_edk2.git] / ArmVirtPkg / XenioFdtDxe / XenioFdtDxe.c
CommitLineData
81996ba8
AB
1/** @file\r
2* Xenio FDT client protocol driver for xen,xen DT node\r
3*\r
4* Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
5*\r
6* This program and the accompanying materials are\r
7* licensed and made available under the terms and conditions of the BSD License\r
8* which accompanies this distribution. The full text of the license may be found at\r
9* http://opensource.org/licenses/bsd-license.php\r
10*\r
11* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13*\r
14**/\r
15\r
16#include <Library/BaseLib.h>\r
17#include <Library/DebugLib.h>\r
18#include <Library/UefiDriverEntryPoint.h>\r
19#include <Library/UefiBootServicesTableLib.h>\r
20#include <Library/XenIoMmioLib.h>\r
21\r
22#include <Protocol/FdtClient.h>\r
23\r
24EFI_STATUS\r
25EFIAPI\r
26InitializeXenioFdtDxe (\r
27 IN EFI_HANDLE ImageHandle,\r
28 IN EFI_SYSTEM_TABLE *SystemTable\r
29 )\r
30{\r
31 EFI_STATUS Status;\r
32 FDT_CLIENT_PROTOCOL *FdtClient;\r
33 CONST UINT64 *Reg;\r
cfc8d51c
AB
34 UINT32 RegSize;\r
35 UINTN AddressCells, SizeCells;\r
81996ba8
AB
36 EFI_HANDLE Handle;\r
37 UINT64 RegBase;\r
38\r
39 Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
40 (VOID **)&FdtClient);\r
41 ASSERT_EFI_ERROR (Status);\r
42\r
43 Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,xen",\r
cfc8d51c
AB
44 (CONST VOID **)&Reg, &AddressCells, &SizeCells,\r
45 &RegSize);\r
81996ba8
AB
46 if (EFI_ERROR (Status)) {\r
47 DEBUG ((EFI_D_WARN, "%a: No 'xen,xen' compatible DT node found\n",\r
48 __FUNCTION__));\r
49 return EFI_UNSUPPORTED;\r
50 }\r
51\r
cfc8d51c
AB
52 ASSERT (AddressCells == 2);\r
53 ASSERT (SizeCells == 2);\r
54 ASSERT (RegSize == 2 * sizeof (UINT64));\r
81996ba8
AB
55\r
56 //\r
57 // Retrieve the reg base from this node and wire it up to the\r
58 // MMIO flavor of the XenBus root device I/O protocol\r
59 //\r
60 RegBase = SwapBytes64 (Reg[0]);\r
61 Handle = NULL;\r
62 Status = XenIoMmioInstall (&Handle, RegBase);\r
63 if (EFI_ERROR (Status)) {\r
64 DEBUG ((EFI_D_ERROR, "%a: XenIoMmioInstall () failed on a new handle "\r
65 "(Status == %r)\n", __FUNCTION__, Status));\r
66 return Status;\r
67 }\r
68\r
69 DEBUG ((EFI_D_INFO, "Found Xen node with Grant table @ 0x%Lx\n", RegBase));\r
70\r
71 return EFI_SUCCESS;\r
72}\r