hpsa.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. /*
  2. * Disk Array driver for HP Smart Array SAS controllers
  3. * Copyright 2000, 2014 Hewlett-Packard Development Company, L.P.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; version 2 of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  12. * NON INFRINGEMENT. See the GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. *
  18. * Questions/Comments/Bugfixes to iss_storagedev@hp.com
  19. *
  20. */
  21. #ifndef HPSA_H
  22. #define HPSA_H
  23. #include <scsi/scsicam.h>
  24. #define IO_OK 0
  25. #define IO_ERROR 1
  26. struct ctlr_info;
  27. struct access_method {
  28. void (*submit_command)(struct ctlr_info *h,
  29. struct CommandList *c);
  30. void (*set_intr_mask)(struct ctlr_info *h, unsigned long val);
  31. unsigned long (*fifo_full)(struct ctlr_info *h);
  32. bool (*intr_pending)(struct ctlr_info *h);
  33. unsigned long (*command_completed)(struct ctlr_info *h, u8 q);
  34. };
  35. struct hpsa_scsi_dev_t {
  36. int devtype;
  37. int bus, target, lun; /* as presented to the OS */
  38. unsigned char scsi3addr[8]; /* as presented to the HW */
  39. #define RAID_CTLR_LUNID "\0\0\0\0\0\0\0\0"
  40. unsigned char device_id[16]; /* from inquiry pg. 0x83 */
  41. unsigned char vendor[8]; /* bytes 8-15 of inquiry data */
  42. unsigned char model[16]; /* bytes 16-31 of inquiry data */
  43. unsigned char raid_level; /* from inquiry page 0xC1 */
  44. unsigned char volume_offline; /* discovered via TUR or VPD */
  45. u32 ioaccel_handle;
  46. int offload_config; /* I/O accel RAID offload configured */
  47. int offload_enabled; /* I/O accel RAID offload enabled */
  48. int offload_to_mirror; /* Send next I/O accelerator RAID
  49. * offload request to mirror drive
  50. */
  51. struct raid_map_data raid_map; /* I/O accelerator RAID map */
  52. };
  53. struct reply_queue_buffer {
  54. u64 *head;
  55. size_t size;
  56. u8 wraparound;
  57. u32 current_entry;
  58. dma_addr_t busaddr;
  59. };
  60. #pragma pack(1)
  61. struct bmic_controller_parameters {
  62. u8 led_flags;
  63. u8 enable_command_list_verification;
  64. u8 backed_out_write_drives;
  65. u16 stripes_for_parity;
  66. u8 parity_distribution_mode_flags;
  67. u16 max_driver_requests;
  68. u16 elevator_trend_count;
  69. u8 disable_elevator;
  70. u8 force_scan_complete;
  71. u8 scsi_transfer_mode;
  72. u8 force_narrow;
  73. u8 rebuild_priority;
  74. u8 expand_priority;
  75. u8 host_sdb_asic_fix;
  76. u8 pdpi_burst_from_host_disabled;
  77. char software_name[64];
  78. char hardware_name[32];
  79. u8 bridge_revision;
  80. u8 snapshot_priority;
  81. u32 os_specific;
  82. u8 post_prompt_timeout;
  83. u8 automatic_drive_slamming;
  84. u8 reserved1;
  85. u8 nvram_flags;
  86. #define HBA_MODE_ENABLED_FLAG (1 << 3)
  87. u8 cache_nvram_flags;
  88. u8 drive_config_flags;
  89. u16 reserved2;
  90. u8 temp_warning_level;
  91. u8 temp_shutdown_level;
  92. u8 temp_condition_reset;
  93. u8 max_coalesce_commands;
  94. u32 max_coalesce_delay;
  95. u8 orca_password[4];
  96. u8 access_id[16];
  97. u8 reserved[356];
  98. };
  99. #pragma pack()
  100. struct ctlr_info {
  101. int ctlr;
  102. char devname[8];
  103. char *product_name;
  104. struct pci_dev *pdev;
  105. u32 board_id;
  106. void __iomem *vaddr;
  107. unsigned long paddr;
  108. int nr_cmds; /* Number of commands allowed on this controller */
  109. struct CfgTable __iomem *cfgtable;
  110. int interrupts_enabled;
  111. int max_commands;
  112. int commands_outstanding;
  113. # define PERF_MODE_INT 0
  114. # define DOORBELL_INT 1
  115. # define SIMPLE_MODE_INT 2
  116. # define MEMQ_MODE_INT 3
  117. unsigned int intr[MAX_REPLY_QUEUES];
  118. unsigned int msix_vector;
  119. unsigned int msi_vector;
  120. int intr_mode; /* either PERF_MODE_INT or SIMPLE_MODE_INT */
  121. struct access_method access;
  122. char hba_mode_enabled;
  123. /* queue and queue Info */
  124. struct list_head reqQ;
  125. struct list_head cmpQ;
  126. unsigned int Qdepth;
  127. unsigned int maxSG;
  128. spinlock_t lock;
  129. int maxsgentries;
  130. u8 max_cmd_sg_entries;
  131. int chainsize;
  132. struct SGDescriptor **cmd_sg_list;
  133. /* pointers to command and error info pool */
  134. struct CommandList *cmd_pool;
  135. dma_addr_t cmd_pool_dhandle;
  136. struct io_accel1_cmd *ioaccel_cmd_pool;
  137. dma_addr_t ioaccel_cmd_pool_dhandle;
  138. struct io_accel2_cmd *ioaccel2_cmd_pool;
  139. dma_addr_t ioaccel2_cmd_pool_dhandle;
  140. struct ErrorInfo *errinfo_pool;
  141. dma_addr_t errinfo_pool_dhandle;
  142. unsigned long *cmd_pool_bits;
  143. int scan_finished;
  144. spinlock_t scan_lock;
  145. wait_queue_head_t scan_wait_queue;
  146. struct Scsi_Host *scsi_host;
  147. spinlock_t devlock; /* to protect hba[ctlr]->dev[]; */
  148. int ndevices; /* number of used elements in .dev[] array. */
  149. struct hpsa_scsi_dev_t *dev[HPSA_MAX_DEVICES];
  150. /*
  151. * Performant mode tables.
  152. */
  153. u32 trans_support;
  154. u32 trans_offset;
  155. struct TransTable_struct *transtable;
  156. unsigned long transMethod;
  157. /* cap concurrent passthrus at some reasonable maximum */
  158. #define HPSA_MAX_CONCURRENT_PASSTHRUS (20)
  159. spinlock_t passthru_count_lock; /* protects passthru_count */
  160. int passthru_count;
  161. /*
  162. * Performant mode completion buffers
  163. */
  164. size_t reply_queue_size;
  165. struct reply_queue_buffer reply_queue[MAX_REPLY_QUEUES];
  166. u8 nreply_queues;
  167. u32 *blockFetchTable;
  168. u32 *ioaccel1_blockFetchTable;
  169. u32 *ioaccel2_blockFetchTable;
  170. u32 *ioaccel2_bft2_regs;
  171. unsigned char *hba_inquiry_data;
  172. u32 driver_support;
  173. u32 fw_support;
  174. int ioaccel_support;
  175. int ioaccel_maxsg;
  176. u64 last_intr_timestamp;
  177. u32 last_heartbeat;
  178. u64 last_heartbeat_timestamp;
  179. u32 heartbeat_sample_interval;
  180. atomic_t firmware_flash_in_progress;
  181. u32 *lockup_detected;
  182. struct delayed_work monitor_ctlr_work;
  183. int remove_in_progress;
  184. u32 fifo_recently_full;
  185. /* Address of h->q[x] is passed to intr handler to know which queue */
  186. u8 q[MAX_REPLY_QUEUES];
  187. u32 TMFSupportFlags; /* cache what task mgmt funcs are supported. */
  188. #define HPSATMF_BITS_SUPPORTED (1 << 0)
  189. #define HPSATMF_PHYS_LUN_RESET (1 << 1)
  190. #define HPSATMF_PHYS_NEX_RESET (1 << 2)
  191. #define HPSATMF_PHYS_TASK_ABORT (1 << 3)
  192. #define HPSATMF_PHYS_TSET_ABORT (1 << 4)
  193. #define HPSATMF_PHYS_CLEAR_ACA (1 << 5)
  194. #define HPSATMF_PHYS_CLEAR_TSET (1 << 6)
  195. #define HPSATMF_PHYS_QRY_TASK (1 << 7)
  196. #define HPSATMF_PHYS_QRY_TSET (1 << 8)
  197. #define HPSATMF_PHYS_QRY_ASYNC (1 << 9)
  198. #define HPSATMF_MASK_SUPPORTED (1 << 16)
  199. #define HPSATMF_LOG_LUN_RESET (1 << 17)
  200. #define HPSATMF_LOG_NEX_RESET (1 << 18)
  201. #define HPSATMF_LOG_TASK_ABORT (1 << 19)
  202. #define HPSATMF_LOG_TSET_ABORT (1 << 20)
  203. #define HPSATMF_LOG_CLEAR_ACA (1 << 21)
  204. #define HPSATMF_LOG_CLEAR_TSET (1 << 22)
  205. #define HPSATMF_LOG_QRY_TASK (1 << 23)
  206. #define HPSATMF_LOG_QRY_TSET (1 << 24)
  207. #define HPSATMF_LOG_QRY_ASYNC (1 << 25)
  208. u32 events;
  209. #define CTLR_STATE_CHANGE_EVENT (1 << 0)
  210. #define CTLR_ENCLOSURE_HOT_PLUG_EVENT (1 << 1)
  211. #define CTLR_STATE_CHANGE_EVENT_PHYSICAL_DRV (1 << 4)
  212. #define CTLR_STATE_CHANGE_EVENT_LOGICAL_DRV (1 << 5)
  213. #define CTLR_STATE_CHANGE_EVENT_REDUNDANT_CNTRL (1 << 6)
  214. #define CTLR_STATE_CHANGE_EVENT_AIO_ENABLED_DISABLED (1 << 30)
  215. #define CTLR_STATE_CHANGE_EVENT_AIO_CONFIG_CHANGE (1 << 31)
  216. #define RESCAN_REQUIRED_EVENT_BITS \
  217. (CTLR_ENCLOSURE_HOT_PLUG_EVENT | \
  218. CTLR_STATE_CHANGE_EVENT_PHYSICAL_DRV | \
  219. CTLR_STATE_CHANGE_EVENT_LOGICAL_DRV | \
  220. CTLR_STATE_CHANGE_EVENT_AIO_ENABLED_DISABLED | \
  221. CTLR_STATE_CHANGE_EVENT_AIO_CONFIG_CHANGE)
  222. spinlock_t offline_device_lock;
  223. struct list_head offline_device_list;
  224. int acciopath_status;
  225. int drv_req_rescan; /* flag for driver to request rescan event */
  226. int raid_offload_debug;
  227. };
  228. struct offline_device_entry {
  229. unsigned char scsi3addr[8];
  230. struct list_head offline_list;
  231. };
  232. #define HPSA_ABORT_MSG 0
  233. #define HPSA_DEVICE_RESET_MSG 1
  234. #define HPSA_RESET_TYPE_CONTROLLER 0x00
  235. #define HPSA_RESET_TYPE_BUS 0x01
  236. #define HPSA_RESET_TYPE_TARGET 0x03
  237. #define HPSA_RESET_TYPE_LUN 0x04
  238. #define HPSA_MSG_SEND_RETRY_LIMIT 10
  239. #define HPSA_MSG_SEND_RETRY_INTERVAL_MSECS (10000)
  240. /* Maximum time in seconds driver will wait for command completions
  241. * when polling before giving up.
  242. */
  243. #define HPSA_MAX_POLL_TIME_SECS (20)
  244. /* During SCSI error recovery, HPSA_TUR_RETRY_LIMIT defines
  245. * how many times to retry TEST UNIT READY on a device
  246. * while waiting for it to become ready before giving up.
  247. * HPSA_MAX_WAIT_INTERVAL_SECS is the max wait interval
  248. * between sending TURs while waiting for a device
  249. * to become ready.
  250. */
  251. #define HPSA_TUR_RETRY_LIMIT (20)
  252. #define HPSA_MAX_WAIT_INTERVAL_SECS (30)
  253. /* HPSA_BOARD_READY_WAIT_SECS is how long to wait for a board
  254. * to become ready, in seconds, before giving up on it.
  255. * HPSA_BOARD_READY_POLL_INTERVAL_MSECS * is how long to wait
  256. * between polling the board to see if it is ready, in
  257. * milliseconds. HPSA_BOARD_READY_POLL_INTERVAL and
  258. * HPSA_BOARD_READY_ITERATIONS are derived from those.
  259. */
  260. #define HPSA_BOARD_READY_WAIT_SECS (120)
  261. #define HPSA_BOARD_NOT_READY_WAIT_SECS (100)
  262. #define HPSA_BOARD_READY_POLL_INTERVAL_MSECS (100)
  263. #define HPSA_BOARD_READY_POLL_INTERVAL \
  264. ((HPSA_BOARD_READY_POLL_INTERVAL_MSECS * HZ) / 1000)
  265. #define HPSA_BOARD_READY_ITERATIONS \
  266. ((HPSA_BOARD_READY_WAIT_SECS * 1000) / \
  267. HPSA_BOARD_READY_POLL_INTERVAL_MSECS)
  268. #define HPSA_BOARD_NOT_READY_ITERATIONS \
  269. ((HPSA_BOARD_NOT_READY_WAIT_SECS * 1000) / \
  270. HPSA_BOARD_READY_POLL_INTERVAL_MSECS)
  271. #define HPSA_POST_RESET_PAUSE_MSECS (3000)
  272. #define HPSA_POST_RESET_NOOP_RETRIES (12)
  273. /* Defining the diffent access_menthods */
  274. /*
  275. * Memory mapped FIFO interface (SMART 53xx cards)
  276. */
  277. #define SA5_DOORBELL 0x20
  278. #define SA5_REQUEST_PORT_OFFSET 0x40
  279. #define SA5_REPLY_INTR_MASK_OFFSET 0x34
  280. #define SA5_REPLY_PORT_OFFSET 0x44
  281. #define SA5_INTR_STATUS 0x30
  282. #define SA5_SCRATCHPAD_OFFSET 0xB0
  283. #define SA5_CTCFG_OFFSET 0xB4
  284. #define SA5_CTMEM_OFFSET 0xB8
  285. #define SA5_INTR_OFF 0x08
  286. #define SA5B_INTR_OFF 0x04
  287. #define SA5_INTR_PENDING 0x08
  288. #define SA5B_INTR_PENDING 0x04
  289. #define FIFO_EMPTY 0xffffffff
  290. #define HPSA_FIRMWARE_READY 0xffff0000 /* value in scratchpad register */
  291. #define HPSA_ERROR_BIT 0x02
  292. /* Performant mode flags */
  293. #define SA5_PERF_INTR_PENDING 0x04
  294. #define SA5_PERF_INTR_OFF 0x05
  295. #define SA5_OUTDB_STATUS_PERF_BIT 0x01
  296. #define SA5_OUTDB_CLEAR_PERF_BIT 0x01
  297. #define SA5_OUTDB_CLEAR 0xA0
  298. #define SA5_OUTDB_CLEAR_PERF_BIT 0x01
  299. #define SA5_OUTDB_STATUS 0x9C
  300. #define HPSA_INTR_ON 1
  301. #define HPSA_INTR_OFF 0
  302. /*
  303. * Inbound Post Queue offsets for IO Accelerator Mode 2
  304. */
  305. #define IOACCEL2_INBOUND_POSTQ_32 0x48
  306. #define IOACCEL2_INBOUND_POSTQ_64_LOW 0xd0
  307. #define IOACCEL2_INBOUND_POSTQ_64_HI 0xd4
  308. /*
  309. Send the command to the hardware
  310. */
  311. static void SA5_submit_command(struct ctlr_info *h,
  312. struct CommandList *c)
  313. {
  314. writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
  315. (void) readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
  316. }
  317. static void SA5_submit_command_no_read(struct ctlr_info *h,
  318. struct CommandList *c)
  319. {
  320. writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
  321. }
  322. static void SA5_submit_command_ioaccel2(struct ctlr_info *h,
  323. struct CommandList *c)
  324. {
  325. if (c->cmd_type == CMD_IOACCEL2)
  326. writel(c->busaddr, h->vaddr + IOACCEL2_INBOUND_POSTQ_32);
  327. else
  328. writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
  329. }
  330. /*
  331. * This card is the opposite of the other cards.
  332. * 0 turns interrupts on...
  333. * 0x08 turns them off...
  334. */
  335. static void SA5_intr_mask(struct ctlr_info *h, unsigned long val)
  336. {
  337. if (val) { /* Turn interrupts on */
  338. h->interrupts_enabled = 1;
  339. writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
  340. (void) readl(h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
  341. } else { /* Turn them off */
  342. h->interrupts_enabled = 0;
  343. writel(SA5_INTR_OFF,
  344. h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
  345. (void) readl(h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
  346. }
  347. }
  348. static void SA5_performant_intr_mask(struct ctlr_info *h, unsigned long val)
  349. {
  350. if (val) { /* turn on interrupts */
  351. h->interrupts_enabled = 1;
  352. writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
  353. (void) readl(h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
  354. } else {
  355. h->interrupts_enabled = 0;
  356. writel(SA5_PERF_INTR_OFF,
  357. h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
  358. (void) readl(h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
  359. }
  360. }
  361. static unsigned long SA5_performant_completed(struct ctlr_info *h, u8 q)
  362. {
  363. struct reply_queue_buffer *rq = &h->reply_queue[q];
  364. unsigned long flags, register_value = FIFO_EMPTY;
  365. /* msi auto clears the interrupt pending bit. */
  366. if (!(h->msi_vector || h->msix_vector)) {
  367. /* flush the controller write of the reply queue by reading
  368. * outbound doorbell status register.
  369. */
  370. register_value = readl(h->vaddr + SA5_OUTDB_STATUS);
  371. writel(SA5_OUTDB_CLEAR_PERF_BIT, h->vaddr + SA5_OUTDB_CLEAR);
  372. /* Do a read in order to flush the write to the controller
  373. * (as per spec.)
  374. */
  375. register_value = readl(h->vaddr + SA5_OUTDB_STATUS);
  376. }
  377. if ((rq->head[rq->current_entry] & 1) == rq->wraparound) {
  378. register_value = rq->head[rq->current_entry];
  379. rq->current_entry++;
  380. spin_lock_irqsave(&h->lock, flags);
  381. h->commands_outstanding--;
  382. spin_unlock_irqrestore(&h->lock, flags);
  383. } else {
  384. register_value = FIFO_EMPTY;
  385. }
  386. /* Check for wraparound */
  387. if (rq->current_entry == h->max_commands) {
  388. rq->current_entry = 0;
  389. rq->wraparound ^= 1;
  390. }
  391. return register_value;
  392. }
  393. /*
  394. * Returns true if fifo is full.
  395. *
  396. */
  397. static unsigned long SA5_fifo_full(struct ctlr_info *h)
  398. {
  399. if (h->commands_outstanding >= h->max_commands)
  400. return 1;
  401. else
  402. return 0;
  403. }
  404. /*
  405. * returns value read from hardware.
  406. * returns FIFO_EMPTY if there is nothing to read
  407. */
  408. static unsigned long SA5_completed(struct ctlr_info *h,
  409. __attribute__((unused)) u8 q)
  410. {
  411. unsigned long register_value
  412. = readl(h->vaddr + SA5_REPLY_PORT_OFFSET);
  413. unsigned long flags;
  414. if (register_value != FIFO_EMPTY) {
  415. spin_lock_irqsave(&h->lock, flags);
  416. h->commands_outstanding--;
  417. spin_unlock_irqrestore(&h->lock, flags);
  418. }
  419. #ifdef HPSA_DEBUG
  420. if (register_value != FIFO_EMPTY)
  421. dev_dbg(&h->pdev->dev, "Read %lx back from board\n",
  422. register_value);
  423. else
  424. dev_dbg(&h->pdev->dev, "FIFO Empty read\n");
  425. #endif
  426. return register_value;
  427. }
  428. /*
  429. * Returns true if an interrupt is pending..
  430. */
  431. static bool SA5_intr_pending(struct ctlr_info *h)
  432. {
  433. unsigned long register_value =
  434. readl(h->vaddr + SA5_INTR_STATUS);
  435. return register_value & SA5_INTR_PENDING;
  436. }
  437. static bool SA5_performant_intr_pending(struct ctlr_info *h)
  438. {
  439. unsigned long register_value = readl(h->vaddr + SA5_INTR_STATUS);
  440. if (!register_value)
  441. return false;
  442. if (h->msi_vector || h->msix_vector)
  443. return true;
  444. /* Read outbound doorbell to flush */
  445. register_value = readl(h->vaddr + SA5_OUTDB_STATUS);
  446. return register_value & SA5_OUTDB_STATUS_PERF_BIT;
  447. }
  448. #define SA5_IOACCEL_MODE1_INTR_STATUS_CMP_BIT 0x100
  449. static bool SA5_ioaccel_mode1_intr_pending(struct ctlr_info *h)
  450. {
  451. unsigned long register_value = readl(h->vaddr + SA5_INTR_STATUS);
  452. return (register_value & SA5_IOACCEL_MODE1_INTR_STATUS_CMP_BIT) ?
  453. true : false;
  454. }
  455. #define IOACCEL_MODE1_REPLY_QUEUE_INDEX 0x1A0
  456. #define IOACCEL_MODE1_PRODUCER_INDEX 0x1B8
  457. #define IOACCEL_MODE1_CONSUMER_INDEX 0x1BC
  458. #define IOACCEL_MODE1_REPLY_UNUSED 0xFFFFFFFFFFFFFFFFULL
  459. static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q)
  460. {
  461. u64 register_value;
  462. struct reply_queue_buffer *rq = &h->reply_queue[q];
  463. unsigned long flags;
  464. BUG_ON(q >= h->nreply_queues);
  465. register_value = rq->head[rq->current_entry];
  466. if (register_value != IOACCEL_MODE1_REPLY_UNUSED) {
  467. rq->head[rq->current_entry] = IOACCEL_MODE1_REPLY_UNUSED;
  468. if (++rq->current_entry == rq->size)
  469. rq->current_entry = 0;
  470. /*
  471. * @todo
  472. *
  473. * Don't really need to write the new index after each command,
  474. * but with current driver design this is easiest.
  475. */
  476. wmb();
  477. writel((q << 24) | rq->current_entry, h->vaddr +
  478. IOACCEL_MODE1_CONSUMER_INDEX);
  479. spin_lock_irqsave(&h->lock, flags);
  480. h->commands_outstanding--;
  481. spin_unlock_irqrestore(&h->lock, flags);
  482. }
  483. return (unsigned long) register_value;
  484. }
  485. static struct access_method SA5_access = {
  486. SA5_submit_command,
  487. SA5_intr_mask,
  488. SA5_fifo_full,
  489. SA5_intr_pending,
  490. SA5_completed,
  491. };
  492. static struct access_method SA5_ioaccel_mode1_access = {
  493. SA5_submit_command,
  494. SA5_performant_intr_mask,
  495. SA5_fifo_full,
  496. SA5_ioaccel_mode1_intr_pending,
  497. SA5_ioaccel_mode1_completed,
  498. };
  499. static struct access_method SA5_ioaccel_mode2_access = {
  500. SA5_submit_command_ioaccel2,
  501. SA5_performant_intr_mask,
  502. SA5_fifo_full,
  503. SA5_performant_intr_pending,
  504. SA5_performant_completed,
  505. };
  506. static struct access_method SA5_performant_access = {
  507. SA5_submit_command,
  508. SA5_performant_intr_mask,
  509. SA5_fifo_full,
  510. SA5_performant_intr_pending,
  511. SA5_performant_completed,
  512. };
  513. static struct access_method SA5_performant_access_no_read = {
  514. SA5_submit_command_no_read,
  515. SA5_performant_intr_mask,
  516. SA5_fifo_full,
  517. SA5_performant_intr_pending,
  518. SA5_performant_completed,
  519. };
  520. struct board_type {
  521. u32 board_id;
  522. char *product_name;
  523. struct access_method *access;
  524. };
  525. #endif /* HPSA_H */