bnx2x_hsi.h 111 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733
  1. /* bnx2x_hsi.h: Broadcom Everest network driver.
  2. *
  3. * Copyright (c) 2007-2011 Broadcom Corporation
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation.
  8. */
  9. #ifndef BNX2X_HSI_H
  10. #define BNX2X_HSI_H
  11. #include "bnx2x_fw_defs.h"
  12. #define FW_ENCODE_32BIT_PATTERN 0x1e1e1e1e
  13. struct license_key {
  14. u32 reserved[6];
  15. u32 max_iscsi_conn;
  16. #define BNX2X_MAX_ISCSI_TRGT_CONN_MASK 0xFFFF
  17. #define BNX2X_MAX_ISCSI_TRGT_CONN_SHIFT 0
  18. #define BNX2X_MAX_ISCSI_INIT_CONN_MASK 0xFFFF0000
  19. #define BNX2X_MAX_ISCSI_INIT_CONN_SHIFT 16
  20. u32 reserved_a;
  21. u32 max_fcoe_conn;
  22. #define BNX2X_MAX_FCOE_TRGT_CONN_MASK 0xFFFF
  23. #define BNX2X_MAX_FCOE_TRGT_CONN_SHIFT 0
  24. #define BNX2X_MAX_FCOE_INIT_CONN_MASK 0xFFFF0000
  25. #define BNX2X_MAX_FCOE_INIT_CONN_SHIFT 16
  26. u32 reserved_b[4];
  27. };
  28. #define PORT_0 0
  29. #define PORT_1 1
  30. #define PORT_MAX 2
  31. /****************************************************************************
  32. * Shared HW configuration *
  33. ****************************************************************************/
  34. struct shared_hw_cfg { /* NVRAM Offset */
  35. /* Up to 16 bytes of NULL-terminated string */
  36. u8 part_num[16]; /* 0x104 */
  37. u32 config; /* 0x114 */
  38. #define SHARED_HW_CFG_MDIO_VOLTAGE_MASK 0x00000001
  39. #define SHARED_HW_CFG_MDIO_VOLTAGE_SHIFT 0
  40. #define SHARED_HW_CFG_MDIO_VOLTAGE_1_2V 0x00000000
  41. #define SHARED_HW_CFG_MDIO_VOLTAGE_2_5V 0x00000001
  42. #define SHARED_HW_CFG_MCP_RST_ON_CORE_RST_EN 0x00000002
  43. #define SHARED_HW_CFG_PORT_SWAP 0x00000004
  44. #define SHARED_HW_CFG_BEACON_WOL_EN 0x00000008
  45. #define SHARED_HW_CFG_MFW_SELECT_MASK 0x00000700
  46. #define SHARED_HW_CFG_MFW_SELECT_SHIFT 8
  47. /* Whatever MFW found in NVM
  48. (if multiple found, priority order is: NC-SI, UMP, IPMI) */
  49. #define SHARED_HW_CFG_MFW_SELECT_DEFAULT 0x00000000
  50. #define SHARED_HW_CFG_MFW_SELECT_NC_SI 0x00000100
  51. #define SHARED_HW_CFG_MFW_SELECT_UMP 0x00000200
  52. #define SHARED_HW_CFG_MFW_SELECT_IPMI 0x00000300
  53. /* Use SPIO4 as an arbiter between: 0-NC_SI, 1-IPMI
  54. (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
  55. #define SHARED_HW_CFG_MFW_SELECT_SPIO4_NC_SI_IPMI 0x00000400
  56. /* Use SPIO4 as an arbiter between: 0-UMP, 1-IPMI
  57. (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
  58. #define SHARED_HW_CFG_MFW_SELECT_SPIO4_UMP_IPMI 0x00000500
  59. /* Use SPIO4 as an arbiter between: 0-NC-SI, 1-UMP
  60. (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
  61. #define SHARED_HW_CFG_MFW_SELECT_SPIO4_NC_SI_UMP 0x00000600
  62. #define SHARED_HW_CFG_LED_MODE_MASK 0x000f0000
  63. #define SHARED_HW_CFG_LED_MODE_SHIFT 16
  64. #define SHARED_HW_CFG_LED_MAC1 0x00000000
  65. #define SHARED_HW_CFG_LED_PHY1 0x00010000
  66. #define SHARED_HW_CFG_LED_PHY2 0x00020000
  67. #define SHARED_HW_CFG_LED_PHY3 0x00030000
  68. #define SHARED_HW_CFG_LED_MAC2 0x00040000
  69. #define SHARED_HW_CFG_LED_PHY4 0x00050000
  70. #define SHARED_HW_CFG_LED_PHY5 0x00060000
  71. #define SHARED_HW_CFG_LED_PHY6 0x00070000
  72. #define SHARED_HW_CFG_LED_MAC3 0x00080000
  73. #define SHARED_HW_CFG_LED_PHY7 0x00090000
  74. #define SHARED_HW_CFG_LED_PHY9 0x000a0000
  75. #define SHARED_HW_CFG_LED_PHY11 0x000b0000
  76. #define SHARED_HW_CFG_LED_MAC4 0x000c0000
  77. #define SHARED_HW_CFG_LED_PHY8 0x000d0000
  78. #define SHARED_HW_CFG_LED_EXTPHY1 0x000e0000
  79. #define SHARED_HW_CFG_AN_ENABLE_MASK 0x3f000000
  80. #define SHARED_HW_CFG_AN_ENABLE_SHIFT 24
  81. #define SHARED_HW_CFG_AN_ENABLE_CL37 0x01000000
  82. #define SHARED_HW_CFG_AN_ENABLE_CL73 0x02000000
  83. #define SHARED_HW_CFG_AN_ENABLE_BAM 0x04000000
  84. #define SHARED_HW_CFG_AN_ENABLE_PARALLEL_DETECTION 0x08000000
  85. #define SHARED_HW_CFG_AN_EN_SGMII_FIBER_AUTO_DETECT 0x10000000
  86. #define SHARED_HW_CFG_AN_ENABLE_REMOTE_PHY 0x20000000
  87. u32 config2; /* 0x118 */
  88. /* one time auto detect grace period (in sec) */
  89. #define SHARED_HW_CFG_GRACE_PERIOD_MASK 0x000000ff
  90. #define SHARED_HW_CFG_GRACE_PERIOD_SHIFT 0
  91. #define SHARED_HW_CFG_PCIE_GEN2_ENABLED 0x00000100
  92. /* The default value for the core clock is 250MHz and it is
  93. achieved by setting the clock change to 4 */
  94. #define SHARED_HW_CFG_CLOCK_CHANGE_MASK 0x00000e00
  95. #define SHARED_HW_CFG_CLOCK_CHANGE_SHIFT 9
  96. #define SHARED_HW_CFG_SMBUS_TIMING_100KHZ 0x00000000
  97. #define SHARED_HW_CFG_SMBUS_TIMING_400KHZ 0x00001000
  98. #define SHARED_HW_CFG_HIDE_PORT1 0x00002000
  99. /* The fan failure mechanism is usually related to the PHY type
  100. since the power consumption of the board is determined by the PHY.
  101. Currently, fan is required for most designs with SFX7101, BCM8727
  102. and BCM8481. If a fan is not required for a board which uses one
  103. of those PHYs, this field should be set to "Disabled". If a fan is
  104. required for a different PHY type, this option should be set to
  105. "Enabled".
  106. The fan failure indication is expected on
  107. SPIO5 */
  108. #define SHARED_HW_CFG_FAN_FAILURE_MASK 0x00180000
  109. #define SHARED_HW_CFG_FAN_FAILURE_SHIFT 19
  110. #define SHARED_HW_CFG_FAN_FAILURE_PHY_TYPE 0x00000000
  111. #define SHARED_HW_CFG_FAN_FAILURE_DISABLED 0x00080000
  112. #define SHARED_HW_CFG_FAN_FAILURE_ENABLED 0x00100000
  113. /* Set the MDC/MDIO access for the first external phy */
  114. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_MASK 0x1C000000
  115. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_SHIFT 26
  116. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_PHY_TYPE 0x00000000
  117. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_EMAC0 0x04000000
  118. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_EMAC1 0x08000000
  119. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_BOTH 0x0c000000
  120. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_SWAPPED 0x10000000
  121. /* Set the MDC/MDIO access for the second external phy */
  122. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_MASK 0xE0000000
  123. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_SHIFT 29
  124. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_PHY_TYPE 0x00000000
  125. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_EMAC0 0x20000000
  126. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_EMAC1 0x40000000
  127. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_BOTH 0x60000000
  128. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_SWAPPED 0x80000000
  129. u32 power_dissipated; /* 0x11c */
  130. #define SHARED_HW_CFG_POWER_DIS_CMN_MASK 0xff000000
  131. #define SHARED_HW_CFG_POWER_DIS_CMN_SHIFT 24
  132. #define SHARED_HW_CFG_POWER_MGNT_SCALE_MASK 0x00ff0000
  133. #define SHARED_HW_CFG_POWER_MGNT_SCALE_SHIFT 16
  134. #define SHARED_HW_CFG_POWER_MGNT_UNKNOWN_SCALE 0x00000000
  135. #define SHARED_HW_CFG_POWER_MGNT_DOT_1_WATT 0x00010000
  136. #define SHARED_HW_CFG_POWER_MGNT_DOT_01_WATT 0x00020000
  137. #define SHARED_HW_CFG_POWER_MGNT_DOT_001_WATT 0x00030000
  138. u32 ump_nc_si_config; /* 0x120 */
  139. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MASK 0x00000003
  140. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_SHIFT 0
  141. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MAC 0x00000000
  142. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_PHY 0x00000001
  143. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MII 0x00000000
  144. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_RMII 0x00000002
  145. #define SHARED_HW_CFG_UMP_NC_SI_NUM_DEVS_MASK 0x00000f00
  146. #define SHARED_HW_CFG_UMP_NC_SI_NUM_DEVS_SHIFT 8
  147. #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_MASK 0x00ff0000
  148. #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_SHIFT 16
  149. #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_NONE 0x00000000
  150. #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_BCM5221 0x00010000
  151. u32 board; /* 0x124 */
  152. #define SHARED_HW_CFG_BOARD_REV_MASK 0x00FF0000
  153. #define SHARED_HW_CFG_BOARD_REV_SHIFT 16
  154. #define SHARED_HW_CFG_BOARD_MAJOR_VER_MASK 0x0F000000
  155. #define SHARED_HW_CFG_BOARD_MAJOR_VER_SHIFT 24
  156. #define SHARED_HW_CFG_BOARD_MINOR_VER_MASK 0xF0000000
  157. #define SHARED_HW_CFG_BOARD_MINOR_VER_SHIFT 28
  158. u32 reserved; /* 0x128 */
  159. };
  160. /****************************************************************************
  161. * Port HW configuration *
  162. ****************************************************************************/
  163. struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */
  164. u32 pci_id;
  165. #define PORT_HW_CFG_PCI_VENDOR_ID_MASK 0xffff0000
  166. #define PORT_HW_CFG_PCI_DEVICE_ID_MASK 0x0000ffff
  167. u32 pci_sub_id;
  168. #define PORT_HW_CFG_PCI_SUBSYS_DEVICE_ID_MASK 0xffff0000
  169. #define PORT_HW_CFG_PCI_SUBSYS_VENDOR_ID_MASK 0x0000ffff
  170. u32 power_dissipated;
  171. #define PORT_HW_CFG_POWER_DIS_D3_MASK 0xff000000
  172. #define PORT_HW_CFG_POWER_DIS_D3_SHIFT 24
  173. #define PORT_HW_CFG_POWER_DIS_D2_MASK 0x00ff0000
  174. #define PORT_HW_CFG_POWER_DIS_D2_SHIFT 16
  175. #define PORT_HW_CFG_POWER_DIS_D1_MASK 0x0000ff00
  176. #define PORT_HW_CFG_POWER_DIS_D1_SHIFT 8
  177. #define PORT_HW_CFG_POWER_DIS_D0_MASK 0x000000ff
  178. #define PORT_HW_CFG_POWER_DIS_D0_SHIFT 0
  179. u32 power_consumed;
  180. #define PORT_HW_CFG_POWER_CONS_D3_MASK 0xff000000
  181. #define PORT_HW_CFG_POWER_CONS_D3_SHIFT 24
  182. #define PORT_HW_CFG_POWER_CONS_D2_MASK 0x00ff0000
  183. #define PORT_HW_CFG_POWER_CONS_D2_SHIFT 16
  184. #define PORT_HW_CFG_POWER_CONS_D1_MASK 0x0000ff00
  185. #define PORT_HW_CFG_POWER_CONS_D1_SHIFT 8
  186. #define PORT_HW_CFG_POWER_CONS_D0_MASK 0x000000ff
  187. #define PORT_HW_CFG_POWER_CONS_D0_SHIFT 0
  188. u32 mac_upper;
  189. #define PORT_HW_CFG_UPPERMAC_MASK 0x0000ffff
  190. #define PORT_HW_CFG_UPPERMAC_SHIFT 0
  191. u32 mac_lower;
  192. u32 iscsi_mac_upper; /* Upper 16 bits are always zeroes */
  193. u32 iscsi_mac_lower;
  194. u32 rdma_mac_upper; /* Upper 16 bits are always zeroes */
  195. u32 rdma_mac_lower;
  196. u32 serdes_config;
  197. #define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_MASK 0x0000FFFF
  198. #define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_SHIFT 0
  199. #define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_MASK 0xFFFF0000
  200. #define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_SHIFT 16
  201. u32 Reserved0[3]; /* 0x158 */
  202. /* Controls the TX laser of the SFP+ module */
  203. u32 sfp_ctrl; /* 0x164 */
  204. #define PORT_HW_CFG_TX_LASER_MASK 0x000000FF
  205. #define PORT_HW_CFG_TX_LASER_SHIFT 0
  206. #define PORT_HW_CFG_TX_LASER_MDIO 0x00000000
  207. #define PORT_HW_CFG_TX_LASER_GPIO0 0x00000001
  208. #define PORT_HW_CFG_TX_LASER_GPIO1 0x00000002
  209. #define PORT_HW_CFG_TX_LASER_GPIO2 0x00000003
  210. #define PORT_HW_CFG_TX_LASER_GPIO3 0x00000004
  211. /* Controls the fault module LED of the SFP+ */
  212. #define PORT_HW_CFG_FAULT_MODULE_LED_MASK 0x0000FF00
  213. #define PORT_HW_CFG_FAULT_MODULE_LED_SHIFT 8
  214. #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO0 0x00000000
  215. #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO1 0x00000100
  216. #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO2 0x00000200
  217. #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO3 0x00000300
  218. #define PORT_HW_CFG_FAULT_MODULE_LED_DISABLED 0x00000400
  219. u32 Reserved01[12]; /* 0x158 */
  220. /* for external PHY, or forced mode or during AN */
  221. u16 xgxs_config_rx[4]; /* 0x198 */
  222. u16 xgxs_config_tx[4]; /* 0x1A0 */
  223. u32 Reserved1[56]; /* 0x1A8 */
  224. u32 default_cfg; /* 0x288 */
  225. #define PORT_HW_CFG_GPIO0_CONFIG_MASK 0x00000003
  226. #define PORT_HW_CFG_GPIO0_CONFIG_SHIFT 0
  227. #define PORT_HW_CFG_GPIO0_CONFIG_NA 0x00000000
  228. #define PORT_HW_CFG_GPIO0_CONFIG_LOW 0x00000001
  229. #define PORT_HW_CFG_GPIO0_CONFIG_HIGH 0x00000002
  230. #define PORT_HW_CFG_GPIO0_CONFIG_INPUT 0x00000003
  231. #define PORT_HW_CFG_GPIO1_CONFIG_MASK 0x0000000C
  232. #define PORT_HW_CFG_GPIO1_CONFIG_SHIFT 2
  233. #define PORT_HW_CFG_GPIO1_CONFIG_NA 0x00000000
  234. #define PORT_HW_CFG_GPIO1_CONFIG_LOW 0x00000004
  235. #define PORT_HW_CFG_GPIO1_CONFIG_HIGH 0x00000008
  236. #define PORT_HW_CFG_GPIO1_CONFIG_INPUT 0x0000000c
  237. #define PORT_HW_CFG_GPIO2_CONFIG_MASK 0x00000030
  238. #define PORT_HW_CFG_GPIO2_CONFIG_SHIFT 4
  239. #define PORT_HW_CFG_GPIO2_CONFIG_NA 0x00000000
  240. #define PORT_HW_CFG_GPIO2_CONFIG_LOW 0x00000010
  241. #define PORT_HW_CFG_GPIO2_CONFIG_HIGH 0x00000020
  242. #define PORT_HW_CFG_GPIO2_CONFIG_INPUT 0x00000030
  243. #define PORT_HW_CFG_GPIO3_CONFIG_MASK 0x000000C0
  244. #define PORT_HW_CFG_GPIO3_CONFIG_SHIFT 6
  245. #define PORT_HW_CFG_GPIO3_CONFIG_NA 0x00000000
  246. #define PORT_HW_CFG_GPIO3_CONFIG_LOW 0x00000040
  247. #define PORT_HW_CFG_GPIO3_CONFIG_HIGH 0x00000080
  248. #define PORT_HW_CFG_GPIO3_CONFIG_INPUT 0x000000c0
  249. /*
  250. * When KR link is required to be set to force which is not
  251. * KR-compliant, this parameter determine what is the trigger for it.
  252. * When GPIO is selected, low input will force the speed. Currently
  253. * default speed is 1G. In the future, it may be widen to select the
  254. * forced speed in with another parameter. Note when force-1G is
  255. * enabled, it override option 56: Link Speed option.
  256. */
  257. #define PORT_HW_CFG_FORCE_KR_ENABLER_MASK 0x00000F00
  258. #define PORT_HW_CFG_FORCE_KR_ENABLER_SHIFT 8
  259. #define PORT_HW_CFG_FORCE_KR_ENABLER_NOT_FORCED 0x00000000
  260. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO0_P0 0x00000100
  261. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO1_P0 0x00000200
  262. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO2_P0 0x00000300
  263. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO3_P0 0x00000400
  264. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO0_P1 0x00000500
  265. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO1_P1 0x00000600
  266. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO2_P1 0x00000700
  267. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO3_P1 0x00000800
  268. #define PORT_HW_CFG_FORCE_KR_ENABLER_FORCED 0x00000900
  269. /* Enable to determine with which GPIO to reset the external phy */
  270. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_MASK 0x000F0000
  271. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_SHIFT 16
  272. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_PHY_TYPE 0x00000000
  273. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P0 0x00010000
  274. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P0 0x00020000
  275. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P0 0x00030000
  276. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P0 0x00040000
  277. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P1 0x00050000
  278. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P1 0x00060000
  279. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P1 0x00070000
  280. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P1 0x00080000
  281. /* Enable BAM on KR */
  282. #define PORT_HW_CFG_ENABLE_BAM_ON_KR_MASK 0x00100000
  283. #define PORT_HW_CFG_ENABLE_BAM_ON_KR_SHIFT 20
  284. #define PORT_HW_CFG_ENABLE_BAM_ON_KR_DISABLED 0x00000000
  285. #define PORT_HW_CFG_ENABLE_BAM_ON_KR_ENABLED 0x00100000
  286. /* Enable Common Mode Sense */
  287. #define PORT_HW_CFG_ENABLE_CMS_MASK 0x00200000
  288. #define PORT_HW_CFG_ENABLE_CMS_SHIFT 21
  289. #define PORT_HW_CFG_ENABLE_CMS_DISABLED 0x00000000
  290. #define PORT_HW_CFG_ENABLE_CMS_ENABLED 0x00200000
  291. u32 speed_capability_mask2; /* 0x28C */
  292. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_MASK 0x0000FFFF
  293. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_SHIFT 0
  294. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_10M_FULL 0x00000001
  295. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3__ 0x00000002
  296. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3___ 0x00000004
  297. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_100M_FULL 0x00000008
  298. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_1G 0x00000010
  299. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_2_DOT_5G 0x00000020
  300. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_10G 0x00000040
  301. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_12G 0x00000080
  302. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_12_DOT_5G 0x00000100
  303. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_13G 0x00000200
  304. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_15G 0x00000400
  305. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_16G 0x00000800
  306. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_MASK 0xFFFF0000
  307. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_SHIFT 16
  308. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_10M_FULL 0x00010000
  309. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0__ 0x00020000
  310. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0___ 0x00040000
  311. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_100M_FULL 0x00080000
  312. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_1G 0x00100000
  313. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_2_DOT_5G 0x00200000
  314. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_10G 0x00400000
  315. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_12G 0x00800000
  316. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_12_DOT_5G 0x01000000
  317. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_13G 0x02000000
  318. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_15G 0x04000000
  319. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_16G 0x08000000
  320. /* In the case where two media types (e.g. copper and fiber) are
  321. present and electrically active at the same time, PHY Selection
  322. will determine which of the two PHYs will be designated as the
  323. Active PHY and used for a connection to the network. */
  324. u32 multi_phy_config; /* 0x290 */
  325. #define PORT_HW_CFG_PHY_SELECTION_MASK 0x00000007
  326. #define PORT_HW_CFG_PHY_SELECTION_SHIFT 0
  327. #define PORT_HW_CFG_PHY_SELECTION_HARDWARE_DEFAULT 0x00000000
  328. #define PORT_HW_CFG_PHY_SELECTION_FIRST_PHY 0x00000001
  329. #define PORT_HW_CFG_PHY_SELECTION_SECOND_PHY 0x00000002
  330. #define PORT_HW_CFG_PHY_SELECTION_FIRST_PHY_PRIORITY 0x00000003
  331. #define PORT_HW_CFG_PHY_SELECTION_SECOND_PHY_PRIORITY 0x00000004
  332. /* When enabled, all second phy nvram parameters will be swapped
  333. with the first phy parameters */
  334. #define PORT_HW_CFG_PHY_SWAPPED_MASK 0x00000008
  335. #define PORT_HW_CFG_PHY_SWAPPED_SHIFT 3
  336. #define PORT_HW_CFG_PHY_SWAPPED_DISABLED 0x00000000
  337. #define PORT_HW_CFG_PHY_SWAPPED_ENABLED 0x00000008
  338. /* Address of the second external phy */
  339. u32 external_phy_config2; /* 0x294 */
  340. #define PORT_HW_CFG_XGXS_EXT_PHY2_ADDR_MASK 0x000000FF
  341. #define PORT_HW_CFG_XGXS_EXT_PHY2_ADDR_SHIFT 0
  342. /* The second XGXS external PHY type */
  343. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_MASK 0x0000FF00
  344. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_SHIFT 8
  345. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_DIRECT 0x00000000
  346. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8071 0x00000100
  347. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8072 0x00000200
  348. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8073 0x00000300
  349. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8705 0x00000400
  350. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8706 0x00000500
  351. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8726 0x00000600
  352. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8481 0x00000700
  353. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_SFX7101 0x00000800
  354. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8727 0x00000900
  355. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8727_NOC 0x00000a00
  356. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84823 0x00000b00
  357. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54640 0x00000c00
  358. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84833 0x00000d00
  359. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_FAILURE 0x0000fd00
  360. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_NOT_CONN 0x0000ff00
  361. /* 4 times 16 bits for all 4 lanes. For some external PHYs (such as
  362. 8706, 8726 and 8727) not all 4 values are needed. */
  363. u16 xgxs_config2_rx[4]; /* 0x296 */
  364. u16 xgxs_config2_tx[4]; /* 0x2A0 */
  365. u32 lane_config;
  366. #define PORT_HW_CFG_LANE_SWAP_CFG_MASK 0x0000ffff
  367. #define PORT_HW_CFG_LANE_SWAP_CFG_SHIFT 0
  368. #define PORT_HW_CFG_LANE_SWAP_CFG_TX_MASK 0x000000ff
  369. #define PORT_HW_CFG_LANE_SWAP_CFG_TX_SHIFT 0
  370. #define PORT_HW_CFG_LANE_SWAP_CFG_RX_MASK 0x0000ff00
  371. #define PORT_HW_CFG_LANE_SWAP_CFG_RX_SHIFT 8
  372. #define PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK 0x0000c000
  373. #define PORT_HW_CFG_LANE_SWAP_CFG_MASTER_SHIFT 14
  374. /* AN and forced */
  375. #define PORT_HW_CFG_LANE_SWAP_CFG_01230123 0x00001b1b
  376. /* forced only */
  377. #define PORT_HW_CFG_LANE_SWAP_CFG_01233210 0x00001be4
  378. /* forced only */
  379. #define PORT_HW_CFG_LANE_SWAP_CFG_31203120 0x0000d8d8
  380. /* forced only */
  381. #define PORT_HW_CFG_LANE_SWAP_CFG_32103210 0x0000e4e4
  382. /* Indicate whether to swap the external phy polarity */
  383. #define PORT_HW_CFG_SWAP_PHY_POLARITY_MASK 0x00010000
  384. #define PORT_HW_CFG_SWAP_PHY_POLARITY_DISABLED 0x00000000
  385. #define PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED 0x00010000
  386. u32 external_phy_config;
  387. #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK 0xff000000
  388. #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_SHIFT 24
  389. #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT 0x00000000
  390. #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_BCM5482 0x01000000
  391. #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_NOT_CONN 0xff000000
  392. #define PORT_HW_CFG_SERDES_EXT_PHY_ADDR_MASK 0x00ff0000
  393. #define PORT_HW_CFG_SERDES_EXT_PHY_ADDR_SHIFT 16
  394. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK 0x0000ff00
  395. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SHIFT 8
  396. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT 0x00000000
  397. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8071 0x00000100
  398. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072 0x00000200
  399. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073 0x00000300
  400. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705 0x00000400
  401. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706 0x00000500
  402. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726 0x00000600
  403. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481 0x00000700
  404. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101 0x00000800
  405. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727 0x00000900
  406. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727_NOC 0x00000a00
  407. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823 0x00000b00
  408. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833 0x00000d00
  409. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE 0x0000fd00
  410. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN 0x0000ff00
  411. #define PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK 0x000000ff
  412. #define PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT 0
  413. u32 speed_capability_mask;
  414. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_MASK 0xffff0000
  415. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_SHIFT 16
  416. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL 0x00010000
  417. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF 0x00020000
  418. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF 0x00040000
  419. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL 0x00080000
  420. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_1G 0x00100000
  421. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G 0x00200000
  422. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10G 0x00400000
  423. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_12G 0x00800000
  424. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_12_5G 0x01000000
  425. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_13G 0x02000000
  426. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_15G 0x04000000
  427. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_16G 0x08000000
  428. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_RESERVED 0xf0000000
  429. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_MASK 0x0000ffff
  430. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_SHIFT 0
  431. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10M_FULL 0x00000001
  432. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10M_HALF 0x00000002
  433. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_100M_HALF 0x00000004
  434. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_100M_FULL 0x00000008
  435. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_1G 0x00000010
  436. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_2_5G 0x00000020
  437. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10G 0x00000040
  438. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_12G 0x00000080
  439. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_12_5G 0x00000100
  440. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_13G 0x00000200
  441. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_15G 0x00000400
  442. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_16G 0x00000800
  443. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_RESERVED 0x0000f000
  444. u32 reserved[2];
  445. };
  446. /****************************************************************************
  447. * Shared Feature configuration *
  448. ****************************************************************************/
  449. struct shared_feat_cfg { /* NVRAM Offset */
  450. u32 config; /* 0x450 */
  451. #define SHARED_FEATURE_BMC_ECHO_MODE_EN 0x00000001
  452. /* Use the values from options 47 and 48 instead of the HW default
  453. values */
  454. #define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_DISABLED 0x00000000
  455. #define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_ENABLED 0x00000002
  456. #define SHARED_FEAT_CFG_FORCE_SF_MODE_MASK 0x00000700
  457. #define SHARED_FEAT_CFG_FORCE_SF_MODE_SHIFT 8
  458. #define SHARED_FEAT_CFG_FORCE_SF_MODE_MF_ALLOWED 0x00000000
  459. #define SHARED_FEAT_CFG_FORCE_SF_MODE_FORCED_SF 0x00000100
  460. #define SHARED_FEAT_CFG_FORCE_SF_MODE_SPIO4 0x00000200
  461. #define SHARED_FEAT_CFG_FORCE_SF_MODE_SWITCH_INDEPT 0x00000300
  462. };
  463. /****************************************************************************
  464. * Port Feature configuration *
  465. ****************************************************************************/
  466. struct port_feat_cfg { /* port 0: 0x454 port 1: 0x4c8 */
  467. u32 config;
  468. #define PORT_FEATURE_BAR1_SIZE_MASK 0x0000000f
  469. #define PORT_FEATURE_BAR1_SIZE_SHIFT 0
  470. #define PORT_FEATURE_BAR1_SIZE_DISABLED 0x00000000
  471. #define PORT_FEATURE_BAR1_SIZE_64K 0x00000001
  472. #define PORT_FEATURE_BAR1_SIZE_128K 0x00000002
  473. #define PORT_FEATURE_BAR1_SIZE_256K 0x00000003
  474. #define PORT_FEATURE_BAR1_SIZE_512K 0x00000004
  475. #define PORT_FEATURE_BAR1_SIZE_1M 0x00000005
  476. #define PORT_FEATURE_BAR1_SIZE_2M 0x00000006
  477. #define PORT_FEATURE_BAR1_SIZE_4M 0x00000007
  478. #define PORT_FEATURE_BAR1_SIZE_8M 0x00000008
  479. #define PORT_FEATURE_BAR1_SIZE_16M 0x00000009
  480. #define PORT_FEATURE_BAR1_SIZE_32M 0x0000000a
  481. #define PORT_FEATURE_BAR1_SIZE_64M 0x0000000b
  482. #define PORT_FEATURE_BAR1_SIZE_128M 0x0000000c
  483. #define PORT_FEATURE_BAR1_SIZE_256M 0x0000000d
  484. #define PORT_FEATURE_BAR1_SIZE_512M 0x0000000e
  485. #define PORT_FEATURE_BAR1_SIZE_1G 0x0000000f
  486. #define PORT_FEATURE_BAR2_SIZE_MASK 0x000000f0
  487. #define PORT_FEATURE_BAR2_SIZE_SHIFT 4
  488. #define PORT_FEATURE_BAR2_SIZE_DISABLED 0x00000000
  489. #define PORT_FEATURE_BAR2_SIZE_64K 0x00000010
  490. #define PORT_FEATURE_BAR2_SIZE_128K 0x00000020
  491. #define PORT_FEATURE_BAR2_SIZE_256K 0x00000030
  492. #define PORT_FEATURE_BAR2_SIZE_512K 0x00000040
  493. #define PORT_FEATURE_BAR2_SIZE_1M 0x00000050
  494. #define PORT_FEATURE_BAR2_SIZE_2M 0x00000060
  495. #define PORT_FEATURE_BAR2_SIZE_4M 0x00000070
  496. #define PORT_FEATURE_BAR2_SIZE_8M 0x00000080
  497. #define PORT_FEATURE_BAR2_SIZE_16M 0x00000090
  498. #define PORT_FEATURE_BAR2_SIZE_32M 0x000000a0
  499. #define PORT_FEATURE_BAR2_SIZE_64M 0x000000b0
  500. #define PORT_FEATURE_BAR2_SIZE_128M 0x000000c0
  501. #define PORT_FEATURE_BAR2_SIZE_256M 0x000000d0
  502. #define PORT_FEATURE_BAR2_SIZE_512M 0x000000e0
  503. #define PORT_FEATURE_BAR2_SIZE_1G 0x000000f0
  504. #define PORT_FEATURE_EN_SIZE_MASK 0x07000000
  505. #define PORT_FEATURE_EN_SIZE_SHIFT 24
  506. #define PORT_FEATURE_WOL_ENABLED 0x01000000
  507. #define PORT_FEATURE_MBA_ENABLED 0x02000000
  508. #define PORT_FEATURE_MFW_ENABLED 0x04000000
  509. /* Reserved bits: 28-29 */
  510. /* Check the optic vendor via i2c against a list of approved modules
  511. in a separate nvram image */
  512. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK 0xE0000000
  513. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_SHIFT 29
  514. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_NO_ENFORCEMENT 0x00000000
  515. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER 0x20000000
  516. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_WARNING_MSG 0x40000000
  517. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_POWER_DOWN 0x60000000
  518. u32 wol_config;
  519. /* Default is used when driver sets to "auto" mode */
  520. #define PORT_FEATURE_WOL_DEFAULT_MASK 0x00000003
  521. #define PORT_FEATURE_WOL_DEFAULT_SHIFT 0
  522. #define PORT_FEATURE_WOL_DEFAULT_DISABLE 0x00000000
  523. #define PORT_FEATURE_WOL_DEFAULT_MAGIC 0x00000001
  524. #define PORT_FEATURE_WOL_DEFAULT_ACPI 0x00000002
  525. #define PORT_FEATURE_WOL_DEFAULT_MAGIC_AND_ACPI 0x00000003
  526. #define PORT_FEATURE_WOL_RES_PAUSE_CAP 0x00000004
  527. #define PORT_FEATURE_WOL_RES_ASYM_PAUSE_CAP 0x00000008
  528. #define PORT_FEATURE_WOL_ACPI_UPON_MGMT 0x00000010
  529. u32 mba_config;
  530. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK 0x00000003
  531. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_SHIFT 0
  532. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_PXE 0x00000000
  533. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_RPL 0x00000001
  534. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_BOOTP 0x00000002
  535. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_ISCSIB 0x00000003
  536. #define PORT_FEATURE_MBA_RES_PAUSE_CAP 0x00000100
  537. #define PORT_FEATURE_MBA_RES_ASYM_PAUSE_CAP 0x00000200
  538. #define PORT_FEATURE_MBA_SETUP_PROMPT_ENABLE 0x00000400
  539. #define PORT_FEATURE_MBA_HOTKEY_CTRL_S 0x00000000
  540. #define PORT_FEATURE_MBA_HOTKEY_CTRL_B 0x00000800
  541. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_MASK 0x000ff000
  542. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_SHIFT 12
  543. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_DISABLED 0x00000000
  544. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_2K 0x00001000
  545. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_4K 0x00002000
  546. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_8K 0x00003000
  547. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_16K 0x00004000
  548. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_32K 0x00005000
  549. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_64K 0x00006000
  550. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_128K 0x00007000
  551. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_256K 0x00008000
  552. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_512K 0x00009000
  553. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_1M 0x0000a000
  554. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_2M 0x0000b000
  555. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_4M 0x0000c000
  556. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_8M 0x0000d000
  557. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_16M 0x0000e000
  558. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_32M 0x0000f000
  559. #define PORT_FEATURE_MBA_MSG_TIMEOUT_MASK 0x00f00000
  560. #define PORT_FEATURE_MBA_MSG_TIMEOUT_SHIFT 20
  561. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_MASK 0x03000000
  562. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_SHIFT 24
  563. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_AUTO 0x00000000
  564. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_BBS 0x01000000
  565. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_INT18H 0x02000000
  566. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_INT19H 0x03000000
  567. #define PORT_FEATURE_MBA_LINK_SPEED_MASK 0x3c000000
  568. #define PORT_FEATURE_MBA_LINK_SPEED_SHIFT 26
  569. #define PORT_FEATURE_MBA_LINK_SPEED_AUTO 0x00000000
  570. #define PORT_FEATURE_MBA_LINK_SPEED_10HD 0x04000000
  571. #define PORT_FEATURE_MBA_LINK_SPEED_10FD 0x08000000
  572. #define PORT_FEATURE_MBA_LINK_SPEED_100HD 0x0c000000
  573. #define PORT_FEATURE_MBA_LINK_SPEED_100FD 0x10000000
  574. #define PORT_FEATURE_MBA_LINK_SPEED_1GBPS 0x14000000
  575. #define PORT_FEATURE_MBA_LINK_SPEED_2_5GBPS 0x18000000
  576. #define PORT_FEATURE_MBA_LINK_SPEED_10GBPS_CX4 0x1c000000
  577. #define PORT_FEATURE_MBA_LINK_SPEED_10GBPS_KX4 0x20000000
  578. #define PORT_FEATURE_MBA_LINK_SPEED_10GBPS_KR 0x24000000
  579. #define PORT_FEATURE_MBA_LINK_SPEED_12GBPS 0x28000000
  580. #define PORT_FEATURE_MBA_LINK_SPEED_12_5GBPS 0x2c000000
  581. #define PORT_FEATURE_MBA_LINK_SPEED_13GBPS 0x30000000
  582. #define PORT_FEATURE_MBA_LINK_SPEED_15GBPS 0x34000000
  583. #define PORT_FEATURE_MBA_LINK_SPEED_16GBPS 0x38000000
  584. u32 bmc_config;
  585. #define PORT_FEATURE_BMC_LINK_OVERRIDE_DEFAULT 0x00000000
  586. #define PORT_FEATURE_BMC_LINK_OVERRIDE_EN 0x00000001
  587. u32 mba_vlan_cfg;
  588. #define PORT_FEATURE_MBA_VLAN_TAG_MASK 0x0000ffff
  589. #define PORT_FEATURE_MBA_VLAN_TAG_SHIFT 0
  590. #define PORT_FEATURE_MBA_VLAN_EN 0x00010000
  591. u32 resource_cfg;
  592. #define PORT_FEATURE_RESOURCE_CFG_VALID 0x00000001
  593. #define PORT_FEATURE_RESOURCE_CFG_DIAG 0x00000002
  594. #define PORT_FEATURE_RESOURCE_CFG_L2 0x00000004
  595. #define PORT_FEATURE_RESOURCE_CFG_ISCSI 0x00000008
  596. #define PORT_FEATURE_RESOURCE_CFG_RDMA 0x00000010
  597. u32 smbus_config;
  598. /* Obsolete */
  599. #define PORT_FEATURE_SMBUS_EN 0x00000001
  600. #define PORT_FEATURE_SMBUS_ADDR_MASK 0x000000fe
  601. #define PORT_FEATURE_SMBUS_ADDR_SHIFT 1
  602. u32 reserved1;
  603. u32 link_config; /* Used as HW defaults for the driver */
  604. #define PORT_FEATURE_CONNECTED_SWITCH_MASK 0x03000000
  605. #define PORT_FEATURE_CONNECTED_SWITCH_SHIFT 24
  606. /* (forced) low speed switch (< 10G) */
  607. #define PORT_FEATURE_CON_SWITCH_1G_SWITCH 0x00000000
  608. /* (forced) high speed switch (>= 10G) */
  609. #define PORT_FEATURE_CON_SWITCH_10G_SWITCH 0x01000000
  610. #define PORT_FEATURE_CON_SWITCH_AUTO_DETECT 0x02000000
  611. #define PORT_FEATURE_CON_SWITCH_ONE_TIME_DETECT 0x03000000
  612. #define PORT_FEATURE_LINK_SPEED_MASK 0x000f0000
  613. #define PORT_FEATURE_LINK_SPEED_SHIFT 16
  614. #define PORT_FEATURE_LINK_SPEED_AUTO 0x00000000
  615. #define PORT_FEATURE_LINK_SPEED_10M_FULL 0x00010000
  616. #define PORT_FEATURE_LINK_SPEED_10M_HALF 0x00020000
  617. #define PORT_FEATURE_LINK_SPEED_100M_HALF 0x00030000
  618. #define PORT_FEATURE_LINK_SPEED_100M_FULL 0x00040000
  619. #define PORT_FEATURE_LINK_SPEED_1G 0x00050000
  620. #define PORT_FEATURE_LINK_SPEED_2_5G 0x00060000
  621. #define PORT_FEATURE_LINK_SPEED_10G_CX4 0x00070000
  622. #define PORT_FEATURE_LINK_SPEED_10G_KX4 0x00080000
  623. #define PORT_FEATURE_LINK_SPEED_10G_KR 0x00090000
  624. #define PORT_FEATURE_LINK_SPEED_12G 0x000a0000
  625. #define PORT_FEATURE_LINK_SPEED_12_5G 0x000b0000
  626. #define PORT_FEATURE_LINK_SPEED_13G 0x000c0000
  627. #define PORT_FEATURE_LINK_SPEED_15G 0x000d0000
  628. #define PORT_FEATURE_LINK_SPEED_16G 0x000e0000
  629. #define PORT_FEATURE_FLOW_CONTROL_MASK 0x00000700
  630. #define PORT_FEATURE_FLOW_CONTROL_SHIFT 8
  631. #define PORT_FEATURE_FLOW_CONTROL_AUTO 0x00000000
  632. #define PORT_FEATURE_FLOW_CONTROL_TX 0x00000100
  633. #define PORT_FEATURE_FLOW_CONTROL_RX 0x00000200
  634. #define PORT_FEATURE_FLOW_CONTROL_BOTH 0x00000300
  635. #define PORT_FEATURE_FLOW_CONTROL_NONE 0x00000400
  636. /* The default for MCP link configuration,
  637. uses the same defines as link_config */
  638. u32 mfw_wol_link_cfg;
  639. /* The default for the driver of the second external phy,
  640. uses the same defines as link_config */
  641. u32 link_config2; /* 0x47C */
  642. /* The default for MCP of the second external phy,
  643. uses the same defines as link_config */
  644. u32 mfw_wol_link_cfg2; /* 0x480 */
  645. u32 Reserved2[17]; /* 0x484 */
  646. };
  647. /****************************************************************************
  648. * Device Information *
  649. ****************************************************************************/
  650. struct shm_dev_info { /* size */
  651. u32 bc_rev; /* 8 bits each: major, minor, build */ /* 4 */
  652. struct shared_hw_cfg shared_hw_config; /* 40 */
  653. struct port_hw_cfg port_hw_config[PORT_MAX]; /* 400*2=800 */
  654. struct shared_feat_cfg shared_feature_config; /* 4 */
  655. struct port_feat_cfg port_feature_config[PORT_MAX];/* 116*2=232 */
  656. };
  657. #define FUNC_0 0
  658. #define FUNC_1 1
  659. #define FUNC_2 2
  660. #define FUNC_3 3
  661. #define FUNC_4 4
  662. #define FUNC_5 5
  663. #define FUNC_6 6
  664. #define FUNC_7 7
  665. #define E1_FUNC_MAX 2
  666. #define E1H_FUNC_MAX 8
  667. #define E2_FUNC_MAX 4 /* per path */
  668. #define VN_0 0
  669. #define VN_1 1
  670. #define VN_2 2
  671. #define VN_3 3
  672. #define E1VN_MAX 1
  673. #define E1HVN_MAX 4
  674. #define E2_VF_MAX 64
  675. /* This value (in milliseconds) determines the frequency of the driver
  676. * issuing the PULSE message code. The firmware monitors this periodic
  677. * pulse to determine when to switch to an OS-absent mode. */
  678. #define DRV_PULSE_PERIOD_MS 250
  679. /* This value (in milliseconds) determines how long the driver should
  680. * wait for an acknowledgement from the firmware before timing out. Once
  681. * the firmware has timed out, the driver will assume there is no firmware
  682. * running and there won't be any firmware-driver synchronization during a
  683. * driver reset. */
  684. #define FW_ACK_TIME_OUT_MS 5000
  685. #define FW_ACK_POLL_TIME_MS 1
  686. #define FW_ACK_NUM_OF_POLL (FW_ACK_TIME_OUT_MS/FW_ACK_POLL_TIME_MS)
  687. /* LED Blink rate that will achieve ~15.9Hz */
  688. #define LED_BLINK_RATE_VAL 480
  689. /****************************************************************************
  690. * Driver <-> FW Mailbox *
  691. ****************************************************************************/
  692. struct drv_port_mb {
  693. u32 link_status;
  694. /* Driver should update this field on any link change event */
  695. #define LINK_STATUS_LINK_FLAG_MASK 0x00000001
  696. #define LINK_STATUS_LINK_UP 0x00000001
  697. #define LINK_STATUS_SPEED_AND_DUPLEX_MASK 0x0000001E
  698. #define LINK_STATUS_SPEED_AND_DUPLEX_AN_NOT_COMPLETE (0<<1)
  699. #define LINK_STATUS_SPEED_AND_DUPLEX_10THD (1<<1)
  700. #define LINK_STATUS_SPEED_AND_DUPLEX_10TFD (2<<1)
  701. #define LINK_STATUS_SPEED_AND_DUPLEX_100TXHD (3<<1)
  702. #define LINK_STATUS_SPEED_AND_DUPLEX_100T4 (4<<1)
  703. #define LINK_STATUS_SPEED_AND_DUPLEX_100TXFD (5<<1)
  704. #define LINK_STATUS_SPEED_AND_DUPLEX_1000THD (6<<1)
  705. #define LINK_STATUS_SPEED_AND_DUPLEX_1000TFD (7<<1)
  706. #define LINK_STATUS_SPEED_AND_DUPLEX_1000XFD (7<<1)
  707. #define LINK_STATUS_SPEED_AND_DUPLEX_2500THD (8<<1)
  708. #define LINK_STATUS_SPEED_AND_DUPLEX_2500TFD (9<<1)
  709. #define LINK_STATUS_SPEED_AND_DUPLEX_2500XFD (9<<1)
  710. #define LINK_STATUS_SPEED_AND_DUPLEX_10GTFD (10<<1)
  711. #define LINK_STATUS_SPEED_AND_DUPLEX_10GXFD (10<<1)
  712. #define LINK_STATUS_SPEED_AND_DUPLEX_12GTFD (11<<1)
  713. #define LINK_STATUS_SPEED_AND_DUPLEX_12GXFD (11<<1)
  714. #define LINK_STATUS_SPEED_AND_DUPLEX_12_5GTFD (12<<1)
  715. #define LINK_STATUS_SPEED_AND_DUPLEX_12_5GXFD (12<<1)
  716. #define LINK_STATUS_SPEED_AND_DUPLEX_13GTFD (13<<1)
  717. #define LINK_STATUS_SPEED_AND_DUPLEX_13GXFD (13<<1)
  718. #define LINK_STATUS_SPEED_AND_DUPLEX_15GTFD (14<<1)
  719. #define LINK_STATUS_SPEED_AND_DUPLEX_15GXFD (14<<1)
  720. #define LINK_STATUS_SPEED_AND_DUPLEX_16GTFD (15<<1)
  721. #define LINK_STATUS_SPEED_AND_DUPLEX_16GXFD (15<<1)
  722. #define LINK_STATUS_AUTO_NEGOTIATE_FLAG_MASK 0x00000020
  723. #define LINK_STATUS_AUTO_NEGOTIATE_ENABLED 0x00000020
  724. #define LINK_STATUS_AUTO_NEGOTIATE_COMPLETE 0x00000040
  725. #define LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK 0x00000080
  726. #define LINK_STATUS_PARALLEL_DETECTION_USED 0x00000080
  727. #define LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE 0x00000200
  728. #define LINK_STATUS_LINK_PARTNER_1000THD_CAPABLE 0x00000400
  729. #define LINK_STATUS_LINK_PARTNER_100T4_CAPABLE 0x00000800
  730. #define LINK_STATUS_LINK_PARTNER_100TXFD_CAPABLE 0x00001000
  731. #define LINK_STATUS_LINK_PARTNER_100TXHD_CAPABLE 0x00002000
  732. #define LINK_STATUS_LINK_PARTNER_10TFD_CAPABLE 0x00004000
  733. #define LINK_STATUS_LINK_PARTNER_10THD_CAPABLE 0x00008000
  734. #define LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK 0x00010000
  735. #define LINK_STATUS_TX_FLOW_CONTROL_ENABLED 0x00010000
  736. #define LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK 0x00020000
  737. #define LINK_STATUS_RX_FLOW_CONTROL_ENABLED 0x00020000
  738. #define LINK_STATUS_LINK_PARTNER_FLOW_CONTROL_MASK 0x000C0000
  739. #define LINK_STATUS_LINK_PARTNER_NOT_PAUSE_CAPABLE (0<<18)
  740. #define LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE (1<<18)
  741. #define LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE (2<<18)
  742. #define LINK_STATUS_LINK_PARTNER_BOTH_PAUSE (3<<18)
  743. #define LINK_STATUS_SERDES_LINK 0x00100000
  744. #define LINK_STATUS_LINK_PARTNER_2500XFD_CAPABLE 0x00200000
  745. #define LINK_STATUS_LINK_PARTNER_2500XHD_CAPABLE 0x00400000
  746. #define LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE 0x00800000
  747. #define LINK_STATUS_LINK_PARTNER_12GXFD_CAPABLE 0x01000000
  748. #define LINK_STATUS_LINK_PARTNER_12_5GXFD_CAPABLE 0x02000000
  749. #define LINK_STATUS_LINK_PARTNER_13GXFD_CAPABLE 0x04000000
  750. #define LINK_STATUS_LINK_PARTNER_15GXFD_CAPABLE 0x08000000
  751. #define LINK_STATUS_LINK_PARTNER_16GXFD_CAPABLE 0x10000000
  752. u32 port_stx;
  753. u32 stat_nig_timer;
  754. /* MCP firmware does not use this field */
  755. u32 ext_phy_fw_version;
  756. };
  757. struct drv_func_mb {
  758. u32 drv_mb_header;
  759. #define DRV_MSG_CODE_MASK 0xffff0000
  760. #define DRV_MSG_CODE_LOAD_REQ 0x10000000
  761. #define DRV_MSG_CODE_LOAD_DONE 0x11000000
  762. #define DRV_MSG_CODE_UNLOAD_REQ_WOL_EN 0x20000000
  763. #define DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS 0x20010000
  764. #define DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP 0x20020000
  765. #define DRV_MSG_CODE_UNLOAD_DONE 0x21000000
  766. #define DRV_MSG_CODE_DCC_OK 0x30000000
  767. #define DRV_MSG_CODE_DCC_FAILURE 0x31000000
  768. #define DRV_MSG_CODE_DIAG_ENTER_REQ 0x50000000
  769. #define DRV_MSG_CODE_DIAG_EXIT_REQ 0x60000000
  770. #define DRV_MSG_CODE_VALIDATE_KEY 0x70000000
  771. #define DRV_MSG_CODE_GET_CURR_KEY 0x80000000
  772. #define DRV_MSG_CODE_GET_UPGRADE_KEY 0x81000000
  773. #define DRV_MSG_CODE_GET_MANUF_KEY 0x82000000
  774. #define DRV_MSG_CODE_LOAD_L2B_PRAM 0x90000000
  775. /*
  776. * The optic module verification commands require bootcode
  777. * v5.0.6 or later
  778. */
  779. #define DRV_MSG_CODE_VRFY_FIRST_PHY_OPT_MDL 0xa0000000
  780. #define REQ_BC_VER_4_VRFY_FIRST_PHY_OPT_MDL 0x00050006
  781. /*
  782. * The specific optic module verification command requires bootcode
  783. * v5.2.12 or later
  784. */
  785. #define DRV_MSG_CODE_VRFY_SPECIFIC_PHY_OPT_MDL 0xa1000000
  786. #define REQ_BC_VER_4_VRFY_SPECIFIC_PHY_OPT_MDL 0x00050234
  787. #define DRV_MSG_CODE_DCBX_ADMIN_PMF_MSG 0xb0000000
  788. #define DRV_MSG_CODE_DCBX_PMF_DRV_OK 0xb2000000
  789. #define DRV_MSG_CODE_SET_MF_BW 0xe0000000
  790. #define REQ_BC_VER_4_SET_MF_BW 0x00060202
  791. #define DRV_MSG_CODE_SET_MF_BW_ACK 0xe1000000
  792. #define BIOS_MSG_CODE_LIC_CHALLENGE 0xff010000
  793. #define BIOS_MSG_CODE_LIC_RESPONSE 0xff020000
  794. #define BIOS_MSG_CODE_VIRT_MAC_PRIM 0xff030000
  795. #define BIOS_MSG_CODE_VIRT_MAC_ISCSI 0xff040000
  796. #define DRV_MSG_SEQ_NUMBER_MASK 0x0000ffff
  797. u32 drv_mb_param;
  798. u32 fw_mb_header;
  799. #define FW_MSG_CODE_MASK 0xffff0000
  800. #define FW_MSG_CODE_DRV_LOAD_COMMON 0x10100000
  801. #define FW_MSG_CODE_DRV_LOAD_PORT 0x10110000
  802. #define FW_MSG_CODE_DRV_LOAD_FUNCTION 0x10120000
  803. /* Load common chip is supported from bc 6.0.0 */
  804. #define REQ_BC_VER_4_DRV_LOAD_COMMON_CHIP 0x00060000
  805. #define FW_MSG_CODE_DRV_LOAD_COMMON_CHIP 0x10130000
  806. #define FW_MSG_CODE_DRV_LOAD_REFUSED 0x10200000
  807. #define FW_MSG_CODE_DRV_LOAD_DONE 0x11100000
  808. #define FW_MSG_CODE_DRV_UNLOAD_COMMON 0x20100000
  809. #define FW_MSG_CODE_DRV_UNLOAD_PORT 0x20110000
  810. #define FW_MSG_CODE_DRV_UNLOAD_FUNCTION 0x20120000
  811. #define FW_MSG_CODE_DRV_UNLOAD_DONE 0x21100000
  812. #define FW_MSG_CODE_DCC_DONE 0x30100000
  813. #define FW_MSG_CODE_DIAG_ENTER_DONE 0x50100000
  814. #define FW_MSG_CODE_DIAG_REFUSE 0x50200000
  815. #define FW_MSG_CODE_DIAG_EXIT_DONE 0x60100000
  816. #define FW_MSG_CODE_VALIDATE_KEY_SUCCESS 0x70100000
  817. #define FW_MSG_CODE_VALIDATE_KEY_FAILURE 0x70200000
  818. #define FW_MSG_CODE_GET_KEY_DONE 0x80100000
  819. #define FW_MSG_CODE_NO_KEY 0x80f00000
  820. #define FW_MSG_CODE_LIC_INFO_NOT_READY 0x80f80000
  821. #define FW_MSG_CODE_L2B_PRAM_LOADED 0x90100000
  822. #define FW_MSG_CODE_L2B_PRAM_T_LOAD_FAILURE 0x90210000
  823. #define FW_MSG_CODE_L2B_PRAM_C_LOAD_FAILURE 0x90220000
  824. #define FW_MSG_CODE_L2B_PRAM_X_LOAD_FAILURE 0x90230000
  825. #define FW_MSG_CODE_L2B_PRAM_U_LOAD_FAILURE 0x90240000
  826. #define FW_MSG_CODE_VRFY_OPT_MDL_SUCCESS 0xa0100000
  827. #define FW_MSG_CODE_VRFY_OPT_MDL_INVLD_IMG 0xa0200000
  828. #define FW_MSG_CODE_VRFY_OPT_MDL_UNAPPROVED 0xa0300000
  829. #define FW_MSG_CODE_LIC_CHALLENGE 0xff010000
  830. #define FW_MSG_CODE_LIC_RESPONSE 0xff020000
  831. #define FW_MSG_CODE_VIRT_MAC_PRIM 0xff030000
  832. #define FW_MSG_CODE_VIRT_MAC_ISCSI 0xff040000
  833. #define FW_MSG_SEQ_NUMBER_MASK 0x0000ffff
  834. u32 fw_mb_param;
  835. u32 drv_pulse_mb;
  836. #define DRV_PULSE_SEQ_MASK 0x00007fff
  837. #define DRV_PULSE_SYSTEM_TIME_MASK 0xffff0000
  838. /* The system time is in the format of
  839. * (year-2001)*12*32 + month*32 + day. */
  840. #define DRV_PULSE_ALWAYS_ALIVE 0x00008000
  841. /* Indicate to the firmware not to go into the
  842. * OS-absent when it is not getting driver pulse.
  843. * This is used for debugging as well for PXE(MBA). */
  844. u32 mcp_pulse_mb;
  845. #define MCP_PULSE_SEQ_MASK 0x00007fff
  846. #define MCP_PULSE_ALWAYS_ALIVE 0x00008000
  847. /* Indicates to the driver not to assert due to lack
  848. * of MCP response */
  849. #define MCP_EVENT_MASK 0xffff0000
  850. #define MCP_EVENT_OTHER_DRIVER_RESET_REQ 0x00010000
  851. u32 iscsi_boot_signature;
  852. u32 iscsi_boot_block_offset;
  853. u32 drv_status;
  854. #define DRV_STATUS_PMF 0x00000001
  855. #define DRV_STATUS_SET_MF_BW 0x00000004
  856. #define DRV_STATUS_DCC_EVENT_MASK 0x0000ff00
  857. #define DRV_STATUS_DCC_DISABLE_ENABLE_PF 0x00000100
  858. #define DRV_STATUS_DCC_BANDWIDTH_ALLOCATION 0x00000200
  859. #define DRV_STATUS_DCC_CHANGE_MAC_ADDRESS 0x00000400
  860. #define DRV_STATUS_DCC_RESERVED1 0x00000800
  861. #define DRV_STATUS_DCC_SET_PROTOCOL 0x00001000
  862. #define DRV_STATUS_DCC_SET_PRIORITY 0x00002000
  863. #define DRV_STATUS_DCBX_EVENT_MASK 0x000f0000
  864. #define DRV_STATUS_DCBX_NEGOTIATION_RESULTS 0x00010000
  865. u32 virt_mac_upper;
  866. #define VIRT_MAC_SIGN_MASK 0xffff0000
  867. #define VIRT_MAC_SIGNATURE 0x564d0000
  868. u32 virt_mac_lower;
  869. };
  870. /****************************************************************************
  871. * Management firmware state *
  872. ****************************************************************************/
  873. /* Allocate 440 bytes for management firmware */
  874. #define MGMTFW_STATE_WORD_SIZE 110
  875. struct mgmtfw_state {
  876. u32 opaque[MGMTFW_STATE_WORD_SIZE];
  877. };
  878. /****************************************************************************
  879. * Multi-Function configuration *
  880. ****************************************************************************/
  881. struct shared_mf_cfg {
  882. u32 clp_mb;
  883. #define SHARED_MF_CLP_SET_DEFAULT 0x00000000
  884. /* set by CLP */
  885. #define SHARED_MF_CLP_EXIT 0x00000001
  886. /* set by MCP */
  887. #define SHARED_MF_CLP_EXIT_DONE 0x00010000
  888. };
  889. struct port_mf_cfg {
  890. u32 dynamic_cfg; /* device control channel */
  891. #define PORT_MF_CFG_E1HOV_TAG_MASK 0x0000ffff
  892. #define PORT_MF_CFG_E1HOV_TAG_SHIFT 0
  893. #define PORT_MF_CFG_E1HOV_TAG_DEFAULT PORT_MF_CFG_E1HOV_TAG_MASK
  894. u32 reserved[3];
  895. };
  896. struct func_mf_cfg {
  897. u32 config;
  898. /* E/R/I/D */
  899. /* function 0 of each port cannot be hidden */
  900. #define FUNC_MF_CFG_FUNC_HIDE 0x00000001
  901. #define FUNC_MF_CFG_PROTOCOL_MASK 0x00000007
  902. #define FUNC_MF_CFG_PROTOCOL_ETHERNET 0x00000002
  903. #define FUNC_MF_CFG_PROTOCOL_ETHERNET_WITH_RDMA 0x00000004
  904. #define FUNC_MF_CFG_PROTOCOL_ISCSI 0x00000006
  905. #define FUNC_MF_CFG_PROTOCOL_DEFAULT\
  906. FUNC_MF_CFG_PROTOCOL_ETHERNET_WITH_RDMA
  907. #define FUNC_MF_CFG_FUNC_DISABLED 0x00000008
  908. /* PRI */
  909. /* 0 - low priority, 3 - high priority */
  910. #define FUNC_MF_CFG_TRANSMIT_PRIORITY_MASK 0x00000300
  911. #define FUNC_MF_CFG_TRANSMIT_PRIORITY_SHIFT 8
  912. #define FUNC_MF_CFG_TRANSMIT_PRIORITY_DEFAULT 0x00000000
  913. /* MINBW, MAXBW */
  914. /* value range - 0..100, increments in 100Mbps */
  915. #define FUNC_MF_CFG_MIN_BW_MASK 0x00ff0000
  916. #define FUNC_MF_CFG_MIN_BW_SHIFT 16
  917. #define FUNC_MF_CFG_MIN_BW_DEFAULT 0x00000000
  918. #define FUNC_MF_CFG_MAX_BW_MASK 0xff000000
  919. #define FUNC_MF_CFG_MAX_BW_SHIFT 24
  920. #define FUNC_MF_CFG_MAX_BW_DEFAULT 0x64000000
  921. u32 mac_upper; /* MAC */
  922. #define FUNC_MF_CFG_UPPERMAC_MASK 0x0000ffff
  923. #define FUNC_MF_CFG_UPPERMAC_SHIFT 0
  924. #define FUNC_MF_CFG_UPPERMAC_DEFAULT FUNC_MF_CFG_UPPERMAC_MASK
  925. u32 mac_lower;
  926. #define FUNC_MF_CFG_LOWERMAC_DEFAULT 0xffffffff
  927. u32 e1hov_tag; /* VNI */
  928. #define FUNC_MF_CFG_E1HOV_TAG_MASK 0x0000ffff
  929. #define FUNC_MF_CFG_E1HOV_TAG_SHIFT 0
  930. #define FUNC_MF_CFG_E1HOV_TAG_DEFAULT FUNC_MF_CFG_E1HOV_TAG_MASK
  931. u32 reserved[2];
  932. };
  933. /* This structure is not applicable and should not be accessed on 57711 */
  934. struct func_ext_cfg {
  935. u32 func_cfg;
  936. #define MACP_FUNC_CFG_FLAGS_MASK 0x000000FF
  937. #define MACP_FUNC_CFG_FLAGS_SHIFT 0
  938. #define MACP_FUNC_CFG_FLAGS_ENABLED 0x00000001
  939. #define MACP_FUNC_CFG_FLAGS_ETHERNET 0x00000002
  940. #define MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD 0x00000004
  941. #define MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD 0x00000008
  942. u32 iscsi_mac_addr_upper;
  943. u32 iscsi_mac_addr_lower;
  944. u32 fcoe_mac_addr_upper;
  945. u32 fcoe_mac_addr_lower;
  946. u32 fcoe_wwn_port_name_upper;
  947. u32 fcoe_wwn_port_name_lower;
  948. u32 fcoe_wwn_node_name_upper;
  949. u32 fcoe_wwn_node_name_lower;
  950. u32 preserve_data;
  951. #define MF_FUNC_CFG_PRESERVE_L2_MAC (1<<0)
  952. #define MF_FUNC_CFG_PRESERVE_ISCSI_MAC (1<<1)
  953. #define MF_FUNC_CFG_PRESERVE_FCOE_MAC (1<<2)
  954. #define MF_FUNC_CFG_PRESERVE_FCOE_WWN_P (1<<3)
  955. #define MF_FUNC_CFG_PRESERVE_FCOE_WWN_N (1<<4)
  956. };
  957. struct mf_cfg {
  958. struct shared_mf_cfg shared_mf_config;
  959. struct port_mf_cfg port_mf_config[PORT_MAX];
  960. struct func_mf_cfg func_mf_config[E1H_FUNC_MAX];
  961. struct func_ext_cfg func_ext_config[E1H_FUNC_MAX];
  962. };
  963. /****************************************************************************
  964. * Shared Memory Region *
  965. ****************************************************************************/
  966. struct shmem_region { /* SharedMem Offset (size) */
  967. u32 validity_map[PORT_MAX]; /* 0x0 (4*2 = 0x8) */
  968. #define SHR_MEM_FORMAT_REV_ID ('A'<<24)
  969. #define SHR_MEM_FORMAT_REV_MASK 0xff000000
  970. /* validity bits */
  971. #define SHR_MEM_VALIDITY_PCI_CFG 0x00100000
  972. #define SHR_MEM_VALIDITY_MB 0x00200000
  973. #define SHR_MEM_VALIDITY_DEV_INFO 0x00400000
  974. #define SHR_MEM_VALIDITY_RESERVED 0x00000007
  975. /* One licensing bit should be set */
  976. #define SHR_MEM_VALIDITY_LIC_KEY_IN_EFFECT_MASK 0x00000038
  977. #define SHR_MEM_VALIDITY_LIC_MANUF_KEY_IN_EFFECT 0x00000008
  978. #define SHR_MEM_VALIDITY_LIC_UPGRADE_KEY_IN_EFFECT 0x00000010
  979. #define SHR_MEM_VALIDITY_LIC_NO_KEY_IN_EFFECT 0x00000020
  980. /* Active MFW */
  981. #define SHR_MEM_VALIDITY_ACTIVE_MFW_UNKNOWN 0x00000000
  982. #define SHR_MEM_VALIDITY_ACTIVE_MFW_IPMI 0x00000040
  983. #define SHR_MEM_VALIDITY_ACTIVE_MFW_UMP 0x00000080
  984. #define SHR_MEM_VALIDITY_ACTIVE_MFW_NCSI 0x000000c0
  985. #define SHR_MEM_VALIDITY_ACTIVE_MFW_NONE 0x000001c0
  986. #define SHR_MEM_VALIDITY_ACTIVE_MFW_MASK 0x000001c0
  987. struct shm_dev_info dev_info; /* 0x8 (0x438) */
  988. struct license_key drv_lic_key[PORT_MAX]; /* 0x440 (52*2=0x68) */
  989. /* FW information (for internal FW use) */
  990. u32 fw_info_fio_offset; /* 0x4a8 (0x4) */
  991. struct mgmtfw_state mgmtfw_state; /* 0x4ac (0x1b8) */
  992. struct drv_port_mb port_mb[PORT_MAX]; /* 0x664 (16*2=0x20) */
  993. struct drv_func_mb func_mb[]; /* 0x684
  994. (44*2/4/8=0x58/0xb0/0x160) */
  995. }; /* 57710 = 0x6dc | 57711 = 0x7E4 | 57712 = 0x734 */
  996. struct fw_flr_ack {
  997. u32 pf_ack;
  998. u32 vf_ack[1];
  999. u32 iov_dis_ack;
  1000. };
  1001. struct fw_flr_mb {
  1002. u32 aggint;
  1003. u32 opgen_addr;
  1004. struct fw_flr_ack ack;
  1005. };
  1006. /**** SUPPORT FOR SHMEM ARRRAYS ***
  1007. * The SHMEM HSI is aligned on 32 bit boundaries which makes it difficult to
  1008. * define arrays with storage types smaller then unsigned dwords.
  1009. * The macros below add generic support for SHMEM arrays with numeric elements
  1010. * that can span 2,4,8 or 16 bits. The array underlying type is a 32 bit dword
  1011. * array with individual bit-filed elements accessed using shifts and masks.
  1012. *
  1013. */
  1014. /* eb is the bitwidth of a single element */
  1015. #define SHMEM_ARRAY_MASK(eb) ((1<<(eb))-1)
  1016. #define SHMEM_ARRAY_ENTRY(i, eb) ((i)/(32/(eb)))
  1017. /* the bit-position macro allows the used to flip the order of the arrays
  1018. * elements on a per byte or word boundary.
  1019. *
  1020. * example: an array with 8 entries each 4 bit wide. This array will fit into
  1021. * a single dword. The diagrmas below show the array order of the nibbles.
  1022. *
  1023. * SHMEM_ARRAY_BITPOS(i, 4, 4) defines the stadard ordering:
  1024. *
  1025. * | | | |
  1026. * 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
  1027. * | | | |
  1028. *
  1029. * SHMEM_ARRAY_BITPOS(i, 4, 8) defines a flip ordering per byte:
  1030. *
  1031. * | | | |
  1032. * 1 | 0 | 3 | 2 | 5 | 4 | 7 | 6 |
  1033. * | | | |
  1034. *
  1035. * SHMEM_ARRAY_BITPOS(i, 4, 16) defines a flip ordering per word:
  1036. *
  1037. * | | | |
  1038. * 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 |
  1039. * | | | |
  1040. */
  1041. #define SHMEM_ARRAY_BITPOS(i, eb, fb) \
  1042. ((((32/(fb)) - 1 - ((i)/((fb)/(eb))) % (32/(fb))) * (fb)) + \
  1043. (((i)%((fb)/(eb))) * (eb)))
  1044. #define SHMEM_ARRAY_GET(a, i, eb, fb) \
  1045. ((a[SHMEM_ARRAY_ENTRY(i, eb)] >> SHMEM_ARRAY_BITPOS(i, eb, fb)) & \
  1046. SHMEM_ARRAY_MASK(eb))
  1047. #define SHMEM_ARRAY_SET(a, i, eb, fb, val) \
  1048. do { \
  1049. a[SHMEM_ARRAY_ENTRY(i, eb)] &= ~(SHMEM_ARRAY_MASK(eb) << \
  1050. SHMEM_ARRAY_BITPOS(i, eb, fb)); \
  1051. a[SHMEM_ARRAY_ENTRY(i, eb)] |= (((val) & SHMEM_ARRAY_MASK(eb)) << \
  1052. SHMEM_ARRAY_BITPOS(i, eb, fb)); \
  1053. } while (0)
  1054. /****START OF DCBX STRUCTURES DECLARATIONS****/
  1055. #define DCBX_MAX_NUM_PRI_PG_ENTRIES 8
  1056. #define DCBX_PRI_PG_BITWIDTH 4
  1057. #define DCBX_PRI_PG_FBITS 8
  1058. #define DCBX_PRI_PG_GET(a, i) \
  1059. SHMEM_ARRAY_GET(a, i, DCBX_PRI_PG_BITWIDTH, DCBX_PRI_PG_FBITS)
  1060. #define DCBX_PRI_PG_SET(a, i, val) \
  1061. SHMEM_ARRAY_SET(a, i, DCBX_PRI_PG_BITWIDTH, DCBX_PRI_PG_FBITS, val)
  1062. #define DCBX_MAX_NUM_PG_BW_ENTRIES 8
  1063. #define DCBX_BW_PG_BITWIDTH 8
  1064. #define DCBX_PG_BW_GET(a, i) \
  1065. SHMEM_ARRAY_GET(a, i, DCBX_BW_PG_BITWIDTH, DCBX_BW_PG_BITWIDTH)
  1066. #define DCBX_PG_BW_SET(a, i, val) \
  1067. SHMEM_ARRAY_SET(a, i, DCBX_BW_PG_BITWIDTH, DCBX_BW_PG_BITWIDTH, val)
  1068. #define DCBX_STRICT_PRI_PG 15
  1069. #define DCBX_MAX_APP_PROTOCOL 16
  1070. #define FCOE_APP_IDX 0
  1071. #define ISCSI_APP_IDX 1
  1072. #define PREDEFINED_APP_IDX_MAX 2
  1073. struct dcbx_ets_feature {
  1074. u32 enabled;
  1075. u32 pg_bw_tbl[2];
  1076. u32 pri_pg_tbl[1];
  1077. };
  1078. struct dcbx_pfc_feature {
  1079. #ifdef __BIG_ENDIAN
  1080. u8 pri_en_bitmap;
  1081. #define DCBX_PFC_PRI_0 0x01
  1082. #define DCBX_PFC_PRI_1 0x02
  1083. #define DCBX_PFC_PRI_2 0x04
  1084. #define DCBX_PFC_PRI_3 0x08
  1085. #define DCBX_PFC_PRI_4 0x10
  1086. #define DCBX_PFC_PRI_5 0x20
  1087. #define DCBX_PFC_PRI_6 0x40
  1088. #define DCBX_PFC_PRI_7 0x80
  1089. u8 pfc_caps;
  1090. u8 reserved;
  1091. u8 enabled;
  1092. #elif defined(__LITTLE_ENDIAN)
  1093. u8 enabled;
  1094. u8 reserved;
  1095. u8 pfc_caps;
  1096. u8 pri_en_bitmap;
  1097. #define DCBX_PFC_PRI_0 0x01
  1098. #define DCBX_PFC_PRI_1 0x02
  1099. #define DCBX_PFC_PRI_2 0x04
  1100. #define DCBX_PFC_PRI_3 0x08
  1101. #define DCBX_PFC_PRI_4 0x10
  1102. #define DCBX_PFC_PRI_5 0x20
  1103. #define DCBX_PFC_PRI_6 0x40
  1104. #define DCBX_PFC_PRI_7 0x80
  1105. #endif
  1106. };
  1107. struct dcbx_app_priority_entry {
  1108. #ifdef __BIG_ENDIAN
  1109. u16 app_id;
  1110. u8 pri_bitmap;
  1111. u8 appBitfield;
  1112. #define DCBX_APP_ENTRY_VALID 0x01
  1113. #define DCBX_APP_ENTRY_SF_MASK 0x30
  1114. #define DCBX_APP_ENTRY_SF_SHIFT 4
  1115. #define DCBX_APP_SF_ETH_TYPE 0x10
  1116. #define DCBX_APP_SF_PORT 0x20
  1117. #elif defined(__LITTLE_ENDIAN)
  1118. u8 appBitfield;
  1119. #define DCBX_APP_ENTRY_VALID 0x01
  1120. #define DCBX_APP_ENTRY_SF_MASK 0x30
  1121. #define DCBX_APP_ENTRY_SF_SHIFT 4
  1122. #define DCBX_APP_SF_ETH_TYPE 0x10
  1123. #define DCBX_APP_SF_PORT 0x20
  1124. u8 pri_bitmap;
  1125. u16 app_id;
  1126. #endif
  1127. };
  1128. struct dcbx_app_priority_feature {
  1129. #ifdef __BIG_ENDIAN
  1130. u8 reserved;
  1131. u8 default_pri;
  1132. u8 tc_supported;
  1133. u8 enabled;
  1134. #elif defined(__LITTLE_ENDIAN)
  1135. u8 enabled;
  1136. u8 tc_supported;
  1137. u8 default_pri;
  1138. u8 reserved;
  1139. #endif
  1140. struct dcbx_app_priority_entry app_pri_tbl[DCBX_MAX_APP_PROTOCOL];
  1141. };
  1142. struct dcbx_features {
  1143. struct dcbx_ets_feature ets;
  1144. struct dcbx_pfc_feature pfc;
  1145. struct dcbx_app_priority_feature app;
  1146. };
  1147. struct lldp_params {
  1148. #ifdef __BIG_ENDIAN
  1149. u8 msg_fast_tx_interval;
  1150. u8 msg_tx_hold;
  1151. u8 msg_tx_interval;
  1152. u8 admin_status;
  1153. #define LLDP_TX_ONLY 0x01
  1154. #define LLDP_RX_ONLY 0x02
  1155. #define LLDP_TX_RX 0x03
  1156. #define LLDP_DISABLED 0x04
  1157. u8 reserved1;
  1158. u8 tx_fast;
  1159. u8 tx_crd_max;
  1160. u8 tx_crd;
  1161. #elif defined(__LITTLE_ENDIAN)
  1162. u8 admin_status;
  1163. #define LLDP_TX_ONLY 0x01
  1164. #define LLDP_RX_ONLY 0x02
  1165. #define LLDP_TX_RX 0x03
  1166. #define LLDP_DISABLED 0x04
  1167. u8 msg_tx_interval;
  1168. u8 msg_tx_hold;
  1169. u8 msg_fast_tx_interval;
  1170. u8 tx_crd;
  1171. u8 tx_crd_max;
  1172. u8 tx_fast;
  1173. u8 reserved1;
  1174. #endif
  1175. #define REM_CHASSIS_ID_STAT_LEN 4
  1176. #define REM_PORT_ID_STAT_LEN 4
  1177. u32 peer_chassis_id[REM_CHASSIS_ID_STAT_LEN];
  1178. u32 peer_port_id[REM_PORT_ID_STAT_LEN];
  1179. };
  1180. struct lldp_dcbx_stat {
  1181. #define LOCAL_CHASSIS_ID_STAT_LEN 2
  1182. #define LOCAL_PORT_ID_STAT_LEN 2
  1183. u32 local_chassis_id[LOCAL_CHASSIS_ID_STAT_LEN];
  1184. u32 local_port_id[LOCAL_PORT_ID_STAT_LEN];
  1185. u32 num_tx_dcbx_pkts;
  1186. u32 num_rx_dcbx_pkts;
  1187. };
  1188. struct lldp_admin_mib {
  1189. u32 ver_cfg_flags;
  1190. #define DCBX_ETS_CONFIG_TX_ENABLED 0x00000001
  1191. #define DCBX_PFC_CONFIG_TX_ENABLED 0x00000002
  1192. #define DCBX_APP_CONFIG_TX_ENABLED 0x00000004
  1193. #define DCBX_ETS_RECO_TX_ENABLED 0x00000008
  1194. #define DCBX_ETS_RECO_VALID 0x00000010
  1195. #define DCBX_ETS_WILLING 0x00000020
  1196. #define DCBX_PFC_WILLING 0x00000040
  1197. #define DCBX_APP_WILLING 0x00000080
  1198. #define DCBX_VERSION_CEE 0x00000100
  1199. #define DCBX_VERSION_IEEE 0x00000200
  1200. #define DCBX_DCBX_ENABLED 0x00000400
  1201. #define DCBX_CEE_VERSION_MASK 0x0000f000
  1202. #define DCBX_CEE_VERSION_SHIFT 12
  1203. #define DCBX_CEE_MAX_VERSION_MASK 0x000f0000
  1204. #define DCBX_CEE_MAX_VERSION_SHIFT 16
  1205. struct dcbx_features features;
  1206. };
  1207. struct lldp_remote_mib {
  1208. u32 prefix_seq_num;
  1209. u32 flags;
  1210. #define DCBX_ETS_TLV_RX 0x00000001
  1211. #define DCBX_PFC_TLV_RX 0x00000002
  1212. #define DCBX_APP_TLV_RX 0x00000004
  1213. #define DCBX_ETS_RX_ERROR 0x00000010
  1214. #define DCBX_PFC_RX_ERROR 0x00000020
  1215. #define DCBX_APP_RX_ERROR 0x00000040
  1216. #define DCBX_ETS_REM_WILLING 0x00000100
  1217. #define DCBX_PFC_REM_WILLING 0x00000200
  1218. #define DCBX_APP_REM_WILLING 0x00000400
  1219. #define DCBX_REMOTE_ETS_RECO_VALID 0x00001000
  1220. struct dcbx_features features;
  1221. u32 suffix_seq_num;
  1222. };
  1223. struct lldp_local_mib {
  1224. u32 prefix_seq_num;
  1225. u32 error;
  1226. #define DCBX_LOCAL_ETS_ERROR 0x00000001
  1227. #define DCBX_LOCAL_PFC_ERROR 0x00000002
  1228. #define DCBX_LOCAL_APP_ERROR 0x00000004
  1229. #define DCBX_LOCAL_PFC_MISMATCH 0x00000010
  1230. #define DCBX_LOCAL_APP_MISMATCH 0x00000020
  1231. struct dcbx_features features;
  1232. u32 suffix_seq_num;
  1233. };
  1234. /***END OF DCBX STRUCTURES DECLARATIONS***/
  1235. struct shmem2_region {
  1236. u32 size;
  1237. u32 dcc_support;
  1238. #define SHMEM_DCC_SUPPORT_NONE 0x00000000
  1239. #define SHMEM_DCC_SUPPORT_DISABLE_ENABLE_PF_TLV 0x00000001
  1240. #define SHMEM_DCC_SUPPORT_BANDWIDTH_ALLOCATION_TLV 0x00000004
  1241. #define SHMEM_DCC_SUPPORT_CHANGE_MAC_ADDRESS_TLV 0x00000008
  1242. #define SHMEM_DCC_SUPPORT_SET_PROTOCOL_TLV 0x00000040
  1243. #define SHMEM_DCC_SUPPORT_SET_PRIORITY_TLV 0x00000080
  1244. #define SHMEM_DCC_SUPPORT_DEFAULT SHMEM_DCC_SUPPORT_NONE
  1245. u32 ext_phy_fw_version2[PORT_MAX];
  1246. /*
  1247. * For backwards compatibility, if the mf_cfg_addr does not exist
  1248. * (the size filed is smaller than 0xc) the mf_cfg resides at the
  1249. * end of struct shmem_region
  1250. */
  1251. u32 mf_cfg_addr;
  1252. #define SHMEM_MF_CFG_ADDR_NONE 0x00000000
  1253. struct fw_flr_mb flr_mb;
  1254. u32 dcbx_lldp_params_offset;
  1255. #define SHMEM_LLDP_DCBX_PARAMS_NONE 0x00000000
  1256. u32 dcbx_neg_res_offset;
  1257. #define SHMEM_DCBX_NEG_RES_NONE 0x00000000
  1258. u32 dcbx_remote_mib_offset;
  1259. #define SHMEM_DCBX_REMOTE_MIB_NONE 0x00000000
  1260. /*
  1261. * The other shmemX_base_addr holds the other path's shmem address
  1262. * required for example in case of common phy init, or for path1 to know
  1263. * the address of mcp debug trace which is located in offset from shmem
  1264. * of path0
  1265. */
  1266. u32 other_shmem_base_addr;
  1267. u32 other_shmem2_base_addr;
  1268. u32 reserved1[E2_VF_MAX / 32];
  1269. u32 reserved2[E2_FUNC_MAX][E2_VF_MAX / 32];
  1270. u32 dcbx_lldp_dcbx_stat_offset;
  1271. #define SHMEM_LLDP_DCBX_STAT_NONE 0x00000000
  1272. };
  1273. struct emac_stats {
  1274. u32 rx_stat_ifhcinoctets;
  1275. u32 rx_stat_ifhcinbadoctets;
  1276. u32 rx_stat_etherstatsfragments;
  1277. u32 rx_stat_ifhcinucastpkts;
  1278. u32 rx_stat_ifhcinmulticastpkts;
  1279. u32 rx_stat_ifhcinbroadcastpkts;
  1280. u32 rx_stat_dot3statsfcserrors;
  1281. u32 rx_stat_dot3statsalignmenterrors;
  1282. u32 rx_stat_dot3statscarriersenseerrors;
  1283. u32 rx_stat_xonpauseframesreceived;
  1284. u32 rx_stat_xoffpauseframesreceived;
  1285. u32 rx_stat_maccontrolframesreceived;
  1286. u32 rx_stat_xoffstateentered;
  1287. u32 rx_stat_dot3statsframestoolong;
  1288. u32 rx_stat_etherstatsjabbers;
  1289. u32 rx_stat_etherstatsundersizepkts;
  1290. u32 rx_stat_etherstatspkts64octets;
  1291. u32 rx_stat_etherstatspkts65octetsto127octets;
  1292. u32 rx_stat_etherstatspkts128octetsto255octets;
  1293. u32 rx_stat_etherstatspkts256octetsto511octets;
  1294. u32 rx_stat_etherstatspkts512octetsto1023octets;
  1295. u32 rx_stat_etherstatspkts1024octetsto1522octets;
  1296. u32 rx_stat_etherstatspktsover1522octets;
  1297. u32 rx_stat_falsecarriererrors;
  1298. u32 tx_stat_ifhcoutoctets;
  1299. u32 tx_stat_ifhcoutbadoctets;
  1300. u32 tx_stat_etherstatscollisions;
  1301. u32 tx_stat_outxonsent;
  1302. u32 tx_stat_outxoffsent;
  1303. u32 tx_stat_flowcontroldone;
  1304. u32 tx_stat_dot3statssinglecollisionframes;
  1305. u32 tx_stat_dot3statsmultiplecollisionframes;
  1306. u32 tx_stat_dot3statsdeferredtransmissions;
  1307. u32 tx_stat_dot3statsexcessivecollisions;
  1308. u32 tx_stat_dot3statslatecollisions;
  1309. u32 tx_stat_ifhcoutucastpkts;
  1310. u32 tx_stat_ifhcoutmulticastpkts;
  1311. u32 tx_stat_ifhcoutbroadcastpkts;
  1312. u32 tx_stat_etherstatspkts64octets;
  1313. u32 tx_stat_etherstatspkts65octetsto127octets;
  1314. u32 tx_stat_etherstatspkts128octetsto255octets;
  1315. u32 tx_stat_etherstatspkts256octetsto511octets;
  1316. u32 tx_stat_etherstatspkts512octetsto1023octets;
  1317. u32 tx_stat_etherstatspkts1024octetsto1522octets;
  1318. u32 tx_stat_etherstatspktsover1522octets;
  1319. u32 tx_stat_dot3statsinternalmactransmiterrors;
  1320. };
  1321. struct bmac1_stats {
  1322. u32 tx_stat_gtpkt_lo;
  1323. u32 tx_stat_gtpkt_hi;
  1324. u32 tx_stat_gtxpf_lo;
  1325. u32 tx_stat_gtxpf_hi;
  1326. u32 tx_stat_gtfcs_lo;
  1327. u32 tx_stat_gtfcs_hi;
  1328. u32 tx_stat_gtmca_lo;
  1329. u32 tx_stat_gtmca_hi;
  1330. u32 tx_stat_gtbca_lo;
  1331. u32 tx_stat_gtbca_hi;
  1332. u32 tx_stat_gtfrg_lo;
  1333. u32 tx_stat_gtfrg_hi;
  1334. u32 tx_stat_gtovr_lo;
  1335. u32 tx_stat_gtovr_hi;
  1336. u32 tx_stat_gt64_lo;
  1337. u32 tx_stat_gt64_hi;
  1338. u32 tx_stat_gt127_lo;
  1339. u32 tx_stat_gt127_hi;
  1340. u32 tx_stat_gt255_lo;
  1341. u32 tx_stat_gt255_hi;
  1342. u32 tx_stat_gt511_lo;
  1343. u32 tx_stat_gt511_hi;
  1344. u32 tx_stat_gt1023_lo;
  1345. u32 tx_stat_gt1023_hi;
  1346. u32 tx_stat_gt1518_lo;
  1347. u32 tx_stat_gt1518_hi;
  1348. u32 tx_stat_gt2047_lo;
  1349. u32 tx_stat_gt2047_hi;
  1350. u32 tx_stat_gt4095_lo;
  1351. u32 tx_stat_gt4095_hi;
  1352. u32 tx_stat_gt9216_lo;
  1353. u32 tx_stat_gt9216_hi;
  1354. u32 tx_stat_gt16383_lo;
  1355. u32 tx_stat_gt16383_hi;
  1356. u32 tx_stat_gtmax_lo;
  1357. u32 tx_stat_gtmax_hi;
  1358. u32 tx_stat_gtufl_lo;
  1359. u32 tx_stat_gtufl_hi;
  1360. u32 tx_stat_gterr_lo;
  1361. u32 tx_stat_gterr_hi;
  1362. u32 tx_stat_gtbyt_lo;
  1363. u32 tx_stat_gtbyt_hi;
  1364. u32 rx_stat_gr64_lo;
  1365. u32 rx_stat_gr64_hi;
  1366. u32 rx_stat_gr127_lo;
  1367. u32 rx_stat_gr127_hi;
  1368. u32 rx_stat_gr255_lo;
  1369. u32 rx_stat_gr255_hi;
  1370. u32 rx_stat_gr511_lo;
  1371. u32 rx_stat_gr511_hi;
  1372. u32 rx_stat_gr1023_lo;
  1373. u32 rx_stat_gr1023_hi;
  1374. u32 rx_stat_gr1518_lo;
  1375. u32 rx_stat_gr1518_hi;
  1376. u32 rx_stat_gr2047_lo;
  1377. u32 rx_stat_gr2047_hi;
  1378. u32 rx_stat_gr4095_lo;
  1379. u32 rx_stat_gr4095_hi;
  1380. u32 rx_stat_gr9216_lo;
  1381. u32 rx_stat_gr9216_hi;
  1382. u32 rx_stat_gr16383_lo;
  1383. u32 rx_stat_gr16383_hi;
  1384. u32 rx_stat_grmax_lo;
  1385. u32 rx_stat_grmax_hi;
  1386. u32 rx_stat_grpkt_lo;
  1387. u32 rx_stat_grpkt_hi;
  1388. u32 rx_stat_grfcs_lo;
  1389. u32 rx_stat_grfcs_hi;
  1390. u32 rx_stat_grmca_lo;
  1391. u32 rx_stat_grmca_hi;
  1392. u32 rx_stat_grbca_lo;
  1393. u32 rx_stat_grbca_hi;
  1394. u32 rx_stat_grxcf_lo;
  1395. u32 rx_stat_grxcf_hi;
  1396. u32 rx_stat_grxpf_lo;
  1397. u32 rx_stat_grxpf_hi;
  1398. u32 rx_stat_grxuo_lo;
  1399. u32 rx_stat_grxuo_hi;
  1400. u32 rx_stat_grjbr_lo;
  1401. u32 rx_stat_grjbr_hi;
  1402. u32 rx_stat_grovr_lo;
  1403. u32 rx_stat_grovr_hi;
  1404. u32 rx_stat_grflr_lo;
  1405. u32 rx_stat_grflr_hi;
  1406. u32 rx_stat_grmeg_lo;
  1407. u32 rx_stat_grmeg_hi;
  1408. u32 rx_stat_grmeb_lo;
  1409. u32 rx_stat_grmeb_hi;
  1410. u32 rx_stat_grbyt_lo;
  1411. u32 rx_stat_grbyt_hi;
  1412. u32 rx_stat_grund_lo;
  1413. u32 rx_stat_grund_hi;
  1414. u32 rx_stat_grfrg_lo;
  1415. u32 rx_stat_grfrg_hi;
  1416. u32 rx_stat_grerb_lo;
  1417. u32 rx_stat_grerb_hi;
  1418. u32 rx_stat_grfre_lo;
  1419. u32 rx_stat_grfre_hi;
  1420. u32 rx_stat_gripj_lo;
  1421. u32 rx_stat_gripj_hi;
  1422. };
  1423. struct bmac2_stats {
  1424. u32 tx_stat_gtpk_lo; /* gtpok */
  1425. u32 tx_stat_gtpk_hi; /* gtpok */
  1426. u32 tx_stat_gtxpf_lo; /* gtpf */
  1427. u32 tx_stat_gtxpf_hi; /* gtpf */
  1428. u32 tx_stat_gtpp_lo; /* NEW BMAC2 */
  1429. u32 tx_stat_gtpp_hi; /* NEW BMAC2 */
  1430. u32 tx_stat_gtfcs_lo;
  1431. u32 tx_stat_gtfcs_hi;
  1432. u32 tx_stat_gtuca_lo; /* NEW BMAC2 */
  1433. u32 tx_stat_gtuca_hi; /* NEW BMAC2 */
  1434. u32 tx_stat_gtmca_lo;
  1435. u32 tx_stat_gtmca_hi;
  1436. u32 tx_stat_gtbca_lo;
  1437. u32 tx_stat_gtbca_hi;
  1438. u32 tx_stat_gtovr_lo;
  1439. u32 tx_stat_gtovr_hi;
  1440. u32 tx_stat_gtfrg_lo;
  1441. u32 tx_stat_gtfrg_hi;
  1442. u32 tx_stat_gtpkt1_lo; /* gtpkt */
  1443. u32 tx_stat_gtpkt1_hi; /* gtpkt */
  1444. u32 tx_stat_gt64_lo;
  1445. u32 tx_stat_gt64_hi;
  1446. u32 tx_stat_gt127_lo;
  1447. u32 tx_stat_gt127_hi;
  1448. u32 tx_stat_gt255_lo;
  1449. u32 tx_stat_gt255_hi;
  1450. u32 tx_stat_gt511_lo;
  1451. u32 tx_stat_gt511_hi;
  1452. u32 tx_stat_gt1023_lo;
  1453. u32 tx_stat_gt1023_hi;
  1454. u32 tx_stat_gt1518_lo;
  1455. u32 tx_stat_gt1518_hi;
  1456. u32 tx_stat_gt2047_lo;
  1457. u32 tx_stat_gt2047_hi;
  1458. u32 tx_stat_gt4095_lo;
  1459. u32 tx_stat_gt4095_hi;
  1460. u32 tx_stat_gt9216_lo;
  1461. u32 tx_stat_gt9216_hi;
  1462. u32 tx_stat_gt16383_lo;
  1463. u32 tx_stat_gt16383_hi;
  1464. u32 tx_stat_gtmax_lo;
  1465. u32 tx_stat_gtmax_hi;
  1466. u32 tx_stat_gtufl_lo;
  1467. u32 tx_stat_gtufl_hi;
  1468. u32 tx_stat_gterr_lo;
  1469. u32 tx_stat_gterr_hi;
  1470. u32 tx_stat_gtbyt_lo;
  1471. u32 tx_stat_gtbyt_hi;
  1472. u32 rx_stat_gr64_lo;
  1473. u32 rx_stat_gr64_hi;
  1474. u32 rx_stat_gr127_lo;
  1475. u32 rx_stat_gr127_hi;
  1476. u32 rx_stat_gr255_lo;
  1477. u32 rx_stat_gr255_hi;
  1478. u32 rx_stat_gr511_lo;
  1479. u32 rx_stat_gr511_hi;
  1480. u32 rx_stat_gr1023_lo;
  1481. u32 rx_stat_gr1023_hi;
  1482. u32 rx_stat_gr1518_lo;
  1483. u32 rx_stat_gr1518_hi;
  1484. u32 rx_stat_gr2047_lo;
  1485. u32 rx_stat_gr2047_hi;
  1486. u32 rx_stat_gr4095_lo;
  1487. u32 rx_stat_gr4095_hi;
  1488. u32 rx_stat_gr9216_lo;
  1489. u32 rx_stat_gr9216_hi;
  1490. u32 rx_stat_gr16383_lo;
  1491. u32 rx_stat_gr16383_hi;
  1492. u32 rx_stat_grmax_lo;
  1493. u32 rx_stat_grmax_hi;
  1494. u32 rx_stat_grpkt_lo;
  1495. u32 rx_stat_grpkt_hi;
  1496. u32 rx_stat_grfcs_lo;
  1497. u32 rx_stat_grfcs_hi;
  1498. u32 rx_stat_gruca_lo;
  1499. u32 rx_stat_gruca_hi;
  1500. u32 rx_stat_grmca_lo;
  1501. u32 rx_stat_grmca_hi;
  1502. u32 rx_stat_grbca_lo;
  1503. u32 rx_stat_grbca_hi;
  1504. u32 rx_stat_grxpf_lo; /* grpf */
  1505. u32 rx_stat_grxpf_hi; /* grpf */
  1506. u32 rx_stat_grpp_lo;
  1507. u32 rx_stat_grpp_hi;
  1508. u32 rx_stat_grxuo_lo; /* gruo */
  1509. u32 rx_stat_grxuo_hi; /* gruo */
  1510. u32 rx_stat_grjbr_lo;
  1511. u32 rx_stat_grjbr_hi;
  1512. u32 rx_stat_grovr_lo;
  1513. u32 rx_stat_grovr_hi;
  1514. u32 rx_stat_grxcf_lo; /* grcf */
  1515. u32 rx_stat_grxcf_hi; /* grcf */
  1516. u32 rx_stat_grflr_lo;
  1517. u32 rx_stat_grflr_hi;
  1518. u32 rx_stat_grpok_lo;
  1519. u32 rx_stat_grpok_hi;
  1520. u32 rx_stat_grmeg_lo;
  1521. u32 rx_stat_grmeg_hi;
  1522. u32 rx_stat_grmeb_lo;
  1523. u32 rx_stat_grmeb_hi;
  1524. u32 rx_stat_grbyt_lo;
  1525. u32 rx_stat_grbyt_hi;
  1526. u32 rx_stat_grund_lo;
  1527. u32 rx_stat_grund_hi;
  1528. u32 rx_stat_grfrg_lo;
  1529. u32 rx_stat_grfrg_hi;
  1530. u32 rx_stat_grerb_lo; /* grerrbyt */
  1531. u32 rx_stat_grerb_hi; /* grerrbyt */
  1532. u32 rx_stat_grfre_lo; /* grfrerr */
  1533. u32 rx_stat_grfre_hi; /* grfrerr */
  1534. u32 rx_stat_gripj_lo;
  1535. u32 rx_stat_gripj_hi;
  1536. };
  1537. union mac_stats {
  1538. struct emac_stats emac_stats;
  1539. struct bmac1_stats bmac1_stats;
  1540. struct bmac2_stats bmac2_stats;
  1541. };
  1542. struct mac_stx {
  1543. /* in_bad_octets */
  1544. u32 rx_stat_ifhcinbadoctets_hi;
  1545. u32 rx_stat_ifhcinbadoctets_lo;
  1546. /* out_bad_octets */
  1547. u32 tx_stat_ifhcoutbadoctets_hi;
  1548. u32 tx_stat_ifhcoutbadoctets_lo;
  1549. /* crc_receive_errors */
  1550. u32 rx_stat_dot3statsfcserrors_hi;
  1551. u32 rx_stat_dot3statsfcserrors_lo;
  1552. /* alignment_errors */
  1553. u32 rx_stat_dot3statsalignmenterrors_hi;
  1554. u32 rx_stat_dot3statsalignmenterrors_lo;
  1555. /* carrier_sense_errors */
  1556. u32 rx_stat_dot3statscarriersenseerrors_hi;
  1557. u32 rx_stat_dot3statscarriersenseerrors_lo;
  1558. /* false_carrier_detections */
  1559. u32 rx_stat_falsecarriererrors_hi;
  1560. u32 rx_stat_falsecarriererrors_lo;
  1561. /* runt_packets_received */
  1562. u32 rx_stat_etherstatsundersizepkts_hi;
  1563. u32 rx_stat_etherstatsundersizepkts_lo;
  1564. /* jabber_packets_received */
  1565. u32 rx_stat_dot3statsframestoolong_hi;
  1566. u32 rx_stat_dot3statsframestoolong_lo;
  1567. /* error_runt_packets_received */
  1568. u32 rx_stat_etherstatsfragments_hi;
  1569. u32 rx_stat_etherstatsfragments_lo;
  1570. /* error_jabber_packets_received */
  1571. u32 rx_stat_etherstatsjabbers_hi;
  1572. u32 rx_stat_etherstatsjabbers_lo;
  1573. /* control_frames_received */
  1574. u32 rx_stat_maccontrolframesreceived_hi;
  1575. u32 rx_stat_maccontrolframesreceived_lo;
  1576. u32 rx_stat_bmac_xpf_hi;
  1577. u32 rx_stat_bmac_xpf_lo;
  1578. u32 rx_stat_bmac_xcf_hi;
  1579. u32 rx_stat_bmac_xcf_lo;
  1580. /* xoff_state_entered */
  1581. u32 rx_stat_xoffstateentered_hi;
  1582. u32 rx_stat_xoffstateentered_lo;
  1583. /* pause_xon_frames_received */
  1584. u32 rx_stat_xonpauseframesreceived_hi;
  1585. u32 rx_stat_xonpauseframesreceived_lo;
  1586. /* pause_xoff_frames_received */
  1587. u32 rx_stat_xoffpauseframesreceived_hi;
  1588. u32 rx_stat_xoffpauseframesreceived_lo;
  1589. /* pause_xon_frames_transmitted */
  1590. u32 tx_stat_outxonsent_hi;
  1591. u32 tx_stat_outxonsent_lo;
  1592. /* pause_xoff_frames_transmitted */
  1593. u32 tx_stat_outxoffsent_hi;
  1594. u32 tx_stat_outxoffsent_lo;
  1595. /* flow_control_done */
  1596. u32 tx_stat_flowcontroldone_hi;
  1597. u32 tx_stat_flowcontroldone_lo;
  1598. /* ether_stats_collisions */
  1599. u32 tx_stat_etherstatscollisions_hi;
  1600. u32 tx_stat_etherstatscollisions_lo;
  1601. /* single_collision_transmit_frames */
  1602. u32 tx_stat_dot3statssinglecollisionframes_hi;
  1603. u32 tx_stat_dot3statssinglecollisionframes_lo;
  1604. /* multiple_collision_transmit_frames */
  1605. u32 tx_stat_dot3statsmultiplecollisionframes_hi;
  1606. u32 tx_stat_dot3statsmultiplecollisionframes_lo;
  1607. /* deferred_transmissions */
  1608. u32 tx_stat_dot3statsdeferredtransmissions_hi;
  1609. u32 tx_stat_dot3statsdeferredtransmissions_lo;
  1610. /* excessive_collision_frames */
  1611. u32 tx_stat_dot3statsexcessivecollisions_hi;
  1612. u32 tx_stat_dot3statsexcessivecollisions_lo;
  1613. /* late_collision_frames */
  1614. u32 tx_stat_dot3statslatecollisions_hi;
  1615. u32 tx_stat_dot3statslatecollisions_lo;
  1616. /* frames_transmitted_64_bytes */
  1617. u32 tx_stat_etherstatspkts64octets_hi;
  1618. u32 tx_stat_etherstatspkts64octets_lo;
  1619. /* frames_transmitted_65_127_bytes */
  1620. u32 tx_stat_etherstatspkts65octetsto127octets_hi;
  1621. u32 tx_stat_etherstatspkts65octetsto127octets_lo;
  1622. /* frames_transmitted_128_255_bytes */
  1623. u32 tx_stat_etherstatspkts128octetsto255octets_hi;
  1624. u32 tx_stat_etherstatspkts128octetsto255octets_lo;
  1625. /* frames_transmitted_256_511_bytes */
  1626. u32 tx_stat_etherstatspkts256octetsto511octets_hi;
  1627. u32 tx_stat_etherstatspkts256octetsto511octets_lo;
  1628. /* frames_transmitted_512_1023_bytes */
  1629. u32 tx_stat_etherstatspkts512octetsto1023octets_hi;
  1630. u32 tx_stat_etherstatspkts512octetsto1023octets_lo;
  1631. /* frames_transmitted_1024_1522_bytes */
  1632. u32 tx_stat_etherstatspkts1024octetsto1522octets_hi;
  1633. u32 tx_stat_etherstatspkts1024octetsto1522octets_lo;
  1634. /* frames_transmitted_1523_9022_bytes */
  1635. u32 tx_stat_etherstatspktsover1522octets_hi;
  1636. u32 tx_stat_etherstatspktsover1522octets_lo;
  1637. u32 tx_stat_bmac_2047_hi;
  1638. u32 tx_stat_bmac_2047_lo;
  1639. u32 tx_stat_bmac_4095_hi;
  1640. u32 tx_stat_bmac_4095_lo;
  1641. u32 tx_stat_bmac_9216_hi;
  1642. u32 tx_stat_bmac_9216_lo;
  1643. u32 tx_stat_bmac_16383_hi;
  1644. u32 tx_stat_bmac_16383_lo;
  1645. /* internal_mac_transmit_errors */
  1646. u32 tx_stat_dot3statsinternalmactransmiterrors_hi;
  1647. u32 tx_stat_dot3statsinternalmactransmiterrors_lo;
  1648. /* if_out_discards */
  1649. u32 tx_stat_bmac_ufl_hi;
  1650. u32 tx_stat_bmac_ufl_lo;
  1651. };
  1652. #define MAC_STX_IDX_MAX 2
  1653. struct host_port_stats {
  1654. u32 host_port_stats_start;
  1655. struct mac_stx mac_stx[MAC_STX_IDX_MAX];
  1656. u32 brb_drop_hi;
  1657. u32 brb_drop_lo;
  1658. u32 host_port_stats_end;
  1659. };
  1660. struct host_func_stats {
  1661. u32 host_func_stats_start;
  1662. u32 total_bytes_received_hi;
  1663. u32 total_bytes_received_lo;
  1664. u32 total_bytes_transmitted_hi;
  1665. u32 total_bytes_transmitted_lo;
  1666. u32 total_unicast_packets_received_hi;
  1667. u32 total_unicast_packets_received_lo;
  1668. u32 total_multicast_packets_received_hi;
  1669. u32 total_multicast_packets_received_lo;
  1670. u32 total_broadcast_packets_received_hi;
  1671. u32 total_broadcast_packets_received_lo;
  1672. u32 total_unicast_packets_transmitted_hi;
  1673. u32 total_unicast_packets_transmitted_lo;
  1674. u32 total_multicast_packets_transmitted_hi;
  1675. u32 total_multicast_packets_transmitted_lo;
  1676. u32 total_broadcast_packets_transmitted_hi;
  1677. u32 total_broadcast_packets_transmitted_lo;
  1678. u32 valid_bytes_received_hi;
  1679. u32 valid_bytes_received_lo;
  1680. u32 host_func_stats_end;
  1681. };
  1682. #define BCM_5710_FW_MAJOR_VERSION 6
  1683. #define BCM_5710_FW_MINOR_VERSION 2
  1684. #define BCM_5710_FW_REVISION_VERSION 9
  1685. #define BCM_5710_FW_ENGINEERING_VERSION 0
  1686. #define BCM_5710_FW_COMPILE_FLAGS 1
  1687. /*
  1688. * attention bits
  1689. */
  1690. struct atten_sp_status_block {
  1691. __le32 attn_bits;
  1692. __le32 attn_bits_ack;
  1693. u8 status_block_id;
  1694. u8 reserved0;
  1695. __le16 attn_bits_index;
  1696. __le32 reserved1;
  1697. };
  1698. /*
  1699. * common data for all protocols
  1700. */
  1701. struct doorbell_hdr {
  1702. u8 header;
  1703. #define DOORBELL_HDR_RX (0x1<<0)
  1704. #define DOORBELL_HDR_RX_SHIFT 0
  1705. #define DOORBELL_HDR_DB_TYPE (0x1<<1)
  1706. #define DOORBELL_HDR_DB_TYPE_SHIFT 1
  1707. #define DOORBELL_HDR_DPM_SIZE (0x3<<2)
  1708. #define DOORBELL_HDR_DPM_SIZE_SHIFT 2
  1709. #define DOORBELL_HDR_CONN_TYPE (0xF<<4)
  1710. #define DOORBELL_HDR_CONN_TYPE_SHIFT 4
  1711. };
  1712. /*
  1713. * doorbell message sent to the chip
  1714. */
  1715. struct doorbell {
  1716. #if defined(__BIG_ENDIAN)
  1717. u16 zero_fill2;
  1718. u8 zero_fill1;
  1719. struct doorbell_hdr header;
  1720. #elif defined(__LITTLE_ENDIAN)
  1721. struct doorbell_hdr header;
  1722. u8 zero_fill1;
  1723. u16 zero_fill2;
  1724. #endif
  1725. };
  1726. /*
  1727. * doorbell message sent to the chip
  1728. */
  1729. struct doorbell_set_prod {
  1730. #if defined(__BIG_ENDIAN)
  1731. u16 prod;
  1732. u8 zero_fill1;
  1733. struct doorbell_hdr header;
  1734. #elif defined(__LITTLE_ENDIAN)
  1735. struct doorbell_hdr header;
  1736. u8 zero_fill1;
  1737. u16 prod;
  1738. #endif
  1739. };
  1740. /*
  1741. * 3 lines. status block
  1742. */
  1743. struct hc_status_block_e1x {
  1744. __le16 index_values[HC_SB_MAX_INDICES_E1X];
  1745. __le16 running_index[HC_SB_MAX_SM];
  1746. u32 rsrv;
  1747. };
  1748. /*
  1749. * host status block
  1750. */
  1751. struct host_hc_status_block_e1x {
  1752. struct hc_status_block_e1x sb;
  1753. };
  1754. /*
  1755. * 3 lines. status block
  1756. */
  1757. struct hc_status_block_e2 {
  1758. __le16 index_values[HC_SB_MAX_INDICES_E2];
  1759. __le16 running_index[HC_SB_MAX_SM];
  1760. u32 reserved;
  1761. };
  1762. /*
  1763. * host status block
  1764. */
  1765. struct host_hc_status_block_e2 {
  1766. struct hc_status_block_e2 sb;
  1767. };
  1768. /*
  1769. * 5 lines. slow-path status block
  1770. */
  1771. struct hc_sp_status_block {
  1772. __le16 index_values[HC_SP_SB_MAX_INDICES];
  1773. __le16 running_index;
  1774. __le16 rsrv;
  1775. u32 rsrv1;
  1776. };
  1777. /*
  1778. * host status block
  1779. */
  1780. struct host_sp_status_block {
  1781. struct atten_sp_status_block atten_status_block;
  1782. struct hc_sp_status_block sp_sb;
  1783. };
  1784. /*
  1785. * IGU driver acknowledgment register
  1786. */
  1787. struct igu_ack_register {
  1788. #if defined(__BIG_ENDIAN)
  1789. u16 sb_id_and_flags;
  1790. #define IGU_ACK_REGISTER_STATUS_BLOCK_ID (0x1F<<0)
  1791. #define IGU_ACK_REGISTER_STATUS_BLOCK_ID_SHIFT 0
  1792. #define IGU_ACK_REGISTER_STORM_ID (0x7<<5)
  1793. #define IGU_ACK_REGISTER_STORM_ID_SHIFT 5
  1794. #define IGU_ACK_REGISTER_UPDATE_INDEX (0x1<<8)
  1795. #define IGU_ACK_REGISTER_UPDATE_INDEX_SHIFT 8
  1796. #define IGU_ACK_REGISTER_INTERRUPT_MODE (0x3<<9)
  1797. #define IGU_ACK_REGISTER_INTERRUPT_MODE_SHIFT 9
  1798. #define IGU_ACK_REGISTER_RESERVED (0x1F<<11)
  1799. #define IGU_ACK_REGISTER_RESERVED_SHIFT 11
  1800. u16 status_block_index;
  1801. #elif defined(__LITTLE_ENDIAN)
  1802. u16 status_block_index;
  1803. u16 sb_id_and_flags;
  1804. #define IGU_ACK_REGISTER_STATUS_BLOCK_ID (0x1F<<0)
  1805. #define IGU_ACK_REGISTER_STATUS_BLOCK_ID_SHIFT 0
  1806. #define IGU_ACK_REGISTER_STORM_ID (0x7<<5)
  1807. #define IGU_ACK_REGISTER_STORM_ID_SHIFT 5
  1808. #define IGU_ACK_REGISTER_UPDATE_INDEX (0x1<<8)
  1809. #define IGU_ACK_REGISTER_UPDATE_INDEX_SHIFT 8
  1810. #define IGU_ACK_REGISTER_INTERRUPT_MODE (0x3<<9)
  1811. #define IGU_ACK_REGISTER_INTERRUPT_MODE_SHIFT 9
  1812. #define IGU_ACK_REGISTER_RESERVED (0x1F<<11)
  1813. #define IGU_ACK_REGISTER_RESERVED_SHIFT 11
  1814. #endif
  1815. };
  1816. /*
  1817. * IGU driver acknowledgement register
  1818. */
  1819. struct igu_backward_compatible {
  1820. u32 sb_id_and_flags;
  1821. #define IGU_BACKWARD_COMPATIBLE_SB_INDEX (0xFFFF<<0)
  1822. #define IGU_BACKWARD_COMPATIBLE_SB_INDEX_SHIFT 0
  1823. #define IGU_BACKWARD_COMPATIBLE_SB_SELECT (0x1F<<16)
  1824. #define IGU_BACKWARD_COMPATIBLE_SB_SELECT_SHIFT 16
  1825. #define IGU_BACKWARD_COMPATIBLE_SEGMENT_ACCESS (0x7<<21)
  1826. #define IGU_BACKWARD_COMPATIBLE_SEGMENT_ACCESS_SHIFT 21
  1827. #define IGU_BACKWARD_COMPATIBLE_BUPDATE (0x1<<24)
  1828. #define IGU_BACKWARD_COMPATIBLE_BUPDATE_SHIFT 24
  1829. #define IGU_BACKWARD_COMPATIBLE_ENABLE_INT (0x3<<25)
  1830. #define IGU_BACKWARD_COMPATIBLE_ENABLE_INT_SHIFT 25
  1831. #define IGU_BACKWARD_COMPATIBLE_RESERVED_0 (0x1F<<27)
  1832. #define IGU_BACKWARD_COMPATIBLE_RESERVED_0_SHIFT 27
  1833. u32 reserved_2;
  1834. };
  1835. /*
  1836. * IGU driver acknowledgement register
  1837. */
  1838. struct igu_regular {
  1839. u32 sb_id_and_flags;
  1840. #define IGU_REGULAR_SB_INDEX (0xFFFFF<<0)
  1841. #define IGU_REGULAR_SB_INDEX_SHIFT 0
  1842. #define IGU_REGULAR_RESERVED0 (0x1<<20)
  1843. #define IGU_REGULAR_RESERVED0_SHIFT 20
  1844. #define IGU_REGULAR_SEGMENT_ACCESS (0x7<<21)
  1845. #define IGU_REGULAR_SEGMENT_ACCESS_SHIFT 21
  1846. #define IGU_REGULAR_BUPDATE (0x1<<24)
  1847. #define IGU_REGULAR_BUPDATE_SHIFT 24
  1848. #define IGU_REGULAR_ENABLE_INT (0x3<<25)
  1849. #define IGU_REGULAR_ENABLE_INT_SHIFT 25
  1850. #define IGU_REGULAR_RESERVED_1 (0x1<<27)
  1851. #define IGU_REGULAR_RESERVED_1_SHIFT 27
  1852. #define IGU_REGULAR_CLEANUP_TYPE (0x3<<28)
  1853. #define IGU_REGULAR_CLEANUP_TYPE_SHIFT 28
  1854. #define IGU_REGULAR_CLEANUP_SET (0x1<<30)
  1855. #define IGU_REGULAR_CLEANUP_SET_SHIFT 30
  1856. #define IGU_REGULAR_BCLEANUP (0x1<<31)
  1857. #define IGU_REGULAR_BCLEANUP_SHIFT 31
  1858. u32 reserved_2;
  1859. };
  1860. /*
  1861. * IGU driver acknowledgement register
  1862. */
  1863. union igu_consprod_reg {
  1864. struct igu_regular regular;
  1865. struct igu_backward_compatible backward_compatible;
  1866. };
  1867. /*
  1868. * Control register for the IGU command register
  1869. */
  1870. struct igu_ctrl_reg {
  1871. u32 ctrl_data;
  1872. #define IGU_CTRL_REG_ADDRESS (0xFFF<<0)
  1873. #define IGU_CTRL_REG_ADDRESS_SHIFT 0
  1874. #define IGU_CTRL_REG_FID (0x7F<<12)
  1875. #define IGU_CTRL_REG_FID_SHIFT 12
  1876. #define IGU_CTRL_REG_RESERVED (0x1<<19)
  1877. #define IGU_CTRL_REG_RESERVED_SHIFT 19
  1878. #define IGU_CTRL_REG_TYPE (0x1<<20)
  1879. #define IGU_CTRL_REG_TYPE_SHIFT 20
  1880. #define IGU_CTRL_REG_UNUSED (0x7FF<<21)
  1881. #define IGU_CTRL_REG_UNUSED_SHIFT 21
  1882. };
  1883. /*
  1884. * Parser parsing flags field
  1885. */
  1886. struct parsing_flags {
  1887. __le16 flags;
  1888. #define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE (0x1<<0)
  1889. #define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE_SHIFT 0
  1890. #define PARSING_FLAGS_VLAN (0x1<<1)
  1891. #define PARSING_FLAGS_VLAN_SHIFT 1
  1892. #define PARSING_FLAGS_EXTRA_VLAN (0x1<<2)
  1893. #define PARSING_FLAGS_EXTRA_VLAN_SHIFT 2
  1894. #define PARSING_FLAGS_OVER_ETHERNET_PROTOCOL (0x3<<3)
  1895. #define PARSING_FLAGS_OVER_ETHERNET_PROTOCOL_SHIFT 3
  1896. #define PARSING_FLAGS_IP_OPTIONS (0x1<<5)
  1897. #define PARSING_FLAGS_IP_OPTIONS_SHIFT 5
  1898. #define PARSING_FLAGS_FRAGMENTATION_STATUS (0x1<<6)
  1899. #define PARSING_FLAGS_FRAGMENTATION_STATUS_SHIFT 6
  1900. #define PARSING_FLAGS_OVER_IP_PROTOCOL (0x3<<7)
  1901. #define PARSING_FLAGS_OVER_IP_PROTOCOL_SHIFT 7
  1902. #define PARSING_FLAGS_PURE_ACK_INDICATION (0x1<<9)
  1903. #define PARSING_FLAGS_PURE_ACK_INDICATION_SHIFT 9
  1904. #define PARSING_FLAGS_TCP_OPTIONS_EXIST (0x1<<10)
  1905. #define PARSING_FLAGS_TCP_OPTIONS_EXIST_SHIFT 10
  1906. #define PARSING_FLAGS_TIME_STAMP_EXIST_FLAG (0x1<<11)
  1907. #define PARSING_FLAGS_TIME_STAMP_EXIST_FLAG_SHIFT 11
  1908. #define PARSING_FLAGS_CONNECTION_MATCH (0x1<<12)
  1909. #define PARSING_FLAGS_CONNECTION_MATCH_SHIFT 12
  1910. #define PARSING_FLAGS_LLC_SNAP (0x1<<13)
  1911. #define PARSING_FLAGS_LLC_SNAP_SHIFT 13
  1912. #define PARSING_FLAGS_RESERVED0 (0x3<<14)
  1913. #define PARSING_FLAGS_RESERVED0_SHIFT 14
  1914. };
  1915. struct regpair {
  1916. __le32 lo;
  1917. __le32 hi;
  1918. };
  1919. /*
  1920. * dmae command structure
  1921. */
  1922. struct dmae_command {
  1923. u32 opcode;
  1924. #define DMAE_COMMAND_SRC (0x1<<0)
  1925. #define DMAE_COMMAND_SRC_SHIFT 0
  1926. #define DMAE_COMMAND_DST (0x3<<1)
  1927. #define DMAE_COMMAND_DST_SHIFT 1
  1928. #define DMAE_COMMAND_C_DST (0x1<<3)
  1929. #define DMAE_COMMAND_C_DST_SHIFT 3
  1930. #define DMAE_COMMAND_C_TYPE_ENABLE (0x1<<4)
  1931. #define DMAE_COMMAND_C_TYPE_ENABLE_SHIFT 4
  1932. #define DMAE_COMMAND_C_TYPE_CRC_ENABLE (0x1<<5)
  1933. #define DMAE_COMMAND_C_TYPE_CRC_ENABLE_SHIFT 5
  1934. #define DMAE_COMMAND_C_TYPE_CRC_OFFSET (0x7<<6)
  1935. #define DMAE_COMMAND_C_TYPE_CRC_OFFSET_SHIFT 6
  1936. #define DMAE_COMMAND_ENDIANITY (0x3<<9)
  1937. #define DMAE_COMMAND_ENDIANITY_SHIFT 9
  1938. #define DMAE_COMMAND_PORT (0x1<<11)
  1939. #define DMAE_COMMAND_PORT_SHIFT 11
  1940. #define DMAE_COMMAND_CRC_RESET (0x1<<12)
  1941. #define DMAE_COMMAND_CRC_RESET_SHIFT 12
  1942. #define DMAE_COMMAND_SRC_RESET (0x1<<13)
  1943. #define DMAE_COMMAND_SRC_RESET_SHIFT 13
  1944. #define DMAE_COMMAND_DST_RESET (0x1<<14)
  1945. #define DMAE_COMMAND_DST_RESET_SHIFT 14
  1946. #define DMAE_COMMAND_E1HVN (0x3<<15)
  1947. #define DMAE_COMMAND_E1HVN_SHIFT 15
  1948. #define DMAE_COMMAND_DST_VN (0x3<<17)
  1949. #define DMAE_COMMAND_DST_VN_SHIFT 17
  1950. #define DMAE_COMMAND_C_FUNC (0x1<<19)
  1951. #define DMAE_COMMAND_C_FUNC_SHIFT 19
  1952. #define DMAE_COMMAND_ERR_POLICY (0x3<<20)
  1953. #define DMAE_COMMAND_ERR_POLICY_SHIFT 20
  1954. #define DMAE_COMMAND_RESERVED0 (0x3FF<<22)
  1955. #define DMAE_COMMAND_RESERVED0_SHIFT 22
  1956. u32 src_addr_lo;
  1957. u32 src_addr_hi;
  1958. u32 dst_addr_lo;
  1959. u32 dst_addr_hi;
  1960. #if defined(__BIG_ENDIAN)
  1961. u16 reserved1;
  1962. u16 len;
  1963. #elif defined(__LITTLE_ENDIAN)
  1964. u16 len;
  1965. u16 reserved1;
  1966. #endif
  1967. u32 comp_addr_lo;
  1968. u32 comp_addr_hi;
  1969. u32 comp_val;
  1970. u32 crc32;
  1971. u32 crc32_c;
  1972. #if defined(__BIG_ENDIAN)
  1973. u16 crc16_c;
  1974. u16 crc16;
  1975. #elif defined(__LITTLE_ENDIAN)
  1976. u16 crc16;
  1977. u16 crc16_c;
  1978. #endif
  1979. #if defined(__BIG_ENDIAN)
  1980. u16 reserved3;
  1981. u16 crc_t10;
  1982. #elif defined(__LITTLE_ENDIAN)
  1983. u16 crc_t10;
  1984. u16 reserved3;
  1985. #endif
  1986. #if defined(__BIG_ENDIAN)
  1987. u16 xsum8;
  1988. u16 xsum16;
  1989. #elif defined(__LITTLE_ENDIAN)
  1990. u16 xsum16;
  1991. u16 xsum8;
  1992. #endif
  1993. };
  1994. struct double_regpair {
  1995. u32 regpair0_lo;
  1996. u32 regpair0_hi;
  1997. u32 regpair1_lo;
  1998. u32 regpair1_hi;
  1999. };
  2000. /*
  2001. * SDM operation gen command (generate aggregative interrupt)
  2002. */
  2003. struct sdm_op_gen {
  2004. __le32 command;
  2005. #define SDM_OP_GEN_COMP_PARAM (0x1F<<0)
  2006. #define SDM_OP_GEN_COMP_PARAM_SHIFT 0
  2007. #define SDM_OP_GEN_COMP_TYPE (0x7<<5)
  2008. #define SDM_OP_GEN_COMP_TYPE_SHIFT 5
  2009. #define SDM_OP_GEN_AGG_VECT_IDX (0xFF<<8)
  2010. #define SDM_OP_GEN_AGG_VECT_IDX_SHIFT 8
  2011. #define SDM_OP_GEN_AGG_VECT_IDX_VALID (0x1<<16)
  2012. #define SDM_OP_GEN_AGG_VECT_IDX_VALID_SHIFT 16
  2013. #define SDM_OP_GEN_RESERVED (0x7FFF<<17)
  2014. #define SDM_OP_GEN_RESERVED_SHIFT 17
  2015. };
  2016. /*
  2017. * The eth Rx Buffer Descriptor
  2018. */
  2019. struct eth_rx_bd {
  2020. __le32 addr_lo;
  2021. __le32 addr_hi;
  2022. };
  2023. /*
  2024. * The eth Rx SGE Descriptor
  2025. */
  2026. struct eth_rx_sge {
  2027. __le32 addr_lo;
  2028. __le32 addr_hi;
  2029. };
  2030. /*
  2031. * The eth storm context of Ustorm
  2032. */
  2033. struct ustorm_eth_st_context {
  2034. u32 reserved0[48];
  2035. };
  2036. /*
  2037. * The eth storm context of Tstorm
  2038. */
  2039. struct tstorm_eth_st_context {
  2040. u32 __reserved0[28];
  2041. };
  2042. /*
  2043. * The eth aggregative context of Xstorm
  2044. */
  2045. struct xstorm_eth_ag_context {
  2046. u32 reserved0;
  2047. #if defined(__BIG_ENDIAN)
  2048. u8 cdu_reserved;
  2049. u8 reserved2;
  2050. u16 reserved1;
  2051. #elif defined(__LITTLE_ENDIAN)
  2052. u16 reserved1;
  2053. u8 reserved2;
  2054. u8 cdu_reserved;
  2055. #endif
  2056. u32 reserved3[30];
  2057. };
  2058. /*
  2059. * The eth aggregative context of Tstorm
  2060. */
  2061. struct tstorm_eth_ag_context {
  2062. u32 __reserved0[14];
  2063. };
  2064. /*
  2065. * The eth aggregative context of Cstorm
  2066. */
  2067. struct cstorm_eth_ag_context {
  2068. u32 __reserved0[10];
  2069. };
  2070. /*
  2071. * The eth aggregative context of Ustorm
  2072. */
  2073. struct ustorm_eth_ag_context {
  2074. u32 __reserved0;
  2075. #if defined(__BIG_ENDIAN)
  2076. u8 cdu_usage;
  2077. u8 __reserved2;
  2078. u16 __reserved1;
  2079. #elif defined(__LITTLE_ENDIAN)
  2080. u16 __reserved1;
  2081. u8 __reserved2;
  2082. u8 cdu_usage;
  2083. #endif
  2084. u32 __reserved3[6];
  2085. };
  2086. /*
  2087. * Timers connection context
  2088. */
  2089. struct timers_block_context {
  2090. u32 __reserved_0;
  2091. u32 __reserved_1;
  2092. u32 __reserved_2;
  2093. u32 flags;
  2094. #define __TIMERS_BLOCK_CONTEXT_NUM_OF_ACTIVE_TIMERS (0x3<<0)
  2095. #define __TIMERS_BLOCK_CONTEXT_NUM_OF_ACTIVE_TIMERS_SHIFT 0
  2096. #define TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG (0x1<<2)
  2097. #define TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG_SHIFT 2
  2098. #define __TIMERS_BLOCK_CONTEXT_RESERVED0 (0x1FFFFFFF<<3)
  2099. #define __TIMERS_BLOCK_CONTEXT_RESERVED0_SHIFT 3
  2100. };
  2101. /*
  2102. * structure for easy accessibility to assembler
  2103. */
  2104. struct eth_tx_bd_flags {
  2105. u8 as_bitfield;
  2106. #define ETH_TX_BD_FLAGS_IP_CSUM (0x1<<0)
  2107. #define ETH_TX_BD_FLAGS_IP_CSUM_SHIFT 0
  2108. #define ETH_TX_BD_FLAGS_L4_CSUM (0x1<<1)
  2109. #define ETH_TX_BD_FLAGS_L4_CSUM_SHIFT 1
  2110. #define ETH_TX_BD_FLAGS_VLAN_MODE (0x3<<2)
  2111. #define ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT 2
  2112. #define ETH_TX_BD_FLAGS_START_BD (0x1<<4)
  2113. #define ETH_TX_BD_FLAGS_START_BD_SHIFT 4
  2114. #define ETH_TX_BD_FLAGS_IS_UDP (0x1<<5)
  2115. #define ETH_TX_BD_FLAGS_IS_UDP_SHIFT 5
  2116. #define ETH_TX_BD_FLAGS_SW_LSO (0x1<<6)
  2117. #define ETH_TX_BD_FLAGS_SW_LSO_SHIFT 6
  2118. #define ETH_TX_BD_FLAGS_IPV6 (0x1<<7)
  2119. #define ETH_TX_BD_FLAGS_IPV6_SHIFT 7
  2120. };
  2121. /*
  2122. * The eth Tx Buffer Descriptor
  2123. */
  2124. struct eth_tx_start_bd {
  2125. __le32 addr_lo;
  2126. __le32 addr_hi;
  2127. __le16 nbd;
  2128. __le16 nbytes;
  2129. __le16 vlan_or_ethertype;
  2130. struct eth_tx_bd_flags bd_flags;
  2131. u8 general_data;
  2132. #define ETH_TX_START_BD_HDR_NBDS (0x3F<<0)
  2133. #define ETH_TX_START_BD_HDR_NBDS_SHIFT 0
  2134. #define ETH_TX_START_BD_ETH_ADDR_TYPE (0x3<<6)
  2135. #define ETH_TX_START_BD_ETH_ADDR_TYPE_SHIFT 6
  2136. };
  2137. /*
  2138. * Tx regular BD structure
  2139. */
  2140. struct eth_tx_bd {
  2141. __le32 addr_lo;
  2142. __le32 addr_hi;
  2143. __le16 total_pkt_bytes;
  2144. __le16 nbytes;
  2145. u8 reserved[4];
  2146. };
  2147. /*
  2148. * Tx parsing BD structure for ETH E1/E1h
  2149. */
  2150. struct eth_tx_parse_bd_e1x {
  2151. u8 global_data;
  2152. #define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W (0xF<<0)
  2153. #define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W_SHIFT 0
  2154. #define ETH_TX_PARSE_BD_E1X_RESERVED0 (0x1<<4)
  2155. #define ETH_TX_PARSE_BD_E1X_RESERVED0_SHIFT 4
  2156. #define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN (0x1<<5)
  2157. #define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN_SHIFT 5
  2158. #define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN (0x1<<6)
  2159. #define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT 6
  2160. #define ETH_TX_PARSE_BD_E1X_NS_FLG (0x1<<7)
  2161. #define ETH_TX_PARSE_BD_E1X_NS_FLG_SHIFT 7
  2162. u8 tcp_flags;
  2163. #define ETH_TX_PARSE_BD_E1X_FIN_FLG (0x1<<0)
  2164. #define ETH_TX_PARSE_BD_E1X_FIN_FLG_SHIFT 0
  2165. #define ETH_TX_PARSE_BD_E1X_SYN_FLG (0x1<<1)
  2166. #define ETH_TX_PARSE_BD_E1X_SYN_FLG_SHIFT 1
  2167. #define ETH_TX_PARSE_BD_E1X_RST_FLG (0x1<<2)
  2168. #define ETH_TX_PARSE_BD_E1X_RST_FLG_SHIFT 2
  2169. #define ETH_TX_PARSE_BD_E1X_PSH_FLG (0x1<<3)
  2170. #define ETH_TX_PARSE_BD_E1X_PSH_FLG_SHIFT 3
  2171. #define ETH_TX_PARSE_BD_E1X_ACK_FLG (0x1<<4)
  2172. #define ETH_TX_PARSE_BD_E1X_ACK_FLG_SHIFT 4
  2173. #define ETH_TX_PARSE_BD_E1X_URG_FLG (0x1<<5)
  2174. #define ETH_TX_PARSE_BD_E1X_URG_FLG_SHIFT 5
  2175. #define ETH_TX_PARSE_BD_E1X_ECE_FLG (0x1<<6)
  2176. #define ETH_TX_PARSE_BD_E1X_ECE_FLG_SHIFT 6
  2177. #define ETH_TX_PARSE_BD_E1X_CWR_FLG (0x1<<7)
  2178. #define ETH_TX_PARSE_BD_E1X_CWR_FLG_SHIFT 7
  2179. u8 ip_hlen_w;
  2180. s8 reserved;
  2181. __le16 total_hlen_w;
  2182. __le16 tcp_pseudo_csum;
  2183. __le16 lso_mss;
  2184. __le16 ip_id;
  2185. __le32 tcp_send_seq;
  2186. };
  2187. /*
  2188. * Tx parsing BD structure for ETH E2
  2189. */
  2190. struct eth_tx_parse_bd_e2 {
  2191. __le16 dst_mac_addr_lo;
  2192. __le16 dst_mac_addr_mid;
  2193. __le16 dst_mac_addr_hi;
  2194. __le16 src_mac_addr_lo;
  2195. __le16 src_mac_addr_mid;
  2196. __le16 src_mac_addr_hi;
  2197. __le32 parsing_data;
  2198. #define ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W (0x1FFF<<0)
  2199. #define ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT 0
  2200. #define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW (0xF<<13)
  2201. #define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT 13
  2202. #define ETH_TX_PARSE_BD_E2_LSO_MSS (0x3FFF<<17)
  2203. #define ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT 17
  2204. #define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR (0x1<<31)
  2205. #define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR_SHIFT 31
  2206. };
  2207. /*
  2208. * The last BD in the BD memory will hold a pointer to the next BD memory
  2209. */
  2210. struct eth_tx_next_bd {
  2211. __le32 addr_lo;
  2212. __le32 addr_hi;
  2213. u8 reserved[8];
  2214. };
  2215. /*
  2216. * union for 4 Bd types
  2217. */
  2218. union eth_tx_bd_types {
  2219. struct eth_tx_start_bd start_bd;
  2220. struct eth_tx_bd reg_bd;
  2221. struct eth_tx_parse_bd_e1x parse_bd_e1x;
  2222. struct eth_tx_parse_bd_e2 parse_bd_e2;
  2223. struct eth_tx_next_bd next_bd;
  2224. };
  2225. /*
  2226. * The eth storm context of Xstorm
  2227. */
  2228. struct xstorm_eth_st_context {
  2229. u32 reserved0[60];
  2230. };
  2231. /*
  2232. * The eth storm context of Cstorm
  2233. */
  2234. struct cstorm_eth_st_context {
  2235. u32 __reserved0[4];
  2236. };
  2237. /*
  2238. * Ethernet connection context
  2239. */
  2240. struct eth_context {
  2241. struct ustorm_eth_st_context ustorm_st_context;
  2242. struct tstorm_eth_st_context tstorm_st_context;
  2243. struct xstorm_eth_ag_context xstorm_ag_context;
  2244. struct tstorm_eth_ag_context tstorm_ag_context;
  2245. struct cstorm_eth_ag_context cstorm_ag_context;
  2246. struct ustorm_eth_ag_context ustorm_ag_context;
  2247. struct timers_block_context timers_context;
  2248. struct xstorm_eth_st_context xstorm_st_context;
  2249. struct cstorm_eth_st_context cstorm_st_context;
  2250. };
  2251. /*
  2252. * Ethernet doorbell
  2253. */
  2254. struct eth_tx_doorbell {
  2255. #if defined(__BIG_ENDIAN)
  2256. u16 npackets;
  2257. u8 params;
  2258. #define ETH_TX_DOORBELL_NUM_BDS (0x3F<<0)
  2259. #define ETH_TX_DOORBELL_NUM_BDS_SHIFT 0
  2260. #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG (0x1<<6)
  2261. #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG_SHIFT 6
  2262. #define ETH_TX_DOORBELL_SPARE (0x1<<7)
  2263. #define ETH_TX_DOORBELL_SPARE_SHIFT 7
  2264. struct doorbell_hdr hdr;
  2265. #elif defined(__LITTLE_ENDIAN)
  2266. struct doorbell_hdr hdr;
  2267. u8 params;
  2268. #define ETH_TX_DOORBELL_NUM_BDS (0x3F<<0)
  2269. #define ETH_TX_DOORBELL_NUM_BDS_SHIFT 0
  2270. #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG (0x1<<6)
  2271. #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG_SHIFT 6
  2272. #define ETH_TX_DOORBELL_SPARE (0x1<<7)
  2273. #define ETH_TX_DOORBELL_SPARE_SHIFT 7
  2274. u16 npackets;
  2275. #endif
  2276. };
  2277. /*
  2278. * client init fc data
  2279. */
  2280. struct client_init_fc_data {
  2281. __le16 cqe_pause_thr_low;
  2282. __le16 cqe_pause_thr_high;
  2283. __le16 bd_pause_thr_low;
  2284. __le16 bd_pause_thr_high;
  2285. __le16 sge_pause_thr_low;
  2286. __le16 sge_pause_thr_high;
  2287. __le16 rx_cos_mask;
  2288. u8 safc_group_num;
  2289. u8 safc_group_en_flg;
  2290. u8 traffic_type;
  2291. u8 reserved0;
  2292. __le16 reserved1;
  2293. __le32 reserved2;
  2294. };
  2295. /*
  2296. * client init ramrod data
  2297. */
  2298. struct client_init_general_data {
  2299. u8 client_id;
  2300. u8 statistics_counter_id;
  2301. u8 statistics_en_flg;
  2302. u8 is_fcoe_flg;
  2303. u8 activate_flg;
  2304. u8 sp_client_id;
  2305. __le16 reserved0;
  2306. __le32 reserved1[2];
  2307. };
  2308. /*
  2309. * client init rx data
  2310. */
  2311. struct client_init_rx_data {
  2312. u8 tpa_en_flg;
  2313. u8 vmqueue_mode_en_flg;
  2314. u8 extra_data_over_sgl_en_flg;
  2315. u8 cache_line_alignment_log_size;
  2316. u8 enable_dynamic_hc;
  2317. u8 max_sges_for_packet;
  2318. u8 client_qzone_id;
  2319. u8 drop_ip_cs_err_flg;
  2320. u8 drop_tcp_cs_err_flg;
  2321. u8 drop_ttl0_flg;
  2322. u8 drop_udp_cs_err_flg;
  2323. u8 inner_vlan_removal_enable_flg;
  2324. u8 outer_vlan_removal_enable_flg;
  2325. u8 status_block_id;
  2326. u8 rx_sb_index_number;
  2327. u8 reserved0[3];
  2328. __le16 bd_buff_size;
  2329. __le16 sge_buff_size;
  2330. __le16 mtu;
  2331. struct regpair bd_page_base;
  2332. struct regpair sge_page_base;
  2333. struct regpair cqe_page_base;
  2334. u8 is_leading_rss;
  2335. u8 is_approx_mcast;
  2336. __le16 max_agg_size;
  2337. __le32 reserved2[3];
  2338. };
  2339. /*
  2340. * client init tx data
  2341. */
  2342. struct client_init_tx_data {
  2343. u8 enforce_security_flg;
  2344. u8 tx_status_block_id;
  2345. u8 tx_sb_index_number;
  2346. u8 reserved0;
  2347. __le16 mtu;
  2348. __le16 reserved1;
  2349. struct regpair tx_bd_page_base;
  2350. __le32 reserved2[2];
  2351. };
  2352. /*
  2353. * client init ramrod data
  2354. */
  2355. struct client_init_ramrod_data {
  2356. struct client_init_general_data general;
  2357. struct client_init_rx_data rx;
  2358. struct client_init_tx_data tx;
  2359. struct client_init_fc_data fc;
  2360. };
  2361. /*
  2362. * The data contain client ID need to the ramrod
  2363. */
  2364. struct eth_common_ramrod_data {
  2365. u32 client_id;
  2366. u32 reserved1;
  2367. };
  2368. /*
  2369. * union for sgl and raw data.
  2370. */
  2371. union eth_sgl_or_raw_data {
  2372. __le16 sgl[8];
  2373. u32 raw_data[4];
  2374. };
  2375. /*
  2376. * regular eth FP CQE parameters struct
  2377. */
  2378. struct eth_fast_path_rx_cqe {
  2379. u8 type_error_flags;
  2380. #define ETH_FAST_PATH_RX_CQE_TYPE (0x1<<0)
  2381. #define ETH_FAST_PATH_RX_CQE_TYPE_SHIFT 0
  2382. #define ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG (0x1<<1)
  2383. #define ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG_SHIFT 1
  2384. #define ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG (0x1<<2)
  2385. #define ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG_SHIFT 2
  2386. #define ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG (0x1<<3)
  2387. #define ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG_SHIFT 3
  2388. #define ETH_FAST_PATH_RX_CQE_START_FLG (0x1<<4)
  2389. #define ETH_FAST_PATH_RX_CQE_START_FLG_SHIFT 4
  2390. #define ETH_FAST_PATH_RX_CQE_END_FLG (0x1<<5)
  2391. #define ETH_FAST_PATH_RX_CQE_END_FLG_SHIFT 5
  2392. #define ETH_FAST_PATH_RX_CQE_SGL_RAW_SEL (0x3<<6)
  2393. #define ETH_FAST_PATH_RX_CQE_SGL_RAW_SEL_SHIFT 6
  2394. u8 status_flags;
  2395. #define ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE (0x7<<0)
  2396. #define ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE_SHIFT 0
  2397. #define ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG (0x1<<3)
  2398. #define ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG_SHIFT 3
  2399. #define ETH_FAST_PATH_RX_CQE_BROADCAST_FLG (0x1<<4)
  2400. #define ETH_FAST_PATH_RX_CQE_BROADCAST_FLG_SHIFT 4
  2401. #define ETH_FAST_PATH_RX_CQE_MAC_MATCH_FLG (0x1<<5)
  2402. #define ETH_FAST_PATH_RX_CQE_MAC_MATCH_FLG_SHIFT 5
  2403. #define ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG (0x1<<6)
  2404. #define ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG_SHIFT 6
  2405. #define ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG (0x1<<7)
  2406. #define ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG_SHIFT 7
  2407. u8 placement_offset;
  2408. u8 queue_index;
  2409. __le32 rss_hash_result;
  2410. __le16 vlan_tag;
  2411. __le16 pkt_len;
  2412. __le16 len_on_bd;
  2413. struct parsing_flags pars_flags;
  2414. union eth_sgl_or_raw_data sgl_or_raw_data;
  2415. };
  2416. /*
  2417. * The data for RSS setup ramrod
  2418. */
  2419. struct eth_halt_ramrod_data {
  2420. u32 client_id;
  2421. u32 reserved0;
  2422. };
  2423. /*
  2424. * The data for statistics query ramrod
  2425. */
  2426. struct common_query_ramrod_data {
  2427. #if defined(__BIG_ENDIAN)
  2428. u8 reserved0;
  2429. u8 collect_port;
  2430. u16 drv_counter;
  2431. #elif defined(__LITTLE_ENDIAN)
  2432. u16 drv_counter;
  2433. u8 collect_port;
  2434. u8 reserved0;
  2435. #endif
  2436. u32 ctr_id_vector;
  2437. };
  2438. /*
  2439. * Place holder for ramrods protocol specific data
  2440. */
  2441. struct ramrod_data {
  2442. __le32 data_lo;
  2443. __le32 data_hi;
  2444. };
  2445. /*
  2446. * union for ramrod data for Ethernet protocol (CQE) (force size of 16 bits)
  2447. */
  2448. union eth_ramrod_data {
  2449. struct ramrod_data general;
  2450. };
  2451. /*
  2452. * Eth Rx Cqe structure- general structure for ramrods
  2453. */
  2454. struct common_ramrod_eth_rx_cqe {
  2455. u8 ramrod_type;
  2456. #define COMMON_RAMROD_ETH_RX_CQE_TYPE (0x1<<0)
  2457. #define COMMON_RAMROD_ETH_RX_CQE_TYPE_SHIFT 0
  2458. #define COMMON_RAMROD_ETH_RX_CQE_ERROR (0x1<<1)
  2459. #define COMMON_RAMROD_ETH_RX_CQE_ERROR_SHIFT 1
  2460. #define COMMON_RAMROD_ETH_RX_CQE_RESERVED0 (0x3F<<2)
  2461. #define COMMON_RAMROD_ETH_RX_CQE_RESERVED0_SHIFT 2
  2462. u8 conn_type;
  2463. __le16 reserved1;
  2464. __le32 conn_and_cmd_data;
  2465. #define COMMON_RAMROD_ETH_RX_CQE_CID (0xFFFFFF<<0)
  2466. #define COMMON_RAMROD_ETH_RX_CQE_CID_SHIFT 0
  2467. #define COMMON_RAMROD_ETH_RX_CQE_CMD_ID (0xFF<<24)
  2468. #define COMMON_RAMROD_ETH_RX_CQE_CMD_ID_SHIFT 24
  2469. struct ramrod_data protocol_data;
  2470. __le32 reserved2[4];
  2471. };
  2472. /*
  2473. * Rx Last CQE in page (in ETH)
  2474. */
  2475. struct eth_rx_cqe_next_page {
  2476. __le32 addr_lo;
  2477. __le32 addr_hi;
  2478. __le32 reserved[6];
  2479. };
  2480. /*
  2481. * union for all eth rx cqe types (fix their sizes)
  2482. */
  2483. union eth_rx_cqe {
  2484. struct eth_fast_path_rx_cqe fast_path_cqe;
  2485. struct common_ramrod_eth_rx_cqe ramrod_cqe;
  2486. struct eth_rx_cqe_next_page next_page_cqe;
  2487. };
  2488. /*
  2489. * common data for all protocols
  2490. */
  2491. struct spe_hdr {
  2492. __le32 conn_and_cmd_data;
  2493. #define SPE_HDR_CID (0xFFFFFF<<0)
  2494. #define SPE_HDR_CID_SHIFT 0
  2495. #define SPE_HDR_CMD_ID (0xFF<<24)
  2496. #define SPE_HDR_CMD_ID_SHIFT 24
  2497. __le16 type;
  2498. #define SPE_HDR_CONN_TYPE (0xFF<<0)
  2499. #define SPE_HDR_CONN_TYPE_SHIFT 0
  2500. #define SPE_HDR_FUNCTION_ID (0xFF<<8)
  2501. #define SPE_HDR_FUNCTION_ID_SHIFT 8
  2502. __le16 reserved1;
  2503. };
  2504. /*
  2505. * Ethernet slow path element
  2506. */
  2507. union eth_specific_data {
  2508. u8 protocol_data[8];
  2509. struct regpair client_init_ramrod_init_data;
  2510. struct eth_halt_ramrod_data halt_ramrod_data;
  2511. struct regpair update_data_addr;
  2512. struct eth_common_ramrod_data common_ramrod_data;
  2513. };
  2514. /*
  2515. * Ethernet slow path element
  2516. */
  2517. struct eth_spe {
  2518. struct spe_hdr hdr;
  2519. union eth_specific_data data;
  2520. };
  2521. /*
  2522. * array of 13 bds as appears in the eth xstorm context
  2523. */
  2524. struct eth_tx_bds_array {
  2525. union eth_tx_bd_types bds[13];
  2526. };
  2527. /*
  2528. * Common configuration parameters per function in Tstorm
  2529. */
  2530. struct tstorm_eth_function_common_config {
  2531. #if defined(__BIG_ENDIAN)
  2532. u8 reserved1;
  2533. u8 rss_result_mask;
  2534. u16 config_flags;
  2535. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY (0x1<<0)
  2536. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY_SHIFT 0
  2537. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY (0x1<<1)
  2538. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY_SHIFT 1
  2539. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY (0x1<<2)
  2540. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY_SHIFT 2
  2541. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY (0x1<<3)
  2542. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY_SHIFT 3
  2543. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE (0x7<<4)
  2544. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT 4
  2545. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_ENABLE_TPA (0x1<<7)
  2546. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_ENABLE_TPA_SHIFT 7
  2547. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_FILTERING_ENABLE (0x1<<8)
  2548. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_FILTERING_ENABLE_SHIFT 8
  2549. #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0 (0x7F<<9)
  2550. #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0_SHIFT 9
  2551. #elif defined(__LITTLE_ENDIAN)
  2552. u16 config_flags;
  2553. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY (0x1<<0)
  2554. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY_SHIFT 0
  2555. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY (0x1<<1)
  2556. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY_SHIFT 1
  2557. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY (0x1<<2)
  2558. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY_SHIFT 2
  2559. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY (0x1<<3)
  2560. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY_SHIFT 3
  2561. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE (0x7<<4)
  2562. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT 4
  2563. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_ENABLE_TPA (0x1<<7)
  2564. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_ENABLE_TPA_SHIFT 7
  2565. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_FILTERING_ENABLE (0x1<<8)
  2566. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_FILTERING_ENABLE_SHIFT 8
  2567. #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0 (0x7F<<9)
  2568. #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0_SHIFT 9
  2569. u8 rss_result_mask;
  2570. u8 reserved1;
  2571. #endif
  2572. u16 vlan_id[2];
  2573. };
  2574. /*
  2575. * RSS idirection table update configuration
  2576. */
  2577. struct rss_update_config {
  2578. #if defined(__BIG_ENDIAN)
  2579. u16 toe_rss_bitmap;
  2580. u16 flags;
  2581. #define RSS_UPDATE_CONFIG_ETH_UPDATE_ENABLE (0x1<<0)
  2582. #define RSS_UPDATE_CONFIG_ETH_UPDATE_ENABLE_SHIFT 0
  2583. #define RSS_UPDATE_CONFIG_TOE_UPDATE_ENABLE (0x1<<1)
  2584. #define RSS_UPDATE_CONFIG_TOE_UPDATE_ENABLE_SHIFT 1
  2585. #define __RSS_UPDATE_CONFIG_RESERVED0 (0x3FFF<<2)
  2586. #define __RSS_UPDATE_CONFIG_RESERVED0_SHIFT 2
  2587. #elif defined(__LITTLE_ENDIAN)
  2588. u16 flags;
  2589. #define RSS_UPDATE_CONFIG_ETH_UPDATE_ENABLE (0x1<<0)
  2590. #define RSS_UPDATE_CONFIG_ETH_UPDATE_ENABLE_SHIFT 0
  2591. #define RSS_UPDATE_CONFIG_TOE_UPDATE_ENABLE (0x1<<1)
  2592. #define RSS_UPDATE_CONFIG_TOE_UPDATE_ENABLE_SHIFT 1
  2593. #define __RSS_UPDATE_CONFIG_RESERVED0 (0x3FFF<<2)
  2594. #define __RSS_UPDATE_CONFIG_RESERVED0_SHIFT 2
  2595. u16 toe_rss_bitmap;
  2596. #endif
  2597. u32 reserved1;
  2598. };
  2599. /*
  2600. * parameters for eth update ramrod
  2601. */
  2602. struct eth_update_ramrod_data {
  2603. struct tstorm_eth_function_common_config func_config;
  2604. u8 indirectionTable[128];
  2605. struct rss_update_config rss_config;
  2606. };
  2607. /*
  2608. * MAC filtering configuration command header
  2609. */
  2610. struct mac_configuration_hdr {
  2611. u8 length;
  2612. u8 offset;
  2613. u16 client_id;
  2614. u16 echo;
  2615. u16 reserved1;
  2616. };
  2617. /*
  2618. * MAC address in list for ramrod
  2619. */
  2620. struct mac_configuration_entry {
  2621. __le16 lsb_mac_addr;
  2622. __le16 middle_mac_addr;
  2623. __le16 msb_mac_addr;
  2624. __le16 vlan_id;
  2625. u8 pf_id;
  2626. u8 flags;
  2627. #define MAC_CONFIGURATION_ENTRY_ACTION_TYPE (0x1<<0)
  2628. #define MAC_CONFIGURATION_ENTRY_ACTION_TYPE_SHIFT 0
  2629. #define MAC_CONFIGURATION_ENTRY_RDMA_MAC (0x1<<1)
  2630. #define MAC_CONFIGURATION_ENTRY_RDMA_MAC_SHIFT 1
  2631. #define MAC_CONFIGURATION_ENTRY_VLAN_FILTERING_MODE (0x3<<2)
  2632. #define MAC_CONFIGURATION_ENTRY_VLAN_FILTERING_MODE_SHIFT 2
  2633. #define MAC_CONFIGURATION_ENTRY_OVERRIDE_VLAN_REMOVAL (0x1<<4)
  2634. #define MAC_CONFIGURATION_ENTRY_OVERRIDE_VLAN_REMOVAL_SHIFT 4
  2635. #define MAC_CONFIGURATION_ENTRY_BROADCAST (0x1<<5)
  2636. #define MAC_CONFIGURATION_ENTRY_BROADCAST_SHIFT 5
  2637. #define MAC_CONFIGURATION_ENTRY_RESERVED1 (0x3<<6)
  2638. #define MAC_CONFIGURATION_ENTRY_RESERVED1_SHIFT 6
  2639. u16 reserved0;
  2640. u32 clients_bit_vector;
  2641. };
  2642. /*
  2643. * MAC filtering configuration command
  2644. */
  2645. struct mac_configuration_cmd {
  2646. struct mac_configuration_hdr hdr;
  2647. struct mac_configuration_entry config_table[64];
  2648. };
  2649. /*
  2650. * approximate-match multicast filtering for E1H per function in Tstorm
  2651. */
  2652. struct tstorm_eth_approximate_match_multicast_filtering {
  2653. u32 mcast_add_hash_bit_array[8];
  2654. };
  2655. /*
  2656. * MAC filtering configuration parameters per port in Tstorm
  2657. */
  2658. struct tstorm_eth_mac_filter_config {
  2659. u32 ucast_drop_all;
  2660. u32 ucast_accept_all;
  2661. u32 mcast_drop_all;
  2662. u32 mcast_accept_all;
  2663. u32 bcast_drop_all;
  2664. u32 bcast_accept_all;
  2665. u32 vlan_filter[2];
  2666. u32 unmatched_unicast;
  2667. u32 reserved;
  2668. };
  2669. /*
  2670. * common flag to indicate existence of TPA.
  2671. */
  2672. struct tstorm_eth_tpa_exist {
  2673. #if defined(__BIG_ENDIAN)
  2674. u16 reserved1;
  2675. u8 reserved0;
  2676. u8 tpa_exist;
  2677. #elif defined(__LITTLE_ENDIAN)
  2678. u8 tpa_exist;
  2679. u8 reserved0;
  2680. u16 reserved1;
  2681. #endif
  2682. u32 reserved2;
  2683. };
  2684. /*
  2685. * Three RX producers for ETH
  2686. */
  2687. struct ustorm_eth_rx_producers {
  2688. #if defined(__BIG_ENDIAN)
  2689. u16 bd_prod;
  2690. u16 cqe_prod;
  2691. #elif defined(__LITTLE_ENDIAN)
  2692. u16 cqe_prod;
  2693. u16 bd_prod;
  2694. #endif
  2695. #if defined(__BIG_ENDIAN)
  2696. u16 reserved;
  2697. u16 sge_prod;
  2698. #elif defined(__LITTLE_ENDIAN)
  2699. u16 sge_prod;
  2700. u16 reserved;
  2701. #endif
  2702. };
  2703. /*
  2704. * cfc delete event data
  2705. */
  2706. struct cfc_del_event_data {
  2707. u32 cid;
  2708. u8 error;
  2709. u8 reserved0;
  2710. u16 reserved1;
  2711. u32 reserved2;
  2712. };
  2713. /*
  2714. * per-port SAFC demo variables
  2715. */
  2716. struct cmng_flags_per_port {
  2717. u8 con_number[NUM_OF_PROTOCOLS];
  2718. u32 cmng_enables;
  2719. #define CMNG_FLAGS_PER_PORT_FAIRNESS_VN (0x1<<0)
  2720. #define CMNG_FLAGS_PER_PORT_FAIRNESS_VN_SHIFT 0
  2721. #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN (0x1<<1)
  2722. #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN_SHIFT 1
  2723. #define CMNG_FLAGS_PER_PORT_FAIRNESS_PROTOCOL (0x1<<2)
  2724. #define CMNG_FLAGS_PER_PORT_FAIRNESS_PROTOCOL_SHIFT 2
  2725. #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_PROTOCOL (0x1<<3)
  2726. #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_PROTOCOL_SHIFT 3
  2727. #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS (0x1<<4)
  2728. #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_SHIFT 4
  2729. #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_MODE (0x1<<5)
  2730. #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_MODE_SHIFT 5
  2731. #define __CMNG_FLAGS_PER_PORT_RESERVED0 (0x3FFFFFF<<6)
  2732. #define __CMNG_FLAGS_PER_PORT_RESERVED0_SHIFT 6
  2733. };
  2734. /*
  2735. * per-port rate shaping variables
  2736. */
  2737. struct rate_shaping_vars_per_port {
  2738. u32 rs_periodic_timeout;
  2739. u32 rs_threshold;
  2740. };
  2741. /*
  2742. * per-port fairness variables
  2743. */
  2744. struct fairness_vars_per_port {
  2745. u32 upper_bound;
  2746. u32 fair_threshold;
  2747. u32 fairness_timeout;
  2748. };
  2749. /*
  2750. * per-port SAFC variables
  2751. */
  2752. struct safc_struct_per_port {
  2753. #if defined(__BIG_ENDIAN)
  2754. u16 __reserved1;
  2755. u8 __reserved0;
  2756. u8 safc_timeout_usec;
  2757. #elif defined(__LITTLE_ENDIAN)
  2758. u8 safc_timeout_usec;
  2759. u8 __reserved0;
  2760. u16 __reserved1;
  2761. #endif
  2762. u8 cos_to_traffic_types[MAX_COS_NUMBER];
  2763. u32 __reserved2;
  2764. u16 cos_to_pause_mask[NUM_OF_SAFC_BITS];
  2765. };
  2766. /*
  2767. * per-port PFC variables
  2768. */
  2769. struct pfc_struct_per_port {
  2770. u8 priority_to_traffic_types[MAX_PFC_PRIORITIES];
  2771. #if defined(__BIG_ENDIAN)
  2772. u16 pfc_pause_quanta_in_nanosec;
  2773. u8 __reserved0;
  2774. u8 priority_non_pausable_mask;
  2775. #elif defined(__LITTLE_ENDIAN)
  2776. u8 priority_non_pausable_mask;
  2777. u8 __reserved0;
  2778. u16 pfc_pause_quanta_in_nanosec;
  2779. #endif
  2780. };
  2781. /*
  2782. * Priority and cos
  2783. */
  2784. struct priority_cos {
  2785. #if defined(__BIG_ENDIAN)
  2786. u16 reserved1;
  2787. u8 cos;
  2788. u8 priority;
  2789. #elif defined(__LITTLE_ENDIAN)
  2790. u8 priority;
  2791. u8 cos;
  2792. u16 reserved1;
  2793. #endif
  2794. u32 reserved2;
  2795. };
  2796. /*
  2797. * Per-port congestion management variables
  2798. */
  2799. struct cmng_struct_per_port {
  2800. struct rate_shaping_vars_per_port rs_vars;
  2801. struct fairness_vars_per_port fair_vars;
  2802. struct safc_struct_per_port safc_vars;
  2803. struct pfc_struct_per_port pfc_vars;
  2804. #if defined(__BIG_ENDIAN)
  2805. u16 __reserved1;
  2806. u8 dcb_enabled;
  2807. u8 llfc_mode;
  2808. #elif defined(__LITTLE_ENDIAN)
  2809. u8 llfc_mode;
  2810. u8 dcb_enabled;
  2811. u16 __reserved1;
  2812. #endif
  2813. struct priority_cos
  2814. traffic_type_to_priority_cos[MAX_PFC_TRAFFIC_TYPES];
  2815. struct cmng_flags_per_port flags;
  2816. };
  2817. /*
  2818. * Dynamic HC counters set by the driver
  2819. */
  2820. struct hc_dynamic_drv_counter {
  2821. u32 val[HC_SB_MAX_DYNAMIC_INDICES];
  2822. };
  2823. /*
  2824. * zone A per-queue data
  2825. */
  2826. struct cstorm_queue_zone_data {
  2827. struct hc_dynamic_drv_counter hc_dyn_drv_cnt;
  2828. struct regpair reserved[2];
  2829. };
  2830. /*
  2831. * Dynamic host coalescing init parameters
  2832. */
  2833. struct dynamic_hc_config {
  2834. u32 threshold[3];
  2835. u8 shift_per_protocol[HC_SB_MAX_DYNAMIC_INDICES];
  2836. u8 hc_timeout0[HC_SB_MAX_DYNAMIC_INDICES];
  2837. u8 hc_timeout1[HC_SB_MAX_DYNAMIC_INDICES];
  2838. u8 hc_timeout2[HC_SB_MAX_DYNAMIC_INDICES];
  2839. u8 hc_timeout3[HC_SB_MAX_DYNAMIC_INDICES];
  2840. };
  2841. /*
  2842. * Protocol-common statistics collected by the Xstorm (per client)
  2843. */
  2844. struct xstorm_per_client_stats {
  2845. __le32 reserved0;
  2846. __le32 unicast_pkts_sent;
  2847. struct regpair unicast_bytes_sent;
  2848. struct regpair multicast_bytes_sent;
  2849. __le32 multicast_pkts_sent;
  2850. __le32 broadcast_pkts_sent;
  2851. struct regpair broadcast_bytes_sent;
  2852. __le16 stats_counter;
  2853. __le16 reserved1;
  2854. __le32 reserved2;
  2855. };
  2856. /*
  2857. * Common statistics collected by the Xstorm (per port)
  2858. */
  2859. struct xstorm_common_stats {
  2860. struct xstorm_per_client_stats client_statistics[MAX_STAT_COUNTER_ID];
  2861. };
  2862. /*
  2863. * Protocol-common statistics collected by the Tstorm (per port)
  2864. */
  2865. struct tstorm_per_port_stats {
  2866. __le32 mac_filter_discard;
  2867. __le32 xxoverflow_discard;
  2868. __le32 brb_truncate_discard;
  2869. __le32 mac_discard;
  2870. };
  2871. /*
  2872. * Protocol-common statistics collected by the Tstorm (per client)
  2873. */
  2874. struct tstorm_per_client_stats {
  2875. struct regpair rcv_unicast_bytes;
  2876. struct regpair rcv_broadcast_bytes;
  2877. struct regpair rcv_multicast_bytes;
  2878. struct regpair rcv_error_bytes;
  2879. __le32 checksum_discard;
  2880. __le32 packets_too_big_discard;
  2881. __le32 rcv_unicast_pkts;
  2882. __le32 rcv_broadcast_pkts;
  2883. __le32 rcv_multicast_pkts;
  2884. __le32 no_buff_discard;
  2885. __le32 ttl0_discard;
  2886. __le16 stats_counter;
  2887. __le16 reserved0;
  2888. };
  2889. /*
  2890. * Protocol-common statistics collected by the Tstorm
  2891. */
  2892. struct tstorm_common_stats {
  2893. struct tstorm_per_port_stats port_statistics;
  2894. struct tstorm_per_client_stats client_statistics[MAX_STAT_COUNTER_ID];
  2895. };
  2896. /*
  2897. * Protocol-common statistics collected by the Ustorm (per client)
  2898. */
  2899. struct ustorm_per_client_stats {
  2900. struct regpair ucast_no_buff_bytes;
  2901. struct regpair mcast_no_buff_bytes;
  2902. struct regpair bcast_no_buff_bytes;
  2903. __le32 ucast_no_buff_pkts;
  2904. __le32 mcast_no_buff_pkts;
  2905. __le32 bcast_no_buff_pkts;
  2906. __le16 stats_counter;
  2907. __le16 reserved0;
  2908. };
  2909. /*
  2910. * Protocol-common statistics collected by the Ustorm
  2911. */
  2912. struct ustorm_common_stats {
  2913. struct ustorm_per_client_stats client_statistics[MAX_STAT_COUNTER_ID];
  2914. };
  2915. /*
  2916. * Eth statistics query structure for the eth_stats_query ramrod
  2917. */
  2918. struct eth_stats_query {
  2919. struct xstorm_common_stats xstorm_common;
  2920. struct tstorm_common_stats tstorm_common;
  2921. struct ustorm_common_stats ustorm_common;
  2922. };
  2923. /*
  2924. * set mac event data
  2925. */
  2926. struct set_mac_event_data {
  2927. u16 echo;
  2928. u16 reserved0;
  2929. u32 reserved1;
  2930. u32 reserved2;
  2931. };
  2932. /*
  2933. * union for all event ring message types
  2934. */
  2935. union event_data {
  2936. struct set_mac_event_data set_mac_event;
  2937. struct cfc_del_event_data cfc_del_event;
  2938. };
  2939. /*
  2940. * per PF event ring data
  2941. */
  2942. struct event_ring_data {
  2943. struct regpair base_addr;
  2944. #if defined(__BIG_ENDIAN)
  2945. u8 index_id;
  2946. u8 sb_id;
  2947. u16 producer;
  2948. #elif defined(__LITTLE_ENDIAN)
  2949. u16 producer;
  2950. u8 sb_id;
  2951. u8 index_id;
  2952. #endif
  2953. u32 reserved0;
  2954. };
  2955. /*
  2956. * event ring message element (each element is 128 bits)
  2957. */
  2958. struct event_ring_msg {
  2959. u8 opcode;
  2960. u8 reserved0;
  2961. u16 reserved1;
  2962. union event_data data;
  2963. };
  2964. /*
  2965. * event ring next page element (128 bits)
  2966. */
  2967. struct event_ring_next {
  2968. struct regpair addr;
  2969. u32 reserved[2];
  2970. };
  2971. /*
  2972. * union for event ring element types (each element is 128 bits)
  2973. */
  2974. union event_ring_elem {
  2975. struct event_ring_msg message;
  2976. struct event_ring_next next_page;
  2977. };
  2978. /*
  2979. * per-vnic fairness variables
  2980. */
  2981. struct fairness_vars_per_vn {
  2982. u32 cos_credit_delta[MAX_COS_NUMBER];
  2983. u32 protocol_credit_delta[NUM_OF_PROTOCOLS];
  2984. u32 vn_credit_delta;
  2985. u32 __reserved0;
  2986. };
  2987. /*
  2988. * The data for flow control configuration
  2989. */
  2990. struct flow_control_configuration {
  2991. struct priority_cos
  2992. traffic_type_to_priority_cos[MAX_PFC_TRAFFIC_TYPES];
  2993. #if defined(__BIG_ENDIAN)
  2994. u16 reserved1;
  2995. u8 dcb_version;
  2996. u8 dcb_enabled;
  2997. #elif defined(__LITTLE_ENDIAN)
  2998. u8 dcb_enabled;
  2999. u8 dcb_version;
  3000. u16 reserved1;
  3001. #endif
  3002. u32 reserved2;
  3003. };
  3004. /*
  3005. * FW version stored in the Xstorm RAM
  3006. */
  3007. struct fw_version {
  3008. #if defined(__BIG_ENDIAN)
  3009. u8 engineering;
  3010. u8 revision;
  3011. u8 minor;
  3012. u8 major;
  3013. #elif defined(__LITTLE_ENDIAN)
  3014. u8 major;
  3015. u8 minor;
  3016. u8 revision;
  3017. u8 engineering;
  3018. #endif
  3019. u32 flags;
  3020. #define FW_VERSION_OPTIMIZED (0x1<<0)
  3021. #define FW_VERSION_OPTIMIZED_SHIFT 0
  3022. #define FW_VERSION_BIG_ENDIEN (0x1<<1)
  3023. #define FW_VERSION_BIG_ENDIEN_SHIFT 1
  3024. #define FW_VERSION_CHIP_VERSION (0x3<<2)
  3025. #define FW_VERSION_CHIP_VERSION_SHIFT 2
  3026. #define __FW_VERSION_RESERVED (0xFFFFFFF<<4)
  3027. #define __FW_VERSION_RESERVED_SHIFT 4
  3028. };
  3029. /*
  3030. * Dynamic Host-Coalescing - Driver(host) counters
  3031. */
  3032. struct hc_dynamic_sb_drv_counters {
  3033. u32 dynamic_hc_drv_counter[HC_SB_MAX_DYNAMIC_INDICES];
  3034. };
  3035. /*
  3036. * 2 bytes. configuration/state parameters for a single protocol index
  3037. */
  3038. struct hc_index_data {
  3039. #if defined(__BIG_ENDIAN)
  3040. u8 flags;
  3041. #define HC_INDEX_DATA_SM_ID (0x1<<0)
  3042. #define HC_INDEX_DATA_SM_ID_SHIFT 0
  3043. #define HC_INDEX_DATA_HC_ENABLED (0x1<<1)
  3044. #define HC_INDEX_DATA_HC_ENABLED_SHIFT 1
  3045. #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED (0x1<<2)
  3046. #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED_SHIFT 2
  3047. #define HC_INDEX_DATA_RESERVE (0x1F<<3)
  3048. #define HC_INDEX_DATA_RESERVE_SHIFT 3
  3049. u8 timeout;
  3050. #elif defined(__LITTLE_ENDIAN)
  3051. u8 timeout;
  3052. u8 flags;
  3053. #define HC_INDEX_DATA_SM_ID (0x1<<0)
  3054. #define HC_INDEX_DATA_SM_ID_SHIFT 0
  3055. #define HC_INDEX_DATA_HC_ENABLED (0x1<<1)
  3056. #define HC_INDEX_DATA_HC_ENABLED_SHIFT 1
  3057. #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED (0x1<<2)
  3058. #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED_SHIFT 2
  3059. #define HC_INDEX_DATA_RESERVE (0x1F<<3)
  3060. #define HC_INDEX_DATA_RESERVE_SHIFT 3
  3061. #endif
  3062. };
  3063. /*
  3064. * HC state-machine
  3065. */
  3066. struct hc_status_block_sm {
  3067. #if defined(__BIG_ENDIAN)
  3068. u8 igu_seg_id;
  3069. u8 igu_sb_id;
  3070. u8 timer_value;
  3071. u8 __flags;
  3072. #elif defined(__LITTLE_ENDIAN)
  3073. u8 __flags;
  3074. u8 timer_value;
  3075. u8 igu_sb_id;
  3076. u8 igu_seg_id;
  3077. #endif
  3078. u32 time_to_expire;
  3079. };
  3080. /*
  3081. * hold PCI identification variables- used in various places in firmware
  3082. */
  3083. struct pci_entity {
  3084. #if defined(__BIG_ENDIAN)
  3085. u8 vf_valid;
  3086. u8 vf_id;
  3087. u8 vnic_id;
  3088. u8 pf_id;
  3089. #elif defined(__LITTLE_ENDIAN)
  3090. u8 pf_id;
  3091. u8 vnic_id;
  3092. u8 vf_id;
  3093. u8 vf_valid;
  3094. #endif
  3095. };
  3096. /*
  3097. * The fast-path status block meta-data, common to all chips
  3098. */
  3099. struct hc_sb_data {
  3100. struct regpair host_sb_addr;
  3101. struct hc_status_block_sm state_machine[HC_SB_MAX_SM];
  3102. struct pci_entity p_func;
  3103. #if defined(__BIG_ENDIAN)
  3104. u8 rsrv0;
  3105. u8 dhc_qzone_id;
  3106. u8 __dynamic_hc_level;
  3107. u8 same_igu_sb_1b;
  3108. #elif defined(__LITTLE_ENDIAN)
  3109. u8 same_igu_sb_1b;
  3110. u8 __dynamic_hc_level;
  3111. u8 dhc_qzone_id;
  3112. u8 rsrv0;
  3113. #endif
  3114. struct regpair rsrv1[2];
  3115. };
  3116. /*
  3117. * The fast-path status block meta-data
  3118. */
  3119. struct hc_sp_status_block_data {
  3120. struct regpair host_sb_addr;
  3121. #if defined(__BIG_ENDIAN)
  3122. u16 rsrv;
  3123. u8 igu_seg_id;
  3124. u8 igu_sb_id;
  3125. #elif defined(__LITTLE_ENDIAN)
  3126. u8 igu_sb_id;
  3127. u8 igu_seg_id;
  3128. u16 rsrv;
  3129. #endif
  3130. struct pci_entity p_func;
  3131. };
  3132. /*
  3133. * The fast-path status block meta-data
  3134. */
  3135. struct hc_status_block_data_e1x {
  3136. struct hc_index_data index_data[HC_SB_MAX_INDICES_E1X];
  3137. struct hc_sb_data common;
  3138. };
  3139. /*
  3140. * The fast-path status block meta-data
  3141. */
  3142. struct hc_status_block_data_e2 {
  3143. struct hc_index_data index_data[HC_SB_MAX_INDICES_E2];
  3144. struct hc_sb_data common;
  3145. };
  3146. /*
  3147. * FW version stored in first line of pram
  3148. */
  3149. struct pram_fw_version {
  3150. u8 major;
  3151. u8 minor;
  3152. u8 revision;
  3153. u8 engineering;
  3154. u8 flags;
  3155. #define PRAM_FW_VERSION_OPTIMIZED (0x1<<0)
  3156. #define PRAM_FW_VERSION_OPTIMIZED_SHIFT 0
  3157. #define PRAM_FW_VERSION_STORM_ID (0x3<<1)
  3158. #define PRAM_FW_VERSION_STORM_ID_SHIFT 1
  3159. #define PRAM_FW_VERSION_BIG_ENDIEN (0x1<<3)
  3160. #define PRAM_FW_VERSION_BIG_ENDIEN_SHIFT 3
  3161. #define PRAM_FW_VERSION_CHIP_VERSION (0x3<<4)
  3162. #define PRAM_FW_VERSION_CHIP_VERSION_SHIFT 4
  3163. #define __PRAM_FW_VERSION_RESERVED0 (0x3<<6)
  3164. #define __PRAM_FW_VERSION_RESERVED0_SHIFT 6
  3165. };
  3166. /*
  3167. * Ethernet slow path element
  3168. */
  3169. union protocol_common_specific_data {
  3170. u8 protocol_data[8];
  3171. struct regpair phy_address;
  3172. struct regpair mac_config_addr;
  3173. struct common_query_ramrod_data query_ramrod_data;
  3174. };
  3175. /*
  3176. * The send queue element
  3177. */
  3178. struct protocol_common_spe {
  3179. struct spe_hdr hdr;
  3180. union protocol_common_specific_data data;
  3181. };
  3182. /*
  3183. * a single rate shaping counter. can be used as protocol or vnic counter
  3184. */
  3185. struct rate_shaping_counter {
  3186. u32 quota;
  3187. #if defined(__BIG_ENDIAN)
  3188. u16 __reserved0;
  3189. u16 rate;
  3190. #elif defined(__LITTLE_ENDIAN)
  3191. u16 rate;
  3192. u16 __reserved0;
  3193. #endif
  3194. };
  3195. /*
  3196. * per-vnic rate shaping variables
  3197. */
  3198. struct rate_shaping_vars_per_vn {
  3199. struct rate_shaping_counter protocol_counters[NUM_OF_PROTOCOLS];
  3200. struct rate_shaping_counter vn_counter;
  3201. };
  3202. /*
  3203. * The send queue element
  3204. */
  3205. struct slow_path_element {
  3206. struct spe_hdr hdr;
  3207. struct regpair protocol_data;
  3208. };
  3209. /*
  3210. * eth/toe flags that indicate if to query
  3211. */
  3212. struct stats_indication_flags {
  3213. u32 collect_eth;
  3214. u32 collect_toe;
  3215. };
  3216. /*
  3217. * per-port PFC variables
  3218. */
  3219. struct storm_pfc_struct_per_port {
  3220. #if defined(__BIG_ENDIAN)
  3221. u16 mid_mac_addr;
  3222. u16 msb_mac_addr;
  3223. #elif defined(__LITTLE_ENDIAN)
  3224. u16 msb_mac_addr;
  3225. u16 mid_mac_addr;
  3226. #endif
  3227. #if defined(__BIG_ENDIAN)
  3228. u16 pfc_pause_quanta_in_nanosec;
  3229. u16 lsb_mac_addr;
  3230. #elif defined(__LITTLE_ENDIAN)
  3231. u16 lsb_mac_addr;
  3232. u16 pfc_pause_quanta_in_nanosec;
  3233. #endif
  3234. };
  3235. /*
  3236. * Per-port congestion management variables
  3237. */
  3238. struct storm_cmng_struct_per_port {
  3239. struct storm_pfc_struct_per_port pfc_vars;
  3240. };
  3241. /*
  3242. * zone A per-queue data
  3243. */
  3244. struct tstorm_queue_zone_data {
  3245. struct regpair reserved[4];
  3246. };
  3247. /*
  3248. * zone B per-VF data
  3249. */
  3250. struct tstorm_vf_zone_data {
  3251. struct regpair reserved;
  3252. };
  3253. /*
  3254. * zone A per-queue data
  3255. */
  3256. struct ustorm_queue_zone_data {
  3257. struct ustorm_eth_rx_producers eth_rx_producers;
  3258. struct regpair reserved[3];
  3259. };
  3260. /*
  3261. * zone B per-VF data
  3262. */
  3263. struct ustorm_vf_zone_data {
  3264. struct regpair reserved;
  3265. };
  3266. /*
  3267. * data per VF-PF channel
  3268. */
  3269. struct vf_pf_channel_data {
  3270. #if defined(__BIG_ENDIAN)
  3271. u16 reserved0;
  3272. u8 valid;
  3273. u8 state;
  3274. #elif defined(__LITTLE_ENDIAN)
  3275. u8 state;
  3276. u8 valid;
  3277. u16 reserved0;
  3278. #endif
  3279. u32 reserved1;
  3280. };
  3281. /*
  3282. * zone A per-queue data
  3283. */
  3284. struct xstorm_queue_zone_data {
  3285. struct regpair reserved[4];
  3286. };
  3287. /*
  3288. * zone B per-VF data
  3289. */
  3290. struct xstorm_vf_zone_data {
  3291. struct regpair reserved;
  3292. };
  3293. #endif /* BNX2X_HSI_H */