probe_roms.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /*
  2. * This file is provided under a dual BSD/GPLv2 license. When using or
  3. * redistributing this file, you may do so under either license.
  4. *
  5. * GPL LICENSE SUMMARY
  6. *
  7. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of version 2 of the GNU General Public License as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called LICENSE.GPL.
  23. *
  24. * BSD LICENSE
  25. *
  26. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  27. * All rights reserved.
  28. *
  29. * Redistribution and use in source and binary forms, with or without
  30. * modification, are permitted provided that the following conditions
  31. * are met:
  32. *
  33. * * Redistributions of source code must retain the above copyright
  34. * notice, this list of conditions and the following disclaimer.
  35. * * Redistributions in binary form must reproduce the above copyright
  36. * notice, this list of conditions and the following disclaimer in
  37. * the documentation and/or other materials provided with the
  38. * distribution.
  39. * * Neither the name of Intel Corporation nor the names of its
  40. * contributors may be used to endorse or promote products derived
  41. * from this software without specific prior written permission.
  42. *
  43. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  44. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  45. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  46. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  47. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  48. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  49. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  50. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  51. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  52. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  53. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  54. */
  55. #ifndef _ISCI_PROBE_ROMS_H_
  56. #define _ISCI_PROBE_ROMS_H_
  57. #ifdef __KERNEL__
  58. #include <linux/firmware.h>
  59. #include <linux/pci.h>
  60. #include <linux/efi.h>
  61. #include "isci.h"
  62. #define SCIC_SDS_PARM_NO_SPEED 0
  63. /* generation 1 (i.e. 1.5 Gb/s) */
  64. #define SCIC_SDS_PARM_GEN1_SPEED 1
  65. /* generation 2 (i.e. 3.0 Gb/s) */
  66. #define SCIC_SDS_PARM_GEN2_SPEED 2
  67. /* generation 3 (i.e. 6.0 Gb/s) */
  68. #define SCIC_SDS_PARM_GEN3_SPEED 3
  69. #define SCIC_SDS_PARM_MAX_SPEED SCIC_SDS_PARM_GEN3_SPEED
  70. /* parameters that can be set by module parameters */
  71. struct sci_user_parameters {
  72. struct sci_phy_user_params {
  73. /**
  74. * This field specifies the NOTIFY (ENABLE SPIN UP) primitive
  75. * insertion frequency for this phy index.
  76. */
  77. u32 notify_enable_spin_up_insertion_frequency;
  78. /**
  79. * This method specifies the number of transmitted DWORDs within which
  80. * to transmit a single ALIGN primitive. This value applies regardless
  81. * of what type of device is attached or connection state. A value of
  82. * 0 indicates that no ALIGN primitives will be inserted.
  83. */
  84. u16 align_insertion_frequency;
  85. /**
  86. * This method specifies the number of transmitted DWORDs within which
  87. * to transmit 2 ALIGN primitives. This applies for SAS connections
  88. * only. A minimum value of 3 is required for this field.
  89. */
  90. u16 in_connection_align_insertion_frequency;
  91. /**
  92. * This field indicates the maximum speed generation to be utilized
  93. * by phys in the supplied port.
  94. * - A value of 1 indicates generation 1 (i.e. 1.5 Gb/s).
  95. * - A value of 2 indicates generation 2 (i.e. 3.0 Gb/s).
  96. * - A value of 3 indicates generation 3 (i.e. 6.0 Gb/s).
  97. */
  98. u8 max_speed_generation;
  99. } phys[SCI_MAX_PHYS];
  100. /**
  101. * This field specifies the maximum number of direct attached devices
  102. * that can have power supplied to them simultaneously.
  103. */
  104. u8 max_number_concurrent_device_spin_up;
  105. /**
  106. * This field specifies the number of seconds to allow a phy to consume
  107. * power before yielding to another phy.
  108. *
  109. */
  110. u8 phy_spin_up_delay_interval;
  111. /**
  112. * These timer values specifies how long a link will remain open with no
  113. * activity in increments of a microsecond, it can be in increments of
  114. * 100 microseconds if the upper most bit is set.
  115. *
  116. */
  117. u16 stp_inactivity_timeout;
  118. u16 ssp_inactivity_timeout;
  119. /**
  120. * These timer values specifies how long a link will remain open in increments
  121. * of 100 microseconds.
  122. *
  123. */
  124. u16 stp_max_occupancy_timeout;
  125. u16 ssp_max_occupancy_timeout;
  126. /**
  127. * This timer value specifies how long a link will remain open with no
  128. * outbound traffic in increments of a microsecond.
  129. *
  130. */
  131. u8 no_outbound_task_timeout;
  132. };
  133. #define SCIC_SDS_PARM_PHY_MASK_MIN 0x0
  134. #define SCIC_SDS_PARM_PHY_MASK_MAX 0xF
  135. #define MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT 4
  136. struct sci_oem_params;
  137. int sci_oem_parameters_validate(struct sci_oem_params *oem);
  138. struct isci_orom;
  139. struct isci_orom *isci_request_oprom(struct pci_dev *pdev);
  140. enum sci_status isci_parse_oem_parameters(struct sci_oem_params *oem,
  141. struct isci_orom *orom, int scu_index);
  142. struct isci_orom *isci_request_firmware(struct pci_dev *pdev, const struct firmware *fw);
  143. struct isci_orom *isci_get_efi_var(struct pci_dev *pdev);
  144. struct isci_oem_hdr {
  145. u8 sig[4];
  146. u8 rev_major;
  147. u8 rev_minor;
  148. u16 len;
  149. u8 checksum;
  150. u8 reserved1;
  151. u16 reserved2;
  152. } __attribute__ ((packed));
  153. #else
  154. #define SCI_MAX_PORTS 4
  155. #define SCI_MAX_PHYS 4
  156. #define SCI_MAX_CONTROLLERS 2
  157. #endif
  158. #define ISCI_FW_NAME "isci/isci_firmware.bin"
  159. #define ROMSIGNATURE 0xaa55
  160. #define ISCI_OEM_SIG "$OEM"
  161. #define ISCI_OEM_SIG_SIZE 4
  162. #define ISCI_ROM_SIG "ISCUOEMB"
  163. #define ISCI_ROM_SIG_SIZE 8
  164. #define ISCI_EFI_VENDOR_GUID \
  165. EFI_GUID(0x193dfefa, 0xa445, 0x4302, 0x99, 0xd8, 0xef, 0x3a, 0xad, \
  166. 0x1a, 0x04, 0xc6)
  167. #define ISCI_EFI_VAR_NAME "RstScuO"
  168. /* Allowed PORT configuration modes APC Automatic PORT configuration mode is
  169. * defined by the OEM configuration parameters providing no PHY_MASK parameters
  170. * for any PORT. i.e. There are no phys assigned to any of the ports at start.
  171. * MPC Manual PORT configuration mode is defined by the OEM configuration
  172. * parameters providing a PHY_MASK value for any PORT. It is assumed that any
  173. * PORT with no PHY_MASK is an invalid port and not all PHYs must be assigned.
  174. * A PORT_PHY mask that assigns just a single PHY to a port and no other PHYs
  175. * being assigned is sufficient to declare manual PORT configuration.
  176. */
  177. enum sci_port_configuration_mode {
  178. SCIC_PORT_MANUAL_CONFIGURATION_MODE = 0,
  179. SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE = 1
  180. };
  181. struct sci_bios_oem_param_block_hdr {
  182. uint8_t signature[ISCI_ROM_SIG_SIZE];
  183. uint16_t total_block_length;
  184. uint8_t hdr_length;
  185. uint8_t version;
  186. uint8_t preboot_source;
  187. uint8_t num_elements;
  188. uint16_t element_length;
  189. uint8_t reserved[8];
  190. } __attribute__ ((packed));
  191. struct sci_oem_params {
  192. struct {
  193. uint8_t mode_type;
  194. uint8_t max_concurrent_dev_spin_up;
  195. uint8_t do_enable_ssc;
  196. uint8_t reserved;
  197. } controller;
  198. struct {
  199. uint8_t phy_mask;
  200. } ports[SCI_MAX_PORTS];
  201. struct sci_phy_oem_params {
  202. struct {
  203. uint32_t high;
  204. uint32_t low;
  205. } sas_address;
  206. uint32_t afe_tx_amp_control0;
  207. uint32_t afe_tx_amp_control1;
  208. uint32_t afe_tx_amp_control2;
  209. uint32_t afe_tx_amp_control3;
  210. } phys[SCI_MAX_PHYS];
  211. } __attribute__ ((packed));
  212. struct isci_orom {
  213. struct sci_bios_oem_param_block_hdr hdr;
  214. struct sci_oem_params ctrl[SCI_MAX_CONTROLLERS];
  215. } __attribute__ ((packed));
  216. #endif