Home | History | Annotate | Download | only in gpxe
      1 #ifndef _GPXE_SBFT_H
      2 #define _GPXE_SBFT_H
      3 
      4 /*
      5  * Copyright (C) 2009 Fen Systems Ltd <mbrown (at) fensystems.co.uk>.
      6  * All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  *
     12  *   Redistributions of source code must retain the above copyright
     13  *   notice, this list of conditions and the following disclaimer.
     14  *
     15  *   Redistributions in binary form must reproduce the above copyright
     16  *   notice, this list of conditions and the following disclaimer in
     17  *   the documentation and/or other materials provided with the
     18  *   distribution.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
     24  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     25  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     27  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     29  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
     31  * OF THE POSSIBILITY OF SUCH DAMAGE.
     32  */
     33 
     34 FILE_LICENCE ( BSD2 );
     35 
     36 /** @file
     37  *
     38  * SRP boot firmware table
     39  *
     40  * The working draft specification for the SRP boot firmware table can
     41  * be found at
     42  *
     43  *   http://etherboot.org/wiki/srp/sbft
     44  *
     45  */
     46 
     47 #include <stdint.h>
     48 #include <gpxe/acpi.h>
     49 #include <gpxe/scsi.h>
     50 #include <gpxe/srp.h>
     51 #include <gpxe/ib_srp.h>
     52 
     53 /** SRP Boot Firmware Table signature */
     54 #define SBFT_SIG "sBFT"
     55 
     56 /** An offset from the start of the sBFT */
     57 typedef uint16_t sbft_off_t;
     58 
     59 /**
     60  * SRP Boot Firmware Table
     61  */
     62 struct sbft_table {
     63 	/** ACPI header */
     64 	struct acpi_description_header acpi;
     65 	/** Offset to SCSI subtable */
     66 	sbft_off_t scsi_offset;
     67 	/** Offset to SRP subtable */
     68 	sbft_off_t srp_offset;
     69 	/** Offset to IB subtable, if present */
     70 	sbft_off_t ib_offset;
     71 	/** Reserved */
     72 	uint8_t reserved[6];
     73 } __attribute__ (( packed ));
     74 
     75 /**
     76  * sBFT SCSI subtable
     77  */
     78 struct sbft_scsi_subtable {
     79 	/** LUN */
     80 	struct scsi_lun lun;
     81 } __attribute__ (( packed ));
     82 
     83 /**
     84  * sBFT SRP subtable
     85  */
     86 struct sbft_srp_subtable {
     87 	/** Initiator and target ports */
     88 	struct srp_port_ids port_ids;
     89 } __attribute__ (( packed ));
     90 
     91 /**
     92  * sBFT IB subtable
     93  */
     94 struct sbft_ib_subtable {
     95 	/** Source GID */
     96 	struct ib_gid sgid;
     97 	/** Destination GID */
     98 	struct ib_gid dgid;
     99 	/** Service ID */
    100 	struct ib_gid_half service_id;
    101 	/** Partition key */
    102 	uint16_t pkey;
    103 	/** Reserved */
    104 	uint8_t reserved[6];
    105 } __attribute__ (( packed ));
    106 
    107 /**
    108  * An sBFT created by gPXE
    109  */
    110 struct gpxe_sbft {
    111 	/** The table header */
    112 	struct sbft_table table;
    113 	/** The SCSI subtable */
    114 	struct sbft_scsi_subtable scsi;
    115 	/** The SRP subtable */
    116 	struct sbft_srp_subtable srp;
    117 	/** The IB subtable */
    118 	struct sbft_ib_subtable ib;
    119 } __attribute__ (( packed, aligned ( 16 ) ));
    120 
    121 struct srp_device;
    122 
    123 extern int sbft_fill_data ( struct srp_device *srp );
    124 
    125 #endif /* _GPXE_SBFT_H */
    126