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 | XEN_BLOCK_FRONT_DEVICE *Dev;
|
---|
19 | UINT8 *Buffer;
|
---|
20 | UINTN Size;
|
---|
21 | UINTN Sector; ///< 512 bytes sector.
|
---|
22 |
|
---|
23 | grant_ref_t GrantRef[BLKIF_MAX_SEGMENTS_PER_REQUEST];
|
---|
24 | INT32 NumRef;
|
---|
25 |
|
---|
26 | EFI_STATUS Status;
|
---|
27 | };
|
---|
28 |
|
---|
29 | typedef struct {
|
---|
30 | UINT64 Sectors;
|
---|
31 | UINT32 SectorSize;
|
---|
32 | UINT32 VDiskInfo;
|
---|
33 | BOOLEAN ReadWrite;
|
---|
34 | BOOLEAN CdRom;
|
---|
35 | BOOLEAN FeatureBarrier;
|
---|
36 | BOOLEAN FeatureFlushCache;
|
---|
37 | } XEN_BLOCK_FRONT_MEDIA_INFO;
|
---|
38 |
|
---|
39 | #define XEN_BLOCK_FRONT_SIGNATURE SIGNATURE_32 ('X', 'p', 'v', 'B')
|
---|
40 | struct _XEN_BLOCK_FRONT_DEVICE {
|
---|
41 | UINT32 Signature;
|
---|
42 | EFI_BLOCK_IO_PROTOCOL BlockIo;
|
---|
43 | domid_t DomainId;
|
---|
44 |
|
---|
45 | blkif_front_ring_t Ring;
|
---|
46 | grant_ref_t RingRef;
|
---|
47 | evtchn_port_t EventChannel;
|
---|
48 | blkif_vdev_t DeviceId;
|
---|
49 |
|
---|
50 | CONST CHAR8 *NodeName;
|
---|
51 | XEN_BLOCK_FRONT_MEDIA_INFO MediaInfo;
|
---|
52 |
|
---|
53 | VOID *StateWatchToken;
|
---|
54 |
|
---|
55 | XENBUS_PROTOCOL *XenBusIo;
|
---|
56 | };
|
---|
57 |
|
---|
58 | #define XEN_BLOCK_FRONT_FROM_BLOCK_IO(b) \
|
---|
59 | CR (b, XEN_BLOCK_FRONT_DEVICE, BlockIo, XEN_BLOCK_FRONT_SIGNATURE)
|
---|
60 |
|
---|
61 | EFI_STATUS
|
---|
62 | XenPvBlockFrontInitialization (
|
---|
63 | IN XENBUS_PROTOCOL *XenBusIo,
|
---|
64 | IN CONST CHAR8 *NodeName,
|
---|
65 | OUT XEN_BLOCK_FRONT_DEVICE **DevPtr
|
---|
66 | );
|
---|
67 |
|
---|
68 | VOID
|
---|
69 | XenPvBlockFrontShutdown (
|
---|
70 | IN XEN_BLOCK_FRONT_DEVICE *Dev
|
---|
71 | );
|
---|
72 |
|
---|
73 | VOID
|
---|
74 | XenPvBlockAsyncIo (
|
---|
75 | IN OUT XEN_BLOCK_FRONT_IO *IoData,
|
---|
76 | IN BOOLEAN IsWrite
|
---|
77 | );
|
---|
78 |
|
---|
79 | EFI_STATUS
|
---|
80 | XenPvBlockIo (
|
---|
81 | IN OUT XEN_BLOCK_FRONT_IO *IoData,
|
---|
82 | IN BOOLEAN IsWrite
|
---|
83 | );
|
---|
84 |
|
---|
85 | VOID
|
---|
86 | XenPvBlockAsyncIoPoll (
|
---|
87 | IN XEN_BLOCK_FRONT_DEVICE *Dev
|
---|
88 | );
|
---|
89 |
|
---|
90 | VOID
|
---|
91 | XenPvBlockSync (
|
---|
92 | IN XEN_BLOCK_FRONT_DEVICE *Dev
|
---|
93 | );
|
---|