summaryrefslogtreecommitdiffstats
path: root/qemu/roms/ipxe/src/include/ipxe/blockdev.h
blob: 9f0a9f7878faab6e71dbae7f8a072d2f1eb32862 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef _IPXE_BLOCKDEV_H
#define _IPXE_BLOCKDEV_H

/**
 * @file
 *
 * Block devices
 *
 */

FILE_LICENCE ( GPL2_OR_LATER );

#include <stdint.h>
#include <ipxe/uaccess.h>
#include <ipxe/interface.h>

/** Block device capacity */
struct block_device_capacity {
	/** Total number of blocks */
	uint64_t blocks;
	/** Block size */
	size_t blksize;
	/** Maximum number of blocks per single transfer */
	unsigned int max_count;
};

extern int block_read ( struct interface *control, struct interface *data,
			uint64_t lba, unsigned int count,
			userptr_t buffer, size_t len );
#define block_read_TYPE( object_type )					\
	typeof ( int ( object_type, struct interface *data,		\
		       uint64_t lba, unsigned int count,		\
		       userptr_t buffer, size_t len ) )

extern int block_write ( struct interface *control, struct interface *data,
			 uint64_t lba, unsigned int count,
			 userptr_t buffer, size_t len );
#define block_write_TYPE( object_type )					\
	typeof ( int ( object_type, struct interface *data,		\
		       uint64_t lba, unsigned int count,		\
		       userptr_t buffer, size_t len ) )

extern int block_read_capacity ( struct interface *control,
				 struct interface *data );
#define block_read_capacity_TYPE( object_type )				\
	typeof ( int ( object_type, struct interface *data ) )

extern void block_capacity ( struct interface *intf,
			     struct block_device_capacity *capacity );
#define block_capacity_TYPE( object_type )				\
	typeof ( void ( object_type,					\
			struct block_device_capacity *capacity ) )


#endif /* _IPXE_BLOCKDEV_H */