bnx2x_hsi.h 184 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032
  1. /* bnx2x_hsi.h: Qlogic Everest network driver.
  2. *
  3. * Copyright (c) 2007-2013 Broadcom Corporation
  4. * Copyright (c) 2014 QLogic Corporation
  5. * All rights reserved
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation.
  10. */
  11. #ifndef BNX2X_HSI_H
  12. #define BNX2X_HSI_H
  13. #include "bnx2x_fw_defs.h"
  14. #include "bnx2x_mfw_req.h"
  15. #define FW_ENCODE_32BIT_PATTERN 0x1e1e1e1e
  16. struct license_key {
  17. u32 reserved[6];
  18. u32 max_iscsi_conn;
  19. #define BNX2X_MAX_ISCSI_TRGT_CONN_MASK 0xFFFF
  20. #define BNX2X_MAX_ISCSI_TRGT_CONN_SHIFT 0
  21. #define BNX2X_MAX_ISCSI_INIT_CONN_MASK 0xFFFF0000
  22. #define BNX2X_MAX_ISCSI_INIT_CONN_SHIFT 16
  23. u32 reserved_a;
  24. u32 max_fcoe_conn;
  25. #define BNX2X_MAX_FCOE_TRGT_CONN_MASK 0xFFFF
  26. #define BNX2X_MAX_FCOE_TRGT_CONN_SHIFT 0
  27. #define BNX2X_MAX_FCOE_INIT_CONN_MASK 0xFFFF0000
  28. #define BNX2X_MAX_FCOE_INIT_CONN_SHIFT 16
  29. u32 reserved_b[4];
  30. };
  31. /****************************************************************************
  32. * Shared HW configuration *
  33. ****************************************************************************/
  34. #define PIN_CFG_NA 0x00000000
  35. #define PIN_CFG_GPIO0_P0 0x00000001
  36. #define PIN_CFG_GPIO1_P0 0x00000002
  37. #define PIN_CFG_GPIO2_P0 0x00000003
  38. #define PIN_CFG_GPIO3_P0 0x00000004
  39. #define PIN_CFG_GPIO0_P1 0x00000005
  40. #define PIN_CFG_GPIO1_P1 0x00000006
  41. #define PIN_CFG_GPIO2_P1 0x00000007
  42. #define PIN_CFG_GPIO3_P1 0x00000008
  43. #define PIN_CFG_EPIO0 0x00000009
  44. #define PIN_CFG_EPIO1 0x0000000a
  45. #define PIN_CFG_EPIO2 0x0000000b
  46. #define PIN_CFG_EPIO3 0x0000000c
  47. #define PIN_CFG_EPIO4 0x0000000d
  48. #define PIN_CFG_EPIO5 0x0000000e
  49. #define PIN_CFG_EPIO6 0x0000000f
  50. #define PIN_CFG_EPIO7 0x00000010
  51. #define PIN_CFG_EPIO8 0x00000011
  52. #define PIN_CFG_EPIO9 0x00000012
  53. #define PIN_CFG_EPIO10 0x00000013
  54. #define PIN_CFG_EPIO11 0x00000014
  55. #define PIN_CFG_EPIO12 0x00000015
  56. #define PIN_CFG_EPIO13 0x00000016
  57. #define PIN_CFG_EPIO14 0x00000017
  58. #define PIN_CFG_EPIO15 0x00000018
  59. #define PIN_CFG_EPIO16 0x00000019
  60. #define PIN_CFG_EPIO17 0x0000001a
  61. #define PIN_CFG_EPIO18 0x0000001b
  62. #define PIN_CFG_EPIO19 0x0000001c
  63. #define PIN_CFG_EPIO20 0x0000001d
  64. #define PIN_CFG_EPIO21 0x0000001e
  65. #define PIN_CFG_EPIO22 0x0000001f
  66. #define PIN_CFG_EPIO23 0x00000020
  67. #define PIN_CFG_EPIO24 0x00000021
  68. #define PIN_CFG_EPIO25 0x00000022
  69. #define PIN_CFG_EPIO26 0x00000023
  70. #define PIN_CFG_EPIO27 0x00000024
  71. #define PIN_CFG_EPIO28 0x00000025
  72. #define PIN_CFG_EPIO29 0x00000026
  73. #define PIN_CFG_EPIO30 0x00000027
  74. #define PIN_CFG_EPIO31 0x00000028
  75. /* EPIO definition */
  76. #define EPIO_CFG_NA 0x00000000
  77. #define EPIO_CFG_EPIO0 0x00000001
  78. #define EPIO_CFG_EPIO1 0x00000002
  79. #define EPIO_CFG_EPIO2 0x00000003
  80. #define EPIO_CFG_EPIO3 0x00000004
  81. #define EPIO_CFG_EPIO4 0x00000005
  82. #define EPIO_CFG_EPIO5 0x00000006
  83. #define EPIO_CFG_EPIO6 0x00000007
  84. #define EPIO_CFG_EPIO7 0x00000008
  85. #define EPIO_CFG_EPIO8 0x00000009
  86. #define EPIO_CFG_EPIO9 0x0000000a
  87. #define EPIO_CFG_EPIO10 0x0000000b
  88. #define EPIO_CFG_EPIO11 0x0000000c
  89. #define EPIO_CFG_EPIO12 0x0000000d
  90. #define EPIO_CFG_EPIO13 0x0000000e
  91. #define EPIO_CFG_EPIO14 0x0000000f
  92. #define EPIO_CFG_EPIO15 0x00000010
  93. #define EPIO_CFG_EPIO16 0x00000011
  94. #define EPIO_CFG_EPIO17 0x00000012
  95. #define EPIO_CFG_EPIO18 0x00000013
  96. #define EPIO_CFG_EPIO19 0x00000014
  97. #define EPIO_CFG_EPIO20 0x00000015
  98. #define EPIO_CFG_EPIO21 0x00000016
  99. #define EPIO_CFG_EPIO22 0x00000017
  100. #define EPIO_CFG_EPIO23 0x00000018
  101. #define EPIO_CFG_EPIO24 0x00000019
  102. #define EPIO_CFG_EPIO25 0x0000001a
  103. #define EPIO_CFG_EPIO26 0x0000001b
  104. #define EPIO_CFG_EPIO27 0x0000001c
  105. #define EPIO_CFG_EPIO28 0x0000001d
  106. #define EPIO_CFG_EPIO29 0x0000001e
  107. #define EPIO_CFG_EPIO30 0x0000001f
  108. #define EPIO_CFG_EPIO31 0x00000020
  109. struct mac_addr {
  110. u32 upper;
  111. u32 lower;
  112. };
  113. struct shared_hw_cfg { /* NVRAM Offset */
  114. /* Up to 16 bytes of NULL-terminated string */
  115. u8 part_num[16]; /* 0x104 */
  116. u32 config; /* 0x114 */
  117. #define SHARED_HW_CFG_MDIO_VOLTAGE_MASK 0x00000001
  118. #define SHARED_HW_CFG_MDIO_VOLTAGE_SHIFT 0
  119. #define SHARED_HW_CFG_MDIO_VOLTAGE_1_2V 0x00000000
  120. #define SHARED_HW_CFG_MDIO_VOLTAGE_2_5V 0x00000001
  121. #define SHARED_HW_CFG_MCP_RST_ON_CORE_RST_EN 0x00000002
  122. #define SHARED_HW_CFG_PORT_SWAP 0x00000004
  123. #define SHARED_HW_CFG_BEACON_WOL_EN 0x00000008
  124. #define SHARED_HW_CFG_PCIE_GEN3_DISABLED 0x00000000
  125. #define SHARED_HW_CFG_PCIE_GEN3_ENABLED 0x00000010
  126. #define SHARED_HW_CFG_MFW_SELECT_MASK 0x00000700
  127. #define SHARED_HW_CFG_MFW_SELECT_SHIFT 8
  128. /* Whatever MFW found in NVM
  129. (if multiple found, priority order is: NC-SI, UMP, IPMI) */
  130. #define SHARED_HW_CFG_MFW_SELECT_DEFAULT 0x00000000
  131. #define SHARED_HW_CFG_MFW_SELECT_NC_SI 0x00000100
  132. #define SHARED_HW_CFG_MFW_SELECT_UMP 0x00000200
  133. #define SHARED_HW_CFG_MFW_SELECT_IPMI 0x00000300
  134. /* Use SPIO4 as an arbiter between: 0-NC_SI, 1-IPMI
  135. (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
  136. #define SHARED_HW_CFG_MFW_SELECT_SPIO4_NC_SI_IPMI 0x00000400
  137. /* Use SPIO4 as an arbiter between: 0-UMP, 1-IPMI
  138. (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
  139. #define SHARED_HW_CFG_MFW_SELECT_SPIO4_UMP_IPMI 0x00000500
  140. /* Use SPIO4 as an arbiter between: 0-NC-SI, 1-UMP
  141. (can only be used when an add-in board, not BMC, pulls-down SPIO4) */
  142. #define SHARED_HW_CFG_MFW_SELECT_SPIO4_NC_SI_UMP 0x00000600
  143. #define SHARED_HW_CFG_LED_MODE_MASK 0x000f0000
  144. #define SHARED_HW_CFG_LED_MODE_SHIFT 16
  145. #define SHARED_HW_CFG_LED_MAC1 0x00000000
  146. #define SHARED_HW_CFG_LED_PHY1 0x00010000
  147. #define SHARED_HW_CFG_LED_PHY2 0x00020000
  148. #define SHARED_HW_CFG_LED_PHY3 0x00030000
  149. #define SHARED_HW_CFG_LED_MAC2 0x00040000
  150. #define SHARED_HW_CFG_LED_PHY4 0x00050000
  151. #define SHARED_HW_CFG_LED_PHY5 0x00060000
  152. #define SHARED_HW_CFG_LED_PHY6 0x00070000
  153. #define SHARED_HW_CFG_LED_MAC3 0x00080000
  154. #define SHARED_HW_CFG_LED_PHY7 0x00090000
  155. #define SHARED_HW_CFG_LED_PHY9 0x000a0000
  156. #define SHARED_HW_CFG_LED_PHY11 0x000b0000
  157. #define SHARED_HW_CFG_LED_MAC4 0x000c0000
  158. #define SHARED_HW_CFG_LED_PHY8 0x000d0000
  159. #define SHARED_HW_CFG_LED_EXTPHY1 0x000e0000
  160. #define SHARED_HW_CFG_LED_EXTPHY2 0x000f0000
  161. #define SHARED_HW_CFG_AN_ENABLE_MASK 0x3f000000
  162. #define SHARED_HW_CFG_AN_ENABLE_SHIFT 24
  163. #define SHARED_HW_CFG_AN_ENABLE_CL37 0x01000000
  164. #define SHARED_HW_CFG_AN_ENABLE_CL73 0x02000000
  165. #define SHARED_HW_CFG_AN_ENABLE_BAM 0x04000000
  166. #define SHARED_HW_CFG_AN_ENABLE_PARALLEL_DETECTION 0x08000000
  167. #define SHARED_HW_CFG_AN_EN_SGMII_FIBER_AUTO_DETECT 0x10000000
  168. #define SHARED_HW_CFG_AN_ENABLE_REMOTE_PHY 0x20000000
  169. #define SHARED_HW_CFG_SRIOV_MASK 0x40000000
  170. #define SHARED_HW_CFG_SRIOV_DISABLED 0x00000000
  171. #define SHARED_HW_CFG_SRIOV_ENABLED 0x40000000
  172. #define SHARED_HW_CFG_ATC_MASK 0x80000000
  173. #define SHARED_HW_CFG_ATC_DISABLED 0x00000000
  174. #define SHARED_HW_CFG_ATC_ENABLED 0x80000000
  175. u32 config2; /* 0x118 */
  176. /* one time auto detect grace period (in sec) */
  177. #define SHARED_HW_CFG_GRACE_PERIOD_MASK 0x000000ff
  178. #define SHARED_HW_CFG_GRACE_PERIOD_SHIFT 0
  179. #define SHARED_HW_CFG_PCIE_GEN2_ENABLED 0x00000100
  180. #define SHARED_HW_CFG_PCIE_GEN2_DISABLED 0x00000000
  181. /* The default value for the core clock is 250MHz and it is
  182. achieved by setting the clock change to 4 */
  183. #define SHARED_HW_CFG_CLOCK_CHANGE_MASK 0x00000e00
  184. #define SHARED_HW_CFG_CLOCK_CHANGE_SHIFT 9
  185. #define SHARED_HW_CFG_SMBUS_TIMING_MASK 0x00001000
  186. #define SHARED_HW_CFG_SMBUS_TIMING_100KHZ 0x00000000
  187. #define SHARED_HW_CFG_SMBUS_TIMING_400KHZ 0x00001000
  188. #define SHARED_HW_CFG_HIDE_PORT1 0x00002000
  189. #define SHARED_HW_CFG_WOL_CAPABLE_MASK 0x00004000
  190. #define SHARED_HW_CFG_WOL_CAPABLE_DISABLED 0x00000000
  191. #define SHARED_HW_CFG_WOL_CAPABLE_ENABLED 0x00004000
  192. /* Output low when PERST is asserted */
  193. #define SHARED_HW_CFG_SPIO4_FOLLOW_PERST_MASK 0x00008000
  194. #define SHARED_HW_CFG_SPIO4_FOLLOW_PERST_DISABLED 0x00000000
  195. #define SHARED_HW_CFG_SPIO4_FOLLOW_PERST_ENABLED 0x00008000
  196. #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_MASK 0x00070000
  197. #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_SHIFT 16
  198. #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_HW 0x00000000
  199. #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_0DB 0x00010000
  200. #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_3_5DB 0x00020000
  201. #define SHARED_HW_CFG_PCIE_GEN2_PREEMPHASIS_6_0DB 0x00030000
  202. /* The fan failure mechanism is usually related to the PHY type
  203. since the power consumption of the board is determined by the PHY.
  204. Currently, fan is required for most designs with SFX7101, BCM8727
  205. and BCM8481. If a fan is not required for a board which uses one
  206. of those PHYs, this field should be set to "Disabled". If a fan is
  207. required for a different PHY type, this option should be set to
  208. "Enabled". The fan failure indication is expected on SPIO5 */
  209. #define SHARED_HW_CFG_FAN_FAILURE_MASK 0x00180000
  210. #define SHARED_HW_CFG_FAN_FAILURE_SHIFT 19
  211. #define SHARED_HW_CFG_FAN_FAILURE_PHY_TYPE 0x00000000
  212. #define SHARED_HW_CFG_FAN_FAILURE_DISABLED 0x00080000
  213. #define SHARED_HW_CFG_FAN_FAILURE_ENABLED 0x00100000
  214. /* ASPM Power Management support */
  215. #define SHARED_HW_CFG_ASPM_SUPPORT_MASK 0x00600000
  216. #define SHARED_HW_CFG_ASPM_SUPPORT_SHIFT 21
  217. #define SHARED_HW_CFG_ASPM_SUPPORT_L0S_L1_ENABLED 0x00000000
  218. #define SHARED_HW_CFG_ASPM_SUPPORT_L0S_DISABLED 0x00200000
  219. #define SHARED_HW_CFG_ASPM_SUPPORT_L1_DISABLED 0x00400000
  220. #define SHARED_HW_CFG_ASPM_SUPPORT_L0S_L1_DISABLED 0x00600000
  221. /* The value of PM_TL_IGNORE_REQS (bit0) in PCI register
  222. tl_control_0 (register 0x2800) */
  223. #define SHARED_HW_CFG_PREVENT_L1_ENTRY_MASK 0x00800000
  224. #define SHARED_HW_CFG_PREVENT_L1_ENTRY_DISABLED 0x00000000
  225. #define SHARED_HW_CFG_PREVENT_L1_ENTRY_ENABLED 0x00800000
  226. #define SHARED_HW_CFG_PORT_MODE_MASK 0x01000000
  227. #define SHARED_HW_CFG_PORT_MODE_2 0x00000000
  228. #define SHARED_HW_CFG_PORT_MODE_4 0x01000000
  229. #define SHARED_HW_CFG_PATH_SWAP_MASK 0x02000000
  230. #define SHARED_HW_CFG_PATH_SWAP_DISABLED 0x00000000
  231. #define SHARED_HW_CFG_PATH_SWAP_ENABLED 0x02000000
  232. /* Set the MDC/MDIO access for the first external phy */
  233. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_MASK 0x1C000000
  234. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_SHIFT 26
  235. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_PHY_TYPE 0x00000000
  236. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_EMAC0 0x04000000
  237. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_EMAC1 0x08000000
  238. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_BOTH 0x0c000000
  239. #define SHARED_HW_CFG_MDC_MDIO_ACCESS1_SWAPPED 0x10000000
  240. /* Set the MDC/MDIO access for the second external phy */
  241. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_MASK 0xE0000000
  242. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_SHIFT 29
  243. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_PHY_TYPE 0x00000000
  244. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_EMAC0 0x20000000
  245. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_EMAC1 0x40000000
  246. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_BOTH 0x60000000
  247. #define SHARED_HW_CFG_MDC_MDIO_ACCESS2_SWAPPED 0x80000000
  248. u32 config_3; /* 0x11C */
  249. #define SHARED_HW_CFG_EXTENDED_MF_MODE_MASK 0x00000F00
  250. #define SHARED_HW_CFG_EXTENDED_MF_MODE_SHIFT 8
  251. #define SHARED_HW_CFG_EXTENDED_MF_MODE_NPAR1_DOT_5 0x00000000
  252. #define SHARED_HW_CFG_EXTENDED_MF_MODE_NPAR2_DOT_0 0x00000100
  253. u32 ump_nc_si_config; /* 0x120 */
  254. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MASK 0x00000003
  255. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_SHIFT 0
  256. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MAC 0x00000000
  257. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_PHY 0x00000001
  258. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_MII 0x00000000
  259. #define SHARED_HW_CFG_UMP_NC_SI_MII_MODE_RMII 0x00000002
  260. #define SHARED_HW_CFG_UMP_NC_SI_NUM_DEVS_MASK 0x00000f00
  261. #define SHARED_HW_CFG_UMP_NC_SI_NUM_DEVS_SHIFT 8
  262. #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_MASK 0x00ff0000
  263. #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_SHIFT 16
  264. #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_NONE 0x00000000
  265. #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_BCM5221 0x00010000
  266. u32 board; /* 0x124 */
  267. #define SHARED_HW_CFG_E3_I2C_MUX0_MASK 0x0000003F
  268. #define SHARED_HW_CFG_E3_I2C_MUX0_SHIFT 0
  269. #define SHARED_HW_CFG_E3_I2C_MUX1_MASK 0x00000FC0
  270. #define SHARED_HW_CFG_E3_I2C_MUX1_SHIFT 6
  271. /* Use the PIN_CFG_XXX defines on top */
  272. #define SHARED_HW_CFG_BOARD_REV_MASK 0x00ff0000
  273. #define SHARED_HW_CFG_BOARD_REV_SHIFT 16
  274. #define SHARED_HW_CFG_BOARD_MAJOR_VER_MASK 0x0f000000
  275. #define SHARED_HW_CFG_BOARD_MAJOR_VER_SHIFT 24
  276. #define SHARED_HW_CFG_BOARD_MINOR_VER_MASK 0xf0000000
  277. #define SHARED_HW_CFG_BOARD_MINOR_VER_SHIFT 28
  278. u32 wc_lane_config; /* 0x128 */
  279. #define SHARED_HW_CFG_LANE_SWAP_CFG_MASK 0x0000FFFF
  280. #define SHARED_HW_CFG_LANE_SWAP_CFG_SHIFT 0
  281. #define SHARED_HW_CFG_LANE_SWAP_CFG_32103210 0x00001b1b
  282. #define SHARED_HW_CFG_LANE_SWAP_CFG_32100123 0x00001be4
  283. #define SHARED_HW_CFG_LANE_SWAP_CFG_01233210 0x0000e41b
  284. #define SHARED_HW_CFG_LANE_SWAP_CFG_01230123 0x0000e4e4
  285. #define SHARED_HW_CFG_LANE_SWAP_CFG_TX_MASK 0x000000FF
  286. #define SHARED_HW_CFG_LANE_SWAP_CFG_TX_SHIFT 0
  287. #define SHARED_HW_CFG_LANE_SWAP_CFG_RX_MASK 0x0000FF00
  288. #define SHARED_HW_CFG_LANE_SWAP_CFG_RX_SHIFT 8
  289. /* TX lane Polarity swap */
  290. #define SHARED_HW_CFG_TX_LANE0_POL_FLIP_ENABLED 0x00010000
  291. #define SHARED_HW_CFG_TX_LANE1_POL_FLIP_ENABLED 0x00020000
  292. #define SHARED_HW_CFG_TX_LANE2_POL_FLIP_ENABLED 0x00040000
  293. #define SHARED_HW_CFG_TX_LANE3_POL_FLIP_ENABLED 0x00080000
  294. /* TX lane Polarity swap */
  295. #define SHARED_HW_CFG_RX_LANE0_POL_FLIP_ENABLED 0x00100000
  296. #define SHARED_HW_CFG_RX_LANE1_POL_FLIP_ENABLED 0x00200000
  297. #define SHARED_HW_CFG_RX_LANE2_POL_FLIP_ENABLED 0x00400000
  298. #define SHARED_HW_CFG_RX_LANE3_POL_FLIP_ENABLED 0x00800000
  299. /* Selects the port layout of the board */
  300. #define SHARED_HW_CFG_E3_PORT_LAYOUT_MASK 0x0F000000
  301. #define SHARED_HW_CFG_E3_PORT_LAYOUT_SHIFT 24
  302. #define SHARED_HW_CFG_E3_PORT_LAYOUT_2P_01 0x00000000
  303. #define SHARED_HW_CFG_E3_PORT_LAYOUT_2P_10 0x01000000
  304. #define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_0123 0x02000000
  305. #define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_1032 0x03000000
  306. #define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_2301 0x04000000
  307. #define SHARED_HW_CFG_E3_PORT_LAYOUT_4P_3210 0x05000000
  308. };
  309. /****************************************************************************
  310. * Port HW configuration *
  311. ****************************************************************************/
  312. struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */
  313. u32 pci_id;
  314. #define PORT_HW_CFG_PCI_VENDOR_ID_MASK 0xffff0000
  315. #define PORT_HW_CFG_PCI_DEVICE_ID_MASK 0x0000ffff
  316. u32 pci_sub_id;
  317. #define PORT_HW_CFG_PCI_SUBSYS_DEVICE_ID_MASK 0xffff0000
  318. #define PORT_HW_CFG_PCI_SUBSYS_VENDOR_ID_MASK 0x0000ffff
  319. u32 power_dissipated;
  320. #define PORT_HW_CFG_POWER_DIS_D0_MASK 0x000000ff
  321. #define PORT_HW_CFG_POWER_DIS_D0_SHIFT 0
  322. #define PORT_HW_CFG_POWER_DIS_D1_MASK 0x0000ff00
  323. #define PORT_HW_CFG_POWER_DIS_D1_SHIFT 8
  324. #define PORT_HW_CFG_POWER_DIS_D2_MASK 0x00ff0000
  325. #define PORT_HW_CFG_POWER_DIS_D2_SHIFT 16
  326. #define PORT_HW_CFG_POWER_DIS_D3_MASK 0xff000000
  327. #define PORT_HW_CFG_POWER_DIS_D3_SHIFT 24
  328. u32 power_consumed;
  329. #define PORT_HW_CFG_POWER_CONS_D0_MASK 0x000000ff
  330. #define PORT_HW_CFG_POWER_CONS_D0_SHIFT 0
  331. #define PORT_HW_CFG_POWER_CONS_D1_MASK 0x0000ff00
  332. #define PORT_HW_CFG_POWER_CONS_D1_SHIFT 8
  333. #define PORT_HW_CFG_POWER_CONS_D2_MASK 0x00ff0000
  334. #define PORT_HW_CFG_POWER_CONS_D2_SHIFT 16
  335. #define PORT_HW_CFG_POWER_CONS_D3_MASK 0xff000000
  336. #define PORT_HW_CFG_POWER_CONS_D3_SHIFT 24
  337. u32 mac_upper;
  338. #define PORT_HW_CFG_UPPERMAC_MASK 0x0000ffff
  339. #define PORT_HW_CFG_UPPERMAC_SHIFT 0
  340. u32 mac_lower;
  341. u32 iscsi_mac_upper; /* Upper 16 bits are always zeroes */
  342. u32 iscsi_mac_lower;
  343. u32 rdma_mac_upper; /* Upper 16 bits are always zeroes */
  344. u32 rdma_mac_lower;
  345. u32 serdes_config;
  346. #define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_MASK 0x0000ffff
  347. #define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_SHIFT 0
  348. #define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_MASK 0xffff0000
  349. #define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_SHIFT 16
  350. /* Default values: 2P-64, 4P-32 */
  351. u32 pf_config; /* 0x158 */
  352. #define PORT_HW_CFG_PF_NUM_VF_MASK 0x0000007F
  353. #define PORT_HW_CFG_PF_NUM_VF_SHIFT 0
  354. /* Default values: 17 */
  355. #define PORT_HW_CFG_PF_NUM_MSIX_VECTORS_MASK 0x00007F00
  356. #define PORT_HW_CFG_PF_NUM_MSIX_VECTORS_SHIFT 8
  357. #define PORT_HW_CFG_ENABLE_FLR_MASK 0x00010000
  358. #define PORT_HW_CFG_FLR_ENABLED 0x00010000
  359. u32 vf_config; /* 0x15C */
  360. #define PORT_HW_CFG_VF_NUM_MSIX_VECTORS_MASK 0x0000007F
  361. #define PORT_HW_CFG_VF_NUM_MSIX_VECTORS_SHIFT 0
  362. #define PORT_HW_CFG_VF_PCI_DEVICE_ID_MASK 0xFFFF0000
  363. #define PORT_HW_CFG_VF_PCI_DEVICE_ID_SHIFT 16
  364. u32 mf_pci_id; /* 0x160 */
  365. #define PORT_HW_CFG_MF_PCI_DEVICE_ID_MASK 0x0000FFFF
  366. #define PORT_HW_CFG_MF_PCI_DEVICE_ID_SHIFT 0
  367. /* Controls the TX laser of the SFP+ module */
  368. u32 sfp_ctrl; /* 0x164 */
  369. #define PORT_HW_CFG_TX_LASER_MASK 0x000000FF
  370. #define PORT_HW_CFG_TX_LASER_SHIFT 0
  371. #define PORT_HW_CFG_TX_LASER_MDIO 0x00000000
  372. #define PORT_HW_CFG_TX_LASER_GPIO0 0x00000001
  373. #define PORT_HW_CFG_TX_LASER_GPIO1 0x00000002
  374. #define PORT_HW_CFG_TX_LASER_GPIO2 0x00000003
  375. #define PORT_HW_CFG_TX_LASER_GPIO3 0x00000004
  376. /* Controls the fault module LED of the SFP+ */
  377. #define PORT_HW_CFG_FAULT_MODULE_LED_MASK 0x0000FF00
  378. #define PORT_HW_CFG_FAULT_MODULE_LED_SHIFT 8
  379. #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO0 0x00000000
  380. #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO1 0x00000100
  381. #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO2 0x00000200
  382. #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO3 0x00000300
  383. #define PORT_HW_CFG_FAULT_MODULE_LED_DISABLED 0x00000400
  384. /* The output pin TX_DIS that controls the TX laser of the SFP+
  385. module. Use the PIN_CFG_XXX defines on top */
  386. u32 e3_sfp_ctrl; /* 0x168 */
  387. #define PORT_HW_CFG_E3_TX_LASER_MASK 0x000000FF
  388. #define PORT_HW_CFG_E3_TX_LASER_SHIFT 0
  389. /* The output pin for SFPP_TYPE which turns on the Fault module LED */
  390. #define PORT_HW_CFG_E3_FAULT_MDL_LED_MASK 0x0000FF00
  391. #define PORT_HW_CFG_E3_FAULT_MDL_LED_SHIFT 8
  392. /* The input pin MOD_ABS that indicates whether SFP+ module is
  393. present or not. Use the PIN_CFG_XXX defines on top */
  394. #define PORT_HW_CFG_E3_MOD_ABS_MASK 0x00FF0000
  395. #define PORT_HW_CFG_E3_MOD_ABS_SHIFT 16
  396. /* The output pin PWRDIS_SFP_X which disable the power of the SFP+
  397. module. Use the PIN_CFG_XXX defines on top */
  398. #define PORT_HW_CFG_E3_PWR_DIS_MASK 0xFF000000
  399. #define PORT_HW_CFG_E3_PWR_DIS_SHIFT 24
  400. /*
  401. * The input pin which signals module transmit fault. Use the
  402. * PIN_CFG_XXX defines on top
  403. */
  404. u32 e3_cmn_pin_cfg; /* 0x16C */
  405. #define PORT_HW_CFG_E3_TX_FAULT_MASK 0x000000FF
  406. #define PORT_HW_CFG_E3_TX_FAULT_SHIFT 0
  407. /* The output pin which reset the PHY. Use the PIN_CFG_XXX defines on
  408. top */
  409. #define PORT_HW_CFG_E3_PHY_RESET_MASK 0x0000FF00
  410. #define PORT_HW_CFG_E3_PHY_RESET_SHIFT 8
  411. /*
  412. * The output pin which powers down the PHY. Use the PIN_CFG_XXX
  413. * defines on top
  414. */
  415. #define PORT_HW_CFG_E3_PWR_DOWN_MASK 0x00FF0000
  416. #define PORT_HW_CFG_E3_PWR_DOWN_SHIFT 16
  417. /* The output pin values BSC_SEL which selects the I2C for this port
  418. in the I2C Mux */
  419. #define PORT_HW_CFG_E3_I2C_MUX0_MASK 0x01000000
  420. #define PORT_HW_CFG_E3_I2C_MUX1_MASK 0x02000000
  421. /*
  422. * The input pin I_FAULT which indicate over-current has occurred.
  423. * Use the PIN_CFG_XXX defines on top
  424. */
  425. u32 e3_cmn_pin_cfg1; /* 0x170 */
  426. #define PORT_HW_CFG_E3_OVER_CURRENT_MASK 0x000000FF
  427. #define PORT_HW_CFG_E3_OVER_CURRENT_SHIFT 0
  428. /* pause on host ring */
  429. u32 generic_features; /* 0x174 */
  430. #define PORT_HW_CFG_PAUSE_ON_HOST_RING_MASK 0x00000001
  431. #define PORT_HW_CFG_PAUSE_ON_HOST_RING_SHIFT 0
  432. #define PORT_HW_CFG_PAUSE_ON_HOST_RING_DISABLED 0x00000000
  433. #define PORT_HW_CFG_PAUSE_ON_HOST_RING_ENABLED 0x00000001
  434. /* SFP+ Tx Equalization: NIC recommended and tested value is 0xBEB2
  435. * LOM recommended and tested value is 0xBEB2. Using a different
  436. * value means using a value not tested by BRCM
  437. */
  438. u32 sfi_tap_values; /* 0x178 */
  439. #define PORT_HW_CFG_TX_EQUALIZATION_MASK 0x0000FFFF
  440. #define PORT_HW_CFG_TX_EQUALIZATION_SHIFT 0
  441. /* SFP+ Tx driver broadcast IDRIVER: NIC recommended and tested
  442. * value is 0x2. LOM recommended and tested value is 0x2. Using a
  443. * different value means using a value not tested by BRCM
  444. */
  445. #define PORT_HW_CFG_TX_DRV_BROADCAST_MASK 0x000F0000
  446. #define PORT_HW_CFG_TX_DRV_BROADCAST_SHIFT 16
  447. /* Set non-default values for TXFIR in SFP mode. */
  448. #define PORT_HW_CFG_TX_DRV_IFIR_MASK 0x00F00000
  449. #define PORT_HW_CFG_TX_DRV_IFIR_SHIFT 20
  450. /* Set non-default values for IPREDRIVER in SFP mode. */
  451. #define PORT_HW_CFG_TX_DRV_IPREDRIVER_MASK 0x0F000000
  452. #define PORT_HW_CFG_TX_DRV_IPREDRIVER_SHIFT 24
  453. /* Set non-default values for POST2 in SFP mode. */
  454. #define PORT_HW_CFG_TX_DRV_POST2_MASK 0xF0000000
  455. #define PORT_HW_CFG_TX_DRV_POST2_SHIFT 28
  456. u32 reserved0[5]; /* 0x17c */
  457. u32 aeu_int_mask; /* 0x190 */
  458. u32 media_type; /* 0x194 */
  459. #define PORT_HW_CFG_MEDIA_TYPE_PHY0_MASK 0x000000FF
  460. #define PORT_HW_CFG_MEDIA_TYPE_PHY0_SHIFT 0
  461. #define PORT_HW_CFG_MEDIA_TYPE_PHY1_MASK 0x0000FF00
  462. #define PORT_HW_CFG_MEDIA_TYPE_PHY1_SHIFT 8
  463. #define PORT_HW_CFG_MEDIA_TYPE_PHY2_MASK 0x00FF0000
  464. #define PORT_HW_CFG_MEDIA_TYPE_PHY2_SHIFT 16
  465. /* 4 times 16 bits for all 4 lanes. In case external PHY is present
  466. (not direct mode), those values will not take effect on the 4 XGXS
  467. lanes. For some external PHYs (such as 8706 and 8726) the values
  468. will be used to configure the external PHY in those cases, not
  469. all 4 values are needed. */
  470. u16 xgxs_config_rx[4]; /* 0x198 */
  471. u16 xgxs_config_tx[4]; /* 0x1A0 */
  472. /* For storing FCOE mac on shared memory */
  473. u32 fcoe_fip_mac_upper;
  474. #define PORT_HW_CFG_FCOE_UPPERMAC_MASK 0x0000ffff
  475. #define PORT_HW_CFG_FCOE_UPPERMAC_SHIFT 0
  476. u32 fcoe_fip_mac_lower;
  477. u32 fcoe_wwn_port_name_upper;
  478. u32 fcoe_wwn_port_name_lower;
  479. u32 fcoe_wwn_node_name_upper;
  480. u32 fcoe_wwn_node_name_lower;
  481. u32 Reserved1[49]; /* 0x1C0 */
  482. /* Enable RJ45 magjack pair swapping on 10GBase-T PHY (0=default),
  483. 84833 only */
  484. u32 xgbt_phy_cfg; /* 0x284 */
  485. #define PORT_HW_CFG_RJ45_PAIR_SWAP_MASK 0x000000FF
  486. #define PORT_HW_CFG_RJ45_PAIR_SWAP_SHIFT 0
  487. u32 default_cfg; /* 0x288 */
  488. #define PORT_HW_CFG_GPIO0_CONFIG_MASK 0x00000003
  489. #define PORT_HW_CFG_GPIO0_CONFIG_SHIFT 0
  490. #define PORT_HW_CFG_GPIO0_CONFIG_NA 0x00000000
  491. #define PORT_HW_CFG_GPIO0_CONFIG_LOW 0x00000001
  492. #define PORT_HW_CFG_GPIO0_CONFIG_HIGH 0x00000002
  493. #define PORT_HW_CFG_GPIO0_CONFIG_INPUT 0x00000003
  494. #define PORT_HW_CFG_GPIO1_CONFIG_MASK 0x0000000C
  495. #define PORT_HW_CFG_GPIO1_CONFIG_SHIFT 2
  496. #define PORT_HW_CFG_GPIO1_CONFIG_NA 0x00000000
  497. #define PORT_HW_CFG_GPIO1_CONFIG_LOW 0x00000004
  498. #define PORT_HW_CFG_GPIO1_CONFIG_HIGH 0x00000008
  499. #define PORT_HW_CFG_GPIO1_CONFIG_INPUT 0x0000000c
  500. #define PORT_HW_CFG_GPIO2_CONFIG_MASK 0x00000030
  501. #define PORT_HW_CFG_GPIO2_CONFIG_SHIFT 4
  502. #define PORT_HW_CFG_GPIO2_CONFIG_NA 0x00000000
  503. #define PORT_HW_CFG_GPIO2_CONFIG_LOW 0x00000010
  504. #define PORT_HW_CFG_GPIO2_CONFIG_HIGH 0x00000020
  505. #define PORT_HW_CFG_GPIO2_CONFIG_INPUT 0x00000030
  506. #define PORT_HW_CFG_GPIO3_CONFIG_MASK 0x000000C0
  507. #define PORT_HW_CFG_GPIO3_CONFIG_SHIFT 6
  508. #define PORT_HW_CFG_GPIO3_CONFIG_NA 0x00000000
  509. #define PORT_HW_CFG_GPIO3_CONFIG_LOW 0x00000040
  510. #define PORT_HW_CFG_GPIO3_CONFIG_HIGH 0x00000080
  511. #define PORT_HW_CFG_GPIO3_CONFIG_INPUT 0x000000c0
  512. /* When KR link is required to be set to force which is not
  513. KR-compliant, this parameter determine what is the trigger for it.
  514. When GPIO is selected, low input will force the speed. Currently
  515. default speed is 1G. In the future, it may be widen to select the
  516. forced speed in with another parameter. Note when force-1G is
  517. enabled, it override option 56: Link Speed option. */
  518. #define PORT_HW_CFG_FORCE_KR_ENABLER_MASK 0x00000F00
  519. #define PORT_HW_CFG_FORCE_KR_ENABLER_SHIFT 8
  520. #define PORT_HW_CFG_FORCE_KR_ENABLER_NOT_FORCED 0x00000000
  521. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO0_P0 0x00000100
  522. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO1_P0 0x00000200
  523. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO2_P0 0x00000300
  524. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO3_P0 0x00000400
  525. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO0_P1 0x00000500
  526. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO1_P1 0x00000600
  527. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO2_P1 0x00000700
  528. #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO3_P1 0x00000800
  529. #define PORT_HW_CFG_FORCE_KR_ENABLER_FORCED 0x00000900
  530. /* Enable to determine with which GPIO to reset the external phy */
  531. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_MASK 0x000F0000
  532. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_SHIFT 16
  533. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_PHY_TYPE 0x00000000
  534. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P0 0x00010000
  535. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P0 0x00020000
  536. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P0 0x00030000
  537. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P0 0x00040000
  538. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P1 0x00050000
  539. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P1 0x00060000
  540. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P1 0x00070000
  541. #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P1 0x00080000
  542. /* Enable BAM on KR */
  543. #define PORT_HW_CFG_ENABLE_BAM_ON_KR_MASK 0x00100000
  544. #define PORT_HW_CFG_ENABLE_BAM_ON_KR_SHIFT 20
  545. #define PORT_HW_CFG_ENABLE_BAM_ON_KR_DISABLED 0x00000000
  546. #define PORT_HW_CFG_ENABLE_BAM_ON_KR_ENABLED 0x00100000
  547. /* Enable Common Mode Sense */
  548. #define PORT_HW_CFG_ENABLE_CMS_MASK 0x00200000
  549. #define PORT_HW_CFG_ENABLE_CMS_SHIFT 21
  550. #define PORT_HW_CFG_ENABLE_CMS_DISABLED 0x00000000
  551. #define PORT_HW_CFG_ENABLE_CMS_ENABLED 0x00200000
  552. /* Determine the Serdes electrical interface */
  553. #define PORT_HW_CFG_NET_SERDES_IF_MASK 0x0F000000
  554. #define PORT_HW_CFG_NET_SERDES_IF_SHIFT 24
  555. #define PORT_HW_CFG_NET_SERDES_IF_SGMII 0x00000000
  556. #define PORT_HW_CFG_NET_SERDES_IF_XFI 0x01000000
  557. #define PORT_HW_CFG_NET_SERDES_IF_SFI 0x02000000
  558. #define PORT_HW_CFG_NET_SERDES_IF_KR 0x03000000
  559. #define PORT_HW_CFG_NET_SERDES_IF_DXGXS 0x04000000
  560. #define PORT_HW_CFG_NET_SERDES_IF_KR2 0x05000000
  561. u32 speed_capability_mask2; /* 0x28C */
  562. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_MASK 0x0000FFFF
  563. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_SHIFT 0
  564. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_10M_FULL 0x00000001
  565. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3__ 0x00000002
  566. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3___ 0x00000004
  567. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_100M_FULL 0x00000008
  568. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_1G 0x00000010
  569. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_2_DOT_5G 0x00000020
  570. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_10G 0x00000040
  571. #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_20G 0x00000080
  572. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_MASK 0xFFFF0000
  573. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_SHIFT 16
  574. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_10M_FULL 0x00010000
  575. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0__ 0x00020000
  576. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0___ 0x00040000
  577. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_100M_FULL 0x00080000
  578. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_1G 0x00100000
  579. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_2_DOT_5G 0x00200000
  580. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_10G 0x00400000
  581. #define PORT_HW_CFG_SPEED_CAPABILITY2_D0_20G 0x00800000
  582. /* In the case where two media types (e.g. copper and fiber) are
  583. present and electrically active at the same time, PHY Selection
  584. will determine which of the two PHYs will be designated as the
  585. Active PHY and used for a connection to the network. */
  586. u32 multi_phy_config; /* 0x290 */
  587. #define PORT_HW_CFG_PHY_SELECTION_MASK 0x00000007
  588. #define PORT_HW_CFG_PHY_SELECTION_SHIFT 0
  589. #define PORT_HW_CFG_PHY_SELECTION_HARDWARE_DEFAULT 0x00000000
  590. #define PORT_HW_CFG_PHY_SELECTION_FIRST_PHY 0x00000001
  591. #define PORT_HW_CFG_PHY_SELECTION_SECOND_PHY 0x00000002
  592. #define PORT_HW_CFG_PHY_SELECTION_FIRST_PHY_PRIORITY 0x00000003
  593. #define PORT_HW_CFG_PHY_SELECTION_SECOND_PHY_PRIORITY 0x00000004
  594. /* When enabled, all second phy nvram parameters will be swapped
  595. with the first phy parameters */
  596. #define PORT_HW_CFG_PHY_SWAPPED_MASK 0x00000008
  597. #define PORT_HW_CFG_PHY_SWAPPED_SHIFT 3
  598. #define PORT_HW_CFG_PHY_SWAPPED_DISABLED 0x00000000
  599. #define PORT_HW_CFG_PHY_SWAPPED_ENABLED 0x00000008
  600. /* Address of the second external phy */
  601. u32 external_phy_config2; /* 0x294 */
  602. #define PORT_HW_CFG_XGXS_EXT_PHY2_ADDR_MASK 0x000000FF
  603. #define PORT_HW_CFG_XGXS_EXT_PHY2_ADDR_SHIFT 0
  604. /* The second XGXS external PHY type */
  605. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_MASK 0x0000FF00
  606. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_SHIFT 8
  607. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_DIRECT 0x00000000
  608. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8071 0x00000100
  609. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8072 0x00000200
  610. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8073 0x00000300
  611. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8705 0x00000400
  612. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8706 0x00000500
  613. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8726 0x00000600
  614. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8481 0x00000700
  615. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_SFX7101 0x00000800
  616. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8727 0x00000900
  617. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8727_NOC 0x00000a00
  618. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84823 0x00000b00
  619. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54640 0x00000c00
  620. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84833 0x00000d00
  621. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54618SE 0x00000e00
  622. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM8722 0x00000f00
  623. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM54616 0x00001000
  624. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84834 0x00001100
  625. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_BCM84858 0x00001200
  626. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_FAILURE 0x0000fd00
  627. #define PORT_HW_CFG_XGXS_EXT_PHY2_TYPE_NOT_CONN 0x0000ff00
  628. /* 4 times 16 bits for all 4 lanes. For some external PHYs (such as
  629. 8706, 8726 and 8727) not all 4 values are needed. */
  630. u16 xgxs_config2_rx[4]; /* 0x296 */
  631. u16 xgxs_config2_tx[4]; /* 0x2A0 */
  632. u32 lane_config;
  633. #define PORT_HW_CFG_LANE_SWAP_CFG_MASK 0x0000ffff
  634. #define PORT_HW_CFG_LANE_SWAP_CFG_SHIFT 0
  635. /* AN and forced */
  636. #define PORT_HW_CFG_LANE_SWAP_CFG_01230123 0x00001b1b
  637. /* forced only */
  638. #define PORT_HW_CFG_LANE_SWAP_CFG_01233210 0x00001be4
  639. /* forced only */
  640. #define PORT_HW_CFG_LANE_SWAP_CFG_31203120 0x0000d8d8
  641. /* forced only */
  642. #define PORT_HW_CFG_LANE_SWAP_CFG_32103210 0x0000e4e4
  643. #define PORT_HW_CFG_LANE_SWAP_CFG_TX_MASK 0x000000ff
  644. #define PORT_HW_CFG_LANE_SWAP_CFG_TX_SHIFT 0
  645. #define PORT_HW_CFG_LANE_SWAP_CFG_RX_MASK 0x0000ff00
  646. #define PORT_HW_CFG_LANE_SWAP_CFG_RX_SHIFT 8
  647. #define PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK 0x0000c000
  648. #define PORT_HW_CFG_LANE_SWAP_CFG_MASTER_SHIFT 14
  649. /* Indicate whether to swap the external phy polarity */
  650. #define PORT_HW_CFG_SWAP_PHY_POLARITY_MASK 0x00010000
  651. #define PORT_HW_CFG_SWAP_PHY_POLARITY_DISABLED 0x00000000
  652. #define PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED 0x00010000
  653. u32 external_phy_config;
  654. #define PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK 0x000000ff
  655. #define PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT 0
  656. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK 0x0000ff00
  657. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SHIFT 8
  658. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT 0x00000000
  659. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8071 0x00000100
  660. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072 0x00000200
  661. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073 0x00000300
  662. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705 0x00000400
  663. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706 0x00000500
  664. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726 0x00000600
  665. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481 0x00000700
  666. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101 0x00000800
  667. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727 0x00000900
  668. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727_NOC 0x00000a00
  669. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823 0x00000b00
  670. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54640 0x00000c00
  671. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833 0x00000d00
  672. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE 0x00000e00
  673. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8722 0x00000f00
  674. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54616 0x00001000
  675. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834 0x00001100
  676. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858 0x00001200
  677. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT_WC 0x0000fc00
  678. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE 0x0000fd00
  679. #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN 0x0000ff00
  680. #define PORT_HW_CFG_SERDES_EXT_PHY_ADDR_MASK 0x00ff0000
  681. #define PORT_HW_CFG_SERDES_EXT_PHY_ADDR_SHIFT 16
  682. #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK 0xff000000
  683. #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_SHIFT 24
  684. #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT 0x00000000
  685. #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_BCM5482 0x01000000
  686. #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT_SD 0x02000000
  687. #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_NOT_CONN 0xff000000
  688. u32 speed_capability_mask;
  689. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_MASK 0x0000ffff
  690. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_SHIFT 0
  691. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10M_FULL 0x00000001
  692. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10M_HALF 0x00000002
  693. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_100M_HALF 0x00000004
  694. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_100M_FULL 0x00000008
  695. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_1G 0x00000010
  696. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_2_5G 0x00000020
  697. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_10G 0x00000040
  698. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_20G 0x00000080
  699. #define PORT_HW_CFG_SPEED_CAPABILITY_D3_RESERVED 0x0000f000
  700. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_MASK 0xffff0000
  701. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_SHIFT 16
  702. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL 0x00010000
  703. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF 0x00020000
  704. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF 0x00040000
  705. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL 0x00080000
  706. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_1G 0x00100000
  707. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G 0x00200000
  708. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_10G 0x00400000
  709. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_20G 0x00800000
  710. #define PORT_HW_CFG_SPEED_CAPABILITY_D0_RESERVED 0xf0000000
  711. /* A place to hold the original MAC address as a backup */
  712. u32 backup_mac_upper; /* 0x2B4 */
  713. u32 backup_mac_lower; /* 0x2B8 */
  714. };
  715. /****************************************************************************
  716. * Shared Feature configuration *
  717. ****************************************************************************/
  718. struct shared_feat_cfg { /* NVRAM Offset */
  719. u32 config; /* 0x450 */
  720. #define SHARED_FEATURE_BMC_ECHO_MODE_EN 0x00000001
  721. /* Use NVRAM values instead of HW default values */
  722. #define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_MASK \
  723. 0x00000002
  724. #define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_DISABLED \
  725. 0x00000000
  726. #define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_ENABLED \
  727. 0x00000002
  728. #define SHARED_FEAT_CFG_NCSI_ID_METHOD_MASK 0x00000008
  729. #define SHARED_FEAT_CFG_NCSI_ID_METHOD_SPIO 0x00000000
  730. #define SHARED_FEAT_CFG_NCSI_ID_METHOD_NVRAM 0x00000008
  731. #define SHARED_FEAT_CFG_NCSI_ID_MASK 0x00000030
  732. #define SHARED_FEAT_CFG_NCSI_ID_SHIFT 4
  733. /* Override the OTP back to single function mode. When using GPIO,
  734. high means only SF, 0 is according to CLP configuration */
  735. #define SHARED_FEAT_CFG_FORCE_SF_MODE_MASK 0x00000700
  736. #define SHARED_FEAT_CFG_FORCE_SF_MODE_SHIFT 8
  737. #define SHARED_FEAT_CFG_FORCE_SF_MODE_MF_ALLOWED 0x00000000
  738. #define SHARED_FEAT_CFG_FORCE_SF_MODE_FORCED_SF 0x00000100
  739. #define SHARED_FEAT_CFG_FORCE_SF_MODE_SPIO4 0x00000200
  740. #define SHARED_FEAT_CFG_FORCE_SF_MODE_SWITCH_INDEPT 0x00000300
  741. #define SHARED_FEAT_CFG_FORCE_SF_MODE_AFEX_MODE 0x00000400
  742. #define SHARED_FEAT_CFG_FORCE_SF_MODE_BD_MODE 0x00000500
  743. #define SHARED_FEAT_CFG_FORCE_SF_MODE_UFP_MODE 0x00000600
  744. #define SHARED_FEAT_CFG_FORCE_SF_MODE_EXTENDED_MODE 0x00000700
  745. /* The interval in seconds between sending LLDP packets. Set to zero
  746. to disable the feature */
  747. #define SHARED_FEAT_CFG_LLDP_XMIT_INTERVAL_MASK 0x00ff0000
  748. #define SHARED_FEAT_CFG_LLDP_XMIT_INTERVAL_SHIFT 16
  749. /* The assigned device type ID for LLDP usage */
  750. #define SHARED_FEAT_CFG_LLDP_DEVICE_TYPE_ID_MASK 0xff000000
  751. #define SHARED_FEAT_CFG_LLDP_DEVICE_TYPE_ID_SHIFT 24
  752. };
  753. /****************************************************************************
  754. * Port Feature configuration *
  755. ****************************************************************************/
  756. struct port_feat_cfg { /* port 0: 0x454 port 1: 0x4c8 */
  757. u32 config;
  758. #define PORT_FEATURE_BAR1_SIZE_MASK 0x0000000f
  759. #define PORT_FEATURE_BAR1_SIZE_SHIFT 0
  760. #define PORT_FEATURE_BAR1_SIZE_DISABLED 0x00000000
  761. #define PORT_FEATURE_BAR1_SIZE_64K 0x00000001
  762. #define PORT_FEATURE_BAR1_SIZE_128K 0x00000002
  763. #define PORT_FEATURE_BAR1_SIZE_256K 0x00000003
  764. #define PORT_FEATURE_BAR1_SIZE_512K 0x00000004
  765. #define PORT_FEATURE_BAR1_SIZE_1M 0x00000005
  766. #define PORT_FEATURE_BAR1_SIZE_2M 0x00000006
  767. #define PORT_FEATURE_BAR1_SIZE_4M 0x00000007
  768. #define PORT_FEATURE_BAR1_SIZE_8M 0x00000008
  769. #define PORT_FEATURE_BAR1_SIZE_16M 0x00000009
  770. #define PORT_FEATURE_BAR1_SIZE_32M 0x0000000a
  771. #define PORT_FEATURE_BAR1_SIZE_64M 0x0000000b
  772. #define PORT_FEATURE_BAR1_SIZE_128M 0x0000000c
  773. #define PORT_FEATURE_BAR1_SIZE_256M 0x0000000d
  774. #define PORT_FEATURE_BAR1_SIZE_512M 0x0000000e
  775. #define PORT_FEATURE_BAR1_SIZE_1G 0x0000000f
  776. #define PORT_FEATURE_BAR2_SIZE_MASK 0x000000f0
  777. #define PORT_FEATURE_BAR2_SIZE_SHIFT 4
  778. #define PORT_FEATURE_BAR2_SIZE_DISABLED 0x00000000
  779. #define PORT_FEATURE_BAR2_SIZE_64K 0x00000010
  780. #define PORT_FEATURE_BAR2_SIZE_128K 0x00000020
  781. #define PORT_FEATURE_BAR2_SIZE_256K 0x00000030
  782. #define PORT_FEATURE_BAR2_SIZE_512K 0x00000040
  783. #define PORT_FEATURE_BAR2_SIZE_1M 0x00000050
  784. #define PORT_FEATURE_BAR2_SIZE_2M 0x00000060
  785. #define PORT_FEATURE_BAR2_SIZE_4M 0x00000070
  786. #define PORT_FEATURE_BAR2_SIZE_8M 0x00000080
  787. #define PORT_FEATURE_BAR2_SIZE_16M 0x00000090
  788. #define PORT_FEATURE_BAR2_SIZE_32M 0x000000a0
  789. #define PORT_FEATURE_BAR2_SIZE_64M 0x000000b0
  790. #define PORT_FEATURE_BAR2_SIZE_128M 0x000000c0
  791. #define PORT_FEATURE_BAR2_SIZE_256M 0x000000d0
  792. #define PORT_FEATURE_BAR2_SIZE_512M 0x000000e0
  793. #define PORT_FEATURE_BAR2_SIZE_1G 0x000000f0
  794. #define PORT_FEAT_CFG_DCBX_MASK 0x00000100
  795. #define PORT_FEAT_CFG_DCBX_DISABLED 0x00000000
  796. #define PORT_FEAT_CFG_DCBX_ENABLED 0x00000100
  797. #define PORT_FEAT_CFG_STORAGE_PERSONALITY_MASK 0x00000C00
  798. #define PORT_FEAT_CFG_STORAGE_PERSONALITY_FCOE 0x00000400
  799. #define PORT_FEAT_CFG_STORAGE_PERSONALITY_ISCSI 0x00000800
  800. #define PORT_FEATURE_EN_SIZE_MASK 0x0f000000
  801. #define PORT_FEATURE_EN_SIZE_SHIFT 24
  802. #define PORT_FEATURE_WOL_ENABLED 0x01000000
  803. #define PORT_FEATURE_MBA_ENABLED 0x02000000
  804. #define PORT_FEATURE_MFW_ENABLED 0x04000000
  805. /* Advertise expansion ROM even if MBA is disabled */
  806. #define PORT_FEAT_CFG_FORCE_EXP_ROM_ADV_MASK 0x08000000
  807. #define PORT_FEAT_CFG_FORCE_EXP_ROM_ADV_DISABLED 0x00000000
  808. #define PORT_FEAT_CFG_FORCE_EXP_ROM_ADV_ENABLED 0x08000000
  809. /* Check the optic vendor via i2c against a list of approved modules
  810. in a separate nvram image */
  811. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK 0xe0000000
  812. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_SHIFT 29
  813. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_NO_ENFORCEMENT \
  814. 0x00000000
  815. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER \
  816. 0x20000000
  817. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_WARNING_MSG 0x40000000
  818. #define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_POWER_DOWN 0x60000000
  819. u32 wol_config;
  820. /* Default is used when driver sets to "auto" mode */
  821. #define PORT_FEATURE_WOL_DEFAULT_MASK 0x00000003
  822. #define PORT_FEATURE_WOL_DEFAULT_SHIFT 0
  823. #define PORT_FEATURE_WOL_DEFAULT_DISABLE 0x00000000
  824. #define PORT_FEATURE_WOL_DEFAULT_MAGIC 0x00000001
  825. #define PORT_FEATURE_WOL_DEFAULT_ACPI 0x00000002
  826. #define PORT_FEATURE_WOL_DEFAULT_MAGIC_AND_ACPI 0x00000003
  827. #define PORT_FEATURE_WOL_RES_PAUSE_CAP 0x00000004
  828. #define PORT_FEATURE_WOL_RES_ASYM_PAUSE_CAP 0x00000008
  829. #define PORT_FEATURE_WOL_ACPI_UPON_MGMT 0x00000010
  830. u32 mba_config;
  831. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK 0x00000007
  832. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_SHIFT 0
  833. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_PXE 0x00000000
  834. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_RPL 0x00000001
  835. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_BOOTP 0x00000002
  836. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_ISCSIB 0x00000003
  837. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_FCOE_BOOT 0x00000004
  838. #define PORT_FEATURE_MBA_BOOT_AGENT_TYPE_NONE 0x00000007
  839. #define PORT_FEATURE_MBA_BOOT_RETRY_MASK 0x00000038
  840. #define PORT_FEATURE_MBA_BOOT_RETRY_SHIFT 3
  841. #define PORT_FEATURE_MBA_RES_PAUSE_CAP 0x00000100
  842. #define PORT_FEATURE_MBA_RES_ASYM_PAUSE_CAP 0x00000200
  843. #define PORT_FEATURE_MBA_SETUP_PROMPT_ENABLE 0x00000400
  844. #define PORT_FEATURE_MBA_HOTKEY_MASK 0x00000800
  845. #define PORT_FEATURE_MBA_HOTKEY_CTRL_S 0x00000000
  846. #define PORT_FEATURE_MBA_HOTKEY_CTRL_B 0x00000800
  847. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_MASK 0x000ff000
  848. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_SHIFT 12
  849. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_DISABLED 0x00000000
  850. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_2K 0x00001000
  851. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_4K 0x00002000
  852. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_8K 0x00003000
  853. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_16K 0x00004000
  854. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_32K 0x00005000
  855. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_64K 0x00006000
  856. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_128K 0x00007000
  857. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_256K 0x00008000
  858. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_512K 0x00009000
  859. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_1M 0x0000a000
  860. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_2M 0x0000b000
  861. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_4M 0x0000c000
  862. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_8M 0x0000d000
  863. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_16M 0x0000e000
  864. #define PORT_FEATURE_MBA_EXP_ROM_SIZE_32M 0x0000f000
  865. #define PORT_FEATURE_MBA_MSG_TIMEOUT_MASK 0x00f00000
  866. #define PORT_FEATURE_MBA_MSG_TIMEOUT_SHIFT 20
  867. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_MASK 0x03000000
  868. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_SHIFT 24
  869. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_AUTO 0x00000000
  870. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_BBS 0x01000000
  871. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_INT18H 0x02000000
  872. #define PORT_FEATURE_MBA_BIOS_BOOTSTRAP_INT19H 0x03000000
  873. #define PORT_FEATURE_MBA_LINK_SPEED_MASK 0x3c000000
  874. #define PORT_FEATURE_MBA_LINK_SPEED_SHIFT 26
  875. #define PORT_FEATURE_MBA_LINK_SPEED_AUTO 0x00000000
  876. #define PORT_FEATURE_MBA_LINK_SPEED_10HD 0x04000000
  877. #define PORT_FEATURE_MBA_LINK_SPEED_10FD 0x08000000
  878. #define PORT_FEATURE_MBA_LINK_SPEED_100HD 0x0c000000
  879. #define PORT_FEATURE_MBA_LINK_SPEED_100FD 0x10000000
  880. #define PORT_FEATURE_MBA_LINK_SPEED_1GBPS 0x14000000
  881. #define PORT_FEATURE_MBA_LINK_SPEED_2_5GBPS 0x18000000
  882. #define PORT_FEATURE_MBA_LINK_SPEED_10GBPS_CX4 0x1c000000
  883. #define PORT_FEATURE_MBA_LINK_SPEED_20GBPS 0x20000000
  884. u32 bmc_config;
  885. #define PORT_FEATURE_BMC_LINK_OVERRIDE_MASK 0x00000001
  886. #define PORT_FEATURE_BMC_LINK_OVERRIDE_DEFAULT 0x00000000
  887. #define PORT_FEATURE_BMC_LINK_OVERRIDE_EN 0x00000001
  888. u32 mba_vlan_cfg;
  889. #define PORT_FEATURE_MBA_VLAN_TAG_MASK 0x0000ffff
  890. #define PORT_FEATURE_MBA_VLAN_TAG_SHIFT 0
  891. #define PORT_FEATURE_MBA_VLAN_EN 0x00010000
  892. u32 resource_cfg;
  893. #define PORT_FEATURE_RESOURCE_CFG_VALID 0x00000001
  894. #define PORT_FEATURE_RESOURCE_CFG_DIAG 0x00000002
  895. #define PORT_FEATURE_RESOURCE_CFG_L2 0x00000004
  896. #define PORT_FEATURE_RESOURCE_CFG_ISCSI 0x00000008
  897. #define PORT_FEATURE_RESOURCE_CFG_RDMA 0x00000010
  898. u32 smbus_config;
  899. #define PORT_FEATURE_SMBUS_ADDR_MASK 0x000000fe
  900. #define PORT_FEATURE_SMBUS_ADDR_SHIFT 1
  901. u32 vf_config;
  902. #define PORT_FEAT_CFG_VF_BAR2_SIZE_MASK 0x0000000f
  903. #define PORT_FEAT_CFG_VF_BAR2_SIZE_SHIFT 0
  904. #define PORT_FEAT_CFG_VF_BAR2_SIZE_DISABLED 0x00000000
  905. #define PORT_FEAT_CFG_VF_BAR2_SIZE_4K 0x00000001
  906. #define PORT_FEAT_CFG_VF_BAR2_SIZE_8K 0x00000002
  907. #define PORT_FEAT_CFG_VF_BAR2_SIZE_16K 0x00000003
  908. #define PORT_FEAT_CFG_VF_BAR2_SIZE_32K 0x00000004
  909. #define PORT_FEAT_CFG_VF_BAR2_SIZE_64K 0x00000005
  910. #define PORT_FEAT_CFG_VF_BAR2_SIZE_128K 0x00000006
  911. #define PORT_FEAT_CFG_VF_BAR2_SIZE_256K 0x00000007
  912. #define PORT_FEAT_CFG_VF_BAR2_SIZE_512K 0x00000008
  913. #define PORT_FEAT_CFG_VF_BAR2_SIZE_1M 0x00000009
  914. #define PORT_FEAT_CFG_VF_BAR2_SIZE_2M 0x0000000a
  915. #define PORT_FEAT_CFG_VF_BAR2_SIZE_4M 0x0000000b
  916. #define PORT_FEAT_CFG_VF_BAR2_SIZE_8M 0x0000000c
  917. #define PORT_FEAT_CFG_VF_BAR2_SIZE_16M 0x0000000d
  918. #define PORT_FEAT_CFG_VF_BAR2_SIZE_32M 0x0000000e
  919. #define PORT_FEAT_CFG_VF_BAR2_SIZE_64M 0x0000000f
  920. u32 link_config; /* Used as HW defaults for the driver */
  921. #define PORT_FEATURE_CONNECTED_SWITCH_MASK 0x03000000
  922. #define PORT_FEATURE_CONNECTED_SWITCH_SHIFT 24
  923. /* (forced) low speed switch (< 10G) */
  924. #define PORT_FEATURE_CON_SWITCH_1G_SWITCH 0x00000000
  925. /* (forced) high speed switch (>= 10G) */
  926. #define PORT_FEATURE_CON_SWITCH_10G_SWITCH 0x01000000
  927. #define PORT_FEATURE_CON_SWITCH_AUTO_DETECT 0x02000000
  928. #define PORT_FEATURE_CON_SWITCH_ONE_TIME_DETECT 0x03000000
  929. #define PORT_FEATURE_LINK_SPEED_MASK 0x000f0000
  930. #define PORT_FEATURE_LINK_SPEED_SHIFT 16
  931. #define PORT_FEATURE_LINK_SPEED_AUTO 0x00000000
  932. #define PORT_FEATURE_LINK_SPEED_10M_FULL 0x00010000
  933. #define PORT_FEATURE_LINK_SPEED_10M_HALF 0x00020000
  934. #define PORT_FEATURE_LINK_SPEED_100M_HALF 0x00030000
  935. #define PORT_FEATURE_LINK_SPEED_100M_FULL 0x00040000
  936. #define PORT_FEATURE_LINK_SPEED_1G 0x00050000
  937. #define PORT_FEATURE_LINK_SPEED_2_5G 0x00060000
  938. #define PORT_FEATURE_LINK_SPEED_10G_CX4 0x00070000
  939. #define PORT_FEATURE_LINK_SPEED_20G 0x00080000
  940. #define PORT_FEATURE_FLOW_CONTROL_MASK 0x00000700
  941. #define PORT_FEATURE_FLOW_CONTROL_SHIFT 8
  942. #define PORT_FEATURE_FLOW_CONTROL_AUTO 0x00000000
  943. #define PORT_FEATURE_FLOW_CONTROL_TX 0x00000100
  944. #define PORT_FEATURE_FLOW_CONTROL_RX 0x00000200
  945. #define PORT_FEATURE_FLOW_CONTROL_BOTH 0x00000300
  946. #define PORT_FEATURE_FLOW_CONTROL_NONE 0x00000400
  947. /* The default for MCP link configuration,
  948. uses the same defines as link_config */
  949. u32 mfw_wol_link_cfg;
  950. /* The default for the driver of the second external phy,
  951. uses the same defines as link_config */
  952. u32 link_config2; /* 0x47C */
  953. /* The default for MCP of the second external phy,
  954. uses the same defines as link_config */
  955. u32 mfw_wol_link_cfg2; /* 0x480 */
  956. /* EEE power saving mode */
  957. u32 eee_power_mode; /* 0x484 */
  958. #define PORT_FEAT_CFG_EEE_POWER_MODE_MASK 0x000000FF
  959. #define PORT_FEAT_CFG_EEE_POWER_MODE_SHIFT 0
  960. #define PORT_FEAT_CFG_EEE_POWER_MODE_DISABLED 0x00000000
  961. #define PORT_FEAT_CFG_EEE_POWER_MODE_BALANCED 0x00000001
  962. #define PORT_FEAT_CFG_EEE_POWER_MODE_AGGRESSIVE 0x00000002
  963. #define PORT_FEAT_CFG_EEE_POWER_MODE_LOW_LATENCY 0x00000003
  964. u32 Reserved2[16]; /* 0x488 */
  965. };
  966. /****************************************************************************
  967. * Device Information *
  968. ****************************************************************************/
  969. struct shm_dev_info { /* size */
  970. u32 bc_rev; /* 8 bits each: major, minor, build */ /* 4 */
  971. struct shared_hw_cfg shared_hw_config; /* 40 */
  972. struct port_hw_cfg port_hw_config[PORT_MAX]; /* 400*2=800 */
  973. struct shared_feat_cfg shared_feature_config; /* 4 */
  974. struct port_feat_cfg port_feature_config[PORT_MAX];/* 116*2=232 */
  975. };
  976. #if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)
  977. #error "Missing either LITTLE_ENDIAN or BIG_ENDIAN definition."
  978. #endif
  979. #define FUNC_0 0
  980. #define FUNC_1 1
  981. #define FUNC_2 2
  982. #define FUNC_3 3
  983. #define FUNC_4 4
  984. #define FUNC_5 5
  985. #define FUNC_6 6
  986. #define FUNC_7 7
  987. #define E1_FUNC_MAX 2
  988. #define E1H_FUNC_MAX 8
  989. #define E2_FUNC_MAX 4 /* per path */
  990. #define VN_0 0
  991. #define VN_1 1
  992. #define VN_2 2
  993. #define VN_3 3
  994. #define E1VN_MAX 1
  995. #define E1HVN_MAX 4
  996. #define E2_VF_MAX 64 /* HC_REG_VF_CONFIGURATION_SIZE */
  997. /* This value (in milliseconds) determines the frequency of the driver
  998. * issuing the PULSE message code. The firmware monitors this periodic
  999. * pulse to determine when to switch to an OS-absent mode. */
  1000. #define DRV_PULSE_PERIOD_MS 250
  1001. /* This value (in milliseconds) determines how long the driver should
  1002. * wait for an acknowledgement from the firmware before timing out. Once
  1003. * the firmware has timed out, the driver will assume there is no firmware
  1004. * running and there won't be any firmware-driver synchronization during a
  1005. * driver reset. */
  1006. #define FW_ACK_TIME_OUT_MS 5000
  1007. #define FW_ACK_POLL_TIME_MS 1
  1008. #define FW_ACK_NUM_OF_POLL (FW_ACK_TIME_OUT_MS/FW_ACK_POLL_TIME_MS)
  1009. #define MFW_TRACE_SIGNATURE 0x54524342
  1010. /****************************************************************************
  1011. * Driver <-> FW Mailbox *
  1012. ****************************************************************************/
  1013. struct drv_port_mb {
  1014. u32 link_status;
  1015. /* Driver should update this field on any link change event */
  1016. #define LINK_STATUS_NONE (0<<0)
  1017. #define LINK_STATUS_LINK_FLAG_MASK 0x00000001
  1018. #define LINK_STATUS_LINK_UP 0x00000001
  1019. #define LINK_STATUS_SPEED_AND_DUPLEX_MASK 0x0000001E
  1020. #define LINK_STATUS_SPEED_AND_DUPLEX_AN_NOT_COMPLETE (0<<1)
  1021. #define LINK_STATUS_SPEED_AND_DUPLEX_10THD (1<<1)
  1022. #define LINK_STATUS_SPEED_AND_DUPLEX_10TFD (2<<1)
  1023. #define LINK_STATUS_SPEED_AND_DUPLEX_100TXHD (3<<1)
  1024. #define LINK_STATUS_SPEED_AND_DUPLEX_100T4 (4<<1)
  1025. #define LINK_STATUS_SPEED_AND_DUPLEX_100TXFD (5<<1)
  1026. #define LINK_STATUS_SPEED_AND_DUPLEX_1000THD (6<<1)
  1027. #define LINK_STATUS_SPEED_AND_DUPLEX_1000TFD (7<<1)
  1028. #define LINK_STATUS_SPEED_AND_DUPLEX_1000XFD (7<<1)
  1029. #define LINK_STATUS_SPEED_AND_DUPLEX_2500THD (8<<1)
  1030. #define LINK_STATUS_SPEED_AND_DUPLEX_2500TFD (9<<1)
  1031. #define LINK_STATUS_SPEED_AND_DUPLEX_2500XFD (9<<1)
  1032. #define LINK_STATUS_SPEED_AND_DUPLEX_10GTFD (10<<1)
  1033. #define LINK_STATUS_SPEED_AND_DUPLEX_10GXFD (10<<1)
  1034. #define LINK_STATUS_SPEED_AND_DUPLEX_20GTFD (11<<1)
  1035. #define LINK_STATUS_SPEED_AND_DUPLEX_20GXFD (11<<1)
  1036. #define LINK_STATUS_AUTO_NEGOTIATE_FLAG_MASK 0x00000020
  1037. #define LINK_STATUS_AUTO_NEGOTIATE_ENABLED 0x00000020
  1038. #define LINK_STATUS_AUTO_NEGOTIATE_COMPLETE 0x00000040
  1039. #define LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK 0x00000080
  1040. #define LINK_STATUS_PARALLEL_DETECTION_USED 0x00000080
  1041. #define LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE 0x00000200
  1042. #define LINK_STATUS_LINK_PARTNER_1000THD_CAPABLE 0x00000400
  1043. #define LINK_STATUS_LINK_PARTNER_100T4_CAPABLE 0x00000800
  1044. #define LINK_STATUS_LINK_PARTNER_100TXFD_CAPABLE 0x00001000
  1045. #define LINK_STATUS_LINK_PARTNER_100TXHD_CAPABLE 0x00002000
  1046. #define LINK_STATUS_LINK_PARTNER_10TFD_CAPABLE 0x00004000
  1047. #define LINK_STATUS_LINK_PARTNER_10THD_CAPABLE 0x00008000
  1048. #define LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK 0x00010000
  1049. #define LINK_STATUS_TX_FLOW_CONTROL_ENABLED 0x00010000
  1050. #define LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK 0x00020000
  1051. #define LINK_STATUS_RX_FLOW_CONTROL_ENABLED 0x00020000
  1052. #define LINK_STATUS_LINK_PARTNER_FLOW_CONTROL_MASK 0x000C0000
  1053. #define LINK_STATUS_LINK_PARTNER_NOT_PAUSE_CAPABLE (0<<18)
  1054. #define LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE (1<<18)
  1055. #define LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE (2<<18)
  1056. #define LINK_STATUS_LINK_PARTNER_BOTH_PAUSE (3<<18)
  1057. #define LINK_STATUS_SERDES_LINK 0x00100000
  1058. #define LINK_STATUS_LINK_PARTNER_2500XFD_CAPABLE 0x00200000
  1059. #define LINK_STATUS_LINK_PARTNER_2500XHD_CAPABLE 0x00400000
  1060. #define LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE 0x00800000
  1061. #define LINK_STATUS_LINK_PARTNER_20GXFD_CAPABLE 0x10000000
  1062. #define LINK_STATUS_PFC_ENABLED 0x20000000
  1063. #define LINK_STATUS_PHYSICAL_LINK_FLAG 0x40000000
  1064. #define LINK_STATUS_SFP_TX_FAULT 0x80000000
  1065. u32 port_stx;
  1066. u32 stat_nig_timer;
  1067. /* MCP firmware does not use this field */
  1068. u32 ext_phy_fw_version;
  1069. };
  1070. struct drv_func_mb {
  1071. u32 drv_mb_header;
  1072. #define DRV_MSG_CODE_MASK 0xffff0000
  1073. #define DRV_MSG_CODE_LOAD_REQ 0x10000000
  1074. #define DRV_MSG_CODE_LOAD_DONE 0x11000000
  1075. #define DRV_MSG_CODE_UNLOAD_REQ_WOL_EN 0x20000000
  1076. #define DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS 0x20010000
  1077. #define DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP 0x20020000
  1078. #define DRV_MSG_CODE_UNLOAD_DONE 0x21000000
  1079. #define DRV_MSG_CODE_DCC_OK 0x30000000
  1080. #define DRV_MSG_CODE_DCC_FAILURE 0x31000000
  1081. #define DRV_MSG_CODE_DIAG_ENTER_REQ 0x50000000
  1082. #define DRV_MSG_CODE_DIAG_EXIT_REQ 0x60000000
  1083. #define DRV_MSG_CODE_VALIDATE_KEY 0x70000000
  1084. #define DRV_MSG_CODE_GET_CURR_KEY 0x80000000
  1085. #define DRV_MSG_CODE_GET_UPGRADE_KEY 0x81000000
  1086. #define DRV_MSG_CODE_GET_MANUF_KEY 0x82000000
  1087. #define DRV_MSG_CODE_LOAD_L2B_PRAM 0x90000000
  1088. #define DRV_MSG_CODE_OEM_OK 0x00010000
  1089. #define DRV_MSG_CODE_OEM_FAILURE 0x00020000
  1090. #define DRV_MSG_CODE_OEM_UPDATE_SVID_OK 0x00030000
  1091. #define DRV_MSG_CODE_OEM_UPDATE_SVID_FAILURE 0x00040000
  1092. /*
  1093. * The optic module verification command requires bootcode
  1094. * v5.0.6 or later, te specific optic module verification command
  1095. * requires bootcode v5.2.12 or later
  1096. */
  1097. #define DRV_MSG_CODE_VRFY_FIRST_PHY_OPT_MDL 0xa0000000
  1098. #define REQ_BC_VER_4_VRFY_FIRST_PHY_OPT_MDL 0x00050006
  1099. #define DRV_MSG_CODE_VRFY_SPECIFIC_PHY_OPT_MDL 0xa1000000
  1100. #define REQ_BC_VER_4_VRFY_SPECIFIC_PHY_OPT_MDL 0x00050234
  1101. #define DRV_MSG_CODE_VRFY_AFEX_SUPPORTED 0xa2000000
  1102. #define REQ_BC_VER_4_VRFY_AFEX_SUPPORTED 0x00070002
  1103. #define REQ_BC_VER_4_SFP_TX_DISABLE_SUPPORTED 0x00070014
  1104. #define REQ_BC_VER_4_MT_SUPPORTED 0x00070201
  1105. #define REQ_BC_VER_4_PFC_STATS_SUPPORTED 0x00070201
  1106. #define REQ_BC_VER_4_FCOE_FEATURES 0x00070209
  1107. #define DRV_MSG_CODE_DCBX_ADMIN_PMF_MSG 0xb0000000
  1108. #define DRV_MSG_CODE_DCBX_PMF_DRV_OK 0xb2000000
  1109. #define REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF 0x00070401
  1110. #define DRV_MSG_CODE_VF_DISABLED_DONE 0xc0000000
  1111. #define DRV_MSG_CODE_AFEX_DRIVER_SETMAC 0xd0000000
  1112. #define DRV_MSG_CODE_AFEX_LISTGET_ACK 0xd1000000
  1113. #define DRV_MSG_CODE_AFEX_LISTSET_ACK 0xd2000000
  1114. #define DRV_MSG_CODE_AFEX_STATSGET_ACK 0xd3000000
  1115. #define DRV_MSG_CODE_AFEX_VIFSET_ACK 0xd4000000
  1116. #define DRV_MSG_CODE_DRV_INFO_ACK 0xd8000000
  1117. #define DRV_MSG_CODE_DRV_INFO_NACK 0xd9000000
  1118. #define DRV_MSG_CODE_EEE_RESULTS_ACK 0xda000000
  1119. #define DRV_MSG_CODE_RMMOD 0xdb000000
  1120. #define REQ_BC_VER_4_RMMOD_CMD 0x0007080f
  1121. #define DRV_MSG_CODE_SET_MF_BW 0xe0000000
  1122. #define REQ_BC_VER_4_SET_MF_BW 0x00060202
  1123. #define DRV_MSG_CODE_SET_MF_BW_ACK 0xe1000000
  1124. #define DRV_MSG_CODE_LINK_STATUS_CHANGED 0x01000000
  1125. #define DRV_MSG_CODE_INITIATE_FLR 0x02000000
  1126. #define REQ_BC_VER_4_INITIATE_FLR 0x00070213
  1127. #define BIOS_MSG_CODE_LIC_CHALLENGE 0xff010000
  1128. #define BIOS_MSG_CODE_LIC_RESPONSE 0xff020000
  1129. #define BIOS_MSG_CODE_VIRT_MAC_PRIM 0xff030000
  1130. #define BIOS_MSG_CODE_VIRT_MAC_ISCSI 0xff040000
  1131. #define DRV_MSG_SEQ_NUMBER_MASK 0x0000ffff
  1132. u32 drv_mb_param;
  1133. #define DRV_MSG_CODE_SET_MF_BW_MIN_MASK 0x00ff0000
  1134. #define DRV_MSG_CODE_SET_MF_BW_MAX_MASK 0xff000000
  1135. #define DRV_MSG_CODE_UNLOAD_SKIP_LINK_RESET 0x00000002
  1136. #define DRV_MSG_CODE_LOAD_REQ_WITH_LFA 0x0000100a
  1137. #define DRV_MSG_CODE_LOAD_REQ_FORCE_LFA 0x00002000
  1138. u32 fw_mb_header;
  1139. #define FW_MSG_CODE_MASK 0xffff0000
  1140. #define FW_MSG_CODE_DRV_LOAD_COMMON 0x10100000
  1141. #define FW_MSG_CODE_DRV_LOAD_PORT 0x10110000
  1142. #define FW_MSG_CODE_DRV_LOAD_FUNCTION 0x10120000
  1143. /* Load common chip is supported from bc 6.0.0 */
  1144. #define REQ_BC_VER_4_DRV_LOAD_COMMON_CHIP 0x00060000
  1145. #define FW_MSG_CODE_DRV_LOAD_COMMON_CHIP 0x10130000
  1146. #define FW_MSG_CODE_DRV_LOAD_REFUSED 0x10200000
  1147. #define FW_MSG_CODE_DRV_LOAD_DONE 0x11100000
  1148. #define FW_MSG_CODE_DRV_UNLOAD_COMMON 0x20100000
  1149. #define FW_MSG_CODE_DRV_UNLOAD_PORT 0x20110000
  1150. #define FW_MSG_CODE_DRV_UNLOAD_FUNCTION 0x20120000
  1151. #define FW_MSG_CODE_DRV_UNLOAD_DONE 0x21100000
  1152. #define FW_MSG_CODE_DCC_DONE 0x30100000
  1153. #define FW_MSG_CODE_LLDP_DONE 0x40100000
  1154. #define FW_MSG_CODE_DIAG_ENTER_DONE 0x50100000
  1155. #define FW_MSG_CODE_DIAG_REFUSE 0x50200000
  1156. #define FW_MSG_CODE_DIAG_EXIT_DONE 0x60100000
  1157. #define FW_MSG_CODE_VALIDATE_KEY_SUCCESS 0x70100000
  1158. #define FW_MSG_CODE_VALIDATE_KEY_FAILURE 0x70200000
  1159. #define FW_MSG_CODE_GET_KEY_DONE 0x80100000
  1160. #define FW_MSG_CODE_NO_KEY 0x80f00000
  1161. #define FW_MSG_CODE_LIC_INFO_NOT_READY 0x80f80000
  1162. #define FW_MSG_CODE_L2B_PRAM_LOADED 0x90100000
  1163. #define FW_MSG_CODE_L2B_PRAM_T_LOAD_FAILURE 0x90210000
  1164. #define FW_MSG_CODE_L2B_PRAM_C_LOAD_FAILURE 0x90220000
  1165. #define FW_MSG_CODE_L2B_PRAM_X_LOAD_FAILURE 0x90230000
  1166. #define FW_MSG_CODE_L2B_PRAM_U_LOAD_FAILURE 0x90240000
  1167. #define FW_MSG_CODE_VRFY_OPT_MDL_SUCCESS 0xa0100000
  1168. #define FW_MSG_CODE_VRFY_OPT_MDL_INVLD_IMG 0xa0200000
  1169. #define FW_MSG_CODE_VRFY_OPT_MDL_UNAPPROVED 0xa0300000
  1170. #define FW_MSG_CODE_VF_DISABLED_DONE 0xb0000000
  1171. #define FW_MSG_CODE_HW_SET_INVALID_IMAGE 0xb0100000
  1172. #define FW_MSG_CODE_AFEX_DRIVER_SETMAC_DONE 0xd0100000
  1173. #define FW_MSG_CODE_AFEX_LISTGET_ACK 0xd1100000
  1174. #define FW_MSG_CODE_AFEX_LISTSET_ACK 0xd2100000
  1175. #define FW_MSG_CODE_AFEX_STATSGET_ACK 0xd3100000
  1176. #define FW_MSG_CODE_AFEX_VIFSET_ACK 0xd4100000
  1177. #define FW_MSG_CODE_DRV_INFO_ACK 0xd8100000
  1178. #define FW_MSG_CODE_DRV_INFO_NACK 0xd9100000
  1179. #define FW_MSG_CODE_EEE_RESULS_ACK 0xda100000
  1180. #define FW_MSG_CODE_RMMOD_ACK 0xdb100000
  1181. #define FW_MSG_CODE_SET_MF_BW_SENT 0xe0000000
  1182. #define FW_MSG_CODE_SET_MF_BW_DONE 0xe1000000
  1183. #define FW_MSG_CODE_LINK_CHANGED_ACK 0x01100000
  1184. #define FW_MSG_CODE_LIC_CHALLENGE 0xff010000
  1185. #define FW_MSG_CODE_LIC_RESPONSE 0xff020000
  1186. #define FW_MSG_CODE_VIRT_MAC_PRIM 0xff030000
  1187. #define FW_MSG_CODE_VIRT_MAC_ISCSI 0xff040000
  1188. #define FW_MSG_SEQ_NUMBER_MASK 0x0000ffff
  1189. u32 fw_mb_param;
  1190. u32 drv_pulse_mb;
  1191. #define DRV_PULSE_SEQ_MASK 0x00007fff
  1192. #define DRV_PULSE_SYSTEM_TIME_MASK 0xffff0000
  1193. /*
  1194. * The system time is in the format of
  1195. * (year-2001)*12*32 + month*32 + day.
  1196. */
  1197. #define DRV_PULSE_ALWAYS_ALIVE 0x00008000
  1198. /*
  1199. * Indicate to the firmware not to go into the
  1200. * OS-absent when it is not getting driver pulse.
  1201. * This is used for debugging as well for PXE(MBA).
  1202. */
  1203. u32 mcp_pulse_mb;
  1204. #define MCP_PULSE_SEQ_MASK 0x00007fff
  1205. #define MCP_PULSE_ALWAYS_ALIVE 0x00008000
  1206. /* Indicates to the driver not to assert due to lack
  1207. * of MCP response */
  1208. #define MCP_EVENT_MASK 0xffff0000
  1209. #define MCP_EVENT_OTHER_DRIVER_RESET_REQ 0x00010000
  1210. u32 iscsi_boot_signature;
  1211. u32 iscsi_boot_block_offset;
  1212. u32 drv_status;
  1213. #define DRV_STATUS_PMF 0x00000001
  1214. #define DRV_STATUS_VF_DISABLED 0x00000002
  1215. #define DRV_STATUS_SET_MF_BW 0x00000004
  1216. #define DRV_STATUS_LINK_EVENT 0x00000008
  1217. #define DRV_STATUS_OEM_EVENT_MASK 0x00000070
  1218. #define DRV_STATUS_OEM_DISABLE_ENABLE_PF 0x00000010
  1219. #define DRV_STATUS_OEM_BANDWIDTH_ALLOCATION 0x00000020
  1220. #define DRV_STATUS_OEM_UPDATE_SVID 0x00000080
  1221. #define DRV_STATUS_DCC_EVENT_MASK 0x0000ff00
  1222. #define DRV_STATUS_DCC_DISABLE_ENABLE_PF 0x00000100
  1223. #define DRV_STATUS_DCC_BANDWIDTH_ALLOCATION 0x00000200
  1224. #define DRV_STATUS_DCC_CHANGE_MAC_ADDRESS 0x00000400
  1225. #define DRV_STATUS_DCC_RESERVED1 0x00000800
  1226. #define DRV_STATUS_DCC_SET_PROTOCOL 0x00001000
  1227. #define DRV_STATUS_DCC_SET_PRIORITY 0x00002000
  1228. #define DRV_STATUS_DCBX_EVENT_MASK 0x000f0000
  1229. #define DRV_STATUS_DCBX_NEGOTIATION_RESULTS 0x00010000
  1230. #define DRV_STATUS_AFEX_EVENT_MASK 0x03f00000
  1231. #define DRV_STATUS_AFEX_LISTGET_REQ 0x00100000
  1232. #define DRV_STATUS_AFEX_LISTSET_REQ 0x00200000
  1233. #define DRV_STATUS_AFEX_STATSGET_REQ 0x00400000
  1234. #define DRV_STATUS_AFEX_VIFSET_REQ 0x00800000
  1235. #define DRV_STATUS_DRV_INFO_REQ 0x04000000
  1236. #define DRV_STATUS_EEE_NEGOTIATION_RESULTS 0x08000000
  1237. u32 virt_mac_upper;
  1238. #define VIRT_MAC_SIGN_MASK 0xffff0000
  1239. #define VIRT_MAC_SIGNATURE 0x564d0000
  1240. u32 virt_mac_lower;
  1241. };
  1242. /****************************************************************************
  1243. * Management firmware state *
  1244. ****************************************************************************/
  1245. /* Allocate 440 bytes for management firmware */
  1246. #define MGMTFW_STATE_WORD_SIZE 110
  1247. struct mgmtfw_state {
  1248. u32 opaque[MGMTFW_STATE_WORD_SIZE];
  1249. };
  1250. /****************************************************************************
  1251. * Multi-Function configuration *
  1252. ****************************************************************************/
  1253. struct shared_mf_cfg {
  1254. u32 clp_mb;
  1255. #define SHARED_MF_CLP_SET_DEFAULT 0x00000000
  1256. /* set by CLP */
  1257. #define SHARED_MF_CLP_EXIT 0x00000001
  1258. /* set by MCP */
  1259. #define SHARED_MF_CLP_EXIT_DONE 0x00010000
  1260. };
  1261. struct port_mf_cfg {
  1262. u32 dynamic_cfg; /* device control channel */
  1263. #define PORT_MF_CFG_E1HOV_TAG_MASK 0x0000ffff
  1264. #define PORT_MF_CFG_E1HOV_TAG_SHIFT 0
  1265. #define PORT_MF_CFG_E1HOV_TAG_DEFAULT PORT_MF_CFG_E1HOV_TAG_MASK
  1266. u32 reserved[1];
  1267. };
  1268. struct func_mf_cfg {
  1269. u32 config;
  1270. /* E/R/I/D */
  1271. /* function 0 of each port cannot be hidden */
  1272. #define FUNC_MF_CFG_FUNC_HIDE 0x00000001
  1273. #define FUNC_MF_CFG_PROTOCOL_MASK 0x00000006
  1274. #define FUNC_MF_CFG_PROTOCOL_FCOE 0x00000000
  1275. #define FUNC_MF_CFG_PROTOCOL_ETHERNET 0x00000002
  1276. #define FUNC_MF_CFG_PROTOCOL_ETHERNET_WITH_RDMA 0x00000004
  1277. #define FUNC_MF_CFG_PROTOCOL_ISCSI 0x00000006
  1278. #define FUNC_MF_CFG_PROTOCOL_DEFAULT \
  1279. FUNC_MF_CFG_PROTOCOL_ETHERNET_WITH_RDMA
  1280. #define FUNC_MF_CFG_FUNC_DISABLED 0x00000008
  1281. #define FUNC_MF_CFG_FUNC_DELETED 0x00000010
  1282. /* PRI */
  1283. /* 0 - low priority, 3 - high priority */
  1284. #define FUNC_MF_CFG_TRANSMIT_PRIORITY_MASK 0x00000300
  1285. #define FUNC_MF_CFG_TRANSMIT_PRIORITY_SHIFT 8
  1286. #define FUNC_MF_CFG_TRANSMIT_PRIORITY_DEFAULT 0x00000000
  1287. /* MINBW, MAXBW */
  1288. /* value range - 0..100, increments in 100Mbps */
  1289. #define FUNC_MF_CFG_MIN_BW_MASK 0x00ff0000
  1290. #define FUNC_MF_CFG_MIN_BW_SHIFT 16
  1291. #define FUNC_MF_CFG_MIN_BW_DEFAULT 0x00000000
  1292. #define FUNC_MF_CFG_MAX_BW_MASK 0xff000000
  1293. #define FUNC_MF_CFG_MAX_BW_SHIFT 24
  1294. #define FUNC_MF_CFG_MAX_BW_DEFAULT 0x64000000
  1295. u32 mac_upper; /* MAC */
  1296. #define FUNC_MF_CFG_UPPERMAC_MASK 0x0000ffff
  1297. #define FUNC_MF_CFG_UPPERMAC_SHIFT 0
  1298. #define FUNC_MF_CFG_UPPERMAC_DEFAULT FUNC_MF_CFG_UPPERMAC_MASK
  1299. u32 mac_lower;
  1300. #define FUNC_MF_CFG_LOWERMAC_DEFAULT 0xffffffff
  1301. u32 e1hov_tag; /* VNI */
  1302. #define FUNC_MF_CFG_E1HOV_TAG_MASK 0x0000ffff
  1303. #define FUNC_MF_CFG_E1HOV_TAG_SHIFT 0
  1304. #define FUNC_MF_CFG_E1HOV_TAG_DEFAULT FUNC_MF_CFG_E1HOV_TAG_MASK
  1305. /* afex default VLAN ID - 12 bits */
  1306. #define FUNC_MF_CFG_AFEX_VLAN_MASK 0x0fff0000
  1307. #define FUNC_MF_CFG_AFEX_VLAN_SHIFT 16
  1308. u32 afex_config;
  1309. #define FUNC_MF_CFG_AFEX_COS_FILTER_MASK 0x000000ff
  1310. #define FUNC_MF_CFG_AFEX_COS_FILTER_SHIFT 0
  1311. #define FUNC_MF_CFG_AFEX_MBA_ENABLED_MASK 0x0000ff00
  1312. #define FUNC_MF_CFG_AFEX_MBA_ENABLED_SHIFT 8
  1313. #define FUNC_MF_CFG_AFEX_MBA_ENABLED_VAL 0x00000100
  1314. #define FUNC_MF_CFG_AFEX_VLAN_MODE_MASK 0x000f0000
  1315. #define FUNC_MF_CFG_AFEX_VLAN_MODE_SHIFT 16
  1316. u32 reserved;
  1317. };
  1318. enum mf_cfg_afex_vlan_mode {
  1319. FUNC_MF_CFG_AFEX_VLAN_TRUNK_MODE = 0,
  1320. FUNC_MF_CFG_AFEX_VLAN_ACCESS_MODE,
  1321. FUNC_MF_CFG_AFEX_VLAN_TRUNK_TAG_NATIVE_MODE
  1322. };
  1323. /* This structure is not applicable and should not be accessed on 57711 */
  1324. struct func_ext_cfg {
  1325. u32 func_cfg;
  1326. #define MACP_FUNC_CFG_FLAGS_MASK 0x0000007F
  1327. #define MACP_FUNC_CFG_FLAGS_SHIFT 0
  1328. #define MACP_FUNC_CFG_FLAGS_ENABLED 0x00000001
  1329. #define MACP_FUNC_CFG_FLAGS_ETHERNET 0x00000002
  1330. #define MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD 0x00000004
  1331. #define MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD 0x00000008
  1332. #define MACP_FUNC_CFG_PAUSE_ON_HOST_RING 0x00000080
  1333. u32 iscsi_mac_addr_upper;
  1334. u32 iscsi_mac_addr_lower;
  1335. u32 fcoe_mac_addr_upper;
  1336. u32 fcoe_mac_addr_lower;
  1337. u32 fcoe_wwn_port_name_upper;
  1338. u32 fcoe_wwn_port_name_lower;
  1339. u32 fcoe_wwn_node_name_upper;
  1340. u32 fcoe_wwn_node_name_lower;
  1341. u32 preserve_data;
  1342. #define MF_FUNC_CFG_PRESERVE_L2_MAC (1<<0)
  1343. #define MF_FUNC_CFG_PRESERVE_ISCSI_MAC (1<<1)
  1344. #define MF_FUNC_CFG_PRESERVE_FCOE_MAC (1<<2)
  1345. #define MF_FUNC_CFG_PRESERVE_FCOE_WWN_P (1<<3)
  1346. #define MF_FUNC_CFG_PRESERVE_FCOE_WWN_N (1<<4)
  1347. #define MF_FUNC_CFG_PRESERVE_TX_BW (1<<5)
  1348. };
  1349. struct mf_cfg {
  1350. struct shared_mf_cfg shared_mf_config; /* 0x4 */
  1351. /* 0x8*2*2=0x20 */
  1352. struct port_mf_cfg port_mf_config[NVM_PATH_MAX][PORT_MAX];
  1353. /* for all chips, there are 8 mf functions */
  1354. struct func_mf_cfg func_mf_config[E1H_FUNC_MAX]; /* 0x18 * 8 = 0xc0 */
  1355. /*
  1356. * Extended configuration per function - this array does not exist and
  1357. * should not be accessed on 57711
  1358. */
  1359. struct func_ext_cfg func_ext_config[E1H_FUNC_MAX]; /* 0x28 * 8 = 0x140*/
  1360. }; /* 0x224 */
  1361. /****************************************************************************
  1362. * Shared Memory Region *
  1363. ****************************************************************************/
  1364. struct shmem_region { /* SharedMem Offset (size) */
  1365. u32 validity_map[PORT_MAX]; /* 0x0 (4*2 = 0x8) */
  1366. #define SHR_MEM_FORMAT_REV_MASK 0xff000000
  1367. #define SHR_MEM_FORMAT_REV_ID ('A'<<24)
  1368. /* validity bits */
  1369. #define SHR_MEM_VALIDITY_PCI_CFG 0x00100000
  1370. #define SHR_MEM_VALIDITY_MB 0x00200000
  1371. #define SHR_MEM_VALIDITY_DEV_INFO 0x00400000
  1372. #define SHR_MEM_VALIDITY_RESERVED 0x00000007
  1373. /* One licensing bit should be set */
  1374. #define SHR_MEM_VALIDITY_LIC_KEY_IN_EFFECT_MASK 0x00000038
  1375. #define SHR_MEM_VALIDITY_LIC_MANUF_KEY_IN_EFFECT 0x00000008
  1376. #define SHR_MEM_VALIDITY_LIC_UPGRADE_KEY_IN_EFFECT 0x00000010
  1377. #define SHR_MEM_VALIDITY_LIC_NO_KEY_IN_EFFECT 0x00000020
  1378. /* Active MFW */
  1379. #define SHR_MEM_VALIDITY_ACTIVE_MFW_UNKNOWN 0x00000000
  1380. #define SHR_MEM_VALIDITY_ACTIVE_MFW_MASK 0x000001c0
  1381. #define SHR_MEM_VALIDITY_ACTIVE_MFW_IPMI 0x00000040
  1382. #define SHR_MEM_VALIDITY_ACTIVE_MFW_UMP 0x00000080
  1383. #define SHR_MEM_VALIDITY_ACTIVE_MFW_NCSI 0x000000c0
  1384. #define SHR_MEM_VALIDITY_ACTIVE_MFW_NONE 0x000001c0
  1385. struct shm_dev_info dev_info; /* 0x8 (0x438) */
  1386. struct license_key drv_lic_key[PORT_MAX]; /* 0x440 (52*2=0x68) */
  1387. /* FW information (for internal FW use) */
  1388. u32 fw_info_fio_offset; /* 0x4a8 (0x4) */
  1389. struct mgmtfw_state mgmtfw_state; /* 0x4ac (0x1b8) */
  1390. struct drv_port_mb port_mb[PORT_MAX]; /* 0x664 (16*2=0x20) */
  1391. #ifdef BMAPI
  1392. /* This is a variable length array */
  1393. /* the number of function depends on the chip type */
  1394. struct drv_func_mb func_mb[1]; /* 0x684 (44*2/4/8=0x58/0xb0/0x160) */
  1395. #else
  1396. /* the number of function depends on the chip type */
  1397. struct drv_func_mb func_mb[]; /* 0x684 (44*2/4/8=0x58/0xb0/0x160) */
  1398. #endif /* BMAPI */
  1399. }; /* 57710 = 0x6dc | 57711 = 0x7E4 | 57712 = 0x734 */
  1400. /****************************************************************************
  1401. * Shared Memory 2 Region *
  1402. ****************************************************************************/
  1403. /* The fw_flr_ack is actually built in the following way: */
  1404. /* 8 bit: PF ack */
  1405. /* 64 bit: VF ack */
  1406. /* 8 bit: ios_dis_ack */
  1407. /* In order to maintain endianity in the mailbox hsi, we want to keep using */
  1408. /* u32. The fw must have the VF right after the PF since this is how it */
  1409. /* access arrays(it expects always the VF to reside after the PF, and that */
  1410. /* makes the calculation much easier for it. ) */
  1411. /* In order to answer both limitations, and keep the struct small, the code */
  1412. /* will abuse the structure defined here to achieve the actual partition */
  1413. /* above */
  1414. /****************************************************************************/
  1415. struct fw_flr_ack {
  1416. u32 pf_ack;
  1417. u32 vf_ack[1];
  1418. u32 iov_dis_ack;
  1419. };
  1420. struct fw_flr_mb {
  1421. u32 aggint;
  1422. u32 opgen_addr;
  1423. struct fw_flr_ack ack;
  1424. };
  1425. struct eee_remote_vals {
  1426. u32 tx_tw;
  1427. u32 rx_tw;
  1428. };
  1429. /**** SUPPORT FOR SHMEM ARRRAYS ***
  1430. * The SHMEM HSI is aligned on 32 bit boundaries which makes it difficult to
  1431. * define arrays with storage types smaller then unsigned dwords.
  1432. * The macros below add generic support for SHMEM arrays with numeric elements
  1433. * that can span 2,4,8 or 16 bits. The array underlying type is a 32 bit dword
  1434. * array with individual bit-filed elements accessed using shifts and masks.
  1435. *
  1436. */
  1437. /* eb is the bitwidth of a single element */
  1438. #define SHMEM_ARRAY_MASK(eb) ((1<<(eb))-1)
  1439. #define SHMEM_ARRAY_ENTRY(i, eb) ((i)/(32/(eb)))
  1440. /* the bit-position macro allows the used to flip the order of the arrays
  1441. * elements on a per byte or word boundary.
  1442. *
  1443. * example: an array with 8 entries each 4 bit wide. This array will fit into
  1444. * a single dword. The diagrmas below show the array order of the nibbles.
  1445. *
  1446. * SHMEM_ARRAY_BITPOS(i, 4, 4) defines the stadard ordering:
  1447. *
  1448. * | | | |
  1449. * 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
  1450. * | | | |
  1451. *
  1452. * SHMEM_ARRAY_BITPOS(i, 4, 8) defines a flip ordering per byte:
  1453. *
  1454. * | | | |
  1455. * 1 | 0 | 3 | 2 | 5 | 4 | 7 | 6 |
  1456. * | | | |
  1457. *
  1458. * SHMEM_ARRAY_BITPOS(i, 4, 16) defines a flip ordering per word:
  1459. *
  1460. * | | | |
  1461. * 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 |
  1462. * | | | |
  1463. */
  1464. #define SHMEM_ARRAY_BITPOS(i, eb, fb) \
  1465. ((((32/(fb)) - 1 - ((i)/((fb)/(eb))) % (32/(fb))) * (fb)) + \
  1466. (((i)%((fb)/(eb))) * (eb)))
  1467. #define SHMEM_ARRAY_GET(a, i, eb, fb) \
  1468. ((a[SHMEM_ARRAY_ENTRY(i, eb)] >> SHMEM_ARRAY_BITPOS(i, eb, fb)) & \
  1469. SHMEM_ARRAY_MASK(eb))
  1470. #define SHMEM_ARRAY_SET(a, i, eb, fb, val) \
  1471. do { \
  1472. a[SHMEM_ARRAY_ENTRY(i, eb)] &= ~(SHMEM_ARRAY_MASK(eb) << \
  1473. SHMEM_ARRAY_BITPOS(i, eb, fb)); \
  1474. a[SHMEM_ARRAY_ENTRY(i, eb)] |= (((val) & SHMEM_ARRAY_MASK(eb)) << \
  1475. SHMEM_ARRAY_BITPOS(i, eb, fb)); \
  1476. } while (0)
  1477. /****START OF DCBX STRUCTURES DECLARATIONS****/
  1478. #define DCBX_MAX_NUM_PRI_PG_ENTRIES 8
  1479. #define DCBX_PRI_PG_BITWIDTH 4
  1480. #define DCBX_PRI_PG_FBITS 8
  1481. #define DCBX_PRI_PG_GET(a, i) \
  1482. SHMEM_ARRAY_GET(a, i, DCBX_PRI_PG_BITWIDTH, DCBX_PRI_PG_FBITS)
  1483. #define DCBX_PRI_PG_SET(a, i, val) \
  1484. SHMEM_ARRAY_SET(a, i, DCBX_PRI_PG_BITWIDTH, DCBX_PRI_PG_FBITS, val)
  1485. #define DCBX_MAX_NUM_PG_BW_ENTRIES 8
  1486. #define DCBX_BW_PG_BITWIDTH 8
  1487. #define DCBX_PG_BW_GET(a, i) \
  1488. SHMEM_ARRAY_GET(a, i, DCBX_BW_PG_BITWIDTH, DCBX_BW_PG_BITWIDTH)
  1489. #define DCBX_PG_BW_SET(a, i, val) \
  1490. SHMEM_ARRAY_SET(a, i, DCBX_BW_PG_BITWIDTH, DCBX_BW_PG_BITWIDTH, val)
  1491. #define DCBX_STRICT_PRI_PG 15
  1492. #define DCBX_MAX_APP_PROTOCOL 16
  1493. #define FCOE_APP_IDX 0
  1494. #define ISCSI_APP_IDX 1
  1495. #define PREDEFINED_APP_IDX_MAX 2
  1496. /* Big/Little endian have the same representation. */
  1497. struct dcbx_ets_feature {
  1498. /*
  1499. * For Admin MIB - is this feature supported by the
  1500. * driver | For Local MIB - should this feature be enabled.
  1501. */
  1502. u32 enabled;
  1503. u32 pg_bw_tbl[2];
  1504. u32 pri_pg_tbl[1];
  1505. };
  1506. /* Driver structure in LE */
  1507. struct dcbx_pfc_feature {
  1508. #ifdef __BIG_ENDIAN
  1509. u8 pri_en_bitmap;
  1510. #define DCBX_PFC_PRI_0 0x01
  1511. #define DCBX_PFC_PRI_1 0x02
  1512. #define DCBX_PFC_PRI_2 0x04
  1513. #define DCBX_PFC_PRI_3 0x08
  1514. #define DCBX_PFC_PRI_4 0x10
  1515. #define DCBX_PFC_PRI_5 0x20
  1516. #define DCBX_PFC_PRI_6 0x40
  1517. #define DCBX_PFC_PRI_7 0x80
  1518. u8 pfc_caps;
  1519. u8 reserved;
  1520. u8 enabled;
  1521. #elif defined(__LITTLE_ENDIAN)
  1522. u8 enabled;
  1523. u8 reserved;
  1524. u8 pfc_caps;
  1525. u8 pri_en_bitmap;
  1526. #define DCBX_PFC_PRI_0 0x01
  1527. #define DCBX_PFC_PRI_1 0x02
  1528. #define DCBX_PFC_PRI_2 0x04
  1529. #define DCBX_PFC_PRI_3 0x08
  1530. #define DCBX_PFC_PRI_4 0x10
  1531. #define DCBX_PFC_PRI_5 0x20
  1532. #define DCBX_PFC_PRI_6 0x40
  1533. #define DCBX_PFC_PRI_7 0x80
  1534. #endif
  1535. };
  1536. struct dcbx_app_priority_entry {
  1537. #ifdef __BIG_ENDIAN
  1538. u16 app_id;
  1539. u8 pri_bitmap;
  1540. u8 appBitfield;
  1541. #define DCBX_APP_ENTRY_VALID 0x01
  1542. #define DCBX_APP_ENTRY_SF_MASK 0xF0
  1543. #define DCBX_APP_ENTRY_SF_SHIFT 4
  1544. #define DCBX_APP_SF_ETH_TYPE 0x10
  1545. #define DCBX_APP_SF_PORT 0x20
  1546. #define DCBX_APP_SF_UDP 0x40
  1547. #define DCBX_APP_SF_DEFAULT 0x80
  1548. #elif defined(__LITTLE_ENDIAN)
  1549. u8 appBitfield;
  1550. #define DCBX_APP_ENTRY_VALID 0x01
  1551. #define DCBX_APP_ENTRY_SF_MASK 0xF0
  1552. #define DCBX_APP_ENTRY_SF_SHIFT 4
  1553. #define DCBX_APP_ENTRY_VALID 0x01
  1554. #define DCBX_APP_SF_ETH_TYPE 0x10
  1555. #define DCBX_APP_SF_PORT 0x20
  1556. #define DCBX_APP_SF_UDP 0x40
  1557. #define DCBX_APP_SF_DEFAULT 0x80
  1558. u8 pri_bitmap;
  1559. u16 app_id;
  1560. #endif
  1561. };
  1562. /* FW structure in BE */
  1563. struct dcbx_app_priority_feature {
  1564. #ifdef __BIG_ENDIAN
  1565. u8 reserved;
  1566. u8 default_pri;
  1567. u8 tc_supported;
  1568. u8 enabled;
  1569. #elif defined(__LITTLE_ENDIAN)
  1570. u8 enabled;
  1571. u8 tc_supported;
  1572. u8 default_pri;
  1573. u8 reserved;
  1574. #endif
  1575. struct dcbx_app_priority_entry app_pri_tbl[DCBX_MAX_APP_PROTOCOL];
  1576. };
  1577. /* FW structure in BE */
  1578. struct dcbx_features {
  1579. /* PG feature */
  1580. struct dcbx_ets_feature ets;
  1581. /* PFC feature */
  1582. struct dcbx_pfc_feature pfc;
  1583. /* APP feature */
  1584. struct dcbx_app_priority_feature app;
  1585. };
  1586. /* LLDP protocol parameters */
  1587. /* FW structure in BE */
  1588. struct lldp_params {
  1589. #ifdef __BIG_ENDIAN
  1590. u8 msg_fast_tx_interval;
  1591. u8 msg_tx_hold;
  1592. u8 msg_tx_interval;
  1593. u8 admin_status;
  1594. #define LLDP_TX_ONLY 0x01
  1595. #define LLDP_RX_ONLY 0x02
  1596. #define LLDP_TX_RX 0x03
  1597. #define LLDP_DISABLED 0x04
  1598. u8 reserved1;
  1599. u8 tx_fast;
  1600. u8 tx_crd_max;
  1601. u8 tx_crd;
  1602. #elif defined(__LITTLE_ENDIAN)
  1603. u8 admin_status;
  1604. #define LLDP_TX_ONLY 0x01
  1605. #define LLDP_RX_ONLY 0x02
  1606. #define LLDP_TX_RX 0x03
  1607. #define LLDP_DISABLED 0x04
  1608. u8 msg_tx_interval;
  1609. u8 msg_tx_hold;
  1610. u8 msg_fast_tx_interval;
  1611. u8 tx_crd;
  1612. u8 tx_crd_max;
  1613. u8 tx_fast;
  1614. u8 reserved1;
  1615. #endif
  1616. #define REM_CHASSIS_ID_STAT_LEN 4
  1617. #define REM_PORT_ID_STAT_LEN 4
  1618. /* Holds remote Chassis ID TLV header, subtype and 9B of payload. */
  1619. u32 peer_chassis_id[REM_CHASSIS_ID_STAT_LEN];
  1620. /* Holds remote Port ID TLV header, subtype and 9B of payload. */
  1621. u32 peer_port_id[REM_PORT_ID_STAT_LEN];
  1622. };
  1623. struct lldp_dcbx_stat {
  1624. #define LOCAL_CHASSIS_ID_STAT_LEN 2
  1625. #define LOCAL_PORT_ID_STAT_LEN 2
  1626. /* Holds local Chassis ID 8B payload of constant subtype 4. */
  1627. u32 local_chassis_id[LOCAL_CHASSIS_ID_STAT_LEN];
  1628. /* Holds local Port ID 8B payload of constant subtype 3. */
  1629. u32 local_port_id[LOCAL_PORT_ID_STAT_LEN];
  1630. /* Number of DCBX frames transmitted. */
  1631. u32 num_tx_dcbx_pkts;
  1632. /* Number of DCBX frames received. */
  1633. u32 num_rx_dcbx_pkts;
  1634. };
  1635. /* ADMIN MIB - DCBX local machine default configuration. */
  1636. struct lldp_admin_mib {
  1637. u32 ver_cfg_flags;
  1638. #define DCBX_ETS_CONFIG_TX_ENABLED 0x00000001
  1639. #define DCBX_PFC_CONFIG_TX_ENABLED 0x00000002
  1640. #define DCBX_APP_CONFIG_TX_ENABLED 0x00000004
  1641. #define DCBX_ETS_RECO_TX_ENABLED 0x00000008
  1642. #define DCBX_ETS_RECO_VALID 0x00000010
  1643. #define DCBX_ETS_WILLING 0x00000020
  1644. #define DCBX_PFC_WILLING 0x00000040
  1645. #define DCBX_APP_WILLING 0x00000080
  1646. #define DCBX_VERSION_CEE 0x00000100
  1647. #define DCBX_VERSION_IEEE 0x00000200
  1648. #define DCBX_DCBX_ENABLED 0x00000400
  1649. #define DCBX_CEE_VERSION_MASK 0x0000f000
  1650. #define DCBX_CEE_VERSION_SHIFT 12
  1651. #define DCBX_CEE_MAX_VERSION_MASK 0x000f0000
  1652. #define DCBX_CEE_MAX_VERSION_SHIFT 16
  1653. struct dcbx_features features;
  1654. };
  1655. /* REMOTE MIB - remote machine DCBX configuration. */
  1656. struct lldp_remote_mib {
  1657. u32 prefix_seq_num;
  1658. u32 flags;
  1659. #define DCBX_ETS_TLV_RX 0x00000001
  1660. #define DCBX_PFC_TLV_RX 0x00000002
  1661. #define DCBX_APP_TLV_RX 0x00000004
  1662. #define DCBX_ETS_RX_ERROR 0x00000010
  1663. #define DCBX_PFC_RX_ERROR 0x00000020
  1664. #define DCBX_APP_RX_ERROR 0x00000040
  1665. #define DCBX_ETS_REM_WILLING 0x00000100
  1666. #define DCBX_PFC_REM_WILLING 0x00000200
  1667. #define DCBX_APP_REM_WILLING 0x00000400
  1668. #define DCBX_REMOTE_ETS_RECO_VALID 0x00001000
  1669. #define DCBX_REMOTE_MIB_VALID 0x00002000
  1670. struct dcbx_features features;
  1671. u32 suffix_seq_num;
  1672. };
  1673. /* LOCAL MIB - operational DCBX configuration - transmitted on Tx LLDPDU. */
  1674. struct lldp_local_mib {
  1675. u32 prefix_seq_num;
  1676. /* Indicates if there is mismatch with negotiation results. */
  1677. u32 error;
  1678. #define DCBX_LOCAL_ETS_ERROR 0x00000001
  1679. #define DCBX_LOCAL_PFC_ERROR 0x00000002
  1680. #define DCBX_LOCAL_APP_ERROR 0x00000004
  1681. #define DCBX_LOCAL_PFC_MISMATCH 0x00000010
  1682. #define DCBX_LOCAL_APP_MISMATCH 0x00000020
  1683. #define DCBX_REMOTE_MIB_ERROR 0x00000040
  1684. #define DCBX_REMOTE_ETS_TLV_NOT_FOUND 0x00000080
  1685. #define DCBX_REMOTE_PFC_TLV_NOT_FOUND 0x00000100
  1686. #define DCBX_REMOTE_APP_TLV_NOT_FOUND 0x00000200
  1687. struct dcbx_features features;
  1688. u32 suffix_seq_num;
  1689. };
  1690. /***END OF DCBX STRUCTURES DECLARATIONS***/
  1691. /***********************************************************/
  1692. /* Elink section */
  1693. /***********************************************************/
  1694. #define SHMEM_LINK_CONFIG_SIZE 2
  1695. struct shmem_lfa {
  1696. u32 req_duplex;
  1697. #define REQ_DUPLEX_PHY0_MASK 0x0000ffff
  1698. #define REQ_DUPLEX_PHY0_SHIFT 0
  1699. #define REQ_DUPLEX_PHY1_MASK 0xffff0000
  1700. #define REQ_DUPLEX_PHY1_SHIFT 16
  1701. u32 req_flow_ctrl;
  1702. #define REQ_FLOW_CTRL_PHY0_MASK 0x0000ffff
  1703. #define REQ_FLOW_CTRL_PHY0_SHIFT 0
  1704. #define REQ_FLOW_CTRL_PHY1_MASK 0xffff0000
  1705. #define REQ_FLOW_CTRL_PHY1_SHIFT 16
  1706. u32 req_line_speed; /* Also determine AutoNeg */
  1707. #define REQ_LINE_SPD_PHY0_MASK 0x0000ffff
  1708. #define REQ_LINE_SPD_PHY0_SHIFT 0
  1709. #define REQ_LINE_SPD_PHY1_MASK 0xffff0000
  1710. #define REQ_LINE_SPD_PHY1_SHIFT 16
  1711. u32 speed_cap_mask[SHMEM_LINK_CONFIG_SIZE];
  1712. u32 additional_config;
  1713. #define REQ_FC_AUTO_ADV_MASK 0x0000ffff
  1714. #define REQ_FC_AUTO_ADV0_SHIFT 0
  1715. #define NO_LFA_DUE_TO_DCC_MASK 0x00010000
  1716. u32 lfa_sts;
  1717. #define LFA_LINK_FLAP_REASON_OFFSET 0
  1718. #define LFA_LINK_FLAP_REASON_MASK 0x000000ff
  1719. #define LFA_LINK_DOWN 0x1
  1720. #define LFA_LOOPBACK_ENABLED 0x2
  1721. #define LFA_DUPLEX_MISMATCH 0x3
  1722. #define LFA_MFW_IS_TOO_OLD 0x4
  1723. #define LFA_LINK_SPEED_MISMATCH 0x5
  1724. #define LFA_FLOW_CTRL_MISMATCH 0x6
  1725. #define LFA_SPEED_CAP_MISMATCH 0x7
  1726. #define LFA_DCC_LFA_DISABLED 0x8
  1727. #define LFA_EEE_MISMATCH 0x9
  1728. #define LINK_FLAP_AVOIDANCE_COUNT_OFFSET 8
  1729. #define LINK_FLAP_AVOIDANCE_COUNT_MASK 0x0000ff00
  1730. #define LINK_FLAP_COUNT_OFFSET 16
  1731. #define LINK_FLAP_COUNT_MASK 0x00ff0000
  1732. #define LFA_FLAGS_MASK 0xff000000
  1733. #define SHMEM_LFA_DONT_CLEAR_STAT (1<<24)
  1734. };
  1735. /* Used to support NSCI get OS driver version
  1736. * on driver load the version value will be set
  1737. * on driver unload driver value of 0x0 will be set.
  1738. */
  1739. struct os_drv_ver {
  1740. #define DRV_VER_NOT_LOADED 0
  1741. /* personalties order is important */
  1742. #define DRV_PERS_ETHERNET 0
  1743. #define DRV_PERS_ISCSI 1
  1744. #define DRV_PERS_FCOE 2
  1745. /* shmem2 struct is constant can't add more personalties here */
  1746. #define MAX_DRV_PERS 3
  1747. u32 versions[MAX_DRV_PERS];
  1748. };
  1749. struct ncsi_oem_fcoe_features {
  1750. u32 fcoe_features1;
  1751. #define FCOE_FEATURES1_IOS_PER_CONNECTION_MASK 0x0000FFFF
  1752. #define FCOE_FEATURES1_IOS_PER_CONNECTION_OFFSET 0
  1753. #define FCOE_FEATURES1_LOGINS_PER_PORT_MASK 0xFFFF0000
  1754. #define FCOE_FEATURES1_LOGINS_PER_PORT_OFFSET 16
  1755. u32 fcoe_features2;
  1756. #define FCOE_FEATURES2_EXCHANGES_MASK 0x0000FFFF
  1757. #define FCOE_FEATURES2_EXCHANGES_OFFSET 0
  1758. #define FCOE_FEATURES2_NPIV_WWN_PER_PORT_MASK 0xFFFF0000
  1759. #define FCOE_FEATURES2_NPIV_WWN_PER_PORT_OFFSET 16
  1760. u32 fcoe_features3;
  1761. #define FCOE_FEATURES3_TARGETS_SUPPORTED_MASK 0x0000FFFF
  1762. #define FCOE_FEATURES3_TARGETS_SUPPORTED_OFFSET 0
  1763. #define FCOE_FEATURES3_OUTSTANDING_COMMANDS_MASK 0xFFFF0000
  1764. #define FCOE_FEATURES3_OUTSTANDING_COMMANDS_OFFSET 16
  1765. u32 fcoe_features4;
  1766. #define FCOE_FEATURES4_FEATURE_SETTINGS_MASK 0x0000000F
  1767. #define FCOE_FEATURES4_FEATURE_SETTINGS_OFFSET 0
  1768. };
  1769. enum curr_cfg_method_e {
  1770. CURR_CFG_MET_NONE = 0, /* default config */
  1771. CURR_CFG_MET_OS = 1,
  1772. CURR_CFG_MET_VENDOR_SPEC = 2,/* e.g. Option ROM, NPAR, O/S Cfg Utils */
  1773. };
  1774. #define FC_NPIV_WWPN_SIZE 8
  1775. #define FC_NPIV_WWNN_SIZE 8
  1776. struct bdn_npiv_settings {
  1777. u8 npiv_wwpn[FC_NPIV_WWPN_SIZE];
  1778. u8 npiv_wwnn[FC_NPIV_WWNN_SIZE];
  1779. };
  1780. struct bdn_fc_npiv_cfg {
  1781. /* hdr used internally by the MFW */
  1782. u32 hdr;
  1783. u32 num_of_npiv;
  1784. };
  1785. #define MAX_NUMBER_NPIV 64
  1786. struct bdn_fc_npiv_tbl {
  1787. struct bdn_fc_npiv_cfg fc_npiv_cfg;
  1788. struct bdn_npiv_settings settings[MAX_NUMBER_NPIV];
  1789. };
  1790. struct mdump_driver_info {
  1791. u32 epoc;
  1792. u32 drv_ver;
  1793. u32 fw_ver;
  1794. u32 valid_dump;
  1795. #define FIRST_DUMP_VALID (1 << 0)
  1796. #define SECOND_DUMP_VALID (1 << 1)
  1797. u32 flags;
  1798. #define ENABLE_ALL_TRIGGERS (0x7fffffff)
  1799. #define TRIGGER_MDUMP_ONCE (1 << 31)
  1800. };
  1801. struct ncsi_oem_data {
  1802. u32 driver_version[4];
  1803. struct ncsi_oem_fcoe_features ncsi_oem_fcoe_features;
  1804. };
  1805. struct shmem2_region {
  1806. u32 size; /* 0x0000 */
  1807. u32 dcc_support; /* 0x0004 */
  1808. #define SHMEM_DCC_SUPPORT_NONE 0x00000000
  1809. #define SHMEM_DCC_SUPPORT_DISABLE_ENABLE_PF_TLV 0x00000001
  1810. #define SHMEM_DCC_SUPPORT_BANDWIDTH_ALLOCATION_TLV 0x00000004
  1811. #define SHMEM_DCC_SUPPORT_CHANGE_MAC_ADDRESS_TLV 0x00000008
  1812. #define SHMEM_DCC_SUPPORT_SET_PROTOCOL_TLV 0x00000040
  1813. #define SHMEM_DCC_SUPPORT_SET_PRIORITY_TLV 0x00000080
  1814. u32 ext_phy_fw_version2[PORT_MAX]; /* 0x0008 */
  1815. /*
  1816. * For backwards compatibility, if the mf_cfg_addr does not exist
  1817. * (the size filed is smaller than 0xc) the mf_cfg resides at the
  1818. * end of struct shmem_region
  1819. */
  1820. u32 mf_cfg_addr; /* 0x0010 */
  1821. #define SHMEM_MF_CFG_ADDR_NONE 0x00000000
  1822. struct fw_flr_mb flr_mb; /* 0x0014 */
  1823. u32 dcbx_lldp_params_offset; /* 0x0028 */
  1824. #define SHMEM_LLDP_DCBX_PARAMS_NONE 0x00000000
  1825. u32 dcbx_neg_res_offset; /* 0x002c */
  1826. #define SHMEM_DCBX_NEG_RES_NONE 0x00000000
  1827. u32 dcbx_remote_mib_offset; /* 0x0030 */
  1828. #define SHMEM_DCBX_REMOTE_MIB_NONE 0x00000000
  1829. /*
  1830. * The other shmemX_base_addr holds the other path's shmem address
  1831. * required for example in case of common phy init, or for path1 to know
  1832. * the address of mcp debug trace which is located in offset from shmem
  1833. * of path0
  1834. */
  1835. u32 other_shmem_base_addr; /* 0x0034 */
  1836. u32 other_shmem2_base_addr; /* 0x0038 */
  1837. /*
  1838. * mcp_vf_disabled is set by the MCP to indicate the driver about VFs
  1839. * which were disabled/flred
  1840. */
  1841. u32 mcp_vf_disabled[E2_VF_MAX / 32]; /* 0x003c */
  1842. /*
  1843. * drv_ack_vf_disabled is set by the PF driver to ack handled disabled
  1844. * VFs
  1845. */
  1846. u32 drv_ack_vf_disabled[E2_FUNC_MAX][E2_VF_MAX / 32]; /* 0x0044 */
  1847. u32 dcbx_lldp_dcbx_stat_offset; /* 0x0064 */
  1848. #define SHMEM_LLDP_DCBX_STAT_NONE 0x00000000
  1849. /*
  1850. * edebug_driver_if field is used to transfer messages between edebug
  1851. * app to the driver through shmem2.
  1852. *
  1853. * message format:
  1854. * bits 0-2 - function number / instance of driver to perform request
  1855. * bits 3-5 - op code / is_ack?
  1856. * bits 6-63 - data
  1857. */
  1858. u32 edebug_driver_if[2]; /* 0x0068 */
  1859. #define EDEBUG_DRIVER_IF_OP_CODE_GET_PHYS_ADDR 1
  1860. #define EDEBUG_DRIVER_IF_OP_CODE_GET_BUS_ADDR 2
  1861. #define EDEBUG_DRIVER_IF_OP_CODE_DISABLE_STAT 3
  1862. u32 nvm_retain_bitmap_addr; /* 0x0070 */
  1863. /* afex support of that driver */
  1864. u32 afex_driver_support; /* 0x0074 */
  1865. #define SHMEM_AFEX_VERSION_MASK 0x100f
  1866. #define SHMEM_AFEX_SUPPORTED_VERSION_ONE 0x1001
  1867. #define SHMEM_AFEX_REDUCED_DRV_LOADED 0x8000
  1868. /* driver receives addr in scratchpad to which it should respond */
  1869. u32 afex_scratchpad_addr_to_write[E2_FUNC_MAX];
  1870. /* generic params from MCP to driver (value depends on the msg sent
  1871. * to driver
  1872. */
  1873. u32 afex_param1_to_driver[E2_FUNC_MAX]; /* 0x0088 */
  1874. u32 afex_param2_to_driver[E2_FUNC_MAX]; /* 0x0098 */
  1875. u32 swim_base_addr; /* 0x0108 */
  1876. u32 swim_funcs;
  1877. u32 swim_main_cb;
  1878. /* bitmap notifying which VIF profiles stored in nvram are enabled by
  1879. * switch
  1880. */
  1881. u32 afex_profiles_enabled[2];
  1882. /* generic flags controlled by the driver */
  1883. u32 drv_flags;
  1884. #define DRV_FLAGS_DCB_CONFIGURED 0x0
  1885. #define DRV_FLAGS_DCB_CONFIGURATION_ABORTED 0x1
  1886. #define DRV_FLAGS_DCB_MFW_CONFIGURED 0x2
  1887. #define DRV_FLAGS_PORT_MASK ((1 << DRV_FLAGS_DCB_CONFIGURED) | \
  1888. (1 << DRV_FLAGS_DCB_CONFIGURATION_ABORTED) | \
  1889. (1 << DRV_FLAGS_DCB_MFW_CONFIGURED))
  1890. /* pointer to extended dev_info shared data copied from nvm image */
  1891. u32 extended_dev_info_shared_addr;
  1892. u32 ncsi_oem_data_addr;
  1893. u32 ocsd_host_addr; /* initialized by option ROM */
  1894. u32 ocbb_host_addr; /* initialized by option ROM */
  1895. u32 ocsd_req_update_interval; /* initialized by option ROM */
  1896. u32 temperature_in_half_celsius;
  1897. u32 glob_struct_in_host;
  1898. u32 dcbx_neg_res_ext_offset;
  1899. #define SHMEM_DCBX_NEG_RES_EXT_NONE 0x00000000
  1900. u32 drv_capabilities_flag[E2_FUNC_MAX];
  1901. #define DRV_FLAGS_CAPABILITIES_LOADED_SUPPORTED 0x00000001
  1902. #define DRV_FLAGS_CAPABILITIES_LOADED_L2 0x00000002
  1903. #define DRV_FLAGS_CAPABILITIES_LOADED_FCOE 0x00000004
  1904. #define DRV_FLAGS_CAPABILITIES_LOADED_ISCSI 0x00000008
  1905. #define DRV_FLAGS_MTU_MASK 0xffff0000
  1906. #define DRV_FLAGS_MTU_SHIFT 16
  1907. u32 extended_dev_info_shared_cfg_size;
  1908. u32 dcbx_en[PORT_MAX];
  1909. /* The offset points to the multi threaded meta structure */
  1910. u32 multi_thread_data_offset;
  1911. /* address of DMAable host address holding values from the drivers */
  1912. u32 drv_info_host_addr_lo;
  1913. u32 drv_info_host_addr_hi;
  1914. /* general values written by the MFW (such as current version) */
  1915. u32 drv_info_control;
  1916. #define DRV_INFO_CONTROL_VER_MASK 0x000000ff
  1917. #define DRV_INFO_CONTROL_VER_SHIFT 0
  1918. #define DRV_INFO_CONTROL_OP_CODE_MASK 0x0000ff00
  1919. #define DRV_INFO_CONTROL_OP_CODE_SHIFT 8
  1920. u32 ibft_host_addr; /* initialized by option ROM */
  1921. struct eee_remote_vals eee_remote_vals[PORT_MAX];
  1922. u32 reserved[E2_FUNC_MAX];
  1923. /* the status of EEE auto-negotiation
  1924. * bits 15:0 the configured tx-lpi entry timer value. Depends on bit 31.
  1925. * bits 19:16 the supported modes for EEE.
  1926. * bits 23:20 the speeds advertised for EEE.
  1927. * bits 27:24 the speeds the Link partner advertised for EEE.
  1928. * The supported/adv. modes in bits 27:19 originate from the
  1929. * SHMEM_EEE_XXX_ADV definitions (where XXX is replaced by speed).
  1930. * bit 28 when 1'b1 EEE was requested.
  1931. * bit 29 when 1'b1 tx lpi was requested.
  1932. * bit 30 when 1'b1 EEE was negotiated. Tx lpi will be asserted iff
  1933. * 30:29 are 2'b11.
  1934. * bit 31 when 1'b0 bits 15:0 contain a PORT_FEAT_CFG_EEE_ define as
  1935. * value. When 1'b1 those bits contains a value times 16 microseconds.
  1936. */
  1937. u32 eee_status[PORT_MAX];
  1938. #define SHMEM_EEE_TIMER_MASK 0x0000ffff
  1939. #define SHMEM_EEE_SUPPORTED_MASK 0x000f0000
  1940. #define SHMEM_EEE_SUPPORTED_SHIFT 16
  1941. #define SHMEM_EEE_ADV_STATUS_MASK 0x00f00000
  1942. #define SHMEM_EEE_100M_ADV (1<<0)
  1943. #define SHMEM_EEE_1G_ADV (1<<1)
  1944. #define SHMEM_EEE_10G_ADV (1<<2)
  1945. #define SHMEM_EEE_ADV_STATUS_SHIFT 20
  1946. #define SHMEM_EEE_LP_ADV_STATUS_MASK 0x0f000000
  1947. #define SHMEM_EEE_LP_ADV_STATUS_SHIFT 24
  1948. #define SHMEM_EEE_REQUESTED_BIT 0x10000000
  1949. #define SHMEM_EEE_LPI_REQUESTED_BIT 0x20000000
  1950. #define SHMEM_EEE_ACTIVE_BIT 0x40000000
  1951. #define SHMEM_EEE_TIME_OUTPUT_BIT 0x80000000
  1952. u32 sizeof_port_stats;
  1953. /* Link Flap Avoidance */
  1954. u32 lfa_host_addr[PORT_MAX];
  1955. u32 reserved1;
  1956. u32 reserved2; /* Offset 0x148 */
  1957. u32 reserved3; /* Offset 0x14C */
  1958. u32 reserved4; /* Offset 0x150 */
  1959. u32 link_attr_sync[PORT_MAX]; /* Offset 0x154 */
  1960. #define LINK_ATTR_SYNC_KR2_ENABLE 0x00000001
  1961. #define LINK_ATTR_84858 0x00000002
  1962. #define LINK_SFP_EEPROM_COMP_CODE_MASK 0x0000ff00
  1963. #define LINK_SFP_EEPROM_COMP_CODE_SHIFT 8
  1964. #define LINK_SFP_EEPROM_COMP_CODE_SR 0x00001000
  1965. #define LINK_SFP_EEPROM_COMP_CODE_LR 0x00002000
  1966. #define LINK_SFP_EEPROM_COMP_CODE_LRM 0x00004000
  1967. u32 reserved5[2];
  1968. u32 link_change_count[PORT_MAX]; /* Offset 0x160-0x164 */
  1969. #define LINK_CHANGE_COUNT_MASK 0xff /* Offset 0x168 */
  1970. /* driver version for each personality */
  1971. struct os_drv_ver func_os_drv_ver[E2_FUNC_MAX]; /* Offset 0x16c */
  1972. /* Flag to the driver that PF's drv_info_host_addr buffer was read */
  1973. u32 mfw_drv_indication;
  1974. /* We use indication for each PF (0..3) */
  1975. #define MFW_DRV_IND_READ_DONE_OFFSET(_pf_) (1 << (_pf_))
  1976. union { /* For various OEMs */ /* Offset 0x1a0 */
  1977. u8 storage_boot_prog[E2_FUNC_MAX];
  1978. #define STORAGE_BOOT_PROG_MASK 0x000000FF
  1979. #define STORAGE_BOOT_PROG_NONE 0x00000000
  1980. #define STORAGE_BOOT_PROG_ISCSI_IP_ACQUIRED 0x00000002
  1981. #define STORAGE_BOOT_PROG_FCOE_FABRIC_LOGIN_SUCCESS 0x00000002
  1982. #define STORAGE_BOOT_PROG_TARGET_FOUND 0x00000004
  1983. #define STORAGE_BOOT_PROG_ISCSI_CHAP_SUCCESS 0x00000008
  1984. #define STORAGE_BOOT_PROG_FCOE_LUN_FOUND 0x00000008
  1985. #define STORAGE_BOOT_PROG_LOGGED_INTO_TGT 0x00000010
  1986. #define STORAGE_BOOT_PROG_IMG_DOWNLOADED 0x00000020
  1987. #define STORAGE_BOOT_PROG_OS_HANDOFF 0x00000040
  1988. #define STORAGE_BOOT_PROG_COMPLETED 0x00000080
  1989. u32 oem_i2c_data_addr;
  1990. };
  1991. /* 9 entires for the C2S PCP map for each inner VLAN PCP + 1 default */
  1992. /* For PCP values 0-3 use the map lower */
  1993. /* 0xFF000000 - PCP 0, 0x00FF0000 - PCP 1,
  1994. * 0x0000FF00 - PCP 2, 0x000000FF PCP 3
  1995. */
  1996. u32 c2s_pcp_map_lower[E2_FUNC_MAX]; /* 0x1a4 */
  1997. /* For PCP values 4-7 use the map upper */
  1998. /* 0xFF000000 - PCP 4, 0x00FF0000 - PCP 5,
  1999. * 0x0000FF00 - PCP 6, 0x000000FF PCP 7
  2000. */
  2001. u32 c2s_pcp_map_upper[E2_FUNC_MAX]; /* 0x1b4 */
  2002. /* For PCP default value get the MSB byte of the map default */
  2003. u32 c2s_pcp_map_default[E2_FUNC_MAX]; /* 0x1c4 */
  2004. /* FC_NPIV table offset in NVRAM */
  2005. u32 fc_npiv_nvram_tbl_addr[PORT_MAX]; /* 0x1d4 */
  2006. /* Shows last method that changed configuration of this device */
  2007. enum curr_cfg_method_e curr_cfg; /* 0x1dc */
  2008. /* Storm FW version, shold be kept in the format 0xMMmmbbdd:
  2009. * MM - Major, mm - Minor, bb - Build ,dd - Drop
  2010. */
  2011. u32 netproc_fw_ver; /* 0x1e0 */
  2012. /* Option ROM SMASH CLP version */
  2013. u32 clp_ver; /* 0x1e4 */
  2014. u32 pcie_bus_num; /* 0x1e8 */
  2015. u32 sriov_switch_mode; /* 0x1ec */
  2016. #define SRIOV_SWITCH_MODE_NONE 0x0
  2017. #define SRIOV_SWITCH_MODE_VEB 0x1
  2018. #define SRIOV_SWITCH_MODE_VEPA 0x2
  2019. u8 rsrv2[E2_FUNC_MAX]; /* 0x1f0 */
  2020. u32 img_inv_table_addr; /* Address to INV_TABLE_P */ /* 0x1f4 */
  2021. u32 mtu_size[E2_FUNC_MAX]; /* 0x1f8 */
  2022. u32 os_driver_state[E2_FUNC_MAX]; /* 0x208 */
  2023. #define OS_DRIVER_STATE_NOT_LOADED 0 /* not installed */
  2024. #define OS_DRIVER_STATE_LOADING 1 /* transition state */
  2025. #define OS_DRIVER_STATE_DISABLED 2 /* installed but disabled */
  2026. #define OS_DRIVER_STATE_ACTIVE 3 /* installed and active */
  2027. /* mini dump driver info */
  2028. struct mdump_driver_info drv_info; /* 0x218 */
  2029. };
  2030. struct emac_stats {
  2031. u32 rx_stat_ifhcinoctets;
  2032. u32 rx_stat_ifhcinbadoctets;
  2033. u32 rx_stat_etherstatsfragments;
  2034. u32 rx_stat_ifhcinucastpkts;
  2035. u32 rx_stat_ifhcinmulticastpkts;
  2036. u32 rx_stat_ifhcinbroadcastpkts;
  2037. u32 rx_stat_dot3statsfcserrors;
  2038. u32 rx_stat_dot3statsalignmenterrors;
  2039. u32 rx_stat_dot3statscarriersenseerrors;
  2040. u32 rx_stat_xonpauseframesreceived;
  2041. u32 rx_stat_xoffpauseframesreceived;
  2042. u32 rx_stat_maccontrolframesreceived;
  2043. u32 rx_stat_xoffstateentered;
  2044. u32 rx_stat_dot3statsframestoolong;
  2045. u32 rx_stat_etherstatsjabbers;
  2046. u32 rx_stat_etherstatsundersizepkts;
  2047. u32 rx_stat_etherstatspkts64octets;
  2048. u32 rx_stat_etherstatspkts65octetsto127octets;
  2049. u32 rx_stat_etherstatspkts128octetsto255octets;
  2050. u32 rx_stat_etherstatspkts256octetsto511octets;
  2051. u32 rx_stat_etherstatspkts512octetsto1023octets;
  2052. u32 rx_stat_etherstatspkts1024octetsto1522octets;
  2053. u32 rx_stat_etherstatspktsover1522octets;
  2054. u32 rx_stat_falsecarriererrors;
  2055. u32 tx_stat_ifhcoutoctets;
  2056. u32 tx_stat_ifhcoutbadoctets;
  2057. u32 tx_stat_etherstatscollisions;
  2058. u32 tx_stat_outxonsent;
  2059. u32 tx_stat_outxoffsent;
  2060. u32 tx_stat_flowcontroldone;
  2061. u32 tx_stat_dot3statssinglecollisionframes;
  2062. u32 tx_stat_dot3statsmultiplecollisionframes;
  2063. u32 tx_stat_dot3statsdeferredtransmissions;
  2064. u32 tx_stat_dot3statsexcessivecollisions;
  2065. u32 tx_stat_dot3statslatecollisions;
  2066. u32 tx_stat_ifhcoutucastpkts;
  2067. u32 tx_stat_ifhcoutmulticastpkts;
  2068. u32 tx_stat_ifhcoutbroadcastpkts;
  2069. u32 tx_stat_etherstatspkts64octets;
  2070. u32 tx_stat_etherstatspkts65octetsto127octets;
  2071. u32 tx_stat_etherstatspkts128octetsto255octets;
  2072. u32 tx_stat_etherstatspkts256octetsto511octets;
  2073. u32 tx_stat_etherstatspkts512octetsto1023octets;
  2074. u32 tx_stat_etherstatspkts1024octetsto1522octets;
  2075. u32 tx_stat_etherstatspktsover1522octets;
  2076. u32 tx_stat_dot3statsinternalmactransmiterrors;
  2077. };
  2078. struct bmac1_stats {
  2079. u32 tx_stat_gtpkt_lo;
  2080. u32 tx_stat_gtpkt_hi;
  2081. u32 tx_stat_gtxpf_lo;
  2082. u32 tx_stat_gtxpf_hi;
  2083. u32 tx_stat_gtfcs_lo;
  2084. u32 tx_stat_gtfcs_hi;
  2085. u32 tx_stat_gtmca_lo;
  2086. u32 tx_stat_gtmca_hi;
  2087. u32 tx_stat_gtbca_lo;
  2088. u32 tx_stat_gtbca_hi;
  2089. u32 tx_stat_gtfrg_lo;
  2090. u32 tx_stat_gtfrg_hi;
  2091. u32 tx_stat_gtovr_lo;
  2092. u32 tx_stat_gtovr_hi;
  2093. u32 tx_stat_gt64_lo;
  2094. u32 tx_stat_gt64_hi;
  2095. u32 tx_stat_gt127_lo;
  2096. u32 tx_stat_gt127_hi;
  2097. u32 tx_stat_gt255_lo;
  2098. u32 tx_stat_gt255_hi;
  2099. u32 tx_stat_gt511_lo;
  2100. u32 tx_stat_gt511_hi;
  2101. u32 tx_stat_gt1023_lo;
  2102. u32 tx_stat_gt1023_hi;
  2103. u32 tx_stat_gt1518_lo;
  2104. u32 tx_stat_gt1518_hi;
  2105. u32 tx_stat_gt2047_lo;
  2106. u32 tx_stat_gt2047_hi;
  2107. u32 tx_stat_gt4095_lo;
  2108. u32 tx_stat_gt4095_hi;
  2109. u32 tx_stat_gt9216_lo;
  2110. u32 tx_stat_gt9216_hi;
  2111. u32 tx_stat_gt16383_lo;
  2112. u32 tx_stat_gt16383_hi;
  2113. u32 tx_stat_gtmax_lo;
  2114. u32 tx_stat_gtmax_hi;
  2115. u32 tx_stat_gtufl_lo;
  2116. u32 tx_stat_gtufl_hi;
  2117. u32 tx_stat_gterr_lo;
  2118. u32 tx_stat_gterr_hi;
  2119. u32 tx_stat_gtbyt_lo;
  2120. u32 tx_stat_gtbyt_hi;
  2121. u32 rx_stat_gr64_lo;
  2122. u32 rx_stat_gr64_hi;
  2123. u32 rx_stat_gr127_lo;
  2124. u32 rx_stat_gr127_hi;
  2125. u32 rx_stat_gr255_lo;
  2126. u32 rx_stat_gr255_hi;
  2127. u32 rx_stat_gr511_lo;
  2128. u32 rx_stat_gr511_hi;
  2129. u32 rx_stat_gr1023_lo;
  2130. u32 rx_stat_gr1023_hi;
  2131. u32 rx_stat_gr1518_lo;
  2132. u32 rx_stat_gr1518_hi;
  2133. u32 rx_stat_gr2047_lo;
  2134. u32 rx_stat_gr2047_hi;
  2135. u32 rx_stat_gr4095_lo;
  2136. u32 rx_stat_gr4095_hi;
  2137. u32 rx_stat_gr9216_lo;
  2138. u32 rx_stat_gr9216_hi;
  2139. u32 rx_stat_gr16383_lo;
  2140. u32 rx_stat_gr16383_hi;
  2141. u32 rx_stat_grmax_lo;
  2142. u32 rx_stat_grmax_hi;
  2143. u32 rx_stat_grpkt_lo;
  2144. u32 rx_stat_grpkt_hi;
  2145. u32 rx_stat_grfcs_lo;
  2146. u32 rx_stat_grfcs_hi;
  2147. u32 rx_stat_grmca_lo;
  2148. u32 rx_stat_grmca_hi;
  2149. u32 rx_stat_grbca_lo;
  2150. u32 rx_stat_grbca_hi;
  2151. u32 rx_stat_grxcf_lo;
  2152. u32 rx_stat_grxcf_hi;
  2153. u32 rx_stat_grxpf_lo;
  2154. u32 rx_stat_grxpf_hi;
  2155. u32 rx_stat_grxuo_lo;
  2156. u32 rx_stat_grxuo_hi;
  2157. u32 rx_stat_grjbr_lo;
  2158. u32 rx_stat_grjbr_hi;
  2159. u32 rx_stat_grovr_lo;
  2160. u32 rx_stat_grovr_hi;
  2161. u32 rx_stat_grflr_lo;
  2162. u32 rx_stat_grflr_hi;
  2163. u32 rx_stat_grmeg_lo;
  2164. u32 rx_stat_grmeg_hi;
  2165. u32 rx_stat_grmeb_lo;
  2166. u32 rx_stat_grmeb_hi;
  2167. u32 rx_stat_grbyt_lo;
  2168. u32 rx_stat_grbyt_hi;
  2169. u32 rx_stat_grund_lo;
  2170. u32 rx_stat_grund_hi;
  2171. u32 rx_stat_grfrg_lo;
  2172. u32 rx_stat_grfrg_hi;
  2173. u32 rx_stat_grerb_lo;
  2174. u32 rx_stat_grerb_hi;
  2175. u32 rx_stat_grfre_lo;
  2176. u32 rx_stat_grfre_hi;
  2177. u32 rx_stat_gripj_lo;
  2178. u32 rx_stat_gripj_hi;
  2179. };
  2180. struct bmac2_stats {
  2181. u32 tx_stat_gtpk_lo; /* gtpok */
  2182. u32 tx_stat_gtpk_hi; /* gtpok */
  2183. u32 tx_stat_gtxpf_lo; /* gtpf */
  2184. u32 tx_stat_gtxpf_hi; /* gtpf */
  2185. u32 tx_stat_gtpp_lo; /* NEW BMAC2 */
  2186. u32 tx_stat_gtpp_hi; /* NEW BMAC2 */
  2187. u32 tx_stat_gtfcs_lo;
  2188. u32 tx_stat_gtfcs_hi;
  2189. u32 tx_stat_gtuca_lo; /* NEW BMAC2 */
  2190. u32 tx_stat_gtuca_hi; /* NEW BMAC2 */
  2191. u32 tx_stat_gtmca_lo;
  2192. u32 tx_stat_gtmca_hi;
  2193. u32 tx_stat_gtbca_lo;
  2194. u32 tx_stat_gtbca_hi;
  2195. u32 tx_stat_gtovr_lo;
  2196. u32 tx_stat_gtovr_hi;
  2197. u32 tx_stat_gtfrg_lo;
  2198. u32 tx_stat_gtfrg_hi;
  2199. u32 tx_stat_gtpkt1_lo; /* gtpkt */
  2200. u32 tx_stat_gtpkt1_hi; /* gtpkt */
  2201. u32 tx_stat_gt64_lo;
  2202. u32 tx_stat_gt64_hi;
  2203. u32 tx_stat_gt127_lo;
  2204. u32 tx_stat_gt127_hi;
  2205. u32 tx_stat_gt255_lo;
  2206. u32 tx_stat_gt255_hi;
  2207. u32 tx_stat_gt511_lo;
  2208. u32 tx_stat_gt511_hi;
  2209. u32 tx_stat_gt1023_lo;
  2210. u32 tx_stat_gt1023_hi;
  2211. u32 tx_stat_gt1518_lo;
  2212. u32 tx_stat_gt1518_hi;
  2213. u32 tx_stat_gt2047_lo;
  2214. u32 tx_stat_gt2047_hi;
  2215. u32 tx_stat_gt4095_lo;
  2216. u32 tx_stat_gt4095_hi;
  2217. u32 tx_stat_gt9216_lo;
  2218. u32 tx_stat_gt9216_hi;
  2219. u32 tx_stat_gt16383_lo;
  2220. u32 tx_stat_gt16383_hi;
  2221. u32 tx_stat_gtmax_lo;
  2222. u32 tx_stat_gtmax_hi;
  2223. u32 tx_stat_gtufl_lo;
  2224. u32 tx_stat_gtufl_hi;
  2225. u32 tx_stat_gterr_lo;
  2226. u32 tx_stat_gterr_hi;
  2227. u32 tx_stat_gtbyt_lo;
  2228. u32 tx_stat_gtbyt_hi;
  2229. u32 rx_stat_gr64_lo;
  2230. u32 rx_stat_gr64_hi;
  2231. u32 rx_stat_gr127_lo;
  2232. u32 rx_stat_gr127_hi;
  2233. u32 rx_stat_gr255_lo;
  2234. u32 rx_stat_gr255_hi;
  2235. u32 rx_stat_gr511_lo;
  2236. u32 rx_stat_gr511_hi;
  2237. u32 rx_stat_gr1023_lo;
  2238. u32 rx_stat_gr1023_hi;
  2239. u32 rx_stat_gr1518_lo;
  2240. u32 rx_stat_gr1518_hi;
  2241. u32 rx_stat_gr2047_lo;
  2242. u32 rx_stat_gr2047_hi;
  2243. u32 rx_stat_gr4095_lo;
  2244. u32 rx_stat_gr4095_hi;
  2245. u32 rx_stat_gr9216_lo;
  2246. u32 rx_stat_gr9216_hi;
  2247. u32 rx_stat_gr16383_lo;
  2248. u32 rx_stat_gr16383_hi;
  2249. u32 rx_stat_grmax_lo;
  2250. u32 rx_stat_grmax_hi;
  2251. u32 rx_stat_grpkt_lo;
  2252. u32 rx_stat_grpkt_hi;
  2253. u32 rx_stat_grfcs_lo;
  2254. u32 rx_stat_grfcs_hi;
  2255. u32 rx_stat_gruca_lo;
  2256. u32 rx_stat_gruca_hi;
  2257. u32 rx_stat_grmca_lo;
  2258. u32 rx_stat_grmca_hi;
  2259. u32 rx_stat_grbca_lo;
  2260. u32 rx_stat_grbca_hi;
  2261. u32 rx_stat_grxpf_lo; /* grpf */
  2262. u32 rx_stat_grxpf_hi; /* grpf */
  2263. u32 rx_stat_grpp_lo;
  2264. u32 rx_stat_grpp_hi;
  2265. u32 rx_stat_grxuo_lo; /* gruo */
  2266. u32 rx_stat_grxuo_hi; /* gruo */
  2267. u32 rx_stat_grjbr_lo;
  2268. u32 rx_stat_grjbr_hi;
  2269. u32 rx_stat_grovr_lo;
  2270. u32 rx_stat_grovr_hi;
  2271. u32 rx_stat_grxcf_lo; /* grcf */
  2272. u32 rx_stat_grxcf_hi; /* grcf */
  2273. u32 rx_stat_grflr_lo;
  2274. u32 rx_stat_grflr_hi;
  2275. u32 rx_stat_grpok_lo;
  2276. u32 rx_stat_grpok_hi;
  2277. u32 rx_stat_grmeg_lo;
  2278. u32 rx_stat_grmeg_hi;
  2279. u32 rx_stat_grmeb_lo;
  2280. u32 rx_stat_grmeb_hi;
  2281. u32 rx_stat_grbyt_lo;
  2282. u32 rx_stat_grbyt_hi;
  2283. u32 rx_stat_grund_lo;
  2284. u32 rx_stat_grund_hi;
  2285. u32 rx_stat_grfrg_lo;
  2286. u32 rx_stat_grfrg_hi;
  2287. u32 rx_stat_grerb_lo; /* grerrbyt */
  2288. u32 rx_stat_grerb_hi; /* grerrbyt */
  2289. u32 rx_stat_grfre_lo; /* grfrerr */
  2290. u32 rx_stat_grfre_hi; /* grfrerr */
  2291. u32 rx_stat_gripj_lo;
  2292. u32 rx_stat_gripj_hi;
  2293. };
  2294. struct mstat_stats {
  2295. struct {
  2296. /* OTE MSTAT on E3 has a bug where this register's contents are
  2297. * actually tx_gtxpok + tx_gtxpf + (possibly)tx_gtxpp
  2298. */
  2299. u32 tx_gtxpok_lo;
  2300. u32 tx_gtxpok_hi;
  2301. u32 tx_gtxpf_lo;
  2302. u32 tx_gtxpf_hi;
  2303. u32 tx_gtxpp_lo;
  2304. u32 tx_gtxpp_hi;
  2305. u32 tx_gtfcs_lo;
  2306. u32 tx_gtfcs_hi;
  2307. u32 tx_gtuca_lo;
  2308. u32 tx_gtuca_hi;
  2309. u32 tx_gtmca_lo;
  2310. u32 tx_gtmca_hi;
  2311. u32 tx_gtgca_lo;
  2312. u32 tx_gtgca_hi;
  2313. u32 tx_gtpkt_lo;
  2314. u32 tx_gtpkt_hi;
  2315. u32 tx_gt64_lo;
  2316. u32 tx_gt64_hi;
  2317. u32 tx_gt127_lo;
  2318. u32 tx_gt127_hi;
  2319. u32 tx_gt255_lo;
  2320. u32 tx_gt255_hi;
  2321. u32 tx_gt511_lo;
  2322. u32 tx_gt511_hi;
  2323. u32 tx_gt1023_lo;
  2324. u32 tx_gt1023_hi;
  2325. u32 tx_gt1518_lo;
  2326. u32 tx_gt1518_hi;
  2327. u32 tx_gt2047_lo;
  2328. u32 tx_gt2047_hi;
  2329. u32 tx_gt4095_lo;
  2330. u32 tx_gt4095_hi;
  2331. u32 tx_gt9216_lo;
  2332. u32 tx_gt9216_hi;
  2333. u32 tx_gt16383_lo;
  2334. u32 tx_gt16383_hi;
  2335. u32 tx_gtufl_lo;
  2336. u32 tx_gtufl_hi;
  2337. u32 tx_gterr_lo;
  2338. u32 tx_gterr_hi;
  2339. u32 tx_gtbyt_lo;
  2340. u32 tx_gtbyt_hi;
  2341. u32 tx_collisions_lo;
  2342. u32 tx_collisions_hi;
  2343. u32 tx_singlecollision_lo;
  2344. u32 tx_singlecollision_hi;
  2345. u32 tx_multiplecollisions_lo;
  2346. u32 tx_multiplecollisions_hi;
  2347. u32 tx_deferred_lo;
  2348. u32 tx_deferred_hi;
  2349. u32 tx_excessivecollisions_lo;
  2350. u32 tx_excessivecollisions_hi;
  2351. u32 tx_latecollisions_lo;
  2352. u32 tx_latecollisions_hi;
  2353. } stats_tx;
  2354. struct {
  2355. u32 rx_gr64_lo;
  2356. u32 rx_gr64_hi;
  2357. u32 rx_gr127_lo;
  2358. u32 rx_gr127_hi;
  2359. u32 rx_gr255_lo;
  2360. u32 rx_gr255_hi;
  2361. u32 rx_gr511_lo;
  2362. u32 rx_gr511_hi;
  2363. u32 rx_gr1023_lo;
  2364. u32 rx_gr1023_hi;
  2365. u32 rx_gr1518_lo;
  2366. u32 rx_gr1518_hi;
  2367. u32 rx_gr2047_lo;
  2368. u32 rx_gr2047_hi;
  2369. u32 rx_gr4095_lo;
  2370. u32 rx_gr4095_hi;
  2371. u32 rx_gr9216_lo;
  2372. u32 rx_gr9216_hi;
  2373. u32 rx_gr16383_lo;
  2374. u32 rx_gr16383_hi;
  2375. u32 rx_grpkt_lo;
  2376. u32 rx_grpkt_hi;
  2377. u32 rx_grfcs_lo;
  2378. u32 rx_grfcs_hi;
  2379. u32 rx_gruca_lo;
  2380. u32 rx_gruca_hi;
  2381. u32 rx_grmca_lo;
  2382. u32 rx_grmca_hi;
  2383. u32 rx_grbca_lo;
  2384. u32 rx_grbca_hi;
  2385. u32 rx_grxpf_lo;
  2386. u32 rx_grxpf_hi;
  2387. u32 rx_grxpp_lo;
  2388. u32 rx_grxpp_hi;
  2389. u32 rx_grxuo_lo;
  2390. u32 rx_grxuo_hi;
  2391. u32 rx_grovr_lo;
  2392. u32 rx_grovr_hi;
  2393. u32 rx_grxcf_lo;
  2394. u32 rx_grxcf_hi;
  2395. u32 rx_grflr_lo;
  2396. u32 rx_grflr_hi;
  2397. u32 rx_grpok_lo;
  2398. u32 rx_grpok_hi;
  2399. u32 rx_grbyt_lo;
  2400. u32 rx_grbyt_hi;
  2401. u32 rx_grund_lo;
  2402. u32 rx_grund_hi;
  2403. u32 rx_grfrg_lo;
  2404. u32 rx_grfrg_hi;
  2405. u32 rx_grerb_lo;
  2406. u32 rx_grerb_hi;
  2407. u32 rx_grfre_lo;
  2408. u32 rx_grfre_hi;
  2409. u32 rx_alignmenterrors_lo;
  2410. u32 rx_alignmenterrors_hi;
  2411. u32 rx_falsecarrier_lo;
  2412. u32 rx_falsecarrier_hi;
  2413. u32 rx_llfcmsgcnt_lo;
  2414. u32 rx_llfcmsgcnt_hi;
  2415. } stats_rx;
  2416. };
  2417. union mac_stats {
  2418. struct emac_stats emac_stats;
  2419. struct bmac1_stats bmac1_stats;
  2420. struct bmac2_stats bmac2_stats;
  2421. struct mstat_stats mstat_stats;
  2422. };
  2423. struct mac_stx {
  2424. /* in_bad_octets */
  2425. u32 rx_stat_ifhcinbadoctets_hi;
  2426. u32 rx_stat_ifhcinbadoctets_lo;
  2427. /* out_bad_octets */
  2428. u32 tx_stat_ifhcoutbadoctets_hi;
  2429. u32 tx_stat_ifhcoutbadoctets_lo;
  2430. /* crc_receive_errors */
  2431. u32 rx_stat_dot3statsfcserrors_hi;
  2432. u32 rx_stat_dot3statsfcserrors_lo;
  2433. /* alignment_errors */
  2434. u32 rx_stat_dot3statsalignmenterrors_hi;
  2435. u32 rx_stat_dot3statsalignmenterrors_lo;
  2436. /* carrier_sense_errors */
  2437. u32 rx_stat_dot3statscarriersenseerrors_hi;
  2438. u32 rx_stat_dot3statscarriersenseerrors_lo;
  2439. /* false_carrier_detections */
  2440. u32 rx_stat_falsecarriererrors_hi;
  2441. u32 rx_stat_falsecarriererrors_lo;
  2442. /* runt_packets_received */
  2443. u32 rx_stat_etherstatsundersizepkts_hi;
  2444. u32 rx_stat_etherstatsundersizepkts_lo;
  2445. /* jabber_packets_received */
  2446. u32 rx_stat_dot3statsframestoolong_hi;
  2447. u32 rx_stat_dot3statsframestoolong_lo;
  2448. /* error_runt_packets_received */
  2449. u32 rx_stat_etherstatsfragments_hi;
  2450. u32 rx_stat_etherstatsfragments_lo;
  2451. /* error_jabber_packets_received */
  2452. u32 rx_stat_etherstatsjabbers_hi;
  2453. u32 rx_stat_etherstatsjabbers_lo;
  2454. /* control_frames_received */
  2455. u32 rx_stat_maccontrolframesreceived_hi;
  2456. u32 rx_stat_maccontrolframesreceived_lo;
  2457. u32 rx_stat_mac_xpf_hi;
  2458. u32 rx_stat_mac_xpf_lo;
  2459. u32 rx_stat_mac_xcf_hi;
  2460. u32 rx_stat_mac_xcf_lo;
  2461. /* xoff_state_entered */
  2462. u32 rx_stat_xoffstateentered_hi;
  2463. u32 rx_stat_xoffstateentered_lo;
  2464. /* pause_xon_frames_received */
  2465. u32 rx_stat_xonpauseframesreceived_hi;
  2466. u32 rx_stat_xonpauseframesreceived_lo;
  2467. /* pause_xoff_frames_received */
  2468. u32 rx_stat_xoffpauseframesreceived_hi;
  2469. u32 rx_stat_xoffpauseframesreceived_lo;
  2470. /* pause_xon_frames_transmitted */
  2471. u32 tx_stat_outxonsent_hi;
  2472. u32 tx_stat_outxonsent_lo;
  2473. /* pause_xoff_frames_transmitted */
  2474. u32 tx_stat_outxoffsent_hi;
  2475. u32 tx_stat_outxoffsent_lo;
  2476. /* flow_control_done */
  2477. u32 tx_stat_flowcontroldone_hi;
  2478. u32 tx_stat_flowcontroldone_lo;
  2479. /* ether_stats_collisions */
  2480. u32 tx_stat_etherstatscollisions_hi;
  2481. u32 tx_stat_etherstatscollisions_lo;
  2482. /* single_collision_transmit_frames */
  2483. u32 tx_stat_dot3statssinglecollisionframes_hi;
  2484. u32 tx_stat_dot3statssinglecollisionframes_lo;
  2485. /* multiple_collision_transmit_frames */
  2486. u32 tx_stat_dot3statsmultiplecollisionframes_hi;
  2487. u32 tx_stat_dot3statsmultiplecollisionframes_lo;
  2488. /* deferred_transmissions */
  2489. u32 tx_stat_dot3statsdeferredtransmissions_hi;
  2490. u32 tx_stat_dot3statsdeferredtransmissions_lo;
  2491. /* excessive_collision_frames */
  2492. u32 tx_stat_dot3statsexcessivecollisions_hi;
  2493. u32 tx_stat_dot3statsexcessivecollisions_lo;
  2494. /* late_collision_frames */
  2495. u32 tx_stat_dot3statslatecollisions_hi;
  2496. u32 tx_stat_dot3statslatecollisions_lo;
  2497. /* frames_transmitted_64_bytes */
  2498. u32 tx_stat_etherstatspkts64octets_hi;
  2499. u32 tx_stat_etherstatspkts64octets_lo;
  2500. /* frames_transmitted_65_127_bytes */
  2501. u32 tx_stat_etherstatspkts65octetsto127octets_hi;
  2502. u32 tx_stat_etherstatspkts65octetsto127octets_lo;
  2503. /* frames_transmitted_128_255_bytes */
  2504. u32 tx_stat_etherstatspkts128octetsto255octets_hi;
  2505. u32 tx_stat_etherstatspkts128octetsto255octets_lo;
  2506. /* frames_transmitted_256_511_bytes */
  2507. u32 tx_stat_etherstatspkts256octetsto511octets_hi;
  2508. u32 tx_stat_etherstatspkts256octetsto511octets_lo;
  2509. /* frames_transmitted_512_1023_bytes */
  2510. u32 tx_stat_etherstatspkts512octetsto1023octets_hi;
  2511. u32 tx_stat_etherstatspkts512octetsto1023octets_lo;
  2512. /* frames_transmitted_1024_1522_bytes */
  2513. u32 tx_stat_etherstatspkts1024octetsto1522octets_hi;
  2514. u32 tx_stat_etherstatspkts1024octetsto1522octets_lo;
  2515. /* frames_transmitted_1523_9022_bytes */
  2516. u32 tx_stat_etherstatspktsover1522octets_hi;
  2517. u32 tx_stat_etherstatspktsover1522octets_lo;
  2518. u32 tx_stat_mac_2047_hi;
  2519. u32 tx_stat_mac_2047_lo;
  2520. u32 tx_stat_mac_4095_hi;
  2521. u32 tx_stat_mac_4095_lo;
  2522. u32 tx_stat_mac_9216_hi;
  2523. u32 tx_stat_mac_9216_lo;
  2524. u32 tx_stat_mac_16383_hi;
  2525. u32 tx_stat_mac_16383_lo;
  2526. /* internal_mac_transmit_errors */
  2527. u32 tx_stat_dot3statsinternalmactransmiterrors_hi;
  2528. u32 tx_stat_dot3statsinternalmactransmiterrors_lo;
  2529. /* if_out_discards */
  2530. u32 tx_stat_mac_ufl_hi;
  2531. u32 tx_stat_mac_ufl_lo;
  2532. };
  2533. #define MAC_STX_IDX_MAX 2
  2534. struct host_port_stats {
  2535. u32 host_port_stats_counter;
  2536. struct mac_stx mac_stx[MAC_STX_IDX_MAX];
  2537. u32 brb_drop_hi;
  2538. u32 brb_drop_lo;
  2539. u32 not_used; /* obsolete */
  2540. u32 pfc_frames_tx_hi;
  2541. u32 pfc_frames_tx_lo;
  2542. u32 pfc_frames_rx_hi;
  2543. u32 pfc_frames_rx_lo;
  2544. u32 eee_lpi_count_hi;
  2545. u32 eee_lpi_count_lo;
  2546. };
  2547. struct host_func_stats {
  2548. u32 host_func_stats_start;
  2549. u32 total_bytes_received_hi;
  2550. u32 total_bytes_received_lo;
  2551. u32 total_bytes_transmitted_hi;
  2552. u32 total_bytes_transmitted_lo;
  2553. u32 total_unicast_packets_received_hi;
  2554. u32 total_unicast_packets_received_lo;
  2555. u32 total_multicast_packets_received_hi;
  2556. u32 total_multicast_packets_received_lo;
  2557. u32 total_broadcast_packets_received_hi;
  2558. u32 total_broadcast_packets_received_lo;
  2559. u32 total_unicast_packets_transmitted_hi;
  2560. u32 total_unicast_packets_transmitted_lo;
  2561. u32 total_multicast_packets_transmitted_hi;
  2562. u32 total_multicast_packets_transmitted_lo;
  2563. u32 total_broadcast_packets_transmitted_hi;
  2564. u32 total_broadcast_packets_transmitted_lo;
  2565. u32 valid_bytes_received_hi;
  2566. u32 valid_bytes_received_lo;
  2567. u32 host_func_stats_end;
  2568. };
  2569. /* VIC definitions */
  2570. #define VICSTATST_UIF_INDEX 2
  2571. /* stats collected for afex.
  2572. * NOTE: structure is exactly as expected to be received by the switch.
  2573. * order must remain exactly as is unless protocol changes !
  2574. */
  2575. struct afex_stats {
  2576. u32 tx_unicast_frames_hi;
  2577. u32 tx_unicast_frames_lo;
  2578. u32 tx_unicast_bytes_hi;
  2579. u32 tx_unicast_bytes_lo;
  2580. u32 tx_multicast_frames_hi;
  2581. u32 tx_multicast_frames_lo;
  2582. u32 tx_multicast_bytes_hi;
  2583. u32 tx_multicast_bytes_lo;
  2584. u32 tx_broadcast_frames_hi;
  2585. u32 tx_broadcast_frames_lo;
  2586. u32 tx_broadcast_bytes_hi;
  2587. u32 tx_broadcast_bytes_lo;
  2588. u32 tx_frames_discarded_hi;
  2589. u32 tx_frames_discarded_lo;
  2590. u32 tx_frames_dropped_hi;
  2591. u32 tx_frames_dropped_lo;
  2592. u32 rx_unicast_frames_hi;
  2593. u32 rx_unicast_frames_lo;
  2594. u32 rx_unicast_bytes_hi;
  2595. u32 rx_unicast_bytes_lo;
  2596. u32 rx_multicast_frames_hi;
  2597. u32 rx_multicast_frames_lo;
  2598. u32 rx_multicast_bytes_hi;
  2599. u32 rx_multicast_bytes_lo;
  2600. u32 rx_broadcast_frames_hi;
  2601. u32 rx_broadcast_frames_lo;
  2602. u32 rx_broadcast_bytes_hi;
  2603. u32 rx_broadcast_bytes_lo;
  2604. u32 rx_frames_discarded_hi;
  2605. u32 rx_frames_discarded_lo;
  2606. u32 rx_frames_dropped_hi;
  2607. u32 rx_frames_dropped_lo;
  2608. };
  2609. /*(DEBLOBBED)*/
  2610. /*
  2611. * attention bits
  2612. */
  2613. struct atten_sp_status_block {
  2614. __le32 attn_bits;
  2615. __le32 attn_bits_ack;
  2616. u8 status_block_id;
  2617. u8 reserved0;
  2618. __le16 attn_bits_index;
  2619. __le32 reserved1;
  2620. };
  2621. /*
  2622. * The eth aggregative context of Cstorm
  2623. */
  2624. struct cstorm_eth_ag_context {
  2625. u32 __reserved0[10];
  2626. };
  2627. /*
  2628. * dmae command structure
  2629. */
  2630. struct dmae_command {
  2631. u32 opcode;
  2632. #define DMAE_COMMAND_SRC (0x1<<0)
  2633. #define DMAE_COMMAND_SRC_SHIFT 0
  2634. #define DMAE_COMMAND_DST (0x3<<1)
  2635. #define DMAE_COMMAND_DST_SHIFT 1
  2636. #define DMAE_COMMAND_C_DST (0x1<<3)
  2637. #define DMAE_COMMAND_C_DST_SHIFT 3
  2638. #define DMAE_COMMAND_C_TYPE_ENABLE (0x1<<4)
  2639. #define DMAE_COMMAND_C_TYPE_ENABLE_SHIFT 4
  2640. #define DMAE_COMMAND_C_TYPE_CRC_ENABLE (0x1<<5)
  2641. #define DMAE_COMMAND_C_TYPE_CRC_ENABLE_SHIFT 5
  2642. #define DMAE_COMMAND_C_TYPE_CRC_OFFSET (0x7<<6)
  2643. #define DMAE_COMMAND_C_TYPE_CRC_OFFSET_SHIFT 6
  2644. #define DMAE_COMMAND_ENDIANITY (0x3<<9)
  2645. #define DMAE_COMMAND_ENDIANITY_SHIFT 9
  2646. #define DMAE_COMMAND_PORT (0x1<<11)
  2647. #define DMAE_COMMAND_PORT_SHIFT 11
  2648. #define DMAE_COMMAND_CRC_RESET (0x1<<12)
  2649. #define DMAE_COMMAND_CRC_RESET_SHIFT 12
  2650. #define DMAE_COMMAND_SRC_RESET (0x1<<13)
  2651. #define DMAE_COMMAND_SRC_RESET_SHIFT 13
  2652. #define DMAE_COMMAND_DST_RESET (0x1<<14)
  2653. #define DMAE_COMMAND_DST_RESET_SHIFT 14
  2654. #define DMAE_COMMAND_E1HVN (0x3<<15)
  2655. #define DMAE_COMMAND_E1HVN_SHIFT 15
  2656. #define DMAE_COMMAND_DST_VN (0x3<<17)
  2657. #define DMAE_COMMAND_DST_VN_SHIFT 17
  2658. #define DMAE_COMMAND_C_FUNC (0x1<<19)
  2659. #define DMAE_COMMAND_C_FUNC_SHIFT 19
  2660. #define DMAE_COMMAND_ERR_POLICY (0x3<<20)
  2661. #define DMAE_COMMAND_ERR_POLICY_SHIFT 20
  2662. #define DMAE_COMMAND_RESERVED0 (0x3FF<<22)
  2663. #define DMAE_COMMAND_RESERVED0_SHIFT 22
  2664. u32 src_addr_lo;
  2665. u32 src_addr_hi;
  2666. u32 dst_addr_lo;
  2667. u32 dst_addr_hi;
  2668. #if defined(__BIG_ENDIAN)
  2669. u16 opcode_iov;
  2670. #define DMAE_COMMAND_SRC_VFID (0x3F<<0)
  2671. #define DMAE_COMMAND_SRC_VFID_SHIFT 0
  2672. #define DMAE_COMMAND_SRC_VFPF (0x1<<6)
  2673. #define DMAE_COMMAND_SRC_VFPF_SHIFT 6
  2674. #define DMAE_COMMAND_RESERVED1 (0x1<<7)
  2675. #define DMAE_COMMAND_RESERVED1_SHIFT 7
  2676. #define DMAE_COMMAND_DST_VFID (0x3F<<8)
  2677. #define DMAE_COMMAND_DST_VFID_SHIFT 8
  2678. #define DMAE_COMMAND_DST_VFPF (0x1<<14)
  2679. #define DMAE_COMMAND_DST_VFPF_SHIFT 14
  2680. #define DMAE_COMMAND_RESERVED2 (0x1<<15)
  2681. #define DMAE_COMMAND_RESERVED2_SHIFT 15
  2682. u16 len;
  2683. #elif defined(__LITTLE_ENDIAN)
  2684. u16 len;
  2685. u16 opcode_iov;
  2686. #define DMAE_COMMAND_SRC_VFID (0x3F<<0)
  2687. #define DMAE_COMMAND_SRC_VFID_SHIFT 0
  2688. #define DMAE_COMMAND_SRC_VFPF (0x1<<6)
  2689. #define DMAE_COMMAND_SRC_VFPF_SHIFT 6
  2690. #define DMAE_COMMAND_RESERVED1 (0x1<<7)
  2691. #define DMAE_COMMAND_RESERVED1_SHIFT 7
  2692. #define DMAE_COMMAND_DST_VFID (0x3F<<8)
  2693. #define DMAE_COMMAND_DST_VFID_SHIFT 8
  2694. #define DMAE_COMMAND_DST_VFPF (0x1<<14)
  2695. #define DMAE_COMMAND_DST_VFPF_SHIFT 14
  2696. #define DMAE_COMMAND_RESERVED2 (0x1<<15)
  2697. #define DMAE_COMMAND_RESERVED2_SHIFT 15
  2698. #endif
  2699. u32 comp_addr_lo;
  2700. u32 comp_addr_hi;
  2701. u32 comp_val;
  2702. u32 crc32;
  2703. u32 crc32_c;
  2704. #if defined(__BIG_ENDIAN)
  2705. u16 crc16_c;
  2706. u16 crc16;
  2707. #elif defined(__LITTLE_ENDIAN)
  2708. u16 crc16;
  2709. u16 crc16_c;
  2710. #endif
  2711. #if defined(__BIG_ENDIAN)
  2712. u16 reserved3;
  2713. u16 crc_t10;
  2714. #elif defined(__LITTLE_ENDIAN)
  2715. u16 crc_t10;
  2716. u16 reserved3;
  2717. #endif
  2718. #if defined(__BIG_ENDIAN)
  2719. u16 xsum8;
  2720. u16 xsum16;
  2721. #elif defined(__LITTLE_ENDIAN)
  2722. u16 xsum16;
  2723. u16 xsum8;
  2724. #endif
  2725. };
  2726. /*
  2727. * common data for all protocols
  2728. */
  2729. struct doorbell_hdr {
  2730. u8 header;
  2731. #define DOORBELL_HDR_RX (0x1<<0)
  2732. #define DOORBELL_HDR_RX_SHIFT 0
  2733. #define DOORBELL_HDR_DB_TYPE (0x1<<1)
  2734. #define DOORBELL_HDR_DB_TYPE_SHIFT 1
  2735. #define DOORBELL_HDR_DPM_SIZE (0x3<<2)
  2736. #define DOORBELL_HDR_DPM_SIZE_SHIFT 2
  2737. #define DOORBELL_HDR_CONN_TYPE (0xF<<4)
  2738. #define DOORBELL_HDR_CONN_TYPE_SHIFT 4
  2739. };
  2740. /*
  2741. * Ethernet doorbell
  2742. */
  2743. struct eth_tx_doorbell {
  2744. #if defined(__BIG_ENDIAN)
  2745. u16 npackets;
  2746. u8 params;
  2747. #define ETH_TX_DOORBELL_NUM_BDS (0x3F<<0)
  2748. #define ETH_TX_DOORBELL_NUM_BDS_SHIFT 0
  2749. #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG (0x1<<6)
  2750. #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG_SHIFT 6
  2751. #define ETH_TX_DOORBELL_SPARE (0x1<<7)
  2752. #define ETH_TX_DOORBELL_SPARE_SHIFT 7
  2753. struct doorbell_hdr hdr;
  2754. #elif defined(__LITTLE_ENDIAN)
  2755. struct doorbell_hdr hdr;
  2756. u8 params;
  2757. #define ETH_TX_DOORBELL_NUM_BDS (0x3F<<0)
  2758. #define ETH_TX_DOORBELL_NUM_BDS_SHIFT 0
  2759. #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG (0x1<<6)
  2760. #define ETH_TX_DOORBELL_RESERVED_TX_FIN_FLAG_SHIFT 6
  2761. #define ETH_TX_DOORBELL_SPARE (0x1<<7)
  2762. #define ETH_TX_DOORBELL_SPARE_SHIFT 7
  2763. u16 npackets;
  2764. #endif
  2765. };
  2766. /*
  2767. * 3 lines. status block
  2768. */
  2769. struct hc_status_block_e1x {
  2770. __le16 index_values[HC_SB_MAX_INDICES_E1X];
  2771. __le16 running_index[HC_SB_MAX_SM];
  2772. __le32 rsrv[11];
  2773. };
  2774. /*
  2775. * host status block
  2776. */
  2777. struct host_hc_status_block_e1x {
  2778. struct hc_status_block_e1x sb;
  2779. };
  2780. /*
  2781. * 3 lines. status block
  2782. */
  2783. struct hc_status_block_e2 {
  2784. __le16 index_values[HC_SB_MAX_INDICES_E2];
  2785. __le16 running_index[HC_SB_MAX_SM];
  2786. __le32 reserved[11];
  2787. };
  2788. /*
  2789. * host status block
  2790. */
  2791. struct host_hc_status_block_e2 {
  2792. struct hc_status_block_e2 sb;
  2793. };
  2794. /*
  2795. * 5 lines. slow-path status block
  2796. */
  2797. struct hc_sp_status_block {
  2798. __le16 index_values[HC_SP_SB_MAX_INDICES];
  2799. __le16 running_index;
  2800. __le16 rsrv;
  2801. u32 rsrv1;
  2802. };
  2803. /*
  2804. * host status block
  2805. */
  2806. struct host_sp_status_block {
  2807. struct atten_sp_status_block atten_status_block;
  2808. struct hc_sp_status_block sp_sb;
  2809. };
  2810. /*
  2811. * IGU driver acknowledgment register
  2812. */
  2813. struct igu_ack_register {
  2814. #if defined(__BIG_ENDIAN)
  2815. u16 sb_id_and_flags;
  2816. #define IGU_ACK_REGISTER_STATUS_BLOCK_ID (0x1F<<0)
  2817. #define IGU_ACK_REGISTER_STATUS_BLOCK_ID_SHIFT 0
  2818. #define IGU_ACK_REGISTER_STORM_ID (0x7<<5)
  2819. #define IGU_ACK_REGISTER_STORM_ID_SHIFT 5
  2820. #define IGU_ACK_REGISTER_UPDATE_INDEX (0x1<<8)
  2821. #define IGU_ACK_REGISTER_UPDATE_INDEX_SHIFT 8
  2822. #define IGU_ACK_REGISTER_INTERRUPT_MODE (0x3<<9)
  2823. #define IGU_ACK_REGISTER_INTERRUPT_MODE_SHIFT 9
  2824. #define IGU_ACK_REGISTER_RESERVED (0x1F<<11)
  2825. #define IGU_ACK_REGISTER_RESERVED_SHIFT 11
  2826. u16 status_block_index;
  2827. #elif defined(__LITTLE_ENDIAN)
  2828. u16 status_block_index;
  2829. u16 sb_id_and_flags;
  2830. #define IGU_ACK_REGISTER_STATUS_BLOCK_ID (0x1F<<0)
  2831. #define IGU_ACK_REGISTER_STATUS_BLOCK_ID_SHIFT 0
  2832. #define IGU_ACK_REGISTER_STORM_ID (0x7<<5)
  2833. #define IGU_ACK_REGISTER_STORM_ID_SHIFT 5
  2834. #define IGU_ACK_REGISTER_UPDATE_INDEX (0x1<<8)
  2835. #define IGU_ACK_REGISTER_UPDATE_INDEX_SHIFT 8
  2836. #define IGU_ACK_REGISTER_INTERRUPT_MODE (0x3<<9)
  2837. #define IGU_ACK_REGISTER_INTERRUPT_MODE_SHIFT 9
  2838. #define IGU_ACK_REGISTER_RESERVED (0x1F<<11)
  2839. #define IGU_ACK_REGISTER_RESERVED_SHIFT 11
  2840. #endif
  2841. };
  2842. /*
  2843. * IGU driver acknowledgement register
  2844. */
  2845. struct igu_backward_compatible {
  2846. u32 sb_id_and_flags;
  2847. #define IGU_BACKWARD_COMPATIBLE_SB_INDEX (0xFFFF<<0)
  2848. #define IGU_BACKWARD_COMPATIBLE_SB_INDEX_SHIFT 0
  2849. #define IGU_BACKWARD_COMPATIBLE_SB_SELECT (0x1F<<16)
  2850. #define IGU_BACKWARD_COMPATIBLE_SB_SELECT_SHIFT 16
  2851. #define IGU_BACKWARD_COMPATIBLE_SEGMENT_ACCESS (0x7<<21)
  2852. #define IGU_BACKWARD_COMPATIBLE_SEGMENT_ACCESS_SHIFT 21
  2853. #define IGU_BACKWARD_COMPATIBLE_BUPDATE (0x1<<24)
  2854. #define IGU_BACKWARD_COMPATIBLE_BUPDATE_SHIFT 24
  2855. #define IGU_BACKWARD_COMPATIBLE_ENABLE_INT (0x3<<25)
  2856. #define IGU_BACKWARD_COMPATIBLE_ENABLE_INT_SHIFT 25
  2857. #define IGU_BACKWARD_COMPATIBLE_RESERVED_0 (0x1F<<27)
  2858. #define IGU_BACKWARD_COMPATIBLE_RESERVED_0_SHIFT 27
  2859. u32 reserved_2;
  2860. };
  2861. /*
  2862. * IGU driver acknowledgement register
  2863. */
  2864. struct igu_regular {
  2865. u32 sb_id_and_flags;
  2866. #define IGU_REGULAR_SB_INDEX (0xFFFFF<<0)
  2867. #define IGU_REGULAR_SB_INDEX_SHIFT 0
  2868. #define IGU_REGULAR_RESERVED0 (0x1<<20)
  2869. #define IGU_REGULAR_RESERVED0_SHIFT 20
  2870. #define IGU_REGULAR_SEGMENT_ACCESS (0x7<<21)
  2871. #define IGU_REGULAR_SEGMENT_ACCESS_SHIFT 21
  2872. #define IGU_REGULAR_BUPDATE (0x1<<24)
  2873. #define IGU_REGULAR_BUPDATE_SHIFT 24
  2874. #define IGU_REGULAR_ENABLE_INT (0x3<<25)
  2875. #define IGU_REGULAR_ENABLE_INT_SHIFT 25
  2876. #define IGU_REGULAR_RESERVED_1 (0x1<<27)
  2877. #define IGU_REGULAR_RESERVED_1_SHIFT 27
  2878. #define IGU_REGULAR_CLEANUP_TYPE (0x3<<28)
  2879. #define IGU_REGULAR_CLEANUP_TYPE_SHIFT 28
  2880. #define IGU_REGULAR_CLEANUP_SET (0x1<<30)
  2881. #define IGU_REGULAR_CLEANUP_SET_SHIFT 30
  2882. #define IGU_REGULAR_BCLEANUP (0x1<<31)
  2883. #define IGU_REGULAR_BCLEANUP_SHIFT 31
  2884. u32 reserved_2;
  2885. };
  2886. /*
  2887. * IGU driver acknowledgement register
  2888. */
  2889. union igu_consprod_reg {
  2890. struct igu_regular regular;
  2891. struct igu_backward_compatible backward_compatible;
  2892. };
  2893. /*
  2894. * Igu control commands
  2895. */
  2896. enum igu_ctrl_cmd {
  2897. IGU_CTRL_CMD_TYPE_RD,
  2898. IGU_CTRL_CMD_TYPE_WR,
  2899. MAX_IGU_CTRL_CMD
  2900. };
  2901. /*
  2902. * Control register for the IGU command register
  2903. */
  2904. struct igu_ctrl_reg {
  2905. u32 ctrl_data;
  2906. #define IGU_CTRL_REG_ADDRESS (0xFFF<<0)
  2907. #define IGU_CTRL_REG_ADDRESS_SHIFT 0
  2908. #define IGU_CTRL_REG_FID (0x7F<<12)
  2909. #define IGU_CTRL_REG_FID_SHIFT 12
  2910. #define IGU_CTRL_REG_RESERVED (0x1<<19)
  2911. #define IGU_CTRL_REG_RESERVED_SHIFT 19
  2912. #define IGU_CTRL_REG_TYPE (0x1<<20)
  2913. #define IGU_CTRL_REG_TYPE_SHIFT 20
  2914. #define IGU_CTRL_REG_UNUSED (0x7FF<<21)
  2915. #define IGU_CTRL_REG_UNUSED_SHIFT 21
  2916. };
  2917. /*
  2918. * Igu interrupt command
  2919. */
  2920. enum igu_int_cmd {
  2921. IGU_INT_ENABLE,
  2922. IGU_INT_DISABLE,
  2923. IGU_INT_NOP,
  2924. IGU_INT_NOP2,
  2925. MAX_IGU_INT_CMD
  2926. };
  2927. /*
  2928. * Igu segments
  2929. */
  2930. enum igu_seg_access {
  2931. IGU_SEG_ACCESS_NORM,
  2932. IGU_SEG_ACCESS_DEF,
  2933. IGU_SEG_ACCESS_ATTN,
  2934. MAX_IGU_SEG_ACCESS
  2935. };
  2936. /*
  2937. * Parser parsing flags field
  2938. */
  2939. struct parsing_flags {
  2940. __le16 flags;
  2941. #define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE (0x1<<0)
  2942. #define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE_SHIFT 0
  2943. #define PARSING_FLAGS_VLAN (0x1<<1)
  2944. #define PARSING_FLAGS_VLAN_SHIFT 1
  2945. #define PARSING_FLAGS_EXTRA_VLAN (0x1<<2)
  2946. #define PARSING_FLAGS_EXTRA_VLAN_SHIFT 2
  2947. #define PARSING_FLAGS_OVER_ETHERNET_PROTOCOL (0x3<<3)
  2948. #define PARSING_FLAGS_OVER_ETHERNET_PROTOCOL_SHIFT 3
  2949. #define PARSING_FLAGS_IP_OPTIONS (0x1<<5)
  2950. #define PARSING_FLAGS_IP_OPTIONS_SHIFT 5
  2951. #define PARSING_FLAGS_FRAGMENTATION_STATUS (0x1<<6)
  2952. #define PARSING_FLAGS_FRAGMENTATION_STATUS_SHIFT 6
  2953. #define PARSING_FLAGS_OVER_IP_PROTOCOL (0x3<<7)
  2954. #define PARSING_FLAGS_OVER_IP_PROTOCOL_SHIFT 7
  2955. #define PARSING_FLAGS_PURE_ACK_INDICATION (0x1<<9)
  2956. #define PARSING_FLAGS_PURE_ACK_INDICATION_SHIFT 9
  2957. #define PARSING_FLAGS_TCP_OPTIONS_EXIST (0x1<<10)
  2958. #define PARSING_FLAGS_TCP_OPTIONS_EXIST_SHIFT 10
  2959. #define PARSING_FLAGS_TIME_STAMP_EXIST_FLAG (0x1<<11)
  2960. #define PARSING_FLAGS_TIME_STAMP_EXIST_FLAG_SHIFT 11
  2961. #define PARSING_FLAGS_CONNECTION_MATCH (0x1<<12)
  2962. #define PARSING_FLAGS_CONNECTION_MATCH_SHIFT 12
  2963. #define PARSING_FLAGS_LLC_SNAP (0x1<<13)
  2964. #define PARSING_FLAGS_LLC_SNAP_SHIFT 13
  2965. #define PARSING_FLAGS_RESERVED0 (0x3<<14)
  2966. #define PARSING_FLAGS_RESERVED0_SHIFT 14
  2967. };
  2968. /*
  2969. * Parsing flags for TCP ACK type
  2970. */
  2971. enum prs_flags_ack_type {
  2972. PRS_FLAG_PUREACK_PIGGY,
  2973. PRS_FLAG_PUREACK_PURE,
  2974. MAX_PRS_FLAGS_ACK_TYPE
  2975. };
  2976. /*
  2977. * Parsing flags for Ethernet address type
  2978. */
  2979. enum prs_flags_eth_addr_type {
  2980. PRS_FLAG_ETHTYPE_NON_UNICAST,
  2981. PRS_FLAG_ETHTYPE_UNICAST,
  2982. MAX_PRS_FLAGS_ETH_ADDR_TYPE
  2983. };
  2984. /*
  2985. * Parsing flags for over-ethernet protocol
  2986. */
  2987. enum prs_flags_over_eth {
  2988. PRS_FLAG_OVERETH_UNKNOWN,
  2989. PRS_FLAG_OVERETH_IPV4,
  2990. PRS_FLAG_OVERETH_IPV6,
  2991. PRS_FLAG_OVERETH_LLCSNAP_UNKNOWN,
  2992. MAX_PRS_FLAGS_OVER_ETH
  2993. };
  2994. /*
  2995. * Parsing flags for over-IP protocol
  2996. */
  2997. enum prs_flags_over_ip {
  2998. PRS_FLAG_OVERIP_UNKNOWN,
  2999. PRS_FLAG_OVERIP_TCP,
  3000. PRS_FLAG_OVERIP_UDP,
  3001. MAX_PRS_FLAGS_OVER_IP
  3002. };
  3003. /*
  3004. * SDM operation gen command (generate aggregative interrupt)
  3005. */
  3006. struct sdm_op_gen {
  3007. __le32 command;
  3008. #define SDM_OP_GEN_COMP_PARAM (0x1F<<0)
  3009. #define SDM_OP_GEN_COMP_PARAM_SHIFT 0
  3010. #define SDM_OP_GEN_COMP_TYPE (0x7<<5)
  3011. #define SDM_OP_GEN_COMP_TYPE_SHIFT 5
  3012. #define SDM_OP_GEN_AGG_VECT_IDX (0xFF<<8)
  3013. #define SDM_OP_GEN_AGG_VECT_IDX_SHIFT 8
  3014. #define SDM_OP_GEN_AGG_VECT_IDX_VALID (0x1<<16)
  3015. #define SDM_OP_GEN_AGG_VECT_IDX_VALID_SHIFT 16
  3016. #define SDM_OP_GEN_RESERVED (0x7FFF<<17)
  3017. #define SDM_OP_GEN_RESERVED_SHIFT 17
  3018. };
  3019. /*
  3020. * Timers connection context
  3021. */
  3022. struct timers_block_context {
  3023. u32 __reserved_0;
  3024. u32 __reserved_1;
  3025. u32 __reserved_2;
  3026. u32 flags;
  3027. #define __TIMERS_BLOCK_CONTEXT_NUM_OF_ACTIVE_TIMERS (0x3<<0)
  3028. #define __TIMERS_BLOCK_CONTEXT_NUM_OF_ACTIVE_TIMERS_SHIFT 0
  3029. #define TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG (0x1<<2)
  3030. #define TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG_SHIFT 2
  3031. #define __TIMERS_BLOCK_CONTEXT_RESERVED0 (0x1FFFFFFF<<3)
  3032. #define __TIMERS_BLOCK_CONTEXT_RESERVED0_SHIFT 3
  3033. };
  3034. /*
  3035. * The eth aggregative context of Tstorm
  3036. */
  3037. struct tstorm_eth_ag_context {
  3038. u32 __reserved0[14];
  3039. };
  3040. /*
  3041. * The eth aggregative context of Ustorm
  3042. */
  3043. struct ustorm_eth_ag_context {
  3044. u32 __reserved0;
  3045. #if defined(__BIG_ENDIAN)
  3046. u8 cdu_usage;
  3047. u8 __reserved2;
  3048. u16 __reserved1;
  3049. #elif defined(__LITTLE_ENDIAN)
  3050. u16 __reserved1;
  3051. u8 __reserved2;
  3052. u8 cdu_usage;
  3053. #endif
  3054. u32 __reserved3[6];
  3055. };
  3056. /*
  3057. * The eth aggregative context of Xstorm
  3058. */
  3059. struct xstorm_eth_ag_context {
  3060. u32 reserved0;
  3061. #if defined(__BIG_ENDIAN)
  3062. u8 cdu_reserved;
  3063. u8 reserved2;
  3064. u16 reserved1;
  3065. #elif defined(__LITTLE_ENDIAN)
  3066. u16 reserved1;
  3067. u8 reserved2;
  3068. u8 cdu_reserved;
  3069. #endif
  3070. u32 reserved3[30];
  3071. };
  3072. /*
  3073. * doorbell message sent to the chip
  3074. */
  3075. struct doorbell {
  3076. #if defined(__BIG_ENDIAN)
  3077. u16 zero_fill2;
  3078. u8 zero_fill1;
  3079. struct doorbell_hdr header;
  3080. #elif defined(__LITTLE_ENDIAN)
  3081. struct doorbell_hdr header;
  3082. u8 zero_fill1;
  3083. u16 zero_fill2;
  3084. #endif
  3085. };
  3086. /*
  3087. * doorbell message sent to the chip
  3088. */
  3089. struct doorbell_set_prod {
  3090. #if defined(__BIG_ENDIAN)
  3091. u16 prod;
  3092. u8 zero_fill1;
  3093. struct doorbell_hdr header;
  3094. #elif defined(__LITTLE_ENDIAN)
  3095. struct doorbell_hdr header;
  3096. u8 zero_fill1;
  3097. u16 prod;
  3098. #endif
  3099. };
  3100. struct regpair {
  3101. __le32 lo;
  3102. __le32 hi;
  3103. };
  3104. struct regpair_native {
  3105. u32 lo;
  3106. u32 hi;
  3107. };
  3108. /*
  3109. * Classify rule opcodes in E2/E3
  3110. */
  3111. enum classify_rule {
  3112. CLASSIFY_RULE_OPCODE_MAC,
  3113. CLASSIFY_RULE_OPCODE_VLAN,
  3114. CLASSIFY_RULE_OPCODE_PAIR,
  3115. CLASSIFY_RULE_OPCODE_IMAC_VNI,
  3116. MAX_CLASSIFY_RULE
  3117. };
  3118. /*
  3119. * Classify rule types in E2/E3
  3120. */
  3121. enum classify_rule_action_type {
  3122. CLASSIFY_RULE_REMOVE,
  3123. CLASSIFY_RULE_ADD,
  3124. MAX_CLASSIFY_RULE_ACTION_TYPE
  3125. };
  3126. /*
  3127. * client init ramrod data
  3128. */
  3129. struct client_init_general_data {
  3130. u8 client_id;
  3131. u8 statistics_counter_id;
  3132. u8 statistics_en_flg;
  3133. u8 is_fcoe_flg;
  3134. u8 activate_flg;
  3135. u8 sp_client_id;
  3136. __le16 mtu;
  3137. u8 statistics_zero_flg;
  3138. u8 func_id;
  3139. u8 cos;
  3140. u8 traffic_type;
  3141. u8 fp_hsi_ver;
  3142. u8 reserved0[3];
  3143. };
  3144. /*
  3145. * client init rx data
  3146. */
  3147. struct client_init_rx_data {
  3148. u8 tpa_en;
  3149. #define CLIENT_INIT_RX_DATA_TPA_EN_IPV4 (0x1<<0)
  3150. #define CLIENT_INIT_RX_DATA_TPA_EN_IPV4_SHIFT 0
  3151. #define CLIENT_INIT_RX_DATA_TPA_EN_IPV6 (0x1<<1)
  3152. #define CLIENT_INIT_RX_DATA_TPA_EN_IPV6_SHIFT 1
  3153. #define CLIENT_INIT_RX_DATA_TPA_MODE (0x1<<2)
  3154. #define CLIENT_INIT_RX_DATA_TPA_MODE_SHIFT 2
  3155. #define CLIENT_INIT_RX_DATA_RESERVED5 (0x1F<<3)
  3156. #define CLIENT_INIT_RX_DATA_RESERVED5_SHIFT 3
  3157. u8 vmqueue_mode_en_flg;
  3158. u8 extra_data_over_sgl_en_flg;
  3159. u8 cache_line_alignment_log_size;
  3160. u8 enable_dynamic_hc;
  3161. u8 max_sges_for_packet;
  3162. u8 client_qzone_id;
  3163. u8 drop_ip_cs_err_flg;
  3164. u8 drop_tcp_cs_err_flg;
  3165. u8 drop_ttl0_flg;
  3166. u8 drop_udp_cs_err_flg;
  3167. u8 inner_vlan_removal_enable_flg;
  3168. u8 outer_vlan_removal_enable_flg;
  3169. u8 status_block_id;
  3170. u8 rx_sb_index_number;
  3171. u8 dont_verify_rings_pause_thr_flg;
  3172. u8 max_tpa_queues;
  3173. u8 silent_vlan_removal_flg;
  3174. __le16 max_bytes_on_bd;
  3175. __le16 sge_buff_size;
  3176. u8 approx_mcast_engine_id;
  3177. u8 rss_engine_id;
  3178. struct regpair bd_page_base;
  3179. struct regpair sge_page_base;
  3180. struct regpair cqe_page_base;
  3181. u8 is_leading_rss;
  3182. u8 is_approx_mcast;
  3183. __le16 max_agg_size;
  3184. __le16 state;
  3185. #define CLIENT_INIT_RX_DATA_UCAST_DROP_ALL (0x1<<0)
  3186. #define CLIENT_INIT_RX_DATA_UCAST_DROP_ALL_SHIFT 0
  3187. #define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_ALL (0x1<<1)
  3188. #define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_ALL_SHIFT 1
  3189. #define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_UNMATCHED (0x1<<2)
  3190. #define CLIENT_INIT_RX_DATA_UCAST_ACCEPT_UNMATCHED_SHIFT 2
  3191. #define CLIENT_INIT_RX_DATA_MCAST_DROP_ALL (0x1<<3)
  3192. #define CLIENT_INIT_RX_DATA_MCAST_DROP_ALL_SHIFT 3
  3193. #define CLIENT_INIT_RX_DATA_MCAST_ACCEPT_ALL (0x1<<4)
  3194. #define CLIENT_INIT_RX_DATA_MCAST_ACCEPT_ALL_SHIFT 4
  3195. #define CLIENT_INIT_RX_DATA_BCAST_ACCEPT_ALL (0x1<<5)
  3196. #define CLIENT_INIT_RX_DATA_BCAST_ACCEPT_ALL_SHIFT 5
  3197. #define CLIENT_INIT_RX_DATA_ACCEPT_ANY_VLAN (0x1<<6)
  3198. #define CLIENT_INIT_RX_DATA_ACCEPT_ANY_VLAN_SHIFT 6
  3199. #define CLIENT_INIT_RX_DATA_RESERVED2 (0x1FF<<7)
  3200. #define CLIENT_INIT_RX_DATA_RESERVED2_SHIFT 7
  3201. __le16 cqe_pause_thr_low;
  3202. __le16 cqe_pause_thr_high;
  3203. __le16 bd_pause_thr_low;
  3204. __le16 bd_pause_thr_high;
  3205. __le16 sge_pause_thr_low;
  3206. __le16 sge_pause_thr_high;
  3207. __le16 rx_cos_mask;
  3208. __le16 silent_vlan_value;
  3209. __le16 silent_vlan_mask;
  3210. u8 handle_ptp_pkts_flg;
  3211. u8 reserved6[3];
  3212. __le32 reserved7;
  3213. };
  3214. /*
  3215. * client init tx data
  3216. */
  3217. struct client_init_tx_data {
  3218. u8 enforce_security_flg;
  3219. u8 tx_status_block_id;
  3220. u8 tx_sb_index_number;
  3221. u8 tss_leading_client_id;
  3222. u8 tx_switching_flg;
  3223. u8 anti_spoofing_flg;
  3224. __le16 default_vlan;
  3225. struct regpair tx_bd_page_base;
  3226. __le16 state;
  3227. #define CLIENT_INIT_TX_DATA_UCAST_ACCEPT_ALL (0x1<<0)
  3228. #define CLIENT_INIT_TX_DATA_UCAST_ACCEPT_ALL_SHIFT 0
  3229. #define CLIENT_INIT_TX_DATA_MCAST_ACCEPT_ALL (0x1<<1)
  3230. #define CLIENT_INIT_TX_DATA_MCAST_ACCEPT_ALL_SHIFT 1
  3231. #define CLIENT_INIT_TX_DATA_BCAST_ACCEPT_ALL (0x1<<2)
  3232. #define CLIENT_INIT_TX_DATA_BCAST_ACCEPT_ALL_SHIFT 2
  3233. #define CLIENT_INIT_TX_DATA_ACCEPT_ANY_VLAN (0x1<<3)
  3234. #define CLIENT_INIT_TX_DATA_ACCEPT_ANY_VLAN_SHIFT 3
  3235. #define CLIENT_INIT_TX_DATA_RESERVED0 (0xFFF<<4)
  3236. #define CLIENT_INIT_TX_DATA_RESERVED0_SHIFT 4
  3237. u8 default_vlan_flg;
  3238. u8 force_default_pri_flg;
  3239. u8 tunnel_lso_inc_ip_id;
  3240. u8 refuse_outband_vlan_flg;
  3241. u8 tunnel_non_lso_pcsum_location;
  3242. u8 tunnel_non_lso_outer_ip_csum_location;
  3243. };
  3244. /*
  3245. * client init ramrod data
  3246. */
  3247. struct client_init_ramrod_data {
  3248. struct client_init_general_data general;
  3249. struct client_init_rx_data rx;
  3250. struct client_init_tx_data tx;
  3251. };
  3252. /*
  3253. * client update ramrod data
  3254. */
  3255. struct client_update_ramrod_data {
  3256. u8 client_id;
  3257. u8 func_id;
  3258. u8 inner_vlan_removal_enable_flg;
  3259. u8 inner_vlan_removal_change_flg;
  3260. u8 outer_vlan_removal_enable_flg;
  3261. u8 outer_vlan_removal_change_flg;
  3262. u8 anti_spoofing_enable_flg;
  3263. u8 anti_spoofing_change_flg;
  3264. u8 activate_flg;
  3265. u8 activate_change_flg;
  3266. __le16 default_vlan;
  3267. u8 default_vlan_enable_flg;
  3268. u8 default_vlan_change_flg;
  3269. __le16 silent_vlan_value;
  3270. __le16 silent_vlan_mask;
  3271. u8 silent_vlan_removal_flg;
  3272. u8 silent_vlan_change_flg;
  3273. u8 refuse_outband_vlan_flg;
  3274. u8 refuse_outband_vlan_change_flg;
  3275. u8 tx_switching_flg;
  3276. u8 tx_switching_change_flg;
  3277. u8 handle_ptp_pkts_flg;
  3278. u8 handle_ptp_pkts_change_flg;
  3279. __le16 reserved1;
  3280. __le32 echo;
  3281. };
  3282. /*
  3283. * The eth storm context of Cstorm
  3284. */
  3285. struct cstorm_eth_st_context {
  3286. u32 __reserved0[4];
  3287. };
  3288. struct double_regpair {
  3289. u32 regpair0_lo;
  3290. u32 regpair0_hi;
  3291. u32 regpair1_lo;
  3292. u32 regpair1_hi;
  3293. };
  3294. /* 2nd parse bd type used in ethernet tx BDs */
  3295. enum eth_2nd_parse_bd_type {
  3296. ETH_2ND_PARSE_BD_TYPE_LSO_TUNNEL,
  3297. MAX_ETH_2ND_PARSE_BD_TYPE
  3298. };
  3299. /*
  3300. * Ethernet address typesm used in ethernet tx BDs
  3301. */
  3302. enum eth_addr_type {
  3303. UNKNOWN_ADDRESS,
  3304. UNICAST_ADDRESS,
  3305. MULTICAST_ADDRESS,
  3306. BROADCAST_ADDRESS,
  3307. MAX_ETH_ADDR_TYPE
  3308. };
  3309. /*
  3310. *
  3311. */
  3312. struct eth_classify_cmd_header {
  3313. u8 cmd_general_data;
  3314. #define ETH_CLASSIFY_CMD_HEADER_RX_CMD (0x1<<0)
  3315. #define ETH_CLASSIFY_CMD_HEADER_RX_CMD_SHIFT 0
  3316. #define ETH_CLASSIFY_CMD_HEADER_TX_CMD (0x1<<1)
  3317. #define ETH_CLASSIFY_CMD_HEADER_TX_CMD_SHIFT 1
  3318. #define ETH_CLASSIFY_CMD_HEADER_OPCODE (0x3<<2)
  3319. #define ETH_CLASSIFY_CMD_HEADER_OPCODE_SHIFT 2
  3320. #define ETH_CLASSIFY_CMD_HEADER_IS_ADD (0x1<<4)
  3321. #define ETH_CLASSIFY_CMD_HEADER_IS_ADD_SHIFT 4
  3322. #define ETH_CLASSIFY_CMD_HEADER_RESERVED0 (0x7<<5)
  3323. #define ETH_CLASSIFY_CMD_HEADER_RESERVED0_SHIFT 5
  3324. u8 func_id;
  3325. u8 client_id;
  3326. u8 reserved1;
  3327. };
  3328. /*
  3329. * header for eth classification config ramrod
  3330. */
  3331. struct eth_classify_header {
  3332. u8 rule_cnt;
  3333. u8 reserved0;
  3334. __le16 reserved1;
  3335. __le32 echo;
  3336. };
  3337. /*
  3338. * Command for adding/removing a Inner-MAC/VNI classification rule
  3339. */
  3340. struct eth_classify_imac_vni_cmd {
  3341. struct eth_classify_cmd_header header;
  3342. __le32 vni;
  3343. __le16 imac_lsb;
  3344. __le16 imac_mid;
  3345. __le16 imac_msb;
  3346. __le16 reserved1;
  3347. };
  3348. /*
  3349. * Command for adding/removing a MAC classification rule
  3350. */
  3351. struct eth_classify_mac_cmd {
  3352. struct eth_classify_cmd_header header;
  3353. __le16 reserved0;
  3354. __le16 inner_mac;
  3355. __le16 mac_lsb;
  3356. __le16 mac_mid;
  3357. __le16 mac_msb;
  3358. __le16 reserved1;
  3359. };
  3360. /*
  3361. * Command for adding/removing a MAC-VLAN pair classification rule
  3362. */
  3363. struct eth_classify_pair_cmd {
  3364. struct eth_classify_cmd_header header;
  3365. __le16 reserved0;
  3366. __le16 inner_mac;
  3367. __le16 mac_lsb;
  3368. __le16 mac_mid;
  3369. __le16 mac_msb;
  3370. __le16 vlan;
  3371. };
  3372. /*
  3373. * Command for adding/removing a VLAN classification rule
  3374. */
  3375. struct eth_classify_vlan_cmd {
  3376. struct eth_classify_cmd_header header;
  3377. __le32 reserved0;
  3378. __le32 reserved1;
  3379. __le16 reserved2;
  3380. __le16 vlan;
  3381. };
  3382. /*
  3383. * Command for adding/removing a VXLAN classification rule
  3384. */
  3385. /*
  3386. * union for eth classification rule
  3387. */
  3388. union eth_classify_rule_cmd {
  3389. struct eth_classify_mac_cmd mac;
  3390. struct eth_classify_vlan_cmd vlan;
  3391. struct eth_classify_pair_cmd pair;
  3392. struct eth_classify_imac_vni_cmd imac_vni;
  3393. };
  3394. /*
  3395. * parameters for eth classification configuration ramrod
  3396. */
  3397. struct eth_classify_rules_ramrod_data {
  3398. struct eth_classify_header header;
  3399. union eth_classify_rule_cmd rules[CLASSIFY_RULES_COUNT];
  3400. };
  3401. /*
  3402. * The data contain client ID need to the ramrod
  3403. */
  3404. struct eth_common_ramrod_data {
  3405. __le32 client_id;
  3406. __le32 reserved1;
  3407. };
  3408. /*
  3409. * The eth storm context of Ustorm
  3410. */
  3411. struct ustorm_eth_st_context {
  3412. u32 reserved0[52];
  3413. };
  3414. /*
  3415. * The eth storm context of Tstorm
  3416. */
  3417. struct tstorm_eth_st_context {
  3418. u32 __reserved0[28];
  3419. };
  3420. /*
  3421. * The eth storm context of Xstorm
  3422. */
  3423. struct xstorm_eth_st_context {
  3424. u32 reserved0[60];
  3425. };
  3426. /*
  3427. * Ethernet connection context
  3428. */
  3429. struct eth_context {
  3430. struct ustorm_eth_st_context ustorm_st_context;
  3431. struct tstorm_eth_st_context tstorm_st_context;
  3432. struct xstorm_eth_ag_context xstorm_ag_context;
  3433. struct tstorm_eth_ag_context tstorm_ag_context;
  3434. struct cstorm_eth_ag_context cstorm_ag_context;
  3435. struct ustorm_eth_ag_context ustorm_ag_context;
  3436. struct timers_block_context timers_context;
  3437. struct xstorm_eth_st_context xstorm_st_context;
  3438. struct cstorm_eth_st_context cstorm_st_context;
  3439. };
  3440. /*
  3441. * union for sgl and raw data.
  3442. */
  3443. union eth_sgl_or_raw_data {
  3444. __le16 sgl[8];
  3445. u32 raw_data[4];
  3446. };
  3447. /*
  3448. * eth FP end aggregation CQE parameters struct
  3449. */
  3450. struct eth_end_agg_rx_cqe {
  3451. u8 type_error_flags;
  3452. #define ETH_END_AGG_RX_CQE_TYPE (0x3<<0)
  3453. #define ETH_END_AGG_RX_CQE_TYPE_SHIFT 0
  3454. #define ETH_END_AGG_RX_CQE_SGL_RAW_SEL (0x1<<2)
  3455. #define ETH_END_AGG_RX_CQE_SGL_RAW_SEL_SHIFT 2
  3456. #define ETH_END_AGG_RX_CQE_RESERVED0 (0x1F<<3)
  3457. #define ETH_END_AGG_RX_CQE_RESERVED0_SHIFT 3
  3458. u8 reserved1;
  3459. u8 queue_index;
  3460. u8 reserved2;
  3461. __le32 timestamp_delta;
  3462. __le16 num_of_coalesced_segs;
  3463. __le16 pkt_len;
  3464. u8 pure_ack_count;
  3465. u8 reserved3;
  3466. __le16 reserved4;
  3467. union eth_sgl_or_raw_data sgl_or_raw_data;
  3468. __le32 reserved5[8];
  3469. };
  3470. /*
  3471. * regular eth FP CQE parameters struct
  3472. */
  3473. struct eth_fast_path_rx_cqe {
  3474. u8 type_error_flags;
  3475. #define ETH_FAST_PATH_RX_CQE_TYPE (0x3<<0)
  3476. #define ETH_FAST_PATH_RX_CQE_TYPE_SHIFT 0
  3477. #define ETH_FAST_PATH_RX_CQE_SGL_RAW_SEL (0x1<<2)
  3478. #define ETH_FAST_PATH_RX_CQE_SGL_RAW_SEL_SHIFT 2
  3479. #define ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG (0x1<<3)
  3480. #define ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG_SHIFT 3
  3481. #define ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG (0x1<<4)
  3482. #define ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG_SHIFT 4
  3483. #define ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG (0x1<<5)
  3484. #define ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG_SHIFT 5
  3485. #define ETH_FAST_PATH_RX_CQE_PTP_PKT (0x1<<6)
  3486. #define ETH_FAST_PATH_RX_CQE_PTP_PKT_SHIFT 6
  3487. #define ETH_FAST_PATH_RX_CQE_RESERVED0 (0x1<<7)
  3488. #define ETH_FAST_PATH_RX_CQE_RESERVED0_SHIFT 7
  3489. u8 status_flags;
  3490. #define ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE (0x7<<0)
  3491. #define ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE_SHIFT 0
  3492. #define ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG (0x1<<3)
  3493. #define ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG_SHIFT 3
  3494. #define ETH_FAST_PATH_RX_CQE_BROADCAST_FLG (0x1<<4)
  3495. #define ETH_FAST_PATH_RX_CQE_BROADCAST_FLG_SHIFT 4
  3496. #define ETH_FAST_PATH_RX_CQE_MAC_MATCH_FLG (0x1<<5)
  3497. #define ETH_FAST_PATH_RX_CQE_MAC_MATCH_FLG_SHIFT 5
  3498. #define ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG (0x1<<6)
  3499. #define ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG_SHIFT 6
  3500. #define ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG (0x1<<7)
  3501. #define ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG_SHIFT 7
  3502. u8 queue_index;
  3503. u8 placement_offset;
  3504. __le32 rss_hash_result;
  3505. __le16 vlan_tag;
  3506. __le16 pkt_len_or_gro_seg_len;
  3507. __le16 len_on_bd;
  3508. struct parsing_flags pars_flags;
  3509. union eth_sgl_or_raw_data sgl_or_raw_data;
  3510. u8 tunn_type;
  3511. u8 tunn_inner_hdrs_offset;
  3512. __le16 reserved1;
  3513. __le32 tunn_tenant_id;
  3514. __le32 padding[5];
  3515. u32 marker;
  3516. };
  3517. /*
  3518. * Command for setting classification flags for a client
  3519. */
  3520. struct eth_filter_rules_cmd {
  3521. u8 cmd_general_data;
  3522. #define ETH_FILTER_RULES_CMD_RX_CMD (0x1<<0)
  3523. #define ETH_FILTER_RULES_CMD_RX_CMD_SHIFT 0
  3524. #define ETH_FILTER_RULES_CMD_TX_CMD (0x1<<1)
  3525. #define ETH_FILTER_RULES_CMD_TX_CMD_SHIFT 1
  3526. #define ETH_FILTER_RULES_CMD_RESERVED0 (0x3F<<2)
  3527. #define ETH_FILTER_RULES_CMD_RESERVED0_SHIFT 2
  3528. u8 func_id;
  3529. u8 client_id;
  3530. u8 reserved1;
  3531. __le16 state;
  3532. #define ETH_FILTER_RULES_CMD_UCAST_DROP_ALL (0x1<<0)
  3533. #define ETH_FILTER_RULES_CMD_UCAST_DROP_ALL_SHIFT 0
  3534. #define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_ALL (0x1<<1)
  3535. #define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_ALL_SHIFT 1
  3536. #define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_UNMATCHED (0x1<<2)
  3537. #define ETH_FILTER_RULES_CMD_UCAST_ACCEPT_UNMATCHED_SHIFT 2
  3538. #define ETH_FILTER_RULES_CMD_MCAST_DROP_ALL (0x1<<3)
  3539. #define ETH_FILTER_RULES_CMD_MCAST_DROP_ALL_SHIFT 3
  3540. #define ETH_FILTER_RULES_CMD_MCAST_ACCEPT_ALL (0x1<<4)
  3541. #define ETH_FILTER_RULES_CMD_MCAST_ACCEPT_ALL_SHIFT 4
  3542. #define ETH_FILTER_RULES_CMD_BCAST_ACCEPT_ALL (0x1<<5)
  3543. #define ETH_FILTER_RULES_CMD_BCAST_ACCEPT_ALL_SHIFT 5
  3544. #define ETH_FILTER_RULES_CMD_ACCEPT_ANY_VLAN (0x1<<6)
  3545. #define ETH_FILTER_RULES_CMD_ACCEPT_ANY_VLAN_SHIFT 6
  3546. #define ETH_FILTER_RULES_CMD_RESERVED2 (0x1FF<<7)
  3547. #define ETH_FILTER_RULES_CMD_RESERVED2_SHIFT 7
  3548. __le16 reserved3;
  3549. struct regpair reserved4;
  3550. };
  3551. /*
  3552. * parameters for eth classification filters ramrod
  3553. */
  3554. struct eth_filter_rules_ramrod_data {
  3555. struct eth_classify_header header;
  3556. struct eth_filter_rules_cmd rules[FILTER_RULES_COUNT];
  3557. };
  3558. /* Hsi version */
  3559. enum eth_fp_hsi_ver {
  3560. ETH_FP_HSI_VER_0,
  3561. ETH_FP_HSI_VER_1,
  3562. ETH_FP_HSI_VER_2,
  3563. MAX_ETH_FP_HSI_VER
  3564. };
  3565. /*
  3566. * parameters for eth classification configuration ramrod
  3567. */
  3568. struct eth_general_rules_ramrod_data {
  3569. struct eth_classify_header header;
  3570. union eth_classify_rule_cmd rules[CLASSIFY_RULES_COUNT];
  3571. };
  3572. /*
  3573. * The data for Halt ramrod
  3574. */
  3575. struct eth_halt_ramrod_data {
  3576. __le32 client_id;
  3577. __le32 reserved0;
  3578. };
  3579. /*
  3580. * destination and source mac address.
  3581. */
  3582. struct eth_mac_addresses {
  3583. #if defined(__BIG_ENDIAN)
  3584. __le16 dst_mid;
  3585. __le16 dst_lo;
  3586. #elif defined(__LITTLE_ENDIAN)
  3587. __le16 dst_lo;
  3588. __le16 dst_mid;
  3589. #endif
  3590. #if defined(__BIG_ENDIAN)
  3591. __le16 src_lo;
  3592. __le16 dst_hi;
  3593. #elif defined(__LITTLE_ENDIAN)
  3594. __le16 dst_hi;
  3595. __le16 src_lo;
  3596. #endif
  3597. #if defined(__BIG_ENDIAN)
  3598. __le16 src_hi;
  3599. __le16 src_mid;
  3600. #elif defined(__LITTLE_ENDIAN)
  3601. __le16 src_mid;
  3602. __le16 src_hi;
  3603. #endif
  3604. };
  3605. /* tunneling related data */
  3606. struct eth_tunnel_data {
  3607. __le16 dst_lo;
  3608. __le16 dst_mid;
  3609. __le16 dst_hi;
  3610. __le16 fw_ip_hdr_csum;
  3611. __le16 pseudo_csum;
  3612. u8 ip_hdr_start_inner_w;
  3613. u8 flags;
  3614. #define ETH_TUNNEL_DATA_IPV6_OUTER (0x1<<0)
  3615. #define ETH_TUNNEL_DATA_IPV6_OUTER_SHIFT 0
  3616. #define ETH_TUNNEL_DATA_RESERVED (0x7F<<1)
  3617. #define ETH_TUNNEL_DATA_RESERVED_SHIFT 1
  3618. };
  3619. /* union for mac addresses and for tunneling data.
  3620. * considered as tunneling data only if (tunnel_exist == 1).
  3621. */
  3622. union eth_mac_addr_or_tunnel_data {
  3623. struct eth_mac_addresses mac_addr;
  3624. struct eth_tunnel_data tunnel_data;
  3625. };
  3626. /*Command for setting multicast classification for a client */
  3627. struct eth_multicast_rules_cmd {
  3628. u8 cmd_general_data;
  3629. #define ETH_MULTICAST_RULES_CMD_RX_CMD (0x1<<0)
  3630. #define ETH_MULTICAST_RULES_CMD_RX_CMD_SHIFT 0
  3631. #define ETH_MULTICAST_RULES_CMD_TX_CMD (0x1<<1)
  3632. #define ETH_MULTICAST_RULES_CMD_TX_CMD_SHIFT 1
  3633. #define ETH_MULTICAST_RULES_CMD_IS_ADD (0x1<<2)
  3634. #define ETH_MULTICAST_RULES_CMD_IS_ADD_SHIFT 2
  3635. #define ETH_MULTICAST_RULES_CMD_RESERVED0 (0x1F<<3)
  3636. #define ETH_MULTICAST_RULES_CMD_RESERVED0_SHIFT 3
  3637. u8 func_id;
  3638. u8 bin_id;
  3639. u8 engine_id;
  3640. __le32 reserved2;
  3641. struct regpair reserved3;
  3642. };
  3643. /*
  3644. * parameters for multicast classification ramrod
  3645. */
  3646. struct eth_multicast_rules_ramrod_data {
  3647. struct eth_classify_header header;
  3648. struct eth_multicast_rules_cmd rules[MULTICAST_RULES_COUNT];
  3649. };
  3650. /*
  3651. * Place holder for ramrods protocol specific data
  3652. */
  3653. struct ramrod_data {
  3654. __le32 data_lo;
  3655. __le32 data_hi;
  3656. };
  3657. /*
  3658. * union for ramrod data for Ethernet protocol (CQE) (force size of 16 bits)
  3659. */
  3660. union eth_ramrod_data {
  3661. struct ramrod_data general;
  3662. };
  3663. /*
  3664. * RSS toeplitz hash type, as reported in CQE
  3665. */
  3666. enum eth_rss_hash_type {
  3667. DEFAULT_HASH_TYPE,
  3668. IPV4_HASH_TYPE,
  3669. TCP_IPV4_HASH_TYPE,
  3670. IPV6_HASH_TYPE,
  3671. TCP_IPV6_HASH_TYPE,
  3672. VLAN_PRI_HASH_TYPE,
  3673. E1HOV_PRI_HASH_TYPE,
  3674. DSCP_HASH_TYPE,
  3675. MAX_ETH_RSS_HASH_TYPE
  3676. };
  3677. /*
  3678. * Ethernet RSS mode
  3679. */
  3680. enum eth_rss_mode {
  3681. ETH_RSS_MODE_DISABLED,
  3682. ETH_RSS_MODE_REGULAR,
  3683. ETH_RSS_MODE_VLAN_PRI,
  3684. ETH_RSS_MODE_E1HOV_PRI,
  3685. ETH_RSS_MODE_IP_DSCP,
  3686. MAX_ETH_RSS_MODE
  3687. };
  3688. /*
  3689. * parameters for RSS update ramrod (E2)
  3690. */
  3691. struct eth_rss_update_ramrod_data {
  3692. u8 rss_engine_id;
  3693. u8 rss_mode;
  3694. __le16 capabilities;
  3695. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_CAPABILITY (0x1<<0)
  3696. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_CAPABILITY_SHIFT 0
  3697. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_TCP_CAPABILITY (0x1<<1)
  3698. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_TCP_CAPABILITY_SHIFT 1
  3699. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_UDP_CAPABILITY (0x1<<2)
  3700. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_UDP_CAPABILITY_SHIFT 2
  3701. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_VXLAN_CAPABILITY (0x1<<3)
  3702. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV4_VXLAN_CAPABILITY_SHIFT 3
  3703. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_CAPABILITY (0x1<<4)
  3704. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_CAPABILITY_SHIFT 4
  3705. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_TCP_CAPABILITY (0x1<<5)
  3706. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_TCP_CAPABILITY_SHIFT 5
  3707. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY (0x1<<6)
  3708. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY_SHIFT 6
  3709. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_VXLAN_CAPABILITY (0x1<<7)
  3710. #define ETH_RSS_UPDATE_RAMROD_DATA_IPV6_VXLAN_CAPABILITY_SHIFT 7
  3711. #define ETH_RSS_UPDATE_RAMROD_DATA_TUNN_INNER_HDRS_CAPABILITY (0x1<<8)
  3712. #define ETH_RSS_UPDATE_RAMROD_DATA_TUNN_INNER_HDRS_CAPABILITY_SHIFT 8
  3713. #define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY (0x1<<9)
  3714. #define ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY_SHIFT 9
  3715. #define ETH_RSS_UPDATE_RAMROD_DATA_RESERVED (0x3F<<10)
  3716. #define ETH_RSS_UPDATE_RAMROD_DATA_RESERVED_SHIFT 10
  3717. u8 rss_result_mask;
  3718. u8 reserved3;
  3719. __le16 reserved4;
  3720. u8 indirection_table[T_ETH_INDIRECTION_TABLE_SIZE];
  3721. __le32 rss_key[T_ETH_RSS_KEY];
  3722. __le32 echo;
  3723. __le32 reserved5;
  3724. };
  3725. /*
  3726. * The eth Rx Buffer Descriptor
  3727. */
  3728. struct eth_rx_bd {
  3729. __le32 addr_lo;
  3730. __le32 addr_hi;
  3731. };
  3732. /*
  3733. * Eth Rx Cqe structure- general structure for ramrods
  3734. */
  3735. struct common_ramrod_eth_rx_cqe {
  3736. u8 ramrod_type;
  3737. #define COMMON_RAMROD_ETH_RX_CQE_TYPE (0x3<<0)
  3738. #define COMMON_RAMROD_ETH_RX_CQE_TYPE_SHIFT 0
  3739. #define COMMON_RAMROD_ETH_RX_CQE_ERROR (0x1<<2)
  3740. #define COMMON_RAMROD_ETH_RX_CQE_ERROR_SHIFT 2
  3741. #define COMMON_RAMROD_ETH_RX_CQE_RESERVED0 (0x1F<<3)
  3742. #define COMMON_RAMROD_ETH_RX_CQE_RESERVED0_SHIFT 3
  3743. u8 conn_type;
  3744. __le16 reserved1;
  3745. __le32 conn_and_cmd_data;
  3746. #define COMMON_RAMROD_ETH_RX_CQE_CID (0xFFFFFF<<0)
  3747. #define COMMON_RAMROD_ETH_RX_CQE_CID_SHIFT 0
  3748. #define COMMON_RAMROD_ETH_RX_CQE_CMD_ID (0xFF<<24)
  3749. #define COMMON_RAMROD_ETH_RX_CQE_CMD_ID_SHIFT 24
  3750. struct ramrod_data protocol_data;
  3751. __le32 echo;
  3752. __le32 reserved2[11];
  3753. };
  3754. /*
  3755. * Rx Last CQE in page (in ETH)
  3756. */
  3757. struct eth_rx_cqe_next_page {
  3758. __le32 addr_lo;
  3759. __le32 addr_hi;
  3760. __le32 reserved[14];
  3761. };
  3762. /*
  3763. * union for all eth rx cqe types (fix their sizes)
  3764. */
  3765. union eth_rx_cqe {
  3766. struct eth_fast_path_rx_cqe fast_path_cqe;
  3767. struct common_ramrod_eth_rx_cqe ramrod_cqe;
  3768. struct eth_rx_cqe_next_page next_page_cqe;
  3769. struct eth_end_agg_rx_cqe end_agg_cqe;
  3770. };
  3771. /*
  3772. * Values for RX ETH CQE type field
  3773. */
  3774. enum eth_rx_cqe_type {
  3775. RX_ETH_CQE_TYPE_ETH_FASTPATH,
  3776. RX_ETH_CQE_TYPE_ETH_RAMROD,
  3777. RX_ETH_CQE_TYPE_ETH_START_AGG,
  3778. RX_ETH_CQE_TYPE_ETH_STOP_AGG,
  3779. MAX_ETH_RX_CQE_TYPE
  3780. };
  3781. /*
  3782. * Type of SGL/Raw field in ETH RX fast path CQE
  3783. */
  3784. enum eth_rx_fp_sel {
  3785. ETH_FP_CQE_REGULAR,
  3786. ETH_FP_CQE_RAW,
  3787. MAX_ETH_RX_FP_SEL
  3788. };
  3789. /*
  3790. * The eth Rx SGE Descriptor
  3791. */
  3792. struct eth_rx_sge {
  3793. __le32 addr_lo;
  3794. __le32 addr_hi;
  3795. };
  3796. /*
  3797. * common data for all protocols
  3798. */
  3799. struct spe_hdr {
  3800. __le32 conn_and_cmd_data;
  3801. #define SPE_HDR_CID (0xFFFFFF<<0)
  3802. #define SPE_HDR_CID_SHIFT 0
  3803. #define SPE_HDR_CMD_ID (0xFF<<24)
  3804. #define SPE_HDR_CMD_ID_SHIFT 24
  3805. __le16 type;
  3806. #define SPE_HDR_CONN_TYPE (0xFF<<0)
  3807. #define SPE_HDR_CONN_TYPE_SHIFT 0
  3808. #define SPE_HDR_FUNCTION_ID (0xFF<<8)
  3809. #define SPE_HDR_FUNCTION_ID_SHIFT 8
  3810. __le16 reserved1;
  3811. };
  3812. /*
  3813. * specific data for ethernet slow path element
  3814. */
  3815. union eth_specific_data {
  3816. u8 protocol_data[8];
  3817. struct regpair client_update_ramrod_data;
  3818. struct regpair client_init_ramrod_init_data;
  3819. struct eth_halt_ramrod_data halt_ramrod_data;
  3820. struct regpair update_data_addr;
  3821. struct eth_common_ramrod_data common_ramrod_data;
  3822. struct regpair classify_cfg_addr;
  3823. struct regpair filter_cfg_addr;
  3824. struct regpair mcast_cfg_addr;
  3825. };
  3826. /*
  3827. * Ethernet slow path element
  3828. */
  3829. struct eth_spe {
  3830. struct spe_hdr hdr;
  3831. union eth_specific_data data;
  3832. };
  3833. /*
  3834. * Ethernet command ID for slow path elements
  3835. */
  3836. enum eth_spqe_cmd_id {
  3837. RAMROD_CMD_ID_ETH_UNUSED,
  3838. RAMROD_CMD_ID_ETH_CLIENT_SETUP,
  3839. RAMROD_CMD_ID_ETH_HALT,
  3840. RAMROD_CMD_ID_ETH_FORWARD_SETUP,
  3841. RAMROD_CMD_ID_ETH_TX_QUEUE_SETUP,
  3842. RAMROD_CMD_ID_ETH_CLIENT_UPDATE,
  3843. RAMROD_CMD_ID_ETH_EMPTY,
  3844. RAMROD_CMD_ID_ETH_TERMINATE,
  3845. RAMROD_CMD_ID_ETH_TPA_UPDATE,
  3846. RAMROD_CMD_ID_ETH_CLASSIFICATION_RULES,
  3847. RAMROD_CMD_ID_ETH_FILTER_RULES,
  3848. RAMROD_CMD_ID_ETH_MULTICAST_RULES,
  3849. RAMROD_CMD_ID_ETH_RSS_UPDATE,
  3850. RAMROD_CMD_ID_ETH_SET_MAC,
  3851. MAX_ETH_SPQE_CMD_ID
  3852. };
  3853. /*
  3854. * eth tpa update command
  3855. */
  3856. enum eth_tpa_update_command {
  3857. TPA_UPDATE_NONE_COMMAND,
  3858. TPA_UPDATE_ENABLE_COMMAND,
  3859. TPA_UPDATE_DISABLE_COMMAND,
  3860. MAX_ETH_TPA_UPDATE_COMMAND
  3861. };
  3862. /* In case of LSO over IPv4 tunnel, whether to increment
  3863. * IP ID on external IP header or internal IP header
  3864. */
  3865. enum eth_tunnel_lso_inc_ip_id {
  3866. EXT_HEADER,
  3867. INT_HEADER,
  3868. MAX_ETH_TUNNEL_LSO_INC_IP_ID
  3869. };
  3870. /* In case tunnel exist and L4 checksum offload,
  3871. * the pseudo checksum location, on packet or on BD.
  3872. */
  3873. enum eth_tunnel_non_lso_csum_location {
  3874. CSUM_ON_PKT,
  3875. CSUM_ON_BD,
  3876. MAX_ETH_TUNNEL_NON_LSO_CSUM_LOCATION
  3877. };
  3878. enum eth_tunn_type {
  3879. TUNN_TYPE_NONE,
  3880. TUNN_TYPE_VXLAN,
  3881. TUNN_TYPE_L2_GRE,
  3882. TUNN_TYPE_IPV4_GRE,
  3883. TUNN_TYPE_IPV6_GRE,
  3884. TUNN_TYPE_L2_GENEVE,
  3885. TUNN_TYPE_IPV4_GENEVE,
  3886. TUNN_TYPE_IPV6_GENEVE,
  3887. MAX_ETH_TUNN_TYPE
  3888. };
  3889. /*
  3890. * Tx regular BD structure
  3891. */
  3892. struct eth_tx_bd {
  3893. __le32 addr_lo;
  3894. __le32 addr_hi;
  3895. __le16 total_pkt_bytes;
  3896. __le16 nbytes;
  3897. u8 reserved[4];
  3898. };
  3899. /*
  3900. * structure for easy accessibility to assembler
  3901. */
  3902. struct eth_tx_bd_flags {
  3903. u8 as_bitfield;
  3904. #define ETH_TX_BD_FLAGS_IP_CSUM (0x1<<0)
  3905. #define ETH_TX_BD_FLAGS_IP_CSUM_SHIFT 0
  3906. #define ETH_TX_BD_FLAGS_L4_CSUM (0x1<<1)
  3907. #define ETH_TX_BD_FLAGS_L4_CSUM_SHIFT 1
  3908. #define ETH_TX_BD_FLAGS_VLAN_MODE (0x3<<2)
  3909. #define ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT 2
  3910. #define ETH_TX_BD_FLAGS_START_BD (0x1<<4)
  3911. #define ETH_TX_BD_FLAGS_START_BD_SHIFT 4
  3912. #define ETH_TX_BD_FLAGS_IS_UDP (0x1<<5)
  3913. #define ETH_TX_BD_FLAGS_IS_UDP_SHIFT 5
  3914. #define ETH_TX_BD_FLAGS_SW_LSO (0x1<<6)
  3915. #define ETH_TX_BD_FLAGS_SW_LSO_SHIFT 6
  3916. #define ETH_TX_BD_FLAGS_IPV6 (0x1<<7)
  3917. #define ETH_TX_BD_FLAGS_IPV6_SHIFT 7
  3918. };
  3919. /*
  3920. * The eth Tx Buffer Descriptor
  3921. */
  3922. struct eth_tx_start_bd {
  3923. __le32 addr_lo;
  3924. __le32 addr_hi;
  3925. __le16 nbd;
  3926. __le16 nbytes;
  3927. __le16 vlan_or_ethertype;
  3928. struct eth_tx_bd_flags bd_flags;
  3929. u8 general_data;
  3930. #define ETH_TX_START_BD_HDR_NBDS (0x7<<0)
  3931. #define ETH_TX_START_BD_HDR_NBDS_SHIFT 0
  3932. #define ETH_TX_START_BD_NO_ADDED_TAGS (0x1<<3)
  3933. #define ETH_TX_START_BD_NO_ADDED_TAGS_SHIFT 3
  3934. #define ETH_TX_START_BD_FORCE_VLAN_MODE (0x1<<4)
  3935. #define ETH_TX_START_BD_FORCE_VLAN_MODE_SHIFT 4
  3936. #define ETH_TX_START_BD_PARSE_NBDS (0x3<<5)
  3937. #define ETH_TX_START_BD_PARSE_NBDS_SHIFT 5
  3938. #define ETH_TX_START_BD_TUNNEL_EXIST (0x1<<7)
  3939. #define ETH_TX_START_BD_TUNNEL_EXIST_SHIFT 7
  3940. };
  3941. /*
  3942. * Tx parsing BD structure for ETH E1/E1h
  3943. */
  3944. struct eth_tx_parse_bd_e1x {
  3945. __le16 global_data;
  3946. #define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W (0xF<<0)
  3947. #define ETH_TX_PARSE_BD_E1X_IP_HDR_START_OFFSET_W_SHIFT 0
  3948. #define ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE (0x3<<4)
  3949. #define ETH_TX_PARSE_BD_E1X_ETH_ADDR_TYPE_SHIFT 4
  3950. #define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN (0x1<<6)
  3951. #define ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN_SHIFT 6
  3952. #define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN (0x1<<7)
  3953. #define ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT 7
  3954. #define ETH_TX_PARSE_BD_E1X_NS_FLG (0x1<<8)
  3955. #define ETH_TX_PARSE_BD_E1X_NS_FLG_SHIFT 8
  3956. #define ETH_TX_PARSE_BD_E1X_RESERVED0 (0x7F<<9)
  3957. #define ETH_TX_PARSE_BD_E1X_RESERVED0_SHIFT 9
  3958. u8 tcp_flags;
  3959. #define ETH_TX_PARSE_BD_E1X_FIN_FLG (0x1<<0)
  3960. #define ETH_TX_PARSE_BD_E1X_FIN_FLG_SHIFT 0
  3961. #define ETH_TX_PARSE_BD_E1X_SYN_FLG (0x1<<1)
  3962. #define ETH_TX_PARSE_BD_E1X_SYN_FLG_SHIFT 1
  3963. #define ETH_TX_PARSE_BD_E1X_RST_FLG (0x1<<2)
  3964. #define ETH_TX_PARSE_BD_E1X_RST_FLG_SHIFT 2
  3965. #define ETH_TX_PARSE_BD_E1X_PSH_FLG (0x1<<3)
  3966. #define ETH_TX_PARSE_BD_E1X_PSH_FLG_SHIFT 3
  3967. #define ETH_TX_PARSE_BD_E1X_ACK_FLG (0x1<<4)
  3968. #define ETH_TX_PARSE_BD_E1X_ACK_FLG_SHIFT 4
  3969. #define ETH_TX_PARSE_BD_E1X_URG_FLG (0x1<<5)
  3970. #define ETH_TX_PARSE_BD_E1X_URG_FLG_SHIFT 5
  3971. #define ETH_TX_PARSE_BD_E1X_ECE_FLG (0x1<<6)
  3972. #define ETH_TX_PARSE_BD_E1X_ECE_FLG_SHIFT 6
  3973. #define ETH_TX_PARSE_BD_E1X_CWR_FLG (0x1<<7)
  3974. #define ETH_TX_PARSE_BD_E1X_CWR_FLG_SHIFT 7
  3975. u8 ip_hlen_w;
  3976. __le16 total_hlen_w;
  3977. __le16 tcp_pseudo_csum;
  3978. __le16 lso_mss;
  3979. __le16 ip_id;
  3980. __le32 tcp_send_seq;
  3981. };
  3982. /*
  3983. * Tx parsing BD structure for ETH E2
  3984. */
  3985. struct eth_tx_parse_bd_e2 {
  3986. union eth_mac_addr_or_tunnel_data data;
  3987. __le32 parsing_data;
  3988. #define ETH_TX_PARSE_BD_E2_L4_HDR_START_OFFSET_W (0x7FF<<0)
  3989. #define ETH_TX_PARSE_BD_E2_L4_HDR_START_OFFSET_W_SHIFT 0
  3990. #define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW (0xF<<11)
  3991. #define ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT 11
  3992. #define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR (0x1<<15)
  3993. #define ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR_SHIFT 15
  3994. #define ETH_TX_PARSE_BD_E2_LSO_MSS (0x3FFF<<16)
  3995. #define ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT 16
  3996. #define ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE (0x3<<30)
  3997. #define ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE_SHIFT 30
  3998. };
  3999. /*
  4000. * Tx 2nd parsing BD structure for ETH packet
  4001. */
  4002. struct eth_tx_parse_2nd_bd {
  4003. __le16 global_data;
  4004. #define ETH_TX_PARSE_2ND_BD_IP_HDR_START_OUTER_W (0xF<<0)
  4005. #define ETH_TX_PARSE_2ND_BD_IP_HDR_START_OUTER_W_SHIFT 0
  4006. #define ETH_TX_PARSE_2ND_BD_RESERVED0 (0x1<<4)
  4007. #define ETH_TX_PARSE_2ND_BD_RESERVED0_SHIFT 4
  4008. #define ETH_TX_PARSE_2ND_BD_LLC_SNAP_EN (0x1<<5)
  4009. #define ETH_TX_PARSE_2ND_BD_LLC_SNAP_EN_SHIFT 5
  4010. #define ETH_TX_PARSE_2ND_BD_NS_FLG (0x1<<6)
  4011. #define ETH_TX_PARSE_2ND_BD_NS_FLG_SHIFT 6
  4012. #define ETH_TX_PARSE_2ND_BD_TUNNEL_UDP_EXIST (0x1<<7)
  4013. #define ETH_TX_PARSE_2ND_BD_TUNNEL_UDP_EXIST_SHIFT 7
  4014. #define ETH_TX_PARSE_2ND_BD_IP_HDR_LEN_OUTER_W (0x1F<<8)
  4015. #define ETH_TX_PARSE_2ND_BD_IP_HDR_LEN_OUTER_W_SHIFT 8
  4016. #define ETH_TX_PARSE_2ND_BD_RESERVED1 (0x7<<13)
  4017. #define ETH_TX_PARSE_2ND_BD_RESERVED1_SHIFT 13
  4018. u8 bd_type;
  4019. #define ETH_TX_PARSE_2ND_BD_TYPE (0xF<<0)
  4020. #define ETH_TX_PARSE_2ND_BD_TYPE_SHIFT 0
  4021. #define ETH_TX_PARSE_2ND_BD_RESERVED2 (0xF<<4)
  4022. #define ETH_TX_PARSE_2ND_BD_RESERVED2_SHIFT 4
  4023. u8 reserved3;
  4024. u8 tcp_flags;
  4025. #define ETH_TX_PARSE_2ND_BD_FIN_FLG (0x1<<0)
  4026. #define ETH_TX_PARSE_2ND_BD_FIN_FLG_SHIFT 0
  4027. #define ETH_TX_PARSE_2ND_BD_SYN_FLG (0x1<<1)
  4028. #define ETH_TX_PARSE_2ND_BD_SYN_FLG_SHIFT 1
  4029. #define ETH_TX_PARSE_2ND_BD_RST_FLG (0x1<<2)
  4030. #define ETH_TX_PARSE_2ND_BD_RST_FLG_SHIFT 2
  4031. #define ETH_TX_PARSE_2ND_BD_PSH_FLG (0x1<<3)
  4032. #define ETH_TX_PARSE_2ND_BD_PSH_FLG_SHIFT 3
  4033. #define ETH_TX_PARSE_2ND_BD_ACK_FLG (0x1<<4)
  4034. #define ETH_TX_PARSE_2ND_BD_ACK_FLG_SHIFT 4
  4035. #define ETH_TX_PARSE_2ND_BD_URG_FLG (0x1<<5)
  4036. #define ETH_TX_PARSE_2ND_BD_URG_FLG_SHIFT 5
  4037. #define ETH_TX_PARSE_2ND_BD_ECE_FLG (0x1<<6)
  4038. #define ETH_TX_PARSE_2ND_BD_ECE_FLG_SHIFT 6
  4039. #define ETH_TX_PARSE_2ND_BD_CWR_FLG (0x1<<7)
  4040. #define ETH_TX_PARSE_2ND_BD_CWR_FLG_SHIFT 7
  4041. u8 reserved4;
  4042. u8 tunnel_udp_hdr_start_w;
  4043. u8 fw_ip_hdr_to_payload_w;
  4044. __le16 fw_ip_csum_wo_len_flags_frag;
  4045. __le16 hw_ip_id;
  4046. __le32 tcp_send_seq;
  4047. };
  4048. /* The last BD in the BD memory will hold a pointer to the next BD memory */
  4049. struct eth_tx_next_bd {
  4050. __le32 addr_lo;
  4051. __le32 addr_hi;
  4052. u8 reserved[8];
  4053. };
  4054. /*
  4055. * union for 4 Bd types
  4056. */
  4057. union eth_tx_bd_types {
  4058. struct eth_tx_start_bd start_bd;
  4059. struct eth_tx_bd reg_bd;
  4060. struct eth_tx_parse_bd_e1x parse_bd_e1x;
  4061. struct eth_tx_parse_bd_e2 parse_bd_e2;
  4062. struct eth_tx_parse_2nd_bd parse_2nd_bd;
  4063. struct eth_tx_next_bd next_bd;
  4064. };
  4065. /*
  4066. * array of 13 bds as appears in the eth xstorm context
  4067. */
  4068. struct eth_tx_bds_array {
  4069. union eth_tx_bd_types bds[13];
  4070. };
  4071. /*
  4072. * VLAN mode on TX BDs
  4073. */
  4074. enum eth_tx_vlan_type {
  4075. X_ETH_NO_VLAN,
  4076. X_ETH_OUTBAND_VLAN,
  4077. X_ETH_INBAND_VLAN,
  4078. X_ETH_FW_ADDED_VLAN,
  4079. MAX_ETH_TX_VLAN_TYPE
  4080. };
  4081. /*
  4082. * Ethernet VLAN filtering mode in E1x
  4083. */
  4084. enum eth_vlan_filter_mode {
  4085. ETH_VLAN_FILTER_ANY_VLAN,
  4086. ETH_VLAN_FILTER_SPECIFIC_VLAN,
  4087. ETH_VLAN_FILTER_CLASSIFY,
  4088. MAX_ETH_VLAN_FILTER_MODE
  4089. };
  4090. /*
  4091. * MAC filtering configuration command header
  4092. */
  4093. struct mac_configuration_hdr {
  4094. u8 length;
  4095. u8 offset;
  4096. __le16 client_id;
  4097. __le32 echo;
  4098. };
  4099. /*
  4100. * MAC address in list for ramrod
  4101. */
  4102. struct mac_configuration_entry {
  4103. __le16 lsb_mac_addr;
  4104. __le16 middle_mac_addr;
  4105. __le16 msb_mac_addr;
  4106. __le16 vlan_id;
  4107. u8 pf_id;
  4108. u8 flags;
  4109. #define MAC_CONFIGURATION_ENTRY_ACTION_TYPE (0x1<<0)
  4110. #define MAC_CONFIGURATION_ENTRY_ACTION_TYPE_SHIFT 0
  4111. #define MAC_CONFIGURATION_ENTRY_RDMA_MAC (0x1<<1)
  4112. #define MAC_CONFIGURATION_ENTRY_RDMA_MAC_SHIFT 1
  4113. #define MAC_CONFIGURATION_ENTRY_VLAN_FILTERING_MODE (0x3<<2)
  4114. #define MAC_CONFIGURATION_ENTRY_VLAN_FILTERING_MODE_SHIFT 2
  4115. #define MAC_CONFIGURATION_ENTRY_OVERRIDE_VLAN_REMOVAL (0x1<<4)
  4116. #define MAC_CONFIGURATION_ENTRY_OVERRIDE_VLAN_REMOVAL_SHIFT 4
  4117. #define MAC_CONFIGURATION_ENTRY_BROADCAST (0x1<<5)
  4118. #define MAC_CONFIGURATION_ENTRY_BROADCAST_SHIFT 5
  4119. #define MAC_CONFIGURATION_ENTRY_RESERVED1 (0x3<<6)
  4120. #define MAC_CONFIGURATION_ENTRY_RESERVED1_SHIFT 6
  4121. __le16 reserved0;
  4122. __le32 clients_bit_vector;
  4123. };
  4124. /*
  4125. * MAC filtering configuration command
  4126. */
  4127. struct mac_configuration_cmd {
  4128. struct mac_configuration_hdr hdr;
  4129. struct mac_configuration_entry config_table[64];
  4130. };
  4131. /*
  4132. * Set-MAC command type (in E1x)
  4133. */
  4134. enum set_mac_action_type {
  4135. T_ETH_MAC_COMMAND_INVALIDATE,
  4136. T_ETH_MAC_COMMAND_SET,
  4137. MAX_SET_MAC_ACTION_TYPE
  4138. };
  4139. /*
  4140. * Ethernet TPA Modes
  4141. */
  4142. enum tpa_mode {
  4143. TPA_LRO,
  4144. TPA_GRO,
  4145. MAX_TPA_MODE};
  4146. /*
  4147. * tpa update ramrod data
  4148. */
  4149. struct tpa_update_ramrod_data {
  4150. u8 update_ipv4;
  4151. u8 update_ipv6;
  4152. u8 client_id;
  4153. u8 max_tpa_queues;
  4154. u8 max_sges_for_packet;
  4155. u8 complete_on_both_clients;
  4156. u8 dont_verify_rings_pause_thr_flg;
  4157. u8 tpa_mode;
  4158. __le16 sge_buff_size;
  4159. __le16 max_agg_size;
  4160. __le32 sge_page_base_lo;
  4161. __le32 sge_page_base_hi;
  4162. __le16 sge_pause_thr_low;
  4163. __le16 sge_pause_thr_high;
  4164. };
  4165. /*
  4166. * approximate-match multicast filtering for E1H per function in Tstorm
  4167. */
  4168. struct tstorm_eth_approximate_match_multicast_filtering {
  4169. u32 mcast_add_hash_bit_array[8];
  4170. };
  4171. /*
  4172. * Common configuration parameters per function in Tstorm
  4173. */
  4174. struct tstorm_eth_function_common_config {
  4175. __le16 config_flags;
  4176. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY (0x1<<0)
  4177. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY_SHIFT 0
  4178. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY (0x1<<1)
  4179. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY_SHIFT 1
  4180. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY (0x1<<2)
  4181. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY_SHIFT 2
  4182. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY (0x1<<3)
  4183. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY_SHIFT 3
  4184. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE (0x7<<4)
  4185. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT 4
  4186. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_FILTERING_ENABLE (0x1<<7)
  4187. #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_FILTERING_ENABLE_SHIFT 7
  4188. #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0 (0xFF<<8)
  4189. #define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0_SHIFT 8
  4190. u8 rss_result_mask;
  4191. u8 reserved1;
  4192. __le16 vlan_id[2];
  4193. };
  4194. /*
  4195. * MAC filtering configuration parameters per port in Tstorm
  4196. */
  4197. struct tstorm_eth_mac_filter_config {
  4198. u32 ucast_drop_all;
  4199. u32 ucast_accept_all;
  4200. u32 mcast_drop_all;
  4201. u32 mcast_accept_all;
  4202. u32 bcast_accept_all;
  4203. u32 vlan_filter[2];
  4204. u32 unmatched_unicast;
  4205. };
  4206. /*
  4207. * tx only queue init ramrod data
  4208. */
  4209. struct tx_queue_init_ramrod_data {
  4210. struct client_init_general_data general;
  4211. struct client_init_tx_data tx;
  4212. };
  4213. /*
  4214. * Three RX producers for ETH
  4215. */
  4216. struct ustorm_eth_rx_producers {
  4217. #if defined(__BIG_ENDIAN)
  4218. u16 bd_prod;
  4219. u16 cqe_prod;
  4220. #elif defined(__LITTLE_ENDIAN)
  4221. u16 cqe_prod;
  4222. u16 bd_prod;
  4223. #endif
  4224. #if defined(__BIG_ENDIAN)
  4225. u16 reserved;
  4226. u16 sge_prod;
  4227. #elif defined(__LITTLE_ENDIAN)
  4228. u16 sge_prod;
  4229. u16 reserved;
  4230. #endif
  4231. };
  4232. /*
  4233. * FCoE RX statistics parameters section#0
  4234. */
  4235. struct fcoe_rx_stat_params_section0 {
  4236. __le32 fcoe_rx_pkt_cnt;
  4237. __le32 fcoe_rx_byte_cnt;
  4238. };
  4239. /*
  4240. * FCoE RX statistics parameters section#1
  4241. */
  4242. struct fcoe_rx_stat_params_section1 {
  4243. __le32 fcoe_ver_cnt;
  4244. __le32 fcoe_rx_drop_pkt_cnt;
  4245. };
  4246. /*
  4247. * FCoE RX statistics parameters section#2
  4248. */
  4249. struct fcoe_rx_stat_params_section2 {
  4250. __le32 fc_crc_cnt;
  4251. __le32 eofa_del_cnt;
  4252. __le32 miss_frame_cnt;
  4253. __le32 seq_timeout_cnt;
  4254. __le32 drop_seq_cnt;
  4255. __le32 fcoe_rx_drop_pkt_cnt;
  4256. __le32 fcp_rx_pkt_cnt;
  4257. __le32 reserved0;
  4258. };
  4259. /*
  4260. * FCoE TX statistics parameters
  4261. */
  4262. struct fcoe_tx_stat_params {
  4263. __le32 fcoe_tx_pkt_cnt;
  4264. __le32 fcoe_tx_byte_cnt;
  4265. __le32 fcp_tx_pkt_cnt;
  4266. __le32 reserved0;
  4267. };
  4268. /*
  4269. * FCoE statistics parameters
  4270. */
  4271. struct fcoe_statistics_params {
  4272. struct fcoe_tx_stat_params tx_stat;
  4273. struct fcoe_rx_stat_params_section0 rx_stat0;
  4274. struct fcoe_rx_stat_params_section1 rx_stat1;
  4275. struct fcoe_rx_stat_params_section2 rx_stat2;
  4276. };
  4277. /*
  4278. * The data afex vif list ramrod need
  4279. */
  4280. struct afex_vif_list_ramrod_data {
  4281. u8 afex_vif_list_command;
  4282. u8 func_bit_map;
  4283. __le16 vif_list_index;
  4284. u8 func_to_clear;
  4285. u8 echo;
  4286. __le16 reserved1;
  4287. };
  4288. struct c2s_pri_trans_table_entry {
  4289. u8 val[MAX_VLAN_PRIORITIES];
  4290. };
  4291. /*
  4292. * cfc delete event data
  4293. */
  4294. struct cfc_del_event_data {
  4295. __le32 cid;
  4296. __le32 reserved0;
  4297. __le32 reserved1;
  4298. };
  4299. /*
  4300. * per-port SAFC demo variables
  4301. */
  4302. struct cmng_flags_per_port {
  4303. u32 cmng_enables;
  4304. #define CMNG_FLAGS_PER_PORT_FAIRNESS_VN (0x1<<0)
  4305. #define CMNG_FLAGS_PER_PORT_FAIRNESS_VN_SHIFT 0
  4306. #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN (0x1<<1)
  4307. #define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN_SHIFT 1
  4308. #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS (0x1<<2)
  4309. #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_SHIFT 2
  4310. #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_MODE (0x1<<3)
  4311. #define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_MODE_SHIFT 3
  4312. #define __CMNG_FLAGS_PER_PORT_RESERVED0 (0xFFFFFFF<<4)
  4313. #define __CMNG_FLAGS_PER_PORT_RESERVED0_SHIFT 4
  4314. u32 __reserved1;
  4315. };
  4316. /*
  4317. * per-port rate shaping variables
  4318. */
  4319. struct rate_shaping_vars_per_port {
  4320. u32 rs_periodic_timeout;
  4321. u32 rs_threshold;
  4322. };
  4323. /*
  4324. * per-port fairness variables
  4325. */
  4326. struct fairness_vars_per_port {
  4327. u32 upper_bound;
  4328. u32 fair_threshold;
  4329. u32 fairness_timeout;
  4330. u32 reserved0;
  4331. };
  4332. /*
  4333. * per-port SAFC variables
  4334. */
  4335. struct safc_struct_per_port {
  4336. #if defined(__BIG_ENDIAN)
  4337. u16 __reserved1;
  4338. u8 __reserved0;
  4339. u8 safc_timeout_usec;
  4340. #elif defined(__LITTLE_ENDIAN)
  4341. u8 safc_timeout_usec;
  4342. u8 __reserved0;
  4343. u16 __reserved1;
  4344. #endif
  4345. u8 cos_to_traffic_types[MAX_COS_NUMBER];
  4346. u16 cos_to_pause_mask[NUM_OF_SAFC_BITS];
  4347. };
  4348. /*
  4349. * Per-port congestion management variables
  4350. */
  4351. struct cmng_struct_per_port {
  4352. struct rate_shaping_vars_per_port rs_vars;
  4353. struct fairness_vars_per_port fair_vars;
  4354. struct safc_struct_per_port safc_vars;
  4355. struct cmng_flags_per_port flags;
  4356. };
  4357. /*
  4358. * a single rate shaping counter. can be used as protocol or vnic counter
  4359. */
  4360. struct rate_shaping_counter {
  4361. u32 quota;
  4362. #if defined(__BIG_ENDIAN)
  4363. u16 __reserved0;
  4364. u16 rate;
  4365. #elif defined(__LITTLE_ENDIAN)
  4366. u16 rate;
  4367. u16 __reserved0;
  4368. #endif
  4369. };
  4370. /*
  4371. * per-vnic rate shaping variables
  4372. */
  4373. struct rate_shaping_vars_per_vn {
  4374. struct rate_shaping_counter vn_counter;
  4375. };
  4376. /*
  4377. * per-vnic fairness variables
  4378. */
  4379. struct fairness_vars_per_vn {
  4380. u32 cos_credit_delta[MAX_COS_NUMBER];
  4381. u32 vn_credit_delta;
  4382. u32 __reserved0;
  4383. };
  4384. /*
  4385. * cmng port init state
  4386. */
  4387. struct cmng_vnic {
  4388. struct rate_shaping_vars_per_vn vnic_max_rate[4];
  4389. struct fairness_vars_per_vn vnic_min_rate[4];
  4390. };
  4391. /*
  4392. * cmng port init state
  4393. */
  4394. struct cmng_init {
  4395. struct cmng_struct_per_port port;
  4396. struct cmng_vnic vnic;
  4397. };
  4398. /*
  4399. * driver parameters for congestion management init, all rates are in Mbps
  4400. */
  4401. struct cmng_init_input {
  4402. u32 port_rate;
  4403. u16 vnic_min_rate[4];
  4404. u16 vnic_max_rate[4];
  4405. u16 cos_min_rate[MAX_COS_NUMBER];
  4406. u16 cos_to_pause_mask[MAX_COS_NUMBER];
  4407. struct cmng_flags_per_port flags;
  4408. };
  4409. /*
  4410. * Protocol-common command ID for slow path elements
  4411. */
  4412. enum common_spqe_cmd_id {
  4413. RAMROD_CMD_ID_COMMON_UNUSED,
  4414. RAMROD_CMD_ID_COMMON_FUNCTION_START,
  4415. RAMROD_CMD_ID_COMMON_FUNCTION_STOP,
  4416. RAMROD_CMD_ID_COMMON_FUNCTION_UPDATE,
  4417. RAMROD_CMD_ID_COMMON_CFC_DEL,
  4418. RAMROD_CMD_ID_COMMON_CFC_DEL_WB,
  4419. RAMROD_CMD_ID_COMMON_STAT_QUERY,
  4420. RAMROD_CMD_ID_COMMON_STOP_TRAFFIC,
  4421. RAMROD_CMD_ID_COMMON_START_TRAFFIC,
  4422. RAMROD_CMD_ID_COMMON_AFEX_VIF_LISTS,
  4423. RAMROD_CMD_ID_COMMON_SET_TIMESYNC,
  4424. MAX_COMMON_SPQE_CMD_ID
  4425. };
  4426. /*
  4427. * Per-protocol connection types
  4428. */
  4429. enum connection_type {
  4430. ETH_CONNECTION_TYPE,
  4431. TOE_CONNECTION_TYPE,
  4432. RDMA_CONNECTION_TYPE,
  4433. ISCSI_CONNECTION_TYPE,
  4434. FCOE_CONNECTION_TYPE,
  4435. RESERVED_CONNECTION_TYPE_0,
  4436. RESERVED_CONNECTION_TYPE_1,
  4437. RESERVED_CONNECTION_TYPE_2,
  4438. NONE_CONNECTION_TYPE,
  4439. MAX_CONNECTION_TYPE
  4440. };
  4441. /*
  4442. * Cos modes
  4443. */
  4444. enum cos_mode {
  4445. OVERRIDE_COS,
  4446. STATIC_COS,
  4447. FW_WRR,
  4448. MAX_COS_MODE
  4449. };
  4450. /*
  4451. * Dynamic HC counters set by the driver
  4452. */
  4453. struct hc_dynamic_drv_counter {
  4454. u32 val[HC_SB_MAX_DYNAMIC_INDICES];
  4455. };
  4456. /*
  4457. * zone A per-queue data
  4458. */
  4459. struct cstorm_queue_zone_data {
  4460. struct hc_dynamic_drv_counter hc_dyn_drv_cnt;
  4461. struct regpair reserved[2];
  4462. };
  4463. /*
  4464. * Vf-PF channel data in cstorm ram (non-triggered zone)
  4465. */
  4466. struct vf_pf_channel_zone_data {
  4467. u32 msg_addr_lo;
  4468. u32 msg_addr_hi;
  4469. };
  4470. /*
  4471. * zone for VF non-triggered data
  4472. */
  4473. struct non_trigger_vf_zone {
  4474. struct vf_pf_channel_zone_data vf_pf_channel;
  4475. };
  4476. /*
  4477. * Vf-PF channel trigger zone in cstorm ram
  4478. */
  4479. struct vf_pf_channel_zone_trigger {
  4480. u8 addr_valid;
  4481. };
  4482. /*
  4483. * zone that triggers the in-bound interrupt
  4484. */
  4485. struct trigger_vf_zone {
  4486. struct vf_pf_channel_zone_trigger vf_pf_channel;
  4487. u8 reserved0;
  4488. u16 reserved1;
  4489. u32 reserved2;
  4490. };
  4491. /*
  4492. * zone B per-VF data
  4493. */
  4494. struct cstorm_vf_zone_data {
  4495. struct non_trigger_vf_zone non_trigger;
  4496. struct trigger_vf_zone trigger;
  4497. };
  4498. /*
  4499. * Dynamic host coalescing init parameters, per state machine
  4500. */
  4501. struct dynamic_hc_sm_config {
  4502. u32 threshold[3];
  4503. u8 shift_per_protocol[HC_SB_MAX_DYNAMIC_INDICES];
  4504. u8 hc_timeout0[HC_SB_MAX_DYNAMIC_INDICES];
  4505. u8 hc_timeout1[HC_SB_MAX_DYNAMIC_INDICES];
  4506. u8 hc_timeout2[HC_SB_MAX_DYNAMIC_INDICES];
  4507. u8 hc_timeout3[HC_SB_MAX_DYNAMIC_INDICES];
  4508. };
  4509. /*
  4510. * Dynamic host coalescing init parameters
  4511. */
  4512. struct dynamic_hc_config {
  4513. struct dynamic_hc_sm_config sm_config[HC_SB_MAX_SM];
  4514. };
  4515. struct e2_integ_data {
  4516. #if defined(__BIG_ENDIAN)
  4517. u8 flags;
  4518. #define E2_INTEG_DATA_TESTING_EN (0x1<<0)
  4519. #define E2_INTEG_DATA_TESTING_EN_SHIFT 0
  4520. #define E2_INTEG_DATA_LB_TX (0x1<<1)
  4521. #define E2_INTEG_DATA_LB_TX_SHIFT 1
  4522. #define E2_INTEG_DATA_COS_TX (0x1<<2)
  4523. #define E2_INTEG_DATA_COS_TX_SHIFT 2
  4524. #define E2_INTEG_DATA_OPPORTUNISTICQM (0x1<<3)
  4525. #define E2_INTEG_DATA_OPPORTUNISTICQM_SHIFT 3
  4526. #define E2_INTEG_DATA_DPMTESTRELEASEDQ (0x1<<4)
  4527. #define E2_INTEG_DATA_DPMTESTRELEASEDQ_SHIFT 4
  4528. #define E2_INTEG_DATA_RESERVED (0x7<<5)
  4529. #define E2_INTEG_DATA_RESERVED_SHIFT 5
  4530. u8 cos;
  4531. u8 voq;
  4532. u8 pbf_queue;
  4533. #elif defined(__LITTLE_ENDIAN)
  4534. u8 pbf_queue;
  4535. u8 voq;
  4536. u8 cos;
  4537. u8 flags;
  4538. #define E2_INTEG_DATA_TESTING_EN (0x1<<0)
  4539. #define E2_INTEG_DATA_TESTING_EN_SHIFT 0
  4540. #define E2_INTEG_DATA_LB_TX (0x1<<1)
  4541. #define E2_INTEG_DATA_LB_TX_SHIFT 1
  4542. #define E2_INTEG_DATA_COS_TX (0x1<<2)
  4543. #define E2_INTEG_DATA_COS_TX_SHIFT 2
  4544. #define E2_INTEG_DATA_OPPORTUNISTICQM (0x1<<3)
  4545. #define E2_INTEG_DATA_OPPORTUNISTICQM_SHIFT 3
  4546. #define E2_INTEG_DATA_DPMTESTRELEASEDQ (0x1<<4)
  4547. #define E2_INTEG_DATA_DPMTESTRELEASEDQ_SHIFT 4
  4548. #define E2_INTEG_DATA_RESERVED (0x7<<5)
  4549. #define E2_INTEG_DATA_RESERVED_SHIFT 5
  4550. #endif
  4551. #if defined(__BIG_ENDIAN)
  4552. u16 reserved3;
  4553. u8 reserved2;
  4554. u8 ramEn;
  4555. #elif defined(__LITTLE_ENDIAN)
  4556. u8 ramEn;
  4557. u8 reserved2;
  4558. u16 reserved3;
  4559. #endif
  4560. };
  4561. /*
  4562. * set mac event data
  4563. */
  4564. struct eth_event_data {
  4565. __le32 echo;
  4566. __le32 reserved0;
  4567. __le32 reserved1;
  4568. };
  4569. /*
  4570. * pf-vf event data
  4571. */
  4572. struct vf_pf_event_data {
  4573. u8 vf_id;
  4574. u8 reserved0;
  4575. __le16 reserved1;
  4576. __le32 msg_addr_lo;
  4577. __le32 msg_addr_hi;
  4578. };
  4579. /*
  4580. * VF FLR event data
  4581. */
  4582. struct vf_flr_event_data {
  4583. u8 vf_id;
  4584. u8 reserved0;
  4585. __le16 reserved1;
  4586. __le32 reserved2;
  4587. __le32 reserved3;
  4588. };
  4589. /*
  4590. * malicious VF event data
  4591. */
  4592. struct malicious_vf_event_data {
  4593. u8 vf_id;
  4594. u8 err_id;
  4595. __le16 reserved1;
  4596. __le32 reserved2;
  4597. __le32 reserved3;
  4598. };
  4599. /*
  4600. * vif list event data
  4601. */
  4602. struct vif_list_event_data {
  4603. u8 func_bit_map;
  4604. u8 echo;
  4605. __le16 reserved0;
  4606. __le32 reserved1;
  4607. __le32 reserved2;
  4608. };
  4609. /* function update event data */
  4610. struct function_update_event_data {
  4611. u8 echo;
  4612. u8 reserved;
  4613. __le16 reserved0;
  4614. __le32 reserved1;
  4615. __le32 reserved2;
  4616. };
  4617. /* union for all event ring message types */
  4618. union event_data {
  4619. struct vf_pf_event_data vf_pf_event;
  4620. struct eth_event_data eth_event;
  4621. struct cfc_del_event_data cfc_del_event;
  4622. struct vf_flr_event_data vf_flr_event;
  4623. struct malicious_vf_event_data malicious_vf_event;
  4624. struct vif_list_event_data vif_list_event;
  4625. struct function_update_event_data function_update_event;
  4626. };
  4627. /*
  4628. * per PF event ring data
  4629. */
  4630. struct event_ring_data {
  4631. struct regpair_native base_addr;
  4632. #if defined(__BIG_ENDIAN)
  4633. u8 index_id;
  4634. u8 sb_id;
  4635. u16 producer;
  4636. #elif defined(__LITTLE_ENDIAN)
  4637. u16 producer;
  4638. u8 sb_id;
  4639. u8 index_id;
  4640. #endif
  4641. u32 reserved0;
  4642. };
  4643. /*
  4644. * event ring message element (each element is 128 bits)
  4645. */
  4646. struct event_ring_msg {
  4647. u8 opcode;
  4648. u8 error;
  4649. u16 reserved1;
  4650. union event_data data;
  4651. };
  4652. /*
  4653. * event ring next page element (128 bits)
  4654. */
  4655. struct event_ring_next {
  4656. struct regpair addr;
  4657. u32 reserved[2];
  4658. };
  4659. /*
  4660. * union for event ring element types (each element is 128 bits)
  4661. */
  4662. union event_ring_elem {
  4663. struct event_ring_msg message;
  4664. struct event_ring_next next_page;
  4665. };
  4666. /*
  4667. * Common event ring opcodes
  4668. */
  4669. enum event_ring_opcode {
  4670. EVENT_RING_OPCODE_VF_PF_CHANNEL,
  4671. EVENT_RING_OPCODE_FUNCTION_START,
  4672. EVENT_RING_OPCODE_FUNCTION_STOP,
  4673. EVENT_RING_OPCODE_CFC_DEL,
  4674. EVENT_RING_OPCODE_CFC_DEL_WB,
  4675. EVENT_RING_OPCODE_STAT_QUERY,
  4676. EVENT_RING_OPCODE_STOP_TRAFFIC,
  4677. EVENT_RING_OPCODE_START_TRAFFIC,
  4678. EVENT_RING_OPCODE_VF_FLR,
  4679. EVENT_RING_OPCODE_MALICIOUS_VF,
  4680. EVENT_RING_OPCODE_FORWARD_SETUP,
  4681. EVENT_RING_OPCODE_RSS_UPDATE_RULES,
  4682. EVENT_RING_OPCODE_FUNCTION_UPDATE,
  4683. EVENT_RING_OPCODE_AFEX_VIF_LISTS,
  4684. EVENT_RING_OPCODE_SET_MAC,
  4685. EVENT_RING_OPCODE_CLASSIFICATION_RULES,
  4686. EVENT_RING_OPCODE_FILTERS_RULES,
  4687. EVENT_RING_OPCODE_MULTICAST_RULES,
  4688. EVENT_RING_OPCODE_SET_TIMESYNC,
  4689. MAX_EVENT_RING_OPCODE
  4690. };
  4691. /*
  4692. * Modes for fairness algorithm
  4693. */
  4694. enum fairness_mode {
  4695. FAIRNESS_COS_WRR_MODE,
  4696. FAIRNESS_COS_ETS_MODE,
  4697. MAX_FAIRNESS_MODE
  4698. };
  4699. /*
  4700. * Priority and cos
  4701. */
  4702. struct priority_cos {
  4703. u8 priority;
  4704. u8 cos;
  4705. __le16 reserved1;
  4706. };
  4707. /*
  4708. * The data for flow control configuration
  4709. */
  4710. struct flow_control_configuration {
  4711. struct priority_cos traffic_type_to_priority_cos[MAX_TRAFFIC_TYPES];
  4712. u8 dcb_enabled;
  4713. u8 dcb_version;
  4714. u8 dont_add_pri_0_en;
  4715. u8 reserved1;
  4716. __le32 reserved2;
  4717. u8 dcb_outer_pri[MAX_TRAFFIC_TYPES];
  4718. };
  4719. /*
  4720. *
  4721. */
  4722. struct function_start_data {
  4723. u8 function_mode;
  4724. u8 allow_npar_tx_switching;
  4725. __le16 sd_vlan_tag;
  4726. __le16 vif_id;
  4727. u8 path_id;
  4728. u8 network_cos_mode;
  4729. u8 dmae_cmd_id;
  4730. u8 no_added_tags;
  4731. __le16 reserved0;
  4732. __le32 reserved1;
  4733. u8 inner_clss_vxlan;
  4734. u8 inner_clss_l2gre;
  4735. u8 inner_clss_l2geneve;
  4736. u8 inner_rss;
  4737. __le16 vxlan_dst_port;
  4738. __le16 geneve_dst_port;
  4739. u8 sd_accept_mf_clss_fail;
  4740. u8 sd_accept_mf_clss_fail_match_ethtype;
  4741. __le16 sd_accept_mf_clss_fail_ethtype;
  4742. __le16 sd_vlan_eth_type;
  4743. u8 sd_vlan_force_pri_flg;
  4744. u8 sd_vlan_force_pri_val;
  4745. u8 c2s_pri_tt_valid;
  4746. u8 c2s_pri_default;
  4747. u8 reserved2[6];
  4748. struct c2s_pri_trans_table_entry c2s_pri_trans_table;
  4749. };
  4750. struct function_update_data {
  4751. u8 vif_id_change_flg;
  4752. u8 afex_default_vlan_change_flg;
  4753. u8 allowed_priorities_change_flg;
  4754. u8 network_cos_mode_change_flg;
  4755. __le16 vif_id;
  4756. __le16 afex_default_vlan;
  4757. u8 allowed_priorities;
  4758. u8 network_cos_mode;
  4759. u8 lb_mode_en_change_flg;
  4760. u8 lb_mode_en;
  4761. u8 tx_switch_suspend_change_flg;
  4762. u8 tx_switch_suspend;
  4763. u8 echo;
  4764. u8 update_tunn_cfg_flg;
  4765. u8 inner_clss_vxlan;
  4766. u8 inner_clss_l2gre;
  4767. u8 inner_clss_l2geneve;
  4768. u8 inner_rss;
  4769. __le16 vxlan_dst_port;
  4770. __le16 geneve_dst_port;
  4771. u8 sd_vlan_force_pri_change_flg;
  4772. u8 sd_vlan_force_pri_flg;
  4773. u8 sd_vlan_force_pri_val;
  4774. u8 sd_vlan_tag_change_flg;
  4775. u8 sd_vlan_eth_type_change_flg;
  4776. u8 reserved1;
  4777. __le16 sd_vlan_tag;
  4778. __le16 sd_vlan_eth_type;
  4779. __le16 reserved0;
  4780. __le32 reserved2;
  4781. };
  4782. /*
  4783. * FW version stored in the Xstorm RAM
  4784. */
  4785. struct fw_version {
  4786. #if defined(__BIG_ENDIAN)
  4787. u8 engineering;
  4788. u8 revision;
  4789. u8 minor;
  4790. u8 major;
  4791. #elif defined(__LITTLE_ENDIAN)
  4792. u8 major;
  4793. u8 minor;
  4794. u8 revision;
  4795. u8 engineering;
  4796. #endif
  4797. u32 flags;
  4798. #define FW_VERSION_OPTIMIZED (0x1<<0)
  4799. #define FW_VERSION_OPTIMIZED_SHIFT 0
  4800. #define FW_VERSION_BIG_ENDIEN (0x1<<1)
  4801. #define FW_VERSION_BIG_ENDIEN_SHIFT 1
  4802. #define FW_VERSION_CHIP_VERSION (0x3<<2)
  4803. #define FW_VERSION_CHIP_VERSION_SHIFT 2
  4804. #define __FW_VERSION_RESERVED (0xFFFFFFF<<4)
  4805. #define __FW_VERSION_RESERVED_SHIFT 4
  4806. };
  4807. /*
  4808. * Dynamic Host-Coalescing - Driver(host) counters
  4809. */
  4810. struct hc_dynamic_sb_drv_counters {
  4811. u32 dynamic_hc_drv_counter[HC_SB_MAX_DYNAMIC_INDICES];
  4812. };
  4813. /*
  4814. * 2 bytes. configuration/state parameters for a single protocol index
  4815. */
  4816. struct hc_index_data {
  4817. #if defined(__BIG_ENDIAN)
  4818. u8 flags;
  4819. #define HC_INDEX_DATA_SM_ID (0x1<<0)
  4820. #define HC_INDEX_DATA_SM_ID_SHIFT 0
  4821. #define HC_INDEX_DATA_HC_ENABLED (0x1<<1)
  4822. #define HC_INDEX_DATA_HC_ENABLED_SHIFT 1
  4823. #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED (0x1<<2)
  4824. #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED_SHIFT 2
  4825. #define HC_INDEX_DATA_RESERVE (0x1F<<3)
  4826. #define HC_INDEX_DATA_RESERVE_SHIFT 3
  4827. u8 timeout;
  4828. #elif defined(__LITTLE_ENDIAN)
  4829. u8 timeout;
  4830. u8 flags;
  4831. #define HC_INDEX_DATA_SM_ID (0x1<<0)
  4832. #define HC_INDEX_DATA_SM_ID_SHIFT 0
  4833. #define HC_INDEX_DATA_HC_ENABLED (0x1<<1)
  4834. #define HC_INDEX_DATA_HC_ENABLED_SHIFT 1
  4835. #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED (0x1<<2)
  4836. #define HC_INDEX_DATA_DYNAMIC_HC_ENABLED_SHIFT 2
  4837. #define HC_INDEX_DATA_RESERVE (0x1F<<3)
  4838. #define HC_INDEX_DATA_RESERVE_SHIFT 3
  4839. #endif
  4840. };
  4841. /*
  4842. * HC state-machine
  4843. */
  4844. struct hc_status_block_sm {
  4845. #if defined(__BIG_ENDIAN)
  4846. u8 igu_seg_id;
  4847. u8 igu_sb_id;
  4848. u8 timer_value;
  4849. u8 __flags;
  4850. #elif defined(__LITTLE_ENDIAN)
  4851. u8 __flags;
  4852. u8 timer_value;
  4853. u8 igu_sb_id;
  4854. u8 igu_seg_id;
  4855. #endif
  4856. u32 time_to_expire;
  4857. };
  4858. /*
  4859. * hold PCI identification variables- used in various places in firmware
  4860. */
  4861. struct pci_entity {
  4862. #if defined(__BIG_ENDIAN)
  4863. u8 vf_valid;
  4864. u8 vf_id;
  4865. u8 vnic_id;
  4866. u8 pf_id;
  4867. #elif defined(__LITTLE_ENDIAN)
  4868. u8 pf_id;
  4869. u8 vnic_id;
  4870. u8 vf_id;
  4871. u8 vf_valid;
  4872. #endif
  4873. };
  4874. /*
  4875. * The fast-path status block meta-data, common to all chips
  4876. */
  4877. struct hc_sb_data {
  4878. struct regpair_native host_sb_addr;
  4879. struct hc_status_block_sm state_machine[HC_SB_MAX_SM];
  4880. struct pci_entity p_func;
  4881. #if defined(__BIG_ENDIAN)
  4882. u8 rsrv0;
  4883. u8 state;
  4884. u8 dhc_qzone_id;
  4885. u8 same_igu_sb_1b;
  4886. #elif defined(__LITTLE_ENDIAN)
  4887. u8 same_igu_sb_1b;
  4888. u8 dhc_qzone_id;
  4889. u8 state;
  4890. u8 rsrv0;
  4891. #endif
  4892. struct regpair_native rsrv1[2];
  4893. };
  4894. /*
  4895. * Segment types for host coaslescing
  4896. */
  4897. enum hc_segment {
  4898. HC_REGULAR_SEGMENT,
  4899. HC_DEFAULT_SEGMENT,
  4900. MAX_HC_SEGMENT
  4901. };
  4902. /*
  4903. * The fast-path status block meta-data
  4904. */
  4905. struct hc_sp_status_block_data {
  4906. struct regpair_native host_sb_addr;
  4907. #if defined(__BIG_ENDIAN)
  4908. u8 rsrv1;
  4909. u8 state;
  4910. u8 igu_seg_id;
  4911. u8 igu_sb_id;
  4912. #elif defined(__LITTLE_ENDIAN)
  4913. u8 igu_sb_id;
  4914. u8 igu_seg_id;
  4915. u8 state;
  4916. u8 rsrv1;
  4917. #endif
  4918. struct pci_entity p_func;
  4919. };
  4920. /*
  4921. * The fast-path status block meta-data
  4922. */
  4923. struct hc_status_block_data_e1x {
  4924. struct hc_index_data index_data[HC_SB_MAX_INDICES_E1X];
  4925. struct hc_sb_data common;
  4926. };
  4927. /*
  4928. * The fast-path status block meta-data
  4929. */
  4930. struct hc_status_block_data_e2 {
  4931. struct hc_index_data index_data[HC_SB_MAX_INDICES_E2];
  4932. struct hc_sb_data common;
  4933. };
  4934. /*
  4935. * IGU block operartion modes (in Everest2)
  4936. */
  4937. enum igu_mode {
  4938. HC_IGU_BC_MODE,
  4939. HC_IGU_NBC_MODE,
  4940. MAX_IGU_MODE
  4941. };
  4942. /*
  4943. * Inner Headers Classification Type
  4944. */
  4945. enum inner_clss_type {
  4946. INNER_CLSS_DISABLED,
  4947. INNER_CLSS_USE_VLAN,
  4948. INNER_CLSS_USE_VNI,
  4949. MAX_INNER_CLSS_TYPE};
  4950. /*
  4951. * IP versions
  4952. */
  4953. enum ip_ver {
  4954. IP_V4,
  4955. IP_V6,
  4956. MAX_IP_VER
  4957. };
  4958. /*
  4959. * Malicious VF error ID
  4960. */
  4961. enum malicious_vf_error_id {
  4962. MALICIOUS_VF_NO_ERROR,
  4963. VF_PF_CHANNEL_NOT_READY,
  4964. ETH_ILLEGAL_BD_LENGTHS,
  4965. ETH_PACKET_TOO_SHORT,
  4966. ETH_PAYLOAD_TOO_BIG,
  4967. ETH_ILLEGAL_ETH_TYPE,
  4968. ETH_ILLEGAL_LSO_HDR_LEN,
  4969. ETH_TOO_MANY_BDS,
  4970. ETH_ZERO_HDR_NBDS,
  4971. ETH_START_BD_NOT_SET,
  4972. ETH_ILLEGAL_PARSE_NBDS,
  4973. ETH_IPV6_AND_CHECKSUM,
  4974. ETH_VLAN_FLG_INCORRECT,
  4975. ETH_ILLEGAL_LSO_MSS,
  4976. ETH_TUNNEL_NOT_SUPPORTED,
  4977. MAX_MALICIOUS_VF_ERROR_ID
  4978. };
  4979. /*
  4980. * Multi-function modes
  4981. */
  4982. enum mf_mode {
  4983. SINGLE_FUNCTION,
  4984. MULTI_FUNCTION_SD,
  4985. MULTI_FUNCTION_SI,
  4986. MULTI_FUNCTION_AFEX,
  4987. MAX_MF_MODE
  4988. };
  4989. /*
  4990. * Protocol-common statistics collected by the Tstorm (per pf)
  4991. */
  4992. struct tstorm_per_pf_stats {
  4993. struct regpair rcv_error_bytes;
  4994. };
  4995. /*
  4996. *
  4997. */
  4998. struct per_pf_stats {
  4999. struct tstorm_per_pf_stats tstorm_pf_statistics;
  5000. };
  5001. /*
  5002. * Protocol-common statistics collected by the Tstorm (per port)
  5003. */
  5004. struct tstorm_per_port_stats {
  5005. __le32 mac_discard;
  5006. __le32 mac_filter_discard;
  5007. __le32 brb_truncate_discard;
  5008. __le32 mf_tag_discard;
  5009. __le32 packet_drop;
  5010. __le32 reserved;
  5011. };
  5012. /*
  5013. *
  5014. */
  5015. struct per_port_stats {
  5016. struct tstorm_per_port_stats tstorm_port_statistics;
  5017. };
  5018. /*
  5019. * Protocol-common statistics collected by the Tstorm (per client)
  5020. */
  5021. struct tstorm_per_queue_stats {
  5022. struct regpair rcv_ucast_bytes;
  5023. __le32 rcv_ucast_pkts;
  5024. __le32 checksum_discard;
  5025. struct regpair rcv_bcast_bytes;
  5026. __le32 rcv_bcast_pkts;
  5027. __le32 pkts_too_big_discard;
  5028. struct regpair rcv_mcast_bytes;
  5029. __le32 rcv_mcast_pkts;
  5030. __le32 ttl0_discard;
  5031. __le16 no_buff_discard;
  5032. __le16 reserved0;
  5033. __le32 reserved1;
  5034. };
  5035. /*
  5036. * Protocol-common statistics collected by the Ustorm (per client)
  5037. */
  5038. struct ustorm_per_queue_stats {
  5039. struct regpair ucast_no_buff_bytes;
  5040. struct regpair mcast_no_buff_bytes;
  5041. struct regpair bcast_no_buff_bytes;
  5042. __le32 ucast_no_buff_pkts;
  5043. __le32 mcast_no_buff_pkts;
  5044. __le32 bcast_no_buff_pkts;
  5045. __le32 coalesced_pkts;
  5046. struct regpair coalesced_bytes;
  5047. __le32 coalesced_events;
  5048. __le32 coalesced_aborts;
  5049. };
  5050. /*
  5051. * Protocol-common statistics collected by the Xstorm (per client)
  5052. */
  5053. struct xstorm_per_queue_stats {
  5054. struct regpair ucast_bytes_sent;
  5055. struct regpair mcast_bytes_sent;
  5056. struct regpair bcast_bytes_sent;
  5057. __le32 ucast_pkts_sent;
  5058. __le32 mcast_pkts_sent;
  5059. __le32 bcast_pkts_sent;
  5060. __le32 error_drop_pkts;
  5061. };
  5062. /*
  5063. *
  5064. */
  5065. struct per_queue_stats {
  5066. struct tstorm_per_queue_stats tstorm_queue_statistics;
  5067. struct ustorm_per_queue_stats ustorm_queue_statistics;
  5068. struct xstorm_per_queue_stats xstorm_queue_statistics;
  5069. };
  5070. /*
  5071. * FW version stored in first line of pram
  5072. */
  5073. struct pram_fw_version {
  5074. u8 major;
  5075. u8 minor;
  5076. u8 revision;
  5077. u8 engineering;
  5078. u8 flags;
  5079. #define PRAM_FW_VERSION_OPTIMIZED (0x1<<0)
  5080. #define PRAM_FW_VERSION_OPTIMIZED_SHIFT 0
  5081. #define PRAM_FW_VERSION_STORM_ID (0x3<<1)
  5082. #define PRAM_FW_VERSION_STORM_ID_SHIFT 1
  5083. #define PRAM_FW_VERSION_BIG_ENDIEN (0x1<<3)
  5084. #define PRAM_FW_VERSION_BIG_ENDIEN_SHIFT 3
  5085. #define PRAM_FW_VERSION_CHIP_VERSION (0x3<<4)
  5086. #define PRAM_FW_VERSION_CHIP_VERSION_SHIFT 4
  5087. #define __PRAM_FW_VERSION_RESERVED0 (0x3<<6)
  5088. #define __PRAM_FW_VERSION_RESERVED0_SHIFT 6
  5089. };
  5090. /*
  5091. * Ethernet slow path element
  5092. */
  5093. union protocol_common_specific_data {
  5094. u8 protocol_data[8];
  5095. struct regpair phy_address;
  5096. struct regpair mac_config_addr;
  5097. struct afex_vif_list_ramrod_data afex_vif_list_data;
  5098. };
  5099. /*
  5100. * The send queue element
  5101. */
  5102. struct protocol_common_spe {
  5103. struct spe_hdr hdr;
  5104. union protocol_common_specific_data data;
  5105. };
  5106. /* The data for the Set Timesync Ramrod */
  5107. struct set_timesync_ramrod_data {
  5108. u8 drift_adjust_cmd;
  5109. u8 offset_cmd;
  5110. u8 add_sub_drift_adjust_value;
  5111. u8 drift_adjust_value;
  5112. u32 drift_adjust_period;
  5113. struct regpair offset_delta;
  5114. };
  5115. /*
  5116. * The send queue element
  5117. */
  5118. struct slow_path_element {
  5119. struct spe_hdr hdr;
  5120. struct regpair protocol_data;
  5121. };
  5122. /*
  5123. * Protocol-common statistics counter
  5124. */
  5125. struct stats_counter {
  5126. __le16 xstats_counter;
  5127. __le16 reserved0;
  5128. __le32 reserved1;
  5129. __le16 tstats_counter;
  5130. __le16 reserved2;
  5131. __le32 reserved3;
  5132. __le16 ustats_counter;
  5133. __le16 reserved4;
  5134. __le32 reserved5;
  5135. __le16 cstats_counter;
  5136. __le16 reserved6;
  5137. __le32 reserved7;
  5138. };
  5139. /*
  5140. *
  5141. */
  5142. struct stats_query_entry {
  5143. u8 kind;
  5144. u8 index;
  5145. __le16 funcID;
  5146. __le32 reserved;
  5147. struct regpair address;
  5148. };
  5149. /*
  5150. * statistic command
  5151. */
  5152. struct stats_query_cmd_group {
  5153. struct stats_query_entry query[STATS_QUERY_CMD_COUNT];
  5154. };
  5155. /*
  5156. * statistic command header
  5157. */
  5158. struct stats_query_header {
  5159. u8 cmd_num;
  5160. u8 reserved0;
  5161. __le16 drv_stats_counter;
  5162. __le32 reserved1;
  5163. struct regpair stats_counters_addrs;
  5164. };
  5165. /*
  5166. * Types of statistcis query entry
  5167. */
  5168. enum stats_query_type {
  5169. STATS_TYPE_QUEUE,
  5170. STATS_TYPE_PORT,
  5171. STATS_TYPE_PF,
  5172. STATS_TYPE_TOE,
  5173. STATS_TYPE_FCOE,
  5174. MAX_STATS_QUERY_TYPE
  5175. };
  5176. /*
  5177. * Indicate of the function status block state
  5178. */
  5179. enum status_block_state {
  5180. SB_DISABLED,
  5181. SB_ENABLED,
  5182. SB_CLEANED,
  5183. MAX_STATUS_BLOCK_STATE
  5184. };
  5185. /*
  5186. * Storm IDs (including attentions for IGU related enums)
  5187. */
  5188. enum storm_id {
  5189. USTORM_ID,
  5190. CSTORM_ID,
  5191. XSTORM_ID,
  5192. TSTORM_ID,
  5193. ATTENTION_ID,
  5194. MAX_STORM_ID
  5195. };
  5196. /*
  5197. * Taffic types used in ETS and flow control algorithms
  5198. */
  5199. enum traffic_type {
  5200. LLFC_TRAFFIC_TYPE_NW,
  5201. LLFC_TRAFFIC_TYPE_FCOE,
  5202. LLFC_TRAFFIC_TYPE_ISCSI,
  5203. MAX_TRAFFIC_TYPE
  5204. };
  5205. /*
  5206. * zone A per-queue data
  5207. */
  5208. struct tstorm_queue_zone_data {
  5209. struct regpair reserved[4];
  5210. };
  5211. /*
  5212. * zone B per-VF data
  5213. */
  5214. struct tstorm_vf_zone_data {
  5215. struct regpair reserved;
  5216. };
  5217. /* Add or Subtract Value for Set Timesync Ramrod */
  5218. enum ts_add_sub_value {
  5219. TS_SUB_VALUE,
  5220. TS_ADD_VALUE,
  5221. MAX_TS_ADD_SUB_VALUE
  5222. };
  5223. /* Drift-Adjust Commands for Set Timesync Ramrod */
  5224. enum ts_drift_adjust_cmd {
  5225. TS_DRIFT_ADJUST_KEEP,
  5226. TS_DRIFT_ADJUST_SET,
  5227. TS_DRIFT_ADJUST_RESET,
  5228. MAX_TS_DRIFT_ADJUST_CMD
  5229. };
  5230. /* Offset Commands for Set Timesync Ramrod */
  5231. enum ts_offset_cmd {
  5232. TS_OFFSET_KEEP,
  5233. TS_OFFSET_INC,
  5234. TS_OFFSET_DEC,
  5235. MAX_TS_OFFSET_CMD
  5236. };
  5237. /* zone A per-queue data */
  5238. struct ustorm_queue_zone_data {
  5239. struct ustorm_eth_rx_producers eth_rx_producers;
  5240. struct regpair reserved[3];
  5241. };
  5242. /*
  5243. * zone B per-VF data
  5244. */
  5245. struct ustorm_vf_zone_data {
  5246. struct regpair reserved;
  5247. };
  5248. /*
  5249. * data per VF-PF channel
  5250. */
  5251. struct vf_pf_channel_data {
  5252. #if defined(__BIG_ENDIAN)
  5253. u16 reserved0;
  5254. u8 valid;
  5255. u8 state;
  5256. #elif defined(__LITTLE_ENDIAN)
  5257. u8 state;
  5258. u8 valid;
  5259. u16 reserved0;
  5260. #endif
  5261. u32 reserved1;
  5262. };
  5263. /*
  5264. * State of VF-PF channel
  5265. */
  5266. enum vf_pf_channel_state {
  5267. VF_PF_CHANNEL_STATE_READY,
  5268. VF_PF_CHANNEL_STATE_WAITING_FOR_ACK,
  5269. MAX_VF_PF_CHANNEL_STATE
  5270. };
  5271. /*
  5272. * vif_list_rule_kind
  5273. */
  5274. enum vif_list_rule_kind {
  5275. VIF_LIST_RULE_SET,
  5276. VIF_LIST_RULE_GET,
  5277. VIF_LIST_RULE_CLEAR_ALL,
  5278. VIF_LIST_RULE_CLEAR_FUNC,
  5279. MAX_VIF_LIST_RULE_KIND
  5280. };
  5281. /*
  5282. * zone A per-queue data
  5283. */
  5284. struct xstorm_queue_zone_data {
  5285. struct regpair reserved[4];
  5286. };
  5287. /*
  5288. * zone B per-VF data
  5289. */
  5290. struct xstorm_vf_zone_data {
  5291. struct regpair reserved;
  5292. };
  5293. #endif /* BNX2X_HSI_H */