iPXE
edd.h
Go to the documentation of this file.
00001 #ifndef _IPXE_EDD_H
00002 #define _IPXE_EDD_H
00003 
00004 /** @file
00005  *
00006  * Enhanced Disk Drive specification
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <stdint.h>
00013 #include <ipxe/interface.h>
00014 
00015 /** An EDD host bus type */
00016 struct edd_host_bus_type {
00017         /** Type */
00018         uint32_t type;
00019 } __attribute__ (( packed ));
00020 
00021 /** EDD bus type */
00022 #define EDD_BUS_TYPE_FIXED( a, b, c, d, ... )                               \
00023         ( ( (a) << 0 ) | ( (b) << 8 ) | ( (c) << 16 ) | ( (d) << 24 ) )
00024 #define EDD_BUS_TYPE( ... )                                                 \
00025         EDD_BUS_TYPE_FIXED ( __VA_ARGS__, ' ', ' ', ' ', ' ' )
00026 /** EDD PCI bus type */
00027 #define EDD_BUS_TYPE_PCI EDD_BUS_TYPE ( 'P', 'C', 'I' )
00028 /** EDD ISA bus type */
00029 #define EDD_BUS_TYPE_ISA EDD_BUS_TYPE ( 'I', 'S', 'A' )
00030 /** EDD PCI-X bus type */
00031 #define EDD_BUS_TYPE_PCIX EDD_BUS_TYPE ( 'P', 'C', 'I', 'X' )
00032 /** EDD Infiniband bus type */
00033 #define EDD_BUS_TYPE_IBND EDD_BUS_TYPE ( 'I', 'B', 'N', 'D' )
00034 /** EDD PCI Express bus type */
00035 #define EDD_BUS_TYPE_XPRS EDD_BUS_TYPE ( 'X', 'P', 'R', 'S' )
00036 /** EDD HyperTransport bus type */
00037 #define EDD_BUS_TYPE_HTPT EDD_BUS_TYPE ( 'H', 'T', 'P', 'T' )
00038 
00039 /** An EDD interface type */
00040 struct edd_interface_type {
00041         /** Type */
00042         uint64_t type;
00043 } __attribute__ (( packed ));
00044 
00045 /** EDD interface type */
00046 #define EDD_INTF_TYPE_FIXED( a, b, c, d, e, f, g, h, ... )                  \
00047         ( ( ( ( uint64_t ) (a) ) <<  0 ) | ( ( ( uint64_t ) (b) ) <<  8 ) | \
00048           ( ( ( uint64_t ) (c) ) << 16 ) | ( ( ( uint64_t ) (d) ) << 24 ) | \
00049           ( ( ( uint64_t ) (e) ) << 32 ) | ( ( ( uint64_t ) (f) ) << 40 ) | \
00050           ( ( ( uint64_t ) (g) ) << 48 ) | ( ( ( uint64_t ) (h) ) << 56 ) )
00051 #define EDD_INTF_TYPE( ... )                                                \
00052         EDD_INTF_TYPE_FIXED ( __VA_ARGS__,                                  \
00053                               ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' )
00054 /** EDD ATA interface type */
00055 #define EDD_INTF_TYPE_ATA EDD_INTF_TYPE ( 'A', 'T', 'A' )
00056 /** EDD ATAPI interface type */
00057 #define EDD_INTF_TYPE_ATAPI EDD_INTF_TYPE ( 'A', 'T', 'A', 'P', 'I' )
00058 /** EDD SCSI interface type */
00059 #define EDD_INTF_TYPE_SCSI EDD_INTF_TYPE ( 'S', 'C', 'S', 'I' )
00060 /** EDD USB interface type */
00061 #define EDD_INTF_TYPE_USB EDD_INTF_TYPE ( 'U', 'S', 'B' )
00062 /** EDD 1394 interface type */
00063 #define EDD_INTF_TYPE_1394 EDD_INTF_TYPE ( '1', '3', '9', '4' )
00064 /** EDD Fibre Channel interface type */
00065 #define EDD_INTF_TYPE_FIBRE EDD_INTF_TYPE ( 'F', 'I', 'B', 'R', 'E' )
00066 /** EDD I2O interface type */
00067 #define EDD_INTF_TYPE_I2O EDD_INTF_TYPE ( 'I', '2', 'O' )
00068 /** EDD RAID interface type */
00069 #define EDD_INTF_TYPE_RAID EDD_INTF_TYPE ( 'R', 'A', 'I', 'D' )
00070 /** EDD SATA interface type */
00071 #define EDD_INTF_TYPE_SATA EDD_INTF_TYPE ( 'S', 'A', 'T', 'A' )
00072 /** EDD SAS interface type */
00073 #define EDD_INTF_TYPE_SAS EDD_INTF_TYPE ( 'S', 'A', 'S' )
00074 
00075 /** An EDD interface path */
00076 union edd_interface_path {
00077         /** Legacy bus type */
00078         struct {
00079                 /** Base address */
00080                 uint16_t base;
00081         } __attribute__ (( packed )) legacy;
00082         /** PCI, PCI-X, PCI Express, or HyperTransport bus type */
00083         struct {
00084                 /** Bus */
00085                 uint8_t bus;
00086                 /** Slot */
00087                 uint8_t slot;
00088                 /** Function */
00089                 uint8_t function;
00090                 /** Channel number */
00091                 uint8_t channel;
00092         } __attribute__ (( packed )) pci;
00093         /** Padding */
00094         uint8_t pad[8];
00095 } __attribute__ (( packed ));
00096 
00097 /** An EDD device path */
00098 union edd_device_path {
00099         /** ATA interface type */
00100         struct {
00101                 /** Slave */
00102                 uint8_t slave;
00103         } __attribute__ (( packed )) ata;
00104         /** ATAPI interface type */
00105         struct {
00106                 /** Slave */
00107                 uint8_t slave;
00108                 /** Logical Unit Number */
00109                 uint8_t lun;
00110         } __attribute__ (( packed )) atapi;
00111         /** SCSI interface type */
00112         struct {
00113                 /** SCSI ID */
00114                 uint16_t id;
00115                 /** Logical Unit Number */
00116                 uint64_t lun;
00117         } __attribute__ (( packed )) scsi;
00118         /** USB interface type */
00119         struct {
00120                 /** Serial number */
00121                 uint64_t serial;
00122         } __attribute__ (( packed )) usb;
00123         /** IEEE1394 interface type */
00124         struct {
00125                 /** GUID */
00126                 uint64_t guid;
00127         } __attribute__ (( packed )) ieee1394;
00128         /** Fibre Channel interface type */
00129         struct {
00130                 /** WWN */
00131                 uint64_t wwn;
00132                 /** Logical Unit Number */
00133                 uint64_t lun;
00134         } __attribute__ (( packed )) fibre;
00135         /** I2O interface type */
00136         struct {
00137                 /** Identity tag */
00138                 uint64_t tag;
00139         } __attribute__ (( packed )) i2o;
00140         /** RAID interface type */
00141         struct {
00142                 /** Array number */
00143                 uint32_t array;
00144         } __attribute__ (( packed )) raid;
00145         /** SATA interface type */
00146         struct {
00147                 /** Port number */
00148                 uint8_t port;
00149                 /** Port multiplier number */
00150                 uint8_t multiplier;
00151         } __attribute__ (( packed )) sata;
00152         /** SAS interface type */
00153         struct {
00154                 /** Address */
00155                 uint64_t address;
00156         } __attribute__ (( packed )) sas;
00157         /** Padding */
00158         uint8_t pad[16];
00159 } __attribute__ (( packed ));
00160 
00161 /** EDD device path information */
00162 struct edd_device_path_information {
00163         /** Key */
00164         uint16_t key;
00165         /** Length of this structure */
00166         uint8_t len;
00167         /** Reserved */
00168         uint8_t reserved_a[3];
00169         /** Host bus type */
00170         struct edd_host_bus_type host_bus_type;
00171         /** Interface type */
00172         struct edd_interface_type interface_type;
00173         /** Interface path */
00174         union edd_interface_path interface_path;
00175         /** Device path */
00176         union edd_device_path device_path;
00177         /** Reserved */
00178         uint8_t reserved_b;
00179         /** Checksum */
00180         uint8_t checksum;
00181 } __attribute__ (( packed ));
00182 
00183 /** EDD device path information key */
00184 #define EDD_DEVICE_PATH_INFO_KEY 0xbedd
00185 
00186 extern int edd_describe ( struct interface *intf,
00187                           struct edd_interface_type *type,
00188                           union edd_device_path *path );
00189 #define edd_describe_TYPE( object_type )                                \
00190         typeof ( int ( object_type, struct edd_interface_type *type,    \
00191                        union edd_device_path *path ) )
00192 
00193 #endif /* _IPXE_EDD_H */