linux-libc-headers-2.6.11-nios2nommu.patch.conditional 409 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527
  1. --- linux/include/asm-generic/4level-fixup.h
  2. +++ linux/include/asm-generic/4level-fixup.h
  3. @@ -0,0 +1,34 @@
  4. +#ifndef _4LEVEL_FIXUP_H
  5. +#define _4LEVEL_FIXUP_H
  6. +
  7. +#define __ARCH_HAS_4LEVEL_HACK
  8. +
  9. +#define PUD_SIZE PGDIR_SIZE
  10. +#define PUD_MASK PGDIR_MASK
  11. +#define PTRS_PER_PUD 1
  12. +
  13. +#define pud_t pgd_t
  14. +
  15. +#define pmd_alloc(mm, pud, address) \
  16. +({ pmd_t *ret; \
  17. + if (pgd_none(*pud)) \
  18. + ret = __pmd_alloc(mm, pud, address); \
  19. + else \
  20. + ret = pmd_offset(pud, address); \
  21. + ret; \
  22. +})
  23. +
  24. +#define pud_alloc(mm, pgd, address) (pgd)
  25. +#define pud_offset(pgd, start) (pgd)
  26. +#define pud_none(pud) 0
  27. +#define pud_bad(pud) 0
  28. +#define pud_present(pud) 1
  29. +#define pud_ERROR(pud) do { } while (0)
  30. +#define pud_clear(pud) pgd_clear(pud)
  31. +
  32. +#undef pud_free_tlb
  33. +#define pud_free_tlb(tlb, x) do { } while (0)
  34. +#define pud_free(x) do { } while (0)
  35. +#define __pud_free_tlb(tlb, x) do { } while (0)
  36. +
  37. +#endif
  38. --- linux/include/asm-generic/bitops.h
  39. +++ linux/include/asm-generic/bitops.h
  40. @@ -0,0 +1,81 @@
  41. +#ifndef _ASM_GENERIC_BITOPS_H_
  42. +#define _ASM_GENERIC_BITOPS_H_
  43. +
  44. +/*
  45. + * For the benefit of those who are trying to port Linux to another
  46. + * architecture, here are some C-language equivalents. You should
  47. + * recode these in the native assembly language, if at all possible.
  48. + * To guarantee atomicity, these routines call cli() and sti() to
  49. + * disable interrupts while they operate. (You have to provide inline
  50. + * routines to cli() and sti().)
  51. + *
  52. + * Also note, these routines assume that you have 32 bit longs.
  53. + * You will have to change this if you are trying to port Linux to the
  54. + * Alpha architecture or to a Cray. :-)
  55. + *
  56. + * C language equivalents written by Theodore Ts'o, 9/26/92
  57. + */
  58. +
  59. +extern __inline__ int set_bit(int nr,long * addr)
  60. +{
  61. + int mask, retval;
  62. +
  63. + addr += nr >> 5;
  64. + mask = 1 << (nr & 0x1f);
  65. + cli();
  66. + retval = (mask & *addr) != 0;
  67. + *addr |= mask;
  68. + sti();
  69. + return retval;
  70. +}
  71. +
  72. +extern __inline__ int clear_bit(int nr, long * addr)
  73. +{
  74. + int mask, retval;
  75. +
  76. + addr += nr >> 5;
  77. + mask = 1 << (nr & 0x1f);
  78. + cli();
  79. + retval = (mask & *addr) != 0;
  80. + *addr &= ~mask;
  81. + sti();
  82. + return retval;
  83. +}
  84. +
  85. +extern __inline__ int test_bit(int nr, const unsigned long * addr)
  86. +{
  87. + int mask;
  88. +
  89. + addr += nr >> 5;
  90. + mask = 1 << (nr & 0x1f);
  91. + return ((mask & *addr) != 0);
  92. +}
  93. +
  94. +/*
  95. + * fls: find last bit set.
  96. + */
  97. +
  98. +#define fls(x) generic_fls(x)
  99. +
  100. +#ifdef __KERNEL__
  101. +
  102. +/*
  103. + * ffs: find first bit set. This is defined the same way as
  104. + * the libc and compiler builtin ffs routines, therefore
  105. + * differs in spirit from the above ffz (man ffs).
  106. + */
  107. +
  108. +#define ffs(x) generic_ffs(x)
  109. +
  110. +/*
  111. + * hweightN: returns the hamming weight (i.e. the number
  112. + * of bits set) of a N-bit word
  113. + */
  114. +
  115. +#define hweight32(x) generic_hweight32(x)
  116. +#define hweight16(x) generic_hweight16(x)
  117. +#define hweight8(x) generic_hweight8(x)
  118. +
  119. +#endif /* __KERNEL__ */
  120. +
  121. +#endif /* _ASM_GENERIC_BITOPS_H */
  122. --- linux/include/asm-generic/bug.h
  123. +++ linux/include/asm-generic/bug.h
  124. @@ -0,0 +1,34 @@
  125. +#ifndef _ASM_GENERIC_BUG_H
  126. +#define _ASM_GENERIC_BUG_H
  127. +
  128. +#include <linux/compiler.h>
  129. +// #include <linux/config.h>
  130. +
  131. +#ifndef HAVE_ARCH_BUG
  132. +#define BUG() do { \
  133. + printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
  134. + panic("BUG!"); \
  135. +} while (0)
  136. +#endif
  137. +
  138. +#ifndef HAVE_ARCH_PAGE_BUG
  139. +#define PAGE_BUG(page) do { \
  140. + printk("page BUG for page at %p\n", page); \
  141. + BUG(); \
  142. +} while (0)
  143. +#endif
  144. +
  145. +#ifndef HAVE_ARCH_BUG_ON
  146. +#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
  147. +#endif
  148. +
  149. +#ifndef HAVE_ARCH_WARN_ON
  150. +#define WARN_ON(condition) do { \
  151. + if (unlikely((condition)!=0)) { \
  152. + printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
  153. + dump_stack(); \
  154. + } \
  155. +} while (0)
  156. +#endif
  157. +
  158. +#endif
  159. --- linux/include/asm-generic/cpumask_arith.h
  160. +++ linux/include/asm-generic/cpumask_arith.h
  161. @@ -0,0 +1,49 @@
  162. +#ifndef __ASM_GENERIC_CPUMASK_ARITH_H
  163. +#define __ASM_GENERIC_CPUMASK_ARITH_H
  164. +
  165. +/*
  166. + * Arithmetic type -based cpu bitmaps. A single unsigned long is used
  167. + * to contain the whole cpu bitmap.
  168. + */
  169. +
  170. +#define cpu_set(cpu, map) set_bit(cpu, &(map))
  171. +#define cpu_clear(cpu, map) clear_bit(cpu, &(map))
  172. +#define cpu_isset(cpu, map) test_bit(cpu, &(map))
  173. +#define cpu_test_and_set(cpu, map) test_and_set_bit(cpu, &(map))
  174. +
  175. +#define cpus_and(dst,src1,src2) do { dst = (src1) & (src2); } while (0)
  176. +#define cpus_or(dst,src1,src2) do { dst = (src1) | (src2); } while (0)
  177. +#define cpus_clear(map) do { map = 0; } while (0)
  178. +#define cpus_complement(map) do { map = ~(map); } while (0)
  179. +#define cpus_equal(map1, map2) ((map1) == (map2))
  180. +#define cpus_empty(map) ((map) == 0)
  181. +#define cpus_addr(map) (&(map))
  182. +
  183. +#if BITS_PER_LONG == 32
  184. +#define cpus_weight(map) hweight32(map)
  185. +#elif BITS_PER_LONG == 64
  186. +#define cpus_weight(map) hweight64(map)
  187. +#endif
  188. +
  189. +#define cpus_shift_right(dst, src, n) do { dst = (src) >> (n); } while (0)
  190. +#define cpus_shift_left(dst, src, n) do { dst = (src) << (n); } while (0)
  191. +
  192. +#define any_online_cpu(map) \
  193. +({ \
  194. + cpumask_t __tmp__; \
  195. + cpus_and(__tmp__, map, cpu_online_map); \
  196. + __tmp__ ? first_cpu(__tmp__) : NR_CPUS; \
  197. +})
  198. +
  199. +#define CPU_MASK_ALL (~((cpumask_t)0) >> (8*sizeof(cpumask_t) - NR_CPUS))
  200. +#define CPU_MASK_NONE ((cpumask_t)0)
  201. +
  202. +/* only ever use this for things that are _never_ used on large boxen */
  203. +#define cpus_coerce(map) ((unsigned long)(map))
  204. +#define cpus_promote(map) ({ map; })
  205. +#define cpumask_of_cpu(cpu) ({ ((cpumask_t)1) << (cpu); })
  206. +
  207. +#define first_cpu(map) __ffs(map)
  208. +#define next_cpu(cpu, map) find_next_bit(&(map), NR_CPUS, cpu + 1)
  209. +
  210. +#endif /* __ASM_GENERIC_CPUMASK_ARITH_H */
  211. --- linux/include/asm-generic/cpumask_array.h
  212. +++ linux/include/asm-generic/cpumask_array.h
  213. @@ -0,0 +1,54 @@
  214. +#ifndef __ASM_GENERIC_CPUMASK_ARRAY_H
  215. +#define __ASM_GENERIC_CPUMASK_ARRAY_H
  216. +
  217. +/*
  218. + * Array-based cpu bitmaps. An array of unsigned longs is used to contain
  219. + * the bitmap, and then contained in a structure so it may be passed by
  220. + * value.
  221. + */
  222. +
  223. +#define CPU_ARRAY_SIZE BITS_TO_LONGS(NR_CPUS)
  224. +
  225. +#define cpu_set(cpu, map) set_bit(cpu, (map).mask)
  226. +#define cpu_clear(cpu, map) clear_bit(cpu, (map).mask)
  227. +#define cpu_isset(cpu, map) test_bit(cpu, (map).mask)
  228. +#define cpu_test_and_set(cpu, map) test_and_set_bit(cpu, (map).mask)
  229. +
  230. +#define cpus_and(dst,src1,src2) bitmap_and((dst).mask,(src1).mask, (src2).mask, NR_CPUS)
  231. +#define cpus_or(dst,src1,src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, NR_CPUS)
  232. +#define cpus_clear(map) bitmap_clear((map).mask, NR_CPUS)
  233. +#define cpus_complement(map) bitmap_complement((map).mask, NR_CPUS)
  234. +#define cpus_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, NR_CPUS)
  235. +#define cpus_empty(map) bitmap_empty(map.mask, NR_CPUS)
  236. +#define cpus_addr(map) ((map).mask)
  237. +#define cpus_weight(map) bitmap_weight((map).mask, NR_CPUS)
  238. +#define cpus_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, NR_CPUS)
  239. +#define cpus_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, NR_CPUS)
  240. +#define first_cpu(map) find_first_bit((map).mask, NR_CPUS)
  241. +#define next_cpu(cpu, map) find_next_bit((map).mask, NR_CPUS, cpu + 1)
  242. +
  243. +/* only ever use this for things that are _never_ used on large boxen */
  244. +#define cpus_coerce(map) ((map).mask[0])
  245. +#define cpus_promote(map) ({ cpumask_t __cpu_mask = CPU_MASK_NONE;\
  246. + __cpu_mask.mask[0] = map; \
  247. + __cpu_mask; \
  248. + })
  249. +#define cpumask_of_cpu(cpu) ({ cpumask_t __cpu_mask = CPU_MASK_NONE;\
  250. + cpu_set(cpu, __cpu_mask); \
  251. + __cpu_mask; \
  252. + })
  253. +#define any_online_cpu(map) \
  254. +({ \
  255. + cpumask_t __tmp__; \
  256. + cpus_and(__tmp__, map, cpu_online_map); \
  257. + find_first_bit(__tmp__.mask, NR_CPUS); \
  258. +})
  259. +
  260. +
  261. +/*
  262. + * um, these need to be usable as static initializers
  263. + */
  264. +#define CPU_MASK_ALL { {[0 ... CPU_ARRAY_SIZE-1] = ~0UL} }
  265. +#define CPU_MASK_NONE { {[0 ... CPU_ARRAY_SIZE-1] = 0UL} }
  266. +
  267. +#endif /* __ASM_GENERIC_CPUMASK_ARRAY_H */
  268. --- linux/include/asm-generic/cpumask_const_reference.h
  269. +++ linux/include/asm-generic/cpumask_const_reference.h
  270. @@ -0,0 +1,29 @@
  271. +#ifndef __ASM_GENERIC_CPUMASK_CONST_REFERENCE_H
  272. +#define __ASM_GENERIC_CPUMASK_CONST_REFERENCE_H
  273. +
  274. +struct cpumask_ref {
  275. + const cpumask_t *val;
  276. +};
  277. +
  278. +typedef const struct cpumask_ref cpumask_const_t;
  279. +
  280. +#define mk_cpumask_const(map) ((cpumask_const_t){ &(map) })
  281. +#define cpu_isset_const(cpu, map) cpu_isset(cpu, *(map).val)
  282. +
  283. +#define cpus_and_const(dst,src1,src2) cpus_and(dst,*(src1).val,*(src2).val)
  284. +#define cpus_or_const(dst,src1,src2) cpus_or(dst,*(src1).val,*(src2).val)
  285. +
  286. +#define cpus_equal_const(map1, map2) cpus_equal(*(map1).val, *(map2).val)
  287. +
  288. +#define cpus_copy_const(map1, map2) bitmap_copy((map1).mask, (map2).val->mask, NR_CPUS)
  289. +
  290. +#define cpus_empty_const(map) cpus_empty(*(map).val)
  291. +#define cpus_weight_const(map) cpus_weight(*(map).val)
  292. +#define first_cpu_const(map) first_cpu(*(map).val)
  293. +#define next_cpu_const(cpu, map) next_cpu(cpu, *(map).val)
  294. +
  295. +/* only ever use this for things that are _never_ used on large boxen */
  296. +#define cpus_coerce_const(map) cpus_coerce(*(map).val)
  297. +#define any_online_cpu_const(map) any_online_cpu(*(map).val)
  298. +
  299. +#endif /* __ASM_GENERIC_CPUMASK_CONST_REFERENCE_H */
  300. --- linux/include/asm-generic/cpumask_const_value.h
  301. +++ linux/include/asm-generic/cpumask_const_value.h
  302. @@ -0,0 +1,21 @@
  303. +#ifndef __ASM_GENERIC_CPUMASK_CONST_VALUE_H
  304. +#define __ASM_GENERIC_CPUMASK_CONST_VALUE_H
  305. +
  306. +typedef const cpumask_t cpumask_const_t;
  307. +
  308. +#define mk_cpumask_const(map) (map)
  309. +#define cpu_isset_const(cpu, map) cpu_isset(cpu, map)
  310. +#define cpus_and_const(dst,src1,src2) cpus_and(dst, src1, src2)
  311. +#define cpus_or_const(dst,src1,src2) cpus_or(dst, src1, src2)
  312. +#define cpus_equal_const(map1, map2) cpus_equal(map1, map2)
  313. +#define cpus_empty_const(map) cpus_empty(map)
  314. +#define cpus_copy_const(map1, map2) do { map1 = (cpumask_t)map2; } while (0)
  315. +#define cpus_weight_const(map) cpus_weight(map)
  316. +#define first_cpu_const(map) first_cpu(map)
  317. +#define next_cpu_const(cpu, map) next_cpu(cpu, map)
  318. +
  319. +/* only ever use this for things that are _never_ used on large boxen */
  320. +#define cpus_coerce_const(map) cpus_coerce(map)
  321. +#define any_online_cpu_const(map) any_online_cpu(map)
  322. +
  323. +#endif /* __ASM_GENERIC_CPUMASK_CONST_VALUE_H */
  324. --- linux/include/asm-generic/cpumask.h
  325. +++ linux/include/asm-generic/cpumask.h
  326. @@ -0,0 +1,40 @@
  327. +#ifndef __ASM_GENERIC_CPUMASK_H
  328. +#define __ASM_GENERIC_CPUMASK_H
  329. +
  330. +// #include <linux/config.h>
  331. +#include <linux/kernel.h>
  332. +#include <linux/threads.h>
  333. +#include <linux/types.h>
  334. +#include <linux/bitmap.h>
  335. +
  336. +#if NR_CPUS > BITS_PER_LONG && NR_CPUS != 1
  337. +#define CPU_ARRAY_SIZE BITS_TO_LONGS(NR_CPUS)
  338. +
  339. +struct cpumask
  340. +{
  341. + unsigned long mask[CPU_ARRAY_SIZE];
  342. +};
  343. +
  344. +typedef struct cpumask cpumask_t;
  345. +
  346. +#else
  347. +typedef unsigned long cpumask_t;
  348. +#endif
  349. +
  350. +#ifdef CONFIG_SMP
  351. +#if NR_CPUS > BITS_PER_LONG
  352. +#include <asm-generic/cpumask_array.h>
  353. +#else
  354. +#include <asm-generic/cpumask_arith.h>
  355. +#endif
  356. +#else
  357. +#include <asm-generic/cpumask_up.h>
  358. +#endif
  359. +
  360. +#if NR_CPUS <= 4*BITS_PER_LONG
  361. +#include <asm-generic/cpumask_const_value.h>
  362. +#else
  363. +#include <asm-generic/cpumask_const_reference.h>
  364. +#endif
  365. +
  366. +#endif /* __ASM_GENERIC_CPUMASK_H */
  367. --- linux/include/asm-generic/cpumask_up.h
  368. +++ linux/include/asm-generic/cpumask_up.h
  369. @@ -0,0 +1,59 @@
  370. +#ifndef __ASM_GENERIC_CPUMASK_UP_H
  371. +#define __ASM_GENERIC_CPUMASK_UP_H
  372. +
  373. +#define cpus_coerce(map) (map)
  374. +
  375. +#define cpu_set(cpu, map) do { (void)(cpu); cpus_coerce(map) = 1UL; } while (0)
  376. +#define cpu_clear(cpu, map) do { (void)(cpu); cpus_coerce(map) = 0UL; } while (0)
  377. +#define cpu_isset(cpu, map) ((void)(cpu), cpus_coerce(map) != 0UL)
  378. +#define cpu_test_and_set(cpu, map) ((void)(cpu), test_and_set_bit(0, &(map)))
  379. +
  380. +#define cpus_and(dst, src1, src2) \
  381. + do { \
  382. + if (cpus_coerce(src1) && cpus_coerce(src2)) \
  383. + cpus_coerce(dst) = 1UL; \
  384. + else \
  385. + cpus_coerce(dst) = 0UL; \
  386. + } while (0)
  387. +
  388. +#define cpus_or(dst, src1, src2) \
  389. + do { \
  390. + if (cpus_coerce(src1) || cpus_coerce(src2)) \
  391. + cpus_coerce(dst) = 1UL; \
  392. + else \
  393. + cpus_coerce(dst) = 0UL; \
  394. + } while (0)
  395. +
  396. +#define cpus_clear(map) do { cpus_coerce(map) = 0UL; } while (0)
  397. +
  398. +#define cpus_complement(map) \
  399. + do { \
  400. + cpus_coerce(map) = !cpus_coerce(map); \
  401. + } while (0)
  402. +
  403. +#define cpus_equal(map1, map2) (cpus_coerce(map1) == cpus_coerce(map2))
  404. +#define cpus_empty(map) (cpus_coerce(map) == 0UL)
  405. +#define cpus_addr(map) (&(map))
  406. +#define cpus_weight(map) (cpus_coerce(map) ? 1UL : 0UL)
  407. +#define cpus_shift_right(d, s, n) do { cpus_coerce(d) = 0UL; } while (0)
  408. +#define cpus_shift_left(d, s, n) do { cpus_coerce(d) = 0UL; } while (0)
  409. +#define first_cpu(map) (cpus_coerce(map) ? 0 : 1)
  410. +#define next_cpu(cpu, map) 1
  411. +
  412. +/* only ever use this for things that are _never_ used on large boxen */
  413. +#define cpus_promote(map) \
  414. + ({ \
  415. + cpumask_t __tmp__; \
  416. + cpus_coerce(__tmp__) = map; \
  417. + __tmp__; \
  418. + })
  419. +#define cpumask_of_cpu(cpu) ((void)(cpu), cpus_promote(1))
  420. +#define any_online_cpu(map) (cpus_coerce(map) ? 0 : 1)
  421. +
  422. +/*
  423. + * um, these need to be usable as static initializers
  424. + */
  425. +#define CPU_MASK_ALL 1UL
  426. +#define CPU_MASK_NONE 0UL
  427. +
  428. +#endif /* __ASM_GENERIC_CPUMASK_UP_H */
  429. --- linux/include/asm-generic/cputime.h
  430. +++ linux/include/asm-generic/cputime.h
  431. @@ -0,0 +1,64 @@
  432. +#ifndef _ASM_GENERIC_CPUTIME_H
  433. +#define _ASM_GENERIC_CPUTIME_H
  434. +
  435. +#include <linux/time.h>
  436. +#include <linux/jiffies.h>
  437. +
  438. +typedef unsigned long cputime_t;
  439. +
  440. +#define cputime_zero (0UL)
  441. +#define cputime_max ((~0UL >> 1) - 1)
  442. +#define cputime_add(__a, __b) ((__a) + (__b))
  443. +#define cputime_sub(__a, __b) ((__a) - (__b))
  444. +#define cputime_eq(__a, __b) ((__a) == (__b))
  445. +#define cputime_gt(__a, __b) ((__a) > (__b))
  446. +#define cputime_ge(__a, __b) ((__a) >= (__b))
  447. +#define cputime_lt(__a, __b) ((__a) < (__b))
  448. +#define cputime_le(__a, __b) ((__a) <= (__b))
  449. +#define cputime_to_jiffies(__ct) (__ct)
  450. +#define jiffies_to_cputime(__hz) (__hz)
  451. +
  452. +typedef u64 cputime64_t;
  453. +
  454. +#define cputime64_zero (0ULL)
  455. +#define cputime64_add(__a, __b) ((__a) + (__b))
  456. +#define cputime64_to_jiffies64(__ct) (__ct)
  457. +#define cputime_to_cputime64(__ct) ((u64) __ct)
  458. +
  459. +
  460. +/*
  461. + * Convert cputime to milliseconds and back.
  462. + */
  463. +#define cputime_to_msecs(__ct) jiffies_to_msecs(__ct)
  464. +#define msecs_to_cputime(__msecs) msecs_to_jiffies(__msecs)
  465. +
  466. +/*
  467. + * Convert cputime to seconds and back.
  468. + */
  469. +#define cputime_to_secs(jif) ((jif) / HZ)
  470. +#define secs_to_cputime(sec) ((sec) * HZ)
  471. +
  472. +/*
  473. + * Convert cputime to timespec and back.
  474. + */
  475. +#define timespec_to_cputime(__val) timespec_to_jiffies(__val)
  476. +#define cputime_to_timespec(__ct,__val) jiffies_to_timespec(__ct,__val)
  477. +
  478. +/*
  479. + * Convert cputime to timeval and back.
  480. + */
  481. +#define timeval_to_cputime(__val) timeval_to_jiffies(__val)
  482. +#define cputime_to_timeval(__ct,__val) jiffies_to_timeval(__ct,__val)
  483. +
  484. +/*
  485. + * Convert cputime to clock and back.
  486. + */
  487. +#define cputime_to_clock_t(__ct) jiffies_to_clock_t(__ct)
  488. +#define clock_t_to_cputime(__x) clock_t_to_jiffies(__x)
  489. +
  490. +/*
  491. + * Convert cputime64 to clock.
  492. + */
  493. +#define cputime64_to_clock_t(__ct) jiffies_64_to_clock_t(__ct)
  494. +
  495. +#endif
  496. --- linux/include/asm-generic/div64.h
  497. +++ linux/include/asm-generic/div64.h
  498. @@ -0,0 +1,58 @@
  499. +#ifndef _ASM_GENERIC_DIV64_H
  500. +#define _ASM_GENERIC_DIV64_H
  501. +/*
  502. + * Copyright (C) 2003 Bernardo Innocenti <bernie@develer.com>
  503. + * Based on former asm-ppc/div64.h and asm-m68knommu/div64.h
  504. + *
  505. + * The semantics of do_div() are:
  506. + *
  507. + * uint32_t do_div(uint64_t *n, uint32_t base)
  508. + * {
  509. + * uint32_t remainder = *n % base;
  510. + * *n = *n / base;
  511. + * return remainder;
  512. + * }
  513. + *
  514. + * NOTE: macro parameter n is evaluated multiple times,
  515. + * beware of side effects!
  516. + */
  517. +
  518. +#include <linux/types.h>
  519. +#include <linux/compiler.h>
  520. +
  521. +#if BITS_PER_LONG == 64
  522. +
  523. +# define do_div(n,base) ({ \
  524. + uint32_t __base = (base); \
  525. + uint32_t __rem; \
  526. + __rem = ((uint64_t)(n)) % __base; \
  527. + (n) = ((uint64_t)(n)) / __base; \
  528. + __rem; \
  529. + })
  530. +
  531. +#elif BITS_PER_LONG == 32
  532. +
  533. +extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
  534. +
  535. +/* The unnecessary pointer compare is there
  536. + * to check for type safety (n must be 64bit)
  537. + */
  538. +# define do_div(n,base) ({ \
  539. + uint32_t __base = (base); \
  540. + uint32_t __rem; \
  541. + (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
  542. + if (likely(((n) >> 32) == 0)) { \
  543. + __rem = (uint32_t)(n) % __base; \
  544. + (n) = (uint32_t)(n) / __base; \
  545. + } else \
  546. + __rem = __div64_32(&(n), __base); \
  547. + __rem; \
  548. + })
  549. +
  550. +#else /* BITS_PER_LONG == ?? */
  551. +
  552. +# error do_div() does not yet support the C64
  553. +
  554. +#endif /* BITS_PER_LONG */
  555. +
  556. +#endif /* _ASM_GENERIC_DIV64_H */
  557. --- linux/include/asm-generic/dma-mapping-broken.h
  558. +++ linux/include/asm-generic/dma-mapping-broken.h
  559. @@ -0,0 +1,22 @@
  560. +#ifndef _ASM_GENERIC_DMA_MAPPING_H
  561. +#define _ASM_GENERIC_DMA_MAPPING_H
  562. +
  563. +/* This is used for archs that do not support DMA */
  564. +
  565. +
  566. +static inline void *
  567. +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
  568. + int flag)
  569. +{
  570. + BUG();
  571. + return NULL;
  572. +}
  573. +
  574. +static inline void
  575. +dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
  576. + dma_addr_t dma_handle)
  577. +{
  578. + BUG();
  579. +}
  580. +
  581. +#endif /* _ASM_GENERIC_DMA_MAPPING_H */
  582. --- linux/include/asm-generic/dma-mapping.h
  583. +++ linux/include/asm-generic/dma-mapping.h
  584. @@ -0,0 +1,309 @@
  585. +/* Copyright (C) 2002 by James.Bottomley@HansenPartnership.com
  586. + *
  587. + * Implements the generic device dma API via the existing pci_ one
  588. + * for unconverted architectures
  589. + */
  590. +
  591. +#ifndef _ASM_GENERIC_DMA_MAPPING_H
  592. +#define _ASM_GENERIC_DMA_MAPPING_H
  593. +
  594. +// #include <linux/config.h>
  595. +
  596. +#ifdef CONFIG_PCI
  597. +
  598. +/* we implement the API below in terms of the existing PCI one,
  599. + * so include it */
  600. +#include <linux/pci.h>
  601. +/* need struct page definitions */
  602. +#include <linux/mm.h>
  603. +
  604. +static inline int
  605. +dma_supported(struct device *dev, u64 mask)
  606. +{
  607. + BUG_ON(dev->bus != &pci_bus_type);
  608. +
  609. + return pci_dma_supported(to_pci_dev(dev), mask);
  610. +}
  611. +
  612. +static inline int
  613. +dma_set_mask(struct device *dev, u64 dma_mask)
  614. +{
  615. + BUG_ON(dev->bus != &pci_bus_type);
  616. +
  617. + return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
  618. +}
  619. +
  620. +static inline void *
  621. +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
  622. + int flag)
  623. +{
  624. + BUG_ON(dev->bus != &pci_bus_type);
  625. +
  626. + return pci_alloc_consistent(to_pci_dev(dev), size, dma_handle);
  627. +}
  628. +
  629. +static inline void
  630. +dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
  631. + dma_addr_t dma_handle)
  632. +{
  633. + BUG_ON(dev->bus != &pci_bus_type);
  634. +
  635. + pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
  636. +}
  637. +
  638. +static inline dma_addr_t
  639. +dma_map_single(struct device *dev, void *cpu_addr, size_t size,
  640. + enum dma_data_direction direction)
  641. +{
  642. + BUG_ON(dev->bus != &pci_bus_type);
  643. +
  644. + return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
  645. +}
  646. +
  647. +static inline void
  648. +dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
  649. + enum dma_data_direction direction)
  650. +{
  651. + BUG_ON(dev->bus != &pci_bus_type);
  652. +
  653. + pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
  654. +}
  655. +
  656. +static inline dma_addr_t
  657. +dma_map_page(struct device *dev, struct page *page,
  658. + unsigned long offset, size_t size,
  659. + enum dma_data_direction direction)
  660. +{
  661. + BUG_ON(dev->bus != &pci_bus_type);
  662. +
  663. + return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
  664. +}
  665. +
  666. +static inline void
  667. +dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
  668. + enum dma_data_direction direction)
  669. +{
  670. + BUG_ON(dev->bus != &pci_bus_type);
  671. +
  672. + pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
  673. +}
  674. +
  675. +static inline int
  676. +dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
  677. + enum dma_data_direction direction)
  678. +{
  679. + BUG_ON(dev->bus != &pci_bus_type);
  680. +
  681. + return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
  682. +}
  683. +
  684. +static inline void
  685. +dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
  686. + enum dma_data_direction direction)
  687. +{
  688. + BUG_ON(dev->bus != &pci_bus_type);
  689. +
  690. + pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
  691. +}
  692. +
  693. +static inline void
  694. +dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
  695. + enum dma_data_direction direction)
  696. +{
  697. + BUG_ON(dev->bus != &pci_bus_type);
  698. +
  699. + pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle,
  700. + size, (int)direction);
  701. +}
  702. +
  703. +static inline void
  704. +dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
  705. + enum dma_data_direction direction)
  706. +{
  707. + BUG_ON(dev->bus != &pci_bus_type);
  708. +
  709. + pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle,
  710. + size, (int)direction);
  711. +}
  712. +
  713. +static inline void
  714. +dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
  715. + enum dma_data_direction direction)
  716. +{
  717. + BUG_ON(dev->bus != &pci_bus_type);
  718. +
  719. + pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction);
  720. +}
  721. +
  722. +static inline void
  723. +dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
  724. + enum dma_data_direction direction)
  725. +{
  726. + BUG_ON(dev->bus != &pci_bus_type);
  727. +
  728. + pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction);
  729. +}
  730. +
  731. +static inline int
  732. +dma_mapping_error(dma_addr_t dma_addr)
  733. +{
  734. + return pci_dma_mapping_error(dma_addr);
  735. +}
  736. +
  737. +
  738. +#else
  739. +
  740. +static inline int
  741. +dma_supported(struct device *dev, u64 mask)
  742. +{
  743. + return 0;
  744. +}
  745. +
  746. +static inline int
  747. +dma_set_mask(struct device *dev, u64 dma_mask)
  748. +{
  749. + BUG();
  750. + return 0;
  751. +}
  752. +
  753. +static inline void *
  754. +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
  755. + int flag)
  756. +{
  757. + BUG();
  758. + return NULL;
  759. +}
  760. +
  761. +static inline void
  762. +dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
  763. + dma_addr_t dma_handle)
  764. +{
  765. + BUG();
  766. +}
  767. +
  768. +static inline dma_addr_t
  769. +dma_map_single(struct device *dev, void *cpu_addr, size_t size,
  770. + enum dma_data_direction direction)
  771. +{
  772. + BUG();
  773. + return 0;
  774. +}
  775. +
  776. +static inline void
  777. +dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
  778. + enum dma_data_direction direction)
  779. +{
  780. + BUG();
  781. +}
  782. +
  783. +static inline dma_addr_t
  784. +dma_map_page(struct device *dev, struct page *page,
  785. + unsigned long offset, size_t size,
  786. + enum dma_data_direction direction)
  787. +{
  788. + BUG();
  789. + return 0;
  790. +}
  791. +
  792. +static inline void
  793. +dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
  794. + enum dma_data_direction direction)
  795. +{
  796. + BUG();
  797. +}
  798. +
  799. +static inline int
  800. +dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
  801. + enum dma_data_direction direction)
  802. +{
  803. + BUG();
  804. + return 0;
  805. +}
  806. +
  807. +static inline void
  808. +dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
  809. + enum dma_data_direction direction)
  810. +{
  811. + BUG();
  812. +}
  813. +
  814. +static inline void
  815. +dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
  816. + enum dma_data_direction direction)
  817. +{
  818. + BUG();
  819. +}
  820. +
  821. +static inline void
  822. +dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
  823. + enum dma_data_direction direction)
  824. +{
  825. + BUG();
  826. +}
  827. +
  828. +static inline void
  829. +dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
  830. + enum dma_data_direction direction)
  831. +{
  832. + BUG();
  833. +}
  834. +
  835. +static inline void
  836. +dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
  837. + enum dma_data_direction direction)
  838. +{
  839. + BUG();
  840. +}
  841. +
  842. +static inline int
  843. +dma_error(dma_addr_t dma_addr)
  844. +{
  845. + return 0;
  846. +}
  847. +
  848. +#endif
  849. +
  850. +/* Now for the API extensions over the pci_ one */
  851. +
  852. +#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  853. +#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
  854. +#define dma_is_consistent(d) (1)
  855. +
  856. +static inline int
  857. +dma_get_cache_alignment(void)
  858. +{
  859. + /* no easy way to get cache size on all processors, so return
  860. + * the maximum possible, to be safe */
  861. + return (1 << L1_CACHE_SHIFT_MAX);
  862. +}
  863. +
  864. +static inline void
  865. +dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
  866. + unsigned long offset, size_t size,
  867. + enum dma_data_direction direction)
  868. +{
  869. + /* just sync everything, that's all the pci API can do */
  870. + dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
  871. +}
  872. +
  873. +static inline void
  874. +dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
  875. + unsigned long offset, size_t size,
  876. + enum dma_data_direction direction)
  877. +{
  878. + /* just sync everything, that's all the pci API can do */
  879. + dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
  880. +}
  881. +
  882. +static inline void
  883. +dma_cache_sync(void *vaddr, size_t size,
  884. + enum dma_data_direction direction)
  885. +{
  886. + /* could define this in terms of the dma_cache ... operations,
  887. + * but if you get this on a platform, you should convert the platform
  888. + * to using the generic device DMA API */
  889. + BUG();
  890. +}
  891. +
  892. +#endif
  893. +
  894. --- linux/include/asm-generic/errno-base.h
  895. +++ linux/include/asm-generic/errno-base.h
  896. @@ -0,0 +1,39 @@
  897. +#ifndef _ASM_GENERIC_ERRNO_BASE_H
  898. +#define _ASM_GENERIC_ERRNO_BASE_H
  899. +
  900. +#define EPERM 1 /* Operation not permitted */
  901. +#define ENOENT 2 /* No such file or directory */
  902. +#define ESRCH 3 /* No such process */
  903. +#define EINTR 4 /* Interrupted system call */
  904. +#define EIO 5 /* I/O error */
  905. +#define ENXIO 6 /* No such device or address */
  906. +#define E2BIG 7 /* Argument list too long */
  907. +#define ENOEXEC 8 /* Exec format error */
  908. +#define EBADF 9 /* Bad file number */
  909. +#define ECHILD 10 /* No child processes */
  910. +#define EAGAIN 11 /* Try again */
  911. +#define ENOMEM 12 /* Out of memory */
  912. +#define EACCES 13 /* Permission denied */
  913. +#define EFAULT 14 /* Bad address */
  914. +#define ENOTBLK 15 /* Block device required */
  915. +#define EBUSY 16 /* Device or resource busy */
  916. +#define EEXIST 17 /* File exists */
  917. +#define EXDEV 18 /* Cross-device link */
  918. +#define ENODEV 19 /* No such device */
  919. +#define ENOTDIR 20 /* Not a directory */
  920. +#define EISDIR 21 /* Is a directory */
  921. +#define EINVAL 22 /* Invalid argument */
  922. +#define ENFILE 23 /* File table overflow */
  923. +#define EMFILE 24 /* Too many open files */
  924. +#define ENOTTY 25 /* Not a typewriter */
  925. +#define ETXTBSY 26 /* Text file busy */
  926. +#define EFBIG 27 /* File too large */
  927. +#define ENOSPC 28 /* No space left on device */
  928. +#define ESPIPE 29 /* Illegal seek */
  929. +#define EROFS 30 /* Read-only file system */
  930. +#define EMLINK 31 /* Too many links */
  931. +#define EPIPE 32 /* Broken pipe */
  932. +#define EDOM 33 /* Math argument out of domain of func */
  933. +#define ERANGE 34 /* Math result not representable */
  934. +
  935. +#endif
  936. --- linux/include/asm-generic/errno.h
  937. +++ linux/include/asm-generic/errno.h
  938. @@ -0,0 +1,105 @@
  939. +#ifndef _ASM_GENERIC_ERRNO_H
  940. +#define _ASM_GENERIC_ERRNO_H
  941. +
  942. +#include <asm-generic/errno-base.h>
  943. +
  944. +#define EDEADLK 35 /* Resource deadlock would occur */
  945. +#define ENAMETOOLONG 36 /* File name too long */
  946. +#define ENOLCK 37 /* No record locks available */
  947. +#define ENOSYS 38 /* Function not implemented */
  948. +#define ENOTEMPTY 39 /* Directory not empty */
  949. +#define ELOOP 40 /* Too many symbolic links encountered */
  950. +#define EWOULDBLOCK EAGAIN /* Operation would block */
  951. +#define ENOMSG 42 /* No message of desired type */
  952. +#define EIDRM 43 /* Identifier removed */
  953. +#define ECHRNG 44 /* Channel number out of range */
  954. +#define EL2NSYNC 45 /* Level 2 not synchronized */
  955. +#define EL3HLT 46 /* Level 3 halted */
  956. +#define EL3RST 47 /* Level 3 reset */
  957. +#define ELNRNG 48 /* Link number out of range */
  958. +#define EUNATCH 49 /* Protocol driver not attached */
  959. +#define ENOCSI 50 /* No CSI structure available */
  960. +#define EL2HLT 51 /* Level 2 halted */
  961. +#define EBADE 52 /* Invalid exchange */
  962. +#define EBADR 53 /* Invalid request descriptor */
  963. +#define EXFULL 54 /* Exchange full */
  964. +#define ENOANO 55 /* No anode */
  965. +#define EBADRQC 56 /* Invalid request code */
  966. +#define EBADSLT 57 /* Invalid slot */
  967. +
  968. +#define EDEADLOCK EDEADLK
  969. +
  970. +#define EBFONT 59 /* Bad font file format */
  971. +#define ENOSTR 60 /* Device not a stream */
  972. +#define ENODATA 61 /* No data available */
  973. +#define ETIME 62 /* Timer expired */
  974. +#define ENOSR 63 /* Out of streams resources */
  975. +#define ENONET 64 /* Machine is not on the network */
  976. +#define ENOPKG 65 /* Package not installed */
  977. +#define EREMOTE 66 /* Object is remote */
  978. +#define ENOLINK 67 /* Link has been severed */
  979. +#define EADV 68 /* Advertise error */
  980. +#define ESRMNT 69 /* Srmount error */
  981. +#define ECOMM 70 /* Communication error on send */
  982. +#define EPROTO 71 /* Protocol error */
  983. +#define EMULTIHOP 72 /* Multihop attempted */
  984. +#define EDOTDOT 73 /* RFS specific error */
  985. +#define EBADMSG 74 /* Not a data message */
  986. +#define EOVERFLOW 75 /* Value too large for defined data type */
  987. +#define ENOTUNIQ 76 /* Name not unique on network */
  988. +#define EBADFD 77 /* File descriptor in bad state */
  989. +#define EREMCHG 78 /* Remote address changed */
  990. +#define ELIBACC 79 /* Can not access a needed shared library */
  991. +#define ELIBBAD 80 /* Accessing a corrupted shared library */
  992. +#define ELIBSCN 81 /* .lib section in a.out corrupted */
  993. +#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
  994. +#define ELIBEXEC 83 /* Cannot exec a shared library directly */
  995. +#define EILSEQ 84 /* Illegal byte sequence */
  996. +#define ERESTART 85 /* Interrupted system call should be restarted */
  997. +#define ESTRPIPE 86 /* Streams pipe error */
  998. +#define EUSERS 87 /* Too many users */
  999. +#define ENOTSOCK 88 /* Socket operation on non-socket */
  1000. +#define EDESTADDRREQ 89 /* Destination address required */
  1001. +#define EMSGSIZE 90 /* Message too long */
  1002. +#define EPROTOTYPE 91 /* Protocol wrong type for socket */
  1003. +#define ENOPROTOOPT 92 /* Protocol not available */
  1004. +#define EPROTONOSUPPORT 93 /* Protocol not supported */
  1005. +#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
  1006. +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
  1007. +#define EPFNOSUPPORT 96 /* Protocol family not supported */
  1008. +#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
  1009. +#define EADDRINUSE 98 /* Address already in use */
  1010. +#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
  1011. +#define ENETDOWN 100 /* Network is down */
  1012. +#define ENETUNREACH 101 /* Network is unreachable */
  1013. +#define ENETRESET 102 /* Network dropped connection because of reset */
  1014. +#define ECONNABORTED 103 /* Software caused connection abort */
  1015. +#define ECONNRESET 104 /* Connection reset by peer */
  1016. +#define ENOBUFS 105 /* No buffer space available */
  1017. +#define EISCONN 106 /* Transport endpoint is already connected */
  1018. +#define ENOTCONN 107 /* Transport endpoint is not connected */
  1019. +#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
  1020. +#define ETOOMANYREFS 109 /* Too many references: cannot splice */
  1021. +#define ETIMEDOUT 110 /* Connection timed out */
  1022. +#define ECONNREFUSED 111 /* Connection refused */
  1023. +#define EHOSTDOWN 112 /* Host is down */
  1024. +#define EHOSTUNREACH 113 /* No route to host */
  1025. +#define EALREADY 114 /* Operation already in progress */
  1026. +#define EINPROGRESS 115 /* Operation now in progress */
  1027. +#define ESTALE 116 /* Stale NFS file handle */
  1028. +#define EUCLEAN 117 /* Structure needs cleaning */
  1029. +#define ENOTNAM 118 /* Not a XENIX named type file */
  1030. +#define ENAVAIL 119 /* No XENIX semaphores available */
  1031. +#define EISNAM 120 /* Is a named type file */
  1032. +#define EREMOTEIO 121 /* Remote I/O error */
  1033. +#define EDQUOT 122 /* Quota exceeded */
  1034. +
  1035. +#define ENOMEDIUM 123 /* No medium found */
  1036. +#define EMEDIUMTYPE 124 /* Wrong medium type */
  1037. +#define ECANCELED 125 /* Operation Canceled */
  1038. +#define ENOKEY 126 /* Required key not available */
  1039. +#define EKEYEXPIRED 127 /* Key has expired */
  1040. +#define EKEYREVOKED 128 /* Key has been revoked */
  1041. +#define EKEYREJECTED 129 /* Key was rejected by service */
  1042. +
  1043. +#endif
  1044. --- linux/include/asm-generic/hdreg.h
  1045. +++ linux/include/asm-generic/hdreg.h
  1046. @@ -0,0 +1,8 @@
  1047. +#warning <asm/hdreg.h> is obsolete, please do not use it
  1048. +
  1049. +#ifndef __ASM_GENERIC_HDREG_H
  1050. +#define __ASM_GENERIC_HDREG_H
  1051. +
  1052. +typedef unsigned long ide_ioreg_t;
  1053. +
  1054. +#endif /* __ASM_GENERIC_HDREG_H */
  1055. --- linux/include/asm-generic/ide_iops.h
  1056. +++ linux/include/asm-generic/ide_iops.h
  1057. @@ -0,0 +1,38 @@
  1058. +/* Generic I/O and MEMIO string operations. */
  1059. +
  1060. +#define __ide_insw insw
  1061. +#define __ide_insl insl
  1062. +#define __ide_outsw outsw
  1063. +#define __ide_outsl outsl
  1064. +
  1065. +static __inline__ void __ide_mm_insw(void __iomem *port, void *addr, u32 count)
  1066. +{
  1067. + while (count--) {
  1068. + *(u16 *)addr = readw(port);
  1069. + addr += 2;
  1070. + }
  1071. +}
  1072. +
  1073. +static __inline__ void __ide_mm_insl(void __iomem *port, void *addr, u32 count)
  1074. +{
  1075. + while (count--) {
  1076. + *(u32 *)addr = readl(port);
  1077. + addr += 4;
  1078. + }
  1079. +}
  1080. +
  1081. +static __inline__ void __ide_mm_outsw(void __iomem *port, void *addr, u32 count)
  1082. +{
  1083. + while (count--) {
  1084. + writew(*(u16 *)addr, port);
  1085. + addr += 2;
  1086. + }
  1087. +}
  1088. +
  1089. +static __inline__ void __ide_mm_outsl(void __iomem * port, void *addr, u32 count)
  1090. +{
  1091. + while (count--) {
  1092. + writel(*(u32 *)addr, port);
  1093. + addr += 4;
  1094. + }
  1095. +}
  1096. --- linux/include/asm-generic/iomap.h
  1097. +++ linux/include/asm-generic/iomap.h
  1098. @@ -0,0 +1,63 @@
  1099. +#ifndef __GENERIC_IO_H
  1100. +#define __GENERIC_IO_H
  1101. +
  1102. +#include <linux/linkage.h>
  1103. +
  1104. +/*
  1105. + * These are the "generic" interfaces for doing new-style
  1106. + * memory-mapped or PIO accesses. Architectures may do
  1107. + * their own arch-optimized versions, these just act as
  1108. + * wrappers around the old-style IO register access functions:
  1109. + * read[bwl]/write[bwl]/in[bwl]/out[bwl]
  1110. + *
  1111. + * Don't include this directly, include it from <asm/io.h>.
  1112. + */
  1113. +
  1114. +/*
  1115. + * Read/write from/to an (offsettable) iomem cookie. It might be a PIO
  1116. + * access or a MMIO access, these functions don't care. The info is
  1117. + * encoded in the hardware mapping set up by the mapping functions
  1118. + * (or the cookie itself, depending on implementation and hw).
  1119. + *
  1120. + * The generic routines just encode the PIO/MMIO as part of the
  1121. + * cookie, and coldly assume that the MMIO IO mappings are not
  1122. + * in the low address range. Architectures for which this is not
  1123. + * true can't use this generic implementation.
  1124. + */
  1125. +extern unsigned int fastcall ioread8(void __iomem *);
  1126. +extern unsigned int fastcall ioread16(void __iomem *);
  1127. +extern unsigned int fastcall ioread32(void __iomem *);
  1128. +
  1129. +extern void fastcall iowrite8(u8, void __iomem *);
  1130. +extern void fastcall iowrite16(u16, void __iomem *);
  1131. +extern void fastcall iowrite32(u32, void __iomem *);
  1132. +
  1133. +/*
  1134. + * "string" versions of the above. Note that they
  1135. + * use native byte ordering for the accesses (on
  1136. + * the assumption that IO and memory agree on a
  1137. + * byte order, and CPU byteorder is irrelevant).
  1138. + *
  1139. + * They do _not_ update the port address. If you
  1140. + * want MMIO that copies stuff laid out in MMIO
  1141. + * memory across multiple ports, use "memcpy_toio()"
  1142. + * and friends.
  1143. + */
  1144. +extern void fastcall ioread8_rep(void __iomem *port, void *buf, unsigned long count);
  1145. +extern void fastcall ioread16_rep(void __iomem *port, void *buf, unsigned long count);
  1146. +extern void fastcall ioread32_rep(void __iomem *port, void *buf, unsigned long count);
  1147. +
  1148. +extern void fastcall iowrite8_rep(void __iomem *port, const void *buf, unsigned long count);
  1149. +extern void fastcall iowrite16_rep(void __iomem *port, const void *buf, unsigned long count);
  1150. +extern void fastcall iowrite32_rep(void __iomem *port, const void *buf, unsigned long count);
  1151. +
  1152. +/* Create a virtual mapping cookie for an IO port range */
  1153. +extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
  1154. +extern void ioport_unmap(void __iomem *);
  1155. +
  1156. +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
  1157. +struct pci_dev;
  1158. +extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
  1159. +extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
  1160. +
  1161. +#endif
  1162. --- linux/include/asm-generic/local.h
  1163. +++ linux/include/asm-generic/local.h
  1164. @@ -0,0 +1,118 @@
  1165. +#ifndef _ASM_GENERIC_LOCAL_H
  1166. +#define _ASM_GENERIC_LOCAL_H
  1167. +
  1168. +// #include <linux/config.h>
  1169. +#include <linux/percpu.h>
  1170. +#include <linux/hardirq.h>
  1171. +#include <asm/types.h>
  1172. +
  1173. +/* An unsigned long type for operations which are atomic for a single
  1174. + * CPU. Usually used in combination with per-cpu variables. */
  1175. +
  1176. +#if BITS_PER_LONG == 32
  1177. +/* Implement in terms of atomics. */
  1178. +
  1179. +/* Don't use typedef: don't want them to be mixed with atomic_t's. */
  1180. +typedef struct
  1181. +{
  1182. + atomic_t a;
  1183. +} local_t;
  1184. +
  1185. +#define LOCAL_INIT(i) { ATOMIC_INIT(i) }
  1186. +
  1187. +#define local_read(l) ((unsigned long)atomic_read(&(l)->a))
  1188. +#define local_set(l,i) atomic_set((&(l)->a),(i))
  1189. +#define local_inc(l) atomic_inc(&(l)->a)
  1190. +#define local_dec(l) atomic_dec(&(l)->a)
  1191. +#define local_add(i,l) atomic_add((i),(&(l)->a))
  1192. +#define local_sub(i,l) atomic_sub((i),(&(l)->a))
  1193. +
  1194. +/* Non-atomic variants, ie. preemption disabled and won't be touched
  1195. + * in interrupt, etc. Some archs can optimize this case well. */
  1196. +#define __local_inc(l) local_set((l), local_read(l) + 1)
  1197. +#define __local_dec(l) local_set((l), local_read(l) - 1)
  1198. +#define __local_add(i,l) local_set((l), local_read(l) + (i))
  1199. +#define __local_sub(i,l) local_set((l), local_read(l) - (i))
  1200. +
  1201. +#else /* ... can't use atomics. */
  1202. +/* Implement in terms of three variables.
  1203. + Another option would be to use local_irq_save/restore. */
  1204. +
  1205. +typedef struct
  1206. +{
  1207. + /* 0 = in hardirq, 1 = in softirq, 2 = usermode. */
  1208. + unsigned long v[3];
  1209. +} local_t;
  1210. +
  1211. +#define _LOCAL_VAR(l) ((l)->v[!in_interrupt() + !in_irq()])
  1212. +
  1213. +#define LOCAL_INIT(i) { { (i), 0, 0 } }
  1214. +
  1215. +static inline unsigned long local_read(local_t *l)
  1216. +{
  1217. + return l->v[0] + l->v[1] + l->v[2];
  1218. +}
  1219. +
  1220. +static inline void local_set(local_t *l, unsigned long v)
  1221. +{
  1222. + l->v[0] = v;
  1223. + l->v[1] = l->v[2] = 0;
  1224. +}
  1225. +
  1226. +static inline void local_inc(local_t *l)
  1227. +{
  1228. + preempt_disable();
  1229. + _LOCAL_VAR(l)++;
  1230. + preempt_enable();
  1231. +}
  1232. +
  1233. +static inline void local_dec(local_t *l)
  1234. +{
  1235. + preempt_disable();
  1236. + _LOCAL_VAR(l)--;
  1237. + preempt_enable();
  1238. +}
  1239. +
  1240. +static inline void local_add(unsigned long v, local_t *l)
  1241. +{
  1242. + preempt_disable();
  1243. + _LOCAL_VAR(l) += v;
  1244. + preempt_enable();
  1245. +}
  1246. +
  1247. +static inline void local_sub(unsigned long v, local_t *l)
  1248. +{
  1249. + preempt_disable();
  1250. + _LOCAL_VAR(l) -= v;
  1251. + preempt_enable();
  1252. +}
  1253. +
  1254. +/* Non-atomic variants, ie. preemption disabled and won't be touched
  1255. + * in interrupt, etc. Some archs can optimize this case well. */
  1256. +#define __local_inc(l) ((l)->v[0]++)
  1257. +#define __local_dec(l) ((l)->v[0]--)
  1258. +#define __local_add(i,l) ((l)->v[0] += (i))
  1259. +#define __local_sub(i,l) ((l)->v[0] -= (i))
  1260. +
  1261. +#endif /* Non-atomic implementation */
  1262. +
  1263. +/* Use these for per-cpu local_t variables: on some archs they are
  1264. + * much more efficient than these naive implementations. Note they take
  1265. + * a variable (eg. mystruct.foo), not an address.
  1266. + */
  1267. +#define cpu_local_read(v) local_read(&__get_cpu_var(v))
  1268. +#define cpu_local_set(v, i) local_set(&__get_cpu_var(v), (i))
  1269. +#define cpu_local_inc(v) local_inc(&__get_cpu_var(v))
  1270. +#define cpu_local_dec(v) local_dec(&__get_cpu_var(v))
  1271. +#define cpu_local_add(i, v) local_add((i), &__get_cpu_var(v))
  1272. +#define cpu_local_sub(i, v) local_sub((i), &__get_cpu_var(v))
  1273. +
  1274. +/* Non-atomic increments, ie. preemption disabled and won't be touched
  1275. + * in interrupt, etc. Some archs can optimize this case well.
  1276. + */
  1277. +#define __cpu_local_inc(v) __local_inc(&__get_cpu_var(v))
  1278. +#define __cpu_local_dec(v) __local_dec(&__get_cpu_var(v))
  1279. +#define __cpu_local_add(i, v) __local_add((i), &__get_cpu_var(v))
  1280. +#define __cpu_local_sub(i, v) __local_sub((i), &__get_cpu_var(v))
  1281. +
  1282. +#endif /* _ASM_GENERIC_LOCAL_H */
  1283. --- linux/include/asm-generic/pci-dma-compat.h
  1284. +++ linux/include/asm-generic/pci-dma-compat.h
  1285. @@ -0,0 +1,107 @@
  1286. +/* include this file if the platform implements the dma_ DMA Mapping API
  1287. + * and wants to provide the pci_ DMA Mapping API in terms of it */
  1288. +
  1289. +#ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H
  1290. +#define _ASM_GENERIC_PCI_DMA_COMPAT_H
  1291. +
  1292. +#include <linux/dma-mapping.h>
  1293. +
  1294. +/* note pci_set_dma_mask isn't here, since it's a public function
  1295. + * exported from drivers/pci, use dma_supported instead */
  1296. +
  1297. +static inline int
  1298. +pci_dma_supported(struct pci_dev *hwdev, u64 mask)
  1299. +{
  1300. + return dma_supported(hwdev == NULL ? NULL : &hwdev->dev, mask);
  1301. +}
  1302. +
  1303. +static inline void *
  1304. +pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
  1305. + dma_addr_t *dma_handle)
  1306. +{
  1307. + return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
  1308. +}
  1309. +
  1310. +static inline void
  1311. +pci_free_consistent(struct pci_dev *hwdev, size_t size,
  1312. + void *vaddr, dma_addr_t dma_handle)
  1313. +{
  1314. + dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle);
  1315. +}
  1316. +
  1317. +static inline dma_addr_t
  1318. +pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
  1319. +{
  1320. + return dma_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction);
  1321. +}
  1322. +
  1323. +static inline void
  1324. +pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
  1325. + size_t size, int direction)
  1326. +{
  1327. + dma_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction);
  1328. +}
  1329. +
  1330. +static inline dma_addr_t
  1331. +pci_map_page(struct pci_dev *hwdev, struct page *page,
  1332. + unsigned long offset, size_t size, int direction)
  1333. +{
  1334. + return dma_map_page(hwdev == NULL ? NULL : &hwdev->dev, page, offset, size, (enum dma_data_direction)direction);
  1335. +}
  1336. +
  1337. +static inline void
  1338. +pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address,
  1339. + size_t size, int direction)
  1340. +{
  1341. + dma_unmap_page(hwdev == NULL ? NULL : &hwdev->dev, dma_address, size, (enum dma_data_direction)direction);
  1342. +}
  1343. +
  1344. +static inline int
  1345. +pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
  1346. + int nents, int direction)
  1347. +{
  1348. + return dma_map_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
  1349. +}
  1350. +
  1351. +static inline void
  1352. +pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
  1353. + int nents, int direction)
  1354. +{
  1355. + dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
  1356. +}
  1357. +
  1358. +static inline void
  1359. +pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle,
  1360. + size_t size, int direction)
  1361. +{
  1362. + dma_sync_single_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
  1363. +}
  1364. +
  1365. +static inline void
  1366. +pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
  1367. + size_t size, int direction)
  1368. +{
  1369. + dma_sync_single_for_device(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
  1370. +}
  1371. +
  1372. +static inline void
  1373. +pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg,
  1374. + int nelems, int direction)
  1375. +{
  1376. + dma_sync_sg_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
  1377. +}
  1378. +
  1379. +static inline void
  1380. +pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
  1381. + int nelems, int direction)
  1382. +{
  1383. + dma_sync_sg_for_device(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
  1384. +}
  1385. +
  1386. +static inline int
  1387. +pci_dma_mapping_error(dma_addr_t dma_addr)
  1388. +{
  1389. + return dma_mapping_error(dma_addr);
  1390. +}
  1391. +
  1392. +#endif
  1393. --- linux/include/asm-generic/pci.h
  1394. +++ linux/include/asm-generic/pci.h
  1395. @@ -0,0 +1,34 @@
  1396. +/*
  1397. + * linux/include/asm-generic/pci.h
  1398. + *
  1399. + * Copyright (C) 2003 Russell King
  1400. + */
  1401. +#ifndef _ASM_GENERIC_PCI_H
  1402. +#define _ASM_GENERIC_PCI_H
  1403. +
  1404. +/**
  1405. + * pcibios_resource_to_bus - convert resource to PCI bus address
  1406. + * @dev: device which owns this resource
  1407. + * @region: converted bus-centric region (start,end)
  1408. + * @res: resource to convert
  1409. + *
  1410. + * Convert a resource to a PCI device bus address or bus window.
  1411. + */
  1412. +static inline void
  1413. +pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
  1414. + struct resource *res)
  1415. +{
  1416. + region->start = res->start;
  1417. + region->end = res->end;
  1418. +}
  1419. +
  1420. +#define pcibios_scan_all_fns(a, b) 0
  1421. +
  1422. +#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
  1423. +static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
  1424. +{
  1425. + return channel ? 15 : 14;
  1426. +}
  1427. +#endif /* HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ */
  1428. +
  1429. +#endif
  1430. --- linux/include/asm-generic/percpu.h
  1431. +++ linux/include/asm-generic/percpu.h
  1432. @@ -0,0 +1,42 @@
  1433. +#ifndef _ASM_GENERIC_PERCPU_H_
  1434. +#define _ASM_GENERIC_PERCPU_H_
  1435. +#include <linux/compiler.h>
  1436. +
  1437. +#define __GENERIC_PER_CPU
  1438. +#ifdef CONFIG_SMP
  1439. +
  1440. +extern unsigned long __per_cpu_offset[NR_CPUS];
  1441. +
  1442. +/* Separate out the type, so (int[3], foo) works. */
  1443. +#define DEFINE_PER_CPU(type, name) \
  1444. + __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
  1445. +
  1446. +/* var is in discarded region: offset to particular copy we want */
  1447. +#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
  1448. +#define __get_cpu_var(var) per_cpu(var, smp_processor_id())
  1449. +
  1450. +/* A macro to avoid #include hell... */
  1451. +#define percpu_modcopy(pcpudst, src, size) \
  1452. +do { \
  1453. + unsigned int __i; \
  1454. + for (__i = 0; __i < NR_CPUS; __i++) \
  1455. + if (cpu_possible(__i)) \
  1456. + memcpy((pcpudst)+__per_cpu_offset[__i], \
  1457. + (src), (size)); \
  1458. +} while (0)
  1459. +#else /* ! SMP */
  1460. +
  1461. +#define DEFINE_PER_CPU(type, name) \
  1462. + __typeof__(type) per_cpu__##name
  1463. +
  1464. +#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var))
  1465. +#define __get_cpu_var(var) per_cpu__##var
  1466. +
  1467. +#endif /* SMP */
  1468. +
  1469. +#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
  1470. +
  1471. +#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
  1472. +#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
  1473. +
  1474. +#endif /* _ASM_GENERIC_PERCPU_H_ */
  1475. --- linux/include/asm-generic/pgtable.h
  1476. +++ linux/include/asm-generic/pgtable.h
  1477. @@ -0,0 +1,137 @@
  1478. +#ifndef _ASM_GENERIC_PGTABLE_H
  1479. +#define _ASM_GENERIC_PGTABLE_H
  1480. +
  1481. +#ifndef __HAVE_ARCH_PTEP_ESTABLISH
  1482. +/*
  1483. + * Establish a new mapping:
  1484. + * - flush the old one
  1485. + * - update the page tables
  1486. + * - inform the TLB about the new one
  1487. + *
  1488. + * We hold the mm semaphore for reading and vma->vm_mm->page_table_lock.
  1489. + *
  1490. + * Note: the old pte is known to not be writable, so we don't need to
  1491. + * worry about dirty bits etc getting lost.
  1492. + */
  1493. +#ifndef __HAVE_ARCH_SET_PTE_ATOMIC
  1494. +#define ptep_establish(__vma, __address, __ptep, __entry) \
  1495. +do { \
  1496. + set_pte(__ptep, __entry); \
  1497. + flush_tlb_page(__vma, __address); \
  1498. +} while (0)
  1499. +#else /* __HAVE_ARCH_SET_PTE_ATOMIC */
  1500. +#define ptep_establish(__vma, __address, __ptep, __entry) \
  1501. +do { \
  1502. + set_pte_atomic(__ptep, __entry); \
  1503. + flush_tlb_page(__vma, __address); \
  1504. +} while (0)
  1505. +#endif /* __HAVE_ARCH_SET_PTE_ATOMIC */
  1506. +#endif
  1507. +
  1508. +#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
  1509. +/*
  1510. + * Largely same as above, but only sets the access flags (dirty,
  1511. + * accessed, and writable). Furthermore, we know it always gets set
  1512. + * to a "more permissive" setting, which allows most architectures
  1513. + * to optimize this.
  1514. + */
  1515. +#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
  1516. +do { \
  1517. + set_pte(__ptep, __entry); \
  1518. + flush_tlb_page(__vma, __address); \
  1519. +} while (0)
  1520. +#endif
  1521. +
  1522. +#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
  1523. +static inline int ptep_test_and_clear_young(pte_t *ptep)
  1524. +{
  1525. + pte_t pte = *ptep;
  1526. + if (!pte_young(pte))
  1527. + return 0;
  1528. + set_pte(ptep, pte_mkold(pte));
  1529. + return 1;
  1530. +}
  1531. +#endif
  1532. +
  1533. +#ifndef __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
  1534. +#define ptep_clear_flush_young(__vma, __address, __ptep) \
  1535. +({ \
  1536. + int __young = ptep_test_and_clear_young(__ptep); \
  1537. + if (__young) \
  1538. + flush_tlb_page(__vma, __address); \
  1539. + __young; \
  1540. +})
  1541. +#endif
  1542. +
  1543. +#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
  1544. +static inline int ptep_test_and_clear_dirty(pte_t *ptep)
  1545. +{
  1546. + pte_t pte = *ptep;
  1547. + if (!pte_dirty(pte))
  1548. + return 0;
  1549. + set_pte(ptep, pte_mkclean(pte));
  1550. + return 1;
  1551. +}
  1552. +#endif
  1553. +
  1554. +#ifndef __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
  1555. +#define ptep_clear_flush_dirty(__vma, __address, __ptep) \
  1556. +({ \
  1557. + int __dirty = ptep_test_and_clear_dirty(__ptep); \
  1558. + if (__dirty) \
  1559. + flush_tlb_page(__vma, __address); \
  1560. + __dirty; \
  1561. +})
  1562. +#endif
  1563. +
  1564. +#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR
  1565. +static inline pte_t ptep_get_and_clear(pte_t *ptep)
  1566. +{
  1567. + pte_t pte = *ptep;
  1568. + pte_clear(ptep);
  1569. + return pte;
  1570. +}
  1571. +#endif
  1572. +
  1573. +#ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH
  1574. +#define ptep_clear_flush(__vma, __address, __ptep) \
  1575. +({ \
  1576. + pte_t __pte = ptep_get_and_clear(__ptep); \
  1577. + flush_tlb_page(__vma, __address); \
  1578. + __pte; \
  1579. +})
  1580. +#endif
  1581. +
  1582. +#ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT
  1583. +static inline void ptep_set_wrprotect(pte_t *ptep)
  1584. +{
  1585. + pte_t old_pte = *ptep;
  1586. + set_pte(ptep, pte_wrprotect(old_pte));
  1587. +}
  1588. +#endif
  1589. +
  1590. +#ifndef __HAVE_ARCH_PTEP_MKDIRTY
  1591. +static inline void ptep_mkdirty(pte_t *ptep)
  1592. +{
  1593. + pte_t old_pte = *ptep;
  1594. + set_pte(ptep, pte_mkdirty(old_pte));
  1595. +}
  1596. +#endif
  1597. +
  1598. +#ifndef __HAVE_ARCH_PTE_SAME
  1599. +#define pte_same(A,B) (pte_val(A) == pte_val(B))
  1600. +#endif
  1601. +
  1602. +#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
  1603. +#define page_test_and_clear_dirty(page) (0)
  1604. +#endif
  1605. +
  1606. +#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
  1607. +#define page_test_and_clear_young(page) (0)
  1608. +#endif
  1609. +
  1610. +#ifndef __HAVE_ARCH_PGD_OFFSET_GATE
  1611. +#define pgd_offset_gate(mm, addr) pgd_offset(mm, addr)
  1612. +#endif
  1613. +
  1614. +#endif /* _ASM_GENERIC_PGTABLE_H */
  1615. --- linux/include/asm-generic/pgtable-nopmd.h
  1616. +++ linux/include/asm-generic/pgtable-nopmd.h
  1617. @@ -0,0 +1,60 @@
  1618. +#ifndef _PGTABLE_NOPMD_H
  1619. +#define _PGTABLE_NOPMD_H
  1620. +
  1621. +#ifndef __ASSEMBLY__
  1622. +
  1623. +#include <asm-generic/pgtable-nopud.h>
  1624. +
  1625. +/*
  1626. + * Having the pmd type consist of a pud gets the size right, and allows
  1627. + * us to conceptually access the pud entry that this pmd is folded into
  1628. + * without casting.
  1629. + */
  1630. +typedef struct { pud_t pud; } pmd_t;
  1631. +
  1632. +#define PMD_SHIFT PUD_SHIFT
  1633. +#define PTRS_PER_PMD 1
  1634. +#define PMD_SIZE (1UL << PMD_SHIFT)
  1635. +#define PMD_MASK (~(PMD_SIZE-1))
  1636. +
  1637. +/*
  1638. + * The "pud_xxx()" functions here are trivial for a folded two-level
  1639. + * setup: the pmd is never bad, and a pmd always exists (as it's folded
  1640. + * into the pud entry)
  1641. + */
  1642. +static inline int pud_none(pud_t pud) { return 0; }
  1643. +static inline int pud_bad(pud_t pud) { return 0; }
  1644. +static inline int pud_present(pud_t pud) { return 1; }
  1645. +static inline void pud_clear(pud_t *pud) { }
  1646. +#define pmd_ERROR(pmd) (pud_ERROR((pmd).pud))
  1647. +
  1648. +#define pud_populate(mm, pmd, pte) do { } while (0)
  1649. +
  1650. +/*
  1651. + * (pmds are folded into puds so this doesn't get actually called,
  1652. + * but the define is needed for a generic inline function.)
  1653. + */
  1654. +#define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
  1655. +
  1656. +static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
  1657. +{
  1658. + return (pmd_t *)pud;
  1659. +}
  1660. +
  1661. +#define pmd_val(x) (pud_val((x).pud))
  1662. +#define __pmd(x) ((pmd_t) { __pud(x) } )
  1663. +
  1664. +#define pud_page(pud) (pmd_page((pmd_t){ pud }))
  1665. +#define pud_page_kernel(pud) (pmd_page_kernel((pmd_t){ pud }))
  1666. +
  1667. +/*
  1668. + * allocating and freeing a pmd is trivial: the 1-entry pmd is
  1669. + * inside the pud, so has no extra memory associated with it.
  1670. + */
  1671. +#define pmd_alloc_one(mm, address) NULL
  1672. +#define pmd_free(x) do { } while (0)
  1673. +#define __pmd_free_tlb(tlb, x) do { } while (0)
  1674. +
  1675. +#endif /* __ASSEMBLY__ */
  1676. +
  1677. +#endif /* _PGTABLE_NOPMD_H */
  1678. --- linux/include/asm-generic/pgtable-nopud.h
  1679. +++ linux/include/asm-generic/pgtable-nopud.h
  1680. @@ -0,0 +1,56 @@
  1681. +#ifndef _PGTABLE_NOPUD_H
  1682. +#define _PGTABLE_NOPUD_H
  1683. +
  1684. +#ifndef __ASSEMBLY__
  1685. +
  1686. +/*
  1687. + * Having the pud type consist of a pgd gets the size right, and allows
  1688. + * us to conceptually access the pgd entry that this pud is folded into
  1689. + * without casting.
  1690. + */
  1691. +typedef struct { pgd_t pgd; } pud_t;
  1692. +
  1693. +#define PUD_SHIFT PGDIR_SHIFT
  1694. +#define PTRS_PER_PUD 1
  1695. +#define PUD_SIZE (1UL << PUD_SHIFT)
  1696. +#define PUD_MASK (~(PUD_SIZE-1))
  1697. +
  1698. +/*
  1699. + * The "pgd_xxx()" functions here are trivial for a folded two-level
  1700. + * setup: the pud is never bad, and a pud always exists (as it's folded
  1701. + * into the pgd entry)
  1702. + */
  1703. +static inline int pgd_none(pgd_t pgd) { return 0; }
  1704. +static inline int pgd_bad(pgd_t pgd) { return 0; }
  1705. +static inline int pgd_present(pgd_t pgd) { return 1; }
  1706. +static inline void pgd_clear(pgd_t *pgd) { }
  1707. +#define pud_ERROR(pud) (pgd_ERROR((pud).pgd))
  1708. +
  1709. +#define pgd_populate(mm, pgd, pud) do { } while (0)
  1710. +/*
  1711. + * (puds are folded into pgds so this doesn't get actually called,
  1712. + * but the define is needed for a generic inline function.)
  1713. + */
  1714. +#define set_pgd(pgdptr, pgdval) set_pud((pud_t *)(pgdptr), (pud_t) { pgdval })
  1715. +
  1716. +static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address)
  1717. +{
  1718. + return (pud_t *)pgd;
  1719. +}
  1720. +
  1721. +#define pud_val(x) (pgd_val((x).pgd))
  1722. +#define __pud(x) ((pud_t) { __pgd(x) } )
  1723. +
  1724. +#define pgd_page(pgd) (pud_page((pud_t){ pgd }))
  1725. +#define pgd_page_kernel(pgd) (pud_page_kernel((pud_t){ pgd }))
  1726. +
  1727. +/*
  1728. + * allocating and freeing a pud is trivial: the 1-entry pud is
  1729. + * inside the pgd, so has no extra memory associated with it.
  1730. + */
  1731. +#define pud_alloc_one(mm, address) NULL
  1732. +#define pud_free(x) do { } while (0)
  1733. +#define __pud_free_tlb(tlb, x) do { } while (0)
  1734. +
  1735. +#endif /* __ASSEMBLY__ */
  1736. +#endif /* _PGTABLE_NOPUD_H */
  1737. --- linux/include/asm-generic/resource.h
  1738. +++ linux/include/asm-generic/resource.h
  1739. @@ -0,0 +1,60 @@
  1740. +#ifndef _ASM_GENERIC_RESOURCE_H
  1741. +#define _ASM_GENERIC_RESOURCE_H
  1742. +
  1743. +/*
  1744. + * Resource limits
  1745. + */
  1746. +
  1747. +/* Allow arch to control resource order */
  1748. +#ifndef __ARCH_RLIMIT_ORDER
  1749. +#define RLIMIT_CPU 0 /* CPU time in ms */
  1750. +#define RLIMIT_FSIZE 1 /* Maximum filesize */
  1751. +#define RLIMIT_DATA 2 /* max data size */
  1752. +#define RLIMIT_STACK 3 /* max stack size */
  1753. +#define RLIMIT_CORE 4 /* max core file size */
  1754. +#define RLIMIT_RSS 5 /* max resident set size */
  1755. +#define RLIMIT_NPROC 6 /* max number of processes */
  1756. +#define RLIMIT_NOFILE 7 /* max number of open files */
  1757. +#define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
  1758. +#define RLIMIT_AS 9 /* address space limit */
  1759. +#define RLIMIT_LOCKS 10 /* maximum file locks held */
  1760. +#define RLIMIT_SIGPENDING 11 /* max number of pending signals */
  1761. +#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
  1762. +
  1763. +#define RLIM_NLIMITS 13
  1764. +#endif
  1765. +
  1766. +/*
  1767. + * SuS says limits have to be unsigned.
  1768. + * Which makes a ton more sense anyway.
  1769. + */
  1770. +#ifndef RLIM_INFINITY
  1771. +#define RLIM_INFINITY (~0UL)
  1772. +#endif
  1773. +
  1774. +#ifndef _STK_LIM_MAX
  1775. +#define _STK_LIM_MAX RLIM_INFINITY
  1776. +#endif
  1777. +
  1778. +#ifdef __KERNEL__
  1779. +
  1780. +#define INIT_RLIMITS \
  1781. +{ \
  1782. + [RLIMIT_CPU] = { RLIM_INFINITY, RLIM_INFINITY }, \
  1783. + [RLIMIT_FSIZE] = { RLIM_INFINITY, RLIM_INFINITY }, \
  1784. + [RLIMIT_DATA] = { RLIM_INFINITY, RLIM_INFINITY }, \
  1785. + [RLIMIT_STACK] = { _STK_LIM, _STK_LIM_MAX }, \
  1786. + [RLIMIT_CORE] = { 0, RLIM_INFINITY }, \
  1787. + [RLIMIT_RSS] = { RLIM_INFINITY, RLIM_INFINITY }, \
  1788. + [RLIMIT_NPROC] = { 0, 0 }, \
  1789. + [RLIMIT_NOFILE] = { INR_OPEN, INR_OPEN }, \
  1790. + [RLIMIT_MEMLOCK] = { MLOCK_LIMIT, MLOCK_LIMIT }, \
  1791. + [RLIMIT_AS] = { RLIM_INFINITY, RLIM_INFINITY }, \
  1792. + [RLIMIT_LOCKS] = { RLIM_INFINITY, RLIM_INFINITY }, \
  1793. + [RLIMIT_SIGPENDING] = { MAX_SIGPENDING, MAX_SIGPENDING }, \
  1794. + [RLIMIT_MSGQUEUE] = { MQ_BYTES_MAX, MQ_BYTES_MAX }, \
  1795. +}
  1796. +
  1797. +#endif /* __KERNEL__ */
  1798. +
  1799. +#endif
  1800. --- linux/include/asm-generic/rmap.h
  1801. +++ linux/include/asm-generic/rmap.h
  1802. @@ -0,0 +1,90 @@
  1803. +#ifndef _GENERIC_RMAP_H
  1804. +#define _GENERIC_RMAP_H
  1805. +/*
  1806. + * linux/include/asm-generic/rmap.h
  1807. + *
  1808. + * Architecture dependent parts of the reverse mapping code,
  1809. + * this version should work for most architectures with a
  1810. + * 'normal' page table layout.
  1811. + *
  1812. + * We use the struct page of the page table page to find out
  1813. + * the process and full address of a page table entry:
  1814. + * - page->mapping points to the process' mm_struct
  1815. + * - page->index has the high bits of the address
  1816. + * - the lower bits of the address are calculated from the
  1817. + * offset of the page table entry within the page table page
  1818. + *
  1819. + * For CONFIG_HIGHPTE, we need to represent the address of a pte in a
  1820. + * scalar pte_addr_t. The pfn of the pte's page is shifted left by PAGE_SIZE
  1821. + * bits and is then ORed with the byte offset of the pte within its page.
  1822. + *
  1823. + * For CONFIG_HIGHMEM4G, the pte_addr_t is 32 bits. 20 for the pfn, 12 for
  1824. + * the offset.
  1825. + *
  1826. + * For CONFIG_HIGHMEM64G, the pte_addr_t is 64 bits. 52 for the pfn, 12 for
  1827. + * the offset.
  1828. + */
  1829. +#include <linux/mm.h>
  1830. +
  1831. +static inline void pgtable_add_rmap(struct page * page, struct mm_struct * mm, unsigned long address)
  1832. +{
  1833. +#ifdef BROKEN_PPC_PTE_ALLOC_ONE
  1834. + /* OK, so PPC calls pte_alloc() before mem_map[] is setup ... ;( */
  1835. + extern int mem_init_done;
  1836. +
  1837. + if (!mem_init_done)
  1838. + return;
  1839. +#endif
  1840. + page->mapping = (void *)mm;
  1841. + page->index = address & ~((PTRS_PER_PTE * PAGE_SIZE) - 1);
  1842. + inc_page_state(nr_page_table_pages);
  1843. +}
  1844. +
  1845. +static inline void pgtable_remove_rmap(struct page * page)
  1846. +{
  1847. + page->mapping = NULL;
  1848. + page->index = 0;
  1849. + dec_page_state(nr_page_table_pages);
  1850. +}
  1851. +
  1852. +static inline struct mm_struct * ptep_to_mm(pte_t * ptep)
  1853. +{
  1854. + struct page * page = kmap_atomic_to_page(ptep);
  1855. + return (struct mm_struct *) page->mapping;
  1856. +}
  1857. +
  1858. +static inline unsigned long ptep_to_address(pte_t * ptep)
  1859. +{
  1860. + struct page * page = kmap_atomic_to_page(ptep);
  1861. + unsigned long low_bits;
  1862. + low_bits = ((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE;
  1863. + return page->index + low_bits;
  1864. +}
  1865. +
  1866. +#ifdef CONFIG_HIGHPTE
  1867. +static inline pte_addr_t ptep_to_paddr(pte_t *ptep)
  1868. +{
  1869. + pte_addr_t paddr;
  1870. + paddr = ((pte_addr_t)page_to_pfn(kmap_atomic_to_page(ptep))) << PAGE_SHIFT;
  1871. + return paddr + (pte_addr_t)((unsigned long)ptep & ~PAGE_MASK);
  1872. +}
  1873. +#else
  1874. +static inline pte_addr_t ptep_to_paddr(pte_t *ptep)
  1875. +{
  1876. + return (pte_addr_t)ptep;
  1877. +}
  1878. +#endif
  1879. +
  1880. +#ifndef CONFIG_HIGHPTE
  1881. +static inline pte_t *rmap_ptep_map(pte_addr_t pte_paddr)
  1882. +{
  1883. + return (pte_t *)pte_paddr;
  1884. +}
  1885. +
  1886. +static inline void rmap_ptep_unmap(pte_t *pte)
  1887. +{
  1888. + return;
  1889. +}
  1890. +#endif
  1891. +
  1892. +#endif /* _GENERIC_RMAP_H */
  1893. --- linux/include/asm-generic/rtc.h
  1894. +++ linux/include/asm-generic/rtc.h
  1895. @@ -0,0 +1,213 @@
  1896. +/*
  1897. + * inclue/asm-generic/rtc.h
  1898. + *
  1899. + * Author: Tom Rini <trini@mvista.com>
  1900. + *
  1901. + * Based on:
  1902. + * drivers/char/rtc.c
  1903. + *
  1904. + * Please read the COPYING file for all license details.
  1905. + */
  1906. +
  1907. +#ifndef __ASM_RTC_H__
  1908. +#define __ASM_RTC_H__
  1909. +
  1910. +#ifdef __KERNEL__
  1911. +
  1912. +#include <linux/mc146818rtc.h>
  1913. +#include <linux/rtc.h>
  1914. +#include <linux/bcd.h>
  1915. +
  1916. +#define RTC_PIE 0x40 /* periodic interrupt enable */
  1917. +#define RTC_AIE 0x20 /* alarm interrupt enable */
  1918. +#define RTC_UIE 0x10 /* update-finished interrupt enable */
  1919. +
  1920. +/* some dummy definitions */
  1921. +#define RTC_BATT_BAD 0x100 /* battery bad */
  1922. +#define RTC_SQWE 0x08 /* enable square-wave output */
  1923. +#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */
  1924. +#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
  1925. +#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
  1926. +
  1927. +/*
  1928. + * Returns true if a clock update is in progress
  1929. + */
  1930. +static inline unsigned char rtc_is_updating(void)
  1931. +{
  1932. + unsigned char uip;
  1933. +
  1934. + spin_lock_irq(&rtc_lock);
  1935. + uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
  1936. + spin_unlock_irq(&rtc_lock);
  1937. + return uip;
  1938. +}
  1939. +
  1940. +static inline unsigned int get_rtc_time(struct rtc_time *time)
  1941. +{
  1942. + unsigned long uip_watchdog = jiffies;
  1943. + unsigned char ctrl;
  1944. +#ifdef CONFIG_MACH_DECSTATION
  1945. + unsigned int real_year;
  1946. +#endif
  1947. +
  1948. + /*
  1949. + * read RTC once any update in progress is done. The update
  1950. + * can take just over 2ms. We wait 10 to 20ms. There is no need to
  1951. + * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP.
  1952. + * If you need to know *exactly* when a second has started, enable
  1953. + * periodic update complete interrupts, (via ioctl) and then
  1954. + * immediately read /dev/rtc which will block until you get the IRQ.
  1955. + * Once the read clears, read the RTC time (again via ioctl). Easy.
  1956. + */
  1957. +
  1958. + if (rtc_is_updating() != 0)
  1959. + while (jiffies - uip_watchdog < 2*HZ/100) {
  1960. + barrier();
  1961. + cpu_relax();
  1962. + }
  1963. +
  1964. + /*
  1965. + * Only the values that we read from the RTC are set. We leave
  1966. + * tm_wday, tm_yday and tm_isdst untouched. Even though the
  1967. + * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
  1968. + * by the RTC when initially set to a non-zero value.
  1969. + */
  1970. + spin_lock_irq(&rtc_lock);
  1971. + time->tm_sec = CMOS_READ(RTC_SECONDS);
  1972. + time->tm_min = CMOS_READ(RTC_MINUTES);
  1973. + time->tm_hour = CMOS_READ(RTC_HOURS);
  1974. + time->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH);
  1975. + time->tm_mon = CMOS_READ(RTC_MONTH);
  1976. + time->tm_year = CMOS_READ(RTC_YEAR);
  1977. +#ifdef CONFIG_MACH_DECSTATION
  1978. + real_year = CMOS_READ(RTC_DEC_YEAR);
  1979. +#endif
  1980. + ctrl = CMOS_READ(RTC_CONTROL);
  1981. + spin_unlock_irq(&rtc_lock);
  1982. +
  1983. + if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
  1984. + {
  1985. + BCD_TO_BIN(time->tm_sec);
  1986. + BCD_TO_BIN(time->tm_min);
  1987. + BCD_TO_BIN(time->tm_hour);
  1988. + BCD_TO_BIN(time->tm_mday);
  1989. + BCD_TO_BIN(time->tm_mon);
  1990. + BCD_TO_BIN(time->tm_year);
  1991. + }
  1992. +
  1993. +#ifdef CONFIG_MACH_DECSTATION
  1994. + time->tm_year += real_year - 72;
  1995. +#endif
  1996. +
  1997. + /*
  1998. + * Account for differences between how the RTC uses the values
  1999. + * and how they are defined in a struct rtc_time;
  2000. + */
  2001. + if (time->tm_year <= 69)
  2002. + time->tm_year += 100;
  2003. +
  2004. + time->tm_mon--;
  2005. +
  2006. + return RTC_24H;
  2007. +}
  2008. +
  2009. +/* Set the current date and time in the real time clock. */
  2010. +static inline int set_rtc_time(struct rtc_time *time)
  2011. +{
  2012. + unsigned char mon, day, hrs, min, sec;
  2013. + unsigned char save_control, save_freq_select;
  2014. + unsigned int yrs;
  2015. +#ifdef CONFIG_MACH_DECSTATION
  2016. + unsigned int real_yrs, leap_yr;
  2017. +#endif
  2018. +
  2019. + yrs = time->tm_year;
  2020. + mon = time->tm_mon + 1; /* tm_mon starts at zero */
  2021. + day = time->tm_mday;
  2022. + hrs = time->tm_hour;
  2023. + min = time->tm_min;
  2024. + sec = time->tm_sec;
  2025. +
  2026. + if (yrs > 255) /* They are unsigned */
  2027. + return -EINVAL;
  2028. +
  2029. + spin_lock_irq(&rtc_lock);
  2030. +#ifdef CONFIG_MACH_DECSTATION
  2031. + real_yrs = yrs;
  2032. + leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) ||
  2033. + !((yrs + 1900) % 400));
  2034. + yrs = 72;
  2035. +
  2036. + /*
  2037. + * We want to keep the year set to 73 until March
  2038. + * for non-leap years, so that Feb, 29th is handled
  2039. + * correctly.
  2040. + */
  2041. + if (!leap_yr && mon < 3) {
  2042. + real_yrs--;
  2043. + yrs = 73;
  2044. + }
  2045. +#endif
  2046. + /* These limits and adjustments are independent of
  2047. + * whether the chip is in binary mode or not.
  2048. + */
  2049. + if (yrs > 169) {
  2050. + spin_unlock_irq(&rtc_lock);
  2051. + return -EINVAL;
  2052. + }
  2053. +
  2054. + if (yrs >= 100)
  2055. + yrs -= 100;
  2056. +
  2057. + if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY)
  2058. + || RTC_ALWAYS_BCD) {
  2059. + BIN_TO_BCD(sec);
  2060. + BIN_TO_BCD(min);
  2061. + BIN_TO_BCD(hrs);
  2062. + BIN_TO_BCD(day);
  2063. + BIN_TO_BCD(mon);
  2064. + BIN_TO_BCD(yrs);
  2065. + }
  2066. +
  2067. + save_control = CMOS_READ(RTC_CONTROL);
  2068. + CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
  2069. + save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
  2070. + CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
  2071. +
  2072. +#ifdef CONFIG_MACH_DECSTATION
  2073. + CMOS_WRITE(real_yrs, RTC_DEC_YEAR);
  2074. +#endif
  2075. + CMOS_WRITE(yrs, RTC_YEAR);
  2076. + CMOS_WRITE(mon, RTC_MONTH);
  2077. + CMOS_WRITE(day, RTC_DAY_OF_MONTH);
  2078. + CMOS_WRITE(hrs, RTC_HOURS);
  2079. + CMOS_WRITE(min, RTC_MINUTES);
  2080. + CMOS_WRITE(sec, RTC_SECONDS);
  2081. +
  2082. + CMOS_WRITE(save_control, RTC_CONTROL);
  2083. + CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
  2084. +
  2085. + spin_unlock_irq(&rtc_lock);
  2086. +
  2087. + return 0;
  2088. +}
  2089. +
  2090. +static inline unsigned int get_rtc_ss(void)
  2091. +{
  2092. + struct rtc_time h;
  2093. +
  2094. + get_rtc_time(&h);
  2095. + return h.tm_sec;
  2096. +}
  2097. +
  2098. +static inline int get_rtc_pll(struct rtc_pll_info *pll)
  2099. +{
  2100. + return -EINVAL;
  2101. +}
  2102. +static inline int set_rtc_pll(struct rtc_pll_info *pll)
  2103. +{
  2104. + return -EINVAL;
  2105. +}
  2106. +
  2107. +#endif /* __KERNEL__ */
  2108. +#endif /* __ASM_RTC_H__ */
  2109. --- linux/include/asm-generic/sections.h
  2110. +++ linux/include/asm-generic/sections.h
  2111. @@ -0,0 +1,13 @@
  2112. +#ifndef _ASM_GENERIC_SECTIONS_H_
  2113. +#define _ASM_GENERIC_SECTIONS_H_
  2114. +
  2115. +/* References to section boundaries */
  2116. +
  2117. +extern char _text[], _stext[], _etext[];
  2118. +extern char _data[], _sdata[], _edata[];
  2119. +extern char __bss_start[], __bss_stop[];
  2120. +extern char __init_begin[], __init_end[];
  2121. +extern char _sinittext[], _einittext[];
  2122. +extern char _end[];
  2123. +
  2124. +#endif /* _ASM_GENERIC_SECTIONS_H_ */
  2125. --- linux/include/asm-generic/siginfo.h
  2126. +++ linux/include/asm-generic/siginfo.h
  2127. @@ -0,0 +1,288 @@
  2128. +#ifndef _ASM_GENERIC_SIGINFO_H
  2129. +#define _ASM_GENERIC_SIGINFO_H
  2130. +
  2131. +#include <linux/compiler.h>
  2132. +#include <linux/types.h>
  2133. +#include <linux/resource.h>
  2134. +
  2135. +typedef union sigval {
  2136. + int sival_int;
  2137. + void __user *sival_ptr;
  2138. +} sigval_t;
  2139. +
  2140. +/*
  2141. + * This is the size (including padding) of the part of the
  2142. + * struct siginfo that is before the union.
  2143. + */
  2144. +#ifndef __ARCH_SI_PREAMBLE_SIZE
  2145. +#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
  2146. +#endif
  2147. +
  2148. +#define SI_MAX_SIZE 128
  2149. +#ifndef SI_PAD_SIZE
  2150. +#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
  2151. +#endif
  2152. +
  2153. +#ifndef __ARCH_SI_UID_T
  2154. +#define __ARCH_SI_UID_T uid_t
  2155. +#endif
  2156. +
  2157. +/*
  2158. + * The default "si_band" type is "long", as specified by POSIX.
  2159. + * However, some architectures want to override this to "int"
  2160. + * for historical compatibility reasons, so we allow that.
  2161. + */
  2162. +#ifndef __ARCH_SI_BAND_T
  2163. +#define __ARCH_SI_BAND_T long
  2164. +#endif
  2165. +
  2166. +#ifndef HAVE_ARCH_SIGINFO_T
  2167. +
  2168. +typedef struct siginfo {
  2169. + int si_signo;
  2170. + int si_errno;
  2171. + int si_code;
  2172. +
  2173. + union {
  2174. + int _pad[SI_PAD_SIZE];
  2175. +
  2176. + /* kill() */
  2177. + struct {
  2178. + pid_t _pid; /* sender's pid */
  2179. + __ARCH_SI_UID_T _uid; /* sender's uid */
  2180. + } _kill;
  2181. +
  2182. + /* POSIX.1b timers */
  2183. + struct {
  2184. + timer_t _tid; /* timer id */
  2185. + int _overrun; /* overrun count */
  2186. + char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
  2187. + sigval_t _sigval; /* same as below */
  2188. + int _sys_private; /* not to be passed to user */
  2189. + } _timer;
  2190. +
  2191. + /* POSIX.1b signals */
  2192. + struct {
  2193. + pid_t _pid; /* sender's pid */
  2194. + __ARCH_SI_UID_T _uid; /* sender's uid */
  2195. + sigval_t _sigval;
  2196. + } _rt;
  2197. +
  2198. + /* SIGCHLD */
  2199. + struct {
  2200. + pid_t _pid; /* which child */
  2201. + __ARCH_SI_UID_T _uid; /* sender's uid */
  2202. + int _status; /* exit code */
  2203. + clock_t _utime;
  2204. + clock_t _stime;
  2205. + } _sigchld;
  2206. +
  2207. + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  2208. + struct {
  2209. + void __user *_addr; /* faulting insn/memory ref. */
  2210. +#ifdef __ARCH_SI_TRAPNO
  2211. + int _trapno; /* TRAP # which caused the signal */
  2212. +#endif
  2213. + } _sigfault;
  2214. +
  2215. + /* SIGPOLL */
  2216. + struct {
  2217. + __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  2218. + int _fd;
  2219. + } _sigpoll;
  2220. + } _sifields;
  2221. +} siginfo_t;
  2222. +
  2223. +#endif
  2224. +
  2225. +/*
  2226. + * How these fields are to be accessed.
  2227. + */
  2228. +#define si_pid _sifields._kill._pid
  2229. +#define si_uid _sifields._kill._uid
  2230. +#define si_tid _sifields._timer._tid
  2231. +#define si_overrun _sifields._timer._overrun
  2232. +#define si_sys_private _sifields._timer._sys_private
  2233. +#define si_status _sifields._sigchld._status
  2234. +#define si_utime _sifields._sigchld._utime
  2235. +#define si_stime _sifields._sigchld._stime
  2236. +#define si_value _sifields._rt._sigval
  2237. +#define si_int _sifields._rt._sigval.sival_int
  2238. +#define si_ptr _sifields._rt._sigval.sival_ptr
  2239. +#define si_addr _sifields._sigfault._addr
  2240. +#ifdef __ARCH_SI_TRAPNO
  2241. +#define si_trapno _sifields._sigfault._trapno
  2242. +#endif
  2243. +#define si_band _sifields._sigpoll._band
  2244. +#define si_fd _sifields._sigpoll._fd
  2245. +
  2246. +#ifdef __KERNEL__
  2247. +#define __SI_MASK 0xffff0000u
  2248. +#define __SI_KILL (0 << 16)
  2249. +#define __SI_TIMER (1 << 16)
  2250. +#define __SI_POLL (2 << 16)
  2251. +#define __SI_FAULT (3 << 16)
  2252. +#define __SI_CHLD (4 << 16)
  2253. +#define __SI_RT (5 << 16)
  2254. +#define __SI_MESGQ (6 << 16)
  2255. +#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
  2256. +#else
  2257. +#define __SI_KILL 0
  2258. +#define __SI_TIMER 0
  2259. +#define __SI_POLL 0
  2260. +#define __SI_FAULT 0
  2261. +#define __SI_CHLD 0
  2262. +#define __SI_RT 0
  2263. +#define __SI_MESGQ 0
  2264. +#define __SI_CODE(T,N) (N)
  2265. +#endif
  2266. +
  2267. +/*
  2268. + * si_code values
  2269. + * Digital reserves positive values for kernel-generated signals.
  2270. + */
  2271. +#define SI_USER 0 /* sent by kill, sigsend, raise */
  2272. +#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
  2273. +#define SI_QUEUE -1 /* sent by sigqueue */
  2274. +#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
  2275. +#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */
  2276. +#define SI_ASYNCIO -4 /* sent by AIO completion */
  2277. +#define SI_SIGIO -5 /* sent by queued SIGIO */
  2278. +#define SI_TKILL -6 /* sent by tkill system call */
  2279. +#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
  2280. +
  2281. +#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
  2282. +#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
  2283. +
  2284. +/*
  2285. + * SIGILL si_codes
  2286. + */
  2287. +#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */
  2288. +#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */
  2289. +#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */
  2290. +#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */
  2291. +#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */
  2292. +#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */
  2293. +#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */
  2294. +#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */
  2295. +#define NSIGILL 8
  2296. +
  2297. +/*
  2298. + * SIGFPE si_codes
  2299. + */
  2300. +#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */
  2301. +#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */
  2302. +#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */
  2303. +#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */
  2304. +#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */
  2305. +#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */
  2306. +#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */
  2307. +#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */
  2308. +#define NSIGFPE 8
  2309. +
  2310. +/*
  2311. + * SIGSEGV si_codes
  2312. + */
  2313. +#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
  2314. +#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
  2315. +#define NSIGSEGV 2
  2316. +
  2317. +/*
  2318. + * SIGBUS si_codes
  2319. + */
  2320. +#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */
  2321. +#define BUS_ADRERR (__SI_FAULT|2) /* non-existant physical address */
  2322. +#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */
  2323. +#define NSIGBUS 3
  2324. +
  2325. +/*
  2326. + * SIGTRAP si_codes
  2327. + */
  2328. +#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
  2329. +#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
  2330. +#define NSIGTRAP 2
  2331. +
  2332. +/*
  2333. + * SIGCHLD si_codes
  2334. + */
  2335. +#define CLD_EXITED (__SI_CHLD|1) /* child has exited */
  2336. +#define CLD_KILLED (__SI_CHLD|2) /* child was killed */
  2337. +#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */
  2338. +#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */
  2339. +#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */
  2340. +#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */
  2341. +#define NSIGCHLD 6
  2342. +
  2343. +/*
  2344. + * SIGPOLL si_codes
  2345. + */
  2346. +#define POLL_IN (__SI_POLL|1) /* data input available */
  2347. +#define POLL_OUT (__SI_POLL|2) /* output buffers available */
  2348. +#define POLL_MSG (__SI_POLL|3) /* input message available */
  2349. +#define POLL_ERR (__SI_POLL|4) /* i/o error */
  2350. +#define POLL_PRI (__SI_POLL|5) /* high priority input available */
  2351. +#define POLL_HUP (__SI_POLL|6) /* device disconnected */
  2352. +#define NSIGPOLL 6
  2353. +
  2354. +/*
  2355. + * sigevent definitions
  2356. + *
  2357. + * It seems likely that SIGEV_THREAD will have to be handled from
  2358. + * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
  2359. + * thread manager then catches and does the appropriate nonsense.
  2360. + * However, everything is written out here so as to not get lost.
  2361. + */
  2362. +#define SIGEV_SIGNAL 0 /* notify via signal */
  2363. +#define SIGEV_NONE 1 /* other notification: meaningless */
  2364. +#define SIGEV_THREAD 2 /* deliver via thread creation */
  2365. +#define SIGEV_THREAD_ID 4 /* deliver to thread */
  2366. +
  2367. +#define SIGEV_MAX_SIZE 64
  2368. +#ifndef SIGEV_PAD_SIZE
  2369. +#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
  2370. +#endif
  2371. +
  2372. +typedef struct sigevent {
  2373. + sigval_t sigev_value;
  2374. + int sigev_signo;
  2375. + int sigev_notify;
  2376. + union {
  2377. + int _pad[SIGEV_PAD_SIZE];
  2378. + int _tid;
  2379. +
  2380. + struct {
  2381. + void (*_function)(sigval_t);
  2382. + void *_attribute; /* really pthread_attr_t */
  2383. + } _sigev_thread;
  2384. + } _sigev_un;
  2385. +} sigevent_t;
  2386. +
  2387. +#define sigev_notify_function _sigev_un._sigev_thread._function
  2388. +#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
  2389. +#define sigev_notify_thread_id _sigev_un._tid
  2390. +
  2391. +#ifdef __KERNEL__
  2392. +
  2393. +struct siginfo;
  2394. +void do_schedule_next_timer(struct siginfo *info);
  2395. +
  2396. +#ifndef HAVE_ARCH_COPY_SIGINFO
  2397. +
  2398. +#include <linux/string.h>
  2399. +
  2400. +static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
  2401. +{
  2402. + if (from->si_code < 0)
  2403. + memcpy(to, from, sizeof(*to));
  2404. + else
  2405. + /* _sigchld is currently the largest know union member */
  2406. + memcpy(to, from, __ARCH_SI_PREAMBLE_SIZE + sizeof(from->_sifields._sigchld));
  2407. +}
  2408. +
  2409. +#endif
  2410. +
  2411. +extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from);
  2412. +
  2413. +#endif /* __KERNEL__ */
  2414. +
  2415. +#endif
  2416. --- linux/include/asm-generic/statfs.h
  2417. +++ linux/include/asm-generic/statfs.h
  2418. @@ -0,0 +1,51 @@
  2419. +#ifndef _GENERIC_STATFS_H
  2420. +#define _GENERIC_STATFS_H
  2421. +
  2422. +#ifndef __KERNEL_STRICT_NAMES
  2423. +# include <linux/types.h>
  2424. +typedef __kernel_fsid_t fsid_t;
  2425. +#endif
  2426. +
  2427. +struct statfs {
  2428. + __u32 f_type;
  2429. + __u32 f_bsize;
  2430. + __u32 f_blocks;
  2431. + __u32 f_bfree;
  2432. + __u32 f_bavail;
  2433. + __u32 f_files;
  2434. + __u32 f_ffree;
  2435. + __kernel_fsid_t f_fsid;
  2436. + __u32 f_namelen;
  2437. + __u32 f_frsize;
  2438. + __u32 f_spare[5];
  2439. +};
  2440. +
  2441. +struct statfs64 {
  2442. + __u32 f_type;
  2443. + __u32 f_bsize;
  2444. + __u64 f_blocks;
  2445. + __u64 f_bfree;
  2446. + __u64 f_bavail;
  2447. + __u64 f_files;
  2448. + __u64 f_ffree;
  2449. + __kernel_fsid_t f_fsid;
  2450. + __u32 f_namelen;
  2451. + __u32 f_frsize;
  2452. + __u32 f_spare[5];
  2453. +};
  2454. +
  2455. +struct compat_statfs64 {
  2456. + __u32 f_type;
  2457. + __u32 f_bsize;
  2458. + __u64 f_blocks;
  2459. + __u64 f_bfree;
  2460. + __u64 f_bavail;
  2461. + __u64 f_files;
  2462. + __u64 f_ffree;
  2463. + __kernel_fsid_t f_fsid;
  2464. + __u32 f_namelen;
  2465. + __u32 f_frsize;
  2466. + __u32 f_spare[5];
  2467. +};
  2468. +
  2469. +#endif
  2470. --- linux/include/asm-generic/termios.h
  2471. +++ linux/include/asm-generic/termios.h
  2472. @@ -0,0 +1,69 @@
  2473. +/* termios.h: generic termios/termio user copying/translation
  2474. + */
  2475. +
  2476. +#ifndef _ASM_GENERIC_TERMIOS_H
  2477. +#define _ASM_GENERIC_TERMIOS_H
  2478. +
  2479. +#include <asm/uaccess.h>
  2480. +
  2481. +#ifndef __ARCH_TERMIO_GETPUT
  2482. +
  2483. +/*
  2484. + * Translate a "termio" structure into a "termios". Ugh.
  2485. + */
  2486. +static inline int user_termio_to_kernel_termios(struct termios *termios,
  2487. + struct termio __user *termio)
  2488. +{
  2489. + unsigned short tmp;
  2490. +
  2491. + if (get_user(tmp, &termio->c_iflag) < 0)
  2492. + goto fault;
  2493. + termios->c_iflag = (0xffff0000 & termios->c_iflag) | tmp;
  2494. +
  2495. + if (get_user(tmp, &termio->c_oflag) < 0)
  2496. + goto fault;
  2497. + termios->c_oflag = (0xffff0000 & termios->c_oflag) | tmp;
  2498. +
  2499. + if (get_user(tmp, &termio->c_cflag) < 0)
  2500. + goto fault;
  2501. + termios->c_cflag = (0xffff0000 & termios->c_cflag) | tmp;
  2502. +
  2503. + if (get_user(tmp, &termio->c_lflag) < 0)
  2504. + goto fault;
  2505. + termios->c_lflag = (0xffff0000 & termios->c_lflag) | tmp;
  2506. +
  2507. + if (get_user(termios->c_line, &termio->c_line) < 0)
  2508. + goto fault;
  2509. +
  2510. + if (copy_from_user(termios->c_cc, termio->c_cc, NCC) != 0)
  2511. + goto fault;
  2512. +
  2513. + return 0;
  2514. +
  2515. + fault:
  2516. + return -EFAULT;
  2517. +}
  2518. +
  2519. +/*
  2520. + * Translate a "termios" structure into a "termio". Ugh.
  2521. + */
  2522. +static inline int kernel_termios_to_user_termio(struct termio __user *termio,
  2523. + struct termios *termios)
  2524. +{
  2525. + if (put_user(termios->c_iflag, &termio->c_iflag) < 0 ||
  2526. + put_user(termios->c_oflag, &termio->c_oflag) < 0 ||
  2527. + put_user(termios->c_cflag, &termio->c_cflag) < 0 ||
  2528. + put_user(termios->c_lflag, &termio->c_lflag) < 0 ||
  2529. + put_user(termios->c_line, &termio->c_line) < 0 ||
  2530. + copy_to_user(termio->c_cc, termios->c_cc, NCC) != 0)
  2531. + return -EFAULT;
  2532. +
  2533. + return 0;
  2534. +}
  2535. +
  2536. +#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
  2537. +#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
  2538. +
  2539. +#endif /* __ARCH_TERMIO_GETPUT */
  2540. +
  2541. +#endif /* _ASM_GENERIC_TERMIOS_H */
  2542. --- linux/include/asm-generic/tlb.h
  2543. +++ linux/include/asm-generic/tlb.h
  2544. @@ -0,0 +1,160 @@
  2545. +/* asm-generic/tlb.h
  2546. + *
  2547. + * Generic TLB shootdown code
  2548. + *
  2549. + * Copyright 2001 Red Hat, Inc.
  2550. + * Based on code from mm/memory.c Copyright Linus Torvalds and others.
  2551. + *
  2552. + * This program is free software; you can redistribute it and/or
  2553. + * modify it under the terms of the GNU General Public License
  2554. + * as published by the Free Software Foundation; either version
  2555. + * 2 of the License, or (at your option) any later version.
  2556. + */
  2557. +#ifndef _ASM_GENERIC__TLB_H
  2558. +#define _ASM_GENERIC__TLB_H
  2559. +
  2560. +// #include <linux/config.h>
  2561. +#include <linux/swap.h>
  2562. +#include <asm/pgalloc.h>
  2563. +#include <asm/tlbflush.h>
  2564. +
  2565. +/*
  2566. + * For UP we don't need to worry about TLB flush
  2567. + * and page free order so much..
  2568. + */
  2569. +#ifdef CONFIG_SMP
  2570. + #define FREE_PTE_NR 506
  2571. + #define tlb_fast_mode(tlb) ((tlb)->nr == ~0U)
  2572. +#else
  2573. + #define FREE_PTE_NR 1
  2574. + #define tlb_fast_mode(tlb) 1
  2575. +#endif
  2576. +
  2577. +/* struct mmu_gather is an opaque type used by the mm code for passing around
  2578. + * any data needed by arch specific code for tlb_remove_page. This structure
  2579. + * can be per-CPU or per-MM as the page table lock is held for the duration of
  2580. + * TLB shootdown.
  2581. + */
  2582. +struct mmu_gather {
  2583. + struct mm_struct *mm;
  2584. + unsigned int nr; /* set to ~0U means fast mode */
  2585. + unsigned int need_flush;/* Really unmapped some ptes? */
  2586. + unsigned int fullmm; /* non-zero means full mm flush */
  2587. + unsigned long freed;
  2588. + struct page * pages[FREE_PTE_NR];
  2589. +};
  2590. +
  2591. +/* Users of the generic TLB shootdown code must declare this storage space. */
  2592. +DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
  2593. +
  2594. +/* tlb_gather_mmu
  2595. + * Return a pointer to an initialized struct mmu_gather.
  2596. + */
  2597. +static inline struct mmu_gather *
  2598. +tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
  2599. +{
  2600. + struct mmu_gather *tlb = &per_cpu(mmu_gathers, smp_processor_id());
  2601. +
  2602. + tlb->mm = mm;
  2603. +
  2604. + /* Use fast mode if only one CPU is online */
  2605. + tlb->nr = num_online_cpus() > 1 ? 0U : ~0U;
  2606. +
  2607. + tlb->fullmm = full_mm_flush;
  2608. + tlb->freed = 0;
  2609. +
  2610. + return tlb;
  2611. +}
  2612. +
  2613. +static inline void
  2614. +tlb_flush_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
  2615. +{
  2616. + if (!tlb->need_flush)
  2617. + return;
  2618. + tlb->need_flush = 0;
  2619. + tlb_flush(tlb);
  2620. + if (!tlb_fast_mode(tlb)) {
  2621. + free_pages_and_swap_cache(tlb->pages, tlb->nr);
  2622. + tlb->nr = 0;
  2623. + }
  2624. +}
  2625. +
  2626. +/* tlb_finish_mmu
  2627. + * Called at the end of the shootdown operation to free up any resources
  2628. + * that were required. The page table lock is still held at this point.
  2629. + */
  2630. +static inline void
  2631. +tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
  2632. +{
  2633. + int freed = tlb->freed;
  2634. + struct mm_struct *mm = tlb->mm;
  2635. + int rss = mm->rss;
  2636. +
  2637. + if (rss < freed)
  2638. + freed = rss;
  2639. + mm->rss = rss - freed;
  2640. + tlb_flush_mmu(tlb, start, end);
  2641. +
  2642. + /* keep the page table cache within bounds */
  2643. + check_pgt_cache();
  2644. +}
  2645. +
  2646. +static inline unsigned int
  2647. +tlb_is_full_mm(struct mmu_gather *tlb)
  2648. +{
  2649. + return tlb->fullmm;
  2650. +}
  2651. +
  2652. +/* tlb_remove_page
  2653. + * Must perform the equivalent to __free_pte(pte_get_and_clear(ptep)), while
  2654. + * handling the additional races in SMP caused by other CPUs caching valid
  2655. + * mappings in their TLBs.
  2656. + */
  2657. +static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
  2658. +{
  2659. + tlb->need_flush = 1;
  2660. + if (tlb_fast_mode(tlb)) {
  2661. + free_page_and_swap_cache(page);
  2662. + return;
  2663. + }
  2664. + tlb->pages[tlb->nr++] = page;
  2665. + if (tlb->nr >= FREE_PTE_NR)
  2666. + tlb_flush_mmu(tlb, 0, 0);
  2667. +}
  2668. +
  2669. +/**
  2670. + * tlb_remove_tlb_entry - remember a pte unmapping for later tlb invalidation.
  2671. + *
  2672. + * Record the fact that pte's were really umapped in ->need_flush, so we can
  2673. + * later optimise away the tlb invalidate. This helps when userspace is
  2674. + * unmapping already-unmapped pages, which happens quite a lot.
  2675. + */
  2676. +#define tlb_remove_tlb_entry(tlb, ptep, address) \
  2677. + do { \
  2678. + tlb->need_flush = 1; \
  2679. + __tlb_remove_tlb_entry(tlb, ptep, address); \
  2680. + } while (0)
  2681. +
  2682. +#define pte_free_tlb(tlb, ptep) \
  2683. + do { \
  2684. + tlb->need_flush = 1; \
  2685. + __pte_free_tlb(tlb, ptep); \
  2686. + } while (0)
  2687. +
  2688. +#ifndef __ARCH_HAS_4LEVEL_HACK
  2689. +#define pud_free_tlb(tlb, pudp) \
  2690. + do { \
  2691. + tlb->need_flush = 1; \
  2692. + __pud_free_tlb(tlb, pudp); \
  2693. + } while (0)
  2694. +#endif
  2695. +
  2696. +#define pmd_free_tlb(tlb, pmdp) \
  2697. + do { \
  2698. + tlb->need_flush = 1; \
  2699. + __pmd_free_tlb(tlb, pmdp); \
  2700. + } while (0)
  2701. +
  2702. +#define tlb_migrate_finish(mm) do {} while (0)
  2703. +
  2704. +#endif /* _ASM_GENERIC__TLB_H */
  2705. --- linux/include/asm-generic/topology.h
  2706. +++ linux/include/asm-generic/topology.h
  2707. @@ -0,0 +1,48 @@
  2708. +/*
  2709. + * linux/include/asm-generic/topology.h
  2710. + *
  2711. + * Written by: Matthew Dobson, IBM Corporation
  2712. + *
  2713. + * Copyright (C) 2002, IBM Corp.
  2714. + *
  2715. + * All rights reserved.
  2716. + *
  2717. + * This program is free software; you can redistribute it and/or modify
  2718. + * it under the terms of the GNU General Public License as published by
  2719. + * the Free Software Foundation; either version 2 of the License, or
  2720. + * (at your option) any later version.
  2721. + *
  2722. + * This program is distributed in the hope that it will be useful, but
  2723. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  2724. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  2725. + * NON INFRINGEMENT. See the GNU General Public License for more
  2726. + * details.
  2727. + *
  2728. + * You should have received a copy of the GNU General Public License
  2729. + * along with this program; if not, write to the Free Software
  2730. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2731. + *
  2732. + * Send feedback to <colpatch@us.ibm.com>
  2733. + */
  2734. +#ifndef _ASM_GENERIC_TOPOLOGY_H
  2735. +#define _ASM_GENERIC_TOPOLOGY_H
  2736. +
  2737. +/* Other architectures wishing to use this simple topology API should fill
  2738. + in the below functions as appropriate in their own <asm/topology.h> file. */
  2739. +#ifndef cpu_to_node
  2740. +#define cpu_to_node(cpu) (0)
  2741. +#endif
  2742. +#ifndef parent_node
  2743. +#define parent_node(node) (0)
  2744. +#endif
  2745. +#ifndef node_to_cpumask
  2746. +#define node_to_cpumask(node) (cpu_online_map)
  2747. +#endif
  2748. +#ifndef node_to_first_cpu
  2749. +#define node_to_first_cpu(node) (0)
  2750. +#endif
  2751. +#ifndef pcibus_to_cpumask
  2752. +#define pcibus_to_cpumask(bus) (cpu_online_map)
  2753. +#endif
  2754. +
  2755. +#endif /* _ASM_GENERIC_TOPOLOGY_H */
  2756. --- linux/include/asm-generic/uaccess.h
  2757. +++ linux/include/asm-generic/uaccess.h
  2758. @@ -0,0 +1,26 @@
  2759. +#ifndef _ASM_GENERIC_UACCESS_H_
  2760. +#define _ASM_GENERIC_UACCESS_H_
  2761. +
  2762. +/*
  2763. + * This macro should be used instead of __get_user() when accessing
  2764. + * values at locations that are not known to be aligned.
  2765. + */
  2766. +#define __get_user_unaligned(x, ptr) \
  2767. +({ \
  2768. + __typeof__ (*(ptr)) __x; \
  2769. + __copy_from_user(&__x, (ptr), sizeof(*(ptr))) ? -EFAULT : 0; \
  2770. + (x) = __x; \
  2771. +})
  2772. +
  2773. +
  2774. +/*
  2775. + * This macro should be used instead of __put_user() when accessing
  2776. + * values at locations that are not known to be aligned.
  2777. + */
  2778. +#define __put_user_unaligned(x, ptr) \
  2779. +({ \
  2780. + __typeof__ (*(ptr)) __x = (x); \
  2781. + __copy_to_user((ptr), &__x, sizeof(*(ptr))) ? -EFAULT : 0; \
  2782. +})
  2783. +
  2784. +#endif /* _ASM_GENERIC_UACCESS_H */
  2785. --- linux/include/asm-generic/unaligned.h
  2786. +++ linux/include/asm-generic/unaligned.h
  2787. @@ -0,0 +1,20 @@
  2788. +#ifndef _ASM_GENERIC_UNALIGNED_H_
  2789. +#define _ASM_GENERIC_UNALIGNED_H_
  2790. +
  2791. +/*
  2792. + * For the benefit of those who are trying to port Linux to another
  2793. + * architecture, here are some C-language equivalents.
  2794. + */
  2795. +
  2796. +#include <asm/string.h>
  2797. +
  2798. +
  2799. +#define get_unaligned(ptr) \
  2800. + ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
  2801. +
  2802. +#define put_unaligned(val, ptr) \
  2803. + ({ __typeof__(*(ptr)) __tmp = (val); \
  2804. + memcpy((ptr), &__tmp, sizeof(*(ptr))); \
  2805. + (void)0; })
  2806. +
  2807. +#endif /* _ASM_GENERIC_UNALIGNED_H */
  2808. --- linux/include/asm-generic/vmlinux.lds.h
  2809. +++ linux/include/asm-generic/vmlinux.lds.h
  2810. @@ -0,0 +1,90 @@
  2811. +#ifndef LOAD_OFFSET
  2812. +#define LOAD_OFFSET 0
  2813. +#endif
  2814. +
  2815. +#ifndef VMLINUX_SYMBOL
  2816. +#define VMLINUX_SYMBOL(_sym_) _sym_
  2817. +#endif
  2818. +
  2819. +#define RODATA \
  2820. + .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
  2821. + *(.rodata) *(.rodata.*) \
  2822. + *(__vermagic) /* Kernel version magic */ \
  2823. + } \
  2824. + \
  2825. + .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
  2826. + *(.rodata1) \
  2827. + } \
  2828. + \
  2829. + /* PCI quirks */ \
  2830. + .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
  2831. + VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
  2832. + *(.pci_fixup_early) \
  2833. + VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
  2834. + VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
  2835. + *(.pci_fixup_header) \
  2836. + VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
  2837. + VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
  2838. + *(.pci_fixup_final) \
  2839. + VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
  2840. + VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
  2841. + *(.pci_fixup_enable) \
  2842. + VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
  2843. + } \
  2844. + \
  2845. + /* Kernel symbol table: Normal symbols */ \
  2846. + __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
  2847. + VMLINUX_SYMBOL(__start___ksymtab) = .; \
  2848. + *(__ksymtab) \
  2849. + VMLINUX_SYMBOL(__stop___ksymtab) = .; \
  2850. + } \
  2851. + \
  2852. + /* Kernel symbol table: GPL-only symbols */ \
  2853. + __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
  2854. + VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
  2855. + *(__ksymtab_gpl) \
  2856. + VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
  2857. + } \
  2858. + \
  2859. + /* Kernel symbol table: Normal symbols */ \
  2860. + __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
  2861. + VMLINUX_SYMBOL(__start___kcrctab) = .; \
  2862. + *(__kcrctab) \
  2863. + VMLINUX_SYMBOL(__stop___kcrctab) = .; \
  2864. + } \
  2865. + \
  2866. + /* Kernel symbol table: GPL-only symbols */ \
  2867. + __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
  2868. + VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
  2869. + *(__kcrctab_gpl) \
  2870. + VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
  2871. + } \
  2872. + \
  2873. + /* Kernel symbol table: strings */ \
  2874. + __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
  2875. + *(__ksymtab_strings) \
  2876. + } \
  2877. + \
  2878. + /* Built-in module parameters. */ \
  2879. + __param : AT(ADDR(__param) - LOAD_OFFSET) { \
  2880. + VMLINUX_SYMBOL(__start___param) = .; \
  2881. + *(__param) \
  2882. + VMLINUX_SYMBOL(__stop___param) = .; \
  2883. + }
  2884. +
  2885. +#define SECURITY_INIT \
  2886. + .security_initcall.init : { \
  2887. + VMLINUX_SYMBOL(__security_initcall_start) = .; \
  2888. + *(.security_initcall.init) \
  2889. + VMLINUX_SYMBOL(__security_initcall_end) = .; \
  2890. + }
  2891. +
  2892. +#define SCHED_TEXT \
  2893. + VMLINUX_SYMBOL(__sched_text_start) = .; \
  2894. + *(.sched.text) \
  2895. + VMLINUX_SYMBOL(__sched_text_end) = .;
  2896. +
  2897. +#define LOCK_TEXT \
  2898. + VMLINUX_SYMBOL(__lock_text_start) = .; \
  2899. + *(.spinlock.text) \
  2900. + VMLINUX_SYMBOL(__lock_text_end) = .;
  2901. --- linux/include/asm-generic/xor.h
  2902. +++ linux/include/asm-generic/xor.h
  2903. @@ -0,0 +1,718 @@
  2904. +/*
  2905. + * include/asm-generic/xor.h
  2906. + *
  2907. + * Generic optimized RAID-5 checksumming functions.
  2908. + *
  2909. + * This program is free software; you can redistribute it and/or modify
  2910. + * it under the terms of the GNU General Public License as published by
  2911. + * the Free Software Foundation; either version 2, or (at your option)
  2912. + * any later version.
  2913. + *
  2914. + * You should have received a copy of the GNU General Public License
  2915. + * (for example /usr/src/linux/COPYING); if not, write to the Free
  2916. + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2917. + */
  2918. +
  2919. +#include <asm/processor.h>
  2920. +
  2921. +static void
  2922. +xor_8regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  2923. +{
  2924. + long lines = bytes / (sizeof (long)) / 8;
  2925. +
  2926. + do {
  2927. + p1[0] ^= p2[0];
  2928. + p1[1] ^= p2[1];
  2929. + p1[2] ^= p2[2];
  2930. + p1[3] ^= p2[3];
  2931. + p1[4] ^= p2[4];
  2932. + p1[5] ^= p2[5];
  2933. + p1[6] ^= p2[6];
  2934. + p1[7] ^= p2[7];
  2935. + p1 += 8;
  2936. + p2 += 8;
  2937. + } while (--lines > 0);
  2938. +}
  2939. +
  2940. +static void
  2941. +xor_8regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2942. + unsigned long *p3)
  2943. +{
  2944. + long lines = bytes / (sizeof (long)) / 8;
  2945. +
  2946. + do {
  2947. + p1[0] ^= p2[0] ^ p3[0];
  2948. + p1[1] ^= p2[1] ^ p3[1];
  2949. + p1[2] ^= p2[2] ^ p3[2];
  2950. + p1[3] ^= p2[3] ^ p3[3];
  2951. + p1[4] ^= p2[4] ^ p3[4];
  2952. + p1[5] ^= p2[5] ^ p3[5];
  2953. + p1[6] ^= p2[6] ^ p3[6];
  2954. + p1[7] ^= p2[7] ^ p3[7];
  2955. + p1 += 8;
  2956. + p2 += 8;
  2957. + p3 += 8;
  2958. + } while (--lines > 0);
  2959. +}
  2960. +
  2961. +static void
  2962. +xor_8regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2963. + unsigned long *p3, unsigned long *p4)
  2964. +{
  2965. + long lines = bytes / (sizeof (long)) / 8;
  2966. +
  2967. + do {
  2968. + p1[0] ^= p2[0] ^ p3[0] ^ p4[0];
  2969. + p1[1] ^= p2[1] ^ p3[1] ^ p4[1];
  2970. + p1[2] ^= p2[2] ^ p3[2] ^ p4[2];
  2971. + p1[3] ^= p2[3] ^ p3[3] ^ p4[3];
  2972. + p1[4] ^= p2[4] ^ p3[4] ^ p4[4];
  2973. + p1[5] ^= p2[5] ^ p3[5] ^ p4[5];
  2974. + p1[6] ^= p2[6] ^ p3[6] ^ p4[6];
  2975. + p1[7] ^= p2[7] ^ p3[7] ^ p4[7];
  2976. + p1 += 8;
  2977. + p2 += 8;
  2978. + p3 += 8;
  2979. + p4 += 8;
  2980. + } while (--lines > 0);
  2981. +}
  2982. +
  2983. +static void
  2984. +xor_8regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2985. + unsigned long *p3, unsigned long *p4, unsigned long *p5)
  2986. +{
  2987. + long lines = bytes / (sizeof (long)) / 8;
  2988. +
  2989. + do {
  2990. + p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0];
  2991. + p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1];
  2992. + p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2];
  2993. + p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3];
  2994. + p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4];
  2995. + p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5];
  2996. + p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6];
  2997. + p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7];
  2998. + p1 += 8;
  2999. + p2 += 8;
  3000. + p3 += 8;
  3001. + p4 += 8;
  3002. + p5 += 8;
  3003. + } while (--lines > 0);
  3004. +}
  3005. +
  3006. +static void
  3007. +xor_32regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  3008. +{
  3009. + long lines = bytes / (sizeof (long)) / 8;
  3010. +
  3011. + do {
  3012. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  3013. + d0 = p1[0]; /* Pull the stuff into registers */
  3014. + d1 = p1[1]; /* ... in bursts, if possible. */
  3015. + d2 = p1[2];
  3016. + d3 = p1[3];
  3017. + d4 = p1[4];
  3018. + d5 = p1[5];
  3019. + d6 = p1[6];
  3020. + d7 = p1[7];
  3021. + d0 ^= p2[0];
  3022. + d1 ^= p2[1];
  3023. + d2 ^= p2[2];
  3024. + d3 ^= p2[3];
  3025. + d4 ^= p2[4];
  3026. + d5 ^= p2[5];
  3027. + d6 ^= p2[6];
  3028. + d7 ^= p2[7];
  3029. + p1[0] = d0; /* Store the result (in bursts) */
  3030. + p1[1] = d1;
  3031. + p1[2] = d2;
  3032. + p1[3] = d3;
  3033. + p1[4] = d4;
  3034. + p1[5] = d5;
  3035. + p1[6] = d6;
  3036. + p1[7] = d7;
  3037. + p1 += 8;
  3038. + p2 += 8;
  3039. + } while (--lines > 0);
  3040. +}
  3041. +
  3042. +static void
  3043. +xor_32regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3044. + unsigned long *p3)
  3045. +{
  3046. + long lines = bytes / (sizeof (long)) / 8;
  3047. +
  3048. + do {
  3049. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  3050. + d0 = p1[0]; /* Pull the stuff into registers */
  3051. + d1 = p1[1]; /* ... in bursts, if possible. */
  3052. + d2 = p1[2];
  3053. + d3 = p1[3];
  3054. + d4 = p1[4];
  3055. + d5 = p1[5];
  3056. + d6 = p1[6];
  3057. + d7 = p1[7];
  3058. + d0 ^= p2[0];
  3059. + d1 ^= p2[1];
  3060. + d2 ^= p2[2];
  3061. + d3 ^= p2[3];
  3062. + d4 ^= p2[4];
  3063. + d5 ^= p2[5];
  3064. + d6 ^= p2[6];
  3065. + d7 ^= p2[7];
  3066. + d0 ^= p3[0];
  3067. + d1 ^= p3[1];
  3068. + d2 ^= p3[2];
  3069. + d3 ^= p3[3];
  3070. + d4 ^= p3[4];
  3071. + d5 ^= p3[5];
  3072. + d6 ^= p3[6];
  3073. + d7 ^= p3[7];
  3074. + p1[0] = d0; /* Store the result (in bursts) */
  3075. + p1[1] = d1;
  3076. + p1[2] = d2;
  3077. + p1[3] = d3;
  3078. + p1[4] = d4;
  3079. + p1[5] = d5;
  3080. + p1[6] = d6;
  3081. + p1[7] = d7;
  3082. + p1 += 8;
  3083. + p2 += 8;
  3084. + p3 += 8;
  3085. + } while (--lines > 0);
  3086. +}
  3087. +
  3088. +static void
  3089. +xor_32regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3090. + unsigned long *p3, unsigned long *p4)
  3091. +{
  3092. + long lines = bytes / (sizeof (long)) / 8;
  3093. +
  3094. + do {
  3095. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  3096. + d0 = p1[0]; /* Pull the stuff into registers */
  3097. + d1 = p1[1]; /* ... in bursts, if possible. */
  3098. + d2 = p1[2];
  3099. + d3 = p1[3];
  3100. + d4 = p1[4];
  3101. + d5 = p1[5];
  3102. + d6 = p1[6];
  3103. + d7 = p1[7];
  3104. + d0 ^= p2[0];
  3105. + d1 ^= p2[1];
  3106. + d2 ^= p2[2];
  3107. + d3 ^= p2[3];
  3108. + d4 ^= p2[4];
  3109. + d5 ^= p2[5];
  3110. + d6 ^= p2[6];
  3111. + d7 ^= p2[7];
  3112. + d0 ^= p3[0];
  3113. + d1 ^= p3[1];
  3114. + d2 ^= p3[2];
  3115. + d3 ^= p3[3];
  3116. + d4 ^= p3[4];
  3117. + d5 ^= p3[5];
  3118. + d6 ^= p3[6];
  3119. + d7 ^= p3[7];
  3120. + d0 ^= p4[0];
  3121. + d1 ^= p4[1];
  3122. + d2 ^= p4[2];
  3123. + d3 ^= p4[3];
  3124. + d4 ^= p4[4];
  3125. + d5 ^= p4[5];
  3126. + d6 ^= p4[6];
  3127. + d7 ^= p4[7];
  3128. + p1[0] = d0; /* Store the result (in bursts) */
  3129. + p1[1] = d1;
  3130. + p1[2] = d2;
  3131. + p1[3] = d3;
  3132. + p1[4] = d4;
  3133. + p1[5] = d5;
  3134. + p1[6] = d6;
  3135. + p1[7] = d7;
  3136. + p1 += 8;
  3137. + p2 += 8;
  3138. + p3 += 8;
  3139. + p4 += 8;
  3140. + } while (--lines > 0);
  3141. +}
  3142. +
  3143. +static void
  3144. +xor_32regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3145. + unsigned long *p3, unsigned long *p4, unsigned long *p5)
  3146. +{
  3147. + long lines = bytes / (sizeof (long)) / 8;
  3148. +
  3149. + do {
  3150. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  3151. + d0 = p1[0]; /* Pull the stuff into registers */
  3152. + d1 = p1[1]; /* ... in bursts, if possible. */
  3153. + d2 = p1[2];
  3154. + d3 = p1[3];
  3155. + d4 = p1[4];
  3156. + d5 = p1[5];
  3157. + d6 = p1[6];
  3158. + d7 = p1[7];
  3159. + d0 ^= p2[0];
  3160. + d1 ^= p2[1];
  3161. + d2 ^= p2[2];
  3162. + d3 ^= p2[3];
  3163. + d4 ^= p2[4];
  3164. + d5 ^= p2[5];
  3165. + d6 ^= p2[6];
  3166. + d7 ^= p2[7];
  3167. + d0 ^= p3[0];
  3168. + d1 ^= p3[1];
  3169. + d2 ^= p3[2];
  3170. + d3 ^= p3[3];
  3171. + d4 ^= p3[4];
  3172. + d5 ^= p3[5];
  3173. + d6 ^= p3[6];
  3174. + d7 ^= p3[7];
  3175. + d0 ^= p4[0];
  3176. + d1 ^= p4[1];
  3177. + d2 ^= p4[2];
  3178. + d3 ^= p4[3];
  3179. + d4 ^= p4[4];
  3180. + d5 ^= p4[5];
  3181. + d6 ^= p4[6];
  3182. + d7 ^= p4[7];
  3183. + d0 ^= p5[0];
  3184. + d1 ^= p5[1];
  3185. + d2 ^= p5[2];
  3186. + d3 ^= p5[3];
  3187. + d4 ^= p5[4];
  3188. + d5 ^= p5[5];
  3189. + d6 ^= p5[6];
  3190. + d7 ^= p5[7];
  3191. + p1[0] = d0; /* Store the result (in bursts) */
  3192. + p1[1] = d1;
  3193. + p1[2] = d2;
  3194. + p1[3] = d3;
  3195. + p1[4] = d4;
  3196. + p1[5] = d5;
  3197. + p1[6] = d6;
  3198. + p1[7] = d7;
  3199. + p1 += 8;
  3200. + p2 += 8;
  3201. + p3 += 8;
  3202. + p4 += 8;
  3203. + p5 += 8;
  3204. + } while (--lines > 0);
  3205. +}
  3206. +
  3207. +static void
  3208. +xor_8regs_p_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  3209. +{
  3210. + long lines = bytes / (sizeof (long)) / 8 - 1;
  3211. + prefetchw(p1);
  3212. + prefetch(p2);
  3213. +
  3214. + do {
  3215. + prefetchw(p1+8);
  3216. + prefetch(p2+8);
  3217. + once_more:
  3218. + p1[0] ^= p2[0];
  3219. + p1[1] ^= p2[1];
  3220. + p1[2] ^= p2[2];
  3221. + p1[3] ^= p2[3];
  3222. + p1[4] ^= p2[4];
  3223. + p1[5] ^= p2[5];
  3224. + p1[6] ^= p2[6];
  3225. + p1[7] ^= p2[7];
  3226. + p1 += 8;
  3227. + p2 += 8;
  3228. + } while (--lines > 0);
  3229. + if (lines == 0)
  3230. + goto once_more;
  3231. +}
  3232. +
  3233. +static void
  3234. +xor_8regs_p_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3235. + unsigned long *p3)
  3236. +{
  3237. + long lines = bytes / (sizeof (long)) / 8 - 1;
  3238. + prefetchw(p1);
  3239. + prefetch(p2);
  3240. + prefetch(p3);
  3241. +
  3242. + do {
  3243. + prefetchw(p1+8);
  3244. + prefetch(p2+8);
  3245. + prefetch(p3+8);
  3246. + once_more:
  3247. + p1[0] ^= p2[0] ^ p3[0];
  3248. + p1[1] ^= p2[1] ^ p3[1];
  3249. + p1[2] ^= p2[2] ^ p3[2];
  3250. + p1[3] ^= p2[3] ^ p3[3];
  3251. + p1[4] ^= p2[4] ^ p3[4];
  3252. + p1[5] ^= p2[5] ^ p3[5];
  3253. + p1[6] ^= p2[6] ^ p3[6];
  3254. + p1[7] ^= p2[7] ^ p3[7];
  3255. + p1 += 8;
  3256. + p2 += 8;
  3257. + p3 += 8;
  3258. + } while (--lines > 0);
  3259. + if (lines == 0)
  3260. + goto once_more;
  3261. +}
  3262. +
  3263. +static void
  3264. +xor_8regs_p_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3265. + unsigned long *p3, unsigned long *p4)
  3266. +{
  3267. + long lines = bytes / (sizeof (long)) / 8 - 1;
  3268. +
  3269. + prefetchw(p1);
  3270. + prefetch(p2);
  3271. + prefetch(p3);
  3272. + prefetch(p4);
  3273. +
  3274. + do {
  3275. + prefetchw(p1+8);
  3276. + prefetch(p2+8);
  3277. + prefetch(p3+8);
  3278. + prefetch(p4+8);
  3279. + once_more:
  3280. + p1[0] ^= p2[0] ^ p3[0] ^ p4[0];
  3281. + p1[1] ^= p2[1] ^ p3[1] ^ p4[1];
  3282. + p1[2] ^= p2[2] ^ p3[2] ^ p4[2];
  3283. + p1[3] ^= p2[3] ^ p3[3] ^ p4[3];
  3284. + p1[4] ^= p2[4] ^ p3[4] ^ p4[4];
  3285. + p1[5] ^= p2[5] ^ p3[5] ^ p4[5];
  3286. + p1[6] ^= p2[6] ^ p3[6] ^ p4[6];
  3287. + p1[7] ^= p2[7] ^ p3[7] ^ p4[7];
  3288. + p1 += 8;
  3289. + p2 += 8;
  3290. + p3 += 8;
  3291. + p4 += 8;
  3292. + } while (--lines > 0);
  3293. + if (lines == 0)
  3294. + goto once_more;
  3295. +}
  3296. +
  3297. +static void
  3298. +xor_8regs_p_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3299. + unsigned long *p3, unsigned long *p4, unsigned long *p5)
  3300. +{
  3301. + long lines = bytes / (sizeof (long)) / 8 - 1;
  3302. +
  3303. + prefetchw(p1);
  3304. + prefetch(p2);
  3305. + prefetch(p3);
  3306. + prefetch(p4);
  3307. + prefetch(p5);
  3308. +
  3309. + do {
  3310. + prefetchw(p1+8);
  3311. + prefetch(p2+8);
  3312. + prefetch(p3+8);
  3313. + prefetch(p4+8);
  3314. + prefetch(p5+8);
  3315. + once_more:
  3316. + p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0];
  3317. + p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1];
  3318. + p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2];
  3319. + p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3];
  3320. + p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4];
  3321. + p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5];
  3322. + p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6];
  3323. + p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7];
  3324. + p1 += 8;
  3325. + p2 += 8;
  3326. + p3 += 8;
  3327. + p4 += 8;
  3328. + p5 += 8;
  3329. + } while (--lines > 0);
  3330. + if (lines == 0)
  3331. + goto once_more;
  3332. +}
  3333. +
  3334. +static void
  3335. +xor_32regs_p_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  3336. +{
  3337. + long lines = bytes / (sizeof (long)) / 8 - 1;
  3338. +
  3339. + prefetchw(p1);
  3340. + prefetch(p2);
  3341. +
  3342. + do {
  3343. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  3344. +
  3345. + prefetchw(p1+8);
  3346. + prefetch(p2+8);
  3347. + once_more:
  3348. + d0 = p1[0]; /* Pull the stuff into registers */
  3349. + d1 = p1[1]; /* ... in bursts, if possible. */
  3350. + d2 = p1[2];
  3351. + d3 = p1[3];
  3352. + d4 = p1[4];
  3353. + d5 = p1[5];
  3354. + d6 = p1[6];
  3355. + d7 = p1[7];
  3356. + d0 ^= p2[0];
  3357. + d1 ^= p2[1];
  3358. + d2 ^= p2[2];
  3359. + d3 ^= p2[3];
  3360. + d4 ^= p2[4];
  3361. + d5 ^= p2[5];
  3362. + d6 ^= p2[6];
  3363. + d7 ^= p2[7];
  3364. + p1[0] = d0; /* Store the result (in bursts) */
  3365. + p1[1] = d1;
  3366. + p1[2] = d2;
  3367. + p1[3] = d3;
  3368. + p1[4] = d4;
  3369. + p1[5] = d5;
  3370. + p1[6] = d6;
  3371. + p1[7] = d7;
  3372. + p1 += 8;
  3373. + p2 += 8;
  3374. + } while (--lines > 0);
  3375. + if (lines == 0)
  3376. + goto once_more;
  3377. +}
  3378. +
  3379. +static void
  3380. +xor_32regs_p_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3381. + unsigned long *p3)
  3382. +{
  3383. + long lines = bytes / (sizeof (long)) / 8 - 1;
  3384. +
  3385. + prefetchw(p1);
  3386. + prefetch(p2);
  3387. + prefetch(p3);
  3388. +
  3389. + do {
  3390. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  3391. +
  3392. + prefetchw(p1+8);
  3393. + prefetch(p2+8);
  3394. + prefetch(p3+8);
  3395. + once_more:
  3396. + d0 = p1[0]; /* Pull the stuff into registers */
  3397. + d1 = p1[1]; /* ... in bursts, if possible. */
  3398. + d2 = p1[2];
  3399. + d3 = p1[3];
  3400. + d4 = p1[4];
  3401. + d5 = p1[5];
  3402. + d6 = p1[6];
  3403. + d7 = p1[7];
  3404. + d0 ^= p2[0];
  3405. + d1 ^= p2[1];
  3406. + d2 ^= p2[2];
  3407. + d3 ^= p2[3];
  3408. + d4 ^= p2[4];
  3409. + d5 ^= p2[5];
  3410. + d6 ^= p2[6];
  3411. + d7 ^= p2[7];
  3412. + d0 ^= p3[0];
  3413. + d1 ^= p3[1];
  3414. + d2 ^= p3[2];
  3415. + d3 ^= p3[3];
  3416. + d4 ^= p3[4];
  3417. + d5 ^= p3[5];
  3418. + d6 ^= p3[6];
  3419. + d7 ^= p3[7];
  3420. + p1[0] = d0; /* Store the result (in bursts) */
  3421. + p1[1] = d1;
  3422. + p1[2] = d2;
  3423. + p1[3] = d3;
  3424. + p1[4] = d4;
  3425. + p1[5] = d5;
  3426. + p1[6] = d6;
  3427. + p1[7] = d7;
  3428. + p1 += 8;
  3429. + p2 += 8;
  3430. + p3 += 8;
  3431. + } while (--lines > 0);
  3432. + if (lines == 0)
  3433. + goto once_more;
  3434. +}
  3435. +
  3436. +static void
  3437. +xor_32regs_p_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3438. + unsigned long *p3, unsigned long *p4)
  3439. +{
  3440. + long lines = bytes / (sizeof (long)) / 8 - 1;
  3441. +
  3442. + prefetchw(p1);
  3443. + prefetch(p2);
  3444. + prefetch(p3);
  3445. + prefetch(p4);
  3446. +
  3447. + do {
  3448. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  3449. +
  3450. + prefetchw(p1+8);
  3451. + prefetch(p2+8);
  3452. + prefetch(p3+8);
  3453. + prefetch(p4+8);
  3454. + once_more:
  3455. + d0 = p1[0]; /* Pull the stuff into registers */
  3456. + d1 = p1[1]; /* ... in bursts, if possible. */
  3457. + d2 = p1[2];
  3458. + d3 = p1[3];
  3459. + d4 = p1[4];
  3460. + d5 = p1[5];
  3461. + d6 = p1[6];
  3462. + d7 = p1[7];
  3463. + d0 ^= p2[0];
  3464. + d1 ^= p2[1];
  3465. + d2 ^= p2[2];
  3466. + d3 ^= p2[3];
  3467. + d4 ^= p2[4];
  3468. + d5 ^= p2[5];
  3469. + d6 ^= p2[6];
  3470. + d7 ^= p2[7];
  3471. + d0 ^= p3[0];
  3472. + d1 ^= p3[1];
  3473. + d2 ^= p3[2];
  3474. + d3 ^= p3[3];
  3475. + d4 ^= p3[4];
  3476. + d5 ^= p3[5];
  3477. + d6 ^= p3[6];
  3478. + d7 ^= p3[7];
  3479. + d0 ^= p4[0];
  3480. + d1 ^= p4[1];
  3481. + d2 ^= p4[2];
  3482. + d3 ^= p4[3];
  3483. + d4 ^= p4[4];
  3484. + d5 ^= p4[5];
  3485. + d6 ^= p4[6];
  3486. + d7 ^= p4[7];
  3487. + p1[0] = d0; /* Store the result (in bursts) */
  3488. + p1[1] = d1;
  3489. + p1[2] = d2;
  3490. + p1[3] = d3;
  3491. + p1[4] = d4;
  3492. + p1[5] = d5;
  3493. + p1[6] = d6;
  3494. + p1[7] = d7;
  3495. + p1 += 8;
  3496. + p2 += 8;
  3497. + p3 += 8;
  3498. + p4 += 8;
  3499. + } while (--lines > 0);
  3500. + if (lines == 0)
  3501. + goto once_more;
  3502. +}
  3503. +
  3504. +static void
  3505. +xor_32regs_p_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3506. + unsigned long *p3, unsigned long *p4, unsigned long *p5)
  3507. +{
  3508. + long lines = bytes / (sizeof (long)) / 8 - 1;
  3509. +
  3510. + prefetchw(p1);
  3511. + prefetch(p2);
  3512. + prefetch(p3);
  3513. + prefetch(p4);
  3514. + prefetch(p5);
  3515. +
  3516. + do {
  3517. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  3518. +
  3519. + prefetchw(p1+8);
  3520. + prefetch(p2+8);
  3521. + prefetch(p3+8);
  3522. + prefetch(p4+8);
  3523. + prefetch(p5+8);
  3524. + once_more:
  3525. + d0 = p1[0]; /* Pull the stuff into registers */
  3526. + d1 = p1[1]; /* ... in bursts, if possible. */
  3527. + d2 = p1[2];
  3528. + d3 = p1[3];
  3529. + d4 = p1[4];
  3530. + d5 = p1[5];
  3531. + d6 = p1[6];
  3532. + d7 = p1[7];
  3533. + d0 ^= p2[0];
  3534. + d1 ^= p2[1];
  3535. + d2 ^= p2[2];
  3536. + d3 ^= p2[3];
  3537. + d4 ^= p2[4];
  3538. + d5 ^= p2[5];
  3539. + d6 ^= p2[6];
  3540. + d7 ^= p2[7];
  3541. + d0 ^= p3[0];
  3542. + d1 ^= p3[1];
  3543. + d2 ^= p3[2];
  3544. + d3 ^= p3[3];
  3545. + d4 ^= p3[4];
  3546. + d5 ^= p3[5];
  3547. + d6 ^= p3[6];
  3548. + d7 ^= p3[7];
  3549. + d0 ^= p4[0];
  3550. + d1 ^= p4[1];
  3551. + d2 ^= p4[2];
  3552. + d3 ^= p4[3];
  3553. + d4 ^= p4[4];
  3554. + d5 ^= p4[5];
  3555. + d6 ^= p4[6];
  3556. + d7 ^= p4[7];
  3557. + d0 ^= p5[0];
  3558. + d1 ^= p5[1];
  3559. + d2 ^= p5[2];
  3560. + d3 ^= p5[3];
  3561. + d4 ^= p5[4];
  3562. + d5 ^= p5[5];
  3563. + d6 ^= p5[6];
  3564. + d7 ^= p5[7];
  3565. + p1[0] = d0; /* Store the result (in bursts) */
  3566. + p1[1] = d1;
  3567. + p1[2] = d2;
  3568. + p1[3] = d3;
  3569. + p1[4] = d4;
  3570. + p1[5] = d5;
  3571. + p1[6] = d6;
  3572. + p1[7] = d7;
  3573. + p1 += 8;
  3574. + p2 += 8;
  3575. + p3 += 8;
  3576. + p4 += 8;
  3577. + p5 += 8;
  3578. + } while (--lines > 0);
  3579. + if (lines == 0)
  3580. + goto once_more;
  3581. +}
  3582. +
  3583. +static struct xor_block_template xor_block_8regs = {
  3584. + .name = "8regs",
  3585. + .do_2 = xor_8regs_2,
  3586. + .do_3 = xor_8regs_3,
  3587. + .do_4 = xor_8regs_4,
  3588. + .do_5 = xor_8regs_5,
  3589. +};
  3590. +
  3591. +static struct xor_block_template xor_block_32regs = {
  3592. + .name = "32regs",
  3593. + .do_2 = xor_32regs_2,
  3594. + .do_3 = xor_32regs_3,
  3595. + .do_4 = xor_32regs_4,
  3596. + .do_5 = xor_32regs_5,
  3597. +};
  3598. +
  3599. +static struct xor_block_template xor_block_8regs_p = {
  3600. + .name = "8regs_prefetch",
  3601. + .do_2 = xor_8regs_p_2,
  3602. + .do_3 = xor_8regs_p_3,
  3603. + .do_4 = xor_8regs_p_4,
  3604. + .do_5 = xor_8regs_p_5,
  3605. +};
  3606. +
  3607. +static struct xor_block_template xor_block_32regs_p = {
  3608. + .name = "32regs_prefetch",
  3609. + .do_2 = xor_32regs_p_2,
  3610. + .do_3 = xor_32regs_p_3,
  3611. + .do_4 = xor_32regs_p_4,
  3612. + .do_5 = xor_32regs_p_5,
  3613. +};
  3614. +
  3615. +#define XOR_TRY_TEMPLATES \
  3616. + do { \
  3617. + xor_speed(&xor_block_8regs); \
  3618. + xor_speed(&xor_block_8regs_p); \
  3619. + xor_speed(&xor_block_32regs); \
  3620. + xor_speed(&xor_block_32regs_p); \
  3621. + } while (0)
  3622. --- linux/include/asm-nios2nommu/altera_juart.h
  3623. +++ linux/include/asm-nios2nommu/altera_juart.h
  3624. @@ -0,0 +1,36 @@
  3625. +/*------------------------------------------------------------------------
  3626. + *
  3627. + * linux/drivers/serial/altera_juart.h
  3628. + *
  3629. + * Driver for Altera JTAG UART core with Avalon interface
  3630. + *
  3631. + * Copyright (C) 2004 Microtronix Datacom Ltd
  3632. + *
  3633. + * This program is free software; you can redistribute it and/or modify
  3634. + * it under the terms of the GNU General Public License as published by
  3635. + * the Free Software Foundation; either version 2 of the License, or
  3636. + * (at your option) any later version.
  3637. + *
  3638. + * This program is distributed in the hope that it will be useful,
  3639. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3640. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3641. + * GNU General Public License for more details.
  3642. + *
  3643. + *
  3644. + * History:
  3645. + * Jun/20/2005 DGT Microtronix Datacom NiosII
  3646. + *
  3647. + -----------------------------------------------------------------------*/
  3648. +
  3649. +#ifndef _ALTERA_JUART_H_
  3650. + #define _ALTERA_JUART_H_
  3651. +
  3652. + /* jtag uart details needed outside of the driver itself: */
  3653. + /* by: arch/kernel/start.c - boot time error message(s) */
  3654. +
  3655. + void jtaguart_console_write
  3656. + ( struct console *co,
  3657. + const char *s,
  3658. + unsigned int count);
  3659. +
  3660. +#endif /* _ALTERA_JUART_H_ */
  3661. --- linux/include/asm-nios2nommu/a.out.h
  3662. +++ linux/include/asm-nios2nommu/a.out.h
  3663. @@ -0,0 +1,85 @@
  3664. +/* $Id: a.out.h,v 1.4 2004/03/30 19:35:04 ken-h Exp $ */
  3665. +/*
  3666. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  3667. + *
  3668. + * All rights reserved.
  3669. + *
  3670. + * This program is free software; you can redistribute it and/or modify
  3671. + * it under the terms of the GNU General Public License as published by
  3672. + * the Free Software Foundation; either version 2 of the License, or
  3673. + * (at your option) any later version.
  3674. + *
  3675. + * This program is distributed in the hope that it will be useful, but
  3676. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  3677. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  3678. + * NON INFRINGEMENT. See the GNU General Public License for more
  3679. + * details.
  3680. + *
  3681. + * You should have received a copy of the GNU General Public License
  3682. + * along with this program; if not, write to the Free Software
  3683. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  3684. + *
  3685. + */
  3686. +#ifndef __NIOS2NOMMU_A_OUT_H__
  3687. +#define __NIOS2NOMMU_A_OUT_H__
  3688. +
  3689. +#define SPARC_PGSIZE 0x1000 /* Thanks to the sun4 architecture... */
  3690. +#define SEGMENT_SIZE SPARC_PGSIZE /* whee... */
  3691. +
  3692. +struct exec {
  3693. + unsigned char a_dynamic:1; /* A __DYNAMIC is in this image */
  3694. + unsigned char a_toolversion:7;
  3695. + unsigned char a_machtype;
  3696. + unsigned short a_info;
  3697. + unsigned long a_text; /* length of text, in bytes */
  3698. + unsigned long a_data; /* length of data, in bytes */
  3699. + unsigned long a_bss; /* length of bss, in bytes */
  3700. + unsigned long a_syms; /* length of symbol table, in bytes */
  3701. + unsigned long a_entry; /* where program begins */
  3702. + unsigned long a_trsize;
  3703. + unsigned long a_drsize;
  3704. +};
  3705. +
  3706. +#define INIT_EXEC { \
  3707. + .a_dynamic = 0, \
  3708. + .a_toolversion = 0, \
  3709. + .a_machtype = 0, \
  3710. + .a_info = 0, \
  3711. + .a_text = 0, \
  3712. + .a_data = 0, \
  3713. + .a_bss = 0, \
  3714. + .a_syms = 0, \
  3715. + .a_entry = 0, \
  3716. + .a_trsize = 0, \
  3717. + .a_drsize = 0, \
  3718. +}
  3719. +
  3720. +/* Where in the file does the text information begin? */
  3721. +#define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? 0 : sizeof (struct exec))
  3722. +
  3723. +/* Where do the Symbols start? */
  3724. +#define N_SYMOFF(x) (N_TXTOFF(x) + (x).a_text + \
  3725. + (x).a_data + (x).a_trsize + \
  3726. + (x).a_drsize)
  3727. +
  3728. +/* Where does text segment go in memory after being loaded? */
  3729. +#define N_TXTADDR(x) (((N_MAGIC(x) == ZMAGIC) && \
  3730. + ((x).a_entry < SPARC_PGSIZE)) ? \
  3731. + 0 : SPARC_PGSIZE)
  3732. +
  3733. +/* And same for the data segment.. */
  3734. +#define N_DATADDR(x) (N_MAGIC(x)==OMAGIC ? \
  3735. + (N_TXTADDR(x) + (x).a_text) \
  3736. + : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
  3737. +
  3738. +#define N_TRSIZE(a) ((a).a_trsize)
  3739. +#define N_DRSIZE(a) ((a).a_drsize)
  3740. +#define N_SYMSIZE(a) ((a).a_syms)
  3741. +
  3742. +#ifdef __KERNEL__
  3743. +
  3744. +#define STACK_TOP TASK_SIZE
  3745. +
  3746. +#endif
  3747. +
  3748. +#endif /* __NIOS2NOMMU_A_OUT_H__ */
  3749. --- linux/include/asm-nios2nommu/asm-macros.h
  3750. +++ linux/include/asm-nios2nommu/asm-macros.h
  3751. @@ -0,0 +1,331 @@
  3752. +/*
  3753. + * Macro used to simplify coding multi-line assembler.
  3754. + * Some of the bit test macro can simplify down to one line
  3755. + * depending on the mask value.
  3756. + *
  3757. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  3758. + *
  3759. + * All rights reserved.
  3760. + *
  3761. + * This program is free software; you can redistribute it and/or modify
  3762. + * it under the terms of the GNU General Public License as published by
  3763. + * the Free Software Foundation; either version 2 of the License, or
  3764. + * (at your option) any later version.
  3765. + *
  3766. + * This program is distributed in the hope that it will be useful, but
  3767. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  3768. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  3769. + * NON INFRINGEMENT. See the GNU General Public License for more
  3770. + * details.
  3771. + *
  3772. + * You should have received a copy of the GNU General Public License
  3773. + * along with this program; if not, write to the Free Software
  3774. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  3775. + *
  3776. + */
  3777. +
  3778. +/*
  3779. + * ANDs reg2 with mask and places the result in reg1.
  3780. + *
  3781. + * You cannnot use the same register for reg1 & reg2.
  3782. + */
  3783. +
  3784. +.macro ANDI32 reg1,reg2,mask
  3785. + .if \mask & 0xffff
  3786. + .if \mask & 0xffff0000
  3787. + movhi \reg1,%hi(\mask)
  3788. + movui \reg1,%lo(\mask)
  3789. + and \reg1,\reg1,\reg2
  3790. + .else
  3791. + andi \reg1,\reg2,%lo(\mask)
  3792. + .endif
  3793. + .else
  3794. + andhi \reg1,\reg2,%hi(\mask)
  3795. + .endif
  3796. +.endm
  3797. +
  3798. +/*
  3799. + * ORs reg2 with mask and places the result in reg1.
  3800. + *
  3801. + * It is safe to use the same register for reg1 & reg2.
  3802. + */
  3803. +
  3804. +.macro ORI32 reg1,reg2,mask
  3805. + .if \mask & 0xffff
  3806. + .if \mask & 0xffff0000
  3807. + orhi \reg1,\reg2,%hi(\mask)
  3808. + ori \reg1,\reg2,%lo(\mask)
  3809. + .else
  3810. + ori \reg1,\reg2,%lo(\mask)
  3811. + .endif
  3812. + .else
  3813. + orhi \reg1,\reg2,%hi(\mask)
  3814. + .endif
  3815. +.endm
  3816. +
  3817. +/*
  3818. + * XORs reg2 with mask and places the result in reg1.
  3819. + *
  3820. + * It is safe to use the same register for reg1 & reg2.
  3821. + */
  3822. +
  3823. +.macro XORI32 reg1,reg2,mask
  3824. + .if \mask & 0xffff
  3825. + .if \mask & 0xffff0000
  3826. + xorhi \reg1,\reg2,%hi(\mask)
  3827. + xori \reg1,\reg1,%lo(\mask)
  3828. + .else
  3829. + xori \reg1,\reg2,%lo(\mask)
  3830. + .endif
  3831. + .else
  3832. + xorhi \reg1,\reg2,%hi(\mask)
  3833. + .endif
  3834. +.endm
  3835. +
  3836. +/*
  3837. + * This is a support macro for BTBZ & BTBNZ. It checks
  3838. + * the bit to make sure it is valid 32 value.
  3839. + *
  3840. + * It is safe to use the same register for reg1 & reg2.
  3841. + */
  3842. +
  3843. +.macro BT reg1,reg2,bit
  3844. +.if \bit > 31
  3845. + .err
  3846. +.else
  3847. + .if \bit < 16
  3848. + andi \reg1,\reg2,(1 << \bit)
  3849. + .else
  3850. + andhi \reg1,\reg2,(1 << (\bit - 16))
  3851. + .endif
  3852. +.endif
  3853. +.endm
  3854. +
  3855. +/*
  3856. + * Tests the bit in reg2 and branches to label if the
  3857. + * bit is zero. The result of the bit test is stored in reg1.
  3858. + *
  3859. + * It is safe to use the same register for reg1 & reg2.
  3860. + */
  3861. +
  3862. +.macro BTBZ reg1,reg2,bit,label
  3863. + BT \reg1,\reg2,\bit
  3864. + beq \reg1,r0,\label
  3865. +.endm
  3866. +
  3867. +/*
  3868. + * Tests the bit in reg2 and branches to label if the
  3869. + * bit is non-zero. The result of the bit test is stored in reg1.
  3870. + *
  3871. + * It is safe to use the same register for reg1 & reg2.
  3872. + */
  3873. +
  3874. +.macro BTBNZ reg1,reg2,bit,label
  3875. + BT \reg1,\reg2,\bit
  3876. + bne \reg1,r0,\label
  3877. +.endm
  3878. +
  3879. +/*
  3880. + * Tests the bit in reg2 and then compliments the bit in reg2.
  3881. + * The result of the bit test is stored in reg1.
  3882. + *
  3883. + * It is NOT safe to use the same register for reg1 & reg2.
  3884. + */
  3885. +
  3886. +.macro BTC reg1,reg2,bit
  3887. +.if \bit > 31
  3888. + .err
  3889. +.else
  3890. + .if \bit < 16
  3891. + andi \reg1,\reg2,(1 << \bit)
  3892. + xori \reg2,\reg2,(1 << \bit)
  3893. + .else
  3894. + andhi \reg1,\reg2,(1 << (\bit - 16))
  3895. + xorhi \reg2,\reg2,(1 << (\bit - 16))
  3896. + .endif
  3897. +.endif
  3898. +.endm
  3899. +
  3900. +/*
  3901. + * Tests the bit in reg2 and then sets the bit in reg2.
  3902. + * The result of the bit test is stored in reg1.
  3903. + *
  3904. + * It is NOT safe to use the same register for reg1 & reg2.
  3905. + */
  3906. +
  3907. +.macro BTS reg1,reg2,bit
  3908. +.if \bit > 31
  3909. + .err
  3910. +.else
  3911. + .if \bit < 16
  3912. + andi \reg1,\reg2,(1 << \bit)
  3913. + ori \reg2,\reg2,(1 << \bit)
  3914. + .else
  3915. + andhi \reg1,\reg2,(1 << (\bit - 16))
  3916. + orhi \reg2,\reg2,(1 << (\bit - 16))
  3917. + .endif
  3918. +.endif
  3919. +.endm
  3920. +
  3921. +/*
  3922. + * Tests the bit in reg2 and then resets the bit in reg2.
  3923. + * The result of the bit test is stored in reg1.
  3924. + *
  3925. + * It is NOT safe to use the same register for reg1 & reg2.
  3926. + */
  3927. +
  3928. +.macro BTR reg1,reg2,bit
  3929. +.if \bit > 31
  3930. + .err
  3931. +.else
  3932. + .if \bit < 16
  3933. + andi \reg1,\reg2,(1 << \bit)
  3934. + andi \reg2,\reg2,%lo(~(1 << \bit))
  3935. + .else
  3936. + andhi \reg1,\reg2,(1 << (\bit - 16))
  3937. + andhi \reg2,\reg2,%lo(~(1 << (\bit - 16)))
  3938. + .endif
  3939. +.endif
  3940. +.endm
  3941. +
  3942. +/*
  3943. + * Tests the bit in reg2 and then compliments the bit in reg2.
  3944. + * The result of the bit test is stored in reg1. If the
  3945. + * original bit was zero it branches to label.
  3946. + *
  3947. + * It is NOT safe to use the same register for reg1 & reg2.
  3948. + */
  3949. +
  3950. +.macro BTCBZ reg1,reg2,bit,label
  3951. + BTC \reg1,\reg2,\bit
  3952. + beq \reg1,r0,\label
  3953. +.endm
  3954. +
  3955. +/*
  3956. + * Tests the bit in reg2 and then compliments the bit in reg2.
  3957. + * The result of the bit test is stored in reg1. If the
  3958. + * original bit was non-zero it branches to label.
  3959. + *
  3960. + * It is NOT safe to use the same register for reg1 & reg2.
  3961. + */
  3962. +
  3963. +.macro BTCBNZ reg1,reg2,bit,label
  3964. + BTC \reg1,\reg2,\bit
  3965. + bne \reg1,r0,\label
  3966. +.endm
  3967. +
  3968. +/*
  3969. + * Tests the bit in reg2 and then sets the bit in reg2.
  3970. + * The result of the bit test is stored in reg1. If the
  3971. + * original bit was zero it branches to label.
  3972. + *
  3973. + * It is NOT safe to use the same register for reg1 & reg2.
  3974. + */
  3975. +
  3976. +.macro BTSBZ reg1,reg2,bit,label
  3977. + BTS \reg1,\reg2,\bit
  3978. + beq \reg1,r0,\label
  3979. +.endm
  3980. +
  3981. +/*
  3982. + * Tests the bit in reg2 and then sets the bit in reg2.
  3983. + * The result of the bit test is stored in reg1. If the
  3984. + * original bit was non-zero it branches to label.
  3985. + *
  3986. + * It is NOT safe to use the same register for reg1 & reg2.
  3987. + */
  3988. +
  3989. +.macro BTSBNZ reg1,reg2,bit,label
  3990. + BTS \reg1,\reg2,\bit
  3991. + bne \reg1,r0,\label
  3992. +.endm
  3993. +
  3994. +/*
  3995. + * Tests the bit in reg2 and then resets the bit in reg2.
  3996. + * The result of the bit test is stored in reg1. If the
  3997. + * original bit was zero it branches to label.
  3998. + *
  3999. + * It is NOT safe to use the same register for reg1 & reg2.
  4000. + */
  4001. +
  4002. +.macro BTRBZ reg1,reg2,bit,label
  4003. + BTR \reg1,\reg2,\bit
  4004. + bne \reg1,r0,\label
  4005. +.endm
  4006. +
  4007. +/*
  4008. + * Tests the bit in reg2 and then resets the bit in reg2.
  4009. + * The result of the bit test is stored in reg1. If the
  4010. + * original bit was non-zero it branches to label.
  4011. + *
  4012. + * It is NOT safe to use the same register for reg1 & reg2.
  4013. + */
  4014. +
  4015. +.macro BTRBNZ reg1,reg2,bit,label
  4016. + BTR \reg1,\reg2,\bit
  4017. + bne \reg1,r0,\label
  4018. +.endm
  4019. +
  4020. +/*
  4021. + * Tests the bits in mask against reg2 stores the result in reg1.
  4022. + * If the all the bits in the mask are zero it branches to label.
  4023. + *
  4024. + * It is safe to use the same register for reg1 & reg2.
  4025. + */
  4026. +
  4027. +.macro TSTBZ reg1,reg2,mask,label
  4028. + ANDI32 \reg1,\reg2,\mask
  4029. + beq \reg1,r0,\label
  4030. +.endm
  4031. +
  4032. +/*
  4033. + * Tests the bits in mask against reg2 stores the result in reg1.
  4034. + * If the any of the bits in the mask are 1 it branches to label.
  4035. + *
  4036. + * It is safe to use the same register for reg1 & reg2.
  4037. + */
  4038. +
  4039. +.macro TSTBNZ reg1,reg2,mask,label
  4040. + ANDI32 \reg1,\reg2,\mask
  4041. + bne \reg1,r0,\label
  4042. +.endm
  4043. +
  4044. +/*
  4045. + * Pushes reg onto the stack.
  4046. + */
  4047. +
  4048. +.macro PUSH reg
  4049. + addi sp,sp,-4
  4050. + stw \reg,0(sp)
  4051. +.endm
  4052. +
  4053. +/*
  4054. + * Pops the top of the stack into reg.
  4055. + */
  4056. +
  4057. +.macro POP reg
  4058. + ldw \reg,0(sp)
  4059. + addi sp,sp,4
  4060. +.endm
  4061. +
  4062. +/*
  4063. + * Clears reg
  4064. + */
  4065. +
  4066. +.macro CLR reg
  4067. + mov \reg,r0
  4068. +.endm
  4069. +
  4070. +/*
  4071. + * The preprocessor macro does not work for
  4072. + * the nios2 compiler. Undefine ENTRY and define
  4073. + * a real assembler macro.
  4074. + */
  4075. +#undef ENTRY
  4076. +#define ENTRY(name) ASM_ENTRY name
  4077. +
  4078. +.macro ASM_ENTRY name
  4079. +.globl \name
  4080. +__ALIGN
  4081. + \name:
  4082. +.endm
  4083. --- linux/include/asm-nios2nommu/atomic.h
  4084. +++ linux/include/asm-nios2nommu/atomic.h
  4085. @@ -0,0 +1,190 @@
  4086. +//vic - add 'atomic_add/sub_return', 'atomic_add_negative'
  4087. +//vic from v850 architecture
  4088. +
  4089. +/* atomic.h:
  4090. + *
  4091. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  4092. + * Copyright (C) 2001 Vic Phillips (vic@microtronix.com)
  4093. + *
  4094. + * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
  4095. + *
  4096. + * All rights reserved.
  4097. + *
  4098. + * This program is free software; you can redistribute it and/or modify
  4099. + * it under the terms of the GNU General Public License as published by
  4100. + * the Free Software Foundation; either version 2 of the License, or
  4101. + * (at your option) any later version.
  4102. + *
  4103. + * This program is distributed in the hope that it will be useful, but
  4104. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  4105. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  4106. + * NON INFRINGEMENT. See the GNU General Public License for more
  4107. + * details.
  4108. + *
  4109. + * You should have received a copy of the GNU General Public License
  4110. + * along with this program; if not, write to the Free Software
  4111. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  4112. + *
  4113. + */
  4114. +
  4115. +#ifndef __ARCH_NIOS2NOMMU_ATOMIC__
  4116. +#define __ARCH_NIOS2NOMMU_ATOMIC__
  4117. +
  4118. +#include <asm/system.h>
  4119. +
  4120. +typedef struct { int counter; } atomic_t;
  4121. +#define ATOMIC_INIT(i) { (i) }
  4122. +
  4123. +#define atomic_read(v) ((v)->counter)
  4124. +#define atomic_set(v, i) (((v)->counter) = i)
  4125. +
  4126. +
  4127. +extern __inline__ void atomic_add(int i, atomic_t *v)
  4128. +{
  4129. + unsigned long flags;
  4130. +
  4131. + local_irq_save(flags);
  4132. + v->counter += i;
  4133. + local_irq_restore(flags);
  4134. +}
  4135. +
  4136. +extern __inline__ int atomic_add_negative(int i, atomic_t *v)
  4137. +{
  4138. + unsigned long flags;
  4139. + int result;
  4140. +
  4141. + local_irq_save(flags);
  4142. + v->counter += i;
  4143. + result = (v->counter < 0);
  4144. + local_irq_restore(flags);
  4145. + return result;
  4146. +}
  4147. +
  4148. +extern __inline__ void atomic_sub(int i, atomic_t *v)
  4149. +{
  4150. + unsigned long flags;
  4151. +
  4152. + local_irq_save(flags);
  4153. + v->counter -= i;
  4154. + local_irq_restore(flags);
  4155. +}
  4156. +
  4157. +extern __inline__ int atomic_sub_and_test(int i, atomic_t *v)
  4158. +{
  4159. + int result;
  4160. + unsigned long flags;
  4161. +
  4162. + local_irq_save(flags);
  4163. + v->counter -= i;
  4164. + result = (v->counter == 0);
  4165. + local_irq_restore(flags);
  4166. + return result;
  4167. +}
  4168. +
  4169. +extern __inline__ void atomic_inc(atomic_t *v)
  4170. +{
  4171. + unsigned long flags;
  4172. +
  4173. + local_irq_save(flags);
  4174. + v->counter += 1;
  4175. + local_irq_restore(flags);
  4176. +}
  4177. +
  4178. +extern __inline__ int atomic_inc_and_test(atomic_t *v)
  4179. +{
  4180. + unsigned long flags;
  4181. + int result;
  4182. +
  4183. + local_irq_save(flags);
  4184. + v->counter += 1;
  4185. + result = (v->counter == 0);
  4186. + local_irq_restore(flags);
  4187. + return result;
  4188. +}
  4189. +
  4190. +extern __inline__ void atomic_dec(atomic_t *v)
  4191. +{
  4192. + int i = 1; /* the compiler optimizes better this way */
  4193. + unsigned long flags;
  4194. +
  4195. + local_irq_save(flags);
  4196. + v->counter -= i;
  4197. + local_irq_restore(flags);
  4198. +}
  4199. +
  4200. +extern __inline__ int atomic_dec_and_test(atomic_t *v)
  4201. +{
  4202. + int result;
  4203. + int i = 1; /* the compiler optimizes better this way */
  4204. + unsigned long flags;
  4205. +
  4206. + local_irq_save(flags);
  4207. + v->counter -= i;
  4208. + result = (v->counter == 0);
  4209. + local_irq_restore(flags);
  4210. + return result;
  4211. +}
  4212. +
  4213. +extern __inline__ int atomic_inc_return(atomic_t *v)
  4214. +{
  4215. + int result;
  4216. + unsigned long flags;
  4217. +
  4218. + local_irq_save(flags);
  4219. + result = ++v->counter;
  4220. + local_irq_restore(flags);
  4221. + return result;
  4222. +}
  4223. +
  4224. +extern __inline__ int atomic_dec_return(atomic_t *v)
  4225. +{
  4226. + int result;
  4227. + int i = 1; /* the compiler optimizes better this way */
  4228. + unsigned long flags;
  4229. +
  4230. + local_irq_save(flags);
  4231. + v->counter -= i;
  4232. + result = v->counter;
  4233. + local_irq_restore(flags);
  4234. + return result;
  4235. +}
  4236. +
  4237. +extern __inline__ int atomic_add_return (int i, volatile atomic_t *v)
  4238. +{
  4239. + int res;
  4240. + unsigned long flags;
  4241. +
  4242. + local_irq_save(flags);
  4243. + res = v->counter + i;
  4244. + v->counter = res;
  4245. + local_irq_restore(flags);
  4246. +
  4247. + return res;
  4248. +}
  4249. +
  4250. +static __inline__ int atomic_sub_return (int i, volatile atomic_t *v)
  4251. +{
  4252. + int res;
  4253. + unsigned long flags;
  4254. +
  4255. + local_irq_save(flags);
  4256. + res = v->counter - i;
  4257. + v->counter = res;
  4258. + local_irq_restore(flags);
  4259. +
  4260. + return res;
  4261. +}
  4262. +
  4263. +#define atomic_dec_return(v) atomic_sub_return(1,(v))
  4264. +#define atomic_inc_return(v) atomic_add_return(1,(v))
  4265. +
  4266. +/* Atomic operations are already serializing */
  4267. +#define smp_mb__before_atomic_dec() barrier()
  4268. +#define smp_mb__after_atomic_dec() barrier()
  4269. +#define smp_mb__before_atomic_inc() barrier()
  4270. +#define smp_mb__after_atomic_inc() barrier()
  4271. +
  4272. +
  4273. +#endif /* !(__ARCH_NIOS2NOMMU_ATOMIC__) */
  4274. +
  4275. +
  4276. --- linux/include/asm-nios2nommu/bitops.h
  4277. +++ linux/include/asm-nios2nommu/bitops.h
  4278. @@ -0,0 +1,472 @@
  4279. +#ifndef _ASM_NIOS_BITOPS_H_
  4280. +#define _ASM_NIOS_BITOPS_H_
  4281. +
  4282. +/*--------------------------------------------------------------------
  4283. + *
  4284. + * include/asm-nios2nommu/bitops.h
  4285. + *
  4286. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  4287. + *
  4288. + * Copyright (C) 2004 Microtronix Datacom Ltd
  4289. + *
  4290. + * This program is free software; you can redistribute it and/or modify
  4291. + * it under the terms of the GNU General Public License as published by
  4292. + * the Free Software Foundation; either version 2 of the License, or
  4293. + * (at your option) any later version.
  4294. + *
  4295. + * This program is distributed in the hope that it will be useful,
  4296. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4297. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4298. + * GNU General Public License for more details.
  4299. + *
  4300. + *
  4301. + * Jan/20/2004 dgt NiosII
  4302. + *
  4303. + ---------------------------------------------------------------------*/
  4304. +
  4305. +
  4306. +#ifdef __KERNEL__
  4307. +// #include <linux/config.h>
  4308. +#include <linux/compiler.h>
  4309. +#include <asm/byteorder.h> /* swab32 */
  4310. +#include <asm/system.h>
  4311. +#endif
  4312. +
  4313. +/*
  4314. + * Adapted to NIOS from generic bitops.h:
  4315. + *
  4316. + * For the benefit of those who are trying to port Linux to another
  4317. + * architecture, here are some C-language equivalents. You should
  4318. + * recode these in the native assembly language, if at all possible.
  4319. + * To guarantee atomicity, these routines call cli() and sti() to
  4320. + * disable interrupts while they operate. (You have to provide inline
  4321. + * routines to cli() and sti().)
  4322. + *
  4323. + * Also note, these routines assume that you have 32 bit integers.
  4324. + * You will have to change this if you are trying to port Linux to the
  4325. + * Alpha architecture or to a Cray. :-)
  4326. + *
  4327. + * C language equivalents written by Theodore Ts'o, 9/26/92
  4328. + */
  4329. +
  4330. +/*
  4331. + * Generic ffs().
  4332. + */
  4333. +static inline int ffs(int x)
  4334. +{
  4335. + int r = 1;
  4336. +
  4337. + if (!x)
  4338. + return 0;
  4339. + if (!(x & 0xffff)) {
  4340. + x >>= 16;
  4341. + r += 16;
  4342. + }
  4343. + if (!(x & 0xff)) {
  4344. + x >>= 8;
  4345. + r += 8;
  4346. + }
  4347. + if (!(x & 0xf)) {
  4348. + x >>= 4;
  4349. + r += 4;
  4350. + }
  4351. + if (!(x & 3)) {
  4352. + x >>= 2;
  4353. + r += 2;
  4354. + }
  4355. + if (!(x & 1)) {
  4356. + x >>= 1;
  4357. + r += 1;
  4358. + }
  4359. + return r;
  4360. +}
  4361. +
  4362. +/*
  4363. + * Generic __ffs().
  4364. + */
  4365. +static inline int __ffs(int x)
  4366. +{
  4367. + int r = 0;
  4368. +
  4369. + if (!x)
  4370. + return 0;
  4371. + if (!(x & 0xffff)) {
  4372. + x >>= 16;
  4373. + r += 16;
  4374. + }
  4375. + if (!(x & 0xff)) {
  4376. + x >>= 8;
  4377. + r += 8;
  4378. + }
  4379. + if (!(x & 0xf)) {
  4380. + x >>= 4;
  4381. + r += 4;
  4382. + }
  4383. + if (!(x & 3)) {
  4384. + x >>= 2;
  4385. + r += 2;
  4386. + }
  4387. + if (!(x & 1)) {
  4388. + x >>= 1;
  4389. + r += 1;
  4390. + }
  4391. + return r;
  4392. +}
  4393. +
  4394. +/*
  4395. + * fls: find last bit set.
  4396. + */
  4397. +#define fls(x) generic_fls(x)
  4398. +
  4399. +
  4400. +/*
  4401. + * Every architecture must define this function. It's the fastest
  4402. + * way of searching a 140-bit bitmap where the first 100 bits are
  4403. + * unlikely to be set. It's guaranteed that at least one of the 140
  4404. + * bits is cleared.
  4405. + */
  4406. +static inline int sched_find_first_bit(unsigned long *b)
  4407. +{
  4408. + if (unlikely(b[0]))
  4409. + return __ffs(b[0]);
  4410. + if (unlikely(b[1]))
  4411. + return __ffs(b[1]) + 32;
  4412. + if (unlikely(b[2]))
  4413. + return __ffs(b[2]) + 64;
  4414. + if (b[3])
  4415. + return __ffs(b[3]) + 96;
  4416. + return __ffs(b[4]) + 128;
  4417. +}
  4418. +
  4419. +/*
  4420. + * ffz = Find First Zero in word. Undefined if no zero exists,
  4421. + * so code should check against ~0UL first..
  4422. + */
  4423. +static __inline__ unsigned long ffz(unsigned long word)
  4424. +{
  4425. + unsigned long result = 0;
  4426. +
  4427. + while(word & 1) {
  4428. + result++;
  4429. + word >>= 1;
  4430. + }
  4431. + return result;
  4432. +}
  4433. +
  4434. +
  4435. +static __inline__ void set_bit(int nr, volatile unsigned long * addr)
  4436. +{
  4437. + int * a = (int *) addr;
  4438. + int mask;
  4439. + unsigned long flags;
  4440. +
  4441. + a += nr >> 5;
  4442. + mask = 1 << (nr & 0x1f);
  4443. + local_irq_save(flags);
  4444. + *a |= mask;
  4445. + local_irq_restore(flags);
  4446. +}
  4447. +
  4448. +static __inline__ void __set_bit(int nr, volatile unsigned long * addr)
  4449. +{
  4450. + int * a = (int *) addr;
  4451. + int mask;
  4452. +
  4453. + a += nr >> 5;
  4454. + mask = 1 << (nr & 0x1f);
  4455. + *a |= mask;
  4456. +}
  4457. +
  4458. +/*
  4459. + * clear_bit() doesn't provide any barrier for the compiler.
  4460. + */
  4461. +#define smp_mb__before_clear_bit() barrier()
  4462. +#define smp_mb__after_clear_bit() barrier()
  4463. +
  4464. +static __inline__ void clear_bit(int nr, volatile unsigned long * addr)
  4465. +{
  4466. + int * a = (int *) addr;
  4467. + int mask;
  4468. + unsigned long flags;
  4469. +
  4470. + a += nr >> 5;
  4471. + mask = 1 << (nr & 0x1f);
  4472. + local_irq_save(flags);
  4473. + *a &= ~mask;
  4474. + local_irq_restore(flags);
  4475. +}
  4476. +
  4477. +static __inline__ void __clear_bit(int nr, volatile unsigned long * addr)
  4478. +{
  4479. + int * a = (int *) addr;
  4480. + int mask;
  4481. +
  4482. + a += nr >> 5;
  4483. + mask = 1 << (nr & 0x1f);
  4484. + *a &= ~mask;
  4485. +}
  4486. +
  4487. +static __inline__ void change_bit(int nr, volatile unsigned long * addr)
  4488. +{
  4489. + int mask, flags;
  4490. + unsigned long *ADDR = (unsigned long *) addr;
  4491. +
  4492. + ADDR += nr >> 5;
  4493. + mask = 1 << (nr & 31);
  4494. + local_irq_save(flags);
  4495. + *ADDR ^= mask;
  4496. + local_irq_restore(flags);
  4497. +}
  4498. +
  4499. +static __inline__ void __change_bit(int nr, volatile unsigned long * addr)
  4500. +{
  4501. + int mask;
  4502. + unsigned long *ADDR = (unsigned long *) addr;
  4503. +
  4504. + ADDR += nr >> 5;
  4505. + mask = 1 << (nr & 31);
  4506. + *ADDR ^= mask;
  4507. +}
  4508. +
  4509. +static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr)
  4510. +{
  4511. + int mask, retval;
  4512. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4513. + unsigned long flags;
  4514. +
  4515. + a += nr >> 5;
  4516. + mask = 1 << (nr & 0x1f);
  4517. + local_irq_save(flags);
  4518. + retval = (mask & *a) != 0;
  4519. + *a |= mask;
  4520. + local_irq_restore(flags);
  4521. +
  4522. + return retval;
  4523. +}
  4524. +
  4525. +static __inline__ int __test_and_set_bit(int nr, volatile unsigned long * addr)
  4526. +{
  4527. + int mask, retval;
  4528. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4529. +
  4530. + a += nr >> 5;
  4531. + mask = 1 << (nr & 0x1f);
  4532. + retval = (mask & *a) != 0;
  4533. + *a |= mask;
  4534. + return retval;
  4535. +}
  4536. +
  4537. +static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr)
  4538. +{
  4539. + int mask, retval;
  4540. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4541. + unsigned long flags;
  4542. +
  4543. + a += nr >> 5;
  4544. + mask = 1 << (nr & 0x1f);
  4545. + local_irq_save(flags);
  4546. + retval = (mask & *a) != 0;
  4547. + *a &= ~mask;
  4548. + local_irq_restore(flags);
  4549. +
  4550. + return retval;
  4551. +}
  4552. +
  4553. +static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long * addr)
  4554. +{
  4555. + int mask, retval;
  4556. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4557. +
  4558. + a += nr >> 5;
  4559. + mask = 1 << (nr & 0x1f);
  4560. + retval = (mask & *a) != 0;
  4561. + *a &= ~mask;
  4562. + return retval;
  4563. +}
  4564. +
  4565. +static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr)
  4566. +{
  4567. + int mask, retval;
  4568. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4569. + unsigned long flags;
  4570. +
  4571. + a += nr >> 5;
  4572. + mask = 1 << (nr & 0x1f);
  4573. + local_irq_save(flags);
  4574. + retval = (mask & *a) != 0;
  4575. + *a ^= mask;
  4576. + local_irq_restore(flags);
  4577. +
  4578. + return retval;
  4579. +}
  4580. +
  4581. +static __inline__ int __test_and_change_bit(int nr, volatile unsigned long * addr)
  4582. +{
  4583. + int mask, retval;
  4584. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4585. +
  4586. + a += nr >> 5;
  4587. + mask = 1 << (nr & 0x1f);
  4588. + retval = (mask & *a) != 0;
  4589. + *a ^= mask;
  4590. + return retval;
  4591. +}
  4592. +
  4593. +/*
  4594. + * This routine doesn't need to be atomic.
  4595. + */
  4596. +static __inline__ int __constant_test_bit(int nr, const volatile unsigned long * addr)
  4597. +{
  4598. + return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
  4599. +}
  4600. +
  4601. +static __inline__ int __test_bit(int nr, const volatile unsigned long * addr)
  4602. +{
  4603. + int * a = (int *) addr;
  4604. + int mask;
  4605. +
  4606. + a += nr >> 5;
  4607. + mask = 1 << (nr & 0x1f);
  4608. + return ((mask & *a) != 0);
  4609. +}
  4610. +
  4611. +#define test_bit(nr,addr) \
  4612. +(__builtin_constant_p(nr) ? \
  4613. + __constant_test_bit((nr),(unsigned long *)(addr)) : \
  4614. + __test_bit((nr),(unsigned long *)(addr)))
  4615. +
  4616. +
  4617. +/* find_next_zero_bit() finds the first zero bit in a bit string of length
  4618. + * 'size' bits, starting the search at bit 'offset'. This is largely based
  4619. + * on Linus's ALPHA routines, which are pretty portable BTW.
  4620. + */
  4621. +
  4622. +extern __inline__ unsigned long find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
  4623. +{
  4624. + unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
  4625. + unsigned long result = offset & ~31UL;
  4626. + unsigned long tmp;
  4627. +
  4628. + if (offset >= size)
  4629. + return size;
  4630. + size -= result;
  4631. + offset &= 31UL;
  4632. + if (offset) {
  4633. + tmp = *(p++);
  4634. + tmp |= ~0UL >> (32-offset);
  4635. + if (size < 32)
  4636. + goto found_first;
  4637. + if (~tmp)
  4638. + goto found_middle;
  4639. + size -= 32;
  4640. + result += 32;
  4641. + }
  4642. + while (size & ~31UL) {
  4643. + if (~(tmp = *(p++)))
  4644. + goto found_middle;
  4645. + result += 32;
  4646. + size -= 32;
  4647. + }
  4648. + if (!size)
  4649. + return result;
  4650. + tmp = *p;
  4651. +
  4652. +found_first:
  4653. + tmp |= ~0UL << size;
  4654. + if (tmp == ~0UL)
  4655. + return result + size;
  4656. +found_middle:
  4657. + return result + ffz(tmp);
  4658. +}
  4659. +
  4660. +/*
  4661. + * Find next one bit in a bitmap reasonably efficiently.
  4662. + */
  4663. +extern __inline__ unsigned long find_next_bit(const unsigned long *addr,
  4664. + unsigned long size, unsigned long offset)
  4665. +{
  4666. + unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
  4667. + unsigned int result = offset & ~31UL;
  4668. + unsigned int tmp;
  4669. +
  4670. + if (offset >= size)
  4671. + return size;
  4672. + size -= result;
  4673. + offset &= 31UL;
  4674. + if (offset) {
  4675. + tmp = *p++;
  4676. + tmp &= ~0UL << offset;
  4677. + if (size < 32)
  4678. + goto found_first;
  4679. + if (tmp)
  4680. + goto found_middle;
  4681. + size -= 32;
  4682. + result += 32;
  4683. + }
  4684. + while (size >= 32) {
  4685. + if ((tmp = *p++) != 0)
  4686. + goto found_middle;
  4687. + result += 32;
  4688. + size -= 32;
  4689. + }
  4690. + if (!size)
  4691. + return result;
  4692. + tmp = *p;
  4693. +
  4694. +found_first:
  4695. + tmp &= ~0UL >> (32 - size);
  4696. + if (tmp == 0UL) /* Are any bits set? */
  4697. + return result + size; /* Nope. */
  4698. +found_middle:
  4699. + return result + __ffs(tmp);
  4700. +}
  4701. +
  4702. +/*
  4703. + * hweightN: returns the hamming weight (i.e. the number
  4704. + * of bits set) of a N-bit word
  4705. + */
  4706. +
  4707. +#define hweight32(x) generic_hweight32(x)
  4708. +#define hweight16(x) generic_hweight16(x)
  4709. +#define hweight8(x) generic_hweight8(x)
  4710. +
  4711. +/* Linus sez that gcc can optimize the following correctly, we'll see if this
  4712. + * holds on the Sparc as it does for the ALPHA.
  4713. + */
  4714. +
  4715. +#define find_first_zero_bit(addr, size) \
  4716. + find_next_zero_bit((addr), (size), 0)
  4717. +#define find_first_bit(addr, size) \
  4718. + find_next_bit((addr), (size), 0)
  4719. +
  4720. +/* Now for the ext2 filesystem bit operations and helper routines.
  4721. + *
  4722. + * Both NIOS and ext2 are little endian, so these are the same as above.
  4723. + */
  4724. +
  4725. +#define ext2_set_bit test_and_set_bit
  4726. +#define ext2_clear_bit test_and_clear_bit
  4727. +#define ext2_test_bit test_bit
  4728. +
  4729. +#define ext2_set_bit_atomic(lock, nr, addr) \
  4730. + ({ \
  4731. + int ret; \
  4732. + spin_lock(lock); \
  4733. + ret = ext2_set_bit((nr),(unsigned long *) (addr)); \
  4734. + spin_unlock(lock); \
  4735. + ret; \
  4736. + })
  4737. +
  4738. +#define ext2_clear_bit_atomic(lock, nr, addr) \
  4739. + ({ \
  4740. + int ret; \
  4741. + spin_lock(lock); \
  4742. + ret = ext2_clear_bit((nr),(unsigned long *) (addr)); \
  4743. + spin_unlock(lock); \
  4744. + ret; \
  4745. + })
  4746. +
  4747. +#define ext2_find_first_zero_bit find_first_zero_bit
  4748. +#define ext2_find_next_zero_bit find_next_zero_bit
  4749. +
  4750. +#endif /* _ASM_NIOS_BITOPS_H */
  4751. --- linux/include/asm-nios2nommu/bootinfo.h
  4752. +++ linux/include/asm-nios2nommu/bootinfo.h
  4753. @@ -0,0 +1,2 @@
  4754. +
  4755. +/* Nothing for nios2nommu */
  4756. --- linux/include/asm-nios2nommu/bug.h
  4757. +++ linux/include/asm-nios2nommu/bug.h
  4758. @@ -0,0 +1,48 @@
  4759. +#ifndef _NIOS2NOMMU_BUG_H
  4760. +#define _NIOS2NOMMU_BUG_H
  4761. +
  4762. +/*--------------------------------------------------------------------
  4763. + *
  4764. + * include/asm-nios2nommu/bug.h
  4765. + *
  4766. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  4767. + *
  4768. + * Copyright (C) 2004 Microtronix Datacom Ltd
  4769. + *
  4770. + * This program is free software; you can redistribute it and/or modify
  4771. + * it under the terms of the GNU General Public License as published by
  4772. + * the Free Software Foundation; either version 2 of the License, or
  4773. + * (at your option) any later version.
  4774. + *
  4775. + * This program is distributed in the hope that it will be useful,
  4776. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4777. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4778. + * GNU General Public License for more details.
  4779. + *
  4780. + *
  4781. + * Jan/20/2004 dgt NiosII
  4782. + *
  4783. + ---------------------------------------------------------------------*/
  4784. +
  4785. +
  4786. +#define BUG() do { \
  4787. + printk("%s(%d): kernel BUG!\n", __FILE__, __LINE__); \
  4788. +} while (0)
  4789. +
  4790. +#define BUG_ON(condition) do { \
  4791. + if (unlikely((condition)!=0)) \
  4792. + BUG(); \
  4793. +} while(0)
  4794. +
  4795. +#define PAGE_BUG(page) do { \
  4796. + BUG(); \
  4797. +} while (0)
  4798. +
  4799. +#define WARN_ON(condition) do { \
  4800. + if (unlikely((condition)!=0)) { \
  4801. + printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
  4802. + dump_stack(); \
  4803. + } \
  4804. +} while (0)
  4805. +
  4806. +#endif
  4807. --- linux/include/asm-nios2nommu/bugs.h
  4808. +++ linux/include/asm-nios2nommu/bugs.h
  4809. @@ -0,0 +1,40 @@
  4810. +#ifndef __ASM_NIOS_BUGS_H
  4811. +#define __ASM_NIOS_BUGS_H
  4812. +
  4813. +/*--------------------------------------------------------------------
  4814. + *
  4815. + * include/asm-nios2nommu/bugs.h
  4816. + *
  4817. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  4818. + *
  4819. + * Copyright (C) 1994 Linus Torvalds
  4820. + * Copyright (C) 2004 Microtronix Datacom Ltd
  4821. + *
  4822. + * This program is free software; you can redistribute it and/or modify
  4823. + * it under the terms of the GNU General Public License as published by
  4824. + * the Free Software Foundation; either version 2 of the License, or
  4825. + * (at your option) any later version.
  4826. + *
  4827. + * This program is distributed in the hope that it will be useful,
  4828. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4829. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4830. + * GNU General Public License for more details.
  4831. + *
  4832. + *
  4833. + * Jan/20/2004 dgt NiosII
  4834. + *
  4835. + ---------------------------------------------------------------------*/
  4836. +
  4837. +
  4838. +/*
  4839. + * This is included by init/main.c to check for architecture-dependent bugs.
  4840. + *
  4841. + * Needs:
  4842. + * void check_bugs(void);
  4843. + */
  4844. +
  4845. +static void check_bugs(void)
  4846. +{
  4847. +}
  4848. +
  4849. +#endif
  4850. --- linux/include/asm-nios2nommu/byteorder.h
  4851. +++ linux/include/asm-nios2nommu/byteorder.h
  4852. @@ -0,0 +1,38 @@
  4853. +#ifndef __ASM_NIOS_BYTEORDER_H
  4854. +#define __ASM_NIOS_BYTEORDER_H
  4855. +
  4856. +/*--------------------------------------------------------------------
  4857. + *
  4858. + * include/asm-nios2nommu/byteorder.h
  4859. + *
  4860. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  4861. + *
  4862. + * Copyright (C) 2004 Microtronix Datacom Ltd
  4863. + *
  4864. + * This program is free software; you can redistribute it and/or modify
  4865. + * it under the terms of the GNU General Public License as published by
  4866. + * the Free Software Foundation; either version 2 of the License, or
  4867. + * (at your option) any later version.
  4868. + *
  4869. + * This program is distributed in the hope that it will be useful,
  4870. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4871. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4872. + * GNU General Public License for more details.
  4873. + *
  4874. + *
  4875. + * Jan/20/2004 dgt NiosII
  4876. + *
  4877. + ---------------------------------------------------------------------*/
  4878. +
  4879. +
  4880. +#include <asm/types.h>
  4881. +
  4882. +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
  4883. +# define __BYTEORDER_HAS_U64__
  4884. +# define __SWAB_64_THRU_32__
  4885. +#endif
  4886. +
  4887. +#include <linux/byteorder/little_endian.h>
  4888. +
  4889. +#endif
  4890. +
  4891. --- linux/include/asm-nios2nommu/cachectl.h
  4892. +++ linux/include/asm-nios2nommu/cachectl.h
  4893. @@ -0,0 +1,36 @@
  4894. +/*
  4895. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  4896. + *
  4897. + * All rights reserved.
  4898. + *
  4899. + * This program is free software; you can redistribute it and/or modify
  4900. + * it under the terms of the GNU General Public License as published by
  4901. + * the Free Software Foundation; either version 2 of the License, or
  4902. + * (at your option) any later version.
  4903. + *
  4904. + * This program is distributed in the hope that it will be useful, but
  4905. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  4906. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  4907. + * NON INFRINGEMENT. See the GNU General Public License for more
  4908. + * details.
  4909. + *
  4910. + * You should have received a copy of the GNU General Public License
  4911. + * along with this program; if not, write to the Free Software
  4912. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  4913. + *
  4914. + */
  4915. +
  4916. +#ifndef _NIOS2NOMMU_CACHECTL_H
  4917. +#define _NIOS2NOMMU_CACHECTL_H
  4918. +
  4919. +/* Definitions for the cacheflush system call. */
  4920. +
  4921. +#define FLUSH_SCOPE_LINE 1 /* Flush a cache line */
  4922. +#define FLUSH_SCOPE_PAGE 2 /* Flush a page */
  4923. +#define FLUSH_SCOPE_ALL 3 /* Flush the whole cache -- superuser only */
  4924. +
  4925. +#define FLUSH_CACHE_DATA 1 /* Writeback and flush data cache */
  4926. +#define FLUSH_CACHE_INSN 2 /* Flush instruction cache */
  4927. +#define FLUSH_CACHE_BOTH 3 /* Flush both caches */
  4928. +
  4929. +#endif /* _NIOS2NOMMU_CACHECTL_H */
  4930. --- linux/include/asm-nios2nommu/cacheflush.h
  4931. +++ linux/include/asm-nios2nommu/cacheflush.h
  4932. @@ -0,0 +1,59 @@
  4933. +#ifndef _NIOS2NOMMU_CACHEFLUSH_H
  4934. +#define _NIOS2NOMMU_CACHEFLUSH_H
  4935. +
  4936. +/*
  4937. + * Ported from m68knommu.
  4938. + *
  4939. + * (C) Copyright 2003, Microtronix Datacom Ltd.
  4940. + * (C) Copyright 2000-2002, Greg Ungerer <gerg@snapgear.com>
  4941. + *
  4942. + * All rights reserved.
  4943. + *
  4944. + * This program is free software; you can redistribute it and/or modify
  4945. + * it under the terms of the GNU General Public License as published by
  4946. + * the Free Software Foundation; either version 2 of the License, or
  4947. + * (at your option) any later version.
  4948. + *
  4949. + * This program is distributed in the hope that it will be useful, but
  4950. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  4951. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  4952. + * NON INFRINGEMENT. See the GNU General Public License for more
  4953. + * details.
  4954. + *
  4955. + * You should have received a copy of the GNU General Public License
  4956. + * along with this program; if not, write to the Free Software
  4957. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  4958. + *
  4959. + */
  4960. +#include <linux/mm.h>
  4961. +
  4962. +extern void cache_push (unsigned long vaddr, int len);
  4963. +extern void dcache_push (unsigned long vaddr, int len);
  4964. +extern void icache_push (unsigned long vaddr, int len);
  4965. +extern void cache_push_all (void);
  4966. +extern void cache_clear (unsigned long paddr, int len);
  4967. +
  4968. +#define flush_cache_all() __flush_cache_all()
  4969. +#define flush_cache_mm(mm) do { } while (0)
  4970. +#define flush_cache_range(vma, start, end) cache_push(start, end - start)
  4971. +#define flush_cache_page(vma, vmaddr) do { } while (0)
  4972. +#define flush_dcache_range(start,end) dcache_push(start, end - start)
  4973. +#define flush_dcache_page(page) do { } while (0)
  4974. +#define flush_dcache_mmap_lock(mapping) do { } while (0)
  4975. +#define flush_dcache_mmap_unlock(mapping) do { } while (0)
  4976. +#define flush_icache_range(start,end) cache_push(start, end - start)
  4977. +#define flush_icache_page(vma,pg) do { } while (0)
  4978. +#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
  4979. +
  4980. +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
  4981. + memcpy(dst, src, len)
  4982. +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
  4983. + memcpy(dst, src, len)
  4984. +
  4985. +
  4986. +extern inline void __flush_cache_all(void)
  4987. +{
  4988. + cache_push_all();
  4989. +}
  4990. +
  4991. +#endif /* _NIOS2NOMMU_CACHEFLUSH_H */
  4992. --- linux/include/asm-nios2nommu/cache.h
  4993. +++ linux/include/asm-nios2nommu/cache.h
  4994. @@ -0,0 +1,34 @@
  4995. +/*
  4996. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  4997. + *
  4998. + * All rights reserved.
  4999. + *
  5000. + * This program is free software; you can redistribute it and/or modify
  5001. + * it under the terms of the GNU General Public License as published by
  5002. + * the Free Software Foundation; either version 2 of the License, or
  5003. + * (at your option) any later version.
  5004. + *
  5005. + * This program is distributed in the hope that it will be useful, but
  5006. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5007. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5008. + * NON INFRINGEMENT. See the GNU General Public License for more
  5009. + * details.
  5010. + *
  5011. + * You should have received a copy of the GNU General Public License
  5012. + * along with this program; if not, write to the Free Software
  5013. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5014. + *
  5015. + */
  5016. +#ifndef __ARCH_NIOS2NOMMU_CACHE_H
  5017. +#define __ARCH_NIOS2NOMMU_CACHE_H
  5018. +
  5019. +#include <asm/nios.h>
  5020. +
  5021. +/* bytes per L1 cache line */
  5022. +#define L1_CACHE_BYTES nasys_icache_line_size /* this need to be at least 1 */
  5023. +
  5024. +
  5025. +#define __cacheline_aligned
  5026. +#define ____cacheline_aligned
  5027. +
  5028. +#endif
  5029. --- linux/include/asm-nios2nommu/ChangeLog
  5030. +++ linux/include/asm-nios2nommu/ChangeLog
  5031. @@ -0,0 +1,14 @@
  5032. +2004-06-29 Ken Hill <khill@microtronix.com>
  5033. +
  5034. + * bitops.h (find_next_zero_bit): Fix problem with with masking for found_first
  5035. + handling. The masking of the upper bits for size < 32 bits would set all
  5036. + the bits to 1. Removing any zero's there may have been.
  5037. +
  5038. +2004-06-02 Ken Hill <khill@microtronix.com>
  5039. +
  5040. + * processor.h (TASK_SIZE): Change na_sdram_end to nasys_program_mem_end to remove
  5041. + dependancy on quartus memory component name.
  5042. +
  5043. + * page.h (PAGE_OFFSET): Change na_sdram to nasys_program_mem to remove
  5044. + dependancy on quartus memory component name.
  5045. +
  5046. --- linux/include/asm-nios2nommu/checksum.h
  5047. +++ linux/include/asm-nios2nommu/checksum.h
  5048. @@ -0,0 +1,320 @@
  5049. +#ifndef __NIOS2_CHECKSUM_H
  5050. +#define __NIOS2_CHECKSUM_H
  5051. +
  5052. +/* checksum.h: IP/UDP/TCP checksum routines on the NIOS.
  5053. + *
  5054. + * Copyright(C) 1995 Linus Torvalds
  5055. + * Copyright(C) 1995 Miguel de Icaza
  5056. + * Copyright(C) 1996 David S. Miller
  5057. + * Copyright(C) 2001 Ken Hill
  5058. + * Copyright(C) 2004 Microtronix Datacom Ltd.
  5059. + *
  5060. + * derived from:
  5061. + * Alpha checksum c-code
  5062. + * ix86 inline assembly
  5063. + * Spar nommu
  5064. + *
  5065. + * All rights reserved.
  5066. + *
  5067. + * This program is free software; you can redistribute it and/or modify
  5068. + * it under the terms of the GNU General Public License as published by
  5069. + * the Free Software Foundation; either version 2 of the License, or
  5070. + * (at your option) any later version.
  5071. + *
  5072. + * This program is distributed in the hope that it will be useful, but
  5073. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5074. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5075. + * NON INFRINGEMENT. See the GNU General Public License for more
  5076. + * details.
  5077. + *
  5078. + * You should have received a copy of the GNU General Public License
  5079. + * along with this program; if not, write to the Free Software
  5080. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5081. + *
  5082. + */
  5083. +
  5084. +
  5085. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  5086. +
  5087. +/*
  5088. + * computes the checksum of the TCP/UDP pseudo-header
  5089. + * returns a 16-bit checksum, already complemented
  5090. + */
  5091. +
  5092. +extern inline unsigned short csum_tcpudp_magic(unsigned long saddr,
  5093. + unsigned long daddr,
  5094. + unsigned short len,
  5095. + unsigned short proto,
  5096. + unsigned int sum)
  5097. +{
  5098. + barrier();
  5099. + __asm__ __volatile__(
  5100. +" add %0, %3, %0\n"
  5101. +" bgeu %0, %3, 1f\n"
  5102. +" addi %0, %0, 1\n"
  5103. +"1: add %0, %4, %0\n"
  5104. +" bgeu %0, %4, 1f\n"
  5105. +" addi %0, %0, 1\n"
  5106. +"1: add %0, %5, %0\n"
  5107. +" bgeu %0, %5, 1f\n"
  5108. +" addi %0, %0, 1\n"
  5109. +"1:\n"
  5110. +/*
  5111. + We need the carry from the addition of 16-bit
  5112. + significant addition, so we zap out the low bits
  5113. + in one half, zap out the high bits in another,
  5114. + shift them both up to the top 16-bits of a word
  5115. + and do the carry producing addition, finally
  5116. + shift the result back down to the low 16-bits.
  5117. +
  5118. + Actually, we can further optimize away two shifts
  5119. + because we know the low bits of the original
  5120. + value will be added to zero-only bits so cannot
  5121. + affect the addition result nor the final carry
  5122. + bit.
  5123. +*/
  5124. +" slli %1,%0, 16\n" /* Need a copy to fold with */
  5125. + /* Bring the LOW 16 bits up */
  5126. +" add %0, %1, %0\n" /* add and set carry, neat eh? */
  5127. +" cmpltu r15, %0, %1\n" /* get remaining carry bit */
  5128. +" srli %0, %0, 16\n" /* shift back down the result */
  5129. +" add %0, %0, r15\n"
  5130. +" nor %0, %0, %0\n" /* negate */
  5131. + : "=&r" (sum), "=&r" (saddr)
  5132. + : "0" (sum), "1" (saddr), "r" (ntohl(len+proto)), "r" (daddr)
  5133. + : "r15");
  5134. + return ((unsigned short) sum);
  5135. + barrier();
  5136. +}
  5137. +
  5138. +
  5139. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  5140. +
  5141. +
  5142. + extern inline unsigned short from32to16(unsigned long x)
  5143. + {
  5144. + barrier();
  5145. + __asm__ __volatile__(
  5146. + "add %0, %1, %0\n"
  5147. + "cmpltu r15, %0, %1\n"
  5148. + "srli %0, %0, 16\n"
  5149. + "add %0, %0, r15\n"
  5150. + : "=r" (x)
  5151. + : "r" (x << 16), "0" (x)
  5152. + : "r15");
  5153. + return x;
  5154. + barrier();
  5155. + }
  5156. +
  5157. +
  5158. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  5159. +
  5160. +
  5161. +extern inline unsigned long do_csum(const unsigned char * buff, int len)
  5162. +{
  5163. + int odd, count;
  5164. + unsigned long result = 0;
  5165. +
  5166. + barrier();
  5167. + if (len <= 0)
  5168. + goto out;
  5169. + odd = 1 & (unsigned long) buff;
  5170. + if (odd) {
  5171. +////result = *buff; // dgt: Big endian
  5172. + result = *buff << 8; // dgt: Little endian
  5173. +
  5174. + len--;
  5175. + buff++;
  5176. + }
  5177. + count = len >> 1; /* nr of 16-bit words.. */
  5178. + if (count) {
  5179. + if (2 & (unsigned long) buff) {
  5180. + result += *(unsigned short *) buff;
  5181. + count--;
  5182. + len -= 2;
  5183. + buff += 2;
  5184. + }
  5185. + count >>= 1; /* nr of 32-bit words.. */
  5186. + if (count) {
  5187. + unsigned long carry = 0;
  5188. + do {
  5189. + unsigned long w = *(unsigned long *) buff;
  5190. + count--;
  5191. + buff += 4;
  5192. + result += carry;
  5193. + result += w;
  5194. + carry = (w > result);
  5195. + } while (count);
  5196. + result += carry;
  5197. + result = (result & 0xffff) + (result >> 16);
  5198. + }
  5199. + if (len & 2) {
  5200. + result += *(unsigned short *) buff;
  5201. + buff += 2;
  5202. + }
  5203. + }
  5204. + if (len & 1)
  5205. + result += *buff; /* This is little machine, byte is right */
  5206. + result = from32to16(result);
  5207. + if (odd)
  5208. + result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
  5209. +out:
  5210. + return result;
  5211. + barrier();
  5212. + }
  5213. +
  5214. +
  5215. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  5216. +
  5217. +
  5218. +/* ihl is always 5 or greater, almost always is 5, iph is always word
  5219. + * aligned but can fail to be dword aligned very often.
  5220. + */
  5221. +
  5222. + extern inline unsigned short ip_fast_csum(const unsigned char *iph, unsigned int ihl)
  5223. + {
  5224. + unsigned int sum;
  5225. +
  5226. + barrier();
  5227. + __asm__ __volatile__(
  5228. +" andi r8, %1, 2\n" /* Remember original alignment */
  5229. +" ldw %0, (%1)\n" /* 16 or 32 bit boundary */
  5230. +" beq r8, r0, 1f\n" /* Aligned on 32 bit boundary, go */
  5231. +" srli %0, %0, 16\n" /* Get correct 16 bits */
  5232. +" addi %2, %2, -1\n" /* Take off for 4 bytes, pickup last 2 at end */
  5233. +" addi %1, %1, 2\n" /* Adjust pointer to 32 bit boundary */
  5234. +" br 2f\n"
  5235. +"1:\n"
  5236. +" addi %2, %2, -1\n"
  5237. +" addi %1, %1, 4\n" /* Bump ptr a long word */
  5238. +"2:\n"
  5239. +" ldw r9, (%1)\n"
  5240. +"1:\n"
  5241. +" add %0, r9, %0\n"
  5242. +" bgeu %0, r9, 2f\n"
  5243. +" addi %0, %0, 1\n"
  5244. +"2:\n"
  5245. +" addi %1, %1, 4\n"
  5246. +" addi %2, %2, -1\n"
  5247. +" ldw r9, (%1)\n"
  5248. +" bne %2, r0, 1b\n"
  5249. +" beq r8, r0, 1f\n" /* 32 bit boundary time to leave */
  5250. +" srli r9, r9, 16\n" /* 16 bit boundary, get correct 16 bits */
  5251. +" add %0, r9, %0\n"
  5252. +" bgeu %0, r9, 1f\n"
  5253. +" addi %0, %0, 1\n"
  5254. +"1:\n"
  5255. +" slli %2, %0, 16\n"
  5256. +" add %0, %2, %0\n"
  5257. +" cmpltu r8, %0, %2\n"
  5258. +" srli %0, %0, 16\n"
  5259. +" add %0, %0, r8\n"
  5260. +" nor %0, %0, %0\n"
  5261. + : "=&r" (sum), "=&r" (iph), "=&r" (ihl)
  5262. + : "1" (iph), "2" (ihl)
  5263. + : "r8", "r9");
  5264. + return sum;
  5265. + barrier();
  5266. + }
  5267. +
  5268. +/*these 2 functions are now in checksum.c */
  5269. +unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum);
  5270. +unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum);
  5271. +
  5272. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  5273. +
  5274. +/*
  5275. + * the same as csum_partial_copy, but copies from user space.
  5276. + *
  5277. + * here even more important to align src and dst on a 32-bit (or even
  5278. + * better 64-bit) boundary
  5279. + */
  5280. +extern inline unsigned int
  5281. +csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *csum_err)
  5282. +{
  5283. + barrier();
  5284. + if (csum_err) *csum_err = 0;
  5285. + memcpy(dst, src, len);
  5286. + return csum_partial(dst, len, sum);
  5287. + barrier();
  5288. +}
  5289. +
  5290. +#define csum_partial_copy_nocheck(src, dst, len, sum) \
  5291. + csum_partial_copy ((src), (dst), (len), (sum))
  5292. +
  5293. +
  5294. +/*
  5295. + * this routine is used for miscellaneous IP-like checksums, mainly
  5296. + * in icmp.c
  5297. + */
  5298. +
  5299. +extern inline unsigned short ip_compute_csum(unsigned char * buff, int len)
  5300. +{
  5301. + barrier();
  5302. + return ~from32to16(do_csum(buff,len));
  5303. + barrier();
  5304. +}
  5305. +
  5306. +
  5307. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  5308. +
  5309. +
  5310. +#define csum_partial_copy_fromuser(s, d, l, w) \
  5311. + csum_partial_copy((char *) (s), (d), (l), (w))
  5312. +
  5313. +
  5314. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  5315. +
  5316. +
  5317. +/*
  5318. + * Fold a partial checksum without adding pseudo headers
  5319. + */
  5320. +extern __inline__ unsigned int csum_fold(unsigned int sum)
  5321. +{
  5322. + barrier();
  5323. + __asm__ __volatile__(
  5324. + "add %0, %1, %0\n"
  5325. + "cmpltu r8, %0, %1\n"
  5326. + "srli %0, %0, 16\n"
  5327. + "add %0, %0, r8\n"
  5328. + "nor %0, %0, %0\n"
  5329. + : "=r" (sum)
  5330. + : "r" (sum << 16), "0" (sum)
  5331. + : "r8");
  5332. + return sum;
  5333. + barrier();
  5334. +}
  5335. +
  5336. +
  5337. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  5338. +
  5339. +
  5340. +extern __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr,
  5341. + unsigned long daddr,
  5342. + unsigned short len,
  5343. + unsigned short proto,
  5344. + unsigned int sum)
  5345. +{
  5346. + barrier();
  5347. + __asm__ __volatile__(
  5348. + "add %0, %1, %0\n"
  5349. + "cmpltu r8, %0, %1\n"
  5350. + "add %0, %0, r8\n" /* add carry */
  5351. + "add %0, %2, %0\n"
  5352. + "cmpltu r8, %0, %2\n"
  5353. + "add %0, %0, r8\n" /* add carry */
  5354. + "add %0, %3, %0\n"
  5355. + "cmpltu r8, %0, %3\n"
  5356. + "add %0, %0, r8\n" /* add carry */
  5357. + : "=r" (sum), "=r" (saddr)
  5358. + : "r" (daddr), "r" ( (ntohs(len)<<16) + (proto*256) ),
  5359. + "0" (sum),
  5360. + "1" (saddr)
  5361. + : "r8");
  5362. +
  5363. + return sum;
  5364. + barrier();
  5365. +}
  5366. +
  5367. +
  5368. +#endif /* (__NIOS2_CHECKSUM_H) */
  5369. --- linux/include/asm-nios2nommu/cprefix.h
  5370. +++ linux/include/asm-nios2nommu/cprefix.h
  5371. @@ -0,0 +1,38 @@
  5372. +/* cprefix.h: This file is included by assembly source which needs
  5373. + * to know what the c-label prefixes are. The newer versions
  5374. + * of cpp that come with gcc predefine such things to help
  5375. + * us out. The reason this stuff is needed is to make
  5376. + * solaris compiles of the kernel work.
  5377. + *
  5378. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  5379. + * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  5380. + *
  5381. + * All rights reserved.
  5382. + *
  5383. + * This program is free software; you can redistribute it and/or modify
  5384. + * it under the terms of the GNU General Public License as published by
  5385. + * the Free Software Foundation; either version 2 of the License, or
  5386. + * (at your option) any later version.
  5387. + *
  5388. + * This program is distributed in the hope that it will be useful, but
  5389. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5390. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5391. + * NON INFRINGEMENT. See the GNU General Public License for more
  5392. + * details.
  5393. + *
  5394. + * You should have received a copy of the GNU General Public License
  5395. + * along with this program; if not, write to the Free Software
  5396. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5397. + *
  5398. + */
  5399. +#ifndef __NIOS2_CPREFIX_H
  5400. +#define __NIOS2_CPREFIX_H
  5401. +
  5402. +#define C_LABEL_PREFIX
  5403. +
  5404. +#define CONCAT(a, b) CONCAT2(a, b)
  5405. +#define CONCAT2(a, b) a##b
  5406. +
  5407. +#define C_LABEL(name) CONCAT(C_LABEL_PREFIX, name)
  5408. +
  5409. +#endif /* !(__NIOS2_CPREFIX_H) */
  5410. --- linux/include/asm-nios2nommu/cpumask.h
  5411. +++ linux/include/asm-nios2nommu/cpumask.h
  5412. @@ -0,0 +1,28 @@
  5413. +/*
  5414. + * All rights reserved.
  5415. + *
  5416. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  5417. + *
  5418. + * This program is free software; you can redistribute it and/or modify
  5419. + * it under the terms of the GNU General Public License as published by
  5420. + * the Free Software Foundation; either version 2 of the License, or
  5421. + * (at your option) any later version.
  5422. + *
  5423. + * This program is distributed in the hope that it will be useful, but
  5424. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5425. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5426. + * NON INFRINGEMENT. See the GNU General Public License for more
  5427. + * details.
  5428. + *
  5429. + * You should have received a copy of the GNU General Public License
  5430. + * along with this program; if not, write to the Free Software
  5431. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5432. + *
  5433. + */
  5434. +
  5435. +#ifndef _ASM_NIOS2NOMMU_CPUMASK_H
  5436. +#define _ASM_NIOS2NOMMU_CPUMASK_H
  5437. +
  5438. +#include <asm-generic/cpumask.h>
  5439. +
  5440. +#endif /* _ASM_NIOS2NOMMU_CPUMASK_H */
  5441. --- linux/include/asm-nios2nommu/cputime.h
  5442. +++ linux/include/asm-nios2nommu/cputime.h
  5443. @@ -0,0 +1,31 @@
  5444. +/*
  5445. + * cputime.h
  5446. + * (C) Copyright 2004, Microtronix Datacom Ltd.
  5447. + *
  5448. + * Taken from m68knommu
  5449. + *
  5450. + * All rights reserved.
  5451. + *
  5452. + * This program is free software; you can redistribute it and/or modify
  5453. + * it under the terms of the GNU General Public License as published by
  5454. + * the Free Software Foundation; either version 2 of the License, or
  5455. + * (at your option) any later version.
  5456. + *
  5457. + * This program is distributed in the hope that it will be useful, but
  5458. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5459. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5460. + * NON INFRINGEMENT. See the GNU General Public License for more
  5461. + * details.
  5462. + *
  5463. + * You should have received a copy of the GNU General Public License
  5464. + * along with this program; if not, write to the Free Software
  5465. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5466. + *
  5467. + */
  5468. +
  5469. +#ifndef __NIOS2NOMMU_CPUTIME_H
  5470. +#define __NIOS2NOMMU_CPUTIME_H
  5471. +
  5472. +#include <asm-generic/cputime.h>
  5473. +
  5474. +#endif /* __NIOS@NOMMU_CPUTIME_H */
  5475. --- linux/include/asm-nios2nommu/current.h
  5476. +++ linux/include/asm-nios2nommu/current.h
  5477. @@ -0,0 +1,39 @@
  5478. +#ifndef _NIOS2NOMMU_CURRENT_H
  5479. +#define _NIOS2NOMMU_CURRENT_H
  5480. +/*
  5481. + * current.h
  5482. + * (C) Copyright 2000, Lineo, David McCullough <davidm@uclinux.org>
  5483. + * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
  5484. + * (C) Copyright 2004, Microtronix Datacom Ltd.
  5485. + *
  5486. + * All rights reserved.
  5487. + *
  5488. + * This program is free software; you can redistribute it and/or modify
  5489. + * it under the terms of the GNU General Public License as published by
  5490. + * the Free Software Foundation; either version 2 of the License, or
  5491. + * (at your option) any later version.
  5492. + *
  5493. + * This program is distributed in the hope that it will be useful, but
  5494. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5495. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5496. + * NON INFRINGEMENT. See the GNU General Public License for more
  5497. + * details.
  5498. + *
  5499. + * You should have received a copy of the GNU General Public License
  5500. + * along with this program; if not, write to the Free Software
  5501. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5502. + *
  5503. + */
  5504. +
  5505. +#include <linux/thread_info.h>
  5506. +
  5507. +struct task_struct;
  5508. +
  5509. +static inline struct task_struct *get_current(void)
  5510. +{
  5511. + return(current_thread_info()->task);
  5512. +}
  5513. +
  5514. +#define current get_current()
  5515. +
  5516. +#endif /* _NIOS2NOMMU_CURRENT_H */
  5517. --- linux/include/asm-nios2nommu/delay.h
  5518. +++ linux/include/asm-nios2nommu/delay.h
  5519. @@ -0,0 +1,96 @@
  5520. +#ifndef _NIOS_DELAY_H
  5521. +#define _NIOS_DELAY_H
  5522. +
  5523. +/*--------------------------------------------------------------------
  5524. + *
  5525. + * include/asm-nios2nommu/delay.h
  5526. + *
  5527. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  5528. + *
  5529. + * Copyright (C) 2004 Microtronix Datacom Ltd
  5530. + *
  5531. + * This program is free software; you can redistribute it and/or modify
  5532. + * it under the terms of the GNU General Public License as published by
  5533. + * the Free Software Foundation; either version 2 of the License, or
  5534. + * (at your option) any later version.
  5535. + *
  5536. + * This program is distributed in the hope that it will be useful,
  5537. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5538. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  5539. + * GNU General Public License for more details.
  5540. + *
  5541. + *
  5542. + * Jan/20/2004 dgt NiosII
  5543. + *
  5544. + ---------------------------------------------------------------------*/
  5545. +
  5546. +
  5547. +#include <asm/param.h>
  5548. +
  5549. +extern __inline__ void __delay(unsigned long loops)
  5550. +{
  5551. + int dummy;
  5552. +
  5553. + __asm__ __volatile__(
  5554. + "1: \n\t"
  5555. + " beq %0,zero,2f\n\t"
  5556. + " addi %0, %0, -1\n\t"
  5557. + " br 1b\n\t"
  5558. + "2: \n\t"
  5559. +
  5560. + : "=r" (dummy) /* Need output for optimizer */
  5561. +
  5562. + : "0" (loops) /* %0 Input */
  5563. + );
  5564. +}
  5565. +
  5566. +/*
  5567. + * Note that 19 * 226 == 4294 ==~ 2^32 / 10^6, so
  5568. + * loops = (4294 * usecs * loops_per_jiffy * HZ) / 2^32.
  5569. + *
  5570. + * The mul instruction gives us loops = (a * b) / 2^32.
  5571. + * We choose a = usecs * 19 * HZ and b = loops_per_jiffy * 226
  5572. + * because this lets us support a wide range of HZ and
  5573. + * loops_per_jiffy values without either a or b overflowing 2^32.
  5574. + * Thus we need usecs * HZ <= (2^32 - 1) / 19 = 226050910 and
  5575. + * loops_per_jiffy <= (2^32 - 1) / 226 = 19004280
  5576. + * (which corresponds to ~3800 bogomips at HZ = 100).
  5577. + * -- paulus
  5578. + */
  5579. +#define __MAX_UDELAY (226050910UL/HZ) /* maximum udelay argument */
  5580. +#define __MAX_NDELAY (4294967295UL/HZ) /* maximum ndelay argument */
  5581. +
  5582. +extern unsigned long loops_per_jiffy;
  5583. +
  5584. +extern __inline__ void __udelay(unsigned int x)
  5585. +{
  5586. + unsigned int loops;
  5587. +
  5588. + __asm__("mulxuu %0,%1,%2" : "=r" (loops) :
  5589. + "r" (x), "r" (loops_per_jiffy * 226));
  5590. + __delay(loops);
  5591. +}
  5592. +
  5593. +extern __inline__ void __ndelay(unsigned int x)
  5594. +{
  5595. + unsigned int loops;
  5596. +
  5597. + __asm__("mulxuu %0,%1,%2" : "=r" (loops) :
  5598. + "r" (x), "r" (loops_per_jiffy * 5));
  5599. + __delay(loops);
  5600. +}
  5601. +
  5602. +extern void __bad_udelay(void); /* deliberately undefined */
  5603. +extern void __bad_ndelay(void); /* deliberately undefined */
  5604. +
  5605. +#define udelay(n) (__builtin_constant_p(n)? \
  5606. + ((n) > __MAX_UDELAY? __bad_udelay(): __udelay((n) * (19 * HZ))) : \
  5607. + __udelay((n) * (19 * HZ)))
  5608. +
  5609. +#define ndelay(n) (__builtin_constant_p(n)? \
  5610. + ((n) > __MAX_NDELAY? __bad_ndelay(): __ndelay((n) * HZ)) : \
  5611. + __ndelay((n) * HZ))
  5612. +
  5613. +#define muldiv(a, b, c) (((a)*(b))/(c))
  5614. +
  5615. +#endif /* defined(_NIOS_DELAY_H) */
  5616. --- linux/include/asm-nios2nommu/div64.h
  5617. +++ linux/include/asm-nios2nommu/div64.h
  5618. @@ -0,0 +1,31 @@
  5619. +#ifndef __ASMNIOS_DIV64_H
  5620. +#define __ASMNIOS_DIV64_H
  5621. +
  5622. +/*--------------------------------------------------------------------
  5623. + *
  5624. + * include/asm-nios2nommu/div64.h
  5625. + *
  5626. + * Derived from m68knommu
  5627. + *
  5628. + * Copyright (C) 2004 Microtronix Datacom Ltd
  5629. + *
  5630. + * This program is free software; you can redistribute it and/or modify
  5631. + * it under the terms of the GNU General Public License as published by
  5632. + * the Free Software Foundation; either version 2 of the License, or
  5633. + * (at your option) any later version.
  5634. + *
  5635. + * This program is distributed in the hope that it will be useful,
  5636. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5637. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  5638. + * GNU General Public License for more details.
  5639. + *
  5640. + *
  5641. + * Jan/20/2004 dgt NiosII
  5642. + *
  5643. + ---------------------------------------------------------------------*/
  5644. +
  5645. +
  5646. +#include <asm-generic/div64.h>
  5647. +
  5648. +#endif
  5649. +
  5650. --- linux/include/asm-nios2nommu/dma.h
  5651. +++ linux/include/asm-nios2nommu/dma.h
  5652. @@ -0,0 +1,57 @@
  5653. +/* $Id: dma.h,v 1.6 2005/04/07 21:00:26 wentao Exp $
  5654. + *
  5655. + * Copyright 2004 (C) Microtronix Datacom Ltd.
  5656. + *
  5657. + * All rights reserved.
  5658. + *
  5659. + * This program is free software; you can redistribute it and/or modify
  5660. + * it under the terms of the GNU General Public License as published by
  5661. + * the Free Software Foundation; either version 2 of the License, or
  5662. + * (at your option) any later version.
  5663. + *
  5664. + * This program is distributed in the hope that it will be useful, but
  5665. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5666. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5667. + * NON INFRINGEMENT. See the GNU General Public License for more
  5668. + * details.
  5669. + *
  5670. + * You should have received a copy of the GNU General Public License
  5671. + * along with this program; if not, write to the Free Software
  5672. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5673. + *
  5674. + */
  5675. +
  5676. +#ifndef _ASM_NIOS2_DMA_H
  5677. +#define _ASM_NIOS2_DMA_H
  5678. +
  5679. +#include <linux/kernel.h>
  5680. +#include <asm/asm-offsets.h>
  5681. +
  5682. +#define MAX_DMA_ADDRESS (LINUX_SDRAM_END)
  5683. +
  5684. +int request_dma(unsigned int, const char *);
  5685. +void free_dma(unsigned int);
  5686. +void enable_dma(unsigned int dmanr);
  5687. +void disable_dma(unsigned int dmanr);
  5688. +void set_dma_count(unsigned int dmanr, unsigned int count);
  5689. +int get_dma_residue(unsigned int dmanr);
  5690. +void nios2_set_dma_data_width(unsigned int dmanr, unsigned int width);
  5691. +
  5692. +void nios2_set_dma_handler(unsigned int dmanr, int (*handler)(void*, int), void* user);
  5693. +int nios2_request_dma(const char *);
  5694. +
  5695. +void nios2_set_dma_mode(unsigned int dmanr, unsigned int mode);
  5696. +void nios2_set_dma_rcon(unsigned int dmanr, unsigned int set);
  5697. +void nios2_set_dma_wcon(unsigned int dmanr, unsigned int set);
  5698. +void nios2_set_dma_raddr(unsigned int dmanr, unsigned int a);
  5699. +void nios2_set_dma_waddr(unsigned int dmanr, unsigned int a);
  5700. +
  5701. +static inline unsigned long claim_dma_lock(void)
  5702. +{
  5703. +}
  5704. +
  5705. +static inline void release_dma_lock(unsigned long flags)
  5706. +{
  5707. +}
  5708. +
  5709. +#endif /* !(_ASM_NIOS2_DMA_H) */
  5710. --- linux/include/asm-nios2nommu/dma-mapping.h
  5711. +++ linux/include/asm-nios2nommu/dma-mapping.h
  5712. @@ -0,0 +1,133 @@
  5713. +/*
  5714. + * include/asm-nios2nommu/dma-mapping.h
  5715. + *
  5716. + * This file exists so that #include <dma-mapping.h> doesn't break anything.
  5717. + */
  5718. +
  5719. +#ifndef _ASM_DMA_MAPPING_H
  5720. +#define _ASM_DMA_MAPPING_H
  5721. +
  5722. +#include <asm/scatterlist.h>
  5723. +#include <linux/mm.h>
  5724. +#include <asm/io.h>
  5725. +#include <asm/cacheflush.h>
  5726. +
  5727. +static inline void *dma_alloc_coherent(struct device *dev, size_t size,
  5728. + dma_addr_t *dma_handle, int flag)
  5729. +{
  5730. + BUG();
  5731. + return 0;
  5732. +}
  5733. +
  5734. +static inline void dma_free_coherent(struct device *dev, size_t size,
  5735. + void *vaddr, dma_addr_t dma_handle)
  5736. +{
  5737. + BUG();
  5738. +}
  5739. +
  5740. +/**
  5741. + * dma_map_single - map a single buffer for streaming DMA
  5742. + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
  5743. + * @cpu_addr: CPU direct mapped address of buffer
  5744. + * @size: size of buffer to map
  5745. + * @dir: DMA transfer direction
  5746. + *
  5747. + * Ensure that any data held in the cache is appropriately discarded
  5748. + * or written back.
  5749. + *
  5750. + * The device owns this memory once this call has completed. The CPU
  5751. + * can regain ownership by calling dma_unmap_single() or
  5752. + * dma_sync_single_for_cpu().
  5753. + */
  5754. +static inline dma_addr_t
  5755. +dma_map_single(struct device *dev, void *cpu_addr, size_t size,
  5756. + enum dma_data_direction dir)
  5757. +{
  5758. + cache_push ((unsigned long)cpu_addr, size);
  5759. + return virt_to_bus((unsigned long)cpu_addr);
  5760. +}
  5761. +
  5762. +/**
  5763. + * dma_unmap_single - unmap a single buffer previously mapped
  5764. + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
  5765. + * @handle: DMA address of buffer
  5766. + * @size: size of buffer to map
  5767. + * @dir: DMA transfer direction
  5768. + *
  5769. + * Unmap a single streaming mode DMA translation. The handle and size
  5770. + * must match what was provided in the previous dma_map_single() call.
  5771. + * All other usages are undefined.
  5772. + *
  5773. + * After this call, reads by the CPU to the buffer are guaranteed to see
  5774. + * whatever the device wrote there.
  5775. + */
  5776. +static inline void
  5777. +dma_unmap_single(struct device *dev, dma_addr_t handle, size_t size,
  5778. + enum dma_data_direction dir)
  5779. +{
  5780. + cache_clear((unsigned long)bus_to_virt(handle), size);
  5781. +}
  5782. +
  5783. +/**
  5784. + * dma_map_sg - map a set of SG buffers for streaming mode DMA
  5785. + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
  5786. + * @sg: list of buffers
  5787. + * @nents: number of buffers to map
  5788. + * @dir: DMA transfer direction
  5789. + *
  5790. + * Map a set of buffers described by scatterlist in streaming
  5791. + * mode for DMA. This is the scatter-gather version of the
  5792. + * above dma_map_single interface. Here the scatter gather list
  5793. + * elements are each tagged with the appropriate dma address
  5794. + * and length. They are obtained via sg_dma_{address,length}(SG).
  5795. + *
  5796. + * NOTE: An implementation may be able to use a smaller number of
  5797. + * DMA address/length pairs than there are SG table elements.
  5798. + * (for example via virtual mapping capabilities)
  5799. + * The routine returns the number of addr/length pairs actually
  5800. + * used, at most nents.
  5801. + *
  5802. + * Device ownership issues as mentioned above for dma_map_single are
  5803. + * the same here.
  5804. + */
  5805. +static inline int
  5806. +dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
  5807. + enum dma_data_direction dir)
  5808. +{
  5809. + int i;
  5810. +
  5811. + for (i = 0; i < nents; i++, sg++) {
  5812. + char *virt;
  5813. +
  5814. + sg->dma_address = page_to_bus(sg->page) + sg->offset;
  5815. + virt = page_address(sg->page) + sg->offset;
  5816. + cache_push ((unsigned long)virt, sg->length);
  5817. + }
  5818. +
  5819. + return nents;
  5820. +}
  5821. +
  5822. +/**
  5823. + * dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
  5824. + * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
  5825. + * @sg: list of buffers
  5826. + * @nents: number of buffers to map
  5827. + * @dir: DMA transfer direction
  5828. + *
  5829. + * Unmap a set of streaming mode DMA translations.
  5830. + * Again, CPU read rules concerning calls here are the same as for
  5831. + * dma_unmap_single() above.
  5832. + */
  5833. +static inline void
  5834. +dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
  5835. + enum dma_data_direction dir)
  5836. +{
  5837. + int i;
  5838. +
  5839. + for (i = 0; i < nents; i++, sg++) {
  5840. + char *virt;
  5841. + virt = page_address(sg->page) + sg->offset;
  5842. + cache_clear ((unsigned long)virt, sg->length);
  5843. + }
  5844. +}
  5845. +#endif /* _ASM_DMA_MAPPING_H */
  5846. --- linux/include/asm-nios2nommu/elf.h
  5847. +++ linux/include/asm-nios2nommu/elf.h
  5848. @@ -0,0 +1,141 @@
  5849. +#ifndef __NIOS2_ELF_H
  5850. +#define __NIOS2_ELF_H
  5851. +
  5852. +/*--------------------------------------------------------------------
  5853. + *
  5854. + * include/asm-nios2nommu/elf.h
  5855. + *
  5856. + * Nio2 ELF relocation types
  5857. + *
  5858. + * Derived from M68knommu
  5859. + *
  5860. + * Copyright (C) 2004 Microtronix Datacom Ltd
  5861. + *
  5862. + * This program is free software; you can redistribute it and/or modify
  5863. + * it under the terms of the GNU General Public License as published by
  5864. + * the Free Software Foundation; either version 2 of the License, or
  5865. + * (at your option) any later version.
  5866. + *
  5867. + * This program is distributed in the hope that it will be useful,
  5868. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5869. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  5870. + * GNU General Public License for more details.
  5871. + *
  5872. + * Jan/20/2004 dgt NiosII
  5873. + * Mar/18/2004 xwt NiosII relocation types added
  5874. + *
  5875. + ---------------------------------------------------------------------*/
  5876. +
  5877. +// #include <linux/config.h>
  5878. +#include <asm/ptrace.h>
  5879. +#include <asm/user.h>
  5880. +
  5881. +#define R_NIOS2_NONE 0
  5882. +#define R_NIOS2_S16 1
  5883. +#define R_NIOS2_U16 2
  5884. +#define R_NIOS2_PCREL16 3
  5885. +#define R_NIOS2_CALL26 4
  5886. +#define R_NIOS2_IMM5 5
  5887. +#define R_NIOS2_CACHE_OPX 6
  5888. +#define R_NIOS2_IMM6 7
  5889. +#define R_NIOS2_IMM8 8
  5890. +#define R_NIOS2_HI16 9
  5891. +#define R_NIOS2_LO16 10
  5892. +#define R_NIOS2_HIADJ16 11
  5893. +#define R_NIOS2_BFD_RELOC_32 12
  5894. +#define R_NIOS2_BFD_RELOC_16 13
  5895. +#define R_NIOS2_BFD_RELOC_8 14
  5896. +#define R_NIOS2_GPREL 15
  5897. +#define R_NIOS2_GNU_VTINHERIT 16
  5898. +#define R_NIOS2_GNU_VTENTRY 17
  5899. +#define R_NIOS2_UJMP 18
  5900. +#define R_NIOS2_CJMP 19
  5901. +#define R_NIOS2_CALLR 20
  5902. +#define R_NIOS2_ALIGN 21
  5903. +/* Keep this the last entry. */
  5904. +#define R_NIOS2_NUM 22
  5905. +
  5906. +typedef unsigned long elf_greg_t;
  5907. +
  5908. +#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
  5909. +typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  5910. +
  5911. +typedef unsigned long elf_fpregset_t;
  5912. +
  5913. +/*
  5914. + * This is used to ensure we don't load something for the wrong architecture.
  5915. + */
  5916. +#define elf_check_arch(x) \
  5917. + ((x)->e_machine == EM_ALTERA_NIOS2)
  5918. +
  5919. +/*
  5920. + * These are used to set parameters in the core dumps.
  5921. + */
  5922. +#define ELF_CLASS ELFCLASS32
  5923. +#define ELF_DATA ELFDATA2LSB
  5924. +#define ELF_ARCH EM_ALTERA_NIOS2
  5925. +
  5926. +#define ELF_PLAT_INIT(_r, load_addr) _r->a1 = 0
  5927. +
  5928. +#define USE_ELF_CORE_DUMP
  5929. +#define ELF_EXEC_PAGESIZE 4096
  5930. +
  5931. +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
  5932. + use of this is to invoke "./ld.so someprog" to test out a new version of
  5933. + the loader. We need to make sure that it is out of the way of the program
  5934. + that it will "exec", and that there is sufficient room for the brk. */
  5935. +
  5936. +#define ELF_ET_DYN_BASE 0xD0000000UL
  5937. +
  5938. +/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
  5939. + now struct_user_regs, they are different) */
  5940. +
  5941. +#define ELF_CORE_COPY_REGS(pr_reg, regs) \
  5942. + /* Bleech. */ \
  5943. + pr_reg[0] = regs->r1; \
  5944. + pr_reg[1] = regs->r2; \
  5945. + pr_reg[2] = regs->r3; \
  5946. + pr_reg[3] = regs->r4; \
  5947. + pr_reg[4] = regs->r5; \
  5948. + pr_reg[5] = regs->r6; \
  5949. + pr_reg[6] = regs->r7; \
  5950. + pr_reg[7] = regs->r8; \
  5951. + pr_reg[8] = regs->r9; \
  5952. + pr_reg[9] = regs->r10; \
  5953. + pr_reg[10] = regs->r11; \
  5954. + pr_reg[11] = regs->r12; \
  5955. + pr_reg[12] = regs->r13; \
  5956. + pr_reg[13] = regs->r14; \
  5957. + pr_reg[14] = regs->r15; \
  5958. + pr_reg[23] = regs->sp; \
  5959. + pr_reg[26] = regs->estatus; \
  5960. + { \
  5961. + struct switch_stack *sw = ((struct switch_stack *)regs) - 1; \
  5962. + pr_reg[15] = sw->r16; \
  5963. + pr_reg[16] = sw->r17; \
  5964. + pr_reg[17] = sw->r18; \
  5965. + pr_reg[18] = sw->r19; \
  5966. + pr_reg[19] = sw->r20; \
  5967. + pr_reg[20] = sw->r21; \
  5968. + pr_reg[21] = sw->r22; \
  5969. + pr_reg[22] = sw->r23; \
  5970. + pr_reg[24] = sw->fp; \
  5971. + pr_reg[25] = sw->gp; \
  5972. + }
  5973. +
  5974. +/* This yields a mask that user programs can use to figure out what
  5975. + instruction set this cpu supports. */
  5976. +
  5977. +#define ELF_HWCAP (0)
  5978. +
  5979. +/* This yields a string that ld.so will use to load implementation
  5980. + specific libraries for optimization. This is more specific in
  5981. + intent than poking at uname or /proc/cpuinfo. */
  5982. +
  5983. +#define ELF_PLATFORM (NULL)
  5984. +
  5985. +#ifdef __KERNEL__
  5986. +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
  5987. +#endif
  5988. +
  5989. +#endif
  5990. --- linux/include/asm-nios2nommu/entry.h
  5991. +++ linux/include/asm-nios2nommu/entry.h
  5992. @@ -0,0 +1,188 @@
  5993. +/*
  5994. + * Hacked from m68knommu port.
  5995. + *
  5996. + * Copyright(C) 2004 Microtronix Datacom Ltd.
  5997. + *
  5998. + * All rights reserved.
  5999. + *
  6000. + * This program is free software; you can redistribute it and/or modify
  6001. + * it under the terms of the GNU General Public License as published by
  6002. + * the Free Software Foundation; either version 2 of the License, or
  6003. + * (at your option) any later version.
  6004. + *
  6005. + * This program is distributed in the hope that it will be useful, but
  6006. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6007. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6008. + * NON INFRINGEMENT. See the GNU General Public License for more
  6009. + * details.
  6010. + *
  6011. + * You should have received a copy of the GNU General Public License
  6012. + * along with this program; if not, write to the Free Software
  6013. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6014. + *
  6015. + */
  6016. +
  6017. +#ifndef __NIOS2NOMMU_ENTRY_H
  6018. +#define __NIOS2NOMMU_ENTRY_H
  6019. +
  6020. +#ifdef __ASSEMBLY__
  6021. +
  6022. +// #include <linux/config.h>
  6023. +#include <asm/setup.h>
  6024. +#include <asm/page.h>
  6025. +#include <asm/asm-offsets.h>
  6026. +
  6027. +/*
  6028. + * Stack layout in 'ret_from_exception':
  6029. + *
  6030. + * This allows access to the syscall arguments in registers r4-r8
  6031. + *
  6032. + * 0(sp) - r8
  6033. + * 4(sp) - r9
  6034. + * 8(sp) - r10
  6035. + * C(sp) - r11
  6036. + * 10(sp) - r12
  6037. + * 14(sp) - r13
  6038. + * 18(sp) - r14
  6039. + * 1C(sp) - r15
  6040. + * 20(sp) - r1
  6041. + * 24(sp) - r2
  6042. + * 28(sp) - r3
  6043. + * 2C(sp) - r4
  6044. + * 30(sp) - r5
  6045. + * 34(sp) - r6
  6046. + * 38(sp) - r7
  6047. + * 3C(sp) - orig_r2
  6048. + * 40(sp) - ra
  6049. + * 44(sp) - fp
  6050. + * 48(sp) - sp
  6051. + * 4C(sp) - gp
  6052. + * 50(sp) - estatus
  6053. + * 54(sp) - status_extension
  6054. + * 58(sp) - ea
  6055. + *
  6056. + */
  6057. +
  6058. +/* process bits for task_struct.flags */
  6059. +PF_TRACESYS_OFF = 3
  6060. +PF_TRACESYS_BIT = 5
  6061. +PF_PTRACED_OFF = 3
  6062. +PF_PTRACED_BIT = 4
  6063. +PF_DTRACE_OFF = 1
  6064. +PF_DTRACE_BIT = 5
  6065. +
  6066. +LENOSYS = 38
  6067. +
  6068. +/*
  6069. + * This defines the normal kernel pt-regs layout.
  6070. + *
  6071. + */
  6072. +
  6073. +/*
  6074. + * Standard Nios2 interrupt entry and exit macros.
  6075. + * Must be called with interrupts disabled.
  6076. + */
  6077. +.macro SAVE_ALL
  6078. + movia r24,status_extension // Read status extension
  6079. + ldw r24,0(r24)
  6080. + andi r24,r24,PS_S_ASM
  6081. + bne r24,r0,1f // In supervisor mode, already on kernel stack
  6082. + movia r24,_current_thread // Switch to current kernel stack
  6083. + ldw r24,0(r24) // using the thread_info
  6084. + addi r24,r24,THREAD_SIZE_ASM-PT_REGS_SIZE
  6085. + stw sp,PT_SP(r24) // Save user stack before changing
  6086. + mov sp,r24
  6087. + br 2f
  6088. +
  6089. +1: mov r24,sp
  6090. + addi sp,sp,-PT_REGS_SIZE // Backup the kernel stack pointer
  6091. + stw r24,PT_SP(sp)
  6092. +2: stw r1,PT_R1(sp)
  6093. + stw r2,PT_R2(sp)
  6094. + stw r3,PT_R3(sp)
  6095. + stw r4,PT_R4(sp)
  6096. + stw r5,PT_R5(sp)
  6097. + stw r6,PT_R6(sp)
  6098. + stw r7,PT_R7(sp)
  6099. + stw r8,PT_R8(sp)
  6100. + stw r9,PT_R9(sp)
  6101. + stw r10,PT_R10(sp)
  6102. + stw r11,PT_R11(sp)
  6103. + stw r12,PT_R12(sp)
  6104. + stw r13,PT_R13(sp)
  6105. + stw r14,PT_R14(sp)
  6106. + stw r15,PT_R15(sp)
  6107. + stw r2,PT_ORIG_R2(sp)
  6108. + stw ra,PT_RA(sp)
  6109. + stw fp,PT_FP(sp)
  6110. + stw gp,PT_GP(sp)
  6111. + rdctl r24,estatus
  6112. + stw r24,PT_ESTATUS(sp)
  6113. + movia r24,status_extension // Read status extension
  6114. + ldw r1,0(r24)
  6115. + stw r1,PT_STATUS_EXTENSION(sp) // Store user/supervisor status
  6116. + ORI32 r1,r1,PS_S_ASM // Set supervisor mode
  6117. + stw r1,0(r24)
  6118. + stw ea,PT_EA(sp)
  6119. +.endm
  6120. +
  6121. +.macro RESTORE_ALL
  6122. + ldw r1,PT_STATUS_EXTENSION(sp) // Restore user/supervisor status
  6123. + movia r24,status_extension
  6124. + stw r1,0(r24)
  6125. + ldw r1,PT_R1(sp) // Restore registers
  6126. + ldw r2,PT_R2(sp)
  6127. + ldw r3,PT_R3(sp)
  6128. + ldw r4,PT_R4(sp)
  6129. + ldw r5,PT_R5(sp)
  6130. + ldw r6,PT_R6(sp)
  6131. + ldw r7,PT_R7(sp)
  6132. + ldw r8,PT_R8(sp)
  6133. + ldw r9,PT_R9(sp)
  6134. + ldw r10,PT_R10(sp)
  6135. + ldw r11,PT_R11(sp)
  6136. + ldw r12,PT_R12(sp)
  6137. + ldw r13,PT_R13(sp)
  6138. + ldw r14,PT_R14(sp)
  6139. + ldw r15,PT_R15(sp)
  6140. + ldw ra,PT_RA(sp)
  6141. + ldw fp,PT_FP(sp)
  6142. + ldw gp,PT_GP(sp)
  6143. + ldw r24,PT_ESTATUS(sp)
  6144. + wrctl estatus,r24
  6145. + ldw ea,PT_EA(sp)
  6146. + ldw sp,PT_SP(sp) // Restore sp last
  6147. +.endm
  6148. +
  6149. +.macro SAVE_SWITCH_STACK
  6150. + addi sp,sp,-SWITCH_STACK_SIZE
  6151. + stw r16,SW_R16(sp)
  6152. + stw r17,SW_R17(sp)
  6153. + stw r18,SW_R18(sp)
  6154. + stw r19,SW_R19(sp)
  6155. + stw r20,SW_R20(sp)
  6156. + stw r21,SW_R21(sp)
  6157. + stw r22,SW_R22(sp)
  6158. + stw r23,SW_R23(sp)
  6159. + stw fp,SW_FP(sp)
  6160. + stw gp,SW_GP(sp)
  6161. + stw ra,SW_RA(sp)
  6162. +.endm
  6163. +
  6164. +.macro RESTORE_SWITCH_STACK
  6165. + ldw r16,SW_R16(sp)
  6166. + ldw r17,SW_R17(sp)
  6167. + ldw r18,SW_R18(sp)
  6168. + ldw r19,SW_R19(sp)
  6169. + ldw r20,SW_R20(sp)
  6170. + ldw r21,SW_R21(sp)
  6171. + ldw r22,SW_R22(sp)
  6172. + ldw r23,SW_R23(sp)
  6173. + ldw fp,SW_FP(sp)
  6174. + ldw gp,SW_GP(sp)
  6175. + ldw ra,SW_RA(sp)
  6176. + addi sp,sp,SWITCH_STACK_SIZE
  6177. +.endm
  6178. +
  6179. +#endif /* __ASSEMBLY__ */
  6180. +#endif /* __NIOS2NOMMU_ENTRY_H */
  6181. --- linux/include/asm-nios2nommu/errno.h
  6182. +++ linux/include/asm-nios2nommu/errno.h
  6183. @@ -0,0 +1,6 @@
  6184. +#ifndef _NIOS2NOMMU_ERRNO_H
  6185. +#define _NIOS2NOMMU_ERRNO_H
  6186. +
  6187. +#include <asm-generic/errno.h>
  6188. +
  6189. +#endif /* _NIOS2NOMMU_ERRNO_H */
  6190. --- linux/include/asm-nios2nommu/fcntl.h
  6191. +++ linux/include/asm-nios2nommu/fcntl.h
  6192. @@ -0,0 +1,110 @@
  6193. +/*
  6194. + * This file came from the m68k port.
  6195. + *
  6196. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  6197. + *
  6198. + * All rights reserved.
  6199. + *
  6200. + * This program is free software; you can redistribute it and/or modify
  6201. + * it under the terms of the GNU General Public License as published by
  6202. + * the Free Software Foundation; either version 2 of the License, or
  6203. + * (at your option) any later version.
  6204. + *
  6205. + * This program is distributed in the hope that it will be useful, but
  6206. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6207. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6208. + * NON INFRINGEMENT. See the GNU General Public License for more
  6209. + * details.
  6210. + *
  6211. + * You should have received a copy of the GNU General Public License
  6212. + * along with this program; if not, write to the Free Software
  6213. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6214. + *
  6215. + */
  6216. +#ifndef _NIOS2_FCNTL_H
  6217. +#define _NIOS2_FCNTL_H
  6218. +
  6219. +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
  6220. + located on an ext2 file system */
  6221. +#define O_ACCMODE 0003
  6222. +#define O_RDONLY 00
  6223. +#define O_WRONLY 01
  6224. +#define O_RDWR 02
  6225. +#define O_CREAT 0100 /* not fcntl */
  6226. +#define O_EXCL 0200 /* not fcntl */
  6227. +#define O_NOCTTY 0400 /* not fcntl */
  6228. +#define O_TRUNC 01000 /* not fcntl */
  6229. +#define O_APPEND 02000
  6230. +#define O_NONBLOCK 04000
  6231. +#define O_NDELAY O_NONBLOCK
  6232. +#define O_SYNC 010000
  6233. +#define FASYNC 020000 /* fcntl, for BSD compatibility */
  6234. +#define O_DIRECTORY 040000 /* must be a directory */
  6235. +#define O_NOFOLLOW 0100000 /* don't follow links */
  6236. +#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
  6237. +#define O_LARGEFILE 0400000
  6238. +#define O_NOATIME 01000000
  6239. +
  6240. +#define F_DUPFD 0 /* dup */
  6241. +#define F_GETFD 1 /* get close_on_exec */
  6242. +#define F_SETFD 2 /* set/clear close_on_exec */
  6243. +#define F_GETFL 3 /* get file->f_flags */
  6244. +#define F_SETFL 4 /* set file->f_flags */
  6245. +#define F_GETLK 5
  6246. +#define F_SETLK 6
  6247. +#define F_SETLKW 7
  6248. +
  6249. +#define F_SETOWN 8 /* for sockets. */
  6250. +#define F_GETOWN 9 /* for sockets. */
  6251. +#define F_SETSIG 10 /* for sockets. */
  6252. +#define F_GETSIG 11 /* for sockets. */
  6253. +
  6254. +#define F_GETLK64 12 /* using 'struct flock64' */
  6255. +#define F_SETLK64 13
  6256. +#define F_SETLKW64 14
  6257. +
  6258. +/* for F_[GET|SET]FL */
  6259. +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
  6260. +
  6261. +/* for posix fcntl() and lockf() */
  6262. +#define F_RDLCK 0
  6263. +#define F_WRLCK 1
  6264. +#define F_UNLCK 2
  6265. +
  6266. +/* for old implementation of bsd flock () */
  6267. +#define F_EXLCK 4 /* or 3 */
  6268. +#define F_SHLCK 8 /* or 4 */
  6269. +
  6270. +/* for leases */
  6271. +#define F_INPROGRESS 16
  6272. +
  6273. +/* operations for bsd flock(), also used by the kernel implementation */
  6274. +#define LOCK_SH 1 /* shared lock */
  6275. +#define LOCK_EX 2 /* exclusive lock */
  6276. +#define LOCK_NB 4 /* or'd with one of the above to prevent
  6277. + blocking */
  6278. +#define LOCK_UN 8 /* remove lock */
  6279. +
  6280. +#define LOCK_MAND 32 /* This is a mandatory flock */
  6281. +#define LOCK_READ 64 /* ... Which allows concurrent read operations */
  6282. +#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
  6283. +#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
  6284. +
  6285. +struct flock {
  6286. + short l_type;
  6287. + short l_whence;
  6288. + off_t l_start;
  6289. + off_t l_len;
  6290. + pid_t l_pid;
  6291. +};
  6292. +
  6293. +struct flock64 {
  6294. + short l_type;
  6295. + short l_whence;
  6296. + loff_t l_start;
  6297. + loff_t l_len;
  6298. + pid_t l_pid;
  6299. +};
  6300. +
  6301. +#define F_LINUX_SPECIFIC_BASE 1024
  6302. +#endif /* _NIOS2_FCNTL_H */
  6303. --- linux/include/asm-nios2nommu/flat.h
  6304. +++ linux/include/asm-nios2nommu/flat.h
  6305. @@ -0,0 +1,126 @@
  6306. +/*
  6307. + * include/asm-nios2nommu/flat.h -- uClinux bFLT relocations
  6308. + *
  6309. + * Copyright (C) 2004,05 Microtronix Datacom Ltd
  6310. + *
  6311. + * This file is subject to the terms and conditions of the GNU General
  6312. + * Public License. See the file COPYING in the main directory of this
  6313. + * archive for more details.
  6314. + *
  6315. + * Written by Wentao Xu <wentao@microtronix.com>
  6316. + */
  6317. +
  6318. +#ifndef __NIOS2_FLAT_H__
  6319. +#define __NIOS2_FLAT_H__
  6320. +
  6321. +#define flat_reloc_valid(reloc, size) ((reloc) <= (size + 0x8000))
  6322. +
  6323. +/* The stack is 64-bit aligned for Nios II, so (sp - 1) shall
  6324. + * be 64-bit aligned, where -1 is for argc
  6325. + */
  6326. +#define flat_stack_align(sp) (sp = (unsigned long *)(((unsigned long)sp - 1) & (-8)))
  6327. +
  6328. +/* The uClibc port for Nios II expects the argc is followed by argv and envp */
  6329. +#define flat_argvp_envp_on_stack() 1
  6330. +
  6331. +#define flat_old_ram_flag(flags) (flags)
  6332. +
  6333. +/* We store the type of relocation in the top 4 bits of the `relval.' */
  6334. +
  6335. +/* Convert a relocation entry into an address. */
  6336. +static inline unsigned long
  6337. +flat_get_relocate_addr (unsigned long relval)
  6338. +{
  6339. + return relval & 0x0fffffff; /* Mask out top 4-bits */
  6340. +}
  6341. +
  6342. +#define FLAT_NIOS2_RELOC_TYPE(relval) ((relval) >> 28)
  6343. +
  6344. +#define FLAT_NIOS2_R_32 0 /* Normal 32-bit reloc */
  6345. +#define FLAT_NIOS2_R_HI_LO 1 /* High 16-bits + low 16-bits field */
  6346. +#define FLAT_NIOS2_R_HIADJ_LO 2 /* High 16-bits adjust + low 16-bits field */
  6347. +#define FLAT_NIOS2_R_CALL26 4 /* Call imm26 */
  6348. +
  6349. +/* Extract the address to be relocated from the symbol reference at rp;
  6350. + * relval is the raw relocation-table entry from which RP is derived.
  6351. + * rp shall always be 32-bit aligned
  6352. + */
  6353. +static inline unsigned long flat_get_addr_from_rp (unsigned long *rp,
  6354. + unsigned long relval,
  6355. + unsigned long flags)
  6356. +{
  6357. + switch (FLAT_NIOS2_RELOC_TYPE(relval))
  6358. + {
  6359. + case FLAT_NIOS2_R_32:
  6360. + /* Simple 32-bit address. The loader expect it in bigger endian */
  6361. + return htonl(*rp);
  6362. +
  6363. + case FLAT_NIOS2_R_HI_LO:
  6364. + /* get the two 16-bit immediate value from instructions, then
  6365. + * construct a 32-bit value. Again the loader expect bigger endian
  6366. + */
  6367. + return htonl ((((rp[0] >> 6) & 0xFFFF) << 16 ) |
  6368. + ((rp[1] >> 6) & 0xFFFF));
  6369. +
  6370. + case FLAT_NIOS2_R_HIADJ_LO:
  6371. + {
  6372. + /* get the two 16-bit immediate value from instructions, then
  6373. + * construct a 32-bit value. Again the loader expect bigger endian
  6374. + */
  6375. + unsigned int low, high;
  6376. + high = (rp[0] >> 6) & 0xFFFF;
  6377. + low = (rp[1] >> 6) & 0xFFFF;
  6378. +
  6379. + if ((low >> 15) & 1) high--;
  6380. +
  6381. + return htonl ((high << 16 ) | low );
  6382. + }
  6383. + case FLAT_NIOS2_R_CALL26:
  6384. + /* the 26-bit immediate value is actually 28-bit */
  6385. + return htonl(((*rp) >> 6) << 2);
  6386. +
  6387. + default:
  6388. + return ~0; /* bogus value */
  6389. + }
  6390. +}
  6391. +
  6392. +/* Insert the address addr into the symbol reference at rp;
  6393. + * relval is the raw relocation-table entry from which rp is derived.
  6394. + * rp shall always be 32-bit aligned
  6395. + */
  6396. +static inline void flat_put_addr_at_rp (unsigned long *rp, unsigned long addr,
  6397. + unsigned long relval)
  6398. +{
  6399. + unsigned long exist_val;
  6400. + switch (FLAT_NIOS2_RELOC_TYPE (relval)) {
  6401. + case FLAT_NIOS2_R_32:
  6402. + /* Simple 32-bit address. */
  6403. + *rp = addr;
  6404. + break;
  6405. +
  6406. + case FLAT_NIOS2_R_HI_LO:
  6407. + exist_val = rp[0];
  6408. + rp[0] = ((((exist_val >> 22) << 16) | (addr >> 16)) << 6) | (exist_val & 0x3F);
  6409. + exist_val = rp[1];
  6410. + rp[1] = ((((exist_val >> 22) << 16) | (addr & 0xFFFF)) << 6) | (exist_val & 0x3F);
  6411. + break;
  6412. +
  6413. + case FLAT_NIOS2_R_HIADJ_LO:
  6414. + {
  6415. + unsigned int high = (addr >> 16);
  6416. + if ((addr >> 15) & 1)
  6417. + high = (high + 1) & 0xFFFF;
  6418. + exist_val = rp[0];
  6419. + rp[0] = ((((exist_val >> 22) << 16) | high) << 6) | (exist_val & 0x3F);
  6420. + exist_val = rp[1];
  6421. + rp[1] = ((((exist_val >> 22) << 16) | (addr & 0xFFFF)) << 6) | (exist_val & 0x3F);
  6422. + break;
  6423. + }
  6424. + case FLAT_NIOS2_R_CALL26:
  6425. + /* the opcode of CALL is 0, so just store the value */
  6426. + *rp = ((addr >> 2) << 6);
  6427. + break;
  6428. + }
  6429. +}
  6430. +
  6431. +#endif /* __NIOS2_FLAT_H__ */
  6432. --- linux/include/asm-nios2nommu/hardirq.h
  6433. +++ linux/include/asm-nios2nommu/hardirq.h
  6434. @@ -0,0 +1,53 @@
  6435. +/*
  6436. + * Ported from m68knommu
  6437. + *
  6438. + * Copyright (C) 2003, Microtronix Datacom Ltd.
  6439. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6440. + *
  6441. + * All rights reserved.
  6442. + *
  6443. + * This program is free software; you can redistribute it and/or modify
  6444. + * it under the terms of the GNU General Public License as published by
  6445. + * the Free Software Foundation; either version 2 of the License, or
  6446. + * (at your option) any later version.
  6447. + *
  6448. + * This program is distributed in the hope that it will be useful, but
  6449. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6450. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6451. + * NON INFRINGEMENT. See the GNU General Public License for more
  6452. + * details.
  6453. + *
  6454. + * You should have received a copy of the GNU General Public License
  6455. + * along with this program; if not, write to the Free Software
  6456. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6457. + *
  6458. + */
  6459. +#ifndef __NIOS2_HARDIRQ_H
  6460. +#define __NIOS2_HARDIRQ_H
  6461. +
  6462. +// #include <linux/config.h>
  6463. +#include <linux/cache.h>
  6464. +#include <linux/threads.h>
  6465. +
  6466. +typedef struct {
  6467. + unsigned int __softirq_pending;
  6468. +} ____cacheline_aligned irq_cpustat_t;
  6469. +
  6470. +#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
  6471. +
  6472. +#define HARDIRQ_BITS 8
  6473. +
  6474. +/*
  6475. + * The hardirq mask has to be large enough to have
  6476. + * space for potentially all IRQ sources in the system
  6477. + * nesting on a single CPU:
  6478. + */
  6479. +#if (1 << HARDIRQ_BITS) < NR_IRQS
  6480. +# error HARDIRQ_BITS is too low!
  6481. +#endif
  6482. +
  6483. +#ifdef CONFIG_SMP
  6484. +# error nios2nommu SMP is not available
  6485. +#endif /* CONFIG_SMP */
  6486. +
  6487. +#endif /* __NIOS2_HARDIRQ_H */
  6488. --- linux/include/asm-nios2nommu/hdreg.h
  6489. +++ linux/include/asm-nios2nommu/hdreg.h
  6490. @@ -0,0 +1,30 @@
  6491. +/*
  6492. + * Copyright (C) 1994-1996 Linus Torvalds & authors
  6493. + * Copyright (C) 2002 Wentau Xu (www.microtronix.com)
  6494. + * copyright (C) 2004 Microtronix Datacom Ltd.
  6495. + *
  6496. + * All rights reserved.
  6497. + *
  6498. + * This program is free software; you can redistribute it and/or modify
  6499. + * it under the terms of the GNU General Public License as published by
  6500. + * the Free Software Foundation; either version 2 of the License, or
  6501. + * (at your option) any later version.
  6502. + *
  6503. + * This program is distributed in the hope that it will be useful, but
  6504. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6505. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6506. + * NON INFRINGEMENT. See the GNU General Public License for more
  6507. + * details.
  6508. + *
  6509. + * You should have received a copy of the GNU General Public License
  6510. + * along with this program; if not, write to the Free Software
  6511. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6512. + *
  6513. + */
  6514. +
  6515. +#ifndef __NIOS2_HDREG_H
  6516. +#define __NIOS2_HDREG_H
  6517. +
  6518. +typedef unsigned long ide_ioreg_t;
  6519. +
  6520. +#endif /* __NIOS2_HDREG_H */
  6521. --- linux/include/asm-nios2nommu/hw_irq.h
  6522. +++ linux/include/asm-nios2nommu/hw_irq.h
  6523. @@ -0,0 +1,16 @@
  6524. +#ifndef _ASM_HW_IRQ_H
  6525. +#define _ASM_HW_IRQ_H
  6526. +
  6527. +/*
  6528. + * linux/include/asm/hw_irq.h
  6529. + *
  6530. + * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
  6531. + *
  6532. + * moved some of the old arch/i386/kernel/irq.h to here. VY
  6533. + *
  6534. + * IRQ/IPI changes taken from work by Thomas Radke
  6535. + * <tomsoft@informatik.tu-chemnitz.de>
  6536. + */
  6537. +
  6538. +
  6539. +#endif /* _ASM_HW_IRQ_H */
  6540. --- linux/include/asm-nios2nommu/ide.h
  6541. +++ linux/include/asm-nios2nommu/ide.h
  6542. @@ -0,0 +1,47 @@
  6543. +/*
  6544. + * linux/include/asm-niosnommu2/ide.h
  6545. + *
  6546. + * Copyright (C) 1994-1996 Linus Torvalds & authors
  6547. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  6548. + *
  6549. + * All rights reserved.
  6550. + *
  6551. + * This program is free software; you can redistribute it and/or modify
  6552. + * it under the terms of the GNU General Public License as published by
  6553. + * the Free Software Foundation; either version 2 of the License, or
  6554. + * (at your option) any later version.
  6555. + *
  6556. + * This program is distributed in the hope that it will be useful, but
  6557. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6558. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6559. + * NON INFRINGEMENT. See the GNU General Public License for more
  6560. + * details.
  6561. + *
  6562. + * You should have received a copy of the GNU General Public License
  6563. + * along with this program; if not, write to the Free Software
  6564. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6565. + *
  6566. + */
  6567. +
  6568. +#ifndef __ASMNIOS2_IDE_H
  6569. +#define __ASMNIOS2_IDE_H
  6570. +
  6571. +#ifdef __KERNEL__
  6572. +#undef MAX_HWIFS /* we're going to force it */
  6573. +
  6574. +#ifndef MAX_HWIFS
  6575. +#define MAX_HWIFS 1
  6576. +#endif
  6577. +
  6578. +#define IDE_ARCH_OBSOLETE_INIT
  6579. +#define IDE_ARCH_OBSOLETE_DEFAULTS
  6580. +#define ide_default_io_base(i) ((unsigned long)na_ide_ide)
  6581. +#define ide_default_irq(b) (na_ide_ide_irq)
  6582. +#define ide_init_default_irq(base) ide_default_irq(base)
  6583. +#define ide_default_io_ctl(base) ((base) + (0xE*4))
  6584. +
  6585. +#include <asm-generic/ide_iops.h>
  6586. +
  6587. +#endif /* __KERNEL__ */
  6588. +
  6589. +#endif /* __ASMNIOS2_IDE_H */
  6590. --- linux/include/asm-nios2nommu/init.h
  6591. +++ linux/include/asm-nios2nommu/init.h
  6592. @@ -0,0 +1,22 @@
  6593. +/*
  6594. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6595. + *
  6596. + * All rights reserved.
  6597. + *
  6598. + * This program is free software; you can redistribute it and/or modify
  6599. + * it under the terms of the GNU General Public License as published by
  6600. + * the Free Software Foundation; either version 2 of the License, or
  6601. + * (at your option) any later version.
  6602. + *
  6603. + * This program is distributed in the hope that it will be useful, but
  6604. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6605. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6606. + * NON INFRINGEMENT. See the GNU General Public License for more
  6607. + * details.
  6608. + *
  6609. + * You should have received a copy of the GNU General Public License
  6610. + * along with this program; if not, write to the Free Software
  6611. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6612. + *
  6613. + */
  6614. +#error "<asm/init.h> should never be used - use <linux/init.h> instead"
  6615. --- linux/include/asm-nios2nommu/ioctl.h
  6616. +++ linux/include/asm-nios2nommu/ioctl.h
  6617. @@ -0,0 +1,100 @@
  6618. +/* $Id: ioctl.h,v 1.3 2004/02/12 23:06:40 ken-h Exp $
  6619. + *
  6620. + * linux/ioctl.h for Linux by H.H. Bergman.
  6621. + *
  6622. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6623. + *
  6624. + * All rights reserved.
  6625. + *
  6626. + * This program is free software; you can redistribute it and/or modify
  6627. + * it under the terms of the GNU General Public License as published by
  6628. + * the Free Software Foundation; either version 2 of the License, or
  6629. + * (at your option) any later version.
  6630. + *
  6631. + * This program is distributed in the hope that it will be useful, but
  6632. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6633. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6634. + * NON INFRINGEMENT. See the GNU General Public License for more
  6635. + * details.
  6636. + *
  6637. + * You should have received a copy of the GNU General Public License
  6638. + * along with this program; if not, write to the Free Software
  6639. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6640. + *
  6641. + */
  6642. +
  6643. +#ifndef _NIOS2_IOCTL_H
  6644. +#define _NIOS2_IOCTL_H
  6645. +
  6646. +/* ioctl command encoding: 32 bits total, command in lower 16 bits,
  6647. + * size of the parameter structure in the lower 14 bits of the
  6648. + * upper 16 bits.
  6649. + * Encoding the size of the parameter structure in the ioctl request
  6650. + * is useful for catching programs compiled with old versions
  6651. + * and to avoid overwriting user space outside the user buffer area.
  6652. + * The highest 2 bits are reserved for indicating the ``access mode''.
  6653. + * NOTE: This limits the max parameter size to 16kB -1 !
  6654. + */
  6655. +
  6656. +/*
  6657. + * I don't really have any idea about what this should look like, so
  6658. + * for the time being, this is heavily based on the PC definitions.
  6659. + */
  6660. +
  6661. +/*
  6662. + * The following is for compatibility across the various Linux
  6663. + * platforms. The i386 ioctl numbering scheme doesn't really enforce
  6664. + * a type field. De facto, however, the top 8 bits of the lower 16
  6665. + * bits are indeed used as a type field, so we might just as well make
  6666. + * this explicit here. Please be sure to use the decoding macros
  6667. + * below from now on.
  6668. + */
  6669. +#define _IOC_NRBITS 8
  6670. +#define _IOC_TYPEBITS 8
  6671. +#define _IOC_SIZEBITS 14
  6672. +#define _IOC_DIRBITS 2
  6673. +
  6674. +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
  6675. +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
  6676. +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
  6677. +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
  6678. +
  6679. +#define _IOC_NRSHIFT 0
  6680. +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
  6681. +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
  6682. +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
  6683. +
  6684. +/*
  6685. + * Direction bits.
  6686. + */
  6687. +#define _IOC_NONE 0U
  6688. +#define _IOC_WRITE 1U
  6689. +#define _IOC_READ 2U
  6690. +
  6691. +#define _IOC(dir,type,nr,size) \
  6692. + (((dir) << _IOC_DIRSHIFT) | \
  6693. + ((type) << _IOC_TYPESHIFT) | \
  6694. + ((nr) << _IOC_NRSHIFT) | \
  6695. + ((size) << _IOC_SIZESHIFT))
  6696. +
  6697. +/* used to create numbers */
  6698. +#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
  6699. +#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
  6700. +#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
  6701. +#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
  6702. +
  6703. +/* used to decode ioctl numbers.. */
  6704. +#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
  6705. +#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
  6706. +#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
  6707. +#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
  6708. +
  6709. +/* ...and for the drivers/sound files... */
  6710. +
  6711. +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
  6712. +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
  6713. +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
  6714. +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
  6715. +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
  6716. +
  6717. +#endif /* _NIOS2_IOCTL_H */
  6718. --- linux/include/asm-nios2nommu/ioctls.h
  6719. +++ linux/include/asm-nios2nommu/ioctls.h
  6720. @@ -0,0 +1,103 @@
  6721. +/*
  6722. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6723. + *
  6724. + * All rights reserved.
  6725. + *
  6726. + * This program is free software; you can redistribute it and/or modify
  6727. + * it under the terms of the GNU General Public License as published by
  6728. + * the Free Software Foundation; either version 2 of the License, or
  6729. + * (at your option) any later version.
  6730. + *
  6731. + * This program is distributed in the hope that it will be useful, but
  6732. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6733. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6734. + * NON INFRINGEMENT. See the GNU General Public License for more
  6735. + * details.
  6736. + *
  6737. + * You should have received a copy of the GNU General Public License
  6738. + * along with this program; if not, write to the Free Software
  6739. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6740. + *
  6741. + */
  6742. +
  6743. +#ifndef __ARCH_NIOS2_IOCTLS_H__
  6744. +#define __ARCH_NIOS2_IOCTLS_H__
  6745. +
  6746. +#include <asm/ioctl.h>
  6747. +
  6748. +/* 0x54 is just a magic number to make these relatively unique ('T') */
  6749. +
  6750. +#define TCGETS 0x5401
  6751. +#define TCSETS 0x5402
  6752. +#define TCSETSW 0x5403
  6753. +#define TCSETSF 0x5404
  6754. +#define TCGETA 0x5405
  6755. +#define TCSETA 0x5406
  6756. +#define TCSETAW 0x5407
  6757. +#define TCSETAF 0x5408
  6758. +#define TCSBRK 0x5409
  6759. +#define TCXONC 0x540A
  6760. +#define TCFLSH 0x540B
  6761. +#define TIOCEXCL 0x540C
  6762. +#define TIOCNXCL 0x540D
  6763. +#define TIOCSCTTY 0x540E
  6764. +#define TIOCGPGRP 0x540F
  6765. +#define TIOCSPGRP 0x5410
  6766. +#define TIOCOUTQ 0x5411
  6767. +#define TIOCSTI 0x5412
  6768. +#define TIOCGWINSZ 0x5413
  6769. +#define TIOCSWINSZ 0x5414
  6770. +#define TIOCMGET 0x5415
  6771. +#define TIOCMBIS 0x5416
  6772. +#define TIOCMBIC 0x5417
  6773. +#define TIOCMSET 0x5418
  6774. +#define TIOCGSOFTCAR 0x5419
  6775. +#define TIOCSSOFTCAR 0x541A
  6776. +#define FIONREAD 0x541B
  6777. +#define TIOCINQ FIONREAD
  6778. +#define TIOCLINUX 0x541C
  6779. +#define TIOCCONS 0x541D
  6780. +#define TIOCGSERIAL 0x541E
  6781. +#define TIOCSSERIAL 0x541F
  6782. +#define TIOCPKT 0x5420
  6783. +#define FIONBIO 0x5421
  6784. +#define TIOCNOTTY 0x5422
  6785. +#define TIOCSETD 0x5423
  6786. +#define TIOCGETD 0x5424
  6787. +#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
  6788. +#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
  6789. +#define TIOCSBRK 0x5427 /* BSD compatibility */
  6790. +#define TIOCCBRK 0x5428 /* BSD compatibility */
  6791. +#define TIOCGSID 0x5429 /* Return the session ID of FD */
  6792. +#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
  6793. +#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
  6794. +
  6795. +#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
  6796. +#define FIOCLEX 0x5451
  6797. +#define FIOASYNC 0x5452
  6798. +#define TIOCSERCONFIG 0x5453
  6799. +#define TIOCSERGWILD 0x5454
  6800. +#define TIOCSERSWILD 0x5455
  6801. +#define TIOCGLCKTRMIOS 0x5456
  6802. +#define TIOCSLCKTRMIOS 0x5457
  6803. +#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
  6804. +#define TIOCSERGETLSR 0x5459 /* Get line status register */
  6805. +#define TIOCSERGETMULTI 0x545A /* Get multiport config */
  6806. +#define TIOCSERSETMULTI 0x545B /* Set multiport config */
  6807. +
  6808. +#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
  6809. +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
  6810. +#define FIOQSIZE 0x545E
  6811. +
  6812. +/* Used for packet mode */
  6813. +#define TIOCPKT_DATA 0
  6814. +#define TIOCPKT_FLUSHREAD 1
  6815. +#define TIOCPKT_FLUSHWRITE 2
  6816. +#define TIOCPKT_STOP 4
  6817. +#define TIOCPKT_START 8
  6818. +#define TIOCPKT_NOSTOP 16
  6819. +#define TIOCPKT_DOSTOP 32
  6820. +
  6821. +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
  6822. +
  6823. +#endif /* __ARCH_NIOS2_IOCTLS_H__ */
  6824. --- linux/include/asm-nios2nommu/io.h
  6825. +++ linux/include/asm-nios2nommu/io.h
  6826. @@ -0,0 +1,240 @@
  6827. +/*
  6828. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6829. + *
  6830. + * All rights reserved.
  6831. + *
  6832. + * This program is free software; you can redistribute it and/or modify
  6833. + * it under the terms of the GNU General Public License as published by
  6834. + * the Free Software Foundation; either version 2 of the License, or
  6835. + * (at your option) any later version.
  6836. + *
  6837. + * This program is distributed in the hope that it will be useful, but
  6838. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6839. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6840. + * NON INFRINGEMENT. See the GNU General Public License for more
  6841. + * details.
  6842. + *
  6843. + * You should have received a copy of the GNU General Public License
  6844. + * along with this program; if not, write to the Free Software
  6845. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6846. + *
  6847. + */
  6848. +
  6849. +#ifndef __NIOS2_IO_H
  6850. +#define __NIOS2_IO_H
  6851. +
  6852. +#ifdef __KERNEL__
  6853. +
  6854. +#include <linux/kernel.h>
  6855. +
  6856. +#include <asm/page.h> /* IO address mapping routines need this */
  6857. +#include <asm/system.h>
  6858. +#include <asm/unaligned.h>
  6859. +
  6860. +extern void insw(unsigned long port, void *dst, unsigned long count);
  6861. +extern void outsw(unsigned long port, void *src, unsigned long count);
  6862. +extern void insl(unsigned long port, void *dst, unsigned long count);
  6863. +extern void outsl(unsigned long port, void *src, unsigned long count);
  6864. +
  6865. +
  6866. +/*
  6867. + * readX/writeX() are used to access memory mapped devices. On some
  6868. + * architectures the memory mapped IO stuff needs to be accessed
  6869. + * differently. On the Nios architecture, we just read/write the
  6870. + * memory location directly.
  6871. + */
  6872. +
  6873. +#define readb(addr) \
  6874. +({ \
  6875. + unsigned char __res;\
  6876. + __asm__ __volatile__( \
  6877. + "ldbuio %0, 0(%1)" \
  6878. + : "=r"(__res) \
  6879. + : "r" (addr)); \
  6880. + __res; \
  6881. +})
  6882. +
  6883. +#define readw(addr) \
  6884. +({ \
  6885. + unsigned short __res;\
  6886. + __asm__ __volatile__( \
  6887. + "ldhuio %0, 0(%1)" \
  6888. + : "=r"(__res) \
  6889. + : "r" (addr)); \
  6890. + __res; \
  6891. +})
  6892. +
  6893. +#define readl(addr) \
  6894. +({ \
  6895. + unsigned int __res;\
  6896. + __asm__ __volatile__( \
  6897. + "ldwio %0, 0(%1)" \
  6898. + : "=r"(__res) \
  6899. + : "r" (addr)); \
  6900. + __res; \
  6901. +})
  6902. +
  6903. +#define writeb(b,addr) \
  6904. +({ \
  6905. + __asm__ __volatile__( \
  6906. + "stbio %0, 0(%1)" \
  6907. + : : "r"(b), "r" (addr)); \
  6908. +})
  6909. +
  6910. +#define writew(b,addr) \
  6911. +({ \
  6912. + __asm__ __volatile__( \
  6913. + "sthio %0, 0(%1)" \
  6914. + : : "r"(b), "r" (addr)); \
  6915. +})
  6916. +
  6917. +#define writel(b,addr) \
  6918. +({ \
  6919. + __asm__ __volatile__( \
  6920. + "stwio %0, 0(%1)" \
  6921. + : : "r"(b), "r" (addr)); \
  6922. +})
  6923. +
  6924. +#define __raw_readb readb
  6925. +#define __raw_readw readw
  6926. +#define __raw_readl readl
  6927. +#define __raw_writeb writeb
  6928. +#define __raw_writew writew
  6929. +#define __raw_writel writel
  6930. +
  6931. +#define mmiowb()
  6932. +
  6933. +/*
  6934. + * make the short names macros so specific devices
  6935. + * can override them as required
  6936. + */
  6937. +
  6938. +#define memset_io(addr,c,len) memset((void *)(((unsigned int)(addr)) | 0x80000000),(c),(len))
  6939. +#define memcpy_fromio(to,from,len) memcpy((to),(void *)(((unsigned int)(from)) | 0x80000000),(len))
  6940. +#define memcpy_toio(to,from,len) memcpy((void *)(((unsigned int)(to)) | 0x80000000),(from),(len))
  6941. +
  6942. +#define inb(addr) readb(addr)
  6943. +#define inw(addr) readw(addr)
  6944. +#define inl(addr) readl(addr)
  6945. +
  6946. +#define outb(x,addr) ((void) writeb(x,addr))
  6947. +#define outw(x,addr) ((void) writew(x,addr))
  6948. +#define outl(x,addr) ((void) writel(x,addr))
  6949. +
  6950. +#define inb_p(addr) inb(addr)
  6951. +#define inw_p(addr) inw(addr)
  6952. +#define inl_p(addr) inl(addr)
  6953. +
  6954. +#define outb_p(x,addr) outb(x,addr)
  6955. +#define outw_p(x,addr) outw(x,addr)
  6956. +#define outl_p(x,addr) outl(x,addr)
  6957. +
  6958. +
  6959. +
  6960. +extern inline void insb(unsigned long port, void *dst, unsigned long count)
  6961. +{
  6962. + unsigned char *p=(unsigned char*)dst;
  6963. + while (count--)
  6964. + *p++ = inb(port);
  6965. +}
  6966. +
  6967. +/* See arch/niosnommu/io.c for optimized version */
  6968. +extern inline void _insw(unsigned long port, void *dst, unsigned long count)
  6969. +{
  6970. + unsigned short *p=(unsigned short*)dst;
  6971. + while (count--)
  6972. + *p++ = inw(port);
  6973. +}
  6974. +
  6975. +/* See arch/niosnommu/kernel/io.c for unaligned destination pointer */
  6976. +extern inline void _insl(unsigned long port, void *dst, unsigned long count)
  6977. +{
  6978. + unsigned long *p=(unsigned long*)dst;
  6979. + while (count--)
  6980. + *p++ = inl(port);
  6981. +}
  6982. +
  6983. +extern inline void outsb(unsigned long port, void *src, unsigned long count)
  6984. +{
  6985. + unsigned char *p=(unsigned char*)src;
  6986. + while (count--)
  6987. + outb( *p++, port );
  6988. +}
  6989. +
  6990. +/* See arch/niosnommu/io.c for optimized version */
  6991. +extern inline void _outsw(unsigned long port, void *src, unsigned long count)
  6992. +{
  6993. + unsigned short *p=(unsigned short*)src;
  6994. + while (count--)
  6995. + outw( *p++, port );
  6996. +}
  6997. +
  6998. +/* See arch/niosnommu/kernel/io.c for unaligned source pointer */
  6999. +extern inline void _outsl(unsigned long port, void *src, unsigned long count)
  7000. +{
  7001. + unsigned long *p=(unsigned long*)src;
  7002. + while (count--)
  7003. + outl( *p++, port );
  7004. +}
  7005. +
  7006. +
  7007. +
  7008. +extern inline void mapioaddr(unsigned long physaddr, unsigned long virt_addr,
  7009. + int bus, int rdonly)
  7010. +{
  7011. + return;
  7012. +}
  7013. +
  7014. +//vic - copied from m68knommu
  7015. +
  7016. +/* Values for nocacheflag and cmode */
  7017. +#define IOMAP_FULL_CACHING 0
  7018. +#define IOMAP_NOCACHE_SER 1
  7019. +#define IOMAP_NOCACHE_NONSER 2
  7020. +#define IOMAP_WRITETHROUGH 3
  7021. +
  7022. +extern void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag);
  7023. +extern void __iounmap(void *addr, unsigned long size);
  7024. +
  7025. +extern inline void *ioremap(unsigned long physaddr, unsigned long size)
  7026. +{
  7027. + return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
  7028. +}
  7029. +extern inline void *ioremap_nocache(unsigned long physaddr, unsigned long size)
  7030. +{
  7031. + return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
  7032. +}
  7033. +extern inline void *ioremap_writethrough(unsigned long physaddr, unsigned long size)
  7034. +{
  7035. + return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
  7036. +}
  7037. +extern inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size)
  7038. +{
  7039. + return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
  7040. +}
  7041. +
  7042. +extern void iounmap(void *addr);
  7043. +
  7044. +
  7045. +#define IO_SPACE_LIMIT 0xffffffff
  7046. +
  7047. +#define dma_cache_inv(_start,_size) do { } while (0)
  7048. +#define dma_cache_wback(_start,_size) do { } while (0)
  7049. +#define dma_cache_wback_inv(_start,_size) do { } while (0)
  7050. +
  7051. +/* Pages to physical address... */
  7052. +#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
  7053. +#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT)
  7054. +
  7055. +#define mm_ptov(vaddr) ((void *) (vaddr))
  7056. +#define mm_vtop(vaddr) ((unsigned long) (vaddr))
  7057. +#define phys_to_virt(vaddr) ((void *) (vaddr))
  7058. +#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
  7059. +
  7060. +#define virt_to_bus virt_to_phys
  7061. +#define bus_to_virt phys_to_virt
  7062. +
  7063. +#endif /* __KERNEL__ */
  7064. +
  7065. +#endif /* !(__NIOS2_IO_H) */
  7066. +
  7067. --- linux/include/asm-nios2nommu/ipcbuf.h
  7068. +++ linux/include/asm-nios2nommu/ipcbuf.h
  7069. @@ -0,0 +1,49 @@
  7070. +#ifndef __NIOS2_IPCBUF_H__
  7071. +#define __NIOS2_IPCBUF_H__
  7072. +
  7073. +/* Copied from asm-m68k/ipcbuf.h
  7074. + * The user_ipc_perm structure for Nios architecture.
  7075. + * Note extra padding because this structure is passed back and forth
  7076. + * between kernel and user space.
  7077. + *
  7078. + * Pad space is left for:
  7079. + * - 32-bit mode_t and seq
  7080. + * - 2 miscellaneous 32-bit values
  7081. + *
  7082. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  7083. + *
  7084. + * All rights reserved.
  7085. + *
  7086. + * This program is free software; you can redistribute it and/or modify
  7087. + * it under the terms of the GNU General Public License as published by
  7088. + * the Free Software Foundation; either version 2 of the License, or
  7089. + * (at your option) any later version.
  7090. + *
  7091. + * This program is distributed in the hope that it will be useful, but
  7092. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  7093. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  7094. + * NON INFRINGEMENT. See the GNU General Public License for more
  7095. + * details.
  7096. + *
  7097. + * You should have received a copy of the GNU General Public License
  7098. + * along with this program; if not, write to the Free Software
  7099. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  7100. + *
  7101. + */
  7102. +
  7103. +struct ipc64_perm
  7104. +{
  7105. + __kernel_key_t key;
  7106. + __kernel_uid32_t uid;
  7107. + __kernel_gid32_t gid;
  7108. + __kernel_uid32_t cuid;
  7109. + __kernel_gid32_t cgid;
  7110. + __kernel_mode_t mode;
  7111. + unsigned short __pad1;
  7112. + unsigned short seq;
  7113. + unsigned short __pad2;
  7114. + unsigned long __unused1;
  7115. + unsigned long __unused2;
  7116. +};
  7117. +
  7118. +#endif /* __NIOS2_IPCBUF_H__ */
  7119. --- linux/include/asm-nios2nommu/ipc.h
  7120. +++ linux/include/asm-nios2nommu/ipc.h
  7121. @@ -0,0 +1,51 @@
  7122. +#ifndef __NIOS2_IPC_H__
  7123. +#define __NIOS2_IPC_H__
  7124. +
  7125. +/* Copied from sparc version
  7126. + * These are used to wrap system calls on the Nios.
  7127. + *
  7128. + * See arch/niosnommu/kernel/sys_nios.c for ugly details..
  7129. + *
  7130. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  7131. + *
  7132. + * All rights reserved.
  7133. + *
  7134. + * This program is free software; you can redistribute it and/or modify
  7135. + * it under the terms of the GNU General Public License as published by
  7136. + * the Free Software Foundation; either version 2 of the License, or
  7137. + * (at your option) any later version.
  7138. + *
  7139. + * This program is distributed in the hope that it will be useful, but
  7140. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  7141. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  7142. + * NON INFRINGEMENT. See the GNU General Public License for more
  7143. + * details.
  7144. + *
  7145. + * You should have received a copy of the GNU General Public License
  7146. + * along with this program; if not, write to the Free Software
  7147. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  7148. + *
  7149. + */
  7150. +struct ipc_kludge {
  7151. + struct msgbuf *msgp;
  7152. + long msgtyp;
  7153. +};
  7154. +
  7155. +#define SEMOP 1
  7156. +#define SEMGET 2
  7157. +#define SEMCTL 3
  7158. +#define MSGSND 11
  7159. +#define MSGRCV 12
  7160. +#define MSGGET 13
  7161. +#define MSGCTL 14
  7162. +#define SHMAT 21
  7163. +#define SHMDT 22
  7164. +#define SHMGET 23
  7165. +#define SHMCTL 24
  7166. +
  7167. +/* Used by the DIPC package, try and avoid reusing it */
  7168. +#define DIPC 25
  7169. +
  7170. +#define IPCCALL(version,op) ((version)<<16 | (op))
  7171. +
  7172. +#endif
  7173. --- linux/include/asm-nios2nommu/irq.h
  7174. +++ linux/include/asm-nios2nommu/irq.h
  7175. @@ -0,0 +1,182 @@
  7176. +/*
  7177. + * 21Mar2001 1.1 dgt/microtronix
  7178. + *
  7179. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  7180. + *
  7181. + * All rights reserved.
  7182. + *
  7183. + * This program is free software; you can redistribute it and/or modify
  7184. + * it under the terms of the GNU General Public License as published by
  7185. + * the Free Software Foundation; either version 2 of the License, or
  7186. + * (at your option) any later version.
  7187. + *
  7188. + * This program is distributed in the hope that it will be useful, but
  7189. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  7190. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  7191. + * NON INFRINGEMENT. See the GNU General Public License for more
  7192. + * details.
  7193. + *
  7194. + * You should have received a copy of the GNU General Public License
  7195. + * along with this program; if not, write to the Free Software
  7196. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  7197. + *
  7198. + */
  7199. +
  7200. +
  7201. +#ifndef _NIOS2NOMMU_IRQ_H_
  7202. +#define _NIOS2NOMMU_IRQ_H_
  7203. +
  7204. +extern void disable_irq(unsigned int);
  7205. +extern void enable_irq(unsigned int);
  7206. +
  7207. +// #include <linux/config.h>
  7208. +#include <linux/interrupt.h>
  7209. +
  7210. +#define SYS_IRQS 32
  7211. +#define NR_IRQS SYS_IRQS
  7212. +
  7213. +/*
  7214. + * Interrupt source definitions
  7215. + * General interrupt sources are the level 1-7.
  7216. + * Adding an interrupt service routine for one of these sources
  7217. + * results in the addition of that routine to a chain of routines.
  7218. + * Each one is called in succession. Each individual interrupt
  7219. + * service routine should determine if the device associated with
  7220. + * that routine requires service.
  7221. + */
  7222. +
  7223. +#define IRQ01 (1) /* level 1 interrupt */
  7224. +#define IRQ02 (2) /* level 2 interrupt */
  7225. +#define IRQ03 (3) /* level 3 interrupt */
  7226. +#define IRQ04 (4) /* level 4 interrupt */
  7227. +#define IRQ05 (5) /* level 5 interrupt */
  7228. +#define IRQ06 (6) /* level 6 interrupt */
  7229. +#define IRQ07 (7) /* level 7 interrupt */
  7230. +#define IRQ08 (8) /* level 8 interrupt */
  7231. +#define IRQ09 (9) /* level 9 interrupt */
  7232. +#define IRQ0A (10) /* level 10 interrupt */
  7233. +#define IRQ0B (11) /* level 11 interrupt */
  7234. +#define IRQ0C (12) /* level 12 interrupt */
  7235. +#define IRQ0D (13) /* level 13 interrupt */
  7236. +#define IRQ0E (14) /* level 14 interrupt */
  7237. +#define IRQ0F (15) /* level 15 interrupt */
  7238. +#define IRQ10 (16) /* level 16 interrupt */
  7239. +#define IRQ12 (17) /* level 17 interrupt */
  7240. +#define IRQ13 (18) /* level 18 interrupt */
  7241. +#define IRQ14 (19) /* level 19 interrupt */
  7242. +#define IRQ15 (20) /* level 20 interrupt */
  7243. +#define IRQ16 (21) /* level 21 interrupt */
  7244. +#define IRQ17 (22) /* level 22 interrupt */
  7245. +#define IRQ18 (23) /* level 23 interrupt */
  7246. +#define IRQ19 (24) /* level 24 interrupt */
  7247. +#define IRQ1A (25) /* level 25 interrupt */
  7248. +#define IRQ1B (26) /* level 26 interrupt */
  7249. +#define IRQ1C (27) /* level 27 interrupt */
  7250. +#define IRQ1D (28) /* level 28 interrupt */
  7251. +#define IRQ1E (29) /* level 29 interrupt */
  7252. +#define IRQ1F (30) /* level 30 interrupt */
  7253. +#define IRQ20 (31) /* level 31 interrupt */
  7254. +#define IRQ21 (32) /* level 32 interrupt */
  7255. +
  7256. +#define IRQMAX IRQ21
  7257. +
  7258. +/*
  7259. + * "Generic" interrupt sources
  7260. + */
  7261. +
  7262. +/*
  7263. + * Machine specific interrupt sources.
  7264. + *
  7265. + * Adding an interrupt service routine for a source with this bit
  7266. + * set indicates a special machine specific interrupt source.
  7267. + * The machine specific files define these sources.
  7268. + *
  7269. + * Removed, they are not used by any one.
  7270. + */
  7271. +
  7272. +/*
  7273. + * various flags for request_irq()
  7274. + */
  7275. +#define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */
  7276. +#define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */
  7277. +#define IRQ_FLG_FAST (0x0004)
  7278. +#define IRQ_FLG_SLOW (0x0008)
  7279. +#define IRQ_FLG_STD (0x8000) /* internally used */
  7280. +
  7281. +/*
  7282. + * Functions to set and clear the interrupt mask.
  7283. + */
  7284. +
  7285. +/*
  7286. + * Use a zero to clean the bit.
  7287. + */
  7288. +static inline void clrimr(int mask)
  7289. +{
  7290. + int flags;
  7291. +
  7292. + local_irq_save(flags);
  7293. + __asm__ __volatile__(
  7294. + "rdctl r8, ienable\n"
  7295. + "and r8,r8,%0\n"
  7296. + "wrctl ienable, r8\n"
  7297. + : /* No output */
  7298. + : "r" (mask)
  7299. + : "r8");
  7300. + local_irq_restore(flags);
  7301. +}
  7302. +
  7303. +/*
  7304. + * Use a one to set the bit.
  7305. + */
  7306. +static inline void setimr(int mask)
  7307. +{
  7308. + int flags;
  7309. +
  7310. + local_irq_save(flags);
  7311. + __asm__ __volatile__(
  7312. + "rdctl r8, ienable\n"
  7313. + "or r8,r8,%0\n"
  7314. + "wrctl ienable, r8\n"
  7315. + : /* No output */
  7316. + : "r" (mask)
  7317. + : "r8");
  7318. + local_irq_restore(flags);
  7319. +}
  7320. +
  7321. +/*
  7322. + * This structure is used to chain together the ISRs for a particular
  7323. + * interrupt source (if it supports chaining).
  7324. + */
  7325. +typedef struct irq_node {
  7326. + irqreturn_t (*handler)(int, void *, struct pt_regs *);
  7327. + unsigned long flags;
  7328. + void *dev_id;
  7329. + const char *devname;
  7330. + struct irq_node *next;
  7331. +} irq_node_t;
  7332. +
  7333. +/*
  7334. + * This function returns a new irq_node_t
  7335. + */
  7336. +extern irq_node_t *new_irq_node(void);
  7337. +
  7338. +/*
  7339. + * This structure has only 4 elements for speed reasons
  7340. + */
  7341. +typedef struct irq_handler {
  7342. + irqreturn_t (*handler)(int, void *, struct pt_regs *);
  7343. + unsigned long flags;
  7344. + void *dev_id;
  7345. + const char *devname;
  7346. +} irq_handler_t;
  7347. +
  7348. +/* count of spurious interrupts */
  7349. +extern volatile unsigned int num_spurious;
  7350. +
  7351. +#define disable_irq_nosync(i) disable_irq(i)
  7352. +
  7353. +#ifndef irq_canonicalize
  7354. +#define irq_canonicalize(i) (i)
  7355. +#endif
  7356. +
  7357. +#endif /* _NIOS2NOMMU_IRQ_H_ */
  7358. --- linux/include/asm-nios2nommu/kmap_types.h
  7359. +++ linux/include/asm-nios2nommu/kmap_types.h
  7360. @@ -0,0 +1,43 @@
  7361. +/*
  7362. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  7363. + *
  7364. + * All rights reserved.
  7365. + *
  7366. + * This program is free software; you can redistribute it and/or modify
  7367. + * it under the terms of the GNU General Public License as published by
  7368. + * the Free Software Foundation; either version 2 of the License, or
  7369. + * (at your option) any later version.
  7370. + *
  7371. + * This program is distributed in the hope that it will be useful, but
  7372. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  7373. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  7374. + * NON INFRINGEMENT. See the GNU General Public License for more
  7375. + * details.
  7376. + *
  7377. + * You should have received a copy of the GNU General Public License
  7378. + * along with this program; if not, write to the Free Software
  7379. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  7380. + *
  7381. + */
  7382. +
  7383. +#ifndef _ASM_KMAP_TYPES_H
  7384. +#define _ASM_KMAP_TYPES_H
  7385. +
  7386. +enum km_type {
  7387. + KM_BOUNCE_READ,
  7388. + KM_SKB_SUNRPC_DATA,
  7389. + KM_SKB_DATA_SOFTIRQ,
  7390. + KM_USER0,
  7391. + KM_USER1,
  7392. + KM_BIO_SRC_IRQ,
  7393. + KM_BIO_DST_IRQ,
  7394. + KM_PTE0,
  7395. + KM_PTE1,
  7396. + KM_IRQ0,
  7397. + KM_IRQ1,
  7398. + KM_SOFTIRQ0,
  7399. + KM_SOFTIRQ1,
  7400. + KM_TYPE_NR
  7401. +};
  7402. +
  7403. +#endif
  7404. --- linux/include/asm-nios2nommu/linkage.h
  7405. +++ linux/include/asm-nios2nommu/linkage.h
  7406. @@ -0,0 +1,29 @@
  7407. +/*
  7408. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  7409. + *
  7410. + * All rights reserved.
  7411. + *
  7412. + * This program is free software; you can redistribute it and/or modify
  7413. + * it under the terms of the GNU General Public License as published by
  7414. + * the Free Software Foundation; either version 2 of the License, or
  7415. + * (at your option) any later version.
  7416. + *
  7417. + * This program is distributed in the hope that it will be useful, but
  7418. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  7419. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  7420. + * NON INFRINGEMENT. See the GNU General Public License for more
  7421. + * details.
  7422. + *
  7423. + * You should have received a copy of the GNU General Public License
  7424. + * along with this program; if not, write to the Free Software
  7425. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  7426. + *
  7427. + */
  7428. +
  7429. +#ifndef __ASM_LINKAGE_H
  7430. +#define __ASM_LINKAGE_H
  7431. +
  7432. +#define __ALIGN .align 3
  7433. +#define __ALIGN_STR ".align 3"
  7434. +
  7435. +#endif
  7436. --- linux/include/asm-nios2nommu/linux_logo.h
  7437. +++ linux/include/asm-nios2nommu/linux_logo.h
  7438. @@ -0,0 +1,953 @@
  7439. +/* $Id: linux_logo.h,v 1.3 2004/02/12 23:06:40 ken-h Exp $
  7440. + * include/asm-nios/linux_logo.h: This is a linux logo
  7441. + * to be displayed on boot.
  7442. + *
  7443. + * Copyright (C) 1996 Larry Ewing (lewing@isc.tamu.edu)
  7444. + * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  7445. + * Copyright (C) 2004 Micrtronix Datacom Ltd.
  7446. + *
  7447. + * You can put anything here, but:
  7448. + * LINUX_LOGO_COLORS has to be less than 224
  7449. + * image size has to be 80x80
  7450. + * values have to start from 0x20
  7451. + * (i.e. RGB(linux_logo_red[0],
  7452. + * linux_logo_green[0],
  7453. + * linux_logo_blue[0]) is color 0x20)
  7454. + * BW image has to be 80x80 as well, with MS bit
  7455. + * on the left
  7456. + * Serial_console ascii image can be any size,
  7457. + * but should contain %s to display the version
  7458. + *
  7459. + * All rights reserved.
  7460. + *
  7461. + * This program is free software; you can redistribute it and/or modify
  7462. + * it under the terms of the GNU General Public License as published by
  7463. + * the Free Software Foundation; either version 2 of the License, or
  7464. + * (at your option) any later version.
  7465. + *
  7466. + * This program is distributed in the hope that it will be useful, but
  7467. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  7468. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  7469. + * NON INFRINGEMENT. See the GNU General Public License for more
  7470. + * details.
  7471. + *
  7472. + * You should have received a copy of the GNU General Public License
  7473. + * along with this program; if not, write to the Free Software
  7474. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  7475. + *
  7476. + */
  7477. +
  7478. +#include <linux/init.h>
  7479. +#include <linux/version.h>
  7480. +
  7481. +#define linux_logo_banner "Linux/NIOS2 version " UTS_RELEASE
  7482. +
  7483. +#define __HAVE_ARCH_LINUX_LOGO
  7484. +#define __HAVE_ARCH_LINUX_LOGO16
  7485. +
  7486. +#define LINUX_LOGO_COLORS 221
  7487. +
  7488. +#ifdef INCLUDE_LINUX_LOGO_DATA
  7489. +
  7490. +unsigned char linux_logo_red[] __initdata = {
  7491. + 0x00, 0x06, 0x0a, 0x0e, 0x16, 0x1a, 0x1e, 0x22,
  7492. + 0x12, 0x00, 0x2a, 0x36, 0x42, 0x4e, 0x4a, 0x56,
  7493. + 0x26, 0x46, 0x2e, 0x32, 0x52, 0x3a, 0x02, 0x65,
  7494. + 0x5e, 0x3e, 0x74, 0x8a, 0xa2, 0x9a, 0x86, 0xc6,
  7495. + 0xc3, 0x65, 0xbb, 0xd2, 0xda, 0xd6, 0xe2, 0xf6,
  7496. + 0xfd, 0xae, 0x7b, 0xdd, 0xea, 0x6a, 0xaa, 0xe7,
  7497. + 0xbe, 0x5a, 0xee, 0x9e, 0x95, 0x80, 0x76, 0x79,
  7498. + 0x62, 0x36, 0x9a, 0xe2, 0xec, 0xe1, 0xb8, 0xd7,
  7499. + 0xaf, 0x25, 0xbc, 0xc0, 0xef, 0xea, 0xe8, 0xe8,
  7500. + 0xf5, 0xf1, 0xda, 0xd3, 0x79, 0xdb, 0xf4, 0xf6,
  7501. + 0xf6, 0xf6, 0xe2, 0x3d, 0xb4, 0xce, 0xe6, 0xee,
  7502. + 0xf6, 0x68, 0xd8, 0xec, 0xf5, 0xc6, 0xc8, 0x9c,
  7503. + 0x89, 0xd2, 0xee, 0xcb, 0xb9, 0xd2, 0x66, 0x5e,
  7504. + 0x8b, 0xbe, 0xa8, 0xd5, 0xca, 0xb6, 0xae, 0x9c,
  7505. + 0xc5, 0xbe, 0xbe, 0xca, 0x90, 0xb2, 0x9a, 0xa8,
  7506. + 0xb6, 0xf2, 0xce, 0xfa, 0xb2, 0x6e, 0xa6, 0xfe,
  7507. + 0xf6, 0xec, 0xfe, 0xd2, 0xea, 0xf5, 0xf2, 0xf2,
  7508. + 0xe9, 0xee, 0xf6, 0xf2, 0xee, 0xf6, 0xda, 0xd4,
  7509. + 0xfa, 0xca, 0xf2, 0xf6, 0xfe, 0xf2, 0xda, 0xe4,
  7510. + 0xf6, 0xdd, 0xf2, 0xee, 0xfa, 0xf0, 0x12, 0x4a,
  7511. + 0xd6, 0xf2, 0x8e, 0xf2, 0xf6, 0xf6, 0xb5, 0xf1,
  7512. + 0x26, 0x9a, 0xea, 0xf6, 0xe0, 0xd2, 0x16, 0x9a,
  7513. + 0x2e, 0xd2, 0x70, 0xd6, 0x46, 0x7c, 0xb4, 0x62,
  7514. + 0xda, 0xee, 0xd6, 0xa3, 0x74, 0xa7, 0xa2, 0xe0,
  7515. + 0xae, 0xbe, 0xce, 0xe2, 0xa3, 0x8e, 0x6d, 0x8e,
  7516. + 0x32, 0xaf, 0x50, 0x9e, 0x5b, 0x8a, 0x98, 0x82,
  7517. + 0x7a, 0x82, 0x56, 0x7c, 0x8a, 0x56, 0x5e, 0x86,
  7518. + 0x6a, 0x52, 0x59, 0x64, 0x5e,
  7519. +};
  7520. +
  7521. +unsigned char linux_logo_green[] __initdata = {
  7522. + 0x00, 0x06, 0x0a, 0x0e, 0x16, 0x1a, 0x1e, 0x22,
  7523. + 0x12, 0x00, 0x2a, 0x36, 0x42, 0x4e, 0x4a, 0x56,
  7524. + 0x26, 0x46, 0x2e, 0x32, 0x52, 0x3a, 0x02, 0x65,
  7525. + 0x5e, 0x3e, 0x74, 0x8a, 0xa2, 0x9a, 0x86, 0xc6,
  7526. + 0xc3, 0x62, 0xbb, 0xd2, 0xda, 0xd6, 0xe2, 0xf6,
  7527. + 0xfd, 0xae, 0x7b, 0xdd, 0xea, 0x6a, 0xaa, 0xe7,
  7528. + 0xbe, 0x5a, 0xee, 0x9e, 0x95, 0x80, 0x62, 0x5c,
  7529. + 0x4e, 0x26, 0x72, 0xaa, 0xba, 0xaf, 0x90, 0xae,
  7530. + 0x92, 0x1a, 0xa4, 0x85, 0xb6, 0xbe, 0xc3, 0xc8,
  7531. + 0xcf, 0xd0, 0xc2, 0xce, 0x57, 0xa2, 0xd6, 0xda,
  7532. + 0xda, 0xd7, 0xb8, 0x2a, 0x7b, 0x91, 0xae, 0xca,
  7533. + 0xda, 0x45, 0x9e, 0xb2, 0xd7, 0x9b, 0x90, 0x76,
  7534. + 0x5c, 0xa2, 0xbe, 0xa6, 0x85, 0x96, 0x4e, 0x46,
  7535. + 0x66, 0x92, 0x7a, 0x9a, 0x96, 0x9d, 0x9a, 0x6b,
  7536. + 0x8a, 0x8e, 0xb2, 0xca, 0x90, 0xa6, 0x79, 0x7c,
  7537. + 0xb6, 0xf2, 0xce, 0xfa, 0xb2, 0x6e, 0xa6, 0xfa,
  7538. + 0xea, 0xd7, 0xf6, 0xbc, 0xda, 0xde, 0xda, 0xe6,
  7539. + 0xca, 0xd8, 0xea, 0xe0, 0xcc, 0xf2, 0xce, 0xb2,
  7540. + 0xee, 0xa2, 0xd6, 0xe6, 0xf6, 0xd7, 0xc5, 0xb8,
  7541. + 0xc6, 0xb9, 0xce, 0xde, 0xce, 0xc6, 0x0e, 0x36,
  7542. + 0xae, 0xbe, 0x86, 0xba, 0xbe, 0xe6, 0x8e, 0xc4,
  7543. + 0x1e, 0x8e, 0xae, 0xba, 0xb2, 0xa6, 0x12, 0x7a,
  7544. + 0x20, 0xc6, 0x64, 0xaa, 0x2f, 0x70, 0x85, 0x46,
  7545. + 0xce, 0xd6, 0xa6, 0x6e, 0x51, 0x72, 0x92, 0xa6,
  7546. + 0x87, 0x96, 0xa2, 0xd6, 0x85, 0x7a, 0x6a, 0x6e,
  7547. + 0x22, 0x76, 0x36, 0x76, 0x3c, 0x6e, 0x63, 0x53,
  7548. + 0x66, 0x62, 0x42, 0x50, 0x56, 0x42, 0x56, 0x56,
  7549. + 0x56, 0x3e, 0x51, 0x52, 0x56,
  7550. +};
  7551. +
  7552. +unsigned char linux_logo_blue[] __initdata = {
  7553. + 0x00, 0x06, 0x0a, 0x0e, 0x16, 0x1a, 0x1e, 0x22,
  7554. + 0x12, 0x01, 0x2a, 0x36, 0x42, 0x4e, 0x4a, 0x56,
  7555. + 0x26, 0x46, 0x2e, 0x32, 0x52, 0x3a, 0x06, 0x65,
  7556. + 0x5e, 0x3e, 0x74, 0x8a, 0xa2, 0x9a, 0x86, 0xc6,
  7557. + 0xc3, 0x59, 0xbb, 0xd2, 0xda, 0xd6, 0xe2, 0xf6,
  7558. + 0xfd, 0xae, 0x7b, 0xdd, 0xea, 0x6a, 0xaa, 0xe7,
  7559. + 0xbe, 0x5a, 0xee, 0x9e, 0x95, 0x80, 0x2e, 0x08,
  7560. + 0x0a, 0x06, 0x0a, 0x0b, 0x0b, 0x0f, 0x0c, 0x0f,
  7561. + 0x3d, 0x09, 0x73, 0x09, 0x0d, 0x0a, 0x10, 0x1e,
  7562. + 0x2d, 0x13, 0x86, 0xba, 0x19, 0x0a, 0x36, 0x3c,
  7563. + 0x26, 0x14, 0x0d, 0x06, 0x07, 0x0a, 0x0b, 0x0f,
  7564. + 0x4a, 0x06, 0x0a, 0x0c, 0x2b, 0x0a, 0x0b, 0x0a,
  7565. + 0x06, 0x0a, 0x0a, 0x11, 0x0b, 0x0a, 0x0a, 0x1e,
  7566. + 0x0f, 0x0d, 0x0a, 0x0b, 0x22, 0x6a, 0x72, 0x0b,
  7567. + 0x0b, 0x22, 0x90, 0xca, 0x90, 0x92, 0x3c, 0x2c,
  7568. + 0xb6, 0xf2, 0xce, 0xfa, 0xb2, 0x6e, 0xa6, 0xea,
  7569. + 0xb6, 0x7c, 0xda, 0x8e, 0xa6, 0x87, 0x66, 0xb6,
  7570. + 0x81, 0x6a, 0xc6, 0x9a, 0x5b, 0xd2, 0xb6, 0x6a,
  7571. + 0xca, 0x45, 0x92, 0xb2, 0xca, 0x52, 0x8a, 0x3e,
  7572. + 0x2e, 0x66, 0x66, 0xae, 0x3e, 0x47, 0x06, 0x0e,
  7573. + 0x52, 0x36, 0x6a, 0x0e, 0x0e, 0xbe, 0x2c, 0x0e,
  7574. + 0x0a, 0x5a, 0x0d, 0x0e, 0x3e, 0x0a, 0x06, 0x2e,
  7575. + 0x06, 0x9e, 0x4e, 0x36, 0x06, 0x58, 0x24, 0x06,
  7576. + 0x9e, 0xae, 0x3a, 0x08, 0x08, 0x07, 0x5e, 0x0a,
  7577. + 0x32, 0x2e, 0x2a, 0xb2, 0x43, 0x48, 0x5f, 0x2e,
  7578. + 0x06, 0x06, 0x07, 0x24, 0x06, 0x32, 0x06, 0x06,
  7579. + 0x46, 0x2e, 0x22, 0x06, 0x06, 0x1e, 0x4c, 0x06,
  7580. + 0x3a, 0x22, 0x42, 0x34, 0x42,
  7581. +};
  7582. +
  7583. +unsigned char linux_logo[] __initdata = {
  7584. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7585. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7586. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7587. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7588. + 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x22, 0x22,
  7589. + 0x22, 0x21, 0x21, 0x21, 0x20, 0x20, 0x20, 0x20,
  7590. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7591. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7592. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7593. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7594. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7595. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7596. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7597. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7598. + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
  7599. + 0x26, 0x26, 0x25, 0x28, 0x23, 0x22, 0x21, 0x20,
  7600. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7601. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7602. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7603. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7604. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x20,
  7605. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7606. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7607. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7608. + 0x21, 0x23, 0x25, 0x2a, 0x2b, 0x2c, 0x2d, 0x2d,
  7609. + 0x2d, 0x2e, 0x2c, 0x2b, 0x2a, 0x25, 0x28, 0x22,
  7610. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7611. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7612. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7613. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7614. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x20, 0x20,
  7615. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7616. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7617. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  7618. + 0x24, 0x2a, 0x2c, 0x2f, 0x2c, 0x30, 0x30, 0x24,
  7619. + 0x25, 0x27, 0x2b, 0x2c, 0x2f, 0x31, 0x32, 0x25,
  7620. + 0x23, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7621. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7622. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7623. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7624. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x29, 0x20,
  7625. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7626. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7627. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x25,
  7628. + 0x33, 0x34, 0x35, 0x21, 0x36, 0x36, 0x36, 0x36,
  7629. + 0x36, 0x36, 0x36, 0x36, 0x21, 0x2b, 0x2f, 0x2c,
  7630. + 0x30, 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  7631. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7632. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7633. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7634. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7635. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7636. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7637. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x24, 0x33,
  7638. + 0x2d, 0x27, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7639. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x21, 0x31,
  7640. + 0x2d, 0x32, 0x24, 0x21, 0x20, 0x20, 0x20, 0x20,
  7641. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7642. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7643. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7644. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x29, 0x20,
  7645. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7646. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7647. + 0x20, 0x20, 0x20, 0x20, 0x21, 0x28, 0x2a, 0x34,
  7648. + 0x25, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7649. + 0x36, 0x36, 0x36, 0x23, 0x32, 0x27, 0x21, 0x36,
  7650. + 0x2a, 0x2d, 0x2a, 0x28, 0x21, 0x20, 0x20, 0x20,
  7651. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7652. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7653. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7654. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x29, 0x20,
  7655. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7656. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7657. + 0x20, 0x20, 0x20, 0x20, 0x22, 0x26, 0x2c, 0x35,
  7658. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7659. + 0x36, 0x36, 0x36, 0x25, 0x2f, 0x37, 0x32, 0x22,
  7660. + 0x36, 0x35, 0x31, 0x27, 0x22, 0x20, 0x20, 0x20,
  7661. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7662. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7663. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7664. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x29, 0x20,
  7665. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7666. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7667. + 0x20, 0x20, 0x20, 0x20, 0x23, 0x2a, 0x2f, 0x22,
  7668. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7669. + 0x36, 0x36, 0x36, 0x26, 0x38, 0x38, 0x35, 0x25,
  7670. + 0x36, 0x21, 0x2d, 0x2b, 0x24, 0x21, 0x20, 0x20,
  7671. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7672. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7673. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7674. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7675. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7676. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7677. + 0x20, 0x20, 0x20, 0x21, 0x24, 0x39, 0x39, 0x36,
  7678. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7679. + 0x36, 0x36, 0x36, 0x25, 0x2b, 0x30, 0x28, 0x22,
  7680. + 0x36, 0x36, 0x27, 0x34, 0x30, 0x23, 0x20, 0x20,
  7681. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7682. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7683. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7684. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x20,
  7685. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7686. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7687. + 0x20, 0x20, 0x20, 0x21, 0x26, 0x2d, 0x26, 0x36,
  7688. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7689. + 0x36, 0x36, 0x36, 0x22, 0x22, 0x36, 0x36, 0x36,
  7690. + 0x36, 0x36, 0x36, 0x2d, 0x33, 0x28, 0x21, 0x20,
  7691. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7692. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7693. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7694. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x20, 0x20,
  7695. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7696. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7697. + 0x20, 0x20, 0x20, 0x22, 0x30, 0x2f, 0x23, 0x36,
  7698. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7699. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7700. + 0x36, 0x36, 0x36, 0x2b, 0x2c, 0x25, 0x21, 0x20,
  7701. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7702. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7703. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7704. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x20,
  7705. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7706. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7707. + 0x20, 0x20, 0x20, 0x23, 0x2a, 0x34, 0x36, 0x36,
  7708. + 0x36, 0x21, 0x22, 0x36, 0x36, 0x36, 0x36, 0x36,
  7709. + 0x36, 0x36, 0x36, 0x21, 0x23, 0x22, 0x36, 0x36,
  7710. + 0x36, 0x36, 0x36, 0x28, 0x34, 0x27, 0x22, 0x20,
  7711. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7712. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7713. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7714. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x20, 0x20,
  7715. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7716. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7717. + 0x20, 0x20, 0x20, 0x23, 0x32, 0x2f, 0x36, 0x36,
  7718. + 0x21, 0x21, 0x24, 0x27, 0x21, 0x36, 0x36, 0x36,
  7719. + 0x36, 0x36, 0x28, 0x27, 0x22, 0x33, 0x24, 0x36,
  7720. + 0x36, 0x36, 0x36, 0x22, 0x2f, 0x2a, 0x23, 0x20,
  7721. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7722. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7723. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7724. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x29, 0x20,
  7725. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7726. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7727. + 0x20, 0x20, 0x20, 0x23, 0x32, 0x2f, 0x36, 0x36,
  7728. + 0x30, 0x3a, 0x38, 0x24, 0x24, 0x36, 0x36, 0x36,
  7729. + 0x23, 0x2f, 0x3b, 0x3c, 0x3d, 0x30, 0x25, 0x21,
  7730. + 0x36, 0x36, 0x36, 0x36, 0x2f, 0x32, 0x23, 0x20,
  7731. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7732. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7733. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7734. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7735. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7736. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7737. + 0x20, 0x20, 0x20, 0x23, 0x32, 0x2f, 0x36, 0x23,
  7738. + 0x3e, 0x3f, 0x40, 0x3a, 0x22, 0x36, 0x36, 0x21,
  7739. + 0x41, 0x42, 0x43, 0x44, 0x45, 0x3e, 0x23, 0x21,
  7740. + 0x36, 0x36, 0x36, 0x36, 0x2f, 0x33, 0x28, 0x21,
  7741. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7742. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7743. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7744. + 0x20, 0x20, 0x29, 0x20, 0x29, 0x29, 0x29, 0x20,
  7745. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7746. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7747. + 0x20, 0x20, 0x20, 0x23, 0x32, 0x2f, 0x36, 0x2b,
  7748. + 0x44, 0x40, 0x46, 0x47, 0x35, 0x36, 0x36, 0x26,
  7749. + 0x43, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x2e, 0x36,
  7750. + 0x36, 0x36, 0x36, 0x36, 0x31, 0x35, 0x24, 0x21,
  7751. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7752. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7753. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7754. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7755. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7756. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7757. + 0x20, 0x20, 0x20, 0x23, 0x32, 0x34, 0x36, 0x4d,
  7758. + 0x4e, 0x25, 0x2f, 0x46, 0x4a, 0x22, 0x23, 0x32,
  7759. + 0x4f, 0x50, 0x21, 0x31, 0x51, 0x52, 0x53, 0x36,
  7760. + 0x36, 0x36, 0x36, 0x36, 0x31, 0x35, 0x24, 0x21,
  7761. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7762. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7763. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7764. + 0x20, 0x20, 0x29, 0x20, 0x29, 0x29, 0x29, 0x20,
  7765. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7766. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7767. + 0x20, 0x20, 0x20, 0x23, 0x2a, 0x2f, 0x21, 0x3a,
  7768. + 0x4d, 0x21, 0x31, 0x54, 0x55, 0x28, 0x30, 0x2b,
  7769. + 0x4b, 0x4d, 0x36, 0x23, 0x32, 0x50, 0x3f, 0x36,
  7770. + 0x36, 0x36, 0x36, 0x36, 0x2e, 0x39, 0x24, 0x21,
  7771. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7772. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7773. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7774. + 0x20, 0x20, 0x29, 0x20, 0x29, 0x20, 0x29, 0x20,
  7775. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7776. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7777. + 0x20, 0x20, 0x20, 0x23, 0x2a, 0x38, 0x23, 0x37,
  7778. + 0x55, 0x36, 0x28, 0x3a, 0x56, 0x57, 0x57, 0x58,
  7779. + 0x3c, 0x4d, 0x36, 0x36, 0x36, 0x40, 0x40, 0x21,
  7780. + 0x36, 0x36, 0x36, 0x36, 0x2e, 0x39, 0x24, 0x21,
  7781. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7782. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7783. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7784. + 0x20, 0x20, 0x29, 0x29, 0x29, 0x20, 0x29, 0x20,
  7785. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7786. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7787. + 0x20, 0x20, 0x20, 0x22, 0x30, 0x51, 0x23, 0x35,
  7788. + 0x43, 0x25, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e,
  7789. + 0x5f, 0x60, 0x61, 0x36, 0x31, 0x47, 0x3b, 0x36,
  7790. + 0x36, 0x36, 0x36, 0x36, 0x31, 0x2c, 0x25, 0x21,
  7791. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7792. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7793. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7794. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7795. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7796. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7797. + 0x20, 0x20, 0x20, 0x22, 0x30, 0x2f, 0x23, 0x22,
  7798. + 0x40, 0x62, 0x63, 0x5d, 0x64, 0x65, 0x66, 0x67,
  7799. + 0x68, 0x69, 0x66, 0x5e, 0x6a, 0x6b, 0x2a, 0x36,
  7800. + 0x36, 0x36, 0x36, 0x36, 0x33, 0x2e, 0x26, 0x21,
  7801. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7802. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7803. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7804. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7805. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7806. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7807. + 0x20, 0x20, 0x20, 0x22, 0x27, 0x2f, 0x23, 0x36,
  7808. + 0x6c, 0x63, 0x6d, 0x64, 0x5c, 0x66, 0x69, 0x6e,
  7809. + 0x6f, 0x70, 0x71, 0x69, 0x69, 0x72, 0x6c, 0x36,
  7810. + 0x36, 0x36, 0x36, 0x36, 0x33, 0x34, 0x27, 0x22,
  7811. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7812. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7813. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7814. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7815. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7816. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7817. + 0x20, 0x20, 0x20, 0x22, 0x27, 0x34, 0x26, 0x73,
  7818. + 0x74, 0x75, 0x76, 0x64, 0x65, 0x77, 0x69, 0x78,
  7819. + 0x70, 0x71, 0x71, 0x71, 0x72, 0x5f, 0x5e, 0x21,
  7820. + 0x36, 0x36, 0x36, 0x36, 0x25, 0x38, 0x2a, 0x23,
  7821. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7822. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7823. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7824. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7825. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7826. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7827. + 0x20, 0x20, 0x20, 0x22, 0x26, 0x2d, 0x33, 0x79,
  7828. + 0x63, 0x7a, 0x7b, 0x5c, 0x66, 0x69, 0x6e, 0x7c,
  7829. + 0x71, 0x71, 0x69, 0x7d, 0x7e, 0x7a, 0x7f, 0x36,
  7830. + 0x36, 0x36, 0x36, 0x36, 0x21, 0x51, 0x2b, 0x28,
  7831. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7832. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7833. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7834. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7835. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7836. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7837. + 0x20, 0x20, 0x20, 0x22, 0x26, 0x2d, 0x32, 0x24,
  7838. + 0x80, 0x81, 0x64, 0x82, 0x77, 0x69, 0x71, 0x71,
  7839. + 0x69, 0x83, 0x84, 0x85, 0x7a, 0x85, 0x86, 0x36,
  7840. + 0x21, 0x2b, 0x23, 0x36, 0x36, 0x39, 0x2e, 0x26,
  7841. + 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7842. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7843. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7844. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7845. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7846. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7847. + 0x20, 0x20, 0x20, 0x22, 0x27, 0x2d, 0x33, 0x21,
  7848. + 0x87, 0x88, 0x89, 0x72, 0x67, 0x66, 0x5f, 0x89,
  7849. + 0x8a, 0x63, 0x85, 0x8b, 0x8c, 0x8d, 0x41, 0x36,
  7850. + 0x36, 0x2d, 0x3a, 0x35, 0x36, 0x24, 0x51, 0x32,
  7851. + 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7852. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7853. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7854. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7855. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7856. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7857. + 0x20, 0x20, 0x20, 0x22, 0x30, 0x2f, 0x33, 0x21,
  7858. + 0x55, 0x8e, 0x8f, 0x8a, 0x7d, 0x5e, 0x90, 0x7e,
  7859. + 0x75, 0x75, 0x90, 0x62, 0x40, 0x3f, 0x49, 0x23,
  7860. + 0x36, 0x24, 0x3a, 0x3a, 0x24, 0x36, 0x2e, 0x31,
  7861. + 0x26, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7862. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7863. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7864. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7865. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7866. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7867. + 0x20, 0x20, 0x21, 0x28, 0x33, 0x37, 0x25, 0x22,
  7868. + 0x3b, 0x50, 0x8e, 0x8f, 0x90, 0x7e, 0x90, 0x63,
  7869. + 0x74, 0x91, 0x92, 0x42, 0x93, 0x4b, 0x45, 0x2c,
  7870. + 0x36, 0x36, 0x33, 0x39, 0x21, 0x36, 0x22, 0x51,
  7871. + 0x33, 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  7872. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7873. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7874. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7875. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7876. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7877. + 0x20, 0x20, 0x22, 0x27, 0x2e, 0x2e, 0x36, 0x21,
  7878. + 0x94, 0x3f, 0x50, 0x95, 0x96, 0x8f, 0x8f, 0x97,
  7879. + 0x8e, 0x42, 0x50, 0x43, 0x47, 0x48, 0x48, 0x98,
  7880. + 0x21, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x39,
  7881. + 0x2e, 0x27, 0x23, 0x20, 0x20, 0x20, 0x20, 0x20,
  7882. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7883. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7884. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7885. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7886. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7887. + 0x20, 0x22, 0x24, 0x2b, 0x38, 0x28, 0x36, 0x32,
  7888. + 0x4c, 0x4b, 0x50, 0x50, 0x50, 0x42, 0x42, 0x50,
  7889. + 0x50, 0x40, 0x45, 0x99, 0x48, 0x48, 0x48, 0x48,
  7890. + 0x34, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x23,
  7891. + 0x2f, 0x2b, 0x24, 0x21, 0x20, 0x20, 0x20, 0x20,
  7892. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7893. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7894. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7895. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7896. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7897. + 0x21, 0x28, 0x32, 0x51, 0x32, 0x28, 0x21, 0x98,
  7898. + 0x48, 0x47, 0x9a, 0x50, 0x50, 0x50, 0x50, 0x50,
  7899. + 0x9a, 0x4f, 0x9b, 0x48, 0x48, 0x48, 0x48, 0x48,
  7900. + 0x93, 0x23, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7901. + 0x2a, 0x2f, 0x2a, 0x28, 0x21, 0x20, 0x20, 0x20,
  7902. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7903. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7904. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7905. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7906. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  7907. + 0x23, 0x30, 0x2e, 0x2c, 0x36, 0x21, 0x51, 0x9b,
  7908. + 0x48, 0x48, 0x52, 0x3f, 0x50, 0x50, 0x40, 0x4b,
  7909. + 0x47, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7910. + 0x48, 0x34, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7911. + 0x36, 0x2d, 0x31, 0x27, 0x23, 0x21, 0x20, 0x20,
  7912. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7913. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7914. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7915. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7916. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x23,
  7917. + 0x27, 0x2c, 0x2d, 0x21, 0x36, 0x28, 0x44, 0x48,
  7918. + 0x48, 0x48, 0x48, 0x47, 0x46, 0x4f, 0x47, 0x48,
  7919. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7920. + 0x48, 0x9c, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7921. + 0x36, 0x28, 0x51, 0x39, 0x26, 0x22, 0x20, 0x20,
  7922. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7923. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7924. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7925. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7926. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x25,
  7927. + 0x35, 0x51, 0x28, 0x36, 0x36, 0x9d, 0x48, 0x48,
  7928. + 0x48, 0x48, 0x48, 0x48, 0x9b, 0x48, 0x48, 0x48,
  7929. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7930. + 0x48, 0x4f, 0x28, 0x36, 0x36, 0x36, 0x36, 0x36,
  7931. + 0x36, 0x36, 0x28, 0x38, 0x2b, 0x25, 0x22, 0x20,
  7932. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7933. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7934. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7935. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7936. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x24, 0x33,
  7937. + 0x51, 0x25, 0x36, 0x36, 0x23, 0x40, 0x9b, 0x48,
  7938. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7939. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7940. + 0x9b, 0x99, 0x2b, 0x36, 0x36, 0x36, 0x36, 0x36,
  7941. + 0x36, 0x36, 0x36, 0x30, 0x2f, 0x33, 0x24, 0x21,
  7942. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7943. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7944. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7945. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7946. + 0x20, 0x20, 0x20, 0x20, 0x21, 0x23, 0x30, 0x34,
  7947. + 0x27, 0x36, 0x36, 0x36, 0x2a, 0x40, 0x47, 0x48,
  7948. + 0x48, 0x48, 0x48, 0x9b, 0x99, 0x99, 0x9b, 0x48,
  7949. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x9b, 0x47, 0x52,
  7950. + 0x46, 0x4f, 0x37, 0x21, 0x36, 0x36, 0x36, 0x36,
  7951. + 0x36, 0x36, 0x36, 0x36, 0x30, 0x34, 0x2a, 0x23,
  7952. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7953. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7954. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7955. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7956. + 0x20, 0x20, 0x20, 0x20, 0x22, 0x25, 0x39, 0x2c,
  7957. + 0x36, 0x36, 0x36, 0x21, 0x31, 0x4e, 0x9a, 0x4c,
  7958. + 0x47, 0x9b, 0x9b, 0x52, 0x46, 0x4f, 0x52, 0x9b,
  7959. + 0x9b, 0x9b, 0x47, 0x4f, 0x45, 0x9a, 0x93, 0x93,
  7960. + 0x3f, 0x93, 0x98, 0x28, 0x36, 0x36, 0x36, 0x36,
  7961. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x39, 0x2c, 0x26,
  7962. + 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7963. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7964. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7965. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7966. + 0x20, 0x20, 0x20, 0x20, 0x23, 0x2a, 0x34, 0x28,
  7967. + 0x36, 0x36, 0x36, 0x22, 0x38, 0x98, 0x44, 0x99,
  7968. + 0x9b, 0x48, 0x48, 0x9b, 0x4c, 0x48, 0x48, 0x48,
  7969. + 0x48, 0x48, 0x48, 0x47, 0x52, 0x46, 0x43, 0x93,
  7970. + 0x40, 0x40, 0x43, 0x53, 0x21, 0x23, 0x33, 0x23,
  7971. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x21, 0x2f, 0x32,
  7972. + 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7973. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7974. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7975. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7976. + 0x20, 0x20, 0x20, 0x21, 0x24, 0x2b, 0x31, 0x36,
  7977. + 0x36, 0x22, 0x36, 0x24, 0x9e, 0x4f, 0x9b, 0x48,
  7978. + 0x48, 0x48, 0x48, 0x9b, 0x99, 0x9f, 0x52, 0x48,
  7979. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x47,
  7980. + 0x4f, 0x9a, 0x3f, 0x46, 0x38, 0x36, 0x21, 0x30,
  7981. + 0x26, 0x36, 0x36, 0x36, 0x36, 0x36, 0x39, 0x2c,
  7982. + 0x25, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7983. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7984. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7985. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7986. + 0x20, 0x20, 0x20, 0x22, 0x26, 0x2e, 0x33, 0x36,
  7987. + 0x25, 0x25, 0x36, 0x4d, 0x52, 0x48, 0x48, 0x48,
  7988. + 0x47, 0x9f, 0x48, 0x48, 0x48, 0xa0, 0xa1, 0xa2,
  7989. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7990. + 0x48, 0x47, 0x44, 0x93, 0x43, 0x23, 0x36, 0x36,
  7991. + 0x26, 0x24, 0x36, 0x36, 0x36, 0x36, 0x28, 0x2f,
  7992. + 0x2a, 0x23, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7993. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7994. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7995. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7996. + 0x20, 0x20, 0x20, 0x23, 0x2a, 0x51, 0x24, 0x36,
  7997. + 0x2a, 0x36, 0x28, 0x44, 0x48, 0x48, 0x48, 0x48,
  7998. + 0xa3, 0xa4, 0x48, 0x48, 0x9f, 0xa5, 0xa6, 0x9f,
  7999. + 0x48, 0x48, 0x48, 0xa2, 0xa7, 0x47, 0x48, 0x48,
  8000. + 0x48, 0x48, 0x9b, 0x4b, 0x44, 0x37, 0x36, 0x23,
  8001. + 0x28, 0x30, 0x22, 0x36, 0x36, 0x36, 0x36, 0x2d,
  8002. + 0x35, 0x24, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  8003. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8004. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8005. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8006. + 0x20, 0x20, 0x21, 0x28, 0x2b, 0x34, 0x36, 0x25,
  8007. + 0x24, 0x36, 0x4a, 0x48, 0x48, 0x48, 0x48, 0x48,
  8008. + 0xa8, 0xa1, 0x48, 0x48, 0x9f, 0xa9, 0xa6, 0x9f,
  8009. + 0x48, 0x48, 0xaa, 0xa1, 0xa5, 0x9f, 0x48, 0x48,
  8010. + 0x48, 0x48, 0x48, 0x9b, 0x52, 0x3f, 0x21, 0x30,
  8011. + 0x35, 0x25, 0x30, 0x36, 0x36, 0x36, 0x36, 0x32,
  8012. + 0x2d, 0x26, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20,
  8013. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8014. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8015. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8016. + 0x20, 0x20, 0x22, 0x26, 0x2e, 0x35, 0x36, 0x2a,
  8017. + 0x36, 0x24, 0x4f, 0x48, 0x52, 0x52, 0x48, 0x48,
  8018. + 0xab, 0xac, 0xa0, 0x48, 0xad, 0xa6, 0xa6, 0x9f,
  8019. + 0x48, 0xa2, 0xa9, 0xa6, 0xa2, 0x48, 0x48, 0x48,
  8020. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x47, 0x32, 0x30,
  8021. + 0x2a, 0x23, 0x30, 0x23, 0x36, 0x36, 0x36, 0x21,
  8022. + 0x2f, 0x32, 0x23, 0x20, 0x20, 0x20, 0x20, 0x20,
  8023. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8024. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8025. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8026. + 0x20, 0x21, 0x23, 0x2a, 0x51, 0x28, 0x28, 0x25,
  8027. + 0x36, 0x3a, 0x48, 0x48, 0xae, 0xaf, 0x48, 0x48,
  8028. + 0xad, 0xac, 0xa1, 0x9f, 0xa2, 0xa9, 0xa9, 0xa2,
  8029. + 0x48, 0xab, 0x78, 0xa7, 0x48, 0x48, 0x48, 0x48,
  8030. + 0x9f, 0x48, 0x48, 0x48, 0x48, 0x48, 0x38, 0x21,
  8031. + 0x36, 0x36, 0x22, 0x27, 0x36, 0x36, 0x36, 0x36,
  8032. + 0x2e, 0x35, 0x24, 0x21, 0x20, 0x20, 0x20, 0x20,
  8033. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8034. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8035. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8036. + 0x20, 0x22, 0x25, 0x2c, 0x34, 0x36, 0x30, 0x21,
  8037. + 0x23, 0x43, 0x48, 0x48, 0xb0, 0xb1, 0xb2, 0x9f,
  8038. + 0x48, 0xb3, 0xa5, 0xb3, 0xab, 0xa9, 0xa9, 0xb3,
  8039. + 0xb4, 0xa9, 0xb5, 0xb0, 0x48, 0x48, 0xa0, 0xa5,
  8040. + 0xa1, 0xad, 0x48, 0x48, 0x48, 0x48, 0x94, 0x36,
  8041. + 0x36, 0x36, 0x36, 0x32, 0x36, 0x36, 0x36, 0x36,
  8042. + 0x2a, 0x2e, 0x26, 0x22, 0x20, 0x20, 0x20, 0x20,
  8043. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8044. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8045. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8046. + 0x21, 0x23, 0x2a, 0x51, 0x25, 0x21, 0x2a, 0x36,
  8047. + 0x2e, 0x9b, 0x48, 0x48, 0x48, 0xb6, 0xb7, 0xa4,
  8048. + 0xa2, 0xa7, 0xb5, 0x78, 0x6f, 0x6f, 0x6e, 0x6f,
  8049. + 0xa9, 0xb5, 0xab, 0x48, 0x9f, 0xab, 0xa9, 0xa1,
  8050. + 0xaa, 0x48, 0x48, 0x48, 0x48, 0x48, 0x98, 0x36,
  8051. + 0x36, 0x36, 0x36, 0x32, 0x36, 0x36, 0x36, 0x36,
  8052. + 0x22, 0x2f, 0x30, 0x22, 0x20, 0x20, 0x20, 0x20,
  8053. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8054. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8055. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8056. + 0x22, 0x25, 0x2c, 0x34, 0x36, 0x24, 0x28, 0x36,
  8057. + 0x54, 0x48, 0x48, 0x48, 0x48, 0xa2, 0xa8, 0xa1,
  8058. + 0xa5, 0xa6, 0x6e, 0x6e, 0x6f, 0x6f, 0x6f, 0x6f,
  8059. + 0x6f, 0x78, 0xa5, 0xa0, 0xa0, 0x78, 0xa6, 0xa2,
  8060. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x9a, 0x36,
  8061. + 0x36, 0x36, 0x36, 0x30, 0x36, 0x36, 0x36, 0x36,
  8062. + 0x21, 0x2f, 0x32, 0x23, 0x20, 0x20, 0x20, 0x20,
  8063. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8064. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8065. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  8066. + 0x28, 0x32, 0x2f, 0x28, 0x36, 0x27, 0x22, 0x21,
  8067. + 0x43, 0x48, 0x4b, 0xa2, 0x9f, 0x48, 0xa2, 0xa1,
  8068. + 0xb8, 0x6e, 0x6e, 0xb5, 0x78, 0x6f, 0x78, 0x78,
  8069. + 0x6e, 0x6f, 0x78, 0xb5, 0xa6, 0xa1, 0xa0, 0x48,
  8070. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x4b, 0x21,
  8071. + 0x36, 0x36, 0x21, 0x26, 0x36, 0x36, 0x36, 0x36,
  8072. + 0x36, 0x34, 0x2b, 0x28, 0x21, 0x20, 0x20, 0x20,
  8073. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8074. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8075. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  8076. + 0x25, 0x2c, 0x39, 0x36, 0x36, 0x30, 0x22, 0x25,
  8077. + 0x52, 0x48, 0xa3, 0xb1, 0xb6, 0xb3, 0xaa, 0xac,
  8078. + 0x68, 0x68, 0x6e, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f,
  8079. + 0x78, 0x6f, 0x6f, 0xb5, 0xa6, 0xb4, 0x48, 0x9f,
  8080. + 0xb4, 0xb4, 0xa2, 0x9f, 0x48, 0x48, 0x4f, 0x21,
  8081. + 0x36, 0x36, 0x22, 0x26, 0x36, 0x36, 0x36, 0x36,
  8082. + 0x36, 0x2c, 0x35, 0x24, 0x21, 0x20, 0x20, 0x20,
  8083. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8084. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8085. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  8086. + 0x30, 0x2d, 0x21, 0x36, 0x36, 0x32, 0x23, 0x2a,
  8087. + 0x47, 0x48, 0xa2, 0xb6, 0xaf, 0xb9, 0xba, 0x68,
  8088. + 0x6e, 0x6e, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x78,
  8089. + 0x6f, 0x6f, 0xa6, 0x6f, 0xb5, 0xa0, 0xaa, 0xa6,
  8090. + 0xa6, 0xa9, 0xb2, 0xb3, 0x48, 0x48, 0x4c, 0x22,
  8091. + 0x36, 0x36, 0x24, 0x23, 0x36, 0x36, 0x36, 0x36,
  8092. + 0x36, 0x2c, 0x39, 0x24, 0x21, 0x20, 0x20, 0x20,
  8093. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8094. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8095. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x28,
  8096. + 0x33, 0x2e, 0x36, 0x36, 0x23, 0x31, 0x27, 0x39,
  8097. + 0x9b, 0x48, 0x48, 0x48, 0xb0, 0xb0, 0xba, 0xb8,
  8098. + 0x68, 0x68, 0x69, 0x78, 0x6f, 0xb5, 0x6f, 0xb5,
  8099. + 0x78, 0x78, 0x78, 0x78, 0x78, 0xa5, 0xbb, 0xa9,
  8100. + 0xa5, 0x48, 0x48, 0x48, 0x48, 0x48, 0x4c, 0x23,
  8101. + 0x36, 0x36, 0x26, 0x36, 0x36, 0x36, 0x36, 0x36,
  8102. + 0x36, 0x2c, 0x39, 0x24, 0x21, 0x20, 0x20, 0x20,
  8103. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8104. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8105. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x28,
  8106. + 0x2b, 0x39, 0x36, 0x36, 0x36, 0x26, 0x32, 0x31,
  8107. + 0x9b, 0x48, 0x48, 0x48, 0x48, 0x9f, 0xac, 0x68,
  8108. + 0xbc, 0x6e, 0x6e, 0x6e, 0xb5, 0x6f, 0x6e, 0x6f,
  8109. + 0x6f, 0x78, 0x78, 0xb5, 0xb5, 0xa5, 0x9f, 0x9f,
  8110. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x46, 0x22,
  8111. + 0x36, 0x21, 0x26, 0x36, 0x36, 0x36, 0x36, 0x36,
  8112. + 0x36, 0x2c, 0x35, 0x24, 0x21, 0x20, 0x20, 0x20,
  8113. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8114. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8115. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x24,
  8116. + 0x35, 0x39, 0x36, 0x36, 0x36, 0x36, 0x26, 0x2d,
  8117. + 0x9b, 0x48, 0x48, 0xb0, 0xaa, 0xb3, 0xbd, 0xb8,
  8118. + 0xb8, 0x68, 0x6e, 0x6e, 0xb5, 0x6f, 0x78, 0x6e,
  8119. + 0x78, 0x6f, 0x78, 0x78, 0xb5, 0xa9, 0xa2, 0x48,
  8120. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x9a, 0x36,
  8121. + 0x24, 0x27, 0xbe, 0x24, 0x25, 0x28, 0x21, 0x36,
  8122. + 0x36, 0x34, 0x2b, 0x28, 0x21, 0x20, 0x20, 0x20,
  8123. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8124. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8125. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x25,
  8126. + 0x39, 0x4d, 0xbf, 0x84, 0x81, 0x57, 0x21, 0x39,
  8127. + 0x52, 0x48, 0x48, 0x62, 0xb1, 0xc0, 0xc1, 0xc1,
  8128. + 0xb8, 0xb8, 0x68, 0xbc, 0x6e, 0x6e, 0x6e, 0x78,
  8129. + 0x78, 0x78, 0x78, 0x6e, 0x78, 0xa9, 0xa0, 0xab,
  8130. + 0xb3, 0xa2, 0x48, 0x48, 0x48, 0x48, 0x53, 0x28,
  8131. + 0x23, 0x36, 0x36, 0x36, 0x21, 0x28, 0x2c, 0x30,
  8132. + 0x21, 0x38, 0x33, 0x28, 0x21, 0x20, 0x20, 0x20,
  8133. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8134. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8135. + 0x20, 0x20, 0x20, 0x21, 0x22, 0x22, 0x28, 0x30,
  8136. + 0x2d, 0xc2, 0x7a, 0xc3, 0xc4, 0xc4, 0x7f, 0x22,
  8137. + 0x51, 0x52, 0x48, 0x48, 0xb0, 0xaa, 0xa8, 0xbd,
  8138. + 0x68, 0xb8, 0xb8, 0x68, 0x68, 0x6e, 0x6e, 0x6f,
  8139. + 0x6e, 0x6e, 0xb5, 0x6e, 0x78, 0xab, 0xab, 0xb5,
  8140. + 0x78, 0xa6, 0xb3, 0xc5, 0xac, 0xac, 0xc6, 0x61,
  8141. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x30, 0x32,
  8142. + 0x25, 0x4d, 0x2b, 0x28, 0x21, 0x20, 0x20, 0x20,
  8143. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8144. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8145. + 0x20, 0x21, 0x23, 0x24, 0x26, 0x30, 0x33, 0x31,
  8146. + 0x4d, 0x91, 0x5b, 0xc3, 0xc4, 0xc4, 0xc4, 0x5a,
  8147. + 0x21, 0x2e, 0x46, 0x48, 0x48, 0x48, 0xb0, 0x64,
  8148. + 0xc1, 0xb8, 0xb8, 0xb8, 0x68, 0x71, 0x6e, 0x6e,
  8149. + 0x6f, 0x71, 0x6f, 0x6f, 0xa6, 0xa0, 0x9f, 0xb4,
  8150. + 0xb4, 0xa0, 0xa1, 0xb7, 0xc7, 0x69, 0x66, 0xc8,
  8151. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x21, 0x26, 0x25,
  8152. + 0x83, 0xc9, 0x2c, 0x25, 0x21, 0x20, 0x20, 0x20,
  8153. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8154. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8155. + 0x21, 0x28, 0x30, 0x35, 0x2d, 0x2f, 0x37, 0x4a,
  8156. + 0x60, 0x85, 0xca, 0xcb, 0xc4, 0xc4, 0xc4, 0x82,
  8157. + 0x86, 0x36, 0x32, 0x3f, 0xa2, 0xa4, 0xa8, 0xa9,
  8158. + 0xb8, 0xb8, 0xb8, 0xb8, 0x68, 0x6e, 0x6e, 0x6e,
  8159. + 0x6e, 0x71, 0x6f, 0x71, 0xa6, 0xb4, 0x9f, 0x9f,
  8160. + 0x48, 0x48, 0x48, 0xcc, 0xc3, 0xc7, 0xcd, 0xce,
  8161. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x21, 0x57,
  8162. + 0x77, 0x66, 0x34, 0x27, 0x22, 0x20, 0x20, 0x20,
  8163. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8164. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8165. + 0x23, 0x30, 0x31, 0xcf, 0x91, 0x7e, 0x90, 0x90,
  8166. + 0x8b, 0x5b, 0xc3, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8167. + 0x5d, 0xd0, 0x36, 0x24, 0xd1, 0xb1, 0xaf, 0xaa,
  8168. + 0xba, 0xb8, 0x68, 0x68, 0x68, 0x71, 0x6e, 0x6e,
  8169. + 0x6e, 0x6f, 0x6e, 0x78, 0xa1, 0xa9, 0xa1, 0xb0,
  8170. + 0x9f, 0x9b, 0x99, 0xcc, 0x64, 0x5c, 0x8b, 0xd0,
  8171. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x73, 0x5d,
  8172. + 0x82, 0x5c, 0xd2, 0x2a, 0x23, 0x20, 0x20, 0x20,
  8173. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8174. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  8175. + 0x24, 0x2b, 0xcf, 0x8b, 0x5b, 0x76, 0x5b, 0x5b,
  8176. + 0x7b, 0xc3, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8177. + 0xc7, 0x5e, 0x22, 0x36, 0x21, 0x3a, 0x99, 0x48,
  8178. + 0xa2, 0xa8, 0xb7, 0xc1, 0xb8, 0x68, 0x68, 0xbc,
  8179. + 0x68, 0x6e, 0xb5, 0xb4, 0xb4, 0xab, 0xb5, 0xa1,
  8180. + 0xb0, 0x4f, 0x3f, 0xd3, 0x7b, 0x7b, 0x85, 0x80,
  8181. + 0xbe, 0x36, 0x36, 0x36, 0x21, 0xd4, 0x7e, 0x7b,
  8182. + 0x64, 0x64, 0xd5, 0x35, 0x24, 0x21, 0x20, 0x20,
  8183. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8184. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  8185. + 0x26, 0x31, 0xd6, 0x5b, 0x64, 0xc3, 0xc3, 0xcb,
  8186. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8187. + 0xc4, 0x66, 0xd7, 0x36, 0x36, 0x36, 0x2c, 0x4b,
  8188. + 0xd8, 0xd9, 0xb3, 0xa8, 0xbd, 0xbd, 0xbd, 0xbd,
  8189. + 0xa9, 0xab, 0xb3, 0xa5, 0xa2, 0x9f, 0xa2, 0xa1,
  8190. + 0x6a, 0x9a, 0x3f, 0xda, 0x76, 0x76, 0x7a, 0x63,
  8191. + 0xdb, 0xdc, 0x86, 0xdc, 0xdd, 0x90, 0x5b, 0x64,
  8192. + 0xc3, 0xc3, 0xde, 0x2d, 0x27, 0x23, 0x21, 0x20,
  8193. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8194. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  8195. + 0x26, 0x2d, 0x91, 0x5b, 0x64, 0xc4, 0xc4, 0xc4,
  8196. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8197. + 0xc4, 0xc7, 0x83, 0xce, 0x36, 0x36, 0x36, 0x30,
  8198. + 0xb1, 0xd9, 0x48, 0xa1, 0xb2, 0xb0, 0xb0, 0xb3,
  8199. + 0xa2, 0x48, 0xa7, 0xbd, 0xa9, 0xa2, 0x48, 0x9f,
  8200. + 0xaa, 0x9a, 0x3f, 0xb1, 0x5b, 0x7b, 0xdf, 0x85,
  8201. + 0x7e, 0x90, 0x63, 0x90, 0x85, 0x5b, 0xc3, 0xc4,
  8202. + 0xc4, 0xcb, 0x5d, 0xd5, 0x39, 0x26, 0x23, 0x21,
  8203. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8204. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  8205. + 0x26, 0x2d, 0xe0, 0xdf, 0x64, 0xc4, 0xc4, 0xc4,
  8206. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8207. + 0xc4, 0xc4, 0xc7, 0x88, 0x36, 0x36, 0x36, 0x36,
  8208. + 0x2d, 0x9b, 0x48, 0xb9, 0xaf, 0xa2, 0xa2, 0xb9,
  8209. + 0xa8, 0x9f, 0x48, 0xa7, 0xb7, 0xd9, 0x48, 0x48,
  8210. + 0x9b, 0x45, 0x3f, 0xe1, 0x6d, 0x7b, 0xca, 0xdf,
  8211. + 0x7a, 0x8b, 0x8b, 0x7a, 0x5b, 0x64, 0xc4, 0xc4,
  8212. + 0xc4, 0xc4, 0xc3, 0xe2, 0x37, 0x35, 0x26, 0x23,
  8213. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8214. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  8215. + 0x26, 0x2e, 0xe0, 0x7a, 0x7b, 0xc4, 0xc4, 0xc4,
  8216. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8217. + 0xc4, 0xc4, 0xc7, 0x72, 0x73, 0x36, 0x36, 0x36,
  8218. + 0x24, 0x52, 0x48, 0xa3, 0xaf, 0x9f, 0x48, 0xb6,
  8219. + 0xaf, 0xa2, 0x48, 0x9f, 0xe3, 0xd8, 0x48, 0x48,
  8220. + 0x48, 0x46, 0x42, 0xd6, 0x7a, 0x7b, 0x64, 0x7b,
  8221. + 0x76, 0x5b, 0x5b, 0x76, 0x7b, 0xc3, 0xc4, 0xc4,
  8222. + 0xc4, 0xc4, 0xcb, 0x64, 0xe2, 0x4d, 0x2c, 0x27,
  8223. + 0x23, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8224. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  8225. + 0x25, 0x31, 0xe4, 0x8b, 0x7b, 0xc4, 0xc4, 0xc4,
  8226. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8227. + 0xc4, 0xc4, 0xc4, 0xc7, 0x89, 0xbe, 0x36, 0x36,
  8228. + 0x32, 0x47, 0x48, 0x4f, 0xa0, 0x48, 0x48, 0xe3,
  8229. + 0x92, 0x9f, 0x48, 0x9f, 0x48, 0x48, 0x48, 0x48,
  8230. + 0x48, 0x4b, 0x2f, 0x8f, 0x7a, 0x7b, 0xc3, 0xcb,
  8231. + 0xc3, 0x64, 0x64, 0xc3, 0xc3, 0xcb, 0xc4, 0xc4,
  8232. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc3, 0x5d, 0xe5, 0x2c,
  8233. + 0x26, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8234. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  8235. + 0x25, 0x31, 0xe4, 0x85, 0x7b, 0xc4, 0xc4, 0xc4,
  8236. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8237. + 0xc4, 0xc4, 0xc4, 0xc4, 0x66, 0x57, 0x27, 0x4d,
  8238. + 0x4b, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  8239. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  8240. + 0x99, 0x34, 0xbe, 0xdb, 0x7a, 0x7b, 0xc3, 0xc4,
  8241. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8242. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc3, 0xe4,
  8243. + 0x32, 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  8244. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  8245. + 0x26, 0x2d, 0xe4, 0x85, 0x7b, 0xcb, 0xc4, 0xc4,
  8246. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8247. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc7, 0x5f, 0x92, 0x48,
  8248. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  8249. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x44,
  8250. + 0x35, 0x36, 0xce, 0xdd, 0x7a, 0x7b, 0xcb, 0xc4,
  8251. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8252. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xcb, 0xc3, 0xe1,
  8253. + 0x2b, 0x24, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  8254. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x23,
  8255. + 0x30, 0x2f, 0xd6, 0x8b, 0x7b, 0xcb, 0xc4, 0xc4,
  8256. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8257. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0x66, 0x89, 0x45,
  8258. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  8259. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x9b, 0x4e, 0x25,
  8260. + 0x36, 0x36, 0x61, 0xdb, 0x6d, 0x64, 0xcb, 0xc4,
  8261. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8262. + 0xc4, 0xc4, 0xc4, 0xc4, 0xcb, 0x7b, 0xdf, 0xe5,
  8263. + 0x32, 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  8264. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x28,
  8265. + 0x33, 0xe6, 0x63, 0xdf, 0xc3, 0xc4, 0xc4, 0xc4,
  8266. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8267. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc3, 0x72, 0x81, 0xe7,
  8268. + 0x46, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  8269. + 0x48, 0x48, 0x48, 0x48, 0x3f, 0x2c, 0x36, 0x36,
  8270. + 0x36, 0x36, 0xe8, 0x8f, 0x6d, 0x64, 0xcb, 0xc4,
  8271. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8272. + 0xc4, 0xc4, 0xc4, 0xc3, 0xca, 0x8b, 0xcf, 0x2c,
  8273. + 0x26, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8274. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x24,
  8275. + 0x35, 0x96, 0x75, 0xca, 0xc3, 0xcb, 0xc4, 0xc4,
  8276. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8277. + 0xc4, 0xc4, 0xc4, 0xc4, 0xcb, 0x7b, 0x81, 0xdb,
  8278. + 0x73, 0x3b, 0x44, 0x9b, 0x48, 0x48, 0x48, 0x9b,
  8279. + 0x99, 0x43, 0x94, 0x2c, 0x21, 0x36, 0x36, 0x36,
  8280. + 0x36, 0x36, 0x73, 0xdb, 0x7a, 0x7b, 0xc4, 0xc4,
  8281. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8282. + 0xc4, 0x64, 0x76, 0x7a, 0x91, 0xd5, 0x31, 0x30,
  8283. + 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8284. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x24,
  8285. + 0x39, 0x97, 0x75, 0xdf, 0x7b, 0x64, 0xc3, 0xc3,
  8286. + 0xcb, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  8287. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0x7b, 0x7a, 0xe9,
  8288. + 0xea, 0x36, 0x21, 0x26, 0x2b, 0x39, 0x33, 0x30,
  8289. + 0x23, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  8290. + 0x36, 0x21, 0xea, 0xdd, 0x8b, 0x7b, 0xc4, 0xc4,
  8291. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc3, 0x64, 0x64,
  8292. + 0x76, 0x85, 0xe0, 0xd5, 0x34, 0x2b, 0x27, 0x28,
  8293. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8294. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x28,
  8295. + 0x33, 0xeb, 0x63, 0x7e, 0x7a, 0x6d, 0xdf, 0x5b,
  8296. + 0x76, 0x7b, 0x64, 0x64, 0xc3, 0xcb, 0xc4, 0xc4,
  8297. + 0xc4, 0xc4, 0xc4, 0xc4, 0xcb, 0x76, 0x85, 0xdb,
  8298. + 0x79, 0x22, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  8299. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  8300. + 0x36, 0x21, 0xec, 0xdd, 0x75, 0x76, 0xc3, 0xc4,
  8301. + 0xc4, 0xc4, 0xcb, 0xc3, 0x64, 0x76, 0xdf, 0x8b,
  8302. + 0xd6, 0xd5, 0x2f, 0x35, 0x30, 0x24, 0x22, 0x21,
  8303. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8304. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x23,
  8305. + 0x27, 0x31, 0xed, 0xeb, 0xdd, 0x74, 0x63, 0x90,
  8306. + 0x7e, 0x75, 0x8b, 0x6d, 0xdf, 0x76, 0x64, 0xc3,
  8307. + 0xcb, 0xcb, 0xcb, 0xcb, 0x64, 0x7a, 0x84, 0xee,
  8308. + 0x79, 0xbe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  8309. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  8310. + 0x36, 0x21, 0xea, 0xee, 0x63, 0x6d, 0x7b, 0x64,
  8311. + 0xcb, 0xc3, 0x64, 0x7b, 0xdf, 0x75, 0x63, 0x96,
  8312. + 0x38, 0x39, 0x2a, 0x24, 0x23, 0x21, 0x20, 0x20,
  8313. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8314. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  8315. + 0x28, 0x27, 0x35, 0x2d, 0x41, 0xd5, 0xe7, 0x8f,
  8316. + 0xdb, 0xdd, 0xe9, 0x74, 0x84, 0x90, 0x85, 0x6d,
  8317. + 0x5b, 0x7b, 0x7b, 0xca, 0x6d, 0x90, 0xdb, 0xef,
  8318. + 0xec, 0x22, 0x36, 0x36, 0x28, 0x30, 0x30, 0x30,
  8319. + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x25, 0x36,
  8320. + 0x36, 0x21, 0xd4, 0x80, 0xe9, 0x7e, 0x6d, 0x76,
  8321. + 0xca, 0x76, 0x6d, 0x85, 0x63, 0xdb, 0xd5, 0x34,
  8322. + 0x33, 0x26, 0x23, 0x21, 0x20, 0x20, 0x20, 0x20,
  8323. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8324. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8325. + 0x21, 0x23, 0x24, 0x27, 0x2a, 0x35, 0x2e, 0x2f,
  8326. + 0x41, 0xf0, 0xf1, 0x6c, 0x80, 0xee, 0xdb, 0x74,
  8327. + 0x84, 0x90, 0x75, 0x7e, 0x74, 0x8f, 0xef, 0x79,
  8328. + 0xe8, 0x2b, 0x9d, 0x41, 0x2f, 0x34, 0x2d, 0x2d,
  8329. + 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x34, 0x2f, 0x38,
  8330. + 0x4d, 0x37, 0xf2, 0xf3, 0x8f, 0x74, 0x63, 0x7e,
  8331. + 0x75, 0x7e, 0x63, 0xe9, 0x88, 0xe6, 0x31, 0x2a,
  8332. + 0x24, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8333. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8334. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8335. + 0x20, 0x20, 0x21, 0x22, 0x23, 0x24, 0x26, 0x30,
  8336. + 0x33, 0x39, 0x2e, 0x51, 0x41, 0xd2, 0x6c, 0xf3,
  8337. + 0x80, 0xee, 0xee, 0xee, 0xf4, 0xf3, 0xd7, 0xf5,
  8338. + 0x41, 0x34, 0x35, 0x32, 0x30, 0x27, 0x27, 0x27,
  8339. + 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x30, 0x2a,
  8340. + 0x2b, 0x34, 0xf6, 0xec, 0xf7, 0x8f, 0xdd, 0xe9,
  8341. + 0xe9, 0xdd, 0xee, 0x6c, 0x41, 0x39, 0x27, 0x28,
  8342. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8343. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8344. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8345. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x22,
  8346. + 0x28, 0x24, 0x26, 0x2a, 0x33, 0x2c, 0x2f, 0x41,
  8347. + 0xf8, 0xd7, 0x79, 0x79, 0x79, 0xec, 0xf9, 0x51,
  8348. + 0x39, 0x30, 0x24, 0x23, 0x22, 0x22, 0x22, 0x22,
  8349. + 0x22, 0x22, 0x21, 0x22, 0x22, 0x22, 0x22, 0x23,
  8350. + 0x24, 0x2a, 0x31, 0xfa, 0xea, 0x79, 0xf3, 0x80,
  8351. + 0xf7, 0xdc, 0xfb, 0x2f, 0x35, 0x26, 0x23, 0x21,
  8352. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8353. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8354. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8355. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8356. + 0x20, 0x21, 0x22, 0x23, 0x28, 0x25, 0x30, 0x2b,
  8357. + 0x31, 0x2f, 0xf6, 0xfa, 0xfa, 0x2f, 0x2e, 0x33,
  8358. + 0x26, 0x23, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  8359. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8360. + 0x21, 0x28, 0x27, 0x35, 0x34, 0xfa, 0xfa, 0xfa,
  8361. + 0xfc, 0xf6, 0x2e, 0x33, 0x25, 0x23, 0x21, 0x20,
  8362. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8363. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8364. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8365. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8366. + 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x23, 0x28,
  8367. + 0x26, 0x30, 0x32, 0x2b, 0x33, 0x2a, 0x26, 0x28,
  8368. + 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8369. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8370. + 0x20, 0x21, 0x23, 0x25, 0x30, 0x33, 0x35, 0x35,
  8371. + 0x2b, 0x2a, 0x26, 0x28, 0x22, 0x20, 0x20, 0x20,
  8372. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8373. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8374. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8375. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8376. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  8377. + 0x21, 0x22, 0x23, 0x28, 0x28, 0x23, 0x22, 0x21,
  8378. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8379. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8380. + 0x20, 0x20, 0x20, 0x21, 0x23, 0x28, 0x24, 0x24,
  8381. + 0x28, 0x23, 0x22, 0x21, 0x20, 0x20, 0x20, 0x20,
  8382. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8383. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  8384. +};
  8385. +
  8386. +unsigned char linux_logo16[1];
  8387. +
  8388. +#endif /* INCLUDE_LINUX_LOGO_DATA */
  8389. +
  8390. +#include <linux/linux_logo.h>
  8391. +
  8392. --- linux/include/asm-nios2nommu/local.h
  8393. +++ linux/include/asm-nios2nommu/local.h
  8394. @@ -0,0 +1,28 @@
  8395. +/*
  8396. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8397. + *
  8398. + * All rights reserved.
  8399. + *
  8400. + * This program is free software; you can redistribute it and/or modify
  8401. + * it under the terms of the GNU General Public License as published by
  8402. + * the Free Software Foundation; either version 2 of the License, or
  8403. + * (at your option) any later version.
  8404. + *
  8405. + * This program is distributed in the hope that it will be useful, but
  8406. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8407. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8408. + * NON INFRINGEMENT. See the GNU General Public License for more
  8409. + * details.
  8410. + *
  8411. + * You should have received a copy of the GNU General Public License
  8412. + * along with this program; if not, write to the Free Software
  8413. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8414. + *
  8415. + */
  8416. +
  8417. +#ifndef __NIOS2NOMMU_LOCAL_H
  8418. +#define __NIOS2NOMMU_LOCAL_H
  8419. +
  8420. +#include <asm-generic/local.h>
  8421. +
  8422. +#endif /* __NIOS2NOMMU_LOCAL_H */
  8423. --- linux/include/asm-nios2nommu/mc146818rtc.h
  8424. +++ linux/include/asm-nios2nommu/mc146818rtc.h
  8425. @@ -0,0 +1,29 @@
  8426. +/*
  8427. + * Machine dependent access functions for RTC registers.
  8428. + *
  8429. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8430. + *
  8431. + * All rights reserved.
  8432. + *
  8433. + * This program is free software; you can redistribute it and/or modify
  8434. + * it under the terms of the GNU General Public License as published by
  8435. + * the Free Software Foundation; either version 2 of the License, or
  8436. + * (at your option) any later version.
  8437. + *
  8438. + * This program is distributed in the hope that it will be useful, but
  8439. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8440. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8441. + * NON INFRINGEMENT. See the GNU General Public License for more
  8442. + * details.
  8443. + *
  8444. + * You should have received a copy of the GNU General Public License
  8445. + * along with this program; if not, write to the Free Software
  8446. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8447. + *
  8448. + */
  8449. +#ifndef _NIOS2_MC146818RTC_H
  8450. +#define _NIOS2_MC146818RTC_H
  8451. +
  8452. +/* empty include file to satisfy the include in genrtc.c/ide-geometry.c */
  8453. +
  8454. +#endif /* _NIOS2_MC146818RTC_H */
  8455. --- linux/include/asm-nios2nommu/mman.h
  8456. +++ linux/include/asm-nios2nommu/mman.h
  8457. @@ -0,0 +1,68 @@
  8458. +/*
  8459. + * Copied from the m68k port.
  8460. + *
  8461. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8462. + *
  8463. + * All rights reserved.
  8464. + *
  8465. + * This program is free software; you can redistribute it and/or modify
  8466. + * it under the terms of the GNU General Public License as published by
  8467. + * the Free Software Foundation; either version 2 of the License, or
  8468. + * (at your option) any later version.
  8469. + *
  8470. + * This program is distributed in the hope that it will be useful, but
  8471. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8472. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8473. + * NON INFRINGEMENT. See the GNU General Public License for more
  8474. + * details.
  8475. + *
  8476. + * You should have received a copy of the GNU General Public License
  8477. + * along with this program; if not, write to the Free Software
  8478. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8479. + *
  8480. + */
  8481. +
  8482. +#ifndef __NIOS2_MMAN_H__
  8483. +#define __NIOS2_MMAN_H__
  8484. +
  8485. +#define PROT_READ 0x1 /* page can be read */
  8486. +#define PROT_WRITE 0x2 /* page can be written */
  8487. +#define PROT_EXEC 0x4 /* page can be executed */
  8488. +#define PROT_SEM 0x8 /* page may be used for atomic ops */
  8489. +#define PROT_NONE 0x0 /* page can not be accessed */
  8490. +#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
  8491. +#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
  8492. +
  8493. +#define MAP_SHARED 0x01 /* Share changes */
  8494. +#define MAP_PRIVATE 0x02 /* Changes are private */
  8495. +#define MAP_TYPE 0x0f /* Mask for type of mapping */
  8496. +#define MAP_FIXED 0x10 /* Interpret addr exactly */
  8497. +#define MAP_ANONYMOUS 0x20 /* don't use a file */
  8498. +
  8499. +#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
  8500. +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
  8501. +#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
  8502. +#define MAP_LOCKED 0x2000 /* pages are locked */
  8503. +#define MAP_NORESERVE 0x4000 /* don't check for reservations */
  8504. +#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
  8505. +#define MAP_NONBLOCK 0x10000 /* do not block on IO */
  8506. +
  8507. +#define MS_ASYNC 1 /* sync memory asynchronously */
  8508. +#define MS_INVALIDATE 2 /* invalidate the caches */
  8509. +#define MS_SYNC 4 /* synchronous memory sync */
  8510. +
  8511. +#define MCL_CURRENT 1 /* lock all current mappings */
  8512. +#define MCL_FUTURE 2 /* lock all future mappings */
  8513. +
  8514. +#define MADV_NORMAL 0x0 /* default page-in behavior */
  8515. +#define MADV_RANDOM 0x1 /* page-in minimum required */
  8516. +#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
  8517. +#define MADV_WILLNEED 0x3 /* pre-fault pages */
  8518. +#define MADV_DONTNEED 0x4 /* discard these pages */
  8519. +
  8520. +/* compatibility flags */
  8521. +#define MAP_ANON MAP_ANONYMOUS
  8522. +#define MAP_FILE 0
  8523. +
  8524. +#endif /* __NIOS2_MMAN_H__ */
  8525. +
  8526. --- linux/include/asm-nios2nommu/mmu_context.h
  8527. +++ linux/include/asm-nios2nommu/mmu_context.h
  8528. @@ -0,0 +1,58 @@
  8529. +/*
  8530. + *
  8531. + * Taken from the m68knommu.
  8532. + *
  8533. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8534. + *
  8535. + * All rights reserved.
  8536. + *
  8537. + * This program is free software; you can redistribute it and/or modify
  8538. + * it under the terms of the GNU General Public License as published by
  8539. + * the Free Software Foundation; either version 2 of the License, or
  8540. + * (at your option) any later version.
  8541. + *
  8542. + * This program is distributed in the hope that it will be useful, but
  8543. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8544. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8545. + * NON INFRINGEMENT. See the GNU General Public License for more
  8546. + * details.
  8547. + *
  8548. + * You should have received a copy of the GNU General Public License
  8549. + * along with this program; if not, write to the Free Software
  8550. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8551. + *
  8552. + */
  8553. +
  8554. +#ifndef __NIOS2NOMMU_MMU_CONTEXT_H
  8555. +#define __NIOS2NOMMU_MMU_CONTEXT_H
  8556. +
  8557. +#include <linux/config.h>
  8558. +#include <asm/setup.h>
  8559. +#include <asm/page.h>
  8560. +#include <asm/pgalloc.h>
  8561. +
  8562. +static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
  8563. +{
  8564. +}
  8565. +
  8566. +extern inline int
  8567. +init_new_context(struct task_struct *tsk, struct mm_struct *mm)
  8568. +{
  8569. + // mm->context = virt_to_phys(mm->pgd);
  8570. + return(0);
  8571. +}
  8572. +
  8573. +#define destroy_context(mm) do { } while(0)
  8574. +
  8575. +static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
  8576. +{
  8577. +}
  8578. +
  8579. +#define deactivate_mm(tsk,mm) do { } while (0)
  8580. +
  8581. +extern inline void activate_mm(struct mm_struct *prev_mm,
  8582. + struct mm_struct *next_mm)
  8583. +{
  8584. +}
  8585. +
  8586. +#endif
  8587. --- linux/include/asm-nios2nommu/mmu.h
  8588. +++ linux/include/asm-nios2nommu/mmu.h
  8589. @@ -0,0 +1,36 @@
  8590. +/*
  8591. + *
  8592. + * Taken from the m68knommu.
  8593. + *
  8594. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8595. + *
  8596. + * All rights reserved.
  8597. + *
  8598. + * This program is free software; you can redistribute it and/or modify
  8599. + * it under the terms of the GNU General Public License as published by
  8600. + * the Free Software Foundation; either version 2 of the License, or
  8601. + * (at your option) any later version.
  8602. + *
  8603. + * This program is distributed in the hope that it will be useful, but
  8604. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8605. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8606. + * NON INFRINGEMENT. See the GNU General Public License for more
  8607. + * details.
  8608. + *
  8609. + * You should have received a copy of the GNU General Public License
  8610. + * along with this program; if not, write to the Free Software
  8611. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8612. + *
  8613. + */
  8614. +
  8615. +#ifndef __NIOS2NOMMU_MMU_H
  8616. +#define __NIOS2NOMMU_MMU_H
  8617. +
  8618. +/* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */
  8619. +
  8620. +typedef struct {
  8621. + struct vm_list_struct *vmlist;
  8622. + unsigned long end_brk;
  8623. +} mm_context_t;
  8624. +
  8625. +#endif /* __NIOS2NOMMU_MMU_H */
  8626. --- linux/include/asm-nios2nommu/module.h
  8627. +++ linux/include/asm-nios2nommu/module.h
  8628. @@ -0,0 +1,36 @@
  8629. +#ifndef _NIOS2_MODULE_H
  8630. +#define _NIOS2_MODULE_H
  8631. +
  8632. +/*--------------------------------------------------------------------
  8633. + *
  8634. + * include/asm-nios2nommu/module.h
  8635. + *
  8636. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  8637. + *
  8638. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8639. + *
  8640. + * This program is free software; you can redistribute it and/or modify
  8641. + * it under the terms of the GNU General Public License as published by
  8642. + * the Free Software Foundation; either version 2 of the License, or
  8643. + * (at your option) any later version.
  8644. + *
  8645. + * This program is distributed in the hope that it will be useful,
  8646. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8647. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8648. + * GNU General Public License for more details.
  8649. + *
  8650. + *
  8651. + * Jan/20/2004 dgt NiosII
  8652. + *
  8653. + ---------------------------------------------------------------------*/
  8654. +
  8655. +
  8656. +struct mod_arch_specific
  8657. +{
  8658. +};
  8659. +
  8660. +#define Elf_Shdr Elf32_Shdr
  8661. +#define Elf_Sym Elf32_Sym
  8662. +#define Elf_Ehdr Elf32_Ehdr
  8663. +
  8664. +#endif /* _NIOS_MODULE_H */
  8665. --- linux/include/asm-nios2nommu/msgbuf.h
  8666. +++ linux/include/asm-nios2nommu/msgbuf.h
  8667. @@ -0,0 +1,56 @@
  8668. +/*
  8669. + * Taken from the m68k.
  8670. + *
  8671. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8672. + *
  8673. + * All rights reserved.
  8674. + *
  8675. + * This program is free software; you can redistribute it and/or modify
  8676. + * it under the terms of the GNU General Public License as published by
  8677. + * the Free Software Foundation; either version 2 of the License, or
  8678. + * (at your option) any later version.
  8679. + *
  8680. + * This program is distributed in the hope that it will be useful, but
  8681. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8682. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8683. + * NON INFRINGEMENT. See the GNU General Public License for more
  8684. + * details.
  8685. + *
  8686. + * You should have received a copy of the GNU General Public License
  8687. + * along with this program; if not, write to the Free Software
  8688. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8689. + *
  8690. + */
  8691. +
  8692. +#ifndef _NIOS2_MSGBUF_H
  8693. +#define _NIOS2_MSGBUF_H
  8694. +
  8695. +/*
  8696. + * The msqid64_ds structure for nios2 architecture.
  8697. + * Note extra padding because this structure is passed back and forth
  8698. + * between kernel and user space.
  8699. + *
  8700. + * Pad space is left for:
  8701. + * - 64-bit time_t to solve y2038 problem
  8702. + * - 2 miscellaneous 32-bit values
  8703. + */
  8704. +
  8705. +struct msqid64_ds {
  8706. + struct ipc64_perm msg_perm;
  8707. + __kernel_time_t msg_stime; /* last msgsnd time */
  8708. + unsigned long __unused1;
  8709. + __kernel_time_t msg_rtime; /* last msgrcv time */
  8710. + unsigned long __unused2;
  8711. + __kernel_time_t msg_ctime; /* last change time */
  8712. + unsigned long __unused3;
  8713. + unsigned long msg_cbytes; /* current number of bytes on queue */
  8714. + unsigned long msg_qnum; /* number of messages in queue */
  8715. + unsigned long msg_qbytes; /* max number of bytes on queue */
  8716. + __kernel_pid_t msg_lspid; /* pid of last msgsnd */
  8717. + __kernel_pid_t msg_lrpid; /* last receive pid */
  8718. + unsigned long __unused4;
  8719. + unsigned long __unused5;
  8720. +};
  8721. +
  8722. +#endif /* _NIOS2_MSGBUF_H */
  8723. +
  8724. --- linux/include/asm-nios2nommu/namei.h
  8725. +++ linux/include/asm-nios2nommu/namei.h
  8726. @@ -0,0 +1,36 @@
  8727. +/*
  8728. + * linux/include/asm-nios/namei.h
  8729. + * Moved from m68k version
  8730. + * Included from linux/fs/namei.c
  8731. + *
  8732. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8733. + * All rights reserved.
  8734. + *
  8735. + * This program is free software; you can redistribute it and/or modify
  8736. + * it under the terms of the GNU General Public License as published by
  8737. + * the Free Software Foundation; either version 2 of the License, or
  8738. + * (at your option) any later version.
  8739. + *
  8740. + * This program is distributed in the hope that it will be useful, but
  8741. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8742. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8743. + * NON INFRINGEMENT. See the GNU General Public License for more
  8744. + * details.
  8745. + *
  8746. + * You should have received a copy of the GNU General Public License
  8747. + * along with this program; if not, write to the Free Software
  8748. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8749. + *
  8750. + */
  8751. +
  8752. +#ifndef __NIOS2_NAMEI_H
  8753. +#define __NIOS2_NAMEI_H
  8754. +
  8755. +/* This dummy routine maybe changed to something useful
  8756. + * for /usr/gnemul/ emulation stuff.
  8757. + * Look at asm-sparc/namei.h for details.
  8758. + */
  8759. +
  8760. +#define __emul_prefix() NULL
  8761. +
  8762. +#endif
  8763. --- linux/include/asm-nios2nommu/ndma.h
  8764. +++ linux/include/asm-nios2nommu/ndma.h
  8765. @@ -0,0 +1,64 @@
  8766. +#ifndef __NDMA_H__
  8767. + #define __NDMA_H__
  8768. +
  8769. + #ifndef __ASSEMBLY__
  8770. +
  8771. +// DMA Registers
  8772. +typedef volatile struct
  8773. +{
  8774. + int np_dmastatus; // status register
  8775. + int np_dmareadaddress; // read address
  8776. + int np_dmawriteaddress; // write address
  8777. + int np_dmalength; // length in bytes
  8778. + int np_dmareserved1; // reserved
  8779. + int np_dmareserved2; // reserved
  8780. + int np_dmacontrol; // control register
  8781. + int np_dmareserved3; // control register alternate
  8782. +} np_dma;
  8783. +
  8784. +// DMA Register Bits
  8785. +enum
  8786. +{
  8787. + np_dmacontrol_byte_bit = 0, // Byte transaction
  8788. + np_dmacontrol_hw_bit = 1, // Half-word transaction
  8789. + np_dmacontrol_word_bit = 2, // Word transaction
  8790. + np_dmacontrol_go_bit = 3, // enable execution
  8791. + np_dmacontrol_i_en_bit = 4, // enable interrupt
  8792. + np_dmacontrol_reen_bit = 5, // Enable read end-of-packet
  8793. + np_dmacontrol_ween_bit = 6, // Enable write end-of-packet
  8794. + np_dmacontrol_leen_bit = 7, // Enable length=0 transaction end
  8795. + np_dmacontrol_rcon_bit = 8, // Read from a fixed address
  8796. + np_dmacontrol_wcon_bit = 9, // Write to a fixed address
  8797. + np_dmacontrol_doubleword_bit = 10, // Double-word transaction
  8798. + np_dmacontrol_quadword_bit = 11, // Quad-word transaction
  8799. +
  8800. + np_dmastatus_done_bit = 0, // 1 when done. Status write clears.
  8801. + np_dmastatus_busy_bit = 1, // 1 when busy.
  8802. + np_dmastatus_reop_bit = 2, // read-eop received
  8803. + np_dmastatus_weop_bit = 3, // write-eop received
  8804. + np_dmastatus_len_bit = 4, // requested length transacted
  8805. +
  8806. + np_dmacontrol_byte_mask = (1 << 0), // Byte transaction
  8807. + np_dmacontrol_hw_mask = (1 << 1), // Half-word transaction
  8808. + np_dmacontrol_word_mask = (1 << 2), // Word transaction
  8809. + np_dmacontrol_go_mask = (1 << 3), // enable execution
  8810. + np_dmacontrol_i_en_mask = (1 << 4), // enable interrupt
  8811. + np_dmacontrol_reen_mask = (1 << 5), // Enable read end-of-packet
  8812. + np_dmacontrol_ween_mask = (1 << 6), // Enable write end-of-packet
  8813. + np_dmacontrol_leen_mask = (1 << 7), // Enable length=0 transaction end
  8814. + np_dmacontrol_rcon_mask = (1 << 8), // Read from a fixed address
  8815. + np_dmacontrol_wcon_mask = (1 << 9), // Write to a fixed address
  8816. + np_dmacontrol_doubleword_mask = (1 << 10), // Double-word transaction
  8817. + np_dmacontrol_quadword_mask = (1 << 11), // Quad-word transaction
  8818. +
  8819. + np_dmastatus_done_mask = (1 << 0), // 1 when done. Status write clears.
  8820. + np_dmastatus_busy_mask = (1 << 1), // 1 when busy.
  8821. + np_dmastatus_reop_mask = (1 << 2), // read-eop received
  8822. + np_dmastatus_weop_mask = (1 << 3), // write-eop received
  8823. + np_dmastatus_len_mask = (1 << 4), // requested length transacted
  8824. +};
  8825. +
  8826. + #endif /* __ASSEMBLY__ */
  8827. +
  8828. +#endif
  8829. +/* End of File */
  8830. --- linux/include/asm-nios2nommu/nios.h
  8831. +++ linux/include/asm-nios2nommu/nios.h
  8832. @@ -0,0 +1,7 @@
  8833. +#ifndef __NIOS_H__
  8834. +#define __NIOS_H__
  8835. +
  8836. +#include "nios2_system.h"
  8837. +
  8838. +#endif
  8839. +
  8840. --- linux/include/asm-nios2nommu/page.h
  8841. +++ linux/include/asm-nios2nommu/page.h
  8842. @@ -0,0 +1,135 @@
  8843. +/*
  8844. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8845. + *
  8846. + * All rights reserved.
  8847. + *
  8848. + * This program is free software; you can redistribute it and/or modify
  8849. + * it under the terms of the GNU General Public License as published by
  8850. + * the Free Software Foundation; either version 2 of the License, or
  8851. + * (at your option) any later version.
  8852. + *
  8853. + * This program is distributed in the hope that it will be useful, but
  8854. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8855. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8856. + * NON INFRINGEMENT. See the GNU General Public License for more
  8857. + * details.
  8858. + *
  8859. + * You should have received a copy of the GNU General Public License
  8860. + * along with this program; if not, write to the Free Software
  8861. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8862. + *
  8863. + */
  8864. +
  8865. +#ifndef _NIOS2_PAGE_H
  8866. +#define _NIOS2_PAGE_H
  8867. +
  8868. +/* copied from m68knommu arch */
  8869. +// #include <linux/config.h>
  8870. +
  8871. +/* PAGE_SHIFT determines the page size */
  8872. +
  8873. +#define PAGE_SHIFT (12)
  8874. +#define PAGE_SIZE (1UL << PAGE_SHIFT)
  8875. +#define PAGE_MASK (~(PAGE_SIZE-1))
  8876. +
  8877. +#ifdef __KERNEL__
  8878. +
  8879. +#include <asm/setup.h>
  8880. +
  8881. +#if PAGE_SHIFT < 13
  8882. +#define THREAD_SIZE (8192)
  8883. +#else
  8884. +#define THREAD_SIZE PAGE_SIZE
  8885. +#endif
  8886. +
  8887. +#ifndef __ASSEMBLY__
  8888. +
  8889. +#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
  8890. +#define free_user_page(page, addr) free_page(addr)
  8891. +
  8892. +#define clear_page(page) memset((page), 0, PAGE_SIZE)
  8893. +#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
  8894. +
  8895. +#define clear_user_page(page, vaddr, pg) clear_page(page)
  8896. +#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
  8897. +
  8898. +/*
  8899. + * These are used to make use of C type-checking..
  8900. + */
  8901. +typedef struct { unsigned long pte; } pte_t;
  8902. +typedef struct { unsigned long pmd[16]; } pmd_t;
  8903. +typedef struct { unsigned long pgd; } pgd_t;
  8904. +typedef struct { unsigned long pgprot; } pgprot_t;
  8905. +
  8906. +#define pte_val(x) ((x).pte)
  8907. +#define pmd_val(x) ((&x)->pmd[0])
  8908. +#define pgd_val(x) ((x).pgd)
  8909. +#define pgprot_val(x) ((x).pgprot)
  8910. +
  8911. +#define __pte(x) ((pte_t) { (x) } )
  8912. +#define __pmd(x) ((pmd_t) { (x) } )
  8913. +#define __pgd(x) ((pgd_t) { (x) } )
  8914. +#define __pgprot(x) ((pgprot_t) { (x) } )
  8915. +
  8916. +/* to align the pointer to the (next) page boundary */
  8917. +#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  8918. +
  8919. +/* Pure 2^n version of get_order */
  8920. +extern __inline__ int get_order(unsigned long size)
  8921. +{
  8922. + int order;
  8923. +
  8924. + size = (size-1) >> (PAGE_SHIFT-1);
  8925. + order = -1;
  8926. + do {
  8927. + size >>= 1;
  8928. + order++;
  8929. + } while (size);
  8930. + return order;
  8931. +}
  8932. +
  8933. +extern unsigned long memory_start;
  8934. +extern unsigned long memory_end;
  8935. +
  8936. +#endif /* !__ASSEMBLY__ */
  8937. +#include <asm/nios.h>
  8938. +#define PAGE_OFFSET ((int)(nasys_program_mem))
  8939. +
  8940. +#ifndef __ASSEMBLY__
  8941. +
  8942. +#define __pa(vaddr) virt_to_phys((void *)vaddr)
  8943. +#define __va(paddr) phys_to_virt((unsigned long)paddr)
  8944. +
  8945. +#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
  8946. +
  8947. +#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
  8948. +#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
  8949. +
  8950. +#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
  8951. +#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
  8952. +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
  8953. +
  8954. +#define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn))
  8955. +#define page_to_pfn(page) virt_to_pfn(page_to_virt(page))
  8956. +
  8957. +#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
  8958. + ((void *)(kaddr) < (void *)memory_end))
  8959. +
  8960. +#ifdef CONFIG_NO_KERNEL_MSG
  8961. +#define BUG_PRINT()
  8962. +#else
  8963. +#define BUG_PRINT() printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__)
  8964. +#endif
  8965. +
  8966. +#ifdef na_cpu_oci_core
  8967. +#define BUG_PANIC() asm volatile ("break") /* drop to debugger */
  8968. +#else
  8969. +// #define BUG_PANIC() while(1)
  8970. +#define BUG_PANIC() panic("BUG!")
  8971. +#endif
  8972. +
  8973. +#endif /* __ASSEMBLY__ */
  8974. +
  8975. +#endif /* __KERNEL__ */
  8976. +
  8977. +#endif /* _NIOS2_PAGE_H */
  8978. --- linux/include/asm-nios2nommu/param.h
  8979. +++ linux/include/asm-nios2nommu/param.h
  8980. @@ -0,0 +1,49 @@
  8981. +#ifndef _NIOS_PARAM_H
  8982. +#define _NIOS_PARAM_H
  8983. +
  8984. +/*--------------------------------------------------------------------
  8985. + *
  8986. + * include/asm-nios2nommu/param.h
  8987. + *
  8988. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  8989. + *
  8990. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8991. + *
  8992. + * This program is free software; you can redistribute it and/or modify
  8993. + * it under the terms of the GNU General Public License as published by
  8994. + * the Free Software Foundation; either version 2 of the License, or
  8995. + * (at your option) any later version.
  8996. + *
  8997. + * This program is distributed in the hope that it will be useful,
  8998. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8999. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9000. + * GNU General Public License for more details.
  9001. + *
  9002. + *
  9003. + * Jan/20/2004 dgt NiosII
  9004. + *
  9005. + ---------------------------------------------------------------------*/
  9006. +
  9007. +
  9008. +#ifndef HZ
  9009. +#define HZ 100
  9010. +#endif
  9011. +
  9012. +#ifdef __KERNEL__
  9013. +#define USER_HZ HZ
  9014. +#define CLOCKS_PER_SEC (USER_HZ)
  9015. +#endif
  9016. +
  9017. +#define EXEC_PAGESIZE 4096
  9018. +
  9019. +#ifndef NGROUPS
  9020. +#define NGROUPS 32
  9021. +#endif
  9022. +
  9023. +#ifndef NOGROUP
  9024. +#define NOGROUP (-1)
  9025. +#endif
  9026. +
  9027. +#define MAXHOSTNAMELEN 64 /* max length of hostname */
  9028. +
  9029. +#endif
  9030. --- linux/include/asm-nios2nommu/pci.h
  9031. +++ linux/include/asm-nios2nommu/pci.h
  9032. @@ -0,0 +1,75 @@
  9033. +#ifndef _ASM_NIOS2NOMMU_PCI_H
  9034. +#define _ASM_NIOS2NOMMU_PCI_H
  9035. +
  9036. +/*--------------------------------------------------------------------
  9037. + *
  9038. + * include/asm-nios2nommu/pci.h
  9039. + *
  9040. + * Derived from asm-m68k/pci_m68k.h
  9041. + * - m68k specific PCI declarations, by Wout Klaren.
  9042. + *
  9043. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9044. + *
  9045. + * This program is free software; you can redistribute it and/or modify
  9046. + * it under the terms of the GNU General Public License as published by
  9047. + * the Free Software Foundation; either version 2 of the License, or
  9048. + * (at your option) any later version.
  9049. + *
  9050. + * This program is distributed in the hope that it will be useful,
  9051. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9052. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9053. + * GNU General Public License for more details.
  9054. + *
  9055. + *
  9056. + * Jan/20/2004 dgt NiosII
  9057. + *
  9058. + ---------------------------------------------------------------------*/
  9059. +
  9060. +
  9061. +#include <asm/scatterlist.h>
  9062. +
  9063. +struct pci_ops;
  9064. +
  9065. +/*
  9066. + * Structure with hardware dependent information and functions of the
  9067. + * PCI bus.
  9068. + */
  9069. +
  9070. +struct pci_bus_info
  9071. +{
  9072. + /*
  9073. + * Resources of the PCI bus.
  9074. + */
  9075. +
  9076. + struct resource mem_space;
  9077. + struct resource io_space;
  9078. +
  9079. + /*
  9080. + * System dependent functions.
  9081. + */
  9082. +
  9083. + struct pci_ops *m68k_pci_ops;
  9084. +
  9085. + void (*fixup)(int pci_modify);
  9086. + void (*conf_device)(struct pci_dev *dev);
  9087. +};
  9088. +
  9089. +#define pcibios_assign_all_busses() 0
  9090. +
  9091. +extern inline void pcibios_set_master(struct pci_dev *dev)
  9092. +{
  9093. + /* No special bus mastering setup handling */
  9094. +}
  9095. +
  9096. +extern inline void pcibios_penalize_isa_irq(int irq)
  9097. +{
  9098. + /* We don't do dynamic PCI IRQ allocation */
  9099. +}
  9100. +
  9101. +/* The PCI address space does equal the physical memory
  9102. + * address space. The networking and block device layers use
  9103. + * this boolean for bounce buffer decisions.
  9104. + */
  9105. +#define PCI_DMA_BUS_IS_PHYS (1)
  9106. +
  9107. +#endif /* _ASM_NIOS2NOMMU_PCI_H */
  9108. --- linux/include/asm-nios2nommu/percpu.h
  9109. +++ linux/include/asm-nios2nommu/percpu.h
  9110. @@ -0,0 +1,30 @@
  9111. +#ifndef __ARCH_NIOS2NOMMU_PERCPU__
  9112. +#define __ARCH_NIOS2NOMMU_PERCPU__
  9113. +
  9114. +/*--------------------------------------------------------------------
  9115. + *
  9116. + * include/asm-nios2nommu/percpu.h
  9117. + *
  9118. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  9119. + *
  9120. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9121. + *
  9122. + * This program is free software; you can redistribute it and/or modify
  9123. + * it under the terms of the GNU General Public License as published by
  9124. + * the Free Software Foundation; either version 2 of the License, or
  9125. + * (at your option) any later version.
  9126. + *
  9127. + * This program is distributed in the hope that it will be useful,
  9128. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9129. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9130. + * GNU General Public License for more details.
  9131. + *
  9132. + *
  9133. + * Jan/20/2004 dgt NiosII
  9134. + *
  9135. + ---------------------------------------------------------------------*/
  9136. +
  9137. +
  9138. +#include <asm-generic/percpu.h>
  9139. +
  9140. +#endif /* __ARCH_NIOS2NOMMU_PERCPU__ */
  9141. --- linux/include/asm-nios2nommu/pgalloc.h
  9142. +++ linux/include/asm-nios2nommu/pgalloc.h
  9143. @@ -0,0 +1,32 @@
  9144. +#ifndef _NIOS2NOMMU_PGALLOC_H
  9145. +#define _NIOS2NOMMU_PGALLOC_H
  9146. +
  9147. +/*--------------------------------------------------------------------
  9148. + *
  9149. + * include/asm-nios2nommu/pgalloc.h
  9150. + *
  9151. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  9152. + *
  9153. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9154. + *
  9155. + * This program is free software; you can redistribute it and/or modify
  9156. + * it under the terms of the GNU General Public License as published by
  9157. + * the Free Software Foundation; either version 2 of the License, or
  9158. + * (at your option) any later version.
  9159. + *
  9160. + * This program is distributed in the hope that it will be useful,
  9161. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9162. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9163. + * GNU General Public License for more details.
  9164. + *
  9165. + *
  9166. + * Jan/20/2004 dgt NiosII
  9167. + *
  9168. + ---------------------------------------------------------------------*/
  9169. +
  9170. +
  9171. +#include <asm/setup.h>
  9172. +
  9173. +#define check_pgt_cache() do { } while (0)
  9174. +
  9175. +#endif /* _NIOS2NOMMU_PGALLOC_H */
  9176. --- linux/include/asm-nios2nommu/pgtable.h
  9177. +++ linux/include/asm-nios2nommu/pgtable.h
  9178. @@ -0,0 +1,104 @@
  9179. +#ifndef _NIOS_PGTABLE_H
  9180. +#define _NIOS_PGTABLE_H
  9181. +
  9182. +/*--------------------------------------------------------------------
  9183. + *
  9184. + * include/asm-nios2nommu/pgtable.h
  9185. + *
  9186. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  9187. + *
  9188. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9189. + *
  9190. + * This program is free software; you can redistribute it and/or modify
  9191. + * it under the terms of the GNU General Public License as published by
  9192. + * the Free Software Foundation; either version 2 of the License, or
  9193. + * (at your option) any later version.
  9194. + *
  9195. + * This program is distributed in the hope that it will be useful,
  9196. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9197. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9198. + * GNU General Public License for more details.
  9199. + *
  9200. + *
  9201. + * Jan/20/2004 dgt NiosII
  9202. + *
  9203. + ---------------------------------------------------------------------*/
  9204. +
  9205. +#include <asm-generic/4level-fixup.h>
  9206. +
  9207. +//vic - this bit copied from m68knommu version
  9208. +// #include <linux/config.h>
  9209. +#include <asm/setup.h>
  9210. +#include <asm/io.h>
  9211. +
  9212. +typedef pte_t *pte_addr_t;
  9213. +
  9214. +#define pgd_present(pgd) (1) /* pages are always present on NO_MM */
  9215. +#define pgd_none(pgd) (0)
  9216. +#define pgd_bad(pgd) (0)
  9217. +#define pgd_clear(pgdp)
  9218. +#define kern_addr_valid(addr) (1)
  9219. +#define pmd_offset(a, b) ((void *)0)
  9220. +
  9221. +#define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */
  9222. +#define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */
  9223. +#define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */
  9224. +#define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */
  9225. +#define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */
  9226. +//vic - this bit copied from m68knommu version
  9227. +
  9228. +extern void paging_init(void);
  9229. +#define swapper_pg_dir ((pgd_t *) 0)
  9230. +
  9231. +#define __swp_type(x) (0)
  9232. +#define __swp_offset(x) (0)
  9233. +#define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })
  9234. +#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
  9235. +#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
  9236. +
  9237. +static inline int pte_file(pte_t pte) { return 0; }
  9238. +
  9239. +/*
  9240. + * ZERO_PAGE is a global shared page that is always zero: used
  9241. + * for zero-mapped memory areas etc..
  9242. + */
  9243. +#define ZERO_PAGE(vaddr) (virt_to_page(0))
  9244. +
  9245. +extern unsigned int kobjsize(const void *objp);
  9246. +extern int is_in_rom(unsigned long);
  9247. +
  9248. +/*
  9249. + * No page table caches to initialise
  9250. + */
  9251. +#define pgtable_cache_init() do { } while (0)
  9252. +#define io_remap_page_range(vma, vaddr, paddr, size, prot) \
  9253. + remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot)
  9254. +
  9255. +extern inline void flush_cache_mm(struct mm_struct *mm)
  9256. +{
  9257. +}
  9258. +
  9259. +extern inline void flush_cache_range(struct mm_struct *mm,
  9260. + unsigned long start,
  9261. + unsigned long end)
  9262. +{
  9263. +}
  9264. +
  9265. +/* Push the page at kernel virtual address and clear the icache */
  9266. +extern inline void flush_page_to_ram (unsigned long address)
  9267. +{
  9268. +}
  9269. +
  9270. +/* Push n pages at kernel virtual address and clear the icache */
  9271. +extern inline void flush_pages_to_ram (unsigned long address, int n)
  9272. +{
  9273. +}
  9274. +
  9275. +/*
  9276. + * All 32bit addresses are effectively valid for vmalloc...
  9277. + * Sort of meaningless for non-VM targets.
  9278. + */
  9279. +#define VMALLOC_START 0
  9280. +#define VMALLOC_END 0xffffffff
  9281. +
  9282. +#endif /* _NIOS_PGTABLE_H */
  9283. --- linux/include/asm-nios2nommu/pio_struct.h
  9284. +++ linux/include/asm-nios2nommu/pio_struct.h
  9285. @@ -0,0 +1,14 @@
  9286. +// PIO Peripheral
  9287. +
  9288. +// PIO Registers
  9289. +typedef volatile struct
  9290. + {
  9291. + int np_piodata; // read/write, up to 32 bits
  9292. + int np_piodirection; // write/readable, up to 32 bits, 1->output bit
  9293. + int np_piointerruptmask; // write/readable, up to 32 bits, 1->enable interrupt
  9294. + int np_pioedgecapture; // read, up to 32 bits, cleared by any write
  9295. + } np_pio;
  9296. +
  9297. +// PIO Routines
  9298. +void nr_pio_showhex(int value); // shows low byte on pio named na_seven_seg_pio
  9299. +
  9300. --- linux/include/asm-nios2nommu/poll.h
  9301. +++ linux/include/asm-nios2nommu/poll.h
  9302. @@ -0,0 +1,46 @@
  9303. +#ifndef __NIOS2_POLL_H
  9304. +#define __NIOS2_POLL_H
  9305. +
  9306. +/*--------------------------------------------------------------------
  9307. + *
  9308. + * include/asm-nios2nommu/poll.h
  9309. + *
  9310. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  9311. + *
  9312. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9313. + *
  9314. + * This program is free software; you can redistribute it and/or modify
  9315. + * it under the terms of the GNU General Public License as published by
  9316. + * the Free Software Foundation; either version 2 of the License, or
  9317. + * (at your option) any later version.
  9318. + *
  9319. + * This program is distributed in the hope that it will be useful,
  9320. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9321. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9322. + * GNU General Public License for more details.
  9323. + *
  9324. + *
  9325. + * Jan/20/2004 dgt NiosII
  9326. + *
  9327. + ---------------------------------------------------------------------*/
  9328. +
  9329. +
  9330. +#define POLLIN 1
  9331. +#define POLLPRI 2
  9332. +#define POLLOUT 4
  9333. +#define POLLERR 8
  9334. +#define POLLHUP 16
  9335. +#define POLLNVAL 32
  9336. +#define POLLRDNORM 64
  9337. +#define POLLWRNORM POLLOUT
  9338. +#define POLLRDBAND 128
  9339. +#define POLLWRBAND 256
  9340. +#define POLLMSG 0x0400
  9341. +
  9342. +struct pollfd {
  9343. + int fd;
  9344. + short events;
  9345. + short revents;
  9346. +};
  9347. +
  9348. +#endif
  9349. --- linux/include/asm-nios2nommu/posix_types.h
  9350. +++ linux/include/asm-nios2nommu/posix_types.h
  9351. @@ -0,0 +1,89 @@
  9352. +#ifndef __ARCH_NIOS2_POSIX_TYPES_H
  9353. +#define __ARCH_NIOS2_POSIX_TYPES_H
  9354. +
  9355. +/*--------------------------------------------------------------------
  9356. + *
  9357. + * include/asm-nios2nommu/posix_types.h
  9358. + *
  9359. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  9360. + *
  9361. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9362. + *
  9363. + * This program is free software; you can redistribute it and/or modify
  9364. + * it under the terms of the GNU General Public License as published by
  9365. + * the Free Software Foundation; either version 2 of the License, or
  9366. + * (at your option) any later version.
  9367. + *
  9368. + * This program is distributed in the hope that it will be useful,
  9369. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9370. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9371. + * GNU General Public License for more details.
  9372. + *
  9373. + *
  9374. + * Jan/20/2004 dgt NiosII
  9375. + *
  9376. + ---------------------------------------------------------------------*/
  9377. +
  9378. +
  9379. +/*
  9380. + * This file is generally used by user-level software, so you need to
  9381. + * be a little careful about namespace pollution etc. Also, we cannot
  9382. + * assume GCC is being used.
  9383. + */
  9384. +
  9385. +typedef unsigned long __kernel_ino_t;
  9386. +typedef unsigned short __kernel_mode_t;
  9387. +typedef unsigned short __kernel_nlink_t;
  9388. +typedef long __kernel_off_t;
  9389. +typedef int __kernel_pid_t;
  9390. +typedef unsigned short __kernel_ipc_pid_t;
  9391. +typedef unsigned short __kernel_uid_t;
  9392. +typedef unsigned short __kernel_gid_t;
  9393. +typedef unsigned int __kernel_size_t;
  9394. +typedef int __kernel_ssize_t;
  9395. +typedef int __kernel_ptrdiff_t;
  9396. +typedef long __kernel_time_t;
  9397. +typedef long __kernel_suseconds_t;
  9398. +typedef long __kernel_clock_t;
  9399. +typedef int __kernel_timer_t;
  9400. +typedef int __kernel_clockid_t;
  9401. +typedef int __kernel_daddr_t;
  9402. +typedef char * __kernel_caddr_t;
  9403. +typedef unsigned short __kernel_uid16_t;
  9404. +typedef unsigned short __kernel_gid16_t;
  9405. +typedef unsigned int __kernel_uid32_t;
  9406. +typedef unsigned int __kernel_gid32_t;
  9407. +
  9408. +typedef unsigned short __kernel_old_uid_t;
  9409. +typedef unsigned short __kernel_old_gid_t;
  9410. +typedef unsigned short __kernel_old_dev_t;
  9411. +
  9412. +#ifdef __GNUC__
  9413. +typedef long long __kernel_loff_t;
  9414. +#endif
  9415. +
  9416. +typedef struct {
  9417. +#if defined(__KERNEL__) || defined(__USE_ALL)
  9418. + int val[2];
  9419. +#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
  9420. + int __val[2];
  9421. +#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
  9422. +} __kernel_fsid_t;
  9423. +
  9424. +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
  9425. +
  9426. +#undef __FD_SET
  9427. +#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
  9428. +
  9429. +#undef __FD_CLR
  9430. +#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
  9431. +
  9432. +#undef __FD_ISSET
  9433. +#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
  9434. +
  9435. +#undef __FD_ZERO
  9436. +#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
  9437. +
  9438. +#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
  9439. +
  9440. +#endif
  9441. --- linux/include/asm-nios2nommu/preem_latency.h
  9442. +++ linux/include/asm-nios2nommu/preem_latency.h
  9443. @@ -0,0 +1,39 @@
  9444. +#ifndef _ASM_PREEM_LATENCY_H
  9445. +#define _ASM_PREEM_LATENCY_H
  9446. +
  9447. +/*--------------------------------------------------------------------
  9448. + *
  9449. + * include/asm-nios2nommu/preem_latency.h
  9450. + *
  9451. + * timing support for preempt-stats patch
  9452. + *
  9453. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  9454. + *
  9455. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9456. + *
  9457. + * This program is free software; you can redistribute it and/or modify
  9458. + * it under the terms of the GNU General Public License as published by
  9459. + * the Free Software Foundation; either version 2 of the License, or
  9460. + * (at your option) any later version.
  9461. + *
  9462. + * This program is distributed in the hope that it will be useful,
  9463. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9464. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9465. + * GNU General Public License for more details.
  9466. + *
  9467. + *
  9468. + * Jan/20/2004 dgt NiosII
  9469. + *
  9470. + ---------------------------------------------------------------------*/
  9471. +
  9472. +
  9473. +#include <asm/nios.h>
  9474. +
  9475. +#define readclock(low) \
  9476. +do {\
  9477. + *(volatile unsigned long *)na_Counter_64_bit=1; \
  9478. + low=*(volatile unsigned long *)na_Counter_64_bit; \
  9479. +} while (0)
  9480. +#define readclock_init()
  9481. +
  9482. +#endif /* _ASM_PREEM_LATENCY_H */
  9483. --- linux/include/asm-nios2nommu/processor.h
  9484. +++ linux/include/asm-nios2nommu/processor.h
  9485. @@ -0,0 +1,148 @@
  9486. +/*--------------------------------------------------------------------
  9487. + *
  9488. + * include/asm-nios2nommu/processor.h
  9489. + *
  9490. + * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
  9491. + * Copyright (C) 2001 Ken Hill (khill@microtronix.com)
  9492. + * Vic Phillips (vic@microtronix.com)
  9493. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9494. + *
  9495. + * hacked from:
  9496. + * include/asm-sparc/processor.h
  9497. + *
  9498. + * This program is free software; you can redistribute it and/or modify
  9499. + * it under the terms of the GNU General Public License as published by
  9500. + * the Free Software Foundation; either version 2 of the License, or
  9501. + * (at your option) any later version.
  9502. + *
  9503. + * This program is distributed in the hope that it will be useful,
  9504. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9505. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9506. + * GNU General Public License for more details.
  9507. + *
  9508. + *
  9509. + * Jan/20/2004 dgt NiosII
  9510. + * Nov/02/2003 dgt Fix task_size
  9511. + *
  9512. + ---------------------------------------------------------------------*/
  9513. +
  9514. +#ifndef __ASM_NIOS_PROCESSOR_H
  9515. +#define __ASM_NIOS_PROCESSOR_H
  9516. +
  9517. +#define NIOS2_FLAG_KTHREAD 0x00000001 /* task is a kernel thread */
  9518. +#define NIOS2_FLAG_COPROC 0x00000002 /* Thread used coprocess */
  9519. +#define NIOS2_FLAG_DEBUG 0x00000004 /* task is being debugged */
  9520. +
  9521. +#define NIOS2_OP_NOP 0x1883a
  9522. +#define NIOS2_OP_BREAK 0x3da03a
  9523. +
  9524. +#ifndef __ASSEMBLY__
  9525. +
  9526. +/*
  9527. + * Default implementation of macro that returns current
  9528. + * instruction pointer ("program counter").
  9529. + */
  9530. +#define current_text_addr() ({ __label__ _l; _l: &&_l;})
  9531. +
  9532. +#include <linux/a.out.h>
  9533. +#include <linux/string.h>
  9534. +
  9535. +#include <asm/ptrace.h>
  9536. +#include <asm/signal.h>
  9537. +#include <asm/segment.h>
  9538. +#include <asm/current.h>
  9539. +#include <asm/system.h> /* for get_hi_limit */
  9540. +
  9541. +/*
  9542. + * Bus types
  9543. + */
  9544. +#define EISA_bus 0
  9545. +#define EISA_bus__is_a_macro /* for versions in ksyms.c */
  9546. +#define MCA_bus 0
  9547. +#define MCA_bus__is_a_macro /* for versions in ksyms.c */
  9548. +
  9549. +/*
  9550. + * The nios has no problems with write protection
  9551. + */
  9552. +#define wp_works_ok 1
  9553. +#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
  9554. +
  9555. +/* Whee, this is STACK_TOP and the lowest kernel address too... */
  9556. +#if 0
  9557. +#define KERNBASE 0x00000000 /* First address the kernel will eventually be */
  9558. +#define TASK_SIZE (KERNBASE)
  9559. +#define MAX_USER_ADDR TASK_SIZE
  9560. +#define MMAP_SEARCH_START (TASK_SIZE/3)
  9561. +#endif
  9562. +
  9563. +#define TASK_SIZE ((unsigned int) nasys_program_mem_end) //...this is better...
  9564. +
  9565. +/*
  9566. + * This decides where the kernel will search for a free chunk of vm
  9567. + * space during mmap's. We won't be using it
  9568. + */
  9569. +#define TASK_UNMAPPED_BASE 0
  9570. +
  9571. +/* The Nios processor specific thread struct. */
  9572. +struct thread_struct {
  9573. + struct pt_regs *kregs;
  9574. +
  9575. + /* For signal handling */
  9576. + unsigned long sig_address;
  9577. + unsigned long sig_desc;
  9578. +
  9579. + /* Context switch saved kernel state. */
  9580. + unsigned long ksp;
  9581. + unsigned long kpsr;
  9582. + unsigned long kesr;
  9583. +
  9584. + /* Flags are defined below */
  9585. +
  9586. + unsigned long flags;
  9587. + int current_ds;
  9588. + struct exec core_exec; /* just what it says. */
  9589. +};
  9590. +
  9591. +#define INIT_MMAP { &init_mm, (0), (0), \
  9592. + __pgprot(0x0) , VM_READ | VM_WRITE | VM_EXEC }
  9593. +
  9594. +#define INIT_THREAD { \
  9595. + .kregs = 0, \
  9596. + .sig_address = 0, \
  9597. + .sig_desc = 0, \
  9598. + .ksp = 0, \
  9599. + .kpsr = 0, \
  9600. + .kesr = PS_S, \
  9601. + .flags = NIOS2_FLAG_KTHREAD, \
  9602. + .current_ds = __KERNEL_DS, \
  9603. + .core_exec = INIT_EXEC \
  9604. +}
  9605. +
  9606. +/* Free all resources held by a thread. */
  9607. +extern void release_thread(struct task_struct *);
  9608. +
  9609. +extern unsigned long thread_saved_pc(struct task_struct *t);
  9610. +
  9611. +extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp);
  9612. +
  9613. +/* Prepare to copy thread state - unlazy all lazy status */
  9614. +#define prepare_to_copy(tsk) do { } while (0)
  9615. +
  9616. +extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  9617. +
  9618. +unsigned long get_wchan(struct task_struct *p);
  9619. +
  9620. +#define KSTK_EIP(tsk) ((tsk)->thread.kregs->ea)
  9621. +#define KSTK_ESP(tsk) ((tsk)->thread.kregs->sp)
  9622. +
  9623. +#ifdef __KERNEL__
  9624. +/* Allocation and freeing of basic task resources. */
  9625. +
  9626. +//;dgt2;#define alloc_task_struct() ((struct task_struct *) xx..see..linux..fork..xx __get_free_pages(GFP_KERNEL,1))
  9627. +//;dgt2;#define get_task_struct(tsk) xx..see..linux..sched.h...atomic_inc(&mem_map[MAP_NR(tsk)].count)
  9628. +
  9629. +#endif
  9630. +
  9631. +#define cpu_relax() do { } while (0)
  9632. +#endif /* __ASSEMBLY__ */
  9633. +#endif /* __ASM_NIOS_PROCESSOR_H */
  9634. --- linux/include/asm-nios2nommu/ptrace.h
  9635. +++ linux/include/asm-nios2nommu/ptrace.h
  9636. @@ -0,0 +1,141 @@
  9637. +/*
  9638. + * Taken from the m68k port.
  9639. + *
  9640. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  9641. + *
  9642. + * All rights reserved.
  9643. + *
  9644. + * This program is free software; you can redistribute it and/or modify
  9645. + * it under the terms of the GNU General Public License as published by
  9646. + * the Free Software Foundation; either version 2 of the License, or
  9647. + * (at your option) any later version.
  9648. + *
  9649. + * This program is distributed in the hope that it will be useful, but
  9650. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  9651. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  9652. + * NON INFRINGEMENT. See the GNU General Public License for more
  9653. + * details.
  9654. + *
  9655. + * You should have received a copy of the GNU General Public License
  9656. + * along with this program; if not, write to the Free Software
  9657. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  9658. + *
  9659. + */
  9660. +#ifndef _NIOS2NOMMU_PTRACE_H
  9661. +#define _NIOS2NOMMU_PTRACE_H
  9662. +
  9663. +#ifndef __ASSEMBLY__
  9664. +
  9665. +#define PTR_R0 0
  9666. +#define PTR_R1 1
  9667. +#define PTR_R2 2
  9668. +#define PTR_R3 3
  9669. +#define PTR_R4 4
  9670. +#define PTR_R5 5
  9671. +#define PTR_R6 6
  9672. +#define PTR_R7 7
  9673. +#define PTR_R8 8
  9674. +#define PTR_R9 9
  9675. +#define PTR_R10 10
  9676. +#define PTR_R11 11
  9677. +#define PTR_R12 12
  9678. +#define PTR_R13 13
  9679. +#define PTR_R14 14
  9680. +#define PTR_R15 15
  9681. +#define PTR_R16 16
  9682. +#define PTR_R17 17
  9683. +#define PTR_R18 18
  9684. +#define PTR_R19 19
  9685. +#define PTR_R20 20
  9686. +#define PTR_R21 21
  9687. +#define PTR_R22 22
  9688. +#define PTR_R23 23
  9689. +#define PTR_R24 24
  9690. +#define PTR_R25 25
  9691. +#define PTR_GP 26
  9692. +#define PTR_SP 27
  9693. +#define PTR_FP 28
  9694. +#define PTR_EA 29
  9695. +#define PTR_BA 30
  9696. +#define PTR_RA 31
  9697. +#define PTR_STATUS 32
  9698. +#define PTR_ESTATUS 33
  9699. +#define PTR_BSTATUS 34
  9700. +#define PTR_IENABLE 35
  9701. +#define PTR_IPENDING 36
  9702. +
  9703. +/* this struct defines the way the registers are stored on the
  9704. + stack during a system call.
  9705. +
  9706. + There is a fake_regs in setup.c that has to match pt_regs.*/
  9707. +
  9708. +struct pt_regs {
  9709. + unsigned long r8;
  9710. + unsigned long r9;
  9711. + unsigned long r10;
  9712. + unsigned long r11;
  9713. + unsigned long r12;
  9714. + unsigned long r13;
  9715. + unsigned long r14;
  9716. + unsigned long r15;
  9717. + unsigned long r1;
  9718. + unsigned long r2;
  9719. + unsigned long r3;
  9720. + unsigned long r4;
  9721. + unsigned long r5;
  9722. + unsigned long r6;
  9723. + unsigned long r7;
  9724. + unsigned long orig_r2;
  9725. + unsigned long ra;
  9726. + unsigned long fp;
  9727. + unsigned long sp;
  9728. + unsigned long gp;
  9729. + unsigned long estatus;
  9730. + unsigned long status_extension;
  9731. + unsigned long ea;
  9732. +};
  9733. +
  9734. +
  9735. +/*
  9736. + * This is the extended stack used by signal handlers and the context
  9737. + * switcher: it's pushed after the normal "struct pt_regs".
  9738. + */
  9739. +struct switch_stack {
  9740. + unsigned long r16;
  9741. + unsigned long r17;
  9742. + unsigned long r18;
  9743. + unsigned long r19;
  9744. + unsigned long r20;
  9745. + unsigned long r21;
  9746. + unsigned long r22;
  9747. + unsigned long r23;
  9748. + unsigned long fp;
  9749. + unsigned long gp;
  9750. + unsigned long ra;
  9751. +};
  9752. +
  9753. +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  9754. +#define PTRACE_GETREGS 12
  9755. +#define PTRACE_SETREGS 13
  9756. +#ifdef CONFIG_FPU
  9757. +#define PTRACE_GETFPREGS 14
  9758. +#define PTRACE_SETFPREGS 15
  9759. +#endif
  9760. +
  9761. +#ifdef __KERNEL__
  9762. +
  9763. +#ifndef PS_S
  9764. +#define PS_S (0x00000001)
  9765. +#endif
  9766. +#ifndef PS_T
  9767. +#define PS_T (0x00000002)
  9768. +#endif
  9769. +
  9770. +#define user_mode(regs) (!((regs)->status_extension & PS_S))
  9771. +#define instruction_pointer(regs) ((regs)->ra)
  9772. +#define profile_pc(regs) instruction_pointer(regs)
  9773. +extern void show_regs(struct pt_regs *);
  9774. +
  9775. +#endif /* __KERNEL__ */
  9776. +#endif /* __ASSEMBLY__ */
  9777. +#endif /* _NIOS2NOMMU_PTRACE_H */
  9778. --- linux/include/asm-nios2nommu/resource.h
  9779. +++ linux/include/asm-nios2nommu/resource.h
  9780. @@ -0,0 +1,73 @@
  9781. +#ifndef _NIOS2NOMMU_RESOURCE_H
  9782. +#define _NIOS2NOMMU_RESOURCE_H
  9783. +
  9784. +/*--------------------------------------------------------------------
  9785. + *
  9786. + * Resource limits
  9787. + *
  9788. + * include/asm-nios2nommu/resource.h
  9789. + *
  9790. + * Derived from M68knommu
  9791. + *
  9792. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9793. + *
  9794. + * This program is free software; you can redistribute it and/or modify
  9795. + * it under the terms of the GNU General Public License as published by
  9796. + * the Free Software Foundation; either version 2 of the License, or
  9797. + * (at your option) any later version.
  9798. + *
  9799. + * This program is distributed in the hope that it will be useful,
  9800. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9801. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9802. + * GNU General Public License for more details.
  9803. + *
  9804. + *
  9805. + * Jan/20/2004 dgt NiosII
  9806. + *
  9807. + ---------------------------------------------------------------------*/
  9808. +
  9809. +
  9810. +#define RLIMIT_CPU 0 /* CPU time in ms */
  9811. +#define RLIMIT_FSIZE 1 /* Maximum filesize */
  9812. +#define RLIMIT_DATA 2 /* max data size */
  9813. +#define RLIMIT_STACK 3 /* max stack size */
  9814. +#define RLIMIT_CORE 4 /* max core file size */
  9815. +#define RLIMIT_RSS 5 /* max resident set size */
  9816. +#define RLIMIT_NPROC 6 /* max number of processes */
  9817. +#define RLIMIT_NOFILE 7 /* max number of open files */
  9818. +#define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
  9819. +#define RLIMIT_AS 9 /* address space limit */
  9820. +#define RLIMIT_LOCKS 10 /* maximum file locks held */
  9821. +#define RLIMIT_SIGPENDING 11 /* max number of pending signals */
  9822. +#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
  9823. +
  9824. +#define RLIM_NLIMITS 13
  9825. +
  9826. +/*
  9827. + * SuS says limits have to be unsigned.
  9828. + * Which makes a ton more sense anyway.
  9829. + */
  9830. +#define RLIM_INFINITY (~0UL)
  9831. +
  9832. +#ifdef __KERNEL__
  9833. +
  9834. +#define INIT_RLIMITS \
  9835. +{ \
  9836. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9837. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9838. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9839. + { _STK_LIM, RLIM_INFINITY }, \
  9840. + { 0, RLIM_INFINITY }, \
  9841. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9842. + { 0, 0 }, \
  9843. + { INR_OPEN, INR_OPEN }, \
  9844. + { MLOCK_LIMIT, MLOCK_LIMIT }, \
  9845. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9846. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9847. + { MAX_SIGPENDING, MAX_SIGPENDING }, \
  9848. + { MQ_BYTES_MAX, MQ_BYTES_MAX }, \
  9849. +}
  9850. +
  9851. +#endif /* __KERNEL__ */
  9852. +
  9853. +#endif /* _NIOS2NOMMU_RESOURCE_H */
  9854. --- linux/include/asm-nios2nommu/rmap.h
  9855. +++ linux/include/asm-nios2nommu/rmap.h
  9856. @@ -0,0 +1,2 @@
  9857. +/* Do not need anything here */
  9858. +
  9859. --- linux/include/asm-nios2nommu/scatterlist.h
  9860. +++ linux/include/asm-nios2nommu/scatterlist.h
  9861. @@ -0,0 +1,42 @@
  9862. +#ifndef _NIOS2NOMMU_SCATTERLIST_H
  9863. +#define _NIOS2NOMMU_SCATTERLIST_H
  9864. +
  9865. +/*--------------------------------------------------------------------
  9866. + *
  9867. + * include/asm-nios2nommu/scatterlist.h
  9868. + *
  9869. + * Derived from M68knommu
  9870. + *
  9871. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9872. + *
  9873. + * This program is free software; you can redistribute it and/or modify
  9874. + * it under the terms of the GNU General Public License as published by
  9875. + * the Free Software Foundation; either version 2 of the License, or
  9876. + * (at your option) any later version.
  9877. + *
  9878. + * This program is distributed in the hope that it will be useful,
  9879. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9880. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9881. + * GNU General Public License for more details.
  9882. + *
  9883. + *
  9884. + * Jan/20/2004 dgt NiosII
  9885. + *
  9886. + ---------------------------------------------------------------------*/
  9887. +
  9888. +#include <linux/mm.h>
  9889. +
  9890. +struct scatterlist {
  9891. + struct page *page;
  9892. + unsigned int offset;
  9893. + dma_addr_t dma_address;
  9894. + unsigned int length;
  9895. +};
  9896. +
  9897. +#define sg_address(sg) (page_address((sg)->page) + (sg)->offset
  9898. +#define sg_dma_address(sg) ((sg)->dma_address)
  9899. +#define sg_dma_len(sg) ((sg)->length)
  9900. +
  9901. +#define ISA_DMA_THRESHOLD (0xffffffff)
  9902. +
  9903. +#endif /* !(_NIOS2NOMMU_SCATTERLIST_H) */
  9904. --- linux/include/asm-nios2nommu/sections.h
  9905. +++ linux/include/asm-nios2nommu/sections.h
  9906. @@ -0,0 +1,30 @@
  9907. +#ifndef _NIOS2NOMMU_SECTIONS_H
  9908. +#define _NIOS2NOMMU_SECTIONS_H
  9909. +
  9910. +/*--------------------------------------------------------------------
  9911. + *
  9912. + * include/asm-nios2nommu/sections.h
  9913. + *
  9914. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  9915. + *
  9916. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9917. + *
  9918. + * This program is free software; you can redistribute it and/or modify
  9919. + * it under the terms of the GNU General Public License as published by
  9920. + * the Free Software Foundation; either version 2 of the License, or
  9921. + * (at your option) any later version.
  9922. + *
  9923. + * This program is distributed in the hope that it will be useful,
  9924. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9925. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9926. + * GNU General Public License for more details.
  9927. + *
  9928. + *
  9929. + * Jan/20/2004 dgt NiosII
  9930. + *
  9931. + ---------------------------------------------------------------------*/
  9932. +
  9933. +
  9934. +#include <asm-generic/sections.h>
  9935. +
  9936. +#endif /* _NIOS2NOMMU_SECTIONS_H */
  9937. --- linux/include/asm-nios2nommu/segment.h
  9938. +++ linux/include/asm-nios2nommu/segment.h
  9939. @@ -0,0 +1,75 @@
  9940. +#ifndef _NIOS2NOMMU_SEGMENT_H
  9941. +#define _NIOS2NOMMU_SEGMENT_H
  9942. +
  9943. +/*--------------------------------------------------------------------
  9944. + *
  9945. + * include/asm-nios2nommu/segment.h
  9946. + *
  9947. + * Derived from M68knommu
  9948. + *
  9949. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9950. + *
  9951. + * This program is free software; you can redistribute it and/or modify
  9952. + * it under the terms of the GNU General Public License as published by
  9953. + * the Free Software Foundation; either version 2 of the License, or
  9954. + * (at your option) any later version.
  9955. + *
  9956. + * This program is distributed in the hope that it will be useful,
  9957. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9958. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9959. + * GNU General Public License for more details.
  9960. + *
  9961. + *
  9962. + * Jan/20/2004 dgt NiosII
  9963. + *
  9964. + ---------------------------------------------------------------------*/
  9965. +
  9966. +
  9967. +/* define constants */
  9968. +/* Address spaces (FC0-FC2) */
  9969. +#define USER_DATA (1)
  9970. +#ifndef __USER_DS
  9971. +#define __USER_DS (USER_DATA)
  9972. +#endif
  9973. +#define USER_PROGRAM (2)
  9974. +#define SUPER_DATA (5)
  9975. +#ifndef __KERNEL_DS
  9976. +#define __KERNEL_DS (SUPER_DATA)
  9977. +#endif
  9978. +#define SUPER_PROGRAM (6)
  9979. +#define CPU_SPACE (7)
  9980. +
  9981. +#ifndef __ASSEMBLY__
  9982. +
  9983. +typedef struct {
  9984. + unsigned long seg;
  9985. +} mm_segment_t;
  9986. +
  9987. +#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
  9988. +#define USER_DS MAKE_MM_SEG(__USER_DS)
  9989. +#define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS)
  9990. +
  9991. +/*
  9992. + * Get/set the SFC/DFC registers for MOVES instructions
  9993. + */
  9994. +
  9995. +static inline mm_segment_t get_fs(void)
  9996. +{
  9997. + return USER_DS;
  9998. +}
  9999. +
  10000. +static inline mm_segment_t get_ds(void)
  10001. +{
  10002. + /* return the supervisor data space code */
  10003. + return KERNEL_DS;
  10004. +}
  10005. +
  10006. +static inline void set_fs(mm_segment_t val)
  10007. +{
  10008. +}
  10009. +
  10010. +#define segment_eq(a,b) ((a).seg == (b).seg)
  10011. +
  10012. +#endif /* __ASSEMBLY__ */
  10013. +
  10014. +#endif /* _NIOS2NOMMU_SEGMENT_H */
  10015. --- linux/include/asm-nios2nommu/semaphore.h
  10016. +++ linux/include/asm-nios2nommu/semaphore.h
  10017. @@ -0,0 +1,155 @@
  10018. +#ifndef _NIOS2NOMMU_SEMAPHORE_H
  10019. +#define _NIOS2NOMMU_SEMAPHORE_H
  10020. +
  10021. +/*--------------------------------------------------------------------
  10022. + *
  10023. + * include/asm-nios2nommu/semaphore.h
  10024. + *
  10025. + * Interrupt-safe semaphores..
  10026. + *
  10027. + * Derived from M68knommu
  10028. + *
  10029. + * (C) Copyright 1996 Linus Torvalds
  10030. + * m68k version by Andreas Schwab
  10031. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10032. + *
  10033. + * This program is free software; you can redistribute it and/or modify
  10034. + * it under the terms of the GNU General Public License as published by
  10035. + * the Free Software Foundation; either version 2 of the License, or
  10036. + * (at your option) any later version.
  10037. + *
  10038. + * This program is distributed in the hope that it will be useful,
  10039. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10040. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10041. + * GNU General Public License for more details.
  10042. + *
  10043. + * Jan/20/2004 dgt NiosII
  10044. + *
  10045. + ---------------------------------------------------------------------*/
  10046. +
  10047. +#define RW_LOCK_BIAS 0x01000000
  10048. +
  10049. +#ifndef __ASSEMBLY__
  10050. +
  10051. +#include <linux/linkage.h>
  10052. +#include <linux/wait.h>
  10053. +#include <linux/spinlock.h>
  10054. +#include <linux/rwsem.h>
  10055. +
  10056. +#include <asm/system.h>
  10057. +#include <asm/atomic.h>
  10058. +
  10059. +struct semaphore {
  10060. + atomic_t count;
  10061. + atomic_t waking;
  10062. + wait_queue_head_t wait;
  10063. +};
  10064. +
  10065. +#define __SEMAPHORE_INITIALIZER(name, n) \
  10066. +{ \
  10067. + .count = ATOMIC_INIT(n), \
  10068. + .waking = ATOMIC_INIT(0), \
  10069. + .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \
  10070. +}
  10071. +
  10072. +#define __MUTEX_INITIALIZER(name) \
  10073. + __SEMAPHORE_INITIALIZER(name,1)
  10074. +
  10075. +#define __DECLARE_SEMAPHORE_GENERIC(name,count) \
  10076. + struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
  10077. +
  10078. +#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
  10079. +#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
  10080. +
  10081. +extern inline void sema_init (struct semaphore *sem, int val)
  10082. +{
  10083. + *sem = (struct semaphore)__SEMAPHORE_INITIALIZER(*sem, val);
  10084. +}
  10085. +
  10086. +static inline void init_MUTEX (struct semaphore *sem)
  10087. +{
  10088. + sema_init(sem, 1);
  10089. +}
  10090. +
  10091. +static inline void init_MUTEX_LOCKED (struct semaphore *sem)
  10092. +{
  10093. + sema_init(sem, 0);
  10094. +}
  10095. +
  10096. +asmlinkage void __down(struct semaphore * sem);
  10097. +asmlinkage int __down_interruptible(struct semaphore * sem);
  10098. +asmlinkage int __down_trylock(struct semaphore * sem);
  10099. +asmlinkage void __up(struct semaphore * sem);
  10100. +
  10101. +asmlinkage void __down_failed(void /* special register calling convention */);
  10102. +asmlinkage int __down_failed_interruptible(void /* params in registers */);
  10103. +asmlinkage int __down_failed_trylock(void /* params in registers */);
  10104. +asmlinkage void __up_wakeup(void /* special register calling convention */);
  10105. +
  10106. +extern spinlock_t semaphore_wake_lock;
  10107. +
  10108. +/*
  10109. + * This is ugly, but we want the default case to fall through.
  10110. + * "down_failed" is a special asm handler that calls the C
  10111. + * routine that actually waits.
  10112. + */
  10113. +extern inline void down(struct semaphore * sem)
  10114. +{
  10115. + might_sleep();
  10116. +
  10117. + #if 0
  10118. + ...Nios2 has no atomic "decrement memory"....
  10119. + #else
  10120. + if (atomic_dec_return(&sem->count) < 0)
  10121. + __down(sem);
  10122. + #endif
  10123. +}
  10124. +
  10125. +extern inline int down_interruptible(struct semaphore * sem)
  10126. +{
  10127. + int ret = 0;
  10128. +
  10129. +
  10130. + might_sleep();
  10131. +
  10132. + #if 0
  10133. + ...Nios2 has no atomic "decrement memory"....
  10134. + #else
  10135. + if(atomic_dec_return(&sem->count) < 0)
  10136. + ret = __down_interruptible(sem);
  10137. + return ret;
  10138. + #endif
  10139. +}
  10140. +
  10141. +extern inline int down_trylock(struct semaphore * sem)
  10142. +{
  10143. + #if 0
  10144. + ...Nios2 has no atomic "decrement memory"....
  10145. + #else
  10146. + int ret = 0;
  10147. +
  10148. + if (atomic_dec_return (&sem->count) < 0)
  10149. + ret = __down_trylock(sem);
  10150. + return ret;
  10151. + #endif
  10152. +}
  10153. +
  10154. +/*
  10155. + * Note! This is subtle. We jump to wake people up only if
  10156. + * the semaphore was negative (== somebody was waiting on it).
  10157. + * The default case (no contention) will result in NO
  10158. + * jumps for both down() and up().
  10159. + */
  10160. +extern inline void up(struct semaphore * sem)
  10161. +{
  10162. + #if 0
  10163. + ...Nios2 has no atomic "increment memory"....
  10164. + #else
  10165. + if (atomic_inc_return(&sem->count) <= 0)
  10166. + __up(sem);
  10167. + #endif
  10168. +}
  10169. +
  10170. +#endif /* __ASSEMBLY__ */
  10171. +
  10172. +#endif
  10173. --- linux/include/asm-nios2nommu/semaphore-helper.h
  10174. +++ linux/include/asm-nios2nommu/semaphore-helper.h
  10175. @@ -0,0 +1,101 @@
  10176. +#ifndef _NIOS2NOMMU_SEMAPHORE_HELPER_H
  10177. +#define _NIOS2NOMMU_SEMAPHORE_HELPER_H
  10178. +
  10179. +/*--------------------------------------------------------------------
  10180. + *
  10181. + * include/asm-nios2nommu/semaphore.h
  10182. + *
  10183. + * SMP- and interrupt-safe semaphores helper functions.
  10184. + *
  10185. + * Derived from M68knommu
  10186. + *
  10187. + * (C) Copyright 1996 Linus Torvalds
  10188. + * m68k version by Andreas Schwab
  10189. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10190. + *
  10191. + * This program is free software; you can redistribute it and/or modify
  10192. + * it under the terms of the GNU General Public License as published by
  10193. + * the Free Software Foundation; either version 2 of the License, or
  10194. + * (at your option) any later version.
  10195. + *
  10196. + * This program is distributed in the hope that it will be useful,
  10197. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10198. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10199. + * GNU General Public License for more details.
  10200. + *
  10201. + * Jan/20/2004 dgt NiosII
  10202. + *
  10203. + ---------------------------------------------------------------------*/
  10204. +
  10205. +// #include <linux/config.h>
  10206. +
  10207. +/*
  10208. + * These two _must_ execute atomically wrt each other.
  10209. + */
  10210. +static inline void wake_one_more(struct semaphore * sem)
  10211. +{
  10212. + atomic_inc(&sem->waking);
  10213. +}
  10214. +
  10215. +static inline int waking_non_zero(struct semaphore *sem)
  10216. +{
  10217. + int ret;
  10218. + unsigned long flags;
  10219. +
  10220. + spin_lock_irqsave(&semaphore_wake_lock, flags);
  10221. + ret = 0;
  10222. + if (atomic_read(&sem->waking) > 0) {
  10223. + atomic_dec(&sem->waking);
  10224. + ret = 1;
  10225. + }
  10226. + spin_unlock_irqrestore(&semaphore_wake_lock, flags);
  10227. + return ret;
  10228. +}
  10229. +
  10230. +/*
  10231. + * waking_non_zero_interruptible:
  10232. + * 1 got the lock
  10233. + * 0 go to sleep
  10234. + * -EINTR interrupted
  10235. + */
  10236. +static inline int waking_non_zero_interruptible(struct semaphore *sem,
  10237. + struct task_struct *tsk)
  10238. +{
  10239. + int ret;
  10240. + unsigned long flags;
  10241. +
  10242. + spin_lock_irqsave(&semaphore_wake_lock, flags);
  10243. + ret = 0;
  10244. + if (atomic_read(&sem->waking) > 0) {
  10245. + atomic_dec(&sem->waking);
  10246. + ret = 1;
  10247. + } else if (signal_pending(tsk)) {
  10248. + atomic_inc(&sem->count);
  10249. + ret = -EINTR;
  10250. + }
  10251. + spin_unlock_irqrestore(&semaphore_wake_lock, flags);
  10252. + return ret;
  10253. +}
  10254. +
  10255. +/*
  10256. + * waking_non_zero_trylock:
  10257. + * 1 failed to lock
  10258. + * 0 got the lock
  10259. + */
  10260. +static inline int waking_non_zero_trylock(struct semaphore *sem)
  10261. +{
  10262. + int ret;
  10263. + unsigned long flags;
  10264. +
  10265. + spin_lock_irqsave(&semaphore_wake_lock, flags);
  10266. + ret = 1;
  10267. + if (atomic_read(&sem->waking) > 0) {
  10268. + atomic_dec(&sem->waking);
  10269. + ret = 0;
  10270. + } else
  10271. + atomic_inc(&sem->count);
  10272. + spin_unlock_irqrestore(&semaphore_wake_lock, flags);
  10273. + return ret;
  10274. +}
  10275. +
  10276. +#endif
  10277. --- linux/include/asm-nios2nommu/sembuf.h
  10278. +++ linux/include/asm-nios2nommu/sembuf.h
  10279. @@ -0,0 +1,48 @@
  10280. +#ifndef _NIOS_SEMBUF_H
  10281. +#define _NIOS_SEMBUF_H
  10282. +
  10283. +/*--------------------------------------------------------------------
  10284. + *
  10285. + * include/asm-nios2nommu/sembuf.h
  10286. + *
  10287. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10288. + *
  10289. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10290. + *
  10291. + * This program is free software; you can redistribute it and/or modify
  10292. + * it under the terms of the GNU General Public License as published by
  10293. + * the Free Software Foundation; either version 2 of the License, or
  10294. + * (at your option) any later version.
  10295. + *
  10296. + * This program is distributed in the hope that it will be useful,
  10297. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10298. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10299. + * GNU General Public License for more details.
  10300. + *
  10301. + *
  10302. + * Jan/20/2004 dgt NiosII
  10303. + *
  10304. + ---------------------------------------------------------------------*/
  10305. +
  10306. +
  10307. +/*
  10308. + * Note extra padding because this structure is passed back and forth
  10309. + * between kernel and user space.
  10310. + *
  10311. + * Pad space is left for:
  10312. + * - 64-bit time_t to solve y2038 problem
  10313. + * - 2 miscellaneous 32-bit values
  10314. + */
  10315. +
  10316. +struct semid64_ds {
  10317. + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
  10318. + __kernel_time_t sem_otime; /* last semop time */
  10319. + unsigned long __unused1;
  10320. + __kernel_time_t sem_ctime; /* last change time */
  10321. + unsigned long __unused2;
  10322. + unsigned long sem_nsems; /* no. of semaphores in array */
  10323. + unsigned long __unused3;
  10324. + unsigned long __unused4;
  10325. +};
  10326. +
  10327. +#endif /* _NIOS_SEMBUF_H */
  10328. --- linux/include/asm-nios2nommu/setup.h
  10329. +++ linux/include/asm-nios2nommu/setup.h
  10330. @@ -0,0 +1,31 @@
  10331. +/* Copied from i386 port.
  10332. + * Just a place holder. We don't want to have to test x86 before
  10333. + * we include stuff
  10334. + *
  10335. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  10336. + *
  10337. + * All rights reserved.
  10338. + *
  10339. + * This program is free software; you can redistribute it and/or modify
  10340. + * it under the terms of the GNU General Public License as published by
  10341. + * the Free Software Foundation; either version 2 of the License, or
  10342. + * (at your option) any later version.
  10343. + *
  10344. + * This program is distributed in the hope that it will be useful, but
  10345. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  10346. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  10347. + * NON INFRINGEMENT. See the GNU General Public License for more
  10348. + * details.
  10349. + *
  10350. + * You should have received a copy of the GNU General Public License
  10351. + * along with this program; if not, write to the Free Software
  10352. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  10353. + *
  10354. + */
  10355. +
  10356. +#ifndef _NIOS2_SETUP_H
  10357. +#define _NIOS2_SETUP_H
  10358. +
  10359. +#define COMMAND_LINE_SIZE 512
  10360. +
  10361. +#endif /* _NIOS2_SETUP_H */
  10362. --- linux/include/asm-nios2nommu/shmbuf.h
  10363. +++ linux/include/asm-nios2nommu/shmbuf.h
  10364. @@ -0,0 +1,64 @@
  10365. +#ifndef _NIOS_SHMBUF_H
  10366. +#define _NIOS_SHMBUF_H
  10367. +
  10368. +/*--------------------------------------------------------------------
  10369. + *
  10370. + * include/asm-nios2nommu/shmbuf.h
  10371. + *
  10372. + * Derived from m68knommu
  10373. + *
  10374. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10375. + *
  10376. + * This program is free software; you can redistribute it and/or modify
  10377. + * it under the terms of the GNU General Public License as published by
  10378. + * the Free Software Foundation; either version 2 of the License, or
  10379. + * (at your option) any later version.
  10380. + *
  10381. + * This program is distributed in the hope that it will be useful,
  10382. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10383. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10384. + * GNU General Public License for more details.
  10385. + *
  10386. + *
  10387. + * Jan/20/2004 dgt NiosII
  10388. + *
  10389. + ---------------------------------------------------------------------*/
  10390. +
  10391. +
  10392. +/* Note extra padding because this structure is passed back and forth
  10393. + * between kernel and user space.
  10394. + *
  10395. + * Pad space is left for:
  10396. + * - 64-bit time_t to solve y2038 problem
  10397. + * - 2 miscellaneous 32-bit values
  10398. + */
  10399. +
  10400. +struct shmid64_ds {
  10401. + struct ipc64_perm shm_perm; /* operation perms */
  10402. + size_t shm_segsz; /* size of segment (bytes) */
  10403. + __kernel_time_t shm_atime; /* last attach time */
  10404. + unsigned long __unused1;
  10405. + __kernel_time_t shm_dtime; /* last detach time */
  10406. + unsigned long __unused2;
  10407. + __kernel_time_t shm_ctime; /* last change time */
  10408. + unsigned long __unused3;
  10409. + __kernel_pid_t shm_cpid; /* pid of creator */
  10410. + __kernel_pid_t shm_lpid; /* pid of last operator */
  10411. + unsigned long shm_nattch; /* no. of current attaches */
  10412. + unsigned long __unused4;
  10413. + unsigned long __unused5;
  10414. +};
  10415. +
  10416. +struct shminfo64 {
  10417. + unsigned long shmmax;
  10418. + unsigned long shmmin;
  10419. + unsigned long shmmni;
  10420. + unsigned long shmseg;
  10421. + unsigned long shmall;
  10422. + unsigned long __unused1;
  10423. + unsigned long __unused2;
  10424. + unsigned long __unused3;
  10425. + unsigned long __unused4;
  10426. +};
  10427. +
  10428. +#endif /* _NIOS_SHMBUF_H */
  10429. --- linux/include/asm-nios2nommu/shmparam.h
  10430. +++ linux/include/asm-nios2nommu/shmparam.h
  10431. @@ -0,0 +1,30 @@
  10432. +#ifndef __NIOS2NOMMU_SHMPARAM_H__
  10433. +#define __NIOS2NOMMU_SHMPARAM_H__
  10434. +
  10435. +/*--------------------------------------------------------------------
  10436. + *
  10437. + * include/asm-nios2nommu/shmparam.h
  10438. + *
  10439. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10440. + *
  10441. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10442. + *
  10443. + * This program is free software; you can redistribute it and/or modify
  10444. + * it under the terms of the GNU General Public License as published by
  10445. + * the Free Software Foundation; either version 2 of the License, or
  10446. + * (at your option) any later version.
  10447. + *
  10448. + * This program is distributed in the hope that it will be useful,
  10449. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10450. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10451. + * GNU General Public License for more details.
  10452. + *
  10453. + *
  10454. + * Jan/20/2004 dgt NiosII
  10455. + *
  10456. + ---------------------------------------------------------------------*/
  10457. +
  10458. +
  10459. +#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
  10460. +
  10461. +#endif /* __NIOS2NOMMU_SHMPARAM_H__ */
  10462. --- linux/include/asm-nios2nommu/sigcontext.h
  10463. +++ linux/include/asm-nios2nommu/sigcontext.h
  10464. @@ -0,0 +1,35 @@
  10465. +/*
  10466. + * Taken from the m68knommu.
  10467. + *
  10468. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  10469. + *
  10470. + * All rights reserved.
  10471. + *
  10472. + * This program is free software; you can redistribute it and/or modify
  10473. + * it under the terms of the GNU General Public License as published by
  10474. + * the Free Software Foundation; either version 2 of the License, or
  10475. + * (at your option) any later version.
  10476. + *
  10477. + * This program is distributed in the hope that it will be useful, but
  10478. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  10479. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  10480. + * NON INFRINGEMENT. See the GNU General Public License for more
  10481. + * details.
  10482. + *
  10483. + * You should have received a copy of the GNU General Public License
  10484. + * along with this program; if not, write to the Free Software
  10485. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  10486. + *
  10487. + */
  10488. +
  10489. +#ifndef _ASM_NIOS2NOMMU_SIGCONTEXT_H
  10490. +#define _ASM_NIOS2NOMMU_SIGCONTEXT_H
  10491. +
  10492. +#include <asm/ptrace.h>
  10493. +
  10494. +struct sigcontext {
  10495. + struct pt_regs regs;
  10496. + unsigned long sc_mask; /* old sigmask */
  10497. +};
  10498. +
  10499. +#endif
  10500. --- linux/include/asm-nios2nommu/siginfo.h
  10501. +++ linux/include/asm-nios2nommu/siginfo.h
  10502. @@ -0,0 +1,28 @@
  10503. +/*
  10504. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  10505. + *
  10506. + * All rights reserved.
  10507. + *
  10508. + * This program is free software; you can redistribute it and/or modify
  10509. + * it under the terms of the GNU General Public License as published by
  10510. + * the Free Software Foundation; either version 2 of the License, or
  10511. + * (at your option) any later version.
  10512. + *
  10513. + * This program is distributed in the hope that it will be useful, but
  10514. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  10515. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  10516. + * NON INFRINGEMENT. See the GNU General Public License for more
  10517. + * details.
  10518. + *
  10519. + * You should have received a copy of the GNU General Public License
  10520. + * along with this program; if not, write to the Free Software
  10521. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  10522. + *
  10523. + */
  10524. +
  10525. +#ifndef _NIOS2NOMMU_SIGINFO_H
  10526. +#define _NIOS2NOMMU_SIGINFO_H
  10527. +
  10528. +#include <asm-generic/siginfo.h>
  10529. +
  10530. +#endif
  10531. --- linux/include/asm-nios2nommu/signal.h
  10532. +++ linux/include/asm-nios2nommu/signal.h
  10533. @@ -0,0 +1,207 @@
  10534. +/*
  10535. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  10536. + *
  10537. + * All rights reserved.
  10538. + *
  10539. + * This program is free software; you can redistribute it and/or modify
  10540. + * it under the terms of the GNU General Public License as published by
  10541. + * the Free Software Foundation; either version 2 of the License, or
  10542. + * (at your option) any later version.
  10543. + *
  10544. + * This program is distributed in the hope that it will be useful, but
  10545. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  10546. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  10547. + * NON INFRINGEMENT. See the GNU General Public License for more
  10548. + * details.
  10549. + *
  10550. + * You should have received a copy of the GNU General Public License
  10551. + * along with this program; if not, write to the Free Software
  10552. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  10553. + *
  10554. + */
  10555. +
  10556. +#ifndef _NIOS2_SIGNAL_H
  10557. +#define _NIOS2_SIGNAL_H
  10558. +
  10559. +#include <linux/types.h>
  10560. +
  10561. +/* Avoid too many header ordering problems. */
  10562. +struct siginfo;
  10563. +
  10564. +#ifdef __KERNEL__
  10565. +/* Most things should be clean enough to redefine this at will, if care
  10566. + is taken to make libc match. */
  10567. +
  10568. +#define _NSIG 64
  10569. +#define _NSIG_BPW 32
  10570. +#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
  10571. +
  10572. +typedef unsigned long old_sigset_t; /* at least 32 bits */
  10573. +
  10574. +typedef struct {
  10575. + unsigned long sig[_NSIG_WORDS];
  10576. +} sigset_t;
  10577. +
  10578. +#else
  10579. +/* Here we must cater to libcs that poke about in kernel headers. */
  10580. +
  10581. +#define NSIG 32
  10582. +typedef unsigned long sigset_t;
  10583. +
  10584. +#endif /* __KERNEL__ */
  10585. +
  10586. +#define SIGHUP 1
  10587. +#define SIGINT 2
  10588. +#define SIGQUIT 3
  10589. +#define SIGILL 4
  10590. +#define SIGTRAP 5
  10591. +#define SIGABRT 6
  10592. +#define SIGIOT 6
  10593. +#define SIGBUS 7
  10594. +#define SIGFPE 8
  10595. +#define SIGKILL 9
  10596. +#define SIGUSR1 10
  10597. +#define SIGSEGV 11
  10598. +#define SIGUSR2 12
  10599. +#define SIGPIPE 13
  10600. +#define SIGALRM 14
  10601. +#define SIGTERM 15
  10602. +#define SIGSTKFLT 16
  10603. +#define SIGCHLD 17
  10604. +#define SIGCONT 18
  10605. +#define SIGSTOP 19
  10606. +#define SIGTSTP 20
  10607. +#define SIGTTIN 21
  10608. +#define SIGTTOU 22
  10609. +#define SIGURG 23
  10610. +#define SIGXCPU 24
  10611. +#define SIGXFSZ 25
  10612. +#define SIGVTALRM 26
  10613. +#define SIGPROF 27
  10614. +#define SIGWINCH 28
  10615. +#define SIGIO 29
  10616. +#define SIGPOLL SIGIO
  10617. +/*
  10618. +#define SIGLOST 29
  10619. +*/
  10620. +#define SIGPWR 30
  10621. +#define SIGSYS 31
  10622. +#define SIGUNUSED 31
  10623. +
  10624. +/* These should not be considered constants from userland. */
  10625. +#define SIGRTMIN 32
  10626. +#define SIGRTMAX _NSIG-1
  10627. +
  10628. +/*
  10629. + * SA_FLAGS values:
  10630. + *
  10631. + * SA_ONSTACK indicates that a registered stack_t will be used.
  10632. + * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
  10633. + * SA_RESTART flag to get restarting signals (which were the default long ago)
  10634. + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
  10635. + * SA_RESETHAND clears the handler when the signal is delivered.
  10636. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
  10637. + * SA_NODEFER prevents the current signal from being masked in the handler.
  10638. + *
  10639. + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
  10640. + * Unix names RESETHAND and NODEFER respectively.
  10641. + */
  10642. +#define SA_NOCLDSTOP 0x00000001
  10643. +#define SA_NOCLDWAIT 0x00000002 /* not supported yet */
  10644. +#define SA_SIGINFO 0x00000004
  10645. +#define SA_ONSTACK 0x08000000
  10646. +#define SA_RESTART 0x10000000
  10647. +#define SA_NODEFER 0x40000000
  10648. +#define SA_RESETHAND 0x80000000
  10649. +
  10650. +#define SA_NOMASK SA_NODEFER
  10651. +#define SA_ONESHOT SA_RESETHAND
  10652. +#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
  10653. +
  10654. +#define SA_RESTORER 0x04000000
  10655. +
  10656. +/*
  10657. + * sigaltstack controls
  10658. + */
  10659. +#define SS_ONSTACK 1
  10660. +#define SS_DISABLE 2
  10661. +
  10662. +#define MINSIGSTKSZ 2048
  10663. +#define SIGSTKSZ 8192
  10664. +
  10665. +#ifdef __KERNEL__
  10666. +/*
  10667. + * These values of sa_flags are used only by the kernel as part of the
  10668. + * irq handling routines.
  10669. + *
  10670. + * SA_INTERRUPT is also used by the irq handling routines.
  10671. + * SA_SHIRQ is for shared interrupt support on PCI and EISA.
  10672. + */
  10673. +#define SA_PROBE SA_ONESHOT
  10674. +#define SA_SAMPLE_RANDOM SA_RESTART
  10675. +#define SA_SHIRQ 0x04000000
  10676. +#endif
  10677. +
  10678. +#define SIG_BLOCK 0 /* for blocking signals */
  10679. +#define SIG_UNBLOCK 1 /* for unblocking signals */
  10680. +#define SIG_SETMASK 2 /* for setting the signal mask */
  10681. +
  10682. +/* Type of a signal handler. */
  10683. +typedef void (*__sighandler_t)(int);
  10684. +
  10685. +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
  10686. +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
  10687. +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
  10688. +
  10689. +#ifdef __KERNEL__
  10690. +struct old_sigaction {
  10691. + __sighandler_t sa_handler;
  10692. + old_sigset_t sa_mask;
  10693. + unsigned long sa_flags;
  10694. + void (*sa_restorer)(void);
  10695. +};
  10696. +
  10697. +struct sigaction {
  10698. + __sighandler_t sa_handler;
  10699. + unsigned long sa_flags;
  10700. + void (*sa_restorer)(void);
  10701. + sigset_t sa_mask; /* mask last for extensibility */
  10702. +};
  10703. +
  10704. +struct k_sigaction {
  10705. + struct sigaction sa;
  10706. +};
  10707. +#else
  10708. +/* Here we must cater to libcs that poke about in kernel headers. */
  10709. +
  10710. +struct sigaction {
  10711. + union {
  10712. + __sighandler_t _sa_handler;
  10713. + void (*_sa_sigaction)(int, struct siginfo *, void *);
  10714. + } _u;
  10715. + sigset_t sa_mask;
  10716. + unsigned long sa_flags;
  10717. + void (*sa_restorer)(void);
  10718. +};
  10719. +
  10720. +#define sa_handler _u._sa_handler
  10721. +#define sa_sigaction _u._sa_sigaction
  10722. +
  10723. +#endif /* __KERNEL__ */
  10724. +
  10725. +typedef struct sigaltstack {
  10726. + void *ss_sp;
  10727. + int ss_flags;
  10728. + size_t ss_size;
  10729. +} stack_t;
  10730. +
  10731. +#ifdef __KERNEL__
  10732. +
  10733. +#include <asm/sigcontext.h>
  10734. +#undef __HAVE_ARCH_SIG_BITOPS
  10735. +
  10736. +#define ptrace_signal_deliver(regs, cookie) do { } while (0)
  10737. +
  10738. +#endif /* __KERNEL__ */
  10739. +
  10740. +#endif /* _NIOS2_SIGNAL_H */
  10741. --- linux/include/asm-nios2nommu/smp.h
  10742. +++ linux/include/asm-nios2nommu/smp.h
  10743. @@ -0,0 +1,34 @@
  10744. +#ifndef __ASM_SMP_H
  10745. +#define __ASM_SMP_H
  10746. +
  10747. +/*--------------------------------------------------------------------
  10748. + *
  10749. + * include/asm-nios2nommu/smp.h
  10750. + *
  10751. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10752. + *
  10753. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10754. + *
  10755. + * This program is free software; you can redistribute it and/or modify
  10756. + * it under the terms of the GNU General Public License as published by
  10757. + * the Free Software Foundation; either version 2 of the License, or
  10758. + * (at your option) any later version.
  10759. + *
  10760. + * This program is distributed in the hope that it will be useful,
  10761. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10762. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10763. + * GNU General Public License for more details.
  10764. + *
  10765. + *
  10766. + * Jan/20/2004 dgt NiosII
  10767. + *
  10768. + ---------------------------------------------------------------------*/
  10769. +
  10770. +
  10771. +// #include <linux/config.h>
  10772. +
  10773. +#ifdef CONFIG_SMP
  10774. +#error SMP not supported
  10775. +#endif
  10776. +
  10777. +#endif
  10778. --- linux/include/asm-nios2nommu/socket.h
  10779. +++ linux/include/asm-nios2nommu/socket.h
  10780. @@ -0,0 +1,74 @@
  10781. +#ifndef _ASM_SOCKET_H
  10782. +#define _ASM_SOCKET_H
  10783. +
  10784. +/*--------------------------------------------------------------------
  10785. + *
  10786. + * include/asm-nios2nommu/socket.h
  10787. + *
  10788. + * Derived from m68knommu
  10789. + *
  10790. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10791. + *
  10792. + * This program is free software; you can redistribute it and/or modify
  10793. + * it under the terms of the GNU General Public License as published by
  10794. + * the Free Software Foundation; either version 2 of the License, or
  10795. + * (at your option) any later version.
  10796. + *
  10797. + * This program is distributed in the hope that it will be useful,
  10798. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10799. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10800. + * GNU General Public License for more details.
  10801. + *
  10802. + *
  10803. + * Jan/20/2004 dgt NiosII
  10804. + *
  10805. + ---------------------------------------------------------------------*/
  10806. +
  10807. +
  10808. +#include <asm/sockios.h>
  10809. +
  10810. +/* For setsockopt(2) */
  10811. +#define SOL_SOCKET 1
  10812. +
  10813. +#define SO_DEBUG 1
  10814. +#define SO_REUSEADDR 2
  10815. +#define SO_TYPE 3
  10816. +#define SO_ERROR 4
  10817. +#define SO_DONTROUTE 5
  10818. +#define SO_BROADCAST 6
  10819. +#define SO_SNDBUF 7
  10820. +#define SO_RCVBUF 8
  10821. +#define SO_KEEPALIVE 9
  10822. +#define SO_OOBINLINE 10
  10823. +#define SO_NO_CHECK 11
  10824. +#define SO_PRIORITY 12
  10825. +#define SO_LINGER 13
  10826. +#define SO_BSDCOMPAT 14
  10827. +/* To add :#define SO_REUSEPORT 15 */
  10828. +#define SO_PASSCRED 16
  10829. +#define SO_PEERCRED 17
  10830. +#define SO_RCVLOWAT 18
  10831. +#define SO_SNDLOWAT 19
  10832. +#define SO_RCVTIMEO 20
  10833. +#define SO_SNDTIMEO 21
  10834. +
  10835. +/* Security levels - as per NRL IPv6 - don't actually do anything */
  10836. +#define SO_SECURITY_AUTHENTICATION 22
  10837. +#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
  10838. +#define SO_SECURITY_ENCRYPTION_NETWORK 24
  10839. +
  10840. +#define SO_BINDTODEVICE 25
  10841. +
  10842. +/* Socket filtering */
  10843. +#define SO_ATTACH_FILTER 26
  10844. +#define SO_DETACH_FILTER 27
  10845. +
  10846. +#define SO_PEERNAME 28
  10847. +#define SO_TIMESTAMP 29
  10848. +#define SCM_TIMESTAMP SO_TIMESTAMP
  10849. +
  10850. +#define SO_ACCEPTCONN 30
  10851. +
  10852. +#define SO_PEERSEC 31 /* ;dgt2;tmp; */
  10853. +
  10854. +#endif /* _ASM_SOCKET_H */
  10855. --- linux/include/asm-nios2nommu/sockios.h
  10856. +++ linux/include/asm-nios2nommu/sockios.h
  10857. @@ -0,0 +1,38 @@
  10858. +#ifndef _ASM_NIOS_SOCKIOS_H
  10859. +#define _ASM_NIOS_SOCKIOS_H
  10860. +
  10861. +/*--------------------------------------------------------------------
  10862. + *
  10863. + * include/asm-nios2nommu/sockios.h
  10864. + *
  10865. + * Socket-level I/O control calls.
  10866. + *
  10867. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10868. + *
  10869. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10870. + *
  10871. + * This program is free software; you can redistribute it and/or modify
  10872. + * it under the terms of the GNU General Public License as published by
  10873. + * the Free Software Foundation; either version 2 of the License, or
  10874. + * (at your option) any later version.
  10875. + *
  10876. + * This program is distributed in the hope that it will be useful,
  10877. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10878. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10879. + * GNU General Public License for more details.
  10880. + *
  10881. + *
  10882. + * Jan/20/2004 dgt NiosII
  10883. + *
  10884. + ---------------------------------------------------------------------*/
  10885. +
  10886. +
  10887. +#define FIOSETOWN 0x8901
  10888. +#define SIOCSPGRP 0x8902
  10889. +#define FIOGETOWN 0x8903
  10890. +#define SIOCGPGRP 0x8904
  10891. +#define SIOCATMARK 0x8905
  10892. +#define SIOCGSTAMP 0x8906 /* Get stamp */
  10893. +
  10894. +#endif /* !(_ASM_NIOS_SOCKIOS_H) */
  10895. +
  10896. --- linux/include/asm-nios2nommu/spi.h
  10897. +++ linux/include/asm-nios2nommu/spi.h
  10898. @@ -0,0 +1,92 @@
  10899. +#ifndef _ASM_SPI_H_
  10900. +#define _ASM_SPI_H_ 1
  10901. +
  10902. +/*--------------------------------------------------------------------
  10903. + *
  10904. + * include/asm-nios2nommu/spi.h
  10905. + *
  10906. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10907. + *
  10908. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10909. + *
  10910. + * This program is free software; you can redistribute it and/or modify
  10911. + * it under the terms of the GNU General Public License as published by
  10912. + * the Free Software Foundation; either version 2 of the License, or
  10913. + * (at your option) any later version.
  10914. + *
  10915. + * This program is distributed in the hope that it will be useful,
  10916. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10917. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10918. + * GNU General Public License for more details.
  10919. + *
  10920. + *
  10921. + * Jan/20/2004 dgt NiosII
  10922. + *
  10923. + ---------------------------------------------------------------------*/
  10924. +
  10925. +
  10926. +#include <asm/nios.h>
  10927. +
  10928. +int register_NIOS_SPI( void );
  10929. +void unregister_NIOS_SPI( void );
  10930. +
  10931. +#if defined(MODULE)
  10932. +void cleanup_module( void );
  10933. +int init_module( void );
  10934. +#endif
  10935. +
  10936. +#if defined(__KERNEL__)
  10937. +int spi_reset ( void );
  10938. +#endif
  10939. +
  10940. +
  10941. +#define clockCS 0x01
  10942. +#define temperatureCS 0x02
  10943. +
  10944. +#define clock_read_base 0x00
  10945. +#define clock_write_base 0x80
  10946. +#define clock_read_control 0x0F
  10947. +#define clock_read_trickle 0x11
  10948. +
  10949. +#define clock_read_sec 0x00
  10950. +#define clock_read_min 0x01
  10951. +#define clock_read_hour 0x02
  10952. +#define clock_read_day 0x03
  10953. +#define clock_read_date 0x04
  10954. +#define clock_read_month 0x05
  10955. +#define clock_read_year 0x06
  10956. +
  10957. +#define clock_write_control 0x8F
  10958. +#define clock_write_trickle 0x91
  10959. +#define clock_write_sec 0x80
  10960. +#define clock_write_min 0x81
  10961. +#define clock_write_hour 0x82
  10962. +#define clock_write_day 0x83
  10963. +#define clock_write_date 0x84
  10964. +#define clock_write_month 0x85
  10965. +#define clock_write_year 0x86
  10966. +
  10967. +#define clock_write_ram_start 0xA0
  10968. +#define clock_write_ram_end 0x100
  10969. +#define clock_read_ram_start 0x20
  10970. +#define clock_read_ram_end 0x80
  10971. +
  10972. +
  10973. +#define clock_sec_def 0x11
  10974. +#define clock_min_def 0x59
  10975. +#define clock_hour_def 0x71
  10976. +#define clock_day_def 0x00
  10977. +#define clock_date_def 0x20
  10978. +#define clock_month_def 0x12
  10979. +#define clock_year_def 0x34
  10980. +
  10981. +#define temp_read_base 0x00
  10982. +#define temp_write_base 0x80
  10983. +#define temp_read_control 0x00
  10984. +#define temp_write_control 0x80
  10985. +#define temp_read_msb 0x02
  10986. +#define temp_read_lsb 0x01
  10987. +
  10988. +#define MAX_TEMP_VAR 10
  10989. +
  10990. +#endif /*_ASM_SPI_H_*/
  10991. --- linux/include/asm-nios2nommu/spinlock.h
  10992. +++ linux/include/asm-nios2nommu/spinlock.h
  10993. @@ -0,0 +1,30 @@
  10994. +#ifndef __NIOS_SPINLOCK_H
  10995. +#define __NIOS_SPINLOCK_H
  10996. +
  10997. +/*--------------------------------------------------------------------
  10998. + *
  10999. + * include/asm-nios2nommu/spinlock.h
  11000. + *
  11001. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  11002. + *
  11003. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11004. + *
  11005. + * This program is free software; you can redistribute it and/or modify
  11006. + * it under the terms of the GNU General Public License as published by
  11007. + * the Free Software Foundation; either version 2 of the License, or
  11008. + * (at your option) any later version.
  11009. + *
  11010. + * This program is distributed in the hope that it will be useful,
  11011. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11012. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11013. + * GNU General Public License for more details.
  11014. + *
  11015. + *
  11016. + * Jan/20/2004 dgt NiosII
  11017. + *
  11018. + ---------------------------------------------------------------------*/
  11019. +
  11020. +
  11021. +#error "Nios doesn't do SMP yet"
  11022. +
  11023. +#endif
  11024. --- linux/include/asm-nios2nommu/spi_struct.h
  11025. +++ linux/include/asm-nios2nommu/spi_struct.h
  11026. @@ -0,0 +1,57 @@
  11027. +// SPI Registers
  11028. +typedef volatile struct
  11029. + {
  11030. + int np_spirxdata; // Read-only, 1-16 bit
  11031. + int np_spitxdata; // Write-only, same width as rxdata
  11032. + int np_spistatus; // Read-only, 9-bit
  11033. + int np_spicontrol; // Read/Write, 9-bit
  11034. + int np_spireserved; // reserved
  11035. + int np_spislaveselect; // Read/Write, 1-16 bit, master only
  11036. + int np_spiendofpacket; // Read/write, same width as txdata, rxdata.
  11037. + } np_spi;
  11038. +
  11039. +// SPI Status Register Bits
  11040. +enum
  11041. + {
  11042. + np_spistatus_eop_bit = 9,
  11043. + np_spistatus_e_bit = 8,
  11044. + np_spistatus_rrdy_bit = 7,
  11045. + np_spistatus_trdy_bit = 6,
  11046. + np_spistatus_tmt_bit = 5,
  11047. + np_spistatus_toe_bit = 4,
  11048. + np_spistatus_roe_bit = 3,
  11049. +
  11050. + np_spistatus_eop_mask = (1 << 9),
  11051. + np_spistatus_e_mask = (1 << 8),
  11052. + np_spistatus_rrdy_mask = (1 << 7),
  11053. + np_spistatus_trdy_mask = (1 << 6),
  11054. + np_spistatus_tmt_mask = (1 << 5),
  11055. + np_spistatus_toe_mask = (1 << 4),
  11056. + np_spistatus_roe_mask = (1 << 3),
  11057. + };
  11058. +
  11059. +// SPI Control Register Bits
  11060. +enum
  11061. + {
  11062. + np_spicontrol_sso_bit = 10,
  11063. + np_spicontrol_ieop_bit = 9,
  11064. + np_spicontrol_ie_bit = 8,
  11065. + np_spicontrol_irrdy_bit = 7,
  11066. + np_spicontrol_itrdy_bit = 6,
  11067. + np_spicontrol_itoe_bit = 4,
  11068. + np_spicontrol_iroe_bit = 3,
  11069. +
  11070. + np_spicontrol_sso_mask = (1 << 10),
  11071. + np_spicontrol_ieop_mask = (1 << 9),
  11072. + np_spicontrol_ie_mask = (1 << 8),
  11073. + np_spicontrol_irrdy_mask = (1 << 7),
  11074. + np_spicontrol_itrdy_mask = (1 << 6),
  11075. + np_spicontrol_itoe_mask = (1 << 4),
  11076. + np_spicontrol_iroe_mask = (1 << 3),
  11077. + };
  11078. +
  11079. +// SPI Routines.
  11080. +int nr_spi_rxchar(np_spi *spiBase);
  11081. +int nr_spi_txchar(int i, np_spi *spiBase);
  11082. +
  11083. +
  11084. --- linux/include/asm-nios2nommu/statfs.h
  11085. +++ linux/include/asm-nios2nommu/statfs.h
  11086. @@ -0,0 +1,30 @@
  11087. +#ifndef _NIOS2NOMMU_STATFS_H
  11088. +#define _NIOS2NOMMU_STATFS_H
  11089. +
  11090. +/*--------------------------------------------------------------------
  11091. + *
  11092. + * include/asm-nios2nommu/statfs.h
  11093. + *
  11094. + * Derived from M68knommu
  11095. + *
  11096. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11097. + *
  11098. + * This program is free software; you can redistribute it and/or modify
  11099. + * it under the terms of the GNU General Public License as published by
  11100. + * the Free Software Foundation; either version 2 of the License, or
  11101. + * (at your option) any later version.
  11102. + *
  11103. + * This program is distributed in the hope that it will be useful,
  11104. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11105. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11106. + * GNU General Public License for more details.
  11107. + *
  11108. + *
  11109. + * Jan/20/2004 dgt NiosII
  11110. + *
  11111. + ---------------------------------------------------------------------*/
  11112. +
  11113. +
  11114. +#include <asm-generic/statfs.h>
  11115. +
  11116. +#endif /* _NIOS2NOMMU_STATFS_H */
  11117. --- linux/include/asm-nios2nommu/stat.h
  11118. +++ linux/include/asm-nios2nommu/stat.h
  11119. @@ -0,0 +1,102 @@
  11120. +#ifndef _ASMNIOS2NOMMU_STAT_H
  11121. +#define _ASMNIOS2NOMMU_STAT_H
  11122. +
  11123. +/*--------------------------------------------------------------------
  11124. + *
  11125. + * include/asm-nios2nommu/stat.h
  11126. + *
  11127. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  11128. + *
  11129. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11130. + *
  11131. + * This program is free software; you can redistribute it and/or modify
  11132. + * it under the terms of the GNU General Public License as published by
  11133. + * the Free Software Foundation; either version 2 of the License, or
  11134. + * (at your option) any later version.
  11135. + *
  11136. + * This program is distributed in the hope that it will be useful,
  11137. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11138. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11139. + * GNU General Public License for more details.
  11140. + *
  11141. + *
  11142. + * Jan/20/2004 dgt NiosII
  11143. + *
  11144. + ---------------------------------------------------------------------*/
  11145. +
  11146. +
  11147. +struct __old_kernel_stat {
  11148. + unsigned short st_dev;
  11149. + unsigned short st_ino;
  11150. + unsigned short st_mode;
  11151. + unsigned short st_nlink;
  11152. + unsigned short st_uid;
  11153. + unsigned short st_gid;
  11154. + unsigned short st_rdev;
  11155. + unsigned long st_size;
  11156. + unsigned long st_atime;
  11157. + unsigned long st_mtime;
  11158. + unsigned long st_ctime;
  11159. +};
  11160. +
  11161. +struct stat {
  11162. + unsigned short st_dev;
  11163. + unsigned short __pad1;
  11164. + unsigned long st_ino;
  11165. + unsigned short st_mode;
  11166. + unsigned short st_nlink;
  11167. + unsigned short st_uid;
  11168. + unsigned short st_gid;
  11169. + unsigned short st_rdev;
  11170. + unsigned short __pad2;
  11171. + unsigned long st_size;
  11172. + unsigned long st_blksize;
  11173. + unsigned long st_blocks;
  11174. + unsigned long st_atime;
  11175. + unsigned long __unused1;
  11176. + unsigned long st_mtime;
  11177. + unsigned long __unused2;
  11178. + unsigned long st_ctime;
  11179. + unsigned long __unused3;
  11180. + unsigned long __unused4;
  11181. + unsigned long __unused5;
  11182. +};
  11183. +
  11184. +/* This matches struct stat64 in glibc2.1, hence the absolutely
  11185. + * insane amounts of padding around dev_t's.
  11186. + */
  11187. +struct stat64 {
  11188. + unsigned long long st_dev;
  11189. + unsigned char __pad1[4];
  11190. +
  11191. +#define STAT64_HAS_BROKEN_ST_INO 1
  11192. + unsigned long __st_ino;
  11193. +
  11194. + unsigned int st_mode;
  11195. + unsigned int st_nlink;
  11196. +
  11197. + unsigned long st_uid;
  11198. + unsigned long st_gid;
  11199. +
  11200. + unsigned long long st_rdev;
  11201. + unsigned char __pad3[4];
  11202. +
  11203. + long long st_size;
  11204. + unsigned long st_blksize;
  11205. +
  11206. + unsigned long __pad4; /* future possible st_blocks high bits */
  11207. + unsigned long st_blocks; /* Number 512-byte blocks allocated. */
  11208. +
  11209. + unsigned long st_atime;
  11210. + unsigned long st_atime_nsec;
  11211. +
  11212. + unsigned long st_mtime;
  11213. + unsigned long st_mtime_nsec;
  11214. +
  11215. + unsigned long st_ctime;
  11216. + unsigned long st_ctime_nsec;
  11217. +
  11218. + unsigned long long st_ino;
  11219. +};
  11220. +
  11221. +#endif
  11222. --- linux/include/asm-nios2nommu/string.h
  11223. +++ linux/include/asm-nios2nommu/string.h
  11224. @@ -0,0 +1,45 @@
  11225. +#ifndef __NIOS_STRING_H__
  11226. +#define __NIOS_STRING_H__
  11227. +
  11228. +/*--------------------------------------------------------------------
  11229. + *
  11230. + * include/asm-nios2nommu/string.h
  11231. + *
  11232. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  11233. + *
  11234. + * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  11235. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11236. + *
  11237. + * This program is free software; you can redistribute it and/or modify
  11238. + * it under the terms of the GNU General Public License as published by
  11239. + * the Free Software Foundation; either version 2 of the License, or
  11240. + * (at your option) any later version.
  11241. + *
  11242. + * This program is distributed in the hope that it will be useful,
  11243. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11244. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11245. + * GNU General Public License for more details.
  11246. + *
  11247. + *
  11248. + * Jan/20/2004 dgt NiosII
  11249. + *
  11250. + ---------------------------------------------------------------------*/
  11251. +
  11252. +
  11253. +#ifdef __KERNEL__ /* only set these up for kernel code */
  11254. +
  11255. +#define __HAVE_ARCH_MEMMOVE
  11256. +void * memmove(void * d, const void * s, size_t count);
  11257. +#define __HAVE_ARCH_MEMCPY
  11258. +extern void * memcpy(void *d, const void *s, size_t count);
  11259. +#define __HAVE_ARCH_MEMSET
  11260. +extern void * memset(void * s,int c,size_t count);
  11261. +
  11262. +#if 0
  11263. +#define __HAVE_ARCH_BCOPY
  11264. +#define __HAVE_ARCH_STRLEN
  11265. +#endif
  11266. +
  11267. +#endif /* KERNEL */
  11268. +
  11269. +#endif /* !(__NIOS_STRING_H__) */
  11270. --- linux/include/asm-nios2nommu/system.h
  11271. +++ linux/include/asm-nios2nommu/system.h
  11272. @@ -0,0 +1,172 @@
  11273. +/*
  11274. + * Taken from the m68k.
  11275. + *
  11276. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  11277. + *
  11278. + * All rights reserved.
  11279. + *
  11280. + * This program is free software; you can redistribute it and/or modify
  11281. + * it under the terms of the GNU General Public License as published by
  11282. + * the Free Software Foundation; either version 2 of the License, or
  11283. + * (at your option) any later version.
  11284. + *
  11285. + * This program is distributed in the hope that it will be useful, but
  11286. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  11287. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11288. + * NON INFRINGEMENT. See the GNU General Public License for more
  11289. + * details.
  11290. + *
  11291. + * You should have received a copy of the GNU General Public License
  11292. + * along with this program; if not, write to the Free Software
  11293. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  11294. + *
  11295. + */
  11296. +
  11297. +#ifndef _NIOS2NOMMU_SYSTEM_H
  11298. +#define _NIOS2NOMMU_SYSTEM_H
  11299. +
  11300. +// #include <linux/config.h> /* get configuration macros */
  11301. +#include <linux/linkage.h>
  11302. +#include <asm/segment.h>
  11303. +#include <asm/entry.h>
  11304. +#include <asm/nios.h>
  11305. +
  11306. +/*
  11307. + * switch_to(n) should switch tasks to task ptr, first checking that
  11308. + * ptr isn't the current task, in which case it does nothing. This
  11309. + * also clears the TS-flag if the task we switched to has used the
  11310. + * math co-processor latest.
  11311. + */
  11312. +
  11313. +/*
  11314. + */
  11315. +asmlinkage void resume(void);
  11316. +#define switch_to(prev,next,last) \
  11317. +{ \
  11318. + void *_last; \
  11319. + __asm__ __volatile__( \
  11320. + "mov r4, %1\n" \
  11321. + "mov r5, %2\n" \
  11322. + "call resume\n" \
  11323. + "mov %0,r4\n" \
  11324. + : "=r" (_last) \
  11325. + : "r" (prev), "r" (next) \
  11326. + : "r4","r5","r7","r8","ra"); \
  11327. + (last) = _last; \
  11328. +}
  11329. +
  11330. +#define local_irq_enable() __asm__ __volatile__ ( \
  11331. + "rdctl r8, status\n" \
  11332. + "ori r8, r8, 1\n" \
  11333. + "wrctl status, r8\n" \
  11334. + : : : "r8")
  11335. +
  11336. +#define local_irq_disable() __asm__ __volatile__ ( \
  11337. + "rdctl r8, status\n" \
  11338. + "andi r8, r8, 0xfffe\n" \
  11339. + "wrctl status, r8\n" \
  11340. + : : : "r8")
  11341. +
  11342. +#define local_save_flags(x) __asm__ __volatile__ ( \
  11343. + "rdctl r8, status\n" \
  11344. + "mov %0, r8\n" \
  11345. + :"=r" (x) : : "r8", "memory")
  11346. +
  11347. +#define local_irq_restore(x) __asm__ __volatile__ ( \
  11348. + "mov r8, %0\n" \
  11349. + "wrctl status, r8\n" \
  11350. + : :"r" (x) : "memory")
  11351. +
  11352. +/* For spinlocks etc */
  11353. +#define local_irq_save(x) do { local_save_flags(x); local_irq_disable(); } while (0)
  11354. +
  11355. +#define irqs_disabled() \
  11356. +({ \
  11357. + unsigned long flags; \
  11358. + local_save_flags(flags); \
  11359. + ((flags & NIOS2_STATUS_PIE_MSK) == 0x0); \
  11360. +})
  11361. +
  11362. +#define iret() __asm__ __volatile__ ("eret": : :"memory", "ea")
  11363. +
  11364. +/*
  11365. + * Force strict CPU ordering.
  11366. + * Not really required on m68k...
  11367. + */
  11368. +#define nop() asm volatile ("nop"::)
  11369. +#define mb() asm volatile ("" : : :"memory")
  11370. +#define rmb() asm volatile ("" : : :"memory")
  11371. +#define wmb() asm volatile ("" : : :"memory")
  11372. +#define set_rmb(var, value) do { xchg(&var, value); } while (0)
  11373. +#define set_mb(var, value) set_rmb(var, value)
  11374. +#define set_wmb(var, value) do { var = value; wmb(); } while (0)
  11375. +
  11376. +#ifdef CONFIG_SMP
  11377. +#define smp_mb() mb()
  11378. +#define smp_rmb() rmb()
  11379. +#define smp_wmb() wmb()
  11380. +#define smp_read_barrier_depends() read_barrier_depends()
  11381. +#else
  11382. +#define smp_mb() barrier()
  11383. +#define smp_rmb() barrier()
  11384. +#define smp_wmb() barrier()
  11385. +#define smp_read_barrier_depends() do { } while(0)
  11386. +#endif
  11387. +
  11388. +#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
  11389. +#define tas(ptr) (xchg((ptr),1))
  11390. +
  11391. +struct __xchg_dummy { unsigned long a[100]; };
  11392. +#define __xg(x) ((volatile struct __xchg_dummy *)(x))
  11393. +
  11394. +static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
  11395. +{
  11396. + unsigned long tmp, flags;
  11397. +
  11398. + local_irq_save(flags);
  11399. +
  11400. + switch (size) {
  11401. + case 1:
  11402. + __asm__ __volatile__( \
  11403. + "ldb %0, %2\n" \
  11404. + "stb %1, %2\n" \
  11405. + : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
  11406. + break;
  11407. + case 2:
  11408. + __asm__ __volatile__( \
  11409. + "ldh %0, %2\n" \
  11410. + "sth %1, %2\n" \
  11411. + : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
  11412. + break;
  11413. + case 4:
  11414. + __asm__ __volatile__( \
  11415. + "ldw %0, %2\n" \
  11416. + "stw %1, %2\n" \
  11417. + : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
  11418. + break;
  11419. + }
  11420. + local_irq_restore(flags);
  11421. + return tmp;
  11422. +}
  11423. +
  11424. +/*
  11425. + * Atomic compare and exchange. Compare OLD with MEM, if identical,
  11426. + * store NEW in MEM. Return the initial value in MEM. Success is
  11427. + * indicated by comparing RETURN with OLD.
  11428. + */
  11429. +#define __HAVE_ARCH_CMPXCHG 1
  11430. +
  11431. +static __inline__ unsigned long
  11432. +cmpxchg(volatile int *p, int old, int new)
  11433. +{
  11434. + unsigned long flags;
  11435. + int prev;
  11436. +
  11437. + local_irq_save(flags);
  11438. + if ((prev = *p) == old)
  11439. + *p = new;
  11440. + local_irq_restore(flags);
  11441. + return(prev);
  11442. +}
  11443. +
  11444. +#endif /* _NIOS2NOMMU_SYSTEM_H */
  11445. --- linux/include/asm-nios2nommu/termbits.h
  11446. +++ linux/include/asm-nios2nommu/termbits.h
  11447. @@ -0,0 +1,199 @@
  11448. +#ifndef __ARCH_NIOS_TERMBITS_H__
  11449. +#define __ARCH_NIOS_TERMBITS_H__
  11450. +
  11451. +/*--------------------------------------------------------------------
  11452. + *
  11453. + * include/asm-nios2nommu/termbits.h
  11454. + *
  11455. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  11456. + *
  11457. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11458. + *
  11459. + * This program is free software; you can redistribute it and/or modify
  11460. + * it under the terms of the GNU General Public License as published by
  11461. + * the Free Software Foundation; either version 2 of the License, or
  11462. + * (at your option) any later version.
  11463. + *
  11464. + * This program is distributed in the hope that it will be useful,
  11465. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11466. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11467. + * GNU General Public License for more details.
  11468. + *
  11469. + *
  11470. + * Jan/20/2004 dgt NiosII
  11471. + *
  11472. + ---------------------------------------------------------------------*/
  11473. +
  11474. +
  11475. +#include <linux/posix_types.h>
  11476. +
  11477. +typedef unsigned char cc_t;
  11478. +typedef unsigned int speed_t;
  11479. +typedef unsigned int tcflag_t;
  11480. +
  11481. +#define NCCS 19
  11482. +struct termios {
  11483. + tcflag_t c_iflag; /* input mode flags */
  11484. + tcflag_t c_oflag; /* output mode flags */
  11485. + tcflag_t c_cflag; /* control mode flags */
  11486. + tcflag_t c_lflag; /* local mode flags */
  11487. + cc_t c_line; /* line discipline */
  11488. + cc_t c_cc[NCCS]; /* control characters */
  11489. +};
  11490. +
  11491. +/* c_cc characters */
  11492. +#define VINTR 0
  11493. +#define VQUIT 1
  11494. +#define VERASE 2
  11495. +#define VKILL 3
  11496. +#define VEOF 4
  11497. +#define VTIME 5
  11498. +#define VMIN 6
  11499. +#define VSWTC 7
  11500. +#define VSTART 8
  11501. +#define VSTOP 9
  11502. +#define VSUSP 10
  11503. +#define VEOL 11
  11504. +#define VREPRINT 12
  11505. +#define VDISCARD 13
  11506. +#define VWERASE 14
  11507. +#define VLNEXT 15
  11508. +#define VEOL2 16
  11509. +
  11510. +
  11511. +/* c_iflag bits */
  11512. +#define IGNBRK 0000001
  11513. +#define BRKINT 0000002
  11514. +#define IGNPAR 0000004
  11515. +#define PARMRK 0000010
  11516. +#define INPCK 0000020
  11517. +#define ISTRIP 0000040
  11518. +#define INLCR 0000100
  11519. +#define IGNCR 0000200
  11520. +#define ICRNL 0000400
  11521. +#define IUCLC 0001000
  11522. +#define IXON 0002000
  11523. +#define IXANY 0004000
  11524. +#define IXOFF 0010000
  11525. +#define IMAXBEL 0020000
  11526. +#define IUTF8 0040000
  11527. +
  11528. +/* c_oflag bits */
  11529. +#define OPOST 0000001
  11530. +#define OLCUC 0000002
  11531. +#define ONLCR 0000004
  11532. +#define OCRNL 0000010
  11533. +#define ONOCR 0000020
  11534. +#define ONLRET 0000040
  11535. +#define OFILL 0000100
  11536. +#define OFDEL 0000200
  11537. +#define NLDLY 0000400
  11538. +#define NL0 0000000
  11539. +#define NL1 0000400
  11540. +#define CRDLY 0003000
  11541. +#define CR0 0000000
  11542. +#define CR1 0001000
  11543. +#define CR2 0002000
  11544. +#define CR3 0003000
  11545. +#define TABDLY 0014000
  11546. +#define TAB0 0000000
  11547. +#define TAB1 0004000
  11548. +#define TAB2 0010000
  11549. +#define TAB3 0014000
  11550. +#define XTABS 0014000
  11551. +#define BSDLY 0020000
  11552. +#define BS0 0000000
  11553. +#define BS1 0020000
  11554. +#define VTDLY 0040000
  11555. +#define VT0 0000000
  11556. +#define VT1 0040000
  11557. +#define FFDLY 0100000
  11558. +#define FF0 0000000
  11559. +#define FF1 0100000
  11560. +
  11561. +/* c_cflag bit meaning */
  11562. +#define CBAUD 0010017
  11563. +#define B0 0000000 /* hang up */
  11564. +#define B50 0000001
  11565. +#define B75 0000002
  11566. +#define B110 0000003
  11567. +#define B134 0000004
  11568. +#define B150 0000005
  11569. +#define B200 0000006
  11570. +#define B300 0000007
  11571. +#define B600 0000010
  11572. +#define B1200 0000011
  11573. +#define B1800 0000012
  11574. +#define B2400 0000013
  11575. +#define B4800 0000014
  11576. +#define B9600 0000015
  11577. +#define B19200 0000016
  11578. +#define B38400 0000017
  11579. +#define EXTA B19200
  11580. +#define EXTB B38400
  11581. +#define CSIZE 0000060
  11582. +#define CS5 0000000
  11583. +#define CS6 0000020
  11584. +#define CS7 0000040
  11585. +#define CS8 0000060
  11586. +#define CSTOPB 0000100
  11587. +#define CREAD 0000200
  11588. +#define PARENB 0000400
  11589. +#define PARODD 0001000
  11590. +#define HUPCL 0002000
  11591. +#define CLOCAL 0004000
  11592. +#define CBAUDEX 0010000
  11593. +#define B57600 0010001
  11594. +#define B115200 0010002
  11595. +#define B230400 0010003
  11596. +#define B460800 0010004
  11597. +#define B500000 0010005
  11598. +#define B576000 0010006
  11599. +#define B921600 0010007
  11600. +#define B1000000 0010010
  11601. +#define B1152000 0010011
  11602. +#define B1500000 0010012
  11603. +#define B2000000 0010013
  11604. +#define B2500000 0010014
  11605. +#define B3000000 0010015
  11606. +#define B3500000 0010016
  11607. +#define B4000000 0010017
  11608. +#define CIBAUD 002003600000 /* input baud rate (not used) */
  11609. +#define CMSPAR 010000000000 /* mark or space (stick) parity */
  11610. +#define CRTSCTS 020000000000 /* flow control */
  11611. +
  11612. +/* c_lflag bits */
  11613. +#define ISIG 0000001
  11614. +#define ICANON 0000002
  11615. +#define XCASE 0000004
  11616. +#define ECHO 0000010
  11617. +#define ECHOE 0000020
  11618. +#define ECHOK 0000040
  11619. +#define ECHONL 0000100
  11620. +#define NOFLSH 0000200
  11621. +#define TOSTOP 0000400
  11622. +#define ECHOCTL 0001000
  11623. +#define ECHOPRT 0002000
  11624. +#define ECHOKE 0004000
  11625. +#define FLUSHO 0010000
  11626. +#define PENDIN 0040000
  11627. +#define IEXTEN 0100000
  11628. +
  11629. +
  11630. +/* tcflow() and TCXONC use these */
  11631. +#define TCOOFF 0
  11632. +#define TCOON 1
  11633. +#define TCIOFF 2
  11634. +#define TCION 3
  11635. +
  11636. +/* tcflush() and TCFLSH use these */
  11637. +#define TCIFLUSH 0
  11638. +#define TCOFLUSH 1
  11639. +#define TCIOFLUSH 2
  11640. +
  11641. +/* tcsetattr uses these */
  11642. +#define TCSANOW 0
  11643. +#define TCSADRAIN 1
  11644. +#define TCSAFLUSH 2
  11645. +
  11646. +#endif /* __ARCH_NIOS_TERMBITS_H__ */
  11647. --- linux/include/asm-nios2nommu/termios.h
  11648. +++ linux/include/asm-nios2nommu/termios.h
  11649. @@ -0,0 +1,132 @@
  11650. +#ifndef _NIOS_TERMIOS_H
  11651. +#define _NIOS_TERMIOS_H
  11652. +
  11653. +/*--------------------------------------------------------------------
  11654. + *
  11655. + * include/asm-nios2nommu/termios.h
  11656. + *
  11657. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  11658. + *
  11659. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11660. + *
  11661. + * This program is free software; you can redistribute it and/or modify
  11662. + * it under the terms of the GNU General Public License as published by
  11663. + * the Free Software Foundation; either version 2 of the License, or
  11664. + * (at your option) any later version.
  11665. + *
  11666. + * This program is distributed in the hope that it will be useful,
  11667. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11668. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11669. + * GNU General Public License for more details.
  11670. + *
  11671. + *
  11672. + * Jan/20/2004 dgt NiosII
  11673. + *
  11674. + ---------------------------------------------------------------------*/
  11675. +
  11676. +
  11677. +#include <asm/termbits.h>
  11678. +#include <asm/ioctls.h>
  11679. +
  11680. +struct winsize {
  11681. + unsigned short ws_row;
  11682. + unsigned short ws_col;
  11683. + unsigned short ws_xpixel;
  11684. + unsigned short ws_ypixel;
  11685. +};
  11686. +
  11687. +#define NCC 8
  11688. +struct termio {
  11689. + unsigned short c_iflag; /* input mode flags */
  11690. + unsigned short c_oflag; /* output mode flags */
  11691. + unsigned short c_cflag; /* control mode flags */
  11692. + unsigned short c_lflag; /* local mode flags */
  11693. + unsigned char c_line; /* line discipline */
  11694. + unsigned char c_cc[NCC]; /* control characters */
  11695. +};
  11696. +
  11697. +#ifdef __KERNEL__
  11698. +/* intr=^C quit=^| erase=del kill=^U
  11699. + eof=^D vtime=\0 vmin=\1 sxtc=\0
  11700. + start=^Q stop=^S susp=^Z eol=\0
  11701. + reprint=^R discard=^U werase=^W lnext=^V
  11702. + eol2=\0
  11703. +*/
  11704. +#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
  11705. +#endif
  11706. +
  11707. +/* modem lines */
  11708. +#define TIOCM_LE 0x001
  11709. +#define TIOCM_DTR 0x002
  11710. +#define TIOCM_RTS 0x004
  11711. +#define TIOCM_ST 0x008
  11712. +#define TIOCM_SR 0x010
  11713. +#define TIOCM_CTS 0x020
  11714. +#define TIOCM_CAR 0x040
  11715. +#define TIOCM_RNG 0x080
  11716. +#define TIOCM_DSR 0x100
  11717. +#define TIOCM_CD TIOCM_CAR
  11718. +#define TIOCM_RI TIOCM_RNG
  11719. +#define TIOCM_OUT1 0x2000
  11720. +#define TIOCM_OUT2 0x4000
  11721. +#define TIOCM_LOOP 0x8000
  11722. +
  11723. +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  11724. +
  11725. +/* line disciplines */
  11726. +#define N_TTY 0
  11727. +#define N_SLIP 1
  11728. +#define N_MOUSE 2
  11729. +#define N_PPP 3
  11730. +#define N_STRIP 4
  11731. +#define N_AX25 5
  11732. +#define N_X25 6 /* X.25 async */
  11733. +#define N_6PACK 7
  11734. +#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
  11735. +#define N_R3964 9 /* Reserved for Simatic R3964 module */
  11736. +#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
  11737. +#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
  11738. +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
  11739. +#define N_HDLC 13 /* synchronous HDLC */
  11740. +#define N_SYNC_PPP 14
  11741. +#define N_HCI 15 /* Bluetooth HCI UART */
  11742. +
  11743. +#ifdef __KERNEL__
  11744. +
  11745. +/*
  11746. + * Translate a "termio" structure into a "termios". Ugh.
  11747. + */
  11748. +#define user_termio_to_kernel_termios(termios, termio) \
  11749. +({ \
  11750. + unsigned short tmp; \
  11751. + get_user(tmp, &(termio)->c_iflag); \
  11752. + (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
  11753. + get_user(tmp, &(termio)->c_oflag); \
  11754. + (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
  11755. + get_user(tmp, &(termio)->c_cflag); \
  11756. + (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
  11757. + get_user(tmp, &(termio)->c_lflag); \
  11758. + (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
  11759. + get_user((termios)->c_line, &(termio)->c_line); \
  11760. + copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
  11761. +})
  11762. +
  11763. +/*
  11764. + * Translate a "termios" structure into a "termio". Ugh.
  11765. + */
  11766. +#define kernel_termios_to_user_termio(termio, termios) \
  11767. +({ \
  11768. + put_user((termios)->c_iflag, &(termio)->c_iflag); \
  11769. + put_user((termios)->c_oflag, &(termio)->c_oflag); \
  11770. + put_user((termios)->c_cflag, &(termio)->c_cflag); \
  11771. + put_user((termios)->c_lflag, &(termio)->c_lflag); \
  11772. + put_user((termios)->c_line, &(termio)->c_line); \
  11773. + copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
  11774. +})
  11775. +
  11776. +#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
  11777. +#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
  11778. +
  11779. +#endif /* __KERNEL__ */
  11780. +
  11781. +#endif /* _NIOS_TERMIOS_H */
  11782. --- linux/include/asm-nios2nommu/thread_info.h
  11783. +++ linux/include/asm-nios2nommu/thread_info.h
  11784. @@ -0,0 +1,127 @@
  11785. +/* thread_info.h: niosnommu low-level thread information
  11786. + * adapted from the m68knommu
  11787. + *
  11788. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  11789. + * Copyright (C) 2002 Microtronix Datacom
  11790. + *
  11791. + * - Incorporating suggestions made by Linus Torvalds and Dave Miller
  11792. + *
  11793. + * All rights reserved.
  11794. + *
  11795. + * This program is free software; you can redistribute it and/or modify
  11796. + * it under the terms of the GNU General Public License as published by
  11797. + * the Free Software Foundation; either version 2 of the License, or
  11798. + * (at your option) any later version.
  11799. + *
  11800. + * This program is distributed in the hope that it will be useful, but
  11801. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  11802. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11803. + * NON INFRINGEMENT. See the GNU General Public License for more
  11804. + * details.
  11805. + *
  11806. + * You should have received a copy of the GNU General Public License
  11807. + * along with this program; if not, write to the Free Software
  11808. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  11809. + *
  11810. + */
  11811. +
  11812. +#ifndef _ASM_THREAD_INFO_H
  11813. +#define _ASM_THREAD_INFO_H
  11814. +
  11815. +#include <asm/page.h>
  11816. +
  11817. +#ifdef __KERNEL__
  11818. +
  11819. +#ifndef __ASSEMBLY__
  11820. +
  11821. +/*
  11822. + * low level task data.
  11823. + */
  11824. +struct thread_info {
  11825. + struct task_struct *task; /* main task structure */
  11826. + struct exec_domain *exec_domain; /* execution domain */
  11827. + unsigned long flags; /* low level flags */
  11828. + int cpu; /* cpu we're on */
  11829. + int preempt_count; /* 0 => preemptable, <0 => BUG*/
  11830. + struct restart_block restart_block;
  11831. +};
  11832. +
  11833. +/*
  11834. + * macros/functions for gaining access to the thread information structure
  11835. + */
  11836. +#define INIT_THREAD_INFO(tsk) \
  11837. +{ \
  11838. + .task = &tsk, \
  11839. + .exec_domain = &default_exec_domain, \
  11840. + .flags = 0, \
  11841. + .cpu = 0, \
  11842. + .preempt_count = 1, \
  11843. + .restart_block = { \
  11844. + .fn = do_no_restart_syscall, \
  11845. + }, \
  11846. +}
  11847. +
  11848. +#define init_thread_info (init_thread_union.thread_info)
  11849. +#define init_stack (init_thread_union.stack)
  11850. +
  11851. +
  11852. +/* how to get the thread information struct from C
  11853. + usable only in supervisor mode */
  11854. +static inline struct thread_info *current_thread_info(void)
  11855. +{
  11856. + struct thread_info *ti;
  11857. + __asm__ __volatile__(
  11858. + "mov %0, sp\n"
  11859. + "and %0, %0, %1\n"
  11860. + : "=&r"(ti)
  11861. + : "r" (~(THREAD_SIZE-1))
  11862. + );
  11863. + return ti;
  11864. +}
  11865. +
  11866. +/* thread information allocation */
  11867. +#define alloc_thread_info(tsk) ((struct thread_info *) \
  11868. + __get_free_pages(GFP_KERNEL, 1))
  11869. +#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
  11870. +#define put_thread_info(ti) put_task_struct((ti)->task)
  11871. +
  11872. +#define PREEMPT_ACTIVE 0x4000000
  11873. +
  11874. +/*
  11875. + * thread information flag bit numbers
  11876. + */
  11877. +#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  11878. +#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
  11879. +#define TIF_SIGPENDING 2 /* signal pending */
  11880. +#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  11881. +#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
  11882. + TIF_NEED_RESCHED */
  11883. +#define TIF_MEMDIE 5
  11884. +
  11885. +/* as above, but as bit values */
  11886. +#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  11887. +#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  11888. +#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  11889. +#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  11890. +#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  11891. +
  11892. +#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
  11893. +
  11894. +#else /* __ASSEMBLY__ */
  11895. +
  11896. +/* how to get the thread information struct from ASM
  11897. + usable only in supervisor mode */
  11898. +.macro GET_THREAD_INFO reg
  11899. +.if THREAD_SIZE & 0xffff0000
  11900. + andhi \reg, sp, %hi(~(THREAD_SIZE-1))
  11901. +.else
  11902. + addi \reg, r0, %lo(~(THREAD_SIZE-1))
  11903. + and \reg, \reg, sp
  11904. +.endif
  11905. +.endm
  11906. +
  11907. +#endif /* __ASSEMBLY__ */
  11908. +
  11909. +#endif /* __KERNEL__ */
  11910. +
  11911. +#endif /* _ASM_THREAD_INFO_H */
  11912. --- linux/include/asm-nios2nommu/timer_struct.h
  11913. +++ linux/include/asm-nios2nommu/timer_struct.h
  11914. @@ -0,0 +1,38 @@
  11915. +
  11916. +// ----------------------------------------------
  11917. +// Timer Peripheral
  11918. +
  11919. +// Timer Registers
  11920. +typedef volatile struct
  11921. + {
  11922. + int np_timerstatus; // read only, 2 bits (any write to clear TO)
  11923. + int np_timercontrol; // write/readable, 4 bits
  11924. + int np_timerperiodl; // write/readable, 16 bits
  11925. + int np_timerperiodh; // write/readable, 16 bits
  11926. + int np_timersnapl; // read only, 16 bits
  11927. + int np_timersnaph; // read only, 16 bits
  11928. + } np_timer;
  11929. +
  11930. +// Timer Register Bits
  11931. +enum
  11932. + {
  11933. + np_timerstatus_run_bit = 1, // timer is running
  11934. + np_timerstatus_to_bit = 0, // timer has timed out
  11935. +
  11936. + np_timercontrol_stop_bit = 3, // stop the timer
  11937. + np_timercontrol_start_bit = 2, // start the timer
  11938. + np_timercontrol_cont_bit = 1, // continous mode
  11939. + np_timercontrol_ito_bit = 0, // enable time out interrupt
  11940. +
  11941. + np_timerstatus_run_mask = (1<<1), // timer is running
  11942. + np_timerstatus_to_mask = (1<<0), // timer has timed out
  11943. +
  11944. + np_timercontrol_stop_mask = (1<<3), // stop the timer
  11945. + np_timercontrol_start_mask = (1<<2), // start the timer
  11946. + np_timercontrol_cont_mask = (1<<1), // continous mode
  11947. + np_timercontrol_ito_mask = (1<<0) // enable time out interrupt
  11948. + };
  11949. +
  11950. +// Timer Routines
  11951. +int nr_timer_milliseconds(void); // Starts on first call, hogs timer1.
  11952. +
  11953. --- linux/include/asm-nios2nommu/timex.h
  11954. +++ linux/include/asm-nios2nommu/timex.h
  11955. @@ -0,0 +1,48 @@
  11956. +#ifndef _ASMNIOS2NOMMU_TIMEX_H
  11957. +#define _ASMNIOS2NOMMU_TIMEX_H
  11958. +
  11959. +/*--------------------------------------------------------------------
  11960. + *
  11961. + * include/asm-nios2nommu/timex.h
  11962. + *
  11963. + * timex specifications
  11964. + *
  11965. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  11966. + *
  11967. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11968. + *
  11969. + * This program is free software; you can redistribute it and/or modify
  11970. + * it under the terms of the GNU General Public License as published by
  11971. + * the Free Software Foundation; either version 2 of the License, or
  11972. + * (at your option) any later version.
  11973. + *
  11974. + * This program is distributed in the hope that it will be useful,
  11975. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11976. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11977. + * GNU General Public License for more details.
  11978. + *
  11979. + *
  11980. + * Jan/20/2004 dgt NiosII
  11981. + *
  11982. + ---------------------------------------------------------------------*/
  11983. +
  11984. +
  11985. +#include <asm/nios.h>
  11986. +
  11987. +
  11988. +#define CLOCK_TICK_RATE nasys_clock_freq /* Underlying HZ */
  11989. +
  11990. +#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
  11991. +
  11992. +#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
  11993. + (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
  11994. + << (SHIFT_SCALE-SHIFT_HZ)) / HZ)
  11995. +
  11996. +typedef unsigned long cycles_t;
  11997. +
  11998. +static inline cycles_t get_cycles(void)
  11999. +{
  12000. + return 0;
  12001. +}
  12002. +
  12003. +#endif
  12004. --- linux/include/asm-nios2nommu/tlbflush.h
  12005. +++ linux/include/asm-nios2nommu/tlbflush.h
  12006. @@ -0,0 +1,86 @@
  12007. +#ifndef _NIOS2NOMMU_TLBFLUSH_H
  12008. +#define _NIOS2NOMMU_TLBFLUSH_H
  12009. +
  12010. +/*--------------------------------------------------------------------
  12011. + *
  12012. + * include/asm-nios2nommu/tlbflush.h
  12013. + *
  12014. + * Ported from m68knommu.
  12015. + *
  12016. + * Copyright (C) 2003 Microtronix Datacom Ltd.
  12017. + *
  12018. + * All rights reserved.
  12019. + *
  12020. + * This program is free software; you can redistribute it and/or modify
  12021. + * it under the terms of the GNU General Public License as published by
  12022. + * the Free Software Foundation; either version 2 of the License, or
  12023. + * (at your option) any later version.
  12024. + *
  12025. + * This program is distributed in the hope that it will be useful, but
  12026. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  12027. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  12028. + * NON INFRINGEMENT. See the GNU General Public License for more
  12029. + * details.
  12030. + *
  12031. + * You should have received a copy of the GNU General Public License
  12032. + * along with this program; if not, write to the Free Software
  12033. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  12034. + *
  12035. + *
  12036. + * Jan/20/2004 dgt NiosII
  12037. + *
  12038. + ---------------------------------------------------------------------*/
  12039. +
  12040. +#include <asm/setup.h>
  12041. +
  12042. +/*
  12043. + * flush all user-space atc entries.
  12044. + */
  12045. +static inline void __flush_tlb(void)
  12046. +{
  12047. + BUG();
  12048. +}
  12049. +
  12050. +static inline void __flush_tlb_one(unsigned long addr)
  12051. +{
  12052. + BUG();
  12053. +}
  12054. +
  12055. +#define flush_tlb() __flush_tlb()
  12056. +
  12057. +/*
  12058. + * flush all atc entries (both kernel and user-space entries).
  12059. + */
  12060. +static inline void flush_tlb_all(void)
  12061. +{
  12062. + BUG();
  12063. +}
  12064. +
  12065. +static inline void flush_tlb_mm(struct mm_struct *mm)
  12066. +{
  12067. + BUG();
  12068. +}
  12069. +
  12070. +static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
  12071. +{
  12072. + BUG();
  12073. +}
  12074. +
  12075. +static inline void flush_tlb_range(struct mm_struct *mm,
  12076. + unsigned long start, unsigned long end)
  12077. +{
  12078. + BUG();
  12079. +}
  12080. +
  12081. +extern inline void flush_tlb_kernel_page(unsigned long addr)
  12082. +{
  12083. + BUG();
  12084. +}
  12085. +
  12086. +extern inline void flush_tlb_pgtables(struct mm_struct *mm,
  12087. + unsigned long start, unsigned long end)
  12088. +{
  12089. + BUG();
  12090. +}
  12091. +
  12092. +#endif /* _NIOS2NOMMU_TLBFLUSH_H */
  12093. --- linux/include/asm-nios2nommu/tlb.h
  12094. +++ linux/include/asm-nios2nommu/tlb.h
  12095. @@ -0,0 +1,35 @@
  12096. +#ifndef __NIOS_TLB_H__
  12097. +#define __NIOS_TLB_H__
  12098. +
  12099. +/*--------------------------------------------------------------------
  12100. + *
  12101. + * include/asm-nios2nommu/tlb.h
  12102. + *
  12103. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  12104. + *
  12105. + * Copyright (C) 2003 Microtronix Datacom Ltd
  12106. + * Copyright (C) 2002 NEC Corporation
  12107. + * Copyright (C) 2002 Miles Bader <miles@gnu.org>
  12108. + *
  12109. + * This program is free software; you can redistribute it and/or modify
  12110. + * it under the terms of the GNU General Public License as published by
  12111. + * the Free Software Foundation; either version 2 of the License, or
  12112. + * (at your option) any later version.
  12113. + *
  12114. + * This program is distributed in the hope that it will be useful,
  12115. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12116. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12117. + * GNU General Public License for more details.
  12118. + *
  12119. + *
  12120. + * Written by Miles Bader <miles@gnu.org>
  12121. + * Jan/20/2004 dgt NiosII
  12122. + *
  12123. + ---------------------------------------------------------------------*/
  12124. +
  12125. +#define tlb_flush(tlb) ((void)0)
  12126. +
  12127. +#include <asm-generic/tlb.h>
  12128. +
  12129. +#endif /* __NIOS_TLB_H__ */
  12130. +
  12131. --- linux/include/asm-nios2nommu/topology.h
  12132. +++ linux/include/asm-nios2nommu/topology.h
  12133. @@ -0,0 +1,30 @@
  12134. +#ifndef _ASM_NIOS2NOMMU_TOPOLOGY_H
  12135. +#define _ASM_NIOS2NOMMU_TOPOLOGY_H
  12136. +
  12137. +/*--------------------------------------------------------------------
  12138. + *
  12139. + * include/asm-nios2nommu/topology.h
  12140. + *
  12141. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  12142. + *
  12143. + * Copyright (C) 2004 Microtronix Datacom Ltd
  12144. + *
  12145. + * This program is free software; you can redistribute it and/or modify
  12146. + * it under the terms of the GNU General Public License as published by
  12147. + * the Free Software Foundation; either version 2 of the License, or
  12148. + * (at your option) any later version.
  12149. + *
  12150. + * This program is distributed in the hope that it will be useful,
  12151. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12152. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12153. + * GNU General Public License for more details.
  12154. + *
  12155. + *
  12156. + * Jan/20/2004 dgt NiosII
  12157. + *
  12158. + ---------------------------------------------------------------------*/
  12159. +
  12160. +
  12161. +#include <asm-generic/topology.h>
  12162. +
  12163. +#endif /* _ASM_NIOS2NOMMU_TOPOLOGY_H */
  12164. --- linux/include/asm-nios2nommu/traps.h
  12165. +++ linux/include/asm-nios2nommu/traps.h
  12166. @@ -0,0 +1,27 @@
  12167. +/*
  12168. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  12169. + *
  12170. + * All rights reserved.
  12171. + *
  12172. + * This program is free software; you can redistribute it and/or modify
  12173. + * it under the terms of the GNU General Public License as published by
  12174. + * the Free Software Foundation; either version 2 of the License, or
  12175. + * (at your option) any later version.
  12176. + *
  12177. + * This program is distributed in the hope that it will be useful, but
  12178. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  12179. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  12180. + * NON INFRINGEMENT. See the GNU General Public License for more
  12181. + * details.
  12182. + *
  12183. + * You should have received a copy of the GNU General Public License
  12184. + * along with this program; if not, write to the Free Software
  12185. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  12186. + *
  12187. + */
  12188. +#ifndef _NIOS2_TRAPS_H
  12189. +#define _NIOS2_TRAPS_H
  12190. +
  12191. +#define TRAP_ID_SYSCALL 0
  12192. +#define TRAP_ID_APPDEBUG 1
  12193. +#endif /* !(_NIOS2_TRAPS_H) */
  12194. --- linux/include/asm-nios2nommu/types.h
  12195. +++ linux/include/asm-nios2nommu/types.h
  12196. @@ -0,0 +1,93 @@
  12197. +#ifndef _NIOS_TYPES_H
  12198. +#define _NIOS_TYPES_H
  12199. +
  12200. +/*--------------------------------------------------------------------
  12201. + *
  12202. + * include/asm-nios2nommu/types.h
  12203. + *
  12204. + * Derived from m68knommu
  12205. + *
  12206. + * Copyright (C) 2004 Microtronix Datacom Ltd
  12207. + *
  12208. + * This program is free software; you can redistribute it and/or modify
  12209. + * it under the terms of the GNU General Public License as published by
  12210. + * the Free Software Foundation; either version 2 of the License, or
  12211. + * (at your option) any later version.
  12212. + *
  12213. + * This program is distributed in the hope that it will be useful,
  12214. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12215. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12216. + * GNU General Public License for more details.
  12217. + *
  12218. + *
  12219. + * Jan/20/2004 dgt NiosII
  12220. + *
  12221. + ---------------------------------------------------------------------*/
  12222. +
  12223. +
  12224. +/*
  12225. + * This file is never included by application software unless
  12226. + * explicitly requested (e.g., via linux/types.h) in which case the
  12227. + * application is Linux specific so (user-) name space pollution is
  12228. + * not a major issue. However, for interoperability, libraries still
  12229. + * need to be careful to avoid a name clashes.
  12230. + */
  12231. +
  12232. +#ifndef __ASSEMBLY__
  12233. +
  12234. +typedef unsigned short umode_t;
  12235. +
  12236. +/*
  12237. + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  12238. + * header files exported to user space
  12239. + */
  12240. +
  12241. +typedef __signed__ char __s8;
  12242. +typedef unsigned char __u8;
  12243. +
  12244. +typedef __signed__ short __s16;
  12245. +typedef unsigned short __u16;
  12246. +
  12247. +typedef __signed__ int __s32;
  12248. +typedef unsigned int __u32;
  12249. +
  12250. +#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
  12251. +typedef __signed__ long long __s64;
  12252. +typedef unsigned long long __u64;
  12253. +#endif
  12254. +
  12255. +#endif /* __ASSEMBLY__ */
  12256. +
  12257. +/*
  12258. + * These aren't exported outside the kernel to avoid name space clashes
  12259. + */
  12260. +#ifdef __KERNEL__
  12261. +
  12262. +#define BITS_PER_LONG 32
  12263. +
  12264. +#ifndef __ASSEMBLY__
  12265. +
  12266. +typedef signed char s8;
  12267. +typedef unsigned char u8;
  12268. +
  12269. +typedef signed short s16;
  12270. +typedef unsigned short u16;
  12271. +
  12272. +typedef signed int s32;
  12273. +typedef unsigned int u32;
  12274. +
  12275. +typedef signed long long s64;
  12276. +typedef unsigned long long u64;
  12277. +
  12278. +/* DMA addresses are always 32-bits wide */
  12279. +
  12280. +typedef u32 dma_addr_t;
  12281. +typedef u32 dma64_addr_t;
  12282. +
  12283. +typedef unsigned short kmem_bufctl_t;
  12284. +
  12285. +#endif /* __ASSEMBLY__ */
  12286. +
  12287. +#endif /* __KERNEL__ */
  12288. +
  12289. +#endif /* _NIOS_TYPES_H */
  12290. --- linux/include/asm-nios2nommu/uaccess.h
  12291. +++ linux/include/asm-nios2nommu/uaccess.h
  12292. @@ -0,0 +1,183 @@
  12293. +#ifndef __NIOS2NOMMU_UACCESS_H
  12294. +#define __NIOS2NOMMU_UACCESS_H
  12295. +
  12296. +/*--------------------------------------------------------------------
  12297. + *
  12298. + * asm-nios2nommu/uaccess.h
  12299. + *
  12300. + * User space memory access functions
  12301. + *
  12302. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  12303. + *
  12304. + * Copyright (C) 2004 Microtronix Datacom Ltd
  12305. + *
  12306. + * This program is free software; you can redistribute it and/or modify
  12307. + * it under the terms of the GNU General Public License as published by
  12308. + * the Free Software Foundation; either version 2 of the License, or
  12309. + * (at your option) any later version.
  12310. + *
  12311. + * This program is distributed in the hope that it will be useful,
  12312. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12313. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12314. + * GNU General Public License for more details.
  12315. + *
  12316. + *
  12317. + * Ported from asm-m68knommu/uaccess.h --wentao
  12318. + * Jan/20/2004 dgt NiosII
  12319. + *
  12320. + ---------------------------------------------------------------------*/
  12321. +
  12322. +
  12323. +#include <linux/sched.h>
  12324. +#include <linux/mm.h>
  12325. +#include <asm/segment.h>
  12326. +#include <asm/nios.h>
  12327. +
  12328. +#define VERIFY_READ 0
  12329. +#define VERIFY_WRITE 1
  12330. +
  12331. +#define access_ok(type,addr,size) _access_ok((unsigned long)(addr),(size))
  12332. +
  12333. +static inline int _access_ok(unsigned long addr, unsigned long size)
  12334. +{
  12335. + return (((unsigned long)addr < (unsigned long)nasys_program_mem_end) &&
  12336. + (((unsigned long)addr >= (unsigned long)nasys_program_mem)));
  12337. +}
  12338. +
  12339. +extern inline int verify_area(int type, const void * addr, unsigned long size)
  12340. +{
  12341. + return access_ok(type,addr,size)?0:-EFAULT;
  12342. +}
  12343. +
  12344. +/*
  12345. + * The exception table consists of pairs of addresses: the first is the
  12346. + * address of an instruction that is allowed to fault, and the second is
  12347. + * the address at which the program should continue. No registers are
  12348. + * modified, so it is entirely up to the continuation code to figure out
  12349. + * what to do.
  12350. + *
  12351. + * All the routines below use bits of fixup code that are out of line
  12352. + * with the main instruction path. This means when everything is well,
  12353. + * we don't even have to jump over them. Further, they do not intrude
  12354. + * on our cache or tlb entries.
  12355. + */
  12356. +
  12357. +#define ARCH_HAS_SEARCH_EXTABLE
  12358. +//;dgt2;tmp;
  12359. +
  12360. +struct exception_table_entry
  12361. +{
  12362. + unsigned long insn, fixup;
  12363. +};
  12364. +
  12365. +/* Returns 0 if exception not found and fixup otherwise. */
  12366. +extern unsigned long search_exception_table(unsigned long);
  12367. +
  12368. +
  12369. +/*
  12370. + * These are the main single-value transfer routines. They automatically
  12371. + * use the right size if we just have the right pointer type.
  12372. + */
  12373. +
  12374. +#define put_user(x, ptr) \
  12375. +({ \
  12376. + int __pu_err = 0; \
  12377. + typeof(*(ptr)) __pu_val = (x); \
  12378. + switch (sizeof (*(ptr))) { \
  12379. + case 1: \
  12380. + case 2: \
  12381. + case 4: \
  12382. + case 8: \
  12383. + memcpy(ptr, &__pu_val, sizeof (*(ptr))); \
  12384. + break; \
  12385. + default: \
  12386. + __pu_err = __put_user_bad(); \
  12387. + break; \
  12388. + } \
  12389. + __pu_err; \
  12390. +})
  12391. +#define __put_user(x, ptr) put_user(x, ptr)
  12392. +
  12393. +extern int __put_user_bad(void);
  12394. +
  12395. +/*
  12396. + * Tell gcc we read from memory instead of writing: this is because
  12397. + * we do not write to any memory gcc knows about, so there are no
  12398. + * aliasing issues.
  12399. + */
  12400. +
  12401. +#define __ptr(x) ((unsigned long *)(x))
  12402. +
  12403. +#define get_user(x, ptr) \
  12404. +({ \
  12405. + int __gu_err = 0; \
  12406. + typeof(*(ptr)) __gu_val = 0; \
  12407. + switch (sizeof(*(ptr))) { \
  12408. + case 1: \
  12409. + case 2: \
  12410. + case 4: \
  12411. + case 8: \
  12412. + memcpy(&__gu_val, ptr, sizeof (*(ptr))); \
  12413. + break; \
  12414. + default: \
  12415. + __gu_val = 0; \
  12416. + __gu_err = __get_user_bad(); \
  12417. + break; \
  12418. + } \
  12419. + (x) = __gu_val; \
  12420. + __gu_err; \
  12421. +})
  12422. +#define __get_user(x, ptr) get_user(x, ptr)
  12423. +
  12424. +extern int __get_user_bad(void);
  12425. +
  12426. +#define copy_from_user(to, from, n) (memcpy(to, from, n), 0)
  12427. +#define copy_to_user(to, from, n) (memcpy(to, from, n), 0)
  12428. +
  12429. +#define __copy_from_user(to, from, n) copy_from_user(to, from, n)
  12430. +#define __copy_to_user(to, from, n) copy_to_user(to, from, n)
  12431. +#define __copy_to_user_inatomic __copy_to_user
  12432. +#define __copy_from_user_inatomic __copy_from_user
  12433. +
  12434. +#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; })
  12435. +
  12436. +#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; })
  12437. +
  12438. +/*
  12439. + * Copy a null terminated string from userspace.
  12440. + */
  12441. +
  12442. +static inline long
  12443. +strncpy_from_user(char *dst, const char *src, long count)
  12444. +{
  12445. + char *tmp;
  12446. + strncpy(dst, src, count);
  12447. + for (tmp = dst; *tmp && count > 0; tmp++, count--)
  12448. + ;
  12449. + return(tmp - dst); /* DAVIDM should we count a NUL ? check getname */
  12450. +}
  12451. +
  12452. +/*
  12453. + * Return the size of a string (including the ending 0)
  12454. + *
  12455. + * Return 0 on exception, a value greater than N if too long
  12456. + */
  12457. +static inline long strnlen_user(const char *src, long n)
  12458. +{
  12459. + return(strlen(src) + 1); /* DAVIDM make safer */
  12460. +}
  12461. +
  12462. +#define strlen_user(str) strnlen_user(str, 32767)
  12463. +
  12464. +/*
  12465. + * Zero Userspace
  12466. + */
  12467. +
  12468. +static inline unsigned long
  12469. +clear_user(void *to, unsigned long n)
  12470. +{
  12471. + memset(to, 0, n);
  12472. + return(0);
  12473. +}
  12474. +
  12475. +#endif /* _NIOS2NOMMU_UACCESS_H */
  12476. --- linux/include/asm-nios2nommu/uart_struct.h
  12477. +++ linux/include/asm-nios2nommu/uart_struct.h
  12478. @@ -0,0 +1,83 @@
  12479. +
  12480. +// UART Registers
  12481. +typedef volatile struct
  12482. + {
  12483. + int np_uartrxdata; // Read-only, 8-bit
  12484. + int np_uarttxdata; // Write-only, 8-bit
  12485. + int np_uartstatus; // Read-only, 8-bit
  12486. + int np_uartcontrol; // Read/Write, 9-bit
  12487. + int np_uartdivisor; // Read/Write, 16-bit, optional
  12488. + int np_uartendofpacket; // Read/Write, end-of-packet character
  12489. + } np_uart;
  12490. +
  12491. +// UART Status Register Bits
  12492. +enum
  12493. + {
  12494. + np_uartstatus_eop_bit = 12,
  12495. + np_uartstatus_cts_bit = 11,
  12496. + np_uartstatus_dcts_bit = 10,
  12497. + np_uartstatus_e_bit = 8,
  12498. + np_uartstatus_rrdy_bit = 7,
  12499. + np_uartstatus_trdy_bit = 6,
  12500. + np_uartstatus_tmt_bit = 5,
  12501. + np_uartstatus_toe_bit = 4,
  12502. + np_uartstatus_roe_bit = 3,
  12503. + np_uartstatus_brk_bit = 2,
  12504. + np_uartstatus_fe_bit = 1,
  12505. + np_uartstatus_pe_bit = 0,
  12506. +
  12507. + np_uartstatus_eop_mask = (1<<12),
  12508. + np_uartstatus_cts_mask = (1<<11),
  12509. + np_uartstatus_dcts_mask = (1<<10),
  12510. + np_uartstatus_e_mask = (1<<8),
  12511. + np_uartstatus_rrdy_mask = (1<<7),
  12512. + np_uartstatus_trdy_mask = (1<<6),
  12513. + np_uartstatus_tmt_mask = (1<<5),
  12514. + np_uartstatus_toe_mask = (1<<4),
  12515. + np_uartstatus_roe_mask = (1<<3),
  12516. + np_uartstatus_brk_mask = (1<<2),
  12517. + np_uartstatus_fe_mask = (1<<1),
  12518. + np_uartstatus_pe_mask = (1<<0)
  12519. + };
  12520. +
  12521. +// UART Control Register Bits
  12522. +enum
  12523. + {
  12524. + np_uartcontrol_ieop_bit = 12,
  12525. + np_uartcontrol_rts_bit = 11,
  12526. + np_uartcontrol_idcts_bit = 10,
  12527. + np_uartcontrol_tbrk_bit = 9,
  12528. + np_uartcontrol_ie_bit = 8,
  12529. + np_uartcontrol_irrdy_bit = 7,
  12530. + np_uartcontrol_itrdy_bit = 6,
  12531. + np_uartcontrol_itmt_bit = 5,
  12532. + np_uartcontrol_itoe_bit = 4,
  12533. + np_uartcontrol_iroe_bit = 3,
  12534. + np_uartcontrol_ibrk_bit = 2,
  12535. + np_uartcontrol_ife_bit = 1,
  12536. + np_uartcontrol_ipe_bit = 0,
  12537. +
  12538. + np_uartcontrol_ieop_mask = (1<<12),
  12539. + np_uartcontrol_rts_mask = (1<<11),
  12540. + np_uartcontrol_idcts_mask = (1<<10),
  12541. + np_uartcontrol_tbrk_mask = (1<<9),
  12542. + np_uartcontrol_ie_mask = (1<<8),
  12543. + np_uartcontrol_irrdy_mask = (1<<7),
  12544. + np_uartcontrol_itrdy_mask = (1<<6),
  12545. + np_uartcontrol_itmt_mask = (1<<5),
  12546. + np_uartcontrol_itoe_mask = (1<<4),
  12547. + np_uartcontrol_iroe_mask = (1<<3),
  12548. + np_uartcontrol_ibrk_mask = (1<<2),
  12549. + np_uartcontrol_ife_mask = (1<<1),
  12550. + np_uartcontrol_ipe_mask = (1<<0)
  12551. + };
  12552. +
  12553. +// UART Routines
  12554. +int nr_uart_rxchar(np_uart *uartBase); // 0 for default UART
  12555. +void nr_uart_txcr(void);
  12556. +void nr_uart_txchar(int c,np_uart *uartBase); // 0 for default UART
  12557. +void nr_uart_txhex(int x); // 16 or 32 bits
  12558. +void nr_uart_txhex16(short x);
  12559. +void nr_uart_txhex32(long x);
  12560. +void nr_uart_txstring(char *s);
  12561. +
  12562. --- linux/include/asm-nios2nommu/ucontext.h
  12563. +++ linux/include/asm-nios2nommu/ucontext.h
  12564. @@ -0,0 +1,63 @@
  12565. +#ifndef _NIOSKNOMMU_UCONTEXT_H
  12566. +#define _NIOSKNOMMU_UCONTEXT_H
  12567. +
  12568. +/*--------------------------------------------------------------------
  12569. + *
  12570. + * include/asm-nios2nommu/ucontext.h
  12571. + *
  12572. + * Derived from M68knommu
  12573. + *
  12574. + * Copyright (C) 2004 Microtronix Datacom Ltd
  12575. + *
  12576. + * This program is free software; you can redistribute it and/or modify
  12577. + * it under the terms of the GNU General Public License as published by
  12578. + * the Free Software Foundation; either version 2 of the License, or
  12579. + * (at your option) any later version.
  12580. + *
  12581. + * This program is distributed in the hope that it will be useful,
  12582. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12583. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12584. + * GNU General Public License for more details.
  12585. + *
  12586. + *
  12587. + * Jan/20/2004 dgt NiosII
  12588. + *
  12589. + ---------------------------------------------------------------------*/
  12590. +
  12591. +
  12592. +typedef int greg_t;
  12593. +#define NGREG 32
  12594. +typedef greg_t gregset_t[NGREG];
  12595. +
  12596. +#ifdef CONFIG_FPU
  12597. +typedef struct fpregset {
  12598. + int f_pcr;
  12599. + int f_psr;
  12600. + int f_fpiaddr;
  12601. + int f_fpregs[8][3];
  12602. +} fpregset_t;
  12603. +#endif
  12604. +
  12605. +struct mcontext {
  12606. + int version;
  12607. + int status_extension;
  12608. + gregset_t gregs;
  12609. +#ifdef CONFIG_FPU
  12610. + fpregset_t fpregs;
  12611. +#endif
  12612. +};
  12613. +
  12614. +#define MCONTEXT_VERSION 2
  12615. +
  12616. +struct ucontext {
  12617. + unsigned long uc_flags;
  12618. + struct ucontext *uc_link;
  12619. + stack_t uc_stack;
  12620. + struct mcontext uc_mcontext;
  12621. +#ifdef CONFIG_FPU
  12622. + unsigned long uc_filler[80];
  12623. +#endif
  12624. + sigset_t uc_sigmask; /* mask last for extensibility */
  12625. +};
  12626. +
  12627. +#endif
  12628. --- linux/include/asm-nios2nommu/unaligned.h
  12629. +++ linux/include/asm-nios2nommu/unaligned.h
  12630. @@ -0,0 +1,43 @@
  12631. +#ifndef __NIOS_UNALIGNED_H
  12632. +#define __NIOS_UNALIGNED_H
  12633. +
  12634. +/*--------------------------------------------------------------------
  12635. + *
  12636. + * include/asm-nios2nommu/unaligned.h
  12637. + *
  12638. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  12639. + *
  12640. + * Copyright (C) 2004 Microtronix Datacom Ltd
  12641. + *
  12642. + * This program is free software; you can redistribute it and/or modify
  12643. + * it under the terms of the GNU General Public License as published by
  12644. + * the Free Software Foundation; either version 2 of the License, or
  12645. + * (at your option) any later version.
  12646. + *
  12647. + * This program is distributed in the hope that it will be useful,
  12648. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12649. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12650. + * GNU General Public License for more details.
  12651. + *
  12652. + *
  12653. + * Jan/20/2004 dgt NiosII
  12654. + *
  12655. + ---------------------------------------------------------------------*/
  12656. +
  12657. +
  12658. +/*
  12659. + * The nios cannot do unaligned accesses itself.
  12660. + */
  12661. +
  12662. +#define get_unaligned(ptr) ({ \
  12663. + typeof((*(ptr))) x; \
  12664. + memcpy(&x, (void*)ptr, sizeof(*(ptr))); \
  12665. + x; \
  12666. +})
  12667. +
  12668. +#define put_unaligned(val, ptr) ({ \
  12669. + typeof((*(ptr))) x = val; \
  12670. + memcpy((void*)ptr, &x, sizeof(*(ptr))); \
  12671. +})
  12672. +
  12673. +#endif /* __NIOS_UNALIGNED_H */
  12674. --- linux/include/asm-nios2nommu/unistd.h
  12675. +++ linux/include/asm-nios2nommu/unistd.h
  12676. @@ -0,0 +1,686 @@
  12677. +#ifndef _ASM_NIOS_UNISTD_H_
  12678. +#define _ASM_NIOS_UNISTD_H_
  12679. +
  12680. +/*--------------------------------------------------------------------
  12681. + *
  12682. + * include/asm-nios2nommu/unistd.h
  12683. + *
  12684. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  12685. + *
  12686. + * Copyright (C) 2004 Microtronix Datacom Ltd
  12687. + *
  12688. + * This program is free software; you can redistribute it and/or modify
  12689. + * it under the terms of the GNU General Public License as published by
  12690. + * the Free Software Foundation; either version 2 of the License, or
  12691. + * (at your option) any later version.
  12692. + *
  12693. + * This program is distributed in the hope that it will be useful,
  12694. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12695. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12696. + * GNU General Public License for more details.
  12697. + *
  12698. + *
  12699. + * //vic - kernel_thread moved to process.c
  12700. + * Jan/20/2004 dgt NiosII
  12701. + *
  12702. + ---------------------------------------------------------------------*/
  12703. +
  12704. +
  12705. +#include <asm/traps.h>
  12706. +
  12707. +/* TRAP isr expects the trap# (syscall=#TRAP_ID_SYSCALL) in r2,
  12708. + * the syscall # in r3, and arguments in r4, r5, ...
  12709. + * Return argument expected in r2.
  12710. + */
  12711. +
  12712. +#define __NR_restart_syscall 0
  12713. +#define __NR_exit 1
  12714. +#define __NR_fork 2
  12715. +#define __NR_read 3
  12716. +#define __NR_write 4
  12717. +#define __NR_open 5
  12718. +#define __NR_close 6
  12719. +#define __NR_waitpid 7
  12720. +#define __NR_creat 8
  12721. +#define __NR_link 9
  12722. +#define __NR_unlink 10
  12723. +#define __NR_execve 11
  12724. +#define __NR_chdir 12
  12725. +#define __NR_time 13
  12726. +#define __NR_mknod 14
  12727. +#define __NR_chmod 15
  12728. +#define __NR_chown 16
  12729. +#define __NR_break 17
  12730. +#define __NR_oldstat 18
  12731. +#define __NR_lseek 19
  12732. +#define __NR_getpid 20
  12733. +#define __NR_mount 21
  12734. +#define __NR_umount 22
  12735. +#define __NR_setuid 23
  12736. +#define __NR_getuid 24
  12737. +#define __NR_stime 25
  12738. +#define __NR_ptrace 26
  12739. +#define __NR_alarm 27
  12740. +#define __NR_oldfstat 28
  12741. +#define __NR_pause 29
  12742. +#define __NR_utime 30
  12743. +#define __NR_stty 31
  12744. +#define __NR_gtty 32
  12745. +#define __NR_access 33
  12746. +#define __NR_nice 34
  12747. +#define __NR_ftime 35
  12748. +#define __NR_sync 36
  12749. +#define __NR_kill 37
  12750. +#define __NR_rename 38
  12751. +#define __NR_mkdir 39
  12752. +#define __NR_rmdir 40
  12753. +#define __NR_dup 41
  12754. +#define __NR_pipe 42
  12755. +#define __NR_times 43
  12756. +#define __NR_prof 44
  12757. +#define __NR_brk 45
  12758. +#define __NR_setgid 46
  12759. +#define __NR_getgid 47
  12760. +#define __NR_signal 48
  12761. +#define __NR_geteuid 49
  12762. +#define __NR_getegid 50
  12763. +#define __NR_acct 51
  12764. +#define __NR_umount2 52 //vic #define __NR_phys 52
  12765. +#define __NR_lock 53
  12766. +#define __NR_ioctl 54
  12767. +#define __NR_fcntl 55
  12768. +#define __NR_mpx 56
  12769. +#define __NR_setpgid 57
  12770. +#define __NR_ulimit 58
  12771. +#define __NR_oldolduname 59
  12772. +#define __NR_umask 60
  12773. +#define __NR_chroot 61
  12774. +#define __NR_ustat 62
  12775. +#define __NR_dup2 63
  12776. +#define __NR_getppid 64
  12777. +#define __NR_getpgrp 65
  12778. +#define __NR_setsid 66
  12779. +#define __NR_sigaction 67
  12780. +#define __NR_sgetmask 68
  12781. +#define __NR_ssetmask 69
  12782. +#define __NR_setreuid 70
  12783. +#define __NR_setregid 71
  12784. +#define __NR_sigsuspend 72
  12785. +#define __NR_sigpending 73
  12786. +#define __NR_sethostname 74
  12787. +#define __NR_setrlimit 75
  12788. +#define __NR_getrlimit 76
  12789. +#define __NR_getrusage 77
  12790. +#define __NR_gettimeofday 78
  12791. +#define __NR_settimeofday 79
  12792. +#define __NR_getgroups 80
  12793. +#define __NR_setgroups 81
  12794. +#define __NR_select 82
  12795. +#define __NR_symlink 83
  12796. +#define __NR_oldlstat 84
  12797. +#define __NR_readlink 85
  12798. +#define __NR_uselib 86
  12799. +#define __NR_swapon 87
  12800. +#define __NR_reboot 88
  12801. +#define __NR_readdir 89
  12802. +#define __NR_mmap 90
  12803. +#define __NR_munmap 91
  12804. +#define __NR_truncate 92
  12805. +#define __NR_ftruncate 93
  12806. +#define __NR_fchmod 94
  12807. +#define __NR_fchown 95
  12808. +#define __NR_getpriority 96
  12809. +#define __NR_setpriority 97
  12810. +#define __NR_profil 98
  12811. +#define __NR_statfs 99
  12812. +#define __NR_fstatfs 100
  12813. +#define __NR_ioperm 101
  12814. +#define __NR_socketcall 102
  12815. +#define __NR_syslog 103
  12816. +#define __NR_setitimer 104
  12817. +#define __NR_getitimer 105
  12818. +#define __NR_stat 106
  12819. +#define __NR_lstat 107
  12820. +#define __NR_fstat 108
  12821. +#define __NR_olduname 109
  12822. +#define __NR_iopl /* 110 */ not supported
  12823. +#define __NR_vhangup 111
  12824. +#define __NR_idle /* 112 */ Obsolete
  12825. +#define __NR_vm86 /* 113 */ not supported
  12826. +#define __NR_wait4 114
  12827. +#define __NR_swapoff 115
  12828. +#define __NR_sysinfo 116
  12829. +#define __NR_ipc 117
  12830. +#define __NR_fsync 118
  12831. +#define __NR_sigreturn 119
  12832. +#define __NR_clone 120
  12833. +#define __NR_setdomainname 121
  12834. +#define __NR_uname 122
  12835. +#define __NR_cacheflush 123
  12836. +#define __NR_adjtimex 124
  12837. +#define __NR_mprotect 125
  12838. +#define __NR_sigprocmask 126
  12839. +#define __NR_create_module 127
  12840. +#define __NR_init_module 128
  12841. +#define __NR_delete_module 129
  12842. +#define __NR_get_kernel_syms 130
  12843. +#define __NR_quotactl 131
  12844. +#define __NR_getpgid 132
  12845. +#define __NR_fchdir 133
  12846. +#define __NR_bdflush 134
  12847. +#define __NR_sysfs 135
  12848. +#define __NR_personality 136
  12849. +#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
  12850. +#define __NR_setfsuid 138
  12851. +#define __NR_setfsgid 139
  12852. +#define __NR__llseek 140
  12853. +#define __NR_getdents 141
  12854. +#define __NR__newselect 142
  12855. +#define __NR_flock 143
  12856. +#define __NR_msync 144
  12857. +#define __NR_readv 145
  12858. +#define __NR_writev 146
  12859. +#define __NR_getsid 147
  12860. +#define __NR_fdatasync 148
  12861. +#define __NR__sysctl 149
  12862. +#define __NR_mlock 150
  12863. +#define __NR_munlock 151
  12864. +#define __NR_mlockall 152
  12865. +#define __NR_munlockall 153
  12866. +#define __NR_sched_setparam 154
  12867. +#define __NR_sched_getparam 155
  12868. +#define __NR_sched_setscheduler 156
  12869. +#define __NR_sched_getscheduler 157
  12870. +#define __NR_sched_yield 158
  12871. +#define __NR_sched_get_priority_max 159
  12872. +#define __NR_sched_get_priority_min 160
  12873. +#define __NR_sched_rr_get_interval 161
  12874. +#define __NR_nanosleep 162
  12875. +#define __NR_mremap 163
  12876. +#define __NR_setresuid 164
  12877. +#define __NR_getresuid 165
  12878. +#define __NR_getpagesize 166
  12879. +#define __NR_query_module 167
  12880. +#define __NR_poll 168
  12881. +#define __NR_nfsservctl 169
  12882. +#define __NR_setresgid 170
  12883. +#define __NR_getresgid 171
  12884. +#define __NR_prctl 172
  12885. +#define __NR_rt_sigreturn 173
  12886. +#define __NR_rt_sigaction 174
  12887. +#define __NR_rt_sigprocmask 175
  12888. +#define __NR_rt_sigpending 176
  12889. +#define __NR_rt_sigtimedwait 177
  12890. +#define __NR_rt_sigqueueinfo 178
  12891. +#define __NR_rt_sigsuspend 179
  12892. +#define __NR_pread 180
  12893. +#define __NR_pwrite 181
  12894. +#define __NR_lchown 182
  12895. +#define __NR_getcwd 183
  12896. +#define __NR_capget 184
  12897. +#define __NR_capset 185
  12898. +#define __NR_sigaltstack 186
  12899. +#define __NR_sendfile 187
  12900. +#define __NR_getpmsg 188 /* some people actually want streams */
  12901. +#define __NR_putpmsg 189 /* some people actually want streams */
  12902. +#define __NR_vfork 190
  12903. +#define __NR_ugetrlimit 191
  12904. +#define __NR_mmap2 192
  12905. +#define __NR_truncate64 193
  12906. +#define __NR_ftruncate64 194
  12907. +#define __NR_stat64 195
  12908. +#define __NR_lstat64 196
  12909. +#define __NR_fstat64 197
  12910. +#define __NR_chown32 198
  12911. +#define __NR_getuid32 199
  12912. +#define __NR_getgid32 200
  12913. +#define __NR_geteuid32 201
  12914. +#define __NR_getegid32 202
  12915. +#define __NR_setreuid32 203
  12916. +#define __NR_setregid32 204
  12917. +#define __NR_getgroups32 205
  12918. +#define __NR_setgroups32 206
  12919. +#define __NR_fchown32 207
  12920. +#define __NR_setresuid32 208
  12921. +#define __NR_getresuid32 209
  12922. +#define __NR_setresgid32 210
  12923. +#define __NR_getresgid32 211
  12924. +#define __NR_lchown32 212
  12925. +#define __NR_setuid32 213
  12926. +#define __NR_setgid32 214
  12927. +#define __NR_setfsuid32 215
  12928. +#define __NR_setfsgid32 216
  12929. +#define __NR_pivot_root 217
  12930. +/* 218 unused */
  12931. +/* 219 unused */
  12932. +#define __NR_getdents64 220
  12933. +#define __NR_gettid 221
  12934. +#define __NR_tkill 222
  12935. +#define __NR_setxattr 223
  12936. +#define __NR_lsetxattr 224
  12937. +#define __NR_fsetxattr 225
  12938. +#define __NR_getxattr 226
  12939. +#define __NR_lgetxattr 227
  12940. +#define __NR_fgetxattr 228
  12941. +#define __NR_listxattr 229
  12942. +#define __NR_llistxattr 230
  12943. +#define __NR_flistxattr 231
  12944. +#define __NR_removexattr 232
  12945. +#define __NR_lremovexattr 233
  12946. +#define __NR_fremovexattr 234
  12947. +#define __NR_futex 235
  12948. +#define __NR_sendfile64 236
  12949. +#define __NR_mincore 237
  12950. +#define __NR_madvise 238
  12951. +#define __NR_fcntl64 239
  12952. +#define __NR_readahead 240
  12953. +#define __NR_io_setup 241
  12954. +#define __NR_io_destroy 242
  12955. +#define __NR_io_getevents 243
  12956. +#define __NR_io_submit 244
  12957. +#define __NR_io_cancel 245
  12958. +#define __NR_fadvise64 246
  12959. +#define __NR_exit_group 247
  12960. +#define __NR_lookup_dcookie 248
  12961. +#define __NR_epoll_create 249
  12962. +#define __NR_epoll_ctl 250
  12963. +#define __NR_epoll_wait 251
  12964. +#define __NR_remap_file_pages 252
  12965. +#define __NR_set_tid_address 253
  12966. +#define __NR_timer_create 254
  12967. +#define __NR_timer_settime 255
  12968. +#define __NR_timer_gettime 256
  12969. +#define __NR_timer_getoverrun 257
  12970. +#define __NR_timer_delete 258
  12971. +#define __NR_clock_settime 259
  12972. +#define __NR_clock_gettime 260
  12973. +#define __NR_clock_getres 261
  12974. +#define __NR_clock_nanosleep 262
  12975. +#define __NR_statfs64 263
  12976. +#define __NR_fstatfs64 264
  12977. +#define __NR_tgkill 265
  12978. +#define __NR_utimes 266
  12979. +#define __NR_fadvise64_64 267
  12980. +#define __NR_mbind 268
  12981. +#define __NR_get_mempolicy 269
  12982. +#define __NR_set_mempolicy 270
  12983. +#define __NR_mq_open 271
  12984. +#define __NR_mq_unlink 272
  12985. +#define __NR_mq_timedsend 273
  12986. +#define __NR_mq_timedreceive 274
  12987. +#define __NR_mq_notify 275
  12988. +#define __NR_mq_getsetattr 276
  12989. +#define __NR_waitid 277
  12990. +#define __NR_sys_setaltroot 278
  12991. +#define __NR_add_key 279
  12992. +#define __NR_request_key 280
  12993. +#define __NR_keyctl 281
  12994. +
  12995. +#define NR_syscalls 282
  12996. +
  12997. +/* user-visible error numbers are in the range -1 - -122: see
  12998. + <asm-nios2nommu/errno.h> */
  12999. +
  13000. +#define __syscall_return(type, res) \
  13001. +do { \
  13002. + if ((unsigned long)(res) >= (unsigned long)(-125)) { \
  13003. + \
  13004. + /* avoid using res which is declared to be in \
  13005. + register r2; errno might expand to a function \
  13006. + call and clobber it. */ \
  13007. + \
  13008. + int __err = -(res); \
  13009. + errno = __err; \
  13010. + res = -1; \
  13011. + } \
  13012. + return (type) (res); \
  13013. +} while (0)
  13014. +
  13015. +#define _syscall0(type,name) \
  13016. +type name(void) \
  13017. +{ \
  13018. + long __res; \
  13019. + \
  13020. + __asm__ __volatile__ ( \
  13021. + \
  13022. + " \n\t" \
  13023. + \
  13024. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  13025. + " movi r3, %1\n\t" /* __NR_##name */ \
  13026. + \
  13027. + " trap\n\t" \
  13028. + " mov %0, r2\n\t" /* syscall rtn */ \
  13029. + \
  13030. + " \n\t" \
  13031. + \
  13032. + : "=r" (__res) /* %0 */ \
  13033. + \
  13034. + : "i" (__NR_##name) /* %1 */ \
  13035. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  13036. + \
  13037. + : "r2" /* Clobbered */ \
  13038. + , "r3" /* Clobbered */ \
  13039. + ); \
  13040. + \
  13041. +__syscall_return(type,__res); \
  13042. +}
  13043. +
  13044. +//;dgt2;tmp;can we RELY on syscall1 arg a
  13045. +//;dgt2;tmp; already being in r4 ?
  13046. +#define _syscall1(type,name,atype,a) \
  13047. +type name(atype a) \
  13048. +{ \
  13049. + long __res; \
  13050. + \
  13051. + __asm__ __volatile__ ( \
  13052. + \
  13053. + " \n\t" \
  13054. + \
  13055. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  13056. + " movi r3, %1\n\t" /* __NR_##name */ \
  13057. + " mov r4, %3\n\t" /* (long) a */ \
  13058. + \
  13059. + " trap\n\t" \
  13060. + " mov %0, r2\n\t" /* syscall rtn */ \
  13061. + \
  13062. + " \n\t" \
  13063. + \
  13064. + : "=r" (__res) /* %0 */ \
  13065. + \
  13066. + : "i" (__NR_##name) /* %1 */ \
  13067. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  13068. + , "r" ((long) a) /* %3 */ \
  13069. + \
  13070. + : "r2" /* Clobbered */ \
  13071. + , "r3" /* Clobbered */ \
  13072. + , "r4" /* Clobbered */ \
  13073. + ); \
  13074. + \
  13075. +__syscall_return(type,__res); \
  13076. +}
  13077. +
  13078. +//;dgt2;tmp;can we RELY on syscall2 args a,b
  13079. +//;dgt2;tmp; already being in r4,r5 ?
  13080. +#define _syscall2(type,name,atype,a,btype,b) \
  13081. +type name(atype a,btype b) \
  13082. +{ \
  13083. + long __res; \
  13084. + \
  13085. + __asm__ __volatile__ ( \
  13086. + \
  13087. + " \n\t" \
  13088. + \
  13089. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  13090. + " movi r3, %1\n\t" /* __NR_##name */ \
  13091. + " mov r4, %3\n\t" /* (long) a */ \
  13092. + " mov r5, %4\n\t" /* (long) b */ \
  13093. + \
  13094. + " trap\n\t" \
  13095. + " mov %0, r2\n\t" /* syscall rtn */ \
  13096. + \
  13097. + " \n\t" \
  13098. + \
  13099. + : "=r" (__res) /* %0 */ \
  13100. + \
  13101. + : "i" (__NR_##name) /* %1 */ \
  13102. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  13103. + , "r" ((long) a) /* %3 */ \
  13104. + , "r" ((long) b) /* %4 */ \
  13105. + \
  13106. + : "r2" /* Clobbered */ \
  13107. + , "r3" /* Clobbered */ \
  13108. + , "r4" /* Clobbered */ \
  13109. + , "r5" /* Clobbered */ \
  13110. + ); \
  13111. + \
  13112. +__syscall_return(type,__res); \
  13113. +}
  13114. +
  13115. +//;dgt2;tmp;can we RELY on syscall3 args a,b,c
  13116. +//;dgt2;tmp; already being in r4,r5,r6 ?
  13117. +#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
  13118. +type name(atype a,btype b,ctype c) \
  13119. +{ \
  13120. + long __res; \
  13121. + \
  13122. + __asm__ __volatile__ ( \
  13123. + \
  13124. + " \n\t" \
  13125. + \
  13126. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  13127. + " movi r3, %1\n\t" /* __NR_##name */ \
  13128. + " mov r4, %3\n\t" /* (long) a */ \
  13129. + " mov r5, %4\n\t" /* (long) b */ \
  13130. + " mov r6, %5\n\t" /* (long) c */ \
  13131. + \
  13132. + " trap\n\t" \
  13133. + " mov %0, r2\n\t" /* syscall rtn */ \
  13134. + \
  13135. + " \n\t" \
  13136. + \
  13137. + : "=r" (__res) /* %0 */ \
  13138. + \
  13139. + : "i" (__NR_##name) /* %1 */ \
  13140. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  13141. + , "r" ((long) a) /* %3 */ \
  13142. + , "r" ((long) b) /* %4 */ \
  13143. + , "r" ((long) c) /* %5 */ \
  13144. + \
  13145. + : "r2" /* Clobbered */ \
  13146. + , "r3" /* Clobbered */ \
  13147. + , "r4" /* Clobbered */ \
  13148. + , "r5" /* Clobbered */ \
  13149. + , "r6" /* Clobbered */ \
  13150. + ); \
  13151. + \
  13152. +__syscall_return(type,__res); \
  13153. +}
  13154. +
  13155. +//;dgt2;tmp;can we RELY on syscall4 args a,b,c,d
  13156. +//;dgt2;tmp; already being in r4,r5,r6,r7 ?
  13157. +#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
  13158. +type name (atype a, btype b, ctype c, dtype d) \
  13159. +{ \
  13160. + long __res; \
  13161. + \
  13162. + __asm__ __volatile__ ( \
  13163. + \
  13164. + " \n\t" \
  13165. + \
  13166. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  13167. + " movi r3, %1\n\t" /* __NR_##name */ \
  13168. + " mov r4, %3\n\t" /* (long) a */ \
  13169. + " mov r5, %4\n\t" /* (long) b */ \
  13170. + " mov r6, %5\n\t" /* (long) c */ \
  13171. + " mov r7, %6\n\t" /* (long) d */ \
  13172. + \
  13173. + " trap\n\t" \
  13174. + " mov %0, r2\n\t" /* syscall rtn */ \
  13175. + \
  13176. + " \n\t" \
  13177. + \
  13178. + : "=r" (__res) /* %0 */ \
  13179. + \
  13180. + : "i" (__NR_##name) /* %1 */ \
  13181. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  13182. + , "r" ((long) a) /* %3 */ \
  13183. + , "r" ((long) b) /* %4 */ \
  13184. + , "r" ((long) c) /* %5 */ \
  13185. + , "r" ((long) d) /* %6 */ \
  13186. + \
  13187. + : "r2" /* Clobbered */ \
  13188. + , "r3" /* Clobbered */ \
  13189. + , "r4" /* Clobbered */ \
  13190. + , "r5" /* Clobbered */ \
  13191. + , "r6" /* Clobbered */ \
  13192. + , "r7" /* Clobbered */ \
  13193. + ); \
  13194. + \
  13195. +__syscall_return(type,__res); \
  13196. +}
  13197. +
  13198. +//;dgt2;tmp;can we RELY on syscall5 args a,b,c,d
  13199. +//;dgt2;tmp; already being in r4,r5,r6,r7 ?
  13200. +#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
  13201. +type name (atype a,btype b,ctype c,dtype d,etype e) \
  13202. +{ \
  13203. + long __res; \
  13204. + \
  13205. + __asm__ __volatile__ ( \
  13206. + \
  13207. + " \n\t" \
  13208. + \
  13209. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  13210. + " movi r3, %1\n\t" /* __NR_##name */ \
  13211. + " mov r4, %3\n\t" /* (long) a */ \
  13212. + " mov r5, %4\n\t" /* (long) b */ \
  13213. + " mov r6, %5\n\t" /* (long) c */ \
  13214. + " mov r7, %6\n\t" /* (long) c */ \
  13215. + " mov r8, %7\n\t" /* (long) e */ \
  13216. + \
  13217. + " trap\n\t" \
  13218. + " mov %0, r2\n\t" /* syscall rtn */ \
  13219. + \
  13220. + " \n\t" \
  13221. + \
  13222. + : "=r" (__res) /* %0 */ \
  13223. + \
  13224. + : "i" (__NR_##name) /* %1 */ \
  13225. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  13226. + , "r" ((long) a) /* %3 */ \
  13227. + , "r" ((long) b) /* %4 */ \
  13228. + , "r" ((long) c) /* %5 */ \
  13229. + , "r" ((long) d) /* %6 */ \
  13230. + , "r" ((long) e) /* %7 */ \
  13231. + \
  13232. + : "r2" /* Clobbered */ \
  13233. + , "r3" /* Clobbered */ \
  13234. + , "r4" /* Clobbered */ \
  13235. + , "r5" /* Clobbered */ \
  13236. + , "r6" /* Clobbered */ \
  13237. + , "r7" /* Clobbered */ \
  13238. + , "r8" /* Clobbered */ \
  13239. + ); \
  13240. + \
  13241. +__syscall_return(type,__res); \
  13242. +}
  13243. +
  13244. +//;dgt2;tmp;can we RELY on syscall6 args a,b,c,d
  13245. +//;dgt2;tmp; already being in r4,r5,r6,r7 ?
  13246. +#define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
  13247. +type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
  13248. +{ \
  13249. + long __res; \
  13250. + \
  13251. + __asm__ __volatile__ ( \
  13252. + \
  13253. + " \n\t" \
  13254. + \
  13255. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  13256. + " movi r3, %1\n\t" /* __NR_##name */ \
  13257. + " mov r4, %3\n\t" /* (long) a */ \
  13258. + " mov r5, %4\n\t" /* (long) b */ \
  13259. + " mov r6, %5\n\t" /* (long) c */ \
  13260. + " mov r7, %6\n\t" /* (long) c */ \
  13261. + " mov r8, %7\n\t" /* (long) e */ \
  13262. + " mov r9, %8\n\t" /* (long) f */ \
  13263. + \
  13264. + " trap\n\t" \
  13265. + " mov %0, r2\n\t" /* syscall rtn */ \
  13266. + \
  13267. + " \n\t" \
  13268. + \
  13269. + : "=r" (__res) /* %0 */ \
  13270. + \
  13271. + : "i" (__NR_##name) /* %1 */ \
  13272. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  13273. + , "r" ((long) a) /* %3 */ \
  13274. + , "r" ((long) b) /* %4 */ \
  13275. + , "r" ((long) c) /* %5 */ \
  13276. + , "r" ((long) d) /* %6 */ \
  13277. + , "r" ((long) e) /* %7 */ \
  13278. + , "r" ((long) f) /* %8 */ \
  13279. + \
  13280. + : "r2" /* Clobbered */ \
  13281. + , "r3" /* Clobbered */ \
  13282. + , "r4" /* Clobbered */ \
  13283. + , "r5" /* Clobbered */ \
  13284. + , "r6" /* Clobbered */ \
  13285. + , "r7" /* Clobbered */ \
  13286. + , "r8" /* Clobbered */ \
  13287. + , "r9" /* Clobbered */ \
  13288. + ); \
  13289. + \
  13290. +__syscall_return(type,__res); \
  13291. +}
  13292. +
  13293. +#ifdef __KERNEL__
  13294. +#define __ARCH_WANT_IPC_PARSE_VERSION
  13295. +#define __ARCH_WANT_OLD_READDIR
  13296. +#define __ARCH_WANT_OLD_STAT
  13297. +#define __ARCH_WANT_STAT64
  13298. +#define __ARCH_WANT_SYS_ALARM
  13299. +#define __ARCH_WANT_SYS_GETHOSTNAME
  13300. +#define __ARCH_WANT_SYS_PAUSE
  13301. +#define __ARCH_WANT_SYS_SGETMASK
  13302. +#define __ARCH_WANT_SYS_SIGNAL
  13303. +#define __ARCH_WANT_SYS_TIME
  13304. +#define __ARCH_WANT_SYS_UTIME
  13305. +#define __ARCH_WANT_SYS_WAITPID
  13306. +#define __ARCH_WANT_SYS_SOCKETCALL
  13307. +#define __ARCH_WANT_SYS_FADVISE64
  13308. +#define __ARCH_WANT_SYS_GETPGRP
  13309. +#define __ARCH_WANT_SYS_LLSEEK
  13310. +#define __ARCH_WANT_SYS_NICE
  13311. +#define __ARCH_WANT_SYS_OLD_GETRLIMIT
  13312. +#define __ARCH_WANT_SYS_OLDUMOUNT
  13313. +#define __ARCH_WANT_SYS_SIGPENDING
  13314. +#define __ARCH_WANT_SYS_SIGPROCMASK
  13315. +#define __ARCH_WANT_SYS_RT_SIGACTION
  13316. +#endif
  13317. +
  13318. +#ifdef __KERNEL_SYSCALLS__
  13319. +
  13320. +/*
  13321. + * we need this inline - forking from kernel space will result
  13322. + * in NO COPY ON WRITE (!!!), until an execve is executed. This
  13323. + * is no problem, but for the stack. This is handled by not letting
  13324. + * main() use the stack at all after fork(). Thus, no function
  13325. + * calls - which means inline code for fork too, as otherwise we
  13326. + * would use the stack upon exit from 'fork()'.
  13327. + *
  13328. + * Actually only pause and fork are needed inline, so that there
  13329. + * won't be any messing with the stack from main(), but we define
  13330. + * some others too.
  13331. + */
  13332. +#define __NR__exit __NR_exit
  13333. +static inline _syscall0(int,pause)
  13334. +static inline _syscall0(int,sync)
  13335. +static inline _syscall0(pid_t,setsid)
  13336. +static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
  13337. +static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
  13338. +static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
  13339. +static inline _syscall1(int,dup,int,fd)
  13340. +static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
  13341. +static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
  13342. +static inline _syscall1(int,close,int,fd)
  13343. +static inline _syscall1(int,_exit,int,exitcode)
  13344. +static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
  13345. +static inline _syscall1(int,delete_module,const char *,name)
  13346. +
  13347. +static inline pid_t wait(int * wait_stat)
  13348. +{
  13349. + return waitpid(-1,wait_stat,0);
  13350. +}
  13351. +
  13352. +#endif
  13353. +
  13354. +/*
  13355. + * "Conditional" syscalls
  13356. + *
  13357. + * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
  13358. + * but it doesn't work on all toolchains, so we just do it by hand
  13359. + */
  13360. +#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
  13361. +
  13362. +#endif /* _ASM_NIOS_UNISTD_H_ */
  13363. --- linux/include/asm-nios2nommu/user.h
  13364. +++ linux/include/asm-nios2nommu/user.h
  13365. @@ -0,0 +1,112 @@
  13366. +#ifndef _NIOS2NOMMU_USER_H
  13367. +#define _NIOS2NOMMU_USER_H
  13368. +
  13369. +/*--------------------------------------------------------------------
  13370. + *
  13371. + * include/asm-nios2nommu/user.h
  13372. + *
  13373. + * Derived from M68knommu
  13374. + *
  13375. + * Copyright (C) 2004 Microtronix Datacom Ltd
  13376. + *
  13377. + * This program is free software; you can redistribute it and/or modify
  13378. + * it under the terms of the GNU General Public License as published by
  13379. + * the Free Software Foundation; either version 2 of the License, or
  13380. + * (at your option) any later version.
  13381. + *
  13382. + * This program is distributed in the hope that it will be useful,
  13383. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13384. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13385. + * GNU General Public License for more details.
  13386. + *
  13387. + *
  13388. + * Jan/20/2004 dgt NiosII
  13389. + *
  13390. + ---------------------------------------------------------------------*/
  13391. +
  13392. +
  13393. +#include <asm/page.h>
  13394. +
  13395. +/* Core file format: The core file is written in such a way that gdb
  13396. + can understand it and provide useful information to the user (under
  13397. + linux we use the 'trad-core' bfd). There are quite a number of
  13398. + obstacles to being able to view the contents of the floating point
  13399. + registers, and until these are solved you will not be able to view the
  13400. + contents of them. Actually, you can read in the core file and look at
  13401. + the contents of the user struct to find out what the floating point
  13402. + registers contain.
  13403. + The actual file contents are as follows:
  13404. + UPAGE: 1 page consisting of a user struct that tells gdb what is present
  13405. + in the file. Directly after this is a copy of the task_struct, which
  13406. + is currently not used by gdb, but it may come in useful at some point.
  13407. + All of the registers are stored as part of the upage. The upage should
  13408. + always be only one page.
  13409. + DATA: The data area is stored. We use current->end_text to
  13410. + current->brk to pick up all of the user variables, plus any memory
  13411. + that may have been malloced. No attempt is made to determine if a page
  13412. + is demand-zero or if a page is totally unused, we just cover the entire
  13413. + range. All of the addresses are rounded in such a way that an integral
  13414. + number of pages is written.
  13415. + STACK: We need the stack information in order to get a meaningful
  13416. + backtrace. We need to write the data from (esp) to
  13417. + current->start_stack, so we round each of these off in order to be able
  13418. + to write an integer number of pages.
  13419. + The minimum core file size is 3 pages, or 12288 bytes.
  13420. +*/
  13421. +
  13422. +struct user_m68kfp_struct {
  13423. + unsigned long fpregs[8*3]; /* fp0-fp7 registers */
  13424. + unsigned long fpcntl[3]; /* fp control regs */
  13425. +};
  13426. +
  13427. +/* This is needs more work, probably should look like gdb useage */
  13428. +struct user_regs_struct {
  13429. + long r1,r2,r3,r4,r5,r6,r7,r8;
  13430. + long r9,r10,r11,r12,r13,r14,r15;
  13431. + long r16,r17,r18,r19,r20,r21,r22,r23;
  13432. + long gp;
  13433. + long sp;
  13434. + long ra;
  13435. + long fp;
  13436. + long orig_r2;
  13437. + long estatus;
  13438. + long status_extension;
  13439. + long ea;
  13440. +};
  13441. +
  13442. +
  13443. +/* When the kernel dumps core, it starts by dumping the user struct -
  13444. + this will be used by gdb to figure out where the data and stack segments
  13445. + are within the file, and what virtual addresses to use. */
  13446. +struct user{
  13447. +/* We start with the registers, to mimic the way that "memory" is returned
  13448. + from the ptrace(3,...) function. */
  13449. + struct user_regs_struct regs; /* Where the registers are actually stored */
  13450. +/* ptrace does not yet supply these. Someday.... */
  13451. + int u_fpvalid; /* True if math co-processor being used. */
  13452. + /* for this mess. Not yet used. */
  13453. + struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
  13454. +/* The rest of this junk is to help gdb figure out what goes where */
  13455. + unsigned long int u_tsize; /* Text segment size (pages). */
  13456. + unsigned long int u_dsize; /* Data segment size (pages). */
  13457. + unsigned long int u_ssize; /* Stack segment size (pages). */
  13458. + unsigned long start_code; /* Starting virtual address of text. */
  13459. + unsigned long start_stack; /* Starting virtual address of stack area.
  13460. + This is actually the bottom of the stack,
  13461. + the top of the stack is always found in the
  13462. + esp register. */
  13463. + long int signal; /* Signal that caused the core dump. */
  13464. + int reserved; /* No longer used */
  13465. + struct user_regs_struct *u_ar0;
  13466. + /* Used by gdb to help find the values for */
  13467. + /* the registers. */
  13468. + struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */
  13469. + unsigned long magic; /* To uniquely identify a core file */
  13470. + char u_comm[32]; /* User command that was responsible */
  13471. +};
  13472. +#define NBPG PAGE_SIZE
  13473. +#define UPAGES 1
  13474. +#define HOST_TEXT_START_ADDR (u.start_code)
  13475. +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
  13476. +
  13477. +#endif
  13478. --- linux/include/asm-nios2nommu/virtconvert.h
  13479. +++ linux/include/asm-nios2nommu/virtconvert.h
  13480. @@ -0,0 +1,47 @@
  13481. +#ifndef __NIOS_VIRT_CONVERT__
  13482. +#define __NIOS_VIRT_CONVERT__
  13483. +
  13484. +/*--------------------------------------------------------------------
  13485. + *
  13486. + * include/asm-nios2nommu/virtconvert.h
  13487. + *
  13488. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  13489. + *
  13490. + * Copyright (C) 2004 Microtronix Datacom Ltd
  13491. + *
  13492. + * This program is free software; you can redistribute it and/or modify
  13493. + * it under the terms of the GNU General Public License as published by
  13494. + * the Free Software Foundation; either version 2 of the License, or
  13495. + * (at your option) any later version.
  13496. + *
  13497. + * This program is distributed in the hope that it will be useful,
  13498. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13499. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13500. + * GNU General Public License for more details.
  13501. + *
  13502. + *
  13503. + * Jan/20/2004 dgt NiosII
  13504. + *
  13505. + ---------------------------------------------------------------------*/
  13506. +
  13507. +
  13508. +/*
  13509. + * Macros used for converting between virtual and physical mappings.
  13510. + */
  13511. +
  13512. +#ifdef __KERNEL__
  13513. +
  13514. +// #include <linux/config.h>
  13515. +#include <asm/setup.h>
  13516. +#include <asm/page.h>
  13517. +
  13518. +#define mm_ptov(vaddr) ((void *) (vaddr))
  13519. +#define mm_vtop(vaddr) ((unsigned long) (vaddr))
  13520. +#define phys_to_virt(vaddr) ((void *) (vaddr))
  13521. +#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
  13522. +
  13523. +#define virt_to_bus virt_to_phys
  13524. +#define bus_to_virt phys_to_virt
  13525. +
  13526. +#endif /*__KERNEL__ */
  13527. +#endif /*__NIOS_VIRT_CONVERT__*/