1 | /** @file
|
---|
2 | BlockFront functions and types declarations.
|
---|
3 |
|
---|
4 | Copyright (C) 2014, Citrix Ltd.
|
---|
5 |
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 | #include "XenPvBlkDxe.h"
|
---|
10 |
|
---|
11 | #include <IndustryStandard/Xen/event_channel.h>
|
---|
12 | #include <IndustryStandard/Xen/io/blkif.h>
|
---|
13 |
|
---|
14 | typedef struct _XEN_BLOCK_FRONT_DEVICE XEN_BLOCK_FRONT_DEVICE;
|
---|
15 | typedef struct _XEN_BLOCK_FRONT_IO XEN_BLOCK_FRONT_IO;
|
---|
16 |
|
---|
17 | struct _XEN_BLOCK_FRONT_IO
|
---|
18 | {
|
---|
19 | XEN_BLOCK_FRONT_DEVICE *Dev;
|
---|
20 | UINT8 *Buffer;
|
---|
21 | UINTN Size;
|
---|
22 | UINTN Sector; ///< 512 bytes sector.
|
---|
23 |
|
---|
24 | grant_ref_t GrantRef[BLKIF_MAX_SEGMENTS_PER_REQUEST];
|
---|
25 | INT32 NumRef;
|
---|
26 |
|
---|
27 | EFI_STATUS Status;
|
---|
28 | };
|
---|
29 |
|
---|
30 | typedef struct
|
---|
31 | {
|
---|
32 | UINT64 Sectors;
|
---|
33 | UINT32 SectorSize;
|
---|
34 | UINT32 VDiskInfo;
|
---|
35 | BOOLEAN ReadWrite;
|
---|
36 | BOOLEAN CdRom;
|
---|
37 | BOOLEAN FeatureBarrier;
|
---|
38 | BOOLEAN FeatureFlushCache;
|
---|
39 | } XEN_BLOCK_FRONT_MEDIA_INFO;
|
---|
40 |
|
---|
41 | #define XEN_BLOCK_FRONT_SIGNATURE SIGNATURE_32 ('X', 'p', 'v', 'B')
|
---|
42 | struct _XEN_BLOCK_FRONT_DEVICE {
|
---|
43 | UINT32 Signature;
|
---|
44 | EFI_BLOCK_IO_PROTOCOL BlockIo;
|
---|
45 | domid_t DomainId;
|
---|
46 |
|
---|
47 | blkif_front_ring_t Ring;
|
---|
48 | grant_ref_t RingRef;
|
---|
49 | evtchn_port_t EventChannel;
|
---|
50 | blkif_vdev_t DeviceId;
|
---|
51 |
|
---|
52 | CONST CHAR8 *NodeName;
|
---|
53 | XEN_BLOCK_FRONT_MEDIA_INFO MediaInfo;
|
---|
54 |
|
---|
55 | VOID *StateWatchToken;
|
---|
56 |
|
---|
57 | XENBUS_PROTOCOL *XenBusIo;
|
---|
58 | };
|
---|
59 |
|
---|
60 | #define XEN_BLOCK_FRONT_FROM_BLOCK_IO(b) \
|
---|
61 | CR (b, XEN_BLOCK_FRONT_DEVICE, BlockIo, XEN_BLOCK_FRONT_SIGNATURE)
|
---|
62 |
|
---|
63 | EFI_STATUS
|
---|
64 | XenPvBlockFrontInitialization (
|
---|
65 | IN XENBUS_PROTOCOL *XenBusIo,
|
---|
66 | IN CONST CHAR8 *NodeName,
|
---|
67 | OUT XEN_BLOCK_FRONT_DEVICE **DevPtr
|
---|
68 | );
|
---|
69 |
|
---|
70 | VOID
|
---|
71 | XenPvBlockFrontShutdown (
|
---|
72 | IN XEN_BLOCK_FRONT_DEVICE *Dev
|
---|
73 | );
|
---|
74 |
|
---|
75 | VOID
|
---|
76 | XenPvBlockAsyncIo (
|
---|
77 | IN OUT XEN_BLOCK_FRONT_IO *IoData,
|
---|
78 | IN BOOLEAN IsWrite
|
---|
79 | );
|
---|
80 |
|
---|
81 | EFI_STATUS
|
---|
82 | XenPvBlockIo (
|
---|
83 | IN OUT XEN_BLOCK_FRONT_IO *IoData,
|
---|
84 | IN BOOLEAN IsWrite
|
---|
85 | );
|
---|
86 |
|
---|
87 | VOID
|
---|
88 | XenPvBlockAsyncIoPoll (
|
---|
89 | IN XEN_BLOCK_FRONT_DEVICE *Dev
|
---|
90 | );
|
---|
91 |
|
---|
92 | VOID
|
---|
93 | XenPvBlockSync (
|
---|
94 | IN XEN_BLOCK_FRONT_DEVICE *Dev
|
---|
95 | );
|
---|