bfa_defs.h 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  1. /*
  2. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef __BFA_DEFS_H__
  18. #define __BFA_DEFS_H__
  19. #include "bfa_fc.h"
  20. #include "bfad_drv.h"
  21. #define BFA_MFG_SERIALNUM_SIZE 11
  22. #define STRSZ(_n) (((_n) + 4) & ~3)
  23. /*
  24. * Manufacturing card type
  25. */
  26. enum {
  27. BFA_MFG_TYPE_CB_MAX = 825, /* Crossbow card type max */
  28. BFA_MFG_TYPE_FC8P2 = 825, /* 8G 2port FC card */
  29. BFA_MFG_TYPE_FC8P1 = 815, /* 8G 1port FC card */
  30. BFA_MFG_TYPE_FC4P2 = 425, /* 4G 2port FC card */
  31. BFA_MFG_TYPE_FC4P1 = 415, /* 4G 1port FC card */
  32. BFA_MFG_TYPE_CNA10P2 = 1020, /* 10G 2port CNA card */
  33. BFA_MFG_TYPE_CNA10P1 = 1010, /* 10G 1port CNA card */
  34. BFA_MFG_TYPE_JAYHAWK = 804, /* Jayhawk mezz card */
  35. BFA_MFG_TYPE_WANCHESE = 1007, /* Wanchese mezz card */
  36. BFA_MFG_TYPE_ASTRA = 807, /* Astra mezz card */
  37. BFA_MFG_TYPE_LIGHTNING_P0 = 902, /* Lightning mezz card - old */
  38. BFA_MFG_TYPE_LIGHTNING = 1741, /* Lightning mezz card */
  39. BFA_MFG_TYPE_PROWLER_F = 1560, /* Prowler FC only cards */
  40. BFA_MFG_TYPE_PROWLER_N = 1410, /* Prowler NIC only cards */
  41. BFA_MFG_TYPE_PROWLER_C = 1710, /* Prowler CNA only cards */
  42. BFA_MFG_TYPE_PROWLER_D = 1860, /* Prowler Dual cards */
  43. BFA_MFG_TYPE_CHINOOK = 1867, /* Chinook cards */
  44. BFA_MFG_TYPE_INVALID = 0, /* Invalid card type */
  45. };
  46. #pragma pack(1)
  47. /*
  48. * Check if Mezz card
  49. */
  50. #define bfa_mfg_is_mezz(type) (( \
  51. (type) == BFA_MFG_TYPE_JAYHAWK || \
  52. (type) == BFA_MFG_TYPE_WANCHESE || \
  53. (type) == BFA_MFG_TYPE_ASTRA || \
  54. (type) == BFA_MFG_TYPE_LIGHTNING_P0 || \
  55. (type) == BFA_MFG_TYPE_LIGHTNING || \
  56. (type) == BFA_MFG_TYPE_CHINOOK))
  57. /*
  58. * Check if the card having old wwn/mac handling
  59. */
  60. #define bfa_mfg_is_old_wwn_mac_model(type) (( \
  61. (type) == BFA_MFG_TYPE_FC8P2 || \
  62. (type) == BFA_MFG_TYPE_FC8P1 || \
  63. (type) == BFA_MFG_TYPE_FC4P2 || \
  64. (type) == BFA_MFG_TYPE_FC4P1 || \
  65. (type) == BFA_MFG_TYPE_CNA10P2 || \
  66. (type) == BFA_MFG_TYPE_CNA10P1 || \
  67. (type) == BFA_MFG_TYPE_JAYHAWK || \
  68. (type) == BFA_MFG_TYPE_WANCHESE))
  69. #define bfa_mfg_increment_wwn_mac(m, i) \
  70. do { \
  71. u32 t = ((u32)(m)[0] << 16) | ((u32)(m)[1] << 8) | \
  72. (u32)(m)[2]; \
  73. t += (i); \
  74. (m)[0] = (t >> 16) & 0xFF; \
  75. (m)[1] = (t >> 8) & 0xFF; \
  76. (m)[2] = t & 0xFF; \
  77. } while (0)
  78. /*
  79. * VPD data length
  80. */
  81. #define BFA_MFG_VPD_LEN 512
  82. /*
  83. * VPD vendor tag
  84. */
  85. enum {
  86. BFA_MFG_VPD_UNKNOWN = 0, /* vendor unknown */
  87. BFA_MFG_VPD_IBM = 1, /* vendor IBM */
  88. BFA_MFG_VPD_HP = 2, /* vendor HP */
  89. BFA_MFG_VPD_DELL = 3, /* vendor DELL */
  90. BFA_MFG_VPD_PCI_IBM = 0x08, /* PCI VPD IBM */
  91. BFA_MFG_VPD_PCI_HP = 0x10, /* PCI VPD HP */
  92. BFA_MFG_VPD_PCI_DELL = 0x20, /* PCI VPD DELL */
  93. BFA_MFG_VPD_PCI_BRCD = 0xf8, /* PCI VPD Brocade */
  94. };
  95. /*
  96. * All numerical fields are in big-endian format.
  97. */
  98. struct bfa_mfg_vpd_s {
  99. u8 version; /* vpd data version */
  100. u8 vpd_sig[3]; /* characters 'V', 'P', 'D' */
  101. u8 chksum; /* u8 checksum */
  102. u8 vendor; /* vendor */
  103. u8 len; /* vpd data length excluding header */
  104. u8 rsv;
  105. u8 data[BFA_MFG_VPD_LEN]; /* vpd data */
  106. };
  107. #pragma pack()
  108. /*
  109. * Status return values
  110. */
  111. enum bfa_status {
  112. BFA_STATUS_OK = 0, /* Success */
  113. BFA_STATUS_FAILED = 1, /* Operation failed */
  114. BFA_STATUS_EINVAL = 2, /* Invalid params Check input
  115. * parameters */
  116. BFA_STATUS_ENOMEM = 3, /* Out of resources */
  117. BFA_STATUS_ETIMER = 5, /* Timer expired - Retry, if persists,
  118. * contact support */
  119. BFA_STATUS_EPROTOCOL = 6, /* Protocol error */
  120. BFA_STATUS_SFP_UNSUPP = 10, /* Unsupported SFP - Replace SFP */
  121. BFA_STATUS_UNKNOWN_VFID = 11, /* VF_ID not found */
  122. BFA_STATUS_DATACORRUPTED = 12, /* Diag returned data corrupted */
  123. BFA_STATUS_DEVBUSY = 13, /* Device busy - Retry operation */
  124. BFA_STATUS_HDMA_FAILED = 16, /* Host dma failed contact support */
  125. BFA_STATUS_FLASH_BAD_LEN = 17, /* Flash bad length */
  126. BFA_STATUS_UNKNOWN_LWWN = 18, /* LPORT PWWN not found */
  127. BFA_STATUS_UNKNOWN_RWWN = 19, /* RPORT PWWN not found */
  128. BFA_STATUS_VPORT_EXISTS = 21, /* VPORT already exists */
  129. BFA_STATUS_VPORT_MAX = 22, /* Reached max VPORT supported limit */
  130. BFA_STATUS_UNSUPP_SPEED = 23, /* Invalid Speed Check speed setting */
  131. BFA_STATUS_INVLD_DFSZ = 24, /* Invalid Max data field size */
  132. BFA_STATUS_CMD_NOTSUPP = 26, /* Command/API not supported */
  133. BFA_STATUS_FABRIC_RJT = 29, /* Reject from attached fabric */
  134. BFA_STATUS_PORT_OFFLINE = 34, /* Port is not online */
  135. BFA_STATUS_VPORT_WWN_BP = 46, /* WWN is same as base port's WWN */
  136. BFA_STATUS_PORT_NOT_DISABLED = 47, /* Port not disabled disable port */
  137. BFA_STATUS_NO_FCPIM_NEXUS = 52, /* No FCP Nexus exists with the rport */
  138. BFA_STATUS_IOC_FAILURE = 56, /* IOC failure - Retry, if persists
  139. * contact support */
  140. BFA_STATUS_INVALID_WWN = 57, /* Invalid WWN */
  141. BFA_STATUS_ADAPTER_ENABLED = 60, /* Adapter is not disabled */
  142. BFA_STATUS_IOC_NON_OP = 61, /* IOC is not operational */
  143. BFA_STATUS_VERSION_FAIL = 70, /* Application/Driver version mismatch */
  144. BFA_STATUS_DIAG_BUSY = 71, /* diag busy */
  145. BFA_STATUS_BEACON_ON = 72, /* Port Beacon already on */
  146. BFA_STATUS_ENOFSAVE = 78, /* No saved firmware trace */
  147. BFA_STATUS_IOC_DISABLED = 82, /* IOC is already disabled */
  148. BFA_STATUS_NO_SFP_DEV = 89, /* No SFP device check or replace SFP */
  149. BFA_STATUS_MEMTEST_FAILED = 90, /* Memory test failed contact support */
  150. BFA_STATUS_LEDTEST_OP = 109, /* LED test is operating */
  151. BFA_STATUS_INVALID_MAC = 134, /* Invalid MAC address */
  152. BFA_STATUS_PBC = 154, /* Operation not allowed for pre-boot
  153. * configuration */
  154. BFA_STATUS_BAD_FWCFG = 156, /* Bad firmware configuration */
  155. BFA_STATUS_INVALID_VENDOR = 158, /* Invalid switch vendor */
  156. BFA_STATUS_SFP_NOT_READY = 159, /* SFP info is not ready. Retry */
  157. BFA_STATUS_TRUNK_ENABLED = 164, /* Trunk is already enabled on
  158. * this adapter */
  159. BFA_STATUS_TRUNK_DISABLED = 165, /* Trunking is disabled on
  160. * the adapter */
  161. BFA_STATUS_IOPROFILE_OFF = 175, /* IO profile OFF */
  162. BFA_STATUS_PHY_NOT_PRESENT = 183, /* PHY module not present */
  163. BFA_STATUS_FEATURE_NOT_SUPPORTED = 192, /* Feature not supported */
  164. BFA_STATUS_FAA_ENABLED = 197, /* FAA is already enabled */
  165. BFA_STATUS_FAA_DISABLED = 198, /* FAA is already disabled */
  166. BFA_STATUS_FAA_ACQUIRED = 199, /* FAA is already acquired */
  167. BFA_STATUS_FAA_ACQ_ADDR = 200, /* Acquiring addr */
  168. BFA_STATUS_ERROR_TRUNK_ENABLED = 203, /* Trunk enabled on adapter */
  169. BFA_STATUS_MAX_VAL /* Unknown error code */
  170. };
  171. #define bfa_status_t enum bfa_status
  172. enum bfa_eproto_status {
  173. BFA_EPROTO_BAD_ACCEPT = 0,
  174. BFA_EPROTO_UNKNOWN_RSP = 1
  175. };
  176. #define bfa_eproto_status_t enum bfa_eproto_status
  177. enum bfa_boolean {
  178. BFA_FALSE = 0,
  179. BFA_TRUE = 1
  180. };
  181. #define bfa_boolean_t enum bfa_boolean
  182. #define BFA_STRING_32 32
  183. #define BFA_VERSION_LEN 64
  184. /*
  185. * ---------------------- adapter definitions ------------
  186. */
  187. /*
  188. * BFA adapter level attributes.
  189. */
  190. enum {
  191. BFA_ADAPTER_SERIAL_NUM_LEN = STRSZ(BFA_MFG_SERIALNUM_SIZE),
  192. /*
  193. *!< adapter serial num length
  194. */
  195. BFA_ADAPTER_MODEL_NAME_LEN = 16, /* model name length */
  196. BFA_ADAPTER_MODEL_DESCR_LEN = 128, /* model description length */
  197. BFA_ADAPTER_MFG_NAME_LEN = 8, /* manufacturer name length */
  198. BFA_ADAPTER_SYM_NAME_LEN = 64, /* adapter symbolic name length */
  199. BFA_ADAPTER_OS_TYPE_LEN = 64, /* adapter os type length */
  200. };
  201. struct bfa_adapter_attr_s {
  202. char manufacturer[BFA_ADAPTER_MFG_NAME_LEN];
  203. char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN];
  204. u32 card_type;
  205. char model[BFA_ADAPTER_MODEL_NAME_LEN];
  206. char model_descr[BFA_ADAPTER_MODEL_DESCR_LEN];
  207. wwn_t pwwn;
  208. char node_symname[FC_SYMNAME_MAX];
  209. char hw_ver[BFA_VERSION_LEN];
  210. char fw_ver[BFA_VERSION_LEN];
  211. char optrom_ver[BFA_VERSION_LEN];
  212. char os_type[BFA_ADAPTER_OS_TYPE_LEN];
  213. struct bfa_mfg_vpd_s vpd;
  214. struct mac_s mac;
  215. u8 nports;
  216. u8 max_speed;
  217. u8 prototype;
  218. char asic_rev;
  219. u8 pcie_gen;
  220. u8 pcie_lanes_orig;
  221. u8 pcie_lanes;
  222. u8 cna_capable;
  223. u8 is_mezz;
  224. u8 trunk_capable;
  225. };
  226. /*
  227. * ---------------------- IOC definitions ------------
  228. */
  229. enum {
  230. BFA_IOC_DRIVER_LEN = 16,
  231. BFA_IOC_CHIP_REV_LEN = 8,
  232. };
  233. /*
  234. * Driver and firmware versions.
  235. */
  236. struct bfa_ioc_driver_attr_s {
  237. char driver[BFA_IOC_DRIVER_LEN]; /* driver name */
  238. char driver_ver[BFA_VERSION_LEN]; /* driver version */
  239. char fw_ver[BFA_VERSION_LEN]; /* firmware version */
  240. char bios_ver[BFA_VERSION_LEN]; /* bios version */
  241. char efi_ver[BFA_VERSION_LEN]; /* EFI version */
  242. char ob_ver[BFA_VERSION_LEN]; /* openboot version */
  243. };
  244. /*
  245. * IOC PCI device attributes
  246. */
  247. struct bfa_ioc_pci_attr_s {
  248. u16 vendor_id; /* PCI vendor ID */
  249. u16 device_id; /* PCI device ID */
  250. u16 ssid; /* subsystem ID */
  251. u16 ssvid; /* subsystem vendor ID */
  252. u32 pcifn; /* PCI device function */
  253. u32 rsvd; /* padding */
  254. char chip_rev[BFA_IOC_CHIP_REV_LEN]; /* chip revision */
  255. };
  256. /*
  257. * IOC states
  258. */
  259. enum bfa_ioc_state {
  260. BFA_IOC_UNINIT = 1, /* IOC is in uninit state */
  261. BFA_IOC_RESET = 2, /* IOC is in reset state */
  262. BFA_IOC_SEMWAIT = 3, /* Waiting for IOC h/w semaphore */
  263. BFA_IOC_HWINIT = 4, /* IOC h/w is being initialized */
  264. BFA_IOC_GETATTR = 5, /* IOC is being configured */
  265. BFA_IOC_OPERATIONAL = 6, /* IOC is operational */
  266. BFA_IOC_INITFAIL = 7, /* IOC hardware failure */
  267. BFA_IOC_FAIL = 8, /* IOC heart-beat failure */
  268. BFA_IOC_DISABLING = 9, /* IOC is being disabled */
  269. BFA_IOC_DISABLED = 10, /* IOC is disabled */
  270. BFA_IOC_FWMISMATCH = 11, /* IOC f/w different from drivers */
  271. BFA_IOC_ENABLING = 12, /* IOC is being enabled */
  272. BFA_IOC_HWFAIL = 13, /* PCI mapping doesn't exist */
  273. BFA_IOC_ACQ_ADDR = 14, /* Acquiring addr from fabric */
  274. };
  275. /*
  276. * IOC firmware stats
  277. */
  278. struct bfa_fw_ioc_stats_s {
  279. u32 enable_reqs;
  280. u32 disable_reqs;
  281. u32 get_attr_reqs;
  282. u32 dbg_sync;
  283. u32 dbg_dump;
  284. u32 unknown_reqs;
  285. };
  286. /*
  287. * IOC driver stats
  288. */
  289. struct bfa_ioc_drv_stats_s {
  290. u32 ioc_isrs;
  291. u32 ioc_enables;
  292. u32 ioc_disables;
  293. u32 ioc_hbfails;
  294. u32 ioc_boots;
  295. u32 stats_tmos;
  296. u32 hb_count;
  297. u32 disable_reqs;
  298. u32 enable_reqs;
  299. u32 disable_replies;
  300. u32 enable_replies;
  301. u32 rsvd;
  302. };
  303. /*
  304. * IOC statistics
  305. */
  306. struct bfa_ioc_stats_s {
  307. struct bfa_ioc_drv_stats_s drv_stats; /* driver IOC stats */
  308. struct bfa_fw_ioc_stats_s fw_stats; /* firmware IOC stats */
  309. };
  310. enum bfa_ioc_type_e {
  311. BFA_IOC_TYPE_FC = 1,
  312. BFA_IOC_TYPE_FCoE = 2,
  313. BFA_IOC_TYPE_LL = 3,
  314. };
  315. /*
  316. * IOC attributes returned in queries
  317. */
  318. struct bfa_ioc_attr_s {
  319. enum bfa_ioc_type_e ioc_type;
  320. enum bfa_ioc_state state; /* IOC state */
  321. struct bfa_adapter_attr_s adapter_attr; /* HBA attributes */
  322. struct bfa_ioc_driver_attr_s driver_attr; /* driver attr */
  323. struct bfa_ioc_pci_attr_s pci_attr;
  324. u8 port_id; /* port number */
  325. u8 port_mode; /* bfa_mode_s */
  326. u8 cap_bm; /* capability */
  327. u8 port_mode_cfg; /* bfa_mode_s */
  328. u8 rsvd[4]; /* 64bit align */
  329. };
  330. /*
  331. * AEN related definitions
  332. */
  333. enum bfa_aen_category {
  334. BFA_AEN_CAT_ADAPTER = 1,
  335. BFA_AEN_CAT_PORT = 2,
  336. BFA_AEN_CAT_LPORT = 3,
  337. BFA_AEN_CAT_RPORT = 4,
  338. BFA_AEN_CAT_ITNIM = 5,
  339. BFA_AEN_CAT_AUDIT = 8,
  340. BFA_AEN_CAT_IOC = 9,
  341. };
  342. /* BFA adapter level events */
  343. enum bfa_adapter_aen_event {
  344. BFA_ADAPTER_AEN_ADD = 1, /* New Adapter found event */
  345. BFA_ADAPTER_AEN_REMOVE = 2, /* Adapter removed event */
  346. };
  347. struct bfa_adapter_aen_data_s {
  348. char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN];
  349. u32 nports; /* Number of NPorts */
  350. wwn_t pwwn; /* WWN of one of its physical port */
  351. };
  352. /* BFA physical port Level events */
  353. enum bfa_port_aen_event {
  354. BFA_PORT_AEN_ONLINE = 1, /* Physical Port online event */
  355. BFA_PORT_AEN_OFFLINE = 2, /* Physical Port offline event */
  356. BFA_PORT_AEN_RLIR = 3, /* RLIR event, not supported */
  357. BFA_PORT_AEN_SFP_INSERT = 4, /* SFP inserted event */
  358. BFA_PORT_AEN_SFP_REMOVE = 5, /* SFP removed event */
  359. BFA_PORT_AEN_SFP_POM = 6, /* SFP POM event */
  360. BFA_PORT_AEN_ENABLE = 7, /* Physical Port enable event */
  361. BFA_PORT_AEN_DISABLE = 8, /* Physical Port disable event */
  362. BFA_PORT_AEN_AUTH_ON = 9, /* Physical Port auth success event */
  363. BFA_PORT_AEN_AUTH_OFF = 10, /* Physical Port auth fail event */
  364. BFA_PORT_AEN_DISCONNECT = 11, /* Physical Port disconnect event */
  365. BFA_PORT_AEN_QOS_NEG = 12, /* Base Port QOS negotiation event */
  366. BFA_PORT_AEN_FABRIC_NAME_CHANGE = 13, /* Fabric Name/WWN change */
  367. BFA_PORT_AEN_SFP_ACCESS_ERROR = 14, /* SFP read error event */
  368. BFA_PORT_AEN_SFP_UNSUPPORT = 15, /* Unsupported SFP event */
  369. };
  370. enum bfa_port_aen_sfp_pom {
  371. BFA_PORT_AEN_SFP_POM_GREEN = 1, /* Normal */
  372. BFA_PORT_AEN_SFP_POM_AMBER = 2, /* Warning */
  373. BFA_PORT_AEN_SFP_POM_RED = 3, /* Critical */
  374. BFA_PORT_AEN_SFP_POM_MAX = BFA_PORT_AEN_SFP_POM_RED
  375. };
  376. struct bfa_port_aen_data_s {
  377. wwn_t pwwn; /* WWN of the physical port */
  378. wwn_t fwwn; /* WWN of the fabric port */
  379. u32 phy_port_num; /* For SFP related events */
  380. u16 ioc_type;
  381. u16 level; /* Only transitions will be informed */
  382. mac_t mac; /* MAC address of the ethernet port */
  383. u16 rsvd;
  384. };
  385. /* BFA AEN logical port events */
  386. enum bfa_lport_aen_event {
  387. BFA_LPORT_AEN_NEW = 1, /* LPort created event */
  388. BFA_LPORT_AEN_DELETE = 2, /* LPort deleted event */
  389. BFA_LPORT_AEN_ONLINE = 3, /* LPort online event */
  390. BFA_LPORT_AEN_OFFLINE = 4, /* LPort offline event */
  391. BFA_LPORT_AEN_DISCONNECT = 5, /* LPort disconnect event */
  392. BFA_LPORT_AEN_NEW_PROP = 6, /* VPort created event */
  393. BFA_LPORT_AEN_DELETE_PROP = 7, /* VPort deleted event */
  394. BFA_LPORT_AEN_NEW_STANDARD = 8, /* VPort created event */
  395. BFA_LPORT_AEN_DELETE_STANDARD = 9, /* VPort deleted event */
  396. BFA_LPORT_AEN_NPIV_DUP_WWN = 10, /* VPort with duplicate WWN */
  397. BFA_LPORT_AEN_NPIV_FABRIC_MAX = 11, /* Max NPIV in fabric/fport */
  398. BFA_LPORT_AEN_NPIV_UNKNOWN = 12, /* Unknown NPIV Error code */
  399. };
  400. struct bfa_lport_aen_data_s {
  401. u16 vf_id; /* vf_id of this logical port */
  402. u16 roles; /* Logical port mode,IM/TM/IP etc */
  403. u32 rsvd;
  404. wwn_t ppwwn; /* WWN of its physical port */
  405. wwn_t lpwwn; /* WWN of this logical port */
  406. };
  407. /* BFA ITNIM events */
  408. enum bfa_itnim_aen_event {
  409. BFA_ITNIM_AEN_ONLINE = 1, /* Target online */
  410. BFA_ITNIM_AEN_OFFLINE = 2, /* Target offline */
  411. BFA_ITNIM_AEN_DISCONNECT = 3, /* Target disconnected */
  412. };
  413. struct bfa_itnim_aen_data_s {
  414. u16 vf_id; /* vf_id of the IT nexus */
  415. u16 rsvd[3];
  416. wwn_t ppwwn; /* WWN of its physical port */
  417. wwn_t lpwwn; /* WWN of logical port */
  418. wwn_t rpwwn; /* WWN of remote(target) port */
  419. };
  420. /* BFA audit events */
  421. enum bfa_audit_aen_event {
  422. BFA_AUDIT_AEN_AUTH_ENABLE = 1,
  423. BFA_AUDIT_AEN_AUTH_DISABLE = 2,
  424. BFA_AUDIT_AEN_FLASH_ERASE = 3,
  425. BFA_AUDIT_AEN_FLASH_UPDATE = 4,
  426. };
  427. struct bfa_audit_aen_data_s {
  428. wwn_t pwwn;
  429. int partition_inst;
  430. int partition_type;
  431. };
  432. /* BFA IOC level events */
  433. enum bfa_ioc_aen_event {
  434. BFA_IOC_AEN_HBGOOD = 1, /* Heart Beat restore event */
  435. BFA_IOC_AEN_HBFAIL = 2, /* Heart Beat failure event */
  436. BFA_IOC_AEN_ENABLE = 3, /* IOC enabled event */
  437. BFA_IOC_AEN_DISABLE = 4, /* IOC disabled event */
  438. BFA_IOC_AEN_FWMISMATCH = 5, /* IOC firmware mismatch */
  439. BFA_IOC_AEN_FWCFG_ERROR = 6, /* IOC firmware config error */
  440. BFA_IOC_AEN_INVALID_VENDOR = 7,
  441. BFA_IOC_AEN_INVALID_NWWN = 8, /* Zero NWWN */
  442. BFA_IOC_AEN_INVALID_PWWN = 9 /* Zero PWWN */
  443. };
  444. struct bfa_ioc_aen_data_s {
  445. wwn_t pwwn;
  446. u16 ioc_type;
  447. mac_t mac;
  448. };
  449. /*
  450. * ---------------------- mfg definitions ------------
  451. */
  452. /*
  453. * Checksum size
  454. */
  455. #define BFA_MFG_CHKSUM_SIZE 16
  456. #define BFA_MFG_PARTNUM_SIZE 14
  457. #define BFA_MFG_SUPPLIER_ID_SIZE 10
  458. #define BFA_MFG_SUPPLIER_PARTNUM_SIZE 20
  459. #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE 20
  460. #define BFA_MFG_SUPPLIER_REVISION_SIZE 4
  461. /*
  462. * Initial capability definition
  463. */
  464. #define BFA_MFG_IC_FC 0x01
  465. #define BFA_MFG_IC_ETH 0x02
  466. /*
  467. * Adapter capability mask definition
  468. */
  469. #define BFA_CM_HBA 0x01
  470. #define BFA_CM_CNA 0x02
  471. #define BFA_CM_NIC 0x04
  472. #define BFA_CM_FC16G 0x08
  473. #define BFA_CM_SRIOV 0x10
  474. #define BFA_CM_MEZZ 0x20
  475. #pragma pack(1)
  476. /*
  477. * All numerical fields are in big-endian format.
  478. */
  479. struct bfa_mfg_block_s {
  480. u8 version; /*!< manufacturing block version */
  481. u8 mfg_sig[3]; /*!< characters 'M', 'F', 'G' */
  482. u16 mfgsize; /*!< mfg block size */
  483. u16 u16_chksum; /*!< old u16 checksum */
  484. char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
  485. char brcd_partnum[STRSZ(BFA_MFG_PARTNUM_SIZE)];
  486. u8 mfg_day; /*!< manufacturing day */
  487. u8 mfg_month; /*!< manufacturing month */
  488. u16 mfg_year; /*!< manufacturing year */
  489. wwn_t mfg_wwn; /*!< wwn base for this adapter */
  490. u8 num_wwn; /*!< number of wwns assigned */
  491. u8 mfg_speeds; /*!< speeds allowed for this adapter */
  492. u8 rsv[2];
  493. char supplier_id[STRSZ(BFA_MFG_SUPPLIER_ID_SIZE)];
  494. char supplier_partnum[STRSZ(BFA_MFG_SUPPLIER_PARTNUM_SIZE)];
  495. char supplier_serialnum[STRSZ(BFA_MFG_SUPPLIER_SERIALNUM_SIZE)];
  496. char supplier_revision[STRSZ(BFA_MFG_SUPPLIER_REVISION_SIZE)];
  497. mac_t mfg_mac; /*!< base mac address */
  498. u8 num_mac; /*!< number of mac addresses */
  499. u8 rsv2;
  500. u32 card_type; /*!< card type */
  501. char cap_nic; /*!< capability nic */
  502. char cap_cna; /*!< capability cna */
  503. char cap_hba; /*!< capability hba */
  504. char cap_fc16g; /*!< capability fc 16g */
  505. char cap_sriov; /*!< capability sriov */
  506. char cap_mezz; /*!< capability mezz */
  507. u8 rsv3;
  508. u8 mfg_nports; /*!< number of ports */
  509. char media[8]; /*!< xfi/xaui */
  510. char initial_mode[8]; /*!< initial mode: hba/cna/nic */
  511. u8 rsv4[84];
  512. u8 md5_chksum[BFA_MFG_CHKSUM_SIZE]; /*!< md5 checksum */
  513. };
  514. #pragma pack()
  515. /*
  516. * ---------------------- pci definitions ------------
  517. */
  518. /*
  519. * PCI device and vendor ID information
  520. */
  521. enum {
  522. BFA_PCI_VENDOR_ID_BROCADE = 0x1657,
  523. BFA_PCI_DEVICE_ID_FC_8G2P = 0x13,
  524. BFA_PCI_DEVICE_ID_FC_8G1P = 0x17,
  525. BFA_PCI_DEVICE_ID_CT = 0x14,
  526. BFA_PCI_DEVICE_ID_CT_FC = 0x21,
  527. BFA_PCI_DEVICE_ID_CT2 = 0x22,
  528. };
  529. #define bfa_asic_id_cb(__d) \
  530. ((__d) == BFA_PCI_DEVICE_ID_FC_8G2P || \
  531. (__d) == BFA_PCI_DEVICE_ID_FC_8G1P)
  532. #define bfa_asic_id_ct(__d) \
  533. ((__d) == BFA_PCI_DEVICE_ID_CT || \
  534. (__d) == BFA_PCI_DEVICE_ID_CT_FC)
  535. #define bfa_asic_id_ct2(__d) ((__d) == BFA_PCI_DEVICE_ID_CT2)
  536. #define bfa_asic_id_ctc(__d) \
  537. (bfa_asic_id_ct(__d) || bfa_asic_id_ct2(__d))
  538. /*
  539. * PCI sub-system device and vendor ID information
  540. */
  541. enum {
  542. BFA_PCI_FCOE_SSDEVICE_ID = 0x14,
  543. BFA_PCI_CT2_SSID_FCoE = 0x22,
  544. BFA_PCI_CT2_SSID_ETH = 0x23,
  545. BFA_PCI_CT2_SSID_FC = 0x24,
  546. };
  547. /*
  548. * Maximum number of device address ranges mapped through different BAR(s)
  549. */
  550. #define BFA_PCI_ACCESS_RANGES 1
  551. /*
  552. * Port speed settings. Each specific speed is a bit field. Use multiple
  553. * bits to specify speeds to be selected for auto-negotiation.
  554. */
  555. enum bfa_port_speed {
  556. BFA_PORT_SPEED_UNKNOWN = 0,
  557. BFA_PORT_SPEED_1GBPS = 1,
  558. BFA_PORT_SPEED_2GBPS = 2,
  559. BFA_PORT_SPEED_4GBPS = 4,
  560. BFA_PORT_SPEED_8GBPS = 8,
  561. BFA_PORT_SPEED_10GBPS = 10,
  562. BFA_PORT_SPEED_16GBPS = 16,
  563. BFA_PORT_SPEED_AUTO = 0xf,
  564. };
  565. #define bfa_port_speed_t enum bfa_port_speed
  566. enum {
  567. BFA_BOOT_BOOTLUN_MAX = 4, /* maximum boot lun per IOC */
  568. BFA_PREBOOT_BOOTLUN_MAX = 8, /* maximum preboot lun per IOC */
  569. };
  570. #define BOOT_CFG_REV1 1
  571. #define BOOT_CFG_VLAN 1
  572. /*
  573. * Boot options setting. Boot options setting determines from where
  574. * to get the boot lun information
  575. */
  576. enum bfa_boot_bootopt {
  577. BFA_BOOT_AUTO_DISCOVER = 0, /* Boot from blun provided by fabric */
  578. BFA_BOOT_STORED_BLUN = 1, /* Boot from bluns stored in flash */
  579. BFA_BOOT_FIRST_LUN = 2, /* Boot from first discovered blun */
  580. BFA_BOOT_PBC = 3, /* Boot from pbc configured blun */
  581. };
  582. #pragma pack(1)
  583. /*
  584. * Boot lun information.
  585. */
  586. struct bfa_boot_bootlun_s {
  587. wwn_t pwwn; /* port wwn of target */
  588. struct scsi_lun lun; /* 64-bit lun */
  589. };
  590. #pragma pack()
  591. /*
  592. * BOOT boot configuraton
  593. */
  594. struct bfa_boot_pbc_s {
  595. u8 enable; /* enable/disable SAN boot */
  596. u8 speed; /* boot speed settings */
  597. u8 topology; /* boot topology setting */
  598. u8 rsvd1;
  599. u32 nbluns; /* number of boot luns */
  600. struct bfa_boot_bootlun_s pblun[BFA_PREBOOT_BOOTLUN_MAX];
  601. };
  602. /*
  603. * ASIC block configuration related structures
  604. */
  605. #define BFA_ABLK_MAX_PORTS 2
  606. #define BFA_ABLK_MAX_PFS 16
  607. #define BFA_ABLK_MAX 2
  608. #pragma pack(1)
  609. enum bfa_mode_s {
  610. BFA_MODE_HBA = 1,
  611. BFA_MODE_CNA = 2,
  612. BFA_MODE_NIC = 3
  613. };
  614. struct bfa_adapter_cfg_mode_s {
  615. u16 max_pf;
  616. u16 max_vf;
  617. enum bfa_mode_s mode;
  618. };
  619. struct bfa_ablk_cfg_pf_s {
  620. u16 pers;
  621. u8 port_id;
  622. u8 optrom;
  623. u8 valid;
  624. u8 sriov;
  625. u8 max_vfs;
  626. u8 rsvd[1];
  627. u16 num_qpairs;
  628. u16 num_vectors;
  629. u32 bw;
  630. };
  631. struct bfa_ablk_cfg_port_s {
  632. u8 mode;
  633. u8 type;
  634. u8 max_pfs;
  635. u8 rsvd[5];
  636. };
  637. struct bfa_ablk_cfg_inst_s {
  638. u8 nports;
  639. u8 max_pfs;
  640. u8 rsvd[6];
  641. struct bfa_ablk_cfg_pf_s pf_cfg[BFA_ABLK_MAX_PFS];
  642. struct bfa_ablk_cfg_port_s port_cfg[BFA_ABLK_MAX_PORTS];
  643. };
  644. struct bfa_ablk_cfg_s {
  645. struct bfa_ablk_cfg_inst_s inst[BFA_ABLK_MAX];
  646. };
  647. /*
  648. * SFP module specific
  649. */
  650. #define SFP_DIAGMON_SIZE 10 /* num bytes of diag monitor data */
  651. /* SFP state change notification event */
  652. #define BFA_SFP_SCN_REMOVED 0
  653. #define BFA_SFP_SCN_INSERTED 1
  654. #define BFA_SFP_SCN_POM 2
  655. #define BFA_SFP_SCN_FAILED 3
  656. #define BFA_SFP_SCN_UNSUPPORT 4
  657. #define BFA_SFP_SCN_VALID 5
  658. enum bfa_defs_sfp_media_e {
  659. BFA_SFP_MEDIA_UNKNOWN = 0x00,
  660. BFA_SFP_MEDIA_CU = 0x01,
  661. BFA_SFP_MEDIA_LW = 0x02,
  662. BFA_SFP_MEDIA_SW = 0x03,
  663. BFA_SFP_MEDIA_EL = 0x04,
  664. BFA_SFP_MEDIA_UNSUPPORT = 0x05,
  665. };
  666. /*
  667. * values for xmtr_tech above
  668. */
  669. enum {
  670. SFP_XMTR_TECH_CU = (1 << 0), /* copper FC-BaseT */
  671. SFP_XMTR_TECH_CP = (1 << 1), /* copper passive */
  672. SFP_XMTR_TECH_CA = (1 << 2), /* copper active */
  673. SFP_XMTR_TECH_LL = (1 << 3), /* longwave laser */
  674. SFP_XMTR_TECH_SL = (1 << 4), /* shortwave laser w/ OFC */
  675. SFP_XMTR_TECH_SN = (1 << 5), /* shortwave laser w/o OFC */
  676. SFP_XMTR_TECH_EL_INTRA = (1 << 6), /* elec intra-enclosure */
  677. SFP_XMTR_TECH_EL_INTER = (1 << 7), /* elec inter-enclosure */
  678. SFP_XMTR_TECH_LC = (1 << 8), /* longwave laser */
  679. SFP_XMTR_TECH_SA = (1 << 9)
  680. };
  681. /*
  682. * Serial ID: Data Fields -- Address A0h
  683. * Basic ID field total 64 bytes
  684. */
  685. struct sfp_srlid_base_s {
  686. u8 id; /* 00: Identifier */
  687. u8 extid; /* 01: Extended Identifier */
  688. u8 connector; /* 02: Connector */
  689. u8 xcvr[8]; /* 03-10: Transceiver */
  690. u8 encoding; /* 11: Encoding */
  691. u8 br_norm; /* 12: BR, Nominal */
  692. u8 rate_id; /* 13: Rate Identifier */
  693. u8 len_km; /* 14: Length single mode km */
  694. u8 len_100m; /* 15: Length single mode 100m */
  695. u8 len_om2; /* 16: Length om2 fiber 10m */
  696. u8 len_om1; /* 17: Length om1 fiber 10m */
  697. u8 len_cu; /* 18: Length copper 1m */
  698. u8 len_om3; /* 19: Length om3 fiber 10m */
  699. u8 vendor_name[16];/* 20-35 */
  700. u8 unalloc1;
  701. u8 vendor_oui[3]; /* 37-39 */
  702. u8 vendor_pn[16]; /* 40-55 */
  703. u8 vendor_rev[4]; /* 56-59 */
  704. u8 wavelen[2]; /* 60-61 */
  705. u8 unalloc2;
  706. u8 cc_base; /* 63: check code for base id field */
  707. };
  708. /*
  709. * Serial ID: Data Fields -- Address A0h
  710. * Extended id field total 32 bytes
  711. */
  712. struct sfp_srlid_ext_s {
  713. u8 options[2];
  714. u8 br_max;
  715. u8 br_min;
  716. u8 vendor_sn[16];
  717. u8 date_code[8];
  718. u8 diag_mon_type; /* 92: Diagnostic Monitoring type */
  719. u8 en_options;
  720. u8 sff_8472;
  721. u8 cc_ext;
  722. };
  723. /*
  724. * Diagnostic: Data Fields -- Address A2h
  725. * Diagnostic and control/status base field total 96 bytes
  726. */
  727. struct sfp_diag_base_s {
  728. /*
  729. * Alarm and warning Thresholds 40 bytes
  730. */
  731. u8 temp_high_alarm[2]; /* 00-01 */
  732. u8 temp_low_alarm[2]; /* 02-03 */
  733. u8 temp_high_warning[2]; /* 04-05 */
  734. u8 temp_low_warning[2]; /* 06-07 */
  735. u8 volt_high_alarm[2]; /* 08-09 */
  736. u8 volt_low_alarm[2]; /* 10-11 */
  737. u8 volt_high_warning[2]; /* 12-13 */
  738. u8 volt_low_warning[2]; /* 14-15 */
  739. u8 bias_high_alarm[2]; /* 16-17 */
  740. u8 bias_low_alarm[2]; /* 18-19 */
  741. u8 bias_high_warning[2]; /* 20-21 */
  742. u8 bias_low_warning[2]; /* 22-23 */
  743. u8 tx_pwr_high_alarm[2]; /* 24-25 */
  744. u8 tx_pwr_low_alarm[2]; /* 26-27 */
  745. u8 tx_pwr_high_warning[2]; /* 28-29 */
  746. u8 tx_pwr_low_warning[2]; /* 30-31 */
  747. u8 rx_pwr_high_alarm[2]; /* 32-33 */
  748. u8 rx_pwr_low_alarm[2]; /* 34-35 */
  749. u8 rx_pwr_high_warning[2]; /* 36-37 */
  750. u8 rx_pwr_low_warning[2]; /* 38-39 */
  751. u8 unallocate_1[16];
  752. /*
  753. * ext_cal_const[36]
  754. */
  755. u8 rx_pwr[20];
  756. u8 tx_i[4];
  757. u8 tx_pwr[4];
  758. u8 temp[4];
  759. u8 volt[4];
  760. u8 unallocate_2[3];
  761. u8 cc_dmi;
  762. };
  763. /*
  764. * Diagnostic: Data Fields -- Address A2h
  765. * Diagnostic and control/status extended field total 24 bytes
  766. */
  767. struct sfp_diag_ext_s {
  768. u8 diag[SFP_DIAGMON_SIZE];
  769. u8 unalloc1[4];
  770. u8 status_ctl;
  771. u8 rsvd;
  772. u8 alarm_flags[2];
  773. u8 unalloc2[2];
  774. u8 warning_flags[2];
  775. u8 ext_status_ctl[2];
  776. };
  777. struct sfp_mem_s {
  778. struct sfp_srlid_base_s srlid_base;
  779. struct sfp_srlid_ext_s srlid_ext;
  780. struct sfp_diag_base_s diag_base;
  781. struct sfp_diag_ext_s diag_ext;
  782. };
  783. /*
  784. * transceiver codes (SFF-8472 Rev 10.2 Table 3.5)
  785. */
  786. union sfp_xcvr_e10g_code_u {
  787. u8 b;
  788. struct {
  789. #ifdef __BIGENDIAN
  790. u8 e10g_unall:1; /* 10G Ethernet compliance */
  791. u8 e10g_lrm:1;
  792. u8 e10g_lr:1;
  793. u8 e10g_sr:1;
  794. u8 ib_sx:1; /* Infiniband compliance */
  795. u8 ib_lx:1;
  796. u8 ib_cu_a:1;
  797. u8 ib_cu_p:1;
  798. #else
  799. u8 ib_cu_p:1;
  800. u8 ib_cu_a:1;
  801. u8 ib_lx:1;
  802. u8 ib_sx:1; /* Infiniband compliance */
  803. u8 e10g_sr:1;
  804. u8 e10g_lr:1;
  805. u8 e10g_lrm:1;
  806. u8 e10g_unall:1; /* 10G Ethernet compliance */
  807. #endif
  808. } r;
  809. };
  810. union sfp_xcvr_so1_code_u {
  811. u8 b;
  812. struct {
  813. u8 escon:2; /* ESCON compliance code */
  814. u8 oc192_reach:1; /* SONET compliance code */
  815. u8 so_reach:2;
  816. u8 oc48_reach:3;
  817. } r;
  818. };
  819. union sfp_xcvr_so2_code_u {
  820. u8 b;
  821. struct {
  822. u8 reserved:1;
  823. u8 oc12_reach:3; /* OC12 reach */
  824. u8 reserved1:1;
  825. u8 oc3_reach:3; /* OC3 reach */
  826. } r;
  827. };
  828. union sfp_xcvr_eth_code_u {
  829. u8 b;
  830. struct {
  831. u8 base_px:1;
  832. u8 base_bx10:1;
  833. u8 e100base_fx:1;
  834. u8 e100base_lx:1;
  835. u8 e1000base_t:1;
  836. u8 e1000base_cx:1;
  837. u8 e1000base_lx:1;
  838. u8 e1000base_sx:1;
  839. } r;
  840. };
  841. struct sfp_xcvr_fc1_code_s {
  842. u8 link_len:5; /* FC link length */
  843. u8 xmtr_tech2:3;
  844. u8 xmtr_tech1:7; /* FC transmitter technology */
  845. u8 reserved1:1;
  846. };
  847. union sfp_xcvr_fc2_code_u {
  848. u8 b;
  849. struct {
  850. u8 tw_media:1; /* twin axial pair (tw) */
  851. u8 tp_media:1; /* shielded twisted pair (sp) */
  852. u8 mi_media:1; /* miniature coax (mi) */
  853. u8 tv_media:1; /* video coax (tv) */
  854. u8 m6_media:1; /* multimode, 62.5m (m6) */
  855. u8 m5_media:1; /* multimode, 50m (m5) */
  856. u8 reserved:1;
  857. u8 sm_media:1; /* single mode (sm) */
  858. } r;
  859. };
  860. union sfp_xcvr_fc3_code_u {
  861. u8 b;
  862. struct {
  863. #ifdef __BIGENDIAN
  864. u8 rsv4:1;
  865. u8 mb800:1; /* 800 Mbytes/sec */
  866. u8 mb1600:1; /* 1600 Mbytes/sec */
  867. u8 mb400:1; /* 400 Mbytes/sec */
  868. u8 rsv2:1;
  869. u8 mb200:1; /* 200 Mbytes/sec */
  870. u8 rsv1:1;
  871. u8 mb100:1; /* 100 Mbytes/sec */
  872. #else
  873. u8 mb100:1; /* 100 Mbytes/sec */
  874. u8 rsv1:1;
  875. u8 mb200:1; /* 200 Mbytes/sec */
  876. u8 rsv2:1;
  877. u8 mb400:1; /* 400 Mbytes/sec */
  878. u8 mb1600:1; /* 1600 Mbytes/sec */
  879. u8 mb800:1; /* 800 Mbytes/sec */
  880. u8 rsv4:1;
  881. #endif
  882. } r;
  883. };
  884. struct sfp_xcvr_s {
  885. union sfp_xcvr_e10g_code_u e10g;
  886. union sfp_xcvr_so1_code_u so1;
  887. union sfp_xcvr_so2_code_u so2;
  888. union sfp_xcvr_eth_code_u eth;
  889. struct sfp_xcvr_fc1_code_s fc1;
  890. union sfp_xcvr_fc2_code_u fc2;
  891. union sfp_xcvr_fc3_code_u fc3;
  892. };
  893. /*
  894. * Flash module specific
  895. */
  896. #define BFA_FLASH_PART_ENTRY_SIZE 32 /* partition entry size */
  897. #define BFA_FLASH_PART_MAX 32 /* maximal # of partitions */
  898. enum bfa_flash_part_type {
  899. BFA_FLASH_PART_OPTROM = 1, /* option rom partition */
  900. BFA_FLASH_PART_FWIMG = 2, /* firmware image partition */
  901. BFA_FLASH_PART_FWCFG = 3, /* firmware tuneable config */
  902. BFA_FLASH_PART_DRV = 4, /* IOC driver config */
  903. BFA_FLASH_PART_BOOT = 5, /* boot config */
  904. BFA_FLASH_PART_ASIC = 6, /* asic bootstrap configuration */
  905. BFA_FLASH_PART_MFG = 7, /* manufacturing block partition */
  906. BFA_FLASH_PART_OPTROM2 = 8, /* 2nd option rom partition */
  907. BFA_FLASH_PART_VPD = 9, /* vpd data of OEM info */
  908. BFA_FLASH_PART_PBC = 10, /* pre-boot config */
  909. BFA_FLASH_PART_BOOTOVL = 11, /* boot overlay partition */
  910. BFA_FLASH_PART_LOG = 12, /* firmware log partition */
  911. BFA_FLASH_PART_PXECFG = 13, /* pxe boot config partition */
  912. BFA_FLASH_PART_PXEOVL = 14, /* pxe boot overlay partition */
  913. BFA_FLASH_PART_PORTCFG = 15, /* port cfg partition */
  914. BFA_FLASH_PART_ASICBK = 16, /* asic backup partition */
  915. };
  916. /*
  917. * flash partition attributes
  918. */
  919. struct bfa_flash_part_attr_s {
  920. u32 part_type; /* partition type */
  921. u32 part_instance; /* partition instance */
  922. u32 part_off; /* partition offset */
  923. u32 part_size; /* partition size */
  924. u32 part_len; /* partition content length */
  925. u32 part_status; /* partition status */
  926. char rsv[BFA_FLASH_PART_ENTRY_SIZE - 24];
  927. };
  928. /*
  929. * flash attributes
  930. */
  931. struct bfa_flash_attr_s {
  932. u32 status; /* flash overall status */
  933. u32 npart; /* num of partitions */
  934. struct bfa_flash_part_attr_s part[BFA_FLASH_PART_MAX];
  935. };
  936. /*
  937. * DIAG module specific
  938. */
  939. #define LB_PATTERN_DEFAULT 0xB5B5B5B5
  940. #define QTEST_CNT_DEFAULT 10
  941. #define QTEST_PAT_DEFAULT LB_PATTERN_DEFAULT
  942. struct bfa_diag_memtest_s {
  943. u8 algo;
  944. u8 rsvd[7];
  945. };
  946. struct bfa_diag_memtest_result {
  947. u32 status;
  948. u32 addr;
  949. u32 exp; /* expect value read from reg */
  950. u32 act; /* actually value read */
  951. u32 err_status; /* error status reg */
  952. u32 err_status1; /* extra error info reg */
  953. u32 err_addr; /* error address reg */
  954. u8 algo;
  955. u8 rsv[3];
  956. };
  957. struct bfa_diag_loopback_result_s {
  958. u32 numtxmfrm; /* no. of transmit frame */
  959. u32 numosffrm; /* no. of outstanding frame */
  960. u32 numrcvfrm; /* no. of received good frame */
  961. u32 badfrminf; /* mis-match info */
  962. u32 badfrmnum; /* mis-match fram number */
  963. u8 status; /* loopback test result */
  964. u8 rsvd[3];
  965. };
  966. struct bfa_diag_ledtest_s {
  967. u32 cmd; /* bfa_led_op_t */
  968. u32 color; /* bfa_led_color_t */
  969. u16 freq; /* no. of blinks every 10 secs */
  970. u8 led; /* bitmap of LEDs to be tested */
  971. u8 rsvd[5];
  972. };
  973. struct bfa_diag_loopback_s {
  974. u32 loopcnt;
  975. u32 pattern;
  976. u8 lb_mode; /* bfa_port_opmode_t */
  977. u8 speed; /* bfa_port_speed_t */
  978. u8 rsvd[2];
  979. };
  980. /*
  981. * PHY module specific
  982. */
  983. enum bfa_phy_status_e {
  984. BFA_PHY_STATUS_GOOD = 0, /* phy is good */
  985. BFA_PHY_STATUS_NOT_PRESENT = 1, /* phy does not exist */
  986. BFA_PHY_STATUS_BAD = 2, /* phy is bad */
  987. };
  988. /*
  989. * phy attributes for phy query
  990. */
  991. struct bfa_phy_attr_s {
  992. u32 status; /* phy present/absent status */
  993. u32 length; /* firmware length */
  994. u32 fw_ver; /* firmware version */
  995. u32 an_status; /* AN status */
  996. u32 pma_pmd_status; /* PMA/PMD link status */
  997. u32 pma_pmd_signal; /* PMA/PMD signal detect */
  998. u32 pcs_status; /* PCS link status */
  999. };
  1000. /*
  1001. * phy stats
  1002. */
  1003. struct bfa_phy_stats_s {
  1004. u32 status; /* phy stats status */
  1005. u32 link_breaks; /* Num of link breaks after linkup */
  1006. u32 pma_pmd_fault; /* NPMA/PMD fault */
  1007. u32 pcs_fault; /* PCS fault */
  1008. u32 speed_neg; /* Num of speed negotiation */
  1009. u32 tx_eq_training; /* Num of TX EQ training */
  1010. u32 tx_eq_timeout; /* Num of TX EQ timeout */
  1011. u32 crc_error; /* Num of CRC errors */
  1012. };
  1013. #pragma pack()
  1014. #endif /* __BFA_DEFS_H__ */