1 | /** @file
|
---|
2 | Function declaration and internal data for XenBusDxe.
|
---|
3 |
|
---|
4 | Copyright (C) 2014, Citrix Ltd.
|
---|
5 |
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #ifndef __EFI_XENBUS_DXE_H__
|
---|
11 | #define __EFI_XENBUS_DXE_H__
|
---|
12 |
|
---|
13 | #include <Uefi.h>
|
---|
14 |
|
---|
15 | //
|
---|
16 | // Libraries
|
---|
17 | //
|
---|
18 | #include <Library/UefiBootServicesTableLib.h>
|
---|
19 | #include <Library/MemoryAllocationLib.h>
|
---|
20 | #include <Library/BaseMemoryLib.h>
|
---|
21 | #include <Library/BaseLib.h>
|
---|
22 | #include <Library/UefiLib.h>
|
---|
23 | #include <Library/DevicePathLib.h>
|
---|
24 | #include <Library/DebugLib.h>
|
---|
25 | #include <Library/PcdLib.h>
|
---|
26 |
|
---|
27 | //
|
---|
28 | // UEFI Driver Model Protocols
|
---|
29 | //
|
---|
30 | #include <Protocol/DriverBinding.h>
|
---|
31 |
|
---|
32 | //
|
---|
33 | // Consumed Protocols
|
---|
34 | //
|
---|
35 | #include <Protocol/XenIo.h>
|
---|
36 |
|
---|
37 | //
|
---|
38 | // Produced Protocols
|
---|
39 | //
|
---|
40 | #include <Protocol/XenBus.h>
|
---|
41 |
|
---|
42 | //
|
---|
43 | // Driver Version
|
---|
44 | //
|
---|
45 | #define XENBUS_DXE_VERSION 0x00000010
|
---|
46 |
|
---|
47 | //
|
---|
48 | // Protocol instances
|
---|
49 | //
|
---|
50 | extern EFI_DRIVER_BINDING_PROTOCOL gXenBusDxeDriverBinding;
|
---|
51 | extern EFI_COMPONENT_NAME2_PROTOCOL gXenBusDxeComponentName2;
|
---|
52 | extern EFI_COMPONENT_NAME_PROTOCOL gXenBusDxeComponentName;
|
---|
53 |
|
---|
54 | //
|
---|
55 | // Include files with function prototypes
|
---|
56 | //
|
---|
57 | #include "DriverBinding.h"
|
---|
58 | #include "ComponentName.h"
|
---|
59 |
|
---|
60 | //
|
---|
61 | // Other stuff
|
---|
62 | //
|
---|
63 | #include <IndustryStandard/Xen/xen.h>
|
---|
64 |
|
---|
65 | typedef struct _XENBUS_DEVICE_PATH XENBUS_DEVICE_PATH;
|
---|
66 | typedef struct _XENBUS_DEVICE XENBUS_DEVICE;
|
---|
67 |
|
---|
68 | // Have the state of the driver.
|
---|
69 | #define XENBUS_DEVICE_SIGNATURE SIGNATURE_32 ('X','B','s','t')
|
---|
70 | struct _XENBUS_DEVICE {
|
---|
71 | UINT32 Signature;
|
---|
72 | EFI_DRIVER_BINDING_PROTOCOL *This;
|
---|
73 | EFI_HANDLE ControllerHandle;
|
---|
74 | XENIO_PROTOCOL *XenIo;
|
---|
75 | EFI_EVENT ExitBootEvent;
|
---|
76 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
77 | LIST_ENTRY ChildList;
|
---|
78 |
|
---|
79 | shared_info_t *SharedInfo;
|
---|
80 | };
|
---|
81 |
|
---|
82 | // There is one of this struct allocated for every child.
|
---|
83 | #define XENBUS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('X', 'B', 'p', 'd')
|
---|
84 | typedef struct {
|
---|
85 | UINTN Signature;
|
---|
86 | LIST_ENTRY Link;
|
---|
87 | EFI_HANDLE Handle;
|
---|
88 | XENBUS_PROTOCOL XenBusIo;
|
---|
89 | XENBUS_DEVICE *Dev;
|
---|
90 | XENBUS_DEVICE_PATH *DevicePath;
|
---|
91 | } XENBUS_PRIVATE_DATA;
|
---|
92 |
|
---|
93 | #define XENBUS_PRIVATE_DATA_FROM_THIS(a) \
|
---|
94 | CR (a, XENBUS_PRIVATE_DATA, XenBusIo, XENBUS_PRIVATE_DATA_SIGNATURE)
|
---|
95 | #define XENBUS_PRIVATE_DATA_FROM_LINK(a) \
|
---|
96 | CR (a, XENBUS_PRIVATE_DATA, Link, XENBUS_PRIVATE_DATA_SIGNATURE)
|
---|
97 |
|
---|
98 | /*
|
---|
99 | * Helpers
|
---|
100 | */
|
---|
101 |
|
---|
102 | /**
|
---|
103 | Atomically test and clear a bit.
|
---|
104 |
|
---|
105 | @param Bit Bit index to test in *Address
|
---|
106 | @param Address The Address to the buffer that contain the bit to test.
|
---|
107 |
|
---|
108 | @return Value of the Bit before it was cleared.
|
---|
109 | **/
|
---|
110 | INT32
|
---|
111 | EFIAPI
|
---|
112 | TestAndClearBit (
|
---|
113 | IN INT32 Bit,
|
---|
114 | IN VOID *Address
|
---|
115 | );
|
---|
116 |
|
---|
117 | CHAR8 *
|
---|
118 | AsciiStrDup (
|
---|
119 | IN CONST CHAR8 *Str
|
---|
120 | );
|
---|
121 |
|
---|
122 | #endif
|
---|