iPXE
blockdev.h
Go to the documentation of this file.
1 #ifndef _IPXE_BLOCKDEV_H
2 #define _IPXE_BLOCKDEV_H
3 
4 /**
5  * @file
6  *
7  * Block devices
8  *
9  */
10 
11 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
12 
13 #include <stdint.h>
14 #include <ipxe/uaccess.h>
15 #include <ipxe/interface.h>
16 
17 /** Block device capacity */
19  /** Total number of blocks */
21  /** Block size */
22  size_t blksize;
23  /** Maximum number of blocks per single transfer */
24  unsigned int max_count;
25 };
26 
27 extern int block_read ( struct interface *control, struct interface *data,
28  uint64_t lba, unsigned int count,
29  userptr_t buffer, size_t len );
30 #define block_read_TYPE( object_type ) \
31  typeof ( int ( object_type, struct interface *data, \
32  uint64_t lba, unsigned int count, \
33  userptr_t buffer, size_t len ) )
34 
35 extern int block_write ( struct interface *control, struct interface *data,
36  uint64_t lba, unsigned int count,
37  userptr_t buffer, size_t len );
38 #define block_write_TYPE( object_type ) \
39  typeof ( int ( object_type, struct interface *data, \
40  uint64_t lba, unsigned int count, \
41  userptr_t buffer, size_t len ) )
42 
43 extern int block_read_capacity ( struct interface *control,
44  struct interface *data );
45 #define block_read_capacity_TYPE( object_type ) \
46  typeof ( int ( object_type, struct interface *data ) )
47 
48 extern void block_capacity ( struct interface *intf,
49  struct block_device_capacity *capacity );
50 #define block_capacity_TYPE( object_type ) \
51  typeof ( void ( object_type, \
52  struct block_device_capacity *capacity ) )
53 
54 
55 #endif /* _IPXE_BLOCKDEV_H */
unsigned int max_count
Maximum number of blocks per single transfer.
Definition: blockdev.h:24
uint32_t lba
Start address.
Definition: scsi.h:23
void block_capacity(struct interface *intf, struct block_device_capacity *capacity)
Report block device capacity.
Definition: blockdev.c:129
unsigned long long uint64_t
Definition: stdint.h:13
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
int block_write(struct interface *control, struct interface *data, uint64_t lba, unsigned int count, userptr_t buffer, size_t len)
Write to block device.
Definition: blockdev.c:78
Access to external ("user") memory.
int block_read(struct interface *control, struct interface *data, uint64_t lba, unsigned int count, userptr_t buffer, size_t len)
Read from block device.
Definition: blockdev.c:47
An object interface.
Definition: interface.h:124
Object interfaces.
uint64_t blocks
Total number of blocks.
Definition: blockdev.h:20
uint32_t control
Control.
Definition: myson.h:14
int block_read_capacity(struct interface *control, struct interface *data)
Read block device capacity.
Definition: blockdev.c:105
uint32_t len
Length.
Definition: ena.h:14
Block device capacity.
Definition: blockdev.h:18
uint16_t count
Number of entries.
Definition: ena.h:22
uint8_t data[48]
Additional event data.
Definition: ena.h:22
size_t blksize
Block size.
Definition: blockdev.h:22
unsigned long userptr_t
A pointer to a user buffer.
Definition: uaccess.h:33