]> git.proxmox.com Git - mirror_edk2.git/blame - ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.c
NetworkPkg: HttpDxe response/cancel issue fix
[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
34 UINT32 RegElemSize, RegSize;\r
35 EFI_HANDLE Handle;\r
36 UINT64 RegBase;\r
37\r
38 Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
39 (VOID **)&FdtClient);\r
40 ASSERT_EFI_ERROR (Status);\r
41\r
42 Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,xen",\r
43 (CONST VOID **)&Reg, &RegElemSize, &RegSize);\r
44 if (EFI_ERROR (Status)) {\r
45 DEBUG ((EFI_D_WARN, "%a: No 'xen,xen' compatible DT node found\n",\r
46 __FUNCTION__));\r
47 return EFI_UNSUPPORTED;\r
48 }\r
49\r
50 ASSERT (RegSize == 16);\r
51\r
52 //\r
53 // Retrieve the reg base from this node and wire it up to the\r
54 // MMIO flavor of the XenBus root device I/O protocol\r
55 //\r
56 RegBase = SwapBytes64 (Reg[0]);\r
57 Handle = NULL;\r
58 Status = XenIoMmioInstall (&Handle, RegBase);\r
59 if (EFI_ERROR (Status)) {\r
60 DEBUG ((EFI_D_ERROR, "%a: XenIoMmioInstall () failed on a new handle "\r
61 "(Status == %r)\n", __FUNCTION__, Status));\r
62 return Status;\r
63 }\r
64\r
65 DEBUG ((EFI_D_INFO, "Found Xen node with Grant table @ 0x%Lx\n", RegBase));\r
66\r
67 return EFI_SUCCESS;\r
68}\r