DAC960.h 148 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416
  1. /*
  2. Linux Driver for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers
  3. Copyright 1998-2001 by Leonard N. Zubkoff <lnz@dandelion.com>
  4. This program is free software; you may redistribute and/or modify it under
  5. the terms of the GNU General Public License Version 2 as published by the
  6. Free Software Foundation.
  7. This program is distributed in the hope that it will be useful, but
  8. WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
  9. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  10. for complete details.
  11. The author respectfully requests that any modifications to this software be
  12. sent directly to him for evaluation and testing.
  13. */
  14. /*
  15. Define the maximum number of DAC960 Controllers supported by this driver.
  16. */
  17. #define DAC960_MaxControllers 8
  18. /*
  19. Define the maximum number of Controller Channels supported by DAC960
  20. V1 and V2 Firmware Controllers.
  21. */
  22. #define DAC960_V1_MaxChannels 3
  23. #define DAC960_V2_MaxChannels 4
  24. /*
  25. Define the maximum number of Targets per Channel supported by DAC960
  26. V1 and V2 Firmware Controllers.
  27. */
  28. #define DAC960_V1_MaxTargets 16
  29. #define DAC960_V2_MaxTargets 128
  30. /*
  31. Define the maximum number of Logical Drives supported by DAC960
  32. V1 and V2 Firmware Controllers.
  33. */
  34. #define DAC960_MaxLogicalDrives 32
  35. /*
  36. Define the maximum number of Physical Devices supported by DAC960
  37. V1 and V2 Firmware Controllers.
  38. */
  39. #define DAC960_V1_MaxPhysicalDevices 45
  40. #define DAC960_V2_MaxPhysicalDevices 272
  41. /*
  42. Define a 32/64 bit I/O Address data type.
  43. */
  44. typedef unsigned long DAC960_IO_Address_T;
  45. /*
  46. Define a 32/64 bit PCI Bus Address data type.
  47. */
  48. typedef unsigned long DAC960_PCI_Address_T;
  49. /*
  50. Define a 32 bit Bus Address data type.
  51. */
  52. typedef unsigned int DAC960_BusAddress32_T;
  53. /*
  54. Define a 64 bit Bus Address data type.
  55. */
  56. typedef unsigned long long DAC960_BusAddress64_T;
  57. /*
  58. Define a 32 bit Byte Count data type.
  59. */
  60. typedef unsigned int DAC960_ByteCount32_T;
  61. /*
  62. Define a 64 bit Byte Count data type.
  63. */
  64. typedef unsigned long long DAC960_ByteCount64_T;
  65. /*
  66. dma_loaf is used by helper routines to divide a region of
  67. dma mapped memory into smaller pieces, where those pieces
  68. are not of uniform size.
  69. */
  70. struct dma_loaf {
  71. void *cpu_base;
  72. dma_addr_t dma_base;
  73. size_t length;
  74. void *cpu_free;
  75. dma_addr_t dma_free;
  76. };
  77. /*
  78. Define the SCSI INQUIRY Standard Data structure.
  79. */
  80. typedef struct DAC960_SCSI_Inquiry
  81. {
  82. unsigned char PeripheralDeviceType:5; /* Byte 0 Bits 0-4 */
  83. unsigned char PeripheralQualifier:3; /* Byte 0 Bits 5-7 */
  84. unsigned char DeviceTypeModifier:7; /* Byte 1 Bits 0-6 */
  85. bool RMB:1; /* Byte 1 Bit 7 */
  86. unsigned char ANSI_ApprovedVersion:3; /* Byte 2 Bits 0-2 */
  87. unsigned char ECMA_Version:3; /* Byte 2 Bits 3-5 */
  88. unsigned char ISO_Version:2; /* Byte 2 Bits 6-7 */
  89. unsigned char ResponseDataFormat:4; /* Byte 3 Bits 0-3 */
  90. unsigned char :2; /* Byte 3 Bits 4-5 */
  91. bool TrmIOP:1; /* Byte 3 Bit 6 */
  92. bool AENC:1; /* Byte 3 Bit 7 */
  93. unsigned char AdditionalLength; /* Byte 4 */
  94. unsigned char :8; /* Byte 5 */
  95. unsigned char :8; /* Byte 6 */
  96. bool SftRe:1; /* Byte 7 Bit 0 */
  97. bool CmdQue:1; /* Byte 7 Bit 1 */
  98. bool :1; /* Byte 7 Bit 2 */
  99. bool Linked:1; /* Byte 7 Bit 3 */
  100. bool Sync:1; /* Byte 7 Bit 4 */
  101. bool WBus16:1; /* Byte 7 Bit 5 */
  102. bool WBus32:1; /* Byte 7 Bit 6 */
  103. bool RelAdr:1; /* Byte 7 Bit 7 */
  104. unsigned char VendorIdentification[8]; /* Bytes 8-15 */
  105. unsigned char ProductIdentification[16]; /* Bytes 16-31 */
  106. unsigned char ProductRevisionLevel[4]; /* Bytes 32-35 */
  107. }
  108. DAC960_SCSI_Inquiry_T;
  109. /*
  110. Define the SCSI INQUIRY Unit Serial Number structure.
  111. */
  112. typedef struct DAC960_SCSI_Inquiry_UnitSerialNumber
  113. {
  114. unsigned char PeripheralDeviceType:5; /* Byte 0 Bits 0-4 */
  115. unsigned char PeripheralQualifier:3; /* Byte 0 Bits 5-7 */
  116. unsigned char PageCode; /* Byte 1 */
  117. unsigned char :8; /* Byte 2 */
  118. unsigned char PageLength; /* Byte 3 */
  119. unsigned char ProductSerialNumber[28]; /* Bytes 4-31 */
  120. }
  121. DAC960_SCSI_Inquiry_UnitSerialNumber_T;
  122. /*
  123. Define the SCSI REQUEST SENSE Sense Key type.
  124. */
  125. typedef enum
  126. {
  127. DAC960_SenseKey_NoSense = 0x0,
  128. DAC960_SenseKey_RecoveredError = 0x1,
  129. DAC960_SenseKey_NotReady = 0x2,
  130. DAC960_SenseKey_MediumError = 0x3,
  131. DAC960_SenseKey_HardwareError = 0x4,
  132. DAC960_SenseKey_IllegalRequest = 0x5,
  133. DAC960_SenseKey_UnitAttention = 0x6,
  134. DAC960_SenseKey_DataProtect = 0x7,
  135. DAC960_SenseKey_BlankCheck = 0x8,
  136. DAC960_SenseKey_VendorSpecific = 0x9,
  137. DAC960_SenseKey_CopyAborted = 0xA,
  138. DAC960_SenseKey_AbortedCommand = 0xB,
  139. DAC960_SenseKey_Equal = 0xC,
  140. DAC960_SenseKey_VolumeOverflow = 0xD,
  141. DAC960_SenseKey_Miscompare = 0xE,
  142. DAC960_SenseKey_Reserved = 0xF
  143. }
  144. __attribute__ ((packed))
  145. DAC960_SCSI_RequestSenseKey_T;
  146. /*
  147. Define the SCSI REQUEST SENSE structure.
  148. */
  149. typedef struct DAC960_SCSI_RequestSense
  150. {
  151. unsigned char ErrorCode:7; /* Byte 0 Bits 0-6 */
  152. bool Valid:1; /* Byte 0 Bit 7 */
  153. unsigned char SegmentNumber; /* Byte 1 */
  154. DAC960_SCSI_RequestSenseKey_T SenseKey:4; /* Byte 2 Bits 0-3 */
  155. unsigned char :1; /* Byte 2 Bit 4 */
  156. bool ILI:1; /* Byte 2 Bit 5 */
  157. bool EOM:1; /* Byte 2 Bit 6 */
  158. bool Filemark:1; /* Byte 2 Bit 7 */
  159. unsigned char Information[4]; /* Bytes 3-6 */
  160. unsigned char AdditionalSenseLength; /* Byte 7 */
  161. unsigned char CommandSpecificInformation[4]; /* Bytes 8-11 */
  162. unsigned char AdditionalSenseCode; /* Byte 12 */
  163. unsigned char AdditionalSenseCodeQualifier; /* Byte 13 */
  164. }
  165. DAC960_SCSI_RequestSense_T;
  166. /*
  167. Define the DAC960 V1 Firmware Command Opcodes.
  168. */
  169. typedef enum
  170. {
  171. /* I/O Commands */
  172. DAC960_V1_ReadExtended = 0x33,
  173. DAC960_V1_WriteExtended = 0x34,
  174. DAC960_V1_ReadAheadExtended = 0x35,
  175. DAC960_V1_ReadExtendedWithScatterGather = 0xB3,
  176. DAC960_V1_WriteExtendedWithScatterGather = 0xB4,
  177. DAC960_V1_Read = 0x36,
  178. DAC960_V1_ReadWithScatterGather = 0xB6,
  179. DAC960_V1_Write = 0x37,
  180. DAC960_V1_WriteWithScatterGather = 0xB7,
  181. DAC960_V1_DCDB = 0x04,
  182. DAC960_V1_DCDBWithScatterGather = 0x84,
  183. DAC960_V1_Flush = 0x0A,
  184. /* Controller Status Related Commands */
  185. DAC960_V1_Enquiry = 0x53,
  186. DAC960_V1_Enquiry2 = 0x1C,
  187. DAC960_V1_GetLogicalDriveElement = 0x55,
  188. DAC960_V1_GetLogicalDriveInformation = 0x19,
  189. DAC960_V1_IOPortRead = 0x39,
  190. DAC960_V1_IOPortWrite = 0x3A,
  191. DAC960_V1_GetSDStats = 0x3E,
  192. DAC960_V1_GetPDStats = 0x3F,
  193. DAC960_V1_PerformEventLogOperation = 0x72,
  194. /* Device Related Commands */
  195. DAC960_V1_StartDevice = 0x10,
  196. DAC960_V1_GetDeviceState = 0x50,
  197. DAC960_V1_StopChannel = 0x13,
  198. DAC960_V1_StartChannel = 0x12,
  199. DAC960_V1_ResetChannel = 0x1A,
  200. /* Commands Associated with Data Consistency and Errors */
  201. DAC960_V1_Rebuild = 0x09,
  202. DAC960_V1_RebuildAsync = 0x16,
  203. DAC960_V1_CheckConsistency = 0x0F,
  204. DAC960_V1_CheckConsistencyAsync = 0x1E,
  205. DAC960_V1_RebuildStat = 0x0C,
  206. DAC960_V1_GetRebuildProgress = 0x27,
  207. DAC960_V1_RebuildControl = 0x1F,
  208. DAC960_V1_ReadBadBlockTable = 0x0B,
  209. DAC960_V1_ReadBadDataTable = 0x25,
  210. DAC960_V1_ClearBadDataTable = 0x26,
  211. DAC960_V1_GetErrorTable = 0x17,
  212. DAC960_V1_AddCapacityAsync = 0x2A,
  213. DAC960_V1_BackgroundInitializationControl = 0x2B,
  214. /* Configuration Related Commands */
  215. DAC960_V1_ReadConfig2 = 0x3D,
  216. DAC960_V1_WriteConfig2 = 0x3C,
  217. DAC960_V1_ReadConfigurationOnDisk = 0x4A,
  218. DAC960_V1_WriteConfigurationOnDisk = 0x4B,
  219. DAC960_V1_ReadConfiguration = 0x4E,
  220. DAC960_V1_ReadBackupConfiguration = 0x4D,
  221. DAC960_V1_WriteConfiguration = 0x4F,
  222. DAC960_V1_AddConfiguration = 0x4C,
  223. DAC960_V1_ReadConfigurationLabel = 0x48,
  224. DAC960_V1_WriteConfigurationLabel = 0x49,
  225. /* Firmware Upgrade Related Commands */
  226. DAC960_V1_LoadImage = 0x20,
  227. DAC960_V1_StoreImage = 0x21,
  228. DAC960_V1_ProgramImage = 0x22,
  229. /* Diagnostic Commands */
  230. DAC960_V1_SetDiagnosticMode = 0x31,
  231. DAC960_V1_RunDiagnostic = 0x32,
  232. /* Subsystem Service Commands */
  233. DAC960_V1_GetSubsystemData = 0x70,
  234. DAC960_V1_SetSubsystemParameters = 0x71,
  235. /* Version 2.xx Firmware Commands */
  236. DAC960_V1_Enquiry_Old = 0x05,
  237. DAC960_V1_GetDeviceState_Old = 0x14,
  238. DAC960_V1_Read_Old = 0x02,
  239. DAC960_V1_Write_Old = 0x03,
  240. DAC960_V1_ReadWithScatterGather_Old = 0x82,
  241. DAC960_V1_WriteWithScatterGather_Old = 0x83
  242. }
  243. __attribute__ ((packed))
  244. DAC960_V1_CommandOpcode_T;
  245. /*
  246. Define the DAC960 V1 Firmware Command Identifier type.
  247. */
  248. typedef unsigned char DAC960_V1_CommandIdentifier_T;
  249. /*
  250. Define the DAC960 V1 Firmware Command Status Codes.
  251. */
  252. #define DAC960_V1_NormalCompletion 0x0000 /* Common */
  253. #define DAC960_V1_CheckConditionReceived 0x0002 /* Common */
  254. #define DAC960_V1_NoDeviceAtAddress 0x0102 /* Common */
  255. #define DAC960_V1_InvalidDeviceAddress 0x0105 /* Common */
  256. #define DAC960_V1_InvalidParameter 0x0105 /* Common */
  257. #define DAC960_V1_IrrecoverableDataError 0x0001 /* I/O */
  258. #define DAC960_V1_LogicalDriveNonexistentOrOffline 0x0002 /* I/O */
  259. #define DAC960_V1_AccessBeyondEndOfLogicalDrive 0x0105 /* I/O */
  260. #define DAC960_V1_BadDataEncountered 0x010C /* I/O */
  261. #define DAC960_V1_DeviceBusy 0x0008 /* DCDB */
  262. #define DAC960_V1_DeviceNonresponsive 0x000E /* DCDB */
  263. #define DAC960_V1_CommandTerminatedAbnormally 0x000F /* DCDB */
  264. #define DAC960_V1_UnableToStartDevice 0x0002 /* Device */
  265. #define DAC960_V1_InvalidChannelOrTargetOrModifier 0x0105 /* Device */
  266. #define DAC960_V1_ChannelBusy 0x0106 /* Device */
  267. #define DAC960_V1_ChannelNotStopped 0x0002 /* Device */
  268. #define DAC960_V1_AttemptToRebuildOnlineDrive 0x0002 /* Consistency */
  269. #define DAC960_V1_RebuildBadBlocksEncountered 0x0003 /* Consistency */
  270. #define DAC960_V1_NewDiskFailedDuringRebuild 0x0004 /* Consistency */
  271. #define DAC960_V1_RebuildOrCheckAlreadyInProgress 0x0106 /* Consistency */
  272. #define DAC960_V1_DependentDiskIsDead 0x0002 /* Consistency */
  273. #define DAC960_V1_InconsistentBlocksFound 0x0003 /* Consistency */
  274. #define DAC960_V1_InvalidOrNonredundantLogicalDrive 0x0105 /* Consistency */
  275. #define DAC960_V1_NoRebuildOrCheckInProgress 0x0105 /* Consistency */
  276. #define DAC960_V1_RebuildInProgress_DataValid 0x0000 /* Consistency */
  277. #define DAC960_V1_RebuildFailed_LogicalDriveFailure 0x0002 /* Consistency */
  278. #define DAC960_V1_RebuildFailed_BadBlocksOnOther 0x0003 /* Consistency */
  279. #define DAC960_V1_RebuildFailed_NewDriveFailed 0x0004 /* Consistency */
  280. #define DAC960_V1_RebuildSuccessful 0x0100 /* Consistency */
  281. #define DAC960_V1_RebuildSuccessfullyTerminated 0x0107 /* Consistency */
  282. #define DAC960_V1_BackgroundInitSuccessful 0x0100 /* Consistency */
  283. #define DAC960_V1_BackgroundInitAborted 0x0005 /* Consistency */
  284. #define DAC960_V1_NoBackgroundInitInProgress 0x0105 /* Consistency */
  285. #define DAC960_V1_AddCapacityInProgress 0x0004 /* Consistency */
  286. #define DAC960_V1_AddCapacityFailedOrSuspended 0x00F4 /* Consistency */
  287. #define DAC960_V1_Config2ChecksumError 0x0002 /* Configuration */
  288. #define DAC960_V1_ConfigurationSuspended 0x0106 /* Configuration */
  289. #define DAC960_V1_FailedToConfigureNVRAM 0x0105 /* Configuration */
  290. #define DAC960_V1_ConfigurationNotSavedStateChange 0x0106 /* Configuration */
  291. #define DAC960_V1_SubsystemNotInstalled 0x0001 /* Subsystem */
  292. #define DAC960_V1_SubsystemFailed 0x0002 /* Subsystem */
  293. #define DAC960_V1_SubsystemBusy 0x0106 /* Subsystem */
  294. typedef unsigned short DAC960_V1_CommandStatus_T;
  295. /*
  296. Define the DAC960 V1 Firmware Enquiry Command reply structure.
  297. */
  298. typedef struct DAC960_V1_Enquiry
  299. {
  300. unsigned char NumberOfLogicalDrives; /* Byte 0 */
  301. unsigned int :24; /* Bytes 1-3 */
  302. unsigned int LogicalDriveSizes[32]; /* Bytes 4-131 */
  303. unsigned short FlashAge; /* Bytes 132-133 */
  304. struct {
  305. bool DeferredWriteError:1; /* Byte 134 Bit 0 */
  306. bool BatteryLow:1; /* Byte 134 Bit 1 */
  307. unsigned char :6; /* Byte 134 Bits 2-7 */
  308. } StatusFlags;
  309. unsigned char :8; /* Byte 135 */
  310. unsigned char MinorFirmwareVersion; /* Byte 136 */
  311. unsigned char MajorFirmwareVersion; /* Byte 137 */
  312. enum {
  313. DAC960_V1_NoStandbyRebuildOrCheckInProgress = 0x00,
  314. DAC960_V1_StandbyRebuildInProgress = 0x01,
  315. DAC960_V1_BackgroundRebuildInProgress = 0x02,
  316. DAC960_V1_BackgroundCheckInProgress = 0x03,
  317. DAC960_V1_StandbyRebuildCompletedWithError = 0xFF,
  318. DAC960_V1_BackgroundRebuildOrCheckFailed_DriveFailed = 0xF0,
  319. DAC960_V1_BackgroundRebuildOrCheckFailed_LogicalDriveFailed = 0xF1,
  320. DAC960_V1_BackgroundRebuildOrCheckFailed_OtherCauses = 0xF2,
  321. DAC960_V1_BackgroundRebuildOrCheckSuccessfullyTerminated = 0xF3
  322. } __attribute__ ((packed)) RebuildFlag; /* Byte 138 */
  323. unsigned char MaxCommands; /* Byte 139 */
  324. unsigned char OfflineLogicalDriveCount; /* Byte 140 */
  325. unsigned char :8; /* Byte 141 */
  326. unsigned short EventLogSequenceNumber; /* Bytes 142-143 */
  327. unsigned char CriticalLogicalDriveCount; /* Byte 144 */
  328. unsigned int :24; /* Bytes 145-147 */
  329. unsigned char DeadDriveCount; /* Byte 148 */
  330. unsigned char :8; /* Byte 149 */
  331. unsigned char RebuildCount; /* Byte 150 */
  332. struct {
  333. unsigned char :3; /* Byte 151 Bits 0-2 */
  334. bool BatteryBackupUnitPresent:1; /* Byte 151 Bit 3 */
  335. unsigned char :3; /* Byte 151 Bits 4-6 */
  336. unsigned char :1; /* Byte 151 Bit 7 */
  337. } MiscFlags;
  338. struct {
  339. unsigned char TargetID;
  340. unsigned char Channel;
  341. } DeadDrives[21]; /* Bytes 152-194 */
  342. unsigned char Reserved[62]; /* Bytes 195-255 */
  343. }
  344. __attribute__ ((packed))
  345. DAC960_V1_Enquiry_T;
  346. /*
  347. Define the DAC960 V1 Firmware Enquiry2 Command reply structure.
  348. */
  349. typedef struct DAC960_V1_Enquiry2
  350. {
  351. struct {
  352. enum {
  353. DAC960_V1_P_PD_PU = 0x01,
  354. DAC960_V1_PL = 0x02,
  355. DAC960_V1_PG = 0x10,
  356. DAC960_V1_PJ = 0x11,
  357. DAC960_V1_PR = 0x12,
  358. DAC960_V1_PT = 0x13,
  359. DAC960_V1_PTL0 = 0x14,
  360. DAC960_V1_PRL = 0x15,
  361. DAC960_V1_PTL1 = 0x16,
  362. DAC960_V1_1164P = 0x20
  363. } __attribute__ ((packed)) SubModel; /* Byte 0 */
  364. unsigned char ActualChannels; /* Byte 1 */
  365. enum {
  366. DAC960_V1_FiveChannelBoard = 0x01,
  367. DAC960_V1_ThreeChannelBoard = 0x02,
  368. DAC960_V1_TwoChannelBoard = 0x03,
  369. DAC960_V1_ThreeChannelASIC_DAC = 0x04
  370. } __attribute__ ((packed)) Model; /* Byte 2 */
  371. enum {
  372. DAC960_V1_EISA_Controller = 0x01,
  373. DAC960_V1_MicroChannel_Controller = 0x02,
  374. DAC960_V1_PCI_Controller = 0x03,
  375. DAC960_V1_SCSItoSCSI_Controller = 0x08
  376. } __attribute__ ((packed)) ProductFamily; /* Byte 3 */
  377. } HardwareID; /* Bytes 0-3 */
  378. /* MajorVersion.MinorVersion-FirmwareType-TurnID */
  379. struct {
  380. unsigned char MajorVersion; /* Byte 4 */
  381. unsigned char MinorVersion; /* Byte 5 */
  382. unsigned char TurnID; /* Byte 6 */
  383. char FirmwareType; /* Byte 7 */
  384. } FirmwareID; /* Bytes 4-7 */
  385. unsigned char :8; /* Byte 8 */
  386. unsigned int :24; /* Bytes 9-11 */
  387. unsigned char ConfiguredChannels; /* Byte 12 */
  388. unsigned char ActualChannels; /* Byte 13 */
  389. unsigned char MaxTargets; /* Byte 14 */
  390. unsigned char MaxTags; /* Byte 15 */
  391. unsigned char MaxLogicalDrives; /* Byte 16 */
  392. unsigned char MaxArms; /* Byte 17 */
  393. unsigned char MaxSpans; /* Byte 18 */
  394. unsigned char :8; /* Byte 19 */
  395. unsigned int :32; /* Bytes 20-23 */
  396. unsigned int MemorySize; /* Bytes 24-27 */
  397. unsigned int CacheSize; /* Bytes 28-31 */
  398. unsigned int FlashMemorySize; /* Bytes 32-35 */
  399. unsigned int NonVolatileMemorySize; /* Bytes 36-39 */
  400. struct {
  401. enum {
  402. DAC960_V1_RamType_DRAM = 0x0,
  403. DAC960_V1_RamType_EDO = 0x1,
  404. DAC960_V1_RamType_SDRAM = 0x2,
  405. DAC960_V1_RamType_Last = 0x7
  406. } __attribute__ ((packed)) RamType:3; /* Byte 40 Bits 0-2 */
  407. enum {
  408. DAC960_V1_ErrorCorrection_None = 0x0,
  409. DAC960_V1_ErrorCorrection_Parity = 0x1,
  410. DAC960_V1_ErrorCorrection_ECC = 0x2,
  411. DAC960_V1_ErrorCorrection_Last = 0x7
  412. } __attribute__ ((packed)) ErrorCorrection:3; /* Byte 40 Bits 3-5 */
  413. bool FastPageMode:1; /* Byte 40 Bit 6 */
  414. bool LowPowerMemory:1; /* Byte 40 Bit 7 */
  415. unsigned char :8; /* Bytes 41 */
  416. } MemoryType;
  417. unsigned short ClockSpeed; /* Bytes 42-43 */
  418. unsigned short MemorySpeed; /* Bytes 44-45 */
  419. unsigned short HardwareSpeed; /* Bytes 46-47 */
  420. unsigned int :32; /* Bytes 48-51 */
  421. unsigned int :32; /* Bytes 52-55 */
  422. unsigned char :8; /* Byte 56 */
  423. unsigned char :8; /* Byte 57 */
  424. unsigned short :16; /* Bytes 58-59 */
  425. unsigned short MaxCommands; /* Bytes 60-61 */
  426. unsigned short MaxScatterGatherEntries; /* Bytes 62-63 */
  427. unsigned short MaxDriveCommands; /* Bytes 64-65 */
  428. unsigned short MaxIODescriptors; /* Bytes 66-67 */
  429. unsigned short MaxCombinedSectors; /* Bytes 68-69 */
  430. unsigned char Latency; /* Byte 70 */
  431. unsigned char :8; /* Byte 71 */
  432. unsigned char SCSITimeout; /* Byte 72 */
  433. unsigned char :8; /* Byte 73 */
  434. unsigned short MinFreeLines; /* Bytes 74-75 */
  435. unsigned int :32; /* Bytes 76-79 */
  436. unsigned int :32; /* Bytes 80-83 */
  437. unsigned char RebuildRateConstant; /* Byte 84 */
  438. unsigned char :8; /* Byte 85 */
  439. unsigned char :8; /* Byte 86 */
  440. unsigned char :8; /* Byte 87 */
  441. unsigned int :32; /* Bytes 88-91 */
  442. unsigned int :32; /* Bytes 92-95 */
  443. unsigned short PhysicalDriveBlockSize; /* Bytes 96-97 */
  444. unsigned short LogicalDriveBlockSize; /* Bytes 98-99 */
  445. unsigned short MaxBlocksPerCommand; /* Bytes 100-101 */
  446. unsigned short BlockFactor; /* Bytes 102-103 */
  447. unsigned short CacheLineSize; /* Bytes 104-105 */
  448. struct {
  449. enum {
  450. DAC960_V1_Narrow_8bit = 0x0,
  451. DAC960_V1_Wide_16bit = 0x1,
  452. DAC960_V1_Wide_32bit = 0x2
  453. } __attribute__ ((packed)) BusWidth:2; /* Byte 106 Bits 0-1 */
  454. enum {
  455. DAC960_V1_Fast = 0x0,
  456. DAC960_V1_Ultra = 0x1,
  457. DAC960_V1_Ultra2 = 0x2
  458. } __attribute__ ((packed)) BusSpeed:2; /* Byte 106 Bits 2-3 */
  459. bool Differential:1; /* Byte 106 Bit 4 */
  460. unsigned char :3; /* Byte 106 Bits 5-7 */
  461. } SCSICapability;
  462. unsigned char :8; /* Byte 107 */
  463. unsigned int :32; /* Bytes 108-111 */
  464. unsigned short FirmwareBuildNumber; /* Bytes 112-113 */
  465. enum {
  466. DAC960_V1_AEMI = 0x01,
  467. DAC960_V1_OEM1 = 0x02,
  468. DAC960_V1_OEM2 = 0x04,
  469. DAC960_V1_OEM3 = 0x08,
  470. DAC960_V1_Conner = 0x10,
  471. DAC960_V1_SAFTE = 0x20
  472. } __attribute__ ((packed)) FaultManagementType; /* Byte 114 */
  473. unsigned char :8; /* Byte 115 */
  474. struct {
  475. bool Clustering:1; /* Byte 116 Bit 0 */
  476. bool MylexOnlineRAIDExpansion:1; /* Byte 116 Bit 1 */
  477. bool ReadAhead:1; /* Byte 116 Bit 2 */
  478. bool BackgroundInitialization:1; /* Byte 116 Bit 3 */
  479. unsigned int :28; /* Bytes 116-119 */
  480. } FirmwareFeatures;
  481. unsigned int :32; /* Bytes 120-123 */
  482. unsigned int :32; /* Bytes 124-127 */
  483. }
  484. DAC960_V1_Enquiry2_T;
  485. /*
  486. Define the DAC960 V1 Firmware Logical Drive State type.
  487. */
  488. typedef enum
  489. {
  490. DAC960_V1_LogicalDrive_Online = 0x03,
  491. DAC960_V1_LogicalDrive_Critical = 0x04,
  492. DAC960_V1_LogicalDrive_Offline = 0xFF
  493. }
  494. __attribute__ ((packed))
  495. DAC960_V1_LogicalDriveState_T;
  496. /*
  497. Define the DAC960 V1 Firmware Logical Drive Information structure.
  498. */
  499. typedef struct DAC960_V1_LogicalDriveInformation
  500. {
  501. unsigned int LogicalDriveSize; /* Bytes 0-3 */
  502. DAC960_V1_LogicalDriveState_T LogicalDriveState; /* Byte 4 */
  503. unsigned char RAIDLevel:7; /* Byte 5 Bits 0-6 */
  504. bool WriteBack:1; /* Byte 5 Bit 7 */
  505. unsigned short :16; /* Bytes 6-7 */
  506. }
  507. DAC960_V1_LogicalDriveInformation_T;
  508. /*
  509. Define the DAC960 V1 Firmware Get Logical Drive Information Command
  510. reply structure.
  511. */
  512. typedef DAC960_V1_LogicalDriveInformation_T
  513. DAC960_V1_LogicalDriveInformationArray_T[DAC960_MaxLogicalDrives];
  514. /*
  515. Define the DAC960 V1 Firmware Perform Event Log Operation Types.
  516. */
  517. typedef enum
  518. {
  519. DAC960_V1_GetEventLogEntry = 0x00
  520. }
  521. __attribute__ ((packed))
  522. DAC960_V1_PerformEventLogOpType_T;
  523. /*
  524. Define the DAC960 V1 Firmware Get Event Log Entry Command reply structure.
  525. */
  526. typedef struct DAC960_V1_EventLogEntry
  527. {
  528. unsigned char MessageType; /* Byte 0 */
  529. unsigned char MessageLength; /* Byte 1 */
  530. unsigned char TargetID:5; /* Byte 2 Bits 0-4 */
  531. unsigned char Channel:3; /* Byte 2 Bits 5-7 */
  532. unsigned char LogicalUnit:6; /* Byte 3 Bits 0-5 */
  533. unsigned char :2; /* Byte 3 Bits 6-7 */
  534. unsigned short SequenceNumber; /* Bytes 4-5 */
  535. unsigned char ErrorCode:7; /* Byte 6 Bits 0-6 */
  536. bool Valid:1; /* Byte 6 Bit 7 */
  537. unsigned char SegmentNumber; /* Byte 7 */
  538. DAC960_SCSI_RequestSenseKey_T SenseKey:4; /* Byte 8 Bits 0-3 */
  539. unsigned char :1; /* Byte 8 Bit 4 */
  540. bool ILI:1; /* Byte 8 Bit 5 */
  541. bool EOM:1; /* Byte 8 Bit 6 */
  542. bool Filemark:1; /* Byte 8 Bit 7 */
  543. unsigned char Information[4]; /* Bytes 9-12 */
  544. unsigned char AdditionalSenseLength; /* Byte 13 */
  545. unsigned char CommandSpecificInformation[4]; /* Bytes 14-17 */
  546. unsigned char AdditionalSenseCode; /* Byte 18 */
  547. unsigned char AdditionalSenseCodeQualifier; /* Byte 19 */
  548. unsigned char Dummy[12]; /* Bytes 20-31 */
  549. }
  550. DAC960_V1_EventLogEntry_T;
  551. /*
  552. Define the DAC960 V1 Firmware Physical Device State type.
  553. */
  554. typedef enum
  555. {
  556. DAC960_V1_Device_Dead = 0x00,
  557. DAC960_V1_Device_WriteOnly = 0x02,
  558. DAC960_V1_Device_Online = 0x03,
  559. DAC960_V1_Device_Standby = 0x10
  560. }
  561. __attribute__ ((packed))
  562. DAC960_V1_PhysicalDeviceState_T;
  563. /*
  564. Define the DAC960 V1 Firmware Get Device State Command reply structure.
  565. The structure is padded by 2 bytes for compatibility with Version 2.xx
  566. Firmware.
  567. */
  568. typedef struct DAC960_V1_DeviceState
  569. {
  570. bool Present:1; /* Byte 0 Bit 0 */
  571. unsigned char :7; /* Byte 0 Bits 1-7 */
  572. enum {
  573. DAC960_V1_OtherType = 0x0,
  574. DAC960_V1_DiskType = 0x1,
  575. DAC960_V1_SequentialType = 0x2,
  576. DAC960_V1_CDROM_or_WORM_Type = 0x3
  577. } __attribute__ ((packed)) DeviceType:2; /* Byte 1 Bits 0-1 */
  578. bool :1; /* Byte 1 Bit 2 */
  579. bool Fast20:1; /* Byte 1 Bit 3 */
  580. bool Sync:1; /* Byte 1 Bit 4 */
  581. bool Fast:1; /* Byte 1 Bit 5 */
  582. bool Wide:1; /* Byte 1 Bit 6 */
  583. bool TaggedQueuingSupported:1; /* Byte 1 Bit 7 */
  584. DAC960_V1_PhysicalDeviceState_T DeviceState; /* Byte 2 */
  585. unsigned char :8; /* Byte 3 */
  586. unsigned char SynchronousMultiplier; /* Byte 4 */
  587. unsigned char SynchronousOffset:5; /* Byte 5 Bits 0-4 */
  588. unsigned char :3; /* Byte 5 Bits 5-7 */
  589. unsigned int DiskSize __attribute__ ((packed)); /* Bytes 6-9 */
  590. unsigned short :16; /* Bytes 10-11 */
  591. }
  592. DAC960_V1_DeviceState_T;
  593. /*
  594. Define the DAC960 V1 Firmware Get Rebuild Progress Command reply structure.
  595. */
  596. typedef struct DAC960_V1_RebuildProgress
  597. {
  598. unsigned int LogicalDriveNumber; /* Bytes 0-3 */
  599. unsigned int LogicalDriveSize; /* Bytes 4-7 */
  600. unsigned int RemainingBlocks; /* Bytes 8-11 */
  601. }
  602. DAC960_V1_RebuildProgress_T;
  603. /*
  604. Define the DAC960 V1 Firmware Background Initialization Status Command
  605. reply structure.
  606. */
  607. typedef struct DAC960_V1_BackgroundInitializationStatus
  608. {
  609. unsigned int LogicalDriveSize; /* Bytes 0-3 */
  610. unsigned int BlocksCompleted; /* Bytes 4-7 */
  611. unsigned char Reserved1[12]; /* Bytes 8-19 */
  612. unsigned int LogicalDriveNumber; /* Bytes 20-23 */
  613. unsigned char RAIDLevel; /* Byte 24 */
  614. enum {
  615. DAC960_V1_BackgroundInitializationInvalid = 0x00,
  616. DAC960_V1_BackgroundInitializationStarted = 0x02,
  617. DAC960_V1_BackgroundInitializationInProgress = 0x04,
  618. DAC960_V1_BackgroundInitializationSuspended = 0x05,
  619. DAC960_V1_BackgroundInitializationCancelled = 0x06
  620. } __attribute__ ((packed)) Status; /* Byte 25 */
  621. unsigned char Reserved2[6]; /* Bytes 26-31 */
  622. }
  623. DAC960_V1_BackgroundInitializationStatus_T;
  624. /*
  625. Define the DAC960 V1 Firmware Error Table Entry structure.
  626. */
  627. typedef struct DAC960_V1_ErrorTableEntry
  628. {
  629. unsigned char ParityErrorCount; /* Byte 0 */
  630. unsigned char SoftErrorCount; /* Byte 1 */
  631. unsigned char HardErrorCount; /* Byte 2 */
  632. unsigned char MiscErrorCount; /* Byte 3 */
  633. }
  634. DAC960_V1_ErrorTableEntry_T;
  635. /*
  636. Define the DAC960 V1 Firmware Get Error Table Command reply structure.
  637. */
  638. typedef struct DAC960_V1_ErrorTable
  639. {
  640. DAC960_V1_ErrorTableEntry_T
  641. ErrorTableEntries[DAC960_V1_MaxChannels][DAC960_V1_MaxTargets];
  642. }
  643. DAC960_V1_ErrorTable_T;
  644. /*
  645. Define the DAC960 V1 Firmware Read Config2 Command reply structure.
  646. */
  647. typedef struct DAC960_V1_Config2
  648. {
  649. unsigned char :1; /* Byte 0 Bit 0 */
  650. bool ActiveNegationEnabled:1; /* Byte 0 Bit 1 */
  651. unsigned char :5; /* Byte 0 Bits 2-6 */
  652. bool NoRescanIfResetReceivedDuringScan:1; /* Byte 0 Bit 7 */
  653. bool StorageWorksSupportEnabled:1; /* Byte 1 Bit 0 */
  654. bool HewlettPackardSupportEnabled:1; /* Byte 1 Bit 1 */
  655. bool NoDisconnectOnFirstCommand:1; /* Byte 1 Bit 2 */
  656. unsigned char :2; /* Byte 1 Bits 3-4 */
  657. bool AEMI_ARM:1; /* Byte 1 Bit 5 */
  658. bool AEMI_OFM:1; /* Byte 1 Bit 6 */
  659. unsigned char :1; /* Byte 1 Bit 7 */
  660. enum {
  661. DAC960_V1_OEMID_Mylex = 0x00,
  662. DAC960_V1_OEMID_IBM = 0x08,
  663. DAC960_V1_OEMID_HP = 0x0A,
  664. DAC960_V1_OEMID_DEC = 0x0C,
  665. DAC960_V1_OEMID_Siemens = 0x10,
  666. DAC960_V1_OEMID_Intel = 0x12
  667. } __attribute__ ((packed)) OEMID; /* Byte 2 */
  668. unsigned char OEMModelNumber; /* Byte 3 */
  669. unsigned char PhysicalSector; /* Byte 4 */
  670. unsigned char LogicalSector; /* Byte 5 */
  671. unsigned char BlockFactor; /* Byte 6 */
  672. bool ReadAheadEnabled:1; /* Byte 7 Bit 0 */
  673. bool LowBIOSDelay:1; /* Byte 7 Bit 1 */
  674. unsigned char :2; /* Byte 7 Bits 2-3 */
  675. bool ReassignRestrictedToOneSector:1; /* Byte 7 Bit 4 */
  676. unsigned char :1; /* Byte 7 Bit 5 */
  677. bool ForceUnitAccessDuringWriteRecovery:1; /* Byte 7 Bit 6 */
  678. bool EnableLeftSymmetricRAID5Algorithm:1; /* Byte 7 Bit 7 */
  679. unsigned char DefaultRebuildRate; /* Byte 8 */
  680. unsigned char :8; /* Byte 9 */
  681. unsigned char BlocksPerCacheLine; /* Byte 10 */
  682. unsigned char BlocksPerStripe; /* Byte 11 */
  683. struct {
  684. enum {
  685. DAC960_V1_Async = 0x0,
  686. DAC960_V1_Sync_8MHz = 0x1,
  687. DAC960_V1_Sync_5MHz = 0x2,
  688. DAC960_V1_Sync_10or20MHz = 0x3 /* Byte 11 Bits 0-1 */
  689. } __attribute__ ((packed)) Speed:2;
  690. bool Force8Bit:1; /* Byte 11 Bit 2 */
  691. bool DisableFast20:1; /* Byte 11 Bit 3 */
  692. unsigned char :3; /* Byte 11 Bits 4-6 */
  693. bool EnableTaggedQueuing:1; /* Byte 11 Bit 7 */
  694. } __attribute__ ((packed)) ChannelParameters[6]; /* Bytes 12-17 */
  695. unsigned char SCSIInitiatorID; /* Byte 18 */
  696. unsigned char :8; /* Byte 19 */
  697. enum {
  698. DAC960_V1_StartupMode_ControllerSpinUp = 0x00,
  699. DAC960_V1_StartupMode_PowerOnSpinUp = 0x01
  700. } __attribute__ ((packed)) StartupMode; /* Byte 20 */
  701. unsigned char SimultaneousDeviceSpinUpCount; /* Byte 21 */
  702. unsigned char SecondsDelayBetweenSpinUps; /* Byte 22 */
  703. unsigned char Reserved1[29]; /* Bytes 23-51 */
  704. bool BIOSDisabled:1; /* Byte 52 Bit 0 */
  705. bool CDROMBootEnabled:1; /* Byte 52 Bit 1 */
  706. unsigned char :3; /* Byte 52 Bits 2-4 */
  707. enum {
  708. DAC960_V1_Geometry_128_32 = 0x0,
  709. DAC960_V1_Geometry_255_63 = 0x1,
  710. DAC960_V1_Geometry_Reserved1 = 0x2,
  711. DAC960_V1_Geometry_Reserved2 = 0x3
  712. } __attribute__ ((packed)) DriveGeometry:2; /* Byte 52 Bits 5-6 */
  713. unsigned char :1; /* Byte 52 Bit 7 */
  714. unsigned char Reserved2[9]; /* Bytes 53-61 */
  715. unsigned short Checksum; /* Bytes 62-63 */
  716. }
  717. DAC960_V1_Config2_T;
  718. /*
  719. Define the DAC960 V1 Firmware DCDB request structure.
  720. */
  721. typedef struct DAC960_V1_DCDB
  722. {
  723. unsigned char TargetID:4; /* Byte 0 Bits 0-3 */
  724. unsigned char Channel:4; /* Byte 0 Bits 4-7 */
  725. enum {
  726. DAC960_V1_DCDB_NoDataTransfer = 0,
  727. DAC960_V1_DCDB_DataTransferDeviceToSystem = 1,
  728. DAC960_V1_DCDB_DataTransferSystemToDevice = 2,
  729. DAC960_V1_DCDB_IllegalDataTransfer = 3
  730. } __attribute__ ((packed)) Direction:2; /* Byte 1 Bits 0-1 */
  731. bool EarlyStatus:1; /* Byte 1 Bit 2 */
  732. unsigned char :1; /* Byte 1 Bit 3 */
  733. enum {
  734. DAC960_V1_DCDB_Timeout_24_hours = 0,
  735. DAC960_V1_DCDB_Timeout_10_seconds = 1,
  736. DAC960_V1_DCDB_Timeout_60_seconds = 2,
  737. DAC960_V1_DCDB_Timeout_10_minutes = 3
  738. } __attribute__ ((packed)) Timeout:2; /* Byte 1 Bits 4-5 */
  739. bool NoAutomaticRequestSense:1; /* Byte 1 Bit 6 */
  740. bool DisconnectPermitted:1; /* Byte 1 Bit 7 */
  741. unsigned short TransferLength; /* Bytes 2-3 */
  742. DAC960_BusAddress32_T BusAddress; /* Bytes 4-7 */
  743. unsigned char CDBLength:4; /* Byte 8 Bits 0-3 */
  744. unsigned char TransferLengthHigh4:4; /* Byte 8 Bits 4-7 */
  745. unsigned char SenseLength; /* Byte 9 */
  746. unsigned char CDB[12]; /* Bytes 10-21 */
  747. unsigned char SenseData[64]; /* Bytes 22-85 */
  748. unsigned char Status; /* Byte 86 */
  749. unsigned char :8; /* Byte 87 */
  750. }
  751. DAC960_V1_DCDB_T;
  752. /*
  753. Define the DAC960 V1 Firmware Scatter/Gather List Type 1 32 Bit Address
  754. 32 Bit Byte Count structure.
  755. */
  756. typedef struct DAC960_V1_ScatterGatherSegment
  757. {
  758. DAC960_BusAddress32_T SegmentDataPointer; /* Bytes 0-3 */
  759. DAC960_ByteCount32_T SegmentByteCount; /* Bytes 4-7 */
  760. }
  761. DAC960_V1_ScatterGatherSegment_T;
  762. /*
  763. Define the 13 Byte DAC960 V1 Firmware Command Mailbox structure. Bytes 13-15
  764. are not used. The Command Mailbox structure is padded to 16 bytes for
  765. efficient access.
  766. */
  767. typedef union DAC960_V1_CommandMailbox
  768. {
  769. unsigned int Words[4]; /* Words 0-3 */
  770. unsigned char Bytes[16]; /* Bytes 0-15 */
  771. struct {
  772. DAC960_V1_CommandOpcode_T CommandOpcode; /* Byte 0 */
  773. DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 1 */
  774. unsigned char Dummy[14]; /* Bytes 2-15 */
  775. } __attribute__ ((packed)) Common;
  776. struct {
  777. DAC960_V1_CommandOpcode_T CommandOpcode; /* Byte 0 */
  778. DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 1 */
  779. unsigned char Dummy1[6]; /* Bytes 2-7 */
  780. DAC960_BusAddress32_T BusAddress; /* Bytes 8-11 */
  781. unsigned char Dummy2[4]; /* Bytes 12-15 */
  782. } __attribute__ ((packed)) Type3;
  783. struct {
  784. DAC960_V1_CommandOpcode_T CommandOpcode; /* Byte 0 */
  785. DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 1 */
  786. unsigned char CommandOpcode2; /* Byte 2 */
  787. unsigned char Dummy1[5]; /* Bytes 3-7 */
  788. DAC960_BusAddress32_T BusAddress; /* Bytes 8-11 */
  789. unsigned char Dummy2[4]; /* Bytes 12-15 */
  790. } __attribute__ ((packed)) Type3B;
  791. struct {
  792. DAC960_V1_CommandOpcode_T CommandOpcode; /* Byte 0 */
  793. DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 1 */
  794. unsigned char Dummy1[5]; /* Bytes 2-6 */
  795. unsigned char LogicalDriveNumber:6; /* Byte 7 Bits 0-6 */
  796. bool AutoRestore:1; /* Byte 7 Bit 7 */
  797. unsigned char Dummy2[8]; /* Bytes 8-15 */
  798. } __attribute__ ((packed)) Type3C;
  799. struct {
  800. DAC960_V1_CommandOpcode_T CommandOpcode; /* Byte 0 */
  801. DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 1 */
  802. unsigned char Channel; /* Byte 2 */
  803. unsigned char TargetID; /* Byte 3 */
  804. DAC960_V1_PhysicalDeviceState_T DeviceState:5; /* Byte 4 Bits 0-4 */
  805. unsigned char Modifier:3; /* Byte 4 Bits 5-7 */
  806. unsigned char Dummy1[3]; /* Bytes 5-7 */
  807. DAC960_BusAddress32_T BusAddress; /* Bytes 8-11 */
  808. unsigned char Dummy2[4]; /* Bytes 12-15 */
  809. } __attribute__ ((packed)) Type3D;
  810. struct {
  811. DAC960_V1_CommandOpcode_T CommandOpcode; /* Byte 0 */
  812. DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 1 */
  813. DAC960_V1_PerformEventLogOpType_T OperationType; /* Byte 2 */
  814. unsigned char OperationQualifier; /* Byte 3 */
  815. unsigned short SequenceNumber; /* Bytes 4-5 */
  816. unsigned char Dummy1[2]; /* Bytes 6-7 */
  817. DAC960_BusAddress32_T BusAddress; /* Bytes 8-11 */
  818. unsigned char Dummy2[4]; /* Bytes 12-15 */
  819. } __attribute__ ((packed)) Type3E;
  820. struct {
  821. DAC960_V1_CommandOpcode_T CommandOpcode; /* Byte 0 */
  822. DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 1 */
  823. unsigned char Dummy1[2]; /* Bytes 2-3 */
  824. unsigned char RebuildRateConstant; /* Byte 4 */
  825. unsigned char Dummy2[3]; /* Bytes 5-7 */
  826. DAC960_BusAddress32_T BusAddress; /* Bytes 8-11 */
  827. unsigned char Dummy3[4]; /* Bytes 12-15 */
  828. } __attribute__ ((packed)) Type3R;
  829. struct {
  830. DAC960_V1_CommandOpcode_T CommandOpcode; /* Byte 0 */
  831. DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 1 */
  832. unsigned short TransferLength; /* Bytes 2-3 */
  833. unsigned int LogicalBlockAddress; /* Bytes 4-7 */
  834. DAC960_BusAddress32_T BusAddress; /* Bytes 8-11 */
  835. unsigned char LogicalDriveNumber; /* Byte 12 */
  836. unsigned char Dummy[3]; /* Bytes 13-15 */
  837. } __attribute__ ((packed)) Type4;
  838. struct {
  839. DAC960_V1_CommandOpcode_T CommandOpcode; /* Byte 0 */
  840. DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 1 */
  841. struct {
  842. unsigned short TransferLength:11; /* Bytes 2-3 */
  843. unsigned char LogicalDriveNumber:5; /* Byte 3 Bits 3-7 */
  844. } __attribute__ ((packed)) LD;
  845. unsigned int LogicalBlockAddress; /* Bytes 4-7 */
  846. DAC960_BusAddress32_T BusAddress; /* Bytes 8-11 */
  847. unsigned char ScatterGatherCount:6; /* Byte 12 Bits 0-5 */
  848. enum {
  849. DAC960_V1_ScatterGather_32BitAddress_32BitByteCount = 0x0,
  850. DAC960_V1_ScatterGather_32BitAddress_16BitByteCount = 0x1,
  851. DAC960_V1_ScatterGather_32BitByteCount_32BitAddress = 0x2,
  852. DAC960_V1_ScatterGather_16BitByteCount_32BitAddress = 0x3
  853. } __attribute__ ((packed)) ScatterGatherType:2; /* Byte 12 Bits 6-7 */
  854. unsigned char Dummy[3]; /* Bytes 13-15 */
  855. } __attribute__ ((packed)) Type5;
  856. struct {
  857. DAC960_V1_CommandOpcode_T CommandOpcode; /* Byte 0 */
  858. DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 1 */
  859. unsigned char CommandOpcode2; /* Byte 2 */
  860. unsigned char :8; /* Byte 3 */
  861. DAC960_BusAddress32_T CommandMailboxesBusAddress; /* Bytes 4-7 */
  862. DAC960_BusAddress32_T StatusMailboxesBusAddress; /* Bytes 8-11 */
  863. unsigned char Dummy[4]; /* Bytes 12-15 */
  864. } __attribute__ ((packed)) TypeX;
  865. }
  866. DAC960_V1_CommandMailbox_T;
  867. /*
  868. Define the DAC960 V2 Firmware Command Opcodes.
  869. */
  870. typedef enum
  871. {
  872. DAC960_V2_MemCopy = 0x01,
  873. DAC960_V2_SCSI_10_Passthru = 0x02,
  874. DAC960_V2_SCSI_255_Passthru = 0x03,
  875. DAC960_V2_SCSI_10 = 0x04,
  876. DAC960_V2_SCSI_256 = 0x05,
  877. DAC960_V2_IOCTL = 0x20
  878. }
  879. __attribute__ ((packed))
  880. DAC960_V2_CommandOpcode_T;
  881. /*
  882. Define the DAC960 V2 Firmware IOCTL Opcodes.
  883. */
  884. typedef enum
  885. {
  886. DAC960_V2_GetControllerInfo = 0x01,
  887. DAC960_V2_GetLogicalDeviceInfoValid = 0x03,
  888. DAC960_V2_GetPhysicalDeviceInfoValid = 0x05,
  889. DAC960_V2_GetHealthStatus = 0x11,
  890. DAC960_V2_GetEvent = 0x15,
  891. DAC960_V2_StartDiscovery = 0x81,
  892. DAC960_V2_SetDeviceState = 0x82,
  893. DAC960_V2_RebuildDeviceStart = 0x88,
  894. DAC960_V2_RebuildDeviceStop = 0x89,
  895. DAC960_V2_ConsistencyCheckStart = 0x8C,
  896. DAC960_V2_ConsistencyCheckStop = 0x8D,
  897. DAC960_V2_SetMemoryMailbox = 0x8E,
  898. DAC960_V2_PauseDevice = 0x92,
  899. DAC960_V2_TranslatePhysicalToLogicalDevice = 0xC5
  900. }
  901. __attribute__ ((packed))
  902. DAC960_V2_IOCTL_Opcode_T;
  903. /*
  904. Define the DAC960 V2 Firmware Command Identifier type.
  905. */
  906. typedef unsigned short DAC960_V2_CommandIdentifier_T;
  907. /*
  908. Define the DAC960 V2 Firmware Command Status Codes.
  909. */
  910. #define DAC960_V2_NormalCompletion 0x00
  911. #define DAC960_V2_AbormalCompletion 0x02
  912. #define DAC960_V2_DeviceBusy 0x08
  913. #define DAC960_V2_DeviceNonresponsive 0x0E
  914. #define DAC960_V2_DeviceNonresponsive2 0x0F
  915. #define DAC960_V2_DeviceRevervationConflict 0x18
  916. typedef unsigned char DAC960_V2_CommandStatus_T;
  917. /*
  918. Define the DAC960 V2 Firmware Memory Type structure.
  919. */
  920. typedef struct DAC960_V2_MemoryType
  921. {
  922. enum {
  923. DAC960_V2_MemoryType_Reserved = 0x00,
  924. DAC960_V2_MemoryType_DRAM = 0x01,
  925. DAC960_V2_MemoryType_EDRAM = 0x02,
  926. DAC960_V2_MemoryType_EDO = 0x03,
  927. DAC960_V2_MemoryType_SDRAM = 0x04,
  928. DAC960_V2_MemoryType_Last = 0x1F
  929. } __attribute__ ((packed)) MemoryType:5; /* Byte 0 Bits 0-4 */
  930. bool :1; /* Byte 0 Bit 5 */
  931. bool MemoryParity:1; /* Byte 0 Bit 6 */
  932. bool MemoryECC:1; /* Byte 0 Bit 7 */
  933. }
  934. DAC960_V2_MemoryType_T;
  935. /*
  936. Define the DAC960 V2 Firmware Processor Type structure.
  937. */
  938. typedef enum
  939. {
  940. DAC960_V2_ProcessorType_i960CA = 0x01,
  941. DAC960_V2_ProcessorType_i960RD = 0x02,
  942. DAC960_V2_ProcessorType_i960RN = 0x03,
  943. DAC960_V2_ProcessorType_i960RP = 0x04,
  944. DAC960_V2_ProcessorType_NorthBay = 0x05,
  945. DAC960_V2_ProcessorType_StrongArm = 0x06,
  946. DAC960_V2_ProcessorType_i960RM = 0x07
  947. }
  948. __attribute__ ((packed))
  949. DAC960_V2_ProcessorType_T;
  950. /*
  951. Define the DAC960 V2 Firmware Get Controller Info reply structure.
  952. */
  953. typedef struct DAC960_V2_ControllerInfo
  954. {
  955. unsigned char :8; /* Byte 0 */
  956. enum {
  957. DAC960_V2_SCSI_Bus = 0x00,
  958. DAC960_V2_Fibre_Bus = 0x01,
  959. DAC960_V2_PCI_Bus = 0x03
  960. } __attribute__ ((packed)) BusInterfaceType; /* Byte 1 */
  961. enum {
  962. DAC960_V2_DAC960E = 0x01,
  963. DAC960_V2_DAC960M = 0x08,
  964. DAC960_V2_DAC960PD = 0x10,
  965. DAC960_V2_DAC960PL = 0x11,
  966. DAC960_V2_DAC960PU = 0x12,
  967. DAC960_V2_DAC960PE = 0x13,
  968. DAC960_V2_DAC960PG = 0x14,
  969. DAC960_V2_DAC960PJ = 0x15,
  970. DAC960_V2_DAC960PTL0 = 0x16,
  971. DAC960_V2_DAC960PR = 0x17,
  972. DAC960_V2_DAC960PRL = 0x18,
  973. DAC960_V2_DAC960PT = 0x19,
  974. DAC960_V2_DAC1164P = 0x1A,
  975. DAC960_V2_DAC960PTL1 = 0x1B,
  976. DAC960_V2_EXR2000P = 0x1C,
  977. DAC960_V2_EXR3000P = 0x1D,
  978. DAC960_V2_AcceleRAID352 = 0x1E,
  979. DAC960_V2_AcceleRAID170 = 0x1F,
  980. DAC960_V2_AcceleRAID160 = 0x20,
  981. DAC960_V2_DAC960S = 0x60,
  982. DAC960_V2_DAC960SU = 0x61,
  983. DAC960_V2_DAC960SX = 0x62,
  984. DAC960_V2_DAC960SF = 0x63,
  985. DAC960_V2_DAC960SS = 0x64,
  986. DAC960_V2_DAC960FL = 0x65,
  987. DAC960_V2_DAC960LL = 0x66,
  988. DAC960_V2_DAC960FF = 0x67,
  989. DAC960_V2_DAC960HP = 0x68,
  990. DAC960_V2_RAIDBRICK = 0x69,
  991. DAC960_V2_METEOR_FL = 0x6A,
  992. DAC960_V2_METEOR_FF = 0x6B
  993. } __attribute__ ((packed)) ControllerType; /* Byte 2 */
  994. unsigned char :8; /* Byte 3 */
  995. unsigned short BusInterfaceSpeedMHz; /* Bytes 4-5 */
  996. unsigned char BusWidthBits; /* Byte 6 */
  997. unsigned char FlashCodeTypeOrProductID; /* Byte 7 */
  998. unsigned char NumberOfHostPortsPresent; /* Byte 8 */
  999. unsigned char Reserved1[7]; /* Bytes 9-15 */
  1000. unsigned char BusInterfaceName[16]; /* Bytes 16-31 */
  1001. unsigned char ControllerName[16]; /* Bytes 32-47 */
  1002. unsigned char Reserved2[16]; /* Bytes 48-63 */
  1003. /* Firmware Release Information */
  1004. unsigned char FirmwareMajorVersion; /* Byte 64 */
  1005. unsigned char FirmwareMinorVersion; /* Byte 65 */
  1006. unsigned char FirmwareTurnNumber; /* Byte 66 */
  1007. unsigned char FirmwareBuildNumber; /* Byte 67 */
  1008. unsigned char FirmwareReleaseDay; /* Byte 68 */
  1009. unsigned char FirmwareReleaseMonth; /* Byte 69 */
  1010. unsigned char FirmwareReleaseYearHigh2Digits; /* Byte 70 */
  1011. unsigned char FirmwareReleaseYearLow2Digits; /* Byte 71 */
  1012. /* Hardware Release Information */
  1013. unsigned char HardwareRevision; /* Byte 72 */
  1014. unsigned int :24; /* Bytes 73-75 */
  1015. unsigned char HardwareReleaseDay; /* Byte 76 */
  1016. unsigned char HardwareReleaseMonth; /* Byte 77 */
  1017. unsigned char HardwareReleaseYearHigh2Digits; /* Byte 78 */
  1018. unsigned char HardwareReleaseYearLow2Digits; /* Byte 79 */
  1019. /* Hardware Manufacturing Information */
  1020. unsigned char ManufacturingBatchNumber; /* Byte 80 */
  1021. unsigned char :8; /* Byte 81 */
  1022. unsigned char ManufacturingPlantNumber; /* Byte 82 */
  1023. unsigned char :8; /* Byte 83 */
  1024. unsigned char HardwareManufacturingDay; /* Byte 84 */
  1025. unsigned char HardwareManufacturingMonth; /* Byte 85 */
  1026. unsigned char HardwareManufacturingYearHigh2Digits; /* Byte 86 */
  1027. unsigned char HardwareManufacturingYearLow2Digits; /* Byte 87 */
  1028. unsigned char MaximumNumberOfPDDperXLD; /* Byte 88 */
  1029. unsigned char MaximumNumberOfILDperXLD; /* Byte 89 */
  1030. unsigned short NonvolatileMemorySizeKB; /* Bytes 90-91 */
  1031. unsigned char MaximumNumberOfXLD; /* Byte 92 */
  1032. unsigned int :24; /* Bytes 93-95 */
  1033. /* Unique Information per Controller */
  1034. unsigned char ControllerSerialNumber[16]; /* Bytes 96-111 */
  1035. unsigned char Reserved3[16]; /* Bytes 112-127 */
  1036. /* Vendor Information */
  1037. unsigned int :24; /* Bytes 128-130 */
  1038. unsigned char OEM_Code; /* Byte 131 */
  1039. unsigned char VendorName[16]; /* Bytes 132-147 */
  1040. /* Other Physical/Controller/Operation Information */
  1041. bool BBU_Present:1; /* Byte 148 Bit 0 */
  1042. bool ActiveActiveClusteringMode:1; /* Byte 148 Bit 1 */
  1043. unsigned char :6; /* Byte 148 Bits 2-7 */
  1044. unsigned char :8; /* Byte 149 */
  1045. unsigned short :16; /* Bytes 150-151 */
  1046. /* Physical Device Scan Information */
  1047. bool PhysicalScanActive:1; /* Byte 152 Bit 0 */
  1048. unsigned char :7; /* Byte 152 Bits 1-7 */
  1049. unsigned char PhysicalDeviceChannelNumber; /* Byte 153 */
  1050. unsigned char PhysicalDeviceTargetID; /* Byte 154 */
  1051. unsigned char PhysicalDeviceLogicalUnit; /* Byte 155 */
  1052. /* Maximum Command Data Transfer Sizes */
  1053. unsigned short MaximumDataTransferSizeInBlocks; /* Bytes 156-157 */
  1054. unsigned short MaximumScatterGatherEntries; /* Bytes 158-159 */
  1055. /* Logical/Physical Device Counts */
  1056. unsigned short LogicalDevicesPresent; /* Bytes 160-161 */
  1057. unsigned short LogicalDevicesCritical; /* Bytes 162-163 */
  1058. unsigned short LogicalDevicesOffline; /* Bytes 164-165 */
  1059. unsigned short PhysicalDevicesPresent; /* Bytes 166-167 */
  1060. unsigned short PhysicalDisksPresent; /* Bytes 168-169 */
  1061. unsigned short PhysicalDisksCritical; /* Bytes 170-171 */
  1062. unsigned short PhysicalDisksOffline; /* Bytes 172-173 */
  1063. unsigned short MaximumParallelCommands; /* Bytes 174-175 */
  1064. /* Channel and Target ID Information */
  1065. unsigned char NumberOfPhysicalChannelsPresent; /* Byte 176 */
  1066. unsigned char NumberOfVirtualChannelsPresent; /* Byte 177 */
  1067. unsigned char NumberOfPhysicalChannelsPossible; /* Byte 178 */
  1068. unsigned char NumberOfVirtualChannelsPossible; /* Byte 179 */
  1069. unsigned char MaximumTargetsPerChannel[16]; /* Bytes 180-195 */
  1070. unsigned char Reserved4[12]; /* Bytes 196-207 */
  1071. /* Memory/Cache Information */
  1072. unsigned short MemorySizeMB; /* Bytes 208-209 */
  1073. unsigned short CacheSizeMB; /* Bytes 210-211 */
  1074. unsigned int ValidCacheSizeInBytes; /* Bytes 212-215 */
  1075. unsigned int DirtyCacheSizeInBytes; /* Bytes 216-219 */
  1076. unsigned short MemorySpeedMHz; /* Bytes 220-221 */
  1077. unsigned char MemoryDataWidthBits; /* Byte 222 */
  1078. DAC960_V2_MemoryType_T MemoryType; /* Byte 223 */
  1079. unsigned char CacheMemoryTypeName[16]; /* Bytes 224-239 */
  1080. /* Execution Memory Information */
  1081. unsigned short ExecutionMemorySizeMB; /* Bytes 240-241 */
  1082. unsigned short ExecutionL2CacheSizeMB; /* Bytes 242-243 */
  1083. unsigned char Reserved5[8]; /* Bytes 244-251 */
  1084. unsigned short ExecutionMemorySpeedMHz; /* Bytes 252-253 */
  1085. unsigned char ExecutionMemoryDataWidthBits; /* Byte 254 */
  1086. DAC960_V2_MemoryType_T ExecutionMemoryType; /* Byte 255 */
  1087. unsigned char ExecutionMemoryTypeName[16]; /* Bytes 256-271 */
  1088. /* First CPU Type Information */
  1089. unsigned short FirstProcessorSpeedMHz; /* Bytes 272-273 */
  1090. DAC960_V2_ProcessorType_T FirstProcessorType; /* Byte 274 */
  1091. unsigned char FirstProcessorCount; /* Byte 275 */
  1092. unsigned char Reserved6[12]; /* Bytes 276-287 */
  1093. unsigned char FirstProcessorName[16]; /* Bytes 288-303 */
  1094. /* Second CPU Type Information */
  1095. unsigned short SecondProcessorSpeedMHz; /* Bytes 304-305 */
  1096. DAC960_V2_ProcessorType_T SecondProcessorType; /* Byte 306 */
  1097. unsigned char SecondProcessorCount; /* Byte 307 */
  1098. unsigned char Reserved7[12]; /* Bytes 308-319 */
  1099. unsigned char SecondProcessorName[16]; /* Bytes 320-335 */
  1100. /* Debugging/Profiling/Command Time Tracing Information */
  1101. unsigned short CurrentProfilingDataPageNumber; /* Bytes 336-337 */
  1102. unsigned short ProgramsAwaitingProfilingData; /* Bytes 338-339 */
  1103. unsigned short CurrentCommandTimeTraceDataPageNumber; /* Bytes 340-341 */
  1104. unsigned short ProgramsAwaitingCommandTimeTraceData; /* Bytes 342-343 */
  1105. unsigned char Reserved8[8]; /* Bytes 344-351 */
  1106. /* Error Counters on Physical Devices */
  1107. unsigned short PhysicalDeviceBusResets; /* Bytes 352-353 */
  1108. unsigned short PhysicalDeviceParityErrors; /* Bytes 355-355 */
  1109. unsigned short PhysicalDeviceSoftErrors; /* Bytes 356-357 */
  1110. unsigned short PhysicalDeviceCommandsFailed; /* Bytes 358-359 */
  1111. unsigned short PhysicalDeviceMiscellaneousErrors; /* Bytes 360-361 */
  1112. unsigned short PhysicalDeviceCommandTimeouts; /* Bytes 362-363 */
  1113. unsigned short PhysicalDeviceSelectionTimeouts; /* Bytes 364-365 */
  1114. unsigned short PhysicalDeviceRetriesDone; /* Bytes 366-367 */
  1115. unsigned short PhysicalDeviceAbortsDone; /* Bytes 368-369 */
  1116. unsigned short PhysicalDeviceHostCommandAbortsDone; /* Bytes 370-371 */
  1117. unsigned short PhysicalDevicePredictedFailuresDetected; /* Bytes 372-373 */
  1118. unsigned short PhysicalDeviceHostCommandsFailed; /* Bytes 374-375 */
  1119. unsigned short PhysicalDeviceHardErrors; /* Bytes 376-377 */
  1120. unsigned char Reserved9[6]; /* Bytes 378-383 */
  1121. /* Error Counters on Logical Devices */
  1122. unsigned short LogicalDeviceSoftErrors; /* Bytes 384-385 */
  1123. unsigned short LogicalDeviceCommandsFailed; /* Bytes 386-387 */
  1124. unsigned short LogicalDeviceHostCommandAbortsDone; /* Bytes 388-389 */
  1125. unsigned short :16; /* Bytes 390-391 */
  1126. /* Error Counters on Controller */
  1127. unsigned short ControllerMemoryErrors; /* Bytes 392-393 */
  1128. unsigned short ControllerHostCommandAbortsDone; /* Bytes 394-395 */
  1129. unsigned int :32; /* Bytes 396-399 */
  1130. /* Long Duration Activity Information */
  1131. unsigned short BackgroundInitializationsActive; /* Bytes 400-401 */
  1132. unsigned short LogicalDeviceInitializationsActive; /* Bytes 402-403 */
  1133. unsigned short PhysicalDeviceInitializationsActive; /* Bytes 404-405 */
  1134. unsigned short ConsistencyChecksActive; /* Bytes 406-407 */
  1135. unsigned short RebuildsActive; /* Bytes 408-409 */
  1136. unsigned short OnlineExpansionsActive; /* Bytes 410-411 */
  1137. unsigned short PatrolActivitiesActive; /* Bytes 412-413 */
  1138. unsigned short :16; /* Bytes 414-415 */
  1139. /* Flash ROM Information */
  1140. unsigned char FlashType; /* Byte 416 */
  1141. unsigned char :8; /* Byte 417 */
  1142. unsigned short FlashSizeMB; /* Bytes 418-419 */
  1143. unsigned int FlashLimit; /* Bytes 420-423 */
  1144. unsigned int FlashCount; /* Bytes 424-427 */
  1145. unsigned int :32; /* Bytes 428-431 */
  1146. unsigned char FlashTypeName[16]; /* Bytes 432-447 */
  1147. /* Firmware Run Time Information */
  1148. unsigned char RebuildRate; /* Byte 448 */
  1149. unsigned char BackgroundInitializationRate; /* Byte 449 */
  1150. unsigned char ForegroundInitializationRate; /* Byte 450 */
  1151. unsigned char ConsistencyCheckRate; /* Byte 451 */
  1152. unsigned int :32; /* Bytes 452-455 */
  1153. unsigned int MaximumDP; /* Bytes 456-459 */
  1154. unsigned int FreeDP; /* Bytes 460-463 */
  1155. unsigned int MaximumIOP; /* Bytes 464-467 */
  1156. unsigned int FreeIOP; /* Bytes 468-471 */
  1157. unsigned short MaximumCombLengthInBlocks; /* Bytes 472-473 */
  1158. unsigned short NumberOfConfigurationGroups; /* Bytes 474-475 */
  1159. bool InstallationAbortStatus:1; /* Byte 476 Bit 0 */
  1160. bool MaintenanceModeStatus:1; /* Byte 476 Bit 1 */
  1161. unsigned int :24; /* Bytes 476-479 */
  1162. unsigned char Reserved10[32]; /* Bytes 480-511 */
  1163. unsigned char Reserved11[512]; /* Bytes 512-1023 */
  1164. }
  1165. DAC960_V2_ControllerInfo_T;
  1166. /*
  1167. Define the DAC960 V2 Firmware Logical Device State type.
  1168. */
  1169. typedef enum
  1170. {
  1171. DAC960_V2_LogicalDevice_Online = 0x01,
  1172. DAC960_V2_LogicalDevice_Offline = 0x08,
  1173. DAC960_V2_LogicalDevice_Critical = 0x09
  1174. }
  1175. __attribute__ ((packed))
  1176. DAC960_V2_LogicalDeviceState_T;
  1177. /*
  1178. Define the DAC960 V2 Firmware Get Logical Device Info reply structure.
  1179. */
  1180. typedef struct DAC960_V2_LogicalDeviceInfo
  1181. {
  1182. unsigned char :8; /* Byte 0 */
  1183. unsigned char Channel; /* Byte 1 */
  1184. unsigned char TargetID; /* Byte 2 */
  1185. unsigned char LogicalUnit; /* Byte 3 */
  1186. DAC960_V2_LogicalDeviceState_T LogicalDeviceState; /* Byte 4 */
  1187. unsigned char RAIDLevel; /* Byte 5 */
  1188. unsigned char StripeSize; /* Byte 6 */
  1189. unsigned char CacheLineSize; /* Byte 7 */
  1190. struct {
  1191. enum {
  1192. DAC960_V2_ReadCacheDisabled = 0x0,
  1193. DAC960_V2_ReadCacheEnabled = 0x1,
  1194. DAC960_V2_ReadAheadEnabled = 0x2,
  1195. DAC960_V2_IntelligentReadAheadEnabled = 0x3,
  1196. DAC960_V2_ReadCache_Last = 0x7
  1197. } __attribute__ ((packed)) ReadCache:3; /* Byte 8 Bits 0-2 */
  1198. enum {
  1199. DAC960_V2_WriteCacheDisabled = 0x0,
  1200. DAC960_V2_LogicalDeviceReadOnly = 0x1,
  1201. DAC960_V2_WriteCacheEnabled = 0x2,
  1202. DAC960_V2_IntelligentWriteCacheEnabled = 0x3,
  1203. DAC960_V2_WriteCache_Last = 0x7
  1204. } __attribute__ ((packed)) WriteCache:3; /* Byte 8 Bits 3-5 */
  1205. bool :1; /* Byte 8 Bit 6 */
  1206. bool LogicalDeviceInitialized:1; /* Byte 8 Bit 7 */
  1207. } LogicalDeviceControl; /* Byte 8 */
  1208. /* Logical Device Operations Status */
  1209. bool ConsistencyCheckInProgress:1; /* Byte 9 Bit 0 */
  1210. bool RebuildInProgress:1; /* Byte 9 Bit 1 */
  1211. bool BackgroundInitializationInProgress:1; /* Byte 9 Bit 2 */
  1212. bool ForegroundInitializationInProgress:1; /* Byte 9 Bit 3 */
  1213. bool DataMigrationInProgress:1; /* Byte 9 Bit 4 */
  1214. bool PatrolOperationInProgress:1; /* Byte 9 Bit 5 */
  1215. unsigned char :2; /* Byte 9 Bits 6-7 */
  1216. unsigned char RAID5WriteUpdate; /* Byte 10 */
  1217. unsigned char RAID5Algorithm; /* Byte 11 */
  1218. unsigned short LogicalDeviceNumber; /* Bytes 12-13 */
  1219. /* BIOS Info */
  1220. bool BIOSDisabled:1; /* Byte 14 Bit 0 */
  1221. bool CDROMBootEnabled:1; /* Byte 14 Bit 1 */
  1222. bool DriveCoercionEnabled:1; /* Byte 14 Bit 2 */
  1223. bool WriteSameDisabled:1; /* Byte 14 Bit 3 */
  1224. bool HBA_ModeEnabled:1; /* Byte 14 Bit 4 */
  1225. enum {
  1226. DAC960_V2_Geometry_128_32 = 0x0,
  1227. DAC960_V2_Geometry_255_63 = 0x1,
  1228. DAC960_V2_Geometry_Reserved1 = 0x2,
  1229. DAC960_V2_Geometry_Reserved2 = 0x3
  1230. } __attribute__ ((packed)) DriveGeometry:2; /* Byte 14 Bits 5-6 */
  1231. bool SuperReadAheadEnabled:1; /* Byte 14 Bit 7 */
  1232. unsigned char :8; /* Byte 15 */
  1233. /* Error Counters */
  1234. unsigned short SoftErrors; /* Bytes 16-17 */
  1235. unsigned short CommandsFailed; /* Bytes 18-19 */
  1236. unsigned short HostCommandAbortsDone; /* Bytes 20-21 */
  1237. unsigned short DeferredWriteErrors; /* Bytes 22-23 */
  1238. unsigned int :32; /* Bytes 24-27 */
  1239. unsigned int :32; /* Bytes 28-31 */
  1240. /* Device Size Information */
  1241. unsigned short :16; /* Bytes 32-33 */
  1242. unsigned short DeviceBlockSizeInBytes; /* Bytes 34-35 */
  1243. unsigned int OriginalDeviceSize; /* Bytes 36-39 */
  1244. unsigned int ConfigurableDeviceSize; /* Bytes 40-43 */
  1245. unsigned int :32; /* Bytes 44-47 */
  1246. unsigned char LogicalDeviceName[32]; /* Bytes 48-79 */
  1247. unsigned char SCSI_InquiryData[36]; /* Bytes 80-115 */
  1248. unsigned char Reserved1[12]; /* Bytes 116-127 */
  1249. DAC960_ByteCount64_T LastReadBlockNumber; /* Bytes 128-135 */
  1250. DAC960_ByteCount64_T LastWrittenBlockNumber; /* Bytes 136-143 */
  1251. DAC960_ByteCount64_T ConsistencyCheckBlockNumber; /* Bytes 144-151 */
  1252. DAC960_ByteCount64_T RebuildBlockNumber; /* Bytes 152-159 */
  1253. DAC960_ByteCount64_T BackgroundInitializationBlockNumber; /* Bytes 160-167 */
  1254. DAC960_ByteCount64_T ForegroundInitializationBlockNumber; /* Bytes 168-175 */
  1255. DAC960_ByteCount64_T DataMigrationBlockNumber; /* Bytes 176-183 */
  1256. DAC960_ByteCount64_T PatrolOperationBlockNumber; /* Bytes 184-191 */
  1257. unsigned char Reserved2[64]; /* Bytes 192-255 */
  1258. }
  1259. DAC960_V2_LogicalDeviceInfo_T;
  1260. /*
  1261. Define the DAC960 V2 Firmware Physical Device State type.
  1262. */
  1263. typedef enum
  1264. {
  1265. DAC960_V2_Device_Unconfigured = 0x00,
  1266. DAC960_V2_Device_Online = 0x01,
  1267. DAC960_V2_Device_Rebuild = 0x03,
  1268. DAC960_V2_Device_Missing = 0x04,
  1269. DAC960_V2_Device_Critical = 0x05,
  1270. DAC960_V2_Device_Dead = 0x08,
  1271. DAC960_V2_Device_SuspectedDead = 0x0C,
  1272. DAC960_V2_Device_CommandedOffline = 0x10,
  1273. DAC960_V2_Device_Standby = 0x21,
  1274. DAC960_V2_Device_InvalidState = 0xFF
  1275. }
  1276. __attribute__ ((packed))
  1277. DAC960_V2_PhysicalDeviceState_T;
  1278. /*
  1279. Define the DAC960 V2 Firmware Get Physical Device Info reply structure.
  1280. */
  1281. typedef struct DAC960_V2_PhysicalDeviceInfo
  1282. {
  1283. unsigned char :8; /* Byte 0 */
  1284. unsigned char Channel; /* Byte 1 */
  1285. unsigned char TargetID; /* Byte 2 */
  1286. unsigned char LogicalUnit; /* Byte 3 */
  1287. /* Configuration Status Bits */
  1288. bool PhysicalDeviceFaultTolerant:1; /* Byte 4 Bit 0 */
  1289. bool PhysicalDeviceConnected:1; /* Byte 4 Bit 1 */
  1290. bool PhysicalDeviceLocalToController:1; /* Byte 4 Bit 2 */
  1291. unsigned char :5; /* Byte 4 Bits 3-7 */
  1292. /* Multiple Host/Controller Status Bits */
  1293. bool RemoteHostSystemDead:1; /* Byte 5 Bit 0 */
  1294. bool RemoteControllerDead:1; /* Byte 5 Bit 1 */
  1295. unsigned char :6; /* Byte 5 Bits 2-7 */
  1296. DAC960_V2_PhysicalDeviceState_T PhysicalDeviceState; /* Byte 6 */
  1297. unsigned char NegotiatedDataWidthBits; /* Byte 7 */
  1298. unsigned short NegotiatedSynchronousMegaTransfers; /* Bytes 8-9 */
  1299. /* Multiported Physical Device Information */
  1300. unsigned char NumberOfPortConnections; /* Byte 10 */
  1301. unsigned char DriveAccessibilityBitmap; /* Byte 11 */
  1302. unsigned int :32; /* Bytes 12-15 */
  1303. unsigned char NetworkAddress[16]; /* Bytes 16-31 */
  1304. unsigned short MaximumTags; /* Bytes 32-33 */
  1305. /* Physical Device Operations Status */
  1306. bool ConsistencyCheckInProgress:1; /* Byte 34 Bit 0 */
  1307. bool RebuildInProgress:1; /* Byte 34 Bit 1 */
  1308. bool MakingDataConsistentInProgress:1; /* Byte 34 Bit 2 */
  1309. bool PhysicalDeviceInitializationInProgress:1; /* Byte 34 Bit 3 */
  1310. bool DataMigrationInProgress:1; /* Byte 34 Bit 4 */
  1311. bool PatrolOperationInProgress:1; /* Byte 34 Bit 5 */
  1312. unsigned char :2; /* Byte 34 Bits 6-7 */
  1313. unsigned char LongOperationStatus; /* Byte 35 */
  1314. unsigned char ParityErrors; /* Byte 36 */
  1315. unsigned char SoftErrors; /* Byte 37 */
  1316. unsigned char HardErrors; /* Byte 38 */
  1317. unsigned char MiscellaneousErrors; /* Byte 39 */
  1318. unsigned char CommandTimeouts; /* Byte 40 */
  1319. unsigned char Retries; /* Byte 41 */
  1320. unsigned char Aborts; /* Byte 42 */
  1321. unsigned char PredictedFailuresDetected; /* Byte 43 */
  1322. unsigned int :32; /* Bytes 44-47 */
  1323. unsigned short :16; /* Bytes 48-49 */
  1324. unsigned short DeviceBlockSizeInBytes; /* Bytes 50-51 */
  1325. unsigned int OriginalDeviceSize; /* Bytes 52-55 */
  1326. unsigned int ConfigurableDeviceSize; /* Bytes 56-59 */
  1327. unsigned int :32; /* Bytes 60-63 */
  1328. unsigned char PhysicalDeviceName[16]; /* Bytes 64-79 */
  1329. unsigned char Reserved1[16]; /* Bytes 80-95 */
  1330. unsigned char Reserved2[32]; /* Bytes 96-127 */
  1331. unsigned char SCSI_InquiryData[36]; /* Bytes 128-163 */
  1332. unsigned char Reserved3[20]; /* Bytes 164-183 */
  1333. unsigned char Reserved4[8]; /* Bytes 184-191 */
  1334. DAC960_ByteCount64_T LastReadBlockNumber; /* Bytes 192-199 */
  1335. DAC960_ByteCount64_T LastWrittenBlockNumber; /* Bytes 200-207 */
  1336. DAC960_ByteCount64_T ConsistencyCheckBlockNumber; /* Bytes 208-215 */
  1337. DAC960_ByteCount64_T RebuildBlockNumber; /* Bytes 216-223 */
  1338. DAC960_ByteCount64_T MakingDataConsistentBlockNumber; /* Bytes 224-231 */
  1339. DAC960_ByteCount64_T DeviceInitializationBlockNumber; /* Bytes 232-239 */
  1340. DAC960_ByteCount64_T DataMigrationBlockNumber; /* Bytes 240-247 */
  1341. DAC960_ByteCount64_T PatrolOperationBlockNumber; /* Bytes 248-255 */
  1342. unsigned char Reserved5[256]; /* Bytes 256-511 */
  1343. }
  1344. DAC960_V2_PhysicalDeviceInfo_T;
  1345. /*
  1346. Define the DAC960 V2 Firmware Health Status Buffer structure.
  1347. */
  1348. typedef struct DAC960_V2_HealthStatusBuffer
  1349. {
  1350. unsigned int MicrosecondsFromControllerStartTime; /* Bytes 0-3 */
  1351. unsigned int MillisecondsFromControllerStartTime; /* Bytes 4-7 */
  1352. unsigned int SecondsFrom1January1970; /* Bytes 8-11 */
  1353. unsigned int :32; /* Bytes 12-15 */
  1354. unsigned int StatusChangeCounter; /* Bytes 16-19 */
  1355. unsigned int :32; /* Bytes 20-23 */
  1356. unsigned int DebugOutputMessageBufferIndex; /* Bytes 24-27 */
  1357. unsigned int CodedMessageBufferIndex; /* Bytes 28-31 */
  1358. unsigned int CurrentTimeTracePageNumber; /* Bytes 32-35 */
  1359. unsigned int CurrentProfilerPageNumber; /* Bytes 36-39 */
  1360. unsigned int NextEventSequenceNumber; /* Bytes 40-43 */
  1361. unsigned int :32; /* Bytes 44-47 */
  1362. unsigned char Reserved1[16]; /* Bytes 48-63 */
  1363. unsigned char Reserved2[64]; /* Bytes 64-127 */
  1364. }
  1365. DAC960_V2_HealthStatusBuffer_T;
  1366. /*
  1367. Define the DAC960 V2 Firmware Get Event reply structure.
  1368. */
  1369. typedef struct DAC960_V2_Event
  1370. {
  1371. unsigned int EventSequenceNumber; /* Bytes 0-3 */
  1372. unsigned int EventTime; /* Bytes 4-7 */
  1373. unsigned int EventCode; /* Bytes 8-11 */
  1374. unsigned char :8; /* Byte 12 */
  1375. unsigned char Channel; /* Byte 13 */
  1376. unsigned char TargetID; /* Byte 14 */
  1377. unsigned char LogicalUnit; /* Byte 15 */
  1378. unsigned int :32; /* Bytes 16-19 */
  1379. unsigned int EventSpecificParameter; /* Bytes 20-23 */
  1380. unsigned char RequestSenseData[40]; /* Bytes 24-63 */
  1381. }
  1382. DAC960_V2_Event_T;
  1383. /*
  1384. Define the DAC960 V2 Firmware Command Control Bits structure.
  1385. */
  1386. typedef struct DAC960_V2_CommandControlBits
  1387. {
  1388. bool ForceUnitAccess:1; /* Byte 0 Bit 0 */
  1389. bool DisablePageOut:1; /* Byte 0 Bit 1 */
  1390. bool :1; /* Byte 0 Bit 2 */
  1391. bool AdditionalScatterGatherListMemory:1; /* Byte 0 Bit 3 */
  1392. bool DataTransferControllerToHost:1; /* Byte 0 Bit 4 */
  1393. bool :1; /* Byte 0 Bit 5 */
  1394. bool NoAutoRequestSense:1; /* Byte 0 Bit 6 */
  1395. bool DisconnectProhibited:1; /* Byte 0 Bit 7 */
  1396. }
  1397. DAC960_V2_CommandControlBits_T;
  1398. /*
  1399. Define the DAC960 V2 Firmware Command Timeout structure.
  1400. */
  1401. typedef struct DAC960_V2_CommandTimeout
  1402. {
  1403. unsigned char TimeoutValue:6; /* Byte 0 Bits 0-5 */
  1404. enum {
  1405. DAC960_V2_TimeoutScale_Seconds = 0,
  1406. DAC960_V2_TimeoutScale_Minutes = 1,
  1407. DAC960_V2_TimeoutScale_Hours = 2,
  1408. DAC960_V2_TimeoutScale_Reserved = 3
  1409. } __attribute__ ((packed)) TimeoutScale:2; /* Byte 0 Bits 6-7 */
  1410. }
  1411. DAC960_V2_CommandTimeout_T;
  1412. /*
  1413. Define the DAC960 V2 Firmware Physical Device structure.
  1414. */
  1415. typedef struct DAC960_V2_PhysicalDevice
  1416. {
  1417. unsigned char LogicalUnit; /* Byte 0 */
  1418. unsigned char TargetID; /* Byte 1 */
  1419. unsigned char Channel:3; /* Byte 2 Bits 0-2 */
  1420. unsigned char Controller:5; /* Byte 2 Bits 3-7 */
  1421. }
  1422. __attribute__ ((packed))
  1423. DAC960_V2_PhysicalDevice_T;
  1424. /*
  1425. Define the DAC960 V2 Firmware Logical Device structure.
  1426. */
  1427. typedef struct DAC960_V2_LogicalDevice
  1428. {
  1429. unsigned short LogicalDeviceNumber; /* Bytes 0-1 */
  1430. unsigned char :3; /* Byte 2 Bits 0-2 */
  1431. unsigned char Controller:5; /* Byte 2 Bits 3-7 */
  1432. }
  1433. __attribute__ ((packed))
  1434. DAC960_V2_LogicalDevice_T;
  1435. /*
  1436. Define the DAC960 V2 Firmware Operation Device type.
  1437. */
  1438. typedef enum
  1439. {
  1440. DAC960_V2_Physical_Device = 0x00,
  1441. DAC960_V2_RAID_Device = 0x01,
  1442. DAC960_V2_Physical_Channel = 0x02,
  1443. DAC960_V2_RAID_Channel = 0x03,
  1444. DAC960_V2_Physical_Controller = 0x04,
  1445. DAC960_V2_RAID_Controller = 0x05,
  1446. DAC960_V2_Configuration_Group = 0x10,
  1447. DAC960_V2_Enclosure = 0x11
  1448. }
  1449. __attribute__ ((packed))
  1450. DAC960_V2_OperationDevice_T;
  1451. /*
  1452. Define the DAC960 V2 Firmware Translate Physical To Logical Device structure.
  1453. */
  1454. typedef struct DAC960_V2_PhysicalToLogicalDevice
  1455. {
  1456. unsigned short LogicalDeviceNumber; /* Bytes 0-1 */
  1457. unsigned short :16; /* Bytes 2-3 */
  1458. unsigned char PreviousBootController; /* Byte 4 */
  1459. unsigned char PreviousBootChannel; /* Byte 5 */
  1460. unsigned char PreviousBootTargetID; /* Byte 6 */
  1461. unsigned char PreviousBootLogicalUnit; /* Byte 7 */
  1462. }
  1463. DAC960_V2_PhysicalToLogicalDevice_T;
  1464. /*
  1465. Define the DAC960 V2 Firmware Scatter/Gather List Entry structure.
  1466. */
  1467. typedef struct DAC960_V2_ScatterGatherSegment
  1468. {
  1469. DAC960_BusAddress64_T SegmentDataPointer; /* Bytes 0-7 */
  1470. DAC960_ByteCount64_T SegmentByteCount; /* Bytes 8-15 */
  1471. }
  1472. DAC960_V2_ScatterGatherSegment_T;
  1473. /*
  1474. Define the DAC960 V2 Firmware Data Transfer Memory Address structure.
  1475. */
  1476. typedef union DAC960_V2_DataTransferMemoryAddress
  1477. {
  1478. DAC960_V2_ScatterGatherSegment_T ScatterGatherSegments[2]; /* Bytes 0-31 */
  1479. struct {
  1480. unsigned short ScatterGatherList0Length; /* Bytes 0-1 */
  1481. unsigned short ScatterGatherList1Length; /* Bytes 2-3 */
  1482. unsigned short ScatterGatherList2Length; /* Bytes 4-5 */
  1483. unsigned short :16; /* Bytes 6-7 */
  1484. DAC960_BusAddress64_T ScatterGatherList0Address; /* Bytes 8-15 */
  1485. DAC960_BusAddress64_T ScatterGatherList1Address; /* Bytes 16-23 */
  1486. DAC960_BusAddress64_T ScatterGatherList2Address; /* Bytes 24-31 */
  1487. } ExtendedScatterGather;
  1488. }
  1489. DAC960_V2_DataTransferMemoryAddress_T;
  1490. /*
  1491. Define the 64 Byte DAC960 V2 Firmware Command Mailbox structure.
  1492. */
  1493. typedef union DAC960_V2_CommandMailbox
  1494. {
  1495. unsigned int Words[16]; /* Words 0-15 */
  1496. struct {
  1497. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1498. DAC960_V2_CommandOpcode_T CommandOpcode; /* Byte 2 */
  1499. DAC960_V2_CommandControlBits_T CommandControlBits; /* Byte 3 */
  1500. DAC960_ByteCount32_T DataTransferSize:24; /* Bytes 4-6 */
  1501. unsigned char DataTransferPageNumber; /* Byte 7 */
  1502. DAC960_BusAddress64_T RequestSenseBusAddress; /* Bytes 8-15 */
  1503. unsigned int :24; /* Bytes 16-18 */
  1504. DAC960_V2_CommandTimeout_T CommandTimeout; /* Byte 19 */
  1505. unsigned char RequestSenseSize; /* Byte 20 */
  1506. unsigned char IOCTL_Opcode; /* Byte 21 */
  1507. unsigned char Reserved[10]; /* Bytes 22-31 */
  1508. DAC960_V2_DataTransferMemoryAddress_T
  1509. DataTransferMemoryAddress; /* Bytes 32-63 */
  1510. } Common;
  1511. struct {
  1512. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1513. DAC960_V2_CommandOpcode_T CommandOpcode; /* Byte 2 */
  1514. DAC960_V2_CommandControlBits_T CommandControlBits; /* Byte 3 */
  1515. DAC960_ByteCount32_T DataTransferSize; /* Bytes 4-7 */
  1516. DAC960_BusAddress64_T RequestSenseBusAddress; /* Bytes 8-15 */
  1517. DAC960_V2_PhysicalDevice_T PhysicalDevice; /* Bytes 16-18 */
  1518. DAC960_V2_CommandTimeout_T CommandTimeout; /* Byte 19 */
  1519. unsigned char RequestSenseSize; /* Byte 20 */
  1520. unsigned char CDBLength; /* Byte 21 */
  1521. unsigned char SCSI_CDB[10]; /* Bytes 22-31 */
  1522. DAC960_V2_DataTransferMemoryAddress_T
  1523. DataTransferMemoryAddress; /* Bytes 32-63 */
  1524. } SCSI_10;
  1525. struct {
  1526. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1527. DAC960_V2_CommandOpcode_T CommandOpcode; /* Byte 2 */
  1528. DAC960_V2_CommandControlBits_T CommandControlBits; /* Byte 3 */
  1529. DAC960_ByteCount32_T DataTransferSize; /* Bytes 4-7 */
  1530. DAC960_BusAddress64_T RequestSenseBusAddress; /* Bytes 8-15 */
  1531. DAC960_V2_PhysicalDevice_T PhysicalDevice; /* Bytes 16-18 */
  1532. DAC960_V2_CommandTimeout_T CommandTimeout; /* Byte 19 */
  1533. unsigned char RequestSenseSize; /* Byte 20 */
  1534. unsigned char CDBLength; /* Byte 21 */
  1535. unsigned short :16; /* Bytes 22-23 */
  1536. DAC960_BusAddress64_T SCSI_CDB_BusAddress; /* Bytes 24-31 */
  1537. DAC960_V2_DataTransferMemoryAddress_T
  1538. DataTransferMemoryAddress; /* Bytes 32-63 */
  1539. } SCSI_255;
  1540. struct {
  1541. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1542. DAC960_V2_CommandOpcode_T CommandOpcode; /* Byte 2 */
  1543. DAC960_V2_CommandControlBits_T CommandControlBits; /* Byte 3 */
  1544. DAC960_ByteCount32_T DataTransferSize:24; /* Bytes 4-6 */
  1545. unsigned char DataTransferPageNumber; /* Byte 7 */
  1546. DAC960_BusAddress64_T RequestSenseBusAddress; /* Bytes 8-15 */
  1547. unsigned short :16; /* Bytes 16-17 */
  1548. unsigned char ControllerNumber; /* Byte 18 */
  1549. DAC960_V2_CommandTimeout_T CommandTimeout; /* Byte 19 */
  1550. unsigned char RequestSenseSize; /* Byte 20 */
  1551. unsigned char IOCTL_Opcode; /* Byte 21 */
  1552. unsigned char Reserved[10]; /* Bytes 22-31 */
  1553. DAC960_V2_DataTransferMemoryAddress_T
  1554. DataTransferMemoryAddress; /* Bytes 32-63 */
  1555. } ControllerInfo;
  1556. struct {
  1557. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1558. DAC960_V2_CommandOpcode_T CommandOpcode; /* Byte 2 */
  1559. DAC960_V2_CommandControlBits_T CommandControlBits; /* Byte 3 */
  1560. DAC960_ByteCount32_T DataTransferSize:24; /* Bytes 4-6 */
  1561. unsigned char DataTransferPageNumber; /* Byte 7 */
  1562. DAC960_BusAddress64_T RequestSenseBusAddress; /* Bytes 8-15 */
  1563. DAC960_V2_LogicalDevice_T LogicalDevice; /* Bytes 16-18 */
  1564. DAC960_V2_CommandTimeout_T CommandTimeout; /* Byte 19 */
  1565. unsigned char RequestSenseSize; /* Byte 20 */
  1566. unsigned char IOCTL_Opcode; /* Byte 21 */
  1567. unsigned char Reserved[10]; /* Bytes 22-31 */
  1568. DAC960_V2_DataTransferMemoryAddress_T
  1569. DataTransferMemoryAddress; /* Bytes 32-63 */
  1570. } LogicalDeviceInfo;
  1571. struct {
  1572. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1573. DAC960_V2_CommandOpcode_T CommandOpcode; /* Byte 2 */
  1574. DAC960_V2_CommandControlBits_T CommandControlBits; /* Byte 3 */
  1575. DAC960_ByteCount32_T DataTransferSize:24; /* Bytes 4-6 */
  1576. unsigned char DataTransferPageNumber; /* Byte 7 */
  1577. DAC960_BusAddress64_T RequestSenseBusAddress; /* Bytes 8-15 */
  1578. DAC960_V2_PhysicalDevice_T PhysicalDevice; /* Bytes 16-18 */
  1579. DAC960_V2_CommandTimeout_T CommandTimeout; /* Byte 19 */
  1580. unsigned char RequestSenseSize; /* Byte 20 */
  1581. unsigned char IOCTL_Opcode; /* Byte 21 */
  1582. unsigned char Reserved[10]; /* Bytes 22-31 */
  1583. DAC960_V2_DataTransferMemoryAddress_T
  1584. DataTransferMemoryAddress; /* Bytes 32-63 */
  1585. } PhysicalDeviceInfo;
  1586. struct {
  1587. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1588. DAC960_V2_CommandOpcode_T CommandOpcode; /* Byte 2 */
  1589. DAC960_V2_CommandControlBits_T CommandControlBits; /* Byte 3 */
  1590. DAC960_ByteCount32_T DataTransferSize:24; /* Bytes 4-6 */
  1591. unsigned char DataTransferPageNumber; /* Byte 7 */
  1592. DAC960_BusAddress64_T RequestSenseBusAddress; /* Bytes 8-15 */
  1593. unsigned short EventSequenceNumberHigh16; /* Bytes 16-17 */
  1594. unsigned char ControllerNumber; /* Byte 18 */
  1595. DAC960_V2_CommandTimeout_T CommandTimeout; /* Byte 19 */
  1596. unsigned char RequestSenseSize; /* Byte 20 */
  1597. unsigned char IOCTL_Opcode; /* Byte 21 */
  1598. unsigned short EventSequenceNumberLow16; /* Bytes 22-23 */
  1599. unsigned char Reserved[8]; /* Bytes 24-31 */
  1600. DAC960_V2_DataTransferMemoryAddress_T
  1601. DataTransferMemoryAddress; /* Bytes 32-63 */
  1602. } GetEvent;
  1603. struct {
  1604. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1605. DAC960_V2_CommandOpcode_T CommandOpcode; /* Byte 2 */
  1606. DAC960_V2_CommandControlBits_T CommandControlBits; /* Byte 3 */
  1607. DAC960_ByteCount32_T DataTransferSize:24; /* Bytes 4-6 */
  1608. unsigned char DataTransferPageNumber; /* Byte 7 */
  1609. DAC960_BusAddress64_T RequestSenseBusAddress; /* Bytes 8-15 */
  1610. DAC960_V2_LogicalDevice_T LogicalDevice; /* Bytes 16-18 */
  1611. DAC960_V2_CommandTimeout_T CommandTimeout; /* Byte 19 */
  1612. unsigned char RequestSenseSize; /* Byte 20 */
  1613. unsigned char IOCTL_Opcode; /* Byte 21 */
  1614. union {
  1615. DAC960_V2_LogicalDeviceState_T LogicalDeviceState;
  1616. DAC960_V2_PhysicalDeviceState_T PhysicalDeviceState;
  1617. } DeviceState; /* Byte 22 */
  1618. unsigned char Reserved[9]; /* Bytes 23-31 */
  1619. DAC960_V2_DataTransferMemoryAddress_T
  1620. DataTransferMemoryAddress; /* Bytes 32-63 */
  1621. } SetDeviceState;
  1622. struct {
  1623. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1624. DAC960_V2_CommandOpcode_T CommandOpcode; /* Byte 2 */
  1625. DAC960_V2_CommandControlBits_T CommandControlBits; /* Byte 3 */
  1626. DAC960_ByteCount32_T DataTransferSize:24; /* Bytes 4-6 */
  1627. unsigned char DataTransferPageNumber; /* Byte 7 */
  1628. DAC960_BusAddress64_T RequestSenseBusAddress; /* Bytes 8-15 */
  1629. DAC960_V2_LogicalDevice_T LogicalDevice; /* Bytes 16-18 */
  1630. DAC960_V2_CommandTimeout_T CommandTimeout; /* Byte 19 */
  1631. unsigned char RequestSenseSize; /* Byte 20 */
  1632. unsigned char IOCTL_Opcode; /* Byte 21 */
  1633. bool RestoreConsistency:1; /* Byte 22 Bit 0 */
  1634. bool InitializedAreaOnly:1; /* Byte 22 Bit 1 */
  1635. unsigned char :6; /* Byte 22 Bits 2-7 */
  1636. unsigned char Reserved[9]; /* Bytes 23-31 */
  1637. DAC960_V2_DataTransferMemoryAddress_T
  1638. DataTransferMemoryAddress; /* Bytes 32-63 */
  1639. } ConsistencyCheck;
  1640. struct {
  1641. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1642. DAC960_V2_CommandOpcode_T CommandOpcode; /* Byte 2 */
  1643. DAC960_V2_CommandControlBits_T CommandControlBits; /* Byte 3 */
  1644. unsigned char FirstCommandMailboxSizeKB; /* Byte 4 */
  1645. unsigned char FirstStatusMailboxSizeKB; /* Byte 5 */
  1646. unsigned char SecondCommandMailboxSizeKB; /* Byte 6 */
  1647. unsigned char SecondStatusMailboxSizeKB; /* Byte 7 */
  1648. DAC960_BusAddress64_T RequestSenseBusAddress; /* Bytes 8-15 */
  1649. unsigned int :24; /* Bytes 16-18 */
  1650. DAC960_V2_CommandTimeout_T CommandTimeout; /* Byte 19 */
  1651. unsigned char RequestSenseSize; /* Byte 20 */
  1652. unsigned char IOCTL_Opcode; /* Byte 21 */
  1653. unsigned char HealthStatusBufferSizeKB; /* Byte 22 */
  1654. unsigned char :8; /* Byte 23 */
  1655. DAC960_BusAddress64_T HealthStatusBufferBusAddress; /* Bytes 24-31 */
  1656. DAC960_BusAddress64_T FirstCommandMailboxBusAddress; /* Bytes 32-39 */
  1657. DAC960_BusAddress64_T FirstStatusMailboxBusAddress; /* Bytes 40-47 */
  1658. DAC960_BusAddress64_T SecondCommandMailboxBusAddress; /* Bytes 48-55 */
  1659. DAC960_BusAddress64_T SecondStatusMailboxBusAddress; /* Bytes 56-63 */
  1660. } SetMemoryMailbox;
  1661. struct {
  1662. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1663. DAC960_V2_CommandOpcode_T CommandOpcode; /* Byte 2 */
  1664. DAC960_V2_CommandControlBits_T CommandControlBits; /* Byte 3 */
  1665. DAC960_ByteCount32_T DataTransferSize:24; /* Bytes 4-6 */
  1666. unsigned char DataTransferPageNumber; /* Byte 7 */
  1667. DAC960_BusAddress64_T RequestSenseBusAddress; /* Bytes 8-15 */
  1668. DAC960_V2_PhysicalDevice_T PhysicalDevice; /* Bytes 16-18 */
  1669. DAC960_V2_CommandTimeout_T CommandTimeout; /* Byte 19 */
  1670. unsigned char RequestSenseSize; /* Byte 20 */
  1671. unsigned char IOCTL_Opcode; /* Byte 21 */
  1672. DAC960_V2_OperationDevice_T OperationDevice; /* Byte 22 */
  1673. unsigned char Reserved[9]; /* Bytes 23-31 */
  1674. DAC960_V2_DataTransferMemoryAddress_T
  1675. DataTransferMemoryAddress; /* Bytes 32-63 */
  1676. } DeviceOperation;
  1677. }
  1678. DAC960_V2_CommandMailbox_T;
  1679. /*
  1680. Define the DAC960 Driver IOCTL requests.
  1681. */
  1682. #define DAC960_IOCTL_GET_CONTROLLER_COUNT 0xDAC001
  1683. #define DAC960_IOCTL_GET_CONTROLLER_INFO 0xDAC002
  1684. #define DAC960_IOCTL_V1_EXECUTE_COMMAND 0xDAC003
  1685. #define DAC960_IOCTL_V2_EXECUTE_COMMAND 0xDAC004
  1686. #define DAC960_IOCTL_V2_GET_HEALTH_STATUS 0xDAC005
  1687. /*
  1688. Define the DAC960_IOCTL_GET_CONTROLLER_INFO reply structure.
  1689. */
  1690. typedef struct DAC960_ControllerInfo
  1691. {
  1692. unsigned char ControllerNumber;
  1693. unsigned char FirmwareType;
  1694. unsigned char Channels;
  1695. unsigned char Targets;
  1696. unsigned char PCI_Bus;
  1697. unsigned char PCI_Device;
  1698. unsigned char PCI_Function;
  1699. unsigned char IRQ_Channel;
  1700. DAC960_PCI_Address_T PCI_Address;
  1701. unsigned char ModelName[20];
  1702. unsigned char FirmwareVersion[12];
  1703. }
  1704. DAC960_ControllerInfo_T;
  1705. /*
  1706. Define the User Mode DAC960_IOCTL_V1_EXECUTE_COMMAND request structure.
  1707. */
  1708. typedef struct DAC960_V1_UserCommand
  1709. {
  1710. unsigned char ControllerNumber;
  1711. DAC960_V1_CommandMailbox_T CommandMailbox;
  1712. int DataTransferLength;
  1713. void __user *DataTransferBuffer;
  1714. DAC960_V1_DCDB_T __user *DCDB;
  1715. }
  1716. DAC960_V1_UserCommand_T;
  1717. /*
  1718. Define the Kernel Mode DAC960_IOCTL_V1_EXECUTE_COMMAND request structure.
  1719. */
  1720. typedef struct DAC960_V1_KernelCommand
  1721. {
  1722. unsigned char ControllerNumber;
  1723. DAC960_V1_CommandMailbox_T CommandMailbox;
  1724. int DataTransferLength;
  1725. void *DataTransferBuffer;
  1726. DAC960_V1_DCDB_T *DCDB;
  1727. DAC960_V1_CommandStatus_T CommandStatus;
  1728. void (*CompletionFunction)(struct DAC960_V1_KernelCommand *);
  1729. void *CompletionData;
  1730. }
  1731. DAC960_V1_KernelCommand_T;
  1732. /*
  1733. Define the User Mode DAC960_IOCTL_V2_EXECUTE_COMMAND request structure.
  1734. */
  1735. typedef struct DAC960_V2_UserCommand
  1736. {
  1737. unsigned char ControllerNumber;
  1738. DAC960_V2_CommandMailbox_T CommandMailbox;
  1739. int DataTransferLength;
  1740. int RequestSenseLength;
  1741. void __user *DataTransferBuffer;
  1742. void __user *RequestSenseBuffer;
  1743. }
  1744. DAC960_V2_UserCommand_T;
  1745. /*
  1746. Define the Kernel Mode DAC960_IOCTL_V2_EXECUTE_COMMAND request structure.
  1747. */
  1748. typedef struct DAC960_V2_KernelCommand
  1749. {
  1750. unsigned char ControllerNumber;
  1751. DAC960_V2_CommandMailbox_T CommandMailbox;
  1752. int DataTransferLength;
  1753. int RequestSenseLength;
  1754. void *DataTransferBuffer;
  1755. void *RequestSenseBuffer;
  1756. DAC960_V2_CommandStatus_T CommandStatus;
  1757. void (*CompletionFunction)(struct DAC960_V2_KernelCommand *);
  1758. void *CompletionData;
  1759. }
  1760. DAC960_V2_KernelCommand_T;
  1761. /*
  1762. Define the User Mode DAC960_IOCTL_V2_GET_HEALTH_STATUS request structure.
  1763. */
  1764. typedef struct DAC960_V2_GetHealthStatus
  1765. {
  1766. unsigned char ControllerNumber;
  1767. DAC960_V2_HealthStatusBuffer_T __user *HealthStatusBuffer;
  1768. }
  1769. DAC960_V2_GetHealthStatus_T;
  1770. /*
  1771. Import the Kernel Mode IOCTL interface.
  1772. */
  1773. extern int DAC960_KernelIOCTL(unsigned int Request, void *Argument);
  1774. /*
  1775. DAC960_DriverVersion protects the private portion of this file.
  1776. */
  1777. #ifdef DAC960_DriverVersion
  1778. /*
  1779. Define the maximum Driver Queue Depth and Controller Queue Depth supported
  1780. by DAC960 V1 and V2 Firmware Controllers.
  1781. */
  1782. #define DAC960_MaxDriverQueueDepth 511
  1783. #define DAC960_MaxControllerQueueDepth 512
  1784. /*
  1785. Define the maximum number of Scatter/Gather Segments supported for any
  1786. DAC960 V1 and V2 Firmware controller.
  1787. */
  1788. #define DAC960_V1_ScatterGatherLimit 33
  1789. #define DAC960_V2_ScatterGatherLimit 128
  1790. /*
  1791. Define the number of Command Mailboxes and Status Mailboxes used by the
  1792. DAC960 V1 and V2 Firmware Memory Mailbox Interface.
  1793. */
  1794. #define DAC960_V1_CommandMailboxCount 256
  1795. #define DAC960_V1_StatusMailboxCount 1024
  1796. #define DAC960_V2_CommandMailboxCount 512
  1797. #define DAC960_V2_StatusMailboxCount 512
  1798. /*
  1799. Define the DAC960 Controller Monitoring Timer Interval.
  1800. */
  1801. #define DAC960_MonitoringTimerInterval (10 * HZ)
  1802. /*
  1803. Define the DAC960 Controller Secondary Monitoring Interval.
  1804. */
  1805. #define DAC960_SecondaryMonitoringInterval (60 * HZ)
  1806. /*
  1807. Define the DAC960 Controller Health Status Monitoring Interval.
  1808. */
  1809. #define DAC960_HealthStatusMonitoringInterval (1 * HZ)
  1810. /*
  1811. Define the DAC960 Controller Progress Reporting Interval.
  1812. */
  1813. #define DAC960_ProgressReportingInterval (60 * HZ)
  1814. /*
  1815. Define the maximum number of Partitions allowed for each Logical Drive.
  1816. */
  1817. #define DAC960_MaxPartitions 8
  1818. #define DAC960_MaxPartitionsBits 3
  1819. /*
  1820. Define the DAC960 Controller fixed Block Size and Block Size Bits.
  1821. */
  1822. #define DAC960_BlockSize 512
  1823. #define DAC960_BlockSizeBits 9
  1824. /*
  1825. Define the number of Command structures that should be allocated as a
  1826. group to optimize kernel memory allocation.
  1827. */
  1828. #define DAC960_V1_CommandAllocationGroupSize 11
  1829. #define DAC960_V2_CommandAllocationGroupSize 29
  1830. /*
  1831. Define the Controller Line Buffer, Progress Buffer, User Message, and
  1832. Initial Status Buffer sizes.
  1833. */
  1834. #define DAC960_LineBufferSize 100
  1835. #define DAC960_ProgressBufferSize 200
  1836. #define DAC960_UserMessageSize 200
  1837. #define DAC960_InitialStatusBufferSize (8192-32)
  1838. /*
  1839. Define the DAC960 Controller Firmware Types.
  1840. */
  1841. typedef enum
  1842. {
  1843. DAC960_V1_Controller = 1,
  1844. DAC960_V2_Controller = 2
  1845. }
  1846. DAC960_FirmwareType_T;
  1847. /*
  1848. Define the DAC960 Controller Hardware Types.
  1849. */
  1850. typedef enum
  1851. {
  1852. DAC960_BA_Controller = 1, /* eXtremeRAID 2000 */
  1853. DAC960_LP_Controller = 2, /* AcceleRAID 352 */
  1854. DAC960_LA_Controller = 3, /* DAC1164P */
  1855. DAC960_PG_Controller = 4, /* DAC960PTL/PJ/PG */
  1856. DAC960_PD_Controller = 5, /* DAC960PU/PD/PL/P */
  1857. DAC960_P_Controller = 6, /* DAC960PU/PD/PL/P */
  1858. DAC960_GEM_Controller = 7, /* AcceleRAID 4/5/600 */
  1859. }
  1860. DAC960_HardwareType_T;
  1861. /*
  1862. Define the Driver Message Levels.
  1863. */
  1864. typedef enum DAC960_MessageLevel
  1865. {
  1866. DAC960_AnnounceLevel = 0,
  1867. DAC960_InfoLevel = 1,
  1868. DAC960_NoticeLevel = 2,
  1869. DAC960_WarningLevel = 3,
  1870. DAC960_ErrorLevel = 4,
  1871. DAC960_ProgressLevel = 5,
  1872. DAC960_CriticalLevel = 6,
  1873. DAC960_UserCriticalLevel = 7
  1874. }
  1875. DAC960_MessageLevel_T;
  1876. static char
  1877. *DAC960_MessageLevelMap[] =
  1878. { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING,
  1879. KERN_ERR, KERN_CRIT, KERN_CRIT, KERN_CRIT };
  1880. /*
  1881. Define Driver Message macros.
  1882. */
  1883. #define DAC960_Announce(Format, Arguments...) \
  1884. DAC960_Message(DAC960_AnnounceLevel, Format, ##Arguments)
  1885. #define DAC960_Info(Format, Arguments...) \
  1886. DAC960_Message(DAC960_InfoLevel, Format, ##Arguments)
  1887. #define DAC960_Notice(Format, Arguments...) \
  1888. DAC960_Message(DAC960_NoticeLevel, Format, ##Arguments)
  1889. #define DAC960_Warning(Format, Arguments...) \
  1890. DAC960_Message(DAC960_WarningLevel, Format, ##Arguments)
  1891. #define DAC960_Error(Format, Arguments...) \
  1892. DAC960_Message(DAC960_ErrorLevel, Format, ##Arguments)
  1893. #define DAC960_Progress(Format, Arguments...) \
  1894. DAC960_Message(DAC960_ProgressLevel, Format, ##Arguments)
  1895. #define DAC960_Critical(Format, Arguments...) \
  1896. DAC960_Message(DAC960_CriticalLevel, Format, ##Arguments)
  1897. #define DAC960_UserCritical(Format, Arguments...) \
  1898. DAC960_Message(DAC960_UserCriticalLevel, Format, ##Arguments)
  1899. struct DAC960_privdata {
  1900. DAC960_HardwareType_T HardwareType;
  1901. DAC960_FirmwareType_T FirmwareType;
  1902. irq_handler_t InterruptHandler;
  1903. unsigned int MemoryWindowSize;
  1904. };
  1905. /*
  1906. Define the DAC960 V1 Firmware Controller Status Mailbox structure.
  1907. */
  1908. typedef union DAC960_V1_StatusMailbox
  1909. {
  1910. unsigned int Word; /* Word 0 */
  1911. struct {
  1912. DAC960_V1_CommandIdentifier_T CommandIdentifier; /* Byte 0 */
  1913. unsigned char :7; /* Byte 1 Bits 0-6 */
  1914. bool Valid:1; /* Byte 1 Bit 7 */
  1915. DAC960_V1_CommandStatus_T CommandStatus; /* Bytes 2-3 */
  1916. } Fields;
  1917. }
  1918. DAC960_V1_StatusMailbox_T;
  1919. /*
  1920. Define the DAC960 V2 Firmware Controller Status Mailbox structure.
  1921. */
  1922. typedef union DAC960_V2_StatusMailbox
  1923. {
  1924. unsigned int Words[2]; /* Words 0-1 */
  1925. struct {
  1926. DAC960_V2_CommandIdentifier_T CommandIdentifier; /* Bytes 0-1 */
  1927. DAC960_V2_CommandStatus_T CommandStatus; /* Byte 2 */
  1928. unsigned char RequestSenseLength; /* Byte 3 */
  1929. int DataTransferResidue; /* Bytes 4-7 */
  1930. } Fields;
  1931. }
  1932. DAC960_V2_StatusMailbox_T;
  1933. /*
  1934. Define the DAC960 Driver Command Types.
  1935. */
  1936. typedef enum
  1937. {
  1938. DAC960_ReadCommand = 1,
  1939. DAC960_WriteCommand = 2,
  1940. DAC960_ReadRetryCommand = 3,
  1941. DAC960_WriteRetryCommand = 4,
  1942. DAC960_MonitoringCommand = 5,
  1943. DAC960_ImmediateCommand = 6,
  1944. DAC960_QueuedCommand = 7
  1945. }
  1946. DAC960_CommandType_T;
  1947. /*
  1948. Define the DAC960 Driver Command structure.
  1949. */
  1950. typedef struct DAC960_Command
  1951. {
  1952. int CommandIdentifier;
  1953. DAC960_CommandType_T CommandType;
  1954. struct DAC960_Controller *Controller;
  1955. struct DAC960_Command *Next;
  1956. struct completion *Completion;
  1957. unsigned int LogicalDriveNumber;
  1958. unsigned int BlockNumber;
  1959. unsigned int BlockCount;
  1960. unsigned int SegmentCount;
  1961. int DmaDirection;
  1962. struct scatterlist *cmd_sglist;
  1963. struct request *Request;
  1964. union {
  1965. struct {
  1966. DAC960_V1_CommandMailbox_T CommandMailbox;
  1967. DAC960_V1_KernelCommand_T *KernelCommand;
  1968. DAC960_V1_CommandStatus_T CommandStatus;
  1969. DAC960_V1_ScatterGatherSegment_T *ScatterGatherList;
  1970. dma_addr_t ScatterGatherListDMA;
  1971. struct scatterlist ScatterList[DAC960_V1_ScatterGatherLimit];
  1972. unsigned int EndMarker[0];
  1973. } V1;
  1974. struct {
  1975. DAC960_V2_CommandMailbox_T CommandMailbox;
  1976. DAC960_V2_KernelCommand_T *KernelCommand;
  1977. DAC960_V2_CommandStatus_T CommandStatus;
  1978. unsigned char RequestSenseLength;
  1979. int DataTransferResidue;
  1980. DAC960_V2_ScatterGatherSegment_T *ScatterGatherList;
  1981. dma_addr_t ScatterGatherListDMA;
  1982. DAC960_SCSI_RequestSense_T *RequestSense;
  1983. dma_addr_t RequestSenseDMA;
  1984. struct scatterlist ScatterList[DAC960_V2_ScatterGatherLimit];
  1985. unsigned int EndMarker[0];
  1986. } V2;
  1987. } FW;
  1988. }
  1989. DAC960_Command_T;
  1990. /*
  1991. Define the DAC960 Driver Controller structure.
  1992. */
  1993. typedef struct DAC960_Controller
  1994. {
  1995. void __iomem *BaseAddress;
  1996. void __iomem *MemoryMappedAddress;
  1997. DAC960_FirmwareType_T FirmwareType;
  1998. DAC960_HardwareType_T HardwareType;
  1999. DAC960_IO_Address_T IO_Address;
  2000. DAC960_PCI_Address_T PCI_Address;
  2001. struct pci_dev *PCIDevice;
  2002. unsigned char ControllerNumber;
  2003. unsigned char ControllerName[4];
  2004. unsigned char ModelName[20];
  2005. unsigned char FullModelName[28];
  2006. unsigned char FirmwareVersion[12];
  2007. unsigned char Bus;
  2008. unsigned char Device;
  2009. unsigned char Function;
  2010. unsigned char IRQ_Channel;
  2011. unsigned char Channels;
  2012. unsigned char Targets;
  2013. unsigned char MemorySize;
  2014. unsigned char LogicalDriveCount;
  2015. unsigned short CommandAllocationGroupSize;
  2016. unsigned short ControllerQueueDepth;
  2017. unsigned short DriverQueueDepth;
  2018. unsigned short MaxBlocksPerCommand;
  2019. unsigned short ControllerScatterGatherLimit;
  2020. unsigned short DriverScatterGatherLimit;
  2021. u64 BounceBufferLimit;
  2022. unsigned int CombinedStatusBufferLength;
  2023. unsigned int InitialStatusLength;
  2024. unsigned int CurrentStatusLength;
  2025. unsigned int ProgressBufferLength;
  2026. unsigned int UserStatusLength;
  2027. struct dma_loaf DmaPages;
  2028. unsigned long MonitoringTimerCount;
  2029. unsigned long PrimaryMonitoringTime;
  2030. unsigned long SecondaryMonitoringTime;
  2031. unsigned long ShutdownMonitoringTimer;
  2032. unsigned long LastProgressReportTime;
  2033. unsigned long LastCurrentStatusTime;
  2034. bool ControllerInitialized;
  2035. bool MonitoringCommandDeferred;
  2036. bool EphemeralProgressMessage;
  2037. bool DriveSpinUpMessageDisplayed;
  2038. bool MonitoringAlertMode;
  2039. bool SuppressEnclosureMessages;
  2040. struct timer_list MonitoringTimer;
  2041. struct gendisk *disks[DAC960_MaxLogicalDrives];
  2042. struct pci_pool *ScatterGatherPool;
  2043. DAC960_Command_T *FreeCommands;
  2044. unsigned char *CombinedStatusBuffer;
  2045. unsigned char *CurrentStatusBuffer;
  2046. struct request_queue *RequestQueue[DAC960_MaxLogicalDrives];
  2047. int req_q_index;
  2048. spinlock_t queue_lock;
  2049. wait_queue_head_t CommandWaitQueue;
  2050. wait_queue_head_t HealthStatusWaitQueue;
  2051. DAC960_Command_T InitialCommand;
  2052. DAC960_Command_T *Commands[DAC960_MaxDriverQueueDepth];
  2053. struct proc_dir_entry *ControllerProcEntry;
  2054. bool LogicalDriveInitiallyAccessible[DAC960_MaxLogicalDrives];
  2055. void (*QueueCommand)(DAC960_Command_T *Command);
  2056. bool (*ReadControllerConfiguration)(struct DAC960_Controller *);
  2057. bool (*ReadDeviceConfiguration)(struct DAC960_Controller *);
  2058. bool (*ReportDeviceConfiguration)(struct DAC960_Controller *);
  2059. void (*QueueReadWriteCommand)(DAC960_Command_T *Command);
  2060. union {
  2061. struct {
  2062. unsigned char GeometryTranslationHeads;
  2063. unsigned char GeometryTranslationSectors;
  2064. unsigned char PendingRebuildFlag;
  2065. unsigned short StripeSize;
  2066. unsigned short SegmentSize;
  2067. unsigned short NewEventLogSequenceNumber;
  2068. unsigned short OldEventLogSequenceNumber;
  2069. unsigned short DeviceStateChannel;
  2070. unsigned short DeviceStateTargetID;
  2071. bool DualModeMemoryMailboxInterface;
  2072. bool BackgroundInitializationStatusSupported;
  2073. bool SAFTE_EnclosureManagementEnabled;
  2074. bool NeedLogicalDriveInformation;
  2075. bool NeedErrorTableInformation;
  2076. bool NeedDeviceStateInformation;
  2077. bool NeedDeviceInquiryInformation;
  2078. bool NeedDeviceSerialNumberInformation;
  2079. bool NeedRebuildProgress;
  2080. bool NeedConsistencyCheckProgress;
  2081. bool NeedBackgroundInitializationStatus;
  2082. bool StartDeviceStateScan;
  2083. bool RebuildProgressFirst;
  2084. bool RebuildFlagPending;
  2085. bool RebuildStatusPending;
  2086. dma_addr_t FirstCommandMailboxDMA;
  2087. DAC960_V1_CommandMailbox_T *FirstCommandMailbox;
  2088. DAC960_V1_CommandMailbox_T *LastCommandMailbox;
  2089. DAC960_V1_CommandMailbox_T *NextCommandMailbox;
  2090. DAC960_V1_CommandMailbox_T *PreviousCommandMailbox1;
  2091. DAC960_V1_CommandMailbox_T *PreviousCommandMailbox2;
  2092. dma_addr_t FirstStatusMailboxDMA;
  2093. DAC960_V1_StatusMailbox_T *FirstStatusMailbox;
  2094. DAC960_V1_StatusMailbox_T *LastStatusMailbox;
  2095. DAC960_V1_StatusMailbox_T *NextStatusMailbox;
  2096. DAC960_V1_DCDB_T *MonitoringDCDB;
  2097. dma_addr_t MonitoringDCDB_DMA;
  2098. DAC960_V1_Enquiry_T Enquiry;
  2099. DAC960_V1_Enquiry_T *NewEnquiry;
  2100. dma_addr_t NewEnquiryDMA;
  2101. DAC960_V1_ErrorTable_T ErrorTable;
  2102. DAC960_V1_ErrorTable_T *NewErrorTable;
  2103. dma_addr_t NewErrorTableDMA;
  2104. DAC960_V1_EventLogEntry_T *EventLogEntry;
  2105. dma_addr_t EventLogEntryDMA;
  2106. DAC960_V1_RebuildProgress_T *RebuildProgress;
  2107. dma_addr_t RebuildProgressDMA;
  2108. DAC960_V1_CommandStatus_T LastRebuildStatus;
  2109. DAC960_V1_CommandStatus_T PendingRebuildStatus;
  2110. DAC960_V1_LogicalDriveInformationArray_T LogicalDriveInformation;
  2111. DAC960_V1_LogicalDriveInformationArray_T *NewLogicalDriveInformation;
  2112. dma_addr_t NewLogicalDriveInformationDMA;
  2113. DAC960_V1_BackgroundInitializationStatus_T
  2114. *BackgroundInitializationStatus;
  2115. dma_addr_t BackgroundInitializationStatusDMA;
  2116. DAC960_V1_BackgroundInitializationStatus_T
  2117. LastBackgroundInitializationStatus;
  2118. DAC960_V1_DeviceState_T
  2119. DeviceState[DAC960_V1_MaxChannels][DAC960_V1_MaxTargets];
  2120. DAC960_V1_DeviceState_T *NewDeviceState;
  2121. dma_addr_t NewDeviceStateDMA;
  2122. DAC960_SCSI_Inquiry_T
  2123. InquiryStandardData[DAC960_V1_MaxChannels][DAC960_V1_MaxTargets];
  2124. DAC960_SCSI_Inquiry_T *NewInquiryStandardData;
  2125. dma_addr_t NewInquiryStandardDataDMA;
  2126. DAC960_SCSI_Inquiry_UnitSerialNumber_T
  2127. InquiryUnitSerialNumber[DAC960_V1_MaxChannels][DAC960_V1_MaxTargets];
  2128. DAC960_SCSI_Inquiry_UnitSerialNumber_T *NewInquiryUnitSerialNumber;
  2129. dma_addr_t NewInquiryUnitSerialNumberDMA;
  2130. int DeviceResetCount[DAC960_V1_MaxChannels][DAC960_V1_MaxTargets];
  2131. bool DirectCommandActive[DAC960_V1_MaxChannels][DAC960_V1_MaxTargets];
  2132. } V1;
  2133. struct {
  2134. unsigned int StatusChangeCounter;
  2135. unsigned int NextEventSequenceNumber;
  2136. unsigned int PhysicalDeviceIndex;
  2137. bool NeedLogicalDeviceInformation;
  2138. bool NeedPhysicalDeviceInformation;
  2139. bool NeedDeviceSerialNumberInformation;
  2140. bool StartLogicalDeviceInformationScan;
  2141. bool StartPhysicalDeviceInformationScan;
  2142. struct pci_pool *RequestSensePool;
  2143. dma_addr_t FirstCommandMailboxDMA;
  2144. DAC960_V2_CommandMailbox_T *FirstCommandMailbox;
  2145. DAC960_V2_CommandMailbox_T *LastCommandMailbox;
  2146. DAC960_V2_CommandMailbox_T *NextCommandMailbox;
  2147. DAC960_V2_CommandMailbox_T *PreviousCommandMailbox1;
  2148. DAC960_V2_CommandMailbox_T *PreviousCommandMailbox2;
  2149. dma_addr_t FirstStatusMailboxDMA;
  2150. DAC960_V2_StatusMailbox_T *FirstStatusMailbox;
  2151. DAC960_V2_StatusMailbox_T *LastStatusMailbox;
  2152. DAC960_V2_StatusMailbox_T *NextStatusMailbox;
  2153. dma_addr_t HealthStatusBufferDMA;
  2154. DAC960_V2_HealthStatusBuffer_T *HealthStatusBuffer;
  2155. DAC960_V2_ControllerInfo_T ControllerInformation;
  2156. DAC960_V2_ControllerInfo_T *NewControllerInformation;
  2157. dma_addr_t NewControllerInformationDMA;
  2158. DAC960_V2_LogicalDeviceInfo_T
  2159. *LogicalDeviceInformation[DAC960_MaxLogicalDrives];
  2160. DAC960_V2_LogicalDeviceInfo_T *NewLogicalDeviceInformation;
  2161. dma_addr_t NewLogicalDeviceInformationDMA;
  2162. DAC960_V2_PhysicalDeviceInfo_T
  2163. *PhysicalDeviceInformation[DAC960_V2_MaxPhysicalDevices];
  2164. DAC960_V2_PhysicalDeviceInfo_T *NewPhysicalDeviceInformation;
  2165. dma_addr_t NewPhysicalDeviceInformationDMA;
  2166. DAC960_SCSI_Inquiry_UnitSerialNumber_T *NewInquiryUnitSerialNumber;
  2167. dma_addr_t NewInquiryUnitSerialNumberDMA;
  2168. DAC960_SCSI_Inquiry_UnitSerialNumber_T
  2169. *InquiryUnitSerialNumber[DAC960_V2_MaxPhysicalDevices];
  2170. DAC960_V2_Event_T *Event;
  2171. dma_addr_t EventDMA;
  2172. DAC960_V2_PhysicalToLogicalDevice_T *PhysicalToLogicalDevice;
  2173. dma_addr_t PhysicalToLogicalDeviceDMA;
  2174. DAC960_V2_PhysicalDevice_T
  2175. LogicalDriveToVirtualDevice[DAC960_MaxLogicalDrives];
  2176. bool LogicalDriveFoundDuringScan[DAC960_MaxLogicalDrives];
  2177. } V2;
  2178. } FW;
  2179. unsigned char ProgressBuffer[DAC960_ProgressBufferSize];
  2180. unsigned char UserStatusBuffer[DAC960_UserMessageSize];
  2181. }
  2182. DAC960_Controller_T;
  2183. /*
  2184. Simplify access to Firmware Version Dependent Data Structure Components
  2185. and Functions.
  2186. */
  2187. #define V1 FW.V1
  2188. #define V2 FW.V2
  2189. #define DAC960_QueueCommand(Command) \
  2190. (Controller->QueueCommand)(Command)
  2191. #define DAC960_ReadControllerConfiguration(Controller) \
  2192. (Controller->ReadControllerConfiguration)(Controller)
  2193. #define DAC960_ReadDeviceConfiguration(Controller) \
  2194. (Controller->ReadDeviceConfiguration)(Controller)
  2195. #define DAC960_ReportDeviceConfiguration(Controller) \
  2196. (Controller->ReportDeviceConfiguration)(Controller)
  2197. #define DAC960_QueueReadWriteCommand(Command) \
  2198. (Controller->QueueReadWriteCommand)(Command)
  2199. /*
  2200. * dma_addr_writeql is provided to write dma_addr_t types
  2201. * to a 64-bit pci address space register. The controller
  2202. * will accept having the register written as two 32-bit
  2203. * values.
  2204. *
  2205. * In HIGHMEM kernels, dma_addr_t is a 64-bit value.
  2206. * without HIGHMEM, dma_addr_t is a 32-bit value.
  2207. *
  2208. * The compiler should always fix up the assignment
  2209. * to u.wq appropriately, depending upon the size of
  2210. * dma_addr_t.
  2211. */
  2212. static inline
  2213. void dma_addr_writeql(dma_addr_t addr, void __iomem *write_address)
  2214. {
  2215. union {
  2216. u64 wq;
  2217. uint wl[2];
  2218. } u;
  2219. u.wq = addr;
  2220. writel(u.wl[0], write_address);
  2221. writel(u.wl[1], write_address + 4);
  2222. }
  2223. /*
  2224. Define the DAC960 GEM Series Controller Interface Register Offsets.
  2225. */
  2226. #define DAC960_GEM_RegisterWindowSize 0x600
  2227. typedef enum
  2228. {
  2229. DAC960_GEM_InboundDoorBellRegisterReadSetOffset = 0x214,
  2230. DAC960_GEM_InboundDoorBellRegisterClearOffset = 0x218,
  2231. DAC960_GEM_OutboundDoorBellRegisterReadSetOffset = 0x224,
  2232. DAC960_GEM_OutboundDoorBellRegisterClearOffset = 0x228,
  2233. DAC960_GEM_InterruptStatusRegisterOffset = 0x208,
  2234. DAC960_GEM_InterruptMaskRegisterReadSetOffset = 0x22C,
  2235. DAC960_GEM_InterruptMaskRegisterClearOffset = 0x230,
  2236. DAC960_GEM_CommandMailboxBusAddressOffset = 0x510,
  2237. DAC960_GEM_CommandStatusOffset = 0x518,
  2238. DAC960_GEM_ErrorStatusRegisterReadSetOffset = 0x224,
  2239. DAC960_GEM_ErrorStatusRegisterClearOffset = 0x228,
  2240. }
  2241. DAC960_GEM_RegisterOffsets_T;
  2242. /*
  2243. Define the structure of the DAC960 GEM Series Inbound Door Bell
  2244. */
  2245. typedef union DAC960_GEM_InboundDoorBellRegister
  2246. {
  2247. unsigned int All;
  2248. struct {
  2249. unsigned int :24;
  2250. bool HardwareMailboxNewCommand:1;
  2251. bool AcknowledgeHardwareMailboxStatus:1;
  2252. bool GenerateInterrupt:1;
  2253. bool ControllerReset:1;
  2254. bool MemoryMailboxNewCommand:1;
  2255. unsigned int :3;
  2256. } Write;
  2257. struct {
  2258. unsigned int :24;
  2259. bool HardwareMailboxFull:1;
  2260. bool InitializationInProgress:1;
  2261. unsigned int :6;
  2262. } Read;
  2263. }
  2264. DAC960_GEM_InboundDoorBellRegister_T;
  2265. /*
  2266. Define the structure of the DAC960 GEM Series Outbound Door Bell Register.
  2267. */
  2268. typedef union DAC960_GEM_OutboundDoorBellRegister
  2269. {
  2270. unsigned int All;
  2271. struct {
  2272. unsigned int :24;
  2273. bool AcknowledgeHardwareMailboxInterrupt:1;
  2274. bool AcknowledgeMemoryMailboxInterrupt:1;
  2275. unsigned int :6;
  2276. } Write;
  2277. struct {
  2278. unsigned int :24;
  2279. bool HardwareMailboxStatusAvailable:1;
  2280. bool MemoryMailboxStatusAvailable:1;
  2281. unsigned int :6;
  2282. } Read;
  2283. }
  2284. DAC960_GEM_OutboundDoorBellRegister_T;
  2285. /*
  2286. Define the structure of the DAC960 GEM Series Interrupt Mask Register.
  2287. */
  2288. typedef union DAC960_GEM_InterruptMaskRegister
  2289. {
  2290. unsigned int All;
  2291. struct {
  2292. unsigned int :16;
  2293. unsigned int :8;
  2294. unsigned int HardwareMailboxInterrupt:1;
  2295. unsigned int MemoryMailboxInterrupt:1;
  2296. unsigned int :6;
  2297. } Bits;
  2298. }
  2299. DAC960_GEM_InterruptMaskRegister_T;
  2300. /*
  2301. Define the structure of the DAC960 GEM Series Error Status Register.
  2302. */
  2303. typedef union DAC960_GEM_ErrorStatusRegister
  2304. {
  2305. unsigned int All;
  2306. struct {
  2307. unsigned int :24;
  2308. unsigned int :5;
  2309. bool ErrorStatusPending:1;
  2310. unsigned int :2;
  2311. } Bits;
  2312. }
  2313. DAC960_GEM_ErrorStatusRegister_T;
  2314. /*
  2315. Define inline functions to provide an abstraction for reading and writing the
  2316. DAC960 GEM Series Controller Interface Registers.
  2317. */
  2318. static inline
  2319. void DAC960_GEM_HardwareMailboxNewCommand(void __iomem *ControllerBaseAddress)
  2320. {
  2321. DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister;
  2322. InboundDoorBellRegister.All = 0;
  2323. InboundDoorBellRegister.Write.HardwareMailboxNewCommand = true;
  2324. writel(InboundDoorBellRegister.All,
  2325. ControllerBaseAddress + DAC960_GEM_InboundDoorBellRegisterReadSetOffset);
  2326. }
  2327. static inline
  2328. void DAC960_GEM_AcknowledgeHardwareMailboxStatus(void __iomem *ControllerBaseAddress)
  2329. {
  2330. DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister;
  2331. InboundDoorBellRegister.All = 0;
  2332. InboundDoorBellRegister.Write.AcknowledgeHardwareMailboxStatus = true;
  2333. writel(InboundDoorBellRegister.All,
  2334. ControllerBaseAddress + DAC960_GEM_InboundDoorBellRegisterClearOffset);
  2335. }
  2336. static inline
  2337. void DAC960_GEM_GenerateInterrupt(void __iomem *ControllerBaseAddress)
  2338. {
  2339. DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister;
  2340. InboundDoorBellRegister.All = 0;
  2341. InboundDoorBellRegister.Write.GenerateInterrupt = true;
  2342. writel(InboundDoorBellRegister.All,
  2343. ControllerBaseAddress + DAC960_GEM_InboundDoorBellRegisterReadSetOffset);
  2344. }
  2345. static inline
  2346. void DAC960_GEM_ControllerReset(void __iomem *ControllerBaseAddress)
  2347. {
  2348. DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister;
  2349. InboundDoorBellRegister.All = 0;
  2350. InboundDoorBellRegister.Write.ControllerReset = true;
  2351. writel(InboundDoorBellRegister.All,
  2352. ControllerBaseAddress + DAC960_GEM_InboundDoorBellRegisterReadSetOffset);
  2353. }
  2354. static inline
  2355. void DAC960_GEM_MemoryMailboxNewCommand(void __iomem *ControllerBaseAddress)
  2356. {
  2357. DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister;
  2358. InboundDoorBellRegister.All = 0;
  2359. InboundDoorBellRegister.Write.MemoryMailboxNewCommand = true;
  2360. writel(InboundDoorBellRegister.All,
  2361. ControllerBaseAddress + DAC960_GEM_InboundDoorBellRegisterReadSetOffset);
  2362. }
  2363. static inline
  2364. bool DAC960_GEM_HardwareMailboxFullP(void __iomem *ControllerBaseAddress)
  2365. {
  2366. DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister;
  2367. InboundDoorBellRegister.All =
  2368. readl(ControllerBaseAddress +
  2369. DAC960_GEM_InboundDoorBellRegisterReadSetOffset);
  2370. return InboundDoorBellRegister.Read.HardwareMailboxFull;
  2371. }
  2372. static inline
  2373. bool DAC960_GEM_InitializationInProgressP(void __iomem *ControllerBaseAddress)
  2374. {
  2375. DAC960_GEM_InboundDoorBellRegister_T InboundDoorBellRegister;
  2376. InboundDoorBellRegister.All =
  2377. readl(ControllerBaseAddress +
  2378. DAC960_GEM_InboundDoorBellRegisterReadSetOffset);
  2379. return InboundDoorBellRegister.Read.InitializationInProgress;
  2380. }
  2381. static inline
  2382. void DAC960_GEM_AcknowledgeHardwareMailboxInterrupt(void __iomem *ControllerBaseAddress)
  2383. {
  2384. DAC960_GEM_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2385. OutboundDoorBellRegister.All = 0;
  2386. OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
  2387. writel(OutboundDoorBellRegister.All,
  2388. ControllerBaseAddress + DAC960_GEM_OutboundDoorBellRegisterClearOffset);
  2389. }
  2390. static inline
  2391. void DAC960_GEM_AcknowledgeMemoryMailboxInterrupt(void __iomem *ControllerBaseAddress)
  2392. {
  2393. DAC960_GEM_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2394. OutboundDoorBellRegister.All = 0;
  2395. OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
  2396. writel(OutboundDoorBellRegister.All,
  2397. ControllerBaseAddress + DAC960_GEM_OutboundDoorBellRegisterClearOffset);
  2398. }
  2399. static inline
  2400. void DAC960_GEM_AcknowledgeInterrupt(void __iomem *ControllerBaseAddress)
  2401. {
  2402. DAC960_GEM_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2403. OutboundDoorBellRegister.All = 0;
  2404. OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
  2405. OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
  2406. writel(OutboundDoorBellRegister.All,
  2407. ControllerBaseAddress + DAC960_GEM_OutboundDoorBellRegisterClearOffset);
  2408. }
  2409. static inline
  2410. bool DAC960_GEM_HardwareMailboxStatusAvailableP(void __iomem *ControllerBaseAddress)
  2411. {
  2412. DAC960_GEM_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2413. OutboundDoorBellRegister.All =
  2414. readl(ControllerBaseAddress +
  2415. DAC960_GEM_OutboundDoorBellRegisterReadSetOffset);
  2416. return OutboundDoorBellRegister.Read.HardwareMailboxStatusAvailable;
  2417. }
  2418. static inline
  2419. bool DAC960_GEM_MemoryMailboxStatusAvailableP(void __iomem *ControllerBaseAddress)
  2420. {
  2421. DAC960_GEM_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2422. OutboundDoorBellRegister.All =
  2423. readl(ControllerBaseAddress +
  2424. DAC960_GEM_OutboundDoorBellRegisterReadSetOffset);
  2425. return OutboundDoorBellRegister.Read.MemoryMailboxStatusAvailable;
  2426. }
  2427. static inline
  2428. void DAC960_GEM_EnableInterrupts(void __iomem *ControllerBaseAddress)
  2429. {
  2430. DAC960_GEM_InterruptMaskRegister_T InterruptMaskRegister;
  2431. InterruptMaskRegister.All = 0;
  2432. InterruptMaskRegister.Bits.HardwareMailboxInterrupt = true;
  2433. InterruptMaskRegister.Bits.MemoryMailboxInterrupt = true;
  2434. writel(InterruptMaskRegister.All,
  2435. ControllerBaseAddress + DAC960_GEM_InterruptMaskRegisterClearOffset);
  2436. }
  2437. static inline
  2438. void DAC960_GEM_DisableInterrupts(void __iomem *ControllerBaseAddress)
  2439. {
  2440. DAC960_GEM_InterruptMaskRegister_T InterruptMaskRegister;
  2441. InterruptMaskRegister.All = 0;
  2442. InterruptMaskRegister.Bits.HardwareMailboxInterrupt = true;
  2443. InterruptMaskRegister.Bits.MemoryMailboxInterrupt = true;
  2444. writel(InterruptMaskRegister.All,
  2445. ControllerBaseAddress + DAC960_GEM_InterruptMaskRegisterReadSetOffset);
  2446. }
  2447. static inline
  2448. bool DAC960_GEM_InterruptsEnabledP(void __iomem *ControllerBaseAddress)
  2449. {
  2450. DAC960_GEM_InterruptMaskRegister_T InterruptMaskRegister;
  2451. InterruptMaskRegister.All =
  2452. readl(ControllerBaseAddress +
  2453. DAC960_GEM_InterruptMaskRegisterReadSetOffset);
  2454. return !(InterruptMaskRegister.Bits.HardwareMailboxInterrupt ||
  2455. InterruptMaskRegister.Bits.MemoryMailboxInterrupt);
  2456. }
  2457. static inline
  2458. void DAC960_GEM_WriteCommandMailbox(DAC960_V2_CommandMailbox_T
  2459. *MemoryCommandMailbox,
  2460. DAC960_V2_CommandMailbox_T
  2461. *CommandMailbox)
  2462. {
  2463. memcpy(&MemoryCommandMailbox->Words[1], &CommandMailbox->Words[1],
  2464. sizeof(DAC960_V2_CommandMailbox_T) - sizeof(unsigned int));
  2465. wmb();
  2466. MemoryCommandMailbox->Words[0] = CommandMailbox->Words[0];
  2467. mb();
  2468. }
  2469. static inline
  2470. void DAC960_GEM_WriteHardwareMailbox(void __iomem *ControllerBaseAddress,
  2471. dma_addr_t CommandMailboxDMA)
  2472. {
  2473. dma_addr_writeql(CommandMailboxDMA,
  2474. ControllerBaseAddress +
  2475. DAC960_GEM_CommandMailboxBusAddressOffset);
  2476. }
  2477. static inline DAC960_V2_CommandIdentifier_T
  2478. DAC960_GEM_ReadCommandIdentifier(void __iomem *ControllerBaseAddress)
  2479. {
  2480. return readw(ControllerBaseAddress + DAC960_GEM_CommandStatusOffset);
  2481. }
  2482. static inline DAC960_V2_CommandStatus_T
  2483. DAC960_GEM_ReadCommandStatus(void __iomem *ControllerBaseAddress)
  2484. {
  2485. return readw(ControllerBaseAddress + DAC960_GEM_CommandStatusOffset + 2);
  2486. }
  2487. static inline bool
  2488. DAC960_GEM_ReadErrorStatus(void __iomem *ControllerBaseAddress,
  2489. unsigned char *ErrorStatus,
  2490. unsigned char *Parameter0,
  2491. unsigned char *Parameter1)
  2492. {
  2493. DAC960_GEM_ErrorStatusRegister_T ErrorStatusRegister;
  2494. ErrorStatusRegister.All =
  2495. readl(ControllerBaseAddress + DAC960_GEM_ErrorStatusRegisterReadSetOffset);
  2496. if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false;
  2497. ErrorStatusRegister.Bits.ErrorStatusPending = false;
  2498. *ErrorStatus = ErrorStatusRegister.All;
  2499. *Parameter0 =
  2500. readb(ControllerBaseAddress + DAC960_GEM_CommandMailboxBusAddressOffset + 0);
  2501. *Parameter1 =
  2502. readb(ControllerBaseAddress + DAC960_GEM_CommandMailboxBusAddressOffset + 1);
  2503. writel(0x03000000, ControllerBaseAddress +
  2504. DAC960_GEM_ErrorStatusRegisterClearOffset);
  2505. return true;
  2506. }
  2507. /*
  2508. Define the DAC960 BA Series Controller Interface Register Offsets.
  2509. */
  2510. #define DAC960_BA_RegisterWindowSize 0x80
  2511. typedef enum
  2512. {
  2513. DAC960_BA_InboundDoorBellRegisterOffset = 0x60,
  2514. DAC960_BA_OutboundDoorBellRegisterOffset = 0x61,
  2515. DAC960_BA_InterruptStatusRegisterOffset = 0x30,
  2516. DAC960_BA_InterruptMaskRegisterOffset = 0x34,
  2517. DAC960_BA_CommandMailboxBusAddressOffset = 0x50,
  2518. DAC960_BA_CommandStatusOffset = 0x58,
  2519. DAC960_BA_ErrorStatusRegisterOffset = 0x63
  2520. }
  2521. DAC960_BA_RegisterOffsets_T;
  2522. /*
  2523. Define the structure of the DAC960 BA Series Inbound Door Bell Register.
  2524. */
  2525. typedef union DAC960_BA_InboundDoorBellRegister
  2526. {
  2527. unsigned char All;
  2528. struct {
  2529. bool HardwareMailboxNewCommand:1; /* Bit 0 */
  2530. bool AcknowledgeHardwareMailboxStatus:1; /* Bit 1 */
  2531. bool GenerateInterrupt:1; /* Bit 2 */
  2532. bool ControllerReset:1; /* Bit 3 */
  2533. bool MemoryMailboxNewCommand:1; /* Bit 4 */
  2534. unsigned char :3; /* Bits 5-7 */
  2535. } Write;
  2536. struct {
  2537. bool HardwareMailboxEmpty:1; /* Bit 0 */
  2538. bool InitializationNotInProgress:1; /* Bit 1 */
  2539. unsigned char :6; /* Bits 2-7 */
  2540. } Read;
  2541. }
  2542. DAC960_BA_InboundDoorBellRegister_T;
  2543. /*
  2544. Define the structure of the DAC960 BA Series Outbound Door Bell Register.
  2545. */
  2546. typedef union DAC960_BA_OutboundDoorBellRegister
  2547. {
  2548. unsigned char All;
  2549. struct {
  2550. bool AcknowledgeHardwareMailboxInterrupt:1; /* Bit 0 */
  2551. bool AcknowledgeMemoryMailboxInterrupt:1; /* Bit 1 */
  2552. unsigned char :6; /* Bits 2-7 */
  2553. } Write;
  2554. struct {
  2555. bool HardwareMailboxStatusAvailable:1; /* Bit 0 */
  2556. bool MemoryMailboxStatusAvailable:1; /* Bit 1 */
  2557. unsigned char :6; /* Bits 2-7 */
  2558. } Read;
  2559. }
  2560. DAC960_BA_OutboundDoorBellRegister_T;
  2561. /*
  2562. Define the structure of the DAC960 BA Series Interrupt Mask Register.
  2563. */
  2564. typedef union DAC960_BA_InterruptMaskRegister
  2565. {
  2566. unsigned char All;
  2567. struct {
  2568. unsigned int :2; /* Bits 0-1 */
  2569. bool DisableInterrupts:1; /* Bit 2 */
  2570. bool DisableInterruptsI2O:1; /* Bit 3 */
  2571. unsigned int :4; /* Bits 4-7 */
  2572. } Bits;
  2573. }
  2574. DAC960_BA_InterruptMaskRegister_T;
  2575. /*
  2576. Define the structure of the DAC960 BA Series Error Status Register.
  2577. */
  2578. typedef union DAC960_BA_ErrorStatusRegister
  2579. {
  2580. unsigned char All;
  2581. struct {
  2582. unsigned int :2; /* Bits 0-1 */
  2583. bool ErrorStatusPending:1; /* Bit 2 */
  2584. unsigned int :5; /* Bits 3-7 */
  2585. } Bits;
  2586. }
  2587. DAC960_BA_ErrorStatusRegister_T;
  2588. /*
  2589. Define inline functions to provide an abstraction for reading and writing the
  2590. DAC960 BA Series Controller Interface Registers.
  2591. */
  2592. static inline
  2593. void DAC960_BA_HardwareMailboxNewCommand(void __iomem *ControllerBaseAddress)
  2594. {
  2595. DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
  2596. InboundDoorBellRegister.All = 0;
  2597. InboundDoorBellRegister.Write.HardwareMailboxNewCommand = true;
  2598. writeb(InboundDoorBellRegister.All,
  2599. ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
  2600. }
  2601. static inline
  2602. void DAC960_BA_AcknowledgeHardwareMailboxStatus(void __iomem *ControllerBaseAddress)
  2603. {
  2604. DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
  2605. InboundDoorBellRegister.All = 0;
  2606. InboundDoorBellRegister.Write.AcknowledgeHardwareMailboxStatus = true;
  2607. writeb(InboundDoorBellRegister.All,
  2608. ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
  2609. }
  2610. static inline
  2611. void DAC960_BA_GenerateInterrupt(void __iomem *ControllerBaseAddress)
  2612. {
  2613. DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
  2614. InboundDoorBellRegister.All = 0;
  2615. InboundDoorBellRegister.Write.GenerateInterrupt = true;
  2616. writeb(InboundDoorBellRegister.All,
  2617. ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
  2618. }
  2619. static inline
  2620. void DAC960_BA_ControllerReset(void __iomem *ControllerBaseAddress)
  2621. {
  2622. DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
  2623. InboundDoorBellRegister.All = 0;
  2624. InboundDoorBellRegister.Write.ControllerReset = true;
  2625. writeb(InboundDoorBellRegister.All,
  2626. ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
  2627. }
  2628. static inline
  2629. void DAC960_BA_MemoryMailboxNewCommand(void __iomem *ControllerBaseAddress)
  2630. {
  2631. DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
  2632. InboundDoorBellRegister.All = 0;
  2633. InboundDoorBellRegister.Write.MemoryMailboxNewCommand = true;
  2634. writeb(InboundDoorBellRegister.All,
  2635. ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
  2636. }
  2637. static inline
  2638. bool DAC960_BA_HardwareMailboxFullP(void __iomem *ControllerBaseAddress)
  2639. {
  2640. DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
  2641. InboundDoorBellRegister.All =
  2642. readb(ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
  2643. return !InboundDoorBellRegister.Read.HardwareMailboxEmpty;
  2644. }
  2645. static inline
  2646. bool DAC960_BA_InitializationInProgressP(void __iomem *ControllerBaseAddress)
  2647. {
  2648. DAC960_BA_InboundDoorBellRegister_T InboundDoorBellRegister;
  2649. InboundDoorBellRegister.All =
  2650. readb(ControllerBaseAddress + DAC960_BA_InboundDoorBellRegisterOffset);
  2651. return !InboundDoorBellRegister.Read.InitializationNotInProgress;
  2652. }
  2653. static inline
  2654. void DAC960_BA_AcknowledgeHardwareMailboxInterrupt(void __iomem *ControllerBaseAddress)
  2655. {
  2656. DAC960_BA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2657. OutboundDoorBellRegister.All = 0;
  2658. OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
  2659. writeb(OutboundDoorBellRegister.All,
  2660. ControllerBaseAddress + DAC960_BA_OutboundDoorBellRegisterOffset);
  2661. }
  2662. static inline
  2663. void DAC960_BA_AcknowledgeMemoryMailboxInterrupt(void __iomem *ControllerBaseAddress)
  2664. {
  2665. DAC960_BA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2666. OutboundDoorBellRegister.All = 0;
  2667. OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
  2668. writeb(OutboundDoorBellRegister.All,
  2669. ControllerBaseAddress + DAC960_BA_OutboundDoorBellRegisterOffset);
  2670. }
  2671. static inline
  2672. void DAC960_BA_AcknowledgeInterrupt(void __iomem *ControllerBaseAddress)
  2673. {
  2674. DAC960_BA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2675. OutboundDoorBellRegister.All = 0;
  2676. OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
  2677. OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
  2678. writeb(OutboundDoorBellRegister.All,
  2679. ControllerBaseAddress + DAC960_BA_OutboundDoorBellRegisterOffset);
  2680. }
  2681. static inline
  2682. bool DAC960_BA_HardwareMailboxStatusAvailableP(void __iomem *ControllerBaseAddress)
  2683. {
  2684. DAC960_BA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2685. OutboundDoorBellRegister.All =
  2686. readb(ControllerBaseAddress + DAC960_BA_OutboundDoorBellRegisterOffset);
  2687. return OutboundDoorBellRegister.Read.HardwareMailboxStatusAvailable;
  2688. }
  2689. static inline
  2690. bool DAC960_BA_MemoryMailboxStatusAvailableP(void __iomem *ControllerBaseAddress)
  2691. {
  2692. DAC960_BA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2693. OutboundDoorBellRegister.All =
  2694. readb(ControllerBaseAddress + DAC960_BA_OutboundDoorBellRegisterOffset);
  2695. return OutboundDoorBellRegister.Read.MemoryMailboxStatusAvailable;
  2696. }
  2697. static inline
  2698. void DAC960_BA_EnableInterrupts(void __iomem *ControllerBaseAddress)
  2699. {
  2700. DAC960_BA_InterruptMaskRegister_T InterruptMaskRegister;
  2701. InterruptMaskRegister.All = 0xFF;
  2702. InterruptMaskRegister.Bits.DisableInterrupts = false;
  2703. InterruptMaskRegister.Bits.DisableInterruptsI2O = true;
  2704. writeb(InterruptMaskRegister.All,
  2705. ControllerBaseAddress + DAC960_BA_InterruptMaskRegisterOffset);
  2706. }
  2707. static inline
  2708. void DAC960_BA_DisableInterrupts(void __iomem *ControllerBaseAddress)
  2709. {
  2710. DAC960_BA_InterruptMaskRegister_T InterruptMaskRegister;
  2711. InterruptMaskRegister.All = 0xFF;
  2712. InterruptMaskRegister.Bits.DisableInterrupts = true;
  2713. InterruptMaskRegister.Bits.DisableInterruptsI2O = true;
  2714. writeb(InterruptMaskRegister.All,
  2715. ControllerBaseAddress + DAC960_BA_InterruptMaskRegisterOffset);
  2716. }
  2717. static inline
  2718. bool DAC960_BA_InterruptsEnabledP(void __iomem *ControllerBaseAddress)
  2719. {
  2720. DAC960_BA_InterruptMaskRegister_T InterruptMaskRegister;
  2721. InterruptMaskRegister.All =
  2722. readb(ControllerBaseAddress + DAC960_BA_InterruptMaskRegisterOffset);
  2723. return !InterruptMaskRegister.Bits.DisableInterrupts;
  2724. }
  2725. static inline
  2726. void DAC960_BA_WriteCommandMailbox(DAC960_V2_CommandMailbox_T
  2727. *MemoryCommandMailbox,
  2728. DAC960_V2_CommandMailbox_T
  2729. *CommandMailbox)
  2730. {
  2731. memcpy(&MemoryCommandMailbox->Words[1], &CommandMailbox->Words[1],
  2732. sizeof(DAC960_V2_CommandMailbox_T) - sizeof(unsigned int));
  2733. wmb();
  2734. MemoryCommandMailbox->Words[0] = CommandMailbox->Words[0];
  2735. mb();
  2736. }
  2737. static inline
  2738. void DAC960_BA_WriteHardwareMailbox(void __iomem *ControllerBaseAddress,
  2739. dma_addr_t CommandMailboxDMA)
  2740. {
  2741. dma_addr_writeql(CommandMailboxDMA,
  2742. ControllerBaseAddress +
  2743. DAC960_BA_CommandMailboxBusAddressOffset);
  2744. }
  2745. static inline DAC960_V2_CommandIdentifier_T
  2746. DAC960_BA_ReadCommandIdentifier(void __iomem *ControllerBaseAddress)
  2747. {
  2748. return readw(ControllerBaseAddress + DAC960_BA_CommandStatusOffset);
  2749. }
  2750. static inline DAC960_V2_CommandStatus_T
  2751. DAC960_BA_ReadCommandStatus(void __iomem *ControllerBaseAddress)
  2752. {
  2753. return readw(ControllerBaseAddress + DAC960_BA_CommandStatusOffset + 2);
  2754. }
  2755. static inline bool
  2756. DAC960_BA_ReadErrorStatus(void __iomem *ControllerBaseAddress,
  2757. unsigned char *ErrorStatus,
  2758. unsigned char *Parameter0,
  2759. unsigned char *Parameter1)
  2760. {
  2761. DAC960_BA_ErrorStatusRegister_T ErrorStatusRegister;
  2762. ErrorStatusRegister.All =
  2763. readb(ControllerBaseAddress + DAC960_BA_ErrorStatusRegisterOffset);
  2764. if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false;
  2765. ErrorStatusRegister.Bits.ErrorStatusPending = false;
  2766. *ErrorStatus = ErrorStatusRegister.All;
  2767. *Parameter0 =
  2768. readb(ControllerBaseAddress + DAC960_BA_CommandMailboxBusAddressOffset + 0);
  2769. *Parameter1 =
  2770. readb(ControllerBaseAddress + DAC960_BA_CommandMailboxBusAddressOffset + 1);
  2771. writeb(0xFF, ControllerBaseAddress + DAC960_BA_ErrorStatusRegisterOffset);
  2772. return true;
  2773. }
  2774. /*
  2775. Define the DAC960 LP Series Controller Interface Register Offsets.
  2776. */
  2777. #define DAC960_LP_RegisterWindowSize 0x80
  2778. typedef enum
  2779. {
  2780. DAC960_LP_InboundDoorBellRegisterOffset = 0x20,
  2781. DAC960_LP_OutboundDoorBellRegisterOffset = 0x2C,
  2782. DAC960_LP_InterruptStatusRegisterOffset = 0x30,
  2783. DAC960_LP_InterruptMaskRegisterOffset = 0x34,
  2784. DAC960_LP_CommandMailboxBusAddressOffset = 0x10,
  2785. DAC960_LP_CommandStatusOffset = 0x18,
  2786. DAC960_LP_ErrorStatusRegisterOffset = 0x2E
  2787. }
  2788. DAC960_LP_RegisterOffsets_T;
  2789. /*
  2790. Define the structure of the DAC960 LP Series Inbound Door Bell Register.
  2791. */
  2792. typedef union DAC960_LP_InboundDoorBellRegister
  2793. {
  2794. unsigned char All;
  2795. struct {
  2796. bool HardwareMailboxNewCommand:1; /* Bit 0 */
  2797. bool AcknowledgeHardwareMailboxStatus:1; /* Bit 1 */
  2798. bool GenerateInterrupt:1; /* Bit 2 */
  2799. bool ControllerReset:1; /* Bit 3 */
  2800. bool MemoryMailboxNewCommand:1; /* Bit 4 */
  2801. unsigned char :3; /* Bits 5-7 */
  2802. } Write;
  2803. struct {
  2804. bool HardwareMailboxFull:1; /* Bit 0 */
  2805. bool InitializationInProgress:1; /* Bit 1 */
  2806. unsigned char :6; /* Bits 2-7 */
  2807. } Read;
  2808. }
  2809. DAC960_LP_InboundDoorBellRegister_T;
  2810. /*
  2811. Define the structure of the DAC960 LP Series Outbound Door Bell Register.
  2812. */
  2813. typedef union DAC960_LP_OutboundDoorBellRegister
  2814. {
  2815. unsigned char All;
  2816. struct {
  2817. bool AcknowledgeHardwareMailboxInterrupt:1; /* Bit 0 */
  2818. bool AcknowledgeMemoryMailboxInterrupt:1; /* Bit 1 */
  2819. unsigned char :6; /* Bits 2-7 */
  2820. } Write;
  2821. struct {
  2822. bool HardwareMailboxStatusAvailable:1; /* Bit 0 */
  2823. bool MemoryMailboxStatusAvailable:1; /* Bit 1 */
  2824. unsigned char :6; /* Bits 2-7 */
  2825. } Read;
  2826. }
  2827. DAC960_LP_OutboundDoorBellRegister_T;
  2828. /*
  2829. Define the structure of the DAC960 LP Series Interrupt Mask Register.
  2830. */
  2831. typedef union DAC960_LP_InterruptMaskRegister
  2832. {
  2833. unsigned char All;
  2834. struct {
  2835. unsigned int :2; /* Bits 0-1 */
  2836. bool DisableInterrupts:1; /* Bit 2 */
  2837. unsigned int :5; /* Bits 3-7 */
  2838. } Bits;
  2839. }
  2840. DAC960_LP_InterruptMaskRegister_T;
  2841. /*
  2842. Define the structure of the DAC960 LP Series Error Status Register.
  2843. */
  2844. typedef union DAC960_LP_ErrorStatusRegister
  2845. {
  2846. unsigned char All;
  2847. struct {
  2848. unsigned int :2; /* Bits 0-1 */
  2849. bool ErrorStatusPending:1; /* Bit 2 */
  2850. unsigned int :5; /* Bits 3-7 */
  2851. } Bits;
  2852. }
  2853. DAC960_LP_ErrorStatusRegister_T;
  2854. /*
  2855. Define inline functions to provide an abstraction for reading and writing the
  2856. DAC960 LP Series Controller Interface Registers.
  2857. */
  2858. static inline
  2859. void DAC960_LP_HardwareMailboxNewCommand(void __iomem *ControllerBaseAddress)
  2860. {
  2861. DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
  2862. InboundDoorBellRegister.All = 0;
  2863. InboundDoorBellRegister.Write.HardwareMailboxNewCommand = true;
  2864. writeb(InboundDoorBellRegister.All,
  2865. ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
  2866. }
  2867. static inline
  2868. void DAC960_LP_AcknowledgeHardwareMailboxStatus(void __iomem *ControllerBaseAddress)
  2869. {
  2870. DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
  2871. InboundDoorBellRegister.All = 0;
  2872. InboundDoorBellRegister.Write.AcknowledgeHardwareMailboxStatus = true;
  2873. writeb(InboundDoorBellRegister.All,
  2874. ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
  2875. }
  2876. static inline
  2877. void DAC960_LP_GenerateInterrupt(void __iomem *ControllerBaseAddress)
  2878. {
  2879. DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
  2880. InboundDoorBellRegister.All = 0;
  2881. InboundDoorBellRegister.Write.GenerateInterrupt = true;
  2882. writeb(InboundDoorBellRegister.All,
  2883. ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
  2884. }
  2885. static inline
  2886. void DAC960_LP_ControllerReset(void __iomem *ControllerBaseAddress)
  2887. {
  2888. DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
  2889. InboundDoorBellRegister.All = 0;
  2890. InboundDoorBellRegister.Write.ControllerReset = true;
  2891. writeb(InboundDoorBellRegister.All,
  2892. ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
  2893. }
  2894. static inline
  2895. void DAC960_LP_MemoryMailboxNewCommand(void __iomem *ControllerBaseAddress)
  2896. {
  2897. DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
  2898. InboundDoorBellRegister.All = 0;
  2899. InboundDoorBellRegister.Write.MemoryMailboxNewCommand = true;
  2900. writeb(InboundDoorBellRegister.All,
  2901. ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
  2902. }
  2903. static inline
  2904. bool DAC960_LP_HardwareMailboxFullP(void __iomem *ControllerBaseAddress)
  2905. {
  2906. DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
  2907. InboundDoorBellRegister.All =
  2908. readb(ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
  2909. return InboundDoorBellRegister.Read.HardwareMailboxFull;
  2910. }
  2911. static inline
  2912. bool DAC960_LP_InitializationInProgressP(void __iomem *ControllerBaseAddress)
  2913. {
  2914. DAC960_LP_InboundDoorBellRegister_T InboundDoorBellRegister;
  2915. InboundDoorBellRegister.All =
  2916. readb(ControllerBaseAddress + DAC960_LP_InboundDoorBellRegisterOffset);
  2917. return InboundDoorBellRegister.Read.InitializationInProgress;
  2918. }
  2919. static inline
  2920. void DAC960_LP_AcknowledgeHardwareMailboxInterrupt(void __iomem *ControllerBaseAddress)
  2921. {
  2922. DAC960_LP_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2923. OutboundDoorBellRegister.All = 0;
  2924. OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
  2925. writeb(OutboundDoorBellRegister.All,
  2926. ControllerBaseAddress + DAC960_LP_OutboundDoorBellRegisterOffset);
  2927. }
  2928. static inline
  2929. void DAC960_LP_AcknowledgeMemoryMailboxInterrupt(void __iomem *ControllerBaseAddress)
  2930. {
  2931. DAC960_LP_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2932. OutboundDoorBellRegister.All = 0;
  2933. OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
  2934. writeb(OutboundDoorBellRegister.All,
  2935. ControllerBaseAddress + DAC960_LP_OutboundDoorBellRegisterOffset);
  2936. }
  2937. static inline
  2938. void DAC960_LP_AcknowledgeInterrupt(void __iomem *ControllerBaseAddress)
  2939. {
  2940. DAC960_LP_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2941. OutboundDoorBellRegister.All = 0;
  2942. OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
  2943. OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
  2944. writeb(OutboundDoorBellRegister.All,
  2945. ControllerBaseAddress + DAC960_LP_OutboundDoorBellRegisterOffset);
  2946. }
  2947. static inline
  2948. bool DAC960_LP_HardwareMailboxStatusAvailableP(void __iomem *ControllerBaseAddress)
  2949. {
  2950. DAC960_LP_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2951. OutboundDoorBellRegister.All =
  2952. readb(ControllerBaseAddress + DAC960_LP_OutboundDoorBellRegisterOffset);
  2953. return OutboundDoorBellRegister.Read.HardwareMailboxStatusAvailable;
  2954. }
  2955. static inline
  2956. bool DAC960_LP_MemoryMailboxStatusAvailableP(void __iomem *ControllerBaseAddress)
  2957. {
  2958. DAC960_LP_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  2959. OutboundDoorBellRegister.All =
  2960. readb(ControllerBaseAddress + DAC960_LP_OutboundDoorBellRegisterOffset);
  2961. return OutboundDoorBellRegister.Read.MemoryMailboxStatusAvailable;
  2962. }
  2963. static inline
  2964. void DAC960_LP_EnableInterrupts(void __iomem *ControllerBaseAddress)
  2965. {
  2966. DAC960_LP_InterruptMaskRegister_T InterruptMaskRegister;
  2967. InterruptMaskRegister.All = 0xFF;
  2968. InterruptMaskRegister.Bits.DisableInterrupts = false;
  2969. writeb(InterruptMaskRegister.All,
  2970. ControllerBaseAddress + DAC960_LP_InterruptMaskRegisterOffset);
  2971. }
  2972. static inline
  2973. void DAC960_LP_DisableInterrupts(void __iomem *ControllerBaseAddress)
  2974. {
  2975. DAC960_LP_InterruptMaskRegister_T InterruptMaskRegister;
  2976. InterruptMaskRegister.All = 0xFF;
  2977. InterruptMaskRegister.Bits.DisableInterrupts = true;
  2978. writeb(InterruptMaskRegister.All,
  2979. ControllerBaseAddress + DAC960_LP_InterruptMaskRegisterOffset);
  2980. }
  2981. static inline
  2982. bool DAC960_LP_InterruptsEnabledP(void __iomem *ControllerBaseAddress)
  2983. {
  2984. DAC960_LP_InterruptMaskRegister_T InterruptMaskRegister;
  2985. InterruptMaskRegister.All =
  2986. readb(ControllerBaseAddress + DAC960_LP_InterruptMaskRegisterOffset);
  2987. return !InterruptMaskRegister.Bits.DisableInterrupts;
  2988. }
  2989. static inline
  2990. void DAC960_LP_WriteCommandMailbox(DAC960_V2_CommandMailbox_T
  2991. *MemoryCommandMailbox,
  2992. DAC960_V2_CommandMailbox_T
  2993. *CommandMailbox)
  2994. {
  2995. memcpy(&MemoryCommandMailbox->Words[1], &CommandMailbox->Words[1],
  2996. sizeof(DAC960_V2_CommandMailbox_T) - sizeof(unsigned int));
  2997. wmb();
  2998. MemoryCommandMailbox->Words[0] = CommandMailbox->Words[0];
  2999. mb();
  3000. }
  3001. static inline
  3002. void DAC960_LP_WriteHardwareMailbox(void __iomem *ControllerBaseAddress,
  3003. dma_addr_t CommandMailboxDMA)
  3004. {
  3005. dma_addr_writeql(CommandMailboxDMA,
  3006. ControllerBaseAddress +
  3007. DAC960_LP_CommandMailboxBusAddressOffset);
  3008. }
  3009. static inline DAC960_V2_CommandIdentifier_T
  3010. DAC960_LP_ReadCommandIdentifier(void __iomem *ControllerBaseAddress)
  3011. {
  3012. return readw(ControllerBaseAddress + DAC960_LP_CommandStatusOffset);
  3013. }
  3014. static inline DAC960_V2_CommandStatus_T
  3015. DAC960_LP_ReadCommandStatus(void __iomem *ControllerBaseAddress)
  3016. {
  3017. return readw(ControllerBaseAddress + DAC960_LP_CommandStatusOffset + 2);
  3018. }
  3019. static inline bool
  3020. DAC960_LP_ReadErrorStatus(void __iomem *ControllerBaseAddress,
  3021. unsigned char *ErrorStatus,
  3022. unsigned char *Parameter0,
  3023. unsigned char *Parameter1)
  3024. {
  3025. DAC960_LP_ErrorStatusRegister_T ErrorStatusRegister;
  3026. ErrorStatusRegister.All =
  3027. readb(ControllerBaseAddress + DAC960_LP_ErrorStatusRegisterOffset);
  3028. if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false;
  3029. ErrorStatusRegister.Bits.ErrorStatusPending = false;
  3030. *ErrorStatus = ErrorStatusRegister.All;
  3031. *Parameter0 =
  3032. readb(ControllerBaseAddress + DAC960_LP_CommandMailboxBusAddressOffset + 0);
  3033. *Parameter1 =
  3034. readb(ControllerBaseAddress + DAC960_LP_CommandMailboxBusAddressOffset + 1);
  3035. writeb(0xFF, ControllerBaseAddress + DAC960_LP_ErrorStatusRegisterOffset);
  3036. return true;
  3037. }
  3038. /*
  3039. Define the DAC960 LA Series Controller Interface Register Offsets.
  3040. */
  3041. #define DAC960_LA_RegisterWindowSize 0x80
  3042. typedef enum
  3043. {
  3044. DAC960_LA_InboundDoorBellRegisterOffset = 0x60,
  3045. DAC960_LA_OutboundDoorBellRegisterOffset = 0x61,
  3046. DAC960_LA_InterruptMaskRegisterOffset = 0x34,
  3047. DAC960_LA_CommandOpcodeRegisterOffset = 0x50,
  3048. DAC960_LA_CommandIdentifierRegisterOffset = 0x51,
  3049. DAC960_LA_MailboxRegister2Offset = 0x52,
  3050. DAC960_LA_MailboxRegister3Offset = 0x53,
  3051. DAC960_LA_MailboxRegister4Offset = 0x54,
  3052. DAC960_LA_MailboxRegister5Offset = 0x55,
  3053. DAC960_LA_MailboxRegister6Offset = 0x56,
  3054. DAC960_LA_MailboxRegister7Offset = 0x57,
  3055. DAC960_LA_MailboxRegister8Offset = 0x58,
  3056. DAC960_LA_MailboxRegister9Offset = 0x59,
  3057. DAC960_LA_MailboxRegister10Offset = 0x5A,
  3058. DAC960_LA_MailboxRegister11Offset = 0x5B,
  3059. DAC960_LA_MailboxRegister12Offset = 0x5C,
  3060. DAC960_LA_StatusCommandIdentifierRegOffset = 0x5D,
  3061. DAC960_LA_StatusRegisterOffset = 0x5E,
  3062. DAC960_LA_ErrorStatusRegisterOffset = 0x63
  3063. }
  3064. DAC960_LA_RegisterOffsets_T;
  3065. /*
  3066. Define the structure of the DAC960 LA Series Inbound Door Bell Register.
  3067. */
  3068. typedef union DAC960_LA_InboundDoorBellRegister
  3069. {
  3070. unsigned char All;
  3071. struct {
  3072. bool HardwareMailboxNewCommand:1; /* Bit 0 */
  3073. bool AcknowledgeHardwareMailboxStatus:1; /* Bit 1 */
  3074. bool GenerateInterrupt:1; /* Bit 2 */
  3075. bool ControllerReset:1; /* Bit 3 */
  3076. bool MemoryMailboxNewCommand:1; /* Bit 4 */
  3077. unsigned char :3; /* Bits 5-7 */
  3078. } Write;
  3079. struct {
  3080. bool HardwareMailboxEmpty:1; /* Bit 0 */
  3081. bool InitializationNotInProgress:1; /* Bit 1 */
  3082. unsigned char :6; /* Bits 2-7 */
  3083. } Read;
  3084. }
  3085. DAC960_LA_InboundDoorBellRegister_T;
  3086. /*
  3087. Define the structure of the DAC960 LA Series Outbound Door Bell Register.
  3088. */
  3089. typedef union DAC960_LA_OutboundDoorBellRegister
  3090. {
  3091. unsigned char All;
  3092. struct {
  3093. bool AcknowledgeHardwareMailboxInterrupt:1; /* Bit 0 */
  3094. bool AcknowledgeMemoryMailboxInterrupt:1; /* Bit 1 */
  3095. unsigned char :6; /* Bits 2-7 */
  3096. } Write;
  3097. struct {
  3098. bool HardwareMailboxStatusAvailable:1; /* Bit 0 */
  3099. bool MemoryMailboxStatusAvailable:1; /* Bit 1 */
  3100. unsigned char :6; /* Bits 2-7 */
  3101. } Read;
  3102. }
  3103. DAC960_LA_OutboundDoorBellRegister_T;
  3104. /*
  3105. Define the structure of the DAC960 LA Series Interrupt Mask Register.
  3106. */
  3107. typedef union DAC960_LA_InterruptMaskRegister
  3108. {
  3109. unsigned char All;
  3110. struct {
  3111. unsigned char :2; /* Bits 0-1 */
  3112. bool DisableInterrupts:1; /* Bit 2 */
  3113. unsigned char :5; /* Bits 3-7 */
  3114. } Bits;
  3115. }
  3116. DAC960_LA_InterruptMaskRegister_T;
  3117. /*
  3118. Define the structure of the DAC960 LA Series Error Status Register.
  3119. */
  3120. typedef union DAC960_LA_ErrorStatusRegister
  3121. {
  3122. unsigned char All;
  3123. struct {
  3124. unsigned int :2; /* Bits 0-1 */
  3125. bool ErrorStatusPending:1; /* Bit 2 */
  3126. unsigned int :5; /* Bits 3-7 */
  3127. } Bits;
  3128. }
  3129. DAC960_LA_ErrorStatusRegister_T;
  3130. /*
  3131. Define inline functions to provide an abstraction for reading and writing the
  3132. DAC960 LA Series Controller Interface Registers.
  3133. */
  3134. static inline
  3135. void DAC960_LA_HardwareMailboxNewCommand(void __iomem *ControllerBaseAddress)
  3136. {
  3137. DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
  3138. InboundDoorBellRegister.All = 0;
  3139. InboundDoorBellRegister.Write.HardwareMailboxNewCommand = true;
  3140. writeb(InboundDoorBellRegister.All,
  3141. ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
  3142. }
  3143. static inline
  3144. void DAC960_LA_AcknowledgeHardwareMailboxStatus(void __iomem *ControllerBaseAddress)
  3145. {
  3146. DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
  3147. InboundDoorBellRegister.All = 0;
  3148. InboundDoorBellRegister.Write.AcknowledgeHardwareMailboxStatus = true;
  3149. writeb(InboundDoorBellRegister.All,
  3150. ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
  3151. }
  3152. static inline
  3153. void DAC960_LA_GenerateInterrupt(void __iomem *ControllerBaseAddress)
  3154. {
  3155. DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
  3156. InboundDoorBellRegister.All = 0;
  3157. InboundDoorBellRegister.Write.GenerateInterrupt = true;
  3158. writeb(InboundDoorBellRegister.All,
  3159. ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
  3160. }
  3161. static inline
  3162. void DAC960_LA_ControllerReset(void __iomem *ControllerBaseAddress)
  3163. {
  3164. DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
  3165. InboundDoorBellRegister.All = 0;
  3166. InboundDoorBellRegister.Write.ControllerReset = true;
  3167. writeb(InboundDoorBellRegister.All,
  3168. ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
  3169. }
  3170. static inline
  3171. void DAC960_LA_MemoryMailboxNewCommand(void __iomem *ControllerBaseAddress)
  3172. {
  3173. DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
  3174. InboundDoorBellRegister.All = 0;
  3175. InboundDoorBellRegister.Write.MemoryMailboxNewCommand = true;
  3176. writeb(InboundDoorBellRegister.All,
  3177. ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
  3178. }
  3179. static inline
  3180. bool DAC960_LA_HardwareMailboxFullP(void __iomem *ControllerBaseAddress)
  3181. {
  3182. DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
  3183. InboundDoorBellRegister.All =
  3184. readb(ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
  3185. return !InboundDoorBellRegister.Read.HardwareMailboxEmpty;
  3186. }
  3187. static inline
  3188. bool DAC960_LA_InitializationInProgressP(void __iomem *ControllerBaseAddress)
  3189. {
  3190. DAC960_LA_InboundDoorBellRegister_T InboundDoorBellRegister;
  3191. InboundDoorBellRegister.All =
  3192. readb(ControllerBaseAddress + DAC960_LA_InboundDoorBellRegisterOffset);
  3193. return !InboundDoorBellRegister.Read.InitializationNotInProgress;
  3194. }
  3195. static inline
  3196. void DAC960_LA_AcknowledgeHardwareMailboxInterrupt(void __iomem *ControllerBaseAddress)
  3197. {
  3198. DAC960_LA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3199. OutboundDoorBellRegister.All = 0;
  3200. OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
  3201. writeb(OutboundDoorBellRegister.All,
  3202. ControllerBaseAddress + DAC960_LA_OutboundDoorBellRegisterOffset);
  3203. }
  3204. static inline
  3205. void DAC960_LA_AcknowledgeMemoryMailboxInterrupt(void __iomem *ControllerBaseAddress)
  3206. {
  3207. DAC960_LA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3208. OutboundDoorBellRegister.All = 0;
  3209. OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
  3210. writeb(OutboundDoorBellRegister.All,
  3211. ControllerBaseAddress + DAC960_LA_OutboundDoorBellRegisterOffset);
  3212. }
  3213. static inline
  3214. void DAC960_LA_AcknowledgeInterrupt(void __iomem *ControllerBaseAddress)
  3215. {
  3216. DAC960_LA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3217. OutboundDoorBellRegister.All = 0;
  3218. OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
  3219. OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
  3220. writeb(OutboundDoorBellRegister.All,
  3221. ControllerBaseAddress + DAC960_LA_OutboundDoorBellRegisterOffset);
  3222. }
  3223. static inline
  3224. bool DAC960_LA_HardwareMailboxStatusAvailableP(void __iomem *ControllerBaseAddress)
  3225. {
  3226. DAC960_LA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3227. OutboundDoorBellRegister.All =
  3228. readb(ControllerBaseAddress + DAC960_LA_OutboundDoorBellRegisterOffset);
  3229. return OutboundDoorBellRegister.Read.HardwareMailboxStatusAvailable;
  3230. }
  3231. static inline
  3232. bool DAC960_LA_MemoryMailboxStatusAvailableP(void __iomem *ControllerBaseAddress)
  3233. {
  3234. DAC960_LA_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3235. OutboundDoorBellRegister.All =
  3236. readb(ControllerBaseAddress + DAC960_LA_OutboundDoorBellRegisterOffset);
  3237. return OutboundDoorBellRegister.Read.MemoryMailboxStatusAvailable;
  3238. }
  3239. static inline
  3240. void DAC960_LA_EnableInterrupts(void __iomem *ControllerBaseAddress)
  3241. {
  3242. DAC960_LA_InterruptMaskRegister_T InterruptMaskRegister;
  3243. InterruptMaskRegister.All = 0xFF;
  3244. InterruptMaskRegister.Bits.DisableInterrupts = false;
  3245. writeb(InterruptMaskRegister.All,
  3246. ControllerBaseAddress + DAC960_LA_InterruptMaskRegisterOffset);
  3247. }
  3248. static inline
  3249. void DAC960_LA_DisableInterrupts(void __iomem *ControllerBaseAddress)
  3250. {
  3251. DAC960_LA_InterruptMaskRegister_T InterruptMaskRegister;
  3252. InterruptMaskRegister.All = 0xFF;
  3253. InterruptMaskRegister.Bits.DisableInterrupts = true;
  3254. writeb(InterruptMaskRegister.All,
  3255. ControllerBaseAddress + DAC960_LA_InterruptMaskRegisterOffset);
  3256. }
  3257. static inline
  3258. bool DAC960_LA_InterruptsEnabledP(void __iomem *ControllerBaseAddress)
  3259. {
  3260. DAC960_LA_InterruptMaskRegister_T InterruptMaskRegister;
  3261. InterruptMaskRegister.All =
  3262. readb(ControllerBaseAddress + DAC960_LA_InterruptMaskRegisterOffset);
  3263. return !InterruptMaskRegister.Bits.DisableInterrupts;
  3264. }
  3265. static inline
  3266. void DAC960_LA_WriteCommandMailbox(DAC960_V1_CommandMailbox_T
  3267. *MemoryCommandMailbox,
  3268. DAC960_V1_CommandMailbox_T
  3269. *CommandMailbox)
  3270. {
  3271. MemoryCommandMailbox->Words[1] = CommandMailbox->Words[1];
  3272. MemoryCommandMailbox->Words[2] = CommandMailbox->Words[2];
  3273. MemoryCommandMailbox->Words[3] = CommandMailbox->Words[3];
  3274. wmb();
  3275. MemoryCommandMailbox->Words[0] = CommandMailbox->Words[0];
  3276. mb();
  3277. }
  3278. static inline
  3279. void DAC960_LA_WriteHardwareMailbox(void __iomem *ControllerBaseAddress,
  3280. DAC960_V1_CommandMailbox_T *CommandMailbox)
  3281. {
  3282. writel(CommandMailbox->Words[0],
  3283. ControllerBaseAddress + DAC960_LA_CommandOpcodeRegisterOffset);
  3284. writel(CommandMailbox->Words[1],
  3285. ControllerBaseAddress + DAC960_LA_MailboxRegister4Offset);
  3286. writel(CommandMailbox->Words[2],
  3287. ControllerBaseAddress + DAC960_LA_MailboxRegister8Offset);
  3288. writeb(CommandMailbox->Bytes[12],
  3289. ControllerBaseAddress + DAC960_LA_MailboxRegister12Offset);
  3290. }
  3291. static inline DAC960_V1_CommandIdentifier_T
  3292. DAC960_LA_ReadStatusCommandIdentifier(void __iomem *ControllerBaseAddress)
  3293. {
  3294. return readb(ControllerBaseAddress
  3295. + DAC960_LA_StatusCommandIdentifierRegOffset);
  3296. }
  3297. static inline DAC960_V1_CommandStatus_T
  3298. DAC960_LA_ReadStatusRegister(void __iomem *ControllerBaseAddress)
  3299. {
  3300. return readw(ControllerBaseAddress + DAC960_LA_StatusRegisterOffset);
  3301. }
  3302. static inline bool
  3303. DAC960_LA_ReadErrorStatus(void __iomem *ControllerBaseAddress,
  3304. unsigned char *ErrorStatus,
  3305. unsigned char *Parameter0,
  3306. unsigned char *Parameter1)
  3307. {
  3308. DAC960_LA_ErrorStatusRegister_T ErrorStatusRegister;
  3309. ErrorStatusRegister.All =
  3310. readb(ControllerBaseAddress + DAC960_LA_ErrorStatusRegisterOffset);
  3311. if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false;
  3312. ErrorStatusRegister.Bits.ErrorStatusPending = false;
  3313. *ErrorStatus = ErrorStatusRegister.All;
  3314. *Parameter0 =
  3315. readb(ControllerBaseAddress + DAC960_LA_CommandOpcodeRegisterOffset);
  3316. *Parameter1 =
  3317. readb(ControllerBaseAddress + DAC960_LA_CommandIdentifierRegisterOffset);
  3318. writeb(0xFF, ControllerBaseAddress + DAC960_LA_ErrorStatusRegisterOffset);
  3319. return true;
  3320. }
  3321. /*
  3322. Define the DAC960 PG Series Controller Interface Register Offsets.
  3323. */
  3324. #define DAC960_PG_RegisterWindowSize 0x2000
  3325. typedef enum
  3326. {
  3327. DAC960_PG_InboundDoorBellRegisterOffset = 0x0020,
  3328. DAC960_PG_OutboundDoorBellRegisterOffset = 0x002C,
  3329. DAC960_PG_InterruptMaskRegisterOffset = 0x0034,
  3330. DAC960_PG_CommandOpcodeRegisterOffset = 0x1000,
  3331. DAC960_PG_CommandIdentifierRegisterOffset = 0x1001,
  3332. DAC960_PG_MailboxRegister2Offset = 0x1002,
  3333. DAC960_PG_MailboxRegister3Offset = 0x1003,
  3334. DAC960_PG_MailboxRegister4Offset = 0x1004,
  3335. DAC960_PG_MailboxRegister5Offset = 0x1005,
  3336. DAC960_PG_MailboxRegister6Offset = 0x1006,
  3337. DAC960_PG_MailboxRegister7Offset = 0x1007,
  3338. DAC960_PG_MailboxRegister8Offset = 0x1008,
  3339. DAC960_PG_MailboxRegister9Offset = 0x1009,
  3340. DAC960_PG_MailboxRegister10Offset = 0x100A,
  3341. DAC960_PG_MailboxRegister11Offset = 0x100B,
  3342. DAC960_PG_MailboxRegister12Offset = 0x100C,
  3343. DAC960_PG_StatusCommandIdentifierRegOffset = 0x1018,
  3344. DAC960_PG_StatusRegisterOffset = 0x101A,
  3345. DAC960_PG_ErrorStatusRegisterOffset = 0x103F
  3346. }
  3347. DAC960_PG_RegisterOffsets_T;
  3348. /*
  3349. Define the structure of the DAC960 PG Series Inbound Door Bell Register.
  3350. */
  3351. typedef union DAC960_PG_InboundDoorBellRegister
  3352. {
  3353. unsigned int All;
  3354. struct {
  3355. bool HardwareMailboxNewCommand:1; /* Bit 0 */
  3356. bool AcknowledgeHardwareMailboxStatus:1; /* Bit 1 */
  3357. bool GenerateInterrupt:1; /* Bit 2 */
  3358. bool ControllerReset:1; /* Bit 3 */
  3359. bool MemoryMailboxNewCommand:1; /* Bit 4 */
  3360. unsigned int :27; /* Bits 5-31 */
  3361. } Write;
  3362. struct {
  3363. bool HardwareMailboxFull:1; /* Bit 0 */
  3364. bool InitializationInProgress:1; /* Bit 1 */
  3365. unsigned int :30; /* Bits 2-31 */
  3366. } Read;
  3367. }
  3368. DAC960_PG_InboundDoorBellRegister_T;
  3369. /*
  3370. Define the structure of the DAC960 PG Series Outbound Door Bell Register.
  3371. */
  3372. typedef union DAC960_PG_OutboundDoorBellRegister
  3373. {
  3374. unsigned int All;
  3375. struct {
  3376. bool AcknowledgeHardwareMailboxInterrupt:1; /* Bit 0 */
  3377. bool AcknowledgeMemoryMailboxInterrupt:1; /* Bit 1 */
  3378. unsigned int :30; /* Bits 2-31 */
  3379. } Write;
  3380. struct {
  3381. bool HardwareMailboxStatusAvailable:1; /* Bit 0 */
  3382. bool MemoryMailboxStatusAvailable:1; /* Bit 1 */
  3383. unsigned int :30; /* Bits 2-31 */
  3384. } Read;
  3385. }
  3386. DAC960_PG_OutboundDoorBellRegister_T;
  3387. /*
  3388. Define the structure of the DAC960 PG Series Interrupt Mask Register.
  3389. */
  3390. typedef union DAC960_PG_InterruptMaskRegister
  3391. {
  3392. unsigned int All;
  3393. struct {
  3394. unsigned int MessageUnitInterruptMask1:2; /* Bits 0-1 */
  3395. bool DisableInterrupts:1; /* Bit 2 */
  3396. unsigned int MessageUnitInterruptMask2:5; /* Bits 3-7 */
  3397. unsigned int Reserved0:24; /* Bits 8-31 */
  3398. } Bits;
  3399. }
  3400. DAC960_PG_InterruptMaskRegister_T;
  3401. /*
  3402. Define the structure of the DAC960 PG Series Error Status Register.
  3403. */
  3404. typedef union DAC960_PG_ErrorStatusRegister
  3405. {
  3406. unsigned char All;
  3407. struct {
  3408. unsigned int :2; /* Bits 0-1 */
  3409. bool ErrorStatusPending:1; /* Bit 2 */
  3410. unsigned int :5; /* Bits 3-7 */
  3411. } Bits;
  3412. }
  3413. DAC960_PG_ErrorStatusRegister_T;
  3414. /*
  3415. Define inline functions to provide an abstraction for reading and writing the
  3416. DAC960 PG Series Controller Interface Registers.
  3417. */
  3418. static inline
  3419. void DAC960_PG_HardwareMailboxNewCommand(void __iomem *ControllerBaseAddress)
  3420. {
  3421. DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
  3422. InboundDoorBellRegister.All = 0;
  3423. InboundDoorBellRegister.Write.HardwareMailboxNewCommand = true;
  3424. writel(InboundDoorBellRegister.All,
  3425. ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
  3426. }
  3427. static inline
  3428. void DAC960_PG_AcknowledgeHardwareMailboxStatus(void __iomem *ControllerBaseAddress)
  3429. {
  3430. DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
  3431. InboundDoorBellRegister.All = 0;
  3432. InboundDoorBellRegister.Write.AcknowledgeHardwareMailboxStatus = true;
  3433. writel(InboundDoorBellRegister.All,
  3434. ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
  3435. }
  3436. static inline
  3437. void DAC960_PG_GenerateInterrupt(void __iomem *ControllerBaseAddress)
  3438. {
  3439. DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
  3440. InboundDoorBellRegister.All = 0;
  3441. InboundDoorBellRegister.Write.GenerateInterrupt = true;
  3442. writel(InboundDoorBellRegister.All,
  3443. ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
  3444. }
  3445. static inline
  3446. void DAC960_PG_ControllerReset(void __iomem *ControllerBaseAddress)
  3447. {
  3448. DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
  3449. InboundDoorBellRegister.All = 0;
  3450. InboundDoorBellRegister.Write.ControllerReset = true;
  3451. writel(InboundDoorBellRegister.All,
  3452. ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
  3453. }
  3454. static inline
  3455. void DAC960_PG_MemoryMailboxNewCommand(void __iomem *ControllerBaseAddress)
  3456. {
  3457. DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
  3458. InboundDoorBellRegister.All = 0;
  3459. InboundDoorBellRegister.Write.MemoryMailboxNewCommand = true;
  3460. writel(InboundDoorBellRegister.All,
  3461. ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
  3462. }
  3463. static inline
  3464. bool DAC960_PG_HardwareMailboxFullP(void __iomem *ControllerBaseAddress)
  3465. {
  3466. DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
  3467. InboundDoorBellRegister.All =
  3468. readl(ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
  3469. return InboundDoorBellRegister.Read.HardwareMailboxFull;
  3470. }
  3471. static inline
  3472. bool DAC960_PG_InitializationInProgressP(void __iomem *ControllerBaseAddress)
  3473. {
  3474. DAC960_PG_InboundDoorBellRegister_T InboundDoorBellRegister;
  3475. InboundDoorBellRegister.All =
  3476. readl(ControllerBaseAddress + DAC960_PG_InboundDoorBellRegisterOffset);
  3477. return InboundDoorBellRegister.Read.InitializationInProgress;
  3478. }
  3479. static inline
  3480. void DAC960_PG_AcknowledgeHardwareMailboxInterrupt(void __iomem *ControllerBaseAddress)
  3481. {
  3482. DAC960_PG_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3483. OutboundDoorBellRegister.All = 0;
  3484. OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
  3485. writel(OutboundDoorBellRegister.All,
  3486. ControllerBaseAddress + DAC960_PG_OutboundDoorBellRegisterOffset);
  3487. }
  3488. static inline
  3489. void DAC960_PG_AcknowledgeMemoryMailboxInterrupt(void __iomem *ControllerBaseAddress)
  3490. {
  3491. DAC960_PG_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3492. OutboundDoorBellRegister.All = 0;
  3493. OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
  3494. writel(OutboundDoorBellRegister.All,
  3495. ControllerBaseAddress + DAC960_PG_OutboundDoorBellRegisterOffset);
  3496. }
  3497. static inline
  3498. void DAC960_PG_AcknowledgeInterrupt(void __iomem *ControllerBaseAddress)
  3499. {
  3500. DAC960_PG_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3501. OutboundDoorBellRegister.All = 0;
  3502. OutboundDoorBellRegister.Write.AcknowledgeHardwareMailboxInterrupt = true;
  3503. OutboundDoorBellRegister.Write.AcknowledgeMemoryMailboxInterrupt = true;
  3504. writel(OutboundDoorBellRegister.All,
  3505. ControllerBaseAddress + DAC960_PG_OutboundDoorBellRegisterOffset);
  3506. }
  3507. static inline
  3508. bool DAC960_PG_HardwareMailboxStatusAvailableP(void __iomem *ControllerBaseAddress)
  3509. {
  3510. DAC960_PG_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3511. OutboundDoorBellRegister.All =
  3512. readl(ControllerBaseAddress + DAC960_PG_OutboundDoorBellRegisterOffset);
  3513. return OutboundDoorBellRegister.Read.HardwareMailboxStatusAvailable;
  3514. }
  3515. static inline
  3516. bool DAC960_PG_MemoryMailboxStatusAvailableP(void __iomem *ControllerBaseAddress)
  3517. {
  3518. DAC960_PG_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3519. OutboundDoorBellRegister.All =
  3520. readl(ControllerBaseAddress + DAC960_PG_OutboundDoorBellRegisterOffset);
  3521. return OutboundDoorBellRegister.Read.MemoryMailboxStatusAvailable;
  3522. }
  3523. static inline
  3524. void DAC960_PG_EnableInterrupts(void __iomem *ControllerBaseAddress)
  3525. {
  3526. DAC960_PG_InterruptMaskRegister_T InterruptMaskRegister;
  3527. InterruptMaskRegister.All = 0;
  3528. InterruptMaskRegister.Bits.MessageUnitInterruptMask1 = 0x3;
  3529. InterruptMaskRegister.Bits.DisableInterrupts = false;
  3530. InterruptMaskRegister.Bits.MessageUnitInterruptMask2 = 0x1F;
  3531. writel(InterruptMaskRegister.All,
  3532. ControllerBaseAddress + DAC960_PG_InterruptMaskRegisterOffset);
  3533. }
  3534. static inline
  3535. void DAC960_PG_DisableInterrupts(void __iomem *ControllerBaseAddress)
  3536. {
  3537. DAC960_PG_InterruptMaskRegister_T InterruptMaskRegister;
  3538. InterruptMaskRegister.All = 0;
  3539. InterruptMaskRegister.Bits.MessageUnitInterruptMask1 = 0x3;
  3540. InterruptMaskRegister.Bits.DisableInterrupts = true;
  3541. InterruptMaskRegister.Bits.MessageUnitInterruptMask2 = 0x1F;
  3542. writel(InterruptMaskRegister.All,
  3543. ControllerBaseAddress + DAC960_PG_InterruptMaskRegisterOffset);
  3544. }
  3545. static inline
  3546. bool DAC960_PG_InterruptsEnabledP(void __iomem *ControllerBaseAddress)
  3547. {
  3548. DAC960_PG_InterruptMaskRegister_T InterruptMaskRegister;
  3549. InterruptMaskRegister.All =
  3550. readl(ControllerBaseAddress + DAC960_PG_InterruptMaskRegisterOffset);
  3551. return !InterruptMaskRegister.Bits.DisableInterrupts;
  3552. }
  3553. static inline
  3554. void DAC960_PG_WriteCommandMailbox(DAC960_V1_CommandMailbox_T
  3555. *MemoryCommandMailbox,
  3556. DAC960_V1_CommandMailbox_T
  3557. *CommandMailbox)
  3558. {
  3559. MemoryCommandMailbox->Words[1] = CommandMailbox->Words[1];
  3560. MemoryCommandMailbox->Words[2] = CommandMailbox->Words[2];
  3561. MemoryCommandMailbox->Words[3] = CommandMailbox->Words[3];
  3562. wmb();
  3563. MemoryCommandMailbox->Words[0] = CommandMailbox->Words[0];
  3564. mb();
  3565. }
  3566. static inline
  3567. void DAC960_PG_WriteHardwareMailbox(void __iomem *ControllerBaseAddress,
  3568. DAC960_V1_CommandMailbox_T *CommandMailbox)
  3569. {
  3570. writel(CommandMailbox->Words[0],
  3571. ControllerBaseAddress + DAC960_PG_CommandOpcodeRegisterOffset);
  3572. writel(CommandMailbox->Words[1],
  3573. ControllerBaseAddress + DAC960_PG_MailboxRegister4Offset);
  3574. writel(CommandMailbox->Words[2],
  3575. ControllerBaseAddress + DAC960_PG_MailboxRegister8Offset);
  3576. writeb(CommandMailbox->Bytes[12],
  3577. ControllerBaseAddress + DAC960_PG_MailboxRegister12Offset);
  3578. }
  3579. static inline DAC960_V1_CommandIdentifier_T
  3580. DAC960_PG_ReadStatusCommandIdentifier(void __iomem *ControllerBaseAddress)
  3581. {
  3582. return readb(ControllerBaseAddress
  3583. + DAC960_PG_StatusCommandIdentifierRegOffset);
  3584. }
  3585. static inline DAC960_V1_CommandStatus_T
  3586. DAC960_PG_ReadStatusRegister(void __iomem *ControllerBaseAddress)
  3587. {
  3588. return readw(ControllerBaseAddress + DAC960_PG_StatusRegisterOffset);
  3589. }
  3590. static inline bool
  3591. DAC960_PG_ReadErrorStatus(void __iomem *ControllerBaseAddress,
  3592. unsigned char *ErrorStatus,
  3593. unsigned char *Parameter0,
  3594. unsigned char *Parameter1)
  3595. {
  3596. DAC960_PG_ErrorStatusRegister_T ErrorStatusRegister;
  3597. ErrorStatusRegister.All =
  3598. readb(ControllerBaseAddress + DAC960_PG_ErrorStatusRegisterOffset);
  3599. if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false;
  3600. ErrorStatusRegister.Bits.ErrorStatusPending = false;
  3601. *ErrorStatus = ErrorStatusRegister.All;
  3602. *Parameter0 =
  3603. readb(ControllerBaseAddress + DAC960_PG_CommandOpcodeRegisterOffset);
  3604. *Parameter1 =
  3605. readb(ControllerBaseAddress + DAC960_PG_CommandIdentifierRegisterOffset);
  3606. writeb(0, ControllerBaseAddress + DAC960_PG_ErrorStatusRegisterOffset);
  3607. return true;
  3608. }
  3609. /*
  3610. Define the DAC960 PD Series Controller Interface Register Offsets.
  3611. */
  3612. #define DAC960_PD_RegisterWindowSize 0x80
  3613. typedef enum
  3614. {
  3615. DAC960_PD_CommandOpcodeRegisterOffset = 0x00,
  3616. DAC960_PD_CommandIdentifierRegisterOffset = 0x01,
  3617. DAC960_PD_MailboxRegister2Offset = 0x02,
  3618. DAC960_PD_MailboxRegister3Offset = 0x03,
  3619. DAC960_PD_MailboxRegister4Offset = 0x04,
  3620. DAC960_PD_MailboxRegister5Offset = 0x05,
  3621. DAC960_PD_MailboxRegister6Offset = 0x06,
  3622. DAC960_PD_MailboxRegister7Offset = 0x07,
  3623. DAC960_PD_MailboxRegister8Offset = 0x08,
  3624. DAC960_PD_MailboxRegister9Offset = 0x09,
  3625. DAC960_PD_MailboxRegister10Offset = 0x0A,
  3626. DAC960_PD_MailboxRegister11Offset = 0x0B,
  3627. DAC960_PD_MailboxRegister12Offset = 0x0C,
  3628. DAC960_PD_StatusCommandIdentifierRegOffset = 0x0D,
  3629. DAC960_PD_StatusRegisterOffset = 0x0E,
  3630. DAC960_PD_ErrorStatusRegisterOffset = 0x3F,
  3631. DAC960_PD_InboundDoorBellRegisterOffset = 0x40,
  3632. DAC960_PD_OutboundDoorBellRegisterOffset = 0x41,
  3633. DAC960_PD_InterruptEnableRegisterOffset = 0x43
  3634. }
  3635. DAC960_PD_RegisterOffsets_T;
  3636. /*
  3637. Define the structure of the DAC960 PD Series Inbound Door Bell Register.
  3638. */
  3639. typedef union DAC960_PD_InboundDoorBellRegister
  3640. {
  3641. unsigned char All;
  3642. struct {
  3643. bool NewCommand:1; /* Bit 0 */
  3644. bool AcknowledgeStatus:1; /* Bit 1 */
  3645. bool GenerateInterrupt:1; /* Bit 2 */
  3646. bool ControllerReset:1; /* Bit 3 */
  3647. unsigned char :4; /* Bits 4-7 */
  3648. } Write;
  3649. struct {
  3650. bool MailboxFull:1; /* Bit 0 */
  3651. bool InitializationInProgress:1; /* Bit 1 */
  3652. unsigned char :6; /* Bits 2-7 */
  3653. } Read;
  3654. }
  3655. DAC960_PD_InboundDoorBellRegister_T;
  3656. /*
  3657. Define the structure of the DAC960 PD Series Outbound Door Bell Register.
  3658. */
  3659. typedef union DAC960_PD_OutboundDoorBellRegister
  3660. {
  3661. unsigned char All;
  3662. struct {
  3663. bool AcknowledgeInterrupt:1; /* Bit 0 */
  3664. unsigned char :7; /* Bits 1-7 */
  3665. } Write;
  3666. struct {
  3667. bool StatusAvailable:1; /* Bit 0 */
  3668. unsigned char :7; /* Bits 1-7 */
  3669. } Read;
  3670. }
  3671. DAC960_PD_OutboundDoorBellRegister_T;
  3672. /*
  3673. Define the structure of the DAC960 PD Series Interrupt Enable Register.
  3674. */
  3675. typedef union DAC960_PD_InterruptEnableRegister
  3676. {
  3677. unsigned char All;
  3678. struct {
  3679. bool EnableInterrupts:1; /* Bit 0 */
  3680. unsigned char :7; /* Bits 1-7 */
  3681. } Bits;
  3682. }
  3683. DAC960_PD_InterruptEnableRegister_T;
  3684. /*
  3685. Define the structure of the DAC960 PD Series Error Status Register.
  3686. */
  3687. typedef union DAC960_PD_ErrorStatusRegister
  3688. {
  3689. unsigned char All;
  3690. struct {
  3691. unsigned int :2; /* Bits 0-1 */
  3692. bool ErrorStatusPending:1; /* Bit 2 */
  3693. unsigned int :5; /* Bits 3-7 */
  3694. } Bits;
  3695. }
  3696. DAC960_PD_ErrorStatusRegister_T;
  3697. /*
  3698. Define inline functions to provide an abstraction for reading and writing the
  3699. DAC960 PD Series Controller Interface Registers.
  3700. */
  3701. static inline
  3702. void DAC960_PD_NewCommand(void __iomem *ControllerBaseAddress)
  3703. {
  3704. DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
  3705. InboundDoorBellRegister.All = 0;
  3706. InboundDoorBellRegister.Write.NewCommand = true;
  3707. writeb(InboundDoorBellRegister.All,
  3708. ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
  3709. }
  3710. static inline
  3711. void DAC960_PD_AcknowledgeStatus(void __iomem *ControllerBaseAddress)
  3712. {
  3713. DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
  3714. InboundDoorBellRegister.All = 0;
  3715. InboundDoorBellRegister.Write.AcknowledgeStatus = true;
  3716. writeb(InboundDoorBellRegister.All,
  3717. ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
  3718. }
  3719. static inline
  3720. void DAC960_PD_GenerateInterrupt(void __iomem *ControllerBaseAddress)
  3721. {
  3722. DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
  3723. InboundDoorBellRegister.All = 0;
  3724. InboundDoorBellRegister.Write.GenerateInterrupt = true;
  3725. writeb(InboundDoorBellRegister.All,
  3726. ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
  3727. }
  3728. static inline
  3729. void DAC960_PD_ControllerReset(void __iomem *ControllerBaseAddress)
  3730. {
  3731. DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
  3732. InboundDoorBellRegister.All = 0;
  3733. InboundDoorBellRegister.Write.ControllerReset = true;
  3734. writeb(InboundDoorBellRegister.All,
  3735. ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
  3736. }
  3737. static inline
  3738. bool DAC960_PD_MailboxFullP(void __iomem *ControllerBaseAddress)
  3739. {
  3740. DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
  3741. InboundDoorBellRegister.All =
  3742. readb(ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
  3743. return InboundDoorBellRegister.Read.MailboxFull;
  3744. }
  3745. static inline
  3746. bool DAC960_PD_InitializationInProgressP(void __iomem *ControllerBaseAddress)
  3747. {
  3748. DAC960_PD_InboundDoorBellRegister_T InboundDoorBellRegister;
  3749. InboundDoorBellRegister.All =
  3750. readb(ControllerBaseAddress + DAC960_PD_InboundDoorBellRegisterOffset);
  3751. return InboundDoorBellRegister.Read.InitializationInProgress;
  3752. }
  3753. static inline
  3754. void DAC960_PD_AcknowledgeInterrupt(void __iomem *ControllerBaseAddress)
  3755. {
  3756. DAC960_PD_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3757. OutboundDoorBellRegister.All = 0;
  3758. OutboundDoorBellRegister.Write.AcknowledgeInterrupt = true;
  3759. writeb(OutboundDoorBellRegister.All,
  3760. ControllerBaseAddress + DAC960_PD_OutboundDoorBellRegisterOffset);
  3761. }
  3762. static inline
  3763. bool DAC960_PD_StatusAvailableP(void __iomem *ControllerBaseAddress)
  3764. {
  3765. DAC960_PD_OutboundDoorBellRegister_T OutboundDoorBellRegister;
  3766. OutboundDoorBellRegister.All =
  3767. readb(ControllerBaseAddress + DAC960_PD_OutboundDoorBellRegisterOffset);
  3768. return OutboundDoorBellRegister.Read.StatusAvailable;
  3769. }
  3770. static inline
  3771. void DAC960_PD_EnableInterrupts(void __iomem *ControllerBaseAddress)
  3772. {
  3773. DAC960_PD_InterruptEnableRegister_T InterruptEnableRegister;
  3774. InterruptEnableRegister.All = 0;
  3775. InterruptEnableRegister.Bits.EnableInterrupts = true;
  3776. writeb(InterruptEnableRegister.All,
  3777. ControllerBaseAddress + DAC960_PD_InterruptEnableRegisterOffset);
  3778. }
  3779. static inline
  3780. void DAC960_PD_DisableInterrupts(void __iomem *ControllerBaseAddress)
  3781. {
  3782. DAC960_PD_InterruptEnableRegister_T InterruptEnableRegister;
  3783. InterruptEnableRegister.All = 0;
  3784. InterruptEnableRegister.Bits.EnableInterrupts = false;
  3785. writeb(InterruptEnableRegister.All,
  3786. ControllerBaseAddress + DAC960_PD_InterruptEnableRegisterOffset);
  3787. }
  3788. static inline
  3789. bool DAC960_PD_InterruptsEnabledP(void __iomem *ControllerBaseAddress)
  3790. {
  3791. DAC960_PD_InterruptEnableRegister_T InterruptEnableRegister;
  3792. InterruptEnableRegister.All =
  3793. readb(ControllerBaseAddress + DAC960_PD_InterruptEnableRegisterOffset);
  3794. return InterruptEnableRegister.Bits.EnableInterrupts;
  3795. }
  3796. static inline
  3797. void DAC960_PD_WriteCommandMailbox(void __iomem *ControllerBaseAddress,
  3798. DAC960_V1_CommandMailbox_T *CommandMailbox)
  3799. {
  3800. writel(CommandMailbox->Words[0],
  3801. ControllerBaseAddress + DAC960_PD_CommandOpcodeRegisterOffset);
  3802. writel(CommandMailbox->Words[1],
  3803. ControllerBaseAddress + DAC960_PD_MailboxRegister4Offset);
  3804. writel(CommandMailbox->Words[2],
  3805. ControllerBaseAddress + DAC960_PD_MailboxRegister8Offset);
  3806. writeb(CommandMailbox->Bytes[12],
  3807. ControllerBaseAddress + DAC960_PD_MailboxRegister12Offset);
  3808. }
  3809. static inline DAC960_V1_CommandIdentifier_T
  3810. DAC960_PD_ReadStatusCommandIdentifier(void __iomem *ControllerBaseAddress)
  3811. {
  3812. return readb(ControllerBaseAddress
  3813. + DAC960_PD_StatusCommandIdentifierRegOffset);
  3814. }
  3815. static inline DAC960_V1_CommandStatus_T
  3816. DAC960_PD_ReadStatusRegister(void __iomem *ControllerBaseAddress)
  3817. {
  3818. return readw(ControllerBaseAddress + DAC960_PD_StatusRegisterOffset);
  3819. }
  3820. static inline bool
  3821. DAC960_PD_ReadErrorStatus(void __iomem *ControllerBaseAddress,
  3822. unsigned char *ErrorStatus,
  3823. unsigned char *Parameter0,
  3824. unsigned char *Parameter1)
  3825. {
  3826. DAC960_PD_ErrorStatusRegister_T ErrorStatusRegister;
  3827. ErrorStatusRegister.All =
  3828. readb(ControllerBaseAddress + DAC960_PD_ErrorStatusRegisterOffset);
  3829. if (!ErrorStatusRegister.Bits.ErrorStatusPending) return false;
  3830. ErrorStatusRegister.Bits.ErrorStatusPending = false;
  3831. *ErrorStatus = ErrorStatusRegister.All;
  3832. *Parameter0 =
  3833. readb(ControllerBaseAddress + DAC960_PD_CommandOpcodeRegisterOffset);
  3834. *Parameter1 =
  3835. readb(ControllerBaseAddress + DAC960_PD_CommandIdentifierRegisterOffset);
  3836. writeb(0, ControllerBaseAddress + DAC960_PD_ErrorStatusRegisterOffset);
  3837. return true;
  3838. }
  3839. static inline void DAC960_P_To_PD_TranslateEnquiry(void *Enquiry)
  3840. {
  3841. memcpy(Enquiry + 132, Enquiry + 36, 64);
  3842. memset(Enquiry + 36, 0, 96);
  3843. }
  3844. static inline void DAC960_P_To_PD_TranslateDeviceState(void *DeviceState)
  3845. {
  3846. memcpy(DeviceState + 2, DeviceState + 3, 1);
  3847. memmove(DeviceState + 4, DeviceState + 5, 2);
  3848. memmove(DeviceState + 6, DeviceState + 8, 4);
  3849. }
  3850. static inline
  3851. void DAC960_PD_To_P_TranslateReadWriteCommand(DAC960_V1_CommandMailbox_T
  3852. *CommandMailbox)
  3853. {
  3854. int LogicalDriveNumber = CommandMailbox->Type5.LD.LogicalDriveNumber;
  3855. CommandMailbox->Bytes[3] &= 0x7;
  3856. CommandMailbox->Bytes[3] |= CommandMailbox->Bytes[7] << 6;
  3857. CommandMailbox->Bytes[7] = LogicalDriveNumber;
  3858. }
  3859. static inline
  3860. void DAC960_P_To_PD_TranslateReadWriteCommand(DAC960_V1_CommandMailbox_T
  3861. *CommandMailbox)
  3862. {
  3863. int LogicalDriveNumber = CommandMailbox->Bytes[7];
  3864. CommandMailbox->Bytes[7] = CommandMailbox->Bytes[3] >> 6;
  3865. CommandMailbox->Bytes[3] &= 0x7;
  3866. CommandMailbox->Bytes[3] |= LogicalDriveNumber << 3;
  3867. }
  3868. /*
  3869. Define prototypes for the forward referenced DAC960 Driver Internal Functions.
  3870. */
  3871. static void DAC960_FinalizeController(DAC960_Controller_T *);
  3872. static void DAC960_V1_QueueReadWriteCommand(DAC960_Command_T *);
  3873. static void DAC960_V2_QueueReadWriteCommand(DAC960_Command_T *);
  3874. static void DAC960_RequestFunction(struct request_queue *);
  3875. static irqreturn_t DAC960_BA_InterruptHandler(int, void *);
  3876. static irqreturn_t DAC960_LP_InterruptHandler(int, void *);
  3877. static irqreturn_t DAC960_LA_InterruptHandler(int, void *);
  3878. static irqreturn_t DAC960_PG_InterruptHandler(int, void *);
  3879. static irqreturn_t DAC960_PD_InterruptHandler(int, void *);
  3880. static irqreturn_t DAC960_P_InterruptHandler(int, void *);
  3881. static void DAC960_V1_QueueMonitoringCommand(DAC960_Command_T *);
  3882. static void DAC960_V2_QueueMonitoringCommand(DAC960_Command_T *);
  3883. static void DAC960_MonitoringTimerFunction(unsigned long);
  3884. static void DAC960_Message(DAC960_MessageLevel_T, unsigned char *,
  3885. DAC960_Controller_T *, ...);
  3886. static void DAC960_CreateProcEntries(DAC960_Controller_T *);
  3887. static void DAC960_DestroyProcEntries(DAC960_Controller_T *);
  3888. #endif /* DAC960_DriverVersion */