12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480 |
- Submitted By: Jim Gifford (patches at jg555 dot com)
- Date: 2005-08-31
- Initial Package Version: 0.97
- Origin: OpenSolaris, Joe Ciccone, Jim Gifford
- Upstream Status: N/A
- Description: Adds support for Forcedeth and other NIC's
- Fixes for GCC 4.x
- Removal of bad network drivers
-
- diff -Naur grub-0.97.orig/configure grub-0.97/configure
- --- grub-0.97.orig/configure 2005-05-08 02:48:12.000000000 +0000
- +++ grub-0.97/configure 2005-09-01 00:15:48.000000000 +0000
- @@ -872,47 +872,32 @@
- --disable-packet-retransmission
- turn off packet retransmission
- --enable-pci-direct access PCI directly instead of using BIOS
- - --enable-3c509 enable 3Com509 driver
- - --enable-3c529 enable 3Com529 driver
- --enable-3c595 enable 3Com595 driver
- --enable-3c90x enable 3Com90x driver
- - --enable-cs89x0 enable CS89x0 driver
- --enable-davicom enable Davicom driver
- - --enable-depca enable DEPCA and EtherWORKS driver
- - --enable-eepro enable Etherexpress Pro/10 driver
- + --enable-e1000 enable Etherexpress Pro/1000 driver
- --enable-eepro100 enable Etherexpress Pro/100 driver
- --enable-epic100 enable SMC 83c170 EPIC/100 driver
- - --enable-3c507 enable 3Com507 driver
- - --enable-exos205 enable EXOS205 driver
- - --enable-ni5210 enable Racal-Interlan NI5210 driver
- - --enable-lance enable Lance PCI PCNet/32 driver
- - --enable-ne2100 enable Novell NE2100 driver
- - --enable-ni6510 enable Racal-Interlan NI6510 driver
- + --enable-forcedeth enable Nvidia Geforce driver
- --enable-natsemi enable NatSemi DP8381x driver
- - --enable-ni5010 enable Racal-Interlan NI5010 driver
- - --enable-3c503 enable 3Com503 driver
- - --enable-ne enable NE1000/2000 ISA driver
- + --enable-ns83820 enable NS83820 driver
- --enable-ns8390 enable NE2000 PCI driver
- - --enable-wd enable WD8003/8013, SMC8216/8416 driver
- - --enable-otulip enable old Tulip driver
- + --enable-pcnet32 enable AMD Lance/PCI PCNet/32 driver
- + --enable-pnic enable Bochs Pseudo Nic driver
- --enable-rtl8139 enable Realtek 8139 driver
- + --enable-r8169 enable Realtek 8169 driver
- --enable-sis900 enable SIS 900 and SIS 7016 driver
- - --enable-sk-g16 enable Schneider and Koch G16 driver
- - --enable-smc9000 enable SMC9000 driver
- - --enable-tiara enable Tiara driver
- + --enable-tg3 enable Broadcom Tigon3 driver
- --enable-tulip enable Tulip driver
- + --enable-tlan enable TI ThunderLAN driver
- + --enable-undi enable PXE UNDI driver
- --enable-via-rhine enable Rhine-I/II driver
- - --enable-w89c840 enable Winbond W89c840, Compex RL100-ATX driver
- - --enable-3c503-shmem use 3c503 shared memory mode
- - --enable-3c503-aui use AUI by default on 3c503 cards
- + --enable-w89c840 enable Winbond W89c840 driver
- --enable-compex-rl2000-fix
- specify this if you have a Compex RL2000 PCI
- - --enable-smc9000-scan=LIST
- - probe for SMC9000 I/O addresses using LIST
- --enable-ne-scan=LIST probe for NE base address using LIST
- --enable-wd-default-mem=MEM
- set the default memory location for WD/SMC
- - --enable-cs-scan=LIST probe for CS89x0 base address using LIST
- --enable-diskless enable diskless support
- --disable-hercules disable hercules terminal support
- --disable-serial disable serial terminal support
- @@ -5559,7 +5544,7 @@
-
- fi;
- if test "x$enable_packet_retransmission" != xno; then
- - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONGESTED=1"
- + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONGESTED=1 -DCONFIG_PCI"
- fi
-
- # Check whether --enable-pci-direct or --disable-pci-direct was given.
- @@ -5571,26 +5556,6 @@
- NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONFIG_PCI_DIRECT=1"
- fi
-
- -# Check whether --enable-3c509 or --disable-3c509 was given.
- -if test "${enable_3c509+set}" = set; then
- - enableval="$enable_3c509"
- -
- -fi;
- -if test "x$enable_3c509" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C509"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c509.o"
- -fi
- -
- -# Check whether --enable-3c529 or --disable-3c529 was given.
- -if test "${enable_3c529+set}" = set; then
- - enableval="$enable_3c529"
- -
- -fi;
- -if test "x$enable_3c529" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C529=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c529.o"
- -fi
- -
- # Check whether --enable-3c595 or --disable-3c595 was given.
- if test "${enable_3c595+set}" = set; then
- enableval="$enable_3c595"
- @@ -5611,16 +5576,6 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c90x.o"
- fi
-
- -# Check whether --enable-cs89x0 or --disable-cs89x0 was given.
- -if test "${enable_cs89x0+set}" = set; then
- - enableval="$enable_cs89x0"
- -
- -fi;
- -if test "x$enable_cs89x0" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_CS89X0=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS cs89x0.o"
- -fi
- -
- # Check whether --enable-davicom or --disable-davicom was given.
- if test "${enable_davicom+set}" = set; then
- enableval="$enable_davicom"
- @@ -5631,24 +5586,14 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS davicom.o"
- fi
-
- -# Check whether --enable-depca or --disable-depca was given.
- -if test "${enable_depca+set}" = set; then
- - enableval="$enable_depca"
- +# Check whether --enable-e1000 or --disable-e1000 was given.
- +if test "${enable_e1000+set}" = set; then
- + enableval="$enable_e1000"
-
- fi;
- -if test "x$enable_depca" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_DEPCA=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS depca.o"
- -fi
- -
- -# Check whether --enable-eepro or --disable-eepro was given.
- -if test "${enable_eepro+set}" = set; then
- - enableval="$enable_eepro"
- -
- -fi;
- -if test "x$enable_eepro" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EEPRO=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS eepro.o"
- +if test "x$enable_e1000" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_E1000=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS e1000.o"
- fi
-
- # Check whether --enable-eepro100 or --disable-eepro100 was given.
- @@ -5671,64 +5616,14 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS epic100.o"
- fi
-
- -# Check whether --enable-3c507 or --disable-3c507 was given.
- -if test "${enable_3c507+set}" = set; then
- - enableval="$enable_3c507"
- -
- -fi;
- -if test "x$enable_3c507" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C507=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c507.o"
- -fi
- -
- -# Check whether --enable-exos205 or --disable-exos205 was given.
- -if test "${enable_exos205+set}" = set; then
- - enableval="$enable_exos205"
- -
- -fi;
- -if test "x$enable_exos205" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EXOS205=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS exos205.o"
- -fi
- -
- -# Check whether --enable-ni5210 or --disable-ni5210 was given.
- -if test "${enable_ni5210+set}" = set; then
- - enableval="$enable_ni5210"
- -
- -fi;
- -if test "x$enable_ni5210" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NI5210=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ni5210.o"
- -fi
- -
- -# Check whether --enable-lance or --disable-lance was given.
- -if test "${enable_lance+set}" = set; then
- - enableval="$enable_lance"
- -
- -fi;
- -if test "x$enable_lance" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_LANCE=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS lance.o"
- -fi
- -
- -# Check whether --enable-ne2100 or --disable-ne2100 was given.
- -if test "${enable_ne2100+set}" = set; then
- - enableval="$enable_ne2100"
- -
- -fi;
- -if test "x$enable_ne2100" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NE2100=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ne2100.o"
- -fi
- -
- -# Check whether --enable-ni6510 or --disable-ni6510 was given.
- -if test "${enable_ni6510+set}" = set; then
- - enableval="$enable_ni6510"
- +# Check whether --enable-forcedeth or --disable-forcedeth was given.
- +if test "${enable_forcedeth+set}" = set; then
- + enableval="$enable_forcedeth"
-
- fi;
- -if test "x$enable_ni6510" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NI6510=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ni6510.o"
- +if test "x$enable_forcedeth" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_FORCEDETH=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS forcedeth.o"
- fi
-
- # Check whether --enable-natsemi or --disable-natsemi was given.
- @@ -5741,34 +5636,14 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS natsemi.o"
- fi
-
- -# Check whether --enable-ni5010 or --disable-ni5010 was given.
- -if test "${enable_ni5010+set}" = set; then
- - enableval="$enable_ni5010"
- +# Check whether --enable-ns83820 or --disable-ns83820 was given.
- +if test "${enable_ns83820+set}" = set; then
- + enableval="$enable_ns83820"
-
- fi;
- -if test "x$enable_ni5010" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NI5010=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ni5010.o"
- -fi
- -
- -# Check whether --enable-3c503 or --disable-3c503 was given.
- -if test "${enable_3c503+set}" = set; then
- - enableval="$enable_3c503"
- -
- -fi;
- -if test "x$enable_3c503" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C503=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c503.o"
- -fi
- -
- -# Check whether --enable-ne or --disable-ne was given.
- -if test "${enable_ne+set}" = set; then
- - enableval="$enable_ne"
- -
- -fi;
- -if test "x$enable_ne" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NE=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ne.o"
- +if test "x$enable_ns83820" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS83820=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns83820.o"
- fi
-
- # Check whether --enable-ns8390 or --disable-ns8390 was given.
- @@ -5781,24 +5656,24 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns8390.o"
- fi
-
- -# Check whether --enable-wd or --disable-wd was given.
- -if test "${enable_wd+set}" = set; then
- - enableval="$enable_wd"
- +# Check whether --enable-pcnet32 or --disable-pcnet32 was given.
- +if test "${enable_pcnet32+set}" = set; then
- + enableval="$enable_pcnet32"
-
- fi;
- -if test "x$enable_wd" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_WD=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS wd.o"
- +if test "x$enable_pcnet32" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PCNET32=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS pcnet32.o"
- fi
-
- -# Check whether --enable-otulip or --disable-otulip was given.
- -if test "${enable_otulip+set}" = set; then
- - enableval="$enable_otulip"
- +# Check whether --enable-pnic or --disable-pnic was given.
- +if test "${enable_pnic+set}" = set; then
- + enableval="$enable_pnic"
-
- fi;
- -if test "x$enable_otulip" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_OTULIP=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS otulip.o"
- +if test "x$enable_pnic" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PNIC=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS pnic.o"
- fi
-
- # Check whether --enable-rtl8139 or --disable-rtl8139 was given.
- @@ -5811,6 +5686,16 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS rtl8139.o"
- fi
-
- +# Check whether --enable-r8169 or --disable-r8169 was given.
- +if test "${enable_r8169+set}" = set; then
- + enableval="$enable_r8169"
- +
- +fi;
- +if test "x$enable_r8169" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_R8169=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS r8169.o"
- +fi
- +
- # Check whether --enable-sis900 or --disable-sis900 was given.
- if test "${enable_sis900+set}" = set; then
- enableval="$enable_sis900"
- @@ -5821,34 +5706,14 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS sis900.o"
- fi
-
- -# Check whether --enable-sk-g16 or --disable-sk-g16 was given.
- -if test "${enable_sk_g16+set}" = set; then
- - enableval="$enable_sk_g16"
- -
- -fi;
- -if test "x$enable_sk_g16" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SK_G16=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS sk_g16.o"
- -fi
- -
- -# Check whether --enable-smc9000 or --disable-smc9000 was given.
- -if test "${enable_smc9000+set}" = set; then
- - enableval="$enable_smc9000"
- -
- -fi;
- -if test "x$enable_smc9000" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SMC9000=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS smc9000.o"
- -fi
- -
- -# Check whether --enable-tiara or --disable-tiara was given.
- -if test "${enable_tiara+set}" = set; then
- - enableval="$enable_tiara"
- +# Check whether --enable-tg3 or --disable-tg3 was given.
- +if test "${enable_tg3+set}" = set; then
- + enableval="$enable_tg3"
-
- fi;
- -if test "x$enable_tiara" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TIARA=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS tiara.o"
- +if test "x$enable_tg3" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TG3=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS tg3.o"
- fi
-
- # Check whether --enable-tulip or --disable-tulip was given.
- @@ -5861,6 +5726,16 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS tulip.o"
- fi
-
- +# Check whether --enable-tlan or --disable-tlan was given.
- +if test "${enable_tlan+set}" = set; then
- + enableval="$enable_tlan"
- +
- +fi;
- +if test "x$enable_tlan" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TLAN=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS tlan.o"
- +fi
- +
- # Check whether --enable-via-rhine or --disable-via-rhine was given.
- if test "${enable_via_rhine+set}" = set; then
- enableval="$enable_via_rhine"
- @@ -5895,24 +5770,6 @@
- FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1"
- fi
-
- -# Check whether --enable-3c503-shmem or --disable-3c503-shmem was given.
- -if test "${enable_3c503_shmem+set}" = set; then
- - enableval="$enable_3c503_shmem"
- -
- -fi;
- -if test "x$enable_3c503_shmem" = xyes; then
- - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DT503_SHMEM=1"
- -fi
- -
- -# Check whether --enable-3c503-aui or --disable-3c503-aui was given.
- -if test "${enable_3c503_aui+set}" = set; then
- - enableval="$enable_3c503_aui"
- -
- -fi;
- -if test "x$enable_3c503_aui" = xyes; then
- - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DT503_AUI=1"
- -fi
- -
- # Check whether --enable-compex-rl2000-fix or --disable-compex-rl2000-fix was given.
- if test "${enable_compex_rl2000_fix+set}" = set; then
- enableval="$enable_compex_rl2000_fix"
- @@ -5922,12 +5779,6 @@
- NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCOMPEX_RL2000_FIX=1"
- fi
-
- -# Check whether --enable-smc9000-scan or --disable-smc9000-scan was given.
- -if test "${enable_smc9000_scan+set}" = set; then
- - enableval="$enable_smc9000_scan"
- - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DSMC9000_SCAN=$enable_smc9000_scan"
- -fi;
- -
- # Check whether --enable-ne-scan or --disable-ne-scan was given.
- if test "${enable_ne_scan+set}" = set; then
- enableval="$enable_ne_scan"
- @@ -5944,12 +5795,6 @@
- NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=0xCC000"
- fi;
-
- -# Check whether --enable-cs-scan or --disable-cs-scan was given.
- -if test "${enable_cs_scan+set}" = set; then
- - enableval="$enable_cs_scan"
- - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCS_SCAN=$enable_cs_scan"
- -fi;
- -
- # Check whether --enable-diskless or --disable-diskless was given.
- if test "${enable_diskless+set}" = set; then
- enableval="$enable_diskless"
- diff -Naur grub-0.97.orig/configure.ac grub-0.97/configure.ac
- --- grub-0.97.orig/configure.ac 2005-05-08 02:36:03.000000000 +0000
- +++ grub-0.97/configure.ac 2005-09-01 00:16:05.000000000 +0000
- @@ -317,7 +317,7 @@
- [ --disable-packet-retransmission
- turn off packet retransmission])
- if test "x$enable_packet_retransmission" != xno; then
- - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONGESTED=1"
- + NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONGESTED=1 -DCONFIG_PCI"
- fi
-
- AC_ARG_ENABLE(pci-direct,
- @@ -327,20 +327,6 @@
- fi
-
- dnl Device drivers.
- -AC_ARG_ENABLE(3c509,
- - [ --enable-3c509 enable 3Com509 driver])
- -if test "x$enable_3c509" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C509"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c509.o"
- -fi
- -
- -AC_ARG_ENABLE(3c529,
- - [ --enable-3c529 enable 3Com529 driver])
- -if test "x$enable_3c529" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C529=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c529.o"
- -fi
- -
- AC_ARG_ENABLE(3c595,
- [ --enable-3c595 enable 3Com595 driver])
- if test "x$enable_3c595" = xyes; then
- @@ -355,13 +341,6 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c90x.o"
- fi
-
- -AC_ARG_ENABLE(cs89x0,
- - [ --enable-cs89x0 enable CS89x0 driver])
- -if test "x$enable_cs89x0" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_CS89X0=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS cs89x0.o"
- -fi
- -
- AC_ARG_ENABLE(davicom,
- [ --enable-davicom enable Davicom driver])
- if test "x$enable_davicom" = xyes; then
- @@ -369,18 +348,11 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS davicom.o"
- fi
-
- -AC_ARG_ENABLE(depca,
- - [ --enable-depca enable DEPCA and EtherWORKS driver])
- -if test "x$enable_depca" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_DEPCA=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS depca.o"
- -fi
- -
- -AC_ARG_ENABLE(eepro,
- - [ --enable-eepro enable Etherexpress Pro/10 driver])
- -if test "x$enable_eepro" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EEPRO=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS eepro.o"
- +AC_ARG_ENABLE(e1000,
- + [ --enable-e1000 enable Etherexpress Pro/1000 driver])
- +if test "x$enable_e1000" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_E1000=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS e1000.o"
- fi
-
- AC_ARG_ENABLE(eepro100,
- @@ -397,46 +369,11 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS epic100.o"
- fi
-
- -AC_ARG_ENABLE(3c507,
- - [ --enable-3c507 enable 3Com507 driver])
- -if test "x$enable_3c507" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C507=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c507.o"
- -fi
- -
- -AC_ARG_ENABLE(exos205,
- - [ --enable-exos205 enable EXOS205 driver])
- -if test "x$enable_exos205" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EXOS205=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS exos205.o"
- -fi
- -
- -AC_ARG_ENABLE(ni5210,
- - [ --enable-ni5210 enable Racal-Interlan NI5210 driver])
- -if test "x$enable_ni5210" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NI5210=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ni5210.o"
- -fi
- -
- -AC_ARG_ENABLE(lance,
- - [ --enable-lance enable Lance PCI PCNet/32 driver])
- -if test "x$enable_lance" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_LANCE=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS lance.o"
- -fi
- -
- -AC_ARG_ENABLE(ne2100,
- - [ --enable-ne2100 enable Novell NE2100 driver])
- -if test "x$enable_ne2100" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NE2100=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ne2100.o"
- -fi
- -
- -AC_ARG_ENABLE(ni6510,
- - [ --enable-ni6510 enable Racal-Interlan NI6510 driver])
- -if test "x$enable_ni6510" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NI6510=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ni6510.o"
- +AC_ARG_ENABLE(forcedeth,
- + [ --enable-forcedeth enable Nvidia Geforce driver])
- +if test "x$enable_forcedeth" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_FORCEDETH=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS forcedeth.o"
- fi
-
- AC_ARG_ENABLE(natsemi,
- @@ -446,25 +383,11 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS natsemi.o"
- fi
-
- -AC_ARG_ENABLE(ni5010,
- - [ --enable-ni5010 enable Racal-Interlan NI5010 driver])
- -if test "x$enable_ni5010" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NI5010=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ni5010.o"
- -fi
- -
- -AC_ARG_ENABLE(3c503,
- - [ --enable-3c503 enable 3Com503 driver])
- -if test "x$enable_3c503" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C503=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c503.o"
- -fi
- -
- -AC_ARG_ENABLE(ne,
- - [ --enable-ne enable NE1000/2000 ISA driver])
- -if test "x$enable_ne" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NE=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS ne.o"
- +AC_ARG_ENABLE(ns83820,
- + [ --enable-ns83820 enable NS83820 driver])
- +if test "x$enable_ns83820" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS83820=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns83820.o"
- fi
-
- AC_ARG_ENABLE(ns8390,
- @@ -474,18 +397,18 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns8390.o"
- fi
-
- -AC_ARG_ENABLE(wd,
- - [ --enable-wd enable WD8003/8013, SMC8216/8416 driver])
- -if test "x$enable_wd" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_WD=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS wd.o"
- +AC_ARG_ENABLE(pcnet32,
- + [ --enable-pcnet32 enable AMD Lance/PCI PCNet/32 driver])
- +if test "x$enable_pcnet32" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PCNET32=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS pcnet32.o"
- fi
-
- -AC_ARG_ENABLE(otulip,
- - [ --enable-otulip enable old Tulip driver])
- -if test "x$enable_otulip" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_OTULIP=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS otulip.o"
- +AC_ARG_ENABLE(pnic,
- + [ --enable-pnic enable Bochs Pseudo Nic driver])
- +if test "x$enable_pnic" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PNIC=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS pnic.o"
- fi
-
- AC_ARG_ENABLE(rtl8139,
- @@ -495,6 +418,13 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS rtl8139.o"
- fi
-
- +AC_ARG_ENABLE(r8169,
- + [ --enable-r8169 enable Realtek 8169 driver])
- +if test "x$enable_r8169" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_R8169=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS r8169.o"
- +fi
- +
- AC_ARG_ENABLE(sis900,
- [ --enable-sis900 enable SIS 900 and SIS 7016 driver])
- if test "x$enable_sis900" = xyes; then
- @@ -502,25 +432,11 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS sis900.o"
- fi
-
- -AC_ARG_ENABLE(sk-g16,
- - [ --enable-sk-g16 enable Schneider and Koch G16 driver])
- -if test "x$enable_sk_g16" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SK_G16=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS sk_g16.o"
- -fi
- -
- -AC_ARG_ENABLE(smc9000,
- - [ --enable-smc9000 enable SMC9000 driver])
- -if test "x$enable_smc9000" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SMC9000=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS smc9000.o"
- -fi
- -
- -AC_ARG_ENABLE(tiara,
- - [ --enable-tiara enable Tiara driver])
- -if test "x$enable_tiara" = xyes; then
- - NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TIARA=1"
- - NETBOOT_DRIVERS="$NETBOOT_DRIVERS tiara.o"
- +AC_ARG_ENABLE(tg3,
- + [ --enable-tg3 enable Broadcom Tigon3 driver])
- +if test "x$enable_tg3" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TG3=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS tg3.o"
- fi
-
- AC_ARG_ENABLE(tulip,
- @@ -530,6 +446,13 @@
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS tulip.o"
- fi
-
- +AC_ARG_ENABLE(tlan,
- + [ --enable-tlan enable TI ThunderLAN driver])
- +if test "x$enable_tlan" = xyes; then
- + NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TLAN=1"
- + NETBOOT_DRIVERS="$NETBOOT_DRIVERS tlan.o"
- +fi
- +
- AC_ARG_ENABLE(via-rhine,
- [ --enable-via-rhine enable Rhine-I/II driver])
- if test "x$enable_via_rhine" = xyes; then
- @@ -538,7 +461,7 @@
- fi
-
- AC_ARG_ENABLE(w89c840,
- - [ --enable-w89c840 enable Winbond W89c840, Compex RL100-ATX driver])
- + [ --enable-w89c840 enable Winbond W89c840 driver])
- if test "x$enable_w89c840" = xyes; then
- NET_CFLAGS="$NET_CFLAGS -DINCLUDE_W89C840=1"
- NETBOOT_DRIVERS="$NETBOOT_DRIVERS w89c840.o"
- @@ -550,19 +473,7 @@
- FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1"
- fi
-
- -dnl Extra options.
- -AC_ARG_ENABLE(3c503-shmem,
- - [ --enable-3c503-shmem use 3c503 shared memory mode])
- -if test "x$enable_3c503_shmem" = xyes; then
- - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DT503_SHMEM=1"
- -fi
- -
- -AC_ARG_ENABLE(3c503-aui,
- - [ --enable-3c503-aui use AUI by default on 3c503 cards])
- -if test "x$enable_3c503_aui" = xyes; then
- - NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DT503_AUI=1"
- -fi
- -
- +dnl extra flag for ns8390.c
- AC_ARG_ENABLE(compex-rl2000-fix,
- [ --enable-compex-rl2000-fix
- specify this if you have a Compex RL2000 PCI])
- @@ -570,11 +481,6 @@
- NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCOMPEX_RL2000_FIX=1"
- fi
-
- -AC_ARG_ENABLE(smc9000-scan,
- - [ --enable-smc9000-scan=LIST
- - probe for SMC9000 I/O addresses using LIST],
- - [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DSMC9000_SCAN=$enable_smc9000_scan"])
- -
- AC_ARG_ENABLE(ne-scan,
- [ --enable-ne-scan=LIST probe for NE base address using LIST],
- [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=$enable_ne_scan"],
- @@ -586,10 +492,6 @@
- [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=$enable_wd_default_mem"],
- [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=0xCC000"])
-
- -AC_ARG_ENABLE(cs-scan,
- - [ --enable-cs-scan=LIST probe for CS89x0 base address using LIST],
- - [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCS_SCAN=$enable_cs_scan"])
- -
- dnl Diskless
- AC_ARG_ENABLE(diskless,
- [ --enable-diskless enable diskless support])
- diff -Naur grub-0.97.orig/netboot/3c509.h grub-0.97/netboot/3c509.h
- --- grub-0.97.orig/netboot/3c509.h 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/3c509.h 1970-01-01 00:00:00.000000000 +0000
- @@ -1,397 +0,0 @@
- -/*
- - * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved.
- - *
- - * Redistribution and use in source and binary forms, with or without
- - * modification, are permitted provided that the following conditions are
- - * met: 1. Redistributions of source code must retain the above copyright
- - * notice, this list of conditions and the following disclaimer. 2. The name
- - * of the author may not be used to endorse or promote products derived from
- - * this software withough specific prior written permission
- - *
- - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- - *
- - * if_epreg.h,v 1.4 1994/11/13 10:12:37 gibbs Exp Modified by:
- - *
- - October 2, 1994
- -
- - Modified by: Andres Vega Garcia
- -
- - INRIA - Sophia Antipolis, France
- - e-mail: avega@sophia.inria.fr
- - finger: avega@pax.inria.fr
- -
- - */
- -
- -/*
- - * Ethernet software status per interface.
- - */
- -/*
- - * Some global constants
- - */
- -
- -#define TX_INIT_RATE 16
- -#define TX_INIT_MAX_RATE 64
- -#define RX_INIT_LATENCY 64
- -#define RX_INIT_EARLY_THRESH 64
- -#define MIN_RX_EARLY_THRESHF 16 /* not less than ether_header */
- -#define MIN_RX_EARLY_THRESHL 4
- -
- -#define EEPROMSIZE 0x40
- -#define MAX_EEPROMBUSY 1000
- -#define EP_LAST_TAG 0xd7
- -#define EP_MAX_BOARDS 16
- -#define EP_ID_PORT 0x100
- -
- -/*
- - * some macros to acces long named fields
- - */
- -#define IS_BASE (eth_nic_base)
- -#define BASE (eth_nic_base)
- -
- -/*
- - * Commands to read/write EEPROM trough EEPROM command register (Window 0,
- - * Offset 0xa)
- - */
- -#define EEPROM_CMD_RD 0x0080 /* Read: Address required (5 bits) */
- -#define EEPROM_CMD_WR 0x0040 /* Write: Address required (5 bits) */
- -#define EEPROM_CMD_ERASE 0x00c0 /* Erase: Address required (5 bits) */
- -#define EEPROM_CMD_EWEN 0x0030 /* Erase/Write Enable: No data required */
- -
- -#define EEPROM_BUSY (1<<15)
- -#define EEPROM_TST_MODE (1<<14)
- -
- -/*
- - * Some short functions, worth to let them be a macro
- - */
- -#define is_eeprom_busy(b) (inw((b)+EP_W0_EEPROM_COMMAND)&EEPROM_BUSY)
- -#define GO_WINDOW(x) outw(WINDOW_SELECT|(x), BASE+EP_COMMAND)
- -
- -/**************************************************************************
- - *
- - * These define the EEPROM data structure. They are used in the probe
- - * function to verify the existance of the adapter after having sent
- - * the ID_Sequence.
- - *
- - * There are others but only the ones we use are defined here.
- - *
- - **************************************************************************/
- -
- -#define EEPROM_NODE_ADDR_0 0x0 /* Word */
- -#define EEPROM_NODE_ADDR_1 0x1 /* Word */
- -#define EEPROM_NODE_ADDR_2 0x2 /* Word */
- -#define EEPROM_PROD_ID 0x3 /* 0x9[0-f]50 */
- -#define EEPROM_MFG_ID 0x7 /* 0x6d50 */
- -#define EEPROM_ADDR_CFG 0x8 /* Base addr */
- -#define EEPROM_RESOURCE_CFG 0x9 /* IRQ. Bits 12-15 */
- -
- -/**************************************************************************
- - *
- - * These are the registers for the 3Com 3c509 and their bit patterns when
- - * applicable. They have been taken out the the "EtherLink III Parallel
- - * Tasking EISA and ISA Technical Reference" "Beta Draft 10/30/92" manual
- - * from 3com.
- - *
- - **************************************************************************/
- -
- -#define EP_COMMAND 0x0e /* Write. BASE+0x0e is always a
- - * command reg. */
- -#define EP_STATUS 0x0e /* Read. BASE+0x0e is always status
- - * reg. */
- -#define EP_WINDOW 0x0f /* Read. BASE+0x0f is always window
- - * reg. */
- -/*
- - * Window 0 registers. Setup.
- - */
- -/* Write */
- -#define EP_W0_EEPROM_DATA 0x0c
- -#define EP_W0_EEPROM_COMMAND 0x0a
- -#define EP_W0_RESOURCE_CFG 0x08
- -#define EP_W0_ADDRESS_CFG 0x06
- -#define EP_W0_CONFIG_CTRL 0x04
- -/* Read */
- -#define EP_W0_PRODUCT_ID 0x02
- -#define EP_W0_MFG_ID 0x00
- -
- -/*
- - * Window 1 registers. Operating Set.
- - */
- -/* Write */
- -#define EP_W1_TX_PIO_WR_2 0x02
- -#define EP_W1_TX_PIO_WR_1 0x00
- -/* Read */
- -#define EP_W1_FREE_TX 0x0c
- -#define EP_W1_TX_STATUS 0x0b /* byte */
- -#define EP_W1_TIMER 0x0a /* byte */
- -#define EP_W1_RX_STATUS 0x08
- -#define EP_W1_RX_PIO_RD_2 0x02
- -#define EP_W1_RX_PIO_RD_1 0x00
- -
- -/*
- - * Window 2 registers. Station Address Setup/Read
- - */
- -/* Read/Write */
- -#define EP_W2_ADDR_5 0x05
- -#define EP_W2_ADDR_4 0x04
- -#define EP_W2_ADDR_3 0x03
- -#define EP_W2_ADDR_2 0x02
- -#define EP_W2_ADDR_1 0x01
- -#define EP_W2_ADDR_0 0x00
- -
- -/*
- - * Window 3 registers. FIFO Management.
- - */
- -/* Read */
- -#define EP_W3_FREE_TX 0x0c
- -#define EP_W3_FREE_RX 0x0a
- -
- -/*
- - * Window 4 registers. Diagnostics.
- - */
- -/* Read/Write */
- -#define EP_W4_MEDIA_TYPE 0x0a
- -#define EP_W4_CTRLR_STATUS 0x08
- -#define EP_W4_NET_DIAG 0x06
- -#define EP_W4_FIFO_DIAG 0x04
- -#define EP_W4_HOST_DIAG 0x02
- -#define EP_W4_TX_DIAG 0x00
- -
- -/*
- - * Window 5 Registers. Results and Internal status.
- - */
- -/* Read */
- -#define EP_W5_READ_0_MASK 0x0c
- -#define EP_W5_INTR_MASK 0x0a
- -#define EP_W5_RX_FILTER 0x08
- -#define EP_W5_RX_EARLY_THRESH 0x06
- -#define EP_W5_TX_AVAIL_THRESH 0x02
- -#define EP_W5_TX_START_THRESH 0x00
- -
- -/*
- - * Window 6 registers. Statistics.
- - */
- -/* Read/Write */
- -#define TX_TOTAL_OK 0x0c
- -#define RX_TOTAL_OK 0x0a
- -#define TX_DEFERRALS 0x08
- -#define RX_FRAMES_OK 0x07
- -#define TX_FRAMES_OK 0x06
- -#define RX_OVERRUNS 0x05
- -#define TX_COLLISIONS 0x04
- -#define TX_AFTER_1_COLLISION 0x03
- -#define TX_AFTER_X_COLLISIONS 0x02
- -#define TX_NO_SQE 0x01
- -#define TX_CD_LOST 0x00
- -
- -/****************************************
- - *
- - * Register definitions.
- - *
- - ****************************************/
- -
- -/*
- - * Command register. All windows.
- - *
- - * 16 bit register.
- - * 15-11: 5-bit code for command to be executed.
- - * 10-0: 11-bit arg if any. For commands with no args;
- - * this can be set to anything.
- - */
- -#define GLOBAL_RESET (unsigned short) 0x0000 /* Wait at least 1ms
- - * after issuing */
- -#define WINDOW_SELECT (unsigned short) (0x1<<11)
- -#define START_TRANSCEIVER (unsigned short) (0x2<<11) /* Read ADDR_CFG reg to
- - * determine whether
- - * this is needed. If
- - * so; wait 800 uSec
- - * before using trans-
- - * ceiver. */
- -#define RX_DISABLE (unsigned short) (0x3<<11) /* state disabled on
- - * power-up */
- -#define RX_ENABLE (unsigned short) (0x4<<11)
- -#define RX_RESET (unsigned short) (0x5<<11)
- -#define RX_DISCARD_TOP_PACK (unsigned short) (0x8<<11)
- -#define TX_ENABLE (unsigned short) (0x9<<11)
- -#define TX_DISABLE (unsigned short) (0xa<<11)
- -#define TX_RESET (unsigned short) (0xb<<11)
- -#define REQ_INTR (unsigned short) (0xc<<11)
- -#define SET_INTR_MASK (unsigned short) (0xe<<11)
- -#define SET_RD_0_MASK (unsigned short) (0xf<<11)
- -#define SET_RX_FILTER (unsigned short) (0x10<<11)
- -#define FIL_INDIVIDUAL (unsigned short) (0x1)
- -#define FIL_GROUP (unsigned short) (0x2)
- -#define FIL_BRDCST (unsigned short) (0x4)
- -#define FIL_ALL (unsigned short) (0x8)
- -#define SET_RX_EARLY_THRESH (unsigned short) (0x11<<11)
- -#define SET_TX_AVAIL_THRESH (unsigned short) (0x12<<11)
- -#define SET_TX_START_THRESH (unsigned short) (0x13<<11)
- -#define STATS_ENABLE (unsigned short) (0x15<<11)
- -#define STATS_DISABLE (unsigned short) (0x16<<11)
- -#define STOP_TRANSCEIVER (unsigned short) (0x17<<11)
- -/*
- - * The following C_* acknowledge the various interrupts. Some of them don't
- - * do anything. See the manual.
- - */
- -#define ACK_INTR (unsigned short) (0x6800)
- -#define C_INTR_LATCH (unsigned short) (ACK_INTR|0x1)
- -#define C_CARD_FAILURE (unsigned short) (ACK_INTR|0x2)
- -#define C_TX_COMPLETE (unsigned short) (ACK_INTR|0x4)
- -#define C_TX_AVAIL (unsigned short) (ACK_INTR|0x8)
- -#define C_RX_COMPLETE (unsigned short) (ACK_INTR|0x10)
- -#define C_RX_EARLY (unsigned short) (ACK_INTR|0x20)
- -#define C_INT_RQD (unsigned short) (ACK_INTR|0x40)
- -#define C_UPD_STATS (unsigned short) (ACK_INTR|0x80)
- -
- -/*
- - * Status register. All windows.
- - *
- - * 15-13: Window number(0-7).
- - * 12: Command_in_progress.
- - * 11: reserved.
- - * 10: reserved.
- - * 9: reserved.
- - * 8: reserved.
- - * 7: Update Statistics.
- - * 6: Interrupt Requested.
- - * 5: RX Early.
- - * 4: RX Complete.
- - * 3: TX Available.
- - * 2: TX Complete.
- - * 1: Adapter Failure.
- - * 0: Interrupt Latch.
- - */
- -#define S_INTR_LATCH (unsigned short) (0x1)
- -#define S_CARD_FAILURE (unsigned short) (0x2)
- -#define S_TX_COMPLETE (unsigned short) (0x4)
- -#define S_TX_AVAIL (unsigned short) (0x8)
- -#define S_RX_COMPLETE (unsigned short) (0x10)
- -#define S_RX_EARLY (unsigned short) (0x20)
- -#define S_INT_RQD (unsigned short) (0x40)
- -#define S_UPD_STATS (unsigned short) (0x80)
- -#define S_5_INTS (S_CARD_FAILURE|S_TX_COMPLETE|\
- - S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY)
- -#define S_COMMAND_IN_PROGRESS (unsigned short) (0x1000)
- -
- -/*
- - * FIFO Registers.
- - * RX Status. Window 1/Port 08
- - *
- - * 15: Incomplete or FIFO empty.
- - * 14: 1: Error in RX Packet 0: Incomplete or no error.
- - * 13-11: Type of error.
- - * 1000 = Overrun.
- - * 1011 = Run Packet Error.
- - * 1100 = Alignment Error.
- - * 1101 = CRC Error.
- - * 1001 = Oversize Packet Error (>1514 bytes)
- - * 0010 = Dribble Bits.
- - * (all other error codes, no errors.)
- - *
- - * 10-0: RX Bytes (0-1514)
- - */
- -#define ERR_RX_INCOMPLETE (unsigned short) (0x1<<15)
- -#define ERR_RX (unsigned short) (0x1<<14)
- -#define ERR_RX_OVERRUN (unsigned short) (0x8<<11)
- -#define ERR_RX_RUN_PKT (unsigned short) (0xb<<11)
- -#define ERR_RX_ALIGN (unsigned short) (0xc<<11)
- -#define ERR_RX_CRC (unsigned short) (0xd<<11)
- -#define ERR_RX_OVERSIZE (unsigned short) (0x9<<11)
- -#define ERR_RX_DRIBBLE (unsigned short) (0x2<<11)
- -
- -/*
- - * FIFO Registers.
- - * TX Status. Window 1/Port 0B
- - *
- - * Reports the transmit status of a completed transmission. Writing this
- - * register pops the transmit completion stack.
- - *
- - * Window 1/Port 0x0b.
- - *
- - * 7: Complete
- - * 6: Interrupt on successful transmission requested.
- - * 5: Jabber Error (TP Only, TX Reset required. )
- - * 4: Underrun (TX Reset required. )
- - * 3: Maximum Collisions.
- - * 2: TX Status Overflow.
- - * 1-0: Undefined.
- - *
- - */
- -#define TXS_COMPLETE 0x80
- -#define TXS_SUCCES_INTR_REQ 0x40
- -#define TXS_JABBER 0x20
- -#define TXS_UNDERRUN 0x10
- -#define TXS_MAX_COLLISION 0x8
- -#define TXS_STATUS_OVERFLOW 0x4
- -
- -/*
- - * Configuration control register.
- - * Window 0/Port 04
- - */
- -/* Read */
- -#define IS_AUI (1<<13)
- -#define IS_BNC (1<<12)
- -#define IS_UTP (1<<9)
- -/* Write */
- -#define ENABLE_DRQ_IRQ 0x0001
- -#define W0_P4_CMD_RESET_ADAPTER 0x4
- -#define W0_P4_CMD_ENABLE_ADAPTER 0x1
- -/*
- - * Media type and status.
- - * Window 4/Port 0A
- - */
- -#define ENABLE_UTP 0xc0
- -#define DISABLE_UTP 0x0
- -
- -/*
- - * Resource control register
- - */
- -
- -#define SET_IRQ(i) ( ((i)<<12) | 0xF00) /* set IRQ i */
- -
- -/*
- - * Receive status register
- - */
- -
- -#define RX_BYTES_MASK (unsigned short) (0x07ff)
- -#define RX_ERROR 0x4000
- -#define RX_INCOMPLETE 0x8000
- -
- -
- -/*
- - * Misc defines for various things.
- - */
- -#define ACTIVATE_ADAPTER_TO_CONFIG 0xff /* to the id_port */
- -#define MFG_ID 0x6d50 /* in EEPROM and W0 ADDR_CONFIG */
- -#define PROD_ID 0x9150
- -
- -#define AUI 0x1
- -#define BNC 0x2
- -#define UTP 0x4
- -
- -#define RX_BYTES_MASK (unsigned short) (0x07ff)
- -
- - /* EISA support */
- -#define EP_EISA_START 0x1000
- -#define EP_EISA_W0 0x0c80
- -
- -#ifdef INCLUDE_3C529
- - /* MCA support */
- -#define MCA_MOTHERBOARD_SETUP_REG 0x94
- -#define MCA_ADAPTER_SETUP_REG 0x96
- -#define MCA_MAX_SLOT_NR 8
- -#define MCA_POS_REG(n) (0x100+(n))
- -#endif
- -
- -/*
- - * Local variables:
- - * c-basic-offset: 8
- - * End:
- - */
- diff -Naur grub-0.97.orig/netboot/3c595.c grub-0.97/netboot/3c595.c
- --- grub-0.97.orig/netboot/3c595.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/3c595.c 2005-08-31 19:03:35.000000000 +0000
- @@ -20,6 +20,7 @@
- *
- * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
- *
- +* timlegge 08-24-2003 Add Multicast Support
- */
-
- /* #define EDEBUG */
- @@ -30,7 +31,7 @@
- #include "3c595.h"
- #include "timer.h"
-
- -static unsigned short eth_nic_base, eth_asic_base;
- +static unsigned short eth_nic_base;
- static unsigned short vx_connector, vx_connectors;
-
- static struct connector_entry {
- @@ -57,14 +58,12 @@
- static void vxgetlink(void);
- static void vxsetlink(void);
-
- -#define udelay(n) waiton_timer2(((n)*TICKS_PER_MS)/1000)
- -
- /**************************************************************************
- ETH_RESET - Reset adapter
- ***************************************************************************/
- static void t595_reset(struct nic *nic)
- {
- - int i, j;
- + int i;
-
- /***********************************************************
- Reset 3Com 595 card
- @@ -133,7 +132,7 @@
- outw(ACK_INTR | 0xff, BASE + VX_COMMAND);
-
- outw(SET_RX_FILTER | FIL_INDIVIDUAL |
- - FIL_BRDCST, BASE + VX_COMMAND);
- + FIL_BRDCST|FIL_MULTICAST, BASE + VX_COMMAND);
-
- vxsetlink();
- /*{
- @@ -225,10 +224,9 @@
- /**************************************************************************
- ETH_POLL - Wait for a frame
- ***************************************************************************/
- -static int t595_poll(struct nic *nic)
- +static int t595_poll(struct nic *nic, int retrieve)
- {
- /* common variables */
- - unsigned short type = 0; /* used by EDEBUG */
- /* variables for 3C595 */
- short status, cst;
- register short rx_fifo;
- @@ -262,6 +260,8 @@
- if (rx_fifo==0)
- return 0;
-
- + if ( ! retrieve ) return 1;
- +
- /* read packet */
- #ifdef EDEBUG
- printf("[l=%d",rx_fifo);
- @@ -300,12 +300,15 @@
- outw(RX_DISCARD_TOP_PACK, BASE + VX_COMMAND);
- while (inw(BASE + VX_STATUS) & S_COMMAND_IN_PROGRESS);
- #ifdef EDEBUG
- +{
- + unsigned short type = 0; /* used by EDEBUG */
- type = (nic->packet[12]<<8) | nic->packet[13];
- if(nic->packet[0]+nic->packet[1]+nic->packet[2]+nic->packet[3]+nic->packet[4]+
- nic->packet[5] == 0xFF*ETH_ALEN)
- printf(",t=%hX,b]",type);
- else
- printf(",t=%hX]",type);
- +}
- #endif
- return 1;
- }
- @@ -382,9 +385,8 @@
- static void
- vxsetlink(void)
- {
- - int i, j, k;
- + int i, j;
- char *reason, *warning;
- - static short prev_flags;
- static char prev_conn = -1;
-
- if (prev_conn == -1) {
- @@ -438,28 +440,47 @@
- GO_WINDOW(1);
- }
-
- -static void t595_disable(struct nic *nic)
- +static void t595_disable(struct dev *dev)
- {
- - outw(STOP_TRANSCEIVER, BASE + VX_COMMAND);
- - udelay(8000);
- - GO_WINDOW(4);
- - outw(0, BASE + VX_W4_MEDIA_TYPE);
- - GO_WINDOW(1);
- + struct nic *nic = (struct nic *)dev;
- + t595_reset(nic);
- +
- + outw(STOP_TRANSCEIVER, BASE + VX_COMMAND);
- + udelay(8000);
- + GO_WINDOW(4);
- + outw(0, BASE + VX_W4_MEDIA_TYPE);
- + GO_WINDOW(1);
- +}
- +
- +static void t595_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- }
-
- /**************************************************************************
- ETH_PROBE - Look for an adapter
- ***************************************************************************/
- -struct nic *t595_probe(struct nic *nic, unsigned short *probeaddrs, struct pci_device *pci)
- +static int t595_probe(struct dev *dev, struct pci_device *pci)
- {
- + struct nic *nic = (struct nic *)dev;
- int i;
- unsigned short *p;
-
- - if (probeaddrs == 0 || probeaddrs[0] == 0)
- + if (pci->ioaddr == 0)
- return 0;
- /* eth_nic_base = probeaddrs[0] & ~3; */
- eth_nic_base = pci->ioaddr;
-
- + nic->irqno = 0;
- + nic->ioaddr = pci->ioaddr & ~3;
- +
- GO_WINDOW(0);
- outw(GLOBAL_RESET, BASE + VX_COMMAND);
- VX_BUSY_WAIT;
- @@ -487,14 +508,40 @@
- printf("Ethernet address: %!\n", nic->node_addr);
-
- t595_reset(nic);
- - nic->reset = t595_reset;
- - nic->poll = t595_poll;
- + dev->disable = t595_disable;
- + nic->poll = t595_poll;
- nic->transmit = t595_transmit;
- - nic->disable = t595_disable;
- - return nic;
- + nic->irq = t595_irq;
- + return 1;
-
- }
-
- +static struct pci_id t595_nics[] = {
- +PCI_ROM(0x10b7, 0x5900, "3c590", "3Com590"), /* Vortex 10Mbps */
- +PCI_ROM(0x10b7, 0x5950, "3c595", "3Com595"), /* Vortex 100baseTx */
- +PCI_ROM(0x10b7, 0x5951, "3c595-1", "3Com595"), /* Vortex 100baseT4 */
- +PCI_ROM(0x10b7, 0x5952, "3c595-2", "3Com595"), /* Vortex 100base-MII */
- +PCI_ROM(0x10b7, 0x9000, "3c900-tpo", "3Com900-TPO"), /* 10 Base TPO */
- +PCI_ROM(0x10b7, 0x9001, "3c900-t4", "3Com900-Combo"), /* 10/100 T4 */
- +PCI_ROM(0x10b7, 0x9004, "3c900b-tpo", "3Com900B-TPO"), /* 10 Base TPO */
- +PCI_ROM(0x10b7, 0x9005, "3c900b-combo", "3Com900B-Combo"), /* 10 Base Combo */
- +PCI_ROM(0x10b7, 0x9006, "3c900b-tpb2", "3Com900B-2/T"), /* 10 Base TP and Base2 */
- +PCI_ROM(0x10b7, 0x900a, "3c900b-fl", "3Com900B-FL"), /* 10 Base F */
- +PCI_ROM(0x10b7, 0x9800, "3c980-cyclone-1", "3Com980-Cyclone"), /* Cyclone */
- +PCI_ROM(0x10b7, 0x9805, "3c9805-1", "3Com9805"), /* Dual Port Server Cyclone */
- +PCI_ROM(0x10b7, 0x7646, "3csoho100-tx-1", "3CSOHO100-TX"), /* Hurricane */
- +PCI_ROM(0x10b7, 0x4500, "3c450-1", "3Com450 HomePNA Tornado"),
- +};
- +
- +struct pci_driver t595_driver = {
- + .type = NIC_DRIVER,
- + .name = "3C595",
- + .probe = t595_probe,
- + .ids = t595_nics,
- + .id_count = sizeof(t595_nics)/sizeof(t595_nics[0]),
- + .class = 0,
- +};
- +
- /*
- * Local variables:
- * c-basic-offset: 8
- diff -Naur grub-0.97.orig/netboot/3c90x.c grub-0.97/netboot/3c90x.c
- --- grub-0.97.orig/netboot/3c90x.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/3c90x.c 2005-08-31 19:03:35.000000000 +0000
- @@ -1,7 +1,7 @@
- /*
- * 3c90x.c -- This file implements the 3c90x driver for etherboot. Written
- * by Greg Beeley, Greg.Beeley@LightSys.org. Modified by Steve Smith,
- - * Steve.Smith@Juno.Com
- + * Steve.Smith@Juno.Com. Alignment bug fix Neil Newell (nn@icenoir.net).
- *
- * This program Copyright (C) 1999 LightSys Technology Services, Inc.
- * Portions Copyright (C) 1999 Steve Smith
- @@ -31,13 +31,15 @@
- * Re-wrote poll and transmit for
- * better error recovery and heavy
- * network traffic operation
- + * v2.01 5-26-2003 NN Fixed driver alignment issue which
- + * caused system lockups if driver structures
- + * not 8-byte aligned.
- *
- */
-
- #include "etherboot.h"
- #include "nic.h"
- #include "pci.h"
- -#include "cards.h"
- #include "timer.h"
-
- #define XCVR_MAGIC (0x5A00)
- @@ -47,9 +49,6 @@
- **/
- #define XMIT_RETRIES 250
-
- -#undef virt_to_bus
- -#define virt_to_bus(x) ((unsigned long)x)
- -
- /*** Register definitions for the 3c905 ***/
- enum Registers
- {
- @@ -225,7 +224,7 @@
- unsigned int DataAddr;
- unsigned int DataLength;
- }
- - TXD;
- + TXD __attribute__ ((aligned(8))); /* 64-bit aligned for bus mastering */
-
- /*** RX descriptor ***/
- typedef struct
- @@ -235,7 +234,7 @@
- unsigned int DataAddr;
- unsigned int DataLength;
- }
- - RXD;
- + RXD __attribute__ ((aligned(8))); /* 64-bit aligned for bus mastering */
-
- /*** Global variables ***/
- static struct
- @@ -311,6 +310,7 @@
- }
-
-
- +#if 0
- /*** a3c90x_internal_WriteEepromWord - write a physical word of
- *** data to the onboard serial eeprom (not the BIOS prom, but the
- *** nvram in the card that stores, among other things, the MAC
- @@ -344,8 +344,9 @@
-
- return 0;
- }
- +#endif
-
- -
- +#if 0
- /*** a3c90x_internal_WriteEeprom - write data to the serial eeprom,
- *** and re-compute the eeprom checksum.
- ***/
- @@ -384,8 +385,7 @@
-
- return 0;
- }
- -
- -
- +#endif
-
- /*** a3c90x_reset: exported function that resets the card to its default
- *** state. This is so the Linux driver can re-set the card up the way
- @@ -393,12 +393,10 @@
- *** not alter the selected transceiver that we used to download the boot
- *** image.
- ***/
- -static void
- -a3c90x_reset(struct nic *nic)
- +static void a3c90x_reset(void)
- {
- - int cfg;
- -
- #ifdef CFG_3C90X_PRESERVE_XCVR
- + int cfg;
- /** Read the current InternalConfig value. **/
- a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winTxRxOptions3);
- cfg = inl(INF_3C90X.IOAddr + regInternalConfig_3_l);
- @@ -473,7 +471,7 @@
- *** p - the pointer to the packet data itself.
- ***/
- static void
- -a3c90x_transmit(struct nic *nic, const char *d, unsigned int t,
- +a3c90x_transmit(struct nic *nic __unused, const char *d, unsigned int t,
- unsigned int s, const char *p)
- {
-
- @@ -553,7 +551,7 @@
- if (status & 0x02)
- {
- printf("3C90X: Tx Reclaim Error (%hhX)\n", status);
- - a3c90x_reset(NULL);
- + a3c90x_reset();
- }
- else if (status & 0x04)
- {
- @@ -572,18 +570,18 @@
- else if (status & 0x10)
- {
- printf("3C90X: Tx Underrun (%hhX)\n", status);
- - a3c90x_reset(NULL);
- + a3c90x_reset();
- }
- else if (status & 0x20)
- {
- printf("3C90X: Tx Jabber (%hhX)\n", status);
- - a3c90x_reset(NULL);
- + a3c90x_reset();
- }
- else if ((status & 0x80) != 0x80)
- {
- printf("3C90X: Internal Error - Incomplete Transmission (%hhX)\n",
- status);
- - a3c90x_reset(NULL);
- + a3c90x_reset();
- }
- }
-
- @@ -601,7 +599,7 @@
- *** in nic->packetlen. Return 1 if a packet was found.
- ***/
- static int
- -a3c90x_poll(struct nic *nic)
- +a3c90x_poll(struct nic *nic, int retrieve)
- {
- int i, errcode;
-
- @@ -610,6 +608,8 @@
- return 0;
- }
-
- + if ( ! retrieve ) return 1;
- +
- /** we don't need to acknowledge rxComplete -- the upload engine
- ** does it for us.
- **/
- @@ -663,34 +663,51 @@
- *** [Ken]
- ***/
- static void
- -a3c90x_disable(struct nic *nic)
- - {
- +a3c90x_disable(struct dev *dev __unused)
- +{
- + /* reset and disable merge */
- + a3c90x_reset();
- /* Disable the receiver and transmitter. */
- outw(cmdRxDisable, INF_3C90X.IOAddr + regCommandIntStatus_w);
- outw(cmdTxDisable, INF_3C90X.IOAddr + regCommandIntStatus_w);
- - }
- -
- +}
-
- +static void a3c90x_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
-
- /*** a3c90x_probe: exported routine to probe for the 3c905 card and perform
- *** initialization. If this routine is called, the pci functions did find the
- *** card. We just have to init it here.
- ***/
- -struct nic*
- -a3c90x_probe(struct nic *nic, unsigned short *probeaddrs, struct pci_device *pci)
- - {
- +static int a3c90x_probe(struct dev *dev, struct pci_device *pci)
- +{
- + struct nic *nic = (struct nic *)dev;
- int i, c;
- unsigned short eeprom[0x21];
- unsigned int cfg;
- unsigned int mopt;
- + unsigned int mstat;
- unsigned short linktype;
- +#define HWADDR_OFFSET 10
-
- - if (probeaddrs == 0 || probeaddrs[0] == 0)
- + if (pci->ioaddr == 0)
- return 0;
-
- adjust_pci_device(pci);
-
- - INF_3C90X.IOAddr = probeaddrs[0] & ~3;
- + nic->ioaddr = pci->ioaddr & ~3;
- + nic->irqno = 0;
- +
- + INF_3C90X.IOAddr = pci->ioaddr & ~3;
- INF_3C90X.CurrentWindow = 255;
- switch (a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, 0x03))
- {
- @@ -756,30 +773,45 @@
- "Copyright 1999 LightSys Technology Services, Inc.\n"
- "Portions Copyright 1999 Steve Smith\n");
- printf("Provided with ABSOLUTELY NO WARRANTY.\n");
- +#ifdef CFG_3C90X_BOOTROM_FIX
- + if (INF_3C90X.isBrev)
- + {
- + printf("NOTE: 3c905b bootrom fix enabled; has side "
- + "effects. See 3c90x.txt for info.\n");
- + }
- +#endif
- printf("-------------------------------------------------------"
- "------------------------\n");
-
- /** Retrieve the Hardware address and print it on the screen. **/
- - INF_3C90X.HWAddr[0] = eeprom[0]>>8;
- - INF_3C90X.HWAddr[1] = eeprom[0]&0xFF;
- - INF_3C90X.HWAddr[2] = eeprom[1]>>8;
- - INF_3C90X.HWAddr[3] = eeprom[1]&0xFF;
- - INF_3C90X.HWAddr[4] = eeprom[2]>>8;
- - INF_3C90X.HWAddr[5] = eeprom[2]&0xFF;
- + INF_3C90X.HWAddr[0] = eeprom[HWADDR_OFFSET + 0]>>8;
- + INF_3C90X.HWAddr[1] = eeprom[HWADDR_OFFSET + 0]&0xFF;
- + INF_3C90X.HWAddr[2] = eeprom[HWADDR_OFFSET + 1]>>8;
- + INF_3C90X.HWAddr[3] = eeprom[HWADDR_OFFSET + 1]&0xFF;
- + INF_3C90X.HWAddr[4] = eeprom[HWADDR_OFFSET + 2]>>8;
- + INF_3C90X.HWAddr[5] = eeprom[HWADDR_OFFSET + 2]&0xFF;
- printf("MAC Address = %!\n", INF_3C90X.HWAddr);
-
- + /* Test if the link is good, if not continue */
- + a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winDiagnostics4);
- + mstat = inw(INF_3C90X.IOAddr + regMediaStatus_4_w);
- + if((mstat & (1<<11)) == 0) {
- + printf("Valid link not established\n");
- + return 0;
- + }
- +
- /** Program the MAC address into the station address registers **/
- a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winAddressing2);
- - outw(htons(eeprom[0]), INF_3C90X.IOAddr + regStationAddress_2_3w);
- - outw(htons(eeprom[1]), INF_3C90X.IOAddr + regStationAddress_2_3w+2);
- - outw(htons(eeprom[2]), INF_3C90X.IOAddr + regStationAddress_2_3w+4);
- + outw(htons(eeprom[HWADDR_OFFSET + 0]), INF_3C90X.IOAddr + regStationAddress_2_3w);
- + outw(htons(eeprom[HWADDR_OFFSET + 1]), INF_3C90X.IOAddr + regStationAddress_2_3w+2);
- + outw(htons(eeprom[HWADDR_OFFSET + 2]), INF_3C90X.IOAddr + regStationAddress_2_3w+4);
- outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+0);
- outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+2);
- outw(0, INF_3C90X.IOAddr + regStationMask_2_3w+4);
-
- /** Fill in our entry in the etherboot arp table **/
- for(i=0;i<ETH_ALEN;i++)
- - nic->node_addr[i] = (eeprom[i/2] >> (8*((i&1)^1))) & 0xff;
- + nic->node_addr[i] = (eeprom[HWADDR_OFFSET + i/2] >> (8*((i&1)^1))) & 0xff;
-
- /** Read the media options register, print a message and set default
- ** xcvr.
- @@ -903,8 +935,8 @@
- while (inw(INF_3C90X.IOAddr + regCommandIntStatus_w) & INT_CMDINPROGRESS)
- ;
-
- - /** Set the RX filter = receive only individual pkts & bcast. **/
- - a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdSetRxFilter, 0x01 + 0x04);
- + /** Set the RX filter = receive only individual pkts & multicast & bcast. **/
- + a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdSetRxFilter, 0x01 + 0x02 + 0x04);
- a3c90x_internal_IssueCommand(INF_3C90X.IOAddr, cmdRxEnable, 0);
-
-
- @@ -918,12 +950,46 @@
- cmdAcknowledgeInterrupt, 0x661);
-
- /** Set our exported functions **/
- - nic->reset = a3c90x_reset;
- + dev->disable = a3c90x_disable;
- nic->poll = a3c90x_poll;
- nic->transmit = a3c90x_transmit;
- - nic->disable = a3c90x_disable;
- + nic->irq = a3c90x_irq;
-
- - return nic;
- - }
- + return 1;
- +}
-
-
- +static struct pci_id a3c90x_nics[] = {
- +/* Original 90x revisions: */
- +PCI_ROM(0x10b7, 0x9000, "3c905-tpo", "3Com900-TPO"), /* 10 Base TPO */
- +PCI_ROM(0x10b7, 0x9001, "3c905-t4", "3Com900-Combo"), /* 10/100 T4 */
- +PCI_ROM(0x10b7, 0x9050, "3c905-tpo100", "3Com905-TX"), /* 100 Base TX / 10/100 TPO */
- +PCI_ROM(0x10b7, 0x9051, "3c905-combo", "3Com905-T4"), /* 100 Base T4 / 10 Base Combo */
- +/* Newer 90xB revisions: */
- +PCI_ROM(0x10b7, 0x9004, "3c905b-tpo", "3Com900B-TPO"), /* 10 Base TPO */
- +PCI_ROM(0x10b7, 0x9005, "3c905b-combo", "3Com900B-Combo"), /* 10 Base Combo */
- +PCI_ROM(0x10b7, 0x9006, "3c905b-tpb2", "3Com900B-2/T"), /* 10 Base TP and Base2 */
- +PCI_ROM(0x10b7, 0x900a, "3c905b-fl", "3Com900B-FL"), /* 10 Base FL */
- +PCI_ROM(0x10b7, 0x9055, "3c905b-tpo100", "3Com905B-TX"), /* 10/100 TPO */
- +PCI_ROM(0x10b7, 0x9056, "3c905b-t4", "3Com905B-T4"), /* 10/100 T4 */
- +PCI_ROM(0x10b7, 0x9058, "3c905b-9058", "3Com905B-9058"), /* Cyclone 10/100/BNC */
- +PCI_ROM(0x10b7, 0x905a, "3c905b-fx", "3Com905B-FL"), /* 100 Base FX / 10 Base FX */
- +/* Newer 90xC revision: */
- +PCI_ROM(0x10b7, 0x9200, "3c905c-tpo", "3Com905C-TXM"), /* 10/100 TPO (3C905C-TXM) */
- +PCI_ROM(0x10b7, 0x9210, "3c920b-emb-wnm","3Com20B-EMB WNM"),
- +PCI_ROM(0x10b7, 0x9800, "3c980", "3Com980-Cyclone"), /* Cyclone */
- +PCI_ROM(0x10b7, 0x9805, "3c9805", "3Com9805"), /* Dual Port Server Cyclone */
- +PCI_ROM(0x10b7, 0x7646, "3csoho100-tx", "3CSOHO100-TX"), /* Hurricane */
- +PCI_ROM(0x10b7, 0x4500, "3c450", "3Com450 HomePNA Tornado"),
- +PCI_ROM(0x10b7, 0x1201, "3c982a", "3Com982A"),
- +PCI_ROM(0x10b7, 0x1202, "3c982b", "3Com982B"),
- +};
- +
- +struct pci_driver a3c90x_driver = {
- + .type = NIC_DRIVER,
- + .name = "3C90X",
- + .probe = a3c90x_probe,
- + .ids = a3c90x_nics,
- + .id_count = sizeof(a3c90x_nics)/sizeof(a3c90x_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/3c90x.txt grub-0.97/netboot/3c90x.txt
- --- grub-0.97.orig/netboot/3c90x.txt 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/3c90x.txt 1970-01-01 00:00:00.000000000 +0000
- @@ -1,307 +0,0 @@
- -
- - Instructions for use of the 3C90X driver for EtherBoot
- -
- - Original 3C905B support by:
- - Greg Beeley (Greg.Beeley@LightSys.org),
- - LightSys Technology Services, Inc.
- - February 11, 1999
- -
- - Updates for 3C90X family by:
- - Steve Smith (steve.smith@juno.com)
- - October 1, 1999
- -
- - Minor documentation updates by
- - Greg Beeley (Greg.Beeley@LightSys.org)
- - March 29, 2000
- -
- --------------------------------------------------------------------------------
- -
- -I OVERVIEW
- -
- - The 3c90X series ethernet cards are a group of high-performance busmaster
- - DMA cards from 3Com. This particular driver supports both the 3c90x and
- - the 3c90xB revision cards. 3C90xC family support has been tested to some
- - degree but not extensively.
- -
- - Here's the licensing information:
- -
- - This program Copyright (C) 1999 LightSys Technology Services, Inc.
- - Portions Copyright (C) 1999 Steve Smith.
- -
- - This program may be re-distributed in source or binary form, modified,
- - sold, or copied for any purpose, provided that the above copyright message
- - and this text are included with all source copies or derivative works, and
- - provided that the above copyright message and this text are included in the
- - documentation of any binary-only distributions. This program is
- - distributed WITHOUT ANY WARRANTY, without even the warranty of FITNESS FOR
- - A PARTICULAR PURPOSE or MERCHANTABILITY. Please read the associated
- - documentation "3c90x.txt" before compiling and using this driver.
- -
- -
- -II FLASH PROMS
- -
- - The 3c90xB cards, according to the 3Com documentation, only accept the
- - following flash memory chips:
- -
- - Atmel AT29C512 (64 kilobyte)
- - Atmel AT29C010 (128 kilobyte)
- -
- - The 3c90x cards, according to the 3Com documentation, accept the
- - following flash memory chips capacities:
- -
- - 64 kb (8 kB)
- - 128 kb (16 kB)
- - 256 kb (32 kB) and
- - 512 kb (64 kB)
- -
- - Atmel AT29C512 (64 kilobyte) chips are specifically listed for both
- - adapters, but flashing on the 3c905b cards would only be supported
- - through the Atmel parts. Any device, of the supported size, should
- - be supported when programmed by a dedicated PROM programmer (e.g.
- - not the card).
- -
- - To use this driver in such a PROM, visit Atmel's web site and download
- - their .PDF file containing a list of their distributors. Contact the
- - distributors for pricing information. The prices are quite reasonable
- - (about $3 US each for the 64 kB part), and are comparable to what one would
- - expect for similarly sized standard EPROMs. And, the flash chips are much
- - easier to work with, as they don't need to be UV-erased to be reprogrammed.
- - The 3C905B card actually provides a method to program the flash memory
- - while it is resident on board the card itself; if someone would like to
- - write a small DOS program to do the programming, I can provide the
- - information about the registers and so forth.
- -
- - A utility program, 3c90xutil, is provided with Etherboot in the 'contrib'
- - directory that allows for the on-board flashing of the ROM while Linux
- - is running. The program has been successfully used under Linux, but I
- - have heard problem reports of its use under FreeBSD. Anyone willing to
- - make it work under FreeBSD is more than welcome to do so!
- -
- - You also have the option of using EPROM chips - the 3C905B-TX-NM has been
- - successfully tested with 27C256 (32kB) and 27C512 (64kB) chips with a
- - specified access time of 100ns and faster.
- -
- -
- -III GENERAL USE
- -
- - Normally, the basic procedure for using this driver is as follows:
- -
- - 1. Run the 3c90xcfg program on the driver diskette to enable the
- - boot PROM and set it to 64k or 128k, as appropriate.
- - 2. Build the appropriate 3c90x.fd0 or 3c90x.fd0 floppy image with
- - possibly the value CFG_3C90X_XCVR defined to the transceiver type that
- - you want to use (i.e., 10/100 rj45, AUI, coax, MII).
- - 3. Run the floppy image on the PC to be network booted, to get
- - it configured, and to verify that it will boot properly.
- - 4. Build the 3c90x.rom or 3c90x.lzrom PROM image and program
- - it into the flash or EPROM memory chip.
- - 5. Put the PROM in the ethernet card, boot and enable 'boot from
- - network first' in the system BIOS, save and reboot.
- -
- - Here are some issues to be aware of:
- -
- - 1. If you experience crashes or different behaviour when using the
- - boot PROM, add the setting CFG_3C90X_BOOTROM_FIX and go through the
- - steps 2-5 above. This works around a bug in some 3c905B cards (see
- - below), but has some side-effects which may not be desirable.
- - Please note that you have to boot off a floppy (not PROM!) once for
- - this fix to take effect.
- - 2. The possible need to manually set the CFG_3C90X_XCVR value to
- - configure the transceiver type. Values are listed below.
- - 3. The possible need to define CFG_3C90X_PRESERVE_XCVR for use in
- - operating systems that don't intelligently determine the
- - transceiver type.
- -
- - Some things that are on the 'To-Do' list, perhaps for me, but perhaps
- - for any other volunteers out there:
- -
- - 1. Extend the driver to fully implement the auto-select
- - algorithm if the card has multiple media ports.
- - 2. Fix any bugs in the code <grin>....
- - 3. Extend the driver to support the 3c905c revision cards
- - "officially". Right now, the support has been primarily empirical
- - and not based on 3c905C documentation.
- -
- - Now for the details....
- -
- - This driver has been tested on roughly 300 systems. The main two
- - configuration issues to contend with are:
- -
- - 1. Ensure that PCI Busmastering is enabled for the adapter (configured
- - in the CMOS setup)
- - 2. Some systems don't work properly with the adapter when plug and
- - play OS is enabled; I always set it to "No" or "Disabled" -- this makes
- - it easier and really doesn't adversely affect anything.
- -
- - Roughly 95% of the systems worked when configured properly. A few
- - have issues with booting locally once the boot PROM has been installed
- - (this number has been less than 2%). Other configuration issues that
- - to check:
- -
- - 1. Newer BIOS's actually work correctly with the network boot order.
- - Set the network adapter first. Most older BIOS's automatically go to
- - the network boot PROM first.
- - 2. For systems where the adapter was already installed and is just
- - having the PROM installed, try setting the "reset configuration data"
- - to yes in the CMOS setup if the BIOS isn't seen at first. If your BIOS
- - doesn't have this option, remove the card, start the system, shut down,
- - install the card and restart (or switch to a different PCI slot).
- - 3. Make sure the CMOS security settings aren't preventing a boot.
- -
- - The 3c905B cards have a significant 'bug' that relates to the flash prom:
- - unless the card is set internally to the MII transceiver, it will only
- - read the first 8k of the PROM image. Don't ask why -- it seems really
- - obscure, but it has to do with the way they mux'd the address lines
- - from the PCI bus to the ROM. Unfortunately, most of us are not using
- - MII transceivers, and even the .lzrom image ends up being just a little
- - bit larger than 8k. Note that the workaround for this is disabled by
- - default, because the Windows NT 4.0 driver does not like it (no packets
- - are transmitted).
- -
- - So, the solution that I've used is to internally set the card's nvram
- - configuration to use MII when it boots. The 3c905b driver does this
- - automatically. This way, the 16k prom image can be loaded into memory,
- - and then the 3c905b driver can set the temporary configuration of the
- - card to an appropriate value, either configurable by the user or chosen
- - by the driver.
- -
- - To enable the 3c905B bugfix, which is necessary for these cards when
- - booting from the Flash ROM, define -DCFG_3C90X_BOOTROM_FIX when building,
- - create a floppy image and boot it once.
- - Thereafter, the card should accept the larger prom image.
- -
- - The driver should choose an appropriate transceiver on the card. However,
- - if it doesn't on your card or if you need to, for instance, set your
- - card to 10mbps when connected to an unmanaged 10/100 hub, you can specify
- - which transceiver you want to use. To do this, build the 3c905b.fd0
- - image with -DCFG_3C90X_XCVR=x, where 'x' is one of the following
- - values:
- -
- - 0 10Base-T
- - 1 10mbps AUI
- - 3 10Base-2 (thinnet/coax)
- - 4 100Base-TX
- - 5 100Base-FX
- - 6 MII
- - 8 Auto-negotiation 10Base-T / 100Base-TX (usually the default)
- - 9 MII External MAC Mode
- - 255 Allow driver to choose an 'appropriate' media port.
- -
- - Then proceed from step 2 in the above 'general use' instructions. The
- - .rom image can be built with CFG_3C90X_XCVR set to a value, but you
- - normally don't want to do this, since it is easier to change the
- - transceiver type by rebuilding a new floppy, changing the BIOS to floppy
- - boot, booting, and then changing the BIOS back to network boot. If
- - CFG_3C90X_XCVR is not set in a particular build, it just uses the
- - current configuration (either its 'best guess' or whatever the stored
- - CFG_3C90X_XCVR value was from the last time it was set).
- -
- - [[ Note for the more technically inclined: The CFG_3C90X_XCVR value is
- - programmed into a register in the card's NVRAM that was reserved for
- - LanWorks PROM images to use. When the driver boots, the card comes
- - up in MII mode, and the driver checks the LanWorks register to find
- - out if the user specified a transceiver type. If it finds that
- - information, it uses that, otherwise it picks a transceiver that the
- - card has based on the 3c905b's MediaOptions register. This driver isn't
- - quite smart enough to always determine which media port is actually
- - _connected_; maybe someone else would like to take on that task (it
- - actually involves sending a self-directed packet and seeing if it
- - comes back. IF it does, that port is connected). ]]
- -
- - Another issue to keep in mind is that it is possible that some OS'es
- - might not be happy with the way I've handled the PROM-image hack with
- - setting MII mode on bootup. Linux 2.0.35 does not have this problem.
- - Behavior of other systems may vary. The 3com documentation specifically
- - says that, at least with the card that I have, the device driver in the
- - OS should auto-select the media port, so other drivers should work fine
- - with this 'hack'. However, if yours doesn't seem to, you can try defining
- - CFG_3C90X_PRESERVE_XCVR when building to cause Etherboot to keep the
- - working setting (that allowed the bootp/tftp process) across the eth_reset
- - operation.
- -
- -
- -IV FOR DEVELOPERS....
- -
- - If you would like to fix/extend/etc. this driver, feel free to do so; just
- - be sure you can test the modified version on the 3c905B-TX cards that the
- - driver was originally designed for. This section of this document gives
- - some information that might be relevant to a programmer.
- -
- - A. Main Entry Point
- -
- - a3c90x_probe is the main entry point for this driver. It is referred
- - to in an array in 'config.c'.
- -
- - B. Other Important Functions
- -
- - The functions a3c90x_transmit, a3c90x_poll, a3c90x_reset, and
- - a3c90x_disable are static functions that EtherBoot finds out about
- - as a result of a3c90x_probe setting entries in the nic structure
- - for them. The EtherBoot framework does not use interrupts. It is
- - polled. All transmit and receive operations are initiated by the
- - etherboot framework, not by an interrupt or by the driver.
- -
- - C. Internal Functions
- -
- - The following functions are internal to the driver:
- -
- - a3c90x_internal_IssueCommand - sends a command to the 3c905b card.
- - a3c90x_internal_SetWindow - shifts between one of eight register
- - windows onboard the 3c90x. The bottom 16 bytes of the card's
- - I/O space are multiplexed among 128 bytes, only 16 of which are
- - visible at any one time. This SetWindow function selects one of
- - the eight sets.
- - a3c90x_internal_ReadEeprom - reads a word (16 bits) from the
- - card's onboard nvram. This is NOT the BIOS boot rom. This is
- - where the card stores such things as its hardware address.
- - a3c90x_internal_WriteEeprom - writes a word (16 bits) to the
- - card's nvram, and recomputes the eeprom checksum.
- - a3c90x_internal_WriteEepromWord - writes a word (16 bits) to the
- - card's nvram. Used by the above routine.
- - a3c90x_internal_WriteEepromWord - writes a word (16 bits) to the
- - card's nvram. Used by the above routine.
- -
- - D. Globals
- -
- - All global variables are inside a global structure named INF_3C90X.
- - So, wherever you see that structure referenced, you know the variable
- - is a global. Just keeps things a little neater.
- -
- - E. Enumerations
- -
- - There are quite a few enumerated type definitions for registers and
- - so forth, many for registers that I didn't even touch in the driver.
- - Register types start with 'reg', window numbers (for SetWindow)
- - start with 'win', and commands (for IssueCommand) start with 'cmd'.
- - Register offsets also include an indication in the name as to the
- - size of the register (_b = byte, _w = word, _l = long), and which
- - window the register is in, if it is windowed (0-7).
- -
- - F. Why the 'a3c90x' name?
- -
- - I had to come up with a letter at the beginning of all of the
- - identifiers, since 3com so conveniently had their name start with a
- - number. Another driver used 't' (for 'three'?); I chose 'a' for
- - no reason at all.
- -
- -Addendum by Jorge L. deLyra <delyra@latt.if.usp.br>, 22Nov2000 re
- -working around the 3C905 hardware bug mentioned above:
- -
- -Use this floppy to fix any 3COM model 3C905B PCI 10/100 Ethernet cards
- -that fail to load and run the boot program the first time around. If
- -they have a "Lucent" rather than a "Broadcom" chipset these cards have
- -a configuration bug that causes a hang when trying to load the boot
- -program from the PROM, if you try to use them right out of the box.
- -
- -The boot program in this floppy is the file named 3c905b-tpo100.rom
- -from Etherboot version 4.6.10, compiled with the bugfix parameter
- -
- - CFG_3C90X_BOOTROM_FIX
- -
- -You have to take the chip off the card and boot the system once using
- -this floppy. Once loaded from the floppy, the boot program will access
- -the card and change some setting in it, correcting the problem. After
- -that you may use either this boot program or the normal one, compiled
- -without this bugfix parameter, to boot the machine from the PROM chip.
- -
- -[Any recent Etherboot version should do, not just 4.6.10 - Ed.]
- diff -Naur grub-0.97.orig/netboot/Makefile.am grub-0.97/netboot/Makefile.am
- --- grub-0.97.orig/netboot/Makefile.am 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/Makefile.am 2005-08-31 19:03:35.000000000 +0000
- @@ -10,58 +10,72 @@
-
- noinst_LIBRARIES = $(LIBDRIVERS)
-
- -libdrivers_a_SOURCES = cards.h config.c etherboot.h \
- - fsys_tftp.c linux-asm-io.h linux-asm-string.h \
- - main.c misc.c nic.h osdep.h pci.c pci.h timer.c timer.h
- -EXTRA_libdrivers_a_SOURCES = 3c509.c 3c509.h 3c595.c 3c595.h 3c90x.c \
- - cs89x0.c cs89x0.h davicom.c depca.c eepro.c eepro100.c \
- - epic100.c epic100.h fa311.c i82586.c lance.c natsemi.c \
- - ni5010.c ns8390.c ns8390.h otulip.c otulip.h rtl8139.c \
- - sis900.c sis900.h sk_g16.c sk_g16.h smc9000.c smc9000.h \
- - tiara.c tlan.c tulip.c via-rhine.c w89c840.c
- +libdrivers_a_SOURCES = big_bswap.h bootp.h byteswap.h config.c cpu.h \
- + dev.h elf.h endian.h etherboot.h fsys_tftp.c grub.h \
- + i386_byteswap.h i386_elf.h i386_endian.h i386_timer.c \
- + if_arp.h if_ether.h igmp.h in.h io.h ip.h isa.h latch.h \
- + little_bswap.h misc.c nic.c nic.h osdep.h pci.c pci.h \
- + pci_ids.h pci_io.c stdint.h tftp.h timer.c timer.h \
- + types.h udp.h mii.h pic8259.c pic8259.h pxe.h basemem.c segoff.h
- +EXTRA_libdrivers_a_SOURCES = 3c595.c 3c595.h 3c90x.c davicom.c \
- + e1000.c e1000_hw.h eepro100.c epic100.c epic100.h natsemi.c \
- + ns8390.c ns8390.h pcnet32.c rtl8139.c sis900.c sis900.h \
- + sundance.c tg3.c tg3.h tlan.c tlan.h tulip.c via-rhine.c \
- + w89c840.c r8169.c forcedeth.c ns83820.c pnic.c pnic_api.c \
- + undi.c undi.h
- libdrivers_a_CFLAGS = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- -DFSYS_TFTP=1 $(NET_CFLAGS) $(NET_EXTRAFLAGS)
- # Filled by configure.
- libdrivers_a_LIBADD = @NETBOOT_DRIVERS@
- libdrivers_a_DEPENDENCIES = $(libdrivers_a_LIBADD)
-
- -EXTRA_DIST = README.netboot 3c90x.txt cs89x0.txt sis900.txt tulip.txt
- +EXTRA_DIST = README.netboot
-
- # These below are several special rules for the device drivers.
- # We cannot use a simple rule for them...
-
- # What objects are derived from a driver?
- -3c509_drivers = 3c509.o 3c529.o
- +#3c509_drivers = 3c509.o 3c529.o
- 3c595_drivers = 3c595.o
- 3c90x_drivers = 3c90x.o
- -cs89x0_drivers = cs89x0.o
- +#cs89x0_drivers = cs89x0.o
- davicom_drivers = davicom.o
- -depca_drivers = depca.o
- -eepro_drivers = eepro.o
- +#depca_drivers = depca.o
- +#eepro_drivers = eepro.o
- +e1000_drivers = e1000.o
- eepro100_drivers = eepro100.o
- epic100_drivers = epic100.o
- #fa311_drivers = fa311.o
- -i82586_drivers = 3c507.o exos205.o ni5210.o
- -lance_drivers = lance.o ne2100.o ni6510.o
- +forcedeth_drivers = forcedeth.o
- +#i82586_drivers = 3c507.o exos205.o ni5210.o
- +#lance_drivers = lance.o ne2100.o ni6510.o
- natsemi_drivers = natsemi.o
- -ni5010_drivers = ni5010.o
- +#ni5010_drivers = ni5010.o
- +ns83820_drivers = ns83820.o
- ns8390_drivers = 3c503.o ne.o ns8390.o wd.o
- -otulip_drivers = otulip.o
- +#otulip_drivers = otulip.o
- +pcnet32_drivers = pcnet32.o
- +pnic_drivers = pnic.o
- +r8169_drivers = r8169.o
- rtl8139_drivers = rtl8139.o
- sis900_drivers = sis900.o
- -sk_g16_drivers = sk_g16.o
- -smc9000_drivers = smc9000.o
- -tiara_drivers = tiara.o
- -#tlan_drivers = tlan.o
- +#sk_g16_drivers = sk_g16.o
- +sundance_driver = sundance.o
- +#smc9000_drivers = smc9000.o
- +tg3_drivers = tg3.o
- +#tiara_drivers = tiara.o
- +tlan_drivers = tlan.o
- tulip_drivers = tulip.o
- +undi_drivers = undi.o
- via_rhine_drivers = via_rhine.o
- w89c840_drivers = w89c840.o
-
- +
- # Is it really necessary to specify dependecies explicitly?
- -$(3c509_drivers): 3c509.c 3c509.h
- -$(3c509_drivers): %.o: 3c509.c
- - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +#$(3c509_drivers): 3c509.c 3c509.h
- +#$(3c509_drivers): %.o: 3c509.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- $(3c595_drivers): 3c595.c 3c595.h
- $(3c595_drivers): %.o: 3c595.c
- @@ -73,23 +87,28 @@
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(cs89x0_drivers): cs89x0.c cs89x0.h
- -$(cs89x0_drivers): %.o: cs89x0.c
- - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +#$(cs89x0_drivers): cs89x0.c cs89x0.h
- +#$(cs89x0_drivers): %.o: cs89x0.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- $(davicom_drivers): davicom.c
- $(davicom_drivers): %.o: davicom.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(depca_drivers): depca.c
- -$(depca_drivers): %.o: depca.c
- - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +#$(depca_drivers): depca.c
- +#$(depca_drivers): %.o: depca.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- +#$(eepro_drivers): eepro.c
- +#$(eepro_drivers): %.o: eepro.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(eepro_drivers): eepro.c
- -$(eepro_drivers): %.o: eepro.c
- +$(e1000_drivers): e1000.c e1000_hw.h
- +$(e1000_drivers): %.o: e1000.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- @@ -103,28 +122,38 @@
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- +$(forcedeth_drivers): forcedeth.c
- +$(forcedeth_drivers): %.o: forcedeth.c
- + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- #$(fa311_drivers): fa311.c
- #$(fa311_drivers): %.o: fa311.c
- # $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- # $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(i82586_drivers): i82586.c
- -$(i82586_drivers): %.o: i82586.c
- - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +#$(i82586_drivers): i82586.c
- +#$(i82586_drivers): %.o: i82586.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(lance_drivers): lance.c
- -$(lance_drivers): %.o: lance.c
- - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +#$(lance_drivers): lance.c
- +#$(lance_drivers): %.o: lance.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- $(natsemi_drivers): natsemi.c
- $(natsemi_drivers): %.o: natsemi.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(ni5010_drivers): ni5010.c
- -$(ni5010_drivers): %.o: ni5010.c
- +#$(ni5010_drivers): ni5010.c
- +#$(ni5010_drivers): %.o: ni5010.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- +$(ns83820_drivers): ns83820.c
- +$(ns83820_drivers): %.o: ns83820.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- @@ -133,8 +162,18 @@
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(otulip_drivers): otulip.c otulip.h
- -$(otulip_drivers): %.o: otulip.c
- +#$(otulip_drivers): otulip.c otulip.h
- +#$(otulip_drivers): %.o: otulip.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- +$(pcnet32_drivers): pcnet32.c
- +$(pcnet32_drivers): %.o: pcnet32.c
- + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- +$(pnic_drivers): pnic.c
- +$(pnic_drivers): %.o: pnic.c pnic_api.h
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- @@ -143,36 +182,56 @@
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(sis900_drivers): sis900.c
- -$(sis900_drivers): %.o: sis900.c sis900.h
- +$(r8169_drivers): r8169.c
- +$(r8169_drivers): %.o: r8169.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(sk_g16_drivers): sk_g16.c sk_g16.h
- -$(sk_g16_drivers): %.o: sk_g16.c
- +$(sis900_drivers): sis900.c sis900.h
- +$(sis900_drivers): %.o: sis900.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(smc9000_drivers): smc9000.c smc9000.h
- -$(smc9000_drivers): %.o: smc9000.c
- +#$(sk_g16_drivers): sk_g16.c sk_g16.h
- +#$(sk_g16_drivers): %.o: sk_g16.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- +#$(smc9000_drivers): smc9000.c smc9000.h
- +#$(smc9000_drivers): %.o: smc9000.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- +$(sundance_drivers): sundance.c
- +$(sundance_drivers): %.o: sundance.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(tiara_drivers): tiara.c
- -$(tiara_drivers): %.o: tiara.c
- +$(tg3_drivers): tg3.c tg3.h
- +$(tg3_drivers): %.o: tg3.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -#$(tlan_drivers): tlan.c
- -#$(tlan_drivers): %.o: tlan.c
- +#$(tiara_drivers): tiara.c
- +#$(tiara_drivers): %.o: tiara.c
- # $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- # $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- +$(tlan_drivers): tlan.c tlan.h
- +$(tlan_drivers): %.o: tlan.c
- + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- $(tulip_drivers): tulip.c
- $(tulip_drivers): %.o: tulip.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- +$(undi_drivers): undi.c undi.h
- +$(undi_drivers): %.o: undi.c
- + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- $(via_rhine_drivers): via-rhine.c
- $(via_rhine_drivers): %.o: via-rhine.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- @@ -184,36 +243,45 @@
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- # Per-object flags.
- -3c509_o_CFLAGS = -DINCLUDE_3C509=1
- -3c529_o_CFLAGS = -DINCLUDE_3C529=1
- +#3c509_o_CFLAGS = -DINCLUDE_3C509=1
- +#3c529_o_CFLAGS = -DINCLUDE_3C529=1
- 3c595_o_CFLAGS = -DINCLUDE_3C595=1
- 3c90x_o_CFLAGS = -DINCLUDE_3C90X=1
- -cs89x0_o_CFLAGS = -DINCLUDE_CS89X0=1
- +#cs89x0_o_CFLAGS = -DINCLUDE_CS89X0=1
- davicom_o_CFLAGS = -DINCLUDE_DAVICOM=1
- -depca_o_CFLAGS = -DINCLUDE_DEPCA=1
- -eepro_o_CFLAGS = -DINCLUDE_EEPRO=1
- +#depca_o_CFLAGS = -DINCLUDE_DEPCA=1
- +#eepro_o_CFLAGS = -DINCLUDE_EEPRO=1
- +e1000_o_CFLAGS = -DINCLUDE_E1000=1
- eepro100_o_CFLAGS = -DINCLUDE_EEPRO100=1
- epic100_o_CFLAGS = -DINCLUDE_EPIC100=1
- #fa311_o_CFLAGS = -DINCLUDE_FA311=1
- -3c507_o_CFLAGS = -DINCLUDE_3C507=1
- -exos205_o_CFLAGS = -DINCLUDE_EXOS205=1
- -ni5210_o_CFLAGS = -DINCLUDE_NI5210=1
- -lance_o_CFLAGS = -DINCLUDE_LANCE=1
- -ne2100_o_CFLAGS = -DINCLUDE_NE2100=1
- -ni6510_o_CFLAGS = -DINCLUDE_NI6510=1
- +forcedeth_o_CFLAGS = -DINCLUDE_FORCEDETH=1
- +#3c507_o_CFLAGS = -DINCLUDE_3C507=1
- +#exos205_o_CFLAGS = -DINCLUDE_EXOS205=1
- +#ni5210_o_CFLAGS = -DINCLUDE_NI5210=1
- +#lance_o_CFLAGS = -DINCLUDE_LANCE=1
- +#ne2100_o_CFLAGS = -DINCLUDE_NE2100=1
- +#ni6510_o_CFLAGS = -DINCLUDE_NI6510=1
- natsemi_o_CFLAGS = -DINCLUDE_NATSEMI=1
- -ni5010_o_CFLAGS = -DINCLUDE_NI5010=1
- -3c503_o_CFLAGS = -DINCLUDE_3C503=1
- -ne_o_CFLAGS = -DINCLUDE_NE=1
- +#ni5010_o_CFLAGS = -DINCLUDE_NI5010=1
- +#3c503_o_CFLAGS = -DINCLUDE_3C503=1
- +#ne_o_CFLAGS = -DINCLUDE_NE=1
- +ns83820_o_CFLAGS = -DINCLUDE_NS83820=1
- ns8390_o_CFLAGS = -DINCLUDE_NS8390=1
- -wd_o_CFLAGS = -DINCLUDE_WD=1
- -otulip_o_CFLAGS = -DINCLUDE_OTULIP=1
- +#wd_o_CFLAGS = -DINCLUDE_WD=1
- +#otulip_o_CFLAGS = -DINCLUDE_OTULIP=1
- +pcnet32_o_CFLAGS = -DINCLUDE_PCNET32=1
- +pnic_o_CFLAGS = -DINCLUDE_PNIC=1
- +r8169_o_CFLAGS = -DINCLUDE_R8169=1
- rtl8139_o_CFLAGS = -DINCLUDE_RTL8139=1
- sis900_o_CFLAGS = -DINCLUDE_SIS900=1
- -sk_g16_o_CFLAGS = -DINCLUDE_SK_G16=1
- -smc9000_o_CFLAGS = -DINCLUDE_SMC9000=1
- -tiara_o_CFLAGS = -DINCLUDE_TIARA=1
- -#tlan_o_CFLAGS = -DINCLUDE_TLAN=1
- +#sk_g16_o_CFLAGS = -DINCLUDE_SK_G16=1
- +#smc9000_o_CFLAGS = -DINCLUDE_SMC9000=1
- +sundance_o_CFLAGS = -DINCLUDE_SUNDANCE=1
- +#tiara_o_CFLAGS = -DINCLUDE_TIARA=1
- +tg3_o_CFLAGS = -DINCLUDE_TG3=1
- +tlan_o_CFLAGS = -DINCLUDE_TLAN=1
- tulip_o_CFLAGS = -DINCLUDE_TULIP=1
- +undi_o_CFLAGS = -DINCLUDE_UNDI=1
- via_rhine_o_CFLAGS = -DINCLUDE_VIA_RHINE=1
- w89c840_o_CFLAGS = -DINCLUDE_W89C840=1
- diff -Naur grub-0.97.orig/netboot/Makefile.in grub-0.97/netboot/Makefile.in
- --- grub-0.97.orig/netboot/Makefile.in 2005-05-08 02:42:35.000000000 +0000
- +++ grub-0.97/netboot/Makefile.in 2005-09-01 00:14:15.000000000 +0000
- @@ -48,18 +47,51 @@
- mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
- CONFIG_HEADER = $(top_builddir)/config.h
- CONFIG_CLEAN_FILES =
- -LIBRARIES = $(noinst_LIBRARIES)
- AR = ar
- ARFLAGS = cru
- +LIBRARIES = $(noinst_LIBRARIES)
- libdrivers_a_AR = $(AR) $(ARFLAGS)
- am_libdrivers_a_OBJECTS = libdrivers_a-config.$(OBJEXT) \
- - libdrivers_a-fsys_tftp.$(OBJEXT) libdrivers_a-main.$(OBJEXT) \
- - libdrivers_a-misc.$(OBJEXT) libdrivers_a-pci.$(OBJEXT) \
- - libdrivers_a-timer.$(OBJEXT)
- + libdrivers_a-fsys_tftp.$(OBJEXT) \
- + libdrivers_a-i386_timer.$(OBJEXT) libdrivers_a-misc.$(OBJEXT) \
- + libdrivers_a-nic.$(OBJEXT) libdrivers_a-pci.$(OBJEXT) \
- + libdrivers_a-pci_io.$(OBJEXT) libdrivers_a-timer.$(OBJEXT) \
- + libdrivers_a-pic8259.$(OBJEXT) libdrivers_a-basemem.$(OBJEXT)
- libdrivers_a_OBJECTS = $(am_libdrivers_a_OBJECTS)
- DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
- depcomp = $(SHELL) $(top_srcdir)/depcomp
- am__depfiles_maybe = depfiles
- +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/libdrivers_a-3c595.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-3c90x.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-basemem.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-config.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-davicom.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-e1000.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-eepro100.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-epic100.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-forcedeth.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-fsys_tftp.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-i386_timer.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-misc.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-natsemi.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-nic.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-ns83820.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-ns8390.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pci.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pci_io.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pcnet32.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pic8259.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pnic.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-pnic_api.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-r8169.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-rtl8139.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-sis900.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-tg3.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-timer.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-tlan.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-tulip.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-via-rhine.Po \
- +@AMDEP_TRUE@ ./$(DEPDIR)/libdrivers_a-w89c840.Po
- COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
- CCLD = $(CC)
- @@ -148,8 +180,6 @@
- am__include = @am__include@
- am__leading_dot = @am__leading_dot@
- am__quote = @am__quote@
- -am__tar = @am__tar@
- -am__untar = @am__untar@
- bindir = @bindir@
- build = @build@
- build_alias = @build_alias@
- @@ -186,16 +216,19 @@
- # Don't build the netboot support by default.
- @NETBOOT_SUPPORT_TRUE@LIBDRIVERS = libdrivers.a
- noinst_LIBRARIES = $(LIBDRIVERS)
- -libdrivers_a_SOURCES = cards.h config.c etherboot.h \
- - fsys_tftp.c linux-asm-io.h linux-asm-string.h \
- - main.c misc.c nic.h osdep.h pci.c pci.h timer.c timer.h
- -
- -EXTRA_libdrivers_a_SOURCES = 3c509.c 3c509.h 3c595.c 3c595.h 3c90x.c \
- - cs89x0.c cs89x0.h davicom.c depca.c eepro.c eepro100.c \
- - epic100.c epic100.h fa311.c i82586.c lance.c natsemi.c \
- - ni5010.c ns8390.c ns8390.h otulip.c otulip.h rtl8139.c \
- - sis900.c sis900.h sk_g16.c sk_g16.h smc9000.c smc9000.h \
- - tiara.c tlan.c tulip.c via-rhine.c w89c840.c
- +libdrivers_a_SOURCES = big_bswap.h bootp.h byteswap.h config.c cpu.h \
- + dev.h elf.h endian.h etherboot.h fsys_tftp.c grub.h \
- + i386_byteswap.h i386_elf.h i386_endian.h i386_timer.c \
- + if_arp.h if_ether.h igmp.h in.h io.h ip.h isa.h latch.h \
- + little_bswap.h misc.c nic.c nic.h osdep.h pci.c pci.h \
- + pci_ids.h pci_io.c stdint.h tftp.h timer.c timer.h \
- + types.h udp.h mii.h pic8259.c pic8259.h pxe.h basemem.c segoff.h
- +
- +EXTRA_libdrivers_a_SOURCES = 3c595.c 3c595.h 3c90x.c davicom.c \
- + e1000.c e1000_hw.h eepro100.c epic100.c epic100.h natsemi.c \
- + ns8390.c ns8390.h pcnet32.c rtl8139.c sis900.c sis900.h \
- + tg3.c tg3.h tlan.c tlan.h tulip.c via-rhine.c \
- + w89c840.c r8169.c forcedeth.c ns83820.c pnic.c pnic_api.c
-
- libdrivers_a_CFLAGS = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- -DFSYS_TFTP=1 $(NET_CFLAGS) $(NET_EXTRAFLAGS)
- @@ -203,69 +236,83 @@
- # Filled by configure.
- libdrivers_a_LIBADD = @NETBOOT_DRIVERS@
- libdrivers_a_DEPENDENCIES = $(libdrivers_a_LIBADD)
- -EXTRA_DIST = README.netboot 3c90x.txt cs89x0.txt sis900.txt tulip.txt
- +EXTRA_DIST = README.netboot
-
- # These below are several special rules for the device drivers.
- # We cannot use a simple rule for them...
-
- # What objects are derived from a driver?
- -3c509_drivers = 3c509.o 3c529.o
- +#3c509_drivers = 3c509.o 3c529.o
- 3c595_drivers = 3c595.o
- 3c90x_drivers = 3c90x.o
- -cs89x0_drivers = cs89x0.o
- +#cs89x0_drivers = cs89x0.o
- davicom_drivers = davicom.o
- -depca_drivers = depca.o
- -eepro_drivers = eepro.o
- +#depca_drivers = depca.o
- +#eepro_drivers = eepro.o
- +e1000_drivers = e1000.o
- eepro100_drivers = eepro100.o
- epic100_drivers = epic100.o
- #fa311_drivers = fa311.o
- -i82586_drivers = 3c507.o exos205.o ni5210.o
- -lance_drivers = lance.o ne2100.o ni6510.o
- +forcedeth_drivers = forcedeth.o
- +#i82586_drivers = 3c507.o exos205.o ni5210.o
- +#lance_drivers = lance.o ne2100.o ni6510.o
- natsemi_drivers = natsemi.o
- -ni5010_drivers = ni5010.o
- +#ni5010_drivers = ni5010.o
- +ns83820_drivers = ns83820.o
- ns8390_drivers = 3c503.o ne.o ns8390.o wd.o
- -otulip_drivers = otulip.o
- +#otulip_drivers = otulip.o
- +pcnet32_drivers = pcnet32.o
- +pnic_drivers = pnic.o
- +r8169_drivers = r8169.o
- rtl8139_drivers = rtl8139.o
- sis900_drivers = sis900.o
- -sk_g16_drivers = sk_g16.o
- -smc9000_drivers = smc9000.o
- -tiara_drivers = tiara.o
- -#tlan_drivers = tlan.o
- +#sk_g16_drivers = sk_g16.o
- +#smc9000_drivers = smc9000.o
- +tg3_drivers = tg3.o
- +#tiara_drivers = tiara.o
- +tlan_drivers = tlan.o
- tulip_drivers = tulip.o
- via_rhine_drivers = via_rhine.o
- w89c840_drivers = w89c840.o
-
- # Per-object flags.
- -3c509_o_CFLAGS = -DINCLUDE_3C509=1
- -3c529_o_CFLAGS = -DINCLUDE_3C529=1
- +#3c509_o_CFLAGS = -DINCLUDE_3C509=1
- +#3c529_o_CFLAGS = -DINCLUDE_3C529=1
- 3c595_o_CFLAGS = -DINCLUDE_3C595=1
- 3c90x_o_CFLAGS = -DINCLUDE_3C90X=1
- -cs89x0_o_CFLAGS = -DINCLUDE_CS89X0=1
- +#cs89x0_o_CFLAGS = -DINCLUDE_CS89X0=1
- davicom_o_CFLAGS = -DINCLUDE_DAVICOM=1
- -depca_o_CFLAGS = -DINCLUDE_DEPCA=1
- -eepro_o_CFLAGS = -DINCLUDE_EEPRO=1
- +#depca_o_CFLAGS = -DINCLUDE_DEPCA=1
- +#eepro_o_CFLAGS = -DINCLUDE_EEPRO=1
- +e1000_o_CFLAGS = -DINCLUDE_E1000=1
- eepro100_o_CFLAGS = -DINCLUDE_EEPRO100=1
- epic100_o_CFLAGS = -DINCLUDE_EPIC100=1
- #fa311_o_CFLAGS = -DINCLUDE_FA311=1
- -3c507_o_CFLAGS = -DINCLUDE_3C507=1
- -exos205_o_CFLAGS = -DINCLUDE_EXOS205=1
- -ni5210_o_CFLAGS = -DINCLUDE_NI5210=1
- -lance_o_CFLAGS = -DINCLUDE_LANCE=1
- -ne2100_o_CFLAGS = -DINCLUDE_NE2100=1
- -ni6510_o_CFLAGS = -DINCLUDE_NI6510=1
- +forcedeth_o_CFLAGS = -DINCLUDE_FORCEDETH=1
- +#3c507_o_CFLAGS = -DINCLUDE_3C507=1
- +#exos205_o_CFLAGS = -DINCLUDE_EXOS205=1
- +#ni5210_o_CFLAGS = -DINCLUDE_NI5210=1
- +#lance_o_CFLAGS = -DINCLUDE_LANCE=1
- +#ne2100_o_CFLAGS = -DINCLUDE_NE2100=1
- +#ni6510_o_CFLAGS = -DINCLUDE_NI6510=1
- natsemi_o_CFLAGS = -DINCLUDE_NATSEMI=1
- -ni5010_o_CFLAGS = -DINCLUDE_NI5010=1
- -3c503_o_CFLAGS = -DINCLUDE_3C503=1
- -ne_o_CFLAGS = -DINCLUDE_NE=1
- +#ni5010_o_CFLAGS = -DINCLUDE_NI5010=1
- +#3c503_o_CFLAGS = -DINCLUDE_3C503=1
- +#ne_o_CFLAGS = -DINCLUDE_NE=1
- +ns83820_o_CFLAGS = -DINCLUDE_NS83820=1
- ns8390_o_CFLAGS = -DINCLUDE_NS8390=1
- -wd_o_CFLAGS = -DINCLUDE_WD=1
- -otulip_o_CFLAGS = -DINCLUDE_OTULIP=1
- +#wd_o_CFLAGS = -DINCLUDE_WD=1
- +#otulip_o_CFLAGS = -DINCLUDE_OTULIP=1
- +pcnet32_o_CFLAGS = -DINCLUDE_PCNET32=1
- +pnic_o_CFLAGS = -DINCLUDE_PNIC=1
- +r8169_o_CFLAGS = -DINCLUDE_R8169=1
- rtl8139_o_CFLAGS = -DINCLUDE_RTL8139=1
- sis900_o_CFLAGS = -DINCLUDE_SIS900=1
- -sk_g16_o_CFLAGS = -DINCLUDE_SK_G16=1
- -smc9000_o_CFLAGS = -DINCLUDE_SMC9000=1
- -tiara_o_CFLAGS = -DINCLUDE_TIARA=1
- -#tlan_o_CFLAGS = -DINCLUDE_TLAN=1
- +#sk_g16_o_CFLAGS = -DINCLUDE_SK_G16=1
- +#smc9000_o_CFLAGS = -DINCLUDE_SMC9000=1
- +#tiara_o_CFLAGS = -DINCLUDE_TIARA=1
- +tg3_o_CFLAGS = -DINCLUDE_TG3=1
- +tlan_o_CFLAGS = -DINCLUDE_TLAN=1
- tulip_o_CFLAGS = -DINCLUDE_TULIP=1
- via_rhine_o_CFLAGS = -DINCLUDE_VIA_RHINE=1
- w89c840_o_CFLAGS = -DINCLUDE_W89C840=1
- @@ -316,32 +363,32 @@
- distclean-compile:
- -rm -f *.tab.c
-
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-3c509.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-3c595.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-3c90x.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-basemem.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-config.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-cs89x0.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-davicom.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-depca.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-eepro.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-e1000.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-eepro100.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-epic100.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-fa311.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-forcedeth.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-fsys_tftp.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-i82586.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-lance.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-main.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-i386_timer.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-misc.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-natsemi.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-ni5010.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-nic.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-ns83820.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-ns8390.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-otulip.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pci.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pci_io.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pcnet32.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pic8259.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pnic.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-pnic_api.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-r8169.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-rtl8139.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-sis900.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-sk_g16.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-smc9000.Po@am__quote@
- -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-tiara.Po@am__quote@
- +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-tg3.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-timer.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-tlan.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrivers_a-tulip.Po@am__quote@
- @@ -352,450 +399,513 @@
- @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(COMPILE) -c $<
-
- .c.obj:
- @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
- libdrivers_a-config.o: config.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-config.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-config.Tpo" -c -o libdrivers_a-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-config.Tpo" "$(DEPDIR)/libdrivers_a-config.Po"; else rm -f "$(DEPDIR)/libdrivers_a-config.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='libdrivers_a-config.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-config.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-config.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c
-
- libdrivers_a-config.obj: config.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-config.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-config.Tpo" -c -o libdrivers_a-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-config.Tpo" "$(DEPDIR)/libdrivers_a-config.Po"; else rm -f "$(DEPDIR)/libdrivers_a-config.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='libdrivers_a-config.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-config.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-config.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi`
-
- libdrivers_a-fsys_tftp.o: fsys_tftp.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-fsys_tftp.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" -c -o libdrivers_a-fsys_tftp.o `test -f 'fsys_tftp.c' || echo '$(srcdir)/'`fsys_tftp.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" "$(DEPDIR)/libdrivers_a-fsys_tftp.Po"; else rm -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_tftp.c' object='libdrivers_a-fsys_tftp.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-fsys_tftp.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-fsys_tftp.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-fsys_tftp.o `test -f 'fsys_tftp.c' || echo '$(srcdir)/'`fsys_tftp.c
-
- libdrivers_a-fsys_tftp.obj: fsys_tftp.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-fsys_tftp.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" -c -o libdrivers_a-fsys_tftp.obj `if test -f 'fsys_tftp.c'; then $(CYGPATH_W) 'fsys_tftp.c'; else $(CYGPATH_W) '$(srcdir)/fsys_tftp.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo" "$(DEPDIR)/libdrivers_a-fsys_tftp.Po"; else rm -f "$(DEPDIR)/libdrivers_a-fsys_tftp.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fsys_tftp.c' object='libdrivers_a-fsys_tftp.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-fsys_tftp.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-fsys_tftp.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-fsys_tftp.obj `if test -f 'fsys_tftp.c'; then $(CYGPATH_W) 'fsys_tftp.c'; else $(CYGPATH_W) '$(srcdir)/fsys_tftp.c'; fi`
-
- -libdrivers_a-main.o: main.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-main.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-main.Tpo" -c -o libdrivers_a-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-main.Tpo" "$(DEPDIR)/libdrivers_a-main.Po"; else rm -f "$(DEPDIR)/libdrivers_a-main.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='libdrivers_a-main.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
- -
- -libdrivers_a-main.obj: main.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-main.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-main.Tpo" -c -o libdrivers_a-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-main.Tpo" "$(DEPDIR)/libdrivers_a-main.Po"; else rm -f "$(DEPDIR)/libdrivers_a-main.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='libdrivers_a-main.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
- +libdrivers_a-i386_timer.o: i386_timer.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-i386_timer.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-i386_timer.Tpo" -c -o libdrivers_a-i386_timer.o `test -f 'i386_timer.c' || echo '$(srcdir)/'`i386_timer.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-i386_timer.Tpo" "$(DEPDIR)/libdrivers_a-i386_timer.Po"; else rm -f "$(DEPDIR)/libdrivers_a-i386_timer.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i386_timer.c' object='libdrivers_a-i386_timer.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-i386_timer.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-i386_timer.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-i386_timer.o `test -f 'i386_timer.c' || echo '$(srcdir)/'`i386_timer.c
- +
- +libdrivers_a-i386_timer.obj: i386_timer.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-i386_timer.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-i386_timer.Tpo" -c -o libdrivers_a-i386_timer.obj `if test -f 'i386_timer.c'; then $(CYGPATH_W) 'i386_timer.c'; else $(CYGPATH_W) '$(srcdir)/i386_timer.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-i386_timer.Tpo" "$(DEPDIR)/libdrivers_a-i386_timer.Po"; else rm -f "$(DEPDIR)/libdrivers_a-i386_timer.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i386_timer.c' object='libdrivers_a-i386_timer.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-i386_timer.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-i386_timer.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-i386_timer.obj `if test -f 'i386_timer.c'; then $(CYGPATH_W) 'i386_timer.c'; else $(CYGPATH_W) '$(srcdir)/i386_timer.c'; fi`
-
- libdrivers_a-misc.o: misc.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-misc.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-misc.Tpo" -c -o libdrivers_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-misc.Tpo" "$(DEPDIR)/libdrivers_a-misc.Po"; else rm -f "$(DEPDIR)/libdrivers_a-misc.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libdrivers_a-misc.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-misc.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-misc.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-misc.o `test -f 'misc.c' || echo '$(srcdir)/'`misc.c
-
- libdrivers_a-misc.obj: misc.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-misc.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-misc.Tpo" -c -o libdrivers_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-misc.Tpo" "$(DEPDIR)/libdrivers_a-misc.Po"; else rm -f "$(DEPDIR)/libdrivers_a-misc.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libdrivers_a-misc.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-misc.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-misc.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-misc.obj `if test -f 'misc.c'; then $(CYGPATH_W) 'misc.c'; else $(CYGPATH_W) '$(srcdir)/misc.c'; fi`
-
- +libdrivers_a-nic.o: nic.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-nic.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-nic.Tpo" -c -o libdrivers_a-nic.o `test -f 'nic.c' || echo '$(srcdir)/'`nic.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-nic.Tpo" "$(DEPDIR)/libdrivers_a-nic.Po"; else rm -f "$(DEPDIR)/libdrivers_a-nic.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nic.c' object='libdrivers_a-nic.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-nic.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-nic.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-nic.o `test -f 'nic.c' || echo '$(srcdir)/'`nic.c
- +
- +libdrivers_a-nic.obj: nic.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-nic.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-nic.Tpo" -c -o libdrivers_a-nic.obj `if test -f 'nic.c'; then $(CYGPATH_W) 'nic.c'; else $(CYGPATH_W) '$(srcdir)/nic.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-nic.Tpo" "$(DEPDIR)/libdrivers_a-nic.Po"; else rm -f "$(DEPDIR)/libdrivers_a-nic.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nic.c' object='libdrivers_a-nic.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-nic.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-nic.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-nic.obj `if test -f 'nic.c'; then $(CYGPATH_W) 'nic.c'; else $(CYGPATH_W) '$(srcdir)/nic.c'; fi`
- +
- libdrivers_a-pci.o: pci.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pci.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pci.Tpo" -c -o libdrivers_a-pci.o `test -f 'pci.c' || echo '$(srcdir)/'`pci.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pci.Tpo" "$(DEPDIR)/libdrivers_a-pci.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pci.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci.c' object='libdrivers_a-pci.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pci.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pci.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pci.o `test -f 'pci.c' || echo '$(srcdir)/'`pci.c
-
- libdrivers_a-pci.obj: pci.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pci.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pci.Tpo" -c -o libdrivers_a-pci.obj `if test -f 'pci.c'; then $(CYGPATH_W) 'pci.c'; else $(CYGPATH_W) '$(srcdir)/pci.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pci.Tpo" "$(DEPDIR)/libdrivers_a-pci.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pci.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci.c' object='libdrivers_a-pci.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pci.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pci.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pci.obj `if test -f 'pci.c'; then $(CYGPATH_W) 'pci.c'; else $(CYGPATH_W) '$(srcdir)/pci.c'; fi`
-
- +libdrivers_a-pci_io.o: pci_io.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pci_io.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pci_io.Tpo" -c -o libdrivers_a-pci_io.o `test -f 'pci_io.c' || echo '$(srcdir)/'`pci_io.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pci_io.Tpo" "$(DEPDIR)/libdrivers_a-pci_io.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pci_io.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci_io.c' object='libdrivers_a-pci_io.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pci_io.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pci_io.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pci_io.o `test -f 'pci_io.c' || echo '$(srcdir)/'`pci_io.c
- +
- +libdrivers_a-pci_io.obj: pci_io.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pci_io.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pci_io.Tpo" -c -o libdrivers_a-pci_io.obj `if test -f 'pci_io.c'; then $(CYGPATH_W) 'pci_io.c'; else $(CYGPATH_W) '$(srcdir)/pci_io.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pci_io.Tpo" "$(DEPDIR)/libdrivers_a-pci_io.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pci_io.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci_io.c' object='libdrivers_a-pci_io.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pci_io.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pci_io.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pci_io.obj `if test -f 'pci_io.c'; then $(CYGPATH_W) 'pci_io.c'; else $(CYGPATH_W) '$(srcdir)/pci_io.c'; fi`
- +
- libdrivers_a-timer.o: timer.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-timer.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-timer.Tpo" -c -o libdrivers_a-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-timer.Tpo" "$(DEPDIR)/libdrivers_a-timer.Po"; else rm -f "$(DEPDIR)/libdrivers_a-timer.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='timer.c' object='libdrivers_a-timer.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-timer.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-timer.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c
-
- libdrivers_a-timer.obj: timer.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-timer.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-timer.Tpo" -c -o libdrivers_a-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-timer.Tpo" "$(DEPDIR)/libdrivers_a-timer.Po"; else rm -f "$(DEPDIR)/libdrivers_a-timer.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='timer.c' object='libdrivers_a-timer.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-timer.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-timer.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi`
-
- -libdrivers_a-3c509.o: 3c509.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c509.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c509.Tpo" -c -o libdrivers_a-3c509.o `test -f '3c509.c' || echo '$(srcdir)/'`3c509.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c509.Tpo" "$(DEPDIR)/libdrivers_a-3c509.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c509.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c509.c' object='libdrivers_a-3c509.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c509.o `test -f '3c509.c' || echo '$(srcdir)/'`3c509.c
- -
- -libdrivers_a-3c509.obj: 3c509.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c509.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c509.Tpo" -c -o libdrivers_a-3c509.obj `if test -f '3c509.c'; then $(CYGPATH_W) '3c509.c'; else $(CYGPATH_W) '$(srcdir)/3c509.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c509.Tpo" "$(DEPDIR)/libdrivers_a-3c509.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c509.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c509.c' object='libdrivers_a-3c509.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c509.obj `if test -f '3c509.c'; then $(CYGPATH_W) '3c509.c'; else $(CYGPATH_W) '$(srcdir)/3c509.c'; fi`
- +libdrivers_a-pic8259.o: pic8259.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pic8259.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pic8259.Tpo" -c -o libdrivers_a-pic8259.o `test -f 'pic8259.c' || echo '$(srcdir)/'`pic8259.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pic8259.Tpo" "$(DEPDIR)/libdrivers_a-pic8259.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pic8259.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pic8259.c' object='libdrivers_a-pic8259.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pic8259.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pic8259.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pic8259.o `test -f 'pic8259.c' || echo '$(srcdir)/'`pic8259.c
- +
- +libdrivers_a-pic8259.obj: pic8259.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pic8259.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pic8259.Tpo" -c -o libdrivers_a-pic8259.obj `if test -f 'pic8259.c'; then $(CYGPATH_W) 'pic8259.c'; else $(CYGPATH_W) '$(srcdir)/pic8259.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pic8259.Tpo" "$(DEPDIR)/libdrivers_a-pic8259.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pic8259.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pic8259.c' object='libdrivers_a-pic8259.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pic8259.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pic8259.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pic8259.obj `if test -f 'pic8259.c'; then $(CYGPATH_W) 'pic8259.c'; else $(CYGPATH_W) '$(srcdir)/pic8259.c'; fi`
- +
- +libdrivers_a-basemem.o: basemem.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-basemem.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-basemem.Tpo" -c -o libdrivers_a-basemem.o `test -f 'basemem.c' || echo '$(srcdir)/'`basemem.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-basemem.Tpo" "$(DEPDIR)/libdrivers_a-basemem.Po"; else rm -f "$(DEPDIR)/libdrivers_a-basemem.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='basemem.c' object='libdrivers_a-basemem.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-basemem.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-basemem.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-basemem.o `test -f 'basemem.c' || echo '$(srcdir)/'`basemem.c
- +
- +libdrivers_a-basemem.obj: basemem.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-basemem.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-basemem.Tpo" -c -o libdrivers_a-basemem.obj `if test -f 'basemem.c'; then $(CYGPATH_W) 'basemem.c'; else $(CYGPATH_W) '$(srcdir)/basemem.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-basemem.Tpo" "$(DEPDIR)/libdrivers_a-basemem.Po"; else rm -f "$(DEPDIR)/libdrivers_a-basemem.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='basemem.c' object='libdrivers_a-basemem.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-basemem.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-basemem.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-basemem.obj `if test -f 'basemem.c'; then $(CYGPATH_W) 'basemem.c'; else $(CYGPATH_W) '$(srcdir)/basemem.c'; fi`
-
- libdrivers_a-3c595.o: 3c595.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c595.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c595.Tpo" -c -o libdrivers_a-3c595.o `test -f '3c595.c' || echo '$(srcdir)/'`3c595.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c595.Tpo" "$(DEPDIR)/libdrivers_a-3c595.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c595.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c595.c' object='libdrivers_a-3c595.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-3c595.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-3c595.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c595.o `test -f '3c595.c' || echo '$(srcdir)/'`3c595.c
-
- libdrivers_a-3c595.obj: 3c595.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c595.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c595.Tpo" -c -o libdrivers_a-3c595.obj `if test -f '3c595.c'; then $(CYGPATH_W) '3c595.c'; else $(CYGPATH_W) '$(srcdir)/3c595.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c595.Tpo" "$(DEPDIR)/libdrivers_a-3c595.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c595.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c595.c' object='libdrivers_a-3c595.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-3c595.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-3c595.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c595.obj `if test -f '3c595.c'; then $(CYGPATH_W) '3c595.c'; else $(CYGPATH_W) '$(srcdir)/3c595.c'; fi`
-
- libdrivers_a-3c90x.o: 3c90x.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c90x.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c90x.Tpo" -c -o libdrivers_a-3c90x.o `test -f '3c90x.c' || echo '$(srcdir)/'`3c90x.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo" "$(DEPDIR)/libdrivers_a-3c90x.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c90x.c' object='libdrivers_a-3c90x.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-3c90x.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-3c90x.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c90x.o `test -f '3c90x.c' || echo '$(srcdir)/'`3c90x.c
-
- libdrivers_a-3c90x.obj: 3c90x.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-3c90x.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-3c90x.Tpo" -c -o libdrivers_a-3c90x.obj `if test -f '3c90x.c'; then $(CYGPATH_W) '3c90x.c'; else $(CYGPATH_W) '$(srcdir)/3c90x.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo" "$(DEPDIR)/libdrivers_a-3c90x.Po"; else rm -f "$(DEPDIR)/libdrivers_a-3c90x.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='3c90x.c' object='libdrivers_a-3c90x.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-3c90x.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-3c90x.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-3c90x.obj `if test -f '3c90x.c'; then $(CYGPATH_W) '3c90x.c'; else $(CYGPATH_W) '$(srcdir)/3c90x.c'; fi`
-
- -libdrivers_a-cs89x0.o: cs89x0.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-cs89x0.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-cs89x0.Tpo" -c -o libdrivers_a-cs89x0.o `test -f 'cs89x0.c' || echo '$(srcdir)/'`cs89x0.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-cs89x0.Tpo" "$(DEPDIR)/libdrivers_a-cs89x0.Po"; else rm -f "$(DEPDIR)/libdrivers_a-cs89x0.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cs89x0.c' object='libdrivers_a-cs89x0.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-cs89x0.o `test -f 'cs89x0.c' || echo '$(srcdir)/'`cs89x0.c
- -
- -libdrivers_a-cs89x0.obj: cs89x0.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-cs89x0.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-cs89x0.Tpo" -c -o libdrivers_a-cs89x0.obj `if test -f 'cs89x0.c'; then $(CYGPATH_W) 'cs89x0.c'; else $(CYGPATH_W) '$(srcdir)/cs89x0.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-cs89x0.Tpo" "$(DEPDIR)/libdrivers_a-cs89x0.Po"; else rm -f "$(DEPDIR)/libdrivers_a-cs89x0.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cs89x0.c' object='libdrivers_a-cs89x0.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-cs89x0.obj `if test -f 'cs89x0.c'; then $(CYGPATH_W) 'cs89x0.c'; else $(CYGPATH_W) '$(srcdir)/cs89x0.c'; fi`
- -
- libdrivers_a-davicom.o: davicom.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-davicom.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-davicom.Tpo" -c -o libdrivers_a-davicom.o `test -f 'davicom.c' || echo '$(srcdir)/'`davicom.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-davicom.Tpo" "$(DEPDIR)/libdrivers_a-davicom.Po"; else rm -f "$(DEPDIR)/libdrivers_a-davicom.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='davicom.c' object='libdrivers_a-davicom.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-davicom.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-davicom.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-davicom.o `test -f 'davicom.c' || echo '$(srcdir)/'`davicom.c
-
- libdrivers_a-davicom.obj: davicom.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-davicom.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-davicom.Tpo" -c -o libdrivers_a-davicom.obj `if test -f 'davicom.c'; then $(CYGPATH_W) 'davicom.c'; else $(CYGPATH_W) '$(srcdir)/davicom.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-davicom.Tpo" "$(DEPDIR)/libdrivers_a-davicom.Po"; else rm -f "$(DEPDIR)/libdrivers_a-davicom.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='davicom.c' object='libdrivers_a-davicom.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-davicom.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-davicom.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-davicom.obj `if test -f 'davicom.c'; then $(CYGPATH_W) 'davicom.c'; else $(CYGPATH_W) '$(srcdir)/davicom.c'; fi`
-
- -libdrivers_a-depca.o: depca.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-depca.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-depca.Tpo" -c -o libdrivers_a-depca.o `test -f 'depca.c' || echo '$(srcdir)/'`depca.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-depca.Tpo" "$(DEPDIR)/libdrivers_a-depca.Po"; else rm -f "$(DEPDIR)/libdrivers_a-depca.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='depca.c' object='libdrivers_a-depca.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-depca.o `test -f 'depca.c' || echo '$(srcdir)/'`depca.c
- -
- -libdrivers_a-depca.obj: depca.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-depca.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-depca.Tpo" -c -o libdrivers_a-depca.obj `if test -f 'depca.c'; then $(CYGPATH_W) 'depca.c'; else $(CYGPATH_W) '$(srcdir)/depca.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-depca.Tpo" "$(DEPDIR)/libdrivers_a-depca.Po"; else rm -f "$(DEPDIR)/libdrivers_a-depca.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='depca.c' object='libdrivers_a-depca.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-depca.obj `if test -f 'depca.c'; then $(CYGPATH_W) 'depca.c'; else $(CYGPATH_W) '$(srcdir)/depca.c'; fi`
- -
- -libdrivers_a-eepro.o: eepro.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-eepro.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-eepro.Tpo" -c -o libdrivers_a-eepro.o `test -f 'eepro.c' || echo '$(srcdir)/'`eepro.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-eepro.Tpo" "$(DEPDIR)/libdrivers_a-eepro.Po"; else rm -f "$(DEPDIR)/libdrivers_a-eepro.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eepro.c' object='libdrivers_a-eepro.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-eepro.o `test -f 'eepro.c' || echo '$(srcdir)/'`eepro.c
- -
- -libdrivers_a-eepro.obj: eepro.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-eepro.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-eepro.Tpo" -c -o libdrivers_a-eepro.obj `if test -f 'eepro.c'; then $(CYGPATH_W) 'eepro.c'; else $(CYGPATH_W) '$(srcdir)/eepro.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-eepro.Tpo" "$(DEPDIR)/libdrivers_a-eepro.Po"; else rm -f "$(DEPDIR)/libdrivers_a-eepro.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eepro.c' object='libdrivers_a-eepro.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-eepro.obj `if test -f 'eepro.c'; then $(CYGPATH_W) 'eepro.c'; else $(CYGPATH_W) '$(srcdir)/eepro.c'; fi`
- +libdrivers_a-e1000.o: e1000.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-e1000.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-e1000.Tpo" -c -o libdrivers_a-e1000.o `test -f 'e1000.c' || echo '$(srcdir)/'`e1000.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-e1000.Tpo" "$(DEPDIR)/libdrivers_a-e1000.Po"; else rm -f "$(DEPDIR)/libdrivers_a-e1000.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='e1000.c' object='libdrivers_a-e1000.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-e1000.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-e1000.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-e1000.o `test -f 'e1000.c' || echo '$(srcdir)/'`e1000.c
- +
- +libdrivers_a-e1000.obj: e1000.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-e1000.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-e1000.Tpo" -c -o libdrivers_a-e1000.obj `if test -f 'e1000.c'; then $(CYGPATH_W) 'e1000.c'; else $(CYGPATH_W) '$(srcdir)/e1000.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-e1000.Tpo" "$(DEPDIR)/libdrivers_a-e1000.Po"; else rm -f "$(DEPDIR)/libdrivers_a-e1000.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='e1000.c' object='libdrivers_a-e1000.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-e1000.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-e1000.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-e1000.obj `if test -f 'e1000.c'; then $(CYGPATH_W) 'e1000.c'; else $(CYGPATH_W) '$(srcdir)/e1000.c'; fi`
-
- libdrivers_a-eepro100.o: eepro100.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-eepro100.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-eepro100.Tpo" -c -o libdrivers_a-eepro100.o `test -f 'eepro100.c' || echo '$(srcdir)/'`eepro100.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo" "$(DEPDIR)/libdrivers_a-eepro100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eepro100.c' object='libdrivers_a-eepro100.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-eepro100.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-eepro100.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-eepro100.o `test -f 'eepro100.c' || echo '$(srcdir)/'`eepro100.c
-
- libdrivers_a-eepro100.obj: eepro100.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-eepro100.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-eepro100.Tpo" -c -o libdrivers_a-eepro100.obj `if test -f 'eepro100.c'; then $(CYGPATH_W) 'eepro100.c'; else $(CYGPATH_W) '$(srcdir)/eepro100.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo" "$(DEPDIR)/libdrivers_a-eepro100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-eepro100.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='eepro100.c' object='libdrivers_a-eepro100.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-eepro100.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-eepro100.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-eepro100.obj `if test -f 'eepro100.c'; then $(CYGPATH_W) 'eepro100.c'; else $(CYGPATH_W) '$(srcdir)/eepro100.c'; fi`
-
- libdrivers_a-epic100.o: epic100.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-epic100.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-epic100.Tpo" -c -o libdrivers_a-epic100.o `test -f 'epic100.c' || echo '$(srcdir)/'`epic100.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-epic100.Tpo" "$(DEPDIR)/libdrivers_a-epic100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-epic100.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='epic100.c' object='libdrivers_a-epic100.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-epic100.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-epic100.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-epic100.o `test -f 'epic100.c' || echo '$(srcdir)/'`epic100.c
-
- libdrivers_a-epic100.obj: epic100.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-epic100.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-epic100.Tpo" -c -o libdrivers_a-epic100.obj `if test -f 'epic100.c'; then $(CYGPATH_W) 'epic100.c'; else $(CYGPATH_W) '$(srcdir)/epic100.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-epic100.Tpo" "$(DEPDIR)/libdrivers_a-epic100.Po"; else rm -f "$(DEPDIR)/libdrivers_a-epic100.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='epic100.c' object='libdrivers_a-epic100.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-epic100.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-epic100.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-epic100.obj `if test -f 'epic100.c'; then $(CYGPATH_W) 'epic100.c'; else $(CYGPATH_W) '$(srcdir)/epic100.c'; fi`
-
- -libdrivers_a-fa311.o: fa311.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-fa311.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-fa311.Tpo" -c -o libdrivers_a-fa311.o `test -f 'fa311.c' || echo '$(srcdir)/'`fa311.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-fa311.Tpo" "$(DEPDIR)/libdrivers_a-fa311.Po"; else rm -f "$(DEPDIR)/libdrivers_a-fa311.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fa311.c' object='libdrivers_a-fa311.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-fa311.o `test -f 'fa311.c' || echo '$(srcdir)/'`fa311.c
- -
- -libdrivers_a-fa311.obj: fa311.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-fa311.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-fa311.Tpo" -c -o libdrivers_a-fa311.obj `if test -f 'fa311.c'; then $(CYGPATH_W) 'fa311.c'; else $(CYGPATH_W) '$(srcdir)/fa311.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-fa311.Tpo" "$(DEPDIR)/libdrivers_a-fa311.Po"; else rm -f "$(DEPDIR)/libdrivers_a-fa311.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fa311.c' object='libdrivers_a-fa311.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-fa311.obj `if test -f 'fa311.c'; then $(CYGPATH_W) 'fa311.c'; else $(CYGPATH_W) '$(srcdir)/fa311.c'; fi`
- -
- -libdrivers_a-i82586.o: i82586.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-i82586.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-i82586.Tpo" -c -o libdrivers_a-i82586.o `test -f 'i82586.c' || echo '$(srcdir)/'`i82586.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-i82586.Tpo" "$(DEPDIR)/libdrivers_a-i82586.Po"; else rm -f "$(DEPDIR)/libdrivers_a-i82586.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i82586.c' object='libdrivers_a-i82586.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-i82586.o `test -f 'i82586.c' || echo '$(srcdir)/'`i82586.c
- -
- -libdrivers_a-i82586.obj: i82586.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-i82586.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-i82586.Tpo" -c -o libdrivers_a-i82586.obj `if test -f 'i82586.c'; then $(CYGPATH_W) 'i82586.c'; else $(CYGPATH_W) '$(srcdir)/i82586.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-i82586.Tpo" "$(DEPDIR)/libdrivers_a-i82586.Po"; else rm -f "$(DEPDIR)/libdrivers_a-i82586.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i82586.c' object='libdrivers_a-i82586.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-i82586.obj `if test -f 'i82586.c'; then $(CYGPATH_W) 'i82586.c'; else $(CYGPATH_W) '$(srcdir)/i82586.c'; fi`
- -
- -libdrivers_a-lance.o: lance.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-lance.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-lance.Tpo" -c -o libdrivers_a-lance.o `test -f 'lance.c' || echo '$(srcdir)/'`lance.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-lance.Tpo" "$(DEPDIR)/libdrivers_a-lance.Po"; else rm -f "$(DEPDIR)/libdrivers_a-lance.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lance.c' object='libdrivers_a-lance.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-lance.o `test -f 'lance.c' || echo '$(srcdir)/'`lance.c
- -
- -libdrivers_a-lance.obj: lance.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-lance.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-lance.Tpo" -c -o libdrivers_a-lance.obj `if test -f 'lance.c'; then $(CYGPATH_W) 'lance.c'; else $(CYGPATH_W) '$(srcdir)/lance.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-lance.Tpo" "$(DEPDIR)/libdrivers_a-lance.Po"; else rm -f "$(DEPDIR)/libdrivers_a-lance.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lance.c' object='libdrivers_a-lance.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-lance.obj `if test -f 'lance.c'; then $(CYGPATH_W) 'lance.c'; else $(CYGPATH_W) '$(srcdir)/lance.c'; fi`
- -
- libdrivers_a-natsemi.o: natsemi.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-natsemi.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-natsemi.Tpo" -c -o libdrivers_a-natsemi.o `test -f 'natsemi.c' || echo '$(srcdir)/'`natsemi.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo" "$(DEPDIR)/libdrivers_a-natsemi.Po"; else rm -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='natsemi.c' object='libdrivers_a-natsemi.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-natsemi.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-natsemi.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-natsemi.o `test -f 'natsemi.c' || echo '$(srcdir)/'`natsemi.c
-
- libdrivers_a-natsemi.obj: natsemi.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-natsemi.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-natsemi.Tpo" -c -o libdrivers_a-natsemi.obj `if test -f 'natsemi.c'; then $(CYGPATH_W) 'natsemi.c'; else $(CYGPATH_W) '$(srcdir)/natsemi.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo" "$(DEPDIR)/libdrivers_a-natsemi.Po"; else rm -f "$(DEPDIR)/libdrivers_a-natsemi.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='natsemi.c' object='libdrivers_a-natsemi.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-natsemi.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-natsemi.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-natsemi.obj `if test -f 'natsemi.c'; then $(CYGPATH_W) 'natsemi.c'; else $(CYGPATH_W) '$(srcdir)/natsemi.c'; fi`
-
- -libdrivers_a-ni5010.o: ni5010.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ni5010.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-ni5010.Tpo" -c -o libdrivers_a-ni5010.o `test -f 'ni5010.c' || echo '$(srcdir)/'`ni5010.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ni5010.Tpo" "$(DEPDIR)/libdrivers_a-ni5010.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ni5010.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ni5010.c' object='libdrivers_a-ni5010.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ni5010.o `test -f 'ni5010.c' || echo '$(srcdir)/'`ni5010.c
- -
- -libdrivers_a-ni5010.obj: ni5010.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ni5010.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-ni5010.Tpo" -c -o libdrivers_a-ni5010.obj `if test -f 'ni5010.c'; then $(CYGPATH_W) 'ni5010.c'; else $(CYGPATH_W) '$(srcdir)/ni5010.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ni5010.Tpo" "$(DEPDIR)/libdrivers_a-ni5010.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ni5010.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ni5010.c' object='libdrivers_a-ni5010.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ni5010.obj `if test -f 'ni5010.c'; then $(CYGPATH_W) 'ni5010.c'; else $(CYGPATH_W) '$(srcdir)/ni5010.c'; fi`
- -
- libdrivers_a-ns8390.o: ns8390.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ns8390.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-ns8390.Tpo" -c -o libdrivers_a-ns8390.o `test -f 'ns8390.c' || echo '$(srcdir)/'`ns8390.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo" "$(DEPDIR)/libdrivers_a-ns8390.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ns8390.c' object='libdrivers_a-ns8390.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-ns8390.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-ns8390.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ns8390.o `test -f 'ns8390.c' || echo '$(srcdir)/'`ns8390.c
-
- libdrivers_a-ns8390.obj: ns8390.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ns8390.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-ns8390.Tpo" -c -o libdrivers_a-ns8390.obj `if test -f 'ns8390.c'; then $(CYGPATH_W) 'ns8390.c'; else $(CYGPATH_W) '$(srcdir)/ns8390.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo" "$(DEPDIR)/libdrivers_a-ns8390.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ns8390.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ns8390.c' object='libdrivers_a-ns8390.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-ns8390.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-ns8390.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ns8390.obj `if test -f 'ns8390.c'; then $(CYGPATH_W) 'ns8390.c'; else $(CYGPATH_W) '$(srcdir)/ns8390.c'; fi`
-
- -libdrivers_a-otulip.o: otulip.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-otulip.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-otulip.Tpo" -c -o libdrivers_a-otulip.o `test -f 'otulip.c' || echo '$(srcdir)/'`otulip.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-otulip.Tpo" "$(DEPDIR)/libdrivers_a-otulip.Po"; else rm -f "$(DEPDIR)/libdrivers_a-otulip.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='otulip.c' object='libdrivers_a-otulip.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-otulip.o `test -f 'otulip.c' || echo '$(srcdir)/'`otulip.c
- -
- -libdrivers_a-otulip.obj: otulip.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-otulip.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-otulip.Tpo" -c -o libdrivers_a-otulip.obj `if test -f 'otulip.c'; then $(CYGPATH_W) 'otulip.c'; else $(CYGPATH_W) '$(srcdir)/otulip.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-otulip.Tpo" "$(DEPDIR)/libdrivers_a-otulip.Po"; else rm -f "$(DEPDIR)/libdrivers_a-otulip.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='otulip.c' object='libdrivers_a-otulip.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-otulip.obj `if test -f 'otulip.c'; then $(CYGPATH_W) 'otulip.c'; else $(CYGPATH_W) '$(srcdir)/otulip.c'; fi`
- +libdrivers_a-pcnet32.o: pcnet32.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pcnet32.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pcnet32.Tpo" -c -o libdrivers_a-pcnet32.o `test -f 'pcnet32.c' || echo '$(srcdir)/'`pcnet32.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pcnet32.Tpo" "$(DEPDIR)/libdrivers_a-pcnet32.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pcnet32.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pcnet32.c' object='libdrivers_a-pcnet32.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pcnet32.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pcnet32.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pcnet32.o `test -f 'pcnet32.c' || echo '$(srcdir)/'`pcnet32.c
- +
- +libdrivers_a-pcnet32.obj: pcnet32.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pcnet32.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pcnet32.Tpo" -c -o libdrivers_a-pcnet32.obj `if test -f 'pcnet32.c'; then $(CYGPATH_W) 'pcnet32.c'; else $(CYGPATH_W) '$(srcdir)/pcnet32.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pcnet32.Tpo" "$(DEPDIR)/libdrivers_a-pcnet32.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pcnet32.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pcnet32.c' object='libdrivers_a-pcnet32.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pcnet32.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pcnet32.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pcnet32.obj `if test -f 'pcnet32.c'; then $(CYGPATH_W) 'pcnet32.c'; else $(CYGPATH_W) '$(srcdir)/pcnet32.c'; fi`
-
- libdrivers_a-rtl8139.o: rtl8139.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-rtl8139.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" -c -o libdrivers_a-rtl8139.o `test -f 'rtl8139.c' || echo '$(srcdir)/'`rtl8139.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" "$(DEPDIR)/libdrivers_a-rtl8139.Po"; else rm -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rtl8139.c' object='libdrivers_a-rtl8139.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-rtl8139.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-rtl8139.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-rtl8139.o `test -f 'rtl8139.c' || echo '$(srcdir)/'`rtl8139.c
-
- libdrivers_a-rtl8139.obj: rtl8139.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-rtl8139.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" -c -o libdrivers_a-rtl8139.obj `if test -f 'rtl8139.c'; then $(CYGPATH_W) 'rtl8139.c'; else $(CYGPATH_W) '$(srcdir)/rtl8139.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo" "$(DEPDIR)/libdrivers_a-rtl8139.Po"; else rm -f "$(DEPDIR)/libdrivers_a-rtl8139.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rtl8139.c' object='libdrivers_a-rtl8139.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-rtl8139.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-rtl8139.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-rtl8139.obj `if test -f 'rtl8139.c'; then $(CYGPATH_W) 'rtl8139.c'; else $(CYGPATH_W) '$(srcdir)/rtl8139.c'; fi`
-
- libdrivers_a-sis900.o: sis900.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sis900.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-sis900.Tpo" -c -o libdrivers_a-sis900.o `test -f 'sis900.c' || echo '$(srcdir)/'`sis900.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sis900.Tpo" "$(DEPDIR)/libdrivers_a-sis900.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sis900.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sis900.c' object='libdrivers_a-sis900.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-sis900.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-sis900.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sis900.o `test -f 'sis900.c' || echo '$(srcdir)/'`sis900.c
-
- libdrivers_a-sis900.obj: sis900.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sis900.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-sis900.Tpo" -c -o libdrivers_a-sis900.obj `if test -f 'sis900.c'; then $(CYGPATH_W) 'sis900.c'; else $(CYGPATH_W) '$(srcdir)/sis900.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sis900.Tpo" "$(DEPDIR)/libdrivers_a-sis900.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sis900.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sis900.c' object='libdrivers_a-sis900.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-sis900.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-sis900.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sis900.obj `if test -f 'sis900.c'; then $(CYGPATH_W) 'sis900.c'; else $(CYGPATH_W) '$(srcdir)/sis900.c'; fi`
-
- -libdrivers_a-sk_g16.o: sk_g16.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sk_g16.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-sk_g16.Tpo" -c -o libdrivers_a-sk_g16.o `test -f 'sk_g16.c' || echo '$(srcdir)/'`sk_g16.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sk_g16.Tpo" "$(DEPDIR)/libdrivers_a-sk_g16.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sk_g16.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sk_g16.c' object='libdrivers_a-sk_g16.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sk_g16.o `test -f 'sk_g16.c' || echo '$(srcdir)/'`sk_g16.c
- -
- -libdrivers_a-sk_g16.obj: sk_g16.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-sk_g16.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-sk_g16.Tpo" -c -o libdrivers_a-sk_g16.obj `if test -f 'sk_g16.c'; then $(CYGPATH_W) 'sk_g16.c'; else $(CYGPATH_W) '$(srcdir)/sk_g16.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-sk_g16.Tpo" "$(DEPDIR)/libdrivers_a-sk_g16.Po"; else rm -f "$(DEPDIR)/libdrivers_a-sk_g16.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sk_g16.c' object='libdrivers_a-sk_g16.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-sk_g16.obj `if test -f 'sk_g16.c'; then $(CYGPATH_W) 'sk_g16.c'; else $(CYGPATH_W) '$(srcdir)/sk_g16.c'; fi`
- -
- -libdrivers_a-smc9000.o: smc9000.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-smc9000.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-smc9000.Tpo" -c -o libdrivers_a-smc9000.o `test -f 'smc9000.c' || echo '$(srcdir)/'`smc9000.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-smc9000.Tpo" "$(DEPDIR)/libdrivers_a-smc9000.Po"; else rm -f "$(DEPDIR)/libdrivers_a-smc9000.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smc9000.c' object='libdrivers_a-smc9000.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-smc9000.o `test -f 'smc9000.c' || echo '$(srcdir)/'`smc9000.c
- -
- -libdrivers_a-smc9000.obj: smc9000.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-smc9000.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-smc9000.Tpo" -c -o libdrivers_a-smc9000.obj `if test -f 'smc9000.c'; then $(CYGPATH_W) 'smc9000.c'; else $(CYGPATH_W) '$(srcdir)/smc9000.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-smc9000.Tpo" "$(DEPDIR)/libdrivers_a-smc9000.Po"; else rm -f "$(DEPDIR)/libdrivers_a-smc9000.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='smc9000.c' object='libdrivers_a-smc9000.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-smc9000.obj `if test -f 'smc9000.c'; then $(CYGPATH_W) 'smc9000.c'; else $(CYGPATH_W) '$(srcdir)/smc9000.c'; fi`
- -
- -libdrivers_a-tiara.o: tiara.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tiara.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-tiara.Tpo" -c -o libdrivers_a-tiara.o `test -f 'tiara.c' || echo '$(srcdir)/'`tiara.c; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tiara.Tpo" "$(DEPDIR)/libdrivers_a-tiara.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tiara.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tiara.c' object='libdrivers_a-tiara.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tiara.o `test -f 'tiara.c' || echo '$(srcdir)/'`tiara.c
- -
- -libdrivers_a-tiara.obj: tiara.c
- -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tiara.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-tiara.Tpo" -c -o libdrivers_a-tiara.obj `if test -f 'tiara.c'; then $(CYGPATH_W) 'tiara.c'; else $(CYGPATH_W) '$(srcdir)/tiara.c'; fi`; \
- -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tiara.Tpo" "$(DEPDIR)/libdrivers_a-tiara.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tiara.Tpo"; exit 1; fi
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tiara.c' object='libdrivers_a-tiara.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tiara.obj `if test -f 'tiara.c'; then $(CYGPATH_W) 'tiara.c'; else $(CYGPATH_W) '$(srcdir)/tiara.c'; fi`
- +libdrivers_a-tg3.o: tg3.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tg3.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-tg3.Tpo" -c -o libdrivers_a-tg3.o `test -f 'tg3.c' || echo '$(srcdir)/'`tg3.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tg3.Tpo" "$(DEPDIR)/libdrivers_a-tg3.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tg3.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tg3.c' object='libdrivers_a-tg3.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tg3.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tg3.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tg3.o `test -f 'tg3.c' || echo '$(srcdir)/'`tg3.c
- +
- +libdrivers_a-tg3.obj: tg3.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tg3.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-tg3.Tpo" -c -o libdrivers_a-tg3.obj `if test -f 'tg3.c'; then $(CYGPATH_W) 'tg3.c'; else $(CYGPATH_W) '$(srcdir)/tg3.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tg3.Tpo" "$(DEPDIR)/libdrivers_a-tg3.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tg3.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tg3.c' object='libdrivers_a-tg3.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tg3.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tg3.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tg3.obj `if test -f 'tg3.c'; then $(CYGPATH_W) 'tg3.c'; else $(CYGPATH_W) '$(srcdir)/tg3.c'; fi`
-
- libdrivers_a-tlan.o: tlan.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tlan.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-tlan.Tpo" -c -o libdrivers_a-tlan.o `test -f 'tlan.c' || echo '$(srcdir)/'`tlan.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tlan.Tpo" "$(DEPDIR)/libdrivers_a-tlan.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tlan.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tlan.c' object='libdrivers_a-tlan.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tlan.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tlan.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tlan.o `test -f 'tlan.c' || echo '$(srcdir)/'`tlan.c
-
- libdrivers_a-tlan.obj: tlan.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tlan.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-tlan.Tpo" -c -o libdrivers_a-tlan.obj `if test -f 'tlan.c'; then $(CYGPATH_W) 'tlan.c'; else $(CYGPATH_W) '$(srcdir)/tlan.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tlan.Tpo" "$(DEPDIR)/libdrivers_a-tlan.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tlan.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tlan.c' object='libdrivers_a-tlan.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tlan.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tlan.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tlan.obj `if test -f 'tlan.c'; then $(CYGPATH_W) 'tlan.c'; else $(CYGPATH_W) '$(srcdir)/tlan.c'; fi`
-
- libdrivers_a-tulip.o: tulip.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tulip.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-tulip.Tpo" -c -o libdrivers_a-tulip.o `test -f 'tulip.c' || echo '$(srcdir)/'`tulip.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tulip.Tpo" "$(DEPDIR)/libdrivers_a-tulip.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tulip.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tulip.c' object='libdrivers_a-tulip.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tulip.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tulip.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tulip.o `test -f 'tulip.c' || echo '$(srcdir)/'`tulip.c
-
- libdrivers_a-tulip.obj: tulip.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-tulip.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-tulip.Tpo" -c -o libdrivers_a-tulip.obj `if test -f 'tulip.c'; then $(CYGPATH_W) 'tulip.c'; else $(CYGPATH_W) '$(srcdir)/tulip.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-tulip.Tpo" "$(DEPDIR)/libdrivers_a-tulip.Po"; else rm -f "$(DEPDIR)/libdrivers_a-tulip.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tulip.c' object='libdrivers_a-tulip.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-tulip.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-tulip.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-tulip.obj `if test -f 'tulip.c'; then $(CYGPATH_W) 'tulip.c'; else $(CYGPATH_W) '$(srcdir)/tulip.c'; fi`
-
- libdrivers_a-via-rhine.o: via-rhine.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-via-rhine.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" -c -o libdrivers_a-via-rhine.o `test -f 'via-rhine.c' || echo '$(srcdir)/'`via-rhine.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" "$(DEPDIR)/libdrivers_a-via-rhine.Po"; else rm -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='via-rhine.c' object='libdrivers_a-via-rhine.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-via-rhine.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-via-rhine.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-via-rhine.o `test -f 'via-rhine.c' || echo '$(srcdir)/'`via-rhine.c
-
- libdrivers_a-via-rhine.obj: via-rhine.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-via-rhine.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" -c -o libdrivers_a-via-rhine.obj `if test -f 'via-rhine.c'; then $(CYGPATH_W) 'via-rhine.c'; else $(CYGPATH_W) '$(srcdir)/via-rhine.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo" "$(DEPDIR)/libdrivers_a-via-rhine.Po"; else rm -f "$(DEPDIR)/libdrivers_a-via-rhine.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='via-rhine.c' object='libdrivers_a-via-rhine.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-via-rhine.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-via-rhine.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-via-rhine.obj `if test -f 'via-rhine.c'; then $(CYGPATH_W) 'via-rhine.c'; else $(CYGPATH_W) '$(srcdir)/via-rhine.c'; fi`
-
- libdrivers_a-w89c840.o: w89c840.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-w89c840.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-w89c840.Tpo" -c -o libdrivers_a-w89c840.o `test -f 'w89c840.c' || echo '$(srcdir)/'`w89c840.c; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo" "$(DEPDIR)/libdrivers_a-w89c840.Po"; else rm -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='w89c840.c' object='libdrivers_a-w89c840.o' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-w89c840.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-w89c840.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-w89c840.o `test -f 'w89c840.c' || echo '$(srcdir)/'`w89c840.c
-
- libdrivers_a-w89c840.obj: w89c840.c
- @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-w89c840.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-w89c840.Tpo" -c -o libdrivers_a-w89c840.obj `if test -f 'w89c840.c'; then $(CYGPATH_W) 'w89c840.c'; else $(CYGPATH_W) '$(srcdir)/w89c840.c'; fi`; \
- @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo" "$(DEPDIR)/libdrivers_a-w89c840.Po"; else rm -f "$(DEPDIR)/libdrivers_a-w89c840.Tpo"; exit 1; fi
- @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='w89c840.c' object='libdrivers_a-w89c840.obj' libtool=no @AMDEPBACKSLASH@
- -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-w89c840.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-w89c840.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-w89c840.obj `if test -f 'w89c840.c'; then $(CYGPATH_W) 'w89c840.c'; else $(CYGPATH_W) '$(srcdir)/w89c840.c'; fi`
- -uninstall-info-am:
- +
- +libdrivers_a-r8169.o: r8169.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-r8169.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-r8169.Tpo" -c -o libdrivers_a-r8169.o `test -f 'r8169.c' || echo '$(srcdir)/'`r8169.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-r8169.Tpo" "$(DEPDIR)/libdrivers_a-r8169.Po"; else rm -f "$(DEPDIR)/libdrivers_a-r8169.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='r8169.c' object='libdrivers_a-r8169.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-r8169.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-r8169.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-r8169.o `test -f 'r8169.c' || echo '$(srcdir)/'`r8169.c
- +
- +libdrivers_a-r8169.obj: r8169.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-r8169.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-r8169.Tpo" -c -o libdrivers_a-r8169.obj `if test -f 'r8169.c'; then $(CYGPATH_W) 'r8169.c'; else $(CYGPATH_W) '$(srcdir)/r8169.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-r8169.Tpo" "$(DEPDIR)/libdrivers_a-r8169.Po"; else rm -f "$(DEPDIR)/libdrivers_a-r8169.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='r8169.c' object='libdrivers_a-r8169.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-r8169.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-r8169.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-r8169.obj `if test -f 'r8169.c'; then $(CYGPATH_W) 'r8169.c'; else $(CYGPATH_W) '$(srcdir)/r8169.c'; fi`
- +
- +libdrivers_a-forcedeth.o: forcedeth.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-forcedeth.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-forcedeth.Tpo" -c -o libdrivers_a-forcedeth.o `test -f 'forcedeth.c' || echo '$(srcdir)/'`forcedeth.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-forcedeth.Tpo" "$(DEPDIR)/libdrivers_a-forcedeth.Po"; else rm -f "$(DEPDIR)/libdrivers_a-forcedeth.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='forcedeth.c' object='libdrivers_a-forcedeth.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-forcedeth.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-forcedeth.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-forcedeth.o `test -f 'forcedeth.c' || echo '$(srcdir)/'`forcedeth.c
- +
- +libdrivers_a-forcedeth.obj: forcedeth.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-forcedeth.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-forcedeth.Tpo" -c -o libdrivers_a-forcedeth.obj `if test -f 'forcedeth.c'; then $(CYGPATH_W) 'forcedeth.c'; else $(CYGPATH_W) '$(srcdir)/forcedeth.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-forcedeth.Tpo" "$(DEPDIR)/libdrivers_a-forcedeth.Po"; else rm -f "$(DEPDIR)/libdrivers_a-forcedeth.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='forcedeth.c' object='libdrivers_a-forcedeth.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-forcedeth.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-forcedeth.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-forcedeth.obj `if test -f 'forcedeth.c'; then $(CYGPATH_W) 'forcedeth.c'; else $(CYGPATH_W) '$(srcdir)/forcedeth.c'; fi`
- +
- +libdrivers_a-ns83820.o: ns83820.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ns83820.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-ns83820.Tpo" -c -o libdrivers_a-ns83820.o `test -f 'ns83820.c' || echo '$(srcdir)/'`ns83820.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ns83820.Tpo" "$(DEPDIR)/libdrivers_a-ns83820.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ns83820.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ns83820.c' object='libdrivers_a-ns83820.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-ns83820.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-ns83820.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ns83820.o `test -f 'ns83820.c' || echo '$(srcdir)/'`ns83820.c
- +
- +libdrivers_a-ns83820.obj: ns83820.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-ns83820.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-ns83820.Tpo" -c -o libdrivers_a-ns83820.obj `if test -f 'ns83820.c'; then $(CYGPATH_W) 'ns83820.c'; else $(CYGPATH_W) '$(srcdir)/ns83820.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-ns83820.Tpo" "$(DEPDIR)/libdrivers_a-ns83820.Po"; else rm -f "$(DEPDIR)/libdrivers_a-ns83820.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ns83820.c' object='libdrivers_a-ns83820.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-ns83820.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-ns83820.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-ns83820.obj `if test -f 'ns83820.c'; then $(CYGPATH_W) 'ns83820.c'; else $(CYGPATH_W) '$(srcdir)/ns83820.c'; fi`
- +
- +libdrivers_a-pnic.o: pnic.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pnic.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pnic.Tpo" -c -o libdrivers_a-pnic.o `test -f 'pnic.c' || echo '$(srcdir)/'`pnic.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pnic.Tpo" "$(DEPDIR)/libdrivers_a-pnic.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pnic.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pnic.c' object='libdrivers_a-pnic.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pnic.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pnic.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pnic.o `test -f 'pnic.c' || echo '$(srcdir)/'`pnic.c
- +
- +libdrivers_a-pnic.obj: pnic.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pnic.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pnic.Tpo" -c -o libdrivers_a-pnic.obj `if test -f 'pnic.c'; then $(CYGPATH_W) 'pnic.c'; else $(CYGPATH_W) '$(srcdir)/pnic.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pnic.Tpo" "$(DEPDIR)/libdrivers_a-pnic.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pnic.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pnic.c' object='libdrivers_a-pnic.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pnic.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pnic.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pnic.obj `if test -f 'pnic.c'; then $(CYGPATH_W) 'pnic.c'; else $(CYGPATH_W) '$(srcdir)/pnic.c'; fi`
- +
- +libdrivers_a-pnic_api.o: pnic_api.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pnic_api.o -MD -MP -MF "$(DEPDIR)/libdrivers_a-pnic_api.Tpo" -c -o libdrivers_a-pnic_api.o `test -f 'pnic_api.c' || echo '$(srcdir)/'`pnic_api.c; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pnic_api.Tpo" "$(DEPDIR)/libdrivers_a-pnic_api.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pnic_api.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pnic_api.c' object='libdrivers_a-pnic_api.o' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pnic_api.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pnic_api.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pnic_api.o `test -f 'pnic_api.c' || echo '$(srcdir)/'`pnic_api.c
- +
- +libdrivers_a-pnic_api.obj: pnic_api.c
- +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -MT libdrivers_a-pnic_api.obj -MD -MP -MF "$(DEPDIR)/libdrivers_a-pnic_api.Tpo" -c -o libdrivers_a-pnic_api.obj `if test -f 'pnic_api.c'; then $(CYGPATH_W) 'pnic_api.c'; else $(CYGPATH_W) '$(srcdir)/pnic_api.c'; fi`; \
- +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libdrivers_a-pnic_api.Tpo" "$(DEPDIR)/libdrivers_a-pnic_api.Po"; else rm -f "$(DEPDIR)/libdrivers_a-pnic_api.Tpo"; exit 1; fi
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pnic_api.c' object='libdrivers_a-pnic_api.obj' libtool=no @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libdrivers_a-pnic_api.Po' tmpdepfile='$(DEPDIR)/libdrivers_a-pnic_api.TPo' @AMDEPBACKSLASH@
- +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdrivers_a_CFLAGS) $(CFLAGS) -c -o libdrivers_a-pnic_api.obj `if test -f 'pnic_api.c'; then $(CYGPATH_W) 'pnic_api.c'; else $(CYGPATH_W) '$(srcdir)/pnic_api.c'; fi`
-
- ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- @@ -817,11 +927,9 @@
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- - test -n "$$unique" || unique=$$empty_fix; \
- - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- - $$tags $$unique; \
- - fi
- + test -z "$(ETAGS_ARGS)$$tags$$unique" \
- + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- + $$tags $$unique
- ctags: CTAGS
- CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- @@ -895,7 +1003,7 @@
- clean-generic:
-
- distclean-generic:
- - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- + -rm -f $(CONFIG_CLEAN_FILES)
-
- maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @@ -962,10 +1070,10 @@
-
-
- # Is it really necessary to specify dependecies explicitly?
- -$(3c509_drivers): 3c509.c 3c509.h
- -$(3c509_drivers): %.o: 3c509.c
- - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +#$(3c509_drivers): 3c509.c 3c509.h
- +#$(3c509_drivers): %.o: 3c509.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- $(3c595_drivers): 3c595.c 3c595.h
- $(3c595_drivers): %.o: 3c595.c
- @@ -977,23 +1085,28 @@
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(cs89x0_drivers): cs89x0.c cs89x0.h
- -$(cs89x0_drivers): %.o: cs89x0.c
- - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +#$(cs89x0_drivers): cs89x0.c cs89x0.h
- +#$(cs89x0_drivers): %.o: cs89x0.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- $(davicom_drivers): davicom.c
- $(davicom_drivers): %.o: davicom.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(depca_drivers): depca.c
- -$(depca_drivers): %.o: depca.c
- - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +#$(depca_drivers): depca.c
- +#$(depca_drivers): %.o: depca.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(eepro_drivers): eepro.c
- -$(eepro_drivers): %.o: eepro.c
- +#$(eepro_drivers): eepro.c
- +#$(eepro_drivers): %.o: eepro.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- +$(e1000_drivers): e1000.c e1000_hw.h
- +$(e1000_drivers): %.o: e1000.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- @@ -1007,28 +1120,38 @@
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- +$(forcedeth_drivers): forcedeth.c
- +$(forcedeth_drivers): %.o: forcedeth.c
- + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- #$(fa311_drivers): fa311.c
- #$(fa311_drivers): %.o: fa311.c
- # $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- # $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(i82586_drivers): i82586.c
- -$(i82586_drivers): %.o: i82586.c
- - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +#$(i82586_drivers): i82586.c
- +#$(i82586_drivers): %.o: i82586.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(lance_drivers): lance.c
- -$(lance_drivers): %.o: lance.c
- - $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- - $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +#$(lance_drivers): lance.c
- +#$(lance_drivers): %.o: lance.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- $(natsemi_drivers): natsemi.c
- $(natsemi_drivers): %.o: natsemi.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(ni5010_drivers): ni5010.c
- -$(ni5010_drivers): %.o: ni5010.c
- +#$(ni5010_drivers): ni5010.c
- +#$(ni5010_drivers): %.o: ni5010.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- +$(ns83820_drivers): ns83820.c
- +$(ns83820_drivers): %.o: ns83820.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- @@ -1037,41 +1160,62 @@
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(otulip_drivers): otulip.c otulip.h
- -$(otulip_drivers): %.o: otulip.c
- +#$(otulip_drivers): otulip.c otulip.h
- +#$(otulip_drivers): %.o: otulip.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- +$(pcnet32_drivers): pcnet32.c
- +$(pcnet32_drivers): %.o: pcnet32.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(rtl8139_drivers): rtl8139.c
- -$(rtl8139_drivers): %.o: rtl8139.c
- +$(pnic_drivers): pnic.c
- +$(pnic_drivers): %.o: pnic.c pnic_api.h
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(sis900_drivers): sis900.c
- -$(sis900_drivers): %.o: sis900.c sis900.h
- +$(rtl8139_drivers): rtl8139.c
- +$(rtl8139_drivers): %.o: rtl8139.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(sk_g16_drivers): sk_g16.c sk_g16.h
- -$(sk_g16_drivers): %.o: sk_g16.c
- +$(r8169_drivers): r8169.c
- +$(r8169_drivers): %.o: r8169.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(smc9000_drivers): smc9000.c smc9000.h
- -$(smc9000_drivers): %.o: smc9000.c
- +$(sis900_drivers): sis900.c sis900.h
- +$(sis900_drivers): %.o: sis900.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -$(tiara_drivers): tiara.c
- -$(tiara_drivers): %.o: tiara.c
- +#$(sk_g16_drivers): sk_g16.c sk_g16.h
- +#$(sk_g16_drivers): %.o: sk_g16.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- +#$(smc9000_drivers): smc9000.c smc9000.h
- +#$(smc9000_drivers): %.o: smc9000.c
- +# $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- +# $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- +
- +$(tg3_drivers): tg3.c tg3.h
- +$(tg3_drivers): %.o: tg3.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- -#$(tlan_drivers): tlan.c
- -#$(tlan_drivers): %.o: tlan.c
- +#$(tiara_drivers): tiara.c
- +#$(tiara_drivers): %.o: tiara.c
- # $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- # $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
-
- +$(tlan_drivers): tlan.c tlan.h
- +$(tlan_drivers): %.o: tlan.c
- + $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- + $(NET_EXTRAFLAGS) $($(basename $@)_o_CFLAGS) -o $@ -c $<
- +
- $(tulip_drivers): tulip.c
- $(tulip_drivers): %.o: tulip.c
- $(COMPILE) $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
- diff -Naur grub-0.97.orig/netboot/basemem.c grub-0.97/netboot/basemem.c
- --- grub-0.97.orig/netboot/basemem.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/basemem.c 2005-08-31 19:24:28.000000000 +0000
- @@ -0,0 +1,178 @@
- +#include "etherboot.h"
- +#define DEBUG_BASEMEM
- +/* Routines to allocate base memory in a BIOS-compatible way, by
- + * updating the Free Base Memory Size counter at 40:13h.
- + *
- + * Michael Brown <mbrown@fensystems.co.uk> (mcb30)
- + * $Id: grub-0.95-diskless-patch-2-undi.patch,v 1.1.1.1 2005/06/14 08:18:50 wesolows Exp $
- + */
- +
- +#define fbms ( ( uint16_t * ) phys_to_virt ( 0x413 ) )
- +#define BASE_MEMORY_MAX ( 640 )
- +#define FREE_BLOCK_MAGIC ( ('!'<<0) + ('F'<<8) + ('R'<<16) + ('E'<<24) )
- +
- +typedef struct free_base_memory_block {
- + uint32_t magic;
- + uint16_t size_kb;
- +} free_base_memory_block_t;
- +
- +/* Return amount of free base memory in bytes
- + */
- +
- +uint32_t get_free_base_memory ( void ) {
- + return *fbms << 10;
- +}
- +
- +/* Adjust the real mode stack pointer. We keep the real mode stack at
- + * the top of free base memory, rather than allocating space for it.
- + */
- +
- +inline void adjust_real_mode_stack ( void ) {
- +/* real_mode_stack = ( *fbms << 10 ); */
- +}
- +
- +/* Allocate N bytes of base memory. Amount allocated will be rounded
- + * up to the nearest kB, since that's the granularity of the BIOS FBMS
- + * counter. Returns NULL if memory cannot be allocated.
- + */
- +
- +void * allot_base_memory ( size_t size ) {
- + uint16_t size_kb = ( size + 1023 ) >> 10;
- + void *ptr = NULL;
- +
- +#ifdef DEBUG_BASEMEM
- + printf ( "Trying to allocate %d kB of base memory, %d kB free\n",
- + size_kb, *fbms );
- +#endif
- +
- + /* Free up any unused memory before we start */
- + free_unused_base_memory();
- +
- + /* Check available base memory */
- + if ( size_kb > *fbms ) { return NULL; }
- +
- + /* Reduce available base memory */
- + *fbms -= size_kb;
- +
- + /* Calculate address of memory allocated */
- + ptr = phys_to_virt ( *fbms << 10 );
- +
- +#ifdef DEBUG_BASEMEM
- + /* Zero out memory. We do this so that allocation of
- + * already-used space will show up in the form of a crash as
- + * soon as possible.
- + */
- + memset ( ptr, 0, size_kb << 10 );
- +#endif
- +
- + /* Adjust real mode stack pointer */
- + adjust_real_mode_stack ();
- +
- + return ptr;
- +}
- +
- +/* Free base memory allocated by allot_base_memory. The BIOS provides
- + * nothing better than a LIFO mechanism for freeing memory (i.e. it
- + * just has the single "total free memory" counter), but we improve
- + * upon this slightly; as long as you free all the allotted blocks, it
- + * doesn't matter what order you free them in. (This will only work
- + * for blocks that are freed via forget_base_memory()).
- + *
- + * Yes, it's annoying that you have to remember the size of the blocks
- + * you've allotted. However, since our granularity of allocation is
- + * 1K, the alternative is to risk wasting the occasional kB of base
- + * memory, which is a Bad Thing. Really, you should be using as
- + * little base memory as possible, so consider the awkwardness of the
- + * API to be a feature! :-)
- + */
- +
- +void forget_base_memory ( void *ptr, size_t size ) {
- + uint16_t remainder = virt_to_phys(ptr) & 1023;
- + uint16_t size_kb = ( size + remainder + 1023 ) >> 10;
- + free_base_memory_block_t *free_block =
- + ( free_base_memory_block_t * ) ( ptr - remainder );
- +
- + if ( ( ptr == NULL ) || ( size == 0 ) ) { return; }
- +
- +#ifdef DEBUG_BASEMEM
- + printf ( "Trying to free %d bytes base memory at 0x%x\n",
- + size, virt_to_phys ( ptr ) );
- + if ( remainder > 0 ) {
- + printf ( "WARNING: destructively expanding free block "
- + "downwards to 0x%x\n",
- + virt_to_phys ( ptr - remainder ) );
- + }
- +#endif
- +
- + /* Mark every kilobyte within this block as free. This is
- + * overkill for normal purposes, but helps when something has
- + * allocated base memory with a granularity finer than the
- + * BIOS granularity of 1kB. PXE ROMs tend to do this when
- + * they allocate their own memory. This method allows us to
- + * free their blocks (admittedly in a rather dangerous,
- + * tread-on-anything-either-side sort of way, but there's no
- + * other way to do it).
- + *
- + * Since we're marking every kB as free, there's actually no
- + * need for recording the size of the blocks. However, we
- + * keep this in so that debug messages are friendlier. It
- + * probably adds around 8 bytes to the overall code size.
- + */
- + while ( size_kb > 0 ) {
- + /* Mark this block as unused */
- + free_block->magic = FREE_BLOCK_MAGIC;
- + free_block->size_kb = size_kb;
- + /* Move up by 1 kB */
- + (void *)(free_block += ( 1 << 10 ));
- + size_kb--;
- + }
- +
- + /* Free up unused base memory */
- + free_unused_base_memory();
- +}
- +
- +/* Do the actual freeing of memory. This is split out from
- + * forget_base_memory() so that it may be called separately. It
- + * should be called whenever base memory is deallocated by an external
- + * entity (if we can detect that it has done so) so that we get the
- + * chance to free up our own blocks.
- + */
- +void free_unused_base_memory ( void ) {
- + free_base_memory_block_t *free_block = NULL;
- +
- + /* Try to release memory back to the BIOS. Free all
- + * consecutive blocks marked as free.
- + */
- + while ( 1 ) {
- + /* Calculate address of next potential free block */
- + free_block = ( free_base_memory_block_t * )
- + phys_to_virt ( *fbms << 10 );
- +
- + /* Stop processing if we're all the way up to 640K or
- + * if this is not a free block
- + */
- + if ( ( *fbms == BASE_MEMORY_MAX ) ||
- + ( free_block->magic != FREE_BLOCK_MAGIC ) ) {
- + break;
- + }
- +
- + /* Return memory to BIOS */
- + *fbms += free_block->size_kb;
- +
- +#ifdef DEBUG_BASEMEM
- + printf ( "Freed %d kB base memory, %d kB now free\n",
- + free_block->size_kb, *fbms );
- +
- + /* Zero out freed block. We do this in case
- + * the block contained any structures that
- + * might be located by scanning through
- + * memory.
- + */
- + memset ( free_block, 0, free_block->size_kb << 10 );
- +#endif
- + }
- +
- + /* Adjust real mode stack pointer */
- + adjust_real_mode_stack ();
- +}
- +
- diff -Naur grub-0.97.orig/netboot/big_bswap.h grub-0.97/netboot/big_bswap.h
- --- grub-0.97.orig/netboot/big_bswap.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/big_bswap.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,17 @@
- +#ifndef ETHERBOOT_BIG_BSWAP_H
- +#define ETHERBOOT_BIG_BSWAP_H
- +
- +#define ntohl(x) (x)
- +#define htonl(x) (x)
- +#define ntohs(x) (x)
- +#define htons(x) (x)
- +#define cpu_to_le32(x) __bswap_32(x)
- +#define cpu_to_le16(x) __bswap_16(x)
- +#define cpu_to_be32(x) (x)
- +#define cpu_to_be16(x) (x)
- +#define le32_to_cpu(x) __bswap_32(x)
- +#define le16_to_cpu(x) __bswap_16(x)
- +#define be32_to_cpu(x) (x)
- +#define be16_to_cpu(x) (x)
- +
- +#endif /* ETHERBOOT_BIG_BSWAP_H */
- diff -Naur grub-0.97.orig/netboot/bootp.h grub-0.97/netboot/bootp.h
- --- grub-0.97.orig/netboot/bootp.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/bootp.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,182 @@
- +#ifndef _BOOTP_H
- +#define _BOOTP_H
- +
- +#include "if_ether.h"
- +#include "ip.h"
- +#include "udp.h"
- +
- +#ifndef MAX_BOOTP_RETRIES
- +#define MAX_BOOTP_RETRIES 20
- +#endif
- +
- +#ifdef ALTERNATE_DHCP_PORTS_1067_1068
- +#undef NON_STANDARD_BOOTP_SERVER
- +#define NON_STANDARD_BOOTP_SERVER 1067
- +#undef NON_STANDARD_BOOTP_CLIENT
- +#define NON_STANDARD_BOOTP_CLIENT 1068
- +#endif
- +
- +#ifdef NON_STANDARD_BOOTP_SERVER
- +#define BOOTP_SERVER NON_STANDARD_BOOTP_SERVER
- +#else
- +#define BOOTP_SERVER 67
- +#endif
- +#ifdef NON_STANDARD_BOOTP_CLIENT
- +#define BOOTP_CLIENT NON_STANDARD_BOOTP_CLIENT
- +#else
- +#define BOOTP_CLIENT 68
- +#endif
- +
- +#define BOOTP_REQUEST 1
- +#define BOOTP_REPLY 2
- +
- +#define TAG_LEN(p) (*((p)+1))
- +#define RFC1533_COOKIE 99, 130, 83, 99
- +#define RFC1533_PAD 0
- +#define RFC1533_NETMASK 1
- +#define RFC1533_TIMEOFFSET 2
- +#define RFC1533_GATEWAY 3
- +#define RFC1533_TIMESERVER 4
- +#define RFC1533_IEN116NS 5
- +#define RFC1533_DNS 6
- +#define RFC1533_LOGSERVER 7
- +#define RFC1533_COOKIESERVER 8
- +#define RFC1533_LPRSERVER 9
- +#define RFC1533_IMPRESSSERVER 10
- +#define RFC1533_RESOURCESERVER 11
- +#define RFC1533_HOSTNAME 12
- +#define RFC1533_BOOTFILESIZE 13
- +#define RFC1533_MERITDUMPFILE 14
- +#define RFC1533_DOMAINNAME 15
- +#define RFC1533_SWAPSERVER 16
- +#define RFC1533_ROOTPATH 17
- +#define RFC1533_EXTENSIONPATH 18
- +#define RFC1533_IPFORWARDING 19
- +#define RFC1533_IPSOURCEROUTING 20
- +#define RFC1533_IPPOLICYFILTER 21
- +#define RFC1533_IPMAXREASSEMBLY 22
- +#define RFC1533_IPTTL 23
- +#define RFC1533_IPMTU 24
- +#define RFC1533_IPMTUPLATEAU 25
- +#define RFC1533_INTMTU 26
- +#define RFC1533_INTLOCALSUBNETS 27
- +#define RFC1533_INTBROADCAST 28
- +#define RFC1533_INTICMPDISCOVER 29
- +#define RFC1533_INTICMPRESPOND 30
- +#define RFC1533_INTROUTEDISCOVER 31
- +#define RFC1533_INTROUTESOLICIT 32
- +#define RFC1533_INTSTATICROUTES 33
- +#define RFC1533_LLTRAILERENCAP 34
- +#define RFC1533_LLARPCACHETMO 35
- +#define RFC1533_LLETHERNETENCAP 36
- +#define RFC1533_TCPTTL 37
- +#define RFC1533_TCPKEEPALIVETMO 38
- +#define RFC1533_TCPKEEPALIVEGB 39
- +#define RFC1533_NISDOMAIN 40
- +#define RFC1533_NISSERVER 41
- +#define RFC1533_NTPSERVER 42
- +#define RFC1533_VENDOR 43
- +#define RFC1533_NBNS 44
- +#define RFC1533_NBDD 45
- +#define RFC1533_NBNT 46
- +#define RFC1533_NBSCOPE 47
- +#define RFC1533_XFS 48
- +#define RFC1533_XDM 49
- +#ifndef NO_DHCP_SUPPORT
- +#define RFC2132_REQ_ADDR 50
- +#define RFC2132_MSG_TYPE 53
- +#define RFC2132_SRV_ID 54
- +#define RFC2132_PARAM_LIST 55
- +#define RFC2132_MAX_SIZE 57
- +#define RFC2132_VENDOR_CLASS_ID 60
- +
- +#define DHCPDISCOVER 1
- +#define DHCPOFFER 2
- +#define DHCPREQUEST 3
- +#define DHCPACK 5
- +#endif /* NO_DHCP_SUPPORT */
- +
- +#define RFC1533_VENDOR_MAJOR 0
- +#define RFC1533_VENDOR_MINOR 0
- +
- +#define RFC1533_VENDOR_MAGIC 128
- +#define RFC1533_VENDOR_ADDPARM 129
- +#define RFC1533_VENDOR_ETHDEV 130
- +#ifdef IMAGE_FREEBSD
- +#define RFC1533_VENDOR_HOWTO 132
- +#define RFC1533_VENDOR_KERNEL_ENV 133
- +#endif
- +#define RFC1533_VENDOR_ETHERBOOT_ENCAP 150
- +#define RFC1533_VENDOR_MNUOPTS 160
- +#define RFC1533_VENDOR_NIC_DEV_ID 175
- +#define RFC1533_VENDOR_SELECTION 176
- +#define RFC1533_VENDOR_ARCH 177
- +#define RFC1533_VENDOR_MOTD 184
- +#define RFC1533_VENDOR_NUMOFMOTD 8
- +#define RFC1533_VENDOR_IMG 192
- +#define RFC1533_VENDOR_NUMOFIMG 16
- +
- +#define RFC1533_VENDOR_CONFIGFILE 150
- +
- +#define RFC1533_END 255
- +
- +#define BOOTP_VENDOR_LEN 64
- +
- +#define DHCP_OPT_LEN 312
- +
- +/* Format of a bootp packet */
- +struct bootp_t {
- + uint8_t bp_op;
- + uint8_t bp_htype;
- + uint8_t bp_hlen;
- + uint8_t bp_hops;
- + uint32_t bp_xid;
- + uint16_t bp_secs;
- + uint16_t unused;
- + in_addr bp_ciaddr;
- + in_addr bp_yiaddr;
- + in_addr bp_siaddr;
- + in_addr bp_giaddr;
- + uint8_t bp_hwaddr[16];
- + uint8_t bp_sname[64];
- + char bp_file[128];
- + uint8_t bp_vend[BOOTP_VENDOR_LEN];
- +};
- +
- +struct dhcp_t {
- + uint8_t bp_op;
- + uint8_t bp_htype;
- + uint8_t bp_hlen;
- + uint8_t bp_hops;
- + uint32_t bp_xid;
- + uint16_t bp_secs;
- + uint16_t bp_flag;
- + in_addr bp_ciaddr;
- + in_addr bp_yiaddr;
- + in_addr bp_siaddr;
- + in_addr bp_giaddr;
- + uint8_t bp_hwaddr[16];
- + uint8_t bp_sname[64];
- + char bp_file[128];
- + uint8_t bp_vend[DHCP_OPT_LEN];
- +};
- +
- +/* Format of a bootp IP packet */
- +struct bootpip_t
- +{
- + struct iphdr ip;
- + struct udphdr udp;
- + struct bootp_t bp;
- +};
- +struct dhcpip_t
- +{
- + struct iphdr ip;
- + struct udphdr udp;
- + struct dhcp_t bp;
- +};
- +
- +#define MAX_RFC1533_VENDLEN (ETH_MAX_MTU - sizeof(struct bootpip_t) + BOOTP_VENDOR_LEN)
- +
- +#define BOOTP_DATA_ADDR (&bootp_data)
- +
- +#endif /* _BOOTP_H */
- diff -Naur grub-0.97.orig/netboot/byteswap.h grub-0.97/netboot/byteswap.h
- --- grub-0.97.orig/netboot/byteswap.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/byteswap.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,20 @@
- +#ifndef ETHERBOOT_BYTESWAP_H
- +#define ETHERBOOT_BYTESWAP_H
- +
- +#include "endian.h"
- +#include "i386_byteswap.h"
- +
- +#if __BYTE_ORDER == __LITTLE_ENDIAN
- +#include "little_bswap.h"
- +#endif
- +#if __BYTE_ORDER == __BIG_ENDIAN
- +#include "big_bswap.h"
- +#endif
- +
- +/* Make routines available to all */
- +#define swap32(x) __bswap_32(x)
- +#define swap16(x) __bswap_16(x)
- +#define bswap_32(x) __bswap_32(x)
- +#define bswap_16(x) __bswap_16(x)
- +
- +#endif /* ETHERBOOT_BYTESWAP_H */
- diff -Naur grub-0.97.orig/netboot/cards.h grub-0.97/netboot/cards.h
- --- grub-0.97.orig/netboot/cards.h 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/cards.h 1970-01-01 00:00:00.000000000 +0000
- @@ -1,183 +0,0 @@
- -#ifndef CARDS_H
- -#define CARDS_H
- -
- -/*
- - * This program is free software; you can redistribute it and/or
- - * modify it under the terms of the GNU General Public License as
- - * published by the Free Software Foundation; either version 2, or (at
- - * your option) any later version.
- - */
- -
- -#include "nic.h"
- -
- -/* OK, this is how the PCI support hack works: if pci.h is included before
- - * this file is included, assume that the driver supports PCI. This means that
- - * this file is usually included last. */
- -
- -#ifdef PCI_H
- -#define PCI_ARG(x) ,x
- -#else
- -#define PCI_ARG(x)
- -#endif
- -
- -#ifdef INCLUDE_WD
- -extern struct nic *wd_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_3C503
- -extern struct nic *t503_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_VIA_RHINE
- -extern struct nic *rhine_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_NE
- -extern struct nic *ne_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_NS8390
- -extern struct nic *nepci_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_3C509
- -extern struct nic *t509_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_3C529
- -extern struct nic *t529_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_3C595
- -extern struct nic *t595_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_3C90X
- -extern struct nic *a3c90x_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_EEPRO
- -extern struct nic *eepro_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_EEPRO100
- -extern struct nic *eepro100_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_EPIC100
- -extern struct nic *epic100_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_OTULIP
- -extern struct nic *otulip_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_TULIP
- -extern struct nic *tulip_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_DAVICOM
- -extern struct nic *davicom_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_CS89X0
- -extern struct nic *cs89x0_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_LANCE
- -extern struct nic *lancepci_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_NE2100
- -extern struct nic *ne2100_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_NI6510
- -extern struct nic *ni6510_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_SK_G16
- -extern struct nic *SK_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_3C507
- -extern struct nic *t507_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_NI5010
- -extern struct nic *ni5010_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_NI5210
- -extern struct nic *ni5210_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_EXOS205
- -extern struct nic *exos205_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_SMC9000
- -extern struct nic *smc9000_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_TIARA
- -extern struct nic *tiara_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_DEPCA
- -extern struct nic *depca_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_RTL8139
- -extern struct nic *rtl8139_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_W89C840
- -extern struct nic *w89c840_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_SIS900
- -extern struct nic *sis900_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_NATSEMI
- -extern struct nic *natsemi_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#ifdef INCLUDE_TLAN
- -extern struct nic *tlan_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -#endif /* CARDS_H */
- diff -Naur grub-0.97.orig/netboot/config.c grub-0.97/netboot/config.c
- --- grub-0.97.orig/netboot/config.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/config.c 2005-08-31 19:03:35.000000000 +0000
- @@ -1,598 +1,165 @@
- /*
- - * GRUB -- GRand Unified Bootloader
- - * Copyright (C) 2001,2002 Free Software Foundation, Inc.
- - *
- - * This program is free software; you can redistribute it and/or modify
- - * it under the terms of the GNU General Public License as published by
- - * the Free Software Foundation; either version 2 of the License, or
- - * (at your option) any later version.
- - *
- - * This program is distributed in the hope that it will be useful,
- - * but WITHOUT ANY WARRANTY; without even the implied warranty of
- - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- - * GNU General Public License for more details.
- - *
- - * You should have received a copy of the GNU General Public License
- - * along with this program; if not, write to the Free Software
- - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- - */
- -
- -/* Based on "src/config.c" in etherboot-5.0.5. */
- -
- -/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2, or (at
- * your option) any later version.
- */
-
- -#define GRUB 1
- -#include <etherboot.h>
- -#include <nic.h>
- +#include "grub.h"
- +#include "pci.h"
- +#include "isa.h"
- +#include "nic.h"
-
- -#undef INCLUDE_PCI
- -#if defined(INCLUDE_NS8390) || defined(INCLUDE_EEPRO100) || defined(INCLUDE_LANCE) || defined(INCLUDE_EPIC100) || defined(INCLUDE_TULIP) || defined(INCLUDE_OTULIP) || defined(INCLUDE_3C90X) || defined(INCLUDE_3C595) || defined(INCLUDE_RTL8139) || defined(INCLUDE_VIA_RHINE) || defined(INCLUDE_W89C840) || defined(INCLUDE_DAVICOM) || defined(INCLUDE_SIS900) || defined(INCLUDE_NATSEMI) || defined(INCLUDE_TLAN)
- - /* || others later */
- -# define INCLUDE_PCI
- -# include <pci.h>
- -static unsigned short pci_ioaddrs[16];
- -
- -static struct pci_device pci_nic_list[] =
- +#ifdef CONFIG_PCI
- +static int pci_probe(struct dev *dev, const char *type_name)
- {
- -#ifdef INCLUDE_NS8390
- - { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8029,
- - "Realtek 8029", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C940,
- - "Winbond NE2000-PCI", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_RL2000,
- - "Compex ReadyLink 2000", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_KTI, PCI_DEVICE_ID_KTI_ET32P2,
- - "KTI ET32P2", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_NETVIN, PCI_DEVICE_ID_NETVIN_NV5000SC,
- - "NetVin NV5000SC", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_HT80232,
- - "Holtek HT80232", 0, 0, 0, 0},
- -#endif
- -#ifdef INCLUDE_3C90X
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900TPO,
- - "3Com900-TPO", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900COMBO,
- - "3Com900-Combo", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905TX,
- - "3Com905-TX", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905T4,
- - "3Com905-T4", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x9004,
- - "3Com900B-TPO", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x9005,
- - "3Com900B-Combo", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x9006,
- - "3Com900B-2/T", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x900A,
- - "3Com900B-FL", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905B_TX,
- - "3Com905B-TX", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x9056,
- - "3Com905B-T4", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x905A,
- - "3Com905B-FL", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905C_TXM,
- - "3Com905C-TXM", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x9800,
- - "3Com980-Cyclone", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x9805,
- - "3Com9805", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x7646,
- - "3CSOHO100-TX", 0, 0, 0, 0},
- -#endif
- -#ifdef INCLUDE_3C595
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C590,
- - "3Com590", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595,
- - "3Com595", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595_1,
- - "3Com595", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595_2,
- - "3Com595", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900TPO,
- - "3Com900-TPO", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900COMBO,
- - "3Com900-Combo", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x9004,
- - "3Com900B-TPO", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x9005,
- - "3Com900B-Combo", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x9006,
- - "3Com900B-2/T", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x900A,
- - "3Com900B-FL", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x9800,
- - "3Com980-Cyclone", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x9805,
- - "3Com9805", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_3COM, 0x7646,
- - "3CSOHO100-TX", 0, 0, 0, 0},
- -#endif
- -#ifdef INCLUDE_EEPRO100
- - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557,
- - "Intel EtherExpressPro100", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ER,
- - "Intel EtherExpressPro100 82559ER", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1029,
- - "Intel EtherExpressPro100 ID1029", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1030,
- - "Intel Corporation 82559 InBusiness 10/100", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82562,
- - "Intel EtherExpressPro100 82562EM", 0, 0, 0, 0},
- -#endif
- -#ifdef INCLUDE_EPIC100
- - { PCI_VENDOR_ID_SMC, PCI_DEVICE_ID_SMC_EPIC100,
- - "SMC EtherPowerII", 0, 0, 0, 0},
- -#endif
- -#ifdef INCLUDE_LANCE
- - { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE,
- - "AMD Lance/PCI", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_AMD_HOMEPNA, PCI_DEVICE_ID_AMD_HOMEPNA,
- - "AMD Lance/HomePNA", 0, 0, 0, 0},
- -#endif
- -#ifdef INCLUDE_RTL8139
- - { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139,
- - "Realtek 8139", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DFE530TXP,
- - "DFE530TX+/DFE538TX", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_SMC_1211, PCI_DEVICE_ID_SMC_1211,
- - "SMC EZ10/100", 0, 0, 0, 0},
- -#endif
- -#ifdef INCLUDE_OTULIP
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP,
- - "Digital Tulip", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST,
- - "Digital Tulip Fast", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_PLUS,
- - "Digital Tulip+", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142,
- - "Digital Tulip 21142", 0, 0, 0, 0},
- -#endif
- -#ifdef INCLUDE_TULIP
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP,
- - "Digital Tulip", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST,
- - "Digital Tulip Fast", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_PLUS,
- - "Digital Tulip+", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142,
- - "Digital Tulip 21142", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_MACRONIX, PCI_DEVICE_ID_MX987x5,
- - "Macronix MX987x5", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LC82C115,
- - "LinkSys LNE100TX", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_DEC_TULIP,
- - "Netgear FA310TX", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9102,
- - "Davicom 9102", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9009,
- - "Davicom 9009", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_0985,
- - "ADMtek Centaur-P", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_ADMTEK, 0x0981,
- - "ADMtek AN981 Comet", 0, 0, 0, 0},
- - { 0x125B, 0x1400,
- - "ASIX AX88140", 0, 0, 0, 0 },
- - { 0x11F6, 0x9881,
- - "Compex RL100-TX", 0, 0, 0, 0 },
- -#endif
- -#ifdef INCLUDE_DAVICOM
- - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9102,
- - "Davicom 9102", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9009,
- - "Davicom 9009", 0, 0, 0, 0},
- -#endif
- -#ifdef INCLUDE_VIA_RHINE
- - { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_VT6102,
- - "VIA 6102", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_RHINE_I,
- - "VIA 3043", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_86C100A,
- - "VIA 86C100A", 0, 0, 0, 0},
- -#endif
- -#ifdef INCLUDE_W89C840
- - { PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C840,
- - "Winbond W89C840F", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_RL100ATX,
- - "Compex RL100ATX", 0, 0, 0, 0},
- -#endif
- -#ifdef INCLUDE_SIS900
- - { PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS900,
- - "SIS900", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS7016,
- - "SIS7016", 0, 0, 0, 0},
- -#endif
- -
- -#ifdef INCLUDE_NATSEMI
- - { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_DP83815,
- - "DP83815", 0, 0, 0, 0},
- -#endif
- -
- -#ifdef INCLUDE_TLAN
- - { PCI_VENDOR_ID_OLICOM, PCI_DEVICE_ID_OLICOM_OC2326,
- - "OC2326", 0, 0, 0, 0},
- +/*
- + * NIC probing is in pci device order, followed by the
- + * link order of the drivers. A driver that matches
- + * on vendor and device id will supersede a driver
- + * that matches on pci class.
- + *
- + * If you want to probe for another device behind the same pci
- + * device just increment index. And the previous probe call
- + * will be repeated.
- + */
- + struct pci_probe_state *state = &dev->state.pci;
- + printf("Probing pci %s...\n", type_name);
- + if (dev->how_probe == PROBE_FIRST) {
- + state->advance = 1;
- + state->dev.driver = 0;
- + state->dev.bus = 0;
- + state->dev.devfn = 0;
- + dev->index = -1;
- + }
- + for(;;) {
- + if ((dev->how_probe != PROBE_AWAKE) && state->advance) {
- + find_pci(dev->type, &state->dev);
- + dev->index = -1;
- + }
- + state->advance = 1;
- +
- + if (state->dev.driver == 0)
- + break;
- +
- +#if 0
- + /* FIXME the romaddr code needs a total rethought to be useful */
- + if (state->dev.romaddr != ((unsigned long) rom.rom_segment << 4)) {
- + continue;
- + }
- +#endif
- + if (dev->how_probe != PROBE_AWAKE) {
- + dev->type_index++;
- + }
- + dev->devid.bus_type = PCI_BUS_TYPE;
- + dev->devid.vendor_id = htons(state->dev.vendor);
- + dev->devid.device_id = htons(state->dev.dev_id);
- + /* FIXME how do I handle dev->index + PROBE_AGAIN?? */
- +
- + printf("[%s]", state->dev.name);
- + if (state->dev.driver->probe(dev, &state->dev)) {
- + state->advance = (dev->index == -1);
- + return PROBE_WORKED;
- + }
- + putchar('\n');
- + }
- + return PROBE_FAILED;
- +}
- #endif
-
- - /* other PCI NICs go here */
- - {0, 0, NULL, 0, 0, 0, 0}
- -};
- -#endif /* INCLUDE_*PCI */
- -
- -#include <cards.h>
- -
- -#ifdef INCLUDE_PCI
- -struct pci_dispatch_table
- +#ifdef CONFIG_ISA
- +static int isa_probe(struct dev *dev, const char *type_name)
- {
- - unsigned short vendor;
- - unsigned short dev_id;
- - struct nic *(*eth_probe) (struct nic *, unsigned short *,
- - struct pci_device *);
- -};
- -
- -static struct pci_dispatch_table PCI_NIC[] =
- -{
- -# ifdef INCLUDE_NS8390
- - { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8029, nepci_probe },
- - { PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C940, nepci_probe },
- - { PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_RL2000, nepci_probe },
- - { PCI_VENDOR_ID_KTI, PCI_DEVICE_ID_KTI_ET32P2, nepci_probe },
- - { PCI_VENDOR_ID_NETVIN, PCI_DEVICE_ID_NETVIN_NV5000SC, nepci_probe },
- - { PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_HT80232, nepci_probe },
- -# endif /* INCLUDE_NS8390 */
- -# ifdef INCLUDE_3C90X
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900TPO, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900COMBO, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905TX, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905T4, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, 0x9004, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, 0x9005, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, 0x9006, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, 0x900A, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905B_TX, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, 0x9056, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, 0x905A, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C905C_TXM, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, 0x9800, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, 0x9805, a3c90x_probe },
- - { PCI_VENDOR_ID_3COM, 0x7646, a3c90x_probe },
- -# endif /* INCLUDE_3C90X */
- -# ifdef INCLUDE_3C595
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C590, t595_probe },
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595, t595_probe },
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595_1, t595_probe },
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C595_2, t595_probe },
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900TPO, t595_probe },
- - { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C900COMBO, t595_probe },
- - { PCI_VENDOR_ID_3COM, 0x9004, t595_probe },
- - { PCI_VENDOR_ID_3COM, 0x9005, t595_probe },
- - { PCI_VENDOR_ID_3COM, 0x9006, t595_probe },
- - { PCI_VENDOR_ID_3COM, 0x900A, t595_probe },
- - { PCI_VENDOR_ID_3COM, 0x9800, t595_probe },
- - { PCI_VENDOR_ID_3COM, 0x9805, t595_probe },
- - { PCI_VENDOR_ID_3COM, 0x7646, t595_probe },
- -# endif /* INCLUDE_3C595 */
- -# ifdef INCLUDE_EEPRO100
- - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557, eepro100_probe },
- - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ER, eepro100_probe },
- - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1029, eepro100_probe },
- - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1030, eepro100_probe },
- - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82562, eepro100_probe },
- -# endif /* INCLUDE_EEPRO100 */
- -# ifdef INCLUDE_EPIC100
- - { PCI_VENDOR_ID_SMC, PCI_DEVICE_ID_SMC_EPIC100, epic100_probe },
- -# endif /* INCLUDE_EPIC100 */
- -# ifdef INCLUDE_LANCE
- - { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE, lancepci_probe },
- - { PCI_VENDOR_ID_AMD_HOMEPNA, PCI_DEVICE_ID_AMD_HOMEPNA, lancepci_probe },
- -# endif /* INCLUDE_LANCE */
- -# ifdef INCLUDE_RTL8139
- - { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139, rtl8139_probe },
- - { PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DFE530TXP, rtl8139_probe },
- - { PCI_VENDOR_ID_SMC_1211, PCI_DEVICE_ID_SMC_1211, rtl8139_probe },
- -# endif /* INCLUDE_RTL8139 */
- -# ifdef INCLUDE_OTULIP
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP, otulip_probe },
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST, otulip_probe },
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_PLUS, otulip_probe },
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142, otulip_probe },
- -# endif /* INCLUDE_OTULIP */
- -# ifdef INCLUDE_TULIP
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP, tulip_probe },
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST, tulip_probe },
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_PLUS, tulip_probe },
- - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142, tulip_probe },
- - { PCI_VENDOR_ID_MACRONIX, PCI_DEVICE_ID_MX987x5, tulip_probe },
- - { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LC82C115, tulip_probe },
- - { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_DEC_TULIP, tulip_probe },
- - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9102, tulip_probe },
- - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9009, tulip_probe },
- - { PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_0985, tulip_probe },
- - { PCI_VENDOR_ID_ADMTEK, 0x0981, tulip_probe },
- - { 0x125B, 0x1400, tulip_probe },
- - { 0x11F6, 0x9881, tulip_probe },
- -# endif /* INCLUDE_TULIP */
- -# ifdef INCLUDE_DAVICOM
- - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9102, davicom_probe },
- - { PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DM9009, davicom_probe },
- -# endif /* INCLUDE_DAVICOM */
- -# ifdef INCLUDE_VIA_RHINE
- - { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_VT6102, rhine_probe },
- - { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_RHINE_I, rhine_probe },
- - { PCI_VENDOR_ID_VIATEC, PCI_DEVICE_ID_VIA_86C100A, rhine_probe },
- -# endif /* INCLUDE_VIA_RHINE */
- -# ifdef INCLUDE_W89C840
- - { PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C840, w89c840_probe },
- - { PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_RL100ATX, w89c840_probe },
- -# endif /* INCLUDE_W89C840 */
- -# ifdef INCLUDE_SIS900
- - { PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS900, sis900_probe },
- - { PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS7016, sis900_probe },
- -# endif /* INCLUDE_SIS900 */
- -# ifdef INCLUDE_NATSEMI
- - { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_DP83815, natsemi_probe },
- -# endif /* INCLUDE_NATSEMI */
- -# ifdef INCLUDE_TLAN
- - { PCI_VENDOR_ID_OLICOM, PCI_DEVICE_ID_OLICOM_OC2326, tlan_probe },
- -# endif /* INCLUDE_TLAN */
- - { 0, 0, 0 }
- -};
- -#endif /* GRUB && INCLUDE_PCI */
- -
- -struct dispatch_table
- -{
- - const char *nic_name;
- -#ifdef INCLUDE_PCI
- - struct nic *(*eth_probe) (struct nic *, unsigned short *,
- - struct pci_device *);
- -#else
- - struct nic *(*eth_probe) (struct nic *, unsigned short *);
- -#endif /* INCLUDE_PCI */
- - unsigned short *probe_ioaddrs; /* for probe overrides */
- -};
- -
- /*
- - * NIC probing is in order of appearance in this table.
- + * NIC probing is in the order the drivers were linked togeter.
- * If for some reason you want to change the order,
- - * just rearrange the entries (bracketed by the #ifdef/#endif)
- + * just change the order you list the drivers in.
- */
- -static struct dispatch_table NIC[] =
- -{
- -#ifdef INCLUDE_RTL8139
- - { "RTL8139", rtl8139_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_SIS900
- - { "SIS900", sis900_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_NATSEMI
- - { "NATSEMI", natsemi_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_WD
- - { "WD", wd_probe, 0 },
- -#endif
- -#ifdef INCLUDE_3C503
- - { "3C503", t503_probe, 0 },
- -#endif
- -#ifdef INCLUDE_NE
- - { "NE*000", ne_probe, 0 },
- -#endif
- -#ifdef INCLUDE_3C509
- - { "3C5x9", t509_probe, 0 },
- -#endif
- -#ifdef INCLUDE_3C529
- - { "3C5x9", t529_probe, 0 },
- -#endif
- -#ifdef INCLUDE_3C595
- - { "3C595", t595_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_3C90X
- - { "3C90X", a3c90x_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_EEPRO
- - { "EEPRO", eepro_probe, 0 },
- -#endif
- -#ifdef INCLUDE_EEPRO100
- - { "EEPRO100", eepro100_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_EPIC100
- - { "EPIC100", epic100_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_OTULIP
- - { "OTulip", otulip_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_TULIP
- - { "Tulip", tulip_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_DAVICOM
- - { "DAVICOM", davicom_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_CS89X0
- - { "CS89x0", cs89x0_probe, 0 },
- -#endif
- -#ifdef INCLUDE_NE2100
- - { "NE2100", ne2100_probe, 0 },
- -#endif
- -#ifdef INCLUDE_NI6510
- - { "NI6510", ni6510_probe, 0 },
- -#endif
- -#ifdef INCLUDE_SK_G16
- - { "SK_G16", SK_probe, 0 },
- -#endif
- -#ifdef INCLUDE_3C507
- - { "3C507", t507_probe, 0 },
- -#endif
- -#ifdef INCLUDE_NI5010
- - { "NI5010", ni5010_probe, 0 },
- -#endif
- -#ifdef INCLUDE_NI5210
- - { "NI5210", ni5210_probe, 0 },
- -#endif
- -#ifdef INCLUDE_EXOS205
- - { "EXOS205", exos205_probe, 0 },
- -#endif
- -#ifdef INCLUDE_SMC9000
- - { "SMC9000", smc9000_probe, 0 },
- -#endif
- -#ifdef INCLUDE_TIARA
- - { "TIARA", tiara_probe, 0 },
- -#endif
- -#ifdef INCLUDE_DEPCA
- - { "DEPCA", depca_probe, 0 },
- -#endif
- -#ifdef INCLUDE_NS8390
- - { "NE2000/PCI", nepci_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_LANCE
- - { "LANCE/PCI", lancepci_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_VIA_RHINE
- - { "VIA 86C100", rhine_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_W89C840
- - { "W89C840F", w89c840_probe, pci_ioaddrs },
- -#endif
- -#ifdef INCLUDE_TLAN
- - { "Olicom 2326", tlan_probe, pci_ioaddrs },
- -#endif
- - /* this entry must always be last to mark the end of list */
- - { 0, 0, 0 }
- -};
- -
- -#define NIC_TABLE_SIZE (sizeof (NIC) / sizeof (NIC[0]))
- -
- -static int
- -eth_dummy (struct nic *dummy)
- -{
- - return 0;
- + struct isa_probe_state *state = &dev->state.isa;
- + printf("Probing isa %s...\n", type_name);
- + if (dev->how_probe == PROBE_FIRST) {
- + state->advance = 0;
- + state->driver = isa_drivers;
- + dev->index = -1;
- + }
- + for(;;)
- + {
- + if ((dev->how_probe != PROBE_AWAKE) && state->advance) {
- + state->driver++;
- + dev->index = -1;
- + }
- + state->advance = 1;
- +
- + if (state->driver >= isa_drivers_end)
- + break;
- +
- + if (state->driver->type != dev->type)
- + continue;
- +
- + if (dev->how_probe != PROBE_AWAKE) {
- + dev->type_index++;
- + }
- + printf("[%s]", state->driver->name);
- + dev->devid.bus_type = ISA_BUS_TYPE;
- + /* FIXME how do I handle dev->index + PROBE_AGAIN?? */
- + /* driver will fill in vendor and device IDs */
- + if (state->driver->probe(dev, state->driver->ioaddrs)) {
- + state->advance = (dev->index == -1);
- + return PROBE_WORKED;
- + }
- + putchar('\n');
- + }
- + return PROBE_FAILED;
- }
- -
- -static char packet[ETH_FRAME_LEN];
- -
- -struct nic nic =
- -{
- - (void (*) (struct nic *)) eth_dummy, /* reset */
- - eth_dummy, /* poll */
- - (void (*) (struct nic *, const char *,
- - unsigned int, unsigned int,
- - const char *)) eth_dummy, /* transmit */
- - (void (*) (struct nic *)) eth_dummy, /* disable */
- -#ifdef T503_AUI
- - 1, /* aui */
- #else
- - 0, /* no aui */
- +#define isa_probe(d,tn) (PROBE_FAILED)
- #endif
- - &rom, /* rom_info */
- - arptable[ARP_CLIENT].node, /* node_addr */
- - packet, /* packet */
- - 0, /* packetlen */
- - 0, /* priv_data */
- +static const char *driver_name[] = {
- + "nic",
- + "disk",
- + "floppy",
- };
- -
- -void
- -eth_reset (void)
- +int probe(struct dev *dev)
- {
- - (*nic.reset) (&nic);
- -}
- + const char *type_name;
-
- -int
- -eth_probe (void)
- -{
- - struct pci_device *p;
- - const struct dispatch_table *t;
- - static int probed = 0;
- + EnterFunction("probe");
-
- - /* If already probed, don't try to probe it any longer. */
- - if (probed)
- - return 1;
- -
- - /* Clear the ready flag. */
- - network_ready = 0;
- - /* Clear the ARP table. */
- - grub_memset ((char *) arptable, 0,
- - MAX_ARP * sizeof (struct arptable_t));
- -
- - p = 0;
- -
- -#ifdef INCLUDE_PCI
- - /* In GRUB, the ROM info is initialized here. */
- - rom = *((struct rom_info *) ROM_INFO_LOCATION);
- -
- - eth_pci_init(pci_nic_list);
- - pci_ioaddrs[0] = 0;
- - pci_ioaddrs[1] = 0;
- - /* at this point we have a list of possible PCI candidates
- - we just pick the first one with a non-zero ioaddr */
- - for (p = pci_nic_list; p->vendor != 0; ++p)
- - {
- - if (p->ioaddr != 0)
- - {
- - pci_ioaddrs[0] = p->ioaddr;
- - break;
- + type_name = "";
- + if ((dev->type >= 0) &&
- + (dev->type < sizeof(driver_name)/sizeof(driver_name[0]))) {
- + type_name = driver_name[dev->type];
- }
- - }
- -#endif
- -
- - etherboot_printf("Probing...");
- -
- -#ifdef INCLUDE_PCI
- - if (p->vendor)
- - {
- - struct pci_dispatch_table *pt;
- -
- - for (pt = PCI_NIC; pt->eth_probe != 0; pt++)
- - if (p->vendor == pt->vendor && p->dev_id == pt->dev_id)
- - {
- - etherboot_printf ("[%s]", p->name);
- - if ((pt->eth_probe) (&nic, pci_ioaddrs, p))
- - {
- - probed = 1;
- - return 1;
- - }
- - }
- - }
- -#endif /* INCLUDE_PCI */
- -
- - for (t = NIC; t->nic_name != 0; ++t)
- - {
- - etherboot_printf("[%s]", t->nic_name);
- -#ifdef INCLUDE_PCI
- - if ((*t->eth_probe) (&nic, t->probe_ioaddrs, p))
- - {
- - probed = 1;
- - return 1;
- + if (dev->how_probe == PROBE_FIRST) {
- + dev->to_probe = PROBE_PCI;
- + memset(&dev->state, 0, sizeof(dev->state));
- }
- -#else
- - if ((*t->eth_probe) (&nic, t->probe_ioaddrs))
- - {
- - probed = 1;
- - return 1;
- + if (dev->to_probe == PROBE_PCI) {
- + dev->how_probe = pci_probe(dev, type_name);
- + if (dev->how_probe == PROBE_FAILED) {
- + dev->to_probe = PROBE_ISA;
- + }
- + }
- + if (dev->to_probe == PROBE_ISA) {
- + dev->how_probe = isa_probe(dev, type_name);
- + if (dev->how_probe == PROBE_FAILED) {
- + dev->to_probe = PROBE_NONE;
- + }
- + }
- + if ((dev->to_probe != PROBE_PCI) &&
- + (dev->to_probe != PROBE_ISA)) {
- + dev->how_probe = PROBE_FAILED;
- +
- }
- -#endif /* INCLUDE_PCI */
- - }
- -
- - return 0;
- -}
- -
- -int
- -eth_poll (void)
- -{
- - return ((*nic.poll) (&nic));
- -}
-
- -void
- -eth_transmit (const char *d, unsigned int t, unsigned int s, const void *p)
- -{
- - (*nic.transmit) (&nic, d, t, s, p);
- - if (t == IP)
- - twiddle ();
- + LeaveFunction("probe");
- + return dev->how_probe;
- }
-
- -void
- -eth_disable (void)
- +void disable(struct dev *dev)
- {
- - (*nic.disable) (&nic);
- + if (dev->disable) {
- + dev->disable(dev);
- + dev->disable = 0;
- + }
- }
- diff -Naur grub-0.97.orig/netboot/cpu.h grub-0.97/netboot/cpu.h
- --- grub-0.97.orig/netboot/cpu.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/cpu.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,243 @@
- +#ifndef I386_BITS_CPU_H
- +#define I386_BITS_CPU_H
- +
- +
- +/* Sample usage: CPU_FEATURE_P(cpu.x86_capability, FPU) */
- +#define CPU_FEATURE_P(CAP, FEATURE) \
- + (!!(CAP[(X86_FEATURE_##FEATURE)/32] & ((X86_FEATURE_##FEATURE) & 0x1f)))
- +
- +#define NCAPINTS 4 /* Currently we have 4 32-bit words worth of info */
- +
- +/* Intel-defined CPU features, CPUID level 0x00000001, word 0 */
- +#define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */
- +#define X86_FEATURE_VME (0*32+ 1) /* Virtual Mode Extensions */
- +#define X86_FEATURE_DE (0*32+ 2) /* Debugging Extensions */
- +#define X86_FEATURE_PSE (0*32+ 3) /* Page Size Extensions */
- +#define X86_FEATURE_TSC (0*32+ 4) /* Time Stamp Counter */
- +#define X86_FEATURE_MSR (0*32+ 5) /* Model-Specific Registers, RDMSR, WRMSR */
- +#define X86_FEATURE_PAE (0*32+ 6) /* Physical Address Extensions */
- +#define X86_FEATURE_MCE (0*32+ 7) /* Machine Check Architecture */
- +#define X86_FEATURE_CX8 (0*32+ 8) /* CMPXCHG8 instruction */
- +#define X86_FEATURE_APIC (0*32+ 9) /* Onboard APIC */
- +#define X86_FEATURE_SEP (0*32+11) /* SYSENTER/SYSEXIT */
- +#define X86_FEATURE_MTRR (0*32+12) /* Memory Type Range Registers */
- +#define X86_FEATURE_PGE (0*32+13) /* Page Global Enable */
- +#define X86_FEATURE_MCA (0*32+14) /* Machine Check Architecture */
- +#define X86_FEATURE_CMOV (0*32+15) /* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */
- +#define X86_FEATURE_PAT (0*32+16) /* Page Attribute Table */
- +#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */
- +#define X86_FEATURE_PN (0*32+18) /* Processor serial number */
- +#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */
- +#define X86_FEATURE_DTES (0*32+21) /* Debug Trace Store */
- +#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */
- +#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */
- +#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */
- + /* of FPU context), and CR4.OSFXSR available */
- +#define X86_FEATURE_XMM (0*32+25) /* Streaming SIMD Extensions */
- +#define X86_FEATURE_XMM2 (0*32+26) /* Streaming SIMD Extensions-2 */
- +#define X86_FEATURE_SELFSNOOP (0*32+27) /* CPU self snoop */
- +#define X86_FEATURE_HT (0*32+28) /* Hyper-Threading */
- +#define X86_FEATURE_ACC (0*32+29) /* Automatic clock control */
- +#define X86_FEATURE_IA64 (0*32+30) /* IA-64 processor */
- +
- +/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */
- +/* Don't duplicate feature flags which are redundant with Intel! */
- +#define X86_FEATURE_SYSCALL (1*32+11) /* SYSCALL/SYSRET */
- +#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */
- +#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */
- +#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */
- +#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */
- +
- +/* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */
- +#define X86_FEATURE_RECOVERY (2*32+ 0) /* CPU in recovery mode */
- +#define X86_FEATURE_LONGRUN (2*32+ 1) /* Longrun power control */
- +#define X86_FEATURE_LRTI (2*32+ 3) /* LongRun table interface */
- +
- +/* Other features, Linux-defined mapping, word 3 */
- +/* This range is used for feature bits which conflict or are synthesized */
- +#define X86_FEATURE_CXMMX (3*32+ 0) /* Cyrix MMX extensions */
- +#define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */
- +#define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */
- +#define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */
- +
- +#define MAX_X86_VENDOR_ID 16
- +struct cpuinfo_x86 {
- + uint8_t x86; /* CPU family */
- + uint8_t x86_model;
- + uint8_t x86_mask;
- +
- + int cpuid_level; /* Maximum supported CPUID level, -1=no CPUID */
- + unsigned x86_capability[NCAPINTS];
- + char x86_vendor_id[MAX_X86_VENDOR_ID];
- +};
- +
- +
- +#define X86_VENDOR_INTEL 0
- +#define X86_VENDOR_CYRIX 1
- +#define X86_VENDOR_AMD 2
- +#define X86_VENDOR_UMC 3
- +#define X86_VENDOR_NEXGEN 4
- +#define X86_VENDOR_CENTAUR 5
- +#define X86_VENDOR_RISE 6
- +#define X86_VENDOR_TRANSMETA 7
- +#define X86_VENDOR_NSC 8
- +#define X86_VENDOR_UNKNOWN 0xff
- +
- +/*
- + * EFLAGS bits
- + */
- +#define X86_EFLAGS_CF 0x00000001 /* Carry Flag */
- +#define X86_EFLAGS_PF 0x00000004 /* Parity Flag */
- +#define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */
- +#define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */
- +#define X86_EFLAGS_SF 0x00000080 /* Sign Flag */
- +#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */
- +#define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */
- +#define X86_EFLAGS_DF 0x00000400 /* Direction Flag */
- +#define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */
- +#define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */
- +#define X86_EFLAGS_NT 0x00004000 /* Nested Task */
- +#define X86_EFLAGS_RF 0x00010000 /* Resume Flag */
- +#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */
- +#define X86_EFLAGS_AC 0x00040000 /* Alignment Check */
- +#define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */
- +#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */
- +#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */
- +
- +/*
- + * Generic CPUID function
- + */
- +static inline void cpuid(int op,
- + unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx)
- +{
- + __asm__("cpuid"
- + : "=a" (*eax),
- + "=b" (*ebx),
- + "=c" (*ecx),
- + "=d" (*edx)
- + : "0" (op));
- +}
- +
- +/*
- + * CPUID functions returning a single datum
- + */
- +static inline unsigned int cpuid_eax(unsigned int op)
- +{
- + unsigned int eax;
- +
- + __asm__("cpuid"
- + : "=a" (eax)
- + : "0" (op)
- + : "bx", "cx", "dx");
- + return eax;
- +}
- +static inline unsigned int cpuid_ebx(unsigned int op)
- +{
- + unsigned int eax, ebx;
- +
- + __asm__("cpuid"
- + : "=a" (eax), "=b" (ebx)
- + : "0" (op)
- + : "cx", "dx" );
- + return ebx;
- +}
- +static inline unsigned int cpuid_ecx(unsigned int op)
- +{
- + unsigned int eax, ecx;
- +
- + __asm__("cpuid"
- + : "=a" (eax), "=c" (ecx)
- + : "0" (op)
- + : "bx", "dx" );
- + return ecx;
- +}
- +static inline unsigned int cpuid_edx(unsigned int op)
- +{
- + unsigned int eax, edx;
- +
- + __asm__("cpuid"
- + : "=a" (eax), "=d" (edx)
- + : "0" (op)
- + : "bx", "cx");
- + return edx;
- +}
- +
- +/*
- + * Intel CPU features in CR4
- + */
- +#define X86_CR4_VME 0x0001 /* enable vm86 extensions */
- +#define X86_CR4_PVI 0x0002 /* virtual interrupts flag enable */
- +#define X86_CR4_TSD 0x0004 /* disable time stamp at ipl 3 */
- +#define X86_CR4_DE 0x0008 /* enable debugging extensions */
- +#define X86_CR4_PSE 0x0010 /* enable page size extensions */
- +#define X86_CR4_PAE 0x0020 /* enable physical address extensions */
- +#define X86_CR4_MCE 0x0040 /* Machine check enable */
- +#define X86_CR4_PGE 0x0080 /* enable global pages */
- +#define X86_CR4_PCE 0x0100 /* enable performance counters at ipl 3 */
- +#define X86_CR4_OSFXSR 0x0200 /* enable fast FPU save and restore */
- +#define X86_CR4_OSXMMEXCPT 0x0400 /* enable unmasked SSE exceptions */
- +
- +
- +#define MSR_K6_EFER 0xC0000080
- +/* EFER bits: */
- +#define _EFER_SCE 0 /* SYSCALL/SYSRET */
- +#define _EFER_LME 8 /* Long mode enable */
- +#define _EFER_LMA 10 /* Long mode active (read-only) */
- +#define _EFER_NX 11 /* No execute enable */
- +
- +#define EFER_SCE (1<<_EFER_SCE)
- +#define EFER_LME (1<<EFER_LME)
- +#define EFER_LMA (1<<EFER_LMA)
- +#define EFER_NX (1<<_EFER_NX)
- +
- +#define rdmsr(msr,val1,val2) \
- + __asm__ __volatile__("rdmsr" \
- + : "=a" (val1), "=d" (val2) \
- + : "c" (msr))
- +
- +#define wrmsr(msr,val1,val2) \
- + __asm__ __volatile__("wrmsr" \
- + : /* no outputs */ \
- + : "c" (msr), "a" (val1), "d" (val2))
- +
- +
- +#define read_cr0() ({ \
- + unsigned int __dummy; \
- + __asm__( \
- + "movl %%cr0, %0\n\t" \
- + :"=r" (__dummy)); \
- + __dummy; \
- +})
- +#define write_cr0(x) \
- + __asm__("movl %0,%%cr0": :"r" (x));
- +
- +#define read_cr3() ({ \
- + unsigned int __dummy; \
- + __asm__( \
- + "movl %%cr3, %0\n\t" \
- + :"=r" (__dummy)); \
- + __dummy; \
- +})
- +#define write_cr3x(x) \
- + __asm__("movl %0,%%cr3": :"r" (x));
- +
- +
- +#define read_cr4() ({ \
- + unsigned int __dummy; \
- + __asm__( \
- + "movl %%cr4, %0\n\t" \
- + :"=r" (__dummy)); \
- + __dummy; \
- +})
- +#define write_cr4x(x) \
- + __asm__("movl %0,%%cr4": :"r" (x));
- +
- +
- +extern struct cpuinfo_x86 cpu_info;
- +#ifdef CONFIG_X86_64
- +extern void cpu_setup(void);
- +#else
- +#define cpu_setup() do {} while(0)
- +#endif
- +
- +#endif /* I386_BITS_CPU_H */
- diff -Naur grub-0.97.orig/netboot/cs89x0.c grub-0.97/netboot/cs89x0.c
- --- grub-0.97.orig/netboot/cs89x0.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/cs89x0.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,659 +0,0 @@
- -/* cs89x0.c: A Crystal Semiconductor CS89[02]0 driver for etherboot. */
- -/*
- - Permission is granted to distribute the enclosed cs89x0.[ch] driver
- - only in conjunction with the Etherboot package. The code is
- - ordinarily distributed under the GPL.
- -
- - Russ Nelson, January 2000
- -
- - ChangeLog:
- -
- - Thu Dec 6 22:40:00 1996 Markus Gutschke <gutschk@math.uni-muenster.de>
- -
- - * disabled all "advanced" features; this should make the code more reliable
- -
- - * reorganized the reset function
- -
- - * always reset the address port, so that autoprobing will continue working
- -
- - * some cosmetic changes
- -
- - * 2.5
- -
- - Thu Dec 5 21:00:00 1996 Markus Gutschke <gutschk@math.uni-muenster.de>
- -
- - * tested the code against a CS8900 card
- -
- - * lots of minor bug fixes and adjustments
- -
- - * this is the first release, that actually works! it still requires some
- - changes in order to be more tolerant to different environments
- -
- - * 4
- -
- - Fri Nov 22 23:00:00 1996 Markus Gutschke <gutschk@math.uni-muenster.de>
- -
- - * read the manuals for the CS89x0 chipsets and took note of all the
- - changes that will be neccessary in order to adapt Russel Nelson's code
- - to the requirements of a BOOT-Prom
- -
- - * 6
- -
- - Thu Nov 19 22:00:00 1996 Markus Gutschke <gutschk@math.uni-muenster.de>
- -
- - * Synched with Russel Nelson's current code (v1.00)
- -
- - * 2
- -
- - Thu Nov 12 18:00:00 1996 Markus Gutschke <gutschk@math.uni-muenster.de>
- -
- - * Cleaned up some of the code and tried to optimize the code size.
- -
- - * 1.5
- -
- - Sun Nov 10 16:30:00 1996 Markus Gutschke <gutschk@math.uni-muenster.de>
- -
- - * First experimental release. This code compiles fine, but I
- - have no way of testing whether it actually works.
- -
- - * I did not (yet) bother to make the code 16bit aware, so for
- - the time being, it will only work for Etherboot/32.
- -
- - * 12
- -
- - */
- -
- -#include "etherboot.h"
- -#include "nic.h"
- -#include "cards.h"
- -#include "cs89x0.h"
- -
- -static unsigned short eth_nic_base;
- -static unsigned long eth_mem_start;
- -static unsigned short eth_irq;
- -static unsigned short eth_cs_type; /* one of: CS8900, CS8920, CS8920M */
- -static unsigned short eth_auto_neg_cnf;
- -static unsigned short eth_adapter_cnf;
- -static unsigned short eth_linectl;
- -
- -/*************************************************************************
- - CS89x0 - specific routines
- -**************************************************************************/
- -
- -static inline int readreg(int portno)
- -{
- - outw(portno, eth_nic_base + ADD_PORT);
- - return inw(eth_nic_base + DATA_PORT);
- -}
- -
- -static inline void writereg(int portno, int value)
- -{
- - outw(portno, eth_nic_base + ADD_PORT);
- - outw(value, eth_nic_base + DATA_PORT);
- - return;
- -}
- -
- -/*************************************************************************
- -EEPROM access
- -**************************************************************************/
- -
- -static int wait_eeprom_ready(void)
- -{
- - unsigned long tmo = currticks() + 4*TICKS_PER_SEC;
- -
- - /* check to see if the EEPROM is ready, a timeout is used -
- - just in case EEPROM is ready when SI_BUSY in the
- - PP_SelfST is clear */
- - while(readreg(PP_SelfST) & SI_BUSY) {
- - if (currticks() >= tmo)
- - return -1; }
- - return 0;
- -}
- -
- -static int get_eeprom_data(int off, int len, unsigned short *buffer)
- -{
- - int i;
- -
- -#ifdef EDEBUG
- - printf("\ncs: EEPROM data from %hX for %hX:",off,len);
- -#endif
- - for (i = 0; i < len; i++) {
- - if (wait_eeprom_ready() < 0)
- - return -1;
- - /* Now send the EEPROM read command and EEPROM location
- - to read */
- - writereg(PP_EECMD, (off + i) | EEPROM_READ_CMD);
- - if (wait_eeprom_ready() < 0)
- - return -1;
- - buffer[i] = readreg(PP_EEData);
- -#ifdef EDEBUG
- - if (!(i%10))
- - printf("\ncs: ");
- - printf("%hX ", buffer[i]);
- -#endif
- - }
- -#ifdef EDEBUG
- - putchar('\n');
- -#endif
- -
- - return(0);
- -}
- -
- -static int get_eeprom_chksum(int off, int len, unsigned short *buffer)
- -{
- - int i, cksum;
- -
- - cksum = 0;
- - for (i = 0; i < len; i++)
- - cksum += buffer[i];
- - cksum &= 0xffff;
- - if (cksum == 0)
- - return 0;
- - return -1;
- -}
- -
- -/*************************************************************************
- -Activate all of the available media and probe for network
- -**************************************************************************/
- -
- -static void clrline(void)
- -{
- - int i;
- -
- - putchar('\r');
- - for (i = 79; i--; ) putchar(' ');
- - printf("\rcs: ");
- - return;
- -}
- -
- -static void control_dc_dc(int on_not_off)
- -{
- - unsigned int selfcontrol;
- - unsigned long tmo = currticks() + TICKS_PER_SEC;
- -
- - /* control the DC to DC convertor in the SelfControl register. */
- - selfcontrol = HCB1_ENBL; /* Enable the HCB1 bit as an output */
- - if (((eth_adapter_cnf & A_CNF_DC_DC_POLARITY) != 0) ^ on_not_off)
- - selfcontrol |= HCB1;
- - else
- - selfcontrol &= ~HCB1;
- - writereg(PP_SelfCTL, selfcontrol);
- -
- - /* Wait for the DC/DC converter to power up - 1000ms */
- - while (currticks() < tmo);
- -
- - return;
- -}
- -
- -static int detect_tp(void)
- -{
- - unsigned long tmo;
- -
- - /* Turn on the chip auto detection of 10BT/ AUI */
- -
- - clrline(); printf("attempting %s:","TP");
- -
- - /* If connected to another full duplex capable 10-Base-T card
- - the link pulses seem to be lost when the auto detect bit in
- - the LineCTL is set. To overcome this the auto detect bit
- - will be cleared whilst testing the 10-Base-T interface.
- - This would not be necessary for the sparrow chip but is
- - simpler to do it anyway. */
- - writereg(PP_LineCTL, eth_linectl &~ AUI_ONLY);
- - control_dc_dc(0);
- -
- - /* Delay for the hardware to work out if the TP cable is
- - present - 150ms */
- - for (tmo = currticks() + 4; currticks() < tmo; );
- -
- - if ((readreg(PP_LineST) & LINK_OK) == 0)
- - return 0;
- -
- - if (eth_cs_type != CS8900) {
- -
- - writereg(PP_AutoNegCTL, eth_auto_neg_cnf & AUTO_NEG_MASK);
- -
- - if ((eth_auto_neg_cnf & AUTO_NEG_BITS) == AUTO_NEG_ENABLE) {
- - printf(" negotiating duplex... ");
- - while (readreg(PP_AutoNegST) & AUTO_NEG_BUSY) {
- - if (currticks() - tmo > 40*TICKS_PER_SEC) {
- - printf("time out ");
- - break;
- - }
- - }
- - }
- - if (readreg(PP_AutoNegST) & FDX_ACTIVE)
- - printf("using full duplex");
- - else
- - printf("using half duplex");
- - }
- -
- - return A_CNF_MEDIA_10B_T;
- -}
- -
- -/* send a test packet - return true if carrier bits are ok */
- -static int send_test_pkt(struct nic *nic)
- -{
- - static unsigned char testpacket[] = { 0,0,0,0,0,0, 0,0,0,0,0,0,
- - 0, 46, /*A 46 in network order */
- - 0, 0, /*DSAP=0 & SSAP=0 fields */
- - 0xf3,0 /*Control (Test Req+P bit set)*/ };
- - unsigned long tmo;
- -
- - writereg(PP_LineCTL, readreg(PP_LineCTL) | SERIAL_TX_ON);
- -
- - memcpy(testpacket, nic->node_addr, ETH_ALEN);
- - memcpy(testpacket+ETH_ALEN, nic->node_addr, ETH_ALEN);
- -
- - outw(TX_AFTER_ALL, eth_nic_base + TX_CMD_PORT);
- - outw(ETH_ZLEN, eth_nic_base + TX_LEN_PORT);
- -
- - /* Test to see if the chip has allocated memory for the packet */
- - for (tmo = currticks() + 2;
- - (readreg(PP_BusST) & READY_FOR_TX_NOW) == 0; )
- - if (currticks() >= tmo)
- - return(0);
- -
- - /* Write the contents of the packet */
- - outsw(eth_nic_base + TX_FRAME_PORT, testpacket,
- - (ETH_ZLEN+1)>>1);
- -
- - printf(" sending test packet ");
- - /* wait a couple of timer ticks for packet to be received */
- - for (tmo = currticks() + 2; currticks() < tmo; );
- -
- - if ((readreg(PP_TxEvent) & TX_SEND_OK_BITS) == TX_OK) {
- - printf("succeeded");
- - return 1;
- - }
- - printf("failed");
- - return 0;
- -}
- -
- -
- -static int detect_aui(struct nic *nic)
- -{
- - clrline(); printf("attempting %s:","AUI");
- - control_dc_dc(0);
- -
- - writereg(PP_LineCTL, (eth_linectl & ~AUTO_AUI_10BASET) | AUI_ONLY);
- -
- - if (send_test_pkt(nic)) {
- - return A_CNF_MEDIA_AUI; }
- - else
- - return 0;
- -}
- -
- -static int detect_bnc(struct nic *nic)
- -{
- - clrline(); printf("attempting %s:","BNC");
- - control_dc_dc(1);
- -
- - writereg(PP_LineCTL, (eth_linectl & ~AUTO_AUI_10BASET) | AUI_ONLY);
- -
- - if (send_test_pkt(nic)) {
- - return A_CNF_MEDIA_10B_2; }
- - else
- - return 0;
- -}
- -
- -/**************************************************************************
- -ETH_RESET - Reset adapter
- -***************************************************************************/
- -
- -static void cs89x0_reset(struct nic *nic)
- -{
- - int i;
- - unsigned long reset_tmo;
- -
- - writereg(PP_SelfCTL, readreg(PP_SelfCTL) | POWER_ON_RESET);
- -
- - /* wait for two ticks; that is 2*55ms */
- - for (reset_tmo = currticks() + 2; currticks() < reset_tmo; );
- -
- - if (eth_cs_type != CS8900) {
- - /* Hardware problem requires PNP registers to be reconfigured
- - after a reset */
- - if (eth_irq != 0xFFFF) {
- - outw(PP_CS8920_ISAINT, eth_nic_base + ADD_PORT);
- - outb(eth_irq, eth_nic_base + DATA_PORT);
- - outb(0, eth_nic_base + DATA_PORT + 1); }
- -
- - if (eth_mem_start) {
- - outw(PP_CS8920_ISAMemB, eth_nic_base + ADD_PORT);
- - outb((eth_mem_start >> 8) & 0xff, eth_nic_base + DATA_PORT);
- - outb((eth_mem_start >> 24) & 0xff, eth_nic_base + DATA_PORT + 1); } }
- -
- - /* Wait until the chip is reset */
- - for (reset_tmo = currticks() + 2;
- - (readreg(PP_SelfST) & INIT_DONE) == 0 &&
- - currticks() < reset_tmo; );
- -
- - /* disable interrupts and memory accesses */
- - writereg(PP_BusCTL, 0);
- -
- - /* set the ethernet address */
- - for (i=0; i < ETH_ALEN/2; i++)
- - writereg(PP_IA+i*2,
- - nic->node_addr[i*2] |
- - (nic->node_addr[i*2+1] << 8));
- -
- - /* receive only error free packets addressed to this card */
- - writereg(PP_RxCTL, DEF_RX_ACCEPT);
- -
- - /* do not generate any interrupts on receive operations */
- - writereg(PP_RxCFG, 0);
- -
- - /* do not generate any interrupts on transmit operations */
- - writereg(PP_TxCFG, 0);
- -
- - /* do not generate any interrupts on buffer operations */
- - writereg(PP_BufCFG, 0);
- -
- - /* reset address port, so that autoprobing will keep working */
- - outw(PP_ChipID, eth_nic_base + ADD_PORT);
- -
- - return;
- -}
- -
- -/**************************************************************************
- -ETH_TRANSMIT - Transmit a frame
- -***************************************************************************/
- -
- -static void cs89x0_transmit(
- - struct nic *nic,
- - const char *d, /* Destination */
- - unsigned int t, /* Type */
- - unsigned int s, /* size */
- - const char *p) /* Packet */
- -{
- - unsigned long tmo;
- - int sr;
- -
- - /* does this size have to be rounded??? please,
- - somebody have a look in the specs */
- - if ((sr = ((s + ETH_HLEN + 1)&~1)) < ETH_ZLEN)
- - sr = ETH_ZLEN;
- -
- -retry:
- - /* initiate a transmit sequence */
- - outw(TX_AFTER_ALL, eth_nic_base + TX_CMD_PORT);
- - outw(sr, eth_nic_base + TX_LEN_PORT);
- -
- - /* Test to see if the chip has allocated memory for the packet */
- - if ((readreg(PP_BusST) & READY_FOR_TX_NOW) == 0) {
- - /* Oops... this should not happen! */
- - printf("cs: unable to send packet; retrying...\n");
- - for (tmo = currticks() + 5*TICKS_PER_SEC; currticks() < tmo; );
- - cs89x0_reset(nic);
- - goto retry; }
- -
- - /* Write the contents of the packet */
- - outsw(eth_nic_base + TX_FRAME_PORT, d, ETH_ALEN/2);
- - outsw(eth_nic_base + TX_FRAME_PORT, nic->node_addr,
- - ETH_ALEN/2);
- - outw(((t >> 8)&0xFF)|(t << 8), eth_nic_base + TX_FRAME_PORT);
- - outsw(eth_nic_base + TX_FRAME_PORT, p, (s+1)/2);
- - for (sr = sr/2 - (s+1)/2 - ETH_ALEN - 1; sr-- > 0;
- - outw(0, eth_nic_base + TX_FRAME_PORT));
- -
- - /* wait for transfer to succeed */
- - for (tmo = currticks()+5*TICKS_PER_SEC;
- - (s = readreg(PP_TxEvent)&~0x1F) == 0 && currticks() < tmo;)
- - /* nothing */ ;
- - if ((s & TX_SEND_OK_BITS) != TX_OK) {
- - printf("\ntransmission error %#hX\n", s);
- - }
- -
- - return;
- -}
- -
- -/**************************************************************************
- -ETH_POLL - Wait for a frame
- -***************************************************************************/
- -
- -static int cs89x0_poll(struct nic *nic)
- -{
- - int status;
- -
- - status = readreg(PP_RxEvent);
- -
- - if ((status & RX_OK) == 0)
- - return(0);
- -
- - status = inw(eth_nic_base + RX_FRAME_PORT);
- - nic->packetlen = inw(eth_nic_base + RX_FRAME_PORT);
- - insw(eth_nic_base + RX_FRAME_PORT, nic->packet, nic->packetlen >> 1);
- - if (nic->packetlen & 1)
- - nic->packet[nic->packetlen-1] = inw(eth_nic_base + RX_FRAME_PORT);
- - return 1;
- -}
- -
- -static void cs89x0_disable(struct nic *nic)
- -{
- - cs89x0_reset(nic);
- -}
- -
- -/**************************************************************************
- -ETH_PROBE - Look for an adapter
- -***************************************************************************/
- -
- -struct nic *cs89x0_probe(struct nic *nic, unsigned short *probe_addrs)
- -{
- - static const unsigned int netcard_portlist[] = {
- -#ifdef CS_SCAN
- - CS_SCAN,
- -#else /* use "conservative" default values for autoprobing */
- - 0x300,0x320,0x340,0x200,0x220,0x240,
- - 0x260,0x280,0x2a0,0x2c0,0x2e0,
- - /* if that did not work, then be more aggressive */
- - 0x301,0x321,0x341,0x201,0x221,0x241,
- - 0x261,0x281,0x2a1,0x2c1,0x2e1,
- -#endif
- - 0};
- -
- - int i, result = -1;
- - unsigned rev_type = 0, ioaddr, ioidx, isa_cnf, cs_revision;
- - unsigned short eeprom_buff[CHKSUM_LEN];
- -
- -
- - for (ioidx = 0; (ioaddr=netcard_portlist[ioidx++]) != 0; ) {
- - /* if they give us an odd I/O address, then do ONE write to
- - the address port, to get it back to address zero, where we
- - expect to find the EISA signature word. */
- - if (ioaddr & 1) {
- - ioaddr &= ~1;
- - if ((inw(ioaddr + ADD_PORT) & ADD_MASK) != ADD_SIG)
- - continue;
- - outw(PP_ChipID, ioaddr + ADD_PORT);
- - }
- -
- - if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG)
- - continue;
- - eth_nic_base = ioaddr;
- -
- - /* get the chip type */
- - rev_type = readreg(PRODUCT_ID_ADD);
- - eth_cs_type = rev_type &~ REVISON_BITS;
- - cs_revision = ((rev_type & REVISON_BITS) >> 8) + 'A';
- -
- - printf("\ncs: cs89%c0%s rev %c, base %#hX",
- - eth_cs_type==CS8900?'0':'2',
- - eth_cs_type==CS8920M?"M":"",
- - cs_revision,
- - eth_nic_base);
- -
- - /* First check to see if an EEPROM is attached*/
- - if ((readreg(PP_SelfST) & EEPROM_PRESENT) == 0) {
- - printf("\ncs: no EEPROM...\n");
- - outw(PP_ChipID, eth_nic_base + ADD_PORT);
- - continue; }
- - else if (get_eeprom_data(START_EEPROM_DATA,CHKSUM_LEN,
- - eeprom_buff) < 0) {
- - printf("\ncs: EEPROM read failed...\n");
- - outw(PP_ChipID, eth_nic_base + ADD_PORT);
- - continue; }
- - else if (get_eeprom_chksum(START_EEPROM_DATA,CHKSUM_LEN,
- - eeprom_buff) < 0) {
- - printf("\ncs: EEPROM checksum bad...\n");
- - outw(PP_ChipID, eth_nic_base + ADD_PORT);
- - continue; }
- -
- - /* get transmission control word but keep the
- - autonegotiation bits */
- - eth_auto_neg_cnf = eeprom_buff[AUTO_NEG_CNF_OFFSET/2];
- - /* Store adapter configuration */
- - eth_adapter_cnf = eeprom_buff[ADAPTER_CNF_OFFSET/2];
- - /* Store ISA configuration */
- - isa_cnf = eeprom_buff[ISA_CNF_OFFSET/2];
- -
- - /* store the initial memory base address */
- - eth_mem_start = eeprom_buff[PACKET_PAGE_OFFSET/2] << 8;
- -
- - printf("%s%s%s, addr ",
- - (eth_adapter_cnf & A_CNF_10B_T)?", RJ-45":"",
- - (eth_adapter_cnf & A_CNF_AUI)?", AUI":"",
- - (eth_adapter_cnf & A_CNF_10B_2)?", BNC":"");
- -
- - /* If this is a CS8900 then no pnp soft */
- - if (eth_cs_type != CS8900 &&
- - /* Check if the ISA IRQ has been set */
- - (i = readreg(PP_CS8920_ISAINT) & 0xff,
- - (i != 0 && i < CS8920_NO_INTS)))
- - eth_irq = i;
- - else {
- - i = isa_cnf & INT_NO_MASK;
- - if (eth_cs_type == CS8900) {
- - /* the table that follows is dependent
- - upon how you wired up your cs8900
- - in your system. The table is the
- - same as the cs8900 engineering demo
- - board. irq_map also depends on the
- - contents of the table. Also see
- - write_irq, which is the reverse
- - mapping of the table below. */
- - if (i < 4) i = "\012\013\014\005"[i];
- - else printf("\ncs: BUG: isa_config is %d\n", i); }
- - eth_irq = i; }
- -
- - /* Retrieve and print the ethernet address. */
- - for (i=0; i<ETH_ALEN; i++) {
- - nic->node_addr[i] = ((unsigned char *)eeprom_buff)[i];
- - }
- - printf("%!\n", nic->node_addr);
- -
- - /* Set the LineCTL quintuplet based on adapter
- - configuration read from EEPROM */
- - if ((eth_adapter_cnf & A_CNF_EXTND_10B_2) &&
- - (eth_adapter_cnf & A_CNF_LOW_RX_SQUELCH))
- - eth_linectl = LOW_RX_SQUELCH;
- - else
- - eth_linectl = 0;
- -
- - /* check to make sure that they have the "right"
- - hardware available */
- - switch(eth_adapter_cnf & A_CNF_MEDIA_TYPE) {
- - case A_CNF_MEDIA_10B_T: result = eth_adapter_cnf & A_CNF_10B_T;
- - break;
- - case A_CNF_MEDIA_AUI: result = eth_adapter_cnf & A_CNF_AUI;
- - break;
- - case A_CNF_MEDIA_10B_2: result = eth_adapter_cnf & A_CNF_10B_2;
- - break;
- - default: result = eth_adapter_cnf & (A_CNF_10B_T | A_CNF_AUI |
- - A_CNF_10B_2);
- - }
- - if (!result) {
- - printf("cs: EEPROM is configured for unavailable media\n");
- - error:
- - writereg(PP_LineCTL, readreg(PP_LineCTL) &
- - ~(SERIAL_TX_ON | SERIAL_RX_ON));
- - outw(PP_ChipID, eth_nic_base + ADD_PORT);
- - continue;
- - }
- -
- - /* Initialize the card for probing of the attached media */
- - cs89x0_reset(nic);
- -
- - /* set the hardware to the configured choice */
- - switch(eth_adapter_cnf & A_CNF_MEDIA_TYPE) {
- - case A_CNF_MEDIA_10B_T:
- - result = detect_tp();
- - if (!result) {
- - clrline();
- - printf("10Base-T (RJ-45%s",
- - ") has no cable\n"); }
- - /* check "ignore missing media" bit */
- - if (eth_auto_neg_cnf & IMM_BIT)
- - /* Yes! I don't care if I see a link pulse */
- - result = A_CNF_MEDIA_10B_T;
- - break;
- - case A_CNF_MEDIA_AUI:
- - result = detect_aui(nic);
- - if (!result) {
- - clrline();
- - printf("10Base-5 (AUI%s",
- - ") has no cable\n"); }
- - /* check "ignore missing media" bit */
- - if (eth_auto_neg_cnf & IMM_BIT)
- - /* Yes! I don't care if I see a carrrier */
- - result = A_CNF_MEDIA_AUI;
- - break;
- - case A_CNF_MEDIA_10B_2:
- - result = detect_bnc(nic);
- - if (!result) {
- - clrline();
- - printf("10Base-2 (BNC%s",
- - ") has no cable\n"); }
- - /* check "ignore missing media" bit */
- - if (eth_auto_neg_cnf & IMM_BIT)
- - /* Yes! I don't care if I can xmit a packet */
- - result = A_CNF_MEDIA_10B_2;
- - break;
- - case A_CNF_MEDIA_AUTO:
- - writereg(PP_LineCTL, eth_linectl | AUTO_AUI_10BASET);
- - if (eth_adapter_cnf & A_CNF_10B_T)
- - if ((result = detect_tp()) != 0)
- - break;
- - if (eth_adapter_cnf & A_CNF_AUI)
- - if ((result = detect_aui(nic)) != 0)
- - break;
- - if (eth_adapter_cnf & A_CNF_10B_2)
- - if ((result = detect_bnc(nic)) != 0)
- - break;
- - clrline(); printf("no media detected\n");
- - goto error;
- - }
- - clrline();
- - switch(result) {
- - case 0: printf("no network cable attached to configured media\n");
- - goto error;
- - case A_CNF_MEDIA_10B_T: printf("using 10Base-T (RJ-45)\n");
- - break;
- - case A_CNF_MEDIA_AUI: printf("using 10Base-5 (AUI)\n");
- - break;
- - case A_CNF_MEDIA_10B_2: printf("using 10Base-2 (BNC)\n");
- - break;
- - }
- -
- - /* Turn on both receive and transmit operations */
- - writereg(PP_LineCTL, readreg(PP_LineCTL) | SERIAL_RX_ON |
- - SERIAL_TX_ON);
- -
- - break;
- - }
- -
- - if (ioaddr == 0)
- - return (0);
- - nic->reset = cs89x0_reset;
- - nic->poll = cs89x0_poll;
- - nic->transmit = cs89x0_transmit;
- - nic->disable = cs89x0_disable;
- - return (nic);
- -}
- -
- -/*
- - * Local variables:
- - * c-basic-offset: 8
- - * End:
- - */
- -
- diff -Naur grub-0.97.orig/netboot/cs89x0.h grub-0.97/netboot/cs89x0.h
- --- grub-0.97.orig/netboot/cs89x0.h 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/cs89x0.h 1970-01-01 00:00:00.000000000 +0000
- @@ -1,461 +0,0 @@
- -/* Copyright, 1988-1992, Russell Nelson, Crynwr Software
- -
- - This program is free software; you can redistribute it and/or modify
- - it under the terms of the GNU General Public License as published by
- - the Free Software Foundation, version 1.
- -
- - This program is distributed in the hope that it will be useful,
- - but WITHOUT ANY WARRANTY; without even the implied warranty of
- - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- - GNU General Public License for more details.
- -
- - You should have received a copy of the GNU General Public License
- - along with this program; if not, write to the Free Software
- - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
- -
- -#define PP_ChipID 0x0000 /* offset 0h -> Corp -ID */
- - /* offset 2h -> Model/Product Number */
- - /* offset 3h -> Chip Revision Number */
- -
- -#define PP_ISAIOB 0x0020 /* IO base address */
- -#define PP_CS8900_ISAINT 0x0022 /* ISA interrupt select */
- -#define PP_CS8920_ISAINT 0x0370 /* ISA interrupt select */
- -#define PP_CS8900_ISADMA 0x0024 /* ISA Rec DMA channel */
- -#define PP_CS8920_ISADMA 0x0374 /* ISA Rec DMA channel */
- -#define PP_ISASOF 0x0026 /* ISA DMA offset */
- -#define PP_DmaFrameCnt 0x0028 /* ISA DMA Frame count */
- -#define PP_DmaByteCnt 0x002A /* ISA DMA Byte count */
- -#define PP_CS8900_ISAMemB 0x002C /* Memory base */
- -#define PP_CS8920_ISAMemB 0x0348 /* */
- -
- -#define PP_ISABootBase 0x0030 /* Boot Prom base */
- -#define PP_ISABootMask 0x0034 /* Boot Prom Mask */
- -
- -/* EEPROM data and command registers */
- -#define PP_EECMD 0x0040 /* NVR Interface Command register */
- -#define PP_EEData 0x0042 /* NVR Interface Data Register */
- -#define PP_DebugReg 0x0044 /* Debug Register */
- -
- -#define PP_RxCFG 0x0102 /* Rx Bus config */
- -#define PP_RxCTL 0x0104 /* Receive Control Register */
- -#define PP_TxCFG 0x0106 /* Transmit Config Register */
- -#define PP_TxCMD 0x0108 /* Transmit Command Register */
- -#define PP_BufCFG 0x010A /* Bus configuration Register */
- -#define PP_LineCTL 0x0112 /* Line Config Register */
- -#define PP_SelfCTL 0x0114 /* Self Command Register */
- -#define PP_BusCTL 0x0116 /* ISA bus control Register */
- -#define PP_TestCTL 0x0118 /* Test Register */
- -#define PP_AutoNegCTL 0x011C /* Auto Negotiation Ctrl */
- -
- -#define PP_ISQ 0x0120 /* Interrupt Status */
- -#define PP_RxEvent 0x0124 /* Rx Event Register */
- -#define PP_TxEvent 0x0128 /* Tx Event Register */
- -#define PP_BufEvent 0x012C /* Bus Event Register */
- -#define PP_RxMiss 0x0130 /* Receive Miss Count */
- -#define PP_TxCol 0x0132 /* Transmit Collision Count */
- -#define PP_LineST 0x0134 /* Line State Register */
- -#define PP_SelfST 0x0136 /* Self State register */
- -#define PP_BusST 0x0138 /* Bus Status */
- -#define PP_TDR 0x013C /* Time Domain Reflectometry */
- -#define PP_AutoNegST 0x013E /* Auto Neg Status */
- -#define PP_TxCommand 0x0144 /* Tx Command */
- -#define PP_TxLength 0x0146 /* Tx Length */
- -#define PP_LAF 0x0150 /* Hash Table */
- -#define PP_IA 0x0158 /* Physical Address Register */
- -
- -#define PP_RxStatus 0x0400 /* Receive start of frame */
- -#define PP_RxLength 0x0402 /* Receive Length of frame */
- -#define PP_RxFrame 0x0404 /* Receive frame pointer */
- -#define PP_TxFrame 0x0A00 /* Transmit frame pointer */
- -
- -/* Primary I/O Base Address. If no I/O base is supplied by the user, then this */
- -/* can be used as the default I/O base to access the PacketPage Area. */
- -#define DEFAULTIOBASE 0x0300
- -#define FIRST_IO 0x020C /* First I/O port to check */
- -#define LAST_IO 0x037C /* Last I/O port to check (+10h) */
- -#define ADD_MASK 0x3000 /* Mask it use of the ADD_PORT register */
- -#define ADD_SIG 0x3000 /* Expected ID signature */
- -
- -#define CHIP_EISA_ID_SIG 0x630E /* Product ID Code for Crystal Chip (CS8900 spec 4.3) */
- -
- -#ifdef IBMEIPKT
- -#define EISA_ID_SIG 0x4D24 /* IBM */
- -#define PART_NO_SIG 0x1010 /* IBM */
- -#define MONGOOSE_BIT 0x0000 /* IBM */
- -#else
- -#define EISA_ID_SIG 0x630E /* PnP Vendor ID (same as chip id for Crystal board) */
- -#define PART_NO_SIG 0x4000 /* ID code CS8920 board (PnP Vendor Product code) */
- -#define MONGOOSE_BIT 0x2000 /* PART_NO_SIG + MONGOOSE_BUT => ID of mongoose */
- -#endif
- -
- -#define PRODUCT_ID_ADD 0x0002 /* Address of product ID */
- -
- -/* Mask to find out the types of registers */
- -#define REG_TYPE_MASK 0x001F
- -
- -/* Eeprom Commands */
- -#define ERSE_WR_ENBL 0x00F0
- -#define ERSE_WR_DISABLE 0x0000
- -
- -/* Defines Control/Config register quintuplet numbers */
- -#define RX_BUF_CFG 0x0003
- -#define RX_CONTROL 0x0005
- -#define TX_CFG 0x0007
- -#define TX_COMMAND 0x0009
- -#define BUF_CFG 0x000B
- -#define LINE_CONTROL 0x0013
- -#define SELF_CONTROL 0x0015
- -#define BUS_CONTROL 0x0017
- -#define TEST_CONTROL 0x0019
- -
- -/* Defines Status/Count registers quintuplet numbers */
- -#define RX_EVENT 0x0004
- -#define TX_EVENT 0x0008
- -#define BUF_EVENT 0x000C
- -#define RX_MISS_COUNT 0x0010
- -#define TX_COL_COUNT 0x0012
- -#define LINE_STATUS 0x0014
- -#define SELF_STATUS 0x0016
- -#define BUS_STATUS 0x0018
- -#define TDR 0x001C
- -
- -/* PP_RxCFG - Receive Configuration and Interrupt Mask bit definition - Read/write */
- -#define SKIP_1 0x0040
- -#define RX_STREAM_ENBL 0x0080
- -#define RX_OK_ENBL 0x0100
- -#define RX_DMA_ONLY 0x0200
- -#define AUTO_RX_DMA 0x0400
- -#define BUFFER_CRC 0x0800
- -#define RX_CRC_ERROR_ENBL 0x1000
- -#define RX_RUNT_ENBL 0x2000
- -#define RX_EXTRA_DATA_ENBL 0x4000
- -
- -/* PP_RxCTL - Receive Control bit definition - Read/write */
- -#define RX_IA_HASH_ACCEPT 0x0040
- -#define RX_PROM_ACCEPT 0x0080
- -#define RX_OK_ACCEPT 0x0100
- -#define RX_MULTCAST_ACCEPT 0x0200
- -#define RX_IA_ACCEPT 0x0400
- -#define RX_BROADCAST_ACCEPT 0x0800
- -#define RX_BAD_CRC_ACCEPT 0x1000
- -#define RX_RUNT_ACCEPT 0x2000
- -#define RX_EXTRA_DATA_ACCEPT 0x4000
- -#define RX_ALL_ACCEPT (RX_PROM_ACCEPT|RX_BAD_CRC_ACCEPT|RX_RUNT_ACCEPT|RX_EXTRA_DATA_ACCEPT)
- -/* Default receive mode - individually addressed, broadcast, and error free */
- -#define DEF_RX_ACCEPT (RX_IA_ACCEPT | RX_BROADCAST_ACCEPT | RX_OK_ACCEPT)
- -
- -/* PP_TxCFG - Transmit Configuration Interrupt Mask bit definition - Read/write */
- -#define TX_LOST_CRS_ENBL 0x0040
- -#define TX_SQE_ERROR_ENBL 0x0080
- -#define TX_OK_ENBL 0x0100
- -#define TX_LATE_COL_ENBL 0x0200
- -#define TX_JBR_ENBL 0x0400
- -#define TX_ANY_COL_ENBL 0x0800
- -#define TX_16_COL_ENBL 0x8000
- -
- -/* PP_TxCMD - Transmit Command bit definition - Read-only */
- -#define TX_START_4_BYTES 0x0000
- -#define TX_START_64_BYTES 0x0040
- -#define TX_START_128_BYTES 0x0080
- -#define TX_START_ALL_BYTES 0x00C0
- -#define TX_FORCE 0x0100
- -#define TX_ONE_COL 0x0200
- -#define TX_TWO_PART_DEFF_DISABLE 0x0400
- -#define TX_NO_CRC 0x1000
- -#define TX_RUNT 0x2000
- -
- -/* PP_BufCFG - Buffer Configuration Interrupt Mask bit definition - Read/write */
- -#define GENERATE_SW_INTERRUPT 0x0040
- -#define RX_DMA_ENBL 0x0080
- -#define READY_FOR_TX_ENBL 0x0100
- -#define TX_UNDERRUN_ENBL 0x0200
- -#define RX_MISS_ENBL 0x0400
- -#define RX_128_BYTE_ENBL 0x0800
- -#define TX_COL_COUNT_OVRFLOW_ENBL 0x1000
- -#define RX_MISS_COUNT_OVRFLOW_ENBL 0x2000
- -#define RX_DEST_MATCH_ENBL 0x8000
- -
- -/* PP_LineCTL - Line Control bit definition - Read/write */
- -#define SERIAL_RX_ON 0x0040
- -#define SERIAL_TX_ON 0x0080
- -#define AUI_ONLY 0x0100
- -#define AUTO_AUI_10BASET 0x0200
- -#define MODIFIED_BACKOFF 0x0800
- -#define NO_AUTO_POLARITY 0x1000
- -#define TWO_PART_DEFDIS 0x2000
- -#define LOW_RX_SQUELCH 0x4000
- -
- -/* PP_SelfCTL - Software Self Control bit definition - Read/write */
- -#define POWER_ON_RESET 0x0040
- -#define SW_STOP 0x0100
- -#define SLEEP_ON 0x0200
- -#define AUTO_WAKEUP 0x0400
- -#define HCB0_ENBL 0x1000
- -#define HCB1_ENBL 0x2000
- -#define HCB0 0x4000
- -#define HCB1 0x8000
- -
- -/* PP_BusCTL - ISA Bus Control bit definition - Read/write */
- -#define RESET_RX_DMA 0x0040
- -#define MEMORY_ON 0x0400
- -#define DMA_BURST_MODE 0x0800
- -#define IO_CHANNEL_READY_ON 0x1000
- -#define RX_DMA_SIZE_64K 0x2000
- -#define ENABLE_IRQ 0x8000
- -
- -/* PP_TestCTL - Test Control bit definition - Read/write */
- -#define LINK_OFF 0x0080
- -#define ENDEC_LOOPBACK 0x0200
- -#define AUI_LOOPBACK 0x0400
- -#define BACKOFF_OFF 0x0800
- -#define FAST_TEST 0x8000
- -
- -/* PP_RxEvent - Receive Event Bit definition - Read-only */
- -#define RX_IA_HASHED 0x0040
- -#define RX_DRIBBLE 0x0080
- -#define RX_OK 0x0100
- -#define RX_HASHED 0x0200
- -#define RX_IA 0x0400
- -#define RX_BROADCAST 0x0800
- -#define RX_CRC_ERROR 0x1000
- -#define RX_RUNT 0x2000
- -#define RX_EXTRA_DATA 0x4000
- -
- -#define HASH_INDEX_MASK 0x0FC00
- -
- -/* PP_TxEvent - Transmit Event Bit definition - Read-only */
- -#define TX_LOST_CRS 0x0040
- -#define TX_SQE_ERROR 0x0080
- -#define TX_OK 0x0100
- -#define TX_LATE_COL 0x0200
- -#define TX_JBR 0x0400
- -#define TX_16_COL 0x8000
- -#define TX_SEND_OK_BITS (TX_OK|TX_LOST_CRS)
- -#define TX_COL_COUNT_MASK 0x7800
- -
- -/* PP_BufEvent - Buffer Event Bit definition - Read-only */
- -#define SW_INTERRUPT 0x0040
- -#define RX_DMA 0x0080
- -#define READY_FOR_TX 0x0100
- -#define TX_UNDERRUN 0x0200
- -#define RX_MISS 0x0400
- -#define RX_128_BYTE 0x0800
- -#define TX_COL_OVRFLW 0x1000
- -#define RX_MISS_OVRFLW 0x2000
- -#define RX_DEST_MATCH 0x8000
- -
- -/* PP_LineST - Ethernet Line Status bit definition - Read-only */
- -#define LINK_OK 0x0080
- -#define AUI_ON 0x0100
- -#define TENBASET_ON 0x0200
- -#define POLARITY_OK 0x1000
- -#define CRS_OK 0x4000
- -
- -/* PP_SelfST - Chip Software Status bit definition */
- -#define ACTIVE_33V 0x0040
- -#define INIT_DONE 0x0080
- -#define SI_BUSY 0x0100
- -#define EEPROM_PRESENT 0x0200
- -#define EEPROM_OK 0x0400
- -#define EL_PRESENT 0x0800
- -#define EE_SIZE_64 0x1000
- -
- -/* PP_BusST - ISA Bus Status bit definition */
- -#define TX_BID_ERROR 0x0080
- -#define READY_FOR_TX_NOW 0x0100
- -
- -/* PP_AutoNegCTL - Auto Negotiation Control bit definition */
- -#define RE_NEG_NOW 0x0040
- -#define ALLOW_FDX 0x0080
- -#define AUTO_NEG_ENABLE 0x0100
- -#define NLP_ENABLE 0x0200
- -#define FORCE_FDX 0x8000
- -#define AUTO_NEG_BITS (FORCE_FDX|NLP_ENABLE|AUTO_NEG_ENABLE)
- -#define AUTO_NEG_MASK (FORCE_FDX|NLP_ENABLE|AUTO_NEG_ENABLE|ALLOW_FDX|RE_NEG_NOW)
- -
- -/* PP_AutoNegST - Auto Negotiation Status bit definition */
- -#define AUTO_NEG_BUSY 0x0080
- -#define FLP_LINK 0x0100
- -#define FLP_LINK_GOOD 0x0800
- -#define LINK_FAULT 0x1000
- -#define HDX_ACTIVE 0x4000
- -#define FDX_ACTIVE 0x8000
- -
- -/* The following block defines the ISQ event types */
- -#define ISQ_RECEIVER_EVENT 0x04
- -#define ISQ_TRANSMITTER_EVENT 0x08
- -#define ISQ_BUFFER_EVENT 0x0c
- -#define ISQ_RX_MISS_EVENT 0x10
- -#define ISQ_TX_COL_EVENT 0x12
- -
- -#define ISQ_EVENT_MASK 0x003F /* ISQ mask to find out type of event */
- -#define ISQ_HIST 16 /* small history buffer */
- -#define AUTOINCREMENT 0x8000 /* Bit mask to set bit-15 for autoincrement */
- -
- -#define TXRXBUFSIZE 0x0600
- -#define RXDMABUFSIZE 0x8000
- -#define RXDMASIZE 0x4000
- -#define TXRX_LENGTH_MASK 0x07FF
- -
- -/* rx options bits */
- -#define RCV_WITH_RXON 1 /* Set SerRx ON */
- -#define RCV_COUNTS 2 /* Use Framecnt1 */
- -#define RCV_PONG 4 /* Pong respondent */
- -#define RCV_DONG 8 /* Dong operation */
- -#define RCV_POLLING 0x10 /* Poll RxEvent */
- -#define RCV_ISQ 0x20 /* Use ISQ, int */
- -#define RCV_AUTO_DMA 0x100 /* Set AutoRxDMAE */
- -#define RCV_DMA 0x200 /* Set RxDMA only */
- -#define RCV_DMA_ALL 0x400 /* Copy all DMA'ed */
- -#define RCV_FIXED_DATA 0x800 /* Every frame same */
- -#define RCV_IO 0x1000 /* Use ISA IO only */
- -#define RCV_MEMORY 0x2000 /* Use ISA Memory */
- -
- -#define RAM_SIZE 0x1000 /* The card has 4k bytes or RAM */
- -#define PKT_START PP_TxFrame /* Start of packet RAM */
- -
- -#define RX_FRAME_PORT 0x0000
- -#define TX_FRAME_PORT RX_FRAME_PORT
- -#define TX_CMD_PORT 0x0004
- -#define TX_NOW 0x0000 /* Tx packet after 5 bytes copied */
- -#define TX_AFTER_381 0x0020 /* Tx packet after 381 bytes copied */
- -#define TX_AFTER_ALL 0x0060 /* Tx packet after all bytes copied */
- -#define TX_LEN_PORT 0x0006
- -#define ISQ_PORT 0x0008
- -#define ADD_PORT 0x000A
- -#define DATA_PORT 0x000C
- -
- -#define EEPROM_WRITE_EN 0x00F0
- -#define EEPROM_WRITE_DIS 0x0000
- -#define EEPROM_WRITE_CMD 0x0100
- -#define EEPROM_READ_CMD 0x0200
- -
- -/* Receive Header */
- -/* Description of header of each packet in receive area of memory */
- -#define RBUF_EVENT_LOW 0 /* Low byte of RxEvent - status of received frame */
- -#define RBUF_EVENT_HIGH 1 /* High byte of RxEvent - status of received frame */
- -#define RBUF_LEN_LOW 2 /* Length of received data - low byte */
- -#define RBUF_LEN_HI 3 /* Length of received data - high byte */
- -#define RBUF_HEAD_LEN 4 /* Length of this header */
- -
- -#define CHIP_READ 0x1 /* Used to mark state of the repins code (chip or dma) */
- -#define DMA_READ 0x2 /* Used to mark state of the repins code (chip or dma) */
- -
- -/* for bios scan */
- -/* */
- -#ifdef CSDEBUG
- -/* use these values for debugging bios scan */
- -#define BIOS_START_SEG 0x00000
- -#define BIOS_OFFSET_INC 0x0010
- -#else
- -#define BIOS_START_SEG 0x0c000
- -#define BIOS_OFFSET_INC 0x0200
- -#endif
- -
- -#define BIOS_LAST_OFFSET 0x0fc00
- -
- -/* Byte offsets into the EEPROM configuration buffer */
- -#define ISA_CNF_OFFSET 0x6
- -#define TX_CTL_OFFSET (ISA_CNF_OFFSET + 8) /* 8900 eeprom */
- -#define AUTO_NEG_CNF_OFFSET (ISA_CNF_OFFSET + 8) /* 8920 eeprom */
- -
- - /* the assumption here is that the bits in the eeprom are generally */
- - /* in the same position as those in the autonegctl register. */
- - /* Of course the IMM bit is not in that register so it must be */
- - /* masked out */
- -#define EE_FORCE_FDX 0x8000
- -#define EE_NLP_ENABLE 0x0200
- -#define EE_AUTO_NEG_ENABLE 0x0100
- -#define EE_ALLOW_FDX 0x0080
- -#define EE_AUTO_NEG_CNF_MASK (EE_FORCE_FDX|EE_NLP_ENABLE|EE_AUTO_NEG_ENABLE|EE_ALLOW_FDX)
- -
- -#define IMM_BIT 0x0040 /* ignore missing media */
- -
- -#define ADAPTER_CNF_OFFSET (AUTO_NEG_CNF_OFFSET + 2)
- -#define A_CNF_10B_T 0x0001
- -#define A_CNF_AUI 0x0002
- -#define A_CNF_10B_2 0x0004
- -#define A_CNF_MEDIA_TYPE 0x0060
- -#define A_CNF_MEDIA_AUTO 0x0000
- -#define A_CNF_MEDIA_10B_T 0x0020
- -#define A_CNF_MEDIA_AUI 0x0040
- -#define A_CNF_MEDIA_10B_2 0x0060
- -#define A_CNF_DC_DC_POLARITY 0x0080
- -#define A_CNF_NO_AUTO_POLARITY 0x2000
- -#define A_CNF_LOW_RX_SQUELCH 0x4000
- -#define A_CNF_EXTND_10B_2 0x8000
- -
- -#define PACKET_PAGE_OFFSET 0x8
- -
- -/* Bit definitions for the ISA configuration word from the EEPROM */
- -#define INT_NO_MASK 0x000F
- -#define DMA_NO_MASK 0x0070
- -#define ISA_DMA_SIZE 0x0200
- -#define ISA_AUTO_RxDMA 0x0400
- -#define ISA_RxDMA 0x0800
- -#define DMA_BURST 0x1000
- -#define STREAM_TRANSFER 0x2000
- -#define ANY_ISA_DMA (ISA_AUTO_RxDMA | ISA_RxDMA)
- -
- -/* DMA controller registers */
- -#define DMA_BASE 0x00 /* DMA controller base */
- -#define DMA_BASE_2 0x0C0 /* DMA controller base */
- -
- -#define DMA_STAT 0x0D0 /* DMA controller status register */
- -#define DMA_MASK 0x0D4 /* DMA controller mask register */
- -#define DMA_MODE 0x0D6 /* DMA controller mode register */
- -#define DMA_RESETFF 0x0D8 /* DMA controller first/last flip flop */
- -
- -/* DMA data */
- -#define DMA_DISABLE 0x04 /* Disable channel n */
- -#define DMA_ENABLE 0x00 /* Enable channel n */
- -/* Demand transfers, incr. address, auto init, writes, ch. n */
- -#define DMA_RX_MODE 0x14
- -/* Demand transfers, incr. address, auto init, reads, ch. n */
- -#define DMA_TX_MODE 0x18
- -
- -#define DMA_SIZE (16*1024) /* Size of dma buffer - 16k */
- -
- -#define CS8900 0x0000
- -#define CS8920 0x4000
- -#define CS8920M 0x6000
- -#define REVISON_BITS 0x1F00
- -#define EEVER_NUMBER 0x12
- -#define CHKSUM_LEN 0x14
- -#define CHKSUM_VAL 0x0000
- -#define START_EEPROM_DATA 0x001c /* Offset into eeprom for start of data */
- -#define IRQ_MAP_EEPROM_DATA 0x0046 /* Offset into eeprom for the IRQ map */
- -#define IRQ_MAP_LEN 0x0004 /* No of bytes to read for the IRQ map */
- -#define PNP_IRQ_FRMT 0x0022 /* PNP small item IRQ format */
- -#define CS8900_IRQ_MAP 0x1c20 /* This IRQ map is fixed */
- -
- -#define CS8920_NO_INTS 0x0F /* Max CS8920 interrupt select # */
- -
- -#define PNP_ADD_PORT 0x0279
- -#define PNP_WRITE_PORT 0x0A79
- -
- -#define GET_PNP_ISA_STRUCT 0x40
- -#define PNP_ISA_STRUCT_LEN 0x06
- -#define PNP_CSN_CNT_OFF 0x01
- -#define PNP_RD_PORT_OFF 0x02
- -#define PNP_FUNCTION_OK 0x00
- -#define PNP_WAKE 0x03
- -#define PNP_RSRC_DATA 0x04
- -#define PNP_RSRC_READY 0x01
- -#define PNP_STATUS 0x05
- -#define PNP_ACTIVATE 0x30
- -#define PNP_CNF_IO_H 0x60
- -#define PNP_CNF_IO_L 0x61
- -#define PNP_CNF_INT 0x70
- -#define PNP_CNF_DMA 0x74
- -#define PNP_CNF_MEM 0x48
- -
- -#define BIT0 1
- -#define BIT15 0x8000
- -
- -/*
- - * Local variables:
- - * c-basic-offset: 8
- - * End:
- - */
- -
- diff -Naur grub-0.97.orig/netboot/cs89x0.txt grub-0.97/netboot/cs89x0.txt
- --- grub-0.97.orig/netboot/cs89x0.txt 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/cs89x0.txt 1970-01-01 00:00:00.000000000 +0000
- @@ -1,26 +0,0 @@
- -Permission is granted to distribute the enclosed cs89x0.[ch] driver
- -only in conjunction with the Etherboot package. The code is
- -ordinarily distributed under the GPL.
- -
- -Russ Nelson, January 2000
- -
- -CREDITS
- -
- -I want to thank
- -
- - Mike Cruse <mcruse@cti-ltd.com>
- - for providing an evaluation NIC and for sponsoring the
- - development of this driver.
- -
- - Randall Sears <sears@crystal.cirrus.com>
- - Deva Bodas <bodas@crystal.cirrus.com>
- - Andreas Kraemer <akraemer@crystal.cirrus.com>
- - Wolfgang Krause <100303.2673@compuserve.com>
- - for excellent technical support and for providing the required
- - programming information. I appreciate Crystal Semiconductor's
- - commitment towards free software.
- -
- - Russell Nelson <nelson@crynwr.com>
- - for writing the Linux device driver for the CS89x0
- - chipset. Russel's code is very well designed and simplified my
- - job a lot.
- diff -Naur grub-0.97.orig/netboot/davicom.c grub-0.97/netboot/davicom.c
- --- grub-0.97.orig/netboot/davicom.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/davicom.c 2005-08-31 19:03:35.000000000 +0000
- @@ -1,12 +1,12 @@
- +#ifdef ALLMULTI
- +#error multicast support is not yet implemented
- +#endif
- /*
- DAVICOM DM9009/DM9102/DM9102A Etherboot Driver V1.00
-
- - This driver was ported from Marty Conner's Tulip Etherboot driver.
- - Thanks Marty Connor (mdc@thinguin.org)
- - You can get Tulip driver source file from this URL:
- + This driver was ported from Marty Connor's Tulip Etherboot driver.
- + Thanks Marty Connor (mdc@etherboot.org)
-
- - "http://etherboot.sourceforge..net/#Distribution"
- -
- This davicom etherboot driver supports DM9009/DM9102/DM9102A/
- DM9102A+DM9801/DM9102A+DM9802 NICs.
-
- @@ -36,7 +36,6 @@
- register(CR6)
- */
-
- -
- /*********************************************************************/
- /* Declarations */
- /*********************************************************************/
- @@ -44,7 +43,6 @@
- #include "etherboot.h"
- #include "nic.h"
- #include "pci.h"
- -#include "cards.h"
-
- #undef DAVICOM_DEBUG
- #undef DAVICOM_DEBUG_WHERE
- @@ -99,8 +97,10 @@
- #define eeprom_delay() inl(ee_addr)
-
- /* helpful macro if on a big_endian machine for changing byte order.
- - not strictly needed on Intel */
- + not strictly needed on Intel
- + Already defined in Etherboot includes
- #define le16_to_cpu(val) (val)
- +*/
-
- /* transmit and receive descriptor format */
- struct txdesc {
- @@ -138,20 +138,12 @@
- /* transmit descriptor and buffer */
- #define NTXD 2
- static struct txdesc txd[NTXD] __attribute__ ((aligned(4)));
- -#ifdef USE_LOWMEM_BUFFER
- -#define txb ((char *)0x10000 - BUFLEN)
- -#else
- static unsigned char txb[BUFLEN] __attribute__ ((aligned(4)));
- -#endif
-
- /* receive descriptor(s) and buffer(s) */
- #define NRXD 4
- static struct rxdesc rxd[NRXD] __attribute__ ((aligned(4)));
- -#ifdef USE_LOWMEM_BUFFER
- -#define rxb ((char *)0x10000 - NRXD * BUFLEN - BUFLEN)
- -#else
- static unsigned char rxb[NRXD * BUFLEN] __attribute__ ((aligned(4)));
- -#endif
- static int rxd_tail;
- static int TxPtr;
-
- @@ -161,15 +153,13 @@
- /*********************************************************************/
- static void whereami(const char *str);
- static int read_eeprom(unsigned long ioaddr, int location, int addr_len);
- -struct nic *davicom_probe(struct nic *nic, unsigned short *io_addrs,
- - struct pci_device *pci);
- +static int davicom_probe(struct dev *dev, struct pci_device *pci);
- static void davicom_init_chain(struct nic *nic); /* Sten 10/9 */
- static void davicom_reset(struct nic *nic);
- static void davicom_transmit(struct nic *nic, const char *d, unsigned int t,
- unsigned int s, const char *p);
- -static int davicom_poll(struct nic *nic);
- -static void davicom_disable(struct nic *nic);
- -static void whereami (const char *str);
- +static int davicom_poll(struct nic *nic, int retrieve);
- +static void davicom_disable(struct dev *dev);
- #ifdef DAVICOM_DEBUG
- static void davicom_more(void);
- #endif /* DAVICOM_DEBUG */
- @@ -184,13 +174,10 @@
- /*********************************************************************/
- /* Utility Routines */
- /*********************************************************************/
- -
- -static inline void whereami (const char *str)
- +static inline void whereami(const char *str)
- {
- -#ifdef DAVICOM_DEBUG_WHERE
- printf("%s\n", str);
- /* sleep(2); */
- -#endif
- }
-
- #ifdef DAVICOM_DEBUG
- @@ -360,7 +347,7 @@
- /*
- Sense media mode and set CR6
- */
- -static void davicom_media_chk(struct nic * nic)
- +static void davicom_media_chk(struct nic * nic __unused)
- {
- unsigned long to, csr6;
-
- @@ -446,8 +433,8 @@
- /* Sten: Set 2 TX descriptor but use one TX buffer because
- it transmit a packet and wait complete every time. */
- for (i=0; i<NTXD; i++) {
- - txd[i].buf1addr = &txb[0]; /* Used same TX buffer */
- - txd[i].buf2addr = (unsigned char *)&txd[i+1]; /* Point to Next TX desc */
- + txd[i].buf1addr = (void *)virt_to_bus(&txb[0]); /* Used same TX buffer */
- + txd[i].buf2addr = (void *)virt_to_bus(&txd[i+1]); /* Point to Next TX desc */
- txd[i].buf1sz = 0;
- txd[i].buf2sz = 0;
- txd[i].control = 0x184; /* Begin/End/Chain */
- @@ -466,8 +453,8 @@
-
- /* setup receive descriptor */
- for (i=0; i<NRXD; i++) {
- - rxd[i].buf1addr = &rxb[i * BUFLEN];
- - rxd[i].buf2addr = (unsigned char *)&rxd[i+1]; /* Point to Next RX desc */
- + rxd[i].buf1addr = (void *)virt_to_bus(&rxb[i * BUFLEN]);
- + rxd[i].buf2addr = (void *)virt_to_bus(&rxd[i+1]); /* Point to Next RX desc */
- rxd[i].buf1sz = BUFLEN;
- rxd[i].buf2sz = 0; /* not used */
- rxd[i].control = 0x4; /* Chain Structure */
- @@ -475,8 +462,8 @@
- }
-
- /* Chain the last descriptor to first */
- - txd[NTXD - 1].buf2addr = (unsigned char *)&txd[0];
- - rxd[NRXD - 1].buf2addr = (unsigned char *)&rxd[0];
- + txd[NTXD - 1].buf2addr = (void *)virt_to_bus(&txd[0]);
- + rxd[NRXD - 1].buf2addr = (void *)virt_to_bus(&rxd[0]);
- TxPtr = 0;
- rxd_tail = 0;
- }
- @@ -488,7 +475,6 @@
- static void davicom_reset(struct nic *nic)
- {
- unsigned long to;
- - u32 addr_low, addr_high;
-
- whereami("davicom_reset\n");
-
- @@ -507,8 +493,8 @@
- davicom_init_chain(nic); /* Sten 10/9 */
-
- /* Point to receive descriptor */
- - outl((unsigned long)&rxd[0], ioaddr + CSR3);
- - outl((unsigned long)&txd[0], ioaddr + CSR4); /* Sten 10/9 */
- + outl(virt_to_bus(&rxd[0]), ioaddr + CSR3);
- + outl(virt_to_bus(&txd[0]), ioaddr + CSR4); /* Sten 10/9 */
-
- /* According phyxcer media mode to set CR6,
- DM9102/A phyxcer can auto-detect media mode */
- @@ -591,13 +577,15 @@
- /*********************************************************************/
- /* eth_poll - Wait for a frame */
- /*********************************************************************/
- -static int davicom_poll(struct nic *nic)
- +static int davicom_poll(struct nic *nic, int retrieve)
- {
- whereami("davicom_poll\n");
-
- if (rxd[rxd_tail].status & 0x80000000)
- return 0;
-
- + if ( ! retrieve ) return 1;
- +
- whereami("davicom_poll got one\n");
-
- nic->packetlen = (rxd[rxd_tail].status & 0x3FFF0000) >> 16;
- @@ -627,10 +615,13 @@
- /*********************************************************************/
- /* eth_disable - Disable the interface */
- /*********************************************************************/
- -static void davicom_disable(struct nic *nic)
- +static void davicom_disable(struct dev *dev)
- {
- + struct nic *nic = (struct nic *)dev;
- whereami("davicom_disable\n");
-
- + davicom_reset(nic);
- +
- /* disable interrupts */
- outl(0x00000000, ioaddr + CSR7);
-
- @@ -640,24 +631,43 @@
- /* Clear the missed-packet counter. */
- (volatile unsigned long)inl(ioaddr + CSR8);
- }
- +
- +
- +/*********************************************************************/
- +/* eth_irq - enable, disable and force interrupts */
- +/*********************************************************************/
- +static void davicom_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
- +
-
- /*********************************************************************/
- /* eth_probe - Look for an adapter */
- /*********************************************************************/
- -struct nic *davicom_probe(struct nic *nic, unsigned short *io_addrs,
- - struct pci_device *pci)
- +static int davicom_probe(struct dev *dev, struct pci_device *pci)
- {
- + struct nic *nic = (struct nic *)dev;
- unsigned int i;
- - u32 l1, l2;
-
- whereami("davicom_probe\n");
-
- - if (io_addrs == 0 || *io_addrs == 0)
- + if (pci->ioaddr == 0)
- return 0;
-
- vendor = pci->vendor;
- dev_id = pci->dev_id;
- - ioaddr = *io_addrs;
- + ioaddr = pci->ioaddr & ~3;
- +
- + nic->irqno = 0;
- + nic->ioaddr = pci->ioaddr & ~3;
-
- /* wakeup chip */
- pcibios_write_config_dword(pci->bus, pci->devfn, 0x40, 0x00000000);
- @@ -683,10 +693,26 @@
- /* initialize device */
- davicom_reset(nic);
-
- - nic->reset = davicom_reset;
- + dev->disable = davicom_disable;
- nic->poll = davicom_poll;
- nic->transmit = davicom_transmit;
- - nic->disable = davicom_disable;
- + nic->irq = davicom_irq;
-
- - return nic;
- + return 1;
- }
- +
- +static struct pci_id davicom_nics[] = {
- +PCI_ROM(0x1282, 0x9100, "davicom9100", "Davicom 9100"),
- +PCI_ROM(0x1282, 0x9102, "davicom9102", "Davicom 9102"),
- +PCI_ROM(0x1282, 0x9009, "davicom9009", "Davicom 9009"),
- +PCI_ROM(0x1282, 0x9132, "davicom9132", "Davicom 9132"), /* Needs probably some fixing */
- +};
- +
- +struct pci_driver davicom_driver = {
- + .type = NIC_DRIVER,
- + .name = "DAVICOM",
- + .probe = davicom_probe,
- + .ids = davicom_nics,
- + .id_count = sizeof(davicom_nics)/sizeof(davicom_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/depca.c grub-0.97/netboot/depca.c
- --- grub-0.97.orig/netboot/depca.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/depca.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,752 +0,0 @@
- -/* Etherboot: depca.h merged, comments from Linux driver retained */
- -/* depca.c: A DIGITAL DEPCA & EtherWORKS ethernet driver for linux.
- -
- - Written 1994, 1995 by David C. Davies.
- -
- -
- - Copyright 1994 David C. Davies
- - and
- - United States Government
- - (as represented by the Director, National Security Agency).
- -
- - Copyright 1995 Digital Equipment Corporation.
- -
- -
- - This software may be used and distributed according to the terms of
- - the GNU Public License, incorporated herein by reference.
- -
- - This driver is written for the Digital Equipment Corporation series
- - of DEPCA and EtherWORKS ethernet cards:
- -
- - DEPCA (the original)
- - DE100
- - DE101
- - DE200 Turbo
- - DE201 Turbo
- - DE202 Turbo (TP BNC)
- - DE210
- - DE422 (EISA)
- -
- - The driver has been tested on DE100, DE200 and DE202 cards in a
- - relatively busy network. The DE422 has been tested a little.
- -
- - This driver will NOT work for the DE203, DE204 and DE205 series of
- - cards, since they have a new custom ASIC in place of the AMD LANCE
- - chip. See the 'ewrk3.c' driver in the Linux source tree for running
- - those cards.
- -
- - I have benchmarked the driver with a DE100 at 595kB/s to (542kB/s from)
- - a DECstation 5000/200.
- -
- - The author may be reached at davies@maniac.ultranet.com
- -
- - =========================================================================
- -
- - The driver was originally based on the 'lance.c' driver from Donald
- - Becker which is included with the standard driver distribution for
- - linux. V0.4 is a complete re-write with only the kernel interface
- - remaining from the original code.
- -
- - 1) Lance.c code in /linux/drivers/net/
- - 2) "Ethernet/IEEE 802.3 Family. 1992 World Network Data Book/Handbook",
- - AMD, 1992 [(800) 222-9323].
- - 3) "Am79C90 CMOS Local Area Network Controller for Ethernet (C-LANCE)",
- - AMD, Pub. #17881, May 1993.
- - 4) "Am79C960 PCnet-ISA(tm), Single-Chip Ethernet Controller for ISA",
- - AMD, Pub. #16907, May 1992
- - 5) "DEC EtherWORKS LC Ethernet Controller Owners Manual",
- - Digital Equipment corporation, 1990, Pub. #EK-DE100-OM.003
- - 6) "DEC EtherWORKS Turbo Ethernet Controller Owners Manual",
- - Digital Equipment corporation, 1990, Pub. #EK-DE200-OM.003
- - 7) "DEPCA Hardware Reference Manual", Pub. #EK-DEPCA-PR
- - Digital Equipment Corporation, 1989
- - 8) "DEC EtherWORKS Turbo_(TP BNC) Ethernet Controller Owners Manual",
- - Digital Equipment corporation, 1991, Pub. #EK-DE202-OM.001
- -
- -
- - Peter Bauer's depca.c (V0.5) was referred to when debugging V0.1 of this
- - driver.
- -
- - The original DEPCA card requires that the ethernet ROM address counter
- - be enabled to count and has an 8 bit NICSR. The ROM counter enabling is
- - only done when a 0x08 is read as the first address octet (to minimise
- - the chances of writing over some other hardware's I/O register). The
- - NICSR accesses have been changed to byte accesses for all the cards
- - supported by this driver, since there is only one useful bit in the MSB
- - (remote boot timeout) and it is not used. Also, there is a maximum of
- - only 48kB network RAM for this card. My thanks to Torbjorn Lindh for
- - help debugging all this (and holding my feet to the fire until I got it
- - right).
- -
- - The DE200 series boards have on-board 64kB RAM for use as a shared
- - memory network buffer. Only the DE100 cards make use of a 2kB buffer
- - mode which has not been implemented in this driver (only the 32kB and
- - 64kB modes are supported [16kB/48kB for the original DEPCA]).
- -
- - At the most only 2 DEPCA cards can be supported on the ISA bus because
- - there is only provision for two I/O base addresses on each card (0x300
- - and 0x200). The I/O address is detected by searching for a byte sequence
- - in the Ethernet station address PROM at the expected I/O address for the
- - Ethernet PROM. The shared memory base address is 'autoprobed' by
- - looking for the self test PROM and detecting the card name. When a
- - second DEPCA is detected, information is placed in the base_addr
- - variable of the next device structure (which is created if necessary),
- - thus enabling ethif_probe initialization for the device. More than 2
- - EISA cards can be supported, but care will be needed assigning the
- - shared memory to ensure that each slot has the correct IRQ, I/O address
- - and shared memory address assigned.
- -
- - ************************************************************************
- -
- - NOTE: If you are using two ISA DEPCAs, it is important that you assign
- - the base memory addresses correctly. The driver autoprobes I/O 0x300
- - then 0x200. The base memory address for the first device must be less
- - than that of the second so that the auto probe will correctly assign the
- - I/O and memory addresses on the same card. I can't think of a way to do
- - this unambiguously at the moment, since there is nothing on the cards to
- - tie I/O and memory information together.
- -
- - I am unable to test 2 cards together for now, so this code is
- - unchecked. All reports, good or bad, are welcome.
- -
- - ************************************************************************
- -
- - The board IRQ setting must be at an unused IRQ which is auto-probed
- - using Donald Becker's autoprobe routines. DEPCA and DE100 board IRQs are
- - {2,3,4,5,7}, whereas the DE200 is at {5,9,10,11,15}. Note that IRQ2 is
- - really IRQ9 in machines with 16 IRQ lines.
- -
- - No 16MB memory limitation should exist with this driver as DMA is not
- - used and the common memory area is in low memory on the network card (my
- - current system has 20MB and I've not had problems yet).
- -
- - The ability to load this driver as a loadable module has been added. To
- - utilise this ability, you have to do <8 things:
- -
- - 0) have a copy of the loadable modules code installed on your system.
- - 1) copy depca.c from the /linux/drivers/net directory to your favourite
- - temporary directory.
- - 2) if you wish, edit the source code near line 1530 to reflect the I/O
- - address and IRQ you're using (see also 5).
- - 3) compile depca.c, but include -DMODULE in the command line to ensure
- - that the correct bits are compiled (see end of source code).
- - 4) if you are wanting to add a new card, goto 5. Otherwise, recompile a
- - kernel with the depca configuration turned off and reboot.
- - 5) insmod depca.o [irq=7] [io=0x200] [mem=0xd0000] [adapter_name=DE100]
- - [Alan Cox: Changed the code to allow command line irq/io assignments]
- - [Dave Davies: Changed the code to allow command line mem/name
- - assignments]
- - 6) run the net startup bits for your eth?? interface manually
- - (usually /etc/rc.inet[12] at boot time).
- - 7) enjoy!
- -
- - Note that autoprobing is not allowed in loadable modules - the system is
- - already up and running and you're messing with interrupts.
- -
- - To unload a module, turn off the associated interface
- - 'ifconfig eth?? down' then 'rmmod depca'.
- -
- - To assign a base memory address for the shared memory when running as a
- - loadable module, see 5 above. To include the adapter name (if you have
- - no PROM but know the card name) also see 5 above. Note that this last
- - option will not work with kernel built-in depca's.
- -
- - The shared memory assignment for a loadable module makes sense to avoid
- - the 'memory autoprobe' picking the wrong shared memory (for the case of
- - 2 depca's in a PC).
- -
- - ************************************************************************
- - Support for MCA EtherWORKS cards added 11-3-98.
- - Verified to work with up to 2 DE212 cards in a system (although not
- - fully stress-tested).
- -
- - Currently known bugs/limitations:
- -
- - Note: with the MCA stuff as a module, it trusts the MCA configuration,
- - not the command line for IRQ and memory address. You can
- - specify them if you want, but it will throw your values out.
- - You still have to pass the IO address it was configured as
- - though.
- -
- - ************************************************************************
- - TO DO:
- - ------
- -
- -
- - Revision History
- - ----------------
- -
- - Version Date Description
- -
- - 0.1 25-jan-94 Initial writing.
- - 0.2 27-jan-94 Added LANCE TX hardware buffer chaining.
- - 0.3 1-feb-94 Added multiple DEPCA support.
- - 0.31 4-feb-94 Added DE202 recognition.
- - 0.32 19-feb-94 Tidy up. Improve multi-DEPCA support.
- - 0.33 25-feb-94 Fix DEPCA ethernet ROM counter enable.
- - Add jabber packet fix from murf@perftech.com
- - and becker@super.org
- - 0.34 7-mar-94 Fix DEPCA max network memory RAM & NICSR access.
- - 0.35 8-mar-94 Added DE201 recognition. Tidied up.
- - 0.351 30-apr-94 Added EISA support. Added DE422 recognition.
- - 0.36 16-may-94 DE422 fix released.
- - 0.37 22-jul-94 Added MODULE support
- - 0.38 15-aug-94 Added DBR ROM switch in depca_close().
- - Multi DEPCA bug fix.
- - 0.38axp 15-sep-94 Special version for Alpha AXP Linux V1.0.
- - 0.381 12-dec-94 Added DE101 recognition, fix multicast bug.
- - 0.382 9-feb-95 Fix recognition bug reported by <bkm@star.rl.ac.uk>.
- - 0.383 22-feb-95 Fix for conflict with VESA SCSI reported by
- - <stromain@alf.dec.com>
- - 0.384 17-mar-95 Fix a ring full bug reported by <bkm@star.rl.ac.uk>
- - 0.385 3-apr-95 Fix a recognition bug reported by
- - <ryan.niemi@lastfrontier.com>
- - 0.386 21-apr-95 Fix the last fix...sorry, must be galloping senility
- - 0.40 25-May-95 Rewrite for portability & updated.
- - ALPHA support from <jestabro@amt.tay1.dec.com>
- - 0.41 26-Jun-95 Added verify_area() calls in depca_ioctl() from
- - suggestion by <heiko@colossus.escape.de>
- - 0.42 27-Dec-95 Add 'mem' shared memory assignment for loadable
- - modules.
- - Add 'adapter_name' for loadable modules when no PROM.
- - Both above from a suggestion by
- - <pchen@woodruffs121.residence.gatech.edu>.
- - Add new multicasting code.
- - 0.421 22-Apr-96 Fix alloc_device() bug <jari@markkus2.fimr.fi>
- - 0.422 29-Apr-96 Fix depca_hw_init() bug <jari@markkus2.fimr.fi>
- - 0.423 7-Jun-96 Fix module load bug <kmg@barco.be>
- - 0.43 16-Aug-96 Update alloc_device() to conform to de4x5.c
- - 0.44 1-Sep-97 Fix *_probe() to test check_region() first - bug
- - reported by <mmogilvi@elbert.uccs.edu>
- - 0.45 3-Nov-98 Added support for MCA EtherWORKS (DE210/DE212) cards
- - by <tymm@computer.org>
- - 0.451 5-Nov-98 Fixed mca stuff cuz I'm a dummy. <tymm@computer.org>
- - 0.5 14-Nov-98 Re-spin for 2.1.x kernels.
- - 0.51 27-Jun-99 Correct received packet length for CRC from
- - report by <worm@dkik.dk>
- -
- - =========================================================================
- -*/
- -
- -#include "etherboot.h"
- -#include "nic.h"
- -#include "cards.h"
- -
- -/*
- -** I/O addresses. Note that the 2k buffer option is not supported in
- -** this driver.
- -*/
- -#define DEPCA_NICSR ioaddr+0x00 /* Network interface CSR */
- -#define DEPCA_RBI ioaddr+0x02 /* RAM buffer index (2k buffer mode) */
- -#define DEPCA_DATA ioaddr+0x04 /* LANCE registers' data port */
- -#define DEPCA_ADDR ioaddr+0x06 /* LANCE registers' address port */
- -#define DEPCA_HBASE ioaddr+0x08 /* EISA high memory base address reg. */
- -#define DEPCA_PROM ioaddr+0x0c /* Ethernet address ROM data port */
- -#define DEPCA_CNFG ioaddr+0x0c /* EISA Configuration port */
- -#define DEPCA_RBSA ioaddr+0x0e /* RAM buffer starting address (2k buff.) */
- -
- -/*
- -** These are LANCE registers addressable through DEPCA_ADDR
- -*/
- -#define CSR0 0
- -#define CSR1 1
- -#define CSR2 2
- -#define CSR3 3
- -
- -/*
- -** NETWORK INTERFACE CSR (NI_CSR) bit definitions
- -*/
- -
- -#define TO 0x0100 /* Time Out for remote boot */
- -#define SHE 0x0080 /* SHadow memory Enable */
- -#define BS 0x0040 /* Bank Select */
- -#define BUF 0x0020 /* BUFfer size (1->32k, 0->64k) */
- -#define RBE 0x0010 /* Remote Boot Enable (1->net boot) */
- -#define AAC 0x0008 /* Address ROM Address Counter (1->enable) */
- -#define _128KB 0x0008 /* 128kB Network RAM (1->enable) */
- -#define IM 0x0004 /* Interrupt Mask (1->mask) */
- -#define IEN 0x0002 /* Interrupt tristate ENable (1->enable) */
- -#define LED 0x0001 /* LED control */
- -
- -/*
- -** Control and Status Register 0 (CSR0) bit definitions
- -*/
- -
- -#define ERR 0x8000 /* Error summary */
- -#define BABL 0x4000 /* Babble transmitter timeout error */
- -#define CERR 0x2000 /* Collision Error */
- -#define MISS 0x1000 /* Missed packet */
- -#define MERR 0x0800 /* Memory Error */
- -#define RINT 0x0400 /* Receiver Interrupt */
- -#define TINT 0x0200 /* Transmit Interrupt */
- -#define IDON 0x0100 /* Initialization Done */
- -#define INTR 0x0080 /* Interrupt Flag */
- -#define INEA 0x0040 /* Interrupt Enable */
- -#define RXON 0x0020 /* Receiver on */
- -#define TXON 0x0010 /* Transmitter on */
- -#define TDMD 0x0008 /* Transmit Demand */
- -#define STOP 0x0004 /* Stop */
- -#define STRT 0x0002 /* Start */
- -#define INIT 0x0001 /* Initialize */
- -#define INTM 0xff00 /* Interrupt Mask */
- -#define INTE 0xfff0 /* Interrupt Enable */
- -
- -/*
- -** CONTROL AND STATUS REGISTER 3 (CSR3)
- -*/
- -
- -#define BSWP 0x0004 /* Byte SWaP */
- -#define ACON 0x0002 /* ALE control */
- -#define BCON 0x0001 /* Byte CONtrol */
- -
- -/*
- -** Initialization Block Mode Register
- -*/
- -
- -#define PROM 0x8000 /* Promiscuous Mode */
- -#define EMBA 0x0080 /* Enable Modified Back-off Algorithm */
- -#define INTL 0x0040 /* Internal Loopback */
- -#define DRTY 0x0020 /* Disable Retry */
- -#define COLL 0x0010 /* Force Collision */
- -#define DTCR 0x0008 /* Disable Transmit CRC */
- -#define LOOP 0x0004 /* Loopback */
- -#define DTX 0x0002 /* Disable the Transmitter */
- -#define DRX 0x0001 /* Disable the Receiver */
- -
- -/*
- -** Receive Message Descriptor 1 (RMD1) bit definitions.
- -*/
- -
- -#define R_OWN 0x80000000 /* Owner bit 0 = host, 1 = lance */
- -#define R_ERR 0x4000 /* Error Summary */
- -#define R_FRAM 0x2000 /* Framing Error */
- -#define R_OFLO 0x1000 /* Overflow Error */
- -#define R_CRC 0x0800 /* CRC Error */
- -#define R_BUFF 0x0400 /* Buffer Error */
- -#define R_STP 0x0200 /* Start of Packet */
- -#define R_ENP 0x0100 /* End of Packet */
- -
- -/*
- -** Transmit Message Descriptor 1 (TMD1) bit definitions.
- -*/
- -
- -#define T_OWN 0x80000000 /* Owner bit 0 = host, 1 = lance */
- -#define T_ERR 0x4000 /* Error Summary */
- -#define T_ADD_FCS 0x2000 /* More the 1 retry needed to Xmit */
- -#define T_MORE 0x1000 /* >1 retry to transmit packet */
- -#define T_ONE 0x0800 /* 1 try needed to transmit the packet */
- -#define T_DEF 0x0400 /* Deferred */
- -#define T_STP 0x02000000 /* Start of Packet */
- -#define T_ENP 0x01000000 /* End of Packet */
- -#define T_FLAGS 0xff000000 /* TX Flags Field */
- -
- -/*
- -** Transmit Message Descriptor 3 (TMD3) bit definitions.
- -*/
- -
- -#define TMD3_BUFF 0x8000 /* BUFFer error */
- -#define TMD3_UFLO 0x4000 /* UnderFLOw error */
- -#define TMD3_RES 0x2000 /* REServed */
- -#define TMD3_LCOL 0x1000 /* Late COLlision */
- -#define TMD3_LCAR 0x0800 /* Loss of CARrier */
- -#define TMD3_RTRY 0x0400 /* ReTRY error */
- -
- -/*
- -** Ethernet PROM defines
- -*/
- -#define PROBE_LENGTH 32
- -
- -/*
- -** Set the number of Tx and Rx buffers. Ensure that the memory requested
- -** here is <= to the amount of shared memory set up by the board switches.
- -** The number of descriptors MUST BE A POWER OF 2.
- -**
- -** total_memory = NUM_RX_DESC*(8+RX_BUFF_SZ) + NUM_TX_DESC*(8+TX_BUFF_SZ)
- -*/
- -#define NUM_RX_DESC 2 /* Number of RX descriptors */
- -#define NUM_TX_DESC 2 /* Number of TX descriptors */
- -#define RX_BUFF_SZ 1536 /* Buffer size for each Rx buffer */
- -#define TX_BUFF_SZ 1536 /* Buffer size for each Tx buffer */
- -
- -/*
- -** ISA Bus defines
- -*/
- -#define DEPCA_IO_PORTS {0x300, 0x200, 0}
- -
- -#ifndef DEPCA_MODEL
- -#define DEPCA_MODEL DEPCA
- -#endif
- -
- -static enum {
- - DEPCA, DE100, DE101, DE200, DE201, DE202, DE210, DE212, DE422, unknown
- -} adapter = DEPCA_MODEL;
- -
- -/*
- -** Name <-> Adapter mapping
- -*/
- -
- -static char *adapter_name[] = {
- - "DEPCA",
- - "DE100","DE101",
- - "DE200","DE201","DE202",
- - "DE210","DE212",
- - "DE422",
- - ""
- -};
- -
- -#ifndef DEPCA_RAM_BASE
- -#define DEPCA_RAM_BASE 0xd0000
- -#endif
- -
- -/*
- -** Memory Alignment. Each descriptor is 4 longwords long. To force a
- -** particular alignment on the TX descriptor, adjust DESC_SKIP_LEN and
- -** DESC_ALIGN. ALIGN aligns the start address of the private memory area
- -** and hence the RX descriptor ring's first entry.
- -*/
- -#define ALIGN4 ((u32)4 - 1) /* 1 longword align */
- -#define ALIGN8 ((u32)8 - 1) /* 2 longword (quadword) align */
- -#define ALIGN ALIGN8 /* Keep the LANCE happy... */
- -
- -typedef long s32;
- -typedef unsigned long u32;
- -typedef short s16;
- -typedef unsigned short u16;
- -typedef char s8;
- -typedef unsigned char u8;
- -
- -/*
- -** The DEPCA Rx and Tx ring descriptors.
- -*/
- -struct depca_rx_desc {
- - volatile s32 base;
- - s16 buf_length; /* This length is negative 2's complement! */
- - s16 msg_length; /* This length is "normal". */
- -};
- -
- -struct depca_tx_desc {
- - volatile s32 base;
- - s16 length; /* This length is negative 2's complement! */
- - s16 misc; /* Errors and TDR info */
- -};
- -
- -#define LA_MASK 0x0000ffff /* LANCE address mask for mapping network RAM
- - to LANCE memory address space */
- -
- -/*
- -** The Lance initialization block, described in databook, in common memory.
- -*/
- -struct depca_init {
- - u16 mode; /* Mode register */
- - u8 phys_addr[ETH_ALEN]; /* Physical ethernet address */
- - u8 mcast_table[8]; /* Multicast Hash Table. */
- - u32 rx_ring; /* Rx ring base pointer & ring length */
- - u32 tx_ring; /* Tx ring base pointer & ring length */
- -};
- -
- -struct depca_private {
- - struct depca_rx_desc *rx_ring;
- - struct depca_tx_desc *tx_ring;
- - struct depca_init init_block; /* Shadow init block */
- - char *rx_memcpy[NUM_RX_DESC];
- - char *tx_memcpy[NUM_TX_DESC];
- - u32 bus_offset; /* ISA bus address offset */
- - u32 sh_mem; /* address of shared mem */
- - u32 dma_buffs; /* Rx & Tx buffer start */
- - int rx_cur, tx_cur; /* Next free ring entry */
- - int txRingMask, rxRingMask;
- - s32 rx_rlen, tx_rlen;
- - /* log2([rt]xRingMask+1) for the descriptors */
- -};
- -
- -static Address mem_start = DEPCA_RAM_BASE;
- -static Address mem_len, offset;
- -static unsigned short ioaddr = 0;
- -static struct depca_private lp;
- -
- -/*
- -** Miscellaneous defines...
- -*/
- -#define STOP_DEPCA \
- - outw(CSR0, DEPCA_ADDR);\
- - outw(STOP, DEPCA_DATA)
- -
- -/* Initialize the lance Rx and Tx descriptor rings. */
- -static void depca_init_ring(struct nic *nic)
- -{
- - int i;
- - u32 p;
- -
- - lp.rx_cur = lp.tx_cur = 0;
- - /* Initialize the base addresses and length of each buffer in the ring */
- - for (i = 0; i <= lp.rxRingMask; i++) {
- - writel((p = lp.dma_buffs + i * RX_BUFF_SZ) | R_OWN, &lp.rx_ring[i].base);
- - writew(-RX_BUFF_SZ, &lp.rx_ring[i].buf_length);
- - lp.rx_memcpy[i] = (char *) (p + lp.bus_offset);
- - }
- - for (i = 0; i <= lp.txRingMask; i++) {
- - writel((p = lp.dma_buffs + (i + lp.txRingMask + 1) * TX_BUFF_SZ) & 0x00ffffff, &lp.tx_ring[i].base);
- - lp.tx_memcpy[i] = (char *) (p + lp.bus_offset);
- - }
- -
- - /* Set up the initialization block */
- - lp.init_block.rx_ring = ((u32) ((u32) lp.rx_ring) & LA_MASK) | lp.rx_rlen;
- - lp.init_block.tx_ring = ((u32) ((u32) lp.tx_ring) & LA_MASK) | lp.tx_rlen;
- - for (i = 0; i < ETH_ALEN; i++)
- - lp.init_block.phys_addr[i] = nic->node_addr[i];
- - lp.init_block.mode = 0x0000; /* Enable the Tx and Rx */
- - memset(lp.init_block.mcast_table, 0, sizeof(lp.init_block.mcast_table));
- -}
- -
- -static void LoadCSRs(void)
- -{
- - outw(CSR1, DEPCA_ADDR); /* initialisation block address LSW */
- - outw((u16) (lp.sh_mem & LA_MASK), DEPCA_DATA);
- - outw(CSR2, DEPCA_ADDR); /* initialisation block address MSW */
- - outw((u16) ((lp.sh_mem & LA_MASK) >> 16), DEPCA_DATA);
- - outw(CSR3, DEPCA_ADDR); /* ALE control */
- - outw(ACON, DEPCA_DATA);
- - outw(CSR0, DEPCA_ADDR); /* Point back to CSR0 */
- -}
- -
- -static int InitRestartDepca(void)
- -{
- - int i;
- -
- - /* Copy the shadow init_block to shared memory */
- - memcpy_toio((char *)lp.sh_mem, &lp.init_block, sizeof(struct depca_init));
- - outw(CSR0, DEPCA_ADDR); /* point back to CSR0 */
- - outw(INIT, DEPCA_DATA); /* initialise DEPCA */
- -
- - for (i = 0; i < 100 && !(inw(DEPCA_DATA) & IDON); i++)
- - ;
- - if (i < 100) {
- - /* clear IDON by writing a 1, and start LANCE */
- - outw(IDON | STRT, DEPCA_DATA);
- - } else {
- - printf("DEPCA not initialised\n");
- - return (1);
- - }
- - return (0);
- -}
- -
- -/**************************************************************************
- -RESET - Reset adapter
- -***************************************************************************/
- -static void depca_reset(struct nic *nic)
- -{
- - s16 nicsr;
- - int i, j;
- -
- - STOP_DEPCA;
- - nicsr = inb(DEPCA_NICSR);
- - nicsr = ((nicsr & ~SHE & ~RBE & ~IEN) | IM);
- - outb(nicsr, DEPCA_NICSR);
- - if (inw(DEPCA_DATA) != STOP)
- - {
- - printf("depca: Cannot stop NIC\n");
- - return;
- - }
- -
- - /* Initialisation block */
- - lp.sh_mem = mem_start;
- - mem_start += sizeof(struct depca_init);
- - /* Tx & Rx descriptors (aligned to a quadword boundary) */
- - mem_start = (mem_start + ALIGN) & ~ALIGN;
- - lp.rx_ring = (struct depca_rx_desc *) mem_start;
- - mem_start += (sizeof(struct depca_rx_desc) * NUM_RX_DESC);
- - lp.tx_ring = (struct depca_tx_desc *) mem_start;
- - mem_start += (sizeof(struct depca_tx_desc) * NUM_TX_DESC);
- -
- - lp.bus_offset = mem_start & 0x00ff0000;
- - /* LANCE re-mapped start address */
- - lp.dma_buffs = mem_start & LA_MASK;
- -
- - /* Finish initialising the ring information. */
- - lp.rxRingMask = NUM_RX_DESC - 1;
- - lp.txRingMask = NUM_TX_DESC - 1;
- -
- - /* Calculate Tx/Rx RLEN size for the descriptors. */
- - for (i = 0, j = lp.rxRingMask; j > 0; i++) {
- - j >>= 1;
- - }
- - lp.rx_rlen = (s32) (i << 29);
- - for (i = 0, j = lp.txRingMask; j > 0; i++) {
- - j >>= 1;
- - }
- - lp.tx_rlen = (s32) (i << 29);
- -
- - /* Load the initialisation block */
- - depca_init_ring(nic);
- - LoadCSRs();
- - InitRestartDepca();
- -}
- -
- -/**************************************************************************
- -POLL - Wait for a frame
- -***************************************************************************/
- -static int depca_poll(struct nic *nic)
- -{
- - int entry;
- - u32 status;
- -
- - entry = lp.rx_cur;
- - if ((status = readl(&lp.rx_ring[entry].base) & R_OWN))
- - return (0);
- - memcpy(nic->packet, lp.rx_memcpy[entry], nic->packetlen = lp.rx_ring[entry].msg_length);
- - lp.rx_ring[entry].base |= R_OWN;
- - lp.rx_cur = (++lp.rx_cur) & lp.rxRingMask;
- - return (1);
- -}
- -
- -/**************************************************************************
- -TRANSMIT - Transmit a frame
- -***************************************************************************/
- -static void depca_transmit(
- - struct nic *nic,
- - const char *d, /* Destination */
- - unsigned int t, /* Type */
- - unsigned int s, /* size */
- - const char *p) /* Packet */
- -{
- - int entry, len;
- - char *mem;
- -
- - /* send the packet to destination */
- - /*
- - ** Caution: the right order is important here... dont
- - ** setup the ownership rights until all the other
- - ** information is in place
- - */
- - mem = lp.tx_memcpy[entry = lp.tx_cur];
- - memcpy_toio(mem, d, ETH_ALEN);
- - memcpy_toio(mem + ETH_ALEN, nic->node_addr, ETH_ALEN);
- - mem[ETH_ALEN * 2] = t >> 8;
- - mem[ETH_ALEN * 2 + 1] = t;
- - memcpy_toio(mem + ETH_HLEN, p, s);
- - s += ETH_HLEN;
- - len = (s < ETH_ZLEN ? ETH_ZLEN : s);
- - /* clean out flags */
- - writel(readl(&lp.tx_ring[entry].base) & ~T_FLAGS, &lp.tx_ring[entry].base);
- - /* clears other error flags */
- - writew(0x0000, &lp.tx_ring[entry].misc);
- - /* packet length in buffer */
- - writew(-len, &lp.tx_ring[entry].length);
- - /* start and end of packet, ownership */
- - writel(readl(&lp.tx_ring[entry].base) | (T_STP|T_ENP|T_OWN), &lp.tx_ring[entry].base);
- - /* update current pointers */
- - lp.tx_cur = (++lp.tx_cur) & lp.txRingMask;
- -}
- -
- -/**************************************************************************
- -DISABLE - Turn off ethernet interface
- -***************************************************************************/
- -static void depca_disable(struct nic *nic)
- -{
- - STOP_DEPCA;
- -}
- -
- -/*
- -** Look for a special sequence in the Ethernet station address PROM that
- -** is common across all DEPCA products. Note that the original DEPCA needs
- -** its ROM address counter to be initialized and enabled. Only enable
- -** if the first address octet is a 0x08 - this minimises the chances of
- -** messing around with some other hardware, but it assumes that this DEPCA
- -** card initialized itself correctly.
- -**
- -** Search the Ethernet address ROM for the signature. Since the ROM address
- -** counter can start at an arbitrary point, the search must include the entire
- -** probe sequence length plus the (length_of_the_signature - 1).
- -** Stop the search IMMEDIATELY after the signature is found so that the
- -** PROM address counter is correctly positioned at the start of the
- -** ethernet address for later read out.
- -*/
- -static int depca_probe1(struct nic *nic)
- -{
- - u8 data, nicsr;
- - /* This is only correct for little endian machines, but then
- - Etherboot doesn't work on anything but a PC */
- - u8 sig[] = { 0xFF, 0x00, 0x55, 0xAA, 0xFF, 0x00, 0x55, 0xAA };
- - int i, j;
- - long sum, chksum;
- -
- - data = inb(DEPCA_PROM); /* clear counter on DEPCA */
- - data = inb(DEPCA_PROM); /* read data */
- - if (data == 0x8) {
- - nicsr = inb(DEPCA_NICSR);
- - nicsr |= AAC;
- - outb(nicsr, DEPCA_NICSR);
- - }
- - for (i = 0, j = 0; j < (int)sizeof(sig) && i < PROBE_LENGTH+((int)sizeof(sig))-1; ++i) {
- - data = inb(DEPCA_PROM);
- - if (data == sig[j]) /* track signature */
- - ++j;
- - else
- - j = (data == sig[0]) ? 1 : 0;
- - }
- - if (j != sizeof(sig))
- - return (0);
- - /* put the card in its initial state */
- - STOP_DEPCA;
- - nicsr = ((inb(DEPCA_NICSR) & ~SHE & ~RBE & ~IEN) | IM);
- - outb(nicsr, DEPCA_NICSR);
- - if (inw(DEPCA_DATA) != STOP)
- - return (0);
- - memcpy((char *)mem_start, sig, sizeof(sig));
- - if (memcmp((char *)mem_start, sig, sizeof(sig)) != 0)
- - return (0);
- - for (i = 0, j = 0, sum = 0; j < 3; j++) {
- - sum <<= 1;
- - if (sum > 0xFFFF)
- - sum -= 0xFFFF;
- - sum += (u8)(nic->node_addr[i++] = inb(DEPCA_PROM));
- - sum += (u16)((nic->node_addr[i++] = inb(DEPCA_PROM)) << 8);
- - if (sum > 0xFFFF)
- - sum -= 0xFFFF;
- - }
- - if (sum == 0xFFFF)
- - sum = 0;
- - chksum = (u8)inb(DEPCA_PROM);
- - chksum |= (u16)(inb(DEPCA_PROM) << 8);
- - mem_len = (adapter == DEPCA) ? (48 << 10) : (64 << 10);
- - offset = 0;
- - if (nicsr & BUF) {
- - offset = 0x8000;
- - nicsr &= ~BS;
- - mem_len -= (32 << 10);
- - }
- - if (adapter != DEPCA) /* enable shadow RAM */
- - outb(nicsr |= SHE, DEPCA_NICSR);
- - printf("%s base %#hX, memory [%#hX-%#hX], addr %!",
- - adapter_name[adapter], ioaddr, mem_start, mem_start + mem_len,
- - nic->node_addr);
- - if (sum != chksum)
- - printf(" (bad checksum)");
- - putchar('\n');
- - return (1);
- -}
- -
- -/**************************************************************************
- -PROBE - Look for an adapter, this routine's visible to the outside
- -***************************************************************************/
- -struct nic *depca_probe(struct nic *nic, unsigned short *probe_addrs)
- -{
- - static unsigned short base[] = DEPCA_IO_PORTS;
- - int i;
- -
- - if (probe_addrs == 0 || probe_addrs[0] == 0)
- - probe_addrs = base; /* Use defaults */
- - for (i = 0; (ioaddr = base[i]) != 0; ++i) {
- - if (depca_probe1(nic))
- - break;
- - }
- - if (ioaddr == 0)
- - return (0);
- - depca_reset(nic);
- - /* point to NIC specific routines */
- - nic->reset = depca_reset;
- - nic->poll = depca_poll;
- - nic->transmit = depca_transmit;
- - nic->disable = depca_disable;
- - return (nic);
- -}
- diff -Naur grub-0.97.orig/netboot/dev.h grub-0.97/netboot/dev.h
- --- grub-0.97.orig/netboot/dev.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/dev.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,83 @@
- +#ifndef _DEV_H
- +#define _DEV_H
- +
- +#include "isa.h"
- +#include "pci.h"
- +
- +/* Need to check the packing of this struct if Etherboot is ported */
- +struct dev_id
- +{
- + unsigned short vendor_id;
- + unsigned short device_id;
- + unsigned char bus_type;
- +#define PCI_BUS_TYPE 1
- +#define ISA_BUS_TYPE 2
- +};
- +
- +/* Dont use sizeof, that will include the padding */
- +#define DEV_ID_SIZE 8
- +
- +
- +struct pci_probe_state
- +{
- +#ifdef CONFIG_PCI
- + struct pci_device dev;
- + int advance;
- +#else
- + int dummy;
- +#endif
- +};
- +struct isa_probe_state
- +{
- +#ifdef CONFIG_ISA
- + const struct isa_driver *driver;
- + int advance;
- +#else
- + int dummy;
- +#endif
- +};
- +
- +union probe_state
- +{
- + struct pci_probe_state pci;
- + struct isa_probe_state isa;
- +};
- +
- +struct dev
- +{
- + void (*disable)P((struct dev *));
- + struct dev_id devid; /* device ID string (sent to DHCP server) */
- + int index; /* Index of next device on this controller to probe */
- + int type; /* Type of device I am probing for */
- + int how_probe; /* First, next or awake */
- + int to_probe; /* Flavor of device I am probing */
- + int failsafe; /* Failsafe probe requested */
- + int type_index; /* Index of this device (within type) */
- +#define PROBE_NONE 0
- +#define PROBE_PCI 1
- +#define PROBE_ISA 2
- + union probe_state state;
- +};
- +
- +
- +#define NIC_DRIVER 0
- +#define DISK_DRIVER 1
- +#define FLOPPY_DRIVER 2
- +
- +#define BRIDGE_DRIVER 1000
- +
- +#define PROBE_FIRST (-1)
- +#define PROBE_NEXT 0
- +#define PROBE_AWAKE 1 /* After calling disable bring up the same device */
- +
- +/* The probe result codes are selected
- + * to allow them to be fed back into the probe
- + * routine and get a successful probe.
- + */
- +#define PROBE_FAILED PROBE_FIRST
- +#define PROBE_WORKED PROBE_NEXT
- +
- +extern int probe(struct dev *dev);
- +extern void disable(struct dev *dev);
- +
- +#endif /* _DEV_H */
- diff -Naur grub-0.97.orig/netboot/e1000.c grub-0.97/netboot/e1000.c
- --- grub-0.97.orig/netboot/e1000.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/e1000.c 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,3682 @@
- +/**************************************************************************
- +Etherboot - BOOTP/TFTP Bootstrap Program
- +Inter Pro 1000 for Etherboot
- +Drivers are port from Intel's Linux driver e1000-4.3.15
- +
- +***************************************************************************/
- +/*******************************************************************************
- +
- +
- + Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
- +
- + This program is free software; you can redistribute it and/or modify it
- + under the terms of the GNU General Public License as published by the Free
- + Software Foundation; either version 2 of the License, or (at your option)
- + any later version.
- +
- + This program is distributed in the hope that it will be useful, but WITHOUT
- + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- + more details.
- +
- + You should have received a copy of the GNU General Public License along with
- + this program; if not, write to the Free Software Foundation, Inc., 59
- + Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- +
- + The full GNU General Public License is included in this distribution in the
- + file called LICENSE.
- +
- + Contact Information:
- + Linux NICS <linux.nics@intel.com>
- + Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- +
- +*******************************************************************************/
- +/*
- + * Copyright (C) Archway Digital Solutions.
- + *
- + * written by Chrsitopher Li <cli at arcyway dot com> or <chrisl at gnuchina dot org>
- + * 2/9/2002
- + *
- + * Copyright (C) Linux Networx.
- + * Massive upgrade to work with the new intel gigabit NICs.
- + * <ebiederman at lnxi dot com>
- + *
- + * Support for 82541ei & 82547ei chips from Intel's Linux driver 5.1.13 added by
- + * Georg Baum <gbaum@users.sf.net>, sponsored by PetaMem GmbH and linkLINE Communications, Inc.
- + *
- + * 01/2004: Updated to Linux driver 5.2.22 by Georg Baum <gbaum@users.sf.net>
- + */
- +
- +/* to get some global routines like printf */
- +#include "etherboot.h"
- +/* to get the interface to the body of the program */
- +#include "nic.h"
- +/* to get the PCI support functions, if this is a PCI NIC */
- +#include "pci.h"
- +#include "timer.h"
- +
- +typedef unsigned char *dma_addr_t;
- +
- +typedef enum {
- + FALSE = 0,
- + TRUE = 1
- +} boolean_t;
- +
- +#define DEBUG 0
- +
- +
- +/* Some pieces of code are disabled with #if 0 ... #endif.
- + * They are not deleted to show where the etherboot driver differs
- + * from the linux driver below the function level.
- + * Some member variables of the hw struct have been eliminated
- + * and the corresponding inplace checks inserted instead.
- + * Pieces such as LED handling that we definitely don't need are deleted.
- + *
- + * The following defines should not be needed normally,
- + * but may be helpful for debugging purposes. */
- +
- +/* Define this if you want to program the transmission control register
- + * the way the Linux driver does it. */
- +#undef LINUX_DRIVER_TCTL
- +
- +/* Define this to behave more like the Linux driver. */
- +#undef LINUX_DRIVER
- +
- +#include "e1000_hw.h"
- +
- +/* NIC specific static variables go here */
- +static struct e1000_hw hw;
- +static char tx_pool[128 + 16];
- +static char rx_pool[128 + 16];
- +static char packet[2096];
- +
- +static struct e1000_tx_desc *tx_base;
- +static struct e1000_rx_desc *rx_base;
- +
- +static int tx_tail;
- +static int rx_tail, rx_last;
- +
- +/* Function forward declarations */
- +static int e1000_setup_link(struct e1000_hw *hw);
- +static int e1000_setup_fiber_serdes_link(struct e1000_hw *hw);
- +static int e1000_setup_copper_link(struct e1000_hw *hw);
- +static int e1000_phy_setup_autoneg(struct e1000_hw *hw);
- +static void e1000_config_collision_dist(struct e1000_hw *hw);
- +static int e1000_config_mac_to_phy(struct e1000_hw *hw);
- +static int e1000_config_fc_after_link_up(struct e1000_hw *hw);
- +static int e1000_check_for_link(struct e1000_hw *hw);
- +static int e1000_wait_autoneg(struct e1000_hw *hw);
- +static void e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t *speed, uint16_t *duplex);
- +static int e1000_read_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *phy_data);
- +static int e1000_read_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *phy_data);
- +static int e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t phy_data);
- +static int e1000_write_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, uint16_t phy_data);
- +static void e1000_phy_hw_reset(struct e1000_hw *hw);
- +static int e1000_phy_reset(struct e1000_hw *hw);
- +static int e1000_detect_gig_phy(struct e1000_hw *hw);
- +
- +/* Printing macros... */
- +
- +#define E1000_ERR(args...) printf("e1000: " args)
- +
- +#if DEBUG >= 3
- +#define E1000_DBG(args...) printf("e1000: " args)
- +#else
- +#define E1000_DBG(args...)
- +#endif
- +
- +#define MSGOUT(S, A, B) printk(S "\n", A, B)
- +#if DEBUG >= 2
- +#define DEBUGFUNC(F) DEBUGOUT(F "\n");
- +#else
- +#define DEBUGFUNC(F)
- +#endif
- +#if DEBUG >= 1
- +#define DEBUGOUT(S) printf(S)
- +#define DEBUGOUT1(S,A) printf(S,A)
- +#define DEBUGOUT2(S,A,B) printf(S,A,B)
- +#define DEBUGOUT3(S,A,B,C) printf(S,A,B,C)
- +#define DEBUGOUT7(S,A,B,C,D,E,F,G) printf(S,A,B,C,D,E,F,G)
- +#else
- +#define DEBUGOUT(S)
- +#define DEBUGOUT1(S,A)
- +#define DEBUGOUT2(S,A,B)
- +#define DEBUGOUT3(S,A,B,C)
- +#define DEBUGOUT7(S,A,B,C,D,E,F,G)
- +#endif
- +
- +#define E1000_WRITE_REG(a, reg, value) ( \
- + ((a)->mac_type >= e1000_82543) ? \
- + (writel((value), ((a)->hw_addr + E1000_##reg))) : \
- + (writel((value), ((a)->hw_addr + E1000_82542_##reg))))
- +
- +#define E1000_READ_REG(a, reg) ( \
- + ((a)->mac_type >= e1000_82543) ? \
- + readl((a)->hw_addr + E1000_##reg) : \
- + readl((a)->hw_addr + E1000_82542_##reg))
- +
- +#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \
- + ((a)->mac_type >= e1000_82543) ? \
- + writel((value), ((a)->hw_addr + E1000_##reg + ((offset) << 2))) : \
- + writel((value), ((a)->hw_addr + E1000_82542_##reg + ((offset) << 2))))
- +
- +#define E1000_READ_REG_ARRAY(a, reg, offset) ( \
- + ((a)->mac_type >= e1000_82543) ? \
- + readl((a)->hw_addr + E1000_##reg + ((offset) << 2)) : \
- + readl((a)->hw_addr + E1000_82542_##reg + ((offset) << 2)))
- +
- +#define E1000_WRITE_FLUSH(a) {uint32_t x; x = E1000_READ_REG(a, STATUS);}
- +
- +uint32_t
- +e1000_io_read(struct e1000_hw *hw __unused, uint32_t port)
- +{
- + return inl(port);
- +}
- +
- +void
- +e1000_io_write(struct e1000_hw *hw __unused, uint32_t port, uint32_t value)
- +{
- + outl(value, port);
- +}
- +
- +static inline void e1000_pci_set_mwi(struct e1000_hw *hw)
- +{
- + pci_write_config_word(hw->pdev, PCI_COMMAND, hw->pci_cmd_word);
- +}
- +
- +static inline void e1000_pci_clear_mwi(struct e1000_hw *hw)
- +{
- + pci_write_config_word(hw->pdev, PCI_COMMAND,
- + hw->pci_cmd_word & ~PCI_COMMAND_INVALIDATE);
- +}
- +
- +/******************************************************************************
- + * Raises the EEPROM's clock input.
- + *
- + * hw - Struct containing variables accessed by shared code
- + * eecd - EECD's current value
- + *****************************************************************************/
- +static void
- +e1000_raise_ee_clk(struct e1000_hw *hw,
- + uint32_t *eecd)
- +{
- + /* Raise the clock input to the EEPROM (by setting the SK bit), and then
- + * wait <delay> microseconds.
- + */
- + *eecd = *eecd | E1000_EECD_SK;
- + E1000_WRITE_REG(hw, EECD, *eecd);
- + E1000_WRITE_FLUSH(hw);
- + udelay(hw->eeprom.delay_usec);
- +}
- +
- +/******************************************************************************
- + * Lowers the EEPROM's clock input.
- + *
- + * hw - Struct containing variables accessed by shared code
- + * eecd - EECD's current value
- + *****************************************************************************/
- +static void
- +e1000_lower_ee_clk(struct e1000_hw *hw,
- + uint32_t *eecd)
- +{
- + /* Lower the clock input to the EEPROM (by clearing the SK bit), and then
- + * wait 50 microseconds.
- + */
- + *eecd = *eecd & ~E1000_EECD_SK;
- + E1000_WRITE_REG(hw, EECD, *eecd);
- + E1000_WRITE_FLUSH(hw);
- + udelay(hw->eeprom.delay_usec);
- +}
- +
- +/******************************************************************************
- + * Shift data bits out to the EEPROM.
- + *
- + * hw - Struct containing variables accessed by shared code
- + * data - data to send to the EEPROM
- + * count - number of bits to shift out
- + *****************************************************************************/
- +static void
- +e1000_shift_out_ee_bits(struct e1000_hw *hw,
- + uint16_t data,
- + uint16_t count)
- +{
- + struct e1000_eeprom_info *eeprom = &hw->eeprom;
- + uint32_t eecd;
- + uint32_t mask;
- +
- + /* We need to shift "count" bits out to the EEPROM. So, value in the
- + * "data" parameter will be shifted out to the EEPROM one bit at a time.
- + * In order to do this, "data" must be broken down into bits.
- + */
- + mask = 0x01 << (count - 1);
- + eecd = E1000_READ_REG(hw, EECD);
- + if (eeprom->type == e1000_eeprom_microwire) {
- + eecd &= ~E1000_EECD_DO;
- + } else if (eeprom->type == e1000_eeprom_spi) {
- + eecd |= E1000_EECD_DO;
- + }
- + do {
- + /* A "1" is shifted out to the EEPROM by setting bit "DI" to a "1",
- + * and then raising and then lowering the clock (the SK bit controls
- + * the clock input to the EEPROM). A "0" is shifted out to the EEPROM
- + * by setting "DI" to "0" and then raising and then lowering the clock.
- + */
- + eecd &= ~E1000_EECD_DI;
- +
- + if(data & mask)
- + eecd |= E1000_EECD_DI;
- +
- + E1000_WRITE_REG(hw, EECD, eecd);
- + E1000_WRITE_FLUSH(hw);
- +
- + udelay(eeprom->delay_usec);
- +
- + e1000_raise_ee_clk(hw, &eecd);
- + e1000_lower_ee_clk(hw, &eecd);
- +
- + mask = mask >> 1;
- +
- + } while(mask);
- +
- + /* We leave the "DI" bit set to "0" when we leave this routine. */
- + eecd &= ~E1000_EECD_DI;
- + E1000_WRITE_REG(hw, EECD, eecd);
- +}
- +
- +/******************************************************************************
- + * Shift data bits in from the EEPROM
- + *
- + * hw - Struct containing variables accessed by shared code
- + *****************************************************************************/
- +static uint16_t
- +e1000_shift_in_ee_bits(struct e1000_hw *hw,
- + uint16_t count)
- +{
- + uint32_t eecd;
- + uint32_t i;
- + uint16_t data;
- +
- + /* In order to read a register from the EEPROM, we need to shift 'count'
- + * bits in from the EEPROM. Bits are "shifted in" by raising the clock
- + * input to the EEPROM (setting the SK bit), and then reading the value of
- + * the "DO" bit. During this "shifting in" process the "DI" bit should
- + * always be clear.
- + */
- +
- + eecd = E1000_READ_REG(hw, EECD);
- +
- + eecd &= ~(E1000_EECD_DO | E1000_EECD_DI);
- + data = 0;
- +
- + for(i = 0; i < count; i++) {
- + data = data << 1;
- + e1000_raise_ee_clk(hw, &eecd);
- +
- + eecd = E1000_READ_REG(hw, EECD);
- +
- + eecd &= ~(E1000_EECD_DI);
- + if(eecd & E1000_EECD_DO)
- + data |= 1;
- +
- + e1000_lower_ee_clk(hw, &eecd);
- + }
- +
- + return data;
- +}
- +
- +/******************************************************************************
- + * Prepares EEPROM for access
- + *
- + * hw - Struct containing variables accessed by shared code
- + *
- + * Lowers EEPROM clock. Clears input pin. Sets the chip select pin. This
- + * function should be called before issuing a command to the EEPROM.
- + *****************************************************************************/
- +static int32_t
- +e1000_acquire_eeprom(struct e1000_hw *hw)
- +{
- + struct e1000_eeprom_info *eeprom = &hw->eeprom;
- + uint32_t eecd, i=0;
- +
- + eecd = E1000_READ_REG(hw, EECD);
- +
- + /* Request EEPROM Access */
- + if(hw->mac_type > e1000_82544) {
- + eecd |= E1000_EECD_REQ;
- + E1000_WRITE_REG(hw, EECD, eecd);
- + eecd = E1000_READ_REG(hw, EECD);
- + while((!(eecd & E1000_EECD_GNT)) &&
- + (i < E1000_EEPROM_GRANT_ATTEMPTS)) {
- + i++;
- + udelay(5);
- + eecd = E1000_READ_REG(hw, EECD);
- + }
- + if(!(eecd & E1000_EECD_GNT)) {
- + eecd &= ~E1000_EECD_REQ;
- + E1000_WRITE_REG(hw, EECD, eecd);
- + DEBUGOUT("Could not acquire EEPROM grant\n");
- + return -E1000_ERR_EEPROM;
- + }
- + }
- +
- + /* Setup EEPROM for Read/Write */
- +
- + if (eeprom->type == e1000_eeprom_microwire) {
- + /* Clear SK and DI */
- + eecd &= ~(E1000_EECD_DI | E1000_EECD_SK);
- + E1000_WRITE_REG(hw, EECD, eecd);
- +
- + /* Set CS */
- + eecd |= E1000_EECD_CS;
- + E1000_WRITE_REG(hw, EECD, eecd);
- + } else if (eeprom->type == e1000_eeprom_spi) {
- + /* Clear SK and CS */
- + eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
- + E1000_WRITE_REG(hw, EECD, eecd);
- + udelay(1);
- + }
- +
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- + * Returns EEPROM to a "standby" state
- + *
- + * hw - Struct containing variables accessed by shared code
- + *****************************************************************************/
- +static void
- +e1000_standby_eeprom(struct e1000_hw *hw)
- +{
- + struct e1000_eeprom_info *eeprom = &hw->eeprom;
- + uint32_t eecd;
- +
- + eecd = E1000_READ_REG(hw, EECD);
- +
- + if(eeprom->type == e1000_eeprom_microwire) {
- +
- + /* Deselect EEPROM */
- + eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
- + E1000_WRITE_REG(hw, EECD, eecd);
- + E1000_WRITE_FLUSH(hw);
- + udelay(eeprom->delay_usec);
- +
- + /* Clock high */
- + eecd |= E1000_EECD_SK;
- + E1000_WRITE_REG(hw, EECD, eecd);
- + E1000_WRITE_FLUSH(hw);
- + udelay(eeprom->delay_usec);
- +
- + /* Select EEPROM */
- + eecd |= E1000_EECD_CS;
- + E1000_WRITE_REG(hw, EECD, eecd);
- + E1000_WRITE_FLUSH(hw);
- + udelay(eeprom->delay_usec);
- +
- + /* Clock low */
- + eecd &= ~E1000_EECD_SK;
- + E1000_WRITE_REG(hw, EECD, eecd);
- + E1000_WRITE_FLUSH(hw);
- + udelay(eeprom->delay_usec);
- + } else if(eeprom->type == e1000_eeprom_spi) {
- + /* Toggle CS to flush commands */
- + eecd |= E1000_EECD_CS;
- + E1000_WRITE_REG(hw, EECD, eecd);
- + E1000_WRITE_FLUSH(hw);
- + udelay(eeprom->delay_usec);
- + eecd &= ~E1000_EECD_CS;
- + E1000_WRITE_REG(hw, EECD, eecd);
- + E1000_WRITE_FLUSH(hw);
- + udelay(eeprom->delay_usec);
- + }
- +}
- +
- +/******************************************************************************
- + * Terminates a command by inverting the EEPROM's chip select pin
- + *
- + * hw - Struct containing variables accessed by shared code
- + *****************************************************************************/
- +static void
- +e1000_release_eeprom(struct e1000_hw *hw)
- +{
- + uint32_t eecd;
- +
- + eecd = E1000_READ_REG(hw, EECD);
- +
- + if (hw->eeprom.type == e1000_eeprom_spi) {
- + eecd |= E1000_EECD_CS; /* Pull CS high */
- + eecd &= ~E1000_EECD_SK; /* Lower SCK */
- +
- + E1000_WRITE_REG(hw, EECD, eecd);
- +
- + udelay(hw->eeprom.delay_usec);
- + } else if(hw->eeprom.type == e1000_eeprom_microwire) {
- + /* cleanup eeprom */
- +
- + /* CS on Microwire is active-high */
- + eecd &= ~(E1000_EECD_CS | E1000_EECD_DI);
- +
- + E1000_WRITE_REG(hw, EECD, eecd);
- +
- + /* Rising edge of clock */
- + eecd |= E1000_EECD_SK;
- + E1000_WRITE_REG(hw, EECD, eecd);
- + E1000_WRITE_FLUSH(hw);
- + udelay(hw->eeprom.delay_usec);
- +
- + /* Falling edge of clock */
- + eecd &= ~E1000_EECD_SK;
- + E1000_WRITE_REG(hw, EECD, eecd);
- + E1000_WRITE_FLUSH(hw);
- + udelay(hw->eeprom.delay_usec);
- + }
- +
- + /* Stop requesting EEPROM access */
- + if(hw->mac_type > e1000_82544) {
- + eecd &= ~E1000_EECD_REQ;
- + E1000_WRITE_REG(hw, EECD, eecd);
- + }
- +}
- +
- +/******************************************************************************
- + * Reads a 16 bit word from the EEPROM.
- + *
- + * hw - Struct containing variables accessed by shared code
- + *****************************************************************************/
- +static int32_t
- +e1000_spi_eeprom_ready(struct e1000_hw *hw)
- +{
- + uint16_t retry_count = 0;
- + uint8_t spi_stat_reg;
- +
- + /* Read "Status Register" repeatedly until the LSB is cleared. The
- + * EEPROM will signal that the command has been completed by clearing
- + * bit 0 of the internal status register. If it's not cleared within
- + * 5 milliseconds, then error out.
- + */
- + retry_count = 0;
- + do {
- + e1000_shift_out_ee_bits(hw, EEPROM_RDSR_OPCODE_SPI,
- + hw->eeprom.opcode_bits);
- + spi_stat_reg = (uint8_t)e1000_shift_in_ee_bits(hw, 8);
- + if (!(spi_stat_reg & EEPROM_STATUS_RDY_SPI))
- + break;
- +
- + udelay(5);
- + retry_count += 5;
- +
- + } while(retry_count < EEPROM_MAX_RETRY_SPI);
- +
- + /* ATMEL SPI write time could vary from 0-20mSec on 3.3V devices (and
- + * only 0-5mSec on 5V devices)
- + */
- + if(retry_count >= EEPROM_MAX_RETRY_SPI) {
- + DEBUGOUT("SPI EEPROM Status error\n");
- + return -E1000_ERR_EEPROM;
- + }
- +
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- + * Reads a 16 bit word from the EEPROM.
- + *
- + * hw - Struct containing variables accessed by shared code
- + * offset - offset of word in the EEPROM to read
- + * data - word read from the EEPROM
- + * words - number of words to read
- + *****************************************************************************/
- +static int
- +e1000_read_eeprom(struct e1000_hw *hw,
- + uint16_t offset,
- + uint16_t words,
- + uint16_t *data)
- +{
- + struct e1000_eeprom_info *eeprom = &hw->eeprom;
- + uint32_t i = 0;
- +
- + DEBUGFUNC("e1000_read_eeprom");
- +
- + /* A check for invalid values: offset too large, too many words, and not
- + * enough words.
- + */
- + if((offset > eeprom->word_size) || (words > eeprom->word_size - offset) ||
- + (words == 0)) {
- + DEBUGOUT("\"words\" parameter out of bounds\n");
- + return -E1000_ERR_EEPROM;
- + }
- +
- + /* Prepare the EEPROM for reading */
- + if(e1000_acquire_eeprom(hw) != E1000_SUCCESS)
- + return -E1000_ERR_EEPROM;
- +
- + if(eeprom->type == e1000_eeprom_spi) {
- + uint16_t word_in;
- + uint8_t read_opcode = EEPROM_READ_OPCODE_SPI;
- +
- + if(e1000_spi_eeprom_ready(hw)) {
- + e1000_release_eeprom(hw);
- + return -E1000_ERR_EEPROM;
- + }
- +
- + e1000_standby_eeprom(hw);
- +
- + /* Some SPI eeproms use the 8th address bit embedded in the opcode */
- + if((eeprom->address_bits == 8) && (offset >= 128))
- + read_opcode |= EEPROM_A8_OPCODE_SPI;
- +
- + /* Send the READ command (opcode + addr) */
- + e1000_shift_out_ee_bits(hw, read_opcode, eeprom->opcode_bits);
- + e1000_shift_out_ee_bits(hw, (uint16_t)(offset*2), eeprom->address_bits);
- +
- + /* Read the data. The address of the eeprom internally increments with
- + * each byte (spi) being read, saving on the overhead of eeprom setup
- + * and tear-down. The address counter will roll over if reading beyond
- + * the size of the eeprom, thus allowing the entire memory to be read
- + * starting from any offset. */
- + for (i = 0; i < words; i++) {
- + word_in = e1000_shift_in_ee_bits(hw, 16);
- + data[i] = (word_in >> 8) | (word_in << 8);
- + }
- + } else if(eeprom->type == e1000_eeprom_microwire) {
- + for (i = 0; i < words; i++) {
- + /* Send the READ command (opcode + addr) */
- + e1000_shift_out_ee_bits(hw, EEPROM_READ_OPCODE_MICROWIRE,
- + eeprom->opcode_bits);
- + e1000_shift_out_ee_bits(hw, (uint16_t)(offset + i),
- + eeprom->address_bits);
- +
- + /* Read the data. For microwire, each word requires the overhead
- + * of eeprom setup and tear-down. */
- + data[i] = e1000_shift_in_ee_bits(hw, 16);
- + e1000_standby_eeprom(hw);
- + }
- + }
- +
- + /* End this read operation */
- + e1000_release_eeprom(hw);
- +
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- + * Verifies that the EEPROM has a valid checksum
- + *
- + * hw - Struct containing variables accessed by shared code
- + *
- + * Reads the first 64 16 bit words of the EEPROM and sums the values read.
- + * If the the sum of the 64 16 bit words is 0xBABA, the EEPROM's checksum is
- + * valid.
- + *****************************************************************************/
- +static int
- +e1000_validate_eeprom_checksum(struct e1000_hw *hw)
- +{
- + uint16_t checksum = 0;
- + uint16_t i, eeprom_data;
- +
- + DEBUGFUNC("e1000_validate_eeprom_checksum");
- +
- + for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) {
- + if(e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) {
- + DEBUGOUT("EEPROM Read Error\n");
- + return -E1000_ERR_EEPROM;
- + }
- + checksum += eeprom_data;
- + }
- +
- + if(checksum == (uint16_t) EEPROM_SUM)
- + return E1000_SUCCESS;
- + else {
- + DEBUGOUT("EEPROM Checksum Invalid\n");
- + return -E1000_ERR_EEPROM;
- + }
- +}
- +
- +/******************************************************************************
- + * Reads the adapter's MAC address from the EEPROM and inverts the LSB for the
- + * second function of dual function devices
- + *
- + * hw - Struct containing variables accessed by shared code
- + *****************************************************************************/
- +static int
- +e1000_read_mac_addr(struct e1000_hw *hw)
- +{
- + uint16_t offset;
- + uint16_t eeprom_data;
- + int i;
- +
- + DEBUGFUNC("e1000_read_mac_addr");
- +
- + for(i = 0; i < NODE_ADDRESS_SIZE; i += 2) {
- + offset = i >> 1;
- + if(e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) {
- + DEBUGOUT("EEPROM Read Error\n");
- + return -E1000_ERR_EEPROM;
- + }
- + hw->mac_addr[i] = eeprom_data & 0xff;
- + hw->mac_addr[i+1] = (eeprom_data >> 8) & 0xff;
- + }
- + if(((hw->mac_type == e1000_82546) || (hw->mac_type == e1000_82546_rev_3)) &&
- + (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1))
- + /* Invert the last bit if this is the second device */
- + hw->mac_addr[5] ^= 1;
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- + * Initializes receive address filters.
- + *
- + * hw - Struct containing variables accessed by shared code
- + *
- + * Places the MAC address in receive address register 0 and clears the rest
- + * of the receive addresss registers. Clears the multicast table. Assumes
- + * the receiver is in reset when the routine is called.
- + *****************************************************************************/
- +static void
- +e1000_init_rx_addrs(struct e1000_hw *hw)
- +{
- + uint32_t i;
- + uint32_t addr_low;
- + uint32_t addr_high;
- +
- + DEBUGFUNC("e1000_init_rx_addrs");
- +
- + /* Setup the receive address. */
- + DEBUGOUT("Programming MAC Address into RAR[0]\n");
- + addr_low = (hw->mac_addr[0] |
- + (hw->mac_addr[1] << 8) |
- + (hw->mac_addr[2] << 16) | (hw->mac_addr[3] << 24));
- +
- + addr_high = (hw->mac_addr[4] |
- + (hw->mac_addr[5] << 8) | E1000_RAH_AV);
- +
- + E1000_WRITE_REG_ARRAY(hw, RA, 0, addr_low);
- + E1000_WRITE_REG_ARRAY(hw, RA, 1, addr_high);
- +
- + /* Zero out the other 15 receive addresses. */
- + DEBUGOUT("Clearing RAR[1-15]\n");
- + for(i = 1; i < E1000_RAR_ENTRIES; i++) {
- + E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
- + E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
- + }
- +}
- +
- +/******************************************************************************
- + * Clears the VLAN filer table
- + *
- + * hw - Struct containing variables accessed by shared code
- + *****************************************************************************/
- +static void
- +e1000_clear_vfta(struct e1000_hw *hw)
- +{
- + uint32_t offset;
- +
- + for(offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++)
- + E1000_WRITE_REG_ARRAY(hw, VFTA, offset, 0);
- +}
- +
- +/******************************************************************************
- +* Writes a value to one of the devices registers using port I/O (as opposed to
- +* memory mapped I/O). Only 82544 and newer devices support port I/O. *
- +* hw - Struct containing variables accessed by shared code
- +* offset - offset to write to * value - value to write
- +*****************************************************************************/
- +void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset, uint32_t value){
- + uint32_t io_addr = hw->io_base;
- + uint32_t io_data = hw->io_base + 4;
- + e1000_io_write(hw, io_addr, offset);
- + e1000_io_write(hw, io_data, value);
- +}
- +
- +/******************************************************************************
- + * Set the phy type member in the hw struct.
- + *
- + * hw - Struct containing variables accessed by shared code
- + *****************************************************************************/
- +static int32_t
- +e1000_set_phy_type(struct e1000_hw *hw)
- +{
- + DEBUGFUNC("e1000_set_phy_type");
- +
- + switch(hw->phy_id) {
- + case M88E1000_E_PHY_ID:
- + case M88E1000_I_PHY_ID:
- + case M88E1011_I_PHY_ID:
- + hw->phy_type = e1000_phy_m88;
- + break;
- + case IGP01E1000_I_PHY_ID:
- + hw->phy_type = e1000_phy_igp;
- + break;
- + default:
- + /* Should never have loaded on this device */
- + hw->phy_type = e1000_phy_undefined;
- + return -E1000_ERR_PHY_TYPE;
- + }
- +
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- + * IGP phy init script - initializes the GbE PHY
- + *
- + * hw - Struct containing variables accessed by shared code
- + *****************************************************************************/
- +static void
- +e1000_phy_init_script(struct e1000_hw *hw)
- +{
- + DEBUGFUNC("e1000_phy_init_script");
- +
- +#if 0
- + /* See e1000_sw_init() of the Linux driver */
- + if(hw->phy_init_script) {
- +#else
- + if((hw->mac_type == e1000_82541) ||
- + (hw->mac_type == e1000_82547) ||
- + (hw->mac_type == e1000_82541_rev_2) ||
- + (hw->mac_type == e1000_82547_rev_2)) {
- +#endif
- + mdelay(20);
- +
- + e1000_write_phy_reg(hw,0x0000,0x0140);
- +
- + mdelay(5);
- +
- + if(hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547) {
- + e1000_write_phy_reg(hw, 0x1F95, 0x0001);
- +
- + e1000_write_phy_reg(hw, 0x1F71, 0xBD21);
- +
- + e1000_write_phy_reg(hw, 0x1F79, 0x0018);
- +
- + e1000_write_phy_reg(hw, 0x1F30, 0x1600);
- +
- + e1000_write_phy_reg(hw, 0x1F31, 0x0014);
- +
- + e1000_write_phy_reg(hw, 0x1F32, 0x161C);
- +
- + e1000_write_phy_reg(hw, 0x1F94, 0x0003);
- +
- + e1000_write_phy_reg(hw, 0x1F96, 0x003F);
- +
- + e1000_write_phy_reg(hw, 0x2010, 0x0008);
- + } else {
- + e1000_write_phy_reg(hw, 0x1F73, 0x0099);
- + }
- +
- + e1000_write_phy_reg(hw, 0x0000, 0x3300);
- +
- +
- + if(hw->mac_type == e1000_82547) {
- + uint16_t fused, fine, coarse;
- +
- + /* Move to analog registers page */
- + e1000_read_phy_reg(hw, IGP01E1000_ANALOG_SPARE_FUSE_STATUS, &fused);
- +
- + if(!(fused & IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) {
- + e1000_read_phy_reg(hw, IGP01E1000_ANALOG_FUSE_STATUS, &fused);
- +
- + fine = fused & IGP01E1000_ANALOG_FUSE_FINE_MASK;
- + coarse = fused & IGP01E1000_ANALOG_FUSE_COARSE_MASK;
- +
- + if(coarse > IGP01E1000_ANALOG_FUSE_COARSE_THRESH) {
- + coarse -= IGP01E1000_ANALOG_FUSE_COARSE_10;
- + fine -= IGP01E1000_ANALOG_FUSE_FINE_1;
- + } else if(coarse == IGP01E1000_ANALOG_FUSE_COARSE_THRESH)
- + fine -= IGP01E1000_ANALOG_FUSE_FINE_10;
- +
- + fused = (fused & IGP01E1000_ANALOG_FUSE_POLY_MASK) |
- + (fine & IGP01E1000_ANALOG_FUSE_FINE_MASK) |
- + (coarse & IGP01E1000_ANALOG_FUSE_COARSE_MASK);
- +
- + e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_CONTROL, fused);
- + e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_BYPASS,
- + IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL);
- + }
- + }
- + }
- +}
- +
- +/******************************************************************************
- + * Set the mac type member in the hw struct.
- + *
- + * hw - Struct containing variables accessed by shared code
- + *****************************************************************************/
- +static int
- +e1000_set_mac_type(struct e1000_hw *hw)
- +{
- + DEBUGFUNC("e1000_set_mac_type");
- +
- + switch (hw->device_id) {
- + case E1000_DEV_ID_82542:
- + switch (hw->revision_id) {
- + case E1000_82542_2_0_REV_ID:
- + hw->mac_type = e1000_82542_rev2_0;
- + break;
- + case E1000_82542_2_1_REV_ID:
- + hw->mac_type = e1000_82542_rev2_1;
- + break;
- + default:
- + /* Invalid 82542 revision ID */
- + return -E1000_ERR_MAC_TYPE;
- + }
- + break;
- + case E1000_DEV_ID_82543GC_FIBER:
- + case E1000_DEV_ID_82543GC_COPPER:
- + hw->mac_type = e1000_82543;
- + break;
- + case E1000_DEV_ID_82544EI_COPPER:
- + case E1000_DEV_ID_82544EI_FIBER:
- + case E1000_DEV_ID_82544GC_COPPER:
- + case E1000_DEV_ID_82544GC_LOM:
- + hw->mac_type = e1000_82544;
- + break;
- + case E1000_DEV_ID_82540EM:
- + case E1000_DEV_ID_82540EM_LOM:
- + case E1000_DEV_ID_82540EP:
- + case E1000_DEV_ID_82540EP_LOM:
- + case E1000_DEV_ID_82540EP_LP:
- + hw->mac_type = e1000_82540;
- + break;
- + case E1000_DEV_ID_82545EM_COPPER:
- + case E1000_DEV_ID_82545EM_FIBER:
- + hw->mac_type = e1000_82545;
- + break;
- + case E1000_DEV_ID_82545GM_COPPER:
- + case E1000_DEV_ID_82545GM_FIBER:
- + case E1000_DEV_ID_82545GM_SERDES:
- + hw->mac_type = e1000_82545_rev_3;
- + break;
- + case E1000_DEV_ID_82546EB_COPPER:
- + case E1000_DEV_ID_82546EB_FIBER:
- + case E1000_DEV_ID_82546EB_QUAD_COPPER:
- + hw->mac_type = e1000_82546;
- + break;
- + case E1000_DEV_ID_82546GB_COPPER:
- + case E1000_DEV_ID_82546GB_FIBER:
- + case E1000_DEV_ID_82546GB_SERDES:
- + hw->mac_type = e1000_82546_rev_3;
- + break;
- + case E1000_DEV_ID_82541EI:
- + case E1000_DEV_ID_82541EI_MOBILE:
- + hw->mac_type = e1000_82541;
- + break;
- + case E1000_DEV_ID_82541ER:
- + case E1000_DEV_ID_82541GI:
- + case E1000_DEV_ID_82541GI_MOBILE:
- + hw->mac_type = e1000_82541_rev_2;
- + break;
- + case E1000_DEV_ID_82547EI:
- + hw->mac_type = e1000_82547;
- + break;
- + case E1000_DEV_ID_82547GI:
- + hw->mac_type = e1000_82547_rev_2;
- + break;
- + default:
- + /* Should never have loaded on this device */
- + return -E1000_ERR_MAC_TYPE;
- + }
- +
- + return E1000_SUCCESS;
- +}
- +
- +/*****************************************************************************
- + * Set media type and TBI compatibility.
- + *
- + * hw - Struct containing variables accessed by shared code
- + * **************************************************************************/
- +static void
- +e1000_set_media_type(struct e1000_hw *hw)
- +{
- + uint32_t status;
- +
- + DEBUGFUNC("e1000_set_media_type");
- +
- + if(hw->mac_type != e1000_82543) {
- + /* tbi_compatibility is only valid on 82543 */
- + hw->tbi_compatibility_en = FALSE;
- + }
- +
- + switch (hw->device_id) {
- + case E1000_DEV_ID_82545GM_SERDES:
- + case E1000_DEV_ID_82546GB_SERDES:
- + hw->media_type = e1000_media_type_internal_serdes;
- + break;
- + default:
- + if(hw->mac_type >= e1000_82543) {
- + status = E1000_READ_REG(hw, STATUS);
- + if(status & E1000_STATUS_TBIMODE) {
- + hw->media_type = e1000_media_type_fiber;
- + /* tbi_compatibility not valid on fiber */
- + hw->tbi_compatibility_en = FALSE;
- + } else {
- + hw->media_type = e1000_media_type_copper;
- + }
- + } else {
- + /* This is an 82542 (fiber only) */
- + hw->media_type = e1000_media_type_fiber;
- + }
- + }
- +}
- +
- +/******************************************************************************
- + * Reset the transmit and receive units; mask and clear all interrupts.
- + *
- + * hw - Struct containing variables accessed by shared code
- + *****************************************************************************/
- +static void
- +e1000_reset_hw(struct e1000_hw *hw)
- +{
- + uint32_t ctrl;
- + uint32_t ctrl_ext;
- + uint32_t icr;
- + uint32_t manc;
- +
- + DEBUGFUNC("e1000_reset_hw");
- +
- + /* For 82542 (rev 2.0), disable MWI before issuing a device reset */
- + if(hw->mac_type == e1000_82542_rev2_0) {
- + DEBUGOUT("Disabling MWI on 82542 rev 2.0\n");
- + e1000_pci_clear_mwi(hw);
- + }
- +
- + /* Clear interrupt mask to stop board from generating interrupts */
- + DEBUGOUT("Masking off all interrupts\n");
- + E1000_WRITE_REG(hw, IMC, 0xffffffff);
- +
- + /* Disable the Transmit and Receive units. Then delay to allow
- + * any pending transactions to complete before we hit the MAC with
- + * the global reset.
- + */
- + E1000_WRITE_REG(hw, RCTL, 0);
- + E1000_WRITE_REG(hw, TCTL, E1000_TCTL_PSP);
- + E1000_WRITE_FLUSH(hw);
- +
- + /* The tbi_compatibility_on Flag must be cleared when Rctl is cleared. */
- + hw->tbi_compatibility_on = FALSE;
- +
- + /* Delay to allow any outstanding PCI transactions to complete before
- + * resetting the device
- + */
- + mdelay(10);
- +
- + ctrl = E1000_READ_REG(hw, CTRL);
- +
- + /* Must reset the PHY before resetting the MAC */
- + if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) {
- + E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_PHY_RST));
- + mdelay(5);
- + }
- +
- + /* Issue a global reset to the MAC. This will reset the chip's
- + * transmit, receive, DMA, and link units. It will not effect
- + * the current PCI configuration. The global reset bit is self-
- + * clearing, and should clear within a microsecond.
- + */
- + DEBUGOUT("Issuing a global reset to MAC\n");
- +
- + switch(hw->mac_type) {
- + case e1000_82544:
- + case e1000_82540:
- + case e1000_82545:
- + case e1000_82546:
- + case e1000_82541:
- + case e1000_82541_rev_2:
- + /* These controllers can't ack the 64-bit write when issuing the
- + * reset, so use IO-mapping as a workaround to issue the reset */
- + E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST));
- + break;
- + case e1000_82545_rev_3:
- + case e1000_82546_rev_3:
- + /* Reset is performed on a shadow of the control register */
- + E1000_WRITE_REG(hw, CTRL_DUP, (ctrl | E1000_CTRL_RST));
- + break;
- + default:
- + E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST));
- + break;
- + }
- +
- + /* After MAC reset, force reload of EEPROM to restore power-on settings to
- + * device. Later controllers reload the EEPROM automatically, so just wait
- + * for reload to complete.
- + */
- + switch(hw->mac_type) {
- + case e1000_82542_rev2_0:
- + case e1000_82542_rev2_1:
- + case e1000_82543:
- + case e1000_82544:
- + /* Wait for reset to complete */
- + udelay(10);
- + ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
- + ctrl_ext |= E1000_CTRL_EXT_EE_RST;
- + E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
- + E1000_WRITE_FLUSH(hw);
- + /* Wait for EEPROM reload */
- + mdelay(2);
- + break;
- + case e1000_82541:
- + case e1000_82541_rev_2:
- + case e1000_82547:
- + case e1000_82547_rev_2:
- + /* Wait for EEPROM reload */
- + mdelay(20);
- + break;
- + default:
- + /* Wait for EEPROM reload (it happens automatically) */
- + mdelay(5);
- + break;
- + }
- +
- + /* Disable HW ARPs on ASF enabled adapters */
- + if(hw->mac_type >= e1000_82540) {
- + manc = E1000_READ_REG(hw, MANC);
- + manc &= ~(E1000_MANC_ARP_EN);
- + E1000_WRITE_REG(hw, MANC, manc);
- + }
- +
- + if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) {
- + e1000_phy_init_script(hw);
- + }
- +
- + /* Clear interrupt mask to stop board from generating interrupts */
- + DEBUGOUT("Masking off all interrupts\n");
- + E1000_WRITE_REG(hw, IMC, 0xffffffff);
- +
- + /* Clear any pending interrupt events. */
- + icr = E1000_READ_REG(hw, ICR);
- +
- + /* If MWI was previously enabled, reenable it. */
- + if(hw->mac_type == e1000_82542_rev2_0) {
- +#ifdef LINUX_DRIVER
- + if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE)
- +#endif
- + e1000_pci_set_mwi(hw);
- + }
- +}
- +
- +/******************************************************************************
- + * Performs basic configuration of the adapter.
- + *
- + * hw - Struct containing variables accessed by shared code
- + *
- + * Assumes that the controller has previously been reset and is in a
- + * post-reset uninitialized state. Initializes the receive address registers,
- + * multicast table, and VLAN filter table. Calls routines to setup link
- + * configuration and flow control settings. Clears all on-chip counters. Leaves
- + * the transmit and receive units disabled and uninitialized.
- + *****************************************************************************/
- +static int
- +e1000_init_hw(struct e1000_hw *hw)
- +{
- + uint32_t ctrl, status;
- + uint32_t i;
- + int32_t ret_val;
- + uint16_t pcix_cmd_word;
- + uint16_t pcix_stat_hi_word;
- + uint16_t cmd_mmrbc;
- + uint16_t stat_mmrbc;
- + e1000_bus_type bus_type = e1000_bus_type_unknown;
- +
- + DEBUGFUNC("e1000_init_hw");
- +
- + /* Set the media type and TBI compatibility */
- + e1000_set_media_type(hw);
- +
- + /* Disabling VLAN filtering. */
- + DEBUGOUT("Initializing the IEEE VLAN\n");
- + E1000_WRITE_REG(hw, VET, 0);
- +
- + e1000_clear_vfta(hw);
- +
- + /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */
- + if(hw->mac_type == e1000_82542_rev2_0) {
- + DEBUGOUT("Disabling MWI on 82542 rev 2.0\n");
- + e1000_pci_clear_mwi(hw);
- + E1000_WRITE_REG(hw, RCTL, E1000_RCTL_RST);
- + E1000_WRITE_FLUSH(hw);
- + mdelay(5);
- + }
- +
- + /* Setup the receive address. This involves initializing all of the Receive
- + * Address Registers (RARs 0 - 15).
- + */
- + e1000_init_rx_addrs(hw);
- +
- + /* For 82542 (rev 2.0), take the receiver out of reset and enable MWI */
- + if(hw->mac_type == e1000_82542_rev2_0) {
- + E1000_WRITE_REG(hw, RCTL, 0);
- + E1000_WRITE_FLUSH(hw);
- + mdelay(1);
- +#ifdef LINUX_DRIVER
- + if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE)
- +#endif
- + e1000_pci_set_mwi(hw);
- + }
- +
- + /* Zero out the Multicast HASH table */
- + DEBUGOUT("Zeroing the MTA\n");
- + for(i = 0; i < E1000_MC_TBL_SIZE; i++)
- + E1000_WRITE_REG_ARRAY(hw, MTA, i, 0);
- +
- +#if 0
- + /* Set the PCI priority bit correctly in the CTRL register. This
- + * determines if the adapter gives priority to receives, or if it
- + * gives equal priority to transmits and receives.
- + */
- + if(hw->dma_fairness) {
- + ctrl = E1000_READ_REG(hw, CTRL);
- + E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PRIOR);
- + }
- +#endif
- +
- + switch(hw->mac_type) {
- + case e1000_82545_rev_3:
- + case e1000_82546_rev_3:
- + break;
- + default:
- + if (hw->mac_type >= e1000_82543) {
- + /* See e1000_get_bus_info() of the Linux driver */
- + status = E1000_READ_REG(hw, STATUS);
- + bus_type = (status & E1000_STATUS_PCIX_MODE) ?
- + e1000_bus_type_pcix : e1000_bus_type_pci;
- + }
- +
- + /* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */
- + if(bus_type == e1000_bus_type_pcix) {
- + pci_read_config_word(hw->pdev, PCIX_COMMAND_REGISTER, &pcix_cmd_word);
- + pci_read_config_word(hw->pdev, PCIX_STATUS_REGISTER_HI, &pcix_stat_hi_word);
- + cmd_mmrbc = (pcix_cmd_word & PCIX_COMMAND_MMRBC_MASK) >>
- + PCIX_COMMAND_MMRBC_SHIFT;
- + stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >>
- + PCIX_STATUS_HI_MMRBC_SHIFT;
- + if(stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K)
- + stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K;
- + if(cmd_mmrbc > stat_mmrbc) {
- + pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK;
- + pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT;
- + pci_write_config_word(hw->pdev, PCIX_COMMAND_REGISTER, pcix_cmd_word);
- + }
- + }
- + break;
- + }
- +
- + /* Call a subroutine to configure the link and setup flow control. */
- + ret_val = e1000_setup_link(hw);
- +
- + /* Set the transmit descriptor write-back policy */
- + if(hw->mac_type > e1000_82544) {
- + ctrl = E1000_READ_REG(hw, TXDCTL);
- + ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB;
- + E1000_WRITE_REG(hw, TXDCTL, ctrl);
- + }
- +
- +#if 0
- + /* Clear all of the statistics registers (clear on read). It is
- + * important that we do this after we have tried to establish link
- + * because the symbol error count will increment wildly if there
- + * is no link.
- + */
- + e1000_clear_hw_cntrs(hw);
- +#endif
- +
- + return ret_val;
- +}
- +
- +/******************************************************************************
- + * Adjust SERDES output amplitude based on EEPROM setting.
- + *
- + * hw - Struct containing variables accessed by shared code.
- + *****************************************************************************/
- +static int32_t
- +e1000_adjust_serdes_amplitude(struct e1000_hw *hw)
- +{
- + uint16_t eeprom_data;
- + int32_t ret_val;
- +
- + DEBUGFUNC("e1000_adjust_serdes_amplitude");
- +
- + if(hw->media_type != e1000_media_type_internal_serdes)
- + return E1000_SUCCESS;
- +
- + switch(hw->mac_type) {
- + case e1000_82545_rev_3:
- + case e1000_82546_rev_3:
- + break;
- + default:
- + return E1000_SUCCESS;
- + }
- +
- + if ((ret_val = e1000_read_eeprom(hw, EEPROM_SERDES_AMPLITUDE, 1,
- + &eeprom_data))) {
- + return ret_val;
- + }
- +
- + if(eeprom_data != EEPROM_RESERVED_WORD) {
- + /* Adjust SERDES output amplitude only. */
- + eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK;
- + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL,
- + eeprom_data)))
- + return ret_val;
- + }
- +
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- + * Configures flow control and link settings.
- + *
- + * hw - Struct containing variables accessed by shared code
- + *
- + * Determines which flow control settings to use. Calls the apropriate media-
- + * specific link configuration function. Configures the flow control settings.
- + * Assuming the adapter has a valid link partner, a valid link should be
- + * established. Assumes the hardware has previously been reset and the
- + * transmitter and receiver are not enabled.
- + *****************************************************************************/
- +static int
- +e1000_setup_link(struct e1000_hw *hw)
- +{
- + uint32_t ctrl_ext;
- + int32_t ret_val;
- + uint16_t eeprom_data;
- +
- + DEBUGFUNC("e1000_setup_link");
- +
- + /* Read and store word 0x0F of the EEPROM. This word contains bits
- + * that determine the hardware's default PAUSE (flow control) mode,
- + * a bit that determines whether the HW defaults to enabling or
- + * disabling auto-negotiation, and the direction of the
- + * SW defined pins. If there is no SW over-ride of the flow
- + * control setting, then the variable hw->fc will
- + * be initialized based on a value in the EEPROM.
- + */
- + if(e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data) < 0) {
- + DEBUGOUT("EEPROM Read Error\n");
- + return -E1000_ERR_EEPROM;
- + }
- +
- + if(hw->fc == e1000_fc_default) {
- + if((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == 0)
- + hw->fc = e1000_fc_none;
- + else if((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) ==
- + EEPROM_WORD0F_ASM_DIR)
- + hw->fc = e1000_fc_tx_pause;
- + else
- + hw->fc = e1000_fc_full;
- + }
- +
- + /* We want to save off the original Flow Control configuration just
- + * in case we get disconnected and then reconnected into a different
- + * hub or switch with different Flow Control capabilities.
- + */
- + if(hw->mac_type == e1000_82542_rev2_0)
- + hw->fc &= (~e1000_fc_tx_pause);
- +
- +#if 0
- + /* See e1000_sw_init() of the Linux driver */
- + if((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1))
- +#else
- + if((hw->mac_type < e1000_82543) && (hw->mac_type >= e1000_82543))
- +#endif
- + hw->fc &= (~e1000_fc_rx_pause);
- +
- +#if 0
- + hw->original_fc = hw->fc;
- +#endif
- +
- + DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc);
- +
- + /* Take the 4 bits from EEPROM word 0x0F that determine the initial
- + * polarity value for the SW controlled pins, and setup the
- + * Extended Device Control reg with that info.
- + * This is needed because one of the SW controlled pins is used for
- + * signal detection. So this should be done before e1000_setup_pcs_link()
- + * or e1000_phy_setup() is called.
- + */
- + if(hw->mac_type == e1000_82543) {
- + ctrl_ext = ((eeprom_data & EEPROM_WORD0F_SWPDIO_EXT) <<
- + SWDPIO__EXT_SHIFT);
- + E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
- + }
- +
- + /* Call the necessary subroutine to configure the link. */
- + ret_val = (hw->media_type == e1000_media_type_copper) ?
- + e1000_setup_copper_link(hw) :
- + e1000_setup_fiber_serdes_link(hw);
- + if (ret_val < 0) {
- + return ret_val;
- + }
- +
- + /* Initialize the flow control address, type, and PAUSE timer
- + * registers to their default values. This is done even if flow
- + * control is disabled, because it does not hurt anything to
- + * initialize these registers.
- + */
- + DEBUGOUT("Initializing the Flow Control address, type and timer regs\n");
- +
- + E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW);
- + E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH);
- + E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE);
- +#if 0
- + E1000_WRITE_REG(hw, FCTTV, hw->fc_pause_time);
- +#else
- + E1000_WRITE_REG(hw, FCTTV, FC_DEFAULT_TX_TIMER);
- +#endif
- +
- + /* Set the flow control receive threshold registers. Normally,
- + * these registers will be set to a default threshold that may be
- + * adjusted later by the driver's runtime code. However, if the
- + * ability to transmit pause frames in not enabled, then these
- + * registers will be set to 0.
- + */
- + if(!(hw->fc & e1000_fc_tx_pause)) {
- + E1000_WRITE_REG(hw, FCRTL, 0);
- + E1000_WRITE_REG(hw, FCRTH, 0);
- + } else {
- + /* We need to set up the Receive Threshold high and low water marks
- + * as well as (optionally) enabling the transmission of XON frames.
- + */
- +#if 0
- + if(hw->fc_send_xon) {
- + E1000_WRITE_REG(hw, FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE));
- + E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water);
- + } else {
- + E1000_WRITE_REG(hw, FCRTL, hw->fc_low_water);
- + E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water);
- + }
- +#else
- + E1000_WRITE_REG(hw, FCRTL, (FC_DEFAULT_LO_THRESH | E1000_FCRTL_XONE));
- + E1000_WRITE_REG(hw, FCRTH, FC_DEFAULT_HI_THRESH);
- +#endif
- + }
- + return ret_val;
- +}
- +
- +/******************************************************************************
- + * Sets up link for a fiber based or serdes based adapter
- + *
- + * hw - Struct containing variables accessed by shared code
- + *
- + * Manipulates Physical Coding Sublayer functions in order to configure
- + * link. Assumes the hardware has been previously reset and the transmitter
- + * and receiver are not enabled.
- + *****************************************************************************/
- +static int
- +e1000_setup_fiber_serdes_link(struct e1000_hw *hw)
- +{
- + uint32_t ctrl;
- + uint32_t status;
- + uint32_t txcw = 0;
- + uint32_t i;
- + uint32_t signal = 0;
- + int32_t ret_val;
- +
- + DEBUGFUNC("e1000_setup_fiber_serdes_link");
- +
- + /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be
- + * set when the optics detect a signal. On older adapters, it will be
- + * cleared when there is a signal. This applies to fiber media only.
- + * If we're on serdes media, adjust the output amplitude to value set in
- + * the EEPROM.
- + */
- + ctrl = E1000_READ_REG(hw, CTRL);
- + if(hw->media_type == e1000_media_type_fiber)
- + signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0;
- +
- + if((ret_val = e1000_adjust_serdes_amplitude(hw)))
- + return ret_val;
- +
- + /* Take the link out of reset */
- + ctrl &= ~(E1000_CTRL_LRST);
- +
- +#if 0
- + /* Adjust VCO speed to improve BER performance */
- + if((ret_val = e1000_set_vco_speed(hw)))
- + return ret_val;
- +#endif
- +
- + e1000_config_collision_dist(hw);
- +
- + /* Check for a software override of the flow control settings, and setup
- + * the device accordingly. If auto-negotiation is enabled, then software
- + * will have to set the "PAUSE" bits to the correct value in the Tranmsit
- + * Config Word Register (TXCW) and re-start auto-negotiation. However, if
- + * auto-negotiation is disabled, then software will have to manually
- + * configure the two flow control enable bits in the CTRL register.
- + *
- + * The possible values of the "fc" parameter are:
- + * 0: Flow control is completely disabled
- + * 1: Rx flow control is enabled (we can receive pause frames, but
- + * not send pause frames).
- + * 2: Tx flow control is enabled (we can send pause frames but we do
- + * not support receiving pause frames).
- + * 3: Both Rx and TX flow control (symmetric) are enabled.
- + */
- + switch (hw->fc) {
- + case e1000_fc_none:
- + /* Flow control is completely disabled by a software over-ride. */
- + txcw = (E1000_TXCW_ANE | E1000_TXCW_FD);
- + break;
- + case e1000_fc_rx_pause:
- + /* RX Flow control is enabled and TX Flow control is disabled by a
- + * software over-ride. Since there really isn't a way to advertise
- + * that we are capable of RX Pause ONLY, we will advertise that we
- + * support both symmetric and asymmetric RX PAUSE. Later, we will
- + * disable the adapter's ability to send PAUSE frames.
- + */
- + txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK);
- + break;
- + case e1000_fc_tx_pause:
- + /* TX Flow control is enabled, and RX Flow control is disabled, by a
- + * software over-ride.
- + */
- + txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_ASM_DIR);
- + break;
- + case e1000_fc_full:
- + /* Flow control (both RX and TX) is enabled by a software over-ride. */
- + txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK);
- + break;
- + default:
- + DEBUGOUT("Flow control param set incorrectly\n");
- + return -E1000_ERR_CONFIG;
- + break;
- + }
- +
- + /* Since auto-negotiation is enabled, take the link out of reset (the link
- + * will be in reset, because we previously reset the chip). This will
- + * restart auto-negotiation. If auto-neogtiation is successful then the
- + * link-up status bit will be set and the flow control enable bits (RFCE
- + * and TFCE) will be set according to their negotiated value.
- + */
- + DEBUGOUT("Auto-negotiation enabled\n");
- +
- + E1000_WRITE_REG(hw, TXCW, txcw);
- + E1000_WRITE_REG(hw, CTRL, ctrl);
- + E1000_WRITE_FLUSH(hw);
- +
- + hw->txcw = txcw;
- + mdelay(1);
- +
- + /* If we have a signal (the cable is plugged in) then poll for a "Link-Up"
- + * indication in the Device Status Register. Time-out if a link isn't
- + * seen in 500 milliseconds seconds (Auto-negotiation should complete in
- + * less than 500 milliseconds even if the other end is doing it in SW).
- + * For internal serdes, we just assume a signal is present, then poll.
- + */
- + if(hw->media_type == e1000_media_type_internal_serdes ||
- + (E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) {
- + DEBUGOUT("Looking for Link\n");
- + for(i = 0; i < (LINK_UP_TIMEOUT / 10); i++) {
- + mdelay(10);
- + status = E1000_READ_REG(hw, STATUS);
- + if(status & E1000_STATUS_LU) break;
- + }
- + if(i == (LINK_UP_TIMEOUT / 10)) {
- + DEBUGOUT("Never got a valid link from auto-neg!!!\n");
- + hw->autoneg_failed = 1;
- + /* AutoNeg failed to achieve a link, so we'll call
- + * e1000_check_for_link. This routine will force the link up if
- + * we detect a signal. This will allow us to communicate with
- + * non-autonegotiating link partners.
- + */
- + if((ret_val = e1000_check_for_link(hw))) {
- + DEBUGOUT("Error while checking for link\n");
- + return ret_val;
- + }
- + hw->autoneg_failed = 0;
- + } else {
- + hw->autoneg_failed = 0;
- + DEBUGOUT("Valid Link Found\n");
- + }
- + } else {
- + DEBUGOUT("No Signal Detected\n");
- + }
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- +* Detects which PHY is present and the speed and duplex
- +*
- +* hw - Struct containing variables accessed by shared code
- +******************************************************************************/
- +static int
- +e1000_setup_copper_link(struct e1000_hw *hw)
- +{
- + uint32_t ctrl;
- + int32_t ret_val;
- + uint16_t i;
- + uint16_t phy_data;
- +
- + DEBUGFUNC("e1000_setup_copper_link");
- +
- + ctrl = E1000_READ_REG(hw, CTRL);
- + /* With 82543, we need to force speed and duplex on the MAC equal to what
- + * the PHY speed and duplex configuration is. In addition, we need to
- + * perform a hardware reset on the PHY to take it out of reset.
- + */
- + if(hw->mac_type > e1000_82543) {
- + ctrl |= E1000_CTRL_SLU;
- + ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
- + E1000_WRITE_REG(hw, CTRL, ctrl);
- + } else {
- + ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX | E1000_CTRL_SLU);
- + E1000_WRITE_REG(hw, CTRL, ctrl);
- + e1000_phy_hw_reset(hw);
- + }
- +
- + /* Make sure we have a valid PHY */
- + if((ret_val = e1000_detect_gig_phy(hw))) {
- + DEBUGOUT("Error, did not detect valid phy.\n");
- + return ret_val;
- + }
- + DEBUGOUT1("Phy ID = %x \n", hw->phy_id);
- +
- + if(hw->mac_type <= e1000_82543 ||
- + hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 ||
- +#if 0
- + hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2)
- + hw->phy_reset_disable = FALSE;
- +
- + if(!hw->phy_reset_disable) {
- +#else
- + hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) {
- +#endif
- + if (hw->phy_type == e1000_phy_igp) {
- +
- + if((ret_val = e1000_phy_reset(hw))) {
- + DEBUGOUT("Error Resetting the PHY\n");
- + return ret_val;
- + }
- +
- + /* Wait 10ms for MAC to configure PHY from eeprom settings */
- + mdelay(15);
- +
- +#if 0
- + /* disable lplu d3 during driver init */
- + if((ret_val = e1000_set_d3_lplu_state(hw, FALSE))) {
- + DEBUGOUT("Error Disabling LPLU D3\n");
- + return ret_val;
- + }
- +
- + /* Configure mdi-mdix settings */
- + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL,
- + &phy_data)))
- + return ret_val;
- +
- + if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) {
- + hw->dsp_config_state = e1000_dsp_config_disabled;
- + /* Force MDI for IGP B-0 PHY */
- + phy_data &= ~(IGP01E1000_PSCR_AUTO_MDIX |
- + IGP01E1000_PSCR_FORCE_MDI_MDIX);
- + hw->mdix = 1;
- +
- + } else {
- + hw->dsp_config_state = e1000_dsp_config_enabled;
- + phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX;
- +
- + switch (hw->mdix) {
- + case 1:
- + phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX;
- + break;
- + case 2:
- + phy_data |= IGP01E1000_PSCR_FORCE_MDI_MDIX;
- + break;
- + case 0:
- + default:
- + phy_data |= IGP01E1000_PSCR_AUTO_MDIX;
- + break;
- + }
- + }
- + if((ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL,
- + phy_data)))
- + return ret_val;
- +
- + /* set auto-master slave resolution settings */
- + e1000_ms_type phy_ms_setting = hw->master_slave;
- +
- + if(hw->ffe_config_state == e1000_ffe_config_active)
- + hw->ffe_config_state = e1000_ffe_config_enabled;
- +
- + if(hw->dsp_config_state == e1000_dsp_config_activated)
- + hw->dsp_config_state = e1000_dsp_config_enabled;
- +#endif
- +
- + /* when autonegotiation advertisment is only 1000Mbps then we
- + * should disable SmartSpeed and enable Auto MasterSlave
- + * resolution as hardware default. */
- + if(hw->autoneg_advertised == ADVERTISE_1000_FULL) {
- + /* Disable SmartSpeed */
- + if((ret_val = e1000_read_phy_reg(hw,
- + IGP01E1000_PHY_PORT_CONFIG,
- + &phy_data)))
- + return ret_val;
- + phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED;
- + if((ret_val = e1000_write_phy_reg(hw,
- + IGP01E1000_PHY_PORT_CONFIG,
- + phy_data)))
- + return ret_val;
- + /* Set auto Master/Slave resolution process */
- + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL,
- + &phy_data)))
- + return ret_val;
- + phy_data &= ~CR_1000T_MS_ENABLE;
- + if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL,
- + phy_data)))
- + return ret_val;
- + }
- +
- + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL,
- + &phy_data)))
- + return ret_val;
- +
- +#if 0
- + /* load defaults for future use */
- + hw->original_master_slave = (phy_data & CR_1000T_MS_ENABLE) ?
- + ((phy_data & CR_1000T_MS_VALUE) ?
- + e1000_ms_force_master :
- + e1000_ms_force_slave) :
- + e1000_ms_auto;
- +
- + switch (phy_ms_setting) {
- + case e1000_ms_force_master:
- + phy_data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE);
- + break;
- + case e1000_ms_force_slave:
- + phy_data |= CR_1000T_MS_ENABLE;
- + phy_data &= ~(CR_1000T_MS_VALUE);
- + break;
- + case e1000_ms_auto:
- + phy_data &= ~CR_1000T_MS_ENABLE;
- + default:
- + break;
- + }
- +#endif
- +
- + if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL,
- + phy_data)))
- + return ret_val;
- + } else {
- + /* Enable CRS on TX. This must be set for half-duplex operation. */
- + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
- + &phy_data)))
- + return ret_val;
- +
- + phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX;
- +
- + /* Options:
- + * MDI/MDI-X = 0 (default)
- + * 0 - Auto for all speeds
- + * 1 - MDI mode
- + * 2 - MDI-X mode
- + * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes)
- + */
- +#if 0
- + phy_data &= ~M88E1000_PSCR_AUTO_X_MODE;
- +
- + switch (hw->mdix) {
- + case 1:
- + phy_data |= M88E1000_PSCR_MDI_MANUAL_MODE;
- + break;
- + case 2:
- + phy_data |= M88E1000_PSCR_MDIX_MANUAL_MODE;
- + break;
- + case 3:
- + phy_data |= M88E1000_PSCR_AUTO_X_1000T;
- + break;
- + case 0:
- + default:
- +#endif
- + phy_data |= M88E1000_PSCR_AUTO_X_MODE;
- +#if 0
- + break;
- + }
- +#endif
- +
- + /* Options:
- + * disable_polarity_correction = 0 (default)
- + * Automatic Correction for Reversed Cable Polarity
- + * 0 - Disabled
- + * 1 - Enabled
- + */
- + phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL;
- + if((ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
- + phy_data)))
- + return ret_val;
- +
- + /* Force TX_CLK in the Extended PHY Specific Control Register
- + * to 25MHz clock.
- + */
- + if((ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL,
- + &phy_data)))
- + return ret_val;
- +
- + phy_data |= M88E1000_EPSCR_TX_CLK_25;
- +
- +#ifdef LINUX_DRIVER
- + if (hw->phy_revision < M88E1011_I_REV_4) {
- +#endif
- + /* Configure Master and Slave downshift values */
- + phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK |
- + M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK);
- + phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X |
- + M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X);
- + if((ret_val = e1000_write_phy_reg(hw,
- + M88E1000_EXT_PHY_SPEC_CTRL,
- + phy_data)))
- + return ret_val;
- + }
- +
- + /* SW Reset the PHY so all changes take effect */
- + if((ret_val = e1000_phy_reset(hw))) {
- + DEBUGOUT("Error Resetting the PHY\n");
- + return ret_val;
- +#ifdef LINUX_DRIVER
- + }
- +#endif
- + }
- +
- + /* Options:
- + * autoneg = 1 (default)
- + * PHY will advertise value(s) parsed from
- + * autoneg_advertised and fc
- + * autoneg = 0
- + * PHY will be set to 10H, 10F, 100H, or 100F
- + * depending on value parsed from forced_speed_duplex.
- + */
- +
- + /* Is autoneg enabled? This is enabled by default or by software
- + * override. If so, call e1000_phy_setup_autoneg routine to parse the
- + * autoneg_advertised and fc options. If autoneg is NOT enabled, then
- + * the user should have provided a speed/duplex override. If so, then
- + * call e1000_phy_force_speed_duplex to parse and set this up.
- + */
- + /* Perform some bounds checking on the hw->autoneg_advertised
- + * parameter. If this variable is zero, then set it to the default.
- + */
- + hw->autoneg_advertised &= AUTONEG_ADVERTISE_SPEED_DEFAULT;
- +
- + /* If autoneg_advertised is zero, we assume it was not defaulted
- + * by the calling code so we set to advertise full capability.
- + */
- + if(hw->autoneg_advertised == 0)
- + hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT;
- +
- + DEBUGOUT("Reconfiguring auto-neg advertisement params\n");
- + if((ret_val = e1000_phy_setup_autoneg(hw))) {
- + DEBUGOUT("Error Setting up Auto-Negotiation\n");
- + return ret_val;
- + }
- + DEBUGOUT("Restarting Auto-Neg\n");
- +
- + /* Restart auto-negotiation by setting the Auto Neg Enable bit and
- + * the Auto Neg Restart bit in the PHY control register.
- + */
- + if((ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data)))
- + return ret_val;
- +
- + phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG);
- + if((ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data)))
- + return ret_val;
- +
- +#if 0
- + /* Does the user want to wait for Auto-Neg to complete here, or
- + * check at a later time (for example, callback routine).
- + */
- + if(hw->wait_autoneg_complete) {
- + if((ret_val = e1000_wait_autoneg(hw))) {
- + DEBUGOUT("Error while waiting for autoneg to complete\n");
- + return ret_val;
- + }
- + }
- +#else
- + /* If we do not wait for autonegotiation to complete I
- + * do not see a valid link status.
- + */
- + if((ret_val = e1000_wait_autoneg(hw))) {
- + DEBUGOUT("Error while waiting for autoneg to complete\n");
- + return ret_val;
- + }
- +#endif
- + } /* !hw->phy_reset_disable */
- +
- + /* Check link status. Wait up to 100 microseconds for link to become
- + * valid.
- + */
- + for(i = 0; i < 10; i++) {
- + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data)))
- + return ret_val;
- + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data)))
- + return ret_val;
- +
- + if(phy_data & MII_SR_LINK_STATUS) {
- + /* We have link, so we need to finish the config process:
- + * 1) Set up the MAC to the current PHY speed/duplex
- + * if we are on 82543. If we
- + * are on newer silicon, we only need to configure
- + * collision distance in the Transmit Control Register.
- + * 2) Set up flow control on the MAC to that established with
- + * the link partner.
- + */
- + if(hw->mac_type >= e1000_82544) {
- + e1000_config_collision_dist(hw);
- + } else {
- + if((ret_val = e1000_config_mac_to_phy(hw))) {
- + DEBUGOUT("Error configuring MAC to PHY settings\n");
- + return ret_val;
- + }
- + }
- + if((ret_val = e1000_config_fc_after_link_up(hw))) {
- + DEBUGOUT("Error Configuring Flow Control\n");
- + return ret_val;
- + }
- +#if 0
- + if(hw->phy_type == e1000_phy_igp) {
- + if((ret_val = e1000_config_dsp_after_link_change(hw, TRUE))) {
- + DEBUGOUT("Error Configuring DSP after link up\n");
- + return ret_val;
- + }
- + }
- +#endif
- + DEBUGOUT("Valid link established!!!\n");
- + return E1000_SUCCESS;
- + }
- + udelay(10);
- + }
- +
- + DEBUGOUT("Unable to establish link!!!\n");
- + return -E1000_ERR_NOLINK;
- +}
- +
- +/******************************************************************************
- +* Configures PHY autoneg and flow control advertisement settings
- +*
- +* hw - Struct containing variables accessed by shared code
- +******************************************************************************/
- +static int
- +e1000_phy_setup_autoneg(struct e1000_hw *hw)
- +{
- + int32_t ret_val;
- + uint16_t mii_autoneg_adv_reg;
- + uint16_t mii_1000t_ctrl_reg;
- +
- + DEBUGFUNC("e1000_phy_setup_autoneg");
- +
- + /* Read the MII Auto-Neg Advertisement Register (Address 4). */
- + if((ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV,
- + &mii_autoneg_adv_reg)))
- + return ret_val;
- +
- + /* Read the MII 1000Base-T Control Register (Address 9). */
- + if((ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg)))
- + return ret_val;
- +
- + /* Need to parse both autoneg_advertised and fc and set up
- + * the appropriate PHY registers. First we will parse for
- + * autoneg_advertised software override. Since we can advertise
- + * a plethora of combinations, we need to check each bit
- + * individually.
- + */
- +
- + /* First we clear all the 10/100 mb speed bits in the Auto-Neg
- + * Advertisement Register (Address 4) and the 1000 mb speed bits in
- + * the 1000Base-T Control Register (Address 9).
- + */
- + mii_autoneg_adv_reg &= ~REG4_SPEED_MASK;
- + mii_1000t_ctrl_reg &= ~REG9_SPEED_MASK;
- +
- + DEBUGOUT1("autoneg_advertised %x\n", hw->autoneg_advertised);
- +
- + /* Do we want to advertise 10 Mb Half Duplex? */
- + if(hw->autoneg_advertised & ADVERTISE_10_HALF) {
- + DEBUGOUT("Advertise 10mb Half duplex\n");
- + mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS;
- + }
- +
- + /* Do we want to advertise 10 Mb Full Duplex? */
- + if(hw->autoneg_advertised & ADVERTISE_10_FULL) {
- + DEBUGOUT("Advertise 10mb Full duplex\n");
- + mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS;
- + }
- +
- + /* Do we want to advertise 100 Mb Half Duplex? */
- + if(hw->autoneg_advertised & ADVERTISE_100_HALF) {
- + DEBUGOUT("Advertise 100mb Half duplex\n");
- + mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS;
- + }
- +
- + /* Do we want to advertise 100 Mb Full Duplex? */
- + if(hw->autoneg_advertised & ADVERTISE_100_FULL) {
- + DEBUGOUT("Advertise 100mb Full duplex\n");
- + mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS;
- + }
- +
- + /* We do not allow the Phy to advertise 1000 Mb Half Duplex */
- + if(hw->autoneg_advertised & ADVERTISE_1000_HALF) {
- + DEBUGOUT("Advertise 1000mb Half duplex requested, request denied!\n");
- + }
- +
- + /* Do we want to advertise 1000 Mb Full Duplex? */
- + if(hw->autoneg_advertised & ADVERTISE_1000_FULL) {
- + DEBUGOUT("Advertise 1000mb Full duplex\n");
- + mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS;
- + }
- +
- + /* Check for a software override of the flow control settings, and
- + * setup the PHY advertisement registers accordingly. If
- + * auto-negotiation is enabled, then software will have to set the
- + * "PAUSE" bits to the correct value in the Auto-Negotiation
- + * Advertisement Register (PHY_AUTONEG_ADV) and re-start auto-negotiation.
- + *
- + * The possible values of the "fc" parameter are:
- + * 0: Flow control is completely disabled
- + * 1: Rx flow control is enabled (we can receive pause frames
- + * but not send pause frames).
- + * 2: Tx flow control is enabled (we can send pause frames
- + * but we do not support receiving pause frames).
- + * 3: Both Rx and TX flow control (symmetric) are enabled.
- + * other: No software override. The flow control configuration
- + * in the EEPROM is used.
- + */
- + switch (hw->fc) {
- + case e1000_fc_none: /* 0 */
- + /* Flow control (RX & TX) is completely disabled by a
- + * software over-ride.
- + */
- + mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
- + break;
- + case e1000_fc_rx_pause: /* 1 */
- + /* RX Flow control is enabled, and TX Flow control is
- + * disabled, by a software over-ride.
- + */
- + /* Since there really isn't a way to advertise that we are
- + * capable of RX Pause ONLY, we will advertise that we
- + * support both symmetric and asymmetric RX PAUSE. Later
- + * (in e1000_config_fc_after_link_up) we will disable the
- + *hw's ability to send PAUSE frames.
- + */
- + mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
- + break;
- + case e1000_fc_tx_pause: /* 2 */
- + /* TX Flow control is enabled, and RX Flow control is
- + * disabled, by a software over-ride.
- + */
- + mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR;
- + mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE;
- + break;
- + case e1000_fc_full: /* 3 */
- + /* Flow control (both RX and TX) is enabled by a software
- + * over-ride.
- + */
- + mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
- + break;
- + default:
- + DEBUGOUT("Flow control param set incorrectly\n");
- + return -E1000_ERR_CONFIG;
- + }
- +
- + if((ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV,
- + mii_autoneg_adv_reg)))
- + return ret_val;
- +
- + DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
- +
- + if((ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg)))
- + return ret_val;
- +
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- +* Sets the collision distance in the Transmit Control register
- +*
- +* hw - Struct containing variables accessed by shared code
- +*
- +* Link should have been established previously. Reads the speed and duplex
- +* information from the Device Status register.
- +******************************************************************************/
- +static void
- +e1000_config_collision_dist(struct e1000_hw *hw)
- +{
- + uint32_t tctl;
- +
- + tctl = E1000_READ_REG(hw, TCTL);
- +
- + tctl &= ~E1000_TCTL_COLD;
- + tctl |= E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT;
- +
- + E1000_WRITE_REG(hw, TCTL, tctl);
- + E1000_WRITE_FLUSH(hw);
- +}
- +
- +/******************************************************************************
- +* Sets MAC speed and duplex settings to reflect the those in the PHY
- +*
- +* hw - Struct containing variables accessed by shared code
- +* mii_reg - data to write to the MII control register
- +*
- +* The contents of the PHY register containing the needed information need to
- +* be passed in.
- +******************************************************************************/
- +static int
- +e1000_config_mac_to_phy(struct e1000_hw *hw)
- +{
- + uint32_t ctrl;
- + int32_t ret_val;
- + uint16_t phy_data;
- +
- + DEBUGFUNC("e1000_config_mac_to_phy");
- +
- + /* Read the Device Control Register and set the bits to Force Speed
- + * and Duplex.
- + */
- + ctrl = E1000_READ_REG(hw, CTRL);
- + ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
- + ctrl &= ~(E1000_CTRL_SPD_SEL | E1000_CTRL_ILOS);
- +
- + /* Set up duplex in the Device Control and Transmit Control
- + * registers depending on negotiated values.
- + */
- + if (hw->phy_type == e1000_phy_igp) {
- + if((ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS,
- + &phy_data)))
- + return ret_val;
- +
- + if(phy_data & IGP01E1000_PSSR_FULL_DUPLEX) ctrl |= E1000_CTRL_FD;
- + else ctrl &= ~E1000_CTRL_FD;
- +
- + e1000_config_collision_dist(hw);
- +
- + /* Set up speed in the Device Control register depending on
- + * negotiated values.
- + */
- + if((phy_data & IGP01E1000_PSSR_SPEED_MASK) ==
- + IGP01E1000_PSSR_SPEED_1000MBPS)
- + ctrl |= E1000_CTRL_SPD_1000;
- + else if((phy_data & IGP01E1000_PSSR_SPEED_MASK) ==
- + IGP01E1000_PSSR_SPEED_100MBPS)
- + ctrl |= E1000_CTRL_SPD_100;
- + } else {
- + if((ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS,
- + &phy_data)))
- + return ret_val;
- +
- + if(phy_data & M88E1000_PSSR_DPLX) ctrl |= E1000_CTRL_FD;
- + else ctrl &= ~E1000_CTRL_FD;
- +
- + e1000_config_collision_dist(hw);
- +
- + /* Set up speed in the Device Control register depending on
- + * negotiated values.
- + */
- + if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS)
- + ctrl |= E1000_CTRL_SPD_1000;
- + else if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_100MBS)
- + ctrl |= E1000_CTRL_SPD_100;
- + }
- + /* Write the configured values back to the Device Control Reg. */
- + E1000_WRITE_REG(hw, CTRL, ctrl);
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- + * Forces the MAC's flow control settings.
- + *
- + * hw - Struct containing variables accessed by shared code
- + *
- + * Sets the TFCE and RFCE bits in the device control register to reflect
- + * the adapter settings. TFCE and RFCE need to be explicitly set by
- + * software when a Copper PHY is used because autonegotiation is managed
- + * by the PHY rather than the MAC. Software must also configure these
- + * bits when link is forced on a fiber connection.
- + *****************************************************************************/
- +static int
- +e1000_force_mac_fc(struct e1000_hw *hw)
- +{
- + uint32_t ctrl;
- +
- + DEBUGFUNC("e1000_force_mac_fc");
- +
- + /* Get the current configuration of the Device Control Register */
- + ctrl = E1000_READ_REG(hw, CTRL);
- +
- + /* Because we didn't get link via the internal auto-negotiation
- + * mechanism (we either forced link or we got link via PHY
- + * auto-neg), we have to manually enable/disable transmit an
- + * receive flow control.
- + *
- + * The "Case" statement below enables/disable flow control
- + * according to the "hw->fc" parameter.
- + *
- + * The possible values of the "fc" parameter are:
- + * 0: Flow control is completely disabled
- + * 1: Rx flow control is enabled (we can receive pause
- + * frames but not send pause frames).
- + * 2: Tx flow control is enabled (we can send pause frames
- + * frames but we do not receive pause frames).
- + * 3: Both Rx and TX flow control (symmetric) is enabled.
- + * other: No other values should be possible at this point.
- + */
- +
- + switch (hw->fc) {
- + case e1000_fc_none:
- + ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE));
- + break;
- + case e1000_fc_rx_pause:
- + ctrl &= (~E1000_CTRL_TFCE);
- + ctrl |= E1000_CTRL_RFCE;
- + break;
- + case e1000_fc_tx_pause:
- + ctrl &= (~E1000_CTRL_RFCE);
- + ctrl |= E1000_CTRL_TFCE;
- + break;
- + case e1000_fc_full:
- + ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE);
- + break;
- + default:
- + DEBUGOUT("Flow control param set incorrectly\n");
- + return -E1000_ERR_CONFIG;
- + }
- +
- + /* Disable TX Flow Control for 82542 (rev 2.0) */
- + if(hw->mac_type == e1000_82542_rev2_0)
- + ctrl &= (~E1000_CTRL_TFCE);
- +
- + E1000_WRITE_REG(hw, CTRL, ctrl);
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- + * Configures flow control settings after link is established
- + *
- + * hw - Struct containing variables accessed by shared code
- + *
- + * Should be called immediately after a valid link has been established.
- + * Forces MAC flow control settings if link was forced. When in MII/GMII mode
- + * and autonegotiation is enabled, the MAC flow control settings will be set
- + * based on the flow control negotiated by the PHY. In TBI mode, the TFCE
- + * and RFCE bits will be automaticaly set to the negotiated flow control mode.
- + *****************************************************************************/
- +static int
- +e1000_config_fc_after_link_up(struct e1000_hw *hw)
- +{
- + int32_t ret_val;
- + uint16_t mii_status_reg;
- + uint16_t mii_nway_adv_reg;
- + uint16_t mii_nway_lp_ability_reg;
- + uint16_t speed;
- + uint16_t duplex;
- +
- + DEBUGFUNC("e1000_config_fc_after_link_up");
- +
- + /* Check for the case where we have fiber media and auto-neg failed
- + * so we had to force link. In this case, we need to force the
- + * configuration of the MAC to match the "fc" parameter.
- + */
- + if(((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) ||
- + ((hw->media_type == e1000_media_type_internal_serdes) && (hw->autoneg_failed))) {
- + if((ret_val = e1000_force_mac_fc(hw))) {
- + DEBUGOUT("Error forcing flow control settings\n");
- + return ret_val;
- + }
- + }
- +
- + /* Check for the case where we have copper media and auto-neg is
- + * enabled. In this case, we need to check and see if Auto-Neg
- + * has completed, and if so, how the PHY and link partner has
- + * flow control configured.
- + */
- + if(hw->media_type == e1000_media_type_copper) {
- + /* Read the MII Status Register and check to see if AutoNeg
- + * has completed. We read this twice because this reg has
- + * some "sticky" (latched) bits.
- + */
- + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg)))
- + return ret_val;
- + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg)))
- + return ret_val;
- +
- + if(mii_status_reg & MII_SR_AUTONEG_COMPLETE) {
- + /* The AutoNeg process has completed, so we now need to
- + * read both the Auto Negotiation Advertisement Register
- + * (Address 4) and the Auto_Negotiation Base Page Ability
- + * Register (Address 5) to determine how flow control was
- + * negotiated.
- + */
- + if((ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV,
- + &mii_nway_adv_reg)))
- + return ret_val;
- + if((ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY,
- + &mii_nway_lp_ability_reg)))
- + return ret_val;
- +
- + /* Two bits in the Auto Negotiation Advertisement Register
- + * (Address 4) and two bits in the Auto Negotiation Base
- + * Page Ability Register (Address 5) determine flow control
- + * for both the PHY and the link partner. The following
- + * table, taken out of the IEEE 802.3ab/D6.0 dated March 25,
- + * 1999, describes these PAUSE resolution bits and how flow
- + * control is determined based upon these settings.
- + * NOTE: DC = Don't Care
- + *
- + * LOCAL DEVICE | LINK PARTNER
- + * PAUSE | ASM_DIR | PAUSE | ASM_DIR | NIC Resolution
- + *-------|---------|-------|---------|--------------------
- + * 0 | 0 | DC | DC | e1000_fc_none
- + * 0 | 1 | 0 | DC | e1000_fc_none
- + * 0 | 1 | 1 | 0 | e1000_fc_none
- + * 0 | 1 | 1 | 1 | e1000_fc_tx_pause
- + * 1 | 0 | 0 | DC | e1000_fc_none
- + * 1 | DC | 1 | DC | e1000_fc_full
- + * 1 | 1 | 0 | 0 | e1000_fc_none
- + * 1 | 1 | 0 | 1 | e1000_fc_rx_pause
- + *
- + */
- + /* Are both PAUSE bits set to 1? If so, this implies
- + * Symmetric Flow Control is enabled at both ends. The
- + * ASM_DIR bits are irrelevant per the spec.
- + *
- + * For Symmetric Flow Control:
- + *
- + * LOCAL DEVICE | LINK PARTNER
- + * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
- + *-------|---------|-------|---------|--------------------
- + * 1 | DC | 1 | DC | e1000_fc_full
- + *
- + */
- + if((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
- + (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) {
- + /* Now we need to check if the user selected RX ONLY
- + * of pause frames. In this case, we had to advertise
- + * FULL flow control because we could not advertise RX
- + * ONLY. Hence, we must now check to see if we need to
- + * turn OFF the TRANSMISSION of PAUSE frames.
- + */
- +#if 0
- + if(hw->original_fc == e1000_fc_full) {
- + hw->fc = e1000_fc_full;
- +#else
- + if(hw->fc == e1000_fc_full) {
- +#endif
- + DEBUGOUT("Flow Control = FULL.\r\n");
- + } else {
- + hw->fc = e1000_fc_rx_pause;
- + DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n");
- + }
- + }
- + /* For receiving PAUSE frames ONLY.
- + *
- + * LOCAL DEVICE | LINK PARTNER
- + * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
- + *-------|---------|-------|---------|--------------------
- + * 0 | 1 | 1 | 1 | e1000_fc_tx_pause
- + *
- + */
- + else if(!(mii_nway_adv_reg & NWAY_AR_PAUSE) &&
- + (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
- + (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
- + (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
- + hw->fc = e1000_fc_tx_pause;
- + DEBUGOUT("Flow Control = TX PAUSE frames only.\r\n");
- + }
- + /* For transmitting PAUSE frames ONLY.
- + *
- + * LOCAL DEVICE | LINK PARTNER
- + * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
- + *-------|---------|-------|---------|--------------------
- + * 1 | 1 | 0 | 1 | e1000_fc_rx_pause
- + *
- + */
- + else if((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
- + (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
- + !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
- + (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
- + hw->fc = e1000_fc_rx_pause;
- + DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n");
- + }
- + /* Per the IEEE spec, at this point flow control should be
- + * disabled. However, we want to consider that we could
- + * be connected to a legacy switch that doesn't advertise
- + * desired flow control, but can be forced on the link
- + * partner. So if we advertised no flow control, that is
- + * what we will resolve to. If we advertised some kind of
- + * receive capability (Rx Pause Only or Full Flow Control)
- + * and the link partner advertised none, we will configure
- + * ourselves to enable Rx Flow Control only. We can do
- + * this safely for two reasons: If the link partner really
- + * didn't want flow control enabled, and we enable Rx, no
- + * harm done since we won't be receiving any PAUSE frames
- + * anyway. If the intent on the link partner was to have
- + * flow control enabled, then by us enabling RX only, we
- + * can at least receive pause frames and process them.
- + * This is a good idea because in most cases, since we are
- + * predominantly a server NIC, more times than not we will
- + * be asked to delay transmission of packets than asking
- + * our link partner to pause transmission of frames.
- + */
- +#if 0
- + else if(hw->original_fc == e1000_fc_none ||
- + hw->original_fc == e1000_fc_tx_pause) {
- +#else
- + else if(hw->fc == e1000_fc_none)
- + DEBUGOUT("Flow Control = NONE.\r\n");
- + else if(hw->fc == e1000_fc_tx_pause) {
- +#endif
- + hw->fc = e1000_fc_none;
- + DEBUGOUT("Flow Control = NONE.\r\n");
- + } else {
- + hw->fc = e1000_fc_rx_pause;
- + DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n");
- + }
- +
- + /* Now we need to do one last check... If we auto-
- + * negotiated to HALF DUPLEX, flow control should not be
- + * enabled per IEEE 802.3 spec.
- + */
- + e1000_get_speed_and_duplex(hw, &speed, &duplex);
- +
- + if(duplex == HALF_DUPLEX)
- + hw->fc = e1000_fc_none;
- +
- + /* Now we call a subroutine to actually force the MAC
- + * controller to use the correct flow control settings.
- + */
- + if((ret_val = e1000_force_mac_fc(hw))) {
- + DEBUGOUT("Error forcing flow control settings\n");
- + return ret_val;
- + }
- + } else {
- + DEBUGOUT("Copper PHY and Auto Neg has not completed.\r\n");
- + }
- + }
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- + * Checks to see if the link status of the hardware has changed.
- + *
- + * hw - Struct containing variables accessed by shared code
- + *
- + * Called by any function that needs to check the link status of the adapter.
- + *****************************************************************************/
- +static int
- +e1000_check_for_link(struct e1000_hw *hw)
- +{
- + uint32_t rxcw;
- + uint32_t ctrl;
- + uint32_t status;
- + uint32_t rctl;
- + uint32_t signal = 0;
- + int32_t ret_val;
- + uint16_t phy_data;
- + uint16_t lp_capability;
- +
- + DEBUGFUNC("e1000_check_for_link");
- +
- + /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be
- + * set when the optics detect a signal. On older adapters, it will be
- + * cleared when there is a signal. This applies to fiber media only.
- + */
- + if(hw->media_type == e1000_media_type_fiber)
- + signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0;
- +
- + ctrl = E1000_READ_REG(hw, CTRL);
- + status = E1000_READ_REG(hw, STATUS);
- + rxcw = E1000_READ_REG(hw, RXCW);
- +
- + /* If we have a copper PHY then we only want to go out to the PHY
- + * registers to see if Auto-Neg has completed and/or if our link
- + * status has changed. The get_link_status flag will be set if we
- + * receive a Link Status Change interrupt or we have Rx Sequence
- + * Errors.
- + */
- +#if 0
- + if((hw->media_type == e1000_media_type_copper) && hw->get_link_status) {
- +#else
- + if(hw->media_type == e1000_media_type_copper) {
- +#endif
- + /* First we want to see if the MII Status Register reports
- + * link. If so, then we want to get the current speed/duplex
- + * of the PHY.
- + * Read the register twice since the link bit is sticky.
- + */
- + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data)))
- + return ret_val;
- + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data)))
- + return ret_val;
- +
- + if(phy_data & MII_SR_LINK_STATUS) {
- +#if 0
- + hw->get_link_status = FALSE;
- +#endif
- + } else {
- + /* No link detected */
- + return -E1000_ERR_NOLINK;
- + }
- +
- + /* We have a M88E1000 PHY and Auto-Neg is enabled. If we
- + * have Si on board that is 82544 or newer, Auto
- + * Speed Detection takes care of MAC speed/duplex
- + * configuration. So we only need to configure Collision
- + * Distance in the MAC. Otherwise, we need to force
- + * speed/duplex on the MAC to the current PHY speed/duplex
- + * settings.
- + */
- + if(hw->mac_type >= e1000_82544)
- + e1000_config_collision_dist(hw);
- + else {
- + if((ret_val = e1000_config_mac_to_phy(hw))) {
- + DEBUGOUT("Error configuring MAC to PHY settings\n");
- + return ret_val;
- + }
- + }
- +
- + /* Configure Flow Control now that Auto-Neg has completed. First, we
- + * need to restore the desired flow control settings because we may
- + * have had to re-autoneg with a different link partner.
- + */
- + if((ret_val = e1000_config_fc_after_link_up(hw))) {
- + DEBUGOUT("Error configuring flow control\n");
- + return ret_val;
- + }
- +
- + /* At this point we know that we are on copper and we have
- + * auto-negotiated link. These are conditions for checking the link
- + * parter capability register. We use the link partner capability to
- + * determine if TBI Compatibility needs to be turned on or off. If
- + * the link partner advertises any speed in addition to Gigabit, then
- + * we assume that they are GMII-based, and TBI compatibility is not
- + * needed. If no other speeds are advertised, we assume the link
- + * partner is TBI-based, and we turn on TBI Compatibility.
- + */
- + if(hw->tbi_compatibility_en) {
- + if((ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY,
- + &lp_capability)))
- + return ret_val;
- + if(lp_capability & (NWAY_LPAR_10T_HD_CAPS |
- + NWAY_LPAR_10T_FD_CAPS |
- + NWAY_LPAR_100TX_HD_CAPS |
- + NWAY_LPAR_100TX_FD_CAPS |
- + NWAY_LPAR_100T4_CAPS)) {
- + /* If our link partner advertises anything in addition to
- + * gigabit, we do not need to enable TBI compatibility.
- + */
- + if(hw->tbi_compatibility_on) {
- + /* If we previously were in the mode, turn it off. */
- + rctl = E1000_READ_REG(hw, RCTL);
- + rctl &= ~E1000_RCTL_SBP;
- + E1000_WRITE_REG(hw, RCTL, rctl);
- + hw->tbi_compatibility_on = FALSE;
- + }
- + } else {
- + /* If TBI compatibility is was previously off, turn it on. For
- + * compatibility with a TBI link partner, we will store bad
- + * packets. Some frames have an additional byte on the end and
- + * will look like CRC errors to to the hardware.
- + */
- + if(!hw->tbi_compatibility_on) {
- + hw->tbi_compatibility_on = TRUE;
- + rctl = E1000_READ_REG(hw, RCTL);
- + rctl |= E1000_RCTL_SBP;
- + E1000_WRITE_REG(hw, RCTL, rctl);
- + }
- + }
- + }
- + }
- + /* If we don't have link (auto-negotiation failed or link partner cannot
- + * auto-negotiate), the cable is plugged in (we have signal), and our
- + * link partner is not trying to auto-negotiate with us (we are receiving
- + * idles or data), we need to force link up. We also need to give
- + * auto-negotiation time to complete, in case the cable was just plugged
- + * in. The autoneg_failed flag does this.
- + */
- + else if((((hw->media_type == e1000_media_type_fiber) &&
- + ((ctrl & E1000_CTRL_SWDPIN1) == signal)) ||
- + (hw->media_type == e1000_media_type_internal_serdes)) &&
- + (!(status & E1000_STATUS_LU)) &&
- + (!(rxcw & E1000_RXCW_C))) {
- + if(hw->autoneg_failed == 0) {
- + hw->autoneg_failed = 1;
- + return 0;
- + }
- + DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\r\n");
- +
- + /* Disable auto-negotiation in the TXCW register */
- + E1000_WRITE_REG(hw, TXCW, (hw->txcw & ~E1000_TXCW_ANE));
- +
- + /* Force link-up and also force full-duplex. */
- + ctrl = E1000_READ_REG(hw, CTRL);
- + ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
- + E1000_WRITE_REG(hw, CTRL, ctrl);
- +
- + /* Configure Flow Control after forcing link up. */
- + if((ret_val = e1000_config_fc_after_link_up(hw))) {
- + DEBUGOUT("Error configuring flow control\n");
- + return ret_val;
- + }
- + }
- + /* If we are forcing link and we are receiving /C/ ordered sets, re-enable
- + * auto-negotiation in the TXCW register and disable forced link in the
- + * Device Control register in an attempt to auto-negotiate with our link
- + * partner.
- + */
- + else if(((hw->media_type == e1000_media_type_fiber) ||
- + (hw->media_type == e1000_media_type_internal_serdes)) &&
- + (ctrl & E1000_CTRL_SLU) &&
- + (rxcw & E1000_RXCW_C)) {
- + DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\r\n");
- + E1000_WRITE_REG(hw, TXCW, hw->txcw);
- + E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU));
- + }
- +#if 0
- + /* If we force link for non-auto-negotiation switch, check link status
- + * based on MAC synchronization for internal serdes media type.
- + */
- + else if((hw->media_type == e1000_media_type_internal_serdes) &&
- + !(E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) {
- + /* SYNCH bit and IV bit are sticky. */
- + udelay(10);
- + if(E1000_RXCW_SYNCH & E1000_READ_REG(hw, RXCW)) {
- + if(!(rxcw & E1000_RXCW_IV)) {
- + hw->serdes_link_down = FALSE;
- + DEBUGOUT("SERDES: Link is up.\n");
- + }
- + } else {
- + hw->serdes_link_down = TRUE;
- + DEBUGOUT("SERDES: Link is down.\n");
- + }
- + }
- +#endif
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- + * Detects the current speed and duplex settings of the hardware.
- + *
- + * hw - Struct containing variables accessed by shared code
- + * speed - Speed of the connection
- + * duplex - Duplex setting of the connection
- + *****************************************************************************/
- +static void
- +e1000_get_speed_and_duplex(struct e1000_hw *hw,
- + uint16_t *speed,
- + uint16_t *duplex)
- +{
- + uint32_t status;
- +
- + DEBUGFUNC("e1000_get_speed_and_duplex");
- +
- + if(hw->mac_type >= e1000_82543) {
- + status = E1000_READ_REG(hw, STATUS);
- + if(status & E1000_STATUS_SPEED_1000) {
- + *speed = SPEED_1000;
- + DEBUGOUT("1000 Mbs, ");
- + } else if(status & E1000_STATUS_SPEED_100) {
- + *speed = SPEED_100;
- + DEBUGOUT("100 Mbs, ");
- + } else {
- + *speed = SPEED_10;
- + DEBUGOUT("10 Mbs, ");
- + }
- +
- + if(status & E1000_STATUS_FD) {
- + *duplex = FULL_DUPLEX;
- + DEBUGOUT("Full Duplex\r\n");
- + } else {
- + *duplex = HALF_DUPLEX;
- + DEBUGOUT(" Half Duplex\r\n");
- + }
- + } else {
- + DEBUGOUT("1000 Mbs, Full Duplex\r\n");
- + *speed = SPEED_1000;
- + *duplex = FULL_DUPLEX;
- + }
- +}
- +
- +/******************************************************************************
- +* Blocks until autoneg completes or times out (~4.5 seconds)
- +*
- +* hw - Struct containing variables accessed by shared code
- +******************************************************************************/
- +static int
- +e1000_wait_autoneg(struct e1000_hw *hw)
- +{
- + int32_t ret_val;
- + uint16_t i;
- + uint16_t phy_data;
- +
- + DEBUGFUNC("e1000_wait_autoneg");
- + DEBUGOUT("Waiting for Auto-Neg to complete.\n");
- +
- + /* We will wait for autoneg to complete or 4.5 seconds to expire. */
- + for(i = PHY_AUTO_NEG_TIME; i > 0; i--) {
- + /* Read the MII Status Register and wait for Auto-Neg
- + * Complete bit to be set.
- + */
- + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data)))
- + return ret_val;
- + if((ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data)))
- + return ret_val;
- + if(phy_data & MII_SR_AUTONEG_COMPLETE) {
- + DEBUGOUT("Auto-Neg complete.\n");
- + return E1000_SUCCESS;
- + }
- + mdelay(100);
- + }
- + DEBUGOUT("Auto-Neg timedout.\n");
- + return -E1000_ERR_TIMEOUT;
- +}
- +
- +/******************************************************************************
- +* Raises the Management Data Clock
- +*
- +* hw - Struct containing variables accessed by shared code
- +* ctrl - Device control register's current value
- +******************************************************************************/
- +static void
- +e1000_raise_mdi_clk(struct e1000_hw *hw,
- + uint32_t *ctrl)
- +{
- + /* Raise the clock input to the Management Data Clock (by setting the MDC
- + * bit), and then delay 10 microseconds.
- + */
- + E1000_WRITE_REG(hw, CTRL, (*ctrl | E1000_CTRL_MDC));
- + E1000_WRITE_FLUSH(hw);
- + udelay(10);
- +}
- +
- +/******************************************************************************
- +* Lowers the Management Data Clock
- +*
- +* hw - Struct containing variables accessed by shared code
- +* ctrl - Device control register's current value
- +******************************************************************************/
- +static void
- +e1000_lower_mdi_clk(struct e1000_hw *hw,
- + uint32_t *ctrl)
- +{
- + /* Lower the clock input to the Management Data Clock (by clearing the MDC
- + * bit), and then delay 10 microseconds.
- + */
- + E1000_WRITE_REG(hw, CTRL, (*ctrl & ~E1000_CTRL_MDC));
- + E1000_WRITE_FLUSH(hw);
- + udelay(10);
- +}
- +
- +/******************************************************************************
- +* Shifts data bits out to the PHY
- +*
- +* hw - Struct containing variables accessed by shared code
- +* data - Data to send out to the PHY
- +* count - Number of bits to shift out
- +*
- +* Bits are shifted out in MSB to LSB order.
- +******************************************************************************/
- +static void
- +e1000_shift_out_mdi_bits(struct e1000_hw *hw,
- + uint32_t data,
- + uint16_t count)
- +{
- + uint32_t ctrl;
- + uint32_t mask;
- +
- + /* We need to shift "count" number of bits out to the PHY. So, the value
- + * in the "data" parameter will be shifted out to the PHY one bit at a
- + * time. In order to do this, "data" must be broken down into bits.
- + */
- + mask = 0x01;
- + mask <<= (count - 1);
- +
- + ctrl = E1000_READ_REG(hw, CTRL);
- +
- + /* Set MDIO_DIR and MDC_DIR direction bits to be used as output pins. */
- + ctrl |= (E1000_CTRL_MDIO_DIR | E1000_CTRL_MDC_DIR);
- +
- + while(mask) {
- + /* A "1" is shifted out to the PHY by setting the MDIO bit to "1" and
- + * then raising and lowering the Management Data Clock. A "0" is
- + * shifted out to the PHY by setting the MDIO bit to "0" and then
- + * raising and lowering the clock.
- + */
- + if(data & mask) ctrl |= E1000_CTRL_MDIO;
- + else ctrl &= ~E1000_CTRL_MDIO;
- +
- + E1000_WRITE_REG(hw, CTRL, ctrl);
- + E1000_WRITE_FLUSH(hw);
- +
- + udelay(10);
- +
- + e1000_raise_mdi_clk(hw, &ctrl);
- + e1000_lower_mdi_clk(hw, &ctrl);
- +
- + mask = mask >> 1;
- + }
- +}
- +
- +/******************************************************************************
- +* Shifts data bits in from the PHY
- +*
- +* hw - Struct containing variables accessed by shared code
- +*
- +* Bits are shifted in in MSB to LSB order.
- +******************************************************************************/
- +static uint16_t
- +e1000_shift_in_mdi_bits(struct e1000_hw *hw)
- +{
- + uint32_t ctrl;
- + uint16_t data = 0;
- + uint8_t i;
- +
- + /* In order to read a register from the PHY, we need to shift in a total
- + * of 18 bits from the PHY. The first two bit (turnaround) times are used
- + * to avoid contention on the MDIO pin when a read operation is performed.
- + * These two bits are ignored by us and thrown away. Bits are "shifted in"
- + * by raising the input to the Management Data Clock (setting the MDC bit),
- + * and then reading the value of the MDIO bit.
- + */
- + ctrl = E1000_READ_REG(hw, CTRL);
- +
- + /* Clear MDIO_DIR (SWDPIO1) to indicate this bit is to be used as input. */
- + ctrl &= ~E1000_CTRL_MDIO_DIR;
- + ctrl &= ~E1000_CTRL_MDIO;
- +
- + E1000_WRITE_REG(hw, CTRL, ctrl);
- + E1000_WRITE_FLUSH(hw);
- +
- + /* Raise and Lower the clock before reading in the data. This accounts for
- + * the turnaround bits. The first clock occurred when we clocked out the
- + * last bit of the Register Address.
- + */
- + e1000_raise_mdi_clk(hw, &ctrl);
- + e1000_lower_mdi_clk(hw, &ctrl);
- +
- + for(data = 0, i = 0; i < 16; i++) {
- + data = data << 1;
- + e1000_raise_mdi_clk(hw, &ctrl);
- + ctrl = E1000_READ_REG(hw, CTRL);
- + /* Check to see if we shifted in a "1". */
- + if(ctrl & E1000_CTRL_MDIO) data |= 1;
- + e1000_lower_mdi_clk(hw, &ctrl);
- + }
- +
- + e1000_raise_mdi_clk(hw, &ctrl);
- + e1000_lower_mdi_clk(hw, &ctrl);
- +
- + return data;
- +}
- +
- +/*****************************************************************************
- +* Reads the value from a PHY register, if the value is on a specific non zero
- +* page, sets the page first.
- +*
- +* hw - Struct containing variables accessed by shared code
- +* reg_addr - address of the PHY register to read
- +******************************************************************************/
- +static int
- +e1000_read_phy_reg(struct e1000_hw *hw,
- + uint32_t reg_addr,
- + uint16_t *phy_data)
- +{
- + uint32_t ret_val;
- +
- + DEBUGFUNC("e1000_read_phy_reg");
- +
- + if(hw->phy_type == e1000_phy_igp &&
- + (reg_addr > MAX_PHY_MULTI_PAGE_REG)) {
- + if((ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT,
- + (uint16_t)reg_addr)))
- + return ret_val;
- + }
- +
- + ret_val = e1000_read_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr,
- + phy_data);
- +
- + return ret_val;
- +}
- +
- +static int
- +e1000_read_phy_reg_ex(struct e1000_hw *hw,
- + uint32_t reg_addr,
- + uint16_t *phy_data)
- +{
- + uint32_t i;
- + uint32_t mdic = 0;
- + const uint32_t phy_addr = 1;
- +
- + DEBUGFUNC("e1000_read_phy_reg_ex");
- +
- + if(reg_addr > MAX_PHY_REG_ADDRESS) {
- + DEBUGOUT1("PHY Address %d is out of range\n", reg_addr);
- + return -E1000_ERR_PARAM;
- + }
- +
- + if(hw->mac_type > e1000_82543) {
- + /* Set up Op-code, Phy Address, and register address in the MDI
- + * Control register. The MAC will take care of interfacing with the
- + * PHY to retrieve the desired data.
- + */
- + mdic = ((reg_addr << E1000_MDIC_REG_SHIFT) |
- + (phy_addr << E1000_MDIC_PHY_SHIFT) |
- + (E1000_MDIC_OP_READ));
- +
- + E1000_WRITE_REG(hw, MDIC, mdic);
- +
- + /* Poll the ready bit to see if the MDI read completed */
- + for(i = 0; i < 64; i++) {
- + udelay(50);
- + mdic = E1000_READ_REG(hw, MDIC);
- + if(mdic & E1000_MDIC_READY) break;
- + }
- + if(!(mdic & E1000_MDIC_READY)) {
- + DEBUGOUT("MDI Read did not complete\n");
- + return -E1000_ERR_PHY;
- + }
- + if(mdic & E1000_MDIC_ERROR) {
- + DEBUGOUT("MDI Error\n");
- + return -E1000_ERR_PHY;
- + }
- + *phy_data = (uint16_t) mdic;
- + } else {
- + /* We must first send a preamble through the MDIO pin to signal the
- + * beginning of an MII instruction. This is done by sending 32
- + * consecutive "1" bits.
- + */
- + e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE);
- +
- + /* Now combine the next few fields that are required for a read
- + * operation. We use this method instead of calling the
- + * e1000_shift_out_mdi_bits routine five different times. The format of
- + * a MII read instruction consists of a shift out of 14 bits and is
- + * defined as follows:
- + * <Preamble><SOF><Op Code><Phy Addr><Reg Addr>
- + * followed by a shift in of 18 bits. This first two bits shifted in
- + * are TurnAround bits used to avoid contention on the MDIO pin when a
- + * READ operation is performed. These two bits are thrown away
- + * followed by a shift in of 16 bits which contains the desired data.
- + */
- + mdic = ((reg_addr) | (phy_addr << 5) |
- + (PHY_OP_READ << 10) | (PHY_SOF << 12));
- +
- + e1000_shift_out_mdi_bits(hw, mdic, 14);
- +
- + /* Now that we've shifted out the read command to the MII, we need to
- + * "shift in" the 16-bit value (18 total bits) of the requested PHY
- + * register address.
- + */
- + *phy_data = e1000_shift_in_mdi_bits(hw);
- + }
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- +* Writes a value to a PHY register
- +*
- +* hw - Struct containing variables accessed by shared code
- +* reg_addr - address of the PHY register to write
- +* data - data to write to the PHY
- +******************************************************************************/
- +static int
- +e1000_write_phy_reg(struct e1000_hw *hw,
- + uint32_t reg_addr,
- + uint16_t phy_data)
- +{
- + uint32_t ret_val;
- +
- + DEBUGFUNC("e1000_write_phy_reg");
- +
- + if(hw->phy_type == e1000_phy_igp &&
- + (reg_addr > MAX_PHY_MULTI_PAGE_REG)) {
- + if((ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT,
- + (uint16_t)reg_addr)))
- + return ret_val;
- + }
- +
- + ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr,
- + phy_data);
- +
- + return ret_val;
- +}
- +
- +static int
- +e1000_write_phy_reg_ex(struct e1000_hw *hw,
- + uint32_t reg_addr,
- + uint16_t phy_data)
- +{
- + uint32_t i;
- + uint32_t mdic = 0;
- + const uint32_t phy_addr = 1;
- +
- + DEBUGFUNC("e1000_write_phy_reg_ex");
- +
- + if(reg_addr > MAX_PHY_REG_ADDRESS) {
- + DEBUGOUT1("PHY Address %d is out of range\n", reg_addr);
- + return -E1000_ERR_PARAM;
- + }
- +
- + if(hw->mac_type > e1000_82543) {
- + /* Set up Op-code, Phy Address, register address, and data intended
- + * for the PHY register in the MDI Control register. The MAC will take
- + * care of interfacing with the PHY to send the desired data.
- + */
- + mdic = (((uint32_t) phy_data) |
- + (reg_addr << E1000_MDIC_REG_SHIFT) |
- + (phy_addr << E1000_MDIC_PHY_SHIFT) |
- + (E1000_MDIC_OP_WRITE));
- +
- + E1000_WRITE_REG(hw, MDIC, mdic);
- +
- + /* Poll the ready bit to see if the MDI read completed */
- + for(i = 0; i < 640; i++) {
- + udelay(5);
- + mdic = E1000_READ_REG(hw, MDIC);
- + if(mdic & E1000_MDIC_READY) break;
- + }
- + if(!(mdic & E1000_MDIC_READY)) {
- + DEBUGOUT("MDI Write did not complete\n");
- + return -E1000_ERR_PHY;
- + }
- + } else {
- + /* We'll need to use the SW defined pins to shift the write command
- + * out to the PHY. We first send a preamble to the PHY to signal the
- + * beginning of the MII instruction. This is done by sending 32
- + * consecutive "1" bits.
- + */
- + e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE);
- +
- + /* Now combine the remaining required fields that will indicate a
- + * write operation. We use this method instead of calling the
- + * e1000_shift_out_mdi_bits routine for each field in the command. The
- + * format of a MII write instruction is as follows:
- + * <Preamble><SOF><Op Code><Phy Addr><Reg Addr><Turnaround><Data>.
- + */
- + mdic = ((PHY_TURNAROUND) | (reg_addr << 2) | (phy_addr << 7) |
- + (PHY_OP_WRITE << 12) | (PHY_SOF << 14));
- + mdic <<= 16;
- + mdic |= (uint32_t) phy_data;
- +
- + e1000_shift_out_mdi_bits(hw, mdic, 32);
- + }
- +
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- +* Returns the PHY to the power-on reset state
- +*
- +* hw - Struct containing variables accessed by shared code
- +******************************************************************************/
- +static void
- +e1000_phy_hw_reset(struct e1000_hw *hw)
- +{
- + uint32_t ctrl, ctrl_ext;
- +
- + DEBUGFUNC("e1000_phy_hw_reset");
- +
- + DEBUGOUT("Resetting Phy...\n");
- +
- + if(hw->mac_type > e1000_82543) {
- + /* Read the device control register and assert the E1000_CTRL_PHY_RST
- + * bit. Then, take it out of reset.
- + */
- + ctrl = E1000_READ_REG(hw, CTRL);
- + E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PHY_RST);
- + E1000_WRITE_FLUSH(hw);
- + mdelay(10);
- + E1000_WRITE_REG(hw, CTRL, ctrl);
- + E1000_WRITE_FLUSH(hw);
- + } else {
- + /* Read the Extended Device Control Register, assert the PHY_RESET_DIR
- + * bit to put the PHY into reset. Then, take it out of reset.
- + */
- + ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
- + ctrl_ext |= E1000_CTRL_EXT_SDP4_DIR;
- + ctrl_ext &= ~E1000_CTRL_EXT_SDP4_DATA;
- + E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
- + E1000_WRITE_FLUSH(hw);
- + mdelay(10);
- + ctrl_ext |= E1000_CTRL_EXT_SDP4_DATA;
- + E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
- + E1000_WRITE_FLUSH(hw);
- + }
- + udelay(150);
- +}
- +
- +/******************************************************************************
- +* Resets the PHY
- +*
- +* hw - Struct containing variables accessed by shared code
- +*
- +* Sets bit 15 of the MII Control regiser
- +******************************************************************************/
- +static int
- +e1000_phy_reset(struct e1000_hw *hw)
- +{
- + int32_t ret_val;
- + uint16_t phy_data;
- +
- + DEBUGFUNC("e1000_phy_reset");
- +
- + if(hw->mac_type != e1000_82541_rev_2) {
- + if((ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data)))
- + return ret_val;
- +
- + phy_data |= MII_CR_RESET;
- + if((ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data)))
- + return ret_val;
- +
- + udelay(1);
- + } else e1000_phy_hw_reset(hw);
- +
- + if(hw->phy_type == e1000_phy_igp)
- + e1000_phy_init_script(hw);
- +
- + return E1000_SUCCESS;
- +}
- +
- +/******************************************************************************
- +* Probes the expected PHY address for known PHY IDs
- +*
- +* hw - Struct containing variables accessed by shared code
- +******************************************************************************/
- +static int
- +e1000_detect_gig_phy(struct e1000_hw *hw)
- +{
- + int32_t phy_init_status, ret_val;
- + uint16_t phy_id_high, phy_id_low;
- + boolean_t match = FALSE;
- +
- + DEBUGFUNC("e1000_detect_gig_phy");
- +
- + /* Read the PHY ID Registers to identify which PHY is onboard. */
- + if((ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high)))
- + return ret_val;
- +
- + hw->phy_id = (uint32_t) (phy_id_high << 16);
- + udelay(20);
- + if((ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low)))
- + return ret_val;
- +
- + hw->phy_id |= (uint32_t) (phy_id_low & PHY_REVISION_MASK);
- +#ifdef LINUX_DRIVER
- + hw->phy_revision = (uint32_t) phy_id_low & ~PHY_REVISION_MASK;
- +#endif
- +
- + switch(hw->mac_type) {
- + case e1000_82543:
- + if(hw->phy_id == M88E1000_E_PHY_ID) match = TRUE;
- + break;
- + case e1000_82544:
- + if(hw->phy_id == M88E1000_I_PHY_ID) match = TRUE;
- + break;
- + case e1000_82540:
- + case e1000_82545:
- + case e1000_82545_rev_3:
- + case e1000_82546:
- + case e1000_82546_rev_3:
- + if(hw->phy_id == M88E1011_I_PHY_ID) match = TRUE;
- + break;
- + case e1000_82541:
- + case e1000_82541_rev_2:
- + case e1000_82547:
- + case e1000_82547_rev_2:
- + if(hw->phy_id == IGP01E1000_I_PHY_ID) match = TRUE;
- + break;
- + default:
- + DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type);
- + return -E1000_ERR_CONFIG;
- + }
- + phy_init_status = e1000_set_phy_type(hw);
- +
- + if ((match) && (phy_init_status == E1000_SUCCESS)) {
- + DEBUGOUT1("PHY ID 0x%X detected\n", hw->phy_id);
- + return E1000_SUCCESS;
- + }
- + DEBUGOUT1("Invalid PHY ID 0x%X\n", hw->phy_id);
- + return -E1000_ERR_PHY;
- +}
- +
- +/******************************************************************************
- + * Sets up eeprom variables in the hw struct. Must be called after mac_type
- + * is configured.
- + *
- + * hw - Struct containing variables accessed by shared code
- + *****************************************************************************/
- +static void
- +e1000_init_eeprom_params(struct e1000_hw *hw)
- +{
- + struct e1000_eeprom_info *eeprom = &hw->eeprom;
- + uint32_t eecd = E1000_READ_REG(hw, EECD);
- + uint16_t eeprom_size;
- +
- + DEBUGFUNC("e1000_init_eeprom_params");
- +
- + switch (hw->mac_type) {
- + case e1000_82542_rev2_0:
- + case e1000_82542_rev2_1:
- + case e1000_82543:
- + case e1000_82544:
- + eeprom->type = e1000_eeprom_microwire;
- + eeprom->word_size = 64;
- + eeprom->opcode_bits = 3;
- + eeprom->address_bits = 6;
- + eeprom->delay_usec = 50;
- + break;
- + case e1000_82540:
- + case e1000_82545:
- + case e1000_82545_rev_3:
- + case e1000_82546:
- + case e1000_82546_rev_3:
- + eeprom->type = e1000_eeprom_microwire;
- + eeprom->opcode_bits = 3;
- + eeprom->delay_usec = 50;
- + if(eecd & E1000_EECD_SIZE) {
- + eeprom->word_size = 256;
- + eeprom->address_bits = 8;
- + } else {
- + eeprom->word_size = 64;
- + eeprom->address_bits = 6;
- + }
- + break;
- + case e1000_82541:
- + case e1000_82541_rev_2:
- + case e1000_82547:
- + case e1000_82547_rev_2:
- + if (eecd & E1000_EECD_TYPE) {
- + eeprom->type = e1000_eeprom_spi;
- + if (eecd & E1000_EECD_ADDR_BITS) {
- + eeprom->page_size = 32;
- + eeprom->address_bits = 16;
- + } else {
- + eeprom->page_size = 8;
- + eeprom->address_bits = 8;
- + }
- + } else {
- + eeprom->type = e1000_eeprom_microwire;
- + eeprom->opcode_bits = 3;
- + eeprom->delay_usec = 50;
- + if (eecd & E1000_EECD_ADDR_BITS) {
- + eeprom->word_size = 256;
- + eeprom->address_bits = 8;
- + } else {
- + eeprom->word_size = 64;
- + eeprom->address_bits = 6;
- + }
- + }
- + break;
- + default:
- + eeprom->type = e1000_eeprom_spi;
- + if (eecd & E1000_EECD_ADDR_BITS) {
- + eeprom->page_size = 32;
- + eeprom->address_bits = 16;
- + } else {
- + eeprom->page_size = 8;
- + eeprom->address_bits = 8;
- + }
- + break;
- + }
- +
- + if (eeprom->type == e1000_eeprom_spi) {
- + eeprom->opcode_bits = 8;
- + eeprom->delay_usec = 1;
- + eeprom->word_size = 64;
- + if (e1000_read_eeprom(hw, EEPROM_CFG, 1, &eeprom_size) == 0) {
- + eeprom_size &= EEPROM_SIZE_MASK;
- +
- + switch (eeprom_size) {
- + case EEPROM_SIZE_16KB:
- + eeprom->word_size = 8192;
- + break;
- + case EEPROM_SIZE_8KB:
- + eeprom->word_size = 4096;
- + break;
- + case EEPROM_SIZE_4KB:
- + eeprom->word_size = 2048;
- + break;
- + case EEPROM_SIZE_2KB:
- + eeprom->word_size = 1024;
- + break;
- + case EEPROM_SIZE_1KB:
- + eeprom->word_size = 512;
- + break;
- + case EEPROM_SIZE_512B:
- + eeprom->word_size = 256;
- + break;
- + case EEPROM_SIZE_128B:
- + default:
- + break;
- + }
- + }
- + }
- +}
- +
- +/**
- + * e1000_reset - Reset the adapter
- + */
- +
- +static int
- +e1000_reset(struct e1000_hw *hw)
- +{
- + uint32_t pba;
- + /* Repartition Pba for greater than 9k mtu
- + * To take effect CTRL.RST is required.
- + */
- +
- + if(hw->mac_type < e1000_82547) {
- + pba = E1000_PBA_48K;
- + } else {
- + pba = E1000_PBA_30K;
- + }
- + E1000_WRITE_REG(hw, PBA, pba);
- +
- + /* flow control settings */
- +#if 0
- + hw->fc_high_water = FC_DEFAULT_HI_THRESH;
- + hw->fc_low_water = FC_DEFAULT_LO_THRESH;
- + hw->fc_pause_time = FC_DEFAULT_TX_TIMER;
- + hw->fc_send_xon = 1;
- + hw->fc = hw->original_fc;
- +#endif
- +
- + e1000_reset_hw(hw);
- + if(hw->mac_type >= e1000_82544)
- + E1000_WRITE_REG(hw, WUC, 0);
- + return e1000_init_hw(hw);
- +}
- +
- +/**
- + * e1000_sw_init - Initialize general software structures (struct e1000_adapter)
- + * @adapter: board private structure to initialize
- + *
- + * e1000_sw_init initializes the Adapter private data structure.
- + * Fields are initialized based on PCI device information and
- + * OS network device settings (MTU size).
- + **/
- +
- +static int
- +e1000_sw_init(struct pci_device *pdev, struct e1000_hw *hw)
- +{
- + int result;
- +
- + /* PCI config space info */
- + pci_read_config_word(pdev, PCI_VENDOR_ID, &hw->vendor_id);
- + pci_read_config_word(pdev, PCI_DEVICE_ID, &hw->device_id);
- + pci_read_config_byte(pdev, PCI_REVISION, &hw->revision_id);
- +#if 0
- + pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID,
- + &hw->subsystem_vendor_id);
- + pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &hw->subsystem_id);
- +#endif
- +
- + pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word);
- +
- + /* identify the MAC */
- +
- + result = e1000_set_mac_type(hw);
- + if (result) {
- + E1000_ERR("Unknown MAC Type\n");
- + return result;
- + }
- +
- + /* initialize eeprom parameters */
- +
- + e1000_init_eeprom_params(hw);
- +
- +#if 0
- + if((hw->mac_type == e1000_82541) ||
- + (hw->mac_type == e1000_82547) ||
- + (hw->mac_type == e1000_82541_rev_2) ||
- + (hw->mac_type == e1000_82547_rev_2))
- + hw->phy_init_script = 1;
- +#endif
- +
- + e1000_set_media_type(hw);
- +
- +#if 0
- + if(hw->mac_type < e1000_82543)
- + hw->report_tx_early = 0;
- + else
- + hw->report_tx_early = 1;
- +
- + hw->wait_autoneg_complete = FALSE;
- +#endif
- + hw->tbi_compatibility_en = TRUE;
- +#if 0
- + hw->adaptive_ifs = TRUE;
- +
- + /* Copper options */
- +
- + if(hw->media_type == e1000_media_type_copper) {
- + hw->mdix = AUTO_ALL_MODES;
- + hw->disable_polarity_correction = FALSE;
- + hw->master_slave = E1000_MASTER_SLAVE;
- + }
- +#endif
- + return E1000_SUCCESS;
- +}
- +
- +static void fill_rx (void)
- +{
- + struct e1000_rx_desc *rd;
- + rx_last = rx_tail;
- + rd = rx_base + rx_tail;
- + rx_tail = (rx_tail + 1) % 8;
- + memset (rd, 0, 16);
- + rd->buffer_addr = virt_to_bus(&packet);
- + E1000_WRITE_REG (&hw, RDT, rx_tail);
- +}
- +
- +static void init_descriptor (void)
- +{
- + unsigned long ptr;
- + unsigned long tctl;
- +
- + ptr = virt_to_phys(tx_pool);
- + if (ptr & 0xf)
- + ptr = (ptr + 0x10) & (~0xf);
- +
- + tx_base = phys_to_virt(ptr);
- +
- + E1000_WRITE_REG (&hw, TDBAL, virt_to_bus(tx_base));
- + E1000_WRITE_REG (&hw, TDBAH, 0);
- + E1000_WRITE_REG (&hw, TDLEN, 128);
- +
- + /* Setup the HW Tx Head and Tail descriptor pointers */
- +
- + E1000_WRITE_REG (&hw, TDH, 0);
- + E1000_WRITE_REG (&hw, TDT, 0);
- + tx_tail = 0;
- +
- + /* Program the Transmit Control Register */
- +
- +#ifdef LINUX_DRIVER_TCTL
- + tctl = E1000_READ_REG(&hw, TCTL);
- +
- + tctl &= ~E1000_TCTL_CT;
- + tctl |= E1000_TCTL_EN | E1000_TCTL_PSP |
- + (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT);
- +#else
- + tctl = E1000_TCTL_PSP | E1000_TCTL_EN |
- + (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT) |
- + (E1000_HDX_COLLISION_DISTANCE << E1000_COLD_SHIFT);
- +#endif
- +
- + E1000_WRITE_REG (&hw, TCTL, tctl);
- +
- + e1000_config_collision_dist(&hw);
- +
- +
- + rx_tail = 0;
- + /* disable receive */
- + E1000_WRITE_REG (&hw, RCTL, 0);
- + ptr = virt_to_phys(rx_pool);
- + if (ptr & 0xf)
- + ptr = (ptr + 0x10) & (~0xf);
- + rx_base = phys_to_virt(ptr);
- +
- + /* Setup the Base and Length of the Rx Descriptor Ring */
- +
- + E1000_WRITE_REG (&hw, RDBAL, virt_to_bus(rx_base));
- + E1000_WRITE_REG (&hw, RDBAH, 0);
- +
- + E1000_WRITE_REG (&hw, RDLEN, 128);
- +
- + /* Setup the HW Rx Head and Tail Descriptor Pointers */
- + E1000_WRITE_REG (&hw, RDH, 0);
- + E1000_WRITE_REG (&hw, RDT, 0);
- +
- + E1000_WRITE_REG (&hw, RCTL,
- + E1000_RCTL_EN |
- + E1000_RCTL_BAM |
- + E1000_RCTL_SZ_2048 |
- + E1000_RCTL_MPE);
- + fill_rx();
- +}
- +
- +
- +
- +/**************************************************************************
- +POLL - Wait for a frame
- +***************************************************************************/
- +static int
- +e1000_poll (struct nic *nic, int retrieve)
- +{
- + /* return true if there's an ethernet packet ready to read */
- + /* nic->packet should contain data on return */
- + /* nic->packetlen should contain length of data */
- + struct e1000_rx_desc *rd;
- +
- + rd = rx_base + rx_last;
- + if (!rd->status & E1000_RXD_STAT_DD)
- + return 0;
- +
- + if ( ! retrieve ) return 1;
- +
- + // printf("recv: packet %! -> %! len=%d \n", packet+6, packet,rd->Length);
- + memcpy (nic->packet, packet, rd->length);
- + nic->packetlen = rd->length;
- + fill_rx ();
- + return 1;
- +}
- +
- +/**************************************************************************
- +TRANSMIT - Transmit a frame
- +***************************************************************************/
- +static void
- +e1000_transmit (struct nic *nic, const char *d, /* Destination */
- + unsigned int type, /* Type */
- + unsigned int size, /* size */
- + const char *p) /* Packet */
- +{
- + /* send the packet to destination */
- + struct eth_hdr {
- + unsigned char dst_addr[ETH_ALEN];
- + unsigned char src_addr[ETH_ALEN];
- + unsigned short type;
- + } hdr;
- + struct e1000_tx_desc *txhd; /* header */
- + struct e1000_tx_desc *txp; /* payload */
- + DEBUGFUNC("send");
- +
- + memcpy (&hdr.dst_addr, d, ETH_ALEN);
- + memcpy (&hdr.src_addr, nic->node_addr, ETH_ALEN);
- +
- + hdr.type = htons (type);
- + txhd = tx_base + tx_tail;
- + tx_tail = (tx_tail + 1) % 8;
- + txp = tx_base + tx_tail;
- + tx_tail = (tx_tail + 1) % 8;
- +
- + txhd->buffer_addr = virt_to_bus (&hdr);
- + txhd->lower.data = sizeof (hdr);
- + txhd->upper.data = 0;
- +
- + txp->buffer_addr = virt_to_bus(p);
- + txp->lower.data = E1000_TXD_CMD_RPS | E1000_TXD_CMD_EOP | E1000_TXD_CMD_IFCS | size;
- + txp->upper.data = 0;
- +
- + E1000_WRITE_REG (&hw, TDT, tx_tail);
- + while (!(txp->upper.data & E1000_TXD_STAT_DD)) {
- + udelay(10); /* give the nic a chance to write to the register */
- + poll_interruptions();
- + }
- + DEBUGFUNC("send end");
- +}
- +
- +
- +/**************************************************************************
- +DISABLE - Turn off ethernet interface
- +***************************************************************************/
- +static void e1000_disable (struct dev *dev __unused)
- +{
- + /* Clear the transmit ring */
- + E1000_WRITE_REG (&hw, TDH, 0);
- + E1000_WRITE_REG (&hw, TDT, 0);
- +
- + /* Clear the receive ring */
- + E1000_WRITE_REG (&hw, RDH, 0);
- + E1000_WRITE_REG (&hw, RDT, 0);
- +
- + /* put the card in its initial state */
- + E1000_WRITE_REG (&hw, CTRL, E1000_CTRL_RST);
- +
- + /* Turn off the ethernet interface */
- + E1000_WRITE_REG (&hw, RCTL, 0);
- + E1000_WRITE_REG (&hw, TCTL, 0);
- + mdelay (10);
- +
- + /* Unmap my window to the device */
- + iounmap(hw.hw_addr);
- +}
- +
- +/**************************************************************************
- +IRQ - Enable, Disable, or Force interrupts
- +***************************************************************************/
- +static void e1000_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
- +
- +#define IORESOURCE_IO 0x00000100 /* Resource type */
- +#define BAR_0 0
- +#define BAR_1 1
- +#define BAR_5 5
- +
- +/**************************************************************************
- +PROBE - Look for an adapter, this routine's visible to the outside
- +You should omit the last argument struct pci_device * for a non-PCI NIC
- +***************************************************************************/
- +static int e1000_probe(struct dev *dev, struct pci_device *p)
- +{
- + struct nic *nic = (struct nic *)dev;
- + unsigned long mmio_start, mmio_len;
- + int ret_val, i;
- +
- + if (p == 0)
- + return 0;
- + /* Initialize hw with default values */
- + memset(&hw, 0, sizeof(hw));
- + hw.pdev = p;
- +
- +#if 1
- + /* Are these variables needed? */
- + hw.fc = e1000_fc_none;
- +#if 0
- + hw.original_fc = e1000_fc_none;
- +#endif
- + hw.autoneg_failed = 0;
- +#if 0
- + hw.get_link_status = TRUE;
- +#endif
- +#endif
- +
- + mmio_start = pci_bar_start(p, PCI_BASE_ADDRESS_0);
- + mmio_len = pci_bar_size(p, PCI_BASE_ADDRESS_0);
- + hw.hw_addr = ioremap(mmio_start, mmio_len);
- +
- + for(i = BAR_1; i <= BAR_5; i++) {
- + if(pci_bar_size(p, i) == 0)
- + continue;
- + if(pci_find_capability(p, i) & IORESOURCE_IO) {
- + hw.io_base = pci_bar_start(p, i);
- + break;
- + }
- + }
- +
- + adjust_pci_device(p);
- +
- + nic->ioaddr = p->ioaddr & ~3;
- + nic->irqno = 0;
- +
- + /* From Matt Hortman <mbhortman@acpthinclient.com> */
- + /* MAC and Phy settings */
- +
- + /* setup the private structure */
- + if (e1000_sw_init(p, &hw) < 0) {
- + iounmap(hw.hw_addr);
- + return 0;
- + }
- +
- + /* make sure the EEPROM is good */
- +
- + if (e1000_validate_eeprom_checksum(&hw) < 0) {
- + printf ("The EEPROM Checksum Is Not Valid\n");
- + iounmap(hw.hw_addr);
- + return 0;
- + }
- +
- + /* copy the MAC address out of the EEPROM */
- +
- + e1000_read_mac_addr(&hw);
- + memcpy (nic->node_addr, hw.mac_addr, ETH_ALEN);
- +
- + printf("Ethernet addr: %!\n", nic->node_addr);
- +
- + /* reset the hardware with the new settings */
- +
- + ret_val = e1000_reset(&hw);
- + if (ret_val < 0) {
- + if ((ret_val == -E1000_ERR_NOLINK) ||
- + (ret_val == -E1000_ERR_TIMEOUT)) {
- + E1000_ERR("Valid Link not detected\n");
- + } else {
- + E1000_ERR("Hardware Initialization Failed\n");
- + }
- + iounmap(hw.hw_addr);
- + return 0;
- + }
- + init_descriptor();
- +
- + /* point to NIC specific routines */
- + dev->disable = e1000_disable;
- + nic->poll = e1000_poll;
- + nic->transmit = e1000_transmit;
- + nic->irq = e1000_irq;
- +
- + return 1;
- +}
- +
- +static struct pci_id e1000_nics[] = {
- +PCI_ROM(0x8086, 0x1000, "e1000-82542", "Intel EtherExpressPro1000"),
- +PCI_ROM(0x8086, 0x1001, "e1000-82543gc-fiber", "Intel EtherExpressPro1000 82543GC Fiber"),
- +PCI_ROM(0x8086, 0x1004, "e1000-82543gc-copper", "Intel EtherExpressPro1000 82543GC Copper"),
- +PCI_ROM(0x8086, 0x1008, "e1000-82544ei-copper", "Intel EtherExpressPro1000 82544EI Copper"),
- +PCI_ROM(0x8086, 0x1009, "e1000-82544ei-fiber", "Intel EtherExpressPro1000 82544EI Fiber"),
- +PCI_ROM(0x8086, 0x100C, "e1000-82544gc-copper", "Intel EtherExpressPro1000 82544GC Copper"),
- +PCI_ROM(0x8086, 0x100D, "e1000-82544gc-lom", "Intel EtherExpressPro1000 82544GC LOM"),
- +PCI_ROM(0x8086, 0x100E, "e1000-82540em", "Intel EtherExpressPro1000 82540EM"),
- +PCI_ROM(0x8086, 0x100F, "e1000-82545em-copper", "Intel EtherExpressPro1000 82545EM Copper"),
- +PCI_ROM(0x8086, 0x1010, "e1000-82546eb-copper", "Intel EtherExpressPro1000 82546EB Copper"),
- +PCI_ROM(0x8086, 0x1011, "e1000-82545em-fiber", "Intel EtherExpressPro1000 82545EM Fiber"),
- +PCI_ROM(0x8086, 0x1012, "e1000-82546eb-fiber", "Intel EtherExpressPro1000 82546EB Copper"),
- +PCI_ROM(0x8086, 0x1013, "e1000-82541ei", "Intel EtherExpressPro1000 82541EI"),
- +PCI_ROM(0x8086, 0x1015, "e1000-82540em-lom", "Intel EtherExpressPro1000 82540EM LOM"),
- +PCI_ROM(0x8086, 0x1016, "e1000-82540ep-lom", "Intel EtherExpressPro1000 82540EP LOM"),
- +PCI_ROM(0x8086, 0x1017, "e1000-82540ep", "Intel EtherExpressPro1000 82540EP"),
- +PCI_ROM(0x8086, 0x1018, "e1000-82541ep", "Intel EtherExpressPro1000 82541EP"),
- +PCI_ROM(0x8086, 0x1019, "e1000-82547ei", "Intel EtherExpressPro1000 82547EI"),
- +PCI_ROM(0x8086, 0x101d, "e1000-82546eb-quad-copper", "Intel EtherExpressPro1000 82546EB Quad Copper"),
- +PCI_ROM(0x8086, 0x101e, "e1000-82540ep-lp", "Intel EtherExpressPro1000 82540EP LP"),
- +PCI_ROM(0x8086, 0x1026, "e1000-82545gm-copper", "Intel EtherExpressPro1000 82545GM Copper"),
- +PCI_ROM(0x8086, 0x1027, "e1000-82545gm-fiber", "Intel EtherExpressPro1000 82545GM Fiber"),
- +PCI_ROM(0x8086, 0x1028, "e1000-82545gm-serdes", "Intel EtherExpressPro1000 82545GM SERDES"),
- +PCI_ROM(0x8086, 0x1075, "e1000-82547gi", "Intel EtherExpressPro1000 82547GI"),
- +PCI_ROM(0x8086, 0x1076, "e1000-82541gi", "Intel EtherExpressPro1000 82541GI"),
- +PCI_ROM(0x8086, 0x1077, "e1000-82541gi-mobile", "Intel EtherExpressPro1000 82541GI Mobile"),
- +PCI_ROM(0x8086, 0x1078, "e1000-82541er", "Intel EtherExpressPro1000 82541ER"),
- +PCI_ROM(0x8086, 0x1079, "e1000-82546gb-copper", "Intel EtherExpressPro1000 82546GB Copper"),
- +PCI_ROM(0x8086, 0x107a, "e1000-82546gb-fiber", "Intel EtherExpressPro1000 82546GB Fiber"),
- +PCI_ROM(0x8086, 0x107b, "e1000-82546gb-serdes", "Intel EtherExpressPro1000 82546GB SERDES"),
- +};
- +
- +struct pci_driver e1000_driver = {
- + .type = NIC_DRIVER,
- + .name = "E1000",
- + .probe = e1000_probe,
- + .ids = e1000_nics,
- + .id_count = sizeof(e1000_nics)/sizeof(e1000_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/e1000_hw.h grub-0.97/netboot/e1000_hw.h
- --- grub-0.97.orig/netboot/e1000_hw.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/e1000_hw.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,2058 @@
- +/*******************************************************************************
- +
- +
- + Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
- +
- + This program is free software; you can redistribute it and/or modify it
- + under the terms of the GNU General Public License as published by the Free
- + Software Foundation; either version 2 of the License, or (at your option)
- + any later version.
- +
- + This program is distributed in the hope that it will be useful, but WITHOUT
- + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- + more details.
- +
- + You should have received a copy of the GNU General Public License along with
- + this program; if not, write to the Free Software Foundation, Inc., 59
- + Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- +
- + The full GNU General Public License is included in this distribution in the
- + file called LICENSE.
- +
- + Contact Information:
- + Linux NICS <linux.nics@intel.com>
- + Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- +
- +*******************************************************************************/
- +
- +/* e1000_hw.h
- + * Structures, enums, and macros for the MAC
- + */
- +
- +#ifndef _E1000_HW_H_
- +#define _E1000_HW_H_
- +
- +/* Forward declarations of structures used by the shared code */
- +struct e1000_hw;
- +struct e1000_hw_stats;
- +
- +/* Enumerated types specific to the e1000 hardware */
- +/* Media Access Controlers */
- +typedef enum {
- + e1000_undefined = 0,
- + e1000_82542_rev2_0,
- + e1000_82542_rev2_1,
- + e1000_82543,
- + e1000_82544,
- + e1000_82540,
- + e1000_82545,
- + e1000_82545_rev_3,
- + e1000_82546,
- + e1000_82546_rev_3,
- + e1000_82541,
- + e1000_82541_rev_2,
- + e1000_82547,
- + e1000_82547_rev_2,
- + e1000_num_macs
- +} e1000_mac_type;
- +
- +typedef enum {
- + e1000_eeprom_uninitialized = 0,
- + e1000_eeprom_spi,
- + e1000_eeprom_microwire,
- + e1000_num_eeprom_types
- +} e1000_eeprom_type;
- +
- +/* Media Types */
- +typedef enum {
- + e1000_media_type_copper = 0,
- + e1000_media_type_fiber = 1,
- + e1000_media_type_internal_serdes = 2,
- + e1000_num_media_types
- +} e1000_media_type;
- +
- +typedef enum {
- + e1000_10_half = 0,
- + e1000_10_full = 1,
- + e1000_100_half = 2,
- + e1000_100_full = 3
- +} e1000_speed_duplex_type;
- +
- +/* Flow Control Settings */
- +typedef enum {
- + e1000_fc_none = 0,
- + e1000_fc_rx_pause = 1,
- + e1000_fc_tx_pause = 2,
- + e1000_fc_full = 3,
- + e1000_fc_default = 0xFF
- +} e1000_fc_type;
- +
- +/* PCI bus types */
- +typedef enum {
- + e1000_bus_type_unknown = 0,
- + e1000_bus_type_pci,
- + e1000_bus_type_pcix,
- + e1000_bus_type_reserved
- +} e1000_bus_type;
- +
- +/* PCI bus speeds */
- +typedef enum {
- + e1000_bus_speed_unknown = 0,
- + e1000_bus_speed_33,
- + e1000_bus_speed_66,
- + e1000_bus_speed_100,
- + e1000_bus_speed_120,
- + e1000_bus_speed_133,
- + e1000_bus_speed_reserved
- +} e1000_bus_speed;
- +
- +/* PCI bus widths */
- +typedef enum {
- + e1000_bus_width_unknown = 0,
- + e1000_bus_width_32,
- + e1000_bus_width_64,
- + e1000_bus_width_reserved
- +} e1000_bus_width;
- +
- +/* PHY status info structure and supporting enums */
- +typedef enum {
- + e1000_cable_length_50 = 0,
- + e1000_cable_length_50_80,
- + e1000_cable_length_80_110,
- + e1000_cable_length_110_140,
- + e1000_cable_length_140,
- + e1000_cable_length_undefined = 0xFF
- +} e1000_cable_length;
- +
- +typedef enum {
- + e1000_igp_cable_length_10 = 10,
- + e1000_igp_cable_length_20 = 20,
- + e1000_igp_cable_length_30 = 30,
- + e1000_igp_cable_length_40 = 40,
- + e1000_igp_cable_length_50 = 50,
- + e1000_igp_cable_length_60 = 60,
- + e1000_igp_cable_length_70 = 70,
- + e1000_igp_cable_length_80 = 80,
- + e1000_igp_cable_length_90 = 90,
- + e1000_igp_cable_length_100 = 100,
- + e1000_igp_cable_length_110 = 110,
- + e1000_igp_cable_length_120 = 120,
- + e1000_igp_cable_length_130 = 130,
- + e1000_igp_cable_length_140 = 140,
- + e1000_igp_cable_length_150 = 150,
- + e1000_igp_cable_length_160 = 160,
- + e1000_igp_cable_length_170 = 170,
- + e1000_igp_cable_length_180 = 180
- +} e1000_igp_cable_length;
- +
- +typedef enum {
- + e1000_10bt_ext_dist_enable_normal = 0,
- + e1000_10bt_ext_dist_enable_lower,
- + e1000_10bt_ext_dist_enable_undefined = 0xFF
- +} e1000_10bt_ext_dist_enable;
- +
- +typedef enum {
- + e1000_rev_polarity_normal = 0,
- + e1000_rev_polarity_reversed,
- + e1000_rev_polarity_undefined = 0xFF
- +} e1000_rev_polarity;
- +
- +typedef enum {
- + e1000_downshift_normal = 0,
- + e1000_downshift_activated,
- + e1000_downshift_undefined = 0xFF
- +} e1000_downshift;
- +
- +typedef enum {
- + e1000_polarity_reversal_enabled = 0,
- + e1000_polarity_reversal_disabled,
- + e1000_polarity_reversal_undefined = 0xFF
- +} e1000_polarity_reversal;
- +
- +typedef enum {
- + e1000_auto_x_mode_manual_mdi = 0,
- + e1000_auto_x_mode_manual_mdix,
- + e1000_auto_x_mode_auto1,
- + e1000_auto_x_mode_auto2,
- + e1000_auto_x_mode_undefined = 0xFF
- +} e1000_auto_x_mode;
- +
- +typedef enum {
- + e1000_1000t_rx_status_not_ok = 0,
- + e1000_1000t_rx_status_ok,
- + e1000_1000t_rx_status_undefined = 0xFF
- +} e1000_1000t_rx_status;
- +
- +typedef enum {
- + e1000_phy_m88 = 0,
- + e1000_phy_igp,
- + e1000_phy_undefined = 0xFF
- +} e1000_phy_type;
- +
- +typedef enum {
- + e1000_ms_hw_default = 0,
- + e1000_ms_force_master,
- + e1000_ms_force_slave,
- + e1000_ms_auto
- +} e1000_ms_type;
- +
- +typedef enum {
- + e1000_ffe_config_enabled = 0,
- + e1000_ffe_config_active,
- + e1000_ffe_config_blocked
- +} e1000_ffe_config;
- +
- +typedef enum {
- + e1000_dsp_config_disabled = 0,
- + e1000_dsp_config_enabled,
- + e1000_dsp_config_activated,
- + e1000_dsp_config_undefined = 0xFF
- +} e1000_dsp_config;
- +
- +struct e1000_phy_info {
- + e1000_cable_length cable_length;
- + e1000_10bt_ext_dist_enable extended_10bt_distance;
- + e1000_rev_polarity cable_polarity;
- + e1000_downshift downshift;
- + e1000_polarity_reversal polarity_correction;
- + e1000_auto_x_mode mdix_mode;
- + e1000_1000t_rx_status local_rx;
- + e1000_1000t_rx_status remote_rx;
- +};
- +
- +struct e1000_phy_stats {
- + uint32_t idle_errors;
- + uint32_t receive_errors;
- +};
- +
- +struct e1000_eeprom_info {
- + e1000_eeprom_type type;
- + uint16_t word_size;
- + uint16_t opcode_bits;
- + uint16_t address_bits;
- + uint16_t delay_usec;
- + uint16_t page_size;
- +};
- +
- +
- +
- +/* Error Codes */
- +#define E1000_SUCCESS 0
- +#define E1000_ERR_EEPROM 1
- +#define E1000_ERR_PHY 2
- +#define E1000_ERR_CONFIG 3
- +#define E1000_ERR_PARAM 4
- +#define E1000_ERR_MAC_TYPE 5
- +#define E1000_ERR_PHY_TYPE 6
- +#define E1000_ERR_NOLINK 7
- +#define E1000_ERR_TIMEOUT 8
- +
- +#define E1000_READ_REG_IO(a, reg) \
- + e1000_read_reg_io((a), E1000_##reg)
- +#define E1000_WRITE_REG_IO(a, reg, val) \
- + e1000_write_reg_io((a), E1000_##reg, val)
- +
- +/* PCI Device IDs */
- +#define E1000_DEV_ID_82542 0x1000
- +#define E1000_DEV_ID_82543GC_FIBER 0x1001
- +#define E1000_DEV_ID_82543GC_COPPER 0x1004
- +#define E1000_DEV_ID_82544EI_COPPER 0x1008
- +#define E1000_DEV_ID_82544EI_FIBER 0x1009
- +#define E1000_DEV_ID_82544GC_COPPER 0x100C
- +#define E1000_DEV_ID_82544GC_LOM 0x100D
- +#define E1000_DEV_ID_82540EM 0x100E
- +#define E1000_DEV_ID_82540EM_LOM 0x1015
- +#define E1000_DEV_ID_82540EP_LOM 0x1016
- +#define E1000_DEV_ID_82540EP 0x1017
- +#define E1000_DEV_ID_82540EP_LP 0x101E
- +#define E1000_DEV_ID_82545EM_COPPER 0x100F
- +#define E1000_DEV_ID_82545EM_FIBER 0x1011
- +#define E1000_DEV_ID_82545GM_COPPER 0x1026
- +#define E1000_DEV_ID_82545GM_FIBER 0x1027
- +#define E1000_DEV_ID_82545GM_SERDES 0x1028
- +#define E1000_DEV_ID_82546EB_COPPER 0x1010
- +#define E1000_DEV_ID_82546EB_FIBER 0x1012
- +#define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D
- +#define E1000_DEV_ID_82541EI 0x1013
- +#define E1000_DEV_ID_82541EI_MOBILE 0x1018
- +#define E1000_DEV_ID_82541ER 0x1078
- +#define E1000_DEV_ID_82547GI 0x1075
- +#define E1000_DEV_ID_82541GI 0x1076
- +#define E1000_DEV_ID_82541GI_MOBILE 0x1077
- +#define E1000_DEV_ID_82546GB_COPPER 0x1079
- +#define E1000_DEV_ID_82546GB_FIBER 0x107A
- +#define E1000_DEV_ID_82546GB_SERDES 0x107B
- +#define E1000_DEV_ID_82547EI 0x1019
- +
- +#define NODE_ADDRESS_SIZE 6
- +#define ETH_LENGTH_OF_ADDRESS 6
- +
- +/* MAC decode size is 128K - This is the size of BAR0 */
- +#define MAC_DECODE_SIZE (128 * 1024)
- +
- +#define E1000_82542_2_0_REV_ID 2
- +#define E1000_82542_2_1_REV_ID 3
- +
- +#define SPEED_10 10
- +#define SPEED_100 100
- +#define SPEED_1000 1000
- +#define HALF_DUPLEX 1
- +#define FULL_DUPLEX 2
- +
- +/* The sizes (in bytes) of a ethernet packet */
- +#define ENET_HEADER_SIZE 14
- +#define MAXIMUM_ETHERNET_FRAME_SIZE 1518 /* With FCS */
- +#define MINIMUM_ETHERNET_FRAME_SIZE 64 /* With FCS */
- +#define ETHERNET_FCS_SIZE 4
- +#define MAXIMUM_ETHERNET_PACKET_SIZE \
- + (MAXIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE)
- +#define MINIMUM_ETHERNET_PACKET_SIZE \
- + (MINIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE)
- +#define CRC_LENGTH ETHERNET_FCS_SIZE
- +#define MAX_JUMBO_FRAME_SIZE 0x3F00
- +
- +
- +/* 802.1q VLAN Packet Sizes */
- +#define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMAed) */
- +
- +/* Ethertype field values */
- +#define ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.3ac packet */
- +#define ETHERNET_IP_TYPE 0x0800 /* IP packets */
- +#define ETHERNET_ARP_TYPE 0x0806 /* Address Resolution Protocol (ARP) */
- +
- +/* Packet Header defines */
- +#define IP_PROTOCOL_TCP 6
- +#define IP_PROTOCOL_UDP 0x11
- +
- +/* This defines the bits that are set in the Interrupt Mask
- + * Set/Read Register. Each bit is documented below:
- + * o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0)
- + * o RXSEQ = Receive Sequence Error
- + */
- +#define POLL_IMS_ENABLE_MASK ( \
- + E1000_IMS_RXDMT0 | \
- + E1000_IMS_RXSEQ)
- +
- +/* This defines the bits that are set in the Interrupt Mask
- + * Set/Read Register. Each bit is documented below:
- + * o RXT0 = Receiver Timer Interrupt (ring 0)
- + * o TXDW = Transmit Descriptor Written Back
- + * o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0)
- + * o RXSEQ = Receive Sequence Error
- + * o LSC = Link Status Change
- + */
- +#define IMS_ENABLE_MASK ( \
- + E1000_IMS_RXT0 | \
- + E1000_IMS_TXDW | \
- + E1000_IMS_RXDMT0 | \
- + E1000_IMS_RXSEQ | \
- + E1000_IMS_LSC)
- +
- +/* Number of high/low register pairs in the RAR. The RAR (Receive Address
- + * Registers) holds the directed and multicast addresses that we monitor. We
- + * reserve one of these spots for our directed address, allowing us room for
- + * E1000_RAR_ENTRIES - 1 multicast addresses.
- + */
- +#define E1000_RAR_ENTRIES 15
- +
- +#define MIN_NUMBER_OF_DESCRIPTORS 8
- +#define MAX_NUMBER_OF_DESCRIPTORS 0xFFF8
- +
- +/* Receive Descriptor */
- +struct e1000_rx_desc {
- + uint64_t buffer_addr; /* Address of the descriptor's data buffer */
- + uint16_t length; /* Length of data DMAed into data buffer */
- + uint16_t csum; /* Packet checksum */
- + uint8_t status; /* Descriptor status */
- + uint8_t errors; /* Descriptor Errors */
- + uint16_t special;
- +};
- +
- +/* Receive Decriptor bit definitions */
- +#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */
- +#define E1000_RXD_STAT_EOP 0x02 /* End of Packet */
- +#define E1000_RXD_STAT_IXSM 0x04 /* Ignore checksum */
- +#define E1000_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */
- +#define E1000_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */
- +#define E1000_RXD_STAT_IPCS 0x40 /* IP xsum calculated */
- +#define E1000_RXD_STAT_PIF 0x80 /* passed in-exact filter */
- +#define E1000_RXD_ERR_CE 0x01 /* CRC Error */
- +#define E1000_RXD_ERR_SE 0x02 /* Symbol Error */
- +#define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */
- +#define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */
- +#define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */
- +#define E1000_RXD_ERR_IPE 0x40 /* IP Checksum Error */
- +#define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */
- +#define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */
- +#define E1000_RXD_SPC_PRI_MASK 0xE000 /* Priority is in upper 3 bits */
- +#define E1000_RXD_SPC_PRI_SHIFT 0x000D /* Priority is in upper 3 of 16 */
- +#define E1000_RXD_SPC_CFI_MASK 0x1000 /* CFI is bit 12 */
- +#define E1000_RXD_SPC_CFI_SHIFT 0x000C /* CFI is bit 12 */
- +
- +/* mask to determine if packets should be dropped due to frame errors */
- +#define E1000_RXD_ERR_FRAME_ERR_MASK ( \
- + E1000_RXD_ERR_CE | \
- + E1000_RXD_ERR_SE | \
- + E1000_RXD_ERR_SEQ | \
- + E1000_RXD_ERR_CXE | \
- + E1000_RXD_ERR_RXE)
- +
- +/* Transmit Descriptor */
- +struct e1000_tx_desc {
- + uint64_t buffer_addr; /* Address of the descriptor's data buffer */
- + union {
- + uint32_t data;
- + struct {
- + uint16_t length; /* Data buffer length */
- + uint8_t cso; /* Checksum offset */
- + uint8_t cmd; /* Descriptor control */
- + } flags;
- + } lower;
- + union {
- + uint32_t data;
- + struct {
- + uint8_t status; /* Descriptor status */
- + uint8_t css; /* Checksum start */
- + uint16_t special;
- + } fields;
- + } upper;
- +};
- +
- +/* Transmit Descriptor bit definitions */
- +#define E1000_TXD_DTYP_D 0x00100000 /* Data Descriptor */
- +#define E1000_TXD_DTYP_C 0x00000000 /* Context Descriptor */
- +#define E1000_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */
- +#define E1000_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */
- +#define E1000_TXD_CMD_EOP 0x01000000 /* End of Packet */
- +#define E1000_TXD_CMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */
- +#define E1000_TXD_CMD_IC 0x04000000 /* Insert Checksum */
- +#define E1000_TXD_CMD_RS 0x08000000 /* Report Status */
- +#define E1000_TXD_CMD_RPS 0x10000000 /* Report Packet Sent */
- +#define E1000_TXD_CMD_DEXT 0x20000000 /* Descriptor extension (0 = legacy) */
- +#define E1000_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */
- +#define E1000_TXD_CMD_IDE 0x80000000 /* Enable Tidv register */
- +#define E1000_TXD_STAT_DD 0x00000001 /* Descriptor Done */
- +#define E1000_TXD_STAT_EC 0x00000002 /* Excess Collisions */
- +#define E1000_TXD_STAT_LC 0x00000004 /* Late Collisions */
- +#define E1000_TXD_STAT_TU 0x00000008 /* Transmit underrun */
- +#define E1000_TXD_CMD_TCP 0x01000000 /* TCP packet */
- +#define E1000_TXD_CMD_IP 0x02000000 /* IP packet */
- +#define E1000_TXD_CMD_TSE 0x04000000 /* TCP Seg enable */
- +#define E1000_TXD_STAT_TC 0x00000004 /* Tx Underrun */
- +
- +/* Offload Context Descriptor */
- +struct e1000_context_desc {
- + union {
- + uint32_t ip_config;
- + struct {
- + uint8_t ipcss; /* IP checksum start */
- + uint8_t ipcso; /* IP checksum offset */
- + uint16_t ipcse; /* IP checksum end */
- + } ip_fields;
- + } lower_setup;
- + union {
- + uint32_t tcp_config;
- + struct {
- + uint8_t tucss; /* TCP checksum start */
- + uint8_t tucso; /* TCP checksum offset */
- + uint16_t tucse; /* TCP checksum end */
- + } tcp_fields;
- + } upper_setup;
- + uint32_t cmd_and_length; /* */
- + union {
- + uint32_t data;
- + struct {
- + uint8_t status; /* Descriptor status */
- + uint8_t hdr_len; /* Header length */
- + uint16_t mss; /* Maximum segment size */
- + } fields;
- + } tcp_seg_setup;
- +};
- +
- +/* Offload data descriptor */
- +struct e1000_data_desc {
- + uint64_t buffer_addr; /* Address of the descriptor's buffer address */
- + union {
- + uint32_t data;
- + struct {
- + uint16_t length; /* Data buffer length */
- + uint8_t typ_len_ext; /* */
- + uint8_t cmd; /* */
- + } flags;
- + } lower;
- + union {
- + uint32_t data;
- + struct {
- + uint8_t status; /* Descriptor status */
- + uint8_t popts; /* Packet Options */
- + uint16_t special; /* */
- + } fields;
- + } upper;
- +};
- +
- +/* Filters */
- +#define E1000_NUM_UNICAST 16 /* Unicast filter entries */
- +#define E1000_MC_TBL_SIZE 128 /* Multicast Filter Table (4096 bits) */
- +#define E1000_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */
- +
- +
- +/* Receive Address Register */
- +struct e1000_rar {
- + volatile uint32_t low; /* receive address low */
- + volatile uint32_t high; /* receive address high */
- +};
- +
- +/* Number of entries in the Multicast Table Array (MTA). */
- +#define E1000_NUM_MTA_REGISTERS 128
- +
- +/* IPv4 Address Table Entry */
- +struct e1000_ipv4_at_entry {
- + volatile uint32_t ipv4_addr; /* IP Address (RW) */
- + volatile uint32_t reserved;
- +};
- +
- +/* Four wakeup IP addresses are supported */
- +#define E1000_WAKEUP_IP_ADDRESS_COUNT_MAX 4
- +#define E1000_IP4AT_SIZE E1000_WAKEUP_IP_ADDRESS_COUNT_MAX
- +#define E1000_IP6AT_SIZE 1
- +
- +/* IPv6 Address Table Entry */
- +struct e1000_ipv6_at_entry {
- + volatile uint8_t ipv6_addr[16];
- +};
- +
- +/* Flexible Filter Length Table Entry */
- +struct e1000_fflt_entry {
- + volatile uint32_t length; /* Flexible Filter Length (RW) */
- + volatile uint32_t reserved;
- +};
- +
- +/* Flexible Filter Mask Table Entry */
- +struct e1000_ffmt_entry {
- + volatile uint32_t mask; /* Flexible Filter Mask (RW) */
- + volatile uint32_t reserved;
- +};
- +
- +/* Flexible Filter Value Table Entry */
- +struct e1000_ffvt_entry {
- + volatile uint32_t value; /* Flexible Filter Value (RW) */
- + volatile uint32_t reserved;
- +};
- +
- +/* Four Flexible Filters are supported */
- +#define E1000_FLEXIBLE_FILTER_COUNT_MAX 4
- +
- +/* Each Flexible Filter is at most 128 (0x80) bytes in length */
- +#define E1000_FLEXIBLE_FILTER_SIZE_MAX 128
- +
- +#define E1000_FFLT_SIZE E1000_FLEXIBLE_FILTER_COUNT_MAX
- +#define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX
- +#define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX
- +
- +/* Register Set. (82543, 82544)
- + *
- + * Registers are defined to be 32 bits and should be accessed as 32 bit values.
- + * These registers are physically located on the NIC, but are mapped into the
- + * host memory address space.
- + *
- + * RW - register is both readable and writable
- + * RO - register is read only
- + * WO - register is write only
- + * R/clr - register is read only and is cleared when read
- + * A - register array
- + */
- +#define E1000_CTRL 0x00000 /* Device Control - RW */
- +#define E1000_CTRL_DUP 0x00004 /* Device Control Duplicate (Shadow) - RW */
- +#define E1000_STATUS 0x00008 /* Device Status - RO */
- +#define E1000_EECD 0x00010 /* EEPROM/Flash Control - RW */
- +#define E1000_EERD 0x00014 /* EEPROM Read - RW */
- +#define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */
- +#define E1000_FLA 0x0001C /* Flash Access - RW */
- +#define E1000_MDIC 0x00020 /* MDI Control - RW */
- +#define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */
- +#define E1000_FCAH 0x0002C /* Flow Control Address High -RW */
- +#define E1000_FCT 0x00030 /* Flow Control Type - RW */
- +#define E1000_VET 0x00038 /* VLAN Ether Type - RW */
- +#define E1000_ICR 0x000C0 /* Interrupt Cause Read - R/clr */
- +#define E1000_ITR 0x000C4 /* Interrupt Throttling Rate - RW */
- +#define E1000_ICS 0x000C8 /* Interrupt Cause Set - WO */
- +#define E1000_IMS 0x000D0 /* Interrupt Mask Set - RW */
- +#define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */
- +#define E1000_RCTL 0x00100 /* RX Control - RW */
- +#define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */
- +#define E1000_TXCW 0x00178 /* TX Configuration Word - RW */
- +#define E1000_RXCW 0x00180 /* RX Configuration Word - RO */
- +#define E1000_TCTL 0x00400 /* TX Control - RW */
- +#define E1000_TIPG 0x00410 /* TX Inter-packet gap -RW */
- +#define E1000_TBT 0x00448 /* TX Burst Timer - RW */
- +#define E1000_AIT 0x00458 /* Adaptive Interframe Spacing Throttle - RW */
- +#define E1000_LEDCTL 0x00E00 /* LED Control - RW */
- +#define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */
- +#define E1000_FCRTL 0x02160 /* Flow Control Receive Threshold Low - RW */
- +#define E1000_FCRTH 0x02168 /* Flow Control Receive Threshold High - RW */
- +#define E1000_RDBAL 0x02800 /* RX Descriptor Base Address Low - RW */
- +#define E1000_RDBAH 0x02804 /* RX Descriptor Base Address High - RW */
- +#define E1000_RDLEN 0x02808 /* RX Descriptor Length - RW */
- +#define E1000_RDH 0x02810 /* RX Descriptor Head - RW */
- +#define E1000_RDT 0x02818 /* RX Descriptor Tail - RW */
- +#define E1000_RDTR 0x02820 /* RX Delay Timer - RW */
- +#define E1000_RXDCTL 0x02828 /* RX Descriptor Control - RW */
- +#define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */
- +#define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */
- +#define E1000_TXDMAC 0x03000 /* TX DMA Control - RW */
- +#define E1000_TDFH 0x03410 /* TX Data FIFO Head - RW */
- +#define E1000_TDFT 0x03418 /* TX Data FIFO Tail - RW */
- +#define E1000_TDFHS 0x03420 /* TX Data FIFO Head Saved - RW */
- +#define E1000_TDFTS 0x03428 /* TX Data FIFO Tail Saved - RW */
- +#define E1000_TDFPC 0x03430 /* TX Data FIFO Packet Count - RW */
- +#define E1000_TDBAL 0x03800 /* TX Descriptor Base Address Low - RW */
- +#define E1000_TDBAH 0x03804 /* TX Descriptor Base Address High - RW */
- +#define E1000_TDLEN 0x03808 /* TX Descriptor Length - RW */
- +#define E1000_TDH 0x03810 /* TX Descriptor Head - RW */
- +#define E1000_TDT 0x03818 /* TX Descripotr Tail - RW */
- +#define E1000_TIDV 0x03820 /* TX Interrupt Delay Value - RW */
- +#define E1000_TXDCTL 0x03828 /* TX Descriptor Control - RW */
- +#define E1000_TADV 0x0382C /* TX Interrupt Absolute Delay Val - RW */
- +#define E1000_TSPMT 0x03830 /* TCP Segmentation PAD & Min Threshold - RW */
- +#define E1000_CRCERRS 0x04000 /* CRC Error Count - R/clr */
- +#define E1000_ALGNERRC 0x04004 /* Alignment Error Count - R/clr */
- +#define E1000_SYMERRS 0x04008 /* Symbol Error Count - R/clr */
- +#define E1000_RXERRC 0x0400C /* Receive Error Count - R/clr */
- +#define E1000_MPC 0x04010 /* Missed Packet Count - R/clr */
- +#define E1000_SCC 0x04014 /* Single Collision Count - R/clr */
- +#define E1000_ECOL 0x04018 /* Excessive Collision Count - R/clr */
- +#define E1000_MCC 0x0401C /* Multiple Collision Count - R/clr */
- +#define E1000_LATECOL 0x04020 /* Late Collision Count - R/clr */
- +#define E1000_COLC 0x04028 /* Collision Count - R/clr */
- +#define E1000_DC 0x04030 /* Defer Count - R/clr */
- +#define E1000_TNCRS 0x04034 /* TX-No CRS - R/clr */
- +#define E1000_SEC 0x04038 /* Sequence Error Count - R/clr */
- +#define E1000_CEXTERR 0x0403C /* Carrier Extension Error Count - R/clr */
- +#define E1000_RLEC 0x04040 /* Receive Length Error Count - R/clr */
- +#define E1000_XONRXC 0x04048 /* XON RX Count - R/clr */
- +#define E1000_XONTXC 0x0404C /* XON TX Count - R/clr */
- +#define E1000_XOFFRXC 0x04050 /* XOFF RX Count - R/clr */
- +#define E1000_XOFFTXC 0x04054 /* XOFF TX Count - R/clr */
- +#define E1000_FCRUC 0x04058 /* Flow Control RX Unsupported Count- R/clr */
- +#define E1000_PRC64 0x0405C /* Packets RX (64 bytes) - R/clr */
- +#define E1000_PRC127 0x04060 /* Packets RX (65-127 bytes) - R/clr */
- +#define E1000_PRC255 0x04064 /* Packets RX (128-255 bytes) - R/clr */
- +#define E1000_PRC511 0x04068 /* Packets RX (255-511 bytes) - R/clr */
- +#define E1000_PRC1023 0x0406C /* Packets RX (512-1023 bytes) - R/clr */
- +#define E1000_PRC1522 0x04070 /* Packets RX (1024-1522 bytes) - R/clr */
- +#define E1000_GPRC 0x04074 /* Good Packets RX Count - R/clr */
- +#define E1000_BPRC 0x04078 /* Broadcast Packets RX Count - R/clr */
- +#define E1000_MPRC 0x0407C /* Multicast Packets RX Count - R/clr */
- +#define E1000_GPTC 0x04080 /* Good Packets TX Count - R/clr */
- +#define E1000_GORCL 0x04088 /* Good Octets RX Count Low - R/clr */
- +#define E1000_GORCH 0x0408C /* Good Octets RX Count High - R/clr */
- +#define E1000_GOTCL 0x04090 /* Good Octets TX Count Low - R/clr */
- +#define E1000_GOTCH 0x04094 /* Good Octets TX Count High - R/clr */
- +#define E1000_RNBC 0x040A0 /* RX No Buffers Count - R/clr */
- +#define E1000_RUC 0x040A4 /* RX Undersize Count - R/clr */
- +#define E1000_RFC 0x040A8 /* RX Fragment Count - R/clr */
- +#define E1000_ROC 0x040AC /* RX Oversize Count - R/clr */
- +#define E1000_RJC 0x040B0 /* RX Jabber Count - R/clr */
- +#define E1000_MGTPRC 0x040B4 /* Management Packets RX Count - R/clr */
- +#define E1000_MGTPDC 0x040B8 /* Management Packets Dropped Count - R/clr */
- +#define E1000_MGTPTC 0x040BC /* Management Packets TX Count - R/clr */
- +#define E1000_TORL 0x040C0 /* Total Octets RX Low - R/clr */
- +#define E1000_TORH 0x040C4 /* Total Octets RX High - R/clr */
- +#define E1000_TOTL 0x040C8 /* Total Octets TX Low - R/clr */
- +#define E1000_TOTH 0x040CC /* Total Octets TX High - R/clr */
- +#define E1000_TPR 0x040D0 /* Total Packets RX - R/clr */
- +#define E1000_TPT 0x040D4 /* Total Packets TX - R/clr */
- +#define E1000_PTC64 0x040D8 /* Packets TX (64 bytes) - R/clr */
- +#define E1000_PTC127 0x040DC /* Packets TX (65-127 bytes) - R/clr */
- +#define E1000_PTC255 0x040E0 /* Packets TX (128-255 bytes) - R/clr */
- +#define E1000_PTC511 0x040E4 /* Packets TX (256-511 bytes) - R/clr */
- +#define E1000_PTC1023 0x040E8 /* Packets TX (512-1023 bytes) - R/clr */
- +#define E1000_PTC1522 0x040EC /* Packets TX (1024-1522 Bytes) - R/clr */
- +#define E1000_MPTC 0x040F0 /* Multicast Packets TX Count - R/clr */
- +#define E1000_BPTC 0x040F4 /* Broadcast Packets TX Count - R/clr */
- +#define E1000_TSCTC 0x040F8 /* TCP Segmentation Context TX - R/clr */
- +#define E1000_TSCTFC 0x040FC /* TCP Segmentation Context TX Fail - R/clr */
- +#define E1000_RXCSUM 0x05000 /* RX Checksum Control - RW */
- +#define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */
- +#define E1000_RA 0x05400 /* Receive Address - RW Array */
- +#define E1000_VFTA 0x05600 /* VLAN Filter Table Array - RW Array */
- +#define E1000_WUC 0x05800 /* Wakeup Control - RW */
- +#define E1000_WUFC 0x05808 /* Wakeup Filter Control - RW */
- +#define E1000_WUS 0x05810 /* Wakeup Status - RO */
- +#define E1000_MANC 0x05820 /* Management Control - RW */
- +#define E1000_IPAV 0x05838 /* IP Address Valid - RW */
- +#define E1000_IP4AT 0x05840 /* IPv4 Address Table - RW Array */
- +#define E1000_IP6AT 0x05880 /* IPv6 Address Table - RW Array */
- +#define E1000_WUPL 0x05900 /* Wakeup Packet Length - RW */
- +#define E1000_WUPM 0x05A00 /* Wakeup Packet Memory - RO A */
- +#define E1000_FFLT 0x05F00 /* Flexible Filter Length Table - RW Array */
- +#define E1000_FFMT 0x09000 /* Flexible Filter Mask Table - RW Array */
- +#define E1000_FFVT 0x09800 /* Flexible Filter Value Table - RW Array */
- +
- +/* Register Set (82542)
- + *
- + * Some of the 82542 registers are located at different offsets than they are
- + * in more current versions of the 8254x. Despite the difference in location,
- + * the registers function in the same manner.
- + */
- +#define E1000_82542_CTRL E1000_CTRL
- +#define E1000_82542_CTRL_DUP E1000_CTRL_DUP
- +#define E1000_82542_STATUS E1000_STATUS
- +#define E1000_82542_EECD E1000_EECD
- +#define E1000_82542_EERD E1000_EERD
- +#define E1000_82542_CTRL_EXT E1000_CTRL_EXT
- +#define E1000_82542_FLA E1000_FLA
- +#define E1000_82542_MDIC E1000_MDIC
- +#define E1000_82542_FCAL E1000_FCAL
- +#define E1000_82542_FCAH E1000_FCAH
- +#define E1000_82542_FCT E1000_FCT
- +#define E1000_82542_VET E1000_VET
- +#define E1000_82542_RA 0x00040
- +#define E1000_82542_ICR E1000_ICR
- +#define E1000_82542_ITR E1000_ITR
- +#define E1000_82542_ICS E1000_ICS
- +#define E1000_82542_IMS E1000_IMS
- +#define E1000_82542_IMC E1000_IMC
- +#define E1000_82542_RCTL E1000_RCTL
- +#define E1000_82542_RDTR 0x00108
- +#define E1000_82542_RDBAL 0x00110
- +#define E1000_82542_RDBAH 0x00114
- +#define E1000_82542_RDLEN 0x00118
- +#define E1000_82542_RDH 0x00120
- +#define E1000_82542_RDT 0x00128
- +#define E1000_82542_FCRTH 0x00160
- +#define E1000_82542_FCRTL 0x00168
- +#define E1000_82542_FCTTV E1000_FCTTV
- +#define E1000_82542_TXCW E1000_TXCW
- +#define E1000_82542_RXCW E1000_RXCW
- +#define E1000_82542_MTA 0x00200
- +#define E1000_82542_TCTL E1000_TCTL
- +#define E1000_82542_TIPG E1000_TIPG
- +#define E1000_82542_TDBAL 0x00420
- +#define E1000_82542_TDBAH 0x00424
- +#define E1000_82542_TDLEN 0x00428
- +#define E1000_82542_TDH 0x00430
- +#define E1000_82542_TDT 0x00438
- +#define E1000_82542_TIDV 0x00440
- +#define E1000_82542_TBT E1000_TBT
- +#define E1000_82542_AIT E1000_AIT
- +#define E1000_82542_VFTA 0x00600
- +#define E1000_82542_LEDCTL E1000_LEDCTL
- +#define E1000_82542_PBA E1000_PBA
- +#define E1000_82542_RXDCTL E1000_RXDCTL
- +#define E1000_82542_RADV E1000_RADV
- +#define E1000_82542_RSRPD E1000_RSRPD
- +#define E1000_82542_TXDMAC E1000_TXDMAC
- +#define E1000_82542_TDFHS E1000_TDFHS
- +#define E1000_82542_TDFTS E1000_TDFTS
- +#define E1000_82542_TDFPC E1000_TDFPC
- +#define E1000_82542_TXDCTL E1000_TXDCTL
- +#define E1000_82542_TADV E1000_TADV
- +#define E1000_82542_TSPMT E1000_TSPMT
- +#define E1000_82542_CRCERRS E1000_CRCERRS
- +#define E1000_82542_ALGNERRC E1000_ALGNERRC
- +#define E1000_82542_SYMERRS E1000_SYMERRS
- +#define E1000_82542_RXERRC E1000_RXERRC
- +#define E1000_82542_MPC E1000_MPC
- +#define E1000_82542_SCC E1000_SCC
- +#define E1000_82542_ECOL E1000_ECOL
- +#define E1000_82542_MCC E1000_MCC
- +#define E1000_82542_LATECOL E1000_LATECOL
- +#define E1000_82542_COLC E1000_COLC
- +#define E1000_82542_DC E1000_DC
- +#define E1000_82542_TNCRS E1000_TNCRS
- +#define E1000_82542_SEC E1000_SEC
- +#define E1000_82542_CEXTERR E1000_CEXTERR
- +#define E1000_82542_RLEC E1000_RLEC
- +#define E1000_82542_XONRXC E1000_XONRXC
- +#define E1000_82542_XONTXC E1000_XONTXC
- +#define E1000_82542_XOFFRXC E1000_XOFFRXC
- +#define E1000_82542_XOFFTXC E1000_XOFFTXC
- +#define E1000_82542_FCRUC E1000_FCRUC
- +#define E1000_82542_PRC64 E1000_PRC64
- +#define E1000_82542_PRC127 E1000_PRC127
- +#define E1000_82542_PRC255 E1000_PRC255
- +#define E1000_82542_PRC511 E1000_PRC511
- +#define E1000_82542_PRC1023 E1000_PRC1023
- +#define E1000_82542_PRC1522 E1000_PRC1522
- +#define E1000_82542_GPRC E1000_GPRC
- +#define E1000_82542_BPRC E1000_BPRC
- +#define E1000_82542_MPRC E1000_MPRC
- +#define E1000_82542_GPTC E1000_GPTC
- +#define E1000_82542_GORCL E1000_GORCL
- +#define E1000_82542_GORCH E1000_GORCH
- +#define E1000_82542_GOTCL E1000_GOTCL
- +#define E1000_82542_GOTCH E1000_GOTCH
- +#define E1000_82542_RNBC E1000_RNBC
- +#define E1000_82542_RUC E1000_RUC
- +#define E1000_82542_RFC E1000_RFC
- +#define E1000_82542_ROC E1000_ROC
- +#define E1000_82542_RJC E1000_RJC
- +#define E1000_82542_MGTPRC E1000_MGTPRC
- +#define E1000_82542_MGTPDC E1000_MGTPDC
- +#define E1000_82542_MGTPTC E1000_MGTPTC
- +#define E1000_82542_TORL E1000_TORL
- +#define E1000_82542_TORH E1000_TORH
- +#define E1000_82542_TOTL E1000_TOTL
- +#define E1000_82542_TOTH E1000_TOTH
- +#define E1000_82542_TPR E1000_TPR
- +#define E1000_82542_TPT E1000_TPT
- +#define E1000_82542_PTC64 E1000_PTC64
- +#define E1000_82542_PTC127 E1000_PTC127
- +#define E1000_82542_PTC255 E1000_PTC255
- +#define E1000_82542_PTC511 E1000_PTC511
- +#define E1000_82542_PTC1023 E1000_PTC1023
- +#define E1000_82542_PTC1522 E1000_PTC1522
- +#define E1000_82542_MPTC E1000_MPTC
- +#define E1000_82542_BPTC E1000_BPTC
- +#define E1000_82542_TSCTC E1000_TSCTC
- +#define E1000_82542_TSCTFC E1000_TSCTFC
- +#define E1000_82542_RXCSUM E1000_RXCSUM
- +#define E1000_82542_WUC E1000_WUC
- +#define E1000_82542_WUFC E1000_WUFC
- +#define E1000_82542_WUS E1000_WUS
- +#define E1000_82542_MANC E1000_MANC
- +#define E1000_82542_IPAV E1000_IPAV
- +#define E1000_82542_IP4AT E1000_IP4AT
- +#define E1000_82542_IP6AT E1000_IP6AT
- +#define E1000_82542_WUPL E1000_WUPL
- +#define E1000_82542_WUPM E1000_WUPM
- +#define E1000_82542_FFLT E1000_FFLT
- +#define E1000_82542_TDFH 0x08010
- +#define E1000_82542_TDFT 0x08018
- +#define E1000_82542_FFMT E1000_FFMT
- +#define E1000_82542_FFVT E1000_FFVT
- +
- +/* Statistics counters collected by the MAC */
- +struct e1000_hw_stats {
- + uint64_t crcerrs;
- + uint64_t algnerrc;
- + uint64_t symerrs;
- + uint64_t rxerrc;
- + uint64_t mpc;
- + uint64_t scc;
- + uint64_t ecol;
- + uint64_t mcc;
- + uint64_t latecol;
- + uint64_t colc;
- + uint64_t dc;
- + uint64_t tncrs;
- + uint64_t sec;
- + uint64_t cexterr;
- + uint64_t rlec;
- + uint64_t xonrxc;
- + uint64_t xontxc;
- + uint64_t xoffrxc;
- + uint64_t xofftxc;
- + uint64_t fcruc;
- + uint64_t prc64;
- + uint64_t prc127;
- + uint64_t prc255;
- + uint64_t prc511;
- + uint64_t prc1023;
- + uint64_t prc1522;
- + uint64_t gprc;
- + uint64_t bprc;
- + uint64_t mprc;
- + uint64_t gptc;
- + uint64_t gorcl;
- + uint64_t gorch;
- + uint64_t gotcl;
- + uint64_t gotch;
- + uint64_t rnbc;
- + uint64_t ruc;
- + uint64_t rfc;
- + uint64_t roc;
- + uint64_t rjc;
- + uint64_t mgprc;
- + uint64_t mgpdc;
- + uint64_t mgptc;
- + uint64_t torl;
- + uint64_t torh;
- + uint64_t totl;
- + uint64_t toth;
- + uint64_t tpr;
- + uint64_t tpt;
- + uint64_t ptc64;
- + uint64_t ptc127;
- + uint64_t ptc255;
- + uint64_t ptc511;
- + uint64_t ptc1023;
- + uint64_t ptc1522;
- + uint64_t mptc;
- + uint64_t bptc;
- + uint64_t tsctc;
- + uint64_t tsctfc;
- +};
- +
- +/* Structure containing variables used by the shared code (e1000_hw.c) */
- +struct e1000_hw {
- + struct pci_device *pdev;
- + uint8_t *hw_addr;
- + e1000_mac_type mac_type;
- + e1000_phy_type phy_type;
- +#if 0
- + uint32_t phy_init_script;
- +#endif
- + e1000_media_type media_type;
- + e1000_fc_type fc;
- +#if 0
- + e1000_bus_speed bus_speed;
- + e1000_bus_width bus_width;
- + e1000_bus_type bus_type;
- +#endif
- + struct e1000_eeprom_info eeprom;
- +#if 0
- + e1000_ms_type master_slave;
- + e1000_ms_type original_master_slave;
- + e1000_ffe_config ffe_config_state;
- +#endif
- + uint32_t io_base;
- + uint32_t phy_id;
- +#ifdef LINUX_DRIVER
- + uint32_t phy_revision;
- +#endif
- + uint32_t phy_addr;
- +#if 0
- + uint32_t original_fc;
- +#endif
- + uint32_t txcw;
- + uint32_t autoneg_failed;
- +#if 0
- + uint32_t max_frame_size;
- + uint32_t min_frame_size;
- + uint32_t mc_filter_type;
- + uint32_t num_mc_addrs;
- + uint32_t collision_delta;
- + uint32_t tx_packet_delta;
- + uint32_t ledctl_default;
- + uint32_t ledctl_mode1;
- + uint32_t ledctl_mode2;
- + uint16_t phy_spd_default;
- +#endif
- + uint16_t autoneg_advertised;
- + uint16_t pci_cmd_word;
- +#if 0
- + uint16_t fc_high_water;
- + uint16_t fc_low_water;
- + uint16_t fc_pause_time;
- + uint16_t current_ifs_val;
- + uint16_t ifs_min_val;
- + uint16_t ifs_max_val;
- + uint16_t ifs_step_size;
- + uint16_t ifs_ratio;
- +#endif
- + uint16_t device_id;
- + uint16_t vendor_id;
- +#if 0
- + uint16_t subsystem_id;
- + uint16_t subsystem_vendor_id;
- +#endif
- + uint8_t revision_id;
- +#if 0
- + uint8_t autoneg;
- + uint8_t mdix;
- + uint8_t forced_speed_duplex;
- + uint8_t wait_autoneg_complete;
- + uint8_t dma_fairness;
- +#endif
- + uint8_t mac_addr[NODE_ADDRESS_SIZE];
- +#if 0
- + uint8_t perm_mac_addr[NODE_ADDRESS_SIZE];
- + boolean_t disable_polarity_correction;
- + boolean_t speed_downgraded;
- + e1000_dsp_config dsp_config_state;
- + boolean_t get_link_status;
- + boolean_t serdes_link_down;
- +#endif
- + boolean_t tbi_compatibility_en;
- + boolean_t tbi_compatibility_on;
- +#if 0
- + boolean_t phy_reset_disable;
- + boolean_t fc_send_xon;
- + boolean_t fc_strict_ieee;
- + boolean_t report_tx_early;
- + boolean_t adaptive_ifs;
- + boolean_t ifs_params_forced;
- + boolean_t in_ifs_mode;
- +#endif
- +};
- +
- +
- +#define E1000_EEPROM_SWDPIN0 0x0001 /* SWDPIN 0 EEPROM Value */
- +#define E1000_EEPROM_LED_LOGIC 0x0020 /* Led Logic Word */
- +
- +/* Register Bit Masks */
- +/* Device Control */
- +#define E1000_CTRL_FD 0x00000001 /* Full duplex.0=half; 1=full */
- +#define E1000_CTRL_BEM 0x00000002 /* Endian Mode.0=little,1=big */
- +#define E1000_CTRL_PRIOR 0x00000004 /* Priority on PCI. 0=rx,1=fair */
- +#define E1000_CTRL_LRST 0x00000008 /* Link reset. 0=normal,1=reset */
- +#define E1000_CTRL_TME 0x00000010 /* Test mode. 0=normal,1=test */
- +#define E1000_CTRL_SLE 0x00000020 /* Serial Link on 0=dis,1=en */
- +#define E1000_CTRL_ASDE 0x00000020 /* Auto-speed detect enable */
- +#define E1000_CTRL_SLU 0x00000040 /* Set link up (Force Link) */
- +#define E1000_CTRL_ILOS 0x00000080 /* Invert Loss-Of Signal */
- +#define E1000_CTRL_SPD_SEL 0x00000300 /* Speed Select Mask */
- +#define E1000_CTRL_SPD_10 0x00000000 /* Force 10Mb */
- +#define E1000_CTRL_SPD_100 0x00000100 /* Force 100Mb */
- +#define E1000_CTRL_SPD_1000 0x00000200 /* Force 1Gb */
- +#define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */
- +#define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */
- +#define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */
- +#define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */
- +#define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */
- +#define E1000_CTRL_SWDPIN2 0x00100000 /* SWDPIN 2 value */
- +#define E1000_CTRL_SWDPIN3 0x00200000 /* SWDPIN 3 value */
- +#define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */
- +#define E1000_CTRL_SWDPIO1 0x00800000 /* SWDPIN 1 input or output */
- +#define E1000_CTRL_SWDPIO2 0x01000000 /* SWDPIN 2 input or output */
- +#define E1000_CTRL_SWDPIO3 0x02000000 /* SWDPIN 3 input or output */
- +#define E1000_CTRL_RST 0x04000000 /* Global reset */
- +#define E1000_CTRL_RFCE 0x08000000 /* Receive Flow Control enable */
- +#define E1000_CTRL_TFCE 0x10000000 /* Transmit flow control enable */
- +#define E1000_CTRL_RTE 0x20000000 /* Routing tag enable */
- +#define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */
- +#define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */
- +
- +/* Device Status */
- +#define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */
- +#define E1000_STATUS_LU 0x00000002 /* Link up.0=no,1=link */
- +#define E1000_STATUS_FUNC_MASK 0x0000000C /* PCI Function Mask */
- +#define E1000_STATUS_FUNC_0 0x00000000 /* Function 0 */
- +#define E1000_STATUS_FUNC_1 0x00000004 /* Function 1 */
- +#define E1000_STATUS_TXOFF 0x00000010 /* transmission paused */
- +#define E1000_STATUS_TBIMODE 0x00000020 /* TBI mode */
- +#define E1000_STATUS_SPEED_MASK 0x000000C0
- +#define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */
- +#define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */
- +#define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */
- +#define E1000_STATUS_ASDV 0x00000300 /* Auto speed detect value */
- +#define E1000_STATUS_MTXCKOK 0x00000400 /* MTX clock running OK */
- +#define E1000_STATUS_PCI66 0x00000800 /* In 66Mhz slot */
- +#define E1000_STATUS_BUS64 0x00001000 /* In 64 bit slot */
- +#define E1000_STATUS_PCIX_MODE 0x00002000 /* PCI-X mode */
- +#define E1000_STATUS_PCIX_SPEED 0x0000C000 /* PCI-X bus speed */
- +
- +/* Constants used to intrepret the masked PCI-X bus speed. */
- +#define E1000_STATUS_PCIX_SPEED_66 0x00000000 /* PCI-X bus speed 50-66 MHz */
- +#define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus speed 66-100 MHz */
- +#define E1000_STATUS_PCIX_SPEED_133 0x00008000 /* PCI-X bus speed 100-133 MHz */
- +
- +/* EEPROM/Flash Control */
- +#define E1000_EECD_SK 0x00000001 /* EEPROM Clock */
- +#define E1000_EECD_CS 0x00000002 /* EEPROM Chip Select */
- +#define E1000_EECD_DI 0x00000004 /* EEPROM Data In */
- +#define E1000_EECD_DO 0x00000008 /* EEPROM Data Out */
- +#define E1000_EECD_FWE_MASK 0x00000030
- +#define E1000_EECD_FWE_DIS 0x00000010 /* Disable FLASH writes */
- +#define E1000_EECD_FWE_EN 0x00000020 /* Enable FLASH writes */
- +#define E1000_EECD_FWE_SHIFT 4
- +#define E1000_EECD_REQ 0x00000040 /* EEPROM Access Request */
- +#define E1000_EECD_GNT 0x00000080 /* EEPROM Access Grant */
- +#define E1000_EECD_PRES 0x00000100 /* EEPROM Present */
- +#define E1000_EECD_SIZE 0x00000200 /* EEPROM Size (0=64 word 1=256 word) */
- +#define E1000_EECD_ADDR_BITS 0x00000400 /* EEPROM Addressing bits based on type
- + * (0-small, 1-large) */
- +#define E1000_EECD_TYPE 0x00002000 /* EEPROM Type (1-SPI, 0-Microwire) */
- +#ifndef E1000_EEPROM_GRANT_ATTEMPTS
- +#define E1000_EEPROM_GRANT_ATTEMPTS 1000 /* EEPROM # attempts to gain grant */
- +#endif
- +
- +/* EEPROM Read */
- +#define E1000_EERD_START 0x00000001 /* Start Read */
- +#define E1000_EERD_DONE 0x00000010 /* Read Done */
- +#define E1000_EERD_ADDR_SHIFT 8
- +#define E1000_EERD_ADDR_MASK 0x0000FF00 /* Read Address */
- +#define E1000_EERD_DATA_SHIFT 16
- +#define E1000_EERD_DATA_MASK 0xFFFF0000 /* Read Data */
- +
- +/* SPI EEPROM Status Register */
- +#define EEPROM_STATUS_RDY_SPI 0x01
- +#define EEPROM_STATUS_WEN_SPI 0x02
- +#define EEPROM_STATUS_BP0_SPI 0x04
- +#define EEPROM_STATUS_BP1_SPI 0x08
- +#define EEPROM_STATUS_WPEN_SPI 0x80
- +
- +/* Extended Device Control */
- +#define E1000_CTRL_EXT_GPI0_EN 0x00000001 /* Maps SDP4 to GPI0 */
- +#define E1000_CTRL_EXT_GPI1_EN 0x00000002 /* Maps SDP5 to GPI1 */
- +#define E1000_CTRL_EXT_PHYINT_EN E1000_CTRL_EXT_GPI1_EN
- +#define E1000_CTRL_EXT_GPI2_EN 0x00000004 /* Maps SDP6 to GPI2 */
- +#define E1000_CTRL_EXT_GPI3_EN 0x00000008 /* Maps SDP7 to GPI3 */
- +#define E1000_CTRL_EXT_SDP4_DATA 0x00000010 /* Value of SW Defineable Pin 4 */
- +#define E1000_CTRL_EXT_SDP5_DATA 0x00000020 /* Value of SW Defineable Pin 5 */
- +#define E1000_CTRL_EXT_PHY_INT E1000_CTRL_EXT_SDP5_DATA
- +#define E1000_CTRL_EXT_SDP6_DATA 0x00000040 /* Value of SW Defineable Pin 6 */
- +#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Defineable Pin 7 */
- +#define E1000_CTRL_EXT_SDP4_DIR 0x00000100 /* Direction of SDP4 0=in 1=out */
- +#define E1000_CTRL_EXT_SDP5_DIR 0x00000200 /* Direction of SDP5 0=in 1=out */
- +#define E1000_CTRL_EXT_SDP6_DIR 0x00000400 /* Direction of SDP6 0=in 1=out */
- +#define E1000_CTRL_EXT_SDP7_DIR 0x00000800 /* Direction of SDP7 0=in 1=out */
- +#define E1000_CTRL_EXT_ASDCHK 0x00001000 /* Initiate an ASD sequence */
- +#define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */
- +#define E1000_CTRL_EXT_IPS 0x00004000 /* Invert Power State */
- +#define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */
- +#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
- +#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000
- +#define E1000_CTRL_EXT_LINK_MODE_TBI 0x00C00000
- +#define E1000_CTRL_EXT_WR_WMARK_MASK 0x03000000
- +#define E1000_CTRL_EXT_WR_WMARK_256 0x00000000
- +#define E1000_CTRL_EXT_WR_WMARK_320 0x01000000
- +#define E1000_CTRL_EXT_WR_WMARK_384 0x02000000
- +#define E1000_CTRL_EXT_WR_WMARK_448 0x03000000
- +
- +/* MDI Control */
- +#define E1000_MDIC_DATA_MASK 0x0000FFFF
- +#define E1000_MDIC_REG_MASK 0x001F0000
- +#define E1000_MDIC_REG_SHIFT 16
- +#define E1000_MDIC_PHY_MASK 0x03E00000
- +#define E1000_MDIC_PHY_SHIFT 21
- +#define E1000_MDIC_OP_WRITE 0x04000000
- +#define E1000_MDIC_OP_READ 0x08000000
- +#define E1000_MDIC_READY 0x10000000
- +#define E1000_MDIC_INT_EN 0x20000000
- +#define E1000_MDIC_ERROR 0x40000000
- +
- +/* LED Control */
- +#define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F
- +#define E1000_LEDCTL_LED0_MODE_SHIFT 0
- +#define E1000_LEDCTL_LED0_IVRT 0x00000040
- +#define E1000_LEDCTL_LED0_BLINK 0x00000080
- +#define E1000_LEDCTL_LED1_MODE_MASK 0x00000F00
- +#define E1000_LEDCTL_LED1_MODE_SHIFT 8
- +#define E1000_LEDCTL_LED1_IVRT 0x00004000
- +#define E1000_LEDCTL_LED1_BLINK 0x00008000
- +#define E1000_LEDCTL_LED2_MODE_MASK 0x000F0000
- +#define E1000_LEDCTL_LED2_MODE_SHIFT 16
- +#define E1000_LEDCTL_LED2_IVRT 0x00400000
- +#define E1000_LEDCTL_LED2_BLINK 0x00800000
- +#define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000
- +#define E1000_LEDCTL_LED3_MODE_SHIFT 24
- +#define E1000_LEDCTL_LED3_IVRT 0x40000000
- +#define E1000_LEDCTL_LED3_BLINK 0x80000000
- +
- +#define E1000_LEDCTL_MODE_LINK_10_1000 0x0
- +#define E1000_LEDCTL_MODE_LINK_100_1000 0x1
- +#define E1000_LEDCTL_MODE_LINK_UP 0x2
- +#define E1000_LEDCTL_MODE_ACTIVITY 0x3
- +#define E1000_LEDCTL_MODE_LINK_ACTIVITY 0x4
- +#define E1000_LEDCTL_MODE_LINK_10 0x5
- +#define E1000_LEDCTL_MODE_LINK_100 0x6
- +#define E1000_LEDCTL_MODE_LINK_1000 0x7
- +#define E1000_LEDCTL_MODE_PCIX_MODE 0x8
- +#define E1000_LEDCTL_MODE_FULL_DUPLEX 0x9
- +#define E1000_LEDCTL_MODE_COLLISION 0xA
- +#define E1000_LEDCTL_MODE_BUS_SPEED 0xB
- +#define E1000_LEDCTL_MODE_BUS_SIZE 0xC
- +#define E1000_LEDCTL_MODE_PAUSED 0xD
- +#define E1000_LEDCTL_MODE_LED_ON 0xE
- +#define E1000_LEDCTL_MODE_LED_OFF 0xF
- +
- +/* Receive Address */
- +#define E1000_RAH_AV 0x80000000 /* Receive descriptor valid */
- +
- +/* Interrupt Cause Read */
- +#define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */
- +#define E1000_ICR_TXQE 0x00000002 /* Transmit Queue empty */
- +#define E1000_ICR_LSC 0x00000004 /* Link Status Change */
- +#define E1000_ICR_RXSEQ 0x00000008 /* rx sequence error */
- +#define E1000_ICR_RXDMT0 0x00000010 /* rx desc min. threshold (0) */
- +#define E1000_ICR_RXO 0x00000040 /* rx overrun */
- +#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */
- +#define E1000_ICR_MDAC 0x00000200 /* MDIO access complete */
- +#define E1000_ICR_RXCFG 0x00000400 /* RX /c/ ordered set */
- +#define E1000_ICR_GPI_EN0 0x00000800 /* GP Int 0 */
- +#define E1000_ICR_GPI_EN1 0x00001000 /* GP Int 1 */
- +#define E1000_ICR_GPI_EN2 0x00002000 /* GP Int 2 */
- +#define E1000_ICR_GPI_EN3 0x00004000 /* GP Int 3 */
- +#define E1000_ICR_TXD_LOW 0x00008000
- +#define E1000_ICR_SRPD 0x00010000
- +
- +/* Interrupt Cause Set */
- +#define E1000_ICS_TXDW E1000_ICR_TXDW /* Transmit desc written back */
- +#define E1000_ICS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */
- +#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */
- +#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */
- +#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */
- +#define E1000_ICS_RXO E1000_ICR_RXO /* rx overrun */
- +#define E1000_ICS_RXT0 E1000_ICR_RXT0 /* rx timer intr */
- +#define E1000_ICS_MDAC E1000_ICR_MDAC /* MDIO access complete */
- +#define E1000_ICS_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */
- +#define E1000_ICS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */
- +#define E1000_ICS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */
- +#define E1000_ICS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */
- +#define E1000_ICS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */
- +#define E1000_ICS_TXD_LOW E1000_ICR_TXD_LOW
- +#define E1000_ICS_SRPD E1000_ICR_SRPD
- +
- +/* Interrupt Mask Set */
- +#define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */
- +#define E1000_IMS_TXQE E1000_ICR_TXQE /* Transmit Queue empty */
- +#define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */
- +#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */
- +#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */
- +#define E1000_IMS_RXO E1000_ICR_RXO /* rx overrun */
- +#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */
- +#define E1000_IMS_MDAC E1000_ICR_MDAC /* MDIO access complete */
- +#define E1000_IMS_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */
- +#define E1000_IMS_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */
- +#define E1000_IMS_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */
- +#define E1000_IMS_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */
- +#define E1000_IMS_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */
- +#define E1000_IMS_TXD_LOW E1000_ICR_TXD_LOW
- +#define E1000_IMS_SRPD E1000_ICR_SRPD
- +
- +/* Interrupt Mask Clear */
- +#define E1000_IMC_TXDW E1000_ICR_TXDW /* Transmit desc written back */
- +#define E1000_IMC_TXQE E1000_ICR_TXQE /* Transmit Queue empty */
- +#define E1000_IMC_LSC E1000_ICR_LSC /* Link Status Change */
- +#define E1000_IMC_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */
- +#define E1000_IMC_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */
- +#define E1000_IMC_RXO E1000_ICR_RXO /* rx overrun */
- +#define E1000_IMC_RXT0 E1000_ICR_RXT0 /* rx timer intr */
- +#define E1000_IMC_MDAC E1000_ICR_MDAC /* MDIO access complete */
- +#define E1000_IMC_RXCFG E1000_ICR_RXCFG /* RX /c/ ordered set */
- +#define E1000_IMC_GPI_EN0 E1000_ICR_GPI_EN0 /* GP Int 0 */
- +#define E1000_IMC_GPI_EN1 E1000_ICR_GPI_EN1 /* GP Int 1 */
- +#define E1000_IMC_GPI_EN2 E1000_ICR_GPI_EN2 /* GP Int 2 */
- +#define E1000_IMC_GPI_EN3 E1000_ICR_GPI_EN3 /* GP Int 3 */
- +#define E1000_IMC_TXD_LOW E1000_ICR_TXD_LOW
- +#define E1000_IMC_SRPD E1000_ICR_SRPD
- +
- +/* Receive Control */
- +#define E1000_RCTL_RST 0x00000001 /* Software reset */
- +#define E1000_RCTL_EN 0x00000002 /* enable */
- +#define E1000_RCTL_SBP 0x00000004 /* store bad packet */
- +#define E1000_RCTL_UPE 0x00000008 /* unicast promiscuous enable */
- +#define E1000_RCTL_MPE 0x00000010 /* multicast promiscuous enab */
- +#define E1000_RCTL_LPE 0x00000020 /* long packet enable */
- +#define E1000_RCTL_LBM_NO 0x00000000 /* no loopback mode */
- +#define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */
- +#define E1000_RCTL_LBM_SLP 0x00000080 /* serial link loopback mode */
- +#define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */
- +#define E1000_RCTL_RDMTS_HALF 0x00000000 /* rx desc min threshold size */
- +#define E1000_RCTL_RDMTS_QUAT 0x00000100 /* rx desc min threshold size */
- +#define E1000_RCTL_RDMTS_EIGTH 0x00000200 /* rx desc min threshold size */
- +#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */
- +#define E1000_RCTL_MO_0 0x00000000 /* multicast offset 11:0 */
- +#define E1000_RCTL_MO_1 0x00001000 /* multicast offset 12:1 */
- +#define E1000_RCTL_MO_2 0x00002000 /* multicast offset 13:2 */
- +#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */
- +#define E1000_RCTL_MDR 0x00004000 /* multicast desc ring 0 */
- +#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */
- +/* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */
- +#define E1000_RCTL_SZ_2048 0x00000000 /* rx buffer size 2048 */
- +#define E1000_RCTL_SZ_1024 0x00010000 /* rx buffer size 1024 */
- +#define E1000_RCTL_SZ_512 0x00020000 /* rx buffer size 512 */
- +#define E1000_RCTL_SZ_256 0x00030000 /* rx buffer size 256 */
- +/* these buffer sizes are valid if E1000_RCTL_BSEX is 1 */
- +#define E1000_RCTL_SZ_16384 0x00010000 /* rx buffer size 16384 */
- +#define E1000_RCTL_SZ_8192 0x00020000 /* rx buffer size 8192 */
- +#define E1000_RCTL_SZ_4096 0x00030000 /* rx buffer size 4096 */
- +#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */
- +#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */
- +#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */
- +#define E1000_RCTL_DPF 0x00400000 /* discard pause frames */
- +#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */
- +#define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */
- +
- +/* Receive Descriptor */
- +#define E1000_RDT_DELAY 0x0000ffff /* Delay timer (1=1024us) */
- +#define E1000_RDT_FPDB 0x80000000 /* Flush descriptor block */
- +#define E1000_RDLEN_LEN 0x0007ff80 /* descriptor length */
- +#define E1000_RDH_RDH 0x0000ffff /* receive descriptor head */
- +#define E1000_RDT_RDT 0x0000ffff /* receive descriptor tail */
- +
- +/* Flow Control */
- +#define E1000_FCRTH_RTH 0x0000FFF8 /* Mask Bits[15:3] for RTH */
- +#define E1000_FCRTH_XFCE 0x80000000 /* External Flow Control Enable */
- +#define E1000_FCRTL_RTL 0x0000FFF8 /* Mask Bits[15:3] for RTL */
- +#define E1000_FCRTL_XONE 0x80000000 /* Enable XON frame transmission */
- +
- +/* Receive Descriptor Control */
- +#define E1000_RXDCTL_PTHRESH 0x0000003F /* RXDCTL Prefetch Threshold */
- +#define E1000_RXDCTL_HTHRESH 0x00003F00 /* RXDCTL Host Threshold */
- +#define E1000_RXDCTL_WTHRESH 0x003F0000 /* RXDCTL Writeback Threshold */
- +#define E1000_RXDCTL_GRAN 0x01000000 /* RXDCTL Granularity */
- +
- +/* Transmit Descriptor Control */
- +#define E1000_TXDCTL_PTHRESH 0x000000FF /* TXDCTL Prefetch Threshold */
- +#define E1000_TXDCTL_HTHRESH 0x0000FF00 /* TXDCTL Host Threshold */
- +#define E1000_TXDCTL_WTHRESH 0x00FF0000 /* TXDCTL Writeback Threshold */
- +#define E1000_TXDCTL_GRAN 0x01000000 /* TXDCTL Granularity */
- +#define E1000_TXDCTL_LWTHRESH 0xFE000000 /* TXDCTL Low Threshold */
- +#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */
- +
- +/* Transmit Configuration Word */
- +#define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */
- +#define E1000_TXCW_HD 0x00000040 /* TXCW half duplex */
- +#define E1000_TXCW_PAUSE 0x00000080 /* TXCW sym pause request */
- +#define E1000_TXCW_ASM_DIR 0x00000100 /* TXCW astm pause direction */
- +#define E1000_TXCW_PAUSE_MASK 0x00000180 /* TXCW pause request mask */
- +#define E1000_TXCW_RF 0x00003000 /* TXCW remote fault */
- +#define E1000_TXCW_NP 0x00008000 /* TXCW next page */
- +#define E1000_TXCW_CW 0x0000ffff /* TxConfigWord mask */
- +#define E1000_TXCW_TXC 0x40000000 /* Transmit Config control */
- +#define E1000_TXCW_ANE 0x80000000 /* Auto-neg enable */
- +
- +/* Receive Configuration Word */
- +#define E1000_RXCW_CW 0x0000ffff /* RxConfigWord mask */
- +#define E1000_RXCW_NC 0x04000000 /* Receive config no carrier */
- +#define E1000_RXCW_IV 0x08000000 /* Receive config invalid */
- +#define E1000_RXCW_CC 0x10000000 /* Receive config change */
- +#define E1000_RXCW_C 0x20000000 /* Receive config */
- +#define E1000_RXCW_SYNCH 0x40000000 /* Receive config synch */
- +#define E1000_RXCW_ANC 0x80000000 /* Auto-neg complete */
- +
- +/* Transmit Control */
- +#define E1000_TCTL_RST 0x00000001 /* software reset */
- +#define E1000_TCTL_EN 0x00000002 /* enable tx */
- +#define E1000_TCTL_BCE 0x00000004 /* busy check enable */
- +#define E1000_TCTL_PSP 0x00000008 /* pad short packets */
- +#define E1000_TCTL_CT 0x00000ff0 /* collision threshold */
- +#define E1000_TCTL_COLD 0x003ff000 /* collision distance */
- +#define E1000_TCTL_SWXOFF 0x00400000 /* SW Xoff transmission */
- +#define E1000_TCTL_PBE 0x00800000 /* Packet Burst Enable */
- +#define E1000_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */
- +#define E1000_TCTL_NRTU 0x02000000 /* No Re-transmit on underrun */
- +
- +/* Receive Checksum Control */
- +#define E1000_RXCSUM_PCSS_MASK 0x000000FF /* Packet Checksum Start */
- +#define E1000_RXCSUM_IPOFL 0x00000100 /* IPv4 checksum offload */
- +#define E1000_RXCSUM_TUOFL 0x00000200 /* TCP / UDP checksum offload */
- +#define E1000_RXCSUM_IPV6OFL 0x00000400 /* IPv6 checksum offload */
- +
- +/* Definitions for power management and wakeup registers */
- +/* Wake Up Control */
- +#define E1000_WUC_APME 0x00000001 /* APM Enable */
- +#define E1000_WUC_PME_EN 0x00000002 /* PME Enable */
- +#define E1000_WUC_PME_STATUS 0x00000004 /* PME Status */
- +#define E1000_WUC_APMPME 0x00000008 /* Assert PME on APM Wakeup */
- +#define E1000_WUC_SPM 0x80000000 /* Enable SPM */
- +
- +/* Wake Up Filter Control */
- +#define E1000_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */
- +#define E1000_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */
- +#define E1000_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */
- +#define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */
- +#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
- +#define E1000_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */
- +#define E1000_WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Enable */
- +#define E1000_WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Enable */
- +#define E1000_WUFC_FLX0 0x00010000 /* Flexible Filter 0 Enable */
- +#define E1000_WUFC_FLX1 0x00020000 /* Flexible Filter 1 Enable */
- +#define E1000_WUFC_FLX2 0x00040000 /* Flexible Filter 2 Enable */
- +#define E1000_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */
- +#define E1000_WUFC_ALL_FILTERS 0x000F00FF /* Mask for all wakeup filters */
- +#define E1000_WUFC_FLX_OFFSET 16 /* Offset to the Flexible Filters bits */
- +#define E1000_WUFC_FLX_FILTERS 0x000F0000 /* Mask for the 4 flexible filters */
- +
- +/* Wake Up Status */
- +#define E1000_WUS_LNKC 0x00000001 /* Link Status Changed */
- +#define E1000_WUS_MAG 0x00000002 /* Magic Packet Received */
- +#define E1000_WUS_EX 0x00000004 /* Directed Exact Received */
- +#define E1000_WUS_MC 0x00000008 /* Directed Multicast Received */
- +#define E1000_WUS_BC 0x00000010 /* Broadcast Received */
- +#define E1000_WUS_ARP 0x00000020 /* ARP Request Packet Received */
- +#define E1000_WUS_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Received */
- +#define E1000_WUS_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Received */
- +#define E1000_WUS_FLX0 0x00010000 /* Flexible Filter 0 Match */
- +#define E1000_WUS_FLX1 0x00020000 /* Flexible Filter 1 Match */
- +#define E1000_WUS_FLX2 0x00040000 /* Flexible Filter 2 Match */
- +#define E1000_WUS_FLX3 0x00080000 /* Flexible Filter 3 Match */
- +#define E1000_WUS_FLX_FILTERS 0x000F0000 /* Mask for the 4 flexible filters */
- +
- +/* Management Control */
- +#define E1000_MANC_SMBUS_EN 0x00000001 /* SMBus Enabled - RO */
- +#define E1000_MANC_ASF_EN 0x00000002 /* ASF Enabled - RO */
- +#define E1000_MANC_R_ON_FORCE 0x00000004 /* Reset on Force TCO - RO */
- +#define E1000_MANC_RMCP_EN 0x00000100 /* Enable RCMP 026Fh Filtering */
- +#define E1000_MANC_0298_EN 0x00000200 /* Enable RCMP 0298h Filtering */
- +#define E1000_MANC_IPV4_EN 0x00000400 /* Enable IPv4 */
- +#define E1000_MANC_IPV6_EN 0x00000800 /* Enable IPv6 */
- +#define E1000_MANC_SNAP_EN 0x00001000 /* Accept LLC/SNAP */
- +#define E1000_MANC_ARP_EN 0x00002000 /* Enable ARP Request Filtering */
- +#define E1000_MANC_NEIGHBOR_EN 0x00004000 /* Enable Neighbor Discovery
- + * Filtering */
- +#define E1000_MANC_TCO_RESET 0x00010000 /* TCO Reset Occurred */
- +#define E1000_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */
- +#define E1000_MANC_REPORT_STATUS 0x00040000 /* Status Reporting Enabled */
- +#define E1000_MANC_SMB_REQ 0x01000000 /* SMBus Request */
- +#define E1000_MANC_SMB_GNT 0x02000000 /* SMBus Grant */
- +#define E1000_MANC_SMB_CLK_IN 0x04000000 /* SMBus Clock In */
- +#define E1000_MANC_SMB_DATA_IN 0x08000000 /* SMBus Data In */
- +#define E1000_MANC_SMB_DATA_OUT 0x10000000 /* SMBus Data Out */
- +#define E1000_MANC_SMB_CLK_OUT 0x20000000 /* SMBus Clock Out */
- +
- +#define E1000_MANC_SMB_DATA_OUT_SHIFT 28 /* SMBus Data Out Shift */
- +#define E1000_MANC_SMB_CLK_OUT_SHIFT 29 /* SMBus Clock Out Shift */
- +
- +/* Wake Up Packet Length */
- +#define E1000_WUPL_LENGTH_MASK 0x0FFF /* Only the lower 12 bits are valid */
- +
- +#define E1000_MDALIGN 4096
- +
- +/* EEPROM Commands - Microwire */
- +#define EEPROM_READ_OPCODE_MICROWIRE 0x6 /* EEPROM read opcode */
- +#define EEPROM_WRITE_OPCODE_MICROWIRE 0x5 /* EEPROM write opcode */
- +#define EEPROM_ERASE_OPCODE_MICROWIRE 0x7 /* EEPROM erase opcode */
- +#define EEPROM_EWEN_OPCODE_MICROWIRE 0x13 /* EEPROM erase/write enable */
- +#define EEPROM_EWDS_OPCODE_MICROWIRE 0x10 /* EEPROM erast/write disable */
- +
- +/* EEPROM Commands - SPI */
- +#define EEPROM_MAX_RETRY_SPI 5000 /* Max wait of 5ms, for RDY signal */
- +#define EEPROM_READ_OPCODE_SPI 0x3 /* EEPROM read opcode */
- +#define EEPROM_WRITE_OPCODE_SPI 0x2 /* EEPROM write opcode */
- +#define EEPROM_A8_OPCODE_SPI 0x8 /* opcode bit-3 = address bit-8 */
- +#define EEPROM_WREN_OPCODE_SPI 0x6 /* EEPROM set Write Enable latch */
- +#define EEPROM_WRDI_OPCODE_SPI 0x4 /* EEPROM reset Write Enable latch */
- +#define EEPROM_RDSR_OPCODE_SPI 0x5 /* EEPROM read Status register */
- +#define EEPROM_WRSR_OPCODE_SPI 0x1 /* EEPROM write Status register */
- +
- +/* EEPROM Size definitions */
- +#define EEPROM_SIZE_16KB 0x1800
- +#define EEPROM_SIZE_8KB 0x1400
- +#define EEPROM_SIZE_4KB 0x1000
- +#define EEPROM_SIZE_2KB 0x0C00
- +#define EEPROM_SIZE_1KB 0x0800
- +#define EEPROM_SIZE_512B 0x0400
- +#define EEPROM_SIZE_128B 0x0000
- +#define EEPROM_SIZE_MASK 0x1C00
- +
- +/* EEPROM Word Offsets */
- +#define EEPROM_COMPAT 0x0003
- +#define EEPROM_ID_LED_SETTINGS 0x0004
- +#define EEPROM_SERDES_AMPLITUDE 0x0006 /* For SERDES output amplitude adjustment. */
- +#define EEPROM_INIT_CONTROL1_REG 0x000A
- +#define EEPROM_INIT_CONTROL2_REG 0x000F
- +#define EEPROM_INIT_CONTROL3_PORT_B 0x0014
- +#define EEPROM_INIT_CONTROL3_PORT_A 0x0024
- +#define EEPROM_CFG 0x0012
- +#define EEPROM_FLASH_VERSION 0x0032
- +#define EEPROM_CHECKSUM_REG 0x003F
- +
- +/* Word definitions for ID LED Settings */
- +#define ID_LED_RESERVED_0000 0x0000
- +#define ID_LED_RESERVED_FFFF 0xFFFF
- +#define ID_LED_DEFAULT ((ID_LED_OFF1_ON2 << 12) | \
- + (ID_LED_OFF1_OFF2 << 8) | \
- + (ID_LED_DEF1_DEF2 << 4) | \
- + (ID_LED_DEF1_DEF2))
- +#define ID_LED_DEF1_DEF2 0x1
- +#define ID_LED_DEF1_ON2 0x2
- +#define ID_LED_DEF1_OFF2 0x3
- +#define ID_LED_ON1_DEF2 0x4
- +#define ID_LED_ON1_ON2 0x5
- +#define ID_LED_ON1_OFF2 0x6
- +#define ID_LED_OFF1_DEF2 0x7
- +#define ID_LED_OFF1_ON2 0x8
- +#define ID_LED_OFF1_OFF2 0x9
- +
- +#define IGP_ACTIVITY_LED_MASK 0xFFFFF0FF
- +#define IGP_ACTIVITY_LED_ENABLE 0x0300
- +#define IGP_LED3_MODE 0x07000000
- +
- +
- +/* Mask bits for SERDES amplitude adjustment in Word 6 of the EEPROM */
- +#define EEPROM_SERDES_AMPLITUDE_MASK 0x000F
- +
- +/* Mask bits for fields in Word 0x0a of the EEPROM */
- +#define EEPROM_WORD0A_ILOS 0x0010
- +#define EEPROM_WORD0A_SWDPIO 0x01E0
- +#define EEPROM_WORD0A_LRST 0x0200
- +#define EEPROM_WORD0A_FD 0x0400
- +#define EEPROM_WORD0A_66MHZ 0x0800
- +
- +/* Mask bits for fields in Word 0x0f of the EEPROM */
- +#define EEPROM_WORD0F_PAUSE_MASK 0x3000
- +#define EEPROM_WORD0F_PAUSE 0x1000
- +#define EEPROM_WORD0F_ASM_DIR 0x2000
- +#define EEPROM_WORD0F_ANE 0x0800
- +#define EEPROM_WORD0F_SWPDIO_EXT 0x00F0
- +
- +/* For checksumming, the sum of all words in the EEPROM should equal 0xBABA. */
- +#define EEPROM_SUM 0xBABA
- +
- +/* EEPROM Map defines (WORD OFFSETS)*/
- +#define EEPROM_NODE_ADDRESS_BYTE_0 0
- +#define EEPROM_PBA_BYTE_1 8
- +
- +#define EEPROM_RESERVED_WORD 0xFFFF
- +
- +/* EEPROM Map Sizes (Byte Counts) */
- +#define PBA_SIZE 4
- +
- +/* Collision related configuration parameters */
- +#define E1000_COLLISION_THRESHOLD 16
- +#define E1000_CT_SHIFT 4
- +#define E1000_COLLISION_DISTANCE 64
- +#define E1000_FDX_COLLISION_DISTANCE E1000_COLLISION_DISTANCE
- +#define E1000_HDX_COLLISION_DISTANCE E1000_COLLISION_DISTANCE
- +#define E1000_COLD_SHIFT 12
- +
- +/* Number of Transmit and Receive Descriptors must be a multiple of 8 */
- +#define REQ_TX_DESCRIPTOR_MULTIPLE 8
- +#define REQ_RX_DESCRIPTOR_MULTIPLE 8
- +
- +/* Default values for the transmit IPG register */
- +#define DEFAULT_82542_TIPG_IPGT 10
- +#define DEFAULT_82543_TIPG_IPGT_FIBER 9
- +#define DEFAULT_82543_TIPG_IPGT_COPPER 8
- +
- +#define E1000_TIPG_IPGT_MASK 0x000003FF
- +#define E1000_TIPG_IPGR1_MASK 0x000FFC00
- +#define E1000_TIPG_IPGR2_MASK 0x3FF00000
- +
- +#define DEFAULT_82542_TIPG_IPGR1 2
- +#define DEFAULT_82543_TIPG_IPGR1 8
- +#define E1000_TIPG_IPGR1_SHIFT 10
- +
- +#define DEFAULT_82542_TIPG_IPGR2 10
- +#define DEFAULT_82543_TIPG_IPGR2 6
- +#define E1000_TIPG_IPGR2_SHIFT 20
- +
- +#define E1000_TXDMAC_DPP 0x00000001
- +
- +/* Adaptive IFS defines */
- +#define TX_THRESHOLD_START 8
- +#define TX_THRESHOLD_INCREMENT 10
- +#define TX_THRESHOLD_DECREMENT 1
- +#define TX_THRESHOLD_STOP 190
- +#define TX_THRESHOLD_DISABLE 0
- +#define TX_THRESHOLD_TIMER_MS 10000
- +#define MIN_NUM_XMITS 1000
- +#define IFS_MAX 80
- +#define IFS_STEP 10
- +#define IFS_MIN 40
- +#define IFS_RATIO 4
- +
- +/* PBA constants */
- +#define E1000_PBA_16K 0x0010 /* 16KB, default TX allocation */
- +#define E1000_PBA_22K 0x0016
- +#define E1000_PBA_24K 0x0018
- +#define E1000_PBA_30K 0x001E
- +#define E1000_PBA_40K 0x0028
- +#define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */
- +
- +/* Flow Control Constants */
- +#define FLOW_CONTROL_ADDRESS_LOW 0x00C28001
- +#define FLOW_CONTROL_ADDRESS_HIGH 0x00000100
- +#define FLOW_CONTROL_TYPE 0x8808
- +
- +/* The historical defaults for the flow control values are given below. */
- +#define FC_DEFAULT_HI_THRESH (0x8000) /* 32KB */
- +#define FC_DEFAULT_LO_THRESH (0x4000) /* 16KB */
- +#define FC_DEFAULT_TX_TIMER (0x100) /* ~130 us */
- +
- +/* PCIX Config space */
- +#define PCIX_COMMAND_REGISTER 0xE6
- +#define PCIX_STATUS_REGISTER_LO 0xE8
- +#define PCIX_STATUS_REGISTER_HI 0xEA
- +
- +#define PCIX_COMMAND_MMRBC_MASK 0x000C
- +#define PCIX_COMMAND_MMRBC_SHIFT 0x2
- +#define PCIX_STATUS_HI_MMRBC_MASK 0x0060
- +#define PCIX_STATUS_HI_MMRBC_SHIFT 0x5
- +#define PCIX_STATUS_HI_MMRBC_4K 0x3
- +#define PCIX_STATUS_HI_MMRBC_2K 0x2
- +
- +
- +/* Number of bits required to shift right the "pause" bits from the
- + * EEPROM (bits 13:12) to the "pause" (bits 8:7) field in the TXCW register.
- + */
- +#define PAUSE_SHIFT 5
- +
- +/* Number of bits required to shift left the "SWDPIO" bits from the
- + * EEPROM (bits 8:5) to the "SWDPIO" (bits 25:22) field in the CTRL register.
- + */
- +#define SWDPIO_SHIFT 17
- +
- +/* Number of bits required to shift left the "SWDPIO_EXT" bits from the
- + * EEPROM word F (bits 7:4) to the bits 11:8 of The Extended CTRL register.
- + */
- +#define SWDPIO__EXT_SHIFT 4
- +
- +/* Number of bits required to shift left the "ILOS" bit from the EEPROM
- + * (bit 4) to the "ILOS" (bit 7) field in the CTRL register.
- + */
- +#define ILOS_SHIFT 3
- +
- +
- +#define RECEIVE_BUFFER_ALIGN_SIZE (256)
- +
- +/* Number of milliseconds we wait for auto-negotiation to complete */
- +#define LINK_UP_TIMEOUT 500
- +
- +#define E1000_TX_BUFFER_SIZE ((uint32_t)1514)
- +
- +/* The carrier extension symbol, as received by the NIC. */
- +#define CARRIER_EXTENSION 0x0F
- +
- +/* TBI_ACCEPT macro definition:
- + *
- + * This macro requires:
- + * adapter = a pointer to struct e1000_hw
- + * status = the 8 bit status field of the RX descriptor with EOP set
- + * error = the 8 bit error field of the RX descriptor with EOP set
- + * length = the sum of all the length fields of the RX descriptors that
- + * make up the current frame
- + * last_byte = the last byte of the frame DMAed by the hardware
- + * max_frame_length = the maximum frame length we want to accept.
- + * min_frame_length = the minimum frame length we want to accept.
- + *
- + * This macro is a conditional that should be used in the interrupt
- + * handler's Rx processing routine when RxErrors have been detected.
- + *
- + * Typical use:
- + * ...
- + * if (TBI_ACCEPT) {
- + * accept_frame = TRUE;
- + * e1000_tbi_adjust_stats(adapter, MacAddress);
- + * frame_length--;
- + * } else {
- + * accept_frame = FALSE;
- + * }
- + * ...
- + */
- +
- +#define TBI_ACCEPT(adapter, status, errors, length, last_byte) \
- + ((adapter)->tbi_compatibility_on && \
- + (((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \
- + ((last_byte) == CARRIER_EXTENSION) && \
- + (((status) & E1000_RXD_STAT_VP) ? \
- + (((length) > ((adapter)->min_frame_size - VLAN_TAG_SIZE)) && \
- + ((length) <= ((adapter)->max_frame_size + 1))) : \
- + (((length) > (adapter)->min_frame_size) && \
- + ((length) <= ((adapter)->max_frame_size + VLAN_TAG_SIZE + 1)))))
- +
- +
- +/* Structures, enums, and macros for the PHY */
- +
- +/* Bit definitions for the Management Data IO (MDIO) and Management Data
- + * Clock (MDC) pins in the Device Control Register.
- + */
- +#define E1000_CTRL_PHY_RESET_DIR E1000_CTRL_SWDPIO0
- +#define E1000_CTRL_PHY_RESET E1000_CTRL_SWDPIN0
- +#define E1000_CTRL_MDIO_DIR E1000_CTRL_SWDPIO2
- +#define E1000_CTRL_MDIO E1000_CTRL_SWDPIN2
- +#define E1000_CTRL_MDC_DIR E1000_CTRL_SWDPIO3
- +#define E1000_CTRL_MDC E1000_CTRL_SWDPIN3
- +#define E1000_CTRL_PHY_RESET_DIR4 E1000_CTRL_EXT_SDP4_DIR
- +#define E1000_CTRL_PHY_RESET4 E1000_CTRL_EXT_SDP4_DATA
- +
- +/* PHY 1000 MII Register/Bit Definitions */
- +/* PHY Registers defined by IEEE */
- +#define PHY_CTRL 0x00 /* Control Register */
- +#define PHY_STATUS 0x01 /* Status Regiser */
- +#define PHY_ID1 0x02 /* Phy Id Reg (word 1) */
- +#define PHY_ID2 0x03 /* Phy Id Reg (word 2) */
- +#define PHY_AUTONEG_ADV 0x04 /* Autoneg Advertisement */
- +#define PHY_LP_ABILITY 0x05 /* Link Partner Ability (Base Page) */
- +#define PHY_AUTONEG_EXP 0x06 /* Autoneg Expansion Reg */
- +#define PHY_NEXT_PAGE_TX 0x07 /* Next Page TX */
- +#define PHY_LP_NEXT_PAGE 0x08 /* Link Partner Next Page */
- +#define PHY_1000T_CTRL 0x09 /* 1000Base-T Control Reg */
- +#define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */
- +#define PHY_EXT_STATUS 0x0F /* Extended Status Reg */
- +
- +/* M88E1000 Specific Registers */
- +#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */
- +#define M88E1000_PHY_SPEC_STATUS 0x11 /* PHY Specific Status Register */
- +#define M88E1000_INT_ENABLE 0x12 /* Interrupt Enable Register */
- +#define M88E1000_INT_STATUS 0x13 /* Interrupt Status Register */
- +#define M88E1000_EXT_PHY_SPEC_CTRL 0x14 /* Extended PHY Specific Control */
- +#define M88E1000_RX_ERR_CNTR 0x15 /* Receive Error Counter */
- +
- +#define M88E1000_PHY_EXT_CTRL 0x1A /* PHY extend control register */
- +#define M88E1000_PHY_PAGE_SELECT 0x1D /* Reg 29 for page number setting */
- +#define M88E1000_PHY_GEN_CONTROL 0x1E /* Its meaning depends on reg 29 */
- +#define M88E1000_PHY_VCO_REG_BIT8 0x100 /* Bits 8 & 11 are adjusted for */
- +#define M88E1000_PHY_VCO_REG_BIT11 0x800 /* improved BER performance */
- +
- +#define IGP01E1000_IEEE_REGS_PAGE 0x0000
- +#define IGP01E1000_IEEE_RESTART_AUTONEG 0x3300
- +#define IGP01E1000_IEEE_FORCE_GIGA 0x0140
- +
- +/* IGP01E1000 Specific Registers */
- +#define IGP01E1000_PHY_PORT_CONFIG 0x10 /* PHY Specific Port Config Register */
- +#define IGP01E1000_PHY_PORT_STATUS 0x11 /* PHY Specific Status Register */
- +#define IGP01E1000_PHY_PORT_CTRL 0x12 /* PHY Specific Control Register */
- +#define IGP01E1000_PHY_LINK_HEALTH 0x13 /* PHY Link Health Register */
- +#define IGP01E1000_GMII_FIFO 0x14 /* GMII FIFO Register */
- +#define IGP01E1000_PHY_CHANNEL_QUALITY 0x15 /* PHY Channel Quality Register */
- +#define IGP01E1000_PHY_PAGE_SELECT 0x1F /* PHY Page Select Core Register */
- +
- +/* IGP01E1000 AGC Registers - stores the cable length values*/
- +#define IGP01E1000_PHY_AGC_A 0x1172
- +#define IGP01E1000_PHY_AGC_B 0x1272
- +#define IGP01E1000_PHY_AGC_C 0x1472
- +#define IGP01E1000_PHY_AGC_D 0x1872
- +
- +/* IGP01E1000 DSP Reset Register */
- +#define IGP01E1000_PHY_DSP_RESET 0x1F33
- +#define IGP01E1000_PHY_DSP_SET 0x1F71
- +#define IGP01E1000_PHY_DSP_FFE 0x1F35
- +
- +#define IGP01E1000_PHY_CHANNEL_NUM 4
- +#define IGP01E1000_PHY_AGC_PARAM_A 0x1171
- +#define IGP01E1000_PHY_AGC_PARAM_B 0x1271
- +#define IGP01E1000_PHY_AGC_PARAM_C 0x1471
- +#define IGP01E1000_PHY_AGC_PARAM_D 0x1871
- +
- +#define IGP01E1000_PHY_EDAC_MU_INDEX 0xC000
- +#define IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS 0x8000
- +
- +#define IGP01E1000_PHY_ANALOG_TX_STATE 0x2890
- +#define IGP01E1000_PHY_ANALOG_CLASS_A 0x2000
- +#define IGP01E1000_PHY_FORCE_ANALOG_ENABLE 0x0004
- +#define IGP01E1000_PHY_DSP_FFE_CM_CP 0x0069
- +
- +#define IGP01E1000_PHY_DSP_FFE_DEFAULT 0x002A
- +/* IGP01E1000 PCS Initialization register - stores the polarity status when
- + * speed = 1000 Mbps. */
- +#define IGP01E1000_PHY_PCS_INIT_REG 0x00B4
- +#define IGP01E1000_PHY_PCS_CTRL_REG 0x00B5
- +
- +#define IGP01E1000_ANALOG_REGS_PAGE 0x20C0
- +
- +#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */
- +#define MAX_PHY_MULTI_PAGE_REG 0xF /*Registers that are equal on all pages*/
- +/* PHY Control Register */
- +#define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 */
- +#define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */
- +#define MII_CR_FULL_DUPLEX 0x0100 /* FDX =1, half duplex =0 */
- +#define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */
- +#define MII_CR_ISOLATE 0x0400 /* Isolate PHY from MII */
- +#define MII_CR_POWER_DOWN 0x0800 /* Power down */
- +#define MII_CR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */
- +#define MII_CR_SPEED_SELECT_LSB 0x2000 /* bits 6,13: 10=1000, 01=100, 00=10 */
- +#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */
- +#define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */
- +
- +/* PHY Status Register */
- +#define MII_SR_EXTENDED_CAPS 0x0001 /* Extended register capabilities */
- +#define MII_SR_JABBER_DETECT 0x0002 /* Jabber Detected */
- +#define MII_SR_LINK_STATUS 0x0004 /* Link Status 1 = link */
- +#define MII_SR_AUTONEG_CAPS 0x0008 /* Auto Neg Capable */
- +#define MII_SR_REMOTE_FAULT 0x0010 /* Remote Fault Detect */
- +#define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */
- +#define MII_SR_PREAMBLE_SUPPRESS 0x0040 /* Preamble may be suppressed */
- +#define MII_SR_EXTENDED_STATUS 0x0100 /* Ext. status info in Reg 0x0F */
- +#define MII_SR_100T2_HD_CAPS 0x0200 /* 100T2 Half Duplex Capable */
- +#define MII_SR_100T2_FD_CAPS 0x0400 /* 100T2 Full Duplex Capable */
- +#define MII_SR_10T_HD_CAPS 0x0800 /* 10T Half Duplex Capable */
- +#define MII_SR_10T_FD_CAPS 0x1000 /* 10T Full Duplex Capable */
- +#define MII_SR_100X_HD_CAPS 0x2000 /* 100X Half Duplex Capable */
- +#define MII_SR_100X_FD_CAPS 0x4000 /* 100X Full Duplex Capable */
- +#define MII_SR_100T4_CAPS 0x8000 /* 100T4 Capable */
- +
- +/* Autoneg Advertisement Register */
- +#define NWAY_AR_SELECTOR_FIELD 0x0001 /* indicates IEEE 802.3 CSMA/CD */
- +#define NWAY_AR_10T_HD_CAPS 0x0020 /* 10T Half Duplex Capable */
- +#define NWAY_AR_10T_FD_CAPS 0x0040 /* 10T Full Duplex Capable */
- +#define NWAY_AR_100TX_HD_CAPS 0x0080 /* 100TX Half Duplex Capable */
- +#define NWAY_AR_100TX_FD_CAPS 0x0100 /* 100TX Full Duplex Capable */
- +#define NWAY_AR_100T4_CAPS 0x0200 /* 100T4 Capable */
- +#define NWAY_AR_PAUSE 0x0400 /* Pause operation desired */
- +#define NWAY_AR_ASM_DIR 0x0800 /* Asymmetric Pause Direction bit */
- +#define NWAY_AR_REMOTE_FAULT 0x2000 /* Remote Fault detected */
- +#define NWAY_AR_NEXT_PAGE 0x8000 /* Next Page ability supported */
- +
- +/* Link Partner Ability Register (Base Page) */
- +#define NWAY_LPAR_SELECTOR_FIELD 0x0000 /* LP protocol selector field */
- +#define NWAY_LPAR_10T_HD_CAPS 0x0020 /* LP is 10T Half Duplex Capable */
- +#define NWAY_LPAR_10T_FD_CAPS 0x0040 /* LP is 10T Full Duplex Capable */
- +#define NWAY_LPAR_100TX_HD_CAPS 0x0080 /* LP is 100TX Half Duplex Capable */
- +#define NWAY_LPAR_100TX_FD_CAPS 0x0100 /* LP is 100TX Full Duplex Capable */
- +#define NWAY_LPAR_100T4_CAPS 0x0200 /* LP is 100T4 Capable */
- +#define NWAY_LPAR_PAUSE 0x0400 /* LP Pause operation desired */
- +#define NWAY_LPAR_ASM_DIR 0x0800 /* LP Asymmetric Pause Direction bit */
- +#define NWAY_LPAR_REMOTE_FAULT 0x2000 /* LP has detected Remote Fault */
- +#define NWAY_LPAR_ACKNOWLEDGE 0x4000 /* LP has rx'd link code word */
- +#define NWAY_LPAR_NEXT_PAGE 0x8000 /* Next Page ability supported */
- +
- +/* Autoneg Expansion Register */
- +#define NWAY_ER_LP_NWAY_CAPS 0x0001 /* LP has Auto Neg Capability */
- +#define NWAY_ER_PAGE_RXD 0x0002 /* LP is 10T Half Duplex Capable */
- +#define NWAY_ER_NEXT_PAGE_CAPS 0x0004 /* LP is 10T Full Duplex Capable */
- +#define NWAY_ER_LP_NEXT_PAGE_CAPS 0x0008 /* LP is 100TX Half Duplex Capable */
- +#define NWAY_ER_PAR_DETECT_FAULT 0x0010 /* LP is 100TX Full Duplex Capable */
- +
- +/* Next Page TX Register */
- +#define NPTX_MSG_CODE_FIELD 0x0001 /* NP msg code or unformatted data */
- +#define NPTX_TOGGLE 0x0800 /* Toggles between exchanges
- + * of different NP
- + */
- +#define NPTX_ACKNOWLDGE2 0x1000 /* 1 = will comply with msg
- + * 0 = cannot comply with msg
- + */
- +#define NPTX_MSG_PAGE 0x2000 /* formatted(1)/unformatted(0) pg */
- +#define NPTX_NEXT_PAGE 0x8000 /* 1 = addition NP will follow
- + * 0 = sending last NP
- + */
- +
- +/* Link Partner Next Page Register */
- +#define LP_RNPR_MSG_CODE_FIELD 0x0001 /* NP msg code or unformatted data */
- +#define LP_RNPR_TOGGLE 0x0800 /* Toggles between exchanges
- + * of different NP
- + */
- +#define LP_RNPR_ACKNOWLDGE2 0x1000 /* 1 = will comply with msg
- + * 0 = cannot comply with msg
- + */
- +#define LP_RNPR_MSG_PAGE 0x2000 /* formatted(1)/unformatted(0) pg */
- +#define LP_RNPR_ACKNOWLDGE 0x4000 /* 1 = ACK / 0 = NO ACK */
- +#define LP_RNPR_NEXT_PAGE 0x8000 /* 1 = addition NP will follow
- + * 0 = sending last NP
- + */
- +
- +/* 1000BASE-T Control Register */
- +#define CR_1000T_ASYM_PAUSE 0x0080 /* Advertise asymmetric pause bit */
- +#define CR_1000T_HD_CAPS 0x0100 /* Advertise 1000T HD capability */
- +#define CR_1000T_FD_CAPS 0x0200 /* Advertise 1000T FD capability */
- +#define CR_1000T_REPEATER_DTE 0x0400 /* 1=Repeater/switch device port */
- + /* 0=DTE device */
- +#define CR_1000T_MS_VALUE 0x0800 /* 1=Configure PHY as Master */
- + /* 0=Configure PHY as Slave */
- +#define CR_1000T_MS_ENABLE 0x1000 /* 1=Master/Slave manual config value */
- + /* 0=Automatic Master/Slave config */
- +#define CR_1000T_TEST_MODE_NORMAL 0x0000 /* Normal Operation */
- +#define CR_1000T_TEST_MODE_1 0x2000 /* Transmit Waveform test */
- +#define CR_1000T_TEST_MODE_2 0x4000 /* Master Transmit Jitter test */
- +#define CR_1000T_TEST_MODE_3 0x6000 /* Slave Transmit Jitter test */
- +#define CR_1000T_TEST_MODE_4 0x8000 /* Transmitter Distortion test */
- +
- +/* 1000BASE-T Status Register */
- +#define SR_1000T_IDLE_ERROR_CNT 0x00FF /* Num idle errors since last read */
- +#define SR_1000T_ASYM_PAUSE_DIR 0x0100 /* LP asymmetric pause direction bit */
- +#define SR_1000T_LP_HD_CAPS 0x0400 /* LP is 1000T HD capable */
- +#define SR_1000T_LP_FD_CAPS 0x0800 /* LP is 1000T FD capable */
- +#define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */
- +#define SR_1000T_LOCAL_RX_STATUS 0x2000 /* Local receiver OK */
- +#define SR_1000T_MS_CONFIG_RES 0x4000 /* 1=Local TX is Master, 0=Slave */
- +#define SR_1000T_MS_CONFIG_FAULT 0x8000 /* Master/Slave config fault */
- +#define SR_1000T_REMOTE_RX_STATUS_SHIFT 12
- +#define SR_1000T_LOCAL_RX_STATUS_SHIFT 13
- +#define SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT 5
- +#define FFE_IDLE_ERR_COUNT_TIMEOUT_20 20
- +#define FFE_IDLE_ERR_COUNT_TIMEOUT_100 100
- +
- +/* Extended Status Register */
- +#define IEEE_ESR_1000T_HD_CAPS 0x1000 /* 1000T HD capable */
- +#define IEEE_ESR_1000T_FD_CAPS 0x2000 /* 1000T FD capable */
- +#define IEEE_ESR_1000X_HD_CAPS 0x4000 /* 1000X HD capable */
- +#define IEEE_ESR_1000X_FD_CAPS 0x8000 /* 1000X FD capable */
- +
- +#define PHY_TX_POLARITY_MASK 0x0100 /* register 10h bit 8 (polarity bit) */
- +#define PHY_TX_NORMAL_POLARITY 0 /* register 10h bit 8 (normal polarity) */
- +
- +#define AUTO_POLARITY_DISABLE 0x0010 /* register 11h bit 4 */
- + /* (0=enable, 1=disable) */
- +
- +/* M88E1000 PHY Specific Control Register */
- +#define M88E1000_PSCR_JABBER_DISABLE 0x0001 /* 1=Jabber Function disabled */
- +#define M88E1000_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reversal enabled */
- +#define M88E1000_PSCR_SQE_TEST 0x0004 /* 1=SQE Test enabled */
- +#define M88E1000_PSCR_CLK125_DISABLE 0x0010 /* 1=CLK125 low,
- + * 0=CLK125 toggling
- + */
- +#define M88E1000_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5 */
- + /* Manual MDI configuration */
- +#define M88E1000_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */
- +#define M88E1000_PSCR_AUTO_X_1000T 0x0040 /* 1000BASE-T: Auto crossover,
- + * 100BASE-TX/10BASE-T:
- + * MDI Mode
- + */
- +#define M88E1000_PSCR_AUTO_X_MODE 0x0060 /* Auto crossover enabled
- + * all speeds.
- + */
- +#define M88E1000_PSCR_10BT_EXT_DIST_ENABLE 0x0080
- + /* 1=Enable Extended 10BASE-T distance
- + * (Lower 10BASE-T RX Threshold)
- + * 0=Normal 10BASE-T RX Threshold */
- +#define M88E1000_PSCR_MII_5BIT_ENABLE 0x0100
- + /* 1=5-Bit interface in 100BASE-TX
- + * 0=MII interface in 100BASE-TX */
- +#define M88E1000_PSCR_SCRAMBLER_DISABLE 0x0200 /* 1=Scrambler disable */
- +#define M88E1000_PSCR_FORCE_LINK_GOOD 0x0400 /* 1=Force link good */
- +#define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */
- +
- +#define M88E1000_PSCR_POLARITY_REVERSAL_SHIFT 1
- +#define M88E1000_PSCR_AUTO_X_MODE_SHIFT 5
- +#define M88E1000_PSCR_10BT_EXT_DIST_ENABLE_SHIFT 7
- +
- +/* M88E1000 PHY Specific Status Register */
- +#define M88E1000_PSSR_JABBER 0x0001 /* 1=Jabber */
- +#define M88E1000_PSSR_REV_POLARITY 0x0002 /* 1=Polarity reversed */
- +#define M88E1000_PSSR_DOWNSHIFT 0x0020 /* 1=Downshifted */
- +#define M88E1000_PSSR_MDIX 0x0040 /* 1=MDIX; 0=MDI */
- +#define M88E1000_PSSR_CABLE_LENGTH 0x0380 /* 0=<50M;1=50-80M;2=80-110M;
- + * 3=110-140M;4=>140M */
- +#define M88E1000_PSSR_LINK 0x0400 /* 1=Link up, 0=Link down */
- +#define M88E1000_PSSR_SPD_DPLX_RESOLVED 0x0800 /* 1=Speed & Duplex resolved */
- +#define M88E1000_PSSR_PAGE_RCVD 0x1000 /* 1=Page received */
- +#define M88E1000_PSSR_DPLX 0x2000 /* 1=Duplex 0=Half Duplex */
- +#define M88E1000_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */
- +#define M88E1000_PSSR_10MBS 0x0000 /* 00=10Mbs */
- +#define M88E1000_PSSR_100MBS 0x4000 /* 01=100Mbs */
- +#define M88E1000_PSSR_1000MBS 0x8000 /* 10=1000Mbs */
- +
- +#define M88E1000_PSSR_REV_POLARITY_SHIFT 1
- +#define M88E1000_PSSR_DOWNSHIFT_SHIFT 5
- +#define M88E1000_PSSR_MDIX_SHIFT 6
- +#define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7
- +
- +/* M88E1000 Extended PHY Specific Control Register */
- +#define M88E1000_EPSCR_FIBER_LOOPBACK 0x4000 /* 1=Fiber loopback */
- +#define M88E1000_EPSCR_DOWN_NO_IDLE 0x8000 /* 1=Lost lock detect enabled.
- + * Will assert lost lock and bring
- + * link down if idle not seen
- + * within 1ms in 1000BASE-T
- + */
- +/* Number of times we will attempt to autonegotiate before downshifting if we
- + * are the master */
- +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK 0x0C00
- +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_1X 0x0000
- +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_2X 0x0400
- +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_3X 0x0800
- +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_4X 0x0C00
- +/* Number of times we will attempt to autonegotiate before downshifting if we
- + * are the slave */
- +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK 0x0300
- +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_DIS 0x0000
- +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X 0x0100
- +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_2X 0x0200
- +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_3X 0x0300
- +#define M88E1000_EPSCR_TX_CLK_2_5 0x0060 /* 2.5 MHz TX_CLK */
- +#define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */
- +#define M88E1000_EPSCR_TX_CLK_0 0x0000 /* NO TX_CLK */
- +
- +/* IGP01E1000 Specific Port Config Register - R/W */
- +#define IGP01E1000_PSCFR_AUTO_MDIX_PAR_DETECT 0x0010
- +#define IGP01E1000_PSCFR_PRE_EN 0x0020
- +#define IGP01E1000_PSCFR_SMART_SPEED 0x0080
- +#define IGP01E1000_PSCFR_DISABLE_TPLOOPBACK 0x0100
- +#define IGP01E1000_PSCFR_DISABLE_JABBER 0x0400
- +#define IGP01E1000_PSCFR_DISABLE_TRANSMIT 0x2000
- +
- +/* IGP01E1000 Specific Port Status Register - R/O */
- +#define IGP01E1000_PSSR_AUTONEG_FAILED 0x0001 /* RO LH SC */
- +#define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002
- +#define IGP01E1000_PSSR_CABLE_LENGTH 0x007C
- +#define IGP01E1000_PSSR_FULL_DUPLEX 0x0200
- +#define IGP01E1000_PSSR_LINK_UP 0x0400
- +#define IGP01E1000_PSSR_MDIX 0x0800
- +#define IGP01E1000_PSSR_SPEED_MASK 0xC000 /* speed bits mask */
- +#define IGP01E1000_PSSR_SPEED_10MBPS 0x4000
- +#define IGP01E1000_PSSR_SPEED_100MBPS 0x8000
- +#define IGP01E1000_PSSR_SPEED_1000MBPS 0xC000
- +#define IGP01E1000_PSSR_CABLE_LENGTH_SHIFT 0x0002 /* shift right 2 */
- +#define IGP01E1000_PSSR_MDIX_SHIFT 0x000B /* shift right 11 */
- +
- +/* IGP01E1000 Specific Port Control Register - R/W */
- +#define IGP01E1000_PSCR_TP_LOOPBACK 0x0001
- +#define IGP01E1000_PSCR_CORRECT_NC_SCMBLR 0x0200
- +#define IGP01E1000_PSCR_TEN_CRS_SELECT 0x0400
- +#define IGP01E1000_PSCR_FLIP_CHIP 0x0800
- +#define IGP01E1000_PSCR_AUTO_MDIX 0x1000
- +#define IGP01E1000_PSCR_FORCE_MDI_MDIX 0x2000 /* 0-MDI, 1-MDIX */
- +
- +/* IGP01E1000 Specific Port Link Health Register */
- +#define IGP01E1000_PLHR_SS_DOWNGRADE 0x8000
- +#define IGP01E1000_PLHR_GIG_SCRAMBLER_ERROR 0x4000
- +#define IGP01E1000_PLHR_GIG_REM_RCVR_NOK 0x0800 /* LH */
- +#define IGP01E1000_PLHR_IDLE_ERROR_CNT_OFLOW 0x0400 /* LH */
- +#define IGP01E1000_PLHR_DATA_ERR_1 0x0200 /* LH */
- +#define IGP01E1000_PLHR_DATA_ERR_0 0x0100
- +#define IGP01E1000_PLHR_AUTONEG_FAULT 0x0010
- +#define IGP01E1000_PLHR_AUTONEG_ACTIVE 0x0008
- +#define IGP01E1000_PLHR_VALID_CHANNEL_D 0x0004
- +#define IGP01E1000_PLHR_VALID_CHANNEL_C 0x0002
- +#define IGP01E1000_PLHR_VALID_CHANNEL_B 0x0001
- +#define IGP01E1000_PLHR_VALID_CHANNEL_A 0x0000
- +
- +/* IGP01E1000 Channel Quality Register */
- +#define IGP01E1000_MSE_CHANNEL_D 0x000F
- +#define IGP01E1000_MSE_CHANNEL_C 0x00F0
- +#define IGP01E1000_MSE_CHANNEL_B 0x0F00
- +#define IGP01E1000_MSE_CHANNEL_A 0xF000
- +
- +/* IGP01E1000 DSP reset macros */
- +#define DSP_RESET_ENABLE 0x0
- +#define DSP_RESET_DISABLE 0x2
- +#define E1000_MAX_DSP_RESETS 10
- +
- +/* IGP01E1000 AGC Registers */
- +
- +#define IGP01E1000_AGC_LENGTH_SHIFT 7 /* Coarse - 13:11, Fine - 10:7 */
- +
- +/* 7 bits (3 Coarse + 4 Fine) --> 128 optional values */
- +#define IGP01E1000_AGC_LENGTH_TABLE_SIZE 128
- +
- +/* The precision of the length is +/- 10 meters */
- +#define IGP01E1000_AGC_RANGE 10
- +
- +/* IGP01E1000 PCS Initialization register */
- +/* bits 3:6 in the PCS registers stores the channels polarity */
- +#define IGP01E1000_PHY_POLARITY_MASK 0x0078
- +
- +/* IGP01E1000 GMII FIFO Register */
- +#define IGP01E1000_GMII_FLEX_SPD 0x10 /* Enable flexible speed
- + * on Link-Up */
- +#define IGP01E1000_GMII_SPD 0x20 /* Enable SPD */
- +
- +/* IGP01E1000 Analog Register */
- +#define IGP01E1000_ANALOG_SPARE_FUSE_STATUS 0x20D1
- +#define IGP01E1000_ANALOG_FUSE_STATUS 0x20D0
- +#define IGP01E1000_ANALOG_FUSE_CONTROL 0x20DC
- +#define IGP01E1000_ANALOG_FUSE_BYPASS 0x20DE
- +
- +#define IGP01E1000_ANALOG_FUSE_POLY_MASK 0xF000
- +#define IGP01E1000_ANALOG_FUSE_FINE_MASK 0x0F80
- +#define IGP01E1000_ANALOG_FUSE_COARSE_MASK 0x0070
- +#define IGP01E1000_ANALOG_SPARE_FUSE_ENABLED 0x0100
- +#define IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL 0x0002
- +
- +#define IGP01E1000_ANALOG_FUSE_COARSE_THRESH 0x0040
- +#define IGP01E1000_ANALOG_FUSE_COARSE_10 0x0010
- +#define IGP01E1000_ANALOG_FUSE_FINE_1 0x0080
- +#define IGP01E1000_ANALOG_FUSE_FINE_10 0x0500
- +
- +/* Bit definitions for valid PHY IDs. */
- +#define M88E1000_E_PHY_ID 0x01410C50
- +#define M88E1000_I_PHY_ID 0x01410C30
- +#define M88E1011_I_PHY_ID 0x01410C20
- +#define IGP01E1000_I_PHY_ID 0x02A80380
- +#define M88E1000_12_PHY_ID M88E1000_E_PHY_ID
- +#define M88E1000_14_PHY_ID M88E1000_E_PHY_ID
- +#define M88E1011_I_REV_4 0x04
- +
- +/* Miscellaneous PHY bit definitions. */
- +#define PHY_PREAMBLE 0xFFFFFFFF
- +#define PHY_SOF 0x01
- +#define PHY_OP_READ 0x02
- +#define PHY_OP_WRITE 0x01
- +#define PHY_TURNAROUND 0x02
- +#define PHY_PREAMBLE_SIZE 32
- +#define MII_CR_SPEED_1000 0x0040
- +#define MII_CR_SPEED_100 0x2000
- +#define MII_CR_SPEED_10 0x0000
- +#define E1000_PHY_ADDRESS 0x01
- +#define PHY_AUTO_NEG_TIME 45 /* 4.5 Seconds */
- +#define PHY_FORCE_TIME 20 /* 2.0 Seconds */
- +#define PHY_REVISION_MASK 0xFFFFFFF0
- +#define DEVICE_SPEED_MASK 0x00000300 /* Device Ctrl Reg Speed Mask */
- +#define REG4_SPEED_MASK 0x01E0
- +#define REG9_SPEED_MASK 0x0300
- +#define ADVERTISE_10_HALF 0x0001
- +#define ADVERTISE_10_FULL 0x0002
- +#define ADVERTISE_100_HALF 0x0004
- +#define ADVERTISE_100_FULL 0x0008
- +#define ADVERTISE_1000_HALF 0x0010
- +#define ADVERTISE_1000_FULL 0x0020
- +#define AUTONEG_ADVERTISE_SPEED_DEFAULT 0x002F /* Everything but 1000-Half */
- +#define AUTONEG_ADVERTISE_10_100_ALL 0x000F /* All 10/100 speeds*/
- +#define AUTONEG_ADVERTISE_10_ALL 0x0003 /* 10Mbps Full & Half speeds*/
- +
- +#endif /* _E1000_HW_H_ */
- diff -Naur grub-0.97.orig/netboot/eepro.c grub-0.97/netboot/eepro.c
- --- grub-0.97.orig/netboot/eepro.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/eepro.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,586 +0,0 @@
- -/**************************************************************************
- -Etherboot - BOOTP/TFTP Bootstrap Program
- -Intel EEPRO/10 NIC driver for Etherboot
- -Adapted from Linux eepro.c from kernel 2.2.17
- -
- -This board accepts a 32 pin EEPROM (29C256), however a test with a
- -27C010 shows that this EPROM also works in the socket, but it's not clear
- -how repeatably. The two top address pins appear to be held low, thus
- -the bottom 32kB of the 27C010 is visible in the CPU's address space.
- -To be sure you could put 4 copies of the code in the 27C010, then
- -it doesn't matter whether the extra lines are held low or high, just
- -hopefully not floating as CMOS chips don't like floating inputs.
- -
- -Be careful with seating the EPROM as the socket on my board actually
- -has 34 pins, the top row of 2 are not used.
- -***************************************************************************/
- -
- -/*
- - * This program is free software; you can redistribute it and/or
- - * modify it under the terms of the GNU General Public License as
- - * published by the Free Software Foundation; either version 2, or (at
- - * your option) any later version.
- - */
- -
- -/* to get some global routines like printf */
- -#include "etherboot.h"
- -/* to get the interface to the body of the program */
- -#include "nic.h"
- -/* to get our own prototype */
- -#include "cards.h"
- -/* we use timer2 for microsecond waits */
- -#include "timer.h"
- -
- -#undef DEBUG /* only after include files */
- -
- -/* Different 82595 chips */
- -#define LAN595 0
- -#define LAN595TX 1
- -#define LAN595FX 2
- -#define LAN595FX_10ISA 3
- -
- -#define SLOW_DOWN inb(0x80);
- -
- -/* The station (ethernet) address prefix, used for IDing the board. */
- -#define SA_ADDR0 0x00 /* Etherexpress Pro/10 */
- -#define SA_ADDR1 0xaa
- -#define SA_ADDR2 0x00
- -
- -#define GetBit(x,y) ((x & (1<<y))>>y)
- -
- -/* EEPROM Word 0: */
- -#define ee_PnP 0 /* Plug 'n Play enable bit */
- -#define ee_Word1 1 /* Word 1? */
- -#define ee_BusWidth 2 /* 8/16 bit */
- -#define ee_FlashAddr 3 /* Flash Address */
- -#define ee_FlashMask 0x7 /* Mask */
- -#define ee_AutoIO 6 /* */
- -#define ee_reserved0 7 /* =0! */
- -#define ee_Flash 8 /* Flash there? */
- -#define ee_AutoNeg 9 /* Auto Negotiation enabled? */
- -#define ee_IO0 10 /* IO Address LSB */
- -#define ee_IO0Mask 0x /*...*/
- -#define ee_IO1 15 /* IO MSB */
- -
- -/* EEPROM Word 1: */
- -#define ee_IntSel 0 /* Interrupt */
- -#define ee_IntMask 0x7
- -#define ee_LI 3 /* Link Integrity 0= enabled */
- -#define ee_PC 4 /* Polarity Correction 0= enabled */
- -#define ee_TPE_AUI 5 /* PortSelection 1=TPE */
- -#define ee_Jabber 6 /* Jabber prevention 0= enabled */
- -#define ee_AutoPort 7 /* Auto Port Selection 1= Disabled */
- -#define ee_SMOUT 8 /* SMout Pin Control 0= Input */
- -#define ee_PROM 9 /* Flash EPROM / PROM 0=Flash */
- -#define ee_reserved1 10 /* .. 12 =0! */
- -#define ee_AltReady 13 /* Alternate Ready, 0=normal */
- -#define ee_reserved2 14 /* =0! */
- -#define ee_Duplex 15
- -
- -/* Word2,3,4: */
- -#define ee_IA5 0 /*bit start for individual Addr Byte 5 */
- -#define ee_IA4 8 /*bit start for individual Addr Byte 5 */
- -#define ee_IA3 0 /*bit start for individual Addr Byte 5 */
- -#define ee_IA2 8 /*bit start for individual Addr Byte 5 */
- -#define ee_IA1 0 /*bit start for individual Addr Byte 5 */
- -#define ee_IA0 8 /*bit start for individual Addr Byte 5 */
- -
- -/* Word 5: */
- -#define ee_BNC_TPE 0 /* 0=TPE */
- -#define ee_BootType 1 /* 00=None, 01=IPX, 10=ODI, 11=NDIS */
- -#define ee_BootTypeMask 0x3
- -#define ee_NumConn 3 /* Number of Connections 0= One or Two */
- -#define ee_FlashSock 4 /* Presence of Flash Socket 0= Present */
- -#define ee_PortTPE 5
- -#define ee_PortBNC 6
- -#define ee_PortAUI 7
- -#define ee_PowerMgt 10 /* 0= disabled */
- -#define ee_CP 13 /* Concurrent Processing */
- -#define ee_CPMask 0x7
- -
- -/* Word 6: */
- -#define ee_Stepping 0 /* Stepping info */
- -#define ee_StepMask 0x0F
- -#define ee_BoardID 4 /* Manucaturer Board ID, reserved */
- -#define ee_BoardMask 0x0FFF
- -
- -/* Word 7: */
- -#define ee_INT_TO_IRQ 0 /* int to IRQ Mapping = 0x1EB8 for Pro/10+ */
- -#define ee_FX_INT2IRQ 0x1EB8 /* the _only_ mapping allowed for FX chips */
- -
- -/*..*/
- -#define ee_SIZE 0x40 /* total EEprom Size */
- -#define ee_Checksum 0xBABA /* initial and final value for adding checksum */
- -
- -
- -/* Card identification via EEprom: */
- -#define ee_addr_vendor 0x10 /* Word offset for EISA Vendor ID */
- -#define ee_addr_id 0x11 /* Word offset for Card ID */
- -#define ee_addr_SN 0x12 /* Serial Number */
- -#define ee_addr_CRC_8 0x14 /* CRC over last thee Bytes */
- -
- -
- -#define ee_vendor_intel0 0x25 /* Vendor ID Intel */
- -#define ee_vendor_intel1 0xD4
- -#define ee_id_eepro10p0 0x10 /* ID for eepro/10+ */
- -#define ee_id_eepro10p1 0x31
- -
- -/* now this section could be used by both boards: the oldies and the ee10:
- - * ee10 uses tx buffer before of rx buffer and the oldies the inverse.
- - * (aris)
- - */
- -#define RAM_SIZE 0x8000
- -
- -#define RCV_HEADER 8
- -#define RCV_DEFAULT_RAM 0x6000
- -#define RCV_RAM rcv_ram
- -
- -static unsigned rcv_ram = RCV_DEFAULT_RAM;
- -
- -#define XMT_HEADER 8
- -#define XMT_RAM (RAM_SIZE - RCV_RAM)
- -
- -#define XMT_START ((rcv_start + RCV_RAM) % RAM_SIZE)
- -
- -#define RCV_LOWER_LIMIT (rcv_start >> 8)
- -#define RCV_UPPER_LIMIT (((rcv_start + RCV_RAM) - 2) >> 8)
- -#define XMT_LOWER_LIMIT (XMT_START >> 8)
- -#define XMT_UPPER_LIMIT (((XMT_START + XMT_RAM) - 2) >> 8)
- -
- -#define RCV_START_PRO 0x00
- -#define RCV_START_10 XMT_RAM
- - /* by default the old driver */
- -static unsigned rcv_start = RCV_START_PRO;
- -
- -#define RCV_DONE 0x0008
- -#define RX_OK 0x2000
- -#define RX_ERROR 0x0d81
- -
- -#define TX_DONE_BIT 0x0080
- -#define CHAIN_BIT 0x8000
- -#define XMT_STATUS 0x02
- -#define XMT_CHAIN 0x04
- -#define XMT_COUNT 0x06
- -
- -#define BANK0_SELECT 0x00
- -#define BANK1_SELECT 0x40
- -#define BANK2_SELECT 0x80
- -
- -/* Bank 0 registers */
- -#define COMMAND_REG 0x00 /* Register 0 */
- -#define MC_SETUP 0x03
- -#define XMT_CMD 0x04
- -#define DIAGNOSE_CMD 0x07
- -#define RCV_ENABLE_CMD 0x08
- -#define RCV_DISABLE_CMD 0x0a
- -#define STOP_RCV_CMD 0x0b
- -#define RESET_CMD 0x0e
- -#define POWER_DOWN_CMD 0x18
- -#define RESUME_XMT_CMD 0x1c
- -#define SEL_RESET_CMD 0x1e
- -#define STATUS_REG 0x01 /* Register 1 */
- -#define RX_INT 0x02
- -#define TX_INT 0x04
- -#define EXEC_STATUS 0x30
- -#define ID_REG 0x02 /* Register 2 */
- -#define R_ROBIN_BITS 0xc0 /* round robin counter */
- -#define ID_REG_MASK 0x2c
- -#define ID_REG_SIG 0x24
- -#define AUTO_ENABLE 0x10
- -#define INT_MASK_REG 0x03 /* Register 3 */
- -#define RX_STOP_MASK 0x01
- -#define RX_MASK 0x02
- -#define TX_MASK 0x04
- -#define EXEC_MASK 0x08
- -#define ALL_MASK 0x0f
- -#define IO_32_BIT 0x10
- -#define RCV_BAR 0x04 /* The following are word (16-bit) registers */
- -#define RCV_STOP 0x06
- -
- -#define XMT_BAR_PRO 0x0a
- -#define XMT_BAR_10 0x0b
- -static unsigned xmt_bar = XMT_BAR_PRO;
- -
- -#define HOST_ADDRESS_REG 0x0c
- -#define IO_PORT 0x0e
- -#define IO_PORT_32_BIT 0x0c
- -
- -/* Bank 1 registers */
- -#define REG1 0x01
- -#define WORD_WIDTH 0x02
- -#define INT_ENABLE 0x80
- -#define INT_NO_REG 0x02
- -#define RCV_LOWER_LIMIT_REG 0x08
- -#define RCV_UPPER_LIMIT_REG 0x09
- -
- -#define XMT_LOWER_LIMIT_REG_PRO 0x0a
- -#define XMT_UPPER_LIMIT_REG_PRO 0x0b
- -#define XMT_LOWER_LIMIT_REG_10 0x0b
- -#define XMT_UPPER_LIMIT_REG_10 0x0a
- -static unsigned xmt_lower_limit_reg = XMT_LOWER_LIMIT_REG_PRO;
- -static unsigned xmt_upper_limit_reg = XMT_UPPER_LIMIT_REG_PRO;
- -
- -/* Bank 2 registers */
- -#define XMT_Chain_Int 0x20 /* Interrupt at the end of the transmit chain */
- -#define XMT_Chain_ErrStop 0x40 /* Interrupt at the end of the chain even if there are errors */
- -#define RCV_Discard_BadFrame 0x80 /* Throw bad frames away, and continue to receive others */
- -#define REG2 0x02
- -#define PRMSC_Mode 0x01
- -#define Multi_IA 0x20
- -#define REG3 0x03
- -#define TPE_BIT 0x04
- -#define BNC_BIT 0x20
- -#define REG13 0x0d
- -#define FDX 0x00
- -#define A_N_ENABLE 0x02
- -
- -#define I_ADD_REG0 0x04
- -#define I_ADD_REG1 0x05
- -#define I_ADD_REG2 0x06
- -#define I_ADD_REG3 0x07
- -#define I_ADD_REG4 0x08
- -#define I_ADD_REG5 0x09
- -
- -#define EEPROM_REG_PRO 0x0a
- -#define EEPROM_REG_10 0x0b
- -static unsigned eeprom_reg = EEPROM_REG_PRO;
- -
- -#define EESK 0x01
- -#define EECS 0x02
- -#define EEDI 0x04
- -#define EEDO 0x08
- -
- -/* The horrible routine to read a word from the serial EEPROM. */
- -/* IMPORTANT - the 82595 will be set to Bank 0 after the eeprom is read */
- -
- -/* The delay between EEPROM clock transitions. */
- -#define eeprom_delay() { udelay(40); }
- -#define EE_READ_CMD (6 << 6)
- -
- -/* do a full reset */
- -#define eepro_full_reset(ioaddr) outb(RESET_CMD, ioaddr); udelay(40);
- -
- -/* do a nice reset */
- -#define eepro_sel_reset(ioaddr) { \
- - outb(SEL_RESET_CMD, ioaddr); \
- - SLOW_DOWN; \
- - SLOW_DOWN; \
- - }
- -
- -/* clear all interrupts */
- -#define eepro_clear_int(ioaddr) outb(ALL_MASK, ioaddr + STATUS_REG)
- -
- -/* enable rx */
- -#define eepro_en_rx(ioaddr) outb(RCV_ENABLE_CMD, ioaddr)
- -
- -/* disable rx */
- -#define eepro_dis_rx(ioaddr) outb(RCV_DISABLE_CMD, ioaddr)
- -
- -/* switch bank */
- -#define eepro_sw2bank0(ioaddr) outb(BANK0_SELECT, ioaddr)
- -#define eepro_sw2bank1(ioaddr) outb(BANK1_SELECT, ioaddr)
- -#define eepro_sw2bank2(ioaddr) outb(BANK2_SELECT, ioaddr)
- -
- -static unsigned int rx_start, tx_start;
- -static int tx_last;
- -static unsigned tx_end;
- -static int eepro = 0;
- -static unsigned short ioaddr = 0;
- -static unsigned int mem_start, mem_end = RCV_DEFAULT_RAM / 1024;
- -
- -#define udelay(n) waiton_timer2(((n)*TICKS_PER_MS)/1000)
- -
- -/**************************************************************************
- -RESET - Reset adapter
- -***************************************************************************/
- -static void eepro_reset(struct nic *nic)
- -{
- - int temp_reg, i;
- -
- - /* put the card in its initial state */
- - eepro_sw2bank2(ioaddr); /* be careful, bank2 now */
- - temp_reg = inb(ioaddr + eeprom_reg);
- -#ifdef DEBUG
- - printf("Stepping %d\n", temp_reg >> 5);
- -#endif
- - if (temp_reg & 0x10) /* check the TurnOff Enable bit */
- - outb(temp_reg & 0xEF, ioaddr + eeprom_reg);
- - for (i = 0; i < ETH_ALEN; i++) /* fill the MAC address */
- - outb(nic->node_addr[i], ioaddr + I_ADD_REG0 + i);
- - temp_reg = inb(ioaddr + REG1);
- - /* setup Transmit Chaining and discard bad RCV frames */
- - outb(temp_reg | XMT_Chain_Int | XMT_Chain_ErrStop
- - | RCV_Discard_BadFrame, ioaddr + REG1);
- - temp_reg = inb(ioaddr + REG2); /* match broadcast */
- - outb(temp_reg | 0x14, ioaddr + REG2);
- - temp_reg = inb(ioaddr + REG3);
- - outb(temp_reg & 0x3F, ioaddr + REG3); /* clear test mode */
- - /* set the receiving mode */
- - eepro_sw2bank1(ioaddr); /* be careful, bank1 now */
- - /* initialise the RCV and XMT upper and lower limits */
- - outb(RCV_LOWER_LIMIT, ioaddr + RCV_LOWER_LIMIT_REG);
- - outb(RCV_UPPER_LIMIT, ioaddr + RCV_UPPER_LIMIT_REG);
- - outb(XMT_LOWER_LIMIT, ioaddr + xmt_lower_limit_reg);
- - outb(XMT_UPPER_LIMIT, ioaddr + xmt_upper_limit_reg);
- - eepro_sw2bank0(ioaddr); /* Switch back to bank 0 */
- - eepro_clear_int(ioaddr);
- - /* Initialise RCV */
- - outw(rx_start = (RCV_LOWER_LIMIT << 8), ioaddr + RCV_BAR);
- - outw(((RCV_UPPER_LIMIT << 8) | 0xFE), ioaddr + RCV_STOP);
- - /* Intialise XMT */
- - outw((XMT_LOWER_LIMIT << 8), ioaddr + xmt_bar);
- - eepro_sel_reset(ioaddr);
- - tx_start = tx_end = (XMT_LOWER_LIMIT << 8);
- - tx_last = 0;
- - eepro_en_rx(ioaddr);
- -}
- -
- -/**************************************************************************
- -POLL - Wait for a frame
- -***************************************************************************/
- -static int eepro_poll(struct nic *nic)
- -{
- - int i;
- - unsigned int rcv_car = rx_start;
- - unsigned int rcv_event, rcv_status, rcv_next_frame, rcv_size;
- -
- - /* return true if there's an ethernet packet ready to read */
- - /* nic->packet should contain data on return */
- - /* nic->packetlen should contain length of data */
- -#if 0
- - if ((inb(ioaddr + STATUS_REG) & 0x40) == 0)
- - return (0);
- - outb(0x40, ioaddr + STATUS_REG);
- -#endif
- - outw(rcv_car, ioaddr + HOST_ADDRESS_REG);
- - rcv_event = inw(ioaddr + IO_PORT);
- - if (rcv_event != RCV_DONE)
- - return (0);
- - rcv_status = inw(ioaddr + IO_PORT);
- - rcv_next_frame = inw(ioaddr + IO_PORT);
- - rcv_size = inw(ioaddr + IO_PORT);
- -#if 0
- - printf("%hX %hX %d %hhX\n", rcv_status, rcv_next_frame, rcv_size,
- - inb(ioaddr + STATUS_REG));
- -#endif
- - if ((rcv_status & (RX_OK|RX_ERROR)) != RX_OK) {
- - printf("Receive error %hX\n", rcv_status);
- - return (0);
- - }
- - rcv_size &= 0x3FFF;
- - insw(ioaddr + IO_PORT, nic->packet, ((rcv_size + 3) >> 1));
- -#if 0
- - for (i = 0; i < 48; i++) {
- - printf("%hhX", nic->packet[i]);
- - putchar(i % 16 == 15 ? '\n' : ' ');
- - }
- -#endif
- - nic->packetlen = rcv_size;
- - rcv_car = rx_start + RCV_HEADER + rcv_size;
- - rx_start = rcv_next_frame;
- - if (rcv_car == 0)
- - rcv_car = ((RCV_UPPER_LIMIT << 8) | 0xff);
- - outw(rcv_car - 1, ioaddr + RCV_STOP);
- - return (1);
- -}
- -
- -/**************************************************************************
- -TRANSMIT - Transmit a frame
- -***************************************************************************/
- -static void eepro_transmit(
- - struct nic *nic,
- - const char *d, /* Destination */
- - unsigned int t, /* Type */
- - unsigned int s, /* size */
- - const char *p) /* Packet */
- -{
- - unsigned int status, tx_available, last, end, length;
- - unsigned short type;
- - int boguscount = 20;
- -
- - length = s + ETH_HLEN;
- - if (tx_end > tx_start)
- - tx_available = XMT_RAM - (tx_end - tx_start);
- - else if (tx_end < tx_start)
- - tx_available = tx_start - tx_end;
- - else
- - tx_available = XMT_RAM;
- - last = tx_end;
- - end = last + (((length + 3) >> 1) << 1) + XMT_HEADER;
- - if (end >= (XMT_UPPER_LIMIT << 8)) {
- - last = (XMT_LOWER_LIMIT << 8);
- - end = last + (((length + 3) >> 1) << 1) + XMT_HEADER;
- - }
- - outw(last, ioaddr + HOST_ADDRESS_REG);
- - outw(XMT_CMD, ioaddr + IO_PORT);
- - outw(0, ioaddr + IO_PORT);
- - outw(end, ioaddr + IO_PORT);
- - outw(length, ioaddr + IO_PORT);
- - outsw(ioaddr + IO_PORT, d, ETH_ALEN / 2);
- - outsw(ioaddr + IO_PORT, nic->node_addr, ETH_ALEN / 2);
- - type = htons(t);
- - outsw(ioaddr + IO_PORT, &type, sizeof(type) / 2);
- - outsw(ioaddr + IO_PORT, p, (s + 3) >> 1);
- - /* A dummy read to flush the DRAM write pipeline */
- - status = inw(ioaddr + IO_PORT);
- - outw(last, ioaddr + xmt_bar);
- - outb(XMT_CMD, ioaddr);
- - tx_start = last;
- - tx_last = last;
- - tx_end = end;
- -#if 0
- - printf("%d %d\n", tx_start, tx_end);
- -#endif
- - while (boguscount > 0) {
- - if (((status = inw(ioaddr + IO_PORT)) & TX_DONE_BIT) == 0) {
- - udelay(40);
- - boguscount--;
- - continue;
- - }
- -#if DEBUG
- - if ((status & 0x2000) == 0)
- - printf("Transmit status %hX\n", status);
- -#endif
- - }
- -}
- -
- -/**************************************************************************
- -DISABLE - Turn off ethernet interface
- -***************************************************************************/
- -static void eepro_disable(struct nic *nic)
- -{
- - eepro_sw2bank0(ioaddr); /* Switch to bank 0 */
- - /* Flush the Tx and disable Rx */
- - outb(STOP_RCV_CMD, ioaddr);
- - tx_start = tx_end = (XMT_LOWER_LIMIT << 8);
- - tx_last = 0;
- - /* Reset the 82595 */
- - eepro_full_reset(ioaddr);
- -}
- -
- -static int read_eeprom(int location)
- -{
- - int i;
- - unsigned short retval = 0;
- - int ee_addr = ioaddr + eeprom_reg;
- - int read_cmd = location | EE_READ_CMD;
- - int ctrl_val = EECS;
- -
- - if (eepro == LAN595FX_10ISA) {
- - eepro_sw2bank1(ioaddr);
- - outb(0x00, ioaddr + STATUS_REG);
- - }
- - eepro_sw2bank2(ioaddr);
- - outb(ctrl_val, ee_addr);
- - /* shift the read command bits out */
- - for (i = 8; i >= 0; i--) {
- - short outval = (read_cmd & (1 << i)) ? ctrl_val | EEDI : ctrl_val;
- - outb(outval, ee_addr);
- - outb(outval | EESK, ee_addr); /* EEPROM clock tick */
- - eeprom_delay();
- - outb(outval, ee_addr); /* finish EEPROM clock tick */
- - eeprom_delay();
- - }
- - outb(ctrl_val, ee_addr);
- - for (i = 16; i > 0; i--) {
- - outb(ctrl_val | EESK, ee_addr);
- - eeprom_delay();
- - retval = (retval << 1) | ((inb(ee_addr) & EEDO) ? 1 : 0);
- - outb(ctrl_val, ee_addr);
- - eeprom_delay();
- - }
- - /* terminate the EEPROM access */
- - ctrl_val &= ~EECS;
- - outb(ctrl_val | EESK, ee_addr);
- - eeprom_delay();
- - outb(ctrl_val, ee_addr);
- - eeprom_delay();
- - eepro_sw2bank0(ioaddr);
- - return (retval);
- -}
- -
- -static int eepro_probe1(struct nic *nic)
- -{
- - int i, id, counter, l_eepro = 0;
- - union {
- - unsigned char caddr[ETH_ALEN];
- - unsigned short saddr[ETH_ALEN/2];
- - } station_addr;
- - char *name;
- -
- - id = inb(ioaddr + ID_REG);
- - if ((id & ID_REG_MASK) != ID_REG_SIG)
- - return (0);
- - counter = id & R_ROBIN_BITS;
- - if (((id = inb(ioaddr + ID_REG)) & R_ROBIN_BITS) != (counter + 0x40))
- - return (0);
- - /* yes the 82595 has been found */
- - station_addr.saddr[2] = read_eeprom(2);
- - if (station_addr.saddr[2] == 0x0000 || station_addr.saddr[2] == 0xFFFF) {
- - l_eepro = 3;
- - eepro = LAN595FX_10ISA;
- - eeprom_reg= EEPROM_REG_10;
- - rcv_start = RCV_START_10;
- - xmt_lower_limit_reg = XMT_LOWER_LIMIT_REG_10;
- - xmt_upper_limit_reg = XMT_UPPER_LIMIT_REG_10;
- - station_addr.saddr[2] = read_eeprom(2);
- - }
- - station_addr.saddr[1] = read_eeprom(3);
- - station_addr.saddr[0] = read_eeprom(4);
- - if (l_eepro)
- - name = "Intel EtherExpress 10 ISA";
- - else if (read_eeprom(7) == ee_FX_INT2IRQ) {
- - name = "Intel EtherExpress Pro/10+ ISA";
- - l_eepro = 2;
- - } else if (station_addr.saddr[0] == SA_ADDR1) {
- - name = "Intel EtherExpress Pro/10 ISA";
- - l_eepro = 1;
- - } else {
- - l_eepro = 0;
- - name = "Intel 82595-based LAN card";
- - }
- - station_addr.saddr[0] = swap16(station_addr.saddr[0]);
- - station_addr.saddr[1] = swap16(station_addr.saddr[1]);
- - station_addr.saddr[2] = swap16(station_addr.saddr[2]);
- - for (i = 0; i < ETH_ALEN; i++) {
- - nic->node_addr[i] = station_addr.caddr[i];
- - }
- - printf("\n%s ioaddr %#hX, addr %!", name, ioaddr, nic->node_addr);
- - mem_start = RCV_LOWER_LIMIT << 8;
- - if ((mem_end & 0x3F) < 3 || (mem_end & 0x3F) > 29)
- - mem_end = RCV_UPPER_LIMIT << 8;
- - else {
- - mem_end = mem_end * 1024 + (RCV_LOWER_LIMIT << 8);
- - rcv_ram = mem_end - (RCV_LOWER_LIMIT << 8);
- - }
- - printf(", Rx mem %dK, if %s\n", (mem_end - mem_start) >> 10,
- - GetBit(read_eeprom(5), ee_BNC_TPE) ? "BNC" : "TP");
- - return (1);
- -}
- -
- -/**************************************************************************
- -PROBE - Look for an adapter, this routine's visible to the outside
- -***************************************************************************/
- -struct nic *eepro_probe(struct nic *nic, unsigned short *probe_addrs)
- -{
- - unsigned short *p;
- - /* same probe list as the Linux driver */
- - static unsigned short ioaddrs[] = {
- - 0x300, 0x210, 0x240, 0x280, 0x2C0, 0x200, 0x320, 0x340, 0x360, 0};
- -
- - if (probe_addrs == 0 || probe_addrs[0] == 0)
- - probe_addrs = ioaddrs;
- - for (p = probe_addrs; (ioaddr = *p) != 0; p++) {
- - if (eepro_probe1(nic))
- - break;
- - }
- - if (*p == 0)
- - return (0);
- - eepro_reset(nic);
- - /* point to NIC specific routines */
- - nic->reset = eepro_reset;
- - nic->poll = eepro_poll;
- - nic->transmit = eepro_transmit;
- - nic->disable = eepro_disable;
- - return (nic);
- -}
- diff -Naur grub-0.97.orig/netboot/eepro100.c grub-0.97/netboot/eepro100.c
- --- grub-0.97.orig/netboot/eepro100.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/eepro100.c 2005-08-31 19:03:35.000000000 +0000
- @@ -80,8 +80,8 @@
- *
- * Caveats:
- *
- - * The etherboot framework moves the code to the 32k segment from
- - * 0x98000 to 0xa0000. There is just a little room between the end of
- + * The Etherboot framework moves the code to the 48k segment from
- + * 0x94000 to 0xa0000. There is just a little room between the end of
- * this driver and the 0xa0000 address. If you compile in too many
- * features, this will overflow.
- * The number under "hex" in the output of size that scrolls by while
- @@ -92,17 +92,13 @@
- /* The etherboot authors seem to dislike the argument ordering in
- * outb macros that Linux uses. I disklike the confusion that this
- * has caused even more.... This file uses the Linux argument ordering. */
- -/* Sorry not us. It's inherted code from FreeBSD. [The authors] */
- +/* Sorry not us. It's inherited code from FreeBSD. [The authors] */
-
- #include "etherboot.h"
- #include "nic.h"
- #include "pci.h"
- -#include "cards.h"
- #include "timer.h"
-
- -#undef virt_to_bus
- -#define virt_to_bus(x) ((unsigned long)x)
- -
- static int ioaddr;
-
- typedef unsigned char u8;
- @@ -121,6 +117,18 @@
- SCBEarlyRx = 20, /* Early receive byte count. */
- };
-
- +enum SCBCmdBits {
- + SCBMaskCmdDone=0x8000, SCBMaskRxDone=0x4000, SCBMaskCmdIdle=0x2000,
- + SCBMaskRxSuspend=0x1000, SCBMaskEarlyRx=0x0800, SCBMaskFlowCtl=0x0400,
- + SCBTriggerIntr=0x0200, SCBMaskAll=0x0100,
- + /* The rest are Rx and Tx commands. */
- + CUStart=0x0010, CUResume=0x0020, CUStatsAddr=0x0040, CUShowStats=0x0050,
- + CUCmdBase=0x0060, /* CU Base address (set to zero) . */
- + CUDumpStats=0x0070, /* Dump then reset stats counters. */
- + RxStart=0x0001, RxResume=0x0002, RxAbort=0x0004, RxAddrLoad=0x0006,
- + RxResumeNoResources=0x0007,
- +};
- +
- static int do_eeprom_cmd(int cmd, int cmd_len);
- void hd(void *where, int n);
-
- @@ -139,8 +147,6 @@
- #define EE_WRITE_1 0x4806
- #define EE_ENB (0x4800 | EE_CS)
-
- -#define udelay(n) waiton_timer2(((n)*TICKS_PER_MS)/1000)
- -
- /* The EEPROM commands include the alway-set leading bit. */
- #define EE_READ_CMD 6
-
- @@ -184,9 +190,18 @@
- Typically this takes 0 ticks. */
- static inline void wait_for_cmd_done(int cmd_ioaddr)
- {
- - short wait = 100;
- - do ;
- - while(inb(cmd_ioaddr) && --wait >= 0);
- + int wait = 0;
- + int delayed_cmd;
- +
- + do
- + if (inb(cmd_ioaddr) == 0) return;
- + while(++wait <= 100);
- + delayed_cmd = inb(cmd_ioaddr);
- + do
- + if (inb(cmd_ioaddr) == 0) break;
- + while(++wait <= 10000);
- + printf("Command %2.2x was not immediately accepted, %d ticks!\n",
- + delayed_cmd, wait);
- }
-
- /* Elements of the dump_statistics block. This block must be lword aligned. */
- @@ -212,35 +227,30 @@
-
- /* A speedo3 TX buffer descriptor with two buffers... */
- static struct TxFD {
- - volatile s16 status;
- - s16 command;
- - u32 link; /* void * */
- - u32 tx_desc_addr; /* (almost) Always points to the tx_buf_addr element. */
- - s32 count; /* # of TBD (=2), Tx start thresh., etc. */
- - /* This constitutes two "TBD" entries: hdr and data */
- - u32 tx_buf_addr0; /* void *, header of frame to be transmitted. */
- - s32 tx_buf_size0; /* Length of Tx hdr. */
- - u32 tx_buf_addr1; /* void *, data to be transmitted. */
- - s32 tx_buf_size1; /* Length of Tx data. */
- + volatile s16 status;
- + s16 command;
- + u32 link; /* void * */
- + u32 tx_desc_addr; /* (almost) Always points to the tx_buf_addr element. */
- + s32 count; /* # of TBD (=2), Tx start thresh., etc. */
- + /* This constitutes two "TBD" entries: hdr and data */
- + u32 tx_buf_addr0; /* void *, header of frame to be transmitted. */
- + s32 tx_buf_size0; /* Length of Tx hdr. */
- + u32 tx_buf_addr1; /* void *, data to be transmitted. */
- + s32 tx_buf_size1; /* Length of Tx data. */
- } txfd;
-
- struct RxFD { /* Receive frame descriptor. */
- - volatile s16 status;
- - s16 command;
- - u32 link; /* struct RxFD * */
- - u32 rx_buf_addr; /* void * */
- - u16 count;
- - u16 size;
- - char packet[1518];
- + volatile s16 status;
- + s16 command;
- + u32 link; /* struct RxFD * */
- + u32 rx_buf_addr; /* void * */
- + u16 count;
- + u16 size;
- + char packet[1518];
- };
-
- -#ifdef USE_LOWMEM_BUFFER
- -#define rxfd ((struct RxFD *)(0x10000 - sizeof(struct RxFD)))
- -#define ACCESS(x) x->
- -#else
- static struct RxFD rxfd;
- #define ACCESS(x) x.
- -#endif
-
- static int congenb = 0; /* Enable congestion control in the DP83840. */
- static int txfifo = 8; /* Tx FIFO threshold in 4 byte units, 0-15 */
- @@ -256,8 +266,7 @@
- u32 link;
- unsigned char data[22];
- } confcmd = {
- - 0, CmdConfigure,
- - (u32) & txfd,
- + 0, 0, 0, /* filled in later */
- {22, 0x08, 0, 0, 0, 0x80, 0x32, 0x03, 1, /* 1=Use MII 0=Use AUI */
- 0, 0x2E, 0, 0x60, 0,
- 0xf2, 0x48, 0, 0x40, 0xf2, 0x80, /* 0x40=Force full-duplex */
- @@ -276,19 +285,20 @@
-
- static int mdio_write(int phy_id, int location, int value)
- {
- - int val, boguscnt = 64*4; /* <64 usec. to complete, typ 27 ticks */
- + int val, boguscnt = 64*4; /* <64 usec. to complete, typ 27 ticks */
-
- - outl(0x04000000 | (location<<16) | (phy_id<<21) | value,
- - ioaddr + SCBCtrlMDI);
- - do {
- - udelay(16);
- -
- - val = inl(ioaddr + SCBCtrlMDI);
- - if (--boguscnt < 0) {
- - printf(" mdio_write() timed out with val = %X.\n", val);
- - }
- - } while (! (val & 0x10000000));
- - return val & 0xffff;
- + outl(0x04000000 | (location<<16) | (phy_id<<21) | value,
- + ioaddr + SCBCtrlMDI);
- + do {
- + udelay(16);
- +
- + val = inl(ioaddr + SCBCtrlMDI);
- + if (--boguscnt < 0) {
- + printf(" mdio_write() timed out with val = %X.\n", val);
- + break;
- + }
- + } while (! (val & 0x10000000));
- + return val & 0xffff;
- }
-
- /* Support function: mdio_read
- @@ -298,17 +308,19 @@
- */
- static int mdio_read(int phy_id, int location)
- {
- - int val, boguscnt = 64*4; /* <64 usec. to complete, typ 27 ticks */
- - outl(0x08000000 | (location<<16) | (phy_id<<21), ioaddr + SCBCtrlMDI);
- - do {
- - udelay(16);
- -
- - val = inl(ioaddr + SCBCtrlMDI);
- - if (--boguscnt < 0) {
- - printf( " mdio_read() timed out with val = %X.\n", val);
- - }
- - } while (! (val & 0x10000000));
- - return val & 0xffff;
- + int val, boguscnt = 64*4; /* <64 usec. to complete, typ 27 ticks */
- + outl(0x08000000 | (location<<16) | (phy_id<<21), ioaddr + SCBCtrlMDI);
- + do {
- + udelay(16);
- +
- + val = inl(ioaddr + SCBCtrlMDI);
- +
- + if (--boguscnt < 0) {
- + printf( " mdio_read() timed out with val = %X.\n", val);
- + break;
- + }
- + } while (! (val & 0x10000000));
- + return val & 0xffff;
- }
-
- /* The fixes for the code were kindly provided by Dragan Stancevic
- @@ -340,25 +352,26 @@
- return retval;
- }
-
- +#if 0
- static inline void whereami (const char *str)
- {
- -#if 0
- printf ("%s\n", str);
- sleep (2);
- -#endif
- }
- +#else
- +#define whereami(s)
- +#endif
-
- -/* function: eepro100_reset
- - * resets the card. This is used to allow Etherboot to probe the card again
- - * from a "virginal" state....
- - * Arguments: none
- - *
- - * returns: void.
- - */
- -
- -static void eepro100_reset(struct nic *nic)
- +static void eepro100_irq(struct nic *nic __unused, irq_action_t action __unused)
- {
- - outl(0, ioaddr + SCBPort);
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- }
-
- /* function: eepro100_transmit
- @@ -373,61 +386,87 @@
-
- static void eepro100_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
- {
- - struct eth_hdr {
- - unsigned char dst_addr[ETH_ALEN];
- - unsigned char src_addr[ETH_ALEN];
- - unsigned short type;
- - } hdr;
- - unsigned short status;
- - int to;
- - int s1, s2;
- -
- - status = inw(ioaddr + SCBStatus);
- - /* Acknowledge all of the current interrupt sources ASAP. */
- - outw(status & 0xfc00, ioaddr + SCBStatus);
- + struct eth_hdr {
- + unsigned char dst_addr[ETH_ALEN];
- + unsigned char src_addr[ETH_ALEN];
- + unsigned short type;
- + } hdr;
- + unsigned short status;
- + int s1, s2;
- +
- + status = inw(ioaddr + SCBStatus);
- + /* Acknowledge all of the current interrupt sources ASAP. */
- + outw(status & 0xfc00, ioaddr + SCBStatus);
-
- #ifdef DEBUG
- - printf ("transmitting type %hX packet (%d bytes). status = %hX, cmd=%hX\n",
- - t, s, status, inw (ioaddr + SCBCmd));
- + printf ("transmitting type %hX packet (%d bytes). status = %hX, cmd=%hX\n",
- + t, s, status, inw (ioaddr + SCBCmd));
- #endif
-
- - memcpy (&hdr.dst_addr, d, ETH_ALEN);
- - memcpy (&hdr.src_addr, nic->node_addr, ETH_ALEN);
- + memcpy (&hdr.dst_addr, d, ETH_ALEN);
- + memcpy (&hdr.src_addr, nic->node_addr, ETH_ALEN);
-
- - hdr.type = htons (t);
- + hdr.type = htons (t);
-
- - txfd.status = 0;
- - txfd.command = CmdSuspend | CmdTx | CmdTxFlex;
- - txfd.link = virt_to_bus (&txfd);
- - txfd.count = 0x02208000;
- - txfd.tx_desc_addr = (u32)&txfd.tx_buf_addr0;
- + txfd.status = 0;
- + txfd.command = CmdSuspend | CmdTx | CmdTxFlex;
- + txfd.link = virt_to_bus (&txfd);
- + txfd.count = 0x02208000;
- + txfd.tx_desc_addr = virt_to_bus(&txfd.tx_buf_addr0);
-
- - txfd.tx_buf_addr0 = virt_to_bus (&hdr);
- - txfd.tx_buf_size0 = sizeof (hdr);
- + txfd.tx_buf_addr0 = virt_to_bus (&hdr);
- + txfd.tx_buf_size0 = sizeof (hdr);
-
- - txfd.tx_buf_addr1 = virt_to_bus (p);
- - txfd.tx_buf_size1 = s;
- + txfd.tx_buf_addr1 = virt_to_bus (p);
- + txfd.tx_buf_size1 = s;
-
- #ifdef DEBUG
- - printf ("txfd: \n");
- - hd (&txfd, sizeof (txfd));
- + printf ("txfd: \n");
- + hd (&txfd, sizeof (txfd));
- #endif
-
- - outl(virt_to_bus(&txfd), ioaddr + SCBPointer);
- - outw(INT_MASK | CU_START, ioaddr + SCBCmd);
- - wait_for_cmd_done(ioaddr + SCBCmd);
- -
- - s1 = inw (ioaddr + SCBStatus);
- - load_timer2(10*TICKS_PER_MS); /* timeout 10 ms for transmit */
- - while (!txfd.status && timer2_running())
- - /* Wait */;
- - s2 = inw (ioaddr + SCBStatus);
- + outl(virt_to_bus(&txfd), ioaddr + SCBPointer);
- + outw(INT_MASK | CU_START, ioaddr + SCBCmd);
- + wait_for_cmd_done(ioaddr + SCBCmd);
- +
- + s1 = inw (ioaddr + SCBStatus);
- + load_timer2(10*TICKS_PER_MS); /* timeout 10 ms for transmit */
- + while (!txfd.status && timer2_running())
- + /* Wait */;
- + s2 = inw (ioaddr + SCBStatus);
-
- #ifdef DEBUG
- - printf ("s1 = %hX, s2 = %hX.\n", s1, s2);
- + printf ("s1 = %hX, s2 = %hX.\n", s1, s2);
- #endif
- }
-
- +/*
- + * Sometimes the receiver stops making progress. This routine knows how to
- + * get it going again, without losing packets or being otherwise nasty like
- + * a chip reset would be. Previously the driver had a whole sequence
- + * of if RxSuspended, if it's no buffers do one thing, if it's no resources,
- + * do another, etc. But those things don't really matter. Separate logic
- + * in the ISR provides for allocating buffers--the other half of operation
- + * is just making sure the receiver is active. speedo_rx_soft_reset does that.
- + * This problem with the old, more involved algorithm is shown up under
- + * ping floods on the order of 60K packets/second on a 100Mbps fdx network.
- + */
- +static void
- +speedo_rx_soft_reset(void)
- +{
- + wait_for_cmd_done(ioaddr + SCBCmd);
- + /*
- + * Put the hardware into a known state.
- + */
- + outb(RX_ABORT, ioaddr + SCBCmd);
- +
- + ACCESS(rxfd)rx_buf_addr = 0xffffffff;
- +
- + wait_for_cmd_done(ioaddr + SCBCmd);
- +
- + outb(RX_START, ioaddr + SCBCmd);
- +}
- +
- /* function: eepro100_poll / eth_poll
- * This recieves a packet from the network.
- *
- @@ -440,34 +479,87 @@
- * returns the length of the packet in nic->packetlen.
- */
-
- -static int eepro100_poll(struct nic *nic)
- +static int eepro100_poll(struct nic *nic, int retrieve)
- {
- - if (!ACCESS(rxfd)status)
- - return 0;
- + unsigned int status;
- + status = inw(ioaddr + SCBStatus);
-
- - /* Ok. We got a packet. Now restart the reciever.... */
- - ACCESS(rxfd)status = 0;
- - ACCESS(rxfd)command = 0xc000;
- - outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer);
- - outw(INT_MASK | RX_START, ioaddr + SCBCmd);
- - wait_for_cmd_done(ioaddr + SCBCmd);
- + if (!ACCESS(rxfd)status)
- + return 0;
- +
- + /* There is a packet ready */
- + if ( ! retrieve ) return 1;
- +
- + /*
- + * The chip may have suspended reception for various reasons.
- + * Check for that, and re-prime it should this be the case.
- + */
- + switch ((status >> 2) & 0xf) {
- + case 0: /* Idle */
- + break;
- + case 1: /* Suspended */
- + case 2: /* No resources (RxFDs) */
- + case 9: /* Suspended with no more RBDs */
- + case 10: /* No resources due to no RBDs */
- + case 12: /* Ready with no RBDs */
- + speedo_rx_soft_reset();
- + break;
- + case 3: case 5: case 6: case 7: case 8:
- + case 11: case 13: case 14: case 15:
- + /* these are all reserved values */
- + break;
- + }
- +
- + /* Ok. We got a packet. Now restart the reciever.... */
- + ACCESS(rxfd)status = 0;
- + ACCESS(rxfd)command = 0xc000;
- + outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer);
- + outw(INT_MASK | RX_START, ioaddr + SCBCmd);
- + wait_for_cmd_done(ioaddr + SCBCmd);
-
- #ifdef DEBUG
- - printf ("Got a packet: Len = %d.\n", ACCESS(rxfd)count & 0x3fff);
- + printf ("Got a packet: Len = %d.\n", ACCESS(rxfd)count & 0x3fff);
- #endif
- - nic->packetlen = ACCESS(rxfd)count & 0x3fff;
- - memcpy (nic->packet, ACCESS(rxfd)packet, nic->packetlen);
- + nic->packetlen = ACCESS(rxfd)count & 0x3fff;
- + memcpy (nic->packet, ACCESS(rxfd)packet, nic->packetlen);
- #ifdef DEBUG
- - hd (nic->packet, 0x30);
- + hd (nic->packet, 0x30);
- #endif
- - return 1;
- + return 1;
- }
-
- -static void eepro100_disable(struct nic *nic)
- +/* function: eepro100_disable
- + * resets the card. This is used to allow Etherboot or Linux
- + * to probe the card again from a "virginal" state....
- + * Arguments: none
- + *
- + * returns: void.
- + */
- +static void eepro100_disable(struct dev *dev __unused)
- {
- - /* See if this PartialReset solves the problem with interfering with
- - kernel operation after Etherboot hands over. - Ken 20001102 */
- - outl(2, ioaddr + SCBPort);
- +/* from eepro100_reset */
- + outl(0, ioaddr + SCBPort);
- +/* from eepro100_disable */
- + /* See if this PartialReset solves the problem with interfering with
- + kernel operation after Etherboot hands over. - Ken 20001102 */
- + outl(2, ioaddr + SCBPort);
- +
- + /* The following is from the Intel e100 driver.
- + * This hopefully solves the problem with hanging hard DOS images. */
- +
- + /* wait for the reset to take effect */
- + udelay(20);
- +
- + /* Mask off our interrupt line -- it is unmasked after reset */
- + {
- + u16 intr_status;
- + /* Disable interrupts on our PCI board by setting the mask bit */
- + outw(INT_MASK, ioaddr + SCBCmd);
- + intr_status = inw(ioaddr + SCBStatus);
- + /* ack and clear intrs */
- + outw(intr_status, ioaddr + SCBStatus);
- + inw(ioaddr + SCBStatus);
- + }
- }
-
- /* exported function: eepro100_probe / eth_probe
- @@ -478,25 +570,30 @@
- * leaves the 82557 initialized, and ready to recieve packets.
- */
-
- -struct nic *eepro100_probe(struct nic *nic, unsigned short *probeaddrs, struct pci_device *p)
- +static int eepro100_probe(struct dev *dev, struct pci_device *p)
- {
- + struct nic *nic = (struct nic *)dev;
- unsigned short sum = 0;
- int i;
- int read_cmd, ee_size;
- - unsigned short value;
- int options;
- - int promisc;
- + int rx_mode;
-
- /* we cache only the first few words of the EEPROM data
- be careful not to access beyond this array */
- unsigned short eeprom[16];
-
- - if (probeaddrs == 0 || probeaddrs[0] == 0)
- + if (p->ioaddr == 0)
- return 0;
- - ioaddr = probeaddrs[0] & ~3; /* Mask the bit that says "this is an io addr" */
- + ioaddr = p->ioaddr & ~3; /* Mask the bit that says "this is an io addr" */
- + nic->ioaddr = ioaddr;
-
- adjust_pci_device(p);
-
- + /* Copy IRQ from PCI information */
- + /* nic->irqno = pci->irq; */
- + nic->irqno = 0;
- +
- if ((do_eeprom_cmd(EE_READ_CMD << 24, 27) & 0xffe0000)
- == 0xffe0000) {
- ee_size = 0x100;
- @@ -513,123 +610,138 @@
- sum += value;
- }
-
- - for (i=0;i<ETH_ALEN;i++) {
- - nic->node_addr[i] = (eeprom[i/2] >> (8*(i&1))) & 0xff;
- - }
- - printf ("Ethernet addr: %!\n", nic->node_addr);
- -
- - if (sum != 0xBABA)
- - printf("eepro100: Invalid EEPROM checksum %#hX, "
- - "check settings before activating this device!\n", sum);
- - outl(0, ioaddr + SCBPort);
- - udelay (10000);
- -
- - whereami ("Got eeprom.");
- -
- - outl(virt_to_bus(&lstats), ioaddr + SCBPointer);
- - outw(INT_MASK | CU_STATSADDR, ioaddr + SCBCmd);
- - wait_for_cmd_done(ioaddr + SCBCmd);
- -
- - whereami ("set stats addr.");
- - /* INIT RX stuff. */
- -
- - /* Base = 0 */
- - outl(0, ioaddr + SCBPointer);
- - outw(INT_MASK | RX_ADDR_LOAD, ioaddr + SCBCmd);
- - wait_for_cmd_done(ioaddr + SCBCmd);
- -
- - whereami ("set rx base addr.");
- -
- - ACCESS(rxfd)status = 0x0001;
- - ACCESS(rxfd)command = 0x0000;
- - ACCESS(rxfd)link = virt_to_bus(&(ACCESS(rxfd)status));
- - ACCESS(rxfd)rx_buf_addr = (int) &nic->packet;
- - ACCESS(rxfd)count = 0;
- - ACCESS(rxfd)size = 1528;
- -
- - outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer);
- - outw(INT_MASK | RX_START, ioaddr + SCBCmd);
- - wait_for_cmd_done(ioaddr + SCBCmd);
- -
- - whereami ("started RX process.");
- -
- - /* Start the reciever.... */
- - ACCESS(rxfd)status = 0;
- - ACCESS(rxfd)command = 0xc000;
- - outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer);
- - outw(INT_MASK | RX_START, ioaddr + SCBCmd);
- -
- - /* INIT TX stuff. */
- -
- - /* Base = 0 */
- - outl(0, ioaddr + SCBPointer);
- - outw(INT_MASK | CU_CMD_BASE, ioaddr + SCBCmd);
- - wait_for_cmd_done(ioaddr + SCBCmd);
- -
- - whereami ("set TX base addr.");
- -
- - txfd.command = (CmdIASetup);
- - txfd.status = 0x0000;
- - txfd.link = virt_to_bus (&confcmd);
- -
- - {
- - char *t = (char *)&txfd.tx_desc_addr;
- + for (i=0;i<ETH_ALEN;i++) {
- + nic->node_addr[i] = (eeprom[i/2] >> (8*(i&1))) & 0xff;
- + }
- + printf ("Ethernet addr: %!\n", nic->node_addr);
-
- - for (i=0;i<ETH_ALEN;i++)
- - t[i] = nic->node_addr[i];
- - }
- + if (sum != 0xBABA)
- + printf("eepro100: Invalid EEPROM checksum %#hX, "
- + "check settings before activating this device!\n", sum);
- + outl(0, ioaddr + SCBPort);
- + udelay (10000);
- + whereami ("Got eeprom.");
- +
- + /* Base = 0 */
- + outl(0, ioaddr + SCBPointer);
- + outw(INT_MASK | RX_ADDR_LOAD, ioaddr + SCBCmd);
- + wait_for_cmd_done(ioaddr + SCBCmd);
- + whereami ("set rx base addr.");
- +
- + outl(virt_to_bus(&lstats), ioaddr + SCBPointer);
- + outw(INT_MASK | CU_STATSADDR, ioaddr + SCBCmd);
- + wait_for_cmd_done(ioaddr + SCBCmd);
- + whereami ("set stats addr.");
- +
- + /* INIT RX stuff. */
- + ACCESS(rxfd)status = 0x0001;
- + ACCESS(rxfd)command = 0x0000;
- + ACCESS(rxfd)link = virt_to_bus(&(ACCESS(rxfd)status));
- + ACCESS(rxfd)rx_buf_addr = virt_to_bus(&nic->packet);
- + ACCESS(rxfd)count = 0;
- + ACCESS(rxfd)size = 1528;
- +
- + outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer);
- + outw(INT_MASK | RX_START, ioaddr + SCBCmd);
- + wait_for_cmd_done(ioaddr + SCBCmd);
- +
- + whereami ("started RX process.");
- +
- + /* Start the reciever.... */
- + ACCESS(rxfd)status = 0;
- + ACCESS(rxfd)command = 0xc000;
- + outl(virt_to_bus(&(ACCESS(rxfd)status)), ioaddr + SCBPointer);
- + outw(INT_MASK | RX_START, ioaddr + SCBCmd);
- +
- + /* INIT TX stuff. */
- +
- + /* Base = 0 */
- + outl(0, ioaddr + SCBPointer);
- + outw(INT_MASK | CU_CMD_BASE, ioaddr + SCBCmd);
- + wait_for_cmd_done(ioaddr + SCBCmd);
- +
- + whereami ("set TX base addr.");
- +
- + txfd.command = (CmdIASetup);
- + txfd.status = 0x0000;
- + txfd.link = virt_to_bus (&confcmd);
- +
- + {
- + char *t = (char *)&txfd.tx_desc_addr;
- +
- + for (i=0;i<ETH_ALEN;i++)
- + t[i] = nic->node_addr[i];
- + }
-
- #ifdef DEBUG
- - printf ("Setup_eaddr:\n");
- - hd (&txfd, 0x20);
- + printf ("Setup_eaddr:\n");
- + hd (&txfd, 0x20);
- #endif
- - /* options = 0x40; */ /* 10mbps half duplex... */
- - options = 0x00; /* Autosense */
- -
- - promisc = 0;
- -
- - if ( ((eeprom[6]>>8) & 0x3f) == DP83840
- - || ((eeprom[6]>>8) & 0x3f) == DP83840A) {
- - int mdi_reg23 = mdio_read(eeprom[6] & 0x1f, 23) | 0x0422;
- - if (congenb)
- - mdi_reg23 |= 0x0100;
- - printf(" DP83840 specific setup, setting register 23 to %hX.\n",
- - mdi_reg23);
- - mdio_write(eeprom[6] & 0x1f, 23, mdi_reg23);
- - }
- - whereami ("Done DP8340 special setup.");
- - if (options != 0) {
- - mdio_write(eeprom[6] & 0x1f, 0,
- - ((options & 0x20) ? 0x2000 : 0) | /* 100mbps? */
- - ((options & 0x10) ? 0x0100 : 0)); /* Full duplex? */
- - whereami ("set mdio_register.");
- - }
- + /* options = 0x40; */ /* 10mbps half duplex... */
- + options = 0x00; /* Autosense */
-
- - confcmd.command = CmdSuspend | CmdConfigure;
- - confcmd.status = 0x0000;
- - confcmd.link = virt_to_bus (&txfd);
- - confcmd.data[1] = (txfifo << 4) | rxfifo;
- - confcmd.data[4] = rxdmacount;
- - confcmd.data[5] = txdmacount + 0x80;
- - confcmd.data[15] = promisc ? 0x49: 0x48;
- - confcmd.data[19] = (options & 0x10) ? 0xC0 : 0x80;
- - confcmd.data[21] = promisc ? 0x0D: 0x05;
- +#ifdef PROMISC
- + rx_mode = 3;
- +#elif ALLMULTI
- + rx_mode = 1;
- +#else
- + rx_mode = 0;
- +#endif
-
- - outl(virt_to_bus(&txfd), ioaddr + SCBPointer);
- - outw(INT_MASK | CU_START, ioaddr + SCBCmd);
- - wait_for_cmd_done(ioaddr + SCBCmd);
- + if ( ((eeprom[6]>>8) & 0x3f) == DP83840
- + || ((eeprom[6]>>8) & 0x3f) == DP83840A) {
- + int mdi_reg23 = mdio_read(eeprom[6] & 0x1f, 23) | 0x0422;
- + if (congenb)
- + mdi_reg23 |= 0x0100;
- + printf(" DP83840 specific setup, setting register 23 to %hX.\n",
- + mdi_reg23);
- + mdio_write(eeprom[6] & 0x1f, 23, mdi_reg23);
- + }
- + whereami ("Done DP8340 special setup.");
- + if (options != 0) {
- + mdio_write(eeprom[6] & 0x1f, 0,
- + ((options & 0x20) ? 0x2000 : 0) | /* 100mbps? */
- + ((options & 0x10) ? 0x0100 : 0)); /* Full duplex? */
- + whereami ("set mdio_register.");
- + }
-
- - whereami ("started TX thingy (config, iasetup).");
- + confcmd.command = CmdSuspend | CmdConfigure;
- + confcmd.status = 0x0000;
- + confcmd.link = virt_to_bus (&txfd);
- + confcmd.data[1] = (txfifo << 4) | rxfifo;
- + confcmd.data[4] = rxdmacount;
- + confcmd.data[5] = txdmacount + 0x80;
- + confcmd.data[15] = (rx_mode & 2) ? 0x49: 0x48;
- + confcmd.data[19] = (options & 0x10) ? 0xC0 : 0x80;
- + confcmd.data[21] = (rx_mode & 1) ? 0x0D: 0x05;
- +
- + outl(virt_to_bus(&txfd), ioaddr + SCBPointer);
- + outw(INT_MASK | CU_START, ioaddr + SCBCmd);
- + wait_for_cmd_done(ioaddr + SCBCmd);
- +
- + whereami ("started TX thingy (config, iasetup).");
- +
- + load_timer2(10*TICKS_PER_MS);
- + while (!txfd.status && timer2_running())
- + /* Wait */;
- +
- + /* Read the status register once to disgard stale data */
- + mdio_read(eeprom[6] & 0x1f, 1);
- + /* Check to see if the network cable is plugged in.
- + * This allows for faster failure if there is nothing
- + * we can do.
- + */
- + if (!(mdio_read(eeprom[6] & 0x1f, 1) & (1 << 2))) {
- + printf("Valid link not established\n");
- + eepro100_disable(dev);
- + return 0;
- + }
-
- - load_timer2(10*TICKS_PER_MS);
- - while (!txfd.status && timer2_running())
- - /* Wait */;
- -
- - nic->reset = eepro100_reset;
- - nic->poll = eepro100_poll;
- - nic->transmit = eepro100_transmit;
- - nic->disable = eepro100_disable;
- - return nic;
- + dev->disable = eepro100_disable;
- + nic->poll = eepro100_poll;
- + nic->transmit = eepro100_transmit;
- + nic->irq = eepro100_irq;
- + return 1;
- }
-
- /*********************************************************************/
- @@ -639,16 +751,59 @@
- /* Hexdump a number of bytes from memory... */
- void hd (void *where, int n)
- {
- - int i;
- + int i;
-
- - while (n > 0) {
- - printf ("%X ", where);
- - for (i=0;i < ( (n>16)?16:n);i++)
- - printf (" %hhX", ((char *)where)[i]);
- - printf ("\n");
- - n -= 16;
- - where += 16;
- - }
- + while (n > 0) {
- + printf ("%X ", where);
- + for (i=0;i < ( (n>16)?16:n);i++)
- + printf (" %hhX", ((char *)where)[i]);
- + printf ("\n");
- + n -= 16;
- + where += 16;
- + }
- }
- #endif
-
- +static struct pci_id eepro100_nics[] = {
- +PCI_ROM(0x8086, 0x1029, "id1029", "Intel EtherExpressPro100 ID1029"),
- +PCI_ROM(0x8086, 0x1030, "id1030", "Intel EtherExpressPro100 ID1030"),
- +PCI_ROM(0x8086, 0x1031, "82801cam", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"),
- +PCI_ROM(0x8086, 0x1032, "eepro100-1032", "Intel PRO/100 VE Network Connection"),
- +PCI_ROM(0x8086, 0x1033, "eepro100-1033", "Intel PRO/100 VM Network Connection"),
- +PCI_ROM(0x8086, 0x1034, "eepro100-1034", "Intel PRO/100 VM Network Connection"),
- +PCI_ROM(0x8086, 0x1035, "eepro100-1035", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"),
- +PCI_ROM(0x8086, 0x1036, "eepro100-1036", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"),
- +PCI_ROM(0x8086, 0x1037, "eepro100-1037", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"),
- +PCI_ROM(0x8086, 0x1038, "id1038", "Intel PRO/100 VM Network Connection"),
- +PCI_ROM(0x8086, 0x1039, "82562et", "Intel PRO100 VE 82562ET"),
- +PCI_ROM(0x8086, 0x103a, "id103a", "Intel Corporation 82559 InBusiness 10/100"),
- +PCI_ROM(0x8086, 0x103b, "82562etb", "Intel PRO100 VE 82562ETB"),
- +PCI_ROM(0x8086, 0x103c, "eepro100-103c", "Intel PRO/100 VM Network Connection"),
- +PCI_ROM(0x8086, 0x103d, "eepro100-103d", "Intel PRO/100 VE Network Connection"),
- +PCI_ROM(0x8086, 0x103e, "eepro100-103e", "Intel PRO/100 VM Network Connection"),
- +PCI_ROM(0x8086, 0x1059, "82551qm", "Intel PRO/100 M Mobile Connection"),
- +PCI_ROM(0x8086, 0x1209, "82559er", "Intel EtherExpressPro100 82559ER"),
- +PCI_ROM(0x8086, 0x1227, "82865", "Intel 82865 EtherExpress PRO/100A"),
- +PCI_ROM(0x8086, 0x1228, "82556", "Intel 82556 EtherExpress PRO/100 Smart"),
- +PCI_ROM(0x8086, 0x1229, "eepro100", "Intel EtherExpressPro100"),
- +PCI_ROM(0x8086, 0x2449, "82562em", "Intel EtherExpressPro100 82562EM"),
- +PCI_ROM(0x8086, 0x2459, "82562-1", "Intel 82562 based Fast Ethernet Connection"),
- +PCI_ROM(0x8086, 0x245d, "82562-2", "Intel 82562 based Fast Ethernet Connection"),
- +PCI_ROM(0x8086, 0x1050, "82562ez", "Intel 82562EZ Network Connection"),
- +PCI_ROM(0x8086, 0x5200, "eepro100-5200", "Intel EtherExpress PRO/100 Intelligent Server"),
- +PCI_ROM(0x8086, 0x5201, "eepro100-5201", "Intel EtherExpress PRO/100 Intelligent Server"),
- +};
- +
- +/* Cards with device ids 0x1030 to 0x103F, 0x2449, 0x2459 or 0x245D might need
- + * a workaround for hardware bug on 10 mbit half duplex (see linux driver eepro100.c)
- + * 2003/03/17 gbaum */
- +
- +
- +struct pci_driver eepro100_driver = {
- + .type = NIC_DRIVER,
- + .name = "EEPRO100",
- + .probe = eepro100_probe,
- + .ids = eepro100_nics,
- + .id_count = sizeof(eepro100_nics)/sizeof(eepro100_nics[0]),
- + .class = 0
- +};
- diff -Naur grub-0.97.orig/netboot/elf.h grub-0.97/netboot/elf.h
- --- grub-0.97.orig/netboot/elf.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/elf.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,234 @@
- +#ifndef ELF_H
- +#define ELF_H
- +
- +#define EI_NIDENT 16 /* Size of e_ident array. */
- +
- +/* Values for e_type. */
- +#define ET_NONE 0 /* No file type */
- +#define ET_REL 1 /* Relocatable file */
- +#define ET_EXEC 2 /* Executable file */
- +#define ET_DYN 3 /* Shared object file */
- +#define ET_CORE 4 /* Core file */
- +
- +/* Values for e_machine (architecute). */
- +#define EM_NONE 0 /* No machine */
- +#define EM_M32 1 /* AT&T WE 32100 */
- +#define EM_SPARC 2 /* SUN SPARC */
- +#define EM_386 3 /* Intel 80386+ */
- +#define EM_68K 4 /* Motorola m68k family */
- +#define EM_88K 5 /* Motorola m88k family */
- +#define EM_486 6 /* Perhaps disused */
- +#define EM_860 7 /* Intel 80860 */
- +#define EM_MIPS 8 /* MIPS R3000 big-endian */
- +#define EM_S370 9 /* IBM System/370 */
- +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
- +
- +#define EM_PARISC 15 /* HPPA */
- +#define EM_VPP500 17 /* Fujitsu VPP500 */
- +#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
- +#define EM_960 19 /* Intel 80960 */
- +#define EM_PPC 20 /* PowerPC */
- +#define EM_PPC64 21 /* PowerPC 64-bit */
- +#define EM_S390 22 /* IBM S390 */
- +
- +#define EM_V800 36 /* NEC V800 series */
- +#define EM_FR20 37 /* Fujitsu FR20 */
- +#define EM_RH32 38 /* TRW RH-32 */
- +#define EM_RCE 39 /* Motorola RCE */
- +#define EM_ARM 40 /* ARM */
- +#define EM_FAKE_ALPHA 41 /* Digital Alpha */
- +#define EM_SH 42 /* Hitachi SH */
- +#define EM_SPARCV9 43 /* SPARC v9 64-bit */
- +#define EM_TRICORE 44 /* Siemens Tricore */
- +#define EM_ARC 45 /* Argonaut RISC Core */
- +#define EM_H8_300 46 /* Hitachi H8/300 */
- +#define EM_H8_300H 47 /* Hitachi H8/300H */
- +#define EM_H8S 48 /* Hitachi H8S */
- +#define EM_H8_500 49 /* Hitachi H8/500 */
- +#define EM_IA_64 50 /* Intel Merced */
- +#define EM_MIPS_X 51 /* Stanford MIPS-X */
- +#define EM_COLDFIRE 52 /* Motorola Coldfire */
- +#define EM_68HC12 53 /* Motorola M68HC12 */
- +#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/
- +#define EM_PCP 55 /* Siemens PCP */
- +#define EM_NCPU 56 /* Sony nCPU embeeded RISC */
- +#define EM_NDR1 57 /* Denso NDR1 microprocessor */
- +#define EM_STARCORE 58 /* Motorola Start*Core processor */
- +#define EM_ME16 59 /* Toyota ME16 processor */
- +#define EM_ST100 60 /* STMicroelectronic ST100 processor */
- +#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/
- +#define EM_X86_64 62 /* AMD x86-64 architecture */
- +#define EM_PDSP 63 /* Sony DSP Processor */
- +
- +#define EM_FX66 66 /* Siemens FX66 microcontroller */
- +#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
- +#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
- +#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */
- +#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */
- +#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */
- +#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */
- +#define EM_SVX 73 /* Silicon Graphics SVx */
- +#define EM_AT19 74 /* STMicroelectronics ST19 8 bit mc */
- +#define EM_VAX 75 /* Digital VAX */
- +#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
- +#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */
- +#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
- +#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
- +#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
- +#define EM_HUANY 81 /* Harvard University machine-independent object files */
- +#define EM_PRISM 82 /* SiTera Prism */
- +#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
- +#define EM_FR30 84 /* Fujitsu FR30 */
- +#define EM_D10V 85 /* Mitsubishi D10V */
- +#define EM_D30V 86 /* Mitsubishi D30V */
- +#define EM_V850 87 /* NEC v850 */
- +#define EM_M32R 88 /* Mitsubishi M32R */
- +#define EM_MN10300 89 /* Matsushita MN10300 */
- +#define EM_MN10200 90 /* Matsushita MN10200 */
- +#define EM_PJ 91 /* picoJava */
- +#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
- +#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
- +#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
- +#define EM_NUM 95
- +
- +/* Values for p_type. */
- +#define PT_NULL 0 /* Unused entry. */
- +#define PT_LOAD 1 /* Loadable segment. */
- +#define PT_DYNAMIC 2 /* Dynamic linking information segment. */
- +#define PT_INTERP 3 /* Pathname of interpreter. */
- +#define PT_NOTE 4 /* Auxiliary information. */
- +#define PT_SHLIB 5 /* Reserved (not used). */
- +#define PT_PHDR 6 /* Location of program header itself. */
- +
- +/* Values for p_flags. */
- +#define PF_X 0x1 /* Executable. */
- +#define PF_W 0x2 /* Writable. */
- +#define PF_R 0x4 /* Readable. */
- +
- +
- +#define ELF_PROGRAM_RETURNS_BIT 0x8000000 /* e_flags bit 31 */
- +
- +#define EI_MAG0 0
- +#define ELFMAG0 0x7f
- +
- +#define EI_MAG1 1
- +#define ELFMAG1 'E'
- +
- +#define EI_MAG2 2
- +#define ELFMAG2 'L'
- +
- +#define EI_MAG3 3
- +#define ELFMAG3 'F'
- +
- +#define ELFMAG "\177ELF"
- +
- +#define EI_CLASS 4 /* File class byte index */
- +#define ELFCLASSNONE 0 /* Invalid class */
- +#define ELFCLASS32 1 /* 32-bit objects */
- +#define ELFCLASS64 2 /* 64-bit objects */
- +
- +#define EI_DATA 5 /* Data encodeing byte index */
- +#define ELFDATANONE 0 /* Invalid data encoding */
- +#define ELFDATA2LSB 1 /* 2's complement little endian */
- +#define ELFDATA2MSB 2 /* 2's complement big endian */
- +
- +#define EI_VERSION 6 /* File version byte index */
- + /* Value must be EV_CURRENT */
- +
- +#define EV_NONE 0 /* Invalid ELF Version */
- +#define EV_CURRENT 1 /* Current version */
- +
- +#define ELF32_PHDR_SIZE (8*4) /* Size of an elf program header */
- +
- +#ifndef ASSEMBLY
- +/*
- + * ELF definitions common to all 32-bit architectures.
- + */
- +
- +typedef uint32_t Elf32_Addr;
- +typedef uint16_t Elf32_Half;
- +typedef uint32_t Elf32_Off;
- +typedef int32_t Elf32_Sword;
- +typedef uint32_t Elf32_Word;
- +typedef uint32_t Elf32_Size;
- +
- +typedef uint64_t Elf64_Addr;
- +typedef uint16_t Elf64_Half;
- +typedef uint64_t Elf64_Off;
- +typedef int32_t Elf64_Sword;
- +typedef uint32_t Elf64_Word;
- +typedef uint64_t Elf64_Size;
- +
- +/*
- + * ELF header.
- + */
- +typedef struct {
- + unsigned char e_ident[EI_NIDENT]; /* File identification. */
- + Elf32_Half e_type; /* File type. */
- + Elf32_Half e_machine; /* Machine architecture. */
- + Elf32_Word e_version; /* ELF format version. */
- + Elf32_Addr e_entry; /* Entry point. */
- + Elf32_Off e_phoff; /* Program header file offset. */
- + Elf32_Off e_shoff; /* Section header file offset. */
- + Elf32_Word e_flags; /* Architecture-specific flags. */
- + Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
- + Elf32_Half e_phentsize; /* Size of program header entry. */
- + Elf32_Half e_phnum; /* Number of program header entries. */
- + Elf32_Half e_shentsize; /* Size of section header entry. */
- + Elf32_Half e_shnum; /* Number of section header entries. */
- + Elf32_Half e_shstrndx; /* Section name strings section. */
- +} Elf32_Ehdr;
- +
- +typedef struct {
- + unsigned char e_ident[EI_NIDENT]; /* File identification. */
- + Elf64_Half e_type; /* File type. */
- + Elf64_Half e_machine; /* Machine architecture. */
- + Elf64_Word e_version; /* ELF format version. */
- + Elf64_Addr e_entry; /* Entry point. */
- + Elf64_Off e_phoff; /* Program header file offset. */
- + Elf64_Off e_shoff; /* Section header file offset. */
- + Elf64_Word e_flags; /* Architecture-specific flags. */
- + Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
- + Elf64_Half e_phentsize; /* Size of program header entry. */
- + Elf64_Half e_phnum; /* Number of program header entries. */
- + Elf64_Half e_shentsize; /* Size of section header entry. */
- + Elf64_Half e_shnum; /* Number of section header entries. */
- + Elf64_Half e_shstrndx; /* Section name strings section. */
- +} Elf64_Ehdr;
- +
- +/*
- + * Program header.
- + */
- +typedef struct {
- + Elf32_Word p_type; /* Entry type. */
- + Elf32_Off p_offset; /* File offset of contents. */
- + Elf32_Addr p_vaddr; /* Virtual address (not used). */
- + Elf32_Addr p_paddr; /* Physical address. */
- + Elf32_Size p_filesz; /* Size of contents in file. */
- + Elf32_Size p_memsz; /* Size of contents in memory. */
- + Elf32_Word p_flags; /* Access permission flags. */
- + Elf32_Size p_align; /* Alignment in memory and file. */
- +} Elf32_Phdr;
- +
- +typedef struct {
- + Elf64_Word p_type; /* Entry type. */
- + Elf64_Word p_flags; /* Access permission flags. */
- + Elf64_Off p_offset; /* File offset of contents. */
- + Elf64_Addr p_vaddr; /* Virtual address (not used). */
- + Elf64_Addr p_paddr; /* Physical address. */
- + Elf64_Size p_filesz; /* Size of contents in file. */
- + Elf64_Size p_memsz; /* Size of contents in memory. */
- + Elf64_Size p_align; /* Alignment in memory and file. */
- +} Elf64_Phdr;
- +
- +/* Standardized Elf image notes for booting... The name for all of these is ELFBoot */
- +
- +
- +/* ELF Defines for the current architecture */
- +#include "i386_elf.h"
- +
- +#endif /* ASSEMBLY */
- +
- +//#include "elf_boot.h"
- +
- +#endif /* ELF_H */
- diff -Naur grub-0.97.orig/netboot/endian.h grub-0.97/netboot/endian.h
- --- grub-0.97.orig/netboot/endian.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/endian.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,19 @@
- +#ifndef ETHERBOOT_ENDIAN_H
- +#define ETHERBOOT_ENDIAN_H
- +
- +/* Definitions for byte order, according to significance of bytes,
- + from low addresses to high addresses. The value is what you get by
- + putting '4' in the most significant byte, '3' in the second most
- + significant byte, '2' in the second least significant byte, and '1'
- + in the least significant byte, and then writing down one digit for
- + each byte, starting with the byte at the lowest address at the left,
- + and proceeding to the byte with the highest address at the right. */
- +
- +#define __LITTLE_ENDIAN 1234
- +#define __BIG_ENDIAN 4321
- +#define __PDP_ENDIAN 3412
- +
- +#include "i386_endian.h"
- +
- +
- +#endif /* ETHERBOOT_ENDIAN_H */
- diff -Naur grub-0.97.orig/netboot/epic100.c grub-0.97/netboot/epic100.c
- --- grub-0.97.orig/netboot/epic100.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/epic100.c 2005-08-31 19:03:35.000000000 +0000
- @@ -1,15 +1,18 @@
- +
- /* epic100.c: A SMC 83c170 EPIC/100 fast ethernet driver for Etherboot */
-
- +/* 05/06/2003 timlegge Fixed relocation and implemented Multicast */
- #define LINUX_OUT_MACROS
-
- #include "etherboot.h"
- +#include "pci.h"
- #include "nic.h"
- -#include "cards.h"
- #include "timer.h"
- #include "epic100.h"
-
- -#undef virt_to_bus
- -#define virt_to_bus(x) ((unsigned long)x)
- +/* Condensed operations for readability */
- +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
- +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
-
- #define TX_RING_SIZE 2 /* use at least 2 buffers for TX */
- #define RX_RING_SIZE 2
- @@ -26,23 +29,18 @@
-
- /* The EPIC100 Rx and Tx buffer descriptors. */
- struct epic_rx_desc {
- - unsigned short status;
- - unsigned short rxlength;
- - unsigned long bufaddr;
- - unsigned short buflength;
- - unsigned short control;
- - unsigned long next;
- + unsigned long status;
- + unsigned long bufaddr;
- + unsigned long buflength;
- + unsigned long next;
- };
- -
- /* description of the tx descriptors control bits commonly used */
- #define TD_STDFLAGS TD_LASTDESC
-
- struct epic_tx_desc {
- - unsigned short status;
- - unsigned short txlength;
- - unsigned long bufaddr;
- - unsigned short buflength;
- - unsigned short control;
- + unsigned long status;
- + unsigned long bufaddr;
- + unsigned long buflength;
- unsigned long next;
- };
-
- @@ -51,12 +49,15 @@
-
- static void epic100_open(void);
- static void epic100_init_ring(void);
- -static void epic100_disable(struct nic *nic);
- -static int epic100_poll(struct nic *nic);
- +static void epic100_disable(struct dev *dev);
- +static int epic100_poll(struct nic *nic, int retrieve);
- static void epic100_transmit(struct nic *nic, const char *destaddr,
- unsigned int type, unsigned int len, const char *data);
- +#ifdef DEBUG_EEPROM
- static int read_eeprom(int location);
- +#endif
- static int mii_read(int phy_id, int location);
- +static void epic100_irq(struct nic *nic, irq_action_t action);
-
- static int ioaddr;
-
- @@ -69,6 +70,7 @@
- static int mmctl ;
- static int mmdata ;
- static int lan0 ;
- +static int mc0 ;
- static int rxcon ;
- static int txcon ;
- static int prcdar ;
- @@ -80,37 +82,27 @@
- static unsigned short eeprom[64];
- #endif
- static signed char phys[4]; /* MII device addresses. */
- -static struct epic_rx_desc rx_ring[RX_RING_SIZE];
- -static struct epic_tx_desc tx_ring[TX_RING_SIZE];
- -#ifdef USE_LOWMEM_BUFFER
- -#define rx_packet ((char *)0x10000 - PKT_BUF_SZ * RX_RING_SIZE)
- -#define tx_packet ((char *)0x10000 - PKT_BUF_SZ * RX_RING_SIZE - PKT_BUF_SZ * TX_RING_SIZE)
- -#else
- -static char rx_packet[PKT_BUF_SZ * RX_RING_SIZE];
- -static char tx_packet[PKT_BUF_SZ * TX_RING_SIZE];
- -#endif
- +static struct epic_rx_desc rx_ring[RX_RING_SIZE]
- + __attribute__ ((aligned(4)));
- +static struct epic_tx_desc tx_ring[TX_RING_SIZE]
- + __attribute__ ((aligned(4)));
- +static unsigned char rx_packet[PKT_BUF_SZ * RX_RING_SIZE];
- +static unsigned char tx_packet[PKT_BUF_SZ * TX_RING_SIZE];
-
- /***********************************************************************/
- /* Externally visible functions */
- /***********************************************************************/
-
- - static void
- -epic100_reset(struct nic *nic)
- -{
- - /* Soft reset the chip. */
- - outl(GC_SOFT_RESET, genctl);
- -}
-
- - struct nic*
- -epic100_probe(struct nic *nic, unsigned short *probeaddrs)
- + static int
- +epic100_probe(struct dev *dev, struct pci_device *pci)
- {
- - unsigned short sum = 0;
- - unsigned short value;
- + struct nic *nic = (struct nic *)dev;
- int i;
- unsigned short* ap;
- unsigned int phy, phy_idx;
-
- - if (probeaddrs == 0 || probeaddrs[0] == 0)
- + if (pci->ioaddr == 0)
- return 0;
-
- /* Ideally we would detect all network cards in slot order. That would
- @@ -118,7 +110,9 @@
- well with the current structure. So instead we detect just the
- Epic cards in slot order. */
-
- - ioaddr = probeaddrs[0] & ~3; /* Mask the bit that says "this is an io addr" */
- + ioaddr = pci->ioaddr;
- + nic->irqno = 0;
- + nic->ioaddr = pci->ioaddr & ~3;
-
- /* compute all used static epic100 registers address */
- command = ioaddr + COMMAND; /* Control Register */
- @@ -130,6 +124,7 @@
- mmctl = ioaddr + MMCTL; /* MII Management Interface Control */
- mmdata = ioaddr + MMDATA; /* MII Management Interface Data */
- lan0 = ioaddr + LAN0; /* MAC address. (0x40-0x48) */
- + mc0 = ioaddr + MC0; /* Multicast Control */
- rxcon = ioaddr + RXCON; /* Receive Control */
- txcon = ioaddr + TXCON; /* Transmit Control */
- prcdar = ioaddr + PRCDAR; /* PCI Receive Current Descr Address */
- @@ -160,11 +155,15 @@
- }
-
- #ifdef DEBUG_EEPROM
- +{
- + unsigned short sum = 0;
- + unsigned short value;
- for (i = 0; i < 64; i++) {
- value = read_eeprom(i);
- eeprom[i] = value;
- sum += value;
- }
- +}
-
- #if (EPIC_DEBUG > 1)
- printf("EEPROM contents\n");
- @@ -202,15 +201,26 @@
-
- epic100_open();
-
- - nic->reset = epic100_reset;
- + dev->disable = epic100_disable;
- nic->poll = epic100_poll;
- nic->transmit = epic100_transmit;
- - nic->disable = epic100_disable;
- + nic->irq = epic100_irq;
-
- - return nic;
- + return 1;
- }
-
- - static void
- +static void set_rx_mode(void)
- +{
- + unsigned char mc_filter[8];
- + int i;
- + memset(mc_filter, 0xff, sizeof(mc_filter));
- + outl(0x0C, rxcon);
- + for(i = 0; i < 4; i++)
- + outw(((unsigned short *)mc_filter)[i], mc0 + i*4);
- + return;
- +}
- +
- + static void
- epic100_open(void)
- {
- int mii_reg5;
- @@ -237,11 +247,11 @@
- outl(tmp, txcon);
-
- /* Give adress of RX and TX ring to the chip */
- - outl(virt_to_bus(&rx_ring), prcdar);
- - outl(virt_to_bus(&tx_ring), ptcdar);
- + outl(virt_to_le32desc(&rx_ring), prcdar);
- + outl(virt_to_le32desc(&tx_ring), ptcdar);
-
- /* Start the chip's Rx process: receive unicast and broadcast */
- - outl(0x04, rxcon);
- + set_rx_mode();
- outl(CR_START_RX | CR_QUEUE_RX, command);
-
- putchar('\n');
- @@ -252,34 +262,30 @@
- epic100_init_ring(void)
- {
- int i;
- - char* p;
-
- cur_rx = cur_tx = 0;
-
- - p = &rx_packet[0];
- for (i = 0; i < RX_RING_SIZE; i++) {
- - rx_ring[i].status = RRING_OWN; /* Owned by Epic chip */
- - rx_ring[i].buflength = PKT_BUF_SZ;
- - rx_ring[i].bufaddr = virt_to_bus(p + (PKT_BUF_SZ * i));
- - rx_ring[i].control = 0;
- - rx_ring[i].next = virt_to_bus(&(rx_ring[i + 1]) );
- + rx_ring[i].status = cpu_to_le32(RRING_OWN); /* Owned by Epic chip */
- + rx_ring[i].buflength = cpu_to_le32(PKT_BUF_SZ);
- + rx_ring[i].bufaddr = virt_to_bus(&rx_packet[i * PKT_BUF_SZ]);
- + rx_ring[i].next = virt_to_le32desc(&rx_ring[i + 1]) ;
- }
- /* Mark the last entry as wrapping the ring. */
- - rx_ring[i-1].next = virt_to_bus(&rx_ring[0]);
- + rx_ring[i-1].next = virt_to_le32desc(&rx_ring[0]);
-
- /*
- *The Tx buffer descriptor is filled in as needed,
- * but we do need to clear the ownership bit.
- */
- - p = &tx_packet[0];
-
- for (i = 0; i < TX_RING_SIZE; i++) {
- - tx_ring[i].status = 0; /* Owned by CPU */
- - tx_ring[i].bufaddr = virt_to_bus(p + (PKT_BUF_SZ * i));
- - tx_ring[i].control = TD_STDFLAGS;
- - tx_ring[i].next = virt_to_bus(&(tx_ring[i + 1]) );
- + tx_ring[i].status = 0x0000; /* Owned by CPU */
- + tx_ring[i].buflength = 0x0000 | cpu_to_le32(TD_STDFLAGS << 16);
- + tx_ring[i].bufaddr = virt_to_bus(&tx_packet[i * PKT_BUF_SZ]);
- + tx_ring[i].next = virt_to_le32desc(&tx_ring[i + 1]);
- }
- - tx_ring[i-1].next = virt_to_bus(&tx_ring[0]);
- + tx_ring[i-1].next = virt_to_le32desc(&tx_ring[0]);
- }
-
- /* function: epic100_transmit
- @@ -296,7 +302,7 @@
- unsigned int len, const char *data)
- {
- unsigned short nstype;
- - char* txp;
- + unsigned char *txp;
- int entry;
-
- /* Calculate the next Tx descriptor entry. */
- @@ -310,7 +316,7 @@
- return;
- }
-
- - txp = (char*)tx_ring[entry].bufaddr;
- + txp = tx_packet + (entry * PKT_BUF_SZ);
-
- memcpy(txp, destaddr, ETH_ALEN);
- memcpy(txp + ETH_ALEN, nic->node_addr, ETH_ALEN);
- @@ -319,26 +325,29 @@
- memcpy(txp + ETH_HLEN, data, len);
-
- len += ETH_HLEN;
- -
- + len &= 0x0FFF;
- + while(len < ETH_ZLEN)
- + txp[len++] = '\0';
- /*
- * Caution: the write order is important here,
- * set the base address with the "ownership"
- * bits last.
- */
- - tx_ring[entry].txlength = (len >= 60 ? len : 60);
- - tx_ring[entry].buflength = len;
- - tx_ring[entry].status = TRING_OWN; /* Pass ownership to the chip. */
- +
- + tx_ring[entry].buflength |= cpu_to_le32(len);
- + tx_ring[entry].status = cpu_to_le32(len << 16) |
- + cpu_to_le32(TRING_OWN); /* Pass ownership to the chip. */
-
- cur_tx++;
-
- /* Trigger an immediate transmit demand. */
- - outl(CR_QUEUE_TX, command);
- -
- + outl(CR_QUEUE_TX, command);
- +
- load_timer2(10*TICKS_PER_MS); /* timeout 10 ms for transmit */
- - while ((tx_ring[entry].status & TRING_OWN) && timer2_running())
- + while ((le32_to_cpu(tx_ring[entry].status) & (TRING_OWN)) && timer2_running())
- /* Wait */;
-
- - if ((tx_ring[entry].status & TRING_OWN) != 0)
- + if ((le32_to_cpu(tx_ring[entry].status) & TRING_OWN) != 0)
- printf("Oops, transmitter timeout, status=%hX\n",
- tx_ring[entry].status);
- }
- @@ -356,17 +365,19 @@
- */
-
- static int
- -epic100_poll(struct nic *nic)
- +epic100_poll(struct nic *nic, int retrieve)
- {
- int entry;
- - int status;
- int retcode;
- -
- + int status;
- entry = cur_rx % RX_RING_SIZE;
-
- - if ((status = rx_ring[entry].status & RRING_OWN) == RRING_OWN)
- + if ((rx_ring[entry].status & cpu_to_le32(RRING_OWN)) == RRING_OWN)
- return (0);
-
- + if ( ! retrieve ) return 1;
- +
- + status = le32_to_cpu(rx_ring[entry].status);
- /* We own the next entry, it's a new packet. Send it up. */
-
- #if (EPIC_DEBUG > 4)
- @@ -383,8 +394,8 @@
- retcode = 0;
- } else {
- /* Omit the four octet CRC from the length. */
- - nic->packetlen = rx_ring[entry].rxlength - 4;
- - memcpy(nic->packet, (char*)rx_ring[entry].bufaddr, nic->packetlen);
- + nic->packetlen = le32_to_cpu((rx_ring[entry].buflength))- 4;
- + memcpy(nic->packet, &rx_packet[entry * PKT_BUF_SZ], nic->packetlen);
- retcode = 1;
- }
-
- @@ -395,17 +406,30 @@
- rx_ring[entry].status = RRING_OWN;
-
- /* Restart Receiver */
- - outl(CR_START_RX | CR_QUEUE_RX, command);
- + outl(CR_START_RX | CR_QUEUE_RX, command);
-
- return retcode;
- }
-
-
- static void
- -epic100_disable(struct nic *nic)
- +epic100_disable(struct dev *dev __unused)
- {
- + /* Soft reset the chip. */
- + outl(GC_SOFT_RESET, genctl);
- }
-
- +static void epic100_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
-
- #ifdef DEBUG_EEPROM
- /* Serial EEPROM section. */
- @@ -479,3 +503,18 @@
- break;
- return inw(mmdata);
- }
- +
- +
- +static struct pci_id epic100_nics[] = {
- +PCI_ROM(0x10b8, 0x0005, "epic100", "SMC EtherPowerII"), /* SMC 83c170 EPIC/100 */
- +PCI_ROM(0x10b8, 0x0006, "smc-83c175", "SMC EPIC/C 83c175"),
- +};
- +
- +struct pci_driver epic100_driver = {
- + .type = NIC_DRIVER,
- + .name = "EPIC100",
- + .probe = epic100_probe,
- + .ids = epic100_nics,
- + .id_count = sizeof(epic100_nics)/sizeof(epic100_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/etherboot.h grub-0.97/netboot/etherboot.h
- --- grub-0.97.orig/netboot/etherboot.h 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/etherboot.h 2005-08-31 19:03:35.000000000 +0000
- @@ -1,6 +1,6 @@
- /*
- * GRUB -- GRand Unified Bootloader
- - * Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
- + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- @@ -17,531 +17,45 @@
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- -/* RULE: You must define the macro ``GRUB'' when including this header
- - file in GRUB code. */
- -
- -/* Based on "src/etherboot.h" in etherboot-5.0.5. */
- -
- -/**************************************************************************
- -ETHERBOOT - BOOTP/TFTP Bootstrap Program
- -
- -Author: Martin Renters
- - Date: Dec/93
- -
- -**************************************************************************/
- -
- -/* Include GRUB-specific macros and prototypes here. */
- -#include <shared.h>
- -
- -/* FIXME: For now, enable the DHCP support. Perhaps I should segregate
- - the DHCP support from the BOOTP support, and permit both to
- - co-exist. */
- -#undef NO_DHCP_SUPPORT
- -
- -/* In GRUB, the relocated address in Etherboot doesn't have any sense.
- - Just define it as a bogus value. */
- -#define RELOC 0
- -
- -/* FIXME: Should be an option. */
- -#define BACKOFF_LIMIT 7
- -
- -#include <osdep.h>
- -
- -#define CTRL_C 3
- -
- -#ifndef MAX_TFTP_RETRIES
- -# define MAX_TFTP_RETRIES 20
- -#endif
- -
- -#ifndef MAX_BOOTP_RETRIES
- -# define MAX_BOOTP_RETRIES 20
- -#endif
- -
- -#define MAX_BOOTP_EXTLEN (ETH_FRAME_LEN - ETH_HLEN - \
- - sizeof (struct bootp_t))
- +/*
- + * Transport layer to use Etherboot NIC drivers in GRUB.
- + */
-
- -#ifndef MAX_ARP_RETRIES
- -# define MAX_ARP_RETRIES 20
- -#endif
- +#ifndef ETHERBOOT_H
- +#define ETHERBOOT_H
-
- -#ifndef MAX_RPC_RETRIES
- -# define MAX_RPC_RETRIES 20
- +#include "shared.h"
- +#include "osdep.h"
- +#include "if_ether.h"
- +#include "in.h"
- +
- +/* Link configuration time in tenths of a second */
- +#ifndef VALID_LINK_TIMEOUT
- +#define VALID_LINK_TIMEOUT 100 /* 10.0 seconds */
- #endif
-
- -#define TICKS_PER_SEC 18
- -
- -/* Inter-packet retry in ticks */
- -#define TIMEOUT (10 * TICKS_PER_SEC)
- -
- -/* These settings have sense only if compiled with -DCONGESTED */
- -/* total retransmission timeout in ticks */
- -#define TFTP_TIMEOUT (30 * TICKS_PER_SEC)
- -/* packet retransmission timeout in ticks */
- -#define TFTP_REXMT (3 * TICKS_PER_SEC)
- -
- #ifndef NULL
- -# define NULL ((void *) 0)
- +#define NULL ((void *)0)
- #endif
-
- -/*
- - I'm moving towards the defined names in linux/if_ether.h for clarity.
- - The confusion between 60/64 and 1514/1518 arose because the NS8390
- - counts the 4 byte frame checksum in the incoming packet, but not
- - in the outgoing packet. 60/1514 are the correct numbers for most
- - if not all of the other NIC controllers. I will be retiring the
- - 64/1518 defines in the lead-up to 5.0.
- -*/
- -
- -#define ETH_ALEN 6 /* Size of Ethernet address */
- -#define ETH_HLEN 14 /* Size of ethernet header */
- -#define ETH_ZLEN 60 /* Minimum packet */
- -/*#define ETH_MIN_PACKET 64*/
- -#define ETH_FRAME_LEN 1514 /* Maximum packet */
- -/*#define ETH_MAX_PACKET 1518*/
- -/* Because some DHCP/BOOTP servers don't treat the maximum length the same
- - as Etherboot, subtract the size of an IP header and that of an UDP
- - header. */
- -#define ETH_MAX_MTU (ETH_FRAME_LEN - ETH_HLEN \
- - - sizeof (struct iphdr) \
- - - sizeof (struct udphdr))
- -
- -#define ARP_CLIENT 0
- -#define ARP_SERVER 1
- -#define ARP_GATEWAY 2
- -#define ARP_ROOTSERVER 3
- -#define ARP_SWAPSERVER 4
- -#define MAX_ARP ARP_SWAPSERVER+1
- -
- -#define RARP_REQUEST 3
- -#define RARP_REPLY 4
- -
- -#define IP 0x0800
- -#define ARP 0x0806
- -#define RARP 0x8035
- -
- -#define BOOTP_SERVER 67
- -#define BOOTP_CLIENT 68
- -#define TFTP_PORT 69
- -#define SUNRPC_PORT 111
- -
- -#define IP_UDP 17
- -/* Same after going through htonl */
- -#define IP_BROADCAST 0xFFFFFFFF
- -
- -#define ARP_REQUEST 1
- -#define ARP_REPLY 2
- -
- -#define BOOTP_REQUEST 1
- -#define BOOTP_REPLY 2
- -
- -#define TAG_LEN(p) (*((p) + 1))
- -#define RFC1533_COOKIE 99, 130, 83, 99
- -#define RFC1533_PAD 0
- -#define RFC1533_NETMASK 1
- -#define RFC1533_TIMEOFFSET 2
- -#define RFC1533_GATEWAY 3
- -#define RFC1533_TIMESERVER 4
- -#define RFC1533_IEN116NS 5
- -#define RFC1533_DNS 6
- -#define RFC1533_LOGSERVER 7
- -#define RFC1533_COOKIESERVER 8
- -#define RFC1533_LPRSERVER 9
- -#define RFC1533_IMPRESSSERVER 10
- -#define RFC1533_RESOURCESERVER 11
- -#define RFC1533_HOSTNAME 12
- -#define RFC1533_BOOTFILESIZE 13
- -#define RFC1533_MERITDUMPFILE 14
- -#define RFC1533_DOMAINNAME 15
- -#define RFC1533_SWAPSERVER 16
- -#define RFC1533_ROOTPATH 17
- -#define RFC1533_EXTENSIONPATH 18
- -#define RFC1533_IPFORWARDING 19
- -#define RFC1533_IPSOURCEROUTING 20
- -#define RFC1533_IPPOLICYFILTER 21
- -#define RFC1533_IPMAXREASSEMBLY 22
- -#define RFC1533_IPTTL 23
- -#define RFC1533_IPMTU 24
- -#define RFC1533_IPMTUPLATEAU 25
- -#define RFC1533_INTMTU 26
- -#define RFC1533_INTLOCALSUBNETS 27
- -#define RFC1533_INTBROADCAST 28
- -#define RFC1533_INTICMPDISCOVER 29
- -#define RFC1533_INTICMPRESPOND 30
- -#define RFC1533_INTROUTEDISCOVER 31
- -#define RFC1533_INTROUTESOLICIT 32
- -#define RFC1533_INTSTATICROUTES 33
- -#define RFC1533_LLTRAILERENCAP 34
- -#define RFC1533_LLARPCACHETMO 35
- -#define RFC1533_LLETHERNETENCAP 36
- -#define RFC1533_TCPTTL 37
- -#define RFC1533_TCPKEEPALIVETMO 38
- -#define RFC1533_TCPKEEPALIVEGB 39
- -#define RFC1533_NISDOMAIN 40
- -#define RFC1533_NISSERVER 41
- -#define RFC1533_NTPSERVER 42
- -#define RFC1533_VENDOR 43
- -#define RFC1533_NBNS 44
- -#define RFC1533_NBDD 45
- -#define RFC1533_NBNT 46
- -#define RFC1533_NBSCOPE 47
- -#define RFC1533_XFS 48
- -#define RFC1533_XDM 49
- -#ifndef NO_DHCP_SUPPORT
- -#define RFC2132_REQ_ADDR 50
- -#define RFC2132_MSG_TYPE 53
- -#define RFC2132_SRV_ID 54
- -#define RFC2132_PARAM_LIST 55
- -#define RFC2132_MAX_SIZE 57
- -#define RFC2132_VENDOR_CLASS_ID 60
- -
- -#define DHCPDISCOVER 1
- -#define DHCPOFFER 2
- -#define DHCPREQUEST 3
- -#define DHCPACK 5
- -#endif /* NO_DHCP_SUPPORT */
- -
- -#define RFC1533_VENDOR_MAJOR 0
- -#define RFC1533_VENDOR_MINOR 0
- -
- -#define RFC1533_VENDOR_MAGIC 128
- -#define RFC1533_VENDOR_ADDPARM 129
- -#define RFC1533_VENDOR_MNUOPTS 160
- -#define RFC1533_VENDOR_SELECTION 176
- -#define RFC1533_VENDOR_MOTD 184
- -#define RFC1533_VENDOR_NUMOFMOTD 8
- -#define RFC1533_VENDOR_IMG 192
- -#define RFC1533_VENDOR_NUMOFIMG 16
- -
- -#define RFC1533_VENDOR_CONFIGFILE 150
- -
- -#define RFC1533_END 255
- -
- -#define BOOTP_VENDOR_LEN 64
- -#ifndef NO_DHCP_SUPPORT
- -#define DHCP_OPT_LEN 312
- -#endif /* NO_DHCP_SUPPORT */
- -
- -#define TFTP_DEFAULTSIZE_PACKET 512
- -#define TFTP_MAX_PACKET 1432 /* 512 */
- -
- -#define TFTP_RRQ 1
- -#define TFTP_WRQ 2
- -#define TFTP_DATA 3
- -#define TFTP_ACK 4
- -#define TFTP_ERROR 5
- -#define TFTP_OACK 6
- -
- -#define TFTP_CODE_EOF 1
- -#define TFTP_CODE_MORE 2
- -#define TFTP_CODE_ERROR 3
- -#define TFTP_CODE_BOOT 4
- -#define TFTP_CODE_CFG 5
- -
- -#define AWAIT_ARP 0
- -#define AWAIT_BOOTP 1
- -#define AWAIT_TFTP 2
- -#define AWAIT_RARP 3
- -#define AWAIT_RPC 4
- -#define AWAIT_QDRAIN 5 /* drain queue, process ARP requests */
- -
- -typedef struct
- -{
- - unsigned long s_addr;
- -}
- -in_addr;
- -
- -struct arptable_t
- -{
- - in_addr ipaddr;
- - unsigned char node[6];
- -};
- -
- -/*
- - * A pity sipaddr and tipaddr are not longword aligned or we could use
- - * in_addr. No, I don't want to use #pragma packed.
- - */
- -struct arprequest
- -{
- - unsigned short hwtype;
- - unsigned short protocol;
- - char hwlen;
- - char protolen;
- - unsigned short opcode;
- - char shwaddr[6];
- - char sipaddr[4];
- - char thwaddr[6];
- - char tipaddr[4];
- -};
- -
- -struct iphdr
- -{
- - char verhdrlen;
- - char service;
- - unsigned short len;
- - unsigned short ident;
- - unsigned short frags;
- - char ttl;
- - char protocol;
- - unsigned short chksum;
- - in_addr src;
- - in_addr dest;
- -};
- -
- -struct udphdr
- -{
- - unsigned short src;
- - unsigned short dest;
- - unsigned short len;
- - unsigned short chksum;
- -};
- -
- -/* Format of a bootp packet. */
- -struct bootp_t
- -{
- - char bp_op;
- - char bp_htype;
- - char bp_hlen;
- - char bp_hops;
- - unsigned long bp_xid;
- - unsigned short bp_secs;
- - unsigned short unused;
- - in_addr bp_ciaddr;
- - in_addr bp_yiaddr;
- - in_addr bp_siaddr;
- - in_addr bp_giaddr;
- - char bp_hwaddr[16];
- - char bp_sname[64];
- - char bp_file[128];
- -#ifdef NO_DHCP_SUPPORT
- - char bp_vend[BOOTP_VENDOR_LEN];
- -#else
- - char bp_vend[DHCP_OPT_LEN];
- -#endif /* NO_DHCP_SUPPORT */
- -};
- -
- -/* Format of a bootp IP packet. */
- -struct bootpip_t
- -{
- - struct iphdr ip;
- - struct udphdr udp;
- - struct bootp_t bp;
- -};
- -
- -/* Format of bootp packet with extensions. */
- -struct bootpd_t
- -{
- - struct bootp_t bootp_reply;
- - unsigned char bootp_extension[MAX_BOOTP_EXTLEN];
- -};
- -
- -struct tftp_t
- -{
- - struct iphdr ip;
- - struct udphdr udp;
- - unsigned short opcode;
- - union
- - {
- - char rrq[TFTP_DEFAULTSIZE_PACKET];
- -
- - struct
- - {
- - unsigned short block;
- - char download[TFTP_MAX_PACKET];
- - }
- - data;
- -
- - struct
- - {
- - unsigned short block;
- - }
- - ack;
- -
- - struct
- - {
- - unsigned short errcode;
- - char errmsg[TFTP_DEFAULTSIZE_PACKET];
- - }
- - err;
- -
- - struct
- - {
- - char data[TFTP_DEFAULTSIZE_PACKET+2];
- - }
- - oack;
- - }
- - u;
- -};
- -
- -/* Define a smaller tftp packet solely for making requests to conserve stack
- - 512 bytes should be enough. */
- -struct tftpreq_t
- -{
- - struct iphdr ip;
- - struct udphdr udp;
- - unsigned short opcode;
- - union
- - {
- - char rrq[512];
- -
- - struct
- - {
- - unsigned short block;
- - }
- - ack;
- -
- - struct
- - {
- - unsigned short errcode;
- - char errmsg[512-2];
- - }
- - err;
- - }
- - u;
- -};
- -
- -#define TFTP_MIN_PACKET (sizeof(struct iphdr) + sizeof(struct udphdr) + 4)
- -
- -struct rpc_t
- -{
- - struct iphdr ip;
- - struct udphdr udp;
- - union
- - {
- - char data[300]; /* longest RPC call must fit!!!! */
- -
- - struct
- - {
- - long id;
- - long type;
- - long rpcvers;
- - long prog;
- - long vers;
- - long proc;
- - long data[1];
- - }
- - call;
- -
- - struct
- - {
- - long id;
- - long type;
- - long rstatus;
- - long verifier;
- - long v2;
- - long astatus;
- - long data[1];
- - }
- - reply;
- - }
- - u;
- -};
- -
- -#define PROG_PORTMAP 100000
- -#define PROG_NFS 100003
- -#define PROG_MOUNT 100005
- -
- -#define MSG_CALL 0
- -#define MSG_REPLY 1
- -
- -#define PORTMAP_GETPORT 3
- -
- -#define MOUNT_ADDENTRY 1
- -#define MOUNT_UMOUNTALL 4
- -
- -#define NFS_LOOKUP 4
- -#define NFS_READ 6
- -
- -#define NFS_FHSIZE 32
- -
- -#define NFSERR_PERM 1
- -#define NFSERR_NOENT 2
- -#define NFSERR_ACCES 13
- -
- -/* Block size used for NFS read accesses. A RPC reply packet (including all
- - * headers) must fit within a single Ethernet frame to avoid fragmentation.
- - * Chosen to be a power of two, as most NFS servers are optimized for this. */
- -#define NFS_READ_SIZE 1024
- -
- -#define FLOPPY_BOOT_LOCATION 0x7c00
- -/* Must match offsets in loader.S */
- -#define ROM_SEGMENT 0x1fa
- -#define ROM_LENGTH 0x1fc
- -
- -#define ROM_INFO_LOCATION (FLOPPY_BOOT_LOCATION + ROM_SEGMENT)
- -/* at end of floppy boot block */
- -
- -struct rom_info
- -{
- - unsigned short rom_segment;
- - unsigned short rom_length;
- -};
- -
- -static inline int
- -rom_address_ok (struct rom_info *rom, int assigned_rom_segment)
- -{
- - return (assigned_rom_segment < 0xC000
- - || assigned_rom_segment == rom->rom_segment);
- -}
- -
- -/* Define a type for passing info to a loaded program. */
- -struct ebinfo
- -{
- - unsigned char major, minor; /* Version */
- - unsigned short flags; /* Bit flags */
- -};
- -
- -/***************************************************************************
- -External prototypes
- -***************************************************************************/
- -/* main.c */
- -extern void print_network_configuration (void);
- -extern int ifconfig (char *ip, char *sm, char *gw, char *svr);
- -extern int udp_transmit (unsigned long destip, unsigned int srcsock,
- - unsigned int destsock, int len, const void *buf);
- -extern int await_reply (int type, int ival, void *ptr, int timeout);
- -extern int decode_rfc1533 (unsigned char *, int, int, int);
- -extern long rfc2131_sleep_interval (int base, int exp);
- -extern void cleanup (void);
- -extern int rarp (void);
- -extern int bootp (void);
- -extern void cleanup_net (void);
- -
- -/* config.c */
- -extern void print_config (void);
- -extern void eth_reset (void);
- -extern int eth_probe (void);
- -extern int eth_poll (void);
- -extern void eth_transmit (const char *d, unsigned int t,
- - unsigned int s, const void *p);
- -extern void eth_disable (void);
- -
- -/* misc.c */
- -extern void twiddle (void);
- -extern void sleep (int secs);
- -extern int getdec (char **s);
- -extern void etherboot_printf (const char *, ...);
- -extern int etherboot_sprintf (char *, const char *, ...);
- -extern int inet_aton (char *p, in_addr *i);
- -
- -/***************************************************************************
- -External variables
- -***************************************************************************/
- -/* main.c */
- -extern int ip_abort;
- -extern int network_ready;
- -extern struct rom_info rom;
- -extern struct arptable_t arptable[MAX_ARP];
- -extern struct bootpd_t bootp_data;
- -#define BOOTP_DATA_ADDR (&bootp_data)
- -extern unsigned char *end_of_rfc1533;
-
- -/* config.c */
- -extern struct nic nic;
- +#define gateA20_set() gateA20(1)
- +#define gateA20_unset() gateA20(0)
- +#define EBDEBUG 0
- +/* The 'rom_info' maybe arch depended. It must be moved to some other
- + * place */
- +struct rom_info {
- + unsigned short rom_segment;
- + unsigned short rom_length;
- +};
- +
- +extern void poll_interruptions P((void));
- +
- +/* For UNDI drivers */
- +extern void fake_irq ( uint8_t irq );
- +extern void _trivial_irq_handler_start;
- +extern uint32_t get_free_base_memory ( void );
- +extern void forget_base_memory ( void*, size_t );
- +extern void free_unused_base_memory ( void );
-
- -/* Local hack - define some macros to use etherboot source files "as is". */
- -#ifndef GRUB
- -# undef printf
- -# define printf etherboot_printf
- -# undef sprintf
- -# define sprintf etherboot_sprintf
- -#endif /* GRUB */
- +#endif /* ETHERBOOT_H */
- diff -Naur grub-0.97.orig/netboot/fa311.c grub-0.97/netboot/fa311.c
- --- grub-0.97.orig/netboot/fa311.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/fa311.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,421 +0,0 @@
- -/*
- - Driver for the National Semiconductor DP83810 Ethernet controller.
- -
- - Portions Copyright (C) 2001 Inprimis Technologies, Inc.
- - http://www.inprimis.com/
- -
- - This driver is based (heavily) on the Linux driver for this chip
- - which is copyright 1999-2001 by Donald Becker.
- -
- - This software has no warranties expressed or implied for any
- - purpose.
- -
- - This software may be used and distributed according to the terms of
- - the GNU General Public License (GPL), incorporated herein by reference.
- - Drivers based on or derived from this code fall under the GPL and must
- - retain the authorship, copyright and license notice. This file is not
- - a complete program and may only be used when the entire operating
- - system is licensed under the GPL. License for under other terms may be
- - available. Contact the original author for details.
- -
- - The original author may be reached as becker@scyld.com, or at
- - Scyld Computing Corporation
- - 410 Severn Ave., Suite 210
- - Annapolis MD 21403
- -*/
- -
- -
- -typedef unsigned char u8;
- -typedef signed char s8;
- -typedef unsigned short u16;
- -typedef signed short s16;
- -typedef unsigned int u32;
- -typedef signed int s32;
- -
- -#include "etherboot.h"
- -#include "nic.h"
- -#include "pci.h"
- -
- -#undef virt_to_bus
- -#define virt_to_bus(x) ((unsigned long)x)
- -#define cpu_to_le32(val) (val)
- -#define le32_to_cpu(val) (val)
- -#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
- -#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
- -
- -#define TX_RING_SIZE 1
- -#define RX_RING_SIZE 4
- -#define TIME_OUT 1000000
- -#define PKT_BUF_SZ 1536
- -
- -/* Offsets to the device registers. */
- -enum register_offsets {
- - ChipCmd=0x00, ChipConfig=0x04, EECtrl=0x08, PCIBusCfg=0x0C,
- - IntrStatus=0x10, IntrMask=0x14, IntrEnable=0x18,
- - TxRingPtr=0x20, TxConfig=0x24,
- - RxRingPtr=0x30, RxConfig=0x34,
- - WOLCmd=0x40, PauseCmd=0x44, RxFilterAddr=0x48, RxFilterData=0x4C,
- - BootRomAddr=0x50, BootRomData=0x54, StatsCtrl=0x5C, StatsData=0x60,
- - RxPktErrs=0x60, RxMissed=0x68, RxCRCErrs=0x64,
- -};
- -
- -/* Bit in ChipCmd. */
- -enum ChipCmdBits {
- - ChipReset=0x100, RxReset=0x20, TxReset=0x10, RxOff=0x08, RxOn=0x04,
- - TxOff=0x02, TxOn=0x01,
- -};
- -
- -/* Bits in the interrupt status/mask registers. */
- -enum intr_status_bits {
- - IntrRxDone=0x0001, IntrRxIntr=0x0002, IntrRxErr=0x0004, IntrRxEarly=0x0008,
- - IntrRxIdle=0x0010, IntrRxOverrun=0x0020,
- - IntrTxDone=0x0040, IntrTxIntr=0x0080, IntrTxErr=0x0100,
- - IntrTxIdle=0x0200, IntrTxUnderrun=0x0400,
- - StatsMax=0x0800, LinkChange=0x4000, WOLPkt=0x2000,
- - RxResetDone=0x1000000, TxResetDone=0x2000000,
- - IntrPCIErr=0x00f00000, IntrNormalSummary=0x0251, IntrAbnormalSummary=0xED20,
- -};
- -
- -/* Bits in the RxMode register. */
- -enum rx_mode_bits {
- - AcceptErr=0x20, AcceptRunt=0x10, AcceptBroadcast=0xC0000000,
- - AcceptMulticast=0x00200000, AcceptAllMulticast=0x20000000,
- - AcceptAllPhys=0x10000000, AcceptMyPhys=0x08000000,
- -};
- -
- -/* Bits in network_desc.status */
- -enum desc_status_bits {
- - DescOwn=0x80000000, DescMore=0x40000000, DescIntr=0x20000000,
- - DescNoCRC=0x10000000,
- - DescPktOK=0x08000000, RxTooLong=0x00400000,
- -};
- -
- -/* The Rx and Tx buffer descriptors. */
- -struct netdev_desc {
- - u32 next_desc;
- - s32 cmd_status;
- - u32 addr;
- -};
- -
- -static struct FA311_DEV {
- - unsigned int ioaddr;
- - unsigned short vendor;
- - unsigned short device;
- - unsigned int cur_rx;
- - unsigned int cur_tx;
- - unsigned int rx_buf_sz;
- - volatile struct netdev_desc *rx_head_desc;
- - volatile struct netdev_desc rx_ring[RX_RING_SIZE] __attribute__ ((aligned (4)));
- - volatile struct netdev_desc tx_ring[TX_RING_SIZE] __attribute__ ((aligned (4)));
- -} fa311_dev;
- -
- -static int eeprom_read(long ioaddr, int location);
- -static void init_ring(struct FA311_DEV *dev);
- -static void fa311_reset(struct nic *nic);
- -static int fa311_poll(struct nic *nic);
- -static void fa311_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p);
- -static void fa311_disable(struct nic *nic);
- -
- -static char rx_packet[PKT_BUF_SZ * RX_RING_SIZE] __attribute__ ((aligned (4)));
- -static char tx_packet[PKT_BUF_SZ * TX_RING_SIZE] __attribute__ ((aligned (4)));
- -
- -struct nic * fa311_probe(struct nic *nic, unsigned short *io_addrs, struct pci_device *pci)
- -{
- -int prev_eedata;
- -int i;
- -int duplex;
- -int tx_config;
- -int rx_config;
- -unsigned char macaddr[6];
- -unsigned char mactest;
- -unsigned char pci_bus = 0;
- -struct FA311_DEV* dev = &fa311_dev;
- -
- - if (io_addrs == 0 || *io_addrs == 0)
- - return (0);
- - memset(dev, 0, sizeof(*dev));
- - dev->vendor = pci->vendor;
- - dev->device = pci->dev_id;
- - dev->ioaddr = pci->membase;
- -
- - /* Work around the dropped serial bit. */
- - prev_eedata = eeprom_read(dev->ioaddr, 6);
- - for (i = 0; i < 3; i++) {
- - int eedata = eeprom_read(dev->ioaddr, i + 7);
- - macaddr[i*2] = (eedata << 1) + (prev_eedata >> 15);
- - macaddr[i*2+1] = eedata >> 7;
- - prev_eedata = eedata;
- - }
- - mactest = 0;
- - for (i = 0; i < 6; i++)
- - mactest |= macaddr[i];
- - if (mactest == 0)
- - return (0);
- - for (i = 0; i < 6; i++)
- - nic->node_addr[i] = macaddr[i];
- - printf("%! ", nic->node_addr);
- -
- - adjust_pci_device(pci);
- -
- - fa311_reset(nic);
- -
- - nic->reset = fa311_reset;
- - nic->disable = fa311_disable;
- - nic->poll = fa311_poll;
- - nic->transmit = fa311_transmit;
- -
- - init_ring(dev);
- -
- - writel(virt_to_bus(dev->rx_ring), dev->ioaddr + RxRingPtr);
- - writel(virt_to_bus(dev->tx_ring), dev->ioaddr + TxRingPtr);
- -
- - for (i = 0; i < 6; i += 2)
- - {
- - writel(i, dev->ioaddr + RxFilterAddr);
- - writew(macaddr[i] + (macaddr[i+1] << 8),
- - dev->ioaddr + RxFilterData);
- - }
- -
- - /* Initialize other registers. */
- - /* Configure for standard, in-spec Ethernet. */
- - if (readl(dev->ioaddr + ChipConfig) & 0x20000000)
- - { /* Full duplex */
- - tx_config = 0xD0801002;
- - rx_config = 0x10000020;
- - }
- - else
- - {
- - tx_config = 0x10801002;
- - rx_config = 0x0020;
- - }
- - writel(tx_config, dev->ioaddr + TxConfig);
- - writel(rx_config, dev->ioaddr + RxConfig);
- -
- - duplex = readl(dev->ioaddr + ChipConfig) & 0x20000000 ? 1 : 0;
- - if (duplex) {
- - rx_config |= 0x10000000;
- - tx_config |= 0xC0000000;
- - } else {
- - rx_config &= ~0x10000000;
- - tx_config &= ~0xC0000000;
- - }
- - writew(tx_config, dev->ioaddr + TxConfig);
- - writew(rx_config, dev->ioaddr + RxConfig);
- -
- - writel(AcceptBroadcast | AcceptAllMulticast | AcceptMyPhys,
- - dev->ioaddr + RxFilterAddr);
- -
- - writel(RxOn | TxOn, dev->ioaddr + ChipCmd);
- - writel(4, dev->ioaddr + StatsCtrl); /* Clear Stats */
- - return nic;
- -
- -}
- -
- -static void fa311_reset(struct nic *nic)
- -{
- -u32 chip_config;
- -struct FA311_DEV* dev = &fa311_dev;
- -
- - /* Reset the chip to erase previous misconfiguration. */
- - outl(ChipReset, dev->ioaddr + ChipCmd);
- -
- - if ((readl(dev->ioaddr + ChipConfig) & 0xe000) != 0xe000)
- - {
- - chip_config = readl(dev->ioaddr + ChipConfig);
- - }
- -}
- -
- -static int fa311_poll(struct nic *nic)
- -{
- -s32 desc_status;
- -int to;
- -int entry;
- -int retcode;
- -struct FA311_DEV* dev = &fa311_dev;
- -
- - retcode = 0;
- - entry = dev->cur_rx;
- - to = TIME_OUT;
- - while (to != 0)
- - {
- - desc_status = dev->rx_ring[entry].cmd_status;
- - if ((desc_status & DescOwn) != 0)
- - break;
- - else
- - --to;
- - }
- - if (to != 0)
- - {
- - readl(dev->ioaddr + IntrStatus); /* clear interrrupt bits */
- - /* driver owns the next entry it's a new packet. Send it up. */
- - if ((desc_status & (DescMore|DescPktOK|RxTooLong)) == DescPktOK)
- - {
- - nic->packetlen = (desc_status & 0x0fff) - 4; /* Omit CRC size. */
- - memcpy(nic->packet, (char*)(dev->rx_ring[entry].addr), nic->packetlen);
- - retcode = 1;
- - }
- - /* Give the descriptor back to the chip */
- - dev->rx_ring[entry].cmd_status = cpu_to_le32(dev->rx_buf_sz);
- - dev->cur_rx++;
- - if (dev->cur_rx >= RX_RING_SIZE)
- - dev->cur_rx = 0;
- - dev->rx_head_desc = &dev->rx_ring[dev->cur_rx];
- - }
- - /* Restart Rx engine if stopped. */
- - writel(RxOn, dev->ioaddr + ChipCmd);
- - return retcode;
- -}
- -
- -static void fa311_transmit(struct nic *nic, const char *destaddr, unsigned int type, unsigned int len, const char *data)
- -{
- -unsigned short nstype;
- -s32 desc_status;
- -int to;
- -int entry;
- -char* txp;
- -unsigned char* s;
- -struct FA311_DEV* dev = &fa311_dev;
- -
- - /* Calculate the next Tx descriptor entry. */
- - entry = dev->cur_tx;
- - txp = (char*)(dev->tx_ring[entry].addr);
- -
- - memcpy(txp, destaddr, ETH_ALEN);
- - memcpy(txp + ETH_ALEN, nic->node_addr, ETH_ALEN);
- - nstype = htons(type);
- - memcpy(txp + 12, (char*)&nstype, 2);
- - memcpy(txp + ETH_HLEN, data, len);
- - len += ETH_HLEN;
- - /* pad frame */
- - if (len < ETH_ZLEN)
- - {
- - s = (unsigned char*)(txp+len);
- - while (s < (unsigned char*)(txp+ETH_ZLEN))
- - *s++ = 0;
- - len = ETH_ZLEN;
- - }
- - dev->tx_ring[entry].cmd_status = cpu_to_le32(DescOwn | len);
- - dev->cur_tx++;
- - if (dev->cur_tx >= TX_RING_SIZE)
- - dev->cur_tx = 0;
- -
- - /* Wake the potentially-idle transmit channel. */
- - writel(TxOn, dev->ioaddr + ChipCmd);
- -
- - /* wait for tranmission to complete */
- - to = TIME_OUT;
- - while (to != 0)
- - {
- - desc_status = dev->tx_ring[entry].cmd_status;
- - if ((desc_status & DescOwn) == 0)
- - break;
- - else
- - --to;
- - }
- -
- - readl(dev->ioaddr + IntrStatus); /* clear interrrupt bits */
- - return;
- -}
- -
- -static void fa311_disable(struct nic *nic)
- -{
- -struct FA311_DEV* dev = &fa311_dev;
- -
- - /* Stop the chip's Tx and Rx processes. */
- - writel(RxOff | TxOff, dev->ioaddr + ChipCmd);
- -}
- -
- -
- -/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces.
- - The EEPROM code is for the common 93c06/46 EEPROMs with 6 bit addresses. */
- -
- -/* Delay between EEPROM clock transitions.
- - No extra delay is needed with 33Mhz PCI, but future 66Mhz access may need
- - a delay. Note that pre-2.0.34 kernels had a cache-alignment bug that
- - made udelay() unreliable.
- - The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is
- - depricated.
- -*/
- -#define eeprom_delay(ee_addr) inl(ee_addr)
- -
- -enum EEPROM_Ctrl_Bits {
- - EE_ShiftClk=0x04, EE_DataIn=0x01, EE_ChipSelect=0x08, EE_DataOut=0x02,
- -};
- -#define EE_Write0 (EE_ChipSelect)
- -#define EE_Write1 (EE_ChipSelect | EE_DataIn)
- -
- -/* The EEPROM commands include the alway-set leading bit. */
- -enum EEPROM_Cmds {
- - EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6),
- -};
- -
- -
- -static int eeprom_read(long addr, int location)
- -{
- - int i;
- - int retval = 0;
- - int ee_addr = addr + EECtrl;
- - int read_cmd = location | EE_ReadCmd;
- - writel(EE_Write0, ee_addr);
- -
- - /* Shift the read command bits out. */
- - for (i = 10; i >= 0; i--) {
- - short dataval = (read_cmd & (1 << i)) ? EE_Write1 : EE_Write0;
- - writel(dataval, ee_addr);
- - eeprom_delay(ee_addr);
- - writel(dataval | EE_ShiftClk, ee_addr);
- - eeprom_delay(ee_addr);
- - }
- - writel(EE_ChipSelect, ee_addr);
- - eeprom_delay(ee_addr);
- -
- - for (i = 0; i < 16; i++) {
- - writel(EE_ChipSelect | EE_ShiftClk, ee_addr);
- - eeprom_delay(ee_addr);
- - retval |= (readl(ee_addr) & EE_DataOut) ? 1 << i : 0;
- - writel(EE_ChipSelect, ee_addr);
- - eeprom_delay(ee_addr);
- - }
- -
- - /* Terminate the EEPROM access. */
- - writel(EE_Write0, ee_addr);
- - writel(0, ee_addr);
- - return retval;
- -}
- -
- -/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
- -static void init_ring(struct FA311_DEV *dev)
- -{
- - int i;
- -
- - dev->cur_rx = 0;
- - dev->cur_tx = 0;
- -
- - dev->rx_buf_sz = PKT_BUF_SZ;
- - dev->rx_head_desc = &dev->rx_ring[0];
- -
- - /* Initialize all Rx descriptors. */
- - for (i = 0; i < RX_RING_SIZE; i++) {
- - dev->rx_ring[i].next_desc = virt_to_le32desc(&dev->rx_ring[i+1]);
- - dev->rx_ring[i].cmd_status = DescOwn;
- - }
- - /* Mark the last entry as wrapping the ring. */
- - dev->rx_ring[i-1].next_desc = virt_to_le32desc(&dev->rx_ring[0]);
- -
- - /* Fill in the Rx buffers. Handle allocation failure gracefully. */
- - for (i = 0; i < RX_RING_SIZE; i++) {
- - dev->rx_ring[i].addr = (u32)(&rx_packet[PKT_BUF_SZ * i]);
- - dev->rx_ring[i].cmd_status = cpu_to_le32(dev->rx_buf_sz);
- - }
- -
- - for (i = 0; i < TX_RING_SIZE; i++) {
- - dev->tx_ring[i].next_desc = virt_to_le32desc(&dev->tx_ring[i+1]);
- - dev->tx_ring[i].cmd_status = 0;
- - }
- - dev->tx_ring[i-1].next_desc = virt_to_le32desc(&dev->tx_ring[0]);
- -
- - for (i = 0; i < TX_RING_SIZE; i++)
- - dev->tx_ring[i].addr = (u32)(&tx_packet[PKT_BUF_SZ * i]);
- - return;
- -}
- -
- diff -Naur grub-0.97.orig/netboot/forcedeth.c grub-0.97/netboot/forcedeth.c
- --- grub-0.97.orig/netboot/forcedeth.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/forcedeth.c 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,1039 @@
- +/**************************************************************************
- +* forcedeth.c -- Etherboot device driver for the NVIDIA nForce
- +* media access controllers.
- +*
- +* Note: This driver is based on the Linux driver that was based on
- +* a cleanroom reimplementation which was based on reverse
- +* engineered documentation written by Carl-Daniel Hailfinger
- +* and Andrew de Quincey. It's neither supported nor endorsed
- +* by NVIDIA Corp. Use at your own risk.
- +*
- +* Written 2004 by Timothy Legge <tlegge@rogers.com>
- +*
- +* This program is free software; you can redistribute it and/or modify
- +* it under the terms of the GNU General Public License as published by
- +* the Free Software Foundation; either version 2 of the License, or
- +* (at your option) any later version.
- +*
- +* This program is distributed in the hope that it will be useful,
- +* but WITHOUT ANY WARRANTY; without even the implied warranty of
- +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +* GNU General Public License for more details.
- +*
- +* You should have received a copy of the GNU General Public License
- +* along with this program; if not, write to the Free Software
- +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- +*
- +* Portions of this code based on:
- +* forcedeth: Ethernet driver for NVIDIA nForce media access controllers:
- +*
- +* (C) 2003 Manfred Spraul
- +* See Linux Driver for full information
- +*
- +* Linux Driver Version 0.22, 19 Jan 2004
- +*
- +*
- +* REVISION HISTORY:
- +* ================
- +* v1.0 01-31-2004 timlegge Initial port of Linux driver
- +* v1.1 02-03-2004 timlegge Large Clean up, first release
- +*
- +* Indent Options: indent -kr -i8
- +***************************************************************************/
- +
- +/* to get some global routines like printf */
- +#include "etherboot.h"
- +/* to get the interface to the body of the program */
- +#include "nic.h"
- +/* to get the PCI support functions, if this is a PCI NIC */
- +#include "pci.h"
- +/* Include timer support functions */
- +#include "timer.h"
- +
- +#define drv_version "v1.1"
- +#define drv_date "02-03-2004"
- +
- +//#define TFTM_DEBUG
- +#ifdef TFTM_DEBUG
- +#define dprintf(x) printf x
- +#else
- +#define dprintf(x)
- +#endif
- +
- +typedef unsigned char u8;
- +typedef signed char s8;
- +typedef unsigned short u16;
- +typedef signed short s16;
- +typedef unsigned int u32;
- +typedef signed int s32;
- +
- +/* Condensed operations for readability. */
- +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
- +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
- +
- +unsigned long BASE;
- +/* NIC specific static variables go here */
- +
- +
- +/*
- + * Hardware access:
- + */
- +
- +#define DEV_NEED_LASTPACKET1 0x0001
- +#define DEV_IRQMASK_1 0x0002
- +#define DEV_IRQMASK_2 0x0004
- +#define DEV_NEED_TIMERIRQ 0x0008
- +
- +enum {
- + NvRegIrqStatus = 0x000,
- +#define NVREG_IRQSTAT_MIIEVENT 0040
- +#define NVREG_IRQSTAT_MASK 0x1ff
- + NvRegIrqMask = 0x004,
- +#define NVREG_IRQ_RX 0x0002
- +#define NVREG_IRQ_RX_NOBUF 0x0004
- +#define NVREG_IRQ_TX_ERR 0x0008
- +#define NVREG_IRQ_TX2 0x0010
- +#define NVREG_IRQ_TIMER 0x0020
- +#define NVREG_IRQ_LINK 0x0040
- +#define NVREG_IRQ_TX1 0x0100
- +#define NVREG_IRQMASK_WANTED_1 0x005f
- +#define NVREG_IRQMASK_WANTED_2 0x0147
- +#define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR|NVREG_IRQ_TX2|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_TX1))
- +
- + NvRegUnknownSetupReg6 = 0x008,
- +#define NVREG_UNKSETUP6_VAL 3
- +
- +/*
- + * NVREG_POLL_DEFAULT is the interval length of the timer source on the nic
- + * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms
- + */
- + NvRegPollingInterval = 0x00c,
- +#define NVREG_POLL_DEFAULT 970
- + NvRegMisc1 = 0x080,
- +#define NVREG_MISC1_HD 0x02
- +#define NVREG_MISC1_FORCE 0x3b0f3c
- +
- + NvRegTransmitterControl = 0x084,
- +#define NVREG_XMITCTL_START 0x01
- + NvRegTransmitterStatus = 0x088,
- +#define NVREG_XMITSTAT_BUSY 0x01
- +
- + NvRegPacketFilterFlags = 0x8c,
- +#define NVREG_PFF_ALWAYS 0x7F0008
- +#define NVREG_PFF_PROMISC 0x80
- +#define NVREG_PFF_MYADDR 0x20
- +
- + NvRegOffloadConfig = 0x90,
- +#define NVREG_OFFLOAD_HOMEPHY 0x601
- +#define NVREG_OFFLOAD_NORMAL 0x5ee
- + NvRegReceiverControl = 0x094,
- +#define NVREG_RCVCTL_START 0x01
- + NvRegReceiverStatus = 0x98,
- +#define NVREG_RCVSTAT_BUSY 0x01
- +
- + NvRegRandomSeed = 0x9c,
- +#define NVREG_RNDSEED_MASK 0x00ff
- +#define NVREG_RNDSEED_FORCE 0x7f00
- +
- + NvRegUnknownSetupReg1 = 0xA0,
- +#define NVREG_UNKSETUP1_VAL 0x16070f
- + NvRegUnknownSetupReg2 = 0xA4,
- +#define NVREG_UNKSETUP2_VAL 0x16
- + NvRegMacAddrA = 0xA8,
- + NvRegMacAddrB = 0xAC,
- + NvRegMulticastAddrA = 0xB0,
- +#define NVREG_MCASTADDRA_FORCE 0x01
- + NvRegMulticastAddrB = 0xB4,
- + NvRegMulticastMaskA = 0xB8,
- + NvRegMulticastMaskB = 0xBC,
- +
- + NvRegTxRingPhysAddr = 0x100,
- + NvRegRxRingPhysAddr = 0x104,
- + NvRegRingSizes = 0x108,
- +#define NVREG_RINGSZ_TXSHIFT 0
- +#define NVREG_RINGSZ_RXSHIFT 16
- + NvRegUnknownTransmitterReg = 0x10c,
- + NvRegLinkSpeed = 0x110,
- +#define NVREG_LINKSPEED_FORCE 0x10000
- +#define NVREG_LINKSPEED_10 10
- +#define NVREG_LINKSPEED_100 100
- +#define NVREG_LINKSPEED_1000 1000
- + NvRegUnknownSetupReg5 = 0x130,
- +#define NVREG_UNKSETUP5_BIT31 (1<<31)
- + NvRegUnknownSetupReg3 = 0x134,
- +#define NVREG_UNKSETUP3_VAL1 0x200010
- + NvRegTxRxControl = 0x144,
- +#define NVREG_TXRXCTL_KICK 0x0001
- +#define NVREG_TXRXCTL_BIT1 0x0002
- +#define NVREG_TXRXCTL_BIT2 0x0004
- +#define NVREG_TXRXCTL_IDLE 0x0008
- +#define NVREG_TXRXCTL_RESET 0x0010
- + NvRegMIIStatus = 0x180,
- +#define NVREG_MIISTAT_ERROR 0x0001
- +#define NVREG_MIISTAT_LINKCHANGE 0x0008
- +#define NVREG_MIISTAT_MASK 0x000f
- +#define NVREG_MIISTAT_MASK2 0x000f
- + NvRegUnknownSetupReg4 = 0x184,
- +#define NVREG_UNKSETUP4_VAL 8
- +
- + NvRegAdapterControl = 0x188,
- +#define NVREG_ADAPTCTL_START 0x02
- +#define NVREG_ADAPTCTL_LINKUP 0x04
- +#define NVREG_ADAPTCTL_PHYVALID 0x4000
- +#define NVREG_ADAPTCTL_RUNNING 0x100000
- +#define NVREG_ADAPTCTL_PHYSHIFT 24
- + NvRegMIISpeed = 0x18c,
- +#define NVREG_MIISPEED_BIT8 (1<<8)
- +#define NVREG_MIIDELAY 5
- + NvRegMIIControl = 0x190,
- +#define NVREG_MIICTL_INUSE 0x10000
- +#define NVREG_MIICTL_WRITE 0x08000
- +#define NVREG_MIICTL_ADDRSHIFT 5
- + NvRegMIIData = 0x194,
- + NvRegWakeUpFlags = 0x200,
- +#define NVREG_WAKEUPFLAGS_VAL 0x7770
- +#define NVREG_WAKEUPFLAGS_BUSYSHIFT 24
- +#define NVREG_WAKEUPFLAGS_ENABLESHIFT 16
- +#define NVREG_WAKEUPFLAGS_D3SHIFT 12
- +#define NVREG_WAKEUPFLAGS_D2SHIFT 8
- +#define NVREG_WAKEUPFLAGS_D1SHIFT 4
- +#define NVREG_WAKEUPFLAGS_D0SHIFT 0
- +#define NVREG_WAKEUPFLAGS_ACCEPT_MAGPAT 0x01
- +#define NVREG_WAKEUPFLAGS_ACCEPT_WAKEUPPAT 0x02
- +#define NVREG_WAKEUPFLAGS_ACCEPT_LINKCHANGE 0x04
- +
- + NvRegPatternCRC = 0x204,
- + NvRegPatternMask = 0x208,
- + NvRegPowerCap = 0x268,
- +#define NVREG_POWERCAP_D3SUPP (1<<30)
- +#define NVREG_POWERCAP_D2SUPP (1<<26)
- +#define NVREG_POWERCAP_D1SUPP (1<<25)
- + NvRegPowerState = 0x26c,
- +#define NVREG_POWERSTATE_POWEREDUP 0x8000
- +#define NVREG_POWERSTATE_VALID 0x0100
- +#define NVREG_POWERSTATE_MASK 0x0003
- +#define NVREG_POWERSTATE_D0 0x0000
- +#define NVREG_POWERSTATE_D1 0x0001
- +#define NVREG_POWERSTATE_D2 0x0002
- +#define NVREG_POWERSTATE_D3 0x0003
- +};
- +
- +
- +
- +#define NV_TX_LASTPACKET (1<<0)
- +#define NV_TX_RETRYERROR (1<<3)
- +#define NV_TX_LASTPACKET1 (1<<8)
- +#define NV_TX_DEFERRED (1<<10)
- +#define NV_TX_CARRIERLOST (1<<11)
- +#define NV_TX_LATECOLLISION (1<<12)
- +#define NV_TX_UNDERFLOW (1<<13)
- +#define NV_TX_ERROR (1<<14)
- +#define NV_TX_VALID (1<<15)
- +
- +#define NV_RX_DESCRIPTORVALID (1<<0)
- +#define NV_RX_MISSEDFRAME (1<<1)
- +#define NV_RX_SUBSTRACT1 (1<<3)
- +#define NV_RX_ERROR1 (1<<7)
- +#define NV_RX_ERROR2 (1<<8)
- +#define NV_RX_ERROR3 (1<<9)
- +#define NV_RX_ERROR4 (1<<10)
- +#define NV_RX_CRCERR (1<<11)
- +#define NV_RX_OVERFLOW (1<<12)
- +#define NV_RX_FRAMINGERR (1<<13)
- +#define NV_RX_ERROR (1<<14)
- +#define NV_RX_AVAIL (1<<15)
- +
- +/* Miscelaneous hardware related defines: */
- +#define NV_PCI_REGSZ 0x270
- +
- +/* various timeout delays: all in usec */
- +#define NV_TXRX_RESET_DELAY 4
- +#define NV_TXSTOP_DELAY1 10
- +#define NV_TXSTOP_DELAY1MAX 500000
- +#define NV_TXSTOP_DELAY2 100
- +#define NV_RXSTOP_DELAY1 10
- +#define NV_RXSTOP_DELAY1MAX 500000
- +#define NV_RXSTOP_DELAY2 100
- +#define NV_SETUP5_DELAY 5
- +#define NV_SETUP5_DELAYMAX 50000
- +#define NV_POWERUP_DELAY 5
- +#define NV_POWERUP_DELAYMAX 5000
- +#define NV_MIIBUSY_DELAY 50
- +#define NV_MIIPHY_DELAY 10
- +#define NV_MIIPHY_DELAYMAX 10000
- +
- +#define NV_WAKEUPPATTERNS 5
- +#define NV_WAKEUPMASKENTRIES 4
- +
- +/* General driver defaults */
- +#define NV_WATCHDOG_TIMEO (2*HZ)
- +#define DEFAULT_MTU 1500 /* also maximum supported, at least for now */
- +
- +#define RX_RING 4
- +#define TX_RING 2
- +/* limited to 1 packet until we understand NV_TX_LASTPACKET */
- +#define TX_LIMIT_STOP 10
- +#define TX_LIMIT_START 5
- +
- +/* rx/tx mac addr + type + vlan + align + slack*/
- +#define RX_NIC_BUFSIZE (DEFAULT_MTU + 64)
- +/* even more slack */
- +#define RX_ALLOC_BUFSIZE (DEFAULT_MTU + 128)
- +
- +#define OOM_REFILL (1+HZ/20)
- +#define POLL_WAIT (1+HZ/100)
- +
- +struct ring_desc {
- + u32 PacketBuffer;
- + u16 Length;
- + u16 Flags;
- +};
- +
- +
- +/* Define the TX Descriptor */
- +static struct ring_desc tx_ring[TX_RING];
- +
- +/* Create a static buffer of size RX_BUF_SZ for each
- +TX Descriptor. All descriptors point to a
- +part of this buffer */
- +static unsigned char txb[TX_RING * RX_NIC_BUFSIZE];
- +
- +/* Define the TX Descriptor */
- +static struct ring_desc rx_ring[RX_RING];
- +
- +/* Create a static buffer of size RX_BUF_SZ for each
- +RX Descriptor All descriptors point to a
- +part of this buffer */
- +static unsigned char rxb[RX_RING * RX_NIC_BUFSIZE];
- +
- +/* Private Storage for the NIC */
- +struct forcedeth_private {
- + /* General data:
- + * Locking: spin_lock(&np->lock); */
- + int in_shutdown;
- + u32 linkspeed;
- + int duplex;
- + int phyaddr;
- +
- + /* General data: RO fields */
- + u8 *ring_addr;
- + u32 orig_mac[2];
- + u32 irqmask;
- + /* rx specific fields.
- + * Locking: Within irq hander or disable_irq+spin_lock(&np->lock);
- + */
- + struct ring_desc *rx_ring;
- + unsigned int cur_rx, refill_rx;
- + struct sk_buff *rx_skbuff[RX_RING];
- + u32 rx_dma[RX_RING];
- + unsigned int rx_buf_sz;
- +
- + /*
- + * tx specific fields.
- + */
- + struct ring_desc *tx_ring;
- + unsigned int next_tx, nic_tx;
- + struct sk_buff *tx_skbuff[TX_RING];
- + u32 tx_dma[TX_RING];
- + u16 tx_flags;
- +} npx;
- +
- +static struct forcedeth_private *np;
- +
- +static inline void pci_push(u8 * base)
- +{
- + /* force out pending posted writes */
- + readl(base);
- +}
- +static int reg_delay(int offset, u32 mask,
- + u32 target, int delay, int delaymax, const char *msg)
- +{
- + u8 *base = (u8 *) BASE;
- +
- + pci_push(base);
- + do {
- + udelay(delay);
- + delaymax -= delay;
- + if (delaymax < 0) {
- + if (msg)
- + printf(msg);
- + return 1;
- + }
- + } while ((readl(base + offset) & mask) != target);
- + return 0;
- +}
- +
- +#define MII_READ (-1)
- +#define MII_PHYSID1 0x02 /* PHYS ID 1 */
- +#define MII_PHYSID2 0x03 /* PHYS ID 2 */
- +#define MII_BMCR 0x00 /* Basic mode control register */
- +#define MII_BMSR 0x01 /* Basic mode status register */
- +#define MII_ADVERTISE 0x04 /* Advertisement control reg */
- +#define MII_LPA 0x05 /* Link partner ability reg */
- +
- +#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
- +
- +/* Link partner ability register. */
- +#define LPA_SLCT 0x001f /* Same as advertise selector */
- +#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */
- +#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */
- +#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */
- +#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */
- +#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */
- +#define LPA_RESV 0x1c00 /* Unused... */
- +#define LPA_RFAULT 0x2000 /* Link partner faulted */
- +#define LPA_LPACK 0x4000 /* Link partner acked us */
- +#define LPA_NPAGE 0x8000 /* Next page bit */
- +
- +/* mii_rw: read/write a register on the PHY.
- + *
- + * Caller must guarantee serialization
- + */
- +static int mii_rw(struct nic *nic __unused, int addr, int miireg,
- + int value)
- +{
- + u8 *base = (u8 *) BASE;
- + int was_running;
- + u32 reg;
- + int retval;
- +
- + writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus);
- + was_running = 0;
- + reg = readl(base + NvRegAdapterControl);
- + if (reg & NVREG_ADAPTCTL_RUNNING) {
- + was_running = 1;
- + writel(reg & ~NVREG_ADAPTCTL_RUNNING,
- + base + NvRegAdapterControl);
- + }
- + reg = readl(base + NvRegMIIControl);
- + if (reg & NVREG_MIICTL_INUSE) {
- + writel(NVREG_MIICTL_INUSE, base + NvRegMIIControl);
- + udelay(NV_MIIBUSY_DELAY);
- + }
- +
- + reg =
- + NVREG_MIICTL_INUSE | (addr << NVREG_MIICTL_ADDRSHIFT) | miireg;
- + if (value != MII_READ) {
- + writel(value, base + NvRegMIIData);
- + reg |= NVREG_MIICTL_WRITE;
- + }
- + writel(reg, base + NvRegMIIControl);
- +
- + if (reg_delay(NvRegMIIControl, NVREG_MIICTL_INUSE, 0,
- + NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX, NULL)) {
- + dprintf(("mii_rw of reg %d at PHY %d timed out.\n",
- + miireg, addr));
- + retval = -1;
- + } else if (value != MII_READ) {
- + /* it was a write operation - fewer failures are detectable */
- + dprintf(("mii_rw wrote 0x%x to reg %d at PHY %d\n",
- + value, miireg, addr));
- + retval = 0;
- + } else if (readl(base + NvRegMIIStatus) & NVREG_MIISTAT_ERROR) {
- + dprintf(("mii_rw of reg %d at PHY %d failed.\n",
- + miireg, addr));
- + retval = -1;
- + } else {
- + /* FIXME: why is that required? */
- + udelay(50);
- + retval = readl(base + NvRegMIIData);
- + dprintf(("mii_rw read from reg %d at PHY %d: 0x%x.\n",
- + miireg, addr, retval));
- + }
- + if (was_running) {
- + reg = readl(base + NvRegAdapterControl);
- + writel(reg | NVREG_ADAPTCTL_RUNNING,
- + base + NvRegAdapterControl);
- + }
- + return retval;
- +}
- +
- +static void start_rx(struct nic *nic __unused)
- +{
- + u8 *base = (u8 *) BASE;
- +
- + dprintf(("start_rx\n"));
- + /* Already running? Stop it. */
- + if (readl(base + NvRegReceiverControl) & NVREG_RCVCTL_START) {
- + writel(0, base + NvRegReceiverControl);
- + pci_push(base);
- + }
- + writel(np->linkspeed, base + NvRegLinkSpeed);
- + pci_push(base);
- + writel(NVREG_RCVCTL_START, base + NvRegReceiverControl);
- + pci_push(base);
- +}
- +
- +static void stop_rx(void)
- +{
- + u8 *base = (u8 *) BASE;
- +
- + dprintf(("stop_rx\n"));
- + writel(0, base + NvRegReceiverControl);
- + reg_delay(NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0,
- + NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX,
- + "stop_rx: ReceiverStatus remained busy");
- +
- + udelay(NV_RXSTOP_DELAY2);
- + writel(0, base + NvRegLinkSpeed);
- +}
- +
- +static void start_tx(struct nic *nic __unused)
- +{
- + u8 *base = (u8 *) BASE;
- +
- + dprintf(("start_tx\n"));
- + writel(NVREG_XMITCTL_START, base + NvRegTransmitterControl);
- + pci_push(base);
- +}
- +
- +static void stop_tx(void)
- +{
- + u8 *base = (u8 *) BASE;
- +
- + dprintf(("stop_tx\n"));
- + writel(0, base + NvRegTransmitterControl);
- + reg_delay(NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0,
- + NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX,
- + "stop_tx: TransmitterStatus remained busy");
- +
- + udelay(NV_TXSTOP_DELAY2);
- + writel(0, base + NvRegUnknownTransmitterReg);
- +}
- +
- +
- +static void txrx_reset(struct nic *nic __unused)
- +{
- + u8 *base = (u8 *) BASE;
- +
- + dprintf(("txrx_reset\n"));
- + writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET,
- + base + NvRegTxRxControl);
- + pci_push(base);
- + udelay(NV_TXRX_RESET_DELAY);
- + writel(NVREG_TXRXCTL_BIT2, base + NvRegTxRxControl);
- + pci_push(base);
- +}
- +
- +/*
- + * alloc_rx: fill rx ring entries.
- + * Return 1 if the allocations for the skbs failed and the
- + * rx engine is without Available descriptors
- + */
- +static int alloc_rx(struct nic *nic __unused)
- +{
- + unsigned int refill_rx = np->refill_rx;
- + int i;
- + //while (np->cur_rx != refill_rx) {
- + for (i = 0; i < RX_RING; i++) {
- + //int nr = refill_rx % RX_RING;
- + rx_ring[i].PacketBuffer =
- + virt_to_le32desc(&rxb[i * RX_NIC_BUFSIZE]);
- + rx_ring[i].Length = cpu_to_le16(RX_NIC_BUFSIZE);
- + wmb();
- + rx_ring[i].Flags = cpu_to_le16(NV_RX_AVAIL);
- + /* printf("alloc_rx: Packet %d marked as Available\n",
- + refill_rx); */
- + refill_rx++;
- + }
- + np->refill_rx = refill_rx;
- + if (np->cur_rx - refill_rx == RX_RING)
- + return 1;
- + return 0;
- +}
- +
- +static int update_linkspeed(struct nic *nic)
- +{
- + int adv, lpa, newdup;
- + u32 newls;
- + adv = mii_rw(nic, np->phyaddr, MII_ADVERTISE, MII_READ);
- + lpa = mii_rw(nic, np->phyaddr, MII_LPA, MII_READ);
- + dprintf(("update_linkspeed: PHY advertises 0x%hX, lpa 0x%hX.\n",
- + adv, lpa));
- +
- + /* FIXME: handle parallel detection properly, handle gigabit ethernet */
- + lpa = lpa & adv;
- + if (lpa & LPA_100FULL) {
- + newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_100;
- + newdup = 1;
- + } else if (lpa & LPA_100HALF) {
- + newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_100;
- + newdup = 0;
- + } else if (lpa & LPA_10FULL) {
- + newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10;
- + newdup = 1;
- + } else if (lpa & LPA_10HALF) {
- + newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10;
- + newdup = 0;
- + } else {
- + printf("bad ability %hX - falling back to 10HD.\n", lpa);
- + newls = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10;
- + newdup = 0;
- + }
- + if (np->duplex != newdup || np->linkspeed != newls) {
- + np->duplex = newdup;
- + np->linkspeed = newls;
- + return 1;
- + }
- + return 0;
- +}
- +
- +
- +
- +static int init_ring(struct nic *nic)
- +{
- + int i;
- +
- + np->next_tx = np->nic_tx = 0;
- + for (i = 0; i < TX_RING; i++) {
- + tx_ring[i].Flags = 0;
- + }
- +
- + np->cur_rx = 0;
- + np->refill_rx = 0;
- + for (i = 0; i < RX_RING; i++) {
- + rx_ring[i].Flags = 0;
- + }
- + return alloc_rx(nic);
- +}
- +
- +static void set_multicast(struct nic *nic)
- +{
- +
- + u8 *base = (u8 *) BASE;
- + u32 addr[2];
- + u32 mask[2];
- + u32 pff;
- + u32 alwaysOff[2];
- + u32 alwaysOn[2];
- +
- + memset(addr, 0, sizeof(addr));
- + memset(mask, 0, sizeof(mask));
- +
- + pff = NVREG_PFF_MYADDR;
- +
- + alwaysOn[0] = alwaysOn[1] = alwaysOff[0] = alwaysOff[1] = 0;
- +
- + addr[0] = alwaysOn[0];
- + addr[1] = alwaysOn[1];
- + mask[0] = alwaysOn[0] | alwaysOff[0];
- + mask[1] = alwaysOn[1] | alwaysOff[1];
- +
- + addr[0] |= NVREG_MCASTADDRA_FORCE;
- + pff |= NVREG_PFF_ALWAYS;
- + stop_rx();
- + writel(addr[0], base + NvRegMulticastAddrA);
- + writel(addr[1], base + NvRegMulticastAddrB);
- + writel(mask[0], base + NvRegMulticastMaskA);
- + writel(mask[1], base + NvRegMulticastMaskB);
- + writel(pff, base + NvRegPacketFilterFlags);
- + start_rx(nic);
- +}
- +
- +/**************************************************************************
- +RESET - Reset the NIC to prepare for use
- +***************************************************************************/
- +static int forcedeth_reset(struct nic *nic)
- +{
- + u8 *base = (u8 *) BASE;
- + int ret, oom, i;
- + ret = 0;
- + dprintf(("forcedeth: open\n"));
- +
- + /* 1) erase previous misconfiguration */
- + /* 4.1-1: stop adapter: ignored, 4.3 seems to be overkill */
- + writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA);
- + writel(0, base + NvRegMulticastAddrB);
- + writel(0, base + NvRegMulticastMaskA);
- + writel(0, base + NvRegMulticastMaskB);
- + writel(0, base + NvRegPacketFilterFlags);
- + writel(0, base + NvRegAdapterControl);
- + writel(0, base + NvRegLinkSpeed);
- + writel(0, base + NvRegUnknownTransmitterReg);
- + txrx_reset(nic);
- + writel(0, base + NvRegUnknownSetupReg6);
- +
- + /* 2) initialize descriptor rings */
- + np->in_shutdown = 0;
- + oom = init_ring(nic);
- +
- + /* 3) set mac address */
- + {
- + u32 mac[2];
- +
- + mac[0] =
- + (nic->node_addr[0] << 0) + (nic->node_addr[1] << 8) +
- + (nic->node_addr[2] << 16) + (nic->node_addr[3] << 24);
- + mac[1] =
- + (nic->node_addr[4] << 0) + (nic->node_addr[5] << 8);
- +
- + writel(mac[0], base + NvRegMacAddrA);
- + writel(mac[1], base + NvRegMacAddrB);
- + }
- +
- + /* 4) continue setup */
- + np->linkspeed = NVREG_LINKSPEED_FORCE | NVREG_LINKSPEED_10;
- + np->duplex = 0;
- + writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3);
- + writel(0, base + NvRegTxRxControl);
- + pci_push(base);
- + writel(NVREG_TXRXCTL_BIT1, base + NvRegTxRxControl);
- +
- + reg_delay(NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31,
- + NVREG_UNKSETUP5_BIT31, NV_SETUP5_DELAY,
- + NV_SETUP5_DELAYMAX,
- + "open: SetupReg5, Bit 31 remained off\n");
- + writel(0, base + NvRegUnknownSetupReg4);
- +
- + /* 5) Find a suitable PHY */
- + writel(NVREG_MIISPEED_BIT8 | NVREG_MIIDELAY, base + NvRegMIISpeed);
- + for (i = 1; i < 32; i++) {
- + int id1, id2;
- +
- + id1 = mii_rw(nic, i, MII_PHYSID1, MII_READ);
- + if (id1 < 0)
- + continue;
- + id2 = mii_rw(nic, i, MII_PHYSID2, MII_READ);
- + if (id2 < 0)
- + continue;
- + dprintf(("open: Found PHY %04x:%04x at address %d.\n",
- + id1, id2, i));
- + np->phyaddr = i;
- +
- + update_linkspeed(nic);
- +
- + break;
- + }
- + if (i == 32) {
- + printf("open: failing due to lack of suitable PHY.\n");
- + ret = -1;
- + goto out_drain;
- + }
- +
- + printf("%d-Mbs Link, %s-Duplex\n",
- + np->linkspeed & NVREG_LINKSPEED_10 ? 10 : 100,
- + np->duplex ? "Full" : "Half");
- + /* 6) continue setup */
- + writel(NVREG_MISC1_FORCE | (np->duplex ? 0 : NVREG_MISC1_HD),
- + base + NvRegMisc1);
- + writel(readl(base + NvRegTransmitterStatus),
- + base + NvRegTransmitterStatus);
- + writel(NVREG_PFF_ALWAYS, base + NvRegPacketFilterFlags);
- + writel(NVREG_OFFLOAD_NORMAL, base + NvRegOffloadConfig);
- +
- + writel(readl(base + NvRegReceiverStatus),
- + base + NvRegReceiverStatus);
- +
- + /* FIXME: I cheated and used the calculator to get a random number */
- + i = 75963081;
- + writel(NVREG_RNDSEED_FORCE | (i & NVREG_RNDSEED_MASK),
- + base + NvRegRandomSeed);
- + writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1);
- + writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2);
- + writel(NVREG_POLL_DEFAULT, base + NvRegPollingInterval);
- + writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6);
- + writel((np->
- + phyaddr << NVREG_ADAPTCTL_PHYSHIFT) |
- + NVREG_ADAPTCTL_PHYVALID, base + NvRegAdapterControl);
- + writel(NVREG_UNKSETUP4_VAL, base + NvRegUnknownSetupReg4);
- + writel(NVREG_WAKEUPFLAGS_VAL, base + NvRegWakeUpFlags);
- +
- + /* 7) start packet processing */
- + writel((u32) virt_to_le32desc(&rx_ring[0]),
- + base + NvRegRxRingPhysAddr);
- + writel((u32) virt_to_le32desc(&tx_ring[0]),
- + base + NvRegTxRingPhysAddr);
- +
- +
- + writel(((RX_RING - 1) << NVREG_RINGSZ_RXSHIFT) +
- + ((TX_RING - 1) << NVREG_RINGSZ_TXSHIFT),
- + base + NvRegRingSizes);
- +
- + i = readl(base + NvRegPowerState);
- + if ((i & NVREG_POWERSTATE_POWEREDUP) == 0) {
- + writel(NVREG_POWERSTATE_POWEREDUP | i,
- + base + NvRegPowerState);
- + }
- + pci_push(base);
- + udelay(10);
- + writel(readl(base + NvRegPowerState) | NVREG_POWERSTATE_VALID,
- + base + NvRegPowerState);
- + writel(NVREG_ADAPTCTL_RUNNING, base + NvRegAdapterControl);
- +
- + writel(0, base + NvRegIrqMask);
- + pci_push(base);
- + writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);
- + pci_push(base);
- + writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus);
- + writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);
- + pci_push(base);
- +/*
- + writel(np->irqmask, base + NvRegIrqMask);
- +*/
- + writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA);
- + writel(0, base + NvRegMulticastAddrB);
- + writel(0, base + NvRegMulticastMaskA);
- + writel(0, base + NvRegMulticastMaskB);
- + writel(NVREG_PFF_ALWAYS | NVREG_PFF_MYADDR,
- + base + NvRegPacketFilterFlags);
- +
- + set_multicast(nic);
- + //start_rx(nic);
- + start_tx(nic);
- +
- + if (!
- + (mii_rw(nic, np->phyaddr, MII_BMSR, MII_READ) &
- + BMSR_ANEGCOMPLETE)) {
- + printf("no link during initialization.\n");
- + }
- +
- + udelay(10000);
- + out_drain:
- + return ret;
- +}
- +
- +//extern void hex_dump(const char *data, const unsigned int len);
- +
- +/**************************************************************************
- +POLL - Wait for a frame
- +***************************************************************************/
- +static int forcedeth_poll(struct nic *nic, int retrieve)
- +{
- + /* return true if there's an ethernet packet ready to read */
- + /* nic->packet should contain data on return */
- + /* nic->packetlen should contain length of data */
- +
- + struct ring_desc *prd;
- + int len;
- + int i;
- +
- + i = np->cur_rx % RX_RING;
- + prd = &rx_ring[i];
- +
- + if ( ! (prd->Flags & cpu_to_le16(NV_RX_DESCRIPTORVALID)) ) {
- + return 0;
- + }
- +
- + if ( ! retrieve ) return 1;
- +
- + /* got a valid packet - forward it to the network core */
- + len = cpu_to_le16(prd->Length);
- + nic->packetlen = len;
- + //hex_dump(rxb + (i * RX_NIC_BUFSIZE), len);
- + memcpy(nic->packet, rxb +
- + (i * RX_NIC_BUFSIZE), nic->packetlen);
- +
- + wmb();
- + np->cur_rx++;
- + alloc_rx(nic);
- + return 1;
- +}
- +
- +
- +/**************************************************************************
- +TRANSMIT - Transmit a frame
- +***************************************************************************/
- +static void forcedeth_transmit(struct nic *nic, const char *d, /* Destination */
- + unsigned int t, /* Type */
- + unsigned int s, /* size */
- + const char *p)
- +{ /* Packet */
- + /* send the packet to destination */
- + u8 *ptxb;
- + u16 nstype;
- + //u16 status;
- + u8 *base = (u8 *) BASE;
- + int nr = np->next_tx % TX_RING;
- +
- + /* point to the current txb incase multiple tx_rings are used */
- + ptxb = txb + (nr * RX_NIC_BUFSIZE);
- + //np->tx_skbuff[nr] = ptxb;
- +
- + /* copy the packet to ring buffer */
- + memcpy(ptxb, d, ETH_ALEN); /* dst */
- + memcpy(ptxb + ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */
- + nstype = htons((u16) t); /* type */
- + memcpy(ptxb + 2 * ETH_ALEN, (u8 *) & nstype, 2); /* type */
- + memcpy(ptxb + ETH_HLEN, p, s);
- +
- + s += ETH_HLEN;
- + while (s < ETH_ZLEN) /* pad to min length */
- + ptxb[s++] = '\0';
- +
- + tx_ring[nr].PacketBuffer = (u32) virt_to_le32desc(ptxb);
- + tx_ring[nr].Length = cpu_to_le16(s - 1);
- +
- + wmb();
- + tx_ring[nr].Flags = np->tx_flags;
- +
- + writel(NVREG_TXRXCTL_KICK, base + NvRegTxRxControl);
- + pci_push(base);
- + tx_ring[nr].Flags = np->tx_flags;
- + np->next_tx++;
- +}
- +
- +/**************************************************************************
- +DISABLE - Turn off ethernet interface
- +***************************************************************************/
- +static void forcedeth_disable(struct dev *dev __unused)
- +{
- + /* put the card in its initial state */
- + /* This function serves 3 purposes.
- + * This disables DMA and interrupts so we don't receive
- + * unexpected packets or interrupts from the card after
- + * etherboot has finished.
- + * This frees resources so etherboot may use
- + * this driver on another interface
- + * This allows etherboot to reinitialize the interface
- + * if something is something goes wrong.
- + */
- + u8 *base = (u8 *) BASE;
- + np->in_shutdown = 1;
- + stop_tx();
- + stop_rx();
- +
- + /* disable interrupts on the nic or we will lock up */
- + writel(0, base + NvRegIrqMask);
- + pci_push(base);
- + dprintf(("Irqmask is zero again\n"));
- +
- + /* specia op:o write back the misordered MAC address - otherwise
- + * the next probe_nic would see a wrong address.
- + */
- + writel(np->orig_mac[0], base + NvRegMacAddrA);
- + writel(np->orig_mac[1], base + NvRegMacAddrB);
- +}
- +
- +/**************************************************************************
- +IRQ - Enable, Disable, or Force interrupts
- +***************************************************************************/
- +static void forcedeth_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
- +
- +/**************************************************************************
- +PROBE - Look for an adapter, this routine's visible to the outside
- +***************************************************************************/
- +#define IORESOURCE_MEM 0x00000200
- +#define board_found 1
- +#define valid_link 0
- +static int forcedeth_probe(struct dev *dev, struct pci_device *pci)
- +{
- + struct nic *nic = (struct nic *) dev;
- + unsigned long addr;
- + int sz;
- + u8 *base;
- +
- + if (pci->ioaddr == 0)
- + return 0;
- +
- + printf("forcedeth.c: Found %s, vendor=0x%hX, device=0x%hX\n",
- + pci->name, pci->vendor, pci->dev_id);
- +
- + nic->irqno = 0;
- + nic->ioaddr = pci->ioaddr & ~3;
- +
- + /* point to private storage */
- + np = &npx;
- +
- + adjust_pci_device(pci);
- +
- + addr = pci_bar_start(pci, PCI_BASE_ADDRESS_0);
- + sz = pci_bar_size(pci, PCI_BASE_ADDRESS_0);
- +
- + /* BASE is used throughout to address the card */
- + BASE = (unsigned long) ioremap(addr, sz);
- + if (!BASE)
- + return 0;
- + //rx_ring[0] = rx_ring;
- + //tx_ring[0] = tx_ring;
- +
- + /* read the mac address */
- + base = (u8 *) BASE;
- + np->orig_mac[0] = readl(base + NvRegMacAddrA);
- + np->orig_mac[1] = readl(base + NvRegMacAddrB);
- +
- + nic->node_addr[0] = (np->orig_mac[1] >> 8) & 0xff;
- + nic->node_addr[1] = (np->orig_mac[1] >> 0) & 0xff;
- + nic->node_addr[2] = (np->orig_mac[0] >> 24) & 0xff;
- + nic->node_addr[3] = (np->orig_mac[0] >> 16) & 0xff;
- + nic->node_addr[4] = (np->orig_mac[0] >> 8) & 0xff;
- + nic->node_addr[5] = (np->orig_mac[0] >> 0) & 0xff;
- +#ifdef LINUX
- + if (!is_valid_ether_addr(dev->dev_addr)) {
- + /*
- + * Bad mac address. At least one bios sets the mac address
- + * to 01:23:45:67:89:ab
- + */
- + printk(KERN_ERR
- + "%s: Invalid Mac address detected: %02x:%02x:%02x:%02x:%02x:%02x\n",
- + pci_name(pci_dev), dev->dev_addr[0],
- + dev->dev_addr[1], dev->dev_addr[2],
- + dev->dev_addr[3], dev->dev_addr[4],
- + dev->dev_addr[5]);
- + printk(KERN_ERR
- + "Please complain to your hardware vendor. Switching to a random MAC.\n");
- + dev->dev_addr[0] = 0x00;
- + dev->dev_addr[1] = 0x00;
- + dev->dev_addr[2] = 0x6c;
- + get_random_bytes(&dev->dev_addr[3], 3);
- + }
- +#endif
- + printf("%s: MAC Address %!, ", pci->name, nic->node_addr);
- +
- + np->tx_flags =
- + cpu_to_le16(NV_TX_LASTPACKET | NV_TX_LASTPACKET1 |
- + NV_TX_VALID);
- + switch (pci->dev_id) {
- + case 0x01C3: // nforce
- + np->irqmask = NVREG_IRQMASK_WANTED_2;
- + np->irqmask |= NVREG_IRQ_TIMER;
- + break;
- + case 0x0066: // nforce2
- + np->tx_flags |= cpu_to_le16(NV_TX_LASTPACKET1);
- + np->irqmask = NVREG_IRQMASK_WANTED_2;
- + np->irqmask |= NVREG_IRQ_TIMER;
- + break;
- + case 0x00D6: // nforce3
- + np->tx_flags |= cpu_to_le16(NV_TX_LASTPACKET1);
- + np->irqmask = NVREG_IRQMASK_WANTED_2;
- + np->irqmask |= NVREG_IRQ_TIMER;
- +
- + }
- + dprintf(("%s: forcedeth.c: subsystem: %hX:%hX bound to %s\n",
- + pci->name, pci->vendor, pci->dev_id, pci->name));
- +
- + forcedeth_reset(nic);
- +// if (board_found && valid_link)
- + /* point to NIC specific routines */
- + dev->disable = forcedeth_disable;
- + nic->poll = forcedeth_poll;
- + nic->transmit = forcedeth_transmit;
- + nic->irq = forcedeth_irq;
- + return 1;
- +// }
- + /* else */
- +}
- +
- +static struct pci_id forcedeth_nics[] = {
- + PCI_ROM(0x10de, 0x01C3, "nforce", "nForce Ethernet Controller"),
- + PCI_ROM(0x10de, 0x0066, "nforce2", "nForce2 Ethernet Controller"),
- + PCI_ROM(0x10de, 0x00D6, "nforce3", "nForce3 Ethernet Controller"),
- +};
- +
- +struct pci_driver forcedeth_driver = {
- + .type = NIC_DRIVER,
- + .name = "forcedeth",
- + .probe = forcedeth_probe,
- + .ids = forcedeth_nics,
- + .id_count = sizeof(forcedeth_nics) / sizeof(forcedeth_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/fsys_tftp.c grub-0.97/netboot/fsys_tftp.c
- --- grub-0.97.orig/netboot/fsys_tftp.c 2004-04-15 11:38:40.000000000 +0000
- +++ grub-0.97/netboot/fsys_tftp.c 2005-08-31 19:03:35.000000000 +0000
- @@ -29,14 +29,15 @@
- /* #define TFTP_DEBUG 1 */
-
- #include <filesys.h>
- +#include <shared.h>
-
- -#define GRUB 1
- -#include <etherboot.h>
- -#include <nic.h>
- +#include "grub.h"
- +#include "tftp.h"
- +#include "nic.h"
-
- static int retry;
- static unsigned short iport = 2000;
- -static unsigned short oport;
- +static unsigned short oport = 0;
- static unsigned short block, prevblock;
- static int bcounter;
- static struct tftp_t tp, saved_tp;
- @@ -46,6 +47,172 @@
- static unsigned short len, saved_len;
- static char *buf;
-
- +/**
- + * tftp_read
- + *
- + * Read file with _name_, data handled by _fnc_. In fact, grub never
- + * use it, we just use it to read dhcp config file.
- + */
- +static int await_tftp(int ival, void *ptr __unused,
- + unsigned short ptype __unused, struct iphdr *ip,
- + struct udphdr *udp)
- +{
- + if (!udp) {
- + return 0;
- + }
- + if (arptable[ARP_CLIENT].ipaddr.s_addr != ip->dest.s_addr)
- + return 0;
- + if (ntohs(udp->dest) != ival)
- + return 0;
- + return 1;
- +}
- +
- +int tftp_file_read(const char *name, int (*fnc)(unsigned char *, unsigned int, unsigned int, int))
- +{
- + struct tftpreq_t tp;
- + struct tftp_t *tr;
- + int rc;
- +
- + retry = 0;
- + block = 0;
- + prevblock = 0;
- + bcounter = 0;
- +
- +
- + rx_qdrain();
- +
- + tp.opcode = htons(TFTP_RRQ);
- + /* Warning: the following assumes the layout of bootp_t.
- + But that's fixed by the IP, UDP and BOOTP specs. */
- + len = sizeof(tp.ip) + sizeof(tp.udp) + sizeof(tp.opcode) +
- + sprintf((char *)tp.u.rrq, "%s%coctet%cblksize%c%d",
- + name, 0, 0, 0, TFTP_MAX_PACKET) + 1;
- + if (!udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, ++iport,
- + TFTP_PORT, len, &tp))
- + return (0);
- + for (;;)
- + {
- + long timeout;
- +#ifdef CONGESTED
- + timeout = rfc2131_sleep_interval(block?TFTP_REXMT: TIMEOUT, retry);
- +#else
- + timeout = rfc2131_sleep_interval(TIMEOUT, retry);
- +#endif
- + if (!await_reply(await_tftp, iport, NULL, timeout))
- + {
- + if (!block && retry++ < MAX_TFTP_RETRIES)
- + { /* maybe initial request was lost */
- + if (!udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr,
- + ++iport, TFTP_PORT, len, &tp))
- + return (0);
- + continue;
- + }
- +#ifdef CONGESTED
- + if (block && ((retry += TFTP_REXMT) < TFTP_TIMEOUT))
- + { /* we resend our last ack */
- +#ifdef MDEBUG
- + printf("<REXMT>\n");
- +#endif
- + udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr,
- + iport, oport,
- + TFTP_MIN_PACKET, &tp);
- + continue;
- + }
- +#endif
- + break; /* timeout */
- + }
- + tr = (struct tftp_t *)&nic.packet[ETH_HLEN];
- + if (tr->opcode == ntohs(TFTP_ERROR))
- + {
- + printf("TFTP error %d (%s)\n",
- + ntohs(tr->u.err.errcode),
- + tr->u.err.errmsg);
- + break;
- + }
- +
- + if (tr->opcode == ntohs(TFTP_OACK)) {
- + char *p = tr->u.oack.data, *e;
- +
- + if (prevblock) /* shouldn't happen */
- + continue; /* ignore it */
- + len = ntohs(tr->udp.len) - sizeof(struct udphdr) - 2;
- + if (len > TFTP_MAX_PACKET)
- + goto noak;
- + e = p + len;
- + while (*p != '\0' && p < e) {
- +/* if (!strcasecmp("blksize", p)) { */
- + if (!grub_strcmp("blksize", p)) {
- + p += 8;
- +/* if ((packetsize = strtoul(p, &p, 10)) < */
- + if ((packetsize = getdec(&p)) < TFTP_DEFAULTSIZE_PACKET)
- + goto noak;
- + while (p < e && *p) p++;
- + if (p < e)
- + p++;
- + }
- + else {
- + noak:
- + tp.opcode = htons(TFTP_ERROR);
- + tp.u.err.errcode = 8;
- +/*
- + * Warning: the following assumes the layout of bootp_t.
- + * But that's fixed by the IP, UDP and BOOTP specs.
- + */
- + len = sizeof(tp.ip) + sizeof(tp.udp) + sizeof(tp.opcode) + sizeof(tp.u.err.errcode) +
- +/*
- + * Normally bad form to omit the format string, but in this case
- + * the string we are copying from is fixed. sprintf is just being
- + * used as a strcpy and strlen.
- + */
- + sprintf((char *)tp.u.err.errmsg,
- + "RFC1782 error") + 1;
- + udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr,
- + iport, ntohs(tr->udp.src),
- + len, &tp);
- + return (0);
- + }
- + }
- + if (p > e)
- + goto noak;
- + block = tp.u.ack.block = 0; /* this ensures, that */
- + /* the packet does not get */
- + /* processed as data! */
- + }
- + else if (tr->opcode == htons(TFTP_DATA)) {
- + len = ntohs(tr->udp.len) - sizeof(struct udphdr) - 4;
- + if (len > packetsize) /* shouldn't happen */
- + continue; /* ignore it */
- + block = ntohs(tp.u.ack.block = tr->u.data.block); }
- + else {/* neither TFTP_OACK nor TFTP_DATA */
- + break;
- + }
- +
- + if ((block || bcounter) && (block != (unsigned short)(prevblock+1))) {
- + /* Block order should be continuous */
- + tp.u.ack.block = htons(block = prevblock);
- + }
- + tp.opcode = htons(TFTP_ACK);
- + oport = ntohs(tr->udp.src);
- + udp_transmit(arptable[ARP_SERVER].ipaddr.s_addr, iport,
- + oport, TFTP_MIN_PACKET, &tp); /* ack */
- + if ((unsigned short)(block-prevblock) != 1) {
- + /* Retransmission or OACK, don't process via callback
- + * and don't change the value of prevblock. */
- + continue;
- + }
- + prevblock = block;
- + retry = 0; /* It's the right place to zero the timer? */
- + if ((rc = fnc(tr->u.data.download,
- + ++bcounter, len, len < packetsize)) <= 0)
- + return(rc);
- + if (len < packetsize) { /* End of data --- fnc should not have returned */
- + printf("tftp download complete, but\n");
- + return (1);
- + }
- + }
- + return (0);
- +}
- +
- /* Fill the buffer by receiving the data via the TFTP protocol. */
- static int
- buf_fill (int abort)
- @@ -65,9 +232,9 @@
- timeout = rfc2131_sleep_interval (TIMEOUT, retry);
- #endif
-
- - if (! await_reply (AWAIT_TFTP, iport, NULL, timeout))
- + if (! await_reply (await_tftp, iport, NULL, timeout))
- {
- - if (ip_abort)
- + if (user_abort)
- return 0;
-
- if (! block && retry++ < MAX_TFTP_RETRIES)
- @@ -270,13 +437,7 @@
- buf_read = 0;
- saved_filepos = 0;
-
- - /* Clear out the Rx queue first. It contains nothing of interest,
- - * except possibly ARP requests from the DHCP/TFTP server. We use
- - * polling throughout Etherboot, so some time may have passed since we
- - * last polled the receive queue, which may now be filled with
- - * broadcast packets. This will cause the reply to the packets we are
- - * about to send to be lost immediately. Not very clever. */
- - await_reply (AWAIT_QDRAIN, 0, NULL, 0);
- + rx_qdrain();
-
- #ifdef TFTP_DEBUG
- grub_printf ("send_rrq ()\n");
- diff -Naur grub-0.97.orig/netboot/grub.h grub-0.97/netboot/grub.h
- --- grub-0.97.orig/netboot/grub.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/grub.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,171 @@
- +#ifndef GRUB_H
- +#define GRUB_H
- +
- +#include "osdep.h"
- +#include "byteswap.h"
- +#include "in.h"
- +#include "ip.h"
- +#include "udp.h"
- +#include "if_ether.h"
- +#include "latch.h"
- +#include "io.h"
- +#include "nic.h"
- +#include <shared.h>
- +
- +#define K_ESC '\033'
- +#define K_EOF '\04' /* Ctrl-D */
- +#define K_INTR '\03' /* Ctrl-C */
- +
- +#ifndef MAX_RPC_RETRIES
- +#define MAX_RPC_RETRIES 20
- +#endif
- +
- +
- +/* Inter-packet retry in ticks */
- +#ifndef TIMEOUT
- +#define TIMEOUT (10*TICKS_PER_SEC)
- +#endif
- +
- +#ifndef NULL
- +#define NULL ((void *)0)
- +#endif
- +
- +
- +#define ARP_CLIENT 0
- +#define ARP_SERVER 1
- +#define ARP_GATEWAY 2
- +#define MAX_ARP ARP_GATEWAY+1
- +
- +#define IGMP_SERVER 0
- +#define MAX_IGMP IGMP_SERVER+1
- +
- +#define RARP_REQUEST 3
- +#define RARP_REPLY 4
- +
- +
- +#define MULTICAST_MASK 0xF0000000
- +#define MULTICAST_NETWORK 0xE0000000
- +
- +struct arptable_t {
- + in_addr ipaddr;
- + uint8_t node[6];
- +};
- +
- +struct igmptable_t {
- + in_addr group;
- + unsigned long time;
- +};
- +
- +#define KERNEL_BUF (BOOTP_DATA_ADDR->bootp_reply.bp_file)
- +
- +#define FLOPPY_BOOT_LOCATION 0x7c00
- +/* Must match offsets in loader.S */
- +#define ROM_SEGMENT 0x1fa
- +#define ROM_LENGTH 0x1fc
- +
- +#define ROM_INFO_LOCATION (FLOPPY_BOOT_LOCATION+ROM_SEGMENT)
- +/* at end of floppy boot block */
- +
- +
- +
- +/* Define a type for passing info to a loaded program */
- +struct ebinfo {
- + uint8_t major, minor; /* Version */
- + uint16_t flags; /* Bit flags */
- +};
- +
- +/***************************************************************************
- +External prototypes
- +***************************************************************************/
- +extern void rx_qdrain P((void));
- +extern int tftp P((const char *name, int (*)(unsigned char *, unsigned int, unsigned int, int)));
- +extern int ip_transmit P((int len, const void *buf));
- +extern void build_ip_hdr P((unsigned long destip, int ttl, int protocol,
- + int option_len, int len, const void *buf));
- +extern void build_udp_hdr P((unsigned long destip,
- + unsigned int srcsock, unsigned int destsock, int ttl,
- + int len, const void *buf));
- +extern int udp_transmit P((unsigned long destip, unsigned int srcsock,
- + unsigned int destsock, int len, const void *buf));
- +typedef int (*reply_t)(int ival, void *ptr, unsigned short ptype, struct iphdr *ip, struct udphdr *udp);
- +extern int await_reply P((reply_t reply, int ival, void *ptr, long timeout));
- +extern int decode_rfc1533 P((unsigned char *, unsigned int, unsigned int, int));
- +extern void join_group(int slot, unsigned long group);
- +extern void leave_group(int slot);
- +#define RAND_MAX 2147483647L
- +extern uint16_t ipchksum P((const void *ip, unsigned long len));
- +extern uint16_t add_ipchksums P((unsigned long offset, uint16_t sum, uint16_t new));
- +extern int32_t random P((void));
- +extern long rfc2131_sleep_interval P((long base, int exp));
- +extern long rfc1112_sleep_interval P((long base, int exp));
- +#ifndef DOWNLOAD_PROTO_TFTP
- +#define tftp(fname, load_block) 0
- +#endif
- +extern void cleanup P((void));
- +
- +/* misc.c */
- +extern void twiddle P((void));
- +extern void sleep P((int secs));
- +extern void interruptible_sleep P((int secs));
- +extern void poll_interruptions P((void));
- +extern int strcasecmp P((const char *a, const char *b));
- +extern char *substr P((const char *a, const char *b));
- +extern unsigned long strtoul P((const char *p, const char **, int base));
- +extern void printf P((const char *, ...));
- +extern int sprintf P((char *, const char *, ...));
- +extern int inet_aton P((char *p, in_addr *i));
- +extern void putchar P((int));
- +extern int getchar P((void));
- +extern int iskey P((void));
- +
- +extern void grub_printf(const char *, ...);
- +extern char config_file[128];
- +extern void etherboot_printf(const char *, ...);
- +extern int etherboot_sprintf(char *, const char *, ...);
- +extern int getdec(char **s);
- +extern void cleanup_net(void);
- +extern void print_network_configuration (void);
- +extern int ifconfig (char *, char *, char *, char *);
- +extern struct arptable_t arptable[MAX_ARP];
- +
- +#undef printf
- +#undef sprintf
- +#define printf etherboot_printf
- +#define sprintf etherboot_sprintf
- +
- +#ifdef DEBUG
- +#define EnterFunction(func) printf("Enter: " func "\n");
- +#define LeaveFunction(func) printf("Leave: " func "\n");
- +#else
- +#define EnterFunction(func)
- +#define LeaveFunction(func)
- +#endif
- +
- +/*
- + * Some codes from etherboot use a level in DEBUG. Define it to be
- + * zero means no debug info output, that will make them silence in
- + * compiling. Up it as you want.
- + */
- +#ifndef DEBUG
- +# define DEBUG 0
- +#endif
- +
- +/*#define RPC_DEBUG*/
- +
- +extern char *hostname;
- +
- +extern int hostnamelen;
- +/* Whether network is ready */
- +extern int network_ready;
- +
- +/* User aborted in await_reply if not zero */
- +extern int user_abort;
- +
- +extern int rarp(void);
- +extern int grub_eth_probe(void);
- +extern int bootp(void);
- +
- +extern int dhcp(void);
- +
- +extern struct nic nic;
- +#endif /* GRUB_H */
- diff -Naur grub-0.97.orig/netboot/i386_byteswap.h grub-0.97/netboot/i386_byteswap.h
- --- grub-0.97.orig/netboot/i386_byteswap.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/i386_byteswap.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,46 @@
- +#ifndef ETHERBOOT_BITS_BYTESWAP_H
- +#define ETHERBOOT_BITS_BYTESWAP_H
- +
- +#include "types.h"
- +static inline uint16_t __i386_bswap_16(uint16_t x)
- +{
- + __asm__("xchgb %b0,%h0\n\t"
- + : "=q" (x)
- + : "0" (x));
- + return x;
- +}
- +
- +static inline uint32_t __i386_bswap_32(uint32_t x)
- +{
- + __asm__("xchgb %b0,%h0\n\t"
- + "rorl $16,%0\n\t"
- + "xchgb %b0,%h0"
- + : "=q" (x)
- + : "0" (x));
- + return x;
- +}
- +
- +
- +#define __bswap_constant_16(x) \
- + ((uint16_t)((((uint16_t)(x) & 0x00ff) << 8) | \
- + (((uint16_t)(x) & 0xff00) >> 8)))
- +
- +#define __bswap_constant_32(x) \
- + ((uint32_t)((((uint32_t)(x) & 0x000000ffU) << 24) | \
- + (((uint32_t)(x) & 0x0000ff00U) << 8) | \
- + (((uint32_t)(x) & 0x00ff0000U) >> 8) | \
- + (((uint32_t)(x) & 0xff000000U) >> 24)))
- +
- +#define __bswap_16(x) \
- + (__builtin_constant_p(x) ? \
- + __bswap_constant_16(x) : \
- + __i386_bswap_16(x))
- +
- +
- +#define __bswap_32(x) \
- + (__builtin_constant_p(x) ? \
- + __bswap_constant_32(x) : \
- + __i386_bswap_32(x))
- +
- +
- +#endif /* ETHERBOOT_BITS_BYTESWAP_H */
- diff -Naur grub-0.97.orig/netboot/i386_elf.h grub-0.97/netboot/i386_elf.h
- --- grub-0.97.orig/netboot/i386_elf.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/i386_elf.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,91 @@
- +#ifndef I386_BITS_ELF_H
- +#define I386_BITS_ELF_H
- +
- +#include "cpu.h"
- +
- +#ifdef CONFIG_X86_64
- +/* ELF Defines for the 64bit version of the current architecture */
- +#define EM_CURRENT_64 EM_X86_64
- +#define EM_CURRENT_64_PRESENT ( \
- + CPU_FEATURE_P(cpu_info.x86_capability, LM) && \
- + CPU_FEATURE_P(cpu_info.x86_capability, PAE) && \
- + CPU_FEATURE_P(cpu_info.x86_capability, PSE))
- +
- +#define ELF_CHECK_X86_64_ARCH(x) \
- + (EM_CURRENT_64_PRESENT && ((x).e_machine == EM_X86_64))
- +#define __unused_i386
- +#else
- +#define ELF_CHECK_X86_64_ARCH(x) 0
- +#define __unused_i386 __unused
- +#endif
- +
- +
- +/* ELF Defines for the current architecture */
- +#define EM_CURRENT EM_386
- +#define ELFDATA_CURRENT ELFDATA2LSB
- +
- +#define ELF_CHECK_I386_ARCH(x) \
- + (((x).e_machine == EM_386) || ((x).e_machine == EM_486))
- +
- +#define ELF_CHECK_ARCH(x) \
- + ((ELF_CHECK_I386_ARCH(x) || ELF_CHECK_X86_64_ARCH(x)) && \
- + ((x).e_entry <= 0xffffffffUL))
- +
- +#ifdef IMAGE_FREEBSD
- +/*
- + * FreeBSD has this rather strange "feature" of its design.
- + * At some point in its evolution, FreeBSD started to rely
- + * externally on private/static/debug internal symbol information.
- + * That is, some of the interfaces that software uses to access
- + * and work with the FreeBSD kernel are made available not
- + * via the shared library symbol information (the .DYNAMIC section)
- + * but rather the debug symbols. This means that any symbol, not
- + * just publicly defined symbols can be (and are) used by system
- + * tools to make the system work. (such as top, swapinfo, swapon,
- + * etc)
- + *
- + * Even worse, however, is the fact that standard ELF loaders do
- + * not know how to load the symbols since they are not within
- + * an ELF PT_LOAD section. The kernel needs these symbols to
- + * operate so the following changes/additions to the boot
- + * loading of EtherBoot have been made to get the kernel to load.
- + * All of the changes are within IMAGE_FREEBSD such that the
- + * extra/changed code only compiles when FREEBSD support is
- + * enabled.
- + */
- +
- +/*
- + * Section header for FreeBSD (debug symbol kludge!) support
- + */
- +typedef struct {
- + Elf32_Word sh_name; /* Section name (index into the
- + section header string table). */
- + Elf32_Word sh_type; /* Section type. */
- + Elf32_Word sh_flags; /* Section flags. */
- + Elf32_Addr sh_addr; /* Address in memory image. */
- + Elf32_Off sh_offset; /* Offset in file. */
- + Elf32_Size sh_size; /* Size in bytes. */
- + Elf32_Word sh_link; /* Index of a related section. */
- + Elf32_Word sh_info; /* Depends on section type. */
- + Elf32_Size sh_addralign; /* Alignment in bytes. */
- + Elf32_Size sh_entsize; /* Size of each entry in section. */
- +} Elf32_Shdr;
- +
- +/* sh_type */
- +#define SHT_SYMTAB 2 /* symbol table section */
- +#define SHT_STRTAB 3 /* string table section */
- +
- +/*
- + * Module information subtypes (for the metadata that we need to build)
- + */
- +#define MODINFO_END 0x0000 /* End of list */
- +#define MODINFO_NAME 0x0001 /* Name of module (string) */
- +#define MODINFO_TYPE 0x0002 /* Type of module (string) */
- +#define MODINFO_METADATA 0x8000 /* Module-specfic */
- +
- +#define MODINFOMD_SSYM 0x0003 /* start of symbols */
- +#define MODINFOMD_ESYM 0x0004 /* end of symbols */
- +
- +#endif /* IMAGE_FREEBSD */
- +
- +#endif /* I386_BITS_ELF_H */
- diff -Naur grub-0.97.orig/netboot/i386_endian.h grub-0.97/netboot/i386_endian.h
- --- grub-0.97.orig/netboot/i386_endian.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/i386_endian.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,6 @@
- +#ifndef ETHERBOOT_BITS_ENDIAN_H
- +#define ETHERBOOT_BITS_ENDIAN_H
- +
- +#define __BYTE_ORDER __LITTLE_ENDIAN
- +
- +#endif /* ETHERBOOT_BITS_ENDIAN_H */
- diff -Naur grub-0.97.orig/netboot/i386_timer.c grub-0.97/netboot/i386_timer.c
- --- grub-0.97.orig/netboot/i386_timer.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/i386_timer.c 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,192 @@
- +/* A couple of routines to implement a low-overhead timer for drivers */
- +
- + /*
- + * This program is free software; you can redistribute it and/or
- + * modify it under the terms of the GNU General Public License as
- + * published by the Free Software Foundation; either version 2, or (at
- + * your option) any later version.
- + */
- +#include "grub.h"
- +#include "osdep.h"
- +#include "io.h"
- +#include "timer.h"
- +#include "latch.h"
- +
- +void __load_timer2(unsigned int ticks)
- +{
- + /*
- + * Now let's take care of PPC channel 2
- + *
- + * Set the Gate high, program PPC channel 2 for mode 0,
- + * (interrupt on terminal count mode), binary count,
- + * load 5 * LATCH count, (LSB and MSB) to begin countdown.
- + *
- + * Note some implementations have a bug where the high bits byte
- + * of channel 2 is ignored.
- + */
- + /* Set up the timer gate, turn off the speaker */
- + /* Set the Gate high, disable speaker */
- + outb((inb(PPC_PORTB) & ~PPCB_SPKR) | PPCB_T2GATE, PPC_PORTB);
- + /* binary, mode 0, LSB/MSB, Ch 2 */
- + outb(TIMER2_SEL|WORD_ACCESS|MODE0|BINARY_COUNT, TIMER_MODE_PORT);
- + /* LSB of ticks */
- + outb(ticks & 0xFF, TIMER2_PORT);
- + /* MSB of ticks */
- + outb(ticks >> 8, TIMER2_PORT);
- +}
- +
- +static int __timer2_running(void)
- +{
- + return ((inb(PPC_PORTB) & PPCB_T2OUT) == 0);
- +}
- +
- +#if !defined(CONFIG_TSC_CURRTICKS)
- +void setup_timers(void)
- +{
- + return;
- +}
- +
- +void load_timer2(unsigned int ticks)
- +{
- + return __load_timer2(ticks);
- +}
- +
- +int timer2_running(void)
- +{
- + return __timer2_running();
- +}
- +
- +void ndelay(unsigned int nsecs)
- +{
- + waiton_timer2((nsecs * CLOCK_TICK_RATE)/1000000000);
- +}
- +void udelay(unsigned int usecs)
- +{
- + waiton_timer2((usecs * TICKS_PER_MS)/1000);
- +}
- +#endif /* !defined(CONFIG_TSC_CURRTICKS) */
- +
- +#if defined(CONFIG_TSC_CURRTICKS)
- +
- +#define rdtsc(low,high) \
- + __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
- +
- +#define rdtscll(val) \
- + __asm__ __volatile__ ("rdtsc" : "=A" (val))
- +
- +
- +/* Number of clock ticks to time with the rtc */
- +#define LATCH 0xFF
- +
- +#define LATCHES_PER_SEC ((CLOCK_TICK_RATE + (LATCH/2))/LATCH)
- +#define TICKS_PER_LATCH ((LATCHES_PER_SEC + (TICKS_PER_SEC/2))/TICKS_PER_SEC)
- +
- +static void sleep_latch(void)
- +{
- + __load_timer2(LATCH);
- + while(__timer2_running());
- +}
- +
- +/* ------ Calibrate the TSC -------
- + * Time how long it takes to excute a loop that runs in known time.
- + * And find the convertion needed to get to CLOCK_TICK_RATE
- + */
- +
- +
- +static unsigned long long calibrate_tsc(void)
- +{
- + unsigned long startlow, starthigh;
- + unsigned long endlow, endhigh;
- +
- + rdtsc(startlow,starthigh);
- + sleep_latch();
- + rdtsc(endlow,endhigh);
- +
- + /* 64-bit subtract - gcc just messes up with long longs */
- + __asm__("subl %2,%0\n\t"
- + "sbbl %3,%1"
- + :"=a" (endlow), "=d" (endhigh)
- + :"g" (startlow), "g" (starthigh),
- + "0" (endlow), "1" (endhigh));
- +
- + /* Error: ECPUTOOFAST */
- + if (endhigh)
- + goto bad_ctc;
- +
- + endlow *= TICKS_PER_LATCH;
- + return endlow;
- +
- + /*
- + * The CTC wasn't reliable: we got a hit on the very first read,
- + * or the CPU was so fast/slow that the quotient wouldn't fit in
- + * 32 bits..
- + */
- +bad_ctc:
- + printf("bad_ctc\n");
- + return 0;
- +}
- +
- +static unsigned long clocks_per_tick;
- +void setup_timers(void)
- +{
- + if (!clocks_per_tick) {
- + clocks_per_tick = calibrate_tsc();
- + /* Display the CPU Mhz to easily test if the calibration was bad */
- + printf("CPU %ld Mhz\n", (clocks_per_tick/1000 * TICKS_PER_SEC)/1000);
- + }
- +}
- +
- +unsigned long currticks(void)
- +{
- + unsigned long clocks_high, clocks_low;
- + unsigned long currticks;
- + /* Read the Time Stamp Counter */
- + rdtsc(clocks_low, clocks_high);
- +
- + /* currticks = clocks / clocks_per_tick; */
- + __asm__("divl %1"
- + :"=a" (currticks)
- + :"r" (clocks_per_tick), "0" (clocks_low), "d" (clocks_high));
- +
- +
- + return currticks;
- +}
- +
- +static unsigned long long timer_timeout;
- +static int __timer_running(void)
- +{
- + unsigned long long now;
- + rdtscll(now);
- + return now < timer_timeout;
- +}
- +
- +void udelay(unsigned int usecs)
- +{
- + unsigned long long now;
- + rdtscll(now);
- + timer_timeout = now + usecs * ((clocks_per_tick * TICKS_PER_SEC)/(1000*1000));
- + while(__timer_running());
- +}
- +void ndelay(unsigned int nsecs)
- +{
- + unsigned long long now;
- + rdtscll(now);
- + timer_timeout = now + nsecs * ((clocks_per_tick * TICKS_PER_SEC)/(1000*1000*1000));
- + while(__timer_running());
- +}
- +
- +void load_timer2(unsigned int timer2_ticks)
- +{
- + unsigned long long now;
- + unsigned long clocks;
- + rdtscll(now);
- + clocks = timer2_ticks * ((clocks_per_tick * TICKS_PER_SEC)/CLOCK_TICK_RATE);
- + timer_timeout = now + clocks;
- +}
- +
- +int timer2_running(void)
- +{
- + return __timer_running();
- +}
- +
- +#endif /* RTC_CURRTICKS */
- diff -Naur grub-0.97.orig/netboot/i82586.c grub-0.97/netboot/i82586.c
- --- grub-0.97.orig/netboot/i82586.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/i82586.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,825 +0,0 @@
- -/**************************************************************************
- -Etherboot - BOOTP/TFTP Bootstrap Program
- -i82586 NIC driver for Etherboot
- -Ken Yap, January 1998
- -***************************************************************************/
- -
- -/*
- - * This program is free software; you can redistribute it and/or
- - * modify it under the terms of the GNU General Public License as
- - * published by the Free Software Foundation; either version 2, or (at
- - * your option) any later version.
- - */
- -
- -#include "etherboot.h"
- -#include "nic.h"
- -#include "cards.h"
- -#include "timer.h"
- -
- -#define udelay(n) waiton_timer2(((n)*TICKS_PER_MS)/1000)
- -
- -/* Sources of information:
- -
- - Donald Becker's excellent 3c507 driver in Linux
- - Intel 82596 data sheet (yes, 82596; it has a 586 compatibility mode)
- -*/
- -
- -/* Code below mostly stolen wholesale from 3c507.c driver in Linux */
- -
- -/*
- - Details of the i82586.
- -
- - You'll really need the databook to understand the details of this part,
- - but the outline is that the i82586 has two separate processing units.
- - Both are started from a list of three configuration tables, of which only
- - the last, the System Control Block (SCB), is used after reset-time. The SCB
- - has the following fields:
- - Status word
- - Command word
- - Tx/Command block addr.
- - Rx block addr.
- - The command word accepts the following controls for the Tx and Rx units:
- - */
- -
- -#define CUC_START 0x0100
- -#define CUC_RESUME 0x0200
- -#define CUC_SUSPEND 0x0300
- -#define RX_START 0x0010
- -#define RX_RESUME 0x0020
- -#define RX_SUSPEND 0x0030
- -
- -/* The Rx unit uses a list of frame descriptors and a list of data buffer
- - descriptors. We use full-sized (1518 byte) data buffers, so there is
- - a one-to-one pairing of frame descriptors to buffer descriptors.
- -
- - The Tx ("command") unit executes a list of commands that look like:
- - Status word Written by the 82586 when the command is done.
- - Command word Command in lower 3 bits, post-command action in upper 3
- - Link word The address of the next command.
- - Parameters (as needed).
- -
- - Some definitions related to the Command Word are:
- - */
- -#define CMD_EOL 0x8000 /* The last command of the list, stop. */
- -#define CMD_SUSP 0x4000 /* Suspend after doing cmd. */
- -#define CMD_INTR 0x2000 /* Interrupt after doing cmd. */
- -
- -enum commands {
- - CmdNOp = 0, CmdSASetup = 1, CmdConfigure = 2, CmdMulticastList = 3,
- - CmdTx = 4, CmdTDR = 5, CmdDump = 6, CmdDiagnose = 7};
- -
- -/*
- - Details of the EtherLink16 Implementation
- -
- - The 3c507 and NI5210 are generic shared-memory i82586 implementations.
- - 3c507: The host can map 16K, 32K, 48K, or 64K of the 64K memory into
- - 0x0[CD][08]0000, or all 64K into 0xF[02468]0000.
- - NI5210: The host can map 8k or 16k at 0x[CDE][048C]000 but we
- - assume 8k because to have 16k you cannot put a ROM on the NIC.
- - */
- -
- -/* Offsets from the base I/O address. */
- -
- -#ifdef INCLUDE_3C507
- -
- -#define SA_DATA 0 /* Station address data, or 3Com signature. */
- -#define MISC_CTRL 6 /* Switch the SA_DATA banks, and bus config bits. */
- -#define RESET_IRQ 10 /* Reset the latched IRQ line. */
- -#define I82586_ATTN 11 /* Frob the 82586 Channel Attention line. */
- -#define ROM_CONFIG 13
- -#define MEM_CONFIG 14
- -#define IRQ_CONFIG 15
- -#define EL16_IO_EXTENT 16
- -
- -/* The ID port is used at boot-time to locate the ethercard. */
- -#define ID_PORT 0x100
- -
- -#endif
- -
- -#ifdef INCLUDE_NI5210
- -
- -#define NI52_RESET 0 /* writing to this address, resets the i82586 */
- -#define I82586_ATTN 1 /* channel attention, kick the 586 */
- -
- -#endif
- -
- -#ifdef INCLUDE_EXOS205
- -
- -#define EXOS205_RESET 0 /* writing to this address, resets the i82586 */
- -#define I82586_ATTN 1 /* channel attention, kick the 586 */
- -
- -#endif
- -
- -/* Offsets to registers in the mailbox (SCB). */
- -#define iSCB_STATUS 0x8
- -#define iSCB_CMD 0xA
- -#define iSCB_CBL 0xC /* Command BLock offset. */
- -#define iSCB_RFA 0xE /* Rx Frame Area offset. */
- -
- -/* Since the 3c507 maps the shared memory window so that the last byte is
- -at 82586 address FFFF, the first byte is at 82586 address 0, 16K, 32K, or
- -48K corresponding to window sizes of 64K, 48K, 32K and 16K respectively.
- -We can account for this be setting the 'SBC Base' entry in the ISCP table
- -below for all the 16 bit offset addresses, and also adding the 'SCB Base'
- -value to all 24 bit physical addresses (in the SCP table and the TX and RX
- -Buffer Descriptors).
- - -Mark
- -*/
- -
- -/*
- - What follows in 'init_words[]' is the "program" that is downloaded to the
- - 82586 memory. It's mostly tables and command blocks, and starts at the
- - reset address 0xfffff6. This is designed to be similar to the EtherExpress,
- - thus the unusual location of the SCB at 0x0008.
- -
- - Even with the additional "don't care" values, doing it this way takes less
- - program space than initializing the individual tables, and I feel it's much
- - cleaner.
- -
- - The databook is particularly useless for the first two structures, I had
- - to use the Crynwr driver as an example.
- -
- - The memory setup is as follows:
- -*/
- -
- -#define CONFIG_CMD 0x18
- -#define SET_SA_CMD 0x24
- -#define SA_OFFSET 0x2A
- -#define IDLELOOP 0x30
- -#define TDR_CMD 0x38
- -#define TDR_TIME 0x3C
- -#define DUMP_CMD 0x40
- -#define DIAG_CMD 0x48
- -#define SET_MC_CMD 0x4E
- -#define DUMP_DATA 0x56 /* A 170 byte buffer for dump and Set-MC into. */
- -
- -#define TX_BUF_START 0x0100
- -#define TX_BUF_SIZE (1518+14+20+16) /* packet+header+TBD */
- -
- -#define RX_BUF_START 0x1000
- -#define RX_BUF_SIZE (1518+14+18) /* packet+header+RBD */
- -#define RX_BUF_END (mem_end - mem_start - 20)
- -
- -/*
- - That's it: only 86 bytes to set up the beast, including every extra
- - command available. The 170 byte buffer at DUMP_DATA is shared between the
- - Dump command (called only by the diagnostic program) and the SetMulticastList
- - command.
- -
- - To complete the memory setup you only have to write the station address at
- - SA_OFFSET and create the Tx & Rx buffer lists.
- -
- - The Tx command chain and buffer list is setup as follows:
- - A Tx command table, with the data buffer pointing to...
- - A Tx data buffer descriptor. The packet is in a single buffer, rather than
- - chaining together several smaller buffers.
- - A NoOp command, which initially points to itself,
- - And the packet data.
- -
- - A transmit is done by filling in the Tx command table and data buffer,
- - re-writing the NoOp command, and finally changing the offset of the last
- - command to point to the current Tx command. When the Tx command is finished,
- - it jumps to the NoOp, when it loops until the next Tx command changes the
- - "link offset" in the NoOp. This way the 82586 never has to go through the
- - slow restart sequence.
- -
- - The Rx buffer list is set up in the obvious ring structure. We have enough
- - memory (and low enough interrupt latency) that we can avoid the complicated
- - Rx buffer linked lists by alway associating a full-size Rx data buffer with
- - each Rx data frame.
- -
- - I currently use one transmit buffer starting at TX_BUF_START (0x0100), and
- - use the rest of memory, from RX_BUF_START to RX_BUF_END, for Rx buffers.
- -
- - */
- -
- -static unsigned short init_words[] = {
- - /* System Configuration Pointer (SCP). */
- -#if defined(INCLUDE_3C507)
- - 0x0000, /* Set bus size to 16 bits. */
- -#else
- - 0x0001, /* Set bus size to 8 bits */
- -#endif
- - 0,0, /* pad words. */
- - 0x0000,0x0000, /* ISCP phys addr, set in init_82586_mem(). */
- -
- - /* Intermediate System Configuration Pointer (ISCP). */
- - 0x0001, /* Status word that's cleared when init is done. */
- - 0x0008,0,0, /* SCB offset, (skip, skip) */
- -
- - /* System Control Block (SCB). */
- - 0,0xf000|RX_START|CUC_START, /* SCB status and cmd. */
- - CONFIG_CMD, /* Command list pointer, points to Configure. */
- - RX_BUF_START, /* Rx block list. */
- - 0,0,0,0, /* Error count: CRC, align, buffer, overrun. */
- -
- - /* 0x0018: Configure command. Change to put MAC data with packet. */
- - 0, CmdConfigure, /* Status, command. */
- - SET_SA_CMD, /* Next command is Set Station Addr. */
- - 0x0804, /* "4" bytes of config data, 8 byte FIFO. */
- - 0x2e40, /* Magic values, including MAC data location. */
- - 0, /* Unused pad word. */
- -
- - /* 0x0024: Setup station address command. */
- - 0, CmdSASetup,
- - SET_MC_CMD, /* Next command. */
- - 0xaa00,0xb000,0x0bad, /* Station address (to be filled in) */
- -
- - /* 0x0030: NOP, looping back to itself. Point to first Tx buffer to Tx. */
- - 0, CmdNOp, IDLELOOP, 0 /* pad */,
- -
- - /* 0x0038: A unused Time-Domain Reflectometer command. */
- - 0, CmdTDR, IDLELOOP, 0,
- -
- - /* 0x0040: An unused Dump State command. */
- - 0, CmdDump, IDLELOOP, DUMP_DATA,
- -
- - /* 0x0048: An unused Diagnose command. */
- - 0, CmdDiagnose, IDLELOOP,
- -
- - /* 0x004E: An empty set-multicast-list command. */
- - 0, CmdMulticastList, IDLELOOP, 0,
- -};
- -
- -/* NIC specific static variables go here */
- -
- -static unsigned short ioaddr, irq, scb_base;
- -static Address mem_start, mem_end;
- -static unsigned short rx_head, rx_tail;
- -
- -#define read_mem(m,s) fmemcpy((char *)s, m, sizeof(s))
- -
- -static void setup_rx_buffers(struct nic *nic)
- -{
- - Address write_ptr;
- - unsigned short cur_rx_buf;
- - static unsigned short rx_cmd[16] = {
- - 0x0000, /* Rx status */
- - 0x0000, /* Rx command, only and last */
- - RX_BUF_START, /* Link (will be adjusted) */
- - RX_BUF_START + 22, /* Buffer offset (will be adjusted) */
- - 0x0000, 0x0000, 0x0000, /* Pad for dest addr */
- - 0x0000, 0x0000, 0x0000, /* Pad for source addr */
- - 0x0000, /* Pad for protocol */
- - 0x0000, /* Buffer: Actual count */
- - -1, /* Buffer: Next (none) */
- - RX_BUF_START + 0x20, /* Buffer: Address low (+ scb_base) (will be adjusted) */
- - 0x0000, /* Buffer: Address high */
- - 0x8000 | (RX_BUF_SIZE - 0x20)
- - };
- -
- - cur_rx_buf = rx_head = RX_BUF_START;
- - do { /* While there is room for one more buffer */
- - write_ptr = mem_start + cur_rx_buf;
- - /* adjust some contents */
- - rx_cmd[1] = 0x0000;
- - rx_cmd[2] = cur_rx_buf + RX_BUF_SIZE;
- - rx_cmd[3] = cur_rx_buf + 22;
- - rx_cmd[13] = cur_rx_buf + 0x20 + scb_base;
- - memcpy((char *)write_ptr, (char *)rx_cmd, sizeof(rx_cmd));
- - rx_tail = cur_rx_buf;
- - cur_rx_buf += RX_BUF_SIZE;
- - } while (cur_rx_buf <= RX_BUF_END - RX_BUF_SIZE);
- - /* Terminate the list by setting the EOL bit and wrap ther pointer
- - to make the list a ring. */
- - write_ptr = mem_start + rx_tail;
- - rx_cmd[1] = 0xC000;
- - rx_cmd[2] = rx_head;
- - memcpy((char *)write_ptr, (char *)rx_cmd, sizeof(unsigned short) * 3);
- -}
- -
- -static void ack_status(void)
- -{
- - unsigned short cmd, status;
- - unsigned short *shmem = (short *)mem_start;
- -
- - cmd = (status = shmem[iSCB_STATUS>>1]) & 0xf000;
- - if (status & 0x100) /* CU suspended? */
- - cmd |= CUC_RESUME;
- - if ((status & 0x200) == 0) /* CU not active? */
- - cmd |= CUC_START;
- - if (status & 0x010) /* RU suspended? */
- - cmd |= RX_RESUME;
- - else if ((status & 0x040) == 0) /* RU not active? */
- - cmd |= RX_START;
- - if (cmd == 0) /* Nothing to do */
- - return;
- - shmem[iSCB_CMD>>1] = cmd;
- -#if defined(DEBUG)
- - printf("Status %hX Command %hX\n", status, cmd);
- -#endif
- - outb(0, ioaddr + I82586_ATTN);
- -}
- -
- -/**************************************************************************
- -RESET - Reset adapter
- -***************************************************************************/
- -
- -static void i82586_reset(struct nic *nic)
- -{
- - unsigned long time;
- - unsigned short *shmem = (short *)mem_start;
- -
- - /* put the card in its initial state */
- -
- -#ifdef INCLUDE_3C507
- - /* Enable loopback to protect the wire while starting up,
- - and hold the 586 in reset during the memory initialisation. */
- - outb(0x20, ioaddr + MISC_CTRL);
- -#endif
- -
- - /* Fix the ISCP address and base. */
- - init_words[3] = scb_base;
- - init_words[7] = scb_base;
- -
- - /* Write the words at 0xfff6. */
- - /* Write the words at 0x0000. */
- - /* Fill in the station address. */
- - memcpy((char *)(mem_end - 10), (char *)init_words, 10);
- - memcpy((char *)mem_start, (char *)&init_words[5], sizeof(init_words) - 10);
- - memcpy((char *)mem_start + SA_OFFSET, nic->node_addr, ETH_ALEN);
- - setup_rx_buffers(nic);
- -
- -#ifdef INCLUDE_3C507
- - /* Start the 586 by releasing the reset line, but leave loopback. */
- - outb(0xA0, ioaddr + MISC_CTRL);
- -#endif
- -
- - /* This was time consuming to track down; you need to give two channel
- - attention signals to reliably start up the i82586. */
- - outb(0, ioaddr + I82586_ATTN);
- - time = currticks() + TICKS_PER_SEC; /* allow 1 second to init */
- - while (
- - shmem[iSCB_STATUS>>1] == 0)
- - {
- - if (currticks() > time)
- - {
- - printf("i82586 initialisation timed out with status %hX, cmd %hX\n",
- - shmem[iSCB_STATUS>>1], shmem[iSCB_CMD>>1]);
- - break;
- - }
- - }
- - /* Issue channel-attn -- the 82586 won't start. */
- - outb(0, ioaddr + I82586_ATTN);
- -
- -#ifdef INCLUDE_3C507
- - /* Disable loopback. */
- - outb(0x80, ioaddr + MISC_CTRL);
- -#endif
- -#if defined(DEBUG)
- - printf("i82586 status %hX, cmd %hX\n",
- - shmem[iSCB_STATUS>>1], shmem[iSCB_CMD>>1]);
- -#endif
- -}
- -
- -/**************************************************************************
- - POLL - Wait for a frame
- - ***************************************************************************/
- -static int i82586_poll(struct nic *nic)
- -{
- - int status;
- - unsigned short rfd_cmd, next_rx_frame, data_buffer_addr,
- - frame_status, pkt_len;
- - unsigned short *shmem = (short *)mem_start + rx_head;
- -
- - /* return true if there's an ethernet packet ready to read */
- - if (
- - ((frame_status = shmem[0]) & 0x8000) == 0)
- - return (0); /* nope */
- - rfd_cmd = shmem[1];
- - next_rx_frame = shmem[2];
- - data_buffer_addr = shmem[3];
- - pkt_len = shmem[11];
- - status = 0;
- - if (rfd_cmd != 0 || data_buffer_addr != rx_head + 22
- - || (pkt_len & 0xC000) != 0xC000)
- - printf("\nRx frame corrupt, discarded");
- - else if ((frame_status & 0x2000) == 0)
- - printf("\nRx frame had error");
- - else
- - {
- - /* We have a frame, copy it to our buffer */
- - pkt_len &= 0x3FFF;
- - memcpy(nic->packet, (char *)mem_start + rx_head + 0x20, pkt_len);
- - /* Only packets not from ourself */
- - if (memcmp(nic->packet + ETH_ALEN, nic->node_addr, ETH_ALEN) != 0)
- - {
- - nic->packetlen = pkt_len;
- - status = 1;
- - }
- - }
- - /* Clear the status word and set EOL on Rx frame */
- - shmem[0] = 0;
- - shmem[1] = 0xC000;
- - *(short *)(mem_start + rx_tail + 2) = 0;
- - rx_tail = rx_head;
- - rx_head = next_rx_frame;
- - ack_status();
- - return (status);
- -}
- -
- -/**************************************************************************
- - TRANSMIT - Transmit a frame
- - ***************************************************************************/
- -static void i82586_transmit(
- - struct nic *nic,
- - const char *d, /* Destination */
- - unsigned int t, /* Type */
- - unsigned int s, /* size */
- - const char *p) /* Packet */
- -{
- - Address bptr;
- - unsigned short type, z;
- - static unsigned short tx_cmd[11] = {
- - 0x0, /* Tx status */
- - CmdTx, /* Tx command */
- - TX_BUF_START+16, /* Next command is a NoOp */
- - TX_BUF_START+8, /* Data Buffer offset */
- - 0x8000, /* | with size */
- - 0xffff, /* No next data buffer */
- - TX_BUF_START+22, /* + scb_base */
- - 0x0, /* Buffer address high bits (always zero) */
- - 0x0, /* Nop status */
- - CmdNOp, /* Nop command */
- - TX_BUF_START+16 /* Next is myself */
- - };
- - unsigned short *shmem = (short *)mem_start + TX_BUF_START;
- -
- - /* send the packet to destination */
- - /* adjust some contents */
- - type = htons(t);
- - if (s < ETH_ZLEN)
- - s = ETH_ZLEN;
- - tx_cmd[4] = (s + ETH_HLEN) | 0x8000;
- - tx_cmd[6] = TX_BUF_START + 22 + scb_base;
- - bptr = mem_start + TX_BUF_START;
- - memcpy((char *)bptr, (char *)tx_cmd, sizeof(tx_cmd));
- - bptr += sizeof(tx_cmd);
- - memcpy((char *)bptr, d, ETH_ALEN);
- - bptr += ETH_ALEN;
- - memcpy((char *)bptr, nic->node_addr, ETH_ALEN);
- - bptr += ETH_ALEN;
- - memcpy((char *)bptr, (char *)&type, sizeof(type));
- - bptr += sizeof(type);
- - memcpy((char *)bptr, p, s);
- - /* Change the offset in the IDLELOOP */
- - *(unsigned short *)(mem_start + IDLELOOP + 4) = TX_BUF_START;
- - /* Wait for transmit completion */
- - while (
- - (shmem[0] & 0x2000) == 0)
- - ;
- - /* Change the offset in the IDLELOOP back and
- - change the final loop to point here */
- - *(unsigned short *)(mem_start + IDLELOOP + 4) = IDLELOOP;
- - *(unsigned short *)(mem_start + TX_BUF_START + 20) = IDLELOOP;
- - ack_status();
- -}
- -
- -/**************************************************************************
- - DISABLE - Turn off ethernet interface
- - ***************************************************************************/
- -static void i82586_disable(struct nic *nic)
- -{
- - unsigned short *shmem = (short *)mem_start;
- -
- -#if 0
- - /* Flush the Tx and disable Rx. */
- - shmem[iSCB_CMD>>1] = RX_SUSPEND | CUC_SUSPEND;
- - outb(0, ioaddr + I82586_ATTN);
- -#ifdef INCLUDE_NI5210
- - outb(0, ioaddr + NI52_RESET);
- -#endif
- -#endif /* 0 */
- -}
- -
- -#ifdef INCLUDE_3C507
- -
- -static int t507_probe1(struct nic *nic, unsigned short ioaddr)
- -{
- - int i;
- - Address size;
- - char mem_config;
- - char if_port;
- -
- - if (inb(ioaddr) != '*' || inb(ioaddr+1) != '3'
- - || inb(ioaddr+2) != 'C' || inb(ioaddr+3) != 'O')
- - return (0);
- - irq = inb(ioaddr + IRQ_CONFIG) & 0x0f;
- - mem_config = inb(ioaddr + MEM_CONFIG);
- - if (mem_config & 0x20)
- - {
- - size = 65536L;
- - mem_start = 0xf00000L + (mem_config & 0x08 ? 0x080000L
- - : (((Address)mem_config & 0x3) << 17));
- - }
- - else
- - {
- - size = ((((Address)mem_config & 0x3) + 1) << 14);
- - mem_start = 0x0c0000L + (((Address)mem_config & 0x18) << 12);
- - }
- - mem_end = mem_start + size;
- - scb_base = 65536L - size;
- - if_port = inb(ioaddr + ROM_CONFIG) & 0x80;
- - /* Get station address */
- - outb(0x01, ioaddr + MISC_CTRL);
- - for (i = 0; i < ETH_ALEN; ++i)
- - {
- - nic->node_addr[i] = inb(ioaddr+i);
- - }
- - printf("\n3c507 ioaddr %#hX, IRQ %d, mem [%#X-%#X], %sternal xcvr, addr %!\n",
- - ioaddr, irq, mem_start, mem_end, if_port ? "in" : "ex", nic->node_addr);
- - return (1);
- -}
- -
- -/**************************************************************************
- -PROBE - Look for an adapter, this routine's visible to the outside
- -***************************************************************************/
- -
- -struct nic *t507_probe(struct nic *nic, unsigned short *probe_addrs)
- -{
- - static unsigned char init_ID_done = 0;
- - unsigned short lrs_state = 0xff;
- - static unsigned short io_addrs[] = { 0x300, 0x320, 0x340, 0x280, 0 };
- - unsigned short *p;
- - int i;
- -
- - if (init_ID_done == 0)
- - {
- - /* Send the ID sequence to the ID_PORT to enable the board */
- - outb(0x00, ID_PORT);
- - for (i = 0; i < 255; ++i)
- - {
- - outb(lrs_state, ID_PORT);
- - lrs_state <<= 1;
- - if (lrs_state & 0x100)
- - lrs_state ^= 0xe7;
- - }
- - outb(0x00, ID_PORT);
- - init_ID_done = 1;
- - }
- - /* if probe_addrs is 0, then routine can use a hardwired default */
- - if (probe_addrs == 0)
- - probe_addrs = io_addrs;
- - for (p = probe_addrs; (ioaddr = *p) != 0; ++p)
- - if (t507_probe1(nic, ioaddr))
- - break;
- - if (ioaddr != 0)
- - {
- - /* point to NIC specific routines */
- - i82586_reset(nic);
- - nic->reset = i82586_reset;
- - nic->poll = i82586_poll;
- - nic->transmit = i82586_transmit;
- - nic->disable = i82586_disable;
- - return nic;
- - }
- - /* else */
- - {
- - return 0;
- - }
- -}
- -
- -#endif
- -
- -#ifdef INCLUDE_NI5210
- -
- -static int ni5210_probe2(void)
- -{
- - unsigned short i;
- - unsigned short shmem[10];
- -
- - /* Fix the ISCP address and base. */
- - init_words[3] = scb_base;
- - init_words[7] = scb_base;
- -
- - /* Write the words at 0xfff6. */
- - /* Write the words at 0x0000. */
- - memcpy((char *)(mem_end - 10), (char *)init_words, 10);
- - memcpy((char *)mem_start, (char *)&init_words[5], sizeof(init_words) - 10);
- - if (*(unsigned short *)mem_start != 1)
- - return (0);
- - outb(0, ioaddr + NI52_RESET);
- - outb(0, ioaddr + I82586_ATTN);
- - udelay(32);
- - i = 50;
- - while (
- - shmem[iSCB_STATUS>>1] == 0)
- - {
- - if (--i == 0)
- - {
- - printf("i82586 initialisation timed out with status %hX, cmd %hX\n",
- - shmem[iSCB_STATUS>>1], shmem[iSCB_CMD>>1]);
- - break;
- - }
- - }
- - /* Issue channel-attn -- the 82586 won't start. */
- - outb(0, ioaddr + I82586_ATTN);
- - if (*(unsigned short *)mem_start != 0)
- - return (0);
- - return (1);
- -}
- -
- -static int ni5210_probe1(struct nic *nic)
- -{
- - int i;
- - static Address mem_addrs[] = {
- - 0xc0000, 0xc4000, 0xc8000, 0xcc000,
- - 0xd0000, 0xd4000, 0xd8000, 0xdc000,
- - 0xe0000, 0xe4000, 0xe8000, 0xec000,
- - 0 };
- - Address *p;
- -
- - if (inb(ioaddr + 6) != 0x0 || inb(ioaddr + 7) != 0x55)
- - return (0);
- - scb_base = -8192; /* assume 8k memory */
- - for (p = mem_addrs; (mem_start = *p) != 0; ++p)
- - if (mem_end = mem_start + 8192, ni5210_probe2())
- - break;
- - if (mem_start == 0)
- - return (0);
- - /* Get station address */
- - for (i = 0; i < ETH_ALEN; ++i)
- - {
- - nic->node_addr[i] = inb(ioaddr+i);
- - }
- - printf("\nNI5210 ioaddr %#hX, mem [%#X-%#X], addr %!\n",
- - ioaddr, mem_start, mem_end, nic->node_addr);
- - return (1);
- -}
- -
- -struct nic *ni5210_probe(struct nic *nic, unsigned short *probe_addrs)
- -{
- - /* missing entries are addresses usually already used */
- - static unsigned short io_addrs[] = {
- - 0x200, 0x208, 0x210, 0x218, 0x220, 0x228, 0x230, 0x238,
- - 0x240, 0x248, 0x250, 0x258, 0x260, 0x268, 0x270, /*Par*/
- - 0x280, 0x288, 0x290, 0x298, 0x2A0, 0x2A8, 0x2B0, 0x2B8,
- - 0x2C0, 0x2C8, 0x2D0, 0x2D8, 0x2E0, 0x2E8, 0x2F0, /*Ser*/
- - 0x300, 0x308, 0x310, 0x318, 0x320, 0x328, 0x330, 0x338,
- - 0x340, 0x348, 0x350, 0x358, 0x360, 0x368, 0x370, /*Par*/
- - 0x380, 0x388, 0x390, 0x398, 0x3A0, 0x3A8, /*Vid,Par*/
- - 0x3C0, 0x3C8, 0x3D0, 0x3D8, 0x3E0, 0x3E8, /*Ser*/
- - 0x0
- - };
- - unsigned short *p;
- - int i;
- -
- - /* if probe_addrs is 0, then routine can use a hardwired default */
- - if (probe_addrs == 0)
- - probe_addrs = io_addrs;
- - for (p = probe_addrs; (ioaddr = *p) != 0; ++p)
- - if (ni5210_probe1(nic))
- - break;
- - if (ioaddr != 0)
- - {
- - /* point to NIC specific routines */
- - i82586_reset(nic);
- - nic->reset = i82586_reset;
- - nic->poll = i82586_poll;
- - nic->transmit = i82586_transmit;
- - nic->disable = i82586_disable;
- - return nic;
- - }
- - /* else */
- - {
- - return 0;
- - }
- -}
- -#endif
- -
- -#ifdef INCLUDE_EXOS205
- -
- -/*
- - * Code to download to I186 in EXOS205
- - */
- -
- -static unsigned char exos_i186_init[] =
- -{
- -0x08,0x00,0x14,0x00,0x00,0x00,0xaa,0xfa,0x33,0xc0,0xba,0xfe,0xff,0xef,0xb8,0xf8,
- -0xff,0xe7,0xa0,0xb8,0x7c,0x00,0xe7,0xa4,0xb8,0xbc,0x80,0xe7,0xa8,0x8c,0xc8,0x8e,
- -0xd8,0xbb,0x2f,0x0e,0xc6,0x07,0xa5,0x33,0xc9,0xeb,0x00,0xeb,0x00,0xeb,0x00,0xe2,
- -0xf8,0xbe,0x2c,0x0e,0xba,0x02,0x05,0x33,0xdb,0xb9,0x03,0x00,0xec,0x24,0x0f,0x8a,
- -0xe0,0x02,0xd8,0x42,0x42,0xec,0x02,0xd8,0xd0,0xe0,0xd0,0xe0,0xd0,0xe0,0xd0,0xe0,
- -0x0a,0xc4,0x88,0x04,0x42,0x42,0x46,0xe2,0xe3,0x8a,0xe3,0xd0,0xec,0xd0,0xec,0xd0,
- -0xec,0xd0,0xec,0x80,0xe3,0x0f,0x02,0xe3,0x80,0xf4,0x05,0xec,0x3a,0xe0,0x74,0x05,
- -0xc6,0x04,0x5a,0xeb,0xfe,0xc6,0x04,0x55,0x33,0xc0,0x8e,0xd8,0xbe,0x38,0x00,0xc7,
- -0x04,0xce,0x0e,0x46,0x46,0xc7,0x04,0x00,0xff,0xfb,0xba,0x3c,0x00,0xb8,0x03,0x00,
- -0xef,0x33,0xdb,0x33,0xc9,0xbd,0x04,0x0f,0x90,0x90,0x90,0x90,0xe2,0xfa,0x43,0x2e,
- -0x89,0x5e,0x00,0xeb,0xf3,0x52,0xba,0x00,0x06,0xef,0x50,0x53,0x55,0xbd,0xf8,0x0e,
- -0x2e,0x8b,0x5e,0x00,0x43,0x2e,0x89,0x5e,0x00,0xba,0x22,0x00,0xb8,0x00,0x80,0xef,
- -0x5d,0x5b,0x58,0x5a,0xcf,0x49,0x4e,0x54,0x52,0x20,0x63,0x6e,0x74,0x2d,0x3e,0x00,
- -0x00,0x4c,0x4f,0x4f,0x50,0x20,0x63,0x6e,0x74,0x2d,0x3e,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xea,0x30,0x0e,0x00,0xff,0x00,0x00,0x00,0x00,
- -0x00,0x00,0x00,0x00,0x00,0x00,00
- -};
- -
- -/* These offsets are from the end of the i186 download code */
- -
- -#define OFFSET_SEMA 0x1D1
- -#define OFFSET_ADDR 0x1D7
- -
- -static int exos205_probe2(void)
- -{
- - unsigned short i;
- - unsigned short shmem[10];
- -
- - /* Fix the ISCP address and base. */
- - init_words[3] = scb_base;
- - init_words[7] = scb_base;
- -
- - /* Write the words at 0xfff6. */
- - /* Write the words at 0x0000. */
- - memcpy((char *)(mem_end - 10), (char *)init_words, 10);
- - memcpy((char *)mem_start, (char *)&init_words[5], sizeof(init_words) - 10);
- - if (*(unsigned short *)mem_start != 1)
- - return (0);
- - outb(0, ioaddr + EXOS205_RESET);
- - outb(0, ioaddr + I82586_ATTN);
- - i = 50;
- - while (
- - shmem[iSCB_STATUS>>1] == 0)
- - {
- - if (--i == 0)
- - {
- - printf("i82586 initialisation timed out with status %hX, cmd %hX\n",
- - shmem[iSCB_STATUS>>1], shmem[iSCB_CMD>>1]);
- - break;
- - }
- - }
- - /* Issue channel-attn -- the 82586 won't start. */
- - outb(0, ioaddr + I82586_ATTN);
- - if (*(unsigned short *)mem_start != 0)
- - return (0);
- - return (1);
- -}
- -
- -static int exos205_probe1(struct nic *nic)
- -{
- - int i;
- - /* If you know the other addresses please let me know */
- - static Address mem_addrs[] = {
- - 0xcc000, 0 };
- - Address *p;
- -
- - scb_base = -16384; /* assume 8k memory */
- - for (p = mem_addrs; (mem_start = *p) != 0; ++p)
- - if (mem_end = mem_start + 16384, exos205_probe2())
- - break;
- - if (mem_start == 0)
- - return (0);
- - /* Get station address */
- - for (i = 0; i < ETH_ALEN; ++i)
- - {
- - nic->node_addr[i] = inb(ioaddr+i);
- - }
- - printf("\nEXOS205 ioaddr %#hX, mem [%#X-%#X], addr %!\n",
- - ioaddr, mem_start, mem_end, nic->node_addr);
- - return (1);
- -}
- -
- -struct nic *exos205_probe(struct nic *nic, unsigned short *probe_addrs)
- -{
- - /* If you know the other addresses, please let me know */
- - static unsigned short io_addrs[] = {
- - 0x310, 0x0
- - };
- - unsigned short *p;
- - int i;
- -
- - /* if probe_addrs is 0, then routine can use a hardwired default */
- - if (probe_addrs == 0)
- - probe_addrs = io_addrs;
- - for (p = probe_addrs; (ioaddr = *p) != 0; ++p)
- - if (exos205_probe1(nic))
- - break;
- - if (ioaddr != 0)
- - {
- - /* point to NIC specific routines */
- - i82586_reset(nic);
- - nic->reset = i82586_reset;
- - nic->poll = i82586_poll;
- - nic->transmit = i82586_transmit;
- - nic->disable = i82586_disable;
- - return nic;
- - }
- - /* else */
- - {
- - return 0;
- - }
- -}
- -
- -#endif
- diff -Naur grub-0.97.orig/netboot/if_arp.h grub-0.97/netboot/if_arp.h
- --- grub-0.97.orig/netboot/if_arp.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/if_arp.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,29 @@
- +#ifndef _IF_ARP_H
- +#define _IF_ARP_H
- +
- +#include "types.h"
- +
- +#define ARP_REQUEST 1
- +#define ARP_REPLY 2
- +
- +#ifndef MAX_ARP_RETRIES
- +#define MAX_ARP_RETRIES 20
- +#endif
- +
- +/*
- + * A pity sipaddr and tipaddr are not longword aligned or we could use
- + * in_addr. No, I don't want to use #pragma packed.
- + */
- +struct arprequest {
- + uint16_t hwtype;
- + uint16_t protocol;
- + uint8_t hwlen;
- + uint8_t protolen;
- + uint16_t opcode;
- + uint8_t shwaddr[6];
- + uint8_t sipaddr[4];
- + uint8_t thwaddr[6];
- + uint8_t tipaddr[4];
- +};
- +
- +#endif /* _IF_ARP_H */
- diff -Naur grub-0.97.orig/netboot/if_ether.h grub-0.97/netboot/if_ether.h
- --- grub-0.97.orig/netboot/if_ether.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/if_ether.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,21 @@
- +#ifndef _IF_ETHER_H
- +#define _IF_ETHER_H
- +
- +/*
- + I'm moving towards the defined names in linux/if_ether.h for clarity.
- + The confusion between 60/64 and 1514/1518 arose because the NS8390
- + counts the 4 byte frame checksum in the incoming packet, but not
- + in the outgoing packet. 60/1514 are the correct numbers for most
- + if not all of the other NIC controllers.
- +*/
- +
- +#define ETH_ALEN 6 /* Size of Ethernet address */
- +#define ETH_HLEN 14 /* Size of ethernet header */
- +#define ETH_ZLEN 60 /* Minimum packet */
- +#define ETH_FRAME_LEN 1514 /* Maximum packet */
- +#define ETH_DATA_ALIGN 2 /* Amount needed to align the data after an ethernet header */
- +#ifndef ETH_MAX_MTU
- +#define ETH_MAX_MTU (ETH_FRAME_LEN-ETH_HLEN)
- +#endif
- +
- +#endif /* _IF_ETHER_H */
- diff -Naur grub-0.97.orig/netboot/igmp.h grub-0.97/netboot/igmp.h
- --- grub-0.97.orig/netboot/igmp.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/igmp.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,27 @@
- +#ifndef _IGMP_H
- +#define _IGMP_H
- +
- +/* Max interval between IGMP packets */
- +#define IGMP_INTERVAL (10*TICKS_PER_SEC)
- +#define IGMPv1_ROUTER_PRESENT_TIMEOUT (400*TICKS_PER_SEC)
- +
- +#define IGMP_QUERY 0x11
- +#define IGMPv1_REPORT 0x12
- +#define IGMPv2_REPORT 0x16
- +#define IGMP_LEAVE 0x17
- +#define GROUP_ALL_HOSTS 0xe0000001 /* 224.0.0.1 Host byte order */
- +
- +struct igmp {
- + uint8_t type;
- + uint8_t response_time;
- + uint16_t chksum;
- + in_addr group;
- +};
- +
- +struct igmp_ip_t { /* Format of an igmp ip packet */
- + struct iphdr ip;
- + uint8_t router_alert[4]; /* Router alert option */
- + struct igmp igmp;
- +};
- +
- +#endif /* _IGMP_H */
- diff -Naur grub-0.97.orig/netboot/in.h grub-0.97/netboot/in.h
- --- grub-0.97.orig/netboot/in.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/in.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,21 @@
- +#ifndef _IN_H
- +#define _IN_H
- +
- +#include "types.h"
- +
- +#define IP 0x0800
- +#define ARP 0x0806
- +#define RARP 0x8035
- +
- +#define IP_ICMP 1
- +#define IP_IGMP 2
- +#define IP_UDP 17
- +
- +/* Same after going through htonl */
- +#define IP_BROADCAST 0xFFFFFFFF
- +
- +typedef struct {
- + uint32_t s_addr;
- +} in_addr;
- +
- +#endif /* _IN_H */
- diff -Naur grub-0.97.orig/netboot/io.h grub-0.97/netboot/io.h
- --- grub-0.97.orig/netboot/io.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/io.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,239 @@
- +#ifndef IO_H
- +#define IO_H
- +
- +
- +/* Amount of relocation etherboot is experiencing */
- +extern unsigned long virt_offset;
- +
- +/* Don't require identity mapped physical memory,
- + * osloader.c is the only valid user at the moment.
- + */
- +unsigned long virt_to_phys(volatile const void *virt_addr);
- +void *phys_to_virt(unsigned long phys_addr);
- +
- +/* virt_to_bus converts an addresss inside of etherboot [_start, _end]
- + * into a memory access cards can use.
- + */
- +#define virt_to_bus virt_to_phys
- +
- +
- +/* bus_to_virt reverses virt_to_bus, the address must be output
- + * from virt_to_bus to be valid. This function does not work on
- + * all bus addresses.
- + */
- +#define bus_to_virt phys_to_virt
- +
- +/* ioremap converts a random 32bit bus address into something
- + * etherboot can access.
- + */
- +static inline void *ioremap(unsigned long bus_addr, unsigned long length __unused)
- +{
- + return bus_to_virt(bus_addr);
- +}
- +
- +/* iounmap cleans up anything ioremap had to setup */
- +static inline void iounmap(void *virt_addr __unused)
- +{
- + return;
- +}
- +
- +/*
- + * This file contains the definitions for the x86 IO instructions
- + * inb/inw/inl/outb/outw/outl and the "string versions" of the same
- + * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
- + * versions of the single-IO instructions (inb_p/inw_p/..).
- + *
- + * This file is not meant to be obfuscating: it's just complicated
- + * to (a) handle it all in a way that makes gcc able to optimize it
- + * as well as possible and (b) trying to avoid writing the same thing
- + * over and over again with slight variations and possibly making a
- + * mistake somewhere.
- + */
- +
- +/*
- + * Thanks to James van Artsdalen for a better timing-fix than
- + * the two short jumps: using outb's to a nonexistent port seems
- + * to guarantee better timings even on fast machines.
- + *
- + * On the other hand, I'd like to be sure of a non-existent port:
- + * I feel a bit unsafe about using 0x80 (should be safe, though)
- + *
- + * Linus
- + */
- +
- +#ifdef SLOW_IO_BY_JUMPING
- +#define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:")
- +#else
- +#define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80")
- +#endif
- +
- +#ifdef REALLY_SLOW_IO
- +#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
- +#else
- +#define SLOW_DOWN_IO __SLOW_DOWN_IO
- +#endif
- +
- +/*
- + * readX/writeX() are used to access memory mapped devices. On some
- + * architectures the memory mapped IO stuff needs to be accessed
- + * differently. On the x86 architecture, we just read/write the
- + * memory location directly.
- + */
- +#define readb(addr) (*(volatile unsigned char *) (addr))
- +#define readw(addr) (*(volatile unsigned short *) (addr))
- +#define readl(addr) (*(volatile unsigned int *) (addr))
- +
- +#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b))
- +#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b))
- +#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))
- +
- +#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
- +#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
- +
- +/*
- + * Force strict CPU ordering.
- + * And yes, this is required on UP too when we're talking
- + * to devices.
- + *
- + * For now, "wmb()" doesn't actually do anything, as all
- + * Intel CPU's follow what Intel calls a *Processor Order*,
- + * in which all writes are seen in the program order even
- + * outside the CPU.
- + *
- + * I expect future Intel CPU's to have a weaker ordering,
- + * but I'd also expect them to finally get their act together
- + * and add some real memory barriers if so.
- + *
- + * Some non intel clones support out of order store. wmb() ceases to be a
- + * nop for these.
- + */
- +
- +#define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
- +#define rmb() mb()
- +#define wmb() mb();
- +
- +
- +/*
- + * Talk about misusing macros..
- + */
- +
- +#define __OUT1(s,x) \
- +extern void __out##s(unsigned x value, unsigned short port); \
- +extern inline void __out##s(unsigned x value, unsigned short port) {
- +
- +#define __OUT2(s,s1,s2) \
- +__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
- +
- +#define __OUT(s,s1,x) \
- +__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \
- +__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); } \
- +__OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \
- +__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; }
- +
- +#define __IN1(s,x) \
- +extern unsigned x __in##s(unsigned short port); \
- +extern inline unsigned x __in##s(unsigned short port) { unsigned x _v;
- +
- +#define __IN2(s,s1,s2) \
- +__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
- +
- +#define __IN(s,s1,x,i...) \
- +__IN1(s,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \
- +__IN1(s##c,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \
- +__IN1(s##_p,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \
- +__IN1(s##c_p,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; }
- +
- +#define __INS(s) \
- +extern void ins##s(unsigned short port, void * addr, unsigned long count); \
- +extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \
- +{ __asm__ __volatile__ ("cld ; rep ; ins" #s \
- +: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
- +
- +#define __OUTS(s) \
- +extern void outs##s(unsigned short port, const void * addr, unsigned long count); \
- +extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \
- +{ __asm__ __volatile__ ("cld ; rep ; outs" #s \
- +: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
- +
- +__IN(b,"", char)
- +__IN(w,"",short)
- +__IN(l,"", long)
- +
- +__OUT(b,"b",char)
- +__OUT(w,"w",short)
- +__OUT(l,,int)
- +
- +__INS(b)
- +__INS(w)
- +__INS(l)
- +
- +__OUTS(b)
- +__OUTS(w)
- +__OUTS(l)
- +
- +/*
- + * Note that due to the way __builtin_constant_p() works, you
- + * - can't use it inside a inline function (it will never be true)
- + * - you don't have to worry about side effects within the __builtin..
- + */
- +#define outb(val,port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __outbc((val),(port)) : \
- + __outb((val),(port)))
- +
- +#define inb(port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __inbc(port) : \
- + __inb(port))
- +
- +#define outb_p(val,port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __outbc_p((val),(port)) : \
- + __outb_p((val),(port)))
- +
- +#define inb_p(port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __inbc_p(port) : \
- + __inb_p(port))
- +
- +#define outw(val,port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __outwc((val),(port)) : \
- + __outw((val),(port)))
- +
- +#define inw(port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __inwc(port) : \
- + __inw(port))
- +
- +#define outw_p(val,port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __outwc_p((val),(port)) : \
- + __outw_p((val),(port)))
- +
- +#define inw_p(port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __inwc_p(port) : \
- + __inw_p(port))
- +
- +#define outl(val,port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __outlc((val),(port)) : \
- + __outl((val),(port)))
- +
- +#define inl(port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __inlc(port) : \
- + __inl(port))
- +
- +#define outl_p(val,port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __outlc_p((val),(port)) : \
- + __outl_p((val),(port)))
- +
- +#define inl_p(port) \
- +((__builtin_constant_p((port)) && (port) < 256) ? \
- + __inlc_p(port) : \
- + __inl_p(port))
- +
- +#endif /* ETHERBOOT_IO_H */
- diff -Naur grub-0.97.orig/netboot/ip.h grub-0.97/netboot/ip.h
- --- grub-0.97.orig/netboot/ip.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/ip.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,36 @@
- +#ifndef _IP_H
- +#define _IP_H
- +
- +/* We need 'uint16_t' */
- +#include "types.h"
- +/* We need 'in_addr' */
- +#include "in.h"
- +
- +struct iphdr {
- + uint8_t verhdrlen;
- + uint8_t service;
- + uint16_t len;
- + uint16_t ident;
- + uint16_t frags;
- + uint8_t ttl;
- + uint8_t protocol;
- + uint16_t chksum;
- + in_addr src;
- + in_addr dest;
- +};
- +
- +extern void build_ip_hdr(unsigned long __destip, int __ttl, int __protocol,
- + int __option_len, int __len, const void * __buf);
- +
- +extern int ip_transmit(int __len, const void * __buf);
- +
- +extern uint16_t ipchksum(const void * __data, unsigned long __length);
- +
- +extern uint16_t add_ipchksums(unsigned long __offset, uint16_t __sum,
- + uint16_t __new);
- +
- +
- +
- +
- +
- +#endif /* _IP_H */
- diff -Naur grub-0.97.orig/netboot/isa.h grub-0.97/netboot/isa.h
- --- grub-0.97.orig/netboot/isa.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/isa.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,27 @@
- +#if !defined(ISA_H) && defined(CONFIG_ISA)
- +#define ISA_H
- +
- +struct dev;
- +
- +#define ISAPNP_VENDOR(a,b,c) (((((a)-'A'+1)&0x3f)<<2)|\
- + ((((b)-'A'+1)&0x18)>>3)|((((b)-'A'+1)&7)<<13)|\
- + ((((c)-'A'+1)&0x1f)<<8))
- +
- +#define GENERIC_ISAPNP_VENDOR ISAPNP_VENDOR('P','N','P')
- +
- +struct isa_driver
- +{
- + int type;
- + const char *name;
- + int (*probe)(struct dev *, unsigned short *);
- + unsigned short *ioaddrs;
- +};
- +
- +#define __isa_driver __attribute__ ((unused,__section__(".drivers.isa")))
- +extern const struct isa_driver isa_drivers[];
- +extern const struct isa_driver isa_drivers_end[];
- +
- +#define ISA_ROM(IMAGE, DESCRIPTION)
- +
- +#endif /* ISA_H */
- +
- diff -Naur grub-0.97.orig/netboot/lance.c grub-0.97/netboot/lance.c
- --- grub-0.97.orig/netboot/lance.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/lance.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,564 +0,0 @@
- -/**************************************************************************
- -Etherboot - BOOTP/TFTP Bootstrap Program
- -LANCE NIC driver for Etherboot
- -Large portions borrowed from the Linux LANCE driver by Donald Becker
- -Ken Yap, July 1997
- -***************************************************************************/
- -
- -/*
- - * This program is free software; you can redistribute it and/or
- - * modify it under the terms of the GNU General Public License as
- - * published by the Free Software Foundation; either version 2, or (at
- - * your option) any later version.
- - */
- -
- -/* to get some global routines like printf */
- -#include "etherboot.h"
- -/* to get the interface to the body of the program */
- -#include "nic.h"
- -#ifdef INCLUDE_LANCE
- -#include "pci.h"
- -#endif
- -#include "cards.h"
- -
- -/* Offsets from base I/O address */
- -#if defined(INCLUDE_NE2100) || defined(INCLUDE_LANCE)
- -#define LANCE_ETH_ADDR 0x0
- -#define LANCE_DATA 0x10
- -#define LANCE_ADDR 0x12
- -#define LANCE_RESET 0x14
- -#define LANCE_BUS_IF 0x16
- -#define LANCE_TOTAL_SIZE 0x18
- -#endif
- -#ifdef INCLUDE_NI6510
- -#define LANCE_ETH_ADDR 0x8
- -#define LANCE_DATA 0x0
- -#define LANCE_ADDR 0x2
- -#define LANCE_RESET 0x4
- -#define LANCE_BUS_IF 0x6
- -#define LANCE_TOTAL_SIZE 0x10
- -#endif
- -
- -/* lance_poll() now can use multiple Rx buffers to prevent packet loss. Set
- - * Set LANCE_LOG_RX_BUFFERS to 0..7 for 1, 2, 4, 8, 16, 32, 64 or 128 Rx
- - * buffers. Usually 4 (=16 Rx buffers) is a good value. (Andreas Neuhaus)
- - * Decreased to 2 (=4 Rx buffers) (Ken Yap, 20010305) */
- -
- -#define LANCE_LOG_RX_BUFFERS 2 /* Use 2^2=4 Rx buffers */
- -
- -#define RX_RING_SIZE (1 << (LANCE_LOG_RX_BUFFERS))
- -#define RX_RING_MOD_MASK (RX_RING_SIZE - 1)
- -#define RX_RING_LEN_BITS ((LANCE_LOG_RX_BUFFERS) << 29)
- -
- -struct lance_init_block
- -{
- - unsigned short mode;
- - unsigned char phys_addr[ETH_ALEN];
- - unsigned long filter[2];
- - Address rx_ring;
- - Address tx_ring;
- -};
- -
- -struct lance_rx_head
- -{
- - union {
- - Address base;
- - unsigned char addr[4];
- - } u;
- - short buf_length; /* 2s complement */
- - short msg_length;
- -};
- -
- -struct lance_tx_head
- -{
- - union {
- - Address base;
- - unsigned char addr[4];
- - } u;
- - short buf_length; /* 2s complement */
- - short misc;
- -};
- -
- -struct lance_interface
- -{
- - struct lance_init_block init_block;
- - struct lance_rx_head rx_ring[RX_RING_SIZE];
- - struct lance_tx_head tx_ring;
- - unsigned char rbuf[RX_RING_SIZE][ETH_FRAME_LEN+4];
- - unsigned char tbuf[ETH_FRAME_LEN];
- - /*
- - * Do not alter the order of the struct members above;
- - * the hardware depends on the correct alignment.
- - */
- - int rx_idx;
- -};
- -
- -#define LANCE_MUST_PAD 0x00000001
- -#define LANCE_ENABLE_AUTOSELECT 0x00000002
- -#define LANCE_SELECT_PHONELINE 0x00000004
- -#define LANCE_MUST_UNRESET 0x00000008
- -
- -/* A mapping from the chip ID number to the part number and features.
- - These are from the datasheets -- in real life the '970 version
- - reportedly has the same ID as the '965. */
- -static const struct lance_chip_type
- -{
- - int id_number;
- - const char *name;
- - int flags;
- -} chip_table[] = {
- - {0x0000, "LANCE 7990", /* Ancient lance chip. */
- - LANCE_MUST_PAD + LANCE_MUST_UNRESET},
- - {0x0003, "PCnet/ISA 79C960", /* 79C960 PCnet/ISA. */
- - LANCE_ENABLE_AUTOSELECT},
- - {0x2260, "PCnet/ISA+ 79C961", /* 79C961 PCnet/ISA+, Plug-n-Play. */
- - LANCE_ENABLE_AUTOSELECT},
- - {0x2420, "PCnet/PCI 79C970", /* 79C970 or 79C974 PCnet-SCSI, PCI. */
- - LANCE_ENABLE_AUTOSELECT},
- - /* Bug: the PCnet/PCI actually uses the PCnet/VLB ID number, so just call
- - it the PCnet32. */
- - {0x2430, "PCnet32", /* 79C965 PCnet for VL bus. */
- - LANCE_ENABLE_AUTOSELECT},
- - {0x2621, "PCnet/PCI-II 79C970A", /* 79C970A PCInetPCI II. */
- - LANCE_ENABLE_AUTOSELECT},
- - {0x2625, "PCnet-FAST III 79C973", /* 79C973 PCInet-FAST III. */
- - LANCE_ENABLE_AUTOSELECT},
- - {0x2626, "PCnet/HomePNA 79C978",
- - LANCE_ENABLE_AUTOSELECT|LANCE_SELECT_PHONELINE},
- - {0x0, "PCnet (unknown)",
- - LANCE_ENABLE_AUTOSELECT},
- -};
- -
- -/* Define a macro for converting program addresses to real addresses */
- -#undef virt_to_bus
- -#define virt_to_bus(x) ((unsigned long)x)
- -
- -static int chip_version;
- -static int lance_version;
- -static unsigned short ioaddr;
- -#ifndef INCLUDE_LANCE
- -static int dma;
- -#endif
- -static struct lance_interface *lp;
- -
- -/* additional 8 bytes for 8-byte alignment space */
- -#ifdef USE_LOWMEM_BUFFER
- -#define lance ((char *)0x10000 - (sizeof(struct lance_interface)+8))
- -#else
- -static char lance[sizeof(struct lance_interface)+8];
- -#endif
- -
- -#ifndef INCLUDE_LANCE
- -/* DMA defines and helper routines */
- -
- -/* DMA controller registers */
- -#define DMA1_CMD_REG 0x08 /* command register (w) */
- -#define DMA1_STAT_REG 0x08 /* status register (r) */
- -#define DMA1_REQ_REG 0x09 /* request register (w) */
- -#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */
- -#define DMA1_MODE_REG 0x0B /* mode register (w) */
- -#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */
- -#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */
- -#define DMA1_RESET_REG 0x0D /* Master Clear (w) */
- -#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */
- -#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */
- -
- -#define DMA2_CMD_REG 0xD0 /* command register (w) */
- -#define DMA2_STAT_REG 0xD0 /* status register (r) */
- -#define DMA2_REQ_REG 0xD2 /* request register (w) */
- -#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */
- -#define DMA2_MODE_REG 0xD6 /* mode register (w) */
- -#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */
- -#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */
- -#define DMA2_RESET_REG 0xDA /* Master Clear (w) */
- -#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */
- -#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
- -
- -
- -#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
- -#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
- -#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
- -
- -/* enable/disable a specific DMA channel */
- -static void enable_dma(unsigned int dmanr)
- -{
- - if (dmanr <= 3)
- - outb_p(dmanr, DMA1_MASK_REG);
- - else
- - outb_p(dmanr & 3, DMA2_MASK_REG);
- -}
- -
- -static void disable_dma(unsigned int dmanr)
- -{
- - if (dmanr <= 3)
- - outb_p(dmanr | 4, DMA1_MASK_REG);
- - else
- - outb_p((dmanr & 3) | 4, DMA2_MASK_REG);
- -}
- -
- -/* set mode (above) for a specific DMA channel */
- -static void set_dma_mode(unsigned int dmanr, char mode)
- -{
- - if (dmanr <= 3)
- - outb_p(mode | dmanr, DMA1_MODE_REG);
- - else
- - outb_p(mode | (dmanr&3), DMA2_MODE_REG);
- -}
- -#endif /* !INCLUDE_LANCE */
- -
- -/**************************************************************************
- -RESET - Reset adapter
- -***************************************************************************/
- -static void lance_reset(struct nic *nic)
- -{
- - int i;
- - Address l;
- -
- - /* Reset the LANCE */
- - (void)inw(ioaddr+LANCE_RESET);
- - /* Un-Reset the LANCE, needed only for the NE2100 */
- - if (chip_table[lance_version].flags & LANCE_MUST_UNRESET)
- - outw(0, ioaddr+LANCE_RESET);
- - if (chip_table[lance_version].flags & LANCE_ENABLE_AUTOSELECT)
- - {
- - /* This is 79C960 specific; Turn on auto-select of media
- - (AUI, BNC). */
- - outw(0x2, ioaddr+LANCE_ADDR);
- - /* Don't touch 10base2 power bit. */
- - outw(inw(ioaddr+LANCE_BUS_IF) | 0x2, ioaddr+LANCE_BUS_IF);
- - }
- - /* HomePNA cards need to explicitly pick the phoneline interface.
- - * Some of these cards have ethernet interfaces as well, this
- - * code might require some modification for those.
- - */
- - if (chip_table[lance_version].flags & LANCE_SELECT_PHONELINE) {
- - short media, check ;
- - /* this is specific to HomePNA cards... */
- - outw(49, ioaddr+0x12) ;
- - media = inw(ioaddr+0x16) ;
- -#ifdef DEBUG
- - printf("media was %d\n", media) ;
- -#endif
- - media &= ~3 ;
- - media |= 1 ;
- -#ifdef DEBUG
- - printf("media changed to %d\n", media) ;
- -#endif
- - media &= ~3 ;
- - media |= 1 ;
- - outw(49, ioaddr+0x12) ;
- - outw(media, ioaddr+0x16) ;
- - outw(49, ioaddr+0x12) ;
- - check = inw(ioaddr+0x16) ;
- -#ifdef DEBUG
- - printf("check %s, media was set properly\n",
- - check == media ? "passed" : "FAILED" ) ;
- -#endif
- - }
- -
- - /* Re-initialise the LANCE, and start it when done. */
- - /* Set station address */
- - for (i = 0; i < ETH_ALEN; ++i)
- - lp->init_block.phys_addr[i] = nic->node_addr[i];
- - /* Preset the receive ring headers */
- - for (i=0; i<RX_RING_SIZE; i++) {
- - lp->rx_ring[i].buf_length = -ETH_FRAME_LEN-4;
- - /* OWN */
- - lp->rx_ring[i].u.base = virt_to_bus(lp->rbuf[i]) & 0xffffff;
- - /* we set the top byte as the very last thing */
- - lp->rx_ring[i].u.addr[3] = 0x80;
- - }
- - lp->rx_idx = 0;
- - lp->init_block.mode = 0x0; /* enable Rx and Tx */
- - l = (Address)virt_to_bus(&lp->init_block);
- - outw(0x1, ioaddr+LANCE_ADDR);
- - (void)inw(ioaddr+LANCE_ADDR);
- - outw((short)l, ioaddr+LANCE_DATA);
- - outw(0x2, ioaddr+LANCE_ADDR);
- - (void)inw(ioaddr+LANCE_ADDR);
- - outw((short)(l >> 16), ioaddr+LANCE_DATA);
- - outw(0x4, ioaddr+LANCE_ADDR);
- - (void)inw(ioaddr+LANCE_ADDR);
- - outw(0x915, ioaddr+LANCE_DATA);
- - outw(0x0, ioaddr+LANCE_ADDR);
- - (void)inw(ioaddr+LANCE_ADDR);
- - outw(0x4, ioaddr+LANCE_DATA); /* stop */
- - outw(0x1, ioaddr+LANCE_DATA); /* init */
- - for (i = 10000; i > 0; --i)
- - if (inw(ioaddr+LANCE_DATA) & 0x100)
- - break;
- -#ifdef DEBUG
- - if (i <= 0)
- - printf("Init timed out\n");
- -#endif
- - /* Apparently clearing the InitDone bit here triggers a bug
- - in the '974. (Mark Stockton) */
- - outw(0x2, ioaddr+LANCE_DATA); /* start */
- -}
- -
- -/**************************************************************************
- -POLL - Wait for a frame
- -***************************************************************************/
- -static int lance_poll(struct nic *nic)
- -{
- - int status;
- -
- - status = lp->rx_ring[lp->rx_idx].u.base >> 24;
- - if (status & 0x80)
- - return (0);
- -#ifdef DEBUG
- - printf("LANCE packet received rx_ring.u.base %X mcnt %hX csr0 %hX\n",
- - lp->rx_ring[lp->rx_idx].u.base, lp->rx_ring[lp->rx_idx].msg_length,
- - inw(ioaddr+LANCE_DATA));
- -#endif
- - if (status == 0x3)
- - memcpy(nic->packet, lp->rbuf[lp->rx_idx], nic->packetlen = lp->rx_ring[lp->rx_idx].msg_length);
- - /* Andrew Boyd of QNX reports that some revs of the 79C765
- - clear the buffer length */
- - lp->rx_ring[lp->rx_idx].buf_length = -ETH_FRAME_LEN-4;
- - lp->rx_ring[lp->rx_idx].u.addr[3] |= 0x80; /* prime for next receive */
- -
- - /* I'm not sure if the following is still ok with multiple Rx buffers, but it works */
- - outw(0x0, ioaddr+LANCE_ADDR);
- - (void)inw(ioaddr+LANCE_ADDR);
- - outw(0x500, ioaddr+LANCE_DATA); /* clear receive + InitDone */
- -
- - /* Switch to the next Rx ring buffer */
- - lp->rx_idx = (lp->rx_idx + 1) & RX_RING_MOD_MASK;
- -
- - return (status == 0x3);
- -}
- -
- -/**************************************************************************
- -TRANSMIT - Transmit a frame
- -***************************************************************************/
- -static void lance_transmit(
- - struct nic *nic,
- - const char *d, /* Destination */
- - unsigned int t, /* Type */
- - unsigned int s, /* size */
- - const char *p) /* Packet */
- -{
- - unsigned long time;
- -
- - /* copy the packet to ring buffer */
- - memcpy(lp->tbuf, d, ETH_ALEN); /* dst */
- - memcpy(&lp->tbuf[ETH_ALEN], nic->node_addr, ETH_ALEN); /* src */
- - lp->tbuf[ETH_ALEN+ETH_ALEN] = t >> 8; /* type */
- - lp->tbuf[ETH_ALEN+ETH_ALEN+1] = t; /* type */
- - memcpy(&lp->tbuf[ETH_HLEN], p, s);
- - s += ETH_HLEN;
- - if (chip_table[chip_version].flags & LANCE_MUST_PAD)
- - while (s < ETH_ZLEN) /* pad to min length */
- - lp->tbuf[s++] = 0;
- - lp->tx_ring.buf_length = -s;
- - lp->tx_ring.misc = 0x0;
- - /* OWN, STP, ENP */
- - lp->tx_ring.u.base = virt_to_bus(lp->tbuf) & 0xffffff;
- - /* we set the top byte as the very last thing */
- - lp->tx_ring.u.addr[3] = 0x83;
- - /* Trigger an immediate send poll */
- - outw(0x0, ioaddr+LANCE_ADDR);
- - (void)inw(ioaddr+LANCE_ADDR); /* as in the datasheets... */
- - /* Klaus Espenlaub: the value below was 0x48, but that enabled the
- - * interrupt line, causing a hang if for some reasone the interrupt
- - * controller had the LANCE interrupt enabled. I have no idea why
- - * nobody ran into this before... */
- - outw(0x08, ioaddr+LANCE_DATA);
- - /* wait for transmit complete */
- - time = currticks() + TICKS_PER_SEC; /* wait one second */
- - while (currticks() < time && (lp->tx_ring.u.base & 0x80000000) != 0)
- - ;
- - if ((lp->tx_ring.u.base & 0x80000000) != 0)
- - printf("LANCE timed out on transmit\n");
- - (void)inw(ioaddr+LANCE_ADDR);
- - outw(0x200, ioaddr+LANCE_DATA); /* clear transmit + InitDone */
- -#ifdef DEBUG
- - printf("tx_ring.u.base %X tx_ring.buf_length %hX tx_ring.misc %hX csr0 %hX\n",
- - lp->tx_ring.u.base, lp->tx_ring.buf_length, lp->tx_ring.misc,
- - inw(ioaddr+LANCE_DATA));
- -#endif
- -}
- -
- -static void lance_disable(struct nic *nic)
- -{
- - (void)inw(ioaddr+LANCE_RESET);
- - if (chip_table[lance_version].flags & LANCE_MUST_UNRESET)
- - outw(0, ioaddr+LANCE_RESET);
- -
- - outw(0, ioaddr+LANCE_ADDR);
- - outw(0x0004, ioaddr+LANCE_DATA); /* stop the LANCE */
- -
- -#ifndef INCLUDE_LANCE
- - disable_dma(dma);
- -#endif
- -}
- -
- -#ifdef INCLUDE_LANCE
- -static int lance_probe1(struct nic *nic, struct pci_device *pci)
- -#else
- -static int lance_probe1(struct nic *nic)
- -#endif
- -{
- - int reset_val ;
- - unsigned int i;
- - Address l;
- - short dma_channels;
- -#ifndef INCLUDE_LANCE
- - static const char dmas[] = { 5, 6, 7, 3 };
- -#endif
- -
- - reset_val = inw(ioaddr+LANCE_RESET);
- - outw(reset_val, ioaddr+LANCE_RESET);
- -#if 1 /* Klaus Espenlaub -- was #ifdef INCLUDE_NE2100*/
- - outw(0x0, ioaddr+LANCE_ADDR); /* Switch to window 0 */
- - if (inw(ioaddr+LANCE_DATA) != 0x4)
- - return (-1);
- -#endif
- - outw(88, ioaddr+LANCE_ADDR); /* Get the version of the chip */
- - if (inw(ioaddr+LANCE_ADDR) != 88)
- - lance_version = 0;
- - else
- - {
- - chip_version = inw(ioaddr+LANCE_DATA);
- - outw(89, ioaddr+LANCE_ADDR);
- - chip_version |= inw(ioaddr+LANCE_DATA) << 16;
- - if ((chip_version & 0xfff) != 0x3)
- - return (-1);
- - chip_version = (chip_version >> 12) & 0xffff;
- - for (lance_version = 1; chip_table[lance_version].id_number != 0; ++lance_version)
- - if (chip_table[lance_version].id_number == chip_version)
- - break;
- - }
- - /* make sure data structure is 8-byte aligned */
- - l = ((Address)lance + 7) & ~7;
- - lp = (struct lance_interface *)l;
- - lp->init_block.mode = 0x3; /* disable Rx and Tx */
- - lp->init_block.filter[0] = lp->init_block.filter[1] = 0x0;
- - /* using multiple Rx buffer and a single Tx buffer */
- - lp->init_block.rx_ring = (virt_to_bus(&lp->rx_ring) & 0xffffff) | RX_RING_LEN_BITS;
- - lp->init_block.tx_ring = virt_to_bus(&lp->tx_ring) & 0xffffff;
- - l = virt_to_bus(&lp->init_block);
- - outw(0x1, ioaddr+LANCE_ADDR);
- - (void)inw(ioaddr+LANCE_ADDR);
- - outw((unsigned short)l, ioaddr+LANCE_DATA);
- - outw(0x2, ioaddr+LANCE_ADDR);
- - (void)inw(ioaddr+LANCE_ADDR);
- - outw((unsigned short)(l >> 16), ioaddr+LANCE_DATA);
- - outw(0x4, ioaddr+LANCE_ADDR);
- - (void)inw(ioaddr+LANCE_ADDR);
- - outw(0x915, ioaddr+LANCE_DATA);
- - outw(0x0, ioaddr+LANCE_ADDR);
- - (void)inw(ioaddr+LANCE_ADDR);
- - /* Get station address */
- - for (i = 0; i < ETH_ALEN; ++i) {
- - nic->node_addr[i] = inb(ioaddr+LANCE_ETH_ADDR+i);
- - }
- -#ifndef INCLUDE_LANCE
- - /* now probe for DMA channel */
- - dma_channels = ((inb(DMA1_STAT_REG) >> 4) & 0xf) |
- - (inb(DMA2_STAT_REG) & 0xf0);
- - /* need to fix when PCI provides DMA info */
- - for (i = 0; i < (sizeof(dmas)/sizeof(dmas[0])); ++i)
- - {
- - int j;
- -
- - dma = dmas[i];
- - /* Don't enable a permanently busy DMA channel,
- - or the machine will hang */
- - if (dma_channels & (1 << dma))
- - continue;
- - outw(0x7f04, ioaddr+LANCE_DATA); /* clear memory error bits */
- - set_dma_mode(dma, DMA_MODE_CASCADE);
- - enable_dma(dma);
- - outw(0x1, ioaddr+LANCE_DATA); /* init */
- - for (j = 100; j > 0; --j)
- - if (inw(ioaddr+LANCE_DATA) & 0x900)
- - break;
- - if (inw(ioaddr+LANCE_DATA) & 0x100)
- - break;
- - else
- - disable_dma(dma);
- - }
- - if (i >= (sizeof(dmas)/sizeof(dmas[0])))
- - dma = 0;
- - printf("\n%s base %#X, DMA %d, addr %!\n",
- - chip_table[lance_version].name, ioaddr, dma, nic->node_addr);
- -#else
- - printf(" %s base %#hX, addr %!\n", chip_table[lance_version].name, ioaddr, nic->node_addr);
- -#endif
- - if (chip_table[chip_version].flags & LANCE_ENABLE_AUTOSELECT) {
- - /* Turn on auto-select of media (10baseT or BNC) so that the
- - * user watch the LEDs. */
- - outw(0x0002, ioaddr+LANCE_ADDR);
- - /* Don't touch 10base2 power bit. */
- - outw(inw(ioaddr+LANCE_BUS_IF) | 0x0002, ioaddr+LANCE_BUS_IF);
- - }
- - return (lance_version);
- -}
- -
- -/**************************************************************************
- -PROBE - Look for an adapter, this routine's visible to the outside
- -***************************************************************************/
- -
- -#ifdef INCLUDE_LANCE
- -struct nic *lancepci_probe(struct nic *nic, unsigned short *probe_addrs, struct pci_device *pci)
- -#endif
- -#ifdef INCLUDE_NE2100
- -struct nic *ne2100_probe(struct nic *nic, unsigned short *probe_addrs)
- -#endif
- -#ifdef INCLUDE_NI6510
- -struct nic *ni6510_probe(struct nic *nic, unsigned short *probe_addrs)
- -#endif
- -{
- - unsigned short *p;
- -#ifndef INCLUDE_LANCE
- - static unsigned short io_addrs[] = { 0x300, 0x320, 0x340, 0x360, 0 };
- -#endif
- -
- - /* if probe_addrs is 0, then routine can use a hardwired default */
- - if (probe_addrs == 0) {
- -#ifdef INCLUDE_LANCE
- - return 0;
- -#else
- - probe_addrs = io_addrs;
- -#endif
- - }
- - for (p = probe_addrs; (ioaddr = *p) != 0; ++p)
- - {
- - char offset15, offset14 = inb(ioaddr + 14);
- - unsigned short pci_cmd;
- -
- -#ifdef INCLUDE_NE2100
- - if ((offset14 == 0x52 || offset14 == 0x57) &&
- - ((offset15 = inb(ioaddr + 15)) == 0x57 || offset15 == 0x44))
- - if (lance_probe1(nic) >= 0)
- - break;
- -#endif
- -#ifdef INCLUDE_NI6510
- - if ((offset14 == 0x00 || offset14 == 0x52) &&
- - ((offset15 = inb(ioaddr + 15)) == 0x55 || offset15 == 0x44))
- - if (lance_probe1(nic) >= 0)
- - break;
- -#endif
- -#ifdef INCLUDE_LANCE
- - adjust_pci_device(pci);
- - if (lance_probe1(nic, pci) >= 0)
- - break;
- -#endif
- - }
- - /* if board found */
- - if (ioaddr != 0)
- - {
- - /* point to NIC specific routines */
- - lance_reset(nic);
- - nic->reset = lance_reset;
- - nic->poll = lance_poll;
- - nic->transmit = lance_transmit;
- - nic->disable = lance_disable;
- - return nic;
- - }
- -
- - /* no board found */
- - return 0;
- -}
- diff -Naur grub-0.97.orig/netboot/latch.h grub-0.97/netboot/latch.h
- --- grub-0.97.orig/netboot/latch.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/latch.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,10 @@
- +#ifndef LATCH_H
- +#define LATCH_H
- +
- +#define TICKS_PER_SEC 18
- +
- +/* For different calibrators of the TSC move the declaration of
- + * sleep_latch and the definitions of it's length here...
- + */
- +
- +#endif /* LATCH_H */
- diff -Naur grub-0.97.orig/netboot/linux-asm-io.h grub-0.97/netboot/linux-asm-io.h
- --- grub-0.97.orig/netboot/linux-asm-io.h 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/linux-asm-io.h 1970-01-01 00:00:00.000000000 +0000
- @@ -1,187 +0,0 @@
- -#ifndef _ASM_IO_H
- -#define _ASM_IO_H
- -
- -/*
- - * This file contains the definitions for the x86 IO instructions
- - * inb/inw/inl/outb/outw/outl and the "string versions" of the same
- - * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
- - * versions of the single-IO instructions (inb_p/inw_p/..).
- - *
- - * This file is not meant to be obfuscating: it's just complicated
- - * to (a) handle it all in a way that makes gcc able to optimize it
- - * as well as possible and (b) trying to avoid writing the same thing
- - * over and over again with slight variations and possibly making a
- - * mistake somewhere.
- - */
- -
- -/*
- - * Thanks to James van Artsdalen for a better timing-fix than
- - * the two short jumps: using outb's to a nonexistent port seems
- - * to guarantee better timings even on fast machines.
- - *
- - * On the other hand, I'd like to be sure of a non-existent port:
- - * I feel a bit unsafe about using 0x80 (should be safe, though)
- - *
- - * Linus
- - */
- -
- -#ifdef SLOW_IO_BY_JUMPING
- -#define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:")
- -#else
- -#define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80")
- -#endif
- -
- -#ifdef REALLY_SLOW_IO
- -#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
- -#else
- -#define SLOW_DOWN_IO __SLOW_DOWN_IO
- -#endif
- -
- -/*
- - * readX/writeX() are used to access memory mapped devices. On some
- - * architectures the memory mapped IO stuff needs to be accessed
- - * differently. On the x86 architecture, we just read/write the
- - * memory location directly.
- - */
- -#define readb(addr) (*(volatile unsigned char *) (addr))
- -#define readw(addr) (*(volatile unsigned short *) (addr))
- -#define readl(addr) (*(volatile unsigned int *) (addr))
- -
- -#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b))
- -#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b))
- -#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))
- -
- -#define memset_io(a,b,c) memset((void *)(a),(b),(c))
- -#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
- -#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
- -
- -/*
- - * Again, i386 does not require mem IO specific function.
- - */
- -
- -#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d))
- -
- -/*
- - * Talk about misusing macros..
- - */
- -
- -#define __OUT1(s,x) \
- -extern void __out##s(unsigned x value, unsigned short port); \
- -extern inline void __out##s(unsigned x value, unsigned short port) {
- -
- -#define __OUT2(s,s1,s2) \
- -__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
- -
- -#define __OUT(s,s1,x) \
- -__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \
- -__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); } \
- -__OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \
- -__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; }
- -
- -#define __IN1(s,x) \
- -extern unsigned x __in##s(unsigned short port); \
- -extern inline unsigned x __in##s(unsigned short port) { unsigned x _v;
- -
- -#define __IN2(s,s1,s2) \
- -__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
- -
- -#define __IN(s,s1,x,i...) \
- -__IN1(s,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \
- -__IN1(s##c,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \
- -__IN1(s##_p,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \
- -__IN1(s##c_p,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; }
- -
- -#define __INS(s) \
- -extern void ins##s(unsigned short port, void * addr, unsigned long count); \
- -extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \
- -{ __asm__ __volatile__ ("cld ; rep ; ins" #s \
- -: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
- -
- -#define __OUTS(s) \
- -extern void outs##s(unsigned short port, const void * addr, unsigned long count); \
- -extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \
- -{ __asm__ __volatile__ ("cld ; rep ; outs" #s \
- -: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
- -
- -__IN(b,"", char)
- -__IN(w,"",short)
- -__IN(l,"", long)
- -
- -__OUT(b,"b",char)
- -__OUT(w,"w",short)
- -__OUT(l,,int)
- -
- -__INS(b)
- -__INS(w)
- -__INS(l)
- -
- -__OUTS(b)
- -__OUTS(w)
- -__OUTS(l)
- -
- -/*
- - * Note that due to the way __builtin_constant_p() works, you
- - * - can't use it inside a inline function (it will never be true)
- - * - you don't have to worry about side effects within the __builtin..
- - */
- -#define outb(val,port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __outbc((val),(port)) : \
- - __outb((val),(port)))
- -
- -#define inb(port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __inbc(port) : \
- - __inb(port))
- -
- -#define outb_p(val,port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __outbc_p((val),(port)) : \
- - __outb_p((val),(port)))
- -
- -#define inb_p(port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __inbc_p(port) : \
- - __inb_p(port))
- -
- -#define outw(val,port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __outwc((val),(port)) : \
- - __outw((val),(port)))
- -
- -#define inw(port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __inwc(port) : \
- - __inw(port))
- -
- -#define outw_p(val,port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __outwc_p((val),(port)) : \
- - __outw_p((val),(port)))
- -
- -#define inw_p(port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __inwc_p(port) : \
- - __inw_p(port))
- -
- -#define outl(val,port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __outlc((val),(port)) : \
- - __outl((val),(port)))
- -
- -#define inl(port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __inlc(port) : \
- - __inl(port))
- -
- -#define outl_p(val,port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __outlc_p((val),(port)) : \
- - __outl_p((val),(port)))
- -
- -#define inl_p(port) \
- -((__builtin_constant_p((port)) && (port) < 256) ? \
- - __inlc_p(port) : \
- - __inl_p(port))
- -
- -#endif
- diff -Naur grub-0.97.orig/netboot/linux-asm-string.h grub-0.97/netboot/linux-asm-string.h
- --- grub-0.97.orig/netboot/linux-asm-string.h 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/linux-asm-string.h 1970-01-01 00:00:00.000000000 +0000
- @@ -1,291 +0,0 @@
- -/*
- - * Taken from Linux /usr/include/asm/string.h
- - * All except memcpy, memmove, memset and memcmp removed.
- - */
- -
- -#ifndef _I386_STRING_H_
- -#define _I386_STRING_H_
- -
- -/*
- - * This string-include defines all string functions as inline
- - * functions. Use gcc. It also assumes ds=es=data space, this should be
- - * normal. Most of the string-functions are rather heavily hand-optimized,
- - * see especially strtok,strstr,str[c]spn. They should work, but are not
- - * very easy to understand. Everything is done entirely within the register
- - * set, making the functions fast and clean. String instructions have been
- - * used through-out, making for "slightly" unclear code :-)
- - *
- - * NO Copyright (C) 1991, 1992 Linus Torvalds,
- - * consider these trivial functions to be PD.
- - */
- -
- -typedef int size_t;
- -
- -extern void *__memcpy(void * to, const void * from, size_t n);
- -extern void *__constant_memcpy(void * to, const void * from, size_t n);
- -extern void *memmove(void * dest,const void * src, size_t n);
- -extern void *__memset_generic(void * s, char c,size_t count);
- -extern void *__constant_c_memset(void * s, unsigned long c, size_t count);
- -extern void *__constant_c_and_count_memset(void * s, unsigned long pattern, size_t count);
- -
- -
- -extern inline void * __memcpy(void * to, const void * from, size_t n)
- -{
- -int d0, d1, d2;
- -__asm__ __volatile__(
- - "cld\n\t"
- - "rep ; movsl\n\t"
- - "testb $2,%b4\n\t"
- - "je 1f\n\t"
- - "movsw\n"
- - "1:\ttestb $1,%b4\n\t"
- - "je 2f\n\t"
- - "movsb\n"
- - "2:"
- - : "=&c" (d0), "=&D" (d1), "=&S" (d2)
- - :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from)
- - : "memory");
- -return (to);
- -}
- -
- -/*
- - * This looks horribly ugly, but the compiler can optimize it totally,
- - * as the count is constant.
- - */
- -extern inline void * __constant_memcpy(void * to, const void * from, size_t n)
- -{
- - switch (n) {
- - case 0:
- - return to;
- - case 1:
- - *(unsigned char *)to = *(const unsigned char *)from;
- - return to;
- - case 2:
- - *(unsigned short *)to = *(const unsigned short *)from;
- - return to;
- - case 3:
- - *(unsigned short *)to = *(const unsigned short *)from;
- - *(2+(unsigned char *)to) = *(2+(const unsigned char *)from);
- - return to;
- - case 4:
- - *(unsigned long *)to = *(const unsigned long *)from;
- - return to;
- - case 6: /* for Ethernet addresses */
- - *(unsigned long *)to = *(const unsigned long *)from;
- - *(2+(unsigned short *)to) = *(2+(const unsigned short *)from);
- - return to;
- - case 8:
- - *(unsigned long *)to = *(const unsigned long *)from;
- - *(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
- - return to;
- - case 12:
- - *(unsigned long *)to = *(const unsigned long *)from;
- - *(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
- - *(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
- - return to;
- - case 16:
- - *(unsigned long *)to = *(const unsigned long *)from;
- - *(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
- - *(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
- - *(3+(unsigned long *)to) = *(3+(const unsigned long *)from);
- - return to;
- - case 20:
- - *(unsigned long *)to = *(const unsigned long *)from;
- - *(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
- - *(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
- - *(3+(unsigned long *)to) = *(3+(const unsigned long *)from);
- - *(4+(unsigned long *)to) = *(4+(const unsigned long *)from);
- - return to;
- - }
- -#define COMMON(x) \
- -__asm__ __volatile__( \
- - "cld\n\t" \
- - "rep ; movsl" \
- - x \
- - : "=&c" (d0), "=&D" (d1), "=&S" (d2) \
- - : "0" (n/4),"1" ((long) to),"2" ((long) from) \
- - : "memory");
- -{
- - int d0, d1, d2;
- - switch (n % 4) {
- - case 0: COMMON(""); return to;
- - case 1: COMMON("\n\tmovsb"); return to;
- - case 2: COMMON("\n\tmovsw"); return to;
- - default: COMMON("\n\tmovsw\n\tmovsb"); return to;
- - }
- -}
- -
- -#undef COMMON
- -}
- -
- -#define __HAVE_ARCH_MEMCPY
- -#define memcpy(t, f, n) \
- -(__builtin_constant_p(n) ? \
- - __constant_memcpy((t),(f),(n)) : \
- - __memcpy((t),(f),(n)))
- -
- -#define __HAVE_ARCH_MEMMOVE
- -extern inline void * memmove(void * dest,const void * src, size_t n)
- -{
- -int d0, d1, d2;
- -if (dest<src)
- -__asm__ __volatile__(
- - "cld\n\t"
- - "rep\n\t"
- - "movsb"
- - : "=&c" (d0), "=&S" (d1), "=&D" (d2)
- - :"0" (n),"1" (src),"2" (dest)
- - : "memory");
- -else
- -__asm__ __volatile__(
- - "std\n\t"
- - "rep\n\t"
- - "movsb\n\t"
- - "cld"
- - : "=&c" (d0), "=&S" (d1), "=&D" (d2)
- - :"0" (n),
- - "1" (n-1+(const char *)src),
- - "2" (n-1+(char *)dest)
- - :"memory");
- -return dest;
- -}
- -
- -#define memcmp __builtin_memcmp
- -
- -extern inline void * __memset_generic(void * s, char c,size_t count)
- -{
- -int d0, d1;
- -__asm__ __volatile__(
- - "cld\n\t"
- - "rep\n\t"
- - "stosb"
- - : "=&c" (d0), "=&D" (d1)
- - :"a" (c),"1" (s),"0" (count)
- - :"memory");
- -return s;
- -}
- -
- -/* we might want to write optimized versions of these later */
- -#define __constant_count_memset(s,c,count) __memset_generic((s),(c),(count))
- -
- -/*
- - * memset(x,0,y) is a reasonably common thing to do, so we want to fill
- - * things 32 bits at a time even when we don't know the size of the
- - * area at compile-time..
- - */
- -extern inline void * __constant_c_memset(void * s, unsigned long c, size_t count)
- -{
- -int d0, d1;
- -__asm__ __volatile__(
- - "cld\n\t"
- - "rep ; stosl\n\t"
- - "testb $2,%b3\n\t"
- - "je 1f\n\t"
- - "stosw\n"
- - "1:\ttestb $1,%b3\n\t"
- - "je 2f\n\t"
- - "stosb\n"
- - "2:"
- - : "=&c" (d0), "=&D" (d1)
- - :"a" (c), "q" (count), "0" (count/4), "1" ((long) s)
- - :"memory");
- -return (s);
- -}
- -
- -/*
- - * This looks horribly ugly, but the compiler can optimize it totally,
- - * as we by now know that both pattern and count is constant..
- - */
- -extern inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count)
- -{
- - switch (count) {
- - case 0:
- - return s;
- - case 1:
- - *(unsigned char *)s = pattern;
- - return s;
- - case 2:
- - *(unsigned short *)s = pattern;
- - return s;
- - case 3:
- - *(unsigned short *)s = pattern;
- - *(2+(unsigned char *)s) = pattern;
- - return s;
- - case 4:
- - *(unsigned long *)s = pattern;
- - return s;
- - }
- -#define COMMON(x) \
- -__asm__ __volatile__("cld\n\t" \
- - "rep ; stosl" \
- - x \
- - : "=&c" (d0), "=&D" (d1) \
- - : "a" (pattern),"0" (count/4),"1" ((long) s) \
- - : "memory")
- -{
- - int d0, d1;
- - switch (count % 4) {
- - case 0: COMMON(""); return s;
- - case 1: COMMON("\n\tstosb"); return s;
- - case 2: COMMON("\n\tstosw"); return s;
- - default: COMMON("\n\tstosw\n\tstosb"); return s;
- - }
- -}
- -
- -#undef COMMON
- -}
- -
- -#define __constant_c_x_memset(s, c, count) \
- -(__builtin_constant_p(count) ? \
- - __constant_c_and_count_memset((s),(c),(count)) : \
- - __constant_c_memset((s),(c),(count)))
- -
- -#define __memset(s, c, count) \
- -(__builtin_constant_p(count) ? \
- - __constant_count_memset((s),(c),(count)) : \
- - __memset_generic((s),(c),(count)))
- -
- -#define __HAVE_ARCH_MEMSET
- -#define memset(s, c, count) \
- -(__builtin_constant_p(c) ? \
- - __constant_c_x_memset((s),(c),(count)) : \
- - __memset((s),(c),(count)))
- -
- -#define __HAVE_ARCH_STRNCMP
- -static inline int strncmp(const char * cs,const char * ct,size_t count)
- -{
- -register int __res;
- -int d0, d1, d2;
- -__asm__ __volatile__(
- - "1:\tdecl %3\n\t"
- - "js 2f\n\t"
- - "lodsb\n\t"
- - "scasb\n\t"
- - "jne 3f\n\t"
- - "testb %%al,%%al\n\t"
- - "jne 1b\n"
- - "2:\txorl %%eax,%%eax\n\t"
- - "jmp 4f\n"
- - "3:\tsbbl %%eax,%%eax\n\t"
- - "orb $1,%%al\n"
- - "4:"
- - :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2)
- - :"1" (cs),"2" (ct),"3" (count));
- -return __res;
- -}
- -
- -#define __HAVE_ARCH_STRLEN
- -static inline size_t strlen(const char * s)
- -{
- -int d0;
- -register int __res;
- -__asm__ __volatile__(
- - "repne\n\t"
- - "scasb\n\t"
- - "notl %0\n\t"
- - "decl %0"
- - :"=c" (__res), "=&D" (d0) :"1" (s),"a" (0), "0" (0xffffffff));
- -return __res;
- -}
- -
- -#endif
- diff -Naur grub-0.97.orig/netboot/little_bswap.h grub-0.97/netboot/little_bswap.h
- --- grub-0.97.orig/netboot/little_bswap.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/little_bswap.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,17 @@
- +#ifndef ETHERBOOT_LITTLE_BSWAP_H
- +#define ETHERBOOT_LITTLE_BSWAP_H
- +
- +#define ntohl(x) __bswap_32(x)
- +#define htonl(x) __bswap_32(x)
- +#define ntohs(x) __bswap_16(x)
- +#define htons(x) __bswap_16(x)
- +#define cpu_to_le32(x) (x)
- +#define cpu_to_le16(x) (x)
- +#define cpu_to_be32(x) __bswap_32(x)
- +#define cpu_to_be16(x) __bswap_16(x)
- +#define le32_to_cpu(x) (x)
- +#define le16_to_cpu(x) (x)
- +#define be32_to_cpu(x) __bswap_32(x)
- +#define be16_to_cpu(x) __bswap_16(x)
- +
- +#endif /* ETHERBOOT_LITTLE_BSWAP_H */
- diff -Naur grub-0.97.orig/netboot/main.c grub-0.97/netboot/main.c
- --- grub-0.97.orig/netboot/main.c 2004-05-20 22:19:33.000000000 +0000
- +++ grub-0.97/netboot/main.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,1171 +0,0 @@
- -/*
- - * GRUB -- GRand Unified Bootloader
- - * Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
- - *
- - * This program is free software; you can redistribute it and/or modify
- - * it under the terms of the GNU General Public License as published by
- - * the Free Software Foundation; either version 2 of the License, or
- - * (at your option) any later version.
- - *
- - * This program is distributed in the hope that it will be useful,
- - * but WITHOUT ANY WARRANTY; without even the implied warranty of
- - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- - * GNU General Public License for more details.
- - *
- - * You should have received a copy of the GNU General Public License
- - * along with this program; if not, write to the Free Software
- - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- - */
- -
- -/* Based on "src/main.c" in etherboot-5.0.5. */
- -
- -/**************************************************************************
- -ETHERBOOT - BOOTP/TFTP Bootstrap Program
- -
- -Author: Martin Renters
- - Date: Dec/93
- -
- -Literature dealing with the network protocols:
- - ARP - RFC826
- - RARP - RFC903
- - UDP - RFC768
- - BOOTP - RFC951, RFC2132 (vendor extensions)
- - DHCP - RFC2131, RFC2132 (options)
- - TFTP - RFC1350, RFC2347 (options), RFC2348 (blocksize), RFC2349 (tsize)
- - RPC - RFC1831, RFC1832 (XDR), RFC1833 (rpcbind/portmapper)
- - NFS - RFC1094, RFC1813 (v3, useful for clarifications, not implemented)
- -
- -**************************************************************************/
- -
- -#define GRUB 1
- -#include <etherboot.h>
- -#include <nic.h>
- -
- -/* #define DEBUG 1 */
- -
- -struct arptable_t arptable[MAX_ARP];
- -
- -/* Set if the user pushes Control-C. */
- -int ip_abort = 0;
- -/* Set if an ethernet card is probed and IP addresses are set. */
- -int network_ready = 0;
- -
- -struct rom_info rom;
- -
- -static int vendorext_isvalid;
- -static unsigned long netmask;
- -static struct bootpd_t bootp_data;
- -static unsigned long xid;
- -static unsigned char *end_of_rfc1533 = NULL;
- -
- -#ifndef NO_DHCP_SUPPORT
- -#endif /* NO_DHCP_SUPPORT */
- -
- -/* äEth */
- -static unsigned char vendorext_magic[] = {0xE4, 0x45, 0x74, 0x68};
- -static const unsigned char broadcast[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
- -
- -#ifdef NO_DHCP_SUPPORT
- -
- -static unsigned char rfc1533_cookie[5] = {RFC1533_COOKIE, RFC1533_END};
- -
- -#else /* ! NO_DHCP_SUPPORT */
- -
- -static int dhcp_reply;
- -static in_addr dhcp_server = {0L};
- -static in_addr dhcp_addr = {0L};
- -static unsigned char rfc1533_cookie[] = {RFC1533_COOKIE};
- -static unsigned char rfc1533_end[] = {RFC1533_END};
- -
- -static const unsigned char dhcpdiscover[] =
- -{
- - RFC2132_MSG_TYPE, 1, DHCPDISCOVER,
- - RFC2132_MAX_SIZE,2, /* request as much as we can */
- - ETH_MAX_MTU / 256, ETH_MAX_MTU % 256,
- - RFC2132_PARAM_LIST, 4, RFC1533_NETMASK, RFC1533_GATEWAY,
- - RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH
- -};
- -
- -static const unsigned char dhcprequest[] =
- -{
- - RFC2132_MSG_TYPE, 1, DHCPREQUEST,
- - RFC2132_SRV_ID, 4, 0, 0, 0, 0,
- - RFC2132_REQ_ADDR, 4, 0, 0, 0, 0,
- - RFC2132_MAX_SIZE, 2, /* request as much as we can */
- - ETH_MAX_MTU / 256, ETH_MAX_MTU % 256,
- - /* request parameters */
- - RFC2132_PARAM_LIST,
- - /* 4 standard + 2 vendortags */
- - 4 + 2,
- - /* Standard parameters */
- - RFC1533_NETMASK, RFC1533_GATEWAY,
- - RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH,
- - /* Etherboot vendortags */
- - RFC1533_VENDOR_MAGIC,
- - RFC1533_VENDOR_CONFIGFILE,
- -};
- -
- -#endif /* ! NO_DHCP_SUPPORT */
- -
- -static unsigned short ipchksum (unsigned short *ip, int len);
- -static unsigned short udpchksum (struct iphdr *packet);
- -
- -void
- -print_network_configuration (void)
- -{
- - if (! eth_probe ())
- - grub_printf ("No ethernet card found.\n");
- - else if (! network_ready)
- - grub_printf ("Not initialized yet.\n");
- - else
- - {
- - etherboot_printf ("Address: %@\n", arptable[ARP_CLIENT].ipaddr.s_addr);
- - etherboot_printf ("Netmask: %@\n", netmask);
- - etherboot_printf ("Server: %@\n", arptable[ARP_SERVER].ipaddr.s_addr);
- - etherboot_printf ("Gateway: %@\n", arptable[ARP_GATEWAY].ipaddr.s_addr);
- - }
- -}
- -
- -
- -/**************************************************************************
- -DEFAULT_NETMASK - Return default netmask for IP address
- -**************************************************************************/
- -static inline unsigned long
- -default_netmask (void)
- -{
- - int net = ntohl (arptable[ARP_CLIENT].ipaddr.s_addr) >> 24;
- - if (net <= 127)
- - return (htonl (0xff000000));
- - else if (net < 192)
- - return (htonl (0xffff0000));
- - else
- - return (htonl (0xffffff00));
- -}
- -
- -/* ifconfig - configure network interface. */
- -int
- -ifconfig (char *ip, char *sm, char *gw, char *svr)
- -{
- - in_addr tmp;
- -
- - if (sm)
- - {
- - if (! inet_aton (sm, &tmp))
- - return 0;
- -
- - netmask = tmp.s_addr;
- - }
- -
- - if (ip)
- - {
- - if (! inet_aton (ip, &arptable[ARP_CLIENT].ipaddr))
- - return 0;
- -
- - if (! netmask && ! sm)
- - netmask = default_netmask ();
- - }
- -
- - if (gw && ! inet_aton (gw, &arptable[ARP_GATEWAY].ipaddr))
- - return 0;
- -
- - /* Clear out the ARP entry. */
- - grub_memset (arptable[ARP_GATEWAY].node, 0, ETH_ALEN);
- -
- - if (svr && ! inet_aton (svr, &arptable[ARP_SERVER].ipaddr))
- - return 0;
- -
- - /* Likewise. */
- - grub_memset (arptable[ARP_SERVER].node, 0, ETH_ALEN);
- -
- - if (ip || sm)
- - {
- - if (IP_BROADCAST == (netmask | arptable[ARP_CLIENT].ipaddr.s_addr)
- - || netmask == (netmask | arptable[ARP_CLIENT].ipaddr.s_addr)
- - || ! netmask)
- - network_ready = 0;
- - else
- - network_ready = 1;
- - }
- -
- - return 1;
- -}
- -
- -
- -/**************************************************************************
- -UDP_TRANSMIT - Send a UDP datagram
- -**************************************************************************/
- -int
- -udp_transmit (unsigned long destip, unsigned int srcsock,
- - unsigned int destsock, int len, const void *buf)
- -{
- - struct iphdr *ip;
- - struct udphdr *udp;
- - struct arprequest arpreq;
- - int arpentry, i;
- - int retry;
- -
- - ip = (struct iphdr *) buf;
- - udp = (struct udphdr *) ((unsigned long) buf + sizeof (struct iphdr));
- - ip->verhdrlen = 0x45;
- - ip->service = 0;
- - ip->len = htons (len);
- - ip->ident = 0;
- - ip->frags = 0;
- - ip->ttl = 60;
- - ip->protocol = IP_UDP;
- - ip->chksum = 0;
- - ip->src.s_addr = arptable[ARP_CLIENT].ipaddr.s_addr;
- - ip->dest.s_addr = destip;
- - ip->chksum = ipchksum ((unsigned short *) buf, sizeof (struct iphdr));
- - udp->src = htons (srcsock);
- - udp->dest = htons (destsock);
- - udp->len = htons (len - sizeof (struct iphdr));
- - udp->chksum = 0;
- - udp->chksum = htons (udpchksum (ip));
- -
- - if (udp->chksum == 0)
- - udp->chksum = 0xffff;
- -
- - if (destip == IP_BROADCAST)
- - {
- - eth_transmit (broadcast, IP, len, buf);
- - }
- - else
- - {
- - if (((destip & netmask)
- - != (arptable[ARP_CLIENT].ipaddr.s_addr & netmask))
- - && arptable[ARP_GATEWAY].ipaddr.s_addr)
- - destip = arptable[ARP_GATEWAY].ipaddr.s_addr;
- -
- - for (arpentry = 0; arpentry < MAX_ARP; arpentry++)
- - if (arptable[arpentry].ipaddr.s_addr == destip)
- - break;
- -
- - if (arpentry == MAX_ARP)
- - {
- - etherboot_printf ("%@ is not in my arp table!\n", destip);
- - return 0;
- - }
- -
- - for (i = 0; i < ETH_ALEN; i++)
- - if (arptable[arpentry].node[i])
- - break;
- -
- - if (i == ETH_ALEN)
- - {
- - /* Need to do arp request. */
- -#ifdef DEBUG
- - grub_printf ("arp request.\n");
- -#endif
- - arpreq.hwtype = htons (1);
- - arpreq.protocol = htons (IP);
- - arpreq.hwlen = ETH_ALEN;
- - arpreq.protolen = 4;
- - arpreq.opcode = htons (ARP_REQUEST);
- - grub_memmove (arpreq.shwaddr, arptable[ARP_CLIENT].node,
- - ETH_ALEN);
- - grub_memmove (arpreq.sipaddr, (char *) &arptable[ARP_CLIENT].ipaddr,
- - sizeof (in_addr));
- - grub_memset (arpreq.thwaddr, 0, ETH_ALEN);
- - grub_memmove (arpreq.tipaddr, (char *) &destip, sizeof (in_addr));
- -
- - for (retry = 1; retry <= MAX_ARP_RETRIES; retry++)
- - {
- - long timeout;
- -
- - eth_transmit (broadcast, ARP, sizeof (arpreq), &arpreq);
- - timeout = rfc2131_sleep_interval (TIMEOUT, retry);
- -
- - if (await_reply (AWAIT_ARP, arpentry, arpreq.tipaddr, timeout))
- - goto xmit;
- -
- - if (ip_abort)
- - return 0;
- - }
- -
- - return 0;
- - }
- -
- - xmit:
- - eth_transmit (arptable[arpentry].node, IP, len, buf);
- - }
- -
- - return 1;
- -}
- -
- -/**************************************************************************
- -TFTP - Download extended BOOTP data, or kernel image
- -**************************************************************************/
- -static int
- -tftp (const char *name, int (*fnc) (unsigned char *, int, int, int))
- -{
- - int retry = 0;
- - static unsigned short iport = 2000;
- - unsigned short oport = 0;
- - unsigned short len, block = 0, prevblock = 0;
- - int bcounter = 0;
- - struct tftp_t *tr;
- - struct tftpreq_t tp;
- - int rc;
- - int packetsize = TFTP_DEFAULTSIZE_PACKET;
- -
- - /* Clear out the Rx queue first. It contains nothing of interest,
- - * except possibly ARP requests from the DHCP/TFTP server. We use
- - * polling throughout Etherboot, so some time may have passed since we
- - * last polled the receive queue, which may now be filled with
- - * broadcast packets. This will cause the reply to the packets we are
- - * about to send to be lost immediately. Not very clever. */
- - await_reply (AWAIT_QDRAIN, 0, NULL, 0);
- -
- - tp.opcode = htons (TFTP_RRQ);
- - len = (grub_sprintf ((char *) tp.u.rrq, "%s%coctet%cblksize%c%d",
- - name, 0, 0, 0, TFTP_MAX_PACKET)
- - + sizeof (tp.ip) + sizeof (tp.udp) + sizeof (tp.opcode) + 1);
- - if (! udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, ++iport,
- - TFTP_PORT, len, &tp))
- - return 0;
- -
- - for (;;)
- - {
- - long timeout;
- -
- -#ifdef CONGESTED
- - timeout = rfc2131_sleep_interval (block ? TFTP_REXMT : TIMEOUT, retry);
- -#else
- - timeout = rfc2131_sleep_interval (TIMEOUT, retry);
- -#endif
- -
- - if (! await_reply (AWAIT_TFTP, iport, NULL, timeout))
- - {
- - if (! block && retry++ < MAX_TFTP_RETRIES)
- - {
- - /* Maybe initial request was lost. */
- - if (! udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr,
- - ++iport, TFTP_PORT, len, &tp))
- - return 0;
- -
- - continue;
- - }
- -
- -#ifdef CONGESTED
- - if (block && ((retry += TFTP_REXMT) < TFTP_TIMEOUT))
- - {
- - /* We resend our last ack. */
- -#ifdef MDEBUG
- - grub_printf ("<REXMT>\n");
- -#endif
- - udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr,
- - iport, oport,
- - TFTP_MIN_PACKET, &tp);
- - continue;
- - }
- -#endif
- - /* Timeout. */
- - break;
- - }
- -
- - tr = (struct tftp_t *) &nic.packet[ETH_HLEN];
- - if (tr->opcode == ntohs (TFTP_ERROR))
- - {
- - grub_printf ("TFTP error %d (%s)\n",
- - ntohs (tr->u.err.errcode),
- - tr->u.err.errmsg);
- - break;
- - }
- -
- - if (tr->opcode == ntohs (TFTP_OACK))
- - {
- - char *p = tr->u.oack.data, *e;
- -
- - /* Shouldn't happen. */
- - if (prevblock)
- - /* Ignore it. */
- - continue;
- -
- - len = ntohs (tr->udp.len) - sizeof (struct udphdr) - 2;
- - if (len > TFTP_MAX_PACKET)
- - goto noak;
- -
- - e = p + len;
- - while (*p != '\000' && p < e)
- - {
- - if (! grub_strcmp ("blksize", p))
- - {
- - p += 8;
- - if ((packetsize = getdec (&p)) < TFTP_DEFAULTSIZE_PACKET)
- - goto noak;
- -
- - while (p < e && *p)
- - p++;
- -
- - if (p < e)
- - p++;
- - }
- - else
- - {
- - noak:
- - tp.opcode = htons (TFTP_ERROR);
- - tp.u.err.errcode = 8;
- - len = (grub_sprintf ((char *) tp.u.err.errmsg,
- - "RFC1782 error")
- - + sizeof (tp.ip) + sizeof (tp.udp)
- - + sizeof (tp.opcode) + sizeof (tp.u.err.errcode)
- - + 1);
- - udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr,
- - iport, ntohs (tr->udp.src),
- - len, &tp);
- - return 0;
- - }
- - }
- -
- - if (p > e)
- - goto noak;
- -
- - /* This ensures that the packet does not get processed as data! */
- - block = tp.u.ack.block = 0;
- - }
- - else if (tr->opcode == ntohs (TFTP_DATA))
- - {
- - len = ntohs (tr->udp.len) - sizeof (struct udphdr) - 4;
- - /* Shouldn't happen. */
- - if (len > packetsize)
- - /* Ignore it. */
- - continue;
- -
- - block = ntohs (tp.u.ack.block = tr->u.data.block);
- - }
- - else
- - /* Neither TFTP_OACK nor TFTP_DATA. */
- - break;
- -
- - if ((block || bcounter) && (block != prevblock + 1))
- - /* Block order should be continuous */
- - tp.u.ack.block = htons (block = prevblock);
- -
- - /* Should be continuous. */
- - tp.opcode = htons (TFTP_ACK);
- - oport = ntohs (tr->udp.src);
- - /* Ack. */
- - udp_transmit (arptable[ARP_SERVER].ipaddr.s_addr, iport,
- - oport, TFTP_MIN_PACKET, &tp);
- -
- - if ((unsigned short) (block - prevblock) != 1)
- - /* Retransmission or OACK, don't process via callback
- - * and don't change the value of prevblock. */
- - continue;
- -
- - prevblock = block;
- - /* Is it the right place to zero the timer? */
- - retry = 0;
- -
- - if ((rc = fnc (tr->u.data.download,
- - ++bcounter, len, len < packetsize)) >= 0)
- - return rc;
- -
- - /* End of data. */
- - if (len < packetsize)
- - return 1;
- - }
- -
- - return 0;
- -}
- -
- -/**************************************************************************
- -RARP - Get my IP address and load information
- -**************************************************************************/
- -int
- -rarp (void)
- -{
- - int retry;
- -
- - /* arp and rarp requests share the same packet structure. */
- - struct arprequest rarpreq;
- -
- - /* Make sure that an ethernet is probed. */
- - if (! eth_probe ())
- - return 0;
- -
- - /* Clear the ready flag. */
- - network_ready = 0;
- -
- - grub_memset (&rarpreq, 0, sizeof (rarpreq));
- -
- - rarpreq.hwtype = htons (1);
- - rarpreq.protocol = htons (IP);
- - rarpreq.hwlen = ETH_ALEN;
- - rarpreq.protolen = 4;
- - rarpreq.opcode = htons (RARP_REQUEST);
- - grub_memmove ((char *) &rarpreq.shwaddr, arptable[ARP_CLIENT].node,
- - ETH_ALEN);
- - /* sipaddr is already zeroed out */
- - grub_memmove ((char *) &rarpreq.thwaddr, arptable[ARP_CLIENT].node,
- - ETH_ALEN);
- - /* tipaddr is already zeroed out */
- -
- - for (retry = 0; retry < MAX_ARP_RETRIES; ++retry)
- - {
- - long timeout;
- -
- - eth_transmit (broadcast, RARP, sizeof (rarpreq), &rarpreq);
- -
- - timeout = rfc2131_sleep_interval (TIMEOUT, retry);
- - if (await_reply (AWAIT_RARP, 0, rarpreq.shwaddr, timeout))
- - break;
- -
- - if (ip_abort)
- - return 0;
- - }
- -
- - if (retry < MAX_ARP_RETRIES)
- - {
- - network_ready = 1;
- - return 1;
- - }
- -
- - return 0;
- -}
- -
- -/**************************************************************************
- -BOOTP - Get my IP address and load information
- -**************************************************************************/
- -int
- -bootp (void)
- -{
- - int retry;
- -#ifndef NO_DHCP_SUPPORT
- - int reqretry;
- -#endif /* ! NO_DHCP_SUPPORT */
- - struct bootpip_t ip;
- - unsigned long starttime;
- -
- - /* Make sure that an ethernet is probed. */
- - if (! eth_probe ())
- - return 0;
- -
- - /* Clear the ready flag. */
- - network_ready = 0;
- -
- -#ifdef DEBUG
- - grub_printf ("network is ready.\n");
- -#endif
- -
- - grub_memset (&ip, 0, sizeof (struct bootpip_t));
- - ip.bp.bp_op = BOOTP_REQUEST;
- - ip.bp.bp_htype = 1;
- - ip.bp.bp_hlen = ETH_ALEN;
- - starttime = currticks ();
- - /* Use lower 32 bits of node address, more likely to be
- - distinct than the time since booting */
- - grub_memmove (&xid, &arptable[ARP_CLIENT].node[2], sizeof(xid));
- - ip.bp.bp_xid = xid += htonl (starttime);
- - grub_memmove (ip.bp.bp_hwaddr, arptable[ARP_CLIENT].node, ETH_ALEN);
- -#ifdef DEBUG
- - etherboot_printf ("bp_op = %d\n", ip.bp.bp_op);
- - etherboot_printf ("bp_htype = %d\n", ip.bp.bp_htype);
- - etherboot_printf ("bp_hlen = %d\n", ip.bp.bp_hlen);
- - etherboot_printf ("bp_xid = %d\n", ip.bp.bp_xid);
- - etherboot_printf ("bp_hwaddr = %!\n", ip.bp.bp_hwaddr);
- - etherboot_printf ("bp_hops = %d\n", (int) ip.bp.bp_hops);
- - etherboot_printf ("bp_secs = %d\n", (int) ip.bp.bp_hwaddr);
- -#endif
- -
- -#ifdef NO_DHCP_SUPPORT
- - /* Request RFC-style options. */
- - grub_memmove (ip.bp.bp_vend, rfc1533_cookie, 5);
- -#else
- - /* Request RFC-style options. */
- - grub_memmove (ip.bp.bp_vend, rfc1533_cookie, sizeof rfc1533_cookie);
- - grub_memmove (ip.bp.bp_vend + sizeof rfc1533_cookie, dhcpdiscover,
- - sizeof dhcpdiscover);
- - grub_memmove (ip.bp.bp_vend + sizeof rfc1533_cookie + sizeof dhcpdiscover,
- - rfc1533_end, sizeof rfc1533_end);
- -#endif /* ! NO_DHCP_SUPPORT */
- -
- - for (retry = 0; retry < MAX_BOOTP_RETRIES;)
- - {
- - long timeout;
- -
- -#ifdef DEBUG
- - grub_printf ("retry = %d\n", retry);
- -#endif
- -
- - /* Clear out the Rx queue first. It contains nothing of
- - * interest, except possibly ARP requests from the DHCP/TFTP
- - * server. We use polling throughout Etherboot, so some time
- - * may have passed since we last polled the receive queue,
- - * which may now be filled with broadcast packets. This will
- - * cause the reply to the packets we are about to send to be
- - * lost immediately. Not very clever. */
- - await_reply (AWAIT_QDRAIN, 0, NULL, 0);
- -
- - udp_transmit (IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER,
- - sizeof (struct bootpip_t), &ip);
- - timeout = rfc2131_sleep_interval (TIMEOUT, retry++);
- -#ifdef NO_DHCP_SUPPORT
- - if (await_reply (AWAIT_BOOTP, 0, NULL, timeout))
- - {
- - network_ready = 1;
- - return 1;
- - }
- -#else /* ! NO_DHCP_SUPPORT */
- - if (await_reply (AWAIT_BOOTP, 0, NULL, timeout))
- - {
- - if (dhcp_reply != DHCPOFFER)
- - {
- - network_ready = 1;
- - return 1;
- - }
- -
- - dhcp_reply = 0;
- -#ifdef DEBUG
- - etherboot_printf ("bp_op = %d\n", (int) ip.bp.bp_op);
- - etherboot_printf ("bp_htype = %d\n", (int) ip.bp.bp_htype);
- - etherboot_printf ("bp_hlen = %d\n", (int) ip.bp.bp_hlen);
- - etherboot_printf ("bp_xid = %d\n", (int) ip.bp.bp_xid);
- - etherboot_printf ("bp_hwaddr = %!\n", ip.bp.bp_hwaddr);
- - etherboot_printf ("bp_hops = %d\n", (int) ip.bp.bp_hops);
- - etherboot_printf ("bp_secs = %d\n", (int) ip.bp.bp_hwaddr);
- -#endif
- - grub_memmove (ip.bp.bp_vend, rfc1533_cookie, sizeof rfc1533_cookie);
- - grub_memmove (ip.bp.bp_vend + sizeof rfc1533_cookie,
- - dhcprequest, sizeof dhcprequest);
- - grub_memmove (ip.bp.bp_vend + sizeof rfc1533_cookie
- - + sizeof dhcprequest,
- - rfc1533_end, sizeof rfc1533_end);
- - grub_memmove (ip.bp.bp_vend + 9, (char *) &dhcp_server,
- - sizeof (in_addr));
- - grub_memmove (ip.bp.bp_vend + 15, (char *) &dhcp_addr,
- - sizeof (in_addr));
- -#ifdef DEBUG
- - grub_printf ("errnum = %d\n", errnum);
- -#endif
- - for (reqretry = 0; reqretry < MAX_BOOTP_RETRIES;)
- - {
- - int ret;
- -#ifdef DEBUG
- - grub_printf ("reqretry = %d\n", reqretry);
- -#endif
- -
- - ret = udp_transmit (IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER,
- - sizeof (struct bootpip_t), &ip);
- - if (! ret)
- - grub_printf ("udp_transmit failed.\n");
- -
- - dhcp_reply = 0;
- - timeout = rfc2131_sleep_interval (TIMEOUT, reqretry++);
- - if (await_reply (AWAIT_BOOTP, 0, NULL, timeout))
- - if (dhcp_reply == DHCPACK)
- - {
- - network_ready = 1;
- - return 1;
- - }
- -
- -#ifdef DEBUG
- - grub_printf ("dhcp_reply = %d\n", dhcp_reply);
- -#endif
- -
- - if (ip_abort)
- - return 0;
- - }
- - }
- -#endif /* ! NO_DHCP_SUPPORT */
- -
- - if (ip_abort)
- - return 0;
- -
- - ip.bp.bp_secs = htons ((currticks () - starttime) / TICKS_PER_SEC);
- - }
- -
- - /* Timeout. */
- - return 0;
- -}
- -
- -/**************************************************************************
- -UDPCHKSUM - Checksum UDP Packet (one of the rare cases when assembly is
- - actually simpler...)
- - RETURNS: checksum, 0 on checksum error. This
- - allows for using the same routine for RX and TX summing:
- - RX if (packet->udp.chksum && udpchksum(packet))
- - error("checksum error");
- - TX packet->udp.chksum=0;
- - if (0==(packet->udp.chksum=udpchksum(packet)))
- - packet->upd.chksum=0xffff;
- -**************************************************************************/
- -static inline void
- -dosum (unsigned short *start, unsigned int len, unsigned short *sum)
- -{
- - __asm__ __volatile__
- - ("clc\n"
- - "1:\tlodsw\n\t"
- - "xchg %%al,%%ah\n\t" /* convert to host byte order */
- - "adcw %%ax,%0\n\t" /* add carry of previous iteration */
- - "loop 1b\n\t"
- - "adcw $0,%0" /* add carry of last iteration */
- - : "=b" (*sum), "=S"(start), "=c"(len)
- - : "0"(*sum), "1"(start), "2"(len)
- - : "ax", "cc"
- - );
- -}
- -
- -/* UDP sum:
- - * proto, src_ip, dst_ip, udp_dport, udp_sport, 2*udp_len, payload
- - */
- -static unsigned short
- -udpchksum (struct iphdr *packet)
- -{
- - int len = ntohs (packet->len);
- - unsigned short rval;
- -
- - /* add udplength + protocol number */
- - rval = (len - sizeof (struct iphdr)) + IP_UDP;
- -
- - /* pad to an even number of bytes */
- - if (len % 2) {
- - ((char *) packet)[len++] = 0;
- - }
- -
- - /* sum over src/dst ipaddr + udp packet */
- - len -= (char *) &packet->src - (char *) packet;
- - dosum ((unsigned short *) &packet->src, len >> 1, &rval);
- -
- - /* take one's complement */
- - return ~rval;
- -}
- -
- -/**************************************************************************
- -AWAIT_REPLY - Wait until we get a response for our request
- -**************************************************************************/
- -int
- -await_reply (int type, int ival, void *ptr, int timeout)
- -{
- - unsigned long time;
- - struct iphdr *ip;
- - struct udphdr *udp;
- - struct arprequest *arpreply;
- - struct bootp_t *bootpreply;
- - unsigned short ptype;
- - unsigned int protohdrlen = (ETH_HLEN + sizeof (struct iphdr)
- - + sizeof (struct udphdr));
- -
- - /* Clear the abort flag. */
- - ip_abort = 0;
- -
- - time = timeout + currticks ();
- - /* The timeout check is done below. The timeout is only checked if
- - * there is no packet in the Rx queue. This assumes that eth_poll()
- - * needs a negligible amount of time. */
- - for (;;)
- - {
- - if (eth_poll ())
- - {
- - /* We have something! */
- -
- - /* Check for ARP - No IP hdr. */
- - if (nic.packetlen >= ETH_HLEN)
- - {
- - ptype = (((unsigned short) nic.packet[12]) << 8
- - | ((unsigned short) nic.packet[13]));
- - }
- - else
- - /* What else could we do with it? */
- - continue;
- -
- - if (nic.packetlen >= ETH_HLEN + sizeof (struct arprequest)
- - && ptype == ARP)
- - {
- - unsigned long tmp;
- -
- - arpreply = (struct arprequest *) &nic.packet[ETH_HLEN];
- -
- - if (arpreply->opcode == htons (ARP_REPLY)
- - && ! grub_memcmp (arpreply->sipaddr, ptr, sizeof (in_addr))
- - && type == AWAIT_ARP)
- - {
- - grub_memmove ((char *) arptable[ival].node,
- - arpreply->shwaddr,
- - ETH_ALEN);
- - return 1;
- - }
- -
- - grub_memmove ((char *) &tmp, arpreply->tipaddr,
- - sizeof (in_addr));
- -
- - if (arpreply->opcode == htons (ARP_REQUEST)
- - && tmp == arptable[ARP_CLIENT].ipaddr.s_addr)
- - {
- - arpreply->opcode = htons (ARP_REPLY);
- - grub_memmove (arpreply->tipaddr, arpreply->sipaddr,
- - sizeof (in_addr));
- - grub_memmove (arpreply->thwaddr, (char *) arpreply->shwaddr,
- - ETH_ALEN);
- - grub_memmove (arpreply->sipaddr,
- - (char *) &arptable[ARP_CLIENT].ipaddr,
- - sizeof (in_addr));
- - grub_memmove (arpreply->shwaddr,
- - arptable[ARP_CLIENT].node,
- - ETH_ALEN);
- - eth_transmit (arpreply->thwaddr, ARP,
- - sizeof (struct arprequest),
- - arpreply);
- -#ifdef MDEBUG
- - grub_memmove (&tmp, arpreply->tipaddr, sizeof (in_addr));
- - etherboot_printf ("Sent ARP reply to: %@\n", tmp);
- -#endif /* MDEBUG */
- - }
- -
- - continue;
- - }
- -
- - if (type == AWAIT_QDRAIN)
- - continue;
- -
- - /* Check for RARP - No IP hdr. */
- - if (type == AWAIT_RARP
- - && nic.packetlen >= ETH_HLEN + sizeof (struct arprequest)
- - && ptype == RARP)
- - {
- - arpreply = (struct arprequest *) &nic.packet[ETH_HLEN];
- -
- - if (arpreply->opcode == htons (RARP_REPLY)
- - && ! grub_memcmp (arpreply->thwaddr, ptr, ETH_ALEN))
- - {
- - grub_memmove ((char *) arptable[ARP_SERVER].node,
- - arpreply->shwaddr, ETH_ALEN);
- - grub_memmove ((char *) &arptable[ARP_SERVER].ipaddr,
- - arpreply->sipaddr, sizeof (in_addr));
- - grub_memmove ((char *) &arptable[ARP_CLIENT].ipaddr,
- - arpreply->tipaddr, sizeof (in_addr));
- - return 1;
- - }
- -
- - continue;
- - }
- -
- - /* Anything else has IP header. */
- - if (nic.packetlen < protohdrlen || ptype != IP)
- - continue;
- -
- - ip = (struct iphdr *) &nic.packet[ETH_HLEN];
- - if (ip->verhdrlen != 0x45
- - || ipchksum ((unsigned short *) ip, sizeof (struct iphdr))
- - || ip->protocol != IP_UDP)
- - continue;
- -
- - /*
- - - Till Straumann <Till.Straumann@TU-Berlin.de>
- - added udp checksum (safer on a wireless link)
- - added fragmentation check: I had a corrupted image
- - in memory due to fragmented TFTP packets - took me
- - 3 days to find the cause for this :-(
- - */
- -
- - /* If More Fragments bit and Fragment Offset field
- - are non-zero then packet is fragmented */
- - if (ip->frags & htons(0x3FFF))
- - {
- - grub_printf ("ALERT: got a fragmented packet - reconfigure your server\n");
- - continue;
- - }
- -
- - udp = (struct udphdr *) &nic.packet[(ETH_HLEN
- - + sizeof (struct iphdr))];
- - if (udp->chksum && udpchksum (ip))
- - {
- - grub_printf ("UDP checksum error\n");
- - continue;
- - }
- -
- - /* BOOTP ? */
- - bootpreply = (struct bootp_t *)
- - &nic.packet[(ETH_HLEN + sizeof (struct iphdr)
- - + sizeof (struct udphdr))];
- - if (type == AWAIT_BOOTP
- -#ifdef NO_DHCP_SUPPORT
- - && (nic.packetlen
- - >= (ETH_HLEN + sizeof (struct bootp_t) - BOOTP_VENDOR_LEN))
- -#else
- - && (nic.packetlen
- - >= (ETH_HLEN + sizeof (struct bootp_t) - DHCP_OPT_LEN))
- -#endif /* ! NO_DHCP_SUPPORT */
- - && udp->dest == htons (BOOTP_CLIENT)
- - && bootpreply->bp_op == BOOTP_REPLY
- - && bootpreply->bp_xid == xid
- - && (! grub_memcmp (broadcast, bootpreply->bp_hwaddr, ETH_ALEN)
- - || ! grub_memcmp (arptable[ARP_CLIENT].node,
- - bootpreply->bp_hwaddr, ETH_ALEN)))
- - {
- -#ifdef DEBUG
- - grub_printf ("BOOTP packet was received.\n");
- -#endif
- - arptable[ARP_CLIENT].ipaddr.s_addr
- - = bootpreply->bp_yiaddr.s_addr;
- -#ifndef NO_DHCP_SUPPORT
- - dhcp_addr.s_addr = bootpreply->bp_yiaddr.s_addr;
- -#ifdef DEBUG
- - etherboot_printf ("dhcp_addr = %@\n", dhcp_addr.s_addr);
- -#endif
- -#endif /* ! NO_DHCP_SUPPORT */
- - netmask = default_netmask ();
- - arptable[ARP_SERVER].ipaddr.s_addr
- - = bootpreply->bp_siaddr.s_addr;
- - /* Kill arp. */
- - grub_memset (arptable[ARP_SERVER].node, 0, ETH_ALEN);
- - arptable[ARP_GATEWAY].ipaddr.s_addr
- - = bootpreply->bp_giaddr.s_addr;
- - /* Kill arp. */
- - grub_memset (arptable[ARP_GATEWAY].node, 0, ETH_ALEN);
- -
- - grub_memmove ((char *) BOOTP_DATA_ADDR, (char *) bootpreply,
- - sizeof (struct bootpd_t));
- -#ifdef NO_DHCP_SUPPORT
- - decode_rfc1533 (BOOTP_DATA_ADDR->bootp_reply.bp_vend,
- - 0, BOOTP_VENDOR_LEN + MAX_BOOTP_EXTLEN, 1);
- -#else
- - decode_rfc1533 (BOOTP_DATA_ADDR->bootp_reply.bp_vend,
- - 0, DHCP_OPT_LEN + MAX_BOOTP_EXTLEN, 1);
- -#endif /* ! NO_DHCP_SUPPORT */
- -
- - return 1;
- - }
- -
- - /* TFTP ? */
- - if (type == AWAIT_TFTP && ntohs (udp->dest) == ival)
- - return 1;
- - }
- - else
- - {
- - /* Check for abort key only if the Rx queue is empty -
- - * as long as we have something to process, don't
- - * assume that something failed. It is unlikely that
- - * we have no processing time left between packets. */
- - if (checkkey () != -1 && ASCII_CHAR (getkey ()) == CTRL_C)
- - {
- - ip_abort = 1;
- - return 0;
- - }
- -
- - /* Do the timeout after at least a full queue walk. */
- - if ((timeout == 0) || (currticks() > time))
- - {
- - break;
- - }
- - }
- - }
- -
- - return 0;
- -}
- -
- -/**************************************************************************
- -DECODE_RFC1533 - Decodes RFC1533 header
- -**************************************************************************/
- -int
- -decode_rfc1533 (unsigned char *p, int block, int len, int eof)
- -{
- - static unsigned char *extdata = NULL, *extend = NULL;
- - unsigned char *extpath = NULL;
- - unsigned char *endp;
- -
- - if (block == 0)
- - {
- - end_of_rfc1533 = NULL;
- - vendorext_isvalid = 0;
- -
- - if (grub_memcmp (p, rfc1533_cookie, 4))
- - /* no RFC 1533 header found */
- - return 0;
- -
- - p += 4;
- - endp = p + len;
- - }
- - else
- - {
- - if (block == 1)
- - {
- - if (grub_memcmp (p, rfc1533_cookie, 4))
- - /* no RFC 1533 header found */
- - return 0;
- -
- - p += 4;
- - len -= 4;
- - }
- -
- - if (extend + len
- - <= ((unsigned char *)
- - &(BOOTP_DATA_ADDR->bootp_extension[MAX_BOOTP_EXTLEN])))
- - {
- - grub_memmove (extend, p, len);
- - extend += len;
- - }
- - else
- - {
- - grub_printf ("Overflow in vendor data buffer! Aborting...\n");
- - *extdata = RFC1533_END;
- - return 0;
- - }
- -
- - p = extdata;
- - endp = extend;
- - }
- -
- - if (! eof)
- - return -1;
- -
- - while (p < endp)
- - {
- - unsigned char c = *p;
- -
- - if (c == RFC1533_PAD)
- - {
- - p++;
- - continue;
- - }
- - else if (c == RFC1533_END)
- - {
- - end_of_rfc1533 = endp = p;
- - continue;
- - }
- - else if (c == RFC1533_NETMASK)
- - {
- - grub_memmove ((char *) &netmask, p + 2, sizeof (in_addr));
- - }
- - else if (c == RFC1533_GATEWAY)
- - {
- - /* This is a little simplistic, but it will
- - usually be sufficient.
- - Take only the first entry. */
- - if (TAG_LEN (p) >= sizeof (in_addr))
- - grub_memmove ((char *) &arptable[ARP_GATEWAY].ipaddr, p + 2,
- - sizeof (in_addr));
- - }
- - else if (c == RFC1533_EXTENSIONPATH)
- - extpath = p;
- -#ifndef NO_DHCP_SUPPORT
- - else if (c == RFC2132_MSG_TYPE)
- - {
- - dhcp_reply = *(p + 2);
- - }
- - else if (c == RFC2132_SRV_ID)
- - {
- - grub_memmove ((char *) &dhcp_server, p + 2, sizeof (in_addr));
- -#ifdef DEBUG
- - etherboot_printf ("dhcp_server = %@\n", dhcp_server.s_addr);
- -#endif
- - }
- -#endif /* ! NO_DHCP_SUPPORT */
- - else if (c == RFC1533_VENDOR_MAGIC
- - && TAG_LEN(p) >= 6
- - && ! grub_memcmp (p + 2, vendorext_magic, 4)
- - && p[6] == RFC1533_VENDOR_MAJOR)
- - vendorext_isvalid++;
- - /* GRUB now handles its own tag. Get the name of a configuration
- - file from the network. Cool... */
- - else if (c == RFC1533_VENDOR_CONFIGFILE)
- - {
- - int l = TAG_LEN (p);
- -
- - /* Eliminate the trailing NULs according to RFC 2132. */
- - while (*(p + 2 + l - 1) == '\000' && l > 0)
- - l--;
- -
- - /* XXX: Should check if LEN is less than the maximum length
- - of CONFIG_FILE. This kind of robustness will be a goal
- - in GRUB 1.0. */
- - grub_memmove (config_file, p + 2, l);
- - config_file[l] = 0;
- - }
- -
- - p += TAG_LEN (p) + 2;
- - }
- -
- - extdata = extend = endp;
- -
- - /* Perhaps we can eliminate this because we doesn't require so
- - much information, but I leave this alone. */
- - if (block == 0 && extpath != NULL)
- - {
- - char fname[64];
- - int fnamelen = TAG_LEN (extpath);
- -
- - while (*(extpath + 2 + fnamelen - 1) == '\000' && fnamelen > 0)
- - fnamelen--;
- -
- - if (fnamelen + 1 > sizeof (fname))
- - {
- - grub_printf ("Too long file name for Extensions Path\n");
- - return 0;
- - }
- - else if (! fnamelen)
- - {
- - grub_printf ("Empty file name for Extensions Path\n");
- - return 0;
- - }
- -
- - grub_memmove (fname, extpath + 2, fnamelen);
- - fname[fnamelen] = '\000';
- - grub_printf ("Loading BOOTP-extension file: %s\n", fname);
- - tftp (fname, decode_rfc1533);
- - }
- -
- - /* Proceed with next block. */
- - return -1;
- -}
- -
- -/**************************************************************************
- -IPCHKSUM - Checksum IP Header
- -**************************************************************************/
- -static unsigned short
- -ipchksum (unsigned short *ip, int len)
- -{
- - unsigned long sum = 0;
- - len >>= 1;
- - while (len--)
- - {
- - sum += *(ip++);
- - if (sum > 0xFFFF)
- - sum -= 0xFFFF;
- - }
- - return (~sum) & 0x0000FFFF;
- -}
- -
- -#define TWO_SECOND_DIVISOR (2147483647l/TICKS_PER_SEC)
- -
- -/**************************************************************************
- -RFC2131_SLEEP_INTERVAL - sleep for expotentially longer times
- -**************************************************************************/
- -long
- -rfc2131_sleep_interval (int base, int exp)
- -{
- - static long seed = 0;
- - long q;
- - unsigned long tmo;
- -
- -#ifdef BACKOFF_LIMIT
- - if (exp > BACKOFF_LIMIT)
- - exp = BACKOFF_LIMIT;
- -#endif
- - if (!seed)
- - /* Initialize linear congruential generator */
- - seed = (currticks () + *((long *) &arptable[ARP_CLIENT].node)
- - + ((short *) arptable[ARP_CLIENT].node)[2]);
- - /* simplified version of the LCG given in Bruce Schneier's
- - "Applied Cryptography" */
- - q = seed / 53668;
- - if ((seed = 40014 * (seed - 53668 * q) - 12211 *q ) < 0)
- - seed += 2147483563L;
- - tmo = (base << exp) + (TICKS_PER_SEC - (seed / TWO_SECOND_DIVISOR));
- - return tmo;
- -}
- -
- -/**************************************************************************
- -CLEANUP - shut down networking
- -**************************************************************************/
- -void
- -cleanup_net (void)
- -{
- - if (network_ready)
- - {
- - /* Stop receiving packets. */
- - eth_disable ();
- - network_ready = 0;
- - }
- -}
- diff -Naur grub-0.97.orig/netboot/mii.h grub-0.97/netboot/mii.h
- --- grub-0.97.orig/netboot/mii.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/mii.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,105 @@
- +/*
- + * linux/mii.h: definitions for MII-compatible transceivers
- + * Originally drivers/net/sunhme.h.
- + *
- + * Copyright (C) 1996, 1999, 2001 David S. Miller (davem@redhat.com)
- + *
- + * Copied Form Linux 2.4.25 an unneeded items removed by:
- + * Timothy Legge (timlegge at etherboot dot org)
- + *
- + * 03/26/2004
- + */
- +
- +/* Generic MII registers. */
- +
- +#define MII_BMCR 0x00 /* Basic mode control register */
- +#define MII_BMSR 0x01 /* Basic mode status register */
- +#define MII_PHYSID1 0x02 /* PHYS ID 1 */
- +#define MII_PHYSID2 0x03 /* PHYS ID 2 */
- +#define MII_ADVERTISE 0x04 /* Advertisement control reg */
- +#define MII_LPA 0x05 /* Link partner ability reg */
- +#define MII_EXPANSION 0x06 /* Expansion register */
- +#define MII_DCOUNTER 0x12 /* Disconnect counter */
- +#define MII_FCSCOUNTER 0x13 /* False carrier counter */
- +#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */
- +#define MII_RERRCOUNTER 0x15 /* Receive error counter */
- +#define MII_SREVISION 0x16 /* Silicon revision */
- +#define MII_RESV1 0x17 /* Reserved... */
- +#define MII_LBRERROR 0x18 /* Lpback, rx, bypass error */
- +#define MII_PHYADDR 0x19 /* PHY address */
- +#define MII_RESV2 0x1a /* Reserved... */
- +#define MII_TPISTATUS 0x1b /* TPI status for 10mbps */
- +#define MII_NCONFIG 0x1c /* Network interface config */
- +
- +/* Basic mode control register. */
- +#define BMCR_RESV 0x007f /* Unused... */
- +#define BMCR_CTST 0x0080 /* Collision test */
- +#define BMCR_FULLDPLX 0x0100 /* Full duplex */
- +#define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */
- +#define BMCR_ISOLATE 0x0400 /* Disconnect DP83840 from MII */
- +#define BMCR_PDOWN 0x0800 /* Powerdown the DP83840 */
- +#define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */
- +#define BMCR_SPEED100 0x2000 /* Select 100Mbps */
- +#define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */
- +#define BMCR_RESET 0x8000 /* Reset the DP83840 */
- +
- +/* Basic mode status register. */
- +#define BMSR_ERCAP 0x0001 /* Ext-reg capability */
- +#define BMSR_JCD 0x0002 /* Jabber detected */
- +#define BMSR_LSTATUS 0x0004 /* Link status */
- +#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */
- +#define BMSR_RFAULT 0x0010 /* Remote fault detected */
- +#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
- +#define BMSR_RESV 0x07c0 /* Unused... */
- +#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */
- +#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */
- +#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */
- +#define BMSR_100FULL 0x4000 /* Can do 100mbps, full-duplex */
- +#define BMSR_100BASE4 0x8000 /* Can do 100mbps, 4k packets */
- +
- +/* Advertisement control register. */
- +#define ADVERTISE_SLCT 0x001f /* Selector bits */
- +#define ADVERTISE_CSMA 0x0001 /* Only selector supported */
- +#define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */
- +#define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */
- +#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */
- +#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */
- +#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */
- +#define ADVERTISE_RESV 0x1c00 /* Unused... */
- +#define ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */
- +#define ADVERTISE_LPACK 0x4000 /* Ack link partners response */
- +#define ADVERTISE_NPAGE 0x8000 /* Next page bit */
- +
- +#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
- + ADVERTISE_CSMA)
- +#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
- + ADVERTISE_100HALF | ADVERTISE_100FULL)
- +
- +/* Link partner ability register. */
- +#define LPA_SLCT 0x001f /* Same as advertise selector */
- +#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */
- +#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */
- +#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */
- +#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */
- +#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */
- +#define LPA_RESV 0x1c00 /* Unused... */
- +#define LPA_RFAULT 0x2000 /* Link partner faulted */
- +#define LPA_LPACK 0x4000 /* Link partner acked us */
- +#define LPA_NPAGE 0x8000 /* Next page bit */
- +
- +#define LPA_DUPLEX (LPA_10FULL | LPA_100FULL)
- +#define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4)
- +
- +/* Expansion register for auto-negotiation. */
- +#define EXPANSION_NWAY 0x0001 /* Can do N-way auto-nego */
- +#define EXPANSION_LCWP 0x0002 /* Got new RX page code word */
- +#define EXPANSION_ENABLENPAGE 0x0004 /* This enables npage words */
- +#define EXPANSION_NPCAPABLE 0x0008 /* Link partner supports npage */
- +#define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */
- +#define EXPANSION_RESV 0xffe0 /* Unused... */
- +
- +/* N-way test register. */
- +#define NWAYTEST_RESV1 0x00ff /* Unused... */
- +#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */
- +#define NWAYTEST_RESV2 0xfe00 /* Unused... */
- +
- diff -Naur grub-0.97.orig/netboot/misc.c grub-0.97/netboot/misc.c
- --- grub-0.97.orig/netboot/misc.c 2003-07-09 11:45:37.000000000 +0000
- +++ grub-0.97/netboot/misc.c 2005-08-31 19:03:35.000000000 +0000
- @@ -19,37 +19,90 @@
-
- /* Based on "src/misc.c" in etherboot-5.0.5. */
-
- -#define GRUB 1
- -#include <etherboot.h>
- +#include "grub.h"
- +#include "timer.h"
-
- -void
- -sleep (int secs)
- +#include "nic.h"
- +
- +/**************************************************************************
- +RANDOM - compute a random number between 0 and 2147483647L or 2147483562?
- +**************************************************************************/
- +int32_t random(void)
- {
- - unsigned long tmo = currticks () + secs;
- + static int32_t seed = 0;
- + int32_t q;
- + if (!seed) /* Initialize linear congruential generator */
- + seed = currticks() + *(int32_t *)&arptable[ARP_CLIENT].node
- + + ((int16_t *)arptable[ARP_CLIENT].node)[2];
- + /* simplified version of the LCG given in Bruce Schneier's
- + "Applied Cryptography" */
- + q = seed/53668;
- + if ((seed = 40014*(seed-53668*q) - 12211*q) < 0) seed += 2147483563L;
- + return seed;
- +}
-
- - while (currticks () < tmo)
- - ;
- +/**************************************************************************
- +POLL INTERRUPTIONS
- +**************************************************************************/
- +void poll_interruptions(void)
- +{
- + if (checkkey() != -1 && ASCII_CHAR(getkey()) == K_INTR) {
- + user_abort++;
- + }
- }
-
- -void
- -twiddle (void)
- +/**************************************************************************
- +SLEEP
- +**************************************************************************/
- +void sleep(int secs)
- {
- - static unsigned long lastticks = 0;
- - static int count = 0;
- - static const char tiddles[]="-\\|/";
- - unsigned long ticks;
- + unsigned long tmo;
-
- - if (debug)
- - {
- - if ((ticks = currticks ()) == lastticks)
- - return;
- -
- - lastticks = ticks;
- - grub_putchar (tiddles[(count++) & 3]);
- - grub_putchar ('\b');
- - }
- + for (tmo = currticks()+secs*TICKS_PER_SEC; currticks() < tmo; ) {
- + poll_interruptions();
- + }
- +}
- +
- +/**************************************************************************
- +INTERRUPTIBLE SLEEP
- +**************************************************************************/
- +void interruptible_sleep(int secs)
- +{
- + printf("<sleep>\n");
- + return sleep(secs);
- +}
- +
- +/**************************************************************************
- +TWIDDLE
- +**************************************************************************/
- +void twiddle(void)
- +{
- +#ifdef BAR_PROGRESS
- + static int count=0;
- + static const char tiddles[]="-\\|/";
- + static unsigned long lastticks = 0;
- + unsigned long ticks;
- +#endif
- +#ifdef FREEBSD_PXEEMU
- + extern char pxeemu_nbp_active;
- + if(pxeemu_nbp_active != 0)
- + return;
- +#endif
- +#ifdef BAR_PROGRESS
- + /* Limit the maximum rate at which characters are printed */
- + ticks = currticks();
- + if ((lastticks + (TICKS_PER_SEC/18)) > ticks)
- + return;
- + lastticks = ticks;
- +
- + putchar(tiddles[(count++)&3]);
- + putchar('\b');
- +#else
- + //putchar('.');
- +#endif /* BAR_PROGRESS */
- }
-
- +
- /* Because Etherboot uses its own formats for the printf family,
- define separate definitions from GRUB. */
- /**************************************************************************
- @@ -264,3 +317,5 @@
-
- return ret;
- }
- +
- +
- diff -Naur grub-0.97.orig/netboot/natsemi.c grub-0.97/netboot/natsemi.c
- --- grub-0.97.orig/netboot/natsemi.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/natsemi.c 2005-08-31 19:53:07.000000000 +0000
- @@ -47,15 +47,15 @@
- /* Revision History */
-
- /*
- + 13 Dec 2003 timlegge 1.1 Enabled Multicast Support
- 29 May 2001 mdc 1.0
- Initial Release. Tested with Netgear FA311 and FA312 boards
- -*/
- +*/
- /* Includes */
-
- #include "etherboot.h"
- #include "nic.h"
- #include "pci.h"
- -#include "cards.h"
-
- /* defines */
-
- @@ -71,21 +71,18 @@
-
- #define NUM_RX_DESC 4 /* Number of Rx descriptor registers. */
-
- -typedef unsigned char u8;
- -typedef signed char s8;
- -typedef unsigned short u16;
- -typedef signed short s16;
- -typedef unsigned int u32;
- -typedef signed int s32;
- +typedef uint8_t u8;
- +typedef int8_t s8;
- +typedef uint16_t u16;
- +typedef int16_t s16;
- +typedef uint32_t u32;
- +typedef int32_t s32;
-
- /* helpful macroes if on a big_endian machine for changing byte order.
- not strictly needed on Intel */
- -#define le16_to_cpu(val) (val)
- -#define cpu_to_le32(val) (val)
- #define get_unaligned(ptr) (*(ptr))
- #define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
- #define get_u16(ptr) (*(u16 *)(ptr))
- -#define virt_to_bus(x) ((unsigned long)x)
- #define virt_to_le32desc(addr) virt_to_bus(addr)
-
- enum pcistuff {
- @@ -161,7 +158,8 @@
- AcceptMulticast = 0x00200000,
- AcceptAllMulticast = 0x20000000,
- AcceptAllPhys = 0x10000000,
- - AcceptMyPhys = 0x08000000
- + AcceptMyPhys = 0x08000000,
- + RxFilterEnable = 0x80000000
- };
-
- typedef struct _BufferDesc {
- @@ -207,17 +205,12 @@
- static BufferDesc txd __attribute__ ((aligned(4)));
- static BufferDesc rxd[NUM_RX_DESC] __attribute__ ((aligned(4)));
-
- -#ifdef USE_LOWMEM_BUFFER
- -#define txb ((char *)0x10000 - TX_BUF_SIZE)
- -#define rxb ((char *)0x10000 - NUM_RX_DESC*RX_BUF_SIZE - TX_BUF_SIZE)
- -#else
- static unsigned char txb[TX_BUF_SIZE] __attribute__ ((aligned(4)));
- static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE] __attribute__ ((aligned(4)));
- -#endif
-
- /* Function Prototypes */
-
- -struct nic *natsemi_probe(struct nic *nic, unsigned short *io_addrs, struct pci_device *pci);
- +static int natsemi_probe(struct dev *dev, struct pci_device *pci);
- static int eeprom_read(long addr, int location);
- static int mdio_read(int phy_id, int location);
- static void natsemi_init(struct nic *nic);
- @@ -228,8 +221,9 @@
- static void natsemi_set_rx_mode(struct nic *nic);
- static void natsemi_check_duplex(struct nic *nic);
- static void natsemi_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p);
- -static int natsemi_poll(struct nic *nic);
- -static void natsemi_disable(struct nic *nic);
- +static int natsemi_poll(struct nic *nic, int retrieve);
- +static void natsemi_disable(struct dev *dev);
- +static void natsemi_irq(struct nic *nic, irq_action_t action);
-
- /*
- * Function: natsemi_probe
- @@ -245,24 +239,28 @@
- * Returns: struct nic *: pointer to NIC data structure
- */
-
- -struct nic *
- -natsemi_probe(struct nic *nic, unsigned short *io_addrs, struct pci_device *pci)
- +static int
- +natsemi_probe(struct dev *dev, struct pci_device *pci)
- {
- + struct nic *nic = (struct nic *)dev;
- int i;
- int prev_eedata;
- u32 tmp;
-
- - if (io_addrs == 0 || *io_addrs == 0)
- - return NULL;
- + if (pci->ioaddr == 0)
- + return 0;
- +
- + adjust_pci_device(pci);
-
- /* initialize some commonly used globals */
-
- - ioaddr = *io_addrs & ~3;
- + nic->irqno = 0;
- + nic->ioaddr = pci->ioaddr & ~3;
- +
- + ioaddr = pci->ioaddr & ~3;
- vendor = pci->vendor;
- dev_id = pci->dev_id;
- nic_name = pci->name;
- -
- - adjust_pci_device(pci);
-
- /* natsemi has a non-standard PM control register
- * in PCI config space. Some boards apparently need
- @@ -317,12 +315,12 @@
- /* initialize device */
- natsemi_init(nic);
-
- - nic->reset = natsemi_init;
- + dev->disable = natsemi_disable;
- nic->poll = natsemi_poll;
- nic->transmit = natsemi_transmit;
- - nic->disable = natsemi_disable;
- + nic->irq = natsemi_irq;
-
- - return nic;
- + return 1;
- }
-
- /* Read the EEPROM and MII Management Data I/O (MDIO) interfaces.
- @@ -452,7 +450,7 @@
- * Returns: void.
- */
- static void
- -natsemi_reset(struct nic *nic)
- +natsemi_reset(struct nic *nic __unused)
- {
- outl(ChipReset, ioaddr + ChipCmd);
-
- @@ -504,14 +502,14 @@
- */
-
- static void
- -natsemi_init_txd(struct nic *nic)
- +natsemi_init_txd(struct nic *nic __unused)
- {
- txd.link = (u32) 0;
- txd.cmdsts = (u32) 0;
- - txd.bufptr = (u32) &txb[0];
- + txd.bufptr = virt_to_bus(&txb[0]);
-
- /* load Transmit Descriptor Register */
- - outl((u32) &txd, ioaddr + TxRingPtr);
- + outl(virt_to_bus(&txd), ioaddr + TxRingPtr);
- if (natsemi_debug > 1)
- printf("natsemi_init_txd: TX descriptor register loaded with: %X\n",
- inl(ioaddr + TxRingPtr));
- @@ -527,7 +525,7 @@
- */
-
- static void
- -natsemi_init_rxd(struct nic *nic)
- +natsemi_init_rxd(struct nic *nic __unused)
- {
- int i;
-
- @@ -535,16 +533,16 @@
-
- /* init RX descriptor */
- for (i = 0; i < NUM_RX_DESC; i++) {
- - rxd[i].link = (i+1 < NUM_RX_DESC) ? (u32) &rxd[i+1] : (u32) &rxd[0];
- + rxd[i].link = virt_to_bus((i+1 < NUM_RX_DESC) ? &rxd[i+1] : &rxd[0]);
- rxd[i].cmdsts = (u32) RX_BUF_SIZE;
- - rxd[i].bufptr = (u32) &rxb[i*RX_BUF_SIZE];
- + rxd[i].bufptr = virt_to_bus(&rxb[i*RX_BUF_SIZE]);
- if (natsemi_debug > 1)
- printf("natsemi_init_rxd: rxd[%d]=%X link=%X cmdsts=%X bufptr=%X\n",
- i, &rxd[i], rxd[i].link, rxd[i].cmdsts, rxd[i].bufptr);
- }
-
- /* load Receive Descriptor Register */
- - outl((u32) &rxd[0], ioaddr + RxRingPtr);
- + outl(virt_to_bus(&rxd[0]), ioaddr + RxRingPtr);
-
- if (natsemi_debug > 1)
- printf("natsemi_init_rxd: RX descriptor register loaded with: %X\n",
- @@ -562,14 +560,15 @@
- * Returns: void.
- */
-
- -static void natsemi_set_rx_mode(struct nic *nic)
- +static void natsemi_set_rx_mode(struct nic *nic __unused)
- {
- - u32 rx_mode = AcceptBroadcast | AcceptMyPhys;
- + u32 rx_mode = RxFilterEnable | AcceptBroadcast |
- + AcceptAllMulticast | AcceptMyPhys;
-
- outl(rx_mode, ioaddr + RxFilterAddr);
- }
-
- -static void natsemi_check_duplex(struct nic *nic)
- +static void natsemi_check_duplex(struct nic *nic __unused)
- {
- int duplex = inl(ioaddr + ChipConfig) & 0x20000000 ? 1 : 0;
-
- @@ -607,14 +606,14 @@
- unsigned int s, /* size */
- const char *p) /* Packet */
- {
- - u32 status, to, nstype;
- + u32 to, nstype;
- u32 tx_status;
-
- /* Stop the transmitter */
- outl(TxOff, ioaddr + ChipCmd);
-
- /* load Transmit Descriptor Register */
- - outl((u32) &txd, ioaddr + TxRingPtr);
- + outl(virt_to_bus(&txd), ioaddr + TxRingPtr);
- if (natsemi_debug > 1)
- printf("natsemi_transmit: TX descriptor register loaded with: %X\n",
- inl(ioaddr + TxRingPtr));
- @@ -636,7 +635,7 @@
- txb[s++] = '\0';
-
- /* set the transmit buffer descriptor and enable Transmit State Machine */
- - txd.bufptr = (u32) &txb[0];
- + txd.bufptr = virt_to_bus(&txb[0]);
- txd.cmdsts = (u32) OWN | s;
-
- /* restart the transmitter */
- @@ -647,7 +646,7 @@
-
- to = currticks() + TX_TIMEOUT;
-
- - while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() < to))
- + while ((volatile u32) ( tx_status=txd.cmdsts & OWN) && (currticks() < to))
- /* wait */ ;
-
- if (currticks() >= to) {
- @@ -674,7 +673,7 @@
- */
-
- static int
- -natsemi_poll(struct nic *nic)
- +natsemi_poll(struct nic *nic, int retrieve)
- {
- u32 rx_status = rxd[cur_rx].cmdsts;
- int retstat = 0;
- @@ -685,6 +684,8 @@
- if (!(rx_status & OWN))
- return retstat;
-
- + if ( ! retrieve ) return 1;
- +
- if (natsemi_debug > 1)
- printf("natsemi_poll: got a packet: cur_rx:%d, status:%X\n",
- cur_rx, rx_status);
- @@ -704,7 +705,7 @@
-
- /* return the descriptor and buffer to receive ring */
- rxd[cur_rx].cmdsts = RX_BUF_SIZE;
- - rxd[cur_rx].bufptr = (u32) &rxb[cur_rx*RX_BUF_SIZE];
- + rxd[cur_rx].bufptr = virt_to_bus(&rxb[cur_rx*RX_BUF_SIZE]);
-
- if (++cur_rx == NUM_RX_DESC)
- cur_rx = 0;
- @@ -725,8 +726,12 @@
- */
-
- static void
- -natsemi_disable(struct nic *nic)
- +natsemi_disable(struct dev *dev)
- {
- + struct nic *nic = (struct nic *)dev;
- + /* merge reset and disable */
- + natsemi_init(nic);
- +
- /* Disable interrupts using the mask. */
- outl(0, ioaddr + IntrMask);
- outl(0, ioaddr + IntrEnable);
- @@ -737,3 +742,39 @@
- /* Restore PME enable bit */
- outl(SavedClkRun, ioaddr + ClkRun);
- }
- +
- +/* Function: natsemi_irq
- + *
- + * Description: Enable, Disable, or Force interrupts
- + *
- + * Arguments: struct nic *nic: NIC data structure
- + * irq_action_t action: requested action to perform
- + *
- + * Returns: void.
- + */
- +
- +static void
- +natsemi_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
- +
- +static struct pci_id natsemi_nics[] = {
- +PCI_ROM(0x100b, 0x0020, "dp83815", "DP83815"),
- +};
- +
- +struct pci_driver natsemi_driver = {
- + .type = NIC_DRIVER,
- + .name = "NATSEMI",
- + .probe = natsemi_probe,
- + .ids = natsemi_nics,
- + .id_count = sizeof(natsemi_nics)/sizeof(natsemi_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/nfs.h grub-0.97/netboot/nfs.h
- --- grub-0.97.orig/netboot/nfs.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/nfs.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,63 @@
- +#ifndef _NFS_H
- +#define _NFS_H
- +
- +#define SUNRPC_PORT 111
- +
- +#define PROG_PORTMAP 100000
- +#define PROG_NFS 100003
- +#define PROG_MOUNT 100005
- +
- +#define MSG_CALL 0
- +#define MSG_REPLY 1
- +
- +#define PORTMAP_GETPORT 3
- +
- +#define MOUNT_ADDENTRY 1
- +#define MOUNT_UMOUNTALL 4
- +
- +#define NFS_LOOKUP 4
- +#define NFS_READLINK 5
- +#define NFS_READ 6
- +
- +#define NFS_FHSIZE 32
- +
- +#define NFSERR_PERM 1
- +#define NFSERR_NOENT 2
- +#define NFSERR_ACCES 13
- +#define NFSERR_ISDIR 21
- +#define NFSERR_INVAL 22
- +
- +/* Block size used for NFS read accesses. A RPC reply packet (including all
- + * headers) must fit within a single Ethernet frame to avoid fragmentation.
- + * Chosen to be a power of two, as most NFS servers are optimized for this. */
- +#define NFS_READ_SIZE 1024
- +
- +#define NFS_MAXLINKDEPTH 16
- +
- +struct rpc_t {
- + struct iphdr ip;
- + struct udphdr udp;
- + union {
- + uint8_t data[300]; /* longest RPC call must fit!!!! */
- + struct {
- + uint32_t id;
- + uint32_t type;
- + uint32_t rpcvers;
- + uint32_t prog;
- + uint32_t vers;
- + uint32_t proc;
- + uint32_t data[1];
- + } call;
- + struct {
- + uint32_t id;
- + uint32_t type;
- + uint32_t rstatus;
- + uint32_t verifier;
- + uint32_t v2;
- + uint32_t astatus;
- + uint32_t data[1];
- + } reply;
- + } u;
- +};
- +
- +#endif /* _NFS_H */
- diff -Naur grub-0.97.orig/netboot/ni5010.c grub-0.97/netboot/ni5010.c
- --- grub-0.97.orig/netboot/ni5010.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/ni5010.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,371 +0,0 @@
- -/**************************************************************************
- -Etherboot - BOOTP/TFTP Bootstrap Program
- -Driver for NI5010.
- -Code freely taken from Jan-Pascal van Best and Andreas Mohr's
- -Linux NI5010 driver.
- -***************************************************************************/
- -
- -/*
- - * This program is free software; you can redistribute it and/or
- - * modify it under the terms of the GNU General Public License as
- - * published by the Free Software Foundation; either version 2, or (at
- - * your option) any later version.
- - */
- -
- -/* to get some global routines like printf */
- -#include "etherboot.h"
- -/* to get the interface to the body of the program */
- -#include "nic.h"
- -/* to get our own prototype */
- -#include "cards.h"
- -
- -/* ni5010.h file included verbatim */
- -/*
- - * Racal-Interlan ni5010 Ethernet definitions
- - *
- - * This is an extension to the Linux operating system, and is covered by the
- - * same Gnu Public License that covers that work.
- - *
- - * copyrights (c) 1996 by Jan-Pascal van Best (jvbest@wi.leidenuniv.nl)
- - *
- - * I have done a look in the following sources:
- - * crynwr-packet-driver by Russ Nelson
- - */
- -
- -#define NI5010_BUFSIZE 2048 /* number of bytes in a buffer */
- -
- -#define NI5010_MAGICVAL0 0x00 /* magic-values for ni5010 card */
- -#define NI5010_MAGICVAL1 0x55
- -#define NI5010_MAGICVAL2 0xAA
- -
- -#define SA_ADDR0 0x02
- -#define SA_ADDR1 0x07
- -#define SA_ADDR2 0x01
- -
- -/* The number of low I/O ports used by the ni5010 ethercard. */
- -#define NI5010_IO_EXTENT 32
- -
- -#define PRINTK(x) if (NI5010_DEBUG) printk x
- -#define PRINTK2(x) if (NI5010_DEBUG>=2) printk x
- -#define PRINTK3(x) if (NI5010_DEBUG>=3) printk x
- -
- -/* The various IE command registers */
- -#define EDLC_XSTAT (ioaddr + 0x00) /* EDLC transmit csr */
- -#define EDLC_XCLR (ioaddr + 0x00) /* EDLC transmit "Clear IRQ" */
- -#define EDLC_XMASK (ioaddr + 0x01) /* EDLC transmit "IRQ Masks" */
- -#define EDLC_RSTAT (ioaddr + 0x02) /* EDLC receive csr */
- -#define EDLC_RCLR (ioaddr + 0x02) /* EDLC receive "Clear IRQ" */
- -#define EDLC_RMASK (ioaddr + 0x03) /* EDLC receive "IRQ Masks" */
- -#define EDLC_XMODE (ioaddr + 0x04) /* EDLC transmit Mode */
- -#define EDLC_RMODE (ioaddr + 0x05) /* EDLC receive Mode */
- -#define EDLC_RESET (ioaddr + 0x06) /* EDLC RESET register */
- -#define EDLC_TDR1 (ioaddr + 0x07) /* "Time Domain Reflectometry" reg1 */
- -#define EDLC_ADDR (ioaddr + 0x08) /* EDLC station address, 6 bytes */
- - /* 0x0E doesn't exist for r/w */
- -#define EDLC_TDR2 (ioaddr + 0x0f) /* "Time Domain Reflectometry" reg2 */
- -#define IE_GP (ioaddr + 0x10) /* GP pointer (word register) */
- - /* 0x11 is 2nd byte of GP Pointer */
- -#define IE_RCNT (ioaddr + 0x10) /* Count of bytes in rcv'd packet */
- - /* 0x11 is 2nd byte of "Byte Count" */
- -#define IE_MMODE (ioaddr + 0x12) /* Memory Mode register */
- -#define IE_DMA_RST (ioaddr + 0x13) /* IE DMA Reset. write only */
- -#define IE_ISTAT (ioaddr + 0x13) /* IE Interrupt Status. read only */
- -#define IE_RBUF (ioaddr + 0x14) /* IE Receive Buffer port */
- -#define IE_XBUF (ioaddr + 0x15) /* IE Transmit Buffer port */
- -#define IE_SAPROM (ioaddr + 0x16) /* window on station addr prom */
- -#define IE_RESET (ioaddr + 0x17) /* any write causes Board Reset */
- -
- -/* bits in EDLC_XSTAT, interrupt clear on write, status when read */
- -#define XS_TPOK 0x80 /* transmit packet successful */
- -#define XS_CS 0x40 /* carrier sense */
- -#define XS_RCVD 0x20 /* transmitted packet received */
- -#define XS_SHORT 0x10 /* transmission media is shorted */
- -#define XS_UFLW 0x08 /* underflow. iff failed board */
- -#define XS_COLL 0x04 /* collision occurred */
- -#define XS_16COLL 0x02 /* 16th collision occurred */
- -#define XS_PERR 0x01 /* parity error */
- -
- -#define XS_CLR_UFLW 0x08 /* clear underflow */
- -#define XS_CLR_COLL 0x04 /* clear collision */
- -#define XS_CLR_16COLL 0x02 /* clear 16th collision */
- -#define XS_CLR_PERR 0x01 /* clear parity error */
- -
- -/* bits in EDLC_XMASK, mask/enable transmit interrupts. register is r/w */
- -#define XM_TPOK 0x80 /* =1 to enable Xmt Pkt OK interrupts */
- -#define XM_RCVD 0x20 /* =1 to enable Xmt Pkt Rcvd ints */
- -#define XM_UFLW 0x08 /* =1 to enable Xmt Underflow ints */
- -#define XM_COLL 0x04 /* =1 to enable Xmt Collision ints */
- -#define XM_COLL16 0x02 /* =1 to enable Xmt 16th Coll ints */
- -#define XM_PERR 0x01 /* =1 to enable Xmt Parity Error ints */
- - /* note: always clear this bit */
- -#define XM_ALL (XM_TPOK | XM_RCVD | XM_UFLW | XM_COLL | XM_COLL16)
- -
- -/* bits in EDLC_RSTAT, interrupt clear on write, status when read */
- -#define RS_PKT_OK 0x80 /* received good packet */
- -#define RS_RST_PKT 0x10 /* RESET packet received */
- -#define RS_RUNT 0x08 /* Runt Pkt rcvd. Len < 64 Bytes */
- -#define RS_ALIGN 0x04 /* Alignment error. not 8 bit aligned */
- -#define RS_CRC_ERR 0x02 /* Bad CRC on rcvd pkt */
- -#define RS_OFLW 0x01 /* overflow for rcv FIFO */
- -#define RS_VALID_BITS ( RS_PKT_OK | RS_RST_PKT | RS_RUNT | RS_ALIGN | RS_CRC_ERR | RS_OFLW )
- - /* all valid RSTAT bits */
- -
- -#define RS_CLR_PKT_OK 0x80 /* clear rcvd packet interrupt */
- -#define RS_CLR_RST_PKT 0x10 /* clear RESET packet received */
- -#define RS_CLR_RUNT 0x08 /* clear Runt Pckt received */
- -#define RS_CLR_ALIGN 0x04 /* clear Alignment error */
- -#define RS_CLR_CRC_ERR 0x02 /* clear CRC error */
- -#define RS_CLR_OFLW 0x01 /* clear rcv FIFO Overflow */
- -
- -/* bits in EDLC_RMASK, mask/enable receive interrupts. register is r/w */
- -#define RM_PKT_OK 0x80 /* =1 to enable rcvd good packet ints */
- -#define RM_RST_PKT 0x10 /* =1 to enable RESET packet ints */
- -#define RM_RUNT 0x08 /* =1 to enable Runt Pkt rcvd ints */
- -#define RM_ALIGN 0x04 /* =1 to enable Alignment error ints */
- -#define RM_CRC_ERR 0x02 /* =1 to enable Bad CRC error ints */
- -#define RM_OFLW 0x01 /* =1 to enable overflow error ints */
- -
- -/* bits in EDLC_RMODE, set Receive Packet mode. register is r/w */
- -#define RMD_TEST 0x80 /* =1 for Chip testing. normally 0 */
- -#define RMD_ADD_SIZ 0x10 /* =1 5-byte addr match. normally 0 */
- -#define RMD_EN_RUNT 0x08 /* =1 enable runt rcv. normally 0 */
- -#define RMD_EN_RST 0x04 /* =1 to rcv RESET pkt. normally 0 */
- -
- -#define RMD_PROMISC 0x03 /* receive *all* packets. unusual */
- -#define RMD_MULTICAST 0x02 /* receive multicasts too. unusual */
- -#define RMD_BROADCAST 0x01 /* receive broadcasts & normal. usual */
- -#define RMD_NO_PACKETS 0x00 /* don't receive any packets. unusual */
- -
- -/* bits in EDLC_XMODE, set Transmit Packet mode. register is r/w */
- -#define XMD_COLL_CNT 0xf0 /* coll's since success. read-only */
- -#define XMD_IG_PAR 0x08 /* =1 to ignore parity. ALWAYS set */
- -#define XMD_T_MODE 0x04 /* =1 to power xcvr. ALWAYS set this */
- -#define XMD_LBC 0x02 /* =1 for loopback. normally set */
- -#define XMD_DIS_C 0x01 /* =1 disables contention. normally 0 */
- -
- -/* bits in EDLC_RESET, write only */
- -#define RS_RESET 0x80 /* =1 to hold EDLC in reset state */
- -
- -/* bits in IE_MMODE, write only */
- -#define MM_EN_DMA 0x80 /* =1 begin DMA xfer, Cplt clrs it */
- -#define MM_EN_RCV 0x40 /* =1 allows Pkt rcv. clr'd by rcv */
- -#define MM_EN_XMT 0x20 /* =1 begin Xmt pkt. Cplt clrs it */
- -#define MM_BUS_PAGE 0x18 /* =00 ALWAYS. Used when MUX=1 */
- -#define MM_NET_PAGE 0x06 /* =00 ALWAYS. Used when MUX=0 */
- -#define MM_MUX 0x01 /* =1 means Rcv Buff on system bus */
- - /* =0 means Xmt Buff on system bus */
- -
- -/* bits in IE_ISTAT, read only */
- -#define IS_TDIAG 0x80 /* =1 if Diagnostic problem */
- -#define IS_EN_RCV 0x20 /* =1 until frame is rcv'd cplt */
- -#define IS_EN_XMT 0x10 /* =1 until frame is xmt'd cplt */
- -#define IS_EN_DMA 0x08 /* =1 until DMA is cplt or aborted */
- -#define IS_DMA_INT 0x04 /* =0 iff DMA done interrupt. */
- -#define IS_R_INT 0x02 /* =0 iff unmasked Rcv interrupt */
- -#define IS_X_INT 0x01 /* =0 iff unmasked Xmt interrupt */
- -
- -/* NIC specific static variables go here */
- -
- -static unsigned short ioaddr = 0;
- -static unsigned int bufsize_rcv = 0;
- -
- -#if 0
- -static void show_registers(void)
- -{
- - printf("XSTAT %hhX ", inb(EDLC_XSTAT));
- - printf("XMASK %hhX ", inb(EDLC_XMASK));
- - printf("RSTAT %hhX ", inb(EDLC_RSTAT));
- - printf("RMASK %hhX ", inb(EDLC_RMASK));
- - printf("RMODE %hhX ", inb(EDLC_RMODE));
- - printf("XMODE %hhX ", inb(EDLC_XMODE));
- - printf("ISTAT %hhX\n", inb(IE_ISTAT));
- -}
- -#endif
- -
- -static void reset_receiver(void)
- -{
- - outw(0, IE_GP); /* Receive packet at start of buffer */
- - outb(RS_VALID_BITS, EDLC_RCLR); /* Clear all pending Rcv interrupts */
- - outb(MM_EN_RCV, IE_MMODE); /* Enable rcv */
- -}
- -
- -/**************************************************************************
- -RESET - Reset adapter
- -***************************************************************************/
- -static void ni5010_reset(struct nic *nic)
- -{
- - int i;
- -
- - /* Reset the hardware here. Don't forget to set the station address. */
- - outb(RS_RESET, EDLC_RESET); /* Hold up EDLC_RESET while configing board */
- - outb(0, IE_RESET); /* Hardware reset of ni5010 board */
- - outb(0, EDLC_XMASK); /* Disable all Xmt interrupts */
- - outb(0, EDLC_RMASK); /* Disable all Rcv interrupt */
- - outb(0xFF, EDLC_XCLR); /* Clear all pending Xmt interrupts */
- - outb(0xFF, EDLC_RCLR); /* Clear all pending Rcv interrupts */
- - outb(XMD_LBC, EDLC_XMODE); /* Only loopback xmits */
- - /* Set the station address */
- - for(i = 0; i < ETH_ALEN; i++)
- - outb(nic->node_addr[i], EDLC_ADDR + i);
- - outb(XMD_IG_PAR | XMD_T_MODE | XMD_LBC, EDLC_XMODE);
- - /* Normal packet xmit mode */
- - outb(RMD_BROADCAST, EDLC_RMODE);
- - /* Receive broadcast and normal packets */
- - reset_receiver();
- - outb(0x00, EDLC_RESET); /* Un-reset the ni5010 */
- -}
- -
- -/**************************************************************************
- -POLL - Wait for a frame
- -***************************************************************************/
- -static int ni5010_poll(struct nic *nic)
- -{
- - int rcv_stat;
- -
- - if (((rcv_stat = inb(EDLC_RSTAT)) & RS_VALID_BITS) != RS_PKT_OK) {
- - outb(rcv_stat, EDLC_RSTAT); /* Clear the status */
- - return (0);
- - }
- - outb(rcv_stat, EDLC_RCLR); /* Clear the status */
- - nic->packetlen = inw(IE_RCNT);
- - /* Read packet into buffer */
- - outb(MM_MUX, IE_MMODE); /* Rcv buffer to system bus */
- - outw(0, IE_GP); /* Seek to beginning of packet */
- - insb(IE_RBUF, nic->packet, nic->packetlen);
- - return (1);
- -}
- -
- -/**************************************************************************
- -TRANSMIT - Transmit a frame
- -***************************************************************************/
- -static void ni5010_transmit(struct nic *nic,
- - const char *d, /* Destination */
- - unsigned int t, /* Type */
- - unsigned int s, /* size */
- - const char *p) /* Packet */
- -{
- - unsigned int len;
- - int buf_offs, xmt_stat;
- - unsigned long time;
- -
- - len = s + ETH_HLEN;
- - if (len < ETH_ZLEN)
- - len = ETH_ZLEN;
- - buf_offs = NI5010_BUFSIZE - len;
- - outb(0, EDLC_RMASK); /* Mask all receive interrupts */
- - outb(0, IE_MMODE); /* Put Xmit buffer on system bus */
- - outb(0xFF, EDLC_RCLR); /* Clear out pending rcv interrupts */
- - outw(buf_offs, IE_GP); /* Point GP at start of packet */
- - outsb(IE_XBUF, d, ETH_ALEN); /* Put dst in buffer */
- - outsb(IE_XBUF, nic->node_addr, ETH_ALEN);/* Put src in buffer */
- - outb(t >> 8, IE_XBUF);
- - outb(t, IE_XBUF);
- - outsb(IE_XBUF, p, s); /* Put data in buffer */
- - while (s++ < ETH_ZLEN - ETH_HLEN) /* Pad to min size */
- - outb(0, IE_XBUF);
- - outw(buf_offs, IE_GP); /* Rewrite where packet starts */
- - /* should work without that outb() (Crynwr used it) */
- - /*outb(MM_MUX, IE_MMODE);*/
- - /* Xmt buffer to EDLC bus */
- - outb(MM_EN_XMT | MM_MUX, IE_MMODE); /* Begin transmission */
- - /* wait for transmit complete */
- - while (((xmt_stat = inb(IE_ISTAT)) & IS_EN_XMT) != 0)
- - ;
- - reset_receiver(); /* Immediately switch to receive */
- -}
- -
- -/**************************************************************************
- -DISABLE - Turn off ethernet interface
- -***************************************************************************/
- -static void ni5010_disable(struct nic *nic)
- -{
- - outb(0, IE_MMODE);
- - outb(RS_RESET, EDLC_RESET);
- -}
- -
- -static inline int rd_port(void)
- -{
- - inb(IE_RBUF);
- - return inb(IE_SAPROM);
- -}
- -
- -static int ni5010_probe1(struct nic *nic)
- -{
- - int i, boguscount = 40, data;
- -
- - /* The tests are from the Linux NI5010 driver
- - I don't understand it all, but if it works for them... */
- - if (inb(ioaddr) == 0xFF)
- - return (0);
- - while ((rd_port() & rd_port() & rd_port()
- - & rd_port() & rd_port() & rd_port()) != 0xFF)
- - {
- - if (boguscount-- <= 0)
- - return (0);
- - }
- - for (i = 0; i < 32; i++)
- - if ((data = rd_port()) != 0xFF)
- - break;
- - if (data == 0xFF)
- - return (0);
- - if (data == SA_ADDR0 && rd_port() == SA_ADDR1 && rd_port() == SA_ADDR2) {
- - for (i = 0; i < 4; i++)
- - rd_port();
- - if (rd_port() != NI5010_MAGICVAL1 || rd_port() != NI5010_MAGICVAL2)
- - return (0);
- - } else
- - return (0);
- - for (i = 0; i < ETH_ALEN; i++) {
- - outw(i, IE_GP);
- - nic->node_addr[i] = inb(IE_SAPROM);
- - }
- - printf("\nNI5010 ioaddr %#hX, addr %!\n", ioaddr, nic->node_addr);
- -/* get the size of the onboard receive buffer
- - * higher addresses than bufsize are wrapped into real buffer
- - * i.e. data for offs. 0x801 is written to 0x1 with a 2K onboard buffer
- - */
- - if (bufsize_rcv == 0) {
- - outb(1, IE_MMODE); /* Put Rcv buffer on system bus */
- - outw(0, IE_GP); /* Point GP at start of packet */
- - outb(0, IE_RBUF); /* set buffer byte 0 to 0 */
- - for (i = 1; i < 0xFF; i++) {
- - outw(i << 8, IE_GP); /* Point GP at packet size to be tested */
- - outb(i, IE_RBUF);
- - outw(0x0, IE_GP); /* Point GP at start of packet */
- - data = inb(IE_RBUF);
- - if (data == i) break;
- - }
- - bufsize_rcv = i << 8;
- - outw(0, IE_GP); /* Point GP at start of packet */
- - outb(0, IE_RBUF); /* set buffer byte 0 to 0 again */
- - }
- - printf("Bufsize rcv/xmt=%d/%d\n", bufsize_rcv, NI5010_BUFSIZE);
- - return (1);
- -}
- -
- -/**************************************************************************
- -PROBE - Look for an adapter, this routine's visible to the outside
- -***************************************************************************/
- -struct nic *ni5010_probe(struct nic *nic, unsigned short *probe_addrs)
- -{
- - static unsigned short io_addrs[] = {
- - 0x300, 0x320, 0x340, 0x360, 0x380, 0x3a0, 0 };
- - unsigned short *p;
- -
- - /* if probe_addrs is 0, then use list above */
- - if (probe_addrs == 0 || *probe_addrs == 0)
- - probe_addrs = io_addrs;
- - for (p = probe_addrs; (ioaddr = *p) != 0; p++) {
- - if (ni5010_probe1(nic))
- - break;
- - }
- - if (ioaddr == 0)
- - return (0);
- - ni5010_reset(nic);
- - /* point to NIC specific routines */
- - nic->reset = ni5010_reset;
- - nic->poll = ni5010_poll;
- - nic->transmit = ni5010_transmit;
- - nic->disable = ni5010_disable;
- - return (nic);
- -}
- diff -Naur grub-0.97.orig/netboot/nic.c grub-0.97/netboot/nic.c
- --- grub-0.97.orig/netboot/nic.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/nic.c 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,1198 @@
- +/**************************************************************************
- +Etherboot - Network Bootstrap Program
- +
- +Literature dealing with the network protocols:
- + ARP - RFC826
- + RARP - RFC903
- + IP - RFC791
- + UDP - RFC768
- + BOOTP - RFC951, RFC2132 (vendor extensions)
- + DHCP - RFC2131, RFC2132 (options)
- + TFTP - RFC1350, RFC2347 (options), RFC2348 (blocksize), RFC2349 (tsize)
- + RPC - RFC1831, RFC1832 (XDR), RFC1833 (rpcbind/portmapper)
- + NFS - RFC1094, RFC1813 (v3, useful for clarifications, not implemented)
- + IGMP - RFC1112, RFC2113, RFC2365, RFC2236, RFC3171
- +
- +**************************************************************************/
- +#include "etherboot.h"
- +#include "grub.h"
- +#include "nic.h"
- +#include "elf.h" /* FOR EM_CURRENT */
- +#include "bootp.h"
- +#include "if_arp.h"
- +#include "tftp.h"
- +#include "timer.h"
- +#include "ip.h"
- +#include "udp.h"
- +
- +/* Currently no other module uses rom, but it is available */
- +struct rom_info rom;
- +struct arptable_t arptable[MAX_ARP];
- +#if MULTICAST_LEVEL2
- +unsigned long last_igmpv1 = 0;
- +struct igmptable_t igmptable[MAX_IGMP];
- +#endif
- +static unsigned long netmask;
- +/* Used by nfs.c */
- +char *hostname = "";
- +int hostnamelen = 0;
- +static uint32_t xid;
- +static unsigned char *end_of_rfc1533 = NULL;
- +static const unsigned char broadcast[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
- +static const in_addr zeroIP = { 0L };
- +static char rfc1533_venddata[MAX_RFC1533_VENDLEN];
- +static unsigned char rfc1533_cookie[4] = { RFC1533_COOKIE };
- +static unsigned char rfc1533_cookie_bootp[5] = { RFC1533_COOKIE, RFC1533_END };
- +static unsigned char rfc1533_cookie_dhcp[] = { RFC1533_COOKIE };
- +static int dhcp_reply;
- +static in_addr dhcp_server = { 0L };
- +static in_addr dhcp_addr = { 0L };
- +
- +static const unsigned char dhcpdiscover[] = {
- + RFC2132_MSG_TYPE, 1, DHCPDISCOVER,
- + RFC2132_MAX_SIZE, 2, /* request as much as we can */
- + ETH_MAX_MTU / 256, ETH_MAX_MTU % 256,
- + /* Vendor class identifier */
- + RFC2132_VENDOR_CLASS_ID, 10, 'G', 'R', 'U', 'B', 'C', 'l', 'i', 'e', 'n', 't',
- + RFC2132_PARAM_LIST, 4, RFC1533_NETMASK, RFC1533_GATEWAY,
- + RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH, RFC1533_END
- +};
- +static const unsigned char dhcprequest [] = {
- + RFC2132_MSG_TYPE,1,DHCPREQUEST,
- + RFC2132_SRV_ID,4,0,0,0,0,
- + RFC2132_REQ_ADDR,4,0,0,0,0,
- + RFC2132_MAX_SIZE,2, /* request as much as we can */
- + ETH_MAX_MTU / 256, ETH_MAX_MTU % 256,
- + /* Vendor class identifier */
- + RFC2132_VENDOR_CLASS_ID, 10, 'G', 'R', 'U', 'B', 'C', 'l', 'i', 'e', 'n', 't',
- + RFC2132_PARAM_LIST,
- + /* 4 standard + 2 vendortags */
- + 4 + 2,
- + /* Standard parameters */
- + RFC1533_NETMASK, RFC1533_GATEWAY,
- + RFC1533_HOSTNAME, RFC1533_EXTENSIONPATH,
- + /* Etherboot vendortags */
- + RFC1533_VENDOR_MAGIC,
- + RFC1533_VENDOR_CONFIGFILE,
- + RFC1533_END
- +};
- +
- +/* See nic.h */
- +int user_abort = 0;
- +int network_ready = 0;
- +
- +#ifdef REQUIRE_VCI_ETHERBOOT
- +int vci_etherboot;
- +#endif
- +
- +static int dummy(void *unused __unused)
- +{
- + return (0);
- +}
- +
- +/* Careful. We need an aligned buffer to avoid problems on machines
- + * that care about alignment. To trivally align the ethernet data
- + * (the ip hdr and arp requests) we offset the packet by 2 bytes.
- + * leaving the ethernet data 16 byte aligned. Beyond this
- + * we use memmove but this makes the common cast simple and fast.
- + */
- +static char packet[ETH_FRAME_LEN + ETH_DATA_ALIGN] __aligned;
- +
- +struct nic nic =
- +{
- + {
- + 0, /* dev.disable */
- + {
- + 0,
- + 0,
- + PCI_BUS_TYPE,
- + }, /* dev.devid */
- + 0, /* index */
- + 0, /* type */
- + PROBE_FIRST, /* how_pobe */
- + PROBE_NONE, /* to_probe */
- + 0, /* failsafe */
- + 0, /* type_index */
- + {}, /* state */
- + },
- + (int (*)(struct nic *, int))dummy, /* poll */
- + (void (*)(struct nic *, const char *,
- + unsigned int, unsigned int,
- + const char *))dummy, /* transmit */
- + (void (*)(struct nic *, irq_action_t))dummy, /* irq */
- + 0, /* flags */
- + &rom, /* rom_info */
- + arptable[ARP_CLIENT].node, /* node_addr */
- + packet + ETH_DATA_ALIGN, /* packet */
- + 0, /* packetlen */
- + 0, /* ioaddr */
- + 0, /* irqno */
- + NULL, /* priv_data */
- +};
- +
- +
- +
- +int grub_eth_probe(void)
- +{
- + static int probed = 0;
- + struct dev *dev;
- +
- + EnterFunction("grub_eth_probe");
- +
- + if (probed)
- + return 1;
- +
- + network_ready = 0;
- + grub_memset((char *)arptable, 0, MAX_ARP * sizeof(struct arptable_t));
- + dev = &nic.dev;
- + dev->how_probe = -1;
- + dev->type = NIC_DRIVER;
- + dev->failsafe = 1;
- + rom = *((struct rom_info *)ROM_INFO_LOCATION);
- +
- + probed = (eth_probe(dev) == PROBE_WORKED);
- +
- + LeaveFunction("grub_eth_probe");
- + return probed;
- +}
- +
- +int eth_probe(struct dev *dev)
- +{
- + return probe(dev);
- +}
- +
- +int eth_poll(int retrieve)
- +{
- + return ((*nic.poll)(&nic, retrieve));
- +}
- +
- +void eth_transmit(const char *d, unsigned int t, unsigned int s, const void *p)
- +{
- + (*nic.transmit)(&nic, d, t, s, p);
- + if (t == IP) twiddle();
- +}
- +
- +void eth_disable(void)
- +{
- +#ifdef MULTICAST_LEVEL2
- + int i;
- + for(i = 0; i < MAX_IGMP; i++) {
- + leave_group(i);
- + }
- +#endif
- + disable(&nic.dev);
- +}
- +
- +void eth_irq (irq_action_t action)
- +{
- + (*nic.irq)(&nic,action);
- +}
- +
- +/**************************************************************************
- +IPCHKSUM - Checksum IP Header
- +**************************************************************************/
- +uint16_t ipchksum(const void *data, unsigned long length)
- +{
- + unsigned long sum;
- + unsigned long i;
- + const uint8_t *ptr;
- +
- + /* In the most straight forward way possible,
- + * compute an ip style checksum.
- + */
- + sum = 0;
- + ptr = data;
- + for(i = 0; i < length; i++) {
- + unsigned long value;
- + value = ptr[i];
- + if (i & 1) {
- + value <<= 8;
- + }
- + /* Add the new value */
- + sum += value;
- + /* Wrap around the carry */
- + if (sum > 0xFFFF) {
- + sum = (sum + (sum >> 16)) & 0xFFFF;
- + }
- + }
- + return (~cpu_to_le16(sum)) & 0xFFFF;
- +}
- +
- +uint16_t add_ipchksums(unsigned long offset, uint16_t sum, uint16_t new)
- +{
- + unsigned long checksum;
- + sum = ~sum & 0xFFFF;
- + new = ~new & 0xFFFF;
- + if (offset & 1) {
- + /* byte swap the sum if it came from an odd offset
- + * since the computation is endian independant this
- + * works.
- + */
- + new = bswap_16(new);
- + }
- + checksum = sum + new;
- + if (checksum > 0xFFFF) {
- + checksum -= 0xFFFF;
- + }
- + return (~checksum) & 0xFFFF;
- +}
- +
- +/**************************************************************************
- +DEFAULT_NETMASK - Return default netmask for IP address
- +**************************************************************************/
- +static inline unsigned long default_netmask(void)
- +{
- + int net = ntohl(arptable[ARP_CLIENT].ipaddr.s_addr) >> 24;
- + if (net <= 127)
- + return(htonl(0xff000000));
- + else if (net < 192)
- + return(htonl(0xffff0000));
- + else
- + return(htonl(0xffffff00));
- +}
- +
- +/**************************************************************************
- +IP_TRANSMIT - Send an IP datagram
- +**************************************************************************/
- +static int await_arp(int ival, void *ptr,
- + unsigned short ptype, struct iphdr *ip __unused, struct udphdr *udp __unused)
- +{
- + struct arprequest *arpreply;
- + if (ptype != ARP)
- + return 0;
- + if (nic.packetlen < ETH_HLEN + sizeof(struct arprequest))
- + return 0;
- + arpreply = (struct arprequest *)&nic.packet[ETH_HLEN];
- +
- + if (arpreply->opcode != htons(ARP_REPLY))
- + return 0;
- + if (memcmp(arpreply->sipaddr, ptr, sizeof(in_addr)) != 0)
- + return 0;
- + memcpy(arptable[ival].node, arpreply->shwaddr, ETH_ALEN);
- + return 1;
- +}
- +
- +int ip_transmit(int len, const void *buf)
- +{
- + unsigned long destip;
- + struct iphdr *ip;
- + struct arprequest arpreq;
- + int arpentry, i;
- + int retry;
- +
- + ip = (struct iphdr *)buf;
- + destip = ip->dest.s_addr;
- + if (destip == IP_BROADCAST) {
- + eth_transmit(broadcast, IP, len, buf);
- +#ifdef MULTICAST_LEVEL1
- + } else if ((destip & htonl(MULTICAST_MASK)) == htonl(MULTICAST_NETWORK)) {
- + unsigned char multicast[6];
- + unsigned long hdestip;
- + hdestip = ntohl(destip);
- + multicast[0] = 0x01;
- + multicast[1] = 0x00;
- + multicast[2] = 0x5e;
- + multicast[3] = (hdestip >> 16) & 0x7;
- + multicast[4] = (hdestip >> 8) & 0xff;
- + multicast[5] = hdestip & 0xff;
- + eth_transmit(multicast, IP, len, buf);
- +#endif
- + } else {
- + if (((destip & netmask) !=
- + (arptable[ARP_CLIENT].ipaddr.s_addr & netmask)) &&
- + arptable[ARP_GATEWAY].ipaddr.s_addr)
- + destip = arptable[ARP_GATEWAY].ipaddr.s_addr;
- + for(arpentry = 0; arpentry<MAX_ARP; arpentry++)
- + if (arptable[arpentry].ipaddr.s_addr == destip) break;
- + if (arpentry == MAX_ARP) {
- + printf("%@ is not in my arp table!\n", destip);
- + return(0);
- + }
- + for (i = 0; i < ETH_ALEN; i++)
- + if (arptable[arpentry].node[i])
- + break;
- + if (i == ETH_ALEN) { /* Need to do arp request */
- + arpreq.hwtype = htons(1);
- + arpreq.protocol = htons(IP);
- + arpreq.hwlen = ETH_ALEN;
- + arpreq.protolen = 4;
- + arpreq.opcode = htons(ARP_REQUEST);
- + memcpy(arpreq.shwaddr, arptable[ARP_CLIENT].node, ETH_ALEN);
- + memcpy(arpreq.sipaddr, &arptable[ARP_CLIENT].ipaddr, sizeof(in_addr));
- + memset(arpreq.thwaddr, 0, ETH_ALEN);
- + memcpy(arpreq.tipaddr, &destip, sizeof(in_addr));
- + for (retry = 1; retry <= MAX_ARP_RETRIES; retry++) {
- + long timeout;
- + eth_transmit(broadcast, ARP, sizeof(arpreq),
- + &arpreq);
- + timeout = rfc2131_sleep_interval(TIMEOUT, retry);
- + if (await_reply(await_arp, arpentry,
- + arpreq.tipaddr, timeout)) goto xmit;
- + }
- + return(0);
- + }
- +xmit:
- + eth_transmit(arptable[arpentry].node, IP, len, buf);
- + }
- + return 1;
- +}
- +
- +void build_ip_hdr(unsigned long destip, int ttl, int protocol, int option_len,
- + int len, const void *buf)
- +{
- + struct iphdr *ip;
- + ip = (struct iphdr *)buf;
- + ip->verhdrlen = 0x45;
- + ip->verhdrlen += (option_len/4);
- + ip->service = 0;
- + ip->len = htons(len);
- + ip->ident = 0;
- + ip->frags = 0; /* Should we set don't fragment? */
- + ip->ttl = ttl;
- + ip->protocol = protocol;
- + ip->chksum = 0;
- + ip->src.s_addr = arptable[ARP_CLIENT].ipaddr.s_addr;
- + ip->dest.s_addr = destip;
- + ip->chksum = ipchksum(buf, sizeof(struct iphdr) + option_len);
- +}
- +
- +static uint16_t udpchksum(struct iphdr *ip, struct udphdr *udp)
- +{
- + struct udp_pseudo_hdr pseudo;
- + uint16_t checksum;
- +
- + /* Compute the pseudo header */
- + pseudo.src.s_addr = ip->src.s_addr;
- + pseudo.dest.s_addr = ip->dest.s_addr;
- + pseudo.unused = 0;
- + pseudo.protocol = IP_UDP;
- + pseudo.len = udp->len;
- +
- + /* Sum the pseudo header */
- + checksum = ipchksum(&pseudo, 12);
- +
- + /* Sum the rest of the udp packet */
- + checksum = add_ipchksums(12, checksum, ipchksum(udp, ntohs(udp->len)));
- + return checksum;
- +}
- +
- +
- +void build_udp_hdr(unsigned long destip,
- + unsigned int srcsock, unsigned int destsock, int ttl,
- + int len, const void *buf)
- +{
- + struct iphdr *ip;
- + struct udphdr *udp;
- + ip = (struct iphdr *)buf;
- + build_ip_hdr(destip, ttl, IP_UDP, 0, len, buf);
- + udp = (struct udphdr *)((char *)buf + sizeof(struct iphdr));
- + udp->src = htons(srcsock);
- + udp->dest = htons(destsock);
- + udp->len = htons(len - sizeof(struct iphdr));
- + udp->chksum = 0;
- + if ((udp->chksum = udpchksum(ip, udp)) == 0)
- + udp->chksum = 0xffff;
- +}
- +
- +
- +/**************************************************************************
- +UDP_TRANSMIT - Send an UDP datagram
- +**************************************************************************/
- +int udp_transmit(unsigned long destip, unsigned int srcsock,
- + unsigned int destsock, int len, const void *buf)
- +{
- + build_udp_hdr(destip, srcsock, destsock, 60, len, buf);
- + return ip_transmit(len, buf);
- +}
- +
- +/**************************************************************************
- +QDRAIN - clear the nic's receive queue
- +**************************************************************************/
- +static int await_qdrain(int ival __unused, void *ptr __unused,
- + unsigned short ptype __unused,
- + struct iphdr *ip __unused, struct udphdr *udp __unused)
- +{
- + return 0;
- +}
- +
- +void rx_qdrain(void)
- +{
- + /* Clear out the Rx queue first. It contains nothing of interest,
- + * except possibly ARP requests from the DHCP/TFTP server. We use
- + * polling throughout Etherboot, so some time may have passed since we
- + * last polled the receive queue, which may now be filled with
- + * broadcast packets. This will cause the reply to the packets we are
- + * about to send to be lost immediately. Not very clever. */
- + await_reply(await_qdrain, 0, NULL, 0);
- +}
- +
- +/**
- + * rarp
- + *
- + * Get IP address by rarp. Just copy from etherboot
- + **/
- +static int await_rarp(int ival, void *ptr, unsigned short ptype,
- + struct iphdr *ip, struct udphdr *udp)
- +{
- + struct arprequest *arpreply;
- + if (ptype != RARP)
- + return 0;
- + if (nic.packetlen < ETH_HLEN + sizeof(struct arprequest))
- + return 0;
- + arpreply = (struct arprequest *)&nic.packet[ETH_HLEN];
- + if (arpreply->opcode != htons(RARP_REPLY))
- + return 0;
- + if (memcmp(arpreply->thwaddr, ptr, ETH_ALEN) == 0){
- + memcpy(arptable[ARP_SERVER].node, arpreply->shwaddr, ETH_ALEN);
- + memcpy(&arptable[ARP_SERVER].ipaddr, arpreply->sipaddr, sizeof(in_addr));
- + memcpy(&arptable[ARP_CLIENT].ipaddr, arpreply->tipaddr, sizeof(in_addr));
- + return 1;
- + }
- + return 0;
- +}
- +
- +int rarp(void)
- +{
- + int retry;
- +
- + /* arp and rarp requests share the same packet structure. */
- + struct arprequest rarpreq;
- +
- + if(!grub_eth_probe())
- + return 0;
- + network_ready = 0;
- +
- + memset(&rarpreq, 0, sizeof(rarpreq));
- +
- + rarpreq.hwtype = htons(1);
- + rarpreq.protocol = htons(IP);
- + rarpreq.hwlen = ETH_ALEN;
- + rarpreq.protolen = 4;
- + rarpreq.opcode = htons(RARP_REQUEST);
- + memcpy(&rarpreq.shwaddr, arptable[ARP_CLIENT].node, ETH_ALEN);
- + /* sipaddr is already zeroed out */
- + memcpy(&rarpreq.thwaddr, arptable[ARP_CLIENT].node, ETH_ALEN);
- + /* tipaddr is already zeroed out */
- +
- + for (retry = 0; retry < MAX_ARP_RETRIES; ++retry) {
- + long timeout;
- + eth_transmit(broadcast, RARP, sizeof(rarpreq), &rarpreq);
- +
- + timeout = rfc2131_sleep_interval(TIMEOUT, retry);
- + if (await_reply(await_rarp, 0, rarpreq.shwaddr, timeout))
- + break;
- + if (user_abort)
- + return 0;
- + }
- +
- + if (retry < MAX_ARP_RETRIES) {
- + network_ready = 1;
- + return (1);
- + }
- + return (0);
- +}
- +
- +/**
- + * bootp
- + *
- + * Get IP address by bootp, segregate from bootp in etherboot.
- + **/
- +static int await_bootp(int ival __unused, void *ptr __unused,
- + unsigned short ptype __unused, struct iphdr *ip __unused,
- + struct udphdr *udp)
- +{
- + struct bootp_t *bootpreply;
- + int len; /* Length of vendor */
- +
- + if (!udp) {
- + return 0;
- + }
- + bootpreply = (struct bootp_t *)
- + &nic.packet[ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr)];
- + len = nic.packetlen - (ETH_HLEN + sizeof(struct iphdr) +
- + sizeof(struct udphdr) + sizeof(struct bootp_t) - BOOTP_VENDOR_LEN);
- + if (len < 0) {
- + return 0;
- + }
- + if (udp->dest != htons(BOOTP_CLIENT))
- + return 0;
- + if (bootpreply->bp_op != BOOTP_REPLY)
- + return 0;
- + if (bootpreply->bp_xid != xid)
- + return 0;
- + if (memcmp((char *)&bootpreply->bp_siaddr, (char *)&zeroIP, sizeof(in_addr)) == 0)
- + return 0;
- + if ((memcmp(broadcast, bootpreply->bp_hwaddr, ETH_ALEN) != 0) &&
- + (memcmp(arptable[ARP_CLIENT].node, bootpreply->bp_hwaddr, ETH_ALEN) != 0)) {
- + return 0;
- + }
- + arptable[ARP_CLIENT].ipaddr.s_addr = bootpreply->bp_yiaddr.s_addr;
- + netmask = default_netmask();
- + arptable[ARP_SERVER].ipaddr.s_addr = bootpreply->bp_siaddr.s_addr;
- + memset(arptable[ARP_SERVER].node, 0, ETH_ALEN); /* Kill arp */
- + arptable[ARP_GATEWAY].ipaddr.s_addr = bootpreply->bp_giaddr.s_addr;
- + memset(arptable[ARP_GATEWAY].node, 0, ETH_ALEN); /* Kill arp */
- + /* We don't care bootpreply->bp_file, it must be 'pxegrub':-) */
- + memcpy((char *)rfc1533_venddata, (char *)(bootpreply->bp_vend), len);
- + decode_rfc1533(rfc1533_venddata, 0, len, 1);
- + return(1);
- +}
- +
- +int bootp(void)
- +{
- + int retry;
- + struct bootpip_t ip;
- + unsigned long starttime;
- +
- + EnterFunction("bootp");
- +
- + if(!grub_eth_probe())
- + return 0;
- + network_ready = 0;
- +
- + memset(&ip, 0, sizeof(struct bootpip_t));
- + ip.bp.bp_op = BOOTP_REQUEST;
- + ip.bp.bp_htype = 1;
- + ip.bp.bp_hlen = ETH_ALEN;
- + starttime = currticks();
- + /* Use lower 32 bits of node address, more likely to be
- + distinct than the time since booting */
- + memcpy(&xid, &arptable[ARP_CLIENT].node[2], sizeof(xid));
- + ip.bp.bp_xid = xid += htonl(starttime);
- + /* bp_secs defaults to zero */
- + memcpy(ip.bp.bp_hwaddr, arptable[ARP_CLIENT].node, ETH_ALEN);
- + memcpy(ip.bp.bp_vend, rfc1533_cookie_bootp, sizeof(rfc1533_cookie_bootp)); /* request RFC-style options */
- +
- + for (retry = 0; retry < MAX_BOOTP_RETRIES; ) {
- + long timeout;
- +
- + rx_qdrain();
- +
- + udp_transmit(IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER,
- + sizeof(struct bootpip_t), &ip);
- + timeout = rfc2131_sleep_interval(TIMEOUT, retry++);
- + if (await_reply(await_bootp, 0, NULL, timeout)){
- + network_ready = 1;
- + return(1);
- + }
- + if (user_abort)
- + return 0;
- + ip.bp.bp_secs = htons((currticks()-starttime)/TICKS_PER_SEC);
- + }
- + return(0);
- +}
- +
- +/**
- + * dhcp
- + *
- + * Get IP address by dhcp, segregate from bootp in etherboot.
- + **/
- +static int await_dhcp(int ival __unused, void *ptr __unused,
- + unsigned short ptype __unused, struct iphdr *ip __unused,
- + struct udphdr *udp)
- +{
- + struct dhcp_t *dhcpreply;
- + int len;
- +
- + if (!udp) {
- + return 0;
- + }
- + dhcpreply = (struct dhcp_t *)
- + &nic.packet[ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr)];
- + len = nic.packetlen - (ETH_HLEN + sizeof(struct iphdr) +
- + sizeof(struct udphdr) + sizeof(struct dhcp_t) - DHCP_OPT_LEN);
- + if (len < 0){
- + return 0;
- + }
- + if (udp->dest != htons(BOOTP_CLIENT))
- + return 0;
- + if (dhcpreply->bp_op != BOOTP_REPLY)
- + return 0;
- + if (dhcpreply->bp_xid != xid)
- + return 0;
- + if (memcmp((char *)&dhcpreply->bp_siaddr, (char *)&zeroIP, sizeof(in_addr)) == 0)
- + return 0;
- + if ((memcmp(broadcast, dhcpreply->bp_hwaddr, ETH_ALEN) != 0) &&
- + (memcmp(arptable[ARP_CLIENT].node, dhcpreply->bp_hwaddr, ETH_ALEN) != 0)) {
- + return 0;
- + }
- + arptable[ARP_CLIENT].ipaddr.s_addr = dhcpreply->bp_yiaddr.s_addr;
- + dhcp_addr.s_addr = dhcpreply->bp_yiaddr.s_addr;
- + netmask = default_netmask();
- + arptable[ARP_SERVER].ipaddr.s_addr = dhcpreply->bp_siaddr.s_addr;
- + memset(arptable[ARP_SERVER].node, 0, ETH_ALEN); /* Kill arp */
- + arptable[ARP_GATEWAY].ipaddr.s_addr = dhcpreply->bp_giaddr.s_addr;
- + memset(arptable[ARP_GATEWAY].node, 0, ETH_ALEN); /* Kill arp */
- + /* We don't care bootpreply->bp_file. It must be 'pxegrub' */
- + memcpy((char *)rfc1533_venddata, (char *)(dhcpreply->bp_vend), len);
- + decode_rfc1533(rfc1533_venddata, 0, len, 1);
- + return(1);
- +}
- +
- +int dhcp(void)
- +{
- + int retry;
- + int reqretry;
- + struct dhcpip_t ip;
- + unsigned long starttime;
- +
- + if(!grub_eth_probe())
- + return 0;
- +
- + network_ready = 0;
- +
- + memset(&ip, 0, sizeof(struct dhcpip_t));
- + ip.bp.bp_op = BOOTP_REQUEST;
- + ip.bp.bp_htype = 1;
- + ip.bp.bp_hlen = ETH_ALEN;
- + starttime = currticks();
- + /* Use lower 32 bits of node address, more likely to be
- + distinct than the time since booting */
- + memcpy(&xid, &arptable[ARP_CLIENT].node[2], sizeof(xid));
- + ip.bp.bp_xid = xid += htonl(starttime);
- + memcpy(ip.bp.bp_hwaddr, arptable[ARP_CLIENT].node, ETH_ALEN);
- + memcpy(ip.bp.bp_vend, rfc1533_cookie_dhcp, sizeof rfc1533_cookie_dhcp); /* request RFC-style options */
- + memcpy(ip.bp.bp_vend + sizeof rfc1533_cookie_dhcp, dhcpdiscover, sizeof dhcpdiscover);
- +
- + for (retry = 0; retry < MAX_BOOTP_RETRIES; ) {
- + long timeout;
- +
- + rx_qdrain();
- +
- + udp_transmit(IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER,
- + sizeof(struct bootpip_t), &ip);
- + timeout = rfc2131_sleep_interval(TIMEOUT, retry++);
- + if (await_reply(await_dhcp, 0, NULL, timeout)) {
- + /* If not a DHCPOFFER then must be just a
- + BOOTP reply, be backward compatible with
- + BOOTP then. Jscott report a bug here, but I
- + don't know how it happened */
- + if (dhcp_reply != DHCPOFFER){
- + network_ready = 1;
- + return(1);
- + }
- + dhcp_reply = 0;
- + memcpy(ip.bp.bp_vend, rfc1533_cookie_dhcp, sizeof rfc1533_cookie_dhcp);
- + memcpy(ip.bp.bp_vend + sizeof rfc1533_cookie_dhcp, dhcprequest, sizeof dhcprequest);
- + /* Beware: the magic numbers 9 and 15 depend on
- + the layout of dhcprequest */
- + memcpy(&ip.bp.bp_vend[9], &dhcp_server, sizeof(in_addr));
- + memcpy(&ip.bp.bp_vend[15], &dhcp_addr, sizeof(in_addr));
- + for (reqretry = 0; reqretry < MAX_BOOTP_RETRIES; ) {
- + udp_transmit(IP_BROADCAST, BOOTP_CLIENT, BOOTP_SERVER,
- + sizeof(struct bootpip_t), &ip);
- + dhcp_reply=0;
- + timeout = rfc2131_sleep_interval(TIMEOUT, reqretry++);
- + if (await_reply(await_dhcp, 0, NULL, timeout))
- + if (dhcp_reply == DHCPACK){
- + network_ready = 1;
- + return(1);
- + }
- + if (user_abort)
- + return 0;
- + }
- + }
- + if (user_abort)
- + return 0;
- + ip.bp.bp_secs = htons((currticks()-starttime)/TICKS_PER_SEC);
- + }
- + return(0);
- +}
- +
- +#ifdef MULTICAST_LEVEL2
- +static void send_igmp_reports(unsigned long now)
- +{
- + int i;
- + for(i = 0; i < MAX_IGMP; i++) {
- + if (igmptable[i].time && (now >= igmptable[i].time)) {
- + struct igmp_ip_t igmp;
- + igmp.router_alert[0] = 0x94;
- + igmp.router_alert[1] = 0x04;
- + igmp.router_alert[2] = 0;
- + igmp.router_alert[3] = 0;
- + build_ip_hdr(igmptable[i].group.s_addr,
- + 1, IP_IGMP, sizeof(igmp.router_alert), sizeof(igmp), &igmp);
- + igmp.igmp.type = IGMPv2_REPORT;
- + if (last_igmpv1 &&
- + (now < last_igmpv1 + IGMPv1_ROUTER_PRESENT_TIMEOUT)) {
- + igmp.igmp.type = IGMPv1_REPORT;
- + }
- + igmp.igmp.response_time = 0;
- + igmp.igmp.chksum = 0;
- + igmp.igmp.group.s_addr = igmptable[i].group.s_addr;
- + igmp.igmp.chksum = ipchksum(&igmp.igmp, sizeof(igmp.igmp));
- + ip_transmit(sizeof(igmp), &igmp);
- +#ifdef MDEBUG
- + printf("Sent IGMP report to: %@\n", igmp.igmp.group.s_addr);
- +#endif
- + /* Don't send another igmp report until asked */
- + igmptable[i].time = 0;
- + }
- + }
- +}
- +
- +static void process_igmp(struct iphdr *ip, unsigned long now)
- +{
- + struct igmp *igmp;
- + int i;
- + unsigned iplen = 0;
- + if (!ip || (ip->protocol == IP_IGMP) ||
- + (nic.packetlen < sizeof(struct iphdr) + sizeof(struct igmp))) {
- + return;
- + }
- + iplen = (ip->verhdrlen & 0xf)*4;
- + igmp = (struct igmp *)&nic.packet[sizeof(struct iphdr)];
- + if (ipchksum(igmp, ntohs(ip->len) - iplen) != 0)
- + return;
- + if ((igmp->type == IGMP_QUERY) &&
- + (ip->dest.s_addr == htonl(GROUP_ALL_HOSTS))) {
- + unsigned long interval = IGMP_INTERVAL;
- + if (igmp->response_time == 0) {
- + last_igmpv1 = now;
- + } else {
- + interval = (igmp->response_time * TICKS_PER_SEC)/10;
- + }
- +
- +#ifdef MDEBUG
- + printf("Received IGMP query for: %@\n", igmp->group.s_addr);
- +#endif
- + for(i = 0; i < MAX_IGMP; i++) {
- + uint32_t group = igmptable[i].group.s_addr;
- + if ((group == 0) || (group == igmp->group.s_addr)) {
- + unsigned long time;
- + time = currticks() + rfc1112_sleep_interval(interval, 0);
- + if (time < igmptable[i].time) {
- + igmptable[i].time = time;
- + }
- + }
- + }
- + }
- + if (((igmp->type == IGMPv1_REPORT) || (igmp->type == IGMPv2_REPORT)) &&
- + (ip->dest.s_addr == igmp->group.s_addr)) {
- +#ifdef MDEBUG
- + printf("Received IGMP report for: %@\n", igmp->group.s_addr);
- +#endif
- + for(i = 0; i < MAX_IGMP; i++) {
- + if ((igmptable[i].group.s_addr == igmp->group.s_addr) &&
- + igmptable[i].time != 0) {
- + igmptable[i].time = 0;
- + }
- + }
- + }
- +}
- +
- +void leave_group(int slot)
- +{
- + /* Be very stupid and always send a leave group message if
- + * I have subscribed. Imperfect but it is standards
- + * compliant, easy and reliable to implement.
- + *
- + * The optimal group leave method is to only send leave when,
- + * we were the last host to respond to a query on this group,
- + * and igmpv1 compatibility is not enabled.
- + */
- + if (igmptable[slot].group.s_addr) {
- + struct igmp_ip_t igmp;
- + igmp.router_alert[0] = 0x94;
- + igmp.router_alert[1] = 0x04;
- + igmp.router_alert[2] = 0;
- + igmp.router_alert[3] = 0;
- + build_ip_hdr(htonl(GROUP_ALL_HOSTS),
- + 1, IP_IGMP, sizeof(igmp.router_alert), sizeof(igmp), &igmp);
- + igmp.igmp.type = IGMP_LEAVE;
- + igmp.igmp.response_time = 0;
- + igmp.igmp.chksum = 0;
- + igmp.igmp.group.s_addr = igmptable[slot].group.s_addr;
- + igmp.igmp.chksum = ipchksum(&igmp.igmp, sizeof(igmp));
- + ip_transmit(sizeof(igmp), &igmp);
- +#ifdef MDEBUG
- + printf("Sent IGMP leave for: %@\n", igmp.igmp.group.s_addr);
- +#endif
- + }
- + memset(&igmptable[slot], 0, sizeof(igmptable[0]));
- +}
- +
- +void join_group(int slot, unsigned long group)
- +{
- + /* I have already joined */
- + if (igmptable[slot].group.s_addr == group)
- + return;
- + if (igmptable[slot].group.s_addr) {
- + leave_group(slot);
- + }
- + /* Only join a group if we are given a multicast ip, this way
- + * code can be given a non-multicast (broadcast or unicast ip)
- + * and still work...
- + */
- + if ((group & htonl(MULTICAST_MASK)) == htonl(MULTICAST_NETWORK)) {
- + igmptable[slot].group.s_addr = group;
- + igmptable[slot].time = currticks();
- + }
- +}
- +#else
- +#define send_igmp_reports(now);
- +#define process_igmp(ip, now)
- +#endif
- +
- +/**************************************************************************
- +AWAIT_REPLY - Wait until we get a response for our request
- +************f**************************************************************/
- +int await_reply(reply_t reply, int ival, void *ptr, long timeout)
- +{
- + unsigned long time, now;
- + struct iphdr *ip;
- + unsigned iplen = 0;
- + struct udphdr *udp;
- + unsigned short ptype;
- + int result;
- +
- + user_abort = 0;
- +
- + time = timeout + currticks();
- + /* The timeout check is done below. The timeout is only checked if
- + * there is no packet in the Rx queue. This assumes that eth_poll()
- + * needs a negligible amount of time.
- + */
- + for (;;) {
- + now = currticks();
- + send_igmp_reports(now);
- + result = eth_poll(1);
- + if (result == 0) {
- + /* We don't have anything */
- +
- + /* Check for abort key only if the Rx queue is empty -
- + * as long as we have something to process, don't
- + * assume that something failed. It is unlikely that
- + * we have no processing time left between packets. */
- + poll_interruptions();
- + /* Do the timeout after at least a full queue walk. */
- + if ((timeout == 0) || (currticks() > time) || user_abort == 1) {
- + break;
- + }
- + continue;
- + }
- +
- + /* We have something! */
- +
- + /* Find the Ethernet packet type */
- + if (nic.packetlen >= ETH_HLEN) {
- + ptype = ((unsigned short) nic.packet[12]) << 8
- + | ((unsigned short) nic.packet[13]);
- + } else continue; /* what else could we do with it? */
- + /* Verify an IP header */
- + ip = 0;
- + if ((ptype == IP) && (nic.packetlen >= ETH_HLEN + sizeof(struct iphdr))) {
- + unsigned ipoptlen;
- + ip = (struct iphdr *)&nic.packet[ETH_HLEN];
- + if ((ip->verhdrlen < 0x45) || (ip->verhdrlen > 0x4F))
- + continue;
- + iplen = (ip->verhdrlen & 0xf) * 4;
- + if (ipchksum(ip, iplen) != 0)
- + continue;
- + if (ip->frags & htons(0x3FFF)) {
- + static int warned_fragmentation = 0;
- + if (!warned_fragmentation) {
- + printf("ALERT: got a fragmented packet - reconfigure your server\n");
- + warned_fragmentation = 1;
- + }
- + continue;
- + }
- + if (ntohs(ip->len) > ETH_MAX_MTU)
- + continue;
- +
- + ipoptlen = iplen - sizeof(struct iphdr);
- + if (ipoptlen) {
- + /* Delete the ip options, to guarantee
- + * good alignment, and make etherboot simpler.
- + */
- + memmove(&nic.packet[ETH_HLEN + sizeof(struct iphdr)],
- + &nic.packet[ETH_HLEN + iplen],
- + nic.packetlen - ipoptlen);
- + nic.packetlen -= ipoptlen;
- + }
- + }
- + udp = 0;
- + if (ip && (ip->protocol == IP_UDP) &&
- + (nic.packetlen >= ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr))) {
- + udp = (struct udphdr *)&nic.packet[ETH_HLEN + sizeof(struct iphdr)];
- +
- + /* Make certain we have a reasonable packet length */
- + if (ntohs(udp->len) > (ntohs(ip->len) - iplen))
- + continue;
- +
- + if (udp->chksum && udpchksum(ip, udp)) {
- + printf("UDP checksum error\n");
- + continue;
- + }
- + }
- + result = reply(ival, ptr, ptype, ip, udp);
- + if (result > 0) {
- + return result;
- + }
- +
- + /* If it isn't a packet the upper layer wants see if there is a default
- + * action. This allows us reply to arp and igmp queryies.
- + */
- + if ((ptype == ARP) &&
- + (nic.packetlen >= ETH_HLEN + sizeof(struct arprequest))) {
- + struct arprequest *arpreply;
- + unsigned long tmp;
- +
- + arpreply = (struct arprequest *)&nic.packet[ETH_HLEN];
- + memcpy(&tmp, arpreply->tipaddr, sizeof(in_addr));
- + if ((arpreply->opcode == htons(ARP_REQUEST)) &&
- + (tmp == arptable[ARP_CLIENT].ipaddr.s_addr)) {
- + arpreply->opcode = htons(ARP_REPLY);
- + memcpy(arpreply->tipaddr, arpreply->sipaddr, sizeof(in_addr));
- + memcpy(arpreply->thwaddr, arpreply->shwaddr, ETH_ALEN);
- + memcpy(arpreply->sipaddr, &arptable[ARP_CLIENT].ipaddr, sizeof(in_addr));
- + memcpy(arpreply->shwaddr, arptable[ARP_CLIENT].node, ETH_ALEN);
- + eth_transmit(arpreply->thwaddr, ARP,
- + sizeof(struct arprequest),
- + arpreply);
- +#ifdef MDEBUG
- + memcpy(&tmp, arpreply->tipaddr, sizeof(in_addr));
- + printf("Sent ARP reply to: %@\n",tmp);
- +#endif /* MDEBUG */
- + }
- + }
- + process_igmp(ip, now);
- + }
- + return(0);
- +}
- +
- +#ifdef REQUIRE_VCI_ETHERBOOT
- +/**************************************************************************
- +FIND_VCI_ETHERBOOT - Looks for "Etherboot" in Vendor Encapsulated Identifiers
- +On entry p points to byte count of VCI options
- +**************************************************************************/
- +static int find_vci_etherboot(unsigned char *p)
- +{
- + unsigned char *end = p + 1 + *p;
- +
- + for (p++; p < end; ) {
- + if (*p == RFC2132_VENDOR_CLASS_ID) {
- + if (strncmp("Etherboot", p + 2, sizeof("Etherboot") - 1) == 0)
- + return (1);
- + } else if (*p == RFC1533_END)
- + return (0);
- + p += TAG_LEN(p) + 2;
- + }
- + return (0);
- +}
- +#endif /* REQUIRE_VCI_ETHERBOOT */
- +
- +/**
- + * decode_rfc1533
- + *
- + * Decodes RFC1533 header
- + **/
- +int decode_rfc1533(unsigned char *p, unsigned int block, unsigned int len, int eof)
- +{
- + static unsigned char *extdata = NULL, *extend = NULL;
- + unsigned char *extpath = NULL;
- + unsigned char *endp;
- +
- + if (block == 0) {
- + end_of_rfc1533 = NULL;
- + if (memcmp(p, rfc1533_cookie, sizeof(rfc1533_cookie)))
- + return(0); /* no RFC 1533 header found */
- + p += 4;
- + endp = p + len;
- + } else {
- + if (block == 1) {
- + if (memcmp(p, rfc1533_cookie, sizeof(rfc1533_cookie)))
- + return(0); /* no RFC 1533 header found */
- + p += 4;
- + len -= 4; }
- + if (extend + len <= (unsigned char *)
- + rfc1533_venddata + sizeof(rfc1533_venddata)) {
- + memcpy(extend, p, len);
- + extend += len;
- + } else {
- + printf("Overflow in vendor data buffer! Aborting...\n");
- + *extdata = RFC1533_END;
- + return(0);
- + }
- + p = extdata; endp = extend;
- + }
- + if (!eof)
- + return 1;
- + while (p < endp) {
- + unsigned char c = *p;
- + if (c == RFC1533_PAD) {
- + p++;
- + continue;
- + }
- + else if (c == RFC1533_END) {
- + end_of_rfc1533 = endp = p;
- + continue;
- + }
- + else if (c == RFC1533_NETMASK)
- + memcpy(&netmask, p+2, sizeof(in_addr));
- + else if (c == RFC1533_GATEWAY) {
- + /* This is a little simplistic, but it will
- + usually be sufficient.
- + Take only the first entry */
- + if (TAG_LEN(p) >= sizeof(in_addr))
- + memcpy(&arptable[ARP_GATEWAY].ipaddr, p+2, sizeof(in_addr));
- + }
- + else if (c == RFC1533_EXTENSIONPATH)
- + extpath = p;
- + else if (c == RFC2132_MSG_TYPE)
- + dhcp_reply=*(p+2);
- + else if (c == RFC2132_SRV_ID)
- + memcpy(&dhcp_server, p+2, sizeof(in_addr));
- + else if (c == RFC1533_HOSTNAME) {
- + hostname = p + 2;
- + hostnamelen = *(p + 1);
- + }
- + else if (c == RFC1533_VENDOR_CONFIGFILE){
- + int l = TAG_LEN (p);
- +
- + /* Eliminate the trailing NULs according to RFC 2132. */
- + while (*(p + 2 + l - 1) == '\000' && l > 0)
- + l--;
- +
- + /* XXX: Should check if LEN is less than the maximum length
- + of CONFIG_FILE. This kind of robustness will be a goal
- + in GRUB 1.0. */
- + memcpy (config_file, p + 2, l);
- + config_file[l] = 0;
- + }
- + else {
- + ;
- + }
- + p += TAG_LEN(p) + 2;
- + }
- + extdata = extend = endp;
- + if (block <= 0 && extpath != NULL) {
- + char fname[64];
- + if (TAG_LEN(extpath) >= sizeof(fname)){
- + printf("Overflow in vendor data buffer! Aborting...\n");
- + *extdata = RFC1533_END;
- + return(0);
- + }
- + memcpy(fname, extpath+2, TAG_LEN(extpath));
- + fname[(int)TAG_LEN(extpath)] = '\0';
- + printf("Loading BOOTP-extension file: %s\n",fname);
- + tftp_file_read(fname, decode_rfc1533);
- + }
- + return 1; /* proceed with next block */
- +}
- +
- +
- +/* FIXME double check TWO_SECOND_DIVISOR */
- +#define TWO_SECOND_DIVISOR (RAND_MAX/TICKS_PER_SEC)
- +/**************************************************************************
- +RFC2131_SLEEP_INTERVAL - sleep for expotentially longer times (base << exp) +- 1 sec)
- +**************************************************************************/
- +long rfc2131_sleep_interval(long base, int exp)
- +{
- + unsigned long tmo;
- +#ifdef BACKOFF_LIMIT
- + if (exp > BACKOFF_LIMIT)
- + exp = BACKOFF_LIMIT;
- +#endif
- + tmo = (base << exp) + (TICKS_PER_SEC - (random()/TWO_SECOND_DIVISOR));
- + return tmo;
- +}
- +
- +#ifdef MULTICAST_LEVEL2
- +/**************************************************************************
- +RFC1112_SLEEP_INTERVAL - sleep for expotentially longer times, up to (base << exp)
- +**************************************************************************/
- +long rfc1112_sleep_interval(long base, int exp)
- +{
- + unsigned long divisor, tmo;
- +#ifdef BACKOFF_LIMIT
- + if (exp > BACKOFF_LIMIT)
- + exp = BACKOFF_LIMIT;
- +#endif
- + divisor = RAND_MAX/(base << exp);
- + tmo = random()/divisor;
- + return tmo;
- +}
- +#endif /* MULTICAST_LEVEL_2 */
- +/* ifconfig - configure network interface. */
- +int
- +ifconfig (char *ip, char *sm, char *gw, char *svr)
- +{
- + in_addr tmp;
- +
- + if (sm)
- + {
- + if (! inet_aton (sm, &tmp))
- + return 0;
- +
- + netmask = tmp.s_addr;
- + }
- +
- + if (ip)
- + {
- + if (! inet_aton (ip, &arptable[ARP_CLIENT].ipaddr))
- + return 0;
- +
- + if (! netmask && ! sm)
- + netmask = default_netmask ();
- + }
- +
- + if (gw && ! inet_aton (gw, &arptable[ARP_GATEWAY].ipaddr))
- + return 0;
- +
- + /* Clear out the ARP entry. */
- + grub_memset (arptable[ARP_GATEWAY].node, 0, ETH_ALEN);
- +
- + if (svr && ! inet_aton (svr, &arptable[ARP_SERVER].ipaddr))
- + return 0;
- +
- + /* Likewise. */
- + grub_memset (arptable[ARP_SERVER].node, 0, ETH_ALEN);
- +
- + if (ip || sm)
- + {
- + if (IP_BROADCAST == (netmask | arptable[ARP_CLIENT].ipaddr.s_addr)
- + || netmask == (netmask | arptable[ARP_CLIENT].ipaddr.s_addr)
- + || ! netmask)
- + network_ready = 0;
- + else
- + network_ready = 1;
- + }
- +
- + return 1;
- +}
- +
- +/*
- + * print_network_configuration
- + *
- + * Output the network configuration. It may broke the graphic console now.:-(
- + */
- +void print_network_configuration (void)
- +{
- + EnterFunction("print_network_configuration");
- + if (! grub_eth_probe ())
- + grub_printf ("No ethernet card found.\n");
- + else if (! network_ready)
- + grub_printf ("Not initialized yet.\n");
- + else {
- + etherboot_printf ("Address: %@\n", arptable[ARP_CLIENT].ipaddr.s_addr);
- + etherboot_printf ("Netmask: %@\n", netmask);
- + etherboot_printf ("Server: %@\n", arptable[ARP_SERVER].ipaddr.s_addr);
- + etherboot_printf ("Gateway: %@\n", arptable[ARP_GATEWAY].ipaddr.s_addr);
- + }
- + LeaveFunction("print_network_configuration");
- +}
- +
- +/**
- + * cleanup_net
- + *
- + * Mark network unusable, and disable NICs
- + */
- +void cleanup_net (void)
- +{
- + if (network_ready){
- + /* Stop receiving packets. */
- + eth_disable ();
- + network_ready = 0;
- + }
- +}
- diff -Naur grub-0.97.orig/netboot/nic.h grub-0.97/netboot/nic.h
- --- grub-0.97.orig/netboot/nic.h 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/nic.h 2005-08-31 19:03:35.000000000 +0000
- @@ -8,24 +8,38 @@
- #ifndef NIC_H
- #define NIC_H
-
- +#include "dev.h"
- +
- +typedef enum {
- + DISABLE = 0,
- + ENABLE,
- + FORCE
- +} irq_action_t;
- +
- /*
- * Structure returned from eth_probe and passed to other driver
- * functions.
- */
- -
- struct nic
- {
- - void (*reset)P((struct nic *));
- - int (*poll)P((struct nic *));
- + struct dev dev; /* This must come first */
- + int (*poll)P((struct nic *, int retrieve));
- void (*transmit)P((struct nic *, const char *d,
- unsigned int t, unsigned int s, const char *p));
- - void (*disable)P((struct nic *));
- + void (*irq)P((struct nic *, irq_action_t));
- int flags; /* driver specific flags */
- struct rom_info *rom_info; /* -> rom_info from main */
- unsigned char *node_addr;
- - char *packet;
- + unsigned char *packet;
- unsigned int packetlen;
- + unsigned int ioaddr;
- + unsigned char irqno;
- void *priv_data; /* driver can hang private data here */
- };
-
- +extern int eth_probe(struct dev *dev);
- +extern int eth_poll(int retrieve);
- +extern void eth_transmit(const char *d, unsigned int t, unsigned int s, const void *p);
- +extern void eth_disable(void);
- +extern void eth_irq(irq_action_t action);
- #endif /* NIC_H */
- diff -Naur grub-0.97.orig/netboot/ns83820.c grub-0.97/netboot/ns83820.c
- --- grub-0.97.orig/netboot/ns83820.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/ns83820.c 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,1020 @@
- +/**************************************************************************
- +* ns83820.c: Etherboot device driver for the National Semiconductor 83820
- +* Written 2004 by Timothy Legge <tlegge@rogers.com>
- +*
- +* This program is free software; you can redistribute it and/or modify
- +* it under the terms of the GNU General Public License as published by
- +* the Free Software Foundation; either version 2 of the License, or
- +* (at your option) any later version.
- +*
- +* This program is distributed in the hope that it will be useful,
- +* but WITHOUT ANY WARRANTY; without even the implied warranty of
- +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +* GNU General Public License for more details.
- +*
- +* You should have received a copy of the GNU General Public License
- +* along with this program; if not, write to the Free Software
- +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- +*
- +* Portions of this code based on:
- +* ns83820.c by Benjamin LaHaise with contributions
- +* for Linux kernel 2.4.x.
- +*
- +* Linux Driver Version 0.20, 20020610
- +*
- +* This development of this Etherboot driver was funded by:
- +*
- +* NXTV: http://www.nxtv.com/
- +*
- +* REVISION HISTORY:
- +* ================
- +*
- +* v1.0 02-16-2004 timlegge Initial port of Linux driver
- +* v1.1 02-19-2004 timlegge More rohbust transmit and poll
- +*
- +* Indent Options: indent -kr -i8
- +***************************************************************************/
- +
- +/* to get some global routines like printf */
- +#include "etherboot.h"
- +/* to get the interface to the body of the program */
- +#include "nic.h"
- +/* to get the PCI support functions, if this is a PCI NIC */
- +#include "pci.h"
- +
- +#if ARCH == ia64 /* Support 64-bit addressing */
- +#define USE_64BIT_ADDR
- +#endif
- +
- +//#define DDEBUG
- +#ifdef DDEBUG
- +#define dprintf(x) printf x
- +#else
- +#define dprintf(x)
- +#endif
- +
- +typedef unsigned char u8;
- +typedef signed char s8;
- +typedef unsigned short u16;
- +typedef signed short s16;
- +typedef unsigned int u32;
- +typedef signed int s32;
- +
- +#define HZ 100
- +
- +/* Condensed operations for readability. */
- +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
- +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
- +
- +/* NIC specific static variables go here */
- +
- +/* Global parameters. See MODULE_PARM near the bottom. */
- +// static int ihr = 2;
- +static int reset_phy = 0;
- +static int lnksts = 0; /* CFG_LNKSTS bit polarity */
- +
- +#if defined(CONFIG_HIGHMEM64G) || defined(__ia64__)
- +#define USE_64BIT_ADDR "+"
- +#endif
- +
- +#if defined(USE_64BIT_ADDR)
- +#define TRY_DAC 1
- +#else
- +#define TRY_DAC 0
- +#endif
- +
- +/* tunables */
- +#define RX_BUF_SIZE 1500 /* 8192 */
- +
- +/* Must not exceed ~65000. */
- +#define NR_RX_DESC 64
- +#define NR_TX_DESC 1
- +
- + /* not tunable *//* Extra 6 bytes for 64 bit alignment (divisable by 8) */
- +#define REAL_RX_BUF_SIZE (RX_BUF_SIZE + 14 + 6) /* rx/tx mac addr + type */
- +
- +#define MIN_TX_DESC_FREE 8
- +
- +/* register defines */
- +#define CFGCS 0x04
- +
- +#define CR_TXE 0x00000001
- +#define CR_TXD 0x00000002
- +/* Ramit : Here's a tip, don't do a RXD immediately followed by an RXE
- + * The Receive engine skips one descriptor and moves
- + * onto the next one!! */
- +#define CR_RXE 0x00000004
- +#define CR_RXD 0x00000008
- +#define CR_TXR 0x00000010
- +#define CR_RXR 0x00000020
- +#define CR_SWI 0x00000080
- +#define CR_RST 0x00000100
- +
- +#define PTSCR_EEBIST_FAIL 0x00000001
- +#define PTSCR_EEBIST_EN 0x00000002
- +#define PTSCR_EELOAD_EN 0x00000004
- +#define PTSCR_RBIST_FAIL 0x000001b8
- +#define PTSCR_RBIST_DONE 0x00000200
- +#define PTSCR_RBIST_EN 0x00000400
- +#define PTSCR_RBIST_RST 0x00002000
- +
- +#define MEAR_EEDI 0x00000001
- +#define MEAR_EEDO 0x00000002
- +#define MEAR_EECLK 0x00000004
- +#define MEAR_EESEL 0x00000008
- +#define MEAR_MDIO 0x00000010
- +#define MEAR_MDDIR 0x00000020
- +#define MEAR_MDC 0x00000040
- +
- +#define ISR_TXDESC3 0x40000000
- +#define ISR_TXDESC2 0x20000000
- +#define ISR_TXDESC1 0x10000000
- +#define ISR_TXDESC0 0x08000000
- +#define ISR_RXDESC3 0x04000000
- +#define ISR_RXDESC2 0x02000000
- +#define ISR_RXDESC1 0x01000000
- +#define ISR_RXDESC0 0x00800000
- +#define ISR_TXRCMP 0x00400000
- +#define ISR_RXRCMP 0x00200000
- +#define ISR_DPERR 0x00100000
- +#define ISR_SSERR 0x00080000
- +#define ISR_RMABT 0x00040000
- +#define ISR_RTABT 0x00020000
- +#define ISR_RXSOVR 0x00010000
- +#define ISR_HIBINT 0x00008000
- +#define ISR_PHY 0x00004000
- +#define ISR_PME 0x00002000
- +#define ISR_SWI 0x00001000
- +#define ISR_MIB 0x00000800
- +#define ISR_TXURN 0x00000400
- +#define ISR_TXIDLE 0x00000200
- +#define ISR_TXERR 0x00000100
- +#define ISR_TXDESC 0x00000080
- +#define ISR_TXOK 0x00000040
- +#define ISR_RXORN 0x00000020
- +#define ISR_RXIDLE 0x00000010
- +#define ISR_RXEARLY 0x00000008
- +#define ISR_RXERR 0x00000004
- +#define ISR_RXDESC 0x00000002
- +#define ISR_RXOK 0x00000001
- +
- +#define TXCFG_CSI 0x80000000
- +#define TXCFG_HBI 0x40000000
- +#define TXCFG_MLB 0x20000000
- +#define TXCFG_ATP 0x10000000
- +#define TXCFG_ECRETRY 0x00800000
- +#define TXCFG_BRST_DIS 0x00080000
- +#define TXCFG_MXDMA1024 0x00000000
- +#define TXCFG_MXDMA512 0x00700000
- +#define TXCFG_MXDMA256 0x00600000
- +#define TXCFG_MXDMA128 0x00500000
- +#define TXCFG_MXDMA64 0x00400000
- +#define TXCFG_MXDMA32 0x00300000
- +#define TXCFG_MXDMA16 0x00200000
- +#define TXCFG_MXDMA8 0x00100000
- +
- +#define CFG_LNKSTS 0x80000000
- +#define CFG_SPDSTS 0x60000000
- +#define CFG_SPDSTS1 0x40000000
- +#define CFG_SPDSTS0 0x20000000
- +#define CFG_DUPSTS 0x10000000
- +#define CFG_TBI_EN 0x01000000
- +#define CFG_MODE_1000 0x00400000
- +/* Ramit : Dont' ever use AUTO_1000, it never works and is buggy.
- + * Read the Phy response and then configure the MAC accordingly */
- +#define CFG_AUTO_1000 0x00200000
- +#define CFG_PINT_CTL 0x001c0000
- +#define CFG_PINT_DUPSTS 0x00100000
- +#define CFG_PINT_LNKSTS 0x00080000
- +#define CFG_PINT_SPDSTS 0x00040000
- +#define CFG_TMRTEST 0x00020000
- +#define CFG_MRM_DIS 0x00010000
- +#define CFG_MWI_DIS 0x00008000
- +#define CFG_T64ADDR 0x00004000
- +#define CFG_PCI64_DET 0x00002000
- +#define CFG_DATA64_EN 0x00001000
- +#define CFG_M64ADDR 0x00000800
- +#define CFG_PHY_RST 0x00000400
- +#define CFG_PHY_DIS 0x00000200
- +#define CFG_EXTSTS_EN 0x00000100
- +#define CFG_REQALG 0x00000080
- +#define CFG_SB 0x00000040
- +#define CFG_POW 0x00000020
- +#define CFG_EXD 0x00000010
- +#define CFG_PESEL 0x00000008
- +#define CFG_BROM_DIS 0x00000004
- +#define CFG_EXT_125 0x00000002
- +#define CFG_BEM 0x00000001
- +
- +#define EXTSTS_UDPPKT 0x00200000
- +#define EXTSTS_TCPPKT 0x00080000
- +#define EXTSTS_IPPKT 0x00020000
- +
- +#define SPDSTS_POLARITY (CFG_SPDSTS1 | CFG_SPDSTS0 | CFG_DUPSTS | (lnksts ? CFG_LNKSTS : 0))
- +
- +#define MIBC_MIBS 0x00000008
- +#define MIBC_ACLR 0x00000004
- +#define MIBC_FRZ 0x00000002
- +#define MIBC_WRN 0x00000001
- +
- +#define PCR_PSEN (1 << 31)
- +#define PCR_PS_MCAST (1 << 30)
- +#define PCR_PS_DA (1 << 29)
- +#define PCR_STHI_8 (3 << 23)
- +#define PCR_STLO_4 (1 << 23)
- +#define PCR_FFHI_8K (3 << 21)
- +#define PCR_FFLO_4K (1 << 21)
- +#define PCR_PAUSE_CNT 0xFFFE
- +
- +#define RXCFG_AEP 0x80000000
- +#define RXCFG_ARP 0x40000000
- +#define RXCFG_STRIPCRC 0x20000000
- +#define RXCFG_RX_FD 0x10000000
- +#define RXCFG_ALP 0x08000000
- +#define RXCFG_AIRL 0x04000000
- +#define RXCFG_MXDMA512 0x00700000
- +#define RXCFG_DRTH 0x0000003e
- +#define RXCFG_DRTH0 0x00000002
- +
- +#define RFCR_RFEN 0x80000000
- +#define RFCR_AAB 0x40000000
- +#define RFCR_AAM 0x20000000
- +#define RFCR_AAU 0x10000000
- +#define RFCR_APM 0x08000000
- +#define RFCR_APAT 0x07800000
- +#define RFCR_APAT3 0x04000000
- +#define RFCR_APAT2 0x02000000
- +#define RFCR_APAT1 0x01000000
- +#define RFCR_APAT0 0x00800000
- +#define RFCR_AARP 0x00400000
- +#define RFCR_MHEN 0x00200000
- +#define RFCR_UHEN 0x00100000
- +#define RFCR_ULM 0x00080000
- +
- +#define VRCR_RUDPE 0x00000080
- +#define VRCR_RTCPE 0x00000040
- +#define VRCR_RIPE 0x00000020
- +#define VRCR_IPEN 0x00000010
- +#define VRCR_DUTF 0x00000008
- +#define VRCR_DVTF 0x00000004
- +#define VRCR_VTREN 0x00000002
- +#define VRCR_VTDEN 0x00000001
- +
- +#define VTCR_PPCHK 0x00000008
- +#define VTCR_GCHK 0x00000004
- +#define VTCR_VPPTI 0x00000002
- +#define VTCR_VGTI 0x00000001
- +
- +#define CR 0x00
- +#define CFG 0x04
- +#define MEAR 0x08
- +#define PTSCR 0x0c
- +#define ISR 0x10
- +#define IMR 0x14
- +#define IER 0x18
- +#define IHR 0x1c
- +#define TXDP 0x20
- +#define TXDP_HI 0x24
- +#define TXCFG 0x28
- +#define GPIOR 0x2c
- +#define RXDP 0x30
- +#define RXDP_HI 0x34
- +#define RXCFG 0x38
- +#define PQCR 0x3c
- +#define WCSR 0x40
- +#define PCR 0x44
- +#define RFCR 0x48
- +#define RFDR 0x4c
- +
- +#define SRR 0x58
- +
- +#define VRCR 0xbc
- +#define VTCR 0xc0
- +#define VDR 0xc4
- +#define CCSR 0xcc
- +
- +#define TBICR 0xe0
- +#define TBISR 0xe4
- +#define TANAR 0xe8
- +#define TANLPAR 0xec
- +#define TANER 0xf0
- +#define TESR 0xf4
- +
- +#define TBICR_MR_AN_ENABLE 0x00001000
- +#define TBICR_MR_RESTART_AN 0x00000200
- +
- +#define TBISR_MR_LINK_STATUS 0x00000020
- +#define TBISR_MR_AN_COMPLETE 0x00000004
- +
- +#define TANAR_PS2 0x00000100
- +#define TANAR_PS1 0x00000080
- +#define TANAR_HALF_DUP 0x00000040
- +#define TANAR_FULL_DUP 0x00000020
- +
- +#define GPIOR_GP5_OE 0x00000200
- +#define GPIOR_GP4_OE 0x00000100
- +#define GPIOR_GP3_OE 0x00000080
- +#define GPIOR_GP2_OE 0x00000040
- +#define GPIOR_GP1_OE 0x00000020
- +#define GPIOR_GP3_OUT 0x00000004
- +#define GPIOR_GP1_OUT 0x00000001
- +
- +#define LINK_AUTONEGOTIATE 0x01
- +#define LINK_DOWN 0x02
- +#define LINK_UP 0x04
- +
- +
- +#define __kick_rx() writel(CR_RXE, ns->base + CR)
- +
- +#define kick_rx() do { \
- + dprintf(("kick_rx: maybe kicking\n")); \
- + writel(virt_to_le32desc(&rx_ring[ns->cur_rx]), ns->base + RXDP); \
- + if (ns->next_rx == ns->next_empty) \
- + printf("uh-oh: next_rx == next_empty???\n"); \
- + __kick_rx(); \
- +} while(0)
- +
- +
- +#ifdef USE_64BIT_ADDR
- +#define HW_ADDR_LEN 8
- +#else
- +#define HW_ADDR_LEN 4
- +#endif
- +
- +#define CMDSTS_OWN 0x80000000
- +#define CMDSTS_MORE 0x40000000
- +#define CMDSTS_INTR 0x20000000
- +#define CMDSTS_ERR 0x10000000
- +#define CMDSTS_OK 0x08000000
- +#define CMDSTS_LEN_MASK 0x0000ffff
- +
- +#define CMDSTS_DEST_MASK 0x01800000
- +#define CMDSTS_DEST_SELF 0x00800000
- +#define CMDSTS_DEST_MULTI 0x01000000
- +
- +#define DESC_SIZE 8 /* Should be cache line sized */
- +
- +#ifdef USE_64BIT_ADDR
- +struct ring_desc {
- + uint64_t link;
- + uint64_t bufptr;
- + u32 cmdsts;
- + u32 extsts; /* Extended status field */
- +};
- +#else
- +struct ring_desc {
- + u32 link;
- + u32 bufptr;
- + u32 cmdsts;
- + u32 extsts; /* Extended status field */
- +};
- +#endif
- +
- +/* Define the TX Descriptor */
- +static struct ring_desc tx_ring[NR_TX_DESC]
- + __attribute__ ((aligned(8)));
- +
- +/* Create a static buffer of size REAL_RX_BUF_SIZE for each
- +TX Descriptor. All descriptors point to a
- +part of this buffer */
- +static unsigned char txb[NR_TX_DESC * REAL_RX_BUF_SIZE];
- +
- +/* Define the TX Descriptor */
- +static struct ring_desc rx_ring[NR_RX_DESC]
- + __attribute__ ((aligned(8)));
- +
- +/* Create a static buffer of size REAL_RX_BUF_SIZE for each
- +RX Descriptor All descriptors point to a
- +part of this buffer */
- +static unsigned char rxb[NR_RX_DESC * REAL_RX_BUF_SIZE]
- + __attribute__ ((aligned(8)));
- +
- +/* Private Storage for the NIC */
- +struct ns83820_private {
- + u8 *base;
- + int up;
- + long idle;
- + u32 *next_rx_desc;
- + u16 next_rx, next_empty;
- + u32 cur_rx;
- + u32 *descs;
- + unsigned ihr;
- + u32 CFG_cache;
- + u32 MEAR_cache;
- + u32 IMR_cache;
- + int linkstate;
- + u16 tx_done_idx;
- + u16 tx_idx;
- + u16 tx_intr_idx;
- + u32 phy_descs;
- + u32 *tx_descs;
- +
- +} nsx;
- +static struct ns83820_private *ns;
- +
- +static void phy_intr(struct nic *nic __unused)
- +{
- + static char *speeds[] =
- + { "10", "100", "1000", "1000(?)", "1000F" };
- + u32 cfg, new_cfg;
- + u32 tbisr, tanar, tanlpar;
- + int speed, fullduplex, newlinkstate;
- +
- + cfg = readl(ns->base + CFG) ^ SPDSTS_POLARITY;
- + if (ns->CFG_cache & CFG_TBI_EN) {
- + /* we have an optical transceiver */
- + tbisr = readl(ns->base + TBISR);
- + tanar = readl(ns->base + TANAR);
- + tanlpar = readl(ns->base + TANLPAR);
- + dprintf(("phy_intr: tbisr=%hX, tanar=%hX, tanlpar=%hX\n",
- + tbisr, tanar, tanlpar));
- +
- + if ((fullduplex = (tanlpar & TANAR_FULL_DUP)
- + && (tanar & TANAR_FULL_DUP))) {
- +
- + /* both of us are full duplex */
- + writel(readl(ns->base + TXCFG)
- + | TXCFG_CSI | TXCFG_HBI | TXCFG_ATP,
- + ns->base + TXCFG);
- + writel(readl(ns->base + RXCFG) | RXCFG_RX_FD,
- + ns->base + RXCFG);
- + /* Light up full duplex LED */
- + writel(readl(ns->base + GPIOR) | GPIOR_GP1_OUT,
- + ns->base + GPIOR);
- +
- + } else if (((tanlpar & TANAR_HALF_DUP)
- + && (tanar & TANAR_HALF_DUP))
- + || ((tanlpar & TANAR_FULL_DUP)
- + && (tanar & TANAR_HALF_DUP))
- + || ((tanlpar & TANAR_HALF_DUP)
- + && (tanar & TANAR_FULL_DUP))) {
- +
- + /* one or both of us are half duplex */
- + writel((readl(ns->base + TXCFG)
- + & ~(TXCFG_CSI | TXCFG_HBI)) | TXCFG_ATP,
- + ns->base + TXCFG);
- + writel(readl(ns->base + RXCFG) & ~RXCFG_RX_FD,
- + ns->base + RXCFG);
- + /* Turn off full duplex LED */
- + writel(readl(ns->base + GPIOR) & ~GPIOR_GP1_OUT,
- + ns->base + GPIOR);
- + }
- +
- + speed = 4; /* 1000F */
- +
- + } else {
- + /* we have a copper transceiver */
- + new_cfg =
- + ns->CFG_cache & ~(CFG_SB | CFG_MODE_1000 | CFG_SPDSTS);
- +
- + if (cfg & CFG_SPDSTS1)
- + new_cfg |= CFG_MODE_1000;
- + else
- + new_cfg &= ~CFG_MODE_1000;
- +
- + speed = ((cfg / CFG_SPDSTS0) & 3);
- + fullduplex = (cfg & CFG_DUPSTS);
- +
- + if (fullduplex)
- + new_cfg |= CFG_SB;
- +
- + if ((cfg & CFG_LNKSTS) &&
- + ((new_cfg ^ ns->CFG_cache) & CFG_MODE_1000)) {
- + writel(new_cfg, ns->base + CFG);
- + ns->CFG_cache = new_cfg;
- + }
- +
- + ns->CFG_cache &= ~CFG_SPDSTS;
- + ns->CFG_cache |= cfg & CFG_SPDSTS;
- + }
- +
- + newlinkstate = (cfg & CFG_LNKSTS) ? LINK_UP : LINK_DOWN;
- +
- + if (newlinkstate & LINK_UP && ns->linkstate != newlinkstate) {
- + printf("link now %s mbps, %s duplex and up.\n",
- + speeds[speed], fullduplex ? "full" : "half");
- + } else if (newlinkstate & LINK_DOWN
- + && ns->linkstate != newlinkstate) {
- + printf("link now down.\n");
- + }
- + ns->linkstate = newlinkstate;
- +}
- +static void ns83820_set_multicast(struct nic *nic __unused);
- +static void ns83820_setup_rx(struct nic *nic)
- +{
- + unsigned i;
- + ns->idle = 1;
- + ns->next_rx = 0;
- + ns->next_rx_desc = ns->descs;
- + ns->next_empty = 0;
- + ns->cur_rx = 0;
- +
- +
- + for (i = 0; i < NR_RX_DESC; i++) {
- + rx_ring[i].link = virt_to_le32desc(&rx_ring[i + 1]);
- + rx_ring[i].bufptr =
- + virt_to_le32desc(&rxb[i * REAL_RX_BUF_SIZE]);
- + rx_ring[i].cmdsts = cpu_to_le32(REAL_RX_BUF_SIZE);
- + rx_ring[i].extsts = cpu_to_le32(0);
- + }
- +// No need to wrap the ring
- +// rx_ring[i].link = virt_to_le32desc(&rx_ring[0]);
- + writel(0, ns->base + RXDP_HI);
- + writel(virt_to_le32desc(&rx_ring[0]), ns->base + RXDP);
- +
- + dprintf(("starting receiver\n"));
- +
- + writel(0x0001, ns->base + CCSR);
- + writel(0, ns->base + RFCR);
- + writel(0x7fc00000, ns->base + RFCR);
- + writel(0xffc00000, ns->base + RFCR);
- +
- + ns->up = 1;
- +
- + phy_intr(nic);
- +
- + /* Okay, let it rip */
- + ns->IMR_cache |= ISR_PHY;
- + ns->IMR_cache |= ISR_RXRCMP;
- + //dev->IMR_cache |= ISR_RXERR;
- + //dev->IMR_cache |= ISR_RXOK;
- + ns->IMR_cache |= ISR_RXORN;
- + ns->IMR_cache |= ISR_RXSOVR;
- + ns->IMR_cache |= ISR_RXDESC;
- + ns->IMR_cache |= ISR_RXIDLE;
- + ns->IMR_cache |= ISR_TXDESC;
- + ns->IMR_cache |= ISR_TXIDLE;
- +
- + // No reason to enable interupts...
- + // writel(ns->IMR_cache, ns->base + IMR);
- + // writel(1, ns->base + IER);
- + ns83820_set_multicast(nic);
- + kick_rx();
- +}
- +
- +
- +static void ns83820_do_reset(struct nic *nic __unused, u32 which)
- +{
- + dprintf(("resetting chip...\n"));
- + writel(which, ns->base + CR);
- + do {
- +
- + } while (readl(ns->base + CR) & which);
- + dprintf(("okay!\n"));
- +}
- +
- +static void ns83820_reset(struct nic *nic)
- +{
- + unsigned i;
- + dprintf(("ns83820_reset\n"));
- +
- + writel(0, ns->base + PQCR);
- +
- + ns83820_setup_rx(nic);
- +
- + for (i = 0; i < NR_TX_DESC; i++) {
- + tx_ring[i].link = 0;
- + tx_ring[i].bufptr = 0;
- + tx_ring[i].cmdsts = cpu_to_le32(0);
- + tx_ring[i].extsts = cpu_to_le32(0);
- + }
- +
- + ns->tx_idx = 0;
- + ns->tx_done_idx = 0;
- + writel(0, ns->base + TXDP_HI);
- + return;
- +}
- +static void ns83820_getmac(struct nic *nic __unused, u8 * mac)
- +{
- + unsigned i;
- + for (i = 0; i < 3; i++) {
- + u32 data;
- + /* Read from the perfect match memory: this is loaded by
- + * the chip from the EEPROM via the EELOAD self test.
- + */
- + writel(i * 2, ns->base + RFCR);
- + data = readl(ns->base + RFDR);
- + *mac++ = data;
- + *mac++ = data >> 8;
- + }
- +}
- +
- +static void ns83820_set_multicast(struct nic *nic __unused)
- +{
- + u8 *rfcr = ns->base + RFCR;
- + u32 and_mask = 0xffffffff;
- + u32 or_mask = 0;
- + u32 val;
- +
- + /* Support Multicast */
- + and_mask &= ~(RFCR_AAU | RFCR_AAM);
- + or_mask |= RFCR_AAM;
- + val = (readl(rfcr) & and_mask) | or_mask;
- + /* Ramit : RFCR Write Fix doc says RFEN must be 0 modify other bits */
- + writel(val & ~RFCR_RFEN, rfcr);
- + writel(val, rfcr);
- +
- +}
- +static void ns83820_run_bist(struct nic *nic __unused, const char *name,
- + u32 enable, u32 done, u32 fail)
- +{
- + int timed_out = 0;
- + long start;
- + u32 status;
- + int loops = 0;
- +
- + dprintf(("start %s\n", name))
- +
- + start = currticks();
- +
- + writel(enable, ns->base + PTSCR);
- + for (;;) {
- + loops++;
- + status = readl(ns->base + PTSCR);
- + if (!(status & enable))
- + break;
- + if (status & done)
- + break;
- + if (status & fail)
- + break;
- + if ((currticks() - start) >= HZ) {
- + timed_out = 1;
- + break;
- + }
- + }
- +
- + if (status & fail)
- + printf("%s failed! (0x%hX & 0x%hX)\n", name, status, fail);
- + else if (timed_out)
- + printf("run_bist %s timed out! (%hX)\n", name, status);
- + dprintf(("done %s in %d loops\n", name, loops));
- +}
- +
- +/*************************************
- +Check Link
- +*************************************/
- +static void ns83820_check_intr(struct nic *nic) {
- + int i;
- + u32 isr = readl(ns->base + ISR);
- + if(ISR_PHY & isr)
- + phy_intr(nic);
- + if(( ISR_RXIDLE | ISR_RXDESC | ISR_RXERR) & isr)
- + kick_rx();
- + for (i = 0; i < NR_RX_DESC; i++) {
- + if (rx_ring[i].cmdsts == CMDSTS_OWN) {
- +// rx_ring[i].link = virt_to_le32desc(&rx_ring[i + 1]);
- + rx_ring[i].cmdsts = cpu_to_le32(REAL_RX_BUF_SIZE);
- + }
- + }
- +}
- +/**************************************************************************
- +POLL - Wait for a frame
- +***************************************************************************/
- +static int ns83820_poll(struct nic *nic, int retrieve)
- +{
- + /* return true if there's an ethernet packet ready to read */
- + /* nic->packet should contain data on return */
- + /* nic->packetlen should contain length of data */
- + u32 cmdsts;
- + int entry = ns->cur_rx;
- +
- + ns83820_check_intr(nic);
- +
- + cmdsts = le32_to_cpu(rx_ring[entry].cmdsts);
- +
- + if ( ! ( (CMDSTS_OWN & (cmdsts)) && (cmdsts != (CMDSTS_OWN)) ) )
- + return 0;
- +
- + if ( ! retrieve ) return 1;
- +
- + if (! (CMDSTS_OK & cmdsts) )
- + return 0;
- +
- + nic->packetlen = cmdsts & 0xffff;
- + memcpy(nic->packet,
- + rxb + (entry * REAL_RX_BUF_SIZE),
- + nic->packetlen);
- + // rx_ring[entry].link = 0;
- + rx_ring[entry].cmdsts = cpu_to_le32(CMDSTS_OWN);
- +
- + ns->cur_rx = ++ns->cur_rx % NR_RX_DESC;
- +
- + if (ns->cur_rx == 0) /* We have wrapped the ring */
- + kick_rx();
- +
- + return 1;
- +}
- +
- +static inline void kick_tx(struct nic *nic __unused)
- +{
- + dprintf(("kick_tx\n"));
- + writel(CR_TXE, ns->base + CR);
- +}
- +
- +/**************************************************************************
- +TRANSMIT - Transmit a frame
- +***************************************************************************/
- +static void ns83820_transmit(struct nic *nic, const char *d, /* Destination */
- + unsigned int t, /* Type */
- + unsigned int s, /* size */
- + const char *p)
- +{ /* Packet */
- + /* send the packet to destination */
- +
- + u16 nstype;
- + u32 cmdsts, extsts;
- + int cur_tx = 0;
- + u32 isr = readl(ns->base + ISR);
- + if (ISR_TXIDLE & isr)
- + kick_tx(nic);
- + /* point to the current txb incase multiple tx_rings are used */
- + memcpy(txb, d, ETH_ALEN);
- + memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN);
- + nstype = htons((u16) t);
- + memcpy(txb + 2 * ETH_ALEN, (u8 *) & nstype, 2);
- + memcpy(txb + ETH_HLEN, p, s);
- + s += ETH_HLEN;
- + s &= 0x0FFF;
- + while (s < ETH_ZLEN)
- + txb[s++] = '\0';
- +
- + /* Setup the transmit descriptor */
- + extsts = 0;
- + extsts |= EXTSTS_UDPPKT;
- +
- + tx_ring[cur_tx].bufptr = virt_to_le32desc(&txb);
- + tx_ring[cur_tx].extsts = cpu_to_le32(extsts);
- +
- + cmdsts = cpu_to_le32(0);
- + cmdsts |= cpu_to_le32(CMDSTS_OWN | s);
- + tx_ring[cur_tx].cmdsts = cpu_to_le32(cmdsts);
- +
- + writel(virt_to_le32desc(&tx_ring[0]), ns->base + TXDP);
- + kick_tx(nic);
- +}
- +
- +/**************************************************************************
- +DISABLE - Turn off ethernet interface
- +***************************************************************************/
- +static void ns83820_disable(struct dev *dev)
- +{
- + /* put the card in its initial state */
- + /* This function serves 3 purposes.
- + * This disables DMA and interrupts so we don't receive
- + * unexpected packets or interrupts from the card after
- + * etherboot has finished.
- + * This frees resources so etherboot may use
- + * this driver on another interface
- + * This allows etherboot to reinitialize the interface
- + * if something is something goes wrong.
- + */
- + /* disable interrupts */
- + writel(0, ns->base + IMR);
- + writel(0, ns->base + IER);
- + readl(ns->base + IER);
- +
- + ns->up = 0;
- +
- + ns83820_do_reset((struct nic *) dev, CR_RST);
- +
- + ns->IMR_cache &=
- + ~(ISR_RXOK | ISR_RXDESC | ISR_RXERR | ISR_RXEARLY |
- + ISR_RXIDLE);
- + writel(ns->IMR_cache, ns->base + IMR);
- +
- + /* touch the pci bus... */
- + readl(ns->base + IMR);
- +
- + /* assumes the transmitter is already disabled and reset */
- + writel(0, ns->base + RXDP_HI);
- + writel(0, ns->base + RXDP);
- +}
- +
- +/**************************************************************************
- +IRQ - Enable, Disable, or Force interrupts
- +***************************************************************************/
- +static void ns83820_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
- +
- +/**************************************************************************
- +PROBE - Look for an adapter, this routine's visible to the outside
- +***************************************************************************/
- +
- +#define board_found 1
- +#define valid_link 0
- +static int ns83820_probe(struct dev *dev, struct pci_device *pci)
- +{
- + struct nic *nic = (struct nic *) dev;
- + int sz;
- + long addr;
- + int using_dac = 0;
- +
- + if (pci->ioaddr == 0)
- + return 0;
- +
- + printf("ns83820.c: Found %s, vendor=0x%hX, device=0x%hX\n",
- + pci->name, pci->vendor, pci->dev_id);
- +
- + /* point to private storage */
- + ns = &nsx;
- +
- + adjust_pci_device(pci);
- +
- + addr = pci_bar_start(pci, PCI_BASE_ADDRESS_1);
- + sz = pci_bar_size(pci, PCI_BASE_ADDRESS_1);
- +
- + ns->base = ioremap(addr, (1UL << 12));
- +// ns->base = ioremap(addr, sz);
- +
- + if (!ns->base)
- + return 0;
- +
- + nic->irqno = 0;
- + nic->ioaddr = pci->ioaddr & ~3;
- +
- + /* disable interrupts */
- + writel(0, ns->base + IMR);
- + writel(0, ns->base + IER);
- + readl(ns->base + IER);
- +
- + ns->IMR_cache = 0;
- +
- + ns83820_do_reset(nic, CR_RST);
- +
- + /* Must reset the ram bist before running it */
- + writel(PTSCR_RBIST_RST, ns->base + PTSCR);
- + ns83820_run_bist(nic, "sram bist", PTSCR_RBIST_EN,
- + PTSCR_RBIST_DONE, PTSCR_RBIST_FAIL);
- + ns83820_run_bist(nic, "eeprom bist", PTSCR_EEBIST_EN, 0,
- + PTSCR_EEBIST_FAIL);
- + ns83820_run_bist(nic, "eeprom load", PTSCR_EELOAD_EN, 0, 0);
- +
- + /* I love config registers */
- + ns->CFG_cache = readl(ns->base + CFG);
- +
- + if ((ns->CFG_cache & CFG_PCI64_DET)) {
- + printf("%s: detected 64 bit PCI data bus.\n", pci->name);
- + /*dev->CFG_cache |= CFG_DATA64_EN; */
- + if (!(ns->CFG_cache & CFG_DATA64_EN))
- + printf
- + ("%s: EEPROM did not enable 64 bit bus. Disabled.\n",
- + pci->name);
- + } else
- + ns->CFG_cache &= ~(CFG_DATA64_EN);
- +
- + ns->CFG_cache &= (CFG_TBI_EN | CFG_MRM_DIS | CFG_MWI_DIS |
- + CFG_T64ADDR | CFG_DATA64_EN | CFG_EXT_125 |
- + CFG_M64ADDR);
- + ns->CFG_cache |=
- + CFG_PINT_DUPSTS | CFG_PINT_LNKSTS | CFG_PINT_SPDSTS |
- + CFG_EXTSTS_EN | CFG_EXD | CFG_PESEL;
- + ns->CFG_cache |= CFG_REQALG;
- + ns->CFG_cache |= CFG_POW;
- + ns->CFG_cache |= CFG_TMRTEST;
- +
- + /* When compiled with 64 bit addressing, we must always enable
- + * the 64 bit descriptor format.
- + */
- +#ifdef USE_64BIT_ADDR
- + ns->CFG_cache |= CFG_M64ADDR;
- +#endif
- +
- +//FIXME: Enable section on dac or remove this
- + if (using_dac)
- + ns->CFG_cache |= CFG_T64ADDR;
- +
- + /* Big endian mode does not seem to do what the docs suggest */
- + ns->CFG_cache &= ~CFG_BEM;
- +
- + /* setup optical transceiver if we have one */
- + if (ns->CFG_cache & CFG_TBI_EN) {
- + dprintf(("%s: enabling optical transceiver\n", pci->name));
- + writel(readl(ns->base + GPIOR) | 0x3e8, ns->base + GPIOR);
- +
- + /* setup auto negotiation feature advertisement */
- + writel(readl(ns->base + TANAR)
- + | TANAR_HALF_DUP | TANAR_FULL_DUP,
- + ns->base + TANAR);
- +
- + /* start auto negotiation */
- + writel(TBICR_MR_AN_ENABLE | TBICR_MR_RESTART_AN,
- + ns->base + TBICR);
- + writel(TBICR_MR_AN_ENABLE, ns->base + TBICR);
- + ns->linkstate = LINK_AUTONEGOTIATE;
- +
- + ns->CFG_cache |= CFG_MODE_1000;
- + }
- + writel(ns->CFG_cache, ns->base + CFG);
- + dprintf(("CFG: %hX\n", ns->CFG_cache));
- +
- + /* FIXME: reset_phy is defaulted to 0, should we reset anyway? */
- + if (reset_phy) {
- + dprintf(("%s: resetting phy\n", pci->name));
- + writel(ns->CFG_cache | CFG_PHY_RST, ns->base + CFG);
- + writel(ns->CFG_cache, ns->base + CFG);
- + }
- +#if 0 /* Huh? This sets the PCI latency register. Should be done via
- + * the PCI layer. FIXME.
- + */
- + if (readl(dev->base + SRR))
- + writel(readl(dev->base + 0x20c) | 0xfe00,
- + dev->base + 0x20c);
- +#endif
- +
- + /* Note! The DMA burst size interacts with packet
- + * transmission, such that the largest packet that
- + * can be transmitted is 8192 - FLTH - burst size.
- + * If only the transmit fifo was larger...
- + */
- + /* Ramit : 1024 DMA is not a good idea, it ends up banging
- + * some DELL and COMPAQ SMP systems */
- + writel(TXCFG_CSI | TXCFG_HBI | TXCFG_ATP | TXCFG_MXDMA512
- + | ((1600 / 32) * 0x100), ns->base + TXCFG);
- +
- + /* Set Rx to full duplex, don't accept runt, errored, long or length
- + * range errored packets. Use 512 byte DMA.
- + */
- + /* Ramit : 1024 DMA is not a good idea, it ends up banging
- + * some DELL and COMPAQ SMP systems
- + * Turn on ALP, only we are accpeting Jumbo Packets */
- + writel(RXCFG_AEP | RXCFG_ARP | RXCFG_AIRL | RXCFG_RX_FD
- + | RXCFG_STRIPCRC
- + //| RXCFG_ALP
- + | (RXCFG_MXDMA512) | 0, ns->base + RXCFG);
- +
- + /* Disable priority queueing */
- + writel(0, ns->base + PQCR);
- +
- + /* Enable IP checksum validation and detetion of VLAN headers.
- + * Note: do not set the reject options as at least the 0x102
- + * revision of the chip does not properly accept IP fragments
- + * at least for UDP.
- + */
- + /* Ramit : Be sure to turn on RXCFG_ARP if VLAN's are enabled, since
- + * the MAC it calculates the packetsize AFTER stripping the VLAN
- + * header, and if a VLAN Tagged packet of 64 bytes is received (like
- + * a ping with a VLAN header) then the card, strips the 4 byte VLAN
- + * tag and then checks the packet size, so if RXCFG_ARP is not enabled,
- + * it discrards it!. These guys......
- + */
- + writel(VRCR_IPEN | VRCR_VTDEN, ns->base + VRCR);
- +
- + /* Enable per-packet TCP/UDP/IP checksumming */
- + writel(VTCR_PPCHK, ns->base + VTCR);
- +
- + /* Ramit : Enable async and sync pause frames */
- +// writel(0, ns->base + PCR);
- + writel((PCR_PS_MCAST | PCR_PS_DA | PCR_PSEN | PCR_FFLO_4K |
- + PCR_FFHI_8K | PCR_STLO_4 | PCR_STHI_8 | PCR_PAUSE_CNT),
- + ns->base + PCR);
- +
- + /* Disable Wake On Lan */
- + writel(0, ns->base + WCSR);
- +
- + ns83820_getmac(nic, nic->node_addr);
- + printf("%! at ioaddr 0x%hX, ", nic->node_addr, ns->base);
- +
- + if (using_dac) {
- + dprintf(("%s: using 64 bit addressing.\n", pci->name));
- + }
- +
- + dprintf(("%s: DP83820 %d.%d: %! io=0x%hX\n",
- + pci->name,
- + (unsigned) readl(ns->base + SRR) >> 8,
- + (unsigned) readl(ns->base + SRR) & 0xff,
- + nic->node_addr, pci->ioaddr));
- +
- +#ifdef PHY_CODE_IS_FINISHED
- + ns83820_probe_phy(dev);
- +#endif
- +
- + ns83820_reset(nic);
- + /* point to NIC specific routines */
- + dev->disable = ns83820_disable;
- + nic->poll = ns83820_poll;
- + nic->transmit = ns83820_transmit;
- + nic->irq = ns83820_irq;
- + return 1;
- +}
- +
- +static struct pci_id ns83820_nics[] = {
- + PCI_ROM(0x100b, 0x0022, "ns83820", "National Semiconductor 83820"),
- +};
- +
- +struct pci_driver ns83820_driver = {
- + .type = NIC_DRIVER,
- + .name = "NS83820/PCI",
- + .probe = ns83820_probe,
- + .ids = ns83820_nics,
- + .id_count = sizeof(ns83820_nics) / sizeof(ns83820_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/ns8390.c grub-0.97/netboot/ns8390.c
- --- grub-0.97.orig/netboot/ns8390.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/ns8390.c 2005-08-31 21:13:41.000000000 +0000
- @@ -13,11 +13,15 @@
- the proper functioning of this software, nor do the authors assume any
- responsibility for damages incurred with its use.
-
- +Multicast support added by Timothy Legge (timlegge@users.sourceforge.net) 09/28/2003
- +Relocation support added by Ken Yap (ken_yap@users.sourceforge.net) 28/12/02
- 3c503 support added by Bill Paul (wpaul@ctr.columbia.edu) on 11/15/94
- SMC8416 support added by Bill Paul (wpaul@ctr.columbia.edu) on 12/25/94
- 3c503 PIO support added by Jim Hague (jim.hague@acm.org) on 2/17/98
- RX overrun by Klaus Espenlaub (espenlaub@informatik.uni-ulm.de) on 3/10/99
- parts taken from the Linux 8390 driver (by Donald Becker and Paul Gortmaker)
- +SMC8416 PIO support added by Andrew Bettison (andrewb@zip.com.au) on 4/3/02
- + based on the Linux 8390 driver (by Donald Becker and Paul Gortmaker)
-
- **************************************************************************/
-
- @@ -26,10 +30,16 @@
- #include "ns8390.h"
- #ifdef INCLUDE_NS8390
- #include "pci.h"
- +#else
- +#include "isa.h"
- #endif
- -#include "cards.h"
-
- -static unsigned char eth_vendor, eth_flags, eth_laar;
- +typedef int Address;
- +
- +static unsigned char eth_vendor, eth_flags;
- +#ifdef INCLUDE_WD
- +static unsigned char eth_laar;
- +#endif
- static unsigned short eth_nic_base, eth_asic_base;
- static unsigned char eth_memsize, eth_rx_start, eth_tx_start;
- static Address eth_bmem, eth_rmem;
- @@ -66,6 +76,7 @@
- #endif
-
- #if defined(INCLUDE_WD)
- +#define ASIC_PIO WD_IAR
- #define eth_probe wd_probe
- #if defined(INCLUDE_3C503) || defined(INCLUDE_NE) || defined(INCLUDE_NS8390)
- Error you must only define one of INCLUDE_WD, INCLUDE_3C503, INCLUDE_NE, INCLUDE_NS8390
- @@ -101,13 +112,16 @@
- #endif
- #endif
-
- -#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM))
- +#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM)) || (defined(INCLUDE_WD) && defined(WD_790_PIO))
- /**************************************************************************
- ETH_PIO_READ - Read a frame via Programmed I/O
- **************************************************************************/
- static void eth_pio_read(unsigned int src, unsigned char *dst, unsigned int cnt)
- {
- - if (eth_flags & FLAG_16BIT) { ++cnt; cnt &= ~1; }
- +#ifdef INCLUDE_WD
- + outb(src & 0xff, eth_asic_base + WD_GP2);
- + outb(src >> 8, eth_asic_base + WD_GP2);
- +#else
- outb(D8390_COMMAND_RD2 |
- D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND);
- outb(cnt, eth_nic_base + D8390_P0_RBCR0);
- @@ -122,9 +136,10 @@
- outb(src >> 8, eth_asic_base + _3COM_DAMSB);
- outb(t503_output | _3COM_CR_START, eth_asic_base + _3COM_CR);
- #endif
- +#endif
-
- if (eth_flags & FLAG_16BIT)
- - cnt >>= 1;
- + cnt = (cnt + 1) >> 1;
-
- while(cnt--) {
- #ifdef INCLUDE_3C503
- @@ -153,7 +168,10 @@
- #ifdef COMPEX_RL2000_FIX
- unsigned int x;
- #endif /* COMPEX_RL2000_FIX */
- - if (eth_flags & FLAG_16BIT) { ++cnt; cnt &= ~1; }
- +#ifdef INCLUDE_WD
- + outb(dst & 0xff, eth_asic_base + WD_GP2);
- + outb(dst >> 8, eth_asic_base + WD_GP2);
- +#else
- outb(D8390_COMMAND_RD2 |
- D8390_COMMAND_STA, eth_nic_base + D8390_P0_COMMAND);
- outb(D8390_ISR_RDC, eth_nic_base + D8390_P0_ISR);
- @@ -170,9 +188,10 @@
-
- outb(t503_output | _3COM_CR_DDIR | _3COM_CR_START, eth_asic_base + _3COM_CR);
- #endif
- +#endif
-
- if (eth_flags & FLAG_16BIT)
- - cnt >>= 1;
- + cnt = (cnt + 1) >> 1;
-
- while(cnt--)
- {
- @@ -201,17 +220,40 @@
- if (x >= COMPEX_RL2000_TRIES)
- printf("Warning: Compex RL2000 aborted wait!\n");
- #endif /* COMPEX_RL2000_FIX */
- +#ifndef INCLUDE_WD
- while((inb(eth_nic_base + D8390_P0_ISR) & D8390_ISR_RDC)
- != D8390_ISR_RDC);
- #endif
- +#endif
- }
- #else
- /**************************************************************************
- ETH_PIO_READ - Dummy routine when NE2000 not compiled in
- **************************************************************************/
- -static void eth_pio_read(unsigned int src, unsigned char *dst, unsigned int cnt) {}
- +static void eth_pio_read(unsigned int src __unused, unsigned char *dst __unused, unsigned int cnt __unused) {}
- #endif
-
- +
- +/**************************************************************************
- +enable_multycast - Enable Multicast
- +**************************************************************************/
- +static void enable_multicast(unsigned short eth_nic_base)
- +{
- + unsigned char mcfilter[8];
- + int i;
- + memset(mcfilter, 0xFF, 8);
- + outb(4, eth_nic_base+D8390_P0_RCR);
- + outb(D8390_COMMAND_RD2 + D8390_COMMAND_PS1, eth_nic_base + D8390_P0_COMMAND);
- + for(i=0;i<8;i++)
- + {
- + outb(mcfilter[i], eth_nic_base + 8 + i);
- + if(inb(eth_nic_base + 8 + i)!=mcfilter[i])
- + printf("Error SMC 83C690 Multicast filter read/write mishap %d\n",i);
- + }
- + outb(D8390_COMMAND_RD2 + D8390_COMMAND_PS0, eth_nic_base + D8390_P0_COMMAND);
- + outb(4 | 0x08, eth_nic_base+D8390_P0_RCR);
- +}
- +
- /**************************************************************************
- NS8390_RESET - Reset adapter
- **************************************************************************/
- @@ -238,7 +280,14 @@
- outb(eth_tx_start, eth_nic_base+D8390_P0_TPSR);
- outb(eth_rx_start, eth_nic_base+D8390_P0_PSTART);
- #ifdef INCLUDE_WD
- - if (eth_flags & FLAG_790) outb(0, eth_nic_base + 0x09);
- + if (eth_flags & FLAG_790) {
- +#ifdef WD_790_PIO
- + outb(0x10, eth_asic_base + 0x06); /* disable interrupts, enable PIO */
- + outb(0x01, eth_nic_base + 0x09); /* enable ring read auto-wrap */
- +#else
- + outb(0, eth_nic_base + 0x09);
- +#endif
- + }
- #endif
- outb(eth_memsize, eth_nic_base+D8390_P0_PSTOP);
- outb(eth_memsize - 1, eth_nic_base+D8390_P0_BOUND);
- @@ -266,8 +315,10 @@
- outb(D8390_COMMAND_PS0 |
- D8390_COMMAND_RD2 | D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND);
- outb(0xFF, eth_nic_base+D8390_P0_ISR);
- - outb(0, eth_nic_base+D8390_P0_TCR);
- - outb(4, eth_nic_base+D8390_P0_RCR); /* allow broadcast frames */
- + outb(0, eth_nic_base+D8390_P0_TCR); /* transmitter on */
- + outb(4, eth_nic_base+D8390_P0_RCR); /* allow rx broadcast frames */
- +
- + enable_multicast(eth_nic_base);
-
- #ifdef INCLUDE_3C503
- /*
- @@ -281,7 +332,7 @@
- #endif
- }
-
- -static int ns8390_poll(struct nic *nic);
- +static int ns8390_poll(struct nic *nic, int retrieve);
-
- #ifndef INCLUDE_3C503
- /**************************************************************************
- @@ -324,7 +375,7 @@
-
- /* clear the RX ring, acknowledge overrun interrupt */
- eth_drain_receiver = 1;
- - while (ns8390_poll(nic))
- + while (ns8390_poll(nic, 1))
- /* Nothing */;
- eth_drain_receiver = 0;
- outb(D8390_ISR_OVW, eth_nic_base+D8390_P0_ISR);
- @@ -344,50 +395,54 @@
- unsigned int s, /* size */
- const char *p) /* Packet */
- {
- +#if defined(INCLUDE_3C503) || (defined(INCLUDE_WD) && ! defined(WD_790_PIO))
- + Address eth_vmem = bus_to_virt(eth_bmem);
- +#endif
- #ifdef INCLUDE_3C503
- if (!(eth_flags & FLAG_PIO)) {
- - memcpy((char *)eth_bmem, d, ETH_ALEN); /* dst */
- - memcpy((char *)eth_bmem+ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */
- - *((char *)eth_bmem+12) = t>>8; /* type */
- - *((char *)eth_bmem+13) = t;
- - memcpy((char *)eth_bmem+ETH_HLEN, p, s);
- + memcpy((char *)eth_vmem, d, ETH_ALEN); /* dst */
- + memcpy((char *)eth_vmem+ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */
- + *((char *)eth_vmem+12) = t>>8; /* type */
- + *((char *)eth_vmem+13) = t;
- + memcpy((char *)eth_vmem+ETH_HLEN, p, s);
- s += ETH_HLEN;
- - while (s < ETH_ZLEN) *((char *)eth_bmem+(s++)) = 0;
- + while (s < ETH_ZLEN) *((char *)eth_vmem+(s++)) = 0;
- }
- #endif
-
- #ifdef INCLUDE_WD
- - /* Memory interface */
- if (eth_flags & FLAG_16BIT) {
- outb(eth_laar | WD_LAAR_M16EN, eth_asic_base + WD_LAAR);
- inb(0x84);
- }
- +#ifndef WD_790_PIO
- + /* Memory interface */
- if (eth_flags & FLAG_790) {
- outb(WD_MSR_MENB, eth_asic_base + WD_MSR);
- inb(0x84);
- }
- inb(0x84);
- - memcpy((char *)eth_bmem, d, ETH_ALEN); /* dst */
- - memcpy((char *)eth_bmem+ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */
- - *((char *)eth_bmem+12) = t>>8; /* type */
- - *((char *)eth_bmem+13) = t;
- - memcpy((char *)eth_bmem+ETH_HLEN, p, s);
- + memcpy((char *)eth_vmem, d, ETH_ALEN); /* dst */
- + memcpy((char *)eth_vmem+ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */
- + *((char *)eth_vmem+12) = t>>8; /* type */
- + *((char *)eth_vmem+13) = t;
- + memcpy((char *)eth_vmem+ETH_HLEN, p, s);
- s += ETH_HLEN;
- - while (s < ETH_ZLEN) *((char *)eth_bmem+(s++)) = 0;
- + while (s < ETH_ZLEN) *((char *)eth_vmem+(s++)) = 0;
- if (eth_flags & FLAG_790) {
- outb(0, eth_asic_base + WD_MSR);
- inb(0x84);
- }
- - if (eth_flags & FLAG_16BIT) {
- - outb(eth_laar & ~WD_LAAR_M16EN, eth_asic_base + WD_LAAR);
- - inb(0x84);
- - }
- +#else
- + inb(0x84);
- +#endif
- #endif
-
- #if defined(INCLUDE_3C503)
- - if (eth_flags & FLAG_PIO) {
- + if (eth_flags & FLAG_PIO)
- #endif
- -#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM))
- +#if defined(INCLUDE_NE) || defined(INCLUDE_NS8390) || (defined(INCLUDE_3C503) && !defined(T503_SHMEM)) || (defined(INCLUDE_WD) && defined(WD_790_PIO))
- + {
- /* Programmed I/O */
- unsigned short type;
- type = (t >> 8) | (t << 8);
- @@ -398,12 +453,16 @@
- eth_pio_write(p, (eth_tx_start<<8)+ETH_HLEN, s);
- s += ETH_HLEN;
- if (s < ETH_ZLEN) s = ETH_ZLEN;
- + }
- #endif
- #if defined(INCLUDE_3C503)
- - }
- #endif
-
- #ifdef INCLUDE_WD
- + if (eth_flags & FLAG_16BIT) {
- + outb(eth_laar & ~WD_LAAR_M16EN, eth_asic_base + WD_LAAR);
- + inb(0x84);
- + }
- if (eth_flags & FLAG_790)
- outb(D8390_COMMAND_PS0 |
- D8390_COMMAND_STA, eth_nic_base+D8390_P0_COMMAND);
- @@ -428,7 +487,7 @@
- /**************************************************************************
- NS8390_POLL - Wait for a frame
- **************************************************************************/
- -static int ns8390_poll(struct nic *nic)
- +static int ns8390_poll(struct nic *nic, int retrieve)
- {
- int ret = 0;
- unsigned char rstat, curr, next;
- @@ -453,22 +512,27 @@
- outb(D8390_COMMAND_PS0, eth_nic_base+D8390_P0_COMMAND);
- if (curr >= eth_memsize) curr=eth_rx_start;
- if (curr == next) return(0);
- +
- + if ( ! retrieve ) return 1;
- +
- #ifdef INCLUDE_WD
- if (eth_flags & FLAG_16BIT) {
- outb(eth_laar | WD_LAAR_M16EN, eth_asic_base + WD_LAAR);
- inb(0x84);
- }
- +#ifndef WD_790_PIO
- if (eth_flags & FLAG_790) {
- outb(WD_MSR_MENB, eth_asic_base + WD_MSR);
- inb(0x84);
- }
- +#endif
- inb(0x84);
- #endif
- pktoff = next << 8;
- if (eth_flags & FLAG_PIO)
- eth_pio_read(pktoff, (char *)&pkthdr, 4);
- else
- - memcpy(&pkthdr, (char *)eth_rmem + pktoff, 4);
- + memcpy(&pkthdr, bus_to_virt(eth_rmem + pktoff), 4);
- pktoff += sizeof(pkthdr);
- /* incoming length includes FCS so must sub 4 */
- len = pkthdr.len - 4;
- @@ -486,7 +550,7 @@
- if (eth_flags & FLAG_PIO)
- eth_pio_read(pktoff, p, frag);
- else
- - memcpy(p, (char *)eth_rmem + pktoff, frag);
- + memcpy(p, bus_to_virt(eth_rmem + pktoff), frag);
- pktoff = eth_rx_start << 8;
- p += frag;
- len -= frag;
- @@ -495,14 +559,16 @@
- if (eth_flags & FLAG_PIO)
- eth_pio_read(pktoff, p, len);
- else
- - memcpy(p, (char *)eth_rmem + pktoff, len);
- + memcpy(p, bus_to_virt(eth_rmem + pktoff), len);
- ret = 1;
- }
- #ifdef INCLUDE_WD
- +#ifndef WD_790_PIO
- if (eth_flags & FLAG_790) {
- outb(0, eth_asic_base + WD_MSR);
- inb(0x84);
- }
- +#endif
- if (eth_flags & FLAG_16BIT) {
- outb(eth_laar & ~WD_LAAR_M16EN, eth_asic_base + WD_LAAR);
- inb(0x84);
- @@ -519,31 +585,56 @@
- /**************************************************************************
- NS8390_DISABLE - Turn off adapter
- **************************************************************************/
- -static void ns8390_disable(struct nic *nic)
- +static void ns8390_disable(struct dev *dev)
- {
- + struct nic *nic = (struct nic *)dev;
- + /* reset and disable merge */
- + ns8390_reset(nic);
- +}
- +
- +/**************************************************************************
- +NS8390_IRQ - Enable, Disable, or Force interrupts
- +**************************************************************************/
- +static void ns8390_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- }
-
- /**************************************************************************
- ETH_PROBE - Look for an adapter
- **************************************************************************/
- #ifdef INCLUDE_NS8390
- -struct nic *eth_probe(struct nic *nic, unsigned short *probe_addrs,
- - struct pci_device *pci)
- +static int eth_probe (struct dev *dev, struct pci_device *pci)
- #else
- -struct nic *eth_probe(struct nic *nic, unsigned short *probe_addrs)
- +static int eth_probe (struct dev *dev, unsigned short *probe_addrs __unused)
- #endif
- {
- + struct nic *nic = (struct nic *)dev;
- int i;
- - struct wd_board *brd;
- - unsigned short chksum;
- - unsigned char c;
- +#ifdef INCLUDE_NS8390
- + unsigned short pci_probe_addrs[] = { pci->ioaddr, 0 };
- + unsigned short *probe_addrs = pci_probe_addrs;
- +#endif
- eth_vendor = VENDOR_NONE;
- eth_drain_receiver = 0;
-
- + nic->irqno = 0;
- +
- #ifdef INCLUDE_WD
- +{
- /******************************************************************
- Search for WD/SMC cards
- ******************************************************************/
- + struct wd_board *brd;
- + unsigned short chksum;
- + unsigned char c;
- for (eth_asic_base = WD_LOW_BASE; eth_asic_base <= WD_HIGH_BASE;
- eth_asic_base += 0x20) {
- chksum = 0;
- @@ -560,6 +651,9 @@
- /* We've found a board */
- eth_vendor = VENDOR_WD;
- eth_nic_base = eth_asic_base + WD_NIC_ADDR;
- +
- + nic->ioaddr = eth_nic_base;
- +
- c = inb(eth_asic_base+WD_BID); /* Get board id */
- for (brd = wd_boards; brd->name; brd++)
- if (brd->id == c) break;
- @@ -582,8 +676,9 @@
- } else
- eth_bmem = WD_DEFAULT_MEM;
- if (brd->id == TYPE_SMC8216T || brd->id == TYPE_SMC8216C) {
- - *((unsigned int *)(eth_bmem + 8192)) = (unsigned int)0;
- - if (*((unsigned int *)(eth_bmem + 8192))) {
- + /* from Linux driver, 8416BT detects as 8216 sometimes */
- + unsigned int addr = inb(eth_asic_base + 0xb);
- + if (((addr >> 4) & 3) == 0) {
- brd += 2;
- eth_memsize = brd->memsize;
- }
- @@ -592,19 +687,27 @@
- for (i=0; i<ETH_ALEN; i++) {
- nic->node_addr[i] = inb(i+eth_asic_base+WD_LAR);
- }
- - printf("\n%s base %#hx, memory %#hx, addr %!\n",
- - brd->name, eth_asic_base, eth_bmem, nic->node_addr);
- + printf("\n%s base %#hx", brd->name, eth_asic_base);
- if (eth_flags & FLAG_790) {
- +#ifdef WD_790_PIO
- + printf(", PIO mode, addr %!\n", nic->node_addr);
- + eth_bmem = 0;
- + eth_flags |= FLAG_PIO; /* force PIO mode */
- + outb(0, eth_asic_base+WD_MSR);
- +#else
- + printf(", memory %#x, addr %!\n", eth_bmem, nic->node_addr);
- outb(WD_MSR_MENB, eth_asic_base+WD_MSR);
- outb((inb(eth_asic_base+0x04) |
- 0x80), eth_asic_base+0x04);
- - outb((((unsigned)eth_bmem >> 13) & 0x0F) |
- - (((unsigned)eth_bmem >> 11) & 0x40) |
- + outb(((unsigned)(eth_bmem >> 13) & 0x0F) |
- + ((unsigned)(eth_bmem >> 11) & 0x40) |
- (inb(eth_asic_base+0x0B) & 0xB0), eth_asic_base+0x0B);
- outb((inb(eth_asic_base+0x04) &
- ~0x80), eth_asic_base+0x04);
- +#endif
- } else {
- - outb((((unsigned)eth_bmem >> 13) & 0x3F) | 0x40, eth_asic_base+WD_MSR);
- + printf(", memory %#x, addr %!\n", eth_bmem, nic->node_addr);
- + outb(((unsigned)(eth_bmem >> 13) & 0x3F) | 0x40, eth_asic_base+WD_MSR);
- }
- if (eth_flags & FLAG_16BIT) {
- if (eth_flags & FLAG_790) {
- @@ -624,8 +727,14 @@
- }
- inb(0x84);
- }
- +}
- #endif
- #ifdef INCLUDE_3C503
- +#ifdef T503_AUI
- + nic->flags = 1; /* aui */
- +#else
- + nic->flags = 0; /* no aui */
- +#endif
- /******************************************************************
- Search for 3Com 3c503 if no WD/SMC cards
- ******************************************************************/
- @@ -708,11 +817,12 @@
- /* Get our ethernet address */
-
- outb(_3COM_CR_EALO | _3COM_CR_XSEL, eth_asic_base + _3COM_CR);
- + nic->ioaddr = eth_nic_base;
- printf("\n3Com 3c503 base %#hx, ", eth_nic_base);
- if (eth_flags & FLAG_PIO)
- printf("PIO mode");
- else
- - printf("memory %#hx", eth_bmem);
- + printf("memory %#x", eth_bmem);
- for (i=0; i<ETH_ALEN; i++) {
- nic->node_addr[i] = inb(eth_nic_base+i);
- }
- @@ -734,9 +844,9 @@
- */
-
- if (!(eth_flags & FLAG_PIO)) {
- - memset((char *)eth_bmem, 0, 0x2000);
- + memset(bus_to_virt(eth_bmem), 0, 0x2000);
- for(i = 0; i < 0x2000; ++i)
- - if (*(((char *)eth_bmem)+i)) {
- + if (*((char *)(bus_to_virt(eth_bmem+i)))) {
- printf ("Failed to clear 3c503 shared mem.\n");
- return (0);
- }
- @@ -749,9 +859,11 @@
- }
- #endif
- #if defined(INCLUDE_NE) || defined(INCLUDE_NS8390)
- +{
- /******************************************************************
- Search for NE1000/2000 if no WD/SMC or 3com cards
- ******************************************************************/
- + unsigned char c;
- if (eth_vendor == VENDOR_NONE) {
- char romdata[16], testbuf[32];
- int idx;
- @@ -810,23 +922,94 @@
- for (i=0; i<ETH_ALEN; i++) {
- nic->node_addr[i] = romdata[i + ((eth_flags & FLAG_16BIT) ? i : 0)];
- }
- + nic->ioaddr = eth_nic_base;
- printf("\nNE%c000 base %#hx, addr %!\n",
- (eth_flags & FLAG_16BIT) ? '2' : '1', eth_nic_base,
- nic->node_addr);
- }
- +}
- #endif
- if (eth_vendor == VENDOR_NONE)
- return(0);
- if (eth_vendor != VENDOR_3COM)
- eth_rmem = eth_bmem;
- ns8390_reset(nic);
- - nic->reset = ns8390_reset;
- - nic->poll = ns8390_poll;
- +
- + dev->disable = ns8390_disable;
- + nic->poll = ns8390_poll;
- nic->transmit = ns8390_transmit;
- - nic->disable = ns8390_disable;
- - return(nic);
- + nic->irq = ns8390_irq;
- +
- + /* Based on PnP ISA map */
- +#ifdef INCLUDE_WD
- + dev->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR);
- + dev->devid.device_id = htons(0x812a);
- +#endif
- +#ifdef INCLUDE_3C503
- + dev->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR);
- + dev->devid.device_id = htons(0x80f3);
- +#endif
- +#ifdef INCLUDE_NE
- + dev->devid.vendor_id = htons(GENERIC_ISAPNP_VENDOR);
- + dev->devid.device_id = htons(0x80d6);
- +#endif
- + return 1;
- }
-
- +#ifdef INCLUDE_WD
- +static struct isa_driver wd_driver __isa_driver = {
- + .type = NIC_DRIVER,
- + .name = "WD",
- + .probe = wd_probe,
- + .ioaddrs = 0,
- +};
- +#endif
- +
- +#ifdef INCLUDE_3C503
- +static struct isa_driver t503_driver __isa_driver = {
- + .type = NIC_DRIVER,
- + .name = "3C503",
- + .probe = t503_probe,
- + .ioaddrs = 0,
- +};
- +#endif
- +
- +#ifdef INCLUDE_NE
- +static struct isa_driver ne_driver __isa_driver = {
- + .type = NIC_DRIVER,
- + .name = "NE*000",
- + .probe = ne_probe,
- + .ioaddrs = 0,
- +};
- +#endif
- +
- +#ifdef INCLUDE_NS8390
- +static struct pci_id nepci_nics[] = {
- +/* A few NE2000 PCI clones, list not exhaustive */
- +PCI_ROM(0x10ec, 0x8029, "rtl8029", "Realtek 8029"),
- +PCI_ROM(0x1186, 0x0300, "dlink-528", "D-Link DE-528"),
- +PCI_ROM(0x1050, 0x0940, "winbond940", "Winbond NE2000-PCI"), /* Winbond 86C940 / 89C940 */
- +PCI_ROM(0x1050, 0x5a5a, "winbond940f", "Winbond W89c940F"), /* Winbond 89C940F */
- +PCI_ROM(0x11f6, 0x1401, "compexrl2000", "Compex ReadyLink 2000"),
- +PCI_ROM(0x8e2e, 0x3000, "ktiet32p2", "KTI ET32P2"),
- +PCI_ROM(0x4a14, 0x5000, "nv5000sc", "NetVin NV5000SC"),
- +PCI_ROM(0x12c3, 0x0058, "holtek80232", "Holtek HT80232"),
- +PCI_ROM(0x12c3, 0x5598, "holtek80229", "Holtek HT80229"),
- +PCI_ROM(0x10bd, 0x0e34, "surecom-ne34", "Surecom NE34"),
- +PCI_ROM(0x1106, 0x0926, "via86c926", "Via 86c926"),
- +};
- +
- +struct pci_driver nepci_driver = {
- + .type = NIC_DRIVER,
- + .name = "NE2000/PCI",
- + .probe = nepci_probe,
- + .ids = nepci_nics,
- + .id_count = sizeof(nepci_nics)/sizeof(nepci_nics[0]),
- + .class = 0,
- +};
- +
- +#endif /* INCLUDE_NS8390 */
- +
- /*
- * Local variables:
- * c-basic-offset: 8
- diff -Naur grub-0.97.orig/netboot/osdep.h grub-0.97/netboot/osdep.h
- --- grub-0.97.orig/netboot/osdep.h 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/osdep.h 2005-08-31 19:03:35.000000000 +0000
- @@ -1,94 +1,18 @@
- -#ifndef __OSDEP_H__
- -#define __OSDEP_H__
- +#ifndef _OSDEP_H
- +#define _OSDEP_H
-
- -/*
- - * This program is free software; you can redistribute it and/or
- - * modify it under the terms of the GNU General Public License as
- - * published by the Free Software Foundation; either version 2, or (at
- - * your option) any later version.
- - */
- +#define __unused __attribute__((unused))
- +#define __aligned __attribute__((aligned(16)))
-
- -#define __LITTLE_ENDIAN /* x86 */
- -
- -/* Taken from /usr/include/linux/hfs_sysdep.h */
- -#if defined(__BIG_ENDIAN)
- -# if !defined(__constant_htonl)
- -# define __constant_htonl(x) (x)
- -# endif
- -# if !defined(__constant_htons)
- -# define __constant_htons(x) (x)
- -# endif
- -#elif defined(__LITTLE_ENDIAN)
- -# if !defined(__constant_htonl)
- -# define __constant_htonl(x) \
- - ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
- - (((unsigned long int)(x) & 0x0000ff00U) << 8) | \
- - (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
- - (((unsigned long int)(x) & 0xff000000U) >> 24)))
- -# endif
- -# if !defined(__constant_htons)
- -# define __constant_htons(x) \
- - ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
- - (((unsigned short int)(x) & 0xff00) >> 8)))
- -# endif
- -#else
- -# error "Don't know if bytes are big- or little-endian!"
- -#endif
- -
- -#define ntohl(x) \
- -(__builtin_constant_p(x) ? \
- - __constant_htonl((x)) : \
- - __swap32(x))
- -#define htonl(x) \
- -(__builtin_constant_p(x) ? \
- - __constant_htonl((x)) : \
- - __swap32(x))
- -#define ntohs(x) \
- -(__builtin_constant_p(x) ? \
- - __constant_htons((x)) : \
- - __swap16(x))
- -#define htons(x) \
- -(__builtin_constant_p(x) ? \
- - __constant_htons((x)) : \
- - __swap16(x))
- -
- -static inline unsigned long int __swap32(unsigned long int x)
- -{
- - __asm__("xchgb %b0,%h0\n\t"
- - "rorl $16,%0\n\t"
- - "xchgb %b0,%h0"
- - : "=q" (x)
- - : "0" (x));
- - return x;
- -}
- -
- -static inline unsigned short int __swap16(unsigned short int x)
- -{
- - __asm__("xchgb %b0,%h0"
- - : "=q" (x)
- - : "0" (x));
- - return x;
- -}
- -
- -/* Make routines available to all */
- -#define swap32(x) __swap32(x)
- -#define swap16(x) __swap16(x)
- -
- -#include "linux-asm-io.h"
- -
- -typedef unsigned long Address;
- +#include "io.h"
- +#include "byteswap.h"
- +#include "latch.h"
-
- /* ANSI prototyping macro */
- #ifdef __STDC__
- -#define P(x) x
- +# define P(x) x
- #else
- -#define P(x) ()
- +# define P(x) ()
- #endif
-
- #endif
- -
- -/*
- - * Local variables:
- - * c-basic-offset: 8
- - * End:
- - */
- diff -Naur grub-0.97.orig/netboot/otulip.c grub-0.97/netboot/otulip.c
- --- grub-0.97.orig/netboot/otulip.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/otulip.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,374 +0,0 @@
- -/*
- - Etherboot DEC Tulip driver
- - adapted by Ken Yap from
- -
- - FreeBSD netboot DEC 21143 driver
- -
- - Author: David Sharp
- - date: Nov/98
- -
- - Known to work on DEC DE500 using 21143-PC chipset.
- - Even on cards with the same chipset there can be
- - incompatablity problems with the way media selection
- - and status LED settings are done. See comments below.
- -
- - Some code fragments were taken from verious places,
- - Ken Yap's etherboot, FreeBSD's if_de.c, and various
- - Linux related files. DEC's manuals for the 21143 and
- - SROM format were very helpful. The Linux de driver
- - development page has a number of links to useful
- - related information. Have a look at:
- - ftp://cesdis.gsfc.nasa.gov/pub/linux/drivers/tulip-devel.html
- -
- -*/
- -
- -#include "etherboot.h"
- -#include "nic.h"
- -#include "pci.h"
- -#include "cards.h"
- -#include "otulip.h"
- -
- -static unsigned short vendor, dev_id;
- -static unsigned short ioaddr;
- -static unsigned int *membase;
- -static unsigned char srom[1024];
- -
- -#define BUFLEN 1536 /* must be longword divisable */
- - /* buffers must be longword aligned */
- -
- -/* transmit descriptor and buffer */
- -static struct txdesc txd;
- -
- -/* receive descriptor(s) and buffer(s) */
- -#define NRXD 4
- -static struct rxdesc rxd[NRXD];
- -static int rxd_tail = 0;
- -#ifdef USE_LOWMEM_BUFFER
- -#define rxb ((char *)0x10000 - NRXD * BUFLEN)
- -#define txb ((char *)0x10000 - NRXD * BUFLEN - BUFLEN)
- -#else
- -static unsigned char rxb[NRXD * BUFLEN];
- -static unsigned char txb[BUFLEN];
- -#endif
- -
- -static unsigned char ehdr[ETH_HLEN]; /* buffer for ethernet header */
- -
- -enum tulip_offsets {
- - CSR0=0, CSR1=0x08, CSR2=0x10, CSR3=0x18, CSR4=0x20, CSR5=0x28,
- - CSR6=0x30, CSR7=0x38, CSR8=0x40, CSR9=0x48, CSR10=0x50, CSR11=0x58,
- - CSR12=0x60, CSR13=0x68, CSR14=0x70, CSR15=0x78 };
- -
- -
- -/***************************************************************************/
- -/* 21143 specific stuff */
- -/***************************************************************************/
- -
- -/* XXX assume 33MHz PCI bus, this is not very accurate and should be
- - used only with gross over estimations of required delay times unless
- - you tune UADJUST to your specific processor and I/O subsystem */
- -
- -#define UADJUST 870
- -static void udelay(unsigned long usec) {
- - unsigned long i;
- - for (i=((usec*UADJUST)/33)+1; i>0; i--) (void) TULIP_CSR_READ(csr_0);
- -}
- -
- -/* The following srom related code was taken from FreeBSD's if_de.c */
- -/* with minor alterations to make it work here. the Linux code is */
- -/* better but this was easier to use */
- -
- -static void delay_300ns(void)
- -{
- - int idx;
- - for (idx = (300 / 33) + 1; idx > 0; idx--)
- - (void) TULIP_CSR_READ(csr_busmode);
- -}
- -
- -#define EMIT do { TULIP_CSR_WRITE(csr_srom_mii, csr); delay_300ns(); } while (0)
- -
- -static void srom_idle(void)
- -{
- - unsigned bit, csr;
- -
- - csr = SROMSEL ; EMIT;
- - csr = SROMSEL | SROMRD; EMIT;
- - csr ^= SROMCS; EMIT;
- - csr ^= SROMCLKON; EMIT;
- - /*
- - * Write 25 cycles of 0 which will force the SROM to be idle.
- - */
- - for (bit = 3 + SROM_BITWIDTH + 16; bit > 0; bit--) {
- - csr ^= SROMCLKOFF; EMIT; /* clock low; data not valid */
- - csr ^= SROMCLKON; EMIT; /* clock high; data valid */
- - }
- - csr ^= SROMCLKOFF; EMIT;
- - csr ^= SROMCS; EMIT;
- - csr = 0; EMIT;
- -}
- -
- -static void srom_read(void)
- -{
- - unsigned idx;
- - const unsigned bitwidth = SROM_BITWIDTH;
- - const unsigned cmdmask = (SROMCMD_RD << bitwidth);
- - const unsigned msb = 1 << (bitwidth + 3 - 1);
- - unsigned lastidx = (1 << bitwidth) - 1;
- -
- - srom_idle();
- -
- - for (idx = 0; idx <= lastidx; idx++) {
- - unsigned lastbit, data, bits, bit, csr;
- - csr = SROMSEL ; EMIT;
- - csr = SROMSEL | SROMRD; EMIT;
- - csr ^= SROMCSON; EMIT;
- - csr ^= SROMCLKON; EMIT;
- -
- - lastbit = 0;
- - for (bits = idx|cmdmask, bit = bitwidth + 3; bit > 0; bit--, bits <<= 1)
- - {
- - const unsigned thisbit = bits & msb;
- - csr ^= SROMCLKOFF; EMIT; /* clock low; data not valid */
- - if (thisbit != lastbit) {
- - csr ^= SROMDOUT; EMIT; /* clock low; invert data */
- - } else {
- - EMIT;
- - }
- - csr ^= SROMCLKON; EMIT; /* clock high; data valid */
- - lastbit = thisbit;
- - }
- - csr ^= SROMCLKOFF; EMIT;
- -
- - for (data = 0, bits = 0; bits < 16; bits++) {
- - data <<= 1;
- - csr ^= SROMCLKON; EMIT; /* clock high; data valid */
- - data |= TULIP_CSR_READ(csr_srom_mii) & SROMDIN ? 1 : 0;
- - csr ^= SROMCLKOFF; EMIT; /* clock low; data not valid */
- - }
- - srom[idx*2] = data & 0xFF;
- - srom[idx*2+1] = data >> 8;
- - csr = SROMSEL | SROMRD; EMIT;
- - csr = 0; EMIT;
- - }
- - srom_idle();
- -}
- -
- -/**************************************************************************
- -ETH_RESET - Reset adapter
- -***************************************************************************/
- -static void tulip_reset(struct nic *nic)
- -{
- - int x,cnt=2;
- -
- - outl(0x00000001, ioaddr + CSR0);
- - udelay(1000);
- - /* turn off reset and set cache align=16lword, burst=unlimit */
- - outl(0x01A08000, ioaddr + CSR0);
- -
- - /* for some reason the media selection does not take
- - the first time se it is repeated. */
- -
- - while(cnt--) {
- - /* stop TX,RX processes */
- - if (cnt == 1)
- - outl(0x32404000, ioaddr + CSR6);
- - else
- - outl(0x32000040, ioaddr + CSR6);
- -
- - /* XXX - media selection is vendor specific and hard coded right
- - here. This should be fixed to use the hints in the SROM and
- - allow media selection by the user at runtime. MII support
- - should also be added. Support for chips other than the
- - 21143 should be added here as well */
- -
- - /* start set to 10Mbps half-duplex */
- -
- - /* setup SIA */
- - outl(0x0, ioaddr + CSR13); /* reset SIA */
- - outl(0x7f3f, ioaddr + CSR14);
- - outl(0x8000008, ioaddr + CSR15);
- - outl(0x0, ioaddr + CSR13);
- - outl(0x1, ioaddr + CSR13);
- - outl(0x2404000, ioaddr + CSR6);
- -
- - /* initalize GP */
- - outl(0x8af0008, ioaddr + CSR15);
- - outl(0x50008, ioaddr + CSR15);
- -
- - /* end set to 10Mbps half-duplex */
- -
- - if (vendor == PCI_VENDOR_ID_MACRONIX && dev_id == PCI_DEVICE_ID_MX987x5) {
- - /* do stuff for MX98715 */
- - outl(0x01a80000, ioaddr + CSR6);
- - outl(0xFFFFFFFF, ioaddr + CSR14);
- - outl(0x00001000, ioaddr + CSR12);
- - }
- -
- - outl(0x0, ioaddr + CSR7); /* disable interrupts */
- -
- - /* construct setup packet which is used by the 21143 to
- - program its CAM to recognize interesting MAC addresses */
- -
- - memset(&txd, 0, sizeof(struct txdesc));
- - txd.buf1addr = &txb[0];
- - txd.buf2addr = &txb[0]; /* just in case */
- - txd.buf1sz = 192; /* setup packet must be 192 bytes */
- - txd.buf2sz = 0;
- - txd.control = 0x020; /* setup packet */
- - txd.status = 0x80000000; /* give ownership to 21143 */
- -
- - /* construct perfect filter frame */
- - /* with mac address as first match */
- - /* and broadcast address for all others */
- -
- - for(x=0;x<192;x++) txb[x] = 0xff;
- - txb[0] = nic->node_addr[0];
- - txb[1] = nic->node_addr[1];
- - txb[4] = nic->node_addr[2];
- - txb[5] = nic->node_addr[3];
- - txb[8] = nic->node_addr[4];
- - txb[9] = nic->node_addr[5];
- - outl((unsigned long)&txd, ioaddr + CSR4); /* set xmit buf */
- - outl(0x2406000, ioaddr + CSR6); /* start transmiter */
- -
- - udelay(50000); /* wait for the setup packet to be processed */
- -
- - }
- -
- - /* setup receive descriptor */
- - {
- - int x;
- - for(x=0;x<NRXD;x++) {
- - memset(&rxd[x], 0, sizeof(struct rxdesc));
- - rxd[x].buf1addr = &rxb[x * BUFLEN];
- - rxd[x].buf2addr = 0; /* not used */
- - rxd[x].buf1sz = BUFLEN;
- - rxd[x].buf2sz = 0; /* not used */
- - rxd[x].control = 0x0;
- - rxd[x].status = 0x80000000; /* give ownership it to 21143 */
- - }
- - rxd[NRXD - 1].control = 0x008; /* Set Receive end of ring on la
- -st descriptor */
- - rxd_tail = 0;
- - }
- -
- - /* tell DC211XX where to find rx descriptor list */
- - outl((unsigned long)&rxd[0], ioaddr + CSR3);
- - /* start the receiver */
- - outl(0x2406002, ioaddr + CSR6);
- -
- -}
- -
- -/**************************************************************************
- -ETH_TRANSMIT - Transmit a frame
- -***************************************************************************/
- -static const char padmap[] = {
- - 0, 3, 2, 1};
- -
- -static void tulip_transmit(struct nic *nic, const char *d, unsigned int t, unsigned int s, const char *p)
- -{
- - unsigned long time;
- -
- - /* setup ethernet header */
- -
- - memcpy(ehdr, d, ETH_ALEN);
- - memcpy(&ehdr[ETH_ALEN], nic->node_addr, ETH_ALEN);
- - ehdr[ETH_ALEN*2] = (t >> 8) & 0xff;
- - ehdr[ETH_ALEN*2+1] = t & 0xff;
- -
- - /* setup the transmit descriptor */
- -
- - memset(&txd, 0, sizeof(struct txdesc));
- -
- - txd.buf1addr = &ehdr[0]; /* ethernet header */
- - txd.buf1sz = ETH_HLEN;
- -
- - txd.buf2addr = p; /* packet to transmit */
- - txd.buf2sz = s;
- -
- - txd.control = 0x188; /* LS+FS+TER */
- -
- - txd.status = 0x80000000; /* give it to 21143 */
- -
- - outl(inl(ioaddr + CSR6) & ~0x00004000, ioaddr + CSR6);
- - outl((unsigned long)&txd, ioaddr + CSR4);
- - outl(inl(ioaddr + CSR6) | 0x00004000, ioaddr + CSR6);
- -
- -/* Wait for transmit to complete before returning. not well tested.
- -
- - time = currticks();
- - while(txd.status & 0x80000000) {
- - if (currticks() - time > 20) {
- - printf("transmit timeout.\n");
- - break;
- - }
- - }
- -*/
- -
- -}
- -
- -/**************************************************************************
- -ETH_POLL - Wait for a frame
- -***************************************************************************/
- -static int tulip_poll(struct nic *nic)
- -{
- - if (rxd[rxd_tail].status & 0x80000000) return 0;
- -
- - nic->packetlen = (rxd[rxd_tail].status & 0x3FFF0000) >> 16;
- -
- - /* copy packet to working buffer */
- - /* XXX - this copy could be avoided with a little more work
- - but for now we are content with it because the optimised
- - memcpy(, , ) is quite fast */
- -
- - memcpy(nic->packet, rxb + rxd_tail * BUFLEN, nic->packetlen);
- -
- - /* return the descriptor and buffer to recieve ring */
- - rxd[rxd_tail].status = 0x80000000;
- - rxd_tail++;
- - if (rxd_tail == NRXD) rxd_tail = 0;
- -
- - return 1;
- -}
- -
- -static void tulip_disable(struct nic *nic)
- -{
- - /* nothing for the moment */
- -}
- -
- -/**************************************************************************
- -ETH_PROBE - Look for an adapter
- -***************************************************************************/
- -struct nic *otulip_probe(struct nic *nic, unsigned short *io_addrs, struct pci_device *pci)
- -{
- - int i;
- -
- - if (io_addrs == 0 || *io_addrs == 0)
- - return (0);
- - vendor = pci->vendor;
- - dev_id = pci->dev_id;
- - ioaddr = *io_addrs;
- - membase = (unsigned int *)pci->membase;
- -
- - /* wakeup chip */
- - pcibios_write_config_dword(pci->bus,pci->devfn,0x40,0x00000000);
- -
- - /* Stop the chip's Tx and Rx processes. */
- - /* outl(inl(ioaddr + CSR6) & ~0x2002, ioaddr + CSR6); */
- - /* Clear the missed-packet counter. */
- - /* (volatile int)inl(ioaddr + CSR8); */
- -
- - srom_read();
- -
- - for (i=0; i < ETH_ALEN; i++)
- - nic->node_addr[i] = srom[20+i];
- -
- - printf("Tulip %! at ioaddr %#hX\n", nic->node_addr, ioaddr);
- -
- - tulip_reset(nic);
- -
- - nic->reset = tulip_reset;
- - nic->poll = tulip_poll;
- - nic->transmit = tulip_transmit;
- - nic->disable = tulip_disable;
- - return nic;
- -}
- diff -Naur grub-0.97.orig/netboot/otulip.h grub-0.97/netboot/otulip.h
- --- grub-0.97.orig/netboot/otulip.h 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/otulip.h 1970-01-01 00:00:00.000000000 +0000
- @@ -1,76 +0,0 @@
- -/* mostly stolen from FreeBSD if_de.c, if_devar.h */
- -
- -#define TULIP_CSR_READ(csr) (membase[csr*2])
- -#define CSR_READ(csr) (membase[csr*2])
- -#define TULIP_CSR_WRITE(csr, val) (membase[csr*2] = val)
- -#define CSR_WRITE(csr, val) (membase[csr*2] = val)
- -
- -#define csr_0 0
- -#define csr_1 1
- -#define csr_2 2
- -#define csr_3 3
- -#define csr_4 4
- -#define csr_5 5
- -#define csr_6 6
- -#define csr_7 7
- -#define csr_8 8
- -#define csr_9 9
- -#define csr_10 10
- -#define csr_11 11
- -#define csr_12 12
- -#define csr_13 13
- -#define csr_14 14
- -#define csr_15 15
- -
- -#define csr_busmode csr_0
- -#define csr_txpoll csr_1
- -#define csr_rxpoll csr_2
- -#define csr_rxlist csr_3
- -#define csr_txlist csr_4
- -#define csr_status csr_5
- -#define csr_command csr_6
- -#define csr_intr csr_7
- -#define csr_missed_frames csr_8
- -#define csr_enetrom csr_9 /* 21040 */
- -#define csr_reserved csr_10 /* 21040 */
- -#define csr_full_duplex csr_11 /* 21040 */
- -#define csr_bootrom csr_10 /* 21041/21140A/?? */
- -#define csr_gp csr_12 /* 21140* */
- -#define csr_watchdog csr_15 /* 21140* */
- -#define csr_gp_timer csr_11 /* 21041/21140* */
- -#define csr_srom_mii csr_9 /* 21041/21140* */
- -#define csr_sia_status csr_12 /* 2104x */
- -#define csr_sia_connectivity csr_13 /* 2104x */
- -#define csr_sia_tx_rx csr_14 /* 2104x */
- -#define csr_sia_general csr_15 /* 2104x */
- -
- -#define SROMSEL 0x0800
- -#define SROMCS 0x0001
- -#define SROMCLKON 0x0002
- -#define SROMCLKOFF 0x0002
- -#define SROMRD 0x4000
- -#define SROMWR 0x2000
- -#define SROM_BITWIDTH 6
- -#define SROMCMD_RD 6
- -#define SROMCSON 0x0001
- -#define SROMDOUT 0x0004
- -#define SROMDIN 0x0008
- -
- -
- -struct txdesc {
- - unsigned long status; /* owner, status */
- - unsigned long buf1sz:11, /* size of buffer 1 */
- - buf2sz:11, /* size of buffer 2 */
- - control:10; /* control bits */
- - const unsigned char *buf1addr; /* buffer 1 address */
- - const unsigned char *buf2addr; /* buffer 2 address */
- -};
- -
- -struct rxdesc {
- - unsigned long status; /* owner, status */
- - unsigned long buf1sz:11, /* size of buffer 1 */
- - buf2sz:11, /* size of buffer 2 */
- - control:10; /* control bits */
- - unsigned char *buf1addr; /* buffer 1 address */
- - unsigned char *buf2addr; /* buffer 2 address */
- -};
- diff -Naur grub-0.97.orig/netboot/pci.c grub-0.97/netboot/pci.c
- --- grub-0.97.orig/netboot/pci.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/pci.c 2005-08-31 19:03:35.000000000 +0000
- @@ -1,15 +1,3 @@
- -/*
- -** Support for NE2000 PCI clones added David Monro June 1997
- -** Generalised to other NICs by Ken Yap July 1997
- -**
- -** Most of this is taken from:
- -**
- -** /usr/src/linux/drivers/pci/pci.c
- -** /usr/src/linux/include/linux/pci.h
- -** /usr/src/linux/arch/i386/bios32.c
- -** /usr/src/linux/include/linux/bios32.h
- -** /usr/src/linux/drivers/net/ne.c
- -*/
-
- /*
- * This program is free software; you can redistribute it and/or
- @@ -18,402 +6,294 @@
- * your option) any later version.
- */
-
- -#include "etherboot.h"
- +#include "grub.h"
- #include "pci.h"
-
- -/*#define DEBUG 1*/
- -#define DEBUG 0
- -
- -#ifdef CONFIG_PCI_DIRECT
- -#define PCIBIOS_SUCCESSFUL 0x00
- -
- -/*
- - * Functions for accessing PCI configuration space with type 1 accesses
- - */
- -
- -#define CONFIG_CMD(bus, device_fn, where) (0x80000000 | (bus << 16) | (device_fn << 8) | (where & ~3))
- -
- -int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn,
- - unsigned int where, unsigned char *value)
- +unsigned long virt_offset = 0;
- +unsigned long virt_to_phys(volatile const void *virt_addr)
- {
- - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- - *value = inb(0xCFC + (where&3));
- - return PCIBIOS_SUCCESSFUL;
- + return ((unsigned long)virt_addr) + virt_offset;
- }
-
- -int pcibios_read_config_word (unsigned int bus,
- - unsigned int device_fn, unsigned int where, unsigned short *value)
- +void *phys_to_virt(unsigned long phys_addr)
- {
- - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- - *value = inw(0xCFC + (where&2));
- - return PCIBIOS_SUCCESSFUL;
- + return (void *)(phys_addr - virt_offset);
- }
-
- -int pcibios_read_config_dword (unsigned int bus, unsigned int device_fn,
- - unsigned int where, unsigned int *value)
- -{
- - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- - *value = inl(0xCFC);
- - return PCIBIOS_SUCCESSFUL;
- -}
- +#ifdef INCLUDE_3C595
- +extern struct pci_driver t595_driver;
- +#endif /* INCLUDE_3C595 */
-
- -int pcibios_write_config_byte (unsigned int bus, unsigned int device_fn,
- - unsigned int where, unsigned char value)
- -{
- - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- - outb(value, 0xCFC + (where&3));
- - return PCIBIOS_SUCCESSFUL;
- -}
- +#ifdef INCLUDE_3C90X
- +extern struct pci_driver a3c90x_driver;
- +#endif /* INCLUDE_3C90X */
-
- -int pcibios_write_config_word (unsigned int bus, unsigned int device_fn,
- - unsigned int where, unsigned short value)
- -{
- - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- - outw(value, 0xCFC + (where&2));
- - return PCIBIOS_SUCCESSFUL;
- -}
- +#ifdef INCLUDE_DAVICOM
- +extern struct pci_driver davicom_driver;
- +#endif /* INCLUDE_DAVICOM */
-
- -int pcibios_write_config_dword (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned int value)
- -{
- - outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- - outl(value, 0xCFC);
- - return PCIBIOS_SUCCESSFUL;
- -}
- +#ifdef INCLUDE_E1000
- +extern struct pci_driver e1000_driver;
- +#endif /* INCLUDE_E1000 */
-
- -#undef CONFIG_CMD
- +#ifdef INCLUDE_EEPRO100
- +extern struct pci_driver eepro100_driver;
- +#endif /* INCLUDE_EEPRO100 */
-
- -#else /* CONFIG_PCI_DIRECT not defined */
- +#ifdef INCLUDE_EPIC100
- +extern struct pci_driver epic100_driver;
- +#endif /* INCLUDE_EPIC100 */
-
- -static struct {
- - unsigned long address;
- - unsigned short segment;
- -} bios32_indirect = { 0, KERN_CODE_SEG };
- -
- -static long pcibios_entry;
- -static struct {
- - unsigned long address;
- - unsigned short segment;
- -} pci_indirect = { 0, KERN_CODE_SEG };
- +#ifdef INCLUDE_FORCEDETH
- +extern struct pci_driver forcedeth_driver;
- +#endif /* INCLUDE_FORCEDETH */
-
- -static unsigned long bios32_service(unsigned long service)
- -{
- - unsigned char return_code; /* %al */
- - unsigned long address; /* %ebx */
- - unsigned long length; /* %ecx */
- - unsigned long entry; /* %edx */
- - unsigned long flags;
- -
- - save_flags(flags);
- - __asm__(
- -#ifdef ABSOLUTE_WITHOUT_ASTERISK
- - "lcall (%%edi)"
- -#else
- - "lcall *(%%edi)"
- -#endif
- - : "=a" (return_code),
- - "=b" (address),
- - "=c" (length),
- - "=d" (entry)
- - : "0" (service),
- - "1" (0),
- - "D" (&bios32_indirect));
- - restore_flags(flags);
- -
- - switch (return_code) {
- - case 0:
- - return address + entry;
- - case 0x80: /* Not present */
- - printf("bios32_service(%d) : not present\n", service);
- - return 0;
- - default: /* Shouldn't happen */
- - printf("bios32_service(%d) : returned %#X, mail drew@colorado.edu\n",
- - service, return_code);
- - return 0;
- - }
- -}
- +#ifdef INCLUDE_NATSEMI
- +extern struct pci_driver natsemi_driver;
- +#endif /* INCLUDE_NATSEMI */
-
- -int pcibios_read_config_byte(unsigned int bus,
- - unsigned int device_fn, unsigned int where, unsigned char *value)
- -{
- - unsigned long ret;
- - unsigned long bx = (bus << 8) | device_fn;
- - unsigned long flags;
- -
- - save_flags(flags);
- - __asm__(
- -#ifdef ABSOLUTE_WITHOUT_ASTERISK
- - "lcall (%%esi)\n\t"
- -#else
- - "lcall *(%%esi)\n\t"
- -#endif
- - "jc 1f\n\t"
- - "xor %%ah, %%ah\n"
- - "1:"
- - : "=c" (*value),
- - "=a" (ret)
- - : "1" (PCIBIOS_READ_CONFIG_BYTE),
- - "b" (bx),
- - "D" ((long) where),
- - "S" (&pci_indirect));
- - restore_flags(flags);
- - return (int) (ret & 0xff00) >> 8;
- -}
- +#ifdef INCLUDE_NS83820
- +extern struct pci_driver ns83820_driver;
- +#endif /* INCLUDE_NS83820 */
-
- -int pcibios_read_config_word(unsigned int bus,
- - unsigned int device_fn, unsigned int where, unsigned short *value)
- -{
- - unsigned long ret;
- - unsigned long bx = (bus << 8) | device_fn;
- - unsigned long flags;
- -
- - save_flags(flags);
- - __asm__(
- -#ifdef ABSOLUTE_WITHOUT_ASTERISK
- - "lcall (%%esi)\n\t"
- -#else
- - "lcall *(%%esi)\n\t"
- -#endif
- - "jc 1f\n\t"
- - "xor %%ah, %%ah\n"
- - "1:"
- - : "=c" (*value),
- - "=a" (ret)
- - : "1" (PCIBIOS_READ_CONFIG_WORD),
- - "b" (bx),
- - "D" ((long) where),
- - "S" (&pci_indirect));
- - restore_flags(flags);
- - return (int) (ret & 0xff00) >> 8;
- -}
- +#ifdef INCLUDE_NS8390
- +extern struct pci_driver nepci_driver;
- +#endif /* INCLUDE_NS8390 */
-
- -int pcibios_read_config_dword(unsigned int bus,
- - unsigned int device_fn, unsigned int where, unsigned int *value)
- -{
- - unsigned long ret;
- - unsigned long bx = (bus << 8) | device_fn;
- - unsigned long flags;
- -
- - save_flags(flags);
- - __asm__(
- -#ifdef ABSOLUTE_WITHOUT_ASTERISK
- - "lcall (%%esi)\n\t"
- -#else
- - "lcall *(%%esi)\n\t"
- -#endif
- - "jc 1f\n\t"
- - "xor %%ah, %%ah\n"
- - "1:"
- - : "=c" (*value),
- - "=a" (ret)
- - : "1" (PCIBIOS_READ_CONFIG_DWORD),
- - "b" (bx),
- - "D" ((long) where),
- - "S" (&pci_indirect));
- - restore_flags(flags);
- - return (int) (ret & 0xff00) >> 8;
- -}
- +#ifdef INCLUDE_PCNET32
- +extern struct pci_driver pcnet32_driver;
- +#endif /* INCLUDE_PCNET32 */
-
- -int pcibios_write_config_byte (unsigned int bus,
- - unsigned int device_fn, unsigned int where, unsigned char value)
- -{
- - unsigned long ret;
- - unsigned long bx = (bus << 8) | device_fn;
- - unsigned long flags;
- -
- - save_flags(flags); cli();
- - __asm__(
- -#ifdef ABSOLUTE_WITHOUT_ASTERISK
- - "lcall (%%esi)\n\t"
- -#else
- - "lcall *(%%esi)\n\t"
- -#endif
- - "jc 1f\n\t"
- - "xor %%ah, %%ah\n"
- - "1:"
- - : "=a" (ret)
- - : "0" (PCIBIOS_WRITE_CONFIG_BYTE),
- - "c" (value),
- - "b" (bx),
- - "D" ((long) where),
- - "S" (&pci_indirect));
- - restore_flags(flags);
- - return (int) (ret & 0xff00) >> 8;
- -}
- +#ifdef INCLUDE_PNIC
- +extern struct pci_driver pnic_driver;
- +#endif /* INCLUDE_PNIC */
-
- -int pcibios_write_config_word (unsigned int bus,
- - unsigned int device_fn, unsigned int where, unsigned short value)
- -{
- - unsigned long ret;
- - unsigned long bx = (bus << 8) | device_fn;
- - unsigned long flags;
- -
- - save_flags(flags); cli();
- - __asm__(
- -#ifdef ABSOLUTE_WITHOUT_ASTERISK
- - "lcall (%%esi)\n\t"
- -#else
- - "lcall *(%%esi)\n\t"
- -#endif
- - "jc 1f\n\t"
- - "xor %%ah, %%ah\n"
- - "1:"
- - : "=a" (ret)
- - : "0" (PCIBIOS_WRITE_CONFIG_WORD),
- - "c" (value),
- - "b" (bx),
- - "D" ((long) where),
- - "S" (&pci_indirect));
- - restore_flags(flags);
- - return (int) (ret & 0xff00) >> 8;
- -}
- +#ifdef INCLUDE_RTL8139
- +extern struct pci_driver rtl8139_driver;
- +#endif /* INCLUDE_RTL8139 */
-
- -int pcibios_write_config_dword (unsigned int bus,
- - unsigned int device_fn, unsigned int where, unsigned int value)
- -{
- - unsigned long ret;
- - unsigned long bx = (bus << 8) | device_fn;
- - unsigned long flags;
- -
- - save_flags(flags); cli();
- - __asm__(
- -#ifdef ABSOLUTE_WITHOUT_ASTERISK
- - "lcall (%%esi)\n\t"
- -#else
- - "lcall *(%%esi)\n\t"
- -#endif
- - "jc 1f\n\t"
- - "xor %%ah, %%ah\n"
- - "1:"
- - : "=a" (ret)
- - : "0" (PCIBIOS_WRITE_CONFIG_DWORD),
- - "c" (value),
- - "b" (bx),
- - "D" ((long) where),
- - "S" (&pci_indirect));
- - restore_flags(flags);
- - return (int) (ret & 0xff00) >> 8;
- -}
- +#ifdef INCLUDE_SIS900
- +extern struct pci_driver sis900_driver;
- +extern struct pci_driver sis_bridge_driver;
- +#endif /* INCLUDE_SIS900 */
-
- -static void check_pcibios(void)
- -{
- - unsigned long signature;
- - unsigned char present_status;
- - unsigned char major_revision;
- - unsigned char minor_revision;
- - unsigned long flags;
- - int pack;
- -
- - if ((pcibios_entry = bios32_service(PCI_SERVICE))) {
- - pci_indirect.address = pcibios_entry;
- -
- - save_flags(flags);
- - __asm__(
- -#ifdef ABSOLUTE_WITHOUT_ASTERISK
- - "lcall (%%edi)\n\t"
- -#else
- - "lcall *(%%edi)\n\t"
- -#endif
- - "jc 1f\n\t"
- - "xor %%ah, %%ah\n"
- - "1:\tshl $8, %%eax\n\t"
- - "movw %%bx, %%ax"
- - : "=d" (signature),
- - "=a" (pack)
- - : "1" (PCIBIOS_PCI_BIOS_PRESENT),
- - "D" (&pci_indirect)
- - : "bx", "cx");
- - restore_flags(flags);
- -
- - present_status = (pack >> 16) & 0xff;
- - major_revision = (pack >> 8) & 0xff;
- - minor_revision = pack & 0xff;
- - if (present_status || (signature != PCI_SIGNATURE)) {
- - printf("ERROR: BIOS32 says PCI BIOS, but no PCI "
- - "BIOS????\n");
- - pcibios_entry = 0;
- - }
- -#if DEBUG
- - if (pcibios_entry) {
- - printf ("pcibios_init : PCI BIOS revision %hhX.%hhX"
- - " entry at %#X\n", major_revision,
- - minor_revision, pcibios_entry);
- - }
- -#endif
- - }
- -}
- +#ifdef INCLUDE_SUNDANCE
- +extern struct pci_driver sundance_driver;
- +#endif /* INCLUDE_SUNDANCE */
-
- -static void pcibios_init(void)
- -{
- - union bios32 *check;
- - unsigned char sum;
- - int i, length;
- - unsigned long bios32_entry = 0;
- -
- - /*
- - * Follow the standard procedure for locating the BIOS32 Service
- - * directory by scanning the permissible address range from
- - * 0xe0000 through 0xfffff for a valid BIOS32 structure.
- - *
- - */
- +#ifdef INCLUDE_TG3
- +extern struct pci_driver tg3_driver;
- +#endif /* INCLUDE_TG3 */
- +
- +#ifdef INCLUDE_TLAN
- +extern struct pci_driver tlan_driver;
- +#endif /* INCLUDE_TLAN */
- +
- +#ifdef INCLUDE_TULIP
- +extern struct pci_driver tulip_driver;
- +#endif /* INCLUDE_TULIP */
- +
- +#ifdef INCLUDE_UNDI
- +extern struct pci_driver undi_driver;
- +#endif /* INCLUDE_UNDI */
- +
- +#ifdef INCLUDE_VIA_RHINE
- +extern struct pci_driver rhine_driver;
- +#endif/* INCLUDE_VIA_RHINE */
- +
- +#ifdef INCLUDE_W89C840
- +extern struct pci_driver w89c840_driver;
- +#endif /* INCLUDE_W89C840 */
- +
- +#ifdef INCLUDE_R8169
- +extern struct pci_driver r8169_driver;
- +#endif /* INCLUDE_R8169 */
- +
- +static const struct pci_driver *pci_drivers[] = {
- +
- +#ifdef INCLUDE_3C595
- + &t595_driver,
- +#endif /* INCLUDE_3C595 */
- +
- +#ifdef INCLUDE_3C90X
- + &a3c90x_driver,
- +#endif /* INCLUDE_3C90X */
- +
- +#ifdef INCLUDE_DAVICOM
- + &davicom_driver,
- +#endif /* INCLUDE_DAVICOM */
- +
- +#ifdef INCLUDE_E1000
- + &e1000_driver,
- +#endif /* INCLUDE_E1000 */
- +
- +#ifdef INCLUDE_EEPRO100
- + &eepro100_driver,
- +#endif /* INCLUDE_EEPRO100 */
- +
- +#ifdef INCLUDE_EPIC100
- + &epic100_driver,
- +#endif /* INCLUDE_EPIC100 */
- +
- +#ifdef INCLUDE_FORCEDETH
- + &forcedeth_driver,
- +#endif /* INCLUDE_FORCEDETH */
- +
- +#ifdef INCLUDE_NATSEMI
- + &natsemi_driver,
- +#endif /* INCLUDE_NATSEMI */
- +
- +#ifdef INCLUDE_NS83820
- + &ns83820_driver,
- +#endif /* INCLUDE_NS83820 */
- +
- +#ifdef INCLUDE_NS8390
- + &nepci_driver,
- +#endif /* INCLUDE_NS8390 */
- +
- +#ifdef INCLUDE_PCNET32
- + &pcnet32_driver,
- +#endif /* INCLUDE_PCNET32 */
- +
- +#ifdef INCLUDE_PNIC
- + &pnic_driver,
- +#endif /* INCLUDE_PNIC */
-
- - for (check = (union bios32 *) 0xe0000; check <= (union bios32 *) 0xffff0; ++check) {
- - if (check->fields.signature != BIOS32_SIGNATURE)
- +#ifdef INCLUDE_RTL8139
- + &rtl8139_driver,
- +#endif /* INCLUDE_RTL8139 */
- +
- +#ifdef INCLUDE_SIS900
- + &sis900_driver,
- + &sis_bridge_driver,
- +#endif /* INCLUDE_SIS900 */
- +
- +#ifdef INCLUDE_SUNDANCE
- + &sundance_driver,
- +#endif /* INCLUDE_SUNDANCE */
- +
- +#ifdef INCLUDE_TG3
- + & tg3_driver,
- +#endif /* INCLUDE_TG3 */
- +
- +#ifdef INCLUDE_TLAN
- + &tlan_driver,
- +#endif /* INCLUDE_TLAN */
- +
- +#ifdef INCLUDE_TULIP
- + & tulip_driver,
- +#endif /* INCLUDE_TULIP */
- +
- +#ifdef INCLUDE_VIA_RHINE
- + &rhine_driver,
- +#endif/* INCLUDE_VIA_RHINE */
- +
- +#ifdef INCLUDE_W89C840
- + &w89c840_driver,
- +#endif /* INCLUDE_W89C840 */
- +
- +#ifdef INCLUDE_R8169
- + &r8169_driver,
- +#endif /* INCLUDE_R8169 */
- +
- +/* We must be the last one */
- +#ifdef INCLUDE_UNDI
- + &undi_driver,
- +#endif /* INCLUDE_UNDI */
- +
- + 0
- +};
- +
- +static void scan_drivers(
- + int type,
- + uint32_t class, uint16_t vendor, uint16_t device,
- + const struct pci_driver *last_driver, struct pci_device *dev)
- +{
- + const struct pci_driver *skip_driver = last_driver;
- + /* Assume there is only one match of the correct type */
- + const struct pci_driver *driver;
- + int i, j;
- +
- + for(j = 0; pci_drivers[j] != 0; j++){
- + driver = pci_drivers[j];
- + if (driver->type != type)
- continue;
- - length = check->fields.length * 16;
- - if (!length)
- + if (skip_driver) {
- + if (skip_driver == driver)
- + skip_driver = 0;
- continue;
- - sum = 0;
- - for (i = 0; i < length ; ++i)
- - sum += check->chars[i];
- - if (sum != 0)
- + }
- + for(i = 0; i < driver->id_count; i++) {
- + if ((vendor == driver->ids[i].vendor) &&
- + (device == driver->ids[i].dev_id)) {
- +
- + dev->driver = driver;
- + dev->name = driver->ids[i].name;
- +
- + goto out;
- + }
- + }
- + }
- + if (!class) {
- + goto out;
- + }
- + for(j = 0; pci_drivers[j] != 0; j++){
- + driver = pci_drivers[j];
- + if (driver->type != type)
- continue;
- - if (check->fields.revision != 0) {
- - printf("pcibios_init : unsupported revision %d at %#X, mail drew@colorado.edu\n",
- - check->fields.revision, check);
- + if (skip_driver) {
- + if (skip_driver == driver)
- + skip_driver = 0;
- continue;
- }
- -#if DEBUG
- - printf("pcibios_init : BIOS32 Service Directory "
- - "structure at %#X\n", check);
- -#endif
- - if (!bios32_entry) {
- - if (check->fields.entry >= 0x100000) {
- - printf("pcibios_init: entry in high "
- - "memory, giving up\n");
- - return;
- - } else {
- - bios32_entry = check->fields.entry;
- -#if DEBUG
- - printf("pcibios_init : BIOS32 Service Directory"
- - " entry at %#X\n", bios32_entry);
- -#endif
- - bios32_indirect.address = bios32_entry;
- - }
- + if (last_driver == driver)
- + continue;
- + if ((class >> 8) == driver->class) {
- + dev->driver = driver;
- + dev->name = driver->name;
- + goto out;
- }
- }
- - if (bios32_entry)
- - check_pcibios();
- + out:
- + return;
- }
- -#endif /* CONFIG_PCI_DIRECT not defined*/
-
- -static void scan_bus(struct pci_device *pcidev)
- +void scan_pci_bus(int type, struct pci_device *dev)
- {
- - unsigned int devfn, l, bus, buses;
- + unsigned int first_bus, first_devfn;
- + const struct pci_driver *first_driver;
- + unsigned int devfn, bus, buses;
- unsigned char hdr_type = 0;
- - unsigned short vendor, device;
- - unsigned int membase, ioaddr, romaddr;
- - int i, reg;
- - unsigned int pci_ioaddr = 0;
- -
- + uint32_t class;
- + uint16_t vendor, device;
- + uint32_t l, membase, ioaddr, romaddr;
- + int reg;
- +
- + EnterFunction("scan_pci_bus");
- + first_bus = 0;
- + first_devfn = 0;
- + first_driver = 0;
- + if (dev->driver) {
- + first_driver = dev->driver;
- + first_bus = dev->bus;
- + first_devfn = dev->devfn;
- + /* Re read the header type on a restart */
- + pcibios_read_config_byte(first_bus, first_devfn & ~0x7,
- + PCI_HEADER_TYPE, &hdr_type);
- + dev->driver = 0;
- + dev->bus = 0;
- + dev->devfn = 0;
- + }
- +
- /* Scan all PCI buses, until we find our card.
- - * We could be smart only scan the required busses but that
- + * We could be smart only scan the required buses but that
- * is error prone, and tricky.
- - * By scanning all possible pci busses in order we should find
- + * By scanning all possible pci buses in order we should find
- * our card eventually.
- */
- buses=256;
- - for (bus = 0; bus < buses; ++bus) {
- - for (devfn = 0; devfn < 0xff; ++devfn) {
- + for (bus = first_bus; bus < buses; ++bus) {
- + for (devfn = first_devfn; devfn < 0xff; ++devfn, first_driver = 0) {
- if (PCI_FUNC (devfn) == 0)
- pcibios_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type);
- else if (!(hdr_type & 0x80)) /* not a multi-function device */
- @@ -421,61 +301,90 @@
- pcibios_read_config_dword(bus, devfn, PCI_VENDOR_ID, &l);
- /* some broken boards return 0 if a slot is empty: */
- if (l == 0xffffffff || l == 0x00000000) {
- - hdr_type = 0;
- continue;
- }
- vendor = l & 0xffff;
- device = (l >> 16) & 0xffff;
-
- + pcibios_read_config_dword(bus, devfn, PCI_REVISION, &l);
- + class = (l >> 8) & 0xffffff;
- #if DEBUG
- - printf("bus %hhX, function %hhX, vendor %hX, device %hX\n",
- - bus, devfn, vendor, device);
- + {
- + int i;
- + printf("%hhx:%hhx.%hhx [%hX/%hX] ---- ",
- + bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
- + vendor, device);
- +#if DEBUG > 1
- + for(i = 0; i < 256; i++) {
- + unsigned char byte;
- + if ((i & 0xf) == 0) {
- + printf("%hhx: ", i);
- + }
- + pcibios_read_config_byte(bus, devfn, i, &byte);
- + printf("%hhx ", byte);
- + if ((i & 0xf) == 0xf) {
- + printf("\n");
- + }
- + }
- +#endif
- +
- + }
- +#endif
- + scan_drivers(type, class, vendor, device, first_driver, dev);
- + if (!dev->driver){
- +#if DEBUG
- + printf("No driver fit.\n");
- #endif
- - for (i = 0; pcidev[i].vendor != 0; i++) {
- - if (vendor != pcidev[i].vendor
- - || device != pcidev[i].dev_id)
- + continue;
- + }
- +#if DEBUG
- + printf("Get Driver:\n");
- +#endif
- + dev->devfn = devfn;
- + dev->bus = bus;
- + dev->class = class;
- + dev->vendor = vendor;
- + dev->dev_id = device;
- +
- +
- + /* Get the ROM base address */
- + pcibios_read_config_dword(bus, devfn,
- + PCI_ROM_ADDRESS, &romaddr);
- + romaddr >>= 10;
- + dev->romaddr = romaddr;
- +
- + /* Get the ``membase'' */
- + pcibios_read_config_dword(bus, devfn,
- + PCI_BASE_ADDRESS_1, &membase);
- + dev->membase = membase;
- +
- + /* Get the ``ioaddr'' */
- + for (reg = PCI_BASE_ADDRESS_0; reg <= PCI_BASE_ADDRESS_5; reg += 4) {
- + pcibios_read_config_dword(bus, devfn, reg, &ioaddr);
- + if ((ioaddr & PCI_BASE_ADDRESS_IO_MASK) == 0 || (ioaddr & PCI_BASE_ADDRESS_SPACE_IO) == 0)
- continue;
- - pcidev[i].devfn = devfn;
- - pcidev[i].bus = bus;
- - for (reg = PCI_BASE_ADDRESS_0; reg <= PCI_BASE_ADDRESS_5; reg += 4) {
- - pcibios_read_config_dword(bus, devfn, reg, &ioaddr);
- -
- - if ((ioaddr & PCI_BASE_ADDRESS_IO_MASK) == 0 || (ioaddr & PCI_BASE_ADDRESS_SPACE_IO) == 0)
- - continue;
- - /* Strip the I/O address out of the returned value */
- - ioaddr &= PCI_BASE_ADDRESS_IO_MASK;
- - /* Get the memory base address */
- - pcibios_read_config_dword(bus, devfn,
- - PCI_BASE_ADDRESS_1, &membase);
- - /* Get the ROM base address */
- - pcibios_read_config_dword(bus, devfn, PCI_ROM_ADDRESS, &romaddr);
- - romaddr >>= 10;
- - printf("Found %s at %#hx, ROM address %#hx\n",
- - pcidev[i].name, ioaddr, romaddr);
- - /* Take the first one or the one that matches in boot ROM address */
- - if (pci_ioaddr == 0 || romaddr == ((unsigned long) rom.rom_segment << 4)) {
- - pcidev[i].membase = membase;
- - pcidev[i].ioaddr = ioaddr;
- - return;
- - }
- - }
- +
- +
- + /* Strip the I/O address out of the returned value */
- + ioaddr &= PCI_BASE_ADDRESS_IO_MASK;
- +
- + /* Take the first one or the one that matches in boot ROM address */
- + dev->ioaddr = ioaddr;
- }
- +#if DEBUG > 2
- + printf("Found %s ROM address %#hx\n",
- + dev->name, romaddr);
- +#endif
- + LeaveFunction("scan_pci_bus");
- + return;
- }
- + first_devfn = 0;
- }
- + first_bus = 0;
- + LeaveFunction("scan_pci_bus");
- }
-
- -void eth_pci_init(struct pci_device *pcidev)
- -{
- -#ifndef CONFIG_PCI_DIRECT
- - pcibios_init();
- - if (!pcibios_entry) {
- - printf("pci_init: no BIOS32 detected\n");
- - return;
- - }
- -#endif
- - scan_bus(pcidev);
- - /* return values are in pcidev structures */
- -}
- +
-
- /*
- * Set device to be a busmaster in case BIOS neglected to do so.
- @@ -489,13 +398,134 @@
- pcibios_read_config_word(p->bus, p->devfn, PCI_COMMAND, &pci_command);
- new_command = pci_command | PCI_COMMAND_MASTER|PCI_COMMAND_IO;
- if (pci_command != new_command) {
- - printf("The PCI BIOS has not enabled this device!\nUpdating PCI command %hX->%hX. pci_bus %hhX pci_device_fn %hhX\n",
- +#if DEBUG > 0
- + printf(
- + "The PCI BIOS has not enabled this device!\n"
- + "Updating PCI command %hX->%hX. pci_bus %hhX pci_device_fn %hhX\n",
- pci_command, new_command, p->bus, p->devfn);
- +#endif
- pcibios_write_config_word(p->bus, p->devfn, PCI_COMMAND, new_command);
- }
- pcibios_read_config_byte(p->bus, p->devfn, PCI_LATENCY_TIMER, &pci_latency);
- if (pci_latency < 32) {
- - printf("PCI latency timer (CFLT) is unreasonably low at %d. Setting to 32 clocks.\n", pci_latency);
- +#if DEBUG > 0
- + printf("PCI latency timer (CFLT) is unreasonably low at %d. Setting to 32 clocks.\n",
- + pci_latency);
- +#endif
- pcibios_write_config_byte(p->bus, p->devfn, PCI_LATENCY_TIMER, 32);
- }
- }
- +
- +/*
- + * Find the start of a pci resource.
- + */
- +unsigned long pci_bar_start(struct pci_device *dev, unsigned int index)
- +{
- + uint32_t lo, hi;
- + unsigned long bar;
- + pci_read_config_dword(dev, index, &lo);
- + if (lo & PCI_BASE_ADDRESS_SPACE_IO) {
- + bar = lo & PCI_BASE_ADDRESS_IO_MASK;
- + } else {
- + bar = 0;
- + if ((lo & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == PCI_BASE_ADDRESS_MEM_TYPE_64) {
- + pci_read_config_dword(dev, index + 4, &hi);
- + if (hi) {
- + if (sizeof(unsigned long) > sizeof(uint32_t)) {
- + bar = hi;
- + /* It's REALLY interesting:-) */
- + bar <<=32;
- + }
- + else {
- + printf("Unhandled 64bit BAR\n");
- + return -1UL;
- + }
- + }
- + }
- + bar |= lo & PCI_BASE_ADDRESS_MEM_MASK;
- + }
- + return bar + pcibios_bus_base(dev->bus);
- +}
- +
- +/*
- + * Find the size of a pci resource.
- + */
- +unsigned long pci_bar_size(struct pci_device *dev, unsigned int bar)
- +{
- + uint32_t start, size;
- + /* Save the original bar */
- + pci_read_config_dword(dev, bar, &start);
- + /* Compute which bits can be set */
- + pci_write_config_dword(dev, bar, ~0);
- + pci_read_config_dword(dev, bar, &size);
- + /* Restore the original size */
- + pci_write_config_dword(dev, bar, start);
- + /* Find the significant bits */
- + if (start & PCI_BASE_ADDRESS_SPACE_IO) {
- + size &= PCI_BASE_ADDRESS_IO_MASK;
- + } else {
- + size &= PCI_BASE_ADDRESS_MEM_MASK;
- + }
- + /* Find the lowest bit set */
- + size = size & ~(size - 1);
- + return size;
- +}
- +
- +/**
- + * pci_find_capability - query for devices' capabilities
- + * @dev: PCI device to query
- + * @cap: capability code
- + *
- + * Tell if a device supports a given PCI capability.
- + * Returns the address of the requested capability structure within the
- + * device's PCI configuration space or 0 in case the device does not
- + * support it. Possible values for @cap:
- + *
- + * %PCI_CAP_ID_PM Power Management
- + *
- + * %PCI_CAP_ID_AGP Accelerated Graphics Port
- + *
- + * %PCI_CAP_ID_VPD Vital Product Data
- + *
- + * %PCI_CAP_ID_SLOTID Slot Identification
- + *
- + * %PCI_CAP_ID_MSI Message Signalled Interrupts
- + *
- + * %PCI_CAP_ID_CHSWP CompactPCI HotSwap
- + */
- +int pci_find_capability(struct pci_device *dev, int cap)
- +{
- + uint16_t status;
- + uint8_t pos, id;
- + uint8_t hdr_type;
- + int ttl = 48;
- +
- + pci_read_config_word(dev, PCI_STATUS, &status);
- + if (!(status & PCI_STATUS_CAP_LIST))
- + return 0;
- + pci_read_config_byte(dev, PCI_HEADER_TYPE, &hdr_type);
- + switch (hdr_type & 0x7F) {
- + case PCI_HEADER_TYPE_NORMAL:
- + case PCI_HEADER_TYPE_BRIDGE:
- + default:
- + pci_read_config_byte(dev, PCI_CAPABILITY_LIST, &pos);
- + break;
- + case PCI_HEADER_TYPE_CARDBUS:
- + pci_read_config_byte(dev, PCI_CB_CAPABILITY_LIST, &pos);
- + break;
- + }
- + while (ttl-- && pos >= 0x40) {
- + pos &= ~3;
- + pci_read_config_byte(dev, pos + PCI_CAP_LIST_ID, &id);
- +#if DEBUG > 0
- + printf("Capability: %d\n", id);
- +#endif
- + if (id == 0xff)
- + break;
- + if (id == cap)
- + return pos;
- + pci_read_config_byte(dev, pos + PCI_CAP_LIST_NEXT, &pos);
- + }
- + return 0;
- +}
- +
- diff -Naur grub-0.97.orig/netboot/pci.h grub-0.97/netboot/pci.h
- --- grub-0.97.orig/netboot/pci.h 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/pci.h 2005-08-31 21:31:46.000000000 +0000
- @@ -1,4 +1,4 @@
- -#ifndef PCI_H
- +#if !defined(PCI_H) && defined(CONFIG_PCI)
- #define PCI_H
-
- /*
- @@ -21,10 +21,19 @@
- * your option) any later version.
- */
-
- +#include "pci_ids.h"
- +
- #define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
- #define PCI_COMMAND_MEM 0x2 /* Enable response in mem space */
- #define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */
- #define PCI_LATENCY_TIMER 0x0d /* 8 bits */
- +#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */
- +#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */
- +#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */
- +#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */
- +#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */
- +#define PCI_COMMAND_SERR 0x100 /* Enable SERR */
- +#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */
-
- #define PCIBIOS_PCI_FUNCTION_ID 0xb1XX
- #define PCIBIOS_PCI_BIOS_PRESENT 0xb101
- @@ -42,10 +51,37 @@
- #define PCI_DEVICE_ID 0x02 /* 16 bits */
- #define PCI_COMMAND 0x04 /* 16 bits */
-
- +#define PCI_STATUS 0x06 /* 16 bits */
- +#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
- +#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */
- +#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */
- +#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */
- +#define PCI_STATUS_PARITY 0x100 /* Detected parity error */
- +#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */
- +#define PCI_STATUS_DEVSEL_FAST 0x000
- +#define PCI_STATUS_DEVSEL_MEDIUM 0x200
- +#define PCI_STATUS_DEVSEL_SLOW 0x400
- +#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */
- +#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */
- +#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */
- +#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */
- +#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */
- +
- #define PCI_REVISION 0x08 /* 8 bits */
- +#define PCI_REVISION_ID 0x08 /* 8 bits */
- +#define PCI_CLASS_REVISION 0x08 /* 32 bits */
- #define PCI_CLASS_CODE 0x0b /* 8 bits */
- #define PCI_SUBCLASS_CODE 0x0a /* 8 bits */
- #define PCI_HEADER_TYPE 0x0e /* 8 bits */
- +#define PCI_HEADER_TYPE_NORMAL 0
- +#define PCI_HEADER_TYPE_BRIDGE 1
- +#define PCI_HEADER_TYPE_CARDBUS 2
- +
- +
- +/* Header type 0 (normal devices) */
- +#define PCI_CARDBUS_CIS 0x28
- +#define PCI_SUBSYSTEM_VENDOR_ID 0x2c
- +#define PCI_SUBSYSTEM_ID 0x2e
-
- #define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */
- #define PCI_BASE_ADDRESS_1 0x14 /* 32 bits */
- @@ -54,15 +90,155 @@
- #define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */
- #define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */
-
- +#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06
- +#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */
- +#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */
- +#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */
- +
- #ifndef PCI_BASE_ADDRESS_IO_MASK
- #define PCI_BASE_ADDRESS_IO_MASK (~0x03)
- #endif
- +#ifndef PCI_BASE_ADDRESS_MEM_MASK
- +#define PCI_BASE_ADDRESS_MEM_MASK (~0x0f)
- +#endif
- #define PCI_BASE_ADDRESS_SPACE_IO 0x01
- #define PCI_ROM_ADDRESS 0x30 /* 32 bits */
- #define PCI_ROM_ADDRESS_ENABLE 0x01 /* Write 1 to enable ROM,
- bits 31..11 are address,
- 10..2 are reserved */
-
- +#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */
- +
- +#define PCI_INTERRUPT_LINE 0x3c /* IRQ number (0-15) */
- +#define PCI_INTERRUPT_PIN 0x3d /* IRQ pin on PCI bus (A-D) */
- +
- +/* Header type 1 (PCI-to-PCI bridges) */
- +#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */
- +#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */
- +#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */
- +#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */
- +#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */
- +#define PCI_IO_LIMIT 0x1d
- +#define PCI_IO_RANGE_TYPE_MASK 0x0f /* I/O bridging type */
- +#define PCI_IO_RANGE_TYPE_16 0x00
- +#define PCI_IO_RANGE_TYPE_32 0x01
- +#define PCI_IO_RANGE_MASK ~0x0f
- +#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */
- +#define PCI_MEMORY_BASE 0x20 /* Memory range behind */
- +#define PCI_MEMORY_LIMIT 0x22
- +#define PCI_MEMORY_RANGE_TYPE_MASK 0x0f
- +#define PCI_MEMORY_RANGE_MASK ~0x0f
- +#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */
- +#define PCI_PREF_MEMORY_LIMIT 0x26
- +#define PCI_PREF_RANGE_TYPE_MASK 0x0f
- +#define PCI_PREF_RANGE_TYPE_32 0x00
- +#define PCI_PREF_RANGE_TYPE_64 0x01
- +#define PCI_PREF_RANGE_MASK ~0x0f
- +#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */
- +#define PCI_PREF_LIMIT_UPPER32 0x2c
- +#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */
- +#define PCI_IO_LIMIT_UPPER16 0x32
- +/* 0x34 same as for htype 0 */
- +/* 0x35-0x3b is reserved */
- +#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */
- +/* 0x3c-0x3d are same as for htype 0 */
- +#define PCI_BRIDGE_CONTROL 0x3e
- +#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */
- +#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */
- +#define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */
- +#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */
- +#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */
- +#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */
- +#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */
- +
- +#define PCI_CB_CAPABILITY_LIST 0x14
- +
- +/* Capability lists */
- +
- +#define PCI_CAP_LIST_ID 0 /* Capability ID */
- +#define PCI_CAP_ID_PM 0x01 /* Power Management */
- +#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */
- +#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */
- +#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */
- +#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
- +#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
- +#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
- +#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */
- +#define PCI_CAP_SIZEOF 4
- +
- +/* Power Management Registers */
- +
- +#define PCI_PM_PMC 2 /* PM Capabilities Register */
- +#define PCI_PM_CAP_VER_MASK 0x0007 /* Version */
- +#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */
- +#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */
- +#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */
- +#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */
- +#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */
- +#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */
- +#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */
- +#define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */
- +#define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */
- +#define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */
- +#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */
- +#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */
- +#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */
- +#define PCI_PM_CTRL 4 /* PM control and status register */
- +#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
- +#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */
- +#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */
- +#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */
- +#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */
- +#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */
- +#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */
- +#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */
- +#define PCI_PM_DATA_REGISTER 7 /* (??) */
- +#define PCI_PM_SIZEOF 8
- +
- +/* AGP registers */
- +
- +#define PCI_AGP_VERSION 2 /* BCD version number */
- +#define PCI_AGP_RFU 3 /* Rest of capability flags */
- +#define PCI_AGP_STATUS 4 /* Status register */
- +#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */
- +#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */
- +#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */
- +#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */
- +#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */
- +#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */
- +#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */
- +#define PCI_AGP_COMMAND 8 /* Control register */
- +#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */
- +#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */
- +#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */
- +#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */
- +#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */
- +#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */
- +#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */
- +#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */
- +#define PCI_AGP_SIZEOF 12
- +
- +/* Slot Identification */
- +
- +#define PCI_SID_ESR 2 /* Expansion Slot Register */
- +#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */
- +#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */
- +#define PCI_SID_CHASSIS_NR 3 /* Chassis Number */
- +
- +/* Message Signalled Interrupts registers */
- +
- +#define PCI_MSI_FLAGS 2 /* Various flags */
- +#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */
- +#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */
- +#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */
- +#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */
- +#define PCI_MSI_RFU 3 /* Rest of capability flags */
- +#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */
- +#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
- +#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */
- +#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
- +
- +#define PCI_SLOT(devfn) ((devfn) >> 3)
- #define PCI_FUNC(devfn) ((devfn) & 0x07)
-
- #define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24))
- @@ -85,108 +261,97 @@
- char chars[16];
- };
-
- -#define KERN_CODE_SEG 0x8 /* This _MUST_ match start.S */
- -
- -/* Stuff for asm */
- -#define save_flags(x) \
- -__asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */ :"memory")
- -
- -#define cli() __asm__ __volatile__ ("cli": : :"memory")
- -
- -#define restore_flags(x) \
- -__asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory")
- -
- -#define PCI_VENDOR_ID_ADMTEK 0x1317
- -#define PCI_DEVICE_ID_ADMTEK_0985 0x0985
- -#define PCI_VENDOR_ID_REALTEK 0x10ec
- -#define PCI_DEVICE_ID_REALTEK_8029 0x8029
- -#define PCI_DEVICE_ID_REALTEK_8139 0x8139
- -#define PCI_VENDOR_ID_WINBOND2 0x1050
- -#define PCI_DEVICE_ID_WINBOND2_89C940 0x0940
- -#define PCI_DEVICE_ID_WINBOND2_89C840 0x0840
- -#define PCI_VENDOR_ID_COMPEX 0x11f6
- -#define PCI_DEVICE_ID_COMPEX_RL2000 0x1401
- -#define PCI_DEVICE_ID_COMPEX_RL100ATX 0x2011
- -#define PCI_VENDOR_ID_KTI 0x8e2e
- -#define PCI_DEVICE_ID_KTI_ET32P2 0x3000
- -#define PCI_VENDOR_ID_NETVIN 0x4a14
- -#define PCI_DEVICE_ID_NETVIN_NV5000SC 0x5000
- -#define PCI_VENDOR_ID_HOLTEK 0x12c3
- -#define PCI_DEVICE_ID_HOLTEK_HT80232 0x0058
- -#define PCI_VENDOR_ID_3COM 0x10b7
- -#define PCI_DEVICE_ID_3COM_3C590 0x5900
- -#define PCI_DEVICE_ID_3COM_3C595 0x5950
- -#define PCI_DEVICE_ID_3COM_3C595_1 0x5951
- -#define PCI_DEVICE_ID_3COM_3C595_2 0x5952
- -#define PCI_DEVICE_ID_3COM_3C900TPO 0x9000
- -#define PCI_DEVICE_ID_3COM_3C900COMBO 0x9001
- -#define PCI_DEVICE_ID_3COM_3C905TX 0x9050
- -#define PCI_DEVICE_ID_3COM_3C905T4 0x9051
- -#define PCI_DEVICE_ID_3COM_3C905B_TX 0x9055
- -#define PCI_DEVICE_ID_3COM_3C905C_TXM 0x9200
- -#define PCI_VENDOR_ID_INTEL 0x8086
- -#define PCI_DEVICE_ID_INTEL_82557 0x1229
- -#define PCI_DEVICE_ID_INTEL_82559ER 0x1209
- -#define PCI_DEVICE_ID_INTEL_ID1029 0x1029
- -#define PCI_DEVICE_ID_INTEL_ID1030 0x1030
- -#define PCI_DEVICE_ID_INTEL_82562 0x2449
- -#define PCI_VENDOR_ID_AMD 0x1022
- -#define PCI_DEVICE_ID_AMD_LANCE 0x2000
- -#define PCI_VENDOR_ID_AMD_HOMEPNA 0x1022
- -#define PCI_DEVICE_ID_AMD_HOMEPNA 0x2001
- -#define PCI_VENDOR_ID_SMC_1211 0x1113
- -#define PCI_DEVICE_ID_SMC_1211 0x1211
- -#define PCI_VENDOR_ID_DEC 0x1011
- -#define PCI_DEVICE_ID_DEC_TULIP 0x0002
- -#define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009
- -#define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014
- -#define PCI_DEVICE_ID_DEC_21142 0x0019
- -#define PCI_VENDOR_ID_SMC 0x10B8
- -#ifndef PCI_DEVICE_ID_SMC_EPIC100
- -# define PCI_DEVICE_ID_SMC_EPIC100 0x0005
- -#endif
- -#define PCI_VENDOR_ID_MACRONIX 0x10d9
- -#define PCI_DEVICE_ID_MX987x5 0x0531
- -#define PCI_VENDOR_ID_LINKSYS 0x11AD
- -#define PCI_DEVICE_ID_LC82C115 0xC115
- -#define PCI_VENDOR_ID_VIATEC 0x1106
- -#define PCI_DEVICE_ID_VIA_RHINE_I 0x3043
- -#define PCI_DEVICE_ID_VIA_VT6102 0x3065
- -#define PCI_DEVICE_ID_VIA_86C100A 0x6100
- -#define PCI_VENDOR_ID_DAVICOM 0x1282
- -#define PCI_DEVICE_ID_DM9009 0x9009
- -#define PCI_DEVICE_ID_DM9102 0x9102
- -#define PCI_VENDOR_ID_SIS 0x1039
- -#define PCI_DEVICE_ID_SIS900 0x0900
- -#define PCI_DEVICE_ID_SIS7016 0x7016
- -#define PCI_VENDOR_ID_DLINK 0x1186
- -#define PCI_DEVICE_ID_DFE530TXP 0x1300
- -#define PCI_VENDOR_ID_NS 0x100B
- -#define PCI_DEVICE_ID_DP83815 0x0020
- -#define PCI_VENDOR_ID_OLICOM 0x108d
- -#define PCI_DEVICE_ID_OLICOM_OC3136 0x0001
- -#define PCI_DEVICE_ID_OLICOM_OC2315 0x0011
- -#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012
- -#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013
- -#define PCI_DEVICE_ID_OLICOM_OC2326 0x0014
- -#define PCI_DEVICE_ID_OLICOM_OC6151 0x0021
- +struct pci_device;
- +struct dev;
- +typedef int (*pci_probe_t)(struct dev *, struct pci_device *);
-
- struct pci_device {
- - unsigned short vendor, dev_id;
- - const char *name;
- - unsigned int membase;
- - unsigned short ioaddr;
- - unsigned char devfn;
- - unsigned char bus;
- + uint32_t class;
- + uint16_t vendor, dev_id;
- + const char *name;
- + /* membase and ioaddr are silly and depricated */
- + unsigned int membase;
- + unsigned int ioaddr;
- + unsigned int romaddr;
- + unsigned char irq;
- + unsigned char devfn;
- + unsigned char bus;
- + unsigned char use_specified;
- + const struct pci_driver *driver;
- +};
- +
- +extern void scan_pci_bus(int type, struct pci_device *dev);
- +extern void find_pci(int type, struct pci_device *dev);
- +
- +extern int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn, unsigned int where, uint8_t *value);
- +extern int pcibios_write_config_byte (unsigned int bus, unsigned int device_fn, unsigned int where, uint8_t value);
- +extern int pcibios_read_config_word(unsigned int bus, unsigned int device_fn, unsigned int where, uint16_t *value);
- +extern int pcibios_write_config_word (unsigned int bus, unsigned int device_fn, unsigned int where, uint16_t value);
- +extern int pcibios_read_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, uint32_t *value);
- +extern int pcibios_write_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, uint32_t value);
- +extern unsigned long pcibios_bus_base(unsigned int bus);
- +extern void adjust_pci_device(struct pci_device *p);
- +
- +
- +static inline int
- +pci_read_config_byte(struct pci_device *dev, unsigned int where, uint8_t *value)
- +{
- + return pcibios_read_config_byte(dev->bus, dev->devfn, where, value);
- +}
- +static inline int
- +pci_write_config_byte(struct pci_device *dev, unsigned int where, uint8_t value)
- +{
- + return pcibios_write_config_byte(dev->bus, dev->devfn, where, value);
- +}
- +static inline int
- +pci_read_config_word(struct pci_device *dev, unsigned int where, uint16_t *value)
- +{
- + return pcibios_read_config_word(dev->bus, dev->devfn, where, value);
- +}
- +static inline int
- +pci_write_config_word(struct pci_device *dev, unsigned int where, uint16_t value)
- +{
- + return pcibios_write_config_word(dev->bus, dev->devfn, where, value);
- +}
- +static inline int
- +pci_read_config_dword(struct pci_device *dev, unsigned int where, uint32_t *value)
- +{
- + return pcibios_read_config_dword(dev->bus, dev->devfn, where, value);
- +}
- +static inline int
- +pci_write_config_dword(struct pci_device *dev, unsigned int where, uint32_t value)
- +{
- + return pcibios_write_config_dword(dev->bus, dev->devfn, where, value);
- +}
- +
- +/* Helper functions to find the size of a pci bar */
- +extern unsigned long pci_bar_start(struct pci_device *dev, unsigned int bar);
- +extern unsigned long pci_bar_size(struct pci_device *dev, unsigned int bar);
- +/* Helper function to find pci capabilities */
- +extern int pci_find_capability(struct pci_device *dev, int cap);
- +struct pci_id {
- + unsigned short vendor, dev_id;
- + const char *name;
- +};
- +
- +struct dev;
- +/* Most pci drivers will use this */
- +struct pci_driver {
- + int type;
- + const char *name;
- + pci_probe_t probe;
- + struct pci_id *ids;
- + int id_count;
- +
- +/* On a few occasions the hardware is standardized enough that
- + * we only need to know the class of the device and not the exact
- + * type to drive the device correctly. If this is the case
- + * set a class value other than 0.
- + */
- + unsigned short class;
- };
-
- -extern void eth_pci_init(struct pci_device *);
- +#define PCI_ROM(VENDOR_ID, DEVICE_ID, IMAGE, DESCRIPTION) \
- + { VENDOR_ID, DEVICE_ID, IMAGE, }
-
- -extern int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn, unsigned int where, unsigned char *value);
- -extern int pcibios_write_config_byte (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned char value);
- -extern int pcibios_read_config_word(unsigned int bus, unsigned int device_fn, unsigned int where, unsigned short *value);
- -extern int pcibios_write_config_word (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned short value);
- -extern int pcibios_read_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, unsigned int *value);
- -extern int pcibios_write_config_dword(unsigned int bus, unsigned int device_fn, unsigned int where, unsigned int value);
- -void adjust_pci_device(struct pci_device *p);
- #endif /* PCI_H */
- diff -Naur grub-0.97.orig/netboot/pci_ids.h grub-0.97/netboot/pci_ids.h
- --- grub-0.97.orig/netboot/pci_ids.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/pci_ids.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,1809 @@
- +/*
- + * PCI Class, Vendor and Device IDs
- + *
- + * Please keep sorted.
- + */
- +
- +/* Device classes and subclasses */
- +
- +#define PCI_CLASS_NOT_DEFINED 0x0000
- +#define PCI_CLASS_NOT_DEFINED_VGA 0x0001
- +
- +#define PCI_BASE_CLASS_STORAGE 0x01
- +#define PCI_CLASS_STORAGE_SCSI 0x0100
- +#define PCI_CLASS_STORAGE_IDE 0x0101
- +#define PCI_CLASS_STORAGE_FLOPPY 0x0102
- +#define PCI_CLASS_STORAGE_IPI 0x0103
- +#define PCI_CLASS_STORAGE_RAID 0x0104
- +#define PCI_CLASS_STORAGE_OTHER 0x0180
- +
- +#define PCI_BASE_CLASS_NETWORK 0x02
- +#define PCI_CLASS_NETWORK_ETHERNET 0x0200
- +#define PCI_CLASS_NETWORK_TOKEN_RING 0x0201
- +#define PCI_CLASS_NETWORK_FDDI 0x0202
- +#define PCI_CLASS_NETWORK_ATM 0x0203
- +#define PCI_CLASS_NETWORK_OTHER 0x0280
- +
- +#define PCI_BASE_CLASS_DISPLAY 0x03
- +#define PCI_CLASS_DISPLAY_VGA 0x0300
- +#define PCI_CLASS_DISPLAY_XGA 0x0301
- +#define PCI_CLASS_DISPLAY_3D 0x0302
- +#define PCI_CLASS_DISPLAY_OTHER 0x0380
- +
- +#define PCI_BASE_CLASS_MULTIMEDIA 0x04
- +#define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400
- +#define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401
- +#define PCI_CLASS_MULTIMEDIA_PHONE 0x0402
- +#define PCI_CLASS_MULTIMEDIA_OTHER 0x0480
- +
- +#define PCI_BASE_CLASS_MEMORY 0x05
- +#define PCI_CLASS_MEMORY_RAM 0x0500
- +#define PCI_CLASS_MEMORY_FLASH 0x0501
- +#define PCI_CLASS_MEMORY_OTHER 0x0580
- +
- +#define PCI_BASE_CLASS_BRIDGE 0x06
- +#define PCI_CLASS_BRIDGE_HOST 0x0600
- +#define PCI_CLASS_BRIDGE_ISA 0x0601
- +#define PCI_CLASS_BRIDGE_EISA 0x0602
- +#define PCI_CLASS_BRIDGE_MC 0x0603
- +#define PCI_CLASS_BRIDGE_PCI 0x0604
- +#define PCI_CLASS_BRIDGE_PCMCIA 0x0605
- +#define PCI_CLASS_BRIDGE_NUBUS 0x0606
- +#define PCI_CLASS_BRIDGE_CARDBUS 0x0607
- +#define PCI_CLASS_BRIDGE_RACEWAY 0x0608
- +#define PCI_CLASS_BRIDGE_OTHER 0x0680
- +
- +#define PCI_BASE_CLASS_COMMUNICATION 0x07
- +#define PCI_CLASS_COMMUNICATION_SERIAL 0x0700
- +#define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701
- +#define PCI_CLASS_COMMUNICATION_MULTISERIAL 0x0702
- +#define PCI_CLASS_COMMUNICATION_MODEM 0x0703
- +#define PCI_CLASS_COMMUNICATION_OTHER 0x0780
- +
- +#define PCI_BASE_CLASS_SYSTEM 0x08
- +#define PCI_CLASS_SYSTEM_PIC 0x0800
- +#define PCI_CLASS_SYSTEM_DMA 0x0801
- +#define PCI_CLASS_SYSTEM_TIMER 0x0802
- +#define PCI_CLASS_SYSTEM_RTC 0x0803
- +#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804
- +#define PCI_CLASS_SYSTEM_OTHER 0x0880
- +
- +#define PCI_BASE_CLASS_INPUT 0x09
- +#define PCI_CLASS_INPUT_KEYBOARD 0x0900
- +#define PCI_CLASS_INPUT_PEN 0x0901
- +#define PCI_CLASS_INPUT_MOUSE 0x0902
- +#define PCI_CLASS_INPUT_SCANNER 0x0903
- +#define PCI_CLASS_INPUT_GAMEPORT 0x0904
- +#define PCI_CLASS_INPUT_OTHER 0x0980
- +
- +#define PCI_BASE_CLASS_DOCKING 0x0a
- +#define PCI_CLASS_DOCKING_GENERIC 0x0a00
- +#define PCI_CLASS_DOCKING_OTHER 0x0a80
- +
- +#define PCI_BASE_CLASS_PROCESSOR 0x0b
- +#define PCI_CLASS_PROCESSOR_386 0x0b00
- +#define PCI_CLASS_PROCESSOR_486 0x0b01
- +#define PCI_CLASS_PROCESSOR_PENTIUM 0x0b02
- +#define PCI_CLASS_PROCESSOR_ALPHA 0x0b10
- +#define PCI_CLASS_PROCESSOR_POWERPC 0x0b20
- +#define PCI_CLASS_PROCESSOR_MIPS 0x0b30
- +#define PCI_CLASS_PROCESSOR_CO 0x0b40
- +
- +#define PCI_BASE_CLASS_SERIAL 0x0c
- +#define PCI_CLASS_SERIAL_FIREWIRE 0x0c00
- +#define PCI_CLASS_SERIAL_ACCESS 0x0c01
- +#define PCI_CLASS_SERIAL_SSA 0x0c02
- +#define PCI_CLASS_SERIAL_USB 0x0c03
- +#define PCI_CLASS_SERIAL_FIBER 0x0c04
- +#define PCI_CLASS_SERIAL_SMBUS 0x0c05
- +
- +#define PCI_BASE_CLASS_INTELLIGENT 0x0e
- +#define PCI_CLASS_INTELLIGENT_I2O 0x0e00
- +
- +#define PCI_BASE_CLASS_SATELLITE 0x0f
- +#define PCI_CLASS_SATELLITE_TV 0x0f00
- +#define PCI_CLASS_SATELLITE_AUDIO 0x0f01
- +#define PCI_CLASS_SATELLITE_VOICE 0x0f03
- +#define PCI_CLASS_SATELLITE_DATA 0x0f04
- +
- +#define PCI_BASE_CLASS_CRYPT 0x10
- +#define PCI_CLASS_CRYPT_NETWORK 0x1000
- +#define PCI_CLASS_CRYPT_ENTERTAINMENT 0x1001
- +#define PCI_CLASS_CRYPT_OTHER 0x1080
- +
- +#define PCI_BASE_CLASS_SIGNAL_PROCESSING 0x11
- +#define PCI_CLASS_SP_DPIO 0x1100
- +#define PCI_CLASS_SP_OTHER 0x1180
- +
- +#define PCI_CLASS_OTHERS 0xff
- +
- +/* Vendors and devices. Sort key: vendor first, device next. */
- +
- +#define PCI_VENDOR_ID_DYNALINK 0x0675
- +#define PCI_DEVICE_ID_DYNALINK_IS64PH 0x1702
- +
- +#define PCI_VENDOR_ID_BERKOM 0x0871
- +#define PCI_DEVICE_ID_BERKOM_A1T 0xffa1
- +#define PCI_DEVICE_ID_BERKOM_T_CONCEPT 0xffa2
- +#define PCI_DEVICE_ID_BERKOM_A4T 0xffa4
- +#define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO 0xffa8
- +
- +#define PCI_VENDOR_ID_COMPAQ 0x0e11
- +#define PCI_DEVICE_ID_COMPAQ_TOKENRING 0x0508
- +#define PCI_DEVICE_ID_COMPAQ_1280 0x3033
- +#define PCI_DEVICE_ID_COMPAQ_TRIFLEX 0x4000
- +#define PCI_DEVICE_ID_COMPAQ_6010 0x6010
- +#define PCI_DEVICE_ID_COMPAQ_SMART2P 0xae10
- +#define PCI_DEVICE_ID_COMPAQ_NETEL100 0xae32
- +#define PCI_DEVICE_ID_COMPAQ_NETEL10 0xae34
- +#define PCI_DEVICE_ID_COMPAQ_NETFLEX3I 0xae35
- +#define PCI_DEVICE_ID_COMPAQ_NETEL100D 0xae40
- +#define PCI_DEVICE_ID_COMPAQ_NETEL100PI 0xae43
- +#define PCI_DEVICE_ID_COMPAQ_NETEL100I 0xb011
- +#define PCI_DEVICE_ID_COMPAQ_CISS 0xb060
- +#define PCI_DEVICE_ID_COMPAQ_CISSB 0xb178
- +#define PCI_DEVICE_ID_COMPAQ_THUNDER 0xf130
- +#define PCI_DEVICE_ID_COMPAQ_NETFLEX3B 0xf150
- +
- +#define PCI_VENDOR_ID_NCR 0x1000
- +#define PCI_VENDOR_ID_LSI_LOGIC 0x1000
- +#define PCI_DEVICE_ID_NCR_53C810 0x0001
- +#define PCI_DEVICE_ID_NCR_53C820 0x0002
- +#define PCI_DEVICE_ID_NCR_53C825 0x0003
- +#define PCI_DEVICE_ID_NCR_53C815 0x0004
- +#define PCI_DEVICE_ID_LSI_53C810AP 0x0005
- +#define PCI_DEVICE_ID_NCR_53C860 0x0006
- +#define PCI_DEVICE_ID_LSI_53C1510 0x000a
- +#define PCI_DEVICE_ID_NCR_53C896 0x000b
- +#define PCI_DEVICE_ID_NCR_53C895 0x000c
- +#define PCI_DEVICE_ID_NCR_53C885 0x000d
- +#define PCI_DEVICE_ID_NCR_53C875 0x000f
- +#define PCI_DEVICE_ID_NCR_53C1510 0x0010
- +#define PCI_DEVICE_ID_LSI_53C895A 0x0012
- +#define PCI_DEVICE_ID_LSI_53C875A 0x0013
- +#define PCI_DEVICE_ID_LSI_53C1010_33 0x0020
- +#define PCI_DEVICE_ID_LSI_53C1010_66 0x0021
- +#define PCI_DEVICE_ID_LSI_53C1030 0x0030
- +#define PCI_DEVICE_ID_LSI_53C1035 0x0040
- +#define PCI_DEVICE_ID_NCR_53C875J 0x008f
- +#define PCI_DEVICE_ID_LSI_FC909 0x0621
- +#define PCI_DEVICE_ID_LSI_FC929 0x0622
- +#define PCI_DEVICE_ID_LSI_FC929_LAN 0x0623
- +#define PCI_DEVICE_ID_LSI_FC919 0x0624
- +#define PCI_DEVICE_ID_LSI_FC919_LAN 0x0625
- +#define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701
- +#define PCI_DEVICE_ID_LSI_61C102 0x0901
- +#define PCI_DEVICE_ID_LSI_63C815 0x1000
- +
- +#define PCI_VENDOR_ID_ATI 0x1002
- +/* Mach64 */
- +#define PCI_DEVICE_ID_ATI_68800 0x4158
- +#define PCI_DEVICE_ID_ATI_215CT222 0x4354
- +#define PCI_DEVICE_ID_ATI_210888CX 0x4358
- +#define PCI_DEVICE_ID_ATI_215ET222 0x4554
- +/* Mach64 / Rage */
- +#define PCI_DEVICE_ID_ATI_215GB 0x4742
- +#define PCI_DEVICE_ID_ATI_215GD 0x4744
- +#define PCI_DEVICE_ID_ATI_215GI 0x4749
- +#define PCI_DEVICE_ID_ATI_215GP 0x4750
- +#define PCI_DEVICE_ID_ATI_215GQ 0x4751
- +#define PCI_DEVICE_ID_ATI_215XL 0x4752
- +#define PCI_DEVICE_ID_ATI_215GT 0x4754
- +#define PCI_DEVICE_ID_ATI_215GTB 0x4755
- +#define PCI_DEVICE_ID_ATI_215_IV 0x4756
- +#define PCI_DEVICE_ID_ATI_215_IW 0x4757
- +#define PCI_DEVICE_ID_ATI_215_IZ 0x475A
- +#define PCI_DEVICE_ID_ATI_210888GX 0x4758
- +#define PCI_DEVICE_ID_ATI_215_LB 0x4c42
- +#define PCI_DEVICE_ID_ATI_215_LD 0x4c44
- +#define PCI_DEVICE_ID_ATI_215_LG 0x4c47
- +#define PCI_DEVICE_ID_ATI_215_LI 0x4c49
- +#define PCI_DEVICE_ID_ATI_215_LM 0x4c4D
- +#define PCI_DEVICE_ID_ATI_215_LN 0x4c4E
- +#define PCI_DEVICE_ID_ATI_215_LR 0x4c52
- +#define PCI_DEVICE_ID_ATI_215_LS 0x4c53
- +#define PCI_DEVICE_ID_ATI_264_LT 0x4c54
- +/* Mach64 VT */
- +#define PCI_DEVICE_ID_ATI_264VT 0x5654
- +#define PCI_DEVICE_ID_ATI_264VU 0x5655
- +#define PCI_DEVICE_ID_ATI_264VV 0x5656
- +/* Rage128 Pro GL */
- +#define PCI_DEVICE_ID_ATI_Rage128_PA 0x5041
- +#define PCI_DEVICE_ID_ATI_Rage128_PB 0x5042
- +#define PCI_DEVICE_ID_ATI_Rage128_PC 0x5043
- +#define PCI_DEVICE_ID_ATI_Rage128_PD 0x5044
- +#define PCI_DEVICE_ID_ATI_Rage128_PE 0x5045
- +#define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046
- +/* Rage128 Pro VR */
- +#define PCI_DEVICE_ID_ATI_RAGE128_PG 0x5047
- +#define PCI_DEVICE_ID_ATI_RAGE128_PH 0x5048
- +#define PCI_DEVICE_ID_ATI_RAGE128_PI 0x5049
- +#define PCI_DEVICE_ID_ATI_RAGE128_PJ 0x504A
- +#define PCI_DEVICE_ID_ATI_RAGE128_PK 0x504B
- +#define PCI_DEVICE_ID_ATI_RAGE128_PL 0x504C
- +#define PCI_DEVICE_ID_ATI_RAGE128_PM 0x504D
- +#define PCI_DEVICE_ID_ATI_RAGE128_PN 0x504E
- +#define PCI_DEVICE_ID_ATI_RAGE128_PO 0x504F
- +#define PCI_DEVICE_ID_ATI_RAGE128_PP 0x5050
- +#define PCI_DEVICE_ID_ATI_RAGE128_PQ 0x5051
- +#define PCI_DEVICE_ID_ATI_RAGE128_PR 0x5052
- +#define PCI_DEVICE_ID_ATI_RAGE128_TR 0x5452
- +#define PCI_DEVICE_ID_ATI_RAGE128_PS 0x5053
- +#define PCI_DEVICE_ID_ATI_RAGE128_PT 0x5054
- +#define PCI_DEVICE_ID_ATI_RAGE128_PU 0x5055
- +#define PCI_DEVICE_ID_ATI_RAGE128_PV 0x5056
- +#define PCI_DEVICE_ID_ATI_RAGE128_PW 0x5057
- +#define PCI_DEVICE_ID_ATI_RAGE128_PX 0x5058
- +/* Rage128 GL */
- +#define PCI_DEVICE_ID_ATI_RAGE128_RE 0x5245
- +#define PCI_DEVICE_ID_ATI_RAGE128_RF 0x5246
- +#define PCI_DEVICE_ID_ATI_RAGE128_RG 0x534b
- +#define PCI_DEVICE_ID_ATI_RAGE128_RH 0x534c
- +#define PCI_DEVICE_ID_ATI_RAGE128_RI 0x534d
- +/* Rage128 VR */
- +#define PCI_DEVICE_ID_ATI_RAGE128_RK 0x524b
- +#define PCI_DEVICE_ID_ATI_RAGE128_RL 0x524c
- +#define PCI_DEVICE_ID_ATI_RAGE128_RM 0x5345
- +#define PCI_DEVICE_ID_ATI_RAGE128_RN 0x5346
- +#define PCI_DEVICE_ID_ATI_RAGE128_RO 0x5347
- +/* Rage128 M3 */
- +#define PCI_DEVICE_ID_ATI_RAGE128_LE 0x4c45
- +#define PCI_DEVICE_ID_ATI_RAGE128_LF 0x4c46
- +/* Rage128 Pro Ultra */
- +#define PCI_DEVICE_ID_ATI_RAGE128_U1 0x5446
- +#define PCI_DEVICE_ID_ATI_RAGE128_U2 0x544C
- +#define PCI_DEVICE_ID_ATI_RAGE128_U3 0x5452
- +/* Radeon M4 */
- +#define PCI_DEVICE_ID_ATI_RADEON_LE 0x4d45
- +#define PCI_DEVICE_ID_ATI_RADEON_LF 0x4d46
- +/* Radeon NV-100 */
- +#define PCI_DEVICE_ID_ATI_RADEON_N1 0x5159
- +#define PCI_DEVICE_ID_ATI_RADEON_N2 0x515a
- +/* Radeon */
- +#define PCI_DEVICE_ID_ATI_RADEON_RA 0x5144
- +#define PCI_DEVICE_ID_ATI_RADEON_RB 0x5145
- +#define PCI_DEVICE_ID_ATI_RADEON_RC 0x5146
- +#define PCI_DEVICE_ID_ATI_RADEON_RD 0x5147
- +
- +#define PCI_VENDOR_ID_VLSI 0x1004
- +#define PCI_DEVICE_ID_VLSI_82C592 0x0005
- +#define PCI_DEVICE_ID_VLSI_82C593 0x0006
- +#define PCI_DEVICE_ID_VLSI_82C594 0x0007
- +#define PCI_DEVICE_ID_VLSI_82C597 0x0009
- +#define PCI_DEVICE_ID_VLSI_82C541 0x000c
- +#define PCI_DEVICE_ID_VLSI_82C543 0x000d
- +#define PCI_DEVICE_ID_VLSI_82C532 0x0101
- +#define PCI_DEVICE_ID_VLSI_82C534 0x0102
- +#define PCI_DEVICE_ID_VLSI_82C535 0x0104
- +#define PCI_DEVICE_ID_VLSI_82C147 0x0105
- +#define PCI_DEVICE_ID_VLSI_VAS96011 0x0702
- +
- +#define PCI_VENDOR_ID_ADL 0x1005
- +#define PCI_DEVICE_ID_ADL_2301 0x2301
- +
- +#define PCI_VENDOR_ID_NS 0x100b
- +#define PCI_DEVICE_ID_NS_87415 0x0002
- +#define PCI_DEVICE_ID_NS_87560_LIO 0x000e
- +#define PCI_DEVICE_ID_NS_87560_USB 0x0012
- +#define PCI_DEVICE_ID_NS_83815 0x0020
- +#define PCI_DEVICE_ID_DP83815 0x0020
- +#define PCI_DEVICE_ID_NS_83820 0x0022
- +#define PCI_DEVICE_ID_NS_87410 0xd001
- +
- +#define PCI_VENDOR_ID_TSENG 0x100c
- +#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202
- +#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205
- +#define PCI_DEVICE_ID_TSENG_W32P_c 0x3206
- +#define PCI_DEVICE_ID_TSENG_W32P_d 0x3207
- +#define PCI_DEVICE_ID_TSENG_ET6000 0x3208
- +
- +#define PCI_VENDOR_ID_WEITEK 0x100e
- +#define PCI_DEVICE_ID_WEITEK_P9000 0x9001
- +#define PCI_DEVICE_ID_WEITEK_P9100 0x9100
- +
- +#define PCI_VENDOR_ID_DEC 0x1011
- +#define PCI_DEVICE_ID_DEC_BRD 0x0001
- +#define PCI_DEVICE_ID_DEC_TULIP 0x0002
- +#define PCI_DEVICE_ID_DEC_TGA 0x0004
- +#define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009
- +#define PCI_DEVICE_ID_DEC_TGA2 0x000D
- +#define PCI_DEVICE_ID_DEC_FDDI 0x000F
- +#define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014
- +#define PCI_DEVICE_ID_DEC_21142 0x0019
- +#define PCI_DEVICE_ID_DEC_21052 0x0021
- +#define PCI_DEVICE_ID_DEC_21150 0x0022
- +#define PCI_DEVICE_ID_DEC_21152 0x0024
- +#define PCI_DEVICE_ID_DEC_21153 0x0025
- +#define PCI_DEVICE_ID_DEC_21154 0x0026
- +#define PCI_DEVICE_ID_DEC_21285 0x1065
- +#define PCI_DEVICE_ID_COMPAQ_42XX 0x0046
- +
- +#define PCI_VENDOR_ID_CIRRUS 0x1013
- +#define PCI_DEVICE_ID_CIRRUS_7548 0x0038
- +#define PCI_DEVICE_ID_CIRRUS_5430 0x00a0
- +#define PCI_DEVICE_ID_CIRRUS_5434_4 0x00a4
- +#define PCI_DEVICE_ID_CIRRUS_5434_8 0x00a8
- +#define PCI_DEVICE_ID_CIRRUS_5436 0x00ac
- +#define PCI_DEVICE_ID_CIRRUS_5446 0x00b8
- +#define PCI_DEVICE_ID_CIRRUS_5480 0x00bc
- +#define PCI_DEVICE_ID_CIRRUS_5462 0x00d0
- +#define PCI_DEVICE_ID_CIRRUS_5464 0x00d4
- +#define PCI_DEVICE_ID_CIRRUS_5465 0x00d6
- +#define PCI_DEVICE_ID_CIRRUS_6729 0x1100
- +#define PCI_DEVICE_ID_CIRRUS_6832 0x1110
- +#define PCI_DEVICE_ID_CIRRUS_7542 0x1200
- +#define PCI_DEVICE_ID_CIRRUS_7543 0x1202
- +#define PCI_DEVICE_ID_CIRRUS_7541 0x1204
- +
- +#define PCI_VENDOR_ID_IBM 0x1014
- +#define PCI_DEVICE_ID_IBM_FIRE_CORAL 0x000a
- +#define PCI_DEVICE_ID_IBM_TR 0x0018
- +#define PCI_DEVICE_ID_IBM_82G2675 0x001d
- +#define PCI_DEVICE_ID_IBM_MCA 0x0020
- +#define PCI_DEVICE_ID_IBM_82351 0x0022
- +#define PCI_DEVICE_ID_IBM_PYTHON 0x002d
- +#define PCI_DEVICE_ID_IBM_SERVERAID 0x002e
- +#define PCI_DEVICE_ID_IBM_TR_WAKE 0x003e
- +#define PCI_DEVICE_ID_IBM_MPIC 0x0046
- +#define PCI_DEVICE_ID_IBM_3780IDSP 0x007d
- +#define PCI_DEVICE_ID_IBM_CHUKAR 0x0096
- +#define PCI_DEVICE_ID_IBM_405GP 0x0156
- +#define PCI_DEVICE_ID_IBM_SERVERAIDI960 0x01bd
- +#define PCI_DEVICE_ID_IBM_MPIC_2 0xffff
- +
- +#define PCI_VENDOR_ID_COMPEX2 0x101a // pci.ids says "AT&T GIS (NCR)"
- +#define PCI_DEVICE_ID_COMPEX2_100VG 0x0005
- +
- +#define PCI_VENDOR_ID_WD 0x101c
- +#define PCI_DEVICE_ID_WD_7197 0x3296
- +
- +#define PCI_VENDOR_ID_AMI 0x101e
- +#define PCI_DEVICE_ID_AMI_MEGARAID3 0x1960
- +#define PCI_DEVICE_ID_AMI_MEGARAID 0x9010
- +#define PCI_DEVICE_ID_AMI_MEGARAID2 0x9060
- +
- +#define PCI_VENDOR_ID_AMD 0x1022
- +
- +#define PCI_DEVICE_ID_AMD_LANCE 0x2000
- +#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
- +#define PCI_DEVICE_ID_AMD_HOMEPNA 0x2001
- +#define PCI_DEVICE_ID_AMD_SCSI 0x2020
- +#define PCI_DEVICE_ID_AMD_FE_GATE_7006 0x7006
- +#define PCI_DEVICE_ID_AMD_FE_GATE_7007 0x7007
- +#define PCI_DEVICE_ID_AMD_FE_GATE_700C 0x700C
- +#define PCI_DEVIDE_ID_AMD_FE_GATE_700D 0x700D
- +#define PCI_DEVICE_ID_AMD_FE_GATE_700E 0x700E
- +#define PCI_DEVICE_ID_AMD_FE_GATE_700F 0x700F
- +#define PCI_DEVICE_ID_AMD_COBRA_7400 0x7400
- +#define PCI_DEVICE_ID_AMD_COBRA_7401 0x7401
- +#define PCI_DEVICE_ID_AMD_COBRA_7403 0x7403
- +#define PCI_DEVICE_ID_AMD_COBRA_7404 0x7404
- +#define PCI_DEVICE_ID_AMD_VIPER_7408 0x7408
- +#define PCI_DEVICE_ID_AMD_VIPER_7409 0x7409
- +#define PCI_DEVICE_ID_AMD_VIPER_740B 0x740B
- +#define PCI_DEVICE_ID_AMD_VIPER_740C 0x740C
- +#define PCI_DEVICE_ID_AMD_VIPER_7410 0x7410
- +#define PCI_DEVICE_ID_AMD_VIPER_7411 0x7411
- +#define PCI_DEVICE_ID_AMD_VIPER_7413 0x7413
- +#define PCI_DEVICE_ID_AMD_VIPER_7414 0x7414
- +#define PCI_DEVICE_ID_AMD_VIPER_7440 0x7440
- +#define PCI_DEVICE_ID_AMD_VIPER_7441 0x7441
- +#define PCI_DEVICE_ID_AMD_VIPER_7443 0x7443
- +#define PCI_DEVICE_ID_AMD_VIPER_7448 0x7448
- +#define PCI_DEVICE_ID_AMD_VIPER_7449 0x7449
- +
- +#define PCI_VENDOR_ID_TRIDENT 0x1023
- +#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
- +#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001
- +#define PCI_DEVICE_ID_TRIDENT_9320 0x9320
- +#define PCI_DEVICE_ID_TRIDENT_9388 0x9388
- +#define PCI_DEVICE_ID_TRIDENT_9397 0x9397
- +#define PCI_DEVICE_ID_TRIDENT_939A 0x939A
- +#define PCI_DEVICE_ID_TRIDENT_9520 0x9520
- +#define PCI_DEVICE_ID_TRIDENT_9525 0x9525
- +#define PCI_DEVICE_ID_TRIDENT_9420 0x9420
- +#define PCI_DEVICE_ID_TRIDENT_9440 0x9440
- +#define PCI_DEVICE_ID_TRIDENT_9660 0x9660
- +#define PCI_DEVICE_ID_TRIDENT_9750 0x9750
- +#define PCI_DEVICE_ID_TRIDENT_9850 0x9850
- +#define PCI_DEVICE_ID_TRIDENT_9880 0x9880
- +#define PCI_DEVICE_ID_TRIDENT_8400 0x8400
- +#define PCI_DEVICE_ID_TRIDENT_8420 0x8420
- +#define PCI_DEVICE_ID_TRIDENT_8500 0x8500
- +
- +#define PCI_VENDOR_ID_AI 0x1025
- +#define PCI_DEVICE_ID_AI_M1435 0x1435
- +
- +#define PCI_VENDOR_ID_DELL 0x1028
- +
- +#define PCI_VENDOR_ID_MATROX 0x102B
- +#define PCI_DEVICE_ID_MATROX_MGA_2 0x0518
- +#define PCI_DEVICE_ID_MATROX_MIL 0x0519
- +#define PCI_DEVICE_ID_MATROX_MYS 0x051A
- +#define PCI_DEVICE_ID_MATROX_MIL_2 0x051b
- +#define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f
- +#define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10
- +#define PCI_DEVICE_ID_MATROX_G100_MM 0x1000
- +#define PCI_DEVICE_ID_MATROX_G100_AGP 0x1001
- +#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520
- +#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521
- +#define PCI_DEVICE_ID_MATROX_G400 0x0525
- +#define PCI_DEVICE_ID_MATROX_G550 0x2527
- +#define PCI_DEVICE_ID_MATROX_VIA 0x4536
- +
- +#define PCI_VENDOR_ID_CT 0x102c
- +#define PCI_DEVICE_ID_CT_65545 0x00d8
- +#define PCI_DEVICE_ID_CT_65548 0x00dc
- +#define PCI_DEVICE_ID_CT_65550 0x00e0
- +#define PCI_DEVICE_ID_CT_65554 0x00e4
- +#define PCI_DEVICE_ID_CT_65555 0x00e5
- +
- +#define PCI_VENDOR_ID_MIRO 0x1031
- +#define PCI_DEVICE_ID_MIRO_36050 0x5601
- +
- +#define PCI_VENDOR_ID_NEC 0x1033
- +#define PCI_DEVICE_ID_NEC_PCX2 0x0046
- +#define PCI_DEVICE_ID_NEC_NILE4 0x005a
- +#define PCI_DEVICE_ID_NEC_VRC5476 0x009b
- +
- +#define PCI_VENDOR_ID_FD 0x1036
- +#define PCI_DEVICE_ID_FD_36C70 0x0000
- +
- +#define PCI_VENDOR_ID_SIS 0x1039
- +#define PCI_VENDOR_ID_SI 0x1039
- +#define PCI_DEVICE_ID_SI_5591_AGP 0x0001
- +#define PCI_DEVICE_ID_SI_6202 0x0002
- +#define PCI_DEVICE_ID_SI_503 0x0008
- +#define PCI_DEVICE_ID_SI_ACPI 0x0009
- +#define PCI_DEVICE_ID_SI_5597_VGA 0x0200
- +#define PCI_DEVICE_ID_SI_6205 0x0205
- +#define PCI_DEVICE_ID_SI_501 0x0406
- +#define PCI_DEVICE_ID_SI_496 0x0496
- +#define PCI_DEVICE_ID_SI_300 0x0300
- +#define PCI_DEVICE_ID_SI_315H 0x0310
- +#define PCI_DEVICE_ID_SI_315 0x0315
- +#define PCI_DEVICE_ID_SI_315PRO 0x0325
- +#define PCI_DEVICE_ID_SI_530 0x0530
- +#define PCI_DEVICE_ID_SI_540 0x0540
- +#define PCI_DEVICE_ID_SI_550 0x0550
- +#define PCI_DEVICE_ID_SI_601 0x0601
- +#define PCI_DEVICE_ID_SI_620 0x0620
- +#define PCI_DEVICE_ID_SI_630 0x0630
- +#define PCI_DEVICE_ID_SI_635 0x0635
- +#define PCI_DEVICE_ID_SI_640 0x0640
- +#define PCI_DEVICE_ID_SI_645 0x0645
- +#define PCI_DEVICE_ID_SI_650 0x0650
- +#define PCI_DEVICE_ID_SI_730 0x0730
- +#define PCI_DEVICE_ID_SI_735 0x0735
- +#define PCI_DEVICE_ID_SI_740 0x0740
- +#define PCI_DEVICE_ID_SI_745 0x0745
- +#define PCI_DEVICE_ID_SI_750 0x0750
- +#define PCI_DEVICE_ID_SI_900 0x0900
- +#define PCI_DEVICE_ID_SIS900 0x0900
- +#define PCI_DEVICE_ID_SI_5107 0x5107
- +#define PCI_DEVICE_ID_SI_5300 0x5300
- +#define PCI_DEVICE_ID_SI_540_VGA 0x5300
- +#define PCI_DEVICE_ID_SI_550_VGA 0x5315
- +#define PCI_DEVICE_ID_SI_5511 0x5511
- +#define PCI_DEVICE_ID_SI_5513 0x5513
- +#define PCI_DEVICE_ID_SI_5571 0x5571
- +#define PCI_DEVICE_ID_SI_5591 0x5591
- +#define PCI_DEVICE_ID_SI_5597 0x5597
- +#define PCI_DEVICE_ID_SI_5598 0x5598
- +#define PCI_DEVICE_ID_SI_5600 0x5600
- +#define PCI_DEVICE_ID_SI_6300 0x6300
- +#define PCI_DEVICE_ID_SI_630_VGA 0x6300
- +#define PCI_DEVICE_ID_SI_6306 0x6306
- +#define PCI_DEVICE_ID_SI_6326 0x6326
- +#define PCI_DEVICE_ID_SI_7001 0x7001
- +#define PCI_DEVICE_ID_SI_7016 0x7016
- +#define PCI_DEVICE_ID_SIS7016 0x7016
- +#define PCI_DEVICE_ID_SI_730_VGA 0x7300
- +
- +#define PCI_VENDOR_ID_HP 0x103c
- +#define PCI_DEVICE_ID_HP_DONNER_GFX 0x1008
- +#define PCI_DEVICE_ID_HP_TACHYON 0x1028
- +#define PCI_DEVICE_ID_HP_TACHLITE 0x1029
- +#define PCI_DEVICE_ID_HP_J2585A 0x1030
- +#define PCI_DEVICE_ID_HP_J2585B 0x1031
- +#define PCI_DEVICE_ID_HP_SAS 0x1048
- +#define PCI_DEVICE_ID_HP_DIVA1 0x1049
- +#define PCI_DEVICE_ID_HP_DIVA2 0x104A
- +#define PCI_DEVICE_ID_HP_SP2_0 0x104B
- +
- +#define PCI_VENDOR_ID_PCTECH 0x1042
- +#define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000
- +#define PCI_DEVICE_ID_PCTECH_RZ1001 0x1001
- +#define PCI_DEVICE_ID_PCTECH_SAMURAI_0 0x3000
- +#define PCI_DEVICE_ID_PCTECH_SAMURAI_1 0x3010
- +#define PCI_DEVICE_ID_PCTECH_SAMURAI_IDE 0x3020
- +
- +#define PCI_VENDOR_ID_ASUSTEK 0x1043
- +#define PCI_DEVICE_ID_ASUSTEK_0675 0x0675
- +
- +#define PCI_VENDOR_ID_DPT 0x1044
- +#define PCI_DEVICE_ID_DPT 0xa400
- +
- +#define PCI_VENDOR_ID_OPTI 0x1045
- +#define PCI_DEVICE_ID_OPTI_92C178 0xc178
- +#define PCI_DEVICE_ID_OPTI_82C557 0xc557
- +#define PCI_DEVICE_ID_OPTI_82C558 0xc558
- +#define PCI_DEVICE_ID_OPTI_82C621 0xc621
- +#define PCI_DEVICE_ID_OPTI_82C700 0xc700
- +#define PCI_DEVICE_ID_OPTI_82C701 0xc701
- +#define PCI_DEVICE_ID_OPTI_82C814 0xc814
- +#define PCI_DEVICE_ID_OPTI_82C822 0xc822
- +#define PCI_DEVICE_ID_OPTI_82C861 0xc861
- +#define PCI_DEVICE_ID_OPTI_82C825 0xd568
- +
- +#define PCI_VENDOR_ID_ELSA 0x1048
- +#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000
- +#define PCI_DEVICE_ID_ELSA_QS3000 0x3000
- +
- +#define PCI_VENDOR_ID_ELSA 0x1048
- +#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000
- +#define PCI_DEVICE_ID_ELSA_QS3000 0x3000
- +
- +#define PCI_VENDOR_ID_SGS 0x104a
- +#define PCI_DEVICE_ID_SGS_2000 0x0008
- +#define PCI_DEVICE_ID_SGS_1764 0x0009
- +
- +#define PCI_VENDOR_ID_BUSLOGIC 0x104B
- +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140
- +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040
- +#define PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT 0x8130
- +
- +#define PCI_VENDOR_ID_TI 0x104c
- +#define PCI_DEVICE_ID_TI_TVP4010 0x3d04
- +#define PCI_DEVICE_ID_TI_TVP4020 0x3d07
- +#define PCI_DEVICE_ID_TI_1130 0xac12
- +#define PCI_DEVICE_ID_TI_1031 0xac13
- +#define PCI_DEVICE_ID_TI_1131 0xac15
- +#define PCI_DEVICE_ID_TI_1250 0xac16
- +#define PCI_DEVICE_ID_TI_1220 0xac17
- +#define PCI_DEVICE_ID_TI_1221 0xac19
- +#define PCI_DEVICE_ID_TI_1210 0xac1a
- +#define PCI_DEVICE_ID_TI_1410 0xac50
- +#define PCI_DEVICE_ID_TI_1450 0xac1b
- +#define PCI_DEVICE_ID_TI_1225 0xac1c
- +#define PCI_DEVICE_ID_TI_1251A 0xac1d
- +#define PCI_DEVICE_ID_TI_1211 0xac1e
- +#define PCI_DEVICE_ID_TI_1251B 0xac1f
- +#define PCI_DEVICE_ID_TI_4410 0xac41
- +#define PCI_DEVICE_ID_TI_4451 0xac42
- +#define PCI_DEVICE_ID_TI_1420 0xac51
- +
- +#define PCI_VENDOR_ID_SONY 0x104d
- +#define PCI_DEVICE_ID_SONY_CXD3222 0x8039
- +
- +#define PCI_VENDOR_ID_OAK 0x104e
- +#define PCI_DEVICE_ID_OAK_OTI107 0x0107
- +
- +/* Winbond have two vendor IDs! See 0x10ad as well */
- +#define PCI_VENDOR_ID_WINBOND2 0x1050
- +#define PCI_DEVICE_ID_WINBOND2_89C840 0x0840
- +#define PCI_DEVICE_ID_WINBOND2_89C940 0x0940
- +#define PCI_DEVICE_ID_WINBOND2_89C940F 0x5a5a
- +#define PCI_DEVICE_ID_WINBOND2_6692 0x6692
- +
- +#define PCI_VENDOR_ID_ANIGMA 0x1051
- +#define PCI_DEVICE_ID_ANIGMA_MC145575 0x0100
- +
- +#define PCI_VENDOR_ID_EFAR 0x1055
- +#define PCI_DEVICE_ID_EFAR_SLC90E66_1 0x9130
- +#define PCI_DEVICE_ID_EFAR_SLC90E66_0 0x9460
- +#define PCI_DEVICE_ID_EFAR_SLC90E66_2 0x9462
- +#define PCI_DEVICE_ID_EFAR_SLC90E66_3 0x9463
- +
- +#define PCI_VENDOR_ID_MOTOROLA 0x1057
- +#define PCI_VENDOR_ID_MOTOROLA_OOPS 0x1507
- +#define PCI_DEVICE_ID_MOTOROLA_MPC105 0x0001
- +#define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002
- +#define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801
- +#define PCI_DEVICE_ID_MOTOROLA_FALCON 0x4802
- +#define PCI_DEVICE_ID_MOTOROLA_CPX8216 0x4806
- +
- +#define PCI_VENDOR_ID_PROMISE 0x105a
- +#define PCI_DEVICE_ID_PROMISE_20265 0x0d30
- +#define PCI_DEVICE_ID_PROMISE_20267 0x4d30
- +#define PCI_DEVICE_ID_PROMISE_20246 0x4d33
- +#define PCI_DEVICE_ID_PROMISE_20262 0x4d38
- +#define PCI_DEVICE_ID_PROMISE_20268 0x4d68
- +#define PCI_DEVICE_ID_PROMISE_20268R 0x6268
- +#define PCI_DEVICE_ID_PROMISE_20269 0x4d69
- +#define PCI_DEVICE_ID_PROMISE_20275 0x1275
- +#define PCI_DEVICE_ID_PROMISE_5300 0x5300
- +
- +#define PCI_VENDOR_ID_N9 0x105d
- +#define PCI_DEVICE_ID_N9_I128 0x2309
- +#define PCI_DEVICE_ID_N9_I128_2 0x2339
- +#define PCI_DEVICE_ID_N9_I128_T2R 0x493d
- +
- +#define PCI_VENDOR_ID_UMC 0x1060
- +#define PCI_DEVICE_ID_UMC_UM8673F 0x0101
- +#define PCI_DEVICE_ID_UMC_UM8891A 0x0891
- +#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a
- +#define PCI_DEVICE_ID_UMC_UM8886A 0x886a
- +#define PCI_DEVICE_ID_UMC_UM8881F 0x8881
- +#define PCI_DEVICE_ID_UMC_UM8886F 0x8886
- +#define PCI_DEVICE_ID_UMC_UM9017F 0x9017
- +#define PCI_DEVICE_ID_UMC_UM8886N 0xe886
- +#define PCI_DEVICE_ID_UMC_UM8891N 0xe891
- +
- +#define PCI_VENDOR_ID_X 0x1061
- +#define PCI_DEVICE_ID_X_AGX016 0x0001
- +
- +#define PCI_VENDOR_ID_MYLEX 0x1069
- +#define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001
- +#define PCI_DEVICE_ID_MYLEX_DAC960_PD 0x0002
- +#define PCI_DEVICE_ID_MYLEX_DAC960_PG 0x0010
- +#define PCI_DEVICE_ID_MYLEX_DAC960_LA 0x0020
- +#define PCI_DEVICE_ID_MYLEX_DAC960_LP 0x0050
- +#define PCI_DEVICE_ID_MYLEX_DAC960_BA 0xBA56
- +
- +#define PCI_VENDOR_ID_PICOP 0x1066
- +#define PCI_DEVICE_ID_PICOP_PT86C52X 0x0001
- +#define PCI_DEVICE_ID_PICOP_PT80C524 0x8002
- +
- +#define PCI_VENDOR_ID_APPLE 0x106b
- +#define PCI_DEVICE_ID_APPLE_BANDIT 0x0001
- +#define PCI_DEVICE_ID_APPLE_GC 0x0002
- +#define PCI_DEVICE_ID_APPLE_HYDRA 0x000e
- +#define PCI_DEVICE_ID_APPLE_UNI_N_FW 0x0018
- +#define PCI_DEVICE_ID_APPLE_KL_USB 0x0019
- +#define PCI_DEVICE_ID_APPLE_UNI_N_AGP 0x0020
- +#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC 0x0021
- +#define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030
- +
- +#define PCI_VENDOR_ID_YAMAHA 0x1073
- +#define PCI_DEVICE_ID_YAMAHA_724 0x0004
- +#define PCI_DEVICE_ID_YAMAHA_724F 0x000d
- +#define PCI_DEVICE_ID_YAMAHA_740 0x000a
- +#define PCI_DEVICE_ID_YAMAHA_740C 0x000c
- +#define PCI_DEVICE_ID_YAMAHA_744 0x0010
- +#define PCI_DEVICE_ID_YAMAHA_754 0x0012
- +
- +#define PCI_VENDOR_ID_NEXGEN 0x1074
- +#define PCI_DEVICE_ID_NEXGEN_82C501 0x4e78
- +
- +#define PCI_VENDOR_ID_QLOGIC 0x1077
- +#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020
- +#define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022
- +#define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100
- +#define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200
- +
- +#define PCI_VENDOR_ID_CYRIX 0x1078
- +#define PCI_DEVICE_ID_CYRIX_5510 0x0000
- +#define PCI_DEVICE_ID_CYRIX_PCI_MASTER 0x0001
- +#define PCI_DEVICE_ID_CYRIX_5520 0x0002
- +#define PCI_DEVICE_ID_CYRIX_5530_LEGACY 0x0100
- +#define PCI_DEVICE_ID_CYRIX_5530_SMI 0x0101
- +#define PCI_DEVICE_ID_CYRIX_5530_IDE 0x0102
- +#define PCI_DEVICE_ID_CYRIX_5530_AUDIO 0x0103
- +#define PCI_DEVICE_ID_CYRIX_5530_VIDEO 0x0104
- +
- +#define PCI_VENDOR_ID_LEADTEK 0x107d
- +#define PCI_DEVICE_ID_LEADTEK_805 0x0000
- +
- +#define PCI_VENDOR_ID_INTERPHASE 0x107e
- +#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004
- +#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005
- +#define PCI_DEVICE_ID_INTERPHASE_5575 0x0008
- +
- +#define PCI_VENDOR_ID_CONTAQ 0x1080
- +#define PCI_DEVICE_ID_CONTAQ_82C599 0x0600
- +#define PCI_DEVICE_ID_CONTAQ_82C693 0xc693
- +
- +#define PCI_VENDOR_ID_FOREX 0x1083
- +
- +#define PCI_VENDOR_ID_OLICOM 0x108d
- +#define PCI_DEVICE_ID_OLICOM_OC3136 0x0001
- +#define PCI_DEVICE_ID_OLICOM_OC2315 0x0011
- +#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012
- +#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013
- +#define PCI_DEVICE_ID_OLICOM_OC2326 0x0014
- +#define PCI_DEVICE_ID_OLICOM_OC6151 0x0021
- +
- +#define PCI_VENDOR_ID_SUN 0x108e
- +#define PCI_DEVICE_ID_SUN_EBUS 0x1000
- +#define PCI_DEVICE_ID_SUN_HAPPYMEAL 0x1001
- +#define PCI_DEVICE_ID_SUN_RIO_EBUS 0x1100
- +#define PCI_DEVICE_ID_SUN_RIO_GEM 0x1101
- +#define PCI_DEVICE_ID_SUN_RIO_1394 0x1102
- +#define PCI_DEVICE_ID_SUN_RIO_USB 0x1103
- +#define PCI_DEVICE_ID_SUN_GEM 0x2bad
- +#define PCI_DEVICE_ID_SUN_SIMBA 0x5000
- +#define PCI_DEVICE_ID_SUN_PBM 0x8000
- +#define PCI_DEVICE_ID_SUN_SCHIZO 0x8001
- +#define PCI_DEVICE_ID_SUN_SABRE 0xa000
- +#define PCI_DEVICE_ID_SUN_HUMMINGBIRD 0xa001
- +
- +#define PCI_VENDOR_ID_CMD 0x1095
- +#define PCI_DEVICE_ID_CMD_640 0x0640
- +#define PCI_DEVICE_ID_CMD_643 0x0643
- +#define PCI_DEVICE_ID_CMD_646 0x0646
- +#define PCI_DEVICE_ID_CMD_647 0x0647
- +#define PCI_DEVICE_ID_CMD_648 0x0648
- +#define PCI_DEVICE_ID_CMD_649 0x0649
- +#define PCI_DEVICE_ID_CMD_670 0x0670
- +#define PCI_DEVICE_ID_CMD_680 0x0680
- +
- +#define PCI_VENDOR_ID_VISION 0x1098
- +#define PCI_DEVICE_ID_VISION_QD8500 0x0001
- +#define PCI_DEVICE_ID_VISION_QD8580 0x0002
- +
- +#define PCI_VENDOR_ID_BROOKTREE 0x109e
- +#define PCI_DEVICE_ID_BROOKTREE_848 0x0350
- +#define PCI_DEVICE_ID_BROOKTREE_849A 0x0351
- +#define PCI_DEVICE_ID_BROOKTREE_878_1 0x036e
- +#define PCI_DEVICE_ID_BROOKTREE_878 0x0878
- +#define PCI_DEVICE_ID_BROOKTREE_8474 0x8474
- +
- +#define PCI_VENDOR_ID_SIERRA 0x10a8
- +#define PCI_DEVICE_ID_SIERRA_STB 0x0000
- +
- +#define PCI_VENDOR_ID_SGI 0x10a9
- +#define PCI_DEVICE_ID_SGI_IOC3 0x0003
- +
- +#define PCI_VENDOR_ID_ACC 0x10aa
- +#define PCI_DEVICE_ID_ACC_2056 0x0000
- +
- +#define PCI_VENDOR_ID_WINBOND 0x10ad
- +#define PCI_DEVICE_ID_WINBOND_83769 0x0001
- +#define PCI_DEVICE_ID_WINBOND_82C105 0x0105
- +#define PCI_DEVICE_ID_WINBOND_83C553 0x0565
- +
- +#define PCI_VENDOR_ID_DATABOOK 0x10b3
- +#define PCI_DEVICE_ID_DATABOOK_87144 0xb106
- +
- +#define PCI_VENDOR_ID_PLX 0x10b5
- +#define PCI_DEVICE_ID_PLX_R685 0x1030
- +#define PCI_DEVICE_ID_PLX_ROMULUS 0x106a
- +#define PCI_DEVICE_ID_PLX_SPCOM800 0x1076
- +#define PCI_DEVICE_ID_PLX_1077 0x1077
- +#define PCI_DEVICE_ID_PLX_SPCOM200 0x1103
- +#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151
- +#define PCI_DEVICE_ID_PLX_R753 0x1152
- +#define PCI_DEVICE_ID_PLX_9050 0x9050
- +#define PCI_DEVICE_ID_PLX_9060 0x9060
- +#define PCI_DEVICE_ID_PLX_9060ES 0x906E
- +#define PCI_DEVICE_ID_PLX_9060SD 0x906D
- +#define PCI_DEVICE_ID_PLX_9080 0x9080
- +#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001
- +
- +#define PCI_VENDOR_ID_MADGE 0x10b6
- +#define PCI_DEVICE_ID_MADGE_MK2 0x0002
- +#define PCI_DEVICE_ID_MADGE_C155S 0x1001
- +
- +#define PCI_VENDOR_ID_3COM 0x10b7
- +#define PCI_DEVICE_ID_3COM_3C985 0x0001
- +#define PCI_DEVICE_ID_3COM_3C339 0x3390
- +#define PCI_DEVICE_ID_3COM_3C590 0x5900
- +#define PCI_DEVICE_ID_3COM_3C595 0x5950
- +#define PCI_DEVICE_ID_3COM_3C595TX 0x5950
- +#define PCI_DEVICE_ID_3COM_3C595_1 0x5951
- +#define PCI_DEVICE_ID_3COM_3C595T4 0x5951
- +#define PCI_DEVICE_ID_3COM_3C595_2 0x5952
- +#define PCI_DEVICE_ID_3COM_3C595MII 0x5952
- +#define PCI_DEVICE_ID_3COM_3C900TPO 0x9000
- +#define PCI_DEVICE_ID_3COM_3C900COMBO 0x9001
- +#define PCI_DEVICE_ID_3COM_3C905TX 0x9050
- +#define PCI_DEVICE_ID_3COM_3C905T4 0x9051
- +#define PCI_DEVICE_ID_3COM_3C905B_TX 0x9055
- +#define PCI_DEVICE_ID_3COM_3C905C_TXM 0x9200
- +
- +#define PCI_VENDOR_ID_SMC 0x10b8
- +#define PCI_DEVICE_ID_SMC_EPIC100 0x0005
- +
- +#define PCI_VENDOR_ID_SUNDANCE 0x13F0
- +#define PCI_DEVICE_ID_SUNDANCE_ALTA 0x0201
- +
- +#define PCI_VENDOR_ID_AL 0x10b9
- +#define PCI_DEVICE_ID_AL_M1445 0x1445
- +#define PCI_DEVICE_ID_AL_M1449 0x1449
- +#define PCI_DEVICE_ID_AL_M1451 0x1451
- +#define PCI_DEVICE_ID_AL_M1461 0x1461
- +#define PCI_DEVICE_ID_AL_M1489 0x1489
- +#define PCI_DEVICE_ID_AL_M1511 0x1511
- +#define PCI_DEVICE_ID_AL_M1513 0x1513
- +#define PCI_DEVICE_ID_AL_M1521 0x1521
- +#define PCI_DEVICE_ID_AL_M1523 0x1523
- +#define PCI_DEVICE_ID_AL_M1531 0x1531
- +#define PCI_DEVICE_ID_AL_M1533 0x1533
- +#define PCI_DEVICE_ID_AL_M1541 0x1541
- +#define PCI_DEVICE_ID_AL_M1621 0x1621
- +#define PCI_DEVICE_ID_AL_M1631 0x1631
- +#define PCI_DEVICE_ID_AL_M1641 0x1641
- +#define PCI_DEVICE_ID_AL_M1647 0x1647
- +#define PCI_DEVICE_ID_AL_M1651 0x1651
- +#define PCI_DEVICE_ID_AL_M1543 0x1543
- +#define PCI_DEVICE_ID_AL_M3307 0x3307
- +#define PCI_DEVICE_ID_AL_M4803 0x5215
- +#define PCI_DEVICE_ID_AL_M5219 0x5219
- +#define PCI_DEVICE_ID_AL_M5229 0x5229
- +#define PCI_DEVICE_ID_AL_M5237 0x5237
- +#define PCI_DEVICE_ID_AL_M5243 0x5243
- +#define PCI_DEVICE_ID_AL_M5451 0x5451
- +#define PCI_DEVICE_ID_AL_M7101 0x7101
- +
- +#define PCI_VENDOR_ID_MITSUBISHI 0x10ba
- +
- +#define PCI_VENDOR_ID_SURECOM 0x10bd
- +#define PCI_DEVICE_ID_SURECOM_NE34 0x0e34
- +
- +#define PCI_VENDOR_ID_NEOMAGIC 0x10c8
- +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2070 0x0001
- +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128V 0x0002
- +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZV 0x0003
- +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2160 0x0004
- +#define PCI_DEVICE_ID_NEOMAGIC_MAGICMEDIA_256AV 0x0005
- +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZVPLUS 0x0083
- +
- +#define PCI_VENDOR_ID_ASP 0x10cd
- +#define PCI_DEVICE_ID_ASP_ABP940 0x1200
- +#define PCI_DEVICE_ID_ASP_ABP940U 0x1300
- +#define PCI_DEVICE_ID_ASP_ABP940UW 0x2300
- +
- +#define PCI_VENDOR_ID_MACRONIX 0x10d9
- +#define PCI_DEVICE_ID_MACRONIX_MX98713 0x0512
- +#define PCI_DEVICE_ID_MX987x3 0x0512
- +#define PCI_DEVICE_ID_MACRONIX_MX987x5 0x0531
- +#define PCI_DEVICE_ID_MX987x5 0x0531
- +
- +#define PCI_VENDOR_ID_TCONRAD 0x10da
- +#define PCI_DEVICE_ID_TCONRAD_TOKENRING 0x0508
- +
- +#define PCI_VENDOR_ID_CERN 0x10dc
- +#define PCI_DEVICE_ID_CERN_SPSB_PMC 0x0001
- +#define PCI_DEVICE_ID_CERN_SPSB_PCI 0x0002
- +#define PCI_DEVICE_ID_CERN_HIPPI_DST 0x0021
- +#define PCI_DEVICE_ID_CERN_HIPPI_SRC 0x0022
- +
- +#define PCI_VENDOR_ID_NVIDIA 0x10de
- +#define PCI_DEVICE_ID_NVIDIA_TNT 0x0020
- +#define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028
- +#define PCI_DEVICE_ID_NVIDIA_UTNT2 0x0029
- +#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C
- +#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D
- +#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0
- +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100
- +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101
- +#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103
- +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX 0x0110
- +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX2 0x0111
- +#define PCI_DEVICE_ID_NVIDIA_QUADRO2_MXR 0x0113
- +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS 0x0150
- +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2 0x0151
- +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA 0x0152
- +#define PCI_DEVICE_ID_NVIDIA_QUADRO2_PRO 0x0153
- +
- +#define PCI_VENDOR_ID_IMS 0x10e0
- +#define PCI_DEVICE_ID_IMS_8849 0x8849
- +#define PCI_DEVICE_ID_IMS_TT128 0x9128
- +#define PCI_DEVICE_ID_IMS_TT3D 0x9135
- +
- +#define PCI_VENDOR_ID_TEKRAM2 0x10e1
- +#define PCI_DEVICE_ID_TEKRAM2_690c 0x690c
- +
- +#define PCI_VENDOR_ID_TUNDRA 0x10e3
- +#define PCI_DEVICE_ID_TUNDRA_CA91C042 0x0000
- +
- +#define PCI_VENDOR_ID_AMCC 0x10e8
- +#define PCI_DEVICE_ID_AMCC_MYRINET 0x8043
- +#define PCI_DEVICE_ID_AMCC_PARASTATION 0x8062
- +#define PCI_DEVICE_ID_AMCC_S5933 0x807d
- +#define PCI_DEVICE_ID_AMCC_S5933_HEPC3 0x809c
- +
- +#define PCI_VENDOR_ID_INTERG 0x10ea
- +#define PCI_DEVICE_ID_INTERG_1680 0x1680
- +#define PCI_DEVICE_ID_INTERG_1682 0x1682
- +#define PCI_DEVICE_ID_INTERG_2000 0x2000
- +#define PCI_DEVICE_ID_INTERG_2010 0x2010
- +#define PCI_DEVICE_ID_INTERG_5000 0x5000
- +#define PCI_DEVICE_ID_INTERG_5050 0x5050
- +
- +#define PCI_VENDOR_ID_REALTEK 0x10ec
- +#define PCI_DEVICE_ID_REALTEK_8029 0x8029
- +#define PCI_DEVICE_ID_REALTEK_8129 0x8129
- +#define PCI_DEVICE_ID_REALTEK_8139 0x8139
- +
- +#define PCI_VENDOR_ID_XILINX 0x10ee
- +#define PCI_DEVICE_ID_TURBOPAM 0x4020
- +
- +#define PCI_VENDOR_ID_TRUEVISION 0x10fa
- +#define PCI_DEVICE_ID_TRUEVISION_T1000 0x000c
- +
- +#define PCI_VENDOR_ID_INIT 0x1101
- +#define PCI_DEVICE_ID_INIT_320P 0x9100
- +#define PCI_DEVICE_ID_INIT_360P 0x9500
- +
- +#define PCI_VENDOR_ID_CREATIVE 0x1102 // duplicate: ECTIVA
- +#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002
- +
- +#define PCI_VENDOR_ID_ECTIVA 0x1102 // duplicate: CREATIVE
- +#define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938
- +
- +#define PCI_VENDOR_ID_TTI 0x1103
- +#define PCI_DEVICE_ID_TTI_HPT343 0x0003
- +#define PCI_DEVICE_ID_TTI_HPT366 0x0004
- +
- +#define PCI_VENDOR_ID_VIA 0x1106
- +#define PCI_VENDOR_ID_VIATEC 0x1106
- +#define PCI_DEVICE_ID_VIA_8363_0 0x0305
- +#define PCI_DEVICE_ID_VIA_8371_0 0x0391
- +#define PCI_DEVICE_ID_VIA_8501_0 0x0501
- +#define PCI_DEVICE_ID_VIA_82C505 0x0505
- +#define PCI_DEVICE_ID_VIA_82C561 0x0561
- +#define PCI_DEVICE_ID_VIA_82C586_1 0x0571
- +#define PCI_DEVICE_ID_VIA_82C576 0x0576
- +#define PCI_DEVICE_ID_VIA_82C585 0x0585
- +#define PCI_DEVICE_ID_VIA_82C586_0 0x0586
- +#define PCI_DEVICE_ID_VIA_82C595 0x0595
- +#define PCI_DEVICE_ID_VIA_82C596 0x0596
- +#define PCI_DEVICE_ID_VIA_82C597_0 0x0597
- +#define PCI_DEVICE_ID_VIA_82C598_0 0x0598
- +#define PCI_DEVICE_ID_VIA_8601_0 0x0601
- +#define PCI_DEVICE_ID_VIA_8605_0 0x0605
- +#define PCI_DEVICE_ID_VIA_82C680 0x0680
- +#define PCI_DEVICE_ID_VIA_82C686 0x0686
- +#define PCI_DEVICE_ID_VIA_82C691 0x0691
- +#define PCI_DEVICE_ID_VIA_82C693 0x0693
- +#define PCI_DEVICE_ID_VIA_82C693_1 0x0698
- +#define PCI_DEVICE_ID_VIA_82C926 0x0926
- +#define PCI_DEVICE_ID_VIA_82C576_1 0x1571
- +#define PCI_DEVICE_ID_VIA_82C595_97 0x1595
- +#define PCI_DEVICE_ID_VIA_82C586_2 0x3038
- +#define PCI_DEVICE_ID_VIA_82C586_3 0x3040
- +#define PCI_DEVICE_ID_VIA_RHINE_I 0x3043
- +#define PCI_DEVICE_ID_VIA_6305 0x3044
- +#define PCI_DEVICE_ID_VIA_82C596_3 0x3050
- +#define PCI_DEVICE_ID_VIA_82C596B_3 0x3051
- +#define PCI_DEVICE_ID_VIA_82C686_4 0x3057
- +#define PCI_DEVICE_ID_VIA_82C686_5 0x3058
- +#define PCI_DEVICE_ID_VIA_8233_5 0x3059
- +#define PCI_DEVICE_ID_VIA_8233_7 0x3065
- +#define PCI_DEVICE_ID_VIA_VT6102 0x3065
- +#define PCI_DEVICE_ID_VIA_82C686_6 0x3068
- +#define PCI_DEVICE_ID_VIA_8233_0 0x3074
- +#define PCI_DEVICE_ID_VIA_VT6105 0x3106
- +#define PCI_DEVICE_ID_VIA_8233C_0 0x3109
- +#define PCI_DEVICE_ID_VIA_8633_0 0x3091
- +#define PCI_DEVICE_ID_VIA_8367_0 0x3099
- +#define PCI_DEVICE_ID_VIA_86C100A 0x6100
- +#define PCI_DEVICE_ID_VIA_8231 0x8231
- +#define PCI_DEVICE_ID_VIA_8231_4 0x8235
- +#define PCI_DEVICE_ID_VIA_8365_1 0x8305
- +#define PCI_DEVICE_ID_VIA_8371_1 0x8391
- +#define PCI_DEVICE_ID_VIA_8501_1 0x8501
- +#define PCI_DEVICE_ID_VIA_82C597_1 0x8597
- +#define PCI_DEVICE_ID_VIA_82C598_1 0x8598
- +#define PCI_DEVICE_ID_VIA_8601_1 0x8601
- +#define PCI_DEVICE_ID_VIA_8505_1 0X8605
- +#define PCI_DEVICE_ID_VIA_8633_1 0xB091
- +#define PCI_DEVICE_ID_VIA_8367_1 0xB099
- +
- +#define PCI_VENDOR_ID_SIEMENS 0x110A
- +#define PCI_DEVICE_ID_SIEMENS_DSCC4 0x2102
- +
- +#define PCI_VENDOR_ID_SMC2 0x1113
- +#define PCI_DEVICE_ID_SMC2_1211TX 0x1211
- +#define PCI_DEVICE_ID_SMC2_1211 0x1211
- +#define PCI_DEVICE_ID_SMC2_1216 0x1216
- +
- +#define PCI_VENDOR_ID_VORTEX 0x1119
- +#define PCI_DEVICE_ID_VORTEX_GDT60x0 0x0000
- +#define PCI_DEVICE_ID_VORTEX_GDT6000B 0x0001
- +#define PCI_DEVICE_ID_VORTEX_GDT6x10 0x0002
- +#define PCI_DEVICE_ID_VORTEX_GDT6x20 0x0003
- +#define PCI_DEVICE_ID_VORTEX_GDT6530 0x0004
- +#define PCI_DEVICE_ID_VORTEX_GDT6550 0x0005
- +#define PCI_DEVICE_ID_VORTEX_GDT6x17 0x0006
- +#define PCI_DEVICE_ID_VORTEX_GDT6x27 0x0007
- +#define PCI_DEVICE_ID_VORTEX_GDT6537 0x0008
- +#define PCI_DEVICE_ID_VORTEX_GDT6557 0x0009
- +#define PCI_DEVICE_ID_VORTEX_GDT6x15 0x000a
- +#define PCI_DEVICE_ID_VORTEX_GDT6x25 0x000b
- +#define PCI_DEVICE_ID_VORTEX_GDT6535 0x000c
- +#define PCI_DEVICE_ID_VORTEX_GDT6555 0x000d
- +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP 0x0100
- +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP 0x0101
- +#define PCI_DEVICE_ID_VORTEX_GDT6537RP 0x0102
- +#define PCI_DEVICE_ID_VORTEX_GDT6557RP 0x0103
- +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP 0x0104
- +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP 0x0105
- +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP1 0x0110
- +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP1 0x0111
- +#define PCI_DEVICE_ID_VORTEX_GDT6537RP1 0x0112
- +#define PCI_DEVICE_ID_VORTEX_GDT6557RP1 0x0113
- +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP1 0x0114
- +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP1 0x0115
- +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP2 0x0120
- +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP2 0x0121
- +#define PCI_DEVICE_ID_VORTEX_GDT6537RP2 0x0122
- +#define PCI_DEVICE_ID_VORTEX_GDT6557RP2 0x0123
- +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP2 0x0124
- +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP2 0x0125
- +
- +#define PCI_VENDOR_ID_EF 0x111a
- +#define PCI_DEVICE_ID_EF_ATM_FPGA 0x0000
- +#define PCI_DEVICE_ID_EF_ATM_ASIC 0x0002
- +
- +#define PCI_VENDOR_ID_IDT 0x111d
- +#define PCI_DEVICE_ID_IDT_IDT77201 0x0001
- +
- +#define PCI_VENDOR_ID_FORE 0x1127
- +#define PCI_DEVICE_ID_FORE_PCA200PC 0x0210
- +#define PCI_DEVICE_ID_FORE_PCA200E 0x0300
- +
- +#define PCI_VENDOR_ID_IMAGINGTECH 0x112f
- +#define PCI_DEVICE_ID_IMAGINGTECH_ICPCI 0x0000
- +
- +#define PCI_VENDOR_ID_PHILIPS 0x1131
- +#define PCI_DEVICE_ID_PHILIPS_SAA7145 0x7145
- +#define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146
- +#define PCI_DEVICE_ID_PHILIPS_SAA9730 0x9730
- +
- +#define PCI_VENDOR_ID_EICON 0x1133
- +#define PCI_DEVICE_ID_EICON_DIVA20PRO 0xe001
- +#define PCI_DEVICE_ID_EICON_DIVA20 0xe002
- +#define PCI_DEVICE_ID_EICON_DIVA20PRO_U 0xe003
- +#define PCI_DEVICE_ID_EICON_DIVA20_U 0xe004
- +#define PCI_DEVICE_ID_EICON_DIVA201 0xe005
- +#define PCI_DEVICE_ID_EICON_MAESTRA 0xe010
- +#define PCI_DEVICE_ID_EICON_MAESTRAQ 0xe012
- +#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013
- +#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014
- +
- +#define PCI_VENDOR_ID_CYCLONE 0x113c
- +#define PCI_DEVICE_ID_CYCLONE_SDK 0x0001
- +
- +#define PCI_VENDOR_ID_ALLIANCE 0x1142
- +#define PCI_DEVICE_ID_ALLIANCE_PROMOTIO 0x3210
- +#define PCI_DEVICE_ID_ALLIANCE_PROVIDEO 0x6422
- +#define PCI_DEVICE_ID_ALLIANCE_AT24 0x6424
- +#define PCI_DEVICE_ID_ALLIANCE_AT3D 0x643d
- +
- +#define PCI_VENDOR_ID_SYSKONNECT 0x1148
- +#define PCI_DEVICE_ID_SYSKONNECT_FP 0x4000
- +#define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200
- +#define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300
- +
- +#define PCI_VENDOR_ID_VMIC 0x114a
- +#define PCI_DEVICE_ID_VMIC_VME 0x7587
- +
- +#define PCI_VENDOR_ID_DIGI 0x114f
- +#define PCI_DEVICE_ID_DIGI_EPC 0x0002
- +#define PCI_DEVICE_ID_DIGI_RIGHTSWITCH 0x0003
- +#define PCI_DEVICE_ID_DIGI_XEM 0x0004
- +#define PCI_DEVICE_ID_DIGI_XR 0x0005
- +#define PCI_DEVICE_ID_DIGI_CX 0x0006
- +#define PCI_DEVICE_ID_DIGI_XRJ 0x0009
- +#define PCI_DEVICE_ID_DIGI_EPCJ 0x000a
- +#define PCI_DEVICE_ID_DIGI_XR_920 0x0027
- +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070
- +#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071
- +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072
- +#define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073
- +
- +#define PCI_VENDOR_ID_MUTECH 0x1159
- +#define PCI_DEVICE_ID_MUTECH_MV1000 0x0001
- +
- +#define PCI_VENDOR_ID_XIRCOM 0x115d
- +#define PCI_DEVICE_ID_XIRCOM_X3201_ETH 0x0003
- +#define PCI_DEVICE_ID_XIRCOM_X3201_MDM 0x0103
- +
- +#define PCI_VENDOR_ID_RENDITION 0x1163
- +#define PCI_DEVICE_ID_RENDITION_VERITE 0x0001
- +#define PCI_DEVICE_ID_RENDITION_VERITE2100 0x2000
- +
- +#define PCI_VENDOR_ID_SERVERWORKS 0x1166
- +#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008
- +#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
- +#define PCI_DEVICE_ID_SERVERWORKS_CIOB30 0x0010
- +#define PCI_DEVICE_ID_SERVERWORKS_CMIC_HE 0x0011
- +#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
- +#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
- +#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211
- +#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212
- +#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220
- +#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB
- +#define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230
- +
- +#define PCI_VENDOR_ID_SBE 0x1176
- +#define PCI_DEVICE_ID_SBE_WANXL100 0x0301
- +#define PCI_DEVICE_ID_SBE_WANXL200 0x0302
- +#define PCI_DEVICE_ID_SBE_WANXL400 0x0104
- +
- +#define PCI_VENDOR_ID_TOSHIBA 0x1179
- +#define PCI_DEVICE_ID_TOSHIBA_601 0x0601
- +#define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a
- +#define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f
- +
- +#define PCI_VENDOR_ID_RICOH 0x1180
- +#define PCI_DEVICE_ID_RICOH_RL5C465 0x0465
- +#define PCI_DEVICE_ID_RICOH_RL5C466 0x0466
- +#define PCI_DEVICE_ID_RICOH_RL5C475 0x0475
- +#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
- +#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
- +
- +#define PCI_VENDOR_ID_DLINK 0x1186
- +#define PCI_DEVICE_ID_DFE530TXP 0x1300
- +#define PCI_DEVICE_ID_DFE530TXS 0x1002
- +
- +#define PCI_VENDOR_ID_ARTOP 0x1191
- +#define PCI_DEVICE_ID_ARTOP_ATP8400 0x0004
- +#define PCI_DEVICE_ID_ARTOP_ATP850UF 0x0005
- +#define PCI_DEVICE_ID_ARTOP_ATP860 0x0006
- +#define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007
- +#define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002
- +#define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010
- +#define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020
- +#define PCI_DEVICE_ID_ARTOP_AEC7612S 0x8030
- +#define PCI_DEVICE_ID_ARTOP_AEC7612D 0x8040
- +#define PCI_DEVICE_ID_ARTOP_AEC7612SUW 0x8050
- +#define PCI_DEVICE_ID_ARTOP_8060 0x8060
- +
- +#define PCI_VENDOR_ID_ZEITNET 0x1193
- +#define PCI_DEVICE_ID_ZEITNET_1221 0x0001
- +#define PCI_DEVICE_ID_ZEITNET_1225 0x0002
- +
- +#define PCI_VENDOR_ID_OMEGA 0x119b
- +#define PCI_DEVICE_ID_OMEGA_82C092G 0x1221
- +
- +#define PCI_VENDOR_ID_FUJITSU_ME 0x119e
- +#define PCI_DEVICE_ID_FUJITSU_FS155 0x0001
- +#define PCI_DEVICE_ID_FUJITSU_FS50 0x0003
- +
- +#define PCI_SUBVENDOR_ID_KEYSPAN 0x11a9
- +#define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334
- +
- +#define PCI_VENDOR_ID_GALILEO 0x11ab
- +#define PCI_DEVICE_ID_GALILEO_GT64011 0x4146
- +#define PCI_DEVICE_ID_GALILEO_GT64111 0x4146
- +#define PCI_DEVICE_ID_GALILEO_GT96100 0x9652
- +#define PCI_DEVICE_ID_GALILEO_GT96100A 0x9653
- +
- +#define PCI_VENDOR_ID_LINKSYS 0x11ad
- +#define PCI_VENDOR_ID_LITEON 0x11ad
- +#define PCI_DEVICE_ID_LITEON_LNE100TX 0x0002
- +#define PCI_DEVICE_ID_LC82C115 0xC115
- +
- +#define PCI_VENDOR_ID_V3 0x11b0
- +#define PCI_DEVICE_ID_V3_V960 0x0001
- +#define PCI_DEVICE_ID_V3_V350 0x0001
- +#define PCI_DEVICE_ID_V3_V961 0x0002
- +#define PCI_DEVICE_ID_V3_V351 0x0002
- +
- +#define PCI_VENDOR_ID_NP 0x11bc
- +#define PCI_DEVICE_ID_NP_PCI_FDDI 0x0001
- +
- +#define PCI_VENDOR_ID_ATT 0x11c1
- +#define PCI_DEVICE_ID_ATT_L56XMF 0x0440
- +#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480
- +
- +#define PCI_VENDOR_ID_SPECIALIX 0x11cb
- +#define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000
- +#define PCI_DEVICE_ID_SPECIALIX_XIO 0x4000
- +#define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000
- +#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004
- +
- +#define PCI_VENDOR_ID_AURAVISION 0x11d1
- +#define PCI_DEVICE_ID_AURAVISION_VXP524 0x01f7
- +
- +#define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4
- +#define PCI_DEVICE_ID_AD1889JS 0x1889
- +
- +#define PCI_VENDOR_ID_IKON 0x11d5
- +#define PCI_DEVICE_ID_IKON_10115 0x0115
- +#define PCI_DEVICE_ID_IKON_10117 0x0117
- +
- +#define PCI_VENDOR_ID_ZORAN 0x11de
- +#define PCI_DEVICE_ID_ZORAN_36057 0x6057
- +#define PCI_DEVICE_ID_ZORAN_36120 0x6120
- +
- +#define PCI_VENDOR_ID_KINETIC 0x11f4
- +#define PCI_DEVICE_ID_KINETIC_2915 0x2915
- +
- +#define PCI_VENDOR_ID_COMPEX 0x11f6
- +#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112
- +#define PCI_DEVICE_ID_COMPEX_RL2000 0x1401
- +#define PCI_DEVICE_ID_COMPEX_RL100ATX 0x2011
- +
- +#define PCI_VENDOR_ID_RP 0x11fe
- +#define PCI_DEVICE_ID_RP32INTF 0x0001
- +#define PCI_DEVICE_ID_RP8INTF 0x0002
- +#define PCI_DEVICE_ID_RP16INTF 0x0003
- +#define PCI_DEVICE_ID_RP4QUAD 0x0004
- +#define PCI_DEVICE_ID_RP8OCTA 0x0005
- +#define PCI_DEVICE_ID_RP8J 0x0006
- +#define PCI_DEVICE_ID_RPP4 0x000A
- +#define PCI_DEVICE_ID_RPP8 0x000B
- +#define PCI_DEVICE_ID_RP8M 0x000C
- +
- +#define PCI_VENDOR_ID_CYCLADES 0x120e
- +#define PCI_DEVICE_ID_CYCLOM_Y_Lo 0x0100
- +#define PCI_DEVICE_ID_CYCLOM_Y_Hi 0x0101
- +#define PCI_DEVICE_ID_CYCLOM_4Y_Lo 0x0102
- +#define PCI_DEVICE_ID_CYCLOM_4Y_Hi 0x0103
- +#define PCI_DEVICE_ID_CYCLOM_8Y_Lo 0x0104
- +#define PCI_DEVICE_ID_CYCLOM_8Y_Hi 0x0105
- +#define PCI_DEVICE_ID_CYCLOM_Z_Lo 0x0200
- +#define PCI_DEVICE_ID_CYCLOM_Z_Hi 0x0201
- +#define PCI_DEVICE_ID_PC300_RX_2 0x0300
- +#define PCI_DEVICE_ID_PC300_RX_1 0x0301
- +#define PCI_DEVICE_ID_PC300_TE_2 0x0310
- +#define PCI_DEVICE_ID_PC300_TE_1 0x0311
- +
- +#define PCI_VENDOR_ID_ESSENTIAL 0x120f
- +#define PCI_DEVICE_ID_ESSENTIAL_ROADRUNNER 0x0001
- +
- +#define PCI_VENDOR_ID_O2 0x1217
- +#define PCI_DEVICE_ID_O2_6729 0x6729
- +#define PCI_DEVICE_ID_O2_6730 0x673a
- +#define PCI_DEVICE_ID_O2_6832 0x6832
- +#define PCI_DEVICE_ID_O2_6836 0x6836
- +
- +#define PCI_VENDOR_ID_3DFX 0x121a
- +#define PCI_DEVICE_ID_3DFX_VOODOO 0x0001
- +#define PCI_DEVICE_ID_3DFX_VOODOO2 0x0002
- +#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003
- +#define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005
- +
- +#define PCI_VENDOR_ID_SIGMADES 0x1236
- +#define PCI_DEVICE_ID_SIGMADES_6425 0x6401
- +
- +#define PCI_VENDOR_ID_CCUBE 0x123f
- +
- +#define PCI_VENDOR_ID_AVM 0x1244
- +#define PCI_DEVICE_ID_AVM_B1 0x0700
- +#define PCI_DEVICE_ID_AVM_C4 0x0800
- +#define PCI_DEVICE_ID_AVM_A1 0x0a00
- +#define PCI_DEVICE_ID_AVM_A1_V2 0x0e00
- +#define PCI_DEVICE_ID_AVM_C2 0x1100
- +#define PCI_DEVICE_ID_AVM_T1 0x1200
- +
- +#define PCI_VENDOR_ID_DIPIX 0x1246
- +
- +#define PCI_VENDOR_ID_STALLION 0x124d
- +#define PCI_DEVICE_ID_STALLION_ECHPCI832 0x0000
- +#define PCI_DEVICE_ID_STALLION_ECHPCI864 0x0002
- +#define PCI_DEVICE_ID_STALLION_EIOPCI 0x0003
- +
- +#define PCI_VENDOR_ID_OPTIBASE 0x1255
- +#define PCI_DEVICE_ID_OPTIBASE_FORGE 0x1110
- +#define PCI_DEVICE_ID_OPTIBASE_FUSION 0x1210
- +#define PCI_DEVICE_ID_OPTIBASE_VPLEX 0x2110
- +#define PCI_DEVICE_ID_OPTIBASE_VPLEXCC 0x2120
- +#define PCI_DEVICE_ID_OPTIBASE_VQUEST 0x2130
- +
- +#define PCI_VENDOR_ID_ESS 0x125d
- +#define PCI_DEVICE_ID_ESS_ESS1968 0x1968
- +#define PCI_DEVICE_ID_ESS_AUDIOPCI 0x1969
- +#define PCI_DEVICE_ID_ESS_ESS1978 0x1978
- +
- +#define PCI_VENDOR_ID_HARRIS 0x1260
- +#define PCI_DEVICE_ID_HARRIS_PRISM2 0x3873
- +
- +#define PCI_VENDOR_ID_SATSAGEM 0x1267
- +#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016
- +#define PCI_DEVICE_ID_SATSAGEM_PCR2101 0x5352
- +#define PCI_DEVICE_ID_SATSAGEM_TELSATTURBO 0x5a4b
- +
- +#define PCI_VENDOR_ID_HUGHES 0x1273
- +#define PCI_DEVICE_ID_HUGHES_DIRECPC 0x0002
- +
- +#define PCI_VENDOR_ID_ENSONIQ 0x1274
- +#define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880
- +#define PCI_DEVICE_ID_ENSONIQ_ES1370 0x5000
- +#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371
- +
- +#define PCI_VENDOR_ID_ROCKWELL 0x127A
- +
- +#define PCI_VENDOR_ID_DAVICOM 0x1282
- +#define PCI_DEVICE_ID_DM9009 0x9009
- +#define PCI_DEVICE_ID_DM9102 0x9102
- +
- +#define PCI_VENDOR_ID_ITE 0x1283
- +#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801
- +#define PCI_DEVICE_ID_ITE_IT8172G 0x8172
- +#define PCI_DEVICE_ID_ITE_8872 0x8872
- +
- +
- +/* formerly Platform Tech */
- +#define PCI_VENDOR_ID_ESS_OLD 0x1285
- +#define PCI_DEVICE_ID_ESS_ESS0100 0x0100
- +
- +#define PCI_VENDOR_ID_ALTEON 0x12ae
- +#define PCI_DEVICE_ID_ALTEON_ACENIC 0x0001
- +
- +#define PCI_VENDOR_ID_USR 0x12B9
- +
- +#define PCI_VENDOR_ID_HOLTEK 0x12c3
- +#define PCI_DEVICE_ID_HOLTEK_HT80232 0x0058
- +
- +#define PCI_SUBVENDOR_ID_CONNECT_TECH 0x12c4
- +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232 0x0001
- +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232 0x0002
- +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232 0x0003
- +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485 0x0004
- +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4 0x0005
- +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485 0x0006
- +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2 0x0007
- +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485 0x0008
- +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009
- +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A
- +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B
- +
- +#define PCI_VENDOR_ID_PICTUREL 0x12c5
- +#define PCI_DEVICE_ID_PICTUREL_PCIVST 0x0081
- +
- +#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2
- +#define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018
- +
- +#define PCI_SUBVENDOR_ID_CHASE_PCIFAST 0x12E0
- +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST4 0x0031
- +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST8 0x0021
- +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16 0x0011
- +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC 0x0041
- +#define PCI_SUBVENDOR_ID_CHASE_PCIRAS 0x124D
- +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS4 0xF001
- +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS8 0xF010
- +
- +#define PCI_VENDOR_ID_AUREAL 0x12eb
- +#define PCI_DEVICE_ID_AUREAL_VORTEX_1 0x0001
- +#define PCI_DEVICE_ID_AUREAL_VORTEX_2 0x0002
- +
- +#define PCI_VENDOR_ID_CBOARDS 0x1307
- +#define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001
- +
- +#define PCI_VENDOR_ID_SIIG 0x131f
- +#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000
- +#define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001
- +#define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002
- +#define PCI_DEVICE_ID_SIIG_1S1P_10x_550 0x1010
- +#define PCI_DEVICE_ID_SIIG_1S1P_10x_650 0x1011
- +#define PCI_DEVICE_ID_SIIG_1S1P_10x_850 0x1012
- +#define PCI_DEVICE_ID_SIIG_1P_10x 0x1020
- +#define PCI_DEVICE_ID_SIIG_2P_10x 0x1021
- +#define PCI_DEVICE_ID_SIIG_2S_10x_550 0x1030
- +#define PCI_DEVICE_ID_SIIG_2S_10x_650 0x1031
- +#define PCI_DEVICE_ID_SIIG_2S_10x_850 0x1032
- +#define PCI_DEVICE_ID_SIIG_2S1P_10x_550 0x1034
- +#define PCI_DEVICE_ID_SIIG_2S1P_10x_650 0x1035
- +#define PCI_DEVICE_ID_SIIG_2S1P_10x_850 0x1036
- +#define PCI_DEVICE_ID_SIIG_4S_10x_550 0x1050
- +#define PCI_DEVICE_ID_SIIG_4S_10x_650 0x1051
- +#define PCI_DEVICE_ID_SIIG_4S_10x_850 0x1052
- +#define PCI_DEVICE_ID_SIIG_1S_20x_550 0x2000
- +#define PCI_DEVICE_ID_SIIG_1S_20x_650 0x2001
- +#define PCI_DEVICE_ID_SIIG_1S_20x_850 0x2002
- +#define PCI_DEVICE_ID_SIIG_1P_20x 0x2020
- +#define PCI_DEVICE_ID_SIIG_2P_20x 0x2021
- +#define PCI_DEVICE_ID_SIIG_2S_20x_550 0x2030
- +#define PCI_DEVICE_ID_SIIG_2S_20x_650 0x2031
- +#define PCI_DEVICE_ID_SIIG_2S_20x_850 0x2032
- +#define PCI_DEVICE_ID_SIIG_2P1S_20x_550 0x2040
- +#define PCI_DEVICE_ID_SIIG_2P1S_20x_650 0x2041
- +#define PCI_DEVICE_ID_SIIG_2P1S_20x_850 0x2042
- +#define PCI_DEVICE_ID_SIIG_1S1P_20x_550 0x2010
- +#define PCI_DEVICE_ID_SIIG_1S1P_20x_650 0x2011
- +#define PCI_DEVICE_ID_SIIG_1S1P_20x_850 0x2012
- +#define PCI_DEVICE_ID_SIIG_4S_20x_550 0x2050
- +#define PCI_DEVICE_ID_SIIG_4S_20x_650 0x2051
- +#define PCI_DEVICE_ID_SIIG_4S_20x_850 0x2052
- +#define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060
- +#define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061
- +#define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062
- +
- +#define PCI_VENDOR_ID_ADMTEK 0x1317
- +#define PCI_DEVICE_ID_ADMTEK_0985 0x0985
- +
- +#define PCI_VENDOR_ID_DOMEX 0x134a
- +#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001
- +
- +#define PCI_VENDOR_ID_QUATECH 0x135C
- +#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010
- +#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020
- +#define PCI_DEVICE_ID_QUATECH_DSC200 0x0030
- +#define PCI_DEVICE_ID_QUATECH_QSC200 0x0040
- +#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050
- +#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060
- +
- +#define PCI_VENDOR_ID_SEALEVEL 0x135e
- +#define PCI_DEVICE_ID_SEALEVEL_U530 0x7101
- +#define PCI_DEVICE_ID_SEALEVEL_UCOMM2 0x7201
- +#define PCI_DEVICE_ID_SEALEVEL_UCOMM422 0x7402
- +#define PCI_DEVICE_ID_SEALEVEL_UCOMM232 0x7202
- +#define PCI_DEVICE_ID_SEALEVEL_COMM4 0x7401
- +#define PCI_DEVICE_ID_SEALEVEL_COMM8 0x7801
- +
- +#define PCI_VENDOR_ID_HYPERCOPE 0x1365
- +#define PCI_DEVICE_ID_HYPERCOPE_PLX 0x9050
- +#define PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO 0x0104
- +#define PCI_SUBDEVICE_ID_HYPERCOPE_ERGO 0x0106
- +#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107
- +#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108
- +#define PCI_SUBDEVICE_ID_HYPERCOPE_PLEXUS 0x0109
- +
- +#define PCI_VENDOR_ID_KAWASAKI 0x136b
- +#define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01
- +
- +#define PCI_VENDOR_ID_LMC 0x1376
- +#define PCI_DEVICE_ID_LMC_HSSI 0x0003
- +#define PCI_DEVICE_ID_LMC_DS3 0x0004
- +#define PCI_DEVICE_ID_LMC_SSI 0x0005
- +#define PCI_DEVICE_ID_LMC_T1 0x0006
- +
- +#define PCI_VENDOR_ID_NETGEAR 0x1385
- +#define PCI_DEVICE_ID_NETGEAR_MA301 0x4100
- +#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a
- +#define PCI_DEVICE_ID_NETGEAR_GA622 0x622a
- +
- +#define PCI_VENDOR_ID_APPLICOM 0x1389
- +#define PCI_DEVICE_ID_APPLICOM_PCIGENERIC 0x0001
- +#define PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN 0x0002
- +#define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003
- +
- +#define PCI_VENDOR_ID_MOXA 0x1393
- +#define PCI_DEVICE_ID_MOXA_C104 0x1040
- +#define PCI_DEVICE_ID_MOXA_C168 0x1680
- +#define PCI_DEVICE_ID_MOXA_CP204J 0x2040
- +#define PCI_DEVICE_ID_MOXA_C218 0x2180
- +#define PCI_DEVICE_ID_MOXA_C320 0x3200
- +
- +#define PCI_VENDOR_ID_CCD 0x1397
- +#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0
- +#define PCI_DEVICE_ID_CCD_B000 0xb000
- +#define PCI_DEVICE_ID_CCD_B006 0xb006
- +#define PCI_DEVICE_ID_CCD_B007 0xb007
- +#define PCI_DEVICE_ID_CCD_B008 0xb008
- +#define PCI_DEVICE_ID_CCD_B009 0xb009
- +#define PCI_DEVICE_ID_CCD_B00A 0xb00a
- +#define PCI_DEVICE_ID_CCD_B00B 0xb00b
- +#define PCI_DEVICE_ID_CCD_B00C 0xb00c
- +#define PCI_DEVICE_ID_CCD_B100 0xb100
- +
- +#define PCI_VENDOR_ID_MICROGATE 0x13c0
- +#define PCI_DEVICE_ID_MICROGATE_USC 0x0010
- +#define PCI_DEVICE_ID_MICROGATE_SCC 0x0020
- +#define PCI_DEVICE_ID_MICROGATE_SCA 0x0030
- +
- +#define PCI_VENDOR_ID_3WARE 0x13C1
- +#define PCI_DEVICE_ID_3WARE_1000 0x1000
- +
- +#define PCI_VENDOR_ID_ABOCOM 0x13D1
- +#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1
- +
- +#define PCI_VENDOR_ID_CMEDIA 0x13f6
- +#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100
- +#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101
- +#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111
- +#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112
- +
- +#define PCI_VENDOR_ID_LAVA 0x1407
- +#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */
- +#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */
- +#define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */
- +#define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */
- +#define PCI_DEVICE_ID_LAVA_QUAD_A 0x0201 /* 2x 16650, half of 4 port */
- +#define PCI_DEVICE_ID_LAVA_QUAD_B 0x0202 /* 2x 16650, half of 4 port */
- +#define PCI_DEVICE_ID_LAVA_SSERIAL 0x0500 /* 1x 16550 */
- +#define PCI_DEVICE_ID_LAVA_PORT_650 0x0600 /* 1x 16650 */
- +#define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000
- +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */
- +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */
- +#define PCI_DEVICE_ID_LAVA_BOCA_IOPPAR 0x8800
- +
- +#define PCI_VENDOR_ID_TIMEDIA 0x1409
- +#define PCI_DEVICE_ID_TIMEDIA_1889 0x7168
- +
- +#define PCI_VENDOR_ID_OXSEMI 0x1415
- +#define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403
- +#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501
- +#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x950A
- +#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511
- +#define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513
- +
- +#define PCI_VENDOR_ID_AIRONET 0x14b9
- +#define PCI_DEVICE_ID_AIRONET_4800_1 0x0001
- +#define PCI_DEVICE_ID_AIRONET_4800 0x4500 // values switched? see
- +#define PCI_DEVICE_ID_AIRONET_4500 0x4800 // drivers/net/aironet4500_card.c
- +
- +#define PCI_VENDOR_ID_TITAN 0x14D2
- +#define PCI_DEVICE_ID_TITAN_010L 0x8001
- +#define PCI_DEVICE_ID_TITAN_100L 0x8010
- +#define PCI_DEVICE_ID_TITAN_110L 0x8011
- +#define PCI_DEVICE_ID_TITAN_200L 0x8020
- +#define PCI_DEVICE_ID_TITAN_210L 0x8021
- +#define PCI_DEVICE_ID_TITAN_400L 0x8040
- +#define PCI_DEVICE_ID_TITAN_800L 0x8080
- +#define PCI_DEVICE_ID_TITAN_100 0xA001
- +#define PCI_DEVICE_ID_TITAN_200 0xA005
- +#define PCI_DEVICE_ID_TITAN_400 0xA003
- +#define PCI_DEVICE_ID_TITAN_800B 0xA004
- +
- +#define PCI_VENDOR_ID_PANACOM 0x14d4
- +#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400
- +#define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402
- +
- +#define PCI_VENDOR_ID_BROADCOM 0x14e4
- +#define PCI_DEVICE_ID_TIGON3_5700 0x1644
- +#define PCI_DEVICE_ID_TIGON3_5701 0x1645
- +#define PCI_DEVICE_ID_TIGON3_5702 0x1646
- +#define PCI_DEVICE_ID_TIGON3_5703 0x1647
- +#define PCI_DEVICE_ID_TIGON3_5704 0x1648
- +#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d
- +#define PCI_DEVICE_ID_TIGON3_5705 0x1653
- +#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
- +#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
- +#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
- +#define PCI_DEVICE_ID_TIGON3_5782 0x1696
- +#define PCI_DEVICE_ID_TIGON3_5788 0x169c
- +#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6
- +#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7
- +#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8
- +#define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6
- +#define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7
- +#define PCI_DEVICE_ID_TIGON3_5901 0x170d
- +#define PCI_DEVICE_ID_TIGON3_5901_2 0x170e
- +
- +#define PCI_VENDOR_ID_SYBA 0x1592
- +#define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782
- +#define PCI_DEVICE_ID_SYBA_1P_ECP 0x0783
- +
- +#define PCI_VENDOR_ID_MORETON 0x15aa
- +#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000
- +
- +#define PCI_VENDOR_ID_ZOLTRIX 0x15b0
- +#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0
- +
- +#define PCI_VENDOR_ID_PDC 0x15e9
- +#define PCI_DEVICE_ID_PDC_1841 0x1841
- +
- +#define PCI_VENDOR_ID_SYMPHONY 0x1c1c
- +#define PCI_DEVICE_ID_SYMPHONY_101 0x0001
- +
- +#define PCI_VENDOR_ID_TEKRAM 0x1de1
- +#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
- +
- +#define PCI_VENDOR_ID_3DLABS 0x3d3d
- +#define PCI_DEVICE_ID_3DLABS_300SX 0x0001
- +#define PCI_DEVICE_ID_3DLABS_500TX 0x0002
- +#define PCI_DEVICE_ID_3DLABS_DELTA 0x0003
- +#define PCI_DEVICE_ID_3DLABS_PERMEDIA 0x0004
- +#define PCI_DEVICE_ID_3DLABS_MX 0x0006
- +#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007
- +#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008
- +#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009
- +
- +#define PCI_VENDOR_ID_AVANCE 0x4005
- +#define PCI_DEVICE_ID_AVANCE_ALG2064 0x2064
- +#define PCI_DEVICE_ID_AVANCE_2302 0x2302
- +
- +#define PCI_VENDOR_ID_AKS 0x416c
- +#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100
- +#define PCI_DEVICE_ID_AKS_CPC 0x0200
- +
- +#define PCI_VENDOR_ID_NETVIN 0x4a14
- +#define PCI_DEVICE_ID_NETVIN_NV5000SC 0x5000
- +
- +#define PCI_VENDOR_ID_S3 0x5333
- +#define PCI_DEVICE_ID_S3_PLATO_PXS 0x0551
- +#define PCI_DEVICE_ID_S3_ViRGE 0x5631
- +#define PCI_DEVICE_ID_S3_TRIO 0x8811
- +#define PCI_DEVICE_ID_S3_AURORA64VP 0x8812
- +#define PCI_DEVICE_ID_S3_TRIO64UVP 0x8814
- +#define PCI_DEVICE_ID_S3_ViRGE_VX 0x883d
- +#define PCI_DEVICE_ID_S3_868 0x8880
- +#define PCI_DEVICE_ID_S3_928 0x88b0
- +#define PCI_DEVICE_ID_S3_864_1 0x88c0
- +#define PCI_DEVICE_ID_S3_864_2 0x88c1
- +#define PCI_DEVICE_ID_S3_964_1 0x88d0
- +#define PCI_DEVICE_ID_S3_964_2 0x88d1
- +#define PCI_DEVICE_ID_S3_968 0x88f0
- +#define PCI_DEVICE_ID_S3_TRIO64V2 0x8901
- +#define PCI_DEVICE_ID_S3_PLATO_PXG 0x8902
- +#define PCI_DEVICE_ID_S3_ViRGE_DXGX 0x8a01
- +#define PCI_DEVICE_ID_S3_ViRGE_GX2 0x8a10
- +#define PCI_DEVICE_ID_S3_ViRGE_MX 0x8c01
- +#define PCI_DEVICE_ID_S3_ViRGE_MXP 0x8c02
- +#define PCI_DEVICE_ID_S3_ViRGE_MXPMV 0x8c03
- +#define PCI_DEVICE_ID_S3_SONICVIBES 0xca00
- +
- +#define PCI_VENDOR_ID_DCI 0x6666
- +#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001
- +#define PCI_DEVICE_ID_DCI_PCCOM8 0x0002
- +
- +#define PCI_VENDOR_ID_GENROCO 0x5555
- +#define PCI_DEVICE_ID_GENROCO_HFP832 0x0003
- +
- +#define PCI_VENDOR_ID_INTEL 0x8086
- +#define PCI_DEVICE_ID_INTEL_21145 0x0039
- +#define PCI_DEVICE_ID_INTEL_82375 0x0482
- +#define PCI_DEVICE_ID_INTEL_82424 0x0483
- +#define PCI_DEVICE_ID_INTEL_82378 0x0484
- +#define PCI_DEVICE_ID_INTEL_82430 0x0486
- +#define PCI_DEVICE_ID_INTEL_82434 0x04a3
- +#define PCI_DEVICE_ID_INTEL_I960 0x0960
- +#define PCI_DEVICE_ID_INTEL_82542 0x1000
- +#define PCI_DEVICE_ID_INTEL_82543GC_FIBER 0x1001
- +#define PCI_DEVICE_ID_INTEL_82543GC_COPPER 0x1004
- +#define PCI_DEVICE_ID_INTEL_82544EI_COPPER 0x1008
- +#define PCI_DEVICE_ID_INTEL_82544EI_FIBER 0x1009
- +#define PCI_DEVICE_ID_INTEL_82544GC_COPPER 0x100C
- +#define PCI_DEVICE_ID_INTEL_82544GC_LOM 0x100D
- +#define PCI_DEVICE_ID_INTEL_82540EM 0x100E
- +#define PCI_DEVICE_ID_INTEL_82545EM_COPPER 0x100F
- +#define PCI_DEVICE_ID_INTEL_82546EB_COPPER 0x1010
- +#define PCI_DEVICE_ID_INTEL_82545EM_FIBER 0x1011
- +#define PCI_DEVICE_ID_INTEL_82546EB_FIBER 0x1012
- +#define PCI_DEVICE_ID_INTEL_82540EM_LOM 0x1015
- +#define PCI_DEVICE_ID_INTEL_ID1029 0x1029
- +#define PCI_DEVICE_ID_INTEL_ID1030 0x1030
- +#define PCI_DEVICE_ID_INTEL_ID1031 0x1031
- +#define PCI_DEVICE_ID_INTEL_ID1038 0x1038
- +#define PCI_DEVICE_ID_INTEL_ID1039 0x1039
- +#define PCI_DEVICE_ID_INTEL_ID103A 0x103A
- +#define PCI_DEVICE_ID_INTEL_82562ET 0x1031
- +#define PCI_DEVICE_ID_INTEL_82559ER 0x1209
- +#define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221
- +#define PCI_DEVICE_ID_INTEL_82092AA_1 0x1222
- +#define PCI_DEVICE_ID_INTEL_7116 0x1223
- +#define PCI_DEVICE_ID_INTEL_82596 0x1226
- +#define PCI_DEVICE_ID_INTEL_82865 0x1227
- +#define PCI_DEVICE_ID_INTEL_82557 0x1229
- +#define PCI_DEVICE_ID_INTEL_82437 0x122d
- +#define PCI_DEVICE_ID_INTEL_82371FB_0 0x122e
- +#define PCI_DEVICE_ID_INTEL_82371FB_1 0x1230
- +#define PCI_DEVICE_ID_INTEL_82371MX 0x1234
- +#define PCI_DEVICE_ID_INTEL_82437MX 0x1235
- +#define PCI_DEVICE_ID_INTEL_82441 0x1237
- +#define PCI_DEVICE_ID_INTEL_82380FB 0x124b
- +#define PCI_DEVICE_ID_INTEL_82439 0x1250
- +#define PCI_DEVICE_ID_INTEL_80960_RP 0x1960
- +#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410
- +#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411
- +#define PCI_DEVICE_ID_INTEL_82801AA_2 0x2412
- +#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
- +#define PCI_DEVICE_ID_INTEL_82801AA_5 0x2415
- +#define PCI_DEVICE_ID_INTEL_82801AA_6 0x2416
- +#define PCI_DEVICE_ID_INTEL_82801AA_8 0x2418
- +#define PCI_DEVICE_ID_INTEL_82801AB_0 0x2420
- +#define PCI_DEVICE_ID_INTEL_82801AB_1 0x2421
- +#define PCI_DEVICE_ID_INTEL_82801AB_2 0x2422
- +#define PCI_DEVICE_ID_INTEL_82801AB_3 0x2423
- +#define PCI_DEVICE_ID_INTEL_82801AB_5 0x2425
- +#define PCI_DEVICE_ID_INTEL_82801AB_6 0x2426
- +#define PCI_DEVICE_ID_INTEL_82801AB_8 0x2428
- +#define PCI_DEVICE_ID_INTEL_82801BA_0 0x2440
- +#define PCI_DEVICE_ID_INTEL_82801BA_1 0x2442
- +#define PCI_DEVICE_ID_INTEL_82801BA_2 0x2443
- +#define PCI_DEVICE_ID_INTEL_82801BA_3 0x2444
- +#define PCI_DEVICE_ID_INTEL_82801BA_4 0x2445
- +#define PCI_DEVICE_ID_INTEL_82801BA_5 0x2446
- +#define PCI_DEVICE_ID_INTEL_82801BA_6 0x2448
- +#define PCI_DEVICE_ID_INTEL_82801BA_7 0x2449
- +#define PCI_DEVICE_ID_INTEL_82562 0x2449
- +#define PCI_DEVICE_ID_INTEL_82801BA_8 0x244a
- +#define PCI_DEVICE_ID_INTEL_82801BA_9 0x244b
- +#define PCI_DEVICE_ID_INTEL_82801BA_10 0x244c
- +#define PCI_DEVICE_ID_INTEL_82801BA_11 0x244e
- +#define PCI_DEVICE_ID_INTEL_82801CA_0 0x2480
- +#define PCI_DEVICE_ID_INTEL_82801CA_2 0x2482
- +#define PCI_DEVICE_ID_INTEL_82801CA_3 0x2483
- +#define PCI_DEVICE_ID_INTEL_82801CA_4 0x2484
- +#define PCI_DEVICE_ID_INTEL_82801CA_5 0x2485
- +#define PCI_DEVICE_ID_INTEL_82801CA_6 0x2486
- +#define PCI_DEVICE_ID_INTEL_82801CA_7 0x2487
- +#define PCI_DEVICE_ID_INTEL_82801CA_10 0x248a
- +#define PCI_DEVICE_ID_INTEL_82801CA_11 0x248b
- +#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c
- +#define PCI_DEVICE_ID_INTEL_80310 0x530d
- +#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000
- +#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010
- +#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020
- +#define PCI_DEVICE_ID_INTEL_82437VX 0x7030
- +#define PCI_DEVICE_ID_INTEL_82439TX 0x7100
- +#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110
- +#define PCI_DEVICE_ID_INTEL_82371AB 0x7111
- +#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112
- +#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
- +#define PCI_DEVICE_ID_INTEL_82810_MC1 0x7120
- +#define PCI_DEVICE_ID_INTEL_82810_IG1 0x7121
- +#define PCI_DEVICE_ID_INTEL_82810_MC3 0x7122
- +#define PCI_DEVICE_ID_INTEL_82810_IG3 0x7123
- +#define PCI_DEVICE_ID_INTEL_82443LX_0 0x7180
- +#define PCI_DEVICE_ID_INTEL_82443LX_1 0x7181
- +#define PCI_DEVICE_ID_INTEL_82443BX_0 0x7190
- +#define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191
- +#define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192
- +#define PCI_DEVICE_ID_INTEL_82443MX_0 0x7198
- +#define PCI_DEVICE_ID_INTEL_82443MX_1 0x7199
- +#define PCI_DEVICE_ID_INTEL_82443MX_2 0x719a
- +#define PCI_DEVICE_ID_INTEL_82443MX_3 0x719b
- +#define PCI_DEVICE_ID_INTEL_82372FB_0 0x7600
- +#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601
- +#define PCI_DEVICE_ID_INTEL_82372FB_2 0x7602
- +#define PCI_DEVICE_ID_INTEL_82372FB_3 0x7603
- +#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4
- +#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5
- +#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca
- +
- +#define PCI_VENDOR_ID_COMPUTONE 0x8e0e
- +#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291
- +#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302
- +#define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e
- +#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001
- +#define PCI_SUBDEVICE_ID_COMPUTONE_PG8 0x0002
- +#define PCI_SUBDEVICE_ID_COMPUTONE_PG6 0x0003
- +
- +#define PCI_VENDOR_ID_KTI 0x8e2e
- +#define PCI_DEVICE_ID_KTI_ET32P2 0x3000
- +
- +#define PCI_VENDOR_ID_ADAPTEC 0x9004
- +#define PCI_DEVICE_ID_ADAPTEC_7810 0x1078
- +#define PCI_DEVICE_ID_ADAPTEC_7821 0x2178
- +#define PCI_DEVICE_ID_ADAPTEC_38602 0x3860
- +#define PCI_DEVICE_ID_ADAPTEC_7850 0x5078
- +#define PCI_DEVICE_ID_ADAPTEC_7855 0x5578
- +#define PCI_DEVICE_ID_ADAPTEC_5800 0x5800
- +#define PCI_DEVICE_ID_ADAPTEC_3860 0x6038
- +#define PCI_DEVICE_ID_ADAPTEC_1480A 0x6075
- +#define PCI_DEVICE_ID_ADAPTEC_7860 0x6078
- +#define PCI_DEVICE_ID_ADAPTEC_7861 0x6178
- +#define PCI_DEVICE_ID_ADAPTEC_7870 0x7078
- +#define PCI_DEVICE_ID_ADAPTEC_7871 0x7178
- +#define PCI_DEVICE_ID_ADAPTEC_7872 0x7278
- +#define PCI_DEVICE_ID_ADAPTEC_7873 0x7378
- +#define PCI_DEVICE_ID_ADAPTEC_7874 0x7478
- +#define PCI_DEVICE_ID_ADAPTEC_7895 0x7895
- +#define PCI_DEVICE_ID_ADAPTEC_7880 0x8078
- +#define PCI_DEVICE_ID_ADAPTEC_7881 0x8178
- +#define PCI_DEVICE_ID_ADAPTEC_7882 0x8278
- +#define PCI_DEVICE_ID_ADAPTEC_7883 0x8378
- +#define PCI_DEVICE_ID_ADAPTEC_7884 0x8478
- +#define PCI_DEVICE_ID_ADAPTEC_7885 0x8578
- +#define PCI_DEVICE_ID_ADAPTEC_7886 0x8678
- +#define PCI_DEVICE_ID_ADAPTEC_7887 0x8778
- +#define PCI_DEVICE_ID_ADAPTEC_7888 0x8878
- +#define PCI_DEVICE_ID_ADAPTEC_1030 0x8b78
- +
- +#define PCI_VENDOR_ID_ADAPTEC2 0x9005
- +#define PCI_DEVICE_ID_ADAPTEC2_2940U2 0x0010
- +#define PCI_DEVICE_ID_ADAPTEC2_2930U2 0x0011
- +#define PCI_DEVICE_ID_ADAPTEC2_7890B 0x0013
- +#define PCI_DEVICE_ID_ADAPTEC2_7890 0x001f
- +#define PCI_DEVICE_ID_ADAPTEC2_3940U2 0x0050
- +#define PCI_DEVICE_ID_ADAPTEC2_3950U2D 0x0051
- +#define PCI_DEVICE_ID_ADAPTEC2_7896 0x005f
- +#define PCI_DEVICE_ID_ADAPTEC2_7892A 0x0080
- +#define PCI_DEVICE_ID_ADAPTEC2_7892B 0x0081
- +#define PCI_DEVICE_ID_ADAPTEC2_7892D 0x0083
- +#define PCI_DEVICE_ID_ADAPTEC2_7892P 0x008f
- +#define PCI_DEVICE_ID_ADAPTEC2_7899A 0x00c0
- +#define PCI_DEVICE_ID_ADAPTEC2_7899B 0x00c1
- +#define PCI_DEVICE_ID_ADAPTEC2_7899D 0x00c3
- +#define PCI_DEVICE_ID_ADAPTEC2_7899P 0x00cf
- +
- +#define PCI_VENDOR_ID_ATRONICS 0x907f
- +#define PCI_DEVICE_ID_ATRONICS_2015 0x2015
- +
- +#define PCI_VENDOR_ID_HOLTEK2 0x9412
- +#define PCI_DEVICE_ID_HOLTEK2_6565 0x6565
- +
- +#define PCI_VENDOR_ID_NETMOS 0x9710
- +#define PCI_DEVICE_ID_NETMOS_9735 0x9735
- +#define PCI_DEVICE_ID_NETMOS_9835 0x9835
- +
- +#define PCI_SUBVENDOR_ID_EXSYS 0xd84d
- +#define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014
- +
- +#define PCI_VENDOR_ID_TIGERJET 0xe159
- +#define PCI_DEVICE_ID_TIGERJET_300 0x0001
- +#define PCI_DEVICE_ID_TIGERJET_100 0x0002
- +
- +#define PCI_VENDOR_ID_ARK 0xedd8
- +#define PCI_DEVICE_ID_ARK_STING 0xa091
- +#define PCI_DEVICE_ID_ARK_STINGARK 0xa099
- +#define PCI_DEVICE_ID_ARK_2000MT 0xa0a1
- +
- diff -Naur grub-0.97.orig/netboot/pci_io.c grub-0.97/netboot/pci_io.c
- --- grub-0.97.orig/netboot/pci_io.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/pci_io.c 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,431 @@
- +/*
- +** Support for NE2000 PCI clones added David Monro June 1997
- +** Generalised to other NICs by Ken Yap July 1997
- +**
- +** Most of this is taken from:
- +**
- +** /usr/src/linux/drivers/pci/pci.c
- +** /usr/src/linux/include/linux/pci.h
- +** /usr/src/linux/arch/i386/bios32.c
- +** /usr/src/linux/include/linux/bios32.h
- +** /usr/src/linux/drivers/net/ne.c
- +*/
- +#define PCBIOS
- +#include "grub.h"
- +#include "pci.h"
- +
- +#ifdef CONFIG_PCI_DIRECT
- +#define PCIBIOS_SUCCESSFUL 0x00
- +
- +#define DEBUG 0
- +
- +/*
- + * Functions for accessing PCI configuration space with type 1 accesses
- + */
- +
- +#define CONFIG_CMD(bus, device_fn, where) (0x80000000 | (bus << 16) | (device_fn << 8) | (where & ~3))
- +
- +int pcibios_read_config_byte(unsigned int bus, unsigned int device_fn,
- + unsigned int where, uint8_t *value)
- +{
- + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- + *value = inb(0xCFC + (where&3));
- + return PCIBIOS_SUCCESSFUL;
- +}
- +
- +int pcibios_read_config_word (unsigned int bus,
- + unsigned int device_fn, unsigned int where, uint16_t *value)
- +{
- + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- + *value = inw(0xCFC + (where&2));
- + return PCIBIOS_SUCCESSFUL;
- +}
- +
- +int pcibios_read_config_dword (unsigned int bus, unsigned int device_fn,
- + unsigned int where, uint32_t *value)
- +{
- + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- + *value = inl(0xCFC);
- + return PCIBIOS_SUCCESSFUL;
- +}
- +
- +int pcibios_write_config_byte (unsigned int bus, unsigned int device_fn,
- + unsigned int where, uint8_t value)
- +{
- + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- + outb(value, 0xCFC + (where&3));
- + return PCIBIOS_SUCCESSFUL;
- +}
- +
- +int pcibios_write_config_word (unsigned int bus, unsigned int device_fn,
- + unsigned int where, uint16_t value)
- +{
- + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- + outw(value, 0xCFC + (where&2));
- + return PCIBIOS_SUCCESSFUL;
- +}
- +
- +int pcibios_write_config_dword (unsigned int bus, unsigned int device_fn, unsigned int where, uint32_t value)
- +{
- + outl(CONFIG_CMD(bus,device_fn,where), 0xCF8);
- + outl(value, 0xCFC);
- + return PCIBIOS_SUCCESSFUL;
- +}
- +
- +#undef CONFIG_CMD
- +
- +#else /* CONFIG_PCI_DIRECT not defined */
- +
- +#if !defined(PCBIOS)
- +#error "The pcibios can only be used when the PCBIOS support is compiled in"
- +#endif
- +
- +
- +#define KERN_CODE_SEG 0X8
- +/* Stuff for asm */
- +#define save_flags(x) \
- +__asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */ :"memory")
- +
- +#define cli() __asm__ __volatile__ ("cli": : :"memory")
- +
- +#define restore_flags(x) \
- +__asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory")
- +
- +
- +
- +static struct {
- + unsigned long address;
- + unsigned short segment;
- +} bios32_indirect = { 0, KERN_CODE_SEG };
- +
- +static long pcibios_entry = 0;
- +static struct {
- + unsigned long address;
- + unsigned short segment;
- +} pci_indirect = { 0, KERN_CODE_SEG };
- +
- +static unsigned long bios32_service(unsigned long service)
- +{
- + unsigned char return_code; /* %al */
- + unsigned long address; /* %ebx */
- + unsigned long length; /* %ecx */
- + unsigned long entry; /* %edx */
- + unsigned long flags;
- +
- + save_flags(flags);
- + __asm__(
- +#ifdef ABSOLUTE_WITHOUT_ASTERISK
- + "lcall (%%edi)"
- +#else
- + "lcall *(%%edi)"
- +#endif
- + : "=a" (return_code),
- + "=b" (address),
- + "=c" (length),
- + "=d" (entry)
- + : "0" (service),
- + "1" (0),
- + "D" (&bios32_indirect));
- + restore_flags(flags);
- +
- + switch (return_code) {
- + case 0:
- + return address + entry;
- + case 0x80: /* Not present */
- + printf("bios32_service(%d) : not present\n", service);
- + return 0;
- + default: /* Shouldn't happen */
- + printf("bios32_service(%d) : returned %#X, mail drew@colorado.edu\n",
- + service, return_code);
- + return 0;
- + }
- +}
- +
- +int pcibios_read_config_byte(unsigned int bus,
- + unsigned int device_fn, unsigned int where, uint8_t *value)
- +{
- + unsigned long ret;
- + unsigned long bx = (bus << 8) | device_fn;
- + unsigned long flags;
- +
- + save_flags(flags);
- + __asm__(
- +#ifdef ABSOLUTE_WITHOUT_ASTERISK
- + "lcall (%%esi)\n\t"
- +#else
- + "lcall *(%%esi)\n\t"
- +#endif
- + "jc 1f\n\t"
- + "xor %%ah, %%ah\n"
- + "1:"
- + : "=c" (*value),
- + "=a" (ret)
- + : "1" (PCIBIOS_READ_CONFIG_BYTE),
- + "b" (bx),
- + "D" ((long) where),
- + "S" (&pci_indirect));
- + restore_flags(flags);
- + return (int) (ret & 0xff00) >> 8;
- +}
- +
- +int pcibios_read_config_word(unsigned int bus,
- + unsigned int device_fn, unsigned int where, uint16_t *value)
- +{
- + unsigned long ret;
- + unsigned long bx = (bus << 8) | device_fn;
- + unsigned long flags;
- +
- + save_flags(flags);
- + __asm__(
- +#ifdef ABSOLUTE_WITHOUT_ASTERISK
- + "lcall (%%esi)\n\t"
- +#else
- + "lcall *(%%esi)\n\t"
- +#endif
- + "jc 1f\n\t"
- + "xor %%ah, %%ah\n"
- + "1:"
- + : "=c" (*value),
- + "=a" (ret)
- + : "1" (PCIBIOS_READ_CONFIG_WORD),
- + "b" (bx),
- + "D" ((long) where),
- + "S" (&pci_indirect));
- + restore_flags(flags);
- + return (int) (ret & 0xff00) >> 8;
- +}
- +
- +int pcibios_read_config_dword(unsigned int bus,
- + unsigned int device_fn, unsigned int where, uint32_t *value)
- +{
- + unsigned long ret;
- + unsigned long bx = (bus << 8) | device_fn;
- + unsigned long flags;
- +
- + save_flags(flags);
- + __asm__(
- +#ifdef ABSOLUTE_WITHOUT_ASTERISK
- + "lcall (%%esi)\n\t"
- +#else
- + "lcall *(%%esi)\n\t"
- +#endif
- + "jc 1f\n\t"
- + "xor %%ah, %%ah\n"
- + "1:"
- + : "=c" (*value),
- + "=a" (ret)
- + : "1" (PCIBIOS_READ_CONFIG_DWORD),
- + "b" (bx),
- + "D" ((long) where),
- + "S" (&pci_indirect));
- + restore_flags(flags);
- + return (int) (ret & 0xff00) >> 8;
- +}
- +
- +int pcibios_write_config_byte (unsigned int bus,
- + unsigned int device_fn, unsigned int where, uint8_t value)
- +{
- + unsigned long ret;
- + unsigned long bx = (bus << 8) | device_fn;
- + unsigned long flags;
- +
- + save_flags(flags); cli();
- + __asm__(
- +#ifdef ABSOLUTE_WITHOUT_ASTERISK
- + "lcall (%%esi)\n\t"
- +#else
- + "lcall *(%%esi)\n\t"
- +#endif
- + "jc 1f\n\t"
- + "xor %%ah, %%ah\n"
- + "1:"
- + : "=a" (ret)
- + : "0" (PCIBIOS_WRITE_CONFIG_BYTE),
- + "c" (value),
- + "b" (bx),
- + "D" ((long) where),
- + "S" (&pci_indirect));
- + restore_flags(flags);
- + return (int) (ret & 0xff00) >> 8;
- +}
- +
- +int pcibios_write_config_word (unsigned int bus,
- + unsigned int device_fn, unsigned int where, uint16_t value)
- +{
- + unsigned long ret;
- + unsigned long bx = (bus << 8) | device_fn;
- + unsigned long flags;
- +
- + save_flags(flags); cli();
- + __asm__(
- +#ifdef ABSOLUTE_WITHOUT_ASTERISK
- + "lcall (%%esi)\n\t"
- +#else
- + "lcall *(%%esi)\n\t"
- +#endif
- + "jc 1f\n\t"
- + "xor %%ah, %%ah\n"
- + "1:"
- + : "=a" (ret)
- + : "0" (PCIBIOS_WRITE_CONFIG_WORD),
- + "c" (value),
- + "b" (bx),
- + "D" ((long) where),
- + "S" (&pci_indirect));
- + restore_flags(flags);
- + return (int) (ret & 0xff00) >> 8;
- +}
- +
- +int pcibios_write_config_dword (unsigned int bus,
- + unsigned int device_fn, unsigned int where, uint32_t value)
- +{
- + unsigned long ret;
- + unsigned long bx = (bus << 8) | device_fn;
- + unsigned long flags;
- +
- + save_flags(flags); cli();
- + __asm__(
- +#ifdef ABSOLUTE_WITHOUT_ASTERISK
- + "lcall (%%esi)\n\t"
- +#else
- + "lcall *(%%esi)\n\t"
- +#endif
- + "jc 1f\n\t"
- + "xor %%ah, %%ah\n"
- + "1:"
- + : "=a" (ret)
- + : "0" (PCIBIOS_WRITE_CONFIG_DWORD),
- + "c" (value),
- + "b" (bx),
- + "D" ((long) where),
- + "S" (&pci_indirect));
- + restore_flags(flags);
- + return (int) (ret & 0xff00) >> 8;
- +}
- +
- +static void check_pcibios(void)
- +{
- + unsigned long signature;
- + unsigned char present_status;
- + unsigned char major_revision;
- + unsigned char minor_revision;
- + unsigned long flags;
- + int pack;
- +
- + if ((pcibios_entry = bios32_service(PCI_SERVICE))) {
- + pci_indirect.address = pcibios_entry;
- +
- + save_flags(flags);
- + __asm__(
- +#ifdef ABSOLUTE_WITHOUT_ASTERISK
- + "lcall (%%edi)\n\t"
- +#else
- + "lcall *(%%edi)\n\t"
- +#endif
- + "jc 1f\n\t"
- + "xor %%ah, %%ah\n"
- + "1:\tshl $8, %%eax\n\t"
- + "movw %%bx, %%ax"
- + : "=d" (signature),
- + "=a" (pack)
- + : "1" (PCIBIOS_PCI_BIOS_PRESENT),
- + "D" (&pci_indirect)
- + : "bx", "cx");
- + restore_flags(flags);
- +
- + present_status = (pack >> 16) & 0xff;
- + major_revision = (pack >> 8) & 0xff;
- + minor_revision = pack & 0xff;
- + if (present_status || (signature != PCI_SIGNATURE)) {
- + printf("ERROR: BIOS32 says PCI BIOS, but no PCI "
- + "BIOS????\n");
- + pcibios_entry = 0;
- + }
- +#if DEBUG
- + if (pcibios_entry) {
- + printf ("pcibios_init : PCI BIOS revision %hhX.%hhX"
- + " entry at %#X\n", major_revision,
- + minor_revision, pcibios_entry);
- + }
- +#endif
- + }
- +}
- +
- +static void pcibios_init(void)
- +{
- + union bios32 *check;
- + unsigned char sum;
- + int i, length;
- + unsigned long bios32_entry = 0;
- +
- + EnterFunction("pcibios_init");
- + /*
- + * Follow the standard procedure for locating the BIOS32 Service
- + * directory by scanning the permissible address range from
- + * 0xe0000 through 0xfffff for a valid BIOS32 structure.
- + *
- + */
- +
- + for (check = (union bios32 *) 0xe0000; check <= (union bios32 *) 0xffff0; ++check) {
- + if (check->fields.signature != BIOS32_SIGNATURE)
- + continue;
- + length = check->fields.length * 16;
- + if (!length)
- + continue;
- + sum = 0;
- + for (i = 0; i < length ; ++i)
- + sum += check->chars[i];
- + if (sum != 0)
- + continue;
- + if (check->fields.revision != 0) {
- + printf("pcibios_init : unsupported revision %d at %#X, mail drew@colorado.edu\n",
- + check->fields.revision, check);
- + continue;
- + }
- +#if DEBUG
- + printf("pcibios_init : BIOS32 Service Directory "
- + "structure at %#X\n", check);
- +#endif
- + if (!bios32_entry) {
- + if (check->fields.entry >= 0x100000) {
- + printf("pcibios_init: entry in high "
- + "memory, giving up\n");
- + return;
- + } else {
- + bios32_entry = check->fields.entry;
- +#if DEBUG
- + printf("pcibios_init : BIOS32 Service Directory"
- + " entry at %#X\n", bios32_entry);
- +#endif
- + bios32_indirect.address = bios32_entry;
- + }
- + }
- + }
- + if (bios32_entry)
- + check_pcibios();
- + LeaveFunction("pcibios_init");
- +}
- +
- +#endif /* CONFIG_PCI_DIRECT not defined*/
- +
- +unsigned long pcibios_bus_base(unsigned int bus __unused)
- +{
- + /* architecturally this must be 0 */
- + return 0;
- +}
- +
- +void find_pci(int type, struct pci_device *dev)
- +{
- + EnterFunction("find_pci");
- +#ifndef CONFIG_PCI_DIRECT
- + if (!pcibios_entry) {
- + pcibios_init();
- + }
- + if (!pcibios_entry) {
- + printf("pci_init: no BIOS32 detected\n");
- + return;
- + }
- +#endif
- + LeaveFunction("find_pci");
- + return scan_pci_bus(type, dev);
- +}
- diff -Naur grub-0.97.orig/netboot/pcnet32.c grub-0.97/netboot/pcnet32.c
- --- grub-0.97.orig/netboot/pcnet32.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/pcnet32.c 2005-08-31 22:57:50.000000000 +0000
- @@ -0,0 +1,1004 @@
- +/**************************************************************************
- +*
- +* pcnet32.c -- Etherboot device driver for the AMD PCnet32
- +* Written 2003-2003 by Timothy Legge <tlegge@rogers.com>
- +*
- +* This program is free software; you can redistribute it and/or modify
- +* it under the terms of the GNU General Public License as published by
- +* the Free Software Foundation; either version 2 of the License, or
- +* (at your option) any later version.
- +*
- +* This program is distributed in the hope that it will be useful,
- +* but WITHOUT ANY WARRANTY; without even the implied warranty of
- +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +* GNU General Public License for more details.
- +*
- +* You should have received a copy of the GNU General Public License
- +* along with this program; if not, write to the Free Software
- +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- +*
- +* Portions of this code based on:
- +* pcnet32.c: An AMD PCnet32 ethernet driver for linux:
- +*
- +* (C) 1996-1999 Thomas Bogendoerfer
- +* See Linux Driver for full information
- +*
- +* The transmit and poll functions were written with reference to:
- +* lance.c - LANCE NIC driver for Etherboot written by Ken Yap
- +*
- +* Linux Driver Version 1.27a, 10.02.2002
- +*
- +*
- +* REVISION HISTORY:
- +* ================
- +* v1.0 08-06-2003 timlegge Initial port of Linux driver
- +* v1.1 08-23-2003 timlegge Add multicast support
- +* v1.2 01-17-2004 timlegge Initial driver output cleanup
- +* v1.3 03-29-2004 timlegge More driver cleanup
- +*
- +* Indent Options: indent -kr -i8
- +***************************************************************************/
- +
- +/* to get some global routines like printf */
- +#include "etherboot.h"
- +/* to get the interface to the body of the program */
- +#include "nic.h"
- +/* to get the PCI support functions, if this is a PCI NIC */
- +#include "pci.h"
- +/* Include the time functions */
- +#include "timer.h"
- +#include "mii.h"
- +/* void hex_dump(const char *data, const unsigned int len); */
- +
- +/* Etherboot Specific definations */
- +#define drv_version "v1.3"
- +#define drv_date "03-29-2004"
- +
- +typedef unsigned char u8;
- +typedef signed char s8;
- +typedef unsigned short u16;
- +typedef signed short s16;
- +typedef unsigned int u32;
- +typedef signed int s32;
- +
- +static u32 ioaddr; /* Globally used for the card's io address */
- +
- +#ifdef EDEBUG
- +#define dprintf(x) printf x
- +#else
- +#define dprintf(x)
- +#endif
- +
- +/* Condensed operations for readability. */
- +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
- +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
- +
- +/* End Etherboot Specific */
- +
- +int cards_found /* __initdata */ ;
- +
- +#ifdef REMOVE
- +/* FIXME: Remove these they are probably pointless */
- +
- +/*
- + * VLB I/O addresses
- + */
- +static unsigned int pcnet32_portlist[] /*__initdata */ =
- +{ 0x300, 0x320, 0x340, 0x360, 0 };
- +
- +static int pcnet32_debug = 1;
- +static int tx_start = 1; /* Mapping -- 0:20, 1:64, 2:128, 3:~220 (depends on chip vers) */
- +static int pcnet32vlb; /* check for VLB cards ? */
- +
- +static struct net_device *pcnet32_dev;
- +
- +static int max_interrupt_work = 80;
- +static int rx_copybreak = 200;
- +#endif
- +#define PCNET32_PORT_AUI 0x00
- +#define PCNET32_PORT_10BT 0x01
- +#define PCNET32_PORT_GPSI 0x02
- +#define PCNET32_PORT_MII 0x03
- +
- +#define PCNET32_PORT_PORTSEL 0x03
- +#define PCNET32_PORT_ASEL 0x04
- +#define PCNET32_PORT_100 0x40
- +#define PCNET32_PORT_FD 0x80
- +
- +#define PCNET32_DMA_MASK 0xffffffff
- +
- +/*
- + * table to translate option values from tulip
- + * to internal options
- + */
- +static unsigned char options_mapping[] = {
- + PCNET32_PORT_ASEL, /* 0 Auto-select */
- + PCNET32_PORT_AUI, /* 1 BNC/AUI */
- + PCNET32_PORT_AUI, /* 2 AUI/BNC */
- + PCNET32_PORT_ASEL, /* 3 not supported */
- + PCNET32_PORT_10BT | PCNET32_PORT_FD, /* 4 10baseT-FD */
- + PCNET32_PORT_ASEL, /* 5 not supported */
- + PCNET32_PORT_ASEL, /* 6 not supported */
- + PCNET32_PORT_ASEL, /* 7 not supported */
- + PCNET32_PORT_ASEL, /* 8 not supported */
- + PCNET32_PORT_MII, /* 9 MII 10baseT */
- + PCNET32_PORT_MII | PCNET32_PORT_FD, /* 10 MII 10baseT-FD */
- + PCNET32_PORT_MII, /* 11 MII (autosel) */
- + PCNET32_PORT_10BT, /* 12 10BaseT */
- + PCNET32_PORT_MII | PCNET32_PORT_100, /* 13 MII 100BaseTx */
- + PCNET32_PORT_MII | PCNET32_PORT_100 | PCNET32_PORT_FD, /* 14 MII 100BaseTx-FD */
- + PCNET32_PORT_ASEL /* 15 not supported */
- +};
- +
- +#define MAX_UNITS 8 /* More are supported, limit only on options */
- +static int options[MAX_UNITS];
- +static int full_duplex[MAX_UNITS];
- +
- +/*
- + * Theory of Operation
- + *
- + * This driver uses the same software structure as the normal lance
- + * driver. So look for a verbose description in lance.c. The differences
- + * to the normal lance driver is the use of the 32bit mode of PCnet32
- + * and PCnetPCI chips. Because these chips are 32bit chips, there is no
- + * 16MB limitation and we don't need bounce buffers.
- + */
- +
- +
- +
- +/*
- + * Set the number of Tx and Rx buffers, using Log_2(# buffers).
- + * Reasonable default values are 4 Tx buffers, and 16 Rx buffers.
- + * That translates to 2 (4 == 2^^2) and 4 (16 == 2^^4).
- + */
- +#ifndef PCNET32_LOG_TX_BUFFERS
- +#define PCNET32_LOG_TX_BUFFERS 1
- +#define PCNET32_LOG_RX_BUFFERS 2
- +#endif
- +
- +#define TX_RING_SIZE (1 << (PCNET32_LOG_TX_BUFFERS))
- +#define TX_RING_MOD_MASK (TX_RING_SIZE - 1)
- +/* FIXME: Fix this to allow multiple tx_ring descriptors */
- +#define TX_RING_LEN_BITS 0x0000 /*PCNET32_LOG_TX_BUFFERS) << 12) */
- +
- +#define RX_RING_SIZE (1 << (PCNET32_LOG_RX_BUFFERS))
- +#define RX_RING_MOD_MASK (RX_RING_SIZE - 1)
- +#define RX_RING_LEN_BITS ((PCNET32_LOG_RX_BUFFERS) << 4)
- +
- +#define PKT_BUF_SZ 1544
- +
- +/* Offsets from base I/O address. */
- +#define PCNET32_WIO_RDP 0x10
- +#define PCNET32_WIO_RAP 0x12
- +#define PCNET32_WIO_RESET 0x14
- +#define PCNET32_WIO_BDP 0x16
- +
- +#define PCNET32_DWIO_RDP 0x10
- +#define PCNET32_DWIO_RAP 0x14
- +#define PCNET32_DWIO_RESET 0x18
- +#define PCNET32_DWIO_BDP 0x1C
- +
- +#define PCNET32_TOTAL_SIZE 0x20
- +
- +/* Buffers for the tx and Rx */
- +
- +/* Create a static buffer of size PKT_BUF_SZ for each
- +TX Descriptor. All descriptors point to a
- +part of this buffer */
- +static unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE];
- +// __attribute__ ((aligned(16)));
- +
- +/* Create a static buffer of size PKT_BUF_SZ for each
- +RX Descriptor All descriptors point to a
- +part of this buffer */
- +static unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ];
- +// __attribute__ ((aligned(16)));
- +
- +/* The PCNET32 Rx and Tx ring descriptors. */
- +struct pcnet32_rx_head {
- + u32 base;
- + s16 buf_length;
- + s16 status;
- + u32 msg_length;
- + u32 reserved;
- +};
- +
- +struct pcnet32_tx_head {
- + u32 base;
- + s16 length;
- + s16 status;
- + u32 misc;
- + u32 reserved;
- +};
- +
- +/* The PCNET32 32-Bit initialization block, described in databook. */
- +struct pcnet32_init_block {
- + u16 mode;
- + u16 tlen_rlen;
- + u8 phys_addr[6];
- + u16 reserved;
- + u32 filter[2];
- + /* Receive and transmit ring base, along with extra bits. */
- + u32 rx_ring;
- + u32 tx_ring;
- +};
- +/* PCnet32 access functions */
- +struct pcnet32_access {
- + u16(*read_csr) (unsigned long, int);
- + void (*write_csr) (unsigned long, int, u16);
- + u16(*read_bcr) (unsigned long, int);
- + void (*write_bcr) (unsigned long, int, u16);
- + u16(*read_rap) (unsigned long);
- + void (*write_rap) (unsigned long, u16);
- + void (*reset) (unsigned long);
- +};
- +
- +/* Define the TX Descriptor */
- +static struct pcnet32_tx_head tx_ring[TX_RING_SIZE]
- + __attribute__ ((aligned(16)));
- +
- +
- +/* Define the RX Descriptor */
- +static struct pcnet32_rx_head rx_ring[RX_RING_SIZE]
- + __attribute__ ((aligned(16)));
- +
- +/* May need to be moved to mii.h */
- +struct mii_if_info {
- + int phy_id;
- + int advertising;
- + unsigned int full_duplex:1; /* is full duplex? */
- +};
- +
- +/*
- + * The first three fields of pcnet32_private are read by the ethernet device
- + * so we allocate the structure should be allocated by pci_alloc_consistent().
- + */
- +#define MII_CNT 4
- +struct pcnet32_private {
- + struct pcnet32_init_block init_block;
- + struct pci_dev *pci_dev; /* Pointer to the associated pci device structure */
- + const char *name;
- + /* The saved address of a sent-in-place packet/buffer, for skfree(). */
- + struct sk_buff *tx_skbuff[TX_RING_SIZE];
- + struct sk_buff *rx_skbuff[RX_RING_SIZE];
- + struct pcnet32_access a;
- + unsigned int cur_rx, cur_tx; /* The next free ring entry */
- + char tx_full;
- + int options;
- + int shared_irq:1, /* shared irq possible */
- + ltint:1, /* enable TxDone-intr inhibitor */
- + dxsuflo:1, /* disable transmit stop on uflo */
- + mii:1; /* mii port available */
- + struct mii_if_info mii_if;
- + unsigned char phys[MII_CNT];
- + struct net_device *next;
- + int full_duplex:1;
- +} lpx;
- +
- +static struct pcnet32_private *lp;
- +
- +static int mdio_read(struct nic *nic __unused, int phy_id, int reg_num);
- +#if 0
- +static void mdio_write(struct nic *nic __unused, int phy_id, int reg_num,
- + int val);
- +#endif
- +enum pci_flags_bit {
- + PCI_USES_IO = 1, PCI_USES_MEM = 2, PCI_USES_MASTER = 4,
- + PCI_ADDR0 = 0x10 << 0, PCI_ADDR1 = 0x10 << 1, PCI_ADDR2 =
- + 0x10 << 2, PCI_ADDR3 = 0x10 << 3,
- +};
- +
- +
- +static u16 pcnet32_wio_read_csr(unsigned long addr, int index)
- +{
- + outw(index, addr + PCNET32_WIO_RAP);
- + return inw(addr + PCNET32_WIO_RDP);
- +}
- +
- +static void pcnet32_wio_write_csr(unsigned long addr, int index, u16 val)
- +{
- + outw(index, addr + PCNET32_WIO_RAP);
- + outw(val, addr + PCNET32_WIO_RDP);
- +}
- +
- +static u16 pcnet32_wio_read_bcr(unsigned long addr, int index)
- +{
- + outw(index, addr + PCNET32_WIO_RAP);
- + return inw(addr + PCNET32_WIO_BDP);
- +}
- +
- +static void pcnet32_wio_write_bcr(unsigned long addr, int index, u16 val)
- +{
- + outw(index, addr + PCNET32_WIO_RAP);
- + outw(val, addr + PCNET32_WIO_BDP);
- +}
- +
- +static u16 pcnet32_wio_read_rap(unsigned long addr)
- +{
- + return inw(addr + PCNET32_WIO_RAP);
- +}
- +
- +static void pcnet32_wio_write_rap(unsigned long addr, u16 val)
- +{
- + outw(val, addr + PCNET32_WIO_RAP);
- +}
- +
- +static void pcnet32_wio_reset(unsigned long addr)
- +{
- + inw(addr + PCNET32_WIO_RESET);
- +}
- +
- +static int pcnet32_wio_check(unsigned long addr)
- +{
- + outw(88, addr + PCNET32_WIO_RAP);
- + return (inw(addr + PCNET32_WIO_RAP) == 88);
- +}
- +
- +static struct pcnet32_access pcnet32_wio = {
- + read_csr:pcnet32_wio_read_csr,
- + write_csr:pcnet32_wio_write_csr,
- + read_bcr:pcnet32_wio_read_bcr,
- + write_bcr:pcnet32_wio_write_bcr,
- + read_rap:pcnet32_wio_read_rap,
- + write_rap:pcnet32_wio_write_rap,
- + reset:pcnet32_wio_reset
- +};
- +
- +static u16 pcnet32_dwio_read_csr(unsigned long addr, int index)
- +{
- + outl(index, addr + PCNET32_DWIO_RAP);
- + return (inl(addr + PCNET32_DWIO_RDP) & 0xffff);
- +}
- +
- +static void pcnet32_dwio_write_csr(unsigned long addr, int index, u16 val)
- +{
- + outl(index, addr + PCNET32_DWIO_RAP);
- + outl(val, addr + PCNET32_DWIO_RDP);
- +}
- +
- +static u16 pcnet32_dwio_read_bcr(unsigned long addr, int index)
- +{
- + outl(index, addr + PCNET32_DWIO_RAP);
- + return (inl(addr + PCNET32_DWIO_BDP) & 0xffff);
- +}
- +
- +static void pcnet32_dwio_write_bcr(unsigned long addr, int index, u16 val)
- +{
- + outl(index, addr + PCNET32_DWIO_RAP);
- + outl(val, addr + PCNET32_DWIO_BDP);
- +}
- +
- +static u16 pcnet32_dwio_read_rap(unsigned long addr)
- +{
- + return (inl(addr + PCNET32_DWIO_RAP) & 0xffff);
- +}
- +
- +static void pcnet32_dwio_write_rap(unsigned long addr, u16 val)
- +{
- + outl(val, addr + PCNET32_DWIO_RAP);
- +}
- +
- +static void pcnet32_dwio_reset(unsigned long addr)
- +{
- + inl(addr + PCNET32_DWIO_RESET);
- +}
- +
- +static int pcnet32_dwio_check(unsigned long addr)
- +{
- + outl(88, addr + PCNET32_DWIO_RAP);
- + return ((inl(addr + PCNET32_DWIO_RAP) & 0xffff) == 88);
- +}
- +
- +static struct pcnet32_access pcnet32_dwio = {
- + read_csr:pcnet32_dwio_read_csr,
- + write_csr:pcnet32_dwio_write_csr,
- + read_bcr:pcnet32_dwio_read_bcr,
- + write_bcr:pcnet32_dwio_write_bcr,
- + read_rap:pcnet32_dwio_read_rap,
- + write_rap:pcnet32_dwio_write_rap,
- + reset:pcnet32_dwio_reset
- +};
- +
- +
- +/* Initialize the PCNET32 Rx and Tx rings. */
- +static int pcnet32_init_ring(struct nic *nic)
- +{
- + int i;
- +
- + lp->tx_full = 0;
- + lp->cur_rx = lp->cur_tx = 0;
- +
- + for (i = 0; i < RX_RING_SIZE; i++) {
- + rx_ring[i].base = (u32) virt_to_le32desc(&rxb[i]);
- + rx_ring[i].buf_length = le16_to_cpu(-PKT_BUF_SZ);
- + rx_ring[i].status = le16_to_cpu(0x8000);
- + }
- +
- + /* The Tx buffer address is filled in as needed, but we do need to clear
- + the upper ownership bit. */
- + for (i = 0; i < TX_RING_SIZE; i++) {
- + tx_ring[i].base = 0;
- + tx_ring[i].status = 0;
- + }
- +
- +
- + lp->init_block.tlen_rlen =
- + le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS);
- + for (i = 0; i < 6; i++)
- + lp->init_block.phys_addr[i] = nic->node_addr[i];
- + lp->init_block.rx_ring = (u32) virt_to_le32desc(&rx_ring[0]);
- + lp->init_block.tx_ring = (u32) virt_to_le32desc(&tx_ring[0]);
- + return 0;
- +}
- +
- +/**************************************************************************
- +RESET - Reset adapter
- +***************************************************************************/
- +static void pcnet32_reset(struct nic *nic)
- +{
- + /* put the card in its initial state */
- + u16 val;
- + int i;
- +
- + /* Reset the PCNET32 */
- + lp->a.reset(ioaddr);
- +
- + /* switch pcnet32 to 32bit mode */
- + lp->a.write_bcr(ioaddr, 20, 2);
- +
- + /* set/reset autoselect bit */
- + val = lp->a.read_bcr(ioaddr, 2) & ~2;
- + if (lp->options & PCNET32_PORT_ASEL)
- + val |= 2;
- + lp->a.write_bcr(ioaddr, 2, val);
- + /* handle full duplex setting */
- + if (lp->full_duplex) {
- + val = lp->a.read_bcr(ioaddr, 9) & ~3;
- + if (lp->options & PCNET32_PORT_FD) {
- + val |= 1;
- + if (lp->options ==
- + (PCNET32_PORT_FD | PCNET32_PORT_AUI))
- + val |= 2;
- + } else if (lp->options & PCNET32_PORT_ASEL) {
- + /* workaround of xSeries250, turn on for 79C975 only */
- + i = ((lp->a.
- + read_csr(ioaddr,
- + 88) | (lp->a.read_csr(ioaddr,
- + 89) << 16)) >>
- + 12) & 0xffff;
- + if (i == 0x2627)
- + val |= 3;
- + }
- + lp->a.write_bcr(ioaddr, 9, val);
- + }
- +
- + /* set/reset GPSI bit in test register */
- + val = lp->a.read_csr(ioaddr, 124) & ~0x10;
- + if ((lp->options & PCNET32_PORT_PORTSEL) == PCNET32_PORT_GPSI)
- + val |= 0x10;
- + lp->a.write_csr(ioaddr, 124, val);
- +
- + if (lp->mii && !(lp->options & PCNET32_PORT_ASEL)) {
- + val = lp->a.read_bcr(ioaddr, 32) & ~0x38; /* disable Auto Negotiation, set 10Mpbs, HD */
- + if (lp->options & PCNET32_PORT_FD)
- + val |= 0x10;
- + if (lp->options & PCNET32_PORT_100)
- + val |= 0x08;
- + lp->a.write_bcr(ioaddr, 32, val);
- + } else {
- + if (lp->options & PCNET32_PORT_ASEL) { /* enable auto negotiate, setup, disable fd */
- + val = lp->a.read_bcr(ioaddr, 32) & ~0x98;
- + val |= 0x20;
- + lp->a.write_bcr(ioaddr, 32, val);
- + }
- + }
- +
- +#ifdef DO_DXSUFLO
- + if (lp->dxsuflo) { /* Disable transmit stop on underflow */
- + val = lp->a.read_csr(ioaddr, 3);
- + val |= 0x40;
- + lp->a.write_csr(ioaddr, 3, val);
- + }
- +#endif
- +
- + if (lp->ltint) { /* Enable TxDone-intr inhibitor */
- + val = lp->a.read_csr(ioaddr, 5);
- + val |= (1 << 14);
- + lp->a.write_csr(ioaddr, 5, val);
- + }
- + lp->init_block.mode =
- + le16_to_cpu((lp->options & PCNET32_PORT_PORTSEL) << 7);
- + lp->init_block.filter[0] = 0xffffffff;
- + lp->init_block.filter[1] = 0xffffffff;
- +
- + pcnet32_init_ring(nic);
- +
- +
- + /* Re-initialize the PCNET32, and start it when done. */
- + lp->a.write_csr(ioaddr, 1,
- + (virt_to_bus(&lp->init_block)) & 0xffff);
- + lp->a.write_csr(ioaddr, 2, (virt_to_bus(&lp->init_block)) >> 16);
- + lp->a.write_csr(ioaddr, 4, 0x0915);
- + lp->a.write_csr(ioaddr, 0, 0x0001);
- +
- +
- + i = 0;
- + while (i++ < 100)
- + if (lp->a.read_csr(ioaddr, 0) & 0x0100)
- + break;
- + /*
- + * We used to clear the InitDone bit, 0x0100, here but Mark Stockton
- + * reports that doing so triggers a bug in the '974.
- + */
- + lp->a.write_csr(ioaddr, 0, 0x0042);
- +
- + dprintf(("pcnet32 open, csr0 %hX.\n", lp->a.read_csr(ioaddr, 0)));
- +
- +}
- +
- +/**************************************************************************
- +POLL - Wait for a frame
- +***************************************************************************/
- +static int pcnet32_poll(struct nic *nic __unused, int retrieve)
- +{
- + /* return true if there's an ethernet packet ready to read */
- + /* nic->packet should contain data on return */
- + /* nic->packetlen should contain length of data */
- +
- + int status;
- + int entry;
- +
- + entry = lp->cur_rx & RX_RING_MOD_MASK;
- + status = ((short) le16_to_cpu(rx_ring[entry].status) >> 8);
- +
- + if (status < 0)
- + return 0;
- +
- + if ( ! retrieve ) return 1;
- +
- + if (status == 0x03) {
- + nic->packetlen =
- + (le32_to_cpu(rx_ring[entry].msg_length) & 0xfff) - 4;
- + memcpy(nic->packet, &rxb[entry], nic->packetlen);
- +
- + /* Andrew Boyd of QNX reports that some revs of the 79C765
- + * clear the buffer length */
- + rx_ring[entry].buf_length = le16_to_cpu(-PKT_BUF_SZ);
- + rx_ring[entry].status |= le16_to_cpu(0x8000); /* prime for next receive */
- + /* Switch to the next Rx ring buffer */
- + lp->cur_rx++;
- +
- + } else {
- + return 0;
- + }
- +
- + return 1;
- +}
- +
- +/**************************************************************************
- +TRANSMIT - Transmit a frame
- +***************************************************************************/
- +static void pcnet32_transmit(struct nic *nic __unused, const char *d, /* Destination */
- + unsigned int t, /* Type */
- + unsigned int s, /* size */
- + const char *p)
- +{ /* Packet */
- + /* send the packet to destination */
- + unsigned long time;
- + u8 *ptxb;
- + u16 nstype;
- + u16 status;
- + int entry = 0; /*lp->cur_tx & TX_RING_MOD_MASK; */
- +
- + status = 0x8300;
- + /* point to the current txb incase multiple tx_rings are used */
- + ptxb = txb + (lp->cur_tx * PKT_BUF_SZ);
- +
- + /* copy the packet to ring buffer */
- + memcpy(ptxb, d, ETH_ALEN); /* dst */
- + memcpy(ptxb + ETH_ALEN, nic->node_addr, ETH_ALEN); /* src */
- + nstype = htons((u16) t); /* type */
- + memcpy(ptxb + 2 * ETH_ALEN, (u8 *) & nstype, 2); /* type */
- + memcpy(ptxb + ETH_HLEN, p, s);
- +
- + s += ETH_HLEN;
- + while (s < ETH_ZLEN) /* pad to min length */
- + ptxb[s++] = '\0';
- +
- + tx_ring[entry].length = le16_to_cpu(-s);
- + tx_ring[entry].misc = 0x00000000;
- + tx_ring[entry].base = (u32) virt_to_le32desc(ptxb);
- +
- + /* we set the top byte as the very last thing */
- + tx_ring[entry].status = le16_to_cpu(status);
- +
- +
- + /* Trigger an immediate send poll */
- + lp->a.write_csr(ioaddr, 0, 0x0048);
- +
- + /* wait for transmit complete */
- + lp->cur_tx = 0; /* (lp->cur_tx + 1); */
- + time = currticks() + TICKS_PER_SEC; /* wait one second */
- + while (currticks() < time &&
- + ((short) le16_to_cpu(tx_ring[entry].status) < 0));
- +
- + if ((short) le16_to_cpu(tx_ring[entry].status) < 0)
- + printf("PCNET32 timed out on transmit\n");
- +
- + /* Stop pointing at the current txb
- + * otherwise the card continues to send the packet */
- + tx_ring[entry].base = 0;
- +
- +}
- +
- +/**************************************************************************
- +DISABLE - Turn off ethernet interface
- +***************************************************************************/
- +static void pcnet32_disable(struct dev *dev __unused)
- +{
- + /* Stop the PCNET32 here -- it ocassionally polls memory if we don't */
- + lp->a.write_csr(ioaddr, 0, 0x0004);
- +
- + /*
- + * Switch back to 16-bit mode to avoid problesm with dumb
- + * DOS packet driver after a warm reboot
- + */
- + lp->a.write_bcr(ioaddr, 20, 4);
- +}
- +
- +/**************************************************************************
- +IRQ - Enable, Disable, or Force interrupts
- +***************************************************************************/
- +static void pcnet32_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
- +
- +/**************************************************************************
- +PROBE - Look for an adapter, this routine's visible to the outside
- +You should omit the last argument struct pci_device * for a non-PCI NIC
- +***************************************************************************/
- +static int pcnet32_probe(struct dev *dev, struct pci_device *pci)
- +{
- + struct nic *nic = (struct nic *) dev;
- + int i, media;
- + int fdx, mii, fset, dxsuflo, ltint;
- + int chip_version;
- + char *chipname;
- + struct pcnet32_access *a = NULL;
- + u8 promaddr[6];
- +
- + int shared = 1;
- + if (pci->ioaddr == 0)
- + return 0;
- +
- + /* BASE is used throughout to address the card */
- + ioaddr = pci->ioaddr;
- + printf("pcnet32.c: Found %s, Vendor=0x%hX Device=0x%hX\n",
- + pci->name, pci->vendor, pci->dev_id);
- +
- + nic->irqno = 0;
- + nic->ioaddr = pci->ioaddr & ~3;
- +
- + /* reset the chip */
- + pcnet32_wio_reset(ioaddr);
- +
- + /* NOTE: 16-bit check is first, otherwise some older PCnet chips fail */
- + if (pcnet32_wio_read_csr(ioaddr, 0) == 4
- + && pcnet32_wio_check(ioaddr)) {
- + a = &pcnet32_wio;
- + } else {
- + pcnet32_dwio_reset(ioaddr);
- + if (pcnet32_dwio_read_csr(ioaddr, 0) == 4
- + && pcnet32_dwio_check(ioaddr)) {
- + a = &pcnet32_dwio;
- + } else
- + return 0;
- + }
- +
- + chip_version =
- + a->read_csr(ioaddr, 88) | (a->read_csr(ioaddr, 89) << 16);
- +
- + dprintf(("PCnet chip version is %0xhX\n", chip_version));
- + if ((chip_version & 0xfff) != 0x003)
- + return 0;
- +
- + /* initialize variables */
- + fdx = mii = fset = dxsuflo = ltint = 0;
- + chip_version = (chip_version >> 12) & 0xffff;
- +
- + switch (chip_version) {
- + case 0x2420:
- + chipname = "PCnet/PCI 79C970"; /* PCI */
- + break;
- + case 0x2430:
- + if (shared)
- + chipname = "PCnet/PCI 79C970"; /* 970 gives the wrong chip id back */
- + else
- + chipname = "PCnet/32 79C965"; /* 486/VL bus */
- + break;
- + case 0x2621:
- + chipname = "PCnet/PCI II 79C970A"; /* PCI */
- + fdx = 1;
- + break;
- + case 0x2623:
- + chipname = "PCnet/FAST 79C971"; /* PCI */
- + fdx = 1;
- + mii = 1;
- + fset = 1;
- + ltint = 1;
- + break;
- + case 0x2624:
- + chipname = "PCnet/FAST+ 79C972"; /* PCI */
- + fdx = 1;
- + mii = 1;
- + fset = 1;
- + break;
- + case 0x2625:
- + chipname = "PCnet/FAST III 79C973"; /* PCI */
- + fdx = 1;
- + mii = 1;
- + break;
- + case 0x2626:
- + chipname = "PCnet/Home 79C978"; /* PCI */
- + fdx = 1;
- + /*
- + * This is based on specs published at www.amd.com. This section
- + * assumes that a card with a 79C978 wants to go into 1Mb HomePNA
- + * mode. The 79C978 can also go into standard ethernet, and there
- + * probably should be some sort of module option to select the
- + * mode by which the card should operate
- + */
- + /* switch to home wiring mode */
- + media = a->read_bcr(ioaddr, 49);
- +
- + printf("media reset to %#x.\n", media);
- + a->write_bcr(ioaddr, 49, media);
- + break;
- + case 0x2627:
- + chipname = "PCnet/FAST III 79C975"; /* PCI */
- + fdx = 1;
- + mii = 1;
- + break;
- + default:
- + printf("PCnet version %#x, no PCnet32 chip.\n",
- + chip_version);
- + return 0;
- + }
- +
- + /*
- + * On selected chips turn on the BCR18:NOUFLO bit. This stops transmit
- + * starting until the packet is loaded. Strike one for reliability, lose
- + * one for latency - although on PCI this isnt a big loss. Older chips
- + * have FIFO's smaller than a packet, so you can't do this.
- + */
- +
- + if (fset) {
- + a->write_bcr(ioaddr, 18,
- + (a->read_bcr(ioaddr, 18) | 0x0800));
- + a->write_csr(ioaddr, 80,
- + (a->read_csr(ioaddr, 80) & 0x0C00) | 0x0c00);
- + dxsuflo = 1;
- + ltint = 1;
- + }
- +
- + dprintf(("%s at %hX,", chipname, ioaddr));
- +
- + /* read PROM address */
- + for (i = 0; i < 6; i++)
- + promaddr[i] = inb(ioaddr + i);
- +
- + /* Update the nic structure with the MAC Address */
- + for (i = 0; i < ETH_ALEN; i++) {
- + nic->node_addr[i] = promaddr[i];
- + }
- + /* Print out some hardware info */
- + printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr,
- + ioaddr);
- +
- + /* Set to pci bus master */
- + adjust_pci_device(pci);
- +
- + /* point to private storage */
- + lp = &lpx;
- +
- +#if EBDEBUG
- + if (((chip_version + 1) & 0xfffe) == 0x2624) { /* Version 0x2623 or 0x2624 */
- + i = a->read_csr(ioaddr, 80) & 0x0C00; /* Check tx_start_pt */
- + dprintf((" tx_start_pt(0x%hX):", i));
- + switch (i >> 10) {
- + case 0:
- + dprintf((" 20 bytes,"));
- + break;
- + case 1:
- + dprintf((" 64 bytes,"));
- + break;
- + case 2:
- + dprintf((" 128 bytes,"));
- + break;
- + case 3:
- + dprintf(("~220 bytes,"));
- + break;
- + }
- + i = a->read_bcr(ioaddr, 18); /* Check Burst/Bus control */
- + dprintf((" BCR18(%hX):", i & 0xffff));
- + if (i & (1 << 5))
- + dprintf(("BurstWrEn "));
- + if (i & (1 << 6))
- + dprintf(("BurstRdEn "));
- + if (i & (1 << 7))
- + dprintf(("DWordIO "));
- + if (i & (1 << 11))
- + dprintf(("NoUFlow "));
- + i = a->read_bcr(ioaddr, 25);
- + dprintf((" SRAMSIZE=0x%hX,", i << 8));
- + i = a->read_bcr(ioaddr, 26);
- + dprintf((" SRAM_BND=0x%hX,", i << 8));
- + i = a->read_bcr(ioaddr, 27);
- + if (i & (1 << 14))
- + dprintf(("LowLatRx"));
- + }
- +#endif
- + lp->name = chipname;
- + lp->shared_irq = shared;
- + lp->full_duplex = fdx;
- + lp->dxsuflo = dxsuflo;
- + lp->ltint = ltint;
- + lp->mii = mii;
- + /* FIXME: Fix Options for only one card */
- + if ((cards_found >= MAX_UNITS)
- + || ((unsigned int) options[cards_found] > sizeof(options_mapping)))
- + lp->options = PCNET32_PORT_ASEL;
- + else
- + lp->options = options_mapping[options[cards_found]];
- +
- + if (fdx && !(lp->options & PCNET32_PORT_ASEL) &&
- + ((cards_found >= MAX_UNITS) || full_duplex[cards_found]))
- + lp->options |= PCNET32_PORT_FD;
- +
- + if (!a) {
- + printf("No access methods\n");
- + return 0;
- + }
- + lp->a = *a;
- +
- + /* detect special T1/E1 WAN card by checking for MAC address */
- + if (nic->node_addr[0] == 0x00 && nic->node_addr[1] == 0xe0
- + && nic->node_addr[2] == 0x75)
- + lp->options = PCNET32_PORT_FD | PCNET32_PORT_GPSI;
- +
- + lp->init_block.mode = le16_to_cpu(0x0003); /* Disable Rx and Tx. */
- + lp->init_block.tlen_rlen =
- + le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS);
- + for (i = 0; i < 6; i++)
- + lp->init_block.phys_addr[i] = nic->node_addr[i];
- + lp->init_block.filter[0] = 0xffffffff;
- + lp->init_block.filter[1] = 0xffffffff;
- + lp->init_block.rx_ring = virt_to_bus(&rx_ring);
- + lp->init_block.tx_ring = virt_to_bus(&tx_ring);
- +
- + /* switch pcnet32 to 32bit mode */
- + a->write_bcr(ioaddr, 20, 2);
- +
- +
- + a->write_csr(ioaddr, 1, (virt_to_bus(&lp->init_block)) & 0xffff);
- + a->write_csr(ioaddr, 2, (virt_to_bus(&lp->init_block)) >> 16);
- +
- + /*
- + * To auto-IRQ we enable the initialization-done and DMA error
- + * interrupts. For ISA boards we get a DMA error, but VLB and PCI
- + * boards will work.
- + */
- + /* Trigger an initialization just for the interrupt. */
- +
- + a->write_csr(ioaddr, 0, 0x41);
- + mdelay(1);
- +
- + cards_found++;
- +
- + /* point to NIC specific routines */
- + pcnet32_reset(nic);
- + if (1) {
- + int tmp;
- + int phy, phy_idx = 0;
- + u16 mii_lpa;
- + lp->phys[0] = 1; /* Default Setting */
- + for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) {
- + int mii_status = mdio_read(nic, phy, MII_BMSR);
- + if (mii_status != 0xffff && mii_status != 0x0000) {
- + lp->phys[phy_idx++] = phy;
- + lp->mii_if.advertising =
- + mdio_read(nic, phy, MII_ADVERTISE);
- + if ((mii_status & 0x0040) == 0) {
- + tmp = phy;
- + dprintf (("MII PHY found at address %d, status "
- + "%hX advertising %hX\n", phy, mii_status,
- + lp->mii_if.advertising));
- + }
- + }
- + }
- + if (phy_idx == 0)
- + printf("No MII transceiver found!\n");
- + lp->mii_if.phy_id = lp->phys[0];
- +
- + lp->mii_if.advertising =
- + mdio_read(nic, lp->phys[0], MII_ADVERTISE);
- +
- + mii_lpa = mdio_read(nic, lp->phys[0], MII_LPA);
- + lp->mii_if.advertising &= mii_lpa;
- + if (lp->mii_if.advertising & ADVERTISE_100FULL)
- + printf("100Mbps Full-Duplex\n");
- + else if (lp->mii_if.advertising & ADVERTISE_100HALF)
- + printf("100Mbps Half-Duplex\n");
- + else if (lp->mii_if.advertising & ADVERTISE_10FULL)
- + printf("10Mbps Full-Duplex\n");
- + else if (lp->mii_if.advertising & ADVERTISE_10HALF)
- + printf("10Mbps Half-Duplex\n");
- + else
- + printf("\n");
- + }
- +
- + nic->poll = pcnet32_poll;
- + nic->transmit = pcnet32_transmit;
- + dev->disable = pcnet32_disable;
- + nic->irq = pcnet32_irq;
- +
- + return 1;
- +}
- +static int mdio_read(struct nic *nic __unused, int phy_id, int reg_num)
- +{
- + u16 val_out;
- + int phyaddr;
- +
- + if (!lp->mii)
- + return 0;
- +
- + phyaddr = lp->a.read_bcr(ioaddr, 33);
- +
- + lp->a.write_bcr(ioaddr, 33,
- + ((phy_id & 0x1f) << 5) | (reg_num & 0x1f));
- + val_out = lp->a.read_bcr(ioaddr, 34);
- + lp->a.write_bcr(ioaddr, 33, phyaddr);
- +
- + return val_out;
- +}
- +
- +#if 0
- +static void mdio_write(struct nic *nic __unused, int phy_id, int reg_num,
- + int val)
- +{
- + int phyaddr;
- +
- + if (!lp->mii)
- + return;
- +
- + phyaddr = lp->a.read_bcr(ioaddr, 33);
- +
- + lp->a.write_bcr(ioaddr, 33,
- + ((phy_id & 0x1f) << 5) | (reg_num & 0x1f));
- + lp->a.write_bcr(ioaddr, 34, val);
- + lp->a.write_bcr(ioaddr, 33, phyaddr);
- +}
- +#endif
- +
- +static struct pci_id pcnet32_nics[] = {
- + PCI_ROM(0x1022, 0x2000, "lancepci", "AMD Lance/PCI"),
- + PCI_ROM(0x1022, 0x2625, "pcnetfastiii", "AMD Lance/PCI PCNet/32"),
- + PCI_ROM(0x1022, 0x2001, "amdhomepna", "AMD Lance/HomePNA"),
- +};
- +
- +struct pci_driver pcnet32_driver = {
- + .type = NIC_DRIVER,
- + .name = "PCNET32/PCI",
- + .probe = pcnet32_probe,
- + .ids = pcnet32_nics,
- + .id_count = sizeof(pcnet32_nics) / sizeof(pcnet32_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/pic8259.c grub-0.97/netboot/pic8259.c
- --- grub-0.97.orig/netboot/pic8259.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/pic8259.c 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,267 @@
- +/*
- + * Basic support for controlling the 8259 Programmable Interrupt Controllers.
- + *
- + * Initially written by Michael Brown (mcb30).
- + */
- +
- +#include <etherboot.h>
- +#include <pic8259.h>
- +
- +#ifdef DEBUG_IRQ
- +#define DBG(...) printf ( __VA_ARGS__ )
- +#else
- +#define DBG(...)
- +#endif
- +
- +/* Current locations of trivial IRQ handler. These will change at
- + * runtime when relocation is used; the handler needs to be copied to
- + * base memory before being installed.
- + */
- +void (*trivial_irq_handler)P((void)) = _trivial_irq_handler;
- +uint16_t volatile *trivial_irq_trigger_count = &_trivial_irq_trigger_count;
- +segoff_t *trivial_irq_chain_to = &_trivial_irq_chain_to;
- +uint8_t *trivial_irq_chain = &_trivial_irq_chain;
- +irq_t trivial_irq_installed_on = IRQ_NONE;
- +
- +/* Previous trigger count for trivial IRQ handler */
- +static uint16_t trivial_irq_previous_trigger_count = 0;
- +
- +/* Install a handler for the specified IRQ. Address of previous
- + * handler will be stored in previous_handler. Enabled/disabled state
- + * of IRQ will be preserved across call, therefore if the handler does
- + * chaining, ensure that either (a) IRQ is disabled before call, or
- + * (b) previous_handler points directly to the place that the handler
- + * picks up its chain-to address.
- + */
- +
- +int install_irq_handler ( irq_t irq, segoff_t *handler,
- + uint8_t *previously_enabled,
- + segoff_t *previous_handler ) {
- + segoff_t *irq_vector = IRQ_VECTOR ( irq );
- + *previously_enabled = irq_enabled ( irq );
- +
- + if ( irq > IRQ_MAX ) {
- + DBG ( "Invalid IRQ number %d\n" );
- + return 0;
- + }
- +
- + previous_handler->segment = irq_vector->segment;
- + previous_handler->offset = irq_vector->offset;
- + if ( *previously_enabled ) disable_irq ( irq );
- + DBG ( "Installing handler at %hx:%hx for IRQ %d, leaving %s\n",
- + handler->segment, handler->offset, irq,
- + ( *previously_enabled ? "enabled" : "disabled" ) );
- + DBG ( "...(previous handler at %hx:%hx)\n",
- + previous_handler->segment, previous_handler->offset );
- + irq_vector->segment = handler->segment;
- + irq_vector->offset = handler->offset;
- + if ( *previously_enabled ) enable_irq ( irq );
- + return 1;
- +}
- +
- +/* Remove handler for the specified IRQ. Routine checks that another
- + * handler has not been installed that chains to handler before
- + * uninstalling handler. Enabled/disabled state of the IRQ will be
- + * restored to that specified by previously_enabled.
- + */
- +
- +int remove_irq_handler ( irq_t irq, segoff_t *handler,
- + uint8_t *previously_enabled,
- + segoff_t *previous_handler ) {
- + segoff_t *irq_vector = IRQ_VECTOR ( irq );
- +
- + if ( irq > IRQ_MAX ) {
- + DBG ( "Invalid IRQ number %d\n" );
- + return 0;
- + }
- + if ( ( irq_vector->segment != handler->segment ) ||
- + ( irq_vector->offset != handler->offset ) ) {
- + DBG ( "Cannot remove handler for IRQ %d\n" );
- + return 0;
- + }
- +
- + DBG ( "Removing handler for IRQ %d\n", irq );
- + disable_irq ( irq );
- + irq_vector->segment = previous_handler->segment;
- + irq_vector->offset = previous_handler->offset;
- + if ( *previously_enabled ) enable_irq ( irq );
- + return 1;
- +}
- +
- +/* Install the trivial IRQ handler. This routine installs the
- + * handler, tests it and enables the IRQ.
- + */
- +
- +int install_trivial_irq_handler ( irq_t irq ) {
- + segoff_t trivial_irq_handler_segoff = SEGOFF(trivial_irq_handler);
- +
- + if ( trivial_irq_installed_on != IRQ_NONE ) {
- + DBG ( "Can install trivial IRQ handler only once\n" );
- + return 0;
- + }
- + if ( SEGMENT(trivial_irq_handler) > 0xffff ) {
- + DBG ( "Trivial IRQ handler not in base memory\n" );
- + return 0;
- + }
- +
- + DBG ( "Installing trivial IRQ handler on IRQ %d\n", irq );
- + if ( ! install_irq_handler ( irq, &trivial_irq_handler_segoff,
- + trivial_irq_chain,
- + trivial_irq_chain_to ) )
- + return 0;
- + trivial_irq_installed_on = irq;
- +
- + DBG ( "Testing trivial IRQ handler\n" );
- + disable_irq ( irq );
- + *trivial_irq_trigger_count = 0;
- + trivial_irq_previous_trigger_count = 0;
- + fake_irq ( irq );
- + if ( ! trivial_irq_triggered ( irq ) ) {
- + DBG ( "Installation of trivial IRQ handler failed\n" );
- + remove_trivial_irq_handler ( irq );
- + return 0;
- + }
- + DBG ( "Trivial IRQ handler installed successfully\n" );
- + enable_irq ( irq );
- + return 1;
- +}
- +
- +/* Remove the trivial IRQ handler.
- + */
- +
- +int remove_trivial_irq_handler ( irq_t irq ) {
- + segoff_t trivial_irq_handler_segoff = SEGOFF(trivial_irq_handler);
- +
- + if ( trivial_irq_installed_on == IRQ_NONE ) return 1;
- + if ( irq != trivial_irq_installed_on ) {
- + DBG ( "Cannot uninstall trivial IRQ handler from IRQ %d; "
- + "is installed on IRQ %d\n", irq,
- + trivial_irq_installed_on );
- + return 0;
- + }
- +
- + if ( ! remove_irq_handler ( irq, &trivial_irq_handler_segoff,
- + trivial_irq_chain,
- + trivial_irq_chain_to ) )
- + return 0;
- +
- + if ( trivial_irq_triggered ( trivial_irq_installed_on ) ) {
- + DBG ( "Sending EOI for unwanted trivial IRQ\n" );
- + send_specific_eoi ( trivial_irq_installed_on );
- + }
- +
- + trivial_irq_installed_on = IRQ_NONE;
- + return 1;
- +}
- +
- +/* Safe method to detect whether or not trivial IRQ has been
- + * triggered. Using this call avoids potential race conditions. This
- + * call will return success only once per trigger.
- + */
- +
- +int trivial_irq_triggered ( irq_t irq ) {
- + uint16_t trivial_irq_this_trigger_count = *trivial_irq_trigger_count;
- + int triggered = ( trivial_irq_this_trigger_count -
- + trivial_irq_previous_trigger_count );
- +
- + /* irq is not used at present, but we have it in the API for
- + * future-proofing; in case we want the facility to have
- + * multiple trivial IRQ handlers installed simultaneously.
- + *
- + * Avoid compiler warning about unused variable.
- + */
- + if ( irq == IRQ_NONE ) {};
- +
- + trivial_irq_previous_trigger_count = trivial_irq_this_trigger_count;
- + return triggered ? 1 : 0;
- +}
- +
- +/* Copy trivial IRQ handler to a new location. Typically used to copy
- + * the handler into base memory; when relocation is being used we need
- + * to do this before installing the handler.
- + *
- + * Call with target=NULL in order to restore the handler to its
- + * original location.
- + */
- +
- +int copy_trivial_irq_handler ( void *target, size_t target_size ) {
- + irq_t currently_installed_on = trivial_irq_installed_on;
- + uint32_t offset = ( target == NULL ? 0 :
- + target - &_trivial_irq_handler_start );
- +
- + if (( target != NULL ) && ( target_size < TRIVIAL_IRQ_HANDLER_SIZE )) {
- + DBG ( "Insufficient space to copy trivial IRQ handler\n" );
- + return 0;
- + }
- +
- + if ( currently_installed_on != IRQ_NONE ) {
- + DBG ("WARNING: relocating trivial IRQ handler while in use\n");
- + if ( ! remove_trivial_irq_handler ( currently_installed_on ) )
- + return 0;
- + }
- +
- + /* Do the actual copy */
- + if ( target != NULL ) {
- + DBG ( "Copying trivial IRQ handler to %hx:%hx\n",
- + SEGMENT(target), OFFSET(target) );
- + memcpy ( target, &_trivial_irq_handler_start,
- + TRIVIAL_IRQ_HANDLER_SIZE );
- + } else {
- + DBG ( "Restoring trivial IRQ handler to original location\n" );
- + }
- + /* Update all the pointers to structures within the handler */
- + trivial_irq_handler = ( void (*)P((void)) )
- + ( (void*)_trivial_irq_handler + offset );
- + trivial_irq_trigger_count = (uint16_t*)
- + ( (void*)&_trivial_irq_trigger_count + offset );
- + trivial_irq_chain_to = (segoff_t*)
- + ( (void*)&_trivial_irq_chain_to + offset );
- + trivial_irq_chain = (uint8_t*)
- + ( (void*)&_trivial_irq_chain + offset );
- +
- + if ( currently_installed_on != IRQ_NONE ) {
- + if ( ! install_trivial_irq_handler ( currently_installed_on ) )
- + return 0;
- + }
- + return 1;
- +}
- +
- +/* Send non-specific EOI(s). This seems to be inherently unsafe.
- + */
- +
- +void send_nonspecific_eoi ( irq_t irq ) {
- + DBG ( "Sending non-specific EOI for IRQ %d\n", irq );
- + if ( irq >= IRQ_PIC_CUTOFF ) {
- + outb ( ICR_EOI_NON_SPECIFIC, PIC2_ICR );
- + }
- + outb ( ICR_EOI_NON_SPECIFIC, PIC1_ICR );
- +}
- +
- +/* Send specific EOI(s).
- + */
- +
- +void send_specific_eoi ( irq_t irq ) {
- + DBG ( "Sending specific EOI for IRQ %d\n", irq );
- + outb ( ICR_EOI_SPECIFIC | ICR_VALUE(irq), ICR_REG(irq) );
- + if ( irq >= IRQ_PIC_CUTOFF ) {
- + outb ( ICR_EOI_SPECIFIC | ICR_VALUE(CHAINED_IRQ),
- + ICR_REG(CHAINED_IRQ) );
- + }
- +}
- +
- +/* Dump current 8259 status: enabled IRQs and handler addresses.
- + */
- +
- +#ifdef DEBUG_IRQ
- +void dump_irq_status ( void ) {
- + int irq = 0;
- +
- + for ( irq = 0; irq < 16; irq++ ) {
- + if ( irq_enabled ( irq ) ) {
- + printf ( "IRQ%d enabled, ISR at %hx:%hx\n", irq,
- + IRQ_VECTOR(irq)->segment,
- + IRQ_VECTOR(irq)->offset );
- + }
- + }
- +}
- +#endif
- diff -Naur grub-0.97.orig/netboot/pic8259.h grub-0.97/netboot/pic8259.h
- --- grub-0.97.orig/netboot/pic8259.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/pic8259.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,99 @@
- +/*
- + * Basic support for controlling the 8259 Programmable Interrupt Controllers.
- + *
- + * Initially written by Michael Brown (mcb30).
- + */
- +
- +#ifndef PIC8259_H
- +#define PIC8259_H
- +
- +/* For segoff_t */
- +#include <segoff.h>
- +
- +#define IRQ_PIC_CUTOFF (8)
- +
- +/* 8259 register locations */
- +#define PIC1_ICW1 (0x20)
- +#define PIC1_OCW2 (0x20)
- +#define PIC1_OCW3 (0x20)
- +#define PIC1_ICR (0x20)
- +#define PIC1_IRR (0x20)
- +#define PIC1_ISR (0x20)
- +#define PIC1_ICW2 (0x21)
- +#define PIC1_ICW3 (0x21)
- +#define PIC1_ICW4 (0x21)
- +#define PIC1_IMR (0x21)
- +#define PIC2_ICW1 (0xa0)
- +#define PIC2_OCW2 (0xa0)
- +#define PIC2_OCW3 (0xa0)
- +#define PIC2_ICR (0xa0)
- +#define PIC2_IRR (0xa0)
- +#define PIC2_ISR (0xa0)
- +#define PIC2_ICW2 (0xa1)
- +#define PIC2_ICW3 (0xa1)
- +#define PIC2_ICW4 (0xa1)
- +#define PIC2_IMR (0xa1)
- +
- +/* Register command values */
- +#define OCW3_ID (0x08)
- +#define OCW3_READ_IRR (0x03)
- +#define OCW3_READ_ISR (0x02)
- +#define ICR_EOI_NON_SPECIFIC (0x20)
- +#define ICR_EOI_NOP (0x40)
- +#define ICR_EOI_SPECIFIC (0x60)
- +#define ICR_EOI_SET_PRIORITY (0xc0)
- +
- +/* Macros to enable/disable IRQs */
- +#define IMR_REG(x) ( (x) < IRQ_PIC_CUTOFF ? PIC1_IMR : PIC2_IMR )
- +#define IMR_BIT(x) ( 1 << ( (x) % IRQ_PIC_CUTOFF ) )
- +#define irq_enabled(x) ( ( inb ( IMR_REG(x) ) & IMR_BIT(x) ) == 0 )
- +#define enable_irq(x) outb ( inb( IMR_REG(x) ) & ~IMR_BIT(x), IMR_REG(x) )
- +#define disable_irq(x) outb ( inb( IMR_REG(x) ) | IMR_BIT(x), IMR_REG(x) )
- +
- +/* Macros for acknowledging IRQs */
- +#define ICR_REG(x) ( (x) < IRQ_PIC_CUTOFF ? PIC1_ICR : PIC2_ICR )
- +#define ICR_VALUE(x) ( (x) % IRQ_PIC_CUTOFF )
- +#define CHAINED_IRQ 2
- +
- +/* Utility macros to convert IRQ numbers to INT numbers and INT vectors */
- +#define IRQ_INT(x) ( (x)<IRQ_PIC_CUTOFF ? (x)+0x08 : (x)-IRQ_PIC_CUTOFF+0x70 )
- +#define INT_VECTOR(x) ( (segoff_t*) phys_to_virt( 4 * (x) ) )
- +#define IRQ_VECTOR(x) ( INT_VECTOR ( IRQ_INT(x) ) )
- +
- +/* Other constants */
- +typedef uint8_t irq_t;
- +#define IRQ_MAX (15)
- +#define IRQ_NONE (0xff)
- +
- +/* Labels in assembly code (in pcbios.S)
- + */
- +extern void _trivial_irq_handler_start;
- +extern void _trivial_irq_handler ( void );
- +extern volatile uint16_t _trivial_irq_trigger_count;
- +extern segoff_t _trivial_irq_chain_to;
- +extern uint8_t _trivial_irq_chain;
- +extern void _trivial_irq_handler_end;
- +#define TRIVIAL_IRQ_HANDLER_SIZE \
- + ((uint32_t)( &_trivial_irq_handler_end - &_trivial_irq_handler_start ))
- +
- +/* Function prototypes
- + */
- +int install_irq_handler ( irq_t irq, segoff_t *handler,
- + uint8_t *previously_enabled,
- + segoff_t *previous_handler );
- +int remove_irq_handler ( irq_t irq, segoff_t *handler,
- + uint8_t *previously_enabled,
- + segoff_t *previous_handler );
- +int install_trivial_irq_handler ( irq_t irq );
- +int remove_trivial_irq_handler ( irq_t irq );
- +int trivial_irq_triggered ( irq_t irq );
- +int copy_trivial_irq_handler ( void *target, size_t target_size );
- +void send_non_specific_eoi ( irq_t irq );
- +void send_specific_eoi ( irq_t irq );
- +#ifdef DEBUG_IRQ
- +void dump_irq_status ( void );
- +#else
- +#define dump_irq_status()
- +#endif
- +
- +#endif /* PIC8259_H */
- diff -Naur grub-0.97.orig/netboot/pnic.c grub-0.97/netboot/pnic.c
- --- grub-0.97.orig/netboot/pnic.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/pnic.c 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,267 @@
- +/**************************************************************************
- +Etherboot - BOOTP/TFTP Bootstrap Program
- +Bochs Pseudo NIC driver for Etherboot
- +***************************************************************************/
- +
- +/*
- + * This program is free software; you can redistribute it and/or
- + * modify it under the terms of the GNU General Public License as
- + * published by the Free Software Foundation; either version 2, or (at
- + * your option) any later version.
- + *
- + * See pnic_api.h for an explanation of the Bochs Pseudo NIC.
- + */
- +
- +/* to get some global routines like printf */
- +#include "etherboot.h"
- +/* to get the interface to the body of the program */
- +#include "nic.h"
- +/* to get the PCI support functions, if this is a PCI NIC */
- +#include "pci.h"
- +
- +/* PNIC API */
- +#include "pnic_api.h"
- +
- +/* Private data structure */
- +typedef struct {
- + uint16_t api_version;
- +} pnic_priv_data_t;
- +
- +/* Function prototypes */
- +static int pnic_api_check ( uint16_t api_version );
- +
- +/* NIC specific static variables go here */
- +static uint8_t tx_buffer[ETH_FRAME_LEN];
- +
- +/*
- + * Utility functions: issue a PNIC command, retrieve result. Use
- + * pnic_command_quiet if you don't want failure codes to be
- + * automatically printed. Returns the PNIC status code.
- + *
- + * Set output_length to NULL only if you expect to receive exactly
- + * output_max_length bytes, otherwise it'll complain that you didn't
- + * get enough data (on the assumption that if you not interested in
- + * discovering the output length then you're expecting a fixed amount
- + * of data).
- + */
- +
- +static uint16_t pnic_command_quiet ( struct nic *nic, uint16_t command,
- + void *input, uint16_t input_length,
- + void *output, uint16_t output_max_length,
- + uint16_t *output_length ) {
- + int i;
- + uint16_t status;
- + uint16_t _output_length;
- +
- + if ( input != NULL ) {
- + /* Write input length */
- + outw ( input_length, nic->ioaddr + PNIC_REG_LEN );
- + /* Write input data */
- + for ( i = 0; i < input_length; i++ ) {
- + outb( ((char*)input)[i], nic->ioaddr + PNIC_REG_DATA );
- + }
- + }
- + /* Write command */
- + outw ( command, nic->ioaddr + PNIC_REG_CMD );
- + /* Retrieve status */
- + status = inw ( nic->ioaddr + PNIC_REG_STAT );
- + /* Retrieve output length */
- + _output_length = inw ( nic->ioaddr + PNIC_REG_LEN );
- + if ( output_length == NULL ) {
- + if ( _output_length != output_max_length ) {
- + printf ( "pnic_command %#hx: wrong data length "
- + "returned (expected %d, got %d)\n", command,
- + output_max_length, _output_length );
- + }
- + } else {
- + *output_length = _output_length;
- + }
- + if ( output != NULL ) {
- + if ( _output_length > output_max_length ) {
- + printf ( "pnic_command %#hx: output buffer too small "
- + "(have %d, need %d)\n", command,
- + output_max_length, _output_length );
- + _output_length = output_max_length;
- + }
- + /* Retrieve output data */
- + for ( i = 0; i < _output_length; i++ ) {
- + ((char*)output)[i] =
- + inb ( nic->ioaddr + PNIC_REG_DATA );
- + }
- + }
- + return status;
- +}
- +
- +static uint16_t pnic_command ( struct nic *nic, uint16_t command,
- + void *input, uint16_t input_length,
- + void *output, uint16_t output_max_length,
- + uint16_t *output_length ) {
- + pnic_priv_data_t *priv = (pnic_priv_data_t*)nic->priv_data;
- + uint16_t status = pnic_command_quiet ( nic, command,
- + input, input_length,
- + output, output_max_length,
- + output_length );
- + if ( status == PNIC_STATUS_OK ) return status;
- + printf ( "PNIC command %#hx (len %#hx) failed with status %#hx\n",
- + command, input_length, status );
- + if ( priv->api_version ) pnic_api_check(priv->api_version);
- + return status;
- +}
- +
- +/* Check API version matches that of NIC */
- +static int pnic_api_check ( uint16_t api_version ) {
- + if ( api_version != PNIC_API_VERSION ) {
- + printf ( "Warning: API version mismatch! "
- + "(NIC's is %d.%d, ours is %d.%d)\n",
- + api_version >> 8, api_version & 0xff,
- + PNIC_API_VERSION >> 8, PNIC_API_VERSION & 0xff );
- + }
- + if ( api_version < PNIC_API_VERSION ) {
- + printf ( "*** You may need to update your copy of Bochs ***\n" );
- + }
- + return ( api_version == PNIC_API_VERSION );
- +}
- +
- +/**************************************************************************
- +POLL - Wait for a frame
- +***************************************************************************/
- +static int pnic_poll(struct nic *nic, int retrieve)
- +{
- + uint16_t length;
- + uint16_t qlen;
- +
- + /* Check receive queue length to see if there's anything to
- + * get. Necessary since once we've called PNIC_CMD_RECV we
- + * have to read out the packet, otherwise it's lost forever.
- + */
- + if ( pnic_command ( nic, PNIC_CMD_RECV_QLEN, NULL, 0,
- + &qlen, sizeof(qlen), NULL )
- + != PNIC_STATUS_OK ) return ( 0 );
- + if ( qlen == 0 ) return ( 0 );
- +
- + /* There is a packet ready. Return 1 if we're only checking. */
- + if ( ! retrieve ) return ( 1 );
- +
- + /* Retrieve the packet */
- + if ( pnic_command ( nic, PNIC_CMD_RECV, NULL, 0,
- + nic->packet, ETH_FRAME_LEN, &length )
- + != PNIC_STATUS_OK ) return ( 0 );
- + nic->packetlen = length;
- + return ( 1 );
- +}
- +
- +/**************************************************************************
- +TRANSMIT - Transmit a frame
- +***************************************************************************/
- +static void pnic_transmit(
- + struct nic *nic,
- + const char *dest, /* Destination */
- + unsigned int type, /* Type */
- + unsigned int size, /* size */
- + const char *data) /* Packet */
- +{
- + unsigned int nstype = htons ( type );
- +
- + if ( ( ETH_HLEN + size ) >= ETH_FRAME_LEN ) {
- + printf ( "pnic_transmit: packet too large\n" );
- + return;
- + }
- +
- + /* Assemble packet */
- + memcpy ( tx_buffer, dest, ETH_ALEN );
- + memcpy ( tx_buffer + ETH_ALEN, nic->node_addr, ETH_ALEN );
- + memcpy ( tx_buffer + 2 * ETH_ALEN, &nstype, 2 );
- + memcpy ( tx_buffer + ETH_HLEN, data, size );
- +
- + pnic_command ( nic, PNIC_CMD_XMIT, tx_buffer, ETH_HLEN + size,
- + NULL, 0, NULL );
- +}
- +
- +/**************************************************************************
- +DISABLE - Turn off ethernet interface
- +***************************************************************************/
- +static void pnic_disable(struct dev *dev)
- +{
- + struct nic *nic = (struct nic *)dev;
- + pnic_command ( nic, PNIC_CMD_RESET, NULL, 0, NULL, 0, NULL );
- +}
- +
- +/**************************************************************************
- +IRQ - Handle card interrupt status
- +***************************************************************************/
- +static void pnic_irq ( struct nic *nic, irq_action_t action )
- +{
- + uint8_t enabled;
- +
- + switch ( action ) {
- + case DISABLE :
- + case ENABLE :
- + enabled = ( action == ENABLE ? 1 : 0 );
- + pnic_command ( nic, PNIC_CMD_MASK_IRQ,
- + &enabled, sizeof(enabled), NULL, 0, NULL );
- + break;
- + case FORCE :
- + pnic_command ( nic, PNIC_CMD_FORCE_IRQ,
- + NULL, 0, NULL, 0, NULL );
- + break;
- + }
- +}
- +
- +/**************************************************************************
- +PROBE - Look for an adapter, this routine's visible to the outside
- +***************************************************************************/
- +
- +static int pnic_probe(struct dev *dev, struct pci_device *pci)
- +{
- + struct nic *nic = (struct nic *)dev;
- + static pnic_priv_data_t priv;
- + uint16_t status;
- +
- + printf(" - ");
- +
- + /* Clear private data structure and chain it in */
- + memset ( &priv, 0, sizeof(priv) );
- + nic->priv_data = &priv;
- +
- + /* Mask the bit that says "this is an io addr" */
- + nic->ioaddr = pci->ioaddr & ~3;
- + nic->irqno = pci->irq;
- + /* Not sure what this does, but the rtl8139 driver does it */
- + adjust_pci_device(pci);
- +
- + status = pnic_command_quiet( nic, PNIC_CMD_API_VER, NULL, 0,
- + &priv.api_version,
- + sizeof(priv.api_version), NULL );
- + if ( status != PNIC_STATUS_OK ) {
- + printf ( "PNIC failed installation check, code %#hx\n",
- + status );
- + return 0;
- + }
- + pnic_api_check(priv.api_version);
- + status = pnic_command ( nic, PNIC_CMD_READ_MAC, NULL, 0,
- + nic->node_addr, ETH_ALEN, NULL );
- + printf ( "Detected Bochs Pseudo NIC MAC %! (API v%d.%d) at %#hx\n",
- + nic->node_addr, priv.api_version>>8, priv.api_version&0xff,
- + nic->ioaddr );
- +
- + /* point to NIC specific routines */
- + dev->disable = pnic_disable;
- + nic->poll = pnic_poll;
- + nic->transmit = pnic_transmit;
- + nic->irq = pnic_irq;
- + return 1;
- +}
- +
- +static struct pci_id pnic_nics[] = {
- +/* genrules.pl doesn't let us use macros for PCI IDs...*/
- +PCI_ROM(0xfefe, 0xefef, "pnic", "Bochs Pseudo NIC Adaptor"),
- +};
- +
- +struct pci_driver pnic_driver = {
- + .type = NIC_DRIVER,
- + .name = "PNIC",
- + .probe = pnic_probe,
- + .ids = pnic_nics,
- + .id_count = sizeof(pnic_nics)/sizeof(pnic_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/pnic_api.h grub-0.97/netboot/pnic_api.h
- --- grub-0.97.orig/netboot/pnic_api.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/pnic_api.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,59 @@
- +/*
- + * Constants etc. for the Bochs/Etherboot pseudo-NIC
- + *
- + * This header file must be valid C and C++.
- + *
- + * Operation of the pseudo-NIC (PNIC) is pretty simple. To write a
- + * command plus data, first write the length of the data to
- + * PNIC_REG_LEN, then write the data a byte at a type to
- + * PNIC_REG_DATA, then write the command code to PNIC_REG_CMD. The
- + * status will be available from PNIC_REG_STAT. The length of any
- + * data returned will be in PNIC_REG_LEN and can be read a byte at a
- + * time from PNIC_REG_DATA.
- + */
- +
- +/*
- + * PCI parameters
- + */
- +#define PNIC_PCI_VENDOR 0xfefe /* Hopefully these won't clash with */
- +#define PNIC_PCI_DEVICE 0xefef /* any real PCI device IDs. */
- +
- +/*
- + * 'Hardware' register addresses, offset from io_base
- + */
- +#define PNIC_REG_CMD 0x00 /* Command register, 2 bytes, write only */
- +#define PNIC_REG_STAT 0x00 /* Status register, 2 bytes, read only */
- +#define PNIC_REG_LEN 0x02 /* Length register, 2 bytes, read-write */
- +#define PNIC_REG_DATA 0x04 /* Data port, 1 byte, read-write */
- +/*
- + * PNIC_MAX_REG used in Bochs to claim i/o space
- + */
- +#define PNIC_MAX_REG 0x04
- +
- +/*
- + * Command code definitions: write these into PNIC_REG_CMD
- + */
- +#define PNIC_CMD_NOOP 0x0000
- +#define PNIC_CMD_API_VER 0x0001
- +#define PNIC_CMD_READ_MAC 0x0002
- +#define PNIC_CMD_RESET 0x0003
- +#define PNIC_CMD_XMIT 0x0004
- +#define PNIC_CMD_RECV 0x0005
- +#define PNIC_CMD_RECV_QLEN 0x0006
- +#define PNIC_CMD_MASK_IRQ 0x0007
- +#define PNIC_CMD_FORCE_IRQ 0x0008
- +
- +/*
- + * Status code definitions: read these from PNIC_REG_STAT
- + *
- + * We avoid using status codes that might be confused with
- + * randomly-read data (e.g. 0x0000, 0xffff etc.)
- + */
- +#define PNIC_STATUS_OK 0x4f4b /* 'OK' */
- +#define PNIC_STATUS_UNKNOWN_CMD 0x3f3f /* '??' */
- +
- +/*
- + * Other miscellaneous information
- + */
- +
- +#define PNIC_API_VERSION 0x0101 /* 1.1 */
- diff -Naur grub-0.97.orig/netboot/pxe.h grub-0.97/netboot/pxe.h
- --- grub-0.97.orig/netboot/pxe.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/pxe.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,521 @@
- +/*
- + * Copyright (c) 2000 Alfred Perlstein <alfred@freebsd.org>
- + * All rights reserved.
- + * Copyright (c) 2000 Paul Saab <ps@freebsd.org>
- + * All rights reserved.
- + * Copyright (c) 2000 John Baldwin <jhb@freebsd.org>
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + *
- + * $FreeBSD: src/sys/boot/i386/libi386/pxe.h,v 1.4.2.2 2000/09/10 02:52:18 ps Exp $
- + */
- +
- +/*
- + * The typedefs and structures declared in this file
- + * clearly violate style(9), the reason for this is to conform to the
- + * typedefs/structure-names used in the Intel literature to avoid confusion.
- + *
- + * It's for your own good. :)
- + */
- +
- +/* SEGOFF16_t defined in separate header for Etherboot
- + */
- +#include <segoff.h>
- +
- +/* It seems that intel didn't think about ABI,
- + * either that or 16bit ABI != 32bit ABI (which seems reasonable)
- + * I have to thank Intel for the hair loss I incurred trying to figure
- + * out why PXE was mis-reading structures I was passing it (at least
- + * from my point of view)
- + *
- + * Solution: use gcc's '__attribute__ ((packed))' to correctly align
- + * structures passed into PXE
- + * Question: does this really work for PXE's expected ABI?
- + */
- +#define PACKED __attribute__ ((packed))
- +
- +#define S_SIZE(s) s, sizeof(s) - 1
- +
- +#define IP_STR "%d.%d.%d.%d"
- +#define IP_ARGS(ip) \
- + (int)(ip >> 24) & 0xff, (int)(ip >> 16) & 0xff, \
- + (int)(ip >> 8) & 0xff, (int)ip & 0xff
- +
- +#define MAC_STR "%02x:%02x:%02x:%02x:%02x:%02x"
- +#define MAC_ARGS(mac) \
- + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]
- +
- +#define PXENFSROOTPATH "/pxeroot"
- +
- +typedef struct {
- + uint16_t Seg_Addr;
- + uint32_t Phy_Addr;
- + uint16_t Seg_Size;
- +} PACKED SEGDESC_t; /* PACKED is required, otherwise gcc pads this out to 12
- + bytes - mbrown@fensystems.co.uk (mcb30) 17/5/03 */
- +
- +typedef uint16_t SEGSEL_t;
- +typedef uint16_t PXENV_STATUS_t;
- +typedef uint32_t IP4_t;
- +typedef uint32_t ADDR32_t;
- +typedef uint16_t UDP_PORT_t;
- +
- +#define MAC_ADDR_LEN 16
- +typedef uint8_t MAC_ADDR[MAC_ADDR_LEN];
- +
- +/* PXENV+ */
- +typedef struct {
- + uint8_t Signature[6]; /* 'PXENV+' */
- + uint16_t Version; /* MSB = major, LSB = minor */
- + uint8_t Length; /* structure length */
- + uint8_t Checksum; /* checksum pad */
- + SEGOFF16_t RMEntry; /* SEG:OFF to PXE entry point */
- + /* don't use PMOffset and PMSelector (from the 2.1 PXE manual) */
- + uint32_t PMOffset; /* Protected mode entry */
- + SEGSEL_t PMSelector; /* Protected mode selector */
- + SEGSEL_t StackSeg; /* Stack segment address */
- + uint16_t StackSize; /* Stack segment size (bytes) */
- + SEGSEL_t BC_CodeSeg; /* BC Code segment address */
- + uint16_t BC_CodeSize; /* BC Code segment size (bytes) */
- + SEGSEL_t BC_DataSeg; /* BC Data segment address */
- + uint16_t BC_DataSize; /* BC Data segment size (bytes) */
- + SEGSEL_t UNDIDataSeg; /* UNDI Data segment address */
- + uint16_t UNDIDataSize; /* UNDI Data segment size (bytes) */
- + SEGSEL_t UNDICodeSeg; /* UNDI Code segment address */
- + uint16_t UNDICodeSize; /* UNDI Code segment size (bytes) */
- + SEGOFF16_t PXEPtr; /* SEG:OFF to !PXE struct,
- + only present when Version > 2.1 */
- +} PACKED pxenv_t;
- +
- +/* !PXE */
- +typedef struct {
- + uint8_t Signature[4];
- + uint8_t StructLength;
- + uint8_t StructCksum;
- + uint8_t StructRev;
- + uint8_t reserved_1;
- + SEGOFF16_t UNDIROMID;
- + SEGOFF16_t BaseROMID;
- + SEGOFF16_t EntryPointSP;
- + SEGOFF16_t EntryPointESP;
- + SEGOFF16_t StatusCallout;
- + uint8_t reserved_2;
- + uint8_t SegDescCn;
- + SEGSEL_t FirstSelector;
- + SEGDESC_t Stack;
- + SEGDESC_t UNDIData;
- + SEGDESC_t UNDICode;
- + SEGDESC_t UNDICodeWrite;
- + SEGDESC_t BC_Data;
- + SEGDESC_t BC_Code;
- + SEGDESC_t BC_CodeWrite;
- +} PACKED pxe_t;
- +
- +#define PXENV_START_UNDI 0x0000
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint16_t ax;
- + uint16_t bx;
- + uint16_t dx;
- + uint16_t di;
- + uint16_t es;
- +} PACKED t_PXENV_START_UNDI;
- +
- +#define PXENV_UNDI_STARTUP 0x0001
- +typedef struct {
- + PXENV_STATUS_t Status;
- +} PACKED t_PXENV_UNDI_STARTUP;
- +
- +#define PXENV_UNDI_CLEANUP 0x0002
- +typedef struct {
- + PXENV_STATUS_t Status;
- +} PACKED t_PXENV_UNDI_CLEANUP;
- +
- +#define PXENV_UNDI_INITIALIZE 0x0003
- +typedef struct {
- + PXENV_STATUS_t Status;
- + ADDR32_t ProtocolIni; /* Phys addr of a copy of the driver module */
- + uint8_t reserved[8];
- +} PACKED t_PXENV_UNDI_INITIALIZE;
- +
- +
- +#define MAXNUM_MCADDR 8
- +typedef struct {
- + uint16_t MCastAddrCount;
- + MAC_ADDR McastAddr[MAXNUM_MCADDR];
- +} PACKED t_PXENV_UNDI_MCAST_ADDRESS;
- +
- +#define PXENV_UNDI_RESET_ADAPTER 0x0004
- +typedef struct {
- + PXENV_STATUS_t Status;
- + t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
- +} PACKED t_PXENV_UNDI_RESET;
- +
- +#define PXENV_UNDI_SHUTDOWN 0x0005
- +typedef struct {
- + PXENV_STATUS_t Status;
- +} PACKED t_PXENV_UNDI_SHUTDOWN;
- +
- +#define PXENV_UNDI_OPEN 0x0006
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint16_t OpenFlag;
- + uint16_t PktFilter;
- +# define FLTR_DIRECTED 0x0001
- +# define FLTR_BRDCST 0x0002
- +# define FLTR_PRMSCS 0x0003
- +# define FLTR_SRC_RTG 0x0004
- +
- + t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
- +} PACKED t_PXENV_UNDI_OPEN;
- +
- +#define PXENV_UNDI_CLOSE 0x0007
- +typedef struct {
- + PXENV_STATUS_t Status;
- +} PACKED t_PXENV_UNDI_CLOSE;
- +
- +#define PXENV_UNDI_TRANSMIT 0x0008
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint8_t Protocol;
- +# define P_UNKNOWN 0
- +# define P_IP 1
- +# define P_ARP 2
- +# define P_RARP 3
- +
- + uint8_t XmitFlag;
- +# define XMT_DESTADDR 0x0000
- +# define XMT_BROADCAST 0x0001
- +
- + SEGOFF16_t DestAddr;
- + SEGOFF16_t TBD;
- + uint32_t Reserved[2];
- +} PACKED t_PXENV_UNDI_TRANSMIT;
- +
- +#define MAX_DATA_BLKS 8
- +typedef struct {
- + uint16_t ImmedLength;
- + SEGOFF16_t Xmit;
- + uint16_t DataBlkCount;
- + struct DataBlk {
- + uint8_t TDPtrType;
- + uint8_t TDRsvdByte;
- + uint16_t TDDataLen;
- + SEGOFF16_t TDDataPtr;
- + } DataBlock[MAX_DATA_BLKS];
- +} PACKED t_PXENV_UNDI_TBD;
- +
- +#define PXENV_UNDI_SET_MCAST_ADDRESS 0x0009
- +typedef struct {
- + PXENV_STATUS_t Status;
- + t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
- +} PACKED t_PXENV_UNDI_SET_MCAST_ADDR;
- +
- +#define PXENV_UNDI_SET_STATION_ADDRESS 0x000A
- +typedef struct {
- + PXENV_STATUS_t Status;
- + MAC_ADDR StationAddress; /* Temp MAC addres to use */
- +} PACKED t_PXENV_UNDI_SET_STATION_ADDRESS;
- +
- +#define PXENV_UNDI_SET_PACKET_FILTER 0x000B
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint8_t filter; /* see UNDI_OPEN (0x0006) */
- +} PACKED t_PXENV_UNDI_SET_PACKET_FILTER;
- +
- +#define PXENV_UNDI_GET_INFORMATION 0x000C
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint16_t BaseIo; /* Adapter base I/O address */
- + uint16_t IntNumber; /* Adapter IRQ number */
- + uint16_t MaxTranUnit; /* Adapter maximum transmit unit */
- + uint16_t HwType; /* Type of protocol at the hardware addr */
- +# define ETHER_TYPE 1
- +# define EXP_ETHER_TYPE 2
- +# define IEEE_TYPE 6
- +# define ARCNET_TYPE 7
- +
- + uint16_t HwAddrLen; /* Length of hardware address */
- + MAC_ADDR CurrentNodeAddress; /* Current hardware address */
- + MAC_ADDR PermNodeAddress; /* Permanent hardware address */
- + SEGSEL_t ROMAddress; /* Real mode ROM segment address */
- + uint16_t RxBufCt; /* Receive queue length */
- + uint16_t TxBufCt; /* Transmit queue length */
- +} PACKED t_PXENV_UNDI_GET_INFORMATION;
- +
- +#define PXENV_UNDI_GET_STATISTICS 0x000D
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint32_t XmitGoodFrames; /* Number of successful transmissions */
- + uint32_t RcvGoodFrames; /* Number of good frames received */
- + uint32_t RcvCRCErrors; /* Number of frames with CRC errors */
- + uint32_t RcvResourceErrors; /* Number of frames dropped */
- +} PACKED t_PXENV_UNDI_GET_STATISTICS;
- +
- +#define PXENV_UNDI_CLEAR_STATISTICS 0x000E
- +typedef struct {
- + PXENV_STATUS_t Status;
- +} PACKED t_PXENV_UNDI_CLEAR_STATISTICS;
- +
- +#define PXENV_UNDI_INITIATE_DIAGS 0x000F
- +typedef struct {
- + PXENV_STATUS_t Status;
- +} PACKED t_PXENV_UNDI_INITIATE_DIAGS;
- +
- +#define PXENV_UNDI_FORCE_INTERRUPT 0x0010
- +typedef struct {
- + PXENV_STATUS_t Status;
- +} PACKED t_PXENV_UNDI_FORCE_INTERRUPT;
- +
- +#define PXENV_UNDI_GET_MCAST_ADDRESS 0x0011
- +typedef struct {
- + PXENV_STATUS_t Status;
- + IP4_t InetAddr; /* IP mulicast address */
- + MAC_ADDR MediaAddr; /* MAC multicast address */
- +} PACKED t_PXENV_UNDI_GET_MCAST_ADDR;
- +
- +#define PXENV_UNDI_GET_NIC_TYPE 0x0012
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint8_t NicType; /* Type of NIC */
- +# define PCI_NIC 2
- +# define PnP_NIC 3
- +# define CardBus_NIC 4
- +
- + union {
- + struct {
- + uint16_t Vendor_ID;
- + uint16_t Dev_ID;
- + uint8_t Base_Class;
- + uint8_t Sub_Class;
- + uint8_t Prog_Intf;
- + uint8_t Rev;
- + uint16_t BusDevFunc;
- + uint16_t SubVendor_ID;
- + uint16_t SubDevice_ID;
- + } pci, cardbus;
- + struct {
- + uint32_t EISA_Dev_ID;
- + uint8_t Base_Class;
- + uint8_t Sub_Class;
- + uint8_t Prog_Intf;
- + uint16_t CardSelNum;
- + } pnp;
- + } info;
- +} PACKED t_PXENV_UNDI_GET_NIC_TYPE;
- +
- +#define PXENV_UNDI_GET_IFACE_INFO 0x0013
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint8_t IfaceType[16]; /* Name of MAC type in ASCII. */
- + uint32_t LinkSpeed; /* Defined in NDIS 2.0 spec */
- + uint32_t ServiceFlags; /* Defined in NDIS 2.0 spec */
- + uint32_t Reserved[4]; /* must be 0 */
- +} PACKED t_PXENV_UNDI_GET_IFACE_INFO;
- +
- +#define PXENV_UNDI_ISR 0x0014
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint16_t FuncFlag; /* PXENV_UNDI_ISR_OUT_xxx */
- + uint16_t BufferLength; /* Length of Frame */
- + uint16_t FrameLength; /* Total length of reciever frame */
- + uint16_t FrameHeaderLength; /* Length of the media header in Frame */
- + SEGOFF16_t Frame; /* receive buffer */
- + uint8_t ProtType; /* Protocol type */
- + uint8_t PktType; /* Packet Type */
- +# define PXENV_UNDI_ISR_IN_START 1
- +# define PXENV_UNDI_ISR_IN_PROCESS 2
- +# define PXENV_UNDI_ISR_IN_GET_NEXT 3
- +
- + /* one of these will be returned for PXENV_UNDI_ISR_IN_START */
- +# define PXENV_UNDI_ISR_OUT_OURS 0
- +# define PXENV_UNDI_ISR_OUT_NOT_OURS 1
- +
- + /*
- + * one of these will bre returnd for PXEND_UNDI_ISR_IN_PROCESS
- + * and PXENV_UNDI_ISR_IN_GET_NEXT
- + */
- +# define PXENV_UNDI_ISR_OUT_DONE 0
- +# define PXENV_UNDI_ISR_OUT_TRANSMIT 2
- +# define PXENV_UNDI_ISR_OUT_RECEIVE 3
- +# define PXENV_UNDI_ISR_OUT_BUSY 4
- +} PACKED t_PXENV_UNDI_ISR;
- +
- +#define PXENV_STOP_UNDI 0x0015
- +typedef struct {
- + PXENV_STATUS_t Status;
- +} PACKED t_PXENV_STOP_UNDI;
- +
- +#define PXENV_TFTP_OPEN 0x0020
- +typedef struct {
- + PXENV_STATUS_t Status;
- + IP4_t ServerIPAddress;
- + IP4_t GatewayIPAddress;
- + uint8_t FileName[128];
- + UDP_PORT_t TFTPPort;
- + uint16_t PacketSize;
- +} PACKED t_PXENV_TFTP_OPEN;
- +
- +#define PXENV_TFTP_CLOSE 0x0021
- +typedef struct {
- + PXENV_STATUS_t Status;
- +} PACKED t_PXENV_TFTP_CLOSE;
- +
- +#define PXENV_TFTP_READ 0x0022
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint16_t PacketNumber;
- + uint16_t BufferSize;
- + SEGOFF16_t Buffer;
- +} PACKED t_PXENV_TFTP_READ;
- +
- +#define PXENV_TFTP_READ_FILE 0x0023
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint8_t FileName[128];
- + uint32_t BufferSize;
- + ADDR32_t Buffer;
- + IP4_t ServerIPAddress;
- + IP4_t GatewayIPAdress;
- + IP4_t McastIPAdress;
- + UDP_PORT_t TFTPClntPort;
- + UDP_PORT_t TFTPSrvPort;
- + uint16_t TFTPOpenTimeOut;
- + uint16_t TFTPReopenDelay;
- +} PACKED t_PXENV_TFTP_READ_FILE;
- +
- +#define PXENV_TFTP_GET_FSIZE 0x0025
- +typedef struct {
- + PXENV_STATUS_t Status;
- + IP4_t ServerIPAddress;
- + IP4_t GatewayIPAdress;
- + uint8_t FileName[128];
- + uint32_t FileSize;
- +} PACKED t_PXENV_TFTP_GET_FSIZE;
- +
- +#define PXENV_UDP_OPEN 0x0030
- +typedef struct {
- + PXENV_STATUS_t Status;
- + IP4_t src_ip; /* IP address of this station */
- +} PACKED t_PXENV_UDP_OPEN;
- +
- +#define PXENV_UDP_CLOSE 0x0031
- +typedef struct {
- + PXENV_STATUS_t status;
- +} PACKED t_PXENV_UDP_CLOSE;
- +
- +#define PXENV_UDP_READ 0x0032
- +typedef struct {
- + PXENV_STATUS_t status;
- + IP4_t src_ip; /* IP of sender */
- + IP4_t dest_ip; /* Only accept packets sent to this IP */
- + UDP_PORT_t s_port; /* UDP source port of sender */
- + UDP_PORT_t d_port; /* Only accept packets sent to this port */
- + uint16_t buffer_size; /* Size of the packet buffer */
- + SEGOFF16_t buffer; /* SEG:OFF to the packet buffer */
- +} PACKED t_PXENV_UDP_READ;
- +
- +#define PXENV_UDP_WRITE 0x0033
- +typedef struct {
- + PXENV_STATUS_t status;
- + IP4_t ip; /* dest ip addr */
- + IP4_t gw; /* ip gateway */
- + UDP_PORT_t src_port; /* source udp port */
- + UDP_PORT_t dst_port; /* destination udp port */
- + uint16_t buffer_size; /* Size of the packet buffer */
- + SEGOFF16_t buffer; /* SEG:OFF to the packet buffer */
- +} PACKED t_PXENV_UDP_WRITE;
- +
- +#define PXENV_UNLOAD_STACK 0x0070
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint8_t reserved[10];
- +} PACKED t_PXENV_UNLOAD_STACK;
- +
- +
- +#define PXENV_GET_CACHED_INFO 0x0071
- +typedef struct {
- + PXENV_STATUS_t Status;
- + uint16_t PacketType; /* type (defined right here) */
- +# define PXENV_PACKET_TYPE_DHCP_DISCOVER 1
- +# define PXENV_PACKET_TYPE_DHCP_ACK 2
- +# define PXENV_PACKET_TYPE_BINL_REPLY 3
- + uint16_t BufferSize; /* max to copy, leave at 0 for pointer */
- + SEGOFF16_t Buffer; /* copy to, leave at 0 for pointer */
- + uint16_t BufferLimit; /* max size of buffer in BC dataseg ? */
- +} PACKED t_PXENV_GET_CACHED_INFO;
- +
- +
- +/* structure filled in by PXENV_GET_CACHED_INFO
- + * (how we determine which IP we downloaded the initial bootstrap from)
- + * words can't describe...
- + */
- +typedef struct {
- + uint8_t opcode;
- +# define BOOTP_REQ 1
- +# define BOOTP_REP 2
- + uint8_t Hardware; /* hardware type */
- + uint8_t Hardlen; /* hardware addr len */
- + uint8_t Gatehops; /* zero it */
- + uint32_t ident; /* random number chosen by client */
- + uint16_t seconds; /* seconds since did initial bootstrap */
- + uint16_t Flags; /* seconds since did initial bootstrap */
- +# define BOOTP_BCAST 0x8000 /* ? */
- + IP4_t cip; /* Client IP */
- + IP4_t yip; /* Your IP */
- + IP4_t sip; /* IP to use for next boot stage */
- + IP4_t gip; /* Relay IP ? */
- + MAC_ADDR CAddr; /* Client hardware address */
- + uint8_t Sname[64]; /* Server's hostname (Optional) */
- + uint8_t bootfile[128]; /* boot filename */
- + union {
- +# if 1
- +# define BOOTP_DHCPVEND 1024 /* DHCP extended vendor field size */
- +# else
- +# define BOOTP_DHCPVEND 312 /* DHCP standard vendor field size */
- +# endif
- + uint8_t d[BOOTP_DHCPVEND]; /* raw array of vendor/dhcp options */
- + struct {
- + uint8_t magic[4]; /* DHCP magic cookie */
- +# ifndef VM_RFC1048
- +# define VM_RFC1048 0x63825363L /* ? */
- +# endif
- + uint32_t flags; /* bootp flags/opcodes */
- + uint8_t pad[56]; /* I don't think intel knows what a
- + union does... */
- + } v;
- + } vendor;
- +} PACKED BOOTPLAYER;
- +
- +#define PXENV_RESTART_TFTP 0x0073
- +#define t_PXENV_RESTART_TFTP t_PXENV_TFTP_READ_FILE
- +
- +#define PXENV_START_BASE 0x0075
- +typedef struct {
- + PXENV_STATUS_t Status;
- +} PACKED t_PXENV_START_BASE;
- +
- +#define PXENV_STOP_BASE 0x0076
- +typedef struct {
- + PXENV_STATUS_t Status;
- +} PACKED t_PXENV_STOP_BASE;
- diff -Naur grub-0.97.orig/netboot/r8169.c grub-0.97/netboot/r8169.c
- --- grub-0.97.orig/netboot/r8169.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/r8169.c 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,854 @@
- +/**************************************************************************
- +* r8169.c: Etherboot device driver for the RealTek RTL-8169 Gigabit
- +* Written 2003 by Timothy Legge <tlegge@rogers.com>
- +*
- +* This program is free software; you can redistribute it and/or modify
- +* it under the terms of the GNU General Public License as published by
- +* the Free Software Foundation; either version 2 of the License, or
- +* (at your option) any later version.
- +*
- +* This program is distributed in the hope that it will be useful,
- +* but WITHOUT ANY WARRANTY; without even the implied warranty of
- +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +* GNU General Public License for more details.
- +*
- +* You should have received a copy of the GNU General Public License
- +* along with this program; if not, write to the Free Software
- +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- +*
- +* Portions of this code based on:
- +* r8169.c: A RealTek RTL-8169 Gigabit Ethernet driver
- +* for Linux kernel 2.4.x.
- +*
- +* Written 2002 ShuChen <shuchen@realtek.com.tw>
- +* See Linux Driver for full information
- +*
- +* Linux Driver Version 1.27a, 10.02.2002
- +*
- +* Thanks to:
- +* Jean Chen of RealTek Semiconductor Corp. for
- +* providing the evaluation NIC used to develop
- +* this driver. RealTek's support for Etherboot
- +* is appreciated.
- +*
- +* REVISION HISTORY:
- +* ================
- +*
- +* v1.0 11-26-2003 timlegge Initial port of Linux driver
- +* v1.5 01-17-2004 timlegge Initial driver output cleanup
- +* v1.6 03-27-2004 timlegge Additional Cleanup
- +*
- +* Indent Options: indent -kr -i8
- +***************************************************************************/
- +
- +/* to get some global routines like printf */
- +#include "etherboot.h"
- +/* to get the interface to the body of the program */
- +#include "nic.h"
- +/* to get the PCI support functions, if this is a PCI NIC */
- +#include "pci.h"
- +#include "timer.h"
- +
- +#define drv_version "v1.6"
- +#define drv_date "03-27-2004"
- +
- +typedef unsigned char u8;
- +typedef signed char s8;
- +typedef unsigned short u16;
- +typedef signed short s16;
- +typedef unsigned int u32;
- +typedef signed int s32;
- +
- +#define HZ 1000
- +
- +static u32 ioaddr;
- +
- +#ifdef EDEBUG
- +#define dprintf(x) printf x
- +#else
- +#define dprintf(x)
- +#endif
- +
- +/* Condensed operations for readability. */
- +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
- +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
- +
- +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
- +
- +/* media options
- + _10_Half = 0x01,
- + _10_Full = 0x02,
- + _100_Half = 0x04,
- + _100_Full = 0x08,
- + _1000_Full = 0x10,
- +*/
- +static int media = -1;
- +
- +#if 0
- +/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
- +static int max_interrupt_work = 20;
- +#endif
- +
- +#if 0
- +/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
- + The RTL chips use a 64 element hash table based on the Ethernet CRC. */
- +static int multicast_filter_limit = 32;
- +#endif
- +
- +/* MAC address length*/
- +#define MAC_ADDR_LEN 6
- +
- +/* max supported gigabit ethernet frame size -- must be at least (dev->mtu+14+4).*/
- +#define MAX_ETH_FRAME_SIZE 1536
- +
- +#define TX_FIFO_THRESH 256 /* In bytes */
- +
- +#define RX_FIFO_THRESH 7 /* 7 means NO threshold, Rx buffer level before first PCI xfer. */
- +#define RX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */
- +#define TX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */
- +#define EarlyTxThld 0x3F /* 0x3F means NO early transmit */
- +#define RxPacketMaxSize 0x0800 /* Maximum size supported is 16K-1 */
- +#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */
- +
- +#define NUM_TX_DESC 1 /* Number of Tx descriptor registers */
- +#define NUM_RX_DESC 4 /* Number of Rx descriptor registers */
- +#define RX_BUF_SIZE 1536 /* Rx Buffer size */
- +
- +#define RTL_MIN_IO_SIZE 0x80
- +#define TX_TIMEOUT (6*HZ)
- +
- +/* write/read MMIO register */
- +#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
- +#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg))
- +#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
- +#define RTL_R8(reg) readb (ioaddr + (reg))
- +#define RTL_R16(reg) readw (ioaddr + (reg))
- +#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg)))
- +
- +enum RTL8169_registers {
- + MAC0 = 0, /* Ethernet hardware address. */
- + MAR0 = 8, /* Multicast filter. */
- + TxDescStartAddr = 0x20,
- + TxHDescStartAddr = 0x28,
- + FLASH = 0x30,
- + ERSR = 0x36,
- + ChipCmd = 0x37,
- + TxPoll = 0x38,
- + IntrMask = 0x3C,
- + IntrStatus = 0x3E,
- + TxConfig = 0x40,
- + RxConfig = 0x44,
- + RxMissed = 0x4C,
- + Cfg9346 = 0x50,
- + Config0 = 0x51,
- + Config1 = 0x52,
- + Config2 = 0x53,
- + Config3 = 0x54,
- + Config4 = 0x55,
- + Config5 = 0x56,
- + MultiIntr = 0x5C,
- + PHYAR = 0x60,
- + TBICSR = 0x64,
- + TBI_ANAR = 0x68,
- + TBI_LPAR = 0x6A,
- + PHYstatus = 0x6C,
- + RxMaxSize = 0xDA,
- + CPlusCmd = 0xE0,
- + RxDescStartAddr = 0xE4,
- + EarlyTxThres = 0xEC,
- + FuncEvent = 0xF0,
- + FuncEventMask = 0xF4,
- + FuncPresetState = 0xF8,
- + FuncForceEvent = 0xFC,
- +};
- +
- +enum RTL8169_register_content {
- + /*InterruptStatusBits */
- + SYSErr = 0x8000,
- + PCSTimeout = 0x4000,
- + SWInt = 0x0100,
- + TxDescUnavail = 0x80,
- + RxFIFOOver = 0x40,
- + RxUnderrun = 0x20,
- + RxOverflow = 0x10,
- + TxErr = 0x08,
- + TxOK = 0x04,
- + RxErr = 0x02,
- + RxOK = 0x01,
- +
- + /*RxStatusDesc */
- + RxRES = 0x00200000,
- + RxCRC = 0x00080000,
- + RxRUNT = 0x00100000,
- + RxRWT = 0x00400000,
- +
- + /*ChipCmdBits */
- + CmdReset = 0x10,
- + CmdRxEnb = 0x08,
- + CmdTxEnb = 0x04,
- + RxBufEmpty = 0x01,
- +
- + /*Cfg9346Bits */
- + Cfg9346_Lock = 0x00,
- + Cfg9346_Unlock = 0xC0,
- +
- + /*rx_mode_bits */
- + AcceptErr = 0x20,
- + AcceptRunt = 0x10,
- + AcceptBroadcast = 0x08,
- + AcceptMulticast = 0x04,
- + AcceptMyPhys = 0x02,
- + AcceptAllPhys = 0x01,
- +
- + /*RxConfigBits */
- + RxCfgFIFOShift = 13,
- + RxCfgDMAShift = 8,
- +
- + /*TxConfigBits */
- + TxInterFrameGapShift = 24,
- + TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */
- +
- + /*rtl8169_PHYstatus */
- + TBI_Enable = 0x80,
- + TxFlowCtrl = 0x40,
- + RxFlowCtrl = 0x20,
- + _1000bpsF = 0x10,
- + _100bps = 0x08,
- + _10bps = 0x04,
- + LinkStatus = 0x02,
- + FullDup = 0x01,
- +
- + /*GIGABIT_PHY_registers */
- + PHY_CTRL_REG = 0,
- + PHY_STAT_REG = 1,
- + PHY_AUTO_NEGO_REG = 4,
- + PHY_1000_CTRL_REG = 9,
- +
- + /*GIGABIT_PHY_REG_BIT */
- + PHY_Restart_Auto_Nego = 0x0200,
- + PHY_Enable_Auto_Nego = 0x1000,
- +
- + /* PHY_STAT_REG = 1; */
- + PHY_Auto_Neco_Comp = 0x0020,
- +
- + /* PHY_AUTO_NEGO_REG = 4; */
- + PHY_Cap_10_Half = 0x0020,
- + PHY_Cap_10_Full = 0x0040,
- + PHY_Cap_100_Half = 0x0080,
- + PHY_Cap_100_Full = 0x0100,
- +
- + /* PHY_1000_CTRL_REG = 9; */
- + PHY_Cap_1000_Full = 0x0200,
- +
- + PHY_Cap_Null = 0x0,
- +
- + /*_MediaType*/
- + _10_Half = 0x01,
- + _10_Full = 0x02,
- + _100_Half = 0x04,
- + _100_Full = 0x08,
- + _1000_Full = 0x10,
- +
- + /*_TBICSRBit*/
- + TBILinkOK = 0x02000000,
- +};
- +
- +static struct {
- + const char *name;
- + u8 version; /* depend on RTL8169 docs */
- + u32 RxConfigMask; /* should clear the bits supported by this chip */
- +} rtl_chip_info[] = {
- + {
- +"RTL-8169", 0x00, 0xff7e1880,},};
- +
- +enum _DescStatusBit {
- + OWNbit = 0x80000000,
- + EORbit = 0x40000000,
- + FSbit = 0x20000000,
- + LSbit = 0x10000000,
- +};
- +
- +struct TxDesc {
- + u32 status;
- + u32 vlan_tag;
- + u32 buf_addr;
- + u32 buf_Haddr;
- +};
- +
- +struct RxDesc {
- + u32 status;
- + u32 vlan_tag;
- + u32 buf_addr;
- + u32 buf_Haddr;
- +};
- +
- +/* The descriptors for this card are required to be aligned on
- +256 byte boundaries. As the align attribute does not do more than
- +16 bytes of alignment it requires some extra steps. Add 256 to the
- +size of the array and the init_ring adjusts the alignment */
- +
- +/* Define the TX Descriptor */
- +static u8 tx_ring[NUM_TX_DESC * sizeof(struct TxDesc) + 256];
- +
- +/* Create a static buffer of size RX_BUF_SZ for each
- +TX Descriptor. All descriptors point to a
- +part of this buffer */
- +static unsigned char txb[NUM_TX_DESC * RX_BUF_SIZE];
- +
- +/* Define the RX Descriptor */
- +static u8 rx_ring[NUM_RX_DESC * sizeof(struct TxDesc) + 256];
- +
- +/* Create a static buffer of size RX_BUF_SZ for each
- +RX Descriptor All descriptors point to a
- +part of this buffer */
- +static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE];
- +
- +struct rtl8169_private {
- + void *mmio_addr; /* memory map physical address */
- + int chipset;
- + unsigned long cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
- + unsigned long cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
- + unsigned char *TxDescArrays; /* Index of Tx Descriptor buffer */
- + unsigned char *RxDescArrays; /* Index of Rx Descriptor buffer */
- + struct TxDesc *TxDescArray; /* Index of 256-alignment Tx Descriptor buffer */
- + struct RxDesc *RxDescArray; /* Index of 256-alignment Rx Descriptor buffer */
- + unsigned char *RxBufferRing[NUM_RX_DESC]; /* Index of Rx Buffer array */
- + unsigned char *Tx_skbuff[NUM_TX_DESC];
- +} tpx;
- +
- +static struct rtl8169_private *tpc;
- +
- +static const u16 rtl8169_intr_mask =
- + SYSErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr |
- + TxOK | RxErr | RxOK;
- +static const unsigned int rtl8169_rx_config =
- + (RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift);
- +
- +void mdio_write(int RegAddr, int value)
- +{
- + int i;
- +
- + RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value);
- + udelay(1000);
- +
- + for (i = 2000; i > 0; i--) {
- + /* Check if the RTL8169 has completed writing to the specified MII register */
- + if (!(RTL_R32(PHYAR) & 0x80000000)) {
- + break;
- + } else {
- + udelay(100);
- + }
- + }
- +}
- +
- +int mdio_read(int RegAddr)
- +{
- + int i, value = -1;
- +
- + RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16);
- + udelay(1000);
- +
- + for (i = 2000; i > 0; i--) {
- + /* Check if the RTL8169 has completed retrieving data from the specified MII register */
- + if (RTL_R32(PHYAR) & 0x80000000) {
- + value = (int) (RTL_R32(PHYAR) & 0xFFFF);
- + break;
- + } else {
- + udelay(100);
- + }
- + }
- + return value;
- +}
- +
- +static int rtl8169_init_board(struct pci_device *pdev)
- +{
- + int i;
- + unsigned long rtreg_base, rtreg_len;
- + u32 tmp;
- +
- + rtreg_base = pci_bar_start(pdev, PCI_BASE_ADDRESS_1);
- + rtreg_len = pci_bar_size(pdev, PCI_BASE_ADDRESS_1);
- +
- + /* check for weird/broken PCI region reporting */
- + if (rtreg_len < RTL_MIN_IO_SIZE) {
- + printf("Invalid PCI region size(s), aborting\n");
- + }
- +
- + adjust_pci_device(pdev);
- +/* pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); */
- +
- + /* ioremap MMIO region */
- + ioaddr = (unsigned long) ioremap(rtreg_base, rtreg_len);
- + if (ioaddr == 0)
- + return 0;
- +
- + tpc->mmio_addr = &ioaddr;
- + /* Soft reset the chip. */
- + RTL_W8(ChipCmd, CmdReset);
- +
- + /* Check that the chip has finished the reset. */
- + for (i = 1000; i > 0; i--)
- + if ((RTL_R8(ChipCmd) & CmdReset) == 0)
- + break;
- + else
- + udelay(10);
- +
- + /* identify chip attached to board */
- + tmp = RTL_R32(TxConfig);
- + tmp = ((tmp & 0x7c000000) + ((tmp & 0x00800000) << 2)) >> 24;
- +
- + for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--)
- + if (tmp == rtl_chip_info[i].version) {
- + tpc->chipset = i;
- + goto match;
- + }
- + /* if unknown chip, assume array element #0, original RTL-8169 in this case */
- + dprintf(("PCI device: unknown chip version, assuming RTL-8169\n"));
- + dprintf(("PCI device: TxConfig = 0x%hX\n",
- + (unsigned long) RTL_R32(TxConfig)));
- + tpc->chipset = 0;
- + return 1;
- + match:
- + return 0;
- +
- +}
- +
- +/**************************************************************************
- +IRQ - Wait for a frame
- +***************************************************************************/
- +void r8169_irq ( struct nic *nic __unused, irq_action_t action ) {
- + int intr_status = 0;
- + int interested = RxUnderrun | RxOverflow | RxFIFOOver | RxErr | RxOK;
- +
- + switch ( action ) {
- + case DISABLE:
- + case ENABLE:
- + intr_status = RTL_R16(IntrStatus);
- + /* h/w no longer present (hotplug?) or major error,
- + bail */
- + if (intr_status == 0xFFFF)
- + break;
- +
- + intr_status = intr_status & ~interested;
- + if ( action == ENABLE )
- + intr_status = intr_status | interested;
- + RTL_W16(IntrMask, intr_status);
- + break;
- + case FORCE :
- + RTL_W8(TxPoll, (RTL_R8(TxPoll) | 0x01));
- + break;
- + }
- +}
- +
- +/**************************************************************************
- +POLL - Wait for a frame
- +***************************************************************************/
- +static int r8169_poll(struct nic *nic, int retreive)
- +{
- + /* return true if there's an ethernet packet ready to read */
- + /* nic->packet should contain data on return */
- + /* nic->packetlen should contain length of data */
- + int cur_rx;
- + unsigned int intr_status = 0;
- + cur_rx = tpc->cur_rx;
- + if ((tpc->RxDescArray[cur_rx].status & OWNbit) == 0) {
- + /* There is a packet ready */
- + if(!retreive)
- + return 1;
- + intr_status = RTL_R16(IntrStatus);
- + /* h/w no longer present (hotplug?) or major error,
- + bail */
- + if (intr_status == 0xFFFF)
- + return 0;
- + RTL_W16(IntrStatus, intr_status &
- + ~(RxFIFOOver | RxOverflow | RxOK));
- +
- + if (!(tpc->RxDescArray[cur_rx].status & RxRES)) {
- + nic->packetlen = (int) (tpc->RxDescArray[cur_rx].
- + status & 0x00001FFF) - 4;
- + memcpy(nic->packet, tpc->RxBufferRing[cur_rx],
- + nic->packetlen);
- + if (cur_rx == NUM_RX_DESC - 1)
- + tpc->RxDescArray[cur_rx].status =
- + (OWNbit | EORbit) + RX_BUF_SIZE;
- + else
- + tpc->RxDescArray[cur_rx].status =
- + OWNbit + RX_BUF_SIZE;
- + tpc->RxDescArray[cur_rx].buf_addr =
- + virt_to_bus(tpc->RxBufferRing[cur_rx]);
- + } else
- + printf("Error Rx");
- + /* FIXME: shouldn't I reset the status on an error */
- + cur_rx = (cur_rx + 1) % NUM_RX_DESC;
- + tpc->cur_rx = cur_rx;
- + RTL_W16(IntrStatus, intr_status &
- + (RxFIFOOver | RxOverflow | RxOK));
- +
- + return 1;
- +
- + }
- + tpc->cur_rx = cur_rx;
- + /* FIXME: There is no reason to do this as cur_rx did not change */
- +
- + return (0); /* initially as this is called to flush the input */
- +
- +}
- +
- +/**************************************************************************
- +TRANSMIT - Transmit a frame
- +***************************************************************************/
- +static void r8169_transmit(struct nic *nic, const char *d, /* Destination */
- + unsigned int t, /* Type */
- + unsigned int s, /* size */
- + const char *p)
- +{ /* Packet */
- + /* send the packet to destination */
- +
- + u16 nstype;
- + u32 to;
- + u8 *ptxb;
- + int entry = tpc->cur_tx % NUM_TX_DESC;
- +
- + /* point to the current txb incase multiple tx_rings are used */
- + ptxb = tpc->Tx_skbuff[entry * MAX_ETH_FRAME_SIZE];
- + memcpy(ptxb, d, ETH_ALEN);
- + memcpy(ptxb + ETH_ALEN, nic->node_addr, ETH_ALEN);
- + nstype = htons((u16) t);
- + memcpy(ptxb + 2 * ETH_ALEN, (u8 *) & nstype, 2);
- + memcpy(ptxb + ETH_HLEN, p, s);
- + s += ETH_HLEN;
- + s &= 0x0FFF;
- + while (s < ETH_ZLEN)
- + ptxb[s++] = '\0';
- +
- + tpc->TxDescArray[entry].buf_addr = virt_to_bus(ptxb);
- + if (entry != (NUM_TX_DESC - 1))
- + tpc->TxDescArray[entry].status =
- + (OWNbit | FSbit | LSbit) | ((s > ETH_ZLEN) ? s :
- + ETH_ZLEN);
- + else
- + tpc->TxDescArray[entry].status =
- + (OWNbit | EORbit | FSbit | LSbit) | ((s > ETH_ZLEN) ? s
- + : ETH_ZLEN);
- + RTL_W8(TxPoll, 0x40); /* set polling bit */
- +
- + tpc->cur_tx++;
- + to = currticks() + TX_TIMEOUT;
- + while ((tpc->TxDescArray[entry].status & OWNbit) && (currticks() < to)); /* wait */
- +
- + if (currticks() >= to) {
- + printf("TX Time Out");
- + }
- +}
- +
- +static void rtl8169_set_rx_mode(struct nic *nic __unused)
- +{
- + u32 mc_filter[2]; /* Multicast hash filter */
- + int rx_mode;
- + u32 tmp = 0;
- +
- + /* IFF_ALLMULTI */
- + /* Too many to filter perfectly -- accept all multicasts. */
- + rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
- + mc_filter[1] = mc_filter[0] = 0xffffffff;
- +
- + tmp =
- + rtl8169_rx_config | rx_mode | (RTL_R32(RxConfig) &
- + rtl_chip_info[tpc->chipset].
- + RxConfigMask);
- +
- + RTL_W32(RxConfig, tmp);
- + RTL_W32(MAR0 + 0, mc_filter[0]);
- + RTL_W32(MAR0 + 4, mc_filter[1]);
- +}
- +static void rtl8169_hw_start(struct nic *nic)
- +{
- + u32 i;
- +
- + /* Soft reset the chip. */
- + RTL_W8(ChipCmd, CmdReset);
- +
- + /* Check that the chip has finished the reset. */
- + for (i = 1000; i > 0; i--) {
- + if ((RTL_R8(ChipCmd) & CmdReset) == 0)
- + break;
- + else
- + udelay(10);
- + }
- +
- + RTL_W8(Cfg9346, Cfg9346_Unlock);
- + RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
- + RTL_W8(EarlyTxThres, EarlyTxThld);
- +
- + /* For gigabit rtl8169 */
- + RTL_W16(RxMaxSize, RxPacketMaxSize);
- +
- + /* Set Rx Config register */
- + i = rtl8169_rx_config | (RTL_R32(RxConfig) &
- + rtl_chip_info[tpc->chipset].RxConfigMask);
- + RTL_W32(RxConfig, i);
- +
- + /* Set DMA burst size and Interframe Gap Time */
- + RTL_W32(TxConfig,
- + (TX_DMA_BURST << TxDMAShift) | (InterFrameGap <<
- + TxInterFrameGapShift));
- +
- +
- + tpc->cur_rx = 0;
- +
- + RTL_W32(TxDescStartAddr, virt_to_le32desc(tpc->TxDescArray));
- + RTL_W32(RxDescStartAddr, virt_to_le32desc(tpc->RxDescArray));
- + RTL_W8(Cfg9346, Cfg9346_Lock);
- + udelay(10);
- +
- + RTL_W32(RxMissed, 0);
- +
- + rtl8169_set_rx_mode(nic);
- +
- + /* no early-rx interrupts */
- + RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xF000);
- +}
- +
- +static void rtl8169_init_ring(struct nic *nic __unused)
- +{
- + int i;
- +
- + tpc->cur_rx = 0;
- + tpc->cur_tx = 0;
- + memset(tpc->TxDescArray, 0x0, NUM_TX_DESC * sizeof(struct TxDesc));
- + memset(tpc->RxDescArray, 0x0, NUM_RX_DESC * sizeof(struct RxDesc));
- +
- + for (i = 0; i < NUM_TX_DESC; i++) {
- + tpc->Tx_skbuff[i] = &txb[i];
- + }
- +
- + for (i = 0; i < NUM_RX_DESC; i++) {
- + if (i == (NUM_RX_DESC - 1))
- + tpc->RxDescArray[i].status =
- + (OWNbit | EORbit) + RX_BUF_SIZE;
- + else
- + tpc->RxDescArray[i].status = OWNbit + RX_BUF_SIZE;
- +
- + tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE];
- + tpc->RxDescArray[i].buf_addr =
- + virt_to_bus(tpc->RxBufferRing[i]);
- + }
- +}
- +
- +/**************************************************************************
- +RESET - Finish setting up the ethernet interface
- +***************************************************************************/
- +static void r8169_reset(struct nic *nic)
- +{
- + int i;
- + u8 diff;
- + u32 TxPhyAddr, RxPhyAddr;
- +
- + tpc->TxDescArrays = tx_ring;
- + if (tpc->TxDescArrays == 0)
- + printf("Allot Error");
- + /* Tx Desscriptor needs 256 bytes alignment; */
- + TxPhyAddr = virt_to_bus(tpc->TxDescArrays);
- + diff = 256 - (TxPhyAddr - ((TxPhyAddr >> 8) << 8));
- + TxPhyAddr += diff;
- + tpc->TxDescArray = (struct TxDesc *) (tpc->TxDescArrays + diff);
- +
- + tpc->RxDescArrays = rx_ring;
- + /* Rx Desscriptor needs 256 bytes alignment; */
- + RxPhyAddr = virt_to_bus(tpc->RxDescArrays);
- + diff = 256 - (RxPhyAddr - ((RxPhyAddr >> 8) << 8));
- + RxPhyAddr += diff;
- + tpc->RxDescArray = (struct RxDesc *) (tpc->RxDescArrays + diff);
- +
- + if (tpc->TxDescArrays == NULL || tpc->RxDescArrays == NULL) {
- + printf("Allocate RxDescArray or TxDescArray failed\n");
- + return;
- + }
- +
- + rtl8169_init_ring(nic);
- + rtl8169_hw_start(nic);
- + /* Construct a perfect filter frame with the mac address as first match
- + * and broadcast for all others */
- + for (i = 0; i < 192; i++)
- + txb[i] = 0xFF;
- +
- + txb[0] = nic->node_addr[0];
- + txb[1] = nic->node_addr[1];
- + txb[2] = nic->node_addr[2];
- + txb[3] = nic->node_addr[3];
- + txb[4] = nic->node_addr[4];
- + txb[5] = nic->node_addr[5];
- +}
- +
- +/**************************************************************************
- +DISABLE - Turn off ethernet interface
- +***************************************************************************/
- +static void r8169_disable(struct dev *dev __unused)
- +{
- + int i;
- + /* Stop the chip's Tx and Rx DMA processes. */
- + RTL_W8(ChipCmd, 0x00);
- +
- + /* Disable interrupts by clearing the interrupt mask. */
- + RTL_W16(IntrMask, 0x0000);
- +
- + RTL_W32(RxMissed, 0);
- +
- + tpc->TxDescArrays = NULL;
- + tpc->RxDescArrays = NULL;
- + tpc->TxDescArray = NULL;
- + tpc->RxDescArray = NULL;
- + for (i = 0; i < NUM_RX_DESC; i++) {
- + tpc->RxBufferRing[i] = NULL;
- + }
- +}
- +
- +/**************************************************************************
- +PROBE - Look for an adapter, this routine's visible to the outside
- +***************************************************************************/
- +
- +#define board_found 1
- +#define valid_link 0
- +static int r8169_probe(struct dev *dev, struct pci_device *pci)
- +{
- + struct nic *nic = (struct nic *) dev;
- + static int board_idx = -1;
- + static int printed_version = 0;
- + int i, rc;
- + int option = -1, Cap10_100 = 0, Cap1000 = 0;
- +
- + printf("r8169.c: Found %s, Vendor=%hX Device=%hX\n",
- + pci->name, pci->vendor, pci->dev_id);
- +
- + board_idx++;
- +
- + printed_version = 1;
- +
- + /* point to private storage */
- + tpc = &tpx;
- +
- + rc = rtl8169_init_board(pci); /* Return code is meaningless */
- +
- + /* Get MAC address. FIXME: read EEPROM */
- + for (i = 0; i < MAC_ADDR_LEN; i++)
- + nic->node_addr[i] = RTL_R8(MAC0 + i);
- +
- + dprintf(("%s: Identified chip type is '%s'.\n", pci->name,
- + rtl_chip_info[tpc->chipset].name));
- + /* Print out some hardware info */
- + printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr,
- + ioaddr);
- +
- + /* if TBI is not endbled */
- + if (!(RTL_R8(PHYstatus) & TBI_Enable)) {
- + int val = mdio_read(PHY_AUTO_NEGO_REG);
- +
- + option = media;
- + /* Force RTL8169 in 10/100/1000 Full/Half mode. */
- + if (option > 0) {
- + printf(" Force-mode Enabled.\n");
- + Cap10_100 = 0, Cap1000 = 0;
- + switch (option) {
- + case _10_Half:
- + Cap10_100 = PHY_Cap_10_Half;
- + Cap1000 = PHY_Cap_Null;
- + break;
- + case _10_Full:
- + Cap10_100 = PHY_Cap_10_Full;
- + Cap1000 = PHY_Cap_Null;
- + break;
- + case _100_Half:
- + Cap10_100 = PHY_Cap_100_Half;
- + Cap1000 = PHY_Cap_Null;
- + break;
- + case _100_Full:
- + Cap10_100 = PHY_Cap_100_Full;
- + Cap1000 = PHY_Cap_Null;
- + break;
- + case _1000_Full:
- + Cap10_100 = PHY_Cap_Null;
- + Cap1000 = PHY_Cap_1000_Full;
- + break;
- + default:
- + break;
- + }
- + /* leave PHY_AUTO_NEGO_REG bit4:0 unchanged */
- + mdio_write(PHY_AUTO_NEGO_REG,
- + Cap10_100 | (val & 0x1F));
- + mdio_write(PHY_1000_CTRL_REG, Cap1000);
- + } else {
- + dprintf(("Auto-negotiation Enabled.\n",
- + pci->name));
- +
- + /* enable 10/100 Full/Half Mode, leave PHY_AUTO_NEGO_REG bit4:0 unchanged */
- + mdio_write(PHY_AUTO_NEGO_REG,
- + PHY_Cap_10_Half | PHY_Cap_10_Full |
- + PHY_Cap_100_Half | PHY_Cap_100_Full |
- + (val & 0x1F));
- +
- + /* enable 1000 Full Mode */
- + mdio_write(PHY_1000_CTRL_REG, PHY_Cap_1000_Full);
- +
- + }
- +
- + /* Enable auto-negotiation and restart auto-nigotiation */
- + mdio_write(PHY_CTRL_REG,
- + PHY_Enable_Auto_Nego | PHY_Restart_Auto_Nego);
- + udelay(100);
- +
- + /* wait for auto-negotiation process */
- + for (i = 10000; i > 0; i--) {
- + /* Check if auto-negotiation complete */
- + if (mdio_read(PHY_STAT_REG) & PHY_Auto_Neco_Comp) {
- + udelay(100);
- + option = RTL_R8(PHYstatus);
- + if (option & _1000bpsF) {
- + printf
- + ("1000Mbps Full-duplex operation.\n");
- + } else {
- + printf
- + ("%sMbps %s-duplex operation.\n",
- + (option & _100bps) ? "100" :
- + "10",
- + (option & FullDup) ? "Full" :
- + "Half");
- + }
- + break;
- + } else {
- + udelay(100);
- + }
- + } /* end for-loop to wait for auto-negotiation process */
- +
- + } else {
- + udelay(100);
- + printf
- + ("%s: 1000Mbps Full-duplex operation, TBI Link %s!\n",
- + pci->name,
- + (RTL_R32(TBICSR) & TBILinkOK) ? "OK" : "Failed");
- +
- + }
- +
- + r8169_reset(nic);
- + /* point to NIC specific routines */
- + dev->disable = r8169_disable;
- + nic->poll = r8169_poll;
- + nic->transmit = r8169_transmit;
- + nic->irqno = pci->irq;
- + nic->irq = r8169_irq;
- + nic->ioaddr = ioaddr;
- + return 1;
- +
- +}
- +
- +static struct pci_id r8169_nics[] = {
- + PCI_ROM(0x10ec, 0x8169, "r8169", "RealTek RTL8169 Gigabit Ethernet"),
- +};
- +
- +struct pci_driver r8169_driver = {
- + .type = NIC_DRIVER,
- + .name = "r8169/PCI",
- + .probe = r8169_probe,
- + .ids = r8169_nics,
- + .id_count = sizeof(r8169_nics) / sizeof(r8169_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/rtl8139.c grub-0.97/netboot/rtl8139.c
- --- grub-0.97.orig/netboot/rtl8139.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/rtl8139.c 2005-08-31 19:03:35.000000000 +0000
- @@ -17,6 +17,8 @@
- /*********************************************************************/
-
- /*
- + 28 Dec 2002 ken_yap@users.sourceforge.net (Ken Yap)
- + Put in virt_to_bus calls to allow Etherboot relocation.
-
- 06 Apr 2001 ken_yap@users.sourceforge.net (Ken Yap)
- Following email from Hyun-Joon Cha, added a disable routine, otherwise
- @@ -63,7 +65,6 @@
- #include "etherboot.h"
- #include "nic.h"
- #include "pci.h"
- -#include "cards.h"
- #include "timer.h"
-
- #define RTL_TIMEOUT (1*TICKS_PER_SEC)
- @@ -112,9 +113,19 @@
- * definitions we will probably never need to know about. */
- };
-
- +enum RxEarlyStatusBits {
- + ERGood=0x08, ERBad=0x04, EROVW=0x02, EROK=0x01
- +};
- +
- enum ChipCmdBits {
- CmdReset=0x10, CmdRxEnb=0x08, CmdTxEnb=0x04, RxBufEmpty=0x01, };
-
- +enum IntrMaskBits {
- + SERR=0x8000, TimeOut=0x4000, LenChg=0x2000,
- + FOVW=0x40, PUN_LinkChg=0x20, RXOVW=0x10,
- + TER=0x08, TOK=0x04, RER=0x02, ROK=0x01
- +};
- +
- /* Interrupt register bits, using my own meaningful names. */
- enum IntrStatusBits {
- PCIErr=0x8000, PCSTimeout=0x4000, CableLenChange= 0x2000,
- @@ -155,74 +166,68 @@
- AcceptMulticast=0x04, AcceptMyPhys=0x02, AcceptAllPhys=0x01,
- };
-
- -static int ioaddr;
- static unsigned int cur_rx,cur_tx;
-
- /* The RTL8139 can only transmit from a contiguous, aligned memory block. */
- static unsigned char tx_buffer[TX_BUF_SIZE] __attribute__((aligned(4)));
- -
- -/* I know that this is a MEGA HACK, but the tagged boot image specification
- - * states that we can do whatever we want below 0x10000 - so we do! */
- -/* But we still give the user the choice of using an internal buffer
- - just in case - Ken */
- -#ifdef USE_LOWMEM_BUFFER
- -#define rx_ring ((unsigned char *)(0x10000 - (RX_BUF_LEN + 16)))
- -#else
- static unsigned char rx_ring[RX_BUF_LEN+16] __attribute__((aligned(4)));
- -#endif
-
- -struct nic *rtl8139_probe(struct nic *nic, unsigned short *probeaddrs,
- - struct pci_device *pci);
- -static int read_eeprom(int location);
- +static int rtl8139_probe(struct dev *dev, struct pci_device *pci);
- +static int read_eeprom(struct nic *nic, int location, int addr_len);
- static void rtl_reset(struct nic *nic);
- static void rtl_transmit(struct nic *nic, const char *destaddr,
- unsigned int type, unsigned int len, const char *data);
- -static int rtl_poll(struct nic *nic);
- -static void rtl_disable(struct nic*);
- +static int rtl_poll(struct nic *nic, int retrieve);
- +static void rtl_disable(struct dev *);
- +static void rtl_irq(struct nic *nic, irq_action_t action);
-
-
- -struct nic *rtl8139_probe(struct nic *nic, unsigned short *probeaddrs,
- - struct pci_device *pci)
- +static int rtl8139_probe(struct dev *dev, struct pci_device *pci)
- {
- + struct nic *nic = (struct nic *)dev;
- int i;
- int speed10, fullduplex;
- + int addr_len;
- + unsigned short *ap = (unsigned short*)nic->node_addr;
-
- /* There are enough "RTL8139" strings on the console already, so
- * be brief and concentrate on the interesting pieces of info... */
- printf(" - ");
-
- /* Mask the bit that says "this is an io addr" */
- - ioaddr = probeaddrs[0] & ~3;
- + nic->ioaddr = pci->ioaddr & ~3;
- +
- + /* Copy IRQ from PCI information */
- + nic->irqno = pci->irq;
-
- adjust_pci_device(pci);
-
- /* Bring the chip out of low-power mode. */
- - outb(0x00, ioaddr + Config1);
- -
- - if (read_eeprom(0) != 0xffff) {
- - unsigned short *ap = (unsigned short*)nic->node_addr;
- - for (i = 0; i < 3; i++)
- - *ap++ = read_eeprom(i + 7);
- - } else {
- - unsigned char *ap = (unsigned char*)nic->node_addr;
- - for (i = 0; i < ETH_ALEN; i++)
- - *ap++ = inb(ioaddr + MAC0 + i);
- - }
- + outb(0x00, nic->ioaddr + Config1);
-
- - speed10 = inb(ioaddr + MediaStatus) & MSRSpeed10;
- - fullduplex = inw(ioaddr + MII_BMCR) & BMCRDuplex;
- - printf("ioaddr %#hX, addr %! %sMbps %s-duplex\n", ioaddr,
- - nic->node_addr, speed10 ? "10" : "100",
- - fullduplex ? "full" : "half");
- + addr_len = read_eeprom(nic,0,8) == 0x8129 ? 8 : 6;
- + for (i = 0; i < 3; i++)
- + *ap++ = read_eeprom(nic,i + 7,addr_len);
- +
- + speed10 = inb(nic->ioaddr + MediaStatus) & MSRSpeed10;
- + fullduplex = inw(nic->ioaddr + MII_BMCR) & BMCRDuplex;
- + printf("ioaddr %#hX, irq %d, addr %! %sMbps %s-duplex\n", nic->ioaddr,
- + nic->irqno, nic->node_addr, speed10 ? "10" : "100",
- + fullduplex ? "full" : "half");
-
- rtl_reset(nic);
-
- - nic->reset = rtl_reset;
- - nic->poll = rtl_poll;
- + if (inb(nic->ioaddr + MediaStatus) & MSRLinkFail) {
- + printf("Cable not connected or other link failure\n");
- + return(0);
- + }
- +
- + dev->disable = rtl_disable;
- + nic->poll = rtl_poll;
- nic->transmit = rtl_transmit;
- - nic->disable = rtl_disable;
- + nic->irq = rtl_irq;
-
- - return nic;
- + return 1;
- }
-
- /* Serial EEPROM section. */
- @@ -244,22 +249,23 @@
- #define eeprom_delay() inl(ee_addr)
-
- /* The EEPROM commands include the alway-set leading bit. */
- -#define EE_WRITE_CMD (5 << 6)
- -#define EE_READ_CMD (6 << 6)
- -#define EE_ERASE_CMD (7 << 6)
- +#define EE_WRITE_CMD (5)
- +#define EE_READ_CMD (6)
- +#define EE_ERASE_CMD (7)
-
- -static int read_eeprom(int location)
- +static int read_eeprom(struct nic *nic, int location, int addr_len)
- {
- int i;
- unsigned int retval = 0;
- - long ee_addr = ioaddr + Cfg9346;
- - int read_cmd = location | EE_READ_CMD;
- + long ee_addr = nic->ioaddr + Cfg9346;
- + int read_cmd = location | (EE_READ_CMD << addr_len);
-
- outb(EE_ENB & ~EE_CS, ee_addr);
- outb(EE_ENB, ee_addr);
- + eeprom_delay();
-
- /* Shift the read command bits out. */
- - for (i = 10; i >= 0; i--) {
- + for (i = 4 + addr_len; i >= 0; i--) {
- int dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0;
- outb(EE_ENB | dataval, ee_addr);
- eeprom_delay();
- @@ -279,31 +285,51 @@
-
- /* Terminate the EEPROM access. */
- outb(~EE_CS, ee_addr);
- + eeprom_delay();
- return retval;
- }
-
- +static const unsigned int rtl8139_rx_config =
- + (RX_BUF_LEN_IDX << 11) |
- + (RX_FIFO_THRESH << 13) |
- + (RX_DMA_BURST << 8);
- +
- +static void set_rx_mode(struct nic *nic) {
- + unsigned int mc_filter[2];
- + int rx_mode;
- + /* !IFF_PROMISC */
- + rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
- + mc_filter[1] = mc_filter[0] = 0xffffffff;
- +
- + outl(rtl8139_rx_config | rx_mode, nic->ioaddr + RxConfig);
- +
- + outl(mc_filter[0], nic->ioaddr + MAR0 + 0);
- + outl(mc_filter[1], nic->ioaddr + MAR0 + 4);
- +}
- +
- static void rtl_reset(struct nic* nic)
- {
- int i;
-
- - outb(CmdReset, ioaddr + ChipCmd);
- + outb(CmdReset, nic->ioaddr + ChipCmd);
-
- cur_rx = 0;
- cur_tx = 0;
-
- /* Give the chip 10ms to finish the reset. */
- load_timer2(10*TICKS_PER_MS);
- - while ((inb(ioaddr + ChipCmd) & CmdReset) != 0 && timer2_running())
- + while ((inb(nic->ioaddr + ChipCmd) & CmdReset) != 0 &&
- + timer2_running())
- /* wait */;
-
- for (i = 0; i < ETH_ALEN; i++)
- - outb(nic->node_addr[i], ioaddr + MAC0 + i);
- + outb(nic->node_addr[i], nic->ioaddr + MAC0 + i);
-
- /* Must enable Tx/Rx before setting transfer thresholds! */
- - outb(CmdRxEnb | CmdTxEnb, ioaddr + ChipCmd);
- + outb(CmdRxEnb | CmdTxEnb, nic->ioaddr + ChipCmd);
- outl((RX_FIFO_THRESH<<13) | (RX_BUF_LEN_IDX<<11) | (RX_DMA_BURST<<8),
- - ioaddr + RxConfig); /* accept no frames yet! */
- - outl((TX_DMA_BURST<<8)|0x03000000, ioaddr + TxConfig);
- + nic->ioaddr + RxConfig); /* accept no frames yet! */
- + outl((TX_DMA_BURST<<8)|0x03000000, nic->ioaddr + TxConfig);
-
- /* The Linux driver changes Config1 here to use a different LED pattern
- * for half duplex or full/autodetect duplex (for full/autodetect, the
- @@ -316,19 +342,26 @@
- #ifdef DEBUG_RX
- printf("rx ring address is %X\n",(unsigned long)rx_ring);
- #endif
- - outl((unsigned long)rx_ring, ioaddr + RxBuf);
- + outl((unsigned long)virt_to_bus(rx_ring), nic->ioaddr + RxBuf);
- +
- +
-
- - /* Start the chip's Tx and Rx process. */
- - outl(0, ioaddr + RxMissed);
- - /* set_rx_mode */
- - outb(AcceptBroadcast|AcceptMyPhys, ioaddr + RxConfig);
- /* If we add multicast support, the MAR0 register would have to be
- * initialized to 0xffffffffffffffff (two 32 bit accesses). Etherboot
- * only needs broadcast (for ARP/RARP/BOOTP/DHCP) and unicast. */
- - outb(CmdRxEnb | CmdTxEnb, ioaddr + ChipCmd);
-
- + outb(CmdRxEnb | CmdTxEnb, nic->ioaddr + ChipCmd);
- +
- + outl(rtl8139_rx_config, nic->ioaddr + RxConfig);
- +
- + /* Start the chip's Tx and Rx process. */
- + outl(0, nic->ioaddr + RxMissed);
- +
- + /* set_rx_mode */
- + set_rx_mode(nic);
- +
- /* Disable all known interrupts by setting the interrupt mask. */
- - outw(0, ioaddr + IntrMask);
- + outw(0, nic->ioaddr + IntrMask);
- }
-
- static void rtl_transmit(struct nic *nic, const char *destaddr,
- @@ -337,10 +370,11 @@
- unsigned int status, to, nstype;
- unsigned long txstatus;
-
- + /* nstype assignment moved up here to avoid gcc 3.0.3 compiler bug */
- + nstype = htons(type);
- memcpy(tx_buffer, destaddr, ETH_ALEN);
- memcpy(tx_buffer + ETH_ALEN, nic->node_addr, ETH_ALEN);
- - nstype = htons(type);
- - memcpy(tx_buffer + 2 * ETH_ALEN, (char*)&nstype, 2);
- + memcpy(tx_buffer + 2 * ETH_ALEN, &nstype, 2);
- memcpy(tx_buffer + ETH_HLEN, data, len);
-
- len += ETH_HLEN;
- @@ -354,22 +388,22 @@
- tx_buffer[len++] = '\0';
- }
-
- - outl((unsigned long)tx_buffer, ioaddr + TxAddr0 + cur_tx*4);
- + outl((unsigned long)virt_to_bus(tx_buffer), nic->ioaddr + TxAddr0 + cur_tx*4);
- outl(((TX_FIFO_THRESH<<11) & 0x003f0000) | len,
- - ioaddr + TxStatus0 + cur_tx*4);
- + nic->ioaddr + TxStatus0 + cur_tx*4);
-
- to = currticks() + RTL_TIMEOUT;
-
- do {
- - status = inw(ioaddr + IntrStatus);
- + status = inw(nic->ioaddr + IntrStatus);
- /* Only acknlowledge interrupt sources we can properly handle
- * here - the RxOverflow/RxFIFOOver MUST be handled in the
- * rtl_poll() function. */
- - outw(status & (TxOK | TxErr | PCIErr), ioaddr + IntrStatus);
- + outw(status & (TxOK | TxErr | PCIErr), nic->ioaddr + IntrStatus);
- if ((status & (TxOK | TxErr | PCIErr)) != 0) break;
- } while (currticks() < to);
-
- - txstatus = inl(ioaddr+ TxStatus0 + cur_tx*4);
- + txstatus = inl(nic->ioaddr+ TxStatus0 + cur_tx*4);
-
- if (status & TxOK) {
- cur_tx = (cur_tx + 1) % NUM_TX_DESC;
- @@ -386,19 +420,22 @@
- }
- }
-
- -static int rtl_poll(struct nic *nic)
- +static int rtl_poll(struct nic *nic, int retrieve)
- {
- unsigned int status;
- unsigned int ring_offs;
- unsigned int rx_size, rx_status;
-
- - if (inb(ioaddr + ChipCmd) & RxBufEmpty) {
- + if (inb(nic->ioaddr + ChipCmd) & RxBufEmpty) {
- return 0;
- }
-
- - status = inw(ioaddr + IntrStatus);
- + /* There is a packet ready */
- + if ( ! retrieve ) return 1;
- +
- + status = inw(nic->ioaddr + IntrStatus);
- /* See below for the rest of the interrupt acknowledges. */
- - outw(status & ~(RxFIFOOver | RxOverflow | RxOK), ioaddr + IntrStatus);
- + outw(status & ~(RxFIFOOver | RxOverflow | RxOK), nic->ioaddr + IntrStatus);
-
- #ifdef DEBUG_RX
- printf("rtl_poll: int %hX ", status);
- @@ -438,21 +475,77 @@
- nic->packet[12], nic->packet[13], rx_status);
- #endif
- cur_rx = (cur_rx + rx_size + 4 + 3) & ~3;
- - outw(cur_rx - 16, ioaddr + RxBufPtr);
- + outw(cur_rx - 16, nic->ioaddr + RxBufPtr);
- /* See RTL8139 Programming Guide V0.1 for the official handling of
- * Rx overflow situations. The document itself contains basically no
- * usable information, except for a few exception handling rules. */
- - outw(status & (RxFIFOOver | RxOverflow | RxOK), ioaddr + IntrStatus);
- + outw(status & (RxFIFOOver | RxOverflow | RxOK), nic->ioaddr + IntrStatus);
- return 1;
- }
-
- -static void rtl_disable(struct nic *nic)
- +static void rtl_irq(struct nic *nic, irq_action_t action)
- {
- + unsigned int mask;
- + /* Bit of a guess as to which interrupts we should allow */
- + unsigned int interested = ROK | RER | RXOVW | FOVW | SERR;
- +
- + switch ( action ) {
- + case DISABLE :
- + case ENABLE :
- + mask = inw(nic->ioaddr + IntrMask);
- + mask = mask & ~interested;
- + if ( action == ENABLE ) mask = mask | interested;
- + outw(mask, nic->ioaddr + IntrMask);
- + break;
- + case FORCE :
- + /* Apparently writing a 1 to this read-only bit of a
- + * read-only and otherwise unrelated register will
- + * force an interrupt. If you ever want to see how
- + * not to write a datasheet, read the one for the
- + * RTL8139...
- + */
- + outb(EROK, nic->ioaddr + RxEarlyStatus);
- + break;
- + }
- +}
- +
- +static void rtl_disable(struct dev *dev)
- +{
- + struct nic *nic = (struct nic *)dev;
- + /* merge reset and disable */
- + rtl_reset(nic);
- +
- /* reset the chip */
- - outb(CmdReset, ioaddr + ChipCmd);
- + outb(CmdReset, nic->ioaddr + ChipCmd);
-
- /* 10 ms timeout */
- load_timer2(10*TICKS_PER_MS);
- - while ((inb(ioaddr + ChipCmd) & CmdReset) != 0 && timer2_running())
- + while ((inb(nic->ioaddr + ChipCmd) & CmdReset) != 0 && timer2_running())
- /* wait */;
- }
- +
- +static struct pci_id rtl8139_nics[] = {
- +PCI_ROM(0x10ec, 0x8129, "rtl8129", "Realtek 8129"),
- +PCI_ROM(0x10ec, 0x8139, "rtl8139", "Realtek 8139"),
- +PCI_ROM(0x10ec, 0x8138, "rtl8139b", "Realtek 8139B"),
- +PCI_ROM(0x1186, 0x1300, "dfe538", "DFE530TX+/DFE538TX"),
- +PCI_ROM(0x1113, 0x1211, "smc1211-1", "SMC EZ10/100"),
- +PCI_ROM(0x1112, 0x1211, "smc1211", "SMC EZ10/100"),
- +PCI_ROM(0x1500, 0x1360, "delta8139", "Delta Electronics 8139"),
- +PCI_ROM(0x4033, 0x1360, "addtron8139", "Addtron Technology 8139"),
- +PCI_ROM(0x1186, 0x1340, "dfe690txd", "D-Link DFE690TXD"),
- +PCI_ROM(0x13d1, 0xab06, "fe2000vx", "AboCom FE2000VX"),
- +PCI_ROM(0x1259, 0xa117, "allied8139", "Allied Telesyn 8139"),
- +PCI_ROM(0x14ea, 0xab06, "fnw3603tx", "Planex FNW-3603-TX"),
- +PCI_ROM(0x14ea, 0xab07, "fnw3800tx", "Planex FNW-3800-TX"),
- +PCI_ROM(0xffff, 0x8139, "clone-rtl8139", "Cloned 8139"),
- +};
- +
- +struct pci_driver rtl8139_driver = {
- + .type = NIC_DRIVER,
- + .name = "RTL8139",
- + .probe = rtl8139_probe,
- + .ids = rtl8139_nics,
- + .id_count = sizeof(rtl8139_nics)/sizeof(rtl8139_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/segoff.h grub-0.97/netboot/segoff.h
- --- grub-0.97.orig/netboot/segoff.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/segoff.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,43 @@
- +/*
- + * Segment:offset types and macros
- + *
- + * Initially written by Michael Brown (mcb30).
- + */
- +
- +#ifndef SEGOFF_H
- +#define SEGOFF_H
- +
- +#include <stdint.h>
- +#include <io.h>
- +
- +/* Segment:offset structure. Note that the order within the structure
- + * is offset:segment.
- + */
- +typedef struct {
- + uint16_t offset;
- + uint16_t segment;
- +} segoff_t;
- +
- +/* For PXE stuff */
- +typedef segoff_t SEGOFF16_t;
- +
- +/* Macros for converting from virtual to segment:offset addresses,
- + * when we don't actually care which of the many isomorphic results we
- + * get.
- + */
- +#ifdef DEBUG_SEGMENT
- +uint16_t SEGMENT ( const void * const ptr ) {
- + uint32_t phys = virt_to_phys ( ptr );
- + if ( phys > 0xfffff ) {
- + printf ( "FATAL ERROR: segment address out of range\n" );
- + }
- + return phys >> 4;
- +}
- +#else
- +#define SEGMENT(x) ( virt_to_phys ( x ) >> 4 )
- +#endif
- +#define OFFSET(x) ( virt_to_phys ( x ) & 0xf )
- +#define SEGOFF(x) { OFFSET(x), SEGMENT(x) }
- +#define VIRTUAL(x,y) ( phys_to_virt ( ( ( x ) << 4 ) + ( y ) ) )
- +
- +#endif /* SEGOFF_H */
- diff -Naur grub-0.97.orig/netboot/sis900.c grub-0.97/netboot/sis900.c
- --- grub-0.97.orig/netboot/sis900.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/sis900.c 2005-08-31 20:02:38.000000000 +0000
- @@ -27,6 +27,11 @@
- /* Revision History */
-
- /*
- + 07 Dec 2003 timlegge - Enabled Multicast Support
- + 06 Dec 2003 timlegge - Fixed relocation issue in 5.2
- + 04 Jan 2002 Chien-Yu Chen, Doug Ambrisko, Marty Connor Patch to Etherboot 5.0.5
- + Added support for the SiS 630ET plus various bug fixes from linux kernel
- + source 2.4.17.
- 01 March 2001 mdc 1.0
- Initial Release. Tested with PCI based sis900 card and ThinkNIC
- computer.
- @@ -35,13 +40,12 @@
- Testet with SIS730S chipset + ICS1893
- */
-
- -
- /* Includes */
-
- #include "etherboot.h"
- #include "nic.h"
- #include "pci.h"
- -#include "cards.h"
- +#include "timer.h"
-
- #include "sis900.h"
-
- @@ -51,6 +55,7 @@
-
- static unsigned short vendor, dev_id;
- static unsigned long ioaddr;
- +static u8 pci_revision;
-
- static unsigned int cur_phy;
-
- @@ -58,15 +63,10 @@
-
- static BufferDesc txd;
- static BufferDesc rxd[NUM_RX_DESC];
- -
- -#ifdef USE_LOWMEM_BUFFER
- -#define txb ((char *)0x10000 - TX_BUF_SIZE)
- -#define rxb ((char *)0x10000 - NUM_RX_DESC*RX_BUF_SIZE - TX_BUF_SIZE)
- -#else
- static unsigned char txb[TX_BUF_SIZE];
- static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE];
- -#endif
-
- +#if 0
- static struct mac_chip_info {
- const char *name;
- u16 vendor_id, device_id, flags;
- @@ -78,11 +78,13 @@
- PCI_COMMAND_IO|PCI_COMMAND_MASTER, SIS900_TOTAL_SIZE},
- {0,0,0,0,0} /* 0 terminated list. */
- };
- +#endif
-
- static void sis900_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex);
- static void amd79c901_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex);
- static void ics1893_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex);
- static void rtl8201_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex);
- +static void vt6103_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex);
-
- static struct mii_chip_info {
- const char * name;
- @@ -96,6 +98,7 @@
- {"AMD 79C901 HomePNA PHY", 0x0000, 0x35c8, amd79c901_read_mode},
- {"ICS 1893 Integrated PHYceiver" , 0x0015, 0xf441,ics1893_read_mode},
- {"RTL 8201 10/100Mbps Phyceiver" , 0x0000, 0x8201,rtl8201_read_mode},
- + {"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode},
- {0,0,0,0}
- };
-
- @@ -106,24 +109,32 @@
- u16 status;
- } mii;
-
- -
- // PCI to ISA bridge for SIS640E access
- -static struct pci_device pci_isa_bridge_list[] = {
- +static struct pci_id pci_isa_bridge_list[] = {
- { 0x1039, 0x0008,
- - "SIS 85C503/5513 PCI to ISA bridge", 0, 0, 0, 0},
- - {0, 0, NULL, 0, 0, 0, 0}
- + "SIS 85C503/5513 PCI to ISA bridge"},
- +};
- +
- +struct pci_driver sis_bridge_driver = {
- + .type = BRIDGE_DRIVER,
- + .name = "",
- + .probe = 0,
- + .ids = pci_isa_bridge_list,
- + .id_count = sizeof(pci_isa_bridge_list)/sizeof(pci_isa_bridge_list[0]),
- + .class = 0,
- };
-
- /* Function Prototypes */
-
- -struct nic *sis900_probe(struct nic *nic, unsigned short *io_addrs, struct pci_device *pci);
- +static int sis900_probe(struct dev *dev, struct pci_device *pci);
-
- static u16 sis900_read_eeprom(int location);
- static void sis900_mdio_reset(long mdio_addr);
- static void sis900_mdio_idle(long mdio_addr);
- static u16 sis900_mdio_read(int phy_id, int location);
- +#if 0
- static void sis900_mdio_write(int phy_id, int location, int val);
- -
- +#endif
- static void sis900_init(struct nic *nic);
-
- static void sis900_reset(struct nic *nic);
- @@ -136,9 +147,11 @@
-
- static void sis900_transmit(struct nic *nic, const char *d,
- unsigned int t, unsigned int s, const char *p);
- -static int sis900_poll(struct nic *nic);
- +static int sis900_poll(struct nic *nic, int retrieve);
- +
- +static void sis900_disable(struct dev *dev);
-
- -static void sis900_disable(struct nic *nic);
- +static void sis900_irq(struct nic *nic, irq_action_t action);
-
- /**
- * sis900_get_mac_addr: - Get MAC address for stand alone SiS900 model
- @@ -149,7 +162,7 @@
- * MAC address is read from read_eeprom() into @net_dev->dev_addr.
- */
-
- -static int sis900_get_mac_addr(struct pci_device * pci_dev , struct nic *nic)
- +static int sis900_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic)
- {
- u16 signature;
- int i;
- @@ -168,6 +181,50 @@
- }
-
- /**
- + * sis96x_get_mac_addr: - Get MAC address for SiS962 or SiS963 model
- + * @pci_dev: the sis900 pci device
- + * @net_dev: the net device to get address for
- + *
- + * SiS962 or SiS963 model, use EEPROM to store MAC address. And EEPROM
- + * is shared by
- + * LAN and 1394. When access EEPROM, send EEREQ signal to hardware first
- + * and wait for EEGNT. If EEGNT is ON, EEPROM is permitted to be access
- + * by LAN, otherwise is not. After MAC address is read from EEPROM, send
- + * EEDONE signal to refuse EEPROM access by LAN.
- + * The EEPROM map of SiS962 or SiS963 is different to SiS900.
- + * The signature field in SiS962 or SiS963 spec is meaningless.
- + * MAC address is read into @net_dev->dev_addr.
- + */
- +
- +static int sis96x_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic)
- +{
- +/* long ioaddr = net_dev->base_addr; */
- + long ee_addr = ioaddr + mear;
- + u32 waittime = 0;
- + int i;
- +
- + printf("Alternate function\n");
- +
- + outl(EEREQ, ee_addr);
- + while(waittime < 2000) {
- + if(inl(ee_addr) & EEGNT) {
- +
- + /* get MAC address from EEPROM */
- + for (i = 0; i < 3; i++)
- + ((u16 *)(nic->node_addr))[i] = sis900_read_eeprom(i+EEPROMMACAddr);
- +
- + outl(EEDONE, ee_addr);
- + return 1;
- + } else {
- + udelay(1);
- + waittime ++;
- + }
- + }
- + outl(EEDONE, ee_addr);
- + return 0;
- +}
- +
- +/**
- * sis630e_get_mac_addr: - Get MAC address for SiS630E model
- * @pci_dev: the sis900 pci device
- * @net_dev: the net device to get address for
- @@ -177,17 +234,21 @@
- * MAC address is read into @net_dev->dev_addr.
- */
-
- -static int sis630e_get_mac_addr(struct pci_device * pci_dev, struct nic *nic)
- +static int sis630e_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic)
- {
- u8 reg;
- int i;
- - struct pci_device *p;
- -
- - // find PCI to ISA bridge
- - eth_pci_init(pci_isa_bridge_list);
- + struct pci_device p[1];
-
- - /* the firts entry in this list should contain bus/devfn */
- - p = pci_isa_bridge_list;
- + /* find PCI to ISA bridge */
- + memset(p, 0, sizeof(p));
- + do {
- + find_pci(BRIDGE_DRIVER, p);
- + } while(p->driver && p->driver != &sis_bridge_driver);
- +
- + /* error on failure */
- + if (!p->driver)
- + return 0;
-
- pcibios_read_config_byte(p->bus,p->devfn, 0x48, ®);
- pcibios_write_config_byte(p->bus,p->devfn, 0x48, reg | 0x40);
- @@ -201,7 +262,43 @@
-
- return 1;
- }
- -
- +
- +/**
- + * sis630e_get_mac_addr: - Get MAC address for SiS630E model
- + * @pci_dev: the sis900 pci device
- + * @net_dev: the net device to get address for
- + *
- + * SiS630E model, use APC CMOS RAM to store MAC address.
- + * APC CMOS RAM is accessed through ISA bridge.
- + * MAC address is read into @net_dev->dev_addr.
- + */
- +
- +static int sis635_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic)
- +{
- + u32 rfcrSave;
- + u32 i;
- +
- +
- + rfcrSave = inl(rfcr + ioaddr);
- +
- + outl(rfcrSave | RELOAD, ioaddr + cr);
- + outl(0, ioaddr + cr);
- +
- + /* disable packet filtering before setting filter */
- + outl(rfcrSave & ~RFEN, rfcr + ioaddr);
- +
- + /* load MAC addr to filter data register */
- + for (i = 0 ; i < 3 ; i++) {
- + outl((i << RFADDR_shift), ioaddr + rfcr);
- + *( ((u16 *)nic->node_addr) + i) = inw(ioaddr + rfdr);
- + }
- +
- + /* enable packet filitering */
- + outl(rfcrSave | RFEN, rfcr + ioaddr);
- +
- + return 1;
- +}
- +
- /*
- * Function: sis900_probe
- *
- @@ -216,19 +313,21 @@
- * Returns: struct nic *: pointer to NIC data structure
- */
-
- -struct nic *sis900_probe(struct nic *nic, unsigned short *io_addrs, struct pci_device *pci)
- +static int sis900_probe(struct dev *dev, struct pci_device *pci)
- {
- + struct nic *nic = (struct nic *)dev;
- int i;
- int found=0;
- int phy_addr;
- - u16 signature;
- u8 revision;
- int ret;
-
- - if (io_addrs == 0 || *io_addrs == 0)
- - return NULL;
- + if (pci->ioaddr == 0)
- + return 0;
-
- - ioaddr = *io_addrs & ~3;
- + nic->irqno = 0;
- + nic->ioaddr = pci->ioaddr & ~3;
- + ioaddr = pci->ioaddr & ~3;
- vendor = pci->vendor;
- dev_id = pci->dev_id;
-
- @@ -240,19 +339,29 @@
- /* get MAC address */
- ret = 0;
- pcibios_read_config_byte(pci->bus,pci->devfn, PCI_REVISION, &revision);
- - if (revision == SIS630E_900_REV || revision == SIS630EA1_900_REV)
- - ret = sis630e_get_mac_addr(pci, nic);
- - else if (revision == SIS630S_900_REV)
- +
- + /* save for use later in sis900_reset() */
- + pci_revision = revision;
- +
- + if (revision == SIS630E_900_REV)
- ret = sis630e_get_mac_addr(pci, nic);
- + else if ((revision > 0x81) && (revision <= 0x90))
- + ret = sis635_get_mac_addr(pci, nic);
- + else if (revision == SIS96x_900_REV)
- + ret = sis96x_get_mac_addr(pci, nic);
- else
- ret = sis900_get_mac_addr(pci, nic);
-
- if (ret == 0)
- {
- printf ("sis900_probe: Error MAC address not found\n");
- - return NULL;
- + return 0;
- }
-
- + /* 630ET : set the mii access mode as software-mode */
- + if (revision == SIS630ET_900_REV)
- + outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr);
- +
- printf("\nsis900_probe: MAC addr %! at ioaddr %#hX\n",
- nic->node_addr, ioaddr);
- printf("sis900_probe: Vendor:%#hX Device:%#hX\n", vendor, dev_id);
- @@ -264,7 +373,7 @@
- for (phy_addr = 0; phy_addr < 32; phy_addr++) {
- u16 mii_status;
- u16 phy_id0, phy_id1;
- -
- +
- mii_status = sis900_mdio_read(phy_addr, MII_STATUS);
- if (mii_status == 0xffff || mii_status == 0x0000)
- /* the mii is not accessable, try next one */
- @@ -272,7 +381,7 @@
-
- phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0);
- phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1);
- -
- +
- /* search our mii table for the current mii */
- for (i = 0; mii_chip_table[i].phy_id1; i++) {
-
- @@ -294,7 +403,7 @@
-
- if (found == 0) {
- printf("sis900_probe: No MII transceivers found!\n");
- - return NULL;
- + return 0;
- }
-
- /* Arbitrarily select the last PHY found as current PHY */
- @@ -304,15 +413,14 @@
- /* initialize device */
- sis900_init(nic);
-
- - nic->reset = sis900_init;
- + dev->disable = sis900_disable;
- nic->poll = sis900_poll;
- nic->transmit = sis900_transmit;
- - nic->disable = sis900_disable;
- + nic->irq = sis900_irq;
-
- - return nic;
- + return 1;
- }
-
- -
- /*
- * EEPROM Routines: These functions read and write to EEPROM for
- * retrieving the MAC address and other configuration information about
- @@ -322,7 +430,6 @@
- /* Delay between EEPROM clock transitions. */
- #define eeprom_delay() inl(ee_addr)
-
- -
- /* Function: sis900_read_eeprom
- *
- * Description: reads and returns a given location from EEPROM
- @@ -378,7 +485,6 @@
-
- #define sis900_mdio_delay() inl(mdio_addr)
-
- -
- /*
- Read and write the MII management registers using software-generated
- serial MDIO protocol. Note that the command bits and data bits are
- @@ -432,9 +538,11 @@
- outl(MDC, mdio_addr);
- sis900_mdio_delay();
- }
- + outl(0x00, mdio_addr);
- return retval;
- }
-
- +#if 0
- static void sis900_mdio_write(int phy_id, int location, int value)
- {
- long mdio_addr = ioaddr + mear;
- @@ -471,10 +579,11 @@
- outb(MDC, mdio_addr);
- sis900_mdio_delay();
- }
- + outl(0x00, mdio_addr);
- return;
- }
- +#endif
-
- -
- /* Function: sis900_init
- *
- * Description: resets the ethernet controller chip and various
- @@ -500,10 +609,9 @@
-
- sis900_check_mode(nic);
-
- - outl(RxENA, ioaddr + cr);
- + outl(RxENA| inl(ioaddr + cr), ioaddr + cr);
- }
-
- -
- /*
- * Function: sis900_reset
- *
- @@ -515,7 +623,7 @@
- */
-
- static void
- -sis900_reset(struct nic *nic)
- +sis900_reset(struct nic *nic __unused)
- {
- int i = 0;
- u32 status = TxRCMP | RxRCMP;
- @@ -524,16 +632,19 @@
- outl(0, ioaddr + imr);
- outl(0, ioaddr + rfcr);
-
- - outl(RxRESET | TxRESET | RESET, ioaddr + cr);
- -
- + outl(RxRESET | TxRESET | RESET | inl(ioaddr + cr), ioaddr + cr);
- +
- /* Check that the chip has finished the reset. */
- while (status && (i++ < 1000)) {
- status ^= (inl(isr + ioaddr) & status);
- }
- - outl(PESEL, ioaddr + cfg);
- +
- + if( (pci_revision == SIS635A_900_REV) || (pci_revision == SIS900B_900_REV) )
- + outl(PESEL | RND_CNT, ioaddr + cfg);
- + else
- + outl(PESEL, ioaddr + cfg);
- }
-
- -
- /* Function: sis_init_rxfilter
- *
- * Description: sets receive filter address to our MAC address
- @@ -552,7 +663,7 @@
- rfcrSave = inl(rfcr + ioaddr);
-
- /* disable packet filtering before setting filter */
- - outl(rfcrSave & ~RFEN, rfcr);
- + outl(rfcrSave & ~RFEN, rfcr + ioaddr);
-
- /* load MAC addr to filter data register */
- for (i = 0 ; i < 3 ; i++) {
- @@ -571,7 +682,6 @@
- outl(rfcrSave | RFEN, rfcr + ioaddr);
- }
-
- -
- /*
- * Function: sis_init_txd
- *
- @@ -583,20 +693,19 @@
- */
-
- static void
- -sis900_init_txd(struct nic *nic)
- +sis900_init_txd(struct nic *nic __unused)
- {
- txd.link = (u32) 0;
- txd.cmdsts = (u32) 0;
- - txd.bufptr = (u32) &txb[0];
- + txd.bufptr = virt_to_bus(&txb[0]);
-
- /* load Transmit Descriptor Register */
- - outl((u32) &txd, ioaddr + txdp);
- + outl(virt_to_bus(&txd), ioaddr + txdp);
- if (sis900_debug > 0)
- printf("sis900_init_txd: TX descriptor register loaded with: %X\n",
- inl(ioaddr + txdp));
- }
-
- -
- /* Function: sis_init_rxd
- *
- * Description: initializes the Rx descriptor ring
- @@ -607,7 +716,7 @@
- */
-
- static void
- -sis900_init_rxd(struct nic *nic)
- +sis900_init_rxd(struct nic *nic __unused)
- {
- int i;
-
- @@ -615,16 +724,16 @@
-
- /* init RX descriptor */
- for (i = 0; i < NUM_RX_DESC; i++) {
- - rxd[i].link = (i+1 < NUM_RX_DESC) ? (u32) &rxd[i+1] : (u32) &rxd[0];
- + rxd[i].link = virt_to_bus((i+1 < NUM_RX_DESC) ? &rxd[i+1] : &rxd[0]);
- rxd[i].cmdsts = (u32) RX_BUF_SIZE;
- - rxd[i].bufptr = (u32) &rxb[i*RX_BUF_SIZE];
- + rxd[i].bufptr = virt_to_bus(&rxb[i*RX_BUF_SIZE]);
- if (sis900_debug > 0)
- printf("sis900_init_rxd: rxd[%d]=%X link=%X cmdsts=%X bufptr=%X\n",
- i, &rxd[i], rxd[i].link, rxd[i].cmdsts, rxd[i].bufptr);
- }
-
- /* load Receive Descriptor Register */
- - outl((u32) &rxd[0], ioaddr + rxdp);
- + outl(virt_to_bus(&rxd[0]), ioaddr + rxdp);
-
- if (sis900_debug > 0)
- printf("sis900_init_rxd: RX descriptor register loaded with: %X\n",
- @@ -632,7 +741,6 @@
-
- }
-
- -
- /* Function: sis_init_rxd
- *
- * Description:
- @@ -644,25 +752,36 @@
- * Returns: void.
- */
-
- -static void sis900_set_rx_mode(struct nic *nic)
- +static void sis900_set_rx_mode(struct nic *nic __unused)
- {
- - int i;
- + int i, table_entries;
- + u32 rx_mode;
- + u16 mc_filter[16] = {0}; /* 256/128 bits multicast hash table */
- +
- + if((pci_revision == SIS635A_900_REV) || (pci_revision == SIS900B_900_REV))
- + table_entries = 16;
- + else
- + table_entries = 8;
-
- - /* Configure Multicast Hash Table in Receive Filter
- - to reject all MCAST packets */
- - for (i = 0; i < 8; i++) {
- + /* accept all multicast packet */
- + rx_mode = RFAAB | RFAAM;
- + for (i = 0; i < table_entries; i++)
- + mc_filter[i] = 0xffff;
- +
- + /* update Multicast Hash Table in Receive Filter */
- + for (i = 0; i < table_entries; i++) {
- /* why plus 0x04? That makes the correct value for hash table. */
- outl((u32)(0x00000004+i) << RFADDR_shift, ioaddr + rfcr);
- - outl((u32)(0x0), ioaddr + rfdr);
- + outl(mc_filter[i], ioaddr + rfdr);
- }
- - /* Accept Broadcast packets, destination addresses that match
- +
- + /* Accept Broadcast and multicast packets, destination addresses that match
- our MAC address */
- - outl(RFEN | RFAAB, ioaddr + rfcr);
- + outl(RFEN | rx_mode, ioaddr + rfcr);
-
- return;
- }
-
- -
- /* Function: sis900_check_mode
- *
- * Description: checks the state of transmit and receive
- @@ -674,15 +793,21 @@
- */
-
- static void
- -sis900_check_mode (struct nic *nic)
- +sis900_check_mode(struct nic *nic)
- {
- int speed, duplex;
- u32 tx_flags = 0, rx_flags = 0;
-
- mii.chip_info->read_mode(nic, cur_phy, &speed, &duplex);
-
- - tx_flags = TxATP | (TX_DMA_BURST << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift);
- - rx_flags = RX_DMA_BURST << RxMXDMA_shift;
- + if( inl(ioaddr + cfg) & EDB_MASTER_EN ) {
- + tx_flags = TxATP | (DMA_BURST_64 << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift);
- + rx_flags = DMA_BURST_64 << RxMXDMA_shift;
- + }
- + else {
- + tx_flags = TxATP | (DMA_BURST_512 << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift);
- + rx_flags = DMA_BURST_512 << RxMXDMA_shift;
- + }
-
- if (speed == HW_SPEED_HOME || speed == HW_SPEED_10_MBPS) {
- rx_flags |= (RxDRNT_10 << RxDRNT_shift);
- @@ -702,7 +827,6 @@
- outl (rx_flags, ioaddr + rxcfg);
- }
-
- -
- /* Function: sis900_read_mode
- *
- * Description: retrieves and displays speed and duplex
- @@ -714,24 +838,33 @@
- */
-
- static void
- -sis900_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex)
- +sis900_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
- {
- int i = 0;
- u32 status;
- + u16 phy_id0, phy_id1;
-
- /* STSOUT register is Latched on Transition, read operation updates it */
- while (i++ < 2)
- status = sis900_mdio_read(phy_addr, MII_STSOUT);
-
- - if (status & MII_STSOUT_SPD)
- - *speed = HW_SPEED_100_MBPS;
- - else
- - *speed = HW_SPEED_10_MBPS;
- -
- - if (status & MII_STSOUT_DPLX)
- - *duplex = FDX_CAPABLE_FULL_SELECTED;
- - else
- - *duplex = FDX_CAPABLE_HALF_SELECTED;
- + *speed = HW_SPEED_10_MBPS;
- + *duplex = FDX_CAPABLE_HALF_SELECTED;
- +
- + if (status & (MII_NWAY_TX | MII_NWAY_TX_FDX))
- + *speed = HW_SPEED_100_MBPS;
- + if (status & ( MII_NWAY_TX_FDX | MII_NWAY_T_FDX))
- + *duplex = FDX_CAPABLE_FULL_SELECTED;
- +
- + /* Workaround for Realtek RTL8201 PHY issue */
- + phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0);
- + phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1);
- + if((phy_id0 == 0x0000) && ((phy_id1 & 0xFFF0) == 0x8200)){
- + if(sis900_mdio_read(phy_addr, MII_CONTROL) & MII_CNTL_FDX)
- + *duplex = FDX_CAPABLE_FULL_SELECTED;
- + if(sis900_mdio_read(phy_addr, 0x0019) & 0x01)
- + *speed = HW_SPEED_100_MBPS;
- + }
-
- if (status & MII_STSOUT_LINK_FAIL)
- printf("sis900_read_mode: Media Link Off\n");
- @@ -743,7 +876,6 @@
- "full" : "half");
- }
-
- -
- /* Function: amd79c901_read_mode
- *
- * Description: retrieves and displays speed and duplex
- @@ -755,7 +887,7 @@
- */
-
- static void
- -amd79c901_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex)
- +amd79c901_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
- {
- int i;
- u16 status;
- @@ -796,7 +928,6 @@
- }
- }
-
- -
- /**
- * ics1893_read_mode: - read media mode for ICS1893 PHY
- * @net_dev: the net device to read mode for
- @@ -808,7 +939,7 @@
- * to determine the speed and duplex mode for sis900
- */
-
- -static void ics1893_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex)
- +static void ics1893_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
- {
- int i = 0;
- u32 status;
- @@ -848,7 +979,7 @@
- * to determine the speed and duplex mode for sis900
- */
-
- -static void rtl8201_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex)
- +static void rtl8201_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
- {
- u32 status;
-
- @@ -878,7 +1009,51 @@
- *duplex == FDX_CAPABLE_FULL_SELECTED ?
- "full" : "half");
- else
- - printf("rtl9201_read_config_mode: Media Link Off\n");
- + printf("rtl8201_read_config_mode: Media Link Off\n");
- +}
- +
- +/**
- + * vt6103_read_mode: - read media mode for vt6103 phy
- + * @nic: the net device to read mode for
- + * @phy_addr: mii phy address
- + * @speed: the transmit speed to be determined
- + * @duplex: the duplex mode to be determined
- + *
- + * read MII_STATUS register from rtl8201 phy
- + * to determine the speed and duplex mode for sis900
- + */
- +
- +static void vt6103_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
- +{
- + u32 status;
- +
- + status = sis900_mdio_read(phy_addr, MII_STATUS);
- +
- + if (status & MII_STAT_CAN_TX_FDX) {
- + *speed = HW_SPEED_100_MBPS;
- + *duplex = FDX_CAPABLE_FULL_SELECTED;
- + }
- + else if (status & MII_STAT_CAN_TX) {
- + *speed = HW_SPEED_100_MBPS;
- + *duplex = FDX_CAPABLE_HALF_SELECTED;
- + }
- + else if (status & MII_STAT_CAN_T_FDX) {
- + *speed = HW_SPEED_10_MBPS;
- + *duplex = FDX_CAPABLE_FULL_SELECTED;
- + }
- + else if (status & MII_STAT_CAN_T) {
- + *speed = HW_SPEED_10_MBPS;
- + *duplex = FDX_CAPABLE_HALF_SELECTED;
- + }
- +
- + if (status & MII_STAT_LINK)
- + printf("vt6103_read_mode: Media Link On %s %s-duplex \n",
- + *speed == HW_SPEED_100_MBPS ?
- + "100mbps" : "10mbps",
- + *duplex == FDX_CAPABLE_FULL_SELECTED ?
- + "full" : "half");
- + else
- + printf("vt6103_read_config_mode: Media Link Off\n");
- }
-
- /* Function: sis900_transmit
- @@ -900,14 +1075,14 @@
- unsigned int s, /* size */
- const char *p) /* Packet */
- {
- - u32 status, to, nstype;
- + u32 to, nstype;
- u32 tx_status;
-
- /* Stop the transmitter */
- - outl(TxDIS, ioaddr + cr);
- + outl(TxDIS | inl(ioaddr + cr), ioaddr + cr);
-
- /* load Transmit Descriptor Register */
- - outl((u32) &txd, ioaddr + txdp);
- + outl(virt_to_bus(&txd), ioaddr + txdp);
- if (sis900_debug > 1)
- printf("sis900_transmit: TX descriptor register loaded with: %X\n",
- inl(ioaddr + txdp));
- @@ -929,18 +1104,18 @@
- txb[s++] = '\0';
-
- /* set the transmit buffer descriptor and enable Transmit State Machine */
- - txd.bufptr = (u32) &txb[0];
- + txd.bufptr = virt_to_bus(&txb[0]);
- txd.cmdsts = (u32) OWN | s;
-
- /* restart the transmitter */
- - outl(TxENA, ioaddr + cr);
- + outl(TxENA | inl(ioaddr + cr), ioaddr + cr);
-
- if (sis900_debug > 1)
- printf("sis900_transmit: Queued Tx packet size %d.\n", (int) s);
-
- to = currticks() + TX_TIMEOUT;
-
- - while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() < to))
- + while ((volatile u32) ( tx_status=txd.cmdsts & OWN) && (currticks() < to))
- /* wait */ ;
-
- if (currticks() >= to) {
- @@ -955,7 +1130,6 @@
- outl(0, ioaddr + imr);
- }
-
- -
- /* Function: sis900_poll
- *
- * Description: checks for a received packet and returns it if found.
- @@ -971,7 +1145,7 @@
- */
-
- static int
- -sis900_poll(struct nic *nic)
- +sis900_poll(struct nic *nic, int retrieve)
- {
- u32 rx_status = rxd[cur_rx].cmdsts;
- int retstat = 0;
- @@ -986,6 +1160,8 @@
- printf("sis900_poll: got a packet: cur_rx:%d, status:%X\n",
- cur_rx, rx_status);
-
- + if ( ! retrieve ) return 1;
- +
- nic->packetlen = (rx_status & DSIZE) - CRC_SIZE;
-
- if (rx_status & (ABORT|OVERRUN|TOOLONG|RUNT|RXISERR|CRCERR|FAERR)) {
- @@ -1001,18 +1177,18 @@
-
- /* return the descriptor and buffer to receive ring */
- rxd[cur_rx].cmdsts = RX_BUF_SIZE;
- - rxd[cur_rx].bufptr = (u32) &rxb[cur_rx*RX_BUF_SIZE];
- + rxd[cur_rx].bufptr = virt_to_bus(&rxb[cur_rx*RX_BUF_SIZE]);
-
- if (++cur_rx == NUM_RX_DESC)
- cur_rx = 0;
-
- /* re-enable the potentially idle receive state machine */
- - outl(RxENA , ioaddr + cr);
- + outl(RxENA | inl(ioaddr + cr), ioaddr + cr);
-
- return retstat;
- +
- }
-
- -
- /* Function: sis900_disable
- *
- * Description: Turns off interrupts and stops Tx and Rx engines
- @@ -1023,12 +1199,53 @@
- */
-
- static void
- -sis900_disable(struct nic *nic)
- +sis900_disable(struct dev *dev)
- {
- + struct nic *nic = (struct nic *)dev;
- + /* merge reset and disable */
- + sis900_init(nic);
- +
- /* Disable interrupts by clearing the interrupt mask. */
- outl(0, ioaddr + imr);
- outl(0, ioaddr + ier);
-
- /* Stop the chip's Tx and Rx Status Machine */
- - outl(RxDIS | TxDIS, ioaddr + cr);
- + outl(RxDIS | TxDIS | inl(ioaddr + cr), ioaddr + cr);
- +}
- +
- +/* Function: sis900_irq
- + *
- + * Description: Enable, Disable, or Force, interrupts
- + *
- + * Arguments: struct nic *nic: NIC data structure
- + * irq_action_t action: Requested action
- + *
- + * Returns: void.
- + */
- +
- +static void
- +sis900_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- }
- +
- +static struct pci_id sis900_nics[] = {
- +PCI_ROM(0x1039, 0x0900, "sis900", "SIS900"),
- +PCI_ROM(0x1039, 0x7016, "sis7016", "SIS7016"),
- +};
- +
- +struct pci_driver sis900_driver = {
- + .type = NIC_DRIVER,
- + .name = "SIS900",
- + .probe = sis900_probe,
- + .ids = sis900_nics,
- + .id_count = sizeof(sis900_nics)/sizeof(sis900_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/sis900.h grub-0.97/netboot/sis900.h
- --- grub-0.97.orig/netboot/sis900.h 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/sis900.h 2005-08-31 19:03:35.000000000 +0000
- @@ -39,14 +39,16 @@
-
- /* Symbolic names for bits in various registers */
- enum sis900_command_register_bits {
- - RESET = 0x00000100,
- - SWI = 0x00000080,
- - RxRESET = 0x00000020,
- - TxRESET = 0x00000010,
- - RxDIS = 0x00000008,
- - RxENA = 0x00000004,
- - TxDIS = 0x00000002,
- - TxENA = 0x00000001
- + RELOAD = 0x00000400,
- + ACCESSMODE = 0x00000200,
- + RESET = 0x00000100,
- + SWI = 0x00000080,
- + RxRESET = 0x00000020,
- + TxRESET = 0x00000010,
- + RxDIS = 0x00000008,
- + RxENA = 0x00000004,
- + TxDIS = 0x00000002,
- + TxENA = 0x00000001
- };
-
- enum sis900_configuration_register_bits {
- @@ -57,7 +59,10 @@
- EXD = 0x00000010,
- PESEL = 0x00000008,
- LPM = 0x00000004,
- - BEM = 0x00000001
- + BEM = 0x00000001,
- + RND_CNT = 0x00000400,
- + FAIR_BACKOFF = 0x00000200,
- + EDB_MASTER_EN = 0x00002000
- };
-
- enum sis900_eeprom_access_reigster_bits {
- @@ -108,6 +113,10 @@
- #define TX_DMA_BURST 0
- #define RX_DMA_BURST 0
-
- +enum sis900_tx_rx_dma{
- + DMA_BURST_512 = 0, DMA_BURST_64 = 5
- +};
- +
- /* transmit FIFO threshholds */
- #define TX_FILL_THRESH 16 /* 1/4 FIFO size */
- #define TxFILLT_shift 8
- @@ -172,6 +181,11 @@
- EEeraseAll = 0x0120,
- EEwriteAll = 0x0110,
- EEaddrMask = 0x013F,
- + EEcmdShift = 16
- +};
- +/* For SiS962 or SiS963, request the eeprom software access */
- +enum sis96x_eeprom_command {
- + EEREQ = 0x00000400, EEDONE = 0x00000200, EEGNT = 0x00000100
- };
-
- /* Manamgement Data I/O (mdio) frame */
- @@ -236,7 +250,8 @@
- MII_CONFIG1 = 0x0010,
- MII_CONFIG2 = 0x0011,
- MII_STSOUT = 0x0012,
- - MII_MASK = 0x0013
- + MII_MASK = 0x0013,
- + MII_RESV = 0x0014
- };
-
- /* mii registers specific to AMD 79C901 */
- @@ -320,7 +335,9 @@
-
- enum sis900_revision_id {
- SIS630A_900_REV = 0x80, SIS630E_900_REV = 0x81,
- - SIS630S_900_REV = 0x82, SIS630EA1_900_REV = 0x83
- + SIS630S_900_REV = 0x82, SIS630EA1_900_REV = 0x83,
- + SIS630ET_900_REV = 0x84, SIS635A_900_REV = 0x90,
- + SIS96x_900_REV = 0X91, SIS900B_900_REV = 0x03
- };
-
- enum sis630_revision_id {
- diff -Naur grub-0.97.orig/netboot/sis900.txt grub-0.97/netboot/sis900.txt
- --- grub-0.97.orig/netboot/sis900.txt 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/sis900.txt 1970-01-01 00:00:00.000000000 +0000
- @@ -1,91 +0,0 @@
- -How I added the SIS900 card to Etherboot
- -
- -Author: Marty Connor (mdc@thinguin.org)
- -
- -Date: 25 Febrary 2001
- -
- -Description:
- -
- -This file is intended to help people who want to write an Etherboot
- -driver or port another driver to Etherboot. It is a starting point.
- -Perhaps someday I may write a more detailed description of writing an
- -Etherboot driver. This text should help get people started, and
- -studying sis900.[ch] should help show the basic structure and
- -techniques involved in writing and Etherboot driver.
- -
- -***********************************************************************
- -
- -0. Back up all the files I need to modify:
- -
- -cd etherboot-4.7.20/src
- -cp Makefile Makefile.orig
- -cp config.c config.c.orig
- -cp pci.h pci.h.orig
- -cp NIC NIC.orig
- -cp cards.h cards.h.orig
- -
- -1. Edit src/Makefile to add SIS900FLAGS to defines
- -
- -SIS900FLAGS= -DINCLUDE_SIS900
- -
- -2. edit src/pci.h to add PCI signatures for card
- -
- -#define PCI_VENDOR_ID_SIS 0x1039
- -#define PCI_DEVICE_ID_SIS900 0x0900
- -#define PCI_DEVICE_ID_SIS7016 0x7016
- -
- -3. Edit src/config.c to add the card to the card probe list
- -
- -#if defined(INCLUDE_NS8390) || defined(INCLUDE_EEPRO100) ||
- - defined(INCLUDE_LANCE) || defined(INCLUDE_EPIC100) ||
- - defined(INCLUDE_TULIP) || defined(INCLUDE_OTULIP) ||
- - defined(INCLUDE_3C90X) || defined(INCLUDE_3C595) ||
- - defined(INCLUDE_RTL8139) || defined(INCLUDE_VIA_RHINE) ||
- - defined(INCLUDE_SIS900) || defined(INCLUDE_W89C840)
- -
- -... and ...
- -
- -#ifdef INCLUDE_SIS900
- - { PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS900,
- - "SIS900", 0, 0, 0, 0},
- - { PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS7016,
- - "SIS7016", 0, 0, 0, 0},
- -#endif
- -
- -... and ...
- -
- -#ifdef INCLUDE_SIS900
- - { "SIS900", sis900_probe, pci_ioaddrs },
- -#endif
- -
- -4. Edit NIC to add sis900 and sis7016 to NIC list
- -
- -# SIS 900 and SIS 7016
- -sis900 sis900 0x1039,0x0900
- -sis7016 sis900 0x1039,0x7016
- -
- -5. Edit cards.h to add sis900 probe routine declaration
- -
- -#ifdef INCLUDE_SIS900
- -extern struct nic *sis900_probe(struct nic *, unsigned short *
- - PCI_ARG(struct pci_device *));
- -#endif
- -
- -***********************************************************************
- -
- -At this point, you can begin creating your driver source file. See
- -the "Writing and Etherboot Driver" section of the Etherboot
- -documentation for some hints. See the skel.c file for a starting
- -point. If there is a Linux driver for the card, you may be able to
- -use that. Copy and learn from existing Etherboot drivers (this is GPL
- -/ Open Source software!).
- -
- -Join the etherboot-developers and etherboot-users mailing lists
- -(information is on etherboot.sourceforge.net) for information and
- -assistance. We invite more developers to help improve Etherboot.
- -
- -Visit the http://etherboot.sourceforge.net, http://thinguin.org,
- -http://rom-o-matic.net, and http://ltsp.org sites for information and
- -assistance.
- -
- -Enjoy.
- diff -Naur grub-0.97.orig/netboot/sk_g16.c grub-0.97/netboot/sk_g16.c
- --- grub-0.97.orig/netboot/sk_g16.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/sk_g16.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,1160 +0,0 @@
- -/**************************************************************************
- -Etherboot - BOOTP/TFTP Bootstrap Program
- -Schneider & Koch G16 NIC driver for Etherboot
- -heavily based on SK G16 driver from Linux 2.0.36
- -Changes to make it work with Etherboot by Georg Baum <Georg.Baum@gmx.de>
- -***************************************************************************/
- -
- -/*-
- - * Copyright (C) 1994 by PJD Weichmann & SWS Bern, Switzerland
- - *
- - * This software may be used and distributed according to the terms
- - * of the GNU Public License, incorporated herein by reference.
- - *
- - * Module : sk_g16.c
- - *
- - * Version : $Revision: 1.4 $
- - *
- - * Author : Patrick J.D. Weichmann
- - *
- - * Date Created : 94/05/26
- - * Last Updated : $Date: 2002/01/02 21:56:40 $
- - *
- - * Description : Schneider & Koch G16 Ethernet Device Driver for
- - * Linux Kernel >= 1.1.22
- - * Update History :
- - *
- --*/
- -
- -/*
- - * The Schneider & Koch (SK) G16 Network device driver is based
- - * on the 'ni6510' driver from Michael Hipp which can be found at
- - * ftp://sunsite.unc.edu/pub/Linux/system/Network/drivers/nidrivers.tar.gz
- - *
- - * Sources: 1) ni6510.c by M. Hipp
- - * 2) depca.c by D.C. Davies
- - * 3) skeleton.c by D. Becker
- - * 4) Am7990 Local Area Network Controller for Ethernet (LANCE),
- - * AMD, Pub. #05698, June 1989
- - *
- - * Many Thanks for helping me to get things working to:
- - *
- - * A. Cox (A.Cox@swansea.ac.uk)
- - * M. Hipp (mhipp@student.uni-tuebingen.de)
- - * R. Bolz (Schneider & Koch, Germany)
- - *
- - * See README.sk_g16 for details about limitations and bugs for the
- - * current version.
- - *
- - * To Do:
- - * - Support of SK_G8 and other SK Network Cards.
- - * - Autoset memory mapped RAM. Check for free memory and then
- - * configure RAM correctly.
- - * - SK_close should really set card in to initial state.
- - * - Test if IRQ 3 is not switched off. Use autoirq() functionality.
- - * (as in /drivers/net/skeleton.c)
- - * - Implement Multicast addressing. At minimum something like
- - * in depca.c.
- - * - Redo the statistics part.
- - * - Try to find out if the board is in 8 Bit or 16 Bit slot.
- - * If in 8 Bit mode don't use IRQ 11.
- - * - (Try to make it slightly faster.)
- - */
- -
- -/* to get some global routines like printf */
- -#include "etherboot.h"
- -/* to get the interface to the body of the program */
- -#include "nic.h"
- -
- -/* From linux/if_ether.h: */
- -#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */
- -
- -#include "sk_g16.h"
- -
- -/*
- - * Schneider & Koch Card Definitions
- - * =================================
- - */
- -
- -#define SK_NAME "SK_G16"
- -
- -/*
- - * SK_G16 Configuration
- - * --------------------
- - */
- -
- -/*
- - * Abbreviations
- - * -------------
- - *
- - * RAM - used for the 16KB shared memory
- - * Boot_ROM, ROM - are used for referencing the BootEPROM
- - *
- - * SK_ADDR is a symbolic constant used to configure
- - * the behaviour of the driver and the SK_G16.
- - *
- - * SK_ADDR defines the address where the RAM will be mapped into the real
- - * host memory.
- - * valid addresses are from 0xa0000 to 0xfc000 in 16Kbyte steps.
- - */
- -
- -#define SK_ADDR 0xcc000
- -
- -/*
- - * In POS3 are bits A14-A19 of the address bus. These bits can be set
- - * to choose the RAM address. That's why we only can choose the RAM address
- - * in 16KB steps.
- - */
- -
- -#define POS_ADDR (rom_addr>>14) /* Do not change this line */
- -
- -/*
- - * SK_G16 I/O PORT's + IRQ's + Boot_ROM locations
- - * ----------------------------------------------
- - */
- -
- -/*
- - * As nearly every card has also SK_G16 a specified I/O Port region and
- - * only a few possible IRQ's.
- - * In the Installation Guide from Schneider & Koch is listed a possible
- - * Interrupt IRQ2. IRQ2 is always IRQ9 in boards with two cascaded interrupt
- - * controllers. So we use in SK_IRQS IRQ9.
- - */
- -
- -/* Don't touch any of the following #defines. */
- -
- -#define SK_IO_PORTS { 0x100, 0x180, 0x208, 0x220, 0x288, 0x320, 0x328, 0x390, 0 }
- -
- -/*
- - * SK_G16 POS REGISTERS
- - * --------------------
- - */
- -
- -/*
- - * SK_G16 has a Programmable Option Select (POS) Register.
- - * The POS is composed of 8 separate registers (POS0-7) which
- - * are I/O mapped on an address set by the W1 switch.
- - *
- - */
- -
- -#define SK_POS_SIZE 8 /* 8 I/O Ports are used by SK_G16 */
- -
- -#define SK_POS0 ioaddr /* Card-ID Low (R) */
- -#define SK_POS1 ioaddr+1 /* Card-ID High (R) */
- -#define SK_POS2 ioaddr+2 /* Card-Enable, Boot-ROM Disable (RW) */
- -#define SK_POS3 ioaddr+3 /* Base address of RAM */
- -#define SK_POS4 ioaddr+4 /* IRQ */
- -
- -/* POS5 - POS7 are unused */
- -
- -/*
- - * SK_G16 MAC PREFIX
- - * -----------------
- - */
- -
- -/*
- - * Scheider & Koch manufacturer code (00:00:a5).
- - * This must be checked, that we are sure it is a SK card.
- - */
- -
- -#define SK_MAC0 0x00
- -#define SK_MAC1 0x00
- -#define SK_MAC2 0x5a
- -
- -/*
- - * SK_G16 ID
- - * ---------
- - */
- -
- -/*
- - * If POS0,POS1 contain the following ID, then we know
- - * at which I/O Port Address we are.
- - */
- -
- -#define SK_IDLOW 0xfd
- -#define SK_IDHIGH 0x6a
- -
- -
- -/*
- - * LANCE POS Bit definitions
- - * -------------------------
- - */
- -
- -#define SK_ROM_RAM_ON (POS2_CARD)
- -#define SK_ROM_RAM_OFF (POS2_EPROM)
- -#define SK_ROM_ON (inb(SK_POS2) & POS2_CARD)
- -#define SK_ROM_OFF (inb(SK_POS2) | POS2_EPROM)
- -#define SK_RAM_ON (inb(SK_POS2) | POS2_CARD)
- -#define SK_RAM_OFF (inb(SK_POS2) & POS2_EPROM)
- -
- -#define POS2_CARD 0x0001 /* 1 = SK_G16 on 0 = off */
- -#define POS2_EPROM 0x0002 /* 1 = Boot EPROM off 0 = on */
- -
- -/*
- - * SK_G16 Memory mapped Registers
- - * ------------------------------
- - *
- - */
- -
- -#define SK_IOREG (board->ioreg) /* LANCE data registers. */
- -#define SK_PORT (board->port) /* Control, Status register */
- -#define SK_IOCOM (board->iocom) /* I/O Command */
- -
- -/*
- - * SK_G16 Status/Control Register bits
- - * -----------------------------------
- - *
- - * (C) Controlreg (S) Statusreg
- - */
- -
- -/*
- - * Register transfer: 0 = no transfer
- - * 1 = transferring data between LANCE and I/O reg
- - */
- -#define SK_IORUN 0x20
- -
- -/*
- - * LANCE interrupt: 0 = LANCE interrupt occurred
- - * 1 = no LANCE interrupt occurred
- - */
- -#define SK_IRQ 0x10
- -
- -#define SK_RESET 0x08 /* Reset SK_CARD: 0 = RESET 1 = normal */
- -#define SK_RW 0x02 /* 0 = write to 1 = read from */
- -#define SK_ADR 0x01 /* 0 = REG DataPort 1 = RAP Reg addr port */
- -
- -
- -#define SK_RREG SK_RW /* Transferdirection to read from lance */
- -#define SK_WREG 0 /* Transferdirection to write to lance */
- -#define SK_RAP SK_ADR /* Destination Register RAP */
- -#define SK_RDATA 0 /* Destination Register REG DataPort */
- -
- -/*
- - * SK_G16 I/O Command
- - * ------------------
- - */
- -
- -/*
- - * Any bitcombination sets the internal I/O bit (transfer will start)
- - * when written to I/O Command
- - */
- -
- -#define SK_DOIO 0x80 /* Do Transfer */
- -
- -/*
- - * LANCE RAP (Register Address Port).
- - * ---------------------------------
- - */
- -
- -/*
- - * The LANCE internal registers are selected through the RAP.
- - * The Registers are:
- - *
- - * CSR0 - Status and Control flags
- - * CSR1 - Low order bits of initialize block (bits 15:00)
- - * CSR2 - High order bits of initialize block (bits 07:00, 15:08 are reserved)
- - * CSR3 - Allows redefinition of the Bus Master Interface.
- - * This register must be set to 0x0002, which means BSWAP = 0,
- - * ACON = 1, BCON = 0;
- - *
- - */
- -
- -#define CSR0 0x00
- -#define CSR1 0x01
- -#define CSR2 0x02
- -#define CSR3 0x03
- -
- -/*
- - * General Definitions
- - * ===================
- - */
- -
- -/*
- - * Set the number of Tx and Rx buffers, using Log_2(# buffers).
- - * We have 16KB RAM which can be accessed by the LANCE. In the
- - * memory are not only the buffers but also the ring descriptors and
- - * the initialize block.
- - * Don't change anything unless you really know what you do.
- - */
- -
- -#define LC_LOG_TX_BUFFERS 1 /* (2 == 2^^1) 2 Transmit buffers */
- -#define LC_LOG_RX_BUFFERS 2 /* (8 == 2^^3) 8 Receive buffers */
- -
- -/* Descriptor ring sizes */
- -
- -#define TMDNUM (1 << (LC_LOG_TX_BUFFERS)) /* 2 Transmit descriptor rings */
- -#define RMDNUM (1 << (LC_LOG_RX_BUFFERS)) /* 8 Receive Buffers */
- -
- -/* Define Mask for setting RMD, TMD length in the LANCE init_block */
- -
- -#define TMDNUMMASK (LC_LOG_TX_BUFFERS << 29)
- -#define RMDNUMMASK (LC_LOG_RX_BUFFERS << 29)
- -
- -/*
- - * Data Buffer size is set to maximum packet length.
- - */
- -
- -#define PKT_BUF_SZ 1518
- -
- -/*
- - * The number of low I/O ports used by the ethercard.
- - */
- -
- -#define ETHERCARD_TOTAL_SIZE SK_POS_SIZE
- -
- -/*
- - * Portreserve is there to mark the Card I/O Port region as used.
- - * Check_region is to check if the region at ioaddr with the size "size"
- - * is free or not.
- - * Snarf_region allocates the I/O Port region.
- - */
- -
- -#ifndef HAVE_PORTRESERVE
- -
- -#define check_region(ioaddr1, size) 0
- -#define request_region(ioaddr1, size,name) do ; while (0)
- -
- -#endif
- -
- -/*
- - * SK_DEBUG
- - *
- - * Here you can choose what level of debugging wanted.
- - *
- - * If SK_DEBUG and SK_DEBUG2 are undefined, then only the
- - * necessary messages will be printed.
- - *
- - * If SK_DEBUG is defined, there will be many debugging prints
- - * which can help to find some mistakes in configuration or even
- - * in the driver code.
- - *
- - * If SK_DEBUG2 is defined, many many messages will be printed
- - * which normally you don't need. I used this to check the interrupt
- - * routine.
- - *
- - * (If you define only SK_DEBUG2 then only the messages for
- - * checking interrupts will be printed!)
- - *
- - * Normal way of live is:
- - *
- - * For the whole thing get going let both symbolic constants
- - * undefined. If you face any problems and you know what's going
- - * on (you know something about the card and you can interpret some
- - * hex LANCE register output) then define SK_DEBUG
- - *
- - */
- -
- -#undef SK_DEBUG /* debugging */
- -#undef SK_DEBUG2 /* debugging with more verbose report */
- -
- -#ifdef SK_DEBUG
- -#define PRINTF(x) printf x
- -#else
- -#define PRINTF(x) /**/
- -#endif
- -
- -#ifdef SK_DEBUG2
- -#define PRINTF2(x) printf x
- -#else
- -#define PRINTF2(x) /**/
- -#endif
- -
- -/*
- - * SK_G16 RAM
- - *
- - * The components are memory mapped and can be set in a region from
- - * 0x00000 through 0xfc000 in 16KB steps.
- - *
- - * The Network components are: dual ported RAM, Prom, I/O Reg, Status-,
- - * Controlregister and I/O Command.
- - *
- - * dual ported RAM: This is the only memory region which the LANCE chip
- - * has access to. From the Lance it is addressed from 0x0000 to
- - * 0x3fbf. The host accesses it normally.
- - *
- - * PROM: The PROM obtains the ETHERNET-MAC-Address. It is realised as a
- - * 8-Bit PROM, this means only the 16 even addresses are used of the
- - * 32 Byte Address region. Access to a odd address results in invalid
- - * data.
- - *
- - * LANCE I/O Reg: The I/O Reg is build of 4 single Registers, Low-Byte Write,
- - * Hi-Byte Write, Low-Byte Read, Hi-Byte Read.
- - * Transfer from or to the LANCE is always in 16Bit so Low and High
- - * registers are always relevant.
- - *
- - * The Data from the Readregister is not the data in the Writeregister!!
- - *
- - * Port: Status- and Controlregister.
- - * Two different registers which share the same address, Status is
- - * read-only, Control is write-only.
- - *
- - * I/O Command:
- - * Any bitcombination written in here starts the transmission between
- - * Host and LANCE.
- - */
- -
- -typedef struct
- -{
- - unsigned char ram[0x3fc0]; /* 16KB dual ported ram */
- - unsigned char rom[0x0020]; /* 32Byte PROM containing 6Byte MAC */
- - unsigned char res1[0x0010]; /* reserved */
- - unsigned volatile short ioreg;/* LANCE I/O Register */
- - unsigned volatile char port; /* Statusregister and Controlregister */
- - unsigned char iocom; /* I/O Command Register */
- -} SK_RAM;
- -
- -/* struct */
- -
- -/*
- - * This is the structure for the dual ported ram. We
- - * have exactly 16 320 Bytes. In here there must be:
- - *
- - * - Initialize Block (starting at a word boundary)
- - * - Receive and Transmit Descriptor Rings (quadword boundary)
- - * - Data Buffers (arbitrary boundary)
- - *
- - * This is because LANCE has on SK_G16 only access to the dual ported
- - * RAM and nowhere else.
- - */
- -
- -struct SK_ram
- -{
- - struct init_block ib;
- - struct tmd tmde[TMDNUM];
- - struct rmd rmde[RMDNUM];
- - char tmdbuf[TMDNUM][PKT_BUF_SZ];
- - char rmdbuf[RMDNUM][PKT_BUF_SZ];
- -};
- -
- -/*
- - * Structure where all necessary information is for ring buffer
- - * management and statistics.
- - */
- -
- -struct priv
- -{
- - struct SK_ram *ram; /* dual ported ram structure */
- - struct rmd *rmdhead; /* start of receive ring descriptors */
- - struct tmd *tmdhead; /* start of transmit ring descriptors */
- - int rmdnum; /* actual used ring descriptor */
- - int tmdnum; /* actual transmit descriptor for transmitting data */
- - int tmdlast; /* last sent descriptor used for error handling, etc */
- - void *rmdbufs[RMDNUM]; /* pointer to the receive buffers */
- - void *tmdbufs[TMDNUM]; /* pointer to the transmit buffers */
- -};
- -
- -/* global variable declaration */
- -
- -/* static variables */
- -
- -static SK_RAM *board; /* pointer to our memory mapped board components */
- -static unsigned short ioaddr; /* base io address */
- -static struct priv p_data;
- -
- -/* Macros */
- -
- -
- -/* Function Prototypes */
- -
- -/*
- - * Device Driver functions
- - * -----------------------
- - * See for short explanation of each function its definitions header.
- - */
- -
- -static int SK_probe1(struct nic *nic, short ioaddr1);
- -
- -static void SK_reset(struct nic *nic);
- -static int SK_poll(struct nic *nic);
- -static void SK_transmit(
- -struct nic *nic,
- -const char *d, /* Destination */
- -unsigned int t, /* Type */
- -unsigned int s, /* size */
- -const char *p); /* Packet */
- -static void SK_disable(struct nic *nic);
- -struct nic *SK_probe(struct nic *nic, unsigned short *probe_addrs);
- -
- -/*
- - * LANCE Functions
- - * ---------------
- - */
- -
- -static int SK_lance_init(struct nic *nic, unsigned short mode);
- -static void SK_reset_board(void);
- -static void SK_set_RAP(int reg_number);
- -static int SK_read_reg(int reg_number);
- -static int SK_rread_reg(void);
- -static void SK_write_reg(int reg_number, int value);
- -
- -/*
- - * Debugging functions
- - * -------------------
- - */
- -
- -static void SK_print_pos(struct nic *nic, char *text);
- -static void SK_print_ram(struct nic *nic);
- -
- -
- -/**************************************************************************
- -RESET - Reset adapter
- -***************************************************************************/
- -static void SK_reset(struct nic *nic)
- -{
- - /* put the card in its initial state */
- - SK_lance_init(nic, MODE_NORMAL);
- -}
- -
- -/**************************************************************************
- -POLL - Wait for a frame
- -***************************************************************************/
- -static int SK_poll(struct nic *nic)
- -{
- - /* return true if there's an ethernet packet ready to read */
- - struct priv *p; /* SK_G16 private structure */
- - struct rmd *rmdp;
- - int csr0, rmdstat, packet_there;
- - PRINTF2(("## %s: At beginning of SK_poll(). CSR0: %#hX\n",
- - SK_NAME, SK_read_reg(CSR0)));
- -
- - p = nic->priv_data;
- - csr0 = SK_read_reg(CSR0); /* store register for checking */
- -
- - /*
- - * Acknowledge all of the current interrupt sources, disable
- - * Interrupts (INEA = 0)
- - */
- -
- - SK_write_reg(CSR0, csr0 & CSR0_CLRALL);
- -
- - if (csr0 & CSR0_ERR) /* LANCE Error */
- - {
- - printf("%s: error: %#hX", SK_NAME, csr0);
- -
- - if (csr0 & CSR0_MISS) /* No place to store packet ? */
- - {
- - printf(", Packet dropped.");
- - }
- - putchar('\n');
- - }
- -
- - rmdp = p->rmdhead + p->rmdnum;
- - packet_there = 0;
- - /* As long as we own the next entry, check status and send
- - * it up to higher layer
- - */
- -
- - while (!( (rmdstat = rmdp->u.s.status) & RX_OWN))
- - {
- - /*
- - * Start and end of packet must be set, because we use
- - * the ethernet maximum packet length (1518) as buffer size.
- - *
- - * Because our buffers are at maximum OFLO and BUFF errors are
- - * not to be concerned (see Data sheet)
- - */
- -
- - if ((rmdstat & (RX_STP | RX_ENP)) != (RX_STP | RX_ENP))
- - {
- - /* Start of a frame > 1518 Bytes ? */
- -
- - if (rmdstat & RX_STP)
- - {
- - printf("%s: packet too long\n", SK_NAME);
- - }
- -
- - /*
- - * All other packets will be ignored until a new frame with
- - * start (RX_STP) set follows.
- - *
- - * What we do is just give descriptor free for new incoming
- - * packets.
- - */
- -
- - rmdp->u.s.status = RX_OWN; /* Relinquish ownership to LANCE */
- -
- - }
- - else if (rmdstat & RX_ERR) /* Receive Error ? */
- - {
- - printf("%s: RX error: %#hX\n", SK_NAME, (int) rmdstat);
- - rmdp->u.s.status = RX_OWN; /* Relinquish ownership to LANCE */
- - }
- - else /* We have a packet which can be queued for the upper layers */
- - {
- -
- - int len = (rmdp->mlen & 0x0fff); /* extract message length from receive buffer */
- -
- - /*
- - * Copy data out of our receive descriptor into nic->packet.
- - *
- - * (rmdp->u.buffer & 0x00ffffff) -> get address of buffer and
- - * ignore status fields)
- - */
- -
- - memcpy(nic->packet, (unsigned char *) (rmdp->u.buffer & 0x00ffffff), nic->packetlen = len);
- - packet_there = 1;
- -
- -
- - /*
- - * Packet is queued and marked for processing so we
- - * free our descriptor
- - */
- -
- - rmdp->u.s.status = RX_OWN;
- -
- - p->rmdnum++;
- - p->rmdnum %= RMDNUM;
- -
- - rmdp = p->rmdhead + p->rmdnum;
- - }
- - }
- - SK_write_reg(CSR0, CSR0_INEA); /* Enable Interrupts */
- - return (packet_there);
- -}
- -
- -/**************************************************************************
- -TRANSMIT - Transmit a frame
- -***************************************************************************/
- -static void SK_transmit(
- -struct nic *nic,
- -const char *d, /* Destination */
- -unsigned int t, /* Type */
- -unsigned int s, /* size */
- -const char *pack) /* Packet */
- -{
- - /* send the packet to destination */
- - struct priv *p; /* SK_G16 private structure */
- - struct tmd *tmdp;
- - short len;
- - int csr0, i, tmdstat;
- -
- - PRINTF2(("## %s: At beginning of SK_transmit(). CSR0: %#hX\n",
- - SK_NAME, SK_read_reg(CSR0)));
- - p = nic->priv_data;
- - tmdp = p->tmdhead + p->tmdnum; /* Which descriptor for transmitting */
- -
- - /* Copy data into dual ported ram */
- -
- - memcpy(&p->ram->tmdbuf[p->tmdnum][0], d, ETH_ALEN); /* dst */
- - memcpy(&p->ram->tmdbuf[p->tmdnum][ETH_ALEN], nic->node_addr, ETH_ALEN); /* src */
- - p->ram->tmdbuf[p->tmdnum][ETH_ALEN + ETH_ALEN] = t >> 8; /* type */
- - p->ram->tmdbuf[p->tmdnum][ETH_ALEN + ETH_ALEN + 1] = t; /* type */
- - memcpy(&p->ram->tmdbuf[p->tmdnum][ETH_HLEN], pack, s);
- - s += ETH_HLEN;
- - while (s < ETH_ZLEN) /* pad to min length */
- - p->ram->tmdbuf[p->tmdnum][s++] = 0;
- - p->ram->tmde[p->tmdnum].status2 = 0x0;
- -
- - /* Evaluate Packet length */
- - len = ETH_ZLEN < s ? s : ETH_ZLEN;
- -
- - /* Fill in Transmit Message Descriptor */
- -
- - tmdp->blen = -len; /* set length to transmit */
- -
- - /*
- - * Packet start and end is always set because we use the maximum
- - * packet length as buffer length.
- - * Relinquish ownership to LANCE
- - */
- -
- - tmdp->u.s.status = TX_OWN | TX_STP | TX_ENP;
- -
- - /* Start Demand Transmission */
- - SK_write_reg(CSR0, CSR0_TDMD | CSR0_INEA);
- -
- - csr0 = SK_read_reg(CSR0); /* store register for checking */
- -
- - /*
- - * Acknowledge all of the current interrupt sources, disable
- - * Interrupts (INEA = 0)
- - */
- -
- - SK_write_reg(CSR0, csr0 & CSR0_CLRALL);
- -
- - if (csr0 & CSR0_ERR) /* LANCE Error */
- - {
- - printf("%s: error: %#hX", SK_NAME, csr0);
- -
- - if (csr0 & CSR0_MISS) /* No place to store packet ? */
- - {
- - printf(", Packet dropped.");
- - }
- - putchar('\n');
- - }
- -
- -
- - /* Set next buffer */
- - p->tmdlast++;
- - p->tmdlast &= TMDNUM-1;
- -
- - tmdstat = tmdp->u.s.status & 0xff00; /* filter out status bits 15:08 */
- -
- - /*
- - * We check status of transmitted packet.
- - * see LANCE data-sheet for error explanation
- - */
- - if (tmdstat & TX_ERR) /* Error occurred */
- - {
- - printf("%s: TX error: %#hX %#hX\n", SK_NAME, (int) tmdstat,
- - (int) tmdp->status2);
- -
- - if (tmdp->status2 & TX_TDR) /* TDR problems? */
- - {
- - printf("%s: tdr-problems \n", SK_NAME);
- - }
- -
- - if (tmdp->status2 & TX_UFLO) /* Underflow error ? */
- - {
- - /*
- - * If UFLO error occurs it will turn transmitter of.
- - * So we must reinit LANCE
- - */
- -
- - SK_lance_init(nic, MODE_NORMAL);
- - }
- -
- - tmdp->status2 = 0; /* Clear error flags */
- - }
- -
- - SK_write_reg(CSR0, CSR0_INEA); /* Enable Interrupts */
- -
- - /* Set pointer to next transmit buffer */
- - p->tmdnum++;
- - p->tmdnum &= TMDNUM-1;
- -
- -}
- -
- -/**************************************************************************
- -DISABLE - Turn off ethernet interface
- -***************************************************************************/
- -static void SK_disable(struct nic *nic)
- -{
- - PRINTF(("## %s: At beginning of SK_disable(). CSR0: %#hX\n",
- - SK_NAME, SK_read_reg(CSR0)));
- - PRINTF(("%s: Shutting %s down CSR0 %#hX\n", SK_NAME, SK_NAME,
- - (int) SK_read_reg(CSR0)));
- -
- - SK_write_reg(CSR0, CSR0_STOP); /* STOP the LANCE */
- -}
- -
- -/**************************************************************************
- -PROBE - Look for an adapter, this routine's visible to the outside
- -***************************************************************************/
- -struct nic *SK_probe(struct nic *nic, unsigned short *probe_addrs)
- -{
- - unsigned short *p;
- - static unsigned short io_addrs[] = SK_IO_PORTS;
- - /* if probe_addrs is 0, then routine can use a hardwired default */
- - putchar('\n');
- - nic->priv_data = &p_data;
- - if (probe_addrs == 0)
- - probe_addrs = io_addrs;
- - for (p = probe_addrs; (ioaddr = *p) != 0; ++p)
- - {
- - long offset1, offset0 = inb(ioaddr);
- - if ((offset0 == SK_IDLOW) &&
- - ((offset1 = inb(ioaddr + 1)) == SK_IDHIGH))
- - if (SK_probe1(nic, ioaddr) >= 0)
- - break;
- - }
- - /* if board found */
- - if (ioaddr != 0)
- - {
- - /* point to NIC specific routines */
- - nic->reset = SK_reset;
- - nic->poll = SK_poll;
- - nic->transmit = SK_transmit;
- - nic->disable = SK_disable;
- - return nic;
- - }
- - /* else */
- - {
- - return 0;
- - }
- -}
- -
- -int SK_probe1(struct nic *nic, short ioaddr1)
- -{
- - int i,j; /* Counters */
- - int sk_addr_flag = 0; /* SK ADDR correct? 1 - no, 0 - yes */
- - unsigned int rom_addr; /* used to store RAM address used for POS_ADDR */
- -
- - struct priv *p; /* SK_G16 private structure */
- -
- - if (SK_ADDR & 0x3fff || SK_ADDR < 0xa0000)
- - {
- - /*
- - * Now here we could use a routine which searches for a free
- - * place in the ram and set SK_ADDR if found. TODO.
- - */
- - printf("%s: SK_ADDR %#hX is not valid. Check configuration.\n",
- - SK_NAME, SK_ADDR);
- - return -1;
- - }
- -
- - rom_addr = SK_ADDR;
- -
- - outb(SK_ROM_RAM_OFF, SK_POS2); /* Boot_ROM + RAM off */
- - outb(POS_ADDR, SK_POS3); /* Set RAM address */
- - outb(SK_ROM_RAM_ON, SK_POS2); /* RAM on, BOOT_ROM on */
- -#ifdef SK_DEBUG
- - SK_print_pos(nic, "POS registers after ROM, RAM config");
- -#endif
- -
- - board = (SK_RAM *) rom_addr;
- - PRINTF(("adr[0]: %hX, adr[1]: %hX, adr[2]: %hX\n",
- - board->rom[0], board->rom[2], board->rom[4]));
- -
- - /* Read in station address */
- - for (i = 0, j = 0; i < ETH_ALEN; i++, j+=2)
- - {
- - *(nic->node_addr+i) = board->rom[j];
- - }
- -
- - /* Check for manufacturer code */
- -#ifdef SK_DEBUG
- - if (!(*(nic->node_addr+0) == SK_MAC0 &&
- - *(nic->node_addr+1) == SK_MAC1 &&
- - *(nic->node_addr+2) == SK_MAC2) )
- - {
- - PRINTF(("## %s: We did not find SK_G16 at RAM location.\n",
- - SK_NAME));
- - return -1; /* NO SK_G16 found */
- - }
- -#endif
- -
- - p = nic->priv_data;
- -
- - /* Initialize private structure */
- -
- - p->ram = (struct SK_ram *) rom_addr; /* Set dual ported RAM addr */
- - p->tmdhead = &(p->ram)->tmde[0]; /* Set TMD head */
- - p->rmdhead = &(p->ram)->rmde[0]; /* Set RMD head */
- -
- - printf("Schneider & Koch G16 at %#hX, mem at %#hX, HW addr: %!\n",
- - (unsigned int) ioaddr, (unsigned int) p->ram, nic->node_addr);
- -
- - /* Initialize buffer pointers */
- -
- - for (i = 0; i < TMDNUM; i++)
- - {
- - p->tmdbufs[i] = p->ram->tmdbuf[i];
- - }
- -
- - for (i = 0; i < RMDNUM; i++)
- - {
- - p->rmdbufs[i] = p->ram->rmdbuf[i];
- - }
- - i = 0;
- -
- - if (!(i = SK_lance_init(nic, MODE_NORMAL))) /* LANCE init OK? */
- - {
- -
- -#ifdef SK_DEBUG
- - /*
- - * This debug block tries to stop LANCE,
- - * reinit LANCE with transmitter and receiver disabled,
- - * then stop again and reinit with NORMAL_MODE
- - */
- -
- - printf("## %s: After lance init. CSR0: %#hX\n",
- - SK_NAME, SK_read_reg(CSR0));
- - SK_write_reg(CSR0, CSR0_STOP);
- - printf("## %s: LANCE stopped. CSR0: %#hX\n",
- - SK_NAME, SK_read_reg(CSR0));
- - SK_lance_init(nic, MODE_DTX | MODE_DRX);
- - printf("## %s: Reinit with DTX + DRX off. CSR0: %#hX\n",
- - SK_NAME, SK_read_reg(CSR0));
- - SK_write_reg(CSR0, CSR0_STOP);
- - printf("## %s: LANCE stopped. CSR0: %#hX\n",
- - SK_NAME, SK_read_reg(CSR0));
- - SK_lance_init(nic, MODE_NORMAL);
- - printf("## %s: LANCE back to normal mode. CSR0: %#hX\n",
- - SK_NAME, SK_read_reg(CSR0));
- - SK_print_pos(nic, "POS regs before returning OK");
- -
- -#endif /* SK_DEBUG */
- -
- - }
- - else /* LANCE init failed */
- - {
- -
- - PRINTF(("## %s: LANCE init failed: CSR0: %#hX\n",
- - SK_NAME, SK_read_reg(CSR0)));
- - return -1;
- - }
- -
- -#ifdef SK_DEBUG
- - SK_print_pos(nic, "End of SK_probe1");
- - SK_print_ram(nic);
- -#endif
- -
- - return 0; /* Initialization done */
- -
- -} /* End of SK_probe1() */
- -
- -static int SK_lance_init(struct nic *nic, unsigned short mode)
- -{
- - int i;
- - struct priv *p = (struct priv *) nic->priv_data;
- - struct tmd *tmdp;
- - struct rmd *rmdp;
- -
- - PRINTF(("## %s: At beginning of LANCE init. CSR0: %#hX\n",
- - SK_NAME, SK_read_reg(CSR0)));
- -
- - /* Reset LANCE */
- - SK_reset_board();
- -
- - /* Initialize TMD's with start values */
- - p->tmdnum = 0; /* First descriptor for transmitting */
- - p->tmdlast = 0; /* First descriptor for reading stats */
- -
- - for (i = 0; i < TMDNUM; i++) /* Init all TMD's */
- - {
- - tmdp = p->tmdhead + i;
- -
- - tmdp->u.buffer = (unsigned long) p->tmdbufs[i]; /* assign buffer */
- -
- - /* Mark TMD as start and end of packet */
- - tmdp->u.s.status = TX_STP | TX_ENP;
- - }
- -
- -
- - /* Initialize RMD's with start values */
- -
- - p->rmdnum = 0; /* First RMD which will be used */
- -
- - for (i = 0; i < RMDNUM; i++) /* Init all RMD's */
- - {
- - rmdp = p->rmdhead + i;
- -
- -
- - rmdp->u.buffer = (unsigned long) p->rmdbufs[i]; /* assign buffer */
- -
- - /*
- - * LANCE must be owner at beginning so that he can fill in
- - * receiving packets, set status and release RMD
- - */
- -
- - rmdp->u.s.status = RX_OWN;
- -
- - rmdp->blen = -PKT_BUF_SZ; /* Buffer Size in a two's complement */
- -
- - rmdp->mlen = 0; /* init message length */
- -
- - }
- -
- - /* Fill LANCE Initialize Block */
- -
- - (p->ram)->ib.mode = mode; /* Set operation mode */
- -
- - for (i = 0; i < ETH_ALEN; i++) /* Set physical address */
- - {
- - (p->ram)->ib.paddr[i] = *(nic->node_addr+i);
- - }
- -
- - for (i = 0; i < 8; i++) /* Set multicast, logical address */
- - {
- - (p->ram)->ib.laddr[i] = 0; /* We do not use logical addressing */
- - }
- -
- - /* Set ring descriptor pointers and set number of descriptors */
- -
- - (p->ram)->ib.rdrp = (int) p->rmdhead | RMDNUMMASK;
- - (p->ram)->ib.tdrp = (int) p->tmdhead | TMDNUMMASK;
- -
- - /* Prepare LANCE Control and Status Registers */
- -
- - SK_write_reg(CSR3, CSR3_ACON); /* Ale Control !!!THIS MUST BE SET!!!! */
- -
- - /*
- - * LANCE addresses the RAM from 0x0000 to 0x3fbf and has no access to
- - * PC Memory locations.
- - *
- - * In structure SK_ram is defined that the first thing in ram
- - * is the initialization block. So his address is for LANCE always
- - * 0x0000
- - *
- - * CSR1 contains low order bits 15:0 of initialization block address
- - * CSR2 is built of:
- - * 7:0 High order bits 23:16 of initialization block address
- - * 15:8 reserved, must be 0
- - */
- -
- - /* Set initialization block address (must be on word boundary) */
- - SK_write_reg(CSR1, 0); /* Set low order bits 15:0 */
- - SK_write_reg(CSR2, 0); /* Set high order bits 23:16 */
- -
- -
- - PRINTF(("## %s: After setting CSR1-3. CSR0: %#hX\n",
- - SK_NAME, SK_read_reg(CSR0)));
- -
- - /* Initialize LANCE */
- -
- - /*
- - * INIT = Initialize, when set, causes the LANCE to begin the
- - * initialization procedure and access the Init Block.
- - */
- -
- - SK_write_reg(CSR0, CSR0_INIT);
- -
- - /* Wait until LANCE finished initialization */
- -
- - SK_set_RAP(CSR0); /* Register Address Pointer to CSR0 */
- -
- - for (i = 0; (i < 100) && !(SK_rread_reg() & CSR0_IDON); i++)
- - ; /* Wait until init done or go ahead if problems (i>=100) */
- -
- - if (i >= 100) /* Something is wrong ! */
- - {
- - printf("%s: can't init am7990, status: %#hX "
- - "init_block: %#hX\n",
- - SK_NAME, (int) SK_read_reg(CSR0),
- - (unsigned int) &(p->ram)->ib);
- -
- -#ifdef SK_DEBUG
- - SK_print_pos(nic, "LANCE INIT failed");
- -#endif
- -
- - return -1; /* LANCE init failed */
- - }
- -
- - PRINTF(("## %s: init done after %d ticks\n", SK_NAME, i));
- -
- - /* Clear Initialize done, enable Interrupts, start LANCE */
- -
- - SK_write_reg(CSR0, CSR0_IDON | CSR0_INEA | CSR0_STRT);
- -
- - PRINTF(("## %s: LANCE started. CSR0: %#hX\n", SK_NAME,
- - SK_read_reg(CSR0)));
- -
- - return 0; /* LANCE is up and running */
- -
- -} /* End of SK_lance_init() */
- -
- -/* LANCE access functions
- - *
- - * ! CSR1-3 can only be accessed when in CSR0 the STOP bit is set !
- - */
- -
- -static void SK_reset_board(void)
- -{
- - int i;
- -
- - PRINTF(("## %s: At beginning of SK_reset_board.\n", SK_NAME));
- - SK_PORT = 0x00; /* Reset active */
- - for (i = 0; i < 10 ; i++) /* Delay min 5ms */
- - ;
- - SK_PORT = SK_RESET; /* Set back to normal operation */
- -
- -} /* End of SK_reset_board() */
- -
- -static void SK_set_RAP(int reg_number)
- -{
- - SK_IOREG = reg_number;
- - SK_PORT = SK_RESET | SK_RAP | SK_WREG;
- - SK_IOCOM = SK_DOIO;
- -
- - while (SK_PORT & SK_IORUN)
- - ;
- -} /* End of SK_set_RAP() */
- -
- -static int SK_read_reg(int reg_number)
- -{
- - SK_set_RAP(reg_number);
- -
- - SK_PORT = SK_RESET | SK_RDATA | SK_RREG;
- - SK_IOCOM = SK_DOIO;
- -
- - while (SK_PORT & SK_IORUN)
- - ;
- - return (SK_IOREG);
- -
- -} /* End of SK_read_reg() */
- -
- -static int SK_rread_reg(void)
- -{
- - SK_PORT = SK_RESET | SK_RDATA | SK_RREG;
- -
- - SK_IOCOM = SK_DOIO;
- -
- - while (SK_PORT & SK_IORUN)
- - ;
- - return (SK_IOREG);
- -
- -} /* End of SK_rread_reg() */
- -
- -static void SK_write_reg(int reg_number, int value)
- -{
- - SK_set_RAP(reg_number);
- -
- - SK_IOREG = value;
- - SK_PORT = SK_RESET | SK_RDATA | SK_WREG;
- - SK_IOCOM = SK_DOIO;
- -
- - while (SK_PORT & SK_IORUN)
- - ;
- -} /* End of SK_write_reg */
- -
- -/*
- - * Debugging functions
- - * -------------------
- - */
- -
- -#ifdef SK_DEBUG
- -static void SK_print_pos(struct nic *nic, char *text)
- -{
- -
- - unsigned char pos0 = inb(SK_POS0),
- - pos1 = inb(SK_POS1),
- - pos2 = inb(SK_POS2),
- - pos3 = inb(SK_POS3),
- - pos4 = inb(SK_POS4);
- -
- -
- - printf("## %s: %s.\n"
- - "## pos0=%#hX pos1=%#hX pos2=%#hX pos3=%#hX pos4=%#hX\n",
- - SK_NAME, text, pos0, pos1, pos2, (pos3<<14), pos4);
- -
- -} /* End of SK_print_pos() */
- -
- -static void SK_print_ram(struct nic *nic)
- -{
- -
- - int i;
- - struct priv *p = (struct priv *) nic->priv_data;
- -
- - printf("## %s: RAM Details.\n"
- - "## RAM at %#hX tmdhead: %#hX rmdhead: %#hX initblock: %#hX\n",
- - SK_NAME,
- - (unsigned int) p->ram,
- - (unsigned int) p->tmdhead,
- - (unsigned int) p->rmdhead,
- - (unsigned int) &(p->ram)->ib);
- -
- - printf("## ");
- -
- - for(i = 0; i < TMDNUM; i++)
- - {
- - if (!(i % 3)) /* Every third line do a newline */
- - {
- - printf("\n## ");
- - }
- - printf("tmdbufs%d: %#hX ", (i+1), (int) p->tmdbufs[i]);
- - }
- - printf("## ");
- -
- - for(i = 0; i < RMDNUM; i++)
- - {
- - if (!(i % 3)) /* Every third line do a newline */
- - {
- - printf("\n## ");
- - }
- - printf("rmdbufs%d: %#hX ", (i+1), (int) p->rmdbufs[i]);
- - }
- - putchar('\n');
- -
- -} /* End of SK_print_ram() */
- -#endif
- diff -Naur grub-0.97.orig/netboot/sk_g16.h grub-0.97/netboot/sk_g16.h
- --- grub-0.97.orig/netboot/sk_g16.h 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/sk_g16.h 1970-01-01 00:00:00.000000000 +0000
- @@ -1,168 +0,0 @@
- -/*-
- - *
- - * This software may be used and distributed according to the terms
- - * of the GNU Public License, incorporated herein by reference.
- - *
- - * Module : sk_g16.h
- - * Version : $Revision: 1.3 $
- - *
- - * Author : M.Hipp (mhipp@student.uni-tuebingen.de)
- - * changes by : Patrick J.D. Weichmann
- - *
- - * Date Created : 94/05/25
- - *
- - * Description : In here are all necessary definitions of
- - * the am7990 (LANCE) chip used for writing a
- - * network device driver which uses this chip
- - *
- - * $Log: sk_g16.h,v $
- - * Revision 1.3 2000/07/29 19:22:54 okuji
- - * update the network support to etherboot-4.6.4.
- - *
- --*/
- -
- -#ifndef SK_G16_H
- -
- -#define SK_G16_H
- -
- -
- -/*
- - * Control and Status Register 0 (CSR0) bit definitions
- - *
- - * (R=Readable) (W=Writeable) (S=Set on write) (C-Clear on write)
- - *
- - */
- -
- -#define CSR0_ERR 0x8000 /* Error summary (R) */
- -#define CSR0_BABL 0x4000 /* Babble transmitter timeout error (RC) */
- -#define CSR0_CERR 0x2000 /* Collision Error (RC) */
- -#define CSR0_MISS 0x1000 /* Missed packet (RC) */
- -#define CSR0_MERR 0x0800 /* Memory Error (RC) */
- -#define CSR0_RINT 0x0400 /* Receiver Interrupt (RC) */
- -#define CSR0_TINT 0x0200 /* Transmit Interrupt (RC) */
- -#define CSR0_IDON 0x0100 /* Initialization Done (RC) */
- -#define CSR0_INTR 0x0080 /* Interrupt Flag (R) */
- -#define CSR0_INEA 0x0040 /* Interrupt Enable (RW) */
- -#define CSR0_RXON 0x0020 /* Receiver on (R) */
- -#define CSR0_TXON 0x0010 /* Transmitter on (R) */
- -#define CSR0_TDMD 0x0008 /* Transmit Demand (RS) */
- -#define CSR0_STOP 0x0004 /* Stop (RS) */
- -#define CSR0_STRT 0x0002 /* Start (RS) */
- -#define CSR0_INIT 0x0001 /* Initialize (RS) */
- -
- -#define CSR0_CLRALL 0x7f00 /* mask for all clearable bits */
- -
- -/*
- - * Control and Status Register 3 (CSR3) bit definitions
- - *
- - */
- -
- -#define CSR3_BSWAP 0x0004 /* Byte Swap (RW) */
- -#define CSR3_ACON 0x0002 /* ALE Control (RW) */
- -#define CSR3_BCON 0x0001 /* Byte Control (RW) */
- -
- -/*
- - * Initialization Block Mode operation Bit Definitions.
- - */
- -
- -#define MODE_PROM 0x8000 /* Promiscuous Mode */
- -#define MODE_INTL 0x0040 /* Internal Loopback */
- -#define MODE_DRTY 0x0020 /* Disable Retry */
- -#define MODE_COLL 0x0010 /* Force Collision */
- -#define MODE_DTCR 0x0008 /* Disable Transmit CRC) */
- -#define MODE_LOOP 0x0004 /* Loopback */
- -#define MODE_DTX 0x0002 /* Disable the Transmitter */
- -#define MODE_DRX 0x0001 /* Disable the Receiver */
- -
- -#define MODE_NORMAL 0x0000 /* Normal operation mode */
- -
- -/*
- - * Receive message descriptor status bit definitions.
- - */
- -
- -#define RX_OWN 0x80 /* Owner bit 0 = host, 1 = lance */
- -#define RX_ERR 0x40 /* Error Summary */
- -#define RX_FRAM 0x20 /* Framing Error */
- -#define RX_OFLO 0x10 /* Overflow Error */
- -#define RX_CRC 0x08 /* CRC Error */
- -#define RX_BUFF 0x04 /* Buffer Error */
- -#define RX_STP 0x02 /* Start of Packet */
- -#define RX_ENP 0x01 /* End of Packet */
- -
- -
- -/*
- - * Transmit message descriptor status bit definitions.
- - */
- -
- -#define TX_OWN 0x80 /* Owner bit 0 = host, 1 = lance */
- -#define TX_ERR 0x40 /* Error Summary */
- -#define TX_MORE 0x10 /* More the 1 retry needed to Xmit */
- -#define TX_ONE 0x08 /* One retry needed to Xmit */
- -#define TX_DEF 0x04 /* Deferred */
- -#define TX_STP 0x02 /* Start of Packet */
- -#define TX_ENP 0x01 /* End of Packet */
- -
- -/*
- - * Transmit status (2) (valid if TX_ERR == 1)
- - */
- -
- -#define TX_BUFF 0x8000 /* Buffering error (no ENP) */
- -#define TX_UFLO 0x4000 /* Underflow (late memory) */
- -#define TX_LCOL 0x1000 /* Late collision */
- -#define TX_LCAR 0x0400 /* Loss of Carrier */
- -#define TX_RTRY 0x0200 /* Failed after 16 retransmissions */
- -#define TX_TDR 0x003f /* Time-domain-reflectometer-value */
- -
- -
- -/*
- - * Structures used for Communication with the LANCE
- - */
- -
- -/* LANCE Initialize Block */
- -
- -struct init_block
- -{
- - unsigned short mode; /* Mode Register */
- - unsigned char paddr[6]; /* Physical Address (MAC) */
- - unsigned char laddr[8]; /* Logical Filter Address (not used) */
- - unsigned int rdrp; /* Receive Descriptor Ring pointer */
- - unsigned int tdrp; /* Transmit Descriptor Ring pointer */
- -};
- -
- -
- -/* Receive Message Descriptor Entry */
- -
- -struct rmd
- -{
- - union rmd_u
- - {
- - unsigned long buffer; /* Address of buffer */
- - struct rmd_s
- - {
- - unsigned char unused[3];
- - unsigned volatile char status; /* Status Bits */
- - } s;
- - } u;
- - volatile short blen; /* Buffer Length (two's complement) */
- - unsigned short mlen; /* Message Byte Count */
- -};
- -
- -
- -/* Transmit Message Descriptor Entry */
- -
- -struct tmd
- -{
- - union tmd_u
- - {
- - unsigned long buffer; /* Address of buffer */
- - struct tmd_s
- - {
- - unsigned char unused[3];
- - unsigned volatile char status; /* Status Bits */
- - } s;
- - } u;
- - unsigned short blen; /* Buffer Length (two's complement) */
- - unsigned volatile short status2; /* Error Status Bits */
- -};
- -
- -#endif /* End of SK_G16_H */
- diff -Naur grub-0.97.orig/netboot/smc9000.c grub-0.97/netboot/smc9000.c
- --- grub-0.97.orig/netboot/smc9000.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/smc9000.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,522 +0,0 @@
- - /*------------------------------------------------------------------------
- - * smc9000.c
- - * This is a Etherboot driver for SMC's 9000 series of Ethernet cards.
- - *
- - * Copyright (C) 1998 Daniel Engström <daniel.engstrom@riksnett.no>
- - * Based on the Linux SMC9000 driver, smc9194.c by Eric Stahlman
- - * Copyright (C) 1996 by Erik Stahlman <eric@vt.edu>
- - *
- - * This software may be used and distributed according to the terms
- - * of the GNU Public License, incorporated herein by reference.
- - *
- - * "Features" of the SMC chip:
- - * 4608 byte packet memory. ( for the 91C92/4. Others have more )
- - * EEPROM for configuration
- - * AUI/TP selection
- - *
- - * Authors
- - * Erik Stahlman <erik@vt.edu>
- - * Daniel Engström <daniel.engstrom@riksnett.no>
- - *
- - * History
- - * 98-09-25 Daniel Engström Etherboot driver crated from Eric's
- - * Linux driver.
- - *
- - *---------------------------------------------------------------------------*/
- -#define LINUX_OUT_MACROS 1
- -#define SMC9000_VERBOSE 1
- -#define SMC9000_DEBUG 0
- -
- -#include "etherboot.h"
- -#include "nic.h"
- -#include "cards.h"
- -#include "smc9000.h"
- -
- -# define _outb outb
- -# define _outw outw
- -
- -static const char smc9000_version[] = "Version 0.99 98-09-30";
- -static unsigned int smc9000_base=0;
- -static const char *interfaces[ 2 ] = { "TP", "AUI" };
- -static const char *chip_ids[ 15 ] = {
- - NULL, NULL, NULL,
- - /* 3 */ "SMC91C90/91C92",
- - /* 4 */ "SMC91C94",
- - /* 5 */ "SMC91C95",
- - NULL,
- - /* 7 */ "SMC91C100",
- - /* 8 */ "SMC91C100FD",
- - NULL, NULL, NULL,
- - NULL, NULL, NULL
- -};
- -static const char smc91c96_id[] = "SMC91C96";
- -
- -/*
- - * Function: smc_reset( int ioaddr )
- - * Purpose:
- - * This sets the SMC91xx chip to its normal state, hopefully from whatever
- - * mess that any other DOS driver has put it in.
- - *
- - * Maybe I should reset more registers to defaults in here? SOFTRESET should
- - * do that for me.
- - *
- - * Method:
- - * 1. send a SOFT RESET
- - * 2. wait for it to finish
- - * 3. reset the memory management unit
- - * 4. clear all interrupts
- - *
- -*/
- -static void smc_reset(int ioaddr)
- -{
- - /* This resets the registers mostly to defaults, but doesn't
- - * affect EEPROM. That seems unnecessary */
- - SMC_SELECT_BANK(ioaddr, 0);
- - _outw( RCR_SOFTRESET, ioaddr + RCR );
- -
- - /* this should pause enough for the chip to be happy */
- - SMC_DELAY(ioaddr);
- -
- - /* Set the transmit and receive configuration registers to
- - * default values */
- - _outw(RCR_CLEAR, ioaddr + RCR);
- - _outw(TCR_CLEAR, ioaddr + TCR);
- -
- - /* Reset the MMU */
- - SMC_SELECT_BANK(ioaddr, 2);
- - _outw( MC_RESET, ioaddr + MMU_CMD );
- -
- - /* Note: It doesn't seem that waiting for the MMU busy is needed here,
- - * but this is a place where future chipsets _COULD_ break. Be wary
- - * of issuing another MMU command right after this */
- - _outb(0, ioaddr + INT_MASK);
- -}
- -
- -
- -/*----------------------------------------------------------------------
- - * Function: smc_probe( int ioaddr )
- - *
- - * Purpose:
- - * Tests to see if a given ioaddr points to an SMC9xxx chip.
- - * Returns a 0 on success
- - *
- - * Algorithm:
- - * (1) see if the high byte of BANK_SELECT is 0x33
- - * (2) compare the ioaddr with the base register's address
- - * (3) see if I recognize the chip ID in the appropriate register
- - *
- - * ---------------------------------------------------------------------
- - */
- -static int smc_probe( int ioaddr )
- -{
- - word bank;
- - word revision_register;
- - word base_address_register;
- -
- - /* First, see if the high byte is 0x33 */
- - bank = inw(ioaddr + BANK_SELECT);
- - if ((bank & 0xFF00) != 0x3300) {
- - return -1;
- - }
- - /* The above MIGHT indicate a device, but I need to write to further
- - * test this. */
- - _outw(0x0, ioaddr + BANK_SELECT);
- - bank = inw(ioaddr + BANK_SELECT);
- - if ((bank & 0xFF00) != 0x3300) {
- - return -1;
- - }
- -
- - /* well, we've already written once, so hopefully another time won't
- - * hurt. This time, I need to switch the bank register to bank 1,
- - * so I can access the base address register */
- - SMC_SELECT_BANK(ioaddr, 1);
- - base_address_register = inw(ioaddr + BASE);
- -
- - if (ioaddr != (base_address_register >> 3 & 0x3E0)) {
- -#ifdef SMC9000_VERBOSE
- - printf("SMC9000: IOADDR %hX doesn't match configuration (%hX)."
- - "Probably not a SMC chip\n",
- - ioaddr, base_address_register >> 3 & 0x3E0);
- -#endif
- - /* well, the base address register didn't match. Must not have
- - * been a SMC chip after all. */
- - return -1;
- - }
- -
- -
- - /* check if the revision register is something that I recognize.
- - * These might need to be added to later, as future revisions
- - * could be added. */
- - SMC_SELECT_BANK(ioaddr, 3);
- - revision_register = inw(ioaddr + REVISION);
- - if (!chip_ids[(revision_register >> 4) & 0xF]) {
- - /* I don't recognize this chip, so... */
- -#ifdef SMC9000_VERBOSE
- - printf("SMC9000: IO %hX: Unrecognized revision register:"
- - " %hX, Contact author.\n", ioaddr, revision_register);
- -#endif
- - return -1;
- - }
- -
- - /* at this point I'll assume that the chip is an SMC9xxx.
- - * It might be prudent to check a listing of MAC addresses
- - * against the hardware address, or do some other tests. */
- - return 0;
- -}
- -
- -
- -/**************************************************************************
- - * ETH_RESET - Reset adapter
- - ***************************************************************************/
- -
- -static void smc9000_reset(struct nic *nic)
- -{
- - smc_reset(smc9000_base);
- -}
- -
- -/**************************************************************************
- - * ETH_TRANSMIT - Transmit a frame
- - ***************************************************************************/
- -static void smc9000_transmit(
- - struct nic *nic,
- - const char *d, /* Destination */
- - unsigned int t, /* Type */
- - unsigned int s, /* size */
- - const char *p) /* Packet */
- -{
- - word length; /* real, length incl. header */
- - word numPages;
- - unsigned long time_out;
- - byte packet_no;
- - word status;
- - int i;
- -
- - /* We dont pad here since we can have the hardware doing it for us */
- - length = (s + ETH_HLEN + 1)&~1;
- -
- - /* convert to MMU pages */
- - numPages = length / 256;
- -
- - if (numPages > 7 ) {
- -#ifdef SMC9000_VERBOSE
- - printf("SMC9000: Far too big packet error. \n");
- -#endif
- - return;
- - }
- -
- - /* dont try more than, say 30 times */
- - for (i=0;i<30;i++) {
- - /* now, try to allocate the memory */
- - SMC_SELECT_BANK(smc9000_base, 2);
- - _outw(MC_ALLOC | numPages, smc9000_base + MMU_CMD);
- -
- - status = 0;
- - /* wait for the memory allocation to finnish */
- - for (time_out = currticks() + 5*TICKS_PER_SEC; currticks() < time_out; ) {
- - status = inb(smc9000_base + INTERRUPT);
- - if ( status & IM_ALLOC_INT ) {
- - /* acknowledge the interrupt */
- - _outb(IM_ALLOC_INT, smc9000_base + INTERRUPT);
- - break;
- - }
- - }
- -
- - if ((status & IM_ALLOC_INT) != 0 ) {
- - /* We've got the memory */
- - break;
- - } else {
- - printf("SMC9000: Memory allocation timed out, resetting MMU.\n");
- - _outw(MC_RESET, smc9000_base + MMU_CMD);
- - }
- - }
- -
- - /* If I get here, I _know_ there is a packet slot waiting for me */
- - packet_no = inb(smc9000_base + PNR_ARR + 1);
- - if (packet_no & 0x80) {
- - /* or isn't there? BAD CHIP! */
- - printf("SMC9000: Memory allocation failed. \n");
- - return;
- - }
- -
- - /* we have a packet address, so tell the card to use it */
- - _outb(packet_no, smc9000_base + PNR_ARR);
- -
- - /* point to the beginning of the packet */
- - _outw(PTR_AUTOINC, smc9000_base + POINTER);
- -
- -#if SMC9000_DEBUG > 2
- - printf("Trying to xmit packet of length %hX\n", length );
- -#endif
- -
- - /* send the packet length ( +6 for status, length and ctl byte )
- - * and the status word ( set to zeros ) */
- - _outw(0, smc9000_base + DATA_1 );
- -
- - /* send the packet length ( +6 for status words, length, and ctl) */
- - _outb((length+6) & 0xFF, smc9000_base + DATA_1);
- - _outb((length+6) >> 8 , smc9000_base + DATA_1);
- -
- - /* Write the contents of the packet */
- -
- - /* The ethernet header first... */
- - outsw(smc9000_base + DATA_1, d, ETH_ALEN >> 1);
- - outsw(smc9000_base + DATA_1, nic->node_addr, ETH_ALEN >> 1);
- - _outw(htons(t), smc9000_base + DATA_1);
- -
- - /* ... the data ... */
- - outsw(smc9000_base + DATA_1 , p, s >> 1);
- -
- - /* ... and the last byte, if there is one. */
- - if ((s & 1) == 0) {
- - _outw(0, smc9000_base + DATA_1);
- - } else {
- - _outb(p[s-1], smc9000_base + DATA_1);
- - _outb(0x20, smc9000_base + DATA_1);
- - }
- -
- - /* and let the chipset deal with it */
- - _outw(MC_ENQUEUE , smc9000_base + MMU_CMD);
- -
- - status = 0; time_out = currticks() + 5*TICKS_PER_SEC;
- - do {
- - status = inb(smc9000_base + INTERRUPT);
- -
- - if ((status & IM_TX_INT ) != 0) {
- - word tx_status;
- -
- - /* ack interrupt */
- - _outb(IM_TX_INT, smc9000_base + INTERRUPT);
- -
- - packet_no = inw(smc9000_base + FIFO_PORTS);
- - packet_no &= 0x7F;
- -
- - /* select this as the packet to read from */
- - _outb( packet_no, smc9000_base + PNR_ARR );
- -
- - /* read the first word from this packet */
- - _outw( PTR_AUTOINC | PTR_READ, smc9000_base + POINTER );
- -
- - tx_status = inw( smc9000_base + DATA_1 );
- -
- - if (0 == (tx_status & TS_SUCCESS)) {
- -#ifdef SMC9000_VERBOSE
- - printf("SMC9000: TX FAIL STATUS: %hX \n", tx_status);
- -#endif
- - /* re-enable transmit */
- - SMC_SELECT_BANK(smc9000_base, 0);
- - _outw(inw(smc9000_base + TCR ) | TCR_ENABLE, smc9000_base + TCR );
- - }
- -
- - /* kill the packet */
- - SMC_SELECT_BANK(smc9000_base, 2);
- - _outw(MC_FREEPKT, smc9000_base + MMU_CMD);
- -
- - return;
- - }
- - }while(currticks() < time_out);
- -
- - printf("SMC9000: Waring TX timed out, resetting board\n");
- - smc_reset(smc9000_base);
- - return;
- -}
- -
- -/**************************************************************************
- - * ETH_POLL - Wait for a frame
- - ***************************************************************************/
- -static int smc9000_poll(struct nic *nic)
- -{
- - if(!smc9000_base)
- - return 0;
- -
- - SMC_SELECT_BANK(smc9000_base, 2);
- - if (inw(smc9000_base + FIFO_PORTS) & FP_RXEMPTY)
- - return 0;
- -
- - /* start reading from the start of the packet */
- - _outw(PTR_READ | PTR_RCV | PTR_AUTOINC, smc9000_base + POINTER);
- -
- - /* First read the status and check that we're ok */
- - if (!(inw(smc9000_base + DATA_1) & RS_ERRORS)) {
- - /* Next: read the packet length and mask off the top bits */
- - nic->packetlen = (inw(smc9000_base + DATA_1) & 0x07ff);
- -
- - /* the packet length includes the 3 extra words */
- - nic->packetlen -= 6;
- -#if SMC9000_DEBUG > 2
- - printf(" Reading %d words (and %d byte(s))\n",
- - (nic->packetlen >> 1), nic->packetlen & 1);
- -#endif
- - /* read the packet (and the last "extra" word) */
- - insw(smc9000_base + DATA_1, nic->packet, (nic->packetlen+2) >> 1);
- - /* is there an odd last byte ? */
- - if (nic->packet[nic->packetlen+1] & 0x20)
- - nic->packetlen++;
- -
- - /* error or good, tell the card to get rid of this packet */
- - _outw(MC_RELEASE, smc9000_base + MMU_CMD);
- - return 1;
- - }
- -
- - printf("SMC9000: RX error\n");
- - /* error or good, tell the card to get rid of this packet */
- - _outw(MC_RELEASE, smc9000_base + MMU_CMD);
- - return 0;
- -}
- -
- -static void smc9000_disable(struct nic *nic)
- -{
- - if(!smc9000_base)
- - return;
- -
- - /* no more interrupts for me */
- - SMC_SELECT_BANK(smc9000_base, 2);
- - _outb( 0, smc9000_base + INT_MASK);
- -
- - /* and tell the card to stay away from that nasty outside world */
- - SMC_SELECT_BANK(smc9000_base, 0);
- - _outb( RCR_CLEAR, smc9000_base + RCR );
- - _outb( TCR_CLEAR, smc9000_base + TCR );
- -}
- -
- -/**************************************************************************
- - * ETH_PROBE - Look for an adapter
- - ***************************************************************************/
- -
- -struct nic *smc9000_probe(struct nic *nic, unsigned short *probe_addrs)
- -{
- - unsigned short revision;
- - int memory;
- - int media;
- - const char * version_string;
- - const char * if_string;
- - int i;
- -
- - /*
- - * the SMC9000 can be at any of the following port addresses. To change,
- - * for a slightly different card, you can add it to the array. Keep in
- - * mind that the array must end in zero.
- - */
- - static unsigned short portlist[] = {
- -#ifdef SMC9000_SCAN
- - SMC9000_SCAN,
- -#else
- - 0x200, 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x2E0,
- - 0x300, 0x320, 0x340, 0x360, 0x380, 0x3A0, 0x3C0, 0x3E0,
- -#endif
- - 0 };
- -
- - printf("\nSMC9000 %s\n", smc9000_version);
- -#ifdef SMC9000_VERBOSE
- - printf("Copyright (C) 1998 Daniel Engstr\x94m\n");
- - printf("Copyright (C) 1996 Eric Stahlman\n");
- -#endif
- - /* if no addresses supplied, fall back on defaults */
- - if (probe_addrs == 0 || probe_addrs[0] == 0)
- - probe_addrs = portlist;
- -
- - /* check every ethernet address */
- - for (i = 0; probe_addrs[i]; i++) {
- - /* check this specific address */
- - if (smc_probe(probe_addrs[i]) == 0)
- - smc9000_base = probe_addrs[i];
- - }
- -
- - /* couldn't find anything */
- - if(0 == smc9000_base)
- - goto out;
- -
- - /*
- - * Get the MAC address ( bank 1, regs 4 - 9 )
- - */
- - SMC_SELECT_BANK(smc9000_base, 1);
- - for ( i = 0; i < 6; i += 2 ) {
- - word address;
- -
- - address = inw(smc9000_base + ADDR0 + i);
- - nic->node_addr[i+1] = address >> 8;
- - nic->node_addr[i] = address & 0xFF;
- - }
- -
- -
- - /* get the memory information */
- - SMC_SELECT_BANK(smc9000_base, 0);
- - memory = ( inw(smc9000_base + MCR) >> 9 ) & 0x7; /* multiplier */
- - memory *= 256 * (inw(smc9000_base + MIR) & 0xFF);
- -
- - /*
- - * Now, I want to find out more about the chip. This is sort of
- - * redundant, but it's cleaner to have it in both, rather than having
- - * one VERY long probe procedure.
- - */
- - SMC_SELECT_BANK(smc9000_base, 3);
- - revision = inw(smc9000_base + REVISION);
- - version_string = chip_ids[(revision >> 4) & 0xF];
- -
- - if (((revision & 0xF0) >> 4 == CHIP_9196) &&
- - ((revision & 0x0F) >= REV_9196)) {
- - /* This is a 91c96. 'c96 has the same chip id as 'c94 (4) but
- - * a revision starting at 6 */
- - version_string = smc91c96_id;
- - }
- -
- - if ( !version_string ) {
- - /* I shouldn't get here because this call was done before.... */
- - goto out;
- - }
- -
- - /* is it using AUI or 10BaseT ? */
- - SMC_SELECT_BANK(smc9000_base, 1);
- - if (inw(smc9000_base + CONFIG) & CFG_AUI_SELECT)
- - media = 2;
- - else
- - media = 1;
- -
- - if_string = interfaces[media - 1];
- -
- - /* now, reset the chip, and put it into a known state */
- - smc_reset(smc9000_base);
- -
- - printf("%s rev:%d I/O port:%hX Interface:%s RAM:%d bytes \n",
- - version_string, revision & 0xF,
- - smc9000_base, if_string, memory );
- - /*
- - * Print the Ethernet address
- - */
- - printf("Ethernet MAC address: %!\n", nic->node_addr);
- -
- - SMC_SELECT_BANK(smc9000_base, 0);
- -
- - /* see the header file for options in TCR/RCR NORMAL*/
- - _outw(TCR_NORMAL, smc9000_base + TCR);
- - _outw(RCR_NORMAL, smc9000_base + RCR);
- -
- - /* Select which interface to use */
- - SMC_SELECT_BANK(smc9000_base, 1);
- - if ( media == 1 ) {
- - _outw( inw( smc9000_base + CONFIG ) & ~CFG_AUI_SELECT,
- - smc9000_base + CONFIG );
- - }
- - else if ( media == 2 ) {
- - _outw( inw( smc9000_base + CONFIG ) | CFG_AUI_SELECT,
- - smc9000_base + CONFIG );
- - }
- -
- - nic->reset = smc9000_reset;
- - nic->poll = smc9000_poll;
- - nic->transmit = smc9000_transmit;
- - nic->disable = smc9000_disable;
- -
- -
- - return nic;
- -
- -out:
- -#ifdef SMC9000_VERBOSE
- - printf("No SMC9000 adapters found\n");
- -#endif
- - smc9000_base = 0;
- -
- - return (0);
- -}
- -
- -
- -
- diff -Naur grub-0.97.orig/netboot/smc9000.h grub-0.97/netboot/smc9000.h
- --- grub-0.97.orig/netboot/smc9000.h 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/smc9000.h 1970-01-01 00:00:00.000000000 +0000
- @@ -1,205 +0,0 @@
- -/*------------------------------------------------------------------------
- - * smc9000.h
- - *
- - * Copyright (C) 1998 by Daniel Engström
- - * Copyright (C) 1996 by Erik Stahlman
- - *
- - * This software may be used and distributed according to the terms
- - * of the GNU Public License, incorporated herein by reference.
- - *
- - * This file contains register information and access macros for
- - * the SMC91xxx chipset.
- - *
- - * Information contained in this file was obtained from the SMC91C94
- - * manual from SMC. To get a copy, if you really want one, you can find
- - * information under www.smsc.com in the components division.
- - * ( this thanks to advice from Donald Becker ).
- - *
- - * Authors
- - * Daniel Engström <daniel.engstrom@riksnett.no>
- - * Erik Stahlman <erik@vt.edu>
- - *
- - * History
- - * 96-01-06 Erik Stahlman moved definitions here from main .c
- - * file
- - * 96-01-19 Erik Stahlman polished this up some, and added
- - * better error handling
- - * 98-09-25 Daniel Engström adjusted for Etherboot
- - * 98-09-27 Daniel Engström moved some static strings back to the
- - * main .c file
- - * --------------------------------------------------------------------------*/
- -#ifndef _SMC9000_H_
- -# define _SMC9000_H_
- -
- -/* I want some simple types */
- -typedef unsigned char byte;
- -typedef unsigned short word;
- -typedef unsigned long int dword;
- -
- -/*---------------------------------------------------------------
- - *
- - * A description of the SMC registers is probably in order here,
- - * although for details, the SMC datasheet is invaluable.
- - *
- - * Basically, the chip has 4 banks of registers ( 0 to 3 ), which
- - * are accessed by writing a number into the BANK_SELECT register
- - * ( I also use a SMC_SELECT_BANK macro for this ).
- - *
- - * The banks are configured so that for most purposes, bank 2 is all
- - * that is needed for simple run time tasks.
- - * ----------------------------------------------------------------------*/
- -
- -/*
- - * Bank Select Register:
- - *
- - * yyyy yyyy 0000 00xx
- - * xx = bank number
- - * yyyy yyyy = 0x33, for identification purposes.
- - */
- -#define BANK_SELECT 14
- -
- -/* BANK 0 */
- -
- -#define TCR 0 /* transmit control register */
- -#define TCR_ENABLE 0x0001 /* if this is 1, we can transmit */
- -#define TCR_FDUPLX 0x0800 /* receive packets sent out */
- -#define TCR_STP_SQET 0x1000 /* stop transmitting if Signal quality error */
- -#define TCR_MON_CNS 0x0400 /* monitors the carrier status */
- -#define TCR_PAD_ENABLE 0x0080 /* pads short packets to 64 bytes */
- -
- -#define TCR_CLEAR 0 /* do NOTHING */
- -/* the normal settings for the TCR register : */
- -#define TCR_NORMAL (TCR_ENABLE | TCR_PAD_ENABLE)
- -
- -
- -#define EPH_STATUS 2
- -#define ES_LINK_OK 0x4000 /* is the link integrity ok ? */
- -
- -#define RCR 4
- -#define RCR_SOFTRESET 0x8000 /* resets the chip */
- -#define RCR_STRIP_CRC 0x200 /* strips CRC */
- -#define RCR_ENABLE 0x100 /* IFF this is set, we can receive packets */
- -#define RCR_ALMUL 0x4 /* receive all multicast packets */
- -#define RCR_PROMISC 0x2 /* enable promiscuous mode */
- -
- -/* the normal settings for the RCR register : */
- -#define RCR_NORMAL (RCR_STRIP_CRC | RCR_ENABLE)
- -#define RCR_CLEAR 0x0 /* set it to a base state */
- -
- -#define COUNTER 6
- -#define MIR 8
- -#define MCR 10
- -/* 12 is reserved */
- -
- -/* BANK 1 */
- -#define CONFIG 0
- -#define CFG_AUI_SELECT 0x100
- -#define BASE 2
- -#define ADDR0 4
- -#define ADDR1 6
- -#define ADDR2 8
- -#define GENERAL 10
- -#define CONTROL 12
- -#define CTL_POWERDOWN 0x2000
- -#define CTL_LE_ENABLE 0x80
- -#define CTL_CR_ENABLE 0x40
- -#define CTL_TE_ENABLE 0x0020
- -#define CTL_AUTO_RELEASE 0x0800
- -#define CTL_EPROM_ACCESS 0x0003 /* high if Eprom is being read */
- -
- -/* BANK 2 */
- -#define MMU_CMD 0
- -#define MC_BUSY 1 /* only readable bit in the register */
- -#define MC_NOP 0
- -#define MC_ALLOC 0x20 /* or with number of 256 byte packets */
- -#define MC_RESET 0x40
- -#define MC_REMOVE 0x60 /* remove the current rx packet */
- -#define MC_RELEASE 0x80 /* remove and release the current rx packet */
- -#define MC_FREEPKT 0xA0 /* Release packet in PNR register */
- -#define MC_ENQUEUE 0xC0 /* Enqueue the packet for transmit */
- -
- -#define PNR_ARR 2
- -#define FIFO_PORTS 4
- -
- -#define FP_RXEMPTY 0x8000
- -#define FP_TXEMPTY 0x80
- -
- -#define POINTER 6
- -#define PTR_READ 0x2000
- -#define PTR_RCV 0x8000
- -#define PTR_AUTOINC 0x4000
- -#define PTR_AUTO_INC 0x0040
- -
- -#define DATA_1 8
- -#define DATA_2 10
- -#define INTERRUPT 12
- -
- -#define INT_MASK 13
- -#define IM_RCV_INT 0x1
- -#define IM_TX_INT 0x2
- -#define IM_TX_EMPTY_INT 0x4
- -#define IM_ALLOC_INT 0x8
- -#define IM_RX_OVRN_INT 0x10
- -#define IM_EPH_INT 0x20
- -#define IM_ERCV_INT 0x40 /* not on SMC9192 */
- -
- -/* BANK 3 */
- -#define MULTICAST1 0
- -#define MULTICAST2 2
- -#define MULTICAST3 4
- -#define MULTICAST4 6
- -#define MGMT 8
- -#define REVISION 10 /* ( hi: chip id low: rev # ) */
- -
- -
- -/* this is NOT on SMC9192 */
- -#define ERCV 12
- -
- -/* Note that 9194 and 9196 have the smame chip id,
- - * the 9196 will have revisions starting at 6 */
- -#define CHIP_9190 3
- -#define CHIP_9194 4
- -#define CHIP_9195 5
- -#define CHIP_9196 4
- -#define CHIP_91100 7
- -#define CHIP_91100FD 8
- -
- -#define REV_9196 6
- -
- -/*
- - * Transmit status bits
- - */
- -#define TS_SUCCESS 0x0001
- -#define TS_LOSTCAR 0x0400
- -#define TS_LATCOL 0x0200
- -#define TS_16COL 0x0010
- -
- -/*
- - * Receive status bits
- - */
- -#define RS_ALGNERR 0x8000
- -#define RS_BADCRC 0x2000
- -#define RS_ODDFRAME 0x1000
- -#define RS_TOOLONG 0x0800
- -#define RS_TOOSHORT 0x0400
- -#define RS_MULTICAST 0x0001
- -#define RS_ERRORS (RS_ALGNERR | RS_BADCRC | RS_TOOLONG | RS_TOOSHORT)
- -
- -
- -/*-------------------------------------------------------------------------
- - * I define some macros to make it easier to do somewhat common
- - * or slightly complicated, repeated tasks.
- - --------------------------------------------------------------------------*/
- -
- -/* select a register bank, 0 to 3 */
- -
- -#define SMC_SELECT_BANK(x, y) { _outw( y, x + BANK_SELECT ); }
- -
- -/* define a small delay for the reset */
- -#define SMC_DELAY(x) { inw( x + RCR );\
- - inw( x + RCR );\
- - inw( x + RCR ); }
- -
- -
- -#endif /* _SMC_9000_H_ */
- -
- diff -Naur grub-0.97.orig/netboot/stdint.h grub-0.97/netboot/stdint.h
- --- grub-0.97.orig/netboot/stdint.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/stdint.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,18 @@
- +#ifndef STDINT_H
- +#define STDINT_H
- +/*
- + * I'm architecture depended. Check me before port GRUB
- + */
- +typedef unsigned size_t;
- +
- +typedef unsigned char uint8_t;
- +typedef unsigned short uint16_t;
- +typedef unsigned long uint32_t;
- +typedef unsigned long long uint64_t;
- +
- +typedef signed char int8_t;
- +typedef signed short int16_t;
- +typedef signed long int32_t;
- +typedef signed long long int64_t;
- +
- +#endif /* STDINT_H */
- diff -Naur grub-0.97.orig/netboot/tftp.h grub-0.97/netboot/tftp.h
- --- grub-0.97.orig/netboot/tftp.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/tftp.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,82 @@
- +#ifndef _TFTP_H
- +#define _TFTP_H
- +
- +#include "if_ether.h"
- +#include "ip.h"
- +#include "udp.h"
- +
- +#ifndef MAX_TFTP_RETRIES
- +#define MAX_TFTP_RETRIES 20
- +#endif
- +
- +/* These settings have sense only if compiled with -DCONGESTED */
- +/* total retransmission timeout in ticks */
- +#define TFTP_TIMEOUT (30*TICKS_PER_SEC)
- +/* packet retransmission timeout in ticks */
- +#define TFTP_REXMT (3*TICKS_PER_SEC)
- +
- +#define TFTP_PORT 69
- +#define TFTP_DEFAULTSIZE_PACKET 512
- +#define TFTP_MAX_PACKET 1432 /* 512 */
- +
- +#define TFTP_RRQ 1
- +#define TFTP_WRQ 2
- +#define TFTP_DATA 3
- +#define TFTP_ACK 4
- +#define TFTP_ERROR 5
- +#define TFTP_OACK 6
- +
- +#define TFTP_CODE_EOF 1
- +#define TFTP_CODE_MORE 2
- +#define TFTP_CODE_ERROR 3
- +#define TFTP_CODE_BOOT 4
- +#define TFTP_CODE_CFG 5
- +
- +struct tftp_t {
- + struct iphdr ip;
- + struct udphdr udp;
- + uint16_t opcode;
- + union {
- + uint8_t rrq[TFTP_DEFAULTSIZE_PACKET];
- + struct {
- + uint16_t block;
- + uint8_t download[TFTP_MAX_PACKET];
- + } data;
- + struct {
- + uint16_t block;
- + } ack;
- + struct {
- + uint16_t errcode;
- + uint8_t errmsg[TFTP_DEFAULTSIZE_PACKET];
- + } err;
- + struct {
- + uint8_t data[TFTP_DEFAULTSIZE_PACKET+2];
- + } oack;
- + } u;
- +};
- +
- +/* define a smaller tftp packet solely for making requests to conserve stack
- + 512 bytes should be enough */
- +struct tftpreq_t {
- + struct iphdr ip;
- + struct udphdr udp;
- + uint16_t opcode;
- + union {
- + uint8_t rrq[512];
- + struct {
- + uint16_t block;
- + } ack;
- + struct {
- + uint16_t errcode;
- + uint8_t errmsg[512-2];
- + } err;
- + } u;
- +};
- +
- +#define TFTP_MIN_PACKET (sizeof(struct iphdr) + sizeof(struct udphdr) + 4)
- +
- +typedef int (*read_actor_t)(unsigned char *, unsigned int, unsigned int, int);
- +
- +int tftp_file_read(const char *name, read_actor_t);
- +
- +#endif /* _TFTP_H */
- diff -Naur grub-0.97.orig/netboot/tg3.c grub-0.97/netboot/tg3.c
- --- grub-0.97.orig/netboot/tg3.c 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/tg3.c 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,3322 @@
- +/* $Id: grub-0.95-diskless-patch-2.patch,v 1.1.1.1 2005/06/14 08:18:50 wesolows Exp $
- + * tg3.c: Broadcom Tigon3 ethernet driver.
- + *
- + * Copyright (C) 2001, 2002 David S. Miller (davem@redhat.com)
- + * Copyright (C) 2001, 2002 Jeff Garzik (jgarzik@mandrakesoft.com)
- + * Copyright (C) 2003 Eric Biederman (ebiederman@lnxi.com) [etherboot port]
- + */
- +
- +/* 11-13-2003 timlegge Fix Issue with NetGear GA302T
- + * 11-18-2003 ebiederm Generalize NetGear Fix to what the code was supposed to be.
- + */
- +
- +#include "etherboot.h"
- +#include "nic.h"
- +#include "pci.h"
- +#include "timer.h"
- +/*#include "string.h"*/
- +#include "tg3.h"
- +
- +#define SUPPORT_COPPER_PHY 1
- +#define SUPPORT_FIBER_PHY 1
- +#define SUPPORT_LINK_REPORT 1
- +#define SUPPORT_PARTNO_STR 1
- +#define SUPPORT_PHY_STR 1
- +
- +struct tg3 tg3;
- +
- +/* Dummy defines for error handling */
- +#define EBUSY 1
- +#define ENODEV 2
- +#define EINVAL 3
- +#define ENOMEM 4
- +
- +
- +/* These numbers seem to be hard coded in the NIC firmware somehow.
- + * You can't change the ring sizes, but you can change where you place
- + * them in the NIC onboard memory.
- + */
- +#define TG3_RX_RING_SIZE 512
- +#define TG3_DEF_RX_RING_PENDING 20 /* RX_RING_PENDING seems to be o.k. at 20 and 200 */
- +#define TG3_RX_RCB_RING_SIZE 1024
- +
- +/* (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ? \
- + 512 : 1024) */
- + #define TG3_TX_RING_SIZE 512
- +#define TG3_DEF_TX_RING_PENDING (TG3_TX_RING_SIZE - 1)
- +
- +#define TG3_RX_RING_BYTES (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_RING_SIZE)
- +#define TG3_RX_RCB_RING_BYTES (sizeof(struct tg3_rx_buffer_desc) * TG3_RX_RCB_RING_SIZE)
- +
- +#define TG3_TX_RING_BYTES (sizeof(struct tg3_tx_buffer_desc) * TG3_TX_RING_SIZE)
- +#define NEXT_TX(N) (((N) + 1) & (TG3_TX_RING_SIZE - 1))
- +#define PREV_TX(N) (((N) - 1) & (TG3_TX_RING_SIZE - 1))
- +
- +#define RX_PKT_BUF_SZ (1536 + 2 + 64)
- +
- +
- +static struct bss {
- + struct tg3_rx_buffer_desc rx_std[TG3_RX_RING_SIZE];
- + struct tg3_rx_buffer_desc rx_rcb[TG3_RX_RCB_RING_SIZE];
- + struct tg3_tx_buffer_desc tx_ring[TG3_TX_RING_SIZE];
- + struct tg3_hw_status hw_status;
- + struct tg3_hw_stats hw_stats;
- + unsigned char rx_bufs[TG3_DEF_RX_RING_PENDING][RX_PKT_BUF_SZ];
- +} tg3_bss;
- +
- +/**
- + * pci_save_state - save the PCI configuration space of a device before suspending
- + * @dev: - PCI device that we're dealing with
- + * @buffer: - buffer to hold config space context
- + *
- + * @buffer must be large enough to hold the entire PCI 2.2 config space
- + * (>= 64 bytes).
- + */
- +static int pci_save_state(struct pci_device *dev, uint32_t *buffer)
- +{
- + int i;
- + for (i = 0; i < 16; i++)
- + pci_read_config_dword(dev, i * 4,&buffer[i]);
- + return 0;
- +}
- +
- +/**
- + * pci_restore_state - Restore the saved state of a PCI device
- + * @dev: - PCI device that we're dealing with
- + * @buffer: - saved PCI config space
- + *
- + */
- +static int pci_restore_state(struct pci_device *dev, uint32_t *buffer)
- +{
- + int i;
- +
- + for (i = 0; i < 16; i++)
- + pci_write_config_dword(dev,i * 4, buffer[i]);
- + return 0;
- +}
- +
- +static void tg3_write_indirect_reg32(uint32_t off, uint32_t val)
- +{
- + pci_write_config_dword(tg3.pdev, TG3PCI_REG_BASE_ADDR, off);
- + pci_write_config_dword(tg3.pdev, TG3PCI_REG_DATA, val);
- +}
- +
- +#define tw32(reg,val) tg3_write_indirect_reg32((reg),(val))
- +#define tw32_mailbox(reg, val) writel(((val) & 0xffffffff), tg3.regs + (reg))
- +#define tw16(reg,val) writew(((val) & 0xffff), tg3.regs + (reg))
- +#define tw8(reg,val) writeb(((val) & 0xff), tg3.regs + (reg))
- +#define tr32(reg) readl(tg3.regs + (reg))
- +#define tr16(reg) readw(tg3.regs + (reg))
- +#define tr8(reg) readb(tg3.regs + (reg))
- +
- +static void tw32_carefully(uint32_t reg, uint32_t val)
- +{
- + tw32(reg, val);
- + tr32(reg);
- + udelay(100);
- +}
- +
- +static void tw32_mailbox2(uint32_t reg, uint32_t val)
- +{
- + tw32_mailbox(reg, val);
- + tr32(reg);
- +}
- +
- +static void tg3_write_mem(uint32_t off, uint32_t val)
- +{
- + pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
- + pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_DATA, val);
- +
- + /* Always leave this as zero. */
- + pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
- +}
- +
- +static void tg3_read_mem(uint32_t off, uint32_t *val)
- +{
- + pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, off);
- + pci_read_config_dword(tg3.pdev, TG3PCI_MEM_WIN_DATA, val);
- +
- + /* Always leave this as zero. */
- + pci_write_config_dword(tg3.pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
- +}
- +
- +static void tg3_disable_ints(struct tg3 *tp)
- +{
- + tw32(TG3PCI_MISC_HOST_CTRL,
- + (tp->misc_host_ctrl | MISC_HOST_CTRL_MASK_PCI_INT));
- + tw32_mailbox2(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
- +}
- +
- +static void tg3_switch_clocks(struct tg3 *tp)
- +{
- + uint32_t orig_clock_ctrl, clock_ctrl;
- +
- + clock_ctrl = tr32(TG3PCI_CLOCK_CTRL);
- +
- + orig_clock_ctrl = clock_ctrl;
- + clock_ctrl &= (CLOCK_CTRL_FORCE_CLKRUN | CLOCK_CTRL_CLKRUN_OENABLE | 0x1f);
- + tp->pci_clock_ctrl = clock_ctrl;
- +
- + if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) &&
- + (orig_clock_ctrl & CLOCK_CTRL_44MHZ_CORE)!=0) {
- + tw32_carefully(TG3PCI_CLOCK_CTRL,
- + clock_ctrl | (CLOCK_CTRL_44MHZ_CORE | CLOCK_CTRL_ALTCLK));
- + tw32_carefully(TG3PCI_CLOCK_CTRL,
- + clock_ctrl | (CLOCK_CTRL_ALTCLK));
- + }
- + tw32_carefully(TG3PCI_CLOCK_CTRL, clock_ctrl);
- +}
- +
- +#define PHY_BUSY_LOOPS 5000
- +
- +static int tg3_readphy(struct tg3 *tp, int reg, uint32_t *val)
- +{
- + uint32_t frame_val;
- + int loops, ret;
- +
- + tw32_carefully(MAC_MI_MODE, tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL);
- +
- + *val = 0xffffffff;
- +
- + frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) &
- + MI_COM_PHY_ADDR_MASK);
- + frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) &
- + MI_COM_REG_ADDR_MASK);
- + frame_val |= (MI_COM_CMD_READ | MI_COM_START);
- +
- + tw32_carefully(MAC_MI_COM, frame_val);
- +
- + loops = PHY_BUSY_LOOPS;
- + while (loops-- > 0) {
- + udelay(10);
- + frame_val = tr32(MAC_MI_COM);
- +
- + if ((frame_val & MI_COM_BUSY) == 0) {
- + udelay(5);
- + frame_val = tr32(MAC_MI_COM);
- + break;
- + }
- + }
- +
- + ret = -EBUSY;
- + if (loops > 0) {
- + *val = frame_val & MI_COM_DATA_MASK;
- + ret = 0;
- + }
- +
- + tw32_carefully(MAC_MI_MODE, tp->mi_mode);
- +
- + return ret;
- +}
- +
- +static int tg3_writephy(struct tg3 *tp, int reg, uint32_t val)
- +{
- + uint32_t frame_val;
- + int loops, ret;
- +
- + tw32_carefully(MAC_MI_MODE, tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL);
- +
- + frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) &
- + MI_COM_PHY_ADDR_MASK);
- + frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) &
- + MI_COM_REG_ADDR_MASK);
- + frame_val |= (val & MI_COM_DATA_MASK);
- + frame_val |= (MI_COM_CMD_WRITE | MI_COM_START);
- +
- + tw32_carefully(MAC_MI_COM, frame_val);
- +
- + loops = PHY_BUSY_LOOPS;
- + while (loops-- > 0) {
- + udelay(10);
- + frame_val = tr32(MAC_MI_COM);
- + if ((frame_val & MI_COM_BUSY) == 0) {
- + udelay(5);
- + frame_val = tr32(MAC_MI_COM);
- + break;
- + }
- + }
- +
- + ret = -EBUSY;
- + if (loops > 0)
- + ret = 0;
- +
- + tw32_carefully(MAC_MI_MODE, tp->mi_mode);
- +
- + return ret;
- +}
- +
- +static int tg3_writedsp(struct tg3 *tp, uint16_t addr, uint16_t val)
- +{
- + int err;
- + err = tg3_writephy(tp, MII_TG3_DSP_ADDRESS, addr);
- + err |= tg3_writephy(tp, MII_TG3_DSP_RW_PORT, val);
- + return err;
- +}
- +
- +
- +static void tg3_phy_set_wirespeed(struct tg3 *tp)
- +{
- + uint32_t val;
- +
- + if (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED)
- + return;
- +
- + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x7007);
- + tg3_readphy(tp, MII_TG3_AUX_CTRL, &val);
- + tg3_writephy(tp, MII_TG3_AUX_CTRL, (val | (1 << 15) | (1 << 4)));
- +}
- +
- +static int tg3_bmcr_reset(struct tg3 *tp)
- +{
- + uint32_t phy_control;
- + int limit, err;
- +
- + /* OK, reset it, and poll the BMCR_RESET bit until it
- + * clears or we time out.
- + */
- + phy_control = BMCR_RESET;
- + err = tg3_writephy(tp, MII_BMCR, phy_control);
- + if (err != 0)
- + return -EBUSY;
- +
- + limit = 5000;
- + while (limit--) {
- + err = tg3_readphy(tp, MII_BMCR, &phy_control);
- + if (err != 0)
- + return -EBUSY;
- +
- + if ((phy_control & BMCR_RESET) == 0) {
- + udelay(40);
- + break;
- + }
- + udelay(10);
- + }
- + if (limit <= 0)
- + return -EBUSY;
- +
- + return 0;
- +}
- +
- +static int tg3_wait_macro_done(struct tg3 *tp)
- +{
- + int limit = 100;
- +
- + while (limit--) {
- + uint32_t tmp32;
- +
- + tg3_readphy(tp, 0x16, &tmp32);
- + if ((tmp32 & 0x1000) == 0)
- + break;
- + }
- + if (limit <= 0)
- + return -EBUSY;
- +
- + return 0;
- +}
- +
- +static int tg3_phy_write_and_check_testpat(struct tg3 *tp, int *resetp)
- +{
- + static const uint32_t test_pat[4][6] = {
- + { 0x00005555, 0x00000005, 0x00002aaa, 0x0000000a, 0x00003456, 0x00000003 },
- + { 0x00002aaa, 0x0000000a, 0x00003333, 0x00000003, 0x0000789a, 0x00000005 },
- + { 0x00005a5a, 0x00000005, 0x00002a6a, 0x0000000a, 0x00001bcd, 0x00000003 },
- + { 0x00002a5a, 0x0000000a, 0x000033c3, 0x00000003, 0x00002ef1, 0x00000005 }
- + };
- + int chan;
- +
- + for (chan = 0; chan < 4; chan++) {
- + int i;
- +
- + tg3_writephy(tp, MII_TG3_DSP_ADDRESS,
- + (chan * 0x2000) | 0x0200);
- + tg3_writephy(tp, 0x16, 0x0002);
- +
- + for (i = 0; i < 6; i++)
- + tg3_writephy(tp, MII_TG3_DSP_RW_PORT,
- + test_pat[chan][i]);
- +
- + tg3_writephy(tp, 0x16, 0x0202);
- + if (tg3_wait_macro_done(tp)) {
- + *resetp = 1;
- + return -EBUSY;
- + }
- +
- + tg3_writephy(tp, MII_TG3_DSP_ADDRESS,
- + (chan * 0x2000) | 0x0200);
- + tg3_writephy(tp, 0x16, 0x0082);
- + if (tg3_wait_macro_done(tp)) {
- + *resetp = 1;
- + return -EBUSY;
- + }
- +
- + tg3_writephy(tp, 0x16, 0x0802);
- + if (tg3_wait_macro_done(tp)) {
- + *resetp = 1;
- + return -EBUSY;
- + }
- +
- + for (i = 0; i < 6; i += 2) {
- + uint32_t low, high;
- +
- + tg3_readphy(tp, MII_TG3_DSP_RW_PORT, &low);
- + tg3_readphy(tp, MII_TG3_DSP_RW_PORT, &high);
- + if (tg3_wait_macro_done(tp)) {
- + *resetp = 1;
- + return -EBUSY;
- + }
- + low &= 0x7fff;
- + high &= 0x000f;
- + if (low != test_pat[chan][i] ||
- + high != test_pat[chan][i+1]) {
- + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000b);
- + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x4001);
- + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x4005);
- +
- + return -EBUSY;
- + }
- + }
- + }
- +
- + return 0;
- +}
- +
- +static int tg3_phy_reset_chanpat(struct tg3 *tp)
- +{
- + int chan;
- +
- + for (chan = 0; chan < 4; chan++) {
- + int i;
- +
- + tg3_writephy(tp, MII_TG3_DSP_ADDRESS,
- + (chan * 0x2000) | 0x0200);
- + tg3_writephy(tp, 0x16, 0x0002);
- + for (i = 0; i < 6; i++)
- + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x000);
- + tg3_writephy(tp, 0x16, 0x0202);
- + if (tg3_wait_macro_done(tp))
- + return -EBUSY;
- + }
- +
- + return 0;
- +}
- +
- +static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
- +{
- + uint32_t reg32, phy9_orig;
- + int retries, do_phy_reset, err;
- +
- + retries = 10;
- + do_phy_reset = 1;
- + do {
- + if (do_phy_reset) {
- + err = tg3_bmcr_reset(tp);
- + if (err)
- + return err;
- + do_phy_reset = 0;
- + }
- +
- + /* Disable transmitter and interrupt. */
- + tg3_readphy(tp, MII_TG3_EXT_CTRL, ®32);
- + reg32 |= 0x3000;
- + tg3_writephy(tp, MII_TG3_EXT_CTRL, reg32);
- +
- + /* Set full-duplex, 1000 mbps. */
- + tg3_writephy(tp, MII_BMCR,
- + BMCR_FULLDPLX | TG3_BMCR_SPEED1000);
- +
- + /* Set to master mode. */
- + tg3_readphy(tp, MII_TG3_CTRL, &phy9_orig);
- + tg3_writephy(tp, MII_TG3_CTRL,
- + (MII_TG3_CTRL_AS_MASTER |
- + MII_TG3_CTRL_ENABLE_AS_MASTER));
- +
- + /* Enable SM_DSP_CLOCK and 6dB. */
- + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
- +
- + /* Block the PHY control access. */
- + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8005);
- + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0800);
- +
- + err = tg3_phy_write_and_check_testpat(tp, &do_phy_reset);
- + if (!err)
- + break;
- + } while (--retries);
- +
- + err = tg3_phy_reset_chanpat(tp);
- + if (err)
- + return err;
- +
- + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8005);
- + tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x0000);
- +
- + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200);
- + tg3_writephy(tp, 0x16, 0x0000);
- +
- + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
- +
- + tg3_writephy(tp, MII_TG3_CTRL, phy9_orig);
- +
- + tg3_readphy(tp, MII_TG3_EXT_CTRL, ®32);
- + reg32 &= ~0x3000;
- + tg3_writephy(tp, MII_TG3_EXT_CTRL, reg32);
- +
- + return err;
- +}
- +
- +/* This will reset the tigon3 PHY if there is no valid
- + * link.
- + */
- +static int tg3_phy_reset(struct tg3 *tp)
- +{
- + uint32_t phy_status;
- + int err;
- +
- + err = tg3_readphy(tp, MII_BMSR, &phy_status);
- + err |= tg3_readphy(tp, MII_BMSR, &phy_status);
- + if (err != 0)
- + return -EBUSY;
- +
- + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) ||
- + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
- + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) {
- + err = tg3_phy_reset_5703_4_5(tp);
- + if (err)
- + return err;
- + goto out;
- + }
- + err = tg3_bmcr_reset(tp);
- + if (err)
- + return err;
- + out:
- + tg3_phy_set_wirespeed(tp);
- + return 0;
- +}
- +
- +static void tg3_set_power_state_0(struct tg3 *tp)
- +{
- + uint16_t power_control;
- + int pm = tp->pm_cap;
- +
- + /* Make sure register accesses (indirect or otherwise)
- + * will function correctly.
- + */
- + pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, tp->misc_host_ctrl);
- +
- + pci_read_config_word(tp->pdev, pm + PCI_PM_CTRL, &power_control);
- +
- + power_control |= PCI_PM_CTRL_PME_STATUS;
- + power_control &= ~(PCI_PM_CTRL_STATE_MASK);
- + power_control |= 0;
- + pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control);
- +
- + tw32_carefully(GRC_LOCAL_CTRL, tp->grc_local_ctrl);
- +
- + return;
- +}
- +
- +
- +#if SUPPORT_LINK_REPORT
- +static void tg3_link_report(struct tg3 *tp)
- +{
- + if (!tp->carrier_ok) {
- + printf("Link is down.\n");
- + } else {
- + printf("Link is up at %d Mbps, %s duplex. %s %s %s\n",
- + (tp->link_config.active_speed == SPEED_1000 ?
- + 1000 :
- + (tp->link_config.active_speed == SPEED_100 ?
- + 100 : 10)),
- + (tp->link_config.active_duplex == DUPLEX_FULL ?
- + "full" : "half"),
- + (tp->tg3_flags & TG3_FLAG_TX_PAUSE) ? "TX" : "",
- + (tp->tg3_flags & TG3_FLAG_RX_PAUSE) ? "RX" : "",
- + (tp->tg3_flags & (TG3_FLAG_TX_PAUSE |TG3_FLAG_RX_PAUSE)) ? "flow control" : "");
- + }
- +}
- +#else
- +#define tg3_link_report(tp)
- +#endif
- +
- +static void tg3_setup_flow_control(struct tg3 *tp, uint32_t local_adv, uint32_t remote_adv)
- +{
- + uint32_t new_tg3_flags = 0;
- +
- + if (local_adv & ADVERTISE_PAUSE_CAP) {
- + if (local_adv & ADVERTISE_PAUSE_ASYM) {
- + if (remote_adv & LPA_PAUSE_CAP)
- + new_tg3_flags |=
- + (TG3_FLAG_RX_PAUSE |
- + TG3_FLAG_TX_PAUSE);
- + else if (remote_adv & LPA_PAUSE_ASYM)
- + new_tg3_flags |=
- + (TG3_FLAG_RX_PAUSE);
- + } else {
- + if (remote_adv & LPA_PAUSE_CAP)
- + new_tg3_flags |=
- + (TG3_FLAG_RX_PAUSE |
- + TG3_FLAG_TX_PAUSE);
- + }
- + } else if (local_adv & ADVERTISE_PAUSE_ASYM) {
- + if ((remote_adv & LPA_PAUSE_CAP) &&
- + (remote_adv & LPA_PAUSE_ASYM))
- + new_tg3_flags |= TG3_FLAG_TX_PAUSE;
- + }
- +
- + tp->tg3_flags &= ~(TG3_FLAG_RX_PAUSE | TG3_FLAG_TX_PAUSE);
- + tp->tg3_flags |= new_tg3_flags;
- +
- + if (new_tg3_flags & TG3_FLAG_RX_PAUSE)
- + tp->rx_mode |= RX_MODE_FLOW_CTRL_ENABLE;
- + else
- + tp->rx_mode &= ~RX_MODE_FLOW_CTRL_ENABLE;
- +
- + if (new_tg3_flags & TG3_FLAG_TX_PAUSE)
- + tp->tx_mode |= TX_MODE_FLOW_CTRL_ENABLE;
- + else
- + tp->tx_mode &= ~TX_MODE_FLOW_CTRL_ENABLE;
- +}
- +
- +#if SUPPORT_COPPER_PHY
- +static void tg3_aux_stat_to_speed_duplex(
- + struct tg3 *tp __unused, uint32_t val, uint8_t *speed, uint8_t *duplex)
- +{
- + static const uint8_t map[] = {
- + [0] = (SPEED_INVALID << 2) | DUPLEX_INVALID,
- + [MII_TG3_AUX_STAT_10HALF >> 8] = (SPEED_10 << 2) | DUPLEX_HALF,
- + [MII_TG3_AUX_STAT_10FULL >> 8] = (SPEED_10 << 2) | DUPLEX_FULL,
- + [MII_TG3_AUX_STAT_100HALF >> 8] = (SPEED_100 << 2) | DUPLEX_HALF,
- + [MII_TG3_AUX_STAT_100_4 >> 8] = (SPEED_INVALID << 2) | DUPLEX_INVALID,
- + [MII_TG3_AUX_STAT_100FULL >> 8] = (SPEED_100 << 2) | DUPLEX_FULL,
- + [MII_TG3_AUX_STAT_1000HALF >> 8] = (SPEED_1000 << 2) | DUPLEX_HALF,
- + [MII_TG3_AUX_STAT_1000FULL >> 8] = (SPEED_1000 << 2) | DUPLEX_FULL,
- + };
- + uint8_t result;
- + result = map[(val & MII_TG3_AUX_STAT_SPDMASK) >> 8];
- + *speed = result >> 2;
- + *duplex = result & 3;
- +}
- +
- +static int tg3_phy_copper_begin(struct tg3 *tp)
- +{
- + uint32_t new_adv;
- +
- + tp->link_config.advertising =
- + (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
- + ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
- + ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full |
- + ADVERTISED_Autoneg | ADVERTISED_MII);
- +
- + if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) {
- + tp->link_config.advertising &=
- + ~(ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full);
- + }
- +
- + new_adv = (ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);
- + if (tp->link_config.advertising & ADVERTISED_10baseT_Half) {
- + new_adv |= ADVERTISE_10HALF;
- + }
- + if (tp->link_config.advertising & ADVERTISED_10baseT_Full) {
- + new_adv |= ADVERTISE_10FULL;
- + }
- + if (tp->link_config.advertising & ADVERTISED_100baseT_Half) {
- + new_adv |= ADVERTISE_100HALF;
- + }
- + if (tp->link_config.advertising & ADVERTISED_100baseT_Full) {
- + new_adv |= ADVERTISE_100FULL;
- + }
- + tg3_writephy(tp, MII_ADVERTISE, new_adv);
- +
- + if (tp->link_config.advertising &
- + (ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full)) {
- + new_adv = 0;
- + if (tp->link_config.advertising & ADVERTISED_1000baseT_Half) {
- + new_adv |= MII_TG3_CTRL_ADV_1000_HALF;
- + }
- + if (tp->link_config.advertising & ADVERTISED_1000baseT_Full) {
- + new_adv |= MII_TG3_CTRL_ADV_1000_FULL;
- + }
- + if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY) &&
- + (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 ||
- + tp->pci_chip_rev_id == CHIPREV_ID_5701_B0)) {
- + new_adv |= (MII_TG3_CTRL_AS_MASTER |
- + MII_TG3_CTRL_ENABLE_AS_MASTER);
- + }
- + tg3_writephy(tp, MII_TG3_CTRL, new_adv);
- + } else {
- + tg3_writephy(tp, MII_TG3_CTRL, 0);
- + }
- +
- + tg3_writephy(tp, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART);
- +
- + return 0;
- +}
- +
- +static int tg3_init_5401phy_dsp(struct tg3 *tp)
- +{
- + int err;
- +
- + /* Turn off tap power management. */
- + err = tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c20);
- +
- + err |= tg3_writedsp(tp, 0x0012, 0x1804);
- + err |= tg3_writedsp(tp, 0x0013, 0x1204);
- + err |= tg3_writedsp(tp, 0x8006, 0x0132);
- + err |= tg3_writedsp(tp, 0x8006, 0x0232);
- + err |= tg3_writedsp(tp, 0x201f, 0x0a20);
- +
- + udelay(40);
- +
- + return err;
- +}
- +
- +static int tg3_setup_copper_phy(struct tg3 *tp)
- +{
- + int current_link_up;
- + uint32_t bmsr, dummy;
- + int i, err;
- +
- + tw32_carefully(MAC_STATUS,
- + (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED));
- +
- + tp->mi_mode = MAC_MI_MODE_BASE;
- + tw32_carefully(MAC_MI_MODE, tp->mi_mode);
- +
- + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x02);
- +
- + /* Some third-party PHYs need to be reset on link going
- + * down.
- + */
- + if ( ( (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) ||
- + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
- + (tp->pci_chip_rev_id == CHIPREV_ID_5705_A0)) &&
- + (tp->carrier_ok)) {
- + tg3_readphy(tp, MII_BMSR, &bmsr);
- + tg3_readphy(tp, MII_BMSR, &bmsr);
- + if (!(bmsr & BMSR_LSTATUS))
- + tg3_phy_reset(tp);
- + }
- +
- + if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) {
- + tg3_readphy(tp, MII_BMSR, &bmsr);
- + tg3_readphy(tp, MII_BMSR, &bmsr);
- +
- + if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE))
- + bmsr = 0;
- +
- + if (!(bmsr & BMSR_LSTATUS)) {
- + err = tg3_init_5401phy_dsp(tp);
- + if (err)
- + return err;
- +
- + tg3_readphy(tp, MII_BMSR, &bmsr);
- + for (i = 0; i < 1000; i++) {
- + udelay(10);
- + tg3_readphy(tp, MII_BMSR, &bmsr);
- + if (bmsr & BMSR_LSTATUS) {
- + udelay(40);
- + break;
- + }
- + }
- +
- + if ((tp->phy_id & PHY_ID_REV_MASK) == PHY_REV_BCM5401_B0 &&
- + !(bmsr & BMSR_LSTATUS) &&
- + tp->link_config.active_speed == SPEED_1000) {
- + err = tg3_phy_reset(tp);
- + if (!err)
- + err = tg3_init_5401phy_dsp(tp);
- + if (err)
- + return err;
- + }
- + }
- + } else if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 ||
- + tp->pci_chip_rev_id == CHIPREV_ID_5701_B0) {
- + /* 5701 {A0,B0} CRC bug workaround */
- + tg3_writephy(tp, 0x15, 0x0a75);
- + tg3_writephy(tp, 0x1c, 0x8c68);
- + tg3_writephy(tp, 0x1c, 0x8d68);
- + tg3_writephy(tp, 0x1c, 0x8c68);
- + }
- +
- + /* Clear pending interrupts... */
- + tg3_readphy(tp, MII_TG3_ISTAT, &dummy);
- + tg3_readphy(tp, MII_TG3_ISTAT, &dummy);
- +
- + tg3_writephy(tp, MII_TG3_IMASK, ~0);
- +
- + if (tp->led_mode == led_mode_three_link)
- + tg3_writephy(tp, MII_TG3_EXT_CTRL,
- + MII_TG3_EXT_CTRL_LNK3_LED_MODE);
- + else
- + tg3_writephy(tp, MII_TG3_EXT_CTRL, 0);
- +
- + current_link_up = 0;
- +
- + tg3_readphy(tp, MII_BMSR, &bmsr);
- + tg3_readphy(tp, MII_BMSR, &bmsr);
- +
- + if (bmsr & BMSR_LSTATUS) {
- + uint32_t aux_stat, bmcr;
- +
- + tg3_readphy(tp, MII_TG3_AUX_STAT, &aux_stat);
- + for (i = 0; i < 2000; i++) {
- + udelay(10);
- + tg3_readphy(tp, MII_TG3_AUX_STAT, &aux_stat);
- + if (aux_stat)
- + break;
- + }
- +
- + tg3_aux_stat_to_speed_duplex(tp, aux_stat,
- + &tp->link_config.active_speed,
- + &tp->link_config.active_duplex);
- + tg3_readphy(tp, MII_BMCR, &bmcr);
- + tg3_readphy(tp, MII_BMCR, &bmcr);
- + if (bmcr & BMCR_ANENABLE) {
- + uint32_t gig_ctrl;
- +
- + current_link_up = 1;
- +
- + /* Force autoneg restart if we are exiting
- + * low power mode.
- + */
- + tg3_readphy(tp, MII_TG3_CTRL, &gig_ctrl);
- + if (!(gig_ctrl & (MII_TG3_CTRL_ADV_1000_HALF |
- + MII_TG3_CTRL_ADV_1000_FULL))) {
- + current_link_up = 0;
- + }
- + } else {
- + current_link_up = 0;
- + }
- + }
- +
- + if (current_link_up == 1 &&
- + (tp->link_config.active_duplex == DUPLEX_FULL)) {
- + uint32_t local_adv, remote_adv;
- +
- + tg3_readphy(tp, MII_ADVERTISE, &local_adv);
- + local_adv &= (ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM);
- +
- + tg3_readphy(tp, MII_LPA, &remote_adv);
- + remote_adv &= (LPA_PAUSE_CAP | LPA_PAUSE_ASYM);
- +
- + /* If we are not advertising full pause capability,
- + * something is wrong. Bring the link down and reconfigure.
- + */
- + if (local_adv != ADVERTISE_PAUSE_CAP) {
- + current_link_up = 0;
- + } else {
- + tg3_setup_flow_control(tp, local_adv, remote_adv);
- + }
- + }
- +
- + if (current_link_up == 0) {
- + uint32_t tmp;
- +
- + tg3_phy_copper_begin(tp);
- +
- + tg3_readphy(tp, MII_BMSR, &tmp);
- + tg3_readphy(tp, MII_BMSR, &tmp);
- + if (tmp & BMSR_LSTATUS)
- + current_link_up = 1;
- + }
- +
- + tp->mac_mode &= ~MAC_MODE_PORT_MODE_MASK;
- + if (current_link_up == 1) {
- + if (tp->link_config.active_speed == SPEED_100 ||
- + tp->link_config.active_speed == SPEED_10)
- + tp->mac_mode |= MAC_MODE_PORT_MODE_MII;
- + else
- + tp->mac_mode |= MAC_MODE_PORT_MODE_GMII;
- + } else
- + tp->mac_mode |= MAC_MODE_PORT_MODE_GMII;
- +
- + tp->mac_mode &= ~MAC_MODE_HALF_DUPLEX;
- + if (tp->link_config.active_duplex == DUPLEX_HALF)
- + tp->mac_mode |= MAC_MODE_HALF_DUPLEX;
- +
- + tp->mac_mode &= ~MAC_MODE_LINK_POLARITY;
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) {
- + if ((tp->led_mode == led_mode_link10) ||
- + (current_link_up == 1 &&
- + tp->link_config.active_speed == SPEED_10))
- + tp->mac_mode |= MAC_MODE_LINK_POLARITY;
- + } else {
- + if (current_link_up == 1)
- + tp->mac_mode |= MAC_MODE_LINK_POLARITY;
- + tw32(MAC_LED_CTRL, LED_CTRL_PHY_MODE_1);
- + }
- +
- + /* ??? Without this setting Netgear GA302T PHY does not
- + * ??? send/receive packets...
- + * With this other PHYs cannot bring up the link
- + */
- + if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5411 &&
- + tp->pci_chip_rev_id == CHIPREV_ID_5700_ALTIMA) {
- + tp->mi_mode |= MAC_MI_MODE_AUTO_POLL;
- + tw32_carefully(MAC_MI_MODE, tp->mi_mode);
- + }
- +
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- +
- + /* Link change polled. */
- + tw32_carefully(MAC_EVENT, 0);
- +
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 &&
- + current_link_up == 1 &&
- + tp->link_config.active_speed == SPEED_1000 &&
- + ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ||
- + (tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED))) {
- + udelay(120);
- + tw32_carefully(MAC_STATUS,
- + (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED));
- + tg3_write_mem(
- + NIC_SRAM_FIRMWARE_MBOX,
- + NIC_SRAM_FIRMWARE_MBOX_MAGIC2);
- + }
- +
- + if (current_link_up != tp->carrier_ok) {
- + tp->carrier_ok = current_link_up;
- + tg3_link_report(tp);
- + }
- +
- + return 0;
- +}
- +#else
- +#define tg3_setup_copper_phy(TP) (-EINVAL)
- +#endif /* SUPPORT_COPPER_PHY */
- +
- +#if SUPPORT_FIBER_PHY
- +struct tg3_fiber_aneginfo {
- + int state;
- +#define ANEG_STATE_UNKNOWN 0
- +#define ANEG_STATE_AN_ENABLE 1
- +#define ANEG_STATE_RESTART_INIT 2
- +#define ANEG_STATE_RESTART 3
- +#define ANEG_STATE_DISABLE_LINK_OK 4
- +#define ANEG_STATE_ABILITY_DETECT_INIT 5
- +#define ANEG_STATE_ABILITY_DETECT 6
- +#define ANEG_STATE_ACK_DETECT_INIT 7
- +#define ANEG_STATE_ACK_DETECT 8
- +#define ANEG_STATE_COMPLETE_ACK_INIT 9
- +#define ANEG_STATE_COMPLETE_ACK 10
- +#define ANEG_STATE_IDLE_DETECT_INIT 11
- +#define ANEG_STATE_IDLE_DETECT 12
- +#define ANEG_STATE_LINK_OK 13
- +#define ANEG_STATE_NEXT_PAGE_WAIT_INIT 14
- +#define ANEG_STATE_NEXT_PAGE_WAIT 15
- +
- + uint32_t flags;
- +#define MR_AN_ENABLE 0x00000001
- +#define MR_RESTART_AN 0x00000002
- +#define MR_AN_COMPLETE 0x00000004
- +#define MR_PAGE_RX 0x00000008
- +#define MR_NP_LOADED 0x00000010
- +#define MR_TOGGLE_TX 0x00000020
- +#define MR_LP_ADV_FULL_DUPLEX 0x00000040
- +#define MR_LP_ADV_HALF_DUPLEX 0x00000080
- +#define MR_LP_ADV_SYM_PAUSE 0x00000100
- +#define MR_LP_ADV_ASYM_PAUSE 0x00000200
- +#define MR_LP_ADV_REMOTE_FAULT1 0x00000400
- +#define MR_LP_ADV_REMOTE_FAULT2 0x00000800
- +#define MR_LP_ADV_NEXT_PAGE 0x00001000
- +#define MR_TOGGLE_RX 0x00002000
- +#define MR_NP_RX 0x00004000
- +
- +#define MR_LINK_OK 0x80000000
- +
- + unsigned long link_time, cur_time;
- +
- + uint32_t ability_match_cfg;
- + int ability_match_count;
- +
- + char ability_match, idle_match, ack_match;
- +
- + uint32_t txconfig, rxconfig;
- +#define ANEG_CFG_NP 0x00000080
- +#define ANEG_CFG_ACK 0x00000040
- +#define ANEG_CFG_RF2 0x00000020
- +#define ANEG_CFG_RF1 0x00000010
- +#define ANEG_CFG_PS2 0x00000001
- +#define ANEG_CFG_PS1 0x00008000
- +#define ANEG_CFG_HD 0x00004000
- +#define ANEG_CFG_FD 0x00002000
- +#define ANEG_CFG_INVAL 0x00001f06
- +
- +};
- +#define ANEG_OK 0
- +#define ANEG_DONE 1
- +#define ANEG_TIMER_ENAB 2
- +#define ANEG_FAILED -1
- +
- +#define ANEG_STATE_SETTLE_TIME 10000
- +
- +static int tg3_fiber_aneg_smachine(struct tg3 *tp,
- + struct tg3_fiber_aneginfo *ap)
- +{
- + unsigned long delta;
- + uint32_t rx_cfg_reg;
- + int ret;
- +
- + if (ap->state == ANEG_STATE_UNKNOWN) {
- + ap->rxconfig = 0;
- + ap->link_time = 0;
- + ap->cur_time = 0;
- + ap->ability_match_cfg = 0;
- + ap->ability_match_count = 0;
- + ap->ability_match = 0;
- + ap->idle_match = 0;
- + ap->ack_match = 0;
- + }
- + ap->cur_time++;
- +
- + if (tr32(MAC_STATUS) & MAC_STATUS_RCVD_CFG) {
- + rx_cfg_reg = tr32(MAC_RX_AUTO_NEG);
- +
- + if (rx_cfg_reg != ap->ability_match_cfg) {
- + ap->ability_match_cfg = rx_cfg_reg;
- + ap->ability_match = 0;
- + ap->ability_match_count = 0;
- + } else {
- + if (++ap->ability_match_count > 1) {
- + ap->ability_match = 1;
- + ap->ability_match_cfg = rx_cfg_reg;
- + }
- + }
- + if (rx_cfg_reg & ANEG_CFG_ACK)
- + ap->ack_match = 1;
- + else
- + ap->ack_match = 0;
- +
- + ap->idle_match = 0;
- + } else {
- + ap->idle_match = 1;
- + ap->ability_match_cfg = 0;
- + ap->ability_match_count = 0;
- + ap->ability_match = 0;
- + ap->ack_match = 0;
- +
- + rx_cfg_reg = 0;
- + }
- +
- + ap->rxconfig = rx_cfg_reg;
- + ret = ANEG_OK;
- +
- + switch(ap->state) {
- + case ANEG_STATE_UNKNOWN:
- + if (ap->flags & (MR_AN_ENABLE | MR_RESTART_AN))
- + ap->state = ANEG_STATE_AN_ENABLE;
- +
- + /* fallthru */
- + case ANEG_STATE_AN_ENABLE:
- + ap->flags &= ~(MR_AN_COMPLETE | MR_PAGE_RX);
- + if (ap->flags & MR_AN_ENABLE) {
- + ap->link_time = 0;
- + ap->cur_time = 0;
- + ap->ability_match_cfg = 0;
- + ap->ability_match_count = 0;
- + ap->ability_match = 0;
- + ap->idle_match = 0;
- + ap->ack_match = 0;
- +
- + ap->state = ANEG_STATE_RESTART_INIT;
- + } else {
- + ap->state = ANEG_STATE_DISABLE_LINK_OK;
- + }
- + break;
- +
- + case ANEG_STATE_RESTART_INIT:
- + ap->link_time = ap->cur_time;
- + ap->flags &= ~(MR_NP_LOADED);
- + ap->txconfig = 0;
- + tw32(MAC_TX_AUTO_NEG, 0);
- + tp->mac_mode |= MAC_MODE_SEND_CONFIGS;
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- +
- + ret = ANEG_TIMER_ENAB;
- + ap->state = ANEG_STATE_RESTART;
- +
- + /* fallthru */
- + case ANEG_STATE_RESTART:
- + delta = ap->cur_time - ap->link_time;
- + if (delta > ANEG_STATE_SETTLE_TIME) {
- + ap->state = ANEG_STATE_ABILITY_DETECT_INIT;
- + } else {
- + ret = ANEG_TIMER_ENAB;
- + }
- + break;
- +
- + case ANEG_STATE_DISABLE_LINK_OK:
- + ret = ANEG_DONE;
- + break;
- +
- + case ANEG_STATE_ABILITY_DETECT_INIT:
- + ap->flags &= ~(MR_TOGGLE_TX);
- + ap->txconfig = (ANEG_CFG_FD | ANEG_CFG_PS1);
- + tw32(MAC_TX_AUTO_NEG, ap->txconfig);
- + tp->mac_mode |= MAC_MODE_SEND_CONFIGS;
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- +
- + ap->state = ANEG_STATE_ABILITY_DETECT;
- + break;
- +
- + case ANEG_STATE_ABILITY_DETECT:
- + if (ap->ability_match != 0 && ap->rxconfig != 0) {
- + ap->state = ANEG_STATE_ACK_DETECT_INIT;
- + }
- + break;
- +
- + case ANEG_STATE_ACK_DETECT_INIT:
- + ap->txconfig |= ANEG_CFG_ACK;
- + tw32(MAC_TX_AUTO_NEG, ap->txconfig);
- + tp->mac_mode |= MAC_MODE_SEND_CONFIGS;
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- +
- + ap->state = ANEG_STATE_ACK_DETECT;
- +
- + /* fallthru */
- + case ANEG_STATE_ACK_DETECT:
- + if (ap->ack_match != 0) {
- + if ((ap->rxconfig & ~ANEG_CFG_ACK) ==
- + (ap->ability_match_cfg & ~ANEG_CFG_ACK)) {
- + ap->state = ANEG_STATE_COMPLETE_ACK_INIT;
- + } else {
- + ap->state = ANEG_STATE_AN_ENABLE;
- + }
- + } else if (ap->ability_match != 0 &&
- + ap->rxconfig == 0) {
- + ap->state = ANEG_STATE_AN_ENABLE;
- + }
- + break;
- +
- + case ANEG_STATE_COMPLETE_ACK_INIT:
- + if (ap->rxconfig & ANEG_CFG_INVAL) {
- + ret = ANEG_FAILED;
- + break;
- + }
- + ap->flags &= ~(MR_LP_ADV_FULL_DUPLEX |
- + MR_LP_ADV_HALF_DUPLEX |
- + MR_LP_ADV_SYM_PAUSE |
- + MR_LP_ADV_ASYM_PAUSE |
- + MR_LP_ADV_REMOTE_FAULT1 |
- + MR_LP_ADV_REMOTE_FAULT2 |
- + MR_LP_ADV_NEXT_PAGE |
- + MR_TOGGLE_RX |
- + MR_NP_RX);
- + if (ap->rxconfig & ANEG_CFG_FD)
- + ap->flags |= MR_LP_ADV_FULL_DUPLEX;
- + if (ap->rxconfig & ANEG_CFG_HD)
- + ap->flags |= MR_LP_ADV_HALF_DUPLEX;
- + if (ap->rxconfig & ANEG_CFG_PS1)
- + ap->flags |= MR_LP_ADV_SYM_PAUSE;
- + if (ap->rxconfig & ANEG_CFG_PS2)
- + ap->flags |= MR_LP_ADV_ASYM_PAUSE;
- + if (ap->rxconfig & ANEG_CFG_RF1)
- + ap->flags |= MR_LP_ADV_REMOTE_FAULT1;
- + if (ap->rxconfig & ANEG_CFG_RF2)
- + ap->flags |= MR_LP_ADV_REMOTE_FAULT2;
- + if (ap->rxconfig & ANEG_CFG_NP)
- + ap->flags |= MR_LP_ADV_NEXT_PAGE;
- +
- + ap->link_time = ap->cur_time;
- +
- + ap->flags ^= (MR_TOGGLE_TX);
- + if (ap->rxconfig & 0x0008)
- + ap->flags |= MR_TOGGLE_RX;
- + if (ap->rxconfig & ANEG_CFG_NP)
- + ap->flags |= MR_NP_RX;
- + ap->flags |= MR_PAGE_RX;
- +
- + ap->state = ANEG_STATE_COMPLETE_ACK;
- + ret = ANEG_TIMER_ENAB;
- + break;
- +
- + case ANEG_STATE_COMPLETE_ACK:
- + if (ap->ability_match != 0 &&
- + ap->rxconfig == 0) {
- + ap->state = ANEG_STATE_AN_ENABLE;
- + break;
- + }
- + delta = ap->cur_time - ap->link_time;
- + if (delta > ANEG_STATE_SETTLE_TIME) {
- + if (!(ap->flags & (MR_LP_ADV_NEXT_PAGE))) {
- + ap->state = ANEG_STATE_IDLE_DETECT_INIT;
- + } else {
- + if ((ap->txconfig & ANEG_CFG_NP) == 0 &&
- + !(ap->flags & MR_NP_RX)) {
- + ap->state = ANEG_STATE_IDLE_DETECT_INIT;
- + } else {
- + ret = ANEG_FAILED;
- + }
- + }
- + }
- + break;
- +
- + case ANEG_STATE_IDLE_DETECT_INIT:
- + ap->link_time = ap->cur_time;
- + tp->mac_mode &= ~MAC_MODE_SEND_CONFIGS;
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- +
- + ap->state = ANEG_STATE_IDLE_DETECT;
- + ret = ANEG_TIMER_ENAB;
- + break;
- +
- + case ANEG_STATE_IDLE_DETECT:
- + if (ap->ability_match != 0 &&
- + ap->rxconfig == 0) {
- + ap->state = ANEG_STATE_AN_ENABLE;
- + break;
- + }
- + delta = ap->cur_time - ap->link_time;
- + if (delta > ANEG_STATE_SETTLE_TIME) {
- + /* XXX another gem from the Broadcom driver :( */
- + ap->state = ANEG_STATE_LINK_OK;
- + }
- + break;
- +
- + case ANEG_STATE_LINK_OK:
- + ap->flags |= (MR_AN_COMPLETE | MR_LINK_OK);
- + ret = ANEG_DONE;
- + break;
- +
- + case ANEG_STATE_NEXT_PAGE_WAIT_INIT:
- + /* ??? unimplemented */
- + break;
- +
- + case ANEG_STATE_NEXT_PAGE_WAIT:
- + /* ??? unimplemented */
- + break;
- +
- + default:
- + ret = ANEG_FAILED;
- + break;
- + };
- +
- + return ret;
- +}
- +
- +static int tg3_setup_fiber_phy(struct tg3 *tp)
- +{
- + uint32_t orig_pause_cfg;
- + uint16_t orig_active_speed;
- + uint8_t orig_active_duplex;
- + int current_link_up;
- + int i;
- +
- + orig_pause_cfg =
- + (tp->tg3_flags & (TG3_FLAG_RX_PAUSE |
- + TG3_FLAG_TX_PAUSE));
- + orig_active_speed = tp->link_config.active_speed;
- + orig_active_duplex = tp->link_config.active_duplex;
- +
- + tp->mac_mode &= ~(MAC_MODE_PORT_MODE_MASK | MAC_MODE_HALF_DUPLEX);
- + tp->mac_mode |= MAC_MODE_PORT_MODE_TBI;
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- +
- + /* Reset when initting first time or we have a link. */
- + if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) ||
- + (tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED)) {
- + /* Set PLL lock range. */
- + tg3_writephy(tp, 0x16, 0x8007);
- +
- + /* SW reset */
- + tg3_writephy(tp, MII_BMCR, BMCR_RESET);
- +
- + /* Wait for reset to complete. */
- + mdelay(5);
- +
- + /* Config mode; select PMA/Ch 1 regs. */
- + tg3_writephy(tp, 0x10, 0x8411);
- +
- + /* Enable auto-lock and comdet, select txclk for tx. */
- + tg3_writephy(tp, 0x11, 0x0a10);
- +
- + tg3_writephy(tp, 0x18, 0x00a0);
- + tg3_writephy(tp, 0x16, 0x41ff);
- +
- + /* Assert and deassert POR. */
- + tg3_writephy(tp, 0x13, 0x0400);
- + udelay(40);
- + tg3_writephy(tp, 0x13, 0x0000);
- +
- + tg3_writephy(tp, 0x11, 0x0a50);
- + udelay(40);
- + tg3_writephy(tp, 0x11, 0x0a10);
- +
- + /* Wait for signal to stabilize */
- + mdelay(150);
- +
- + /* Deselect the channel register so we can read the PHYID
- + * later.
- + */
- + tg3_writephy(tp, 0x10, 0x8011);
- + }
- +
- + /* Disable link change interrupt. */
- + tw32_carefully(MAC_EVENT, 0);
- +
- + current_link_up = 0;
- + if (tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED) {
- + if (!(tp->tg3_flags & TG3_FLAG_GOT_SERDES_FLOWCTL)) {
- + struct tg3_fiber_aneginfo aninfo;
- + int status = ANEG_FAILED;
- + unsigned int tick;
- + uint32_t tmp;
- +
- + memset(&aninfo, 0, sizeof(aninfo));
- + aninfo.flags |= (MR_AN_ENABLE);
- +
- + tw32(MAC_TX_AUTO_NEG, 0);
- +
- + tmp = tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK;
- + tw32_carefully(MAC_MODE, tmp | MAC_MODE_PORT_MODE_GMII);
- +
- + tw32_carefully(MAC_MODE, tp->mac_mode | MAC_MODE_SEND_CONFIGS);
- +
- + aninfo.state = ANEG_STATE_UNKNOWN;
- + aninfo.cur_time = 0;
- + tick = 0;
- + while (++tick < 195000) {
- + status = tg3_fiber_aneg_smachine(tp, &aninfo);
- + if (status == ANEG_DONE ||
- + status == ANEG_FAILED)
- + break;
- +
- + udelay(1);
- + }
- +
- + tp->mac_mode &= ~MAC_MODE_SEND_CONFIGS;
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- +
- + if (status == ANEG_DONE &&
- + (aninfo.flags &
- + (MR_AN_COMPLETE | MR_LINK_OK |
- + MR_LP_ADV_FULL_DUPLEX))) {
- + uint32_t local_adv, remote_adv;
- +
- + local_adv = ADVERTISE_PAUSE_CAP;
- + remote_adv = 0;
- + if (aninfo.flags & MR_LP_ADV_SYM_PAUSE)
- + remote_adv |= LPA_PAUSE_CAP;
- + if (aninfo.flags & MR_LP_ADV_ASYM_PAUSE)
- + remote_adv |= LPA_PAUSE_ASYM;
- +
- + tg3_setup_flow_control(tp, local_adv, remote_adv);
- +
- + tp->tg3_flags |=
- + TG3_FLAG_GOT_SERDES_FLOWCTL;
- + current_link_up = 1;
- + }
- + for (i = 0; i < 60; i++) {
- + udelay(20);
- + tw32_carefully(MAC_STATUS,
- + (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED));
- + if ((tr32(MAC_STATUS) &
- + (MAC_STATUS_SYNC_CHANGED |
- + MAC_STATUS_CFG_CHANGED)) == 0)
- + break;
- + }
- + if (current_link_up == 0 &&
- + (tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED)) {
- + current_link_up = 1;
- + }
- + } else {
- + /* Forcing 1000FD link up. */
- + current_link_up = 1;
- + }
- + }
- +
- + tp->mac_mode &= ~MAC_MODE_LINK_POLARITY;
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- +
- + tp->hw_status->status =
- + (SD_STATUS_UPDATED |
- + (tp->hw_status->status & ~SD_STATUS_LINK_CHG));
- +
- + for (i = 0; i < 100; i++) {
- + udelay(20);
- + tw32_carefully(MAC_STATUS,
- + (MAC_STATUS_SYNC_CHANGED | MAC_STATUS_CFG_CHANGED));
- + if ((tr32(MAC_STATUS) &
- + (MAC_STATUS_SYNC_CHANGED |
- + MAC_STATUS_CFG_CHANGED)) == 0)
- + break;
- + }
- +
- + if ((tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED) == 0)
- + current_link_up = 0;
- +
- + if (current_link_up == 1) {
- + tp->link_config.active_speed = SPEED_1000;
- + tp->link_config.active_duplex = DUPLEX_FULL;
- + } else {
- + tp->link_config.active_speed = SPEED_INVALID;
- + tp->link_config.active_duplex = DUPLEX_INVALID;
- + }
- +
- + if (current_link_up != tp->carrier_ok) {
- + tp->carrier_ok = current_link_up;
- + tg3_link_report(tp);
- + } else {
- + uint32_t now_pause_cfg =
- + tp->tg3_flags & (TG3_FLAG_RX_PAUSE |
- + TG3_FLAG_TX_PAUSE);
- + if (orig_pause_cfg != now_pause_cfg ||
- + orig_active_speed != tp->link_config.active_speed ||
- + orig_active_duplex != tp->link_config.active_duplex)
- + tg3_link_report(tp);
- + }
- +
- + if ((tr32(MAC_STATUS) & MAC_STATUS_PCS_SYNCED) == 0) {
- + tw32_carefully(MAC_MODE, tp->mac_mode | MAC_MODE_LINK_POLARITY);
- + if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) {
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- + }
- + }
- +
- + return 0;
- +}
- +#else
- +#define tg3_setup_fiber_phy(TP) (-EINVAL)
- +#endif /* SUPPORT_FIBER_PHY */
- +
- +static int tg3_setup_phy(struct tg3 *tp)
- +{
- + int err;
- +
- + if (tp->phy_id == PHY_ID_SERDES) {
- + err = tg3_setup_fiber_phy(tp);
- + } else {
- + err = tg3_setup_copper_phy(tp);
- + }
- +
- + if (tp->link_config.active_speed == SPEED_1000 &&
- + tp->link_config.active_duplex == DUPLEX_HALF)
- + tw32(MAC_TX_LENGTHS,
- + ((2 << TX_LENGTHS_IPG_CRS_SHIFT) |
- + (6 << TX_LENGTHS_IPG_SHIFT) |
- + (0xff << TX_LENGTHS_SLOT_TIME_SHIFT)));
- + else
- + tw32(MAC_TX_LENGTHS,
- + ((2 << TX_LENGTHS_IPG_CRS_SHIFT) |
- + (6 << TX_LENGTHS_IPG_SHIFT) |
- + (32 << TX_LENGTHS_SLOT_TIME_SHIFT)));
- +
- + return err;
- +}
- +
- +
- +#define MAX_WAIT_CNT 1000
- +
- +/* To stop a block, clear the enable bit and poll till it
- + * clears.
- + */
- +static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, uint32_t enable_bit)
- +{
- + unsigned int i;
- + uint32_t val;
- +
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
- + switch(ofs) {
- + case RCVLSC_MODE:
- + case DMAC_MODE:
- + case MBFREE_MODE:
- + case BUFMGR_MODE:
- + case MEMARB_MODE:
- + /* We can't enable/disable these bits of the
- + * 5705, just say success.
- + */
- + return 0;
- + default:
- + break;
- + }
- + }
- + val = tr32(ofs);
- + val &= ~enable_bit;
- + tw32(ofs, val);
- + tr32(ofs);
- +
- + for (i = 0; i < MAX_WAIT_CNT; i++) {
- + udelay(100);
- + val = tr32(ofs);
- + if ((val & enable_bit) == 0)
- + break;
- + }
- +
- + if (i == MAX_WAIT_CNT) {
- + printf("tg3_stop_block timed out, ofs=%lx enable_bit=%x\n",
- + ofs, enable_bit);
- + return -ENODEV;
- + }
- +
- + return 0;
- +}
- +
- +static int tg3_abort_hw(struct tg3 *tp)
- +{
- + int i, err;
- +
- + tg3_disable_ints(tp);
- +
- + tp->rx_mode &= ~RX_MODE_ENABLE;
- + tw32_carefully(MAC_RX_MODE, tp->rx_mode);
- +
- + err = tg3_stop_block(tp, RCVBDI_MODE, RCVBDI_MODE_ENABLE);
- + err |= tg3_stop_block(tp, RCVLPC_MODE, RCVLPC_MODE_ENABLE);
- + err |= tg3_stop_block(tp, RCVLSC_MODE, RCVLSC_MODE_ENABLE);
- + err |= tg3_stop_block(tp, RCVDBDI_MODE, RCVDBDI_MODE_ENABLE);
- + err |= tg3_stop_block(tp, RCVDCC_MODE, RCVDCC_MODE_ENABLE);
- + err |= tg3_stop_block(tp, RCVCC_MODE, RCVCC_MODE_ENABLE);
- +
- + err |= tg3_stop_block(tp, SNDBDS_MODE, SNDBDS_MODE_ENABLE);
- + err |= tg3_stop_block(tp, SNDBDI_MODE, SNDBDI_MODE_ENABLE);
- + err |= tg3_stop_block(tp, SNDDATAI_MODE, SNDDATAI_MODE_ENABLE);
- + err |= tg3_stop_block(tp, RDMAC_MODE, RDMAC_MODE_ENABLE);
- + err |= tg3_stop_block(tp, SNDDATAC_MODE, SNDDATAC_MODE_ENABLE);
- + err |= tg3_stop_block(tp, SNDBDC_MODE, SNDBDC_MODE_ENABLE);
- + if (err)
- + goto out;
- +
- + tp->mac_mode &= ~MAC_MODE_TDE_ENABLE;
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- +
- + tp->tx_mode &= ~TX_MODE_ENABLE;
- + tw32_carefully(MAC_TX_MODE, tp->tx_mode);
- +
- + for (i = 0; i < MAX_WAIT_CNT; i++) {
- + udelay(100);
- + if (!(tr32(MAC_TX_MODE) & TX_MODE_ENABLE))
- + break;
- + }
- + if (i >= MAX_WAIT_CNT) {
- + printf("tg3_abort_hw timed out TX_MODE_ENABLE will not clear MAC_TX_MODE=%x\n",
- + tr32(MAC_TX_MODE));
- + return -ENODEV;
- + }
- +
- + err = tg3_stop_block(tp, HOSTCC_MODE, HOSTCC_MODE_ENABLE);
- + err |= tg3_stop_block(tp, WDMAC_MODE, WDMAC_MODE_ENABLE);
- + err |= tg3_stop_block(tp, MBFREE_MODE, MBFREE_MODE_ENABLE);
- +
- + tw32(FTQ_RESET, 0xffffffff);
- + tw32(FTQ_RESET, 0x00000000);
- +
- + err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE);
- + err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE);
- + if (err)
- + goto out;
- +
- + memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
- +
- +out:
- + return err;
- +}
- +
- +static void tg3_chip_reset(struct tg3 *tp)
- +{
- + uint32_t val;
- +
- + if (!(tp->tg3_flags2 & TG3_FLG2_SUN_5704)) {
- + /* Force NVRAM to settle.
- + * This deals with a chip bug which can result in EEPROM
- + * corruption.
- + */
- + if (tp->tg3_flags & TG3_FLAG_NVRAM) {
- + int i;
- +
- + tw32(NVRAM_SWARB, SWARB_REQ_SET1);
- + for (i = 0; i < 100000; i++) {
- + if (tr32(NVRAM_SWARB) & SWARB_GNT1)
- + break;
- + udelay(10);
- + }
- + }
- + }
- + /* In Etherboot we don't need to worry about the 5701
- + * REG_WRITE_BUG because we do all register writes indirectly.
- + */
- +
- + /* do the reset */
- + val = GRC_MISC_CFG_CORECLK_RESET;
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
- + val |= GRC_MISC_CFG_KEEP_GPHY_POWER;
- + tw32(GRC_MISC_CFG, val);
- +
- + /* Flush PCI posted writes. The normal MMIO registers
- + * are inaccessible at this time so this is the only
- + * way to make this reliably. I tried to use indirect
- + * register read/write but this upset some 5701 variants.
- + */
- + pci_read_config_dword(tp->pdev, PCI_COMMAND, &val);
- +
- + udelay(120);
- +
- + /* Re-enable indirect register accesses. */
- + pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL,
- + tp->misc_host_ctrl);
- +
- + /* Set MAX PCI retry to zero. */
- + val = (PCISTATE_ROM_ENABLE | PCISTATE_ROM_RETRY_ENABLE);
- + if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 &&
- + (tp->tg3_flags & TG3_FLAG_PCIX_MODE))
- + val |= PCISTATE_RETRY_SAME_DMA;
- + pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, val);
- +
- + pci_restore_state(tp->pdev, tp->pci_cfg_state);
- +
- + /* Make sure PCI-X relaxed ordering bit is clear. */
- + pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val);
- + val &= ~PCIX_CAPS_RELAXED_ORDERING;
- + pci_write_config_dword(tp->pdev, TG3PCI_X_CAPS, val);
- +
- + tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
- +
- + if (((tp->nic_sram_data_cfg & NIC_SRAM_DATA_CFG_MINI_PCI) != 0) &&
- + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) {
- + tp->pci_clock_ctrl |=
- + (CLOCK_CTRL_FORCE_CLKRUN | CLOCK_CTRL_CLKRUN_OENABLE);
- + tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl);
- + }
- +
- + tw32(TG3PCI_MISC_HOST_CTRL, tp->misc_host_ctrl);
- +}
- +
- +static void tg3_stop_fw(struct tg3 *tp)
- +{
- + if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) {
- + uint32_t val;
- + int i;
- +
- + tg3_write_mem(NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_PAUSE_FW);
- + val = tr32(GRC_RX_CPU_EVENT);
- + val |= (1 << 14);
- + tw32(GRC_RX_CPU_EVENT, val);
- +
- + /* Wait for RX cpu to ACK the event. */
- + for (i = 0; i < 100; i++) {
- + if (!(tr32(GRC_RX_CPU_EVENT) & (1 << 14)))
- + break;
- + udelay(1);
- + }
- + }
- +}
- +
- +static int tg3_restart_fw(struct tg3 *tp, uint32_t state)
- +{
- + uint32_t val;
- + int i;
- +
- + tg3_write_mem(NIC_SRAM_FIRMWARE_MBOX,
- + NIC_SRAM_FIRMWARE_MBOX_MAGIC1);
- + /* Wait for firmware initialization to complete. */
- + for (i = 0; i < 100000; i++) {
- + tg3_read_mem(NIC_SRAM_FIRMWARE_MBOX, &val);
- + if (val == (uint32_t) ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
- + break;
- + udelay(10);
- + }
- + if (i >= 100000 &&
- + !(tp->tg3_flags2 & TG3_FLG2_SUN_5704)) {
- + printf("Firmware will not restart magic=%x\n",
- + val);
- + return -ENODEV;
- + }
- + if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
- + state = DRV_STATE_SUSPEND;
- + }
- + tg3_write_mem(NIC_SRAM_FW_DRV_STATE_MBOX, state);
- + return 0;
- +}
- +
- +static int tg3_halt(struct tg3 *tp)
- +{
- + tg3_stop_fw(tp);
- + tg3_abort_hw(tp);
- + tg3_chip_reset(tp);
- + return tg3_restart_fw(tp, DRV_STATE_UNLOAD);
- +}
- +
- +static void __tg3_set_mac_addr(struct tg3 *tp)
- +{
- + uint32_t addr_high, addr_low;
- + int i;
- +
- + addr_high = ((tp->nic->node_addr[0] << 8) |
- + tp->nic->node_addr[1]);
- + addr_low = ((tp->nic->node_addr[2] << 24) |
- + (tp->nic->node_addr[3] << 16) |
- + (tp->nic->node_addr[4] << 8) |
- + (tp->nic->node_addr[5] << 0));
- + for (i = 0; i < 4; i++) {
- + tw32(MAC_ADDR_0_HIGH + (i * 8), addr_high);
- + tw32(MAC_ADDR_0_LOW + (i * 8), addr_low);
- + }
- +
- + if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700) &&
- + (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) &&
- + (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)) {
- + for(i = 0; i < 12; i++) {
- + tw32(MAC_EXTADDR_0_HIGH + (i * 8), addr_high);
- + tw32(MAC_EXTADDR_0_LOW + (i * 8), addr_low);
- + }
- + }
- + addr_high = (tp->nic->node_addr[0] +
- + tp->nic->node_addr[1] +
- + tp->nic->node_addr[2] +
- + tp->nic->node_addr[3] +
- + tp->nic->node_addr[4] +
- + tp->nic->node_addr[5]) &
- + TX_BACKOFF_SEED_MASK;
- + tw32(MAC_TX_BACKOFF_SEED, addr_high);
- +}
- +
- +static void tg3_set_bdinfo(struct tg3 *tp, uint32_t bdinfo_addr,
- + dma_addr_t mapping, uint32_t maxlen_flags,
- + uint32_t nic_addr)
- +{
- + tg3_write_mem((bdinfo_addr +
- + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH),
- + ((uint64_t) mapping >> 32));
- + tg3_write_mem((bdinfo_addr +
- + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW),
- + ((uint64_t) mapping & 0xffffffff));
- + tg3_write_mem((bdinfo_addr +
- + TG3_BDINFO_MAXLEN_FLAGS),
- + maxlen_flags);
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
- + tg3_write_mem((bdinfo_addr + TG3_BDINFO_NIC_ADDR), nic_addr);
- + }
- +}
- +
- +
- +static void tg3_init_rings(struct tg3 *tp)
- +{
- + unsigned i;
- +
- + /* Zero out the tg3 variables */
- + memset(&tg3_bss, 0, sizeof(tg3_bss));
- + tp->rx_std = &tg3_bss.rx_std[0];
- + tp->rx_rcb = &tg3_bss.rx_rcb[0];
- + tp->tx_ring = &tg3_bss.tx_ring[0];
- + tp->hw_status = &tg3_bss.hw_status;
- + tp->hw_stats = &tg3_bss.hw_stats;
- + tp->mac_mode = 0;
- +
- +
- + /* Initialize tx/rx rings for packet processing.
- + *
- + * The chip has been shut down and the driver detached from
- + * the networking, so no interrupts or new tx packets will
- + * end up in the driver.
- + */
- +
- + /* Initialize invariants of the rings, we only set this
- + * stuff once. This works because the card does not
- + * write into the rx buffer posting rings.
- + */
- + for (i = 0; i < TG3_RX_RING_SIZE; i++) {
- + struct tg3_rx_buffer_desc *rxd;
- +
- + rxd = &tp->rx_std[i];
- + rxd->idx_len = (RX_PKT_BUF_SZ - 2 - 64) << RXD_LEN_SHIFT;
- + rxd->type_flags = (RXD_FLAG_END << RXD_FLAGS_SHIFT);
- + rxd->opaque = (RXD_OPAQUE_RING_STD | (i << RXD_OPAQUE_INDEX_SHIFT));
- +
- + /* Note where the receive buffer for the ring is placed */
- + rxd->addr_hi = 0;
- + rxd->addr_lo = virt_to_bus(
- + &tg3_bss.rx_bufs[i%TG3_DEF_RX_RING_PENDING][2]);
- + }
- +}
- +
- +#define TG3_WRITE_SETTINGS(TABLE) \
- +do { \
- + const uint32_t *_table, *_end; \
- + _table = TABLE; \
- + _end = _table + sizeof(TABLE)/sizeof(TABLE[0]); \
- + for(; _table < _end; _table += 2) { \
- + tw32(_table[0], _table[1]); \
- + } \
- +} while(0)
- +
- +
- +/* initialize/reset the tg3 */
- +static int tg3_setup_hw(struct tg3 *tp)
- +{
- + uint32_t val, rdmac_mode;
- + int i, err, limit;
- +
- + /* Simply don't support setups with extremly buggy firmware in etherboot */
- + if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) {
- + printf("Error 5701_A0 firmware bug detected\n");
- + return -EINVAL;
- + }
- +
- + tg3_disable_ints(tp);
- +
- + /* Originally this was all in tg3_init_hw */
- +
- + /* Force the chip into D0. */
- + tg3_set_power_state_0(tp);
- +
- + tg3_switch_clocks(tp);
- +
- + tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0);
- +
- +
- + /* Originally this was all in tg3_reset_hw */
- +
- + tg3_stop_fw(tp);
- +
- + /* No need to call tg3_abort_hw here, it is called before tg3_setup_hw. */
- +
- + tg3_chip_reset(tp);
- +
- + tw32(GRC_MODE, tp->grc_mode); /* Redundant? */
- +
- + err = tg3_restart_fw(tp, DRV_STATE_START);
- + if (err)
- + return err;
- +
- + if (tp->phy_id == PHY_ID_SERDES) {
- + tp->mac_mode = MAC_MODE_PORT_MODE_TBI;
- + }
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- +
- +
- + /* This works around an issue with Athlon chipsets on
- + * B3 tigon3 silicon. This bit has no effect on any
- + * other revision.
- + */
- + tp->pci_clock_ctrl |= CLOCK_CTRL_DELAY_PCI_GRANT;
- + tw32_carefully(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl);
- +
- + if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 &&
- + (tp->tg3_flags & TG3_FLAG_PCIX_MODE)) {
- + val = tr32(TG3PCI_PCISTATE);
- + val |= PCISTATE_RETRY_SAME_DMA;
- + tw32(TG3PCI_PCISTATE, val);
- + }
- +
- + /* Descriptor ring init may make accesses to the
- + * NIC SRAM area to setup the TX descriptors, so we
- + * can only do this after the hardware has been
- + * successfully reset.
- + */
- + tg3_init_rings(tp);
- +
- + /* Clear statistics/status block in chip */
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
- + for (i = NIC_SRAM_STATS_BLK;
- + i < NIC_SRAM_STATUS_BLK + TG3_HW_STATUS_SIZE;
- + i += sizeof(uint32_t)) {
- + tg3_write_mem(i, 0);
- + udelay(40);
- + }
- + }
- +
- + /* This value is determined during the probe time DMA
- + * engine test, tg3_setup_dma.
- + */
- + tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
- +
- + tp->grc_mode &= ~(GRC_MODE_HOST_SENDBDS |
- + GRC_MODE_4X_NIC_SEND_RINGS |
- + GRC_MODE_NO_TX_PHDR_CSUM |
- + GRC_MODE_NO_RX_PHDR_CSUM);
- + tp->grc_mode |= GRC_MODE_HOST_SENDBDS;
- + tp->grc_mode |= GRC_MODE_NO_TX_PHDR_CSUM;
- + tp->grc_mode |= GRC_MODE_NO_RX_PHDR_CSUM;
- +
- + tw32(GRC_MODE,
- + tp->grc_mode |
- + (GRC_MODE_IRQ_ON_MAC_ATTN | GRC_MODE_HOST_STACKUP));
- +
- + /* Setup the timer prescalar register. Clock is always 66Mhz. */
- + tw32(GRC_MISC_CFG,
- + (65 << GRC_MISC_CFG_PRESCALAR_SHIFT));
- +
- + /* Initialize MBUF/DESC pool. */
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
- + tw32(BUFMGR_MB_POOL_ADDR, NIC_SRAM_MBUF_POOL_BASE);
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
- + tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE64);
- + else
- + tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE96);
- + tw32(BUFMGR_DMA_DESC_POOL_ADDR, NIC_SRAM_DMA_DESC_POOL_BASE);
- + tw32(BUFMGR_DMA_DESC_POOL_SIZE, NIC_SRAM_DMA_DESC_POOL_SIZE);
- + }
- + if (!(tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE)) {
- + tw32(BUFMGR_MB_RDMA_LOW_WATER,
- + tp->bufmgr_config.mbuf_read_dma_low_water);
- + tw32(BUFMGR_MB_MACRX_LOW_WATER,
- + tp->bufmgr_config.mbuf_mac_rx_low_water);
- + tw32(BUFMGR_MB_HIGH_WATER,
- + tp->bufmgr_config.mbuf_high_water);
- + } else {
- + tw32(BUFMGR_MB_RDMA_LOW_WATER,
- + tp->bufmgr_config.mbuf_read_dma_low_water_jumbo);
- + tw32(BUFMGR_MB_MACRX_LOW_WATER,
- + tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo);
- + tw32(BUFMGR_MB_HIGH_WATER,
- + tp->bufmgr_config.mbuf_high_water_jumbo);
- + }
- + tw32(BUFMGR_DMA_LOW_WATER,
- + tp->bufmgr_config.dma_low_water);
- + tw32(BUFMGR_DMA_HIGH_WATER,
- + tp->bufmgr_config.dma_high_water);
- +
- + tw32(BUFMGR_MODE, BUFMGR_MODE_ENABLE | BUFMGR_MODE_ATTN_ENABLE);
- + for (i = 0; i < 2000; i++) {
- + if (tr32(BUFMGR_MODE) & BUFMGR_MODE_ENABLE)
- + break;
- + udelay(10);
- + }
- + if (i >= 2000) {
- + printf("tg3_setup_hw cannot enable BUFMGR\n");
- + return -ENODEV;
- + }
- +
- + tw32(FTQ_RESET, 0xffffffff);
- + tw32(FTQ_RESET, 0x00000000);
- + for (i = 0; i < 2000; i++) {
- + if (tr32(FTQ_RESET) == 0x00000000)
- + break;
- + udelay(10);
- + }
- + if (i >= 2000) {
- + printf("tg3_setup_hw cannot reset FTQ\n");
- + return -ENODEV;
- + }
- +
- + /* Initialize TG3_BDINFO's at:
- + * RCVDBDI_STD_BD: standard eth size rx ring
- + * RCVDBDI_JUMBO_BD: jumbo frame rx ring
- + * RCVDBDI_MINI_BD: small frame rx ring (??? does not work)
- + *
- + * like so:
- + * TG3_BDINFO_HOST_ADDR: high/low parts of DMA address of ring
- + * TG3_BDINFO_MAXLEN_FLAGS: (rx max buffer size << 16) |
- + * ring attribute flags
- + * TG3_BDINFO_NIC_ADDR: location of descriptors in nic SRAM
- + *
- + * Standard receive ring @ NIC_SRAM_RX_BUFFER_DESC, 512 entries.
- + * Jumbo receive ring @ NIC_SRAM_RX_JUMBO_BUFFER_DESC, 256 entries.
- + *
- + * ??? No space allocated for mini receive ring? :(
- + *
- + * The size of each ring is fixed in the firmware, but the location is
- + * configurable.
- + */
- + {
- + static const uint32_t table_all[] = {
- + /* Setup replenish thresholds. */
- + RCVBDI_STD_THRESH, TG3_DEF_RX_RING_PENDING / 8,
- +
- + /* Etherboot lives below 4GB */
- + RCVDBDI_STD_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH, 0,
- + RCVDBDI_STD_BD + TG3_BDINFO_NIC_ADDR, NIC_SRAM_RX_BUFFER_DESC,
- + };
- + static const uint32_t table_not_5705[] = {
- + /* Buffer maximum length */
- + RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS, RX_STD_MAX_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT,
- +
- + /* Disable the mini frame rx ring */
- + RCVDBDI_MINI_BD + TG3_BDINFO_MAXLEN_FLAGS, BDINFO_FLAGS_DISABLED,
- +
- + /* Disable the jumbo frame rx ring */
- + RCVBDI_JUMBO_THRESH, 0,
- + RCVDBDI_JUMBO_BD + TG3_BDINFO_MAXLEN_FLAGS, BDINFO_FLAGS_DISABLED,
- +
- +
- + };
- + TG3_WRITE_SETTINGS(table_all);
- + tw32(RCVDBDI_STD_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW,
- + virt_to_bus(tp->rx_std));
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
- + tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS,
- + RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT);
- + } else {
- + TG3_WRITE_SETTINGS(table_not_5705);
- + }
- + }
- +
- +
- + /* There is only one send ring on 5705, no need to explicitly
- + * disable the others.
- + */
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
- + /* Clear out send RCB ring in SRAM. */
- + for (i = NIC_SRAM_SEND_RCB; i < NIC_SRAM_RCV_RET_RCB; i += TG3_BDINFO_SIZE)
- + tg3_write_mem(i + TG3_BDINFO_MAXLEN_FLAGS, BDINFO_FLAGS_DISABLED);
- + }
- +
- + tp->tx_prod = 0;
- + tw32_mailbox(MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW, 0);
- + tw32_mailbox2(MAILBOX_SNDNIC_PROD_IDX_0 + TG3_64BIT_REG_LOW, 0);
- +
- + tg3_set_bdinfo(tp,
- + NIC_SRAM_SEND_RCB,
- + virt_to_bus(tp->tx_ring),
- + (TG3_TX_RING_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT),
- + NIC_SRAM_TX_BUFFER_DESC);
- +
- + /* There is only one receive return ring on 5705, no need to explicitly
- + * disable the others.
- + */
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
- + for (i = NIC_SRAM_RCV_RET_RCB; i < NIC_SRAM_STATS_BLK; i += TG3_BDINFO_SIZE) {
- + tg3_write_mem(i + TG3_BDINFO_MAXLEN_FLAGS,
- + BDINFO_FLAGS_DISABLED);
- + }
- + }
- +
- + tp->rx_rcb_ptr = 0;
- + tw32_mailbox2(MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW, 0);
- +
- + tg3_set_bdinfo(tp,
- + NIC_SRAM_RCV_RET_RCB,
- + virt_to_bus(tp->rx_rcb),
- + (TG3_RX_RCB_RING_SIZE << BDINFO_FLAGS_MAXLEN_SHIFT),
- + 0);
- +
- + tp->rx_std_ptr = TG3_DEF_RX_RING_PENDING;
- + tw32_mailbox2(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW,
- + tp->rx_std_ptr);
- +
- + tw32_mailbox2(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW, 0);
- +
- + /* Initialize MAC address and backoff seed. */
- + __tg3_set_mac_addr(tp);
- +
- + /* Calculate RDMAC_MODE setting early, we need it to determine
- + * the RCVLPC_STATE_ENABLE mask.
- + */
- + rdmac_mode = (RDMAC_MODE_ENABLE | RDMAC_MODE_TGTABORT_ENAB |
- + RDMAC_MODE_MSTABORT_ENAB | RDMAC_MODE_PARITYERR_ENAB |
- + RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB |
- + RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB |
- + RDMAC_MODE_LNGREAD_ENAB);
- + if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
- + rdmac_mode |= RDMAC_MODE_SPLIT_ENABLE;
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
- + if (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) {
- + if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) &&
- + !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) {
- + rdmac_mode |= RDMAC_MODE_FIFO_LONG_BURST;
- + }
- + }
- + }
- +
- + /* Setup host coalescing engine. */
- + tw32(HOSTCC_MODE, 0);
- + for (i = 0; i < 2000; i++) {
- + if (!(tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE))
- + break;
- + udelay(10);
- + }
- +
- + tp->mac_mode = MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE |
- + MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE;
- + tw32_carefully(MAC_MODE, tp->mac_mode | MAC_MODE_RXSTAT_CLEAR | MAC_MODE_TXSTAT_CLEAR);
- +
- + tp->grc_local_ctrl = GRC_LCLCTRL_INT_ON_ATTN | GRC_LCLCTRL_AUTO_SEEPROM;
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700)
- + tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 |
- + GRC_LCLCTRL_GPIO_OUTPUT1);
- + tw32_carefully(GRC_LOCAL_CTRL, tp->grc_local_ctrl);
- +
- + tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0);
- + tr32(MAILBOX_INTERRUPT_0);
- +
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
- + tw32_carefully(DMAC_MODE, DMAC_MODE_ENABLE);
- + }
- +
- + val = ( WDMAC_MODE_ENABLE | WDMAC_MODE_TGTABORT_ENAB |
- + WDMAC_MODE_MSTABORT_ENAB | WDMAC_MODE_PARITYERR_ENAB |
- + WDMAC_MODE_ADDROFLOW_ENAB | WDMAC_MODE_FIFOOFLOW_ENAB |
- + WDMAC_MODE_FIFOURUN_ENAB | WDMAC_MODE_FIFOOREAD_ENAB |
- + WDMAC_MODE_LNGREAD_ENAB);
- + if ((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) &&
- + ((tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) != 0) &&
- + !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) {
- + val |= WDMAC_MODE_RX_ACCEL;
- + }
- + tw32_carefully(WDMAC_MODE, val);
- +
- + if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) != 0) {
- + val = tr32(TG3PCI_X_CAPS);
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) {
- + val &= PCIX_CAPS_BURST_MASK;
- + val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT);
- + } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
- + val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK);
- + val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT);
- + if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
- + val |= (tp->split_mode_max_reqs <<
- + PCIX_CAPS_SPLIT_SHIFT);
- + }
- + tw32(TG3PCI_X_CAPS, val);
- + }
- +
- + tw32_carefully(RDMAC_MODE, rdmac_mode);
- + {
- + static const uint32_t table_all[] = {
- + /* MTU + ethernet header + FCS + optional VLAN tag */
- + MAC_RX_MTU_SIZE, ETH_MAX_MTU + ETH_HLEN + 8,
- +
- + /* The slot time is changed by tg3_setup_phy if we
- + * run at gigabit with half duplex.
- + */
- + MAC_TX_LENGTHS,
- + (2 << TX_LENGTHS_IPG_CRS_SHIFT) |
- + (6 << TX_LENGTHS_IPG_SHIFT) |
- + (32 << TX_LENGTHS_SLOT_TIME_SHIFT),
- +
- + /* Receive rules. */
- + MAC_RCV_RULE_CFG, RCV_RULE_CFG_DEFAULT_CLASS,
- + RCVLPC_CONFIG, 0x0181,
- +
- + /* Receive/send statistics. */
- + RCVLPC_STATS_ENABLE, 0xffffff,
- + RCVLPC_STATSCTRL, RCVLPC_STATSCTRL_ENABLE,
- + SNDDATAI_STATSENAB, 0xffffff,
- + SNDDATAI_STATSCTRL, (SNDDATAI_SCTRL_ENABLE |SNDDATAI_SCTRL_FASTUPD),
- +
- + /* Host coalescing engine */
- + HOSTCC_RXCOL_TICKS, 0,
- + HOSTCC_TXCOL_TICKS, LOW_TXCOL_TICKS,
- + HOSTCC_RXMAX_FRAMES, 1,
- + HOSTCC_TXMAX_FRAMES, LOW_RXMAX_FRAMES,
- + HOSTCC_RXCOAL_MAXF_INT, 1,
- + HOSTCC_TXCOAL_MAXF_INT, 0,
- +
- + /* Status/statistics block address. */
- + /* Etherboot lives below 4GB, so HIGH == 0 */
- + HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, 0,
- +
- + /* No need to enable 32byte coalesce mode. */
- + HOSTCC_MODE, HOSTCC_MODE_ENABLE | 0,
- +
- + RCVCC_MODE, RCVCC_MODE_ENABLE | RCVCC_MODE_ATTN_ENABLE,
- + RCVLPC_MODE, RCVLPC_MODE_ENABLE,
- +
- + RCVDCC_MODE, RCVDCC_MODE_ENABLE | RCVDCC_MODE_ATTN_ENABLE,
- +
- + SNDDATAC_MODE, SNDDATAC_MODE_ENABLE,
- + SNDBDC_MODE, SNDBDC_MODE_ENABLE | SNDBDC_MODE_ATTN_ENABLE,
- + RCVBDI_MODE, RCVBDI_MODE_ENABLE | RCVBDI_MODE_RCB_ATTN_ENAB,
- + RCVDBDI_MODE, RCVDBDI_MODE_ENABLE | RCVDBDI_MODE_INV_RING_SZ,
- + SNDDATAI_MODE, SNDDATAI_MODE_ENABLE,
- + SNDBDI_MODE, SNDBDI_MODE_ENABLE | SNDBDI_MODE_ATTN_ENABLE,
- + SNDBDS_MODE, SNDBDS_MODE_ENABLE | SNDBDS_MODE_ATTN_ENABLE,
- +
- + /* Accept all multicast frames. */
- + MAC_HASH_REG_0, 0xffffffff,
- + MAC_HASH_REG_1, 0xffffffff,
- + MAC_HASH_REG_2, 0xffffffff,
- + MAC_HASH_REG_3, 0xffffffff,
- + };
- + static const uint32_t table_not_5705[] = {
- + /* Host coalescing engine */
- + HOSTCC_RXCOAL_TICK_INT, 0,
- + HOSTCC_TXCOAL_TICK_INT, 0,
- +
- + /* Status/statistics block address. */
- + /* Etherboot lives below 4GB, so HIGH == 0 */
- + HOSTCC_STAT_COAL_TICKS, DEFAULT_STAT_COAL_TICKS,
- + HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, 0,
- + HOSTCC_STATS_BLK_NIC_ADDR, NIC_SRAM_STATS_BLK,
- + HOSTCC_STATUS_BLK_NIC_ADDR, NIC_SRAM_STATUS_BLK,
- +
- + RCVLSC_MODE, RCVLSC_MODE_ENABLE | RCVLSC_MODE_ATTN_ENABLE,
- +
- + MBFREE_MODE, MBFREE_MODE_ENABLE,
- + };
- + TG3_WRITE_SETTINGS(table_all);
- + tw32(HOSTCC_STATS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW,
- + virt_to_bus(tp->hw_stats));
- + tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW,
- + virt_to_bus(tp->hw_status));
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
- + TG3_WRITE_SETTINGS(table_not_5705);
- + }
- + }
- +
- + tp->tx_mode = TX_MODE_ENABLE;
- + tw32_carefully(MAC_TX_MODE, tp->tx_mode);
- +
- + tp->rx_mode = RX_MODE_ENABLE;
- + tw32_carefully(MAC_RX_MODE, tp->rx_mode);
- +
- + tp->mi_mode = MAC_MI_MODE_BASE;
- + tw32_carefully(MAC_MI_MODE, tp->mi_mode);
- +
- + tw32(MAC_LED_CTRL, 0);
- + tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB);
- + if (tp->phy_id == PHY_ID_SERDES) {
- + tw32_carefully(MAC_RX_MODE, RX_MODE_RESET);
- + }
- + tp->rx_mode |= RX_MODE_KEEP_VLAN_TAG; /* drop tagged vlan packets */
- + tw32_carefully(MAC_RX_MODE, tp->rx_mode);
- +
- + if (tp->pci_chip_rev_id == CHIPREV_ID_5703_A1)
- + tw32(MAC_SERDES_CFG, 0x616000);
- +
- + /* Prevent chip from dropping frames when flow control
- + * is enabled.
- + */
- + tw32(MAC_LOW_WMARK_MAX_RX_FRAME, 2);
- + tr32(MAC_LOW_WMARK_MAX_RX_FRAME);
- +
- + err = tg3_setup_phy(tp);
- +
- + /* Ignore CRC stats */
- +
- + /* Initialize receive rules. */
- + tw32(MAC_RCV_RULE_0, 0xc2000000 & RCV_RULE_DISABLE_MASK);
- + tw32(MAC_RCV_VALUE_0, 0xffffffff & RCV_RULE_DISABLE_MASK);
- + tw32(MAC_RCV_RULE_1, 0x86000004 & RCV_RULE_DISABLE_MASK);
- + tw32(MAC_RCV_VALUE_1, 0xffffffff & RCV_RULE_DISABLE_MASK);
- +
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
- + limit = 8;
- + else
- + limit = 16;
- + if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF)
- + limit -= 4;
- + switch (limit) {
- + case 16: tw32(MAC_RCV_RULE_15, 0); tw32(MAC_RCV_VALUE_15, 0);
- + case 15: tw32(MAC_RCV_RULE_14, 0); tw32(MAC_RCV_VALUE_14, 0);
- + case 14: tw32(MAC_RCV_RULE_13, 0); tw32(MAC_RCV_VALUE_13, 0);
- + case 13: tw32(MAC_RCV_RULE_12, 0); tw32(MAC_RCV_VALUE_12, 0);
- + case 12: tw32(MAC_RCV_RULE_11, 0); tw32(MAC_RCV_VALUE_11, 0);
- + case 11: tw32(MAC_RCV_RULE_10, 0); tw32(MAC_RCV_VALUE_10, 0);
- + case 10: tw32(MAC_RCV_RULE_9, 0); tw32(MAC_RCV_VALUE_9, 0);
- + case 9: tw32(MAC_RCV_RULE_8, 0); tw32(MAC_RCV_VALUE_8, 0);
- + case 8: tw32(MAC_RCV_RULE_7, 0); tw32(MAC_RCV_VALUE_7, 0);
- + case 7: tw32(MAC_RCV_RULE_6, 0); tw32(MAC_RCV_VALUE_6, 0);
- + case 6: tw32(MAC_RCV_RULE_5, 0); tw32(MAC_RCV_VALUE_5, 0);
- + case 5: tw32(MAC_RCV_RULE_4, 0); tw32(MAC_RCV_VALUE_4, 0);
- + case 4: /* tw32(MAC_RCV_RULE_3, 0); tw32(MAC_RCV_VALUE_3, 0); */
- + case 3: /* tw32(MAC_RCV_RULE_2, 0); tw32(MAC_RCV_VALUE_2, 0); */
- + case 2:
- + case 1:
- + default:
- + break;
- + };
- +
- + return err;
- +}
- +
- +
- +
- +/* Chips other than 5700/5701 use the NVRAM for fetching info. */
- +static void tg3_nvram_init(struct tg3 *tp)
- +{
- + tw32(GRC_EEPROM_ADDR,
- + (EEPROM_ADDR_FSM_RESET |
- + (EEPROM_DEFAULT_CLOCK_PERIOD <<
- + EEPROM_ADDR_CLKPERD_SHIFT)));
- +
- + mdelay(1);
- +
- + /* Enable seeprom accesses. */
- + tw32_carefully(GRC_LOCAL_CTRL,
- + tr32(GRC_LOCAL_CTRL) | GRC_LCLCTRL_AUTO_SEEPROM);
- +
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
- + GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) {
- + uint32_t nvcfg1 = tr32(NVRAM_CFG1);
- +
- + tp->tg3_flags |= TG3_FLAG_NVRAM;
- + if (nvcfg1 & NVRAM_CFG1_FLASHIF_ENAB) {
- + if (nvcfg1 & NVRAM_CFG1_BUFFERED_MODE)
- + tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
- + } else {
- + nvcfg1 &= ~NVRAM_CFG1_COMPAT_BYPASS;
- + tw32(NVRAM_CFG1, nvcfg1);
- + }
- +
- + } else {
- + tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED);
- + }
- +}
- +
- +
- +static int tg3_nvram_read_using_eeprom(
- + struct tg3 *tp __unused, uint32_t offset, uint32_t *val)
- +{
- + uint32_t tmp;
- + int i;
- +
- + if (offset > EEPROM_ADDR_ADDR_MASK ||
- + (offset % 4) != 0) {
- + return -EINVAL;
- + }
- +
- + tmp = tr32(GRC_EEPROM_ADDR) & ~(EEPROM_ADDR_ADDR_MASK |
- + EEPROM_ADDR_DEVID_MASK |
- + EEPROM_ADDR_READ);
- + tw32(GRC_EEPROM_ADDR,
- + tmp |
- + (0 << EEPROM_ADDR_DEVID_SHIFT) |
- + ((offset << EEPROM_ADDR_ADDR_SHIFT) &
- + EEPROM_ADDR_ADDR_MASK) |
- + EEPROM_ADDR_READ | EEPROM_ADDR_START);
- +
- + for (i = 0; i < 10000; i++) {
- + tmp = tr32(GRC_EEPROM_ADDR);
- +
- + if (tmp & EEPROM_ADDR_COMPLETE)
- + break;
- + udelay(100);
- + }
- + if (!(tmp & EEPROM_ADDR_COMPLETE)) {
- + return -EBUSY;
- + }
- +
- + *val = tr32(GRC_EEPROM_DATA);
- + return 0;
- +}
- +
- +static int tg3_nvram_read(struct tg3 *tp, uint32_t offset, uint32_t *val)
- +{
- + int i, saw_done_clear;
- +
- + if (!(tp->tg3_flags & TG3_FLAG_NVRAM))
- + return tg3_nvram_read_using_eeprom(tp, offset, val);
- +
- + if (tp->tg3_flags & TG3_FLAG_NVRAM_BUFFERED)
- + offset = ((offset / NVRAM_BUFFERED_PAGE_SIZE) <<
- + NVRAM_BUFFERED_PAGE_POS) +
- + (offset % NVRAM_BUFFERED_PAGE_SIZE);
- +
- + if (offset > NVRAM_ADDR_MSK)
- + return -EINVAL;
- +
- + tw32(NVRAM_SWARB, SWARB_REQ_SET1);
- + for (i = 0; i < 1000; i++) {
- + if (tr32(NVRAM_SWARB) & SWARB_GNT1)
- + break;
- + udelay(20);
- + }
- +
- + tw32(NVRAM_ADDR, offset);
- + tw32(NVRAM_CMD,
- + NVRAM_CMD_RD | NVRAM_CMD_GO |
- + NVRAM_CMD_FIRST | NVRAM_CMD_LAST | NVRAM_CMD_DONE);
- +
- + /* Wait for done bit to clear then set again. */
- + saw_done_clear = 0;
- + for (i = 0; i < 1000; i++) {
- + udelay(10);
- + if (!saw_done_clear &&
- + !(tr32(NVRAM_CMD) & NVRAM_CMD_DONE))
- + saw_done_clear = 1;
- + else if (saw_done_clear &&
- + (tr32(NVRAM_CMD) & NVRAM_CMD_DONE))
- + break;
- + }
- + if (i >= 1000) {
- + tw32(NVRAM_SWARB, SWARB_REQ_CLR1);
- + return -EBUSY;
- + }
- +
- + *val = bswap_32(tr32(NVRAM_RDDATA));
- + tw32(NVRAM_SWARB, 0x20);
- +
- + return 0;
- +}
- +
- +struct subsys_tbl_ent {
- + uint16_t subsys_vendor, subsys_devid;
- + uint32_t phy_id;
- +};
- +
- +static struct subsys_tbl_ent subsys_id_to_phy_id[] = {
- + /* Broadcom boards. */
- + { 0x14e4, 0x1644, PHY_ID_BCM5401 }, /* BCM95700A6 */
- + { 0x14e4, 0x0001, PHY_ID_BCM5701 }, /* BCM95701A5 */
- + { 0x14e4, 0x0002, PHY_ID_BCM8002 }, /* BCM95700T6 */
- + { 0x14e4, 0x0003, PHY_ID_SERDES }, /* BCM95700A9 */
- + { 0x14e4, 0x0005, PHY_ID_BCM5701 }, /* BCM95701T1 */
- + { 0x14e4, 0x0006, PHY_ID_BCM5701 }, /* BCM95701T8 */
- + { 0x14e4, 0x0007, PHY_ID_SERDES }, /* BCM95701A7 */
- + { 0x14e4, 0x0008, PHY_ID_BCM5701 }, /* BCM95701A10 */
- + { 0x14e4, 0x8008, PHY_ID_BCM5701 }, /* BCM95701A12 */
- + { 0x14e4, 0x0009, PHY_ID_BCM5701 }, /* BCM95703Ax1 */
- + { 0x14e4, 0x8009, PHY_ID_BCM5701 }, /* BCM95703Ax2 */
- +
- + /* 3com boards. */
- + { PCI_VENDOR_ID_3COM, 0x1000, PHY_ID_BCM5401 }, /* 3C996T */
- + { PCI_VENDOR_ID_3COM, 0x1006, PHY_ID_BCM5701 }, /* 3C996BT */
- + /* { PCI_VENDOR_ID_3COM, 0x1002, PHY_ID_XXX }, 3C996CT */
- + /* { PCI_VENDOR_ID_3COM, 0x1003, PHY_ID_XXX }, 3C997T */
- + { PCI_VENDOR_ID_3COM, 0x1004, PHY_ID_SERDES }, /* 3C996SX */
- + /* { PCI_VENDOR_ID_3COM, 0x1005, PHY_ID_XXX }, 3C997SZ */
- + { PCI_VENDOR_ID_3COM, 0x1007, PHY_ID_BCM5701 }, /* 3C1000T */
- + { PCI_VENDOR_ID_3COM, 0x1008, PHY_ID_BCM5701 }, /* 3C940BR01 */
- +
- + /* DELL boards. */
- + { PCI_VENDOR_ID_DELL, 0x00d1, PHY_ID_BCM5401 }, /* VIPER */
- + { PCI_VENDOR_ID_DELL, 0x0106, PHY_ID_BCM5401 }, /* JAGUAR */
- + { PCI_VENDOR_ID_DELL, 0x0109, PHY_ID_BCM5411 }, /* MERLOT */
- + { PCI_VENDOR_ID_DELL, 0x010a, PHY_ID_BCM5411 }, /* SLIM_MERLOT */
- +
- + /* Compaq boards. */
- + { PCI_VENDOR_ID_COMPAQ, 0x007c, PHY_ID_BCM5701 }, /* BANSHEE */
- + { PCI_VENDOR_ID_COMPAQ, 0x009a, PHY_ID_BCM5701 }, /* BANSHEE_2 */
- + { PCI_VENDOR_ID_COMPAQ, 0x007d, PHY_ID_SERDES }, /* CHANGELING */
- + { PCI_VENDOR_ID_COMPAQ, 0x0085, PHY_ID_BCM5701 }, /* NC7780 */
- + { PCI_VENDOR_ID_COMPAQ, 0x0099, PHY_ID_BCM5701 } /* NC7780_2 */
- +};
- +
- +static int tg3_phy_probe(struct tg3 *tp)
- +{
- + uint32_t eeprom_phy_id, hw_phy_id_1, hw_phy_id_2;
- + uint32_t hw_phy_id, hw_phy_id_masked;
- + enum phy_led_mode eeprom_led_mode;
- + uint32_t val;
- + unsigned i;
- + int eeprom_signature_found, err;
- +
- + tp->phy_id = PHY_ID_INVALID;
- +
- + for (i = 0; i < sizeof(subsys_id_to_phy_id)/sizeof(subsys_id_to_phy_id[0]); i++) {
- + if ((subsys_id_to_phy_id[i].subsys_vendor == tp->subsystem_vendor) &&
- + (subsys_id_to_phy_id[i].subsys_devid == tp->subsystem_device)) {
- + tp->phy_id = subsys_id_to_phy_id[i].phy_id;
- + break;
- + }
- + }
- +
- + eeprom_phy_id = PHY_ID_INVALID;
- + eeprom_led_mode = led_mode_auto;
- + eeprom_signature_found = 0;
- + tg3_read_mem(NIC_SRAM_DATA_SIG, &val);
- + if (val == NIC_SRAM_DATA_SIG_MAGIC) {
- + uint32_t nic_cfg;
- +
- + tg3_read_mem(NIC_SRAM_DATA_CFG, &nic_cfg);
- + tp->nic_sram_data_cfg = nic_cfg;
- +
- + eeprom_signature_found = 1;
- +
- + if ((nic_cfg & NIC_SRAM_DATA_CFG_PHY_TYPE_MASK) ==
- + NIC_SRAM_DATA_CFG_PHY_TYPE_FIBER) {
- + eeprom_phy_id = PHY_ID_SERDES;
- + } else {
- + uint32_t nic_phy_id;
- +
- + tg3_read_mem(NIC_SRAM_DATA_PHY_ID, &nic_phy_id);
- + if (nic_phy_id != 0) {
- + uint32_t id1 = nic_phy_id & NIC_SRAM_DATA_PHY_ID1_MASK;
- + uint32_t id2 = nic_phy_id & NIC_SRAM_DATA_PHY_ID2_MASK;
- +
- + eeprom_phy_id = (id1 >> 16) << 10;
- + eeprom_phy_id |= (id2 & 0xfc00) << 16;
- + eeprom_phy_id |= (id2 & 0x03ff) << 0;
- + }
- + }
- +
- + switch (nic_cfg & NIC_SRAM_DATA_CFG_LED_MODE_MASK) {
- + case NIC_SRAM_DATA_CFG_LED_TRIPLE_SPD:
- + eeprom_led_mode = led_mode_three_link;
- + break;
- +
- + case NIC_SRAM_DATA_CFG_LED_LINK_SPD:
- + eeprom_led_mode = led_mode_link10;
- + break;
- +
- + default:
- + eeprom_led_mode = led_mode_auto;
- + break;
- + };
- + if (((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) ||
- + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
- + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) &&
- + (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP)) {
- + tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
- + }
- +
- + if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE)
- + tp->tg3_flags |= TG3_FLAG_ENABLE_ASF;
- + if (nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL)
- + tp->tg3_flags |= TG3_FLAG_SERDES_WOL_CAP;
- + }
- +
- + /* Now read the physical PHY_ID from the chip and verify
- + * that it is sane. If it doesn't look good, we fall back
- + * to either the hard-coded table based PHY_ID and failing
- + * that the value found in the eeprom area.
- + */
- + err = tg3_readphy(tp, MII_PHYSID1, &hw_phy_id_1);
- + err |= tg3_readphy(tp, MII_PHYSID2, &hw_phy_id_2);
- +
- + hw_phy_id = (hw_phy_id_1 & 0xffff) << 10;
- + hw_phy_id |= (hw_phy_id_2 & 0xfc00) << 16;
- + hw_phy_id |= (hw_phy_id_2 & 0x03ff) << 0;
- +
- + hw_phy_id_masked = hw_phy_id & PHY_ID_MASK;
- +
- + if (!err && KNOWN_PHY_ID(hw_phy_id_masked)) {
- + tp->phy_id = hw_phy_id;
- + } else {
- + /* phy_id currently holds the value found in the
- + * subsys_id_to_phy_id[] table or PHY_ID_INVALID
- + * if a match was not found there.
- + */
- + if (tp->phy_id == PHY_ID_INVALID) {
- + if (!eeprom_signature_found ||
- + !KNOWN_PHY_ID(eeprom_phy_id & PHY_ID_MASK))
- + return -ENODEV;
- + tp->phy_id = eeprom_phy_id;
- + }
- + }
- +
- + err = tg3_phy_reset(tp);
- + if (err)
- + return err;
- +
- + if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0 ||
- + tp->pci_chip_rev_id == CHIPREV_ID_5701_B0) {
- + uint32_t mii_tg3_ctrl;
- +
- + /* These chips, when reset, only advertise 10Mb
- + * capabilities. Fix that.
- + */
- + err = tg3_writephy(tp, MII_ADVERTISE,
- + (ADVERTISE_CSMA |
- + ADVERTISE_PAUSE_CAP |
- + ADVERTISE_10HALF |
- + ADVERTISE_10FULL |
- + ADVERTISE_100HALF |
- + ADVERTISE_100FULL));
- + mii_tg3_ctrl = (MII_TG3_CTRL_ADV_1000_HALF |
- + MII_TG3_CTRL_ADV_1000_FULL |
- + MII_TG3_CTRL_AS_MASTER |
- + MII_TG3_CTRL_ENABLE_AS_MASTER);
- + if (tp->tg3_flags & TG3_FLAG_10_100_ONLY)
- + mii_tg3_ctrl = 0;
- +
- + err |= tg3_writephy(tp, MII_TG3_CTRL, mii_tg3_ctrl);
- + err |= tg3_writephy(tp, MII_BMCR,
- + (BMCR_ANRESTART | BMCR_ANENABLE));
- + }
- +
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) {
- + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
- + tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x201f);
- + tg3_writedsp(tp, MII_TG3_DSP_RW_PORT, 0x2aaa);
- + }
- +
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
- + tg3_writephy(tp, 0x1c, 0x8d68);
- + tg3_writephy(tp, 0x1c, 0x8d68);
- + }
- +
- + /* Enable Ethernet@WireSpeed */
- + tg3_phy_set_wirespeed(tp);
- +
- + if (!err && ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401)) {
- + err = tg3_init_5401phy_dsp(tp);
- + }
- +
- + /* Determine the PHY led mode.
- + * Be careful if this gets set wrong it can result in an inability to
- + * establish a link.
- + */
- + if (tp->phy_id == PHY_ID_SERDES) {
- + tp->led_mode = led_mode_three_link;
- + }
- + else if (tp->subsystem_vendor == PCI_VENDOR_ID_DELL) {
- + tp->led_mode = led_mode_link10;
- + } else {
- + tp->led_mode = led_mode_three_link;
- + if (eeprom_signature_found &&
- + eeprom_led_mode != led_mode_auto)
- + tp->led_mode = eeprom_led_mode;
- + }
- +
- + if (tp->phy_id == PHY_ID_SERDES)
- + tp->link_config.advertising =
- + (ADVERTISED_1000baseT_Half |
- + ADVERTISED_1000baseT_Full |
- + ADVERTISED_Autoneg |
- + ADVERTISED_FIBRE);
- + if (tp->tg3_flags & TG3_FLAG_10_100_ONLY)
- + tp->link_config.advertising &=
- + ~(ADVERTISED_1000baseT_Half |
- + ADVERTISED_1000baseT_Full);
- +
- + return err;
- +}
- +
- +#if SUPPORT_PARTNO_STR
- +static void tg3_read_partno(struct tg3 *tp)
- +{
- + unsigned char vpd_data[256];
- + int i;
- +
- + for (i = 0; i < 256; i += 4) {
- + uint32_t tmp;
- +
- + if (tg3_nvram_read(tp, 0x100 + i, &tmp))
- + goto out_not_found;
- +
- + vpd_data[i + 0] = ((tmp >> 0) & 0xff);
- + vpd_data[i + 1] = ((tmp >> 8) & 0xff);
- + vpd_data[i + 2] = ((tmp >> 16) & 0xff);
- + vpd_data[i + 3] = ((tmp >> 24) & 0xff);
- + }
- +
- + /* Now parse and find the part number. */
- + for (i = 0; i < 256; ) {
- + unsigned char val = vpd_data[i];
- + int block_end;
- +
- + if (val == 0x82 || val == 0x91) {
- + i = (i + 3 +
- + (vpd_data[i + 1] +
- + (vpd_data[i + 2] << 8)));
- + continue;
- + }
- +
- + if (val != 0x90)
- + goto out_not_found;
- +
- + block_end = (i + 3 +
- + (vpd_data[i + 1] +
- + (vpd_data[i + 2] << 8)));
- + i += 3;
- + while (i < block_end) {
- + if (vpd_data[i + 0] == 'P' &&
- + vpd_data[i + 1] == 'N') {
- + int partno_len = vpd_data[i + 2];
- +
- + if (partno_len > 24)
- + goto out_not_found;
- +
- + memcpy(tp->board_part_number,
- + &vpd_data[i + 3],
- + partno_len);
- +
- + /* Success. */
- + return;
- + }
- + }
- +
- + /* Part number not found. */
- + goto out_not_found;
- + }
- +
- +out_not_found:
- + memcpy(tp->board_part_number, "none", sizeof("none"));
- +}
- +#else
- +#define tg3_read_partno(TP) ((TP)->board_part_number[0] = '\0')
- +#endif
- +
- +static int tg3_get_invariants(struct tg3 *tp)
- +{
- + uint32_t misc_ctrl_reg;
- + uint32_t pci_state_reg, grc_misc_cfg;
- + uint16_t pci_cmd;
- + uint8_t pci_latency;
- + int err;
- +
- + /* Read the subsystem vendor and device ids */
- + pci_read_config_word(tp->pdev, PCI_SUBSYSTEM_VENDOR_ID, &tp->subsystem_vendor);
- + pci_read_config_word(tp->pdev, PCI_SUBSYSTEM_ID, &tp->subsystem_device);
- +
- + /* The sun_5704 code needs infrastructure etherboot does have
- + * ignore it for now.
- + */
- +
- + /* If we have an AMD 762 or Intel ICH/ICH0 chipset, write
- + * reordering to the mailbox registers done by the host
- + * controller can cause major troubles. We read back from
- + * every mailbox register write to force the writes to be
- + * posted to the chip in order.
- + *
- + * TG3_FLAG_MBOX_WRITE_REORDER has been forced on.
- + */
- +
- + /* Force memory write invalidate off. If we leave it on,
- + * then on 5700_BX chips we have to enable a workaround.
- + * The workaround is to set the TG3PCI_DMA_RW_CTRL boundry
- + * to match the cacheline size. The Broadcom driver have this
- + * workaround but turns MWI off all the times so never uses
- + * it. This seems to suggest that the workaround is insufficient.
- + */
- + pci_read_config_word(tp->pdev, PCI_COMMAND, &pci_cmd);
- + pci_cmd &= ~PCI_COMMAND_INVALIDATE;
- + /* Also, force SERR#/PERR# in PCI command. */
- + pci_cmd |= PCI_COMMAND_PARITY | PCI_COMMAND_SERR;
- + pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd);
- +
- + /* It is absolutely critical that TG3PCI_MISC_HOST_CTRL
- + * has the register indirect write enable bit set before
- + * we try to access any of the MMIO registers. It is also
- + * critical that the PCI-X hw workaround situation is decided
- + * before that as well.
- + */
- + pci_read_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, &misc_ctrl_reg);
- +
- + tp->pci_chip_rev_id = (misc_ctrl_reg >> MISC_HOST_CTRL_CHIPREV_SHIFT);
- +
- + /* Initialize misc host control in PCI block. */
- + tp->misc_host_ctrl |= (misc_ctrl_reg &
- + MISC_HOST_CTRL_CHIPREV);
- + pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL,
- + tp->misc_host_ctrl);
- +
- + pci_read_config_byte(tp->pdev, PCI_LATENCY_TIMER, &pci_latency);
- + if (pci_latency < 64) {
- + pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER, 64);
- + }
- +
- + pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE, &pci_state_reg);
- +
- + /* If this is a 5700 BX chipset, and we are in PCI-X
- + * mode, enable register write workaround.
- + *
- + * The workaround is to use indirect register accesses
- + * for all chip writes not to mailbox registers.
- + *
- + * In etherboot to simplify things we just always use this work around.
- + */
- + if ((pci_state_reg & PCISTATE_CONV_PCI_MODE) == 0) {
- + tp->tg3_flags |= TG3_FLAG_PCIX_MODE;
- + }
- + /* Back to back register writes can cause problems on the 5701,
- + * the workaround is to read back all reg writes except those to
- + * mailbox regs.
- + * In etherboot we always use indirect register accesses so
- + * we don't see this.
- + */
- +
- + if ((pci_state_reg & PCISTATE_BUS_SPEED_HIGH) != 0)
- + tp->tg3_flags |= TG3_FLAG_PCI_HIGH_SPEED;
- + if ((pci_state_reg & PCISTATE_BUS_32BIT) != 0)
- + tp->tg3_flags |= TG3_FLAG_PCI_32BIT;
- +
- + /* Chip-specific fixup from Broadcom driver */
- + if ((tp->pci_chip_rev_id == CHIPREV_ID_5704_A0) &&
- + (!(pci_state_reg & PCISTATE_RETRY_SAME_DMA))) {
- + pci_state_reg |= PCISTATE_RETRY_SAME_DMA;
- + pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, pci_state_reg);
- + }
- +
- + /* Force the chip into D0. */
- + tg3_set_power_state_0(tp);
- +
- + /* Etherboot does not ask the tg3 to do checksums */
- + /* Etherboot does not ask the tg3 to do jumbo frames */
- + /* Ehterboot does not ask the tg3 to use WakeOnLan. */
- +
- + /* A few boards don't want Ethernet@WireSpeed phy feature */
- + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) ||
- + ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) &&
- + (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) &&
- + (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1))) {
- + tp->tg3_flags2 |= TG3_FLG2_NO_ETH_WIRE_SPEED;
- + }
- +
- + /* Avoid tagged irq status etherboot does not use irqs */
- +
- + /* Only 5701 and later support tagged irq status mode.
- + * Also, 5788 chips cannot use tagged irq status.
- + *
- + * However, since etherboot does not use irqs avoid tagged irqs
- + * status because the interrupt condition is more difficult to
- + * fully clear in that mode.
- + */
- +
- + /* Since some 5700_AX && 5700_BX have problems with 32BYTE
- + * coalesce_mode, and the rest work fine anything set.
- + * Don't enable HOST_CC_MODE_32BYTE in etherboot.
- + */
- +
- + /* Initialize MAC MI mode, polling disabled. */
- + tw32_carefully(MAC_MI_MODE, tp->mi_mode);
- +
- + /* Initialize data/descriptor byte/word swapping. */
- + tw32(GRC_MODE, tp->grc_mode);
- +
- + tg3_switch_clocks(tp);
- +
- + /* Clear this out for sanity. */
- + tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0);
- +
- + /* Etherboot does not need to check if the PCIX_TARGET_HWBUG
- + * is needed. It always uses it.
- + */
- +
- + udelay(50);
- + tg3_nvram_init(tp);
- +
- + /* The TX descriptors will reside in main memory.
- + */
- +
- + /* See which board we are using.
- + */
- + grc_misc_cfg = tr32(GRC_MISC_CFG);
- + grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK;
- +
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 &&
- + grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5704CIOBE) {
- + tp->tg3_flags |= TG3_FLAG_SPLIT_MODE;
- + tp->split_mode_max_reqs = SPLIT_MODE_5704_MAX_REQ;
- + }
- +
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
- + (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 ||
- + grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M))
- + tp->tg3_flags2 |= TG3_FLG2_IS_5788;
- +
- + /* these are limited to 10/100 only */
- + if (((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) &&
- + ((grc_misc_cfg == 0x8000) || (grc_misc_cfg == 0x4000))) ||
- + ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) &&
- + (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM) &&
- + ((tp->pdev->dev_id == PCI_DEVICE_ID_TIGON3_5901) ||
- + (tp->pdev->dev_id == PCI_DEVICE_ID_TIGON3_5901_2)))) {
- + tp->tg3_flags |= TG3_FLAG_10_100_ONLY;
- + }
- +
- + err = tg3_phy_probe(tp);
- + if (err) {
- + printf("phy probe failed, err %d\n", err);
- + }
- +
- + tg3_read_partno(tp);
- +
- +
- + /* 5700 BX chips need to have their TX producer index mailboxes
- + * written twice to workaround a bug.
- + * In etherboot we do this unconditionally to simplify things.
- + */
- +
- + /* 5700 chips can get confused if TX buffers straddle the
- + * 4GB address boundary in some cases.
- + *
- + * In etherboot we can ignore the problem as etherboot lives below 4GB.
- + */
- +
- + /* In etherboot wake-on-lan is unconditionally disabled */
- + return err;
- +}
- +
- +static int tg3_get_device_address(struct tg3 *tp)
- +{
- + struct nic *nic = tp->nic;
- + uint32_t hi, lo, mac_offset;
- +
- + if (PCI_FUNC(tp->pdev->devfn) == 0)
- + mac_offset = 0x7c;
- + else
- + mac_offset = 0xcc;
- +
- + /* First try to get it from MAC address mailbox. */
- + tg3_read_mem(NIC_SRAM_MAC_ADDR_HIGH_MBOX, &hi);
- + if ((hi >> 16) == 0x484b) {
- + nic->node_addr[0] = (hi >> 8) & 0xff;
- + nic->node_addr[1] = (hi >> 0) & 0xff;
- +
- + tg3_read_mem(NIC_SRAM_MAC_ADDR_LOW_MBOX, &lo);
- + nic->node_addr[2] = (lo >> 24) & 0xff;
- + nic->node_addr[3] = (lo >> 16) & 0xff;
- + nic->node_addr[4] = (lo >> 8) & 0xff;
- + nic->node_addr[5] = (lo >> 0) & 0xff;
- + }
- + /* Next, try NVRAM. */
- + else if (!tg3_nvram_read(tp, mac_offset + 0, &hi) &&
- + !tg3_nvram_read(tp, mac_offset + 4, &lo)) {
- + nic->node_addr[0] = ((hi >> 16) & 0xff);
- + nic->node_addr[1] = ((hi >> 24) & 0xff);
- + nic->node_addr[2] = ((lo >> 0) & 0xff);
- + nic->node_addr[3] = ((lo >> 8) & 0xff);
- + nic->node_addr[4] = ((lo >> 16) & 0xff);
- + nic->node_addr[5] = ((lo >> 24) & 0xff);
- + }
- + /* Finally just fetch it out of the MAC control regs. */
- + else {
- + hi = tr32(MAC_ADDR_0_HIGH);
- + lo = tr32(MAC_ADDR_0_LOW);
- +
- + nic->node_addr[5] = lo & 0xff;
- + nic->node_addr[4] = (lo >> 8) & 0xff;
- + nic->node_addr[3] = (lo >> 16) & 0xff;
- + nic->node_addr[2] = (lo >> 24) & 0xff;
- + nic->node_addr[1] = hi & 0xff;
- + nic->node_addr[0] = (hi >> 8) & 0xff;
- + }
- +
- + return 0;
- +}
- +
- +
- +static int tg3_setup_dma(struct tg3 *tp)
- +{
- + tw32(TG3PCI_CLOCK_CTRL, 0);
- +
- + if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) == 0) {
- + tp->dma_rwctrl =
- + (0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) |
- + (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) |
- + (0x7 << DMA_RWCTRL_WRITE_WATER_SHIFT) |
- + (0x7 << DMA_RWCTRL_READ_WATER_SHIFT) |
- + (0x0f << DMA_RWCTRL_MIN_DMA_SHIFT);
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
- + tp->dma_rwctrl &= ~(DMA_RWCTRL_MIN_DMA << DMA_RWCTRL_MIN_DMA_SHIFT);
- + }
- + } else {
- + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
- + tp->dma_rwctrl =
- + (0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) |
- + (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) |
- + (0x3 << DMA_RWCTRL_WRITE_WATER_SHIFT) |
- + (0x7 << DMA_RWCTRL_READ_WATER_SHIFT) |
- + (0x00 << DMA_RWCTRL_MIN_DMA_SHIFT);
- + else
- + tp->dma_rwctrl =
- + (0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) |
- + (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) |
- + (0x3 << DMA_RWCTRL_WRITE_WATER_SHIFT) |
- + (0x3 << DMA_RWCTRL_READ_WATER_SHIFT) |
- + (0x0f << DMA_RWCTRL_MIN_DMA_SHIFT);
- +
- + /* Wheee, some more chip bugs... */
- + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) ||
- + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)) {
- + uint32_t ccval = tr32(TG3PCI_CLOCK_CTRL) & 0x1f;
- +
- + if ((ccval == 0x6) || (ccval == 0x7)) {
- + tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA;
- + }
- + }
- + }
- +
- + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) ||
- + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)) {
- + tp->dma_rwctrl &= ~(DMA_RWCTRL_MIN_DMA << DMA_RWCTRL_MIN_DMA_SHIFT);
- + }
- +
- + tp->dma_rwctrl |= DMA_RWCTRL_ASSERT_ALL_BE;
- +
- + tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
- +
- + return 0;
- +}
- +
- +static void tg3_init_link_config(struct tg3 *tp)
- +{
- + tp->link_config.advertising =
- + (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
- + ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
- + ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full |
- + ADVERTISED_Autoneg | ADVERTISED_MII);
- + tp->carrier_ok = 0;
- + tp->link_config.active_speed = SPEED_INVALID;
- + tp->link_config.active_duplex = DUPLEX_INVALID;
- +}
- +
- +
- +#if SUPPORT_PHY_STR
- +static const char * tg3_phy_string(struct tg3 *tp)
- +{
- + switch (tp->phy_id & PHY_ID_MASK) {
- + case PHY_ID_BCM5400: return "5400";
- + case PHY_ID_BCM5401: return "5401";
- + case PHY_ID_BCM5411: return "5411";
- + case PHY_ID_BCM5701: return "5701";
- + case PHY_ID_BCM5703: return "5703";
- + case PHY_ID_BCM5704: return "5704";
- + case PHY_ID_BCM8002: return "8002";
- + case PHY_ID_SERDES: return "serdes";
- + default: return "unknown";
- + };
- +}
- +#else
- +#define tg3_phy_string(TP) "?"
- +#endif
- +
- +
- +static void tg3_poll_link(struct tg3 *tp)
- +{
- + uint32_t mac_stat;
- +
- + mac_stat = tr32(MAC_STATUS);
- + if (tp->phy_id == PHY_ID_SERDES) {
- + if (tp->carrier_ok?
- + (mac_stat & MAC_STATUS_LNKSTATE_CHANGED):
- + (mac_stat & MAC_STATUS_PCS_SYNCED)) {
- + tw32_carefully(MAC_MODE, tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK);
- + tw32_carefully(MAC_MODE, tp->mac_mode);
- +
- + tg3_setup_phy(tp);
- + }
- + }
- + else {
- + if (mac_stat & MAC_STATUS_LNKSTATE_CHANGED) {
- + tg3_setup_phy(tp);
- + }
- + }
- +}
- +
- +/**************************************************************************
- +POLL - Wait for a frame
- +***************************************************************************/
- +static void tg3_ack_irqs(struct tg3 *tp)
- +{
- + if (tp->hw_status->status & SD_STATUS_UPDATED) {
- + /*
- + * writing any value to intr-mbox-0 clears PCI INTA# and
- + * chip-internal interrupt pending events.
- + * writing non-zero to intr-mbox-0 additional tells the
- + * NIC to stop sending us irqs, engaging "in-intr-handler"
- + * event coalescing.
- + */
- + tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
- + 0x00000001);
- + /*
- + * Flush PCI write. This also guarantees that our
- + * status block has been flushed to host memory.
- + */
- + tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW);
- + tp->hw_status->status &= ~SD_STATUS_UPDATED;
- + }
- +}
- +
- +static int tg3_poll(struct nic *nic, int retrieve)
- +{
- + /* return true if there's an ethernet packet ready to read */
- + /* nic->packet should contain data on return */
- + /* nic->packetlen should contain length of data */
- +
- + struct tg3 *tp = &tg3;
- + int result;
- +
- + result = 0;
- +
- + if ( (tp->hw_status->idx[0].rx_producer != tp->rx_rcb_ptr) && !retrieve )
- + return 1;
- +
- + tg3_ack_irqs(tp);
- +
- + if (tp->hw_status->idx[0].rx_producer != tp->rx_rcb_ptr) {
- + struct tg3_rx_buffer_desc *desc;
- + unsigned int len;
- + desc = &tp->rx_rcb[tp->rx_rcb_ptr];
- + if ((desc->opaque & RXD_OPAQUE_RING_MASK) == RXD_OPAQUE_RING_STD) {
- + len = ((desc->idx_len & RXD_LEN_MASK) >> RXD_LEN_SHIFT) - 4; /* omit crc */
- +
- + nic->packetlen = len;
- + memcpy(nic->packet, bus_to_virt(desc->addr_lo), len);
- + result = 1;
- + }
- + tp->rx_rcb_ptr = (tp->rx_rcb_ptr + 1) % TG3_RX_RCB_RING_SIZE;
- +
- + /* ACK the status ring */
- + tw32_mailbox2(MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW, tp->rx_rcb_ptr);
- +
- + /* Refill RX ring. */
- + if (result) {
- + tp->rx_std_ptr = (tp->rx_std_ptr + 1) % TG3_RX_RING_SIZE;
- + tw32_mailbox2(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW, tp->rx_std_ptr);
- + }
- + }
- + tg3_poll_link(tp);
- + return result;
- +}
- +
- +/**************************************************************************
- +TRANSMIT - Transmit a frame
- +***************************************************************************/
- +#if 0
- +static void tg3_set_txd(struct tg3 *tp, int entry,
- + dma_addr_t mapping, int len, uint32_t flags,
- + uint32_t mss_and_is_end)
- +{
- + struct tg3_tx_buffer_desc *txd = &tp->tx_ring[entry];
- + int is_end = (mss_and_is_end & 0x1);
- + if (is_end) {
- + flags |= TXD_FLAG_END;
- + }
- +
- + txd->addr_hi = 0;
- + txd->addr_lo = mapping & 0xffffffff;
- + txd->len_flags = (len << TXD_LEN_SHIFT) | flags;
- + txd->vlan_tag = 0 << TXD_VLAN_TAG_SHIFT;
- +}
- +#endif
- +
- +static void tg3_transmit(struct nic *nic, const char *dst_addr,
- + unsigned int type, unsigned int size, const char *packet)
- +{
- + static struct eth_frame {
- + uint8_t dst_addr[ETH_ALEN];
- + uint8_t src_addr[ETH_ALEN];
- + uint16_t type;
- + uint8_t data [ETH_FRAME_LEN - ETH_HLEN];
- + } frame[2];
- + static int frame_idx;
- +
- + /* send the packet to destination */
- + struct tg3_tx_buffer_desc *txd;
- + struct tg3 *tp;
- + uint32_t entry;
- + int i;
- +
- + /* Wait until there is a free packet frame */
- + tp = &tg3;
- + i = 0;
- + entry = tp->tx_prod;
- + while((tp->hw_status->idx[0].tx_consumer != entry) &&
- + (tp->hw_status->idx[0].tx_consumer != PREV_TX(entry))) {
- + mdelay(10); /* give the nick a chance */
- + poll_interruptions();
- + if (++i > 500) { /* timeout 5s for transmit */
- + printf("transmit timed out\n");
- + tg3_halt(tp);
- + tg3_setup_hw(tp);
- + return;
- + }
- + }
- + if (i != 0) {
- + printf("#");
- + }
- +
- + /* Copy the packet to the our local buffer */
- + memcpy(&frame[frame_idx].dst_addr, dst_addr, ETH_ALEN);
- + memcpy(&frame[frame_idx].src_addr, nic->node_addr, ETH_ALEN);
- + frame[frame_idx].type = htons(type);
- + memset(&frame[frame_idx].data, 0, sizeof(frame[frame_idx].data));
- + memcpy(&frame[frame_idx].data, packet, size);
- +
- + /* Setup the ring buffer entry to transmit */
- + txd = &tp->tx_ring[entry];
- + txd->addr_hi = 0; /* Etherboot runs under 4GB */
- + txd->addr_lo = virt_to_bus(&frame[frame_idx]);
- + txd->len_flags = ((size + ETH_HLEN) << TXD_LEN_SHIFT) | TXD_FLAG_END;
- + txd->vlan_tag = 0 << TXD_VLAN_TAG_SHIFT;
- +
- + /* Advance to the next entry */
- + entry = NEXT_TX(entry);
- + frame_idx ^= 1;
- +
- + /* Packets are ready, update Tx producer idx local and on card */
- + tw32_mailbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry);
- + tw32_mailbox2((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry);
- + tp->tx_prod = entry;
- +}
- +
- +/**************************************************************************
- +DISABLE - Turn off ethernet interface
- +***************************************************************************/
- +static void tg3_disable(struct dev *dev __unused)
- +{
- + struct tg3 *tp = &tg3;
- + /* put the card in its initial state */
- + /* This function serves 3 purposes.
- + * This disables DMA and interrupts so we don't receive
- + * unexpected packets or interrupts from the card after
- + * etherboot has finished.
- + * This frees resources so etherboot may use
- + * this driver on another interface
- + * This allows etherboot to reinitialize the interface
- + * if something is something goes wrong.
- + */
- + tg3_halt(tp);
- + tp->tg3_flags &= ~(TG3_FLAG_INIT_COMPLETE|TG3_FLAG_GOT_SERDES_FLOWCTL);
- + tp->carrier_ok = 0;
- + iounmap((void *)tp->regs);
- +}
- +
- +/**************************************************************************
- +IRQ - Enable, Disable, or Force interrupts
- +***************************************************************************/
- +static void tg3_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
- +
- +/**************************************************************************
- +PROBE - Look for an adapter, this routine's visible to the outside
- +You should omit the last argument struct pci_device * for a non-PCI NIC
- +***************************************************************************/
- +static int tg3_probe(struct dev *dev, struct pci_device *pdev)
- +{
- + struct nic *nic = (struct nic *)dev;
- + struct tg3 *tp = &tg3;
- + unsigned long tg3reg_base, tg3reg_len;
- + int i, err, pm_cap;
- +
- + if (pdev == 0)
- + return 0;
- +
- + memset(tp, 0, sizeof(*tp));
- +
- + adjust_pci_device(pdev);
- +
- + nic->irqno = 0;
- + nic->ioaddr = pdev->ioaddr & ~3;
- +
- + /* Find power-management capability. */
- + pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
- + if (pm_cap == 0) {
- + printf("Cannot find PowerManagement capability, aborting.\n");
- + return 0;
- + }
- + tg3reg_base = pci_bar_start(pdev, PCI_BASE_ADDRESS_0);
- + if (tg3reg_base == -1UL) {
- + printf("Unuseable bar\n");
- + return 0;
- + }
- + tg3reg_len = pci_bar_size(pdev, PCI_BASE_ADDRESS_0);
- +
- + tp->pdev = pdev;
- + tp->nic = nic;
- + tp->pm_cap = pm_cap;
- + tp->rx_mode = 0;
- + tp->tx_mode = 0;
- + tp->mi_mode = MAC_MI_MODE_BASE;
- + tp->tg3_flags = 0 & ~TG3_FLAG_INIT_COMPLETE;
- +
- + /* The word/byte swap controls here control register access byte
- + * swapping. DMA data byte swapping is controlled in the GRC_MODE
- + * setting below.
- + */
- + tp->misc_host_ctrl =
- + MISC_HOST_CTRL_MASK_PCI_INT |
- + MISC_HOST_CTRL_WORD_SWAP |
- + MISC_HOST_CTRL_INDIR_ACCESS |
- + MISC_HOST_CTRL_PCISTATE_RW;
- +
- + /* The NONFRM (non-frame) byte/word swap controls take effect
- + * on descriptor entries, anything which isn't packet data.
- + *
- + * The StrongARM chips on the board (one for tx, one for rx)
- + * are running in big-endian mode.
- + */
- + tp->grc_mode = (GRC_MODE_WSWAP_DATA | GRC_MODE_BSWAP_DATA |
- + GRC_MODE_WSWAP_NONFRM_DATA);
- +#if __BYTE_ORDER == __BIG_ENDIAN
- + tp->grc_mode |= GRC_MODE_BSWAP_NONFRM_DATA;
- +#endif
- + tp->regs = (unsigned long) ioremap(tg3reg_base, tg3reg_len);
- + if (tp->regs == 0UL) {
- + printf("Cannot map device registers, aborting\n");
- + return 0;
- + }
- +
- + tg3_init_link_config(tp);
- +
- + err = tg3_get_invariants(tp);
- + if (err) {
- + printf("Problem fetching invariants of chip, aborting.\n");
- + goto err_out_iounmap;
- + }
- +
- + err = tg3_get_device_address(tp);
- + if (err) {
- + printf("Could not obtain valid ethernet address, aborting.\n");
- + goto err_out_iounmap;
- + }
- + printf("Ethernet addr: %!\n", nic->node_addr);
- +
- + tg3_setup_dma(tp);
- +
- + /* Now that we have fully setup the chip, save away a snapshot
- + * of the PCI config space. We need to restore this after
- + * GRC_MISC_CFG core clock resets and some resume events.
- + */
- + pci_save_state(tp->pdev, tp->pci_cfg_state);
- +
- + printf("Tigon3 [partno(%s) rev %hx PHY(%s)] (PCI%s:%s:%s)\n",
- + tp->board_part_number,
- + tp->pci_chip_rev_id,
- + tg3_phy_string(tp),
- + ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "X" : ""),
- + ((tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED) ?
- + ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "133MHz" : "66MHz") :
- + ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "100MHz" : "33MHz")),
- + ((tp->tg3_flags & TG3_FLAG_PCI_32BIT) ? "32-bit" : "64-bit"));
- +
- +
- + err = tg3_setup_hw(tp);
- + if (err) {
- + goto err_out_disable;
- + }
- + tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE;
- +
- + /* Wait for a reasonable time for the link to come up */
- + tg3_poll_link(tp);
- + for(i = 0; !tp->carrier_ok && (i < VALID_LINK_TIMEOUT*100); i++) {
- + mdelay(1);
- + tg3_poll_link(tp);
- + }
- + if (!tp->carrier_ok){
- + printf("Valid link not established\n");
- + goto err_out_disable;
- + }
- +
- + dev->disable = tg3_disable;
- + nic->poll = tg3_poll;
- + nic->transmit = tg3_transmit;
- + nic->irq = tg3_irq;
- +
- + return 1;
- +
- + err_out_iounmap:
- + iounmap((void *)tp->regs);
- + return 0;
- + err_out_disable:
- + tg3_disable(dev);
- + return 0;
- +}
- +
- +static struct pci_id tg3_nics[] = {
- +PCI_ROM(0x14e4, 0x1644, "tg3-5700", "Broadcom Tigon 3 5700"),
- +PCI_ROM(0x14e4, 0x1645, "tg3-5701", "Broadcom Tigon 3 5701"),
- +PCI_ROM(0x14e4, 0x1646, "tg3-5702", "Broadcom Tigon 3 5702"),
- +PCI_ROM(0x14e4, 0x1647, "tg3-5703", "Broadcom Tigon 3 5703"),
- +PCI_ROM(0x14e4, 0x1648, "tg3-5704", "Broadcom Tigon 3 5704"),
- +PCI_ROM(0x14e4, 0x164d, "tg3-5702FE", "Broadcom Tigon 3 5702FE"),
- +PCI_ROM(0x14e4, 0x1653, "tg3-5705", "Broadcom Tigon 3 5705"),
- +PCI_ROM(0x14e4, 0x1654, "tg3-5705_2", "Broadcom Tigon 3 5705_2"),
- +PCI_ROM(0x14e4, 0x165d, "tg3-5705M", "Broadcom Tigon 3 5705M"),
- +PCI_ROM(0x14e4, 0x165e, "tg3-5705M_2", "Broadcom Tigon 3 5705M_2"),
- +PCI_ROM(0x14e4, 0x1696, "tg3-5782", "Broadcom Tigon 3 5782"),
- +PCI_ROM(0x14e4, 0x169c, "tg3-5788", "Broadcom Tigon 3 5788"),
- +PCI_ROM(0x14e4, 0x16a6, "tg3-5702X", "Broadcom Tigon 3 5702X"),
- +PCI_ROM(0x14e4, 0x16a7, "tg3-5703X", "Broadcom Tigon 3 5703X"),
- +PCI_ROM(0x14e4, 0x16a8, "tg3-5704S", "Broadcom Tigon 3 5704S"),
- +PCI_ROM(0x14e4, 0x16c6, "tg3-5702A3", "Broadcom Tigon 3 5702A3"),
- +PCI_ROM(0x14e4, 0x16c7, "tg3-5703A3", "Broadcom Tigon 3 5703A3"),
- +PCI_ROM(0x14e4, 0x170d, "tg3-5901", "Broadcom Tigon 3 5901"),
- +PCI_ROM(0x14e4, 0x170e, "tg3-5901_2", "Broadcom Tigon 3 5901_2"),
- +PCI_ROM(0x1148, 0x4400, "tg3-9DXX", "Syskonnect 9DXX"),
- +PCI_ROM(0x1148, 0x4500, "tg3-9MXX", "Syskonnect 9MXX"),
- +PCI_ROM(0x173b, 0x03e8, "tg3-ac1000", "Altima AC1000"),
- +PCI_ROM(0x173b, 0x03e9, "tg3-ac1001", "Altima AC1001"),
- +PCI_ROM(0x173b, 0x03ea, "tg3-ac9100", "Altima AC9100"),
- +PCI_ROM(0x173b, 0x03eb, "tg3-ac1003", "Altima AC1003"),
- +};
- +
- +struct pci_driver tg3_driver = {
- + .type = NIC_DRIVER,
- + .name = "TG3",
- + .probe = tg3_probe,
- + .ids = tg3_nics,
- + .id_count = sizeof(tg3_nics)/sizeof(tg3_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/tg3.h grub-0.97/netboot/tg3.h
- --- grub-0.97.orig/netboot/tg3.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/tg3.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,2203 @@
- +/* $Id: grub-0.95-diskless-patch-2.patch,v 1.1.1.1 2005/06/14 08:18:50 wesolows Exp $
- + * tg3.h: Definitions for Broadcom Tigon3 ethernet driver.
- + *
- + * Copyright (C) 2001, 2002 David S. Miller (davem@redhat.com)
- + * Copyright (C) 2001 Jeff Garzik (jgarzik@mandrakesoft.com)
- + */
- +
- +#ifndef _T3_H
- +#define _T3_H
- +
- +#include "stdint.h"
- +
- +typedef unsigned long dma_addr_t;
- +
- +/* From mii.h */
- +
- +/* Indicates what features are advertised by the interface. */
- +#define ADVERTISED_10baseT_Half (1 << 0)
- +#define ADVERTISED_10baseT_Full (1 << 1)
- +#define ADVERTISED_100baseT_Half (1 << 2)
- +#define ADVERTISED_100baseT_Full (1 << 3)
- +#define ADVERTISED_1000baseT_Half (1 << 4)
- +#define ADVERTISED_1000baseT_Full (1 << 5)
- +#define ADVERTISED_Autoneg (1 << 6)
- +#define ADVERTISED_TP (1 << 7)
- +#define ADVERTISED_AUI (1 << 8)
- +#define ADVERTISED_MII (1 << 9)
- +#define ADVERTISED_FIBRE (1 << 10)
- +#define ADVERTISED_BNC (1 << 11)
- +
- +/* The following are all involved in forcing a particular link
- + * mode for the device for setting things. When getting the
- + * devices settings, these indicate the current mode and whether
- + * it was foced up into this mode or autonegotiated.
- + */
- +
- +/* The forced speed, 10Mb, 100Mb, gigabit. */
- +#define SPEED_10 0
- +#define SPEED_100 1
- +#define SPEED_1000 2
- +#define SPEED_INVALID 3
- +
- +
- +/* Duplex, half or full. */
- +#define DUPLEX_HALF 0x00
- +#define DUPLEX_FULL 0x01
- +#define DUPLEX_INVALID 0x02
- +
- +/* Which connector port. */
- +#define PORT_TP 0x00
- +#define PORT_AUI 0x01
- +#define PORT_MII 0x02
- +#define PORT_FIBRE 0x03
- +#define PORT_BNC 0x04
- +
- +/* Which tranceiver to use. */
- +#define XCVR_INTERNAL 0x00
- +#define XCVR_EXTERNAL 0x01
- +#define XCVR_DUMMY1 0x02
- +#define XCVR_DUMMY2 0x03
- +#define XCVR_DUMMY3 0x04
- +
- +/* Enable or disable autonegotiation. If this is set to enable,
- + * the forced link modes above are completely ignored.
- + */
- +#define AUTONEG_DISABLE 0x00
- +#define AUTONEG_ENABLE 0x01
- +
- +/* Wake-On-Lan options. */
- +#define WAKE_PHY (1 << 0)
- +#define WAKE_UCAST (1 << 1)
- +#define WAKE_MCAST (1 << 2)
- +#define WAKE_BCAST (1 << 3)
- +#define WAKE_ARP (1 << 4)
- +#define WAKE_MAGIC (1 << 5)
- +#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
- +
- +/* Generic MII registers. */
- +
- +#define MII_BMCR 0x00 /* Basic mode control register */
- +#define MII_BMSR 0x01 /* Basic mode status register */
- +#define MII_PHYSID1 0x02 /* PHYS ID 1 */
- +#define MII_PHYSID2 0x03 /* PHYS ID 2 */
- +#define MII_ADVERTISE 0x04 /* Advertisement control reg */
- +#define MII_LPA 0x05 /* Link partner ability reg */
- +#define MII_EXPANSION 0x06 /* Expansion register */
- +#define MII_DCOUNTER 0x12 /* Disconnect counter */
- +#define MII_FCSCOUNTER 0x13 /* False carrier counter */
- +#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */
- +#define MII_RERRCOUNTER 0x15 /* Receive error counter */
- +#define MII_SREVISION 0x16 /* Silicon revision */
- +#define MII_RESV1 0x17 /* Reserved... */
- +#define MII_LBRERROR 0x18 /* Lpback, rx, bypass error */
- +#define MII_PHYADDR 0x19 /* PHY address */
- +#define MII_RESV2 0x1a /* Reserved... */
- +#define MII_TPISTATUS 0x1b /* TPI status for 10mbps */
- +#define MII_NCONFIG 0x1c /* Network interface config */
- +
- +/* Basic mode control register. */
- +#define BMCR_RESV 0x007f /* Unused... */
- +#define BMCR_CTST 0x0080 /* Collision test */
- +#define BMCR_FULLDPLX 0x0100 /* Full duplex */
- +#define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */
- +#define BMCR_ISOLATE 0x0400 /* Disconnect DP83840 from MII */
- +#define BMCR_PDOWN 0x0800 /* Powerdown the DP83840 */
- +#define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */
- +#define BMCR_SPEED100 0x2000 /* Select 100Mbps */
- +#define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */
- +#define BMCR_RESET 0x8000 /* Reset the DP83840 */
- +
- +/* Basic mode status register. */
- +#define BMSR_ERCAP 0x0001 /* Ext-reg capability */
- +#define BMSR_JCD 0x0002 /* Jabber detected */
- +#define BMSR_LSTATUS 0x0004 /* Link status */
- +#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */
- +#define BMSR_RFAULT 0x0010 /* Remote fault detected */
- +#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
- +#define BMSR_RESV 0x07c0 /* Unused... */
- +#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */
- +#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */
- +#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */
- +#define BMSR_100FULL 0x4000 /* Can do 100mbps, full-duplex */
- +#define BMSR_100BASE4 0x8000 /* Can do 100mbps, 4k packets */
- +
- +/* Advertisement control register. */
- +#define ADVERTISE_SLCT 0x001f /* Selector bits */
- +#define ADVERTISE_CSMA 0x0001 /* Only selector supported */
- +#define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */
- +#define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */
- +#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */
- +#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */
- +#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */
- +#define ADVERTISE_RESV 0x1c00 /* Unused... */
- +#define ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */
- +#define ADVERTISE_LPACK 0x4000 /* Ack link partners response */
- +#define ADVERTISE_NPAGE 0x8000 /* Next page bit */
- +
- +#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
- + ADVERTISE_CSMA)
- +#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
- + ADVERTISE_100HALF | ADVERTISE_100FULL)
- +
- +/* Link partner ability register. */
- +#define LPA_SLCT 0x001f /* Same as advertise selector */
- +#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */
- +#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */
- +#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */
- +#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */
- +#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */
- +#define LPA_RESV 0x1c00 /* Unused... */
- +#define LPA_RFAULT 0x2000 /* Link partner faulted */
- +#define LPA_LPACK 0x4000 /* Link partner acked us */
- +#define LPA_NPAGE 0x8000 /* Next page bit */
- +
- +#define LPA_DUPLEX (LPA_10FULL | LPA_100FULL)
- +#define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4)
- +
- +/* Expansion register for auto-negotiation. */
- +#define EXPANSION_NWAY 0x0001 /* Can do N-way auto-nego */
- +#define EXPANSION_LCWP 0x0002 /* Got new RX page code word */
- +#define EXPANSION_ENABLENPAGE 0x0004 /* This enables npage words */
- +#define EXPANSION_NPCAPABLE 0x0008 /* Link partner supports npage */
- +#define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */
- +#define EXPANSION_RESV 0xffe0 /* Unused... */
- +
- +/* N-way test register. */
- +#define NWAYTEST_RESV1 0x00ff /* Unused... */
- +#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */
- +#define NWAYTEST_RESV2 0xfe00 /* Unused... */
- +
- +
- +/* From tg3.h */
- +
- +#define TG3_64BIT_REG_HIGH 0x00UL
- +#define TG3_64BIT_REG_LOW 0x04UL
- +
- +/* Descriptor block info. */
- +#define TG3_BDINFO_HOST_ADDR 0x0UL /* 64-bit */
- +#define TG3_BDINFO_MAXLEN_FLAGS 0x8UL /* 32-bit */
- +#define BDINFO_FLAGS_USE_EXT_RECV 0x00000001 /* ext rx_buffer_desc */
- +#define BDINFO_FLAGS_DISABLED 0x00000002
- +#define BDINFO_FLAGS_MAXLEN_MASK 0xffff0000
- +#define BDINFO_FLAGS_MAXLEN_SHIFT 16
- +#define TG3_BDINFO_NIC_ADDR 0xcUL /* 32-bit */
- +#define TG3_BDINFO_SIZE 0x10UL
- +
- +#define RX_COPY_THRESHOLD 256
- +
- +#define RX_STD_MAX_SIZE 1536
- +#define RX_STD_MAX_SIZE_5705 512
- +#define RX_JUMBO_MAX_SIZE 0xdeadbeef /* XXX */
- +
- +/* First 256 bytes are a mirror of PCI config space. */
- +#define TG3PCI_VENDOR 0x00000000
- +#define TG3PCI_VENDOR_BROADCOM 0x14e4
- +#define TG3PCI_DEVICE 0x00000002
- +#define TG3PCI_DEVICE_TIGON3_1 0x1644 /* BCM5700 */
- +#define TG3PCI_DEVICE_TIGON3_2 0x1645 /* BCM5701 */
- +#define TG3PCI_DEVICE_TIGON3_3 0x1646 /* BCM5702 */
- +#define TG3PCI_DEVICE_TIGON3_4 0x1647 /* BCM5703 */
- +#define TG3PCI_COMMAND 0x00000004
- +#define TG3PCI_STATUS 0x00000006
- +#define TG3PCI_CCREVID 0x00000008
- +#define TG3PCI_CACHELINESZ 0x0000000c
- +#define TG3PCI_LATTIMER 0x0000000d
- +#define TG3PCI_HEADERTYPE 0x0000000e
- +#define TG3PCI_BIST 0x0000000f
- +#define TG3PCI_BASE0_LOW 0x00000010
- +#define TG3PCI_BASE0_HIGH 0x00000014
- +/* 0x18 --> 0x2c unused */
- +#define TG3PCI_SUBSYSVENID 0x0000002c
- +#define TG3PCI_SUBSYSID 0x0000002e
- +#define TG3PCI_ROMADDR 0x00000030
- +#define TG3PCI_CAPLIST 0x00000034
- +/* 0x35 --> 0x3c unused */
- +#define TG3PCI_IRQ_LINE 0x0000003c
- +#define TG3PCI_IRQ_PIN 0x0000003d
- +#define TG3PCI_MIN_GNT 0x0000003e
- +#define TG3PCI_MAX_LAT 0x0000003f
- +#define TG3PCI_X_CAPS 0x00000040
- +#define PCIX_CAPS_RELAXED_ORDERING 0x00020000
- +#define PCIX_CAPS_SPLIT_MASK 0x00700000
- +#define PCIX_CAPS_SPLIT_SHIFT 20
- +#define PCIX_CAPS_BURST_MASK 0x000c0000
- +#define PCIX_CAPS_BURST_SHIFT 18
- +#define PCIX_CAPS_MAX_BURST_CPIOB 2
- +#define TG3PCI_PM_CAP_PTR 0x00000041
- +#define TG3PCI_X_COMMAND 0x00000042
- +#define TG3PCI_X_STATUS 0x00000044
- +#define TG3PCI_PM_CAP_ID 0x00000048
- +#define TG3PCI_VPD_CAP_PTR 0x00000049
- +#define TG3PCI_PM_CAPS 0x0000004a
- +#define TG3PCI_PM_CTRL_STAT 0x0000004c
- +#define TG3PCI_BR_SUPP_EXT 0x0000004e
- +#define TG3PCI_PM_DATA 0x0000004f
- +#define TG3PCI_VPD_CAP_ID 0x00000050
- +#define TG3PCI_MSI_CAP_PTR 0x00000051
- +#define TG3PCI_VPD_ADDR_FLAG 0x00000052
- +#define VPD_ADDR_FLAG_WRITE 0x00008000
- +#define TG3PCI_VPD_DATA 0x00000054
- +#define TG3PCI_MSI_CAP_ID 0x00000058
- +#define TG3PCI_NXT_CAP_PTR 0x00000059
- +#define TG3PCI_MSI_CTRL 0x0000005a
- +#define TG3PCI_MSI_ADDR_LOW 0x0000005c
- +#define TG3PCI_MSI_ADDR_HIGH 0x00000060
- +#define TG3PCI_MSI_DATA 0x00000064
- +/* 0x66 --> 0x68 unused */
- +#define TG3PCI_MISC_HOST_CTRL 0x00000068
- +#define MISC_HOST_CTRL_CLEAR_INT 0x00000001
- +#define MISC_HOST_CTRL_MASK_PCI_INT 0x00000002
- +#define MISC_HOST_CTRL_BYTE_SWAP 0x00000004
- +#define MISC_HOST_CTRL_WORD_SWAP 0x00000008
- +#define MISC_HOST_CTRL_PCISTATE_RW 0x00000010
- +#define MISC_HOST_CTRL_CLKREG_RW 0x00000020
- +#define MISC_HOST_CTRL_REGWORD_SWAP 0x00000040
- +#define MISC_HOST_CTRL_INDIR_ACCESS 0x00000080
- +#define MISC_HOST_CTRL_IRQ_MASK_MODE 0x00000100
- +#define MISC_HOST_CTRL_TAGGED_STATUS 0x00000200
- +#define MISC_HOST_CTRL_CHIPREV 0xffff0000
- +#define MISC_HOST_CTRL_CHIPREV_SHIFT 16
- +#define GET_CHIP_REV_ID(MISC_HOST_CTRL) \
- + (((MISC_HOST_CTRL) & MISC_HOST_CTRL_CHIPREV) >> \
- + MISC_HOST_CTRL_CHIPREV_SHIFT)
- +#define CHIPREV_ID_5700_A0 0x7000
- +#define CHIPREV_ID_5700_A1 0x7001
- +#define CHIPREV_ID_5700_B0 0x7100
- +#define CHIPREV_ID_5700_B1 0x7101
- +#define CHIPREV_ID_5700_B3 0x7102
- +#define CHIPREV_ID_5700_ALTIMA 0x7104
- +#define CHIPREV_ID_5700_C0 0x7200
- +#define CHIPREV_ID_5701_A0 0x0000
- +#define CHIPREV_ID_5701_B0 0x0100
- +#define CHIPREV_ID_5701_B2 0x0102
- +#define CHIPREV_ID_5701_B5 0x0105
- +#define CHIPREV_ID_5703_A0 0x1000
- +#define CHIPREV_ID_5703_A1 0x1001
- +#define CHIPREV_ID_5703_A2 0x1002
- +#define CHIPREV_ID_5703_A3 0x1003
- +#define CHIPREV_ID_5704_A0 0x2000
- +#define CHIPREV_ID_5704_A1 0x2001
- +#define CHIPREV_ID_5704_A2 0x2002
- +#define CHIPREV_ID_5705_A0 0x3000
- +#define CHIPREV_ID_5705_A1 0x3001
- +#define CHIPREV_ID_5705_A2 0x3002
- +#define CHIPREV_ID_5705_A3 0x3003
- +#define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12)
- +#define ASIC_REV_5700 0x07
- +#define ASIC_REV_5701 0x00
- +#define ASIC_REV_5703 0x01
- +#define ASIC_REV_5704 0x02
- +#define ASIC_REV_5705 0x03
- +#define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8)
- +#define CHIPREV_5700_AX 0x70
- +#define CHIPREV_5700_BX 0x71
- +#define CHIPREV_5700_CX 0x72
- +#define CHIPREV_5701_AX 0x00
- +#define GET_METAL_REV(CHIP_REV_ID) ((CHIP_REV_ID) & 0xff)
- +#define METAL_REV_A0 0x00
- +#define METAL_REV_A1 0x01
- +#define METAL_REV_B0 0x00
- +#define METAL_REV_B1 0x01
- +#define METAL_REV_B2 0x02
- +#define TG3PCI_DMA_RW_CTRL 0x0000006c
- +#define DMA_RWCTRL_MIN_DMA 0x000000ff
- +#define DMA_RWCTRL_MIN_DMA_SHIFT 0
- +#define DMA_RWCTRL_READ_BNDRY_MASK 0x00000700
- +#define DMA_RWCTRL_READ_BNDRY_DISAB 0x00000000
- +#define DMA_RWCTRL_READ_BNDRY_16 0x00000100
- +#define DMA_RWCTRL_READ_BNDRY_32 0x00000200
- +#define DMA_RWCTRL_READ_BNDRY_64 0x00000300
- +#define DMA_RWCTRL_READ_BNDRY_128 0x00000400
- +#define DMA_RWCTRL_READ_BNDRY_256 0x00000500
- +#define DMA_RWCTRL_READ_BNDRY_512 0x00000600
- +#define DMA_RWCTRL_READ_BNDRY_1024 0x00000700
- +#define DMA_RWCTRL_WRITE_BNDRY_MASK 0x00003800
- +#define DMA_RWCTRL_WRITE_BNDRY_DISAB 0x00000000
- +#define DMA_RWCTRL_WRITE_BNDRY_16 0x00000800
- +#define DMA_RWCTRL_WRITE_BNDRY_32 0x00001000
- +#define DMA_RWCTRL_WRITE_BNDRY_64 0x00001800
- +#define DMA_RWCTRL_WRITE_BNDRY_128 0x00002000
- +#define DMA_RWCTRL_WRITE_BNDRY_256 0x00002800
- +#define DMA_RWCTRL_WRITE_BNDRY_512 0x00003000
- +#define DMA_RWCTRL_WRITE_BNDRY_1024 0x00003800
- +#define DMA_RWCTRL_ONE_DMA 0x00004000
- +#define DMA_RWCTRL_READ_WATER 0x00070000
- +#define DMA_RWCTRL_READ_WATER_SHIFT 16
- +#define DMA_RWCTRL_WRITE_WATER 0x00380000
- +#define DMA_RWCTRL_WRITE_WATER_SHIFT 19
- +#define DMA_RWCTRL_USE_MEM_READ_MULT 0x00400000
- +#define DMA_RWCTRL_ASSERT_ALL_BE 0x00800000
- +#define DMA_RWCTRL_PCI_READ_CMD 0x0f000000
- +#define DMA_RWCTRL_PCI_READ_CMD_SHIFT 24
- +#define DMA_RWCTRL_PCI_WRITE_CMD 0xf0000000
- +#define DMA_RWCTRL_PCI_WRITE_CMD_SHIFT 28
- +#define TG3PCI_PCISTATE 0x00000070
- +#define PCISTATE_FORCE_RESET 0x00000001
- +#define PCISTATE_INT_NOT_ACTIVE 0x00000002
- +#define PCISTATE_CONV_PCI_MODE 0x00000004
- +#define PCISTATE_BUS_SPEED_HIGH 0x00000008
- +#define PCISTATE_BUS_32BIT 0x00000010
- +#define PCISTATE_ROM_ENABLE 0x00000020
- +#define PCISTATE_ROM_RETRY_ENABLE 0x00000040
- +#define PCISTATE_FLAT_VIEW 0x00000100
- +#define PCISTATE_RETRY_SAME_DMA 0x00002000
- +#define TG3PCI_CLOCK_CTRL 0x00000074
- +#define CLOCK_CTRL_CORECLK_DISABLE 0x00000200
- +#define CLOCK_CTRL_RXCLK_DISABLE 0x00000400
- +#define CLOCK_CTRL_TXCLK_DISABLE 0x00000800
- +#define CLOCK_CTRL_ALTCLK 0x00001000
- +#define CLOCK_CTRL_PWRDOWN_PLL133 0x00008000
- +#define CLOCK_CTRL_44MHZ_CORE 0x00040000
- +#define CLOCK_CTRL_625_CORE 0x00100000
- +#define CLOCK_CTRL_FORCE_CLKRUN 0x00200000
- +#define CLOCK_CTRL_CLKRUN_OENABLE 0x00400000
- +#define CLOCK_CTRL_DELAY_PCI_GRANT 0x80000000
- +#define TG3PCI_REG_BASE_ADDR 0x00000078
- +#define TG3PCI_MEM_WIN_BASE_ADDR 0x0000007c
- +#define TG3PCI_REG_DATA 0x00000080
- +#define TG3PCI_MEM_WIN_DATA 0x00000084
- +#define TG3PCI_MODE_CTRL 0x00000088
- +#define TG3PCI_MISC_CFG 0x0000008c
- +#define TG3PCI_MISC_LOCAL_CTRL 0x00000090
- +/* 0x94 --> 0x98 unused */
- +#define TG3PCI_STD_RING_PROD_IDX 0x00000098 /* 64-bit */
- +#define TG3PCI_RCV_RET_RING_CON_IDX 0x000000a0 /* 64-bit */
- +#define TG3PCI_SND_PROD_IDX 0x000000a8 /* 64-bit */
- +/* 0xb0 --> 0x100 unused */
- +
- +/* 0x100 --> 0x200 unused */
- +
- +/* Mailbox registers */
- +#define MAILBOX_INTERRUPT_0 0x00000200 /* 64-bit */
- +#define MAILBOX_INTERRUPT_1 0x00000208 /* 64-bit */
- +#define MAILBOX_INTERRUPT_2 0x00000210 /* 64-bit */
- +#define MAILBOX_INTERRUPT_3 0x00000218 /* 64-bit */
- +#define MAILBOX_GENERAL_0 0x00000220 /* 64-bit */
- +#define MAILBOX_GENERAL_1 0x00000228 /* 64-bit */
- +#define MAILBOX_GENERAL_2 0x00000230 /* 64-bit */
- +#define MAILBOX_GENERAL_3 0x00000238 /* 64-bit */
- +#define MAILBOX_GENERAL_4 0x00000240 /* 64-bit */
- +#define MAILBOX_GENERAL_5 0x00000248 /* 64-bit */
- +#define MAILBOX_GENERAL_6 0x00000250 /* 64-bit */
- +#define MAILBOX_GENERAL_7 0x00000258 /* 64-bit */
- +#define MAILBOX_RELOAD_STAT 0x00000260 /* 64-bit */
- +#define MAILBOX_RCV_STD_PROD_IDX 0x00000268 /* 64-bit */
- +#define MAILBOX_RCV_JUMBO_PROD_IDX 0x00000270 /* 64-bit */
- +#define MAILBOX_RCV_MINI_PROD_IDX 0x00000278 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_0 0x00000280 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_1 0x00000288 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_2 0x00000290 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_3 0x00000298 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_4 0x000002a0 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_5 0x000002a8 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_6 0x000002b0 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_7 0x000002b8 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_8 0x000002c0 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_9 0x000002c8 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_10 0x000002d0 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_11 0x000002d8 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_12 0x000002e0 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_13 0x000002e8 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_14 0x000002f0 /* 64-bit */
- +#define MAILBOX_RCVRET_CON_IDX_15 0x000002f8 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_0 0x00000300 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_1 0x00000308 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_2 0x00000310 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_3 0x00000318 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_4 0x00000320 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_5 0x00000328 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_6 0x00000330 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_7 0x00000338 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_8 0x00000340 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_9 0x00000348 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_10 0x00000350 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_11 0x00000358 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_12 0x00000360 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_13 0x00000368 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_14 0x00000370 /* 64-bit */
- +#define MAILBOX_SNDHOST_PROD_IDX_15 0x00000378 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_0 0x00000380 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_1 0x00000388 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_2 0x00000390 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_3 0x00000398 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_4 0x000003a0 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_5 0x000003a8 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_6 0x000003b0 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_7 0x000003b8 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_8 0x000003c0 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_9 0x000003c8 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_10 0x000003d0 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_11 0x000003d8 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_12 0x000003e0 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_13 0x000003e8 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_14 0x000003f0 /* 64-bit */
- +#define MAILBOX_SNDNIC_PROD_IDX_15 0x000003f8 /* 64-bit */
- +
- +/* MAC control registers */
- +#define MAC_MODE 0x00000400
- +#define MAC_MODE_RESET 0x00000001
- +#define MAC_MODE_HALF_DUPLEX 0x00000002
- +#define MAC_MODE_PORT_MODE_MASK 0x0000000c
- +#define MAC_MODE_PORT_MODE_TBI 0x0000000c
- +#define MAC_MODE_PORT_MODE_GMII 0x00000008
- +#define MAC_MODE_PORT_MODE_MII 0x00000004
- +#define MAC_MODE_PORT_MODE_NONE 0x00000000
- +#define MAC_MODE_PORT_INT_LPBACK 0x00000010
- +#define MAC_MODE_TAGGED_MAC_CTRL 0x00000080
- +#define MAC_MODE_TX_BURSTING 0x00000100
- +#define MAC_MODE_MAX_DEFER 0x00000200
- +#define MAC_MODE_LINK_POLARITY 0x00000400
- +#define MAC_MODE_RXSTAT_ENABLE 0x00000800
- +#define MAC_MODE_RXSTAT_CLEAR 0x00001000
- +#define MAC_MODE_RXSTAT_FLUSH 0x00002000
- +#define MAC_MODE_TXSTAT_ENABLE 0x00004000
- +#define MAC_MODE_TXSTAT_CLEAR 0x00008000
- +#define MAC_MODE_TXSTAT_FLUSH 0x00010000
- +#define MAC_MODE_SEND_CONFIGS 0x00020000
- +#define MAC_MODE_MAGIC_PKT_ENABLE 0x00040000
- +#define MAC_MODE_ACPI_ENABLE 0x00080000
- +#define MAC_MODE_MIP_ENABLE 0x00100000
- +#define MAC_MODE_TDE_ENABLE 0x00200000
- +#define MAC_MODE_RDE_ENABLE 0x00400000
- +#define MAC_MODE_FHDE_ENABLE 0x00800000
- +#define MAC_STATUS 0x00000404
- +#define MAC_STATUS_PCS_SYNCED 0x00000001
- +#define MAC_STATUS_SIGNAL_DET 0x00000002
- +#define MAC_STATUS_RCVD_CFG 0x00000004
- +#define MAC_STATUS_CFG_CHANGED 0x00000008
- +#define MAC_STATUS_SYNC_CHANGED 0x00000010
- +#define MAC_STATUS_PORT_DEC_ERR 0x00000400
- +#define MAC_STATUS_LNKSTATE_CHANGED 0x00001000
- +#define MAC_STATUS_MI_COMPLETION 0x00400000
- +#define MAC_STATUS_MI_INTERRUPT 0x00800000
- +#define MAC_STATUS_AP_ERROR 0x01000000
- +#define MAC_STATUS_ODI_ERROR 0x02000000
- +#define MAC_STATUS_RXSTAT_OVERRUN 0x04000000
- +#define MAC_STATUS_TXSTAT_OVERRUN 0x08000000
- +#define MAC_EVENT 0x00000408
- +#define MAC_EVENT_PORT_DECODE_ERR 0x00000400
- +#define MAC_EVENT_LNKSTATE_CHANGED 0x00001000
- +#define MAC_EVENT_MI_COMPLETION 0x00400000
- +#define MAC_EVENT_MI_INTERRUPT 0x00800000
- +#define MAC_EVENT_AP_ERROR 0x01000000
- +#define MAC_EVENT_ODI_ERROR 0x02000000
- +#define MAC_EVENT_RXSTAT_OVERRUN 0x04000000
- +#define MAC_EVENT_TXSTAT_OVERRUN 0x08000000
- +#define MAC_LED_CTRL 0x0000040c
- +#define LED_CTRL_LNKLED_OVERRIDE 0x00000001
- +#define LED_CTRL_1000MBPS_ON 0x00000002
- +#define LED_CTRL_100MBPS_ON 0x00000004
- +#define LED_CTRL_10MBPS_ON 0x00000008
- +#define LED_CTRL_TRAFFIC_OVERRIDE 0x00000010
- +#define LED_CTRL_TRAFFIC_BLINK 0x00000020
- +#define LED_CTRL_TRAFFIC_LED 0x00000040
- +#define LED_CTRL_1000MBPS_STATUS 0x00000080
- +#define LED_CTRL_100MBPS_STATUS 0x00000100
- +#define LED_CTRL_10MBPS_STATUS 0x00000200
- +#define LED_CTRL_TRAFFIC_STATUS 0x00000400
- +#define LED_CTRL_MAC_MODE 0x00000000
- +#define LED_CTRL_PHY_MODE_1 0x00000800
- +#define LED_CTRL_PHY_MODE_2 0x00001000
- +#define LED_CTRL_BLINK_RATE_MASK 0x7ff80000
- +#define LED_CTRL_BLINK_RATE_SHIFT 19
- +#define LED_CTRL_BLINK_PER_OVERRIDE 0x00080000
- +#define LED_CTRL_BLINK_RATE_OVERRIDE 0x80000000
- +#define MAC_ADDR_0_HIGH 0x00000410 /* upper 2 bytes */
- +#define MAC_ADDR_0_LOW 0x00000414 /* lower 4 bytes */
- +#define MAC_ADDR_1_HIGH 0x00000418 /* upper 2 bytes */
- +#define MAC_ADDR_1_LOW 0x0000041c /* lower 4 bytes */
- +#define MAC_ADDR_2_HIGH 0x00000420 /* upper 2 bytes */
- +#define MAC_ADDR_2_LOW 0x00000424 /* lower 4 bytes */
- +#define MAC_ADDR_3_HIGH 0x00000428 /* upper 2 bytes */
- +#define MAC_ADDR_3_LOW 0x0000042c /* lower 4 bytes */
- +#define MAC_ACPI_MBUF_PTR 0x00000430
- +#define MAC_ACPI_LEN_OFFSET 0x00000434
- +#define ACPI_LENOFF_LEN_MASK 0x0000ffff
- +#define ACPI_LENOFF_LEN_SHIFT 0
- +#define ACPI_LENOFF_OFF_MASK 0x0fff0000
- +#define ACPI_LENOFF_OFF_SHIFT 16
- +#define MAC_TX_BACKOFF_SEED 0x00000438
- +#define TX_BACKOFF_SEED_MASK 0x000003ff
- +#define MAC_RX_MTU_SIZE 0x0000043c
- +#define RX_MTU_SIZE_MASK 0x0000ffff
- +#define MAC_PCS_TEST 0x00000440
- +#define PCS_TEST_PATTERN_MASK 0x000fffff
- +#define PCS_TEST_PATTERN_SHIFT 0
- +#define PCS_TEST_ENABLE 0x00100000
- +#define MAC_TX_AUTO_NEG 0x00000444
- +#define TX_AUTO_NEG_MASK 0x0000ffff
- +#define TX_AUTO_NEG_SHIFT 0
- +#define MAC_RX_AUTO_NEG 0x00000448
- +#define RX_AUTO_NEG_MASK 0x0000ffff
- +#define RX_AUTO_NEG_SHIFT 0
- +#define MAC_MI_COM 0x0000044c
- +#define MI_COM_CMD_MASK 0x0c000000
- +#define MI_COM_CMD_WRITE 0x04000000
- +#define MI_COM_CMD_READ 0x08000000
- +#define MI_COM_READ_FAILED 0x10000000
- +#define MI_COM_START 0x20000000
- +#define MI_COM_BUSY 0x20000000
- +#define MI_COM_PHY_ADDR_MASK 0x03e00000
- +#define MI_COM_PHY_ADDR_SHIFT 21
- +#define MI_COM_REG_ADDR_MASK 0x001f0000
- +#define MI_COM_REG_ADDR_SHIFT 16
- +#define MI_COM_DATA_MASK 0x0000ffff
- +#define MAC_MI_STAT 0x00000450
- +#define MAC_MI_STAT_LNKSTAT_ATTN_ENAB 0x00000001
- +#define MAC_MI_MODE 0x00000454
- +#define MAC_MI_MODE_CLK_10MHZ 0x00000001
- +#define MAC_MI_MODE_SHORT_PREAMBLE 0x00000002
- +#define MAC_MI_MODE_AUTO_POLL 0x00000010
- +#define MAC_MI_MODE_CORE_CLK_62MHZ 0x00008000
- +#define MAC_MI_MODE_BASE 0x000c0000 /* XXX magic values XXX */
- +#define MAC_AUTO_POLL_STATUS 0x00000458
- +#define MAC_AUTO_POLL_ERROR 0x00000001
- +#define MAC_TX_MODE 0x0000045c
- +#define TX_MODE_RESET 0x00000001
- +#define TX_MODE_ENABLE 0x00000002
- +#define TX_MODE_FLOW_CTRL_ENABLE 0x00000010
- +#define TX_MODE_BIG_BCKOFF_ENABLE 0x00000020
- +#define TX_MODE_LONG_PAUSE_ENABLE 0x00000040
- +#define MAC_TX_STATUS 0x00000460
- +#define TX_STATUS_XOFFED 0x00000001
- +#define TX_STATUS_SENT_XOFF 0x00000002
- +#define TX_STATUS_SENT_XON 0x00000004
- +#define TX_STATUS_LINK_UP 0x00000008
- +#define TX_STATUS_ODI_UNDERRUN 0x00000010
- +#define TX_STATUS_ODI_OVERRUN 0x00000020
- +#define MAC_TX_LENGTHS 0x00000464
- +#define TX_LENGTHS_SLOT_TIME_MASK 0x000000ff
- +#define TX_LENGTHS_SLOT_TIME_SHIFT 0
- +#define TX_LENGTHS_IPG_MASK 0x00000f00
- +#define TX_LENGTHS_IPG_SHIFT 8
- +#define TX_LENGTHS_IPG_CRS_MASK 0x00003000
- +#define TX_LENGTHS_IPG_CRS_SHIFT 12
- +#define MAC_RX_MODE 0x00000468
- +#define RX_MODE_RESET 0x00000001
- +#define RX_MODE_ENABLE 0x00000002
- +#define RX_MODE_FLOW_CTRL_ENABLE 0x00000004
- +#define RX_MODE_KEEP_MAC_CTRL 0x00000008
- +#define RX_MODE_KEEP_PAUSE 0x00000010
- +#define RX_MODE_ACCEPT_OVERSIZED 0x00000020
- +#define RX_MODE_ACCEPT_RUNTS 0x00000040
- +#define RX_MODE_LEN_CHECK 0x00000080
- +#define RX_MODE_PROMISC 0x00000100
- +#define RX_MODE_NO_CRC_CHECK 0x00000200
- +#define RX_MODE_KEEP_VLAN_TAG 0x00000400
- +#define MAC_RX_STATUS 0x0000046c
- +#define RX_STATUS_REMOTE_TX_XOFFED 0x00000001
- +#define RX_STATUS_XOFF_RCVD 0x00000002
- +#define RX_STATUS_XON_RCVD 0x00000004
- +#define MAC_HASH_REG_0 0x00000470
- +#define MAC_HASH_REG_1 0x00000474
- +#define MAC_HASH_REG_2 0x00000478
- +#define MAC_HASH_REG_3 0x0000047c
- +#define MAC_RCV_RULE_0 0x00000480
- +#define MAC_RCV_VALUE_0 0x00000484
- +#define MAC_RCV_RULE_1 0x00000488
- +#define MAC_RCV_VALUE_1 0x0000048c
- +#define MAC_RCV_RULE_2 0x00000490
- +#define MAC_RCV_VALUE_2 0x00000494
- +#define MAC_RCV_RULE_3 0x00000498
- +#define MAC_RCV_VALUE_3 0x0000049c
- +#define MAC_RCV_RULE_4 0x000004a0
- +#define MAC_RCV_VALUE_4 0x000004a4
- +#define MAC_RCV_RULE_5 0x000004a8
- +#define MAC_RCV_VALUE_5 0x000004ac
- +#define MAC_RCV_RULE_6 0x000004b0
- +#define MAC_RCV_VALUE_6 0x000004b4
- +#define MAC_RCV_RULE_7 0x000004b8
- +#define MAC_RCV_VALUE_7 0x000004bc
- +#define MAC_RCV_RULE_8 0x000004c0
- +#define MAC_RCV_VALUE_8 0x000004c4
- +#define MAC_RCV_RULE_9 0x000004c8
- +#define MAC_RCV_VALUE_9 0x000004cc
- +#define MAC_RCV_RULE_10 0x000004d0
- +#define MAC_RCV_VALUE_10 0x000004d4
- +#define MAC_RCV_RULE_11 0x000004d8
- +#define MAC_RCV_VALUE_11 0x000004dc
- +#define MAC_RCV_RULE_12 0x000004e0
- +#define MAC_RCV_VALUE_12 0x000004e4
- +#define MAC_RCV_RULE_13 0x000004e8
- +#define MAC_RCV_VALUE_13 0x000004ec
- +#define MAC_RCV_RULE_14 0x000004f0
- +#define MAC_RCV_VALUE_14 0x000004f4
- +#define MAC_RCV_RULE_15 0x000004f8
- +#define MAC_RCV_VALUE_15 0x000004fc
- +#define RCV_RULE_DISABLE_MASK 0x7fffffff
- +#define MAC_RCV_RULE_CFG 0x00000500
- +#define RCV_RULE_CFG_DEFAULT_CLASS 0x00000008
- +#define MAC_LOW_WMARK_MAX_RX_FRAME 0x00000504
- +/* 0x508 --> 0x520 unused */
- +#define MAC_HASHREGU_0 0x00000520
- +#define MAC_HASHREGU_1 0x00000524
- +#define MAC_HASHREGU_2 0x00000528
- +#define MAC_HASHREGU_3 0x0000052c
- +#define MAC_EXTADDR_0_HIGH 0x00000530
- +#define MAC_EXTADDR_0_LOW 0x00000534
- +#define MAC_EXTADDR_1_HIGH 0x00000538
- +#define MAC_EXTADDR_1_LOW 0x0000053c
- +#define MAC_EXTADDR_2_HIGH 0x00000540
- +#define MAC_EXTADDR_2_LOW 0x00000544
- +#define MAC_EXTADDR_3_HIGH 0x00000548
- +#define MAC_EXTADDR_3_LOW 0x0000054c
- +#define MAC_EXTADDR_4_HIGH 0x00000550
- +#define MAC_EXTADDR_4_LOW 0x00000554
- +#define MAC_EXTADDR_5_HIGH 0x00000558
- +#define MAC_EXTADDR_5_LOW 0x0000055c
- +#define MAC_EXTADDR_6_HIGH 0x00000560
- +#define MAC_EXTADDR_6_LOW 0x00000564
- +#define MAC_EXTADDR_7_HIGH 0x00000568
- +#define MAC_EXTADDR_7_LOW 0x0000056c
- +#define MAC_EXTADDR_8_HIGH 0x00000570
- +#define MAC_EXTADDR_8_LOW 0x00000574
- +#define MAC_EXTADDR_9_HIGH 0x00000578
- +#define MAC_EXTADDR_9_LOW 0x0000057c
- +#define MAC_EXTADDR_10_HIGH 0x00000580
- +#define MAC_EXTADDR_10_LOW 0x00000584
- +#define MAC_EXTADDR_11_HIGH 0x00000588
- +#define MAC_EXTADDR_11_LOW 0x0000058c
- +#define MAC_SERDES_CFG 0x00000590
- +#define MAC_SERDES_STAT 0x00000594
- +/* 0x598 --> 0x600 unused */
- +#define MAC_TX_MAC_STATE_BASE 0x00000600 /* 16 bytes */
- +#define MAC_RX_MAC_STATE_BASE 0x00000610 /* 20 bytes */
- +/* 0x624 --> 0x800 unused */
- +#define MAC_TX_STATS_OCTETS 0x00000800
- +#define MAC_TX_STATS_RESV1 0x00000804
- +#define MAC_TX_STATS_COLLISIONS 0x00000808
- +#define MAC_TX_STATS_XON_SENT 0x0000080c
- +#define MAC_TX_STATS_XOFF_SENT 0x00000810
- +#define MAC_TX_STATS_RESV2 0x00000814
- +#define MAC_TX_STATS_MAC_ERRORS 0x00000818
- +#define MAC_TX_STATS_SINGLE_COLLISIONS 0x0000081c
- +#define MAC_TX_STATS_MULT_COLLISIONS 0x00000820
- +#define MAC_TX_STATS_DEFERRED 0x00000824
- +#define MAC_TX_STATS_RESV3 0x00000828
- +#define MAC_TX_STATS_EXCESSIVE_COL 0x0000082c
- +#define MAC_TX_STATS_LATE_COL 0x00000830
- +#define MAC_TX_STATS_RESV4_1 0x00000834
- +#define MAC_TX_STATS_RESV4_2 0x00000838
- +#define MAC_TX_STATS_RESV4_3 0x0000083c
- +#define MAC_TX_STATS_RESV4_4 0x00000840
- +#define MAC_TX_STATS_RESV4_5 0x00000844
- +#define MAC_TX_STATS_RESV4_6 0x00000848
- +#define MAC_TX_STATS_RESV4_7 0x0000084c
- +#define MAC_TX_STATS_RESV4_8 0x00000850
- +#define MAC_TX_STATS_RESV4_9 0x00000854
- +#define MAC_TX_STATS_RESV4_10 0x00000858
- +#define MAC_TX_STATS_RESV4_11 0x0000085c
- +#define MAC_TX_STATS_RESV4_12 0x00000860
- +#define MAC_TX_STATS_RESV4_13 0x00000864
- +#define MAC_TX_STATS_RESV4_14 0x00000868
- +#define MAC_TX_STATS_UCAST 0x0000086c
- +#define MAC_TX_STATS_MCAST 0x00000870
- +#define MAC_TX_STATS_BCAST 0x00000874
- +#define MAC_TX_STATS_RESV5_1 0x00000878
- +#define MAC_TX_STATS_RESV5_2 0x0000087c
- +#define MAC_RX_STATS_OCTETS 0x00000880
- +#define MAC_RX_STATS_RESV1 0x00000884
- +#define MAC_RX_STATS_FRAGMENTS 0x00000888
- +#define MAC_RX_STATS_UCAST 0x0000088c
- +#define MAC_RX_STATS_MCAST 0x00000890
- +#define MAC_RX_STATS_BCAST 0x00000894
- +#define MAC_RX_STATS_FCS_ERRORS 0x00000898
- +#define MAC_RX_STATS_ALIGN_ERRORS 0x0000089c
- +#define MAC_RX_STATS_XON_PAUSE_RECVD 0x000008a0
- +#define MAC_RX_STATS_XOFF_PAUSE_RECVD 0x000008a4
- +#define MAC_RX_STATS_MAC_CTRL_RECVD 0x000008a8
- +#define MAC_RX_STATS_XOFF_ENTERED 0x000008ac
- +#define MAC_RX_STATS_FRAME_TOO_LONG 0x000008b0
- +#define MAC_RX_STATS_JABBERS 0x000008b4
- +#define MAC_RX_STATS_UNDERSIZE 0x000008b8
- +/* 0x8bc --> 0xc00 unused */
- +
- +/* Send data initiator control registers */
- +#define SNDDATAI_MODE 0x00000c00
- +#define SNDDATAI_MODE_RESET 0x00000001
- +#define SNDDATAI_MODE_ENABLE 0x00000002
- +#define SNDDATAI_MODE_STAT_OFLOW_ENAB 0x00000004
- +#define SNDDATAI_STATUS 0x00000c04
- +#define SNDDATAI_STATUS_STAT_OFLOW 0x00000004
- +#define SNDDATAI_STATSCTRL 0x00000c08
- +#define SNDDATAI_SCTRL_ENABLE 0x00000001
- +#define SNDDATAI_SCTRL_FASTUPD 0x00000002
- +#define SNDDATAI_SCTRL_CLEAR 0x00000004
- +#define SNDDATAI_SCTRL_FLUSH 0x00000008
- +#define SNDDATAI_SCTRL_FORCE_ZERO 0x00000010
- +#define SNDDATAI_STATSENAB 0x00000c0c
- +#define SNDDATAI_STATSINCMASK 0x00000c10
- +/* 0xc14 --> 0xc80 unused */
- +#define SNDDATAI_COS_CNT_0 0x00000c80
- +#define SNDDATAI_COS_CNT_1 0x00000c84
- +#define SNDDATAI_COS_CNT_2 0x00000c88
- +#define SNDDATAI_COS_CNT_3 0x00000c8c
- +#define SNDDATAI_COS_CNT_4 0x00000c90
- +#define SNDDATAI_COS_CNT_5 0x00000c94
- +#define SNDDATAI_COS_CNT_6 0x00000c98
- +#define SNDDATAI_COS_CNT_7 0x00000c9c
- +#define SNDDATAI_COS_CNT_8 0x00000ca0
- +#define SNDDATAI_COS_CNT_9 0x00000ca4
- +#define SNDDATAI_COS_CNT_10 0x00000ca8
- +#define SNDDATAI_COS_CNT_11 0x00000cac
- +#define SNDDATAI_COS_CNT_12 0x00000cb0
- +#define SNDDATAI_COS_CNT_13 0x00000cb4
- +#define SNDDATAI_COS_CNT_14 0x00000cb8
- +#define SNDDATAI_COS_CNT_15 0x00000cbc
- +#define SNDDATAI_DMA_RDQ_FULL_CNT 0x00000cc0
- +#define SNDDATAI_DMA_PRIO_RDQ_FULL_CNT 0x00000cc4
- +#define SNDDATAI_SDCQ_FULL_CNT 0x00000cc8
- +#define SNDDATAI_NICRNG_SSND_PIDX_CNT 0x00000ccc
- +#define SNDDATAI_STATS_UPDATED_CNT 0x00000cd0
- +#define SNDDATAI_INTERRUPTS_CNT 0x00000cd4
- +#define SNDDATAI_AVOID_INTERRUPTS_CNT 0x00000cd8
- +#define SNDDATAI_SND_THRESH_HIT_CNT 0x00000cdc
- +/* 0xce0 --> 0x1000 unused */
- +
- +/* Send data completion control registers */
- +#define SNDDATAC_MODE 0x00001000
- +#define SNDDATAC_MODE_RESET 0x00000001
- +#define SNDDATAC_MODE_ENABLE 0x00000002
- +/* 0x1004 --> 0x1400 unused */
- +
- +/* Send BD ring selector */
- +#define SNDBDS_MODE 0x00001400
- +#define SNDBDS_MODE_RESET 0x00000001
- +#define SNDBDS_MODE_ENABLE 0x00000002
- +#define SNDBDS_MODE_ATTN_ENABLE 0x00000004
- +#define SNDBDS_STATUS 0x00001404
- +#define SNDBDS_STATUS_ERROR_ATTN 0x00000004
- +#define SNDBDS_HWDIAG 0x00001408
- +/* 0x140c --> 0x1440 */
- +#define SNDBDS_SEL_CON_IDX_0 0x00001440
- +#define SNDBDS_SEL_CON_IDX_1 0x00001444
- +#define SNDBDS_SEL_CON_IDX_2 0x00001448
- +#define SNDBDS_SEL_CON_IDX_3 0x0000144c
- +#define SNDBDS_SEL_CON_IDX_4 0x00001450
- +#define SNDBDS_SEL_CON_IDX_5 0x00001454
- +#define SNDBDS_SEL_CON_IDX_6 0x00001458
- +#define SNDBDS_SEL_CON_IDX_7 0x0000145c
- +#define SNDBDS_SEL_CON_IDX_8 0x00001460
- +#define SNDBDS_SEL_CON_IDX_9 0x00001464
- +#define SNDBDS_SEL_CON_IDX_10 0x00001468
- +#define SNDBDS_SEL_CON_IDX_11 0x0000146c
- +#define SNDBDS_SEL_CON_IDX_12 0x00001470
- +#define SNDBDS_SEL_CON_IDX_13 0x00001474
- +#define SNDBDS_SEL_CON_IDX_14 0x00001478
- +#define SNDBDS_SEL_CON_IDX_15 0x0000147c
- +/* 0x1480 --> 0x1800 unused */
- +
- +/* Send BD initiator control registers */
- +#define SNDBDI_MODE 0x00001800
- +#define SNDBDI_MODE_RESET 0x00000001
- +#define SNDBDI_MODE_ENABLE 0x00000002
- +#define SNDBDI_MODE_ATTN_ENABLE 0x00000004
- +#define SNDBDI_STATUS 0x00001804
- +#define SNDBDI_STATUS_ERROR_ATTN 0x00000004
- +#define SNDBDI_IN_PROD_IDX_0 0x00001808
- +#define SNDBDI_IN_PROD_IDX_1 0x0000180c
- +#define SNDBDI_IN_PROD_IDX_2 0x00001810
- +#define SNDBDI_IN_PROD_IDX_3 0x00001814
- +#define SNDBDI_IN_PROD_IDX_4 0x00001818
- +#define SNDBDI_IN_PROD_IDX_5 0x0000181c
- +#define SNDBDI_IN_PROD_IDX_6 0x00001820
- +#define SNDBDI_IN_PROD_IDX_7 0x00001824
- +#define SNDBDI_IN_PROD_IDX_8 0x00001828
- +#define SNDBDI_IN_PROD_IDX_9 0x0000182c
- +#define SNDBDI_IN_PROD_IDX_10 0x00001830
- +#define SNDBDI_IN_PROD_IDX_11 0x00001834
- +#define SNDBDI_IN_PROD_IDX_12 0x00001838
- +#define SNDBDI_IN_PROD_IDX_13 0x0000183c
- +#define SNDBDI_IN_PROD_IDX_14 0x00001840
- +#define SNDBDI_IN_PROD_IDX_15 0x00001844
- +/* 0x1848 --> 0x1c00 unused */
- +
- +/* Send BD completion control registers */
- +#define SNDBDC_MODE 0x00001c00
- +#define SNDBDC_MODE_RESET 0x00000001
- +#define SNDBDC_MODE_ENABLE 0x00000002
- +#define SNDBDC_MODE_ATTN_ENABLE 0x00000004
- +/* 0x1c04 --> 0x2000 unused */
- +
- +/* Receive list placement control registers */
- +#define RCVLPC_MODE 0x00002000
- +#define RCVLPC_MODE_RESET 0x00000001
- +#define RCVLPC_MODE_ENABLE 0x00000002
- +#define RCVLPC_MODE_CLASS0_ATTN_ENAB 0x00000004
- +#define RCVLPC_MODE_MAPOOR_AATTN_ENAB 0x00000008
- +#define RCVLPC_MODE_STAT_OFLOW_ENAB 0x00000010
- +#define RCVLPC_STATUS 0x00002004
- +#define RCVLPC_STATUS_CLASS0 0x00000004
- +#define RCVLPC_STATUS_MAPOOR 0x00000008
- +#define RCVLPC_STATUS_STAT_OFLOW 0x00000010
- +#define RCVLPC_LOCK 0x00002008
- +#define RCVLPC_LOCK_REQ_MASK 0x0000ffff
- +#define RCVLPC_LOCK_REQ_SHIFT 0
- +#define RCVLPC_LOCK_GRANT_MASK 0xffff0000
- +#define RCVLPC_LOCK_GRANT_SHIFT 16
- +#define RCVLPC_NON_EMPTY_BITS 0x0000200c
- +#define RCVLPC_NON_EMPTY_BITS_MASK 0x0000ffff
- +#define RCVLPC_CONFIG 0x00002010
- +#define RCVLPC_STATSCTRL 0x00002014
- +#define RCVLPC_STATSCTRL_ENABLE 0x00000001
- +#define RCVLPC_STATSCTRL_FASTUPD 0x00000002
- +#define RCVLPC_STATS_ENABLE 0x00002018
- +#define RCVLPC_STATSENAB_LNGBRST_RFIX 0x00400000
- +#define RCVLPC_STATS_INCMASK 0x0000201c
- +/* 0x2020 --> 0x2100 unused */
- +#define RCVLPC_SELLST_BASE 0x00002100 /* 16 16-byte entries */
- +#define SELLST_TAIL 0x00000004
- +#define SELLST_CONT 0x00000008
- +#define SELLST_UNUSED 0x0000000c
- +#define RCVLPC_COS_CNTL_BASE 0x00002200 /* 16 4-byte entries */
- +#define RCVLPC_DROP_FILTER_CNT 0x00002240
- +#define RCVLPC_DMA_WQ_FULL_CNT 0x00002244
- +#define RCVLPC_DMA_HIPRIO_WQ_FULL_CNT 0x00002248
- +#define RCVLPC_NO_RCV_BD_CNT 0x0000224c
- +#define RCVLPC_IN_DISCARDS_CNT 0x00002250
- +#define RCVLPC_IN_ERRORS_CNT 0x00002254
- +#define RCVLPC_RCV_THRESH_HIT_CNT 0x00002258
- +/* 0x225c --> 0x2400 unused */
- +
- +/* Receive Data and Receive BD Initiator Control */
- +#define RCVDBDI_MODE 0x00002400
- +#define RCVDBDI_MODE_RESET 0x00000001
- +#define RCVDBDI_MODE_ENABLE 0x00000002
- +#define RCVDBDI_MODE_JUMBOBD_NEEDED 0x00000004
- +#define RCVDBDI_MODE_FRM_TOO_BIG 0x00000008
- +#define RCVDBDI_MODE_INV_RING_SZ 0x00000010
- +#define RCVDBDI_STATUS 0x00002404
- +#define RCVDBDI_STATUS_JUMBOBD_NEEDED 0x00000004
- +#define RCVDBDI_STATUS_FRM_TOO_BIG 0x00000008
- +#define RCVDBDI_STATUS_INV_RING_SZ 0x00000010
- +#define RCVDBDI_SPLIT_FRAME_MINSZ 0x00002408
- +/* 0x240c --> 0x2440 unused */
- +#define RCVDBDI_JUMBO_BD 0x00002440 /* TG3_BDINFO_... */
- +#define RCVDBDI_STD_BD 0x00002450 /* TG3_BDINFO_... */
- +#define RCVDBDI_MINI_BD 0x00002460 /* TG3_BDINFO_... */
- +#define RCVDBDI_JUMBO_CON_IDX 0x00002470
- +#define RCVDBDI_STD_CON_IDX 0x00002474
- +#define RCVDBDI_MINI_CON_IDX 0x00002478
- +/* 0x247c --> 0x2480 unused */
- +#define RCVDBDI_BD_PROD_IDX_0 0x00002480
- +#define RCVDBDI_BD_PROD_IDX_1 0x00002484
- +#define RCVDBDI_BD_PROD_IDX_2 0x00002488
- +#define RCVDBDI_BD_PROD_IDX_3 0x0000248c
- +#define RCVDBDI_BD_PROD_IDX_4 0x00002490
- +#define RCVDBDI_BD_PROD_IDX_5 0x00002494
- +#define RCVDBDI_BD_PROD_IDX_6 0x00002498
- +#define RCVDBDI_BD_PROD_IDX_7 0x0000249c
- +#define RCVDBDI_BD_PROD_IDX_8 0x000024a0
- +#define RCVDBDI_BD_PROD_IDX_9 0x000024a4
- +#define RCVDBDI_BD_PROD_IDX_10 0x000024a8
- +#define RCVDBDI_BD_PROD_IDX_11 0x000024ac
- +#define RCVDBDI_BD_PROD_IDX_12 0x000024b0
- +#define RCVDBDI_BD_PROD_IDX_13 0x000024b4
- +#define RCVDBDI_BD_PROD_IDX_14 0x000024b8
- +#define RCVDBDI_BD_PROD_IDX_15 0x000024bc
- +#define RCVDBDI_HWDIAG 0x000024c0
- +/* 0x24c4 --> 0x2800 unused */
- +
- +/* Receive Data Completion Control */
- +#define RCVDCC_MODE 0x00002800
- +#define RCVDCC_MODE_RESET 0x00000001
- +#define RCVDCC_MODE_ENABLE 0x00000002
- +#define RCVDCC_MODE_ATTN_ENABLE 0x00000004
- +/* 0x2804 --> 0x2c00 unused */
- +
- +/* Receive BD Initiator Control Registers */
- +#define RCVBDI_MODE 0x00002c00
- +#define RCVBDI_MODE_RESET 0x00000001
- +#define RCVBDI_MODE_ENABLE 0x00000002
- +#define RCVBDI_MODE_RCB_ATTN_ENAB 0x00000004
- +#define RCVBDI_STATUS 0x00002c04
- +#define RCVBDI_STATUS_RCB_ATTN 0x00000004
- +#define RCVBDI_JUMBO_PROD_IDX 0x00002c08
- +#define RCVBDI_STD_PROD_IDX 0x00002c0c
- +#define RCVBDI_MINI_PROD_IDX 0x00002c10
- +#define RCVBDI_MINI_THRESH 0x00002c14
- +#define RCVBDI_STD_THRESH 0x00002c18
- +#define RCVBDI_JUMBO_THRESH 0x00002c1c
- +/* 0x2c20 --> 0x3000 unused */
- +
- +/* Receive BD Completion Control Registers */
- +#define RCVCC_MODE 0x00003000
- +#define RCVCC_MODE_RESET 0x00000001
- +#define RCVCC_MODE_ENABLE 0x00000002
- +#define RCVCC_MODE_ATTN_ENABLE 0x00000004
- +#define RCVCC_STATUS 0x00003004
- +#define RCVCC_STATUS_ERROR_ATTN 0x00000004
- +#define RCVCC_JUMP_PROD_IDX 0x00003008
- +#define RCVCC_STD_PROD_IDX 0x0000300c
- +#define RCVCC_MINI_PROD_IDX 0x00003010
- +/* 0x3014 --> 0x3400 unused */
- +
- +/* Receive list selector control registers */
- +#define RCVLSC_MODE 0x00003400
- +#define RCVLSC_MODE_RESET 0x00000001
- +#define RCVLSC_MODE_ENABLE 0x00000002
- +#define RCVLSC_MODE_ATTN_ENABLE 0x00000004
- +#define RCVLSC_STATUS 0x00003404
- +#define RCVLSC_STATUS_ERROR_ATTN 0x00000004
- +/* 0x3408 --> 0x3800 unused */
- +
- +/* Mbuf cluster free registers */
- +#define MBFREE_MODE 0x00003800
- +#define MBFREE_MODE_RESET 0x00000001
- +#define MBFREE_MODE_ENABLE 0x00000002
- +#define MBFREE_STATUS 0x00003804
- +/* 0x3808 --> 0x3c00 unused */
- +
- +/* Host coalescing control registers */
- +#define HOSTCC_MODE 0x00003c00
- +#define HOSTCC_MODE_RESET 0x00000001
- +#define HOSTCC_MODE_ENABLE 0x00000002
- +#define HOSTCC_MODE_ATTN 0x00000004
- +#define HOSTCC_MODE_NOW 0x00000008
- +#define HOSTCC_MODE_FULL_STATUS 0x00000000
- +#define HOSTCC_MODE_64BYTE 0x00000080
- +#define HOSTCC_MODE_32BYTE 0x00000100
- +#define HOSTCC_MODE_CLRTICK_RXBD 0x00000200
- +#define HOSTCC_MODE_CLRTICK_TXBD 0x00000400
- +#define HOSTCC_MODE_NOINT_ON_NOW 0x00000800
- +#define HOSTCC_MODE_NOINT_ON_FORCE 0x00001000
- +#define HOSTCC_STATUS 0x00003c04
- +#define HOSTCC_STATUS_ERROR_ATTN 0x00000004
- +#define HOSTCC_RXCOL_TICKS 0x00003c08
- +#define LOW_RXCOL_TICKS 0x00000032
- +#define DEFAULT_RXCOL_TICKS 0x00000048
- +#define HIGH_RXCOL_TICKS 0x00000096
- +#define HOSTCC_TXCOL_TICKS 0x00003c0c
- +#define LOW_TXCOL_TICKS 0x00000096
- +#define DEFAULT_TXCOL_TICKS 0x0000012c
- +#define HIGH_TXCOL_TICKS 0x00000145
- +#define HOSTCC_RXMAX_FRAMES 0x00003c10
- +#define LOW_RXMAX_FRAMES 0x00000005
- +#define DEFAULT_RXMAX_FRAMES 0x00000008
- +#define HIGH_RXMAX_FRAMES 0x00000012
- +#define HOSTCC_TXMAX_FRAMES 0x00003c14
- +#define LOW_TXMAX_FRAMES 0x00000035
- +#define DEFAULT_TXMAX_FRAMES 0x0000004b
- +#define HIGH_TXMAX_FRAMES 0x00000052
- +#define HOSTCC_RXCOAL_TICK_INT 0x00003c18
- +#define DEFAULT_RXCOAL_TICK_INT 0x00000019
- +#define HOSTCC_TXCOAL_TICK_INT 0x00003c1c
- +#define DEFAULT_TXCOAL_TICK_INT 0x00000019
- +#define HOSTCC_RXCOAL_MAXF_INT 0x00003c20
- +#define DEFAULT_RXCOAL_MAXF_INT 0x00000005
- +#define HOSTCC_TXCOAL_MAXF_INT 0x00003c24
- +#define DEFAULT_TXCOAL_MAXF_INT 0x00000005
- +#define HOSTCC_STAT_COAL_TICKS 0x00003c28
- +#define DEFAULT_STAT_COAL_TICKS 0x000f4240
- +/* 0x3c2c --> 0x3c30 unused */
- +#define HOSTCC_STATS_BLK_HOST_ADDR 0x00003c30 /* 64-bit */
- +#define HOSTCC_STATUS_BLK_HOST_ADDR 0x00003c38 /* 64-bit */
- +#define HOSTCC_STATS_BLK_NIC_ADDR 0x00003c40
- +#define HOSTCC_STATUS_BLK_NIC_ADDR 0x00003c44
- +#define HOSTCC_FLOW_ATTN 0x00003c48
- +/* 0x3c4c --> 0x3c50 unused */
- +#define HOSTCC_JUMBO_CON_IDX 0x00003c50
- +#define HOSTCC_STD_CON_IDX 0x00003c54
- +#define HOSTCC_MINI_CON_IDX 0x00003c58
- +/* 0x3c5c --> 0x3c80 unused */
- +#define HOSTCC_RET_PROD_IDX_0 0x00003c80
- +#define HOSTCC_RET_PROD_IDX_1 0x00003c84
- +#define HOSTCC_RET_PROD_IDX_2 0x00003c88
- +#define HOSTCC_RET_PROD_IDX_3 0x00003c8c
- +#define HOSTCC_RET_PROD_IDX_4 0x00003c90
- +#define HOSTCC_RET_PROD_IDX_5 0x00003c94
- +#define HOSTCC_RET_PROD_IDX_6 0x00003c98
- +#define HOSTCC_RET_PROD_IDX_7 0x00003c9c
- +#define HOSTCC_RET_PROD_IDX_8 0x00003ca0
- +#define HOSTCC_RET_PROD_IDX_9 0x00003ca4
- +#define HOSTCC_RET_PROD_IDX_10 0x00003ca8
- +#define HOSTCC_RET_PROD_IDX_11 0x00003cac
- +#define HOSTCC_RET_PROD_IDX_12 0x00003cb0
- +#define HOSTCC_RET_PROD_IDX_13 0x00003cb4
- +#define HOSTCC_RET_PROD_IDX_14 0x00003cb8
- +#define HOSTCC_RET_PROD_IDX_15 0x00003cbc
- +#define HOSTCC_SND_CON_IDX_0 0x00003cc0
- +#define HOSTCC_SND_CON_IDX_1 0x00003cc4
- +#define HOSTCC_SND_CON_IDX_2 0x00003cc8
- +#define HOSTCC_SND_CON_IDX_3 0x00003ccc
- +#define HOSTCC_SND_CON_IDX_4 0x00003cd0
- +#define HOSTCC_SND_CON_IDX_5 0x00003cd4
- +#define HOSTCC_SND_CON_IDX_6 0x00003cd8
- +#define HOSTCC_SND_CON_IDX_7 0x00003cdc
- +#define HOSTCC_SND_CON_IDX_8 0x00003ce0
- +#define HOSTCC_SND_CON_IDX_9 0x00003ce4
- +#define HOSTCC_SND_CON_IDX_10 0x00003ce8
- +#define HOSTCC_SND_CON_IDX_11 0x00003cec
- +#define HOSTCC_SND_CON_IDX_12 0x00003cf0
- +#define HOSTCC_SND_CON_IDX_13 0x00003cf4
- +#define HOSTCC_SND_CON_IDX_14 0x00003cf8
- +#define HOSTCC_SND_CON_IDX_15 0x00003cfc
- +/* 0x3d00 --> 0x4000 unused */
- +
- +/* Memory arbiter control registers */
- +#define MEMARB_MODE 0x00004000
- +#define MEMARB_MODE_RESET 0x00000001
- +#define MEMARB_MODE_ENABLE 0x00000002
- +#define MEMARB_STATUS 0x00004004
- +#define MEMARB_TRAP_ADDR_LOW 0x00004008
- +#define MEMARB_TRAP_ADDR_HIGH 0x0000400c
- +/* 0x4010 --> 0x4400 unused */
- +
- +/* Buffer manager control registers */
- +#define BUFMGR_MODE 0x00004400
- +#define BUFMGR_MODE_RESET 0x00000001
- +#define BUFMGR_MODE_ENABLE 0x00000002
- +#define BUFMGR_MODE_ATTN_ENABLE 0x00000004
- +#define BUFMGR_MODE_BM_TEST 0x00000008
- +#define BUFMGR_MODE_MBLOW_ATTN_ENAB 0x00000010
- +#define BUFMGR_STATUS 0x00004404
- +#define BUFMGR_STATUS_ERROR 0x00000004
- +#define BUFMGR_STATUS_MBLOW 0x00000010
- +#define BUFMGR_MB_POOL_ADDR 0x00004408
- +#define BUFMGR_MB_POOL_SIZE 0x0000440c
- +#define BUFMGR_MB_RDMA_LOW_WATER 0x00004410
- +#define DEFAULT_MB_RDMA_LOW_WATER 0x00000050
- +#define DEFAULT_MB_RDMA_LOW_WATER_5705 0x00000000
- +#define DEFAULT_MB_RDMA_LOW_WATER_JUMBO 0x00000130
- +#define BUFMGR_MB_MACRX_LOW_WATER 0x00004414
- +#define DEFAULT_MB_MACRX_LOW_WATER 0x00000020
- +#define DEFAULT_MB_MACRX_LOW_WATER_5705 0x00000010
- +#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO 0x00000098
- +#define BUFMGR_MB_HIGH_WATER 0x00004418
- +#define DEFAULT_MB_HIGH_WATER 0x00000060
- +#define DEFAULT_MB_HIGH_WATER_5705 0x00000060
- +#define DEFAULT_MB_HIGH_WATER_JUMBO 0x0000017c
- +#define BUFMGR_RX_MB_ALLOC_REQ 0x0000441c
- +#define BUFMGR_MB_ALLOC_BIT 0x10000000
- +#define BUFMGR_RX_MB_ALLOC_RESP 0x00004420
- +#define BUFMGR_TX_MB_ALLOC_REQ 0x00004424
- +#define BUFMGR_TX_MB_ALLOC_RESP 0x00004428
- +#define BUFMGR_DMA_DESC_POOL_ADDR 0x0000442c
- +#define BUFMGR_DMA_DESC_POOL_SIZE 0x00004430
- +#define BUFMGR_DMA_LOW_WATER 0x00004434
- +#define DEFAULT_DMA_LOW_WATER 0x00000005
- +#define BUFMGR_DMA_HIGH_WATER 0x00004438
- +#define DEFAULT_DMA_HIGH_WATER 0x0000000a
- +#define BUFMGR_RX_DMA_ALLOC_REQ 0x0000443c
- +#define BUFMGR_RX_DMA_ALLOC_RESP 0x00004440
- +#define BUFMGR_TX_DMA_ALLOC_REQ 0x00004444
- +#define BUFMGR_TX_DMA_ALLOC_RESP 0x00004448
- +#define BUFMGR_HWDIAG_0 0x0000444c
- +#define BUFMGR_HWDIAG_1 0x00004450
- +#define BUFMGR_HWDIAG_2 0x00004454
- +/* 0x4458 --> 0x4800 unused */
- +
- +/* Read DMA control registers */
- +#define RDMAC_MODE 0x00004800
- +#define RDMAC_MODE_RESET 0x00000001
- +#define RDMAC_MODE_ENABLE 0x00000002
- +#define RDMAC_MODE_TGTABORT_ENAB 0x00000004
- +#define RDMAC_MODE_MSTABORT_ENAB 0x00000008
- +#define RDMAC_MODE_PARITYERR_ENAB 0x00000010
- +#define RDMAC_MODE_ADDROFLOW_ENAB 0x00000020
- +#define RDMAC_MODE_FIFOOFLOW_ENAB 0x00000040
- +#define RDMAC_MODE_FIFOURUN_ENAB 0x00000080
- +#define RDMAC_MODE_FIFOOREAD_ENAB 0x00000100
- +#define RDMAC_MODE_LNGREAD_ENAB 0x00000200
- +#define RDMAC_MODE_SPLIT_ENABLE 0x00000800
- +#define RDMAC_MODE_SPLIT_RESET 0x00001000
- +#define RDMAC_MODE_FIFO_SIZE_128 0x00020000
- +#define RDMAC_MODE_FIFO_LONG_BURST 0x00030000
- +#define RDMAC_STATUS 0x00004804
- +#define RDMAC_STATUS_TGTABORT 0x00000004
- +#define RDMAC_STATUS_MSTABORT 0x00000008
- +#define RDMAC_STATUS_PARITYERR 0x00000010
- +#define RDMAC_STATUS_ADDROFLOW 0x00000020
- +#define RDMAC_STATUS_FIFOOFLOW 0x00000040
- +#define RDMAC_STATUS_FIFOURUN 0x00000080
- +#define RDMAC_STATUS_FIFOOREAD 0x00000100
- +#define RDMAC_STATUS_LNGREAD 0x00000200
- +/* 0x4808 --> 0x4c00 unused */
- +
- +/* Write DMA control registers */
- +#define WDMAC_MODE 0x00004c00
- +#define WDMAC_MODE_RESET 0x00000001
- +#define WDMAC_MODE_ENABLE 0x00000002
- +#define WDMAC_MODE_TGTABORT_ENAB 0x00000004
- +#define WDMAC_MODE_MSTABORT_ENAB 0x00000008
- +#define WDMAC_MODE_PARITYERR_ENAB 0x00000010
- +#define WDMAC_MODE_ADDROFLOW_ENAB 0x00000020
- +#define WDMAC_MODE_FIFOOFLOW_ENAB 0x00000040
- +#define WDMAC_MODE_FIFOURUN_ENAB 0x00000080
- +#define WDMAC_MODE_FIFOOREAD_ENAB 0x00000100
- +#define WDMAC_MODE_LNGREAD_ENAB 0x00000200
- +#define WDMAC_MODE_RX_ACCEL 0x00000400
- +#define WDMAC_STATUS 0x00004c04
- +#define WDMAC_STATUS_TGTABORT 0x00000004
- +#define WDMAC_STATUS_MSTABORT 0x00000008
- +#define WDMAC_STATUS_PARITYERR 0x00000010
- +#define WDMAC_STATUS_ADDROFLOW 0x00000020
- +#define WDMAC_STATUS_FIFOOFLOW 0x00000040
- +#define WDMAC_STATUS_FIFOURUN 0x00000080
- +#define WDMAC_STATUS_FIFOOREAD 0x00000100
- +#define WDMAC_STATUS_LNGREAD 0x00000200
- +/* 0x4c08 --> 0x5000 unused */
- +
- +/* Per-cpu register offsets (arm9) */
- +#define CPU_MODE 0x00000000
- +#define CPU_MODE_RESET 0x00000001
- +#define CPU_MODE_HALT 0x00000400
- +#define CPU_STATE 0x00000004
- +#define CPU_EVTMASK 0x00000008
- +/* 0xc --> 0x1c reserved */
- +#define CPU_PC 0x0000001c
- +#define CPU_INSN 0x00000020
- +#define CPU_SPAD_UFLOW 0x00000024
- +#define CPU_WDOG_CLEAR 0x00000028
- +#define CPU_WDOG_VECTOR 0x0000002c
- +#define CPU_WDOG_PC 0x00000030
- +#define CPU_HW_BP 0x00000034
- +/* 0x38 --> 0x44 unused */
- +#define CPU_WDOG_SAVED_STATE 0x00000044
- +#define CPU_LAST_BRANCH_ADDR 0x00000048
- +#define CPU_SPAD_UFLOW_SET 0x0000004c
- +/* 0x50 --> 0x200 unused */
- +#define CPU_R0 0x00000200
- +#define CPU_R1 0x00000204
- +#define CPU_R2 0x00000208
- +#define CPU_R3 0x0000020c
- +#define CPU_R4 0x00000210
- +#define CPU_R5 0x00000214
- +#define CPU_R6 0x00000218
- +#define CPU_R7 0x0000021c
- +#define CPU_R8 0x00000220
- +#define CPU_R9 0x00000224
- +#define CPU_R10 0x00000228
- +#define CPU_R11 0x0000022c
- +#define CPU_R12 0x00000230
- +#define CPU_R13 0x00000234
- +#define CPU_R14 0x00000238
- +#define CPU_R15 0x0000023c
- +#define CPU_R16 0x00000240
- +#define CPU_R17 0x00000244
- +#define CPU_R18 0x00000248
- +#define CPU_R19 0x0000024c
- +#define CPU_R20 0x00000250
- +#define CPU_R21 0x00000254
- +#define CPU_R22 0x00000258
- +#define CPU_R23 0x0000025c
- +#define CPU_R24 0x00000260
- +#define CPU_R25 0x00000264
- +#define CPU_R26 0x00000268
- +#define CPU_R27 0x0000026c
- +#define CPU_R28 0x00000270
- +#define CPU_R29 0x00000274
- +#define CPU_R30 0x00000278
- +#define CPU_R31 0x0000027c
- +/* 0x280 --> 0x400 unused */
- +
- +#define RX_CPU_BASE 0x00005000
- +#define TX_CPU_BASE 0x00005400
- +
- +/* Mailboxes */
- +#define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */
- +#define GRCMBOX_INTERRUPT_1 0x00005808 /* 64-bit */
- +#define GRCMBOX_INTERRUPT_2 0x00005810 /* 64-bit */
- +#define GRCMBOX_INTERRUPT_3 0x00005818 /* 64-bit */
- +#define GRCMBOX_GENERAL_0 0x00005820 /* 64-bit */
- +#define GRCMBOX_GENERAL_1 0x00005828 /* 64-bit */
- +#define GRCMBOX_GENERAL_2 0x00005830 /* 64-bit */
- +#define GRCMBOX_GENERAL_3 0x00005838 /* 64-bit */
- +#define GRCMBOX_GENERAL_4 0x00005840 /* 64-bit */
- +#define GRCMBOX_GENERAL_5 0x00005848 /* 64-bit */
- +#define GRCMBOX_GENERAL_6 0x00005850 /* 64-bit */
- +#define GRCMBOX_GENERAL_7 0x00005858 /* 64-bit */
- +#define GRCMBOX_RELOAD_STAT 0x00005860 /* 64-bit */
- +#define GRCMBOX_RCVSTD_PROD_IDX 0x00005868 /* 64-bit */
- +#define GRCMBOX_RCVJUMBO_PROD_IDX 0x00005870 /* 64-bit */
- +#define GRCMBOX_RCVMINI_PROD_IDX 0x00005878 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_0 0x00005880 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_1 0x00005888 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_2 0x00005890 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_3 0x00005898 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_4 0x000058a0 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_5 0x000058a8 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_6 0x000058b0 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_7 0x000058b8 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_8 0x000058c0 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_9 0x000058c8 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_10 0x000058d0 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_11 0x000058d8 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_12 0x000058e0 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_13 0x000058e8 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_14 0x000058f0 /* 64-bit */
- +#define GRCMBOX_RCVRET_CON_IDX_15 0x000058f8 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_0 0x00005900 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_1 0x00005908 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_2 0x00005910 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_3 0x00005918 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_4 0x00005920 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_5 0x00005928 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_6 0x00005930 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_7 0x00005938 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_8 0x00005940 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_9 0x00005948 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_10 0x00005950 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_11 0x00005958 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_12 0x00005960 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_13 0x00005968 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_14 0x00005970 /* 64-bit */
- +#define GRCMBOX_SNDHOST_PROD_IDX_15 0x00005978 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_0 0x00005980 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_1 0x00005988 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_2 0x00005990 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_3 0x00005998 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_4 0x000059a0 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_5 0x000059a8 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_6 0x000059b0 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_7 0x000059b8 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_8 0x000059c0 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_9 0x000059c8 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_10 0x000059d0 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_11 0x000059d8 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_12 0x000059e0 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_13 0x000059e8 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_14 0x000059f0 /* 64-bit */
- +#define GRCMBOX_SNDNIC_PROD_IDX_15 0x000059f8 /* 64-bit */
- +#define GRCMBOX_HIGH_PRIO_EV_VECTOR 0x00005a00
- +#define GRCMBOX_HIGH_PRIO_EV_MASK 0x00005a04
- +#define GRCMBOX_LOW_PRIO_EV_VEC 0x00005a08
- +#define GRCMBOX_LOW_PRIO_EV_MASK 0x00005a0c
- +/* 0x5a10 --> 0x5c00 */
- +
- +/* Flow Through queues */
- +#define FTQ_RESET 0x00005c00
- +/* 0x5c04 --> 0x5c10 unused */
- +#define FTQ_DMA_NORM_READ_CTL 0x00005c10
- +#define FTQ_DMA_NORM_READ_FULL_CNT 0x00005c14
- +#define FTQ_DMA_NORM_READ_FIFO_ENQDEQ 0x00005c18
- +#define FTQ_DMA_NORM_READ_WRITE_PEEK 0x00005c1c
- +#define FTQ_DMA_HIGH_READ_CTL 0x00005c20
- +#define FTQ_DMA_HIGH_READ_FULL_CNT 0x00005c24
- +#define FTQ_DMA_HIGH_READ_FIFO_ENQDEQ 0x00005c28
- +#define FTQ_DMA_HIGH_READ_WRITE_PEEK 0x00005c2c
- +#define FTQ_DMA_COMP_DISC_CTL 0x00005c30
- +#define FTQ_DMA_COMP_DISC_FULL_CNT 0x00005c34
- +#define FTQ_DMA_COMP_DISC_FIFO_ENQDEQ 0x00005c38
- +#define FTQ_DMA_COMP_DISC_WRITE_PEEK 0x00005c3c
- +#define FTQ_SEND_BD_COMP_CTL 0x00005c40
- +#define FTQ_SEND_BD_COMP_FULL_CNT 0x00005c44
- +#define FTQ_SEND_BD_COMP_FIFO_ENQDEQ 0x00005c48
- +#define FTQ_SEND_BD_COMP_WRITE_PEEK 0x00005c4c
- +#define FTQ_SEND_DATA_INIT_CTL 0x00005c50
- +#define FTQ_SEND_DATA_INIT_FULL_CNT 0x00005c54
- +#define FTQ_SEND_DATA_INIT_FIFO_ENQDEQ 0x00005c58
- +#define FTQ_SEND_DATA_INIT_WRITE_PEEK 0x00005c5c
- +#define FTQ_DMA_NORM_WRITE_CTL 0x00005c60
- +#define FTQ_DMA_NORM_WRITE_FULL_CNT 0x00005c64
- +#define FTQ_DMA_NORM_WRITE_FIFO_ENQDEQ 0x00005c68
- +#define FTQ_DMA_NORM_WRITE_WRITE_PEEK 0x00005c6c
- +#define FTQ_DMA_HIGH_WRITE_CTL 0x00005c70
- +#define FTQ_DMA_HIGH_WRITE_FULL_CNT 0x00005c74
- +#define FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ 0x00005c78
- +#define FTQ_DMA_HIGH_WRITE_WRITE_PEEK 0x00005c7c
- +#define FTQ_SWTYPE1_CTL 0x00005c80
- +#define FTQ_SWTYPE1_FULL_CNT 0x00005c84
- +#define FTQ_SWTYPE1_FIFO_ENQDEQ 0x00005c88
- +#define FTQ_SWTYPE1_WRITE_PEEK 0x00005c8c
- +#define FTQ_SEND_DATA_COMP_CTL 0x00005c90
- +#define FTQ_SEND_DATA_COMP_FULL_CNT 0x00005c94
- +#define FTQ_SEND_DATA_COMP_FIFO_ENQDEQ 0x00005c98
- +#define FTQ_SEND_DATA_COMP_WRITE_PEEK 0x00005c9c
- +#define FTQ_HOST_COAL_CTL 0x00005ca0
- +#define FTQ_HOST_COAL_FULL_CNT 0x00005ca4
- +#define FTQ_HOST_COAL_FIFO_ENQDEQ 0x00005ca8
- +#define FTQ_HOST_COAL_WRITE_PEEK 0x00005cac
- +#define FTQ_MAC_TX_CTL 0x00005cb0
- +#define FTQ_MAC_TX_FULL_CNT 0x00005cb4
- +#define FTQ_MAC_TX_FIFO_ENQDEQ 0x00005cb8
- +#define FTQ_MAC_TX_WRITE_PEEK 0x00005cbc
- +#define FTQ_MB_FREE_CTL 0x00005cc0
- +#define FTQ_MB_FREE_FULL_CNT 0x00005cc4
- +#define FTQ_MB_FREE_FIFO_ENQDEQ 0x00005cc8
- +#define FTQ_MB_FREE_WRITE_PEEK 0x00005ccc
- +#define FTQ_RCVBD_COMP_CTL 0x00005cd0
- +#define FTQ_RCVBD_COMP_FULL_CNT 0x00005cd4
- +#define FTQ_RCVBD_COMP_FIFO_ENQDEQ 0x00005cd8
- +#define FTQ_RCVBD_COMP_WRITE_PEEK 0x00005cdc
- +#define FTQ_RCVLST_PLMT_CTL 0x00005ce0
- +#define FTQ_RCVLST_PLMT_FULL_CNT 0x00005ce4
- +#define FTQ_RCVLST_PLMT_FIFO_ENQDEQ 0x00005ce8
- +#define FTQ_RCVLST_PLMT_WRITE_PEEK 0x00005cec
- +#define FTQ_RCVDATA_INI_CTL 0x00005cf0
- +#define FTQ_RCVDATA_INI_FULL_CNT 0x00005cf4
- +#define FTQ_RCVDATA_INI_FIFO_ENQDEQ 0x00005cf8
- +#define FTQ_RCVDATA_INI_WRITE_PEEK 0x00005cfc
- +#define FTQ_RCVDATA_COMP_CTL 0x00005d00
- +#define FTQ_RCVDATA_COMP_FULL_CNT 0x00005d04
- +#define FTQ_RCVDATA_COMP_FIFO_ENQDEQ 0x00005d08
- +#define FTQ_RCVDATA_COMP_WRITE_PEEK 0x00005d0c
- +#define FTQ_SWTYPE2_CTL 0x00005d10
- +#define FTQ_SWTYPE2_FULL_CNT 0x00005d14
- +#define FTQ_SWTYPE2_FIFO_ENQDEQ 0x00005d18
- +#define FTQ_SWTYPE2_WRITE_PEEK 0x00005d1c
- +/* 0x5d20 --> 0x6000 unused */
- +
- +/* Message signaled interrupt registers */
- +#define MSGINT_MODE 0x00006000
- +#define MSGINT_MODE_RESET 0x00000001
- +#define MSGINT_MODE_ENABLE 0x00000002
- +#define MSGINT_STATUS 0x00006004
- +#define MSGINT_FIFO 0x00006008
- +/* 0x600c --> 0x6400 unused */
- +
- +/* DMA completion registers */
- +#define DMAC_MODE 0x00006400
- +#define DMAC_MODE_RESET 0x00000001
- +#define DMAC_MODE_ENABLE 0x00000002
- +/* 0x6404 --> 0x6800 unused */
- +
- +/* GRC registers */
- +#define GRC_MODE 0x00006800
- +#define GRC_MODE_UPD_ON_COAL 0x00000001
- +#define GRC_MODE_BSWAP_NONFRM_DATA 0x00000002
- +#define GRC_MODE_WSWAP_NONFRM_DATA 0x00000004
- +#define GRC_MODE_BSWAP_DATA 0x00000010
- +#define GRC_MODE_WSWAP_DATA 0x00000020
- +#define GRC_MODE_SPLITHDR 0x00000100
- +#define GRC_MODE_NOFRM_CRACKING 0x00000200
- +#define GRC_MODE_INCL_CRC 0x00000400
- +#define GRC_MODE_ALLOW_BAD_FRMS 0x00000800
- +#define GRC_MODE_NOIRQ_ON_SENDS 0x00002000
- +#define GRC_MODE_NOIRQ_ON_RCV 0x00004000
- +#define GRC_MODE_FORCE_PCI32BIT 0x00008000
- +#define GRC_MODE_HOST_STACKUP 0x00010000
- +#define GRC_MODE_HOST_SENDBDS 0x00020000
- +#define GRC_MODE_NO_TX_PHDR_CSUM 0x00100000
- +#define GRC_MODE_NO_RX_PHDR_CSUM 0x00800000
- +#define GRC_MODE_IRQ_ON_TX_CPU_ATTN 0x01000000
- +#define GRC_MODE_IRQ_ON_RX_CPU_ATTN 0x02000000
- +#define GRC_MODE_IRQ_ON_MAC_ATTN 0x04000000
- +#define GRC_MODE_IRQ_ON_DMA_ATTN 0x08000000
- +#define GRC_MODE_IRQ_ON_FLOW_ATTN 0x10000000
- +#define GRC_MODE_4X_NIC_SEND_RINGS 0x20000000
- +#define GRC_MODE_MCAST_FRM_ENABLE 0x40000000
- +#define GRC_MISC_CFG 0x00006804
- +#define GRC_MISC_CFG_CORECLK_RESET 0x00000001
- +#define GRC_MISC_CFG_PRESCALAR_MASK 0x000000fe
- +#define GRC_MISC_CFG_PRESCALAR_SHIFT 1
- +#define GRC_MISC_CFG_BOARD_ID_MASK 0x0001e000
- +#define GRC_MISC_CFG_BOARD_ID_5700 0x0001e000
- +#define GRC_MISC_CFG_BOARD_ID_5701 0x00000000
- +#define GRC_MISC_CFG_BOARD_ID_5702FE 0x00004000
- +#define GRC_MISC_CFG_BOARD_ID_5703 0x00000000
- +#define GRC_MISC_CFG_BOARD_ID_5703S 0x00002000
- +#define GRC_MISC_CFG_BOARD_ID_5704 0x00000000
- +#define GRC_MISC_CFG_BOARD_ID_5704CIOBE 0x00004000
- +#define GRC_MISC_CFG_BOARD_ID_5704_A2 0x00008000
- +#define GRC_MISC_CFG_BOARD_ID_5788 0x00010000
- +#define GRC_MISC_CFG_BOARD_ID_5788M 0x00018000
- +#define GRC_MISC_CFG_BOARD_ID_AC91002A1 0x00018000
- +#define GRC_MISC_CFG_KEEP_GPHY_POWER 0x04000000
- +#define GRC_LOCAL_CTRL 0x00006808
- +#define GRC_LCLCTRL_INT_ACTIVE 0x00000001
- +#define GRC_LCLCTRL_CLEARINT 0x00000002
- +#define GRC_LCLCTRL_SETINT 0x00000004
- +#define GRC_LCLCTRL_INT_ON_ATTN 0x00000008
- +#define GRC_LCLCTRL_GPIO_INPUT0 0x00000100
- +#define GRC_LCLCTRL_GPIO_INPUT1 0x00000200
- +#define GRC_LCLCTRL_GPIO_INPUT2 0x00000400
- +#define GRC_LCLCTRL_GPIO_OE0 0x00000800
- +#define GRC_LCLCTRL_GPIO_OE1 0x00001000
- +#define GRC_LCLCTRL_GPIO_OE2 0x00002000
- +#define GRC_LCLCTRL_GPIO_OUTPUT0 0x00004000
- +#define GRC_LCLCTRL_GPIO_OUTPUT1 0x00008000
- +#define GRC_LCLCTRL_GPIO_OUTPUT2 0x00010000
- +#define GRC_LCLCTRL_EXTMEM_ENABLE 0x00020000
- +#define GRC_LCLCTRL_MEMSZ_MASK 0x001c0000
- +#define GRC_LCLCTRL_MEMSZ_256K 0x00000000
- +#define GRC_LCLCTRL_MEMSZ_512K 0x00040000
- +#define GRC_LCLCTRL_MEMSZ_1M 0x00080000
- +#define GRC_LCLCTRL_MEMSZ_2M 0x000c0000
- +#define GRC_LCLCTRL_MEMSZ_4M 0x00100000
- +#define GRC_LCLCTRL_MEMSZ_8M 0x00140000
- +#define GRC_LCLCTRL_MEMSZ_16M 0x00180000
- +#define GRC_LCLCTRL_BANK_SELECT 0x00200000
- +#define GRC_LCLCTRL_SSRAM_TYPE 0x00400000
- +#define GRC_LCLCTRL_AUTO_SEEPROM 0x01000000
- +#define GRC_TIMER 0x0000680c
- +#define GRC_RX_CPU_EVENT 0x00006810
- +#define GRC_RX_TIMER_REF 0x00006814
- +#define GRC_RX_CPU_SEM 0x00006818
- +#define GRC_REMOTE_RX_CPU_ATTN 0x0000681c
- +#define GRC_TX_CPU_EVENT 0x00006820
- +#define GRC_TX_TIMER_REF 0x00006824
- +#define GRC_TX_CPU_SEM 0x00006828
- +#define GRC_REMOTE_TX_CPU_ATTN 0x0000682c
- +#define GRC_MEM_POWER_UP 0x00006830 /* 64-bit */
- +#define GRC_EEPROM_ADDR 0x00006838
- +#define EEPROM_ADDR_WRITE 0x00000000
- +#define EEPROM_ADDR_READ 0x80000000
- +#define EEPROM_ADDR_COMPLETE 0x40000000
- +#define EEPROM_ADDR_FSM_RESET 0x20000000
- +#define EEPROM_ADDR_DEVID_MASK 0x1c000000
- +#define EEPROM_ADDR_DEVID_SHIFT 26
- +#define EEPROM_ADDR_START 0x02000000
- +#define EEPROM_ADDR_CLKPERD_SHIFT 16
- +#define EEPROM_ADDR_ADDR_MASK 0x0000ffff
- +#define EEPROM_ADDR_ADDR_SHIFT 0
- +#define EEPROM_DEFAULT_CLOCK_PERIOD 0x60
- +#define EEPROM_CHIP_SIZE (64 * 1024)
- +#define GRC_EEPROM_DATA 0x0000683c
- +#define GRC_EEPROM_CTRL 0x00006840
- +#define GRC_MDI_CTRL 0x00006844
- +#define GRC_SEEPROM_DELAY 0x00006848
- +/* 0x684c --> 0x6c00 unused */
- +
- +/* 0x6c00 --> 0x7000 unused */
- +
- +/* NVRAM Control registers */
- +#define NVRAM_CMD 0x00007000
- +#define NVRAM_CMD_RESET 0x00000001
- +#define NVRAM_CMD_DONE 0x00000008
- +#define NVRAM_CMD_GO 0x00000010
- +#define NVRAM_CMD_WR 0x00000020
- +#define NVRAM_CMD_RD 0x00000000
- +#define NVRAM_CMD_ERASE 0x00000040
- +#define NVRAM_CMD_FIRST 0x00000080
- +#define NVRAM_CMD_LAST 0x00000100
- +#define NVRAM_STAT 0x00007004
- +#define NVRAM_WRDATA 0x00007008
- +#define NVRAM_ADDR 0x0000700c
- +#define NVRAM_ADDR_MSK 0x00ffffff
- +#define NVRAM_RDDATA 0x00007010
- +#define NVRAM_CFG1 0x00007014
- +#define NVRAM_CFG1_FLASHIF_ENAB 0x00000001
- +#define NVRAM_CFG1_BUFFERED_MODE 0x00000002
- +#define NVRAM_CFG1_PASS_THRU 0x00000004
- +#define NVRAM_CFG1_BIT_BANG 0x00000008
- +#define NVRAM_CFG1_COMPAT_BYPASS 0x80000000
- +#define NVRAM_CFG2 0x00007018
- +#define NVRAM_CFG3 0x0000701c
- +#define NVRAM_SWARB 0x00007020
- +#define SWARB_REQ_SET0 0x00000001
- +#define SWARB_REQ_SET1 0x00000002
- +#define SWARB_REQ_SET2 0x00000004
- +#define SWARB_REQ_SET3 0x00000008
- +#define SWARB_REQ_CLR0 0x00000010
- +#define SWARB_REQ_CLR1 0x00000020
- +#define SWARB_REQ_CLR2 0x00000040
- +#define SWARB_REQ_CLR3 0x00000080
- +#define SWARB_GNT0 0x00000100
- +#define SWARB_GNT1 0x00000200
- +#define SWARB_GNT2 0x00000400
- +#define SWARB_GNT3 0x00000800
- +#define SWARB_REQ0 0x00001000
- +#define SWARB_REQ1 0x00002000
- +#define SWARB_REQ2 0x00004000
- +#define SWARB_REQ3 0x00008000
- +#define NVRAM_BUFFERED_PAGE_SIZE 264
- +#define NVRAM_BUFFERED_PAGE_POS 9
- +/* 0x7024 --> 0x7400 unused */
- +
- +/* 0x7400 --> 0x8000 unused */
- +
- +/* 32K Window into NIC internal memory */
- +#define NIC_SRAM_WIN_BASE 0x00008000
- +
- +/* Offsets into first 32k of NIC internal memory. */
- +#define NIC_SRAM_PAGE_ZERO 0x00000000
- +#define NIC_SRAM_SEND_RCB 0x00000100 /* 16 * TG3_BDINFO_... */
- +#define NIC_SRAM_RCV_RET_RCB 0x00000200 /* 16 * TG3_BDINFO_... */
- +#define NIC_SRAM_STATS_BLK 0x00000300
- +#define NIC_SRAM_STATUS_BLK 0x00000b00
- +
- +#define NIC_SRAM_FIRMWARE_MBOX 0x00000b50
- +#define NIC_SRAM_FIRMWARE_MBOX_MAGIC1 0x4B657654
- +#define NIC_SRAM_FIRMWARE_MBOX_MAGIC2 0x4861764b /* !dma on linkchg */
- +
- +#define NIC_SRAM_DATA_SIG 0x00000b54
- +#define NIC_SRAM_DATA_SIG_MAGIC 0x4b657654 /* ascii for 'KevT' */
- +
- +#define NIC_SRAM_DATA_CFG 0x00000b58
- +#define NIC_SRAM_DATA_CFG_LED_MODE_MASK 0x0000000c
- +#define NIC_SRAM_DATA_CFG_LED_MODE_UNKNOWN 0x00000000
- +#define NIC_SRAM_DATA_CFG_LED_TRIPLE_SPD 0x00000004
- +#define NIC_SRAM_DATA_CFG_LED_OPEN_DRAIN 0x00000004
- +#define NIC_SRAM_DATA_CFG_LED_LINK_SPD 0x00000008
- +#define NIC_SRAM_DATA_CFG_LED_OUTPUT 0x00000008
- +#define NIC_SRAM_DATA_CFG_PHY_TYPE_MASK 0x00000030
- +#define NIC_SRAM_DATA_CFG_PHY_TYPE_UNKNOWN 0x00000000
- +#define NIC_SRAM_DATA_CFG_PHY_TYPE_COPPER 0x00000010
- +#define NIC_SRAM_DATA_CFG_PHY_TYPE_FIBER 0x00000020
- +#define NIC_SRAM_DATA_CFG_WOL_ENABLE 0x00000040
- +#define NIC_SRAM_DATA_CFG_ASF_ENABLE 0x00000080
- +#define NIC_SRAM_DATA_CFG_EEPROM_WP 0x00000100
- +#define NIC_SRAM_DATA_CFG_MINI_PCI 0x00001000
- +#define NIC_SRAM_DATA_CFG_FIBER_WOL 0x00004000
- +
- +#define NIC_SRAM_DATA_PHY_ID 0x00000b74
- +#define NIC_SRAM_DATA_PHY_ID1_MASK 0xffff0000
- +#define NIC_SRAM_DATA_PHY_ID2_MASK 0x0000ffff
- +
- +#define NIC_SRAM_FW_CMD_MBOX 0x00000b78
- +#define FWCMD_NICDRV_ALIVE 0x00000001
- +#define FWCMD_NICDRV_PAUSE_FW 0x00000002
- +#define FWCMD_NICDRV_IPV4ADDR_CHG 0x00000003
- +#define FWCMD_NICDRV_IPV6ADDR_CHG 0x00000004
- +#define FWCMD_NICDRV_FIX_DMAR 0x00000005
- +#define FWCMD_NICDRV_FIX_DMAW 0x00000006
- +#define NIC_SRAM_FW_CMD_LEN_MBOX 0x00000b7c
- +#define NIC_SRAM_FW_CMD_DATA_MBOX 0x00000b80
- +#define NIC_SRAM_FW_ASF_STATUS_MBOX 0x00000c00
- +#define NIC_SRAM_FW_DRV_STATE_MBOX 0x00000c04
- +#define DRV_STATE_START 0x00000001
- +#define DRV_STATE_UNLOAD 0x00000002
- +#define DRV_STATE_WOL 0x00000003
- +#define DRV_STATE_SUSPEND 0x00000004
- +
- +#define NIC_SRAM_FW_RESET_TYPE_MBOX 0x00000c08
- +
- +#define NIC_SRAM_MAC_ADDR_HIGH_MBOX 0x00000c14
- +#define NIC_SRAM_MAC_ADDR_LOW_MBOX 0x00000c18
- +
- +#define NIC_SRAM_RX_MINI_BUFFER_DESC 0x00001000
- +
- +#define NIC_SRAM_DMA_DESC_POOL_BASE 0x00002000
- +#define NIC_SRAM_DMA_DESC_POOL_SIZE 0x00002000
- +#define NIC_SRAM_TX_BUFFER_DESC 0x00004000 /* 512 entries */
- +#define NIC_SRAM_RX_BUFFER_DESC 0x00006000 /* 256 entries */
- +#define NIC_SRAM_RX_JUMBO_BUFFER_DESC 0x00007000 /* 256 entries */
- +#define NIC_SRAM_MBUF_POOL_BASE 0x00008000
- +#define NIC_SRAM_MBUF_POOL_SIZE96 0x00018000
- +#define NIC_SRAM_MBUF_POOL_SIZE64 0x00010000
- +#define NIC_SRAM_MBUF_POOL_BASE5705 0x00010000
- +#define NIC_SRAM_MBUF_POOL_SIZE5705 0x0000e000
- +
- +/* Currently this is fixed. */
- +#define PHY_ADDR 0x01
- +
- +/* Tigon3 specific PHY MII registers. */
- +#define TG3_BMCR_SPEED1000 0x0040
- +
- +#define MII_TG3_CTRL 0x09 /* 1000-baseT control register */
- +#define MII_TG3_CTRL_ADV_1000_HALF 0x0100
- +#define MII_TG3_CTRL_ADV_1000_FULL 0x0200
- +#define MII_TG3_CTRL_AS_MASTER 0x0800
- +#define MII_TG3_CTRL_ENABLE_AS_MASTER 0x1000
- +
- +#define MII_TG3_EXT_CTRL 0x10 /* Extended control register */
- +#define MII_TG3_EXT_CTRL_LNK3_LED_MODE 0x0002
- +#define MII_TG3_EXT_CTRL_TBI 0x8000
- +
- +#define MII_TG3_EXT_STAT 0x11 /* Extended status register */
- +#define MII_TG3_EXT_STAT_LPASS 0x0100
- +
- +#define MII_TG3_DSP_RW_PORT 0x15 /* DSP coefficient read/write port */
- +
- +#define MII_TG3_DSP_ADDRESS 0x17 /* DSP address register */
- +
- +#define MII_TG3_AUX_CTRL 0x18 /* auxilliary control register */
- +
- +#define MII_TG3_AUX_STAT 0x19 /* auxilliary status register */
- +#define MII_TG3_AUX_STAT_LPASS 0x0004
- +#define MII_TG3_AUX_STAT_SPDMASK 0x0700
- +#define MII_TG3_AUX_STAT_10HALF 0x0100
- +#define MII_TG3_AUX_STAT_10FULL 0x0200
- +#define MII_TG3_AUX_STAT_100HALF 0x0300
- +#define MII_TG3_AUX_STAT_100_4 0x0400
- +#define MII_TG3_AUX_STAT_100FULL 0x0500
- +#define MII_TG3_AUX_STAT_1000HALF 0x0600
- +#define MII_TG3_AUX_STAT_1000FULL 0x0700
- +
- +#define MII_TG3_ISTAT 0x1a /* IRQ status register */
- +#define MII_TG3_IMASK 0x1b /* IRQ mask register */
- +
- +/* ISTAT/IMASK event bits */
- +#define MII_TG3_INT_LINKCHG 0x0002
- +#define MII_TG3_INT_SPEEDCHG 0x0004
- +#define MII_TG3_INT_DUPLEXCHG 0x0008
- +#define MII_TG3_INT_ANEG_PAGE_RX 0x0400
- +
- +/* XXX Add this to mii.h */
- +#ifndef ADVERTISE_PAUSE
- +#define ADVERTISE_PAUSE_CAP 0x0400
- +#endif
- +#ifndef ADVERTISE_PAUSE_ASYM
- +#define ADVERTISE_PAUSE_ASYM 0x0800
- +#endif
- +#ifndef LPA_PAUSE
- +#define LPA_PAUSE_CAP 0x0400
- +#endif
- +#ifndef LPA_PAUSE_ASYM
- +#define LPA_PAUSE_ASYM 0x0800
- +#endif
- +
- +/* There are two ways to manage the TX descriptors on the tigon3.
- + * Either the descriptors are in host DMA'able memory, or they
- + * exist only in the cards on-chip SRAM. All 16 send bds are under
- + * the same mode, they may not be configured individually.
- + *
- + * The mode we use is controlled by TG3_FLAG_HOST_TXDS in tp->tg3_flags.
- + *
- + * To use host memory TX descriptors:
- + * 1) Set GRC_MODE_HOST_SENDBDS in GRC_MODE register.
- + * Make sure GRC_MODE_4X_NIC_SEND_RINGS is clear.
- + * 2) Allocate DMA'able memory.
- + * 3) In NIC_SRAM_SEND_RCB (of desired index) of on-chip SRAM:
- + * a) Set TG3_BDINFO_HOST_ADDR to DMA address of memory
- + * obtained in step 2
- + * b) Set TG3_BDINFO_NIC_ADDR to NIC_SRAM_TX_BUFFER_DESC.
- + * c) Set len field of TG3_BDINFO_MAXLEN_FLAGS to number
- + * of TX descriptors. Leave flags field clear.
- + * 4) Access TX descriptors via host memory. The chip
- + * will refetch into local SRAM as needed when producer
- + * index mailboxes are updated.
- + *
- + * To use on-chip TX descriptors:
- + * 1) Set GRC_MODE_4X_NIC_SEND_RINGS in GRC_MODE register.
- + * Make sure GRC_MODE_HOST_SENDBDS is clear.
- + * 2) In NIC_SRAM_SEND_RCB (of desired index) of on-chip SRAM:
- + * a) Set TG3_BDINFO_HOST_ADDR to zero.
- + * b) Set TG3_BDINFO_NIC_ADDR to NIC_SRAM_TX_BUFFER_DESC
- + * c) TG3_BDINFO_MAXLEN_FLAGS is don't care.
- + * 3) Access TX descriptors directly in on-chip SRAM
- + * using normal {read,write}l(). (and not using
- + * pointer dereferencing of ioremap()'d memory like
- + * the broken Broadcom driver does)
- + *
- + * Note that BDINFO_FLAGS_DISABLED should be set in the flags field of
- + * TG3_BDINFO_MAXLEN_FLAGS of all unused SEND_RCB indices.
- + */
- +struct tg3_tx_buffer_desc {
- + uint32_t addr_hi;
- + uint32_t addr_lo;
- +
- + uint32_t len_flags;
- +#define TXD_FLAG_TCPUDP_CSUM 0x0001
- +#define TXD_FLAG_IP_CSUM 0x0002
- +#define TXD_FLAG_END 0x0004
- +#define TXD_FLAG_IP_FRAG 0x0008
- +#define TXD_FLAG_IP_FRAG_END 0x0010
- +#define TXD_FLAG_VLAN 0x0040
- +#define TXD_FLAG_COAL_NOW 0x0080
- +#define TXD_FLAG_CPU_PRE_DMA 0x0100
- +#define TXD_FLAG_CPU_POST_DMA 0x0200
- +#define TXD_FLAG_ADD_SRC_ADDR 0x1000
- +#define TXD_FLAG_CHOOSE_SRC_ADDR 0x6000
- +#define TXD_FLAG_NO_CRC 0x8000
- +#define TXD_LEN_SHIFT 16
- +
- + uint32_t vlan_tag;
- +#define TXD_VLAN_TAG_SHIFT 0
- +#define TXD_MSS_SHIFT 16
- +};
- +
- +#define TXD_ADDR 0x00UL /* 64-bit */
- +#define TXD_LEN_FLAGS 0x08UL /* 32-bit (upper 16-bits are len) */
- +#define TXD_VLAN_TAG 0x0cUL /* 32-bit (upper 16-bits are tag) */
- +#define TXD_SIZE 0x10UL
- +
- +struct tg3_rx_buffer_desc {
- + uint32_t addr_hi;
- + uint32_t addr_lo;
- +
- + uint32_t idx_len;
- +#define RXD_IDX_MASK 0xffff0000
- +#define RXD_IDX_SHIFT 16
- +#define RXD_LEN_MASK 0x0000ffff
- +#define RXD_LEN_SHIFT 0
- +
- + uint32_t type_flags;
- +#define RXD_TYPE_SHIFT 16
- +#define RXD_FLAGS_SHIFT 0
- +
- +#define RXD_FLAG_END 0x0004
- +#define RXD_FLAG_MINI 0x0800
- +#define RXD_FLAG_JUMBO 0x0020
- +#define RXD_FLAG_VLAN 0x0040
- +#define RXD_FLAG_ERROR 0x0400
- +#define RXD_FLAG_IP_CSUM 0x1000
- +#define RXD_FLAG_TCPUDP_CSUM 0x2000
- +#define RXD_FLAG_IS_TCP 0x4000
- +
- + uint32_t ip_tcp_csum;
- +#define RXD_IPCSUM_MASK 0xffff0000
- +#define RXD_IPCSUM_SHIFT 16
- +#define RXD_TCPCSUM_MASK 0x0000ffff
- +#define RXD_TCPCSUM_SHIFT 0
- +
- + uint32_t err_vlan;
- +
- +#define RXD_VLAN_MASK 0x0000ffff
- +
- +#define RXD_ERR_BAD_CRC 0x00010000
- +#define RXD_ERR_COLLISION 0x00020000
- +#define RXD_ERR_LINK_LOST 0x00040000
- +#define RXD_ERR_PHY_DECODE 0x00080000
- +#define RXD_ERR_ODD_NIBBLE_RCVD_MII 0x00100000
- +#define RXD_ERR_MAC_ABRT 0x00200000
- +#define RXD_ERR_TOO_SMALL 0x00400000
- +#define RXD_ERR_NO_RESOURCES 0x00800000
- +#define RXD_ERR_HUGE_FRAME 0x01000000
- +#define RXD_ERR_MASK 0xffff0000
- +
- + uint32_t reserved;
- + uint32_t opaque;
- +#define RXD_OPAQUE_INDEX_MASK 0x0000ffff
- +#define RXD_OPAQUE_INDEX_SHIFT 0
- +#define RXD_OPAQUE_RING_STD 0x00010000
- +#define RXD_OPAQUE_RING_JUMBO 0x00020000
- +#define RXD_OPAQUE_RING_MINI 0x00040000
- +#define RXD_OPAQUE_RING_MASK 0x00070000
- +};
- +
- +struct tg3_ext_rx_buffer_desc {
- + struct {
- + uint32_t addr_hi;
- + uint32_t addr_lo;
- + } addrlist[3];
- + uint32_t len2_len1;
- + uint32_t resv_len3;
- + struct tg3_rx_buffer_desc std;
- +};
- +
- +/* We only use this when testing out the DMA engine
- + * at probe time. This is the internal format of buffer
- + * descriptors used by the chip at NIC_SRAM_DMA_DESCS.
- + */
- +struct tg3_internal_buffer_desc {
- + uint32_t addr_hi;
- + uint32_t addr_lo;
- + uint32_t nic_mbuf;
- + /* XXX FIX THIS */
- +#if __BYTE_ORDER == __BIG_ENDIAN
- + uint16_t cqid_sqid;
- + uint16_t len;
- +#else
- + uint16_t len;
- + uint16_t cqid_sqid;
- +#endif
- + uint32_t flags;
- + uint32_t __cookie1;
- + uint32_t __cookie2;
- + uint32_t __cookie3;
- +};
- +
- +#define TG3_HW_STATUS_SIZE 0x50
- +struct tg3_hw_status {
- + uint32_t status;
- +#define SD_STATUS_UPDATED 0x00000001
- +#define SD_STATUS_LINK_CHG 0x00000002
- +#define SD_STATUS_ERROR 0x00000004
- +
- + uint32_t status_tag;
- +
- +#if __BYTE_ORDER == __BIG_ENDIAN
- + uint16_t rx_consumer;
- + uint16_t rx_jumbo_consumer;
- +#else
- + uint16_t rx_jumbo_consumer;
- + uint16_t rx_consumer;
- +#endif
- +
- +#if __BYTE_ORDER == __BIG_ENDIAN
- + uint16_t reserved;
- + uint16_t rx_mini_consumer;
- +#else
- + uint16_t rx_mini_consumer;
- + uint16_t reserved;
- +#endif
- + struct {
- +#if __BYTE_ORDER == __BIG_ENDIAN
- + uint16_t tx_consumer;
- + uint16_t rx_producer;
- +#else
- + uint16_t rx_producer;
- + uint16_t tx_consumer;
- +#endif
- + } idx[16];
- +};
- +
- +typedef struct {
- + uint32_t high, low;
- +} tg3_stat64_t;
- +
- +struct tg3_hw_stats {
- + uint8_t __reserved0[0x400-0x300];
- +
- + /* Statistics maintained by Receive MAC. */
- + tg3_stat64_t rx_octets;
- + uint64_t __reserved1;
- + tg3_stat64_t rx_fragments;
- + tg3_stat64_t rx_ucast_packets;
- + tg3_stat64_t rx_mcast_packets;
- + tg3_stat64_t rx_bcast_packets;
- + tg3_stat64_t rx_fcs_errors;
- + tg3_stat64_t rx_align_errors;
- + tg3_stat64_t rx_xon_pause_rcvd;
- + tg3_stat64_t rx_xoff_pause_rcvd;
- + tg3_stat64_t rx_mac_ctrl_rcvd;
- + tg3_stat64_t rx_xoff_entered;
- + tg3_stat64_t rx_frame_too_long_errors;
- + tg3_stat64_t rx_jabbers;
- + tg3_stat64_t rx_undersize_packets;
- + tg3_stat64_t rx_in_length_errors;
- + tg3_stat64_t rx_out_length_errors;
- + tg3_stat64_t rx_64_or_less_octet_packets;
- + tg3_stat64_t rx_65_to_127_octet_packets;
- + tg3_stat64_t rx_128_to_255_octet_packets;
- + tg3_stat64_t rx_256_to_511_octet_packets;
- + tg3_stat64_t rx_512_to_1023_octet_packets;
- + tg3_stat64_t rx_1024_to_1522_octet_packets;
- + tg3_stat64_t rx_1523_to_2047_octet_packets;
- + tg3_stat64_t rx_2048_to_4095_octet_packets;
- + tg3_stat64_t rx_4096_to_8191_octet_packets;
- + tg3_stat64_t rx_8192_to_9022_octet_packets;
- +
- + uint64_t __unused0[37];
- +
- + /* Statistics maintained by Transmit MAC. */
- + tg3_stat64_t tx_octets;
- + uint64_t __reserved2;
- + tg3_stat64_t tx_collisions;
- + tg3_stat64_t tx_xon_sent;
- + tg3_stat64_t tx_xoff_sent;
- + tg3_stat64_t tx_flow_control;
- + tg3_stat64_t tx_mac_errors;
- + tg3_stat64_t tx_single_collisions;
- + tg3_stat64_t tx_mult_collisions;
- + tg3_stat64_t tx_deferred;
- + uint64_t __reserved3;
- + tg3_stat64_t tx_excessive_collisions;
- + tg3_stat64_t tx_late_collisions;
- + tg3_stat64_t tx_collide_2times;
- + tg3_stat64_t tx_collide_3times;
- + tg3_stat64_t tx_collide_4times;
- + tg3_stat64_t tx_collide_5times;
- + tg3_stat64_t tx_collide_6times;
- + tg3_stat64_t tx_collide_7times;
- + tg3_stat64_t tx_collide_8times;
- + tg3_stat64_t tx_collide_9times;
- + tg3_stat64_t tx_collide_10times;
- + tg3_stat64_t tx_collide_11times;
- + tg3_stat64_t tx_collide_12times;
- + tg3_stat64_t tx_collide_13times;
- + tg3_stat64_t tx_collide_14times;
- + tg3_stat64_t tx_collide_15times;
- + tg3_stat64_t tx_ucast_packets;
- + tg3_stat64_t tx_mcast_packets;
- + tg3_stat64_t tx_bcast_packets;
- + tg3_stat64_t tx_carrier_sense_errors;
- + tg3_stat64_t tx_discards;
- + tg3_stat64_t tx_errors;
- +
- + uint64_t __unused1[31];
- +
- + /* Statistics maintained by Receive List Placement. */
- + tg3_stat64_t COS_rx_packets[16];
- + tg3_stat64_t COS_rx_filter_dropped;
- + tg3_stat64_t dma_writeq_full;
- + tg3_stat64_t dma_write_prioq_full;
- + tg3_stat64_t rxbds_empty;
- + tg3_stat64_t rx_discards;
- + tg3_stat64_t rx_errors;
- + tg3_stat64_t rx_threshold_hit;
- +
- + uint64_t __unused2[9];
- +
- + /* Statistics maintained by Send Data Initiator. */
- + tg3_stat64_t COS_out_packets[16];
- + tg3_stat64_t dma_readq_full;
- + tg3_stat64_t dma_read_prioq_full;
- + tg3_stat64_t tx_comp_queue_full;
- +
- + /* Statistics maintained by Host Coalescing. */
- + tg3_stat64_t ring_set_send_prod_index;
- + tg3_stat64_t ring_status_update;
- + tg3_stat64_t nic_irqs;
- + tg3_stat64_t nic_avoided_irqs;
- + tg3_stat64_t nic_tx_threshold_hit;
- +
- + uint8_t __reserved4[0xb00-0x9c0];
- +};
- +
- +enum phy_led_mode {
- + led_mode_auto,
- + led_mode_three_link,
- + led_mode_link10
- +};
- +
- +#if 0
- +/* 'mapping' is superfluous as the chip does not write into
- + * the tx/rx post rings so we could just fetch it from there.
- + * But the cache behavior is better how we are doing it now.
- + */
- +struct ring_info {
- + struct sk_buff *skb;
- + DECLARE_PCI_UNMAP_ADDR(mapping)
- +};
- +
- +struct tx_ring_info {
- + struct sk_buff *skb;
- + DECLARE_PCI_UNMAP_ADDR(mapping)
- + uint32_t prev_vlan_tag;
- +};
- +#endif
- +
- +struct tg3_config_info {
- + uint32_t flags;
- +};
- +
- +struct tg3_link_config {
- + /* Describes what we're trying to get. */
- + uint32_t advertising;
- +#if 0
- + uint16_t speed;
- + uint8_t duplex;
- + uint8_t autoneg;
- +#define SPEED_INVALID 0xffff
- +#define DUPLEX_INVALID 0xff
- +#define AUTONEG_INVALID 0xff
- +#endif
- +
- + /* Describes what we actually have. */
- + uint8_t active_speed;
- + uint8_t active_duplex;
- +
- + /* When we go in and out of low power mode we need
- + * to swap with this state.
- + */
- +#if 0
- + int phy_is_low_power;
- + uint16_t orig_speed;
- + uint8_t orig_duplex;
- + uint8_t orig_autoneg;
- +#endif
- +};
- +
- +struct tg3_bufmgr_config {
- + uint32_t mbuf_read_dma_low_water;
- + uint32_t mbuf_mac_rx_low_water;
- + uint32_t mbuf_high_water;
- +
- + uint32_t mbuf_read_dma_low_water_jumbo;
- + uint32_t mbuf_mac_rx_low_water_jumbo;
- + uint32_t mbuf_high_water_jumbo;
- +
- + uint32_t dma_low_water;
- + uint32_t dma_high_water;
- +};
- +
- +struct tg3 {
- +#if 0
- + /* SMP locking strategy:
- + *
- + * lock: Held during all operations except TX packet
- + * processing.
- + *
- + * tx_lock: Held during tg3_start_xmit{,_4gbug} and tg3_tx
- + *
- + * If you want to shut up all asynchronous processing you must
- + * acquire both locks, 'lock' taken before 'tx_lock'. IRQs must
- + * be disabled to take 'lock' but only softirq disabling is
- + * necessary for acquisition of 'tx_lock'.
- + */
- + spinlock_t lock;
- + spinlock_t tx_lock;
- +#endif
- +
- + uint32_t tx_prod;
- +#if 0
- + uint32_t tx_cons;
- +#endif
- + uint32_t rx_rcb_ptr;
- + uint32_t rx_std_ptr;
- +#if 0
- + uint32_t rx_jumbo_ptr;
- + spinlock_t indirect_lock;
- +
- + struct net_device_stats net_stats;
- + struct net_device_stats net_stats_prev;
- +#endif
- + unsigned long phy_crc_errors;
- +
- +#if 0
- + uint32_t rx_offset;
- +#endif
- + uint32_t tg3_flags;
- +#if 0
- +#define TG3_FLAG_HOST_TXDS 0x00000001
- +#endif
- +#define TG3_FLAG_TXD_MBOX_HWBUG 0x00000002
- +#define TG3_FLAG_RX_CHECKSUMS 0x00000004
- +#define TG3_FLAG_USE_LINKCHG_REG 0x00000008
- +#define TG3_FLAG_USE_MI_INTERRUPT 0x00000010
- +#define TG3_FLAG_ENABLE_ASF 0x00000020
- +#define TG3_FLAG_5701_REG_WRITE_BUG 0x00000040
- +#define TG3_FLAG_POLL_SERDES 0x00000080
- +#define TG3_FLAG_MBOX_WRITE_REORDER 0x00000100
- +#define TG3_FLAG_PCIX_TARGET_HWBUG 0x00000200
- +#define TG3_FLAG_WOL_SPEED_100MB 0x00000400
- +#define TG3_FLAG_WOL_ENABLE 0x00000800
- +#define TG3_FLAG_EEPROM_WRITE_PROT 0x00001000
- +#define TG3_FLAG_NVRAM 0x00002000
- +#define TG3_FLAG_NVRAM_BUFFERED 0x00004000
- +#define TG3_FLAG_RX_PAUSE 0x00008000
- +#define TG3_FLAG_TX_PAUSE 0x00010000
- +#define TG3_FLAG_PCIX_MODE 0x00020000
- +#define TG3_FLAG_PCI_HIGH_SPEED 0x00040000
- +#define TG3_FLAG_PCI_32BIT 0x00080000
- +#define TG3_FLAG_NO_TX_PSEUDO_CSUM 0x00100000
- +#define TG3_FLAG_NO_RX_PSEUDO_CSUM 0x00200000
- +#define TG3_FLAG_SERDES_WOL_CAP 0x00400000
- +#define TG3_FLAG_JUMBO_ENABLE 0x00800000
- +#define TG3_FLAG_10_100_ONLY 0x01000000
- +#define TG3_FLAG_PAUSE_AUTONEG 0x02000000
- +#define TG3_FLAG_PAUSE_RX 0x04000000
- +#define TG3_FLAG_PAUSE_TX 0x08000000
- +#define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000
- +#define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000
- +#define TG3_FLAG_SPLIT_MODE 0x40000000
- +#define TG3_FLAG_INIT_COMPLETE 0x80000000
- +
- + uint32_t tg3_flags2;
- +#define TG3_FLG2_RESTART_TIMER 0x00000001
- +#define TG3_FLG2_SUN_5704 0x00000002
- +#define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004
- +#define TG3_FLG2_IS_5788 0x00000008
- +#define TG3_FLG2_MAX_RXPEND_64 0x00000010
- +#define TG3_FLG2_TSO_CAPABLE 0x00000020
- +
- +
- +
- + uint32_t split_mode_max_reqs;
- +#define SPLIT_MODE_5704_MAX_REQ 3
- +
- +#if 0
- + struct timer_list timer;
- + uint16_t timer_counter;
- + uint16_t timer_multiplier;
- + uint32_t timer_offset;
- + uint16_t asf_counter;
- + uint16_t asf_multiplier;
- +#endif
- +
- + struct tg3_link_config link_config;
- + struct tg3_bufmgr_config bufmgr_config;
- +
- +#if 0
- + uint32_t rx_pending;
- + uint32_t rx_jumbo_pending;
- + uint32_t tx_pending;
- +#endif
- +
- + /* cache h/w values, often passed straight to h/w */
- + uint32_t rx_mode;
- + uint32_t tx_mode;
- + uint32_t mac_mode;
- + uint32_t mi_mode;
- + uint32_t misc_host_ctrl;
- + uint32_t grc_mode;
- + uint32_t grc_local_ctrl;
- + uint32_t dma_rwctrl;
- +#if 0
- + uint32_t coalesce_mode;
- +#endif
- +
- + /* PCI block */
- + uint16_t pci_chip_rev_id;
- +#if 0
- + uint8_t pci_cacheline_sz;
- + uint8_t pci_lat_timer;
- + uint8_t pci_hdr_type;
- + uint8_t pci_bist;
- +#endif
- + uint32_t pci_cfg_state[64 / sizeof(uint32_t)];
- +
- + int pm_cap;
- +
- + /* PHY info */
- + uint32_t phy_id;
- +#define PHY_ID_MASK 0xfffffff0
- +#define PHY_ID_BCM5400 0x60008040
- +#define PHY_ID_BCM5401 0x60008050
- +#define PHY_ID_BCM5411 0x60008070
- +#define PHY_ID_BCM5701 0x60008110
- +#define PHY_ID_BCM5703 0x60008160
- +#define PHY_ID_BCM5704 0x60008190
- +#define PHY_ID_BCM5705 0x600081a0
- +#define PHY_ID_BCM8002 0x60010140
- +#define PHY_ID_SERDES 0xfeedbee0
- +#define PHY_ID_INVALID 0xffffffff
- +#define PHY_ID_REV_MASK 0x0000000f
- +#define PHY_REV_BCM5401_B0 0x1
- +#define PHY_REV_BCM5401_B2 0x3
- +#define PHY_REV_BCM5401_C0 0x6
- +#define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */
- +
- + enum phy_led_mode led_mode;
- +
- + char board_part_number[24];
- + uint32_t nic_sram_data_cfg;
- + uint32_t pci_clock_ctrl;
- +#if 0
- + struct pci_device *pdev_peer;
- +#endif
- +
- + /* This macro assumes the passed PHY ID is already masked
- + * with PHY_ID_MASK.
- + */
- +#define KNOWN_PHY_ID(X) \
- + ((X) == PHY_ID_BCM5400 || (X) == PHY_ID_BCM5401 || \
- + (X) == PHY_ID_BCM5411 || (X) == PHY_ID_BCM5701 || \
- + (X) == PHY_ID_BCM5703 || (X) == PHY_ID_BCM5704 || \
- + (X) == PHY_ID_BCM5705 || \
- + (X) == PHY_ID_BCM8002 || (X) == PHY_ID_SERDES)
- +
- + unsigned long regs;
- + struct pci_device *pdev;
- + struct nic *nic;
- +#if 0
- + struct net_device *dev;
- +#endif
- +#if TG3_VLAN_TAG_USED
- + struct vlan_group *vlgrp;
- +#endif
- +
- + struct tg3_rx_buffer_desc *rx_std;
- +#if 0
- + struct ring_info *rx_std_buffers;
- + dma_addr_t rx_std_mapping;
- + struct tg3_rx_buffer_desc *rx_jumbo;
- + struct ring_info *rx_jumbo_buffers;
- + dma_addr_t rx_jumbo_mapping;
- +#endif
- +
- + struct tg3_rx_buffer_desc *rx_rcb;
- +#if 0
- + dma_addr_t rx_rcb_mapping;
- +#endif
- +
- + /* TX descs are only used if TG3_FLAG_HOST_TXDS is set. */
- + struct tg3_tx_buffer_desc *tx_ring;
- +#if 0
- + struct tx_ring_info *tx_buffers;
- + dma_addr_t tx_desc_mapping;
- +#endif
- +
- + struct tg3_hw_status *hw_status;
- +#if 0
- + dma_addr_t status_mapping;
- +#endif
- +#if 0
- + uint32_t msg_enable;
- +#endif
- +
- + struct tg3_hw_stats *hw_stats;
- +#if 0
- + dma_addr_t stats_mapping;
- +#endif
- +
- + int carrier_ok;
- + uint16_t subsystem_vendor;
- + uint16_t subsystem_device;
- +};
- +
- +#endif /* !(_T3_H) */
- diff -Naur grub-0.97.orig/netboot/tiara.c grub-0.97/netboot/tiara.c
- --- grub-0.97.orig/netboot/tiara.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/tiara.c 1970-01-01 00:00:00.000000000 +0000
- @@ -1,255 +0,0 @@
- -/**************************************************************************
- -Etherboot - BOOTP/TFTP Bootstrap Program
- -
- -TIARA (Fujitsu Etherstar) NIC driver for Etherboot
- -Copyright (c) Ken Yap 1998
- -
- -Information gleaned from:
- -
- -TIARA.ASM Packet driver by Brian Fisher, Queens U, Kingston, Ontario
- -Fujitsu MB86960 spec sheet (different chip but same family)
- -***************************************************************************/
- -
- -/*
- - * This program is free software; you can redistribute it and/or
- - * modify it under the terms of the GNU General Public License as
- - * published by the Free Software Foundation; either version 2, or (at
- - * your option) any later version.
- - */
- -
- -/* to get some global routines like printf */
- -#include "etherboot.h"
- -/* to get the interface to the body of the program */
- -#include "nic.h"
- -#include "cards.h"
- -
- -/*
- - EtherStar I/O Register offsets
- -*/
- -
- -/* Offsets of registers */
- -#define DLCR_XMIT_STAT 0x00
- -#define DLCR_XMIT_MASK 0x01
- -#define DLCR_RECV_STAT 0x02
- -#define DLCR_RECV_MASK 0x03
- -#define DLCR_XMIT_MODE 0x04
- -#define DLCR_RECV_MODE 0x05
- -#define DLCR_ENABLE 0x06
- -#define DLCR_TDR_LOW 0x07
- -#define DLCR_NODE_ID 0x08
- -#define DLCR_TDR_HIGH 0x0F
- -#define BMPR_MEM_PORT 0x10
- -#define BMPR_PKT_LEN 0x12
- -#define BMPR_DMA_ENABLE 0x14
- -#define PROM_ID 0x18
- -
- -#define TMST 0x80
- -#define TMT_OK 0x80
- -#define TMT_16COLL 0x02
- -#define BUF_EMPTY 0x40
- -
- -#define CARD_DISABLE 0x80 /* written to DLCR_ENABLE to disable card */
- -#define CARD_ENABLE 0 /* written to DLCR_ENABLE to enable card */
- -
- -#define CLEAR_STATUS 0x0F /* used to clear status info */
- -/*
- - 00001111B
- - !!!!!!!!--------
- - !!!!!!!+--------CLEAR BUS WRITE ERROR
- - !!!!!!+---------CLEAR 16 COLLISION
- - !!!!!+----------CLEAR COLLISION
- - !!!!+-----------CLEAR UNDERFLOW
- - !!!+------------NC
- - !!+-------------NC
- - !+--------------NC
- - +---------------NC
- -*/
- -
- -#define NO_TX_IRQS 0 /* written to clear transmit IRQs */
- -
- -#define CLR_RCV_STATUS 0xCF /* clears receive status */
- -
- -#define EN_RCV_IRQS 0x80 /* enable receive interrupts */
- -/*
- - 10000000B
- - !!!!!!!!--------
- - !!!!!!!+--------ENABLE OVERFLOW
- - !!!!!!+---------ENABLE CRC
- - !!!!!+----------ENABLE ALIGN
- - !!!!+-----------ENABLE SHORT PKT
- - !!!+------------DISABLE REMOTE RESET
- - !!+-------------RESERVED
- - !+--------------RESERVED
- - +---------------ENABLE PKT READY
- -*/
- -
- -#define XMIT_MODE 0x02
- -/*
- - 00000010B
- - !!!!!!!!---------ENABLE CARRIER DETECT
- - !!!!!!!+---------DISABLE LOOPBACK
- -*/
- -
- -#define RECV_MODE 0x02
- -/*
- - 00000010B
- - !!!!!!!!---------ACCEPT ALL PACKETS
- - !!!!!!!+---------ACCEPT PHYSICAL, MULTICAST, AND
- - !!!!!!+----------BROADCAST PACKETS
- - !!!!!+-----------DISABLE REMOTE RESET
- - !!!!+------------DISABLE SHORT PACKETS
- - !!!+-------------USE 6 BYTE ADDRESS
- - !!+--------------NC
- - !+---------------NC
- - +----------------DISABLE CRC TEST MODE
- -*/
- -
- -/* NIC specific static variables go here */
- -
- -static unsigned short ioaddr;
- -
- -/**************************************************************************
- -RESET - Reset adapter
- -***************************************************************************/
- -static void tiara_reset(struct nic *nic)
- -{
- - int i;
- -
- - outb(CARD_DISABLE, ioaddr + DLCR_ENABLE);
- - outb(CLEAR_STATUS, ioaddr + DLCR_XMIT_STAT);
- - outb(NO_TX_IRQS, ioaddr + DLCR_XMIT_MASK);
- - outb(CLR_RCV_STATUS, ioaddr + DLCR_RECV_STAT);
- - outb(XMIT_MODE, ioaddr + DLCR_XMIT_MODE);
- - outb(RECV_MODE, ioaddr + DLCR_RECV_MODE);
- - /* Vacuum recv buffer */
- - while ((inb(ioaddr + DLCR_RECV_MODE) & BUF_EMPTY) == 0)
- - inb(ioaddr + BMPR_MEM_PORT);
- - /* Set node address */
- - for (i = 0; i < ETH_ALEN; ++i)
- - outb(nic->node_addr[i], ioaddr + DLCR_NODE_ID + i);
- - outb(CLR_RCV_STATUS, ioaddr + DLCR_RECV_STAT);
- - outb(CARD_ENABLE, ioaddr + DLCR_ENABLE);
- -}
- -
- -/**************************************************************************
- -POLL - Wait for a frame
- -***************************************************************************/
- -static int tiara_poll(struct nic *nic)
- -{
- - unsigned int len;
- -
- - if (inb(ioaddr + DLCR_RECV_MODE) & BUF_EMPTY)
- - return (0);
- - /* Ack packet */
- - outw(CLR_RCV_STATUS, ioaddr + DLCR_RECV_STAT);
- - len = inw(ioaddr + BMPR_MEM_PORT); /* throw away status */
- - len = inw(ioaddr + BMPR_MEM_PORT);
- - /* Drop overlength packets */
- - if (len > ETH_FRAME_LEN)
- - return (0); /* should we drain the buffer? */
- - insw(ioaddr + BMPR_MEM_PORT, nic->packet, len / 2);
- - /* If it's our own, drop it */
- - if (memcmp(nic->packet + ETH_ALEN, nic->node_addr, ETH_ALEN) == 0)
- - return (0);
- - nic->packetlen = len;
- - return (1);
- -}
- -
- -/**************************************************************************
- -TRANSMIT - Transmit a frame
- -***************************************************************************/
- -static void tiara_transmit(
- -struct nic *nic,
- -const char *d, /* Destination */
- -unsigned int t, /* Type */
- -unsigned int s, /* size */
- -const char *p) /* Packet */
- -{
- - unsigned int len;
- - unsigned long time;
- -
- - len = s + ETH_HLEN;
- - if (len < ETH_ZLEN)
- - len = ETH_ZLEN;
- - t = htons(t);
- - outsw(ioaddr + BMPR_MEM_PORT, d, ETH_ALEN / 2);
- - outsw(ioaddr + BMPR_MEM_PORT, nic->node_addr, ETH_ALEN / 2);
- - outw(t, ioaddr + BMPR_MEM_PORT);
- - outsw(ioaddr + BMPR_MEM_PORT, p, s / 2);
- - if (s & 1) /* last byte */
- - outb(p[s-1], ioaddr + BMPR_MEM_PORT);
- - while (s++ < ETH_ZLEN - ETH_HLEN) /* pad */
- - outb(0, ioaddr + BMPR_MEM_PORT);
- - outw(len | (TMST << 8), ioaddr + BMPR_PKT_LEN);
- - /* wait for transmit complete */
- - time = currticks() + TICKS_PER_SEC; /* wait one second */
- - while (currticks() < time && (inb(ioaddr) & (TMT_OK|TMT_16COLL)) == 0)
- - ;
- - if ((inb(ioaddr) & (TMT_OK|TMT_16COLL)) == 0)
- - printf("Tiara timed out on transmit\n");
- - /* Do we need to ack the transmit? */
- -}
- -
- -/**************************************************************************
- -DISABLE - Turn off ethernet interface
- -***************************************************************************/
- -static void tiara_disable(struct nic *nic)
- -{
- - /* Apparently only a power down can do this properly */
- - outb(CARD_DISABLE, ioaddr + DLCR_ENABLE);
- -}
- -
- -static int tiara_probe1(struct nic *nic)
- -{
- - /* Hope all the Tiara cards have this vendor prefix */
- - static char vendor_prefix[] = { 0x08, 0x00, 0x1A };
- - static char all_ones[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
- - int i;
- -
- - for (i = 0; i < ETH_ALEN; ++i)
- - nic->node_addr[i] = inb(ioaddr + PROM_ID + i);
- - if (memcmp(nic->node_addr, vendor_prefix, sizeof(vendor_prefix)) != 0)
- - return (0);
- - if (memcmp(nic->node_addr, all_ones, sizeof(all_ones)) == 0)
- - return (0);
- - printf("\nTiara ioaddr %#hX, addr %!\n", ioaddr, nic->node_addr);
- - return (1);
- -}
- -
- -/**************************************************************************
- -PROBE - Look for an adapter, this routine's visible to the outside
- -***************************************************************************/
- -struct nic *tiara_probe(struct nic *nic, unsigned short *probe_addrs)
- -{
- - /* missing entries are addresses usually already used */
- - static unsigned short io_addrs[] = {
- - 0x100, 0x120, 0x140, 0x160,
- - 0x180, 0x1A0, 0x1C0, 0x1E0,
- - 0x200, 0x220, 0x240, /*Par*/
- - 0x280, 0x2A0, 0x2C0, /*Ser*/
- - 0x300, 0x320, 0x340, /*Par*/
- - 0x380, /*Vid,Par*/ 0x3C0, /*Ser*/
- - 0x0
- - };
- - unsigned short *p;
- -
- - /* if probe_addrs is 0, then routine can use a hardwired default */
- - if (probe_addrs == 0)
- - probe_addrs = io_addrs;
- - for (p = probe_addrs; (ioaddr = *p) != 0; ++p)
- - if (tiara_probe1(nic))
- - break;
- - /* if board found */
- - if (ioaddr != 0)
- - {
- - tiara_reset(nic);
- - /* point to NIC specific routines */
- - nic->reset = tiara_reset;
- - nic->poll = tiara_poll;
- - nic->transmit = tiara_transmit;
- - nic->disable = tiara_disable;
- - return nic;
- - }
- - else
- - return (0);
- -}
- diff -Naur grub-0.97.orig/netboot/timer.c grub-0.97/netboot/timer.c
- --- grub-0.97.orig/netboot/timer.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/timer.c 2005-08-31 19:03:35.000000000 +0000
- @@ -6,122 +6,24 @@
- * published by the Free Software Foundation; either version 2, or (at
- * your option) any later version.
- */
- -
- -#include "etherboot.h"
- +#include "grub.h"
- #include "timer.h"
-
- -void load_timer2(unsigned int ticks)
- -{
- - /* Set up the timer gate, turn off the speaker */
- - outb((inb(PPC_PORTB) & ~PPCB_SPKR) | PPCB_T2GATE, PPC_PORTB);
- - outb(TIMER2_SEL|WORD_ACCESS|MODE0|BINARY_COUNT, TIMER_MODE_PORT);
- - outb(ticks & 0xFF, TIMER2_PORT);
- - outb(ticks >> 8, TIMER2_PORT);
- -}
- -
- -#if defined(CONFIG_TSC_CURRTICKS)
- -#define rdtsc(low,high) \
- - __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
- -
- -#define rdtscll(val) \
- - __asm__ __volatile__ ("rdtsc" : "=A" (val))
- -
- -
- -#define HZ TICKS_PER_SEC
- -#define CLOCK_TICK_RATE 1193180U /* Underlying HZ */
- -/* LATCH is used in the interval timer and ftape setup. */
- -#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */
- +/* Machine Independant timer helper functions */
-
- -
- -/* ------ Calibrate the TSC -------
- - * Return 2^32 * (1 / (TSC clocks per usec)) for do_fast_gettimeoffset().
- - * Too much 64-bit arithmetic here to do this cleanly in C, and for
- - * accuracy's sake we want to keep the overhead on the CTC speaker (channel 2)
- - * output busy loop as low as possible. We avoid reading the CTC registers
- - * directly because of the awkward 8-bit access mechanism of the 82C54
- - * device.
- - */
- -
- -#define CALIBRATE_LATCH (5 * LATCH)
- -
- -static unsigned long long calibrate_tsc(void)
- +void mdelay(unsigned int msecs)
- {
- - /* Set the Gate high, disable speaker */
- - outb((inb(0x61) & ~0x02) | 0x01, 0x61);
- -
- - /*
- - * Now let's take care of CTC channel 2
- - *
- - * Set the Gate high, program CTC channel 2 for mode 0,
- - * (interrupt on terminal count mode), binary count,
- - * load 5 * LATCH count, (LSB and MSB) to begin countdown.
- - */
- - outb(0xb0, 0x43); /* binary, mode 0, LSB/MSB, Ch 2 */
- - outb(CALIBRATE_LATCH & 0xff, 0x42); /* LSB of count */
- - outb(CALIBRATE_LATCH >> 8, 0x42); /* MSB of count */
- -
- - {
- - unsigned long startlow, starthigh;
- - unsigned long endlow, endhigh;
- - unsigned long count;
- -
- - rdtsc(startlow,starthigh);
- - count = 0;
- - do {
- - count++;
- - } while ((inb(0x61) & 0x20) == 0);
- - rdtsc(endlow,endhigh);
- -
- - /* Error: ECTCNEVERSET */
- - if (count <= 1)
- - goto bad_ctc;
- -
- - /* 64-bit subtract - gcc just messes up with long longs */
- - __asm__("subl %2,%0\n\t"
- - "sbbl %3,%1"
- - :"=a" (endlow), "=d" (endhigh)
- - :"g" (startlow), "g" (starthigh),
- - "0" (endlow), "1" (endhigh));
- -
- - /* Error: ECPUTOOFAST */
- - if (endhigh)
- - goto bad_ctc;
- -
- - endlow /= 5;
- - return endlow;
- + unsigned int i;
- + for(i = 0; i < msecs; i++) {
- + udelay(1000);
- + poll_interruptions();
- }
- -
- - /*
- - * The CTC wasn't reliable: we got a hit on the very first read,
- - * or the CPU was so fast/slow that the quotient wouldn't fit in
- - * 32 bits..
- - */
- -bad_ctc:
- - printf("bad_ctc\n");
- - return 0;
- }
-
- -
- -unsigned long currticks(void)
- +void waiton_timer2(unsigned int ticks)
- {
- - static unsigned long clocks_per_tick;
- - unsigned long clocks_high, clocks_low;
- - unsigned long currticks;
- - if (!clocks_per_tick) {
- - clocks_per_tick = calibrate_tsc();
- - printf("clocks_per_tick = %d\n", clocks_per_tick);
- + load_timer2(ticks);
- + while(timer2_running()) {
- + poll_interruptions();
- }
- -
- - /* Read the Time Stamp Counter */
- - rdtsc(clocks_low, clocks_high);
- -
- - /* currticks = clocks / clocks_per_tick; */
- - __asm__("divl %1"
- - :"=a" (currticks)
- - :"r" (clocks_per_tick), "0" (clocks_low), "d" (clocks_high));
- -
- -
- - return currticks;
- }
- -
- -#endif /* RTC_CURRTICKS */
- diff -Naur grub-0.97.orig/netboot/timer.h grub-0.97/netboot/timer.h
- --- grub-0.97.orig/netboot/timer.h 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/timer.h 2005-08-31 19:03:35.000000000 +0000
- @@ -36,7 +36,8 @@
- #define BCD_COUNT 0x01
-
- /* Timers tick over at this rate */
- -#define TICKS_PER_MS 1193
- +#define CLOCK_TICK_RATE 1193180U
- +#define TICKS_PER_MS (CLOCK_TICK_RATE/1000)
-
- /* Parallel Peripheral Controller Port B */
- #define PPC_PORTB 0x61
- @@ -49,16 +50,19 @@
- /* Ticks must be between 0 and 65535 (0 == 65536)
- because it is a 16 bit counter */
- extern void load_timer2(unsigned int ticks);
- -extern inline int timer2_running(void)
- -{
- - return ((inb(PPC_PORTB) & PPCB_T2OUT) == 0);
- -}
- -
- -extern inline void waiton_timer2(unsigned int ticks)
- -{
- - load_timer2(ticks);
- - while ((inb(PPC_PORTB) & PPCB_T2OUT) == 0)
- - ;
- -}
- +extern inline int timer2_running(void);
- +extern void waiton_timer2(unsigned int ticks);
- +extern void __load_timer2(unsigned int ticks);
- +
- +extern void setup_timers(void);
- +extern void ndelay(unsigned int nsecs);
- +extern void udelay(unsigned int usecs);
- +extern void mdelay(unsigned int msecs);
- +//extern unsigned long currticks(void);
- +
- +struct timeval {
- + long tv_sec;
- + long tv_usec;
- +};
-
- #endif /* TIMER_H */
- diff -Naur grub-0.97.orig/netboot/tlan.c grub-0.97/netboot/tlan.c
- --- grub-0.97.orig/netboot/tlan.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/tlan.c 2005-09-01 00:05:20.000000000 +0000
- @@ -1,3746 +1,1814 @@
- +#define EB51
- +
- +#ifdef EB50
- +#define __unused __attribute__((unused))
- +#endif
- +
- /**************************************************************************
- -Etherboot - BOOTP/TFTP Bootstrap Program
- -TLAN driver for Etherboot
- +*
- +* tlan.c -- Etherboot device driver for the Texas Instruments ThunderLAN
- +* Written 2003-2003 by Timothy Legge <tlegge@rogers.com>
- +*
- +* This program is free software; you can redistribute it and/or modify
- +* it under the terms of the GNU General Public License as published by
- +* the Free Software Foundation; either version 2 of the License, or
- +* (at your option) any later version.
- +*
- +* This program is distributed in the hope that it will be useful,
- +* but WITHOUT ANY WARRANTY; without even the implied warranty of
- +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +* GNU General Public License for more details.
- +*
- +* You should have received a copy of the GNU General Public License
- +* along with this program; if not, write to the Free Software
- +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- +*
- +* Portions of this code based on:
- +* lan.c: Linux ThunderLan Driver:
- +*
- +* by James Banks
- +*
- +* (C) 1997-1998 Caldera, Inc.
- +* (C) 1998 James Banks
- +* (C) 1999-2001 Torben Mathiasen
- +* (C) 2002 Samuel Chessman
- +*
- +* REVISION HISTORY:
- +* ================
- +* v1.0 07-08-2003 timlegge Initial not quite working version
- +* v1.1 07-27-2003 timlegge Sync 5.0 and 5.1 versions
- +* v1.2 08-19-2003 timlegge Implement Multicast Support
- +* v1.3 08-23-2003 timlegge Fix the transmit Function
- +* v1.4 01-17-2004 timlegge Initial driver output cleanup
- +*
- +* Indent Options: indent -kr -i8
- ***************************************************************************/
-
- -/*
- - * This program is free software; you can redistribute it and/or
- - * modify it under the terms of the GNU General Public License as
- - * published by the Free Software Foundation; either version 2, or (at
- - * your option) any later version.
- - */
- -
- /* to get some global routines like printf */
- #include "etherboot.h"
- /* to get the interface to the body of the program */
- #include "nic.h"
- /* to get the PCI support functions, if this is a PCI NIC */
- #include "pci.h"
- -/* to get our own prototype */
- -#include "cards.h"
- -
- - /*****************************************************************
- - * TLan Definitions
- - *
- - ****************************************************************/
- +#include "timer.h"
- +#include "tlan.h"
-
- -#define TLAN_MIN_FRAME_SIZE 64
- -#define TLAN_MAX_FRAME_SIZE 1600
- +#define drv_version "v1.4"
- +#define drv_date "01-17-2004"
-
- -#define TLAN_NUM_RX_LISTS 32
- -#define TLAN_NUM_TX_LISTS 64
- +/* NIC specific static variables go here */
- +#define HZ 100
- +#define TX_TIME_OUT (6*HZ)
-
- -#define TLAN_IGNORE 0
- -#define TLAN_RECORD 1
- +#ifdef EB50
- +#define cpu_to_le32(val) (val)
- +#define le32_to_cpu(val) (val)
- +#define virt_to_bus(x) ((unsigned long) x)
- +#define bus_to_virt(x) ((unsigned long) x)
- +#endif
-
- -#define TLAN_DBG(lvl, format, args...) if (debug&lvl) printf("TLAN: " format, ##args );
- -#define TLAN_DEBUG_GNRL 0x0001
- -#define TLAN_DEBUG_TX 0x0002
- -#define TLAN_DEBUG_RX 0x0004
- -#define TLAN_DEBUG_LIST 0x0008
- -#define TLAN_DEBUG_PROBE 0x0010
- +/* Condensed operations for readability. */
- +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
- +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
-
- -#define MAX_TLAN_BOARDS 8 /* Max number of boards installed at a time */
-
- - /*****************************************************************
- - * Device Identification Definitions
- - *
- - ****************************************************************/
- -
- -#define PCI_DEVICE_ID_NETELLIGENT_10_T2 0xB012
- -#define PCI_DEVICE_ID_NETELLIGENT_10_100_WS_5100 0xB030
- -#ifndef PCI_DEVICE_ID_OLICOM_OC2183
- -#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013
- -#endif
- -#ifndef PCI_DEVICE_ID_OLICOM_OC2325
- -#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012
- -#endif
- -#ifndef PCI_DEVICE_ID_OLICOM_OC2326
- -#define PCI_DEVICE_ID_OLICOM_OC2326 0x0014
- -#endif
- -#define TLAN_ADAPTER_NONE 0x00000000
- -#define TLAN_ADAPTER_UNMANAGED_PHY 0x00000001
- -#define TLAN_ADAPTER_BIT_RATE_PHY 0x00000002
- -#define TLAN_ADAPTER_USE_INTERN_10 0x00000004
- -#define TLAN_ADAPTER_ACTIVITY_LED 0x00000008
- -#define TLAN_SPEED_DEFAULT 0
- -#define TLAN_SPEED_10 10
- -#define TLAN_SPEED_100 100
- -#define TLAN_DUPLEX_DEFAULT 0
- -#define TLAN_DUPLEX_HALF 1
- -#define TLAN_DUPLEX_FULL 2
- -#define TLAN_BUFFERS_PER_LIST 10
- -#define TLAN_LAST_BUFFER 0x80000000
- -#define TLAN_CSTAT_UNUSED 0x8000
- -#define TLAN_CSTAT_FRM_CMP 0x4000
- -#define TLAN_CSTAT_READY 0x3000
- -#define TLAN_CSTAT_EOC 0x0800
- -#define TLAN_CSTAT_RX_ERROR 0x0400
- -#define TLAN_CSTAT_PASS_CRC 0x0200
- -#define TLAN_CSTAT_DP_PR 0x0100
- -
- - /*****************************************************************
- - * PHY definitions
- - *
- - ****************************************************************/
- -
- -#define TLAN_PHY_MAX_ADDR 0x1F
- -#define TLAN_PHY_NONE 0x20
- -
- - /*****************************************************************
- - * TLan Driver Timer Definitions
- - *
- - ****************************************************************/
- -
- -#define TLAN_TIMER_LINK_BEAT 1
- -#define TLAN_TIMER_ACTIVITY 2
- -#define TLAN_TIMER_PHY_PDOWN 3
- -#define TLAN_TIMER_PHY_PUP 4
- -#define TLAN_TIMER_PHY_RESET 5
- -#define TLAN_TIMER_PHY_START_LINK 6
- -#define TLAN_TIMER_PHY_FINISH_AN 7
- -#define TLAN_TIMER_FINISH_RESET 8
- -#define TLAN_TIMER_ACT_DELAY (HZ/10)
- -
- - /*****************************************************************
- - * TLan Driver Eeprom Definitions
- - *
- - ****************************************************************/
- -
- -#define TLAN_EEPROM_ACK 0
- -#define TLAN_EEPROM_STOP 1
- -
- - /*****************************************************************
- - * Host Register Offsets and Contents
- - *
- - ****************************************************************/
- -
- -#define TLAN_HOST_CMD 0x00
- -#define TLAN_HC_GO 0x80000000
- -#define TLAN_HC_STOP 0x40000000
- -#define TLAN_HC_ACK 0x20000000
- -#define TLAN_HC_CS_MASK 0x1FE00000
- -#define TLAN_HC_EOC 0x00100000
- -#define TLAN_HC_RT 0x00080000
- -#define TLAN_HC_NES 0x00040000
- -#define TLAN_HC_AD_RST 0x00008000
- -#define TLAN_HC_LD_TMR 0x00004000
- -#define TLAN_HC_LD_THR 0x00002000
- -#define TLAN_HC_REQ_INT 0x00001000
- -#define TLAN_HC_INT_OFF 0x00000800
- -#define TLAN_HC_INT_ON 0x00000400
- -#define TLAN_HC_AC_MASK 0x000000FF
- -#define TLAN_CH_PARM 0x04
- -#define TLAN_DIO_ADR 0x08
- -#define TLAN_DA_ADR_INC 0x8000
- -#define TLAN_DA_RAM_ADR 0x4000
- -#define TLAN_HOST_INT 0x0A
- -#define TLAN_HI_IV_MASK 0x1FE0
- -#define TLAN_HI_IT_MASK 0x001C
- -#define TLAN_DIO_DATA 0x0C
- -
- -/* ThunderLAN Internal Register DIO Offsets */
- -
- -#define TLAN_NET_CMD 0x00
- -#define TLAN_NET_CMD_NRESET 0x80
- -#define TLAN_NET_CMD_NWRAP 0x40
- -#define TLAN_NET_CMD_CSF 0x20
- -#define TLAN_NET_CMD_CAF 0x10
- -#define TLAN_NET_CMD_NOBRX 0x08
- -#define TLAN_NET_CMD_DUPLEX 0x04
- -#define TLAN_NET_CMD_TRFRAM 0x02
- -#define TLAN_NET_CMD_TXPACE 0x01
- -#define TLAN_NET_SIO 0x01
- -#define TLAN_NET_SIO_MINTEN 0x80
- -#define TLAN_NET_SIO_ECLOK 0x40
- -#define TLAN_NET_SIO_ETXEN 0x20
- -#define TLAN_NET_SIO_EDATA 0x10
- -#define TLAN_NET_SIO_NMRST 0x08
- -#define TLAN_NET_SIO_MCLK 0x04
- -#define TLAN_NET_SIO_MTXEN 0x02
- -#define TLAN_NET_SIO_MDATA 0x01
- -#define TLAN_NET_STS 0x02
- -#define TLAN_NET_STS_MIRQ 0x80
- -#define TLAN_NET_STS_HBEAT 0x40
- -#define TLAN_NET_STS_TXSTOP 0x20
- -#define TLAN_NET_STS_RXSTOP 0x10
- -#define TLAN_NET_STS_RSRVD 0x0F
- -#define TLAN_NET_MASK 0x03
- -#define TLAN_NET_MASK_MASK7 0x80
- -#define TLAN_NET_MASK_MASK6 0x40
- -#define TLAN_NET_MASK_MASK5 0x20
- -#define TLAN_NET_MASK_MASK4 0x10
- -#define TLAN_NET_MASK_RSRVD 0x0F
- -#define TLAN_NET_CONFIG 0x04
- -#define TLAN_NET_CFG_RCLK 0x8000
- -#define TLAN_NET_CFG_TCLK 0x4000
- -#define TLAN_NET_CFG_BIT 0x2000
- -#define TLAN_NET_CFG_RXCRC 0x1000
- -#define TLAN_NET_CFG_PEF 0x0800
- -#define TLAN_NET_CFG_1FRAG 0x0400
- -#define TLAN_NET_CFG_1CHAN 0x0200
- -#define TLAN_NET_CFG_MTEST 0x0100
- -#define TLAN_NET_CFG_PHY_EN 0x0080
- -#define TLAN_NET_CFG_MSMASK 0x007F
- -#define TLAN_MAN_TEST 0x06
- -#define TLAN_DEF_VENDOR_ID 0x08
- -#define TLAN_DEF_DEVICE_ID 0x0A
- -#define TLAN_DEF_REVISION 0x0C
- -#define TLAN_DEF_SUBCLASS 0x0D
- -#define TLAN_DEF_MIN_LAT 0x0E
- -#define TLAN_DEF_MAX_LAT 0x0F
- -#define TLAN_AREG_0 0x10
- -#define TLAN_AREG_1 0x16
- -#define TLAN_AREG_2 0x1C
- -#define TLAN_AREG_3 0x22
- -#define TLAN_HASH_1 0x28
- -#define TLAN_HASH_2 0x2C
- -#define TLAN_GOOD_TX_FRMS 0x30
- -#define TLAN_TX_UNDERUNS 0x33
- -#define TLAN_GOOD_RX_FRMS 0x34
- -#define TLAN_RX_OVERRUNS 0x37
- -#define TLAN_DEFERRED_TX 0x38
- -#define TLAN_CRC_ERRORS 0x3A
- -#define TLAN_CODE_ERRORS 0x3B
- -#define TLAN_MULTICOL_FRMS 0x3C
- -#define TLAN_SINGLECOL_FRMS 0x3E
- -#define TLAN_EXCESSCOL_FRMS 0x40
- -#define TLAN_LATE_COLS 0x41
- -#define TLAN_CARRIER_LOSS 0x42
- -#define TLAN_ACOMMIT 0x43
- -#define TLAN_LED_REG 0x44
- -#define TLAN_LED_ACT 0x10
- -#define TLAN_LED_LINK 0x01
- -#define TLAN_BSIZE_REG 0x45
- -#define TLAN_MAX_RX 0x46
- -#define TLAN_INT_DIS 0x48
- -#define TLAN_ID_TX_EOC 0x04
- -#define TLAN_ID_RX_EOF 0x02
- -#define TLAN_ID_RX_EOC 0x01
- -
- -/* ThunderLAN Interrupt Codes */
- -
- -#define TLAN_INT_NUMBER_OF_INTS 8
- -
- -#define TLAN_INT_NONE 0x0000
- -#define TLAN_INT_TX_EOF 0x0001
- -#define TLAN_INT_STAT_OVERFLOW 0x0002
- -#define TLAN_INT_RX_EOF 0x0003
- -#define TLAN_INT_DUMMY 0x0004
- -#define TLAN_INT_TX_EOC 0x0005
- -#define TLAN_INT_STATUS_CHECK 0x0006
- -#define TLAN_INT_RX_EOC 0x0007
- -#define TLAN_TLPHY_ID 0x10
- -#define TLAN_TLPHY_CTL 0x11
- -#define TLAN_TC_IGLINK 0x8000
- -#define TLAN_TC_SWAPOL 0x4000
- -#define TLAN_TC_AUISEL 0x2000
- -#define TLAN_TC_SQEEN 0x1000
- -#define TLAN_TC_MTEST 0x0800
- -#define TLAN_TC_RESERVED 0x07F8
- -#define TLAN_TC_NFEW 0x0004
- -#define TLAN_TC_INTEN 0x0002
- -#define TLAN_TC_TINT 0x0001
- -#define TLAN_TLPHY_STS 0x12
- -#define TLAN_TS_MINT 0x8000
- -#define TLAN_TS_PHOK 0x4000
- -#define TLAN_TS_POLOK 0x2000
- -#define TLAN_TS_TPENERGY 0x1000
- -#define TLAN_TS_RESERVED 0x0FFF
- -#define TLAN_TLPHY_PAR 0x19
- -#define TLAN_PHY_CIM_STAT 0x0020
- -#define TLAN_PHY_SPEED_100 0x0040
- -#define TLAN_PHY_DUPLEX_FULL 0x0080
- -#define TLAN_PHY_AN_EN_STAT 0x0400
- -
- -
- -/* ThunderLAN MII Registers */
- -
- -/* Generic MII/PHY Registers */
- -
- -#define MII_GEN_CTL 0x00
- -#define MII_GC_RESET 0x8000
- -#define MII_GC_LOOPBK 0x4000
- -#define MII_GC_SPEEDSEL 0x2000
- -#define MII_GC_AUTOENB 0x1000
- -#define MII_GC_PDOWN 0x0800
- -#define MII_GC_ISOLATE 0x0400
- -#define MII_GC_AUTORSRT 0x0200
- -#define MII_GC_DUPLEX 0x0100
- -#define MII_GC_COLTEST 0x0080
- -#define MII_GC_RESERVED 0x007F
- -#define MII_GEN_STS 0x01
- -#define MII_GS_100BT4 0x8000
- -#define MII_GS_100BTXFD 0x4000
- -#define MII_GS_100BTXHD 0x2000
- -#define MII_GS_10BTFD 0x1000
- -#define MII_GS_10BTHD 0x0800
- -#define MII_GS_RESERVED 0x07C0
- -#define MII_GS_AUTOCMPLT 0x0020
- -#define MII_GS_RFLT 0x0010
- -#define MII_GS_AUTONEG 0x0008
- -#define MII_GS_LINK 0x0004
- -#define MII_GS_JABBER 0x0002
- -#define MII_GS_EXTCAP 0x0001
- -#define MII_GEN_ID_HI 0x02
- -#define MII_GEN_ID_LO 0x03
- -#define MII_GIL_OUI 0xFC00
- -#define MII_GIL_MODEL 0x03F0
- -#define MII_GIL_REVISION 0x000F
- -#define MII_AN_ADV 0x04
- -#define MII_AN_LPA 0x05
- -#define MII_AN_EXP 0x06
- -
- -/* ThunderLAN Specific MII/PHY Registers */
- -
- -#define TLAN_TC_IGLINK 0x8000
- -#define TLAN_TC_SWAPOL 0x4000
- -#define TLAN_TC_AUISEL 0x2000
- -#define TLAN_TC_SQEEN 0x1000
- -#define TLAN_TC_MTEST 0x0800
- -#define TLAN_TC_RESERVED 0x07F8
- -#define TLAN_TC_NFEW 0x0004
- -#define TLAN_TC_INTEN 0x0002
- -#define TLAN_TC_TINT 0x0001
- -#define TLAN_TS_MINT 0x8000
- -#define TLAN_TS_PHOK 0x4000
- -#define TLAN_TS_POLOK 0x2000
- -#define TLAN_TS_TPENERGY 0x1000
- -#define TLAN_TS_RESERVED 0x0FFF
- -#define TLAN_PHY_CIM_STAT 0x0020
- -#define TLAN_PHY_SPEED_100 0x0040
- -#define TLAN_PHY_DUPLEX_FULL 0x0080
- -#define TLAN_PHY_AN_EN_STAT 0x0400
- -
- -/* National Sem. & Level1 PHY id's */
- -#define NAT_SEM_ID1 0x2000
- -#define NAT_SEM_ID2 0x5C01
- -#define LEVEL1_ID1 0x7810
- -#define LEVEL1_ID2 0x0000
- -
- -#define TLan_ClearBit( bit, port ) outb_p(inb_p(port) & ~bit, port)
- -#define TLan_GetBit( bit, port ) ((int) (inb_p(port) & bit))
- -#define TLan_SetBit( bit, port ) outb_p(inb_p(port) | bit, port)
- -
- -typedef unsigned int u32;
- -typedef unsigned short u16;
- -typedef unsigned char u8;
- +static void TLan_ResetLists(struct nic *nic __unused);
- +static void TLan_ResetAdapter(struct nic *nic __unused);
- +static void TLan_FinishReset(struct nic *nic __unused);
-
- -/* Routines to access internal registers. */
- +static void TLan_EeSendStart(u16);
- +static int TLan_EeSendByte(u16, u8, int);
- +static void TLan_EeReceiveByte(u16, u8 *, int);
- +static int TLan_EeReadByte(u16 io_base, u8, u8 *);
-
- -inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr)
- -{
- - outw(internal_addr, base_addr + TLAN_DIO_ADR);
- - return (inb((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x3)));
- -
- -} /* TLan_DioRead8 */
- +static void TLan_PhyDetect(struct nic *nic);
- +static void TLan_PhyPowerDown(struct nic *nic);
- +static void TLan_PhyPowerUp(struct nic *nic);
-
- -inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr)
- -{
- - outw(internal_addr, base_addr + TLAN_DIO_ADR);
- - return (inw((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x2)));
-
- -} /* TLan_DioRead16 */
- +static void TLan_SetMac(struct nic *nic __unused, int areg, char *mac);
-
- -inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr)
- -{
- - outw(internal_addr, base_addr + TLAN_DIO_ADR);
- - return (inl(base_addr + TLAN_DIO_DATA));
- +static void TLan_PhyReset(struct nic *nic);
- +static void TLan_PhyStartLink(struct nic *nic);
- +static void TLan_PhyFinishAutoNeg(struct nic *nic);
-
- -} /* TLan_DioRead32 */
- +#ifdef MONITOR
- +static void TLan_PhyMonitor(struct nic *nic);
- +#endif
-
- -inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)
- -{
- - outw(internal_addr, base_addr + TLAN_DIO_ADR);
- - outb(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x3));
-
- -}
- +static void refill_rx(struct nic *nic __unused);
-
- -inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)
- -{
- - outw(internal_addr, base_addr + TLAN_DIO_ADR);
- - outw(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
- +static int TLan_MiiReadReg(struct nic *nic __unused, u16, u16, u16 *);
- +static void TLan_MiiSendData(u16, u32, unsigned);
- +static void TLan_MiiSync(u16);
- +static void TLan_MiiWriteReg(struct nic *nic __unused, u16, u16, u16);
-
- -}
-
- -inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data)
- -{
- - outw(internal_addr, base_addr + TLAN_DIO_ADR);
- - outl(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
- +const char *media[] = {
- + "10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ",
- + "100baseTx-FD", "100baseT4", 0
- +};
-
- -}
- +/* This much match tlan_pci_tbl[]! */
- +enum tlan_nics {
- + NETEL10 = 0, NETEL100 = 1, NETFLEX3I = 2, THUNDER = 3, NETFLEX3B =
- + 4, NETEL100PI = 5,
- + NETEL100D = 6, NETEL100I = 7, OC2183 = 8, OC2325 = 9, OC2326 =
- + 10, NETELLIGENT_10_100_WS_5100 = 11,
- + NETELLIGENT_10_T2 = 12
- +};
-
- -/* NIC specific static variables go here */
- +struct pci_id_info {
- + const char *name;
- + int nic_id;
- + struct match_info {
- + u32 pci, pci_mask, subsystem, subsystem_mask;
- + u32 revision, revision_mask; /* Only 8 bits. */
- + } id;
- + u32 flags;
- + u16 addrOfs; /* Address Offset */
- +};
-
- -/*****************************************************************************
- -******************************************************************************
- +static struct pci_id_info tlan_pci_tbl[] = {
- + {"Compaq Netelligent 10 T PCI UTP", NETEL10,
- + {0xae340e11, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_ACTIVITY_LED, 0x83},
- + {"Compaq Netelligent 10/100 TX PCI UTP", NETEL100,
- + {0xae320e11, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_ACTIVITY_LED, 0x83},
- + {"Compaq Integrated NetFlex-3/P", NETFLEX3I,
- + {0xae350e11, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_NONE, 0x83},
- + {"Compaq NetFlex-3/P", THUNDER,
- + {0xf1300e11, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_UNMANAGED_PHY | TLAN_ADAPTER_BIT_RATE_PHY, 0x83},
- + {"Compaq NetFlex-3/P", NETFLEX3B,
- + {0xf1500e11, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_NONE, 0x83},
- + {"Compaq Netelligent Integrated 10/100 TX UTP", NETEL100PI,
- + {0xae430e11, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_ACTIVITY_LED, 0x83},
- + {"Compaq Netelligent Dual 10/100 TX PCI UTP", NETEL100D,
- + {0xae400e11, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_NONE, 0x83},
- + {"Compaq Netelligent 10/100 TX Embedded UTP", NETEL100I,
- + {0xb0110e11, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_NONE, 0x83},
- + {"Olicom OC-2183/2185", OC2183,
- + {0x0013108d, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_USE_INTERN_10, 0x83},
- + {"Olicom OC-2325", OC2325,
- + {0x0012108d, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_UNMANAGED_PHY, 0xF8},
- + {"Olicom OC-2326", OC2326,
- + {0x0014108d, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_USE_INTERN_10, 0xF8},
- + {"Compaq Netelligent 10/100 TX UTP", NETELLIGENT_10_100_WS_5100,
- + {0xb0300e11, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_ACTIVITY_LED, 0x83},
- + {"Compaq Netelligent 10 T/2 PCI UTP/Coax", NETELLIGENT_10_T2,
- + {0xb0120e11, 0xffffffff, 0, 0, 0, 0},
- + TLAN_ADAPTER_NONE, 0x83},
- + {"Compaq NetFlex-3/E", 0, /* EISA card */
- + {0, 0, 0, 0, 0, 0},
- + TLAN_ADAPTER_ACTIVITY_LED | TLAN_ADAPTER_UNMANAGED_PHY |
- + TLAN_ADAPTER_BIT_RATE_PHY, 0x83},
- + {"Compaq NetFlex-3/E", 0, /* EISA card */
- + {0, 0, 0, 0, 0, 0},
- + TLAN_ADAPTER_ACTIVITY_LED, 0x83},
- + {0, 0,
- + {0, 0, 0, 0, 0, 0},
- + 0, 0},
- +};
-
- - ThunderLAN Driver Eeprom routines
-
- - The Compaq Netelligent 10 and 10/100 cards use a Microchip 24C02A
- - EEPROM. These functions are based on information in Microchip's
- - data sheet. I don't know how well this functions will work with
- - other EEPROMs.
- +struct TLanList {
- + u32 forward;
- + u16 cStat;
- + u16 frameSize;
- + struct {
- + u32 count;
- + u32 address;
- + } buffer[TLAN_BUFFERS_PER_LIST];
- +};
-
- -******************************************************************************
- -*****************************************************************************/
-
- - /***************************************************************
- - * TLan_EeSendStart
- - *
- - * Returns:
- - * Nothing
- - * Parms:
- - * io_base The IO port base address for the
- - * TLAN device with the EEPROM to
- - * use.
- - *
- - * This function sends a start cycle to an EEPROM attached
- - * to a TLAN chip.
- - *
- - **************************************************************/
-
- -static void TLan_EeSendStart( u16 io_base )
- -{
- - u16 sio;
- +struct TLanList tx_ring[TLAN_NUM_TX_LISTS];
- +static unsigned char txb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_TX_LISTS];
-
- - outw( TLAN_NET_SIO, io_base + TLAN_DIO_ADR );
- - sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO;
- +struct TLanList rx_ring[TLAN_NUM_RX_LISTS];
- +static unsigned char rxb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_RX_LISTS];
-
- - TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
- - TLan_SetBit( TLAN_NET_SIO_EDATA, sio );
- - TLan_SetBit( TLAN_NET_SIO_ETXEN, sio );
- - TLan_ClearBit( TLAN_NET_SIO_EDATA, sio );
- - TLan_ClearBit( TLAN_NET_SIO_ECLOK, sio );
- +typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE];
-
- -} /* TLan_EeSendStart */
-
- - /***************************************************************
- - * TLan_EeSendByte
- - *
- - * Returns:
- - * If the correct ack was received, 0, otherwise 1
- - * Parms: io_base The IO port base address for the
- - * TLAN device with the EEPROM to
- - * use.
- - * data The 8 bits of information to
- - * send to the EEPROM.
- - * stop If TLAN_EEPROM_STOP is passed, a
- - * stop cycle is sent after the
- - * byte is sent after the ack is
- - * read.
- - *
- - * This function sends a byte on the serial EEPROM line,
- - * driving the clock to send each bit. The function then
- - * reverses transmission direction and reads an acknowledge
- - * bit.
- - *
- - **************************************************************/
- +int chip_idx;
-
- -static int TLan_EeSendByte( u16 io_base, u8 data, int stop )
- -{
- - int err;
- - u8 place;
- - u16 sio;
-
- - outw( TLAN_NET_SIO, io_base + TLAN_DIO_ADR );
- - sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO;
- +/*****************************************************************
- +* TLAN Private Information Structure
- +*
- +****************************************************************/
- +struct tlan_private {
- + unsigned short vendor_id; /* PCI Vendor code */
- + unsigned short dev_id; /* PCI Device code */
- + const char *nic_name;
- + u8 *padBuffer;
- + u8 *rxBuffer;
- + struct TLanList *rx_head_desc;
- + u32 rxHead;
- + u32 rxTail;
- + u32 rxEocCount;
- + unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indicies */
- + unsigned int cur_tx, dirty_tx;
- + unsigned rx_buf_sz; /* Based on mtu + Slack */
- + struct TLanList *txList;
- + struct TLanList *rxList;
- + u8 *txBuffer;
- + u32 txHead;
- + u32 txInProgress;
- + u32 txTail;
- + int eoc;
- + u32 txBusyCount;
- + u32 phyOnline;
- + u32 timerSetAt;
- + u32 timerType;
- + u32 adapterRev;
- + u32 aui;
- + u32 debug;
- + u32 duplex;
- + u32 phy[2];
- + u32 phyNum;
- + u32 speed;
- + u8 tlanRev;
- + u8 tlanFullDuplex;
- + char devName[8];
- + u8 link;
- + u8 is_eisa;
- + u8 neg_be_verbose;
- +} TLanPrivateInfo;
-
- - /* Assume clock is low, tx is enabled; */
- - for ( place = 0x80; place != 0; place >>= 1 ) {
- - if ( place & data )
- - TLan_SetBit( TLAN_NET_SIO_EDATA, sio );
- - else
- - TLan_ClearBit( TLAN_NET_SIO_EDATA, sio );
- - TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
- - TLan_ClearBit( TLAN_NET_SIO_ECLOK, sio );
- - }
- - TLan_ClearBit( TLAN_NET_SIO_ETXEN, sio );
- - TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
- - err = TLan_GetBit( TLAN_NET_SIO_EDATA, sio );
- - TLan_ClearBit( TLAN_NET_SIO_ECLOK, sio );
- - TLan_SetBit( TLAN_NET_SIO_ETXEN, sio );
- +static struct tlan_private *priv;
-
- - if ( ( ! err ) && stop ) {
- - TLan_ClearBit( TLAN_NET_SIO_EDATA, sio ); /* STOP, raise data while clock is high */
- - TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
- - TLan_SetBit( TLAN_NET_SIO_EDATA, sio );
- - }
- +u32 BASE;
-
- - return ( err );
-
- -} /* TLan_EeSendByte */
-
- - /***************************************************************
- - * TLan_EeReceiveByte
- - *
- - * Returns:
- - * Nothing
- - * Parms:
- - * io_base The IO port base address for the
- - * TLAN device with the EEPROM to
- - * use.
- - * data An address to a char to hold the
- - * data sent from the EEPROM.
- - * stop If TLAN_EEPROM_STOP is passed, a
- - * stop cycle is sent after the
- - * byte is received, and no ack is
- - * sent.
- - *
- - * This function receives 8 bits of data from the EEPROM
- - * over the serial link. It then sends and ack bit, or no
- - * ack and a stop bit. This function is used to retrieve
- - * data after the address of a byte in the EEPROM has been
- - * sent.
- - *
- - **************************************************************/
- +/***************************************************************
- +* TLan_ResetLists
- +*
- +* Returns:
- +* Nothing
- +* Parms:
- +* dev The device structure with the list
- +* stuctures to be reset.
- +*
- +* This routine sets the variables associated with managing
- +* the TLAN lists to their initial values.
- +*
- +**************************************************************/
-
- -static void TLan_EeReceiveByte( u16 io_base, u8 *data, int stop )
- +void TLan_ResetLists(struct nic *nic __unused)
- {
- - u8 place;
- - u16 sio;
-
- - outw( TLAN_NET_SIO, io_base + TLAN_DIO_ADR );
- - sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO;
- - *data = 0;
- + int i;
- + struct TLanList *list;
- + priv->txHead = 0;
- + priv->txTail = 0;
-
- - /* Assume clock is low, tx is enabled; */
- - TLan_ClearBit( TLAN_NET_SIO_ETXEN, sio );
- - for ( place = 0x80; place; place >>= 1 ) {
- - TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
- - if ( TLan_GetBit( TLAN_NET_SIO_EDATA, sio ) )
- - *data |= place;
- - TLan_ClearBit( TLAN_NET_SIO_ECLOK, sio );
- + for (i = 0; i < TLAN_NUM_TX_LISTS; i++) {
- + list = &tx_ring[i];
- + list->cStat = TLAN_CSTAT_UNUSED;
- +/* list->buffer[0].address = 0; */
- + list->buffer[0].address = virt_to_bus(txb +
- + (i * TLAN_MAX_FRAME_SIZE));
- + list->buffer[2].count = 0;
- + list->buffer[2].address = 0;
- + list->buffer[9].address = 0;
- +/* list->forward = 0; */
- }
-
- - TLan_SetBit( TLAN_NET_SIO_ETXEN, sio );
- - if ( ! stop ) {
- - TLan_ClearBit( TLAN_NET_SIO_EDATA, sio ); /* Ack = 0 */
- - TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
- - TLan_ClearBit( TLAN_NET_SIO_ECLOK, sio );
- - } else {
- - TLan_SetBit( TLAN_NET_SIO_EDATA, sio ); /* No ack = 1 (?) */
- - TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
- - TLan_ClearBit( TLAN_NET_SIO_ECLOK, sio );
- - TLan_ClearBit( TLAN_NET_SIO_EDATA, sio ); /* STOP, raise data while clock is high */
- - TLan_SetBit( TLAN_NET_SIO_ECLOK, sio );
- - TLan_SetBit( TLAN_NET_SIO_EDATA, sio );
- - }
- + priv->cur_rx = 0;
- + priv->rx_buf_sz = (TLAN_MAX_FRAME_SIZE);
- + priv->rx_head_desc = &rx_ring[0];
- +
- + /* Initialize all the Rx descriptors */
- + for (i = 0; i < TLAN_NUM_RX_LISTS; i++) {
- + rx_ring[i].forward = virt_to_le32desc(&rx_ring[i + 1]);
- + rx_ring[i].cStat = TLAN_CSTAT_READY;
- + rx_ring[i].frameSize = TLAN_MAX_FRAME_SIZE;
- + rx_ring[i].buffer[0].count =
- + TLAN_MAX_FRAME_SIZE | TLAN_LAST_BUFFER;
- + rx_ring[i].buffer[0].address =
- + virt_to_le32desc(&rxb[i * TLAN_MAX_FRAME_SIZE]);
- + rx_ring[i].buffer[1].count = 0;
- + rx_ring[i].buffer[1].address = 0;
- + }
- +
- + /* Mark the last entry as wrapping the ring */
- + rx_ring[i - 1].forward = virt_to_le32desc(&rx_ring[0]);
- + priv->dirty_rx = (unsigned int) (i - TLAN_NUM_RX_LISTS);
-
- -} /* TLan_EeReceiveByte */
- +} /* TLan_ResetLists */
-
- - /***************************************************************
- - * TLan_EeReadByte
- - *
- - * Returns:
- - * No error = 0, else, the stage at which the error
- - * occurred.
- - * Parms:
- - * io_base The IO port base address for the
- - * TLAN device with the EEPROM to
- - * use.
- - * ee_addr The address of the byte in the
- - * EEPROM whose contents are to be
- - * retrieved.
- - * data An address to a char to hold the
- - * data obtained from the EEPROM.
- - *
- - * This function reads a byte of information from an byte
- - * cell in the EEPROM.
- - *
- - **************************************************************/
- +/***************************************************************
- +* TLan_Reset
- +*
- +* Returns:
- +* 0
- +* Parms:
- +* dev Pointer to device structure of adapter
- +* to be reset.
- +*
- +* This function resets the adapter and it's physical
- +* device. See Chap. 3, pp. 9-10 of the "ThunderLAN
- +* Programmer's Guide" for details. The routine tries to
- +* implement what is detailed there, though adjustments
- +* have been made.
- +*
- +**************************************************************/
-
- -static int TLan_EeReadByte( u16 io_base, u8 ee_addr, u8 *data )
- +void TLan_ResetAdapter(struct nic *nic __unused)
- {
- - int err;
- - unsigned long flags = 0;
- - int ret=0;
- + int i;
- + u32 addr;
- + u32 data;
- + u8 data8;
-
- - TLan_EeSendStart( io_base );
- - err = TLan_EeSendByte( io_base, 0xA0, TLAN_EEPROM_ACK );
- - if (err)
- - {
- - ret=1;
- - goto fail;
- - }
- - err = TLan_EeSendByte( io_base, ee_addr, TLAN_EEPROM_ACK );
- - if (err)
- - {
- - ret=2;
- - goto fail;
- - }
- - TLan_EeSendStart( io_base );
- - err = TLan_EeSendByte( io_base, 0xA1, TLAN_EEPROM_ACK );
- - if (err)
- - {
- - ret=3;
- - goto fail;
- - }
- - TLan_EeReceiveByte( io_base, data, TLAN_EEPROM_STOP );
- -fail:
- + priv->tlanFullDuplex = FALSE;
- + priv->phyOnline = 0;
- +/* 1. Assert reset bit. */
-
- - return ret;
- + data = inl(BASE + TLAN_HOST_CMD);
- + data |= TLAN_HC_AD_RST;
- + outl(data, BASE + TLAN_HOST_CMD);
-
- -} /* TLan_EeReadByte */
- + udelay(1000);
-
- -#if 0
- -/* Not yet converted from Linux driver */
- -/*****************************************************************************
- -******************************************************************************
- +/* 2. Turn off interrupts. ( Probably isn't necessary ) */
-
- - ThunderLAN Driver PHY Layer Routines
- + data = inl(BASE + TLAN_HOST_CMD);
- + data |= TLAN_HC_INT_OFF;
- + outl(data, BASE + TLAN_HOST_CMD);
- +/* 3. Clear AREGs and HASHs. */
-
- -******************************************************************************
- -*****************************************************************************/
- + for (i = TLAN_AREG_0; i <= TLAN_HASH_2; i += 4) {
- + TLan_DioWrite32(BASE, (u16) i, 0);
- + }
-
- - /*********************************************************************
- - * TLan_PhyPrint
- - *
- - * Returns:
- - * Nothing
- - * Parms:
- - * dev A pointer to the device structure of the
- - * TLAN device having the PHYs to be detailed.
- - *
- - * This function prints the registers a PHY (aka tranceiver).
- - *
- - ********************************************************************/
- +/* 4. Setup NetConfig register. */
-
- -void TLan_PhyPrint( struct net_device *dev )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - u16 i, data0, data1, data2, data3, phy;
- + data =
- + TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | TLAN_NET_CFG_PHY_EN;
- + TLan_DioWrite16(BASE, TLAN_NET_CONFIG, (u16) data);
-
- - phy = priv->phy[priv->phyNum];
- +/* 5. Load Ld_Tmr and Ld_Thr in HOST_CMD. */
-
- - if ( priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY ) {
- - printk( "TLAN: Device %s, Unmanaged PHY.\n", dev->name );
- - } else if ( phy <= TLAN_PHY_MAX_ADDR ) {
- - printk( "TLAN: Device %s, PHY 0x%02x.\n", dev->name, phy );
- - printk( "TLAN: Off. +0 +1 +2 +3 \n" );
- - for ( i = 0; i < 0x20; i+= 4 ) {
- - printk( "TLAN: 0x%02x", i );
- - TLan_MiiReadReg( dev, phy, i, &data0 );
- - printk( " 0x%04hx", data0 );
- - TLan_MiiReadReg( dev, phy, i + 1, &data1 );
- - printk( " 0x%04hx", data1 );
- - TLan_MiiReadReg( dev, phy, i + 2, &data2 );
- - printk( " 0x%04hx", data2 );
- - TLan_MiiReadReg( dev, phy, i + 3, &data3 );
- - printk( " 0x%04hx\n", data3 );
- - }
- - } else {
- - printk( "TLAN: Device %s, Invalid PHY.\n", dev->name );
- - }
- + outl(TLAN_HC_LD_TMR | 0x3f, BASE + TLAN_HOST_CMD);
- + outl(TLAN_HC_LD_THR | 0x0, BASE + TLAN_HOST_CMD);
-
- -} /* TLan_PhyPrint */
- +/* 6. Unreset the MII by setting NMRST (in NetSio) to 1. */
-
- - /*********************************************************************
- - * TLan_PhyDetect
- - *
- - * Returns:
- - * Nothing
- - * Parms:
- - * dev A pointer to the device structure of the adapter
- - * for which the PHY needs determined.
- - *
- - * So far I've found that adapters which have external PHYs
- - * may also use the internal PHY for part of the functionality.
- - * (eg, AUI/Thinnet). This function finds out if this TLAN
- - * chip has an internal PHY, and then finds the first external
- - * PHY (starting from address 0) if it exists).
- - *
- - ********************************************************************/
- + outw(TLAN_NET_SIO, BASE + TLAN_DIO_ADR);
- + addr = BASE + TLAN_DIO_DATA + TLAN_NET_SIO;
- + TLan_SetBit(TLAN_NET_SIO_NMRST, addr);
-
- -void TLan_PhyDetect( struct net_device *dev )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - u16 control;
- - u16 hi;
- - u16 lo;
- - u32 phy;
- +/* 7. Setup the remaining registers. */
-
- - if ( priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY ) {
- - priv->phyNum = 0xFFFF;
- - return;
- + if (priv->tlanRev >= 0x30) {
- + data8 = TLAN_ID_TX_EOC | TLAN_ID_RX_EOC;
- + TLan_DioWrite8(BASE, TLAN_INT_DIS, data8);
- }
- + TLan_PhyDetect(nic);
- + data = TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN;
-
- - TLan_MiiReadReg( dev, TLAN_PHY_MAX_ADDR, MII_GEN_ID_HI, &hi );
- -
- - if ( hi != 0xFFFF ) {
- - priv->phy[0] = TLAN_PHY_MAX_ADDR;
- - } else {
- - priv->phy[0] = TLAN_PHY_NONE;
- + if (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_BIT_RATE_PHY) {
- + data |= TLAN_NET_CFG_BIT;
- + if (priv->aui == 1) {
- + TLan_DioWrite8(BASE, TLAN_ACOMMIT, 0x0a);
- + } else if (priv->duplex == TLAN_DUPLEX_FULL) {
- + TLan_DioWrite8(BASE, TLAN_ACOMMIT, 0x00);
- + priv->tlanFullDuplex = TRUE;
- + } else {
- + TLan_DioWrite8(BASE, TLAN_ACOMMIT, 0x08);
- + }
- }
-
- - priv->phy[1] = TLAN_PHY_NONE;
- - for ( phy = 0; phy <= TLAN_PHY_MAX_ADDR; phy++ ) {
- - TLan_MiiReadReg( dev, phy, MII_GEN_CTL, &control );
- - TLan_MiiReadReg( dev, phy, MII_GEN_ID_HI, &hi );
- - TLan_MiiReadReg( dev, phy, MII_GEN_ID_LO, &lo );
- - if ( ( control != 0xFFFF ) || ( hi != 0xFFFF ) || ( lo != 0xFFFF ) ) {
- - TLAN_DBG( TLAN_DEBUG_GNRL, "PHY found at %02x %04x %04x %04x\n", phy, control, hi, lo );
- - if ( ( priv->phy[1] == TLAN_PHY_NONE ) && ( phy != TLAN_PHY_MAX_ADDR ) ) {
- - priv->phy[1] = phy;
- - }
- - }
- + if (priv->phyNum == 0) {
- + data |= TLAN_NET_CFG_PHY_EN;
- }
- + TLan_DioWrite16(BASE, TLAN_NET_CONFIG, (u16) data);
-
- - if ( priv->phy[1] != TLAN_PHY_NONE ) {
- - priv->phyNum = 1;
- - } else if ( priv->phy[0] != TLAN_PHY_NONE ) {
- - priv->phyNum = 0;
- + if (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_UNMANAGED_PHY) {
- + TLan_FinishReset(nic);
- } else {
- - printk( "TLAN: Cannot initialize device, no PHY was found!\n" );
- + TLan_PhyPowerDown(nic);
- }
-
- -} /* TLan_PhyDetect */
- +} /* TLan_ResetAdapter */
-
- -void TLan_PhyPowerDown( struct net_device *dev )
- +void TLan_FinishReset(struct nic *nic)
- {
- - TLanPrivateInfo *priv = dev->priv;
- - u16 value;
-
- - TLAN_DBG( TLAN_DEBUG_GNRL, "%s: Powering down PHY(s).\n", dev->name );
- - value = MII_GC_PDOWN | MII_GC_LOOPBK | MII_GC_ISOLATE;
- - TLan_MiiSync( dev->base_addr );
- - TLan_MiiWriteReg( dev, priv->phy[priv->phyNum], MII_GEN_CTL, value );
- - if ( ( priv->phyNum == 0 ) && ( priv->phy[1] != TLAN_PHY_NONE ) && ( ! ( priv->adapter->flags & TLAN_ADAPTER_USE_INTERN_10 ) ) ) {
- - TLan_MiiSync( dev->base_addr );
- - TLan_MiiWriteReg( dev, priv->phy[1], MII_GEN_CTL, value );
- + u8 data;
- + u32 phy;
- + u8 sio;
- + u16 status;
- + u16 partner;
- + u16 tlphy_ctl;
- + u16 tlphy_par;
- + u16 tlphy_id1, tlphy_id2;
- + int i;
- +
- + phy = priv->phy[priv->phyNum];
- +
- + data = TLAN_NET_CMD_NRESET | TLAN_NET_CMD_NWRAP;
- + if (priv->tlanFullDuplex) {
- + data |= TLAN_NET_CMD_DUPLEX;
- }
- + TLan_DioWrite8(BASE, TLAN_NET_CMD, data);
- + data = TLAN_NET_MASK_MASK4 | TLAN_NET_MASK_MASK5;
- + if (priv->phyNum == 0) {
- + data |= TLAN_NET_MASK_MASK7;
- + }
- + TLan_DioWrite8(BASE, TLAN_NET_MASK, data);
- + TLan_DioWrite16(BASE, TLAN_MAX_RX, ((1536) + 7) & ~7);
- + TLan_MiiReadReg(nic, phy, MII_GEN_ID_HI, &tlphy_id1);
- + TLan_MiiReadReg(nic, phy, MII_GEN_ID_LO, &tlphy_id2);
-
- - /* Wait for 50 ms and powerup
- - * This is abitrary. It is intended to make sure the
- - * tranceiver settles.
- - */
- - TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_PUP );
- + if ((tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_UNMANAGED_PHY)
- + || (priv->aui)) {
- + status = MII_GS_LINK;
- + printf("TLAN: %s: Link forced.\n", priv->nic_name);
- + } else {
- + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status);
- + udelay(1000);
- + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status);
- + if ((status & MII_GS_LINK) && /* We only support link info on Nat.Sem. PHY's */
- + (tlphy_id1 == NAT_SEM_ID1)
- + && (tlphy_id2 == NAT_SEM_ID2)) {
- + TLan_MiiReadReg(nic, phy, MII_AN_LPA, &partner);
- + TLan_MiiReadReg(nic, phy, TLAN_TLPHY_PAR,
- + &tlphy_par);
-
- -} /* TLan_PhyPowerDown */
- + printf("TLAN: %s: Link active with ",
- + priv->nic_name);
- + if (!(tlphy_par & TLAN_PHY_AN_EN_STAT)) {
- + printf("forced 10%sMbps %s-Duplex\n",
- + tlphy_par & TLAN_PHY_SPEED_100 ? ""
- + : "0",
- + tlphy_par & TLAN_PHY_DUPLEX_FULL ?
- + "Full" : "Half");
- + } else {
- + printf
- + ("AutoNegotiation enabled, at 10%sMbps %s-Duplex\n",
- + tlphy_par & TLAN_PHY_SPEED_100 ? "" :
- + "0",
- + tlphy_par & TLAN_PHY_DUPLEX_FULL ?
- + "Full" : "Half");
- + printf("TLAN: Partner capability: ");
- + for (i = 5; i <= 10; i++)
- + if (partner & (1 << i))
- + printf("%s", media[i - 5]);
- + printf("\n");
- + }
-
- -void TLan_PhyPowerUp( struct net_device *dev )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - u16 value;
- + TLan_DioWrite8(BASE, TLAN_LED_REG, TLAN_LED_LINK);
- +#ifdef MONITOR
- + /* We have link beat..for now anyway */
- + priv->link = 1;
- + /*Enabling link beat monitoring */
- + /* TLan_SetTimer( nic, (10*HZ), TLAN_TIMER_LINK_BEAT ); */
- + mdelay(10000);
- + TLan_PhyMonitor(nic);
- +#endif
- + } else if (status & MII_GS_LINK) {
- + printf("TLAN: %s: Link active\n", priv->nic_name);
- + TLan_DioWrite8(BASE, TLAN_LED_REG, TLAN_LED_LINK);
- + }
- + }
-
- - TLAN_DBG( TLAN_DEBUG_GNRL, "%s: Powering up PHY.\n", dev->name );
- - TLan_MiiSync( dev->base_addr );
- - value = MII_GC_LOOPBK;
- - TLan_MiiWriteReg( dev, priv->phy[priv->phyNum], MII_GEN_CTL, value );
- - TLan_MiiSync(dev->base_addr);
- - /* Wait for 500 ms and reset the
- - * tranceiver. The TLAN docs say both 50 ms and
- - * 500 ms, so do the longer, just in case.
- - */
- - TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_RESET );
- + if (priv->phyNum == 0) {
- + TLan_MiiReadReg(nic, phy, TLAN_TLPHY_CTL, &tlphy_ctl);
- + tlphy_ctl |= TLAN_TC_INTEN;
- + TLan_MiiWriteReg(nic, phy, TLAN_TLPHY_CTL, tlphy_ctl);
- + sio = TLan_DioRead8(BASE, TLAN_NET_SIO);
- + sio |= TLAN_NET_SIO_MINTEN;
- + TLan_DioWrite8(BASE, TLAN_NET_SIO, sio);
- + }
-
- -} /* TLan_PhyPowerUp */
- + if (status & MII_GS_LINK) {
- + TLan_SetMac(nic, 0, nic->node_addr);
- + priv->phyOnline = 1;
- + outb((TLAN_HC_INT_ON >> 8), BASE + TLAN_HOST_CMD + 1);
- +/* if ( debug >= 1 && debug != TLAN_DEBUG_PROBE ) {
- + outb( ( TLAN_HC_REQ_INT >> 8 ), BASE + TLAN_HOST_CMD + 1 );
- + }
-
- -void TLan_PhyReset( struct net_device *dev )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - u16 phy;
- - u16 value;
- + */
- + outl(virt_to_bus(&rx_ring), BASE + TLAN_CH_PARM);
- + outl(TLAN_HC_GO | TLAN_HC_RT, BASE + TLAN_HOST_CMD);
- + } else {
- + printf
- + ("TLAN: %s: Link inactive, will retry in 10 secs...\n",
- + priv->nic_name);
- + /* TLan_SetTimer( nic, (10*HZ), TLAN_TIMER_FINISH_RESET ); */
- + mdelay(10000);
- + TLan_FinishReset(nic);
- + return;
-
- - phy = priv->phy[priv->phyNum];
- + }
-
- - TLAN_DBG( TLAN_DEBUG_GNRL, "%s: Reseting PHY.\n", dev->name );
- - TLan_MiiSync( dev->base_addr );
- - value = MII_GC_LOOPBK | MII_GC_RESET;
- - TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, value );
- - TLan_MiiReadReg( dev, phy, MII_GEN_CTL, &value );
- - while ( value & MII_GC_RESET ) {
- - TLan_MiiReadReg( dev, phy, MII_GEN_CTL, &value );
- - }
- -
- - /* Wait for 500 ms and initialize.
- - * I don't remember why I wait this long.
- - * I've changed this to 50ms, as it seems long enough.
- - */
- - TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_START_LINK );
- -
- -} /* TLan_PhyReset */
- -
- -void TLan_PhyStartLink( struct net_device *dev )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - u16 ability;
- - u16 control;
- - u16 data;
- - u16 phy;
- - u16 status;
- - u16 tctl;
- -
- - phy = priv->phy[priv->phyNum];
- - TLAN_DBG( TLAN_DEBUG_GNRL, "%s: Trying to activate link.\n", dev->name );
- - TLan_MiiReadReg( dev, phy, MII_GEN_STS, &status );
- - TLan_MiiReadReg( dev, phy, MII_GEN_STS, &ability );
- -
- - if ( ( status & MII_GS_AUTONEG ) &&
- - ( ! priv->aui ) ) {
- - ability = status >> 11;
- - if ( priv->speed == TLAN_SPEED_10 &&
- - priv->duplex == TLAN_DUPLEX_HALF) {
- - TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, 0x0000);
- - } else if ( priv->speed == TLAN_SPEED_10 &&
- - priv->duplex == TLAN_DUPLEX_FULL) {
- - priv->tlanFullDuplex = TRUE;
- - TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, 0x0100);
- - } else if ( priv->speed == TLAN_SPEED_100 &&
- - priv->duplex == TLAN_DUPLEX_HALF) {
- - TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, 0x2000);
- - } else if ( priv->speed == TLAN_SPEED_100 &&
- - priv->duplex == TLAN_DUPLEX_FULL) {
- - priv->tlanFullDuplex = TRUE;
- - TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, 0x2100);
- - } else {
- -
- - /* Set Auto-Neg advertisement */
- - TLan_MiiWriteReg( dev, phy, MII_AN_ADV, (ability << 5) | 1);
- - /* Enablee Auto-Neg */
- - TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, 0x1000 );
- - /* Restart Auto-Neg */
- - TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, 0x1200 );
- - /* Wait for 4 sec for autonegotiation
- - * to complete. The max spec time is less than this
- - * but the card need additional time to start AN.
- - * .5 sec should be plenty extra.
- - */
- - printk( "TLAN: %s: Starting autonegotiation.\n", dev->name );
- - TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_PHY_FINISH_AN );
- - return;
- - }
- -
- - }
- -
- - if ( ( priv->aui ) && ( priv->phyNum != 0 ) ) {
- - priv->phyNum = 0;
- - data = TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | TLAN_NET_CFG_PHY_EN;
- - TLan_DioWrite16( dev->base_addr, TLAN_NET_CONFIG, data );
- - TLan_SetTimer( dev, (40*HZ/1000), TLAN_TIMER_PHY_PDOWN );
- - return;
- - } else if ( priv->phyNum == 0 ) {
- - TLan_MiiReadReg( dev, phy, TLAN_TLPHY_CTL, &tctl );
- - if ( priv->aui ) {
- - tctl |= TLAN_TC_AUISEL;
- - } else {
- - tctl &= ~TLAN_TC_AUISEL;
- - control = 0;
- - if ( priv->duplex == TLAN_DUPLEX_FULL ) {
- - control |= MII_GC_DUPLEX;
- - priv->tlanFullDuplex = TRUE;
- - }
- - if ( priv->speed == TLAN_SPEED_100 ) {
- - control |= MII_GC_SPEEDSEL;
- - }
- - TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, control );
- - }
- - TLan_MiiWriteReg( dev, phy, TLAN_TLPHY_CTL, tctl );
- - }
- -
- - /* Wait for 2 sec to give the tranceiver time
- - * to establish link.
- - */
- - TLan_SetTimer( dev, (4*HZ), TLAN_TIMER_FINISH_RESET );
- -
- -} /* TLan_PhyStartLink */
- -
- -void TLan_PhyFinishAutoNeg( struct net_device *dev )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - u16 an_adv;
- - u16 an_lpa;
- - u16 data;
- - u16 mode;
- - u16 phy;
- - u16 status;
- -
- - phy = priv->phy[priv->phyNum];
- -
- - TLan_MiiReadReg( dev, phy, MII_GEN_STS, &status );
- - udelay( 1000 );
- - TLan_MiiReadReg( dev, phy, MII_GEN_STS, &status );
- -
- - if ( ! ( status & MII_GS_AUTOCMPLT ) ) {
- - /* Wait for 8 sec to give the process
- - * more time. Perhaps we should fail after a while.
- - */
- - if (!priv->neg_be_verbose++) {
- - printk(KERN_INFO "TLAN: Giving autonegotiation more time.\n");
- - printk(KERN_INFO "TLAN: Please check that your adapter has\n");
- - printk(KERN_INFO "TLAN: been properly connected to a HUB or Switch.\n");
- - printk(KERN_INFO "TLAN: Trying to establish link in the background...\n");
- - }
- - TLan_SetTimer( dev, (8*HZ), TLAN_TIMER_PHY_FINISH_AN );
- - return;
- - }
- -
- - printk( "TLAN: %s: Autonegotiation complete.\n", dev->name );
- - TLan_MiiReadReg( dev, phy, MII_AN_ADV, &an_adv );
- - TLan_MiiReadReg( dev, phy, MII_AN_LPA, &an_lpa );
- - mode = an_adv & an_lpa & 0x03E0;
- - if ( mode & 0x0100 ) {
- - priv->tlanFullDuplex = TRUE;
- - } else if ( ! ( mode & 0x0080 ) && ( mode & 0x0040 ) ) {
- - priv->tlanFullDuplex = TRUE;
- - }
- -
- - if ( ( ! ( mode & 0x0180 ) ) && ( priv->adapter->flags & TLAN_ADAPTER_USE_INTERN_10 ) && ( priv->phyNum != 0 ) ) {
- - priv->phyNum = 0;
- - data = TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | TLAN_NET_CFG_PHY_EN;
- - TLan_DioWrite16( dev->base_addr, TLAN_NET_CONFIG, data );
- - TLan_SetTimer( dev, (400*HZ/1000), TLAN_TIMER_PHY_PDOWN );
- - return;
- - }
- -
- - if ( priv->phyNum == 0 ) {
- - if ( ( priv->duplex == TLAN_DUPLEX_FULL ) || ( an_adv & an_lpa & 0x0040 ) ) {
- - TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, MII_GC_AUTOENB | MII_GC_DUPLEX );
- - printk( "TLAN: Starting internal PHY with FULL-DUPLEX\n" );
- - } else {
- - TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, MII_GC_AUTOENB );
- - printk( "TLAN: Starting internal PHY with HALF-DUPLEX\n" );
- - }
- - }
- -
- - /* Wait for 100 ms. No reason in partiticular.
- - */
- - TLan_SetTimer( dev, (HZ/10), TLAN_TIMER_FINISH_RESET );
- -
- -} /* TLan_PhyFinishAutoNeg */
- -
- -#ifdef MONITOR
- -
- - /*********************************************************************
- - *
- - * TLan_phyMonitor
- - *
- - * Returns:
- - * None
- - *
- - * Params:
- - * dev The device structure of this device.
- - *
- - *
- - * This function monitors PHY condition by reading the status
- - * register via the MII bus. This can be used to give info
- - * about link changes (up/down), and possible switch to alternate
- - * media.
- - *
- - * ******************************************************************/
- -
- -void TLan_PhyMonitor( struct net_device *dev )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - u16 phy;
- - u16 phy_status;
- -
- - phy = priv->phy[priv->phyNum];
- -
- - /* Get PHY status register */
- - TLan_MiiReadReg( dev, phy, MII_GEN_STS, &phy_status );
- -
- - /* Check if link has been lost */
- - if (!(phy_status & MII_GS_LINK)) {
- - if (priv->link) {
- - priv->link = 0;
- - printk(KERN_DEBUG "TLAN: %s has lost link\n", dev->name);
- - dev->flags &= ~IFF_RUNNING;
- - TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_LINK_BEAT );
- - return;
- - }
- - }
- -
- - /* Link restablished? */
- - if ((phy_status & MII_GS_LINK) && !priv->link) {
- - priv->link = 1;
- - printk(KERN_DEBUG "TLAN: %s has reestablished link\n", dev->name);
- - dev->flags |= IFF_RUNNING;
- - }
- -
- - /* Setup a new monitor */
- - TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_LINK_BEAT );
- -}
- -
- -#endif /* MONITOR */
- -
- -/*****************************************************************************
- -******************************************************************************
- -
- - ThunderLAN Driver MII Routines
- -
- - These routines are based on the information in Chap. 2 of the
- - "ThunderLAN Programmer's Guide", pp. 15-24.
- -
- -******************************************************************************
- -*****************************************************************************/
- -
- - /***************************************************************
- - * TLan_MiiReadReg
- - *
- - * Returns:
- - * 0 if ack received ok
- - * 1 otherwise.
- - *
- - * Parms:
- - * dev The device structure containing
- - * The io address and interrupt count
- - * for this device.
- - * phy The address of the PHY to be queried.
- - * reg The register whose contents are to be
- - * retreived.
- - * val A pointer to a variable to store the
- - * retrieved value.
- - *
- - * This function uses the TLAN's MII bus to retreive the contents
- - * of a given register on a PHY. It sends the appropriate info
- - * and then reads the 16-bit register value from the MII bus via
- - * the TLAN SIO register.
- - *
- - **************************************************************/
- -
- -int TLan_MiiReadReg( struct net_device *dev, u16 phy, u16 reg, u16 *val )
- -{
- - u8 nack;
- - u16 sio, tmp;
- - u32 i;
- - int err;
- - int minten;
- - TLanPrivateInfo *priv = dev->priv;
- - unsigned long flags = 0;
- -
- - err = FALSE;
- - outw(TLAN_NET_SIO, dev->base_addr + TLAN_DIO_ADR);
- - sio = dev->base_addr + TLAN_DIO_DATA + TLAN_NET_SIO;
- -
- - if (!in_irq())
- - spin_lock_irqsave(&priv->lock, flags);
- -
- - TLan_MiiSync(dev->base_addr);
- -
- - minten = TLan_GetBit( TLAN_NET_SIO_MINTEN, sio );
- - if ( minten )
- - TLan_ClearBit(TLAN_NET_SIO_MINTEN, sio);
- -
- - TLan_MiiSendData( dev->base_addr, 0x1, 2 ); /* Start ( 01b ) */
- - TLan_MiiSendData( dev->base_addr, 0x2, 2 ); /* Read ( 10b ) */
- - TLan_MiiSendData( dev->base_addr, phy, 5 ); /* Device # */
- - TLan_MiiSendData( dev->base_addr, reg, 5 ); /* Register # */
- -
- - TLan_ClearBit(TLAN_NET_SIO_MTXEN, sio); /* Change direction */
- -
- - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Clock Idle bit */
- - TLan_SetBit(TLAN_NET_SIO_MCLK, sio);
- - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Wait 300ns */
- -
- - nack = TLan_GetBit(TLAN_NET_SIO_MDATA, sio); /* Check for ACK */
- - TLan_SetBit(TLAN_NET_SIO_MCLK, sio); /* Finish ACK */
- - if (nack) { /* No ACK, so fake it */
- - for (i = 0; i < 16; i++) {
- - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio);
- - TLan_SetBit(TLAN_NET_SIO_MCLK, sio);
- - }
- - tmp = 0xffff;
- - err = TRUE;
- - } else { /* ACK, so read data */
- - for (tmp = 0, i = 0x8000; i; i >>= 1) {
- - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio);
- - if (TLan_GetBit(TLAN_NET_SIO_MDATA, sio))
- - tmp |= i;
- - TLan_SetBit(TLAN_NET_SIO_MCLK, sio);
- - }
- - }
- -
- - TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Idle cycle */
- - TLan_SetBit(TLAN_NET_SIO_MCLK, sio);
- -
- - if ( minten )
- - TLan_SetBit(TLAN_NET_SIO_MINTEN, sio);
- -
- - *val = tmp;
- -
- - if (!in_irq())
- - spin_unlock_irqrestore(&priv->lock, flags);
- -
- - return err;
- -
- -} /* TLan_MiiReadReg */
- -
- - /***************************************************************
- - * TLan_MiiSendData
- - *
- - * Returns:
- - * Nothing
- - * Parms:
- - * base_port The base IO port of the adapter in
- - * question.
- - * dev The address of the PHY to be queried.
- - * data The value to be placed on the MII bus.
- - * num_bits The number of bits in data that are to
- - * be placed on the MII bus.
- - *
- - * This function sends on sequence of bits on the MII
- - * configuration bus.
- - *
- - **************************************************************/
- -
- -void TLan_MiiSendData( u16 base_port, u32 data, unsigned num_bits )
- -{
- - u16 sio;
- - u32 i;
- -
- - if ( num_bits == 0 )
- - return;
- -
- - outw( TLAN_NET_SIO, base_port + TLAN_DIO_ADR );
- - sio = base_port + TLAN_DIO_DATA + TLAN_NET_SIO;
- - TLan_SetBit( TLAN_NET_SIO_MTXEN, sio );
- -
- - for ( i = ( 0x1 << ( num_bits - 1 ) ); i; i >>= 1 ) {
- - TLan_ClearBit( TLAN_NET_SIO_MCLK, sio );
- - (void) TLan_GetBit( TLAN_NET_SIO_MCLK, sio );
- - if ( data & i )
- - TLan_SetBit( TLAN_NET_SIO_MDATA, sio );
- - else
- - TLan_ClearBit( TLAN_NET_SIO_MDATA, sio );
- - TLan_SetBit( TLAN_NET_SIO_MCLK, sio );
- - (void) TLan_GetBit( TLAN_NET_SIO_MCLK, sio );
- - }
- -
- -} /* TLan_MiiSendData */
- -
- - /***************************************************************
- - * TLan_MiiSync
- - *
- - * Returns:
- - * Nothing
- - * Parms:
- - * base_port The base IO port of the adapter in
- - * question.
- - *
- - * This functions syncs all PHYs in terms of the MII configuration
- - * bus.
- - *
- - **************************************************************/
- -
- -void TLan_MiiSync( u16 base_port )
- -{
- - int i;
- - u16 sio;
- -
- - outw( TLAN_NET_SIO, base_port + TLAN_DIO_ADR );
- - sio = base_port + TLAN_DIO_DATA + TLAN_NET_SIO;
- -
- - TLan_ClearBit( TLAN_NET_SIO_MTXEN, sio );
- - for ( i = 0; i < 32; i++ ) {
- - TLan_ClearBit( TLAN_NET_SIO_MCLK, sio );
- - TLan_SetBit( TLAN_NET_SIO_MCLK, sio );
- - }
- -
- -} /* TLan_MiiSync */
- -
- - /***************************************************************
- - * TLan_MiiWriteReg
- - *
- - * Returns:
- - * Nothing
- - * Parms:
- - * dev The device structure for the device
- - * to write to.
- - * phy The address of the PHY to be written to.
- - * reg The register whose contents are to be
- - * written.
- - * val The value to be written to the register.
- - *
- - * This function uses the TLAN's MII bus to write the contents of a
- - * given register on a PHY. It sends the appropriate info and then
- - * writes the 16-bit register value from the MII configuration bus
- - * via the TLAN SIO register.
- - *
- - **************************************************************/
- -
- -void TLan_MiiWriteReg( struct net_device *dev, u16 phy, u16 reg, u16 val )
- -{
- - u16 sio;
- - int minten;
- - unsigned long flags = 0;
- - TLanPrivateInfo *priv = dev->priv;
- -
- - outw(TLAN_NET_SIO, dev->base_addr + TLAN_DIO_ADR);
- - sio = dev->base_addr + TLAN_DIO_DATA + TLAN_NET_SIO;
- -
- - if (!in_irq())
- - spin_lock_irqsave(&priv->lock, flags);
- -
- - TLan_MiiSync( dev->base_addr );
- -
- - minten = TLan_GetBit( TLAN_NET_SIO_MINTEN, sio );
- - if ( minten )
- - TLan_ClearBit( TLAN_NET_SIO_MINTEN, sio );
- -
- - TLan_MiiSendData( dev->base_addr, 0x1, 2 ); /* Start ( 01b ) */
- - TLan_MiiSendData( dev->base_addr, 0x1, 2 ); /* Write ( 01b ) */
- - TLan_MiiSendData( dev->base_addr, phy, 5 ); /* Device # */
- - TLan_MiiSendData( dev->base_addr, reg, 5 ); /* Register # */
- -
- - TLan_MiiSendData( dev->base_addr, 0x2, 2 ); /* Send ACK */
- - TLan_MiiSendData( dev->base_addr, val, 16 ); /* Send Data */
- -
- - TLan_ClearBit( TLAN_NET_SIO_MCLK, sio ); /* Idle cycle */
- - TLan_SetBit( TLAN_NET_SIO_MCLK, sio );
- -
- - if ( minten )
- - TLan_SetBit( TLAN_NET_SIO_MINTEN, sio );
- -
- - if (!in_irq())
- - spin_unlock_irqrestore(&priv->lock, flags);
- -
- -} /* TLan_MiiWriteReg */
- -#endif
- -
- -/**************************************************************************
- -RESET - Reset adapter
- -***************************************************************************/
- -static void skel_reset(struct nic *nic)
- -{
- - /* put the card in its initial state */
- -}
- -
- -/**************************************************************************
- -POLL - Wait for a frame
- -***************************************************************************/
- -static int skel_poll(struct nic *nic)
- -{
- - /* return true if there's an ethernet packet ready to read */
- - /* nic->packet should contain data on return */
- - /* nic->packetlen should contain length of data */
- - return (0); /* initially as this is called to flush the input */
- -}
- -
- -/**************************************************************************
- -TRANSMIT - Transmit a frame
- -***************************************************************************/
- -static void skel_transmit(
- - struct nic *nic,
- - const char *d, /* Destination */
- - unsigned int t, /* Type */
- - unsigned int s, /* size */
- - const char *p) /* Packet */
- -{
- - /* send the packet to destination */
- -}
- -
- -/**************************************************************************
- -DISABLE - Turn off ethernet interface
- -***************************************************************************/
- -static void skel_disable(struct nic *nic)
- -{
- -}
- -
- -/**************************************************************************
- -PROBE - Look for an adapter, this routine's visible to the outside
- -You should omit the last argument struct pci_device * for a non-PCI NIC
- -***************************************************************************/
- -struct nic *tlan_probe(struct nic *nic, unsigned short *probe_addrs,
- - struct pci_device *p)
- -{
- - /* if probe_addrs is 0, then routine can use a hardwired default */
- - /* if board found */
- - {
- - /* point to NIC specific routines */
- - nic->reset = skel_reset;
- - nic->poll = skel_poll;
- - nic->transmit = skel_transmit;
- - nic->disable = skel_disable;
- - return nic;
- - }
- - /* else */
- - return 0;
- -}
- -
- -#if 0
- -#ifndef TLAN_H
- -#define TLAN_H
- -/********************************************************************
- - *
- - * Linux ThunderLAN Driver
- - *
- - * tlan.h
- - * by James Banks
- - *
- - * (C) 1997-1998 Caldera, Inc.
- - * (C) 1999-2001 Torben Mathiasen
- - *
- - * This software may be used and distributed according to the terms
- - * of the GNU General Public License, incorporated herein by reference.
- - *
- - ** This file is best viewed/edited with tabstop=4, colums>=132
- - *
- - *
- - * Dec 10, 1999 Torben Mathiasen <torben.mathiasen@compaq.com>
- - * New Maintainer
- - *
- - ********************************************************************/
- -
- -#include <asm/io.h>
- -#include <asm/types.h>
- -#include <linux/netdevice.h>
- -
- -#define FALSE 0
- -#define TRUE 1
- -
- -#define TX_TIMEOUT (10*HZ) /* We need time for auto-neg */
- -
- -typedef struct tlan_adapter_entry {
- - u16 vendorId;
- - u16 deviceId;
- - char *deviceLabel;
- - u32 flags;
- - u16 addrOfs;
- -} TLanAdapterEntry;
- -
- - /*****************************************************************
- - * EISA Definitions
- - *
- - ****************************************************************/
- -
- -#define EISA_ID 0xc80 /* EISA ID Registers */
- -#define EISA_ID0 0xc80 /* EISA ID Register 0 */
- -#define EISA_ID1 0xc81 /* EISA ID Register 1 */
- -#define EISA_ID2 0xc82 /* EISA ID Register 2 */
- -#define EISA_ID3 0xc83 /* EISA ID Register 3 */
- -#define EISA_CR 0xc84 /* EISA Control Register */
- -#define EISA_REG0 0xc88 /* EISA Configuration Register 0 */
- -#define EISA_REG1 0xc89 /* EISA Configuration Register 1 */
- -#define EISA_REG2 0xc8a /* EISA Configuration Register 2 */
- -#define EISA_REG3 0xc8f /* EISA Configuration Register 3 */
- -#define EISA_APROM 0xc90 /* Ethernet Address PROM */
- -
- - /*****************************************************************
- - * Rx/Tx List Definitions
- - *
- - ****************************************************************/
- -
- -typedef struct tlan_buffer_ref_tag {
- - u32 count;
- - u32 address;
- -} TLanBufferRef;
- -
- -typedef struct tlan_list_tag {
- - u32 forward;
- - u16 cStat;
- - u16 frameSize;
- - TLanBufferRef buffer[TLAN_BUFFERS_PER_LIST];
- -} TLanList;
- -
- -typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE];
- -
- - /*****************************************************************
- - * TLAN Private Information Structure
- - *
- - ****************************************************************/
- -
- -typedef struct tlan_private_tag {
- - struct net_device *nextDevice;
- - void *dmaStorage;
- - u8 *padBuffer;
- - TLanList *rxList;
- - u8 *rxBuffer;
- - u32 rxHead;
- - u32 rxTail;
- - u32 rxEocCount;
- - TLanList *txList;
- - u8 *txBuffer;
- - u32 txHead;
- - u32 txInProgress;
- - u32 txTail;
- - u32 txBusyCount;
- - u32 phyOnline;
- - u32 timerSetAt;
- - u32 timerType;
- - struct timer_list timer;
- - struct net_device_stats stats;
- - struct board *adapter;
- - u32 adapterRev;
- - u32 aui;
- - u32 debug;
- - u32 duplex;
- - u32 phy[2];
- - u32 phyNum;
- - u32 speed;
- - u8 tlanRev;
- - u8 tlanFullDuplex;
- - char devName[8];
- - spinlock_t lock;
- - u8 link;
- - u8 is_eisa;
- - struct tq_struct tlan_tqueue;
- - u8 neg_be_verbose;
- -} TLanPrivateInfo;
- -
- -#define TLAN_HC_GO 0x80000000
- -#define TLAN_HC_STOP 0x40000000
- -#define TLAN_HC_ACK 0x20000000
- -#define TLAN_HC_CS_MASK 0x1FE00000
- -#define TLAN_HC_EOC 0x00100000
- -#define TLAN_HC_RT 0x00080000
- -#define TLAN_HC_NES 0x00040000
- -#define TLAN_HC_AD_RST 0x00008000
- -#define TLAN_HC_LD_TMR 0x00004000
- -#define TLAN_HC_LD_THR 0x00002000
- -#define TLAN_HC_REQ_INT 0x00001000
- -#define TLAN_HC_INT_OFF 0x00000800
- -#define TLAN_HC_INT_ON 0x00000400
- -#define TLAN_HC_AC_MASK 0x000000FF
- -#define TLAN_DA_ADR_INC 0x8000
- -#define TLAN_DA_RAM_ADR 0x4000
- -#define TLAN_HI_IV_MASK 0x1FE0
- -#define TLAN_HI_IT_MASK 0x001C
- -
- -#define TLAN_NET_CMD_NRESET 0x80
- -#define TLAN_NET_CMD_NWRAP 0x40
- -#define TLAN_NET_CMD_CSF 0x20
- -#define TLAN_NET_CMD_CAF 0x10
- -#define TLAN_NET_CMD_NOBRX 0x08
- -#define TLAN_NET_CMD_DUPLEX 0x04
- -#define TLAN_NET_CMD_TRFRAM 0x02
- -#define TLAN_NET_CMD_TXPACE 0x01
- -#define TLAN_NET_SIO_MINTEN 0x80
- -#define TLAN_NET_SIO_ECLOK 0x40
- -#define TLAN_NET_SIO_ETXEN 0x20
- -#define TLAN_NET_SIO_EDATA 0x10
- -#define TLAN_NET_SIO_NMRST 0x08
- -#define TLAN_NET_SIO_MCLK 0x04
- -#define TLAN_NET_SIO_MTXEN 0x02
- -#define TLAN_NET_SIO_MDATA 0x01
- -#define TLAN_NET_STS_MIRQ 0x80
- -#define TLAN_NET_STS_HBEAT 0x40
- -#define TLAN_NET_STS_TXSTOP 0x20
- -#define TLAN_NET_STS_RXSTOP 0x10
- -#define TLAN_NET_STS_RSRVD 0x0F
- -#define TLAN_NET_MASK_MASK7 0x80
- -#define TLAN_NET_MASK_MASK6 0x40
- -#define TLAN_NET_MASK_MASK5 0x20
- -#define TLAN_NET_MASK_MASK4 0x10
- -#define TLAN_NET_MASK_RSRVD 0x0F
- -#define TLAN_NET_CFG_RCLK 0x8000
- -#define TLAN_NET_CFG_TCLK 0x4000
- -#define TLAN_NET_CFG_BIT 0x2000
- -#define TLAN_NET_CFG_RXCRC 0x1000
- -#define TLAN_NET_CFG_PEF 0x0800
- -#define TLAN_NET_CFG_1FRAG 0x0400
- -#define TLAN_NET_CFG_1CHAN 0x0200
- -#define TLAN_NET_CFG_MTEST 0x0100
- -#define TLAN_NET_CFG_PHY_EN 0x0080
- -#define TLAN_NET_CFG_MSMASK 0x007F
- -#define TLAN_LED_ACT 0x10
- -#define TLAN_LED_LINK 0x01
- -#define TLAN_ID_TX_EOC 0x04
- -#define TLAN_ID_RX_EOF 0x02
- -#define TLAN_ID_RX_EOC 0x01
- -
- -#define CIRC_INC( a, b ) if ( ++a >= b ) a = 0
- -
- -#ifdef I_LIKE_A_FAST_HASH_FUNCTION
- -/* given 6 bytes, view them as 8 6-bit numbers and return the XOR of those */
- -/* the code below is about seven times as fast as the original code */
- -inline u32 TLan_HashFunc( u8 *a )
- -{
- - u8 hash;
- -
- - hash = (a[0]^a[3]); /* & 077 */
- - hash ^= ((a[0]^a[3])>>6); /* & 003 */
- - hash ^= ((a[1]^a[4])<<2); /* & 074 */
- - hash ^= ((a[1]^a[4])>>4); /* & 017 */
- - hash ^= ((a[2]^a[5])<<4); /* & 060 */
- - hash ^= ((a[2]^a[5])>>2); /* & 077 */
- -
- - return (hash & 077);
- -}
- -
- -#else /* original code */
- -
- -inline u32 xor( u32 a, u32 b )
- -{
- - return ( ( a && ! b ) || ( ! a && b ) );
- -}
- -#define XOR8( a, b, c, d, e, f, g, h ) xor( a, xor( b, xor( c, xor( d, xor( e, xor( f, xor( g, h ) ) ) ) ) ) )
- -#define DA( a, bit ) ( ( (u8) a[bit/8] ) & ( (u8) ( 1 << bit%8 ) ) )
- -
- -inline u32 TLan_HashFunc( u8 *a )
- -{
- - u32 hash;
- -
- - hash = XOR8( DA(a,0), DA(a, 6), DA(a,12), DA(a,18), DA(a,24), DA(a,30), DA(a,36), DA(a,42) );
- - hash |= XOR8( DA(a,1), DA(a, 7), DA(a,13), DA(a,19), DA(a,25), DA(a,31), DA(a,37), DA(a,43) ) << 1;
- - hash |= XOR8( DA(a,2), DA(a, 8), DA(a,14), DA(a,20), DA(a,26), DA(a,32), DA(a,38), DA(a,44) ) << 2;
- - hash |= XOR8( DA(a,3), DA(a, 9), DA(a,15), DA(a,21), DA(a,27), DA(a,33), DA(a,39), DA(a,45) ) << 3;
- - hash |= XOR8( DA(a,4), DA(a,10), DA(a,16), DA(a,22), DA(a,28), DA(a,34), DA(a,40), DA(a,46) ) << 4;
- - hash |= XOR8( DA(a,5), DA(a,11), DA(a,17), DA(a,23), DA(a,29), DA(a,35), DA(a,41), DA(a,47) ) << 5;
- -
- - return hash;
- -
- -}
- -
- -#endif /* I_LIKE_A_FAST_HASH_FUNCTION */
- -#endif
- -/*******************************************************************************
- - *
- - * Linux ThunderLAN Driver
- - *
- - * tlan.c
- - * by James Banks
- - *
- - * (C) 1997-1998 Caldera, Inc.
- - * (C) 1998 James Banks
- - * (C) 1999-2001 Torben Mathiasen
- - *
- - * This software may be used and distributed according to the terms
- - * of the GNU General Public License, incorporated herein by reference.
- - *
- - ** This file is best viewed/edited with columns>=132.
- - *
- - ** Useful (if not required) reading:
- - *
- - * Texas Instruments, ThunderLAN Programmer's Guide,
- - * TI Literature Number SPWU013A
- - * available in PDF format from www.ti.com
- - * Level One, LXT901 and LXT970 Data Sheets
- - * available in PDF format from www.level1.com
- - * National Semiconductor, DP83840A Data Sheet
- - * available in PDF format from www.national.com
- - * Microchip Technology, 24C01A/02A/04A Data Sheet
- - * available in PDF format from www.microchip.com
- - *
- - * Change History
- - *
- - * Tigran Aivazian <tigran@sco.com>: TLan_PciProbe() now uses
- - * new PCI BIOS interface.
- - * Alan Cox <alan@redhat.com>: Fixed the out of memory
- - * handling.
- - *
- - * Torben Mathiasen <torben.mathiasen@compaq.com> New Maintainer!
- - *
- - * v1.1 Dec 20, 1999 - Removed linux version checking
- - * Patch from Tigran Aivazian.
- - * - v1.1 includes Alan's SMP updates.
- - * - We still have problems on SMP though,
- - * but I'm looking into that.
- - *
- - * v1.2 Jan 02, 2000 - Hopefully fixed the SMP deadlock.
- - * - Removed dependency of HZ being 100.
- - * - We now allow higher priority timers to
- - * overwrite timers like TLAN_TIMER_ACTIVITY
- - * Patch from John Cagle <john.cagle@compaq.com>.
- - * - Fixed a few compiler warnings.
- - *
- - * v1.3 Feb 04, 2000 - Fixed the remaining HZ issues.
- - * - Removed call to pci_present().
- - * - Removed SA_INTERRUPT flag from irq handler.
- - * - Added __init and __initdata to reduce resisdent
- - * code size.
- - * - Driver now uses module_init/module_exit.
- - * - Rewrote init_module and tlan_probe to
- - * share a lot more code. We now use tlan_probe
- - * with builtin and module driver.
- - * - Driver ported to new net API.
- - * - tlan.txt has been reworked to reflect current
- - * driver (almost)
- - * - Other minor stuff
- - *
- - * v1.4 Feb 10, 2000 - Updated with more changes required after Dave's
- - * network cleanup in 2.3.43pre7 (Tigran & myself)
- - * - Minor stuff.
- - *
- - * v1.5 March 22, 2000 - Fixed another timer bug that would hang the driver
- - * if no cable/link were present.
- - * - Cosmetic changes.
- - * - TODO: Port completely to new PCI/DMA API
- - * Auto-Neg fallback.
- - *
- - * v1.6 April 04, 2000 - Fixed driver support for kernel-parameters. Haven't
- - * tested it though, as the kernel support is currently
- - * broken (2.3.99p4p3).
- - * - Updated tlan.txt accordingly.
- - * - Adjusted minimum/maximum frame length.
- - * - There is now a TLAN website up at
- - * http://tlan.kernel.dk
- - *
- - * v1.7 April 07, 2000 - Started to implement custom ioctls. Driver now
- - * reports PHY information when used with Donald
- - * Beckers userspace MII diagnostics utility.
- - *
- - * v1.8 April 23, 2000 - Fixed support for forced speed/duplex settings.
- - * - Added link information to Auto-Neg and forced
- - * modes. When NIC operates with auto-neg the driver
- - * will report Link speed & duplex modes as well as
- - * link partner abilities. When forced link is used,
- - * the driver will report status of the established
- - * link.
- - * Please read tlan.txt for additional information.
- - * - Removed call to check_region(), and used
- - * return value of request_region() instead.
- - *
- - * v1.8a May 28, 2000 - Minor updates.
- - *
- - * v1.9 July 25, 2000 - Fixed a few remaining Full-Duplex issues.
- - * - Updated with timer fixes from Andrew Morton.
- - * - Fixed module race in TLan_Open.
- - * - Added routine to monitor PHY status.
- - * - Added activity led support for Proliant devices.
- - *
- - * v1.10 Aug 30, 2000 - Added support for EISA based tlan controllers
- - * like the Compaq NetFlex3/E.
- - * - Rewrote tlan_probe to better handle multiple
- - * bus probes. Probing and device setup is now
- - * done through TLan_Probe and TLan_init_one. Actual
- - * hardware probe is done with kernel API and
- - * TLan_EisaProbe.
- - * - Adjusted debug information for probing.
- - * - Fixed bug that would cause general debug information
- - * to be printed after driver removal.
- - * - Added transmit timeout handling.
- - * - Fixed OOM return values in tlan_probe.
- - * - Fixed possible mem leak in tlan_exit
- - * (now tlan_remove_one).
- - * - Fixed timer bug in TLan_phyMonitor.
- - * - This driver version is alpha quality, please
- - * send me any bug issues you may encounter.
- - *
- - * v1.11 Aug 31, 2000 - Do not try to register irq 0 if no irq line was
- - * set for EISA cards.
- - * - Added support for NetFlex3/E with nibble-rate
- - * 10Base-T PHY. This is untestet as I haven't got
- - * one of these cards.
- - * - Fixed timer being added twice.
- - * - Disabled PhyMonitoring by default as this is
- - * work in progress. Define MONITOR to enable it.
- - * - Now we don't display link info with PHYs that
- - * doesn't support it (level1).
- - * - Incresed tx_timeout beacuse of auto-neg.
- - * - Adjusted timers for forced speeds.
- - *
- - * v1.12 Oct 12, 2000 - Minor fixes (memleak, init, etc.)
- - *
- - * v1.13 Nov 28, 2000 - Stop flooding console with auto-neg issues
- - * when link can't be established.
- - * - Added the bbuf option as a kernel parameter.
- - * - Fixed ioaddr probe bug.
- - * - Fixed stupid deadlock with MII interrupts.
- - * - Added support for speed/duplex selection with
- - * multiple nics.
- - * - Added partly fix for TX Channel lockup with
- - * TLAN v1.0 silicon. This needs to be investigated
- - * further.
- - *
- - * v1.14 Dec 16, 2000 - Added support for servicing multiple frames per.
- - * interrupt. Thanks goes to
- - * Adam Keys <adam@ti.com>
- - * Denis Beaudoin <dbeaudoin@ti.com>
- - * for providing the patch.
- - * - Fixed auto-neg output when using multiple
- - * adapters.
- - * - Converted to use new taskq interface.
- - *
- - * v1.14a Jan 6, 2001 - Minor adjustments (spinlocks, etc.)
- - *
- - *******************************************************************************/
- -
- -
- -#include <linux/module.h>
- -
- -#include "tlan.h"
- -
- -#include <linux/init.h>
- -#include <linux/ioport.h>
- -#include <linux/pci.h>
- -#include <linux/etherdevice.h>
- -#include <linux/delay.h>
- -#include <linux/spinlock.h>
- -#include <linux/mii.h>
- -
- -typedef u32 (TLanIntVectorFunc)( struct net_device *, u16 );
- -
- -/* For removing EISA devices */
- -static struct net_device *TLan_Eisa_Devices;
- -
- -static int TLanDevicesInstalled;
- -
- -/* Set speed, duplex and aui settings */
- -static int aui[MAX_TLAN_BOARDS];
- -static int duplex[MAX_TLAN_BOARDS];
- -static int speed[MAX_TLAN_BOARDS];
- -static int boards_found;
- -
- -MODULE_AUTHOR("Maintainer: Torben Mathiasen <torben.mathiasen@compaq.com>");
- -MODULE_DESCRIPTION("Driver for TI ThunderLAN based ethernet PCI adapters");
- -MODULE_LICENSE("GPL");
- -
- -MODULE_PARM(aui, "1-" __MODULE_STRING(MAX_TLAN_BOARDS) "i");
- -MODULE_PARM(duplex, "1-" __MODULE_STRING(MAX_TLAN_BOARDS) "i");
- -MODULE_PARM(speed, "1-" __MODULE_STRING(MAX_TLAN_BOARDS) "i");
- -MODULE_PARM(debug, "i");
- -MODULE_PARM(bbuf, "i");
- -MODULE_PARM_DESC(aui, "ThunderLAN use AUI port(s) (0-1)");
- -MODULE_PARM_DESC(duplex, "ThunderLAN duplex setting(s) (0-default, 1-half, 2-full)");
- -MODULE_PARM_DESC(speed, "ThunderLAN port speen setting(s) (0,10,100)");
- -MODULE_PARM_DESC(debug, "ThunderLAN debug mask");
- -MODULE_PARM_DESC(bbuf, "ThunderLAN use big buffer (0-1)");
- -EXPORT_NO_SYMBOLS;
- -
- -/* Define this to enable Link beat monitoring */
- -#undef MONITOR
- -
- -/* Turn on debugging. See linux/Documentation/networking/tlan.txt for details */
- -static int debug;
- -
- -static int bbuf;
- -static u8 *TLanPadBuffer;
- -static char TLanSignature[] = "TLAN";
- -static const char tlan_banner[] = "ThunderLAN driver v1.14a\n";
- -static int tlan_have_pci;
- -static int tlan_have_eisa;
- -
- -const char *media[] = {
- - "10BaseT-HD ", "10BaseT-FD ","100baseTx-HD ",
- - "100baseTx-FD", "100baseT4", 0
- -};
- -
- -int media_map[] = { 0x0020, 0x0040, 0x0080, 0x0100, 0x0200,};
- -
- -static struct board {
- - const char *deviceLabel;
- - u32 flags;
- - u16 addrOfs;
- -} board_info[] __devinitdata = {
- - { "Compaq Netelligent 10 T PCI UTP", TLAN_ADAPTER_ACTIVITY_LED, 0x83 },
- - { "Compaq Netelligent 10/100 TX PCI UTP", TLAN_ADAPTER_ACTIVITY_LED, 0x83 },
- - { "Compaq Integrated NetFlex-3/P", TLAN_ADAPTER_NONE, 0x83 },
- - { "Compaq NetFlex-3/P", TLAN_ADAPTER_UNMANAGED_PHY | TLAN_ADAPTER_BIT_RATE_PHY, 0x83 },
- - { "Compaq NetFlex-3/P", TLAN_ADAPTER_NONE, 0x83 },
- - { "Compaq Netelligent Integrated 10/100 TX UTP", TLAN_ADAPTER_ACTIVITY_LED, 0x83 },
- - { "Compaq Netelligent Dual 10/100 TX PCI UTP", TLAN_ADAPTER_NONE, 0x83 },
- - { "Compaq Netelligent 10/100 TX Embedded UTP", TLAN_ADAPTER_NONE, 0x83 },
- - { "Olicom OC-2183/2185", TLAN_ADAPTER_USE_INTERN_10, 0x83 },
- - { "Olicom OC-2325", TLAN_ADAPTER_UNMANAGED_PHY, 0xF8 },
- - { "Olicom OC-2326", TLAN_ADAPTER_USE_INTERN_10, 0xF8 },
- - { "Compaq Netelligent 10/100 TX UTP", TLAN_ADAPTER_ACTIVITY_LED, 0x83 },
- - { "Compaq Netelligent 10 T/2 PCI UTP/Coax", TLAN_ADAPTER_NONE, 0x83 },
- - { "Compaq NetFlex-3/E", TLAN_ADAPTER_ACTIVITY_LED | /* EISA card */
- - TLAN_ADAPTER_UNMANAGED_PHY | TLAN_ADAPTER_BIT_RATE_PHY, 0x83 },
- - { "Compaq NetFlex-3/E", TLAN_ADAPTER_ACTIVITY_LED, 0x83 }, /* EISA card */
- -};
- -
- -static struct pci_device_id tlan_pci_tbl[] __devinitdata = {
- - { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_NETEL10,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
- - { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_NETEL100,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },
- - { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_NETFLEX3I,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 },
- - { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_THUNDER,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3 },
- - { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_NETFLEX3B,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 },
- - { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_NETEL100PI,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5 },
- - { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_NETEL100D,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6 },
- - { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_NETEL100I,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 7 },
- - { PCI_VENDOR_ID_OLICOM, PCI_DEVICE_ID_OLICOM_OC2183,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 },
- - { PCI_VENDOR_ID_OLICOM, PCI_DEVICE_ID_OLICOM_OC2325,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9 },
- - { PCI_VENDOR_ID_OLICOM, PCI_DEVICE_ID_OLICOM_OC2326,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 10 },
- - { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_NETELLIGENT_10_100_WS_5100,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 11 },
- - { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_NETELLIGENT_10_T2,
- - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12 },
- - { 0,}
- -};
- -MODULE_DEVICE_TABLE(pci, tlan_pci_tbl);
- -
- -static void TLan_EisaProbe( void );
- -static void TLan_Eisa_Cleanup( void );
- -static int TLan_Init( struct net_device * );
- -static int TLan_Open( struct net_device *dev );
- -static int TLan_StartTx( struct sk_buff *, struct net_device *);
- -static void TLan_HandleInterrupt( int, void *, struct pt_regs *);
- -static int TLan_Close( struct net_device *);
- -static struct net_device_stats *TLan_GetStats( struct net_device *);
- -static void TLan_SetMulticastList( struct net_device *);
- -static int TLan_ioctl( struct net_device *dev, struct ifreq *rq, int cmd);
- -static int TLan_probe1( struct pci_dev *pdev, long ioaddr, int irq, int rev, const struct pci_device_id *ent);
- -static void TLan_tx_timeout( struct net_device *dev);
- -static int tlan_init_one( struct pci_dev *pdev, const struct pci_device_id *ent);
- -
- -static u32 TLan_HandleInvalid( struct net_device *, u16 );
- -static u32 TLan_HandleTxEOF( struct net_device *, u16 );
- -static u32 TLan_HandleStatOverflow( struct net_device *, u16 );
- -static u32 TLan_HandleRxEOF( struct net_device *, u16 );
- -static u32 TLan_HandleDummy( struct net_device *, u16 );
- -static u32 TLan_HandleTxEOC( struct net_device *, u16 );
- -static u32 TLan_HandleStatusCheck( struct net_device *, u16 );
- -static u32 TLan_HandleRxEOC( struct net_device *, u16 );
- -
- -static void TLan_Timer( unsigned long );
- -
- -static void TLan_ResetLists( struct net_device * );
- -static void TLan_FreeLists( struct net_device * );
- -static void TLan_PrintDio( u16 );
- -static void TLan_PrintList( TLanList *, char *, int );
- -static void TLan_ReadAndClearStats( struct net_device *, int );
- -static void TLan_ResetAdapter( struct net_device * );
- -static void TLan_FinishReset( struct net_device * );
- -static void TLan_SetMac( struct net_device *, int areg, char *mac );
- -
- -static void TLan_PhyPrint( struct net_device * );
- -static void TLan_PhyDetect( struct net_device * );
- -static void TLan_PhyPowerDown( struct net_device * );
- -static void TLan_PhyPowerUp( struct net_device * );
- -static void TLan_PhyReset( struct net_device * );
- -static void TLan_PhyStartLink( struct net_device * );
- -static void TLan_PhyFinishAutoNeg( struct net_device * );
- -#ifdef MONITOR
- -static void TLan_PhyMonitor( struct net_device * );
- -#endif
- -
- -/*
- -static int TLan_PhyNop( struct net_device * );
- -static int TLan_PhyInternalCheck( struct net_device * );
- -static int TLan_PhyInternalService( struct net_device * );
- -static int TLan_PhyDp83840aCheck( struct net_device * );
- -*/
- -
- -static int TLan_MiiReadReg( struct net_device *, u16, u16, u16 * );
- -static void TLan_MiiSendData( u16, u32, unsigned );
- -static void TLan_MiiSync( u16 );
- -static void TLan_MiiWriteReg( struct net_device *, u16, u16, u16 );
- -
- -static void TLan_EeSendStart( u16 );
- -static int TLan_EeSendByte( u16, u8, int );
- -static void TLan_EeReceiveByte( u16, u8 *, int );
- -static int TLan_EeReadByte( struct net_device *, u8, u8 * );
- -
- -static TLanIntVectorFunc *TLanIntVector[TLAN_INT_NUMBER_OF_INTS] = {
- - TLan_HandleInvalid,
- - TLan_HandleTxEOF,
- - TLan_HandleStatOverflow,
- - TLan_HandleRxEOF,
- - TLan_HandleDummy,
- - TLan_HandleTxEOC,
- - TLan_HandleStatusCheck,
- - TLan_HandleRxEOC
- -};
- -
- -static inline void
- -TLan_SetTimer( struct net_device *dev, u32 ticks, u32 type )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - unsigned long flags = 0;
- -
- - if (!in_irq())
- - spin_lock_irqsave(&priv->lock, flags);
- - if ( priv->timer.function != NULL &&
- - priv->timerType != TLAN_TIMER_ACTIVITY ) {
- - if (!in_irq())
- - spin_unlock_irqrestore(&priv->lock, flags);
- - return;
- - }
- - priv->timer.function = &TLan_Timer;
- - if (!in_irq())
- - spin_unlock_irqrestore(&priv->lock, flags);
- -
- - priv->timer.data = (unsigned long) dev;
- - priv->timerSetAt = jiffies;
- - priv->timerType = type;
- - mod_timer(&priv->timer, jiffies + ticks);
- -
- -} /* TLan_SetTimer */
- -
- -/*****************************************************************************
- -******************************************************************************
- -
- - ThunderLAN Driver Primary Functions
- -
- - These functions are more or less common to all Linux network drivers.
- -
- -******************************************************************************
- -*****************************************************************************/
- -
- - /***************************************************************
- - * tlan_remove_one
- - *
- - * Returns:
- - * Nothing
- - * Parms:
- - * None
- - *
- - * Goes through the TLanDevices list and frees the device
- - * structs and memory associated with each device (lists
- - * and buffers). It also ureserves the IO port regions
- - * associated with this device.
- - *
- - **************************************************************/
- -
- -static void __devexit tlan_remove_one( struct pci_dev *pdev)
- -{
- - struct net_device *dev = pci_get_drvdata( pdev );
- - TLanPrivateInfo *priv = dev->priv;
- -
- - unregister_netdev( dev );
- -
- - if ( priv->dmaStorage ) {
- - kfree( priv->dmaStorage );
- - }
- -
- - release_region( dev->base_addr, 0x10 );
- -
- - kfree( dev );
- -
- - pci_set_drvdata( pdev, NULL );
- -}
- -
- -static struct pci_driver tlan_driver = {
- - name: "tlan",
- - id_table: tlan_pci_tbl,
- - probe: tlan_init_one,
- - remove: tlan_remove_one,
- -};
- -
- -static int __init tlan_probe(void)
- -{
- - static int pad_allocated;
- -
- - printk(KERN_INFO "%s", tlan_banner);
- -
- - TLanPadBuffer = (u8 *) kmalloc(TLAN_MIN_FRAME_SIZE,
- - GFP_KERNEL);
- -
- - if (TLanPadBuffer == NULL) {
- - printk(KERN_ERR "TLAN: Could not allocate memory for pad buffer.\n");
- - return -ENOMEM;
- - }
- -
- - memset(TLanPadBuffer, 0, TLAN_MIN_FRAME_SIZE);
- - pad_allocated = 1;
- -
- - TLAN_DBG(TLAN_DEBUG_PROBE, "Starting PCI Probe....\n");
- -
- - /* Use new style PCI probing. Now the kernel will
- - do most of this for us */
- - pci_register_driver(&tlan_driver);
- -
- - TLAN_DBG(TLAN_DEBUG_PROBE, "Starting EISA Probe....\n");
- - TLan_EisaProbe();
- -
- - printk(KERN_INFO "TLAN: %d device%s installed, PCI: %d EISA: %d\n",
- - TLanDevicesInstalled, TLanDevicesInstalled == 1 ? "" : "s",
- - tlan_have_pci, tlan_have_eisa);
- -
- - if (TLanDevicesInstalled == 0) {
- - pci_unregister_driver(&tlan_driver);
- - kfree(TLanPadBuffer);
- - return -ENODEV;
- - }
- - return 0;
- -}
- -
- -
- -static int __devinit tlan_init_one( struct pci_dev *pdev,
- - const struct pci_device_id *ent)
- -{
- - return TLan_probe1( pdev, -1, -1, 0, ent);
- -}
- -
- -/*
- - ***************************************************************
- - * tlan_probe1
- - *
- - * Returns:
- - * 0 on success, error code on error
- - * Parms:
- - * none
- - *
- - * The name is lower case to fit in with all the rest of
- - * the netcard_probe names. This function looks for
- - * another TLan based adapter, setting it up with the
- - * allocated device struct if one is found.
- - * tlan_probe has been ported to the new net API and
- - * now allocates its own device structure. This function
- - * is also used by modules.
- - *
- - **************************************************************/
- -
- -static int __devinit TLan_probe1(struct pci_dev *pdev,
- - long ioaddr, int irq, int rev, const struct pci_device_id *ent )
- -{
- -
- - struct net_device *dev;
- - TLanPrivateInfo *priv;
- - u8 pci_rev;
- - u16 device_id;
- - int reg;
- -
- - if (pdev && pci_enable_device(pdev))
- - return -EIO;
- -
- - dev = init_etherdev(NULL, sizeof(TLanPrivateInfo));
- - if (dev == NULL) {
- - printk(KERN_ERR "TLAN: Could not allocate memory for device.\n");
- - return -ENOMEM;
- - }
- - SET_MODULE_OWNER(dev);
- -
- - priv = dev->priv;
- -
- - /* Is this a PCI device? */
- - if (pdev) {
- - u32 pci_io_base = 0;
- -
- - priv->adapter = &board_info[ent->driver_data];
- -
- - pci_read_config_byte ( pdev, PCI_REVISION_ID, &pci_rev);
- -
- - for ( reg= 0; reg <= 5; reg ++ ) {
- - if (pci_resource_flags(pdev, reg) & IORESOURCE_IO) {
- - pci_io_base = pci_resource_start(pdev, reg);
- - TLAN_DBG( TLAN_DEBUG_GNRL, "IO mapping is available at %x.\n",
- - pci_io_base);
- - break;
- - }
- - }
- - if (!pci_io_base) {
- - printk(KERN_ERR "TLAN: No IO mappings available\n");
- - unregister_netdev(dev);
- - kfree(dev);
- - return -ENODEV;
- - }
- -
- - dev->base_addr = pci_io_base;
- - dev->irq = pdev->irq;
- - priv->adapterRev = pci_rev;
- - pci_set_master(pdev);
- - pci_set_drvdata(pdev, dev);
- -
- - } else { /* EISA card */
- - /* This is a hack. We need to know which board structure
- - * is suited for this adapter */
- - device_id = inw(ioaddr + EISA_ID2);
- - priv->is_eisa = 1;
- - if (device_id == 0x20F1) {
- - priv->adapter = &board_info[13]; /* NetFlex-3/E */
- - priv->adapterRev = 23; /* TLAN 2.3 */
- - } else {
- - priv->adapter = &board_info[14];
- - priv->adapterRev = 10; /* TLAN 1.0 */
- - }
- - dev->base_addr = ioaddr;
- - dev->irq = irq;
- - }
- -
- - /* Kernel parameters */
- - if (dev->mem_start) {
- - priv->aui = dev->mem_start & 0x01;
- - priv->duplex = ((dev->mem_start & 0x06) == 0x06) ? 0 : (dev->mem_start & 0x06) >> 1;
- - priv->speed = ((dev->mem_start & 0x18) == 0x18) ? 0 : (dev->mem_start & 0x18) >> 3;
- -
- - if (priv->speed == 0x1) {
- - priv->speed = TLAN_SPEED_10;
- - } else if (priv->speed == 0x2) {
- - priv->speed = TLAN_SPEED_100;
- - }
- - debug = priv->debug = dev->mem_end;
- - } else {
- - priv->aui = aui[boards_found];
- - priv->speed = speed[boards_found];
- - priv->duplex = duplex[boards_found];
- - priv->debug = debug;
- - }
- -
- - /* This will be used when we get an adapter error from
- - * within our irq handler */
- - INIT_LIST_HEAD(&priv->tlan_tqueue.list);
- - priv->tlan_tqueue.sync = 0;
- - priv->tlan_tqueue.routine = (void *)(void*)TLan_tx_timeout;
- - priv->tlan_tqueue.data = dev;
- -
- - spin_lock_init(&priv->lock);
- -
- - if (TLan_Init(dev)) {
- - printk(KERN_ERR "TLAN: Could not register device.\n");
- - unregister_netdev(dev);
- - kfree(dev);
- - return -EAGAIN;
- - } else {
- -
- - TLanDevicesInstalled++;
- - boards_found++;
- -
- - /* pdev is NULL if this is an EISA device */
- - if (pdev)
- - tlan_have_pci++;
- - else {
- - priv->nextDevice = TLan_Eisa_Devices;
- - TLan_Eisa_Devices = dev;
- - tlan_have_eisa++;
- - }
- -
- - printk(KERN_INFO "TLAN: %s irq=%2d, io=%04x, %s, Rev. %d\n",
- - dev->name,
- - (int) dev->irq,
- - (int) dev->base_addr,
- - priv->adapter->deviceLabel,
- - priv->adapterRev);
- - return 0;
- - }
- -
- -}
- +} /* TLan_FinishReset */
-
- -static void TLan_Eisa_Cleanup(void)
- -{
- - struct net_device *dev;
- - TLanPrivateInfo *priv;
- -
- - while( tlan_have_eisa ) {
- - dev = TLan_Eisa_Devices;
- - priv = dev->priv;
- - if (priv->dmaStorage) {
- - kfree(priv->dmaStorage);
- - }
- - release_region( dev->base_addr, 0x10);
- - unregister_netdev( dev );
- - TLan_Eisa_Devices = priv->nextDevice;
- - kfree( dev );
- - tlan_have_eisa--;
- - }
- -}
- -
- -
- -static void __exit tlan_exit(void)
- -{
- - pci_unregister_driver(&tlan_driver);
- -
- - if (tlan_have_eisa)
- - TLan_Eisa_Cleanup();
- -
- - kfree( TLanPadBuffer );
- -
- -}
- -
- -/* Module loading/unloading */
- -module_init(tlan_probe);
- -module_exit(tlan_exit);
- -
- - /**************************************************************
- - * TLan_EisaProbe
- - *
- - * Returns: 0 on success, 1 otherwise
- - *
- - * Parms: None
- - *
- - *
- - * This functions probes for EISA devices and calls
- - * TLan_probe1 when one is found.
- - *
- - *************************************************************/
- -
- -static void __init TLan_EisaProbe (void)
- +/**************************************************************************
- +POLL - Wait for a frame
- +***************************************************************************/
- +static int tlan_poll(struct nic *nic, int retrieve)
- {
- - long ioaddr;
- - int rc = -ENODEV;
- - int irq;
- - u16 device_id;
- -
- - if (!EISA_bus) {
- - TLAN_DBG(TLAN_DEBUG_PROBE, "No EISA bus present\n");
- - return;
- - }
- -
- - /* Loop through all slots of the EISA bus */
- - for (ioaddr = 0x1000; ioaddr < 0x9000; ioaddr += 0x1000) {
- -
- - TLAN_DBG(TLAN_DEBUG_PROBE,"EISA_ID 0x%4x: 0x%4x\n", (int) ioaddr + 0xC80, inw(ioaddr + EISA_ID));
- - TLAN_DBG(TLAN_DEBUG_PROBE,"EISA_ID 0x%4x: 0x%4x\n", (int) ioaddr + 0xC82, inw(ioaddr + EISA_ID2));
- + /* return true if there's an ethernet packet ready to read */
- + /* nic->packet should contain data on return */
- + /* nic->packetlen should contain length of data */
- + u32 framesize;
- + u32 host_cmd = 0;
- + u32 ack = 1;
- + int eoc = 0;
- + int entry = priv->cur_rx % TLAN_NUM_RX_LISTS;
- + u16 tmpCStat = le32_to_cpu(rx_ring[entry].cStat);
- + u16 host_int = inw(BASE + TLAN_HOST_INT);
-
- - TLAN_DBG(TLAN_DEBUG_PROBE, "Probing for EISA adapter at IO: 0x%4x : ",
- - (int) ioaddr);
- - if (request_region(ioaddr, 0x10, TLanSignature) == NULL)
- - goto out;
- -
- - if (inw(ioaddr + EISA_ID) != 0x110E) {
- - release_region(ioaddr, 0x10);
- - goto out;
- - }
- -
- - device_id = inw(ioaddr + EISA_ID2);
- - if (device_id != 0x20F1 && device_id != 0x40F1) {
- - release_region (ioaddr, 0x10);
- - goto out;
- - }
- -
- - if (inb(ioaddr + EISA_CR) != 0x1) { /* Check if adapter is enabled */
- - release_region (ioaddr, 0x10);
- - goto out2;
- - }
- -
- - if (debug == 0x10)
- - printk("Found one\n");
- + if ((tmpCStat & TLAN_CSTAT_FRM_CMP) && !retrieve)
- + return 1;
-
- - /* Get irq from board */
- - switch (inb(ioaddr + 0xCC0)) {
- - case(0x10):
- - irq=5;
- - break;
- - case(0x20):
- - irq=9;
- - break;
- - case(0x40):
- - irq=10;
- - break;
- - case(0x80):
- - irq=11;
- - break;
- - default:
- - goto out;
- - }
- -
- -
- - /* Setup the newly found eisa adapter */
- - rc = TLan_probe1( NULL, ioaddr, irq,
- - 12, NULL);
- - continue;
- -
- - out:
- - if (debug == 0x10)
- - printk("None found\n");
- - continue;
- -
- - out2: if (debug == 0x10)
- - printk("Card found but it is not enabled, skipping\n");
- - continue;
- -
- - }
- + outw(host_int, BASE + TLAN_HOST_INT);
-
- -} /* TLan_EisaProbe */
- + if (!(tmpCStat & TLAN_CSTAT_FRM_CMP))
- + return 0;
-
- -
- + /* printf("PI-1: 0x%hX\n", host_int); */
- + if (tmpCStat & TLAN_CSTAT_EOC)
- + eoc = 1;
-
- - /***************************************************************
- - * TLan_Init
- - *
- - * Returns:
- - * 0 on success, error code otherwise.
- - * Parms:
- - * dev The structure of the device to be
- - * init'ed.
- - *
- - * This function completes the initialization of the
- - * device structure and driver. It reserves the IO
- - * addresses, allocates memory for the lists and bounce
- - * buffers, retrieves the MAC address from the eeprom
- - * and assignes the device's methods.
- - *
- - **************************************************************/
- + framesize = rx_ring[entry].frameSize;
-
- -static int TLan_Init( struct net_device *dev )
- -{
- - int dma_size;
- - int err;
- - int i;
- - TLanPrivateInfo *priv;
- + nic->packetlen = framesize;
-
- - priv = dev->priv;
- -
- - if (!priv->is_eisa) /* EISA devices have already requested IO */
- - if (!request_region( dev->base_addr, 0x10, TLanSignature )) {
- - printk(KERN_ERR "TLAN: %s: IO port region 0x%lx size 0x%x in use.\n",
- - dev->name,
- - dev->base_addr,
- - 0x10 );
- - return -EIO;
- +#ifdef EBDEBUG
- + printf(".%d.", framesize);
- +#endif
- +
- + memcpy(nic->packet, rxb +
- + (priv->cur_rx * TLAN_MAX_FRAME_SIZE), nic->packetlen);
- +
- + rx_ring[entry].cStat = 0;
- +#ifdef EBDEBUG
- + //hex_dump(nic->packet, nic->packetlen);
- + printf("%d", entry);
- +#endif
- + entry = (entry + 1) % TLAN_NUM_RX_LISTS;
- + priv->cur_rx = entry;
- + if (eoc) {
- + if ((rx_ring[entry].cStat & TLAN_CSTAT_READY) ==
- + TLAN_CSTAT_READY) {
- + ack |= TLAN_HC_GO | TLAN_HC_RT;
- + host_cmd = TLAN_HC_ACK | ack | 0x001C0000;
- + outl(host_cmd, BASE + TLAN_HOST_CMD);
- }
- -
- - if ( bbuf ) {
- - dma_size = ( TLAN_NUM_RX_LISTS + TLAN_NUM_TX_LISTS )
- - * ( sizeof(TLanList) + TLAN_MAX_FRAME_SIZE );
- } else {
- - dma_size = ( TLAN_NUM_RX_LISTS + TLAN_NUM_TX_LISTS )
- - * ( sizeof(TLanList) );
- - }
- - priv->dmaStorage = kmalloc(dma_size, GFP_KERNEL | GFP_DMA);
- - if ( priv->dmaStorage == NULL ) {
- - printk(KERN_ERR "TLAN: Could not allocate lists and buffers for %s.\n",
- - dev->name );
- - release_region( dev->base_addr, 0x10 );
- - return -ENOMEM;
- - }
- - memset( priv->dmaStorage, 0, dma_size );
- - priv->rxList = (TLanList *)
- - ( ( ( (u32) priv->dmaStorage ) + 7 ) & 0xFFFFFFF8 );
- - priv->txList = priv->rxList + TLAN_NUM_RX_LISTS;
- - if ( bbuf ) {
- - priv->rxBuffer = (u8 *) ( priv->txList + TLAN_NUM_TX_LISTS );
- - priv->txBuffer = priv->rxBuffer
- - + ( TLAN_NUM_RX_LISTS * TLAN_MAX_FRAME_SIZE );
- - }
- -
- - err = 0;
- - for ( i = 0; i < 6 ; i++ )
- - err |= TLan_EeReadByte( dev,
- - (u8) priv->adapter->addrOfs + i,
- - (u8 *) &dev->dev_addr[i] );
- - if ( err ) {
- - printk(KERN_ERR "TLAN: %s: Error reading MAC from eeprom: %d\n",
- - dev->name,
- - err );
- - }
- - dev->addr_len = 6;
- -
- - /* Device methods */
- - dev->open = &TLan_Open;
- - dev->hard_start_xmit = &TLan_StartTx;
- - dev->stop = &TLan_Close;
- - dev->get_stats = &TLan_GetStats;
- - dev->set_multicast_list = &TLan_SetMulticastList;
- - dev->do_ioctl = &TLan_ioctl;
- - dev->tx_timeout = &TLan_tx_timeout;
- - dev->watchdog_timeo = TX_TIMEOUT;
- -
- - return 0;
- -
- -} /* TLan_Init */
- -
- - /***************************************************************
- - * TLan_Open
- - *
- - * Returns:
- - * 0 on success, error code otherwise.
- - * Parms:
- - * dev Structure of device to be opened.
- - *
- - * This routine puts the driver and TLAN adapter in a
- - * state where it is ready to send and receive packets.
- - * It allocates the IRQ, resets and brings the adapter
- - * out of reset, and allows interrupts. It also delays
- - * the startup for autonegotiation or sends a Rx GO
- - * command to the adapter, as appropriate.
- - *
- - **************************************************************/
- -
- -static int TLan_Open( struct net_device *dev )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - int err;
- -
- - priv->tlanRev = TLan_DioRead8( dev->base_addr, TLAN_DEF_REVISION );
- - err = request_irq( dev->irq, TLan_HandleInterrupt, SA_SHIRQ, TLanSignature, dev );
- -
- - if ( err ) {
- - printk(KERN_ERR "TLAN: Cannot open %s because IRQ %d is already in use.\n", dev->name, dev->irq );
- - return err;
- + host_cmd = TLAN_HC_ACK | ack | (0x000C0000);
- + outl(host_cmd, BASE + TLAN_HOST_CMD);
- +#ifdef EBDEBUG
- + printf("AC: 0x%hX\n", inw(BASE + TLAN_CH_PARM));
- + host_int = inw(BASE + TLAN_HOST_INT);
- + printf("PI-2: 0x%hX\n", host_int);
- +#endif
- }
- -
- - init_timer(&priv->timer);
- - netif_start_queue(dev);
- -
- - /* NOTE: It might not be necessary to read the stats before a
- - reset if you don't care what the values are.
- - */
- - TLan_ResetLists( dev );
- - TLan_ReadAndClearStats( dev, TLAN_IGNORE );
- - TLan_ResetAdapter( dev );
- -
- - TLAN_DBG( TLAN_DEBUG_GNRL, "%s: Opened. TLAN Chip Rev: %x\n", dev->name, priv->tlanRev );
- -
- - return 0;
- -
- -} /* TLan_Open */
- -
- - /**************************************************************
- - * TLan_ioctl
- - *
- - * Returns:
- - * 0 on success, error code otherwise
- - * Params:
- - * dev structure of device to receive ioctl.
- - *
- - * rq ifreq structure to hold userspace data.
- - *
- - * cmd ioctl command.
- - *
- - *
- - *************************************************************/
- + refill_rx(nic);
- + return (1); /* initially as this is called to flush the input */
- +}
-
- -static int TLan_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
- +static void refill_rx(struct nic *nic __unused)
- {
- - TLanPrivateInfo *priv = dev->priv;
- - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
- - u32 phy = priv->phy[priv->phyNum];
- -
- - if (!priv->phyOnline)
- - return -EAGAIN;
- -
- - switch(cmd) {
- - case SIOCGMIIPHY: /* Get address of MII PHY in use. */
- - case SIOCDEVPRIVATE: /* for binary compat, remove in 2.5 */
- - data->phy_id = phy;
- -
- - case SIOCGMIIREG: /* Read MII PHY register. */
- - case SIOCDEVPRIVATE+1: /* for binary compat, remove in 2.5 */
- - TLan_MiiReadReg(dev, data->phy_id & 0x1f, data->reg_num & 0x1f, &data->val_out);
- - return 0;
- -
- + int entry = 0;
-
- - case SIOCSMIIREG: /* Write MII PHY register. */
- - case SIOCDEVPRIVATE+2: /* for binary compat, remove in 2.5 */
- - if (!capable(CAP_NET_ADMIN))
- - return -EPERM;
- - TLan_MiiWriteReg(dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
- - return 0;
- - default:
- - return -EOPNOTSUPP;
- + for (;
- + (priv->cur_rx - priv->dirty_rx +
- + TLAN_NUM_RX_LISTS) % TLAN_NUM_RX_LISTS > 0;
- + priv->dirty_rx = (priv->dirty_rx + 1) % TLAN_NUM_RX_LISTS) {
- + entry = priv->dirty_rx % TLAN_NUM_TX_LISTS;
- + rx_ring[entry].frameSize = TLAN_MAX_FRAME_SIZE;
- + rx_ring[entry].cStat = TLAN_CSTAT_READY;
- }
- -} /* tlan_ioctl */
- -
- - /***************************************************************
- - * TLan_tx_timeout
- - *
- - * Returns: nothing
- - *
- - * Params:
- - * dev structure of device which timed out
- - * during transmit.
- - *
- - **************************************************************/
- -
- -static void TLan_tx_timeout(struct net_device *dev)
- -{
- -
- - TLAN_DBG( TLAN_DEBUG_GNRL, "%s: Transmit timed out.\n", dev->name);
- -
- - /* Ok so we timed out, lets see what we can do about it...*/
- - TLan_FreeLists( dev );
- - TLan_ResetLists( dev );
- - TLan_ReadAndClearStats( dev, TLAN_IGNORE );
- - TLan_ResetAdapter( dev );
- - dev->trans_start = jiffies;
- - netif_wake_queue( dev );
-
- }
- -
-
- - /***************************************************************
- - * TLan_StartTx
- - *
- - * Returns:
- - * 0 on success, non-zero on failure.
- - * Parms:
- - * skb A pointer to the sk_buff containing the
- - * frame to be sent.
- - * dev The device to send the data on.
- - *
- - * This function adds a frame to the Tx list to be sent
- - * ASAP. First it verifies that the adapter is ready and
- - * there is room in the queue. Then it sets up the next
- - * available list, copies the frame to the corresponding
- - * buffer. If the adapter Tx channel is idle, it gives
- - * the adapter a Tx Go command on the list, otherwise it
- - * sets the forward address of the previous list to point
- - * to this one. Then it frees the sk_buff.
- - *
- - **************************************************************/
- +/* #define EBDEBUG */
- +/**************************************************************************
- +TRANSMIT - Transmit a frame
- +***************************************************************************/
- +static void tlan_transmit(struct nic *nic, const char *d, /* Destination */
- + unsigned int t, /* Type */
- + unsigned int s, /* size */
- + const char *p)
- +{ /* Packet */
- + u16 nstype;
- + u32 to;
- + struct TLanList *tail_list;
- + struct TLanList *head_list;
- + u8 *tail_buffer;
- + u32 ack = 0;
- + u32 host_cmd;
- + int eoc = 0;
- + u16 tmpCStat;
- +#ifdef EBDEBUG
- + u16 host_int = inw(BASE + TLAN_HOST_INT);
- +#endif
- + int entry = 0;
-
- -static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - TLanList *tail_list;
- - u8 *tail_buffer;
- - int pad;
- - unsigned long flags;
- -
- - if ( ! priv->phyOnline ) {
- - TLAN_DBG( TLAN_DEBUG_TX, "TRANSMIT: %s PHY is not ready\n", dev->name );
- - dev_kfree_skb_any(skb);
- - return 0;
- +#ifdef EBDEBUG
- + printf("INT0-0x%hX\n", host_int);
- +#endif
- +
- + if (!priv->phyOnline) {
- + printf("TRANSMIT: %s PHY is not ready\n", priv->nic_name);
- + return;
- }
-
- tail_list = priv->txList + priv->txTail;
- -
- - if ( tail_list->cStat != TLAN_CSTAT_UNUSED ) {
- - TLAN_DBG( TLAN_DEBUG_TX, "TRANSMIT: %s is busy (Head=%d Tail=%d)\n", dev->name, priv->txHead, priv->txTail );
- - netif_stop_queue(dev);
- +
- + if (tail_list->cStat != TLAN_CSTAT_UNUSED) {
- + printf("TRANSMIT: %s is busy (Head=%d Tail=%d)\n",
- + priv->nic_name, priv->txList, priv->txTail);
- + tx_ring[entry].cStat = TLAN_CSTAT_UNUSED;
- priv->txBusyCount++;
- - return 1;
- + return;
- }
-
- tail_list->forward = 0;
-
- - if ( bbuf ) {
- - tail_buffer = priv->txBuffer + ( priv->txTail * TLAN_MAX_FRAME_SIZE );
- - memcpy( tail_buffer, skb->data, skb->len );
- - } else {
- - tail_list->buffer[0].address = virt_to_bus( skb->data );
- - tail_list->buffer[9].address = (u32) skb;
- - }
- + tail_buffer = txb + (priv->txTail * TLAN_MAX_FRAME_SIZE);
-
- - pad = TLAN_MIN_FRAME_SIZE - skb->len;
- -
- - if ( pad > 0 ) {
- - tail_list->frameSize = (u16) skb->len + pad;
- - tail_list->buffer[0].count = (u32) skb->len;
- - tail_list->buffer[1].count = TLAN_LAST_BUFFER | (u32) pad;
- - tail_list->buffer[1].address = virt_to_bus( TLanPadBuffer );
- - } else {
- - tail_list->frameSize = (u16) skb->len;
- - tail_list->buffer[0].count = TLAN_LAST_BUFFER | (u32) skb->len;
- - tail_list->buffer[1].count = 0;
- - tail_list->buffer[1].address = 0;
- - }
- + /* send the packet to destination */
- + memcpy(tail_buffer, d, ETH_ALEN);
- + memcpy(tail_buffer + ETH_ALEN, nic->node_addr, ETH_ALEN);
- + nstype = htons((u16) t);
- + memcpy(tail_buffer + 2 * ETH_ALEN, (u8 *) & nstype, 2);
- + memcpy(tail_buffer + ETH_HLEN, p, s);
- +
- + s += ETH_HLEN;
- + s &= 0x0FFF;
- + while (s < ETH_ZLEN)
- + tail_buffer[s++] = '\0';
- +
- + /*=====================================================*/
- + /* Receive
- + * 0000 0000 0001 1100
- + * 0000 0000 0000 1100
- + * 0000 0000 0000 0011 = 0x0003
- + *
- + * 0000 0000 0000 0000 0000 0000 0000 0011
- + * 0000 0000 0000 1100 0000 0000 0000 0000 = 0x000C0000
- + *
- + * Transmit
- + * 0000 0000 0001 1100
- + * 0000 0000 0000 0100
- + * 0000 0000 0000 0001 = 0x0001
- + *
- + * 0000 0000 0000 0000 0000 0000 0000 0001
- + * 0000 0000 0000 0100 0000 0000 0000 0000 = 0x00040000
- + * */
- +
- + /* Setup the transmit descriptor */
- + tail_list->frameSize = (u16) s;
- + tail_list->buffer[0].count = TLAN_LAST_BUFFER | (u32) s;
- + tail_list->buffer[1].count = 0;
- + tail_list->buffer[1].address = 0;
-
- - spin_lock_irqsave(&priv->lock, flags);
- tail_list->cStat = TLAN_CSTAT_READY;
- - if ( ! priv->txInProgress ) {
- +
- +#ifdef EBDEBUG
- + host_int = inw(BASE + TLAN_HOST_INT);
- + printf("INT1-0x%hX\n", host_int);
- +#endif
- +
- + if (!priv->txInProgress) {
- priv->txInProgress = 1;
- - TLAN_DBG( TLAN_DEBUG_TX, "TRANSMIT: Starting TX on buffer %d\n", priv->txTail );
- - outl( virt_to_bus( tail_list ), dev->base_addr + TLAN_CH_PARM );
- - outl( TLAN_HC_GO, dev->base_addr + TLAN_HOST_CMD );
- + outl(virt_to_le32desc(tail_list), BASE + TLAN_CH_PARM);
- + outl(TLAN_HC_GO, BASE + TLAN_HOST_CMD);
- } else {
- - TLAN_DBG( TLAN_DEBUG_TX, "TRANSMIT: Adding buffer %d to TX channel\n", priv->txTail );
- - if ( priv->txTail == 0 ) {
- - ( priv->txList + ( TLAN_NUM_TX_LISTS - 1 ) )->forward = virt_to_bus( tail_list );
- + if (priv->txTail == 0) {
- +#ifdef EBDEBUG
- + printf("Out buffer\n");
- +#endif
- + (priv->txList + (TLAN_NUM_TX_LISTS - 1))->forward =
- + virt_to_le32desc(tail_list);
- } else {
- - ( priv->txList + ( priv->txTail - 1 ) )->forward = virt_to_bus( tail_list );
- +#ifdef EBDEBUG
- + printf("Fix this \n");
- +#endif
- + (priv->txList + (priv->txTail - 1))->forward =
- + virt_to_le32desc(tail_list);
- }
- }
- - spin_unlock_irqrestore(&priv->lock, flags);
- -
- - CIRC_INC( priv->txTail, TLAN_NUM_TX_LISTS );
- -
- - if ( bbuf )
- - dev_kfree_skb_any(skb);
- -
- - dev->trans_start = jiffies;
- - return 0;
- -
- -} /* TLan_StartTx */
- -
- - /***************************************************************
- - * TLan_HandleInterrupt
- - *
- - * Returns:
- - * Nothing
- - * Parms:
- - * irq The line on which the interrupt
- - * occurred.
- - * dev_id A pointer to the device assigned to
- - * this irq line.
- - * regs ???
- - *
- - * This function handles an interrupt generated by its
- - * assigned TLAN adapter. The function deactivates
- - * interrupts on its adapter, records the type of
- - * interrupt, executes the appropriate subhandler, and
- - * acknowdges the interrupt to the adapter (thus
- - * re-enabling adapter interrupts.
- - *
- - **************************************************************/
- -
- -static void TLan_HandleInterrupt(int irq, void *dev_id, struct pt_regs *regs)
- -{
- - u32 ack;
- - struct net_device *dev;
- - u32 host_cmd;
- - u16 host_int;
- - int type;
- - TLanPrivateInfo *priv;
- -
- - dev = dev_id;
- - priv = dev->priv;
- -
- - spin_lock(&priv->lock);
- -
- - host_int = inw( dev->base_addr + TLAN_HOST_INT );
- - outw( host_int, dev->base_addr + TLAN_HOST_INT );
- +
- + CIRC_INC(priv->txTail, TLAN_NUM_TX_LISTS);
-
- - type = ( host_int & TLAN_HI_IT_MASK ) >> 2;
- +#ifdef EBDEBUG
- + host_int = inw(BASE + TLAN_HOST_INT);
- + printf("INT2-0x%hX\n", host_int);
- +#endif
-
- - ack = TLanIntVector[type]( dev, host_int );
- + to = currticks() + TX_TIME_OUT;
- + while ((tail_list->cStat == TLAN_CSTAT_READY) && currticks() < to);
-
- - if ( ack ) {
- - host_cmd = TLAN_HC_ACK | ack | ( type << 18 );
- - outl( host_cmd, dev->base_addr + TLAN_HOST_CMD );
- + head_list = priv->txList + priv->txHead;
- + while (((tmpCStat = head_list->cStat) & TLAN_CSTAT_FRM_CMP)
- + && (ack < 255)) {
- + ack++;
- + if(tmpCStat & TLAN_CSTAT_EOC)
- + eoc =1;
- + head_list->cStat = TLAN_CSTAT_UNUSED;
- + CIRC_INC(priv->txHead, TLAN_NUM_TX_LISTS);
- + head_list = priv->txList + priv->txHead;
- +
- }
- + if(!ack)
- + printf("Incomplete TX Frame\n");
-
- - spin_unlock(&priv->lock);
- -
- -} /* TLan_HandleInterrupts */
- -
- - /***************************************************************
- - * TLan_Close
- - *
- - * Returns:
- - * An error code.
- - * Parms:
- - * dev The device structure of the device to
- - * close.
- - *
- - * This function shuts down the adapter. It records any
- - * stats, puts the adapter into reset state, deactivates
- - * its time as needed, and frees the irq it is using.
- - *
- - **************************************************************/
- -
- -static int TLan_Close(struct net_device *dev)
- -{
- - TLanPrivateInfo *priv = dev->priv;
- -
- - netif_stop_queue(dev);
- - priv->neg_be_verbose = 0;
- -
- - TLan_ReadAndClearStats( dev, TLAN_RECORD );
- - outl( TLAN_HC_AD_RST, dev->base_addr + TLAN_HOST_CMD );
- - if ( priv->timer.function != NULL ) {
- - del_timer_sync( &priv->timer );
- - priv->timer.function = NULL;
- + if(eoc) {
- + head_list = priv->txList + priv->txHead;
- + if ((head_list->cStat & TLAN_CSTAT_READY) == TLAN_CSTAT_READY) {
- + outl(virt_to_le32desc(head_list), BASE + TLAN_CH_PARM);
- + ack |= TLAN_HC_GO;
- + } else {
- + priv->txInProgress = 0;
- + }
- }
- -
- - free_irq( dev->irq, dev );
- - TLan_FreeLists( dev );
- - TLAN_DBG( TLAN_DEBUG_GNRL, "Device %s closed.\n", dev->name );
- -
- - return 0;
- -
- -} /* TLan_Close */
- -
- - /***************************************************************
- - * TLan_GetStats
- - *
- - * Returns:
- - * A pointer to the device's statistics structure.
- - * Parms:
- - * dev The device structure to return the
- - * stats for.
- - *
- - * This function updates the devices statistics by reading
- - * the TLAN chip's onboard registers. Then it returns the
- - * address of the statistics structure.
- - *
- - **************************************************************/
- -
- -static struct net_device_stats *TLan_GetStats( struct net_device *dev )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - int i;
- -
- - /* Should only read stats if open ? */
- - TLan_ReadAndClearStats( dev, TLAN_RECORD );
- -
- - TLAN_DBG( TLAN_DEBUG_RX, "RECEIVE: %s EOC count = %d\n", dev->name, priv->rxEocCount );
- - TLAN_DBG( TLAN_DEBUG_TX, "TRANSMIT: %s Busy count = %d\n", dev->name, priv->txBusyCount );
- - if ( debug & TLAN_DEBUG_GNRL ) {
- - TLan_PrintDio( dev->base_addr );
- - TLan_PhyPrint( dev );
- - }
- - if ( debug & TLAN_DEBUG_LIST ) {
- - for ( i = 0; i < TLAN_NUM_RX_LISTS; i++ )
- - TLan_PrintList( priv->rxList + i, "RX", i );
- - for ( i = 0; i < TLAN_NUM_TX_LISTS; i++ )
- - TLan_PrintList( priv->txList + i, "TX", i );
- + if(ack) {
- + host_cmd = TLAN_HC_ACK | ack;
- + outl(host_cmd, BASE + TLAN_HOST_CMD);
- }
-
- - return ( &( (TLanPrivateInfo *) dev->priv )->stats );
- -
- -} /* TLan_GetStats */
- -
- - /***************************************************************
- - * TLan_SetMulticastList
- - *
- - * Returns:
- - * Nothing
- - * Parms:
- - * dev The device structure to set the
- - * multicast list for.
- - *
- - * This function sets the TLAN adaptor to various receive
- - * modes. If the IFF_PROMISC flag is set, promiscuous
- - * mode is acitviated. Otherwise, promiscuous mode is
- - * turned off. If the IFF_ALLMULTI flag is set, then
- - * the hash table is set to receive all group addresses.
- - * Otherwise, the first three multicast addresses are
- - * stored in AREG_1-3, and the rest are selected via the
- - * hash table, as necessary.
- - *
- - **************************************************************/
- -
- -static void TLan_SetMulticastList( struct net_device *dev )
- -{
- - struct dev_mc_list *dmi = dev->mc_list;
- - u32 hash1 = 0;
- - u32 hash2 = 0;
- - int i;
- - u32 offset;
- - u8 tmp;
- -
- - if ( dev->flags & IFF_PROMISC ) {
- - tmp = TLan_DioRead8( dev->base_addr, TLAN_NET_CMD );
- - TLan_DioWrite8( dev->base_addr, TLAN_NET_CMD, tmp | TLAN_NET_CMD_CAF );
- - } else {
- - tmp = TLan_DioRead8( dev->base_addr, TLAN_NET_CMD );
- - TLan_DioWrite8( dev->base_addr, TLAN_NET_CMD, tmp & ~TLAN_NET_CMD_CAF );
- - if ( dev->flags & IFF_ALLMULTI ) {
- - for ( i = 0; i < 3; i++ )
- - TLan_SetMac( dev, i + 1, NULL );
- - TLan_DioWrite32( dev->base_addr, TLAN_HASH_1, 0xFFFFFFFF );
- - TLan_DioWrite32( dev->base_addr, TLAN_HASH_2, 0xFFFFFFFF );
- + if(priv->tlanRev < 0x30 ) {
- + ack = 1;
- + head_list = priv->txList + priv->txHead;
- + if ((head_list->cStat & TLAN_CSTAT_READY) == TLAN_CSTAT_READY) {
- + outl(virt_to_le32desc(head_list), BASE + TLAN_CH_PARM);
- + ack |= TLAN_HC_GO;
- } else {
- - for ( i = 0; i < dev->mc_count; i++ ) {
- - if ( i < 3 ) {
- - TLan_SetMac( dev, i + 1, (char *) &dmi->dmi_addr );
- - } else {
- - offset = TLan_HashFunc( (u8 *) &dmi->dmi_addr );
- - if ( offset < 32 )
- - hash1 |= ( 1 << offset );
- - else
- - hash2 |= ( 1 << ( offset - 32 ) );
- - }
- - dmi = dmi->next;
- - }
- - for ( ; i < 3; i++ )
- - TLan_SetMac( dev, i + 1, NULL );
- - TLan_DioWrite32( dev->base_addr, TLAN_HASH_1, hash1 );
- - TLan_DioWrite32( dev->base_addr, TLAN_HASH_2, hash2 );
- + priv->txInProgress = 0;
- }
- + host_cmd = TLAN_HC_ACK | ack | 0x00140000;
- + outl(host_cmd, BASE + TLAN_HOST_CMD);
- +
- }
- +
- + if (currticks() >= to) {
- + printf("TX Time Out");
- + }
- +}
-
- -} /* TLan_SetMulticastList */
- -
- -/*****************************************************************************
- -******************************************************************************
- -
- - ThunderLAN Driver Interrupt Vectors and Table
- -
- - Please see Chap. 4, "Interrupt Handling" of the "ThunderLAN
- - Programmer's Guide" for more informations on handling interrupts
- - generated by TLAN based adapters.
- -
- -******************************************************************************
- -*****************************************************************************/
- -
- - /***************************************************************
- - * TLan_HandleInvalid
- - *
- - * Returns:
- - * 0
- - * Parms:
- - * dev Device assigned the IRQ that was
- - * raised.
- - * host_int The contents of the HOST_INT
- - * port.
- - *
- - * This function handles invalid interrupts. This should
- - * never happen unless some other adapter is trying to use
- - * the IRQ line assigned to the device.
- - *
- - **************************************************************/
- -
- -u32 TLan_HandleInvalid( struct net_device *dev, u16 host_int )
- +/**************************************************************************
- +DISABLE - Turn off ethernet interface
- +***************************************************************************/
- +#ifdef EB51
- +static void tlan_disable(struct dev *dev __unused)
- +#else
- +static void tlan_disable(struct nic *nic __unused)
- +#endif
- {
- - /* printk( "TLAN: Invalid interrupt on %s.\n", dev->name ); */
- - return 0;
- -
- -} /* TLan_HandleInvalid */
- -
- - /***************************************************************
- - * TLan_HandleTxEOF
- - *
- - * Returns:
- - * 1
- - * Parms:
- - * dev Device assigned the IRQ that was
- - * raised.
- - * host_int The contents of the HOST_INT
- - * port.
- - *
- - * This function handles Tx EOF interrupts which are raised
- - * by the adapter when it has completed sending the
- - * contents of a buffer. If detemines which list/buffer
- - * was completed and resets it. If the buffer was the last
- - * in the channel (EOC), then the function checks to see if
- - * another buffer is ready to send, and if so, sends a Tx
- - * Go command. Finally, the driver activates/continues the
- - * activity LED.
- + /* put the card in its initial state */
- + /* This function serves 3 purposes.
- + * This disables DMA and interrupts so we don't receive
- + * unexpected packets or interrupts from the card after
- + * etherboot has finished.
- + * This frees resources so etherboot may use
- + * this driver on another interface
- + * This allows etherboot to reinitialize the interface
- + * if something is something goes wrong.
- *
- - **************************************************************/
- + */
- + outl(TLAN_HC_AD_RST, BASE + TLAN_HOST_CMD);
- +}
-
- -u32 TLan_HandleTxEOF( struct net_device *dev, u16 host_int )
- +/**************************************************************************
- +IRQ - Enable, Disable, or Force interrupts
- +***************************************************************************/
- +static void tlan_irq(struct nic *nic __unused, irq_action_t action __unused)
- {
- - TLanPrivateInfo *priv = dev->priv;
- - int eoc = 0;
- - TLanList *head_list;
- - u32 ack = 0;
- - u16 tmpCStat;
- -
- - TLAN_DBG( TLAN_DEBUG_TX, "TRANSMIT: Handling TX EOF (Head=%d Tail=%d)\n", priv->txHead, priv->txTail );
- - head_list = priv->txList + priv->txHead;
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
-
- - while (((tmpCStat = head_list->cStat ) & TLAN_CSTAT_FRM_CMP) && (ack < 255)) {
- - ack++;
- - if ( ! bbuf ) {
- - dev_kfree_skb_any( (struct sk_buff *) head_list->buffer[9].address );
- - head_list->buffer[9].address = 0;
- - }
- -
- - if ( tmpCStat & TLAN_CSTAT_EOC )
- - eoc = 1;
- -
- - priv->stats.tx_bytes += head_list->frameSize;
- +static void TLan_SetMulticastList(struct nic *nic) {
- + int i;
- + u8 tmp;
-
- - head_list->cStat = TLAN_CSTAT_UNUSED;
- - netif_start_queue(dev);
- - CIRC_INC( priv->txHead, TLAN_NUM_TX_LISTS );
- - head_list = priv->txList + priv->txHead;
- - }
- + /* !IFF_PROMISC */
- + tmp = TLan_DioRead8(BASE, TLAN_NET_CMD);
- + TLan_DioWrite8(BASE, TLAN_NET_CMD, tmp & ~TLAN_NET_CMD_CAF);
- +
- + /* IFF_ALLMULTI */
- + for(i = 0; i< 3; i++)
- + TLan_SetMac(nic, i + 1, NULL);
- + TLan_DioWrite32(BASE, TLAN_HASH_1, 0xFFFFFFFF);
- + TLan_DioWrite32(BASE, TLAN_HASH_2, 0xFFFFFFFF);
-
- - if (!ack)
- - printk(KERN_INFO "TLAN: Received interrupt for uncompleted TX frame.\n");
- -
- - if ( eoc ) {
- - TLAN_DBG( TLAN_DEBUG_TX, "TRANSMIT: Handling TX EOC (Head=%d Tail=%d)\n", priv->txHead, priv->txTail );
- - head_list = priv->txList + priv->txHead;
- - if ( ( head_list->cStat & TLAN_CSTAT_READY ) == TLAN_CSTAT_READY ) {
- - outl( virt_to_bus( head_list ), dev->base_addr + TLAN_CH_PARM );
- - ack |= TLAN_HC_GO;
- - } else {
- - priv->txInProgress = 0;
- - }
- - }
-
- - if ( priv->adapter->flags & TLAN_ADAPTER_ACTIVITY_LED ) {
- - TLan_DioWrite8( dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK | TLAN_LED_ACT );
- - if ( priv->timer.function == NULL ) {
- - priv->timer.function = &TLan_Timer;
- - priv->timer.data = (unsigned long) dev;
- - priv->timer.expires = jiffies + TLAN_TIMER_ACT_DELAY;
- - priv->timerSetAt = jiffies;
- - priv->timerType = TLAN_TIMER_ACTIVITY;
- - add_timer(&priv->timer);
- - } else if ( priv->timerType == TLAN_TIMER_ACTIVITY ) {
- - priv->timerSetAt = jiffies;
- +}
- +/**************************************************************************
- +PROBE - Look for an adapter, this routine's visible to the outside
- +***************************************************************************/
- +
- +#define board_found 1
- +#define valid_link 0
- +#ifdef EB51
- +static int tlan_probe(struct dev *dev, struct pci_device *pci)
- +{
- + struct nic *nic = (struct nic *) dev;
- +#else
- +struct nic *tlan_probe(struct nic *nic, unsigned short *io_addrs, struct pci_device *pci)
- +{
- +#endif
- + u16 data = 0;
- + int err;
- + int i;
- +
- + if (pci->ioaddr == 0)
- + return 0;
- +
- + nic->irqno = 0;
- + nic->ioaddr = pci->ioaddr & ~3;
- +
- + BASE = pci->ioaddr;
- + printf("\n");
- + printf("tlan.c: %s, %s\n", drv_version, drv_date);
- + printf("%s: Probing for Vendor 0x%hX, Device 0x%hX",
- + pci->name, pci->vendor, pci->dev_id);
- +
- +
- + /* I really must find out what this does */
- + adjust_pci_device(pci);
- +
- + /* Point to private storage */
- + priv = &TLanPrivateInfo;
- + /* Figure out which chip we're dealing with */
- + i = 0;
- + chip_idx = -1;
- +
- + while (tlan_pci_tbl[i].name) {
- + if ((((u32) pci->dev_id << 16) | pci->vendor) ==
- + (tlan_pci_tbl[i].id.pci & 0xffffffff)) {
- + chip_idx = i;
- + break;
- }
- + i++;
- }
-
- - return ack;
- + priv->vendor_id = pci->vendor;
- + priv->dev_id = pci->dev_id;
- + priv->nic_name = pci->name;
- + priv->eoc = 0;
-
- -} /* TLan_HandleTxEOF */
- + err = 0;
- + for (i = 0; i < 6; i++)
- + err |= TLan_EeReadByte(BASE,
- + (u8) tlan_pci_tbl[chip_idx].
- + addrOfs + i,
- + (u8 *) & nic->node_addr[i]);
- + if (err) {
- + printf("TLAN: %s: Error reading MAC from eeprom: %d\n",
- + pci->name, err);
- + } else
- + printf("\nAddress: %!\n", nic->node_addr);
-
- - /***************************************************************
- - * TLan_HandleStatOverflow
- - *
- - * Returns:
- - * 1
- - * Parms:
- - * dev Device assigned the IRQ that was
- - * raised.
- - * host_int The contents of the HOST_INT
- - * port.
- - *
- - * This function handles the Statistics Overflow interrupt
- - * which means that one or more of the TLAN statistics
- - * registers has reached 1/2 capacity and needs to be read.
- - *
- - **************************************************************/
- + priv->tlanRev = TLan_DioRead8(BASE, TLAN_DEF_REVISION);
- + printf("\nRevision = 0x%hX\n", priv->tlanRev);
-
- -u32 TLan_HandleStatOverflow( struct net_device *dev, u16 host_int )
- -{
- - TLan_ReadAndClearStats( dev, TLAN_RECORD );
- + TLan_ResetLists(nic);
- + TLan_ResetAdapter(nic);
- +/*
- + data = inl(BASE + TLAN_HOST_CMD);
- + data |= TLAN_HC_EOC;
- + outw(data, BASE + TLAN_HOST_CMD);
- +*/
- +
- + data = inl(BASE + TLAN_HOST_CMD);
- + data |= TLAN_HC_INT_OFF;
- + outw(data, BASE + TLAN_HOST_CMD);
-
- + TLan_SetMulticastList(nic);
- + udelay(100);
- + priv->txList = tx_ring;
- + priv->rxList = rx_ring;
- +/* if (board_found && valid_link)
- + {*/
- + /* point to NIC specific routines */
- +#ifdef EB51
- + dev->disable = tlan_disable;
- + nic->poll = tlan_poll;
- + nic->transmit = tlan_transmit;
- + nic->irq = tlan_irq;
- return 1;
- +#else
- + nic->disable = tlan_disable;
- + nic->poll = tlan_poll;
- + nic->transmit = tlan_transmit;
- + nic->irq = tlan_irq;
- + return nic;
- +#endif
- +}
- +
- +
- +/*****************************************************************************
- +******************************************************************************
- +
- + ThunderLAN Driver Eeprom routines
- +
- + The Compaq Netelligent 10 and 10/100 cards use a Microchip 24C02A
- + EEPROM. These functions are based on information in Microchip's
- + data sheet. I don't know how well this functions will work with
- + other EEPROMs.
- +
- +******************************************************************************
- +*****************************************************************************/
-
- -} /* TLan_HandleStatOverflow */
-
- /***************************************************************
- - * TLan_HandleRxEOF
- + * TLan_EeSendStart
- *
- * Returns:
- - * 1
- + * Nothing
- * Parms:
- - * dev Device assigned the IRQ that was
- - * raised.
- - * host_int The contents of the HOST_INT
- - * port.
- - *
- - * This function handles the Rx EOF interrupt which
- - * indicates a frame has been received by the adapter from
- - * the net and the frame has been transferred to memory.
- - * The function determines the bounce buffer the frame has
- - * been loaded into, creates a new sk_buff big enough to
- - * hold the frame, and sends it to protocol stack. It
- - * then resets the used buffer and appends it to the end
- - * of the list. If the frame was the last in the Rx
- - * channel (EOC), the function restarts the receive channel
- - * by sending an Rx Go command to the adapter. Then it
- - * activates/continues the activity LED.
- + * io_base The IO port base address for the
- + * TLAN device with the EEPROM to
- + * use.
- + *
- + * This function sends a start cycle to an EEPROM attached
- + * to a TLAN chip.
- *
- **************************************************************/
-
- -u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int )
- +void TLan_EeSendStart(u16 io_base)
- {
- - TLanPrivateInfo *priv = dev->priv;
- - u32 ack = 0;
- - int eoc = 0;
- - u8 *head_buffer;
- - TLanList *head_list;
- - struct sk_buff *skb;
- - TLanList *tail_list;
- - void *t;
- - u32 frameSize;
- - u16 tmpCStat;
- -
- - TLAN_DBG( TLAN_DEBUG_RX, "RECEIVE: Handling RX EOF (Head=%d Tail=%d)\n", priv->rxHead, priv->rxTail );
- - head_list = priv->rxList + priv->rxHead;
- -
- - while (((tmpCStat = head_list->cStat) & TLAN_CSTAT_FRM_CMP) && (ack < 255)) {
- - frameSize = head_list->frameSize;
- - ack++;
- - if (tmpCStat & TLAN_CSTAT_EOC)
- - eoc = 1;
- -
- - if (bbuf) {
- - skb = dev_alloc_skb(frameSize + 7);
- - if (skb == NULL)
- - printk(KERN_INFO "TLAN: Couldn't allocate memory for received data.\n");
- - else {
- - head_buffer = priv->rxBuffer + (priv->rxHead * TLAN_MAX_FRAME_SIZE);
- - skb->dev = dev;
- - skb_reserve(skb, 2);
- - t = (void *) skb_put(skb, frameSize);
- -
- - priv->stats.rx_bytes += head_list->frameSize;
- -
- - memcpy( t, head_buffer, frameSize );
- - skb->protocol = eth_type_trans( skb, dev );
- - netif_rx( skb );
- - }
- - } else {
- - struct sk_buff *new_skb;
- -
- - /*
- - * I changed the algorithm here. What we now do
- - * is allocate the new frame. If this fails we
- - * simply recycle the frame.
- - */
- -
- - new_skb = dev_alloc_skb( TLAN_MAX_FRAME_SIZE + 7 );
- -
- - if ( new_skb != NULL ) {
- - /* If this ever happened it would be a problem */
- - /* not any more - ac */
- - skb = (struct sk_buff *) head_list->buffer[9].address;
- - skb_trim( skb, frameSize );
- -
- - priv->stats.rx_bytes += frameSize;
- + u16 sio;
-
- - skb->protocol = eth_type_trans( skb, dev );
- - netif_rx( skb );
- -
- - new_skb->dev = dev;
- - skb_reserve( new_skb, 2 );
- - t = (void *) skb_put( new_skb, TLAN_MAX_FRAME_SIZE );
- - head_list->buffer[0].address = virt_to_bus( t );
- - head_list->buffer[8].address = (u32) t;
- - head_list->buffer[9].address = (u32) new_skb;
- - } else
- - printk(KERN_WARNING "TLAN: Couldn't allocate memory for received data.\n" );
- - }
- + outw(TLAN_NET_SIO, io_base + TLAN_DIO_ADR);
- + sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO;
-
- - head_list->forward = 0;
- - head_list->cStat = 0;
- - tail_list = priv->rxList + priv->rxTail;
- - tail_list->forward = virt_to_bus( head_list );
- -
- - CIRC_INC( priv->rxHead, TLAN_NUM_RX_LISTS );
- - CIRC_INC( priv->rxTail, TLAN_NUM_RX_LISTS );
- - head_list = priv->rxList + priv->rxHead;
- - }
- + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio);
- + TLan_SetBit(TLAN_NET_SIO_EDATA, sio);
- + TLan_SetBit(TLAN_NET_SIO_ETXEN, sio);
- + TLan_ClearBit(TLAN_NET_SIO_EDATA, sio);
- + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio);
-
- - if (!ack)
- - printk(KERN_INFO "TLAN: Received interrupt for uncompleted RX frame.\n");
- -
- +} /* TLan_EeSendStart */
-
- - if ( eoc ) {
- - TLAN_DBG( TLAN_DEBUG_RX, "RECEIVE: Handling RX EOC (Head=%d Tail=%d)\n", priv->rxHead, priv->rxTail );
- - head_list = priv->rxList + priv->rxHead;
- - outl( virt_to_bus( head_list ), dev->base_addr + TLAN_CH_PARM );
- - ack |= TLAN_HC_GO | TLAN_HC_RT;
- - priv->rxEocCount++;
- - }
- -
- - if ( priv->adapter->flags & TLAN_ADAPTER_ACTIVITY_LED ) {
- - TLan_DioWrite8( dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK | TLAN_LED_ACT );
- - if ( priv->timer.function == NULL ) {
- - priv->timer.function = &TLan_Timer;
- - priv->timer.data = (unsigned long) dev;
- - priv->timer.expires = jiffies + TLAN_TIMER_ACT_DELAY;
- - priv->timerSetAt = jiffies;
- - priv->timerType = TLAN_TIMER_ACTIVITY;
- - add_timer(&priv->timer);
- - } else if ( priv->timerType == TLAN_TIMER_ACTIVITY ) {
- - priv->timerSetAt = jiffies;
- - }
- - }
-
- - dev->last_rx = jiffies;
- -
- - return ack;
-
- -} /* TLan_HandleRxEOF */
-
- /***************************************************************
- - * TLan_HandleDummy
- + * TLan_EeSendByte
- *
- * Returns:
- - * 1
- - * Parms:
- - * dev Device assigned the IRQ that was
- - * raised.
- - * host_int The contents of the HOST_INT
- - * port.
- - *
- - * This function handles the Dummy interrupt, which is
- - * raised whenever a test interrupt is generated by setting
- - * the Req_Int bit of HOST_CMD to 1.
- + * If the correct ack was received, 0, otherwise 1
- + * Parms: io_base The IO port base address for the
- + * TLAN device with the EEPROM to
- + * use.
- + * data The 8 bits of information to
- + * send to the EEPROM.
- + * stop If TLAN_EEPROM_STOP is passed, a
- + * stop cycle is sent after the
- + * byte is sent after the ack is
- + * read.
- + *
- + * This function sends a byte on the serial EEPROM line,
- + * driving the clock to send each bit. The function then
- + * reverses transmission direction and reads an acknowledge
- + * bit.
- *
- **************************************************************/
-
- -u32 TLan_HandleDummy( struct net_device *dev, u16 host_int )
- +int TLan_EeSendByte(u16 io_base, u8 data, int stop)
- {
- - printk( "TLAN: Test interrupt on %s.\n", dev->name );
- - return 1;
- + int err;
- + u8 place;
- + u16 sio;
-
- -} /* TLan_HandleDummy */
- + outw(TLAN_NET_SIO, io_base + TLAN_DIO_ADR);
- + sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO;
-
- - /***************************************************************
- - * TLan_HandleTxEOC
- - *
- - * Returns:
- - * 1
- - * Parms:
- - * dev Device assigned the IRQ that was
- - * raised.
- - * host_int The contents of the HOST_INT
- - * port.
- - *
- - * This driver is structured to determine EOC occurances by
- - * reading the CSTAT member of the list structure. Tx EOC
- - * interrupts are disabled via the DIO INTDIS register.
- - * However, TLAN chips before revision 3.0 didn't have this
- - * functionality, so process EOC events if this is the
- - * case.
- - *
- - **************************************************************/
- + /* Assume clock is low, tx is enabled; */
- + for (place = 0x80; place != 0; place >>= 1) {
- + if (place & data)
- + TLan_SetBit(TLAN_NET_SIO_EDATA, sio);
- + else
- + TLan_ClearBit(TLAN_NET_SIO_EDATA, sio);
- + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio);
- + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio);
- + }
- + TLan_ClearBit(TLAN_NET_SIO_ETXEN, sio);
- + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio);
- + err = TLan_GetBit(TLAN_NET_SIO_EDATA, sio);
- + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio);
- + TLan_SetBit(TLAN_NET_SIO_ETXEN, sio);
-
- -u32 TLan_HandleTxEOC( struct net_device *dev, u16 host_int )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - TLanList *head_list;
- - u32 ack = 1;
- -
- - host_int = 0;
- - if ( priv->tlanRev < 0x30 ) {
- - TLAN_DBG( TLAN_DEBUG_TX, "TRANSMIT: Handling TX EOC (Head=%d Tail=%d) -- IRQ\n", priv->txHead, priv->txTail );
- - head_list = priv->txList + priv->txHead;
- - if ( ( head_list->cStat & TLAN_CSTAT_READY ) == TLAN_CSTAT_READY ) {
- - netif_stop_queue(dev);
- - outl( virt_to_bus( head_list ), dev->base_addr + TLAN_CH_PARM );
- - ack |= TLAN_HC_GO;
- - } else {
- - priv->txInProgress = 0;
- - }
- + if ((!err) && stop) {
- + TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); /* STOP, raise data while clock is high */
- + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio);
- + TLan_SetBit(TLAN_NET_SIO_EDATA, sio);
- }
-
- - return ack;
- + return (err);
- +
- +} /* TLan_EeSendByte */
- +
- +
-
- -} /* TLan_HandleTxEOC */
-
- /***************************************************************
- - * TLan_HandleStatusCheck
- + * TLan_EeReceiveByte
- *
- * Returns:
- - * 0 if Adapter check, 1 if Network Status check.
- + * Nothing
- * Parms:
- - * dev Device assigned the IRQ that was
- - * raised.
- - * host_int The contents of the HOST_INT
- - * port.
- - *
- - * This function handles Adapter Check/Network Status
- - * interrupts generated by the adapter. It checks the
- - * vector in the HOST_INT register to determine if it is
- - * an Adapter Check interrupt. If so, it resets the
- - * adapter. Otherwise it clears the status registers
- - * and services the PHY.
- + * io_base The IO port base address for the
- + * TLAN device with the EEPROM to
- + * use.
- + * data An address to a char to hold the
- + * data sent from the EEPROM.
- + * stop If TLAN_EEPROM_STOP is passed, a
- + * stop cycle is sent after the
- + * byte is received, and no ack is
- + * sent.
- + *
- + * This function receives 8 bits of data from the EEPROM
- + * over the serial link. It then sends and ack bit, or no
- + * ack and a stop bit. This function is used to retrieve
- + * data after the address of a byte in the EEPROM has been
- + * sent.
- *
- **************************************************************/
-
- -u32 TLan_HandleStatusCheck( struct net_device *dev, u16 host_int )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - u32 ack;
- - u32 error;
- - u8 net_sts;
- - u32 phy;
- - u16 tlphy_ctl;
- - u16 tlphy_sts;
- -
- - ack = 1;
- - if ( host_int & TLAN_HI_IV_MASK ) {
- - netif_stop_queue( dev );
- - error = inl( dev->base_addr + TLAN_CH_PARM );
- - printk( "TLAN: %s: Adaptor Error = 0x%x\n", dev->name, error );
- - TLan_ReadAndClearStats( dev, TLAN_RECORD );
- - outl( TLAN_HC_AD_RST, dev->base_addr + TLAN_HOST_CMD );
- -
- - queue_task(&priv->tlan_tqueue, &tq_immediate);
- - mark_bh(IMMEDIATE_BH);
- -
- - netif_wake_queue(dev);
- - ack = 0;
- - } else {
- - TLAN_DBG( TLAN_DEBUG_GNRL, "%s: Status Check\n", dev->name );
- - phy = priv->phy[priv->phyNum];
- +void TLan_EeReceiveByte(u16 io_base, u8 * data, int stop)
- +{
- + u8 place;
- + u16 sio;
-
- - net_sts = TLan_DioRead8( dev->base_addr, TLAN_NET_STS );
- - if ( net_sts ) {
- - TLan_DioWrite8( dev->base_addr, TLAN_NET_STS, net_sts );
- - TLAN_DBG( TLAN_DEBUG_GNRL, "%s: Net_Sts = %x\n", dev->name, (unsigned) net_sts );
- - }
- - if ( ( net_sts & TLAN_NET_STS_MIRQ ) && ( priv->phyNum == 0 ) ) {
- - TLan_MiiReadReg( dev, phy, TLAN_TLPHY_STS, &tlphy_sts );
- - TLan_MiiReadReg( dev, phy, TLAN_TLPHY_CTL, &tlphy_ctl );
- - if ( ! ( tlphy_sts & TLAN_TS_POLOK ) && ! ( tlphy_ctl & TLAN_TC_SWAPOL ) ) {
- - tlphy_ctl |= TLAN_TC_SWAPOL;
- - TLan_MiiWriteReg( dev, phy, TLAN_TLPHY_CTL, tlphy_ctl);
- - } else if ( ( tlphy_sts & TLAN_TS_POLOK ) && ( tlphy_ctl & TLAN_TC_SWAPOL ) ) {
- - tlphy_ctl &= ~TLAN_TC_SWAPOL;
- - TLan_MiiWriteReg( dev, phy, TLAN_TLPHY_CTL, tlphy_ctl);
- - }
- + outw(TLAN_NET_SIO, io_base + TLAN_DIO_ADR);
- + sio = io_base + TLAN_DIO_DATA + TLAN_NET_SIO;
- + *data = 0;
-
- - if (debug) {
- - TLan_PhyPrint( dev );
- - }
- - }
- + /* Assume clock is low, tx is enabled; */
- + TLan_ClearBit(TLAN_NET_SIO_ETXEN, sio);
- + for (place = 0x80; place; place >>= 1) {
- + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio);
- + if (TLan_GetBit(TLAN_NET_SIO_EDATA, sio))
- + *data |= place;
- + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio);
- + }
- +
- + TLan_SetBit(TLAN_NET_SIO_ETXEN, sio);
- + if (!stop) {
- + TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); /* Ack = 0 */
- + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio);
- + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio);
- + } else {
- + TLan_SetBit(TLAN_NET_SIO_EDATA, sio); /* No ack = 1 (?) */
- + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio);
- + TLan_ClearBit(TLAN_NET_SIO_ECLOK, sio);
- + TLan_ClearBit(TLAN_NET_SIO_EDATA, sio); /* STOP, raise data while clock is high */
- + TLan_SetBit(TLAN_NET_SIO_ECLOK, sio);
- + TLan_SetBit(TLAN_NET_SIO_EDATA, sio);
- }
-
- - return ack;
- +} /* TLan_EeReceiveByte */
- +
-
- -} /* TLan_HandleStatusCheck */
-
- /***************************************************************
- - * TLan_HandleRxEOC
- + * TLan_EeReadByte
- *
- * Returns:
- - * 1
- + * No error = 0, else, the stage at which the error
- + * occurred.
- * Parms:
- - * dev Device assigned the IRQ that was
- - * raised.
- - * host_int The contents of the HOST_INT
- - * port.
- - *
- - * This driver is structured to determine EOC occurances by
- - * reading the CSTAT member of the list structure. Rx EOC
- - * interrupts are disabled via the DIO INTDIS register.
- - * However, TLAN chips before revision 3.0 didn't have this
- - * CSTAT member or a INTDIS register, so if this chip is
- - * pre-3.0, process EOC interrupts normally.
- + * io_base The IO port base address for the
- + * TLAN device with the EEPROM to
- + * use.
- + * ee_addr The address of the byte in the
- + * EEPROM whose contents are to be
- + * retrieved.
- + * data An address to a char to hold the
- + * data obtained from the EEPROM.
- + *
- + * This function reads a byte of information from an byte
- + * cell in the EEPROM.
- *
- **************************************************************/
-
- -u32 TLan_HandleRxEOC( struct net_device *dev, u16 host_int )
- +int TLan_EeReadByte(u16 io_base, u8 ee_addr, u8 * data)
- {
- - TLanPrivateInfo *priv = dev->priv;
- - TLanList *head_list;
- - u32 ack = 1;
- + int err;
- + int ret = 0;
-
- - if ( priv->tlanRev < 0x30 ) {
- - TLAN_DBG( TLAN_DEBUG_RX, "RECEIVE: Handling RX EOC (Head=%d Tail=%d) -- IRQ\n", priv->rxHead, priv->rxTail );
- - head_list = priv->rxList + priv->rxHead;
- - outl( virt_to_bus( head_list ), dev->base_addr + TLAN_CH_PARM );
- - ack |= TLAN_HC_GO | TLAN_HC_RT;
- - priv->rxEocCount++;
- +
- + TLan_EeSendStart(io_base);
- + err = TLan_EeSendByte(io_base, 0xA0, TLAN_EEPROM_ACK);
- + if (err) {
- + ret = 1;
- + goto fail;
- + }
- + err = TLan_EeSendByte(io_base, ee_addr, TLAN_EEPROM_ACK);
- + if (err) {
- + ret = 2;
- + goto fail;
- + }
- + TLan_EeSendStart(io_base);
- + err = TLan_EeSendByte(io_base, 0xA1, TLAN_EEPROM_ACK);
- + if (err) {
- + ret = 3;
- + goto fail;
- }
- + TLan_EeReceiveByte(io_base, data, TLAN_EEPROM_STOP);
- + fail:
-
- - return ack;
- + return ret;
- +
- +} /* TLan_EeReadByte */
-
- -} /* TLan_HandleRxEOC */
-
- /*****************************************************************************
- ******************************************************************************
-
- - ThunderLAN Driver Timer Function
- + ThunderLAN Driver MII Routines
- +
- + These routines are based on the information in Chap. 2 of the
- + "ThunderLAN Programmer's Guide", pp. 15-24.
-
- ******************************************************************************
- *****************************************************************************/
-
- +
- /***************************************************************
- - * TLan_Timer
- + * TLan_MiiReadReg
- *
- * Returns:
- - * Nothing
- + * 0 if ack received ok
- + * 1 otherwise.
- + *
- * Parms:
- - * data A value given to add timer when
- - * add_timer was called.
- + * dev The device structure containing
- + * The io address and interrupt count
- + * for this device.
- + * phy The address of the PHY to be queried.
- + * reg The register whose contents are to be
- + * retreived.
- + * val A pointer to a variable to store the
- + * retrieved value.
- *
- - * This function handles timed functionality for the
- - * TLAN driver. The two current timer uses are for
- - * delaying for autonegotionation and driving the ACT LED.
- - * - Autonegotiation requires being allowed about
- - * 2 1/2 seconds before attempting to transmit a
- - * packet. It would be a very bad thing to hang
- - * the kernel this long, so the driver doesn't
- - * allow transmission 'til after this time, for
- - * certain PHYs. It would be much nicer if all
- - * PHYs were interrupt-capable like the internal
- - * PHY.
- - * - The ACT LED, which shows adapter activity, is
- - * driven by the driver, and so must be left on
- - * for a short period to power up the LED so it
- - * can be seen. This delay can be changed by
- - * changing the TLAN_TIMER_ACT_DELAY in tlan.h,
- - * if desired. 100 ms produces a slightly
- - * sluggish response.
- + * This function uses the TLAN's MII bus to retreive the contents
- + * of a given register on a PHY. It sends the appropriate info
- + * and then reads the 16-bit register value from the MII bus via
- + * the TLAN SIO register.
- *
- **************************************************************/
-
- -void TLan_Timer( unsigned long data )
- +int TLan_MiiReadReg(struct nic *nic __unused, u16 phy, u16 reg, u16 * val)
- {
- - struct net_device *dev = (struct net_device *) data;
- - TLanPrivateInfo *priv = dev->priv;
- - u32 elapsed;
- - unsigned long flags = 0;
- -
- - priv->timer.function = NULL;
- -
- - switch ( priv->timerType ) {
- -#ifdef MONITOR
- - case TLAN_TIMER_LINK_BEAT:
- - TLan_PhyMonitor( dev );
- - break;
- -#endif
- - case TLAN_TIMER_PHY_PDOWN:
- - TLan_PhyPowerDown( dev );
- - break;
- - case TLAN_TIMER_PHY_PUP:
- - TLan_PhyPowerUp( dev );
- - break;
- - case TLAN_TIMER_PHY_RESET:
- - TLan_PhyReset( dev );
- - break;
- - case TLAN_TIMER_PHY_START_LINK:
- - TLan_PhyStartLink( dev );
- - break;
- - case TLAN_TIMER_PHY_FINISH_AN:
- - TLan_PhyFinishAutoNeg( dev );
- - break;
- - case TLAN_TIMER_FINISH_RESET:
- - TLan_FinishReset( dev );
- - break;
- - case TLAN_TIMER_ACTIVITY:
- - spin_lock_irqsave(&priv->lock, flags);
- - if ( priv->timer.function == NULL ) {
- - elapsed = jiffies - priv->timerSetAt;
- - if ( elapsed >= TLAN_TIMER_ACT_DELAY ) {
- - TLan_DioWrite8( dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK );
- - } else {
- - priv->timer.function = &TLan_Timer;
- - priv->timer.expires = priv->timerSetAt + TLAN_TIMER_ACT_DELAY;
- - spin_unlock_irqrestore(&priv->lock, flags);
- - add_timer( &priv->timer );
- - break;
- - }
- - }
- - spin_unlock_irqrestore(&priv->lock, flags);
- - break;
- - default:
- - break;
- + u8 nack;
- + u16 sio, tmp;
- + u32 i;
- + int err;
- + int minten;
- +
- + err = FALSE;
- + outw(TLAN_NET_SIO, BASE + TLAN_DIO_ADR);
- + sio = BASE + TLAN_DIO_DATA + TLAN_NET_SIO;
- +
- + TLan_MiiSync(BASE);
- +
- + minten = TLan_GetBit(TLAN_NET_SIO_MINTEN, sio);
- + if (minten)
- + TLan_ClearBit(TLAN_NET_SIO_MINTEN, sio);
- +
- + TLan_MiiSendData(BASE, 0x1, 2); /* Start ( 01b ) */
- + TLan_MiiSendData(BASE, 0x2, 2); /* Read ( 10b ) */
- + TLan_MiiSendData(BASE, phy, 5); /* Device # */
- + TLan_MiiSendData(BASE, reg, 5); /* Register # */
- +
- +
- + TLan_ClearBit(TLAN_NET_SIO_MTXEN, sio); /* Change direction */
- +
- + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Clock Idle bit */
- + TLan_SetBit(TLAN_NET_SIO_MCLK, sio);
- + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Wait 300ns */
- +
- + nack = TLan_GetBit(TLAN_NET_SIO_MDATA, sio); /* Check for ACK */
- + TLan_SetBit(TLAN_NET_SIO_MCLK, sio); /* Finish ACK */
- + if (nack) { /* No ACK, so fake it */
- + for (i = 0; i < 16; i++) {
- + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio);
- + TLan_SetBit(TLAN_NET_SIO_MCLK, sio);
- + }
- + tmp = 0xffff;
- + err = TRUE;
- + } else { /* ACK, so read data */
- + for (tmp = 0, i = 0x8000; i; i >>= 1) {
- + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio);
- + if (TLan_GetBit(TLAN_NET_SIO_MDATA, sio))
- + tmp |= i;
- + TLan_SetBit(TLAN_NET_SIO_MCLK, sio);
- + }
- }
-
- -} /* TLan_Timer */
-
- -/*****************************************************************************
- -******************************************************************************
- + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Idle cycle */
- + TLan_SetBit(TLAN_NET_SIO_MCLK, sio);
-
- - ThunderLAN Driver Adapter Related Routines
- + if (minten)
- + TLan_SetBit(TLAN_NET_SIO_MINTEN, sio);
-
- -******************************************************************************
- -*****************************************************************************/
- + *val = tmp;
- +
- + return err;
- +
- +} /* TLan_MiiReadReg */
-
- /***************************************************************
- - * TLan_ResetLists
- - *
- + * TLan_MiiSendData
- + *
- * Returns:
- * Nothing
- * Parms:
- - * dev The device structure with the list
- - * stuctures to be reset.
- + * base_port The base IO port of the adapter in
- + * question.
- + * dev The address of the PHY to be queried.
- + * data The value to be placed on the MII bus.
- + * num_bits The number of bits in data that are to
- + * be placed on the MII bus.
- *
- - * This routine sets the variables associated with managing
- - * the TLAN lists to their initial values.
- + * This function sends on sequence of bits on the MII
- + * configuration bus.
- *
- **************************************************************/
-
- -void TLan_ResetLists( struct net_device *dev )
- +void TLan_MiiSendData(u16 base_port, u32 data, unsigned num_bits)
- {
- - TLanPrivateInfo *priv = dev->priv;
- - int i;
- - TLanList *list;
- - struct sk_buff *skb;
- - void *t = NULL;
- + u16 sio;
- + u32 i;
-
- - priv->txHead = 0;
- - priv->txTail = 0;
- - for ( i = 0; i < TLAN_NUM_TX_LISTS; i++ ) {
- - list = priv->txList + i;
- - list->cStat = TLAN_CSTAT_UNUSED;
- - if ( bbuf ) {
- - list->buffer[0].address = virt_to_bus( priv->txBuffer + ( i * TLAN_MAX_FRAME_SIZE ) );
- - } else {
- - list->buffer[0].address = 0;
- - }
- - list->buffer[2].count = 0;
- - list->buffer[2].address = 0;
- - list->buffer[9].address = 0;
- - }
- + if (num_bits == 0)
- + return;
- +
- + outw(TLAN_NET_SIO, base_port + TLAN_DIO_ADR);
- + sio = base_port + TLAN_DIO_DATA + TLAN_NET_SIO;
- + TLan_SetBit(TLAN_NET_SIO_MTXEN, sio);
-
- - priv->rxHead = 0;
- - priv->rxTail = TLAN_NUM_RX_LISTS - 1;
- - for ( i = 0; i < TLAN_NUM_RX_LISTS; i++ ) {
- - list = priv->rxList + i;
- - list->cStat = TLAN_CSTAT_READY;
- - list->frameSize = TLAN_MAX_FRAME_SIZE;
- - list->buffer[0].count = TLAN_MAX_FRAME_SIZE | TLAN_LAST_BUFFER;
- - if ( bbuf ) {
- - list->buffer[0].address = virt_to_bus( priv->rxBuffer + ( i * TLAN_MAX_FRAME_SIZE ) );
- - } else {
- - skb = dev_alloc_skb( TLAN_MAX_FRAME_SIZE + 7 );
- - if ( skb == NULL ) {
- - printk( "TLAN: Couldn't allocate memory for received data.\n" );
- - /* If this ever happened it would be a problem */
- - } else {
- - skb->dev = dev;
- - skb_reserve( skb, 2 );
- - t = (void *) skb_put( skb, TLAN_MAX_FRAME_SIZE );
- - }
- - list->buffer[0].address = virt_to_bus( t );
- - list->buffer[8].address = (u32) t;
- - list->buffer[9].address = (u32) skb;
- - }
- - list->buffer[1].count = 0;
- - list->buffer[1].address = 0;
- - if ( i < TLAN_NUM_RX_LISTS - 1 )
- - list->forward = virt_to_bus( list + 1 );
- + for (i = (0x1 << (num_bits - 1)); i; i >>= 1) {
- + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio);
- + (void) TLan_GetBit(TLAN_NET_SIO_MCLK, sio);
- + if (data & i)
- + TLan_SetBit(TLAN_NET_SIO_MDATA, sio);
- else
- - list->forward = 0;
- + TLan_ClearBit(TLAN_NET_SIO_MDATA, sio);
- + TLan_SetBit(TLAN_NET_SIO_MCLK, sio);
- + (void) TLan_GetBit(TLAN_NET_SIO_MCLK, sio);
- }
-
- -} /* TLan_ResetLists */
- +} /* TLan_MiiSendData */
-
- -void TLan_FreeLists( struct net_device *dev )
- -{
- - TLanPrivateInfo *priv = dev->priv;
- - int i;
- - TLanList *list;
- - struct sk_buff *skb;
- -
- - if ( ! bbuf ) {
- - for ( i = 0; i < TLAN_NUM_TX_LISTS; i++ ) {
- - list = priv->txList + i;
- - skb = (struct sk_buff *) list->buffer[9].address;
- - if ( skb ) {
- - dev_kfree_skb_any( skb );
- - list->buffer[9].address = 0;
- - }
- - }
-
- - for ( i = 0; i < TLAN_NUM_RX_LISTS; i++ ) {
- - list = priv->rxList + i;
- - skb = (struct sk_buff *) list->buffer[9].address;
- - if ( skb ) {
- - dev_kfree_skb_any( skb );
- - list->buffer[9].address = 0;
- - }
- - }
- - }
-
- -} /* TLan_FreeLists */
-
- /***************************************************************
- - * TLan_PrintDio
- - *
- + * TLan_MiiSync
- + *
- * Returns:
- * Nothing
- * Parms:
- - * io_base Base IO port of the device of
- - * which to print DIO registers.
- + * base_port The base IO port of the adapter in
- + * question.
- *
- - * This function prints out all the internal (DIO)
- - * registers of a TLAN chip.
- + * This functions syncs all PHYs in terms of the MII configuration
- + * bus.
- *
- **************************************************************/
-
- -void TLan_PrintDio( u16 io_base )
- +void TLan_MiiSync(u16 base_port)
- {
- - u32 data0, data1;
- - int i;
- + int i;
- + u16 sio;
-
- - printk( "TLAN: Contents of internal registers for io base 0x%04hx.\n", io_base );
- - printk( "TLAN: Off. +0 +4\n" );
- - for ( i = 0; i < 0x4C; i+= 8 ) {
- - data0 = TLan_DioRead32( io_base, i );
- - data1 = TLan_DioRead32( io_base, i + 0x4 );
- - printk( "TLAN: 0x%02x 0x%08x 0x%08x\n", i, data0, data1 );
- + outw(TLAN_NET_SIO, base_port + TLAN_DIO_ADR);
- + sio = base_port + TLAN_DIO_DATA + TLAN_NET_SIO;
- +
- + TLan_ClearBit(TLAN_NET_SIO_MTXEN, sio);
- + for (i = 0; i < 32; i++) {
- + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio);
- + TLan_SetBit(TLAN_NET_SIO_MCLK, sio);
- }
-
- -} /* TLan_PrintDio */
- +} /* TLan_MiiSync */
- +
- +
- +
-
- /***************************************************************
- - * TLan_PrintList
- - *
- + * TLan_MiiWriteReg
- + *
- * Returns:
- * Nothing
- * Parms:
- - * list A pointer to the TLanList structure to
- - * be printed.
- - * type A string to designate type of list,
- - * "Rx" or "Tx".
- - * num The index of the list.
- + * dev The device structure for the device
- + * to write to.
- + * phy The address of the PHY to be written to.
- + * reg The register whose contents are to be
- + * written.
- + * val The value to be written to the register.
- *
- - * This function prints out the contents of the list
- - * pointed to by the list parameter.
- + * This function uses the TLAN's MII bus to write the contents of a
- + * given register on a PHY. It sends the appropriate info and then
- + * writes the 16-bit register value from the MII configuration bus
- + * via the TLAN SIO register.
- *
- **************************************************************/
-
- -void TLan_PrintList( TLanList *list, char *type, int num)
- +void TLan_MiiWriteReg(struct nic *nic __unused, u16 phy, u16 reg, u16 val)
- {
- - int i;
- + u16 sio;
- + int minten;
- +
- + outw(TLAN_NET_SIO, BASE + TLAN_DIO_ADR);
- + sio = BASE + TLAN_DIO_DATA + TLAN_NET_SIO;
- +
- + TLan_MiiSync(BASE);
- +
- + minten = TLan_GetBit(TLAN_NET_SIO_MINTEN, sio);
- + if (minten)
- + TLan_ClearBit(TLAN_NET_SIO_MINTEN, sio);
- +
- + TLan_MiiSendData(BASE, 0x1, 2); /* Start ( 01b ) */
- + TLan_MiiSendData(BASE, 0x1, 2); /* Write ( 01b ) */
- + TLan_MiiSendData(BASE, phy, 5); /* Device # */
- + TLan_MiiSendData(BASE, reg, 5); /* Register # */
- +
- + TLan_MiiSendData(BASE, 0x2, 2); /* Send ACK */
- + TLan_MiiSendData(BASE, val, 16); /* Send Data */
- +
- + TLan_ClearBit(TLAN_NET_SIO_MCLK, sio); /* Idle cycle */
- + TLan_SetBit(TLAN_NET_SIO_MCLK, sio);
- +
- + if (minten)
- + TLan_SetBit(TLAN_NET_SIO_MINTEN, sio);
-
- - printk( "TLAN: %s List %d at 0x%08x\n", type, num, (u32) list );
- - printk( "TLAN: Forward = 0x%08x\n", list->forward );
- - printk( "TLAN: CSTAT = 0x%04hx\n", list->cStat );
- - printk( "TLAN: Frame Size = 0x%04hx\n", list->frameSize );
- - /* for ( i = 0; i < 10; i++ ) { */
- - for ( i = 0; i < 2; i++ ) {
- - printk( "TLAN: Buffer[%d].count, addr = 0x%08x, 0x%08x\n", i, list->buffer[i].count, list->buffer[i].address );
- - }
-
- -} /* TLan_PrintList */
- +} /* TLan_MiiWriteReg */
-
- /***************************************************************
- - * TLan_ReadAndClearStats
- + * TLan_SetMac
- *
- * Returns:
- * Nothing
- * Parms:
- * dev Pointer to device structure of adapter
- - * to which to read stats.
- - * record Flag indicating whether to add
- + * on which to change the AREG.
- + * areg The AREG to set the address in (0 - 3).
- + * mac A pointer to an array of chars. Each
- + * element stores one byte of the address.
- + * IE, it isn't in ascii.
- *
- - * This functions reads all the internal status registers
- - * of the TLAN chip, which clears them as a side effect.
- - * It then either adds the values to the device's status
- - * struct, or discards them, depending on whether record
- - * is TLAN_RECORD (!=0) or TLAN_IGNORE (==0).
- + * This function transfers a MAC address to one of the
- + * TLAN AREGs (address registers). The TLAN chip locks
- + * the register on writing to offset 0 and unlocks the
- + * register after writing to offset 5. If NULL is passed
- + * in mac, then the AREG is filled with 0's.
- *
- **************************************************************/
-
- -void TLan_ReadAndClearStats( struct net_device *dev, int record )
- +void TLan_SetMac(struct nic *nic __unused, int areg, char *mac)
- {
- - TLanPrivateInfo *priv = dev->priv;
- - u32 tx_good, tx_under;
- - u32 rx_good, rx_over;
- - u32 def_tx, crc, code;
- - u32 multi_col, single_col;
- - u32 excess_col, late_col, loss;
- -
- - outw( TLAN_GOOD_TX_FRMS, dev->base_addr + TLAN_DIO_ADR );
- - tx_good = inb( dev->base_addr + TLAN_DIO_DATA );
- - tx_good += inb( dev->base_addr + TLAN_DIO_DATA + 1 ) << 8;
- - tx_good += inb( dev->base_addr + TLAN_DIO_DATA + 2 ) << 16;
- - tx_under = inb( dev->base_addr + TLAN_DIO_DATA + 3 );
- -
- - outw( TLAN_GOOD_RX_FRMS, dev->base_addr + TLAN_DIO_ADR );
- - rx_good = inb( dev->base_addr + TLAN_DIO_DATA );
- - rx_good += inb( dev->base_addr + TLAN_DIO_DATA + 1 ) << 8;
- - rx_good += inb( dev->base_addr + TLAN_DIO_DATA + 2 ) << 16;
- - rx_over = inb( dev->base_addr + TLAN_DIO_DATA + 3 );
- -
- - outw( TLAN_DEFERRED_TX, dev->base_addr + TLAN_DIO_ADR );
- - def_tx = inb( dev->base_addr + TLAN_DIO_DATA );
- - def_tx += inb( dev->base_addr + TLAN_DIO_DATA + 1 ) << 8;
- - crc = inb( dev->base_addr + TLAN_DIO_DATA + 2 );
- - code = inb( dev->base_addr + TLAN_DIO_DATA + 3 );
- -
- - outw( TLAN_MULTICOL_FRMS, dev->base_addr + TLAN_DIO_ADR );
- - multi_col = inb( dev->base_addr + TLAN_DIO_DATA );
- - multi_col += inb( dev->base_addr + TLAN_DIO_DATA + 1 ) << 8;
- - single_col = inb( dev->base_addr + TLAN_DIO_DATA + 2 );
- - single_col += inb( dev->base_addr + TLAN_DIO_DATA + 3 ) << 8;
- -
- - outw( TLAN_EXCESSCOL_FRMS, dev->base_addr + TLAN_DIO_ADR );
- - excess_col = inb( dev->base_addr + TLAN_DIO_DATA );
- - late_col = inb( dev->base_addr + TLAN_DIO_DATA + 1 );
- - loss = inb( dev->base_addr + TLAN_DIO_DATA + 2 );
- -
- - if ( record ) {
- - priv->stats.rx_packets += rx_good;
- - priv->stats.rx_errors += rx_over + crc + code;
- - priv->stats.tx_packets += tx_good;
- - priv->stats.tx_errors += tx_under + loss;
- - priv->stats.collisions += multi_col + single_col + excess_col + late_col;
- -
- - priv->stats.rx_over_errors += rx_over;
- - priv->stats.rx_crc_errors += crc;
- - priv->stats.rx_frame_errors += code;
- + int i;
-
- - priv->stats.tx_aborted_errors += tx_under;
- - priv->stats.tx_carrier_errors += loss;
- + areg *= 6;
- +
- + if (mac != NULL) {
- + for (i = 0; i < 6; i++)
- + TLan_DioWrite8(BASE, TLAN_AREG_0 + areg + i,
- + mac[i]);
- + } else {
- + for (i = 0; i < 6; i++)
- + TLan_DioWrite8(BASE, TLAN_AREG_0 + areg + i, 0);
- }
- -
- -} /* TLan_ReadAndClearStats */
-
- - /***************************************************************
- - * TLan_Reset
- +} /* TLan_SetMac */
- +
- + /*********************************************************************
- + * TLan_PhyDetect
- *
- * Returns:
- - * 0
- + * Nothing
- * Parms:
- - * dev Pointer to device structure of adapter
- - * to be reset.
- + * dev A pointer to the device structure of the adapter
- + * for which the PHY needs determined.
- *
- - * This function resets the adapter and it's physical
- - * device. See Chap. 3, pp. 9-10 of the "ThunderLAN
- - * Programmer's Guide" for details. The routine tries to
- - * implement what is detailed there, though adjustments
- - * have been made.
- + * So far I've found that adapters which have external PHYs
- + * may also use the internal PHY for part of the functionality.
- + * (eg, AUI/Thinnet). This function finds out if this TLAN
- + * chip has an internal PHY, and then finds the first external
- + * PHY (starting from address 0) if it exists).
- *
- - **************************************************************/
- + ********************************************************************/
-
- -void
- -TLan_ResetAdapter( struct net_device *dev )
- +void TLan_PhyDetect(struct nic *nic)
- {
- - TLanPrivateInfo *priv = dev->priv;
- - int i;
- - u32 addr;
- - u32 data;
- - u8 data8;
- + u16 control;
- + u16 hi;
- + u16 lo;
- + u32 phy;
-
- - priv->tlanFullDuplex = FALSE;
- - priv->phyOnline=0;
- -/* 1. Assert reset bit. */
- + if (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_UNMANAGED_PHY) {
- + priv->phyNum = 0xFFFF;
- + return;
- + }
-
- - data = inl(dev->base_addr + TLAN_HOST_CMD);
- - data |= TLAN_HC_AD_RST;
- - outl(data, dev->base_addr + TLAN_HOST_CMD);
- -
- - udelay(1000);
- + TLan_MiiReadReg(nic, TLAN_PHY_MAX_ADDR, MII_GEN_ID_HI, &hi);
-
- -/* 2. Turn off interrupts. ( Probably isn't necessary ) */
- + if (hi != 0xFFFF) {
- + priv->phy[0] = TLAN_PHY_MAX_ADDR;
- + } else {
- + priv->phy[0] = TLAN_PHY_NONE;
- + }
-
- - data = inl(dev->base_addr + TLAN_HOST_CMD);
- - data |= TLAN_HC_INT_OFF;
- - outl(data, dev->base_addr + TLAN_HOST_CMD);
- + priv->phy[1] = TLAN_PHY_NONE;
- + for (phy = 0; phy <= TLAN_PHY_MAX_ADDR; phy++) {
- + TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &control);
- + TLan_MiiReadReg(nic, phy, MII_GEN_ID_HI, &hi);
- + TLan_MiiReadReg(nic, phy, MII_GEN_ID_LO, &lo);
- + if ((control != 0xFFFF) || (hi != 0xFFFF)
- + || (lo != 0xFFFF)) {
- + printf("PHY found at %hX %hX %hX %hX\n", phy,
- + control, hi, lo);
- + if ((priv->phy[1] == TLAN_PHY_NONE)
- + && (phy != TLAN_PHY_MAX_ADDR)) {
- + priv->phy[1] = phy;
- + }
- + }
- + }
-
- -/* 3. Clear AREGs and HASHs. */
- + if (priv->phy[1] != TLAN_PHY_NONE) {
- + priv->phyNum = 1;
- + } else if (priv->phy[0] != TLAN_PHY_NONE) {
- + priv->phyNum = 0;
- + } else {
- + printf
- + ("TLAN: Cannot initialize device, no PHY was found!\n");
- + }
- +
- +} /* TLan_PhyDetect */
-
- - for ( i = TLAN_AREG_0; i <= TLAN_HASH_2; i += 4 ) {
- - TLan_DioWrite32( dev->base_addr, (u16) i, 0 );
- +void TLan_PhyPowerDown(struct nic *nic)
- +{
- +
- + u16 value;
- + printf("%s: Powering down PHY(s).\n", priv->nic_name);
- + value = MII_GC_PDOWN | MII_GC_LOOPBK | MII_GC_ISOLATE;
- + TLan_MiiSync(BASE);
- + TLan_MiiWriteReg(nic, priv->phy[priv->phyNum], MII_GEN_CTL, value);
- + if ((priv->phyNum == 0) && (priv->phy[1] != TLAN_PHY_NONE)
- + &&
- + (!(tlan_pci_tbl[chip_idx].
- + flags & TLAN_ADAPTER_USE_INTERN_10))) {
- + TLan_MiiSync(BASE);
- + TLan_MiiWriteReg(nic, priv->phy[1], MII_GEN_CTL, value);
- }
-
- -/* 4. Setup NetConfig register. */
- + /* Wait for 50 ms and powerup
- + * This is abitrary. It is intended to make sure the
- + * tranceiver settles.
- + */
- + /* TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_PUP ); */
- + mdelay(50);
- + TLan_PhyPowerUp(nic);
-
- - data = TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | TLAN_NET_CFG_PHY_EN;
- - TLan_DioWrite16( dev->base_addr, TLAN_NET_CONFIG, (u16) data );
- +} /* TLan_PhyPowerDown */
-
- -/* 5. Load Ld_Tmr and Ld_Thr in HOST_CMD. */
-
- - outl( TLAN_HC_LD_TMR | 0x3f, dev->base_addr + TLAN_HOST_CMD );
- - outl( TLAN_HC_LD_THR | 0x9, dev->base_addr + TLAN_HOST_CMD );
- +void TLan_PhyPowerUp(struct nic *nic)
- +{
- + u16 value;
-
- -/* 6. Unreset the MII by setting NMRST (in NetSio) to 1. */
- + printf("%s: Powering up PHY.\n", priv->nic_name);
- + TLan_MiiSync(BASE);
- + value = MII_GC_LOOPBK;
- + TLan_MiiWriteReg(nic, priv->phy[priv->phyNum], MII_GEN_CTL, value);
- + TLan_MiiSync(BASE);
- + /* Wait for 500 ms and reset the
- + * tranceiver. The TLAN docs say both 50 ms and
- + * 500 ms, so do the longer, just in case.
- + */
- + mdelay(500);
- + TLan_PhyReset(nic);
- + /* TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_RESET ); */
-
- - outw( TLAN_NET_SIO, dev->base_addr + TLAN_DIO_ADR );
- - addr = dev->base_addr + TLAN_DIO_DATA + TLAN_NET_SIO;
- - TLan_SetBit( TLAN_NET_SIO_NMRST, addr );
- +} /* TLan_PhyPowerUp */
-
- -/* 7. Setup the remaining registers. */
- +void TLan_PhyReset(struct nic *nic)
- +{
- + u16 phy;
- + u16 value;
-
- - if ( priv->tlanRev >= 0x30 ) {
- - data8 = TLAN_ID_TX_EOC | TLAN_ID_RX_EOC;
- - TLan_DioWrite8( dev->base_addr, TLAN_INT_DIS, data8 );
- + phy = priv->phy[priv->phyNum];
- +
- + printf("%s: Reseting PHY.\n", priv->nic_name);
- + TLan_MiiSync(BASE);
- + value = MII_GC_LOOPBK | MII_GC_RESET;
- + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, value);
- + TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &value);
- + while (value & MII_GC_RESET) {
- + TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &value);
- }
- - TLan_PhyDetect( dev );
- - data = TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN;
- -
- - if ( priv->adapter->flags & TLAN_ADAPTER_BIT_RATE_PHY ) {
- - data |= TLAN_NET_CFG_BIT;
- - if ( priv->aui == 1 ) {
- - TLan_DioWrite8( dev->base_addr, TLAN_ACOMMIT, 0x0a );
- - } else if ( priv->duplex == TLAN_DUPLEX_FULL ) {
- - TLan_DioWrite8( dev->base_addr, TLAN_ACOMMIT, 0x00 );
- +
- + /* Wait for 500 ms and initialize.
- + * I don't remember why I wait this long.
- + * I've changed this to 50ms, as it seems long enough.
- + */
- + /* TLan_SetTimer( dev, (HZ/20), TLAN_TIMER_PHY_START_LINK ); */
- + mdelay(50);
- + TLan_PhyStartLink(nic);
- +
- +} /* TLan_PhyReset */
- +
- +
- +void TLan_PhyStartLink(struct nic *nic)
- +{
- +
- + u16 ability;
- + u16 control;
- + u16 data;
- + u16 phy;
- + u16 status;
- + u16 tctl;
- +
- + phy = priv->phy[priv->phyNum];
- + printf("%s: Trying to activate link.\n", priv->nic_name);
- + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status);
- + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &ability);
- +
- + if ((status & MII_GS_AUTONEG) && (!priv->aui)) {
- + ability = status >> 11;
- + if (priv->speed == TLAN_SPEED_10 &&
- + priv->duplex == TLAN_DUPLEX_HALF) {
- + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x0000);
- + } else if (priv->speed == TLAN_SPEED_10 &&
- + priv->duplex == TLAN_DUPLEX_FULL) {
- + priv->tlanFullDuplex = TRUE;
- + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x0100);
- + } else if (priv->speed == TLAN_SPEED_100 &&
- + priv->duplex == TLAN_DUPLEX_HALF) {
- + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x2000);
- + } else if (priv->speed == TLAN_SPEED_100 &&
- + priv->duplex == TLAN_DUPLEX_FULL) {
- priv->tlanFullDuplex = TRUE;
- + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x2100);
- } else {
- - TLan_DioWrite8( dev->base_addr, TLAN_ACOMMIT, 0x08 );
- +
- + /* Set Auto-Neg advertisement */
- + TLan_MiiWriteReg(nic, phy, MII_AN_ADV,
- + (ability << 5) | 1);
- + /* Enablee Auto-Neg */
- + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x1000);
- + /* Restart Auto-Neg */
- + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x1200);
- + /* Wait for 4 sec for autonegotiation
- + * to complete. The max spec time is less than this
- + * but the card need additional time to start AN.
- + * .5 sec should be plenty extra.
- + */
- + printf("TLAN: %s: Starting autonegotiation.\n",
- + priv->nic_name);
- + mdelay(4000);
- + TLan_PhyFinishAutoNeg(nic);
- + /* TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_PHY_FINISH_AN ); */
- + return;
- }
- - }
-
- - if ( priv->phyNum == 0 ) {
- - data |= TLAN_NET_CFG_PHY_EN;
- }
- - TLan_DioWrite16( dev->base_addr, TLAN_NET_CONFIG, (u16) data );
-
- - if ( priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY ) {
- - TLan_FinishReset( dev );
- - } else {
- - TLan_PhyPowerDown( dev );
- + if ((priv->aui) && (priv->phyNum != 0)) {
- + priv->phyNum = 0;
- + data =
- + TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN |
- + TLAN_NET_CFG_PHY_EN;
- + TLan_DioWrite16(BASE, TLAN_NET_CONFIG, data);
- + mdelay(50);
- + /* TLan_SetTimer( dev, (40*HZ/1000), TLAN_TIMER_PHY_PDOWN ); */
- + TLan_PhyPowerDown(nic);
- + return;
- + } else if (priv->phyNum == 0) {
- + control = 0;
- + TLan_MiiReadReg(nic, phy, TLAN_TLPHY_CTL, &tctl);
- + if (priv->aui) {
- + tctl |= TLAN_TC_AUISEL;
- + } else {
- + tctl &= ~TLAN_TC_AUISEL;
- + if (priv->duplex == TLAN_DUPLEX_FULL) {
- + control |= MII_GC_DUPLEX;
- + priv->tlanFullDuplex = TRUE;
- + }
- + if (priv->speed == TLAN_SPEED_100) {
- + control |= MII_GC_SPEEDSEL;
- + }
- + }
- + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, control);
- + TLan_MiiWriteReg(nic, phy, TLAN_TLPHY_CTL, tctl);
- }
-
- -} /* TLan_ResetAdapter */
- + /* Wait for 2 sec to give the tranceiver time
- + * to establish link.
- + */
- + /* TLan_SetTimer( dev, (4*HZ), TLAN_TIMER_FINISH_RESET ); */
- + mdelay(2000);
- + TLan_FinishReset(nic);
- +
- +} /* TLan_PhyStartLink */
-
- -void
- -TLan_FinishReset( struct net_device *dev )
- +void TLan_PhyFinishAutoNeg(struct nic *nic)
- {
- - TLanPrivateInfo *priv = dev->priv;
- - u8 data;
- - u32 phy;
- - u8 sio;
- - u16 status;
- - u16 partner;
- - u16 tlphy_ctl;
- - u16 tlphy_par;
- - u16 tlphy_id1, tlphy_id2;
- - int i;
- +
- + u16 an_adv;
- + u16 an_lpa;
- + u16 data;
- + u16 mode;
- + u16 phy;
- + u16 status;
-
- phy = priv->phy[priv->phyNum];
-
- - data = TLAN_NET_CMD_NRESET | TLAN_NET_CMD_NWRAP;
- - if ( priv->tlanFullDuplex ) {
- - data |= TLAN_NET_CMD_DUPLEX;
- + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status);
- + udelay(1000);
- + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status);
- +
- + if (!(status & MII_GS_AUTOCMPLT)) {
- + /* Wait for 8 sec to give the process
- + * more time. Perhaps we should fail after a while.
- + */
- + if (!priv->neg_be_verbose++) {
- + printf
- + ("TLAN: Giving autonegotiation more time.\n");
- + printf
- + ("TLAN: Please check that your adapter has\n");
- + printf
- + ("TLAN: been properly connected to a HUB or Switch.\n");
- + printf
- + ("TLAN: Trying to establish link in the background...\n");
- + }
- + mdelay(8000);
- + TLan_PhyFinishAutoNeg(nic);
- + /* TLan_SetTimer( dev, (8*HZ), TLAN_TIMER_PHY_FINISH_AN ); */
- + return;
- }
- - TLan_DioWrite8( dev->base_addr, TLAN_NET_CMD, data );
- - data = TLAN_NET_MASK_MASK4 | TLAN_NET_MASK_MASK5;
- - if ( priv->phyNum == 0 ) {
- - data |= TLAN_NET_MASK_MASK7;
- - }
- - TLan_DioWrite8( dev->base_addr, TLAN_NET_MASK, data );
- - TLan_DioWrite16( dev->base_addr, TLAN_MAX_RX, ((1536)+7)&~7 );
- - TLan_MiiReadReg( dev, phy, MII_GEN_ID_HI, &tlphy_id1 );
- - TLan_MiiReadReg( dev, phy, MII_GEN_ID_LO, &tlphy_id2 );
- -
- - if ( ( priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY ) || ( priv->aui ) ) {
- - status = MII_GS_LINK;
- - printk( "TLAN: %s: Link forced.\n", dev->name );
- - } else {
- - TLan_MiiReadReg( dev, phy, MII_GEN_STS, &status );
- - udelay( 1000 );
- - TLan_MiiReadReg( dev, phy, MII_GEN_STS, &status );
- - if ( (status & MII_GS_LINK) && /* We only support link info on Nat.Sem. PHY's */
- - (tlphy_id1 == NAT_SEM_ID1) &&
- - (tlphy_id2 == NAT_SEM_ID2) ) {
- - TLan_MiiReadReg( dev, phy, MII_AN_LPA, &partner );
- - TLan_MiiReadReg( dev, phy, TLAN_TLPHY_PAR, &tlphy_par );
- -
- - printk( "TLAN: %s: Link active with ", dev->name );
- - if (!(tlphy_par & TLAN_PHY_AN_EN_STAT)) {
- - printk( "forced 10%sMbps %s-Duplex\n",
- - tlphy_par & TLAN_PHY_SPEED_100 ? "" : "0",
- - tlphy_par & TLAN_PHY_DUPLEX_FULL ? "Full" : "Half");
- - } else {
- - printk( "AutoNegotiation enabled, at 10%sMbps %s-Duplex\n",
- - tlphy_par & TLAN_PHY_SPEED_100 ? "" : "0",
- - tlphy_par & TLAN_PHY_DUPLEX_FULL ? "Full" : "Half");
- - printk("TLAN: Partner capability: ");
- - for (i = 5; i <= 10; i++)
- - if (partner & (1<<i))
- - printk("%s", media[i-5]);
- - printk("\n");
- - }
-
- - TLan_DioWrite8( dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK );
- -#ifdef MONITOR
- - /* We have link beat..for now anyway */
- - priv->link = 1;
- - /*Enabling link beat monitoring */
- - TLan_SetTimer( dev, (10*HZ), TLAN_TIMER_LINK_BEAT );
- -#endif
- - } else if (status & MII_GS_LINK) {
- - printk( "TLAN: %s: Link active\n", dev->name );
- - TLan_DioWrite8( dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK );
- - }
- + printf("TLAN: %s: Autonegotiation complete.\n", priv->nic_name);
- + TLan_MiiReadReg(nic, phy, MII_AN_ADV, &an_adv);
- + TLan_MiiReadReg(nic, phy, MII_AN_LPA, &an_lpa);
- + mode = an_adv & an_lpa & 0x03E0;
- + if (mode & 0x0100) {
- + printf("Full Duplex\n");
- + priv->tlanFullDuplex = TRUE;
- + } else if (!(mode & 0x0080) && (mode & 0x0040)) {
- + priv->tlanFullDuplex = TRUE;
- + printf("Full Duplex\n");
- }
-
- - if ( priv->phyNum == 0 ) {
- - TLan_MiiReadReg( dev, phy, TLAN_TLPHY_CTL, &tlphy_ctl );
- - tlphy_ctl |= TLAN_TC_INTEN;
- - TLan_MiiWriteReg( dev, phy, TLAN_TLPHY_CTL, tlphy_ctl );
- - sio = TLan_DioRead8( dev->base_addr, TLAN_NET_SIO );
- - sio |= TLAN_NET_SIO_MINTEN;
- - TLan_DioWrite8( dev->base_addr, TLAN_NET_SIO, sio );
- + if ((!(mode & 0x0180))
- + && (tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_USE_INTERN_10)
- + && (priv->phyNum != 0)) {
- + priv->phyNum = 0;
- + data =
- + TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN |
- + TLAN_NET_CFG_PHY_EN;
- + TLan_DioWrite16(BASE, TLAN_NET_CONFIG, data);
- + /* TLan_SetTimer( nic, (400*HZ/1000), TLAN_TIMER_PHY_PDOWN ); */
- + mdelay(400);
- + TLan_PhyPowerDown(nic);
- + return;
- }
-
- - if ( status & MII_GS_LINK ) {
- - TLan_SetMac( dev, 0, dev->dev_addr );
- - priv->phyOnline = 1;
- - outb( ( TLAN_HC_INT_ON >> 8 ), dev->base_addr + TLAN_HOST_CMD + 1 );
- - if ( debug >= 1 && debug != TLAN_DEBUG_PROBE ) {
- - outb( ( TLAN_HC_REQ_INT >> 8 ), dev->base_addr + TLAN_HOST_CMD + 1 );
- + if (priv->phyNum == 0) {
- + if ((priv->duplex == TLAN_DUPLEX_FULL)
- + || (an_adv & an_lpa & 0x0040)) {
- + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL,
- + MII_GC_AUTOENB | MII_GC_DUPLEX);
- + printf
- + ("TLAN: Starting internal PHY with FULL-DUPLEX\n");
- + } else {
- + TLan_MiiWriteReg(nic, phy, MII_GEN_CTL,
- + MII_GC_AUTOENB);
- + printf
- + ("TLAN: Starting internal PHY with HALF-DUPLEX\n");
- }
- - outl( virt_to_bus( priv->rxList ), dev->base_addr + TLAN_CH_PARM );
- - outl( TLAN_HC_GO | TLAN_HC_RT, dev->base_addr + TLAN_HOST_CMD );
- - } else {
- - printk( "TLAN: %s: Link inactive, will retry in 10 secs...\n", dev->name );
- - TLan_SetTimer( dev, (10*HZ), TLAN_TIMER_FINISH_RESET );
- - return;
- }
-
- -} /* TLan_FinishReset */
- + /* Wait for 100 ms. No reason in partiticular.
- + */
- + /* TLan_SetTimer( dev, (HZ/10), TLAN_TIMER_FINISH_RESET ); */
- + mdelay(100);
- + TLan_FinishReset(nic);
-
- - /***************************************************************
- - * TLan_SetMac
- - *
- - * Returns:
- - * Nothing
- - * Parms:
- - * dev Pointer to device structure of adapter
- - * on which to change the AREG.
- - * areg The AREG to set the address in (0 - 3).
- - * mac A pointer to an array of chars. Each
- - * element stores one byte of the address.
- - * IE, it isn't in ascii.
- - *
- - * This function transfers a MAC address to one of the
- - * TLAN AREGs (address registers). The TLAN chip locks
- - * the register on writing to offset 0 and unlocks the
- - * register after writing to offset 5. If NULL is passed
- - * in mac, then the AREG is filled with 0's.
- - *
- - **************************************************************/
- +} /* TLan_PhyFinishAutoNeg */
- +
- +#ifdef MONITOR
- +
- + /*********************************************************************
- + *
- + * TLan_phyMonitor
- + *
- + * Returns:
- + * None
- + *
- + * Params:
- + * dev The device structure of this device.
- + *
- + *
- + * This function monitors PHY condition by reading the status
- + * register via the MII bus. This can be used to give info
- + * about link changes (up/down), and possible switch to alternate
- + * media.
- + *
- + * ******************************************************************/
-
- -void TLan_SetMac( struct net_device *dev, int areg, char *mac )
- +void TLan_PhyMonitor(struct net_device *dev)
- {
- - int i;
- -
- - areg *= 6;
- + TLanPrivateInfo *priv = dev->priv;
- + u16 phy;
- + u16 phy_status;
-
- - if ( mac != NULL ) {
- - for ( i = 0; i < 6; i++ )
- - TLan_DioWrite8( dev->base_addr, TLAN_AREG_0 + areg + i, mac[i] );
- - } else {
- - for ( i = 0; i < 6; i++ )
- - TLan_DioWrite8( dev->base_addr, TLAN_AREG_0 + areg + i, 0 );
- + phy = priv->phy[priv->phyNum];
- +
- + /* Get PHY status register */
- + TLan_MiiReadReg(nic, phy, MII_GEN_STS, &phy_status);
- +
- + /* Check if link has been lost */
- + if (!(phy_status & MII_GS_LINK)) {
- + if (priv->link) {
- + priv->link = 0;
- + printf("TLAN: %s has lost link\n", priv->nic_name);
- + priv->flags &= ~IFF_RUNNING;
- + mdelay(2000);
- + TLan_PhyMonitor(nic);
- + /* TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_LINK_BEAT ); */
- + return;
- + }
- }
-
- -} /* TLan_SetMac */
- + /* Link restablished? */
- + if ((phy_status & MII_GS_LINK) && !priv->link) {
- + priv->link = 1;
- + printf("TLAN: %s has reestablished link\n",
- + priv->nic_name);
- + priv->flags |= IFF_RUNNING;
- + }
- +
- + /* Setup a new monitor */
- + /* TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_LINK_BEAT ); */
- + mdelay(2000);
- + TLan_PhyMonitor(nic);
- +}
-
- +#endif /* MONITOR */
- +
- +#ifdef EB51
- +static struct pci_id tlan_nics[] = {
- + PCI_ROM(0x0e11, 0xae34, "netel10", "Compaq Netelligent 10 T PCI UTP"),
- + PCI_ROM(0x0e11, 0xae32, "netel100","Compaq Netelligent 10/100 TX PCI UTP"),
- + PCI_ROM(0x0e11, 0xae35, "netflex3i", "Compaq Integrated NetFlex-3/P"),
- + PCI_ROM(0x0e11, 0xf130, "thunder", "Compaq NetFlex-3/P"),
- + PCI_ROM(0x0e11, 0xf150, "netflex3b", "Compaq NetFlex-3/P"),
- + PCI_ROM(0x0e11, 0xae43, "netel100pi", "Compaq Netelligent Integrated 10/100 TX UTP"),
- + PCI_ROM(0x0e11, 0xae40, "netel100d", "Compaq Netelligent Dual 10/100 TX PCI UTP"),
- + PCI_ROM(0x0e11, 0xb011, "netel100i", "Compaq Netelligent 10/100 TX Embedded UTP"),
- + PCI_ROM(0x108d, 0x0013, "oc2183", "Olicom OC-2183/2185"),
- + PCI_ROM(0x108d, 0x0012, "oc2325", "Olicom OC-2325"),
- + PCI_ROM(0x108d, 0x0014, "oc2326", "Olicom OC-2326"),
- + PCI_ROM(0x0e11, 0xb030, "netelligent_10_100_ws_5100", "Compaq Netelligent 10/100 TX UTP"),
- + PCI_ROM(0x0e11, 0xb012, "netelligent_10_t2", "Compaq Netelligent 10 T/2 PCI UTP/Coax"),
- +};
- +
- +struct pci_driver tlan_driver = {
- + .type = NIC_DRIVER,
- + .name = "TLAN/PCI",
- + .probe = tlan_probe,
- + .ids = tlan_nics,
- + .id_count = sizeof(tlan_nics) / sizeof(tlan_nics[0]),
- + .class = 0,
- +};
- #endif
- diff -Naur grub-0.97.orig/netboot/tlan.h grub-0.97/netboot/tlan.h
- --- grub-0.97.orig/netboot/tlan.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/tlan.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,536 @@
- +/**************************************************************************
- +*
- +* tlan.c -- Etherboot device driver for the Texas Instruments ThunderLAN
- +* Written 2003-2003 by Timothy Legge <tlegge@rogers.com>
- +*
- +* This program is free software; you can redistribute it and/or modify
- +* it under the terms of the GNU General Public License as published by
- +* the Free Software Foundation; either version 2 of the License, or
- +* (at your option) any later version.
- +*
- +* This program is distributed in the hope that it will be useful,
- +* but WITHOUT ANY WARRANTY; without even the implied warranty of
- +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +* GNU General Public License for more details.
- +*
- +* You should have received a copy of the GNU General Public License
- +* along with this program; if not, write to the Free Software
- +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- +*
- +* Portions of this code (almost all) based on:
- +* tlan.c: Linux ThunderLan Driver:
- +*
- +* by James Banks
- +*
- +* (C) 1997-1998 Caldera, Inc.
- +* (C) 1998 James Banks
- +* (C) 1999-2001 Torben Mathiasen
- +* (C) 2002 Samuel Chessman
- +*
- +* REVISION HISTORY:
- +* ================
- +* v1.0 07-08-2003 timlegge Initial not quite working version
- +*
- +* Indent Style: indent -kr -i8
- +***************************************************************************/
- +
- +/*
- +#include <asm/io.h>
- +#include <asm/types.h>
- +#include <linux/netdevice.h>
- +*/
- +
- +typedef unsigned char u8;
- +typedef signed char s8;
- +typedef unsigned short u16;
- +typedef signed short s16;
- +typedef unsigned int u32;
- +typedef signed int s32;
- + /*****************************************************************
- + * TLan Definitions
- + *
- + ****************************************************************/
- +
- +#define FALSE 0
- +#define TRUE 1
- +
- +#define TLAN_MIN_FRAME_SIZE 64
- +#define TLAN_MAX_FRAME_SIZE 1600
- +
- +#define TLAN_NUM_RX_LISTS 4
- +#define TLAN_NUM_TX_LISTS 2
- +
- +#define TLAN_IGNORE 0
- +#define TLAN_RECORD 1
- +/*
- +#define TLAN_DBG(lvl, format, args...) if (debug&lvl) printf("TLAN: " format, ##args );
- +*/
- +#define TLAN_DEBUG_GNRL 0x0001
- +#define TLAN_DEBUG_TX 0x0002
- +#define TLAN_DEBUG_RX 0x0004
- +#define TLAN_DEBUG_LIST 0x0008
- +#define TLAN_DEBUG_PROBE 0x0010
- +
- +#define TX_TIMEOUT (10*HZ) /* We need time for auto-neg */
- +#define MAX_TLAN_BOARDS 8 /* Max number of boards installed at a time */
- +
- +
- + /*****************************************************************
- + * Device Identification Definitions
- + *
- + ****************************************************************/
- +
- +#define PCI_DEVICE_ID_NETELLIGENT_10_T2 0xB012
- +#define PCI_DEVICE_ID_NETELLIGENT_10_100_WS_5100 0xB030
- +#ifndef PCI_DEVICE_ID_OLICOM_OC2183
- +#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013
- +#endif
- +#ifndef PCI_DEVICE_ID_OLICOM_OC2325
- +#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012
- +#endif
- +#ifndef PCI_DEVICE_ID_OLICOM_OC2326
- +#define PCI_DEVICE_ID_OLICOM_OC2326 0x0014
- +#endif
- +
- +typedef struct tlan_adapter_entry {
- + u16 vendorId;
- + u16 deviceId;
- + char *deviceLabel;
- + u32 flags;
- + u16 addrOfs;
- +} TLanAdapterEntry;
- +
- +#define TLAN_ADAPTER_NONE 0x00000000
- +#define TLAN_ADAPTER_UNMANAGED_PHY 0x00000001
- +#define TLAN_ADAPTER_BIT_RATE_PHY 0x00000002
- +#define TLAN_ADAPTER_USE_INTERN_10 0x00000004
- +#define TLAN_ADAPTER_ACTIVITY_LED 0x00000008
- +
- +#define TLAN_SPEED_DEFAULT 0
- +#define TLAN_SPEED_10 10
- +#define TLAN_SPEED_100 100
- +
- +#define TLAN_DUPLEX_DEFAULT 0
- +#define TLAN_DUPLEX_HALF 1
- +#define TLAN_DUPLEX_FULL 2
- +
- +
- +
- + /*****************************************************************
- + * EISA Definitions
- + *
- + ****************************************************************/
- +
- +#define EISA_ID 0xc80 /* EISA ID Registers */
- +#define EISA_ID0 0xc80 /* EISA ID Register 0 */
- +#define EISA_ID1 0xc81 /* EISA ID Register 1 */
- +#define EISA_ID2 0xc82 /* EISA ID Register 2 */
- +#define EISA_ID3 0xc83 /* EISA ID Register 3 */
- +#define EISA_CR 0xc84 /* EISA Control Register */
- +#define EISA_REG0 0xc88 /* EISA Configuration Register 0 */
- +#define EISA_REG1 0xc89 /* EISA Configuration Register 1 */
- +#define EISA_REG2 0xc8a /* EISA Configuration Register 2 */
- +#define EISA_REG3 0xc8f /* EISA Configuration Register 3 */
- +#define EISA_APROM 0xc90 /* Ethernet Address PROM */
- +
- +
- +
- + /*****************************************************************
- + * Rx/Tx List Definitions
- + *
- + ****************************************************************/
- +
- +#define TLAN_BUFFERS_PER_LIST 10
- +#define TLAN_LAST_BUFFER 0x80000000
- +#define TLAN_CSTAT_UNUSED 0x8000
- +#define TLAN_CSTAT_FRM_CMP 0x4000
- +#define TLAN_CSTAT_READY 0x3000
- +#define TLAN_CSTAT_EOC 0x0800
- +#define TLAN_CSTAT_RX_ERROR 0x0400
- +#define TLAN_CSTAT_PASS_CRC 0x0200
- +#define TLAN_CSTAT_DP_PR 0x0100
- +
- +
- +
- +
- +
- +
- + /*****************************************************************
- + * PHY definitions
- + *
- + ****************************************************************/
- +
- +#define TLAN_PHY_MAX_ADDR 0x1F
- +#define TLAN_PHY_NONE 0x20
- +
- +
- +
- + /*****************************************************************
- + * TLan Driver Timer Definitions
- + *
- + ****************************************************************/
- +
- +#define TLAN_TIMER_LINK_BEAT 1
- +#define TLAN_TIMER_ACTIVITY 2
- +#define TLAN_TIMER_PHY_PDOWN 3
- +#define TLAN_TIMER_PHY_PUP 4
- +#define TLAN_TIMER_PHY_RESET 5
- +#define TLAN_TIMER_PHY_START_LINK 6
- +#define TLAN_TIMER_PHY_FINISH_AN 7
- +#define TLAN_TIMER_FINISH_RESET 8
- +
- +#define TLAN_TIMER_ACT_DELAY (HZ/10)
- +
- +
- +
- +
- + /*****************************************************************
- + * TLan Driver Eeprom Definitions
- + *
- + ****************************************************************/
- +
- +#define TLAN_EEPROM_ACK 0
- +#define TLAN_EEPROM_STOP 1
- +
- +
- +
- +
- + /*****************************************************************
- + * Host Register Offsets and Contents
- + *
- + ****************************************************************/
- +
- +#define TLAN_HOST_CMD 0x00
- +#define TLAN_HC_GO 0x80000000
- +#define TLAN_HC_STOP 0x40000000
- +#define TLAN_HC_ACK 0x20000000
- +#define TLAN_HC_CS_MASK 0x1FE00000
- +#define TLAN_HC_EOC 0x00100000
- +#define TLAN_HC_RT 0x00080000
- +#define TLAN_HC_NES 0x00040000
- +#define TLAN_HC_AD_RST 0x00008000
- +#define TLAN_HC_LD_TMR 0x00004000
- +#define TLAN_HC_LD_THR 0x00002000
- +#define TLAN_HC_REQ_INT 0x00001000
- +#define TLAN_HC_INT_OFF 0x00000800
- +#define TLAN_HC_INT_ON 0x00000400
- +#define TLAN_HC_AC_MASK 0x000000FF
- +#define TLAN_CH_PARM 0x04
- +#define TLAN_DIO_ADR 0x08
- +#define TLAN_DA_ADR_INC 0x8000
- +#define TLAN_DA_RAM_ADR 0x4000
- +#define TLAN_HOST_INT 0x0A
- +#define TLAN_HI_IV_MASK 0x1FE0
- +#define TLAN_HI_IT_MASK 0x001C
- +#define TLAN_DIO_DATA 0x0C
- +
- +
- +/* ThunderLAN Internal Register DIO Offsets */
- +
- +#define TLAN_NET_CMD 0x00
- +#define TLAN_NET_CMD_NRESET 0x80
- +#define TLAN_NET_CMD_NWRAP 0x40
- +#define TLAN_NET_CMD_CSF 0x20
- +#define TLAN_NET_CMD_CAF 0x10
- +#define TLAN_NET_CMD_NOBRX 0x08
- +#define TLAN_NET_CMD_DUPLEX 0x04
- +#define TLAN_NET_CMD_TRFRAM 0x02
- +#define TLAN_NET_CMD_TXPACE 0x01
- +#define TLAN_NET_SIO 0x01
- +#define TLAN_NET_SIO_MINTEN 0x80
- +#define TLAN_NET_SIO_ECLOK 0x40
- +#define TLAN_NET_SIO_ETXEN 0x20
- +#define TLAN_NET_SIO_EDATA 0x10
- +#define TLAN_NET_SIO_NMRST 0x08
- +#define TLAN_NET_SIO_MCLK 0x04
- +#define TLAN_NET_SIO_MTXEN 0x02
- +#define TLAN_NET_SIO_MDATA 0x01
- +#define TLAN_NET_STS 0x02
- +#define TLAN_NET_STS_MIRQ 0x80
- +#define TLAN_NET_STS_HBEAT 0x40
- +#define TLAN_NET_STS_TXSTOP 0x20
- +#define TLAN_NET_STS_RXSTOP 0x10
- +#define TLAN_NET_STS_RSRVD 0x0F
- +#define TLAN_NET_MASK 0x03
- +#define TLAN_NET_MASK_MASK7 0x80
- +#define TLAN_NET_MASK_MASK6 0x40
- +#define TLAN_NET_MASK_MASK5 0x20
- +#define TLAN_NET_MASK_MASK4 0x10
- +#define TLAN_NET_MASK_RSRVD 0x0F
- +#define TLAN_NET_CONFIG 0x04
- +#define TLAN_NET_CFG_RCLK 0x8000
- +#define TLAN_NET_CFG_TCLK 0x4000
- +#define TLAN_NET_CFG_BIT 0x2000
- +#define TLAN_NET_CFG_RXCRC 0x1000
- +#define TLAN_NET_CFG_PEF 0x0800
- +#define TLAN_NET_CFG_1FRAG 0x0400
- +#define TLAN_NET_CFG_1CHAN 0x0200
- +#define TLAN_NET_CFG_MTEST 0x0100
- +#define TLAN_NET_CFG_PHY_EN 0x0080
- +#define TLAN_NET_CFG_MSMASK 0x007F
- +#define TLAN_MAN_TEST 0x06
- +#define TLAN_DEF_VENDOR_ID 0x08
- +#define TLAN_DEF_DEVICE_ID 0x0A
- +#define TLAN_DEF_REVISION 0x0C
- +#define TLAN_DEF_SUBCLASS 0x0D
- +#define TLAN_DEF_MIN_LAT 0x0E
- +#define TLAN_DEF_MAX_LAT 0x0F
- +#define TLAN_AREG_0 0x10
- +#define TLAN_AREG_1 0x16
- +#define TLAN_AREG_2 0x1C
- +#define TLAN_AREG_3 0x22
- +#define TLAN_HASH_1 0x28
- +#define TLAN_HASH_2 0x2C
- +#define TLAN_GOOD_TX_FRMS 0x30
- +#define TLAN_TX_UNDERUNS 0x33
- +#define TLAN_GOOD_RX_FRMS 0x34
- +#define TLAN_RX_OVERRUNS 0x37
- +#define TLAN_DEFERRED_TX 0x38
- +#define TLAN_CRC_ERRORS 0x3A
- +#define TLAN_CODE_ERRORS 0x3B
- +#define TLAN_MULTICOL_FRMS 0x3C
- +#define TLAN_SINGLECOL_FRMS 0x3E
- +#define TLAN_EXCESSCOL_FRMS 0x40
- +#define TLAN_LATE_COLS 0x41
- +#define TLAN_CARRIER_LOSS 0x42
- +#define TLAN_ACOMMIT 0x43
- +#define TLAN_LED_REG 0x44
- +#define TLAN_LED_ACT 0x10
- +#define TLAN_LED_LINK 0x01
- +#define TLAN_BSIZE_REG 0x45
- +#define TLAN_MAX_RX 0x46
- +#define TLAN_INT_DIS 0x48
- +#define TLAN_ID_TX_EOC 0x04
- +#define TLAN_ID_RX_EOF 0x02
- +#define TLAN_ID_RX_EOC 0x01
- +
- +
- +
- +/* ThunderLAN Interrupt Codes */
- +
- +#define TLAN_INT_NUMBER_OF_INTS 8
- +
- +#define TLAN_INT_NONE 0x0000
- +#define TLAN_INT_TX_EOF 0x0001
- +#define TLAN_INT_STAT_OVERFLOW 0x0002
- +#define TLAN_INT_RX_EOF 0x0003
- +#define TLAN_INT_DUMMY 0x0004
- +#define TLAN_INT_TX_EOC 0x0005
- +#define TLAN_INT_STATUS_CHECK 0x0006
- +#define TLAN_INT_RX_EOC 0x0007
- +
- +
- +
- +/* ThunderLAN MII Registers */
- +
- +/* Generic MII/PHY Registers */
- +
- +#define MII_GEN_CTL 0x00
- +#define MII_GC_RESET 0x8000
- +#define MII_GC_LOOPBK 0x4000
- +#define MII_GC_SPEEDSEL 0x2000
- +#define MII_GC_AUTOENB 0x1000
- +#define MII_GC_PDOWN 0x0800
- +#define MII_GC_ISOLATE 0x0400
- +#define MII_GC_AUTORSRT 0x0200
- +#define MII_GC_DUPLEX 0x0100
- +#define MII_GC_COLTEST 0x0080
- +#define MII_GC_RESERVED 0x007F
- +#define MII_GEN_STS 0x01
- +#define MII_GS_100BT4 0x8000
- +#define MII_GS_100BTXFD 0x4000
- +#define MII_GS_100BTXHD 0x2000
- +#define MII_GS_10BTFD 0x1000
- +#define MII_GS_10BTHD 0x0800
- +#define MII_GS_RESERVED 0x07C0
- +#define MII_GS_AUTOCMPLT 0x0020
- +#define MII_GS_RFLT 0x0010
- +#define MII_GS_AUTONEG 0x0008
- +#define MII_GS_LINK 0x0004
- +#define MII_GS_JABBER 0x0002
- +#define MII_GS_EXTCAP 0x0001
- +#define MII_GEN_ID_HI 0x02
- +#define MII_GEN_ID_LO 0x03
- +#define MII_GIL_OUI 0xFC00
- +#define MII_GIL_MODEL 0x03F0
- +#define MII_GIL_REVISION 0x000F
- +#define MII_AN_ADV 0x04
- +#define MII_AN_LPA 0x05
- +#define MII_AN_EXP 0x06
- +
- +/* ThunderLAN Specific MII/PHY Registers */
- +
- +#define TLAN_TLPHY_ID 0x10
- +#define TLAN_TLPHY_CTL 0x11
- +#define TLAN_TC_IGLINK 0x8000
- +#define TLAN_TC_SWAPOL 0x4000
- +#define TLAN_TC_AUISEL 0x2000
- +#define TLAN_TC_SQEEN 0x1000
- +#define TLAN_TC_MTEST 0x0800
- +#define TLAN_TC_RESERVED 0x07F8
- +#define TLAN_TC_NFEW 0x0004
- +#define TLAN_TC_INTEN 0x0002
- +#define TLAN_TC_TINT 0x0001
- +#define TLAN_TLPHY_STS 0x12
- +#define TLAN_TS_MINT 0x8000
- +#define TLAN_TS_PHOK 0x4000
- +#define TLAN_TS_POLOK 0x2000
- +#define TLAN_TS_TPENERGY 0x1000
- +#define TLAN_TS_RESERVED 0x0FFF
- +#define TLAN_TLPHY_PAR 0x19
- +#define TLAN_PHY_CIM_STAT 0x0020
- +#define TLAN_PHY_SPEED_100 0x0040
- +#define TLAN_PHY_DUPLEX_FULL 0x0080
- +#define TLAN_PHY_AN_EN_STAT 0x0400
- +
- +/* National Sem. & Level1 PHY id's */
- +#define NAT_SEM_ID1 0x2000
- +#define NAT_SEM_ID2 0x5C01
- +#define LEVEL1_ID1 0x7810
- +#define LEVEL1_ID2 0x0000
- +
- +#define CIRC_INC( a, b ) if ( ++a >= b ) a = 0
- +
- +/* Routines to access internal registers. */
- +
- +inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr)
- +{
- + outw(internal_addr, base_addr + TLAN_DIO_ADR);
- + return (inb((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x3)));
- +
- +} /* TLan_DioRead8 */
- +
- +
- +
- +
- +inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr)
- +{
- + outw(internal_addr, base_addr + TLAN_DIO_ADR);
- + return (inw((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x2)));
- +
- +} /* TLan_DioRead16 */
- +
- +
- +
- +
- +inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr)
- +{
- + outw(internal_addr, base_addr + TLAN_DIO_ADR);
- + return (inl(base_addr + TLAN_DIO_DATA));
- +
- +} /* TLan_DioRead32 */
- +
- +
- +
- +
- +inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)
- +{
- + outw(internal_addr, base_addr + TLAN_DIO_ADR);
- + outb(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x3));
- +
- +}
- +
- +
- +
- +
- +inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)
- +{
- + outw(internal_addr, base_addr + TLAN_DIO_ADR);
- + outw(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
- +
- +}
- +
- +
- +
- +
- +inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data)
- +{
- + outw(internal_addr, base_addr + TLAN_DIO_ADR);
- + outl(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
- +
- +}
- +
- +
- +
- +#if 0
- +inline void TLan_ClearBit(u8 bit, u16 port)
- +{
- + outb_p(inb_p(port) & ~bit, port);
- +}
- +
- +
- +
- +
- +inline int TLan_GetBit(u8 bit, u16 port)
- +{
- + return ((int) (inb_p(port) & bit));
- +}
- +
- +
- +
- +
- +inline void TLan_SetBit(u8 bit, u16 port)
- +{
- + outb_p(inb_p(port) | bit, port);
- +}
- +#endif
- +
- +#define TLan_ClearBit( bit, port ) outb_p(inb_p(port) & ~bit, port)
- +#define TLan_GetBit( bit, port ) ((int) (inb_p(port) & bit))
- +#define TLan_SetBit( bit, port ) outb_p(inb_p(port) | bit, port)
- +
- +#ifdef I_LIKE_A_FAST_HASH_FUNCTION
- +/* given 6 bytes, view them as 8 6-bit numbers and return the XOR of those */
- +/* the code below is about seven times as fast as the original code */
- +inline u32 TLan_HashFunc(u8 * a)
- +{
- + u8 hash;
- +
- + hash = (a[0] ^ a[3]); /* & 077 */
- + hash ^= ((a[0] ^ a[3]) >> 6); /* & 003 */
- + hash ^= ((a[1] ^ a[4]) << 2); /* & 074 */
- + hash ^= ((a[1] ^ a[4]) >> 4); /* & 017 */
- + hash ^= ((a[2] ^ a[5]) << 4); /* & 060 */
- + hash ^= ((a[2] ^ a[5]) >> 2); /* & 077 */
- +
- + return (hash & 077);
- +}
- +
- +#else /* original code */
- +
- +inline u32 xor(u32 a, u32 b)
- +{
- + return ((a && !b) || (!a && b));
- +}
- +
- +#define XOR8( a, b, c, d, e, f, g, h ) xor( a, xor( b, xor( c, xor( d, xor( e, xor( f, xor( g, h ) ) ) ) ) ) )
- +#define DA( a, bit ) ( ( (u8) a[bit/8] ) & ( (u8) ( 1 << bit%8 ) ) )
- +
- +inline u32 TLan_HashFunc(u8 * a)
- +{
- + u32 hash;
- +
- + hash =
- + XOR8(DA(a, 0), DA(a, 6), DA(a, 12), DA(a, 18), DA(a, 24),
- + DA(a, 30), DA(a, 36), DA(a, 42));
- + hash |=
- + XOR8(DA(a, 1), DA(a, 7), DA(a, 13), DA(a, 19), DA(a, 25),
- + DA(a, 31), DA(a, 37), DA(a, 43)) << 1;
- + hash |=
- + XOR8(DA(a, 2), DA(a, 8), DA(a, 14), DA(a, 20), DA(a, 26),
- + DA(a, 32), DA(a, 38), DA(a, 44)) << 2;
- + hash |=
- + XOR8(DA(a, 3), DA(a, 9), DA(a, 15), DA(a, 21), DA(a, 27),
- + DA(a, 33), DA(a, 39), DA(a, 45)) << 3;
- + hash |=
- + XOR8(DA(a, 4), DA(a, 10), DA(a, 16), DA(a, 22), DA(a, 28),
- + DA(a, 34), DA(a, 40), DA(a, 46)) << 4;
- + hash |=
- + XOR8(DA(a, 5), DA(a, 11), DA(a, 17), DA(a, 23), DA(a, 29),
- + DA(a, 35), DA(a, 41), DA(a, 47)) << 5;
- +
- + return hash;
- +
- +}
- +
- +#endif /* I_LIKE_A_FAST_HASH_FUNCTION */
- diff -Naur grub-0.97.orig/netboot/tulip.c grub-0.97/netboot/tulip.c
- --- grub-0.97.orig/netboot/tulip.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/tulip.c 2005-08-31 19:03:35.000000000 +0000
- @@ -48,6 +48,7 @@
- /*********************************************************************/
-
- /*
- + 07 Sep 2003 timlegge Multicast Support Added
- 11 Apr 2001 mdc [patch to etherboot 4.7.24]
- Major rewrite to include Linux tulip driver media detection
- code. This driver should support a lot more cards now.
- @@ -98,7 +99,6 @@
- and thinguin mailing lists.
- */
-
- -
- /*********************************************************************/
- /* Declarations */
- /*********************************************************************/
- @@ -106,31 +106,29 @@
- #include "etherboot.h"
- #include "nic.h"
- #include "pci.h"
- -#include "cards.h"
-
- /* User settable parameters */
-
- -#undef TULIP_DEBUG
- -#undef TULIP_DEBUG_WHERE
- +#undef TULIP_DEBUG
- +#undef TULIP_DEBUG_WHERE
- +#ifdef TULIP_DEBUG
- static int tulip_debug = 2; /* 1 normal messages, 0 quiet .. 7 verbose. */
- +#endif
-
- #define TX_TIME_OUT 2*TICKS_PER_SEC
-
- -typedef unsigned char u8;
- -typedef signed char s8;
- -typedef unsigned short u16;
- -typedef signed short s16;
- -typedef unsigned int u32;
- -typedef signed int s32;
- +typedef uint8_t u8;
- +typedef int8_t s8;
- +typedef uint16_t u16;
- +typedef int16_t s16;
- +typedef uint32_t u32;
- +typedef int32_t s32;
-
- /* helpful macros if on a big_endian machine for changing byte order.
- not strictly needed on Intel */
- -#define le16_to_cpu(val) (val)
- -#define cpu_to_le32(val) (val)
- #define get_unaligned(ptr) (*(ptr))
- #define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
- #define get_u16(ptr) (*(u16 *)(ptr))
- -#define virt_to_bus(x) ((unsigned long)x)
- #define virt_to_le32desc(addr) virt_to_bus(addr)
-
- #define TULIP_IOTYPE PCI_USES_MASTER | PCI_USES_IO | PCI_ADDR0
- @@ -212,6 +210,8 @@
- TULIP_IOTYPE, 256, PNIC2 },
- { "ADMtek AN981 Comet", { 0x09811317, 0xffffffff, 0, 0, 0, 0 },
- TULIP_IOTYPE, 256, COMET },
- + { "ADMTek AN983 Comet", { 0x12161113, 0xffffffff, 0, 0, 0, 0 },
- + TULIP_IOTYPE, 256, COMET },
- { "ADMtek Centaur-P", { 0x09851317, 0xffffffff, 0, 0, 0, 0 },
- TULIP_IOTYPE, 256, COMET },
- { "ADMtek Centaur-C", { 0x19851317, 0xffffffff, 0, 0, 0, 0 },
- @@ -280,9 +280,13 @@
- static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x7F3F, 0x7F3D, };
- static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
-
- +/* not used
- static u16 t21142_csr13[] = { 0x0001, 0x0009, 0x0009, 0x0000, 0x0001, };
- +*/
- static u16 t21142_csr14[] = { 0xFFFF, 0x0705, 0x0705, 0x0000, 0x7F3D, };
- +/* not used
- static u16 t21142_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
- +*/
-
- /* Offsets to the Command and Status Registers, "CSRs". All accesses
- must be longword instructions and quadword aligned. */
- @@ -300,6 +304,14 @@
- TxFIFOUnderflow=0x20, TxJabber=0x08, TxNoBuf=0x04, TxDied=0x02, TxIntr=0x01,
- };
-
- +/* The configuration bits in CSR6. */
- +enum csr6_mode_bits {
- + TxOn=0x2000, RxOn=0x0002, FullDuplex=0x0200,
- + AcceptBroadcast=0x0100, AcceptAllMulticast=0x0080,
- + AcceptAllPhys=0x0040, AcceptRunt=0x0008,
- +};
- +
- +
- enum desc_status_bits {
- DescOwnded=0x80000000, RxDescFatalErr=0x8000, RxWholePkt=0x0300,
- };
- @@ -384,21 +396,11 @@
-
- #define TX_RING_SIZE 2
- static struct tulip_tx_desc tx_ring[TX_RING_SIZE] __attribute__ ((aligned(4)));
- -
- -#ifdef USE_LOWMEM_BUFFER
- -#define txb ((char *)0x10000 - BUFLEN)
- -#else
- static unsigned char txb[BUFLEN] __attribute__ ((aligned(4)));
- -#endif
-
- #define RX_RING_SIZE 4
- static struct tulip_rx_desc rx_ring[RX_RING_SIZE] __attribute__ ((aligned(4)));
- -
- -#ifdef USE_LOWMEM_BUFFER
- -#define rxb ((char *)0x10000 - RX_RING_SIZE * BUFLEN - BUFLEN)
- -#else
- static unsigned char rxb[RX_RING_SIZE * BUFLEN] __attribute__ ((aligned(4)));
- -#endif
-
- static struct tulip_private {
- int cur_rx;
- @@ -471,7 +473,6 @@
- static const char * block_name[] = {"21140 non-MII", "21140 MII PHY",
- "21142 Serial PHY", "21142 MII PHY", "21143 SYM PHY", "21143 reset method"};
-
- -
- /*********************************************************************/
- /* Function Prototypes */
- /*********************************************************************/
- @@ -479,14 +480,13 @@
- static void mdio_write(struct nic *nic, int phy_id, int location, int value);
- static int read_eeprom(unsigned long ioaddr, int location, int addr_len);
- static void parse_eeprom(struct nic *nic);
- -struct nic *tulip_probe(struct nic *nic, unsigned short *io_addrs,
- - struct pci_device *pci);
- +static int tulip_probe(struct dev *dev, struct pci_device *pci);
- static void tulip_init_ring(struct nic *nic);
- static void tulip_reset(struct nic *nic);
- static void tulip_transmit(struct nic *nic, const char *d, unsigned int t,
- unsigned int s, const char *p);
- -static int tulip_poll(struct nic *nic);
- -static void tulip_disable(struct nic *nic);
- +static int tulip_poll(struct nic *nic, int retrieve);
- +static void tulip_disable(struct dev *dev);
- static void nway_start(struct nic *nic);
- static void pnic_do_nway(struct nic *nic);
- static void select_media(struct nic *nic, int startup);
- @@ -504,7 +504,6 @@
- static void tulip_more(void);
- #endif
-
- -
- /*********************************************************************/
- /* Utility Routines */
- /*********************************************************************/
- @@ -535,7 +534,6 @@
- /* wait */ ;
- }
-
- -
- /*********************************************************************/
- /* Media Descriptor Code */
- /*********************************************************************/
- @@ -565,7 +563,7 @@
- MDIO protocol. See the MII specifications or DP83840A data sheet
- for details. */
-
- -int mdio_read(struct nic *nic, int phy_id, int location)
- +int mdio_read(struct nic *nic __unused, int phy_id, int location)
- {
- int i;
- int read_cmd = (0xf6 << 10) | (phy_id << 5) | location;
- @@ -626,7 +624,7 @@
- return (retval>>1) & 0xffff;
- }
-
- -void mdio_write(struct nic *nic, int phy_id, int location, int value)
- +void mdio_write(struct nic *nic __unused, int phy_id, int location, int value)
- {
- int i;
- int cmd = (0x5002 << 16) | (phy_id << 23) | (location<<18) | value;
- @@ -682,7 +680,6 @@
- }
- }
-
- -
- /*********************************************************************/
- /* EEPROM Reading Code */
- /*********************************************************************/
- @@ -727,7 +724,6 @@
- return retval;
- }
-
- -
- /*********************************************************************/
- /* EEPROM Parsing Code */
- /*********************************************************************/
- @@ -895,11 +891,10 @@
- }
- }
-
- -
- /*********************************************************************/
- /* tulip_init_ring - setup the tx and rx descriptors */
- /*********************************************************************/
- -static void tulip_init_ring(struct nic *nic)
- +static void tulip_init_ring(struct nic *nic __unused)
- {
- int i;
-
- @@ -935,7 +930,22 @@
- /* Mark the last entry as wrapping the ring, though this should never happen */
- tx_ring[1].length = cpu_to_le32(DESC_RING_WRAP | BUFLEN);
- }
- -
- +
- +static void set_rx_mode(struct nic *nic __unused) {
- + int csr6 = inl(ioaddr + CSR6) & ~0x00D5;
- +
- + tp->csr6 &= ~0x00D5;
- +
- + /* !IFF_PROMISC */
- + tp->csr6 |= AcceptAllMulticast;
- + csr6 |= AcceptAllMulticast;
- +
- + outl(csr6, ioaddr + CSR6);
- +
- +
- +
- +}
- +
- /*********************************************************************/
- /* eth_reset - Reset adapter */
- /*********************************************************************/
- @@ -943,7 +953,6 @@
- {
- int i;
- unsigned long to;
- - u32 addr_low, addr_high;
-
- #ifdef TULIP_DEBUG_WHERE
- whereami("tulip_reset\n");
- @@ -956,7 +965,7 @@
- if (tp->mii_cnt || (tp->mtable && tp->mtable->has_mii)) {
- outl(0x814C0000, ioaddr + CSR6);
- }
- -
- +
- /* Reset the chip, holding bit 0 set at least 50 PCI cycles. */
- outl(0x00000001, ioaddr + CSR0);
- tulip_wait(1);
- @@ -1022,8 +1031,8 @@
- }
-
- /* Point to rx and tx descriptors */
- - outl((unsigned long)&rx_ring[0], ioaddr + CSR3);
- - outl((unsigned long)&tx_ring[0], ioaddr + CSR4);
- + outl(virt_to_le32desc(&rx_ring[0]), ioaddr + CSR3);
- + outl(virt_to_le32desc(&tx_ring[0]), ioaddr + CSR4);
-
- init_media(nic);
-
- @@ -1049,11 +1058,12 @@
- if (tp->chip_id == LC82C168)
- tulip_check_duplex(nic);
-
- + set_rx_mode(nic);
- +
- /* enable transmit and receive */
- outl(tp->csr6 | 0x00002002, ioaddr + CSR6);
- }
-
- -
- /*********************************************************************/
- /* eth_transmit - Transmit a frame */
- /*********************************************************************/
- @@ -1095,7 +1105,7 @@
- tx_ring[0].status = cpu_to_le32(0x80000000);
-
- /* Point to transmit descriptor */
- - outl((u32)&tx_ring[0], ioaddr + CSR4);
- + outl(virt_to_le32desc(&tx_ring[0]), ioaddr + CSR4);
-
- /* Enable Tx */
- outl(csr6 | 0x00002000, ioaddr + CSR6);
- @@ -1113,11 +1123,11 @@
- /* Disable Tx */
- outl(csr6 & ~0x00002000, ioaddr + CSR6);
- }
- -
- +
- /*********************************************************************/
- /* eth_poll - Wait for a frame */
- /*********************************************************************/
- -static int tulip_poll(struct nic *nic)
- +static int tulip_poll(struct nic *nic, int retrieve)
- {
-
- #ifdef TULIP_DEBUG_WHERE
- @@ -1128,6 +1138,8 @@
- if (rx_ring[tp->cur_rx].status & 0x80000000)
- return 0;
-
- + if ( ! retrieve ) return 1;
- +
- #ifdef TULIP_DEBUG_WHERE
- whereami("tulip_poll got one\n");
- #endif
- @@ -1151,17 +1163,20 @@
-
- return 1;
- }
- -
- +
- /*********************************************************************/
- /* eth_disable - Disable the interface */
- /*********************************************************************/
- -static void tulip_disable(struct nic *nic)
- +static void tulip_disable(struct dev *dev)
- {
- -
- + struct nic *nic = (struct nic *)dev;
- #ifdef TULIP_DEBUG_WHERE
- whereami("tulip_disable\n");
- #endif
-
- + /* merge reset and disable */
- + tulip_reset(nic);
- +
- /* disable interrupts */
- outl(0x00000000, ioaddr + CSR7);
-
- @@ -1171,24 +1186,41 @@
- /* Clear the missed-packet counter. */
- (volatile unsigned long)inl(ioaddr + CSR8);
- }
- -
- +
- +/*********************************************************************/
- +/*IRQ - Enable, Disable, or Force interrupts */
- +/*********************************************************************/
- +static void tulip_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
- +
- /*********************************************************************/
- /* eth_probe - Look for an adapter */
- /*********************************************************************/
- -struct nic *tulip_probe(struct nic *nic, unsigned short *io_addrs,
- - struct pci_device *pci)
- +static int tulip_probe(struct dev *dev, struct pci_device *pci)
- {
- - u32 i, l1, l2;
- + struct nic *nic = (struct nic *)dev;
- + u32 i;
- u8 chip_rev;
- u8 ee_data[EEPROM_SIZE];
- unsigned short sum;
- int chip_idx;
- static unsigned char last_phys_addr[ETH_ALEN] = {0x00, 'L', 'i', 'n', 'u', 'x'};
-
- - if (io_addrs == 0 || *io_addrs == 0)
- + if (pci->ioaddr == 0)
- return 0;
-
- - ioaddr = *io_addrs;
- + ioaddr = pci->ioaddr;
- + nic->ioaddr = pci->ioaddr & ~3;
- + nic->irqno = 0;
-
- /* point to private storage */
- tp = &tpx;
- @@ -1378,15 +1410,15 @@
- /* reset the device and make ready for tx and rx of packets */
- tulip_reset(nic);
-
- - nic->reset = tulip_reset;
- + dev->disable = tulip_disable;
- nic->poll = tulip_poll;
- nic->transmit = tulip_transmit;
- - nic->disable = tulip_disable;
- + nic->irq = tulip_irq;
-
- /* give the board a chance to reset before returning */
- tulip_wait(4*TICKS_PER_SEC);
-
- - return nic;
- + return 1;
- }
-
- static void start_link(struct nic *nic)
- @@ -1508,7 +1540,7 @@
- }
- }
-
- -static void nway_start(struct nic *nic)
- +static void nway_start(struct nic *nic __unused)
- {
- int csr14 = ((tp->sym_advertise & 0x0780) << 9) |
- ((tp->sym_advertise&0x0020)<<1) | 0xffbf;
- @@ -1662,7 +1694,7 @@
- }
- }
-
- -static void pnic_do_nway(struct nic *nic)
- +static void pnic_do_nway(struct nic *nic __unused)
- {
- u32 phy_reg = inl(ioaddr + 0xB8);
- u32 new_csr6 = tp->csr6 & ~0x40C40200;
- @@ -1886,8 +1918,8 @@
- }
- } else if (tp->chip_id == DC21040) { /* 21040 */
- /* Turn on the xcvr interface. */
- - int csr12 = inl(ioaddr + CSR12);
- #ifdef TULIP_DEBUG
- + int csr12 = inl(ioaddr + CSR12);
- if (tulip_debug > 1)
- printf("%s: 21040 media type is %s, CSR12 is %hhX.\n",
- tp->nic_name, medianame[tp->if_port], csr12);
- @@ -1987,3 +2019,51 @@
-
- return 0;
- }
- +
- +static struct pci_id tulip_nics[] = {
- +PCI_ROM(0x1011, 0x0002, "dc21040", "Digital Tulip"),
- +PCI_ROM(0x1011, 0x0009, "ds21140", "Digital Tulip Fast"),
- +PCI_ROM(0x1011, 0x0014, "dc21041", "Digital Tulip+"),
- +PCI_ROM(0x1011, 0x0019, "ds21142", "Digital Tulip 21142"),
- +PCI_ROM(0x10b7, 0x9300, "3csoho100b-tx","3ComSOHO100B-TX"),
- +PCI_ROM(0x10b9, 0x5261, "ali1563", "ALi 1563 integrated ethernet"),
- +PCI_ROM(0x10d9, 0x0512, "mx98713", "Macronix MX987x3"),
- +PCI_ROM(0x10d9, 0x0531, "mx98715", "Macronix MX987x5"),
- +PCI_ROM(0x1113, 0x1217, "mxic-98715", "Macronix MX987x5"),
- +PCI_ROM(0x11ad, 0xc115, "lc82c115", "LinkSys LNE100TX"),
- +PCI_ROM(0x11ad, 0x0002, "82c168", "Netgear FA310TX"),
- +PCI_ROM(0x1282, 0x9100, "dm9100", "Davicom 9100"),
- +PCI_ROM(0x1282, 0x9102, "dm9102", "Davicom 9102"),
- +PCI_ROM(0x1282, 0x9009, "dm9009", "Davicom 9009"),
- +PCI_ROM(0x1282, 0x9132, "dm9132", "Davicom 9132"),
- +PCI_ROM(0x1317, 0x0985, "centaur-p", "ADMtek Centaur-P"),
- +PCI_ROM(0x1317, 0x0981, "an981", "ADMtek AN981 Comet"), /* ADMTek Centaur-P (stmicro) */
- +PCI_ROM(0x1113, 0x1216, "an983", "ADMTek AN983 Comet"),
- +PCI_ROM(0x1317, 0x9511, "an983b", "ADMTek Comet 983b"),
- +PCI_ROM(0x1317, 0x1985, "centaur-c", "ADMTek Centaur-C"),
- +PCI_ROM(0x8086, 0x0039, "intel21145", "Intel Tulip"),
- +PCI_ROM(0x125b, 0x1400, "ax88140", "ASIX AX88140"),
- +PCI_ROM(0x11f6, 0x9881, "rl100tx", "Compex RL100-TX"),
- +PCI_ROM(0x115d, 0x0003, "xircomtulip", "Xircom Tulip"),
- +PCI_ROM(0x104a, 0x0981, "tulip-0981", "Tulip 0x104a 0x0981"),
- +PCI_ROM(0x104a, 0x2774, "tulip-2774", "Tulip 0x104a 0x2774"),
- +PCI_ROM(0x1113, 0x9511, "tulip-9511", "Tulip 0x1113 0x9511"),
- +PCI_ROM(0x1186, 0x1561, "tulip-1561", "Tulip 0x1186 0x1561"),
- +PCI_ROM(0x1259, 0xa120, "tulip-a120", "Tulip 0x1259 0xa120"),
- +PCI_ROM(0x13d1, 0xab02, "tulip-ab02", "Tulip 0x13d1 0xab02"),
- +PCI_ROM(0x13d1, 0xab03, "tulip-ab03", "Tulip 0x13d1 0xab03"),
- +PCI_ROM(0x13d1, 0xab08, "tulip-ab08", "Tulip 0x13d1 0xab08"),
- +PCI_ROM(0x14f1, 0x1803, "lanfinity", "Conexant LANfinity"),
- +PCI_ROM(0x1626, 0x8410, "tulip-8410", "Tulip 0x1626 0x8410"),
- +PCI_ROM(0x1737, 0xab08, "tulip-1737-ab08","Tulip 0x1737 0xab08"),
- +PCI_ROM(0x1737, 0xab09, "tulip-ab09", "Tulip 0x1737 0xab09"),
- +};
- +
- +struct pci_driver tulip_driver = {
- + .type = NIC_DRIVER,
- + .name = "Tulip",
- + .probe = tulip_probe,
- + .ids = tulip_nics,
- + .id_count = sizeof(tulip_nics)/sizeof(tulip_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/netboot/tulip.txt grub-0.97/netboot/tulip.txt
- --- grub-0.97.orig/netboot/tulip.txt 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/tulip.txt 1970-01-01 00:00:00.000000000 +0000
- @@ -1,53 +0,0 @@
- -This software may be used and distributed according to the terms of
- -the GNU Public License, incorporated herein by reference.
- -
- -This is a tulip and clone driver for Etherboot. See the revision
- -history in the tulip.c file for information on changes. This version
- -of the driver incorporates changes from Bob Edwards and Paul Mackerras
- -who cantributed changes to support the TRENDnet TE100-PCIA NIC which
- -uses a genuine Intel 21143-PD chipset. There are also various code
- -cleanups to make time-based activities more reliable.
- -
- -Of course you have to have all the usual Etherboot environment
- -(bootp/dhcp/NFS) set up, and you need a Linux kernel with v0.91g
- -(7.16.99) or later of the tulip.c driver compiled in to support some
- -MX98715 based cards. That file is available at:
- -
- - http://cesdis.gsfc.nasa.gov/linux/drivers/test/tulip.c
- -
- -NOTES
- -
- -I've tested this driver with a SOHOware Fast 10/100 Model SDA110A,
- -a Linksys LNE100TX v2.0, and a Netgear FA310TX card, and it worked at
- -both 10 and 100 mbits. Other cards based on the tulip family may work as
- -well.
- -
- -These cards are about 20$US, are supported by Linux and now Etherboot,
- -and being PCI, they auto-configure IRQ and IOADDR and auto-negotiate
- -10/100 half/full duplex. It seems like a pretty good value compared to
- -some of the pricier cards, and can lower the cost of building/adapting
- -thin client workstations substantially while giving a considerable
- -performance increase.
- -
- -On some PCI tulip clone chipsets (MX987x5, LC82C115, LC82C168) this driver
- -lets the card choose the fastest speed it can negotiate with the peer
- -device. On other cards, it chooses 10mbit half-duplex.
- -
- -I burned an AM27C256 (32KByte) EPROM with mx987x5.lzrom and it worked.
- -According to the data sheet the MX98715A supports up to 64K (27C512)
- -EPROMs,
- -
- -I've liberally commented the code and header files in the hope that it
- -will help the next person who hacks the code or needs to support some
- -tulip clone card, or wishes to add functionality.
- -
- -Anyway, please test this if you can on your tulip based card, and let
- -me (mdc@thinguin.org) and the netboot list (netboot@baghira.han.de)
- -know how things go. I also would appreciate code review by people who
- -program. I'm a strong believer in "another set of eyes".
- -
- -Regards,
- -
- -Marty Connor
- -mdc@thinguin.org
- -http://www.thinguin.org/
- diff -Naur grub-0.97.orig/netboot/types.h grub-0.97/netboot/types.h
- --- grub-0.97.orig/netboot/types.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/types.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,44 @@
- +#ifndef _TYPES_H
- +#define _TYPES_H
- +
- +/* I'm architecture independed :-) */
- +
- +/*
- + * It's architecture depended headers for common integer types
- + */
- +#include "stdint.h"
- +
- +/*
- + * Here are some RPC types define from linux /usr/include/rpc/types.h
- + */
- +typedef int bool_t;
- +typedef int enum_t;
- +typedef uint32_t rpcprog_t;
- +typedef uint32_t rpcvers_t;
- +typedef uint32_t rpcproc_t;
- +typedef uint32_t rpcprot_t;
- +typedef uint32_t rpcport_t;
- +
- +/* For bool_t */
- +/* typedef enum { */
- +/* FALSE = 0, */
- +/* TRUE = 1 */
- +/* } boolean_t; */
- +
- +
- +
- +/* Some BSD or RPC style types */
- +typedef unsigned char u_char;
- +typedef unsigned short u_short;
- +typedef unsigned int u_int;
- +typedef unsigned long u_long;
- +typedef long long quad_t;
- +typedef unsigned long long u_quad_t;
- +typedef struct {
- + int __val[2];
- +}fsid_t; /* Type of file system IDs, from bits/types.h */
- +
- +typedef int daddr_t; /* The type of a disk address, from bits/types.h */
- +typedef char * caddr_t;
- +
- +#endif /* _TYPES_H */
- diff -Naur grub-0.97.orig/netboot/udp.h grub-0.97/netboot/udp.h
- --- grub-0.97.orig/netboot/udp.h 1970-01-01 00:00:00.000000000 +0000
- +++ grub-0.97/netboot/udp.h 2005-08-31 19:03:35.000000000 +0000
- @@ -0,0 +1,30 @@
- +#ifndef _UDP_H
- +#define _UDP_H
- +
- +/* We need 'uint16_t' and 'uint8_t' */
- +#include "types.h"
- +/* We need 'in_addr' */
- +#include "in.h"
- +
- +struct udp_pseudo_hdr {
- + in_addr src;
- + in_addr dest;
- + uint8_t unused;
- + uint8_t protocol;
- + uint16_t len;
- +};
- +struct udphdr {
- + uint16_t src;
- + uint16_t dest;
- + uint16_t len;
- + uint16_t chksum;
- +};
- +
- +extern void build_udp_hdr(unsigned long __destip, unsigned int __srcsock,
- + unsigned int __destsock, int __ttl, int __len,
- + const void * __buf);
- +
- +extern int udp_transmit(unsigned long __destip, unsigned int __srcsock,
- + unsigned int __destsock, int __len, const void * __buf);
- +
- +#endif /* _UDP_H */
- diff -Naur grub-0.97.orig/netboot/via-rhine.c grub-0.97/netboot/via-rhine.c
- --- grub-0.97.orig/netboot/via-rhine.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/via-rhine.c 2005-08-31 19:03:35.000000000 +0000
- @@ -18,7 +18,7 @@
-
- */
-
- -static const char *version = "rhine.c v1.0.0 2000-01-07\n";
- +static const char *version = "rhine.c v1.0.1 2003-02-06\n";
-
- /* A few user-configurable values. */
-
- @@ -46,7 +46,6 @@
- #include "etherboot.h"
- #include "nic.h"
- #include "pci.h"
- -#include "cards.h"
-
- /* define all ioaddr */
-
- @@ -103,6 +102,11 @@
- #define byCFGD ioaddr + 0x7b
- #define wTallyCntMPA ioaddr + 0x7c
- #define wTallyCntCRC ioaddr + 0x7d
- +#define bySTICKHW ioaddr + 0x83
- +#define byWOLcrClr ioaddr + 0xA4
- +#define byWOLcgClr ioaddr + 0xA7
- +#define byPwrcsrClr ioaddr + 0xAC
- +
- /*--------------------- Exioaddr Definitions -------------------------*/
-
- /*
- @@ -617,9 +621,6 @@
-
- */
-
- -#define PCI_VENDOR_ID_FET 0x1106
- -#define PCI_DEVICE_ID_FET_3043 0x3043
- -
- /* The rest of these values should never change. */
- #define NUM_TX_DESC 2 /* Number of Tx descriptor registers. */
-
- @@ -652,23 +653,19 @@
- }
- rhine;
-
- -static struct nic *rhine_probe1 (struct nic *dev, int ioaddr,
- +static void rhine_probe1 (struct nic *nic, int ioaddr,
- int chip_id, int options);
- static int QueryAuto (int);
- static int ReadMII (int byMIIIndex, int);
- static void WriteMII (char, char, char, int);
- static void MIIDelay (void);
- static void rhine_init_ring (struct nic *dev);
- -static void rhine_disable (struct nic *nic);
- +static void rhine_disable (struct dev *dev);
- static void rhine_reset (struct nic *nic);
- -static int rhine_poll (struct nic *nic);
- +static int rhine_poll (struct nic *nic, int retreive);
- static void rhine_transmit (struct nic *nic, const char *d, unsigned int t,
- unsigned int s, const char *p);
-
- -/* Linux support functions */
- -#define virt_to_bus(x) ((unsigned long)x)
- -#define bus_to_virt(x) ((void *)x)
- -
- /* Initialize the Rx and Tx rings, along with various 'dev' bits. */
- static void
- rhine_init_ring (struct nic *nic)
- @@ -854,26 +851,99 @@
- }
- }
-
- -struct nic *
- -rhine_probe (struct nic *nic, unsigned short *probeaddrs,
- - struct pci_device *pci)
- +/* Offsets to the device registers. */
- +enum register_offsets {
- + StationAddr=0x00, RxConfig=0x06, TxConfig=0x07, ChipCmd=0x08,
- + IntrStatus=0x0C, IntrEnable=0x0E,
- + MulticastFilter0=0x10, MulticastFilter1=0x14,
- + RxRingPtr=0x18, TxRingPtr=0x1C, GFIFOTest=0x54,
- + MIIPhyAddr=0x6C, MIIStatus=0x6D, PCIBusConfig=0x6E,
- + MIICmd=0x70, MIIRegAddr=0x71, MIIData=0x72, MACRegEEcsr=0x74,
- + ConfigA=0x78, ConfigB=0x79, ConfigC=0x7A, ConfigD=0x7B,
- + RxMissed=0x7C, RxCRCErrs=0x7E, MiscCmd=0x81,
- + StickyHW=0x83, IntrStatus2=0x84, WOLcrClr=0xA4, WOLcgClr=0xA7,
- + PwrcsrClr=0xAC,
- +};
- +
- +/* Bits in the interrupt status/mask registers. */
- +enum intr_status_bits {
- + IntrRxDone=0x0001, IntrRxErr=0x0004, IntrRxEmpty=0x0020,
- + IntrTxDone=0x0002, IntrTxError=0x0008, IntrTxUnderrun=0x0210,
- + IntrPCIErr=0x0040,
- + IntrStatsMax=0x0080, IntrRxEarly=0x0100,
- + IntrRxOverflow=0x0400, IntrRxDropped=0x0800, IntrRxNoBuf=0x1000,
- + IntrTxAborted=0x2000, IntrLinkChange=0x4000,
- + IntrRxWakeUp=0x8000,
- + IntrNormalSummary=0x0003, IntrAbnormalSummary=0xC260,
- + IntrTxDescRace=0x080000, /* mapped from IntrStatus2 */
- + IntrTxErrSummary=0x082218,
- +};
- +#define DEFAULT_INTR (IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow | \
- + IntrRxDropped | IntrRxNoBuf)
- +
- +/***************************************************************************
- + IRQ - PXE IRQ Handler
- +***************************************************************************/
- +void rhine_irq ( struct nic *nic, irq_action_t action ) {
- + struct rhine_private *tp = (struct rhine_private *) nic->priv_data;
- + /* Enable interrupts by setting the interrupt mask. */
- + unsigned int intr_status;
- +
- + switch ( action ) {
- + case DISABLE :
- + case ENABLE :
- + intr_status = inw(nic->ioaddr + IntrStatus);
- + /* On Rhine-II, Bit 3 indicates Tx descriptor write-back race. */
- + if (tp->chip_id == 0x3065)
- + intr_status |= inb(nic->ioaddr + IntrStatus2) << 16;
- + intr_status = (intr_status & ~DEFAULT_INTR);
- + if ( action == ENABLE )
- + intr_status = intr_status | DEFAULT_INTR;
- + outw(intr_status, nic->ioaddr + IntrEnable);
- + break;
- + case FORCE :
- + outw(0x0010, nic->ioaddr + 0x84);
- + break;
- + }
- +}
- +
- +static int
- +rhine_probe (struct dev *dev, struct pci_device *pci)
- {
- + struct nic *nic = (struct nic *)dev;
- + struct rhine_private *tp = &rhine;
- if (!pci->ioaddr)
- - return NULL;
- - nic = rhine_probe1 (nic, pci->ioaddr, 0, -1);
- + return 0;
- + rhine_probe1 (nic, pci->ioaddr, pci->dev_id, -1);
-
- - if (nic)
- - adjust_pci_device(pci);
- - nic->poll = rhine_poll;
- - nic->transmit = rhine_transmit;
- - nic->reset = rhine_reset;
- - nic->disable = rhine_disable;
- + adjust_pci_device(pci);
- rhine_reset (nic);
-
- - return nic;
- + dev->disable = rhine_disable;
- + nic->poll = rhine_poll;
- + nic->transmit = rhine_transmit;
- + nic->irqno = pci->irq;
- + nic->irq = rhine_irq;
- + nic->ioaddr = tp->ioaddr;
- +
- +
- + return 1;
- +}
- +
- +static void set_rx_mode(struct nic *nic __unused) {
- + struct rhine_private *tp = (struct rhine_private *) nic->priv_data;
- + unsigned char rx_mode;
- + int ioaddr = tp->ioaddr;
- +
- + /* ! IFF_PROMISC */
- + outl(0xffffffff, byMAR0);
- + outl(0xffffffff, byMAR4);
- + rx_mode = 0x0C;
- +
- + outb(0x60 /* thresh */ | rx_mode, byRCR );
- }
-
- -static struct nic *
- +static void
- rhine_probe1 (struct nic *nic, int ioaddr, int chip_id, int options)
- {
- struct rhine_private *tp;
- @@ -885,6 +955,29 @@
-
- if (rhine_debug > 0 && did_version++ == 0)
- printf (version);
- +
- + /* D-Link provided reset code (with comment additions) */
- + if((chip_id != 0x3043) && (chip_id != 0x6100)) {
- + unsigned char byOrgValue;
- +
- + if(rhine_debug > 0)
- + printf("Enabling Sticky Bit Workaround for Chip_id: 0x%hX\n"
- + , chip_id);
- + /* clear sticky bit before reset & read ethernet address */
- + byOrgValue = inb(bySTICKHW);
- + byOrgValue = byOrgValue & 0xFC;
- + outb(byOrgValue, bySTICKHW);
- +
- + /* (bits written are cleared?) */
- + /* disable force PME-enable */
- + outb(0x80, byWOLcgClr);
- + /* disable power-event config bit */
- + outb(0xFF, byWOLcrClr);
- + /* clear power status (undocumented in vt6102 docs?) */
- + outb(0xFF, byPwrcsrClr);
- +
- + }
- +
- /* Perhaps this should be read from the EEPROM? */
- for (i = 0; i < ETH_ALEN; i++)
- nic->node_addr[i] = inb (byPAR0 + i);
- @@ -920,6 +1013,7 @@
- }
- #endif
-
- +
- /* query MII to know LineSpeed,duplex mode */
- byMIIvalue = inb (ioaddr + 0x6d);
- LineSpeed = byMIIvalue & MIISR_SPEED;
- @@ -971,15 +1065,19 @@
- if (tp->default_port)
- tp->medialock = 1;
- }
- - return nic;
- + return;
- }
-
- -static void
- -rhine_disable (struct nic *nic)
- +static void
- +rhine_disable (struct dev *dev)
- {
- + struct nic *nic = (struct nic *)dev;
- struct rhine_private *tp = (struct rhine_private *) nic->priv_data;
- int ioaddr = tp->ioaddr;
-
- + /* merge reset and disable */
- + rhine_reset(nic);
- +
- printf ("rhine disable\n");
- /* Switch to loopback mode to avoid hardware races. */
- writeb(0x60 | 0x01, byTCR);
- @@ -1002,17 +1100,10 @@
- int rx_bufs_tmp, rx_bufs_tmp1;
- int tx_bufs_tmp, tx_bufs_tmp1;
-
- -#ifdef USE_LOWMEM_BUFFER
- -#define buf1 (0x10000 - (RX_RING_SIZE * PKT_BUF_SZ + 32))
- -#define buf2 (buf1 - (RX_RING_SIZE * PKT_BUF_SZ + 32))
- -#define desc1 (buf2 - (TX_RING_SIZE * sizeof (struct rhine_tx_desc) + 32))
- -#define desc2 (desc1 - (TX_RING_SIZE * sizeof (struct rhine_tx_desc) + 32))
- -#else
- static char buf1[RX_RING_SIZE * PKT_BUF_SZ + 32];
- static char buf2[RX_RING_SIZE * PKT_BUF_SZ + 32];
- static char desc1[TX_RING_SIZE * sizeof (struct rhine_tx_desc) + 32];
- static char desc2[TX_RING_SIZE * sizeof (struct rhine_tx_desc) + 32];
- -#endif
-
- /* printf ("rhine_reset\n"); */
- /* Soft reset the chip. */
- @@ -1069,6 +1160,9 @@
- outl (virt_to_bus (tp->rx_ring), dwCurrentRxDescAddr);
- outl (virt_to_bus (tp->tx_ring), dwCurrentTxDescAddr);
-
- + /* Setup Multicast */
- + set_rx_mode(nic);
- +
- /* close IMR */
- outw (0x0000, byIMR0);
-
- @@ -1093,15 +1187,34 @@
- /*set IMR to work */
- outw (IMRShadow, byIMR0);
- }
- +/* Beware of PCI posted writes */
- +#define IOSYNC do { readb(nic->ioaddr + StationAddr); } while (0)
-
- static int
- -rhine_poll (struct nic *nic)
- +rhine_poll (struct nic *nic, int retreive)
- {
- struct rhine_private *tp = (struct rhine_private *) nic->priv_data;
- int rxstatus, good = 0;;
-
- if (tp->rx_ring[tp->cur_rx].rx_status.bits.own_bit == 0)
- {
- + unsigned int intr_status;
- + /* There is a packet ready */
- + if(!retreive)
- + return 1;
- +
- + intr_status = inw(nic->ioaddr + IntrStatus);
- + /* On Rhine-II, Bit 3 indicates Tx descriptor write-back race. */
- +#if 0
- + if (tp->chip_id == 0x3065)
- + intr_status |= inb(nic->ioaddr + IntrStatus2) << 16;
- +#endif
- + /* Acknowledge all of the current interrupt sources ASAP. */
- + if (intr_status & IntrTxDescRace)
- + outb(0x08, nic->ioaddr + IntrStatus2);
- + outw(intr_status & 0xffff, nic->ioaddr + IntrStatus);
- + IOSYNC;
- +
- rxstatus = tp->rx_ring[tp->cur_rx].rx_status.lw;
- if ((rxstatus & 0x0300) != 0x0300)
- {
- @@ -1124,6 +1237,11 @@
- tp->cur_rx++;
- tp->cur_rx = tp->cur_rx % RX_RING_SIZE;
- }
- + /* Acknowledge all of the current interrupt sources ASAP. */
- + outw(DEFAULT_INTR & ~IntrRxDone, nic->ioaddr + IntrStatus);
- +
- + IOSYNC;
- +
- return good;
- }
-
- @@ -1152,7 +1270,7 @@
- while (s < ETH_ZLEN)
- *((char *) tp->tx_buffs[entry] + ETH_HLEN + (s++)) = 0;
-
- - tp->tx_ring[entry].tx_ctrl.bits.tx_buf_size = ETH_HLEN + s;
- + tp->tx_ring[entry].tx_ctrl.bits.tx_buf_size = s;
-
- tp->tx_ring[entry].tx_status.bits.own_bit = 1;
-
- @@ -1170,6 +1288,9 @@
- /*printf("td4=[%X]",inl(dwCurrentTDSE3)); */
-
- outb (CR1bak, byCR1);
- + /* Wait until transmit is finished */
- + while (tp->tx_ring[entry].tx_status.bits.own_bit != 0)
- + ;
- tp->cur_tx++;
-
- /*outw(IMRShadow,byIMR0); */
- @@ -1177,4 +1298,21 @@
- /*tp->tx_skbuff[entry] = 0; */
- }
-
- +static struct pci_id rhine_nics[] = {
- +PCI_ROM(0x1106, 0x3065, "dlink-530tx", "VIA 6102"),
- +PCI_ROM(0x1106, 0x3106, "via-rhine-6105", "VIA 6105"),
- +PCI_ROM(0x1106, 0x3043, "dlink-530tx-old", "VIA 3043"), /* Rhine-I 86c100a */
- +PCI_ROM(0x1106, 0x3053, "via6105m", "VIA 6105M"),
- +PCI_ROM(0x1106, 0x6100, "via-rhine-old", "VIA 86C100A"), /* Rhine-II */
- +};
- +
- +struct pci_driver rhine_driver = {
- + .type = NIC_DRIVER,
- + .name = "VIA 86C100",
- + .probe = rhine_probe,
- + .ids = rhine_nics,
- + .id_count = sizeof(rhine_nics)/sizeof(rhine_nics[0]),
- + .class = 0,
- +};
- +
- /* EOF via-rhine.c */
- diff -Naur grub-0.97.orig/netboot/w89c840.c grub-0.97/netboot/w89c840.c
- --- grub-0.97.orig/netboot/w89c840.c 2003-07-09 11:45:38.000000000 +0000
- +++ grub-0.97/netboot/w89c840.c 2005-08-31 19:03:35.000000000 +0000
- @@ -43,6 +43,9 @@
- * using timer2 routines. Proposed
- * by Ken Yap to eliminate CPU speed
- * dependency.
- + * Dec 12 2003 V0.94 timlegge Fixed issues in 5.2, removed
- + * interrupt usage, enabled
- + * multicast support
- *
- * This is the etherboot driver for cards based on Winbond W89c840F chip.
- *
- @@ -77,10 +80,9 @@
- #include "etherboot.h"
- #include "nic.h"
- #include "pci.h"
- -#include "cards.h"
- #include "timer.h"
-
- -static const char *w89c840_version = "diver Version 0.92 - August 27, 2000";
- +static const char *w89c840_version = "driver Version 0.94 - December 12, 2003";
-
- typedef unsigned char u8;
- typedef signed char s8;
- @@ -90,9 +92,6 @@
- typedef signed int s32;
-
- /* Linux support functions */
- -#define virt_to_bus(x) ((unsigned long)x)
- -#define bus_to_virt(x) ((void *)x)
- -
- #define virt_to_le32desc(addr) virt_to_bus(addr)
- #define le32desc_to_virt(addr) bus_to_virt(addr)
-
- @@ -109,7 +108,6 @@
- bonding and packet priority.
- There are no ill effects from too-large receive rings. */
- #define TX_RING_SIZE 2
- -
- #define RX_RING_SIZE 2
-
- /* The presumed FIFO size for working around the Tx-FIFO-overflow bug.
- @@ -260,32 +258,20 @@
-
- static int ioaddr;
- static unsigned short eeprom [0x40];
- -
- -#ifdef USE_LOWMEM_BUFFER
- -#define rx_packet ((char *)0x10000 - PKT_BUF_SZ * RX_RING_SIZE)
- -#define tx_packet ((char *)0x10000 - PKT_BUF_SZ * RX_RING_SIZE - PKT_BUF_SZ * TX_RING_SIZE)
- -#else
- static char rx_packet[PKT_BUF_SZ * RX_RING_SIZE];
- static char tx_packet[PKT_BUF_SZ * TX_RING_SIZE];
- -#endif
-
- static int eeprom_read(long ioaddr, int location);
- static int mdio_read(int base_address, int phy_id, int location);
- +#if 0
- static void mdio_write(int base_address, int phy_id, int location, int value);
- +#endif
-
- static void check_duplex(void);
- static void set_rx_mode(void);
- static void init_ring(void);
-
- -/*
- -static void wait_long_time(void)
- -{
- - printf("Paused - please read output above this line\n");
- - sleep(3);
- -}
- -*/
- -
- -#if defined W89C840_DEBUG
- +#if defined(W89C840_DEBUG)
- static void decode_interrupt(u32 intr_status)
- {
- printf("Interrupt status: ");
- @@ -349,15 +335,17 @@
- check_duplex();
- set_rx_mode();
-
- - /* Clear and Enable interrupts by setting the interrupt mask. */
- + /* Do not enable the interrupts Etherboot doesn't need them */
- +/*
- writel(0x1A0F5, ioaddr + IntrStatus);
- writel(0x1A0F5, ioaddr + IntrEnable);
- -
- +*/
- #if defined(W89C840_DEBUG)
- printf("winbond-840 : Done reset.\n");
- #endif
- }
-
- +#if 0
- static void handle_intr(u32 intr_stat)
- {
- if ((intr_stat & (NormalIntr|AbnormalIntr)) == 0) {
- @@ -372,7 +360,7 @@
- /* There was an abnormal interrupt */
- printf("\n-=- Abnormal interrupt.\n");
-
- -#if defined (W89C840_DEBUG)
- +#if defined(W89C840_DEBUG)
- decode_interrupt(intr_stat);
- #endif
-
- @@ -383,19 +371,21 @@
- }
- }
- }
- +#endif
-
- /**************************************************************************
- w89c840_poll - Wait for a frame
- ***************************************************************************/
- -static int w89c840_poll(struct nic *nic)
- +static int w89c840_poll(struct nic *nic, int retrieve)
- {
- /* return true if there's an ethernet packet ready to read */
- /* nic->packet should contain data on return */
- /* nic->packetlen should contain length of data */
- int packet_received = 0;
-
- +#if defined(W89C840_DEBUG)
- u32 intr_status = readl(ioaddr + IntrStatus);
- - /* handle_intr(intr_status); */ /* -- handled later */
- +#endif
-
- do {
- /* Code from netdev_rx(dev) */
- @@ -411,6 +401,11 @@
- break;
- }
-
- + if ( !retrieve ) {
- + packet_received = 1;
- + break;
- + }
- +
- if ((status & 0x38008300) != 0x0300) {
- if ((status & 0x38000300) != 0x0300) {
- /* Ingore earlier buffers. */
- @@ -478,11 +473,7 @@
- entry = (++w840private.cur_rx) % RX_RING_SIZE;
- w840private.rx_head_desc = &w840private.rx_ring[entry];
- } while (0);
- -
- - if (intr_status & (AbnormalIntr | TxFIFOUnderflow | IntrPCIErr |TimerInt | IntrTxStopped)) {
- - handle_intr(intr_status);
- - }
- -
- +
- return packet_received;
- }
-
- @@ -521,13 +512,13 @@
-
- w840private.tx_ring[entry].buffer1 = virt_to_le32desc(tx_packet);
-
- - w840private.tx_ring[entry].length = (DescWholePkt | s);
- + w840private.tx_ring[entry].length = (DescWholePkt | (u32) s);
- if (entry >= TX_RING_SIZE-1) /* Wrap ring */
- w840private.tx_ring[entry].length |= (DescIntr | DescEndRing);
- w840private.tx_ring[entry].status = (DescOwn);
- w840private.cur_tx++;
-
- - w840private.tx_q_bytes += s;
- + w840private.tx_q_bytes = (u16) s;
- writel(0, ioaddr + TxStartDemand);
-
- /* Work around horrible bug in the chip by marking the queue as full
- @@ -550,33 +541,29 @@
- load_timer2(TX_TIMEOUT);
-
- {
- +#if defined W89C840_DEBUG
- u32 intr_stat = 0;
- -
- +#endif
- while (1) {
-
- - intr_stat = readl(ioaddr + IntrStatus);
- #if defined(W89C840_DEBUG)
- - decode_interrupt(intr_stat);
- + decode_interrupt(intr_stat);
- #endif
-
- - if (intr_stat & (NormalIntr | IntrTxDone)) {
- -
- while ( (transmit_status & DescOwn) && timer2_running()) {
-
- transmit_status = w840private.tx_ring[entry].status;
- }
-
- - writel(intr_stat & 0x0001ffff, ioaddr + IntrStatus);
- break;
- - }
- }
- }
-
- if ((transmit_status & DescOwn) == 0) {
-
- #if defined(W89C840_DEBUG)
- - printf("winbond-840 : transmission complete after %d wait loop iterations, status %X\n",
- - TX_LOOP_COUNT - transmit_loop_counter, w840private.tx_ring[entry].status);
- + printf("winbond-840 : transmission complete after wait loop iterations, status %X\n",
- + w840private.tx_ring[entry].status);
- #endif
-
- return;
- @@ -592,8 +579,12 @@
- /**************************************************************************
- w89c840_disable - Turn off ethernet interface
- ***************************************************************************/
- -static void w89c840_disable(struct nic *nic)
- +static void w89c840_disable(struct dev *dev)
- {
- + struct nic *nic = (struct nic *)dev;
- + /* merge reset and disable */
- + w89c840_reset(nic);
- +
- /* Don't know what to do to disable the board. Is this needed at all? */
- /* Yes, a live NIC can corrupt the loaded memory later [Ken] */
- /* Stop the chip's Tx and Rx processes. */
- @@ -601,20 +592,37 @@
- }
-
- /**************************************************************************
- +w89c840_irq - Enable, Disable, or Force interrupts
- +***************************************************************************/
- +static void w89c840_irq(struct nic *nic __unused, irq_action_t action __unused)
- +{
- + switch ( action ) {
- + case DISABLE :
- + break;
- + case ENABLE :
- + break;
- + case FORCE :
- + break;
- + }
- +}
- +
- +/**************************************************************************
- w89c840_probe - Look for an adapter, this routine's visible to the outside
- ***************************************************************************/
- -struct nic *w89c840_probe(struct nic *nic, unsigned short *probe_addrs, struct pci_device *p)
- +static int w89c840_probe(struct dev *dev, struct pci_device *p)
- {
- + struct nic *nic = (struct nic *)dev;
- u16 sum = 0;
- - int i, j, to;
- + int i, j;
- unsigned short value;
- - int options;
- - int promisc;
-
- - if (probe_addrs == 0 || probe_addrs[0] == 0)
- + if (p->ioaddr == 0)
- return 0;
-
- - ioaddr = probe_addrs[0]; /* Mask the bit that says "this is an io addr" */
- + ioaddr = p->ioaddr;
- + nic->ioaddr = p->ioaddr & ~3;
- + nic->irqno = 0;
- +
-
- #if defined(W89C840_DEBUG)
- printf("winbond-840: PCI bus %hhX device function %hhX: I/O address: %hX\n", p->bus, p->devfn, ioaddr);
- @@ -622,8 +630,6 @@
-
- ioaddr = ioaddr & ~3; /* Mask the bit that says "this is an io addr" */
-
- - /* if probe_addrs is 0, then routine can use a hardwired default */
- -
- /* From Matt Hortman <mbhortman@acpthinclient.com> */
- if (p->vendor == PCI_VENDOR_ID_WINBOND2
- && p->dev_id == PCI_DEVICE_ID_WINBOND2_89C840) {
- @@ -689,14 +695,14 @@
- }
-
- /* point to NIC specific routines */
- - nic->reset = w89c840_reset;
- - nic->poll = w89c840_poll;
- + dev->disable = w89c840_disable;
- + nic->poll = w89c840_poll;
- nic->transmit = w89c840_transmit;
- - nic->disable = w89c840_disable;
- + nic->irq = w89c840_irq;
-
- w89c840_reset(nic);
-
- - return nic;
- + return 1;
- }
-
- /* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. These are
- @@ -814,6 +820,7 @@
- return (retval>>1) & 0xffff;
- }
-
- +#if 0
- static void mdio_write(int base_address, int phy_id, int location, int value)
- {
- long mdio_addr = base_address + MIICtrl;
- @@ -844,6 +851,7 @@
- }
- return;
- }
- +#endif
-
- static void check_duplex(void)
- {
- @@ -877,12 +885,10 @@
- memset(mc_filter, 0xff, sizeof(mc_filter));
-
- /*
- - * Actually, should work OK with multicast enabled. -- iko
- - */
- -/*
- - * rx_mode = AcceptBroadcast | AcceptMyPhys | AcceptMulticast;
- + * works OK with multicast enabled.
- */
- - rx_mode = AcceptBroadcast | AcceptMyPhys;
- +
- + rx_mode = AcceptBroadcast | AcceptMyPhys | AcceptMulticast;
-
- writel(mc_filter[0], ioaddr + MulticastFilter0);
- writel(mc_filter[1], ioaddr + MulticastFilter1);
- @@ -932,3 +938,18 @@
- }
- return;
- }
- +
- +
- +static struct pci_id w89c840_nics[] = {
- +PCI_ROM(0x1050, 0x0840, "winbond840", "Winbond W89C840F"),
- +PCI_ROM(0x11f6, 0x2011, "compexrl100atx", "Compex RL100ATX"),
- +};
- +
- +struct pci_driver w89c840_driver = {
- + .type = NIC_DRIVER,
- + .name = "W89C840F",
- + .probe = w89c840_probe,
- + .ids = w89c840_nics,
- + .id_count = sizeof(w89c840_nics)/sizeof(w89c840_nics[0]),
- + .class = 0,
- +};
- diff -Naur grub-0.97.orig/stage2/disk_io.c grub-0.97/stage2/disk_io.c
- --- grub-0.97.orig/stage2/disk_io.c 2004-05-23 16:35:24.000000000 +0000
- +++ grub-0.97/stage2/disk_io.c 2005-08-31 19:03:35.000000000 +0000
- @@ -25,6 +25,7 @@
- #ifdef SUPPORT_NETBOOT
- # define GRUB 1
- # include <etherboot.h>
- +# include <grub.h>
- #endif
-
- #ifdef GRUB_UTIL
|