i2o.h 33 KB

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