i2o.h 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  1. /*
  2. * I2O kernel space accessible structures/APIs
  3. *
  4. * (c) Copyright 1999, 2000 Red Hat Software
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. *
  11. *************************************************************************
  12. *
  13. * This header file defined the I2O APIs/structures for use by
  14. * the I2O kernel modules.
  15. *
  16. */
  17. #ifndef _I2O_H
  18. #define _I2O_H
  19. #ifdef __KERNEL__ /* This file to be included by kernel only */
  20. #include <linux/i2o-dev.h>
  21. /* How many different OSM's are we allowing */
  22. #define I2O_MAX_DRIVERS 8
  23. #include <asm/io.h>
  24. #include <asm/semaphore.h> /* Needed for MUTEX init macros */
  25. #include <linux/pci.h>
  26. #include <linux/dma-mapping.h>
  27. /* message queue empty */
  28. #define I2O_QUEUE_EMPTY 0xffffffff
  29. /*
  30. * Message structures
  31. */
  32. struct i2o_message {
  33. union {
  34. struct {
  35. u8 version_offset;
  36. u8 flags;
  37. u16 size;
  38. u32 target_tid:12;
  39. u32 init_tid:12;
  40. u32 function:8;
  41. u32 icntxt; /* initiator context */
  42. u32 tcntxt; /* transaction context */
  43. } s;
  44. u32 head[4];
  45. } u;
  46. /* List follows */
  47. u32 body[0];
  48. };
  49. /*
  50. * Each I2O device entity has one of these. There is one per device.
  51. */
  52. struct i2o_device {
  53. i2o_lct_entry lct_data; /* Device LCT information */
  54. struct i2o_controller *iop; /* Controlling IOP */
  55. struct list_head list; /* node in IOP devices list */
  56. struct device device;
  57. struct semaphore lock; /* device lock */
  58. };
  59. /*
  60. * Event structure provided to the event handling function
  61. */
  62. struct i2o_event {
  63. struct work_struct work;
  64. struct i2o_device *i2o_dev; /* I2O device pointer from which the
  65. event reply was initiated */
  66. u16 size; /* Size of data in 32-bit words */
  67. u32 tcntxt; /* Transaction context used at
  68. registration */
  69. u32 event_indicator; /* Event indicator from reply */
  70. u32 data[0]; /* Event data from reply */
  71. };
  72. /*
  73. * I2O classes which could be handled by the OSM
  74. */
  75. struct i2o_class_id {
  76. u16 class_id:12;
  77. };
  78. /*
  79. * I2O driver structure for OSMs
  80. */
  81. struct i2o_driver {
  82. char *name; /* OSM name */
  83. int context; /* Low 8 bits of the transaction info */
  84. struct i2o_class_id *classes; /* I2O classes that this OSM handles */
  85. /* Message reply handler */
  86. int (*reply) (struct i2o_controller *, u32, struct i2o_message *);
  87. /* Event handler */
  88. void (*event) (struct i2o_event *);
  89. struct workqueue_struct *event_queue; /* Event queue */
  90. struct device_driver driver;
  91. /* notification of changes */
  92. void (*notify_controller_add) (struct i2o_controller *);
  93. void (*notify_controller_remove) (struct i2o_controller *);
  94. void (*notify_device_add) (struct i2o_device *);
  95. void (*notify_device_remove) (struct i2o_device *);
  96. struct semaphore lock;
  97. };
  98. /*
  99. * Contains DMA mapped address information
  100. */
  101. struct i2o_dma {
  102. void *virt;
  103. dma_addr_t phys;
  104. size_t len;
  105. };
  106. /*
  107. * Contains IO mapped address information
  108. */
  109. struct i2o_io {
  110. void __iomem *virt;
  111. unsigned long phys;
  112. unsigned long len;
  113. };
  114. /*
  115. * Context queue entry, used for 32-bit context on 64-bit systems
  116. */
  117. struct i2o_context_list_element {
  118. struct list_head list;
  119. u32 context;
  120. void *ptr;
  121. unsigned long timestamp;
  122. };
  123. /*
  124. * Each I2O controller has one of these objects
  125. */
  126. struct i2o_controller {
  127. char name[16];
  128. int unit;
  129. int type;
  130. struct pci_dev *pdev; /* PCI device */
  131. unsigned int promise:1; /* Promise controller */
  132. unsigned int adaptec:1; /* DPT / Adaptec controller */
  133. unsigned int raptor:1; /* split bar */
  134. unsigned int no_quiesce:1; /* dont quiesce before reset */
  135. unsigned int short_req:1; /* use small block sizes */
  136. unsigned int limit_sectors:1; /* limit number of sectors / request */
  137. unsigned int pae_support:1; /* controller has 64-bit SGL support */
  138. struct list_head devices; /* list of I2O devices */
  139. struct list_head list; /* Controller list */
  140. void __iomem *in_port; /* Inbout port address */
  141. void __iomem *out_port; /* Outbound port address */
  142. void __iomem *irq_status; /* Interrupt status register address */
  143. void __iomem *irq_mask; /* Interrupt mask register address */
  144. /* Dynamic LCT related data */
  145. struct i2o_dma status; /* IOP status block */
  146. struct i2o_dma hrt; /* HW Resource Table */
  147. i2o_lct *lct; /* Logical Config Table */
  148. struct i2o_dma dlct; /* Temp LCT */
  149. struct semaphore lct_lock; /* Lock for LCT updates */
  150. struct i2o_dma status_block; /* IOP status block */
  151. struct i2o_io base; /* controller messaging unit */
  152. struct i2o_io in_queue; /* inbound message queue Host->IOP */
  153. struct i2o_dma out_queue; /* outbound message queue IOP->Host */
  154. unsigned int battery:1; /* Has a battery backup */
  155. unsigned int io_alloc:1; /* An I/O resource was allocated */
  156. unsigned int mem_alloc:1; /* A memory resource was allocated */
  157. struct resource io_resource; /* I/O resource allocated to the IOP */
  158. struct resource mem_resource; /* Mem resource allocated to the IOP */
  159. struct device device;
  160. struct class_device *classdev; /* I2O controller class device */
  161. struct i2o_device *exec; /* Executive */
  162. #if BITS_PER_LONG == 64
  163. spinlock_t context_list_lock; /* lock for context_list */
  164. atomic_t context_list_counter; /* needed for unique contexts */
  165. struct list_head context_list; /* list of context id's
  166. and pointers */
  167. #endif
  168. spinlock_t lock; /* lock for controller
  169. configuration */
  170. void *driver_data[I2O_MAX_DRIVERS]; /* storage for drivers */
  171. };
  172. /*
  173. * I2O System table entry
  174. *
  175. * The system table contains information about all the IOPs in the
  176. * system. It is sent to all IOPs so that they can create peer2peer
  177. * connections between them.
  178. */
  179. struct i2o_sys_tbl_entry {
  180. u16 org_id;
  181. u16 reserved1;
  182. u32 iop_id:12;
  183. u32 reserved2:20;
  184. u16 seg_num:12;
  185. u16 i2o_version:4;
  186. u8 iop_state;
  187. u8 msg_type;
  188. u16 frame_size;
  189. u16 reserved3;
  190. u32 last_changed;
  191. u32 iop_capabilities;
  192. u32 inbound_low;
  193. u32 inbound_high;
  194. };
  195. struct i2o_sys_tbl {
  196. u8 num_entries;
  197. u8 version;
  198. u16 reserved1;
  199. u32 change_ind;
  200. u32 reserved2;
  201. u32 reserved3;
  202. struct i2o_sys_tbl_entry iops[0];
  203. };
  204. extern struct list_head i2o_controllers;
  205. /* Message functions */
  206. static inline u32 i2o_msg_get(struct i2o_controller *,
  207. struct i2o_message __iomem **);
  208. extern u32 i2o_msg_get_wait(struct i2o_controller *,
  209. struct i2o_message __iomem **, int);
  210. static inline void i2o_msg_post(struct i2o_controller *, u32);
  211. static inline int i2o_msg_post_wait(struct i2o_controller *, u32,
  212. unsigned long);
  213. extern int i2o_msg_post_wait_mem(struct i2o_controller *, u32, unsigned long,
  214. struct i2o_dma *);
  215. extern void i2o_msg_nop(struct i2o_controller *, u32);
  216. static inline void i2o_flush_reply(struct i2o_controller *, u32);
  217. /* IOP functions */
  218. extern int i2o_status_get(struct i2o_controller *);
  219. extern int i2o_event_register(struct i2o_device *, struct i2o_driver *, int,
  220. u32);
  221. extern struct i2o_device *i2o_iop_find_device(struct i2o_controller *, u16);
  222. extern struct i2o_controller *i2o_find_iop(int);
  223. /* Functions needed for handling 64-bit pointers in 32-bit context */
  224. #if BITS_PER_LONG == 64
  225. extern u32 i2o_cntxt_list_add(struct i2o_controller *, void *);
  226. extern void *i2o_cntxt_list_get(struct i2o_controller *, u32);
  227. extern u32 i2o_cntxt_list_remove(struct i2o_controller *, void *);
  228. extern u32 i2o_cntxt_list_get_ptr(struct i2o_controller *, void *);
  229. static inline u32 i2o_ptr_low(void *ptr)
  230. {
  231. return (u32) (u64) ptr;
  232. };
  233. static inline u32 i2o_ptr_high(void *ptr)
  234. {
  235. return (u32) ((u64) ptr >> 32);
  236. };
  237. static inline u32 i2o_dma_low(dma_addr_t dma_addr)
  238. {
  239. return (u32) (u64) dma_addr;
  240. };
  241. static inline u32 i2o_dma_high(dma_addr_t dma_addr)
  242. {
  243. return (u32) ((u64) dma_addr >> 32);
  244. };
  245. #else
  246. static inline u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr)
  247. {
  248. return (u32) ptr;
  249. };
  250. static inline void *i2o_cntxt_list_get(struct i2o_controller *c, u32 context)
  251. {
  252. return (void *)context;
  253. };
  254. static inline u32 i2o_cntxt_list_remove(struct i2o_controller *c, void *ptr)
  255. {
  256. return (u32) ptr;
  257. };
  258. static inline u32 i2o_cntxt_list_get_ptr(struct i2o_controller *c, void *ptr)
  259. {
  260. return (u32) ptr;
  261. };
  262. static inline u32 i2o_ptr_low(void *ptr)
  263. {
  264. return (u32) ptr;
  265. };
  266. static inline u32 i2o_ptr_high(void *ptr)
  267. {
  268. return 0;
  269. };
  270. static inline u32 i2o_dma_low(dma_addr_t dma_addr)
  271. {
  272. return (u32) dma_addr;
  273. };
  274. static inline u32 i2o_dma_high(dma_addr_t dma_addr)
  275. {
  276. return 0;
  277. };
  278. #endif
  279. /**
  280. * i2o_sg_tablesize - Calculate the maximum number of elements in a SGL
  281. * @c: I2O controller for which the calculation should be done
  282. * @body_size: maximum body size used for message in 32-bit words.
  283. *
  284. * Return the maximum number of SG elements in a SG list.
  285. */
  286. static inline u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size)
  287. {
  288. i2o_status_block *sb = c->status_block.virt;
  289. u16 sg_count =
  290. (sb->inbound_frame_size - sizeof(struct i2o_message) / 4) -
  291. body_size;
  292. if (c->pae_support) {
  293. /*
  294. * for 64-bit a SG attribute element must be added and each
  295. * SG element needs 12 bytes instead of 8.
  296. */
  297. sg_count -= 2;
  298. sg_count /= 3;
  299. } else
  300. sg_count /= 2;
  301. if (c->short_req && (sg_count > 8))
  302. sg_count = 8;
  303. return sg_count;
  304. };
  305. /**
  306. * i2o_dma_map_single - Map pointer to controller and fill in I2O message.
  307. * @c: I2O controller
  308. * @ptr: pointer to the data which should be mapped
  309. * @size: size of data in bytes
  310. * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE
  311. * @sg_ptr: pointer to the SG list inside the I2O message
  312. *
  313. * This function does all necessary DMA handling and also writes the I2O
  314. * SGL elements into the I2O message. For details on DMA handling see also
  315. * dma_map_single(). The pointer sg_ptr will only be set to the end of the
  316. * SG list if the allocation was successful.
  317. *
  318. * Returns DMA address which must be checked for failures using
  319. * dma_mapping_error().
  320. */
  321. static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
  322. size_t size,
  323. enum dma_data_direction direction,
  324. u32 __iomem ** sg_ptr)
  325. {
  326. u32 sg_flags;
  327. u32 __iomem *mptr = *sg_ptr;
  328. dma_addr_t dma_addr;
  329. switch (direction) {
  330. case DMA_TO_DEVICE:
  331. sg_flags = 0xd4000000;
  332. break;
  333. case DMA_FROM_DEVICE:
  334. sg_flags = 0xd0000000;
  335. break;
  336. default:
  337. return 0;
  338. }
  339. dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction);
  340. if (!dma_mapping_error(dma_addr)) {
  341. #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
  342. if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
  343. writel(0x7C020002, mptr++);
  344. writel(PAGE_SIZE, mptr++);
  345. }
  346. #endif
  347. writel(sg_flags | size, mptr++);
  348. writel(i2o_dma_low(dma_addr), mptr++);
  349. #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
  350. if ((sizeof(dma_addr_t) > 4) && c->pae_support)
  351. writel(i2o_dma_high(dma_addr), mptr++);
  352. #endif
  353. *sg_ptr = mptr;
  354. }
  355. return dma_addr;
  356. };
  357. /**
  358. * i2o_dma_map_sg - Map a SG List to controller and fill in I2O message.
  359. * @c: I2O controller
  360. * @sg: SG list to be mapped
  361. * @sg_count: number of elements in the SG list
  362. * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE
  363. * @sg_ptr: pointer to the SG list inside the I2O message
  364. *
  365. * This function does all necessary DMA handling and also writes the I2O
  366. * SGL elements into the I2O message. For details on DMA handling see also
  367. * dma_map_sg(). The pointer sg_ptr will only be set to the end of the SG
  368. * list if the allocation was successful.
  369. *
  370. * Returns 0 on failure or 1 on success.
  371. */
  372. static inline int i2o_dma_map_sg(struct i2o_controller *c,
  373. struct scatterlist *sg, int sg_count,
  374. enum dma_data_direction direction,
  375. u32 __iomem ** sg_ptr)
  376. {
  377. u32 sg_flags;
  378. u32 __iomem *mptr = *sg_ptr;
  379. switch (direction) {
  380. case DMA_TO_DEVICE:
  381. sg_flags = 0x14000000;
  382. break;
  383. case DMA_FROM_DEVICE:
  384. sg_flags = 0x10000000;
  385. break;
  386. default:
  387. return 0;
  388. }
  389. sg_count = dma_map_sg(&c->pdev->dev, sg, sg_count, direction);
  390. if (!sg_count)
  391. return 0;
  392. #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
  393. if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
  394. writel(0x7C020002, mptr++);
  395. writel(PAGE_SIZE, mptr++);
  396. }
  397. #endif
  398. while (sg_count-- > 0) {
  399. if (!sg_count)
  400. sg_flags |= 0xC0000000;
  401. writel(sg_flags | sg_dma_len(sg), mptr++);
  402. writel(i2o_dma_low(sg_dma_address(sg)), mptr++);
  403. #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
  404. if ((sizeof(dma_addr_t) > 4) && c->pae_support)
  405. writel(i2o_dma_high(sg_dma_address(sg)), mptr++);
  406. #endif
  407. sg++;
  408. }
  409. *sg_ptr = mptr;
  410. return 1;
  411. };
  412. /**
  413. * i2o_dma_alloc - Allocate DMA memory
  414. * @dev: struct device pointer to the PCI device of the I2O controller
  415. * @addr: i2o_dma struct which should get the DMA buffer
  416. * @len: length of the new DMA memory
  417. * @gfp_mask: GFP mask
  418. *
  419. * Allocate a coherent DMA memory and write the pointers into addr.
  420. *
  421. * Returns 0 on success or -ENOMEM on failure.
  422. */
  423. static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr,
  424. size_t len, unsigned int gfp_mask)
  425. {
  426. struct pci_dev *pdev = to_pci_dev(dev);
  427. int dma_64 = 0;
  428. if ((sizeof(dma_addr_t) > 4) && (pdev->dma_mask == DMA_64BIT_MASK)) {
  429. dma_64 = 1;
  430. if (pci_set_dma_mask(pdev, DMA_32BIT_MASK))
  431. return -ENOMEM;
  432. }
  433. addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask);
  434. if ((sizeof(dma_addr_t) > 4) && dma_64)
  435. if (pci_set_dma_mask(pdev, DMA_64BIT_MASK))
  436. printk(KERN_WARNING "i2o: unable to set 64-bit DMA");
  437. if (!addr->virt)
  438. return -ENOMEM;
  439. memset(addr->virt, 0, len);
  440. addr->len = len;
  441. return 0;
  442. };
  443. /**
  444. * i2o_dma_free - Free DMA memory
  445. * @dev: struct device pointer to the PCI device of the I2O controller
  446. * @addr: i2o_dma struct which contains the DMA buffer
  447. *
  448. * Free a coherent DMA memory and set virtual address of addr to NULL.
  449. */
  450. static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr)
  451. {
  452. if (addr->virt) {
  453. if (addr->phys)
  454. dma_free_coherent(dev, addr->len, addr->virt,
  455. addr->phys);
  456. else
  457. kfree(addr->virt);
  458. addr->virt = NULL;
  459. }
  460. };
  461. /**
  462. * i2o_dma_realloc - Realloc DMA memory
  463. * @dev: struct device pointer to the PCI device of the I2O controller
  464. * @addr: pointer to a i2o_dma struct DMA buffer
  465. * @len: new length of memory
  466. * @gfp_mask: GFP mask
  467. *
  468. * If there was something allocated in the addr, free it first. If len > 0
  469. * than try to allocate it and write the addresses back to the addr
  470. * structure. If len == 0 set the virtual address to NULL.
  471. *
  472. * Returns the 0 on success or negative error code on failure.
  473. */
  474. static inline int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr,
  475. size_t len, unsigned int gfp_mask)
  476. {
  477. i2o_dma_free(dev, addr);
  478. if (len)
  479. return i2o_dma_alloc(dev, addr, len, gfp_mask);
  480. return 0;
  481. };
  482. /* I2O driver (OSM) functions */
  483. extern int i2o_driver_register(struct i2o_driver *);
  484. extern void i2o_driver_unregister(struct i2o_driver *);
  485. /**
  486. * i2o_driver_notify_controller_add - Send notification of added controller
  487. * to a single I2O driver
  488. *
  489. * Send notification of added controller to a single registered driver.
  490. */
  491. static inline void i2o_driver_notify_controller_add(struct i2o_driver *drv,
  492. struct i2o_controller *c)
  493. {
  494. if (drv->notify_controller_add)
  495. drv->notify_controller_add(c);
  496. };
  497. /**
  498. * i2o_driver_notify_controller_remove - Send notification of removed
  499. * controller to a single I2O driver
  500. *
  501. * Send notification of removed controller to a single registered driver.
  502. */
  503. static inline void i2o_driver_notify_controller_remove(struct i2o_driver *drv,
  504. struct i2o_controller *c)
  505. {
  506. if (drv->notify_controller_remove)
  507. drv->notify_controller_remove(c);
  508. };
  509. /**
  510. * i2o_driver_notify_device_add - Send notification of added device to a
  511. * single I2O driver
  512. *
  513. * Send notification of added device to a single registered driver.
  514. */
  515. static inline void i2o_driver_notify_device_add(struct i2o_driver *drv,
  516. struct i2o_device *i2o_dev)
  517. {
  518. if (drv->notify_device_add)
  519. drv->notify_device_add(i2o_dev);
  520. };
  521. /**
  522. * i2o_driver_notify_device_remove - Send notification of removed device
  523. * to a single I2O driver
  524. *
  525. * Send notification of removed device to a single registered driver.
  526. */
  527. static inline void i2o_driver_notify_device_remove(struct i2o_driver *drv,
  528. struct i2o_device *i2o_dev)
  529. {
  530. if (drv->notify_device_remove)
  531. drv->notify_device_remove(i2o_dev);
  532. };
  533. extern void i2o_driver_notify_controller_add_all(struct i2o_controller *);
  534. extern void i2o_driver_notify_controller_remove_all(struct i2o_controller *);
  535. extern void i2o_driver_notify_device_add_all(struct i2o_device *);
  536. extern void i2o_driver_notify_device_remove_all(struct i2o_device *);
  537. /* I2O device functions */
  538. extern int i2o_device_claim(struct i2o_device *);
  539. extern int i2o_device_claim_release(struct i2o_device *);
  540. /* Exec OSM functions */
  541. extern int i2o_exec_lct_get(struct i2o_controller *);
  542. /* device / driver / kobject conversion functions */
  543. #define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver)
  544. #define to_i2o_device(dev) container_of(dev, struct i2o_device, device)
  545. #define to_i2o_controller(dev) container_of(dev, struct i2o_controller, device)
  546. #define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj))
  547. /**
  548. * i2o_msg_get - obtain an I2O message from the IOP
  549. * @c: I2O controller
  550. * @msg: pointer to a I2O message pointer
  551. *
  552. * This function tries to get a message slot. If no message slot is
  553. * available do not wait until one is availabe (see also i2o_msg_get_wait).
  554. *
  555. * On a success the message is returned and the pointer to the message is
  556. * set in msg. The returned message is the physical page frame offset
  557. * address from the read port (see the i2o spec). If no message is
  558. * available returns I2O_QUEUE_EMPTY and msg is leaved untouched.
  559. */
  560. static inline u32 i2o_msg_get(struct i2o_controller *c,
  561. struct i2o_message __iomem ** msg)
  562. {
  563. u32 m = readl(c->in_port);
  564. if (m != I2O_QUEUE_EMPTY)
  565. *msg = c->in_queue.virt + m;
  566. return m;
  567. };
  568. /**
  569. * i2o_msg_post - Post I2O message to I2O controller
  570. * @c: I2O controller to which the message should be send
  571. * @m: the message identifier
  572. *
  573. * Post the message to the I2O controller.
  574. */
  575. static inline void i2o_msg_post(struct i2o_controller *c, u32 m)
  576. {
  577. writel(m, c->in_port);
  578. };
  579. /**
  580. * i2o_msg_post_wait - Post and wait a message and wait until return
  581. * @c: controller
  582. * @m: message to post
  583. * @timeout: time in seconds to wait
  584. *
  585. * This API allows an OSM to post a message and then be told whether or
  586. * not the system received a successful reply. If the message times out
  587. * then the value '-ETIMEDOUT' is returned.
  588. *
  589. * Returns 0 on success or negative error code on failure.
  590. */
  591. static inline int i2o_msg_post_wait(struct i2o_controller *c, u32 m,
  592. unsigned long timeout)
  593. {
  594. return i2o_msg_post_wait_mem(c, m, timeout, NULL);
  595. };
  596. /**
  597. * i2o_flush_reply - Flush reply from I2O controller
  598. * @c: I2O controller
  599. * @m: the message identifier
  600. *
  601. * The I2O controller must be informed that the reply message is not needed
  602. * anymore. If you forget to flush the reply, the message frame can't be
  603. * used by the controller anymore and is therefore lost.
  604. */
  605. static inline void i2o_flush_reply(struct i2o_controller *c, u32 m)
  606. {
  607. writel(m, c->out_port);
  608. };
  609. /**
  610. * i2o_out_to_virt - Turn an I2O message to a virtual address
  611. * @c: controller
  612. * @m: message engine value
  613. *
  614. * Turn a receive message from an I2O controller bus address into
  615. * a Linux virtual address. The shared page frame is a linear block
  616. * so we simply have to shift the offset. This function does not
  617. * work for sender side messages as they are ioremap objects
  618. * provided by the I2O controller.
  619. */
  620. static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c,
  621. u32 m)
  622. {
  623. BUG_ON(m < c->out_queue.phys
  624. || m >= c->out_queue.phys + c->out_queue.len);
  625. return c->out_queue.virt + (m - c->out_queue.phys);
  626. };
  627. /**
  628. * i2o_msg_in_to_virt - Turn an I2O message to a virtual address
  629. * @c: controller
  630. * @m: message engine value
  631. *
  632. * Turn a send message from an I2O controller bus address into
  633. * a Linux virtual address. The shared page frame is a linear block
  634. * so we simply have to shift the offset. This function does not
  635. * work for receive side messages as they are kmalloc objects
  636. * in a different pool.
  637. */
  638. static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct
  639. i2o_controller *c,
  640. u32 m)
  641. {
  642. return c->in_queue.virt + m;
  643. };
  644. /*
  645. * Endian handling wrapped into the macro - keeps the core code
  646. * cleaner.
  647. */
  648. #define i2o_raw_writel(val, mem) __raw_writel(cpu_to_le32(val), mem)
  649. extern int i2o_parm_field_get(struct i2o_device *, int, int, void *, int);
  650. extern int i2o_parm_table_get(struct i2o_device *, int, int, int, void *, int,
  651. void *, int);
  652. /* debugging and troubleshooting/diagnostic helpers. */
  653. #define osm_printk(level, format, arg...) \
  654. printk(level "%s: " format, OSM_NAME , ## arg)
  655. #ifdef DEBUG
  656. #define osm_debug(format, arg...) \
  657. osm_printk(KERN_DEBUG, format , ## arg)
  658. #else
  659. #define osm_debug(format, arg...) \
  660. do { } while (0)
  661. #endif
  662. #define osm_err(format, arg...) \
  663. osm_printk(KERN_ERR, format , ## arg)
  664. #define osm_info(format, arg...) \
  665. osm_printk(KERN_INFO, format , ## arg)
  666. #define osm_warn(format, arg...) \
  667. osm_printk(KERN_WARNING, format , ## arg)
  668. /* debugging functions */
  669. extern void i2o_report_status(const char *, const char *, struct i2o_message *);
  670. extern void i2o_dump_message(struct i2o_message *);
  671. extern void i2o_dump_hrt(struct i2o_controller *c);
  672. extern void i2o_debug_state(struct i2o_controller *c);
  673. /*
  674. * Cache strategies
  675. */
  676. /* The NULL strategy leaves everything up to the controller. This tends to be a
  677. * pessimal but functional choice.
  678. */
  679. #define CACHE_NULL 0
  680. /* Prefetch data when reading. We continually attempt to load the next 32 sectors
  681. * into the controller cache.
  682. */
  683. #define CACHE_PREFETCH 1
  684. /* Prefetch data when reading. We sometimes attempt to load the next 32 sectors
  685. * into the controller cache. When an I/O is less <= 8K we assume its probably
  686. * not sequential and don't prefetch (default)
  687. */
  688. #define CACHE_SMARTFETCH 2
  689. /* Data is written to the cache and then out on to the disk. The I/O must be
  690. * physically on the medium before the write is acknowledged (default without
  691. * NVRAM)
  692. */
  693. #define CACHE_WRITETHROUGH 17
  694. /* Data is written to the cache and then out on to the disk. The controller
  695. * is permitted to write back the cache any way it wants. (default if battery
  696. * backed NVRAM is present). It can be useful to set this for swap regardless of
  697. * battery state.
  698. */
  699. #define CACHE_WRITEBACK 18
  700. /* Optimise for under powered controllers, especially on RAID1 and RAID0. We
  701. * write large I/O's directly to disk bypassing the cache to avoid the extra
  702. * memory copy hits. Small writes are writeback cached
  703. */
  704. #define CACHE_SMARTBACK 19
  705. /* Optimise for under powered controllers, especially on RAID1 and RAID0. We
  706. * write large I/O's directly to disk bypassing the cache to avoid the extra
  707. * memory copy hits. Small writes are writethrough cached. Suitable for devices
  708. * lacking battery backup
  709. */
  710. #define CACHE_SMARTTHROUGH 20
  711. /*
  712. * Ioctl structures
  713. */
  714. #define BLKI2OGRSTRAT _IOR('2', 1, int)
  715. #define BLKI2OGWSTRAT _IOR('2', 2, int)
  716. #define BLKI2OSRSTRAT _IOW('2', 3, int)
  717. #define BLKI2OSWSTRAT _IOW('2', 4, int)
  718. /*
  719. * I2O Function codes
  720. */
  721. /*
  722. * Executive Class
  723. */
  724. #define I2O_CMD_ADAPTER_ASSIGN 0xB3
  725. #define I2O_CMD_ADAPTER_READ 0xB2
  726. #define I2O_CMD_ADAPTER_RELEASE 0xB5
  727. #define I2O_CMD_BIOS_INFO_SET 0xA5
  728. #define I2O_CMD_BOOT_DEVICE_SET 0xA7
  729. #define I2O_CMD_CONFIG_VALIDATE 0xBB
  730. #define I2O_CMD_CONN_SETUP 0xCA
  731. #define I2O_CMD_DDM_DESTROY 0xB1
  732. #define I2O_CMD_DDM_ENABLE 0xD5
  733. #define I2O_CMD_DDM_QUIESCE 0xC7
  734. #define I2O_CMD_DDM_RESET 0xD9
  735. #define I2O_CMD_DDM_SUSPEND 0xAF
  736. #define I2O_CMD_DEVICE_ASSIGN 0xB7
  737. #define I2O_CMD_DEVICE_RELEASE 0xB9
  738. #define I2O_CMD_HRT_GET 0xA8
  739. #define I2O_CMD_ADAPTER_CLEAR 0xBE
  740. #define I2O_CMD_ADAPTER_CONNECT 0xC9
  741. #define I2O_CMD_ADAPTER_RESET 0xBD
  742. #define I2O_CMD_LCT_NOTIFY 0xA2
  743. #define I2O_CMD_OUTBOUND_INIT 0xA1
  744. #define I2O_CMD_PATH_ENABLE 0xD3
  745. #define I2O_CMD_PATH_QUIESCE 0xC5
  746. #define I2O_CMD_PATH_RESET 0xD7
  747. #define I2O_CMD_STATIC_MF_CREATE 0xDD
  748. #define I2O_CMD_STATIC_MF_RELEASE 0xDF
  749. #define I2O_CMD_STATUS_GET 0xA0
  750. #define I2O_CMD_SW_DOWNLOAD 0xA9
  751. #define I2O_CMD_SW_UPLOAD 0xAB
  752. #define I2O_CMD_SW_REMOVE 0xAD
  753. #define I2O_CMD_SYS_ENABLE 0xD1
  754. #define I2O_CMD_SYS_MODIFY 0xC1
  755. #define I2O_CMD_SYS_QUIESCE 0xC3
  756. #define I2O_CMD_SYS_TAB_SET 0xA3
  757. /*
  758. * Utility Class
  759. */
  760. #define I2O_CMD_UTIL_NOP 0x00
  761. #define I2O_CMD_UTIL_ABORT 0x01
  762. #define I2O_CMD_UTIL_CLAIM 0x09
  763. #define I2O_CMD_UTIL_RELEASE 0x0B
  764. #define I2O_CMD_UTIL_PARAMS_GET 0x06
  765. #define I2O_CMD_UTIL_PARAMS_SET 0x05
  766. #define I2O_CMD_UTIL_EVT_REGISTER 0x13
  767. #define I2O_CMD_UTIL_EVT_ACK 0x14
  768. #define I2O_CMD_UTIL_CONFIG_DIALOG 0x10
  769. #define I2O_CMD_UTIL_DEVICE_RESERVE 0x0D
  770. #define I2O_CMD_UTIL_DEVICE_RELEASE 0x0F
  771. #define I2O_CMD_UTIL_LOCK 0x17
  772. #define I2O_CMD_UTIL_LOCK_RELEASE 0x19
  773. #define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15
  774. /*
  775. * SCSI Host Bus Adapter Class
  776. */
  777. #define I2O_CMD_SCSI_EXEC 0x81
  778. #define I2O_CMD_SCSI_ABORT 0x83
  779. #define I2O_CMD_SCSI_BUSRESET 0x27
  780. /*
  781. * Bus Adapter Class
  782. */
  783. #define I2O_CMD_BUS_ADAPTER_RESET 0x85
  784. #define I2O_CMD_BUS_RESET 0x87
  785. #define I2O_CMD_BUS_SCAN 0x89
  786. #define I2O_CMD_BUS_QUIESCE 0x8b
  787. /*
  788. * Random Block Storage Class
  789. */
  790. #define I2O_CMD_BLOCK_READ 0x30
  791. #define I2O_CMD_BLOCK_WRITE 0x31
  792. #define I2O_CMD_BLOCK_CFLUSH 0x37
  793. #define I2O_CMD_BLOCK_MLOCK 0x49
  794. #define I2O_CMD_BLOCK_MUNLOCK 0x4B
  795. #define I2O_CMD_BLOCK_MMOUNT 0x41
  796. #define I2O_CMD_BLOCK_MEJECT 0x43
  797. #define I2O_CMD_BLOCK_POWER 0x70
  798. #define I2O_CMD_PRIVATE 0xFF
  799. /* Command status values */
  800. #define I2O_CMD_IN_PROGRESS 0x01
  801. #define I2O_CMD_REJECTED 0x02
  802. #define I2O_CMD_FAILED 0x03
  803. #define I2O_CMD_COMPLETED 0x04
  804. /* I2O API function return values */
  805. #define I2O_RTN_NO_ERROR 0
  806. #define I2O_RTN_NOT_INIT 1
  807. #define I2O_RTN_FREE_Q_EMPTY 2
  808. #define I2O_RTN_TCB_ERROR 3
  809. #define I2O_RTN_TRANSACTION_ERROR 4
  810. #define I2O_RTN_ADAPTER_ALREADY_INIT 5
  811. #define I2O_RTN_MALLOC_ERROR 6
  812. #define I2O_RTN_ADPTR_NOT_REGISTERED 7
  813. #define I2O_RTN_MSG_REPLY_TIMEOUT 8
  814. #define I2O_RTN_NO_STATUS 9
  815. #define I2O_RTN_NO_FIRM_VER 10
  816. #define I2O_RTN_NO_LINK_SPEED 11
  817. /* Reply message status defines for all messages */
  818. #define I2O_REPLY_STATUS_SUCCESS 0x00
  819. #define I2O_REPLY_STATUS_ABORT_DIRTY 0x01
  820. #define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02
  821. #define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03
  822. #define I2O_REPLY_STATUS_ERROR_DIRTY 0x04
  823. #define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05
  824. #define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06
  825. #define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08
  826. #define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09
  827. #define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0A
  828. #define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0B
  829. #define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80
  830. /* Status codes and Error Information for Parameter functions */
  831. #define I2O_PARAMS_STATUS_SUCCESS 0x00
  832. #define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01
  833. #define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02
  834. #define I2O_PARAMS_STATUS_BUFFER_FULL 0x03
  835. #define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04
  836. #define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05
  837. #define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE 0x06
  838. #define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS 0x07
  839. #define I2O_PARAMS_STATUS_INVALID_GROUP_ID 0x08
  840. #define I2O_PARAMS_STATUS_INVALID_OPERATION 0x09
  841. #define I2O_PARAMS_STATUS_NO_KEY_FIELD 0x0A
  842. #define I2O_PARAMS_STATUS_NO_SUCH_FIELD 0x0B
  843. #define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP 0x0C
  844. #define I2O_PARAMS_STATUS_OPERATION_ERROR 0x0D
  845. #define I2O_PARAMS_STATUS_SCALAR_ERROR 0x0E
  846. #define I2O_PARAMS_STATUS_TABLE_ERROR 0x0F
  847. #define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE 0x10
  848. /* DetailedStatusCode defines for Executive, DDM, Util and Transaction error
  849. * messages: Table 3-2 Detailed Status Codes.*/
  850. #define I2O_DSC_SUCCESS 0x0000
  851. #define I2O_DSC_BAD_KEY 0x0002
  852. #define I2O_DSC_TCL_ERROR 0x0003
  853. #define I2O_DSC_REPLY_BUFFER_FULL 0x0004
  854. #define I2O_DSC_NO_SUCH_PAGE 0x0005
  855. #define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x0006
  856. #define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x0007
  857. #define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x0009
  858. #define I2O_DSC_UNSUPPORTED_FUNCTION 0x000A
  859. #define I2O_DSC_DEVICE_LOCKED 0x000B
  860. #define I2O_DSC_DEVICE_RESET 0x000C
  861. #define I2O_DSC_INAPPROPRIATE_FUNCTION 0x000D
  862. #define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x000E
  863. #define I2O_DSC_INVALID_MESSAGE_FLAGS 0x000F
  864. #define I2O_DSC_INVALID_OFFSET 0x0010
  865. #define I2O_DSC_INVALID_PARAMETER 0x0011
  866. #define I2O_DSC_INVALID_REQUEST 0x0012
  867. #define I2O_DSC_INVALID_TARGET_ADDRESS 0x0013
  868. #define I2O_DSC_MESSAGE_TOO_LARGE 0x0014
  869. #define I2O_DSC_MESSAGE_TOO_SMALL 0x0015
  870. #define I2O_DSC_MISSING_PARAMETER 0x0016
  871. #define I2O_DSC_TIMEOUT 0x0017
  872. #define I2O_DSC_UNKNOWN_ERROR 0x0018
  873. #define I2O_DSC_UNKNOWN_FUNCTION 0x0019
  874. #define I2O_DSC_UNSUPPORTED_VERSION 0x001A
  875. #define I2O_DSC_DEVICE_BUSY 0x001B
  876. #define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C
  877. /* DetailedStatusCode defines for Block Storage Operation: Table 6-7 Detailed
  878. Status Codes.*/
  879. #define I2O_BSA_DSC_SUCCESS 0x0000
  880. #define I2O_BSA_DSC_MEDIA_ERROR 0x0001
  881. #define I2O_BSA_DSC_ACCESS_ERROR 0x0002
  882. #define I2O_BSA_DSC_DEVICE_FAILURE 0x0003
  883. #define I2O_BSA_DSC_DEVICE_NOT_READY 0x0004
  884. #define I2O_BSA_DSC_MEDIA_NOT_PRESENT 0x0005
  885. #define I2O_BSA_DSC_MEDIA_LOCKED 0x0006
  886. #define I2O_BSA_DSC_MEDIA_FAILURE 0x0007
  887. #define I2O_BSA_DSC_PROTOCOL_FAILURE 0x0008
  888. #define I2O_BSA_DSC_BUS_FAILURE 0x0009
  889. #define I2O_BSA_DSC_ACCESS_VIOLATION 0x000A
  890. #define I2O_BSA_DSC_WRITE_PROTECTED 0x000B
  891. #define I2O_BSA_DSC_DEVICE_RESET 0x000C
  892. #define I2O_BSA_DSC_VOLUME_CHANGED 0x000D
  893. #define I2O_BSA_DSC_TIMEOUT 0x000E
  894. /* FailureStatusCodes, Table 3-3 Message Failure Codes */
  895. #define I2O_FSC_TRANSPORT_SERVICE_SUSPENDED 0x81
  896. #define I2O_FSC_TRANSPORT_SERVICE_TERMINATED 0x82
  897. #define I2O_FSC_TRANSPORT_CONGESTION 0x83
  898. #define I2O_FSC_TRANSPORT_FAILURE 0x84
  899. #define I2O_FSC_TRANSPORT_STATE_ERROR 0x85
  900. #define I2O_FSC_TRANSPORT_TIME_OUT 0x86
  901. #define I2O_FSC_TRANSPORT_ROUTING_FAILURE 0x87
  902. #define I2O_FSC_TRANSPORT_INVALID_VERSION 0x88
  903. #define I2O_FSC_TRANSPORT_INVALID_OFFSET 0x89
  904. #define I2O_FSC_TRANSPORT_INVALID_MSG_FLAGS 0x8A
  905. #define I2O_FSC_TRANSPORT_FRAME_TOO_SMALL 0x8B
  906. #define I2O_FSC_TRANSPORT_FRAME_TOO_LARGE 0x8C
  907. #define I2O_FSC_TRANSPORT_INVALID_TARGET_ID 0x8D
  908. #define I2O_FSC_TRANSPORT_INVALID_INITIATOR_ID 0x8E
  909. #define I2O_FSC_TRANSPORT_INVALID_INITIATOR_CONTEXT 0x8F
  910. #define I2O_FSC_TRANSPORT_UNKNOWN_FAILURE 0xFF
  911. /* Device Claim Types */
  912. #define I2O_CLAIM_PRIMARY 0x01000000
  913. #define I2O_CLAIM_MANAGEMENT 0x02000000
  914. #define I2O_CLAIM_AUTHORIZED 0x03000000
  915. #define I2O_CLAIM_SECONDARY 0x04000000
  916. /* Message header defines for VersionOffset */
  917. #define I2OVER15 0x0001
  918. #define I2OVER20 0x0002
  919. /* Default is 1.5 */
  920. #define I2OVERSION I2OVER15
  921. #define SGL_OFFSET_0 I2OVERSION
  922. #define SGL_OFFSET_4 (0x0040 | I2OVERSION)
  923. #define SGL_OFFSET_5 (0x0050 | I2OVERSION)
  924. #define SGL_OFFSET_6 (0x0060 | I2OVERSION)
  925. #define SGL_OFFSET_7 (0x0070 | I2OVERSION)
  926. #define SGL_OFFSET_8 (0x0080 | I2OVERSION)
  927. #define SGL_OFFSET_9 (0x0090 | I2OVERSION)
  928. #define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
  929. #define SGL_OFFSET_11 (0x00B0 | I2OVERSION)
  930. #define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
  931. #define SGL_OFFSET(x) (((x)<<4) | I2OVERSION)
  932. /* Transaction Reply Lists (TRL) Control Word structure */
  933. #define TRL_SINGLE_FIXED_LENGTH 0x00
  934. #define TRL_SINGLE_VARIABLE_LENGTH 0x40
  935. #define TRL_MULTIPLE_FIXED_LENGTH 0x80
  936. /* msg header defines for MsgFlags */
  937. #define MSG_STATIC 0x0100
  938. #define MSG_64BIT_CNTXT 0x0200
  939. #define MSG_MULTI_TRANS 0x1000
  940. #define MSG_FAIL 0x2000
  941. #define MSG_FINAL 0x4000
  942. #define MSG_REPLY 0x8000
  943. /* minimum size msg */
  944. #define THREE_WORD_MSG_SIZE 0x00030000
  945. #define FOUR_WORD_MSG_SIZE 0x00040000
  946. #define FIVE_WORD_MSG_SIZE 0x00050000
  947. #define SIX_WORD_MSG_SIZE 0x00060000
  948. #define SEVEN_WORD_MSG_SIZE 0x00070000
  949. #define EIGHT_WORD_MSG_SIZE 0x00080000
  950. #define NINE_WORD_MSG_SIZE 0x00090000
  951. #define TEN_WORD_MSG_SIZE 0x000A0000
  952. #define ELEVEN_WORD_MSG_SIZE 0x000B0000
  953. #define I2O_MESSAGE_SIZE(x) ((x)<<16)
  954. /* special TID assignments */
  955. #define ADAPTER_TID 0
  956. #define HOST_TID 1
  957. /* outbound queue defines */
  958. #define I2O_MAX_OUTBOUND_MSG_FRAMES 128
  959. #define I2O_OUTBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
  960. #define I2O_POST_WAIT_OK 0
  961. #define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT
  962. #define I2O_CONTEXT_LIST_MIN_LENGTH 15
  963. #define I2O_CONTEXT_LIST_USED 0x01
  964. #define I2O_CONTEXT_LIST_DELETED 0x02
  965. /* timeouts */
  966. #define I2O_TIMEOUT_INIT_OUTBOUND_QUEUE 15
  967. #define I2O_TIMEOUT_MESSAGE_GET 5
  968. #define I2O_TIMEOUT_RESET 30
  969. #define I2O_TIMEOUT_STATUS_GET 5
  970. #define I2O_TIMEOUT_LCT_GET 360
  971. #define I2O_TIMEOUT_SCSI_SCB_ABORT 240
  972. /* retries */
  973. #define I2O_HRT_GET_TRIES 3
  974. #define I2O_LCT_GET_TRIES 3
  975. /* defines for max_sectors and max_phys_segments */
  976. #define I2O_MAX_SECTORS 1024
  977. #define I2O_MAX_SECTORS_LIMITED 256
  978. #define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
  979. #endif /* __KERNEL__ */
  980. #endif /* _I2O_H */