Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / sanboot.h
1 #ifndef _IPXE_SANBOOT_H
2 #define _IPXE_SANBOOT_H
3
4 /** @file
5  *
6  * iPXE sanboot API
7  *
8  * The sanboot API provides methods for hooking, unhooking,
9  * describing, and booting from SAN devices.
10  *
11  * The standard methods (readl()/writel() etc.) do not strictly check
12  * the type of the address parameter; this is because traditional
13  * usage does not necessarily provide the correct pointer type.  For
14  * example, code written for ISA devices at fixed I/O addresses (such
15  * as the keyboard controller) tend to use plain integer constants for
16  * the address parameter.
17  */
18
19 FILE_LICENCE ( GPL2_OR_LATER );
20
21 #include <ipxe/api.h>
22 #include <config/sanboot.h>
23
24 struct uri;
25
26 /**
27  * Calculate static inline sanboot API function name
28  *
29  * @v _prefix           Subsystem prefix
30  * @v _api_func         API function
31  * @ret _subsys_func    Subsystem API function
32  */
33 #define SANBOOT_INLINE( _subsys, _api_func ) \
34         SINGLE_API_INLINE ( SANBOOT_PREFIX_ ## _subsys, _api_func )
35
36 /**
37  * Provide a sanboot API implementation
38  *
39  * @v _prefix           Subsystem prefix
40  * @v _api_func         API function
41  * @v _func             Implementing function
42  */
43 #define PROVIDE_SANBOOT( _subsys, _api_func, _func ) \
44         PROVIDE_SINGLE_API ( SANBOOT_PREFIX_ ## _subsys, _api_func, _func )
45
46 /**
47  * Provide a static inline sanboot API implementation
48  *
49  * @v _prefix           Subsystem prefix
50  * @v _api_func         API function
51  */
52 #define PROVIDE_SANBOOT_INLINE( _subsys, _api_func ) \
53         PROVIDE_SINGLE_API_INLINE ( SANBOOT_PREFIX_ ## _subsys, _api_func )
54
55 /* Include all architecture-independent sanboot API headers */
56 #include <ipxe/null_sanboot.h>
57
58 /* Include all architecture-dependent sanboot API headers */
59 #include <bits/sanboot.h>
60
61 /**
62  * Get default SAN drive number
63  *
64  * @ret drive           Default drive number
65  */
66 unsigned int san_default_drive ( void );
67
68 /**
69  * Hook SAN device
70  *
71  * @v uri               URI
72  * @v drive             Drive number
73  * @ret rc              Return status code
74  */
75 int san_hook ( struct uri *uri, unsigned int drive );
76
77 /**
78  * Unhook SAN device
79  *
80  * @v drive             Drive number
81  */
82 void san_unhook ( unsigned int drive );
83
84 /**
85  * Attempt to boot from a SAN device
86  *
87  * @v drive             Drive number
88  * @ret rc              Return status code
89  */
90 int san_boot ( unsigned int drive );
91
92 /**
93  * Describe SAN device for SAN-booted operating system
94  *
95  * @v drive             Drive number
96  * @ret rc              Return status code
97  */
98 int san_describe ( unsigned int drive );
99
100 #endif /* _IPXE_SANBOOT_H */