2
1

linux-libc-headers-2.6.9-nios2nommu.patch.conditional 390 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925
  1. --- linux/include/asm-generic/bitops.h
  2. +++ linux/include/asm-generic/bitops.h
  3. @@ -0,0 +1,81 @@
  4. +#ifndef _ASM_GENERIC_BITOPS_H_
  5. +#define _ASM_GENERIC_BITOPS_H_
  6. +
  7. +/*
  8. + * For the benefit of those who are trying to port Linux to another
  9. + * architecture, here are some C-language equivalents. You should
  10. + * recode these in the native assembly language, if at all possible.
  11. + * To guarantee atomicity, these routines call cli() and sti() to
  12. + * disable interrupts while they operate. (You have to provide inline
  13. + * routines to cli() and sti().)
  14. + *
  15. + * Also note, these routines assume that you have 32 bit longs.
  16. + * You will have to change this if you are trying to port Linux to the
  17. + * Alpha architecture or to a Cray. :-)
  18. + *
  19. + * C language equivalents written by Theodore Ts'o, 9/26/92
  20. + */
  21. +
  22. +extern __inline__ int set_bit(int nr,long * addr)
  23. +{
  24. + int mask, retval;
  25. +
  26. + addr += nr >> 5;
  27. + mask = 1 << (nr & 0x1f);
  28. + cli();
  29. + retval = (mask & *addr) != 0;
  30. + *addr |= mask;
  31. + sti();
  32. + return retval;
  33. +}
  34. +
  35. +extern __inline__ int clear_bit(int nr, long * addr)
  36. +{
  37. + int mask, retval;
  38. +
  39. + addr += nr >> 5;
  40. + mask = 1 << (nr & 0x1f);
  41. + cli();
  42. + retval = (mask & *addr) != 0;
  43. + *addr &= ~mask;
  44. + sti();
  45. + return retval;
  46. +}
  47. +
  48. +extern __inline__ int test_bit(int nr, const unsigned long * addr)
  49. +{
  50. + int mask;
  51. +
  52. + addr += nr >> 5;
  53. + mask = 1 << (nr & 0x1f);
  54. + return ((mask & *addr) != 0);
  55. +}
  56. +
  57. +/*
  58. + * fls: find last bit set.
  59. + */
  60. +
  61. +#define fls(x) generic_fls(x)
  62. +
  63. +#ifdef __KERNEL__
  64. +
  65. +/*
  66. + * ffs: find first bit set. This is defined the same way as
  67. + * the libc and compiler builtin ffs routines, therefore
  68. + * differs in spirit from the above ffz (man ffs).
  69. + */
  70. +
  71. +#define ffs(x) generic_ffs(x)
  72. +
  73. +/*
  74. + * hweightN: returns the hamming weight (i.e. the number
  75. + * of bits set) of a N-bit word
  76. + */
  77. +
  78. +#define hweight32(x) generic_hweight32(x)
  79. +#define hweight16(x) generic_hweight16(x)
  80. +#define hweight8(x) generic_hweight8(x)
  81. +
  82. +#endif /* __KERNEL__ */
  83. +
  84. +#endif /* _ASM_GENERIC_BITOPS_H */
  85. --- linux/include/asm-generic/bug.h
  86. +++ linux/include/asm-generic/bug.h
  87. @@ -0,0 +1,34 @@
  88. +#ifndef _ASM_GENERIC_BUG_H
  89. +#define _ASM_GENERIC_BUG_H
  90. +
  91. +#include <linux/compiler.h>
  92. +// #include <linux/config.h>
  93. +
  94. +#ifndef HAVE_ARCH_BUG
  95. +#define BUG() do { \
  96. + printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
  97. + panic("BUG!"); \
  98. +} while (0)
  99. +#endif
  100. +
  101. +#ifndef HAVE_ARCH_PAGE_BUG
  102. +#define PAGE_BUG(page) do { \
  103. + printk("page BUG for page at %p\n", page); \
  104. + BUG(); \
  105. +} while (0)
  106. +#endif
  107. +
  108. +#ifndef HAVE_ARCH_BUG_ON
  109. +#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
  110. +#endif
  111. +
  112. +#ifndef HAVE_ARCH_WARN_ON
  113. +#define WARN_ON(condition) do { \
  114. + if (unlikely((condition)!=0)) { \
  115. + printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
  116. + dump_stack(); \
  117. + } \
  118. +} while (0)
  119. +#endif
  120. +
  121. +#endif
  122. --- linux/include/asm-generic/cpumask.h
  123. +++ linux/include/asm-generic/cpumask.h
  124. @@ -0,0 +1,40 @@
  125. +#ifndef __ASM_GENERIC_CPUMASK_H
  126. +#define __ASM_GENERIC_CPUMASK_H
  127. +
  128. +// #include <linux/config.h>
  129. +#include <linux/kernel.h>
  130. +#include <linux/threads.h>
  131. +#include <linux/types.h>
  132. +#include <linux/bitmap.h>
  133. +
  134. +#if NR_CPUS > BITS_PER_LONG && NR_CPUS != 1
  135. +#define CPU_ARRAY_SIZE BITS_TO_LONGS(NR_CPUS)
  136. +
  137. +struct cpumask
  138. +{
  139. + unsigned long mask[CPU_ARRAY_SIZE];
  140. +};
  141. +
  142. +typedef struct cpumask cpumask_t;
  143. +
  144. +#else
  145. +typedef unsigned long cpumask_t;
  146. +#endif
  147. +
  148. +#ifdef CONFIG_SMP
  149. +#if NR_CPUS > BITS_PER_LONG
  150. +#include <asm-generic/cpumask_array.h>
  151. +#else
  152. +#include <asm-generic/cpumask_arith.h>
  153. +#endif
  154. +#else
  155. +#include <asm-generic/cpumask_up.h>
  156. +#endif
  157. +
  158. +#if NR_CPUS <= 4*BITS_PER_LONG
  159. +#include <asm-generic/cpumask_const_value.h>
  160. +#else
  161. +#include <asm-generic/cpumask_const_reference.h>
  162. +#endif
  163. +
  164. +#endif /* __ASM_GENERIC_CPUMASK_H */
  165. --- linux/include/asm-generic/cpumask_arith.h
  166. +++ linux/include/asm-generic/cpumask_arith.h
  167. @@ -0,0 +1,49 @@
  168. +#ifndef __ASM_GENERIC_CPUMASK_ARITH_H
  169. +#define __ASM_GENERIC_CPUMASK_ARITH_H
  170. +
  171. +/*
  172. + * Arithmetic type -based cpu bitmaps. A single unsigned long is used
  173. + * to contain the whole cpu bitmap.
  174. + */
  175. +
  176. +#define cpu_set(cpu, map) set_bit(cpu, &(map))
  177. +#define cpu_clear(cpu, map) clear_bit(cpu, &(map))
  178. +#define cpu_isset(cpu, map) test_bit(cpu, &(map))
  179. +#define cpu_test_and_set(cpu, map) test_and_set_bit(cpu, &(map))
  180. +
  181. +#define cpus_and(dst,src1,src2) do { dst = (src1) & (src2); } while (0)
  182. +#define cpus_or(dst,src1,src2) do { dst = (src1) | (src2); } while (0)
  183. +#define cpus_clear(map) do { map = 0; } while (0)
  184. +#define cpus_complement(map) do { map = ~(map); } while (0)
  185. +#define cpus_equal(map1, map2) ((map1) == (map2))
  186. +#define cpus_empty(map) ((map) == 0)
  187. +#define cpus_addr(map) (&(map))
  188. +
  189. +#if BITS_PER_LONG == 32
  190. +#define cpus_weight(map) hweight32(map)
  191. +#elif BITS_PER_LONG == 64
  192. +#define cpus_weight(map) hweight64(map)
  193. +#endif
  194. +
  195. +#define cpus_shift_right(dst, src, n) do { dst = (src) >> (n); } while (0)
  196. +#define cpus_shift_left(dst, src, n) do { dst = (src) << (n); } while (0)
  197. +
  198. +#define any_online_cpu(map) \
  199. +({ \
  200. + cpumask_t __tmp__; \
  201. + cpus_and(__tmp__, map, cpu_online_map); \
  202. + __tmp__ ? first_cpu(__tmp__) : NR_CPUS; \
  203. +})
  204. +
  205. +#define CPU_MASK_ALL (~((cpumask_t)0) >> (8*sizeof(cpumask_t) - NR_CPUS))
  206. +#define CPU_MASK_NONE ((cpumask_t)0)
  207. +
  208. +/* only ever use this for things that are _never_ used on large boxen */
  209. +#define cpus_coerce(map) ((unsigned long)(map))
  210. +#define cpus_promote(map) ({ map; })
  211. +#define cpumask_of_cpu(cpu) ({ ((cpumask_t)1) << (cpu); })
  212. +
  213. +#define first_cpu(map) __ffs(map)
  214. +#define next_cpu(cpu, map) find_next_bit(&(map), NR_CPUS, cpu + 1)
  215. +
  216. +#endif /* __ASM_GENERIC_CPUMASK_ARITH_H */
  217. --- linux/include/asm-generic/cpumask_array.h
  218. +++ linux/include/asm-generic/cpumask_array.h
  219. @@ -0,0 +1,54 @@
  220. +#ifndef __ASM_GENERIC_CPUMASK_ARRAY_H
  221. +#define __ASM_GENERIC_CPUMASK_ARRAY_H
  222. +
  223. +/*
  224. + * Array-based cpu bitmaps. An array of unsigned longs is used to contain
  225. + * the bitmap, and then contained in a structure so it may be passed by
  226. + * value.
  227. + */
  228. +
  229. +#define CPU_ARRAY_SIZE BITS_TO_LONGS(NR_CPUS)
  230. +
  231. +#define cpu_set(cpu, map) set_bit(cpu, (map).mask)
  232. +#define cpu_clear(cpu, map) clear_bit(cpu, (map).mask)
  233. +#define cpu_isset(cpu, map) test_bit(cpu, (map).mask)
  234. +#define cpu_test_and_set(cpu, map) test_and_set_bit(cpu, (map).mask)
  235. +
  236. +#define cpus_and(dst,src1,src2) bitmap_and((dst).mask,(src1).mask, (src2).mask, NR_CPUS)
  237. +#define cpus_or(dst,src1,src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, NR_CPUS)
  238. +#define cpus_clear(map) bitmap_clear((map).mask, NR_CPUS)
  239. +#define cpus_complement(map) bitmap_complement((map).mask, NR_CPUS)
  240. +#define cpus_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, NR_CPUS)
  241. +#define cpus_empty(map) bitmap_empty(map.mask, NR_CPUS)
  242. +#define cpus_addr(map) ((map).mask)
  243. +#define cpus_weight(map) bitmap_weight((map).mask, NR_CPUS)
  244. +#define cpus_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, NR_CPUS)
  245. +#define cpus_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, NR_CPUS)
  246. +#define first_cpu(map) find_first_bit((map).mask, NR_CPUS)
  247. +#define next_cpu(cpu, map) find_next_bit((map).mask, NR_CPUS, cpu + 1)
  248. +
  249. +/* only ever use this for things that are _never_ used on large boxen */
  250. +#define cpus_coerce(map) ((map).mask[0])
  251. +#define cpus_promote(map) ({ cpumask_t __cpu_mask = CPU_MASK_NONE;\
  252. + __cpu_mask.mask[0] = map; \
  253. + __cpu_mask; \
  254. + })
  255. +#define cpumask_of_cpu(cpu) ({ cpumask_t __cpu_mask = CPU_MASK_NONE;\
  256. + cpu_set(cpu, __cpu_mask); \
  257. + __cpu_mask; \
  258. + })
  259. +#define any_online_cpu(map) \
  260. +({ \
  261. + cpumask_t __tmp__; \
  262. + cpus_and(__tmp__, map, cpu_online_map); \
  263. + find_first_bit(__tmp__.mask, NR_CPUS); \
  264. +})
  265. +
  266. +
  267. +/*
  268. + * um, these need to be usable as static initializers
  269. + */
  270. +#define CPU_MASK_ALL { {[0 ... CPU_ARRAY_SIZE-1] = ~0UL} }
  271. +#define CPU_MASK_NONE { {[0 ... CPU_ARRAY_SIZE-1] = 0UL} }
  272. +
  273. +#endif /* __ASM_GENERIC_CPUMASK_ARRAY_H */
  274. --- linux/include/asm-generic/cpumask_const_reference.h
  275. +++ linux/include/asm-generic/cpumask_const_reference.h
  276. @@ -0,0 +1,29 @@
  277. +#ifndef __ASM_GENERIC_CPUMASK_CONST_REFERENCE_H
  278. +#define __ASM_GENERIC_CPUMASK_CONST_REFERENCE_H
  279. +
  280. +struct cpumask_ref {
  281. + const cpumask_t *val;
  282. +};
  283. +
  284. +typedef const struct cpumask_ref cpumask_const_t;
  285. +
  286. +#define mk_cpumask_const(map) ((cpumask_const_t){ &(map) })
  287. +#define cpu_isset_const(cpu, map) cpu_isset(cpu, *(map).val)
  288. +
  289. +#define cpus_and_const(dst,src1,src2) cpus_and(dst,*(src1).val,*(src2).val)
  290. +#define cpus_or_const(dst,src1,src2) cpus_or(dst,*(src1).val,*(src2).val)
  291. +
  292. +#define cpus_equal_const(map1, map2) cpus_equal(*(map1).val, *(map2).val)
  293. +
  294. +#define cpus_copy_const(map1, map2) bitmap_copy((map1).mask, (map2).val->mask, NR_CPUS)
  295. +
  296. +#define cpus_empty_const(map) cpus_empty(*(map).val)
  297. +#define cpus_weight_const(map) cpus_weight(*(map).val)
  298. +#define first_cpu_const(map) first_cpu(*(map).val)
  299. +#define next_cpu_const(cpu, map) next_cpu(cpu, *(map).val)
  300. +
  301. +/* only ever use this for things that are _never_ used on large boxen */
  302. +#define cpus_coerce_const(map) cpus_coerce(*(map).val)
  303. +#define any_online_cpu_const(map) any_online_cpu(*(map).val)
  304. +
  305. +#endif /* __ASM_GENERIC_CPUMASK_CONST_REFERENCE_H */
  306. --- linux/include/asm-generic/cpumask_const_value.h
  307. +++ linux/include/asm-generic/cpumask_const_value.h
  308. @@ -0,0 +1,21 @@
  309. +#ifndef __ASM_GENERIC_CPUMASK_CONST_VALUE_H
  310. +#define __ASM_GENERIC_CPUMASK_CONST_VALUE_H
  311. +
  312. +typedef const cpumask_t cpumask_const_t;
  313. +
  314. +#define mk_cpumask_const(map) (map)
  315. +#define cpu_isset_const(cpu, map) cpu_isset(cpu, map)
  316. +#define cpus_and_const(dst,src1,src2) cpus_and(dst, src1, src2)
  317. +#define cpus_or_const(dst,src1,src2) cpus_or(dst, src1, src2)
  318. +#define cpus_equal_const(map1, map2) cpus_equal(map1, map2)
  319. +#define cpus_empty_const(map) cpus_empty(map)
  320. +#define cpus_copy_const(map1, map2) do { map1 = (cpumask_t)map2; } while (0)
  321. +#define cpus_weight_const(map) cpus_weight(map)
  322. +#define first_cpu_const(map) first_cpu(map)
  323. +#define next_cpu_const(cpu, map) next_cpu(cpu, map)
  324. +
  325. +/* only ever use this for things that are _never_ used on large boxen */
  326. +#define cpus_coerce_const(map) cpus_coerce(map)
  327. +#define any_online_cpu_const(map) any_online_cpu(map)
  328. +
  329. +#endif /* __ASM_GENERIC_CPUMASK_CONST_VALUE_H */
  330. --- linux/include/asm-generic/cpumask_up.h
  331. +++ linux/include/asm-generic/cpumask_up.h
  332. @@ -0,0 +1,59 @@
  333. +#ifndef __ASM_GENERIC_CPUMASK_UP_H
  334. +#define __ASM_GENERIC_CPUMASK_UP_H
  335. +
  336. +#define cpus_coerce(map) (map)
  337. +
  338. +#define cpu_set(cpu, map) do { (void)(cpu); cpus_coerce(map) = 1UL; } while (0)
  339. +#define cpu_clear(cpu, map) do { (void)(cpu); cpus_coerce(map) = 0UL; } while (0)
  340. +#define cpu_isset(cpu, map) ((void)(cpu), cpus_coerce(map) != 0UL)
  341. +#define cpu_test_and_set(cpu, map) ((void)(cpu), test_and_set_bit(0, &(map)))
  342. +
  343. +#define cpus_and(dst, src1, src2) \
  344. + do { \
  345. + if (cpus_coerce(src1) && cpus_coerce(src2)) \
  346. + cpus_coerce(dst) = 1UL; \
  347. + else \
  348. + cpus_coerce(dst) = 0UL; \
  349. + } while (0)
  350. +
  351. +#define cpus_or(dst, src1, src2) \
  352. + do { \
  353. + if (cpus_coerce(src1) || cpus_coerce(src2)) \
  354. + cpus_coerce(dst) = 1UL; \
  355. + else \
  356. + cpus_coerce(dst) = 0UL; \
  357. + } while (0)
  358. +
  359. +#define cpus_clear(map) do { cpus_coerce(map) = 0UL; } while (0)
  360. +
  361. +#define cpus_complement(map) \
  362. + do { \
  363. + cpus_coerce(map) = !cpus_coerce(map); \
  364. + } while (0)
  365. +
  366. +#define cpus_equal(map1, map2) (cpus_coerce(map1) == cpus_coerce(map2))
  367. +#define cpus_empty(map) (cpus_coerce(map) == 0UL)
  368. +#define cpus_addr(map) (&(map))
  369. +#define cpus_weight(map) (cpus_coerce(map) ? 1UL : 0UL)
  370. +#define cpus_shift_right(d, s, n) do { cpus_coerce(d) = 0UL; } while (0)
  371. +#define cpus_shift_left(d, s, n) do { cpus_coerce(d) = 0UL; } while (0)
  372. +#define first_cpu(map) (cpus_coerce(map) ? 0 : 1)
  373. +#define next_cpu(cpu, map) 1
  374. +
  375. +/* only ever use this for things that are _never_ used on large boxen */
  376. +#define cpus_promote(map) \
  377. + ({ \
  378. + cpumask_t __tmp__; \
  379. + cpus_coerce(__tmp__) = map; \
  380. + __tmp__; \
  381. + })
  382. +#define cpumask_of_cpu(cpu) ((void)(cpu), cpus_promote(1))
  383. +#define any_online_cpu(map) (cpus_coerce(map) ? 0 : 1)
  384. +
  385. +/*
  386. + * um, these need to be usable as static initializers
  387. + */
  388. +#define CPU_MASK_ALL 1UL
  389. +#define CPU_MASK_NONE 0UL
  390. +
  391. +#endif /* __ASM_GENERIC_CPUMASK_UP_H */
  392. --- linux/include/asm-generic/div64.h
  393. +++ linux/include/asm-generic/div64.h
  394. @@ -0,0 +1,58 @@
  395. +#ifndef _ASM_GENERIC_DIV64_H
  396. +#define _ASM_GENERIC_DIV64_H
  397. +/*
  398. + * Copyright (C) 2003 Bernardo Innocenti <bernie@develer.com>
  399. + * Based on former asm-ppc/div64.h and asm-m68knommu/div64.h
  400. + *
  401. + * The semantics of do_div() are:
  402. + *
  403. + * uint32_t do_div(uint64_t *n, uint32_t base)
  404. + * {
  405. + * uint32_t remainder = *n % base;
  406. + * *n = *n / base;
  407. + * return remainder;
  408. + * }
  409. + *
  410. + * NOTE: macro parameter n is evaluated multiple times,
  411. + * beware of side effects!
  412. + */
  413. +
  414. +#include <linux/types.h>
  415. +#include <linux/compiler.h>
  416. +
  417. +#if BITS_PER_LONG == 64
  418. +
  419. +# define do_div(n,base) ({ \
  420. + uint32_t __base = (base); \
  421. + uint32_t __rem; \
  422. + __rem = ((uint64_t)(n)) % __base; \
  423. + (n) = ((uint64_t)(n)) / __base; \
  424. + __rem; \
  425. + })
  426. +
  427. +#elif BITS_PER_LONG == 32
  428. +
  429. +extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
  430. +
  431. +/* The unnecessary pointer compare is there
  432. + * to check for type safety (n must be 64bit)
  433. + */
  434. +# define do_div(n,base) ({ \
  435. + uint32_t __base = (base); \
  436. + uint32_t __rem; \
  437. + (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
  438. + if (likely(((n) >> 32) == 0)) { \
  439. + __rem = (uint32_t)(n) % __base; \
  440. + (n) = (uint32_t)(n) / __base; \
  441. + } else \
  442. + __rem = __div64_32(&(n), __base); \
  443. + __rem; \
  444. + })
  445. +
  446. +#else /* BITS_PER_LONG == ?? */
  447. +
  448. +# error do_div() does not yet support the C64
  449. +
  450. +#endif /* BITS_PER_LONG */
  451. +
  452. +#endif /* _ASM_GENERIC_DIV64_H */
  453. --- linux/include/asm-generic/dma-mapping-broken.h
  454. +++ linux/include/asm-generic/dma-mapping-broken.h
  455. @@ -0,0 +1,22 @@
  456. +#ifndef _ASM_GENERIC_DMA_MAPPING_H
  457. +#define _ASM_GENERIC_DMA_MAPPING_H
  458. +
  459. +/* This is used for archs that do not support DMA */
  460. +
  461. +
  462. +static inline void *
  463. +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
  464. + int flag)
  465. +{
  466. + BUG();
  467. + return 0;
  468. +}
  469. +
  470. +static inline void
  471. +dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
  472. + dma_addr_t dma_handle)
  473. +{
  474. + BUG();
  475. +}
  476. +
  477. +#endif /* _ASM_GENERIC_DMA_MAPPING_H */
  478. --- linux/include/asm-generic/dma-mapping.h
  479. +++ linux/include/asm-generic/dma-mapping.h
  480. @@ -0,0 +1,309 @@
  481. +/* Copyright (C) 2002 by James.Bottomley@HansenPartnership.com
  482. + *
  483. + * Implements the generic device dma API via the existing pci_ one
  484. + * for unconverted architectures
  485. + */
  486. +
  487. +#ifndef _ASM_GENERIC_DMA_MAPPING_H
  488. +#define _ASM_GENERIC_DMA_MAPPING_H
  489. +
  490. +// #include <linux/config.h>
  491. +
  492. +#ifdef CONFIG_PCI
  493. +
  494. +/* we implement the API below in terms of the existing PCI one,
  495. + * so include it */
  496. +#include <linux/pci.h>
  497. +/* need struct page definitions */
  498. +#include <linux/mm.h>
  499. +
  500. +static inline int
  501. +dma_supported(struct device *dev, u64 mask)
  502. +{
  503. + BUG_ON(dev->bus != &pci_bus_type);
  504. +
  505. + return pci_dma_supported(to_pci_dev(dev), mask);
  506. +}
  507. +
  508. +static inline int
  509. +dma_set_mask(struct device *dev, u64 dma_mask)
  510. +{
  511. + BUG_ON(dev->bus != &pci_bus_type);
  512. +
  513. + return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
  514. +}
  515. +
  516. +static inline void *
  517. +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
  518. + int flag)
  519. +{
  520. + BUG_ON(dev->bus != &pci_bus_type);
  521. +
  522. + return pci_alloc_consistent(to_pci_dev(dev), size, dma_handle);
  523. +}
  524. +
  525. +static inline void
  526. +dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
  527. + dma_addr_t dma_handle)
  528. +{
  529. + BUG_ON(dev->bus != &pci_bus_type);
  530. +
  531. + pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
  532. +}
  533. +
  534. +static inline dma_addr_t
  535. +dma_map_single(struct device *dev, void *cpu_addr, size_t size,
  536. + enum dma_data_direction direction)
  537. +{
  538. + BUG_ON(dev->bus != &pci_bus_type);
  539. +
  540. + return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
  541. +}
  542. +
  543. +static inline void
  544. +dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
  545. + enum dma_data_direction direction)
  546. +{
  547. + BUG_ON(dev->bus != &pci_bus_type);
  548. +
  549. + pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
  550. +}
  551. +
  552. +static inline dma_addr_t
  553. +dma_map_page(struct device *dev, struct page *page,
  554. + unsigned long offset, size_t size,
  555. + enum dma_data_direction direction)
  556. +{
  557. + BUG_ON(dev->bus != &pci_bus_type);
  558. +
  559. + return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
  560. +}
  561. +
  562. +static inline void
  563. +dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
  564. + enum dma_data_direction direction)
  565. +{
  566. + BUG_ON(dev->bus != &pci_bus_type);
  567. +
  568. + pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
  569. +}
  570. +
  571. +static inline int
  572. +dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
  573. + enum dma_data_direction direction)
  574. +{
  575. + BUG_ON(dev->bus != &pci_bus_type);
  576. +
  577. + return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
  578. +}
  579. +
  580. +static inline void
  581. +dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
  582. + enum dma_data_direction direction)
  583. +{
  584. + BUG_ON(dev->bus != &pci_bus_type);
  585. +
  586. + pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
  587. +}
  588. +
  589. +static inline void
  590. +dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
  591. + enum dma_data_direction direction)
  592. +{
  593. + BUG_ON(dev->bus != &pci_bus_type);
  594. +
  595. + pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle,
  596. + size, (int)direction);
  597. +}
  598. +
  599. +static inline void
  600. +dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
  601. + enum dma_data_direction direction)
  602. +{
  603. + BUG_ON(dev->bus != &pci_bus_type);
  604. +
  605. + pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle,
  606. + size, (int)direction);
  607. +}
  608. +
  609. +static inline void
  610. +dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
  611. + enum dma_data_direction direction)
  612. +{
  613. + BUG_ON(dev->bus != &pci_bus_type);
  614. +
  615. + pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction);
  616. +}
  617. +
  618. +static inline void
  619. +dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
  620. + enum dma_data_direction direction)
  621. +{
  622. + BUG_ON(dev->bus != &pci_bus_type);
  623. +
  624. + pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction);
  625. +}
  626. +
  627. +static inline int
  628. +dma_mapping_error(dma_addr_t dma_addr)
  629. +{
  630. + return pci_dma_mapping_error(dma_addr);
  631. +}
  632. +
  633. +
  634. +#else
  635. +
  636. +static inline int
  637. +dma_supported(struct device *dev, u64 mask)
  638. +{
  639. + return 0;
  640. +}
  641. +
  642. +static inline int
  643. +dma_set_mask(struct device *dev, u64 dma_mask)
  644. +{
  645. + BUG();
  646. + return 0;
  647. +}
  648. +
  649. +static inline void *
  650. +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
  651. + int flag)
  652. +{
  653. + BUG();
  654. + return NULL;
  655. +}
  656. +
  657. +static inline void
  658. +dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
  659. + dma_addr_t dma_handle)
  660. +{
  661. + BUG();
  662. +}
  663. +
  664. +static inline dma_addr_t
  665. +dma_map_single(struct device *dev, void *cpu_addr, size_t size,
  666. + enum dma_data_direction direction)
  667. +{
  668. + BUG();
  669. + return 0;
  670. +}
  671. +
  672. +static inline void
  673. +dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
  674. + enum dma_data_direction direction)
  675. +{
  676. + BUG();
  677. +}
  678. +
  679. +static inline dma_addr_t
  680. +dma_map_page(struct device *dev, struct page *page,
  681. + unsigned long offset, size_t size,
  682. + enum dma_data_direction direction)
  683. +{
  684. + BUG();
  685. + return 0;
  686. +}
  687. +
  688. +static inline void
  689. +dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
  690. + enum dma_data_direction direction)
  691. +{
  692. + BUG();
  693. +}
  694. +
  695. +static inline int
  696. +dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
  697. + enum dma_data_direction direction)
  698. +{
  699. + BUG();
  700. + return 0;
  701. +}
  702. +
  703. +static inline void
  704. +dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
  705. + enum dma_data_direction direction)
  706. +{
  707. + BUG();
  708. +}
  709. +
  710. +static inline void
  711. +dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
  712. + enum dma_data_direction direction)
  713. +{
  714. + BUG();
  715. +}
  716. +
  717. +static inline void
  718. +dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
  719. + enum dma_data_direction direction)
  720. +{
  721. + BUG();
  722. +}
  723. +
  724. +static inline void
  725. +dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
  726. + enum dma_data_direction direction)
  727. +{
  728. + BUG();
  729. +}
  730. +
  731. +static inline void
  732. +dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
  733. + enum dma_data_direction direction)
  734. +{
  735. + BUG();
  736. +}
  737. +
  738. +static inline int
  739. +dma_error(dma_addr_t dma_addr)
  740. +{
  741. + return 0;
  742. +}
  743. +
  744. +#endif
  745. +
  746. +/* Now for the API extensions over the pci_ one */
  747. +
  748. +#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  749. +#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
  750. +#define dma_is_consistent(d) (1)
  751. +
  752. +static inline int
  753. +dma_get_cache_alignment(void)
  754. +{
  755. + /* no easy way to get cache size on all processors, so return
  756. + * the maximum possible, to be safe */
  757. + return (1 << L1_CACHE_SHIFT_MAX);
  758. +}
  759. +
  760. +static inline void
  761. +dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
  762. + unsigned long offset, size_t size,
  763. + enum dma_data_direction direction)
  764. +{
  765. + /* just sync everything, that's all the pci API can do */
  766. + dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
  767. +}
  768. +
  769. +static inline void
  770. +dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
  771. + unsigned long offset, size_t size,
  772. + enum dma_data_direction direction)
  773. +{
  774. + /* just sync everything, that's all the pci API can do */
  775. + dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
  776. +}
  777. +
  778. +static inline void
  779. +dma_cache_sync(void *vaddr, size_t size,
  780. + enum dma_data_direction direction)
  781. +{
  782. + /* could define this in terms of the dma_cache ... operations,
  783. + * but if you get this on a platform, you should convert the platform
  784. + * to using the generic device DMA API */
  785. + BUG();
  786. +}
  787. +
  788. +#endif
  789. +
  790. --- linux/include/asm-generic/errno-base.h
  791. +++ linux/include/asm-generic/errno-base.h
  792. @@ -0,0 +1,39 @@
  793. +#ifndef _ASM_GENERIC_ERRNO_BASE_H
  794. +#define _ASM_GENERIC_ERRNO_BASE_H
  795. +
  796. +#define EPERM 1 /* Operation not permitted */
  797. +#define ENOENT 2 /* No such file or directory */
  798. +#define ESRCH 3 /* No such process */
  799. +#define EINTR 4 /* Interrupted system call */
  800. +#define EIO 5 /* I/O error */
  801. +#define ENXIO 6 /* No such device or address */
  802. +#define E2BIG 7 /* Argument list too long */
  803. +#define ENOEXEC 8 /* Exec format error */
  804. +#define EBADF 9 /* Bad file number */
  805. +#define ECHILD 10 /* No child processes */
  806. +#define EAGAIN 11 /* Try again */
  807. +#define ENOMEM 12 /* Out of memory */
  808. +#define EACCES 13 /* Permission denied */
  809. +#define EFAULT 14 /* Bad address */
  810. +#define ENOTBLK 15 /* Block device required */
  811. +#define EBUSY 16 /* Device or resource busy */
  812. +#define EEXIST 17 /* File exists */
  813. +#define EXDEV 18 /* Cross-device link */
  814. +#define ENODEV 19 /* No such device */
  815. +#define ENOTDIR 20 /* Not a directory */
  816. +#define EISDIR 21 /* Is a directory */
  817. +#define EINVAL 22 /* Invalid argument */
  818. +#define ENFILE 23 /* File table overflow */
  819. +#define EMFILE 24 /* Too many open files */
  820. +#define ENOTTY 25 /* Not a typewriter */
  821. +#define ETXTBSY 26 /* Text file busy */
  822. +#define EFBIG 27 /* File too large */
  823. +#define ENOSPC 28 /* No space left on device */
  824. +#define ESPIPE 29 /* Illegal seek */
  825. +#define EROFS 30 /* Read-only file system */
  826. +#define EMLINK 31 /* Too many links */
  827. +#define EPIPE 32 /* Broken pipe */
  828. +#define EDOM 33 /* Math argument out of domain of func */
  829. +#define ERANGE 34 /* Math result not representable */
  830. +
  831. +#endif
  832. --- linux/include/asm-generic/errno.h
  833. +++ linux/include/asm-generic/errno.h
  834. @@ -0,0 +1,100 @@
  835. +#ifndef _ASM_GENERIC_ERRNO_H
  836. +#define _ASM_GENERIC_ERRNO_H
  837. +
  838. +#include <asm-generic/errno-base.h>
  839. +
  840. +#define EDEADLK 35 /* Resource deadlock would occur */
  841. +#define ENAMETOOLONG 36 /* File name too long */
  842. +#define ENOLCK 37 /* No record locks available */
  843. +#define ENOSYS 38 /* Function not implemented */
  844. +#define ENOTEMPTY 39 /* Directory not empty */
  845. +#define ELOOP 40 /* Too many symbolic links encountered */
  846. +#define EWOULDBLOCK EAGAIN /* Operation would block */
  847. +#define ENOMSG 42 /* No message of desired type */
  848. +#define EIDRM 43 /* Identifier removed */
  849. +#define ECHRNG 44 /* Channel number out of range */
  850. +#define EL2NSYNC 45 /* Level 2 not synchronized */
  851. +#define EL3HLT 46 /* Level 3 halted */
  852. +#define EL3RST 47 /* Level 3 reset */
  853. +#define ELNRNG 48 /* Link number out of range */
  854. +#define EUNATCH 49 /* Protocol driver not attached */
  855. +#define ENOCSI 50 /* No CSI structure available */
  856. +#define EL2HLT 51 /* Level 2 halted */
  857. +#define EBADE 52 /* Invalid exchange */
  858. +#define EBADR 53 /* Invalid request descriptor */
  859. +#define EXFULL 54 /* Exchange full */
  860. +#define ENOANO 55 /* No anode */
  861. +#define EBADRQC 56 /* Invalid request code */
  862. +#define EBADSLT 57 /* Invalid slot */
  863. +
  864. +#define EDEADLOCK EDEADLK
  865. +
  866. +#define EBFONT 59 /* Bad font file format */
  867. +#define ENOSTR 60 /* Device not a stream */
  868. +#define ENODATA 61 /* No data available */
  869. +#define ETIME 62 /* Timer expired */
  870. +#define ENOSR 63 /* Out of streams resources */
  871. +#define ENONET 64 /* Machine is not on the network */
  872. +#define ENOPKG 65 /* Package not installed */
  873. +#define EREMOTE 66 /* Object is remote */
  874. +#define ENOLINK 67 /* Link has been severed */
  875. +#define EADV 68 /* Advertise error */
  876. +#define ESRMNT 69 /* Srmount error */
  877. +#define ECOMM 70 /* Communication error on send */
  878. +#define EPROTO 71 /* Protocol error */
  879. +#define EMULTIHOP 72 /* Multihop attempted */
  880. +#define EDOTDOT 73 /* RFS specific error */
  881. +#define EBADMSG 74 /* Not a data message */
  882. +#define EOVERFLOW 75 /* Value too large for defined data type */
  883. +#define ENOTUNIQ 76 /* Name not unique on network */
  884. +#define EBADFD 77 /* File descriptor in bad state */
  885. +#define EREMCHG 78 /* Remote address changed */
  886. +#define ELIBACC 79 /* Can not access a needed shared library */
  887. +#define ELIBBAD 80 /* Accessing a corrupted shared library */
  888. +#define ELIBSCN 81 /* .lib section in a.out corrupted */
  889. +#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
  890. +#define ELIBEXEC 83 /* Cannot exec a shared library directly */
  891. +#define EILSEQ 84 /* Illegal byte sequence */
  892. +#define ERESTART 85 /* Interrupted system call should be restarted */
  893. +#define ESTRPIPE 86 /* Streams pipe error */
  894. +#define EUSERS 87 /* Too many users */
  895. +#define ENOTSOCK 88 /* Socket operation on non-socket */
  896. +#define EDESTADDRREQ 89 /* Destination address required */
  897. +#define EMSGSIZE 90 /* Message too long */
  898. +#define EPROTOTYPE 91 /* Protocol wrong type for socket */
  899. +#define ENOPROTOOPT 92 /* Protocol not available */
  900. +#define EPROTONOSUPPORT 93 /* Protocol not supported */
  901. +#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
  902. +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
  903. +#define EPFNOSUPPORT 96 /* Protocol family not supported */
  904. +#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
  905. +#define EADDRINUSE 98 /* Address already in use */
  906. +#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
  907. +#define ENETDOWN 100 /* Network is down */
  908. +#define ENETUNREACH 101 /* Network is unreachable */
  909. +#define ENETRESET 102 /* Network dropped connection because of reset */
  910. +#define ECONNABORTED 103 /* Software caused connection abort */
  911. +#define ECONNRESET 104 /* Connection reset by peer */
  912. +#define ENOBUFS 105 /* No buffer space available */
  913. +#define EISCONN 106 /* Transport endpoint is already connected */
  914. +#define ENOTCONN 107 /* Transport endpoint is not connected */
  915. +#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
  916. +#define ETOOMANYREFS 109 /* Too many references: cannot splice */
  917. +#define ETIMEDOUT 110 /* Connection timed out */
  918. +#define ECONNREFUSED 111 /* Connection refused */
  919. +#define EHOSTDOWN 112 /* Host is down */
  920. +#define EHOSTUNREACH 113 /* No route to host */
  921. +#define EALREADY 114 /* Operation already in progress */
  922. +#define EINPROGRESS 115 /* Operation now in progress */
  923. +#define ESTALE 116 /* Stale NFS file handle */
  924. +#define EUCLEAN 117 /* Structure needs cleaning */
  925. +#define ENOTNAM 118 /* Not a XENIX named type file */
  926. +#define ENAVAIL 119 /* No XENIX semaphores available */
  927. +#define EISNAM 120 /* Is a named type file */
  928. +#define EREMOTEIO 121 /* Remote I/O error */
  929. +#define EDQUOT 122 /* Quota exceeded */
  930. +
  931. +#define ENOMEDIUM 123 /* No medium found */
  932. +#define EMEDIUMTYPE 124 /* Wrong medium type */
  933. +
  934. +#endif
  935. --- linux/include/asm-generic/hdreg.h
  936. +++ linux/include/asm-generic/hdreg.h
  937. @@ -0,0 +1,8 @@
  938. +#warning <asm/hdreg.h> is obsolete, please do not use it
  939. +
  940. +#ifndef __ASM_GENERIC_HDREG_H
  941. +#define __ASM_GENERIC_HDREG_H
  942. +
  943. +typedef unsigned long ide_ioreg_t;
  944. +
  945. +#endif /* __ASM_GENERIC_HDREG_H */
  946. --- linux/include/asm-generic/ide_iops.h
  947. +++ linux/include/asm-generic/ide_iops.h
  948. @@ -0,0 +1,38 @@
  949. +/* Generic I/O and MEMIO string operations. */
  950. +
  951. +#define __ide_insw insw
  952. +#define __ide_insl insl
  953. +#define __ide_outsw outsw
  954. +#define __ide_outsl outsl
  955. +
  956. +static __inline__ void __ide_mm_insw(void __iomem *port, void *addr, u32 count)
  957. +{
  958. + while (count--) {
  959. + *(u16 *)addr = readw(port);
  960. + addr += 2;
  961. + }
  962. +}
  963. +
  964. +static __inline__ void __ide_mm_insl(void __iomem *port, void *addr, u32 count)
  965. +{
  966. + while (count--) {
  967. + *(u32 *)addr = readl(port);
  968. + addr += 4;
  969. + }
  970. +}
  971. +
  972. +static __inline__ void __ide_mm_outsw(void __iomem *port, void *addr, u32 count)
  973. +{
  974. + while (count--) {
  975. + writew(*(u16 *)addr, port);
  976. + addr += 2;
  977. + }
  978. +}
  979. +
  980. +static __inline__ void __ide_mm_outsl(void __iomem * port, void *addr, u32 count)
  981. +{
  982. + while (count--) {
  983. + writel(*(u32 *)addr, port);
  984. + addr += 4;
  985. + }
  986. +}
  987. --- linux/include/asm-generic/iomap.h
  988. +++ linux/include/asm-generic/iomap.h
  989. @@ -0,0 +1,63 @@
  990. +#ifndef __GENERIC_IO_H
  991. +#define __GENERIC_IO_H
  992. +
  993. +#include <linux/linkage.h>
  994. +
  995. +/*
  996. + * These are the "generic" interfaces for doing new-style
  997. + * memory-mapped or PIO accesses. Architectures may do
  998. + * their own arch-optimized versions, these just act as
  999. + * wrappers around the old-style IO register access functions:
  1000. + * read[bwl]/write[bwl]/in[bwl]/out[bwl]
  1001. + *
  1002. + * Don't include this directly, include it from <asm/io.h>.
  1003. + */
  1004. +
  1005. +/*
  1006. + * Read/write from/to an (offsettable) iomem cookie. It might be a PIO
  1007. + * access or a MMIO access, these functions don't care. The info is
  1008. + * encoded in the hardware mapping set up by the mapping functions
  1009. + * (or the cookie itself, depending on implementation and hw).
  1010. + *
  1011. + * The generic routines just encode the PIO/MMIO as part of the
  1012. + * cookie, and coldly assume that the MMIO IO mappings are not
  1013. + * in the low address range. Architectures for which this is not
  1014. + * true can't use this generic implementation.
  1015. + */
  1016. +extern unsigned int fastcall ioread8(void __iomem *);
  1017. +extern unsigned int fastcall ioread16(void __iomem *);
  1018. +extern unsigned int fastcall ioread32(void __iomem *);
  1019. +
  1020. +extern void fastcall iowrite8(u8, void __iomem *);
  1021. +extern void fastcall iowrite16(u16, void __iomem *);
  1022. +extern void fastcall iowrite32(u32, void __iomem *);
  1023. +
  1024. +/*
  1025. + * "string" versions of the above. Note that they
  1026. + * use native byte ordering for the accesses (on
  1027. + * the assumption that IO and memory agree on a
  1028. + * byte order, and CPU byteorder is irrelevant).
  1029. + *
  1030. + * They do _not_ update the port address. If you
  1031. + * want MMIO that copies stuff laid out in MMIO
  1032. + * memory across multiple ports, use "memcpy_toio()"
  1033. + * and friends.
  1034. + */
  1035. +extern void fastcall ioread8_rep(void __iomem *port, void *buf, unsigned long count);
  1036. +extern void fastcall ioread16_rep(void __iomem *port, void *buf, unsigned long count);
  1037. +extern void fastcall ioread32_rep(void __iomem *port, void *buf, unsigned long count);
  1038. +
  1039. +extern void fastcall iowrite8_rep(void __iomem *port, const void *buf, unsigned long count);
  1040. +extern void fastcall iowrite16_rep(void __iomem *port, const void *buf, unsigned long count);
  1041. +extern void fastcall iowrite32_rep(void __iomem *port, const void *buf, unsigned long count);
  1042. +
  1043. +/* Create a virtual mapping cookie for an IO port range */
  1044. +extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
  1045. +extern void ioport_unmap(void __iomem *);
  1046. +
  1047. +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
  1048. +struct pci_dev;
  1049. +extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
  1050. +extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
  1051. +
  1052. +#endif
  1053. --- linux/include/asm-generic/local.h
  1054. +++ linux/include/asm-generic/local.h
  1055. @@ -0,0 +1,118 @@
  1056. +#ifndef _ASM_GENERIC_LOCAL_H
  1057. +#define _ASM_GENERIC_LOCAL_H
  1058. +
  1059. +// #include <linux/config.h>
  1060. +#include <linux/percpu.h>
  1061. +#include <linux/hardirq.h>
  1062. +#include <asm/types.h>
  1063. +
  1064. +/* An unsigned long type for operations which are atomic for a single
  1065. + * CPU. Usually used in combination with per-cpu variables. */
  1066. +
  1067. +#if BITS_PER_LONG == 32
  1068. +/* Implement in terms of atomics. */
  1069. +
  1070. +/* Don't use typedef: don't want them to be mixed with atomic_t's. */
  1071. +typedef struct
  1072. +{
  1073. + atomic_t a;
  1074. +} local_t;
  1075. +
  1076. +#define LOCAL_INIT(i) { ATOMIC_INIT(i) }
  1077. +
  1078. +#define local_read(l) ((unsigned long)atomic_read(&(l)->a))
  1079. +#define local_set(l,i) atomic_set((&(l)->a),(i))
  1080. +#define local_inc(l) atomic_inc(&(l)->a)
  1081. +#define local_dec(l) atomic_dec(&(l)->a)
  1082. +#define local_add(i,l) atomic_add((i),(&(l)->a))
  1083. +#define local_sub(i,l) atomic_sub((i),(&(l)->a))
  1084. +
  1085. +/* Non-atomic variants, ie. preemption disabled and won't be touched
  1086. + * in interrupt, etc. Some archs can optimize this case well. */
  1087. +#define __local_inc(l) local_set((l), local_read(l) + 1)
  1088. +#define __local_dec(l) local_set((l), local_read(l) - 1)
  1089. +#define __local_add(i,l) local_set((l), local_read(l) + (i))
  1090. +#define __local_sub(i,l) local_set((l), local_read(l) - (i))
  1091. +
  1092. +#else /* ... can't use atomics. */
  1093. +/* Implement in terms of three variables.
  1094. + Another option would be to use local_irq_save/restore. */
  1095. +
  1096. +typedef struct
  1097. +{
  1098. + /* 0 = in hardirq, 1 = in softirq, 2 = usermode. */
  1099. + unsigned long v[3];
  1100. +} local_t;
  1101. +
  1102. +#define _LOCAL_VAR(l) ((l)->v[!in_interrupt() + !in_irq()])
  1103. +
  1104. +#define LOCAL_INIT(i) { { (i), 0, 0 } }
  1105. +
  1106. +static inline unsigned long local_read(local_t *l)
  1107. +{
  1108. + return l->v[0] + l->v[1] + l->v[2];
  1109. +}
  1110. +
  1111. +static inline void local_set(local_t *l, unsigned long v)
  1112. +{
  1113. + l->v[0] = v;
  1114. + l->v[1] = l->v[2] = 0;
  1115. +}
  1116. +
  1117. +static inline void local_inc(local_t *l)
  1118. +{
  1119. + preempt_disable();
  1120. + _LOCAL_VAR(l)++;
  1121. + preempt_enable();
  1122. +}
  1123. +
  1124. +static inline void local_dec(local_t *l)
  1125. +{
  1126. + preempt_disable();
  1127. + _LOCAL_VAR(l)--;
  1128. + preempt_enable();
  1129. +}
  1130. +
  1131. +static inline void local_add(unsigned long v, local_t *l)
  1132. +{
  1133. + preempt_disable();
  1134. + _LOCAL_VAR(l) += v;
  1135. + preempt_enable();
  1136. +}
  1137. +
  1138. +static inline void local_sub(unsigned long v, local_t *l)
  1139. +{
  1140. + preempt_disable();
  1141. + _LOCAL_VAR(l) -= v;
  1142. + preempt_enable();
  1143. +}
  1144. +
  1145. +/* Non-atomic variants, ie. preemption disabled and won't be touched
  1146. + * in interrupt, etc. Some archs can optimize this case well. */
  1147. +#define __local_inc(l) ((l)->v[0]++)
  1148. +#define __local_dec(l) ((l)->v[0]--)
  1149. +#define __local_add(i,l) ((l)->v[0] += (i))
  1150. +#define __local_sub(i,l) ((l)->v[0] -= (i))
  1151. +
  1152. +#endif /* Non-atomic implementation */
  1153. +
  1154. +/* Use these for per-cpu local_t variables: on some archs they are
  1155. + * much more efficient than these naive implementations. Note they take
  1156. + * a variable (eg. mystruct.foo), not an address.
  1157. + */
  1158. +#define cpu_local_read(v) local_read(&__get_cpu_var(v))
  1159. +#define cpu_local_set(v, i) local_set(&__get_cpu_var(v), (i))
  1160. +#define cpu_local_inc(v) local_inc(&__get_cpu_var(v))
  1161. +#define cpu_local_dec(v) local_dec(&__get_cpu_var(v))
  1162. +#define cpu_local_add(i, v) local_add((i), &__get_cpu_var(v))
  1163. +#define cpu_local_sub(i, v) local_sub((i), &__get_cpu_var(v))
  1164. +
  1165. +/* Non-atomic increments, ie. preemption disabled and won't be touched
  1166. + * in interrupt, etc. Some archs can optimize this case well.
  1167. + */
  1168. +#define __cpu_local_inc(v) __local_inc(&__get_cpu_var(v))
  1169. +#define __cpu_local_dec(v) __local_dec(&__get_cpu_var(v))
  1170. +#define __cpu_local_add(i, v) __local_add((i), &__get_cpu_var(v))
  1171. +#define __cpu_local_sub(i, v) __local_sub((i), &__get_cpu_var(v))
  1172. +
  1173. +#endif /* _ASM_GENERIC_LOCAL_H */
  1174. --- linux/include/asm-generic/pci-dma-compat.h
  1175. +++ linux/include/asm-generic/pci-dma-compat.h
  1176. @@ -0,0 +1,107 @@
  1177. +/* include this file if the platform implements the dma_ DMA Mapping API
  1178. + * and wants to provide the pci_ DMA Mapping API in terms of it */
  1179. +
  1180. +#ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H
  1181. +#define _ASM_GENERIC_PCI_DMA_COMPAT_H
  1182. +
  1183. +#include <linux/dma-mapping.h>
  1184. +
  1185. +/* note pci_set_dma_mask isn't here, since it's a public function
  1186. + * exported from drivers/pci, use dma_supported instead */
  1187. +
  1188. +static inline int
  1189. +pci_dma_supported(struct pci_dev *hwdev, u64 mask)
  1190. +{
  1191. + return dma_supported(hwdev == NULL ? NULL : &hwdev->dev, mask);
  1192. +}
  1193. +
  1194. +static inline void *
  1195. +pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
  1196. + dma_addr_t *dma_handle)
  1197. +{
  1198. + return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
  1199. +}
  1200. +
  1201. +static inline void
  1202. +pci_free_consistent(struct pci_dev *hwdev, size_t size,
  1203. + void *vaddr, dma_addr_t dma_handle)
  1204. +{
  1205. + dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle);
  1206. +}
  1207. +
  1208. +static inline dma_addr_t
  1209. +pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
  1210. +{
  1211. + return dma_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction);
  1212. +}
  1213. +
  1214. +static inline void
  1215. +pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
  1216. + size_t size, int direction)
  1217. +{
  1218. + dma_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction);
  1219. +}
  1220. +
  1221. +static inline dma_addr_t
  1222. +pci_map_page(struct pci_dev *hwdev, struct page *page,
  1223. + unsigned long offset, size_t size, int direction)
  1224. +{
  1225. + return dma_map_page(hwdev == NULL ? NULL : &hwdev->dev, page, offset, size, (enum dma_data_direction)direction);
  1226. +}
  1227. +
  1228. +static inline void
  1229. +pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address,
  1230. + size_t size, int direction)
  1231. +{
  1232. + dma_unmap_page(hwdev == NULL ? NULL : &hwdev->dev, dma_address, size, (enum dma_data_direction)direction);
  1233. +}
  1234. +
  1235. +static inline int
  1236. +pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
  1237. + int nents, int direction)
  1238. +{
  1239. + return dma_map_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
  1240. +}
  1241. +
  1242. +static inline void
  1243. +pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
  1244. + int nents, int direction)
  1245. +{
  1246. + dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
  1247. +}
  1248. +
  1249. +static inline void
  1250. +pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle,
  1251. + size_t size, int direction)
  1252. +{
  1253. + dma_sync_single_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
  1254. +}
  1255. +
  1256. +static inline void
  1257. +pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
  1258. + size_t size, int direction)
  1259. +{
  1260. + dma_sync_single_for_device(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
  1261. +}
  1262. +
  1263. +static inline void
  1264. +pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg,
  1265. + int nelems, int direction)
  1266. +{
  1267. + dma_sync_sg_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
  1268. +}
  1269. +
  1270. +static inline void
  1271. +pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
  1272. + int nelems, int direction)
  1273. +{
  1274. + dma_sync_sg_for_device(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
  1275. +}
  1276. +
  1277. +static inline int
  1278. +pci_dma_mapping_error(dma_addr_t dma_addr)
  1279. +{
  1280. + return dma_mapping_error(dma_addr);
  1281. +}
  1282. +
  1283. +#endif
  1284. --- linux/include/asm-generic/pci.h
  1285. +++ linux/include/asm-generic/pci.h
  1286. @@ -0,0 +1,27 @@
  1287. +/*
  1288. + * linux/include/asm-generic/pci.h
  1289. + *
  1290. + * Copyright (C) 2003 Russell King
  1291. + */
  1292. +#ifndef _ASM_GENERIC_PCI_H
  1293. +#define _ASM_GENERIC_PCI_H
  1294. +
  1295. +/**
  1296. + * pcibios_resource_to_bus - convert resource to PCI bus address
  1297. + * @dev: device which owns this resource
  1298. + * @region: converted bus-centric region (start,end)
  1299. + * @res: resource to convert
  1300. + *
  1301. + * Convert a resource to a PCI device bus address or bus window.
  1302. + */
  1303. +static inline void
  1304. +pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
  1305. + struct resource *res)
  1306. +{
  1307. + region->start = res->start;
  1308. + region->end = res->end;
  1309. +}
  1310. +
  1311. +#define pcibios_scan_all_fns(a, b) 0
  1312. +
  1313. +#endif
  1314. --- linux/include/asm-generic/percpu.h
  1315. +++ linux/include/asm-generic/percpu.h
  1316. @@ -0,0 +1,42 @@
  1317. +#ifndef _ASM_GENERIC_PERCPU_H_
  1318. +#define _ASM_GENERIC_PERCPU_H_
  1319. +#include <linux/compiler.h>
  1320. +
  1321. +#define __GENERIC_PER_CPU
  1322. +#ifdef CONFIG_SMP
  1323. +
  1324. +extern unsigned long __per_cpu_offset[NR_CPUS];
  1325. +
  1326. +/* Separate out the type, so (int[3], foo) works. */
  1327. +#define DEFINE_PER_CPU(type, name) \
  1328. + __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
  1329. +
  1330. +/* var is in discarded region: offset to particular copy we want */
  1331. +#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
  1332. +#define __get_cpu_var(var) per_cpu(var, smp_processor_id())
  1333. +
  1334. +/* A macro to avoid #include hell... */
  1335. +#define percpu_modcopy(pcpudst, src, size) \
  1336. +do { \
  1337. + unsigned int __i; \
  1338. + for (__i = 0; __i < NR_CPUS; __i++) \
  1339. + if (cpu_possible(__i)) \
  1340. + memcpy((pcpudst)+__per_cpu_offset[__i], \
  1341. + (src), (size)); \
  1342. +} while (0)
  1343. +#else /* ! SMP */
  1344. +
  1345. +#define DEFINE_PER_CPU(type, name) \
  1346. + __typeof__(type) per_cpu__##name
  1347. +
  1348. +#define per_cpu(var, cpu) (*((void)cpu, &per_cpu__##var))
  1349. +#define __get_cpu_var(var) per_cpu__##var
  1350. +
  1351. +#endif /* SMP */
  1352. +
  1353. +#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
  1354. +
  1355. +#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
  1356. +#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
  1357. +
  1358. +#endif /* _ASM_GENERIC_PERCPU_H_ */
  1359. --- linux/include/asm-generic/pgtable.h
  1360. +++ linux/include/asm-generic/pgtable.h
  1361. @@ -0,0 +1,137 @@
  1362. +#ifndef _ASM_GENERIC_PGTABLE_H
  1363. +#define _ASM_GENERIC_PGTABLE_H
  1364. +
  1365. +#ifndef __HAVE_ARCH_PTEP_ESTABLISH
  1366. +/*
  1367. + * Establish a new mapping:
  1368. + * - flush the old one
  1369. + * - update the page tables
  1370. + * - inform the TLB about the new one
  1371. + *
  1372. + * We hold the mm semaphore for reading and vma->vm_mm->page_table_lock.
  1373. + *
  1374. + * Note: the old pte is known to not be writable, so we don't need to
  1375. + * worry about dirty bits etc getting lost.
  1376. + */
  1377. +#ifndef __HAVE_ARCH_SET_PTE_ATOMIC
  1378. +#define ptep_establish(__vma, __address, __ptep, __entry) \
  1379. +do { \
  1380. + set_pte(__ptep, __entry); \
  1381. + flush_tlb_page(__vma, __address); \
  1382. +} while (0)
  1383. +#else /* __HAVE_ARCH_SET_PTE_ATOMIC */
  1384. +#define ptep_establish(__vma, __address, __ptep, __entry) \
  1385. +do { \
  1386. + set_pte_atomic(__ptep, __entry); \
  1387. + flush_tlb_page(__vma, __address); \
  1388. +} while (0)
  1389. +#endif /* __HAVE_ARCH_SET_PTE_ATOMIC */
  1390. +#endif
  1391. +
  1392. +#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
  1393. +/*
  1394. + * Largely same as above, but only sets the access flags (dirty,
  1395. + * accessed, and writable). Furthermore, we know it always gets set
  1396. + * to a "more permissive" setting, which allows most architectures
  1397. + * to optimize this.
  1398. + */
  1399. +#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
  1400. +do { \
  1401. + set_pte(__ptep, __entry); \
  1402. + flush_tlb_page(__vma, __address); \
  1403. +} while (0)
  1404. +#endif
  1405. +
  1406. +#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
  1407. +static inline int ptep_test_and_clear_young(pte_t *ptep)
  1408. +{
  1409. + pte_t pte = *ptep;
  1410. + if (!pte_young(pte))
  1411. + return 0;
  1412. + set_pte(ptep, pte_mkold(pte));
  1413. + return 1;
  1414. +}
  1415. +#endif
  1416. +
  1417. +#ifndef __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
  1418. +#define ptep_clear_flush_young(__vma, __address, __ptep) \
  1419. +({ \
  1420. + int __young = ptep_test_and_clear_young(__ptep); \
  1421. + if (__young) \
  1422. + flush_tlb_page(__vma, __address); \
  1423. + __young; \
  1424. +})
  1425. +#endif
  1426. +
  1427. +#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
  1428. +static inline int ptep_test_and_clear_dirty(pte_t *ptep)
  1429. +{
  1430. + pte_t pte = *ptep;
  1431. + if (!pte_dirty(pte))
  1432. + return 0;
  1433. + set_pte(ptep, pte_mkclean(pte));
  1434. + return 1;
  1435. +}
  1436. +#endif
  1437. +
  1438. +#ifndef __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
  1439. +#define ptep_clear_flush_dirty(__vma, __address, __ptep) \
  1440. +({ \
  1441. + int __dirty = ptep_test_and_clear_dirty(__ptep); \
  1442. + if (__dirty) \
  1443. + flush_tlb_page(__vma, __address); \
  1444. + __dirty; \
  1445. +})
  1446. +#endif
  1447. +
  1448. +#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR
  1449. +static inline pte_t ptep_get_and_clear(pte_t *ptep)
  1450. +{
  1451. + pte_t pte = *ptep;
  1452. + pte_clear(ptep);
  1453. + return pte;
  1454. +}
  1455. +#endif
  1456. +
  1457. +#ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH
  1458. +#define ptep_clear_flush(__vma, __address, __ptep) \
  1459. +({ \
  1460. + pte_t __pte = ptep_get_and_clear(__ptep); \
  1461. + flush_tlb_page(__vma, __address); \
  1462. + __pte; \
  1463. +})
  1464. +#endif
  1465. +
  1466. +#ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT
  1467. +static inline void ptep_set_wrprotect(pte_t *ptep)
  1468. +{
  1469. + pte_t old_pte = *ptep;
  1470. + set_pte(ptep, pte_wrprotect(old_pte));
  1471. +}
  1472. +#endif
  1473. +
  1474. +#ifndef __HAVE_ARCH_PTEP_MKDIRTY
  1475. +static inline void ptep_mkdirty(pte_t *ptep)
  1476. +{
  1477. + pte_t old_pte = *ptep;
  1478. + set_pte(ptep, pte_mkdirty(old_pte));
  1479. +}
  1480. +#endif
  1481. +
  1482. +#ifndef __HAVE_ARCH_PTE_SAME
  1483. +#define pte_same(A,B) (pte_val(A) == pte_val(B))
  1484. +#endif
  1485. +
  1486. +#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
  1487. +#define page_test_and_clear_dirty(page) (0)
  1488. +#endif
  1489. +
  1490. +#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
  1491. +#define page_test_and_clear_young(page) (0)
  1492. +#endif
  1493. +
  1494. +#ifndef __HAVE_ARCH_PGD_OFFSET_GATE
  1495. +#define pgd_offset_gate(mm, addr) pgd_offset(mm, addr)
  1496. +#endif
  1497. +
  1498. +#endif /* _ASM_GENERIC_PGTABLE_H */
  1499. --- linux/include/asm-generic/rmap.h
  1500. +++ linux/include/asm-generic/rmap.h
  1501. @@ -0,0 +1,90 @@
  1502. +#ifndef _GENERIC_RMAP_H
  1503. +#define _GENERIC_RMAP_H
  1504. +/*
  1505. + * linux/include/asm-generic/rmap.h
  1506. + *
  1507. + * Architecture dependent parts of the reverse mapping code,
  1508. + * this version should work for most architectures with a
  1509. + * 'normal' page table layout.
  1510. + *
  1511. + * We use the struct page of the page table page to find out
  1512. + * the process and full address of a page table entry:
  1513. + * - page->mapping points to the process' mm_struct
  1514. + * - page->index has the high bits of the address
  1515. + * - the lower bits of the address are calculated from the
  1516. + * offset of the page table entry within the page table page
  1517. + *
  1518. + * For CONFIG_HIGHPTE, we need to represent the address of a pte in a
  1519. + * scalar pte_addr_t. The pfn of the pte's page is shifted left by PAGE_SIZE
  1520. + * bits and is then ORed with the byte offset of the pte within its page.
  1521. + *
  1522. + * For CONFIG_HIGHMEM4G, the pte_addr_t is 32 bits. 20 for the pfn, 12 for
  1523. + * the offset.
  1524. + *
  1525. + * For CONFIG_HIGHMEM64G, the pte_addr_t is 64 bits. 52 for the pfn, 12 for
  1526. + * the offset.
  1527. + */
  1528. +#include <linux/mm.h>
  1529. +
  1530. +static inline void pgtable_add_rmap(struct page * page, struct mm_struct * mm, unsigned long address)
  1531. +{
  1532. +#ifdef BROKEN_PPC_PTE_ALLOC_ONE
  1533. + /* OK, so PPC calls pte_alloc() before mem_map[] is setup ... ;( */
  1534. + extern int mem_init_done;
  1535. +
  1536. + if (!mem_init_done)
  1537. + return;
  1538. +#endif
  1539. + page->mapping = (void *)mm;
  1540. + page->index = address & ~((PTRS_PER_PTE * PAGE_SIZE) - 1);
  1541. + inc_page_state(nr_page_table_pages);
  1542. +}
  1543. +
  1544. +static inline void pgtable_remove_rmap(struct page * page)
  1545. +{
  1546. + page->mapping = NULL;
  1547. + page->index = 0;
  1548. + dec_page_state(nr_page_table_pages);
  1549. +}
  1550. +
  1551. +static inline struct mm_struct * ptep_to_mm(pte_t * ptep)
  1552. +{
  1553. + struct page * page = kmap_atomic_to_page(ptep);
  1554. + return (struct mm_struct *) page->mapping;
  1555. +}
  1556. +
  1557. +static inline unsigned long ptep_to_address(pte_t * ptep)
  1558. +{
  1559. + struct page * page = kmap_atomic_to_page(ptep);
  1560. + unsigned long low_bits;
  1561. + low_bits = ((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE;
  1562. + return page->index + low_bits;
  1563. +}
  1564. +
  1565. +#ifdef CONFIG_HIGHPTE
  1566. +static inline pte_addr_t ptep_to_paddr(pte_t *ptep)
  1567. +{
  1568. + pte_addr_t paddr;
  1569. + paddr = ((pte_addr_t)page_to_pfn(kmap_atomic_to_page(ptep))) << PAGE_SHIFT;
  1570. + return paddr + (pte_addr_t)((unsigned long)ptep & ~PAGE_MASK);
  1571. +}
  1572. +#else
  1573. +static inline pte_addr_t ptep_to_paddr(pte_t *ptep)
  1574. +{
  1575. + return (pte_addr_t)ptep;
  1576. +}
  1577. +#endif
  1578. +
  1579. +#ifndef CONFIG_HIGHPTE
  1580. +static inline pte_t *rmap_ptep_map(pte_addr_t pte_paddr)
  1581. +{
  1582. + return (pte_t *)pte_paddr;
  1583. +}
  1584. +
  1585. +static inline void rmap_ptep_unmap(pte_t *pte)
  1586. +{
  1587. + return;
  1588. +}
  1589. +#endif
  1590. +
  1591. +#endif /* _GENERIC_RMAP_H */
  1592. --- linux/include/asm-generic/rtc.h
  1593. +++ linux/include/asm-generic/rtc.h
  1594. @@ -0,0 +1,213 @@
  1595. +/*
  1596. + * inclue/asm-generic/rtc.h
  1597. + *
  1598. + * Author: Tom Rini <trini@mvista.com>
  1599. + *
  1600. + * Based on:
  1601. + * drivers/char/rtc.c
  1602. + *
  1603. + * Please read the COPYING file for all license details.
  1604. + */
  1605. +
  1606. +#ifndef __ASM_RTC_H__
  1607. +#define __ASM_RTC_H__
  1608. +
  1609. +#ifdef __KERNEL__
  1610. +
  1611. +#include <linux/mc146818rtc.h>
  1612. +#include <linux/rtc.h>
  1613. +#include <linux/bcd.h>
  1614. +
  1615. +#define RTC_PIE 0x40 /* periodic interrupt enable */
  1616. +#define RTC_AIE 0x20 /* alarm interrupt enable */
  1617. +#define RTC_UIE 0x10 /* update-finished interrupt enable */
  1618. +
  1619. +/* some dummy definitions */
  1620. +#define RTC_BATT_BAD 0x100 /* battery bad */
  1621. +#define RTC_SQWE 0x08 /* enable square-wave output */
  1622. +#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */
  1623. +#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
  1624. +#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
  1625. +
  1626. +/*
  1627. + * Returns true if a clock update is in progress
  1628. + */
  1629. +static inline unsigned char rtc_is_updating(void)
  1630. +{
  1631. + unsigned char uip;
  1632. +
  1633. + spin_lock_irq(&rtc_lock);
  1634. + uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
  1635. + spin_unlock_irq(&rtc_lock);
  1636. + return uip;
  1637. +}
  1638. +
  1639. +static inline unsigned int get_rtc_time(struct rtc_time *time)
  1640. +{
  1641. + unsigned long uip_watchdog = jiffies;
  1642. + unsigned char ctrl;
  1643. +#ifdef CONFIG_MACH_DECSTATION
  1644. + unsigned int real_year;
  1645. +#endif
  1646. +
  1647. + /*
  1648. + * read RTC once any update in progress is done. The update
  1649. + * can take just over 2ms. We wait 10 to 20ms. There is no need to
  1650. + * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP.
  1651. + * If you need to know *exactly* when a second has started, enable
  1652. + * periodic update complete interrupts, (via ioctl) and then
  1653. + * immediately read /dev/rtc which will block until you get the IRQ.
  1654. + * Once the read clears, read the RTC time (again via ioctl). Easy.
  1655. + */
  1656. +
  1657. + if (rtc_is_updating() != 0)
  1658. + while (jiffies - uip_watchdog < 2*HZ/100) {
  1659. + barrier();
  1660. + cpu_relax();
  1661. + }
  1662. +
  1663. + /*
  1664. + * Only the values that we read from the RTC are set. We leave
  1665. + * tm_wday, tm_yday and tm_isdst untouched. Even though the
  1666. + * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
  1667. + * by the RTC when initially set to a non-zero value.
  1668. + */
  1669. + spin_lock_irq(&rtc_lock);
  1670. + time->tm_sec = CMOS_READ(RTC_SECONDS);
  1671. + time->tm_min = CMOS_READ(RTC_MINUTES);
  1672. + time->tm_hour = CMOS_READ(RTC_HOURS);
  1673. + time->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH);
  1674. + time->tm_mon = CMOS_READ(RTC_MONTH);
  1675. + time->tm_year = CMOS_READ(RTC_YEAR);
  1676. +#ifdef CONFIG_MACH_DECSTATION
  1677. + real_year = CMOS_READ(RTC_DEC_YEAR);
  1678. +#endif
  1679. + ctrl = CMOS_READ(RTC_CONTROL);
  1680. + spin_unlock_irq(&rtc_lock);
  1681. +
  1682. + if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
  1683. + {
  1684. + BCD_TO_BIN(time->tm_sec);
  1685. + BCD_TO_BIN(time->tm_min);
  1686. + BCD_TO_BIN(time->tm_hour);
  1687. + BCD_TO_BIN(time->tm_mday);
  1688. + BCD_TO_BIN(time->tm_mon);
  1689. + BCD_TO_BIN(time->tm_year);
  1690. + }
  1691. +
  1692. +#ifdef CONFIG_MACH_DECSTATION
  1693. + time->tm_year += real_year - 72;
  1694. +#endif
  1695. +
  1696. + /*
  1697. + * Account for differences between how the RTC uses the values
  1698. + * and how they are defined in a struct rtc_time;
  1699. + */
  1700. + if (time->tm_year <= 69)
  1701. + time->tm_year += 100;
  1702. +
  1703. + time->tm_mon--;
  1704. +
  1705. + return RTC_24H;
  1706. +}
  1707. +
  1708. +/* Set the current date and time in the real time clock. */
  1709. +static inline int set_rtc_time(struct rtc_time *time)
  1710. +{
  1711. + unsigned char mon, day, hrs, min, sec;
  1712. + unsigned char save_control, save_freq_select;
  1713. + unsigned int yrs;
  1714. +#ifdef CONFIG_MACH_DECSTATION
  1715. + unsigned int real_yrs, leap_yr;
  1716. +#endif
  1717. +
  1718. + yrs = time->tm_year;
  1719. + mon = time->tm_mon + 1; /* tm_mon starts at zero */
  1720. + day = time->tm_mday;
  1721. + hrs = time->tm_hour;
  1722. + min = time->tm_min;
  1723. + sec = time->tm_sec;
  1724. +
  1725. + if (yrs > 255) /* They are unsigned */
  1726. + return -EINVAL;
  1727. +
  1728. + spin_lock_irq(&rtc_lock);
  1729. +#ifdef CONFIG_MACH_DECSTATION
  1730. + real_yrs = yrs;
  1731. + leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) ||
  1732. + !((yrs + 1900) % 400));
  1733. + yrs = 72;
  1734. +
  1735. + /*
  1736. + * We want to keep the year set to 73 until March
  1737. + * for non-leap years, so that Feb, 29th is handled
  1738. + * correctly.
  1739. + */
  1740. + if (!leap_yr && mon < 3) {
  1741. + real_yrs--;
  1742. + yrs = 73;
  1743. + }
  1744. +#endif
  1745. + /* These limits and adjustments are independent of
  1746. + * whether the chip is in binary mode or not.
  1747. + */
  1748. + if (yrs > 169) {
  1749. + spin_unlock_irq(&rtc_lock);
  1750. + return -EINVAL;
  1751. + }
  1752. +
  1753. + if (yrs >= 100)
  1754. + yrs -= 100;
  1755. +
  1756. + if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY)
  1757. + || RTC_ALWAYS_BCD) {
  1758. + BIN_TO_BCD(sec);
  1759. + BIN_TO_BCD(min);
  1760. + BIN_TO_BCD(hrs);
  1761. + BIN_TO_BCD(day);
  1762. + BIN_TO_BCD(mon);
  1763. + BIN_TO_BCD(yrs);
  1764. + }
  1765. +
  1766. + save_control = CMOS_READ(RTC_CONTROL);
  1767. + CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
  1768. + save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
  1769. + CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
  1770. +
  1771. +#ifdef CONFIG_MACH_DECSTATION
  1772. + CMOS_WRITE(real_yrs, RTC_DEC_YEAR);
  1773. +#endif
  1774. + CMOS_WRITE(yrs, RTC_YEAR);
  1775. + CMOS_WRITE(mon, RTC_MONTH);
  1776. + CMOS_WRITE(day, RTC_DAY_OF_MONTH);
  1777. + CMOS_WRITE(hrs, RTC_HOURS);
  1778. + CMOS_WRITE(min, RTC_MINUTES);
  1779. + CMOS_WRITE(sec, RTC_SECONDS);
  1780. +
  1781. + CMOS_WRITE(save_control, RTC_CONTROL);
  1782. + CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
  1783. +
  1784. + spin_unlock_irq(&rtc_lock);
  1785. +
  1786. + return 0;
  1787. +}
  1788. +
  1789. +static inline unsigned int get_rtc_ss(void)
  1790. +{
  1791. + struct rtc_time h;
  1792. +
  1793. + get_rtc_time(&h);
  1794. + return h.tm_sec;
  1795. +}
  1796. +
  1797. +static inline int get_rtc_pll(struct rtc_pll_info *pll)
  1798. +{
  1799. + return -EINVAL;
  1800. +}
  1801. +static inline int set_rtc_pll(struct rtc_pll_info *pll)
  1802. +{
  1803. + return -EINVAL;
  1804. +}
  1805. +
  1806. +#endif /* __KERNEL__ */
  1807. +#endif /* __ASM_RTC_H__ */
  1808. --- linux/include/asm-generic/sections.h
  1809. +++ linux/include/asm-generic/sections.h
  1810. @@ -0,0 +1,12 @@
  1811. +#ifndef _ASM_GENERIC_SECTIONS_H_
  1812. +#define _ASM_GENERIC_SECTIONS_H_
  1813. +
  1814. +/* References to section boundaries */
  1815. +
  1816. +extern char _text[], _stext[], _etext[];
  1817. +extern char _data[], _sdata[], _edata[];
  1818. +extern char __bss_start[], __bss_stop[];
  1819. +extern char __init_begin[], __init_end[];
  1820. +extern char _sinittext[], _einittext[];
  1821. +
  1822. +#endif /* _ASM_GENERIC_SECTIONS_H_ */
  1823. --- linux/include/asm-generic/siginfo.h
  1824. +++ linux/include/asm-generic/siginfo.h
  1825. @@ -0,0 +1,295 @@
  1826. +#ifndef _ASM_GENERIC_SIGINFO_H
  1827. +#define _ASM_GENERIC_SIGINFO_H
  1828. +
  1829. +#include <linux/compiler.h>
  1830. +#include <linux/types.h>
  1831. +#include <linux/resource.h>
  1832. +
  1833. +typedef union sigval {
  1834. + int sival_int;
  1835. + void __user *sival_ptr;
  1836. +} sigval_t;
  1837. +
  1838. +/*
  1839. + * This is the size (including padding) of the part of the
  1840. + * struct siginfo that is before the union.
  1841. + */
  1842. +#ifndef __ARCH_SI_PREAMBLE_SIZE
  1843. +#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
  1844. +#endif
  1845. +
  1846. +#define SI_MAX_SIZE 128
  1847. +#ifndef SI_PAD_SIZE
  1848. +#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
  1849. +#endif
  1850. +
  1851. +#ifndef __ARCH_SI_UID_T
  1852. +#define __ARCH_SI_UID_T uid_t
  1853. +#endif
  1854. +
  1855. +/*
  1856. + * The default "si_band" type is "long", as specified by POSIX.
  1857. + * However, some architectures want to override this to "int"
  1858. + * for historical compatibility reasons, so we allow that.
  1859. + */
  1860. +#ifndef __ARCH_SI_BAND_T
  1861. +#define __ARCH_SI_BAND_T long
  1862. +#endif
  1863. +
  1864. +#ifndef HAVE_ARCH_SIGINFO_T
  1865. +
  1866. +typedef struct siginfo {
  1867. + int si_signo;
  1868. + int si_errno;
  1869. + int si_code;
  1870. +
  1871. + union {
  1872. + int _pad[SI_PAD_SIZE];
  1873. +
  1874. + /* kill() */
  1875. + struct {
  1876. + pid_t _pid; /* sender's pid */
  1877. + __ARCH_SI_UID_T _uid; /* sender's uid */
  1878. + } _kill;
  1879. +
  1880. + /* POSIX.1b timers */
  1881. + struct {
  1882. + timer_t _tid; /* timer id */
  1883. + int _overrun; /* overrun count */
  1884. + char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
  1885. + sigval_t _sigval; /* same as below */
  1886. + int _sys_private; /* not to be passed to user */
  1887. + } _timer;
  1888. +
  1889. + /* POSIX.1b signals */
  1890. + struct {
  1891. + pid_t _pid; /* sender's pid */
  1892. + __ARCH_SI_UID_T _uid; /* sender's uid */
  1893. + sigval_t _sigval;
  1894. + } _rt;
  1895. +
  1896. + /* SIGCHLD */
  1897. + struct {
  1898. + pid_t _pid; /* which child */
  1899. + __ARCH_SI_UID_T _uid; /* sender's uid */
  1900. + int _status; /* exit code */
  1901. + clock_t _utime;
  1902. + clock_t _stime;
  1903. + } _sigchld;
  1904. +
  1905. + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  1906. + struct {
  1907. + void __user *_addr; /* faulting insn/memory ref. */
  1908. +#ifdef __ARCH_SI_TRAPNO
  1909. + int _trapno; /* TRAP # which caused the signal */
  1910. +#endif
  1911. + } _sigfault;
  1912. +
  1913. + /* SIGPOLL */
  1914. + struct {
  1915. + __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  1916. + int _fd;
  1917. + } _sigpoll;
  1918. + } _sifields;
  1919. +} siginfo_t;
  1920. +
  1921. +#endif
  1922. +
  1923. +/*
  1924. + * How these fields are to be accessed.
  1925. + */
  1926. +#define si_pid _sifields._kill._pid
  1927. +#define si_uid _sifields._kill._uid
  1928. +#define si_tid _sifields._timer._tid
  1929. +#define si_overrun _sifields._timer._overrun
  1930. +#define si_sys_private _sifields._timer._sys_private
  1931. +#define si_status _sifields._sigchld._status
  1932. +#define si_utime _sifields._sigchld._utime
  1933. +#define si_stime _sifields._sigchld._stime
  1934. +#define si_value _sifields._rt._sigval
  1935. +#define si_int _sifields._rt._sigval.sival_int
  1936. +#define si_ptr _sifields._rt._sigval.sival_ptr
  1937. +#define si_addr _sifields._sigfault._addr
  1938. +#ifdef __ARCH_SI_TRAPNO
  1939. +#define si_trapno _sifields._sigfault._trapno
  1940. +#endif
  1941. +#define si_band _sifields._sigpoll._band
  1942. +#define si_fd _sifields._sigpoll._fd
  1943. +
  1944. +#ifdef __KERNEL__
  1945. +#define __SI_MASK 0xffff0000u
  1946. +#define __SI_KILL (0 << 16)
  1947. +#define __SI_TIMER (1 << 16)
  1948. +#define __SI_POLL (2 << 16)
  1949. +#define __SI_FAULT (3 << 16)
  1950. +#define __SI_CHLD (4 << 16)
  1951. +#define __SI_RT (5 << 16)
  1952. +#define __SI_MESGQ (6 << 16)
  1953. +#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
  1954. +#else
  1955. +#define __SI_KILL 0
  1956. +#define __SI_TIMER 0
  1957. +#define __SI_POLL 0
  1958. +#define __SI_FAULT 0
  1959. +#define __SI_CHLD 0
  1960. +#define __SI_RT 0
  1961. +#define __SI_MESGQ 0
  1962. +#define __SI_CODE(T,N) (N)
  1963. +#endif
  1964. +
  1965. +/*
  1966. + * si_code values
  1967. + * Digital reserves positive values for kernel-generated signals.
  1968. + */
  1969. +#define SI_USER 0 /* sent by kill, sigsend, raise */
  1970. +#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
  1971. +#define SI_QUEUE -1 /* sent by sigqueue */
  1972. +#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
  1973. +#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */
  1974. +#define SI_ASYNCIO -4 /* sent by AIO completion */
  1975. +#define SI_SIGIO -5 /* sent by queued SIGIO */
  1976. +#define SI_TKILL -6 /* sent by tkill system call */
  1977. +#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
  1978. +
  1979. +#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
  1980. +#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
  1981. +
  1982. +#ifndef HAVE_ARCH_SI_CODES
  1983. +/*
  1984. + * SIGILL si_codes
  1985. + */
  1986. +#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */
  1987. +#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */
  1988. +#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */
  1989. +#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */
  1990. +#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */
  1991. +#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */
  1992. +#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */
  1993. +#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */
  1994. +#define NSIGILL 8
  1995. +
  1996. +/*
  1997. + * SIGFPE si_codes
  1998. + */
  1999. +#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */
  2000. +#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */
  2001. +#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */
  2002. +#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */
  2003. +#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */
  2004. +#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */
  2005. +#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */
  2006. +#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */
  2007. +#define NSIGFPE 8
  2008. +
  2009. +/*
  2010. + * SIGSEGV si_codes
  2011. + */
  2012. +#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
  2013. +#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
  2014. +#define NSIGSEGV 2
  2015. +
  2016. +/*
  2017. + * SIGBUS si_codes
  2018. + */
  2019. +#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */
  2020. +#define BUS_ADRERR (__SI_FAULT|2) /* non-existant physical address */
  2021. +#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */
  2022. +#define NSIGBUS 3
  2023. +
  2024. +/*
  2025. + * SIGTRAP si_codes
  2026. + */
  2027. +#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
  2028. +#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
  2029. +#define NSIGTRAP 2
  2030. +
  2031. +/*
  2032. + * SIGCHLD si_codes
  2033. + */
  2034. +#define CLD_EXITED (__SI_CHLD|1) /* child has exited */
  2035. +#define CLD_KILLED (__SI_CHLD|2) /* child was killed */
  2036. +#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */
  2037. +#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */
  2038. +#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */
  2039. +#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */
  2040. +#define NSIGCHLD 6
  2041. +
  2042. +/*
  2043. + * SIGPOLL si_codes
  2044. + */
  2045. +#define POLL_IN (__SI_POLL|1) /* data input available */
  2046. +#define POLL_OUT (__SI_POLL|2) /* output buffers available */
  2047. +#define POLL_MSG (__SI_POLL|3) /* input message available */
  2048. +#define POLL_ERR (__SI_POLL|4) /* i/o error */
  2049. +#define POLL_PRI (__SI_POLL|5) /* high priority input available */
  2050. +#define POLL_HUP (__SI_POLL|6) /* device disconnected */
  2051. +#define NSIGPOLL 6
  2052. +
  2053. +#endif
  2054. +
  2055. +/*
  2056. + * sigevent definitions
  2057. + *
  2058. + * It seems likely that SIGEV_THREAD will have to be handled from
  2059. + * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
  2060. + * thread manager then catches and does the appropriate nonsense.
  2061. + * However, everything is written out here so as to not get lost.
  2062. + */
  2063. +#define SIGEV_SIGNAL 0 /* notify via signal */
  2064. +#define SIGEV_NONE 1 /* other notification: meaningless */
  2065. +#define SIGEV_THREAD 2 /* deliver via thread creation */
  2066. +#define SIGEV_THREAD_ID 4 /* deliver to thread */
  2067. +
  2068. +#define SIGEV_MAX_SIZE 64
  2069. +#ifndef SIGEV_PAD_SIZE
  2070. +#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
  2071. +#endif
  2072. +
  2073. +#ifndef HAVE_ARCH_SIGEVENT_T
  2074. +
  2075. +typedef struct sigevent {
  2076. + sigval_t sigev_value;
  2077. + int sigev_signo;
  2078. + int sigev_notify;
  2079. + union {
  2080. + int _pad[SIGEV_PAD_SIZE];
  2081. + int _tid;
  2082. +
  2083. + struct {
  2084. + void (*_function)(sigval_t);
  2085. + void *_attribute; /* really pthread_attr_t */
  2086. + } _sigev_thread;
  2087. + } _sigev_un;
  2088. +} sigevent_t;
  2089. +
  2090. +#endif
  2091. +
  2092. +#define sigev_notify_function _sigev_un._sigev_thread._function
  2093. +#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
  2094. +#define sigev_notify_thread_id _sigev_un._tid
  2095. +
  2096. +#ifdef __KERNEL__
  2097. +
  2098. +struct siginfo;
  2099. +void do_schedule_next_timer(struct siginfo *info);
  2100. +
  2101. +#ifndef HAVE_ARCH_COPY_SIGINFO
  2102. +
  2103. +#include <linux/string.h>
  2104. +
  2105. +static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
  2106. +{
  2107. + if (from->si_code < 0)
  2108. + memcpy(to, from, sizeof(*to));
  2109. + else
  2110. + /* _sigchld is currently the largest know union member */
  2111. + memcpy(to, from, __ARCH_SI_PREAMBLE_SIZE + sizeof(from->_sifields._sigchld));
  2112. +}
  2113. +
  2114. +#endif
  2115. +
  2116. +extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from);
  2117. +
  2118. +#endif /* __KERNEL__ */
  2119. +
  2120. +#endif
  2121. --- linux/include/asm-generic/statfs.h
  2122. +++ linux/include/asm-generic/statfs.h
  2123. @@ -0,0 +1,51 @@
  2124. +#ifndef _GENERIC_STATFS_H
  2125. +#define _GENERIC_STATFS_H
  2126. +
  2127. +#ifndef __KERNEL_STRICT_NAMES
  2128. +# include <linux/types.h>
  2129. +typedef __kernel_fsid_t fsid_t;
  2130. +#endif
  2131. +
  2132. +struct statfs {
  2133. + __u32 f_type;
  2134. + __u32 f_bsize;
  2135. + __u32 f_blocks;
  2136. + __u32 f_bfree;
  2137. + __u32 f_bavail;
  2138. + __u32 f_files;
  2139. + __u32 f_ffree;
  2140. + __kernel_fsid_t f_fsid;
  2141. + __u32 f_namelen;
  2142. + __u32 f_frsize;
  2143. + __u32 f_spare[5];
  2144. +};
  2145. +
  2146. +struct statfs64 {
  2147. + __u32 f_type;
  2148. + __u32 f_bsize;
  2149. + __u64 f_blocks;
  2150. + __u64 f_bfree;
  2151. + __u64 f_bavail;
  2152. + __u64 f_files;
  2153. + __u64 f_ffree;
  2154. + __kernel_fsid_t f_fsid;
  2155. + __u32 f_namelen;
  2156. + __u32 f_frsize;
  2157. + __u32 f_spare[5];
  2158. +};
  2159. +
  2160. +struct compat_statfs64 {
  2161. + __u32 f_type;
  2162. + __u32 f_bsize;
  2163. + __u64 f_blocks;
  2164. + __u64 f_bfree;
  2165. + __u64 f_bavail;
  2166. + __u64 f_files;
  2167. + __u64 f_ffree;
  2168. + __kernel_fsid_t f_fsid;
  2169. + __u32 f_namelen;
  2170. + __u32 f_frsize;
  2171. + __u32 f_spare[5];
  2172. +};
  2173. +
  2174. +#endif
  2175. --- linux/include/asm-generic/tlb.h
  2176. +++ linux/include/asm-generic/tlb.h
  2177. @@ -0,0 +1,152 @@
  2178. +/* asm-generic/tlb.h
  2179. + *
  2180. + * Generic TLB shootdown code
  2181. + *
  2182. + * Copyright 2001 Red Hat, Inc.
  2183. + * Based on code from mm/memory.c Copyright Linus Torvalds and others.
  2184. + *
  2185. + * This program is free software; you can redistribute it and/or
  2186. + * modify it under the terms of the GNU General Public License
  2187. + * as published by the Free Software Foundation; either version
  2188. + * 2 of the License, or (at your option) any later version.
  2189. + */
  2190. +#ifndef _ASM_GENERIC__TLB_H
  2191. +#define _ASM_GENERIC__TLB_H
  2192. +
  2193. +// #include <linux/config.h>
  2194. +#include <linux/swap.h>
  2195. +#include <asm/pgalloc.h>
  2196. +#include <asm/tlbflush.h>
  2197. +
  2198. +/*
  2199. + * For UP we don't need to worry about TLB flush
  2200. + * and page free order so much..
  2201. + */
  2202. +#ifdef CONFIG_SMP
  2203. + #define FREE_PTE_NR 506
  2204. + #define tlb_fast_mode(tlb) ((tlb)->nr == ~0U)
  2205. +#else
  2206. + #define FREE_PTE_NR 1
  2207. + #define tlb_fast_mode(tlb) 1
  2208. +#endif
  2209. +
  2210. +/* struct mmu_gather is an opaque type used by the mm code for passing around
  2211. + * any data needed by arch specific code for tlb_remove_page. This structure
  2212. + * can be per-CPU or per-MM as the page table lock is held for the duration of
  2213. + * TLB shootdown.
  2214. + */
  2215. +struct mmu_gather {
  2216. + struct mm_struct *mm;
  2217. + unsigned int nr; /* set to ~0U means fast mode */
  2218. + unsigned int need_flush;/* Really unmapped some ptes? */
  2219. + unsigned int fullmm; /* non-zero means full mm flush */
  2220. + unsigned long freed;
  2221. + struct page * pages[FREE_PTE_NR];
  2222. +};
  2223. +
  2224. +/* Users of the generic TLB shootdown code must declare this storage space. */
  2225. +DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
  2226. +
  2227. +/* tlb_gather_mmu
  2228. + * Return a pointer to an initialized struct mmu_gather.
  2229. + */
  2230. +static inline struct mmu_gather *
  2231. +tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
  2232. +{
  2233. + struct mmu_gather *tlb = &per_cpu(mmu_gathers, smp_processor_id());
  2234. +
  2235. + tlb->mm = mm;
  2236. +
  2237. + /* Use fast mode if only one CPU is online */
  2238. + tlb->nr = num_online_cpus() > 1 ? 0U : ~0U;
  2239. +
  2240. + tlb->fullmm = full_mm_flush;
  2241. + tlb->freed = 0;
  2242. +
  2243. + return tlb;
  2244. +}
  2245. +
  2246. +static inline void
  2247. +tlb_flush_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
  2248. +{
  2249. + if (!tlb->need_flush)
  2250. + return;
  2251. + tlb->need_flush = 0;
  2252. + tlb_flush(tlb);
  2253. + if (!tlb_fast_mode(tlb)) {
  2254. + free_pages_and_swap_cache(tlb->pages, tlb->nr);
  2255. + tlb->nr = 0;
  2256. + }
  2257. +}
  2258. +
  2259. +/* tlb_finish_mmu
  2260. + * Called at the end of the shootdown operation to free up any resources
  2261. + * that were required. The page table lock is still held at this point.
  2262. + */
  2263. +static inline void
  2264. +tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
  2265. +{
  2266. + int freed = tlb->freed;
  2267. + struct mm_struct *mm = tlb->mm;
  2268. + int rss = mm->rss;
  2269. +
  2270. + if (rss < freed)
  2271. + freed = rss;
  2272. + mm->rss = rss - freed;
  2273. + tlb_flush_mmu(tlb, start, end);
  2274. +
  2275. + /* keep the page table cache within bounds */
  2276. + check_pgt_cache();
  2277. +}
  2278. +
  2279. +static inline unsigned int
  2280. +tlb_is_full_mm(struct mmu_gather *tlb)
  2281. +{
  2282. + return tlb->fullmm;
  2283. +}
  2284. +
  2285. +/* tlb_remove_page
  2286. + * Must perform the equivalent to __free_pte(pte_get_and_clear(ptep)), while
  2287. + * handling the additional races in SMP caused by other CPUs caching valid
  2288. + * mappings in their TLBs.
  2289. + */
  2290. +static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
  2291. +{
  2292. + tlb->need_flush = 1;
  2293. + if (tlb_fast_mode(tlb)) {
  2294. + free_page_and_swap_cache(page);
  2295. + return;
  2296. + }
  2297. + tlb->pages[tlb->nr++] = page;
  2298. + if (tlb->nr >= FREE_PTE_NR)
  2299. + tlb_flush_mmu(tlb, 0, 0);
  2300. +}
  2301. +
  2302. +/**
  2303. + * tlb_remove_tlb_entry - remember a pte unmapping for later tlb invalidation.
  2304. + *
  2305. + * Record the fact that pte's were really umapped in ->need_flush, so we can
  2306. + * later optimise away the tlb invalidate. This helps when userspace is
  2307. + * unmapping already-unmapped pages, which happens quite a lot.
  2308. + */
  2309. +#define tlb_remove_tlb_entry(tlb, ptep, address) \
  2310. + do { \
  2311. + tlb->need_flush = 1; \
  2312. + __tlb_remove_tlb_entry(tlb, ptep, address); \
  2313. + } while (0)
  2314. +
  2315. +#define pte_free_tlb(tlb, ptep) \
  2316. + do { \
  2317. + tlb->need_flush = 1; \
  2318. + __pte_free_tlb(tlb, ptep); \
  2319. + } while (0)
  2320. +
  2321. +#define pmd_free_tlb(tlb, pmdp) \
  2322. + do { \
  2323. + tlb->need_flush = 1; \
  2324. + __pmd_free_tlb(tlb, pmdp); \
  2325. + } while (0)
  2326. +
  2327. +#define tlb_migrate_finish(mm) do {} while (0)
  2328. +
  2329. +#endif /* _ASM_GENERIC__TLB_H */
  2330. --- linux/include/asm-generic/topology.h
  2331. +++ linux/include/asm-generic/topology.h
  2332. @@ -0,0 +1,53 @@
  2333. +/*
  2334. + * linux/include/asm-generic/topology.h
  2335. + *
  2336. + * Written by: Matthew Dobson, IBM Corporation
  2337. + *
  2338. + * Copyright (C) 2002, IBM Corp.
  2339. + *
  2340. + * All rights reserved.
  2341. + *
  2342. + * This program is free software; you can redistribute it and/or modify
  2343. + * it under the terms of the GNU General Public License as published by
  2344. + * the Free Software Foundation; either version 2 of the License, or
  2345. + * (at your option) any later version.
  2346. + *
  2347. + * This program is distributed in the hope that it will be useful, but
  2348. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  2349. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  2350. + * NON INFRINGEMENT. See the GNU General Public License for more
  2351. + * details.
  2352. + *
  2353. + * You should have received a copy of the GNU General Public License
  2354. + * along with this program; if not, write to the Free Software
  2355. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2356. + *
  2357. + * Send feedback to <colpatch@us.ibm.com>
  2358. + */
  2359. +#ifndef _ASM_GENERIC_TOPOLOGY_H
  2360. +#define _ASM_GENERIC_TOPOLOGY_H
  2361. +
  2362. +/* Other architectures wishing to use this simple topology API should fill
  2363. + in the below functions as appropriate in their own <asm/topology.h> file. */
  2364. +#ifndef cpu_to_node
  2365. +#define cpu_to_node(cpu) (0)
  2366. +#endif
  2367. +#ifndef parent_node
  2368. +#define parent_node(node) (0)
  2369. +#endif
  2370. +#ifndef node_to_cpumask
  2371. +#define node_to_cpumask(node) (cpu_online_map)
  2372. +#endif
  2373. +#ifndef node_to_first_cpu
  2374. +#define node_to_first_cpu(node) (0)
  2375. +#endif
  2376. +#ifndef pcibus_to_cpumask
  2377. +#define pcibus_to_cpumask(bus) (cpu_online_map)
  2378. +#endif
  2379. +
  2380. +/* Cross-node load balancing interval. */
  2381. +#ifndef NODE_BALANCE_RATE
  2382. +#define NODE_BALANCE_RATE 10
  2383. +#endif
  2384. +
  2385. +#endif /* _ASM_GENERIC_TOPOLOGY_H */
  2386. --- linux/include/asm-generic/uaccess.h
  2387. +++ linux/include/asm-generic/uaccess.h
  2388. @@ -0,0 +1,26 @@
  2389. +#ifndef _ASM_GENERIC_UACCESS_H_
  2390. +#define _ASM_GENERIC_UACCESS_H_
  2391. +
  2392. +/*
  2393. + * This macro should be used instead of __get_user() when accessing
  2394. + * values at locations that are not known to be aligned.
  2395. + */
  2396. +#define __get_user_unaligned(x, ptr) \
  2397. +({ \
  2398. + __typeof__ (*(ptr)) __x; \
  2399. + __copy_from_user(&__x, (ptr), sizeof(*(ptr))) ? -EFAULT : 0; \
  2400. + (x) = __x; \
  2401. +})
  2402. +
  2403. +
  2404. +/*
  2405. + * This macro should be used instead of __put_user() when accessing
  2406. + * values at locations that are not known to be aligned.
  2407. + */
  2408. +#define __put_user_unaligned(x, ptr) \
  2409. +({ \
  2410. + __typeof__ (*(ptr)) __x = (x); \
  2411. + __copy_to_user((ptr), &__x, sizeof(*(ptr))) ? -EFAULT : 0; \
  2412. +})
  2413. +
  2414. +#endif /* _ASM_GENERIC_UACCESS_H */
  2415. --- linux/include/asm-generic/unaligned.h
  2416. +++ linux/include/asm-generic/unaligned.h
  2417. @@ -0,0 +1,20 @@
  2418. +#ifndef _ASM_GENERIC_UNALIGNED_H_
  2419. +#define _ASM_GENERIC_UNALIGNED_H_
  2420. +
  2421. +/*
  2422. + * For the benefit of those who are trying to port Linux to another
  2423. + * architecture, here are some C-language equivalents.
  2424. + */
  2425. +
  2426. +#include <asm/string.h>
  2427. +
  2428. +
  2429. +#define get_unaligned(ptr) \
  2430. + ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
  2431. +
  2432. +#define put_unaligned(val, ptr) \
  2433. + ({ __typeof__(*(ptr)) __tmp = (val); \
  2434. + memcpy((ptr), &__tmp, sizeof(*(ptr))); \
  2435. + (void)0; })
  2436. +
  2437. +#endif /* _ASM_GENERIC_UNALIGNED_H */
  2438. --- linux/include/asm-generic/vmlinux.lds.h
  2439. +++ linux/include/asm-generic/vmlinux.lds.h
  2440. @@ -0,0 +1,84 @@
  2441. +#ifndef LOAD_OFFSET
  2442. +#define LOAD_OFFSET 0
  2443. +#endif
  2444. +
  2445. +#ifndef VMLINUX_SYMBOL
  2446. +#define VMLINUX_SYMBOL(_sym_) _sym_
  2447. +#endif
  2448. +
  2449. +#define RODATA \
  2450. + .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
  2451. + *(.rodata) *(.rodata.*) \
  2452. + *(__vermagic) /* Kernel version magic */ \
  2453. + } \
  2454. + \
  2455. + .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
  2456. + *(.rodata1) \
  2457. + } \
  2458. + \
  2459. + /* PCI quirks */ \
  2460. + .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
  2461. + VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
  2462. + *(.pci_fixup_header) \
  2463. + VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
  2464. + VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
  2465. + *(.pci_fixup_final) \
  2466. + VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
  2467. + } \
  2468. + \
  2469. + /* Kernel symbol table: Normal symbols */ \
  2470. + __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
  2471. + VMLINUX_SYMBOL(__start___ksymtab) = .; \
  2472. + *(__ksymtab) \
  2473. + VMLINUX_SYMBOL(__stop___ksymtab) = .; \
  2474. + } \
  2475. + \
  2476. + /* Kernel symbol table: GPL-only symbols */ \
  2477. + __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
  2478. + VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
  2479. + *(__ksymtab_gpl) \
  2480. + VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
  2481. + } \
  2482. + \
  2483. + /* Kernel symbol table: Normal symbols */ \
  2484. + __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
  2485. + VMLINUX_SYMBOL(__start___kcrctab) = .; \
  2486. + *(__kcrctab) \
  2487. + VMLINUX_SYMBOL(__stop___kcrctab) = .; \
  2488. + } \
  2489. + \
  2490. + /* Kernel symbol table: GPL-only symbols */ \
  2491. + __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
  2492. + VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
  2493. + *(__kcrctab_gpl) \
  2494. + VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
  2495. + } \
  2496. + \
  2497. + /* Kernel symbol table: strings */ \
  2498. + __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
  2499. + *(__ksymtab_strings) \
  2500. + } \
  2501. + \
  2502. + /* Built-in module parameters. */ \
  2503. + __param : AT(ADDR(__param) - LOAD_OFFSET) { \
  2504. + VMLINUX_SYMBOL(__start___param) = .; \
  2505. + *(__param) \
  2506. + VMLINUX_SYMBOL(__stop___param) = .; \
  2507. + }
  2508. +
  2509. +#define SECURITY_INIT \
  2510. + .security_initcall.init : { \
  2511. + VMLINUX_SYMBOL(__security_initcall_start) = .; \
  2512. + *(.security_initcall.init) \
  2513. + VMLINUX_SYMBOL(__security_initcall_end) = .; \
  2514. + }
  2515. +
  2516. +#define SCHED_TEXT \
  2517. + VMLINUX_SYMBOL(__sched_text_start) = .; \
  2518. + *(.sched.text) \
  2519. + VMLINUX_SYMBOL(__sched_text_end) = .;
  2520. +
  2521. +#define LOCK_TEXT \
  2522. + VMLINUX_SYMBOL(__lock_text_start) = .; \
  2523. + *(.spinlock.text) \
  2524. + VMLINUX_SYMBOL(__lock_text_end) = .;
  2525. --- linux/include/asm-generic/xor.h
  2526. +++ linux/include/asm-generic/xor.h
  2527. @@ -0,0 +1,718 @@
  2528. +/*
  2529. + * include/asm-generic/xor.h
  2530. + *
  2531. + * Generic optimized RAID-5 checksumming functions.
  2532. + *
  2533. + * This program is free software; you can redistribute it and/or modify
  2534. + * it under the terms of the GNU General Public License as published by
  2535. + * the Free Software Foundation; either version 2, or (at your option)
  2536. + * any later version.
  2537. + *
  2538. + * You should have received a copy of the GNU General Public License
  2539. + * (for example /usr/src/linux/COPYING); if not, write to the Free
  2540. + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2541. + */
  2542. +
  2543. +#include <asm/processor.h>
  2544. +
  2545. +static void
  2546. +xor_8regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  2547. +{
  2548. + long lines = bytes / (sizeof (long)) / 8;
  2549. +
  2550. + do {
  2551. + p1[0] ^= p2[0];
  2552. + p1[1] ^= p2[1];
  2553. + p1[2] ^= p2[2];
  2554. + p1[3] ^= p2[3];
  2555. + p1[4] ^= p2[4];
  2556. + p1[5] ^= p2[5];
  2557. + p1[6] ^= p2[6];
  2558. + p1[7] ^= p2[7];
  2559. + p1 += 8;
  2560. + p2 += 8;
  2561. + } while (--lines > 0);
  2562. +}
  2563. +
  2564. +static void
  2565. +xor_8regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2566. + unsigned long *p3)
  2567. +{
  2568. + long lines = bytes / (sizeof (long)) / 8;
  2569. +
  2570. + do {
  2571. + p1[0] ^= p2[0] ^ p3[0];
  2572. + p1[1] ^= p2[1] ^ p3[1];
  2573. + p1[2] ^= p2[2] ^ p3[2];
  2574. + p1[3] ^= p2[3] ^ p3[3];
  2575. + p1[4] ^= p2[4] ^ p3[4];
  2576. + p1[5] ^= p2[5] ^ p3[5];
  2577. + p1[6] ^= p2[6] ^ p3[6];
  2578. + p1[7] ^= p2[7] ^ p3[7];
  2579. + p1 += 8;
  2580. + p2 += 8;
  2581. + p3 += 8;
  2582. + } while (--lines > 0);
  2583. +}
  2584. +
  2585. +static void
  2586. +xor_8regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2587. + unsigned long *p3, unsigned long *p4)
  2588. +{
  2589. + long lines = bytes / (sizeof (long)) / 8;
  2590. +
  2591. + do {
  2592. + p1[0] ^= p2[0] ^ p3[0] ^ p4[0];
  2593. + p1[1] ^= p2[1] ^ p3[1] ^ p4[1];
  2594. + p1[2] ^= p2[2] ^ p3[2] ^ p4[2];
  2595. + p1[3] ^= p2[3] ^ p3[3] ^ p4[3];
  2596. + p1[4] ^= p2[4] ^ p3[4] ^ p4[4];
  2597. + p1[5] ^= p2[5] ^ p3[5] ^ p4[5];
  2598. + p1[6] ^= p2[6] ^ p3[6] ^ p4[6];
  2599. + p1[7] ^= p2[7] ^ p3[7] ^ p4[7];
  2600. + p1 += 8;
  2601. + p2 += 8;
  2602. + p3 += 8;
  2603. + p4 += 8;
  2604. + } while (--lines > 0);
  2605. +}
  2606. +
  2607. +static void
  2608. +xor_8regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2609. + unsigned long *p3, unsigned long *p4, unsigned long *p5)
  2610. +{
  2611. + long lines = bytes / (sizeof (long)) / 8;
  2612. +
  2613. + do {
  2614. + p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0];
  2615. + p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1];
  2616. + p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2];
  2617. + p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3];
  2618. + p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4];
  2619. + p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5];
  2620. + p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6];
  2621. + p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7];
  2622. + p1 += 8;
  2623. + p2 += 8;
  2624. + p3 += 8;
  2625. + p4 += 8;
  2626. + p5 += 8;
  2627. + } while (--lines > 0);
  2628. +}
  2629. +
  2630. +static void
  2631. +xor_32regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  2632. +{
  2633. + long lines = bytes / (sizeof (long)) / 8;
  2634. +
  2635. + do {
  2636. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  2637. + d0 = p1[0]; /* Pull the stuff into registers */
  2638. + d1 = p1[1]; /* ... in bursts, if possible. */
  2639. + d2 = p1[2];
  2640. + d3 = p1[3];
  2641. + d4 = p1[4];
  2642. + d5 = p1[5];
  2643. + d6 = p1[6];
  2644. + d7 = p1[7];
  2645. + d0 ^= p2[0];
  2646. + d1 ^= p2[1];
  2647. + d2 ^= p2[2];
  2648. + d3 ^= p2[3];
  2649. + d4 ^= p2[4];
  2650. + d5 ^= p2[5];
  2651. + d6 ^= p2[6];
  2652. + d7 ^= p2[7];
  2653. + p1[0] = d0; /* Store the result (in bursts) */
  2654. + p1[1] = d1;
  2655. + p1[2] = d2;
  2656. + p1[3] = d3;
  2657. + p1[4] = d4;
  2658. + p1[5] = d5;
  2659. + p1[6] = d6;
  2660. + p1[7] = d7;
  2661. + p1 += 8;
  2662. + p2 += 8;
  2663. + } while (--lines > 0);
  2664. +}
  2665. +
  2666. +static void
  2667. +xor_32regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2668. + unsigned long *p3)
  2669. +{
  2670. + long lines = bytes / (sizeof (long)) / 8;
  2671. +
  2672. + do {
  2673. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  2674. + d0 = p1[0]; /* Pull the stuff into registers */
  2675. + d1 = p1[1]; /* ... in bursts, if possible. */
  2676. + d2 = p1[2];
  2677. + d3 = p1[3];
  2678. + d4 = p1[4];
  2679. + d5 = p1[5];
  2680. + d6 = p1[6];
  2681. + d7 = p1[7];
  2682. + d0 ^= p2[0];
  2683. + d1 ^= p2[1];
  2684. + d2 ^= p2[2];
  2685. + d3 ^= p2[3];
  2686. + d4 ^= p2[4];
  2687. + d5 ^= p2[5];
  2688. + d6 ^= p2[6];
  2689. + d7 ^= p2[7];
  2690. + d0 ^= p3[0];
  2691. + d1 ^= p3[1];
  2692. + d2 ^= p3[2];
  2693. + d3 ^= p3[3];
  2694. + d4 ^= p3[4];
  2695. + d5 ^= p3[5];
  2696. + d6 ^= p3[6];
  2697. + d7 ^= p3[7];
  2698. + p1[0] = d0; /* Store the result (in bursts) */
  2699. + p1[1] = d1;
  2700. + p1[2] = d2;
  2701. + p1[3] = d3;
  2702. + p1[4] = d4;
  2703. + p1[5] = d5;
  2704. + p1[6] = d6;
  2705. + p1[7] = d7;
  2706. + p1 += 8;
  2707. + p2 += 8;
  2708. + p3 += 8;
  2709. + } while (--lines > 0);
  2710. +}
  2711. +
  2712. +static void
  2713. +xor_32regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2714. + unsigned long *p3, unsigned long *p4)
  2715. +{
  2716. + long lines = bytes / (sizeof (long)) / 8;
  2717. +
  2718. + do {
  2719. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  2720. + d0 = p1[0]; /* Pull the stuff into registers */
  2721. + d1 = p1[1]; /* ... in bursts, if possible. */
  2722. + d2 = p1[2];
  2723. + d3 = p1[3];
  2724. + d4 = p1[4];
  2725. + d5 = p1[5];
  2726. + d6 = p1[6];
  2727. + d7 = p1[7];
  2728. + d0 ^= p2[0];
  2729. + d1 ^= p2[1];
  2730. + d2 ^= p2[2];
  2731. + d3 ^= p2[3];
  2732. + d4 ^= p2[4];
  2733. + d5 ^= p2[5];
  2734. + d6 ^= p2[6];
  2735. + d7 ^= p2[7];
  2736. + d0 ^= p3[0];
  2737. + d1 ^= p3[1];
  2738. + d2 ^= p3[2];
  2739. + d3 ^= p3[3];
  2740. + d4 ^= p3[4];
  2741. + d5 ^= p3[5];
  2742. + d6 ^= p3[6];
  2743. + d7 ^= p3[7];
  2744. + d0 ^= p4[0];
  2745. + d1 ^= p4[1];
  2746. + d2 ^= p4[2];
  2747. + d3 ^= p4[3];
  2748. + d4 ^= p4[4];
  2749. + d5 ^= p4[5];
  2750. + d6 ^= p4[6];
  2751. + d7 ^= p4[7];
  2752. + p1[0] = d0; /* Store the result (in bursts) */
  2753. + p1[1] = d1;
  2754. + p1[2] = d2;
  2755. + p1[3] = d3;
  2756. + p1[4] = d4;
  2757. + p1[5] = d5;
  2758. + p1[6] = d6;
  2759. + p1[7] = d7;
  2760. + p1 += 8;
  2761. + p2 += 8;
  2762. + p3 += 8;
  2763. + p4 += 8;
  2764. + } while (--lines > 0);
  2765. +}
  2766. +
  2767. +static void
  2768. +xor_32regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2769. + unsigned long *p3, unsigned long *p4, unsigned long *p5)
  2770. +{
  2771. + long lines = bytes / (sizeof (long)) / 8;
  2772. +
  2773. + do {
  2774. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  2775. + d0 = p1[0]; /* Pull the stuff into registers */
  2776. + d1 = p1[1]; /* ... in bursts, if possible. */
  2777. + d2 = p1[2];
  2778. + d3 = p1[3];
  2779. + d4 = p1[4];
  2780. + d5 = p1[5];
  2781. + d6 = p1[6];
  2782. + d7 = p1[7];
  2783. + d0 ^= p2[0];
  2784. + d1 ^= p2[1];
  2785. + d2 ^= p2[2];
  2786. + d3 ^= p2[3];
  2787. + d4 ^= p2[4];
  2788. + d5 ^= p2[5];
  2789. + d6 ^= p2[6];
  2790. + d7 ^= p2[7];
  2791. + d0 ^= p3[0];
  2792. + d1 ^= p3[1];
  2793. + d2 ^= p3[2];
  2794. + d3 ^= p3[3];
  2795. + d4 ^= p3[4];
  2796. + d5 ^= p3[5];
  2797. + d6 ^= p3[6];
  2798. + d7 ^= p3[7];
  2799. + d0 ^= p4[0];
  2800. + d1 ^= p4[1];
  2801. + d2 ^= p4[2];
  2802. + d3 ^= p4[3];
  2803. + d4 ^= p4[4];
  2804. + d5 ^= p4[5];
  2805. + d6 ^= p4[6];
  2806. + d7 ^= p4[7];
  2807. + d0 ^= p5[0];
  2808. + d1 ^= p5[1];
  2809. + d2 ^= p5[2];
  2810. + d3 ^= p5[3];
  2811. + d4 ^= p5[4];
  2812. + d5 ^= p5[5];
  2813. + d6 ^= p5[6];
  2814. + d7 ^= p5[7];
  2815. + p1[0] = d0; /* Store the result (in bursts) */
  2816. + p1[1] = d1;
  2817. + p1[2] = d2;
  2818. + p1[3] = d3;
  2819. + p1[4] = d4;
  2820. + p1[5] = d5;
  2821. + p1[6] = d6;
  2822. + p1[7] = d7;
  2823. + p1 += 8;
  2824. + p2 += 8;
  2825. + p3 += 8;
  2826. + p4 += 8;
  2827. + p5 += 8;
  2828. + } while (--lines > 0);
  2829. +}
  2830. +
  2831. +static void
  2832. +xor_8regs_p_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  2833. +{
  2834. + long lines = bytes / (sizeof (long)) / 8 - 1;
  2835. + prefetchw(p1);
  2836. + prefetch(p2);
  2837. +
  2838. + do {
  2839. + prefetchw(p1+8);
  2840. + prefetch(p2+8);
  2841. + once_more:
  2842. + p1[0] ^= p2[0];
  2843. + p1[1] ^= p2[1];
  2844. + p1[2] ^= p2[2];
  2845. + p1[3] ^= p2[3];
  2846. + p1[4] ^= p2[4];
  2847. + p1[5] ^= p2[5];
  2848. + p1[6] ^= p2[6];
  2849. + p1[7] ^= p2[7];
  2850. + p1 += 8;
  2851. + p2 += 8;
  2852. + } while (--lines > 0);
  2853. + if (lines == 0)
  2854. + goto once_more;
  2855. +}
  2856. +
  2857. +static void
  2858. +xor_8regs_p_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2859. + unsigned long *p3)
  2860. +{
  2861. + long lines = bytes / (sizeof (long)) / 8 - 1;
  2862. + prefetchw(p1);
  2863. + prefetch(p2);
  2864. + prefetch(p3);
  2865. +
  2866. + do {
  2867. + prefetchw(p1+8);
  2868. + prefetch(p2+8);
  2869. + prefetch(p3+8);
  2870. + once_more:
  2871. + p1[0] ^= p2[0] ^ p3[0];
  2872. + p1[1] ^= p2[1] ^ p3[1];
  2873. + p1[2] ^= p2[2] ^ p3[2];
  2874. + p1[3] ^= p2[3] ^ p3[3];
  2875. + p1[4] ^= p2[4] ^ p3[4];
  2876. + p1[5] ^= p2[5] ^ p3[5];
  2877. + p1[6] ^= p2[6] ^ p3[6];
  2878. + p1[7] ^= p2[7] ^ p3[7];
  2879. + p1 += 8;
  2880. + p2 += 8;
  2881. + p3 += 8;
  2882. + } while (--lines > 0);
  2883. + if (lines == 0)
  2884. + goto once_more;
  2885. +}
  2886. +
  2887. +static void
  2888. +xor_8regs_p_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2889. + unsigned long *p3, unsigned long *p4)
  2890. +{
  2891. + long lines = bytes / (sizeof (long)) / 8 - 1;
  2892. +
  2893. + prefetchw(p1);
  2894. + prefetch(p2);
  2895. + prefetch(p3);
  2896. + prefetch(p4);
  2897. +
  2898. + do {
  2899. + prefetchw(p1+8);
  2900. + prefetch(p2+8);
  2901. + prefetch(p3+8);
  2902. + prefetch(p4+8);
  2903. + once_more:
  2904. + p1[0] ^= p2[0] ^ p3[0] ^ p4[0];
  2905. + p1[1] ^= p2[1] ^ p3[1] ^ p4[1];
  2906. + p1[2] ^= p2[2] ^ p3[2] ^ p4[2];
  2907. + p1[3] ^= p2[3] ^ p3[3] ^ p4[3];
  2908. + p1[4] ^= p2[4] ^ p3[4] ^ p4[4];
  2909. + p1[5] ^= p2[5] ^ p3[5] ^ p4[5];
  2910. + p1[6] ^= p2[6] ^ p3[6] ^ p4[6];
  2911. + p1[7] ^= p2[7] ^ p3[7] ^ p4[7];
  2912. + p1 += 8;
  2913. + p2 += 8;
  2914. + p3 += 8;
  2915. + p4 += 8;
  2916. + } while (--lines > 0);
  2917. + if (lines == 0)
  2918. + goto once_more;
  2919. +}
  2920. +
  2921. +static void
  2922. +xor_8regs_p_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  2923. + unsigned long *p3, unsigned long *p4, unsigned long *p5)
  2924. +{
  2925. + long lines = bytes / (sizeof (long)) / 8 - 1;
  2926. +
  2927. + prefetchw(p1);
  2928. + prefetch(p2);
  2929. + prefetch(p3);
  2930. + prefetch(p4);
  2931. + prefetch(p5);
  2932. +
  2933. + do {
  2934. + prefetchw(p1+8);
  2935. + prefetch(p2+8);
  2936. + prefetch(p3+8);
  2937. + prefetch(p4+8);
  2938. + prefetch(p5+8);
  2939. + once_more:
  2940. + p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0];
  2941. + p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1];
  2942. + p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2];
  2943. + p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3];
  2944. + p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4];
  2945. + p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5];
  2946. + p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6];
  2947. + p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7];
  2948. + p1 += 8;
  2949. + p2 += 8;
  2950. + p3 += 8;
  2951. + p4 += 8;
  2952. + p5 += 8;
  2953. + } while (--lines > 0);
  2954. + if (lines == 0)
  2955. + goto once_more;
  2956. +}
  2957. +
  2958. +static void
  2959. +xor_32regs_p_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  2960. +{
  2961. + long lines = bytes / (sizeof (long)) / 8 - 1;
  2962. +
  2963. + prefetchw(p1);
  2964. + prefetch(p2);
  2965. +
  2966. + do {
  2967. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  2968. +
  2969. + prefetchw(p1+8);
  2970. + prefetch(p2+8);
  2971. + once_more:
  2972. + d0 = p1[0]; /* Pull the stuff into registers */
  2973. + d1 = p1[1]; /* ... in bursts, if possible. */
  2974. + d2 = p1[2];
  2975. + d3 = p1[3];
  2976. + d4 = p1[4];
  2977. + d5 = p1[5];
  2978. + d6 = p1[6];
  2979. + d7 = p1[7];
  2980. + d0 ^= p2[0];
  2981. + d1 ^= p2[1];
  2982. + d2 ^= p2[2];
  2983. + d3 ^= p2[3];
  2984. + d4 ^= p2[4];
  2985. + d5 ^= p2[5];
  2986. + d6 ^= p2[6];
  2987. + d7 ^= p2[7];
  2988. + p1[0] = d0; /* Store the result (in bursts) */
  2989. + p1[1] = d1;
  2990. + p1[2] = d2;
  2991. + p1[3] = d3;
  2992. + p1[4] = d4;
  2993. + p1[5] = d5;
  2994. + p1[6] = d6;
  2995. + p1[7] = d7;
  2996. + p1 += 8;
  2997. + p2 += 8;
  2998. + } while (--lines > 0);
  2999. + if (lines == 0)
  3000. + goto once_more;
  3001. +}
  3002. +
  3003. +static void
  3004. +xor_32regs_p_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3005. + unsigned long *p3)
  3006. +{
  3007. + long lines = bytes / (sizeof (long)) / 8 - 1;
  3008. +
  3009. + prefetchw(p1);
  3010. + prefetch(p2);
  3011. + prefetch(p3);
  3012. +
  3013. + do {
  3014. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  3015. +
  3016. + prefetchw(p1+8);
  3017. + prefetch(p2+8);
  3018. + prefetch(p3+8);
  3019. + once_more:
  3020. + d0 = p1[0]; /* Pull the stuff into registers */
  3021. + d1 = p1[1]; /* ... in bursts, if possible. */
  3022. + d2 = p1[2];
  3023. + d3 = p1[3];
  3024. + d4 = p1[4];
  3025. + d5 = p1[5];
  3026. + d6 = p1[6];
  3027. + d7 = p1[7];
  3028. + d0 ^= p2[0];
  3029. + d1 ^= p2[1];
  3030. + d2 ^= p2[2];
  3031. + d3 ^= p2[3];
  3032. + d4 ^= p2[4];
  3033. + d5 ^= p2[5];
  3034. + d6 ^= p2[6];
  3035. + d7 ^= p2[7];
  3036. + d0 ^= p3[0];
  3037. + d1 ^= p3[1];
  3038. + d2 ^= p3[2];
  3039. + d3 ^= p3[3];
  3040. + d4 ^= p3[4];
  3041. + d5 ^= p3[5];
  3042. + d6 ^= p3[6];
  3043. + d7 ^= p3[7];
  3044. + p1[0] = d0; /* Store the result (in bursts) */
  3045. + p1[1] = d1;
  3046. + p1[2] = d2;
  3047. + p1[3] = d3;
  3048. + p1[4] = d4;
  3049. + p1[5] = d5;
  3050. + p1[6] = d6;
  3051. + p1[7] = d7;
  3052. + p1 += 8;
  3053. + p2 += 8;
  3054. + p3 += 8;
  3055. + } while (--lines > 0);
  3056. + if (lines == 0)
  3057. + goto once_more;
  3058. +}
  3059. +
  3060. +static void
  3061. +xor_32regs_p_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3062. + unsigned long *p3, unsigned long *p4)
  3063. +{
  3064. + long lines = bytes / (sizeof (long)) / 8 - 1;
  3065. +
  3066. + prefetchw(p1);
  3067. + prefetch(p2);
  3068. + prefetch(p3);
  3069. + prefetch(p4);
  3070. +
  3071. + do {
  3072. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  3073. +
  3074. + prefetchw(p1+8);
  3075. + prefetch(p2+8);
  3076. + prefetch(p3+8);
  3077. + prefetch(p4+8);
  3078. + once_more:
  3079. + d0 = p1[0]; /* Pull the stuff into registers */
  3080. + d1 = p1[1]; /* ... in bursts, if possible. */
  3081. + d2 = p1[2];
  3082. + d3 = p1[3];
  3083. + d4 = p1[4];
  3084. + d5 = p1[5];
  3085. + d6 = p1[6];
  3086. + d7 = p1[7];
  3087. + d0 ^= p2[0];
  3088. + d1 ^= p2[1];
  3089. + d2 ^= p2[2];
  3090. + d3 ^= p2[3];
  3091. + d4 ^= p2[4];
  3092. + d5 ^= p2[5];
  3093. + d6 ^= p2[6];
  3094. + d7 ^= p2[7];
  3095. + d0 ^= p3[0];
  3096. + d1 ^= p3[1];
  3097. + d2 ^= p3[2];
  3098. + d3 ^= p3[3];
  3099. + d4 ^= p3[4];
  3100. + d5 ^= p3[5];
  3101. + d6 ^= p3[6];
  3102. + d7 ^= p3[7];
  3103. + d0 ^= p4[0];
  3104. + d1 ^= p4[1];
  3105. + d2 ^= p4[2];
  3106. + d3 ^= p4[3];
  3107. + d4 ^= p4[4];
  3108. + d5 ^= p4[5];
  3109. + d6 ^= p4[6];
  3110. + d7 ^= p4[7];
  3111. + p1[0] = d0; /* Store the result (in bursts) */
  3112. + p1[1] = d1;
  3113. + p1[2] = d2;
  3114. + p1[3] = d3;
  3115. + p1[4] = d4;
  3116. + p1[5] = d5;
  3117. + p1[6] = d6;
  3118. + p1[7] = d7;
  3119. + p1 += 8;
  3120. + p2 += 8;
  3121. + p3 += 8;
  3122. + p4 += 8;
  3123. + } while (--lines > 0);
  3124. + if (lines == 0)
  3125. + goto once_more;
  3126. +}
  3127. +
  3128. +static void
  3129. +xor_32regs_p_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  3130. + unsigned long *p3, unsigned long *p4, unsigned long *p5)
  3131. +{
  3132. + long lines = bytes / (sizeof (long)) / 8 - 1;
  3133. +
  3134. + prefetchw(p1);
  3135. + prefetch(p2);
  3136. + prefetch(p3);
  3137. + prefetch(p4);
  3138. + prefetch(p5);
  3139. +
  3140. + do {
  3141. + register long d0, d1, d2, d3, d4, d5, d6, d7;
  3142. +
  3143. + prefetchw(p1+8);
  3144. + prefetch(p2+8);
  3145. + prefetch(p3+8);
  3146. + prefetch(p4+8);
  3147. + prefetch(p5+8);
  3148. + once_more:
  3149. + d0 = p1[0]; /* Pull the stuff into registers */
  3150. + d1 = p1[1]; /* ... in bursts, if possible. */
  3151. + d2 = p1[2];
  3152. + d3 = p1[3];
  3153. + d4 = p1[4];
  3154. + d5 = p1[5];
  3155. + d6 = p1[6];
  3156. + d7 = p1[7];
  3157. + d0 ^= p2[0];
  3158. + d1 ^= p2[1];
  3159. + d2 ^= p2[2];
  3160. + d3 ^= p2[3];
  3161. + d4 ^= p2[4];
  3162. + d5 ^= p2[5];
  3163. + d6 ^= p2[6];
  3164. + d7 ^= p2[7];
  3165. + d0 ^= p3[0];
  3166. + d1 ^= p3[1];
  3167. + d2 ^= p3[2];
  3168. + d3 ^= p3[3];
  3169. + d4 ^= p3[4];
  3170. + d5 ^= p3[5];
  3171. + d6 ^= p3[6];
  3172. + d7 ^= p3[7];
  3173. + d0 ^= p4[0];
  3174. + d1 ^= p4[1];
  3175. + d2 ^= p4[2];
  3176. + d3 ^= p4[3];
  3177. + d4 ^= p4[4];
  3178. + d5 ^= p4[5];
  3179. + d6 ^= p4[6];
  3180. + d7 ^= p4[7];
  3181. + d0 ^= p5[0];
  3182. + d1 ^= p5[1];
  3183. + d2 ^= p5[2];
  3184. + d3 ^= p5[3];
  3185. + d4 ^= p5[4];
  3186. + d5 ^= p5[5];
  3187. + d6 ^= p5[6];
  3188. + d7 ^= p5[7];
  3189. + p1[0] = d0; /* Store the result (in bursts) */
  3190. + p1[1] = d1;
  3191. + p1[2] = d2;
  3192. + p1[3] = d3;
  3193. + p1[4] = d4;
  3194. + p1[5] = d5;
  3195. + p1[6] = d6;
  3196. + p1[7] = d7;
  3197. + p1 += 8;
  3198. + p2 += 8;
  3199. + p3 += 8;
  3200. + p4 += 8;
  3201. + p5 += 8;
  3202. + } while (--lines > 0);
  3203. + if (lines == 0)
  3204. + goto once_more;
  3205. +}
  3206. +
  3207. +static struct xor_block_template xor_block_8regs = {
  3208. + .name = "8regs",
  3209. + .do_2 = xor_8regs_2,
  3210. + .do_3 = xor_8regs_3,
  3211. + .do_4 = xor_8regs_4,
  3212. + .do_5 = xor_8regs_5,
  3213. +};
  3214. +
  3215. +static struct xor_block_template xor_block_32regs = {
  3216. + .name = "32regs",
  3217. + .do_2 = xor_32regs_2,
  3218. + .do_3 = xor_32regs_3,
  3219. + .do_4 = xor_32regs_4,
  3220. + .do_5 = xor_32regs_5,
  3221. +};
  3222. +
  3223. +static struct xor_block_template xor_block_8regs_p = {
  3224. + .name = "8regs_prefetch",
  3225. + .do_2 = xor_8regs_p_2,
  3226. + .do_3 = xor_8regs_p_3,
  3227. + .do_4 = xor_8regs_p_4,
  3228. + .do_5 = xor_8regs_p_5,
  3229. +};
  3230. +
  3231. +static struct xor_block_template xor_block_32regs_p = {
  3232. + .name = "32regs_prefetch",
  3233. + .do_2 = xor_32regs_p_2,
  3234. + .do_3 = xor_32regs_p_3,
  3235. + .do_4 = xor_32regs_p_4,
  3236. + .do_5 = xor_32regs_p_5,
  3237. +};
  3238. +
  3239. +#define XOR_TRY_TEMPLATES \
  3240. + do { \
  3241. + xor_speed(&xor_block_8regs); \
  3242. + xor_speed(&xor_block_8regs_p); \
  3243. + xor_speed(&xor_block_32regs); \
  3244. + xor_speed(&xor_block_32regs_p); \
  3245. + } while (0)
  3246. --- linux/include/asm-nios2nommu/ChangeLog
  3247. +++ linux/include/asm-nios2nommu/ChangeLog
  3248. @@ -0,0 +1,14 @@
  3249. +2004-06-29 Ken Hill <khill@microtronix.com>
  3250. +
  3251. + * bitops.h (find_next_zero_bit): Fix problem with with masking for found_first
  3252. + handling. The masking of the upper bits for size < 32 bits would set all
  3253. + the bits to 1. Removing any zero's there may have been.
  3254. +
  3255. +2004-06-02 Ken Hill <khill@microtronix.com>
  3256. +
  3257. + * processor.h (TASK_SIZE): Change na_sdram_end to nasys_program_mem_end to remove
  3258. + dependancy on quartus memory component name.
  3259. +
  3260. + * page.h (PAGE_OFFSET): Change na_sdram to nasys_program_mem to remove
  3261. + dependancy on quartus memory component name.
  3262. +
  3263. --- linux/include/asm-nios2nommu/a.out.h
  3264. +++ linux/include/asm-nios2nommu/a.out.h
  3265. @@ -0,0 +1,85 @@
  3266. +/* $Id: a.out.h,v 1.4 2004/03/30 19:35:04 ken-h Exp $ */
  3267. +/*
  3268. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  3269. + *
  3270. + * All rights reserved.
  3271. + *
  3272. + * This program is free software; you can redistribute it and/or modify
  3273. + * it under the terms of the GNU General Public License as published by
  3274. + * the Free Software Foundation; either version 2 of the License, or
  3275. + * (at your option) any later version.
  3276. + *
  3277. + * This program is distributed in the hope that it will be useful, but
  3278. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  3279. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  3280. + * NON INFRINGEMENT. See the GNU General Public License for more
  3281. + * details.
  3282. + *
  3283. + * You should have received a copy of the GNU General Public License
  3284. + * along with this program; if not, write to the Free Software
  3285. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  3286. + *
  3287. + */
  3288. +#ifndef __NIOS2NOMMU_A_OUT_H__
  3289. +#define __NIOS2NOMMU_A_OUT_H__
  3290. +
  3291. +#define SPARC_PGSIZE 0x1000 /* Thanks to the sun4 architecture... */
  3292. +#define SEGMENT_SIZE SPARC_PGSIZE /* whee... */
  3293. +
  3294. +struct exec {
  3295. + unsigned char a_dynamic:1; /* A __DYNAMIC is in this image */
  3296. + unsigned char a_toolversion:7;
  3297. + unsigned char a_machtype;
  3298. + unsigned short a_info;
  3299. + unsigned long a_text; /* length of text, in bytes */
  3300. + unsigned long a_data; /* length of data, in bytes */
  3301. + unsigned long a_bss; /* length of bss, in bytes */
  3302. + unsigned long a_syms; /* length of symbol table, in bytes */
  3303. + unsigned long a_entry; /* where program begins */
  3304. + unsigned long a_trsize;
  3305. + unsigned long a_drsize;
  3306. +};
  3307. +
  3308. +#define INIT_EXEC { \
  3309. + .a_dynamic = 0, \
  3310. + .a_toolversion = 0, \
  3311. + .a_machtype = 0, \
  3312. + .a_info = 0, \
  3313. + .a_text = 0, \
  3314. + .a_data = 0, \
  3315. + .a_bss = 0, \
  3316. + .a_syms = 0, \
  3317. + .a_entry = 0, \
  3318. + .a_trsize = 0, \
  3319. + .a_drsize = 0, \
  3320. +}
  3321. +
  3322. +/* Where in the file does the text information begin? */
  3323. +#define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? 0 : sizeof (struct exec))
  3324. +
  3325. +/* Where do the Symbols start? */
  3326. +#define N_SYMOFF(x) (N_TXTOFF(x) + (x).a_text + \
  3327. + (x).a_data + (x).a_trsize + \
  3328. + (x).a_drsize)
  3329. +
  3330. +/* Where does text segment go in memory after being loaded? */
  3331. +#define N_TXTADDR(x) (((N_MAGIC(x) == ZMAGIC) && \
  3332. + ((x).a_entry < SPARC_PGSIZE)) ? \
  3333. + 0 : SPARC_PGSIZE)
  3334. +
  3335. +/* And same for the data segment.. */
  3336. +#define N_DATADDR(x) (N_MAGIC(x)==OMAGIC ? \
  3337. + (N_TXTADDR(x) + (x).a_text) \
  3338. + : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
  3339. +
  3340. +#define N_TRSIZE(a) ((a).a_trsize)
  3341. +#define N_DRSIZE(a) ((a).a_drsize)
  3342. +#define N_SYMSIZE(a) ((a).a_syms)
  3343. +
  3344. +#ifdef __KERNEL__
  3345. +
  3346. +#define STACK_TOP TASK_SIZE
  3347. +
  3348. +#endif
  3349. +
  3350. +#endif /* __NIOS2NOMMU_A_OUT_H__ */
  3351. --- linux/include/asm-nios2nommu/asm-macros.h
  3352. +++ linux/include/asm-nios2nommu/asm-macros.h
  3353. @@ -0,0 +1,331 @@
  3354. +/*
  3355. + * Macro used to simplify coding multi-line assembler.
  3356. + * Some of the bit test macro can simplify down to one line
  3357. + * depending on the mask value.
  3358. + *
  3359. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  3360. + *
  3361. + * All rights reserved.
  3362. + *
  3363. + * This program is free software; you can redistribute it and/or modify
  3364. + * it under the terms of the GNU General Public License as published by
  3365. + * the Free Software Foundation; either version 2 of the License, or
  3366. + * (at your option) any later version.
  3367. + *
  3368. + * This program is distributed in the hope that it will be useful, but
  3369. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  3370. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  3371. + * NON INFRINGEMENT. See the GNU General Public License for more
  3372. + * details.
  3373. + *
  3374. + * You should have received a copy of the GNU General Public License
  3375. + * along with this program; if not, write to the Free Software
  3376. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  3377. + *
  3378. + */
  3379. +
  3380. +/*
  3381. + * ANDs reg2 with mask and places the result in reg1.
  3382. + *
  3383. + * You cannnot use the same register for reg1 & reg2.
  3384. + */
  3385. +
  3386. +.macro ANDI32 reg1,reg2,mask
  3387. + .if \mask & 0xffff
  3388. + .if \mask & 0xffff0000
  3389. + movhi \reg1,%hi(\mask)
  3390. + movui \reg1,%lo(\mask)
  3391. + and \reg1,\reg1,\reg2
  3392. + .else
  3393. + andi \reg1,\reg2,%lo(\mask)
  3394. + .endif
  3395. + .else
  3396. + andhi \reg1,\reg2,%hi(\mask)
  3397. + .endif
  3398. +.endm
  3399. +
  3400. +/*
  3401. + * ORs reg2 with mask and places the result in reg1.
  3402. + *
  3403. + * It is safe to use the same register for reg1 & reg2.
  3404. + */
  3405. +
  3406. +.macro ORI32 reg1,reg2,mask
  3407. + .if \mask & 0xffff
  3408. + .if \mask & 0xffff0000
  3409. + orhi \reg1,\reg2,%hi(\mask)
  3410. + ori \reg1,\reg2,%lo(\mask)
  3411. + .else
  3412. + ori \reg1,\reg2,%lo(\mask)
  3413. + .endif
  3414. + .else
  3415. + orhi \reg1,\reg2,%hi(\mask)
  3416. + .endif
  3417. +.endm
  3418. +
  3419. +/*
  3420. + * XORs reg2 with mask and places the result in reg1.
  3421. + *
  3422. + * It is safe to use the same register for reg1 & reg2.
  3423. + */
  3424. +
  3425. +.macro XORI32 reg1,reg2,mask
  3426. + .if \mask & 0xffff
  3427. + .if \mask & 0xffff0000
  3428. + xorhi \reg1,\reg2,%hi(\mask)
  3429. + xori \reg1,\reg1,%lo(\mask)
  3430. + .else
  3431. + xori \reg1,\reg2,%lo(\mask)
  3432. + .endif
  3433. + .else
  3434. + xorhi \reg1,\reg2,%hi(\mask)
  3435. + .endif
  3436. +.endm
  3437. +
  3438. +/*
  3439. + * This is a support macro for BTBZ & BTBNZ. It checks
  3440. + * the bit to make sure it is valid 32 value.
  3441. + *
  3442. + * It is safe to use the same register for reg1 & reg2.
  3443. + */
  3444. +
  3445. +.macro BT reg1,reg2,bit
  3446. +.if \bit > 31
  3447. + .err
  3448. +.else
  3449. + .if \bit < 16
  3450. + andi \reg1,\reg2,(1 << \bit)
  3451. + .else
  3452. + andhi \reg1,\reg2,(1 << (\bit - 16))
  3453. + .endif
  3454. +.endif
  3455. +.endm
  3456. +
  3457. +/*
  3458. + * Tests the bit in reg2 and branches to label if the
  3459. + * bit is zero. The result of the bit test is stored in reg1.
  3460. + *
  3461. + * It is safe to use the same register for reg1 & reg2.
  3462. + */
  3463. +
  3464. +.macro BTBZ reg1,reg2,bit,label
  3465. + BT \reg1,\reg2,\bit
  3466. + beq \reg1,r0,\label
  3467. +.endm
  3468. +
  3469. +/*
  3470. + * Tests the bit in reg2 and branches to label if the
  3471. + * bit is non-zero. The result of the bit test is stored in reg1.
  3472. + *
  3473. + * It is safe to use the same register for reg1 & reg2.
  3474. + */
  3475. +
  3476. +.macro BTBNZ reg1,reg2,bit,label
  3477. + BT \reg1,\reg2,\bit
  3478. + bne \reg1,r0,\label
  3479. +.endm
  3480. +
  3481. +/*
  3482. + * Tests the bit in reg2 and then compliments the bit in reg2.
  3483. + * The result of the bit test is stored in reg1.
  3484. + *
  3485. + * It is NOT safe to use the same register for reg1 & reg2.
  3486. + */
  3487. +
  3488. +.macro BTC reg1,reg2,bit
  3489. +.if \bit > 31
  3490. + .err
  3491. +.else
  3492. + .if \bit < 16
  3493. + andi \reg1,\reg2,(1 << \bit)
  3494. + xori \reg2,\reg2,(1 << \bit)
  3495. + .else
  3496. + andhi \reg1,\reg2,(1 << (\bit - 16))
  3497. + xorhi \reg2,\reg2,(1 << (\bit - 16))
  3498. + .endif
  3499. +.endif
  3500. +.endm
  3501. +
  3502. +/*
  3503. + * Tests the bit in reg2 and then sets the bit in reg2.
  3504. + * The result of the bit test is stored in reg1.
  3505. + *
  3506. + * It is NOT safe to use the same register for reg1 & reg2.
  3507. + */
  3508. +
  3509. +.macro BTS reg1,reg2,bit
  3510. +.if \bit > 31
  3511. + .err
  3512. +.else
  3513. + .if \bit < 16
  3514. + andi \reg1,\reg2,(1 << \bit)
  3515. + ori \reg2,\reg2,(1 << \bit)
  3516. + .else
  3517. + andhi \reg1,\reg2,(1 << (\bit - 16))
  3518. + orhi \reg2,\reg2,(1 << (\bit - 16))
  3519. + .endif
  3520. +.endif
  3521. +.endm
  3522. +
  3523. +/*
  3524. + * Tests the bit in reg2 and then resets the bit in reg2.
  3525. + * The result of the bit test is stored in reg1.
  3526. + *
  3527. + * It is NOT safe to use the same register for reg1 & reg2.
  3528. + */
  3529. +
  3530. +.macro BTR reg1,reg2,bit
  3531. +.if \bit > 31
  3532. + .err
  3533. +.else
  3534. + .if \bit < 16
  3535. + andi \reg1,\reg2,(1 << \bit)
  3536. + andi \reg2,\reg2,%lo(~(1 << \bit))
  3537. + .else
  3538. + andhi \reg1,\reg2,(1 << (\bit - 16))
  3539. + andhi \reg2,\reg2,%lo(~(1 << (\bit - 16)))
  3540. + .endif
  3541. +.endif
  3542. +.endm
  3543. +
  3544. +/*
  3545. + * Tests the bit in reg2 and then compliments the bit in reg2.
  3546. + * The result of the bit test is stored in reg1. If the
  3547. + * original bit was zero it branches to label.
  3548. + *
  3549. + * It is NOT safe to use the same register for reg1 & reg2.
  3550. + */
  3551. +
  3552. +.macro BTCBZ reg1,reg2,bit,label
  3553. + BTC \reg1,\reg2,\bit
  3554. + beq \reg1,r0,\label
  3555. +.endm
  3556. +
  3557. +/*
  3558. + * Tests the bit in reg2 and then compliments the bit in reg2.
  3559. + * The result of the bit test is stored in reg1. If the
  3560. + * original bit was non-zero it branches to label.
  3561. + *
  3562. + * It is NOT safe to use the same register for reg1 & reg2.
  3563. + */
  3564. +
  3565. +.macro BTCBNZ reg1,reg2,bit,label
  3566. + BTC \reg1,\reg2,\bit
  3567. + bne \reg1,r0,\label
  3568. +.endm
  3569. +
  3570. +/*
  3571. + * Tests the bit in reg2 and then sets the bit in reg2.
  3572. + * The result of the bit test is stored in reg1. If the
  3573. + * original bit was zero it branches to label.
  3574. + *
  3575. + * It is NOT safe to use the same register for reg1 & reg2.
  3576. + */
  3577. +
  3578. +.macro BTSBZ reg1,reg2,bit,label
  3579. + BTS \reg1,\reg2,\bit
  3580. + beq \reg1,r0,\label
  3581. +.endm
  3582. +
  3583. +/*
  3584. + * Tests the bit in reg2 and then sets the bit in reg2.
  3585. + * The result of the bit test is stored in reg1. If the
  3586. + * original bit was non-zero it branches to label.
  3587. + *
  3588. + * It is NOT safe to use the same register for reg1 & reg2.
  3589. + */
  3590. +
  3591. +.macro BTSBNZ reg1,reg2,bit,label
  3592. + BTS \reg1,\reg2,\bit
  3593. + bne \reg1,r0,\label
  3594. +.endm
  3595. +
  3596. +/*
  3597. + * Tests the bit in reg2 and then resets the bit in reg2.
  3598. + * The result of the bit test is stored in reg1. If the
  3599. + * original bit was zero it branches to label.
  3600. + *
  3601. + * It is NOT safe to use the same register for reg1 & reg2.
  3602. + */
  3603. +
  3604. +.macro BTRBZ reg1,reg2,bit,label
  3605. + BTR \reg1,\reg2,\bit
  3606. + bne \reg1,r0,\label
  3607. +.endm
  3608. +
  3609. +/*
  3610. + * Tests the bit in reg2 and then resets the bit in reg2.
  3611. + * The result of the bit test is stored in reg1. If the
  3612. + * original bit was non-zero it branches to label.
  3613. + *
  3614. + * It is NOT safe to use the same register for reg1 & reg2.
  3615. + */
  3616. +
  3617. +.macro BTRBNZ reg1,reg2,bit,label
  3618. + BTR \reg1,\reg2,\bit
  3619. + bne \reg1,r0,\label
  3620. +.endm
  3621. +
  3622. +/*
  3623. + * Tests the bits in mask against reg2 stores the result in reg1.
  3624. + * If the all the bits in the mask are zero it branches to label.
  3625. + *
  3626. + * It is safe to use the same register for reg1 & reg2.
  3627. + */
  3628. +
  3629. +.macro TSTBZ reg1,reg2,mask,label
  3630. + ANDI32 \reg1,\reg2,\mask
  3631. + beq \reg1,r0,\label
  3632. +.endm
  3633. +
  3634. +/*
  3635. + * Tests the bits in mask against reg2 stores the result in reg1.
  3636. + * If the any of the bits in the mask are 1 it branches to label.
  3637. + *
  3638. + * It is safe to use the same register for reg1 & reg2.
  3639. + */
  3640. +
  3641. +.macro TSTBNZ reg1,reg2,mask,label
  3642. + ANDI32 \reg1,\reg2,\mask
  3643. + bne \reg1,r0,\label
  3644. +.endm
  3645. +
  3646. +/*
  3647. + * Pushes reg onto the stack.
  3648. + */
  3649. +
  3650. +.macro PUSH reg
  3651. + addi sp,sp,-4
  3652. + stw \reg,0(sp)
  3653. +.endm
  3654. +
  3655. +/*
  3656. + * Pops the top of the stack into reg.
  3657. + */
  3658. +
  3659. +.macro POP reg
  3660. + ldw \reg,0(sp)
  3661. + addi sp,sp,4
  3662. +.endm
  3663. +
  3664. +/*
  3665. + * Clears reg
  3666. + */
  3667. +
  3668. +.macro CLR reg
  3669. + mov \reg,r0
  3670. +.endm
  3671. +
  3672. +/*
  3673. + * The preprocessor macro does not work for
  3674. + * the nios2 compiler. Undefine ENTRY and define
  3675. + * a real assembler macro.
  3676. + */
  3677. +#undef ENTRY
  3678. +#define ENTRY(name) ASM_ENTRY name
  3679. +
  3680. +.macro ASM_ENTRY name
  3681. +.globl \name
  3682. +__ALIGN
  3683. + \name:
  3684. +.endm
  3685. --- linux/include/asm-nios2nommu/atomic.h
  3686. +++ linux/include/asm-nios2nommu/atomic.h
  3687. @@ -0,0 +1,190 @@
  3688. +//vic - add 'atomic_add/sub_return', 'atomic_add_negative'
  3689. +//vic from v850 architecture
  3690. +
  3691. +/* atomic.h:
  3692. + *
  3693. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  3694. + * Copyright (C) 2001 Vic Phillips (vic@microtronix.com)
  3695. + *
  3696. + * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
  3697. + *
  3698. + * All rights reserved.
  3699. + *
  3700. + * This program is free software; you can redistribute it and/or modify
  3701. + * it under the terms of the GNU General Public License as published by
  3702. + * the Free Software Foundation; either version 2 of the License, or
  3703. + * (at your option) any later version.
  3704. + *
  3705. + * This program is distributed in the hope that it will be useful, but
  3706. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  3707. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  3708. + * NON INFRINGEMENT. See the GNU General Public License for more
  3709. + * details.
  3710. + *
  3711. + * You should have received a copy of the GNU General Public License
  3712. + * along with this program; if not, write to the Free Software
  3713. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  3714. + *
  3715. + */
  3716. +
  3717. +#ifndef __ARCH_NIOS2NOMMU_ATOMIC__
  3718. +#define __ARCH_NIOS2NOMMU_ATOMIC__
  3719. +
  3720. +#include <asm/system.h>
  3721. +
  3722. +typedef struct { int counter; } atomic_t;
  3723. +#define ATOMIC_INIT(i) { (i) }
  3724. +
  3725. +#define atomic_read(v) ((v)->counter)
  3726. +#define atomic_set(v, i) (((v)->counter) = i)
  3727. +
  3728. +
  3729. +extern __inline__ void atomic_add(int i, atomic_t *v)
  3730. +{
  3731. + unsigned long flags;
  3732. +
  3733. + local_irq_save(flags);
  3734. + v->counter += i;
  3735. + local_irq_restore(flags);
  3736. +}
  3737. +
  3738. +extern __inline__ int atomic_add_negative(int i, atomic_t *v)
  3739. +{
  3740. + unsigned long flags;
  3741. + int result;
  3742. +
  3743. + local_irq_save(flags);
  3744. + v->counter += i;
  3745. + result = (v->counter < 0);
  3746. + local_irq_restore(flags);
  3747. + return result;
  3748. +}
  3749. +
  3750. +extern __inline__ void atomic_sub(int i, atomic_t *v)
  3751. +{
  3752. + unsigned long flags;
  3753. +
  3754. + local_irq_save(flags);
  3755. + v->counter -= i;
  3756. + local_irq_restore(flags);
  3757. +}
  3758. +
  3759. +extern __inline__ int atomic_sub_and_test(int i, atomic_t *v)
  3760. +{
  3761. + int result;
  3762. + unsigned long flags;
  3763. +
  3764. + local_irq_save(flags);
  3765. + v->counter -= i;
  3766. + result = (v->counter == 0);
  3767. + local_irq_restore(flags);
  3768. + return result;
  3769. +}
  3770. +
  3771. +extern __inline__ void atomic_inc(atomic_t *v)
  3772. +{
  3773. + unsigned long flags;
  3774. +
  3775. + local_irq_save(flags);
  3776. + v->counter += 1;
  3777. + local_irq_restore(flags);
  3778. +}
  3779. +
  3780. +extern __inline__ int atomic_inc_and_test(atomic_t *v)
  3781. +{
  3782. + unsigned long flags;
  3783. + int result;
  3784. +
  3785. + local_irq_save(flags);
  3786. + v->counter += 1;
  3787. + result = (v->counter == 0);
  3788. + local_irq_restore(flags);
  3789. + return result;
  3790. +}
  3791. +
  3792. +extern __inline__ void atomic_dec(atomic_t *v)
  3793. +{
  3794. + int i = 1; /* the compiler optimizes better this way */
  3795. + unsigned long flags;
  3796. +
  3797. + local_irq_save(flags);
  3798. + v->counter -= i;
  3799. + local_irq_restore(flags);
  3800. +}
  3801. +
  3802. +extern __inline__ int atomic_dec_and_test(atomic_t *v)
  3803. +{
  3804. + int result;
  3805. + int i = 1; /* the compiler optimizes better this way */
  3806. + unsigned long flags;
  3807. +
  3808. + local_irq_save(flags);
  3809. + v->counter -= i;
  3810. + result = (v->counter == 0);
  3811. + local_irq_restore(flags);
  3812. + return result;
  3813. +}
  3814. +
  3815. +extern __inline__ int atomic_inc_return(atomic_t *v)
  3816. +{
  3817. + int result;
  3818. + unsigned long flags;
  3819. +
  3820. + local_irq_save(flags);
  3821. + result = ++v->counter;
  3822. + local_irq_restore(flags);
  3823. + return result;
  3824. +}
  3825. +
  3826. +extern __inline__ int atomic_dec_return(atomic_t *v)
  3827. +{
  3828. + int result;
  3829. + int i = 1; /* the compiler optimizes better this way */
  3830. + unsigned long flags;
  3831. +
  3832. + local_irq_save(flags);
  3833. + v->counter -= i;
  3834. + result = v->counter;
  3835. + local_irq_restore(flags);
  3836. + return result;
  3837. +}
  3838. +
  3839. +extern __inline__ int atomic_add_return (int i, volatile atomic_t *v)
  3840. +{
  3841. + int res;
  3842. + unsigned long flags;
  3843. +
  3844. + local_irq_save(flags);
  3845. + res = v->counter + i;
  3846. + v->counter = res;
  3847. + local_irq_restore(flags);
  3848. +
  3849. + return res;
  3850. +}
  3851. +
  3852. +static __inline__ int atomic_sub_return (int i, volatile atomic_t *v)
  3853. +{
  3854. + int res;
  3855. + unsigned long flags;
  3856. +
  3857. + local_irq_save(flags);
  3858. + res = v->counter - i;
  3859. + v->counter = res;
  3860. + local_irq_restore(flags);
  3861. +
  3862. + return res;
  3863. +}
  3864. +
  3865. +#define atomic_dec_return(v) atomic_sub_return(1,(v))
  3866. +#define atomic_inc_return(v) atomic_add_return(1,(v))
  3867. +
  3868. +/* Atomic operations are already serializing */
  3869. +#define smp_mb__before_atomic_dec() barrier()
  3870. +#define smp_mb__after_atomic_dec() barrier()
  3871. +#define smp_mb__before_atomic_inc() barrier()
  3872. +#define smp_mb__after_atomic_inc() barrier()
  3873. +
  3874. +
  3875. +#endif /* !(__ARCH_NIOS2NOMMU_ATOMIC__) */
  3876. +
  3877. +
  3878. --- linux/include/asm-nios2nommu/bitops.h
  3879. +++ linux/include/asm-nios2nommu/bitops.h
  3880. @@ -0,0 +1,472 @@
  3881. +#ifndef _ASM_NIOS_BITOPS_H_
  3882. +#define _ASM_NIOS_BITOPS_H_
  3883. +
  3884. +/*--------------------------------------------------------------------
  3885. + *
  3886. + * include/asm-nios2nommu/bitops.h
  3887. + *
  3888. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  3889. + *
  3890. + * Copyright (C) 2004 Microtronix Datacom Ltd
  3891. + *
  3892. + * This program is free software; you can redistribute it and/or modify
  3893. + * it under the terms of the GNU General Public License as published by
  3894. + * the Free Software Foundation; either version 2 of the License, or
  3895. + * (at your option) any later version.
  3896. + *
  3897. + * This program is distributed in the hope that it will be useful,
  3898. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3899. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  3900. + * GNU General Public License for more details.
  3901. + *
  3902. + *
  3903. + * Jan/20/2004 dgt NiosII
  3904. + *
  3905. + ---------------------------------------------------------------------*/
  3906. +
  3907. +
  3908. +#ifdef __KERNEL__
  3909. +#include <linux/config.h>
  3910. +#include <linux/compiler.h>
  3911. +#include <asm/byteorder.h> /* swab32 */
  3912. +#include <asm/system.h>
  3913. +#endif
  3914. +
  3915. +/*
  3916. + * Adapted to NIOS from generic bitops.h:
  3917. + *
  3918. + * For the benefit of those who are trying to port Linux to another
  3919. + * architecture, here are some C-language equivalents. You should
  3920. + * recode these in the native assembly language, if at all possible.
  3921. + * To guarantee atomicity, these routines call cli() and sti() to
  3922. + * disable interrupts while they operate. (You have to provide inline
  3923. + * routines to cli() and sti().)
  3924. + *
  3925. + * Also note, these routines assume that you have 32 bit integers.
  3926. + * You will have to change this if you are trying to port Linux to the
  3927. + * Alpha architecture or to a Cray. :-)
  3928. + *
  3929. + * C language equivalents written by Theodore Ts'o, 9/26/92
  3930. + */
  3931. +
  3932. +/*
  3933. + * Generic ffs().
  3934. + */
  3935. +static inline int ffs(int x)
  3936. +{
  3937. + int r = 1;
  3938. +
  3939. + if (!x)
  3940. + return 0;
  3941. + if (!(x & 0xffff)) {
  3942. + x >>= 16;
  3943. + r += 16;
  3944. + }
  3945. + if (!(x & 0xff)) {
  3946. + x >>= 8;
  3947. + r += 8;
  3948. + }
  3949. + if (!(x & 0xf)) {
  3950. + x >>= 4;
  3951. + r += 4;
  3952. + }
  3953. + if (!(x & 3)) {
  3954. + x >>= 2;
  3955. + r += 2;
  3956. + }
  3957. + if (!(x & 1)) {
  3958. + x >>= 1;
  3959. + r += 1;
  3960. + }
  3961. + return r;
  3962. +}
  3963. +
  3964. +/*
  3965. + * Generic __ffs().
  3966. + */
  3967. +static inline int __ffs(int x)
  3968. +{
  3969. + int r = 0;
  3970. +
  3971. + if (!x)
  3972. + return 0;
  3973. + if (!(x & 0xffff)) {
  3974. + x >>= 16;
  3975. + r += 16;
  3976. + }
  3977. + if (!(x & 0xff)) {
  3978. + x >>= 8;
  3979. + r += 8;
  3980. + }
  3981. + if (!(x & 0xf)) {
  3982. + x >>= 4;
  3983. + r += 4;
  3984. + }
  3985. + if (!(x & 3)) {
  3986. + x >>= 2;
  3987. + r += 2;
  3988. + }
  3989. + if (!(x & 1)) {
  3990. + x >>= 1;
  3991. + r += 1;
  3992. + }
  3993. + return r;
  3994. +}
  3995. +
  3996. +/*
  3997. + * fls: find last bit set.
  3998. + */
  3999. +#define fls(x) generic_fls(x)
  4000. +
  4001. +
  4002. +/*
  4003. + * Every architecture must define this function. It's the fastest
  4004. + * way of searching a 140-bit bitmap where the first 100 bits are
  4005. + * unlikely to be set. It's guaranteed that at least one of the 140
  4006. + * bits is cleared.
  4007. + */
  4008. +static inline int sched_find_first_bit(unsigned long *b)
  4009. +{
  4010. + if (unlikely(b[0]))
  4011. + return __ffs(b[0]);
  4012. + if (unlikely(b[1]))
  4013. + return __ffs(b[1]) + 32;
  4014. + if (unlikely(b[2]))
  4015. + return __ffs(b[2]) + 64;
  4016. + if (b[3])
  4017. + return __ffs(b[3]) + 96;
  4018. + return __ffs(b[4]) + 128;
  4019. +}
  4020. +
  4021. +/*
  4022. + * ffz = Find First Zero in word. Undefined if no zero exists,
  4023. + * so code should check against ~0UL first..
  4024. + */
  4025. +static __inline__ unsigned long ffz(unsigned long word)
  4026. +{
  4027. + unsigned long result = 0;
  4028. +
  4029. + while(word & 1) {
  4030. + result++;
  4031. + word >>= 1;
  4032. + }
  4033. + return result;
  4034. +}
  4035. +
  4036. +
  4037. +static __inline__ void set_bit(int nr, volatile unsigned long * addr)
  4038. +{
  4039. + int * a = (int *) addr;
  4040. + int mask;
  4041. + unsigned long flags;
  4042. +
  4043. + a += nr >> 5;
  4044. + mask = 1 << (nr & 0x1f);
  4045. + local_irq_save(flags);
  4046. + *a |= mask;
  4047. + local_irq_restore(flags);
  4048. +}
  4049. +
  4050. +static __inline__ void __set_bit(int nr, volatile unsigned long * addr)
  4051. +{
  4052. + int * a = (int *) addr;
  4053. + int mask;
  4054. +
  4055. + a += nr >> 5;
  4056. + mask = 1 << (nr & 0x1f);
  4057. + *a |= mask;
  4058. +}
  4059. +
  4060. +/*
  4061. + * clear_bit() doesn't provide any barrier for the compiler.
  4062. + */
  4063. +#define smp_mb__before_clear_bit() barrier()
  4064. +#define smp_mb__after_clear_bit() barrier()
  4065. +
  4066. +static __inline__ void clear_bit(int nr, volatile unsigned long * addr)
  4067. +{
  4068. + int * a = (int *) addr;
  4069. + int mask;
  4070. + unsigned long flags;
  4071. +
  4072. + a += nr >> 5;
  4073. + mask = 1 << (nr & 0x1f);
  4074. + local_irq_save(flags);
  4075. + *a &= ~mask;
  4076. + local_irq_restore(flags);
  4077. +}
  4078. +
  4079. +static __inline__ void __clear_bit(int nr, volatile unsigned long * addr)
  4080. +{
  4081. + int * a = (int *) addr;
  4082. + int mask;
  4083. +
  4084. + a += nr >> 5;
  4085. + mask = 1 << (nr & 0x1f);
  4086. + *a &= ~mask;
  4087. +}
  4088. +
  4089. +static __inline__ void change_bit(int nr, volatile unsigned long * addr)
  4090. +{
  4091. + int mask, flags;
  4092. + unsigned long *ADDR = (unsigned long *) addr;
  4093. +
  4094. + ADDR += nr >> 5;
  4095. + mask = 1 << (nr & 31);
  4096. + local_irq_save(flags);
  4097. + *ADDR ^= mask;
  4098. + local_irq_restore(flags);
  4099. +}
  4100. +
  4101. +static __inline__ void __change_bit(int nr, volatile unsigned long * addr)
  4102. +{
  4103. + int mask;
  4104. + unsigned long *ADDR = (unsigned long *) addr;
  4105. +
  4106. + ADDR += nr >> 5;
  4107. + mask = 1 << (nr & 31);
  4108. + *ADDR ^= mask;
  4109. +}
  4110. +
  4111. +static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr)
  4112. +{
  4113. + int mask, retval;
  4114. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4115. + unsigned long flags;
  4116. +
  4117. + a += nr >> 5;
  4118. + mask = 1 << (nr & 0x1f);
  4119. + local_irq_save(flags);
  4120. + retval = (mask & *a) != 0;
  4121. + *a |= mask;
  4122. + local_irq_restore(flags);
  4123. +
  4124. + return retval;
  4125. +}
  4126. +
  4127. +static __inline__ int __test_and_set_bit(int nr, volatile unsigned long * addr)
  4128. +{
  4129. + int mask, retval;
  4130. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4131. +
  4132. + a += nr >> 5;
  4133. + mask = 1 << (nr & 0x1f);
  4134. + retval = (mask & *a) != 0;
  4135. + *a |= mask;
  4136. + return retval;
  4137. +}
  4138. +
  4139. +static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr)
  4140. +{
  4141. + int mask, retval;
  4142. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4143. + unsigned long flags;
  4144. +
  4145. + a += nr >> 5;
  4146. + mask = 1 << (nr & 0x1f);
  4147. + local_irq_save(flags);
  4148. + retval = (mask & *a) != 0;
  4149. + *a &= ~mask;
  4150. + local_irq_restore(flags);
  4151. +
  4152. + return retval;
  4153. +}
  4154. +
  4155. +static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long * addr)
  4156. +{
  4157. + int mask, retval;
  4158. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4159. +
  4160. + a += nr >> 5;
  4161. + mask = 1 << (nr & 0x1f);
  4162. + retval = (mask & *a) != 0;
  4163. + *a &= ~mask;
  4164. + return retval;
  4165. +}
  4166. +
  4167. +static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr)
  4168. +{
  4169. + int mask, retval;
  4170. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4171. + unsigned long flags;
  4172. +
  4173. + a += nr >> 5;
  4174. + mask = 1 << (nr & 0x1f);
  4175. + local_irq_save(flags);
  4176. + retval = (mask & *a) != 0;
  4177. + *a ^= mask;
  4178. + local_irq_restore(flags);
  4179. +
  4180. + return retval;
  4181. +}
  4182. +
  4183. +static __inline__ int __test_and_change_bit(int nr, volatile unsigned long * addr)
  4184. +{
  4185. + int mask, retval;
  4186. + volatile unsigned int *a = (volatile unsigned int *) addr;
  4187. +
  4188. + a += nr >> 5;
  4189. + mask = 1 << (nr & 0x1f);
  4190. + retval = (mask & *a) != 0;
  4191. + *a ^= mask;
  4192. + return retval;
  4193. +}
  4194. +
  4195. +/*
  4196. + * This routine doesn't need to be atomic.
  4197. + */
  4198. +static __inline__ int __constant_test_bit(int nr, const volatile unsigned long * addr)
  4199. +{
  4200. + return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
  4201. +}
  4202. +
  4203. +static __inline__ int __test_bit(int nr, const volatile unsigned long * addr)
  4204. +{
  4205. + int * a = (int *) addr;
  4206. + int mask;
  4207. +
  4208. + a += nr >> 5;
  4209. + mask = 1 << (nr & 0x1f);
  4210. + return ((mask & *a) != 0);
  4211. +}
  4212. +
  4213. +#define test_bit(nr,addr) \
  4214. +(__builtin_constant_p(nr) ? \
  4215. + __constant_test_bit((nr),(unsigned long *)(addr)) : \
  4216. + __test_bit((nr),(unsigned long *)(addr)))
  4217. +
  4218. +
  4219. +/* find_next_zero_bit() finds the first zero bit in a bit string of length
  4220. + * 'size' bits, starting the search at bit 'offset'. This is largely based
  4221. + * on Linus's ALPHA routines, which are pretty portable BTW.
  4222. + */
  4223. +
  4224. +extern __inline__ unsigned long find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
  4225. +{
  4226. + unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
  4227. + unsigned long result = offset & ~31UL;
  4228. + unsigned long tmp;
  4229. +
  4230. + if (offset >= size)
  4231. + return size;
  4232. + size -= result;
  4233. + offset &= 31UL;
  4234. + if (offset) {
  4235. + tmp = *(p++);
  4236. + tmp |= ~0UL >> (32-offset);
  4237. + if (size < 32)
  4238. + goto found_first;
  4239. + if (~tmp)
  4240. + goto found_middle;
  4241. + size -= 32;
  4242. + result += 32;
  4243. + }
  4244. + while (size & ~31UL) {
  4245. + if (~(tmp = *(p++)))
  4246. + goto found_middle;
  4247. + result += 32;
  4248. + size -= 32;
  4249. + }
  4250. + if (!size)
  4251. + return result;
  4252. + tmp = *p;
  4253. +
  4254. +found_first:
  4255. + tmp |= ~0UL << size;
  4256. + if (tmp == ~0UL)
  4257. + return result + size;
  4258. +found_middle:
  4259. + return result + ffz(tmp);
  4260. +}
  4261. +
  4262. +/*
  4263. + * Find next one bit in a bitmap reasonably efficiently.
  4264. + */
  4265. +extern __inline__ unsigned long find_next_bit(const unsigned long *addr,
  4266. + unsigned long size, unsigned long offset)
  4267. +{
  4268. + unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
  4269. + unsigned int result = offset & ~31UL;
  4270. + unsigned int tmp;
  4271. +
  4272. + if (offset >= size)
  4273. + return size;
  4274. + size -= result;
  4275. + offset &= 31UL;
  4276. + if (offset) {
  4277. + tmp = *p++;
  4278. + tmp &= ~0UL << offset;
  4279. + if (size < 32)
  4280. + goto found_first;
  4281. + if (tmp)
  4282. + goto found_middle;
  4283. + size -= 32;
  4284. + result += 32;
  4285. + }
  4286. + while (size >= 32) {
  4287. + if ((tmp = *p++) != 0)
  4288. + goto found_middle;
  4289. + result += 32;
  4290. + size -= 32;
  4291. + }
  4292. + if (!size)
  4293. + return result;
  4294. + tmp = *p;
  4295. +
  4296. +found_first:
  4297. + tmp &= ~0UL >> (32 - size);
  4298. + if (tmp == 0UL) /* Are any bits set? */
  4299. + return result + size; /* Nope. */
  4300. +found_middle:
  4301. + return result + __ffs(tmp);
  4302. +}
  4303. +
  4304. +/*
  4305. + * hweightN: returns the hamming weight (i.e. the number
  4306. + * of bits set) of a N-bit word
  4307. + */
  4308. +
  4309. +#define hweight32(x) generic_hweight32(x)
  4310. +#define hweight16(x) generic_hweight16(x)
  4311. +#define hweight8(x) generic_hweight8(x)
  4312. +
  4313. +/* Linus sez that gcc can optimize the following correctly, we'll see if this
  4314. + * holds on the Sparc as it does for the ALPHA.
  4315. + */
  4316. +
  4317. +#define find_first_zero_bit(addr, size) \
  4318. + find_next_zero_bit((addr), (size), 0)
  4319. +#define find_first_bit(addr, size) \
  4320. + find_next_bit((addr), (size), 0)
  4321. +
  4322. +/* Now for the ext2 filesystem bit operations and helper routines.
  4323. + *
  4324. + * Both NIOS and ext2 are little endian, so these are the same as above.
  4325. + */
  4326. +
  4327. +#define ext2_set_bit test_and_set_bit
  4328. +#define ext2_clear_bit test_and_clear_bit
  4329. +#define ext2_test_bit test_bit
  4330. +
  4331. +#define ext2_set_bit_atomic(lock, nr, addr) \
  4332. + ({ \
  4333. + int ret; \
  4334. + spin_lock(lock); \
  4335. + ret = ext2_set_bit((nr),(unsigned long *) (addr)); \
  4336. + spin_unlock(lock); \
  4337. + ret; \
  4338. + })
  4339. +
  4340. +#define ext2_clear_bit_atomic(lock, nr, addr) \
  4341. + ({ \
  4342. + int ret; \
  4343. + spin_lock(lock); \
  4344. + ret = ext2_clear_bit((nr),(unsigned long *) (addr)); \
  4345. + spin_unlock(lock); \
  4346. + ret; \
  4347. + })
  4348. +
  4349. +#define ext2_find_first_zero_bit find_first_zero_bit
  4350. +#define ext2_find_next_zero_bit find_next_zero_bit
  4351. +
  4352. +#endif /* _ASM_NIOS_BITOPS_H */
  4353. --- linux/include/asm-nios2nommu/bootinfo.h
  4354. +++ linux/include/asm-nios2nommu/bootinfo.h
  4355. @@ -0,0 +1,2 @@
  4356. +
  4357. +/* Nothing for nios2nommu */
  4358. --- linux/include/asm-nios2nommu/bug.h
  4359. +++ linux/include/asm-nios2nommu/bug.h
  4360. @@ -0,0 +1,48 @@
  4361. +#ifndef _NIOS2NOMMU_BUG_H
  4362. +#define _NIOS2NOMMU_BUG_H
  4363. +
  4364. +/*--------------------------------------------------------------------
  4365. + *
  4366. + * include/asm-nios2nommu/bug.h
  4367. + *
  4368. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  4369. + *
  4370. + * Copyright (C) 2004 Microtronix Datacom Ltd
  4371. + *
  4372. + * This program is free software; you can redistribute it and/or modify
  4373. + * it under the terms of the GNU General Public License as published by
  4374. + * the Free Software Foundation; either version 2 of the License, or
  4375. + * (at your option) any later version.
  4376. + *
  4377. + * This program is distributed in the hope that it will be useful,
  4378. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4379. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4380. + * GNU General Public License for more details.
  4381. + *
  4382. + *
  4383. + * Jan/20/2004 dgt NiosII
  4384. + *
  4385. + ---------------------------------------------------------------------*/
  4386. +
  4387. +
  4388. +#define BUG() do { \
  4389. + printk("%s(%d): kernel BUG!\n", __FILE__, __LINE__); \
  4390. +} while (0)
  4391. +
  4392. +#define BUG_ON(condition) do { \
  4393. + if (unlikely((condition)!=0)) \
  4394. + BUG(); \
  4395. +} while(0)
  4396. +
  4397. +#define PAGE_BUG(page) do { \
  4398. + BUG(); \
  4399. +} while (0)
  4400. +
  4401. +#define WARN_ON(condition) do { \
  4402. + if (unlikely((condition)!=0)) { \
  4403. + printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
  4404. + dump_stack(); \
  4405. + } \
  4406. +} while (0)
  4407. +
  4408. +#endif
  4409. --- linux/include/asm-nios2nommu/bugs.h
  4410. +++ linux/include/asm-nios2nommu/bugs.h
  4411. @@ -0,0 +1,40 @@
  4412. +#ifndef __ASM_NIOS_BUGS_H
  4413. +#define __ASM_NIOS_BUGS_H
  4414. +
  4415. +/*--------------------------------------------------------------------
  4416. + *
  4417. + * include/asm-nios2nommu/bugs.h
  4418. + *
  4419. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  4420. + *
  4421. + * Copyright (C) 1994 Linus Torvalds
  4422. + * Copyright (C) 2004 Microtronix Datacom Ltd
  4423. + *
  4424. + * This program is free software; you can redistribute it and/or modify
  4425. + * it under the terms of the GNU General Public License as published by
  4426. + * the Free Software Foundation; either version 2 of the License, or
  4427. + * (at your option) any later version.
  4428. + *
  4429. + * This program is distributed in the hope that it will be useful,
  4430. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4431. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4432. + * GNU General Public License for more details.
  4433. + *
  4434. + *
  4435. + * Jan/20/2004 dgt NiosII
  4436. + *
  4437. + ---------------------------------------------------------------------*/
  4438. +
  4439. +
  4440. +/*
  4441. + * This is included by init/main.c to check for architecture-dependent bugs.
  4442. + *
  4443. + * Needs:
  4444. + * void check_bugs(void);
  4445. + */
  4446. +
  4447. +static void check_bugs(void)
  4448. +{
  4449. +}
  4450. +
  4451. +#endif
  4452. --- linux/include/asm-nios2nommu/byteorder.h
  4453. +++ linux/include/asm-nios2nommu/byteorder.h
  4454. @@ -0,0 +1,38 @@
  4455. +#ifndef __ASM_NIOS_BYTEORDER_H
  4456. +#define __ASM_NIOS_BYTEORDER_H
  4457. +
  4458. +/*--------------------------------------------------------------------
  4459. + *
  4460. + * include/asm-nios2nommu/byteorder.h
  4461. + *
  4462. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  4463. + *
  4464. + * Copyright (C) 2004 Microtronix Datacom Ltd
  4465. + *
  4466. + * This program is free software; you can redistribute it and/or modify
  4467. + * it under the terms of the GNU General Public License as published by
  4468. + * the Free Software Foundation; either version 2 of the License, or
  4469. + * (at your option) any later version.
  4470. + *
  4471. + * This program is distributed in the hope that it will be useful,
  4472. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4473. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4474. + * GNU General Public License for more details.
  4475. + *
  4476. + *
  4477. + * Jan/20/2004 dgt NiosII
  4478. + *
  4479. + ---------------------------------------------------------------------*/
  4480. +
  4481. +
  4482. +#include <asm/types.h>
  4483. +
  4484. +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
  4485. +# define __BYTEORDER_HAS_U64__
  4486. +# define __SWAB_64_THRU_32__
  4487. +#endif
  4488. +
  4489. +#include <linux/byteorder/little_endian.h>
  4490. +
  4491. +#endif
  4492. +
  4493. --- linux/include/asm-nios2nommu/cache.h
  4494. +++ linux/include/asm-nios2nommu/cache.h
  4495. @@ -0,0 +1,34 @@
  4496. +/*
  4497. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  4498. + *
  4499. + * All rights reserved.
  4500. + *
  4501. + * This program is free software; you can redistribute it and/or modify
  4502. + * it under the terms of the GNU General Public License as published by
  4503. + * the Free Software Foundation; either version 2 of the License, or
  4504. + * (at your option) any later version.
  4505. + *
  4506. + * This program is distributed in the hope that it will be useful, but
  4507. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  4508. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  4509. + * NON INFRINGEMENT. See the GNU General Public License for more
  4510. + * details.
  4511. + *
  4512. + * You should have received a copy of the GNU General Public License
  4513. + * along with this program; if not, write to the Free Software
  4514. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  4515. + *
  4516. + */
  4517. +#ifndef __ARCH_NIOS2NOMMU_CACHE_H
  4518. +#define __ARCH_NIOS2NOMMU_CACHE_H
  4519. +
  4520. +#include <asm/nios.h>
  4521. +
  4522. +/* bytes per L1 cache line */
  4523. +#define L1_CACHE_BYTES nasys_icache_line_size /* this need to be at least 1 */
  4524. +
  4525. +
  4526. +#define __cacheline_aligned
  4527. +#define ____cacheline_aligned
  4528. +
  4529. +#endif
  4530. --- linux/include/asm-nios2nommu/cachectl.h
  4531. +++ linux/include/asm-nios2nommu/cachectl.h
  4532. @@ -0,0 +1,36 @@
  4533. +/*
  4534. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  4535. + *
  4536. + * All rights reserved.
  4537. + *
  4538. + * This program is free software; you can redistribute it and/or modify
  4539. + * it under the terms of the GNU General Public License as published by
  4540. + * the Free Software Foundation; either version 2 of the License, or
  4541. + * (at your option) any later version.
  4542. + *
  4543. + * This program is distributed in the hope that it will be useful, but
  4544. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  4545. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  4546. + * NON INFRINGEMENT. See the GNU General Public License for more
  4547. + * details.
  4548. + *
  4549. + * You should have received a copy of the GNU General Public License
  4550. + * along with this program; if not, write to the Free Software
  4551. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  4552. + *
  4553. + */
  4554. +
  4555. +#ifndef _NIOS2NOMMU_CACHECTL_H
  4556. +#define _NIOS2NOMMU_CACHECTL_H
  4557. +
  4558. +/* Definitions for the cacheflush system call. */
  4559. +
  4560. +#define FLUSH_SCOPE_LINE 1 /* Flush a cache line */
  4561. +#define FLUSH_SCOPE_PAGE 2 /* Flush a page */
  4562. +#define FLUSH_SCOPE_ALL 3 /* Flush the whole cache -- superuser only */
  4563. +
  4564. +#define FLUSH_CACHE_DATA 1 /* Writeback and flush data cache */
  4565. +#define FLUSH_CACHE_INSN 2 /* Flush instruction cache */
  4566. +#define FLUSH_CACHE_BOTH 3 /* Flush both caches */
  4567. +
  4568. +#endif /* _NIOS2NOMMU_CACHECTL_H */
  4569. --- linux/include/asm-nios2nommu/cacheflush.h
  4570. +++ linux/include/asm-nios2nommu/cacheflush.h
  4571. @@ -0,0 +1,56 @@
  4572. +#ifndef _NIOS2NOMMU_CACHEFLUSH_H
  4573. +#define _NIOS2NOMMU_CACHEFLUSH_H
  4574. +
  4575. +/*
  4576. + * Ported from m68knommu.
  4577. + *
  4578. + * (C) Copyright 2003, Microtronix Datacom Ltd.
  4579. + * (C) Copyright 2000-2002, Greg Ungerer <gerg@snapgear.com>
  4580. + *
  4581. + * All rights reserved.
  4582. + *
  4583. + * This program is free software; you can redistribute it and/or modify
  4584. + * it under the terms of the GNU General Public License as published by
  4585. + * the Free Software Foundation; either version 2 of the License, or
  4586. + * (at your option) any later version.
  4587. + *
  4588. + * This program is distributed in the hope that it will be useful, but
  4589. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  4590. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  4591. + * NON INFRINGEMENT. See the GNU General Public License for more
  4592. + * details.
  4593. + *
  4594. + * You should have received a copy of the GNU General Public License
  4595. + * along with this program; if not, write to the Free Software
  4596. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  4597. + *
  4598. + */
  4599. +#include <linux/mm.h>
  4600. +
  4601. +extern void cache_push (unsigned long vaddr, int len);
  4602. +extern void dcache_push (unsigned long vaddr, int len);
  4603. +extern void icache_push (unsigned long vaddr, int len);
  4604. +extern void cache_push_all (void);
  4605. +
  4606. +#define flush_cache_all() __flush_cache_all()
  4607. +#define flush_cache_mm(mm) do { } while (0)
  4608. +#define flush_cache_range(vma, start, end) do { } while (0)
  4609. +#define flush_cache_page(vma, vmaddr) do { } while (0)
  4610. +#define flush_dcache_range(start,end) dcache_push(start, end - start)
  4611. +#define flush_dcache_page(page) do { } while (0)
  4612. +#define flush_icache_range(start,end) cache_push(start, end - start)
  4613. +#define flush_icache_page(vma,pg) do { } while (0)
  4614. +#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
  4615. +
  4616. +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
  4617. + memcpy(dst, src, len)
  4618. +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
  4619. + memcpy(dst, src, len)
  4620. +
  4621. +
  4622. +extern inline void __flush_cache_all(void)
  4623. +{
  4624. + cache_push_all();
  4625. +}
  4626. +
  4627. +#endif /* _NIOS2NOMMU_CACHEFLUSH_H */
  4628. --- linux/include/asm-nios2nommu/checksum.h
  4629. +++ linux/include/asm-nios2nommu/checksum.h
  4630. @@ -0,0 +1,320 @@
  4631. +#ifndef __NIOS2_CHECKSUM_H
  4632. +#define __NIOS2_CHECKSUM_H
  4633. +
  4634. +/* checksum.h: IP/UDP/TCP checksum routines on the NIOS.
  4635. + *
  4636. + * Copyright(C) 1995 Linus Torvalds
  4637. + * Copyright(C) 1995 Miguel de Icaza
  4638. + * Copyright(C) 1996 David S. Miller
  4639. + * Copyright(C) 2001 Ken Hill
  4640. + * Copyright(C) 2004 Microtronix Datacom Ltd.
  4641. + *
  4642. + * derived from:
  4643. + * Alpha checksum c-code
  4644. + * ix86 inline assembly
  4645. + * Spar nommu
  4646. + *
  4647. + * All rights reserved.
  4648. + *
  4649. + * This program is free software; you can redistribute it and/or modify
  4650. + * it under the terms of the GNU General Public License as published by
  4651. + * the Free Software Foundation; either version 2 of the License, or
  4652. + * (at your option) any later version.
  4653. + *
  4654. + * This program is distributed in the hope that it will be useful, but
  4655. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  4656. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  4657. + * NON INFRINGEMENT. See the GNU General Public License for more
  4658. + * details.
  4659. + *
  4660. + * You should have received a copy of the GNU General Public License
  4661. + * along with this program; if not, write to the Free Software
  4662. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  4663. + *
  4664. + */
  4665. +
  4666. +
  4667. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  4668. +
  4669. +/*
  4670. + * computes the checksum of the TCP/UDP pseudo-header
  4671. + * returns a 16-bit checksum, already complemented
  4672. + */
  4673. +
  4674. +extern inline unsigned short csum_tcpudp_magic(unsigned long saddr,
  4675. + unsigned long daddr,
  4676. + unsigned short len,
  4677. + unsigned short proto,
  4678. + unsigned int sum)
  4679. +{
  4680. + barrier();
  4681. + __asm__ __volatile__(
  4682. +" add %0, %3, %0\n"
  4683. +" bgeu %0, %3, 1f\n"
  4684. +" addi %0, %0, 1\n"
  4685. +"1: add %0, %4, %0\n"
  4686. +" bgeu %0, %4, 1f\n"
  4687. +" addi %0, %0, 1\n"
  4688. +"1: add %0, %5, %0\n"
  4689. +" bgeu %0, %5, 1f\n"
  4690. +" addi %0, %0, 1\n"
  4691. +"1:\n"
  4692. +/*
  4693. + We need the carry from the addition of 16-bit
  4694. + significant addition, so we zap out the low bits
  4695. + in one half, zap out the high bits in another,
  4696. + shift them both up to the top 16-bits of a word
  4697. + and do the carry producing addition, finally
  4698. + shift the result back down to the low 16-bits.
  4699. +
  4700. + Actually, we can further optimize away two shifts
  4701. + because we know the low bits of the original
  4702. + value will be added to zero-only bits so cannot
  4703. + affect the addition result nor the final carry
  4704. + bit.
  4705. +*/
  4706. +" slli %1,%0, 16\n" /* Need a copy to fold with */
  4707. + /* Bring the LOW 16 bits up */
  4708. +" add %0, %1, %0\n" /* add and set carry, neat eh? */
  4709. +" cmpltu r15, %0, %1\n" /* get remaining carry bit */
  4710. +" srli %0, %0, 16\n" /* shift back down the result */
  4711. +" add %0, %0, r15\n"
  4712. +" nor %0, %0, %0\n" /* negate */
  4713. + : "=&r" (sum), "=&r" (saddr)
  4714. + : "0" (sum), "1" (saddr), "r" (ntohl(len+proto)), "r" (daddr)
  4715. + : "r15");
  4716. + return ((unsigned short) sum);
  4717. + barrier();
  4718. +}
  4719. +
  4720. +
  4721. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  4722. +
  4723. +
  4724. + extern inline unsigned short from32to16(unsigned long x)
  4725. + {
  4726. + barrier();
  4727. + __asm__ __volatile__(
  4728. + "add %0, %1, %0\n"
  4729. + "cmpltu r15, %0, %1\n"
  4730. + "srli %0, %0, 16\n"
  4731. + "add %0, %0, r15\n"
  4732. + : "=r" (x)
  4733. + : "r" (x << 16), "0" (x)
  4734. + : "r15");
  4735. + return x;
  4736. + barrier();
  4737. + }
  4738. +
  4739. +
  4740. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  4741. +
  4742. +
  4743. +extern inline unsigned long do_csum(const unsigned char * buff, int len)
  4744. +{
  4745. + int odd, count;
  4746. + unsigned long result = 0;
  4747. +
  4748. + barrier();
  4749. + if (len <= 0)
  4750. + goto out;
  4751. + odd = 1 & (unsigned long) buff;
  4752. + if (odd) {
  4753. +////result = *buff; // dgt: Big endian
  4754. + result = *buff << 8; // dgt: Little endian
  4755. +
  4756. + len--;
  4757. + buff++;
  4758. + }
  4759. + count = len >> 1; /* nr of 16-bit words.. */
  4760. + if (count) {
  4761. + if (2 & (unsigned long) buff) {
  4762. + result += *(unsigned short *) buff;
  4763. + count--;
  4764. + len -= 2;
  4765. + buff += 2;
  4766. + }
  4767. + count >>= 1; /* nr of 32-bit words.. */
  4768. + if (count) {
  4769. + unsigned long carry = 0;
  4770. + do {
  4771. + unsigned long w = *(unsigned long *) buff;
  4772. + count--;
  4773. + buff += 4;
  4774. + result += carry;
  4775. + result += w;
  4776. + carry = (w > result);
  4777. + } while (count);
  4778. + result += carry;
  4779. + result = (result & 0xffff) + (result >> 16);
  4780. + }
  4781. + if (len & 2) {
  4782. + result += *(unsigned short *) buff;
  4783. + buff += 2;
  4784. + }
  4785. + }
  4786. + if (len & 1)
  4787. + result += *buff; /* This is little machine, byte is right */
  4788. + result = from32to16(result);
  4789. + if (odd)
  4790. + result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
  4791. +out:
  4792. + return result;
  4793. + barrier();
  4794. + }
  4795. +
  4796. +
  4797. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  4798. +
  4799. +
  4800. +/* ihl is always 5 or greater, almost always is 5, iph is always word
  4801. + * aligned but can fail to be dword aligned very often.
  4802. + */
  4803. +
  4804. + extern inline unsigned short ip_fast_csum(const unsigned char *iph, unsigned int ihl)
  4805. + {
  4806. + unsigned int sum;
  4807. +
  4808. + barrier();
  4809. + __asm__ __volatile__(
  4810. +" andi r8, %1, 2\n" /* Remember original alignment */
  4811. +" ldw %0, (%1)\n" /* 16 or 32 bit boundary */
  4812. +" beq r8, r0, 1f\n" /* Aligned on 32 bit boundary, go */
  4813. +" srli %0, %0, 16\n" /* Get correct 16 bits */
  4814. +" addi %2, %2, -1\n" /* Take off for 4 bytes, pickup last 2 at end */
  4815. +" addi %1, %1, 2\n" /* Adjust pointer to 32 bit boundary */
  4816. +" br 2f\n"
  4817. +"1:\n"
  4818. +" addi %2, %2, -1\n"
  4819. +" addi %1, %1, 4\n" /* Bump ptr a long word */
  4820. +"2:\n"
  4821. +" ldw r9, (%1)\n"
  4822. +"1:\n"
  4823. +" add %0, r9, %0\n"
  4824. +" bgeu %0, r9, 2f\n"
  4825. +" addi %0, %0, 1\n"
  4826. +"2:\n"
  4827. +" addi %1, %1, 4\n"
  4828. +" addi %2, %2, -1\n"
  4829. +" ldw r9, (%1)\n"
  4830. +" bne %2, r0, 1b\n"
  4831. +" beq r8, r0, 1f\n" /* 32 bit boundary time to leave */
  4832. +" srli r9, r9, 16\n" /* 16 bit boundary, get correct 16 bits */
  4833. +" add %0, r9, %0\n"
  4834. +" bgeu %0, r9, 1f\n"
  4835. +" addi %0, %0, 1\n"
  4836. +"1:\n"
  4837. +" slli %2, %0, 16\n"
  4838. +" add %0, %2, %0\n"
  4839. +" cmpltu r8, %0, %2\n"
  4840. +" srli %0, %0, 16\n"
  4841. +" add %0, %0, r8\n"
  4842. +" nor %0, %0, %0\n"
  4843. + : "=&r" (sum), "=&r" (iph), "=&r" (ihl)
  4844. + : "1" (iph), "2" (ihl)
  4845. + : "r8", "r9");
  4846. + return sum;
  4847. + barrier();
  4848. + }
  4849. +
  4850. +/*these 2 functions are now in checksum.c */
  4851. +unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum);
  4852. +unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum);
  4853. +
  4854. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  4855. +
  4856. +/*
  4857. + * the same as csum_partial_copy, but copies from user space.
  4858. + *
  4859. + * here even more important to align src and dst on a 32-bit (or even
  4860. + * better 64-bit) boundary
  4861. + */
  4862. +extern inline unsigned int
  4863. +csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *csum_err)
  4864. +{
  4865. + barrier();
  4866. + if (csum_err) *csum_err = 0;
  4867. + memcpy(dst, src, len);
  4868. + return csum_partial(dst, len, sum);
  4869. + barrier();
  4870. +}
  4871. +
  4872. +#define csum_partial_copy_nocheck(src, dst, len, sum) \
  4873. + csum_partial_copy ((src), (dst), (len), (sum))
  4874. +
  4875. +
  4876. +/*
  4877. + * this routine is used for miscellaneous IP-like checksums, mainly
  4878. + * in icmp.c
  4879. + */
  4880. +
  4881. +extern inline unsigned short ip_compute_csum(unsigned char * buff, int len)
  4882. +{
  4883. + barrier();
  4884. + return ~from32to16(do_csum(buff,len));
  4885. + barrier();
  4886. +}
  4887. +
  4888. +
  4889. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  4890. +
  4891. +
  4892. +#define csum_partial_copy_fromuser(s, d, l, w) \
  4893. + csum_partial_copy((char *) (s), (d), (l), (w))
  4894. +
  4895. +
  4896. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  4897. +
  4898. +
  4899. +/*
  4900. + * Fold a partial checksum without adding pseudo headers
  4901. + */
  4902. +extern __inline__ unsigned int csum_fold(unsigned int sum)
  4903. +{
  4904. + barrier();
  4905. + __asm__ __volatile__(
  4906. + "add %0, %1, %0\n"
  4907. + "cmpltu r8, %0, %1\n"
  4908. + "srli %0, %0, 16\n"
  4909. + "add %0, %0, r8\n"
  4910. + "nor %0, %0, %0\n"
  4911. + : "=r" (sum)
  4912. + : "r" (sum << 16), "0" (sum)
  4913. + : "r8");
  4914. + return sum;
  4915. + barrier();
  4916. +}
  4917. +
  4918. +
  4919. +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  4920. +
  4921. +
  4922. +extern __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr,
  4923. + unsigned long daddr,
  4924. + unsigned short len,
  4925. + unsigned short proto,
  4926. + unsigned int sum)
  4927. +{
  4928. + barrier();
  4929. + __asm__ __volatile__(
  4930. + "add %0, %1, %0\n"
  4931. + "cmpltu r8, %0, %1\n"
  4932. + "add %0, %0, r8\n" /* add carry */
  4933. + "add %0, %2, %0\n"
  4934. + "cmpltu r8, %0, %2\n"
  4935. + "add %0, %0, r8\n" /* add carry */
  4936. + "add %0, %3, %0\n"
  4937. + "cmpltu r8, %0, %3\n"
  4938. + "add %0, %0, r8\n" /* add carry */
  4939. + : "=r" (sum), "=r" (saddr)
  4940. + : "r" (daddr), "r" ( (ntohs(len)<<16) + (proto*256) ),
  4941. + "0" (sum),
  4942. + "1" (saddr)
  4943. + : "r8");
  4944. +
  4945. + return sum;
  4946. + barrier();
  4947. +}
  4948. +
  4949. +
  4950. +#endif /* (__NIOS2_CHECKSUM_H) */
  4951. --- linux/include/asm-nios2nommu/cprefix.h
  4952. +++ linux/include/asm-nios2nommu/cprefix.h
  4953. @@ -0,0 +1,38 @@
  4954. +/* cprefix.h: This file is included by assembly source which needs
  4955. + * to know what the c-label prefixes are. The newer versions
  4956. + * of cpp that come with gcc predefine such things to help
  4957. + * us out. The reason this stuff is needed is to make
  4958. + * solaris compiles of the kernel work.
  4959. + *
  4960. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  4961. + * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  4962. + *
  4963. + * All rights reserved.
  4964. + *
  4965. + * This program is free software; you can redistribute it and/or modify
  4966. + * it under the terms of the GNU General Public License as published by
  4967. + * the Free Software Foundation; either version 2 of the License, or
  4968. + * (at your option) any later version.
  4969. + *
  4970. + * This program is distributed in the hope that it will be useful, but
  4971. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  4972. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  4973. + * NON INFRINGEMENT. See the GNU General Public License for more
  4974. + * details.
  4975. + *
  4976. + * You should have received a copy of the GNU General Public License
  4977. + * along with this program; if not, write to the Free Software
  4978. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  4979. + *
  4980. + */
  4981. +#ifndef __NIOS2_CPREFIX_H
  4982. +#define __NIOS2_CPREFIX_H
  4983. +
  4984. +#define C_LABEL_PREFIX
  4985. +
  4986. +#define CONCAT(a, b) CONCAT2(a, b)
  4987. +#define CONCAT2(a, b) a##b
  4988. +
  4989. +#define C_LABEL(name) CONCAT(C_LABEL_PREFIX, name)
  4990. +
  4991. +#endif /* !(__NIOS2_CPREFIX_H) */
  4992. --- linux/include/asm-nios2nommu/cpumask.h
  4993. +++ linux/include/asm-nios2nommu/cpumask.h
  4994. @@ -0,0 +1,28 @@
  4995. +/*
  4996. + * All rights reserved.
  4997. + *
  4998. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  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. +
  5017. +#ifndef _ASM_NIOS2NOMMU_CPUMASK_H
  5018. +#define _ASM_NIOS2NOMMU_CPUMASK_H
  5019. +
  5020. +#include <asm-generic/cpumask.h>
  5021. +
  5022. +#endif /* _ASM_NIOS2NOMMU_CPUMASK_H */
  5023. --- linux/include/asm-nios2nommu/current.h
  5024. +++ linux/include/asm-nios2nommu/current.h
  5025. @@ -0,0 +1,39 @@
  5026. +#ifndef _NIOS2NOMMU_CURRENT_H
  5027. +#define _NIOS2NOMMU_CURRENT_H
  5028. +/*
  5029. + * current.h
  5030. + * (C) Copyright 2000, Lineo, David McCullough <davidm@uclinux.org>
  5031. + * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
  5032. + * (C) Copyright 2004, Microtronix Datacom Ltd.
  5033. + *
  5034. + * All rights reserved.
  5035. + *
  5036. + * This program is free software; you can redistribute it and/or modify
  5037. + * it under the terms of the GNU General Public License as published by
  5038. + * the Free Software Foundation; either version 2 of the License, or
  5039. + * (at your option) any later version.
  5040. + *
  5041. + * This program is distributed in the hope that it will be useful, but
  5042. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5043. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5044. + * NON INFRINGEMENT. See the GNU General Public License for more
  5045. + * details.
  5046. + *
  5047. + * You should have received a copy of the GNU General Public License
  5048. + * along with this program; if not, write to the Free Software
  5049. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5050. + *
  5051. + */
  5052. +
  5053. +#include <linux/thread_info.h>
  5054. +
  5055. +struct task_struct;
  5056. +
  5057. +static inline struct task_struct *get_current(void)
  5058. +{
  5059. + return(current_thread_info()->task);
  5060. +}
  5061. +
  5062. +#define current get_current()
  5063. +
  5064. +#endif /* _NIOS2NOMMU_CURRENT_H */
  5065. --- linux/include/asm-nios2nommu/delay.h
  5066. +++ linux/include/asm-nios2nommu/delay.h
  5067. @@ -0,0 +1,96 @@
  5068. +#ifndef _NIOS_DELAY_H
  5069. +#define _NIOS_DELAY_H
  5070. +
  5071. +/*--------------------------------------------------------------------
  5072. + *
  5073. + * include/asm-nios2nommu/delay.h
  5074. + *
  5075. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  5076. + *
  5077. + * Copyright (C) 2004 Microtronix Datacom Ltd
  5078. + *
  5079. + * This program is free software; you can redistribute it and/or modify
  5080. + * it under the terms of the GNU General Public License as published by
  5081. + * the Free Software Foundation; either version 2 of the License, or
  5082. + * (at your option) any later version.
  5083. + *
  5084. + * This program is distributed in the hope that it will be useful,
  5085. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5086. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  5087. + * GNU General Public License for more details.
  5088. + *
  5089. + *
  5090. + * Jan/20/2004 dgt NiosII
  5091. + *
  5092. + ---------------------------------------------------------------------*/
  5093. +
  5094. +
  5095. +#include <asm/param.h>
  5096. +
  5097. +extern __inline__ void __delay(unsigned long loops)
  5098. +{
  5099. + int dummy;
  5100. +
  5101. + __asm__ __volatile__(
  5102. + "1: \n\t"
  5103. + " beq %0,zero,2f\n\t"
  5104. + " addi %0, %0, -1\n\t"
  5105. + " br 1b\n\t"
  5106. + "2: \n\t"
  5107. +
  5108. + : "=r" (dummy) /* Need output for optimizer */
  5109. +
  5110. + : "0" (loops) /* %0 Input */
  5111. + );
  5112. +}
  5113. +
  5114. +/*
  5115. + * Note that 19 * 226 == 4294 ==~ 2^32 / 10^6, so
  5116. + * loops = (4294 * usecs * loops_per_jiffy * HZ) / 2^32.
  5117. + *
  5118. + * The mul instruction gives us loops = (a * b) / 2^32.
  5119. + * We choose a = usecs * 19 * HZ and b = loops_per_jiffy * 226
  5120. + * because this lets us support a wide range of HZ and
  5121. + * loops_per_jiffy values without either a or b overflowing 2^32.
  5122. + * Thus we need usecs * HZ <= (2^32 - 1) / 19 = 226050910 and
  5123. + * loops_per_jiffy <= (2^32 - 1) / 226 = 19004280
  5124. + * (which corresponds to ~3800 bogomips at HZ = 100).
  5125. + * -- paulus
  5126. + */
  5127. +#define __MAX_UDELAY (226050910UL/HZ) /* maximum udelay argument */
  5128. +#define __MAX_NDELAY (4294967295UL/HZ) /* maximum ndelay argument */
  5129. +
  5130. +extern unsigned long loops_per_jiffy;
  5131. +
  5132. +extern __inline__ void __udelay(unsigned int x)
  5133. +{
  5134. + unsigned int loops;
  5135. +
  5136. + __asm__("mulxuu %0,%1,%2" : "=r" (loops) :
  5137. + "r" (x), "r" (loops_per_jiffy * 226));
  5138. + __delay(loops);
  5139. +}
  5140. +
  5141. +extern __inline__ void __ndelay(unsigned int x)
  5142. +{
  5143. + unsigned int loops;
  5144. +
  5145. + __asm__("mulxuu %0,%1,%2" : "=r" (loops) :
  5146. + "r" (x), "r" (loops_per_jiffy * 5));
  5147. + __delay(loops);
  5148. +}
  5149. +
  5150. +extern void __bad_udelay(void); /* deliberately undefined */
  5151. +extern void __bad_ndelay(void); /* deliberately undefined */
  5152. +
  5153. +#define udelay(n) (__builtin_constant_p(n)? \
  5154. + ((n) > __MAX_UDELAY? __bad_udelay(): __udelay((n) * (19 * HZ))) : \
  5155. + __udelay((n) * (19 * HZ)))
  5156. +
  5157. +#define ndelay(n) (__builtin_constant_p(n)? \
  5158. + ((n) > __MAX_NDELAY? __bad_ndelay(): __ndelay((n) * HZ)) : \
  5159. + __ndelay((n) * HZ))
  5160. +
  5161. +#define muldiv(a, b, c) (((a)*(b))/(c))
  5162. +
  5163. +#endif /* defined(_NIOS_DELAY_H) */
  5164. --- linux/include/asm-nios2nommu/div64.h
  5165. +++ linux/include/asm-nios2nommu/div64.h
  5166. @@ -0,0 +1,31 @@
  5167. +#ifndef __ASMNIOS_DIV64_H
  5168. +#define __ASMNIOS_DIV64_H
  5169. +
  5170. +/*--------------------------------------------------------------------
  5171. + *
  5172. + * include/asm-nios2nommu/div64.h
  5173. + *
  5174. + * Derived from m68knommu
  5175. + *
  5176. + * Copyright (C) 2004 Microtronix Datacom Ltd
  5177. + *
  5178. + * This program is free software; you can redistribute it and/or modify
  5179. + * it under the terms of the GNU General Public License as published by
  5180. + * the Free Software Foundation; either version 2 of the License, or
  5181. + * (at your option) any later version.
  5182. + *
  5183. + * This program is distributed in the hope that it will be useful,
  5184. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5185. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  5186. + * GNU General Public License for more details.
  5187. + *
  5188. + *
  5189. + * Jan/20/2004 dgt NiosII
  5190. + *
  5191. + ---------------------------------------------------------------------*/
  5192. +
  5193. +
  5194. +#include <asm-generic/div64.h>
  5195. +
  5196. +#endif
  5197. +
  5198. --- linux/include/asm-nios2nommu/dma-mapping.h
  5199. +++ linux/include/asm-nios2nommu/dma-mapping.h
  5200. @@ -0,0 +1,25 @@
  5201. +/*
  5202. + * include/asm-s390/dma-mapping.h
  5203. + *
  5204. + * S390 version
  5205. + *
  5206. + * This file exists so that #include <dma-mapping.h> doesn't break anything.
  5207. + */
  5208. +
  5209. +#ifndef _ASM_DMA_MAPPING_H
  5210. +#define _ASM_DMA_MAPPING_H
  5211. +
  5212. +static inline void *dma_alloc_coherent(struct device *dev, size_t size,
  5213. + dma_addr_t *dma_handle, int flag)
  5214. +{
  5215. + BUG();
  5216. + return 0;
  5217. +}
  5218. +
  5219. +static inline void dma_free_coherent(struct device *dev, size_t size,
  5220. + void *vaddr, dma_addr_t dma_handle)
  5221. +{
  5222. + BUG();
  5223. +}
  5224. +
  5225. +#endif /* _ASM_DMA_MAPPING_H */
  5226. --- linux/include/asm-nios2nommu/dma.h
  5227. +++ linux/include/asm-nios2nommu/dma.h
  5228. @@ -0,0 +1,40 @@
  5229. +/* $Id: dma.h,v 1.5 2004/03/02 16:05:52 ken-h Exp $
  5230. + *
  5231. + * Copyright 1995 (C) David S. Miller (davem@caip.rutgers.edu)
  5232. + * Copyright 2004 (C) Microtronix Datacom Ltd.
  5233. + *
  5234. + * All rights reserved.
  5235. + *
  5236. + * This program is free software; you can redistribute it and/or modify
  5237. + * it under the terms of the GNU General Public License as published by
  5238. + * the Free Software Foundation; either version 2 of the License, or
  5239. + * (at your option) any later version.
  5240. + *
  5241. + * This program is distributed in the hope that it will be useful, but
  5242. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5243. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5244. + * NON INFRINGEMENT. See the GNU General Public License for more
  5245. + * details.
  5246. + *
  5247. + * You should have received a copy of the GNU General Public License
  5248. + * along with this program; if not, write to the Free Software
  5249. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5250. + *
  5251. + */
  5252. +
  5253. +#ifndef _ASM_NIOS2_DMA_H
  5254. +#define _ASM_NIOS2_DMA_H
  5255. +
  5256. +#include <linux/kernel.h>
  5257. +#include <asm/asm-offsets.h>
  5258. +
  5259. +#define MAX_DMA_CHANNELS 2
  5260. +#define MAX_DMA_ADDRESS (LINUX_SDRAM_START)
  5261. +#define DMA_MODE_READ 1
  5262. +#define DMA_MODE_WRITE 2
  5263. +
  5264. +extern int get_dma_list(char *);
  5265. +extern int request_dma(unsigned int, const char *);
  5266. +extern void free_dma(unsigned int);
  5267. +
  5268. +#endif /* !(_ASM_NIOS2_DMA_H) */
  5269. --- linux/include/asm-nios2nommu/elf.h
  5270. +++ linux/include/asm-nios2nommu/elf.h
  5271. @@ -0,0 +1,141 @@
  5272. +#ifndef __NIOS2_ELF_H
  5273. +#define __NIOS2_ELF_H
  5274. +
  5275. +/*--------------------------------------------------------------------
  5276. + *
  5277. + * include/asm-nios2nommu/elf.h
  5278. + *
  5279. + * Nio2 ELF relocation types
  5280. + *
  5281. + * Derived from M68knommu
  5282. + *
  5283. + * Copyright (C) 2004 Microtronix Datacom Ltd
  5284. + *
  5285. + * This program is free software; you can redistribute it and/or modify
  5286. + * it under the terms of the GNU General Public License as published by
  5287. + * the Free Software Foundation; either version 2 of the License, or
  5288. + * (at your option) any later version.
  5289. + *
  5290. + * This program is distributed in the hope that it will be useful,
  5291. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5292. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  5293. + * GNU General Public License for more details.
  5294. + *
  5295. + * Jan/20/2004 dgt NiosII
  5296. + * Mar/18/2004 xwt NiosII relocation types added
  5297. + *
  5298. + ---------------------------------------------------------------------*/
  5299. +
  5300. +// #include <linux/config.h>
  5301. +#include <asm/ptrace.h>
  5302. +#include <asm/user.h>
  5303. +
  5304. +#define R_NIOS2_NONE 0
  5305. +#define R_NIOS2_S16 1
  5306. +#define R_NIOS2_U16 2
  5307. +#define R_NIOS2_PCREL16 3
  5308. +#define R_NIOS2_CALL26 4
  5309. +#define R_NIOS2_IMM5 5
  5310. +#define R_NIOS2_CACHE_OPX 6
  5311. +#define R_NIOS2_IMM6 7
  5312. +#define R_NIOS2_IMM8 8
  5313. +#define R_NIOS2_HI16 9
  5314. +#define R_NIOS2_LO16 10
  5315. +#define R_NIOS2_HIADJ16 11
  5316. +#define R_NIOS2_BFD_RELOC_32 12
  5317. +#define R_NIOS2_BFD_RELOC_16 13
  5318. +#define R_NIOS2_BFD_RELOC_8 14
  5319. +#define R_NIOS2_GPREL 15
  5320. +#define R_NIOS2_GNU_VTINHERIT 16
  5321. +#define R_NIOS2_GNU_VTENTRY 17
  5322. +#define R_NIOS2_UJMP 18
  5323. +#define R_NIOS2_CJMP 19
  5324. +#define R_NIOS2_CALLR 20
  5325. +#define R_NIOS2_ALIGN 21
  5326. +/* Keep this the last entry. */
  5327. +#define R_NIOS2_NUM 22
  5328. +
  5329. +typedef unsigned long elf_greg_t;
  5330. +
  5331. +#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
  5332. +typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  5333. +
  5334. +typedef unsigned long elf_fpregset_t;
  5335. +
  5336. +/*
  5337. + * This is used to ensure we don't load something for the wrong architecture.
  5338. + */
  5339. +#define elf_check_arch(x) \
  5340. + ((x)->e_machine == EM_ALTERA_NIOS2)
  5341. +
  5342. +/*
  5343. + * These are used to set parameters in the core dumps.
  5344. + */
  5345. +#define ELF_CLASS ELFCLASS32
  5346. +#define ELF_DATA ELFDATA2LSB
  5347. +#define ELF_ARCH EM_ALTERA_NIOS2
  5348. +
  5349. +#define ELF_PLAT_INIT(_r, load_addr) _r->a1 = 0
  5350. +
  5351. +#define USE_ELF_CORE_DUMP
  5352. +#define ELF_EXEC_PAGESIZE 4096
  5353. +
  5354. +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
  5355. + use of this is to invoke "./ld.so someprog" to test out a new version of
  5356. + the loader. We need to make sure that it is out of the way of the program
  5357. + that it will "exec", and that there is sufficient room for the brk. */
  5358. +
  5359. +#define ELF_ET_DYN_BASE 0xD0000000UL
  5360. +
  5361. +/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
  5362. + now struct_user_regs, they are different) */
  5363. +
  5364. +#define ELF_CORE_COPY_REGS(pr_reg, regs) \
  5365. + /* Bleech. */ \
  5366. + pr_reg[0] = regs->r1; \
  5367. + pr_reg[1] = regs->r2; \
  5368. + pr_reg[2] = regs->r3; \
  5369. + pr_reg[3] = regs->r4; \
  5370. + pr_reg[4] = regs->r5; \
  5371. + pr_reg[5] = regs->r6; \
  5372. + pr_reg[6] = regs->r7; \
  5373. + pr_reg[7] = regs->r8; \
  5374. + pr_reg[8] = regs->r9; \
  5375. + pr_reg[9] = regs->r10; \
  5376. + pr_reg[10] = regs->r11; \
  5377. + pr_reg[11] = regs->r12; \
  5378. + pr_reg[12] = regs->r13; \
  5379. + pr_reg[13] = regs->r14; \
  5380. + pr_reg[14] = regs->r15; \
  5381. + pr_reg[23] = regs->sp; \
  5382. + pr_reg[26] = regs->estatus; \
  5383. + { \
  5384. + struct switch_stack *sw = ((struct switch_stack *)regs) - 1; \
  5385. + pr_reg[15] = sw->r16; \
  5386. + pr_reg[16] = sw->r17; \
  5387. + pr_reg[17] = sw->r18; \
  5388. + pr_reg[18] = sw->r19; \
  5389. + pr_reg[19] = sw->r20; \
  5390. + pr_reg[20] = sw->r21; \
  5391. + pr_reg[21] = sw->r22; \
  5392. + pr_reg[22] = sw->r23; \
  5393. + pr_reg[24] = sw->fp; \
  5394. + pr_reg[25] = sw->gp; \
  5395. + }
  5396. +
  5397. +/* This yields a mask that user programs can use to figure out what
  5398. + instruction set this cpu supports. */
  5399. +
  5400. +#define ELF_HWCAP (0)
  5401. +
  5402. +/* This yields a string that ld.so will use to load implementation
  5403. + specific libraries for optimization. This is more specific in
  5404. + intent than poking at uname or /proc/cpuinfo. */
  5405. +
  5406. +#define ELF_PLATFORM (NULL)
  5407. +
  5408. +#ifdef __KERNEL__
  5409. +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
  5410. +#endif
  5411. +
  5412. +#endif
  5413. --- linux/include/asm-nios2nommu/entry.h
  5414. +++ linux/include/asm-nios2nommu/entry.h
  5415. @@ -0,0 +1,188 @@
  5416. +/*
  5417. + * Hacked from m68knommu port.
  5418. + *
  5419. + * Copyright(C) 2004 Microtronix Datacom Ltd.
  5420. + *
  5421. + * All rights reserved.
  5422. + *
  5423. + * This program is free software; you can redistribute it and/or modify
  5424. + * it under the terms of the GNU General Public License as published by
  5425. + * the Free Software Foundation; either version 2 of the License, or
  5426. + * (at your option) any later version.
  5427. + *
  5428. + * This program is distributed in the hope that it will be useful, but
  5429. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5430. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5431. + * NON INFRINGEMENT. See the GNU General Public License for more
  5432. + * details.
  5433. + *
  5434. + * You should have received a copy of the GNU General Public License
  5435. + * along with this program; if not, write to the Free Software
  5436. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5437. + *
  5438. + */
  5439. +
  5440. +#ifndef __NIOS2NOMMU_ENTRY_H
  5441. +#define __NIOS2NOMMU_ENTRY_H
  5442. +
  5443. +#ifdef __ASSEMBLY__
  5444. +
  5445. +// #include <linux/config.h>
  5446. +#include <asm/setup.h>
  5447. +#include <asm/page.h>
  5448. +#include <asm/asm-offsets.h>
  5449. +
  5450. +/*
  5451. + * Stack layout in 'ret_from_exception':
  5452. + *
  5453. + * This allows access to the syscall arguments in registers r4-r8
  5454. + *
  5455. + * 0(sp) - r8
  5456. + * 4(sp) - r9
  5457. + * 8(sp) - r10
  5458. + * C(sp) - r11
  5459. + * 10(sp) - r12
  5460. + * 14(sp) - r13
  5461. + * 18(sp) - r14
  5462. + * 1C(sp) - r15
  5463. + * 20(sp) - r1
  5464. + * 24(sp) - r2
  5465. + * 28(sp) - r3
  5466. + * 2C(sp) - r4
  5467. + * 30(sp) - r5
  5468. + * 34(sp) - r6
  5469. + * 38(sp) - r7
  5470. + * 3C(sp) - orig_r2
  5471. + * 40(sp) - ra
  5472. + * 44(sp) - fp
  5473. + * 48(sp) - sp
  5474. + * 4C(sp) - gp
  5475. + * 50(sp) - estatus
  5476. + * 54(sp) - status_extension
  5477. + * 58(sp) - ea
  5478. + *
  5479. + */
  5480. +
  5481. +/* process bits for task_struct.flags */
  5482. +PF_TRACESYS_OFF = 3
  5483. +PF_TRACESYS_BIT = 5
  5484. +PF_PTRACED_OFF = 3
  5485. +PF_PTRACED_BIT = 4
  5486. +PF_DTRACE_OFF = 1
  5487. +PF_DTRACE_BIT = 5
  5488. +
  5489. +LENOSYS = 38
  5490. +
  5491. +/*
  5492. + * This defines the normal kernel pt-regs layout.
  5493. + *
  5494. + */
  5495. +
  5496. +/*
  5497. + * Standard Nios2 interrupt entry and exit macros.
  5498. + * Must be called with interrupts disabled.
  5499. + */
  5500. +.macro SAVE_ALL
  5501. + movia r24,status_extension // Read status extension
  5502. + ldw r24,0(r24)
  5503. + andi r24,r24,PS_S_ASM
  5504. + bne r24,r0,1f // In supervisor mode, already on kernel stack
  5505. + movia r24,_current_thread // Switch to current kernel stack
  5506. + ldw r24,0(r24) // using the thread_info
  5507. + addi r24,r24,THREAD_SIZE_ASM-PT_REGS_SIZE
  5508. + stw sp,PT_SP(r24) // Save user stack before changing
  5509. + mov sp,r24
  5510. + br 2f
  5511. +
  5512. +1: mov r24,sp
  5513. + addi sp,sp,-PT_REGS_SIZE // Backup the kernel stack pointer
  5514. + stw r24,PT_SP(sp)
  5515. +2: stw r1,PT_R1(sp)
  5516. + stw r2,PT_R2(sp)
  5517. + stw r3,PT_R3(sp)
  5518. + stw r4,PT_R4(sp)
  5519. + stw r5,PT_R5(sp)
  5520. + stw r6,PT_R6(sp)
  5521. + stw r7,PT_R7(sp)
  5522. + stw r8,PT_R8(sp)
  5523. + stw r9,PT_R9(sp)
  5524. + stw r10,PT_R10(sp)
  5525. + stw r11,PT_R11(sp)
  5526. + stw r12,PT_R12(sp)
  5527. + stw r13,PT_R13(sp)
  5528. + stw r14,PT_R14(sp)
  5529. + stw r15,PT_R15(sp)
  5530. + stw r2,PT_ORIG_R2(sp)
  5531. + stw ra,PT_RA(sp)
  5532. + stw fp,PT_FP(sp)
  5533. + stw gp,PT_GP(sp)
  5534. + rdctl r24,estatus
  5535. + stw r24,PT_ESTATUS(sp)
  5536. + movia r24,status_extension // Read status extension
  5537. + ldw r1,0(r24)
  5538. + stw r1,PT_STATUS_EXTENSION(sp) // Store user/supervisor status
  5539. + ORI32 r1,r1,PS_S_ASM // Set supervisor mode
  5540. + stw r1,0(r24)
  5541. + stw ea,PT_EA(sp)
  5542. +.endm
  5543. +
  5544. +.macro RESTORE_ALL
  5545. + ldw r1,PT_STATUS_EXTENSION(sp) // Restore user/supervisor status
  5546. + movia r24,status_extension
  5547. + stw r1,0(r24)
  5548. + ldw r1,PT_R1(sp) // Restore registers
  5549. + ldw r2,PT_R2(sp)
  5550. + ldw r3,PT_R3(sp)
  5551. + ldw r4,PT_R4(sp)
  5552. + ldw r5,PT_R5(sp)
  5553. + ldw r6,PT_R6(sp)
  5554. + ldw r7,PT_R7(sp)
  5555. + ldw r8,PT_R8(sp)
  5556. + ldw r9,PT_R9(sp)
  5557. + ldw r10,PT_R10(sp)
  5558. + ldw r11,PT_R11(sp)
  5559. + ldw r12,PT_R12(sp)
  5560. + ldw r13,PT_R13(sp)
  5561. + ldw r14,PT_R14(sp)
  5562. + ldw r15,PT_R15(sp)
  5563. + ldw ra,PT_RA(sp)
  5564. + ldw fp,PT_FP(sp)
  5565. + ldw gp,PT_GP(sp)
  5566. + ldw r24,PT_ESTATUS(sp)
  5567. + wrctl estatus,r24
  5568. + ldw ea,PT_EA(sp)
  5569. + ldw sp,PT_SP(sp) // Restore sp last
  5570. +.endm
  5571. +
  5572. +.macro SAVE_SWITCH_STACK
  5573. + addi sp,sp,-SWITCH_STACK_SIZE
  5574. + stw r16,SW_R16(sp)
  5575. + stw r17,SW_R17(sp)
  5576. + stw r18,SW_R18(sp)
  5577. + stw r19,SW_R19(sp)
  5578. + stw r20,SW_R20(sp)
  5579. + stw r21,SW_R21(sp)
  5580. + stw r22,SW_R22(sp)
  5581. + stw r23,SW_R23(sp)
  5582. + stw fp,SW_FP(sp)
  5583. + stw gp,SW_GP(sp)
  5584. + stw ra,SW_RA(sp)
  5585. +.endm
  5586. +
  5587. +.macro RESTORE_SWITCH_STACK
  5588. + ldw r16,SW_R16(sp)
  5589. + ldw r17,SW_R17(sp)
  5590. + ldw r18,SW_R18(sp)
  5591. + ldw r19,SW_R19(sp)
  5592. + ldw r20,SW_R20(sp)
  5593. + ldw r21,SW_R21(sp)
  5594. + ldw r22,SW_R22(sp)
  5595. + ldw r23,SW_R23(sp)
  5596. + ldw fp,SW_FP(sp)
  5597. + ldw gp,SW_GP(sp)
  5598. + ldw ra,SW_RA(sp)
  5599. + addi sp,sp,SWITCH_STACK_SIZE
  5600. +.endm
  5601. +
  5602. +#endif /* __ASSEMBLY__ */
  5603. +#endif /* __NIOS2NOMMU_ENTRY_H */
  5604. --- linux/include/asm-nios2nommu/errno.h
  5605. +++ linux/include/asm-nios2nommu/errno.h
  5606. @@ -0,0 +1,6 @@
  5607. +#ifndef _NIOS2NOMMU_ERRNO_H
  5608. +#define _NIOS2NOMMU_ERRNO_H
  5609. +
  5610. +#include <asm-generic/errno.h>
  5611. +
  5612. +#endif /* _NIOS2NOMMU_ERRNO_H */
  5613. --- linux/include/asm-nios2nommu/fcntl.h
  5614. +++ linux/include/asm-nios2nommu/fcntl.h
  5615. @@ -0,0 +1,110 @@
  5616. +/*
  5617. + * This file came from the m68k port.
  5618. + *
  5619. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  5620. + *
  5621. + * All rights reserved.
  5622. + *
  5623. + * This program is free software; you can redistribute it and/or modify
  5624. + * it under the terms of the GNU General Public License as published by
  5625. + * the Free Software Foundation; either version 2 of the License, or
  5626. + * (at your option) any later version.
  5627. + *
  5628. + * This program is distributed in the hope that it will be useful, but
  5629. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5630. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5631. + * NON INFRINGEMENT. See the GNU General Public License for more
  5632. + * details.
  5633. + *
  5634. + * You should have received a copy of the GNU General Public License
  5635. + * along with this program; if not, write to the Free Software
  5636. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5637. + *
  5638. + */
  5639. +#ifndef _NIOS2_FCNTL_H
  5640. +#define _NIOS2_FCNTL_H
  5641. +
  5642. +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
  5643. + located on an ext2 file system */
  5644. +#define O_ACCMODE 0003
  5645. +#define O_RDONLY 00
  5646. +#define O_WRONLY 01
  5647. +#define O_RDWR 02
  5648. +#define O_CREAT 0100 /* not fcntl */
  5649. +#define O_EXCL 0200 /* not fcntl */
  5650. +#define O_NOCTTY 0400 /* not fcntl */
  5651. +#define O_TRUNC 01000 /* not fcntl */
  5652. +#define O_APPEND 02000
  5653. +#define O_NONBLOCK 04000
  5654. +#define O_NDELAY O_NONBLOCK
  5655. +#define O_SYNC 010000
  5656. +#define FASYNC 020000 /* fcntl, for BSD compatibility */
  5657. +#define O_DIRECTORY 040000 /* must be a directory */
  5658. +#define O_NOFOLLOW 0100000 /* don't follow links */
  5659. +#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
  5660. +#define O_LARGEFILE 0400000
  5661. +#define O_NOATIME 01000000
  5662. +
  5663. +#define F_DUPFD 0 /* dup */
  5664. +#define F_GETFD 1 /* get close_on_exec */
  5665. +#define F_SETFD 2 /* set/clear close_on_exec */
  5666. +#define F_GETFL 3 /* get file->f_flags */
  5667. +#define F_SETFL 4 /* set file->f_flags */
  5668. +#define F_GETLK 5
  5669. +#define F_SETLK 6
  5670. +#define F_SETLKW 7
  5671. +
  5672. +#define F_SETOWN 8 /* for sockets. */
  5673. +#define F_GETOWN 9 /* for sockets. */
  5674. +#define F_SETSIG 10 /* for sockets. */
  5675. +#define F_GETSIG 11 /* for sockets. */
  5676. +
  5677. +#define F_GETLK64 12 /* using 'struct flock64' */
  5678. +#define F_SETLK64 13
  5679. +#define F_SETLKW64 14
  5680. +
  5681. +/* for F_[GET|SET]FL */
  5682. +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
  5683. +
  5684. +/* for posix fcntl() and lockf() */
  5685. +#define F_RDLCK 0
  5686. +#define F_WRLCK 1
  5687. +#define F_UNLCK 2
  5688. +
  5689. +/* for old implementation of bsd flock () */
  5690. +#define F_EXLCK 4 /* or 3 */
  5691. +#define F_SHLCK 8 /* or 4 */
  5692. +
  5693. +/* for leases */
  5694. +#define F_INPROGRESS 16
  5695. +
  5696. +/* operations for bsd flock(), also used by the kernel implementation */
  5697. +#define LOCK_SH 1 /* shared lock */
  5698. +#define LOCK_EX 2 /* exclusive lock */
  5699. +#define LOCK_NB 4 /* or'd with one of the above to prevent
  5700. + blocking */
  5701. +#define LOCK_UN 8 /* remove lock */
  5702. +
  5703. +#define LOCK_MAND 32 /* This is a mandatory flock */
  5704. +#define LOCK_READ 64 /* ... Which allows concurrent read operations */
  5705. +#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
  5706. +#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
  5707. +
  5708. +struct flock {
  5709. + short l_type;
  5710. + short l_whence;
  5711. + off_t l_start;
  5712. + off_t l_len;
  5713. + pid_t l_pid;
  5714. +};
  5715. +
  5716. +struct flock64 {
  5717. + short l_type;
  5718. + short l_whence;
  5719. + loff_t l_start;
  5720. + loff_t l_len;
  5721. + pid_t l_pid;
  5722. +};
  5723. +
  5724. +#define F_LINUX_SPECIFIC_BASE 1024
  5725. +#endif /* _NIOS2_FCNTL_H */
  5726. --- linux/include/asm-nios2nommu/flat.h
  5727. +++ linux/include/asm-nios2nommu/flat.h
  5728. @@ -0,0 +1,126 @@
  5729. +/*
  5730. + * include/asm-nios2nommu/flat.h -- uClinux bFLT relocations
  5731. + *
  5732. + * Copyright (C) 2004,05 Microtronix Datacom Ltd
  5733. + *
  5734. + * This file is subject to the terms and conditions of the GNU General
  5735. + * Public License. See the file COPYING in the main directory of this
  5736. + * archive for more details.
  5737. + *
  5738. + * Written by Wentao Xu <wentao@microtronix.com>
  5739. + */
  5740. +
  5741. +#ifndef __NIOS2_FLAT_H__
  5742. +#define __NIOS2_FLAT_H__
  5743. +
  5744. +#define flat_reloc_valid(reloc, size) ((reloc) <= (size + 0x8000))
  5745. +
  5746. +/* The stack is 64-bit aligned for Nios II, so (sp - 1) shall
  5747. + * be 64-bit aligned, where -1 is for argc
  5748. + */
  5749. +#define flat_stack_align(sp) (sp = (unsigned long *)(((unsigned long)sp - 1) & (-8)))
  5750. +
  5751. +/* The uClibc port for Nios II expects the argc is followed by argv and envp */
  5752. +#define flat_argvp_envp_on_stack() 1
  5753. +
  5754. +#define flat_old_ram_flag(flags) (flags)
  5755. +
  5756. +/* We store the type of relocation in the top 4 bits of the `relval.' */
  5757. +
  5758. +/* Convert a relocation entry into an address. */
  5759. +static inline unsigned long
  5760. +flat_get_relocate_addr (unsigned long relval)
  5761. +{
  5762. + return relval & 0x0fffffff; /* Mask out top 4-bits */
  5763. +}
  5764. +
  5765. +#define FLAT_NIOS2_RELOC_TYPE(relval) ((relval) >> 28)
  5766. +
  5767. +#define FLAT_NIOS2_R_32 0 /* Normal 32-bit reloc */
  5768. +#define FLAT_NIOS2_R_HI_LO 1 /* High 16-bits + low 16-bits field */
  5769. +#define FLAT_NIOS2_R_HIADJ_LO 2 /* High 16-bits adjust + low 16-bits field */
  5770. +#define FLAT_NIOS2_R_CALL26 4 /* Call imm26 */
  5771. +
  5772. +/* Extract the address to be relocated from the symbol reference at rp;
  5773. + * relval is the raw relocation-table entry from which RP is derived.
  5774. + * rp shall always be 32-bit aligned
  5775. + */
  5776. +static inline unsigned long flat_get_addr_from_rp (unsigned long *rp,
  5777. + unsigned long relval,
  5778. + unsigned long flags)
  5779. +{
  5780. + switch (FLAT_NIOS2_RELOC_TYPE(relval))
  5781. + {
  5782. + case FLAT_NIOS2_R_32:
  5783. + /* Simple 32-bit address. The loader expect it in bigger endian */
  5784. + return htonl(*rp);
  5785. +
  5786. + case FLAT_NIOS2_R_HI_LO:
  5787. + /* get the two 16-bit immediate value from instructions, then
  5788. + * construct a 32-bit value. Again the loader expect bigger endian
  5789. + */
  5790. + return htonl ((((rp[0] >> 6) & 0xFFFF) << 16 ) |
  5791. + ((rp[1] >> 6) & 0xFFFF));
  5792. +
  5793. + case FLAT_NIOS2_R_HIADJ_LO:
  5794. + {
  5795. + /* get the two 16-bit immediate value from instructions, then
  5796. + * construct a 32-bit value. Again the loader expect bigger endian
  5797. + */
  5798. + unsigned int low, high;
  5799. + high = (rp[0] >> 6) & 0xFFFF;
  5800. + low = (rp[1] >> 6) & 0xFFFF;
  5801. +
  5802. + if ((low >> 15) & 1) high--;
  5803. +
  5804. + return htonl ((high << 16 ) | low );
  5805. + }
  5806. + case FLAT_NIOS2_R_CALL26:
  5807. + /* the 26-bit immediate value is actually 28-bit */
  5808. + return htonl(((*rp) >> 6) << 2);
  5809. +
  5810. + default:
  5811. + return ~0; /* bogus value */
  5812. + }
  5813. +}
  5814. +
  5815. +/* Insert the address addr into the symbol reference at rp;
  5816. + * relval is the raw relocation-table entry from which rp is derived.
  5817. + * rp shall always be 32-bit aligned
  5818. + */
  5819. +static inline void flat_put_addr_at_rp (unsigned long *rp, unsigned long addr,
  5820. + unsigned long relval)
  5821. +{
  5822. + unsigned long exist_val;
  5823. + switch (FLAT_NIOS2_RELOC_TYPE (relval)) {
  5824. + case FLAT_NIOS2_R_32:
  5825. + /* Simple 32-bit address. */
  5826. + *rp = addr;
  5827. + break;
  5828. +
  5829. + case FLAT_NIOS2_R_HI_LO:
  5830. + exist_val = rp[0];
  5831. + rp[0] = ((((exist_val >> 22) << 16) | (addr >> 16)) << 6) | (exist_val & 0x3F);
  5832. + exist_val = rp[1];
  5833. + rp[1] = ((((exist_val >> 22) << 16) | (addr & 0xFFFF)) << 6) | (exist_val & 0x3F);
  5834. + break;
  5835. +
  5836. + case FLAT_NIOS2_R_HIADJ_LO:
  5837. + {
  5838. + unsigned int high = (addr >> 16);
  5839. + if ((addr >> 15) & 1)
  5840. + high = (high + 1) & 0xFFFF;
  5841. + exist_val = rp[0];
  5842. + rp[0] = ((((exist_val >> 22) << 16) | high) << 6) | (exist_val & 0x3F);
  5843. + exist_val = rp[1];
  5844. + rp[1] = ((((exist_val >> 22) << 16) | (addr & 0xFFFF)) << 6) | (exist_val & 0x3F);
  5845. + break;
  5846. + }
  5847. + case FLAT_NIOS2_R_CALL26:
  5848. + /* the opcode of CALL is 0, so just store the value */
  5849. + *rp = ((addr >> 2) << 6);
  5850. + break;
  5851. + }
  5852. +}
  5853. +
  5854. +#endif /* __NIOS2_FLAT_H__ */
  5855. --- linux/include/asm-nios2nommu/hardirq.h
  5856. +++ linux/include/asm-nios2nommu/hardirq.h
  5857. @@ -0,0 +1,85 @@
  5858. +/*
  5859. + * Ported from m68knommu
  5860. + *
  5861. + * Copyright (C) 2003, Microtronix Datacom Ltd.
  5862. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  5863. + *
  5864. + * All rights reserved.
  5865. + *
  5866. + * This program is free software; you can redistribute it and/or modify
  5867. + * it under the terms of the GNU General Public License as published by
  5868. + * the Free Software Foundation; either version 2 of the License, or
  5869. + * (at your option) any later version.
  5870. + *
  5871. + * This program is distributed in the hope that it will be useful, but
  5872. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5873. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5874. + * NON INFRINGEMENT. See the GNU General Public License for more
  5875. + * details.
  5876. + *
  5877. + * You should have received a copy of the GNU General Public License
  5878. + * along with this program; if not, write to the Free Software
  5879. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5880. + *
  5881. + */
  5882. +#ifndef __NIOS2_HARDIRQ_H
  5883. +#define __NIOS2_HARDIRQ_H
  5884. +
  5885. +// #include <linux/config.h>
  5886. +#include <linux/cache.h>
  5887. +#include <linux/threads.h>
  5888. +
  5889. +typedef struct {
  5890. + unsigned int __softirq_pending;
  5891. + unsigned int __syscall_count;
  5892. + struct task_struct * __ksoftirqd_task;
  5893. +} ____cacheline_aligned irq_cpustat_t;
  5894. +
  5895. +#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
  5896. +
  5897. +/*
  5898. + * We put the hardirq and softirq counter into the preemption
  5899. + * counter. The bitmask has the following meaning:
  5900. + *
  5901. + * - bits 0-7 are the preemption count (max preemption depth: 256)
  5902. + * - bits 8-15 are the softirq count (max # of softirqs: 256)
  5903. + * - bits 16-23 are the hardirq count (max # of hardirqs: 256)
  5904. + *
  5905. + * - ( bit 26 is the PREEMPT_ACTIVE flag. )
  5906. + *
  5907. + * PREEMPT_MASK: 0x000000ff
  5908. + * HARDIRQ_MASK: 0x0000ff00
  5909. + * SOFTIRQ_MASK: 0x00ff0000
  5910. + */
  5911. +
  5912. +#define PREEMPT_BITS 8
  5913. +#define SOFTIRQ_BITS 8
  5914. +#define HARDIRQ_BITS 8
  5915. +
  5916. +#define PREEMPT_SHIFT 0
  5917. +#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS)
  5918. +#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
  5919. +
  5920. +/*
  5921. + * The hardirq mask has to be large enough to have
  5922. + * space for potentially all IRQ sources in the system
  5923. + * nesting on a single CPU:
  5924. + */
  5925. +#if (1 << HARDIRQ_BITS) < NR_IRQS
  5926. +# error HARDIRQ_BITS is too low!
  5927. +#endif
  5928. +
  5929. +#define irq_enter() (preempt_count() += HARDIRQ_OFFSET)
  5930. +#define irq_exit() \
  5931. +do { \
  5932. + preempt_count() -= IRQ_EXIT_OFFSET; \
  5933. + if (!in_interrupt() && softirq_pending(smp_processor_id())) \
  5934. + do_softirq(); \
  5935. + preempt_enable_no_resched(); \
  5936. +} while (0)
  5937. +
  5938. +#ifdef CONFIG_SMP
  5939. +# error nios2nommu SMP is not available
  5940. +#endif /* CONFIG_SMP */
  5941. +
  5942. +#endif /* __NIOS2_HARDIRQ_H */
  5943. --- linux/include/asm-nios2nommu/hdreg.h
  5944. +++ linux/include/asm-nios2nommu/hdreg.h
  5945. @@ -0,0 +1,30 @@
  5946. +/*
  5947. + * Copyright (C) 1994-1996 Linus Torvalds & authors
  5948. + * Copyright (C) 2002 Wentau Xu (www.microtronix.com)
  5949. + * copyright (C) 2004 Microtronix Datacom Ltd.
  5950. + *
  5951. + * All rights reserved.
  5952. + *
  5953. + * This program is free software; you can redistribute it and/or modify
  5954. + * it under the terms of the GNU General Public License as published by
  5955. + * the Free Software Foundation; either version 2 of the License, or
  5956. + * (at your option) any later version.
  5957. + *
  5958. + * This program is distributed in the hope that it will be useful, but
  5959. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  5960. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  5961. + * NON INFRINGEMENT. See the GNU General Public License for more
  5962. + * details.
  5963. + *
  5964. + * You should have received a copy of the GNU General Public License
  5965. + * along with this program; if not, write to the Free Software
  5966. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  5967. + *
  5968. + */
  5969. +
  5970. +#ifndef __NIOS2_HDREG_H
  5971. +#define __NIOS2_HDREG_H
  5972. +
  5973. +typedef unsigned long ide_ioreg_t;
  5974. +
  5975. +#endif /* __NIOS2_HDREG_H */
  5976. --- linux/include/asm-nios2nommu/hw_irq.h
  5977. +++ linux/include/asm-nios2nommu/hw_irq.h
  5978. @@ -0,0 +1,16 @@
  5979. +#ifndef _ASM_HW_IRQ_H
  5980. +#define _ASM_HW_IRQ_H
  5981. +
  5982. +/*
  5983. + * linux/include/asm/hw_irq.h
  5984. + *
  5985. + * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
  5986. + *
  5987. + * moved some of the old arch/i386/kernel/irq.h to here. VY
  5988. + *
  5989. + * IRQ/IPI changes taken from work by Thomas Radke
  5990. + * <tomsoft@informatik.tu-chemnitz.de>
  5991. + */
  5992. +
  5993. +
  5994. +#endif /* _ASM_HW_IRQ_H */
  5995. --- linux/include/asm-nios2nommu/ide.h
  5996. +++ linux/include/asm-nios2nommu/ide.h
  5997. @@ -0,0 +1,47 @@
  5998. +/*
  5999. + * linux/include/asm-niosnommu2/ide.h
  6000. + *
  6001. + * Copyright (C) 1994-1996 Linus Torvalds & authors
  6002. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  6003. + *
  6004. + * All rights reserved.
  6005. + *
  6006. + * This program is free software; you can redistribute it and/or modify
  6007. + * it under the terms of the GNU General Public License as published by
  6008. + * the Free Software Foundation; either version 2 of the License, or
  6009. + * (at your option) any later version.
  6010. + *
  6011. + * This program is distributed in the hope that it will be useful, but
  6012. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6013. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6014. + * NON INFRINGEMENT. See the GNU General Public License for more
  6015. + * details.
  6016. + *
  6017. + * You should have received a copy of the GNU General Public License
  6018. + * along with this program; if not, write to the Free Software
  6019. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6020. + *
  6021. + */
  6022. +
  6023. +#ifndef __ASMNIOS2_IDE_H
  6024. +#define __ASMNIOS2_IDE_H
  6025. +
  6026. +#ifdef __KERNEL__
  6027. +#undef MAX_HWIFS /* we're going to force it */
  6028. +
  6029. +#ifndef MAX_HWIFS
  6030. +#define MAX_HWIFS 1
  6031. +#endif
  6032. +
  6033. +#define IDE_ARCH_OBSOLETE_INIT
  6034. +#define IDE_ARCH_OBSOLETE_DEFAULTS
  6035. +#define ide_default_io_base(i) ((unsigned long)na_ide_ide)
  6036. +#define ide_default_irq(b) (na_ide_ide_irq)
  6037. +#define ide_init_default_irq(base) ide_default_irq(base)
  6038. +#define ide_default_io_ctl(base) ((base) + (0xE*4))
  6039. +
  6040. +#include <asm-generic/ide_iops.h>
  6041. +
  6042. +#endif /* __KERNEL__ */
  6043. +
  6044. +#endif /* __ASMNIOS2_IDE_H */
  6045. --- linux/include/asm-nios2nommu/init.h
  6046. +++ linux/include/asm-nios2nommu/init.h
  6047. @@ -0,0 +1,22 @@
  6048. +/*
  6049. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6050. + *
  6051. + * All rights reserved.
  6052. + *
  6053. + * This program is free software; you can redistribute it and/or modify
  6054. + * it under the terms of the GNU General Public License as published by
  6055. + * the Free Software Foundation; either version 2 of the License, or
  6056. + * (at your option) any later version.
  6057. + *
  6058. + * This program is distributed in the hope that it will be useful, but
  6059. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6060. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6061. + * NON INFRINGEMENT. See the GNU General Public License for more
  6062. + * details.
  6063. + *
  6064. + * You should have received a copy of the GNU General Public License
  6065. + * along with this program; if not, write to the Free Software
  6066. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6067. + *
  6068. + */
  6069. +#error "<asm/init.h> should never be used - use <linux/init.h> instead"
  6070. --- linux/include/asm-nios2nommu/io.h
  6071. +++ linux/include/asm-nios2nommu/io.h
  6072. @@ -0,0 +1,239 @@
  6073. +/*
  6074. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6075. + *
  6076. + * All rights reserved.
  6077. + *
  6078. + * This program is free software; you can redistribute it and/or modify
  6079. + * it under the terms of the GNU General Public License as published by
  6080. + * the Free Software Foundation; either version 2 of the License, or
  6081. + * (at your option) any later version.
  6082. + *
  6083. + * This program is distributed in the hope that it will be useful, but
  6084. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6085. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6086. + * NON INFRINGEMENT. See the GNU General Public License for more
  6087. + * details.
  6088. + *
  6089. + * You should have received a copy of the GNU General Public License
  6090. + * along with this program; if not, write to the Free Software
  6091. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6092. + *
  6093. + */
  6094. +
  6095. +#ifndef __NIOS2_IO_H
  6096. +#define __NIOS2_IO_H
  6097. +
  6098. +#ifdef __KERNEL__
  6099. +
  6100. +#include <linux/kernel.h>
  6101. +
  6102. +#include <asm/page.h> /* IO address mapping routines need this */
  6103. +#include <asm/system.h>
  6104. +#include <asm/unaligned.h>
  6105. +
  6106. +extern void insw(unsigned long port, void *dst, unsigned long count);
  6107. +extern void outsw(unsigned long port, void *src, unsigned long count);
  6108. +extern void insl(unsigned long port, void *dst, unsigned long count);
  6109. +extern void outsl(unsigned long port, void *src, unsigned long count);
  6110. +
  6111. +
  6112. +/*
  6113. + * readX/writeX() are used to access memory mapped devices. On some
  6114. + * architectures the memory mapped IO stuff needs to be accessed
  6115. + * differently. On the Nios architecture, we just read/write the
  6116. + * memory location directly.
  6117. + */
  6118. +
  6119. +#define readb(addr) \
  6120. +({ \
  6121. + unsigned char __res;\
  6122. + __asm__ __volatile__( \
  6123. + "ldbuio %0, 0(%1)" \
  6124. + : "=r"(__res) \
  6125. + : "r" (addr)); \
  6126. + __res; \
  6127. +})
  6128. +
  6129. +#define readw(addr) \
  6130. +({ \
  6131. + unsigned short __res;\
  6132. + __asm__ __volatile__( \
  6133. + "ldhuio %0, 0(%1)" \
  6134. + : "=r"(__res) \
  6135. + : "r" (addr)); \
  6136. + __res; \
  6137. +})
  6138. +
  6139. +#define readl(addr) \
  6140. +({ \
  6141. + unsigned int __res;\
  6142. + __asm__ __volatile__( \
  6143. + "ldwio %0, 0(%1)" \
  6144. + : "=r"(__res) \
  6145. + : "r" (addr)); \
  6146. + __res; \
  6147. +})
  6148. +
  6149. +#define writeb(b,addr) \
  6150. +({ \
  6151. + __asm__ __volatile__( \
  6152. + "stbio %0, 0(%1)" \
  6153. + : : "r"(b), "r" (addr)); \
  6154. +})
  6155. +
  6156. +#define writew(b,addr) \
  6157. +({ \
  6158. + __asm__ __volatile__( \
  6159. + "sthio %0, 0(%1)" \
  6160. + : : "r"(b), "r" (addr)); \
  6161. +})
  6162. +
  6163. +#define writel(b,addr) \
  6164. +({ \
  6165. + __asm__ __volatile__( \
  6166. + "stwio %0, 0(%1)" \
  6167. + : : "r"(b), "r" (addr)); \
  6168. +})
  6169. +
  6170. +#define __raw_readb readb
  6171. +#define __raw_readw readw
  6172. +#define __raw_readl readl
  6173. +#define __raw_writeb writeb
  6174. +#define __raw_writew writew
  6175. +#define __raw_writel writel
  6176. +
  6177. +
  6178. +/*
  6179. + * make the short names macros so specific devices
  6180. + * can override them as required
  6181. + */
  6182. +
  6183. +#define memset_io(addr,c,len) memset((void *)(((unsigned int)(addr)) | 0x80000000),(c),(len))
  6184. +#define memcpy_fromio(to,from,len) memcpy((to),(void *)(((unsigned int)(from)) | 0x80000000),(len))
  6185. +#define memcpy_toio(to,from,len) memcpy((void *)(((unsigned int)(to)) | 0x80000000),(from),(len))
  6186. +
  6187. +#define inb(addr) readb(addr)
  6188. +#define inw(addr) readw(addr)
  6189. +#define inl(addr) readl(addr)
  6190. +
  6191. +#define outb(x,addr) ((void) writeb(x,addr))
  6192. +#define outw(x,addr) ((void) writew(x,addr))
  6193. +#define outl(x,addr) ((void) writel(x,addr))
  6194. +
  6195. +#define inb_p(addr) inb(addr)
  6196. +#define inw_p(addr) inw(addr)
  6197. +#define inl_p(addr) inl(addr)
  6198. +
  6199. +#define outb_p(x,addr) outb(x,addr)
  6200. +#define outw_p(x,addr) outw(x,addr)
  6201. +#define outl_p(x,addr) outl(x,addr)
  6202. +
  6203. +
  6204. +
  6205. +extern inline void insb(unsigned long port, void *dst, unsigned long count)
  6206. +{
  6207. + unsigned char *p=(unsigned char*)dst;
  6208. + while (count--)
  6209. + *p++ = inb(port);
  6210. +}
  6211. +
  6212. +/* See arch/niosnommu/io.c for optimized version */
  6213. +extern inline void _insw(unsigned long port, void *dst, unsigned long count)
  6214. +{
  6215. + unsigned short *p=(unsigned short*)dst;
  6216. + while (count--)
  6217. + *p++ = inw(port);
  6218. +}
  6219. +
  6220. +/* See arch/niosnommu/kernel/io.c for unaligned destination pointer */
  6221. +extern inline void _insl(unsigned long port, void *dst, unsigned long count)
  6222. +{
  6223. + unsigned long *p=(unsigned long*)dst;
  6224. + while (count--)
  6225. + *p++ = inl(port);
  6226. +}
  6227. +
  6228. +extern inline void outsb(unsigned long port, void *src, unsigned long count)
  6229. +{
  6230. + unsigned char *p=(unsigned char*)src;
  6231. + while (count--)
  6232. + outb( *p++, port );
  6233. +}
  6234. +
  6235. +/* See arch/niosnommu/io.c for optimized version */
  6236. +extern inline void _outsw(unsigned long port, void *src, unsigned long count)
  6237. +{
  6238. + unsigned short *p=(unsigned short*)src;
  6239. + while (count--)
  6240. + outw( *p++, port );
  6241. +}
  6242. +
  6243. +/* See arch/niosnommu/kernel/io.c for unaligned source pointer */
  6244. +extern inline void _outsl(unsigned long port, void *src, unsigned long count)
  6245. +{
  6246. + unsigned long *p=(unsigned long*)src;
  6247. + while (count--)
  6248. + outl( *p++, port );
  6249. +}
  6250. +
  6251. +
  6252. +
  6253. +extern inline void mapioaddr(unsigned long physaddr, unsigned long virt_addr,
  6254. + int bus, int rdonly)
  6255. +{
  6256. + return;
  6257. +}
  6258. +
  6259. +//vic - copied from m68knommu
  6260. +
  6261. +/* Values for nocacheflag and cmode */
  6262. +#define IOMAP_FULL_CACHING 0
  6263. +#define IOMAP_NOCACHE_SER 1
  6264. +#define IOMAP_NOCACHE_NONSER 2
  6265. +#define IOMAP_WRITETHROUGH 3
  6266. +
  6267. +extern void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag);
  6268. +extern void __iounmap(void *addr, unsigned long size);
  6269. +
  6270. +extern inline void *ioremap(unsigned long physaddr, unsigned long size)
  6271. +{
  6272. + return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
  6273. +}
  6274. +extern inline void *ioremap_nocache(unsigned long physaddr, unsigned long size)
  6275. +{
  6276. + return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
  6277. +}
  6278. +extern inline void *ioremap_writethrough(unsigned long physaddr, unsigned long size)
  6279. +{
  6280. + return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
  6281. +}
  6282. +extern inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size)
  6283. +{
  6284. + return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
  6285. +}
  6286. +
  6287. +extern void iounmap(void *addr);
  6288. +
  6289. +
  6290. +#define IO_SPACE_LIMIT 0xffffffff
  6291. +
  6292. +#define dma_cache_inv(_start,_size) do { } while (0)
  6293. +#define dma_cache_wback(_start,_size) do { } while (0)
  6294. +#define dma_cache_wback_inv(_start,_size) do { } while (0)
  6295. +
  6296. +/* Pages to physical address... */
  6297. +#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
  6298. +#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT)
  6299. +
  6300. +#define mm_ptov(vaddr) ((void *) (vaddr))
  6301. +#define mm_vtop(vaddr) ((unsigned long) (vaddr))
  6302. +#define phys_to_virt(vaddr) ((void *) (vaddr))
  6303. +#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
  6304. +
  6305. +#define virt_to_bus virt_to_phys
  6306. +#define bus_to_virt phys_to_virt
  6307. +
  6308. +#endif /* __KERNEL__ */
  6309. +
  6310. +#endif /* !(__NIOS2_IO_H) */
  6311. +
  6312. --- linux/include/asm-nios2nommu/ioctl.h
  6313. +++ linux/include/asm-nios2nommu/ioctl.h
  6314. @@ -0,0 +1,100 @@
  6315. +/* $Id: ioctl.h,v 1.3 2004/02/12 23:06:40 ken-h Exp $
  6316. + *
  6317. + * linux/ioctl.h for Linux by H.H. Bergman.
  6318. + *
  6319. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6320. + *
  6321. + * All rights reserved.
  6322. + *
  6323. + * This program is free software; you can redistribute it and/or modify
  6324. + * it under the terms of the GNU General Public License as published by
  6325. + * the Free Software Foundation; either version 2 of the License, or
  6326. + * (at your option) any later version.
  6327. + *
  6328. + * This program is distributed in the hope that it will be useful, but
  6329. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6330. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6331. + * NON INFRINGEMENT. See the GNU General Public License for more
  6332. + * details.
  6333. + *
  6334. + * You should have received a copy of the GNU General Public License
  6335. + * along with this program; if not, write to the Free Software
  6336. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6337. + *
  6338. + */
  6339. +
  6340. +#ifndef _NIOS2_IOCTL_H
  6341. +#define _NIOS2_IOCTL_H
  6342. +
  6343. +/* ioctl command encoding: 32 bits total, command in lower 16 bits,
  6344. + * size of the parameter structure in the lower 14 bits of the
  6345. + * upper 16 bits.
  6346. + * Encoding the size of the parameter structure in the ioctl request
  6347. + * is useful for catching programs compiled with old versions
  6348. + * and to avoid overwriting user space outside the user buffer area.
  6349. + * The highest 2 bits are reserved for indicating the ``access mode''.
  6350. + * NOTE: This limits the max parameter size to 16kB -1 !
  6351. + */
  6352. +
  6353. +/*
  6354. + * I don't really have any idea about what this should look like, so
  6355. + * for the time being, this is heavily based on the PC definitions.
  6356. + */
  6357. +
  6358. +/*
  6359. + * The following is for compatibility across the various Linux
  6360. + * platforms. The i386 ioctl numbering scheme doesn't really enforce
  6361. + * a type field. De facto, however, the top 8 bits of the lower 16
  6362. + * bits are indeed used as a type field, so we might just as well make
  6363. + * this explicit here. Please be sure to use the decoding macros
  6364. + * below from now on.
  6365. + */
  6366. +#define _IOC_NRBITS 8
  6367. +#define _IOC_TYPEBITS 8
  6368. +#define _IOC_SIZEBITS 14
  6369. +#define _IOC_DIRBITS 2
  6370. +
  6371. +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
  6372. +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
  6373. +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
  6374. +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
  6375. +
  6376. +#define _IOC_NRSHIFT 0
  6377. +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
  6378. +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
  6379. +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
  6380. +
  6381. +/*
  6382. + * Direction bits.
  6383. + */
  6384. +#define _IOC_NONE 0U
  6385. +#define _IOC_WRITE 1U
  6386. +#define _IOC_READ 2U
  6387. +
  6388. +#define _IOC(dir,type,nr,size) \
  6389. + (((dir) << _IOC_DIRSHIFT) | \
  6390. + ((type) << _IOC_TYPESHIFT) | \
  6391. + ((nr) << _IOC_NRSHIFT) | \
  6392. + ((size) << _IOC_SIZESHIFT))
  6393. +
  6394. +/* used to create numbers */
  6395. +#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
  6396. +#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
  6397. +#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
  6398. +#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
  6399. +
  6400. +/* used to decode ioctl numbers.. */
  6401. +#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
  6402. +#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
  6403. +#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
  6404. +#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
  6405. +
  6406. +/* ...and for the drivers/sound files... */
  6407. +
  6408. +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
  6409. +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
  6410. +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
  6411. +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
  6412. +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
  6413. +
  6414. +#endif /* _NIOS2_IOCTL_H */
  6415. --- linux/include/asm-nios2nommu/ioctls.h
  6416. +++ linux/include/asm-nios2nommu/ioctls.h
  6417. @@ -0,0 +1,103 @@
  6418. +/*
  6419. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6420. + *
  6421. + * All rights reserved.
  6422. + *
  6423. + * This program is free software; you can redistribute it and/or modify
  6424. + * it under the terms of the GNU General Public License as published by
  6425. + * the Free Software Foundation; either version 2 of the License, or
  6426. + * (at your option) any later version.
  6427. + *
  6428. + * This program is distributed in the hope that it will be useful, but
  6429. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6430. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6431. + * NON INFRINGEMENT. See the GNU General Public License for more
  6432. + * details.
  6433. + *
  6434. + * You should have received a copy of the GNU General Public License
  6435. + * along with this program; if not, write to the Free Software
  6436. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6437. + *
  6438. + */
  6439. +
  6440. +#ifndef __ARCH_NIOS2_IOCTLS_H__
  6441. +#define __ARCH_NIOS2_IOCTLS_H__
  6442. +
  6443. +#include <asm/ioctl.h>
  6444. +
  6445. +/* 0x54 is just a magic number to make these relatively unique ('T') */
  6446. +
  6447. +#define TCGETS 0x5401
  6448. +#define TCSETS 0x5402
  6449. +#define TCSETSW 0x5403
  6450. +#define TCSETSF 0x5404
  6451. +#define TCGETA 0x5405
  6452. +#define TCSETA 0x5406
  6453. +#define TCSETAW 0x5407
  6454. +#define TCSETAF 0x5408
  6455. +#define TCSBRK 0x5409
  6456. +#define TCXONC 0x540A
  6457. +#define TCFLSH 0x540B
  6458. +#define TIOCEXCL 0x540C
  6459. +#define TIOCNXCL 0x540D
  6460. +#define TIOCSCTTY 0x540E
  6461. +#define TIOCGPGRP 0x540F
  6462. +#define TIOCSPGRP 0x5410
  6463. +#define TIOCOUTQ 0x5411
  6464. +#define TIOCSTI 0x5412
  6465. +#define TIOCGWINSZ 0x5413
  6466. +#define TIOCSWINSZ 0x5414
  6467. +#define TIOCMGET 0x5415
  6468. +#define TIOCMBIS 0x5416
  6469. +#define TIOCMBIC 0x5417
  6470. +#define TIOCMSET 0x5418
  6471. +#define TIOCGSOFTCAR 0x5419
  6472. +#define TIOCSSOFTCAR 0x541A
  6473. +#define FIONREAD 0x541B
  6474. +#define TIOCINQ FIONREAD
  6475. +#define TIOCLINUX 0x541C
  6476. +#define TIOCCONS 0x541D
  6477. +#define TIOCGSERIAL 0x541E
  6478. +#define TIOCSSERIAL 0x541F
  6479. +#define TIOCPKT 0x5420
  6480. +#define FIONBIO 0x5421
  6481. +#define TIOCNOTTY 0x5422
  6482. +#define TIOCSETD 0x5423
  6483. +#define TIOCGETD 0x5424
  6484. +#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
  6485. +#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
  6486. +#define TIOCSBRK 0x5427 /* BSD compatibility */
  6487. +#define TIOCCBRK 0x5428 /* BSD compatibility */
  6488. +#define TIOCGSID 0x5429 /* Return the session ID of FD */
  6489. +#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
  6490. +#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
  6491. +
  6492. +#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
  6493. +#define FIOCLEX 0x5451
  6494. +#define FIOASYNC 0x5452
  6495. +#define TIOCSERCONFIG 0x5453
  6496. +#define TIOCSERGWILD 0x5454
  6497. +#define TIOCSERSWILD 0x5455
  6498. +#define TIOCGLCKTRMIOS 0x5456
  6499. +#define TIOCSLCKTRMIOS 0x5457
  6500. +#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
  6501. +#define TIOCSERGETLSR 0x5459 /* Get line status register */
  6502. +#define TIOCSERGETMULTI 0x545A /* Get multiport config */
  6503. +#define TIOCSERSETMULTI 0x545B /* Set multiport config */
  6504. +
  6505. +#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
  6506. +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
  6507. +#define FIOQSIZE 0x545E
  6508. +
  6509. +/* Used for packet mode */
  6510. +#define TIOCPKT_DATA 0
  6511. +#define TIOCPKT_FLUSHREAD 1
  6512. +#define TIOCPKT_FLUSHWRITE 2
  6513. +#define TIOCPKT_STOP 4
  6514. +#define TIOCPKT_START 8
  6515. +#define TIOCPKT_NOSTOP 16
  6516. +#define TIOCPKT_DOSTOP 32
  6517. +
  6518. +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
  6519. +
  6520. +#endif /* __ARCH_NIOS2_IOCTLS_H__ */
  6521. --- linux/include/asm-nios2nommu/ipc.h
  6522. +++ linux/include/asm-nios2nommu/ipc.h
  6523. @@ -0,0 +1,51 @@
  6524. +#ifndef __NIOS2_IPC_H__
  6525. +#define __NIOS2_IPC_H__
  6526. +
  6527. +/* Copied from sparc version
  6528. + * These are used to wrap system calls on the Nios.
  6529. + *
  6530. + * See arch/niosnommu/kernel/sys_nios.c for ugly details..
  6531. + *
  6532. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6533. + *
  6534. + * All rights reserved.
  6535. + *
  6536. + * This program is free software; you can redistribute it and/or modify
  6537. + * it under the terms of the GNU General Public License as published by
  6538. + * the Free Software Foundation; either version 2 of the License, or
  6539. + * (at your option) any later version.
  6540. + *
  6541. + * This program is distributed in the hope that it will be useful, but
  6542. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6543. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6544. + * NON INFRINGEMENT. See the GNU General Public License for more
  6545. + * details.
  6546. + *
  6547. + * You should have received a copy of the GNU General Public License
  6548. + * along with this program; if not, write to the Free Software
  6549. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6550. + *
  6551. + */
  6552. +struct ipc_kludge {
  6553. + struct msgbuf *msgp;
  6554. + long msgtyp;
  6555. +};
  6556. +
  6557. +#define SEMOP 1
  6558. +#define SEMGET 2
  6559. +#define SEMCTL 3
  6560. +#define MSGSND 11
  6561. +#define MSGRCV 12
  6562. +#define MSGGET 13
  6563. +#define MSGCTL 14
  6564. +#define SHMAT 21
  6565. +#define SHMDT 22
  6566. +#define SHMGET 23
  6567. +#define SHMCTL 24
  6568. +
  6569. +/* Used by the DIPC package, try and avoid reusing it */
  6570. +#define DIPC 25
  6571. +
  6572. +#define IPCCALL(version,op) ((version)<<16 | (op))
  6573. +
  6574. +#endif
  6575. --- linux/include/asm-nios2nommu/ipcbuf.h
  6576. +++ linux/include/asm-nios2nommu/ipcbuf.h
  6577. @@ -0,0 +1,49 @@
  6578. +#ifndef __NIOS2_IPCBUF_H__
  6579. +#define __NIOS2_IPCBUF_H__
  6580. +
  6581. +/* Copied from asm-m68k/ipcbuf.h
  6582. + * The user_ipc_perm structure for Nios architecture.
  6583. + * Note extra padding because this structure is passed back and forth
  6584. + * between kernel and user space.
  6585. + *
  6586. + * Pad space is left for:
  6587. + * - 32-bit mode_t and seq
  6588. + * - 2 miscellaneous 32-bit values
  6589. + *
  6590. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6591. + *
  6592. + * All rights reserved.
  6593. + *
  6594. + * This program is free software; you can redistribute it and/or modify
  6595. + * it under the terms of the GNU General Public License as published by
  6596. + * the Free Software Foundation; either version 2 of the License, or
  6597. + * (at your option) any later version.
  6598. + *
  6599. + * This program is distributed in the hope that it will be useful, but
  6600. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6601. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6602. + * NON INFRINGEMENT. See the GNU General Public License for more
  6603. + * details.
  6604. + *
  6605. + * You should have received a copy of the GNU General Public License
  6606. + * along with this program; if not, write to the Free Software
  6607. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6608. + *
  6609. + */
  6610. +
  6611. +struct ipc64_perm
  6612. +{
  6613. + __kernel_key_t key;
  6614. + __kernel_uid32_t uid;
  6615. + __kernel_gid32_t gid;
  6616. + __kernel_uid32_t cuid;
  6617. + __kernel_gid32_t cgid;
  6618. + __kernel_mode_t mode;
  6619. + unsigned short __pad1;
  6620. + unsigned short seq;
  6621. + unsigned short __pad2;
  6622. + unsigned long __unused1;
  6623. + unsigned long __unused2;
  6624. +};
  6625. +
  6626. +#endif /* __NIOS2_IPCBUF_H__ */
  6627. --- linux/include/asm-nios2nommu/irq.h
  6628. +++ linux/include/asm-nios2nommu/irq.h
  6629. @@ -0,0 +1,182 @@
  6630. +/*
  6631. + * 21Mar2001 1.1 dgt/microtronix
  6632. + *
  6633. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6634. + *
  6635. + * All rights reserved.
  6636. + *
  6637. + * This program is free software; you can redistribute it and/or modify
  6638. + * it under the terms of the GNU General Public License as published by
  6639. + * the Free Software Foundation; either version 2 of the License, or
  6640. + * (at your option) any later version.
  6641. + *
  6642. + * This program is distributed in the hope that it will be useful, but
  6643. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6644. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6645. + * NON INFRINGEMENT. See the GNU General Public License for more
  6646. + * details.
  6647. + *
  6648. + * You should have received a copy of the GNU General Public License
  6649. + * along with this program; if not, write to the Free Software
  6650. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6651. + *
  6652. + */
  6653. +
  6654. +
  6655. +#ifndef _NIOS2NOMMU_IRQ_H_
  6656. +#define _NIOS2NOMMU_IRQ_H_
  6657. +
  6658. +extern void disable_irq(unsigned int);
  6659. +extern void enable_irq(unsigned int);
  6660. +
  6661. +// #include <linux/config.h>
  6662. +#include <linux/interrupt.h>
  6663. +
  6664. +#define SYS_IRQS 32
  6665. +#define NR_IRQS SYS_IRQS
  6666. +
  6667. +/*
  6668. + * Interrupt source definitions
  6669. + * General interrupt sources are the level 1-7.
  6670. + * Adding an interrupt service routine for one of these sources
  6671. + * results in the addition of that routine to a chain of routines.
  6672. + * Each one is called in succession. Each individual interrupt
  6673. + * service routine should determine if the device associated with
  6674. + * that routine requires service.
  6675. + */
  6676. +
  6677. +#define IRQ01 (1) /* level 1 interrupt */
  6678. +#define IRQ02 (2) /* level 2 interrupt */
  6679. +#define IRQ03 (3) /* level 3 interrupt */
  6680. +#define IRQ04 (4) /* level 4 interrupt */
  6681. +#define IRQ05 (5) /* level 5 interrupt */
  6682. +#define IRQ06 (6) /* level 6 interrupt */
  6683. +#define IRQ07 (7) /* level 7 interrupt */
  6684. +#define IRQ08 (8) /* level 8 interrupt */
  6685. +#define IRQ09 (9) /* level 9 interrupt */
  6686. +#define IRQ0A (10) /* level 10 interrupt */
  6687. +#define IRQ0B (11) /* level 11 interrupt */
  6688. +#define IRQ0C (12) /* level 12 interrupt */
  6689. +#define IRQ0D (13) /* level 13 interrupt */
  6690. +#define IRQ0E (14) /* level 14 interrupt */
  6691. +#define IRQ0F (15) /* level 15 interrupt */
  6692. +#define IRQ10 (16) /* level 16 interrupt */
  6693. +#define IRQ12 (17) /* level 17 interrupt */
  6694. +#define IRQ13 (18) /* level 18 interrupt */
  6695. +#define IRQ14 (19) /* level 19 interrupt */
  6696. +#define IRQ15 (20) /* level 20 interrupt */
  6697. +#define IRQ16 (21) /* level 21 interrupt */
  6698. +#define IRQ17 (22) /* level 22 interrupt */
  6699. +#define IRQ18 (23) /* level 23 interrupt */
  6700. +#define IRQ19 (24) /* level 24 interrupt */
  6701. +#define IRQ1A (25) /* level 25 interrupt */
  6702. +#define IRQ1B (26) /* level 26 interrupt */
  6703. +#define IRQ1C (27) /* level 27 interrupt */
  6704. +#define IRQ1D (28) /* level 28 interrupt */
  6705. +#define IRQ1E (29) /* level 29 interrupt */
  6706. +#define IRQ1F (30) /* level 30 interrupt */
  6707. +#define IRQ20 (31) /* level 31 interrupt */
  6708. +#define IRQ21 (32) /* level 32 interrupt */
  6709. +
  6710. +#define IRQMAX IRQ21
  6711. +
  6712. +/*
  6713. + * "Generic" interrupt sources
  6714. + */
  6715. +
  6716. +/*
  6717. + * Machine specific interrupt sources.
  6718. + *
  6719. + * Adding an interrupt service routine for a source with this bit
  6720. + * set indicates a special machine specific interrupt source.
  6721. + * The machine specific files define these sources.
  6722. + *
  6723. + * Removed, they are not used by any one.
  6724. + */
  6725. +
  6726. +/*
  6727. + * various flags for request_irq()
  6728. + */
  6729. +#define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */
  6730. +#define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */
  6731. +#define IRQ_FLG_FAST (0x0004)
  6732. +#define IRQ_FLG_SLOW (0x0008)
  6733. +#define IRQ_FLG_STD (0x8000) /* internally used */
  6734. +
  6735. +/*
  6736. + * Functions to set and clear the interrupt mask.
  6737. + */
  6738. +
  6739. +/*
  6740. + * Use a zero to clean the bit.
  6741. + */
  6742. +static inline void clrimr(int mask)
  6743. +{
  6744. + int flags;
  6745. +
  6746. + local_irq_save(flags);
  6747. + __asm__ __volatile__(
  6748. + "rdctl r8, ienable\n"
  6749. + "and r8,r8,%0\n"
  6750. + "wrctl ienable, r8\n"
  6751. + : /* No output */
  6752. + : "r" (mask)
  6753. + : "r8");
  6754. + local_irq_restore(flags);
  6755. +}
  6756. +
  6757. +/*
  6758. + * Use a one to set the bit.
  6759. + */
  6760. +static inline void setimr(int mask)
  6761. +{
  6762. + int flags;
  6763. +
  6764. + local_irq_save(flags);
  6765. + __asm__ __volatile__(
  6766. + "rdctl r8, ienable\n"
  6767. + "or r8,r8,%0\n"
  6768. + "wrctl ienable, r8\n"
  6769. + : /* No output */
  6770. + : "r" (mask)
  6771. + : "r8");
  6772. + local_irq_restore(flags);
  6773. +}
  6774. +
  6775. +/*
  6776. + * This structure is used to chain together the ISRs for a particular
  6777. + * interrupt source (if it supports chaining).
  6778. + */
  6779. +typedef struct irq_node {
  6780. + irqreturn_t (*handler)(int, void *, struct pt_regs *);
  6781. + unsigned long flags;
  6782. + void *dev_id;
  6783. + const char *devname;
  6784. + struct irq_node *next;
  6785. +} irq_node_t;
  6786. +
  6787. +/*
  6788. + * This function returns a new irq_node_t
  6789. + */
  6790. +extern irq_node_t *new_irq_node(void);
  6791. +
  6792. +/*
  6793. + * This structure has only 4 elements for speed reasons
  6794. + */
  6795. +typedef struct irq_handler {
  6796. + irqreturn_t (*handler)(int, void *, struct pt_regs *);
  6797. + unsigned long flags;
  6798. + void *dev_id;
  6799. + const char *devname;
  6800. +} irq_handler_t;
  6801. +
  6802. +/* count of spurious interrupts */
  6803. +extern volatile unsigned int num_spurious;
  6804. +
  6805. +#define disable_irq_nosync(i) disable_irq(i)
  6806. +
  6807. +#ifndef irq_canonicalize
  6808. +#define irq_canonicalize(i) (i)
  6809. +#endif
  6810. +
  6811. +#endif /* _NIOS2NOMMU_IRQ_H_ */
  6812. --- linux/include/asm-nios2nommu/kmap_types.h
  6813. +++ linux/include/asm-nios2nommu/kmap_types.h
  6814. @@ -0,0 +1,43 @@
  6815. +/*
  6816. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6817. + *
  6818. + * All rights reserved.
  6819. + *
  6820. + * This program is free software; you can redistribute it and/or modify
  6821. + * it under the terms of the GNU General Public License as published by
  6822. + * the Free Software Foundation; either version 2 of the License, or
  6823. + * (at your option) any later version.
  6824. + *
  6825. + * This program is distributed in the hope that it will be useful, but
  6826. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6827. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6828. + * NON INFRINGEMENT. See the GNU General Public License for more
  6829. + * details.
  6830. + *
  6831. + * You should have received a copy of the GNU General Public License
  6832. + * along with this program; if not, write to the Free Software
  6833. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6834. + *
  6835. + */
  6836. +
  6837. +#ifndef _ASM_KMAP_TYPES_H
  6838. +#define _ASM_KMAP_TYPES_H
  6839. +
  6840. +enum km_type {
  6841. + KM_BOUNCE_READ,
  6842. + KM_SKB_SUNRPC_DATA,
  6843. + KM_SKB_DATA_SOFTIRQ,
  6844. + KM_USER0,
  6845. + KM_USER1,
  6846. + KM_BIO_SRC_IRQ,
  6847. + KM_BIO_DST_IRQ,
  6848. + KM_PTE0,
  6849. + KM_PTE1,
  6850. + KM_IRQ0,
  6851. + KM_IRQ1,
  6852. + KM_SOFTIRQ0,
  6853. + KM_SOFTIRQ1,
  6854. + KM_TYPE_NR
  6855. +};
  6856. +
  6857. +#endif
  6858. --- linux/include/asm-nios2nommu/linkage.h
  6859. +++ linux/include/asm-nios2nommu/linkage.h
  6860. @@ -0,0 +1,29 @@
  6861. +/*
  6862. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  6863. + *
  6864. + * All rights reserved.
  6865. + *
  6866. + * This program is free software; you can redistribute it and/or modify
  6867. + * it under the terms of the GNU General Public License as published by
  6868. + * the Free Software Foundation; either version 2 of the License, or
  6869. + * (at your option) any later version.
  6870. + *
  6871. + * This program is distributed in the hope that it will be useful, but
  6872. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6873. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6874. + * NON INFRINGEMENT. See the GNU General Public License for more
  6875. + * details.
  6876. + *
  6877. + * You should have received a copy of the GNU General Public License
  6878. + * along with this program; if not, write to the Free Software
  6879. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6880. + *
  6881. + */
  6882. +
  6883. +#ifndef __ASM_LINKAGE_H
  6884. +#define __ASM_LINKAGE_H
  6885. +
  6886. +#define __ALIGN .align 3
  6887. +#define __ALIGN_STR ".align 3"
  6888. +
  6889. +#endif
  6890. --- linux/include/asm-nios2nommu/linux_logo.h
  6891. +++ linux/include/asm-nios2nommu/linux_logo.h
  6892. @@ -0,0 +1,953 @@
  6893. +/* $Id: linux_logo.h,v 1.3 2004/02/12 23:06:40 ken-h Exp $
  6894. + * include/asm-nios/linux_logo.h: This is a linux logo
  6895. + * to be displayed on boot.
  6896. + *
  6897. + * Copyright (C) 1996 Larry Ewing (lewing@isc.tamu.edu)
  6898. + * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  6899. + * Copyright (C) 2004 Micrtronix Datacom Ltd.
  6900. + *
  6901. + * You can put anything here, but:
  6902. + * LINUX_LOGO_COLORS has to be less than 224
  6903. + * image size has to be 80x80
  6904. + * values have to start from 0x20
  6905. + * (i.e. RGB(linux_logo_red[0],
  6906. + * linux_logo_green[0],
  6907. + * linux_logo_blue[0]) is color 0x20)
  6908. + * BW image has to be 80x80 as well, with MS bit
  6909. + * on the left
  6910. + * Serial_console ascii image can be any size,
  6911. + * but should contain %s to display the version
  6912. + *
  6913. + * All rights reserved.
  6914. + *
  6915. + * This program is free software; you can redistribute it and/or modify
  6916. + * it under the terms of the GNU General Public License as published by
  6917. + * the Free Software Foundation; either version 2 of the License, or
  6918. + * (at your option) any later version.
  6919. + *
  6920. + * This program is distributed in the hope that it will be useful, but
  6921. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  6922. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  6923. + * NON INFRINGEMENT. See the GNU General Public License for more
  6924. + * details.
  6925. + *
  6926. + * You should have received a copy of the GNU General Public License
  6927. + * along with this program; if not, write to the Free Software
  6928. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  6929. + *
  6930. + */
  6931. +
  6932. +#include <linux/init.h>
  6933. +#include <linux/version.h>
  6934. +
  6935. +#define linux_logo_banner "Linux/NIOS2 version " UTS_RELEASE
  6936. +
  6937. +#define __HAVE_ARCH_LINUX_LOGO
  6938. +#define __HAVE_ARCH_LINUX_LOGO16
  6939. +
  6940. +#define LINUX_LOGO_COLORS 221
  6941. +
  6942. +#ifdef INCLUDE_LINUX_LOGO_DATA
  6943. +
  6944. +unsigned char linux_logo_red[] __initdata = {
  6945. + 0x00, 0x06, 0x0a, 0x0e, 0x16, 0x1a, 0x1e, 0x22,
  6946. + 0x12, 0x00, 0x2a, 0x36, 0x42, 0x4e, 0x4a, 0x56,
  6947. + 0x26, 0x46, 0x2e, 0x32, 0x52, 0x3a, 0x02, 0x65,
  6948. + 0x5e, 0x3e, 0x74, 0x8a, 0xa2, 0x9a, 0x86, 0xc6,
  6949. + 0xc3, 0x65, 0xbb, 0xd2, 0xda, 0xd6, 0xe2, 0xf6,
  6950. + 0xfd, 0xae, 0x7b, 0xdd, 0xea, 0x6a, 0xaa, 0xe7,
  6951. + 0xbe, 0x5a, 0xee, 0x9e, 0x95, 0x80, 0x76, 0x79,
  6952. + 0x62, 0x36, 0x9a, 0xe2, 0xec, 0xe1, 0xb8, 0xd7,
  6953. + 0xaf, 0x25, 0xbc, 0xc0, 0xef, 0xea, 0xe8, 0xe8,
  6954. + 0xf5, 0xf1, 0xda, 0xd3, 0x79, 0xdb, 0xf4, 0xf6,
  6955. + 0xf6, 0xf6, 0xe2, 0x3d, 0xb4, 0xce, 0xe6, 0xee,
  6956. + 0xf6, 0x68, 0xd8, 0xec, 0xf5, 0xc6, 0xc8, 0x9c,
  6957. + 0x89, 0xd2, 0xee, 0xcb, 0xb9, 0xd2, 0x66, 0x5e,
  6958. + 0x8b, 0xbe, 0xa8, 0xd5, 0xca, 0xb6, 0xae, 0x9c,
  6959. + 0xc5, 0xbe, 0xbe, 0xca, 0x90, 0xb2, 0x9a, 0xa8,
  6960. + 0xb6, 0xf2, 0xce, 0xfa, 0xb2, 0x6e, 0xa6, 0xfe,
  6961. + 0xf6, 0xec, 0xfe, 0xd2, 0xea, 0xf5, 0xf2, 0xf2,
  6962. + 0xe9, 0xee, 0xf6, 0xf2, 0xee, 0xf6, 0xda, 0xd4,
  6963. + 0xfa, 0xca, 0xf2, 0xf6, 0xfe, 0xf2, 0xda, 0xe4,
  6964. + 0xf6, 0xdd, 0xf2, 0xee, 0xfa, 0xf0, 0x12, 0x4a,
  6965. + 0xd6, 0xf2, 0x8e, 0xf2, 0xf6, 0xf6, 0xb5, 0xf1,
  6966. + 0x26, 0x9a, 0xea, 0xf6, 0xe0, 0xd2, 0x16, 0x9a,
  6967. + 0x2e, 0xd2, 0x70, 0xd6, 0x46, 0x7c, 0xb4, 0x62,
  6968. + 0xda, 0xee, 0xd6, 0xa3, 0x74, 0xa7, 0xa2, 0xe0,
  6969. + 0xae, 0xbe, 0xce, 0xe2, 0xa3, 0x8e, 0x6d, 0x8e,
  6970. + 0x32, 0xaf, 0x50, 0x9e, 0x5b, 0x8a, 0x98, 0x82,
  6971. + 0x7a, 0x82, 0x56, 0x7c, 0x8a, 0x56, 0x5e, 0x86,
  6972. + 0x6a, 0x52, 0x59, 0x64, 0x5e,
  6973. +};
  6974. +
  6975. +unsigned char linux_logo_green[] __initdata = {
  6976. + 0x00, 0x06, 0x0a, 0x0e, 0x16, 0x1a, 0x1e, 0x22,
  6977. + 0x12, 0x00, 0x2a, 0x36, 0x42, 0x4e, 0x4a, 0x56,
  6978. + 0x26, 0x46, 0x2e, 0x32, 0x52, 0x3a, 0x02, 0x65,
  6979. + 0x5e, 0x3e, 0x74, 0x8a, 0xa2, 0x9a, 0x86, 0xc6,
  6980. + 0xc3, 0x62, 0xbb, 0xd2, 0xda, 0xd6, 0xe2, 0xf6,
  6981. + 0xfd, 0xae, 0x7b, 0xdd, 0xea, 0x6a, 0xaa, 0xe7,
  6982. + 0xbe, 0x5a, 0xee, 0x9e, 0x95, 0x80, 0x62, 0x5c,
  6983. + 0x4e, 0x26, 0x72, 0xaa, 0xba, 0xaf, 0x90, 0xae,
  6984. + 0x92, 0x1a, 0xa4, 0x85, 0xb6, 0xbe, 0xc3, 0xc8,
  6985. + 0xcf, 0xd0, 0xc2, 0xce, 0x57, 0xa2, 0xd6, 0xda,
  6986. + 0xda, 0xd7, 0xb8, 0x2a, 0x7b, 0x91, 0xae, 0xca,
  6987. + 0xda, 0x45, 0x9e, 0xb2, 0xd7, 0x9b, 0x90, 0x76,
  6988. + 0x5c, 0xa2, 0xbe, 0xa6, 0x85, 0x96, 0x4e, 0x46,
  6989. + 0x66, 0x92, 0x7a, 0x9a, 0x96, 0x9d, 0x9a, 0x6b,
  6990. + 0x8a, 0x8e, 0xb2, 0xca, 0x90, 0xa6, 0x79, 0x7c,
  6991. + 0xb6, 0xf2, 0xce, 0xfa, 0xb2, 0x6e, 0xa6, 0xfa,
  6992. + 0xea, 0xd7, 0xf6, 0xbc, 0xda, 0xde, 0xda, 0xe6,
  6993. + 0xca, 0xd8, 0xea, 0xe0, 0xcc, 0xf2, 0xce, 0xb2,
  6994. + 0xee, 0xa2, 0xd6, 0xe6, 0xf6, 0xd7, 0xc5, 0xb8,
  6995. + 0xc6, 0xb9, 0xce, 0xde, 0xce, 0xc6, 0x0e, 0x36,
  6996. + 0xae, 0xbe, 0x86, 0xba, 0xbe, 0xe6, 0x8e, 0xc4,
  6997. + 0x1e, 0x8e, 0xae, 0xba, 0xb2, 0xa6, 0x12, 0x7a,
  6998. + 0x20, 0xc6, 0x64, 0xaa, 0x2f, 0x70, 0x85, 0x46,
  6999. + 0xce, 0xd6, 0xa6, 0x6e, 0x51, 0x72, 0x92, 0xa6,
  7000. + 0x87, 0x96, 0xa2, 0xd6, 0x85, 0x7a, 0x6a, 0x6e,
  7001. + 0x22, 0x76, 0x36, 0x76, 0x3c, 0x6e, 0x63, 0x53,
  7002. + 0x66, 0x62, 0x42, 0x50, 0x56, 0x42, 0x56, 0x56,
  7003. + 0x56, 0x3e, 0x51, 0x52, 0x56,
  7004. +};
  7005. +
  7006. +unsigned char linux_logo_blue[] __initdata = {
  7007. + 0x00, 0x06, 0x0a, 0x0e, 0x16, 0x1a, 0x1e, 0x22,
  7008. + 0x12, 0x01, 0x2a, 0x36, 0x42, 0x4e, 0x4a, 0x56,
  7009. + 0x26, 0x46, 0x2e, 0x32, 0x52, 0x3a, 0x06, 0x65,
  7010. + 0x5e, 0x3e, 0x74, 0x8a, 0xa2, 0x9a, 0x86, 0xc6,
  7011. + 0xc3, 0x59, 0xbb, 0xd2, 0xda, 0xd6, 0xe2, 0xf6,
  7012. + 0xfd, 0xae, 0x7b, 0xdd, 0xea, 0x6a, 0xaa, 0xe7,
  7013. + 0xbe, 0x5a, 0xee, 0x9e, 0x95, 0x80, 0x2e, 0x08,
  7014. + 0x0a, 0x06, 0x0a, 0x0b, 0x0b, 0x0f, 0x0c, 0x0f,
  7015. + 0x3d, 0x09, 0x73, 0x09, 0x0d, 0x0a, 0x10, 0x1e,
  7016. + 0x2d, 0x13, 0x86, 0xba, 0x19, 0x0a, 0x36, 0x3c,
  7017. + 0x26, 0x14, 0x0d, 0x06, 0x07, 0x0a, 0x0b, 0x0f,
  7018. + 0x4a, 0x06, 0x0a, 0x0c, 0x2b, 0x0a, 0x0b, 0x0a,
  7019. + 0x06, 0x0a, 0x0a, 0x11, 0x0b, 0x0a, 0x0a, 0x1e,
  7020. + 0x0f, 0x0d, 0x0a, 0x0b, 0x22, 0x6a, 0x72, 0x0b,
  7021. + 0x0b, 0x22, 0x90, 0xca, 0x90, 0x92, 0x3c, 0x2c,
  7022. + 0xb6, 0xf2, 0xce, 0xfa, 0xb2, 0x6e, 0xa6, 0xea,
  7023. + 0xb6, 0x7c, 0xda, 0x8e, 0xa6, 0x87, 0x66, 0xb6,
  7024. + 0x81, 0x6a, 0xc6, 0x9a, 0x5b, 0xd2, 0xb6, 0x6a,
  7025. + 0xca, 0x45, 0x92, 0xb2, 0xca, 0x52, 0x8a, 0x3e,
  7026. + 0x2e, 0x66, 0x66, 0xae, 0x3e, 0x47, 0x06, 0x0e,
  7027. + 0x52, 0x36, 0x6a, 0x0e, 0x0e, 0xbe, 0x2c, 0x0e,
  7028. + 0x0a, 0x5a, 0x0d, 0x0e, 0x3e, 0x0a, 0x06, 0x2e,
  7029. + 0x06, 0x9e, 0x4e, 0x36, 0x06, 0x58, 0x24, 0x06,
  7030. + 0x9e, 0xae, 0x3a, 0x08, 0x08, 0x07, 0x5e, 0x0a,
  7031. + 0x32, 0x2e, 0x2a, 0xb2, 0x43, 0x48, 0x5f, 0x2e,
  7032. + 0x06, 0x06, 0x07, 0x24, 0x06, 0x32, 0x06, 0x06,
  7033. + 0x46, 0x2e, 0x22, 0x06, 0x06, 0x1e, 0x4c, 0x06,
  7034. + 0x3a, 0x22, 0x42, 0x34, 0x42,
  7035. +};
  7036. +
  7037. +unsigned char linux_logo[] __initdata = {
  7038. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7039. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7040. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7041. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7042. + 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x22, 0x22,
  7043. + 0x22, 0x21, 0x21, 0x21, 0x20, 0x20, 0x20, 0x20,
  7044. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7045. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7046. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7047. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7048. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7049. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7050. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7051. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7052. + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
  7053. + 0x26, 0x26, 0x25, 0x28, 0x23, 0x22, 0x21, 0x20,
  7054. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7055. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7056. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7057. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7058. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x20,
  7059. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7060. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7061. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7062. + 0x21, 0x23, 0x25, 0x2a, 0x2b, 0x2c, 0x2d, 0x2d,
  7063. + 0x2d, 0x2e, 0x2c, 0x2b, 0x2a, 0x25, 0x28, 0x22,
  7064. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7065. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7066. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7067. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7068. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x20, 0x20,
  7069. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7070. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7071. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  7072. + 0x24, 0x2a, 0x2c, 0x2f, 0x2c, 0x30, 0x30, 0x24,
  7073. + 0x25, 0x27, 0x2b, 0x2c, 0x2f, 0x31, 0x32, 0x25,
  7074. + 0x23, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7075. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7076. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7077. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7078. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x29, 0x20,
  7079. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7080. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7081. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x25,
  7082. + 0x33, 0x34, 0x35, 0x21, 0x36, 0x36, 0x36, 0x36,
  7083. + 0x36, 0x36, 0x36, 0x36, 0x21, 0x2b, 0x2f, 0x2c,
  7084. + 0x30, 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  7085. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7086. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7087. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7088. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7089. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7090. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7091. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x24, 0x33,
  7092. + 0x2d, 0x27, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7093. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x21, 0x31,
  7094. + 0x2d, 0x32, 0x24, 0x21, 0x20, 0x20, 0x20, 0x20,
  7095. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7096. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7097. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7098. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x29, 0x20,
  7099. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7100. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7101. + 0x20, 0x20, 0x20, 0x20, 0x21, 0x28, 0x2a, 0x34,
  7102. + 0x25, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7103. + 0x36, 0x36, 0x36, 0x23, 0x32, 0x27, 0x21, 0x36,
  7104. + 0x2a, 0x2d, 0x2a, 0x28, 0x21, 0x20, 0x20, 0x20,
  7105. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7106. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7107. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7108. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x29, 0x20,
  7109. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7110. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7111. + 0x20, 0x20, 0x20, 0x20, 0x22, 0x26, 0x2c, 0x35,
  7112. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7113. + 0x36, 0x36, 0x36, 0x25, 0x2f, 0x37, 0x32, 0x22,
  7114. + 0x36, 0x35, 0x31, 0x27, 0x22, 0x20, 0x20, 0x20,
  7115. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7116. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7117. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7118. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x29, 0x20,
  7119. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7120. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7121. + 0x20, 0x20, 0x20, 0x20, 0x23, 0x2a, 0x2f, 0x22,
  7122. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7123. + 0x36, 0x36, 0x36, 0x26, 0x38, 0x38, 0x35, 0x25,
  7124. + 0x36, 0x21, 0x2d, 0x2b, 0x24, 0x21, 0x20, 0x20,
  7125. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7126. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7127. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7128. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7129. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7130. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7131. + 0x20, 0x20, 0x20, 0x21, 0x24, 0x39, 0x39, 0x36,
  7132. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7133. + 0x36, 0x36, 0x36, 0x25, 0x2b, 0x30, 0x28, 0x22,
  7134. + 0x36, 0x36, 0x27, 0x34, 0x30, 0x23, 0x20, 0x20,
  7135. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7136. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7137. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7138. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x20,
  7139. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7140. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7141. + 0x20, 0x20, 0x20, 0x21, 0x26, 0x2d, 0x26, 0x36,
  7142. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7143. + 0x36, 0x36, 0x36, 0x22, 0x22, 0x36, 0x36, 0x36,
  7144. + 0x36, 0x36, 0x36, 0x2d, 0x33, 0x28, 0x21, 0x20,
  7145. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7146. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7147. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7148. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x20, 0x20,
  7149. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7150. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7151. + 0x20, 0x20, 0x20, 0x22, 0x30, 0x2f, 0x23, 0x36,
  7152. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7153. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7154. + 0x36, 0x36, 0x36, 0x2b, 0x2c, 0x25, 0x21, 0x20,
  7155. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7156. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7157. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7158. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x20,
  7159. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7160. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7161. + 0x20, 0x20, 0x20, 0x23, 0x2a, 0x34, 0x36, 0x36,
  7162. + 0x36, 0x21, 0x22, 0x36, 0x36, 0x36, 0x36, 0x36,
  7163. + 0x36, 0x36, 0x36, 0x21, 0x23, 0x22, 0x36, 0x36,
  7164. + 0x36, 0x36, 0x36, 0x28, 0x34, 0x27, 0x22, 0x20,
  7165. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7166. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7167. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7168. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x20, 0x20,
  7169. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7170. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7171. + 0x20, 0x20, 0x20, 0x23, 0x32, 0x2f, 0x36, 0x36,
  7172. + 0x21, 0x21, 0x24, 0x27, 0x21, 0x36, 0x36, 0x36,
  7173. + 0x36, 0x36, 0x28, 0x27, 0x22, 0x33, 0x24, 0x36,
  7174. + 0x36, 0x36, 0x36, 0x22, 0x2f, 0x2a, 0x23, 0x20,
  7175. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7176. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7177. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7178. + 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x29, 0x20,
  7179. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7180. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7181. + 0x20, 0x20, 0x20, 0x23, 0x32, 0x2f, 0x36, 0x36,
  7182. + 0x30, 0x3a, 0x38, 0x24, 0x24, 0x36, 0x36, 0x36,
  7183. + 0x23, 0x2f, 0x3b, 0x3c, 0x3d, 0x30, 0x25, 0x21,
  7184. + 0x36, 0x36, 0x36, 0x36, 0x2f, 0x32, 0x23, 0x20,
  7185. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7186. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7187. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7188. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7189. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7190. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7191. + 0x20, 0x20, 0x20, 0x23, 0x32, 0x2f, 0x36, 0x23,
  7192. + 0x3e, 0x3f, 0x40, 0x3a, 0x22, 0x36, 0x36, 0x21,
  7193. + 0x41, 0x42, 0x43, 0x44, 0x45, 0x3e, 0x23, 0x21,
  7194. + 0x36, 0x36, 0x36, 0x36, 0x2f, 0x33, 0x28, 0x21,
  7195. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7196. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7197. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7198. + 0x20, 0x20, 0x29, 0x20, 0x29, 0x29, 0x29, 0x20,
  7199. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7200. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7201. + 0x20, 0x20, 0x20, 0x23, 0x32, 0x2f, 0x36, 0x2b,
  7202. + 0x44, 0x40, 0x46, 0x47, 0x35, 0x36, 0x36, 0x26,
  7203. + 0x43, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x2e, 0x36,
  7204. + 0x36, 0x36, 0x36, 0x36, 0x31, 0x35, 0x24, 0x21,
  7205. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7206. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7207. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7208. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7209. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7210. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7211. + 0x20, 0x20, 0x20, 0x23, 0x32, 0x34, 0x36, 0x4d,
  7212. + 0x4e, 0x25, 0x2f, 0x46, 0x4a, 0x22, 0x23, 0x32,
  7213. + 0x4f, 0x50, 0x21, 0x31, 0x51, 0x52, 0x53, 0x36,
  7214. + 0x36, 0x36, 0x36, 0x36, 0x31, 0x35, 0x24, 0x21,
  7215. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7216. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7217. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7218. + 0x20, 0x20, 0x29, 0x20, 0x29, 0x29, 0x29, 0x20,
  7219. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7220. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7221. + 0x20, 0x20, 0x20, 0x23, 0x2a, 0x2f, 0x21, 0x3a,
  7222. + 0x4d, 0x21, 0x31, 0x54, 0x55, 0x28, 0x30, 0x2b,
  7223. + 0x4b, 0x4d, 0x36, 0x23, 0x32, 0x50, 0x3f, 0x36,
  7224. + 0x36, 0x36, 0x36, 0x36, 0x2e, 0x39, 0x24, 0x21,
  7225. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7226. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7227. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7228. + 0x20, 0x20, 0x29, 0x20, 0x29, 0x20, 0x29, 0x20,
  7229. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7230. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7231. + 0x20, 0x20, 0x20, 0x23, 0x2a, 0x38, 0x23, 0x37,
  7232. + 0x55, 0x36, 0x28, 0x3a, 0x56, 0x57, 0x57, 0x58,
  7233. + 0x3c, 0x4d, 0x36, 0x36, 0x36, 0x40, 0x40, 0x21,
  7234. + 0x36, 0x36, 0x36, 0x36, 0x2e, 0x39, 0x24, 0x21,
  7235. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7236. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7237. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7238. + 0x20, 0x20, 0x29, 0x29, 0x29, 0x20, 0x29, 0x20,
  7239. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7240. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7241. + 0x20, 0x20, 0x20, 0x22, 0x30, 0x51, 0x23, 0x35,
  7242. + 0x43, 0x25, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e,
  7243. + 0x5f, 0x60, 0x61, 0x36, 0x31, 0x47, 0x3b, 0x36,
  7244. + 0x36, 0x36, 0x36, 0x36, 0x31, 0x2c, 0x25, 0x21,
  7245. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7246. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7247. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7248. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7249. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7250. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7251. + 0x20, 0x20, 0x20, 0x22, 0x30, 0x2f, 0x23, 0x22,
  7252. + 0x40, 0x62, 0x63, 0x5d, 0x64, 0x65, 0x66, 0x67,
  7253. + 0x68, 0x69, 0x66, 0x5e, 0x6a, 0x6b, 0x2a, 0x36,
  7254. + 0x36, 0x36, 0x36, 0x36, 0x33, 0x2e, 0x26, 0x21,
  7255. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7256. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7257. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7258. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7259. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7260. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7261. + 0x20, 0x20, 0x20, 0x22, 0x27, 0x2f, 0x23, 0x36,
  7262. + 0x6c, 0x63, 0x6d, 0x64, 0x5c, 0x66, 0x69, 0x6e,
  7263. + 0x6f, 0x70, 0x71, 0x69, 0x69, 0x72, 0x6c, 0x36,
  7264. + 0x36, 0x36, 0x36, 0x36, 0x33, 0x34, 0x27, 0x22,
  7265. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7266. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7267. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7268. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7269. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7270. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7271. + 0x20, 0x20, 0x20, 0x22, 0x27, 0x34, 0x26, 0x73,
  7272. + 0x74, 0x75, 0x76, 0x64, 0x65, 0x77, 0x69, 0x78,
  7273. + 0x70, 0x71, 0x71, 0x71, 0x72, 0x5f, 0x5e, 0x21,
  7274. + 0x36, 0x36, 0x36, 0x36, 0x25, 0x38, 0x2a, 0x23,
  7275. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7276. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7277. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7278. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7279. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7280. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7281. + 0x20, 0x20, 0x20, 0x22, 0x26, 0x2d, 0x33, 0x79,
  7282. + 0x63, 0x7a, 0x7b, 0x5c, 0x66, 0x69, 0x6e, 0x7c,
  7283. + 0x71, 0x71, 0x69, 0x7d, 0x7e, 0x7a, 0x7f, 0x36,
  7284. + 0x36, 0x36, 0x36, 0x36, 0x21, 0x51, 0x2b, 0x28,
  7285. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7286. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7287. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7288. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7289. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7290. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7291. + 0x20, 0x20, 0x20, 0x22, 0x26, 0x2d, 0x32, 0x24,
  7292. + 0x80, 0x81, 0x64, 0x82, 0x77, 0x69, 0x71, 0x71,
  7293. + 0x69, 0x83, 0x84, 0x85, 0x7a, 0x85, 0x86, 0x36,
  7294. + 0x21, 0x2b, 0x23, 0x36, 0x36, 0x39, 0x2e, 0x26,
  7295. + 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7296. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7297. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7298. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7299. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7300. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7301. + 0x20, 0x20, 0x20, 0x22, 0x27, 0x2d, 0x33, 0x21,
  7302. + 0x87, 0x88, 0x89, 0x72, 0x67, 0x66, 0x5f, 0x89,
  7303. + 0x8a, 0x63, 0x85, 0x8b, 0x8c, 0x8d, 0x41, 0x36,
  7304. + 0x36, 0x2d, 0x3a, 0x35, 0x36, 0x24, 0x51, 0x32,
  7305. + 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7306. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7307. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7308. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7309. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7310. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7311. + 0x20, 0x20, 0x20, 0x22, 0x30, 0x2f, 0x33, 0x21,
  7312. + 0x55, 0x8e, 0x8f, 0x8a, 0x7d, 0x5e, 0x90, 0x7e,
  7313. + 0x75, 0x75, 0x90, 0x62, 0x40, 0x3f, 0x49, 0x23,
  7314. + 0x36, 0x24, 0x3a, 0x3a, 0x24, 0x36, 0x2e, 0x31,
  7315. + 0x26, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7316. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7317. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7318. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7319. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7320. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7321. + 0x20, 0x20, 0x21, 0x28, 0x33, 0x37, 0x25, 0x22,
  7322. + 0x3b, 0x50, 0x8e, 0x8f, 0x90, 0x7e, 0x90, 0x63,
  7323. + 0x74, 0x91, 0x92, 0x42, 0x93, 0x4b, 0x45, 0x2c,
  7324. + 0x36, 0x36, 0x33, 0x39, 0x21, 0x36, 0x22, 0x51,
  7325. + 0x33, 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  7326. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7327. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7328. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7329. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7330. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7331. + 0x20, 0x20, 0x22, 0x27, 0x2e, 0x2e, 0x36, 0x21,
  7332. + 0x94, 0x3f, 0x50, 0x95, 0x96, 0x8f, 0x8f, 0x97,
  7333. + 0x8e, 0x42, 0x50, 0x43, 0x47, 0x48, 0x48, 0x98,
  7334. + 0x21, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x39,
  7335. + 0x2e, 0x27, 0x23, 0x20, 0x20, 0x20, 0x20, 0x20,
  7336. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7337. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7338. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7339. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7340. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7341. + 0x20, 0x22, 0x24, 0x2b, 0x38, 0x28, 0x36, 0x32,
  7342. + 0x4c, 0x4b, 0x50, 0x50, 0x50, 0x42, 0x42, 0x50,
  7343. + 0x50, 0x40, 0x45, 0x99, 0x48, 0x48, 0x48, 0x48,
  7344. + 0x34, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x23,
  7345. + 0x2f, 0x2b, 0x24, 0x21, 0x20, 0x20, 0x20, 0x20,
  7346. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7347. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7348. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7349. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7350. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7351. + 0x21, 0x28, 0x32, 0x51, 0x32, 0x28, 0x21, 0x98,
  7352. + 0x48, 0x47, 0x9a, 0x50, 0x50, 0x50, 0x50, 0x50,
  7353. + 0x9a, 0x4f, 0x9b, 0x48, 0x48, 0x48, 0x48, 0x48,
  7354. + 0x93, 0x23, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7355. + 0x2a, 0x2f, 0x2a, 0x28, 0x21, 0x20, 0x20, 0x20,
  7356. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7357. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7358. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7359. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7360. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  7361. + 0x23, 0x30, 0x2e, 0x2c, 0x36, 0x21, 0x51, 0x9b,
  7362. + 0x48, 0x48, 0x52, 0x3f, 0x50, 0x50, 0x40, 0x4b,
  7363. + 0x47, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7364. + 0x48, 0x34, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7365. + 0x36, 0x2d, 0x31, 0x27, 0x23, 0x21, 0x20, 0x20,
  7366. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7367. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7368. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7369. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7370. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x23,
  7371. + 0x27, 0x2c, 0x2d, 0x21, 0x36, 0x28, 0x44, 0x48,
  7372. + 0x48, 0x48, 0x48, 0x47, 0x46, 0x4f, 0x47, 0x48,
  7373. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7374. + 0x48, 0x9c, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7375. + 0x36, 0x28, 0x51, 0x39, 0x26, 0x22, 0x20, 0x20,
  7376. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7377. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7378. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7379. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7380. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x25,
  7381. + 0x35, 0x51, 0x28, 0x36, 0x36, 0x9d, 0x48, 0x48,
  7382. + 0x48, 0x48, 0x48, 0x48, 0x9b, 0x48, 0x48, 0x48,
  7383. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7384. + 0x48, 0x4f, 0x28, 0x36, 0x36, 0x36, 0x36, 0x36,
  7385. + 0x36, 0x36, 0x28, 0x38, 0x2b, 0x25, 0x22, 0x20,
  7386. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7387. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7388. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7389. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7390. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x24, 0x33,
  7391. + 0x51, 0x25, 0x36, 0x36, 0x23, 0x40, 0x9b, 0x48,
  7392. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7393. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7394. + 0x9b, 0x99, 0x2b, 0x36, 0x36, 0x36, 0x36, 0x36,
  7395. + 0x36, 0x36, 0x36, 0x30, 0x2f, 0x33, 0x24, 0x21,
  7396. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7397. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7398. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7399. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7400. + 0x20, 0x20, 0x20, 0x20, 0x21, 0x23, 0x30, 0x34,
  7401. + 0x27, 0x36, 0x36, 0x36, 0x2a, 0x40, 0x47, 0x48,
  7402. + 0x48, 0x48, 0x48, 0x9b, 0x99, 0x99, 0x9b, 0x48,
  7403. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x9b, 0x47, 0x52,
  7404. + 0x46, 0x4f, 0x37, 0x21, 0x36, 0x36, 0x36, 0x36,
  7405. + 0x36, 0x36, 0x36, 0x36, 0x30, 0x34, 0x2a, 0x23,
  7406. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7407. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7408. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7409. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7410. + 0x20, 0x20, 0x20, 0x20, 0x22, 0x25, 0x39, 0x2c,
  7411. + 0x36, 0x36, 0x36, 0x21, 0x31, 0x4e, 0x9a, 0x4c,
  7412. + 0x47, 0x9b, 0x9b, 0x52, 0x46, 0x4f, 0x52, 0x9b,
  7413. + 0x9b, 0x9b, 0x47, 0x4f, 0x45, 0x9a, 0x93, 0x93,
  7414. + 0x3f, 0x93, 0x98, 0x28, 0x36, 0x36, 0x36, 0x36,
  7415. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x39, 0x2c, 0x26,
  7416. + 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7417. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7418. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7419. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7420. + 0x20, 0x20, 0x20, 0x20, 0x23, 0x2a, 0x34, 0x28,
  7421. + 0x36, 0x36, 0x36, 0x22, 0x38, 0x98, 0x44, 0x99,
  7422. + 0x9b, 0x48, 0x48, 0x9b, 0x4c, 0x48, 0x48, 0x48,
  7423. + 0x48, 0x48, 0x48, 0x47, 0x52, 0x46, 0x43, 0x93,
  7424. + 0x40, 0x40, 0x43, 0x53, 0x21, 0x23, 0x33, 0x23,
  7425. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x21, 0x2f, 0x32,
  7426. + 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7427. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7428. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7429. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7430. + 0x20, 0x20, 0x20, 0x21, 0x24, 0x2b, 0x31, 0x36,
  7431. + 0x36, 0x22, 0x36, 0x24, 0x9e, 0x4f, 0x9b, 0x48,
  7432. + 0x48, 0x48, 0x48, 0x9b, 0x99, 0x9f, 0x52, 0x48,
  7433. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x47,
  7434. + 0x4f, 0x9a, 0x3f, 0x46, 0x38, 0x36, 0x21, 0x30,
  7435. + 0x26, 0x36, 0x36, 0x36, 0x36, 0x36, 0x39, 0x2c,
  7436. + 0x25, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7437. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7438. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7439. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7440. + 0x20, 0x20, 0x20, 0x22, 0x26, 0x2e, 0x33, 0x36,
  7441. + 0x25, 0x25, 0x36, 0x4d, 0x52, 0x48, 0x48, 0x48,
  7442. + 0x47, 0x9f, 0x48, 0x48, 0x48, 0xa0, 0xa1, 0xa2,
  7443. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7444. + 0x48, 0x47, 0x44, 0x93, 0x43, 0x23, 0x36, 0x36,
  7445. + 0x26, 0x24, 0x36, 0x36, 0x36, 0x36, 0x28, 0x2f,
  7446. + 0x2a, 0x23, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7447. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7448. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7449. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7450. + 0x20, 0x20, 0x20, 0x23, 0x2a, 0x51, 0x24, 0x36,
  7451. + 0x2a, 0x36, 0x28, 0x44, 0x48, 0x48, 0x48, 0x48,
  7452. + 0xa3, 0xa4, 0x48, 0x48, 0x9f, 0xa5, 0xa6, 0x9f,
  7453. + 0x48, 0x48, 0x48, 0xa2, 0xa7, 0x47, 0x48, 0x48,
  7454. + 0x48, 0x48, 0x9b, 0x4b, 0x44, 0x37, 0x36, 0x23,
  7455. + 0x28, 0x30, 0x22, 0x36, 0x36, 0x36, 0x36, 0x2d,
  7456. + 0x35, 0x24, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  7457. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7458. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7459. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7460. + 0x20, 0x20, 0x21, 0x28, 0x2b, 0x34, 0x36, 0x25,
  7461. + 0x24, 0x36, 0x4a, 0x48, 0x48, 0x48, 0x48, 0x48,
  7462. + 0xa8, 0xa1, 0x48, 0x48, 0x9f, 0xa9, 0xa6, 0x9f,
  7463. + 0x48, 0x48, 0xaa, 0xa1, 0xa5, 0x9f, 0x48, 0x48,
  7464. + 0x48, 0x48, 0x48, 0x9b, 0x52, 0x3f, 0x21, 0x30,
  7465. + 0x35, 0x25, 0x30, 0x36, 0x36, 0x36, 0x36, 0x32,
  7466. + 0x2d, 0x26, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20,
  7467. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7468. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7469. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7470. + 0x20, 0x20, 0x22, 0x26, 0x2e, 0x35, 0x36, 0x2a,
  7471. + 0x36, 0x24, 0x4f, 0x48, 0x52, 0x52, 0x48, 0x48,
  7472. + 0xab, 0xac, 0xa0, 0x48, 0xad, 0xa6, 0xa6, 0x9f,
  7473. + 0x48, 0xa2, 0xa9, 0xa6, 0xa2, 0x48, 0x48, 0x48,
  7474. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x47, 0x32, 0x30,
  7475. + 0x2a, 0x23, 0x30, 0x23, 0x36, 0x36, 0x36, 0x21,
  7476. + 0x2f, 0x32, 0x23, 0x20, 0x20, 0x20, 0x20, 0x20,
  7477. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7478. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7479. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7480. + 0x20, 0x21, 0x23, 0x2a, 0x51, 0x28, 0x28, 0x25,
  7481. + 0x36, 0x3a, 0x48, 0x48, 0xae, 0xaf, 0x48, 0x48,
  7482. + 0xad, 0xac, 0xa1, 0x9f, 0xa2, 0xa9, 0xa9, 0xa2,
  7483. + 0x48, 0xab, 0x78, 0xa7, 0x48, 0x48, 0x48, 0x48,
  7484. + 0x9f, 0x48, 0x48, 0x48, 0x48, 0x48, 0x38, 0x21,
  7485. + 0x36, 0x36, 0x22, 0x27, 0x36, 0x36, 0x36, 0x36,
  7486. + 0x2e, 0x35, 0x24, 0x21, 0x20, 0x20, 0x20, 0x20,
  7487. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7488. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7489. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7490. + 0x20, 0x22, 0x25, 0x2c, 0x34, 0x36, 0x30, 0x21,
  7491. + 0x23, 0x43, 0x48, 0x48, 0xb0, 0xb1, 0xb2, 0x9f,
  7492. + 0x48, 0xb3, 0xa5, 0xb3, 0xab, 0xa9, 0xa9, 0xb3,
  7493. + 0xb4, 0xa9, 0xb5, 0xb0, 0x48, 0x48, 0xa0, 0xa5,
  7494. + 0xa1, 0xad, 0x48, 0x48, 0x48, 0x48, 0x94, 0x36,
  7495. + 0x36, 0x36, 0x36, 0x32, 0x36, 0x36, 0x36, 0x36,
  7496. + 0x2a, 0x2e, 0x26, 0x22, 0x20, 0x20, 0x20, 0x20,
  7497. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7498. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7499. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7500. + 0x21, 0x23, 0x2a, 0x51, 0x25, 0x21, 0x2a, 0x36,
  7501. + 0x2e, 0x9b, 0x48, 0x48, 0x48, 0xb6, 0xb7, 0xa4,
  7502. + 0xa2, 0xa7, 0xb5, 0x78, 0x6f, 0x6f, 0x6e, 0x6f,
  7503. + 0xa9, 0xb5, 0xab, 0x48, 0x9f, 0xab, 0xa9, 0xa1,
  7504. + 0xaa, 0x48, 0x48, 0x48, 0x48, 0x48, 0x98, 0x36,
  7505. + 0x36, 0x36, 0x36, 0x32, 0x36, 0x36, 0x36, 0x36,
  7506. + 0x22, 0x2f, 0x30, 0x22, 0x20, 0x20, 0x20, 0x20,
  7507. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7508. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7509. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7510. + 0x22, 0x25, 0x2c, 0x34, 0x36, 0x24, 0x28, 0x36,
  7511. + 0x54, 0x48, 0x48, 0x48, 0x48, 0xa2, 0xa8, 0xa1,
  7512. + 0xa5, 0xa6, 0x6e, 0x6e, 0x6f, 0x6f, 0x6f, 0x6f,
  7513. + 0x6f, 0x78, 0xa5, 0xa0, 0xa0, 0x78, 0xa6, 0xa2,
  7514. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x9a, 0x36,
  7515. + 0x36, 0x36, 0x36, 0x30, 0x36, 0x36, 0x36, 0x36,
  7516. + 0x21, 0x2f, 0x32, 0x23, 0x20, 0x20, 0x20, 0x20,
  7517. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7518. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7519. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  7520. + 0x28, 0x32, 0x2f, 0x28, 0x36, 0x27, 0x22, 0x21,
  7521. + 0x43, 0x48, 0x4b, 0xa2, 0x9f, 0x48, 0xa2, 0xa1,
  7522. + 0xb8, 0x6e, 0x6e, 0xb5, 0x78, 0x6f, 0x78, 0x78,
  7523. + 0x6e, 0x6f, 0x78, 0xb5, 0xa6, 0xa1, 0xa0, 0x48,
  7524. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x4b, 0x21,
  7525. + 0x36, 0x36, 0x21, 0x26, 0x36, 0x36, 0x36, 0x36,
  7526. + 0x36, 0x34, 0x2b, 0x28, 0x21, 0x20, 0x20, 0x20,
  7527. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7528. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7529. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  7530. + 0x25, 0x2c, 0x39, 0x36, 0x36, 0x30, 0x22, 0x25,
  7531. + 0x52, 0x48, 0xa3, 0xb1, 0xb6, 0xb3, 0xaa, 0xac,
  7532. + 0x68, 0x68, 0x6e, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f,
  7533. + 0x78, 0x6f, 0x6f, 0xb5, 0xa6, 0xb4, 0x48, 0x9f,
  7534. + 0xb4, 0xb4, 0xa2, 0x9f, 0x48, 0x48, 0x4f, 0x21,
  7535. + 0x36, 0x36, 0x22, 0x26, 0x36, 0x36, 0x36, 0x36,
  7536. + 0x36, 0x2c, 0x35, 0x24, 0x21, 0x20, 0x20, 0x20,
  7537. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7538. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7539. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  7540. + 0x30, 0x2d, 0x21, 0x36, 0x36, 0x32, 0x23, 0x2a,
  7541. + 0x47, 0x48, 0xa2, 0xb6, 0xaf, 0xb9, 0xba, 0x68,
  7542. + 0x6e, 0x6e, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x78,
  7543. + 0x6f, 0x6f, 0xa6, 0x6f, 0xb5, 0xa0, 0xaa, 0xa6,
  7544. + 0xa6, 0xa9, 0xb2, 0xb3, 0x48, 0x48, 0x4c, 0x22,
  7545. + 0x36, 0x36, 0x24, 0x23, 0x36, 0x36, 0x36, 0x36,
  7546. + 0x36, 0x2c, 0x39, 0x24, 0x21, 0x20, 0x20, 0x20,
  7547. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7548. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7549. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x28,
  7550. + 0x33, 0x2e, 0x36, 0x36, 0x23, 0x31, 0x27, 0x39,
  7551. + 0x9b, 0x48, 0x48, 0x48, 0xb0, 0xb0, 0xba, 0xb8,
  7552. + 0x68, 0x68, 0x69, 0x78, 0x6f, 0xb5, 0x6f, 0xb5,
  7553. + 0x78, 0x78, 0x78, 0x78, 0x78, 0xa5, 0xbb, 0xa9,
  7554. + 0xa5, 0x48, 0x48, 0x48, 0x48, 0x48, 0x4c, 0x23,
  7555. + 0x36, 0x36, 0x26, 0x36, 0x36, 0x36, 0x36, 0x36,
  7556. + 0x36, 0x2c, 0x39, 0x24, 0x21, 0x20, 0x20, 0x20,
  7557. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7558. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7559. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x28,
  7560. + 0x2b, 0x39, 0x36, 0x36, 0x36, 0x26, 0x32, 0x31,
  7561. + 0x9b, 0x48, 0x48, 0x48, 0x48, 0x9f, 0xac, 0x68,
  7562. + 0xbc, 0x6e, 0x6e, 0x6e, 0xb5, 0x6f, 0x6e, 0x6f,
  7563. + 0x6f, 0x78, 0x78, 0xb5, 0xb5, 0xa5, 0x9f, 0x9f,
  7564. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x46, 0x22,
  7565. + 0x36, 0x21, 0x26, 0x36, 0x36, 0x36, 0x36, 0x36,
  7566. + 0x36, 0x2c, 0x35, 0x24, 0x21, 0x20, 0x20, 0x20,
  7567. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7568. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7569. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x24,
  7570. + 0x35, 0x39, 0x36, 0x36, 0x36, 0x36, 0x26, 0x2d,
  7571. + 0x9b, 0x48, 0x48, 0xb0, 0xaa, 0xb3, 0xbd, 0xb8,
  7572. + 0xb8, 0x68, 0x6e, 0x6e, 0xb5, 0x6f, 0x78, 0x6e,
  7573. + 0x78, 0x6f, 0x78, 0x78, 0xb5, 0xa9, 0xa2, 0x48,
  7574. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x9a, 0x36,
  7575. + 0x24, 0x27, 0xbe, 0x24, 0x25, 0x28, 0x21, 0x36,
  7576. + 0x36, 0x34, 0x2b, 0x28, 0x21, 0x20, 0x20, 0x20,
  7577. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7578. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7579. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x25,
  7580. + 0x39, 0x4d, 0xbf, 0x84, 0x81, 0x57, 0x21, 0x39,
  7581. + 0x52, 0x48, 0x48, 0x62, 0xb1, 0xc0, 0xc1, 0xc1,
  7582. + 0xb8, 0xb8, 0x68, 0xbc, 0x6e, 0x6e, 0x6e, 0x78,
  7583. + 0x78, 0x78, 0x78, 0x6e, 0x78, 0xa9, 0xa0, 0xab,
  7584. + 0xb3, 0xa2, 0x48, 0x48, 0x48, 0x48, 0x53, 0x28,
  7585. + 0x23, 0x36, 0x36, 0x36, 0x21, 0x28, 0x2c, 0x30,
  7586. + 0x21, 0x38, 0x33, 0x28, 0x21, 0x20, 0x20, 0x20,
  7587. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7588. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7589. + 0x20, 0x20, 0x20, 0x21, 0x22, 0x22, 0x28, 0x30,
  7590. + 0x2d, 0xc2, 0x7a, 0xc3, 0xc4, 0xc4, 0x7f, 0x22,
  7591. + 0x51, 0x52, 0x48, 0x48, 0xb0, 0xaa, 0xa8, 0xbd,
  7592. + 0x68, 0xb8, 0xb8, 0x68, 0x68, 0x6e, 0x6e, 0x6f,
  7593. + 0x6e, 0x6e, 0xb5, 0x6e, 0x78, 0xab, 0xab, 0xb5,
  7594. + 0x78, 0xa6, 0xb3, 0xc5, 0xac, 0xac, 0xc6, 0x61,
  7595. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x30, 0x32,
  7596. + 0x25, 0x4d, 0x2b, 0x28, 0x21, 0x20, 0x20, 0x20,
  7597. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7598. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7599. + 0x20, 0x21, 0x23, 0x24, 0x26, 0x30, 0x33, 0x31,
  7600. + 0x4d, 0x91, 0x5b, 0xc3, 0xc4, 0xc4, 0xc4, 0x5a,
  7601. + 0x21, 0x2e, 0x46, 0x48, 0x48, 0x48, 0xb0, 0x64,
  7602. + 0xc1, 0xb8, 0xb8, 0xb8, 0x68, 0x71, 0x6e, 0x6e,
  7603. + 0x6f, 0x71, 0x6f, 0x6f, 0xa6, 0xa0, 0x9f, 0xb4,
  7604. + 0xb4, 0xa0, 0xa1, 0xb7, 0xc7, 0x69, 0x66, 0xc8,
  7605. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x21, 0x26, 0x25,
  7606. + 0x83, 0xc9, 0x2c, 0x25, 0x21, 0x20, 0x20, 0x20,
  7607. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7608. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7609. + 0x21, 0x28, 0x30, 0x35, 0x2d, 0x2f, 0x37, 0x4a,
  7610. + 0x60, 0x85, 0xca, 0xcb, 0xc4, 0xc4, 0xc4, 0x82,
  7611. + 0x86, 0x36, 0x32, 0x3f, 0xa2, 0xa4, 0xa8, 0xa9,
  7612. + 0xb8, 0xb8, 0xb8, 0xb8, 0x68, 0x6e, 0x6e, 0x6e,
  7613. + 0x6e, 0x71, 0x6f, 0x71, 0xa6, 0xb4, 0x9f, 0x9f,
  7614. + 0x48, 0x48, 0x48, 0xcc, 0xc3, 0xc7, 0xcd, 0xce,
  7615. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x21, 0x57,
  7616. + 0x77, 0x66, 0x34, 0x27, 0x22, 0x20, 0x20, 0x20,
  7617. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7618. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7619. + 0x23, 0x30, 0x31, 0xcf, 0x91, 0x7e, 0x90, 0x90,
  7620. + 0x8b, 0x5b, 0xc3, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7621. + 0x5d, 0xd0, 0x36, 0x24, 0xd1, 0xb1, 0xaf, 0xaa,
  7622. + 0xba, 0xb8, 0x68, 0x68, 0x68, 0x71, 0x6e, 0x6e,
  7623. + 0x6e, 0x6f, 0x6e, 0x78, 0xa1, 0xa9, 0xa1, 0xb0,
  7624. + 0x9f, 0x9b, 0x99, 0xcc, 0x64, 0x5c, 0x8b, 0xd0,
  7625. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x73, 0x5d,
  7626. + 0x82, 0x5c, 0xd2, 0x2a, 0x23, 0x20, 0x20, 0x20,
  7627. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7628. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  7629. + 0x24, 0x2b, 0xcf, 0x8b, 0x5b, 0x76, 0x5b, 0x5b,
  7630. + 0x7b, 0xc3, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7631. + 0xc7, 0x5e, 0x22, 0x36, 0x21, 0x3a, 0x99, 0x48,
  7632. + 0xa2, 0xa8, 0xb7, 0xc1, 0xb8, 0x68, 0x68, 0xbc,
  7633. + 0x68, 0x6e, 0xb5, 0xb4, 0xb4, 0xab, 0xb5, 0xa1,
  7634. + 0xb0, 0x4f, 0x3f, 0xd3, 0x7b, 0x7b, 0x85, 0x80,
  7635. + 0xbe, 0x36, 0x36, 0x36, 0x21, 0xd4, 0x7e, 0x7b,
  7636. + 0x64, 0x64, 0xd5, 0x35, 0x24, 0x21, 0x20, 0x20,
  7637. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7638. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  7639. + 0x26, 0x31, 0xd6, 0x5b, 0x64, 0xc3, 0xc3, 0xcb,
  7640. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7641. + 0xc4, 0x66, 0xd7, 0x36, 0x36, 0x36, 0x2c, 0x4b,
  7642. + 0xd8, 0xd9, 0xb3, 0xa8, 0xbd, 0xbd, 0xbd, 0xbd,
  7643. + 0xa9, 0xab, 0xb3, 0xa5, 0xa2, 0x9f, 0xa2, 0xa1,
  7644. + 0x6a, 0x9a, 0x3f, 0xda, 0x76, 0x76, 0x7a, 0x63,
  7645. + 0xdb, 0xdc, 0x86, 0xdc, 0xdd, 0x90, 0x5b, 0x64,
  7646. + 0xc3, 0xc3, 0xde, 0x2d, 0x27, 0x23, 0x21, 0x20,
  7647. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7648. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  7649. + 0x26, 0x2d, 0x91, 0x5b, 0x64, 0xc4, 0xc4, 0xc4,
  7650. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7651. + 0xc4, 0xc7, 0x83, 0xce, 0x36, 0x36, 0x36, 0x30,
  7652. + 0xb1, 0xd9, 0x48, 0xa1, 0xb2, 0xb0, 0xb0, 0xb3,
  7653. + 0xa2, 0x48, 0xa7, 0xbd, 0xa9, 0xa2, 0x48, 0x9f,
  7654. + 0xaa, 0x9a, 0x3f, 0xb1, 0x5b, 0x7b, 0xdf, 0x85,
  7655. + 0x7e, 0x90, 0x63, 0x90, 0x85, 0x5b, 0xc3, 0xc4,
  7656. + 0xc4, 0xcb, 0x5d, 0xd5, 0x39, 0x26, 0x23, 0x21,
  7657. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7658. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  7659. + 0x26, 0x2d, 0xe0, 0xdf, 0x64, 0xc4, 0xc4, 0xc4,
  7660. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7661. + 0xc4, 0xc4, 0xc7, 0x88, 0x36, 0x36, 0x36, 0x36,
  7662. + 0x2d, 0x9b, 0x48, 0xb9, 0xaf, 0xa2, 0xa2, 0xb9,
  7663. + 0xa8, 0x9f, 0x48, 0xa7, 0xb7, 0xd9, 0x48, 0x48,
  7664. + 0x9b, 0x45, 0x3f, 0xe1, 0x6d, 0x7b, 0xca, 0xdf,
  7665. + 0x7a, 0x8b, 0x8b, 0x7a, 0x5b, 0x64, 0xc4, 0xc4,
  7666. + 0xc4, 0xc4, 0xc3, 0xe2, 0x37, 0x35, 0x26, 0x23,
  7667. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7668. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  7669. + 0x26, 0x2e, 0xe0, 0x7a, 0x7b, 0xc4, 0xc4, 0xc4,
  7670. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7671. + 0xc4, 0xc4, 0xc7, 0x72, 0x73, 0x36, 0x36, 0x36,
  7672. + 0x24, 0x52, 0x48, 0xa3, 0xaf, 0x9f, 0x48, 0xb6,
  7673. + 0xaf, 0xa2, 0x48, 0x9f, 0xe3, 0xd8, 0x48, 0x48,
  7674. + 0x48, 0x46, 0x42, 0xd6, 0x7a, 0x7b, 0x64, 0x7b,
  7675. + 0x76, 0x5b, 0x5b, 0x76, 0x7b, 0xc3, 0xc4, 0xc4,
  7676. + 0xc4, 0xc4, 0xcb, 0x64, 0xe2, 0x4d, 0x2c, 0x27,
  7677. + 0x23, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7678. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  7679. + 0x25, 0x31, 0xe4, 0x8b, 0x7b, 0xc4, 0xc4, 0xc4,
  7680. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7681. + 0xc4, 0xc4, 0xc4, 0xc7, 0x89, 0xbe, 0x36, 0x36,
  7682. + 0x32, 0x47, 0x48, 0x4f, 0xa0, 0x48, 0x48, 0xe3,
  7683. + 0x92, 0x9f, 0x48, 0x9f, 0x48, 0x48, 0x48, 0x48,
  7684. + 0x48, 0x4b, 0x2f, 0x8f, 0x7a, 0x7b, 0xc3, 0xcb,
  7685. + 0xc3, 0x64, 0x64, 0xc3, 0xc3, 0xcb, 0xc4, 0xc4,
  7686. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc3, 0x5d, 0xe5, 0x2c,
  7687. + 0x26, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7688. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  7689. + 0x25, 0x31, 0xe4, 0x85, 0x7b, 0xc4, 0xc4, 0xc4,
  7690. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7691. + 0xc4, 0xc4, 0xc4, 0xc4, 0x66, 0x57, 0x27, 0x4d,
  7692. + 0x4b, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7693. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7694. + 0x99, 0x34, 0xbe, 0xdb, 0x7a, 0x7b, 0xc3, 0xc4,
  7695. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7696. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc3, 0xe4,
  7697. + 0x32, 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  7698. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
  7699. + 0x26, 0x2d, 0xe4, 0x85, 0x7b, 0xcb, 0xc4, 0xc4,
  7700. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7701. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc7, 0x5f, 0x92, 0x48,
  7702. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7703. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x44,
  7704. + 0x35, 0x36, 0xce, 0xdd, 0x7a, 0x7b, 0xcb, 0xc4,
  7705. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7706. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xcb, 0xc3, 0xe1,
  7707. + 0x2b, 0x24, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  7708. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x23,
  7709. + 0x30, 0x2f, 0xd6, 0x8b, 0x7b, 0xcb, 0xc4, 0xc4,
  7710. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7711. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0x66, 0x89, 0x45,
  7712. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7713. + 0x48, 0x48, 0x48, 0x48, 0x48, 0x9b, 0x4e, 0x25,
  7714. + 0x36, 0x36, 0x61, 0xdb, 0x6d, 0x64, 0xcb, 0xc4,
  7715. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7716. + 0xc4, 0xc4, 0xc4, 0xc4, 0xcb, 0x7b, 0xdf, 0xe5,
  7717. + 0x32, 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  7718. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x28,
  7719. + 0x33, 0xe6, 0x63, 0xdf, 0xc3, 0xc4, 0xc4, 0xc4,
  7720. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7721. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc3, 0x72, 0x81, 0xe7,
  7722. + 0x46, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
  7723. + 0x48, 0x48, 0x48, 0x48, 0x3f, 0x2c, 0x36, 0x36,
  7724. + 0x36, 0x36, 0xe8, 0x8f, 0x6d, 0x64, 0xcb, 0xc4,
  7725. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7726. + 0xc4, 0xc4, 0xc4, 0xc3, 0xca, 0x8b, 0xcf, 0x2c,
  7727. + 0x26, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7728. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x24,
  7729. + 0x35, 0x96, 0x75, 0xca, 0xc3, 0xcb, 0xc4, 0xc4,
  7730. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7731. + 0xc4, 0xc4, 0xc4, 0xc4, 0xcb, 0x7b, 0x81, 0xdb,
  7732. + 0x73, 0x3b, 0x44, 0x9b, 0x48, 0x48, 0x48, 0x9b,
  7733. + 0x99, 0x43, 0x94, 0x2c, 0x21, 0x36, 0x36, 0x36,
  7734. + 0x36, 0x36, 0x73, 0xdb, 0x7a, 0x7b, 0xc4, 0xc4,
  7735. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7736. + 0xc4, 0x64, 0x76, 0x7a, 0x91, 0xd5, 0x31, 0x30,
  7737. + 0x28, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7738. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x24,
  7739. + 0x39, 0x97, 0x75, 0xdf, 0x7b, 0x64, 0xc3, 0xc3,
  7740. + 0xcb, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
  7741. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0x7b, 0x7a, 0xe9,
  7742. + 0xea, 0x36, 0x21, 0x26, 0x2b, 0x39, 0x33, 0x30,
  7743. + 0x23, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7744. + 0x36, 0x21, 0xea, 0xdd, 0x8b, 0x7b, 0xc4, 0xc4,
  7745. + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc3, 0x64, 0x64,
  7746. + 0x76, 0x85, 0xe0, 0xd5, 0x34, 0x2b, 0x27, 0x28,
  7747. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7748. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x28,
  7749. + 0x33, 0xeb, 0x63, 0x7e, 0x7a, 0x6d, 0xdf, 0x5b,
  7750. + 0x76, 0x7b, 0x64, 0x64, 0xc3, 0xcb, 0xc4, 0xc4,
  7751. + 0xc4, 0xc4, 0xc4, 0xc4, 0xcb, 0x76, 0x85, 0xdb,
  7752. + 0x79, 0x22, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7753. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7754. + 0x36, 0x21, 0xec, 0xdd, 0x75, 0x76, 0xc3, 0xc4,
  7755. + 0xc4, 0xc4, 0xcb, 0xc3, 0x64, 0x76, 0xdf, 0x8b,
  7756. + 0xd6, 0xd5, 0x2f, 0x35, 0x30, 0x24, 0x22, 0x21,
  7757. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7758. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x23,
  7759. + 0x27, 0x31, 0xed, 0xeb, 0xdd, 0x74, 0x63, 0x90,
  7760. + 0x7e, 0x75, 0x8b, 0x6d, 0xdf, 0x76, 0x64, 0xc3,
  7761. + 0xcb, 0xcb, 0xcb, 0xcb, 0x64, 0x7a, 0x84, 0xee,
  7762. + 0x79, 0xbe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7763. + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
  7764. + 0x36, 0x21, 0xea, 0xee, 0x63, 0x6d, 0x7b, 0x64,
  7765. + 0xcb, 0xc3, 0x64, 0x7b, 0xdf, 0x75, 0x63, 0x96,
  7766. + 0x38, 0x39, 0x2a, 0x24, 0x23, 0x21, 0x20, 0x20,
  7767. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7768. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  7769. + 0x28, 0x27, 0x35, 0x2d, 0x41, 0xd5, 0xe7, 0x8f,
  7770. + 0xdb, 0xdd, 0xe9, 0x74, 0x84, 0x90, 0x85, 0x6d,
  7771. + 0x5b, 0x7b, 0x7b, 0xca, 0x6d, 0x90, 0xdb, 0xef,
  7772. + 0xec, 0x22, 0x36, 0x36, 0x28, 0x30, 0x30, 0x30,
  7773. + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x25, 0x36,
  7774. + 0x36, 0x21, 0xd4, 0x80, 0xe9, 0x7e, 0x6d, 0x76,
  7775. + 0xca, 0x76, 0x6d, 0x85, 0x63, 0xdb, 0xd5, 0x34,
  7776. + 0x33, 0x26, 0x23, 0x21, 0x20, 0x20, 0x20, 0x20,
  7777. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7778. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7779. + 0x21, 0x23, 0x24, 0x27, 0x2a, 0x35, 0x2e, 0x2f,
  7780. + 0x41, 0xf0, 0xf1, 0x6c, 0x80, 0xee, 0xdb, 0x74,
  7781. + 0x84, 0x90, 0x75, 0x7e, 0x74, 0x8f, 0xef, 0x79,
  7782. + 0xe8, 0x2b, 0x9d, 0x41, 0x2f, 0x34, 0x2d, 0x2d,
  7783. + 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x34, 0x2f, 0x38,
  7784. + 0x4d, 0x37, 0xf2, 0xf3, 0x8f, 0x74, 0x63, 0x7e,
  7785. + 0x75, 0x7e, 0x63, 0xe9, 0x88, 0xe6, 0x31, 0x2a,
  7786. + 0x24, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7787. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7788. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7789. + 0x20, 0x20, 0x21, 0x22, 0x23, 0x24, 0x26, 0x30,
  7790. + 0x33, 0x39, 0x2e, 0x51, 0x41, 0xd2, 0x6c, 0xf3,
  7791. + 0x80, 0xee, 0xee, 0xee, 0xf4, 0xf3, 0xd7, 0xf5,
  7792. + 0x41, 0x34, 0x35, 0x32, 0x30, 0x27, 0x27, 0x27,
  7793. + 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x30, 0x2a,
  7794. + 0x2b, 0x34, 0xf6, 0xec, 0xf7, 0x8f, 0xdd, 0xe9,
  7795. + 0xe9, 0xdd, 0xee, 0x6c, 0x41, 0x39, 0x27, 0x28,
  7796. + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7797. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7798. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7799. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x22,
  7800. + 0x28, 0x24, 0x26, 0x2a, 0x33, 0x2c, 0x2f, 0x41,
  7801. + 0xf8, 0xd7, 0x79, 0x79, 0x79, 0xec, 0xf9, 0x51,
  7802. + 0x39, 0x30, 0x24, 0x23, 0x22, 0x22, 0x22, 0x22,
  7803. + 0x22, 0x22, 0x21, 0x22, 0x22, 0x22, 0x22, 0x23,
  7804. + 0x24, 0x2a, 0x31, 0xfa, 0xea, 0x79, 0xf3, 0x80,
  7805. + 0xf7, 0xdc, 0xfb, 0x2f, 0x35, 0x26, 0x23, 0x21,
  7806. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7807. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7808. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7809. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7810. + 0x20, 0x21, 0x22, 0x23, 0x28, 0x25, 0x30, 0x2b,
  7811. + 0x31, 0x2f, 0xf6, 0xfa, 0xfa, 0x2f, 0x2e, 0x33,
  7812. + 0x26, 0x23, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20,
  7813. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7814. + 0x21, 0x28, 0x27, 0x35, 0x34, 0xfa, 0xfa, 0xfa,
  7815. + 0xfc, 0xf6, 0x2e, 0x33, 0x25, 0x23, 0x21, 0x20,
  7816. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7817. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7818. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7819. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7820. + 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x23, 0x28,
  7821. + 0x26, 0x30, 0x32, 0x2b, 0x33, 0x2a, 0x26, 0x28,
  7822. + 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7823. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7824. + 0x20, 0x21, 0x23, 0x25, 0x30, 0x33, 0x35, 0x35,
  7825. + 0x2b, 0x2a, 0x26, 0x28, 0x22, 0x20, 0x20, 0x20,
  7826. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7827. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7828. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7829. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7830. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21,
  7831. + 0x21, 0x22, 0x23, 0x28, 0x28, 0x23, 0x22, 0x21,
  7832. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7833. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7834. + 0x20, 0x20, 0x20, 0x21, 0x23, 0x28, 0x24, 0x24,
  7835. + 0x28, 0x23, 0x22, 0x21, 0x20, 0x20, 0x20, 0x20,
  7836. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7837. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  7838. +};
  7839. +
  7840. +unsigned char linux_logo16[1];
  7841. +
  7842. +#endif /* INCLUDE_LINUX_LOGO_DATA */
  7843. +
  7844. +#include <linux/linux_logo.h>
  7845. +
  7846. --- linux/include/asm-nios2nommu/local.h
  7847. +++ linux/include/asm-nios2nommu/local.h
  7848. @@ -0,0 +1,28 @@
  7849. +/*
  7850. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  7851. + *
  7852. + * All rights reserved.
  7853. + *
  7854. + * This program is free software; you can redistribute it and/or modify
  7855. + * it under the terms of the GNU General Public License as published by
  7856. + * the Free Software Foundation; either version 2 of the License, or
  7857. + * (at your option) any later version.
  7858. + *
  7859. + * This program is distributed in the hope that it will be useful, but
  7860. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  7861. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  7862. + * NON INFRINGEMENT. See the GNU General Public License for more
  7863. + * details.
  7864. + *
  7865. + * You should have received a copy of the GNU General Public License
  7866. + * along with this program; if not, write to the Free Software
  7867. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  7868. + *
  7869. + */
  7870. +
  7871. +#ifndef __NIOS2NOMMU_LOCAL_H
  7872. +#define __NIOS2NOMMU_LOCAL_H
  7873. +
  7874. +#include <asm-generic/local.h>
  7875. +
  7876. +#endif /* __NIOS2NOMMU_LOCAL_H */
  7877. --- linux/include/asm-nios2nommu/mc146818rtc.h
  7878. +++ linux/include/asm-nios2nommu/mc146818rtc.h
  7879. @@ -0,0 +1,29 @@
  7880. +/*
  7881. + * Machine dependent access functions for RTC registers.
  7882. + *
  7883. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  7884. + *
  7885. + * All rights reserved.
  7886. + *
  7887. + * This program is free software; you can redistribute it and/or modify
  7888. + * it under the terms of the GNU General Public License as published by
  7889. + * the Free Software Foundation; either version 2 of the License, or
  7890. + * (at your option) any later version.
  7891. + *
  7892. + * This program is distributed in the hope that it will be useful, but
  7893. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  7894. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  7895. + * NON INFRINGEMENT. See the GNU General Public License for more
  7896. + * details.
  7897. + *
  7898. + * You should have received a copy of the GNU General Public License
  7899. + * along with this program; if not, write to the Free Software
  7900. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  7901. + *
  7902. + */
  7903. +#ifndef _NIOS2_MC146818RTC_H
  7904. +#define _NIOS2_MC146818RTC_H
  7905. +
  7906. +/* empty include file to satisfy the include in genrtc.c/ide-geometry.c */
  7907. +
  7908. +#endif /* _NIOS2_MC146818RTC_H */
  7909. --- linux/include/asm-nios2nommu/mman.h
  7910. +++ linux/include/asm-nios2nommu/mman.h
  7911. @@ -0,0 +1,68 @@
  7912. +/*
  7913. + * Copied from the m68k port.
  7914. + *
  7915. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  7916. + *
  7917. + * All rights reserved.
  7918. + *
  7919. + * This program is free software; you can redistribute it and/or modify
  7920. + * it under the terms of the GNU General Public License as published by
  7921. + * the Free Software Foundation; either version 2 of the License, or
  7922. + * (at your option) any later version.
  7923. + *
  7924. + * This program is distributed in the hope that it will be useful, but
  7925. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  7926. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  7927. + * NON INFRINGEMENT. See the GNU General Public License for more
  7928. + * details.
  7929. + *
  7930. + * You should have received a copy of the GNU General Public License
  7931. + * along with this program; if not, write to the Free Software
  7932. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  7933. + *
  7934. + */
  7935. +
  7936. +#ifndef __NIOS2_MMAN_H__
  7937. +#define __NIOS2_MMAN_H__
  7938. +
  7939. +#define PROT_READ 0x1 /* page can be read */
  7940. +#define PROT_WRITE 0x2 /* page can be written */
  7941. +#define PROT_EXEC 0x4 /* page can be executed */
  7942. +#define PROT_SEM 0x8 /* page may be used for atomic ops */
  7943. +#define PROT_NONE 0x0 /* page can not be accessed */
  7944. +#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
  7945. +#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
  7946. +
  7947. +#define MAP_SHARED 0x01 /* Share changes */
  7948. +#define MAP_PRIVATE 0x02 /* Changes are private */
  7949. +#define MAP_TYPE 0x0f /* Mask for type of mapping */
  7950. +#define MAP_FIXED 0x10 /* Interpret addr exactly */
  7951. +#define MAP_ANONYMOUS 0x20 /* don't use a file */
  7952. +
  7953. +#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
  7954. +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
  7955. +#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
  7956. +#define MAP_LOCKED 0x2000 /* pages are locked */
  7957. +#define MAP_NORESERVE 0x4000 /* don't check for reservations */
  7958. +#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
  7959. +#define MAP_NONBLOCK 0x10000 /* do not block on IO */
  7960. +
  7961. +#define MS_ASYNC 1 /* sync memory asynchronously */
  7962. +#define MS_INVALIDATE 2 /* invalidate the caches */
  7963. +#define MS_SYNC 4 /* synchronous memory sync */
  7964. +
  7965. +#define MCL_CURRENT 1 /* lock all current mappings */
  7966. +#define MCL_FUTURE 2 /* lock all future mappings */
  7967. +
  7968. +#define MADV_NORMAL 0x0 /* default page-in behavior */
  7969. +#define MADV_RANDOM 0x1 /* page-in minimum required */
  7970. +#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
  7971. +#define MADV_WILLNEED 0x3 /* pre-fault pages */
  7972. +#define MADV_DONTNEED 0x4 /* discard these pages */
  7973. +
  7974. +/* compatibility flags */
  7975. +#define MAP_ANON MAP_ANONYMOUS
  7976. +#define MAP_FILE 0
  7977. +
  7978. +#endif /* __NIOS2_MMAN_H__ */
  7979. +
  7980. --- linux/include/asm-nios2nommu/mmu.h
  7981. +++ linux/include/asm-nios2nommu/mmu.h
  7982. @@ -0,0 +1,47 @@
  7983. +/*
  7984. + *
  7985. + * Taken from the m68knommu.
  7986. + *
  7987. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  7988. + *
  7989. + * All rights reserved.
  7990. + *
  7991. + * This program is free software; you can redistribute it and/or modify
  7992. + * it under the terms of the GNU General Public License as published by
  7993. + * the Free Software Foundation; either version 2 of the License, or
  7994. + * (at your option) any later version.
  7995. + *
  7996. + * This program is distributed in the hope that it will be useful, but
  7997. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  7998. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  7999. + * NON INFRINGEMENT. See the GNU General Public License for more
  8000. + * details.
  8001. + *
  8002. + * You should have received a copy of the GNU General Public License
  8003. + * along with this program; if not, write to the Free Software
  8004. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8005. + *
  8006. + */
  8007. +
  8008. +#ifndef __NIOS2NOMMU_MMU_H
  8009. +#define __NIOS2NOMMU_MMU_H
  8010. +
  8011. +/* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */
  8012. +
  8013. +struct mm_rblock_struct {
  8014. + int size;
  8015. + int refcount;
  8016. + void *kblock;
  8017. +};
  8018. +
  8019. +struct mm_tblock_struct {
  8020. + struct mm_rblock_struct *rblock;
  8021. + struct mm_tblock_struct *next;
  8022. +};
  8023. +
  8024. +typedef struct {
  8025. + struct mm_tblock_struct tblock;
  8026. + unsigned long end_brk;
  8027. +} mm_context_t;
  8028. +
  8029. +#endif /* __NIOS2NOMMU_MMU_H */
  8030. --- linux/include/asm-nios2nommu/mmu_context.h
  8031. +++ linux/include/asm-nios2nommu/mmu_context.h
  8032. @@ -0,0 +1,58 @@
  8033. +/*
  8034. + *
  8035. + * Taken from the m68knommu.
  8036. + *
  8037. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8038. + *
  8039. + * All rights reserved.
  8040. + *
  8041. + * This program is free software; you can redistribute it and/or modify
  8042. + * it under the terms of the GNU General Public License as published by
  8043. + * the Free Software Foundation; either version 2 of the License, or
  8044. + * (at your option) any later version.
  8045. + *
  8046. + * This program is distributed in the hope that it will be useful, but
  8047. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8048. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8049. + * NON INFRINGEMENT. See the GNU General Public License for more
  8050. + * details.
  8051. + *
  8052. + * You should have received a copy of the GNU General Public License
  8053. + * along with this program; if not, write to the Free Software
  8054. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8055. + *
  8056. + */
  8057. +
  8058. +#ifndef __NIOS2NOMMU_MMU_CONTEXT_H
  8059. +#define __NIOS2NOMMU_MMU_CONTEXT_H
  8060. +
  8061. +// #include <linux/config.h>
  8062. +#include <asm/setup.h>
  8063. +#include <asm/page.h>
  8064. +#include <asm/pgalloc.h>
  8065. +
  8066. +static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
  8067. +{
  8068. +}
  8069. +
  8070. +extern inline int
  8071. +init_new_context(struct task_struct *tsk, struct mm_struct *mm)
  8072. +{
  8073. + // mm->context = virt_to_phys(mm->pgd);
  8074. + return(0);
  8075. +}
  8076. +
  8077. +#define destroy_context(mm) do { } while(0)
  8078. +
  8079. +static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
  8080. +{
  8081. +}
  8082. +
  8083. +#define deactivate_mm(tsk,mm) do { } while (0)
  8084. +
  8085. +extern inline void activate_mm(struct mm_struct *prev_mm,
  8086. + struct mm_struct *next_mm)
  8087. +{
  8088. +}
  8089. +
  8090. +#endif
  8091. --- linux/include/asm-nios2nommu/module.h
  8092. +++ linux/include/asm-nios2nommu/module.h
  8093. @@ -0,0 +1,36 @@
  8094. +#ifndef _NIOS2_MODULE_H
  8095. +#define _NIOS2_MODULE_H
  8096. +
  8097. +/*--------------------------------------------------------------------
  8098. + *
  8099. + * include/asm-nios2nommu/module.h
  8100. + *
  8101. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  8102. + *
  8103. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8104. + *
  8105. + * This program is free software; you can redistribute it and/or modify
  8106. + * it under the terms of the GNU General Public License as published by
  8107. + * the Free Software Foundation; either version 2 of the License, or
  8108. + * (at your option) any later version.
  8109. + *
  8110. + * This program is distributed in the hope that it will be useful,
  8111. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8112. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8113. + * GNU General Public License for more details.
  8114. + *
  8115. + *
  8116. + * Jan/20/2004 dgt NiosII
  8117. + *
  8118. + ---------------------------------------------------------------------*/
  8119. +
  8120. +
  8121. +struct mod_arch_specific
  8122. +{
  8123. +};
  8124. +
  8125. +#define Elf_Shdr Elf32_Shdr
  8126. +#define Elf_Sym Elf32_Sym
  8127. +#define Elf_Ehdr Elf32_Ehdr
  8128. +
  8129. +#endif /* _NIOS_MODULE_H */
  8130. --- linux/include/asm-nios2nommu/msgbuf.h
  8131. +++ linux/include/asm-nios2nommu/msgbuf.h
  8132. @@ -0,0 +1,56 @@
  8133. +/*
  8134. + * Taken from the m68k.
  8135. + *
  8136. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8137. + *
  8138. + * All rights reserved.
  8139. + *
  8140. + * This program is free software; you can redistribute it and/or modify
  8141. + * it under the terms of the GNU General Public License as published by
  8142. + * the Free Software Foundation; either version 2 of the License, or
  8143. + * (at your option) any later version.
  8144. + *
  8145. + * This program is distributed in the hope that it will be useful, but
  8146. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8147. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8148. + * NON INFRINGEMENT. See the GNU General Public License for more
  8149. + * details.
  8150. + *
  8151. + * You should have received a copy of the GNU General Public License
  8152. + * along with this program; if not, write to the Free Software
  8153. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8154. + *
  8155. + */
  8156. +
  8157. +#ifndef _NIOS2_MSGBUF_H
  8158. +#define _NIOS2_MSGBUF_H
  8159. +
  8160. +/*
  8161. + * The msqid64_ds structure for nios2 architecture.
  8162. + * Note extra padding because this structure is passed back and forth
  8163. + * between kernel and user space.
  8164. + *
  8165. + * Pad space is left for:
  8166. + * - 64-bit time_t to solve y2038 problem
  8167. + * - 2 miscellaneous 32-bit values
  8168. + */
  8169. +
  8170. +struct msqid64_ds {
  8171. + struct ipc64_perm msg_perm;
  8172. + __kernel_time_t msg_stime; /* last msgsnd time */
  8173. + unsigned long __unused1;
  8174. + __kernel_time_t msg_rtime; /* last msgrcv time */
  8175. + unsigned long __unused2;
  8176. + __kernel_time_t msg_ctime; /* last change time */
  8177. + unsigned long __unused3;
  8178. + unsigned long msg_cbytes; /* current number of bytes on queue */
  8179. + unsigned long msg_qnum; /* number of messages in queue */
  8180. + unsigned long msg_qbytes; /* max number of bytes on queue */
  8181. + __kernel_pid_t msg_lspid; /* pid of last msgsnd */
  8182. + __kernel_pid_t msg_lrpid; /* last receive pid */
  8183. + unsigned long __unused4;
  8184. + unsigned long __unused5;
  8185. +};
  8186. +
  8187. +#endif /* _NIOS2_MSGBUF_H */
  8188. +
  8189. --- linux/include/asm-nios2nommu/namei.h
  8190. +++ linux/include/asm-nios2nommu/namei.h
  8191. @@ -0,0 +1,36 @@
  8192. +/*
  8193. + * linux/include/asm-nios/namei.h
  8194. + * Moved from m68k version
  8195. + * Included from linux/fs/namei.c
  8196. + *
  8197. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8198. + * All rights reserved.
  8199. + *
  8200. + * This program is free software; you can redistribute it and/or modify
  8201. + * it under the terms of the GNU General Public License as published by
  8202. + * the Free Software Foundation; either version 2 of the License, or
  8203. + * (at your option) any later version.
  8204. + *
  8205. + * This program is distributed in the hope that it will be useful, but
  8206. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8207. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8208. + * NON INFRINGEMENT. See the GNU General Public License for more
  8209. + * details.
  8210. + *
  8211. + * You should have received a copy of the GNU General Public License
  8212. + * along with this program; if not, write to the Free Software
  8213. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8214. + *
  8215. + */
  8216. +
  8217. +#ifndef __NIOS2_NAMEI_H
  8218. +#define __NIOS2_NAMEI_H
  8219. +
  8220. +/* This dummy routine maybe changed to something useful
  8221. + * for /usr/gnemul/ emulation stuff.
  8222. + * Look at asm-sparc/namei.h for details.
  8223. + */
  8224. +
  8225. +#define __emul_prefix() NULL
  8226. +
  8227. +#endif
  8228. --- linux/include/asm-nios2nommu/ndma.h
  8229. +++ linux/include/asm-nios2nommu/ndma.h
  8230. @@ -0,0 +1,64 @@
  8231. +#ifndef __NDMA_H__
  8232. + #define __NDMA_H__
  8233. +
  8234. + #ifndef __ASSEMBLY__
  8235. +
  8236. +// DMA Registers
  8237. +typedef volatile struct
  8238. +{
  8239. + int np_dmastatus; // status register
  8240. + int np_dmareadaddress; // read address
  8241. + int np_dmawriteaddress; // write address
  8242. + int np_dmalength; // length in bytes
  8243. + int np_dmareserved1; // reserved
  8244. + int np_dmareserved2; // reserved
  8245. + int np_dmacontrol; // control register
  8246. + int np_dmareserved3; // control register alternate
  8247. +} np_dma;
  8248. +
  8249. +// DMA Register Bits
  8250. +enum
  8251. +{
  8252. + np_dmacontrol_byte_bit = 0, // Byte transaction
  8253. + np_dmacontrol_hw_bit = 1, // Half-word transaction
  8254. + np_dmacontrol_word_bit = 2, // Word transaction
  8255. + np_dmacontrol_go_bit = 3, // enable execution
  8256. + np_dmacontrol_i_en_bit = 4, // enable interrupt
  8257. + np_dmacontrol_reen_bit = 5, // Enable read end-of-packet
  8258. + np_dmacontrol_ween_bit = 6, // Enable write end-of-packet
  8259. + np_dmacontrol_leen_bit = 7, // Enable length=0 transaction end
  8260. + np_dmacontrol_rcon_bit = 8, // Read from a fixed address
  8261. + np_dmacontrol_wcon_bit = 9, // Write to a fixed address
  8262. + np_dmacontrol_doubleword_bit = 10, // Double-word transaction
  8263. + np_dmacontrol_quadword_bit = 11, // Quad-word transaction
  8264. +
  8265. + np_dmastatus_done_bit = 0, // 1 when done. Status write clears.
  8266. + np_dmastatus_busy_bit = 1, // 1 when busy.
  8267. + np_dmastatus_reop_bit = 2, // read-eop received
  8268. + np_dmastatus_weop_bit = 3, // write-eop received
  8269. + np_dmastatus_len_bit = 4, // requested length transacted
  8270. +
  8271. + np_dmacontrol_byte_mask = (1 << 0), // Byte transaction
  8272. + np_dmacontrol_hw_mask = (1 << 1), // Half-word transaction
  8273. + np_dmacontrol_word_mask = (1 << 2), // Word transaction
  8274. + np_dmacontrol_go_mask = (1 << 3), // enable execution
  8275. + np_dmacontrol_i_en_mask = (1 << 4), // enable interrupt
  8276. + np_dmacontrol_reen_mask = (1 << 5), // Enable read end-of-packet
  8277. + np_dmacontrol_ween_mask = (1 << 6), // Enable write end-of-packet
  8278. + np_dmacontrol_leen_mask = (1 << 7), // Enable length=0 transaction end
  8279. + np_dmacontrol_rcon_mask = (1 << 8), // Read from a fixed address
  8280. + np_dmacontrol_wcon_mask = (1 << 9), // Write to a fixed address
  8281. + np_dmacontrol_doubleword_mask = (1 << 10), // Double-word transaction
  8282. + np_dmacontrol_quadword_mask = (1 << 11), // Quad-word transaction
  8283. +
  8284. + np_dmastatus_done_mask = (1 << 0), // 1 when done. Status write clears.
  8285. + np_dmastatus_busy_mask = (1 << 1), // 1 when busy.
  8286. + np_dmastatus_reop_mask = (1 << 2), // read-eop received
  8287. + np_dmastatus_weop_mask = (1 << 3), // write-eop received
  8288. + np_dmastatus_len_mask = (1 << 4), // requested length transacted
  8289. +};
  8290. +
  8291. + #endif /* __ASSEMBLY__ */
  8292. +
  8293. +#endif
  8294. +/* End of File */
  8295. --- linux/include/asm-nios2nommu/nios.h
  8296. +++ linux/include/asm-nios2nommu/nios.h
  8297. @@ -0,0 +1,7 @@
  8298. +#ifndef __NIOS_H__
  8299. +#define __NIOS_H__
  8300. +
  8301. +#include "nios2_system.h"
  8302. +
  8303. +#endif
  8304. +
  8305. --- linux/include/asm-nios2nommu/page.h
  8306. +++ linux/include/asm-nios2nommu/page.h
  8307. @@ -0,0 +1,135 @@
  8308. +/*
  8309. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  8310. + *
  8311. + * All rights reserved.
  8312. + *
  8313. + * This program is free software; you can redistribute it and/or modify
  8314. + * it under the terms of the GNU General Public License as published by
  8315. + * the Free Software Foundation; either version 2 of the License, or
  8316. + * (at your option) any later version.
  8317. + *
  8318. + * This program is distributed in the hope that it will be useful, but
  8319. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  8320. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  8321. + * NON INFRINGEMENT. See the GNU General Public License for more
  8322. + * details.
  8323. + *
  8324. + * You should have received a copy of the GNU General Public License
  8325. + * along with this program; if not, write to the Free Software
  8326. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  8327. + *
  8328. + */
  8329. +
  8330. +#ifndef _NIOS2_PAGE_H
  8331. +#define _NIOS2_PAGE_H
  8332. +
  8333. +/* copied from m68knommu arch */
  8334. +// #include <linux/config.h>
  8335. +
  8336. +/* PAGE_SHIFT determines the page size */
  8337. +
  8338. +#define PAGE_SHIFT (12)
  8339. +#define PAGE_SIZE (1UL << PAGE_SHIFT)
  8340. +#define PAGE_MASK (~(PAGE_SIZE-1))
  8341. +
  8342. +#ifdef __KERNEL__
  8343. +
  8344. +#include <asm/setup.h>
  8345. +
  8346. +#if PAGE_SHIFT < 13
  8347. +#define THREAD_SIZE (8192)
  8348. +#else
  8349. +#define THREAD_SIZE PAGE_SIZE
  8350. +#endif
  8351. +
  8352. +#ifndef __ASSEMBLY__
  8353. +
  8354. +#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
  8355. +#define free_user_page(page, addr) free_page(addr)
  8356. +
  8357. +#define clear_page(page) memset((page), 0, PAGE_SIZE)
  8358. +#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
  8359. +
  8360. +#define clear_user_page(page, vaddr, pg) clear_page(page)
  8361. +#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
  8362. +
  8363. +/*
  8364. + * These are used to make use of C type-checking..
  8365. + */
  8366. +typedef struct { unsigned long pte; } pte_t;
  8367. +typedef struct { unsigned long pmd[16]; } pmd_t;
  8368. +typedef struct { unsigned long pgd; } pgd_t;
  8369. +typedef struct { unsigned long pgprot; } pgprot_t;
  8370. +
  8371. +#define pte_val(x) ((x).pte)
  8372. +#define pmd_val(x) ((&x)->pmd[0])
  8373. +#define pgd_val(x) ((x).pgd)
  8374. +#define pgprot_val(x) ((x).pgprot)
  8375. +
  8376. +#define __pte(x) ((pte_t) { (x) } )
  8377. +#define __pmd(x) ((pmd_t) { (x) } )
  8378. +#define __pgd(x) ((pgd_t) { (x) } )
  8379. +#define __pgprot(x) ((pgprot_t) { (x) } )
  8380. +
  8381. +/* to align the pointer to the (next) page boundary */
  8382. +#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  8383. +
  8384. +/* Pure 2^n version of get_order */
  8385. +extern __inline__ int get_order(unsigned long size)
  8386. +{
  8387. + int order;
  8388. +
  8389. + size = (size-1) >> (PAGE_SHIFT-1);
  8390. + order = -1;
  8391. + do {
  8392. + size >>= 1;
  8393. + order++;
  8394. + } while (size);
  8395. + return order;
  8396. +}
  8397. +
  8398. +extern unsigned long memory_start;
  8399. +extern unsigned long memory_end;
  8400. +
  8401. +#endif /* !__ASSEMBLY__ */
  8402. +#include <asm/nios.h>
  8403. +#define PAGE_OFFSET ((int)(nasys_program_mem))
  8404. +
  8405. +#ifndef __ASSEMBLY__
  8406. +
  8407. +#define __pa(vaddr) virt_to_phys((void *)vaddr)
  8408. +#define __va(paddr) phys_to_virt((unsigned long)paddr)
  8409. +
  8410. +#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
  8411. +
  8412. +#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
  8413. +#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
  8414. +
  8415. +#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
  8416. +#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
  8417. +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
  8418. +
  8419. +#define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn))
  8420. +#define page_to_pfn(page) virt_to_pfn(page_to_virt(page))
  8421. +
  8422. +#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
  8423. + ((void *)(kaddr) < (void *)memory_end))
  8424. +
  8425. +#ifdef CONFIG_NO_KERNEL_MSG
  8426. +#define BUG_PRINT()
  8427. +#else
  8428. +#define BUG_PRINT() printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__)
  8429. +#endif
  8430. +
  8431. +#ifdef na_cpu_oci_core
  8432. +#define BUG_PANIC() asm volatile ("break") /* drop to debugger */
  8433. +#else
  8434. +// #define BUG_PANIC() while(1)
  8435. +#define BUG_PANIC() panic("BUG!")
  8436. +#endif
  8437. +
  8438. +#endif /* __ASSEMBLY__ */
  8439. +
  8440. +#endif /* __KERNEL__ */
  8441. +
  8442. +#endif /* _NIOS2_PAGE_H */
  8443. --- linux/include/asm-nios2nommu/param.h
  8444. +++ linux/include/asm-nios2nommu/param.h
  8445. @@ -0,0 +1,49 @@
  8446. +#ifndef _NIOS_PARAM_H
  8447. +#define _NIOS_PARAM_H
  8448. +
  8449. +/*--------------------------------------------------------------------
  8450. + *
  8451. + * include/asm-nios2nommu/param.h
  8452. + *
  8453. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  8454. + *
  8455. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8456. + *
  8457. + * This program is free software; you can redistribute it and/or modify
  8458. + * it under the terms of the GNU General Public License as published by
  8459. + * the Free Software Foundation; either version 2 of the License, or
  8460. + * (at your option) any later version.
  8461. + *
  8462. + * This program is distributed in the hope that it will be useful,
  8463. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8464. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8465. + * GNU General Public License for more details.
  8466. + *
  8467. + *
  8468. + * Jan/20/2004 dgt NiosII
  8469. + *
  8470. + ---------------------------------------------------------------------*/
  8471. +
  8472. +
  8473. +#ifndef HZ
  8474. +#define HZ 100
  8475. +#endif
  8476. +
  8477. +#ifdef __KERNEL__
  8478. +#define USER_HZ HZ
  8479. +#define CLOCKS_PER_SEC (USER_HZ)
  8480. +#endif
  8481. +
  8482. +#define EXEC_PAGESIZE 4096
  8483. +
  8484. +#ifndef NGROUPS
  8485. +#define NGROUPS 32
  8486. +#endif
  8487. +
  8488. +#ifndef NOGROUP
  8489. +#define NOGROUP (-1)
  8490. +#endif
  8491. +
  8492. +#define MAXHOSTNAMELEN 64 /* max length of hostname */
  8493. +
  8494. +#endif
  8495. --- linux/include/asm-nios2nommu/pci.h
  8496. +++ linux/include/asm-nios2nommu/pci.h
  8497. @@ -0,0 +1,75 @@
  8498. +#ifndef _ASM_NIOS2NOMMU_PCI_H
  8499. +#define _ASM_NIOS2NOMMU_PCI_H
  8500. +
  8501. +/*--------------------------------------------------------------------
  8502. + *
  8503. + * include/asm-nios2nommu/pci.h
  8504. + *
  8505. + * Derived from asm-m68k/pci_m68k.h
  8506. + * - m68k specific PCI declarations, by Wout Klaren.
  8507. + *
  8508. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8509. + *
  8510. + * This program is free software; you can redistribute it and/or modify
  8511. + * it under the terms of the GNU General Public License as published by
  8512. + * the Free Software Foundation; either version 2 of the License, or
  8513. + * (at your option) any later version.
  8514. + *
  8515. + * This program is distributed in the hope that it will be useful,
  8516. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8517. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8518. + * GNU General Public License for more details.
  8519. + *
  8520. + *
  8521. + * Jan/20/2004 dgt NiosII
  8522. + *
  8523. + ---------------------------------------------------------------------*/
  8524. +
  8525. +
  8526. +#include <asm/scatterlist.h>
  8527. +
  8528. +struct pci_ops;
  8529. +
  8530. +/*
  8531. + * Structure with hardware dependent information and functions of the
  8532. + * PCI bus.
  8533. + */
  8534. +
  8535. +struct pci_bus_info
  8536. +{
  8537. + /*
  8538. + * Resources of the PCI bus.
  8539. + */
  8540. +
  8541. + struct resource mem_space;
  8542. + struct resource io_space;
  8543. +
  8544. + /*
  8545. + * System dependent functions.
  8546. + */
  8547. +
  8548. + struct pci_ops *m68k_pci_ops;
  8549. +
  8550. + void (*fixup)(int pci_modify);
  8551. + void (*conf_device)(struct pci_dev *dev);
  8552. +};
  8553. +
  8554. +#define pcibios_assign_all_busses() 0
  8555. +
  8556. +extern inline void pcibios_set_master(struct pci_dev *dev)
  8557. +{
  8558. + /* No special bus mastering setup handling */
  8559. +}
  8560. +
  8561. +extern inline void pcibios_penalize_isa_irq(int irq)
  8562. +{
  8563. + /* We don't do dynamic PCI IRQ allocation */
  8564. +}
  8565. +
  8566. +/* The PCI address space does equal the physical memory
  8567. + * address space. The networking and block device layers use
  8568. + * this boolean for bounce buffer decisions.
  8569. + */
  8570. +#define PCI_DMA_BUS_IS_PHYS (1)
  8571. +
  8572. +#endif /* _ASM_NIOS2NOMMU_PCI_H */
  8573. --- linux/include/asm-nios2nommu/percpu.h
  8574. +++ linux/include/asm-nios2nommu/percpu.h
  8575. @@ -0,0 +1,30 @@
  8576. +#ifndef __ARCH_NIOS2NOMMU_PERCPU__
  8577. +#define __ARCH_NIOS2NOMMU_PERCPU__
  8578. +
  8579. +/*--------------------------------------------------------------------
  8580. + *
  8581. + * include/asm-nios2nommu/percpu.h
  8582. + *
  8583. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  8584. + *
  8585. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8586. + *
  8587. + * This program is free software; you can redistribute it and/or modify
  8588. + * it under the terms of the GNU General Public License as published by
  8589. + * the Free Software Foundation; either version 2 of the License, or
  8590. + * (at your option) any later version.
  8591. + *
  8592. + * This program is distributed in the hope that it will be useful,
  8593. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8594. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8595. + * GNU General Public License for more details.
  8596. + *
  8597. + *
  8598. + * Jan/20/2004 dgt NiosII
  8599. + *
  8600. + ---------------------------------------------------------------------*/
  8601. +
  8602. +
  8603. +#include <asm-generic/percpu.h>
  8604. +
  8605. +#endif /* __ARCH_NIOS2NOMMU_PERCPU__ */
  8606. --- linux/include/asm-nios2nommu/pgalloc.h
  8607. +++ linux/include/asm-nios2nommu/pgalloc.h
  8608. @@ -0,0 +1,32 @@
  8609. +#ifndef _NIOS2NOMMU_PGALLOC_H
  8610. +#define _NIOS2NOMMU_PGALLOC_H
  8611. +
  8612. +/*--------------------------------------------------------------------
  8613. + *
  8614. + * include/asm-nios2nommu/pgalloc.h
  8615. + *
  8616. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  8617. + *
  8618. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8619. + *
  8620. + * This program is free software; you can redistribute it and/or modify
  8621. + * it under the terms of the GNU General Public License as published by
  8622. + * the Free Software Foundation; either version 2 of the License, or
  8623. + * (at your option) any later version.
  8624. + *
  8625. + * This program is distributed in the hope that it will be useful,
  8626. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8627. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8628. + * GNU General Public License for more details.
  8629. + *
  8630. + *
  8631. + * Jan/20/2004 dgt NiosII
  8632. + *
  8633. + ---------------------------------------------------------------------*/
  8634. +
  8635. +
  8636. +#include <asm/setup.h>
  8637. +
  8638. +#define check_pgt_cache() do { } while (0)
  8639. +
  8640. +#endif /* _NIOS2NOMMU_PGALLOC_H */
  8641. --- linux/include/asm-nios2nommu/pgtable.h
  8642. +++ linux/include/asm-nios2nommu/pgtable.h
  8643. @@ -0,0 +1,100 @@
  8644. +#ifndef _NIOS_PGTABLE_H
  8645. +#define _NIOS_PGTABLE_H
  8646. +
  8647. +/*--------------------------------------------------------------------
  8648. + *
  8649. + * include/asm-nios2nommu/pgtable.h
  8650. + *
  8651. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  8652. + *
  8653. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8654. + *
  8655. + * This program is free software; you can redistribute it and/or modify
  8656. + * it under the terms of the GNU General Public License as published by
  8657. + * the Free Software Foundation; either version 2 of the License, or
  8658. + * (at your option) any later version.
  8659. + *
  8660. + * This program is distributed in the hope that it will be useful,
  8661. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8662. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8663. + * GNU General Public License for more details.
  8664. + *
  8665. + *
  8666. + * Jan/20/2004 dgt NiosII
  8667. + *
  8668. + ---------------------------------------------------------------------*/
  8669. +
  8670. +
  8671. +//vic - this bit copied from m68knommu version
  8672. +// #include <linux/config.h>
  8673. +#include <asm/setup.h>
  8674. +#include <asm/io.h>
  8675. +
  8676. +typedef pte_t *pte_addr_t;
  8677. +
  8678. +#define pgd_present(pgd) (1) /* pages are always present on NO_MM */
  8679. +#define pgd_none(pgd) (0)
  8680. +#define pgd_bad(pgd) (0)
  8681. +#define pgd_clear(pgdp)
  8682. +#define kern_addr_valid(addr) (1)
  8683. +#define pmd_offset(a, b) ((void *)0)
  8684. +
  8685. +#define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */
  8686. +#define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */
  8687. +#define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */
  8688. +#define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */
  8689. +#define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */
  8690. +//vic - this bit copied from m68knommu version
  8691. +
  8692. +extern void paging_init(void);
  8693. +#define swapper_pg_dir ((pgd_t *) 0)
  8694. +
  8695. +#define __swp_type(x) (0)
  8696. +#define __swp_offset(x) (0)
  8697. +#define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })
  8698. +#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
  8699. +#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
  8700. +
  8701. +static inline int pte_file(pte_t pte) { return 0; }
  8702. +
  8703. +/*
  8704. + * ZERO_PAGE is a global shared page that is always zero: used
  8705. + * for zero-mapped memory areas etc..
  8706. + */
  8707. +#define ZERO_PAGE(vaddr) (virt_to_page(0))
  8708. +
  8709. +extern unsigned int kobjsize(const void *objp);
  8710. +
  8711. +/*
  8712. + * No page table caches to initialise
  8713. + */
  8714. +#define pgtable_cache_init() do { } while (0)
  8715. +
  8716. +extern inline void flush_cache_mm(struct mm_struct *mm)
  8717. +{
  8718. +}
  8719. +
  8720. +extern inline void flush_cache_range(struct mm_struct *mm,
  8721. + unsigned long start,
  8722. + unsigned long end)
  8723. +{
  8724. +}
  8725. +
  8726. +/* Push the page at kernel virtual address and clear the icache */
  8727. +extern inline void flush_page_to_ram (unsigned long address)
  8728. +{
  8729. +}
  8730. +
  8731. +/* Push n pages at kernel virtual address and clear the icache */
  8732. +extern inline void flush_pages_to_ram (unsigned long address, int n)
  8733. +{
  8734. +}
  8735. +
  8736. +/*
  8737. + * All 32bit addresses are effectively valid for vmalloc...
  8738. + * Sort of meaningless for non-VM targets.
  8739. + */
  8740. +#define VMALLOC_START 0
  8741. +#define VMALLOC_END 0xffffffff
  8742. +
  8743. +#endif /* _NIOS_PGTABLE_H */
  8744. --- linux/include/asm-nios2nommu/pio_struct.h
  8745. +++ linux/include/asm-nios2nommu/pio_struct.h
  8746. @@ -0,0 +1,14 @@
  8747. +// PIO Peripheral
  8748. +
  8749. +// PIO Registers
  8750. +typedef volatile struct
  8751. + {
  8752. + int np_piodata; // read/write, up to 32 bits
  8753. + int np_piodirection; // write/readable, up to 32 bits, 1->output bit
  8754. + int np_piointerruptmask; // write/readable, up to 32 bits, 1->enable interrupt
  8755. + int np_pioedgecapture; // read, up to 32 bits, cleared by any write
  8756. + } np_pio;
  8757. +
  8758. +// PIO Routines
  8759. +void nr_pio_showhex(int value); // shows low byte on pio named na_seven_seg_pio
  8760. +
  8761. --- linux/include/asm-nios2nommu/poll.h
  8762. +++ linux/include/asm-nios2nommu/poll.h
  8763. @@ -0,0 +1,46 @@
  8764. +#ifndef __NIOS2_POLL_H
  8765. +#define __NIOS2_POLL_H
  8766. +
  8767. +/*--------------------------------------------------------------------
  8768. + *
  8769. + * include/asm-nios2nommu/poll.h
  8770. + *
  8771. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  8772. + *
  8773. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8774. + *
  8775. + * This program is free software; you can redistribute it and/or modify
  8776. + * it under the terms of the GNU General Public License as published by
  8777. + * the Free Software Foundation; either version 2 of the License, or
  8778. + * (at your option) any later version.
  8779. + *
  8780. + * This program is distributed in the hope that it will be useful,
  8781. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8782. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8783. + * GNU General Public License for more details.
  8784. + *
  8785. + *
  8786. + * Jan/20/2004 dgt NiosII
  8787. + *
  8788. + ---------------------------------------------------------------------*/
  8789. +
  8790. +
  8791. +#define POLLIN 1
  8792. +#define POLLPRI 2
  8793. +#define POLLOUT 4
  8794. +#define POLLERR 8
  8795. +#define POLLHUP 16
  8796. +#define POLLNVAL 32
  8797. +#define POLLRDNORM 64
  8798. +#define POLLWRNORM POLLOUT
  8799. +#define POLLRDBAND 128
  8800. +#define POLLWRBAND 256
  8801. +#define POLLMSG 0x0400
  8802. +
  8803. +struct pollfd {
  8804. + int fd;
  8805. + short events;
  8806. + short revents;
  8807. +};
  8808. +
  8809. +#endif
  8810. --- linux/include/asm-nios2nommu/posix_types.h
  8811. +++ linux/include/asm-nios2nommu/posix_types.h
  8812. @@ -0,0 +1,89 @@
  8813. +#ifndef __ARCH_NIOS2_POSIX_TYPES_H
  8814. +#define __ARCH_NIOS2_POSIX_TYPES_H
  8815. +
  8816. +/*--------------------------------------------------------------------
  8817. + *
  8818. + * include/asm-nios2nommu/posix_types.h
  8819. + *
  8820. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  8821. + *
  8822. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8823. + *
  8824. + * This program is free software; you can redistribute it and/or modify
  8825. + * it under the terms of the GNU General Public License as published by
  8826. + * the Free Software Foundation; either version 2 of the License, or
  8827. + * (at your option) any later version.
  8828. + *
  8829. + * This program is distributed in the hope that it will be useful,
  8830. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8831. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8832. + * GNU General Public License for more details.
  8833. + *
  8834. + *
  8835. + * Jan/20/2004 dgt NiosII
  8836. + *
  8837. + ---------------------------------------------------------------------*/
  8838. +
  8839. +
  8840. +/*
  8841. + * This file is generally used by user-level software, so you need to
  8842. + * be a little careful about namespace pollution etc. Also, we cannot
  8843. + * assume GCC is being used.
  8844. + */
  8845. +
  8846. +typedef unsigned long __kernel_ino_t;
  8847. +typedef unsigned short __kernel_mode_t;
  8848. +typedef unsigned short __kernel_nlink_t;
  8849. +typedef long __kernel_off_t;
  8850. +typedef int __kernel_pid_t;
  8851. +typedef unsigned short __kernel_ipc_pid_t;
  8852. +typedef unsigned short __kernel_uid_t;
  8853. +typedef unsigned short __kernel_gid_t;
  8854. +typedef unsigned int __kernel_size_t;
  8855. +typedef int __kernel_ssize_t;
  8856. +typedef int __kernel_ptrdiff_t;
  8857. +typedef long __kernel_time_t;
  8858. +typedef long __kernel_suseconds_t;
  8859. +typedef long __kernel_clock_t;
  8860. +typedef int __kernel_timer_t;
  8861. +typedef int __kernel_clockid_t;
  8862. +typedef int __kernel_daddr_t;
  8863. +typedef char * __kernel_caddr_t;
  8864. +typedef unsigned short __kernel_uid16_t;
  8865. +typedef unsigned short __kernel_gid16_t;
  8866. +typedef unsigned int __kernel_uid32_t;
  8867. +typedef unsigned int __kernel_gid32_t;
  8868. +
  8869. +typedef unsigned short __kernel_old_uid_t;
  8870. +typedef unsigned short __kernel_old_gid_t;
  8871. +typedef unsigned short __kernel_old_dev_t;
  8872. +
  8873. +#ifdef __GNUC__
  8874. +typedef long long __kernel_loff_t;
  8875. +#endif
  8876. +
  8877. +typedef struct {
  8878. +#if defined(__KERNEL__) || defined(__USE_ALL)
  8879. + int val[2];
  8880. +#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
  8881. + int __val[2];
  8882. +#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
  8883. +} __kernel_fsid_t;
  8884. +
  8885. +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
  8886. +
  8887. +#undef __FD_SET
  8888. +#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
  8889. +
  8890. +#undef __FD_CLR
  8891. +#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
  8892. +
  8893. +#undef __FD_ISSET
  8894. +#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
  8895. +
  8896. +#undef __FD_ZERO
  8897. +#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
  8898. +
  8899. +#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
  8900. +
  8901. +#endif
  8902. --- linux/include/asm-nios2nommu/preem_latency.h
  8903. +++ linux/include/asm-nios2nommu/preem_latency.h
  8904. @@ -0,0 +1,39 @@
  8905. +#ifndef _ASM_PREEM_LATENCY_H
  8906. +#define _ASM_PREEM_LATENCY_H
  8907. +
  8908. +/*--------------------------------------------------------------------
  8909. + *
  8910. + * include/asm-nios2nommu/preem_latency.h
  8911. + *
  8912. + * timing support for preempt-stats patch
  8913. + *
  8914. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  8915. + *
  8916. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8917. + *
  8918. + * This program is free software; you can redistribute it and/or modify
  8919. + * it under the terms of the GNU General Public License as published by
  8920. + * the Free Software Foundation; either version 2 of the License, or
  8921. + * (at your option) any later version.
  8922. + *
  8923. + * This program is distributed in the hope that it will be useful,
  8924. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8925. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8926. + * GNU General Public License for more details.
  8927. + *
  8928. + *
  8929. + * Jan/20/2004 dgt NiosII
  8930. + *
  8931. + ---------------------------------------------------------------------*/
  8932. +
  8933. +
  8934. +#include <asm/nios.h>
  8935. +
  8936. +#define readclock(low) \
  8937. +do {\
  8938. + *(volatile unsigned long *)na_Counter_64_bit=1; \
  8939. + low=*(volatile unsigned long *)na_Counter_64_bit; \
  8940. +} while (0)
  8941. +#define readclock_init()
  8942. +
  8943. +#endif /* _ASM_PREEM_LATENCY_H */
  8944. --- linux/include/asm-nios2nommu/processor.h
  8945. +++ linux/include/asm-nios2nommu/processor.h
  8946. @@ -0,0 +1,148 @@
  8947. +/*--------------------------------------------------------------------
  8948. + *
  8949. + * include/asm-nios2nommu/processor.h
  8950. + *
  8951. + * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
  8952. + * Copyright (C) 2001 Ken Hill (khill@microtronix.com)
  8953. + * Vic Phillips (vic@microtronix.com)
  8954. + * Copyright (C) 2004 Microtronix Datacom Ltd
  8955. + *
  8956. + * hacked from:
  8957. + * include/asm-sparc/processor.h
  8958. + *
  8959. + * This program is free software; you can redistribute it and/or modify
  8960. + * it under the terms of the GNU General Public License as published by
  8961. + * the Free Software Foundation; either version 2 of the License, or
  8962. + * (at your option) any later version.
  8963. + *
  8964. + * This program is distributed in the hope that it will be useful,
  8965. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8966. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8967. + * GNU General Public License for more details.
  8968. + *
  8969. + *
  8970. + * Jan/20/2004 dgt NiosII
  8971. + * Nov/02/2003 dgt Fix task_size
  8972. + *
  8973. + ---------------------------------------------------------------------*/
  8974. +
  8975. +#ifndef __ASM_NIOS_PROCESSOR_H
  8976. +#define __ASM_NIOS_PROCESSOR_H
  8977. +
  8978. +#define NIOS2_FLAG_KTHREAD 0x00000001 /* task is a kernel thread */
  8979. +#define NIOS2_FLAG_COPROC 0x00000002 /* Thread used coprocess */
  8980. +#define NIOS2_FLAG_DEBUG 0x00000004 /* task is being debugged */
  8981. +
  8982. +#define NIOS2_OP_NOP 0x1883a
  8983. +#define NIOS2_OP_BREAK 0x3da03a
  8984. +
  8985. +#ifndef __ASSEMBLY__
  8986. +
  8987. +/*
  8988. + * Default implementation of macro that returns current
  8989. + * instruction pointer ("program counter").
  8990. + */
  8991. +#define current_text_addr() ({ __label__ _l; _l: &&_l;})
  8992. +
  8993. +#include <linux/a.out.h>
  8994. +#include <linux/string.h>
  8995. +
  8996. +#include <asm/ptrace.h>
  8997. +#include <asm/signal.h>
  8998. +#include <asm/segment.h>
  8999. +#include <asm/current.h>
  9000. +#include <asm/system.h> /* for get_hi_limit */
  9001. +
  9002. +/*
  9003. + * Bus types
  9004. + */
  9005. +#define EISA_bus 0
  9006. +#define EISA_bus__is_a_macro /* for versions in ksyms.c */
  9007. +#define MCA_bus 0
  9008. +#define MCA_bus__is_a_macro /* for versions in ksyms.c */
  9009. +
  9010. +/*
  9011. + * The nios has no problems with write protection
  9012. + */
  9013. +#define wp_works_ok 1
  9014. +#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
  9015. +
  9016. +/* Whee, this is STACK_TOP and the lowest kernel address too... */
  9017. +#if 0
  9018. +#define KERNBASE 0x00000000 /* First address the kernel will eventually be */
  9019. +#define TASK_SIZE (KERNBASE)
  9020. +#define MAX_USER_ADDR TASK_SIZE
  9021. +#define MMAP_SEARCH_START (TASK_SIZE/3)
  9022. +#endif
  9023. +
  9024. +#define TASK_SIZE ((unsigned int) nasys_program_mem_end) //...this is better...
  9025. +
  9026. +/*
  9027. + * This decides where the kernel will search for a free chunk of vm
  9028. + * space during mmap's. We won't be using it
  9029. + */
  9030. +#define TASK_UNMAPPED_BASE 0
  9031. +
  9032. +/* The Nios processor specific thread struct. */
  9033. +struct thread_struct {
  9034. + struct pt_regs *kregs;
  9035. +
  9036. + /* For signal handling */
  9037. + unsigned long sig_address;
  9038. + unsigned long sig_desc;
  9039. +
  9040. + /* Context switch saved kernel state. */
  9041. + unsigned long ksp;
  9042. + unsigned long kpsr;
  9043. + unsigned long kesr;
  9044. +
  9045. + /* Flags are defined below */
  9046. +
  9047. + unsigned long flags;
  9048. + int current_ds;
  9049. + struct exec core_exec; /* just what it says. */
  9050. +};
  9051. +
  9052. +#define INIT_MMAP { &init_mm, (0), (0), \
  9053. + __pgprot(0x0) , VM_READ | VM_WRITE | VM_EXEC }
  9054. +
  9055. +#define INIT_THREAD { \
  9056. + .kregs = 0, \
  9057. + .sig_address = 0, \
  9058. + .sig_desc = 0, \
  9059. + .ksp = 0, \
  9060. + .kpsr = 0, \
  9061. + .kesr = PS_S, \
  9062. + .flags = NIOS2_FLAG_KTHREAD, \
  9063. + .current_ds = __KERNEL_DS, \
  9064. + .core_exec = INIT_EXEC \
  9065. +}
  9066. +
  9067. +/* Free all resources held by a thread. */
  9068. +extern void release_thread(struct task_struct *);
  9069. +
  9070. +extern unsigned long thread_saved_pc(struct task_struct *t);
  9071. +
  9072. +extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp);
  9073. +
  9074. +/* Prepare to copy thread state - unlazy all lazy status */
  9075. +#define prepare_to_copy(tsk) do { } while (0)
  9076. +
  9077. +extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  9078. +
  9079. +unsigned long get_wchan(struct task_struct *p);
  9080. +
  9081. +#define KSTK_EIP(tsk) ((tsk)->thread.kregs->ea)
  9082. +#define KSTK_ESP(tsk) ((tsk)->thread.kregs->sp)
  9083. +
  9084. +#ifdef __KERNEL__
  9085. +/* Allocation and freeing of basic task resources. */
  9086. +
  9087. +//;dgt2;#define alloc_task_struct() ((struct task_struct *) xx..see..linux..fork..xx __get_free_pages(GFP_KERNEL,1))
  9088. +//;dgt2;#define get_task_struct(tsk) xx..see..linux..sched.h...atomic_inc(&mem_map[MAP_NR(tsk)].count)
  9089. +
  9090. +#endif
  9091. +
  9092. +#define cpu_relax() do { } while (0)
  9093. +#endif /* __ASSEMBLY__ */
  9094. +#endif /* __ASM_NIOS_PROCESSOR_H */
  9095. --- linux/include/asm-nios2nommu/ptrace.h
  9096. +++ linux/include/asm-nios2nommu/ptrace.h
  9097. @@ -0,0 +1,141 @@
  9098. +/*
  9099. + * Taken from the m68k port.
  9100. + *
  9101. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  9102. + *
  9103. + * All rights reserved.
  9104. + *
  9105. + * This program is free software; you can redistribute it and/or modify
  9106. + * it under the terms of the GNU General Public License as published by
  9107. + * the Free Software Foundation; either version 2 of the License, or
  9108. + * (at your option) any later version.
  9109. + *
  9110. + * This program is distributed in the hope that it will be useful, but
  9111. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  9112. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  9113. + * NON INFRINGEMENT. See the GNU General Public License for more
  9114. + * details.
  9115. + *
  9116. + * You should have received a copy of the GNU General Public License
  9117. + * along with this program; if not, write to the Free Software
  9118. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  9119. + *
  9120. + */
  9121. +#ifndef _NIOS2NOMMU_PTRACE_H
  9122. +#define _NIOS2NOMMU_PTRACE_H
  9123. +
  9124. +#ifndef __ASSEMBLY__
  9125. +
  9126. +#define PTR_R0 0
  9127. +#define PTR_R1 1
  9128. +#define PTR_R2 2
  9129. +#define PTR_R3 3
  9130. +#define PTR_R4 4
  9131. +#define PTR_R5 5
  9132. +#define PTR_R6 6
  9133. +#define PTR_R7 7
  9134. +#define PTR_R8 8
  9135. +#define PTR_R9 9
  9136. +#define PTR_R10 10
  9137. +#define PTR_R11 11
  9138. +#define PTR_R12 12
  9139. +#define PTR_R13 13
  9140. +#define PTR_R14 14
  9141. +#define PTR_R15 15
  9142. +#define PTR_R16 16
  9143. +#define PTR_R17 17
  9144. +#define PTR_R18 18
  9145. +#define PTR_R19 19
  9146. +#define PTR_R20 20
  9147. +#define PTR_R21 21
  9148. +#define PTR_R22 22
  9149. +#define PTR_R23 23
  9150. +#define PTR_R24 24
  9151. +#define PTR_R25 25
  9152. +#define PTR_GP 26
  9153. +#define PTR_SP 27
  9154. +#define PTR_FP 28
  9155. +#define PTR_EA 29
  9156. +#define PTR_BA 30
  9157. +#define PTR_RA 31
  9158. +#define PTR_STATUS 32
  9159. +#define PTR_ESTATUS 33
  9160. +#define PTR_BSTATUS 34
  9161. +#define PTR_IENABLE 35
  9162. +#define PTR_IPENDING 36
  9163. +
  9164. +/* this struct defines the way the registers are stored on the
  9165. + stack during a system call.
  9166. +
  9167. + There is a fake_regs in setup.c that has to match pt_regs.*/
  9168. +
  9169. +struct pt_regs {
  9170. + unsigned long r8;
  9171. + unsigned long r9;
  9172. + unsigned long r10;
  9173. + unsigned long r11;
  9174. + unsigned long r12;
  9175. + unsigned long r13;
  9176. + unsigned long r14;
  9177. + unsigned long r15;
  9178. + unsigned long r1;
  9179. + unsigned long r2;
  9180. + unsigned long r3;
  9181. + unsigned long r4;
  9182. + unsigned long r5;
  9183. + unsigned long r6;
  9184. + unsigned long r7;
  9185. + unsigned long orig_r2;
  9186. + unsigned long ra;
  9187. + unsigned long fp;
  9188. + unsigned long sp;
  9189. + unsigned long gp;
  9190. + unsigned long estatus;
  9191. + unsigned long status_extension;
  9192. + unsigned long ea;
  9193. +};
  9194. +
  9195. +
  9196. +/*
  9197. + * This is the extended stack used by signal handlers and the context
  9198. + * switcher: it's pushed after the normal "struct pt_regs".
  9199. + */
  9200. +struct switch_stack {
  9201. + unsigned long r16;
  9202. + unsigned long r17;
  9203. + unsigned long r18;
  9204. + unsigned long r19;
  9205. + unsigned long r20;
  9206. + unsigned long r21;
  9207. + unsigned long r22;
  9208. + unsigned long r23;
  9209. + unsigned long fp;
  9210. + unsigned long gp;
  9211. + unsigned long ra;
  9212. +};
  9213. +
  9214. +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  9215. +#define PTRACE_GETREGS 12
  9216. +#define PTRACE_SETREGS 13
  9217. +#ifdef CONFIG_FPU
  9218. +#define PTRACE_GETFPREGS 14
  9219. +#define PTRACE_SETFPREGS 15
  9220. +#endif
  9221. +
  9222. +#ifdef __KERNEL__
  9223. +
  9224. +#ifndef PS_S
  9225. +#define PS_S (0x00000001)
  9226. +#endif
  9227. +#ifndef PS_T
  9228. +#define PS_T (0x00000002)
  9229. +#endif
  9230. +
  9231. +#define user_mode(regs) (!((regs)->status_extension & PS_S))
  9232. +#define instruction_pointer(regs) ((regs)->ra)
  9233. +#define profile_pc(regs) instruction_pointer(regs)
  9234. +extern void show_regs(struct pt_regs *);
  9235. +
  9236. +#endif /* __KERNEL__ */
  9237. +#endif /* __ASSEMBLY__ */
  9238. +#endif /* _NIOS2NOMMU_PTRACE_H */
  9239. --- linux/include/asm-nios2nommu/resource.h
  9240. +++ linux/include/asm-nios2nommu/resource.h
  9241. @@ -0,0 +1,73 @@
  9242. +#ifndef _NIOS2NOMMU_RESOURCE_H
  9243. +#define _NIOS2NOMMU_RESOURCE_H
  9244. +
  9245. +/*--------------------------------------------------------------------
  9246. + *
  9247. + * Resource limits
  9248. + *
  9249. + * include/asm-nios2nommu/resource.h
  9250. + *
  9251. + * Derived from M68knommu
  9252. + *
  9253. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9254. + *
  9255. + * This program is free software; you can redistribute it and/or modify
  9256. + * it under the terms of the GNU General Public License as published by
  9257. + * the Free Software Foundation; either version 2 of the License, or
  9258. + * (at your option) any later version.
  9259. + *
  9260. + * This program is distributed in the hope that it will be useful,
  9261. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9262. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9263. + * GNU General Public License for more details.
  9264. + *
  9265. + *
  9266. + * Jan/20/2004 dgt NiosII
  9267. + *
  9268. + ---------------------------------------------------------------------*/
  9269. +
  9270. +
  9271. +#define RLIMIT_CPU 0 /* CPU time in ms */
  9272. +#define RLIMIT_FSIZE 1 /* Maximum filesize */
  9273. +#define RLIMIT_DATA 2 /* max data size */
  9274. +#define RLIMIT_STACK 3 /* max stack size */
  9275. +#define RLIMIT_CORE 4 /* max core file size */
  9276. +#define RLIMIT_RSS 5 /* max resident set size */
  9277. +#define RLIMIT_NPROC 6 /* max number of processes */
  9278. +#define RLIMIT_NOFILE 7 /* max number of open files */
  9279. +#define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
  9280. +#define RLIMIT_AS 9 /* address space limit */
  9281. +#define RLIMIT_LOCKS 10 /* maximum file locks held */
  9282. +#define RLIMIT_SIGPENDING 11 /* max number of pending signals */
  9283. +#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
  9284. +
  9285. +#define RLIM_NLIMITS 13
  9286. +
  9287. +/*
  9288. + * SuS says limits have to be unsigned.
  9289. + * Which makes a ton more sense anyway.
  9290. + */
  9291. +#define RLIM_INFINITY (~0UL)
  9292. +
  9293. +#ifdef __KERNEL__
  9294. +
  9295. +#define INIT_RLIMITS \
  9296. +{ \
  9297. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9298. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9299. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9300. + { _STK_LIM, RLIM_INFINITY }, \
  9301. + { 0, RLIM_INFINITY }, \
  9302. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9303. + { 0, 0 }, \
  9304. + { INR_OPEN, INR_OPEN }, \
  9305. + { MLOCK_LIMIT, MLOCK_LIMIT }, \
  9306. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9307. + { RLIM_INFINITY, RLIM_INFINITY }, \
  9308. + { MAX_SIGPENDING, MAX_SIGPENDING }, \
  9309. + { MQ_BYTES_MAX, MQ_BYTES_MAX }, \
  9310. +}
  9311. +
  9312. +#endif /* __KERNEL__ */
  9313. +
  9314. +#endif /* _NIOS2NOMMU_RESOURCE_H */
  9315. --- linux/include/asm-nios2nommu/rmap.h
  9316. +++ linux/include/asm-nios2nommu/rmap.h
  9317. @@ -0,0 +1,2 @@
  9318. +/* Do not need anything here */
  9319. +
  9320. --- linux/include/asm-nios2nommu/scatterlist.h
  9321. +++ linux/include/asm-nios2nommu/scatterlist.h
  9322. @@ -0,0 +1,40 @@
  9323. +#ifndef _NIOS2NOMMU_SCATTERLIST_H
  9324. +#define _NIOS2NOMMU_SCATTERLIST_H
  9325. +
  9326. +/*--------------------------------------------------------------------
  9327. + *
  9328. + * include/asm-nios2nommu/scatterlist.h
  9329. + *
  9330. + * Derived from M68knommu
  9331. + *
  9332. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9333. + *
  9334. + * This program is free software; you can redistribute it and/or modify
  9335. + * it under the terms of the GNU General Public License as published by
  9336. + * the Free Software Foundation; either version 2 of the License, or
  9337. + * (at your option) any later version.
  9338. + *
  9339. + * This program is distributed in the hope that it will be useful,
  9340. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9341. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9342. + * GNU General Public License for more details.
  9343. + *
  9344. + *
  9345. + * Jan/20/2004 dgt NiosII
  9346. + *
  9347. + ---------------------------------------------------------------------*/
  9348. +
  9349. +
  9350. +struct scatterlist {
  9351. + struct page *page;
  9352. + unsigned int offset;
  9353. + dma_addr_t dma_address;
  9354. + unsigned int length;
  9355. +};
  9356. +
  9357. +#define sg_dma_address(sg) ((sg)->dma_address)
  9358. +#define sg_dma_len(sg) ((sg)->length)
  9359. +
  9360. +#define ISA_DMA_THRESHOLD (0xffffffff)
  9361. +
  9362. +#endif /* !(_NIOS2NOMMU_SCATTERLIST_H) */
  9363. --- linux/include/asm-nios2nommu/sections.h
  9364. +++ linux/include/asm-nios2nommu/sections.h
  9365. @@ -0,0 +1,30 @@
  9366. +#ifndef _NIOS2NOMMU_SECTIONS_H
  9367. +#define _NIOS2NOMMU_SECTIONS_H
  9368. +
  9369. +/*--------------------------------------------------------------------
  9370. + *
  9371. + * include/asm-nios2nommu/sections.h
  9372. + *
  9373. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  9374. + *
  9375. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9376. + *
  9377. + * This program is free software; you can redistribute it and/or modify
  9378. + * it under the terms of the GNU General Public License as published by
  9379. + * the Free Software Foundation; either version 2 of the License, or
  9380. + * (at your option) any later version.
  9381. + *
  9382. + * This program is distributed in the hope that it will be useful,
  9383. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9384. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9385. + * GNU General Public License for more details.
  9386. + *
  9387. + *
  9388. + * Jan/20/2004 dgt NiosII
  9389. + *
  9390. + ---------------------------------------------------------------------*/
  9391. +
  9392. +
  9393. +#include <asm-generic/sections.h>
  9394. +
  9395. +#endif /* _NIOS2NOMMU_SECTIONS_H */
  9396. --- linux/include/asm-nios2nommu/segment.h
  9397. +++ linux/include/asm-nios2nommu/segment.h
  9398. @@ -0,0 +1,75 @@
  9399. +#ifndef _NIOS2NOMMU_SEGMENT_H
  9400. +#define _NIOS2NOMMU_SEGMENT_H
  9401. +
  9402. +/*--------------------------------------------------------------------
  9403. + *
  9404. + * include/asm-nios2nommu/segment.h
  9405. + *
  9406. + * Derived from M68knommu
  9407. + *
  9408. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9409. + *
  9410. + * This program is free software; you can redistribute it and/or modify
  9411. + * it under the terms of the GNU General Public License as published by
  9412. + * the Free Software Foundation; either version 2 of the License, or
  9413. + * (at your option) any later version.
  9414. + *
  9415. + * This program is distributed in the hope that it will be useful,
  9416. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9417. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9418. + * GNU General Public License for more details.
  9419. + *
  9420. + *
  9421. + * Jan/20/2004 dgt NiosII
  9422. + *
  9423. + ---------------------------------------------------------------------*/
  9424. +
  9425. +
  9426. +/* define constants */
  9427. +/* Address spaces (FC0-FC2) */
  9428. +#define USER_DATA (1)
  9429. +#ifndef __USER_DS
  9430. +#define __USER_DS (USER_DATA)
  9431. +#endif
  9432. +#define USER_PROGRAM (2)
  9433. +#define SUPER_DATA (5)
  9434. +#ifndef __KERNEL_DS
  9435. +#define __KERNEL_DS (SUPER_DATA)
  9436. +#endif
  9437. +#define SUPER_PROGRAM (6)
  9438. +#define CPU_SPACE (7)
  9439. +
  9440. +#ifndef __ASSEMBLY__
  9441. +
  9442. +typedef struct {
  9443. + unsigned long seg;
  9444. +} mm_segment_t;
  9445. +
  9446. +#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
  9447. +#define USER_DS MAKE_MM_SEG(__USER_DS)
  9448. +#define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS)
  9449. +
  9450. +/*
  9451. + * Get/set the SFC/DFC registers for MOVES instructions
  9452. + */
  9453. +
  9454. +static inline mm_segment_t get_fs(void)
  9455. +{
  9456. + return USER_DS;
  9457. +}
  9458. +
  9459. +static inline mm_segment_t get_ds(void)
  9460. +{
  9461. + /* return the supervisor data space code */
  9462. + return KERNEL_DS;
  9463. +}
  9464. +
  9465. +static inline void set_fs(mm_segment_t val)
  9466. +{
  9467. +}
  9468. +
  9469. +#define segment_eq(a,b) ((a).seg == (b).seg)
  9470. +
  9471. +#endif /* __ASSEMBLY__ */
  9472. +
  9473. +#endif /* _NIOS2NOMMU_SEGMENT_H */
  9474. --- linux/include/asm-nios2nommu/semaphore-helper.h
  9475. +++ linux/include/asm-nios2nommu/semaphore-helper.h
  9476. @@ -0,0 +1,101 @@
  9477. +#ifndef _NIOS2NOMMU_SEMAPHORE_HELPER_H
  9478. +#define _NIOS2NOMMU_SEMAPHORE_HELPER_H
  9479. +
  9480. +/*--------------------------------------------------------------------
  9481. + *
  9482. + * include/asm-nios2nommu/semaphore.h
  9483. + *
  9484. + * SMP- and interrupt-safe semaphores helper functions.
  9485. + *
  9486. + * Derived from M68knommu
  9487. + *
  9488. + * (C) Copyright 1996 Linus Torvalds
  9489. + * m68k version by Andreas Schwab
  9490. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9491. + *
  9492. + * This program is free software; you can redistribute it and/or modify
  9493. + * it under the terms of the GNU General Public License as published by
  9494. + * the Free Software Foundation; either version 2 of the License, or
  9495. + * (at your option) any later version.
  9496. + *
  9497. + * This program is distributed in the hope that it will be useful,
  9498. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9499. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9500. + * GNU General Public License for more details.
  9501. + *
  9502. + * Jan/20/2004 dgt NiosII
  9503. + *
  9504. + ---------------------------------------------------------------------*/
  9505. +
  9506. +// #include <linux/config.h>
  9507. +
  9508. +/*
  9509. + * These two _must_ execute atomically wrt each other.
  9510. + */
  9511. +static inline void wake_one_more(struct semaphore * sem)
  9512. +{
  9513. + atomic_inc(&sem->waking);
  9514. +}
  9515. +
  9516. +static inline int waking_non_zero(struct semaphore *sem)
  9517. +{
  9518. + int ret;
  9519. + unsigned long flags;
  9520. +
  9521. + spin_lock_irqsave(&semaphore_wake_lock, flags);
  9522. + ret = 0;
  9523. + if (atomic_read(&sem->waking) > 0) {
  9524. + atomic_dec(&sem->waking);
  9525. + ret = 1;
  9526. + }
  9527. + spin_unlock_irqrestore(&semaphore_wake_lock, flags);
  9528. + return ret;
  9529. +}
  9530. +
  9531. +/*
  9532. + * waking_non_zero_interruptible:
  9533. + * 1 got the lock
  9534. + * 0 go to sleep
  9535. + * -EINTR interrupted
  9536. + */
  9537. +static inline int waking_non_zero_interruptible(struct semaphore *sem,
  9538. + struct task_struct *tsk)
  9539. +{
  9540. + int ret;
  9541. + unsigned long flags;
  9542. +
  9543. + spin_lock_irqsave(&semaphore_wake_lock, flags);
  9544. + ret = 0;
  9545. + if (atomic_read(&sem->waking) > 0) {
  9546. + atomic_dec(&sem->waking);
  9547. + ret = 1;
  9548. + } else if (signal_pending(tsk)) {
  9549. + atomic_inc(&sem->count);
  9550. + ret = -EINTR;
  9551. + }
  9552. + spin_unlock_irqrestore(&semaphore_wake_lock, flags);
  9553. + return ret;
  9554. +}
  9555. +
  9556. +/*
  9557. + * waking_non_zero_trylock:
  9558. + * 1 failed to lock
  9559. + * 0 got the lock
  9560. + */
  9561. +static inline int waking_non_zero_trylock(struct semaphore *sem)
  9562. +{
  9563. + int ret;
  9564. + unsigned long flags;
  9565. +
  9566. + spin_lock_irqsave(&semaphore_wake_lock, flags);
  9567. + ret = 1;
  9568. + if (atomic_read(&sem->waking) > 0) {
  9569. + atomic_dec(&sem->waking);
  9570. + ret = 0;
  9571. + } else
  9572. + atomic_inc(&sem->count);
  9573. + spin_unlock_irqrestore(&semaphore_wake_lock, flags);
  9574. + return ret;
  9575. +}
  9576. +
  9577. +#endif
  9578. --- linux/include/asm-nios2nommu/semaphore.h
  9579. +++ linux/include/asm-nios2nommu/semaphore.h
  9580. @@ -0,0 +1,155 @@
  9581. +#ifndef _NIOS2NOMMU_SEMAPHORE_H
  9582. +#define _NIOS2NOMMU_SEMAPHORE_H
  9583. +
  9584. +/*--------------------------------------------------------------------
  9585. + *
  9586. + * include/asm-nios2nommu/semaphore.h
  9587. + *
  9588. + * Interrupt-safe semaphores..
  9589. + *
  9590. + * Derived from M68knommu
  9591. + *
  9592. + * (C) Copyright 1996 Linus Torvalds
  9593. + * m68k version by Andreas Schwab
  9594. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9595. + *
  9596. + * This program is free software; you can redistribute it and/or modify
  9597. + * it under the terms of the GNU General Public License as published by
  9598. + * the Free Software Foundation; either version 2 of the License, or
  9599. + * (at your option) any later version.
  9600. + *
  9601. + * This program is distributed in the hope that it will be useful,
  9602. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9603. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9604. + * GNU General Public License for more details.
  9605. + *
  9606. + * Jan/20/2004 dgt NiosII
  9607. + *
  9608. + ---------------------------------------------------------------------*/
  9609. +
  9610. +#define RW_LOCK_BIAS 0x01000000
  9611. +
  9612. +#ifndef __ASSEMBLY__
  9613. +
  9614. +#include <linux/linkage.h>
  9615. +#include <linux/wait.h>
  9616. +#include <linux/spinlock.h>
  9617. +#include <linux/rwsem.h>
  9618. +
  9619. +#include <asm/system.h>
  9620. +#include <asm/atomic.h>
  9621. +
  9622. +struct semaphore {
  9623. + atomic_t count;
  9624. + atomic_t waking;
  9625. + wait_queue_head_t wait;
  9626. +};
  9627. +
  9628. +#define __SEMAPHORE_INITIALIZER(name, n) \
  9629. +{ \
  9630. + .count = ATOMIC_INIT(n), \
  9631. + .waking = ATOMIC_INIT(0), \
  9632. + .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \
  9633. +}
  9634. +
  9635. +#define __MUTEX_INITIALIZER(name) \
  9636. + __SEMAPHORE_INITIALIZER(name,1)
  9637. +
  9638. +#define __DECLARE_SEMAPHORE_GENERIC(name,count) \
  9639. + struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
  9640. +
  9641. +#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
  9642. +#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
  9643. +
  9644. +extern inline void sema_init (struct semaphore *sem, int val)
  9645. +{
  9646. + *sem = (struct semaphore)__SEMAPHORE_INITIALIZER(*sem, val);
  9647. +}
  9648. +
  9649. +static inline void init_MUTEX (struct semaphore *sem)
  9650. +{
  9651. + sema_init(sem, 1);
  9652. +}
  9653. +
  9654. +static inline void init_MUTEX_LOCKED (struct semaphore *sem)
  9655. +{
  9656. + sema_init(sem, 0);
  9657. +}
  9658. +
  9659. +asmlinkage void __down(struct semaphore * sem);
  9660. +asmlinkage int __down_interruptible(struct semaphore * sem);
  9661. +asmlinkage int __down_trylock(struct semaphore * sem);
  9662. +asmlinkage void __up(struct semaphore * sem);
  9663. +
  9664. +asmlinkage void __down_failed(void /* special register calling convention */);
  9665. +asmlinkage int __down_failed_interruptible(void /* params in registers */);
  9666. +asmlinkage int __down_failed_trylock(void /* params in registers */);
  9667. +asmlinkage void __up_wakeup(void /* special register calling convention */);
  9668. +
  9669. +extern spinlock_t semaphore_wake_lock;
  9670. +
  9671. +/*
  9672. + * This is ugly, but we want the default case to fall through.
  9673. + * "down_failed" is a special asm handler that calls the C
  9674. + * routine that actually waits.
  9675. + */
  9676. +extern inline void down(struct semaphore * sem)
  9677. +{
  9678. + might_sleep();
  9679. +
  9680. + #if 0
  9681. + ...Nios2 has no atomic "decrement memory"....
  9682. + #else
  9683. + if (atomic_dec_return(&sem->count) < 0)
  9684. + __down(sem);
  9685. + #endif
  9686. +}
  9687. +
  9688. +extern inline int down_interruptible(struct semaphore * sem)
  9689. +{
  9690. + int ret = 0;
  9691. +
  9692. +
  9693. + might_sleep();
  9694. +
  9695. + #if 0
  9696. + ...Nios2 has no atomic "decrement memory"....
  9697. + #else
  9698. + if(atomic_dec_return(&sem->count) < 0)
  9699. + ret = __down_interruptible(sem);
  9700. + return ret;
  9701. + #endif
  9702. +}
  9703. +
  9704. +extern inline int down_trylock(struct semaphore * sem)
  9705. +{
  9706. + #if 0
  9707. + ...Nios2 has no atomic "decrement memory"....
  9708. + #else
  9709. + int ret = 0;
  9710. +
  9711. + if (atomic_dec_return (&sem->count) < 0)
  9712. + ret = __down_trylock(sem);
  9713. + return ret;
  9714. + #endif
  9715. +}
  9716. +
  9717. +/*
  9718. + * Note! This is subtle. We jump to wake people up only if
  9719. + * the semaphore was negative (== somebody was waiting on it).
  9720. + * The default case (no contention) will result in NO
  9721. + * jumps for both down() and up().
  9722. + */
  9723. +extern inline void up(struct semaphore * sem)
  9724. +{
  9725. + #if 0
  9726. + ...Nios2 has no atomic "increment memory"....
  9727. + #else
  9728. + if (atomic_inc_return(&sem->count) <= 0)
  9729. + __up(sem);
  9730. + #endif
  9731. +}
  9732. +
  9733. +#endif /* __ASSEMBLY__ */
  9734. +
  9735. +#endif
  9736. --- linux/include/asm-nios2nommu/sembuf.h
  9737. +++ linux/include/asm-nios2nommu/sembuf.h
  9738. @@ -0,0 +1,48 @@
  9739. +#ifndef _NIOS_SEMBUF_H
  9740. +#define _NIOS_SEMBUF_H
  9741. +
  9742. +/*--------------------------------------------------------------------
  9743. + *
  9744. + * include/asm-nios2nommu/sembuf.h
  9745. + *
  9746. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  9747. + *
  9748. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9749. + *
  9750. + * This program is free software; you can redistribute it and/or modify
  9751. + * it under the terms of the GNU General Public License as published by
  9752. + * the Free Software Foundation; either version 2 of the License, or
  9753. + * (at your option) any later version.
  9754. + *
  9755. + * This program is distributed in the hope that it will be useful,
  9756. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9757. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9758. + * GNU General Public License for more details.
  9759. + *
  9760. + *
  9761. + * Jan/20/2004 dgt NiosII
  9762. + *
  9763. + ---------------------------------------------------------------------*/
  9764. +
  9765. +
  9766. +/*
  9767. + * Note extra padding because this structure is passed back and forth
  9768. + * between kernel and user space.
  9769. + *
  9770. + * Pad space is left for:
  9771. + * - 64-bit time_t to solve y2038 problem
  9772. + * - 2 miscellaneous 32-bit values
  9773. + */
  9774. +
  9775. +struct semid64_ds {
  9776. + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
  9777. + __kernel_time_t sem_otime; /* last semop time */
  9778. + unsigned long __unused1;
  9779. + __kernel_time_t sem_ctime; /* last change time */
  9780. + unsigned long __unused2;
  9781. + unsigned long sem_nsems; /* no. of semaphores in array */
  9782. + unsigned long __unused3;
  9783. + unsigned long __unused4;
  9784. +};
  9785. +
  9786. +#endif /* _NIOS_SEMBUF_H */
  9787. --- linux/include/asm-nios2nommu/setup.h
  9788. +++ linux/include/asm-nios2nommu/setup.h
  9789. @@ -0,0 +1,31 @@
  9790. +/* Copied from i386 port.
  9791. + * Just a place holder. We don't want to have to test x86 before
  9792. + * we include stuff
  9793. + *
  9794. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  9795. + *
  9796. + * All rights reserved.
  9797. + *
  9798. + * This program is free software; you can redistribute it and/or modify
  9799. + * it under the terms of the GNU General Public License as published by
  9800. + * the Free Software Foundation; either version 2 of the License, or
  9801. + * (at your option) any later version.
  9802. + *
  9803. + * This program is distributed in the hope that it will be useful, but
  9804. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  9805. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  9806. + * NON INFRINGEMENT. See the GNU General Public License for more
  9807. + * details.
  9808. + *
  9809. + * You should have received a copy of the GNU General Public License
  9810. + * along with this program; if not, write to the Free Software
  9811. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  9812. + *
  9813. + */
  9814. +
  9815. +#ifndef _NIOS2_SETUP_H
  9816. +#define _NIOS2_SETUP_H
  9817. +
  9818. +#define COMMAND_LINE_SIZE 512
  9819. +
  9820. +#endif /* _NIOS2_SETUP_H */
  9821. --- linux/include/asm-nios2nommu/shmbuf.h
  9822. +++ linux/include/asm-nios2nommu/shmbuf.h
  9823. @@ -0,0 +1,64 @@
  9824. +#ifndef _NIOS_SHMBUF_H
  9825. +#define _NIOS_SHMBUF_H
  9826. +
  9827. +/*--------------------------------------------------------------------
  9828. + *
  9829. + * include/asm-nios2nommu/shmbuf.h
  9830. + *
  9831. + * Derived from m68knommu
  9832. + *
  9833. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9834. + *
  9835. + * This program is free software; you can redistribute it and/or modify
  9836. + * it under the terms of the GNU General Public License as published by
  9837. + * the Free Software Foundation; either version 2 of the License, or
  9838. + * (at your option) any later version.
  9839. + *
  9840. + * This program is distributed in the hope that it will be useful,
  9841. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9842. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9843. + * GNU General Public License for more details.
  9844. + *
  9845. + *
  9846. + * Jan/20/2004 dgt NiosII
  9847. + *
  9848. + ---------------------------------------------------------------------*/
  9849. +
  9850. +
  9851. +/* Note extra padding because this structure is passed back and forth
  9852. + * between kernel and user space.
  9853. + *
  9854. + * Pad space is left for:
  9855. + * - 64-bit time_t to solve y2038 problem
  9856. + * - 2 miscellaneous 32-bit values
  9857. + */
  9858. +
  9859. +struct shmid64_ds {
  9860. + struct ipc64_perm shm_perm; /* operation perms */
  9861. + size_t shm_segsz; /* size of segment (bytes) */
  9862. + __kernel_time_t shm_atime; /* last attach time */
  9863. + unsigned long __unused1;
  9864. + __kernel_time_t shm_dtime; /* last detach time */
  9865. + unsigned long __unused2;
  9866. + __kernel_time_t shm_ctime; /* last change time */
  9867. + unsigned long __unused3;
  9868. + __kernel_pid_t shm_cpid; /* pid of creator */
  9869. + __kernel_pid_t shm_lpid; /* pid of last operator */
  9870. + unsigned long shm_nattch; /* no. of current attaches */
  9871. + unsigned long __unused4;
  9872. + unsigned long __unused5;
  9873. +};
  9874. +
  9875. +struct shminfo64 {
  9876. + unsigned long shmmax;
  9877. + unsigned long shmmin;
  9878. + unsigned long shmmni;
  9879. + unsigned long shmseg;
  9880. + unsigned long shmall;
  9881. + unsigned long __unused1;
  9882. + unsigned long __unused2;
  9883. + unsigned long __unused3;
  9884. + unsigned long __unused4;
  9885. +};
  9886. +
  9887. +#endif /* _NIOS_SHMBUF_H */
  9888. --- linux/include/asm-nios2nommu/shmparam.h
  9889. +++ linux/include/asm-nios2nommu/shmparam.h
  9890. @@ -0,0 +1,30 @@
  9891. +#ifndef __NIOS2NOMMU_SHMPARAM_H__
  9892. +#define __NIOS2NOMMU_SHMPARAM_H__
  9893. +
  9894. +/*--------------------------------------------------------------------
  9895. + *
  9896. + * include/asm-nios2nommu/shmparam.h
  9897. + *
  9898. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  9899. + *
  9900. + * Copyright (C) 2004 Microtronix Datacom Ltd
  9901. + *
  9902. + * This program is free software; you can redistribute it and/or modify
  9903. + * it under the terms of the GNU General Public License as published by
  9904. + * the Free Software Foundation; either version 2 of the License, or
  9905. + * (at your option) any later version.
  9906. + *
  9907. + * This program is distributed in the hope that it will be useful,
  9908. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9909. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9910. + * GNU General Public License for more details.
  9911. + *
  9912. + *
  9913. + * Jan/20/2004 dgt NiosII
  9914. + *
  9915. + ---------------------------------------------------------------------*/
  9916. +
  9917. +
  9918. +#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
  9919. +
  9920. +#endif /* __NIOS2NOMMU_SHMPARAM_H__ */
  9921. --- linux/include/asm-nios2nommu/sigcontext.h
  9922. +++ linux/include/asm-nios2nommu/sigcontext.h
  9923. @@ -0,0 +1,35 @@
  9924. +/*
  9925. + * Taken from the m68knommu.
  9926. + *
  9927. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  9928. + *
  9929. + * All rights reserved.
  9930. + *
  9931. + * This program is free software; you can redistribute it and/or modify
  9932. + * it under the terms of the GNU General Public License as published by
  9933. + * the Free Software Foundation; either version 2 of the License, or
  9934. + * (at your option) any later version.
  9935. + *
  9936. + * This program is distributed in the hope that it will be useful, but
  9937. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  9938. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  9939. + * NON INFRINGEMENT. See the GNU General Public License for more
  9940. + * details.
  9941. + *
  9942. + * You should have received a copy of the GNU General Public License
  9943. + * along with this program; if not, write to the Free Software
  9944. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  9945. + *
  9946. + */
  9947. +
  9948. +#ifndef _ASM_NIOS2NOMMU_SIGCONTEXT_H
  9949. +#define _ASM_NIOS2NOMMU_SIGCONTEXT_H
  9950. +
  9951. +#include <asm/ptrace.h>
  9952. +
  9953. +struct sigcontext {
  9954. + struct pt_regs regs;
  9955. + unsigned long sc_mask; /* old sigmask */
  9956. +};
  9957. +
  9958. +#endif
  9959. --- linux/include/asm-nios2nommu/siginfo.h
  9960. +++ linux/include/asm-nios2nommu/siginfo.h
  9961. @@ -0,0 +1,28 @@
  9962. +/*
  9963. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  9964. + *
  9965. + * All rights reserved.
  9966. + *
  9967. + * This program is free software; you can redistribute it and/or modify
  9968. + * it under the terms of the GNU General Public License as published by
  9969. + * the Free Software Foundation; either version 2 of the License, or
  9970. + * (at your option) any later version.
  9971. + *
  9972. + * This program is distributed in the hope that it will be useful, but
  9973. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  9974. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  9975. + * NON INFRINGEMENT. See the GNU General Public License for more
  9976. + * details.
  9977. + *
  9978. + * You should have received a copy of the GNU General Public License
  9979. + * along with this program; if not, write to the Free Software
  9980. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  9981. + *
  9982. + */
  9983. +
  9984. +#ifndef _NIOS2NOMMU_SIGINFO_H
  9985. +#define _NIOS2NOMMU_SIGINFO_H
  9986. +
  9987. +#include <asm-generic/siginfo.h>
  9988. +
  9989. +#endif
  9990. --- linux/include/asm-nios2nommu/signal.h
  9991. +++ linux/include/asm-nios2nommu/signal.h
  9992. @@ -0,0 +1,207 @@
  9993. +/*
  9994. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  9995. + *
  9996. + * All rights reserved.
  9997. + *
  9998. + * This program is free software; you can redistribute it and/or modify
  9999. + * it under the terms of the GNU General Public License as published by
  10000. + * the Free Software Foundation; either version 2 of the License, or
  10001. + * (at your option) any later version.
  10002. + *
  10003. + * This program is distributed in the hope that it will be useful, but
  10004. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  10005. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  10006. + * NON INFRINGEMENT. See the GNU General Public License for more
  10007. + * details.
  10008. + *
  10009. + * You should have received a copy of the GNU General Public License
  10010. + * along with this program; if not, write to the Free Software
  10011. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  10012. + *
  10013. + */
  10014. +
  10015. +#ifndef _NIOS2_SIGNAL_H
  10016. +#define _NIOS2_SIGNAL_H
  10017. +
  10018. +#include <linux/types.h>
  10019. +
  10020. +/* Avoid too many header ordering problems. */
  10021. +struct siginfo;
  10022. +
  10023. +#ifdef __KERNEL__
  10024. +/* Most things should be clean enough to redefine this at will, if care
  10025. + is taken to make libc match. */
  10026. +
  10027. +#define _NSIG 64
  10028. +#define _NSIG_BPW 32
  10029. +#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
  10030. +
  10031. +typedef unsigned long old_sigset_t; /* at least 32 bits */
  10032. +
  10033. +typedef struct {
  10034. + unsigned long sig[_NSIG_WORDS];
  10035. +} sigset_t;
  10036. +
  10037. +#else
  10038. +/* Here we must cater to libcs that poke about in kernel headers. */
  10039. +
  10040. +#define NSIG 32
  10041. +typedef unsigned long sigset_t;
  10042. +
  10043. +#endif /* __KERNEL__ */
  10044. +
  10045. +#define SIGHUP 1
  10046. +#define SIGINT 2
  10047. +#define SIGQUIT 3
  10048. +#define SIGILL 4
  10049. +#define SIGTRAP 5
  10050. +#define SIGABRT 6
  10051. +#define SIGIOT 6
  10052. +#define SIGBUS 7
  10053. +#define SIGFPE 8
  10054. +#define SIGKILL 9
  10055. +#define SIGUSR1 10
  10056. +#define SIGSEGV 11
  10057. +#define SIGUSR2 12
  10058. +#define SIGPIPE 13
  10059. +#define SIGALRM 14
  10060. +#define SIGTERM 15
  10061. +#define SIGSTKFLT 16
  10062. +#define SIGCHLD 17
  10063. +#define SIGCONT 18
  10064. +#define SIGSTOP 19
  10065. +#define SIGTSTP 20
  10066. +#define SIGTTIN 21
  10067. +#define SIGTTOU 22
  10068. +#define SIGURG 23
  10069. +#define SIGXCPU 24
  10070. +#define SIGXFSZ 25
  10071. +#define SIGVTALRM 26
  10072. +#define SIGPROF 27
  10073. +#define SIGWINCH 28
  10074. +#define SIGIO 29
  10075. +#define SIGPOLL SIGIO
  10076. +/*
  10077. +#define SIGLOST 29
  10078. +*/
  10079. +#define SIGPWR 30
  10080. +#define SIGSYS 31
  10081. +#define SIGUNUSED 31
  10082. +
  10083. +/* These should not be considered constants from userland. */
  10084. +#define SIGRTMIN 32
  10085. +#define SIGRTMAX _NSIG-1
  10086. +
  10087. +/*
  10088. + * SA_FLAGS values:
  10089. + *
  10090. + * SA_ONSTACK indicates that a registered stack_t will be used.
  10091. + * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
  10092. + * SA_RESTART flag to get restarting signals (which were the default long ago)
  10093. + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
  10094. + * SA_RESETHAND clears the handler when the signal is delivered.
  10095. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
  10096. + * SA_NODEFER prevents the current signal from being masked in the handler.
  10097. + *
  10098. + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
  10099. + * Unix names RESETHAND and NODEFER respectively.
  10100. + */
  10101. +#define SA_NOCLDSTOP 0x00000001
  10102. +#define SA_NOCLDWAIT 0x00000002 /* not supported yet */
  10103. +#define SA_SIGINFO 0x00000004
  10104. +#define SA_ONSTACK 0x08000000
  10105. +#define SA_RESTART 0x10000000
  10106. +#define SA_NODEFER 0x40000000
  10107. +#define SA_RESETHAND 0x80000000
  10108. +
  10109. +#define SA_NOMASK SA_NODEFER
  10110. +#define SA_ONESHOT SA_RESETHAND
  10111. +#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
  10112. +
  10113. +#define SA_RESTORER 0x04000000
  10114. +
  10115. +/*
  10116. + * sigaltstack controls
  10117. + */
  10118. +#define SS_ONSTACK 1
  10119. +#define SS_DISABLE 2
  10120. +
  10121. +#define MINSIGSTKSZ 2048
  10122. +#define SIGSTKSZ 8192
  10123. +
  10124. +#ifdef __KERNEL__
  10125. +/*
  10126. + * These values of sa_flags are used only by the kernel as part of the
  10127. + * irq handling routines.
  10128. + *
  10129. + * SA_INTERRUPT is also used by the irq handling routines.
  10130. + * SA_SHIRQ is for shared interrupt support on PCI and EISA.
  10131. + */
  10132. +#define SA_PROBE SA_ONESHOT
  10133. +#define SA_SAMPLE_RANDOM SA_RESTART
  10134. +#define SA_SHIRQ 0x04000000
  10135. +#endif
  10136. +
  10137. +#define SIG_BLOCK 0 /* for blocking signals */
  10138. +#define SIG_UNBLOCK 1 /* for unblocking signals */
  10139. +#define SIG_SETMASK 2 /* for setting the signal mask */
  10140. +
  10141. +/* Type of a signal handler. */
  10142. +typedef void (*__sighandler_t)(int);
  10143. +
  10144. +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
  10145. +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
  10146. +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
  10147. +
  10148. +#ifdef __KERNEL__
  10149. +struct old_sigaction {
  10150. + __sighandler_t sa_handler;
  10151. + old_sigset_t sa_mask;
  10152. + unsigned long sa_flags;
  10153. + void (*sa_restorer)(void);
  10154. +};
  10155. +
  10156. +struct sigaction {
  10157. + __sighandler_t sa_handler;
  10158. + unsigned long sa_flags;
  10159. + void (*sa_restorer)(void);
  10160. + sigset_t sa_mask; /* mask last for extensibility */
  10161. +};
  10162. +
  10163. +struct k_sigaction {
  10164. + struct sigaction sa;
  10165. +};
  10166. +#else
  10167. +/* Here we must cater to libcs that poke about in kernel headers. */
  10168. +
  10169. +struct sigaction {
  10170. + union {
  10171. + __sighandler_t _sa_handler;
  10172. + void (*_sa_sigaction)(int, struct siginfo *, void *);
  10173. + } _u;
  10174. + sigset_t sa_mask;
  10175. + unsigned long sa_flags;
  10176. + void (*sa_restorer)(void);
  10177. +};
  10178. +
  10179. +#define sa_handler _u._sa_handler
  10180. +#define sa_sigaction _u._sa_sigaction
  10181. +
  10182. +#endif /* __KERNEL__ */
  10183. +
  10184. +typedef struct sigaltstack {
  10185. + void *ss_sp;
  10186. + int ss_flags;
  10187. + size_t ss_size;
  10188. +} stack_t;
  10189. +
  10190. +#ifdef __KERNEL__
  10191. +
  10192. +#include <asm/sigcontext.h>
  10193. +#undef __HAVE_ARCH_SIG_BITOPS
  10194. +
  10195. +#define ptrace_signal_deliver(regs, cookie) do { } while (0)
  10196. +
  10197. +#endif /* __KERNEL__ */
  10198. +
  10199. +#endif /* _NIOS2_SIGNAL_H */
  10200. --- linux/include/asm-nios2nommu/smp.h
  10201. +++ linux/include/asm-nios2nommu/smp.h
  10202. @@ -0,0 +1,34 @@
  10203. +#ifndef __ASM_SMP_H
  10204. +#define __ASM_SMP_H
  10205. +
  10206. +/*--------------------------------------------------------------------
  10207. + *
  10208. + * include/asm-nios2nommu/smp.h
  10209. + *
  10210. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10211. + *
  10212. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10213. + *
  10214. + * This program is free software; you can redistribute it and/or modify
  10215. + * it under the terms of the GNU General Public License as published by
  10216. + * the Free Software Foundation; either version 2 of the License, or
  10217. + * (at your option) any later version.
  10218. + *
  10219. + * This program is distributed in the hope that it will be useful,
  10220. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10221. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10222. + * GNU General Public License for more details.
  10223. + *
  10224. + *
  10225. + * Jan/20/2004 dgt NiosII
  10226. + *
  10227. + ---------------------------------------------------------------------*/
  10228. +
  10229. +
  10230. +// #include <linux/config.h>
  10231. +
  10232. +#ifdef CONFIG_SMP
  10233. +#error SMP not supported
  10234. +#endif
  10235. +
  10236. +#endif
  10237. --- linux/include/asm-nios2nommu/socket.h
  10238. +++ linux/include/asm-nios2nommu/socket.h
  10239. @@ -0,0 +1,74 @@
  10240. +#ifndef _ASM_SOCKET_H
  10241. +#define _ASM_SOCKET_H
  10242. +
  10243. +/*--------------------------------------------------------------------
  10244. + *
  10245. + * include/asm-nios2nommu/socket.h
  10246. + *
  10247. + * Derived from m68knommu
  10248. + *
  10249. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10250. + *
  10251. + * This program is free software; you can redistribute it and/or modify
  10252. + * it under the terms of the GNU General Public License as published by
  10253. + * the Free Software Foundation; either version 2 of the License, or
  10254. + * (at your option) any later version.
  10255. + *
  10256. + * This program is distributed in the hope that it will be useful,
  10257. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10258. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10259. + * GNU General Public License for more details.
  10260. + *
  10261. + *
  10262. + * Jan/20/2004 dgt NiosII
  10263. + *
  10264. + ---------------------------------------------------------------------*/
  10265. +
  10266. +
  10267. +#include <asm/sockios.h>
  10268. +
  10269. +/* For setsockopt(2) */
  10270. +#define SOL_SOCKET 1
  10271. +
  10272. +#define SO_DEBUG 1
  10273. +#define SO_REUSEADDR 2
  10274. +#define SO_TYPE 3
  10275. +#define SO_ERROR 4
  10276. +#define SO_DONTROUTE 5
  10277. +#define SO_BROADCAST 6
  10278. +#define SO_SNDBUF 7
  10279. +#define SO_RCVBUF 8
  10280. +#define SO_KEEPALIVE 9
  10281. +#define SO_OOBINLINE 10
  10282. +#define SO_NO_CHECK 11
  10283. +#define SO_PRIORITY 12
  10284. +#define SO_LINGER 13
  10285. +#define SO_BSDCOMPAT 14
  10286. +/* To add :#define SO_REUSEPORT 15 */
  10287. +#define SO_PASSCRED 16
  10288. +#define SO_PEERCRED 17
  10289. +#define SO_RCVLOWAT 18
  10290. +#define SO_SNDLOWAT 19
  10291. +#define SO_RCVTIMEO 20
  10292. +#define SO_SNDTIMEO 21
  10293. +
  10294. +/* Security levels - as per NRL IPv6 - don't actually do anything */
  10295. +#define SO_SECURITY_AUTHENTICATION 22
  10296. +#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
  10297. +#define SO_SECURITY_ENCRYPTION_NETWORK 24
  10298. +
  10299. +#define SO_BINDTODEVICE 25
  10300. +
  10301. +/* Socket filtering */
  10302. +#define SO_ATTACH_FILTER 26
  10303. +#define SO_DETACH_FILTER 27
  10304. +
  10305. +#define SO_PEERNAME 28
  10306. +#define SO_TIMESTAMP 29
  10307. +#define SCM_TIMESTAMP SO_TIMESTAMP
  10308. +
  10309. +#define SO_ACCEPTCONN 30
  10310. +
  10311. +#define SO_PEERSEC 31 /* ;dgt2;tmp; */
  10312. +
  10313. +#endif /* _ASM_SOCKET_H */
  10314. --- linux/include/asm-nios2nommu/sockios.h
  10315. +++ linux/include/asm-nios2nommu/sockios.h
  10316. @@ -0,0 +1,38 @@
  10317. +#ifndef _ASM_NIOS_SOCKIOS_H
  10318. +#define _ASM_NIOS_SOCKIOS_H
  10319. +
  10320. +/*--------------------------------------------------------------------
  10321. + *
  10322. + * include/asm-nios2nommu/sockios.h
  10323. + *
  10324. + * Socket-level I/O control calls.
  10325. + *
  10326. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10327. + *
  10328. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10329. + *
  10330. + * This program is free software; you can redistribute it and/or modify
  10331. + * it under the terms of the GNU General Public License as published by
  10332. + * the Free Software Foundation; either version 2 of the License, or
  10333. + * (at your option) any later version.
  10334. + *
  10335. + * This program is distributed in the hope that it will be useful,
  10336. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10337. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10338. + * GNU General Public License for more details.
  10339. + *
  10340. + *
  10341. + * Jan/20/2004 dgt NiosII
  10342. + *
  10343. + ---------------------------------------------------------------------*/
  10344. +
  10345. +
  10346. +#define FIOSETOWN 0x8901
  10347. +#define SIOCSPGRP 0x8902
  10348. +#define FIOGETOWN 0x8903
  10349. +#define SIOCGPGRP 0x8904
  10350. +#define SIOCATMARK 0x8905
  10351. +#define SIOCGSTAMP 0x8906 /* Get stamp */
  10352. +
  10353. +#endif /* !(_ASM_NIOS_SOCKIOS_H) */
  10354. +
  10355. --- linux/include/asm-nios2nommu/spi.h
  10356. +++ linux/include/asm-nios2nommu/spi.h
  10357. @@ -0,0 +1,92 @@
  10358. +#ifndef _ASM_SPI_H_
  10359. +#define _ASM_SPI_H_ 1
  10360. +
  10361. +/*--------------------------------------------------------------------
  10362. + *
  10363. + * include/asm-nios2nommu/spi.h
  10364. + *
  10365. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10366. + *
  10367. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10368. + *
  10369. + * This program is free software; you can redistribute it and/or modify
  10370. + * it under the terms of the GNU General Public License as published by
  10371. + * the Free Software Foundation; either version 2 of the License, or
  10372. + * (at your option) any later version.
  10373. + *
  10374. + * This program is distributed in the hope that it will be useful,
  10375. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10376. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10377. + * GNU General Public License for more details.
  10378. + *
  10379. + *
  10380. + * Jan/20/2004 dgt NiosII
  10381. + *
  10382. + ---------------------------------------------------------------------*/
  10383. +
  10384. +
  10385. +#include <asm/nios.h>
  10386. +
  10387. +int register_NIOS_SPI( void );
  10388. +void unregister_NIOS_SPI( void );
  10389. +
  10390. +#if defined(MODULE)
  10391. +void cleanup_module( void );
  10392. +int init_module( void );
  10393. +#endif
  10394. +
  10395. +#if defined(__KERNEL__)
  10396. +int spi_reset ( void );
  10397. +#endif
  10398. +
  10399. +
  10400. +#define clockCS 0x01
  10401. +#define temperatureCS 0x02
  10402. +
  10403. +#define clock_read_base 0x00
  10404. +#define clock_write_base 0x80
  10405. +#define clock_read_control 0x0F
  10406. +#define clock_read_trickle 0x11
  10407. +
  10408. +#define clock_read_sec 0x00
  10409. +#define clock_read_min 0x01
  10410. +#define clock_read_hour 0x02
  10411. +#define clock_read_day 0x03
  10412. +#define clock_read_date 0x04
  10413. +#define clock_read_month 0x05
  10414. +#define clock_read_year 0x06
  10415. +
  10416. +#define clock_write_control 0x8F
  10417. +#define clock_write_trickle 0x91
  10418. +#define clock_write_sec 0x80
  10419. +#define clock_write_min 0x81
  10420. +#define clock_write_hour 0x82
  10421. +#define clock_write_day 0x83
  10422. +#define clock_write_date 0x84
  10423. +#define clock_write_month 0x85
  10424. +#define clock_write_year 0x86
  10425. +
  10426. +#define clock_write_ram_start 0xA0
  10427. +#define clock_write_ram_end 0x100
  10428. +#define clock_read_ram_start 0x20
  10429. +#define clock_read_ram_end 0x80
  10430. +
  10431. +
  10432. +#define clock_sec_def 0x11
  10433. +#define clock_min_def 0x59
  10434. +#define clock_hour_def 0x71
  10435. +#define clock_day_def 0x00
  10436. +#define clock_date_def 0x20
  10437. +#define clock_month_def 0x12
  10438. +#define clock_year_def 0x34
  10439. +
  10440. +#define temp_read_base 0x00
  10441. +#define temp_write_base 0x80
  10442. +#define temp_read_control 0x00
  10443. +#define temp_write_control 0x80
  10444. +#define temp_read_msb 0x02
  10445. +#define temp_read_lsb 0x01
  10446. +
  10447. +#define MAX_TEMP_VAR 10
  10448. +
  10449. +#endif /*_ASM_SPI_H_*/
  10450. --- linux/include/asm-nios2nommu/spinlock.h
  10451. +++ linux/include/asm-nios2nommu/spinlock.h
  10452. @@ -0,0 +1,30 @@
  10453. +#ifndef __NIOS_SPINLOCK_H
  10454. +#define __NIOS_SPINLOCK_H
  10455. +
  10456. +/*--------------------------------------------------------------------
  10457. + *
  10458. + * include/asm-nios2nommu/spinlock.h
  10459. + *
  10460. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10461. + *
  10462. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10463. + *
  10464. + * This program is free software; you can redistribute it and/or modify
  10465. + * it under the terms of the GNU General Public License as published by
  10466. + * the Free Software Foundation; either version 2 of the License, or
  10467. + * (at your option) any later version.
  10468. + *
  10469. + * This program is distributed in the hope that it will be useful,
  10470. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10471. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10472. + * GNU General Public License for more details.
  10473. + *
  10474. + *
  10475. + * Jan/20/2004 dgt NiosII
  10476. + *
  10477. + ---------------------------------------------------------------------*/
  10478. +
  10479. +
  10480. +#error "Nios doesn't do SMP yet"
  10481. +
  10482. +#endif
  10483. --- linux/include/asm-nios2nommu/stat.h
  10484. +++ linux/include/asm-nios2nommu/stat.h
  10485. @@ -0,0 +1,102 @@
  10486. +#ifndef _ASMNIOS2NOMMU_STAT_H
  10487. +#define _ASMNIOS2NOMMU_STAT_H
  10488. +
  10489. +/*--------------------------------------------------------------------
  10490. + *
  10491. + * include/asm-nios2nommu/stat.h
  10492. + *
  10493. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10494. + *
  10495. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10496. + *
  10497. + * This program is free software; you can redistribute it and/or modify
  10498. + * it under the terms of the GNU General Public License as published by
  10499. + * the Free Software Foundation; either version 2 of the License, or
  10500. + * (at your option) any later version.
  10501. + *
  10502. + * This program is distributed in the hope that it will be useful,
  10503. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10504. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10505. + * GNU General Public License for more details.
  10506. + *
  10507. + *
  10508. + * Jan/20/2004 dgt NiosII
  10509. + *
  10510. + ---------------------------------------------------------------------*/
  10511. +
  10512. +
  10513. +struct __old_kernel_stat {
  10514. + unsigned short st_dev;
  10515. + unsigned short st_ino;
  10516. + unsigned short st_mode;
  10517. + unsigned short st_nlink;
  10518. + unsigned short st_uid;
  10519. + unsigned short st_gid;
  10520. + unsigned short st_rdev;
  10521. + unsigned long st_size;
  10522. + unsigned long st_atime;
  10523. + unsigned long st_mtime;
  10524. + unsigned long st_ctime;
  10525. +};
  10526. +
  10527. +struct stat {
  10528. + unsigned short st_dev;
  10529. + unsigned short __pad1;
  10530. + unsigned long st_ino;
  10531. + unsigned short st_mode;
  10532. + unsigned short st_nlink;
  10533. + unsigned short st_uid;
  10534. + unsigned short st_gid;
  10535. + unsigned short st_rdev;
  10536. + unsigned short __pad2;
  10537. + unsigned long st_size;
  10538. + unsigned long st_blksize;
  10539. + unsigned long st_blocks;
  10540. + unsigned long st_atime;
  10541. + unsigned long __unused1;
  10542. + unsigned long st_mtime;
  10543. + unsigned long __unused2;
  10544. + unsigned long st_ctime;
  10545. + unsigned long __unused3;
  10546. + unsigned long __unused4;
  10547. + unsigned long __unused5;
  10548. +};
  10549. +
  10550. +/* This matches struct stat64 in glibc2.1, hence the absolutely
  10551. + * insane amounts of padding around dev_t's.
  10552. + */
  10553. +struct stat64 {
  10554. + unsigned long long st_dev;
  10555. + unsigned char __pad1[4];
  10556. +
  10557. +#define STAT64_HAS_BROKEN_ST_INO 1
  10558. + unsigned long __st_ino;
  10559. +
  10560. + unsigned int st_mode;
  10561. + unsigned int st_nlink;
  10562. +
  10563. + unsigned long st_uid;
  10564. + unsigned long st_gid;
  10565. +
  10566. + unsigned long long st_rdev;
  10567. + unsigned char __pad3[4];
  10568. +
  10569. + long long st_size;
  10570. + unsigned long st_blksize;
  10571. +
  10572. + unsigned long __pad4; /* future possible st_blocks high bits */
  10573. + unsigned long st_blocks; /* Number 512-byte blocks allocated. */
  10574. +
  10575. + unsigned long st_atime;
  10576. + unsigned long st_atime_nsec;
  10577. +
  10578. + unsigned long st_mtime;
  10579. + unsigned long st_mtime_nsec;
  10580. +
  10581. + unsigned long st_ctime;
  10582. + unsigned long st_ctime_nsec;
  10583. +
  10584. + unsigned long long st_ino;
  10585. +};
  10586. +
  10587. +#endif
  10588. --- linux/include/asm-nios2nommu/statfs.h
  10589. +++ linux/include/asm-nios2nommu/statfs.h
  10590. @@ -0,0 +1,30 @@
  10591. +#ifndef _NIOS2NOMMU_STATFS_H
  10592. +#define _NIOS2NOMMU_STATFS_H
  10593. +
  10594. +/*--------------------------------------------------------------------
  10595. + *
  10596. + * include/asm-nios2nommu/statfs.h
  10597. + *
  10598. + * Derived from M68knommu
  10599. + *
  10600. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10601. + *
  10602. + * This program is free software; you can redistribute it and/or modify
  10603. + * it under the terms of the GNU General Public License as published by
  10604. + * the Free Software Foundation; either version 2 of the License, or
  10605. + * (at your option) any later version.
  10606. + *
  10607. + * This program is distributed in the hope that it will be useful,
  10608. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10609. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10610. + * GNU General Public License for more details.
  10611. + *
  10612. + *
  10613. + * Jan/20/2004 dgt NiosII
  10614. + *
  10615. + ---------------------------------------------------------------------*/
  10616. +
  10617. +
  10618. +#include <asm-generic/statfs.h>
  10619. +
  10620. +#endif /* _NIOS2NOMMU_STATFS_H */
  10621. --- linux/include/asm-nios2nommu/string.h
  10622. +++ linux/include/asm-nios2nommu/string.h
  10623. @@ -0,0 +1,45 @@
  10624. +#ifndef __NIOS_STRING_H__
  10625. +#define __NIOS_STRING_H__
  10626. +
  10627. +/*--------------------------------------------------------------------
  10628. + *
  10629. + * include/asm-nios2nommu/string.h
  10630. + *
  10631. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10632. + *
  10633. + * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  10634. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10635. + *
  10636. + * This program is free software; you can redistribute it and/or modify
  10637. + * it under the terms of the GNU General Public License as published by
  10638. + * the Free Software Foundation; either version 2 of the License, or
  10639. + * (at your option) any later version.
  10640. + *
  10641. + * This program is distributed in the hope that it will be useful,
  10642. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10643. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10644. + * GNU General Public License for more details.
  10645. + *
  10646. + *
  10647. + * Jan/20/2004 dgt NiosII
  10648. + *
  10649. + ---------------------------------------------------------------------*/
  10650. +
  10651. +
  10652. +#ifdef __KERNEL__ /* only set these up for kernel code */
  10653. +
  10654. +#define __HAVE_ARCH_MEMMOVE
  10655. +void * memmove(void * d, const void * s, size_t count);
  10656. +#define __HAVE_ARCH_MEMCPY
  10657. +extern void * memcpy(void *d, const void *s, size_t count);
  10658. +#define __HAVE_ARCH_MEMSET
  10659. +extern void * memset(void * s,int c,size_t count);
  10660. +
  10661. +#if 0
  10662. +#define __HAVE_ARCH_BCOPY
  10663. +#define __HAVE_ARCH_STRLEN
  10664. +#endif
  10665. +
  10666. +#endif /* KERNEL */
  10667. +
  10668. +#endif /* !(__NIOS_STRING_H__) */
  10669. --- linux/include/asm-nios2nommu/system.h
  10670. +++ linux/include/asm-nios2nommu/system.h
  10671. @@ -0,0 +1,172 @@
  10672. +/*
  10673. + * Taken from the m68k.
  10674. + *
  10675. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  10676. + *
  10677. + * All rights reserved.
  10678. + *
  10679. + * This program is free software; you can redistribute it and/or modify
  10680. + * it under the terms of the GNU General Public License as published by
  10681. + * the Free Software Foundation; either version 2 of the License, or
  10682. + * (at your option) any later version.
  10683. + *
  10684. + * This program is distributed in the hope that it will be useful, but
  10685. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  10686. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  10687. + * NON INFRINGEMENT. See the GNU General Public License for more
  10688. + * details.
  10689. + *
  10690. + * You should have received a copy of the GNU General Public License
  10691. + * along with this program; if not, write to the Free Software
  10692. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  10693. + *
  10694. + */
  10695. +
  10696. +#ifndef _NIOS2NOMMU_SYSTEM_H
  10697. +#define _NIOS2NOMMU_SYSTEM_H
  10698. +
  10699. +// #include <linux/config.h> /* get configuration macros */
  10700. +#include <linux/linkage.h>
  10701. +#include <asm/segment.h>
  10702. +#include <asm/entry.h>
  10703. +#include <asm/nios.h>
  10704. +
  10705. +/*
  10706. + * switch_to(n) should switch tasks to task ptr, first checking that
  10707. + * ptr isn't the current task, in which case it does nothing. This
  10708. + * also clears the TS-flag if the task we switched to has used the
  10709. + * math co-processor latest.
  10710. + */
  10711. +
  10712. +/*
  10713. + */
  10714. +asmlinkage void resume(void);
  10715. +#define switch_to(prev,next,last) \
  10716. +{ \
  10717. + void *_last; \
  10718. + __asm__ __volatile__( \
  10719. + "mov r4, %1\n" \
  10720. + "mov r5, %2\n" \
  10721. + "call resume\n" \
  10722. + "mov %0,r4\n" \
  10723. + : "=r" (_last) \
  10724. + : "r" (prev), "r" (next) \
  10725. + : "r4","r5","r7","r8","ra"); \
  10726. + (last) = _last; \
  10727. +}
  10728. +
  10729. +#define local_irq_enable() __asm__ __volatile__ ( \
  10730. + "rdctl r8, status\n" \
  10731. + "ori r8, r8, 1\n" \
  10732. + "wrctl status, r8\n" \
  10733. + : : : "r8")
  10734. +
  10735. +#define local_irq_disable() __asm__ __volatile__ ( \
  10736. + "rdctl r8, status\n" \
  10737. + "andi r8, r8, 0xfffe\n" \
  10738. + "wrctl status, r8\n" \
  10739. + : : : "r8")
  10740. +
  10741. +#define local_save_flags(x) __asm__ __volatile__ ( \
  10742. + "rdctl r8, status\n" \
  10743. + "mov %0, r8\n" \
  10744. + :"=r" (x) : : "r8", "memory")
  10745. +
  10746. +#define local_irq_restore(x) __asm__ __volatile__ ( \
  10747. + "mov r8, %0\n" \
  10748. + "wrctl status, r8\n" \
  10749. + : :"r" (x) : "memory")
  10750. +
  10751. +/* For spinlocks etc */
  10752. +#define local_irq_save(x) do { local_save_flags(x); local_irq_disable(); } while (0)
  10753. +
  10754. +#define irqs_disabled() \
  10755. +({ \
  10756. + unsigned long flags; \
  10757. + local_save_flags(flags); \
  10758. + ((flags & NIOS2_STATUS_PIE_MSK) == 0x0); \
  10759. +})
  10760. +
  10761. +#define iret() __asm__ __volatile__ ("eret": : :"memory", "ea")
  10762. +
  10763. +/*
  10764. + * Force strict CPU ordering.
  10765. + * Not really required on m68k...
  10766. + */
  10767. +#define nop() asm volatile ("nop"::)
  10768. +#define mb() asm volatile ("" : : :"memory")
  10769. +#define rmb() asm volatile ("" : : :"memory")
  10770. +#define wmb() asm volatile ("" : : :"memory")
  10771. +#define set_rmb(var, value) do { xchg(&var, value); } while (0)
  10772. +#define set_mb(var, value) set_rmb(var, value)
  10773. +#define set_wmb(var, value) do { var = value; wmb(); } while (0)
  10774. +
  10775. +#ifdef CONFIG_SMP
  10776. +#define smp_mb() mb()
  10777. +#define smp_rmb() rmb()
  10778. +#define smp_wmb() wmb()
  10779. +#define smp_read_barrier_depends() read_barrier_depends()
  10780. +#else
  10781. +#define smp_mb() barrier()
  10782. +#define smp_rmb() barrier()
  10783. +#define smp_wmb() barrier()
  10784. +#define smp_read_barrier_depends() do { } while(0)
  10785. +#endif
  10786. +
  10787. +#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
  10788. +#define tas(ptr) (xchg((ptr),1))
  10789. +
  10790. +struct __xchg_dummy { unsigned long a[100]; };
  10791. +#define __xg(x) ((volatile struct __xchg_dummy *)(x))
  10792. +
  10793. +static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
  10794. +{
  10795. + unsigned long tmp, flags;
  10796. +
  10797. + local_irq_save(flags);
  10798. +
  10799. + switch (size) {
  10800. + case 1:
  10801. + __asm__ __volatile__( \
  10802. + "ldb %0, %2\n" \
  10803. + "stb %1, %2\n" \
  10804. + : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
  10805. + break;
  10806. + case 2:
  10807. + __asm__ __volatile__( \
  10808. + "ldh %0, %2\n" \
  10809. + "sth %1, %2\n" \
  10810. + : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
  10811. + break;
  10812. + case 4:
  10813. + __asm__ __volatile__( \
  10814. + "ldw %0, %2\n" \
  10815. + "stw %1, %2\n" \
  10816. + : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
  10817. + break;
  10818. + }
  10819. + local_irq_restore(flags);
  10820. + return tmp;
  10821. +}
  10822. +
  10823. +/*
  10824. + * Atomic compare and exchange. Compare OLD with MEM, if identical,
  10825. + * store NEW in MEM. Return the initial value in MEM. Success is
  10826. + * indicated by comparing RETURN with OLD.
  10827. + */
  10828. +#define __HAVE_ARCH_CMPXCHG 1
  10829. +
  10830. +static __inline__ unsigned long
  10831. +cmpxchg(volatile int *p, int old, int new)
  10832. +{
  10833. + unsigned long flags;
  10834. + int prev;
  10835. +
  10836. + local_irq_save(flags);
  10837. + if ((prev = *p) == old)
  10838. + *p = new;
  10839. + local_irq_restore(flags);
  10840. + return(prev);
  10841. +}
  10842. +
  10843. +#endif /* _NIOS2NOMMU_SYSTEM_H */
  10844. --- linux/include/asm-nios2nommu/termbits.h
  10845. +++ linux/include/asm-nios2nommu/termbits.h
  10846. @@ -0,0 +1,199 @@
  10847. +#ifndef __ARCH_NIOS_TERMBITS_H__
  10848. +#define __ARCH_NIOS_TERMBITS_H__
  10849. +
  10850. +/*--------------------------------------------------------------------
  10851. + *
  10852. + * include/asm-nios2nommu/termbits.h
  10853. + *
  10854. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  10855. + *
  10856. + * Copyright (C) 2004 Microtronix Datacom Ltd
  10857. + *
  10858. + * This program is free software; you can redistribute it and/or modify
  10859. + * it under the terms of the GNU General Public License as published by
  10860. + * the Free Software Foundation; either version 2 of the License, or
  10861. + * (at your option) any later version.
  10862. + *
  10863. + * This program is distributed in the hope that it will be useful,
  10864. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10865. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10866. + * GNU General Public License for more details.
  10867. + *
  10868. + *
  10869. + * Jan/20/2004 dgt NiosII
  10870. + *
  10871. + ---------------------------------------------------------------------*/
  10872. +
  10873. +
  10874. +#include <linux/posix_types.h>
  10875. +
  10876. +typedef unsigned char cc_t;
  10877. +typedef unsigned int speed_t;
  10878. +typedef unsigned int tcflag_t;
  10879. +
  10880. +#define NCCS 19
  10881. +struct termios {
  10882. + tcflag_t c_iflag; /* input mode flags */
  10883. + tcflag_t c_oflag; /* output mode flags */
  10884. + tcflag_t c_cflag; /* control mode flags */
  10885. + tcflag_t c_lflag; /* local mode flags */
  10886. + cc_t c_line; /* line discipline */
  10887. + cc_t c_cc[NCCS]; /* control characters */
  10888. +};
  10889. +
  10890. +/* c_cc characters */
  10891. +#define VINTR 0
  10892. +#define VQUIT 1
  10893. +#define VERASE 2
  10894. +#define VKILL 3
  10895. +#define VEOF 4
  10896. +#define VTIME 5
  10897. +#define VMIN 6
  10898. +#define VSWTC 7
  10899. +#define VSTART 8
  10900. +#define VSTOP 9
  10901. +#define VSUSP 10
  10902. +#define VEOL 11
  10903. +#define VREPRINT 12
  10904. +#define VDISCARD 13
  10905. +#define VWERASE 14
  10906. +#define VLNEXT 15
  10907. +#define VEOL2 16
  10908. +
  10909. +
  10910. +/* c_iflag bits */
  10911. +#define IGNBRK 0000001
  10912. +#define BRKINT 0000002
  10913. +#define IGNPAR 0000004
  10914. +#define PARMRK 0000010
  10915. +#define INPCK 0000020
  10916. +#define ISTRIP 0000040
  10917. +#define INLCR 0000100
  10918. +#define IGNCR 0000200
  10919. +#define ICRNL 0000400
  10920. +#define IUCLC 0001000
  10921. +#define IXON 0002000
  10922. +#define IXANY 0004000
  10923. +#define IXOFF 0010000
  10924. +#define IMAXBEL 0020000
  10925. +#define IUTF8 0040000
  10926. +
  10927. +/* c_oflag bits */
  10928. +#define OPOST 0000001
  10929. +#define OLCUC 0000002
  10930. +#define ONLCR 0000004
  10931. +#define OCRNL 0000010
  10932. +#define ONOCR 0000020
  10933. +#define ONLRET 0000040
  10934. +#define OFILL 0000100
  10935. +#define OFDEL 0000200
  10936. +#define NLDLY 0000400
  10937. +#define NL0 0000000
  10938. +#define NL1 0000400
  10939. +#define CRDLY 0003000
  10940. +#define CR0 0000000
  10941. +#define CR1 0001000
  10942. +#define CR2 0002000
  10943. +#define CR3 0003000
  10944. +#define TABDLY 0014000
  10945. +#define TAB0 0000000
  10946. +#define TAB1 0004000
  10947. +#define TAB2 0010000
  10948. +#define TAB3 0014000
  10949. +#define XTABS 0014000
  10950. +#define BSDLY 0020000
  10951. +#define BS0 0000000
  10952. +#define BS1 0020000
  10953. +#define VTDLY 0040000
  10954. +#define VT0 0000000
  10955. +#define VT1 0040000
  10956. +#define FFDLY 0100000
  10957. +#define FF0 0000000
  10958. +#define FF1 0100000
  10959. +
  10960. +/* c_cflag bit meaning */
  10961. +#define CBAUD 0010017
  10962. +#define B0 0000000 /* hang up */
  10963. +#define B50 0000001
  10964. +#define B75 0000002
  10965. +#define B110 0000003
  10966. +#define B134 0000004
  10967. +#define B150 0000005
  10968. +#define B200 0000006
  10969. +#define B300 0000007
  10970. +#define B600 0000010
  10971. +#define B1200 0000011
  10972. +#define B1800 0000012
  10973. +#define B2400 0000013
  10974. +#define B4800 0000014
  10975. +#define B9600 0000015
  10976. +#define B19200 0000016
  10977. +#define B38400 0000017
  10978. +#define EXTA B19200
  10979. +#define EXTB B38400
  10980. +#define CSIZE 0000060
  10981. +#define CS5 0000000
  10982. +#define CS6 0000020
  10983. +#define CS7 0000040
  10984. +#define CS8 0000060
  10985. +#define CSTOPB 0000100
  10986. +#define CREAD 0000200
  10987. +#define PARENB 0000400
  10988. +#define PARODD 0001000
  10989. +#define HUPCL 0002000
  10990. +#define CLOCAL 0004000
  10991. +#define CBAUDEX 0010000
  10992. +#define B57600 0010001
  10993. +#define B115200 0010002
  10994. +#define B230400 0010003
  10995. +#define B460800 0010004
  10996. +#define B500000 0010005
  10997. +#define B576000 0010006
  10998. +#define B921600 0010007
  10999. +#define B1000000 0010010
  11000. +#define B1152000 0010011
  11001. +#define B1500000 0010012
  11002. +#define B2000000 0010013
  11003. +#define B2500000 0010014
  11004. +#define B3000000 0010015
  11005. +#define B3500000 0010016
  11006. +#define B4000000 0010017
  11007. +#define CIBAUD 002003600000 /* input baud rate (not used) */
  11008. +#define CMSPAR 010000000000 /* mark or space (stick) parity */
  11009. +#define CRTSCTS 020000000000 /* flow control */
  11010. +
  11011. +/* c_lflag bits */
  11012. +#define ISIG 0000001
  11013. +#define ICANON 0000002
  11014. +#define XCASE 0000004
  11015. +#define ECHO 0000010
  11016. +#define ECHOE 0000020
  11017. +#define ECHOK 0000040
  11018. +#define ECHONL 0000100
  11019. +#define NOFLSH 0000200
  11020. +#define TOSTOP 0000400
  11021. +#define ECHOCTL 0001000
  11022. +#define ECHOPRT 0002000
  11023. +#define ECHOKE 0004000
  11024. +#define FLUSHO 0010000
  11025. +#define PENDIN 0040000
  11026. +#define IEXTEN 0100000
  11027. +
  11028. +
  11029. +/* tcflow() and TCXONC use these */
  11030. +#define TCOOFF 0
  11031. +#define TCOON 1
  11032. +#define TCIOFF 2
  11033. +#define TCION 3
  11034. +
  11035. +/* tcflush() and TCFLSH use these */
  11036. +#define TCIFLUSH 0
  11037. +#define TCOFLUSH 1
  11038. +#define TCIOFLUSH 2
  11039. +
  11040. +/* tcsetattr uses these */
  11041. +#define TCSANOW 0
  11042. +#define TCSADRAIN 1
  11043. +#define TCSAFLUSH 2
  11044. +
  11045. +#endif /* __ARCH_NIOS_TERMBITS_H__ */
  11046. --- linux/include/asm-nios2nommu/termios.h
  11047. +++ linux/include/asm-nios2nommu/termios.h
  11048. @@ -0,0 +1,132 @@
  11049. +#ifndef _NIOS_TERMIOS_H
  11050. +#define _NIOS_TERMIOS_H
  11051. +
  11052. +/*--------------------------------------------------------------------
  11053. + *
  11054. + * include/asm-nios2nommu/termios.h
  11055. + *
  11056. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  11057. + *
  11058. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11059. + *
  11060. + * This program is free software; you can redistribute it and/or modify
  11061. + * it under the terms of the GNU General Public License as published by
  11062. + * the Free Software Foundation; either version 2 of the License, or
  11063. + * (at your option) any later version.
  11064. + *
  11065. + * This program is distributed in the hope that it will be useful,
  11066. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11067. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11068. + * GNU General Public License for more details.
  11069. + *
  11070. + *
  11071. + * Jan/20/2004 dgt NiosII
  11072. + *
  11073. + ---------------------------------------------------------------------*/
  11074. +
  11075. +
  11076. +#include <asm/termbits.h>
  11077. +#include <asm/ioctls.h>
  11078. +
  11079. +struct winsize {
  11080. + unsigned short ws_row;
  11081. + unsigned short ws_col;
  11082. + unsigned short ws_xpixel;
  11083. + unsigned short ws_ypixel;
  11084. +};
  11085. +
  11086. +#define NCC 8
  11087. +struct termio {
  11088. + unsigned short c_iflag; /* input mode flags */
  11089. + unsigned short c_oflag; /* output mode flags */
  11090. + unsigned short c_cflag; /* control mode flags */
  11091. + unsigned short c_lflag; /* local mode flags */
  11092. + unsigned char c_line; /* line discipline */
  11093. + unsigned char c_cc[NCC]; /* control characters */
  11094. +};
  11095. +
  11096. +#ifdef __KERNEL__
  11097. +/* intr=^C quit=^| erase=del kill=^U
  11098. + eof=^D vtime=\0 vmin=\1 sxtc=\0
  11099. + start=^Q stop=^S susp=^Z eol=\0
  11100. + reprint=^R discard=^U werase=^W lnext=^V
  11101. + eol2=\0
  11102. +*/
  11103. +#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
  11104. +#endif
  11105. +
  11106. +/* modem lines */
  11107. +#define TIOCM_LE 0x001
  11108. +#define TIOCM_DTR 0x002
  11109. +#define TIOCM_RTS 0x004
  11110. +#define TIOCM_ST 0x008
  11111. +#define TIOCM_SR 0x010
  11112. +#define TIOCM_CTS 0x020
  11113. +#define TIOCM_CAR 0x040
  11114. +#define TIOCM_RNG 0x080
  11115. +#define TIOCM_DSR 0x100
  11116. +#define TIOCM_CD TIOCM_CAR
  11117. +#define TIOCM_RI TIOCM_RNG
  11118. +#define TIOCM_OUT1 0x2000
  11119. +#define TIOCM_OUT2 0x4000
  11120. +#define TIOCM_LOOP 0x8000
  11121. +
  11122. +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  11123. +
  11124. +/* line disciplines */
  11125. +#define N_TTY 0
  11126. +#define N_SLIP 1
  11127. +#define N_MOUSE 2
  11128. +#define N_PPP 3
  11129. +#define N_STRIP 4
  11130. +#define N_AX25 5
  11131. +#define N_X25 6 /* X.25 async */
  11132. +#define N_6PACK 7
  11133. +#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
  11134. +#define N_R3964 9 /* Reserved for Simatic R3964 module */
  11135. +#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
  11136. +#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
  11137. +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
  11138. +#define N_HDLC 13 /* synchronous HDLC */
  11139. +#define N_SYNC_PPP 14
  11140. +#define N_HCI 15 /* Bluetooth HCI UART */
  11141. +
  11142. +#ifdef __KERNEL__
  11143. +
  11144. +/*
  11145. + * Translate a "termio" structure into a "termios". Ugh.
  11146. + */
  11147. +#define user_termio_to_kernel_termios(termios, termio) \
  11148. +({ \
  11149. + unsigned short tmp; \
  11150. + get_user(tmp, &(termio)->c_iflag); \
  11151. + (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
  11152. + get_user(tmp, &(termio)->c_oflag); \
  11153. + (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
  11154. + get_user(tmp, &(termio)->c_cflag); \
  11155. + (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
  11156. + get_user(tmp, &(termio)->c_lflag); \
  11157. + (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
  11158. + get_user((termios)->c_line, &(termio)->c_line); \
  11159. + copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
  11160. +})
  11161. +
  11162. +/*
  11163. + * Translate a "termios" structure into a "termio". Ugh.
  11164. + */
  11165. +#define kernel_termios_to_user_termio(termio, termios) \
  11166. +({ \
  11167. + put_user((termios)->c_iflag, &(termio)->c_iflag); \
  11168. + put_user((termios)->c_oflag, &(termio)->c_oflag); \
  11169. + put_user((termios)->c_cflag, &(termio)->c_cflag); \
  11170. + put_user((termios)->c_lflag, &(termio)->c_lflag); \
  11171. + put_user((termios)->c_line, &(termio)->c_line); \
  11172. + copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
  11173. +})
  11174. +
  11175. +#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
  11176. +#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
  11177. +
  11178. +#endif /* __KERNEL__ */
  11179. +
  11180. +#endif /* _NIOS_TERMIOS_H */
  11181. --- linux/include/asm-nios2nommu/thread_info.h
  11182. +++ linux/include/asm-nios2nommu/thread_info.h
  11183. @@ -0,0 +1,126 @@
  11184. +/* thread_info.h: niosnommu low-level thread information
  11185. + * adapted from the m68knommu
  11186. + *
  11187. + * Copyright (C) 2004 Microtronix Datacom Ltd.
  11188. + * Copyright (C) 2002 Microtronix Datacom
  11189. + *
  11190. + * - Incorporating suggestions made by Linus Torvalds and Dave Miller
  11191. + *
  11192. + * All rights reserved.
  11193. + *
  11194. + * This program is free software; you can redistribute it and/or modify
  11195. + * it under the terms of the GNU General Public License as published by
  11196. + * the Free Software Foundation; either version 2 of the License, or
  11197. + * (at your option) any later version.
  11198. + *
  11199. + * This program is distributed in the hope that it will be useful, but
  11200. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  11201. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11202. + * NON INFRINGEMENT. See the GNU General Public License for more
  11203. + * details.
  11204. + *
  11205. + * You should have received a copy of the GNU General Public License
  11206. + * along with this program; if not, write to the Free Software
  11207. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  11208. + *
  11209. + */
  11210. +
  11211. +#ifndef _ASM_THREAD_INFO_H
  11212. +#define _ASM_THREAD_INFO_H
  11213. +
  11214. +#include <asm/page.h>
  11215. +
  11216. +#ifdef __KERNEL__
  11217. +
  11218. +#ifndef __ASSEMBLY__
  11219. +
  11220. +/*
  11221. + * low level task data.
  11222. + */
  11223. +struct thread_info {
  11224. + struct task_struct *task; /* main task structure */
  11225. + struct exec_domain *exec_domain; /* execution domain */
  11226. + unsigned long flags; /* low level flags */
  11227. + int cpu; /* cpu we're on */
  11228. + int preempt_count; /* 0 => preemptable, <0 => BUG*/
  11229. + struct restart_block restart_block;
  11230. +};
  11231. +
  11232. +/*
  11233. + * macros/functions for gaining access to the thread information structure
  11234. + */
  11235. +#define INIT_THREAD_INFO(tsk) \
  11236. +{ \
  11237. + .task = &tsk, \
  11238. + .exec_domain = &default_exec_domain, \
  11239. + .flags = 0, \
  11240. + .cpu = 0, \
  11241. + .preempt_count = 1, \
  11242. + .restart_block = { \
  11243. + .fn = do_no_restart_syscall, \
  11244. + }, \
  11245. +}
  11246. +
  11247. +#define init_thread_info (init_thread_union.thread_info)
  11248. +#define init_stack (init_thread_union.stack)
  11249. +
  11250. +
  11251. +/* how to get the thread information struct from C
  11252. + usable only in supervisor mode */
  11253. +static inline struct thread_info *current_thread_info(void)
  11254. +{
  11255. + struct thread_info *ti;
  11256. + __asm__ __volatile__(
  11257. + "mov %0, sp\n"
  11258. + "and %0, %0, %1\n"
  11259. + : "=&r"(ti)
  11260. + : "r" (~(THREAD_SIZE-1))
  11261. + );
  11262. + return ti;
  11263. +}
  11264. +
  11265. +/* thread information allocation */
  11266. +#define alloc_thread_info(tsk) ((struct thread_info *) \
  11267. + __get_free_pages(GFP_KERNEL, 1))
  11268. +#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
  11269. +#define put_thread_info(ti) put_task_struct((ti)->task)
  11270. +
  11271. +#define PREEMPT_ACTIVE 0x4000000
  11272. +
  11273. +/*
  11274. + * thread information flag bit numbers
  11275. + */
  11276. +#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  11277. +#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
  11278. +#define TIF_SIGPENDING 2 /* signal pending */
  11279. +#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  11280. +#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
  11281. + TIF_NEED_RESCHED */
  11282. +
  11283. +/* as above, but as bit values */
  11284. +#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  11285. +#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  11286. +#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  11287. +#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  11288. +#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  11289. +
  11290. +#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
  11291. +
  11292. +#else /* __ASSEMBLY__ */
  11293. +
  11294. +/* how to get the thread information struct from ASM
  11295. + usable only in supervisor mode */
  11296. +.macro GET_THREAD_INFO reg
  11297. +.if THREAD_SIZE & 0xffff0000
  11298. + andhi \reg, sp, %hi(~(THREAD_SIZE-1))
  11299. +.else
  11300. + addi \reg, r0, %lo(~(THREAD_SIZE-1))
  11301. + and \reg, \reg, sp
  11302. +.endif
  11303. +.endm
  11304. +
  11305. +#endif /* __ASSEMBLY__ */
  11306. +
  11307. +#endif /* __KERNEL__ */
  11308. +
  11309. +#endif /* _ASM_THREAD_INFO_H */
  11310. --- linux/include/asm-nios2nommu/timer_struct.h
  11311. +++ linux/include/asm-nios2nommu/timer_struct.h
  11312. @@ -0,0 +1,38 @@
  11313. +
  11314. +// ----------------------------------------------
  11315. +// Timer Peripheral
  11316. +
  11317. +// Timer Registers
  11318. +typedef volatile struct
  11319. + {
  11320. + int np_timerstatus; // read only, 2 bits (any write to clear TO)
  11321. + int np_timercontrol; // write/readable, 4 bits
  11322. + int np_timerperiodl; // write/readable, 16 bits
  11323. + int np_timerperiodh; // write/readable, 16 bits
  11324. + int np_timersnapl; // read only, 16 bits
  11325. + int np_timersnaph; // read only, 16 bits
  11326. + } np_timer;
  11327. +
  11328. +// Timer Register Bits
  11329. +enum
  11330. + {
  11331. + np_timerstatus_run_bit = 1, // timer is running
  11332. + np_timerstatus_to_bit = 0, // timer has timed out
  11333. +
  11334. + np_timercontrol_stop_bit = 3, // stop the timer
  11335. + np_timercontrol_start_bit = 2, // start the timer
  11336. + np_timercontrol_cont_bit = 1, // continous mode
  11337. + np_timercontrol_ito_bit = 0, // enable time out interrupt
  11338. +
  11339. + np_timerstatus_run_mask = (1<<1), // timer is running
  11340. + np_timerstatus_to_mask = (1<<0), // timer has timed out
  11341. +
  11342. + np_timercontrol_stop_mask = (1<<3), // stop the timer
  11343. + np_timercontrol_start_mask = (1<<2), // start the timer
  11344. + np_timercontrol_cont_mask = (1<<1), // continous mode
  11345. + np_timercontrol_ito_mask = (1<<0) // enable time out interrupt
  11346. + };
  11347. +
  11348. +// Timer Routines
  11349. +int nr_timer_milliseconds(void); // Starts on first call, hogs timer1.
  11350. +
  11351. --- linux/include/asm-nios2nommu/timex.h
  11352. +++ linux/include/asm-nios2nommu/timex.h
  11353. @@ -0,0 +1,48 @@
  11354. +#ifndef _ASMNIOS2NOMMU_TIMEX_H
  11355. +#define _ASMNIOS2NOMMU_TIMEX_H
  11356. +
  11357. +/*--------------------------------------------------------------------
  11358. + *
  11359. + * include/asm-nios2nommu/timex.h
  11360. + *
  11361. + * timex specifications
  11362. + *
  11363. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  11364. + *
  11365. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11366. + *
  11367. + * This program is free software; you can redistribute it and/or modify
  11368. + * it under the terms of the GNU General Public License as published by
  11369. + * the Free Software Foundation; either version 2 of the License, or
  11370. + * (at your option) any later version.
  11371. + *
  11372. + * This program is distributed in the hope that it will be useful,
  11373. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11374. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11375. + * GNU General Public License for more details.
  11376. + *
  11377. + *
  11378. + * Jan/20/2004 dgt NiosII
  11379. + *
  11380. + ---------------------------------------------------------------------*/
  11381. +
  11382. +
  11383. +#include <asm/nios.h>
  11384. +
  11385. +
  11386. +#define CLOCK_TICK_RATE nasys_clock_freq /* Underlying HZ */
  11387. +
  11388. +#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
  11389. +
  11390. +#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
  11391. + (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
  11392. + << (SHIFT_SCALE-SHIFT_HZ)) / HZ)
  11393. +
  11394. +typedef unsigned long cycles_t;
  11395. +
  11396. +static inline cycles_t get_cycles(void)
  11397. +{
  11398. + return 0;
  11399. +}
  11400. +
  11401. +#endif
  11402. --- linux/include/asm-nios2nommu/tlb.h
  11403. +++ linux/include/asm-nios2nommu/tlb.h
  11404. @@ -0,0 +1,35 @@
  11405. +#ifndef __NIOS_TLB_H__
  11406. +#define __NIOS_TLB_H__
  11407. +
  11408. +/*--------------------------------------------------------------------
  11409. + *
  11410. + * include/asm-nios2nommu/tlb.h
  11411. + *
  11412. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  11413. + *
  11414. + * Copyright (C) 2003 Microtronix Datacom Ltd
  11415. + * Copyright (C) 2002 NEC Corporation
  11416. + * Copyright (C) 2002 Miles Bader <miles@gnu.org>
  11417. + *
  11418. + * This program is free software; you can redistribute it and/or modify
  11419. + * it under the terms of the GNU General Public License as published by
  11420. + * the Free Software Foundation; either version 2 of the License, or
  11421. + * (at your option) any later version.
  11422. + *
  11423. + * This program is distributed in the hope that it will be useful,
  11424. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11425. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11426. + * GNU General Public License for more details.
  11427. + *
  11428. + *
  11429. + * Written by Miles Bader <miles@gnu.org>
  11430. + * Jan/20/2004 dgt NiosII
  11431. + *
  11432. + ---------------------------------------------------------------------*/
  11433. +
  11434. +#define tlb_flush(tlb) ((void)0)
  11435. +
  11436. +#include <asm-generic/tlb.h>
  11437. +
  11438. +#endif /* __NIOS_TLB_H__ */
  11439. +
  11440. --- linux/include/asm-nios2nommu/tlbflush.h
  11441. +++ linux/include/asm-nios2nommu/tlbflush.h
  11442. @@ -0,0 +1,86 @@
  11443. +#ifndef _NIOS2NOMMU_TLBFLUSH_H
  11444. +#define _NIOS2NOMMU_TLBFLUSH_H
  11445. +
  11446. +/*--------------------------------------------------------------------
  11447. + *
  11448. + * include/asm-nios2nommu/tlbflush.h
  11449. + *
  11450. + * Ported from m68knommu.
  11451. + *
  11452. + * Copyright (C) 2003 Microtronix Datacom Ltd.
  11453. + *
  11454. + * All rights reserved.
  11455. + *
  11456. + * This program is free software; you can redistribute it and/or modify
  11457. + * it under the terms of the GNU General Public License as published by
  11458. + * the Free Software Foundation; either version 2 of the License, or
  11459. + * (at your option) any later version.
  11460. + *
  11461. + * This program is distributed in the hope that it will be useful, but
  11462. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  11463. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11464. + * NON INFRINGEMENT. See the GNU General Public License for more
  11465. + * details.
  11466. + *
  11467. + * You should have received a copy of the GNU General Public License
  11468. + * along with this program; if not, write to the Free Software
  11469. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  11470. + *
  11471. + *
  11472. + * Jan/20/2004 dgt NiosII
  11473. + *
  11474. + ---------------------------------------------------------------------*/
  11475. +
  11476. +#include <asm/setup.h>
  11477. +
  11478. +/*
  11479. + * flush all user-space atc entries.
  11480. + */
  11481. +static inline void __flush_tlb(void)
  11482. +{
  11483. + BUG();
  11484. +}
  11485. +
  11486. +static inline void __flush_tlb_one(unsigned long addr)
  11487. +{
  11488. + BUG();
  11489. +}
  11490. +
  11491. +#define flush_tlb() __flush_tlb()
  11492. +
  11493. +/*
  11494. + * flush all atc entries (both kernel and user-space entries).
  11495. + */
  11496. +static inline void flush_tlb_all(void)
  11497. +{
  11498. + BUG();
  11499. +}
  11500. +
  11501. +static inline void flush_tlb_mm(struct mm_struct *mm)
  11502. +{
  11503. + BUG();
  11504. +}
  11505. +
  11506. +static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
  11507. +{
  11508. + BUG();
  11509. +}
  11510. +
  11511. +static inline void flush_tlb_range(struct mm_struct *mm,
  11512. + unsigned long start, unsigned long end)
  11513. +{
  11514. + BUG();
  11515. +}
  11516. +
  11517. +extern inline void flush_tlb_kernel_page(unsigned long addr)
  11518. +{
  11519. + BUG();
  11520. +}
  11521. +
  11522. +extern inline void flush_tlb_pgtables(struct mm_struct *mm,
  11523. + unsigned long start, unsigned long end)
  11524. +{
  11525. + BUG();
  11526. +}
  11527. +
  11528. +#endif /* _NIOS2NOMMU_TLBFLUSH_H */
  11529. --- linux/include/asm-nios2nommu/topology.h
  11530. +++ linux/include/asm-nios2nommu/topology.h
  11531. @@ -0,0 +1,30 @@
  11532. +#ifndef _ASM_NIOS2NOMMU_TOPOLOGY_H
  11533. +#define _ASM_NIOS2NOMMU_TOPOLOGY_H
  11534. +
  11535. +/*--------------------------------------------------------------------
  11536. + *
  11537. + * include/asm-nios2nommu/topology.h
  11538. + *
  11539. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  11540. + *
  11541. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11542. + *
  11543. + * This program is free software; you can redistribute it and/or modify
  11544. + * it under the terms of the GNU General Public License as published by
  11545. + * the Free Software Foundation; either version 2 of the License, or
  11546. + * (at your option) any later version.
  11547. + *
  11548. + * This program is distributed in the hope that it will be useful,
  11549. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11550. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11551. + * GNU General Public License for more details.
  11552. + *
  11553. + *
  11554. + * Jan/20/2004 dgt NiosII
  11555. + *
  11556. + ---------------------------------------------------------------------*/
  11557. +
  11558. +
  11559. +#include <asm-generic/topology.h>
  11560. +
  11561. +#endif /* _ASM_NIOS2NOMMU_TOPOLOGY_H */
  11562. --- linux/include/asm-nios2nommu/traps.h
  11563. +++ linux/include/asm-nios2nommu/traps.h
  11564. @@ -0,0 +1,27 @@
  11565. +/*
  11566. + * Copyright (C) 2004, Microtronix Datacom Ltd.
  11567. + *
  11568. + * All rights reserved.
  11569. + *
  11570. + * This program is free software; you can redistribute it and/or modify
  11571. + * it under the terms of the GNU General Public License as published by
  11572. + * the Free Software Foundation; either version 2 of the License, or
  11573. + * (at your option) any later version.
  11574. + *
  11575. + * This program is distributed in the hope that it will be useful, but
  11576. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  11577. + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11578. + * NON INFRINGEMENT. See the GNU General Public License for more
  11579. + * details.
  11580. + *
  11581. + * You should have received a copy of the GNU General Public License
  11582. + * along with this program; if not, write to the Free Software
  11583. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  11584. + *
  11585. + */
  11586. +#ifndef _NIOS2_TRAPS_H
  11587. +#define _NIOS2_TRAPS_H
  11588. +
  11589. +#define TRAP_ID_SYSCALL 0
  11590. +#define TRAP_ID_APPDEBUG 1
  11591. +#endif /* !(_NIOS2_TRAPS_H) */
  11592. --- linux/include/asm-nios2nommu/types.h
  11593. +++ linux/include/asm-nios2nommu/types.h
  11594. @@ -0,0 +1,93 @@
  11595. +#ifndef _NIOS_TYPES_H
  11596. +#define _NIOS_TYPES_H
  11597. +
  11598. +/*--------------------------------------------------------------------
  11599. + *
  11600. + * include/asm-nios2nommu/types.h
  11601. + *
  11602. + * Derived from m68knommu
  11603. + *
  11604. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11605. + *
  11606. + * This program is free software; you can redistribute it and/or modify
  11607. + * it under the terms of the GNU General Public License as published by
  11608. + * the Free Software Foundation; either version 2 of the License, or
  11609. + * (at your option) any later version.
  11610. + *
  11611. + * This program is distributed in the hope that it will be useful,
  11612. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11613. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11614. + * GNU General Public License for more details.
  11615. + *
  11616. + *
  11617. + * Jan/20/2004 dgt NiosII
  11618. + *
  11619. + ---------------------------------------------------------------------*/
  11620. +
  11621. +
  11622. +/*
  11623. + * This file is never included by application software unless
  11624. + * explicitly requested (e.g., via linux/types.h) in which case the
  11625. + * application is Linux specific so (user-) name space pollution is
  11626. + * not a major issue. However, for interoperability, libraries still
  11627. + * need to be careful to avoid a name clashes.
  11628. + */
  11629. +
  11630. +#ifndef __ASSEMBLY__
  11631. +
  11632. +typedef unsigned short umode_t;
  11633. +
  11634. +/*
  11635. + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  11636. + * header files exported to user space
  11637. + */
  11638. +
  11639. +typedef __signed__ char __s8;
  11640. +typedef unsigned char __u8;
  11641. +
  11642. +typedef __signed__ short __s16;
  11643. +typedef unsigned short __u16;
  11644. +
  11645. +typedef __signed__ int __s32;
  11646. +typedef unsigned int __u32;
  11647. +
  11648. +#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
  11649. +typedef __signed__ long long __s64;
  11650. +typedef unsigned long long __u64;
  11651. +#endif
  11652. +
  11653. +#endif /* __ASSEMBLY__ */
  11654. +
  11655. +/*
  11656. + * These aren't exported outside the kernel to avoid name space clashes
  11657. + */
  11658. +#ifdef __KERNEL__
  11659. +
  11660. +#define BITS_PER_LONG 32
  11661. +
  11662. +#ifndef __ASSEMBLY__
  11663. +
  11664. +typedef signed char s8;
  11665. +typedef unsigned char u8;
  11666. +
  11667. +typedef signed short s16;
  11668. +typedef unsigned short u16;
  11669. +
  11670. +typedef signed int s32;
  11671. +typedef unsigned int u32;
  11672. +
  11673. +typedef signed long long s64;
  11674. +typedef unsigned long long u64;
  11675. +
  11676. +/* DMA addresses are always 32-bits wide */
  11677. +
  11678. +typedef u32 dma_addr_t;
  11679. +typedef u32 dma64_addr_t;
  11680. +
  11681. +typedef unsigned short kmem_bufctl_t;
  11682. +
  11683. +#endif /* __ASSEMBLY__ */
  11684. +
  11685. +#endif /* __KERNEL__ */
  11686. +
  11687. +#endif /* _NIOS_TYPES_H */
  11688. --- linux/include/asm-nios2nommu/uaccess.h
  11689. +++ linux/include/asm-nios2nommu/uaccess.h
  11690. @@ -0,0 +1,183 @@
  11691. +#ifndef __NIOS2NOMMU_UACCESS_H
  11692. +#define __NIOS2NOMMU_UACCESS_H
  11693. +
  11694. +/*--------------------------------------------------------------------
  11695. + *
  11696. + * asm-nios2nommu/uaccess.h
  11697. + *
  11698. + * User space memory access functions
  11699. + *
  11700. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  11701. + *
  11702. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11703. + *
  11704. + * This program is free software; you can redistribute it and/or modify
  11705. + * it under the terms of the GNU General Public License as published by
  11706. + * the Free Software Foundation; either version 2 of the License, or
  11707. + * (at your option) any later version.
  11708. + *
  11709. + * This program is distributed in the hope that it will be useful,
  11710. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11711. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11712. + * GNU General Public License for more details.
  11713. + *
  11714. + *
  11715. + * Ported from asm-m68knommu/uaccess.h --wentao
  11716. + * Jan/20/2004 dgt NiosII
  11717. + *
  11718. + ---------------------------------------------------------------------*/
  11719. +
  11720. +
  11721. +#include <linux/sched.h>
  11722. +#include <linux/mm.h>
  11723. +#include <asm/segment.h>
  11724. +#include <asm/nios.h>
  11725. +
  11726. +#define VERIFY_READ 0
  11727. +#define VERIFY_WRITE 1
  11728. +
  11729. +#define access_ok(type,addr,size) _access_ok((unsigned long)(addr),(size))
  11730. +
  11731. +static inline int _access_ok(unsigned long addr, unsigned long size)
  11732. +{
  11733. + return (((unsigned long)addr < (unsigned long)nasys_program_mem_end) &&
  11734. + (((unsigned long)addr >= (unsigned long)nasys_program_mem)));
  11735. +}
  11736. +
  11737. +extern inline int verify_area(int type, const void * addr, unsigned long size)
  11738. +{
  11739. + return access_ok(type,addr,size)?0:-EFAULT;
  11740. +}
  11741. +
  11742. +/*
  11743. + * The exception table consists of pairs of addresses: the first is the
  11744. + * address of an instruction that is allowed to fault, and the second is
  11745. + * the address at which the program should continue. No registers are
  11746. + * modified, so it is entirely up to the continuation code to figure out
  11747. + * what to do.
  11748. + *
  11749. + * All the routines below use bits of fixup code that are out of line
  11750. + * with the main instruction path. This means when everything is well,
  11751. + * we don't even have to jump over them. Further, they do not intrude
  11752. + * on our cache or tlb entries.
  11753. + */
  11754. +
  11755. +#define ARCH_HAS_SEARCH_EXTABLE
  11756. +//;dgt2;tmp;
  11757. +
  11758. +struct exception_table_entry
  11759. +{
  11760. + unsigned long insn, fixup;
  11761. +};
  11762. +
  11763. +/* Returns 0 if exception not found and fixup otherwise. */
  11764. +extern unsigned long search_exception_table(unsigned long);
  11765. +
  11766. +
  11767. +/*
  11768. + * These are the main single-value transfer routines. They automatically
  11769. + * use the right size if we just have the right pointer type.
  11770. + */
  11771. +
  11772. +#define put_user(x, ptr) \
  11773. +({ \
  11774. + int __pu_err = 0; \
  11775. + typeof(*(ptr)) __pu_val = (x); \
  11776. + switch (sizeof (*(ptr))) { \
  11777. + case 1: \
  11778. + case 2: \
  11779. + case 4: \
  11780. + case 8: \
  11781. + memcpy(ptr, &__pu_val, sizeof (*(ptr))); \
  11782. + break; \
  11783. + default: \
  11784. + __pu_err = __put_user_bad(); \
  11785. + break; \
  11786. + } \
  11787. + __pu_err; \
  11788. +})
  11789. +#define __put_user(x, ptr) put_user(x, ptr)
  11790. +
  11791. +extern int __put_user_bad(void);
  11792. +
  11793. +/*
  11794. + * Tell gcc we read from memory instead of writing: this is because
  11795. + * we do not write to any memory gcc knows about, so there are no
  11796. + * aliasing issues.
  11797. + */
  11798. +
  11799. +#define __ptr(x) ((unsigned long *)(x))
  11800. +
  11801. +#define get_user(x, ptr) \
  11802. +({ \
  11803. + int __gu_err = 0; \
  11804. + typeof(*(ptr)) __gu_val = 0; \
  11805. + switch (sizeof(*(ptr))) { \
  11806. + case 1: \
  11807. + case 2: \
  11808. + case 4: \
  11809. + case 8: \
  11810. + memcpy(&__gu_val, ptr, sizeof (*(ptr))); \
  11811. + break; \
  11812. + default: \
  11813. + __gu_val = 0; \
  11814. + __gu_err = __get_user_bad(); \
  11815. + break; \
  11816. + } \
  11817. + (x) = __gu_val; \
  11818. + __gu_err; \
  11819. +})
  11820. +#define __get_user(x, ptr) get_user(x, ptr)
  11821. +
  11822. +extern int __get_user_bad(void);
  11823. +
  11824. +#define copy_from_user(to, from, n) (memcpy(to, from, n), 0)
  11825. +#define copy_to_user(to, from, n) (memcpy(to, from, n), 0)
  11826. +
  11827. +#define __copy_from_user(to, from, n) copy_from_user(to, from, n)
  11828. +#define __copy_to_user(to, from, n) copy_to_user(to, from, n)
  11829. +#define __copy_to_user_inatomic __copy_to_user
  11830. +#define __copy_from_user_inatomic __copy_from_user
  11831. +
  11832. +#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; })
  11833. +
  11834. +#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; })
  11835. +
  11836. +/*
  11837. + * Copy a null terminated string from userspace.
  11838. + */
  11839. +
  11840. +static inline long
  11841. +strncpy_from_user(char *dst, const char *src, long count)
  11842. +{
  11843. + char *tmp;
  11844. + strncpy(dst, src, count);
  11845. + for (tmp = dst; *tmp && count > 0; tmp++, count--)
  11846. + ;
  11847. + return(tmp - dst); /* DAVIDM should we count a NUL ? check getname */
  11848. +}
  11849. +
  11850. +/*
  11851. + * Return the size of a string (including the ending 0)
  11852. + *
  11853. + * Return 0 on exception, a value greater than N if too long
  11854. + */
  11855. +static inline long strnlen_user(const char *src, long n)
  11856. +{
  11857. + return(strlen(src) + 1); /* DAVIDM make safer */
  11858. +}
  11859. +
  11860. +#define strlen_user(str) strnlen_user(str, 32767)
  11861. +
  11862. +/*
  11863. + * Zero Userspace
  11864. + */
  11865. +
  11866. +static inline unsigned long
  11867. +clear_user(void *to, unsigned long n)
  11868. +{
  11869. + memset(to, 0, n);
  11870. + return(0);
  11871. +}
  11872. +
  11873. +#endif /* _NIOS2NOMMU_UACCESS_H */
  11874. --- linux/include/asm-nios2nommu/uart_struct.h
  11875. +++ linux/include/asm-nios2nommu/uart_struct.h
  11876. @@ -0,0 +1,83 @@
  11877. +
  11878. +// UART Registers
  11879. +typedef volatile struct
  11880. + {
  11881. + int np_uartrxdata; // Read-only, 8-bit
  11882. + int np_uarttxdata; // Write-only, 8-bit
  11883. + int np_uartstatus; // Read-only, 8-bit
  11884. + int np_uartcontrol; // Read/Write, 9-bit
  11885. + int np_uartdivisor; // Read/Write, 16-bit, optional
  11886. + int np_uartendofpacket; // Read/Write, end-of-packet character
  11887. + } np_uart;
  11888. +
  11889. +// UART Status Register Bits
  11890. +enum
  11891. + {
  11892. + np_uartstatus_eop_bit = 12,
  11893. + np_uartstatus_cts_bit = 11,
  11894. + np_uartstatus_dcts_bit = 10,
  11895. + np_uartstatus_e_bit = 8,
  11896. + np_uartstatus_rrdy_bit = 7,
  11897. + np_uartstatus_trdy_bit = 6,
  11898. + np_uartstatus_tmt_bit = 5,
  11899. + np_uartstatus_toe_bit = 4,
  11900. + np_uartstatus_roe_bit = 3,
  11901. + np_uartstatus_brk_bit = 2,
  11902. + np_uartstatus_fe_bit = 1,
  11903. + np_uartstatus_pe_bit = 0,
  11904. +
  11905. + np_uartstatus_eop_mask = (1<<12),
  11906. + np_uartstatus_cts_mask = (1<<11),
  11907. + np_uartstatus_dcts_mask = (1<<10),
  11908. + np_uartstatus_e_mask = (1<<8),
  11909. + np_uartstatus_rrdy_mask = (1<<7),
  11910. + np_uartstatus_trdy_mask = (1<<6),
  11911. + np_uartstatus_tmt_mask = (1<<5),
  11912. + np_uartstatus_toe_mask = (1<<4),
  11913. + np_uartstatus_roe_mask = (1<<3),
  11914. + np_uartstatus_brk_mask = (1<<2),
  11915. + np_uartstatus_fe_mask = (1<<1),
  11916. + np_uartstatus_pe_mask = (1<<0)
  11917. + };
  11918. +
  11919. +// UART Control Register Bits
  11920. +enum
  11921. + {
  11922. + np_uartcontrol_ieop_bit = 12,
  11923. + np_uartcontrol_rts_bit = 11,
  11924. + np_uartcontrol_idcts_bit = 10,
  11925. + np_uartcontrol_tbrk_bit = 9,
  11926. + np_uartcontrol_ie_bit = 8,
  11927. + np_uartcontrol_irrdy_bit = 7,
  11928. + np_uartcontrol_itrdy_bit = 6,
  11929. + np_uartcontrol_itmt_bit = 5,
  11930. + np_uartcontrol_itoe_bit = 4,
  11931. + np_uartcontrol_iroe_bit = 3,
  11932. + np_uartcontrol_ibrk_bit = 2,
  11933. + np_uartcontrol_ife_bit = 1,
  11934. + np_uartcontrol_ipe_bit = 0,
  11935. +
  11936. + np_uartcontrol_ieop_mask = (1<<12),
  11937. + np_uartcontrol_rts_mask = (1<<11),
  11938. + np_uartcontrol_idcts_mask = (1<<10),
  11939. + np_uartcontrol_tbrk_mask = (1<<9),
  11940. + np_uartcontrol_ie_mask = (1<<8),
  11941. + np_uartcontrol_irrdy_mask = (1<<7),
  11942. + np_uartcontrol_itrdy_mask = (1<<6),
  11943. + np_uartcontrol_itmt_mask = (1<<5),
  11944. + np_uartcontrol_itoe_mask = (1<<4),
  11945. + np_uartcontrol_iroe_mask = (1<<3),
  11946. + np_uartcontrol_ibrk_mask = (1<<2),
  11947. + np_uartcontrol_ife_mask = (1<<1),
  11948. + np_uartcontrol_ipe_mask = (1<<0)
  11949. + };
  11950. +
  11951. +// UART Routines
  11952. +int nr_uart_rxchar(np_uart *uartBase); // 0 for default UART
  11953. +void nr_uart_txcr(void);
  11954. +void nr_uart_txchar(int c,np_uart *uartBase); // 0 for default UART
  11955. +void nr_uart_txhex(int x); // 16 or 32 bits
  11956. +void nr_uart_txhex16(short x);
  11957. +void nr_uart_txhex32(long x);
  11958. +void nr_uart_txstring(char *s);
  11959. +
  11960. --- linux/include/asm-nios2nommu/ucontext.h
  11961. +++ linux/include/asm-nios2nommu/ucontext.h
  11962. @@ -0,0 +1,63 @@
  11963. +#ifndef _NIOSKNOMMU_UCONTEXT_H
  11964. +#define _NIOSKNOMMU_UCONTEXT_H
  11965. +
  11966. +/*--------------------------------------------------------------------
  11967. + *
  11968. + * include/asm-nios2nommu/ucontext.h
  11969. + *
  11970. + * Derived from M68knommu
  11971. + *
  11972. + * Copyright (C) 2004 Microtronix Datacom Ltd
  11973. + *
  11974. + * This program is free software; you can redistribute it and/or modify
  11975. + * it under the terms of the GNU General Public License as published by
  11976. + * the Free Software Foundation; either version 2 of the License, or
  11977. + * (at your option) any later version.
  11978. + *
  11979. + * This program is distributed in the hope that it will be useful,
  11980. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11981. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11982. + * GNU General Public License for more details.
  11983. + *
  11984. + *
  11985. + * Jan/20/2004 dgt NiosII
  11986. + *
  11987. + ---------------------------------------------------------------------*/
  11988. +
  11989. +
  11990. +typedef int greg_t;
  11991. +#define NGREG 32
  11992. +typedef greg_t gregset_t[NGREG];
  11993. +
  11994. +#ifdef CONFIG_FPU
  11995. +typedef struct fpregset {
  11996. + int f_pcr;
  11997. + int f_psr;
  11998. + int f_fpiaddr;
  11999. + int f_fpregs[8][3];
  12000. +} fpregset_t;
  12001. +#endif
  12002. +
  12003. +struct mcontext {
  12004. + int version;
  12005. + int status_extension;
  12006. + gregset_t gregs;
  12007. +#ifdef CONFIG_FPU
  12008. + fpregset_t fpregs;
  12009. +#endif
  12010. +};
  12011. +
  12012. +#define MCONTEXT_VERSION 2
  12013. +
  12014. +struct ucontext {
  12015. + unsigned long uc_flags;
  12016. + struct ucontext *uc_link;
  12017. + stack_t uc_stack;
  12018. + struct mcontext uc_mcontext;
  12019. +#ifdef CONFIG_FPU
  12020. + unsigned long uc_filler[80];
  12021. +#endif
  12022. + sigset_t uc_sigmask; /* mask last for extensibility */
  12023. +};
  12024. +
  12025. +#endif
  12026. --- linux/include/asm-nios2nommu/unaligned.h
  12027. +++ linux/include/asm-nios2nommu/unaligned.h
  12028. @@ -0,0 +1,43 @@
  12029. +#ifndef __NIOS_UNALIGNED_H
  12030. +#define __NIOS_UNALIGNED_H
  12031. +
  12032. +/*--------------------------------------------------------------------
  12033. + *
  12034. + * include/asm-nios2nommu/unaligned.h
  12035. + *
  12036. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  12037. + *
  12038. + * Copyright (C) 2004 Microtronix Datacom Ltd
  12039. + *
  12040. + * This program is free software; you can redistribute it and/or modify
  12041. + * it under the terms of the GNU General Public License as published by
  12042. + * the Free Software Foundation; either version 2 of the License, or
  12043. + * (at your option) any later version.
  12044. + *
  12045. + * This program is distributed in the hope that it will be useful,
  12046. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12047. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12048. + * GNU General Public License for more details.
  12049. + *
  12050. + *
  12051. + * Jan/20/2004 dgt NiosII
  12052. + *
  12053. + ---------------------------------------------------------------------*/
  12054. +
  12055. +
  12056. +/*
  12057. + * The nios cannot do unaligned accesses itself.
  12058. + */
  12059. +
  12060. +#define get_unaligned(ptr) ({ \
  12061. + typeof((*(ptr))) x; \
  12062. + memcpy(&x, (void*)ptr, sizeof(*(ptr))); \
  12063. + x; \
  12064. +})
  12065. +
  12066. +#define put_unaligned(val, ptr) ({ \
  12067. + typeof((*(ptr))) x = val; \
  12068. + memcpy((void*)ptr, &x, sizeof(*(ptr))); \
  12069. +})
  12070. +
  12071. +#endif /* __NIOS_UNALIGNED_H */
  12072. --- linux/include/asm-nios2nommu/unistd.h
  12073. +++ linux/include/asm-nios2nommu/unistd.h
  12074. @@ -0,0 +1,686 @@
  12075. +#ifndef _ASM_NIOS_UNISTD_H_
  12076. +#define _ASM_NIOS_UNISTD_H_
  12077. +
  12078. +/*--------------------------------------------------------------------
  12079. + *
  12080. + * include/asm-nios2nommu/unistd.h
  12081. + *
  12082. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  12083. + *
  12084. + * Copyright (C) 2004 Microtronix Datacom Ltd
  12085. + *
  12086. + * This program is free software; you can redistribute it and/or modify
  12087. + * it under the terms of the GNU General Public License as published by
  12088. + * the Free Software Foundation; either version 2 of the License, or
  12089. + * (at your option) any later version.
  12090. + *
  12091. + * This program is distributed in the hope that it will be useful,
  12092. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12093. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12094. + * GNU General Public License for more details.
  12095. + *
  12096. + *
  12097. + * //vic - kernel_thread moved to process.c
  12098. + * Jan/20/2004 dgt NiosII
  12099. + *
  12100. + ---------------------------------------------------------------------*/
  12101. +
  12102. +
  12103. +#include <asm/traps.h>
  12104. +
  12105. +/* TRAP isr expects the trap# (syscall=#TRAP_ID_SYSCALL) in r2,
  12106. + * the syscall # in r3, and arguments in r4, r5, ...
  12107. + * Return argument expected in r2.
  12108. + */
  12109. +
  12110. +#define __NR_restart_syscall 0
  12111. +#define __NR_exit 1
  12112. +#define __NR_fork 2
  12113. +#define __NR_read 3
  12114. +#define __NR_write 4
  12115. +#define __NR_open 5
  12116. +#define __NR_close 6
  12117. +#define __NR_waitpid 7
  12118. +#define __NR_creat 8
  12119. +#define __NR_link 9
  12120. +#define __NR_unlink 10
  12121. +#define __NR_execve 11
  12122. +#define __NR_chdir 12
  12123. +#define __NR_time 13
  12124. +#define __NR_mknod 14
  12125. +#define __NR_chmod 15
  12126. +#define __NR_chown 16
  12127. +#define __NR_break 17
  12128. +#define __NR_oldstat 18
  12129. +#define __NR_lseek 19
  12130. +#define __NR_getpid 20
  12131. +#define __NR_mount 21
  12132. +#define __NR_umount 22
  12133. +#define __NR_setuid 23
  12134. +#define __NR_getuid 24
  12135. +#define __NR_stime 25
  12136. +#define __NR_ptrace 26
  12137. +#define __NR_alarm 27
  12138. +#define __NR_oldfstat 28
  12139. +#define __NR_pause 29
  12140. +#define __NR_utime 30
  12141. +#define __NR_stty 31
  12142. +#define __NR_gtty 32
  12143. +#define __NR_access 33
  12144. +#define __NR_nice 34
  12145. +#define __NR_ftime 35
  12146. +#define __NR_sync 36
  12147. +#define __NR_kill 37
  12148. +#define __NR_rename 38
  12149. +#define __NR_mkdir 39
  12150. +#define __NR_rmdir 40
  12151. +#define __NR_dup 41
  12152. +#define __NR_pipe 42
  12153. +#define __NR_times 43
  12154. +#define __NR_prof 44
  12155. +#define __NR_brk 45
  12156. +#define __NR_setgid 46
  12157. +#define __NR_getgid 47
  12158. +#define __NR_signal 48
  12159. +#define __NR_geteuid 49
  12160. +#define __NR_getegid 50
  12161. +#define __NR_acct 51
  12162. +#define __NR_umount2 52 //vic #define __NR_phys 52
  12163. +#define __NR_lock 53
  12164. +#define __NR_ioctl 54
  12165. +#define __NR_fcntl 55
  12166. +#define __NR_mpx 56
  12167. +#define __NR_setpgid 57
  12168. +#define __NR_ulimit 58
  12169. +#define __NR_oldolduname 59
  12170. +#define __NR_umask 60
  12171. +#define __NR_chroot 61
  12172. +#define __NR_ustat 62
  12173. +#define __NR_dup2 63
  12174. +#define __NR_getppid 64
  12175. +#define __NR_getpgrp 65
  12176. +#define __NR_setsid 66
  12177. +#define __NR_sigaction 67
  12178. +#define __NR_sgetmask 68
  12179. +#define __NR_ssetmask 69
  12180. +#define __NR_setreuid 70
  12181. +#define __NR_setregid 71
  12182. +#define __NR_sigsuspend 72
  12183. +#define __NR_sigpending 73
  12184. +#define __NR_sethostname 74
  12185. +#define __NR_setrlimit 75
  12186. +#define __NR_getrlimit 76
  12187. +#define __NR_getrusage 77
  12188. +#define __NR_gettimeofday 78
  12189. +#define __NR_settimeofday 79
  12190. +#define __NR_getgroups 80
  12191. +#define __NR_setgroups 81
  12192. +#define __NR_select 82
  12193. +#define __NR_symlink 83
  12194. +#define __NR_oldlstat 84
  12195. +#define __NR_readlink 85
  12196. +#define __NR_uselib 86
  12197. +#define __NR_swapon 87
  12198. +#define __NR_reboot 88
  12199. +#define __NR_readdir 89
  12200. +#define __NR_mmap 90
  12201. +#define __NR_munmap 91
  12202. +#define __NR_truncate 92
  12203. +#define __NR_ftruncate 93
  12204. +#define __NR_fchmod 94
  12205. +#define __NR_fchown 95
  12206. +#define __NR_getpriority 96
  12207. +#define __NR_setpriority 97
  12208. +#define __NR_profil 98
  12209. +#define __NR_statfs 99
  12210. +#define __NR_fstatfs 100
  12211. +#define __NR_ioperm 101
  12212. +#define __NR_socketcall 102
  12213. +#define __NR_syslog 103
  12214. +#define __NR_setitimer 104
  12215. +#define __NR_getitimer 105
  12216. +#define __NR_stat 106
  12217. +#define __NR_lstat 107
  12218. +#define __NR_fstat 108
  12219. +#define __NR_olduname 109
  12220. +#define __NR_iopl /* 110 */ not supported
  12221. +#define __NR_vhangup 111
  12222. +#define __NR_idle /* 112 */ Obsolete
  12223. +#define __NR_vm86 /* 113 */ not supported
  12224. +#define __NR_wait4 114
  12225. +#define __NR_swapoff 115
  12226. +#define __NR_sysinfo 116
  12227. +#define __NR_ipc 117
  12228. +#define __NR_fsync 118
  12229. +#define __NR_sigreturn 119
  12230. +#define __NR_clone 120
  12231. +#define __NR_setdomainname 121
  12232. +#define __NR_uname 122
  12233. +#define __NR_cacheflush 123
  12234. +#define __NR_adjtimex 124
  12235. +#define __NR_mprotect 125
  12236. +#define __NR_sigprocmask 126
  12237. +#define __NR_create_module 127
  12238. +#define __NR_init_module 128
  12239. +#define __NR_delete_module 129
  12240. +#define __NR_get_kernel_syms 130
  12241. +#define __NR_quotactl 131
  12242. +#define __NR_getpgid 132
  12243. +#define __NR_fchdir 133
  12244. +#define __NR_bdflush 134
  12245. +#define __NR_sysfs 135
  12246. +#define __NR_personality 136
  12247. +#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
  12248. +#define __NR_setfsuid 138
  12249. +#define __NR_setfsgid 139
  12250. +#define __NR__llseek 140
  12251. +#define __NR_getdents 141
  12252. +#define __NR__newselect 142
  12253. +#define __NR_flock 143
  12254. +#define __NR_msync 144
  12255. +#define __NR_readv 145
  12256. +#define __NR_writev 146
  12257. +#define __NR_getsid 147
  12258. +#define __NR_fdatasync 148
  12259. +#define __NR__sysctl 149
  12260. +#define __NR_mlock 150
  12261. +#define __NR_munlock 151
  12262. +#define __NR_mlockall 152
  12263. +#define __NR_munlockall 153
  12264. +#define __NR_sched_setparam 154
  12265. +#define __NR_sched_getparam 155
  12266. +#define __NR_sched_setscheduler 156
  12267. +#define __NR_sched_getscheduler 157
  12268. +#define __NR_sched_yield 158
  12269. +#define __NR_sched_get_priority_max 159
  12270. +#define __NR_sched_get_priority_min 160
  12271. +#define __NR_sched_rr_get_interval 161
  12272. +#define __NR_nanosleep 162
  12273. +#define __NR_mremap 163
  12274. +#define __NR_setresuid 164
  12275. +#define __NR_getresuid 165
  12276. +#define __NR_getpagesize 166
  12277. +#define __NR_query_module 167
  12278. +#define __NR_poll 168
  12279. +#define __NR_nfsservctl 169
  12280. +#define __NR_setresgid 170
  12281. +#define __NR_getresgid 171
  12282. +#define __NR_prctl 172
  12283. +#define __NR_rt_sigreturn 173
  12284. +#define __NR_rt_sigaction 174
  12285. +#define __NR_rt_sigprocmask 175
  12286. +#define __NR_rt_sigpending 176
  12287. +#define __NR_rt_sigtimedwait 177
  12288. +#define __NR_rt_sigqueueinfo 178
  12289. +#define __NR_rt_sigsuspend 179
  12290. +#define __NR_pread 180
  12291. +#define __NR_pwrite 181
  12292. +#define __NR_lchown 182
  12293. +#define __NR_getcwd 183
  12294. +#define __NR_capget 184
  12295. +#define __NR_capset 185
  12296. +#define __NR_sigaltstack 186
  12297. +#define __NR_sendfile 187
  12298. +#define __NR_getpmsg 188 /* some people actually want streams */
  12299. +#define __NR_putpmsg 189 /* some people actually want streams */
  12300. +#define __NR_vfork 190
  12301. +#define __NR_ugetrlimit 191
  12302. +#define __NR_mmap2 192
  12303. +#define __NR_truncate64 193
  12304. +#define __NR_ftruncate64 194
  12305. +#define __NR_stat64 195
  12306. +#define __NR_lstat64 196
  12307. +#define __NR_fstat64 197
  12308. +#define __NR_chown32 198
  12309. +#define __NR_getuid32 199
  12310. +#define __NR_getgid32 200
  12311. +#define __NR_geteuid32 201
  12312. +#define __NR_getegid32 202
  12313. +#define __NR_setreuid32 203
  12314. +#define __NR_setregid32 204
  12315. +#define __NR_getgroups32 205
  12316. +#define __NR_setgroups32 206
  12317. +#define __NR_fchown32 207
  12318. +#define __NR_setresuid32 208
  12319. +#define __NR_getresuid32 209
  12320. +#define __NR_setresgid32 210
  12321. +#define __NR_getresgid32 211
  12322. +#define __NR_lchown32 212
  12323. +#define __NR_setuid32 213
  12324. +#define __NR_setgid32 214
  12325. +#define __NR_setfsuid32 215
  12326. +#define __NR_setfsgid32 216
  12327. +#define __NR_pivot_root 217
  12328. +/* 218 unused */
  12329. +/* 219 unused */
  12330. +#define __NR_getdents64 220
  12331. +#define __NR_gettid 221
  12332. +#define __NR_tkill 222
  12333. +#define __NR_setxattr 223
  12334. +#define __NR_lsetxattr 224
  12335. +#define __NR_fsetxattr 225
  12336. +#define __NR_getxattr 226
  12337. +#define __NR_lgetxattr 227
  12338. +#define __NR_fgetxattr 228
  12339. +#define __NR_listxattr 229
  12340. +#define __NR_llistxattr 230
  12341. +#define __NR_flistxattr 231
  12342. +#define __NR_removexattr 232
  12343. +#define __NR_lremovexattr 233
  12344. +#define __NR_fremovexattr 234
  12345. +#define __NR_futex 235
  12346. +#define __NR_sendfile64 236
  12347. +#define __NR_mincore 237
  12348. +#define __NR_madvise 238
  12349. +#define __NR_fcntl64 239
  12350. +#define __NR_readahead 240
  12351. +#define __NR_io_setup 241
  12352. +#define __NR_io_destroy 242
  12353. +#define __NR_io_getevents 243
  12354. +#define __NR_io_submit 244
  12355. +#define __NR_io_cancel 245
  12356. +#define __NR_fadvise64 246
  12357. +#define __NR_exit_group 247
  12358. +#define __NR_lookup_dcookie 248
  12359. +#define __NR_epoll_create 249
  12360. +#define __NR_epoll_ctl 250
  12361. +#define __NR_epoll_wait 251
  12362. +#define __NR_remap_file_pages 252
  12363. +#define __NR_set_tid_address 253
  12364. +#define __NR_timer_create 254
  12365. +#define __NR_timer_settime 255
  12366. +#define __NR_timer_gettime 256
  12367. +#define __NR_timer_getoverrun 257
  12368. +#define __NR_timer_delete 258
  12369. +#define __NR_clock_settime 259
  12370. +#define __NR_clock_gettime 260
  12371. +#define __NR_clock_getres 261
  12372. +#define __NR_clock_nanosleep 262
  12373. +#define __NR_statfs64 263
  12374. +#define __NR_fstatfs64 264
  12375. +#define __NR_tgkill 265
  12376. +#define __NR_utimes 266
  12377. +#define __NR_fadvise64_64 267
  12378. +#define __NR_mbind 268
  12379. +#define __NR_get_mempolicy 269
  12380. +#define __NR_set_mempolicy 270
  12381. +#define __NR_mq_open 271
  12382. +#define __NR_mq_unlink 272
  12383. +#define __NR_mq_timedsend 273
  12384. +#define __NR_mq_timedreceive 274
  12385. +#define __NR_mq_notify 275
  12386. +#define __NR_mq_getsetattr 276
  12387. +#define __NR_waitid 277
  12388. +#define __NR_sys_setaltroot 278
  12389. +#define __NR_add_key 279
  12390. +#define __NR_request_key 280
  12391. +#define __NR_keyctl 281
  12392. +
  12393. +#define NR_syscalls 282
  12394. +
  12395. +/* user-visible error numbers are in the range -1 - -122: see
  12396. + <asm-nios2nommu/errno.h> */
  12397. +
  12398. +#define __syscall_return(type, res) \
  12399. +do { \
  12400. + if ((unsigned long)(res) >= (unsigned long)(-125)) { \
  12401. + \
  12402. + /* avoid using res which is declared to be in \
  12403. + register r2; errno might expand to a function \
  12404. + call and clobber it. */ \
  12405. + \
  12406. + int __err = -(res); \
  12407. + errno = __err; \
  12408. + res = -1; \
  12409. + } \
  12410. + return (type) (res); \
  12411. +} while (0)
  12412. +
  12413. +#define _syscall0(type,name) \
  12414. +type name(void) \
  12415. +{ \
  12416. + long __res; \
  12417. + \
  12418. + __asm__ __volatile__ ( \
  12419. + \
  12420. + " \n\t" \
  12421. + \
  12422. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  12423. + " movi r3, %1\n\t" /* __NR_##name */ \
  12424. + \
  12425. + " trap\n\t" \
  12426. + " mov %0, r2\n\t" /* syscall rtn */ \
  12427. + \
  12428. + " \n\t" \
  12429. + \
  12430. + : "=r" (__res) /* %0 */ \
  12431. + \
  12432. + : "i" (__NR_##name) /* %1 */ \
  12433. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  12434. + \
  12435. + : "r2" /* Clobbered */ \
  12436. + , "r3" /* Clobbered */ \
  12437. + ); \
  12438. + \
  12439. +__syscall_return(type,__res); \
  12440. +}
  12441. +
  12442. +//;dgt2;tmp;can we RELY on syscall1 arg a
  12443. +//;dgt2;tmp; already being in r4 ?
  12444. +#define _syscall1(type,name,atype,a) \
  12445. +type name(atype a) \
  12446. +{ \
  12447. + long __res; \
  12448. + \
  12449. + __asm__ __volatile__ ( \
  12450. + \
  12451. + " \n\t" \
  12452. + \
  12453. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  12454. + " movi r3, %1\n\t" /* __NR_##name */ \
  12455. + " mov r4, %3\n\t" /* (long) a */ \
  12456. + \
  12457. + " trap\n\t" \
  12458. + " mov %0, r2\n\t" /* syscall rtn */ \
  12459. + \
  12460. + " \n\t" \
  12461. + \
  12462. + : "=r" (__res) /* %0 */ \
  12463. + \
  12464. + : "i" (__NR_##name) /* %1 */ \
  12465. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  12466. + , "r" ((long) a) /* %3 */ \
  12467. + \
  12468. + : "r2" /* Clobbered */ \
  12469. + , "r3" /* Clobbered */ \
  12470. + , "r4" /* Clobbered */ \
  12471. + ); \
  12472. + \
  12473. +__syscall_return(type,__res); \
  12474. +}
  12475. +
  12476. +//;dgt2;tmp;can we RELY on syscall2 args a,b
  12477. +//;dgt2;tmp; already being in r4,r5 ?
  12478. +#define _syscall2(type,name,atype,a,btype,b) \
  12479. +type name(atype a,btype b) \
  12480. +{ \
  12481. + long __res; \
  12482. + \
  12483. + __asm__ __volatile__ ( \
  12484. + \
  12485. + " \n\t" \
  12486. + \
  12487. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  12488. + " movi r3, %1\n\t" /* __NR_##name */ \
  12489. + " mov r4, %3\n\t" /* (long) a */ \
  12490. + " mov r5, %4\n\t" /* (long) b */ \
  12491. + \
  12492. + " trap\n\t" \
  12493. + " mov %0, r2\n\t" /* syscall rtn */ \
  12494. + \
  12495. + " \n\t" \
  12496. + \
  12497. + : "=r" (__res) /* %0 */ \
  12498. + \
  12499. + : "i" (__NR_##name) /* %1 */ \
  12500. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  12501. + , "r" ((long) a) /* %3 */ \
  12502. + , "r" ((long) b) /* %4 */ \
  12503. + \
  12504. + : "r2" /* Clobbered */ \
  12505. + , "r3" /* Clobbered */ \
  12506. + , "r4" /* Clobbered */ \
  12507. + , "r5" /* Clobbered */ \
  12508. + ); \
  12509. + \
  12510. +__syscall_return(type,__res); \
  12511. +}
  12512. +
  12513. +//;dgt2;tmp;can we RELY on syscall3 args a,b,c
  12514. +//;dgt2;tmp; already being in r4,r5,r6 ?
  12515. +#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
  12516. +type name(atype a,btype b,ctype c) \
  12517. +{ \
  12518. + long __res; \
  12519. + \
  12520. + __asm__ __volatile__ ( \
  12521. + \
  12522. + " \n\t" \
  12523. + \
  12524. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  12525. + " movi r3, %1\n\t" /* __NR_##name */ \
  12526. + " mov r4, %3\n\t" /* (long) a */ \
  12527. + " mov r5, %4\n\t" /* (long) b */ \
  12528. + " mov r6, %5\n\t" /* (long) c */ \
  12529. + \
  12530. + " trap\n\t" \
  12531. + " mov %0, r2\n\t" /* syscall rtn */ \
  12532. + \
  12533. + " \n\t" \
  12534. + \
  12535. + : "=r" (__res) /* %0 */ \
  12536. + \
  12537. + : "i" (__NR_##name) /* %1 */ \
  12538. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  12539. + , "r" ((long) a) /* %3 */ \
  12540. + , "r" ((long) b) /* %4 */ \
  12541. + , "r" ((long) c) /* %5 */ \
  12542. + \
  12543. + : "r2" /* Clobbered */ \
  12544. + , "r3" /* Clobbered */ \
  12545. + , "r4" /* Clobbered */ \
  12546. + , "r5" /* Clobbered */ \
  12547. + , "r6" /* Clobbered */ \
  12548. + ); \
  12549. + \
  12550. +__syscall_return(type,__res); \
  12551. +}
  12552. +
  12553. +//;dgt2;tmp;can we RELY on syscall4 args a,b,c,d
  12554. +//;dgt2;tmp; already being in r4,r5,r6,r7 ?
  12555. +#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
  12556. +type name (atype a, btype b, ctype c, dtype d) \
  12557. +{ \
  12558. + long __res; \
  12559. + \
  12560. + __asm__ __volatile__ ( \
  12561. + \
  12562. + " \n\t" \
  12563. + \
  12564. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  12565. + " movi r3, %1\n\t" /* __NR_##name */ \
  12566. + " mov r4, %3\n\t" /* (long) a */ \
  12567. + " mov r5, %4\n\t" /* (long) b */ \
  12568. + " mov r6, %5\n\t" /* (long) c */ \
  12569. + " mov r7, %6\n\t" /* (long) d */ \
  12570. + \
  12571. + " trap\n\t" \
  12572. + " mov %0, r2\n\t" /* syscall rtn */ \
  12573. + \
  12574. + " \n\t" \
  12575. + \
  12576. + : "=r" (__res) /* %0 */ \
  12577. + \
  12578. + : "i" (__NR_##name) /* %1 */ \
  12579. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  12580. + , "r" ((long) a) /* %3 */ \
  12581. + , "r" ((long) b) /* %4 */ \
  12582. + , "r" ((long) c) /* %5 */ \
  12583. + , "r" ((long) d) /* %6 */ \
  12584. + \
  12585. + : "r2" /* Clobbered */ \
  12586. + , "r3" /* Clobbered */ \
  12587. + , "r4" /* Clobbered */ \
  12588. + , "r5" /* Clobbered */ \
  12589. + , "r6" /* Clobbered */ \
  12590. + , "r7" /* Clobbered */ \
  12591. + ); \
  12592. + \
  12593. +__syscall_return(type,__res); \
  12594. +}
  12595. +
  12596. +//;dgt2;tmp;can we RELY on syscall5 args a,b,c,d
  12597. +//;dgt2;tmp; already being in r4,r5,r6,r7 ?
  12598. +#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
  12599. +type name (atype a,btype b,ctype c,dtype d,etype e) \
  12600. +{ \
  12601. + long __res; \
  12602. + \
  12603. + __asm__ __volatile__ ( \
  12604. + \
  12605. + " \n\t" \
  12606. + \
  12607. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  12608. + " movi r3, %1\n\t" /* __NR_##name */ \
  12609. + " mov r4, %3\n\t" /* (long) a */ \
  12610. + " mov r5, %4\n\t" /* (long) b */ \
  12611. + " mov r6, %5\n\t" /* (long) c */ \
  12612. + " mov r7, %6\n\t" /* (long) c */ \
  12613. + " mov r8, %7\n\t" /* (long) e */ \
  12614. + \
  12615. + " trap\n\t" \
  12616. + " mov %0, r2\n\t" /* syscall rtn */ \
  12617. + \
  12618. + " \n\t" \
  12619. + \
  12620. + : "=r" (__res) /* %0 */ \
  12621. + \
  12622. + : "i" (__NR_##name) /* %1 */ \
  12623. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  12624. + , "r" ((long) a) /* %3 */ \
  12625. + , "r" ((long) b) /* %4 */ \
  12626. + , "r" ((long) c) /* %5 */ \
  12627. + , "r" ((long) d) /* %6 */ \
  12628. + , "r" ((long) e) /* %7 */ \
  12629. + \
  12630. + : "r2" /* Clobbered */ \
  12631. + , "r3" /* Clobbered */ \
  12632. + , "r4" /* Clobbered */ \
  12633. + , "r5" /* Clobbered */ \
  12634. + , "r6" /* Clobbered */ \
  12635. + , "r7" /* Clobbered */ \
  12636. + , "r8" /* Clobbered */ \
  12637. + ); \
  12638. + \
  12639. +__syscall_return(type,__res); \
  12640. +}
  12641. +
  12642. +//;dgt2;tmp;can we RELY on syscall6 args a,b,c,d
  12643. +//;dgt2;tmp; already being in r4,r5,r6,r7 ?
  12644. +#define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
  12645. +type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
  12646. +{ \
  12647. + long __res; \
  12648. + \
  12649. + __asm__ __volatile__ ( \
  12650. + \
  12651. + " \n\t" \
  12652. + \
  12653. + " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
  12654. + " movi r3, %1\n\t" /* __NR_##name */ \
  12655. + " mov r4, %3\n\t" /* (long) a */ \
  12656. + " mov r5, %4\n\t" /* (long) b */ \
  12657. + " mov r6, %5\n\t" /* (long) c */ \
  12658. + " mov r7, %6\n\t" /* (long) c */ \
  12659. + " mov r8, %7\n\t" /* (long) e */ \
  12660. + " mov r9, %8\n\t" /* (long) f */ \
  12661. + \
  12662. + " trap\n\t" \
  12663. + " mov %0, r2\n\t" /* syscall rtn */ \
  12664. + \
  12665. + " \n\t" \
  12666. + \
  12667. + : "=r" (__res) /* %0 */ \
  12668. + \
  12669. + : "i" (__NR_##name) /* %1 */ \
  12670. + , "i" (TRAP_ID_SYSCALL) /* %2 */ \
  12671. + , "r" ((long) a) /* %3 */ \
  12672. + , "r" ((long) b) /* %4 */ \
  12673. + , "r" ((long) c) /* %5 */ \
  12674. + , "r" ((long) d) /* %6 */ \
  12675. + , "r" ((long) e) /* %7 */ \
  12676. + , "r" ((long) f) /* %8 */ \
  12677. + \
  12678. + : "r2" /* Clobbered */ \
  12679. + , "r3" /* Clobbered */ \
  12680. + , "r4" /* Clobbered */ \
  12681. + , "r5" /* Clobbered */ \
  12682. + , "r6" /* Clobbered */ \
  12683. + , "r7" /* Clobbered */ \
  12684. + , "r8" /* Clobbered */ \
  12685. + , "r9" /* Clobbered */ \
  12686. + ); \
  12687. + \
  12688. +__syscall_return(type,__res); \
  12689. +}
  12690. +
  12691. +#ifdef __KERNEL__
  12692. +#define __ARCH_WANT_IPC_PARSE_VERSION
  12693. +#define __ARCH_WANT_OLD_READDIR
  12694. +#define __ARCH_WANT_OLD_STAT
  12695. +#define __ARCH_WANT_STAT64
  12696. +#define __ARCH_WANT_SYS_ALARM
  12697. +#define __ARCH_WANT_SYS_GETHOSTNAME
  12698. +#define __ARCH_WANT_SYS_PAUSE
  12699. +#define __ARCH_WANT_SYS_SGETMASK
  12700. +#define __ARCH_WANT_SYS_SIGNAL
  12701. +#define __ARCH_WANT_SYS_TIME
  12702. +#define __ARCH_WANT_SYS_UTIME
  12703. +#define __ARCH_WANT_SYS_WAITPID
  12704. +#define __ARCH_WANT_SYS_SOCKETCALL
  12705. +#define __ARCH_WANT_SYS_FADVISE64
  12706. +#define __ARCH_WANT_SYS_GETPGRP
  12707. +#define __ARCH_WANT_SYS_LLSEEK
  12708. +#define __ARCH_WANT_SYS_NICE
  12709. +#define __ARCH_WANT_SYS_OLD_GETRLIMIT
  12710. +#define __ARCH_WANT_SYS_OLDUMOUNT
  12711. +#define __ARCH_WANT_SYS_SIGPENDING
  12712. +#define __ARCH_WANT_SYS_SIGPROCMASK
  12713. +#define __ARCH_WANT_SYS_RT_SIGACTION
  12714. +#endif
  12715. +
  12716. +#ifdef __KERNEL_SYSCALLS__
  12717. +
  12718. +/*
  12719. + * we need this inline - forking from kernel space will result
  12720. + * in NO COPY ON WRITE (!!!), until an execve is executed. This
  12721. + * is no problem, but for the stack. This is handled by not letting
  12722. + * main() use the stack at all after fork(). Thus, no function
  12723. + * calls - which means inline code for fork too, as otherwise we
  12724. + * would use the stack upon exit from 'fork()'.
  12725. + *
  12726. + * Actually only pause and fork are needed inline, so that there
  12727. + * won't be any messing with the stack from main(), but we define
  12728. + * some others too.
  12729. + */
  12730. +#define __NR__exit __NR_exit
  12731. +static inline _syscall0(int,pause)
  12732. +static inline _syscall0(int,sync)
  12733. +static inline _syscall0(pid_t,setsid)
  12734. +static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
  12735. +static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
  12736. +static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
  12737. +static inline _syscall1(int,dup,int,fd)
  12738. +static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
  12739. +static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
  12740. +static inline _syscall1(int,close,int,fd)
  12741. +static inline _syscall1(int,_exit,int,exitcode)
  12742. +static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
  12743. +static inline _syscall1(int,delete_module,const char *,name)
  12744. +
  12745. +static inline pid_t wait(int * wait_stat)
  12746. +{
  12747. + return waitpid(-1,wait_stat,0);
  12748. +}
  12749. +
  12750. +#endif
  12751. +
  12752. +/*
  12753. + * "Conditional" syscalls
  12754. + *
  12755. + * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
  12756. + * but it doesn't work on all toolchains, so we just do it by hand
  12757. + */
  12758. +#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
  12759. +
  12760. +#endif /* _ASM_NIOS_UNISTD_H_ */
  12761. --- linux/include/asm-nios2nommu/user.h
  12762. +++ linux/include/asm-nios2nommu/user.h
  12763. @@ -0,0 +1,112 @@
  12764. +#ifndef _NIOS2NOMMU_USER_H
  12765. +#define _NIOS2NOMMU_USER_H
  12766. +
  12767. +/*--------------------------------------------------------------------
  12768. + *
  12769. + * include/asm-nios2nommu/user.h
  12770. + *
  12771. + * Derived from M68knommu
  12772. + *
  12773. + * Copyright (C) 2004 Microtronix Datacom Ltd
  12774. + *
  12775. + * This program is free software; you can redistribute it and/or modify
  12776. + * it under the terms of the GNU General Public License as published by
  12777. + * the Free Software Foundation; either version 2 of the License, or
  12778. + * (at your option) any later version.
  12779. + *
  12780. + * This program is distributed in the hope that it will be useful,
  12781. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12782. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12783. + * GNU General Public License for more details.
  12784. + *
  12785. + *
  12786. + * Jan/20/2004 dgt NiosII
  12787. + *
  12788. + ---------------------------------------------------------------------*/
  12789. +
  12790. +
  12791. +#include <asm/page.h>
  12792. +
  12793. +/* Core file format: The core file is written in such a way that gdb
  12794. + can understand it and provide useful information to the user (under
  12795. + linux we use the 'trad-core' bfd). There are quite a number of
  12796. + obstacles to being able to view the contents of the floating point
  12797. + registers, and until these are solved you will not be able to view the
  12798. + contents of them. Actually, you can read in the core file and look at
  12799. + the contents of the user struct to find out what the floating point
  12800. + registers contain.
  12801. + The actual file contents are as follows:
  12802. + UPAGE: 1 page consisting of a user struct that tells gdb what is present
  12803. + in the file. Directly after this is a copy of the task_struct, which
  12804. + is currently not used by gdb, but it may come in useful at some point.
  12805. + All of the registers are stored as part of the upage. The upage should
  12806. + always be only one page.
  12807. + DATA: The data area is stored. We use current->end_text to
  12808. + current->brk to pick up all of the user variables, plus any memory
  12809. + that may have been malloced. No attempt is made to determine if a page
  12810. + is demand-zero or if a page is totally unused, we just cover the entire
  12811. + range. All of the addresses are rounded in such a way that an integral
  12812. + number of pages is written.
  12813. + STACK: We need the stack information in order to get a meaningful
  12814. + backtrace. We need to write the data from (esp) to
  12815. + current->start_stack, so we round each of these off in order to be able
  12816. + to write an integer number of pages.
  12817. + The minimum core file size is 3 pages, or 12288 bytes.
  12818. +*/
  12819. +
  12820. +struct user_m68kfp_struct {
  12821. + unsigned long fpregs[8*3]; /* fp0-fp7 registers */
  12822. + unsigned long fpcntl[3]; /* fp control regs */
  12823. +};
  12824. +
  12825. +/* This is needs more work, probably should look like gdb useage */
  12826. +struct user_regs_struct {
  12827. + long r1,r2,r3,r4,r5,r6,r7,r8;
  12828. + long r9,r10,r11,r12,r13,r14,r15;
  12829. + long r16,r17,r18,r19,r20,r21,r22,r23;
  12830. + long gp;
  12831. + long sp;
  12832. + long ra;
  12833. + long fp;
  12834. + long orig_r2;
  12835. + long estatus;
  12836. + long status_extension;
  12837. + long ea;
  12838. +};
  12839. +
  12840. +
  12841. +/* When the kernel dumps core, it starts by dumping the user struct -
  12842. + this will be used by gdb to figure out where the data and stack segments
  12843. + are within the file, and what virtual addresses to use. */
  12844. +struct user{
  12845. +/* We start with the registers, to mimic the way that "memory" is returned
  12846. + from the ptrace(3,...) function. */
  12847. + struct user_regs_struct regs; /* Where the registers are actually stored */
  12848. +/* ptrace does not yet supply these. Someday.... */
  12849. + int u_fpvalid; /* True if math co-processor being used. */
  12850. + /* for this mess. Not yet used. */
  12851. + struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
  12852. +/* The rest of this junk is to help gdb figure out what goes where */
  12853. + unsigned long int u_tsize; /* Text segment size (pages). */
  12854. + unsigned long int u_dsize; /* Data segment size (pages). */
  12855. + unsigned long int u_ssize; /* Stack segment size (pages). */
  12856. + unsigned long start_code; /* Starting virtual address of text. */
  12857. + unsigned long start_stack; /* Starting virtual address of stack area.
  12858. + This is actually the bottom of the stack,
  12859. + the top of the stack is always found in the
  12860. + esp register. */
  12861. + long int signal; /* Signal that caused the core dump. */
  12862. + int reserved; /* No longer used */
  12863. + struct user_regs_struct *u_ar0;
  12864. + /* Used by gdb to help find the values for */
  12865. + /* the registers. */
  12866. + struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */
  12867. + unsigned long magic; /* To uniquely identify a core file */
  12868. + char u_comm[32]; /* User command that was responsible */
  12869. +};
  12870. +#define NBPG PAGE_SIZE
  12871. +#define UPAGES 1
  12872. +#define HOST_TEXT_START_ADDR (u.start_code)
  12873. +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
  12874. +
  12875. +#endif
  12876. --- linux/include/asm-nios2nommu/virtconvert.h
  12877. +++ linux/include/asm-nios2nommu/virtconvert.h
  12878. @@ -0,0 +1,47 @@
  12879. +#ifndef __NIOS_VIRT_CONVERT__
  12880. +#define __NIOS_VIRT_CONVERT__
  12881. +
  12882. +/*--------------------------------------------------------------------
  12883. + *
  12884. + * include/asm-nios2nommu/virtconvert.h
  12885. + *
  12886. + * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
  12887. + *
  12888. + * Copyright (C) 2004 Microtronix Datacom Ltd
  12889. + *
  12890. + * This program is free software; you can redistribute it and/or modify
  12891. + * it under the terms of the GNU General Public License as published by
  12892. + * the Free Software Foundation; either version 2 of the License, or
  12893. + * (at your option) any later version.
  12894. + *
  12895. + * This program is distributed in the hope that it will be useful,
  12896. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12897. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12898. + * GNU General Public License for more details.
  12899. + *
  12900. + *
  12901. + * Jan/20/2004 dgt NiosII
  12902. + *
  12903. + ---------------------------------------------------------------------*/
  12904. +
  12905. +
  12906. +/*
  12907. + * Macros used for converting between virtual and physical mappings.
  12908. + */
  12909. +
  12910. +#ifdef __KERNEL__
  12911. +
  12912. +// #include <linux/config.h>
  12913. +#include <asm/setup.h>
  12914. +#include <asm/page.h>
  12915. +
  12916. +#define mm_ptov(vaddr) ((void *) (vaddr))
  12917. +#define mm_vtop(vaddr) ((unsigned long) (vaddr))
  12918. +#define phys_to_virt(vaddr) ((void *) (vaddr))
  12919. +#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
  12920. +
  12921. +#define virt_to_bus virt_to_phys
  12922. +#define bus_to_virt phys_to_virt
  12923. +
  12924. +#endif /*__KERNEL__ */
  12925. +#endif /*__NIOS_VIRT_CONVERT__*/