summaryrefslogtreecommitdiffstats
path: root/cpu
diff options
context:
space:
mode:
authorSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-21 09:10:08 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-21 09:10:08 +0200
commita586aa0ce0c9561356d58ff6f7325d78cd9d1804 (patch)
treee3678c5a900c5088f5789016f2b94a12641f75ef /cpu
parentc97a04cc312e1d066c4977fddc3cb02202b6dbea (diff)
downloadbarebox-a586aa0ce0c9561356d58ff6f7325d78cd9d1804.tar.gz
barebox-a586aa0ce0c9561356d58ff6f7325d78cd9d1804.tar.xz
remove old /cpu directory
Diffstat (limited to 'cpu')
-rw-r--r--cpu/74xx_7xx/Makefile51
-rw-r--r--cpu/74xx_7xx/cache.S381
-rw-r--r--cpu/74xx_7xx/config.mk26
-rw-r--r--cpu/74xx_7xx/cpu.c291
-rw-r--r--cpu/74xx_7xx/cpu_init.c62
-rw-r--r--cpu/74xx_7xx/interrupts.c105
-rw-r--r--cpu/74xx_7xx/io.S128
-rw-r--r--cpu/74xx_7xx/kgdb.S77
-rw-r--r--cpu/74xx_7xx/speed.c139
-rw-r--r--cpu/74xx_7xx/start.S900
-rw-r--r--cpu/74xx_7xx/traps.c236
-rw-r--r--cpu/arm1136/Makefile47
-rw-r--r--cpu/arm1136/start.S417
-rw-r--r--cpu/arm720t/Makefile47
-rw-r--r--cpu/arm720t/start.S542
-rw-r--r--cpu/arm920t/Makefile3
-rw-r--r--cpu/arm920t/at91rm9200/Makefile9
-rw-r--r--cpu/arm920t/at91rm9200/bcm5221.c224
-rw-r--r--cpu/arm920t/at91rm9200/dm9161.c216
-rw-r--r--cpu/arm920t/at91rm9200/i2c.c196
-rw-r--r--cpu/arm920t/at91rm9200/interrupts.c124
-rw-r--r--cpu/arm920t/at91rm9200/lowlevel_init.S205
-rw-r--r--cpu/arm920t/at91rm9200/lxt972.c183
-rw-r--r--cpu/arm920t/ks8695/Makefile46
-rw-r--r--cpu/arm920t/ks8695/interrupts.c98
-rw-r--r--cpu/arm920t/ks8695/lowlevel_init.S205
-rw-r--r--cpu/arm920t/s3c24x0/Makefile46
-rw-r--r--cpu/arm920t/s3c24x0/i2c.c441
-rw-r--r--cpu/arm920t/s3c24x0/interrupts.c153
-rw-r--r--cpu/arm920t/s3c24x0/speed.c101
-rw-r--r--cpu/arm925t/Makefile47
-rw-r--r--cpu/arm925t/omap925.c39
-rw-r--r--cpu/arm925t/start.S429
-rw-r--r--cpu/arm926ejs/Makefile47
-rw-r--r--cpu/arm926ejs/cpuinfo.c244
-rw-r--r--cpu/arm926ejs/omap/Makefile47
-rw-r--r--cpu/arm926ejs/omap/reset.S45
-rw-r--r--cpu/arm926ejs/omap/timer.c108
-rw-r--r--cpu/arm926ejs/versatile/Makefile47
-rw-r--r--cpu/arm926ejs/versatile/reset.S45
-rw-r--r--cpu/arm926ejs/versatile/timer.c106
-rw-r--r--cpu/arm946es/Makefile47
-rw-r--r--cpu/arm946es/start.S409
-rw-r--r--cpu/arm_intcm/Makefile47
-rw-r--r--cpu/at32ap/Makefile50
-rw-r--r--cpu/at32ap/at32ap7000/Makefile43
-rw-r--r--cpu/at32ap/at32ap7000/devices.c448
-rw-r--r--cpu/at32ap/at32ap7000/hebi.c38
-rw-r--r--cpu/at32ap/cache.c97
-rw-r--r--cpu/at32ap/config.mk22
-rw-r--r--cpu/at32ap/cpu.c83
-rw-r--r--cpu/at32ap/device.c126
-rw-r--r--cpu/at32ap/entry.S65
-rw-r--r--cpu/at32ap/exception.c119
-rw-r--r--cpu/at32ap/hsdramc.c155
-rw-r--r--cpu/at32ap/hsdramc1.h143
-rw-r--r--cpu/at32ap/hsmc3.h126
-rw-r--r--cpu/at32ap/interrupts.c117
-rw-r--r--cpu/at32ap/pio.c94
-rw-r--r--cpu/at32ap/pio2.h44
-rw-r--r--cpu/at32ap/pm.c163
-rw-r--r--cpu/at32ap/sm.h204
-rw-r--r--cpu/at32ap/start.S113
-rw-r--r--cpu/i386/Makefile51
-rw-r--r--cpu/i386/config.mk26
-rw-r--r--cpu/i386/cpu.c66
-rw-r--r--cpu/i386/interrupts.c525
-rw-r--r--cpu/i386/reset.S37
-rw-r--r--cpu/i386/sc520.c481
-rw-r--r--cpu/i386/sc520_asm.S584
-rw-r--r--cpu/i386/serial.c503
-rw-r--r--cpu/i386/start.S196
-rw-r--r--cpu/i386/start16.S112
-rw-r--r--cpu/i386/timer.c103
-rw-r--r--cpu/ixp/Makefile47
-rw-r--r--cpu/ixp/config.mk37
-rw-r--r--cpu/ixp/cpu.c111
-rw-r--r--cpu/ixp/interrupts.c249
-rw-r--r--cpu/ixp/npe/IxEthAcc.c261
-rw-r--r--cpu/ixp/npe/IxEthAccCommon.c1049
-rw-r--r--cpu/ixp/npe/IxEthAccControlInterface.c533
-rw-r--r--cpu/ixp/npe/IxEthAccDataPlane.c2483
-rw-r--r--cpu/ixp/npe/IxEthAccMac.c2641
-rw-r--r--cpu/ixp/npe/IxEthAccMii.c410
-rw-r--r--cpu/ixp/npe/IxEthDBAPI.c448
-rw-r--r--cpu/ixp/npe/IxEthDBAPISupport.c650
-rw-r--r--cpu/ixp/npe/IxEthDBCore.c463
-rw-r--r--cpu/ixp/npe/IxEthDBEvents.c520
-rw-r--r--cpu/ixp/npe/IxEthDBFeatures.c662
-rw-r--r--cpu/ixp/npe/IxEthDBFirewall.c266
-rw-r--r--cpu/ixp/npe/IxEthDBHashtable.c642
-rw-r--r--cpu/ixp/npe/IxEthDBLearning.c149
-rw-r--r--cpu/ixp/npe/IxEthDBMem.c649
-rw-r--r--cpu/ixp/npe/IxEthDBNPEAdaptor.c719
-rw-r--r--cpu/ixp/npe/IxEthDBPortUpdate.c740
-rw-r--r--cpu/ixp/npe/IxEthDBReports.c652
-rw-r--r--cpu/ixp/npe/IxEthDBSearch.c327
-rw-r--r--cpu/ixp/npe/IxEthDBSpanningTree.c107
-rw-r--r--cpu/ixp/npe/IxEthDBUtil.c120
-rw-r--r--cpu/ixp/npe/IxEthDBVlan.c1179
-rw-r--r--cpu/ixp/npe/IxEthDBWiFi.c480
-rw-r--r--cpu/ixp/npe/IxEthMii.c497
-rw-r--r--cpu/ixp/npe/IxFeatureCtrl.c422
-rw-r--r--cpu/ixp/npe/IxNpeDl.c972
-rw-r--r--cpu/ixp/npe/IxNpeDlImageMgr.c675
-rw-r--r--cpu/ixp/npe/IxNpeDlNpeMgr.c936
-rw-r--r--cpu/ixp/npe/IxNpeDlNpeMgrUtils.c806
-rw-r--r--cpu/ixp/npe/IxNpeMh.c582
-rw-r--r--cpu/ixp/npe/IxNpeMhConfig.c608
-rw-r--r--cpu/ixp/npe/IxNpeMhReceive.c320
-rw-r--r--cpu/ixp/npe/IxNpeMhSend.c307
-rw-r--r--cpu/ixp/npe/IxNpeMhSolicitedCbMgr.c358
-rw-r--r--cpu/ixp/npe/IxNpeMhUnsolicitedCbMgr.c246
-rw-r--r--cpu/ixp/npe/IxOsalBufferMgt.c800
-rw-r--r--cpu/ixp/npe/IxOsalIoMem.c332
-rw-r--r--cpu/ixp/npe/IxOsalOsCacheMMU.c67
-rw-r--r--cpu/ixp/npe/IxOsalOsMsgQ.c79
-rw-r--r--cpu/ixp/npe/IxOsalOsSemaphore.c233
-rw-r--r--cpu/ixp/npe/IxOsalOsServices.c243
-rw-r--r--cpu/ixp/npe/IxOsalOsThread.c98
-rw-r--r--cpu/ixp/npe/IxQMgrAqmIf.c963
-rw-r--r--cpu/ixp/npe/IxQMgrDispatcher.c1347
-rw-r--r--cpu/ixp/npe/IxQMgrInit.c233
-rw-r--r--cpu/ixp/npe/IxQMgrQAccess.c796
-rw-r--r--cpu/ixp/npe/IxQMgrQCfg.c543
-rw-r--r--cpu/ixp/npe/Makefile100
-rw-r--r--cpu/ixp/npe/include/IxAssert.h71
-rw-r--r--cpu/ixp/npe/include/IxAtmSch.h504
-rw-r--r--cpu/ixp/npe/include/IxAtmTypes.h409
-rw-r--r--cpu/ixp/npe/include/IxAtmdAcc.h1194
-rw-r--r--cpu/ixp/npe/include/IxAtmdAccCtrl.h1958
-rw-r--r--cpu/ixp/npe/include/IxAtmm.h795
-rw-r--r--cpu/ixp/npe/include/IxDmaAcc.h260
-rw-r--r--cpu/ixp/npe/include/IxEthAcc.h2512
-rw-r--r--cpu/ixp/npe/include/IxEthAccDataPlane_p.h233
-rw-r--r--cpu/ixp/npe/include/IxEthAccMac_p.h248
-rw-r--r--cpu/ixp/npe/include/IxEthAccMii_p.h97
-rw-r--r--cpu/ixp/npe/include/IxEthAccQueueAssign_p.h137
-rw-r--r--cpu/ixp/npe/include/IxEthAcc_p.h325
-rw-r--r--cpu/ixp/npe/include/IxEthDB.h2373
-rw-r--r--cpu/ixp/npe/include/IxEthDBLocks_p.h122
-rw-r--r--cpu/ixp/npe/include/IxEthDBLog_p.h227
-rw-r--r--cpu/ixp/npe/include/IxEthDBMessages_p.h258
-rw-r--r--cpu/ixp/npe/include/IxEthDBPortDefs.h163
-rw-r--r--cpu/ixp/npe/include/IxEthDBQoS.h154
-rw-r--r--cpu/ixp/npe/include/IxEthDB_p.h712
-rw-r--r--cpu/ixp/npe/include/IxEthMii.h270
-rw-r--r--cpu/ixp/npe/include/IxEthMii_p.h185
-rw-r--r--cpu/ixp/npe/include/IxEthNpe.h695
-rw-r--r--cpu/ixp/npe/include/IxFeatureCtrl.h742
-rw-r--r--cpu/ixp/npe/include/IxHssAcc.h1316
-rw-r--r--cpu/ixp/npe/include/IxI2cDrv.h867
-rw-r--r--cpu/ixp/npe/include/IxNpeA.h782
-rw-r--r--cpu/ixp/npe/include/IxNpeDl.h980
-rw-r--r--cpu/ixp/npe/include/IxNpeDlImageMgr_p.h363
-rw-r--r--cpu/ixp/npe/include/IxNpeDlMacros_p.h414
-rw-r--r--cpu/ixp/npe/include/IxNpeDlNpeMgrEcRegisters_p.h893
-rw-r--r--cpu/ixp/npe/include/IxNpeDlNpeMgrUtils_p.h405
-rw-r--r--cpu/ixp/npe/include/IxNpeDlNpeMgr_p.h260
-rw-r--r--cpu/ixp/npe/include/IxNpeMh.h497
-rw-r--r--cpu/ixp/npe/include/IxNpeMhConfig_p.h555
-rw-r--r--cpu/ixp/npe/include/IxNpeMhMacros_p.h296
-rw-r--r--cpu/ixp/npe/include/IxNpeMhReceive_p.h139
-rw-r--r--cpu/ixp/npe/include/IxNpeMhSend_p.h163
-rw-r--r--cpu/ixp/npe/include/IxNpeMhSolicitedCbMgr_p.h171
-rw-r--r--cpu/ixp/npe/include/IxNpeMhUnsolicitedCbMgr_p.h169
-rw-r--r--cpu/ixp/npe/include/IxNpeMicrocode.h296
-rw-r--r--cpu/ixp/npe/include/IxOsBufLib.h55
-rw-r--r--cpu/ixp/npe/include/IxOsBuffMgt.h52
-rw-r--r--cpu/ixp/npe/include/IxOsBuffPoolMgt.h74
-rw-r--r--cpu/ixp/npe/include/IxOsCacheMMU.h60
-rw-r--r--cpu/ixp/npe/include/IxOsPrintf.h102
-rw-r--r--cpu/ixp/npe/include/IxOsServices.h55
-rw-r--r--cpu/ixp/npe/include/IxOsServicesComponents.h134
-rw-r--r--cpu/ixp/npe/include/IxOsServicesEndianess.h52
-rw-r--r--cpu/ixp/npe/include/IxOsServicesMemAccess.h52
-rw-r--r--cpu/ixp/npe/include/IxOsServicesMemMap.h54
-rw-r--r--cpu/ixp/npe/include/IxOsal.h1517
-rw-r--r--cpu/ixp/npe/include/IxOsalAssert.h81
-rw-r--r--cpu/ixp/npe/include/IxOsalBackward.h65
-rw-r--r--cpu/ixp/npe/include/IxOsalBackwardAssert.h54
-rw-r--r--cpu/ixp/npe/include/IxOsalBackwardBufferMgt.h159
-rw-r--r--cpu/ixp/npe/include/IxOsalBackwardCacheMMU.h69
-rw-r--r--cpu/ixp/npe/include/IxOsalBackwardMemMap.h141
-rw-r--r--cpu/ixp/npe/include/IxOsalBackwardOsServices.h125
-rw-r--r--cpu/ixp/npe/include/IxOsalBackwardOssl.h272
-rw-r--r--cpu/ixp/npe/include/IxOsalBufferMgt.h621
-rw-r--r--cpu/ixp/npe/include/IxOsalBufferMgtDefault.h88
-rw-r--r--cpu/ixp/npe/include/IxOsalConfig.h76
-rw-r--r--cpu/ixp/npe/include/IxOsalEndianess.h134
-rw-r--r--cpu/ixp/npe/include/IxOsalIoMem.h322
-rw-r--r--cpu/ixp/npe/include/IxOsalMemAccess.h459
-rw-r--r--cpu/ixp/npe/include/IxOsalOem.h97
-rw-r--r--cpu/ixp/npe/include/IxOsalOs.h30
-rw-r--r--cpu/ixp/npe/include/IxOsalOsAssert.h10
-rw-r--r--cpu/ixp/npe/include/IxOsalOsBufferMgt.h59
-rw-r--r--cpu/ixp/npe/include/IxOsalOsIxp400.h316
-rw-r--r--cpu/ixp/npe/include/IxOsalOsIxp400CustomizedMapping.h404
-rw-r--r--cpu/ixp/npe/include/IxOsalOsTypes.h45
-rw-r--r--cpu/ixp/npe/include/IxOsalOsUtilitySymbols.h4
-rw-r--r--cpu/ixp/npe/include/IxOsalTypes.h401
-rw-r--r--cpu/ixp/npe/include/IxOsalUtilitySymbols.h51
-rw-r--r--cpu/ixp/npe/include/IxParityENAcc.h785
-rw-r--r--cpu/ixp/npe/include/IxPerfProfAcc.h1358
-rw-r--r--cpu/ixp/npe/include/IxQMgr.h2210
-rw-r--r--cpu/ixp/npe/include/IxQMgrAqmIf_p.h927
-rw-r--r--cpu/ixp/npe/include/IxQMgrDefines_p.h55
-rw-r--r--cpu/ixp/npe/include/IxQMgrDispatcher_p.h106
-rw-r--r--cpu/ixp/npe/include/IxQMgrLog_p.h124
-rw-r--r--cpu/ixp/npe/include/IxQMgrQAccess_p.h96
-rw-r--r--cpu/ixp/npe/include/IxQMgrQCfg_p.h122
-rw-r--r--cpu/ixp/npe/include/IxQueueAssignments.h516
-rw-r--r--cpu/ixp/npe/include/IxSspAcc.h1271
-rw-r--r--cpu/ixp/npe/include/IxTimeSyncAcc.h783
-rw-r--r--cpu/ixp/npe/include/IxTimerCtrl.h263
-rw-r--r--cpu/ixp/npe/include/IxTypes.h86
-rw-r--r--cpu/ixp/npe/include/IxUART.h458
-rw-r--r--cpu/ixp/npe/include/IxVersionId.h155
-rw-r--r--cpu/ixp/npe/include/ix_error.h66
-rw-r--r--cpu/ixp/npe/include/ix_macros.h266
-rw-r--r--cpu/ixp/npe/include/ix_os_type.h65
-rw-r--r--cpu/ixp/npe/include/ix_ossl.h160
-rw-r--r--cpu/ixp/npe/include/ix_symbols.h106
-rw-r--r--cpu/ixp/npe/include/ix_types.h208
-rw-r--r--cpu/ixp/npe/include/npe.h90
-rw-r--r--cpu/ixp/npe/include/os_datatypes.h82
-rw-r--r--cpu/ixp/npe/miiphy.c118
-rw-r--r--cpu/ixp/npe/npe.c635
-rw-r--r--cpu/ixp/pci.c575
-rw-r--r--cpu/ixp/start.S519
-rw-r--r--cpu/ixp/timer.c78
-rw-r--r--cpu/lh7a40x/Makefile47
-rw-r--r--cpu/lh7a40x/config.mk34
-rw-r--r--cpu/lh7a40x/cpu.c183
-rw-r--r--cpu/lh7a40x/interrupts.c250
-rw-r--r--cpu/lh7a40x/speed.c83
-rw-r--r--cpu/lh7a40x/start.S428
-rw-r--r--cpu/mcf52x2/Makefile49
-rw-r--r--cpu/mcf52x2/config.mk27
-rw-r--r--cpu/mcf52x2/cpu.c205
-rw-r--r--cpu/mcf52x2/cpu_init.c466
-rw-r--r--cpu/mcf52x2/interrupts.c193
-rw-r--r--cpu/mcf52x2/speed.c41
-rw-r--r--cpu/mcf52x2/start.S434
-rw-r--r--cpu/microblaze/Makefile47
-rw-r--r--cpu/microblaze/cpu.c25
-rw-r--r--cpu/microblaze/interrupts.c32
-rw-r--r--cpu/microblaze/start.S36
-rw-r--r--cpu/mips/Makefile49
-rw-r--r--cpu/mips/au1x00_eth.c311
-rw-r--r--cpu/mips/cache.S269
-rw-r--r--cpu/mips/config.mk40
-rw-r--r--cpu/mips/cpu.c54
-rw-r--r--cpu/mips/incaip_clock.c116
-rw-r--r--cpu/mips/incaip_wdt.S72
-rw-r--r--cpu/mips/interrupts.c33
-rw-r--r--cpu/mips/start.S390
-rw-r--r--cpu/mpc5xx/Makefile59
-rw-r--r--cpu/mpc5xx/config.mk33
-rw-r--r--cpu/mpc5xx/cpu.c171
-rw-r--r--cpu/mpc5xx/cpu_init.c123
-rw-r--r--cpu/mpc5xx/interrupts.c196
-rw-r--r--cpu/mpc5xx/reginfo.c37
-rw-r--r--cpu/mpc5xx/speed.c67
-rw-r--r--cpu/mpc5xx/spi.c412
-rw-r--r--cpu/mpc5xx/start.S602
-rw-r--r--cpu/mpc5xx/traps.c230
-rw-r--r--cpu/mpc5xxx/Makefile14
-rw-r--r--cpu/mpc5xxx/cpu.c123
-rw-r--r--cpu/mpc5xxx/cpu_init.c201
-rw-r--r--cpu/mpc5xxx/firmware_sc_task.impl.S364
-rw-r--r--cpu/mpc5xxx/firmware_sc_task_bestcomm.impl.S361
-rw-r--r--cpu/mpc5xxx/ide.c88
-rw-r--r--cpu/mpc5xxx/interrupts.c349
-rw-r--r--cpu/mpc5xxx/io.S128
-rw-r--r--cpu/mpc5xxx/loadtask.c77
-rw-r--r--cpu/mpc5xxx/pci_mpc5200.c187
-rw-r--r--cpu/mpc5xxx/reginfo.c59
-rw-r--r--cpu/mpc5xxx/speed.c107
-rw-r--r--cpu/mpc5xxx/start.S797
-rw-r--r--cpu/mpc5xxx/traps.c229
-rw-r--r--cpu/mpc8220/Makefile50
-rw-r--r--cpu/mpc8220/config.mk27
-rw-r--r--cpu/mpc8220/cpu.c120
-rw-r--r--cpu/mpc8220/cpu_init.c136
-rw-r--r--cpu/mpc8220/dma.h68
-rw-r--r--cpu/mpc8220/dramSetup.c752
-rw-r--r--cpu/mpc8220/dramSetup.h108
-rw-r--r--cpu/mpc8220/fec.c988
-rw-r--r--cpu/mpc8220/fec.h283
-rw-r--r--cpu/mpc8220/fec_dma_tasks.S363
-rw-r--r--cpu/mpc8220/i2c.c404
-rw-r--r--cpu/mpc8220/i2cCore.c618
-rw-r--r--cpu/mpc8220/i2cCore.h103
-rw-r--r--cpu/mpc8220/interrupts.c80
-rw-r--r--cpu/mpc8220/io.S128
-rw-r--r--cpu/mpc8220/loadtask.c78
-rw-r--r--cpu/mpc8220/pci.c191
-rw-r--r--cpu/mpc8220/speed.c119
-rw-r--r--cpu/mpc8220/start.S773
-rw-r--r--cpu/mpc8220/traps.c222
-rw-r--r--cpu/mpc8220/uart.c126
-rw-r--r--cpu/mpc824x/Makefile56
-rw-r--r--cpu/mpc824x/config.mk26
-rw-r--r--cpu/mpc824x/cpu.c280
-rw-r--r--cpu/mpc824x/cpu_init.c388
-rw-r--r--cpu/mpc824x/drivers/epic.h1
-rw-r--r--cpu/mpc824x/drivers/epic/README102
-rw-r--r--cpu/mpc824x/drivers/epic/epic.h163
-rw-r--r--cpu/mpc824x/drivers/epic/epic1.c517
-rw-r--r--cpu/mpc824x/drivers/epic/epic2.S196
-rw-r--r--cpu/mpc824x/drivers/epic/epicutil.S57
-rw-r--r--cpu/mpc824x/drivers/errors.h212
-rw-r--r--cpu/mpc824x/drivers/i2c/i2c.c284
-rw-r--r--cpu/mpc824x/drivers/i2c_export.h103
-rw-r--r--cpu/mpc824x/interrupts.c93
-rw-r--r--cpu/mpc824x/pci.c78
-rw-r--r--cpu/mpc824x/speed.c118
-rw-r--r--cpu/mpc824x/start.S771
-rw-r--r--cpu/mpc824x/traps.c200
-rw-r--r--cpu/mpc8260/Makefile49
-rw-r--r--cpu/mpc8260/bedbug_603e.c237
-rw-r--r--cpu/mpc8260/commproc.c221
-rw-r--r--cpu/mpc8260/config.mk27
-rw-r--r--cpu/mpc8260/cpu.c296
-rw-r--r--cpu/mpc8260/cpu_init.c292
-rw-r--r--cpu/mpc8260/i2c.c768
-rw-r--r--cpu/mpc8260/interrupts.c279
-rw-r--r--cpu/mpc8260/kgdb.S71
-rw-r--r--cpu/mpc8260/pci.c453
-rw-r--r--cpu/mpc8260/speed.c240
-rw-r--r--cpu/mpc8260/speed.h54
-rw-r--r--cpu/mpc8260/spi.c435
-rw-r--r--cpu/mpc8260/start.S1045
-rw-r--r--cpu/mpc8260/traps.c257
-rw-r--r--cpu/mpc83xx/Makefile50
-rw-r--r--cpu/mpc83xx/config.mk26
-rw-r--r--cpu/mpc83xx/cpu.c399
-rw-r--r--cpu/mpc83xx/cpu_init.c222
-rw-r--r--cpu/mpc83xx/interrupts.c97
-rw-r--r--cpu/mpc83xx/qe_io.c85
-rw-r--r--cpu/mpc83xx/spd_sdram.c620
-rw-r--r--cpu/mpc83xx/speed.c374
-rw-r--r--cpu/mpc83xx/start.S1274
-rw-r--r--cpu/mpc83xx/traps.c235
-rw-r--r--cpu/mpc85xx/Makefile51
-rw-r--r--cpu/mpc85xx/commproc.c208
-rw-r--r--cpu/mpc85xx/config.mk26
-rw-r--r--cpu/mpc85xx/cpu.c277
-rw-r--r--cpu/mpc85xx/cpu_init.c238
-rw-r--r--cpu/mpc85xx/interrupts.c162
-rw-r--r--cpu/mpc85xx/pci.c242
-rw-r--r--cpu/mpc85xx/resetvec.S2
-rw-r--r--cpu/mpc85xx/spd_sdram.c1094
-rw-r--r--cpu/mpc85xx/speed.c124
-rw-r--r--cpu/mpc85xx/start.S1147
-rw-r--r--cpu/mpc85xx/traps.c274
-rw-r--r--cpu/mpc86xx/Makefile51
-rw-r--r--cpu/mpc86xx/cache.S374
-rw-r--r--cpu/mpc86xx/config.mk26
-rw-r--r--cpu/mpc86xx/cpu.c308
-rw-r--r--cpu/mpc86xx/cpu_init.c117
-rw-r--r--cpu/mpc86xx/interrupts.c204
-rw-r--r--cpu/mpc86xx/pci.c146
-rw-r--r--cpu/mpc86xx/pcie_indirect.c199
-rw-r--r--cpu/mpc86xx/resetvec.S2
-rw-r--r--cpu/mpc86xx/spd_sdram.c1320
-rw-r--r--cpu/mpc86xx/speed.c127
-rw-r--r--cpu/mpc86xx/start.S1186
-rw-r--r--cpu/mpc86xx/traps.c226
-rw-r--r--cpu/mpc8xx/Makefile53
-rw-r--r--cpu/mpc8xx/bedbug_860.c316
-rw-r--r--cpu/mpc8xx/commproc.c131
-rw-r--r--cpu/mpc8xx/config.mk26
-rw-r--r--cpu/mpc8xx/cpu.c634
-rw-r--r--cpu/mpc8xx/cpu_init.c283
-rw-r--r--cpu/mpc8xx/i2c.c740
-rw-r--r--cpu/mpc8xx/interrupts.c275
-rw-r--r--cpu/mpc8xx/kgdb.S73
-rw-r--r--cpu/mpc8xx/lcd.c617
-rw-r--r--cpu/mpc8xx/plprcr_write.S135
-rw-r--r--cpu/mpc8xx/reginfo.c58
-rw-r--r--cpu/mpc8xx/scc.c539
-rw-r--r--cpu/mpc8xx/speed.c394
-rw-r--r--cpu/mpc8xx/spi.c560
-rw-r--r--cpu/mpc8xx/start.S700
-rw-r--r--cpu/mpc8xx/traps.c225
-rw-r--r--cpu/mpc8xx/upatch.c102
-rw-r--r--cpu/mpc8xx/video.c1319
-rw-r--r--cpu/mpc8xx/wlkbd.c36
-rw-r--r--cpu/nios/Makefile48
-rw-r--r--cpu/nios/asmi.c695
-rw-r--r--cpu/nios/config.mk24
-rw-r--r--cpu/nios/cpu.c78
-rw-r--r--cpu/nios/interrupts.c196
-rw-r--r--cpu/nios/spi.c158
-rw-r--r--cpu/nios/start.S237
-rw-r--r--cpu/nios/traps.S582
-rw-r--r--cpu/nios2/Makefile48
-rw-r--r--cpu/nios2/config.mk24
-rw-r--r--cpu/nios2/cpu.c50
-rw-r--r--cpu/nios2/epcs.c729
-rw-r--r--cpu/nios2/exceptions.S155
-rw-r--r--cpu/nios2/interrupts.c231
-rw-r--r--cpu/nios2/start.S216
-rw-r--r--cpu/nios2/sysid.c58
-rw-r--r--cpu/nios2/traps.c42
-rw-r--r--cpu/ppc4xx/405gp_pci.c578
-rw-r--r--cpu/ppc4xx/440spe_pcie.c962
-rw-r--r--cpu/ppc4xx/440spe_pcie.h171
-rw-r--r--cpu/ppc4xx/Makefile53
-rw-r--r--cpu/ppc4xx/bedbug_405.c308
-rw-r--r--cpu/ppc4xx/commproc.c69
-rw-r--r--cpu/ppc4xx/config.mk26
-rw-r--r--cpu/ppc4xx/cpu.c500
-rw-r--r--cpu/ppc4xx/cpu_init.c395
-rw-r--r--cpu/ppc4xx/dcr.S196
-rw-r--r--cpu/ppc4xx/i2c.c446
-rw-r--r--cpu/ppc4xx/interrupts.c694
-rw-r--r--cpu/ppc4xx/kgdb.S77
-rw-r--r--cpu/ppc4xx/miiphy.c293
-rw-r--r--cpu/ppc4xx/ndfc.c194
-rw-r--r--cpu/ppc4xx/reginfo_405ep.c68
-rw-r--r--cpu/ppc4xx/reginfo_405gp.c91
-rw-r--r--cpu/ppc4xx/resetvec.S12
-rw-r--r--cpu/ppc4xx/sdram.c416
-rw-r--r--cpu/ppc4xx/sdram.h78
-rw-r--r--cpu/ppc4xx/spd_sdram.c1813
-rw-r--r--cpu/ppc4xx/speed.c815
-rw-r--r--cpu/ppc4xx/start.S1835
-rw-r--r--cpu/ppc4xx/traps.c271
-rw-r--r--cpu/ppc4xx/vecnum.h257
-rw-r--r--cpu/pxa/Makefile47
-rw-r--r--cpu/pxa/config.mk36
-rw-r--r--cpu/pxa/cpu.c55
-rw-r--r--cpu/pxa/i2c.c473
-rw-r--r--cpu/pxa/interrupts.c182
-rw-r--r--cpu/pxa/mmc.c489
-rw-r--r--cpu/pxa/pxafb.c471
-rw-r--r--cpu/pxa/start.S498
-rw-r--r--cpu/s3c44b0/Makefile47
-rw-r--r--cpu/s3c44b0/config.mk35
-rw-r--r--cpu/s3c44b0/cpu.c509
-rw-r--r--cpu/s3c44b0/interrupts.c203
-rw-r--r--cpu/s3c44b0/start.S272
-rw-r--r--cpu/sa1100/Makefile47
-rw-r--r--cpu/sa1100/config.mk35
-rw-r--r--cpu/sa1100/cpu.c145
-rw-r--r--cpu/sa1100/interrupts.c198
-rw-r--r--cpu/sa1100/start.S419
450 files changed, 0 insertions, 143393 deletions
diff --git a/cpu/74xx_7xx/Makefile b/cpu/74xx_7xx/Makefile
deleted file mode 100644
index fe905f31fe..0000000000
--- a/cpu/74xx_7xx/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# (C) Copyright 2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# (C) Copyright 2001
-# Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-SOBJS = cache.o kgdb.o io.o
-COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/74xx_7xx/cache.S b/cpu/74xx_7xx/cache.S
deleted file mode 100644
index a793d799d1..0000000000
--- a/cpu/74xx_7xx/cache.S
+++ /dev/null
@@ -1,381 +0,0 @@
-#include <config.h>
-#include <74xx_7xx.h>
-#include <version.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#ifndef CACHE_LINE_SIZE
-# define CACHE_LINE_SIZE L1_CACHE_BYTES
-#endif
-
-#if CACHE_LINE_SIZE == 128
-#define LG_CACHE_LINE_SIZE 7
-#elif CACHE_LINE_SIZE == 32
-#define LG_CACHE_LINE_SIZE 5
-#elif CACHE_LINE_SIZE == 16
-#define LG_CACHE_LINE_SIZE 4
-#elif CACHE_LINE_SIZE == 8
-#define LG_CACHE_LINE_SIZE 3
-#else
-# error "Invalid cache line size!"
-#endif
-
-/*
- * Invalidate L1 instruction cache.
- */
-_GLOBAL(invalidate_l1_instruction_cache)
- mfspr r3,PVR
- rlwinm r3,r3,16,16,31
- cmpi 0,r3,1
- beqlr /* for 601, do nothing */
- /* 603/604 processor - use invalidate-all bit in HID0 */
- mfspr r3,HID0
- ori r3,r3,HID0_ICFI
- mtspr HID0,r3
- isync
- blr
-
-/*
- * Invalidate L1 data cache.
- */
-_GLOBAL(invalidate_l1_data_cache)
- mfspr r3,HID0
- ori r3,r3,HID0_DCFI
- mtspr HID0,r3
- isync
- blr
-
-/*
- * Flush data cache.
- */
-_GLOBAL(flush_data_cache)
- lis r3,0
- lis r5,CACHE_LINE_SIZE
-flush:
- cmp 0,1,r3,r5
- bge done
- lwz r5,0(r3)
- lis r5,CACHE_LINE_SIZE
- addi r3,r3,0x4
- b flush
-done:
- blr
-/*
- * Write any modified data cache blocks out to memory
- * and invalidate the corresponding instruction cache blocks.
- * This is a no-op on the 601.
- *
- * flush_icache_range(unsigned long start, unsigned long stop)
- */
-_GLOBAL(flush_icache_range)
- mfspr r5,PVR
- rlwinm r5,r5,16,16,31
- cmpi 0,r5,1
- beqlr /* for 601, do nothing */
- li r5,CACHE_LINE_SIZE-1
- andc r3,r3,r5
- subf r4,r3,r4
- add r4,r4,r5
- srwi. r4,r4,LG_CACHE_LINE_SIZE
- beqlr
- mtctr r4
- mr r6,r3
-1: dcbst 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- sync /* wait for dcbst's to get to ram */
- mtctr r4
-2: icbi 0,r6
- addi r6,r6,CACHE_LINE_SIZE
- bdnz 2b
- sync /* additional sync needed on g4 */
- isync
- blr
-/*
- * Write any modified data cache blocks out to memory.
- * Does not invalidate the corresponding cache lines (especially for
- * any corresponding instruction cache).
- *
- * clean_dcache_range(unsigned long start, unsigned long stop)
- */
-_GLOBAL(clean_dcache_range)
- li r5,CACHE_LINE_SIZE-1
- andc r3,r3,r5 /* align r3 down to cache line */
- subf r4,r3,r4 /* r4 = offset of stop from start of cache line */
- add r4,r4,r5 /* r4 += cache_line_size-1 */
- srwi. r4,r4,LG_CACHE_LINE_SIZE /* r4 = number of cache lines to flush */
- beqlr /* if r4 == 0 return */
- mtctr r4 /* ctr = r4 */
-
- sync
-1: dcbst 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- sync /* wait for dcbst's to get to ram */
- blr
-
-/*
- * Write any modified data cache blocks out to memory
- * and invalidate the corresponding instruction cache blocks.
- *
- * flush_dcache_range(unsigned long start, unsigned long stop)
- */
-_GLOBAL(flush_dcache_range)
- li r5,CACHE_LINE_SIZE-1
- andc r3,r3,r5
- subf r4,r3,r4
- add r4,r4,r5
- srwi. r4,r4,LG_CACHE_LINE_SIZE
- beqlr
- mtctr r4
-
- sync
-1: dcbf 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- sync /* wait for dcbf's to get to ram */
- blr
-
-/*
- * Like above, but invalidate the D-cache. This is used by the 8xx
- * to invalidate the cache so the PPC core doesn't get stale data
- * from the CPM (no cache snooping here :-).
- *
- * invalidate_dcache_range(unsigned long start, unsigned long stop)
- */
-_GLOBAL(invalidate_dcache_range)
- li r5,CACHE_LINE_SIZE-1
- andc r3,r3,r5
- subf r4,r3,r4
- add r4,r4,r5
- srwi. r4,r4,LG_CACHE_LINE_SIZE
- beqlr
- mtctr r4
-
- sync
-1: dcbi 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- sync /* wait for dcbi's to get to ram */
- blr
-
-/*
- * Flush a particular page from the data cache to RAM.
- * Note: this is necessary because the instruction cache does *not*
- * snoop from the data cache.
- * This is a no-op on the 601 which has a unified cache.
- *
- * void __flush_page_to_ram(void *page)
- */
-_GLOBAL(__flush_page_to_ram)
- mfspr r5,PVR
- rlwinm r5,r5,16,16,31
- cmpi 0,r5,1
- beqlr /* for 601, do nothing */
- rlwinm r3,r3,0,0,19 /* Get page base address */
- li r4,4096/CACHE_LINE_SIZE /* Number of lines in a page */
- mtctr r4
- mr r6,r3
-0: dcbst 0,r3 /* Write line to ram */
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 0b
- sync
- mtctr r4
-1: icbi 0,r6
- addi r6,r6,CACHE_LINE_SIZE
- bdnz 1b
- sync
- isync
- blr
-
-/*
- * Flush a particular page from the instruction cache.
- * Note: this is necessary because the instruction cache does *not*
- * snoop from the data cache.
- * This is a no-op on the 601 which has a unified cache.
- *
- * void __flush_icache_page(void *page)
- */
-_GLOBAL(__flush_icache_page)
- mfspr r5,PVR
- rlwinm r5,r5,16,16,31
- cmpi 0,r5,1
- beqlr /* for 601, do nothing */
- li r4,4096/CACHE_LINE_SIZE /* Number of lines in a page */
- mtctr r4
-1: icbi 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- sync
- isync
- blr
-
-/*
- * Clear a page using the dcbz instruction, which doesn't cause any
- * memory traffic (except to write out any cache lines which get
- * displaced). This only works on cacheable memory.
- */
-_GLOBAL(clear_page)
- li r0,4096/CACHE_LINE_SIZE
- mtctr r0
-1: dcbz 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- blr
-
-/*
- * Enable L1 Instruction cache
- */
-_GLOBAL(icache_enable)
- mfspr r3, HID0
- li r5, HID0_ICFI|HID0_ILOCK
- andc r3, r3, r5
- ori r3, r3, HID0_ICE
- ori r5, r3, HID0_ICFI
- mtspr HID0, r5
- mtspr HID0, r3
- isync
- blr
-
-/*
- * Disable L1 Instruction cache
- */
-_GLOBAL(icache_disable)
- mfspr r3, HID0
- li r5, 0
- ori r5, r5, HID0_ICE
- andc r3, r3, r5
- mtspr HID0, r3
- isync
- blr
-
-/*
- * Is instruction cache enabled?
- */
-_GLOBAL(icache_status)
- mfspr r3, HID0
- andi. r3, r3, HID0_ICE
- blr
-
-
-_GLOBAL(l1dcache_enable)
- mfspr r3, HID0
- li r5, HID0_DCFI|HID0_DLOCK
- andc r3, r3, r5
- mtspr HID0, r3 /* no invalidate, unlock */
- ori r3, r3, HID0_DCE
- ori r5, r3, HID0_DCFI
- mtspr HID0, r5 /* enable + invalidate */
- mtspr HID0, r3 /* enable */
- sync
- blr
-
-/*
- * Enable data cache(s) - L1 and optionally L2
- * Calls l2cache_enable. LR saved in r5
- */
-_GLOBAL(dcache_enable)
- mfspr r3, HID0
- li r5, HID0_DCFI|HID0_DLOCK
- andc r3, r3, r5
- mtspr HID0, r3 /* no invalidate, unlock */
- ori r3, r3, HID0_DCE
- ori r5, r3, HID0_DCFI
- mtspr HID0, r5 /* enable + invalidate */
- mtspr HID0, r3 /* enable */
- sync
-#ifdef CFG_L2
- mflr r5
- bl l2cache_enable /* uses r3 and r4 */
- sync
- mtlr r5
-#endif
- blr
-
-
-/*
- * Disable data cache(s) - L1 and optionally L2
- * Calls flush_data_cache and l2cache_disable_no_flush.
- * LR saved in r4
- */
-_GLOBAL(dcache_disable)
- mflr r4 /* save link register */
- bl flush_data_cache /* uses r3 and r5 */
- sync
- mfspr r3, HID0
- li r5, HID0_DCFI|HID0_DLOCK
- andc r3, r3, r5
- mtspr HID0, r3 /* no invalidate, unlock */
- li r5, HID0_DCE|HID0_DCFI
- andc r3, r3, r5 /* no enable, no invalidate */
- mtspr HID0, r3
- sync
-#ifdef CFG_L2
- bl l2cache_disable_no_flush /* uses r3 */
-#endif
- mtlr r4 /* restore link register */
- blr
-
-/*
- * Is data cache enabled?
- */
-_GLOBAL(dcache_status)
- mfspr r3, HID0
- andi. r3, r3, HID0_DCE
- blr
-
-/*
- * Invalidate L2 cache using L2I and polling L2IP
- */
-_GLOBAL(l2cache_invalidate)
- sync
- oris r3, r3, L2CR_L2I@h
- sync
- mtspr l2cr, r3
- sync
-invl2:
- mfspr r3, l2cr
- andi. r3, r3, L2CR_L2IP
- bne invl2
- /* turn off the global invalidate bit */
- mfspr r3, l2cr
- rlwinm r3, r3, 0, 11, 9
- sync
- mtspr l2cr, r3
- sync
- blr
-
-/*
- * Enable L2 cache
- * Calls l2cache_invalidate. LR is saved in r4
- */
-_GLOBAL(l2cache_enable)
- mflr r4 /* save link register */
- bl l2cache_invalidate /* uses r3 */
- sync
- lis r3, L2_ENABLE@h
- ori r3, r3, L2_ENABLE@l
- mtspr l2cr, r3
- isync
- mtlr r4 /* restore link register */
- blr
-
-/*
- * Disable L2 cache
- * Calls flush_data_cache. LR is saved in r4
- */
-_GLOBAL(l2cache_disable)
- mflr r4 /* save link register */
- bl flush_data_cache /* uses r3 and r5 */
- sync
- mtlr r4 /* restore link register */
-l2cache_disable_no_flush: /* provide way to disable L2 w/o flushing */
- lis r3, L2_INIT@h
- ori r3, r3, L2_INIT@l
- mtspr l2cr, r3
- isync
- blr
diff --git a/cpu/74xx_7xx/config.mk b/cpu/74xx_7xx/config.mk
deleted file mode 100644
index 417d99f33b..0000000000
--- a/cpu/74xx_7xx/config.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# (C) Copyright 2001
-# Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
-
-PLATFORM_CPPFLAGS += -DCONFIG_74xx_7xx -ffixed-r2 -ffixed-r29 -mstring
diff --git a/cpu/74xx_7xx/cpu.c b/cpu/74xx_7xx/cpu.c
deleted file mode 100644
index f4e5fc504b..0000000000
--- a/cpu/74xx_7xx/cpu.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * (C) Copyright 2001
- * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * cpu.c
- *
- * CPU specific code
- *
- * written or collected and sometimes rewritten by
- * Magnus Damm <damm@bitsmart.com>
- *
- * minor modifications by
- * Wolfgang Denk <wd@denx.de>
- *
- * more modifications by
- * Josh Huber <huber@mclx.com>
- * added support for the 74xx series of cpus
- * added support for the 7xx series of cpus
- * made the code a little less hard-coded, and more auto-detectish
- */
-
-#include <common.h>
-#include <command.h>
-#include <74xx_7xx.h>
-#include <asm/cache.h>
-
-#ifdef CONFIG_AMIGAONEG3SE
-#include "../board/MAI/AmigaOneG3SE/via686.h"
-#include "../board/MAI/AmigaOneG3SE/memio.h"
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-cpu_t
-get_cpu_type(void)
-{
- uint pvr = get_pvr();
- cpu_t type;
-
- type = CPU_UNKNOWN;
-
- switch (PVR_VER(pvr)) {
- case 0x000c:
- type = CPU_7400;
- break;
- case 0x0008:
- type = CPU_750;
-
- if (((pvr >> 8) & 0xff) == 0x01) {
- type = CPU_750CX; /* old CX (80100 and 8010x?)*/
- } else if (((pvr >> 8) & 0xff) == 0x22) {
- type = CPU_750CX; /* CX (82201,82202) and CXe (82214) */
- } else if (((pvr >> 8) & 0xff) == 0x33) {
- type = CPU_750CX; /* CXe (83311) */
- } else if (((pvr >> 12) & 0xF) == 0x3) {
- type = CPU_755;
- }
- break;
-
- case 0x7000:
- type = CPU_750FX;
- break;
-
- case 0x7002:
- type = CPU_750GX;
- break;
-
- case 0x800C:
- type = CPU_7410;
- break;
-
- case 0x8000:
- type = CPU_7450;
- break;
-
- case 0x8001:
- type = CPU_7455;
- break;
-
- case 0x8002:
- type = CPU_7457;
- break;
-
- case 0x8004:
- type = CPU_7448;
- break;
-
- default:
- break;
- }
-
- return type;
-}
-
-/* ------------------------------------------------------------------------- */
-
-#if !defined(CONFIG_BAB7xx)
-int checkcpu (void)
-{
- uint type = get_cpu_type();
- uint pvr = get_pvr();
- ulong clock = gd->cpu_clk;
- char buf[32];
- char *str;
-
- puts ("CPU: ");
-
- switch (type) {
- case CPU_750CX:
- printf ("750CX%s v%d.%d", (pvr&0xf0)?"e":"",
- (pvr>>8) & 0xf,
- pvr & 0xf);
- goto PR_CLK;
-
- case CPU_750:
- str = "750";
- break;
-
- case CPU_750FX:
- str = "750FX";
- break;
-
- case CPU_750GX:
- str = "750GX";
- break;
-
- case CPU_755:
- str = "755";
- break;
-
- case CPU_7400:
- str = "MPC7400";
- break;
-
- case CPU_7410:
- str = "MPC7410";
- break;
-
- case CPU_7448:
- str = "MPC7448";
- break;
-
- case CPU_7450:
- str = "MPC7450";
- break;
-
- case CPU_7455:
- str = "MPC7455";
- break;
-
- case CPU_7457:
- str = "MPC7457";
- break;
-
- default:
- printf("Unknown CPU -- PVR: 0x%08x\n", pvr);
- return -1;
- }
-
- printf ("%s v%d.%d", str, (pvr >> 8) & 0xFF, pvr & 0xFF);
-PR_CLK:
- printf (" @ %s MHz\n", strmhz(buf, clock));
-
- return (0);
-}
-#endif
-/* these two functions are unimplemented currently [josh] */
-
-/* -------------------------------------------------------------------- */
-/* L1 i-cache */
-
-int
-checkicache(void)
-{
- return 0; /* XXX */
-}
-
-/* -------------------------------------------------------------------- */
-/* L1 d-cache */
-
-int
-checkdcache(void)
-{
- return 0; /* XXX */
-}
-
-/* -------------------------------------------------------------------- */
-
-static inline void
-soft_restart(unsigned long addr)
-{
- /* SRR0 has system reset vector, SRR1 has default MSR value */
- /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
-
- __asm__ __volatile__ ("mtspr 26, %0" :: "r" (addr));
- __asm__ __volatile__ ("li 4, (1 << 6)" ::: "r4");
- __asm__ __volatile__ ("mtspr 27, 4");
- __asm__ __volatile__ ("rfi");
-
- while(1); /* not reached */
-}
-
-
-#if !defined(CONFIG_PCIPPC2) && \
- !defined(CONFIG_BAB7xx) && \
- !defined(CONFIG_ELPPC) && \
- !defined(CONFIG_PPMC7XX)
-/* no generic way to do board reset. simply call soft_reset. */
-void
-do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- ulong addr;
- /* flush and disable I/D cache */
- __asm__ __volatile__ ("mfspr 3, 1008" ::: "r3");
- __asm__ __volatile__ ("ori 5, 5, 0xcc00" ::: "r5");
- __asm__ __volatile__ ("ori 4, 3, 0xc00" ::: "r4");
- __asm__ __volatile__ ("andc 5, 3, 5" ::: "r5");
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("mtspr 1008, 4");
- __asm__ __volatile__ ("isync");
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("mtspr 1008, 5");
- __asm__ __volatile__ ("isync");
- __asm__ __volatile__ ("sync");
-
-#ifdef CFG_RESET_ADDRESS
- addr = CFG_RESET_ADDRESS;
-#else
- /*
- * note: when CFG_MONITOR_BASE points to a RAM address,
- * CFG_MONITOR_BASE - sizeof (ulong) is usually a valid
- * address. Better pick an address known to be invalid on your
- * system and assign it to CFG_RESET_ADDRESS.
- */
- addr = CFG_MONITOR_BASE - sizeof (ulong);
-#endif
- soft_restart(addr);
- while(1); /* not reached */
-}
-#endif
-
-/* ------------------------------------------------------------------------- */
-
-/*
- * For the 7400 the TB clock runs at 1/4 the cpu bus speed.
- */
-#ifdef CONFIG_AMIGAONEG3SE
-unsigned long get_tbclk(void)
-{
- return (gd->bus_clk / 4);
-}
-#else /* ! CONFIG_AMIGAONEG3SE */
-
-unsigned long get_tbclk (void)
-{
- return CFG_BUS_HZ / 4;
-}
-#endif /* CONFIG_AMIGAONEG3SE */
-/* ------------------------------------------------------------------------- */
-
-#if defined(CONFIG_WATCHDOG)
-#if !defined(CONFIG_PCIPPC2) && !defined(CONFIG_BAB7xx)
-void
-watchdog_reset(void)
-{
-
-}
-#endif /* !CONFIG_PCIPPC2 && !CONFIG_BAB7xx */
-#endif /* CONFIG_WATCHDOG */
-
-/* ------------------------------------------------------------------------- */
diff --git a/cpu/74xx_7xx/cpu_init.c b/cpu/74xx_7xx/cpu_init.c
deleted file mode 100644
index e02a4cc21c..0000000000
--- a/cpu/74xx_7xx/cpu_init.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * (C) Copyright 2001
- * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * cpu_init.c - low level cpu init
- *
- * there's really nothing going on here yet. future work area?
- */
-
-#include <common.h>
-#include <74xx_7xx.h>
-
-/*
- * Breath some life into the CPU...
- *
- * there's basically nothing to do here since the memory controller
- * isn't on the CPU in this case.
- */
-void
-cpu_init_f (void)
-{
- switch (get_cpu_type()) {
- case CPU_7450:
- case CPU_7455:
- case CPU_7457:
- case CPU_7448:
- /* enable the timebase bit in HID0 */
- set_hid0(get_hid0() | 0x4000000);
- break;
- default:
- /* do nothing */
- break;
- }
-}
-
-/*
- * initialize higher level parts of CPU like timers
- */
-int cpu_init_r (void)
-{
- return (0);
-}
diff --git a/cpu/74xx_7xx/interrupts.c b/cpu/74xx_7xx/interrupts.c
deleted file mode 100644
index f0ea485265..0000000000
--- a/cpu/74xx_7xx/interrupts.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * (C) Copyright 2001
- * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * interrupts.c - just enough support for the decrementer/timer
- */
-
-#include <common.h>
-#include <mpc8xx.h>
-#include <mpc8xx_irq.h>
-#include <asm/processor.h>
-#include <commproc.h>
-#include <command.h>
-
-int interrupt_init_cpu (unsigned *decrementer_count)
-{
-#if defined(DEBUG) && !defined(CONFIG_AMIGAONEG3SE)
- printf("interrupt_init: GT main cause reg: %08x:%08x\n",
- GTREGREAD(LOW_INTERRUPT_CAUSE_REGISTER),
- GTREGREAD(HIGH_INTERRUPT_CAUSE_REGISTER));
- printf("interrupt_init: ethernet cause regs: %08x %08x %08x\n",
- GTREGREAD(ETHERNET0_INTERRUPT_CAUSE_REGISTER),
- GTREGREAD(ETHERNET1_INTERRUPT_CAUSE_REGISTER),
- GTREGREAD(ETHERNET2_INTERRUPT_CAUSE_REGISTER));
- printf("interrupt_init: ethernet mask regs: %08x %08x %08x\n",
- GTREGREAD(ETHERNET0_INTERRUPT_MASK_REGISTER),
- GTREGREAD(ETHERNET1_INTERRUPT_MASK_REGISTER),
- GTREGREAD(ETHERNET2_INTERRUPT_MASK_REGISTER));
- puts("interrupt_init: setting decrementer_count\n");
-#endif
- *decrementer_count = get_tbclk() / CFG_HZ;
-
- return (0);
-}
-
-/****************************************************************************/
-
-/*
- * Handle external interrupts
- */
-void
-external_interrupt(struct pt_regs *regs)
-{
- puts("external_interrupt (oops!)\n");
-}
-
-volatile ulong timestamp = 0;
-
-/*
- * timer_interrupt - gets called when the decrementer overflows,
- * with interrupts disabled.
- * Trivial implementation - no need to be really accurate.
- */
-void
-timer_interrupt_cpu (struct pt_regs *regs)
-{
- /* nothing to do here */
- return;
-}
-
-/****************************************************************************/
-
-/*
- * Install and free a interrupt handler.
- */
-
-void
-irq_install_handler(int vec, interrupt_handler_t *handler, void *arg)
-{
-
-}
-
-void
-irq_free_handler(int vec)
-{
-
-}
-
-/****************************************************************************/
-
-void
-do_irqinfo(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
-{
- puts("IRQ related functions are unimplemented currently.\n");
-}
diff --git a/cpu/74xx_7xx/io.S b/cpu/74xx_7xx/io.S
deleted file mode 100644
index af2e6d12fb..0000000000
--- a/cpu/74xx_7xx/io.S
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Andreas Heppel <aheppel@sysgo.de>
- * Copyright (C) 2002 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <ppc_asm.tmpl>
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in8 */
-/* Description: Input 8 bits */
-/* ------------------------------------------------------------------------------- */
- .globl in8
-in8:
- lbz r3,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in16 */
-/* Description: Input 16 bits */
-/* ------------------------------------------------------------------------------- */
- .globl in16
-in16:
- lhz r3,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in16r */
-/* Description: Input 16 bits and byte reverse */
-/* ------------------------------------------------------------------------------- */
- .globl in16r
-in16r:
- lhbrx r3,0,r3
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in32 */
-/* Description: Input 32 bits */
-/* ------------------------------------------------------------------------------- */
- .globl in32
-in32:
- lwz 3,0(3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in32r */
-/* Description: Input 32 bits and byte reverse */
-/* ------------------------------------------------------------------------------- */
- .globl in32r
-in32r:
- lwbrx r3,0,r3
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out8 */
-/* Description: Output 8 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out8
-out8:
- stb r4,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out16 */
-/* Description: Output 16 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out16
-out16:
- sth r4,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out16r */
-/* Description: Byte reverse and output 16 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out16r
-out16r:
- sthbrx r4,0,r3
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out32 */
-/* Description: Output 32 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out32
-out32:
- stw r4,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out32r */
-/* Description: Byte reverse and output 32 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out32r
-out32r:
- stwbrx r4,0,r3
- sync
- blr
diff --git a/cpu/74xx_7xx/kgdb.S b/cpu/74xx_7xx/kgdb.S
deleted file mode 100644
index ce632d0e50..0000000000
--- a/cpu/74xx_7xx/kgdb.S
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2000 Murray Jensen <Murray.Jensen@cmst.csiro.au>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307USA
- */
-
-#include <config.h>
-#include <command.h>
-#include <74xx_7xx.h>
-#include <version.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-
- /*
- * cache flushing routines for kgdb
- */
-
- .globl kgdb_flush_cache_all
-kgdb_flush_cache_all:
- lis r3,0
- addis r4,r0,0x0040
-kgdb_flush_loop:
- lwz r5,0(r3)
- addi r3,r3,CONFIG_CACHELINE_SIZE
- cmp 0,0,r3,r4
- bne kgdb_flush_loop
- SYNC
- mfspr r3,1008
- ori r3,r3,0x8800
- mtspr 1008,r3
- sync
- blr
-
- .globl kgdb_flush_cache_range
-kgdb_flush_cache_range:
- li r5,CONFIG_CACHELINE_SIZE-1
- andc r3,r3,r5
- subf r4,r3,r4
- add r4,r4,r5
- srwi. r4,r4,CFG_CACHELINE_SHIFT
- beqlr
- mtctr r4
- mr r6,r3
-1: dcbst 0,r3
- addi r3,r3,CONFIG_CACHELINE_SIZE
- bdnz 1b
- sync /* wait for dcbst's to get to ram */
- mtctr r4
-2: icbi 0,r6
- addi r6,r6,CONFIG_CACHELINE_SIZE
- bdnz 2b
- SYNC
- blr
-
-#endif /* CFG_CMD_KGDB */
diff --git a/cpu/74xx_7xx/speed.c b/cpu/74xx_7xx/speed.c
deleted file mode 100644
index d1800ede05..0000000000
--- a/cpu/74xx_7xx/speed.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <74xx_7xx.h>
-#include <asm/processor.h>
-
-#ifdef CONFIG_AMIGAONEG3SE
-#include "../board/MAI/AmigaOneG3SE/via686.h"
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static const int hid1_multipliers_x_10[] = {
- 25, /* 0000 - 2.5x */
- 75, /* 0001 - 7.5x */
- 70, /* 0010 - 7x */
- 10, /* 0011 - bypass */
- 20, /* 0100 - 2x */
- 65, /* 0101 - 6.5x */
- 100, /* 0110 - 10x */
- 45, /* 0111 - 4.5x */
- 30, /* 1000 - 3x */
- 55, /* 1001 - 5.5x */
- 40, /* 1010 - 4x */
- 50, /* 1011 - 5x */
- 80, /* 1100 - 8x */
- 60, /* 1101 - 6x */
- 35, /* 1110 - 3.5x */
- 0 /* 1111 - off */
-};
-
-static const int hid1_fx_multipliers_x_10[] = {
- 00, /* 0000 - off */
- 00, /* 0001 - off */
- 10, /* 0010 - bypass */
- 10, /* 0011 - bypass */
- 20, /* 0100 - 2x */
- 25, /* 0101 - 2.5x */
- 30, /* 0110 - 3x */
- 35, /* 0111 - 3.5x */
- 40, /* 1000 - 4x */
- 45, /* 1001 - 4.5x */
- 50, /* 1010 - 5x */
- 55, /* 1011 - 5.5x */
- 60, /* 1100 - 6x */
- 65, /* 1101 - 6.5x */
- 70, /* 1110 - 7x */
- 75, /* 1111 - 7.5 */
- 80, /* 10000 - 8x */
- 85, /* 10001 - 8.5x */
- 90, /* 10010 - 9x */
- 95, /* 10011 - 9.5x */
- 100, /* 10100 - 10x */
- 110, /* 10101 - 11x */
- 120, /* 10110 - 12x */
-};
-
-
-/* ------------------------------------------------------------------------- */
-
-/*
- * Measure CPU clock speed (core clock GCLK1, GCLK2)
- *
- * (Approx. GCLK frequency in Hz)
- */
-
-int get_clocks (void)
-{
- ulong clock = 0;
-
- /* calculate the clock frequency based upon the CPU type */
- switch (get_cpu_type()) {
- case CPU_7448:
- case CPU_7455:
- case CPU_7457:
- /*
- * It is assumed that the PLL_EXT line is zero.
- * Make sure division is done before multiplication to prevent 32-bit
- * arithmetic overflows which will cause a negative number
- */
- clock = (CFG_BUS_CLK / 10) * hid1_multipliers_x_10[(get_hid1 () >> 13) & 0xF];
- break;
-
- case CPU_750GX:
- case CPU_750FX:
- clock = CFG_BUS_CLK * hid1_fx_multipliers_x_10[get_hid1 () >> 27] / 10;
- break;
-
- case CPU_7450:
- case CPU_740:
- case CPU_740P:
- case CPU_745:
- case CPU_750CX:
- case CPU_750:
- case CPU_750P:
- case CPU_755:
- case CPU_7400:
- case CPU_7410:
- /*
- * Make sure division is done before multiplication to prevent 32-bit
- * arithmetic overflows which will cause a negative number
- */
- clock = (CFG_BUS_CLK / 10) * hid1_multipliers_x_10[get_hid1 () >> 28];
- break;
-
- case CPU_UNKNOWN:
- printf ("get_gclk_freq(): unknown CPU type\n");
- clock = 0;
- return (1);
- }
-
- gd->cpu_clk = clock;
- gd->bus_clk = CFG_BUS_CLK;
-
- return (0);
-}
-
-/* ------------------------------------------------------------------------- */
diff --git a/cpu/74xx_7xx/start.S b/cpu/74xx_7xx/start.S
deleted file mode 100644
index 4822741e03..0000000000
--- a/cpu/74xx_7xx/start.S
+++ /dev/null
@@ -1,900 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2000,2001,2002 Wolfgang Denk <wd@denx.de>
- * Copyright (C) 2001 Josh Huber <huber@mclx.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* U-Boot - Startup Code for PowerPC based Embedded Boards
- *
- *
- * The processor starts at 0xfff00100 and the code is executed
- * from flash. The code is organized to be at an other address
- * in memory, but as long we don't jump around before relocating.
- * board_init lies at a quite high address and when the cpu has
- * jumped there, everything is ok.
- */
-#include <config.h>
-#include <74xx_7xx.h>
-#include <version.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#if !defined(CONFIG_DB64360) && \
- !defined(CONFIG_DB64460) && \
- !defined(CONFIG_CPCI750) && \
- !defined(CONFIG_P3Mx)
-#include <galileo/gt64260R.h>
-#endif
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-/* We don't want the MMU yet.
-*/
-#undef MSR_KERNEL
-/* Machine Check and Recoverable Interr. */
-#define MSR_KERNEL ( MSR_ME | MSR_RI )
-
-/*
- * Set up GOT: Global Offset Table
- *
- * Use r14 to access the GOT
- */
- START_GOT
- GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_FIXUP_TABLE_)
-
- GOT_ENTRY(_start)
- GOT_ENTRY(_start_of_vectors)
- GOT_ENTRY(_end_of_vectors)
- GOT_ENTRY(transfer_to_handler)
-
- GOT_ENTRY(__init_end)
- GOT_ENTRY(_end)
- GOT_ENTRY(__bss_start)
- END_GOT
-
-/*
- * r3 - 1st arg to board_init(): IMMP pointer
- * r4 - 2nd arg to board_init(): boot flag
- */
- .text
- .long 0x27051956 /* U-Boot Magic Number */
- .globl version_string
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
-
- . = EXC_OFF_SYS_RESET
- .globl _start
-_start:
- li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
- b boot_cold
- sync
-
- . = EXC_OFF_SYS_RESET + 0x10
-
- .globl _start_warm
-_start_warm:
- li r21, BOOTFLAG_WARM /* Software reboot */
- b boot_warm
- sync
-
- /* the boot code is located below the exception table */
-
- .globl _start_of_vectors
-_start_of_vectors:
-
-/* Machine check */
- STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. "Never" generated on the 860. */
- STD_EXCEPTION(0x300, DataStorage, UnknownException)
-
-/* Instruction Storage exception. "Never" generated on the 860. */
- STD_EXCEPTION(0x400, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
- STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
-
-/* Alignment exception. */
- . = 0x600
-Alignment:
- EXCEPTION_PROLOG
- mfspr r4,DAR
- stw r4,_DAR(r21)
- mfspr r5,DSISR
- stw r5,_DSISR(r21)
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_Alignment:
- .long AlignmentException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
- . = 0x700
-ProgramCheck:
- EXCEPTION_PROLOG
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_ProgramCheck:
- .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
- /* No FPU on MPC8xx. This exception is not supposed to happen.
- */
- STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
-
- /* I guess we could implement decrementer, and may have
- * to someday for timekeeping.
- */
- STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
- STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
- STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
- STD_EXCEPTION(0xc00, SystemCall, UnknownException)
- STD_EXCEPTION(0xd00, SingleStep, UnknownException)
-
- STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
- STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
-
- /*
- * On the MPC8xx, this is a software emulation interrupt. It
- * occurs for all unimplemented and illegal instructions.
- */
- STD_EXCEPTION(0x1000, SoftEmu, SoftEmuException)
-
- STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
- STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
- STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
- STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
-
- STD_EXCEPTION(0x1500, Reserved5, UnknownException)
- STD_EXCEPTION(0x1600, Reserved6, UnknownException)
- STD_EXCEPTION(0x1700, Reserved7, UnknownException)
- STD_EXCEPTION(0x1800, Reserved8, UnknownException)
- STD_EXCEPTION(0x1900, Reserved9, UnknownException)
- STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
- STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
-
- STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
- STD_EXCEPTION(0x1d00, InstructionBreakpoint, UnknownException)
- STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
- STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
-
- .globl _end_of_vectors
-_end_of_vectors:
-
- . = 0x2000
-
-boot_cold:
-boot_warm:
- /* disable everything */
- li r0, 0
- mtspr HID0, r0
- sync
- mtmsr 0
- bl invalidate_bats
- sync
-
-#ifdef CFG_L2
- /* init the L2 cache */
- addis r3, r0, L2_INIT@h
- ori r3, r3, L2_INIT@l
- sync
- mtspr l2cr, r3
-#endif
-#if defined(CONFIG_ALTIVEC) && defined(CONFIG_74xx)
- .long 0x7e00066c
- /*
- * dssall instruction, gas doesn't have it yet
- * ...for altivec, data stream stop all this probably
- * isn't needed unless we warm (software) reboot U-Boot
- */
-#endif
-
-#ifdef CFG_L2
- /* invalidate the L2 cache */
- bl l2cache_invalidate
- sync
-#endif
-#ifdef CFG_BOARD_ASM_INIT
- /* do early init */
- bl board_asm_init
-#endif
-
- /*
- * Calculate absolute address in FLASH and jump there
- *------------------------------------------------------*/
- lis r3, CFG_MONITOR_BASE@h
- ori r3, r3, CFG_MONITOR_BASE@l
- addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
- mtlr r3
- blr
-
-in_flash:
- /* let the C-code set up the rest */
- /* */
- /* Be careful to keep code relocatable ! */
- /*------------------------------------------------------*/
-
- /* perform low-level init */
- /* sdram init, galileo init, etc */
- /* r3: NHR bit from HID0 */
-
- /* setup the bats */
- bl setup_bats
- sync
-
- /*
- * Cache must be enabled here for stack-in-cache trick.
- * This means we need to enable the BATS.
- * This means:
- * 1) for the EVB, original gt regs need to be mapped
- * 2) need to have an IBAT for the 0xf region,
- * we are running there!
- * Cache should be turned on after BATs, since by default
- * everything is write-through.
- * The init-mem BAT can be reused after reloc. The old
- * gt-regs BAT can be reused after board_init_f calls
- * board_early_init_f (EVB only).
- */
-#if !defined(CONFIG_BAB7xx) && !defined(CONFIG_ELPPC) && !defined(CONFIG_P3Mx)
- /* enable address translation */
- bl enable_addr_trans
- sync
-
- /* enable and invalidate the data cache */
- bl l1dcache_enable
- sync
-#endif
-#ifdef CFG_INIT_RAM_LOCK
- bl lock_ram_in_cache
- sync
-#endif
-
- /* set up the stack pointer in our newly created
- * cache-ram (r1) */
- lis r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@h
- ori r1, r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@l
-
- li r0, 0 /* Make room for stack frame header and */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
-
- GET_GOT /* initialize GOT access */
-
- /* run low-level CPU init code (from Flash) */
- bl cpu_init_f
- sync
-
- mr r3, r21
-
- /* r3: BOOTFLAG */
- /* run 1st part of board init code (from Flash) */
- bl board_init_f
- sync
-
- /* NOTREACHED */
-
- .globl invalidate_bats
-invalidate_bats:
- /* invalidate BATs */
- mtspr IBAT0U, r0
- mtspr IBAT1U, r0
- mtspr IBAT2U, r0
- mtspr IBAT3U, r0
-#ifdef CONFIG_750FX
- mtspr IBAT4U, r0
- mtspr IBAT5U, r0
- mtspr IBAT6U, r0
- mtspr IBAT7U, r0
-#endif
- isync
- mtspr DBAT0U, r0
- mtspr DBAT1U, r0
- mtspr DBAT2U, r0
- mtspr DBAT3U, r0
-#ifdef CONFIG_750FX
- mtspr DBAT4U, r0
- mtspr DBAT5U, r0
- mtspr DBAT6U, r0
- mtspr DBAT7U, r0
-#endif
- isync
- sync
- blr
-
- /* setup_bats - set them up to some initial state */
- .globl setup_bats
-setup_bats:
- addis r0, r0, 0x0000
-
- /* IBAT 0 */
- addis r4, r0, CFG_IBAT0L@h
- ori r4, r4, CFG_IBAT0L@l
- addis r3, r0, CFG_IBAT0U@h
- ori r3, r3, CFG_IBAT0U@l
- mtspr IBAT0L, r4
- mtspr IBAT0U, r3
- isync
-
- /* DBAT 0 */
- addis r4, r0, CFG_DBAT0L@h
- ori r4, r4, CFG_DBAT0L@l
- addis r3, r0, CFG_DBAT0U@h
- ori r3, r3, CFG_DBAT0U@l
- mtspr DBAT0L, r4
- mtspr DBAT0U, r3
- isync
-
- /* IBAT 1 */
- addis r4, r0, CFG_IBAT1L@h
- ori r4, r4, CFG_IBAT1L@l
- addis r3, r0, CFG_IBAT1U@h
- ori r3, r3, CFG_IBAT1U@l
- mtspr IBAT1L, r4
- mtspr IBAT1U, r3
- isync
-
- /* DBAT 1 */
- addis r4, r0, CFG_DBAT1L@h
- ori r4, r4, CFG_DBAT1L@l
- addis r3, r0, CFG_DBAT1U@h
- ori r3, r3, CFG_DBAT1U@l
- mtspr DBAT1L, r4
- mtspr DBAT1U, r3
- isync
-
- /* IBAT 2 */
- addis r4, r0, CFG_IBAT2L@h
- ori r4, r4, CFG_IBAT2L@l
- addis r3, r0, CFG_IBAT2U@h
- ori r3, r3, CFG_IBAT2U@l
- mtspr IBAT2L, r4
- mtspr IBAT2U, r3
- isync
-
- /* DBAT 2 */
- addis r4, r0, CFG_DBAT2L@h
- ori r4, r4, CFG_DBAT2L@l
- addis r3, r0, CFG_DBAT2U@h
- ori r3, r3, CFG_DBAT2U@l
- mtspr DBAT2L, r4
- mtspr DBAT2U, r3
- isync
-
- /* IBAT 3 */
- addis r4, r0, CFG_IBAT3L@h
- ori r4, r4, CFG_IBAT3L@l
- addis r3, r0, CFG_IBAT3U@h
- ori r3, r3, CFG_IBAT3U@l
- mtspr IBAT3L, r4
- mtspr IBAT3U, r3
- isync
-
- /* DBAT 3 */
- addis r4, r0, CFG_DBAT3L@h
- ori r4, r4, CFG_DBAT3L@l
- addis r3, r0, CFG_DBAT3U@h
- ori r3, r3, CFG_DBAT3U@l
- mtspr DBAT3L, r4
- mtspr DBAT3U, r3
- isync
-
-#ifdef CONFIG_750FX
- /* IBAT 4 */
- addis r4, r0, CFG_IBAT4L@h
- ori r4, r4, CFG_IBAT4L@l
- addis r3, r0, CFG_IBAT4U@h
- ori r3, r3, CFG_IBAT4U@l
- mtspr IBAT4L, r4
- mtspr IBAT4U, r3
- isync
-
- /* DBAT 4 */
- addis r4, r0, CFG_DBAT4L@h
- ori r4, r4, CFG_DBAT4L@l
- addis r3, r0, CFG_DBAT4U@h
- ori r3, r3, CFG_DBAT4U@l
- mtspr DBAT4L, r4
- mtspr DBAT4U, r3
- isync
-
- /* IBAT 5 */
- addis r4, r0, CFG_IBAT5L@h
- ori r4, r4, CFG_IBAT5L@l
- addis r3, r0, CFG_IBAT5U@h
- ori r3, r3, CFG_IBAT5U@l
- mtspr IBAT5L, r4
- mtspr IBAT5U, r3
- isync
-
- /* DBAT 5 */
- addis r4, r0, CFG_DBAT5L@h
- ori r4, r4, CFG_DBAT5L@l
- addis r3, r0, CFG_DBAT5U@h
- ori r3, r3, CFG_DBAT5U@l
- mtspr DBAT5L, r4
- mtspr DBAT5U, r3
- isync
-
- /* IBAT 6 */
- addis r4, r0, CFG_IBAT6L@h
- ori r4, r4, CFG_IBAT6L@l
- addis r3, r0, CFG_IBAT6U@h
- ori r3, r3, CFG_IBAT6U@l
- mtspr IBAT6L, r4
- mtspr IBAT6U, r3
- isync
-
- /* DBAT 6 */
- addis r4, r0, CFG_DBAT6L@h
- ori r4, r4, CFG_DBAT6L@l
- addis r3, r0, CFG_DBAT6U@h
- ori r3, r3, CFG_DBAT6U@l
- mtspr DBAT6L, r4
- mtspr DBAT6U, r3
- isync
-
- /* IBAT 7 */
- addis r4, r0, CFG_IBAT7L@h
- ori r4, r4, CFG_IBAT7L@l
- addis r3, r0, CFG_IBAT7U@h
- ori r3, r3, CFG_IBAT7U@l
- mtspr IBAT7L, r4
- mtspr IBAT7U, r3
- isync
-
- /* DBAT 7 */
- addis r4, r0, CFG_DBAT7L@h
- ori r4, r4, CFG_DBAT7L@l
- addis r3, r0, CFG_DBAT7U@h
- ori r3, r3, CFG_DBAT7U@l
- mtspr DBAT7L, r4
- mtspr DBAT7U, r3
- isync
-#endif
-
- /* bats are done, now invalidate the TLBs */
-
- addis r3, 0, 0x0000
- addis r5, 0, 0x4 /* upper bound of 0x00040000 for 7400/750 */
-
- isync
-
-tlblp:
- tlbie r3
- sync
- addi r3, r3, 0x1000
- cmp 0, 0, r3, r5
- blt tlblp
-
- blr
-
- .globl enable_addr_trans
-enable_addr_trans:
- /* enable address translation */
- mfmsr r5
- ori r5, r5, (MSR_IR | MSR_DR)
- mtmsr r5
- isync
- blr
-
- .globl disable_addr_trans
-disable_addr_trans:
- /* disable address translation */
- mflr r4
- mfmsr r3
- andi. r0, r3, (MSR_IR | MSR_DR)
- beqlr
- andc r3, r3, r0
- mtspr SRR0, r4
- mtspr SRR1, r3
- rfi
-
-/*
- * This code finishes saving the registers to the exception frame
- * and jumps to the appropriate handler for the exception.
- * Register r21 is pointer into trap frame, r1 has new stack pointer.
- */
- .globl transfer_to_handler
-transfer_to_handler:
- stw r22,_NIP(r21)
- lis r22,MSR_POW@h
- andc r23,r23,r22
- stw r23,_MSR(r21)
- SAVE_GPR(7, r21)
- SAVE_4GPRS(8, r21)
- SAVE_8GPRS(12, r21)
- SAVE_8GPRS(24, r21)
- mflr r23
- andi. r24,r23,0x3f00 /* get vector offset */
- stw r24,TRAP(r21)
- li r22,0
- stw r22,RESULT(r21)
- mtspr SPRG2,r22 /* r1 is now kernel sp */
- lwz r24,0(r23) /* virtual address of handler */
- lwz r23,4(r23) /* where to go when done */
- mtspr SRR0,r24
- mtspr SRR1,r20
- mtlr r23
- SYNC
- rfi /* jump to handler, enable MMU */
-
-int_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr SRR0,r2
- mtspr SRR1,r0
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfi
-
- .globl dc_read
-dc_read:
- blr
-
- .globl get_pvr
-get_pvr:
- mfspr r3, PVR
- blr
-
-/*-----------------------------------------------------------------------*/
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
- */
- .globl relocate_code
-relocate_code:
- mr r1, r3 /* Set new stack pointer */
- mr r9, r4 /* Save copy of Global Data pointer */
- mr r10, r5 /* Save copy of Destination Address */
-
- mr r3, r5 /* Destination Address */
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
- lwz r5, GOT(__init_end)
- sub r5, r5, r4
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
- *
- * Offset:
- */
- sub r15, r10, r4
-
- /* First our own GOT */
- add r14, r14, r15
- /* then the one used by the C code */
- add r30, r30, r15
-
- /*
- * Now relocate code
- */
-#ifdef CONFIG_ECC
- bl board_relocate_rom
- sync
- mr r3, r10 /* Destination Address */
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
- lwz r5, GOT(__init_end)
- sub r5, r5, r4
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-#else
- cmplw cr1,r3,r4
- addi r0,r5,3
- srwi. r0,r0,2
- beq cr1,4f /* In place copy is not necessary */
- beq 7f /* Protect against 0 count */
- mtctr r0
- bge cr1,2f
-
- la r8,-4(r4)
- la r7,-4(r3)
-1: lwzu r0,4(r8)
- stwu r0,4(r7)
- bdnz 1b
- b 4f
-
-2: slwi r0,r0,2
- add r8,r4,r0
- add r7,r3,r0
-3: lwzu r0,-4(r8)
- stwu r0,-4(r7)
- bdnz 3b
-#endif
-/*
- * Now flush the cache: note that we must start from a cache aligned
- * address. Otherwise we might miss one cache line.
- */
-4: cmpwi r6,0
- add r5,r3,r5
- beq 7f /* Always flush prefetch queue in any case */
- subi r0,r6,1
- andc r3,r3,r0
- mr r4,r3
-5: dcbst 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 5b
- sync /* Wait for all dcbst to complete on bus */
- mr r4,r3
-6: icbi 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 6b
-7: sync /* Wait for all icbi to complete on bus */
- isync
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
- addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
- mtlr r0
- blr
-
-in_ram:
-#ifdef CONFIG_ECC
- bl board_init_ecc
-#endif
- /*
- * Relocation Function, r14 point to got2+0x8000
- *
- * Adjust got2 pointers, no need to check for 0, this code
- * already puts a few entries in the table.
- */
- li r0,__got2_entries@sectoff@l
- la r3,GOT(_GOT2_TABLE_)
- lwz r11,GOT(_GOT2_TABLE_)
- mtctr r0
- sub r11,r3,r11
- addi r3,r3,-4
-1: lwzu r0,4(r3)
- add r0,r0,r11
- stw r0,0(r3)
- bdnz 1b
-
- /*
- * Now adjust the fixups and the pointers to the fixups
- * in case we need to move ourselves again.
- */
-2: li r0,__fixup_entries@sectoff@l
- lwz r3,GOT(_FIXUP_TABLE_)
- cmpwi r0,0
- mtctr r0
- addi r3,r3,-4
- beq 4f
-3: lwzu r4,4(r3)
- lwzux r0,r4,r11
- add r0,r0,r11
- stw r10,0(r3)
- stw r0,0(r4)
- bdnz 3b
-4:
-/* clear_bss: */
- /*
- * Now clear BSS segment
- */
- lwz r3,GOT(__bss_start)
- lwz r4,GOT(_end)
-
- cmplw 0, r3, r4
- beq 6f
-
- li r0, 0
-5:
- stw r0, 0(r3)
- addi r3, r3, 4
- cmplw 0, r3, r4
- bne 5b
-6:
- mr r3, r10 /* Destination Address */
-#if defined(CONFIG_AMIGAONEG3SE) || \
- defined(CONFIG_DB64360) || \
- defined(CONFIG_DB64460) || \
- defined(CONFIG_CPCI750) || \
- defined(CONFIG_PPMC7XX) || \
- defined(CONFIG_P3Mx)
- mr r4, r9 /* Use RAM copy of the global data */
-#endif
- bl after_reloc
-
- /* not reached - end relocate_code */
-/*-----------------------------------------------------------------------*/
-
- /*
- * Copy exception vector code to low memory
- *
- * r3: dest_addr
- * r7: source address, r8: end address, r9: target address
- */
- .globl trap_init
-trap_init:
- lwz r7, GOT(_start)
- lwz r8, GOT(_end_of_vectors)
-
- li r9, 0x100 /* reset vector always at 0x100 */
-
- cmplw 0, r7, r8
- bgelr /* return if r7>=r8 - just in case */
-
- mflr r4 /* save link register */
-1:
- lwz r0, 0(r7)
- stw r0, 0(r9)
- addi r7, r7, 4
- addi r9, r9, 4
- cmplw 0, r7, r8
- bne 1b
-
- /*
- * relocate `hdlr' and `int_return' entries
- */
- li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
- li r8, Alignment - _start + EXC_OFF_SYS_RESET
-2:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 2b
-
- li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
- li r8, SystemCall - _start + EXC_OFF_SYS_RESET
-3:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 3b
-
- li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
- li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-4:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 4b
-
- /* enable execptions from RAM vectors */
- mfmsr r7
- li r8,MSR_IP
- andc r7,r7,r8
- mtmsr r7
-
- mtlr r4 /* restore link register */
- blr
-
- /*
- * Function: relocate entries for one exception vector
- */
-trap_reloc:
- lwz r0, 0(r7) /* hdlr ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 0(r7)
-
- lwz r0, 4(r7) /* int_return ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 4(r7)
-
- sync
- isync
-
- blr
-
-#ifdef CFG_INIT_RAM_LOCK
-lock_ram_in_cache:
- /* Allocate Initial RAM in data cache.
- */
- lis r3, (CFG_INIT_RAM_ADDR & ~31)@h
- ori r3, r3, (CFG_INIT_RAM_ADDR & ~31)@l
- li r2, ((CFG_INIT_RAM_END & ~31) + \
- (CFG_INIT_RAM_ADDR & 31) + 31) / 32
- mtctr r2
-1:
- dcbz r0, r3
- addi r3, r3, 32
- bdnz 1b
-
- /* Lock the data cache */
- mfspr r0, HID0
- ori r0, r0, 0x1000
- sync
- mtspr HID0, r0
- sync
- blr
-
-.globl unlock_ram_in_cache
-unlock_ram_in_cache:
- /* invalidate the INIT_RAM section */
- lis r3, (CFG_INIT_RAM_ADDR & ~31)@h
- ori r3, r3, (CFG_INIT_RAM_ADDR & ~31)@l
- li r2, ((CFG_INIT_RAM_END & ~31) + \
- (CFG_INIT_RAM_ADDR & 31) + 31) / 32
- mtctr r2
-1: icbi r0, r3
- addi r3, r3, 32
- bdnz 1b
- sync /* Wait for all icbi to complete on bus */
- isync
-
- /* Unlock the data cache and invalidate it */
- mfspr r0, HID0
- li r3,0x1000
- andc r0,r0,r3
- li r3,0x0400
- or r0,r0,r3
- sync
- mtspr HID0, r0
- sync
- blr
-#endif
diff --git a/cpu/74xx_7xx/traps.c b/cpu/74xx_7xx/traps.c
deleted file mode 100644
index d7e317d088..0000000000
--- a/cpu/74xx_7xx/traps.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * linux/arch/ppc/kernel/traps.c
- *
- * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- * Modified by Cort Dougan (cort@cs.nmt.edu)
- * and Paul Mackerras (paulus@cs.anu.edu.au)
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * This file handles the architecture-dependent parts of hardware exceptions
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/processor.h>
-
-#ifdef CONFIG_AMIGAONEG3SE
-DECLARE_GLOBAL_DATA_PTR;
-#endif
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
-/* Returns 0 if exception not found and fixup otherwise. */
-extern unsigned long search_exception_table(unsigned long);
-
-/* THIS NEEDS CHANGING to use the board info structure.
-*/
-#ifdef CONFIG_AMIGAONEG3SE
-#define END_OF_MEM (gd->bd->bi_memstart + gd->bd->bi_memsize)
-#else
-#define END_OF_MEM 0x02000000
-#endif
-
-/*
- * Trap & Exception support
- */
-
-void
-print_backtrace(unsigned long *sp)
-{
- int cnt = 0;
- unsigned long i;
-
- printf("Call backtrace: ");
- while (sp) {
- if ((uint)sp > END_OF_MEM)
- break;
-
- i = sp[1];
- if (cnt++ % 7 == 0)
- printf("\n");
- printf("%08lX ", i);
- if (cnt > 32) break;
- sp = (unsigned long *)*sp;
- }
- printf("\n");
-}
-
-void
-show_regs(struct pt_regs * regs)
-{
- int i;
-
- printf("NIP: %08lX XER: %08lX LR: %08lX REGS:"
- " %p TRAP: %04lx DAR: %08lX\n",
- regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
- printf("MSR: %08lx EE: %01x PR: %01x FP:"
- " %01x ME: %01x IR/DR: %01x%01x\n",
- regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
- regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
- regs->msr&MSR_IR ? 1 : 0,
- regs->msr&MSR_DR ? 1 : 0);
-
- printf("\n");
- for (i = 0; i < 32; i++) {
- if ((i % 8) == 0)
- {
- printf("GPR%02d: ", i);
- }
-
- printf("%08lX ", regs->gpr[i]);
- if ((i % 8) == 7)
- {
- printf("\n");
- }
- }
-}
-
-
-void
-_exception(int signr, struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
-}
-
-void
-MachineCheckException(struct pt_regs *regs)
-{
- unsigned long fixup;
-
- /* Probing PCI using config cycles cause this exception
- * when a device is not present. Catch it and return to
- * the PCI exception handler.
- */
- if ((fixup = search_exception_table(regs->nip)) != 0) {
- regs->nip = fixup;
- return;
- }
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- printf("Machine check in kernel mode.\n");
- printf("Caused by (from msr): ");
- printf("regs %p ",regs);
- switch( regs->msr & 0x000F0000) {
- case (0x80000000>>12):
- printf("Machine check signal - probably due to mm fault\n"
- "with mmu off\n");
- break;
- case (0x80000000>>13):
- printf("Transfer error ack signal\n");
- break;
- case (0x80000000>>14):
- printf("Data parity signal\n");
- break;
- case (0x80000000>>15):
- printf("Address parity signal\n");
- break;
- default:
- printf("Unknown values in msr\n");
- }
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("machine check");
-}
-
-void
-AlignmentException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Alignment Exception");
-}
-
-void
-ProgramCheckException(struct pt_regs *regs)
-{
- unsigned char *p = regs ? (unsigned char *)(regs->nip) : NULL;
- int i, j;
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
-
- p = (unsigned char *) ((unsigned long)p & 0xFFFFFFE0);
- p -= 32;
- for (i = 0; i < 256; i+=16) {
- printf("%08x: ", (unsigned int)p+i);
- for (j = 0; j < 16; j++) {
- printf("%02x ", p[i+j]);
- }
- printf("\n");
- }
-
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Program Check Exception");
-}
-
-void
-SoftEmuException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Software Emulation Exception");
-}
-
-
-void
-UnknownException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
- regs->nip, regs->msr, regs->trap);
- _exception(0, regs);
-}
-
-/* Probe an address by reading. If not present, return -1, otherwise
- * return 0.
- */
-int
-addr_probe(uint *addr)
-{
- return 0;
-}
diff --git a/cpu/arm1136/Makefile b/cpu/arm1136/Makefile
deleted file mode 100644
index d5ac7d3fd9..0000000000
--- a/cpu/arm1136/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = interrupts.o cpu.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/arm1136/start.S b/cpu/arm1136/start.S
deleted file mode 100644
index 17c7a83491..0000000000
--- a/cpu/arm1136/start.S
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * armboot - Startup Code for OMP2420/ARM1136 CPU-core
- *
- * Copyright (c) 2004 Texas Instruments <r-woodruff2@ti.com>
- *
- * Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
- * Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
- * Copyright (c) 2002 Gary Jennejohn <gj@denx.de>
- * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
- * Copyright (c) 2003 Kshitij <kshitij@ti.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <version.h>
-#if !defined(CONFIG_INTEGRATOR) && ! defined(CONFIG_ARCH_CINTEGRATOR)
-#include <asm/arch/omap2420.h>
-#endif
-.globl _start
-_start: b reset
- ldr pc, _undefined_instruction
- ldr pc, _software_interrupt
- ldr pc, _prefetch_abort
- ldr pc, _data_abort
- ldr pc, _not_used
- ldr pc, _irq
- ldr pc, _fiq
-
-_undefined_instruction: .word undefined_instruction
-_software_interrupt: .word software_interrupt
-_prefetch_abort: .word prefetch_abort
-_data_abort: .word data_abort
-_not_used: .word not_used
-_irq: .word irq
-_fiq: .word fiq
-_pad: .word 0x12345678 /* now 16*4=64 */
-.global _end_vect
-_end_vect:
-
- .balignl 16,0xdeadbeef
-/*
- *************************************************************************
- *
- * Startup Code (reset vector)
- *
- * do important init only if we don't start from memory!
- * setup Memory and board specific bits prior to relocation.
- * relocate armboot to ram
- * setup stack
- *
- *************************************************************************
- */
-
-_TEXT_BASE:
- .word TEXT_BASE
-
-.globl _armboot_start
-_armboot_start:
- .word _start
-
-/*
- * These are defined in the board-specific linker script.
- */
-.globl _bss_start
-_bss_start:
- .word __bss_start
-
-.globl _bss_end
-_bss_end:
- .word _end
-
-#ifdef CONFIG_USE_IRQ
-/* IRQ stack memory (calculated at run-time) */
-.globl IRQ_STACK_START
-IRQ_STACK_START:
- .word 0x0badc0de
-
-/* IRQ stack memory (calculated at run-time) */
-.globl FIQ_STACK_START
-FIQ_STACK_START:
- .word 0x0badc0de
-#endif
-
-/*
- * the actual reset code
- */
-
-reset:
- /*
- * set the cpu to SVC32 mode
- */
- mrs r0,cpsr
- bic r0,r0,#0x1f
- orr r0,r0,#0xd3
- msr cpsr,r0
-
-#ifdef CONFIG_OMAP2420H4
- /* Copy vectors to mask ROM indirect addr */
- adr r0, _start /* r0 <- current position of code */
- add r0, r0, #4 /* skip reset vector */
- mov r2, #64 /* r2 <- size to copy */
- add r2, r0, r2 /* r2 <- source end address */
- mov r1, #SRAM_OFFSET0 /* build vect addr */
- mov r3, #SRAM_OFFSET1
- add r1, r1, r3
- mov r3, #SRAM_OFFSET2
- add r1, r1, r3
-next:
- ldmia r0!, {r3-r10} /* copy from source address [r0] */
- stmia r1!, {r3-r10} /* copy to target address [r1] */
- cmp r0, r2 /* until source end address [r2] */
- bne next /* loop until equal */
- bl cpy_clk_code /* put dpll adjust code behind vectors */
-#endif
- /* the mask ROM code should have PLL and others stable */
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
- bl cpu_init_crit
-#endif
-
-#ifndef CONFIG_SKIP_RELOCATE_UBOOT
-relocate: /* relocate U-Boot to RAM */
- adr r0, _start /* r0 <- current position of code */
- ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
- cmp r0, r1 /* don't reloc during debug */
- beq stack_setup
-
- ldr r2, _armboot_start
- ldr r3, _bss_start
- sub r2, r3, r2 /* r2 <- size of armboot */
- add r2, r0, r2 /* r2 <- source end address */
-
-copy_loop:
- ldmia r0!, {r3-r10} /* copy from source address [r0] */
- stmia r1!, {r3-r10} /* copy to target address [r1] */
- cmp r0, r2 /* until source end addreee [r2] */
- ble copy_loop
-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
-
- /* Set up the stack */
-stack_setup:
- ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
- sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
- sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
-#ifdef CONFIG_USE_IRQ
- sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
-#endif
- sub sp, r0, #12 /* leave 3 words for abort-stack */
-
-clear_bss:
- ldr r0, _bss_start /* find start of bss segment */
- ldr r1, _bss_end /* stop here */
- mov r2, #0x00000000 /* clear */
-
-clbss_l:str r2, [r0] /* clear loop... */
- add r0, r0, #4
- cmp r0, r1
- bne clbss_l
-
- ldr pc, _start_armboot
-
-_start_armboot: .word start_armboot
-
-
-/*
- *************************************************************************
- *
- * CPU_init_critical registers
- *
- * setup important registers
- * setup memory timing
- *
- *************************************************************************
- */
-cpu_init_crit:
- /*
- * flush v4 I/D caches
- */
- mov r0, #0
- mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
- mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */
-
- /*
- * disable MMU stuff and caches
- */
- mrc p15, 0, r0, c1, c0, 0
- bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)
- bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM)
- orr r0, r0, #0x00000002 @ set bit 2 (A) Align
- orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
- mcr p15, 0, r0, c1, c0, 0
-
- /*
- * Jump to board specific initialization... The Mask ROM will have already initialized
- * basic memory. Go here to bump up clock rate and handle wake up conditions.
- */
- mov ip, lr /* persevere link reg across call */
- bl lowlevel_init /* go setup pll,mux,memory */
- mov lr, ip /* restore link */
- mov pc, lr /* back to my caller */
-/*
- *************************************************************************
- *
- * Interrupt handling
- *
- *************************************************************************
- */
-@
-@ IRQ stack frame.
-@
-#define S_FRAME_SIZE 72
-
-#define S_OLD_R0 68
-#define S_PSR 64
-#define S_PC 60
-#define S_LR 56
-#define S_SP 52
-
-#define S_IP 48
-#define S_FP 44
-#define S_R10 40
-#define S_R9 36
-#define S_R8 32
-#define S_R7 28
-#define S_R6 24
-#define S_R5 20
-#define S_R4 16
-#define S_R3 12
-#define S_R2 8
-#define S_R1 4
-#define S_R0 0
-
-#define MODE_SVC 0x13
-#define I_BIT 0x80
-
-/*
- * use bad_save_user_regs for abort/prefetch/undef/swi ...
- * use irq_save_user_regs / irq_restore_user_regs for IRQ/FIQ handling
- */
-
- .macro bad_save_user_regs
- sub sp, sp, #S_FRAME_SIZE @ carve out a frame on current user stack
- stmia sp, {r0 - r12} @ Save user registers (now in svc mode) r0-r12
-
- ldr r2, _armboot_start
- sub r2, r2, #(CFG_MALLOC_LEN)
- sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
- ldmia r2, {r2 - r3} @ get values for "aborted" pc and cpsr (into parm regs)
- add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack
-
- add r5, sp, #S_SP
- mov r1, lr
- stmia r5, {r0 - r3} @ save sp_SVC, lr_SVC, pc, cpsr
- mov r0, sp @ save current stack into r0 (param register)
- .endm
-
- .macro irq_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Calling r0-r12
- add r8, sp, #S_PC @ !!!! R8 NEEDS to be saved !!!! a reserved stack spot would be good.
- stmdb r8, {sp, lr}^ @ Calling SP, LR
- str lr, [r8, #0] @ Save calling PC
- mrs r6, spsr
- str r6, [r8, #4] @ Save CPSR
- str r0, [r8, #8] @ Save OLD_R0
- mov r0, sp
- .endm
-
- .macro irq_restore_user_regs
- ldmia sp, {r0 - lr}^ @ Calling r0 - lr
- mov r0, r0
- ldr lr, [sp, #S_PC] @ Get PC
- add sp, sp, #S_FRAME_SIZE
- subs pc, lr, #4 @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_bad_stack
- ldr r13, _armboot_start @ setup our mode stack (enter in banked mode)
- sub r13, r13, #(CFG_MALLOC_LEN) @ move past malloc pool
- sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ move to reserved a couple spots for abort stack
-
- str lr, [r13] @ save caller lr in position 0 of saved stack
- mrs lr, spsr @ get the spsr
- str lr, [r13, #4] @ save spsr in position 1 of saved stack
-
- mov r13, #MODE_SVC @ prepare SVC-Mode
- @ msr spsr_c, r13
- msr spsr, r13 @ switch modes, make sure moves will execute
- mov lr, pc @ capture return pc
- movs pc, lr @ jump to next instruction & switch modes.
- .endm
-
- .macro get_bad_stack_swi
- sub r13, r13, #4 @ space on current stack for scratch reg.
- str r0, [r13] @ save R0's value.
- ldr r0, _armboot_start @ get data regions start
- sub r0, r0, #(CFG_MALLOC_LEN) @ move past malloc pool
- sub r0, r0, #(CFG_GBL_DATA_SIZE+8) @ move past gbl and a couple spots for abort stack
- str lr, [r0] @ save caller lr in position 0 of saved stack
- mrs r0, spsr @ get the spsr
- str lr, [r0, #4] @ save spsr in position 1 of saved stack
- ldr r0, [r13] @ restore r0
- add r13, r13, #4 @ pop stack entry
- .endm
-
- .macro get_irq_stack @ setup IRQ stack
- ldr sp, IRQ_STACK_START
- .endm
-
- .macro get_fiq_stack @ setup FIQ stack
- ldr sp, FIQ_STACK_START
- .endm
-
-/*
- * exception handlers
- */
- .align 5
-undefined_instruction:
- get_bad_stack
- bad_save_user_regs
- bl do_undefined_instruction
-
- .align 5
-software_interrupt:
- get_bad_stack_swi
- bad_save_user_regs
- bl do_software_interrupt
-
- .align 5
-prefetch_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_prefetch_abort
-
- .align 5
-data_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_data_abort
-
- .align 5
-not_used:
- get_bad_stack
- bad_save_user_regs
- bl do_not_used
-
-#ifdef CONFIG_USE_IRQ
-
- .align 5
-irq:
- get_irq_stack
- irq_save_user_regs
- bl do_irq
- irq_restore_user_regs
-
- .align 5
-fiq:
- get_fiq_stack
- /* someone ought to write a more effiction fiq_save_user_regs */
- irq_save_user_regs
- bl do_fiq
- irq_restore_user_regs
-
-#else
-
- .align 5
-irq:
- get_bad_stack
- bad_save_user_regs
- bl do_irq
-
- .align 5
-fiq:
- get_bad_stack
- bad_save_user_regs
- bl do_fiq
-
-#endif
- .align 5
-.global arm1136_cache_flush
-arm1136_cache_flush:
- mcr p15, 0, r1, c7, c5, 0 @ invalidate I cache
- mov pc, lr @ back to caller
-
-#if defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_CINTEGRATOR)
-/* Use the IntegratorCP function from board/integratorcp/platform.S */
-#else
-
- .align 5
-.globl reset_cpu
-reset_cpu:
- ldr r1, rstctl /* get addr for global reset reg */
- mov r3, #0x2 /* full reset pll+mpu */
- str r3, [r1] /* force reset */
- mov r0, r0
-_loop_forever:
- b _loop_forever
-rstctl:
- .word PM_RSTCTRL_WKUP
-
-#endif
diff --git a/cpu/arm720t/Makefile b/cpu/arm720t/Makefile
deleted file mode 100644
index c97f329638..0000000000
--- a/cpu/arm720t/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = serial.o serial_netarm.o interrupts.o cpu.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/arm720t/start.S b/cpu/arm720t/start.S
deleted file mode 100644
index e66d109443..0000000000
--- a/cpu/arm720t/start.S
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * armboot - Startup Code for ARM720 CPU-core
- *
- * Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
- * Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-#include <asm/hardware.h>
-
-/*
- *************************************************************************
- *
- * Jump vector table as in table 3.1 in [1]
- *
- *************************************************************************
- */
-
-
-.globl _start
-_start: b reset
- ldr pc, _undefined_instruction
- ldr pc, _software_interrupt
- ldr pc, _prefetch_abort
- ldr pc, _data_abort
- ldr pc, _not_used
- ldr pc, _irq
- ldr pc, _fiq
-
-_undefined_instruction: .word undefined_instruction
-_software_interrupt: .word software_interrupt
-_prefetch_abort: .word prefetch_abort
-_data_abort: .word data_abort
-_not_used: .word not_used
-_irq: .word irq
-_fiq: .word fiq
-
- .balignl 16,0xdeadbeef
-
-
-/*
- *************************************************************************
- *
- * Startup Code (reset vector)
- *
- * do important init only if we don't start from RAM!
- * relocate armboot to ram
- * setup stack
- * jump to second stage
- *
- *************************************************************************
- */
-
-_TEXT_BASE:
- .word TEXT_BASE
-
-.globl _armboot_start
-_armboot_start:
- .word _start
-
-/*
- * These are defined in the board-specific linker script.
- */
-.globl _bss_start
-_bss_start:
- .word __bss_start
-
-.globl _bss_end
-_bss_end:
- .word _end
-
-#ifdef CONFIG_USE_IRQ
-/* IRQ stack memory (calculated at run-time) */
-.globl IRQ_STACK_START
-IRQ_STACK_START:
- .word 0x0badc0de
-
-/* IRQ stack memory (calculated at run-time) */
-.globl FIQ_STACK_START
-FIQ_STACK_START:
- .word 0x0badc0de
-#endif
-
-
-/*
- * the actual reset code
- */
-
-reset:
- /*
- * set the cpu to SVC32 mode
- */
- mrs r0,cpsr
- bic r0,r0,#0x1f
- orr r0,r0,#0x13
- msr cpsr,r0
-
- /*
- * we do sys-critical inits only at reboot,
- * not when booting from ram!
- */
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
- bl cpu_init_crit
-#endif
-
-#ifndef CONFIG_SKIP_RELOCATE_UBOOT
-relocate: /* relocate U-Boot to RAM */
- adr r0, _start /* r0 <- current position of code */
- ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
- cmp r0, r1 /* don't reloc during debug */
- beq stack_setup
-
-#if TEXT_BASE
- ldr r2, =0x0 /* Relocate the exception vectors */
- cmp r1, r2 /* and associated data to address */
- ldmneia r0!, {r3-r10} /* 0x0. Do nothing if TEXT_BASE is */
- stmneia r2!, {r3-r10} /* 0x0. Copy the first 15 words. */
- ldmneia r0, {r3-r9}
- stmneia r2, {r3-r9}
- adrne r0, _start /* restore r0 */
-#endif
-
- ldr r2, _armboot_start
- ldr r3, _bss_start
- sub r2, r3, r2 /* r2 <- size of armboot */
- add r2, r0, r2 /* r2 <- source end address */
-
-copy_loop:
- ldmia r0!, {r3-r10} /* copy from source address [r0] */
- stmia r1!, {r3-r10} /* copy to target address [r1] */
- cmp r0, r2 /* until source end addreee [r2] */
- ble copy_loop
-
-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
-
- /* Set up the stack */
-stack_setup:
- ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
- sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
- sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
-#ifdef CONFIG_USE_IRQ
- sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
-#endif
- sub sp, r0, #12 /* leave 3 words for abort-stack */
-
-clear_bss:
- ldr r0, _bss_start /* find start of bss segment */
- ldr r1, _bss_end /* stop here */
- mov r2, #0x00000000 /* clear */
-
-clbss_l:str r2, [r0] /* clear loop... */
- add r0, r0, #4
- cmp r0, r1
- ble clbss_l
-
- ldr pc, _start_armboot
-
-_start_armboot: .word start_armboot
-
-/*
- *************************************************************************
- *
- * CPU_init_critical registers
- *
- * setup important registers
- * setup memory timing
- *
- *************************************************************************
- */
-
-#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_ARMADILLO)
-
-/* Interupt-Controller base addresses */
-INTMR1: .word 0x80000280 @ 32 bit size
-INTMR2: .word 0x80001280 @ 16 bit size
-INTMR3: .word 0x80002280 @ 8 bit size
-
-/* SYSCONs */
-SYSCON1: .word 0x80000100
-SYSCON2: .word 0x80001100
-SYSCON3: .word 0x80002200
-
-#define CLKCTL 0x6 /* mask */
-#define CLKCTL_18 0x0 /* 18.432 MHz */
-#define CLKCTL_36 0x2 /* 36.864 MHz */
-#define CLKCTL_49 0x4 /* 49.152 MHz */
-#define CLKCTL_73 0x6 /* 73.728 MHz */
-
-#endif
-
-cpu_init_crit:
-#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_ARMADILLO)
-
- /*
- * mask all IRQs by clearing all bits in the INTMRs
- */
- mov r1, #0x00
- ldr r0, INTMR1
- str r1, [r0]
- ldr r0, INTMR2
- str r1, [r0]
- ldr r0, INTMR3
- str r1, [r0]
-
- /*
- * flush v4 I/D caches
- */
- mov r0, #0
- mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
- mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */
-
- /*
- * disable MMU stuff and caches
- */
- mrc p15,0,r0,c1,c0
- bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)
- bic r0, r0, #0x0000008f @ clear bits 7, 3:0 (B--- WCAM)
- orr r0, r0, #0x00000002 @ set bit 2 (A) Align
- mcr p15,0,r0,c1,c0
-#elif defined(CONFIG_NETARM)
- /*
- * prior to software reset : need to set pin PORTC4 to be *HRESET
- */
- ldr r0, =NETARM_GEN_MODULE_BASE
- ldr r1, =(NETARM_GEN_PORT_MODE(0x10) | \
- NETARM_GEN_PORT_DIR(0x10))
- str r1, [r0, #+NETARM_GEN_PORTC]
- /*
- * software reset : see HW Ref. Guide 8.2.4 : Software Service register
- * for an explanation of this process
- */
- ldr r0, =NETARM_GEN_MODULE_BASE
- ldr r1, =NETARM_GEN_SW_SVC_RESETA
- str r1, [r0, #+NETARM_GEN_SOFTWARE_SERVICE]
- ldr r1, =NETARM_GEN_SW_SVC_RESETB
- str r1, [r0, #+NETARM_GEN_SOFTWARE_SERVICE]
- ldr r1, =NETARM_GEN_SW_SVC_RESETA
- str r1, [r0, #+NETARM_GEN_SOFTWARE_SERVICE]
- ldr r1, =NETARM_GEN_SW_SVC_RESETB
- str r1, [r0, #+NETARM_GEN_SOFTWARE_SERVICE]
- /*
- * setup PLL and System Config
- */
- ldr r0, =NETARM_GEN_MODULE_BASE
-
- ldr r1, =( NETARM_GEN_SYS_CFG_LENDIAN | \
- NETARM_GEN_SYS_CFG_BUSFULL | \
- NETARM_GEN_SYS_CFG_USER_EN | \
- NETARM_GEN_SYS_CFG_ALIGN_ABORT | \
- NETARM_GEN_SYS_CFG_BUSARB_INT | \
- NETARM_GEN_SYS_CFG_BUSMON_EN )
-
- str r1, [r0, #+NETARM_GEN_SYSTEM_CONTROL]
-
-#ifndef CONFIG_NETARM_PLL_BYPASS
- ldr r1, =( NETARM_GEN_PLL_CTL_PLLCNT(NETARM_PLL_COUNT_VAL) | \
- NETARM_GEN_PLL_CTL_POLTST_DEF | \
- NETARM_GEN_PLL_CTL_INDIV(1) | \
- NETARM_GEN_PLL_CTL_ICP_DEF | \
- NETARM_GEN_PLL_CTL_OUTDIV(2) )
- str r1, [r0, #+NETARM_GEN_PLL_CONTROL]
-#endif
-
- /*
- * mask all IRQs by clearing all bits in the INTMRs
- */
- mov r1, #0
- ldr r0, =NETARM_GEN_MODULE_BASE
- str r1, [r0, #+NETARM_GEN_INTR_ENABLE]
-
-#elif defined(CONFIG_S3C4510B)
-
- /*
- * Mask off all IRQ sources
- */
- ldr r1, =REG_INTMASK
- ldr r0, =0x3FFFFF
- str r0, [r1]
-
- /*
- * Disable Cache
- */
- ldr r0, =REG_SYSCFG
- ldr r1, =0x83ffffa0 /* cache-disabled */
- str r1, [r0]
-
-#elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
- /* No specific initialisation for IntegratorAP/CM720T as yet */
-#else
-#error No cpu_init_crit() defined for current CPU type
-#endif
-
-#ifdef CONFIG_ARM7_REVD
- /* set clock speed */
- /* !!! we run @ 36 MHz due to a hardware flaw in Rev. D processors */
- /* !!! not doing DRAM refresh properly! */
- ldr r0, SYSCON3
- ldr r1, [r0]
- bic r1, r1, #CLKCTL
- orr r1, r1, #CLKCTL_36
- str r1, [r0]
-#endif
-
- mov ip, lr
- /*
- * before relocating, we have to setup RAM timing
- * because memory timing is board-dependent, you will
- * find a lowlevel_init.S in your board directory.
- */
- bl lowlevel_init
- mov lr, ip
-
- mov pc, lr
-
-
-/*
- *************************************************************************
- *
- * Interrupt handling
- *
- *************************************************************************
- */
-
-@
-@ IRQ stack frame.
-@
-#define S_FRAME_SIZE 72
-
-#define S_OLD_R0 68
-#define S_PSR 64
-#define S_PC 60
-#define S_LR 56
-#define S_SP 52
-
-#define S_IP 48
-#define S_FP 44
-#define S_R10 40
-#define S_R9 36
-#define S_R8 32
-#define S_R7 28
-#define S_R6 24
-#define S_R5 20
-#define S_R4 16
-#define S_R3 12
-#define S_R2 8
-#define S_R1 4
-#define S_R0 0
-
-#define MODE_SVC 0x13
-#define I_BIT 0x80
-
-/*
- * use bad_save_user_regs for abort/prefetch/undef/swi ...
- * use irq_save_user_regs / irq_restore_user_regs for IRQ/FIQ handling
- */
-
- .macro bad_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Calling r0-r12
- add r8, sp, #S_PC
-
- ldr r2, _armboot_start
- sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
- ldmia r2, {r2 - r4} @ get pc, cpsr, old_r0
- add r0, sp, #S_FRAME_SIZE @ restore sp_SVC
-
- add r5, sp, #S_SP
- mov r1, lr
- stmia r5, {r0 - r4} @ save sp_SVC, lr_SVC, pc, cpsr, old_r
- mov r0, sp
- .endm
-
- .macro irq_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Calling r0-r12
- add r8, sp, #S_PC
- stmdb r8, {sp, lr}^ @ Calling SP, LR
- str lr, [r8, #0] @ Save calling PC
- mrs r6, spsr
- str r6, [r8, #4] @ Save CPSR
- str r0, [r8, #8] @ Save OLD_R0
- mov r0, sp
- .endm
-
- .macro irq_restore_user_regs
- ldmia sp, {r0 - lr}^ @ Calling r0 - lr
- mov r0, r0
- ldr lr, [sp, #S_PC] @ Get PC
- add sp, sp, #S_FRAME_SIZE
- subs pc, lr, #4 @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_bad_stack
- ldr r13, _armboot_start @ setup our mode stack
- sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
-
- str lr, [r13] @ save caller lr / spsr
- mrs lr, spsr
- str lr, [r13, #4]
-
- mov r13, #MODE_SVC @ prepare SVC-Mode
- msr spsr_c, r13
- mov lr, pc
- movs pc, lr
- .endm
-
- .macro get_irq_stack @ setup IRQ stack
- ldr sp, IRQ_STACK_START
- .endm
-
- .macro get_fiq_stack @ setup FIQ stack
- ldr sp, FIQ_STACK_START
- .endm
-
-/*
- * exception handlers
- */
- .align 5
-undefined_instruction:
- get_bad_stack
- bad_save_user_regs
- bl do_undefined_instruction
-
- .align 5
-software_interrupt:
- get_bad_stack
- bad_save_user_regs
- bl do_software_interrupt
-
- .align 5
-prefetch_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_prefetch_abort
-
- .align 5
-data_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_data_abort
-
- .align 5
-not_used:
- get_bad_stack
- bad_save_user_regs
- bl do_not_used
-
-#ifdef CONFIG_USE_IRQ
-
- .align 5
-irq:
- get_irq_stack
- irq_save_user_regs
- bl do_irq
- irq_restore_user_regs
-
- .align 5
-fiq:
- get_fiq_stack
- /* someone ought to write a more effiction fiq_save_user_regs */
- irq_save_user_regs
- bl do_fiq
- irq_restore_user_regs
-
-#else
-
- .align 5
-irq:
- get_bad_stack
- bad_save_user_regs
- bl do_irq
-
- .align 5
-fiq:
- get_bad_stack
- bad_save_user_regs
- bl do_fiq
-
-#endif
-
-#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_ARMADILLO)
- .align 5
-.globl reset_cpu
-reset_cpu:
- mov ip, #0
- mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
- mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
- mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
- bic ip, ip, #0x000f @ ............wcam
- bic ip, ip, #0x2100 @ ..v....s........
- mcr p15, 0, ip, c1, c0, 0 @ ctrl register
- mov pc, r0
-#elif defined(CONFIG_NETARM)
- .align 5
-.globl reset_cpu
-reset_cpu:
- ldr r1, =NETARM_MEM_MODULE_BASE
- ldr r0, [r1, #+NETARM_MEM_CS0_BASE_ADDR]
- ldr r1, =0xFFFFF000
- and r0, r1, r0
- ldr r1, =(relocate-TEXT_BASE)
- add r0, r1, r0
- ldr r4, =NETARM_GEN_MODULE_BASE
- ldr r1, =NETARM_GEN_SW_SVC_RESETA
- str r1, [r4, #+NETARM_GEN_SOFTWARE_SERVICE]
- ldr r1, =NETARM_GEN_SW_SVC_RESETB
- str r1, [r4, #+NETARM_GEN_SOFTWARE_SERVICE]
- ldr r1, =NETARM_GEN_SW_SVC_RESETA
- str r1, [r4, #+NETARM_GEN_SOFTWARE_SERVICE]
- ldr r1, =NETARM_GEN_SW_SVC_RESETB
- str r1, [r4, #+NETARM_GEN_SOFTWARE_SERVICE]
- mov pc, r0
-#elif defined(CONFIG_S3C4510B)
-/* Nothing done here as reseting the CPU is board specific, depending
- * on external peripherals such as watchdog timers, etc. */
-#elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
- /* No specific reset actions for IntegratorAP/CM720T as yet */
-#else
-#error No reset_cpu() defined for current CPU type
-#endif
diff --git a/cpu/arm920t/Makefile b/cpu/arm920t/Makefile
deleted file mode 100644
index aab09ef5bc..0000000000
--- a/cpu/arm920t/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-obj-y += cpu.o interrupts.o
-extra-y += start.o
-obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200/
diff --git a/cpu/arm920t/at91rm9200/Makefile b/cpu/arm920t/at91rm9200/Makefile
deleted file mode 100644
index b553e18c89..0000000000
--- a/cpu/arm920t/at91rm9200/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-obj-$(CONFIG_DRIVER_NET_AT91_ETHER) += bcm5221.o
-obj-$(CONFIG_DRIVER_NET_AT91_ETHER) += dm9161.o
-obj-$(CONFIG_DRIVER_NET_AT91_I2C) += i2c.o
-obj-y += interrupts.o
-obj-y += lowlevel_init.o
-obj-$(CONFIG_DRIVER_NET_AT91_ETHER) += lxt972.o
-obj-y += serial.o
-# obj-y += usb_ohci.o
-
diff --git a/cpu/arm920t/at91rm9200/bcm5221.c b/cpu/arm920t/at91rm9200/bcm5221.c
deleted file mode 100644
index f78b42257b..0000000000
--- a/cpu/arm920t/at91rm9200/bcm5221.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Broadcom BCM5221 Ethernet PHY
- *
- * (C) Copyright 2005 REA Elektronik GmbH <www.rea.de>
- * Anders Larsen <alarsen@rea.de>
- *
- * (C) Copyright 2003
- * Author : Hamid Ikdoumi (Atmel)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <at91rm9200_net.h>
-#include <net.h>
-#include <bcm5221.h>
-
-/*
- * Name:
- * bcm5221_IsPhyConnected
- * Description:
- * Reads the 2 PHY ID registers
- * Arguments:
- * p_mac - pointer to AT91S_EMAC struct
- * Return value:
- * TRUE - if id read successfully
- * FALSE- if error
- */
-unsigned int bcm5221_IsPhyConnected (AT91PS_EMAC p_mac)
-{
- unsigned short Id1, Id2;
-
- at91rm9200_EmacEnableMDIO (p_mac);
- at91rm9200_EmacReadPhy (p_mac, BCM5221_PHYID1, &Id1);
- at91rm9200_EmacReadPhy (p_mac, BCM5221_PHYID2, &Id2);
- at91rm9200_EmacDisableMDIO (p_mac);
-
- if ((Id1 == (BCM5221_PHYID1_OUI >> 6)) &&
- ((Id2 >> 10) == (BCM5221_PHYID1_OUI & BCM5221_LSB_MASK)))
- return TRUE;
-
- return FALSE;
-}
-
-/*
- * Name:
- * bcm5221_GetLinkSpeed
- * Description:
- * Link parallel detection status of MAC is checked and set in the
- * MAC configuration registers
- * Arguments:
- * p_mac - pointer to MAC
- * Return value:
- * TRUE - if link status set succesfully
- * FALSE - if link status not set
- */
-unsigned char bcm5221_GetLinkSpeed (AT91PS_EMAC p_mac)
-{
- unsigned short stat1, stat2;
-
- if (!at91rm9200_EmacReadPhy (p_mac, BCM5221_BMSR, &stat1))
- return FALSE;
-
- if (!(stat1 & BCM5221_LINK_STATUS)) /* link status up? */
- return FALSE;
-
- if (!at91rm9200_EmacReadPhy (p_mac, BCM5221_ACSR, &stat2))
- return FALSE;
-
- if ((stat1 & BCM5221_100BASE_TX_FD) && (stat2 & BCM5221_100) && (stat2 & BCM5221_FDX)) {
- /*set Emac for 100BaseTX and Full Duplex */
- p_mac->EMAC_CFG |= AT91C_EMAC_SPD | AT91C_EMAC_FD;
- return TRUE;
- }
-
- if ((stat1 & BCM5221_10BASE_T_FD) && !(stat2 & BCM5221_100) && (stat2 & BCM5221_FDX)) {
- /*set MII for 10BaseT and Full Duplex */
- p_mac->EMAC_CFG = (p_mac->EMAC_CFG &
- ~(AT91C_EMAC_SPD | AT91C_EMAC_FD))
- | AT91C_EMAC_FD;
- return TRUE;
- }
-
- if ((stat1 & BCM5221_100BASE_TX_HD) && (stat2 & BCM5221_100) && !(stat2 & BCM5221_FDX)) {
- /*set MII for 100BaseTX and Half Duplex */
- p_mac->EMAC_CFG = (p_mac->EMAC_CFG &
- ~(AT91C_EMAC_SPD | AT91C_EMAC_FD))
- | AT91C_EMAC_SPD;
- return TRUE;
- }
-
- if ((stat1 & BCM5221_10BASE_T_HD) && !(stat2 & BCM5221_100) && !(stat2 & BCM5221_FDX)) {
- /*set MII for 10BaseT and Half Duplex */
- p_mac->EMAC_CFG &= ~(AT91C_EMAC_SPD | AT91C_EMAC_FD);
- return TRUE;
- }
- return FALSE;
-}
-
-
-/*
- * Name:
- * bcm5221_InitPhy
- * Description:
- * MAC starts checking its link by using parallel detection and
- * Autonegotiation and the same is set in the MAC configuration registers
- * Arguments:
- * p_mac - pointer to struct AT91S_EMAC
- * Return value:
- * TRUE - if link status set succesfully
- * FALSE - if link status not set
- */
-unsigned char bcm5221_InitPhy (AT91PS_EMAC p_mac)
-{
- unsigned char ret = TRUE;
- unsigned short IntValue;
-
- at91rm9200_EmacEnableMDIO (p_mac);
-
- if (!bcm5221_GetLinkSpeed (p_mac)) {
- /* Try another time */
- ret = bcm5221_GetLinkSpeed (p_mac);
- }
-
- /* Disable PHY Interrupts */
- at91rm9200_EmacReadPhy (p_mac, BCM5221_INTR, &IntValue);
- /* clear FDX LED and INTR Enable */
- IntValue &= ~(BCM5221_FDX_LED | BCM5221_INTR_ENABLE);
- /* set FDX, SPD, Link, INTR masks */
- IntValue |= (BCM5221_FDX_MASK | BCM5221_SPD_MASK |
- BCM5221_LINK_MASK | BCM5221_INTR_MASK);
- at91rm9200_EmacWritePhy (p_mac, BCM5221_INTR, &IntValue);
- at91rm9200_EmacDisableMDIO (p_mac);
-
- return (ret);
-}
-
-
-/*
- * Name:
- * bcm5221_AutoNegotiate
- * Description:
- * MAC Autonegotiates with the partner status of same is set in the
- * MAC configuration registers
- * Arguments:
- * dev - pointer to struct net_device
- * Return value:
- * TRUE - if link status set successfully
- * FALSE - if link status not set
- */
-unsigned char bcm5221_AutoNegotiate (AT91PS_EMAC p_mac, int *status)
-{
- unsigned short value;
- unsigned short PhyAnar;
- unsigned short PhyAnalpar;
-
- /* Set bcm5221 control register */
- if (!at91rm9200_EmacReadPhy (p_mac, BCM5221_BMCR, &value))
- return FALSE;
- value &= ~BCM5221_AUTONEG; /* remove autonegotiation enable */
- value |= BCM5221_ISOLATE; /* Electrically isolate PHY */
- if (!at91rm9200_EmacWritePhy (p_mac, BCM5221_BMCR, &value))
- return FALSE;
-
- /* Set the Auto_negotiation Advertisement Register */
- /* MII advertising for 100BaseTxFD and HD, 10BaseTFD and HD, IEEE 802.3 */
- PhyAnar = BCM5221_TX_FDX | BCM5221_TX_HDX |
- BCM5221_10_FDX | BCM5221_10_HDX | BCM5221_AN_IEEE_802_3;
- if (!at91rm9200_EmacWritePhy (p_mac, BCM5221_ANAR, &PhyAnar))
- return FALSE;
-
- /* Read the Control Register */
- if (!at91rm9200_EmacReadPhy (p_mac, BCM5221_BMCR, &value))
- return FALSE;
-
- value |= BCM5221_SPEED_SELECT | BCM5221_AUTONEG | BCM5221_DUPLEX_MODE;
- if (!at91rm9200_EmacWritePhy (p_mac, BCM5221_BMCR, &value))
- return FALSE;
- /* Restart Auto_negotiation */
- value |= BCM5221_RESTART_AUTONEG;
- value &= ~BCM5221_ISOLATE;
- if (!at91rm9200_EmacWritePhy (p_mac, BCM5221_BMCR, &value))
- return FALSE;
-
- /*check AutoNegotiate complete */
- udelay (10000);
- at91rm9200_EmacReadPhy (p_mac, BCM5221_BMSR, &value);
- if (!(value & BCM5221_AUTONEG_COMP))
- return FALSE;
-
- /* Get the AutoNeg Link partner base page */
- if (!at91rm9200_EmacReadPhy (p_mac, BCM5221_ANLPAR, &PhyAnalpar))
- return FALSE;
-
- if ((PhyAnar & BCM5221_TX_FDX) && (PhyAnalpar & BCM5221_TX_FDX)) {
- /*set MII for 100BaseTX and Full Duplex */
- p_mac->EMAC_CFG |= AT91C_EMAC_SPD | AT91C_EMAC_FD;
- return TRUE;
- }
-
- if ((PhyAnar & BCM5221_10_FDX) && (PhyAnalpar & BCM5221_10_FDX)) {
- /*set MII for 10BaseT and Full Duplex */
- p_mac->EMAC_CFG = (p_mac->EMAC_CFG &
- ~(AT91C_EMAC_SPD | AT91C_EMAC_FD))
- | AT91C_EMAC_FD;
- return TRUE;
- }
- return FALSE;
-}
diff --git a/cpu/arm920t/at91rm9200/dm9161.c b/cpu/arm920t/at91rm9200/dm9161.c
deleted file mode 100644
index ed7fae4e99..0000000000
--- a/cpu/arm920t/at91rm9200/dm9161.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * (C) Copyright 2003
- * Author : Hamid Ikdoumi (Atmel)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <at91rm9200_net.h>
-#include <net.h>
-#include <dm9161.h>
-
-/*
- * Name:
- * dm9161_IsPhyConnected
- * Description:
- * Reads the 2 PHY ID registers
- * Arguments:
- * p_mac - pointer to AT91S_EMAC struct
- * Return value:
- * TRUE - if id read successfully
- * FALSE- if error
- */
-unsigned int dm9161_IsPhyConnected (AT91PS_EMAC p_mac)
-{
- unsigned short Id1, Id2;
-
- at91rm9200_EmacEnableMDIO (p_mac);
- at91rm9200_EmacReadPhy (p_mac, DM9161_PHYID1, &Id1);
- at91rm9200_EmacReadPhy (p_mac, DM9161_PHYID2, &Id2);
- at91rm9200_EmacDisableMDIO (p_mac);
-
- if ((Id1 == (DM9161_PHYID1_OUI >> 6)) &&
- ((Id2 >> 10) == (DM9161_PHYID1_OUI & DM9161_LSB_MASK)))
- return TRUE;
-
- return FALSE;
-}
-
-/*
- * Name:
- * dm9161_GetLinkSpeed
- * Description:
- * Link parallel detection status of MAC is checked and set in the
- * MAC configuration registers
- * Arguments:
- * p_mac - pointer to MAC
- * Return value:
- * TRUE - if link status set succesfully
- * FALSE - if link status not set
- */
-UCHAR dm9161_GetLinkSpeed (AT91PS_EMAC p_mac)
-{
- unsigned short stat1, stat2;
-
- if (!at91rm9200_EmacReadPhy (p_mac, DM9161_BMSR, &stat1))
- return FALSE;
-
- if (!(stat1 & DM9161_LINK_STATUS)) /* link status up? */
- return FALSE;
-
- if (!at91rm9200_EmacReadPhy (p_mac, DM9161_DSCSR, &stat2))
- return FALSE;
-
- if ((stat1 & DM9161_100BASE_TX_FD) && (stat2 & DM9161_100FDX)) {
- /*set Emac for 100BaseTX and Full Duplex */
- p_mac->EMAC_CFG |= AT91C_EMAC_SPD | AT91C_EMAC_FD;
- return TRUE;
- }
-
- if ((stat1 & DM9161_10BASE_T_FD) && (stat2 & DM9161_10FDX)) {
- /*set MII for 10BaseT and Full Duplex */
- p_mac->EMAC_CFG = (p_mac->EMAC_CFG &
- ~(AT91C_EMAC_SPD | AT91C_EMAC_FD))
- | AT91C_EMAC_FD;
- return TRUE;
- }
-
- if ((stat1 & DM9161_100BASE_T4_HD) && (stat2 & DM9161_100HDX)) {
- /*set MII for 100BaseTX and Half Duplex */
- p_mac->EMAC_CFG = (p_mac->EMAC_CFG &
- ~(AT91C_EMAC_SPD | AT91C_EMAC_FD))
- | AT91C_EMAC_SPD;
- return TRUE;
- }
-
- if ((stat1 & DM9161_10BASE_T_HD) && (stat2 & DM9161_10HDX)) {
- /*set MII for 10BaseT and Half Duplex */
- p_mac->EMAC_CFG &= ~(AT91C_EMAC_SPD | AT91C_EMAC_FD);
- return TRUE;
- }
- return FALSE;
-}
-
-
-/*
- * Name:
- * dm9161_InitPhy
- * Description:
- * MAC starts checking its link by using parallel detection and
- * Autonegotiation and the same is set in the MAC configuration registers
- * Arguments:
- * p_mac - pointer to struct AT91S_EMAC
- * Return value:
- * TRUE - if link status set succesfully
- * FALSE - if link status not set
- */
-UCHAR dm9161_InitPhy (AT91PS_EMAC p_mac)
-{
- UCHAR ret = TRUE;
- unsigned short IntValue;
- unsigned int timeout = 4000;
-
- at91rm9200_EmacEnableMDIO (p_mac);
-
- while (!dm9161_GetLinkSpeed (p_mac) && timeout--)
- udelay(1000);
-
- /* Disable PHY Interrupts */
- at91rm9200_EmacReadPhy (p_mac, DM9161_MDINTR, &IntValue);
- /* set FDX, SPD, Link, INTR masks */
- IntValue |= (DM9161_FDX_MASK | DM9161_SPD_MASK |
- DM9161_LINK_MASK | DM9161_INTR_MASK);
- at91rm9200_EmacWritePhy (p_mac, DM9161_MDINTR, &IntValue);
- at91rm9200_EmacDisableMDIO (p_mac);
-
- return (ret);
-}
-
-
-/*
- * Name:
- * dm9161_AutoNegotiate
- * Description:
- * MAC Autonegotiates with the partner status of same is set in the
- * MAC configuration registers
- * Arguments:
- * dev - pointer to struct net_device
- * Return value:
- * TRUE - if link status set successfully
- * FALSE - if link status not set
- */
-UCHAR dm9161_AutoNegotiate (AT91PS_EMAC p_mac, int *status)
-{
- unsigned short value;
- unsigned short PhyAnar;
- unsigned short PhyAnalpar;
-
- /* Set dm9161 control register */
- if (!at91rm9200_EmacReadPhy (p_mac, DM9161_BMCR, &value))
- return FALSE;
- value &= ~DM9161_AUTONEG; /* remove autonegotiation enable */
- value |= DM9161_ISOLATE; /* Electrically isolate PHY */
- if (!at91rm9200_EmacWritePhy (p_mac, DM9161_BMCR, &value))
- return FALSE;
-
- /* Set the Auto_negotiation Advertisement Register */
- /* MII advertising for Next page, 100BaseTxFD and HD, 10BaseTFD and HD, IEEE 802.3 */
- PhyAnar = DM9161_NP | DM9161_TX_FDX | DM9161_TX_HDX |
- DM9161_10_FDX | DM9161_10_HDX | DM9161_AN_IEEE_802_3;
- if (!at91rm9200_EmacWritePhy (p_mac, DM9161_ANAR, &PhyAnar))
- return FALSE;
-
- /* Read the Control Register */
- if (!at91rm9200_EmacReadPhy (p_mac, DM9161_BMCR, &value))
- return FALSE;
-
- value |= DM9161_SPEED_SELECT | DM9161_AUTONEG | DM9161_DUPLEX_MODE;
- if (!at91rm9200_EmacWritePhy (p_mac, DM9161_BMCR, &value))
- return FALSE;
- /* Restart Auto_negotiation */
- value |= DM9161_RESTART_AUTONEG;
- value &= ~DM9161_ISOLATE;
- if (!at91rm9200_EmacWritePhy (p_mac, DM9161_BMCR, &value))
- return FALSE;
-
- /*check AutoNegotiate complete */
- udelay (10000);
- at91rm9200_EmacReadPhy (p_mac, DM9161_BMSR, &value);
- if (!(value & DM9161_AUTONEG_COMP))
- return FALSE;
-
- /* Get the AutoNeg Link partner base page */
- if (!at91rm9200_EmacReadPhy (p_mac, DM9161_ANLPAR, &PhyAnalpar))
- return FALSE;
-
- if ((PhyAnar & DM9161_TX_FDX) && (PhyAnalpar & DM9161_TX_FDX)) {
- /*set MII for 100BaseTX and Full Duplex */
- p_mac->EMAC_CFG |= AT91C_EMAC_SPD | AT91C_EMAC_FD;
- return TRUE;
- }
-
- if ((PhyAnar & DM9161_10_FDX) && (PhyAnalpar & DM9161_10_FDX)) {
- /*set MII for 10BaseT and Full Duplex */
- p_mac->EMAC_CFG = (p_mac->EMAC_CFG &
- ~(AT91C_EMAC_SPD | AT91C_EMAC_FD))
- | AT91C_EMAC_FD;
- return TRUE;
- }
- return FALSE;
-}
diff --git a/cpu/arm920t/at91rm9200/i2c.c b/cpu/arm920t/at91rm9200/i2c.c
deleted file mode 100644
index c9bf0e4cd7..0000000000
--- a/cpu/arm920t/at91rm9200/i2c.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * i2c Support for Atmel's AT91RM9200 Two-Wire Interface
- *
- * (c) Rick Bronson
- *
- * Borrowed heavily from original work by:
- * Copyright (c) 2000 Philip Edelbrock <phil@stimpy.netroedge.com>
- *
- * Modified to work with u-boot by (C) 2004 Gary Jennejohn garyj@denx.de
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
-*/
-#include <common.h>
-
-#include <i2c.h>
-#include <asm/io.h>
-#include <asm/arch/hardware.h>
-
-#include <at91rm9200_i2c.h>
-
-/* define DEBUG */
-
-/*
- * Poll the i2c status register until the specified bit is set.
- * Returns 0 if timed out (100 msec)
- */
-static short at91_poll_status(AT91PS_TWI twi, unsigned long bit) {
- int loop_cntr = 10000;
- do {
- udelay(10);
- } while (!(twi->TWI_SR & bit) && (--loop_cntr > 0));
-
- return (loop_cntr > 0);
-}
-
-/*
- * Generic i2c master transfer entrypoint
- *
- * rw == 1 means that this is a read
- */
-static int
-at91_xfer(unsigned char chip, unsigned int addr, int alen,
- unsigned char *buffer, int len, int rw)
-{
- AT91PS_TWI twi = (AT91PS_TWI) AT91_TWI_BASE;
- int length;
- unsigned char *buf;
- /* Set the TWI Master Mode Register */
- twi->TWI_MMR = (chip << 16) | (alen << 8)
- | ((rw == 1) ? AT91C_TWI_MREAD : 0);
-
- /* Set TWI Internal Address Register with first messages data field */
- if (alen > 0)
- twi->TWI_IADR = addr;
-
- length = len;
- buf = buffer;
- if (length && buf) { /* sanity check */
- if (rw) {
- twi->TWI_CR = AT91C_TWI_START;
- while (length--) {
- if (!length)
- twi->TWI_CR = AT91C_TWI_STOP;
- /* Wait until transfer is finished */
- if (!at91_poll_status(twi, AT91C_TWI_RXRDY)) {
- debug ("at91_i2c: timeout 1\n");
- return 1;
- }
- *buf++ = twi->TWI_RHR;
- }
- if (!at91_poll_status(twi, AT91C_TWI_TXCOMP)) {
- debug ("at91_i2c: timeout 2\n");
- return 1;
- }
- } else {
- twi->TWI_CR = AT91C_TWI_START;
- while (length--) {
- twi->TWI_THR = *buf++;
- if (!length)
- twi->TWI_CR = AT91C_TWI_STOP;
- if (!at91_poll_status(twi, AT91C_TWI_TXRDY)) {
- debug ("at91_i2c: timeout 3\n");
- return 1;
- }
- }
- /* Wait until transfer is finished */
- if (!at91_poll_status(twi, AT91C_TWI_TXCOMP)) {
- debug ("at91_i2c: timeout 4\n");
- return 1;
- }
- }
- }
- return 0;
-}
-
-int
-i2c_probe(unsigned char chip)
-{
- unsigned char buffer[1];
-
- return at91_xfer(chip, 0, 0, buffer, 1, 1);
-}
-
-int
-i2c_read (unsigned char chip, unsigned int addr, int alen,
- unsigned char *buffer, int len)
-{
-#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
- /* we only allow one address byte */
- if (alen > 1)
- return 1;
- /* XXX assume an ATMEL AT24C16 */
- if (alen == 1) {
- addr = addr & 0xff;
- }
-#endif
- return at91_xfer(chip, addr, alen, buffer, len, 1);
-}
-
-int
-i2c_write(unsigned char chip, unsigned int addr, int alen,
- unsigned char *buffer, int len)
-{
-#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
- int i;
- unsigned char *buf;
-
- /* we only allow one address byte */
- if (alen > 1)
- return 1;
- /* XXX assume an ATMEL AT24C16 */
- if (alen == 1) {
- buf = buffer;
- /* do single byte writes */
- for (i = 0; i < len; i++) {
- addr = addr & 0xff;
- if (at91_xfer(chip, addr, alen, buf++, 1, 0))
- return 1;
- addr++;
- }
- return 0;
- }
-#endif
- return at91_xfer(chip, addr, alen, buffer, len, 0);
-}
-
-/*
- * Main initialization routine
- */
-void
-i2c_init(int speed, int slaveaddr)
-{
- AT91PS_TWI twi = (AT91PS_TWI) AT91_TWI_BASE;
-
- *AT91C_PIOA_PDR = AT91C_PA25_TWD | AT91C_PA26_TWCK;
- *AT91C_PIOA_ASR = AT91C_PA25_TWD | AT91C_PA26_TWCK;
- *AT91C_PIOA_MDER = AT91C_PA25_TWD | AT91C_PA26_TWCK;
- *AT91C_PMC_PCER = 1 << AT91C_ID_TWI; /* enable peripheral clock */
-
- twi->TWI_IDR = 0x3ff; /* Disable all interrupts */
- twi->TWI_CR = AT91C_TWI_SWRST; /* Reset peripheral */
- twi->TWI_CR = AT91C_TWI_MSEN | AT91C_TWI_SVDIS; /* Set Master mode */
-
- /* Here, CKDIV = 1 and CHDIV=CLDIV ==> CLDIV = CHDIV = 1/4*((Fmclk/FTWI) -6) */
- twi->TWI_CWGR = AT91C_TWI_CKDIV1 | AT91C_TWI_CLDIV3 | (AT91C_TWI_CLDIV3 << 8);
-
- debug ("Found AT91 i2c\n");
- return;
-}
-
-uchar i2c_reg_read(uchar i2c_addr, uchar reg)
-{
- unsigned char buf;
-
- i2c_read(i2c_addr, reg, 1, &buf, 1);
-
- return(buf);
-}
-
-void i2c_reg_write(uchar i2c_addr, uchar reg, uchar val)
-{
- i2c_write(i2c_addr, reg, 1, &val, 1);
-}
diff --git a/cpu/arm920t/at91rm9200/interrupts.c b/cpu/arm920t/at91rm9200/interrupts.c
deleted file mode 100644
index 0614233ead..0000000000
--- a/cpu/arm920t/at91rm9200/interrupts.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * (C) Copyright 2002
- * Lineo, Inc. <www.lineo.com>
- * Bernhard Kuhn <bkuhn@lineo.com>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <clock.h>
-#include <init.h>
-#include <asm/arch/hardware.h>
-
-AT91PS_TC tmr;
-
-uint64_t at91rm9200_clocksource_read(void)
-{
- return (tmr->TC_CV & 0x0000ffff);
-}
-
-static struct clocksource cs = {
- .read = at91rm9200_clocksource_read,
- .mask = 0x0000ffff,
- .shift = 10,
-};
-
-static int clocksource_init (void)
-{
- tmr = AT91C_BASE_TC0;
-
- /* enables TC1.0 clock */
- *AT91C_PMC_PCER = 1 << AT91C_ID_TC0; /* enable clock */
-
- *AT91C_TCB0_BCR = 0;
- *AT91C_TCB0_BMR = AT91C_TCB_TC0XC0S_NONE | AT91C_TCB_TC1XC1S_NONE | AT91C_TCB_TC2XC2S_NONE;
- tmr->TC_CCR = AT91C_TC_CLKDIS;
-#define AT91C_TC_CMR_CPCTRG (1 << 14)
- /* set to MCLK/2 and restart the timer when the vlaue in TC_RC is reached */
- tmr->TC_CMR = AT91C_TC_TIMER_DIV1_CLOCK | AT91C_TC_CMR_CPCTRG;
-
- tmr->TC_IDR = ~0ul;
- tmr->TC_RC = 0xffff;
- tmr->TC_CCR = AT91C_TC_SWTRG | AT91C_TC_CLKEN;
-
- cs.mult = clocksource_hz2mult(CLOCK_TICK_RATE, cs.shift);
- init_clock(&cs);
- return 0;
-}
-
-core_initcall(clocksource_init);
-
-/*
- * Reset the cpu by setting up the watchdog timer and let him time out
- * or toggle a GPIO pin on the AT91RM9200DK board
- */
-void reset_cpu (ulong ignored)
-{
-
-#ifdef CONFIG_DBGU
- AT91PS_USART us = (AT91PS_USART) AT91C_BASE_DBGU;
-#endif
-#ifdef CONFIG_USART0
- AT91PS_USART us = AT91C_BASE_US0;
-#endif
-#ifdef CONFIG_USART1
- AT91PS_USART us = AT91C_BASE_US1;
-#endif
-#ifdef CONFIG_AT91RM9200DK
- AT91PS_PIO pio = AT91C_BASE_PIOA;
-#endif
-
- /*shutdown the console to avoid strange chars during reset */
- us->US_CR = (AT91C_US_RSTRX | AT91C_US_RSTTX);
-
-#ifdef CONFIG_AT91RM9200DK
- /* Clear PA19 to trigger the hard reset */
- pio->PIO_CODR = 0x00080000;
- pio->PIO_OER = 0x00080000;
- pio->PIO_PER = 0x00080000;
-#endif
-
- /* this is the way Linux does it */
-
- /* FIXME:
- * These defines should be moved into
- * include/asm-arm/arch-at91rm9200/AT91RM9200.h
- * as soon as the whitespace fix gets applied.
- */
- #define AT91C_ST_RSTEN (0x1 << 16)
- #define AT91C_ST_EXTEN (0x1 << 17)
- #define AT91C_ST_WDRST (0x1 << 0)
- #define ST_WDMR *((unsigned long *)0xfffffd08) /* watchdog mode register */
- #define ST_CR *((unsigned long *)0xfffffd00) /* system clock control register */
-
- ST_WDMR = AT91C_ST_RSTEN | AT91C_ST_EXTEN | 1 ;
- ST_CR = AT91C_ST_WDRST;
-
- while (1);
- /* Never reached */
-}
diff --git a/cpu/arm920t/at91rm9200/lowlevel_init.S b/cpu/arm920t/at91rm9200/lowlevel_init.S
deleted file mode 100644
index 1902bd02c5..0000000000
--- a/cpu/arm920t/at91rm9200/lowlevel_init.S
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Memory Setup stuff - taken from blob memsetup.S
- *
- * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and
- * Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
- *
- * Modified for the at91rm9200dk board by
- * (C) Copyright 2004
- * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <version.h>
-
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
-/*
- * some parameters for the board
- *
- * This is based on rm9200dk.cfg for the BDI2000 from ABATRON which in
- * turn is based on the boot.bin code from ATMEL
- *
- */
-
-/* flash */
-#define MC_PUIA 0xFFFFFF10
-#define MC_PUP 0xFFFFFF50
-#define MC_PUER 0xFFFFFF54
-#define MC_ASR 0xFFFFFF04
-#define MC_AASR 0xFFFFFF08
-#define EBI_CFGR 0xFFFFFF64
-#define SMC2_CSR 0xFFFFFF70
-
-/* clocks */
-#define PLLAR 0xFFFFFC28
-#define PLLBR 0xFFFFFC2C
-#define MCKR 0xFFFFFC30
-
-#define AT91C_BASE_CKGR 0xFFFFFC20
-#define CKGR_MOR 0
-
-/* sdram */
-#define PIOC_ASR 0xFFFFF870
-#define PIOC_BSR 0xFFFFF874
-#define PIOC_PDR 0xFFFFF804
-#define EBI_CSA 0xFFFFFF60
-#define SDRC_CR 0xFFFFFF98
-#define SDRC_MR 0xFFFFFF90
-#define SDRC_TR 0xFFFFFF94
-
-
-_MTEXT_BASE:
-#undef START_FROM_MEM
-#ifdef START_FROM_MEM
- .word TEXT_BASE-PHYS_FLASH_1
-#else
- .word TEXT_BASE
-#endif
-
-.globl lowlevel_init
-lowlevel_init:
- /* Get the CKGR Base Address */
- ldr r1, =AT91C_BASE_CKGR
- /* Main oscillator Enable register */
-#ifdef CFG_USE_MAIN_OSCILLATOR
- ldr r0, =0x0000FF01 /* Enable main oscillator, OSCOUNT = 0xFF */
-#else
- ldr r0, =0x0000FF00 /* Disable main oscillator, OSCOUNT = 0xFF */
-#endif
- str r0, [r1, #CKGR_MOR]
- /* Add loop to compensate Main Oscillator startup time */
- ldr r0, =0x00000010
-LoopOsc:
- subs r0, r0, #1
- bhi LoopOsc
-
- /* memory control configuration */
- /* this isn't very elegant, but what the heck */
- ldr r0, =SMRDATA
- ldr r1, _MTEXT_BASE
- sub r0, r0, r1
- add r2, r0, #80
-0:
- /* the address */
- ldr r1, [r0], #4
- /* the value */
- ldr r3, [r0], #4
- str r3, [r1]
- cmp r2, r0
- bne 0b
- /* delay - this is all done by guess */
- ldr r0, =0x00010000
-1:
- subs r0, r0, #1
- bhi 1b
- ldr r0, =SMRDATA1
- ldr r1, _MTEXT_BASE
- sub r0, r0, r1
- add r2, r0, #176
-2:
- /* the address */
- ldr r1, [r0], #4
- /* the value */
- ldr r3, [r0], #4
- str r3, [r1]
- cmp r2, r0
- bne 2b
-
- /* switch from FastBus to Asynchronous clock mode */
- mrc p15, 0, r0, c1, c0, 0
- orr r0, r0, #0xC0000000 @ set bit 31 (iA) and 30 (nF)
- mcr p15, 0, r0, c1, c0, 0
-
- /* everything is fine now */
- mov pc, lr
-
- .ltorg
-
-SMRDATA:
- .word MC_PUIA
- .word MC_PUIA_VAL
- .word MC_PUP
- .word MC_PUP_VAL
- .word MC_PUER
- .word MC_PUER_VAL
- .word MC_ASR
- .word MC_ASR_VAL
- .word MC_AASR
- .word MC_AASR_VAL
- .word EBI_CFGR
- .word EBI_CFGR_VAL
- .word SMC2_CSR
- .word SMC2_CSR_VAL
- .word PLLAR
- .word PLLAR_VAL
- .word PLLBR
- .word PLLBR_VAL
- .word MCKR
- .word MCKR_VAL
- /* SMRDATA is 80 bytes long */
- /* here there's a delay of 100 */
-SMRDATA1:
- .word PIOC_ASR
- .word PIOC_ASR_VAL
- .word PIOC_BSR
- .word PIOC_BSR_VAL
- .word PIOC_PDR
- .word PIOC_PDR_VAL
- .word EBI_CSA
- .word EBI_CSA_VAL
- .word SDRC_CR
- .word SDRC_CR_VAL
- .word SDRC_MR
- .word SDRC_MR_VAL
- .word SDRAM
- .word SDRAM_VAL
- .word SDRC_MR
- .word SDRC_MR_VAL1
- .word SDRAM
- .word SDRAM_VAL
- .word SDRAM
- .word SDRAM_VAL
- .word SDRAM
- .word SDRAM_VAL
- .word SDRAM
- .word SDRAM_VAL
- .word SDRAM
- .word SDRAM_VAL
- .word SDRAM
- .word SDRAM_VAL
- .word SDRAM
- .word SDRAM_VAL
- .word SDRAM
- .word SDRAM_VAL
- .word SDRC_MR
- .word SDRC_MR_VAL2
- .word SDRAM1
- .word SDRAM_VAL
- .word SDRC_TR
- .word SDRC_TR_VAL
- .word SDRAM
- .word SDRAM_VAL
- .word SDRC_MR
- .word SDRC_MR_VAL3
- .word SDRAM
- .word SDRAM_VAL
- /* SMRDATA1 is 176 bytes long */
-#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
diff --git a/cpu/arm920t/at91rm9200/lxt972.c b/cpu/arm920t/at91rm9200/lxt972.c
deleted file mode 100644
index df45f23a36..0000000000
--- a/cpu/arm920t/at91rm9200/lxt972.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- *
- * (C) Copyright 2003
- * Author : Hamid Ikdoumi (Atmel)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * Adapted for KwikByte KB920x board: 22APR2005
- */
-
-#include <common.h>
-#include <at91rm9200_net.h>
-#include <net.h>
-#include <lxt971a.h>
-
-/*
- * Name:
- * lxt972_IsPhyConnected
- * Description:
- * Reads the 2 PHY ID registers
- * Arguments:
- * p_mac - pointer to AT91S_EMAC struct
- * Return value:
- * TRUE - if id read successfully
- * FALSE- if error
- */
-unsigned int lxt972_IsPhyConnected (AT91PS_EMAC p_mac)
-{
- unsigned short Id1, Id2;
-
- at91rm9200_EmacEnableMDIO (p_mac);
- at91rm9200_EmacReadPhy (p_mac, PHY_COMMON_ID1, &Id1);
- at91rm9200_EmacReadPhy (p_mac, PHY_COMMON_ID2, &Id2);
- at91rm9200_EmacDisableMDIO (p_mac);
-
- if ((Id1 == (0x0013)) && ((Id2 & 0xFFF0) == 0x78E0))
- return TRUE;
-
- return FALSE;
-}
-
-/*
- * Name:
- * lxt972_GetLinkSpeed
- * Description:
- * Link parallel detection status of MAC is checked and set in the
- * MAC configuration registers
- * Arguments:
- * p_mac - pointer to MAC
- * Return value:
- * TRUE - if link status set succesfully
- * FALSE - if link status not set
- */
-UCHAR lxt972_GetLinkSpeed (AT91PS_EMAC p_mac)
-{
- unsigned short stat1;
-
- if (!at91rm9200_EmacReadPhy (p_mac, PHY_LXT971_STAT2, &stat1))
- return FALSE;
-
- if (!(stat1 & PHY_LXT971_STAT2_LINK)) /* link status up? */
- return FALSE;
-
- if (stat1 & PHY_LXT971_STAT2_100BTX) {
-
- if (stat1 & PHY_LXT971_STAT2_DUPLEX_MODE) {
-
- /*set Emac for 100BaseTX and Full Duplex */
- p_mac->EMAC_CFG |= AT91C_EMAC_SPD | AT91C_EMAC_FD;
- } else {
-
- /*set Emac for 100BaseTX and Half Duplex */
- p_mac->EMAC_CFG = (p_mac->EMAC_CFG &
- ~(AT91C_EMAC_SPD | AT91C_EMAC_FD))
- | AT91C_EMAC_SPD;
- }
-
- return TRUE;
-
- } else {
-
- if (stat1 & PHY_LXT971_STAT2_DUPLEX_MODE) {
-
- /*set MII for 10BaseT and Full Duplex */
- p_mac->EMAC_CFG = (p_mac->EMAC_CFG &
- ~(AT91C_EMAC_SPD | AT91C_EMAC_FD))
- | AT91C_EMAC_FD;
- } else {
-
- /*set MII for 10BaseT and Half Duplex */
- p_mac->EMAC_CFG &= ~(AT91C_EMAC_SPD | AT91C_EMAC_FD);
- }
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-/*
- * Name:
- * lxt972_InitPhy
- * Description:
- * MAC starts checking its link by using parallel detection and
- * Autonegotiation and the same is set in the MAC configuration registers
- * Arguments:
- * p_mac - pointer to struct AT91S_EMAC
- * Return value:
- * TRUE - if link status set succesfully
- * FALSE - if link status not set
- */
-UCHAR lxt972_InitPhy (AT91PS_EMAC p_mac)
-{
- UCHAR ret = TRUE;
-
- at91rm9200_EmacEnableMDIO (p_mac);
-
- if (!lxt972_GetLinkSpeed (p_mac)) {
- /* Try another time */
- ret = lxt972_GetLinkSpeed (p_mac);
- }
-
- /* Disable PHY Interrupts */
- at91rm9200_EmacWritePhy (p_mac, PHY_LXT971_INT_ENABLE, 0);
-
- at91rm9200_EmacDisableMDIO (p_mac);
-
- return (ret);
-}
-
-
-/*
- * Name:
- * lxt972_AutoNegotiate
- * Description:
- * MAC Autonegotiates with the partner status of same is set in the
- * MAC configuration registers
- * Arguments:
- * dev - pointer to struct net_device
- * Return value:
- * TRUE - if link status set successfully
- * FALSE - if link status not set
- */
-UCHAR lxt972_AutoNegotiate (AT91PS_EMAC p_mac, int *status)
-{
- unsigned short value;
-
- /* Set lxt972 control register */
- if (!at91rm9200_EmacReadPhy (p_mac, PHY_COMMON_CTRL, &value))
- return FALSE;
-
- /* Restart Auto_negotiation */
- value |= PHY_COMMON_CTRL_RES_AUTO;
- if (!at91rm9200_EmacWritePhy (p_mac, PHY_COMMON_CTRL, &value))
- return FALSE;
-
- /*check AutoNegotiate complete */
- udelay (10000);
- at91rm9200_EmacReadPhy (p_mac, PHY_COMMON_STAT, &value);
- if (!(value & PHY_COMMON_STAT_AN_COMP))
- return FALSE;
-
- return (lxt972_GetLinkSpeed (p_mac));
-}
diff --git a/cpu/arm920t/ks8695/Makefile b/cpu/arm920t/ks8695/Makefile
deleted file mode 100644
index 7db9473524..0000000000
--- a/cpu/arm920t/ks8695/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(SOC).a
-
-COBJS = interrupts.o serial.o
-SOBJS = lowlevel_init.o
-
-SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-
-all: $(obj).depend $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/arm920t/ks8695/interrupts.c b/cpu/arm920t/ks8695/interrupts.c
deleted file mode 100644
index 7f7377be00..0000000000
--- a/cpu/arm920t/ks8695/interrupts.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * (C) Copyright 2004-2005, Greg Ungerer <greg.ungerer@opengear.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/arch/platform.h>
-
-/*
- * Handy KS8695 register access functions.
- */
-#define ks8695_read(a) *((volatile ulong *) (KS8695_IO_BASE + (a)))
-#define ks8695_write(a,v) *((volatile ulong *) (KS8695_IO_BASE + (a))) = (v)
-
-int timer_inited;
-ulong timer_ticks;
-
-int interrupt_init (void)
-{
- /* nothing happens here - we don't setup any IRQs */
- return (0);
-}
-
-/*
- * Initial timer set constants. Nothing complicated, just set for a 1ms
- * tick.
- */
-#define TIMER_INTERVAL (TICKS_PER_uSEC * mSEC_1)
-#define TIMER_COUNT (TIMER_INTERVAL / 2)
-#define TIMER_PULSE TIMER_COUNT
-
-void reset_timer_masked(void)
-{
- /* Set the hadware timer for 1ms */
- ks8695_write(KS8695_TIMER1, TIMER_COUNT);
- ks8695_write(KS8695_TIMER1_PCOUNT, TIMER_PULSE);
- ks8695_write(KS8695_TIMER_CTRL, 0x2);
- timer_ticks = 0;
- timer_inited++;
-}
-
-void reset_timer(void)
-{
- reset_timer_masked();
-}
-
-ulong get_timer_masked(void)
-{
- /* Check for timer wrap */
- if (ks8695_read(KS8695_INT_STATUS) & KS8695_INTMASK_TIMERINT1) {
- /* Clear interrupt condition */
- ks8695_write(KS8695_INT_STATUS, KS8695_INTMASK_TIMERINT1);
- timer_ticks++;
- }
- return timer_ticks;
-}
-
-ulong get_timer(ulong base)
-{
- return (get_timer_masked() - base);
-}
-
-void set_timer(ulong t)
-{
- timer_ticks = t;
-}
-
-void reset_cpu (ulong ignored)
-{
- ulong tc;
-
- /* Set timer0 to watchdog, and let it timeout */
- tc = ks8695_read(KS8695_TIMER_CTRL) & 0x2;
- ks8695_write(KS8695_TIMER_CTRL, tc);
- ks8695_write(KS8695_TIMER0, ((10 << 8) | 0xff));
- ks8695_write(KS8695_TIMER_CTRL, (tc | 0x1));
-
- /* Should only wait here till watchdog resets */
- for (;;)
- ;
-}
diff --git a/cpu/arm920t/ks8695/lowlevel_init.S b/cpu/arm920t/ks8695/lowlevel_init.S
deleted file mode 100644
index e9f1227dd6..0000000000
--- a/cpu/arm920t/ks8695/lowlevel_init.S
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * lowlevel_init.S - basic hardware initialization for the KS8695 CPU
- *
- * Copyright (c) 2004-2005, Greg Ungerer <greg.ungerer@opengear.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <version.h>
-#include <asm/arch/platform.h>
-
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
-
-/*
- *************************************************************************
- *
- * Handy dandy macros
- *
- *************************************************************************
- */
-
-/* Delay a bit */
-.macro DELAY_FOR cycles, reg0
- ldr \reg0, =\cycles
- subs \reg0, \reg0, #1
- subne pc, pc, #0xc
-.endm
-
-/*
- *************************************************************************
- *
- * Some local storage.
- *
- *************************************************************************
- */
-
-/* Should we boot with an interactive console or not */
-.globl serial_console
-
-/*
- *************************************************************************
- *
- * Raw hardware initialization code. The important thing is to get
- * SDRAM setup and running. We do some other basic things here too,
- * like getting the PLL set for high speed, and init the LEDs.
- *
- *************************************************************************
- */
-
-.globl lowlevel_init
-lowlevel_init:
-
-#if DEBUG
- /*
- * enable UART for early debug trace
- */
- ldr r1, =(KS8695_IO_BASE+KS8695_UART_DIVISOR)
- mov r2, #0xd9
- str r2, [r1] /* 115200 baud */
- ldr r1, =(KS8695_IO_BASE+KS8695_UART_LINE_CTRL)
- mov r2, #0x03
- str r2, [r1] /* 8 data bits, no parity, 1 stop */
- ldr r1, =(KS8695_IO_BASE+KS8695_UART_TX_HOLDING)
- mov r2, #0x41
- str r2, [r1] /* write 'A' */
-#endif
-#if DEBUG
- ldr r1, =(KS8695_IO_BASE+KS8695_UART_TX_HOLDING)
- mov r2, #0x42
- str r2, [r1]
-#endif
-
- /*
- * remap the memory and flash regions. we want to end up with
- * ram from address 0, and flash at 32MB.
- */
- ldr r1, =(KS8695_IO_BASE+KS8695_MEM_CTRL0)
- ldr r2, =0xbfc00040
- str r2, [r1] /* large flash map */
- ldr pc, =(highflash+0x02000000-0x00f00000) /* jump to high flash address */
-highflash:
- ldr r2, =0x8fe00040
- str r2, [r1] /* remap flash range */
-
- /*
- * remap the second select region to the 4MB immediately after
- * the first region. This way if you have a larger flash (say 8Mb)
- * then you can have it all mapped nicely. Has no effect if you
- * only have a 4Mb or smaller flash.
- */
- ldr r1, =(KS8695_IO_BASE+KS8695_MEM_CTRL1)
- ldr r2, =0x9fe40040
- str r2, [r1] /* remap flash2 region, contiguous */
- ldr r1, =(KS8695_IO_BASE+KS8695_MEM_GENERAL)
- ldr r2, =0x30000005
- str r2, [r1] /* enable both flash selects */
-
-#ifdef CONFIG_CM41xx
- /*
- * map the second flash chip, using the external IO lines.
- */
- ldr r1, =(KS8695_IO_BASE+KS8695_IO_CTRL0)
- ldr r2, =0xafe80b6d
- str r2, [r1] /* remap io0 region, contiguous */
- ldr r1, =(KS8695_IO_BASE+KS8695_IO_CTRL1)
- ldr r2, =0xbfec0b6d
- str r2, [r1] /* remap io1 region, contiguous */
- ldr r1, =(KS8695_IO_BASE+KS8695_MEM_GENERAL)
- ldr r2, =0x30050005
- str r2, [r1] /* enable second flash */
-#endif
-
- /*
- * before relocating, we have to setup RAM timing
- */
- ldr r1, =(KS8695_IO_BASE+KS8695_SDRAM_CTRL0)
-#if (PHYS_SDRAM_1_SIZE == 0x02000000)
- ldr r2, =0x7fc0000e /* 32MB */
-#else
- ldr r2, =0x3fc0000e /* 16MB */
-#endif
- str r2, [r1] /* configure sdram bank0 setup */
- ldr r1, =(KS8695_IO_BASE+KS8695_SDRAM_CTRL1)
- mov r2, #0
- str r2, [r1] /* configure sdram bank1 setup */
-
- ldr r1, =(KS8695_IO_BASE+KS8695_SDRAM_GENERAL)
- ldr r2, =0x0000000a
- str r2, [r1] /* set RAS/CAS timing */
-
- ldr r1, =(KS8695_IO_BASE+KS8695_SDRAM_BUFFER)
- ldr r2, =0x00030000
- str r2, [r1] /* send NOP command */
- DELAY_FOR 0x100, r0
- ldr r2, =0x00010000
- str r2, [r1] /* send PRECHARGE-ALL */
- DELAY_FOR 0x100, r0
-
- ldr r1, =(KS8695_IO_BASE+KS8695_SDRAM_REFRESH)
- ldr r2, =0x00000020
- str r2, [r1] /* set for fast refresh */
- DELAY_FOR 0x100, r0
- ldr r2, =0x00000190
- str r2, [r1] /* set normal refresh timing */
-
- ldr r1, =(KS8695_IO_BASE+KS8695_SDRAM_BUFFER)
- ldr r2, =0x00020033
- str r2, [r1] /* send mode command */
- DELAY_FOR 0x100, r0
- ldr r2, =0x01f00000
- str r2, [r1] /* enable sdram fifos */
-
- /*
- * set pll to top speed
- */
- ldr r1, =(KS8695_IO_BASE+KS8695_SYSTEN_BUS_CLOCK)
- mov r2, #0
- str r2, [r1] /* set pll clock to 166MHz */
-
- ldr r1, =(KS8695_IO_BASE+KS8695_SWITCH_CTRL0)
- ldr r2, [r1] /* Get switch ctrl0 register */
- and r2, r2, #0x0fc00000 /* Mask out LED control bits */
- orr r2, r2, #0x01800000 /* Set Link/activity/speed actions */
- str r2, [r1]
-
-#ifdef CONFIG_CM4008
- ldr r1, =(KS8695_IO_BASE+KS8695_GPIO_MODE)
- ldr r2, =0x0000fe30
- str r2, [r1] /* enable LED's as outputs */
- ldr r1, =(KS8695_IO_BASE+KS8695_GPIO_DATA)
- ldr r2, =0x0000fe20
- str r2, [r1] /* turn on power LED */
-#endif
-#if defined(CONFIG_CM4008) || defined(CONFIG_CM41xx)
- ldr r2, [r1] /* get current GPIO input data */
- tst r2, #0x8 /* check if "erase" depressed */
- beq nobutton
- mov r2, #0 /* be quiet on boot, no console */
- ldr r1, =serial_console
- str r2, [r1]
-nobutton:
-#endif
-
- add lr, lr, #0x02000000 /* flash is now mapped high */
- add ip, ip, #0x02000000 /* this is a hack */
- mov pc, lr /* all done, return */
-
-#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
diff --git a/cpu/arm920t/s3c24x0/Makefile b/cpu/arm920t/s3c24x0/Makefile
deleted file mode 100644
index 3a7c4b35fd..0000000000
--- a/cpu/arm920t/s3c24x0/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(SOC).a
-
-COBJS = i2c.o interrupts.o serial.o speed.o \
- usb_ohci.o
-
-SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-
-all: $(obj).depend $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/arm920t/s3c24x0/i2c.c b/cpu/arm920t/s3c24x0/i2c.c
deleted file mode 100644
index 7d02cdc161..0000000000
--- a/cpu/arm920t/s3c24x0/i2c.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * (C) Copyright 2002
- * David Mueller, ELSOFT AG, d.mueller@elsoft.ch
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* This code should work for both the S3C2400 and the S3C2410
- * as they seem to have the same I2C controller inside.
- * The different address mapping is handled by the s3c24xx.h files below.
- */
-
-#include <common.h>
-
-#ifdef CONFIG_DRIVER_S3C24X0_I2C
-
-#if defined(CONFIG_S3C2400)
-#include <s3c2400.h>
-#elif defined(CONFIG_S3C2410)
-#include <s3c2410.h>
-#endif
-#include <i2c.h>
-
-#ifdef CONFIG_HARD_I2C
-
-#define I2C_WRITE 0
-#define I2C_READ 1
-
-#define I2C_OK 0
-#define I2C_NOK 1
-#define I2C_NACK 2
-#define I2C_NOK_LA 3 /* Lost arbitration */
-#define I2C_NOK_TOUT 4 /* time out */
-
-#define I2CSTAT_BSY 0x20 /* Busy bit */
-#define I2CSTAT_NACK 0x01 /* Nack bit */
-#define I2CCON_IRPND 0x10 /* Interrupt pending bit */
-#define I2C_MODE_MT 0xC0 /* Master Transmit Mode */
-#define I2C_MODE_MR 0x80 /* Master Receive Mode */
-#define I2C_START_STOP 0x20 /* START / STOP */
-#define I2C_TXRX_ENA 0x10 /* I2C Tx/Rx enable */
-
-#define I2C_TIMEOUT 1 /* 1 second */
-
-
-static int GetI2CSDA(void)
-{
- S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
-
-#ifdef CONFIG_S3C2410
- return (gpio->GPEDAT & 0x8000) >> 15;
-#endif
-#ifdef CONFIG_S3C2400
- return (gpio->PGDAT & 0x0020) >> 5;
-#endif
-}
-
-
-static void SetI2CSCL(int x)
-{
- S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
-
-#ifdef CONFIG_S3C2410
- gpio->GPEDAT = (gpio->GPEDAT & ~0x4000) | (x&1) << 14;
-#endif
-#ifdef CONFIG_S3C2400
- gpio->PGDAT = (gpio->PGDAT & ~0x0040) | (x&1) << 6;
-#endif
-}
-
-
-static int WaitForXfer (void)
-{
- S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
- int i, status;
-
- i = I2C_TIMEOUT * 10000;
- status = i2c->IICCON;
- while ((i > 0) && !(status & I2CCON_IRPND)) {
- udelay (100);
- status = i2c->IICCON;
- i--;
- }
-
- return (status & I2CCON_IRPND) ? I2C_OK : I2C_NOK_TOUT;
-}
-
-static int IsACK (void)
-{
- S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
-
- return (!(i2c->IICSTAT & I2CSTAT_NACK));
-}
-
-static void ReadWriteByte (void)
-{
- S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
-
- i2c->IICCON &= ~I2CCON_IRPND;
-}
-
-void i2c_init (int speed, int slaveadd)
-{
- S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
- S3C24X0_GPIO *const gpio = S3C24X0_GetBase_GPIO ();
- ulong freq, pres = 16, div;
- int i, status;
-
- /* wait for some time to give previous transfer a chance to finish */
-
- i = I2C_TIMEOUT * 1000;
- status = i2c->IICSTAT;
- while ((i > 0) && (status & I2CSTAT_BSY)) {
- udelay (1000);
- status = i2c->IICSTAT;
- i--;
- }
-
- if ((status & I2CSTAT_BSY) || GetI2CSDA () == 0) {
-#ifdef CONFIG_S3C2410
- ulong old_gpecon = gpio->GPECON;
-#endif
-#ifdef CONFIG_S3C2400
- ulong old_gpecon = gpio->PGCON;
-#endif
- /* bus still busy probably by (most) previously interrupted transfer */
-
-#ifdef CONFIG_S3C2410
- /* set I2CSDA and I2CSCL (GPE15, GPE14) to GPIO */
- gpio->GPECON = (gpio->GPECON & ~0xF0000000) | 0x10000000;
-#endif
-#ifdef CONFIG_S3C2400
- /* set I2CSDA and I2CSCL (PG5, PG6) to GPIO */
- gpio->PGCON = (gpio->PGCON & ~0x00003c00) | 0x00001000;
-#endif
-
- /* toggle I2CSCL until bus idle */
- SetI2CSCL (0);
- udelay (1000);
- i = 10;
- while ((i > 0) && (GetI2CSDA () != 1)) {
- SetI2CSCL (1);
- udelay (1000);
- SetI2CSCL (0);
- udelay (1000);
- i--;
- }
- SetI2CSCL (1);
- udelay (1000);
-
- /* restore pin functions */
-#ifdef CONFIG_S3C2410
- gpio->GPECON = old_gpecon;
-#endif
-#ifdef CONFIG_S3C2400
- gpio->PGCON = old_gpecon;
-#endif
- }
-
- /* calculate prescaler and divisor values */
- freq = get_PCLK ();
- if ((freq / pres / (16 + 1)) > speed)
- /* set prescaler to 512 */
- pres = 512;
-
- div = 0;
- while ((freq / pres / (div + 1)) > speed)
- div++;
-
- /* set prescaler, divisor according to freq, also set
- * ACKGEN, IRQ */
- i2c->IICCON = (div & 0x0F) | 0xA0 | ((pres == 512) ? 0x40 : 0);
-
- /* init to SLAVE REVEIVE and set slaveaddr */
- i2c->IICSTAT = 0;
- i2c->IICADD = slaveadd;
- /* program Master Transmit (and implicit STOP) */
- i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA;
-
-}
-
-/*
- * cmd_type is 0 for write, 1 for read.
- *
- * addr_len can take any value from 0-255, it is only limited
- * by the char, we could make it larger if needed. If it is
- * 0 we skip the address write cycle.
- */
-static
-int i2c_transfer (unsigned char cmd_type,
- unsigned char chip,
- unsigned char addr[],
- unsigned char addr_len,
- unsigned char data[], unsigned short data_len)
-{
- S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
- int i, status, result;
-
- if (data == 0 || data_len == 0) {
- /*Don't support data transfer of no length or to address 0 */
- printf ("i2c_transfer: bad call\n");
- return I2C_NOK;
- }
-
- /* Check I2C bus idle */
- i = I2C_TIMEOUT * 1000;
- status = i2c->IICSTAT;
- while ((i > 0) && (status & I2CSTAT_BSY)) {
- udelay (1000);
- status = i2c->IICSTAT;
- i--;
- }
-
- if (status & I2CSTAT_BSY)
- return I2C_NOK_TOUT;
-
- i2c->IICCON |= 0x80;
- result = I2C_OK;
-
- switch (cmd_type) {
- case I2C_WRITE:
- if (addr && addr_len) {
- i2c->IICDS = chip;
- /* send START */
- i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA | I2C_START_STOP;
- i = 0;
- while ((i < addr_len) && (result == I2C_OK)) {
- result = WaitForXfer ();
- i2c->IICDS = addr[i];
- ReadWriteByte ();
- i++;
- }
- i = 0;
- while ((i < data_len) && (result == I2C_OK)) {
- result = WaitForXfer ();
- i2c->IICDS = data[i];
- ReadWriteByte ();
- i++;
- }
- } else {
- i2c->IICDS = chip;
- /* send START */
- i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA | I2C_START_STOP;
- i = 0;
- while ((i < data_len) && (result = I2C_OK)) {
- result = WaitForXfer ();
- i2c->IICDS = data[i];
- ReadWriteByte ();
- i++;
- }
- }
-
- if (result == I2C_OK)
- result = WaitForXfer ();
-
- /* send STOP */
- i2c->IICSTAT = I2C_MODE_MR | I2C_TXRX_ENA;
- ReadWriteByte ();
- break;
-
- case I2C_READ:
- if (addr && addr_len) {
- i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA;
- i2c->IICDS = chip;
- /* send START */
- i2c->IICSTAT |= I2C_START_STOP;
- result = WaitForXfer ();
- if (IsACK ()) {
- i = 0;
- while ((i < addr_len) && (result == I2C_OK)) {
- i2c->IICDS = addr[i];
- ReadWriteByte ();
- result = WaitForXfer ();
- i++;
- }
-
- i2c->IICDS = chip;
- /* resend START */
- i2c->IICSTAT = I2C_MODE_MR | I2C_TXRX_ENA |
- I2C_START_STOP;
- ReadWriteByte ();
- result = WaitForXfer ();
- i = 0;
- while ((i < data_len) && (result == I2C_OK)) {
- /* disable ACK for final READ */
- if (i == data_len - 1)
- i2c->IICCON &= ~0x80;
- ReadWriteByte ();
- result = WaitForXfer ();
- data[i] = i2c->IICDS;
- i++;
- }
- } else {
- result = I2C_NACK;
- }
-
- } else {
- i2c->IICSTAT = I2C_MODE_MR | I2C_TXRX_ENA;
- i2c->IICDS = chip;
- /* send START */
- i2c->IICSTAT |= I2C_START_STOP;
- result = WaitForXfer ();
-
- if (IsACK ()) {
- i = 0;
- while ((i < data_len) && (result == I2C_OK)) {
- /* disable ACK for final READ */
- if (i == data_len - 1)
- i2c->IICCON &= ~0x80;
- ReadWriteByte ();
- result = WaitForXfer ();
- data[i] = i2c->IICDS;
- i++;
- }
- } else {
- result = I2C_NACK;
- }
- }
-
- /* send STOP */
- i2c->IICSTAT = I2C_MODE_MR | I2C_TXRX_ENA;
- ReadWriteByte ();
- break;
-
- default:
- printf ("i2c_transfer: bad call\n");
- result = I2C_NOK;
- break;
- }
-
- return (result);
-}
-
-int i2c_probe (uchar chip)
-{
- uchar buf[1];
-
- buf[0] = 0;
-
- /*
- * What is needed is to send the chip address and verify that the
- * address was <ACK>ed (i.e. there was a chip at that address which
- * drove the data line low).
- */
- return (i2c_transfer (I2C_READ, chip << 1, 0, 0, buf, 1) != I2C_OK);
-}
-
-int i2c_read (uchar chip, uint addr, int alen, uchar * buffer, int len)
-{
- uchar xaddr[4];
- int ret;
-
- if (alen > 4) {
- printf ("I2C read: addr len %d not supported\n", alen);
- return 1;
- }
-
- if (alen > 0) {
- xaddr[0] = (addr >> 24) & 0xFF;
- xaddr[1] = (addr >> 16) & 0xFF;
- xaddr[2] = (addr >> 8) & 0xFF;
- xaddr[3] = addr & 0xFF;
- }
-
-#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
- /*
- * EEPROM chips that implement "address overflow" are ones
- * like Catalyst 24WC04/08/16 which has 9/10/11 bits of
- * address and the extra bits end up in the "chip address"
- * bit slots. This makes a 24WC08 (1Kbyte) chip look like
- * four 256 byte chips.
- *
- * Note that we consider the length of the address field to
- * still be one byte because the extra address bits are
- * hidden in the chip address.
- */
- if (alen > 0)
- chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
-#endif
- if ((ret =
- i2c_transfer (I2C_READ, chip << 1, &xaddr[4 - alen], alen,
- buffer, len)) != 0) {
- printf ("I2c read: failed %d\n", ret);
- return 1;
- }
- return 0;
-}
-
-int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len)
-{
- uchar xaddr[4];
-
- if (alen > 4) {
- printf ("I2C write: addr len %d not supported\n", alen);
- return 1;
- }
-
- if (alen > 0) {
- xaddr[0] = (addr >> 24) & 0xFF;
- xaddr[1] = (addr >> 16) & 0xFF;
- xaddr[2] = (addr >> 8) & 0xFF;
- xaddr[3] = addr & 0xFF;
- }
-#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
- /*
- * EEPROM chips that implement "address overflow" are ones
- * like Catalyst 24WC04/08/16 which has 9/10/11 bits of
- * address and the extra bits end up in the "chip address"
- * bit slots. This makes a 24WC08 (1Kbyte) chip look like
- * four 256 byte chips.
- *
- * Note that we consider the length of the address field to
- * still be one byte because the extra address bits are
- * hidden in the chip address.
- */
- if (alen > 0)
- chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
-#endif
- return (i2c_transfer
- (I2C_WRITE, chip << 1, &xaddr[4 - alen], alen, buffer,
- len) != 0);
-}
-#endif /* CONFIG_HARD_I2C */
-
-#endif /* CONFIG_DRIVER_S3C24X0_I2C */
diff --git a/cpu/arm920t/s3c24x0/interrupts.c b/cpu/arm920t/s3c24x0/interrupts.c
deleted file mode 100644
index 353f5432e9..0000000000
--- a/cpu/arm920t/s3c24x0/interrupts.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * (C) Copyright 2002
- * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB)
-
-#include <arm920t.h>
-#if defined(CONFIG_S3C2400)
-#include <s3c2400.h>
-#elif defined(CONFIG_S3C2410)
-#include <s3c2410.h>
-#endif
-
-int timer_load_val = 0;
-
-/* macro to read the 16 bit timer */
-static inline ulong READ_TIMER(void)
-{
- S3C24X0_TIMERS * const timers = S3C24X0_GetBase_TIMERS();
-
- return (timers->TCNTO4 & 0xffff);
-}
-
-static ulong timestamp;
-static ulong lastdec;
-
-int interrupt_init (void)
-{
- S3C24X0_TIMERS * const timers = S3C24X0_GetBase_TIMERS();
-
- /* use PWM Timer 4 because it has no output */
- /* prescaler for Timer 4 is 16 */
- timers->TCFG0 = 0x0f00;
- if (timer_load_val == 0)
- {
- /*
- * for 10 ms clock period @ PCLK with 4 bit divider = 1/2
- * (default) and prescaler = 16. Should be 10390
- * @33.25MHz and 15625 @ 50 MHz
- */
- timer_load_val = get_PCLK()/(2 * 16 * 100);
- }
- /* load value for 10 ms timeout */
- lastdec = timers->TCNTB4 = timer_load_val;
- /* auto load, manual update of Timer 4 */
- timers->TCON = (timers->TCON & ~0x0700000) | 0x600000;
- /* auto load, start Timer 4 */
- timers->TCON = (timers->TCON & ~0x0700000) | 0x500000;
- timestamp = 0;
-
- return (0);
-}
-
-/*
- * timer without interrupts
- */
-
-void reset_timer (void)
-{
- reset_timer_masked ();
-}
-
-ulong get_timer (ulong base)
-{
- return get_timer_masked () - base;
-}
-
-void set_timer (ulong t)
-{
- timestamp = t;
-}
-
-void reset_timer_masked (void)
-{
- /* reset time */
- lastdec = READ_TIMER();
- timestamp = 0;
-}
-
-ulong get_timer_masked (void)
-{
- ulong now = READ_TIMER();
-
- if (lastdec >= now) {
- /* normal mode */
- timestamp += lastdec - now;
- } else {
- /* we have an overflow ... */
- timestamp += lastdec + timer_load_val - now;
- }
- lastdec = now;
-
- return timestamp;
-}
-
-/*
- * reset the cpu by setting up the watchdog timer and let him time out
- */
-void reset_cpu (ulong ignored)
-{
- volatile S3C24X0_WATCHDOG * watchdog;
-
-#ifdef CONFIG_TRAB
- extern void disable_vfd (void);
-
- disable_vfd();
-#endif
-
- watchdog = S3C24X0_GetBase_WATCHDOG();
-
- /* Disable watchdog */
- watchdog->WTCON = 0x0000;
-
- /* Initialize watchdog timer count register */
- watchdog->WTCNT = 0x0001;
-
- /* Enable watchdog timer; assert reset at timer timeout */
- watchdog->WTCON = 0x0021;
-
- while(1); /* loop forever and wait for reset to happen */
-
- /*NOTREACHED*/
-}
-
-#endif /* defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB) */
diff --git a/cpu/arm920t/s3c24x0/speed.c b/cpu/arm920t/s3c24x0/speed.c
deleted file mode 100644
index e0dca62563..0000000000
--- a/cpu/arm920t/s3c24x0/speed.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * (C) Copyright 2001-2004
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2002
- * David Mueller, ELSOFT AG, d.mueller@elsoft.ch
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* This code should work for both the S3C2400 and the S3C2410
- * as they seem to have the same PLL and clock machinery inside.
- * The different address mapping is handled by the s3c24xx.h files below.
- */
-
-#include <common.h>
-#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB)
-
-#if defined(CONFIG_S3C2400)
-#include <s3c2400.h>
-#elif defined(CONFIG_S3C2410)
-#include <s3c2410.h>
-#endif
-
-#define MPLL 0
-#define UPLL 1
-
-/* ------------------------------------------------------------------------- */
-/* NOTE: This describes the proper use of this file.
- *
- * CONFIG_SYS_CLK_FREQ should be defined as the input frequency of the PLL.
- *
- * get_FCLK(), get_HCLK(), get_PCLK() and get_UCLK() return the clock of
- * the specified bus in HZ.
- */
-/* ------------------------------------------------------------------------- */
-
-static ulong get_PLLCLK(int pllreg)
-{
- S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
- ulong r, m, p, s;
-
- if (pllreg == MPLL)
- r = clk_power->MPLLCON;
- else if (pllreg == UPLL)
- r = clk_power->UPLLCON;
- else
- hang();
-
- m = ((r & 0xFF000) >> 12) + 8;
- p = ((r & 0x003F0) >> 4) + 2;
- s = r & 0x3;
-
- return((CONFIG_SYS_CLK_FREQ * m) / (p << s));
-}
-
-/* return FCLK frequency */
-ulong get_FCLK(void)
-{
- return(get_PLLCLK(MPLL));
-}
-
-/* return HCLK frequency */
-ulong get_HCLK(void)
-{
- S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
-
- return((clk_power->CLKDIVN & 0x2) ? get_FCLK()/2 : get_FCLK());
-}
-
-/* return PCLK frequency */
-ulong get_PCLK(void)
-{
- S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
-
- return((clk_power->CLKDIVN & 0x1) ? get_HCLK()/2 : get_HCLK());
-}
-
-/* return UCLK frequency */
-ulong get_UCLK(void)
-{
- return(get_PLLCLK(UPLL));
-}
-
-#endif /* defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB) */
diff --git a/cpu/arm925t/Makefile b/cpu/arm925t/Makefile
deleted file mode 100644
index 0d4912cd72..0000000000
--- a/cpu/arm925t/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = interrupts.o cpu.o omap925.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/arm925t/omap925.c b/cpu/arm925t/omap925.c
deleted file mode 100644
index 65dab9f88d..0000000000
--- a/cpu/arm925t/omap925.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * (C) Copyright 2003
- * Texas Instruments <www.ti.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <command.h>
-#include <arm925t.h>
-
-#define MIF_CONFIG_REG 0xFFFECC0C
-#define FLASH_GLOBAL_CTRL_NWP 1
-
-void archflashwp (void *archdata, int wp)
-{
- ulong *fgc = (ulong *) MIF_CONFIG_REG;
-
- if (wp == 1)
- *fgc &= ~FLASH_GLOBAL_CTRL_NWP;
- else
- *fgc |= FLASH_GLOBAL_CTRL_NWP;
-}
diff --git a/cpu/arm925t/start.S b/cpu/arm925t/start.S
deleted file mode 100644
index acd77426d3..0000000000
--- a/cpu/arm925t/start.S
+++ /dev/null
@@ -1,429 +0,0 @@
-/*
- * armboot - Startup Code for ARM925 CPU-core
- *
- * Copyright (c) 2003 Texas Instruments
- *
- * ----- Adapted for OMAP1510 from ARM920 code ------
- *
- * Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
- * Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
- * Copyright (c) 2002 Gary Jennejohn <gj@denx.de>
- * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
- * Copyright (c) 2003 Kshitij <kshitij@ti.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-
-#if defined(CONFIG_OMAP1510)
-#include <./configs/omap1510.h>
-#endif
-
-/*
- *************************************************************************
- *
- * Jump vector table as in table 3.1 in [1]
- *
- *************************************************************************
- */
-
-
-.globl _start
-_start: b reset
- ldr pc, _undefined_instruction
- ldr pc, _software_interrupt
- ldr pc, _prefetch_abort
- ldr pc, _data_abort
- ldr pc, _not_used
- ldr pc, _irq
- ldr pc, _fiq
-
-_undefined_instruction: .word undefined_instruction
-_software_interrupt: .word software_interrupt
-_prefetch_abort: .word prefetch_abort
-_data_abort: .word data_abort
-_not_used: .word not_used
-_irq: .word irq
-_fiq: .word fiq
-
- .balignl 16,0xdeadbeef
-
-
-/*
- *************************************************************************
- *
- * Startup Code (reset vector)
- *
- * do important init only if we don't start from memory!
- * setup Memory and board specific bits prior to relocation.
- * relocate armboot to ram
- * setup stack
- *
- *************************************************************************
- */
-
-_TEXT_BASE:
- .word TEXT_BASE
-
-.globl _armboot_start
-_armboot_start:
- .word _start
-
-/*
- * These are defined in the board-specific linker script.
- */
-.globl _bss_start
-_bss_start:
- .word __bss_start
-
-.globl _bss_end
-_bss_end:
- .word _end
-
-#ifdef CONFIG_USE_IRQ
-/* IRQ stack memory (calculated at run-time) */
-.globl IRQ_STACK_START
-IRQ_STACK_START:
- .word 0x0badc0de
-
-/* IRQ stack memory (calculated at run-time) */
-.globl FIQ_STACK_START
-FIQ_STACK_START:
- .word 0x0badc0de
-#endif
-
-
-/*
- * the actual reset code
- */
-
-reset:
- /*
- * set the cpu to SVC32 mode
- */
- mrs r0,cpsr
- bic r0,r0,#0x1f
- orr r0,r0,#0xd3
- msr cpsr,r0
-
- /*
- * Set up 925T mode
- */
- mov r1, #0x81 /* Set ARM925T configuration. */
- mcr p15, 0, r1, c15, c1, 0 /* Write ARM925T configuration register. */
-
- /*
- * turn off the watchdog, unlock/diable sequence
- */
- mov r1, #0xF5
- ldr r0, =WDTIM_MODE
- strh r1, [r0]
- mov r1, #0xA0
- strh r1, [r0]
-
- /*
- * mask all IRQs by setting all bits in the INTMR - default
- */
- mov r1, #0xffffffff
- ldr r0, =REG_IHL1_MIR
- str r1, [r0]
- ldr r0, =REG_IHL2_MIR
- str r1, [r0]
-
- /*
- * wait for dpll to lock
- */
- ldr r0, =CK_DPLL1
- mov r1, #0x10
- strh r1, [r0]
-poll1:
- ldrh r1, [r0]
- ands r1, r1, #0x01
- beq poll1
-
- /*
- * we do sys-critical inits only at reboot,
- * not when booting from ram!
- */
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
- bl cpu_init_crit
-#endif
-
-#ifndef CONFIG_SKIP_RELOCATE_UBOOT
-relocate: /* relocate U-Boot to RAM */
- adr r0, _start /* r0 <- current position of code */
- ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
- cmp r0, r1 /* don't reloc during debug */
- beq stack_setup
-
- ldr r2, _armboot_start
- ldr r3, _bss_start
- sub r2, r3, r2 /* r2 <- size of armboot */
- add r2, r0, r2 /* r2 <- source end address */
-
-copy_loop:
- ldmia r0!, {r3-r10} /* copy from source address [r0] */
- stmia r1!, {r3-r10} /* copy to target address [r1] */
- cmp r0, r2 /* until source end addreee [r2] */
- ble copy_loop
-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
-
- /* Set up the stack */
-stack_setup:
- ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
- sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
- sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
-#ifdef CONFIG_USE_IRQ
- sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
-#endif
- sub sp, r0, #12 /* leave 3 words for abort-stack */
-
-clear_bss:
- ldr r0, _bss_start /* find start of bss segment */
- ldr r1, _bss_end /* stop here */
- mov r2, #0x00000000 /* clear */
-
-clbss_l:str r2, [r0] /* clear loop... */
- add r0, r0, #4
- cmp r0, r1
- ble clbss_l
-
- ldr pc, _start_armboot
-
-_start_armboot: .word start_armboot
-
-
-/*
- *************************************************************************
- *
- * CPU_init_critical registers
- *
- * setup important registers
- * setup memory timing
- *
- *************************************************************************
- */
-
-
-cpu_init_crit:
- /*
- * flush v4 I/D caches
- */
- mov r0, #0
- mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
- mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */
-
- /*
- * disable MMU stuff and caches
- */
- mrc p15, 0, r0, c1, c0, 0
- bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)
- bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM)
- orr r0, r0, #0x00000002 @ set bit 2 (A) Align
- orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
- mcr p15, 0, r0, c1, c0, 0
-
- /*
- * Go setup Memory and board specific bits prior to relocation.
- */
- mov ip, lr /* perserve link reg across call */
- bl lowlevel_init /* go setup pll,mux,memory */
- mov lr, ip /* restore link */
- mov pc, lr /* back to my caller */
-/*
- *************************************************************************
- *
- * Interrupt handling
- *
- *************************************************************************
- */
-
-@
-@ IRQ stack frame.
-@
-#define S_FRAME_SIZE 72
-
-#define S_OLD_R0 68
-#define S_PSR 64
-#define S_PC 60
-#define S_LR 56
-#define S_SP 52
-
-#define S_IP 48
-#define S_FP 44
-#define S_R10 40
-#define S_R9 36
-#define S_R8 32
-#define S_R7 28
-#define S_R6 24
-#define S_R5 20
-#define S_R4 16
-#define S_R3 12
-#define S_R2 8
-#define S_R1 4
-#define S_R0 0
-
-#define MODE_SVC 0x13
-#define I_BIT 0x80
-
-/*
- * use bad_save_user_regs for abort/prefetch/undef/swi ...
- * use irq_save_user_regs / irq_restore_user_regs for IRQ/FIQ handling
- */
-
- .macro bad_save_user_regs
- sub sp, sp, #S_FRAME_SIZE @ carve out a frame on current user stack
- stmia sp, {r0 - r12} @ Save user registers (now in svc mode) r0-r12
-
- ldr r2, _armboot_start
- sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
- ldmia r2, {r2 - r3} @ get values for "aborted" pc and cpsr (into parm regs)
- add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack
-
- add r5, sp, #S_SP
- mov r1, lr
- stmia r5, {r0 - r3} @ save sp_SVC, lr_SVC, pc, cpsr
- mov r0, sp @ save current stack into r0 (param register)
- .endm
-
- .macro irq_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Calling r0-r12
- add r8, sp, #S_PC @ !!!! R8 NEEDS to be saved !!!! a reserved stack spot would be good.
- stmdb r8, {sp, lr}^ @ Calling SP, LR
- str lr, [r8, #0] @ Save calling PC
- mrs r6, spsr
- str r6, [r8, #4] @ Save CPSR
- str r0, [r8, #8] @ Save OLD_R0
- mov r0, sp
- .endm
-
- .macro irq_restore_user_regs
- ldmia sp, {r0 - lr}^ @ Calling r0 - lr
- mov r0, r0
- ldr lr, [sp, #S_PC] @ Get PC
- add sp, sp, #S_FRAME_SIZE
- subs pc, lr, #4 @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_bad_stack
- ldr r13, _armboot_start @ setup our mode stack
- sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
-
- str lr, [r13] @ save caller lr in position 0 of saved stack
- mrs lr, spsr @ get the spsr
- str lr, [r13, #4] @ save spsr in position 1 of saved stack
-
- mov r13, #MODE_SVC @ prepare SVC-Mode
- @ msr spsr_c, r13
- msr spsr, r13 @ switch modes, make sure moves will execute
- mov lr, pc @ capture return pc
- movs pc, lr @ jump to next instruction & switch modes.
- .endm
-
- .macro get_irq_stack @ setup IRQ stack
- ldr sp, IRQ_STACK_START
- .endm
-
- .macro get_fiq_stack @ setup FIQ stack
- ldr sp, FIQ_STACK_START
- .endm
-
-/*
- * exception handlers
- */
- .align 5
-undefined_instruction:
- get_bad_stack
- bad_save_user_regs
- bl do_undefined_instruction
-
- .align 5
-software_interrupt:
- get_bad_stack
- bad_save_user_regs
- bl do_software_interrupt
-
- .align 5
-prefetch_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_prefetch_abort
-
- .align 5
-data_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_data_abort
-
- .align 5
-not_used:
- get_bad_stack
- bad_save_user_regs
- bl do_not_used
-
-#ifdef CONFIG_USE_IRQ
-
- .align 5
-irq:
- get_irq_stack
- irq_save_user_regs
- bl do_irq
- irq_restore_user_regs
-
- .align 5
-fiq:
- get_fiq_stack
- /* someone ought to write a more effiction fiq_save_user_regs */
- irq_save_user_regs
- bl do_fiq
- irq_restore_user_regs
-
-#else
-
- .align 5
-irq:
- get_bad_stack
- bad_save_user_regs
- bl do_irq
-
- .align 5
-fiq:
- get_bad_stack
- bad_save_user_regs
- bl do_fiq
-
-#endif
-
- .align 5
-.globl reset_cpu
-reset_cpu:
- ldr r1, rstctl1 /* get clkm1 reset ctl */
- mov r3, #0x3 /* dsp_en + arm_rst = global reset */
- strh r3, [r1] /* force reset */
- mov r0, r0
-_loop_forever:
- b _loop_forever
-rstctl1:
- .word 0xfffece10
diff --git a/cpu/arm926ejs/Makefile b/cpu/arm926ejs/Makefile
deleted file mode 100644
index 0facce4703..0000000000
--- a/cpu/arm926ejs/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = interrupts.o cpu.o cpuinfo.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/arm926ejs/cpuinfo.c b/cpu/arm926ejs/cpuinfo.c
deleted file mode 100644
index 8c9863161a..0000000000
--- a/cpu/arm926ejs/cpuinfo.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * OMAP1 CPU identification code
- *
- * Copyright (C) 2004 Nokia Corporation
- * Written by Tony Lindgren <tony@atomide.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <common.h>
-#include <command.h>
-#include <arm926ejs.h>
-
-#if defined(CONFIG_DISPLAY_CPUINFO) && defined(CONFIG_OMAP)
-
-#define omap_readw(x) *(volatile unsigned short *)(x)
-#define omap_readl(x) *(volatile unsigned long *)(x)
-
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
-#define OMAP_DIE_ID_0 0xfffe1800
-#define OMAP_DIE_ID_1 0xfffe1804
-#define OMAP_PRODUCTION_ID_0 0xfffe2000
-#define OMAP_PRODUCTION_ID_1 0xfffe2004
-#define OMAP32_ID_0 0xfffed400
-#define OMAP32_ID_1 0xfffed404
-
-struct omap_id {
- u16 jtag_id; /* Used to determine OMAP type */
- u8 die_rev; /* Processor revision */
- u32 omap_id; /* OMAP revision */
- u32 type; /* Cpu id bits [31:08], cpu class bits [07:00] */
-};
-
-/* Register values to detect the OMAP version */
-static struct omap_id omap_ids[] = {
- { .jtag_id = 0xb574, .die_rev = 0x2, .omap_id = 0x03310315, .type = 0x03100000},
- { .jtag_id = 0x355f, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x07300100},
- { .jtag_id = 0xb55f, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x07300300},
- { .jtag_id = 0xb470, .die_rev = 0x0, .omap_id = 0x03310100, .type = 0x15100000},
- { .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x16100000},
- { .jtag_id = 0xb576, .die_rev = 0x2, .omap_id = 0x03320100, .type = 0x16110000},
- { .jtag_id = 0xb576, .die_rev = 0x3, .omap_id = 0x03320100, .type = 0x16100c00},
- { .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x03320200, .type = 0x16100d00},
- { .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 0x1610ef00},
- { .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 0x1610ef00},
- { .jtag_id = 0xb576, .die_rev = 0x1, .omap_id = 0x03320100, .type = 0x16110000},
- { .jtag_id = 0xb58c, .die_rev = 0x2, .omap_id = 0x03320200, .type = 0x16110b00},
- { .jtag_id = 0xb58c, .die_rev = 0x3, .omap_id = 0x03320200, .type = 0x16110c00},
- { .jtag_id = 0xb65f, .die_rev = 0x0, .omap_id = 0x03320400, .type = 0x16212300},
- { .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320400, .type = 0x16212300},
- { .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320500, .type = 0x16212300},
- { .jtag_id = 0xb5f7, .die_rev = 0x0, .omap_id = 0x03330000, .type = 0x17100000},
- { .jtag_id = 0xb5f7, .die_rev = 0x1, .omap_id = 0x03330100, .type = 0x17100000},
- { .jtag_id = 0xb5f7, .die_rev = 0x2, .omap_id = 0x03330100, .type = 0x17100000},
-};
-
-/*
- * Get OMAP type from PROD_ID.
- * 1710 has the PROD_ID in bits 15:00, not in 16:01 as documented in TRM.
- * 1510 PROD_ID is empty, and 1610 PROD_ID does not make sense.
- * Undocumented register in TEST BLOCK is used as fallback; This seems to
- * work on 1510, 1610 & 1710. The official way hopefully will work in future
- * processors.
- */
-static u16 omap_get_jtag_id(void)
-{
- u32 prod_id, omap_id;
-
- prod_id = omap_readl(OMAP_PRODUCTION_ID_1);
- omap_id = omap_readl(OMAP32_ID_1);
-
- /* Check for unusable OMAP_PRODUCTION_ID_1 on 1611B/5912 and 730 */
- if (((prod_id >> 20) == 0) || (prod_id == omap_id))
- prod_id = 0;
- else
- prod_id &= 0xffff;
-
- if (prod_id)
- return prod_id;
-
- /* Use OMAP32_ID_1 as fallback */
- prod_id = ((omap_id >> 12) & 0xffff);
-
- return prod_id;
-}
-
-/*
- * Get OMAP revision from DIE_REV.
- * Early 1710 processors may have broken OMAP_DIE_ID, it contains PROD_ID.
- * Undocumented register in the TEST BLOCK is used as fallback.
- * REVISIT: This does not seem to work on 1510
- */
-static u8 omap_get_die_rev(void)
-{
- u32 die_rev;
-
- die_rev = omap_readl(OMAP_DIE_ID_1);
-
- /* Check for broken OMAP_DIE_ID on early 1710 */
- if (((die_rev >> 12) & 0xffff) == omap_get_jtag_id())
- die_rev = 0;
-
- die_rev = (die_rev >> 17) & 0xf;
- if (die_rev)
- return die_rev;
-
- die_rev = (omap_readl(OMAP32_ID_1) >> 28) & 0xf;
-
- return die_rev;
-}
-
-static unsigned long dpll1(void)
-{
- unsigned short pll_ctl_val = omap_readw(DPLL_CTL_REG);
- unsigned long rate;
-
- rate = CONFIG_SYS_CLK_FREQ; /* Base xtal rate */
- if (pll_ctl_val & 0x10) {
- /* PLL enabled, apply multiplier and divisor */
- if (pll_ctl_val & 0xf80)
- rate *= (pll_ctl_val & 0xf80) >> 7;
- rate /= ((pll_ctl_val & 0x60) >> 5) + 1;
- } else {
- /* PLL disabled, apply bypass divisor */
- switch (pll_ctl_val & 0xc) {
- case 0:
- break;
- case 0x4:
- rate /= 2;
- break;
- default:
- rate /= 4;
- break;
- }
- }
-
- return rate;
-}
-
-static unsigned long armcore(void)
-{
- unsigned short arm_ckctl = omap_readw(ARM_CKCTL);
-
- return (dpll1() >> ((arm_ckctl & 0x0030) >> 4));
-}
-
-int print_cpuinfo (void)
-{
- int i;
- u16 jtag_id;
- u8 die_rev;
- u32 omap_id;
- u8 cpu_type;
- u32 system_serial_high;
- u32 system_serial_low;
- u32 system_rev = 0;
-
- jtag_id = omap_get_jtag_id();
- die_rev = omap_get_die_rev();
- omap_id = omap_readl(OMAP32_ID_0);
-
-#ifdef DEBUG
- printf("OMAP_DIE_ID_0: 0x%08x\n", omap_readl(OMAP_DIE_ID_0));
- printf("OMAP_DIE_ID_1: 0x%08x DIE_REV: %i\n",
- omap_readl(OMAP_DIE_ID_1),
- (omap_readl(OMAP_DIE_ID_1) >> 17) & 0xf);
- printf("OMAP_PRODUCTION_ID_0: 0x%08x\n", omap_readl(OMAP_PRODUCTION_ID_0));
- printf("OMAP_PRODUCTION_ID_1: 0x%08x JTAG_ID: 0x%04x\n",
- omap_readl(OMAP_PRODUCTION_ID_1),
- omap_readl(OMAP_PRODUCTION_ID_1) & 0xffff);
- printf("OMAP32_ID_0: 0x%08x\n", omap_readl(OMAP32_ID_0));
- printf("OMAP32_ID_1: 0x%08x\n", omap_readl(OMAP32_ID_1));
- printf("JTAG_ID: 0x%04x DIE_REV: %i\n", jtag_id, die_rev);
-#endif
-
- system_serial_high = omap_readl(OMAP_DIE_ID_0);
- system_serial_low = omap_readl(OMAP_DIE_ID_1);
-
- /* First check only the major version in a safe way */
- for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
- if (jtag_id == (omap_ids[i].jtag_id)) {
- system_rev = omap_ids[i].type;
- break;
- }
- }
-
- /* Check if we can find the die revision */
- for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
- if (jtag_id == omap_ids[i].jtag_id && die_rev == omap_ids[i].die_rev) {
- system_rev = omap_ids[i].type;
- break;
- }
- }
-
- /* Finally check also the omap_id */
- for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
- if (jtag_id == omap_ids[i].jtag_id
- && die_rev == omap_ids[i].die_rev
- && omap_id == omap_ids[i].omap_id) {
- system_rev = omap_ids[i].type;
- break;
- }
- }
-
- /* Add the cpu class info (7xx, 15xx, 16xx, 24xx) */
- cpu_type = system_rev >> 24;
-
- switch (cpu_type) {
- case 0x07:
- system_rev |= 0x07;
- break;
- case 0x03:
- case 0x15:
- system_rev |= 0x15;
- break;
- case 0x16:
- case 0x17:
- system_rev |= 0x16;
- break;
- case 0x24:
- system_rev |= 0x24;
- break;
- default:
- printf("Unknown OMAP cpu type: 0x%02x\n", cpu_type);
- }
-
- printf("CPU: OMAP%04x", system_rev >> 16);
- if ((system_rev >> 8) & 0xff)
- printf("%x", (system_rev >> 8) & 0xff);
-#ifdef DEBUG
- printf(" revision %i handled as %02xxx id: %08x%08x",
- die_rev, system_rev & 0xff, system_serial_low, system_serial_high);
-#endif
- printf(" at %ld.%01ld MHz (DPLL1=%ld.%01ld MHz)\n",
- armcore() / 1000000, (armcore() / 100000) % 10,
- dpll1() / 1000000, (dpll1() / 100000) % 10);
-
- return 0;
-}
-
-#endif /* #if defined(CONFIG_DISPLAY_CPUINFO) && defined(CONFIG_OMAP) */
diff --git a/cpu/arm926ejs/omap/Makefile b/cpu/arm926ejs/omap/Makefile
deleted file mode 100644
index c335d5c866..0000000000
--- a/cpu/arm926ejs/omap/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(SOC).a
-
-COBJS = timer.o
-SOBJS = reset.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/arm926ejs/omap/reset.S b/cpu/arm926ejs/omap/reset.S
deleted file mode 100644
index e8989028e2..0000000000
--- a/cpu/arm926ejs/omap/reset.S
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * armboot - Startup Code for ARM926EJS CPU-core
- *
- * Copyright (c) 2003 Texas Instruments
- *
- * ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------
- *
- * Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
- * Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
- * Copyright (c) 2002 Gary Jennejohn <gj@denx.de>
- * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
- * Copyright (c) 2003 Kshitij <kshitij@ti.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
- .align 5
-.globl reset_cpu
-reset_cpu:
- ldr r1, rstctl1 /* get clkm1 reset ctl */
- mov r3, #0x0
- strh r3, [r1] /* clear it */
- mov r3, #0x8
- strh r3, [r1] /* force dsp+arm reset */
-_loop_forever:
- b _loop_forever
-
-rstctl1:
- .word 0xfffece10
diff --git a/cpu/arm926ejs/omap/timer.c b/cpu/arm926ejs/omap/timer.c
deleted file mode 100644
index 2535f62f79..0000000000
--- a/cpu/arm926ejs/omap/timer.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * (C) Copyright 2003
- * Texas Instruments <www.ti.com>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * (C) Copyright 2002-2004
- * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
- *
- * (C) Copyright 2004
- * Philippe Robin, ARM Ltd. <philippe.robin@arm.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <arm926ejs.h>
-
-#define TIMER_LOAD_VAL 0xffffffff
-
-/* macro to read the 32 bit timer */
-#define READ_TIMER (*(volatile ulong *)(CFG_TIMERBASE+8))
-
-static ulong timestamp;
-static ulong lastdec;
-
-int timer_init (void)
-{
- int32_t val;
-
- /* Start the decrementer ticking down from 0xffffffff */
- *((int32_t *) (CFG_TIMERBASE + LOAD_TIM)) = TIMER_LOAD_VAL;
- val = MPUTIM_ST | MPUTIM_AR | MPUTIM_CLOCK_ENABLE | (CFG_PVT << MPUTIM_PTV_BIT);
- *((int32_t *) (CFG_TIMERBASE + CNTL_TIMER)) = val;
-
- /* init the timestamp and lastdec value */
- reset_timer_masked();
-
- return 0;
-}
-
-/*
- * timer without interrupts
- */
-
-void reset_timer (void)
-{
- reset_timer_masked ();
-}
-
-ulong get_timer (ulong base)
-{
- return get_timer_masked () - base;
-}
-
-void set_timer (ulong t)
-{
- timestamp = t;
-}
-
-void reset_timer_masked (void)
-{
- /* reset time */
- lastdec = READ_TIMER; /* capure current decrementer value time */
- timestamp = 0; /* start "advancing" time stamp from 0 */
-}
-
-ulong get_timer_masked (void)
-{
- ulong now = READ_TIMER; /* current tick value */
-
- if (lastdec >= now) { /* normal mode (non roll) */
- /* normal mode */
- timestamp += lastdec - now; /* move stamp fordward with absoulte diff ticks */
- } else { /* we have overflow of the count down timer */
- /* nts = ts + ld + (TLV - now)
- * ts=old stamp, ld=time that passed before passing through -1
- * (TLV-now) amount of time after passing though -1
- * nts = new "advancing time stamp"...it could also roll and cause problems.
- */
- timestamp += lastdec + TIMER_LOAD_VAL - now;
- }
- lastdec = now;
-
- return timestamp;
-}
diff --git a/cpu/arm926ejs/versatile/Makefile b/cpu/arm926ejs/versatile/Makefile
deleted file mode 100644
index c335d5c866..0000000000
--- a/cpu/arm926ejs/versatile/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(SOC).a
-
-COBJS = timer.o
-SOBJS = reset.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/arm926ejs/versatile/reset.S b/cpu/arm926ejs/versatile/reset.S
deleted file mode 100644
index e8989028e2..0000000000
--- a/cpu/arm926ejs/versatile/reset.S
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * armboot - Startup Code for ARM926EJS CPU-core
- *
- * Copyright (c) 2003 Texas Instruments
- *
- * ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------
- *
- * Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
- * Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
- * Copyright (c) 2002 Gary Jennejohn <gj@denx.de>
- * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
- * Copyright (c) 2003 Kshitij <kshitij@ti.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
- .align 5
-.globl reset_cpu
-reset_cpu:
- ldr r1, rstctl1 /* get clkm1 reset ctl */
- mov r3, #0x0
- strh r3, [r1] /* clear it */
- mov r3, #0x8
- strh r3, [r1] /* force dsp+arm reset */
-_loop_forever:
- b _loop_forever
-
-rstctl1:
- .word 0xfffece10
diff --git a/cpu/arm926ejs/versatile/timer.c b/cpu/arm926ejs/versatile/timer.c
deleted file mode 100644
index 41004a7a05..0000000000
--- a/cpu/arm926ejs/versatile/timer.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * (C) Copyright 2003
- * Texas Instruments <www.ti.com>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * (C) Copyright 2002-2004
- * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
- *
- * (C) Copyright 2004
- * Philippe Robin, ARM Ltd. <philippe.robin@arm.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <arm926ejs.h>
-
-#define TIMER_LOAD_VAL 0xffffffff
-
-/* macro to read the 32 bit timer */
-#define READ_TIMER (*(volatile ulong *)(CFG_TIMERBASE+4))
-
-static ulong timestamp;
-static ulong lastdec;
-
-/* nothing really to do with interrupts, just starts up a counter. */
-int timer_init (void)
-{
- *(volatile ulong *)(CFG_TIMERBASE + 0) = CFG_TIMER_RELOAD; /* TimerLoad */
- *(volatile ulong *)(CFG_TIMERBASE + 4) = CFG_TIMER_RELOAD; /* TimerValue */
- *(volatile ulong *)(CFG_TIMERBASE + 8) = 0x8C;
-
- /* init the timestamp and lastdec value */
- reset_timer_masked();
-
- return 0;
-}
-
-/*
- * timer without interrupts
- */
-
-void reset_timer (void)
-{
- reset_timer_masked ();
-}
-
-ulong get_timer (ulong base)
-{
- return get_timer_masked () - base;
-}
-
-void set_timer (ulong t)
-{
- timestamp = t;
-}
-
-void reset_timer_masked (void)
-{
- /* reset time */
- lastdec = READ_TIMER; /* capure current decrementer value time */
- timestamp = 0; /* start "advancing" time stamp from 0 */
-}
-
-ulong get_timer_masked (void)
-{
- ulong now = READ_TIMER; /* current tick value */
-
- if (lastdec >= now) { /* normal mode (non roll) */
- /* normal mode */
- timestamp += lastdec - now; /* move stamp fordward with absoulte diff ticks */
- } else { /* we have overflow of the count down timer */
- /* nts = ts + ld + (TLV - now)
- * ts=old stamp, ld=time that passed before passing through -1
- * (TLV-now) amount of time after passing though -1
- * nts = new "advancing time stamp"...it could also roll and cause problems.
- */
- timestamp += lastdec + TIMER_LOAD_VAL - now;
- }
- lastdec = now;
-
- return timestamp;
-}
diff --git a/cpu/arm946es/Makefile b/cpu/arm946es/Makefile
deleted file mode 100644
index d5ac7d3fd9..0000000000
--- a/cpu/arm946es/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = interrupts.o cpu.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/arm946es/start.S b/cpu/arm946es/start.S
deleted file mode 100644
index 6f88482851..0000000000
--- a/cpu/arm946es/start.S
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * armboot - Startup Code for ARM926EJS CPU-core
- *
- * Copyright (c) 2003 Texas Instruments
- *
- * ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------
- *
- * Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
- * Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
- * Copyright (c) 2002 Gary Jennejohn <gj@denx.de>
- * Copyright (c) 2003 Richard Woodruff <r-woodruff2@ti.com>
- * Copyright (c) 2003 Kshitij <kshitij@ti.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-
-/*
- *************************************************************************
- *
- * Jump vector table as in table 3.1 in [1]
- *
- *************************************************************************
- */
-
-
-.globl _start
-_start:
- b reset
- ldr pc, _undefined_instruction
- ldr pc, _software_interrupt
- ldr pc, _prefetch_abort
- ldr pc, _data_abort
- ldr pc, _not_used
- ldr pc, _irq
- ldr pc, _fiq
-
-_undefined_instruction:
- .word undefined_instruction
-_software_interrupt:
- .word software_interrupt
-_prefetch_abort:
- .word prefetch_abort
-_data_abort:
- .word data_abort
-_not_used:
- .word not_used
-_irq:
- .word irq
-_fiq:
- .word fiq
-
- .balignl 16,0xdeadbeef
-
-
-/*
- *************************************************************************
- *
- * Startup Code (reset vector)
- *
- * do important init only if we don't start from memory!
- * setup Memory and board specific bits prior to relocation.
- * relocate armboot to ram
- * setup stack
- *
- *************************************************************************
- */
-
-_TEXT_BASE:
- .word TEXT_BASE
-
-.globl _armboot_start
-_armboot_start:
- .word _start
-
-/*
- * These are defined in the board-specific linker script.
- */
-.globl _bss_start
-_bss_start:
- .word __bss_start
-
-.globl _bss_end
-_bss_end:
- .word _end
-
-#ifdef CONFIG_USE_IRQ
-/* IRQ stack memory (calculated at run-time) */
-.globl IRQ_STACK_START
-IRQ_STACK_START:
- .word 0x0badc0de
-
-/* IRQ stack memory (calculated at run-time) */
-.globl FIQ_STACK_START
-FIQ_STACK_START:
- .word 0x0badc0de
-#endif
-
-
-/*
- * the actual reset code
- */
-
-reset:
- /*
- * set the cpu to SVC32 mode
- */
- mrs r0,cpsr
- bic r0,r0,#0x1f
- orr r0,r0,#0xd3
- msr cpsr,r0
-
- /*
- * we do sys-critical inits only at reboot,
- * not when booting from ram!
- */
-#ifdef CONFIG_SKIP_LOWLEVEL_INIT
- bl cpu_init_crit
-#endif
-
-relocate: /* relocate U-Boot to RAM */
- adr r0, _start /* r0 <- current position of code */
- ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
- cmp r0, r1 /* don't reloc during debug */
- beq stack_setup
-
- ldr r2, _armboot_start
- ldr r3, _bss_start
- sub r2, r3, r2 /* r2 <- size of armboot */
- add r2, r0, r2 /* r2 <- source end address */
-
-copy_loop:
- ldmia r0!, {r3-r10} /* copy from source address [r0] */
- stmia r1!, {r3-r10} /* copy to target address [r1] */
- cmp r0, r2 /* until source end addreee [r2] */
- ble copy_loop
-
- /* Set up the stack */
-stack_setup:
- ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
- sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
- sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
-#ifdef CONFIG_USE_IRQ
- sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
-#endif
- sub sp, r0, #12 /* leave 3 words for abort-stack */
-
-clear_bss:
- ldr r0, _bss_start /* find start of bss segment */
- ldr r1, _bss_end /* stop here */
- mov r2, #0x00000000 /* clear */
-
-clbss_l:str r2, [r0] /* clear loop... */
- add r0, r0, #4
- cmp r0, r1
- bne clbss_l
-
- ldr pc, _start_armboot
-
-_start_armboot:
- .word start_armboot
-
-
-/*
- *************************************************************************
- *
- * CPU_init_critical registers
- *
- * setup important registers
- * setup memory timing
- *
- *************************************************************************
- */
-
-
-cpu_init_crit:
- /*
- * flush v4 I/D caches
- */
- mov r0, #0
- mcr p15, 0, r0, c7, c5, 0 /* flush v4 I-cache */
- mcr p15, 0, r0, c7, c6, 0 /* flush v4 D-cache */
-
- /*
- * disable MMU stuff and caches
- */
- mrc p15, 0, r0, c1, c0, 0
- bic r0, r0, #0x00002300 /* clear bits 13, 9:8 (--V- --RS) */
- bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */
- orr r0, r0, #0x00000002 /* set bit 2 (A) Align */
- orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */
- mcr p15, 0, r0, c1, c0, 0
-
- /*
- * Go setup Memory and board specific bits prior to relocation.
- */
- mov ip, lr /* perserve link reg across call */
- bl lowlevel_init /* go setup memory */
- mov lr, ip /* restore link */
- mov pc, lr /* back to my caller */
-/*
- *************************************************************************
- *
- * Interrupt handling
- *
- *************************************************************************
- */
-
-@
-@ IRQ stack frame.
-@
-#define S_FRAME_SIZE 72
-
-#define S_OLD_R0 68
-#define S_PSR 64
-#define S_PC 60
-#define S_LR 56
-#define S_SP 52
-
-#define S_IP 48
-#define S_FP 44
-#define S_R10 40
-#define S_R9 36
-#define S_R8 32
-#define S_R7 28
-#define S_R6 24
-#define S_R5 20
-#define S_R4 16
-#define S_R3 12
-#define S_R2 8
-#define S_R1 4
-#define S_R0 0
-
-#define MODE_SVC 0x13
-#define I_BIT 0x80
-
-/*
- * use bad_save_user_regs for abort/prefetch/undef/swi ...
- * use irq_save_user_regs / irq_restore_user_regs for IRQ/FIQ handling
- */
-
- .macro bad_save_user_regs
- @ carve out a frame on current user stack
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Save user registers (now in svc mode) r0-r12
-
- ldr r2, _armboot_start
- sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
- @ get values for "aborted" pc and cpsr (into parm regs)
- ldmia r2, {r2 - r3}
- add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack
- add r5, sp, #S_SP
- mov r1, lr
- stmia r5, {r0 - r3} @ save sp_SVC, lr_SVC, pc, cpsr
- mov r0, sp @ save current stack into r0 (param register)
- .endm
-
- .macro irq_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Calling r0-r12
- @ !!!! R8 NEEDS to be saved !!!! a reserved stack spot would be good.
- add r8, sp, #S_PC
- stmdb r8, {sp, lr}^ @ Calling SP, LR
- str lr, [r8, #0] @ Save calling PC
- mrs r6, spsr
- str r6, [r8, #4] @ Save CPSR
- str r0, [r8, #8] @ Save OLD_R0
- mov r0, sp
- .endm
-
- .macro irq_restore_user_regs
- ldmia sp, {r0 - lr}^ @ Calling r0 - lr
- mov r0, r0
- ldr lr, [sp, #S_PC] @ Get PC
- add sp, sp, #S_FRAME_SIZE
- subs pc, lr, #4 @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_bad_stack
- ldr r13, _armboot_start @ setup our mode stack
- sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
-
- str lr, [r13] @ save caller lr in position 0 of saved stack
- mrs lr, spsr @ get the spsr
- str lr, [r13, #4] @ save spsr in position 1 of saved stack
- mov r13, #MODE_SVC @ prepare SVC-Mode
- @ msr spsr_c, r13
- msr spsr, r13 @ switch modes, make sure moves will execute
- mov lr, pc @ capture return pc
- movs pc, lr @ jump to next instruction & switch modes.
- .endm
-
- .macro get_irq_stack @ setup IRQ stack
- ldr sp, IRQ_STACK_START
- .endm
-
- .macro get_fiq_stack @ setup FIQ stack
- ldr sp, FIQ_STACK_START
- .endm
-
-/*
- * exception handlers
- */
- .align 5
-undefined_instruction:
- get_bad_stack
- bad_save_user_regs
- bl do_undefined_instruction
-
- .align 5
-software_interrupt:
- get_bad_stack
- bad_save_user_regs
- bl do_software_interrupt
-
- .align 5
-prefetch_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_prefetch_abort
-
- .align 5
-data_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_data_abort
-
- .align 5
-not_used:
- get_bad_stack
- bad_save_user_regs
- bl do_not_used
-
-#ifdef CONFIG_USE_IRQ
-
- .align 5
-irq:
- get_irq_stack
- irq_save_user_regs
- bl do_irq
- irq_restore_user_regs
-
- .align 5
-fiq:
- get_fiq_stack
- /* someone ought to write a more effiction fiq_save_user_regs */
- irq_save_user_regs
- bl do_fiq
- irq_restore_user_regs
-
-#else
-
- .align 5
-irq:
- get_bad_stack
- bad_save_user_regs
- bl do_irq
-
- .align 5
-fiq:
- get_bad_stack
- bad_save_user_regs
- bl do_fiq
-
-#endif
-
-# ifdef CONFIG_INTEGRATOR
-
- /* Satisfied by general board level routine */
-
-#else
-
- .align 5
-.globl reset_cpu
-reset_cpu:
-
- ldr r1, rstctl1 /* get clkm1 reset ctl */
- mov r3, #0x0
- strh r3, [r1] /* clear it */
- mov r3, #0x8
- strh r3, [r1] /* force dsp+arm reset */
-_loop_forever:
- b _loop_forever
-
-rstctl1:
- .word 0xfffece10
-
-#endif /* #ifdef CONFIG_INTEGRATOR */
diff --git a/cpu/arm_intcm/Makefile b/cpu/arm_intcm/Makefile
deleted file mode 100644
index d5ac7d3fd9..0000000000
--- a/cpu/arm_intcm/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = interrupts.o cpu.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/at32ap/Makefile b/cpu/at32ap/Makefile
deleted file mode 100644
index f62ec8bc9b..0000000000
--- a/cpu/at32ap/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# Copyright (C) 2005-2006 Atmel Corporation.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB := $(obj)lib$(CPU).a
-
-START := start.o
-SOBJS := entry.o
-COBJS := cpu.o hsdramc.o exception.o cache.o
-COBJS += interrupts.o device.o pm.o pio.o
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $^
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/at32ap/at32ap7000/Makefile b/cpu/at32ap/at32ap7000/Makefile
deleted file mode 100644
index 2ed74d2508..0000000000
--- a/cpu/at32ap/at32ap7000/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Copyright (C) 2005-2006 Atmel Corporation
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB := $(obj)lib$(SOC).a
-
-COBJS := hebi.o devices.o
-SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-
-all: $(obj).depend $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $^
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/at32ap/at32ap7000/devices.c b/cpu/at32ap/at32ap7000/devices.c
deleted file mode 100644
index 8b216e906a..0000000000
--- a/cpu/at32ap/at32ap7000/devices.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * Copyright (C) 2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <common.h>
-
-#include <asm/arch/memory-map.h>
-#include <asm/arch/platform.h>
-
-#include "../sm.h"
-
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
-const struct clock_domain chip_clock[] = {
- [CLOCK_CPU] = {
- .reg = SM_PM_CPU_MASK,
- .id = CLOCK_CPU,
- .bridge = NO_DEVICE,
- },
- [CLOCK_HSB] = {
- .reg = SM_PM_HSB_MASK,
- .id = CLOCK_HSB,
- .bridge = NO_DEVICE,
- },
- [CLOCK_PBA] = {
- .reg = SM_PM_PBA_MASK,
- .id = CLOCK_PBA,
- .bridge = DEVICE_PBA_BRIDGE,
- },
- [CLOCK_PBB] = {
- .reg = SM_PM_PBB_MASK,
- .id = CLOCK_PBB,
- .bridge = DEVICE_PBB_BRIDGE,
- },
-};
-
-static const struct resource hebi_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_HSB, 0 },
- },
- }, {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBB, 13 },
- },
- }, {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBB, 14 },
- },
- }, {
- .type = RESOURCE_GPIO,
- .u = {
- .gpio = { 27, DEVICE_PIOE, GPIO_FUNC_A, 0 },
- },
- },
-};
-static const struct resource pba_bridge_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_HSB, 1 },
- }
- }, {
- .type = RESOURCE_CLOCK,
- .u = {
- /* HSB-HSB Bridge */
- .clock = { CLOCK_HSB, 4 },
- },
- },
-};
-static const struct resource pbb_bridge_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_HSB, 2 },
- },
- },
-};
-static const struct resource hramc_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_HSB, 3 },
- },
- },
-};
-static const struct resource pioa_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBA, 10 },
- },
- },
-};
-static const struct resource piob_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBA, 11 },
- },
- },
-};
-static const struct resource pioc_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBA, 12 },
- },
- },
-};
-static const struct resource piod_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBA, 13 },
- },
- },
-};
-static const struct resource pioe_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBA, 14 },
- },
- },
-};
-static const struct resource sm_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBB, 0 },
- },
- },
-};
-static const struct resource intc_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBB, 1 },
- },
- },
-};
-static const struct resource hmatrix_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBB, 2 },
- },
- },
-};
-#if defined(CFG_HPDC)
-static const struct resource hpdc_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBA, 16 },
- },
- },
-};
-#endif
-#if defined(CFG_MACB0)
-static const struct resource macb0_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_HSB, 8 },
- },
- }, {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBB, 6 },
- },
- }, {
- .type = RESOURCE_GPIO,
- .u = {
- .gpio = { 19, DEVICE_PIOC, GPIO_FUNC_A, 0 },
- },
- },
-};
-#endif
-#if defined(CFG_MACB1)
-static const struct resource macb1_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_HSB, 9 },
- },
- }, {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBB, 7 },
- },
- }, {
- .type = RESOURCE_GPIO,
- .u = {
- .gpio = { 12, DEVICE_PIOC, GPIO_FUNC_B, 19 },
- },
- }, {
- .type = RESOURCE_GPIO,
- .u = {
- .gpio = { 14, DEVICE_PIOD, GPIO_FUNC_B, 2 },
- },
- },
-};
-#endif
-#if defined(CFG_LCDC)
-static const struct resource lcdc_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_HSB, 7 },
- },
- },
-};
-#endif
-#if defined(CFG_USART0)
-static const struct resource usart0_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBA, 3 },
- },
- }, {
- .type = RESOURCE_GPIO,
- .u = {
- .gpio = { 2, DEVICE_PIOA, GPIO_FUNC_B, 8 },
- },
- },
-};
-#endif
-#if defined(CFG_USART1)
-static const struct resource usart1_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBA, 4 },
- },
- }, {
- .type = RESOURCE_GPIO,
- .u = {
- .gpio = { 2, DEVICE_PIOA, GPIO_FUNC_A, 17 },
- },
- },
-};
-#endif
-#if defined(CFG_USART2)
-static const struct resource usart2_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBA, 5 },
- },
- }, {
- .type = RESOURCE_GPIO,
- .u = {
- .gpio = { 2, DEVICE_PIOB, GPIO_FUNC_B, 26 },
- },
- },
-};
-#endif
-#if defined(CFG_USART3)
-static const struct resource usart3_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBA, 6 },
- },
- }, {
- .type = RESOURCE_GPIO,
- .u = {
- .gpio = { 2, DEVICE_PIOB, GPIO_FUNC_B, 17 },
- },
- },
-};
-#endif
-#if defined(CFG_MMCI)
-static const struct resource mmci_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_PBB, 9 },
- },
- }, {
- .type = RESOURCE_GPIO,
- .u = {
- .gpio = { 6, DEVICE_PIOA, GPIO_FUNC_A, 10 },
- },
- },
-};
-#endif
-#if defined(CFG_DMAC)
-static const struct resource dmac_resource[] = {
- {
- .type = RESOURCE_CLOCK,
- .u = {
- .clock = { CLOCK_HSB, 10 },
- },
- },
-};
-#endif
-
-const struct device chip_device[] = {
- [DEVICE_HEBI] = {
- .regs = (void *)HSMC_BASE,
- .nr_resources = ARRAY_SIZE(hebi_resource),
- .resource = hebi_resource,
- },
- [DEVICE_PBA_BRIDGE] = {
- .nr_resources = ARRAY_SIZE(pba_bridge_resource),
- .resource = pba_bridge_resource,
- },
- [DEVICE_PBB_BRIDGE] = {
- .nr_resources = ARRAY_SIZE(pbb_bridge_resource),
- .resource = pbb_bridge_resource,
- },
- [DEVICE_HRAMC] = {
- .nr_resources = ARRAY_SIZE(hramc_resource),
- .resource = hramc_resource,
- },
- [DEVICE_PIOA] = {
- .regs = (void *)PIOA_BASE,
- .nr_resources = ARRAY_SIZE(pioa_resource),
- .resource = pioa_resource,
- },
- [DEVICE_PIOB] = {
- .regs = (void *)PIOB_BASE,
- .nr_resources = ARRAY_SIZE(piob_resource),
- .resource = piob_resource,
- },
- [DEVICE_PIOC] = {
- .regs = (void *)PIOC_BASE,
- .nr_resources = ARRAY_SIZE(pioc_resource),
- .resource = pioc_resource,
- },
- [DEVICE_PIOD] = {
- .regs = (void *)PIOD_BASE,
- .nr_resources = ARRAY_SIZE(piod_resource),
- .resource = piod_resource,
- },
- [DEVICE_PIOE] = {
- .regs = (void *)PIOE_BASE,
- .nr_resources = ARRAY_SIZE(pioe_resource),
- .resource = pioe_resource,
- },
- [DEVICE_SM] = {
- .regs = (void *)SM_BASE,
- .nr_resources = ARRAY_SIZE(sm_resource),
- .resource = sm_resource,
- },
- [DEVICE_INTC] = {
- .regs = (void *)INTC_BASE,
- .nr_resources = ARRAY_SIZE(intc_resource),
- .resource = intc_resource,
- },
- [DEVICE_HMATRIX] = {
- .regs = (void *)HMATRIX_BASE,
- .nr_resources = ARRAY_SIZE(hmatrix_resource),
- .resource = hmatrix_resource,
- },
-#if defined(CFG_HPDC)
- [DEVICE_HPDC] = {
- .nr_resources = ARRAY_SIZE(hpdc_resource),
- .resource = hpdc_resource,
- },
-#endif
-#if defined(CFG_MACB0)
- [DEVICE_MACB0] = {
- .regs = (void *)MACB0_BASE,
- .nr_resources = ARRAY_SIZE(macb0_resource),
- .resource = macb0_resource,
- },
-#endif
-#if defined(CFG_MACB1)
- [DEVICE_MACB1] = {
- .regs = (void *)MACB1_BASE,
- .nr_resources = ARRAY_SIZE(macb1_resource),
- .resource = macb1_resource,
- },
-#endif
-#if defined(CFG_LCDC)
- [DEVICE_LCDC] = {
- .nr_resources = ARRAY_SIZE(lcdc_resource),
- .resource = lcdc_resource,
- },
-#endif
-#if defined(CFG_USART0)
- [DEVICE_USART0] = {
- .regs = (void *)USART0_BASE,
- .nr_resources = ARRAY_SIZE(usart0_resource),
- .resource = usart0_resource,
- },
-#endif
-#if defined(CFG_USART1)
- [DEVICE_USART1] = {
- .regs = (void *)USART1_BASE,
- .nr_resources = ARRAY_SIZE(usart1_resource),
- .resource = usart1_resource,
- },
-#endif
-#if defined(CFG_USART2)
- [DEVICE_USART2] = {
- .regs = (void *)USART2_BASE,
- .nr_resources = ARRAY_SIZE(usart2_resource),
- .resource = usart2_resource,
- },
-#endif
-#if defined(CFG_USART3)
- [DEVICE_USART3] = {
- .regs = (void *)USART3_BASE,
- .nr_resources = ARRAY_SIZE(usart3_resource),
- .resource = usart3_resource,
- },
-#endif
-#if defined(CFG_MMCI)
- [DEVICE_MMCI] = {
- .regs = (void *)MMCI_BASE,
- .nr_resources = ARRAY_SIZE(mmci_resource),
- .resource = mmci_resource,
- },
-#endif
-#if defined(CFG_DMAC)
- [DEVICE_DMAC] = {
- .regs = (void *)DMAC_BASE,
- .nr_resources = ARRAY_SIZE(dmac_resource),
- .resource = dmac_resource,
- },
-#endif
-};
diff --git a/cpu/at32ap/at32ap7000/hebi.c b/cpu/at32ap/at32ap7000/hebi.c
deleted file mode 100644
index 3b32adf1ea..0000000000
--- a/cpu/at32ap/at32ap7000/hebi.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <common.h>
-
-#include <asm/io.h>
-
-#include <asm/arch/hmatrix2.h>
-#include <asm/arch/memory-map.h>
-#include <asm/arch/platform.h>
-
-void cpu_enable_sdram(void)
-{
- const struct device *hmatrix;
-
- hmatrix = get_device(DEVICE_HMATRIX);
-
- /* Set the SDRAM_ENABLE bit in the HEBI SFR */
- hmatrix2_writel(hmatrix, SFR4, 1 << 1);
-}
diff --git a/cpu/at32ap/cache.c b/cpu/at32ap/cache.c
deleted file mode 100644
index 41fb5aa047..0000000000
--- a/cpu/at32ap/cache.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2004-2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-#include <asm/cacheflush.h>
-
-void dcache_clean_range(volatile void *start, size_t size)
-{
- unsigned long v, begin, end, linesz;
-
- linesz = CFG_DCACHE_LINESZ;
-
- /* You asked for it, you got it */
- begin = (unsigned long)start & ~(linesz - 1);
- end = ((unsigned long)start + size + linesz - 1) & ~(linesz - 1);
-
- for (v = begin; v < end; v += linesz)
- dcache_clean_line((void *)v);
-
- sync_write_buffer();
-}
-
-void dcache_invalidate_range(volatile void *start, size_t size)
-{
- unsigned long v, begin, end, linesz;
-
- linesz = CFG_DCACHE_LINESZ;
-
- /* You asked for it, you got it */
- begin = (unsigned long)start & ~(linesz - 1);
- end = ((unsigned long)start + size + linesz - 1) & ~(linesz - 1);
-
- for (v = begin; v < end; v += linesz)
- dcache_invalidate_line((void *)v);
-}
-
-void dcache_flush_range(volatile void *start, size_t size)
-{
- unsigned long v, begin, end, linesz;
-
- linesz = CFG_DCACHE_LINESZ;
-
- /* You asked for it, you got it */
- begin = (unsigned long)start & ~(linesz - 1);
- end = ((unsigned long)start + size + linesz - 1) & ~(linesz - 1);
-
- for (v = begin; v < end; v += linesz)
- dcache_flush_line((void *)v);
-
- sync_write_buffer();
-}
-
-void icache_invalidate_range(volatile void *start, size_t size)
-{
- unsigned long v, begin, end, linesz;
-
- linesz = CFG_ICACHE_LINESZ;
-
- /* You asked for it, you got it */
- begin = (unsigned long)start & ~(linesz - 1);
- end = ((unsigned long)start + size + linesz - 1) & ~(linesz - 1);
-
- for (v = begin; v < end; v += linesz)
- icache_invalidate_line((void *)v);
-}
-
-/*
- * This is called after loading something into memory. We need to
- * make sure that everything that was loaded is actually written to
- * RAM, and that the icache will look for it. Cleaning the dcache and
- * invalidating the icache will do the trick.
- */
-void flush_cache (unsigned long start_addr, unsigned long size)
-{
- dcache_clean_range((void *)start_addr, size);
- icache_invalidate_range((void *)start_addr, size);
-}
diff --git a/cpu/at32ap/config.mk b/cpu/at32ap/config.mk
deleted file mode 100644
index 1c12169221..0000000000
--- a/cpu/at32ap/config.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Copyright (C) 2005-2006 Atmel Corporation
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-PLATFORM_RELFLAGS += -mcpu=ap7000
diff --git a/cpu/at32ap/cpu.c b/cpu/at32ap/cpu.c
deleted file mode 100644
index 37e3ea040b..0000000000
--- a/cpu/at32ap/cpu.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2005-2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <common.h>
-#include <command.h>
-
-#include <asm/io.h>
-#include <asm/sections.h>
-#include <asm/sysreg.h>
-
-#include <asm/arch/memory-map.h>
-#include <asm/arch/platform.h>
-
-#include "hsmc3.h"
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int cpu_init(void)
-{
- const struct device *hebi;
- extern void _evba(void);
- char *p;
-
- gd->cpu_hz = CFG_OSC0_HZ;
-
- /* fff03400: 00010001 04030402 00050005 10011103 */
- hebi = get_device(DEVICE_HEBI);
- hsmc3_writel(hebi, MODE0, 0x00031103);
- hsmc3_writel(hebi, CYCLE0, 0x000c000d);
- hsmc3_writel(hebi, PULSE0, 0x0b0a0906);
- hsmc3_writel(hebi, SETUP0, 0x00010002);
-
- pm_init();
-
- sysreg_write(EVBA, (unsigned long)&_evba);
- asm volatile("csrf %0" : : "i"(SYSREG_EM_OFFSET));
- gd->console_uart = get_device(CFG_CONSOLE_UART_DEV);
-
- /* Lock everything that mess with the flash in the icache */
- for (p = __flashprog_start; p <= (__flashprog_end + CFG_ICACHE_LINESZ);
- p += CFG_ICACHE_LINESZ)
- asm volatile("cache %0, 0x02" : "=m"(*p) :: "memory");
-
- return 0;
-}
-
-void prepare_to_boot(void)
-{
- /* Flush both caches and the write buffer */
- asm volatile("cache %0[4], 010\n\t"
- "cache %0[0], 000\n\t"
- "sync 0" : : "r"(0) : "memory");
-}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- /* This will reset the CPU core, caches, MMU and all internal busses */
- __builtin_mtdr(8, 1 << 13); /* set DC:DBE */
- __builtin_mtdr(8, 1 << 30); /* set DC:RES */
-
- /* Flush the pipeline before we declare it a failure */
- asm volatile("sub pc, pc, -4");
-
- return -1;
-}
diff --git a/cpu/at32ap/device.c b/cpu/at32ap/device.c
deleted file mode 100644
index 89914b6b56..0000000000
--- a/cpu/at32ap/device.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <common.h>
-
-#include <asm/arch/platform.h>
-
-#include "sm.h"
-
-struct device_state {
- int refcount;
-};
-
-static struct device_state device_state[NR_DEVICES];
-
-static int claim_resource(const struct resource *res)
-{
- int ret = 0;
-
- switch (res->type) {
- case RESOURCE_GPIO:
- ret = gpio_set_func(res->u.gpio.gpio_dev,
- res->u.gpio.start,
- res->u.gpio.nr_pins,
- res->u.gpio.func);
- break;
- case RESOURCE_CLOCK:
- ret = pm_enable_clock(res->u.clock.id, res->u.clock.index);
- break;
- }
-
- return ret;
-}
-
-static void free_resource(const struct resource *res)
-{
- switch (res->type) {
- case RESOURCE_GPIO:
- gpio_free(res->u.gpio.gpio_dev, res->u.gpio.start,
- res->u.gpio.nr_pins);
- break;
- case RESOURCE_CLOCK:
- pm_disable_clock(res->u.clock.id, res->u.clock.index);
- break;
- }
-}
-
-static int init_dev(const struct device *dev)
-{
- unsigned int i;
- int ret = 0;
-
- for (i = 0; i < dev->nr_resources; i++) {
- ret = claim_resource(&dev->resource[i]);
- if (ret)
- goto cleanup;
- }
-
- return 0;
-
-cleanup:
- while (i--)
- free_resource(&dev->resource[i]);
-
- return ret;
-}
-
-const struct device *get_device(enum device_id devid)
-{
- struct device_state *devstate;
- const struct device *dev;
- unsigned long flags;
- int initialized = 0;
- int ret = 0;
-
- devstate = &device_state[devid];
- dev = &chip_device[devid];
-
- flags = disable_interrupts();
- if (devstate->refcount++)
- initialized = 1;
- if (flags)
- enable_interrupts();
-
- if (!initialized)
- ret = init_dev(dev);
-
- return ret ? NULL : dev;
-}
-
-void put_device(const struct device *dev)
-{
- struct device_state *devstate;
- unsigned long devid, flags;
-
- devid = (unsigned long)(dev - chip_device) / sizeof(struct device);
- devstate = &device_state[devid];
-
- flags = disable_interrupts();
- devstate--;
- if (!devstate) {
- unsigned int i;
- for (i = 0; i < dev->nr_resources; i++)
- free_resource(&dev->resource[i]);
- }
- if (flags)
- enable_interrupts();
-}
diff --git a/cpu/at32ap/entry.S b/cpu/at32ap/entry.S
deleted file mode 100644
index b52d798be3..0000000000
--- a/cpu/at32ap/entry.S
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2004-2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <asm/sysreg.h>
-#include <asm/ptrace.h>
-
- .section .text.exception,"ax"
- .global _evba
- .type _evba,@function
- .align 10
-_evba:
- .irp x,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
- .align 2
- rjmp unknown_exception
- .endr
-
- .global timer_interrupt_handler
- .type timer_interrupt_handler,@function
- .align 2
-timer_interrupt_handler:
- /*
- * Increment timer_overflow and re-write COMPARE with 0xffffffff.
- *
- * We're running at interrupt level 3, so we don't need to save
- * r8-r12 or lr to the stack.
- */
- mov r8, lo(timer_overflow)
- orh r8, hi(timer_overflow)
- ld.w r9, r8[0]
- mov r10, -1
- mtsr SYSREG_COMPARE, r10
- sub r9, -1
- st.w r8[0], r9
- rete
-
- .type unknown_exception, @function
-unknown_exception:
- pushm r0-r12
- sub r8, sp, REG_R12 - REG_R0 - 4
- mov r9, lr
- mfsr r10, SYSREG_RAR_EX
- mfsr r11, SYSREG_RSR_EX
- pushm r8-r11
- mfsr r12, SYSREG_ECR
- mov r11, sp
- rcall do_unknown_exception
-1: rjmp 1b
diff --git a/cpu/at32ap/exception.c b/cpu/at32ap/exception.c
deleted file mode 100644
index 4123c44616..0000000000
--- a/cpu/at32ap/exception.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2005-2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <common.h>
-
-#include <asm/sysreg.h>
-#include <asm/ptrace.h>
-
-static const char * const cpu_modes[8] = {
- "Application", "Supervisor", "Interrupt level 0", "Interrupt level 1",
- "Interrupt level 2", "Interrupt level 3", "Exception", "NMI"
-};
-
-static void dump_mem(const char *str, unsigned long bottom, unsigned long top)
-{
- unsigned long p;
- int i;
-
- printf("%s(0x%08lx to 0x%08lx)\n", str, bottom, top);
-
- for (p = bottom & ~31; p < top; ) {
- printf("%04lx: ", p & 0xffff);
-
- for (i = 0; i < 8; i++, p += 4) {
- unsigned int val;
-
- if (p < bottom || p >= top)
- printf(" ");
- else {
- val = *(unsigned long *)p;
- printf("%08x ", val);
- }
- }
- printf("\n");
- }
-}
-
-void do_unknown_exception(unsigned int ecr, struct pt_regs *regs)
-{
- unsigned int mode;
-
- printf("\n *** Unhandled exception %u at PC=0x%08lx\n", ecr, regs->pc);
-
- switch (ecr) {
- case ECR_BUS_ERROR_WRITE:
- case ECR_BUS_ERROR_READ:
- printf("Bus error at address 0x%08lx\n",
- sysreg_read(BEAR));
- break;
- case ECR_TLB_MULTIPLE:
- case ECR_ADDR_ALIGN_X:
- case ECR_PROTECTION_X:
- case ECR_ADDR_ALIGN_R:
- case ECR_ADDR_ALIGN_W:
- case ECR_PROTECTION_R:
- case ECR_PROTECTION_W:
- case ECR_DTLB_MODIFIED:
- case ECR_TLB_MISS_X:
- case ECR_TLB_MISS_R:
- case ECR_TLB_MISS_W:
- printf("MMU exception at address 0x%08lx\n",
- sysreg_read(TLBEAR));
- break;
- }
-
- printf(" pc: %08lx lr: %08lx sp: %08lx r12: %08lx\n",
- regs->pc, regs->lr, regs->sp, regs->r12);
- printf(" r11: %08lx r10: %08lx r9: %08lx r8: %08lx\n",
- regs->r11, regs->r10, regs->r9, regs->r8);
- printf(" r7: %08lx r6: %08lx r5: %08lx r4: %08lx\n",
- regs->r7, regs->r6, regs->r5, regs->r4);
- printf(" r3: %08lx r2: %08lx r1: %08lx r0: %08lx\n",
- regs->r3, regs->r2, regs->r1, regs->r0);
- printf("Flags: %c%c%c%c%c\n",
- regs->sr & SR_Q ? 'Q' : 'q',
- regs->sr & SR_V ? 'V' : 'v',
- regs->sr & SR_N ? 'N' : 'n',
- regs->sr & SR_Z ? 'Z' : 'z',
- regs->sr & SR_C ? 'C' : 'c');
- printf("Mode bits: %c%c%c%c%c%c%c%c%c\n",
- regs->sr & SR_H ? 'H' : 'h',
- regs->sr & SR_R ? 'R' : 'r',
- regs->sr & SR_J ? 'J' : 'j',
- regs->sr & SR_EM ? 'E' : 'e',
- regs->sr & SR_I3M ? '3' : '.',
- regs->sr & SR_I2M ? '2' : '.',
- regs->sr & SR_I1M ? '1' : '.',
- regs->sr & SR_I0M ? '0' : '.',
- regs->sr & SR_GM ? 'G' : 'g');
- mode = (regs->sr >> SYSREG_M0_OFFSET) & 7;
- printf("CPU Mode: %s\n", cpu_modes[mode]);
-
- /* Avoid exception loops */
- if (regs->sp >= CFG_INIT_SP_ADDR
- || regs->sp < (CFG_INIT_SP_ADDR - CONFIG_STACKSIZE))
- printf("\nStack pointer seems bogus, won't do stack dump\n");
- else
- dump_mem("\nStack: ", regs->sp, CFG_INIT_SP_ADDR);
-
- panic("Unhandled exception\n");
-}
diff --git a/cpu/at32ap/hsdramc.c b/cpu/at32ap/hsdramc.c
deleted file mode 100644
index f36da35452..0000000000
--- a/cpu/at32ap/hsdramc.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2005-2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <common.h>
-
-#ifdef CFG_HSDRAMC
-#include <asm/io.h>
-#include <asm/sdram.h>
-
-#include <asm/arch/platform.h>
-
-#include "hsdramc1.h"
-
-struct hsdramc {
- const struct device *hebi;
- void *regs;
-};
-
-static struct hsdramc hsdramc;
-
-unsigned long sdram_init(const struct sdram_info *info)
-{
- unsigned long *sdram = (unsigned long *)uncached(info->phys_addr);
- unsigned long sdram_size;
- unsigned long tmp;
- unsigned long bus_hz;
- unsigned int i;
-
- hsdramc.hebi = get_device(DEVICE_HEBI);
- if (!hsdramc.hebi)
- return 0;
-
- /* FIXME: Both of these lines are complete hacks */
- hsdramc.regs = hsdramc.hebi->regs + 0x400;
- bus_hz = pm_get_clock_freq(hsdramc.hebi->resource[0].u.clock.id);
-
- cpu_enable_sdram();
-
- tmp = (HSDRAMC1_BF(NC, info->col_bits - 8)
- | HSDRAMC1_BF(NR, info->row_bits - 11)
- | HSDRAMC1_BF(NB, info->bank_bits - 1)
- | HSDRAMC1_BF(CAS, info->cas)
- | HSDRAMC1_BF(TWR, info->twr)
- | HSDRAMC1_BF(TRC, info->trc)
- | HSDRAMC1_BF(TRP, info->trp)
- | HSDRAMC1_BF(TRCD, info->trcd)
- | HSDRAMC1_BF(TRAS, info->tras)
- | HSDRAMC1_BF(TXSR, info->txsr));
-
-#ifdef CFG_SDRAM_16BIT
- tmp |= HSDRAMC1_BIT(DBW);
- sdram_size = 1 << (info->row_bits + info->col_bits
- + info->bank_bits + 1);
-#else
- sdram_size = 1 << (info->row_bits + info->col_bits
- + info->bank_bits + 2);
-#endif
-
- hsdramc1_writel(&hsdramc, CR, tmp);
-
- /*
- * Initialization sequence for SDRAM, from the data sheet:
- *
- * 1. A minimum pause of 200 us is provided to precede any
- * signal toggle.
- */
- udelay(200);
-
- /*
- * 2. A Precharge All command is issued to the SDRAM
- */
- hsdramc1_writel(&hsdramc, MR, HSDRAMC1_MODE_BANKS_PRECHARGE);
- hsdramc1_readl(&hsdramc, MR);
- writel(0, sdram);
-
- /*
- * 3. Eight auto-refresh (CBR) cycles are provided
- */
- hsdramc1_writel(&hsdramc, MR, HSDRAMC1_MODE_AUTO_REFRESH);
- hsdramc1_readl(&hsdramc, MR);
- for (i = 0; i < 8; i++)
- writel(0, sdram);
-
- /*
- * 4. A mode register set (MRS) cycle is issued to program
- * SDRAM parameters, in particular CAS latency and burst
- * length.
- *
- * CAS from info struct, burst length 1, serial burst type
- */
- hsdramc1_writel(&hsdramc, MR, HSDRAMC1_MODE_LOAD_MODE);
- hsdramc1_readl(&hsdramc, MR);
- writel(0, sdram + (info->cas << 4));
-
- /*
- * 5. A Normal Mode command is provided, 3 clocks after tMRD
- * is met.
- *
- * From the timing diagram, it looks like tMRD is 3
- * cycles...try a dummy read from the peripheral bus.
- */
- hsdramc1_readl(&hsdramc, MR);
- hsdramc1_writel(&hsdramc, MR, HSDRAMC1_MODE_NORMAL);
- hsdramc1_readl(&hsdramc, MR);
- writel(0, sdram);
-
- /*
- * 6. Write refresh rate into SDRAMC refresh timer count
- * register (refresh rate = timing between refresh cycles).
- *
- * 15.6 us is a typical value for a burst of length one
- */
- hsdramc1_writel(&hsdramc, TR, (156 * (bus_hz / 1000)) / 10000);
-
- printf("SDRAM: %u MB at address 0x%08lx\n",
- sdram_size >> 20, info->phys_addr);
-
- printf("Testing SDRAM...");
- for (i = 0; i < sdram_size / 4; i++)
- sdram[i] = i;
-
- for (i = 0; i < sdram_size / 4; i++) {
- tmp = sdram[i];
- if (tmp != i) {
- printf("FAILED at address 0x%08lx\n",
- info->phys_addr + i * 4);
- printf("SDRAM: read 0x%lx, expected 0x%lx\n", tmp, i);
- return 0;
- }
- }
-
- puts("OK\n");
-
- return sdram_size;
-}
-
-#endif /* CFG_HSDRAMC */
diff --git a/cpu/at32ap/hsdramc1.h b/cpu/at32ap/hsdramc1.h
deleted file mode 100644
index ce229bca1f..0000000000
--- a/cpu/at32ap/hsdramc1.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Register definitions for SDRAM Controller
- */
-#ifndef __ASM_AVR32_HSDRAMC1_H__
-#define __ASM_AVR32_HSDRAMC1_H__
-
-/* HSDRAMC1 register offsets */
-#define HSDRAMC1_MR 0x0000
-#define HSDRAMC1_TR 0x0004
-#define HSDRAMC1_CR 0x0008
-#define HSDRAMC1_HSR 0x000c
-#define HSDRAMC1_LPR 0x0010
-#define HSDRAMC1_IER 0x0014
-#define HSDRAMC1_IDR 0x0018
-#define HSDRAMC1_IMR 0x001c
-#define HSDRAMC1_ISR 0x0020
-#define HSDRAMC1_MDR 0x0024
-#define HSDRAMC1_VERSION 0x00fc
-
-/* Bitfields in MR */
-#define HSDRAMC1_MODE_OFFSET 0
-#define HSDRAMC1_MODE_SIZE 3
-
-/* Bitfields in TR */
-#define HSDRAMC1_COUNT_OFFSET 0
-#define HSDRAMC1_COUNT_SIZE 12
-
-/* Bitfields in CR */
-#define HSDRAMC1_NC_OFFSET 0
-#define HSDRAMC1_NC_SIZE 2
-#define HSDRAMC1_NR_OFFSET 2
-#define HSDRAMC1_NR_SIZE 2
-#define HSDRAMC1_NB_OFFSET 4
-#define HSDRAMC1_NB_SIZE 1
-#define HSDRAMC1_CAS_OFFSET 5
-#define HSDRAMC1_CAS_SIZE 2
-#define HSDRAMC1_DBW_OFFSET 7
-#define HSDRAMC1_DBW_SIZE 1
-#define HSDRAMC1_TWR_OFFSET 8
-#define HSDRAMC1_TWR_SIZE 4
-#define HSDRAMC1_TRC_OFFSET 12
-#define HSDRAMC1_TRC_SIZE 4
-#define HSDRAMC1_TRP_OFFSET 16
-#define HSDRAMC1_TRP_SIZE 4
-#define HSDRAMC1_TRCD_OFFSET 20
-#define HSDRAMC1_TRCD_SIZE 4
-#define HSDRAMC1_TRAS_OFFSET 24
-#define HSDRAMC1_TRAS_SIZE 4
-#define HSDRAMC1_TXSR_OFFSET 28
-#define HSDRAMC1_TXSR_SIZE 4
-
-/* Bitfields in HSR */
-#define HSDRAMC1_DA_OFFSET 0
-#define HSDRAMC1_DA_SIZE 1
-
-/* Bitfields in LPR */
-#define HSDRAMC1_LPCB_OFFSET 0
-#define HSDRAMC1_LPCB_SIZE 2
-#define HSDRAMC1_PASR_OFFSET 4
-#define HSDRAMC1_PASR_SIZE 3
-#define HSDRAMC1_TCSR_OFFSET 8
-#define HSDRAMC1_TCSR_SIZE 2
-#define HSDRAMC1_DS_OFFSET 10
-#define HSDRAMC1_DS_SIZE 2
-#define HSDRAMC1_TIMEOUT_OFFSET 12
-#define HSDRAMC1_TIMEOUT_SIZE 2
-
-/* Bitfields in IDR */
-#define HSDRAMC1_RES_OFFSET 0
-#define HSDRAMC1_RES_SIZE 1
-
-/* Bitfields in MDR */
-#define HSDRAMC1_MD_OFFSET 0
-#define HSDRAMC1_MD_SIZE 2
-
-/* Bitfields in VERSION */
-#define HSDRAMC1_VERSION_OFFSET 0
-#define HSDRAMC1_VERSION_SIZE 12
-#define HSDRAMC1_MFN_OFFSET 16
-#define HSDRAMC1_MFN_SIZE 3
-
-/* Constants for MODE */
-#define HSDRAMC1_MODE_NORMAL 0
-#define HSDRAMC1_MODE_NOP 1
-#define HSDRAMC1_MODE_BANKS_PRECHARGE 2
-#define HSDRAMC1_MODE_LOAD_MODE 3
-#define HSDRAMC1_MODE_AUTO_REFRESH 4
-#define HSDRAMC1_MODE_EXT_LOAD_MODE 5
-#define HSDRAMC1_MODE_POWER_DOWN 6
-
-/* Constants for NC */
-#define HSDRAMC1_NC_8_COLUMN_BITS 0
-#define HSDRAMC1_NC_9_COLUMN_BITS 1
-#define HSDRAMC1_NC_10_COLUMN_BITS 2
-#define HSDRAMC1_NC_11_COLUMN_BITS 3
-
-/* Constants for NR */
-#define HSDRAMC1_NR_11_ROW_BITS 0
-#define HSDRAMC1_NR_12_ROW_BITS 1
-#define HSDRAMC1_NR_13_ROW_BITS 2
-
-/* Constants for NB */
-#define HSDRAMC1_NB_TWO_BANKS 0
-#define HSDRAMC1_NB_FOUR_BANKS 1
-
-/* Constants for CAS */
-#define HSDRAMC1_CAS_ONE_CYCLE 1
-#define HSDRAMC1_CAS_TWO_CYCLES 2
-
-/* Constants for DBW */
-#define HSDRAMC1_DBW_32_BITS 0
-#define HSDRAMC1_DBW_16_BITS 1
-
-/* Constants for TIMEOUT */
-#define HSDRAMC1_TIMEOUT_AFTER_END 0
-#define HSDRAMC1_TIMEOUT_64_CYC_AFTER_END 1
-#define HSDRAMC1_TIMEOUT_128_CYC_AFTER_END 2
-
-/* Constants for MD */
-#define HSDRAMC1_MD_SDRAM 0
-#define HSDRAMC1_MD_LOW_POWER_SDRAM 1
-
-/* Bit manipulation macros */
-#define HSDRAMC1_BIT(name) \
- (1 << HSDRAMC1_##name##_OFFSET)
-#define HSDRAMC1_BF(name,value) \
- (((value) & ((1 << HSDRAMC1_##name##_SIZE) - 1)) \
- << HSDRAMC1_##name##_OFFSET)
-#define HSDRAMC1_BFEXT(name,value) \
- (((value) >> HSDRAMC1_##name##_OFFSET) \
- & ((1 << HSDRAMC1_##name##_SIZE) - 1))
-#define HSDRAMC1_BFINS(name,value,old) \
- (((old) & ~(((1 << HSDRAMC1_##name##_SIZE) - 1) \
- << HSDRAMC1_##name##_OFFSET)) \
- | HSDRAMC1_BF(name,value))
-
-/* Register access macros */
-#define hsdramc1_readl(port,reg) \
- readl((port)->regs + HSDRAMC1_##reg)
-#define hsdramc1_writel(port,reg,value) \
- writel((value), (port)->regs + HSDRAMC1_##reg)
-
-#endif /* __ASM_AVR32_HSDRAMC1_H__ */
diff --git a/cpu/at32ap/hsmc3.h b/cpu/at32ap/hsmc3.h
deleted file mode 100644
index ec78cee714..0000000000
--- a/cpu/at32ap/hsmc3.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Register definitions for Static Memory Controller
- */
-#ifndef __CPU_AT32AP_HSMC3_H__
-#define __CPU_AT32AP_HSMC3_H__
-
-/* HSMC3 register offsets */
-#define HSMC3_SETUP0 0x0000
-#define HSMC3_PULSE0 0x0004
-#define HSMC3_CYCLE0 0x0008
-#define HSMC3_MODE0 0x000c
-#define HSMC3_SETUP1 0x0010
-#define HSMC3_PULSE1 0x0014
-#define HSMC3_CYCLE1 0x0018
-#define HSMC3_MODE1 0x001c
-#define HSMC3_SETUP2 0x0020
-#define HSMC3_PULSE2 0x0024
-#define HSMC3_CYCLE2 0x0028
-#define HSMC3_MODE2 0x002c
-#define HSMC3_SETUP3 0x0030
-#define HSMC3_PULSE3 0x0034
-#define HSMC3_CYCLE3 0x0038
-#define HSMC3_MODE3 0x003c
-#define HSMC3_SETUP4 0x0040
-#define HSMC3_PULSE4 0x0044
-#define HSMC3_CYCLE4 0x0048
-#define HSMC3_MODE4 0x004c
-#define HSMC3_SETUP5 0x0050
-#define HSMC3_PULSE5 0x0054
-#define HSMC3_CYCLE5 0x0058
-#define HSMC3_MODE5 0x005c
-
-/* Bitfields in SETUP0 */
-#define HSMC3_NWE_SETUP_OFFSET 0
-#define HSMC3_NWE_SETUP_SIZE 6
-#define HSMC3_NCS_WR_SETUP_OFFSET 8
-#define HSMC3_NCS_WR_SETUP_SIZE 6
-#define HSMC3_NRD_SETUP_OFFSET 16
-#define HSMC3_NRD_SETUP_SIZE 6
-#define HSMC3_NCS_RD_SETUP_OFFSET 24
-#define HSMC3_NCS_RD_SETUP_SIZE 6
-
-/* Bitfields in PULSE0 */
-#define HSMC3_NWE_PULSE_OFFSET 0
-#define HSMC3_NWE_PULSE_SIZE 7
-#define HSMC3_NCS_WR_PULSE_OFFSET 8
-#define HSMC3_NCS_WR_PULSE_SIZE 7
-#define HSMC3_NRD_PULSE_OFFSET 16
-#define HSMC3_NRD_PULSE_SIZE 7
-#define HSMC3_NCS_RD_PULSE_OFFSET 24
-#define HSMC3_NCS_RD_PULSE_SIZE 7
-
-/* Bitfields in CYCLE0 */
-#define HSMC3_NWE_CYCLE_OFFSET 0
-#define HSMC3_NWE_CYCLE_SIZE 9
-#define HSMC3_NRD_CYCLE_OFFSET 16
-#define HSMC3_NRD_CYCLE_SIZE 9
-
-/* Bitfields in MODE0 */
-#define HSMC3_READ_MODE_OFFSET 0
-#define HSMC3_READ_MODE_SIZE 1
-#define HSMC3_WRITE_MODE_OFFSET 1
-#define HSMC3_WRITE_MODE_SIZE 1
-#define HSMC3_EXNW_MODE_OFFSET 4
-#define HSMC3_EXNW_MODE_SIZE 2
-#define HSMC3_BAT_OFFSET 8
-#define HSMC3_BAT_SIZE 1
-#define HSMC3_DBW_OFFSET 12
-#define HSMC3_DBW_SIZE 2
-#define HSMC3_TDF_CYCLES_OFFSET 16
-#define HSMC3_TDF_CYCLES_SIZE 4
-#define HSMC3_TDF_MODE_OFFSET 20
-#define HSMC3_TDF_MODE_SIZE 1
-#define HSMC3_PMEN_OFFSET 24
-#define HSMC3_PMEN_SIZE 1
-#define HSMC3_PS_OFFSET 28
-#define HSMC3_PS_SIZE 2
-
-/* Bitfields in MODE1 */
-#define HSMC3_PD_OFFSET 28
-#define HSMC3_PD_SIZE 2
-
-/* Constants for READ_MODE */
-#define HSMC3_READ_MODE_NCS_CONTROLLED 0
-#define HSMC3_READ_MODE_NRD_CONTROLLED 1
-
-/* Constants for WRITE_MODE */
-#define HSMC3_WRITE_MODE_NCS_CONTROLLED 0
-#define HSMC3_WRITE_MODE_NWE_CONTROLLED 1
-
-/* Constants for EXNW_MODE */
-#define HSMC3_EXNW_MODE_DISABLED 0
-#define HSMC3_EXNW_MODE_RESERVED 1
-#define HSMC3_EXNW_MODE_FROZEN 2
-#define HSMC3_EXNW_MODE_READY 3
-
-/* Constants for BAT */
-#define HSMC3_BAT_BYTE_SELECT 0
-#define HSMC3_BAT_BYTE_WRITE 1
-
-/* Constants for DBW */
-#define HSMC3_DBW_8_BITS 0
-#define HSMC3_DBW_16_BITS 1
-#define HSMC3_DBW_32_BITS 2
-
-/* Bit manipulation macros */
-#define HSMC3_BIT(name) \
- (1 << HSMC3_##name##_OFFSET)
-#define HSMC3_BF(name,value) \
- (((value) & ((1 << HSMC3_##name##_SIZE) - 1)) \
- << HSMC3_##name##_OFFSET)
-#define HSMC3_BFEXT(name,value) \
- (((value) >> HSMC3_##name##_OFFSET) \
- & ((1 << HSMC3_##name##_SIZE) - 1))
-#define HSMC3_BFINS(name,value,old)\
- (((old) & ~(((1 << HSMC3_##name##_SIZE) - 1) \
- << HSMC3_##name##_OFFSET)) \
- | HSMC3_BF(name,value))
-
-/* Register access macros */
-#define hsmc3_readl(port,reg) \
- readl((port)->regs + HSMC3_##reg)
-#define hsmc3_writel(port,reg,value) \
- writel((value), (port)->regs + HSMC3_##reg)
-
-#endif /* __CPU_AT32AP_HSMC3_H__ */
diff --git a/cpu/at32ap/interrupts.c b/cpu/at32ap/interrupts.c
deleted file mode 100644
index 9fb6c5f4e4..0000000000
--- a/cpu/at32ap/interrupts.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2004-2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <common.h>
-
-#include <asm/div64.h>
-#include <asm/errno.h>
-#include <asm/io.h>
-#include <asm/processor.h>
-#include <asm/sysreg.h>
-
-#include <asm/arch/platform.h>
-
-#define HANDLER_MASK 0x00ffffff
-#define INTLEV_SHIFT 30
-#define INTLEV_MASK 0x00000003
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/* Incremented whenever COUNT reaches 0xffffffff by timer_interrupt_handler */
-volatile unsigned long timer_overflow;
-
-/*
- * Instead of dividing by get_tbclk(), multiply by this constant and
- * right-shift the result by 32 bits.
- */
-static unsigned long tb_factor;
-
-static const struct device *intc_dev;
-
-void reset_timer(void)
-{
- sysreg_write(COUNT, 0);
- cpu_sync_pipeline(); /* process any pending interrupts */
- timer_overflow = 0;
-}
-
-unsigned long get_timer(unsigned long base)
-{
- u64 now = get_ticks();
-
- now *= tb_factor;
- return (unsigned long)(now >> 32) - base;
-}
-
-void set_timer(unsigned long t)
-{
- unsigned long long ticks = t;
- unsigned long lo, hi, hi_new;
-
- ticks = (ticks * get_tbclk()) / CFG_HZ;
- hi = ticks >> 32;
- lo = ticks & 0xffffffffUL;
-
- do {
- timer_overflow = hi;
- sysreg_write(COUNT, lo);
- hi_new = timer_overflow;
- } while (hi_new != hi);
-}
-
-static int set_interrupt_handler(unsigned int nr, void (*handler)(void),
- unsigned int priority)
-{
- unsigned long intpr;
- unsigned long handler_addr = (unsigned long)handler;
-
- if ((handler_addr & HANDLER_MASK) != handler_addr
- || (priority & INTLEV_MASK) != priority)
- return -EINVAL;
-
- intpr = (handler_addr & HANDLER_MASK);
- intpr |= (priority & INTLEV_MASK) << INTLEV_SHIFT;
- writel(intpr, intc_dev->regs + 4 * nr);
-
- return 0;
-}
-
-void timer_init(void)
-{
- extern void timer_interrupt_handler(void);
- u64 tmp;
-
- sysreg_write(COUNT, 0);
-
- tmp = (u64)CFG_HZ << 32;
- tmp += gd->cpu_hz / 2;
- do_div(tmp, gd->cpu_hz);
- tb_factor = (u32)tmp;
-
- intc_dev = get_device(DEVICE_INTC);
-
- if (!intc_dev
- || set_interrupt_handler(0, &timer_interrupt_handler, 3))
- return;
-
- /* For all practical purposes, this gives us an overflow interrupt */
- sysreg_write(COMPARE, 0xffffffff);
-}
diff --git a/cpu/at32ap/pio.c b/cpu/at32ap/pio.c
deleted file mode 100644
index 8b6c3a35df..0000000000
--- a/cpu/at32ap/pio.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <common.h>
-
-#include <asm/errno.h>
-#include <asm/io.h>
-#include <asm/arch/platform.h>
-
-#include "pio2.h"
-
-struct pio_state {
- const struct device *dev;
- u32 alloc_mask;
-};
-
-static struct pio_state pio_state[CFG_NR_PIOS];
-
-int gpio_set_func(enum device_id gpio_devid, unsigned int start,
- unsigned int nr_pins, enum gpio_func func)
-{
- const struct device *gpio;
- struct pio_state *state;
- u32 mask;
-
- state = &pio_state[gpio_devid - DEVICE_PIOA];
-
- gpio = get_device(gpio_devid);
- if (!gpio)
- return -EBUSY;
-
- state->dev = gpio;
- mask = ((1 << nr_pins) - 1) << start;
-
- if (mask & state->alloc_mask) {
- put_device(gpio);
- return -EBUSY;
- }
- state->alloc_mask |= mask;
-
- switch (func) {
- case GPIO_FUNC_GPIO:
- /* TODO */
- return -EINVAL;
- case GPIO_FUNC_A:
- pio2_writel(gpio, ASR, mask);
- pio2_writel(gpio, PDR, mask);
- pio2_writel(gpio, PUDR, mask);
- break;
- case GPIO_FUNC_B:
- pio2_writel(gpio, BSR, mask);
- pio2_writel(gpio, PDR, mask);
- pio2_writel(gpio, PUDR, mask);
- break;
- }
-
- return 0;
-}
-
-void gpio_free(enum device_id gpio_devid, unsigned int start,
- unsigned int nr_pins)
-{
- const struct device *gpio;
- struct pio_state *state;
- u32 mask;
-
- state = &pio_state[gpio_devid - DEVICE_PIOA];
- gpio = state->dev;
- mask = ((1 << nr_pins) - 1) << start;
-
- pio2_writel(gpio, ODR, mask);
- pio2_writel(gpio, PER, mask);
-
- state->alloc_mask &= ~mask;
- put_device(gpio);
-}
diff --git a/cpu/at32ap/pio2.h b/cpu/at32ap/pio2.h
deleted file mode 100644
index 6b79de3c72..0000000000
--- a/cpu/at32ap/pio2.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Register definitions for Parallel Input/Output Controller
- */
-#ifndef __CPU_AT32AP_PIO2_H__
-#define __CPU_AT32AP_PIO2_H__
-
-/* PIO2 register offsets */
-#define PIO2_PER 0x0000
-#define PIO2_PDR 0x0004
-#define PIO2_PSR 0x0008
-#define PIO2_OER 0x0010
-#define PIO2_ODR 0x0014
-#define PIO2_OSR 0x0018
-#define PIO2_IFER 0x0020
-#define PIO2_IFDR 0x0024
-#define PIO2_ISFR 0x0028
-#define PIO2_SODR 0x0030
-#define PIO2_CODR 0x0034
-#define PIO2_ODSR 0x0038
-#define PIO2_PDSR 0x003c
-#define PIO2_IER 0x0040
-#define PIO2_IDR 0x0044
-#define PIO2_IMR 0x0048
-#define PIO2_ISR 0x004c
-#define PIO2_MDER 0x0050
-#define PIO2_MDDR 0x0054
-#define PIO2_MDSR 0x0058
-#define PIO2_PUDR 0x0060
-#define PIO2_PUER 0x0064
-#define PIO2_PUSR 0x0068
-#define PIO2_ASR 0x0070
-#define PIO2_BSR 0x0074
-#define PIO2_ABSR 0x0078
-#define PIO2_OWER 0x00a0
-#define PIO2_OWDR 0x00a4
-#define PIO2_OWSR 0x00a8
-
-/* Register access macros */
-#define pio2_readl(port,reg) \
- readl((port)->regs + PIO2_##reg)
-#define pio2_writel(port,reg,value) \
- writel((value), (port)->regs + PIO2_##reg)
-
-#endif /* __CPU_AT32AP_PIO2_H__ */
diff --git a/cpu/at32ap/pm.c b/cpu/at32ap/pm.c
deleted file mode 100644
index 01ac325ee8..0000000000
--- a/cpu/at32ap/pm.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <common.h>
-
-#ifdef CFG_POWER_MANAGER
-#include <asm/errno.h>
-#include <asm/io.h>
-
-#include <asm/arch/memory-map.h>
-#include <asm/arch/platform.h>
-
-#include "sm.h"
-
-/* Sanity checks */
-#if (CFG_CLKDIV_CPU > CFG_CLKDIV_HSB) \
- || (CFG_CLKDIV_HSB > CFG_CLKDIV_PBA) \
- || (CFG_CLKDIV_HSB > CFG_CLKDIV_PBB)
-# error Constraint fCPU >= fHSB >= fPB{A,B} violated
-#endif
-#if defined(CONFIG_PLL) && ((CFG_PLL0_MUL < 1) || (CFG_PLL0_DIV < 1))
-# error Invalid PLL multiplier and/or divider
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-struct clock_domain_state {
- const struct device *bridge;
- unsigned long freq;
- u32 mask;
-};
-static struct clock_domain_state ckd_state[NR_CLOCK_DOMAINS];
-
-int pm_enable_clock(enum clock_domain_id id, unsigned int index)
-{
- const struct clock_domain *ckd = &chip_clock[id];
- struct clock_domain_state *state = &ckd_state[id];
-
- if (ckd->bridge != NO_DEVICE) {
- state->bridge = get_device(ckd->bridge);
- if (!state->bridge)
- return -EBUSY;
- }
-
- state->mask |= 1 << index;
- if (gd->sm)
- writel(state->mask, gd->sm->regs + ckd->reg);
-
- return 0;
-}
-
-void pm_disable_clock(enum clock_domain_id id, unsigned int index)
-{
- const struct clock_domain *ckd = &chip_clock[id];
- struct clock_domain_state *state = &ckd_state[id];
-
- state->mask &= ~(1 << index);
- if (gd->sm)
- writel(state->mask, gd->sm->regs + ckd->reg);
-
- if (ckd->bridge)
- put_device(state->bridge);
-}
-
-unsigned long pm_get_clock_freq(enum clock_domain_id domain)
-{
- return ckd_state[domain].freq;
-}
-
-void pm_init(void)
-{
- uint32_t cksel = 0;
- unsigned long main_clock;
-
- /* Make sure we don't disable any device we're already using */
- get_device(DEVICE_HRAMC);
- get_device(DEVICE_HEBI);
-
- /* Enable the PICO as well */
- ckd_state[CLOCK_CPU].mask |= 1;
-
- gd->sm = get_device(DEVICE_SM);
- if (!gd->sm)
- panic("Unable to claim system manager device!\n");
-
- /* Disable any devices that haven't been explicitly claimed */
- sm_writel(gd->sm, PM_PBB_MASK, ckd_state[CLOCK_PBB].mask);
- sm_writel(gd->sm, PM_PBA_MASK, ckd_state[CLOCK_PBA].mask);
- sm_writel(gd->sm, PM_HSB_MASK, ckd_state[CLOCK_HSB].mask);
- sm_writel(gd->sm, PM_CPU_MASK, ckd_state[CLOCK_CPU].mask);
-
-#ifdef CONFIG_PLL
- /* Initialize the PLL */
- main_clock = (CFG_OSC0_HZ / CFG_PLL0_DIV) * CFG_PLL0_MUL;
-
- sm_writel(gd->sm, PM_PLL0, (SM_BF(PLLCOUNT, CFG_PLL0_SUPPRESS_CYCLES)
- | SM_BF(PLLMUL, CFG_PLL0_MUL - 1)
- | SM_BF(PLLDIV, CFG_PLL0_DIV - 1)
- | SM_BF(PLLOPT, CFG_PLL0_OPT)
- | SM_BF(PLLOSC, 0)
- | SM_BIT(PLLEN)));
-
- /* Wait for lock */
- while (!(sm_readl(gd->sm, PM_ISR) & SM_BIT(LOCK0))) ;
-#else
- main_clock = CFG_OSC0_HZ;
-#endif
-
- /* Set up clocks for the CPU and all peripheral buses */
- if (CFG_CLKDIV_CPU) {
- cksel |= SM_BIT(CPUDIV) | SM_BF(CPUSEL, CFG_CLKDIV_CPU - 1);
- ckd_state[CLOCK_CPU].freq = main_clock / (1 << CFG_CLKDIV_CPU);
- } else {
- ckd_state[CLOCK_CPU].freq = main_clock;
- }
- if (CFG_CLKDIV_HSB) {
- cksel |= SM_BIT(HSBDIV) | SM_BF(HSBSEL, CFG_CLKDIV_HSB - 1);
- ckd_state[CLOCK_HSB].freq = main_clock / (1 << CFG_CLKDIV_HSB);
- } else {
- ckd_state[CLOCK_HSB].freq = main_clock;
- }
- if (CFG_CLKDIV_PBA) {
- cksel |= SM_BIT(PBADIV) | SM_BF(PBASEL, CFG_CLKDIV_PBA - 1);
- ckd_state[CLOCK_PBA].freq = main_clock / (1 << CFG_CLKDIV_PBA);
- } else {
- ckd_state[CLOCK_PBA].freq = main_clock;
- }
- if (CFG_CLKDIV_PBB) {
- cksel |= SM_BIT(PBBDIV) | SM_BF(PBBSEL, CFG_CLKDIV_PBB - 1);
- ckd_state[CLOCK_PBB].freq = main_clock / (1 << CFG_CLKDIV_PBB);
- } else {
- ckd_state[CLOCK_PBB].freq = main_clock;
- }
- sm_writel(gd->sm, PM_CKSEL, cksel);
-
- /* CFG_HZ currently depends on cpu_hz */
- gd->cpu_hz = ckd_state[CLOCK_CPU].freq;
-
-#ifdef CONFIG_PLL
- /* Use PLL0 as main clock */
- sm_writel(gd->sm, PM_MCCTRL, SM_BIT(PLLSEL));
-#endif
-}
-
-#endif /* CFG_POWER_MANAGER */
diff --git a/cpu/at32ap/sm.h b/cpu/at32ap/sm.h
deleted file mode 100644
index ce81ef0a46..0000000000
--- a/cpu/at32ap/sm.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Register definitions for System Manager
- */
-#ifndef __CPU_AT32AP_SM_H__
-#define __CPU_AT32AP_SM_H__
-
-/* SM register offsets */
-#define SM_PM_MCCTRL 0x0000
-#define SM_PM_CKSEL 0x0004
-#define SM_PM_CPU_MASK 0x0008
-#define SM_PM_HSB_MASK 0x000c
-#define SM_PM_PBA_MASK 0x0010
-#define SM_PM_PBB_MASK 0x0014
-#define SM_PM_PLL0 0x0020
-#define SM_PM_PLL1 0x0024
-#define SM_PM_VCTRL 0x0030
-#define SM_PM_VMREF 0x0034
-#define SM_PM_VMV 0x0038
-#define SM_PM_IER 0x0040
-#define SM_PM_IDR 0x0044
-#define SM_PM_IMR 0x0048
-#define SM_PM_ISR 0x004c
-#define SM_PM_ICR 0x0050
-#define SM_PM_GCCTRL 0x0060
-#define SM_RTC_CTRL 0x0080
-#define SM_RTC_VAL 0x0084
-#define SM_RTC_TOP 0x0088
-#define SM_RTC_IER 0x0090
-#define SM_RTC_IDR 0x0094
-#define SM_RTC_IMR 0x0098
-#define SM_RTC_ISR 0x009c
-#define SM_RTC_ICR 0x00a0
-#define SM_WDT_CTRL 0x00b0
-#define SM_WDT_CLR 0x00b4
-#define SM_WDT_EXT 0x00b8
-#define SM_RC_RCAUSE 0x00c0
-#define SM_EIM_IER 0x0100
-#define SM_EIM_IDR 0x0104
-#define SM_EIM_IMR 0x0108
-#define SM_EIM_ISR 0x010c
-#define SM_EIM_ICR 0x0110
-#define SM_EIM_MODE 0x0114
-#define SM_EIM_EDGE 0x0118
-#define SM_EIM_LEVEL 0x011c
-#define SM_EIM_TEST 0x0120
-#define SM_EIM_NMIC 0x0124
-
-/* Bitfields in PM_CKSEL */
-#define SM_CPUSEL_OFFSET 0
-#define SM_CPUSEL_SIZE 3
-#define SM_CPUDIV_OFFSET 7
-#define SM_CPUDIV_SIZE 1
-#define SM_HSBSEL_OFFSET 8
-#define SM_HSBSEL_SIZE 3
-#define SM_HSBDIV_OFFSET 15
-#define SM_HSBDIV_SIZE 1
-#define SM_PBASEL_OFFSET 16
-#define SM_PBASEL_SIZE 3
-#define SM_PBADIV_OFFSET 23
-#define SM_PBADIV_SIZE 1
-#define SM_PBBSEL_OFFSET 24
-#define SM_PBBSEL_SIZE 3
-#define SM_PBBDIV_OFFSET 31
-#define SM_PBBDIV_SIZE 1
-
-/* Bitfields in PM_PLL0 */
-#define SM_PLLEN_OFFSET 0
-#define SM_PLLEN_SIZE 1
-#define SM_PLLOSC_OFFSET 1
-#define SM_PLLOSC_SIZE 1
-#define SM_PLLOPT_OFFSET 2
-#define SM_PLLOPT_SIZE 3
-#define SM_PLLDIV_OFFSET 8
-#define SM_PLLDIV_SIZE 8
-#define SM_PLLMUL_OFFSET 16
-#define SM_PLLMUL_SIZE 8
-#define SM_PLLCOUNT_OFFSET 24
-#define SM_PLLCOUNT_SIZE 6
-#define SM_PLLTEST_OFFSET 31
-#define SM_PLLTEST_SIZE 1
-
-/* Bitfields in PM_VCTRL */
-#define SM_VAUTO_OFFSET 0
-#define SM_VAUTO_SIZE 1
-#define SM_PM_VCTRL_VAL_OFFSET 8
-#define SM_PM_VCTRL_VAL_SIZE 7
-
-/* Bitfields in PM_VMREF */
-#define SM_REFSEL_OFFSET 0
-#define SM_REFSEL_SIZE 4
-
-/* Bitfields in PM_VMV */
-#define SM_PM_VMV_VAL_OFFSET 0
-#define SM_PM_VMV_VAL_SIZE 8
-
-/* Bitfields in PM_ICR */
-#define SM_LOCK0_OFFSET 0
-#define SM_LOCK0_SIZE 1
-#define SM_LOCK1_OFFSET 1
-#define SM_LOCK1_SIZE 1
-#define SM_WAKE_OFFSET 2
-#define SM_WAKE_SIZE 1
-#define SM_VOK_OFFSET 3
-#define SM_VOK_SIZE 1
-#define SM_VMRDY_OFFSET 4
-#define SM_VMRDY_SIZE 1
-#define SM_CKRDY_OFFSET 5
-#define SM_CKRDY_SIZE 1
-
-/* Bitfields in PM_GCCTRL */
-#define SM_OSCSEL_OFFSET 0
-#define SM_OSCSEL_SIZE 1
-#define SM_PLLSEL_OFFSET 1
-#define SM_PLLSEL_SIZE 1
-#define SM_CEN_OFFSET 2
-#define SM_CEN_SIZE 1
-#define SM_CPC_OFFSET 3
-#define SM_CPC_SIZE 1
-#define SM_DIVEN_OFFSET 4
-#define SM_DIVEN_SIZE 1
-#define SM_DIV_OFFSET 8
-#define SM_DIV_SIZE 8
-
-/* Bitfields in RTC_CTRL */
-#define SM_PCLR_OFFSET 1
-#define SM_PCLR_SIZE 1
-#define SM_TOPEN_OFFSET 2
-#define SM_TOPEN_SIZE 1
-#define SM_CLKEN_OFFSET 3
-#define SM_CLKEN_SIZE 1
-#define SM_PSEL_OFFSET 8
-#define SM_PSEL_SIZE 16
-
-/* Bitfields in RTC_VAL */
-#define SM_RTC_VAL_VAL_OFFSET 0
-#define SM_RTC_VAL_VAL_SIZE 31
-
-/* Bitfields in RTC_TOP */
-#define SM_RTC_TOP_VAL_OFFSET 0
-#define SM_RTC_TOP_VAL_SIZE 32
-
-/* Bitfields in RTC_ICR */
-#define SM_TOPI_OFFSET 0
-#define SM_TOPI_SIZE 1
-
-/* Bitfields in WDT_CTRL */
-#define SM_KEY_OFFSET 24
-#define SM_KEY_SIZE 8
-
-/* Bitfields in RC_RCAUSE */
-#define SM_POR_OFFSET 0
-#define SM_POR_SIZE 1
-#define SM_BOD_OFFSET 1
-#define SM_BOD_SIZE 1
-#define SM_EXT_OFFSET 2
-#define SM_EXT_SIZE 1
-#define SM_WDT_OFFSET 3
-#define SM_WDT_SIZE 1
-#define SM_NTAE_OFFSET 4
-#define SM_NTAE_SIZE 1
-#define SM_SERP_OFFSET 5
-#define SM_SERP_SIZE 1
-
-/* Bitfields in EIM_EDGE */
-#define SM_INT0_OFFSET 0
-#define SM_INT0_SIZE 1
-#define SM_INT1_OFFSET 1
-#define SM_INT1_SIZE 1
-#define SM_INT2_OFFSET 2
-#define SM_INT2_SIZE 1
-#define SM_INT3_OFFSET 3
-#define SM_INT3_SIZE 1
-
-/* Bitfields in EIM_LEVEL */
-
-/* Bitfields in EIM_TEST */
-#define SM_TESTEN_OFFSET 31
-#define SM_TESTEN_SIZE 1
-
-/* Bitfields in EIM_NMIC */
-#define SM_EN_OFFSET 0
-#define SM_EN_SIZE 1
-
-/* Bit manipulation macros */
-#define SM_BIT(name) \
- (1 << SM_##name##_OFFSET)
-#define SM_BF(name,value) \
- (((value) & ((1 << SM_##name##_SIZE) - 1)) \
- << SM_##name##_OFFSET)
-#define SM_BFEXT(name,value) \
- (((value) >> SM_##name##_OFFSET) \
- & ((1 << SM_##name##_SIZE) - 1))
-#define SM_BFINS(name,value,old) \
- (((old) & ~(((1 << SM_##name##_SIZE) - 1) \
- << SM_##name##_OFFSET)) \
- | SM_BF(name,value))
-
-/* Register access macros */
-#define sm_readl(port,reg) \
- readl((port)->regs + SM_##reg)
-#define sm_writel(port,reg,value) \
- writel((value), (port)->regs + SM_##reg)
-
-#endif /* __CPU_AT32AP_SM_H__ */
diff --git a/cpu/at32ap/start.S b/cpu/at32ap/start.S
deleted file mode 100644
index 79ee33b1fa..0000000000
--- a/cpu/at32ap/start.S
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2005-2006 Atmel Corporation
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <config.h>
-#include <asm/sysreg.h>
-
-#ifndef PART_SPECIFIC_BOOTSTRAP
-# define PART_SPECIFIC_BOOTSTRAP
-#endif
-
-#define SYSREG_MMUCR_I_OFFSET 2
-#define SYSREG_MMUCR_S_OFFSET 4
-
-#define SR_INIT (SYSREG_BIT(GM) | SYSREG_BIT(EM) | SYSREG_BIT(M0))
-#define CPUCR_INIT (SYSREG_BIT(BI) | SYSREG_BIT(BE) \
- | SYSREG_BIT(FE) | SYSREG_BIT(RE) \
- | SYSREG_BIT(IBE) | SYSREG_BIT(IEE))
-
- .text
- .global _start
-_start:
- PART_SPECIFIC_BOOTSTRAP
-
- /* Reset the Status Register */
- mov r0, lo(SR_INIT)
- orh r0, hi(SR_INIT)
- mtsr SYSREG_SR, r0
-
- /* Reset CPUCR and invalidate the BTB */
- mov r2, CPUCR_INIT
- mtsr SYSREG_CPUCR, r2
-
- /* Flush the caches */
- mov r1, 0
- cache r1[4], 8
- cache r1[0], 0
- sync 0
-
- /* Reset the MMU to default settings */
- mov r0, SYSREG_BIT(MMUCR_S) | SYSREG_BIT(MMUCR_I)
- mtsr SYSREG_MMUCR, r0
-
- /* Internal RAM should not need any initialization. We might
- have to initialize external RAM here if the part doesn't
- have internal RAM (or we may use the data cache) */
-
- /* Jump to cacheable segment */
- lddpc pc, 1f
-
- .align 2
-1: .long 2f
-
-2: lddpc sp, sp_init
-
- /*
- * Relocate the data section and initialize .bss. Everything
- * is guaranteed to be at least doubleword aligned by the
- * linker script.
- */
- lddpc r12, .Ldata_vma
- lddpc r11, .Ldata_lma
- lddpc r10, .Ldata_end
- sub r10, r12
-4: ld.d r8, r11++
- sub r10, 8
- st.d r12++, r8
- brne 4b
-
- mov r8, 0
- mov r9, 0
- lddpc r10, .Lbss_end
- sub r10, r12
-4: sub r10, 8
- st.d r12++, r8
- brne 4b
-
- /* Initialize the GOT pointer */
- lddpc r6, got_init
-3: rsub r6, pc
- ld.w pc, r6[start_u_boot@got]
-
- .align 2
- .type sp_init,@object
-sp_init:
- .long CFG_INIT_SP_ADDR
-got_init:
- .long 3b - _GLOBAL_OFFSET_TABLE_
-.Ldata_lma:
- .long __data_lma
-.Ldata_vma:
- .long _data
-.Ldata_end:
- .long _edata
-.Lbss_end:
- .long _end
diff --git a/cpu/i386/Makefile b/cpu/i386/Makefile
deleted file mode 100644
index 50534b615b..0000000000
--- a/cpu/i386/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# (C) Copyright 2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# (C) Copyright 2002
-# Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o start16.o reset.o
-COBJS = serial.o interrupts.o cpu.o timer.o sc520.o
-SOBJS = sc520_asm.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/i386/config.mk b/cpu/i386/config.mk
deleted file mode 100644
index 16a160d2f3..0000000000
--- a/cpu/i386/config.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# (C) Copyright 2002
-# Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS +=
-
-PLATFORM_CPPFLAGS += -march=i386 -Werror
diff --git a/cpu/i386/cpu.c b/cpu/i386/cpu.c
deleted file mode 100644
index 5fd37c72a6..0000000000
--- a/cpu/i386/cpu.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * CPU specific code
- */
-
-#include <common.h>
-#include <command.h>
-
-int cpu_init(void)
-{
- /* initialize FPU, reset EM, set MP and NE */
- asm ("fninit\n" \
- "movl %cr0, %eax\n" \
- "andl $~0x4, %eax\n" \
- "orl $0x22, %eax\n" \
- "movl %eax, %cr0\n" );
-
- return 0;
-}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- printf ("resetting ...\n");
- udelay(50000); /* wait 50 ms */
- disable_interrupts();
- reset_cpu(0);
-
- /*NOTREACHED*/
- return 0;
-}
-
-void flush_cache (unsigned long dummy1, unsigned long dummy2)
-{
- asm("wbinvd\n");
- return;
-}
diff --git a/cpu/i386/interrupts.c b/cpu/i386/interrupts.c
deleted file mode 100644
index f340119900..0000000000
--- a/cpu/i386/interrupts.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <asm/io.h>
-#include <asm/i8259.h>
-#include <asm/ibmpc.h>
-
-
-struct idt_entry {
- u16 base_low;
- u16 selector;
- u8 res;
- u8 access;
- u16 base_high;
-} __attribute__ ((packed));
-
-
-struct idt_entry idt[256];
-
-
-#define MAX_IRQ 16
-
-typedef struct irq_handler {
- struct irq_handler *next;
- interrupt_handler_t* isr_func;
- void *isr_data;
-} irq_handler_t;
-
-#define IRQ_DISABLED 1
-
-typedef struct {
- irq_handler_t *handler;
- unsigned long status;
-} irq_desc_t;
-
-static irq_desc_t irq_table[MAX_IRQ];
-
-asm ("irq_return:\n"
- " addl $4, %esp\n"
- " popa\n"
- " iret\n");
-
-asm ("exp_return:\n"
- " addl $12, %esp\n"
- " pop %esp\n"
- " popa\n"
- " iret\n");
-
-char exception_stack[4096];
-
-#define DECLARE_INTERRUPT(x) \
- asm(".globl irq_"#x"\n" \
- "irq_"#x":\n" \
- "pusha \n" \
- "pushl $"#x"\n" \
- "pushl $irq_return\n" \
- "jmp do_irq\n"); \
- void __attribute__ ((regparm(0))) irq_##x(void)
-
-#define DECLARE_EXCEPTION(x, f) \
- asm(".globl exp_"#x"\n" \
- "exp_"#x":\n" \
- "pusha \n" \
- "movl %esp, %ebx\n" \
- "movl $exception_stack, %eax\n" \
- "movl %eax, %esp \n" \
- "pushl %ebx\n" \
- "movl 32(%esp), %ebx\n" \
- "xorl %edx, %edx\n" \
- "movw 36(%esp), %dx\n" \
- "pushl %edx\n" \
- "pushl %ebx\n" \
- "pushl $"#x"\n" \
- "pushl $exp_return\n" \
- "jmp "#f"\n"); \
- void __attribute__ ((regparm(0))) exp_##x(void)
-
-DECLARE_EXCEPTION(0, divide_exception_entry); /* Divide exception */
-DECLARE_EXCEPTION(1, debug_exception_entry); /* Debug exception */
-DECLARE_EXCEPTION(2, nmi_entry); /* NMI */
-DECLARE_EXCEPTION(3, unknown_exception_entry); /* Breakpoint/Coprocessor Error */
-DECLARE_EXCEPTION(4, unknown_exception_entry); /* Overflow */
-DECLARE_EXCEPTION(5, unknown_exception_entry); /* Bounds */
-DECLARE_EXCEPTION(6, invalid_instruction_entry); /* Invalid instruction */
-DECLARE_EXCEPTION(7, unknown_exception_entry); /* Device not present */
-DECLARE_EXCEPTION(8, double_fault_entry); /* Double fault */
-DECLARE_EXCEPTION(9, unknown_exception_entry); /* Co-processor segment overrun */
-DECLARE_EXCEPTION(10, invalid_tss_exception_entry);/* Invalid TSS */
-DECLARE_EXCEPTION(11, seg_fault_entry); /* Segment not present */
-DECLARE_EXCEPTION(12, stack_fault_entry); /* Stack overflow */
-DECLARE_EXCEPTION(13, gpf_entry); /* GPF */
-DECLARE_EXCEPTION(14, page_fault_entry); /* PF */
-DECLARE_EXCEPTION(15, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(16, fp_exception_entry); /* Floating point */
-DECLARE_EXCEPTION(17, alignment_check_entry); /* alignment check */
-DECLARE_EXCEPTION(18, machine_check_entry); /* machine check */
-DECLARE_EXCEPTION(19, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(20, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(21, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(22, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(23, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(24, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(25, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(26, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(27, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(28, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(29, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(30, unknown_exception_entry); /* Reserved */
-DECLARE_EXCEPTION(31, unknown_exception_entry); /* Reserved */
-
-DECLARE_INTERRUPT(0);
-DECLARE_INTERRUPT(1);
-DECLARE_INTERRUPT(3);
-DECLARE_INTERRUPT(4);
-DECLARE_INTERRUPT(5);
-DECLARE_INTERRUPT(6);
-DECLARE_INTERRUPT(7);
-DECLARE_INTERRUPT(8);
-DECLARE_INTERRUPT(9);
-DECLARE_INTERRUPT(10);
-DECLARE_INTERRUPT(11);
-DECLARE_INTERRUPT(12);
-DECLARE_INTERRUPT(13);
-DECLARE_INTERRUPT(14);
-DECLARE_INTERRUPT(15);
-
-void __attribute__ ((regparm(0))) default_isr(void);
-asm ("default_isr: iret\n");
-
-void disable_irq(int irq)
-{
- if (irq >= MAX_IRQ) {
- return;
- }
- irq_table[irq].status |= IRQ_DISABLED;
-
-}
-
-void enable_irq(int irq)
-{
- if (irq >= MAX_IRQ) {
- return;
- }
- irq_table[irq].status &= ~IRQ_DISABLED;
-}
-
-/* masks one specific IRQ in the PIC */
-static void unmask_irq(int irq)
-{
- int imr_port;
-
- if (irq >= MAX_IRQ) {
- return;
- }
- if (irq > 7) {
- imr_port = SLAVE_PIC + IMR;
- } else {
- imr_port = MASTER_PIC + IMR;
- }
-
- outb(inb(imr_port)&~(1<<(irq&7)), imr_port);
-}
-
-
-/* unmasks one specific IRQ in the PIC */
-static void mask_irq(int irq)
-{
- int imr_port;
-
- if (irq >= MAX_IRQ) {
- return;
- }
- if (irq > 7) {
- imr_port = SLAVE_PIC + IMR;
- } else {
- imr_port = MASTER_PIC + IMR;
- }
-
- outb(inb(imr_port)|(1<<(irq&7)), imr_port);
-}
-
-
-/* issue a Specific End Of Interrupt instruciton */
-static void specific_eoi(int irq)
-{
- /* If it is on the slave PIC this have to be performed on
- * both the master and the slave PICs */
- if (irq > 7) {
- outb(OCW2_SEOI|(irq&7), SLAVE_PIC + OCW2);
- irq = SEOI_IR2; /* also do IR2 on master */
- }
- outb(OCW2_SEOI|irq, MASTER_PIC + OCW2);
-}
-
-void __attribute__ ((regparm(0))) do_irq(int irq)
-{
-
- mask_irq(irq);
-
- if (irq_table[irq].status & IRQ_DISABLED) {
- unmask_irq(irq);
- specific_eoi(irq);
- return;
- }
-
-
- if (NULL != irq_table[irq].handler) {
- irq_handler_t *handler;
- for (handler = irq_table[irq].handler;
- NULL!= handler; handler = handler->next) {
- handler->isr_func(handler->isr_data);
- }
- } else {
- if ((irq & 7) != 7) {
- printf("Spurious irq %d\n", irq);
- }
- }
- unmask_irq(irq);
- specific_eoi(irq);
-}
-
-
-void __attribute__ ((regparm(0))) unknown_exception_entry(int cause, int ip, int seg)
-{
- printf("Unknown Exception %d at %04x:%08x\n", cause, seg, ip);
-}
-
-void __attribute__ ((regparm(0))) divide_exception_entry(int cause, int ip, int seg)
-{
- printf("Divide Error (Division by zero) at %04x:%08x\n", seg, ip);
- while(1);
-}
-
-void __attribute__ ((regparm(0))) debug_exception_entry(int cause, int ip, int seg)
-{
- printf("Debug Interrupt (Single step) at %04x:%08x\n", seg, ip);
-}
-
-void __attribute__ ((regparm(0))) nmi_entry(int cause, int ip, int seg)
-{
- printf("NMI Interrupt at %04x:%08x\n", seg, ip);
-}
-
-void __attribute__ ((regparm(0))) invalid_instruction_entry(int cause, int ip, int seg)
-{
- printf("Invalid Instruction at %04x:%08x\n", seg, ip);
- while(1);
-}
-
-void __attribute__ ((regparm(0))) double_fault_entry(int cause, int ip, int seg)
-{
- printf("Double fault at %04x:%08x\n", seg, ip);
- while(1);
-}
-
-void __attribute__ ((regparm(0))) invalid_tss_exception_entry(int cause, int ip, int seg)
-{
- printf("Invalid TSS at %04x:%08x\n", seg, ip);
-}
-
-void __attribute__ ((regparm(0))) seg_fault_entry(int cause, int ip, int seg)
-{
- printf("Segmentation fault at %04x:%08x\n", seg, ip);
- while(1);
-}
-
-void __attribute__ ((regparm(0))) stack_fault_entry(int cause, int ip, int seg)
-{
- printf("Stack fault at %04x:%08x\n", seg, ip);
- while(1);
-}
-
-void __attribute__ ((regparm(0))) gpf_entry(int cause, int ip, int seg)
-{
- printf("General protection fault at %04x:%08x\n", seg, ip);
-}
-
-void __attribute__ ((regparm(0))) page_fault_entry(int cause, int ip, int seg)
-{
- printf("Page fault at %04x:%08x\n", seg, ip);
- while(1);
-}
-
-void __attribute__ ((regparm(0))) fp_exception_entry(int cause, int ip, int seg)
-{
- printf("Floating point exception at %04x:%08x\n", seg, ip);
-}
-
-void __attribute__ ((regparm(0))) alignment_check_entry(int cause, int ip, int seg)
-{
- printf("Alignment check at %04x:%08x\n", seg, ip);
-}
-
-void __attribute__ ((regparm(0))) machine_check_entry(int cause, int ip, int seg)
-{
- printf("Machine check exception at %04x:%08x\n", seg, ip);
-}
-
-
-void irq_install_handler(int ino, interrupt_handler_t *func, void *pdata)
-{
- int status;
-
- if (ino>MAX_IRQ) {
- return;
- }
-
- if (NULL != irq_table[ino].handler) {
- return;
- }
-
- status = disable_interrupts();
- irq_table[ino].handler = malloc(sizeof(irq_handler_t));
- if (NULL == irq_table[ino].handler) {
- return;
- }
-
- memset(irq_table[ino].handler, 0, sizeof(irq_handler_t));
-
- irq_table[ino].handler->isr_func = func;
- irq_table[ino].handler->isr_data = pdata;
- if (status) {
- enable_interrupts();
- }
-
- unmask_irq(ino);
-
- return;
-}
-
-void irq_free_handler(int ino)
-{
- int status;
- if (ino>MAX_IRQ) {
- return;
- }
-
- status = disable_interrupts();
- mask_irq(ino);
- if (NULL == irq_table[ino].handler) {
- return;
- }
- free(irq_table[ino].handler);
- irq_table[ino].handler=NULL;
- if (status) {
- enable_interrupts();
- }
- return;
-}
-
-
-asm ("idt_ptr:\n"
- ".word 0x800\n" /* size of the table 8*256 bytes */
- ".long idt\n" /* offset */
- ".word 0x18\n");/* data segment */
-
-static void set_vector(int intnum, void *routine)
-{
- idt[intnum].base_high = (u16)((u32)(routine)>>16);
- idt[intnum].base_low = (u16)((u32)(routine)&0xffff);
-}
-
-
-int interrupt_init(void)
-{
- int i;
-
- /* Just in case... */
- disable_interrupts();
-
- /* Initialize the IDT and stuff */
-
-
- memset(irq_table, 0, sizeof(irq_table));
-
- /* Setup the IDT */
- for (i=0;i<256;i++) {
- idt[i].access = 0x8e;
- idt[i].res = 0;
- idt[i].selector = 0x10;
- set_vector(i, default_isr);
- }
-
- asm ("cs lidt idt_ptr\n");
-
- /* Setup exceptions */
- set_vector(0x00, exp_0);
- set_vector(0x01, exp_1);
- set_vector(0x02, exp_2);
- set_vector(0x03, exp_3);
- set_vector(0x04, exp_4);
- set_vector(0x05, exp_5);
- set_vector(0x06, exp_6);
- set_vector(0x07, exp_7);
- set_vector(0x08, exp_8);
- set_vector(0x09, exp_9);
- set_vector(0x0a, exp_10);
- set_vector(0x0b, exp_11);
- set_vector(0x0c, exp_12);
- set_vector(0x0d, exp_13);
- set_vector(0x0e, exp_14);
- set_vector(0x0f, exp_15);
- set_vector(0x10, exp_16);
- set_vector(0x11, exp_17);
- set_vector(0x12, exp_18);
- set_vector(0x13, exp_19);
- set_vector(0x14, exp_20);
- set_vector(0x15, exp_21);
- set_vector(0x16, exp_22);
- set_vector(0x17, exp_23);
- set_vector(0x18, exp_24);
- set_vector(0x19, exp_25);
- set_vector(0x1a, exp_26);
- set_vector(0x1b, exp_27);
- set_vector(0x1c, exp_28);
- set_vector(0x1d, exp_29);
- set_vector(0x1e, exp_30);
- set_vector(0x1f, exp_31);
-
-
- /* Setup interrupts */
- set_vector(0x20, irq_0);
- set_vector(0x21, irq_1);
- set_vector(0x23, irq_3);
- set_vector(0x24, irq_4);
- set_vector(0x25, irq_5);
- set_vector(0x26, irq_6);
- set_vector(0x27, irq_7);
- set_vector(0x28, irq_8);
- set_vector(0x29, irq_9);
- set_vector(0x2a, irq_10);
- set_vector(0x2b, irq_11);
- set_vector(0x2c, irq_12);
- set_vector(0x2d, irq_13);
- set_vector(0x2e, irq_14);
- set_vector(0x2f, irq_15);
- /* vectors 0x30-0x3f are reserved for irq 16-31 */
-
-
- /* Mask all interrupts */
- outb(0xff, MASTER_PIC + IMR);
- outb(0xff, SLAVE_PIC + IMR);
-
- /* Master PIC */
- outb(ICW1_SEL|ICW1_EICW4, MASTER_PIC + ICW1);
- outb(0x20, MASTER_PIC + ICW2); /* Place master PIC interrupts at INT20 */
- outb(IR2, MASTER_PIC + ICW3); /* ICW3, One slevc PIC is present */
- outb(ICW4_PM, MASTER_PIC + ICW4);
-
- for (i=0;i<8;i++) {
- outb(OCW2_SEOI|i, MASTER_PIC + OCW2);
- }
-
- /* Slave PIC */
- outb(ICW1_SEL|ICW1_EICW4, SLAVE_PIC + ICW1);
- outb(0x28, SLAVE_PIC + ICW2); /* Place slave PIC interrupts at INT28 */
- outb(0x02, SLAVE_PIC + ICW3); /* Slave ID */
- outb(ICW4_PM, SLAVE_PIC + ICW4);
-
- for (i=0;i<8;i++) {
- outb(OCW2_SEOI|i, SLAVE_PIC + OCW2);
- }
-
-
- /* enable cascade interrerupt */
- outb(0xfb, MASTER_PIC + IMR);
- outb(0xff, SLAVE_PIC + IMR);
-
- /* It is now safe to enable interrupts */
- enable_interrupts();
-
- return 0;
-}
-
-void enable_interrupts(void)
-{
- asm("sti\n");
-}
-
-int disable_interrupts(void)
-{
- long flags;
-
- asm volatile ("pushfl ; popl %0 ; cli\n" : "=g" (flags) : );
-
- return (flags&0x200); /* IE flags is bit 9 */
-}
-
-
-#ifdef CFG_RESET_GENERIC
-
-void __attribute__ ((regparm(0))) generate_gpf(void);
-asm(".globl generate_gpf\n"
- "generate_gpf:\n"
- "ljmp $0x70, $0x47114711\n"); /* segment 0x70 is an arbitrary segment which does not
- * exist */
-void reset_cpu(ulong addr)
-{
- set_vector(13, generate_gpf); /* general protection fault handler */
- set_vector(8, generate_gpf); /* double fault handler */
- generate_gpf(); /* start the show */
-}
-#endif
diff --git a/cpu/i386/reset.S b/cpu/i386/reset.S
deleted file mode 100644
index 07a7384927..0000000000
--- a/cpu/i386/reset.S
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * U-boot - i386 Startup Code
- *
- * Copyright (c) 2002 Omicron Ceti AB, Daniel Engström <denaiel@omicron.se>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* Reset vector, jumps to start16.S */
-
-.extern start16
-
-.section .reset, "ax"
-.code16
-reset_vector:
- cli
- cld
- jmp start16
-
- .org 0xf
- nop
diff --git a/cpu/i386/sc520.c b/cpu/i386/sc520.c
deleted file mode 100644
index d2b4e27f92..0000000000
--- a/cpu/i386/sc520.c
+++ /dev/null
@@ -1,481 +0,0 @@
-/*
- * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB <daniel@omicron.se>.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* stuff specific for the sc520,
- * but idependent of implementation */
-
-#include <config.h>
-
-#ifdef CONFIG_SC520
-
-#include <common.h>
-#include <config.h>
-#include <pci.h>
-#ifdef CONFIG_SC520_SSI
-#include <ssi.h>
-#endif
-#include <asm/io.h>
-#include <asm/pci.h>
-#include <asm/ic/sc520.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/*
- * utility functions for boards based on the AMD sc520
- *
- * void write_mmcr_byte(u16 mmcr, u8 data)
- * void write_mmcr_word(u16 mmcr, u16 data)
- * void write_mmcr_long(u16 mmcr, u32 data)
- *
- * u8 read_mmcr_byte(u16 mmcr)
- * u16 read_mmcr_word(u16 mmcr)
- * u32 read_mmcr_long(u16 mmcr)
- *
- * void init_sc520(void)
- * unsigned long init_sc520_dram(void)
- * void pci_sc520_init(struct pci_controller *hose)
- *
- * void reset_timer(void)
- * ulong get_timer(ulong base)
- * void set_timer(ulong t)
- * void udelay(unsigned long usec)
- *
- */
-
-static u32 mmcr_base= 0xfffef000;
-
-void write_mmcr_byte(u16 mmcr, u8 data)
-{
- writeb(data, mmcr+mmcr_base);
-}
-
-void write_mmcr_word(u16 mmcr, u16 data)
-{
- writew(data, mmcr+mmcr_base);
-}
-
-void write_mmcr_long(u16 mmcr, u32 data)
-{
- writel(data, mmcr+mmcr_base);
-}
-
-u8 read_mmcr_byte(u16 mmcr)
-{
- return readb(mmcr+mmcr_base);
-}
-
-u16 read_mmcr_word(u16 mmcr)
-{
- return readw(mmcr+mmcr_base);
-}
-
-u32 read_mmcr_long(u16 mmcr)
-{
- return readl(mmcr+mmcr_base);
-}
-
-
-void init_sc520(void)
-{
- /* Set the UARTxCTL register at it's slower,
- * baud clock giving us a 1.8432 MHz reference
- */
- write_mmcr_byte(SC520_UART1CTL, 7);
- write_mmcr_byte(SC520_UART2CTL, 7);
-
- /* first set the timer pin mapping */
- write_mmcr_byte(SC520_CLKSEL, 0x72); /* no clock frequency selected, use 1.1892MHz */
-
- /* enable PCI bus arbitrer */
- write_mmcr_byte(SC520_SYSARBCTL,0x02); /* enable concurrent mode */
-
- write_mmcr_word(SC520_SYSARBMENB,0x1f); /* enable external grants */
- write_mmcr_word(SC520_HBCTL,0x04); /* enable posted-writes */
-
-
- if (CFG_SC520_HIGH_SPEED) {
- write_mmcr_byte(SC520_CPUCTL, 0x2); /* set it to 133 MHz and write back */
- gd->cpu_clk = 133000000;
- printf("## CPU Speed set to 133MHz\n");
- } else {
- write_mmcr_byte(SC520_CPUCTL, 1); /* set CPU to 100 MHz and write back cache */
- printf("## CPU Speed set to 100MHz\n");
- gd->cpu_clk = 100000000;
- }
-
-
- /* wait at least one millisecond */
- asm("movl $0x2000,%%ecx\n"
- "wait_loop: pushl %%ecx\n"
- "popl %%ecx\n"
- "loop wait_loop\n": : : "ecx");
-
- /* turn on the SDRAM write buffer */
- write_mmcr_byte(SC520_DBCTL, 0x11);
-
- /* turn on the cache and disable write through */
- asm("movl %%cr0, %%eax\n"
- "andl $0x9fffffff, %%eax\n"
- "movl %%eax, %%cr0\n" : : : "eax");
-}
-
-unsigned long init_sc520_dram(void)
-{
- bd_t *bd = gd->bd;
-
- u32 dram_present=0;
- u32 dram_ctrl;
-#ifdef CFG_SDRAM_DRCTMCTL
- /* these memory control registers are set up in the assember part,
- * in sc520_asm.S, during 'mem_init'. If we muck with them here,
- * after we are running a stack in RAM, we have troubles. Besides,
- * these refresh and delay values are better ? simply specified
- * outright in the include/configs/{cfg} file since the HW designer
- * simply dictates it.
- */
-#else
- int val;
-
- int cas_precharge_delay = CFG_SDRAM_PRECHARGE_DELAY;
- int refresh_rate = CFG_SDRAM_REFRESH_RATE;
- int ras_cas_delay = CFG_SDRAM_RAS_CAS_DELAY;
-
- /* set SDRAM speed here */
-
- refresh_rate/=78;
- if (refresh_rate<=1) {
- val = 0; /* 7.8us */
- } else if (refresh_rate==2) {
- val = 1; /* 15.6us */
- } else if (refresh_rate==3 || refresh_rate==4) {
- val = 2; /* 31.2us */
- } else {
- val = 3; /* 62.4us */
- }
-
- write_mmcr_byte(SC520_DRCCTL, (read_mmcr_byte(SC520_DRCCTL) & 0xcf) | (val<<4));
-
- val = read_mmcr_byte(SC520_DRCTMCTL);
- val &= 0xf0;
-
- if (cas_precharge_delay==3) {
- val |= 0x04; /* 3T */
- } else if (cas_precharge_delay==4) {
- val |= 0x08; /* 4T */
- } else if (cas_precharge_delay>4) {
- val |= 0x0c;
- }
-
- if (ras_cas_delay > 3) {
- val |= 2;
- } else {
- val |= 1;
- }
- write_mmcr_byte(SC520_DRCTMCTL, val);
-#endif
-
- /* We read-back the configuration of the dram
- * controller that the assembly code wrote */
- dram_ctrl = read_mmcr_long(SC520_DRCBENDADR);
-
- bd->bi_dram[0].start = 0;
- if (dram_ctrl & 0x80) {
- /* bank 0 enabled */
- dram_present = bd->bi_dram[1].start = (dram_ctrl & 0x7f) << 22;
- bd->bi_dram[0].size = bd->bi_dram[1].start;
-
- } else {
- bd->bi_dram[0].size = 0;
- bd->bi_dram[1].start = bd->bi_dram[0].start;
- }
-
- if (dram_ctrl & 0x8000) {
- /* bank 1 enabled */
- dram_present = bd->bi_dram[2].start = (dram_ctrl & 0x7f00) << 14;
- bd->bi_dram[1].size = bd->bi_dram[2].start - bd->bi_dram[1].start;
- } else {
- bd->bi_dram[1].size = 0;
- bd->bi_dram[2].start = bd->bi_dram[1].start;
- }
-
- if (dram_ctrl & 0x800000) {
- /* bank 2 enabled */
- dram_present = bd->bi_dram[3].start = (dram_ctrl & 0x7f0000) << 6;
- bd->bi_dram[2].size = bd->bi_dram[3].start - bd->bi_dram[2].start;
- } else {
- bd->bi_dram[2].size = 0;
- bd->bi_dram[3].start = bd->bi_dram[2].start;
- }
-
- if (dram_ctrl & 0x80000000) {
- /* bank 3 enabled */
- dram_present = (dram_ctrl & 0x7f000000) >> 2;
- bd->bi_dram[3].size = dram_present - bd->bi_dram[3].start;
- } else {
- bd->bi_dram[3].size = 0;
- }
-
-
- gd->ram_size = dram_present;
-
- return dram_present;
-}
-
-
-#ifdef CONFIG_PCI
-
-
-static struct {
- u8 priority;
- u16 level_reg;
- u8 level_bit;
-} sc520_irq[] = {
- { SC520_IRQ0, SC520_MPICMODE, 0x01 },
- { SC520_IRQ1, SC520_MPICMODE, 0x02 },
- { SC520_IRQ2, SC520_SL1PICMODE, 0x02 },
- { SC520_IRQ3, SC520_MPICMODE, 0x08 },
- { SC520_IRQ4, SC520_MPICMODE, 0x10 },
- { SC520_IRQ5, SC520_MPICMODE, 0x20 },
- { SC520_IRQ6, SC520_MPICMODE, 0x40 },
- { SC520_IRQ7, SC520_MPICMODE, 0x80 },
-
- { SC520_IRQ8, SC520_SL1PICMODE, 0x01 },
- { SC520_IRQ9, SC520_SL1PICMODE, 0x02 },
- { SC520_IRQ10, SC520_SL1PICMODE, 0x04 },
- { SC520_IRQ11, SC520_SL1PICMODE, 0x08 },
- { SC520_IRQ12, SC520_SL1PICMODE, 0x10 },
- { SC520_IRQ13, SC520_SL1PICMODE, 0x20 },
- { SC520_IRQ14, SC520_SL1PICMODE, 0x40 },
- { SC520_IRQ15, SC520_SL1PICMODE, 0x80 }
-};
-
-
-/* The interrupt used for PCI INTA-INTD */
-int sc520_pci_ints[15] = {
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1
-};
-
-/* utility function to configure a pci interrupt */
-int pci_sc520_set_irq(int pci_pin, int irq)
-{
- int i;
-
- printf("set_irq(): map INT%c to IRQ%d\n", pci_pin + 'A', irq);
- if (irq < 0 || irq > 15) {
- return -1; /* illegal irq */
- }
-
- if (pci_pin < 0 || pci_pin > 15) {
- return -1; /* illegal pci int pin */
- }
-
- /* first disable any non-pci interrupt source that use
- * this level */
- for (i=SC520_GPTMR0MAP;i<=SC520_GP10IMAP;i++) {
- if (i>=SC520_PCIINTAMAP&&i<=SC520_PCIINTDMAP) {
- continue;
- }
- if (read_mmcr_byte(i) == sc520_irq[irq].priority) {
- write_mmcr_byte(i, SC520_IRQ_DISABLED);
- }
- }
-
- /* Set the trigger to level */
- write_mmcr_byte(sc520_irq[irq].level_reg,
- read_mmcr_byte(sc520_irq[irq].level_reg) | sc520_irq[irq].level_bit);
-
-
- if (pci_pin < 4) {
- /* PCI INTA-INTD */
- /* route the interrupt */
- write_mmcr_byte(SC520_PCIINTAMAP + pci_pin, sc520_irq[irq].priority);
-
-
- } else {
- /* GPIRQ0-GPIRQ10 used for additional PCI INTS */
- write_mmcr_byte(SC520_GP0IMAP + pci_pin - 4, sc520_irq[irq].priority);
-
- /* also set the polarity in this case */
- write_mmcr_word(SC520_INTPINPOL,
- read_mmcr_word(SC520_INTPINPOL) | (1 << (pci_pin-4)));
-
- }
-
- /* register the pin */
- sc520_pci_ints[pci_pin] = irq;
-
-
- return 0; /* OK */
-}
-
-void pci_sc520_init(struct pci_controller *hose)
-{
- hose->first_busno = 0;
- hose->last_busno = 0xff;
-
- /* System memory space */
- pci_set_region(hose->regions + 0,
- SC520_PCI_MEMORY_BUS,
- SC520_PCI_MEMORY_PHYS,
- SC520_PCI_MEMORY_SIZE,
- PCI_REGION_MEM | PCI_REGION_MEMORY);
-
- /* PCI memory space */
- pci_set_region(hose->regions + 1,
- SC520_PCI_MEM_BUS,
- SC520_PCI_MEM_PHYS,
- SC520_PCI_MEM_SIZE,
- PCI_REGION_MEM);
-
- /* ISA/PCI memory space */
- pci_set_region(hose->regions + 2,
- SC520_ISA_MEM_BUS,
- SC520_ISA_MEM_PHYS,
- SC520_ISA_MEM_SIZE,
- PCI_REGION_MEM);
-
- /* PCI I/O space */
- pci_set_region(hose->regions + 3,
- SC520_PCI_IO_BUS,
- SC520_PCI_IO_PHYS,
- SC520_PCI_IO_SIZE,
- PCI_REGION_IO);
-
- /* ISA/PCI I/O space */
- pci_set_region(hose->regions + 4,
- SC520_ISA_IO_BUS,
- SC520_ISA_IO_PHYS,
- SC520_ISA_IO_SIZE,
- PCI_REGION_IO);
-
- hose->region_count = 5;
-
- pci_setup_type1(hose,
- SC520_REG_ADDR,
- SC520_REG_DATA);
-
- pci_register_hose(hose);
-
- hose->last_busno = pci_hose_scan(hose);
-
- /* enable target memory acceses on host brige */
- pci_write_config_word(0, PCI_COMMAND,
- PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
-
-}
-
-
-#endif
-
-#ifdef CFG_TIMER_SC520
-
-
-void reset_timer(void)
-{
- write_mmcr_word(SC520_GPTMR0CNT, 0);
- write_mmcr_word(SC520_GPTMR0CTL, 0x6001);
-
-}
-
-ulong get_timer(ulong base)
-{
- /* fixme: 30 or 33 */
- return read_mmcr_word(SC520_GPTMR0CNT) / 33;
-}
-
-void set_timer(ulong t)
-{
- /* FixMe: use two cascade coupled timers */
- write_mmcr_word(SC520_GPTMR0CTL, 0x4001);
- write_mmcr_word(SC520_GPTMR0CNT, t*33);
- write_mmcr_word(SC520_GPTMR0CTL, 0x6001);
-}
-
-#endif
-
-int ssi_set_interface(int freq, int lsb_first, int inv_clock, int inv_phase)
-{
- u8 temp=0;
-
- if (freq >= 8192) {
- temp |= CTL_CLK_SEL_4;
- } else if (freq >= 4096) {
- temp |= CTL_CLK_SEL_8;
- } else if (freq >= 2048) {
- temp |= CTL_CLK_SEL_16;
- } else if (freq >= 1024) {
- temp |= CTL_CLK_SEL_32;
- } else if (freq >= 512) {
- temp |= CTL_CLK_SEL_64;
- } else if (freq >= 256) {
- temp |= CTL_CLK_SEL_128;
- } else if (freq >= 128) {
- temp |= CTL_CLK_SEL_256;
- } else {
- temp |= CTL_CLK_SEL_512;
- }
-
- if (!lsb_first) {
- temp |= MSBF_ENB;
- }
-
- if (inv_clock) {
- temp |= CLK_INV_ENB;
- }
-
- if (inv_phase) {
- temp |= PHS_INV_ENB;
- }
-
- write_mmcr_byte(SC520_SSICTL, temp);
-
- return 0;
-}
-
-u8 ssi_txrx_byte(u8 data)
-{
- write_mmcr_byte(SC520_SSIXMIT, data);
- while ((read_mmcr_byte(SC520_SSISTA)) & SSISTA_BSY);
- write_mmcr_byte(SC520_SSICMD, SSICMD_CMD_SEL_XMITRCV);
- while ((read_mmcr_byte(SC520_SSISTA)) & SSISTA_BSY);
- return read_mmcr_byte(SC520_SSIRCV);
-}
-
-
-void ssi_tx_byte(u8 data)
-{
- write_mmcr_byte(SC520_SSIXMIT, data);
- while ((read_mmcr_byte(SC520_SSISTA)) & SSISTA_BSY);
- write_mmcr_byte(SC520_SSICMD, SSICMD_CMD_SEL_XMIT);
-}
-
-u8 ssi_rx_byte(void)
-{
- while ((read_mmcr_byte(SC520_SSISTA)) & SSISTA_BSY);
- write_mmcr_byte(SC520_SSICMD, SSICMD_CMD_SEL_RCV);
- while ((read_mmcr_byte(SC520_SSISTA)) & SSISTA_BSY);
- return read_mmcr_byte(SC520_SSIRCV);
-}
-
-#endif /* CONFIG_SC520 */
diff --git a/cpu/i386/sc520_asm.S b/cpu/i386/sc520_asm.S
deleted file mode 100644
index 8fc713d93b..0000000000
--- a/cpu/i386/sc520_asm.S
+++ /dev/null
@@ -1,584 +0,0 @@
-/*
- * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB <daniel@omicron.se>.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* This file is largely based on code obtned from AMD. AMD's original
- * copyright is included below
- */
-
-/*
- * =============================================================================
- *
- * Copyright 1999 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this COPYRIGHT NOTICE is not removed or altered. All
- * other rights are reserved by AMD.
- *
- * THE MATERIALS ARE PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY
- * OF ANY KIND INCLUDING WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT OF
- * THIRD-PARTY INTELLECTUAL PROPERTY, OR FITNESS FOR ANY PARTICULAR PURPOSE.
- * IN NO EVENT SHALL AMD OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER
- * (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS
- * INTERRUPTION, LOSS OF INFORMAITON) ARISING OUT OF THE USE OF OR INABILITY
- * TO USE THE MATERIALS, EVEN IF AMD HAS BEEN ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGES. BECAUSE SOME JURSIDICTIONS PROHIBIT THE EXCLUSION OR
- * LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE
- * LIMITATION MAY NOT APPLY TO YOU.
- *
- * AMD does not assume any responsibility for any errors that may appear in
- * the Materials nor any responsibility to support or update the Materials.
- * AMD retains the right to make changes to its test specifications at any
- * time, without notice.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software back to AMD. Please include your name,
- * company, telephone number, AMD product requiring support and question or
- * problem encountered.
- *
- * Advanced Micro Devices, Inc. Worldwide support and contact
- * Embedded Processor Division information available at:
- * Systems Engineering epd.support@amd.com
- * 5204 E. Ben White Blvd. -or-
- * Austin, TX 78741 http://www.amd.com/html/support/techsup.html
- * ============================================================================
- */
-
-
-/*******************************************************************************
- * AUTHOR : Buddy Fey - Original.
- *******************************************************************************
- */
-
-
-/*******************************************************************************
- * FUNCTIONAL DESCRIPTION:
- * This routine is called to autodetect the geometry of the DRAM.
- *
- * This routine is called to determine the number of column bits for the DRAM
- * devices in this external bank. This routine assumes that the external bank
- * has been configured for an 11-bit column and for 4 internal banks. This gives
- * us the maximum address reach in memory. By writing a test value to the max
- * address and locating where it aliases to, we can determine the number of valid
- * column bits.
- *
- * This routine is called to determine the number of internal banks each DRAM
- * device has. The external bank (under test) is configured for maximum reach
- * with 11-bit columns and 4 internal banks. This routine will write to a max
- * address (BA1 and BA0 = 1) and then read from an address with BA1=0 to see if
- * that column is a "don't care". If BA1 does not affect write/read of data,
- * then this device has only 2 internal banks.
- *
- * This routine is called to determine the ending address for this external
- * bank of SDRAM. We write to a max address with a data value and then disable
- * row address bits looking for "don't care" locations. Each "don't care" bit
- * represents a dividing of the maximum density (128M) by 2. By dividing the
- * maximum of 32 4M chunks in an external bank down by all the "don't care" bits
- * determined during sizing, we set the proper density.
- *
- * WARNINGS.
- * bp must be preserved because it is used for return linkage.
- *
- * EXIT
- * nothing returned - but the memory subsystem is enabled
- *******************************************************************************
- */
-
-#include <config.h>
-#ifdef CONFIG_SC520
-
-.section .text
-.equ DRCCTL, 0x0fffef010 /* DRAM control register */
-.equ DRCTMCTL, 0x0fffef012 /* DRAM timing control register */
-.equ DRCCFG, 0x0fffef014 /* DRAM bank configuration register */
-.equ DRCBENDADR, 0x0fffef018 /* DRAM bank ending address register */
-.equ ECCCTL, 0x0fffef020 /* DRAM ECC control register */
-.equ ECCINT, 0x0fffefd18 /* DRAM ECC nmi-INT mapping */
-.equ DBCTL, 0x0fffef040 /* DRAM buffer control register */
-
-.equ CACHELINESZ, 0x00000010 /* size of our cache line (read buffer) */
-.equ COL11_ADR, 0x0e001e00 /* 11 col addrs */
-.equ COL10_ADR, 0x0e000e00 /* 10 col addrs */
-.equ COL09_ADR, 0x0e000600 /* 9 col addrs */
-.equ COL08_ADR, 0x0e000200 /* 8 col addrs */
-.equ ROW14_ADR, 0x0f000000 /* 14 row addrs */
-.equ ROW13_ADR, 0x07000000 /* 13 row addrs */
-.equ ROW12_ADR, 0x03000000 /* 12 row addrs */
-.equ ROW11_ADR, 0x01000000 /* 11 row addrs/also bank switch */
-.equ ROW10_ADR, 0x00000000 /* 10 row addrs/also bank switch */
-.equ COL11_DATA, 0x0b0b0b0b /* 11 col addrs */
-.equ COL10_DATA, 0x0a0a0a0a /* 10 col data */
-.equ COL09_DATA, 0x09090909 /* 9 col data */
-.equ COL08_DATA, 0x08080808 /* 8 col data */
-.equ ROW14_DATA, 0x3f3f3f3f /* 14 row data (MASK) */
-.equ ROW13_DATA, 0x1f1f1f1f /* 13 row data (MASK) */
-.equ ROW12_DATA, 0x0f0f0f0f /* 12 row data (MASK) */
-.equ ROW11_DATA, 0x07070707 /* 11 row data/also bank switch (MASK) */
-.equ ROW10_DATA, 0xaaaaaaaa /* 10 row data/also bank switch (MASK) */
-
-
- /*
- * initialize dram controller registers
- */
-.globl mem_init
-mem_init:
- xorw %ax,%ax
- movl $DBCTL, %edi
- movb %al, (%edi) /* disable write buffer */
-
- movl $ECCCTL, %edi
- movb %al, (%edi) /* disable ECC */
-
- movl $DRCTMCTL, %edi
- movb $0x1E,%al /* Set SDRAM timing for slowest */
- movb %al, (%edi)
-
- /*
- * setup loop to do 4 external banks starting with bank 3
- */
- movl $0xff000000,%eax /* enable last bank and setup */
- movl $DRCBENDADR, %edi /* ending address register */
- movl %eax, (%edi)
-
- movl $DRCCFG, %edi /* setup */
- movw $0xbbbb,%ax /* dram config register for */
- movw %ax, (%edi)
-
- /*
- * issue a NOP to all DRAMs
- */
- movl $DRCCTL, %edi /* setup DRAM control register with */
- movb $0x1,%al /* Disable refresh,disable write buffer */
- movb %al, (%edi)
- movl $CACHELINESZ, %esi /* just a dummy address to write for */
- movw %ax, (%esi)
- /*
- * delay for 100 usec? 200?
- * ******this is a cludge for now *************
- */
- movw $100,%cx
-sizdelay:
- loop sizdelay /* we need 100 usec here */
- /***********************************************/
-
- /*
- * issue all banks precharge
- */
- movb $0x2,%al /* All banks precharge */
- movb %al, (%edi)
- movw %ax, (%esi)
-
- /*
- * issue 2 auto refreshes to all banks
- */
- movb $0x4,%al /* Auto refresh cmd */
- movb %al, (%edi)
- movw $2,%cx
-refresh1:
- movw %ax, (%esi)
- loop refresh1
-
- /*
- * issue LOAD MODE REGISTER command
- */
- movb $0x3,%al /* Load mode register cmd */
- movb %al, (%edi)
- movw %ax, (%esi)
-
- /*
- * issue 8 more auto refreshes to all banks
- */
- movb $0x4,%al /* Auto refresh cmd */
- movb %al, (%edi)
- movw $8,%cx
-refresh2:
- movw %ax, (%esi)
- loop refresh2
-
- /*
- * set control register to NORMAL mode
- */
- movb $0x0,%al /* Normal mode value */
- movb %al, (%edi)
-
- /*
- * size dram starting with external bank 3 moving to external bank 0
- */
- movl $0x3,%ecx /* start with external bank 3 */
-
-nextbank:
-
- /*
- * write col 11 wrap adr
- */
- movl $COL11_ADR, %esi /* set address to max col (11) wrap addr */
- movl $COL11_DATA, %eax /* pattern for max supported columns(11) */
- movl %eax, (%esi) /* write max col pattern at max col adr */
- movl (%esi), %ebx /* optional read */
- cmpl %ebx,%eax /* to verify write */
- jnz bad_ram /* this ram is bad */
- /*
- * write col 10 wrap adr
- */
-
- movl $COL10_ADR, %esi /* set address to 10 col wrap address */
- movl $COL10_DATA, %eax /* pattern for 10 col wrap */
- movl %eax, (%esi) /* write 10 col pattern @ 10 col wrap adr */
- movl (%esi), %ebx /* optional read */
- cmpl %ebx,%eax /* to verify write */
- jnz bad_ram /* this ram is bad */
- /*
- * write col 9 wrap adr
- */
- movl $COL09_ADR, %esi /* set address to 9 col wrap address */
- movl $COL09_DATA, %eax /* pattern for 9 col wrap */
- movl %eax, (%esi) /* write 9 col pattern @ 9 col wrap adr */
- movl (%esi), %ebx /* optional read */
- cmpl %ebx,%eax /* to verify write */
- jnz bad_ram /* this ram is bad */
- /*
- * write col 8 wrap adr
- */
- movl $COL08_ADR, %esi /* set address to min(8) col wrap address */
- movl $COL08_DATA, %eax /* pattern for min (8) col wrap */
- movl %eax, (%esi) /* write min col pattern @ min col adr */
- movl (%esi), %ebx /* optional read */
- cmpl %ebx,%eax /* to verify write */
- jnz bad_ram /* this ram is bad */
- /*
- * write row 14 wrap adr
- */
- movl $ROW14_ADR, %esi /* set address to max row (14) wrap addr */
- movl $ROW14_DATA, %eax /* pattern for max supported rows(14) */
- movl %eax, (%esi) /* write max row pattern at max row adr */
- movl (%esi), %ebx /* optional read */
- cmpl %ebx,%eax /* to verify write */
- jnz bad_ram /* this ram is bad */
- /*
- * write row 13 wrap adr
- */
- movl $ROW13_ADR, %esi /* set address to 13 row wrap address */
- movl $ROW13_DATA, %eax /* pattern for 13 row wrap */
- movl %eax, (%esi) /* write 13 row pattern @ 13 row wrap adr */
- movl (%esi), %ebx /* optional read */
- cmpl %ebx,%eax /* to verify write */
- jnz bad_ram /* this ram is bad */
- /*
- * write row 12 wrap adr
- */
- movl $ROW12_ADR, %esi /* set address to 12 row wrap address */
- movl $ROW12_DATA, %eax /* pattern for 12 row wrap */
- movl %eax, (%esi) /* write 12 row pattern @ 12 row wrap adr */
- movl (%esi), %ebx /* optional read */
- cmpl %ebx,%eax /* to verify write */
- jnz bad_ram /* this ram is bad */
- /*
- * write row 11 wrap adr
- */
- movl $ROW11_ADR, %edi /* set address to 11 row wrap address */
- movl $ROW11_DATA, %eax /* pattern for 11 row wrap */
- movl %eax, (%edi) /* write 11 row pattern @ 11 row wrap adr */
- movl (%edi), %ebx /* optional read */
- cmpl %ebx,%eax /* to verify write */
- jnz bad_ram /* this ram is bad */
- /*
- * write row 10 wrap adr --- this write is really to determine number of banks
- */
- movl $ROW10_ADR, %edi /* set address to 10 row wrap address */
- movl $ROW10_DATA, %eax /* pattern for 10 row wrap (AA) */
- movl %eax, (%edi) /* write 10 row pattern @ 10 row wrap adr */
- movl (%edi), %ebx /* optional read */
- cmpl %ebx,%eax /* to verify write */
- jnz bad_ram /* this ram is bad */
- /*
- * read data @ row 12 wrap adr to determine * banks,
- * and read data @ row 14 wrap adr to determine * rows.
- * if data @ row 12 wrap adr is not AA, 11 or 12 we have bad RAM.
- * if data @ row 12 wrap == AA, we only have 2 banks, NOT 4
- * if data @ row 12 wrap == 11 or 12, we have 4 banks,
- */
- xorw %di,%di /* value for 2 banks in DI */
- movl (%esi), %ebx /* read from 12 row wrap to check banks
- * (esi is setup from the write to row 12 wrap) */
- cmpl %ebx,%eax /* check for AA pattern (eax holds the aa pattern) */
- jz only2 /* if pattern == AA, we only have 2 banks */
-
- /* 4 banks */
-
- movw $8,%di /* value for 4 banks in DI (BNK_CNT bit) */
- cmpl $ROW11_DATA, %ebx /* only other legitimate values are 11 */
- jz only2
- cmpl $ROW12_DATA, %ebx /* and 12 */
- jnz bad_ram /* its bad if not 11 or 12! */
-
- /* fall through */
-only2:
- /*
- * validate row mask
- */
- movl $ROW14_ADR, %esi /* set address back to max row wrap addr */
- movl (%esi), %eax /* read actual number of rows @ row14 adr */
-
- cmpl $ROW11_DATA, %eax /* row must be greater than 11 pattern */
- jb bad_ram
-
- cmpl $ROW14_DATA, %eax /* and row must be less than 14 pattern */
- ja bad_ram
-
- cmpb %ah,%al /* verify all 4 bytes of dword same */
- jnz bad_ram
- movl %eax,%ebx
- shrl $16,%ebx
- cmpw %bx,%ax
- jnz bad_ram
- /*
- * read col 11 wrap adr for real column data value
- */
- movl $COL11_ADR, %esi /* set address to max col (11) wrap addr */
- movl (%esi), %eax /* read real col number at max col adr */
- /*
- * validate column data
- */
- cmpl $COL08_DATA, %eax /* col must be greater than 8 pattern */
- jb bad_ram
-
- cmpl $COL11_DATA, %eax /* and row must be less than 11 pattern */
- ja bad_ram
-
- subl $COL08_DATA, %eax /* normalize column data to zero */
- jc bad_ram
- cmpb %ah,%al /* verify all 4 bytes of dword equal */
- jnz bad_ram
- movl %eax,%edx
- shrl $16,%edx
- cmpw %dx,%ax
- jnz bad_ram
- /*
- * merge bank and col data together
- */
- addw %di,%dx /* merge of bank and col info in dl */
- /*
- * fix ending addr mask based upon col info
- */
- movb $3,%al
- subb %dh,%al /* dh contains the overflow from the bank/col merge */
- movb %bl,%dh /* bl contains the row mask (aa, 07, 0f, 1f or 3f) */
- xchgw %cx,%ax /* cx = ax = 3 or 2 depending on 2 or 4 bank device */
- shrb %cl,%dh /* */
- incb %dh /* ending addr is 1 greater than real end */
- xchgw %cx,%ax /* cx is bank number again */
- /*
- * issue all banks precharge
- */
-bad_reint:
- movl $DRCCTL, %esi /* setup DRAM control register with */
- movb $0x2,%al /* All banks precharge */
- movb %al, (%esi)
- movl $CACHELINESZ, %esi /* address to init read buffer */
- movw %ax, (%esi)
-
- /*
- * update ENDING ADDRESS REGISTER
- */
- movl $DRCBENDADR, %edi /* DRAM ending address register */
- movl %ecx,%ebx
- addl %ebx, %edi
- movb %dh, (%edi)
- /*
- * update CONFIG REGISTER
- */
- xorb %dh,%dh
- movw $0x00f,%bx
- movw %cx,%ax
- shlw $2,%ax
- xchgw %cx,%ax
- shlw %cl,%dx
- shlw %cl,%bx
- notw %bx
- xchgw %cx,%ax
- movl $DRCCFG, %edi
- mov (%edi), %ax
- andw %bx,%ax
- orw %dx,%ax
- movw %ax, (%edi)
- jcxz cleanup
-
- decw %cx
- movl %ecx,%ebx
- movl $DRCBENDADR, %edi /* DRAM ending address register */
- movb $0xff,%al
- addl %ebx, %edi
- movb %al, (%edi)
- /*
- * set control register to NORMAL mode
- */
- movl $DRCCTL, %esi /* setup DRAM control register with */
- movb $0x0,%al /* Normal mode value */
- movb %al, (%esi)
- movl $CACHELINESZ, %esi /* address to init read buffer */
- movw %ax, (%esi)
- jmp nextbank
-
-cleanup:
- movl $DRCBENDADR, %edi /* DRAM ending address register */
- movw $4,%cx
- xorw %ax,%ax
-cleanuplp:
- movb (%edi), %al
- orb %al,%al
- jz emptybank
-
- addb %ah,%al
- jns nottoomuch
-
- movb $0x7f,%al
-nottoomuch:
- movb %al,%ah
- orb $0x80,%al
- movb %al, (%edi)
-emptybank:
- incl %edi
- loop cleanuplp
-
-#if defined CFG_SDRAM_DRCTMCTL
- /* just have your hardware desinger _GIVE_ you what you need here! */
- movl $DRCTMCTL, %edi
- movb $CFG_SDRAM_DRCTMCTL,%al
- movb (%edi), %al
-#else
-#if defined(CFG_SDRAM_CAS_LATENCY_2T) || defined(CFG_SDRAM_CAS_LATENCY_3T)
- /* set the CAS latency now since it is hard to do
- * when we run from the RAM */
- movl $DRCTMCTL, %edi /* DRAM timing register */
- movb (%edi), %al
-#ifdef CFG_SDRAM_CAS_LATENCY_2T
- andb $0xef, %al
-#endif
-#ifdef CFG_SDRAM_CAS_LATENCY_3T
- orb $0x10, %al
-#endif
- movb %al, (%edi)
-#endif
-#endif
- movl $DRCCTL, %edi /* DRAM Control register */
- movb $0x3,%al /* Load mode register cmd */
- movb %al, (%edi)
- movw %ax, (%esi)
-
-
- movl $DRCCTL, %edi /* DRAM Control register */
- movb $0x18,%al /* Enable refresh and NORMAL mode */
- movb %al, (%edi)
-
- jmp dram_done
-
-bad_ram:
- xorl %edx,%edx
- xorl %edi,%edi
- jmp bad_reint
-
-dram_done:
-
- /* readback DRCBENDADR and return the number
- * of available ram bytes in %eax */
-
- movl $DRCBENDADR, %edi /* DRAM ending address register */
-
- movl (%edi), %eax
- movl %eax, %ecx
- andl $0x80000000, %ecx
- jz bank2
- andl $0x7f000000, %eax
- shrl $2, %eax
- movl %eax, %ebx
-
-bank2: movl (%edi), %eax
- movl %eax, %ecx
- andl $0x00800000, %ecx
- jz bank1
- andl $0x007f0000, %eax
- shll $6, %eax
- movl %eax, %ebx
-
-bank1: movl (%edi), %eax
- movl %eax, %ecx
- andl $0x00008000, %ecx
- jz bank0
- andl $0x00007f00, %eax
- shll $14, %eax
- movl %eax, %ebx
-
-bank0: movl (%edi), %eax
- movl %eax, %ecx
- andl $0x00000080, %ecx
- jz done
- andl $0x0000007f, %eax
- shll $22, %eax
- movl %eax, %ebx
-
-
-done:
- movl %ebx, %eax
-
-#if CFG_SDRAM_ECC_ENABLE
- /* A nominal memory test: just a byte at each address line */
- movl %eax, %ecx
- shrl $0x1, %ecx
- movl $0x1, %edi
-memtest0:
- movb $0xa5, (%edi)
- cmpb $0xa5, (%edi)
- jne out
- shrl $1, %ecx
- andl %ecx,%ecx
- jz set_ecc
- shll $1, %edi
- jmp memtest0
-
-set_ecc:
- /* clear all ram with a memset */
- movl %eax, %ecx
- xorl %esi, %esi
- xorl %edi, %edi
- xorl %eax, %eax
- shrl $2, %ecx
- cld
- rep stosl
- /* enable read, write buffers */
- movb $0x11, %al
- movl $DBCTL, %edi
- movb %al, (%edi)
- /* enable NMI mapping for ECC */
- movl $ECCINT, %edi
- mov $0x10, %al
- movb %al, (%edi)
- /* Turn on ECC */
- movl $ECCCTL, %edi
- mov $0x05, %al
- movb %al, (%edi)
-#endif
-out:
- movl %ebx, %eax
- jmp *%ebp
-
-#endif /* CONFIG_SC520 */
diff --git a/cpu/i386/serial.c b/cpu/i386/serial.c
deleted file mode 100644
index e7299a7ebb..0000000000
--- a/cpu/i386/serial.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/*
- * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-/*------------------------------------------------------------------------------+ */
-
-/*
- * This source code has been made available to you by IBM on an AS-IS
- * basis. Anyone receiving this source is licensed under IBM
- * copyrights to use it in any way he or she deems fit, including
- * copying it, modifying it, compiling it, and redistributing it either
- * with or without modifications. No license under IBM patents or
- * patent applications is to be implied by the copyright license.
- *
- * Any user of this software should understand that IBM cannot provide
- * technical support for this software and will not be responsible for
- * any consequences resulting from the use of this software.
- *
- * Any person who transfers this source code or any derivative work
- * must include the IBM copyright notice, this paragraph, and the
- * preceding two paragraphs in the transferred software.
- *
- * COPYRIGHT I B M CORPORATION 1995
- * LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
- */
-/*------------------------------------------------------------------------------- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <asm/io.h>
-#include <asm/ibmpc.h>
-
-#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
-#include <malloc.h>
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define UART_RBR 0x00
-#define UART_THR 0x00
-#define UART_IER 0x01
-#define UART_IIR 0x02
-#define UART_FCR 0x02
-#define UART_LCR 0x03
-#define UART_MCR 0x04
-#define UART_LSR 0x05
-#define UART_MSR 0x06
-#define UART_SCR 0x07
-#define UART_DLL 0x00
-#define UART_DLM 0x01
-
-/*-----------------------------------------------------------------------------+
- | Line Status Register.
- +-----------------------------------------------------------------------------*/
-#define asyncLSRDataReady1 0x01
-#define asyncLSROverrunError1 0x02
-#define asyncLSRParityError1 0x04
-#define asyncLSRFramingError1 0x08
-#define asyncLSRBreakInterrupt1 0x10
-#define asyncLSRTxHoldEmpty1 0x20
-#define asyncLSRTxShiftEmpty1 0x40
-#define asyncLSRRxFifoError1 0x80
-
-
-#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
-/*-----------------------------------------------------------------------------+
- | Fifo
- +-----------------------------------------------------------------------------*/
-typedef struct {
- char *rx_buffer;
- ulong rx_put;
- ulong rx_get;
- int cts;
-} serial_buffer_t;
-
-volatile serial_buffer_t buf_info;
-static int serial_buffer_active=0;
-#endif
-
-
-static int serial_div(int baudrate)
-{
-
- switch (baudrate) {
- case 1200:
- return 96;
- case 9600:
- return 12;
- case 19200:
- return 6;
- case 38400:
- return 3;
- case 57600:
- return 2;
- case 115200:
- return 1;
- }
-
- return 12;
-}
-
-
-/*
- * Minimal serial functions needed to use one of the SMC ports
- * as serial console interface.
- */
-
-int serial_init(void)
-{
- volatile char val;
- int bdiv = serial_div(gd->baudrate);
-
- outb(0x80, UART0_BASE + UART_LCR); /* set DLAB bit */
- outb(bdiv, UART0_BASE + UART_DLL); /* set baudrate divisor */
- outb(bdiv >> 8, UART0_BASE + UART_DLM);/* set baudrate divisor */
- outb(0x03, UART0_BASE + UART_LCR); /* clear DLAB; set 8 bits, no parity */
- outb(0x01, UART0_BASE + UART_FCR); /* enable FIFO */
- outb(0x0b, UART0_BASE + UART_MCR); /* Set DTR and RTS active */
- val = inb(UART0_BASE + UART_LSR); /* clear line status */
- val = inb(UART0_BASE + UART_RBR); /* read receive buffer */
- outb(0x00, UART0_BASE + UART_SCR); /* set scratchpad */
- outb(0x00, UART0_BASE + UART_IER); /* set interrupt enable reg */
-
- return 0;
-}
-
-
-void serial_setbrg(void)
-{
- unsigned short bdiv;
-
- bdiv = serial_div(gd->baudrate);
-
- outb(0x80, UART0_BASE + UART_LCR); /* set DLAB bit */
- outb(bdiv&0xff, UART0_BASE + UART_DLL); /* set baudrate divisor */
- outb(bdiv >> 8, UART0_BASE + UART_DLM);/* set baudrate divisor */
- outb(0x03, UART0_BASE + UART_LCR); /* clear DLAB; set 8 bits, no parity */
-}
-
-
-void serial_putc(const char c)
-{
- int i;
-
- if (c == '\n')
- serial_putc ('\r');
-
- /* check THRE bit, wait for transmiter available */
- for (i = 1; i < 3500; i++) {
- if ((inb (UART0_BASE + UART_LSR) & 0x20) == 0x20) {
- break;
- }
- udelay(100);
- }
- outb(c, UART0_BASE + UART_THR); /* put character out */
-}
-
-
-void serial_puts(const char *s)
-{
- while (*s) {
- serial_putc(*s++);
- }
-}
-
-
-int serial_getc(void)
-{
- unsigned char status = 0;
-
-#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
- if (serial_buffer_active) {
- return serial_buffered_getc();
- }
-#endif
-
- while (1) {
-#if defined(CONFIG_HW_WATCHDOG)
- WATCHDOG_RESET(); /* Reset HW Watchdog, if needed */
-#endif /* CONFIG_HW_WATCHDOG */
- status = inb(UART0_BASE + UART_LSR);
- if ((status & asyncLSRDataReady1) != 0x0) {
- break;
- }
- if ((status & ( asyncLSRFramingError1 |
- asyncLSROverrunError1 |
- asyncLSRParityError1 |
- asyncLSRBreakInterrupt1 )) != 0) {
- outb(asyncLSRFramingError1 |
- asyncLSROverrunError1 |
- asyncLSRParityError1 |
- asyncLSRBreakInterrupt1, UART0_BASE + UART_LSR);
- }
- }
- return (0x000000ff & (int) inb (UART0_BASE));
-}
-
-
-int serial_tstc(void)
-{
- unsigned char status;
-
-#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
- if (serial_buffer_active) {
- return serial_buffered_tstc();
- }
-#endif
-
- status = inb(UART0_BASE + UART_LSR);
- if ((status & asyncLSRDataReady1) != 0x0) {
- return (1);
- }
- if ((status & ( asyncLSRFramingError1 |
- asyncLSROverrunError1 |
- asyncLSRParityError1 |
- asyncLSRBreakInterrupt1 )) != 0) {
- outb(asyncLSRFramingError1 |
- asyncLSROverrunError1 |
- asyncLSRParityError1 |
- asyncLSRBreakInterrupt1, UART0_BASE + UART_LSR);
- }
- return 0;
-}
-
-
-#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
-
-void serial_isr(void *arg)
-{
- int space;
- int c;
- int rx_put = buf_info.rx_put;
-
- if (buf_info.rx_get <= rx_put) {
- space = CONFIG_SERIAL_SOFTWARE_FIFO - (rx_put - buf_info.rx_get);
- } else {
- space = buf_info.rx_get - rx_put;
- }
-
- while (inb(UART0_BASE + UART_LSR) & 1) {
- c = inb(UART0_BASE);
- if (space) {
- buf_info.rx_buffer[rx_put++] = c;
- space--;
-
- if (rx_put == buf_info.rx_get) {
- buf_info.rx_get++;
- if (rx_put == CONFIG_SERIAL_SOFTWARE_FIFO) {
- buf_info.rx_get = 0;
- }
- }
-
- if (rx_put == CONFIG_SERIAL_SOFTWARE_FIFO) {
- rx_put = 0;
- if (0 == buf_info.rx_get) {
- buf_info.rx_get = 1;
- }
-
- }
-
- }
- if (space < CONFIG_SERIAL_SOFTWARE_FIFO / 4) {
- /* Stop flow by setting RTS inactive */
- outb(inb(UART0_BASE + UART_MCR) & (0xFF ^ 0x02),
- UART0_BASE + UART_MCR);
- }
- }
- buf_info.rx_put = rx_put;
-}
-
-void serial_buffered_init(void)
-{
- serial_puts ("Switching to interrupt driven serial input mode.\n");
- buf_info.rx_buffer = malloc (CONFIG_SERIAL_SOFTWARE_FIFO);
- buf_info.rx_put = 0;
- buf_info.rx_get = 0;
-
- if (inb (UART0_BASE + UART_MSR) & 0x10) {
- serial_puts ("Check CTS signal present on serial port: OK.\n");
- buf_info.cts = 1;
- } else {
- serial_puts ("WARNING: CTS signal not present on serial port.\n");
- buf_info.cts = 0;
- }
-
- irq_install_handler ( VECNUM_U0 /*UART0 */ /*int vec */ ,
- serial_isr /*interrupt_handler_t *handler */ ,
- (void *) &buf_info /*void *arg */ );
-
- /* Enable "RX Data Available" Interrupt on UART */
- /* outb(inb(UART0_BASE + UART_IER) |0x01, UART0_BASE + UART_IER); */
- outb(0x01, UART0_BASE + UART_IER);
-
- /* Set DTR and RTS active, enable interrupts */
- outb(inb (UART0_BASE + UART_MCR) | 0x0b, UART0_BASE + UART_MCR);
-
- /* Setup UART FIFO: RX trigger level: 1 byte, Enable FIFO */
- outb( /*(1 << 6) |*/ 1, UART0_BASE + UART_FCR);
-
- serial_buffer_active = 1;
-}
-
-void serial_buffered_putc (const char c)
-{
- int i;
- /* Wait for CTS */
-#if defined(CONFIG_HW_WATCHDOG)
- while (!(inb (UART0_BASE + UART_MSR) & 0x10))
- WATCHDOG_RESET ();
-#else
- if (buf_info.cts) {
- for (i=0;i<1000;i++) {
- if ((inb (UART0_BASE + UART_MSR) & 0x10)) {
- break;
- }
- }
- if (i!=1000) {
- buf_info.cts = 0;
- }
- } else {
- if ((inb (UART0_BASE + UART_MSR) & 0x10)) {
- buf_info.cts = 1;
- }
- }
-
-#endif
- serial_putc (c);
-}
-
-void serial_buffered_puts(const char *s)
-{
- serial_puts (s);
-}
-
-int serial_buffered_getc(void)
-{
- int space;
- int c;
- int rx_get = buf_info.rx_get;
- int rx_put;
-
-#if defined(CONFIG_HW_WATCHDOG)
- while (rx_get == buf_info.rx_put)
- WATCHDOG_RESET ();
-#else
- while (rx_get == buf_info.rx_put);
-#endif
- c = buf_info.rx_buffer[rx_get++];
- if (rx_get == CONFIG_SERIAL_SOFTWARE_FIFO) {
- rx_get = 0;
- }
- buf_info.rx_get = rx_get;
-
- rx_put = buf_info.rx_put;
- if (rx_get <= rx_put) {
- space = CONFIG_SERIAL_SOFTWARE_FIFO - (rx_put - rx_get);
- } else {
- space = rx_get - rx_put;
- }
- if (space > CONFIG_SERIAL_SOFTWARE_FIFO / 2) {
- /* Start flow by setting RTS active */
- outb(inb (UART0_BASE + UART_MCR) | 0x02, UART0_BASE + UART_MCR);
- }
-
- return c;
-}
-
-int serial_buffered_tstc(void)
-{
- return (buf_info.rx_get != buf_info.rx_put) ? 1 : 0;
-}
-
-#endif /* CONFIG_SERIAL_SOFTWARE_FIFO */
-
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-/*
- AS HARNOIS : according to CONFIG_KGDB_SER_INDEX kgdb uses serial port
- number 0 or number 1
- - if CONFIG_KGDB_SER_INDEX = 1 => serial port number 0 :
- configuration has been already done
- - if CONFIG_KGDB_SER_INDEX = 2 => serial port number 1 :
- configure port 1 for serial I/O with rate = CONFIG_KGDB_BAUDRATE
-*/
-#if (CONFIG_KGDB_SER_INDEX & 2)
-void kgdb_serial_init(void)
-{
- volatile char val;
- bdiv = serial_div (CONFIG_KGDB_BAUDRATE);
-
- /*
- * Init onboard 16550 UART
- */
- outb(0x80, UART1_BASE + UART_LCR); /* set DLAB bit */
- outb(bdiv & 0xff), UART1_BASE + UART_DLL); /* set divisor for 9600 baud */
- outb(bdiv >> 8), UART1_BASE + UART_DLM); /* set divisor for 9600 baud */
- outb(0x03, UART1_BASE + UART_LCR); /* line control 8 bits no parity */
- outb(0x00, UART1_BASE + UART_FCR); /* disable FIFO */
- outb(0x00, UART1_BASE + UART_MCR); /* no modem control DTR RTS */
- val = inb(UART1_BASE + UART_LSR); /* clear line status */
- val = inb(UART1_BASE + UART_RBR); /* read receive buffer */
- outb(0x00, UART1_BASE + UART_SCR); /* set scratchpad */
- outb(0x00, UART1_BASE + UART_IER); /* set interrupt enable reg */
-}
-
-
-void putDebugChar(const char c)
-{
- if (c == '\n')
- serial_putc ('\r');
-
- outb(c, UART1_BASE + UART_THR); /* put character out */
-
- /* check THRE bit, wait for transfer done */
- while ((inb(UART1_BASE + UART_LSR) & 0x20) != 0x20);
-}
-
-
-void putDebugStr(const char *s)
-{
- while (*s) {
- serial_putc(*s++);
- }
-}
-
-
-int getDebugChar(void)
-{
- unsigned char status = 0;
-
- while (1) {
- status = inb(UART1_BASE + UART_LSR);
- if ((status & asyncLSRDataReady1) != 0x0) {
- break;
- }
- if ((status & ( asyncLSRFramingError1 |
- asyncLSROverrunError1 |
- asyncLSRParityError1 |
- asyncLSRBreakInterrupt1 )) != 0) {
- outb(asyncLSRFramingError1 |
- asyncLSROverrunError1 |
- asyncLSRParityError1 |
- asyncLSRBreakInterrupt1, UART1_BASE + UART_LSR);
- }
- }
- return (0x000000ff & (int) inb(UART1_BASE));
-}
-
-
-void kgdb_interruptible(int yes)
-{
- return;
-}
-
-#else /* ! (CONFIG_KGDB_SER_INDEX & 2) */
-
-void kgdb_serial_init(void)
-{
- serial_printf ("[on serial] ");
-}
-
-void putDebugChar(int c)
-{
- serial_putc (c);
-}
-
-void putDebugStr(const char *str)
-{
- serial_puts (str);
-}
-
-int getDebugChar(void)
-{
- return serial_getc ();
-}
-
-void kgdb_interruptible(int yes)
-{
- return;
-}
-#endif /* (CONFIG_KGDB_SER_INDEX & 2) */
-#endif /* CFG_CMD_KGDB */
diff --git a/cpu/i386/start.S b/cpu/i386/start.S
deleted file mode 100644
index afcbb24520..0000000000
--- a/cpu/i386/start.S
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * U-boot - i386 Startup Code
- *
- * Copyright (c) 2002 Omicron Ceti AB, Daniel Engström <denaiel@omicron.se>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-
-
-.section .text
-.code32
-.globl _start
-.type _start, @function
-.globl _i386boot_start
-_i386boot_start:
-_start:
- movl $0x18,%eax /* Load our segement registes, the
- * gdt have already been loaded by start16.S */
- movw %ax,%fs
- movw %ax,%ds
- movw %ax,%gs
- movw %ax,%es
- movw %ax,%ss
-
- /* We call a few functions in the board support package
- * since we have no stack yet we'll have to use %ebp
- * to store the return address */
-
- /* Early platform init (setup gpio, etc ) */
- mov $early_board_init_ret, %ebp
- jmp early_board_init
-early_board_init_ret:
-
- /* The __port80 entry-point should be usabe by now */
- /* so we try to indicate progress */
- movw $0x01, %ax
- movl $.progress0, %ebp
- jmp __show_boot_progress
-.progress0:
-
- /* size memory */
- mov $mem_init_ret, %ebp
- jmp mem_init
-mem_init_ret:
-
- /* check ammount of configured memory
- * (we need atleast bss start+bss size+stack size) */
- movl $_i386boot_bss_start, %ecx /* BSS start */
- addl $_i386boot_bss_size, %ecx /* BSS size */
- addl $CFG_STACK_SIZE, %ecx
- cmpl %ecx, %eax
- jae mem_ok
-
- /* indicate (lack of) progress */
- movw $0x81, %ax
- movl $.progress0a, %ebp
- jmp __show_boot_progress
-.progress0a:
- jmp die
-mem_ok:
-
- /* indicate progress */
- movw $0x02, %ax
- movl $.progress1, %ebp
- jmp __show_boot_progress
-.progress1:
-
- /* create a stack after the bss */
- movl $_i386boot_bss_start, %eax
- addl $_i386boot_bss_size, %eax
- addl $CFG_STACK_SIZE, %eax
- movl %eax, %esp
-
- pushl $0
- popl %eax
- cmpl $0, %eax
- jne no_stack
- push $0x55aa55aa
- popl %ebx
- cmpl $0x55aa55aa, %ebx
- je stack_ok
-
-no_stack:
- /* indicate (lack of) progress */
- movw $0x82, %ax
- movl $.progress1a, %ebp
- jmp __show_boot_progress
-.progress1a:
- jmp die
-
-
-stack_ok:
- /* indicate progress */
- movw $0x03, %ax
- movl $.progress2, %ebp
- jmp __show_boot_progress
-.progress2:
-
- /* copy data section to ram, size must be 4-byte aligned */
- movl $_i386boot_romdata_dest, %edi /* destination address */
- movl $_i386boot_romdata_start, %esi /* source address */
- movl $_i386boot_romdata_size, %ecx /* number of bytes to copy */
- movl %ecx, %eax
- andl $3, %eax
- jnz data_fail
-
- shrl $2, %ecx /* copy 4 byte each time */
- cld
- cmpl $0, %ecx
- je data_ok
-data_segment:
- movsl
- loop data_segment
- jmp data_ok
-data_fail:
- /* indicate (lack of) progress */
- movw $0x83, %ax
- movl $.progress2a, %ebp
- jmp __show_boot_progress
-.progress2a:
- jmp die
-
-data_ok:
-
- /* indicate progress */
- movw $0x04, %ax
- movl $.progress3, %ebp
- jmp __show_boot_progress
-.progress3:
-
- /* clear bss section in ram, size must be 4-byte aligned */
- movl $_i386boot_bss_start, %eax /* BSS start */
- movl $_i386boot_bss_size, %ecx /* BSS size */
- movl %ecx, %eax
- andl $3, %eax
- jnz bss_fail
- shrl $2, %ecx /* clear 4 byte each time */
- cld
- cmpl $0, %ecx
- je bss_ok
-bss:
- movl $0, (%edi)
- add $4, %edi
- loop bss
- jmp bss_ok
-
-bss_fail:
- /* indicate (lack of) progress */
- movw $0x84, %ax
- movl $.progress3a, %ebp
- jmp __show_boot_progress
-.progress3a:
- jmp die
-
-bss_ok:
-
- wbinvd
-
-
- /* indicate progress */
- movw $0x05, %ax
- movl $.progress4, %ebp
- jmp __show_boot_progress
-.progress4:
-
- call start_i386boot /* Enter, U-boot! */
-
- /* indicate (lack of) progress */
- movw $0x85, %ax
- movl $.progress4a, %ebp
- jmp __show_boot_progress
-.progress4a:
-
-die: hlt
- jmp die
- hlt
diff --git a/cpu/i386/start16.S b/cpu/i386/start16.S
deleted file mode 100644
index 239f2ff39b..0000000000
--- a/cpu/i386/start16.S
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * U-boot - i386 Startup Code
- *
- * Copyright (c) 2002, 2003 Omicron Ceti AB, Daniel Engström <denaiel@omicron.se>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#define BOOT_SEG 0xffff0000 /* linear segment of boot code */
-#define a32 .byte 0x67;
-#define o32 .byte 0x66;
-
-.section .start16, "ax"
-.code16
-.globl start16
-start16:
- /* First we let the BSP do some early initialization
- * this code have to map the flash to its final position
- */
- mov $board_init16_ret, %bp
- jmp board_init16
-board_init16_ret:
-
- /* Turn of cache (this might require a 486-class CPU) */
- movl %cr0, %eax
- orl $0x60000000,%eax
- movl %eax, %cr0
- wbinvd
-
- /* load the descriptor tables */
-o32 cs lidt idt_ptr
-o32 cs lgdt gdt_ptr
-
-
- /* Now, we enter protected mode */
- movl %cr0, %eax
- orl $1,%eax
- movl %eax, %cr0
-
- /* Flush the prefetch queue */
- jmp ff
-ff:
-
- /* Finally jump to the 32bit initialization code */
- movw $code32start, %ax
- movw %ax,%bp
-o32 cs ljmp *(%bp)
-
- /* 48-bit far pointer */
-code32start:
- .long _start /* offset */
- .word 0x10 /* segment */
-
-idt_ptr:
- .word 0 /* limit */
- .long 0 /* base */
-
-gdt_ptr:
- .word 0x30 /* limit (48 bytes = 6 GDT entries) */
- .long BOOT_SEG + gdt /* base */
-
- /* The GDT table ...
- *
- * Selector Type
- * 0x00 NULL
- * 0x08 Unused
- * 0x10 32bit code
- * 0x18 32bit data/stack
- * 0x20 16bit code
- * 0x28 16bit data/stack
- */
-
-gdt:
- .word 0, 0, 0, 0 /* NULL */
- .word 0, 0, 0, 0 /* unused */
-
- .word 0xFFFF /* 4Gb - (0x100000*0x1000 = 4Gb) */
- .word 0 /* base address = 0 */
- .word 0x9B00 /* code read/exec */
- .word 0x00CF /* granularity = 4096, 386 (+5th nibble of limit) */
-
- .word 0xFFFF /* 4Gb - (0x100000*0x1000 = 4Gb) */
- .word 0x0 /* base address = 0 */
- .word 0x9300 /* data read/write */
- .word 0x00CF /* granularity = 4096, 386 (+5th nibble of limit) */
-
- .word 0xFFFF /* 64kb */
- .word 0 /* base address = 0 */
- .word 0x9b00 /* data read/write */
- .word 0x0010 /* granularity = 1 (+5th nibble of limit) */
-
- .word 0xFFFF /* 64kb */
- .word 0 /* base address = 0 */
- .word 0x9300 /* data read/write */
- .word 0x0010 /* granularity = 1 (+5th nibble of limit) */
diff --git a/cpu/i386/timer.c b/cpu/i386/timer.c
deleted file mode 100644
index 96b5e2d336..0000000000
--- a/cpu/i386/timer.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/io.h>
-#include <asm/i8254.h>
-#include <asm/ibmpc.h>
-
-
-static volatile unsigned long system_ticks;
-static int timer_init_done =0;
-
-static void timer_isr(void *unused)
-{
- system_ticks++;
-}
-
-unsigned long get_system_ticks(void)
-{
- return system_ticks;
-}
-
-#define TIMER0_VALUE 0x04aa /* 1kHz 1.9318MHz / 1000 */
-#define TIMER2_VALUE 0x0a8e /* 440Hz */
-
-int timer_init(void)
-{
- system_ticks = 0;
-
- irq_install_handler(0, timer_isr, NULL);
-
- /* initialize timer 0 and 2
- *
- * Timer 0 is used to increment system_tick 1000 times/sec
- * Timer 1 was used for DRAM refresh in early PC's
- * Timer 2 is used to drive the speaker
- * (to stasrt a beep: write 3 to port 0x61,
- * to stop it again: write 0)
- */
-
- outb(PIT_CMD_CTR0|PIT_CMD_BOTH|PIT_CMD_MODE2, PIT_BASE + PIT_COMMAND);
- outb(TIMER0_VALUE&0xff, PIT_BASE + PIT_T0);
- outb(TIMER0_VALUE>>8, PIT_BASE + PIT_T0);
-
- outb(PIT_CMD_CTR2|PIT_CMD_BOTH|PIT_CMD_MODE3, PIT_BASE + PIT_COMMAND);
- outb(TIMER2_VALUE&0xff, PIT_BASE + PIT_T2);
- outb(TIMER2_VALUE>>8, PIT_BASE + PIT_T2);
-
- timer_init_done = 1;
-
- return 0;
-}
-
-
-#ifdef CFG_TIMER_GENERIC
-
-/* the unit for these is CFG_HZ */
-
-/* FixMe: implement these */
-void reset_timer (void)
-{
- system_ticks = 0;
-}
-
-ulong get_timer (ulong base)
-{
- return (system_ticks - base);
-}
-
-void set_timer (ulong t)
-{
- system_ticks = t;
-}
-
-static u16 read_pit(void)
-{
- u8 low;
- outb(PIT_CMD_LATCH, PIT_BASE + PIT_COMMAND);
- low = inb(PIT_BASE + PIT_T0);
- return ((inb(PIT_BASE + PIT_T0) << 8) | low);
-}
-
-#endif
diff --git a/cpu/ixp/Makefile b/cpu/ixp/Makefile
deleted file mode 100644
index e1fb327bb4..0000000000
--- a/cpu/ixp/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = serial.o interrupts.o cpu.o timer.o pci.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/ixp/config.mk b/cpu/ixp/config.mk
deleted file mode 100644
index a71a20b822..0000000000
--- a/cpu/ixp/config.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# (C) Copyright 2002
-# Sysgo Real-Time Solutions, GmbH <www.elinos.com>
-# Marius Groeger <mgroeger@sysgo.de>
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-BIG_ENDIAN = y
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \
- -msoft-float -mbig-endian
-
-PLATFORM_CPPFLAGS += -mbig-endian -march=armv5te -mtune=strongarm1100
-# =========================================================================
-#
-# Supply options according to compiler version
-#
-# =========================================================================
-PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
diff --git a/cpu/ixp/cpu.c b/cpu/ixp/cpu.c
deleted file mode 100644
index ec486cd3b5..0000000000
--- a/cpu/ixp/cpu.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * CPU specific code
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/arch/ixp425.h>
-
-ulong loops_per_jiffy;
-
-#ifdef CONFIG_USE_IRQ
-DECLARE_GLOBAL_DATA_PTR;
-#endif
-
-#if defined(CONFIG_DISPLAY_CPUINFO)
-int print_cpuinfo (void)
-{
- unsigned long id;
- int speed = 0;
-
- asm ("mrc p15, 0, %0, c0, c0, 0":"=r" (id));
-
- puts("CPU: Intel IXP425 at ");
- switch ((id & 0x000003f0) >> 4) {
- case 0x1c:
- loops_per_jiffy = 887467;
- speed = 533;
- break;
-
- case 0x1d:
- loops_per_jiffy = 666016;
- speed = 400;
- break;
-
- case 0x1f:
- loops_per_jiffy = 442901;
- speed = 266;
- break;
- }
-
- if (speed)
- printf("%d MHz\n", speed);
- else
- puts("unknown revision\n");
-
- return 0;
-}
-#endif /* CONFIG_DISPLAY_CPUINFO */
-
-int cpu_init (void)
-{
- /*
- * setup up stacks if necessary
- */
-#ifdef CONFIG_USE_IRQ
- IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
- FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
-#endif
-
- return 0;
-}
-
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-
-void bootcount_store (ulong a)
-{
- volatile ulong *save_addr = (volatile ulong *)(CFG_BOOTCOUNT_ADDR);
-
- save_addr[0] = a;
- save_addr[1] = BOOTCOUNT_MAGIC;
-}
-
-ulong bootcount_load (void)
-{
- volatile ulong *save_addr = (volatile ulong *)(CFG_BOOTCOUNT_ADDR);
-
- if (save_addr[1] != BOOTCOUNT_MAGIC)
- return 0;
- else
- return save_addr[0];
-}
-
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
diff --git a/cpu/ixp/interrupts.c b/cpu/ixp/interrupts.c
deleted file mode 100644
index 2dd9561e1a..0000000000
--- a/cpu/ixp/interrupts.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * (C) Copyright 2006
- * Stefan Roese, DENX Software Engineering, sr@denx.de.
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/arch/ixp425.h>
-
-#ifdef CONFIG_USE_IRQ
-/*
- * When interrupts are enabled, use timer 2 for time/delay generation...
- */
-
-#define FREQ 66666666
-#define CLOCK_TICK_RATE (((FREQ / CFG_HZ & ~IXP425_OST_RELOAD_MASK) + 1) * CFG_HZ)
-#define LATCH ((CLOCK_TICK_RATE + CFG_HZ/2) / CFG_HZ) /* For divider */
-
-struct _irq_handler {
- void *m_data;
- void (*m_func)( void *data);
-};
-
-static struct _irq_handler IRQ_HANDLER[N_IRQS];
-
-static volatile ulong timestamp;
-
-/* enable IRQ/FIQ interrupts */
-void enable_interrupts(void)
-{
- unsigned long temp;
- __asm__ __volatile__("mrs %0, cpsr\n"
- "bic %0, %0, #0x80\n"
- "msr cpsr_c, %0"
- : "=r" (temp)
- :
- : "memory");
-}
-
-/*
- * disable IRQ/FIQ interrupts
- * returns true if interrupts had been enabled before we disabled them
- */
-int disable_interrupts(void)
-{
- unsigned long old,temp;
- __asm__ __volatile__("mrs %0, cpsr\n"
- "orr %1, %0, #0x80\n"
- "msr cpsr_c, %1"
- : "=r" (old), "=r" (temp)
- :
- : "memory");
- return (old & 0x80) == 0;
-}
-
-static void default_isr(void *data)
-{
- printf("default_isr(): called for IRQ %d, Interrupt Status=%x PR=%x\n",
- (int)data, *IXP425_ICIP, *IXP425_ICIH);
-}
-
-static int next_irq(void)
-{
- return (((*IXP425_ICIH & 0x000000fc) >> 2) - 1);
-}
-
-static void timer_isr(void *data)
-{
- unsigned int *pTime = (unsigned int *)data;
-
- (*pTime)++;
-
- /*
- * Reset IRQ source
- */
- *IXP425_OSST = IXP425_OSST_TIMER_2_PEND;
-}
-
-ulong get_timer (ulong base)
-{
- return timestamp - base;
-}
-
-void reset_timer (void)
-{
- timestamp = 0;
-}
-
-#else /* #ifdef CONFIG_USE_IRQ */
-void enable_interrupts (void)
-{
- return;
-}
-int disable_interrupts (void)
-{
- return 0;
-}
-#endif /* #ifdef CONFIG_USE_IRQ */
-
-void bad_mode (void)
-{
- panic ("Resetting CPU ...\n");
- reset_cpu (0);
-}
-
-void show_regs (struct pt_regs *regs)
-{
- unsigned long flags;
- const char *processor_modes[] = {
- "USER_26", "FIQ_26", "IRQ_26", "SVC_26",
- "UK4_26", "UK5_26", "UK6_26", "UK7_26",
- "UK8_26", "UK9_26", "UK10_26", "UK11_26",
- "UK12_26", "UK13_26", "UK14_26", "UK15_26",
- "USER_32", "FIQ_32", "IRQ_32", "SVC_32",
- "UK4_32", "UK5_32", "UK6_32", "ABT_32",
- "UK8_32", "UK9_32", "UK10_32", "UND_32",
- "UK12_32", "UK13_32", "UK14_32", "SYS_32"
- };
-
- flags = condition_codes (regs);
-
- printf ("pc : [<%08lx>] lr : [<%08lx>]\n"
- "sp : %08lx ip : %08lx fp : %08lx\n",
- instruction_pointer (regs),
- regs->ARM_lr, regs->ARM_sp, regs->ARM_ip, regs->ARM_fp);
- printf ("r10: %08lx r9 : %08lx r8 : %08lx\n",
- regs->ARM_r10, regs->ARM_r9, regs->ARM_r8);
- printf ("r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n",
- regs->ARM_r7, regs->ARM_r6, regs->ARM_r5, regs->ARM_r4);
- printf ("r3 : %08lx r2 : %08lx r1 : %08lx r0 : %08lx\n",
- regs->ARM_r3, regs->ARM_r2, regs->ARM_r1, regs->ARM_r0);
- printf ("Flags: %c%c%c%c",
- flags & CC_N_BIT ? 'N' : 'n',
- flags & CC_Z_BIT ? 'Z' : 'z',
- flags & CC_C_BIT ? 'C' : 'c', flags & CC_V_BIT ? 'V' : 'v');
- printf (" IRQs %s FIQs %s Mode %s%s\n",
- interrupts_enabled (regs) ? "on" : "off",
- fast_interrupts_enabled (regs) ? "on" : "off",
- processor_modes[processor_mode (regs)],
- thumb_mode (regs) ? " (T)" : "");
-}
-
-void do_undefined_instruction (struct pt_regs *pt_regs)
-{
- printf ("undefined instruction\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_software_interrupt (struct pt_regs *pt_regs)
-{
- printf ("software interrupt\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_prefetch_abort (struct pt_regs *pt_regs)
-{
- printf ("prefetch abort\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_data_abort (struct pt_regs *pt_regs)
-{
- printf ("data abort\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_not_used (struct pt_regs *pt_regs)
-{
- printf ("not used\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_fiq (struct pt_regs *pt_regs)
-{
- printf ("fast interrupt request\n");
- show_regs (pt_regs);
- printf("IRQ=%08lx FIQ=%08lx\n", *IXP425_ICIH, *IXP425_ICFH);
-}
-
-void do_irq (struct pt_regs *pt_regs)
-{
-#ifdef CONFIG_USE_IRQ
- int irq = next_irq();
-
- IRQ_HANDLER[irq].m_func(IRQ_HANDLER[irq].m_data);
-#else
- printf ("interrupt request\n");
- show_regs (pt_regs);
- bad_mode ();
-#endif
-}
-
-int interrupt_init (void)
-{
-#ifdef CONFIG_USE_IRQ
- int i;
-
- /* install default interrupt handlers */
- for (i = 0; i < N_IRQS; i++) {
- IRQ_HANDLER[i].m_data = (void *)i;
- IRQ_HANDLER[i].m_func = default_isr;
- }
-
- /* install interrupt handler for timer */
- IRQ_HANDLER[IXP425_TIMER_2_IRQ].m_data = (void *)&timestamp;
- IRQ_HANDLER[IXP425_TIMER_2_IRQ].m_func = timer_isr;
-
- /* setup the Timer counter value */
- *IXP425_OSRT2 = (LATCH & ~IXP425_OST_RELOAD_MASK) | IXP425_OST_ENABLE;
-
- /* configure interrupts for IRQ mode */
- *IXP425_ICLR = 0x00000000;
-
- /* enable timer irq */
- *IXP425_ICMR = (1 << IXP425_TIMER_2_IRQ);
-#endif
-
- return (0);
-}
diff --git a/cpu/ixp/npe/IxEthAcc.c b/cpu/ixp/npe/IxEthAcc.c
deleted file mode 100644
index d981649da6..0000000000
--- a/cpu/ixp/npe/IxEthAcc.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- * @file IxEthAcc.c
- *
- * @author Intel Corporation
- * @date 20-Feb-2001
- *
- * @brief This file contains the implementation of the IXP425 Ethernet Access Component
- *
- * Design Notes:
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-
-#include "IxEthAcc.h"
-#ifdef CONFIG_IXP425_COMPONENT_ETHDB
-#include "IxEthDB.h"
-#endif
-#include "IxFeatureCtrl.h"
-
-#include "IxEthAcc_p.h"
-#include "IxEthAccMac_p.h"
-#include "IxEthAccMii_p.h"
-
-/**
- * @addtogroup IxEthAcc
- *@{
- */
-
-
-/**
- * @brief System-wide information data strucure.
- *
- * @ingroup IxEthAccPri
- *
- */
-
-IxEthAccInfo ixEthAccDataInfo;
-extern PUBLIC IxEthAccMacState ixEthAccMacState[];
-extern PUBLIC IxOsalMutex ixEthAccControlInterfaceMutex;
-
-/**
- * @brief System-wide information
- *
- * @ingroup IxEthAccPri
- *
- */
-BOOL ixEthAccServiceInit = FALSE;
-
-/* global filtering bit mask */
-PUBLIC UINT32 ixEthAccNewSrcMask;
-
-/**
- * @brief Per port information data strucure.
- *
- * @ingroup IxEthAccPri
- *
- */
-
-IxEthAccPortDataInfo ixEthAccPortData[IX_ETH_ACC_NUMBER_OF_PORTS];
-
-PUBLIC IxEthAccStatus ixEthAccInit()
-{
-#ifdef CONFIG_IXP425_COMPONENT_ETHDB
- /*
- * Initialize Control plane
- */
- if (ixEthDBInit() != IX_ETH_ACC_SUCCESS)
- {
- IX_ETH_ACC_WARNING_LOG("ixEthAccInit: EthDB init failed\n", 0, 0, 0, 0, 0, 0);
-
- return IX_ETH_ACC_FAIL;
- }
-#endif
-
- if (IX_FEATURE_CTRL_SWCONFIG_ENABLED == ixFeatureCtrlSwConfigurationCheck (IX_FEATURECTRL_ETH_LEARNING))
- {
- ixEthAccNewSrcMask = (~0); /* want all the bits */
- }
- else
- {
- ixEthAccNewSrcMask = (~IX_ETHACC_NE_NEWSRCMASK); /* want all but the NewSrc bit */
- }
-
- /*
- * Initialize Data plane
- */
- if ( ixEthAccInitDataPlane() != IX_ETH_ACC_SUCCESS )
- {
- IX_ETH_ACC_WARNING_LOG("ixEthAccInit: data plane init failed\n", 0, 0, 0, 0, 0, 0);
-
- return IX_ETH_ACC_FAIL;
- }
-
-
- if ( ixEthAccQMgrQueuesConfig() != IX_ETH_ACC_SUCCESS )
- {
- IX_ETH_ACC_WARNING_LOG("ixEthAccInit: queue config failed\n", 0, 0, 0, 0, 0, 0);
-
- return IX_ETH_ACC_FAIL;
- }
-
- /*
- * Initialize MII
- */
- if ( ixEthAccMiiInit() != IX_ETH_ACC_SUCCESS )
- {
- IX_ETH_ACC_WARNING_LOG("ixEthAccInit: Mii init failed\n", 0, 0, 0, 0, 0, 0);
-
- return IX_ETH_ACC_FAIL;
- }
-
- /*
- * Initialize MAC I/O memory
- */
- if (ixEthAccMacMemInit() != IX_ETH_ACC_SUCCESS)
- {
- IX_ETH_ACC_WARNING_LOG("ixEthAccInit: Mac init failed\n", 0, 0, 0, 0, 0, 0);
-
- return IX_ETH_ACC_FAIL;
- }
-
- /*
- * Initialize control plane interface lock
- */
- if (ixOsalMutexInit(&ixEthAccControlInterfaceMutex) != IX_SUCCESS)
- {
- IX_ETH_ACC_WARNING_LOG("ixEthAccInit: Control plane interface lock initialization failed\n", 0, 0, 0, 0, 0, 0);
-
- return IX_ETH_ACC_FAIL;
- }
-
- /* initialiasation is complete */
- ixEthAccServiceInit = TRUE;
-
- return IX_ETH_ACC_SUCCESS;
-
-}
-
-PUBLIC void ixEthAccUnload(void)
-{
- IxEthAccPortId portId;
-
- if ( IX_ETH_ACC_IS_SERVICE_INITIALIZED() )
- {
- /* check none of the port is still active */
- for (portId = 0; portId < IX_ETH_ACC_NUMBER_OF_PORTS; portId++)
- {
- if ( IX_ETH_IS_PORT_INITIALIZED(portId) )
- {
- if (ixEthAccMacState[portId].portDisableState == ACTIVE)
- {
- IX_ETH_ACC_WARNING_LOG("ixEthAccUnload: port %u still active, bail out\n", portId, 0, 0, 0, 0, 0);
- return;
- }
- }
- }
-
- /* unmap the memory areas */
- ixEthAccMiiUnload();
- ixEthAccMacUnload();
-
- /* set all ports as uninitialized */
- for (portId = 0; portId < IX_ETH_ACC_NUMBER_OF_PORTS; portId++)
- {
- ixEthAccPortData[portId].portInitialized = FALSE;
- }
-
- /* uninitialize the service */
- ixEthAccServiceInit = FALSE;
- }
-}
-
-PUBLIC IxEthAccStatus ixEthAccPortInit( IxEthAccPortId portId)
-{
-
- IxEthAccStatus ret=IX_ETH_ACC_SUCCESS;
-
- if ( ! IX_ETH_ACC_IS_SERVICE_INITIALIZED() )
- {
- return(IX_ETH_ACC_FAIL);
- }
-
- /*
- * Check for valid port
- */
-
- if ( ! IX_ETH_ACC_IS_PORT_VALID(portId) )
- {
- return (IX_ETH_ACC_INVALID_PORT);
- }
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot initialize Eth port.\n",(INT32) portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if ( IX_ETH_IS_PORT_INITIALIZED(portId) )
- {
- /* Already initialized */
- return(IX_ETH_ACC_FAIL);
- }
-
- if(ixEthAccMacInit(portId)!=IX_ETH_ACC_SUCCESS)
- {
- return IX_ETH_ACC_FAIL;
- }
-
- /*
- * Set the port init flag.
- */
-
- ixEthAccPortData[portId].portInitialized = TRUE;
-
-#ifdef CONFIG_IXP425_COMPONENT_ETHDB
- /* init learning/filtering database structures for this port */
- ixEthDBPortInit(portId);
-#endif
-
- return(ret);
-}
-
-
diff --git a/cpu/ixp/npe/IxEthAccCommon.c b/cpu/ixp/npe/IxEthAccCommon.c
deleted file mode 100644
index bda2c44792..0000000000
--- a/cpu/ixp/npe/IxEthAccCommon.c
+++ /dev/null
@@ -1,1049 +0,0 @@
-/**
- * @file IxEthAccCommon.c
- *
- * @author Intel Corporation
- * @date 12-Feb-2002
- *
- * @brief This file contains the implementation common support routines for the component
- *
- * Design Notes:
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/*
- * Component header files
- */
-
-#include "IxOsal.h"
-#include "IxEthAcc.h"
-#include "IxEthDB.h"
-#include "IxNpeMh.h"
-#include "IxEthDBPortDefs.h"
-#include "IxFeatureCtrl.h"
-#include "IxEthAcc_p.h"
-#include "IxEthAccQueueAssign_p.h"
-
-#include "IxEthAccDataPlane_p.h"
-#include "IxEthAccMii_p.h"
-
-/**
- * @addtogroup IxEthAccPri
- *@{
- */
-
-extern IxEthAccInfo ixEthAccDataInfo;
-
-/**
- *
- * @brief Maximum number of RX queues set to be the maximum number
- * of traffic calsses.
- *
- */
-#define IX_ETHACC_MAX_RX_QUEUES \
- (IX_ETH_DB_QOS_TRAFFIC_CLASS_7_RX_QUEUE_PROPERTY \
- - IX_ETH_DB_QOS_TRAFFIC_CLASS_0_RX_QUEUE_PROPERTY \
- + 1)
-
-/**
- *
- * @brief Maximum number of 128 entry RX queues
- *
- */
-#define IX_ETHACC_MAX_LARGE_RX_QUEUES 4
-
-/**
- *
- * @brief Data structure template for Default RX Queues
- *
- */
-IX_ETH_ACC_PRIVATE
-IxEthAccQregInfo ixEthAccQmgrRxDefaultTemplate =
- {
- IX_ETH_ACC_RX_FRAME_ETH_Q, /**< Queue ID */
- "Eth Rx Q",
- ixEthRxFrameQMCallback, /**< Functional callback */
- (IxQMgrCallbackId) 0, /**< Callback tag */
- IX_QMGR_Q_SIZE128, /**< Allocate Max Size Q */
- IX_QMGR_Q_ENTRY_SIZE1, /**< Queue Entry Sizes - all Q entries are single word entries */
- TRUE, /**< Enable Q notification at startup */
- IX_ETH_ACC_RX_FRAME_ETH_Q_SOURCE,/**< Q Condition to drive callback */
- IX_QMGR_Q_WM_LEVEL0, /**< Q Low water mark */
- IX_QMGR_Q_WM_LEVEL1, /**< Q High water mark - needed by NPE */
- };
-
-/**
- *
- * @brief Data structure template for Small RX Queues
- *
- */
-IX_ETH_ACC_PRIVATE
-IxEthAccQregInfo ixEthAccQmgrRxSmallTemplate =
- {
- IX_ETH_ACC_RX_FRAME_ETH_Q, /**< Queue ID */
- "Eth Rx Q",
- ixEthRxFrameQMCallback, /**< Functional callback */
- (IxQMgrCallbackId) 0, /**< Callback tag */
- IX_QMGR_Q_SIZE64, /**< Allocate Smaller Q */
- IX_QMGR_Q_ENTRY_SIZE1, /**< Queue Entry Sizes - all Q entries are single word entries */
- TRUE, /**< Enable Q notification at startup */
- IX_ETH_ACC_RX_FRAME_ETH_Q_SOURCE,/**< Q Condition to drive callback */
- IX_QMGR_Q_WM_LEVEL0, /**< Q Low water mark */
- IX_QMGR_Q_WM_LEVEL1, /**< Q High water mark - needed by NPE */
- };
-
-
-/**
- *
- * @brief Data structure used to register & initialize the Queues
- *
- */
-IX_ETH_ACC_PRIVATE
-IxEthAccQregInfo ixEthAccQmgrStaticInfo[]=
-{
- {
- IX_ETH_ACC_RX_FREE_BUFF_ENET0_Q,
- "Eth Rx Fr Q 1",
- ixEthRxFreeQMCallback,
- (IxQMgrCallbackId) IX_ETH_PORT_1,
- IX_QMGR_Q_SIZE128, /**< Allocate Max Size Q */
- IX_QMGR_Q_ENTRY_SIZE1, /**< Queue Entry Sizes - all Q entries are single word entries */
- FALSE, /**< Disable Q notification at startup */
- IX_ETH_ACC_RX_FREE_BUFF_ENET0_Q_SOURCE, /**< Q Condition to drive callback */
- IX_QMGR_Q_WM_LEVEL0, /***< Q Low water mark */
- IX_QMGR_Q_WM_LEVEL64, /**< Q High water mark */
- },
-
- {
- IX_ETH_ACC_RX_FREE_BUFF_ENET1_Q,
- "Eth Rx Fr Q 2",
- ixEthRxFreeQMCallback,
- (IxQMgrCallbackId) IX_ETH_PORT_2,
- IX_QMGR_Q_SIZE128, /**< Allocate Max Size Q */
- IX_QMGR_Q_ENTRY_SIZE1, /**< Queue Entry Sizes - all Q entries are single word entries */
- FALSE, /**< Disable Q notification at startup */
- IX_ETH_ACC_RX_FREE_BUFF_ENET1_Q_SOURCE, /**< Q Condition to drive callback */
- IX_QMGR_Q_WM_LEVEL0, /**< Q Low water mark */
- IX_QMGR_Q_WM_LEVEL64, /**< Q High water mark */
- },
-#ifdef __ixp46X
- {
- IX_ETH_ACC_RX_FREE_BUFF_ENET2_Q,
- "Eth Rx Fr Q 3",
- ixEthRxFreeQMCallback,
- (IxQMgrCallbackId) IX_ETH_PORT_3,
- IX_QMGR_Q_SIZE128, /**< Allocate Max Size Q */
- IX_QMGR_Q_ENTRY_SIZE1, /**< Queue Entry Sizes - all Q entries are single word entries */
- FALSE, /**< Disable Q notification at startup */
- IX_ETH_ACC_RX_FREE_BUFF_ENET2_Q_SOURCE, /**< Q Condition to drive callback */
- IX_QMGR_Q_WM_LEVEL0, /**< Q Low water mark */
- IX_QMGR_Q_WM_LEVEL64, /**< Q High water mark */
- },
-#endif
- {
- IX_ETH_ACC_TX_FRAME_ENET0_Q,
- "Eth Tx Q 1",
- ixEthTxFrameQMCallback,
- (IxQMgrCallbackId) IX_ETH_PORT_1,
- IX_QMGR_Q_SIZE128, /**< Allocate Max Size Q */
- IX_QMGR_Q_ENTRY_SIZE1, /**< Queue Entry Sizes - all Q entries are single word entries */
- FALSE, /**< Disable Q notification at startup */
- IX_ETH_ACC_TX_FRAME_ENET0_Q_SOURCE, /**< Q Condition to drive callback */
- IX_QMGR_Q_WM_LEVEL0, /**< Q Low water mark */
- IX_QMGR_Q_WM_LEVEL64, /**< Q High water mark */
- },
-
- {
- IX_ETH_ACC_TX_FRAME_ENET1_Q,
- "Eth Tx Q 2",
- ixEthTxFrameQMCallback,
- (IxQMgrCallbackId) IX_ETH_PORT_2,
- IX_QMGR_Q_SIZE128, /**< Allocate Max Size Q */
- IX_QMGR_Q_ENTRY_SIZE1, /**< Queue Entry Sizes - all Q entries are single word entries */
- FALSE, /**< Disable Q notification at startup */
- IX_ETH_ACC_TX_FRAME_ENET1_Q_SOURCE, /**< Q Condition to drive callback */
- IX_QMGR_Q_WM_LEVEL0, /**< Q Low water mark */
- IX_QMGR_Q_WM_LEVEL64, /**< Q High water mark */
- },
-#ifdef __ixp46X
- {
- IX_ETH_ACC_TX_FRAME_ENET2_Q,
- "Eth Tx Q 3",
- ixEthTxFrameQMCallback,
- (IxQMgrCallbackId) IX_ETH_PORT_3,
- IX_QMGR_Q_SIZE128, /**< Allocate Max Size Q */
- IX_QMGR_Q_ENTRY_SIZE1, /** Queue Entry Sizes - all Q entries are single ord entries */
- FALSE, /** Disable Q notification at startup */
- IX_ETH_ACC_TX_FRAME_ENET2_Q_SOURCE, /** Q Condition to drive callback */
- IX_QMGR_Q_WM_LEVEL0, /* No queues use almost empty */
- IX_QMGR_Q_WM_LEVEL64, /** Q High water mark - needed used */
- },
-#endif
- {
- IX_ETH_ACC_TX_FRAME_DONE_ETH_Q,
- "Eth Tx Done Q",
- ixEthTxFrameDoneQMCallback,
- (IxQMgrCallbackId) 0,
- IX_QMGR_Q_SIZE128, /**< Allocate Max Size Q */
- IX_QMGR_Q_ENTRY_SIZE1, /**< Queue Entry Sizes - all Q entries are single word entries */
- TRUE, /**< Enable Q notification at startup */
- IX_ETH_ACC_TX_FRAME_DONE_ETH_Q_SOURCE, /**< Q Condition to drive callback */
- IX_QMGR_Q_WM_LEVEL0, /**< Q Low water mark */
- IX_QMGR_Q_WM_LEVEL2, /**< Q High water mark - needed by NPE */
- },
-
- { /* Null Termination entry
- */
- (IxQMgrQId)0,
- (char *) NULL,
- (IxQMgrCallback) NULL,
- (IxQMgrCallbackId) 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- }
-
-};
-
-/**
- *
- * @brief Data structure used to register & initialize the Queues
- *
- * The structure will be filled at run time depending on the NPE
- * image already loaded and the QoS configured in ethDB.
- *
- */
-IX_ETH_ACC_PRIVATE
-IxEthAccQregInfo ixEthAccQmgrRxQueuesInfo[IX_ETHACC_MAX_RX_QUEUES+1]=
-{
- { /* PlaceHolder for rx queues
- * depending on the QoS configured
- */
- (IxQMgrQId)0,
- (char *) NULL,
- (IxQMgrCallback) NULL,
- (IxQMgrCallbackId) 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- },
-
- { /* PlaceHolder for rx queues
- * depending on the QoS configured
- */
- (IxQMgrQId)0,
- (char *) NULL,
- (IxQMgrCallback) NULL,
- (IxQMgrCallbackId) 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- },
-
- { /* PlaceHolder for rx queues
- * depending on the QoS configured
- */
- (IxQMgrQId)0,
- (char *) NULL,
- (IxQMgrCallback) NULL,
- (IxQMgrCallbackId) 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- },
-
- { /* PlaceHolder for rx queues
- * depending on the QoS configured
- */
- (IxQMgrQId)0,
- (char *) NULL,
- (IxQMgrCallback) NULL,
- (IxQMgrCallbackId) 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- },
-
- { /* PlaceHolder for rx queues
- * depending on the QoS configured
- */
- (IxQMgrQId)0,
- (char *) NULL,
- (IxQMgrCallback) NULL,
- (IxQMgrCallbackId) 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- },
-
- { /* PlaceHolder for rx queues
- * depending on the QoS configured
- */
- (IxQMgrQId)0,
- (char *) NULL,
- (IxQMgrCallback) NULL,
- (IxQMgrCallbackId) 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- },
-
- { /* PlaceHolder for rx queues
- * depending on the QoS configured
- */
- (IxQMgrQId)0,
- (char *) NULL,
- (IxQMgrCallback) NULL,
- (IxQMgrCallbackId) 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- },
-
- { /* PlaceHolder for rx queues
- * depending on the QoS configured
- */
- (IxQMgrQId)0,
- (char *) NULL,
- (IxQMgrCallback) NULL,
- (IxQMgrCallbackId) 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- },
-
- { /* Null Termination entry
- */
- (IxQMgrQId)0,
- (char *) NULL,
- (IxQMgrCallback) NULL,
- (IxQMgrCallbackId) 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- }
-
-};
-
-/* forward declarations */
-IX_ETH_ACC_PRIVATE IxEthAccStatus
-ixEthAccQMgrQueueSetup(IxEthAccQregInfo *qInfoDes);
-
-/**
- * @fn ixEthAccQMgrQueueSetup(void)
- *
- * @brief Setup one queue and its event, and register the callback required
- * by this component to the QMgr
- *
- * @internal
- */
-IX_ETH_ACC_PRIVATE IxEthAccStatus
-ixEthAccQMgrQueueSetup(IxEthAccQregInfo *qInfoDes)
-{
- /*
- * Configure each Q.
- */
- if ( ixQMgrQConfig( qInfoDes->qName,
- qInfoDes->qId,
- qInfoDes->qSize,
- qInfoDes->qWords) != IX_SUCCESS)
- {
- return IX_ETH_ACC_FAIL;
- }
-
- if ( ixQMgrWatermarkSet( qInfoDes->qId,
- qInfoDes->AlmostEmptyThreshold,
- qInfoDes->AlmostFullThreshold
- ) != IX_SUCCESS)
- {
- return IX_ETH_ACC_FAIL;
- }
-
- /*
- * Set dispatcher priority.
- */
- if ( ixQMgrDispatcherPrioritySet( qInfoDes->qId,
- IX_ETH_ACC_QM_QUEUE_DISPATCH_PRIORITY)
- != IX_SUCCESS)
- {
- return IX_ETH_ACC_FAIL;
- }
-
- /*
- * Register callbacks for each Q.
- */
- if ( ixQMgrNotificationCallbackSet(qInfoDes->qId,
- qInfoDes->qCallback,
- qInfoDes->callbackTag)
- != IX_SUCCESS )
- {
- return IX_ETH_ACC_FAIL;
- }
-
- /*
- * Set notification condition for Q
- */
- if ( qInfoDes->qNotificationEnableAtStartup == TRUE )
- {
- if ( ixQMgrNotificationEnable(qInfoDes->qId,
- qInfoDes->qConditionSource)
- != IX_SUCCESS )
- {
- return IX_ETH_ACC_FAIL;
- }
- }
-
- return(IX_ETH_ACC_SUCCESS);
-}
-
-/**
- * @fn ixEthAccQMgrQueuesConfig(void)
- *
- * @brief Setup all the queues and register all callbacks required
- * by this component to the QMgr
- *
- * The RxFree queues, tx queues, rx queues are configured statically
- *
- * Rx queues configuration is driven by QoS setup.
- * Many Rx queues may be required when QoS is enabled (this depends
- * on IxEthDB setup and the images being downloaded). The configuration
- * of the rxQueues is done in many steps as follows:
- *
- * @li select all Rx queues as configured by ethDB for all ports
- * @li sort the queues by traffic class
- * @li build the priority dependency for all queues
- * @li fill the configuration for all rx queues
- * @li configure all statically configured queues
- * @li configure all dynamically configured queues
- *
- * @param none
- *
- * @return IxEthAccStatus
- *
- * @internal
- */
-IX_ETH_ACC_PUBLIC
-IxEthAccStatus ixEthAccQMgrQueuesConfig(void)
-{
- struct
- {
- int npeCount;
- UINT32 npeId;
- IxQMgrQId qId;
- IxEthDBProperty trafficClass;
- } rxQueues[IX_ETHACC_MAX_RX_QUEUES];
-
- UINT32 rxQueue = 0;
- UINT32 rxQueueCount = 0;
- IxQMgrQId ixQId =IX_QMGR_MAX_NUM_QUEUES;
- IxEthDBStatus ixEthDBStatus = IX_ETH_DB_SUCCESS;
- IxEthDBPortId ixEthDbPortId = 0;
- IxEthAccPortId ixEthAccPortId = 0;
- UINT32 ixNpeId = 0;
- UINT32 ixHighestNpeId = 0;
- UINT32 sortIterations = 0;
- IxEthAccStatus ret = IX_ETH_ACC_SUCCESS;
- IxEthAccQregInfo *qInfoDes = NULL;
- IxEthDBProperty ixEthDBTrafficClass = IX_ETH_DB_QOS_TRAFFIC_CLASS_0_RX_QUEUE_PROPERTY;
- IxEthDBPropertyType ixEthDBPropertyType = IX_ETH_DB_INTEGER_PROPERTY;
- UINT32 ixEthDBParameter = 0;
- BOOL completelySorted = FALSE;
-
- /* Fill the corspondance between ports and queues
- * This defines the mapping from port to queue Ids.
- */
-
- ixEthAccPortData[IX_ETH_PORT_1].ixEthAccRxData.rxFreeQueue
- = IX_ETH_ACC_RX_FREE_BUFF_ENET0_Q;
- ixEthAccPortData[IX_ETH_PORT_2].ixEthAccRxData.rxFreeQueue
- = IX_ETH_ACC_RX_FREE_BUFF_ENET1_Q;
-#ifdef __ixp46X
- ixEthAccPortData[IX_ETH_PORT_3].ixEthAccRxData.rxFreeQueue
- = IX_ETH_ACC_RX_FREE_BUFF_ENET2_Q;
-#endif
- ixEthAccPortData[IX_ETH_PORT_1].ixEthAccTxData.txQueue
- = IX_ETH_ACC_TX_FRAME_ENET0_Q;
- ixEthAccPortData[IX_ETH_PORT_2].ixEthAccTxData.txQueue
- = IX_ETH_ACC_TX_FRAME_ENET1_Q;
-#ifdef __ixp46X
- ixEthAccPortData[IX_ETH_PORT_3].ixEthAccTxData.txQueue
- = IX_ETH_ACC_TX_FRAME_ENET2_Q;
-#endif
- /* Fill the corspondance between ports and NPEs
- * This defines the mapping from port to npeIds.
- */
-
- ixEthAccPortData[IX_ETH_PORT_1].npeId = IX_NPEMH_NPEID_NPEB;
- ixEthAccPortData[IX_ETH_PORT_2].npeId = IX_NPEMH_NPEID_NPEC;
-#ifdef __ixp46X
- ixEthAccPortData[IX_ETH_PORT_3].npeId = IX_NPEMH_NPEID_NPEA;
-#endif
- /* set the default rx scheduling discipline */
- ixEthAccDataInfo.schDiscipline = FIFO_NO_PRIORITY;
-
- /*
- * Queue Selection step:
- *
- * The following code selects all the queues and build
- * a temporary array which contains for each queue
- * - the queue Id,
- * - the highest traffic class (in case of many
- * priorities configured for the same queue on different
- * ports)
- * - the number of different Npes which are
- * configured to write to this queue.
- *
- * The output of this loop is a temporary array of RX queues
- * in any order.
- *
- */
-#ifdef CONFIG_IXP425_COMPONENT_ETHDB
- for (ixEthAccPortId = 0;
- (ixEthAccPortId < IX_ETH_ACC_NUMBER_OF_PORTS)
- && (ret == IX_ETH_ACC_SUCCESS);
- ixEthAccPortId++)
- {
- /* map between ethDb and ethAcc port Ids */
- ixEthDbPortId = (IxEthDBPortId)ixEthAccPortId;
-
- /* map between npeId and ethAcc port Ids */
- ixNpeId = IX_ETH_ACC_PORT_TO_NPE_ID(ixEthAccPortId);
-
- /* Iterate thru the different priorities */
- for (ixEthDBTrafficClass = IX_ETH_DB_QOS_TRAFFIC_CLASS_0_RX_QUEUE_PROPERTY;
- ixEthDBTrafficClass <= IX_ETH_DB_QOS_TRAFFIC_CLASS_7_RX_QUEUE_PROPERTY;
- ixEthDBTrafficClass++)
- {
- ixEthDBStatus = ixEthDBFeaturePropertyGet(
- ixEthDbPortId,
- IX_ETH_DB_VLAN_QOS,
- ixEthDBTrafficClass,
- &ixEthDBPropertyType,
- (void *)&ixEthDBParameter);
-
- if (ixEthDBStatus == IX_ETH_DB_SUCCESS)
- {
- /* This port and QoS class are mapped to
- * a RX queue.
- */
- if (ixEthDBPropertyType == IX_ETH_DB_INTEGER_PROPERTY)
- {
- /* remember the highest npe Id supporting ethernet */
- if (ixNpeId > ixHighestNpeId)
- {
- ixHighestNpeId = ixNpeId;
- }
-
- /* search the queue in the list of queues
- * already used by an other port or QoS
- */
- for (rxQueue = 0;
- rxQueue < rxQueueCount;
- rxQueue++)
- {
- if (rxQueues[rxQueue].qId == (IxQMgrQId)ixEthDBParameter)
- {
- /* found an existing setup, update the number of ports
- * for this queue if the port maps to
- * a different NPE.
- */
- if (rxQueues[rxQueue].npeId != ixNpeId)
- {
- rxQueues[rxQueue].npeCount++;
- rxQueues[rxQueue].npeId = ixNpeId;
- }
- /* get the highest traffic class for this queue */
- if (rxQueues[rxQueue].trafficClass > ixEthDBTrafficClass)
- {
- rxQueues[rxQueue].trafficClass = ixEthDBTrafficClass;
- }
- break;
- }
- }
- if (rxQueue == rxQueueCount)
- {
- /* new queue not found in the current list,
- * add a new entry.
- */
- IX_OSAL_ASSERT(rxQueueCount < IX_ETHACC_MAX_RX_QUEUES);
- rxQueues[rxQueueCount].qId = ixEthDBParameter;
- rxQueues[rxQueueCount].npeCount = 1;
- rxQueues[rxQueueCount].npeId = ixNpeId;
- rxQueues[rxQueueCount].trafficClass = ixEthDBTrafficClass;
- rxQueueCount++;
- }
- }
- else
- {
- /* unexpected property type (not Integer) */
- ret = IX_ETH_ACC_FAIL;
-
- IX_ETH_ACC_WARNING_LOG("ixEthAccQMgrQueuesConfig: unexpected property type returned by EthDB\n", 0, 0, 0, 0, 0, 0);
-
- /* no point to continue to iterate */
- break;
- }
- }
- else
- {
- /* No Rx queue configured for this port
- * and this traffic class. Do nothing.
- */
- }
- }
-
- /* notify EthDB that queue initialization is complete and traffic class allocation is frozen */
- ixEthDBFeaturePropertySet(ixEthDbPortId,
- IX_ETH_DB_VLAN_QOS,
- IX_ETH_DB_QOS_QUEUE_CONFIGURATION_COMPLETE,
- NULL /* ignored */);
- }
-
-#else
-
- ixNpeId = IX_ETH_ACC_PORT_TO_NPE_ID(ixEthAccPortId);
- rxQueues[0].qId = 4;
- rxQueues[0].npeCount = 1;
- rxQueues[0].npeId = ixNpeId;
- rxQueues[0].trafficClass = IX_ETH_DB_QOS_TRAFFIC_CLASS_0_RX_QUEUE_PROPERTY;
- rxQueueCount++;
-
-#endif
-
- /* check there is at least 1 rx queue : there is no point
- * to continue if there is no rx queue configured
- */
- if ((rxQueueCount == 0) || (ret == IX_ETH_ACC_FAIL))
- {
- IX_ETH_ACC_WARNING_LOG("ixEthAccQMgrQueuesConfig: no queues configured, bailing out\n", 0, 0, 0, 0, 0, 0);
- return (IX_ETH_ACC_FAIL);
- }
-
- /* Queue sort step:
- *
- * Re-order the array of queues by decreasing traffic class
- * using a bubble sort. (trafficClass 0 is the lowest
- * priority traffic, trafficClass 7 is the highest priority traffic)
- *
- * Primary sort order is traffic class
- * Secondary sort order is npeId
- *
- * Note that a bubble sort algorithm is not very efficient when
- * the number of queues grows . However, this is not a very bad choice
- * considering the very small number of entries to sort. Also, bubble
- * sort is extremely fast when the list is already sorted.
- *
- * The output of this loop is a sorted array of queues.
- *
- */
- sortIterations = 0;
- do
- {
- sortIterations++;
- completelySorted = TRUE;
- for (rxQueue = 0;
- rxQueue < rxQueueCount - sortIterations;
- rxQueue++)
- {
- /* compare adjacent elements */
- if ((rxQueues[rxQueue].trafficClass <
- rxQueues[rxQueue+1].trafficClass)
- || ((rxQueues[rxQueue].trafficClass ==
- rxQueues[rxQueue+1].trafficClass)
- &&(rxQueues[rxQueue].npeId <
- rxQueues[rxQueue+1].npeId)))
- {
- /* swap adjacent elements */
- int npeCount = rxQueues[rxQueue].npeCount;
- UINT32 npeId = rxQueues[rxQueue].npeId;
- IxQMgrQId qId = rxQueues[rxQueue].qId;
- IxEthDBProperty trafficClass = rxQueues[rxQueue].trafficClass;
- rxQueues[rxQueue].npeCount = rxQueues[rxQueue+1].npeCount;
- rxQueues[rxQueue].npeId = rxQueues[rxQueue+1].npeId;
- rxQueues[rxQueue].qId = rxQueues[rxQueue+1].qId;
- rxQueues[rxQueue].trafficClass = rxQueues[rxQueue+1].trafficClass;
- rxQueues[rxQueue+1].npeCount = npeCount;
- rxQueues[rxQueue+1].npeId = npeId;
- rxQueues[rxQueue+1].qId = qId;
- rxQueues[rxQueue+1].trafficClass = trafficClass;
- completelySorted = FALSE;
- }
- }
- }
- while (!completelySorted);
-
- /* Queue traffic class list:
- *
- * Fill an array of rx queues linked by ascending traffic classes.
- *
- * If the queues are configured as follows
- * qId 6 -> traffic class 0 (lowest)
- * qId 7 -> traffic class 0
- * qId 8 -> traffic class 6
- * qId 12 -> traffic class 7 (highest)
- *
- * Then the output of this loop will be
- *
- * higherPriorityQueue[6] = 8
- * higherPriorityQueue[7] = 8
- * higherPriorityQueue[8] = 12
- * higherPriorityQueue[12] = Invalid queueId
- * higherPriorityQueue[...] = Invalid queueId
- *
- * Note that this queue ordering does not handle all possibilities
- * that could result from different rules associated with different
- * ports, and inconsistencies in the rules. In all cases, the
- * output of this algorithm is a simple linked list of queues,
- * without closed circuit.
-
- * This list is implemented as an array with invalid values initialized
- * with an "invalid" queue id which is the maximum number of queues.
- *
- */
-
- /*
- * Initialise the rx queue list.
- */
- for (rxQueue = 0; rxQueue < IX_QMGR_MAX_NUM_QUEUES; rxQueue++)
- {
- ixEthAccDataInfo.higherPriorityQueue[rxQueue] = IX_QMGR_MAX_NUM_QUEUES;
- }
-
- /* build the linked list for this NPE.
- */
- for (ixNpeId = 0;
- ixNpeId <= ixHighestNpeId;
- ixNpeId++)
- {
- /* iterate thru the sorted list of queues
- */
- ixQId = IX_QMGR_MAX_NUM_QUEUES;
- for (rxQueue = 0;
- rxQueue < rxQueueCount;
- rxQueue++)
- {
- if (rxQueues[rxQueue].npeId == ixNpeId)
- {
- ixEthAccDataInfo.higherPriorityQueue[rxQueues[rxQueue].qId] = ixQId;
- /* iterate thru queues with the same traffic class
- * than the current queue. (queues are ordered by descending
- * traffic classes and npeIds).
- */
- while ((rxQueue < rxQueueCount - 1)
- && (rxQueues[rxQueue].trafficClass
- == rxQueues[rxQueue+1].trafficClass)
- && (ixNpeId == rxQueues[rxQueue].npeId))
- {
- rxQueue++;
- ixEthAccDataInfo.higherPriorityQueue[rxQueues[rxQueue].qId] = ixQId;
- }
- ixQId = rxQueues[rxQueue].qId;
- }
- }
- }
-
- /* point on the first dynamic queue description */
- qInfoDes = ixEthAccQmgrRxQueuesInfo;
-
- /* update the list of queues with the rx queues */
- for (rxQueue = 0;
- (rxQueue < rxQueueCount) && (ret == IX_ETH_ACC_SUCCESS);
- rxQueue++)
- {
- /* Don't utilize more than IX_ETHACC_MAX_LARGE_RX_QUEUES queues
- * with the full 128 entries. For the lower priority queues, use
- * a smaller number of entries. This ensures queue resources
- * remain available for other components.
- */
- if( (rxQueueCount > IX_ETHACC_MAX_LARGE_RX_QUEUES) &&
- (rxQueue < rxQueueCount - IX_ETHACC_MAX_LARGE_RX_QUEUES) )
- {
- /* add the small RX Queue setup template to the list of queues */
- memcpy(qInfoDes, &ixEthAccQmgrRxSmallTemplate, sizeof(*qInfoDes));
- } else {
- /* add the default RX Queue setup template to the list of queues */
- memcpy(qInfoDes, &ixEthAccQmgrRxDefaultTemplate, sizeof(*qInfoDes));
- }
-
- /* setup the RxQueue ID */
- qInfoDes->qId = rxQueues[rxQueue].qId;
-
- /* setup the RxQueue watermark level
- *
- * Each queue can be filled by many NPEs. To avoid the
- * NPEs to write to a full queue, need to set the
- * high watermark level for nearly full condition.
- * (the high watermark level are a power of 2
- * starting from the top of the queue)
- *
- * Number of watermark
- * ports level
- * 1 0
- * 2 1
- * 3 2
- * 4 4
- * 5 4
- * 6 8
- * n approx. 2**ceil(log2(n))
- */
- if (rxQueues[rxQueue].npeCount == 1)
- {
- qInfoDes->AlmostFullThreshold = IX_QMGR_Q_WM_LEVEL0;
- }
- else if (rxQueues[rxQueue].npeCount == 2)
- {
- qInfoDes->AlmostFullThreshold = IX_QMGR_Q_WM_LEVEL1;
- }
- else if (rxQueues[rxQueue].npeCount == 3)
- {
- qInfoDes->AlmostFullThreshold = IX_QMGR_Q_WM_LEVEL2;
- }
- else
- {
- /* reach the maximum number for CSR 2.0 */
- IX_ETH_ACC_WARNING_LOG("ixEthAccQMgrQueuesConfig: maximum number of NPEs per queue reached, bailing out\n", 0, 0, 0, 0, 0, 0);
- ret = IX_ETH_ACC_FAIL;
- break;
- }
-
- /* move to next queue entry */
- ++qInfoDes;
- }
-
- /* configure the static list (RxFree, Tx and TxDone queues) */
- for (qInfoDes = ixEthAccQmgrStaticInfo;
- (qInfoDes->qCallback != (IxQMgrCallback) NULL )
- && (ret == IX_ETH_ACC_SUCCESS);
- ++qInfoDes)
- {
- ret = ixEthAccQMgrQueueSetup(qInfoDes);
- }
-
- /* configure the dynamic list (Rx queues) */
- for (qInfoDes = ixEthAccQmgrRxQueuesInfo;
- (qInfoDes->qCallback != (IxQMgrCallback) NULL )
- && (ret == IX_ETH_ACC_SUCCESS);
- ++qInfoDes)
- {
- ret = ixEthAccQMgrQueueSetup(qInfoDes);
- }
-
- return(ret);
-}
-
-/**
- * @fn ixEthAccQMgrRxQEntryGet(UINT32 *rxQueueEntries)
- *
- * @brief Add and return the total number of entries in all Rx queues
- *
- * @param UINT32 rxQueueEntries[in] number of entries in all queues
- *
- * @return void
- *
- * @note Rx queues configuration is driven by Qos Setup. There is a
- * variable number of rx queues which are set at initialisation.
- *
- * @internal
- */
-IX_ETH_ACC_PUBLIC
-void ixEthAccQMgrRxQEntryGet(UINT32 *numRxQueueEntries)
-{
- UINT32 rxQueueLevel;
- IxEthAccQregInfo *qInfoDes;;
-
- *numRxQueueEntries = 0;
-
- /* iterate thru rx queues */
- for (qInfoDes = ixEthAccQmgrRxQueuesInfo;
- qInfoDes->qCallback != (IxQMgrCallback)NULL;
- ++qInfoDes)
- {
- /* retrieve the rx queue level */
- rxQueueLevel = 0;
- ixQMgrQNumEntriesGet(qInfoDes->qId, &rxQueueLevel);
- (*numRxQueueEntries) += rxQueueLevel;
- }
-}
-
-/**
- * @fn ixEthAccQMgrRxCallbacksRegister(IxQMgrCallback ixQMgrCallback)
- *
- * @brief Change the callback registered to all rx queues.
- *
- * @param IxQMgrCallback ixQMgrCallback[in] QMgr callback to register
- *
- * @return IxEthAccStatus
- *
- * @note The user may decide to use different Rx mechanisms
- * (e.g. receive many frames at the same time , or receive
- * one frame at a time, depending on the overall application
- * performances). A different QMgr callback is registered. This
- * way, there is no excessive pointer checks in the datapath.
- *
- * @internal
- */
-IX_ETH_ACC_PUBLIC
-IxEthAccStatus ixEthAccQMgrRxCallbacksRegister(IxQMgrCallback ixQMgrCallback)
-{
- IxEthAccQregInfo *qInfoDes;
- IxEthAccStatus ret = IX_ETH_ACC_SUCCESS;
-
- /* parameter check */
- if (NULL == ixQMgrCallback)
- {
- ret = IX_ETH_ACC_FAIL;
- }
-
- /* iterate thru rx queues */
- for (qInfoDes = ixEthAccQmgrRxQueuesInfo;
- (qInfoDes->qCallback != (IxQMgrCallback) NULL )
- && (ret == IX_ETH_ACC_SUCCESS);
- ++qInfoDes)
- {
- /* register the rx callback for all queues */
- if (ixQMgrNotificationCallbackSet(qInfoDes->qId,
- ixQMgrCallback,
- qInfoDes->callbackTag
- ) != IX_SUCCESS)
- {
- ret = IX_ETH_ACC_FAIL;
- }
- }
- return(ret);
-}
-
-/**
- * @fn ixEthAccSingleEthNpeCheck(IxEthAccPortId portId)
- *
- * @brief Check the npe exists for this port
- *
- * @param IxEthAccPortId portId[in] port
- *
- * @return IxEthAccStatus
- *
- * @internal
- */
-IX_ETH_ACC_PUBLIC
-IxEthAccStatus ixEthAccSingleEthNpeCheck(IxEthAccPortId portId)
-{
-
- /* If not IXP42X A0 stepping, proceed to check for existence of coprocessors */
- if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
- (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
- || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
- {
- if ((IX_ETH_PORT_1 == portId) &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH0) ==
- IX_FEATURE_CTRL_COMPONENT_ENABLED))
- {
- return IX_ETH_ACC_SUCCESS;
- }
-
- if ((IX_ETH_PORT_2 == portId) &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH1) ==
- IX_FEATURE_CTRL_COMPONENT_ENABLED))
- {
- return IX_ETH_ACC_SUCCESS;
- }
-
- if ((IX_ETH_PORT_3 == portId) &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA_ETH) ==
- IX_FEATURE_CTRL_COMPONENT_ENABLED))
- {
- return IX_ETH_ACC_SUCCESS;
- }
-
- return IX_ETH_ACC_FAIL;
- }
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-/**
- * @fn ixEthAccStatsShow(void)
- *
- * @brief Displays all EthAcc stats
- *
- * @return void
- *
- */
-void ixEthAccStatsShow(IxEthAccPortId portId)
-{
- ixEthAccMdioShow();
-
- printf("\nPort %u\nUnicast MAC : ", portId);
- ixEthAccPortUnicastAddressShow(portId);
- ixEthAccPortMulticastAddressShow(portId);
- printf("\n");
-
- ixEthAccDataPlaneShow();
-}
-
-
-
diff --git a/cpu/ixp/npe/IxEthAccControlInterface.c b/cpu/ixp/npe/IxEthAccControlInterface.c
deleted file mode 100644
index 44328473e6..0000000000
--- a/cpu/ixp/npe/IxEthAccControlInterface.c
+++ /dev/null
@@ -1,533 +0,0 @@
-/**
- * @file IxEthAccControlInterface.c
- *
- * @author Intel Corporation
- * @date
- *
- * @brief IX_ETH_ACC_PUBLIC wrappers for control plane functions
- *
- * Design Notes:
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxOsal.h"
-#include "IxEthAcc.h"
-#include "IxEthAcc_p.h"
-
-PUBLIC IxOsalMutex ixEthAccControlInterfaceMutex;
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortEnable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- printf("EthAcc: (Mac) cannot enable port %d, service not initialized\n", portId);
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortEnablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortDisable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- /* check the context is iinitialized */
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortDisablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortEnabledQuery(IxEthAccPortId portId, BOOL *enabled)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortEnabledQueryPriv(portId, enabled);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortPromiscuousModeClear(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortPromiscuousModeClearPriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortPromiscuousModeSet(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortPromiscuousModeSetPriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortUnicastMacAddressSet(IxEthAccPortId portId, IxEthAccMacAddr *macAddr)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortUnicastMacAddressSetPriv(portId, macAddr);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortUnicastMacAddressGet(IxEthAccPortId portId, IxEthAccMacAddr *macAddr)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortUnicastMacAddressGetPriv(portId, macAddr);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortMulticastAddressJoin(IxEthAccPortId portId, IxEthAccMacAddr *macAddr)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortMulticastAddressJoinPriv(portId, macAddr);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortMulticastAddressJoinAll(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortMulticastAddressJoinAllPriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortMulticastAddressLeave(IxEthAccPortId portId, IxEthAccMacAddr *macAddr)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortMulticastAddressLeavePriv(portId, macAddr);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortMulticastAddressLeaveAll(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortMulticastAddressLeaveAllPriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortUnicastAddressShow(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortUnicastAddressShowPriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC void
-ixEthAccPortMulticastAddressShow(IxEthAccPortId portId)
-{
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return;
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- ixEthAccPortMulticastAddressShowPriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortDuplexModeSet(IxEthAccPortId portId, IxEthAccDuplexMode mode)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortDuplexModeSetPriv(portId, mode);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortDuplexModeGet(IxEthAccPortId portId, IxEthAccDuplexMode *mode)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortDuplexModeGetPriv(portId, mode);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortTxFrameAppendPaddingEnable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortTxFrameAppendPaddingEnablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortTxFrameAppendPaddingDisable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortTxFrameAppendPaddingDisablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortTxFrameAppendFCSEnable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortTxFrameAppendFCSEnablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortTxFrameAppendFCSDisable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortTxFrameAppendFCSDisablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortRxFrameAppendFCSEnable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortRxFrameAppendFCSEnablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortRxFrameAppendFCSDisable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortRxFrameAppendFCSDisablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccTxSchedulingDisciplineSet(IxEthAccPortId portId, IxEthAccSchedulerDiscipline sched)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccTxSchedulingDisciplineSetPriv(portId, sched);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccRxSchedulingDisciplineSet(IxEthAccSchedulerDiscipline sched)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccRxSchedulingDisciplineSetPriv(sched);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortNpeLoopbackEnable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccNpeLoopbackEnablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortTxEnable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortTxEnablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortRxEnable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortRxEnablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortNpeLoopbackDisable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccNpeLoopbackDisablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortTxDisable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortTxDisablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortRxDisable(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortRxDisablePriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus
-ixEthAccPortMacReset(IxEthAccPortId portId)
-{
- IxEthAccStatus result;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&ixEthAccControlInterfaceMutex, IX_OSAL_WAIT_FOREVER);
- result = ixEthAccPortMacResetPriv(portId);
- ixOsalMutexUnlock(&ixEthAccControlInterfaceMutex);
- return result;
-}
diff --git a/cpu/ixp/npe/IxEthAccDataPlane.c b/cpu/ixp/npe/IxEthAccDataPlane.c
deleted file mode 100644
index e46fc9b25a..0000000000
--- a/cpu/ixp/npe/IxEthAccDataPlane.c
+++ /dev/null
@@ -1,2483 +0,0 @@
-/**
- * @file IxEthDataPlane.c
- *
- * @author Intel Corporation
- * @date 12-Feb-2002
- *
- * @brief This file contains the implementation of the IXPxxx
- * Ethernet Access Data plane component
- *
- * Design Notes:
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxNpeMh.h"
-#include "IxEthAcc.h"
-#include "IxEthDB.h"
-#include "IxOsal.h"
-#include "IxEthDBPortDefs.h"
-#include "IxFeatureCtrl.h"
-#include "IxEthAcc_p.h"
-#include "IxEthAccQueueAssign_p.h"
-
-extern PUBLIC IxEthAccMacState ixEthAccMacState[];
-extern PUBLIC UINT32 ixEthAccNewSrcMask;
-
-/**
- * private functions prototype
- */
-PRIVATE IX_OSAL_MBUF *
-ixEthAccEntryFromQConvert(UINT32 qEntry, UINT32 mask);
-
-PRIVATE UINT32
-ixEthAccMbufRxQPrepare(IX_OSAL_MBUF *mbuf);
-
-PRIVATE UINT32
-ixEthAccMbufTxQPrepare(IX_OSAL_MBUF *mbuf);
-
-PRIVATE IxEthAccStatus
-ixEthAccTxSwQHighestPriorityGet(IxEthAccPortId portId,
- IxEthAccTxPriority *priorityPtr);
-
-PRIVATE IxEthAccStatus
-ixEthAccTxFromSwQ(IxEthAccPortId portId,
- IxEthAccTxPriority priority);
-
-PRIVATE IxEthAccStatus
-ixEthAccRxFreeFromSwQ(IxEthAccPortId portId);
-
-PRIVATE void
-ixEthAccMbufFromTxQ(IX_OSAL_MBUF *mbuf);
-
-PRIVATE void
-ixEthAccMbufFromRxQ(IX_OSAL_MBUF *mbuf);
-
-PRIVATE IX_STATUS
-ixEthAccQmgrLockTxWrite(IxEthAccPortId portId,
- UINT32 qBuffer);
-
-PRIVATE IX_STATUS
-ixEthAccQmgrLockRxWrite(IxEthAccPortId portId,
- UINT32 qBuffer);
-
-PRIVATE IX_STATUS
-ixEthAccQmgrTxWrite(IxEthAccPortId portId,
- UINT32 qBuffer,
- UINT32 priority);
-
-/**
- * @addtogroup IxEthAccPri
- *@{
- */
-
-/* increment a counter only when stats are enabled */
-#define TX_STATS_INC(port,field) \
- IX_ETH_ACC_STATS_INC(ixEthAccPortData[port].ixEthAccTxData.stats.field)
-#define RX_STATS_INC(port,field) \
- IX_ETH_ACC_STATS_INC(ixEthAccPortData[port].ixEthAccRxData.stats.field)
-
-/* always increment the counter (mainly used for unexpected errors) */
-#define TX_INC(port,field) \
- ixEthAccPortData[port].ixEthAccTxData.stats.field++
-#define RX_INC(port,field) \
- ixEthAccPortData[port].ixEthAccRxData.stats.field++
-
-PRIVATE IxEthAccDataPlaneStats ixEthAccDataStats;
-
-extern IxEthAccPortDataInfo ixEthAccPortData[];
-extern IxEthAccInfo ixEthAccDataInfo;
-
-PRIVATE IxOsalFastMutex txWriteMutex[IX_ETH_ACC_NUMBER_OF_PORTS];
-PRIVATE IxOsalFastMutex rxWriteMutex[IX_ETH_ACC_NUMBER_OF_PORTS];
-
-/**
- *
- * @brief Mbuf header conversion macros : they implement the
- * different conversions using a temporary value. They also double-check
- * that the parameters can be converted to/from NPE format.
- *
- */
-#if defined(__wince) && !defined(IN_KERNEL)
-#define PTR_VIRT2NPE(ptrSrc,dst) \
- do { UINT32 temp; \
- IX_OSAL_ENSURE(sizeof(ptrSrc) == sizeof(UINT32), "Wrong parameter type"); \
- IX_OSAL_ENSURE(sizeof(dst) == sizeof(UINT32), "Wrong parameter type"); \
- temp = (UINT32)IX_OSAL_MBUF_MBUF_VIRTUAL_TO_PHYSICAL_TRANSLATION((IX_OSAL_MBUF*)ptrSrc); \
- (dst) = IX_OSAL_SWAP_BE_SHARED_LONG(temp); } \
- while(0)
-
-#define PTR_NPE2VIRT(type,src,ptrDst) \
- do { void *temp; \
- IX_OSAL_ENSURE(sizeof(type) == sizeof(UINT32), "Wrong parameter type"); \
- IX_OSAL_ENSURE(sizeof(src) == sizeof(UINT32), "Wrong parameter type"); \
- IX_OSAL_ENSURE(sizeof(ptrDst) == sizeof(UINT32), "Wrong parameter type"); \
- temp = (void *)IX_OSAL_SWAP_BE_SHARED_LONG(src); \
- (ptrDst) = (type)IX_OSAL_MBUF_MBUF_PHYSICAL_TO_VIRTUAL_TRANSLATION(temp); } \
- while(0)
-#else
-#define PTR_VIRT2NPE(ptrSrc,dst) \
- do { UINT32 temp; \
- IX_OSAL_ENSURE(sizeof(ptrSrc) == sizeof(UINT32), "Wrong parameter type"); \
- IX_OSAL_ENSURE(sizeof(dst) == sizeof(UINT32), "Wrong parameter type"); \
- temp = (UINT32)IX_OSAL_MMU_VIRT_TO_PHYS(ptrSrc); \
- (dst) = IX_OSAL_SWAP_BE_SHARED_LONG(temp); } \
- while(0)
-
-#define PTR_NPE2VIRT(type,src,ptrDst) \
- do { void *temp; \
- IX_OSAL_ENSURE(sizeof(type) == sizeof(UINT32), "Wrong parameter type"); \
- IX_OSAL_ENSURE(sizeof(src) == sizeof(UINT32), "Wrong parameter type"); \
- IX_OSAL_ENSURE(sizeof(ptrDst) == sizeof(UINT32), "Wrong parameter type"); \
- temp = (void *)IX_OSAL_SWAP_BE_SHARED_LONG(src); \
- (ptrDst) = (type)IX_OSAL_MMU_PHYS_TO_VIRT(temp); } \
- while(0)
-#endif
-
-/**
- *
- * @brief Mbuf payload pointer conversion macros : Wince has its own
- * method to convert the buffer pointers
- */
-#if defined(__wince) && !defined(IN_KERNEL)
-#define DATAPTR_VIRT2NPE(ptrSrc,dst) \
- do { UINT32 temp; \
- temp = (UINT32)IX_OSAL_MBUF_DATA_VIRTUAL_TO_PHYSICAL_TRANSLATION(ptrSrc); \
- (dst) = IX_OSAL_SWAP_BE_SHARED_LONG(temp); } \
- while(0)
-
-#else
-#define DATAPTR_VIRT2NPE(ptrSrc,dst) PTR_VIRT2NPE(IX_OSAL_MBUF_MDATA(ptrSrc),dst)
-#endif
-
-
-/* Flush the shared part of the mbuf header */
-#define IX_ETHACC_NE_CACHE_FLUSH(mbufPtr) \
- do { \
- IX_OSAL_CACHE_FLUSH(IX_ETHACC_NE_SHARED(mbufPtr), \
- sizeof(IxEthAccNe)); \
- } \
- while(0)
-
-/* Invalidate the shared part of the mbuf header */
-#define IX_ETHACC_NE_CACHE_INVALIDATE(mbufPtr) \
- do { \
- IX_OSAL_CACHE_INVALIDATE(IX_ETHACC_NE_SHARED(mbufPtr), \
- sizeof(IxEthAccNe)); \
- } \
- while(0)
-
-/* Preload one cache line (shared mbuf headers are aligned
- * and their size is 1 cache line)
- *
- * IX_OSAL_CACHED is defined when the mbuf headers are
- * allocated from cached memory.
- *
- * Other processor on emulation environment may not implement
- * preload function
- */
-#ifdef IX_OSAL_CACHED
- #if (CPU!=SIMSPARCSOLARIS) && !defined (__wince)
- #define IX_ACC_DATA_CACHE_PRELOAD(ptr) \
- do { /* preload a cache line (Xscale Processor) */ \
- __asm__ (" pld [%0]\n": : "r" (ptr)); \
- } \
- while(0)
- #else
- /* preload not implemented on different processor */
- #define IX_ACC_DATA_CACHE_PRELOAD(mbufPtr) \
- do { /* nothing */ } while (0)
- #endif
-#else
- /* preload not needed if cache is not enabled */
- #define IX_ACC_DATA_CACHE_PRELOAD(mbufPtr) \
- do { /* nothing */ } while (0)
-#endif
-
-/**
- *
- * @brief function to retrieve the correct pointer from
- * a queue entry posted by the NPE
- *
- * @param qEntry : entry from qmgr queue
- * mask : applicable mask for this queue
- * (4 most significant bits are used for additional informations)
- *
- * @return IX_OSAL_MBUF * pointer to mbuf header
- *
- * @internal
- */
-PRIVATE IX_OSAL_MBUF *
-ixEthAccEntryFromQConvert(UINT32 qEntry, UINT32 mask)
-{
- IX_OSAL_MBUF *mbufPtr;
-
- if (qEntry != 0)
- {
- /* mask NPE bits (e.g. priority, port ...) */
- qEntry &= mask;
-
-#if IX_ACC_DRAM_PHYS_OFFSET != 0
- /* restore the original address pointer (if PHYS_OFFSET is not 0) */
- qEntry |= (IX_ACC_DRAM_PHYS_OFFSET & ~IX_ETHNPE_QM_Q_RXENET_ADDR_MASK);
-#endif
- /* get the mbuf pointer address from the npe-shared address */
- qEntry -= offsetof(IX_OSAL_MBUF,ix_ne);
-
- /* phys2virt mbuf */
- mbufPtr = (IX_OSAL_MBUF *)IX_OSAL_MMU_PHYS_TO_VIRT(qEntry);
-
- /* preload the cacheline shared with NPE */
- IX_ACC_DATA_CACHE_PRELOAD(IX_ETHACC_NE_SHARED(mbufPtr));
-
- /* preload the cacheline used by xscale */
- IX_ACC_DATA_CACHE_PRELOAD(mbufPtr);
- }
- else
- {
- mbufPtr = NULL;
- }
-
- return mbufPtr;
-}
-
-/* Convert the mbuf header for NPE transmission */
-PRIVATE UINT32
-ixEthAccMbufTxQPrepare(IX_OSAL_MBUF *mbuf)
-{
- UINT32 qbuf;
- UINT32 len;
-
- /* endianess swap for tci and flags
- note: this is done only once, even for chained buffers */
- IX_ETHACC_NE_FLAGS(mbuf) = IX_OSAL_SWAP_BE_SHARED_SHORT(IX_ETHACC_NE_FLAGS(mbuf));
- IX_ETHACC_NE_VLANTCI(mbuf) = IX_OSAL_SWAP_BE_SHARED_SHORT(IX_ETHACC_NE_VLANTCI(mbuf));
-
- /* test for unchained mbufs */
- if (IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(mbuf) == NULL)
- {
- /* "best case" scenario : unchained mbufs */
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.unchainedTxMBufs);
-
- /* payload pointer conversion */
- DATAPTR_VIRT2NPE(mbuf, IX_ETHACC_NE_DATA(mbuf));
-
- /* unchained mbufs : the frame length is the mbuf length
- * and the 2 identical lengths are stored in the same
- * word.
- */
- len = IX_OSAL_MBUF_MLEN(mbuf);
-
- /* set the length in both length and pktLen 16-bits fields */
- len |= (len << IX_ETHNPE_ACC_LENGTH_OFFSET);
- IX_ETHACC_NE_LEN(mbuf) = IX_OSAL_SWAP_BE_SHARED_LONG(len);
-
- /* unchained mbufs : next contains 0 */
- IX_ETHACC_NE_NEXT(mbuf) = 0;
-
- /* flush shared header after all address conversions */
- IX_ETHACC_NE_CACHE_FLUSH(mbuf);
- }
- else
- {
- /* chained mbufs */
- IX_OSAL_MBUF *ptr = mbuf;
- IX_OSAL_MBUF *nextPtr;
- UINT32 frmLen;
-
- /* get the frame length from the header of the first buffer */
- frmLen = IX_OSAL_MBUF_PKT_LEN(mbuf);
-
- do
- {
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.chainedTxMBufs);
-
- /* payload pointer */
- DATAPTR_VIRT2NPE(ptr,IX_ETHACC_NE_DATA(ptr));
- /* Buffer length and frame length are stored in the same word */
- len = IX_OSAL_MBUF_MLEN(ptr);
- len = frmLen | (len << IX_ETHNPE_ACC_LENGTH_OFFSET);
- IX_ETHACC_NE_LEN(ptr) = IX_OSAL_SWAP_BE_SHARED_LONG(len);
-
- /* get the virtual next chain pointer */
- nextPtr = IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(ptr);
- if (nextPtr != NULL)
- {
- /* shared pointer of the next buffer is chained */
- PTR_VIRT2NPE(IX_ETHACC_NE_SHARED(nextPtr),
- IX_ETHACC_NE_NEXT(ptr));
- }
- else
- {
- IX_ETHACC_NE_NEXT(ptr) = 0;
- }
-
- /* flush shared header after all address conversions */
- IX_ETHACC_NE_CACHE_FLUSH(ptr);
-
- /* move to next buffer */
- ptr = nextPtr;
-
- /* the frame length field is set only in the first buffer
- * and is zeroed in the next buffers
- */
- frmLen = 0;
- }
- while(ptr != NULL);
-
- }
-
- /* virt2phys mbuf itself */
- qbuf = (UINT32)IX_OSAL_MMU_VIRT_TO_PHYS(
- IX_ETHACC_NE_SHARED(mbuf));
-
- /* Ensure the bits which are reserved to exchange information with
- * the NPE are cleared
- *
- * If the mbuf address is not correctly aligned, or from an
- * incompatible memory range, there is no point to continue
- */
- IX_OSAL_ENSURE(((qbuf & ~IX_ETHNPE_QM_Q_TXENET_ADDR_MASK) == 0),
- "Invalid address range");
-
- return qbuf;
-}
-
-/* Convert the mbuf header for NPE reception */
-PRIVATE UINT32
-ixEthAccMbufRxQPrepare(IX_OSAL_MBUF *mbuf)
-{
- UINT32 len;
- UINT32 qbuf;
-
- if (IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(mbuf) == NULL)
- {
- /* "best case" scenario : unchained mbufs */
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.unchainedRxFreeMBufs);
-
- /* unchained mbufs : payload pointer */
- DATAPTR_VIRT2NPE(mbuf, IX_ETHACC_NE_DATA(mbuf));
-
- /* unchained mbufs : set the buffer length
- * and the frame length field is zeroed
- */
- len = (IX_OSAL_MBUF_MLEN(mbuf) << IX_ETHNPE_ACC_LENGTH_OFFSET);
- IX_ETHACC_NE_LEN(mbuf) = IX_OSAL_SWAP_BE_SHARED_LONG(len);
-
- /* unchained mbufs : next pointer is null */
- IX_ETHACC_NE_NEXT(mbuf) = 0;
-
- /* flush shared header after all address conversions */
- IX_ETHACC_NE_CACHE_FLUSH(mbuf);
-
- /* remove shared header cache line */
- IX_ETHACC_NE_CACHE_INVALIDATE(mbuf);
- }
- else
- {
- /* chained mbufs */
- IX_OSAL_MBUF *ptr = mbuf;
- IX_OSAL_MBUF *nextPtr;
-
- do
- {
- /* chained mbufs */
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.chainedRxFreeMBufs);
-
- /* we must save virtual next chain pointer */
- nextPtr = IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(ptr);
-
- if (nextPtr != NULL)
- {
- /* chaining pointer for NPE */
- PTR_VIRT2NPE(IX_ETHACC_NE_SHARED(nextPtr),
- IX_ETHACC_NE_NEXT(ptr));
- }
- else
- {
- IX_ETHACC_NE_NEXT(ptr) = 0;
- }
-
- /* payload pointer */
- DATAPTR_VIRT2NPE(ptr,IX_ETHACC_NE_DATA(ptr));
-
- /* buffer length */
- len = (IX_OSAL_MBUF_MLEN(ptr) << IX_ETHNPE_ACC_LENGTH_OFFSET);
- IX_ETHACC_NE_LEN(ptr) = IX_OSAL_SWAP_BE_SHARED_LONG(len);
-
- /* flush shared header after all address conversions */
- IX_ETHACC_NE_CACHE_FLUSH(ptr);
-
- /* remove shared header cache line */
- IX_ETHACC_NE_CACHE_INVALIDATE(ptr);
-
- /* next mbuf in the chain */
- ptr = nextPtr;
- }
- while(ptr != NULL);
- }
-
- /* virt2phys mbuf itself */
- qbuf = (UINT32)IX_OSAL_MMU_VIRT_TO_PHYS(
- IX_ETHACC_NE_SHARED(mbuf));
-
- /* Ensure the bits which are reserved to exchange information with
- * the NPE are cleared
- *
- * If the mbuf address is not correctly aligned, or from an
- * incompatible memory range, there is no point to continue
- */
- IX_OSAL_ENSURE(((qbuf & ~IX_ETHNPE_QM_Q_RXENET_ADDR_MASK) == 0),
- "Invalid address range");
-
- return qbuf;
-}
-
-/* Convert the mbuf header after NPE transmission
- * Since there is nothing changed by the NPE, there is no need
- * to process anything but the update of internal stats
- * when they are enabled
-*/
-PRIVATE void
-ixEthAccMbufFromTxQ(IX_OSAL_MBUF *mbuf)
-{
-#ifndef NDEBUG
- /* test for unchained mbufs */
- if (IX_ETHACC_NE_NEXT(mbuf) == 0)
- {
- /* unchained mbufs : update the stats */
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.unchainedTxDoneMBufs);
- }
- else
- {
- /* chained mbufs : walk the chain and update the stats */
- IX_OSAL_MBUF *ptr = mbuf;
-
- do
- {
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.chainedTxDoneMBufs);
- ptr = IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(ptr);
- }
- while (ptr != NULL);
- }
-#endif
-}
-
-/* Convert the mbuf header after NPE reception */
-PRIVATE void
-ixEthAccMbufFromRxQ(IX_OSAL_MBUF *mbuf)
-{
- UINT32 len;
-
- /* endianess swap for tci and flags
- note: this is done only once, even for chained buffers */
- IX_ETHACC_NE_FLAGS(mbuf) = IX_OSAL_SWAP_BE_SHARED_SHORT(IX_ETHACC_NE_FLAGS(mbuf));
- IX_ETHACC_NE_VLANTCI(mbuf) = IX_OSAL_SWAP_BE_SHARED_SHORT(IX_ETHACC_NE_VLANTCI(mbuf));
-
- /* test for unchained mbufs */
- if (IX_ETHACC_NE_NEXT(mbuf) == 0)
- {
- /* unchained mbufs */
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.unchainedRxMBufs);
-
- /* get the frame length. it is the same than the buffer length */
- len = IX_OSAL_SWAP_BE_SHARED_LONG(IX_ETHACC_NE_LEN(mbuf));
- len &= IX_ETHNPE_ACC_PKTLENGTH_MASK;
- IX_OSAL_MBUF_PKT_LEN(mbuf) = IX_OSAL_MBUF_MLEN(mbuf) = len;
-
- /* clears the next packet field */
- IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(mbuf) = NULL;
- }
- else
- {
- IX_OSAL_MBUF *ptr = mbuf;
- IX_OSAL_MBUF *nextPtr;
- UINT32 frmLen;
-
- /* convert the frame length */
- frmLen = IX_OSAL_SWAP_BE_SHARED_LONG(IX_ETHACC_NE_LEN(mbuf));
- IX_OSAL_MBUF_PKT_LEN(mbuf) = (frmLen & IX_ETHNPE_ACC_PKTLENGTH_MASK);
-
- /* chained mbufs */
- do
- {
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.chainedRxMBufs);
-
- /* convert the length */
- len = IX_OSAL_SWAP_BE_SHARED_LONG(IX_ETHACC_NE_LEN(ptr));
- IX_OSAL_MBUF_MLEN(ptr) = (len >> IX_ETHNPE_ACC_LENGTH_OFFSET);
-
- /* get the next pointer */
- PTR_NPE2VIRT(IX_OSAL_MBUF *,IX_ETHACC_NE_NEXT(ptr), nextPtr);
- if (nextPtr != NULL)
- {
- nextPtr = (IX_OSAL_MBUF *)((UINT8 *)nextPtr - offsetof(IX_OSAL_MBUF,ix_ne));
- }
- /* set the next pointer */
- IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(ptr) = nextPtr;
-
- /* move to the next buffer */
- ptr = nextPtr;
- }
- while (ptr != NULL);
- }
-}
-
-/* write to qmgr if possible and report an overflow if not possible
- * Use a fast lock to protect the queue write.
- * This way, the tx feature is reentrant.
- */
-PRIVATE IX_STATUS
-ixEthAccQmgrLockTxWrite(IxEthAccPortId portId, UINT32 qBuffer)
-{
- IX_STATUS qStatus;
- if (ixOsalFastMutexTryLock(&txWriteMutex[portId]) == IX_SUCCESS)
- {
- qStatus = ixQMgrQWrite(
- IX_ETH_ACC_PORT_TO_TX_Q_ID(portId),
- &qBuffer);
-#ifndef NDEBUG
- if (qStatus != IX_SUCCESS)
- {
- TX_STATS_INC(portId, txOverflow);
- }
-#endif
- ixOsalFastMutexUnlock(&txWriteMutex[portId]);
- }
- else
- {
- TX_STATS_INC(portId, txLock);
- qStatus = IX_QMGR_Q_OVERFLOW;
- }
- return qStatus;
-}
-
-/* write to qmgr if possible and report an overflow if not possible
- * Use a fast lock to protect the queue write.
- * This way, the Rx feature is reentrant.
- */
-PRIVATE IX_STATUS
-ixEthAccQmgrLockRxWrite(IxEthAccPortId portId, UINT32 qBuffer)
-{
- IX_STATUS qStatus;
- if (ixOsalFastMutexTryLock(&rxWriteMutex[portId]) == IX_SUCCESS)
- {
- qStatus = ixQMgrQWrite(
- IX_ETH_ACC_PORT_TO_RX_FREE_Q_ID(portId),
- &qBuffer);
-#ifndef NDEBUG
- if (qStatus != IX_SUCCESS)
- {
- RX_STATS_INC(portId, rxFreeOverflow);
- }
-#endif
- ixOsalFastMutexUnlock(&rxWriteMutex[portId]);
- }
- else
- {
- RX_STATS_INC(portId, rxFreeLock);
- qStatus = IX_QMGR_Q_OVERFLOW;
- }
- return qStatus;
-}
-
-/*
- * Set the priority and write to a qmgr queue.
- */
-PRIVATE IX_STATUS
-ixEthAccQmgrTxWrite(IxEthAccPortId portId, UINT32 qBuffer, UINT32 priority)
-{
- /* fill the priority field */
- qBuffer |= (priority << IX_ETHNPE_QM_Q_FIELD_PRIOR_R);
-
- return ixEthAccQmgrLockTxWrite(portId, qBuffer);
-}
-
-/**
- *
- * @brief This function will discover the highest priority S/W Tx Q that
- * has entries in it
- *
- * @param portId - (in) the id of the port whose S/W Tx queues are to be searched
- * priorityPtr - (out) the priority of the highest priority occupied q will be written
- * here
- *
- * @return IX_ETH_ACC_SUCCESS if an occupied Q is found
- * IX_ETH_ACC_FAIL if no Q has entries
- *
- * @internal
- */
-PRIVATE IxEthAccStatus
-ixEthAccTxSwQHighestPriorityGet(IxEthAccPortId portId,
- IxEthAccTxPriority *priorityPtr)
-{
- if (ixEthAccPortData[portId].ixEthAccTxData.schDiscipline
- == FIFO_NO_PRIORITY)
- {
- if(IX_ETH_ACC_DATAPLANE_IS_Q_EMPTY(ixEthAccPortData[portId].
- ixEthAccTxData.txQ[IX_ETH_ACC_TX_DEFAULT_PRIORITY]))
- {
- return IX_ETH_ACC_FAIL;
- }
- else
- {
- *priorityPtr = IX_ETH_ACC_TX_DEFAULT_PRIORITY;
- TX_STATS_INC(portId,txPriority[*priorityPtr]);
- return IX_ETH_ACC_SUCCESS;
- }
- }
- else
- {
- IxEthAccTxPriority highestPriority = IX_ETH_ACC_TX_PRIORITY_7;
- while(1)
- {
- if(!IX_ETH_ACC_DATAPLANE_IS_Q_EMPTY(ixEthAccPortData[portId].
- ixEthAccTxData.txQ[highestPriority]))
- {
-
- *priorityPtr = highestPriority;
- TX_STATS_INC(portId,txPriority[highestPriority]);
- return IX_ETH_ACC_SUCCESS;
-
- }
- if (highestPriority == IX_ETH_ACC_TX_PRIORITY_0)
- {
- return IX_ETH_ACC_FAIL;
- }
- highestPriority--;
- }
- }
-}
-
-/**
- *
- * @brief This function will take a buffer from a TX S/W Q and attempt
- * to add it to the relevant TX H/W Q
- *
- * @param portId - the port whose TX queue is to be written to
- * priority - identifies the queue from which the entry is to be read
- *
- * @internal
- */
-PRIVATE IxEthAccStatus
-ixEthAccTxFromSwQ(IxEthAccPortId portId,
- IxEthAccTxPriority priority)
-{
- IX_OSAL_MBUF *mbuf;
- IX_STATUS qStatus;
-
- IX_OSAL_ENSURE((UINT32)priority <= (UINT32)7, "Invalid priority");
-
- IX_ETH_ACC_DATAPLANE_REMOVE_MBUF_FROM_Q_HEAD(
- ixEthAccPortData[portId].ixEthAccTxData.txQ[priority],
- mbuf);
-
- if (mbuf != NULL)
- {
- /*
- * Add the Tx buffer to the H/W Tx Q
- * We do not need to flush here as it is already done
- * in TxFrameSubmit().
- */
- qStatus = ixEthAccQmgrTxWrite(
- portId,
- IX_OSAL_MMU_VIRT_TO_PHYS((UINT32)IX_ETHACC_NE_SHARED(mbuf)),
- priority);
-
- if (qStatus == IX_SUCCESS)
- {
- TX_STATS_INC(portId,txFromSwQOK);
- return IX_SUCCESS;
- }
- else if (qStatus == IX_QMGR_Q_OVERFLOW)
- {
- /*
- * H/W Q overflow, need to save the buffer
- * back on the s/w Q.
- * we must put it back on the head of the q to avoid
- * reordering packet tx
- */
- TX_STATS_INC(portId,txFromSwQDelayed);
- IX_ETH_ACC_DATAPLANE_ADD_MBUF_TO_Q_HEAD(
- ixEthAccPortData[portId].ixEthAccTxData.txQ[priority],
- mbuf);
-
- /*enable Q notification*/
- qStatus = ixQMgrNotificationEnable(
- IX_ETH_ACC_PORT_TO_TX_Q_ID(portId),
- IX_ETH_ACC_PORT_TO_TX_Q_SOURCE(portId));
-
- if (qStatus != IX_SUCCESS && qStatus != IX_QMGR_WARNING)
- {
- TX_INC(portId,txUnexpectedError);
- IX_ETH_ACC_FATAL_LOG(
- "ixEthAccTxFromSwQ:Unexpected Error: %u\n",
- qStatus, 0, 0, 0, 0, 0);
- }
- }
- else
- {
- TX_INC(portId,txUnexpectedError);
-
- /* recovery attempt */
- IX_ETH_ACC_DATAPLANE_ADD_MBUF_TO_Q_HEAD(
- ixEthAccPortData[portId].ixEthAccTxData.txQ[priority],
- mbuf);
-
- IX_ETH_ACC_FATAL_LOG(
- "ixEthAccTxFromSwQ:Error: unexpected QM status 0x%08X\n",
- qStatus, 0, 0, 0, 0, 0);
- }
- }
- else
- {
- /* sw queue is empty */
- }
- return IX_ETH_ACC_FAIL;
-}
-
-/**
- *
- * @brief This function will take a buffer from a RXfree S/W Q and attempt
- * to add it to the relevant RxFree H/W Q
- *
- * @param portId - the port whose RXFree queue is to be written to
- *
- * @internal
- */
-PRIVATE IxEthAccStatus
-ixEthAccRxFreeFromSwQ(IxEthAccPortId portId)
-{
- IX_OSAL_MBUF *mbuf;
- IX_STATUS qStatus = IX_SUCCESS;
-
- IX_ETH_ACC_DATAPLANE_REMOVE_MBUF_FROM_Q_HEAD(
- ixEthAccPortData[portId].ixEthAccRxData.freeBufferList,
- mbuf);
- if (mbuf != NULL)
- {
- /*
- * Add The Rx Buffer to the H/W Free buffer Q if possible
- */
- qStatus = ixEthAccQmgrLockRxWrite(portId,
- IX_OSAL_MMU_VIRT_TO_PHYS(
- (UINT32)IX_ETHACC_NE_SHARED(mbuf)));
-
- if (qStatus == IX_SUCCESS)
- {
- RX_STATS_INC(portId,rxFreeRepFromSwQOK);
- /*
- * Buffer added to h/w Q.
- */
- return IX_SUCCESS;
- }
- else if (qStatus == IX_QMGR_Q_OVERFLOW)
- {
- /*
- * H/W Q overflow, need to save the buffer back on the s/w Q.
- */
- RX_STATS_INC(portId,rxFreeRepFromSwQDelayed);
-
- IX_ETH_ACC_DATAPLANE_ADD_MBUF_TO_Q_HEAD(
- ixEthAccPortData[portId].ixEthAccRxData.freeBufferList,
- mbuf);
- }
- else
- {
- /* unexpected qmgr error */
- RX_INC(portId,rxUnexpectedError);
-
- IX_ETH_ACC_DATAPLANE_ADD_MBUF_TO_Q_HEAD(
- ixEthAccPortData[portId].ixEthAccRxData.freeBufferList,
- mbuf);
-
- IX_ETH_ACC_FATAL_LOG("IxEthAccRxFreeFromSwQ:Error: unexpected QM status 0x%08X\n",
- qStatus, 0, 0, 0, 0, 0);
- }
- }
- else
- {
- /* sw queue is empty */
- }
- return IX_ETH_ACC_FAIL;
-}
-
-
-IX_ETH_ACC_PUBLIC
-IxEthAccStatus ixEthAccInitDataPlane()
-{
- UINT32 portId;
-
- /*
- * Initialize the service and register callback to other services.
- */
-
- IX_ETH_ACC_MEMSET(&ixEthAccDataStats,
- 0,
- sizeof(ixEthAccDataStats));
-
- for(portId=0; portId < IX_ETH_ACC_NUMBER_OF_PORTS; portId++)
- {
- ixOsalFastMutexInit(&txWriteMutex[portId]);
- ixOsalFastMutexInit(&rxWriteMutex[portId]);
-
- IX_ETH_ACC_MEMSET(&ixEthAccPortData[portId],
- 0,
- sizeof(ixEthAccPortData[portId]));
-
- ixEthAccPortData[portId].ixEthAccTxData.schDiscipline = FIFO_NO_PRIORITY;
- }
-
- return (IX_ETH_ACC_SUCCESS);
-}
-
-
-IX_ETH_ACC_PUBLIC
-IxEthAccStatus ixEthAccPortTxDoneCallbackRegister(IxEthAccPortId portId,
- IxEthAccPortTxDoneCallback
- txCallbackFn,
- UINT32 callbackTag)
-{
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
- if (!IX_ETH_ACC_IS_PORT_VALID(portId))
- {
- return (IX_ETH_ACC_INVALID_PORT);
- }
-
-/* HACK: removing this code to enable NPE-A preliminary testing
- * if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- * {
- * IX_ETH_ACC_WARNING_LOG("ixEthAccPortTxDoneCallbackRegister: Unavailable Eth %d: Cannot register TxDone Callback.\n",(INT32)portId,0,0,0,0,0);
- * return IX_ETH_ACC_SUCCESS ;
- * }
- */
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
- if (txCallbackFn == 0)
- /* Check for null function pointer here. */
- {
- return (IX_ETH_ACC_INVALID_ARG);
- }
- ixEthAccPortData[portId].ixEthAccTxData.txBufferDoneCallbackFn = txCallbackFn;
- ixEthAccPortData[portId].ixEthAccTxData.txCallbackTag = callbackTag;
- return (IX_ETH_ACC_SUCCESS);
-}
-
-
-IX_ETH_ACC_PUBLIC
-IxEthAccStatus ixEthAccPortRxCallbackRegister(IxEthAccPortId portId,
- IxEthAccPortRxCallback
- rxCallbackFn,
- UINT32 callbackTag)
-{
- IxEthAccPortId port;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
- if (!IX_ETH_ACC_IS_PORT_VALID(portId))
- {
- return (IX_ETH_ACC_INVALID_PORT);
- }
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("ixEthAccPortRxCallbackRegister: Unavailable Eth %d: Cannot register Rx Callback.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /* Check for null function pointer here. */
- if (rxCallbackFn == NULL)
- {
- return (IX_ETH_ACC_INVALID_ARG);
- }
-
- /* Check the user is not changing the callback type
- * when the port is enabled.
- */
- if (ixEthAccMacState[portId].portDisableState == ACTIVE)
- {
- for (port = 0; port < IX_ETH_ACC_NUMBER_OF_PORTS; port++)
- {
- if ((ixEthAccMacState[port].portDisableState == ACTIVE)
- && (ixEthAccPortData[port].ixEthAccRxData.rxMultiBufferCallbackInUse == TRUE))
- {
- /* one of the active ports has a different rx callback type.
- * Changing the callback type when the port is enabled
- * is not safe
- */
- return (IX_ETH_ACC_INVALID_ARG);
- }
- }
- }
-
- /* update the callback pointer : this is done before
- * registering the new qmgr callback
- */
- ixEthAccPortData[portId].ixEthAccRxData.rxCallbackFn = rxCallbackFn;
- ixEthAccPortData[portId].ixEthAccRxData.rxCallbackTag = callbackTag;
-
- /* update the qmgr callback for rx queues */
- if (ixEthAccQMgrRxCallbacksRegister(ixEthRxFrameQMCallback)
- != IX_ETH_ACC_SUCCESS)
- {
- /* unexpected qmgr error */
- IX_ETH_ACC_FATAL_LOG("ixEthAccPortRxCallbackRegister: unexpected QMgr error, " \
- "could not register Rx single-buffer callback\n", 0, 0, 0, 0, 0, 0);
-
- RX_INC(portId,rxUnexpectedError);
- return (IX_ETH_ACC_INVALID_ARG);
- }
-
- ixEthAccPortData[portId].ixEthAccRxData.rxMultiBufferCallbackInUse = FALSE;
-
- return (IX_ETH_ACC_SUCCESS);
-}
-
-IX_ETH_ACC_PUBLIC
-IxEthAccStatus ixEthAccPortMultiBufferRxCallbackRegister(
- IxEthAccPortId portId,
- IxEthAccPortMultiBufferRxCallback
- rxCallbackFn,
- UINT32 callbackTag)
-{
- IxEthAccPortId port;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
- if (!IX_ETH_ACC_IS_PORT_VALID(portId))
- {
- return (IX_ETH_ACC_INVALID_PORT);
- }
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("ixEthAccPortMultiBufferRxCallbackRegister: Unavailable Eth %d: Cannot register Rx Callback.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /* Check for null function pointer here. */
- if (rxCallbackFn == NULL)
- {
- return (IX_ETH_ACC_INVALID_ARG);
- }
-
- /* Check the user is not changing the callback type
- * when the port is enabled.
- */
- if (ixEthAccMacState[portId].portDisableState == ACTIVE)
- {
- for (port = 0; port < IX_ETH_ACC_NUMBER_OF_PORTS; port++)
- {
- if ((ixEthAccMacState[port].portDisableState == ACTIVE)
- && (ixEthAccPortData[port].ixEthAccRxData.rxMultiBufferCallbackInUse == FALSE))
- {
- /* one of the active ports has a different rx callback type.
- * Changing the callback type when the port is enabled
- * is not safe
- */
- return (IX_ETH_ACC_INVALID_ARG);
- }
- }
- }
-
- /* update the callback pointer : this is done before
- * registering the new qmgr callback
- */
- ixEthAccPortData[portId].ixEthAccRxData.rxMultiBufferCallbackFn = rxCallbackFn;
- ixEthAccPortData[portId].ixEthAccRxData.rxMultiBufferCallbackTag = callbackTag;
-
- /* update the qmgr callback for rx queues */
- if (ixEthAccQMgrRxCallbacksRegister(ixEthRxMultiBufferQMCallback)
- != IX_ETH_ACC_SUCCESS)
- {
- /* unexpected qmgr error */
- RX_INC(portId,rxUnexpectedError);
-
- IX_ETH_ACC_FATAL_LOG("ixEthAccPortMultiBufferRxCallbackRegister: unexpected QMgr error, " \
- "could not register Rx multi-buffer callback\n", 0, 0, 0, 0, 0, 0);
-
- return (IX_ETH_ACC_INVALID_ARG);
- }
-
- ixEthAccPortData[portId].ixEthAccRxData.rxMultiBufferCallbackInUse = TRUE;
-
- return (IX_ETH_ACC_SUCCESS);
-}
-
-IX_ETH_ACC_PUBLIC
-IxEthAccStatus ixEthAccPortTxFrameSubmit(IxEthAccPortId portId,
- IX_OSAL_MBUF *buffer,
- IxEthAccTxPriority priority)
-{
- IX_STATUS qStatus = IX_SUCCESS;
- UINT32 qBuffer;
- IxEthAccTxPriority highestPriority;
- IxQMgrQStatus txQStatus;
-
-#ifndef NDEBUG
- if (buffer == NULL)
- {
- return (IX_ETH_ACC_FAIL);
- }
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
- if (!IX_ETH_ACC_IS_PORT_VALID(portId))
- {
- return (IX_ETH_ACC_INVALID_PORT);
- }
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_FATAL_LOG("ixEthAccPortTxFrameSubmit: Unavailable Eth %d: Cannot submit Tx Frame.\n",
- (INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_PORT_UNINITIALIZED ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
- if ((UINT32)priority > (UINT32)IX_ETH_ACC_TX_PRIORITY_7)
- {
- return (IX_ETH_ACC_INVALID_ARG);
- }
-#endif
-
- /*
- * Need to Flush the MBUF and its contents (data) as it may be
- * read from the NPE. Convert virtual addresses to physical addresses also.
- */
- qBuffer = ixEthAccMbufTxQPrepare(buffer);
-
- /*
- * If no fifo priority set on Xscale ...
- */
- if (ixEthAccPortData[portId].ixEthAccTxData.schDiscipline ==
- FIFO_NO_PRIORITY)
- {
- /*
- * Add The Tx Buffer to the H/W Tx Q if possible
- * (the priority is passed to the NPE, because
- * the NPE is able to reorder the frames
- * before transmission to the underlying hardware)
- */
- qStatus = ixEthAccQmgrTxWrite(portId,
- qBuffer,
- IX_ETH_ACC_TX_DEFAULT_PRIORITY);
-
- if (qStatus == IX_SUCCESS)
- {
- TX_STATS_INC(portId,txQOK);
-
- /*
- * "best case" scenario : Buffer added to h/w Q.
- */
- return (IX_SUCCESS);
- }
- else if (qStatus == IX_QMGR_Q_OVERFLOW)
- {
- /*
- * We were unable to write the buffer to the
- * appropriate H/W Q, Save it in the sw Q.
- * (use the default priority queue regardless of
- * input parameter)
- */
- priority = IX_ETH_ACC_TX_DEFAULT_PRIORITY;
- }
- else
- {
- /* unexpected qmgr error */
- TX_INC(portId,txUnexpectedError);
- IX_ETH_ACC_FATAL_LOG(
- "ixEthAccPortTxFrameSubmit:Error: qStatus = %u\n",
- (UINT32)qStatus, 0, 0, 0, 0, 0);
- return (IX_ETH_ACC_FAIL);
- }
- }
- else if (ixEthAccPortData[portId].ixEthAccTxData.schDiscipline ==
- FIFO_PRIORITY)
- {
-
- /*
- * For priority transmission, put the frame directly on the H/W queue
- * if the H/W queue is empty, otherwise, put it in a S/W Q
- */
- ixQMgrQStatusGet(IX_ETH_ACC_PORT_TO_TX_Q_ID(portId), &txQStatus);
- if((txQStatus & IX_QMGR_Q_STATUS_E_BIT_MASK) != 0)
- {
- /*The tx queue is empty, check whether there are buffers on the s/w queues*/
- if(ixEthAccTxSwQHighestPriorityGet(portId, &highestPriority)
- !=IX_ETH_ACC_FAIL)
- {
- /*there are buffers on the s/w queues, submit them*/
- ixEthAccTxFromSwQ(portId, highestPriority);
-
- /* the queue was empty, 1 buffer is already supplied
- * but is likely to be immediately transmitted and the
- * hw queue is likely to be empty again, so submit
- * more from the sw queues
- */
- if(ixEthAccTxSwQHighestPriorityGet(portId, &highestPriority)
- !=IX_ETH_ACC_FAIL)
- {
- ixEthAccTxFromSwQ(portId, highestPriority);
- /*
- * and force the buffer supplied to be placed
- * on a priority queue
- */
- qStatus = IX_QMGR_Q_OVERFLOW;
- }
- else
- {
- /*there are no buffers in the s/w queues, submit directly*/
- qStatus = ixEthAccQmgrTxWrite(portId, qBuffer, priority);
- }
- }
- else
- {
- /*there are no buffers in the s/w queues, submit directly*/
- qStatus = ixEthAccQmgrTxWrite(portId, qBuffer, priority);
- }
- }
- else
- {
- qStatus = IX_QMGR_Q_OVERFLOW;
- }
- }
- else
- {
- TX_INC(portId,txUnexpectedError);
- IX_ETH_ACC_FATAL_LOG(
- "ixEthAccPortTxFrameSubmit:Error: wrong schedule discipline setup\n",
- 0, 0, 0, 0, 0, 0);
- return (IX_ETH_ACC_FAIL);
- }
-
- if(qStatus == IX_SUCCESS )
- {
- TX_STATS_INC(portId,txQOK);
- return IX_ETH_ACC_SUCCESS;
- }
- else if(qStatus == IX_QMGR_Q_OVERFLOW)
- {
- TX_STATS_INC(portId,txQDelayed);
- /*
- * We were unable to write the buffer to the
- * appropriate H/W Q, Save it in a s/w Q.
- */
- IX_ETH_ACC_DATAPLANE_ADD_MBUF_TO_Q_TAIL(
- ixEthAccPortData[portId].
- ixEthAccTxData.txQ[priority],
- buffer);
-
- qStatus = ixQMgrNotificationEnable(
- IX_ETH_ACC_PORT_TO_TX_Q_ID(portId),
- IX_ETH_ACC_PORT_TO_TX_Q_SOURCE(portId));
-
- if (qStatus != IX_SUCCESS)
- {
- if (qStatus == IX_QMGR_WARNING)
- {
- /* notification is enabled for a queue
- * which is already empty (the condition is already met)
- * and there will be no more queue event to drain the sw queue
- */
- TX_STATS_INC(portId,txLateNotificationEnabled);
-
- /* pull a buffer from the sw queue */
- if(ixEthAccTxSwQHighestPriorityGet(portId, &highestPriority)
- !=IX_ETH_ACC_FAIL)
- {
- /*there are buffers on the s/w queues, submit from them*/
- ixEthAccTxFromSwQ(portId, highestPriority);
- }
- }
- else
- {
- TX_INC(portId,txUnexpectedError);
- IX_ETH_ACC_FATAL_LOG(
- "ixEthAccPortTxFrameSubmit: unexpected Error: %u\n",
- qStatus, 0, 0, 0, 0, 0);
- }
- }
- }
- else
- {
- TX_INC(portId,txUnexpectedError);
- IX_ETH_ACC_FATAL_LOG(
- "ixEthAccPortTxFrameSubmit: unexpected Error: %u\n",
- qStatus, 0, 0, 0, 0, 0);
- return (IX_ETH_ACC_FAIL);
- }
-
- return (IX_ETH_ACC_SUCCESS);
-}
-
-
-/**
- *
- * @brief replenish: convert a chain of mbufs to the format
- * expected by the NPE
- *
- */
-
-IX_ETH_ACC_PUBLIC
-IxEthAccStatus ixEthAccPortRxFreeReplenish(IxEthAccPortId portId,
- IX_OSAL_MBUF *buffer)
-{
- IX_STATUS qStatus = IX_SUCCESS;
- UINT32 qBuffer;
-
- /*
- * Check buffer is valid.
- */
-
-#ifndef NDEBUG
- /* check parameter value */
- if (buffer == 0)
- {
- return (IX_ETH_ACC_FAIL);
- }
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
- if (!IX_ETH_ACC_IS_PORT_VALID(portId))
- {
- return (IX_ETH_ACC_INVALID_PORT);
- }
-
- /* check initialisation is done */
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_FATAL_LOG(" ixEthAccPortRxFreeReplenish: Unavailable Eth %d: Cannot replenish Rx Free Q.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_PORT_UNINITIALIZED ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
- /* check boundaries and constraints */
- if (IX_OSAL_MBUF_MLEN(buffer) < IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MIN)
- {
- return (IX_ETH_ACC_FAIL);
- }
-#endif
-
- qBuffer = ixEthAccMbufRxQPrepare(buffer);
-
- /*
- * Add The Rx Buffer to the H/W Free buffer Q if possible
- */
- qStatus = ixEthAccQmgrLockRxWrite(portId, qBuffer);
-
- if (qStatus == IX_SUCCESS)
- {
- RX_STATS_INC(portId,rxFreeRepOK);
- /*
- * Buffer added to h/w Q.
- */
- return (IX_SUCCESS);
- }
- else if (qStatus == IX_QMGR_Q_OVERFLOW)
- {
- RX_STATS_INC(portId,rxFreeRepDelayed);
- /*
- * We were unable to write the buffer to the approprate H/W Q,
- * Save it in a s/w Q.
- */
- IX_ETH_ACC_DATAPLANE_ADD_MBUF_TO_Q_TAIL(
- ixEthAccPortData[portId].ixEthAccRxData.freeBufferList,
- buffer);
-
- qStatus = ixQMgrNotificationEnable(
- IX_ETH_ACC_PORT_TO_RX_FREE_Q_ID(portId),
- IX_ETH_ACC_PORT_TO_RX_FREE_Q_SOURCE(portId));
-
- if (qStatus != IX_SUCCESS)
- {
- if (qStatus == IX_QMGR_WARNING)
- {
- /* notification is enabled for a queue
- * which is already empty (the condition is already met)
- * and there will be no more queue event to drain the sw queue
- * move an entry from the sw queue to the hw queue */
- RX_STATS_INC(portId,rxFreeLateNotificationEnabled);
- ixEthAccRxFreeFromSwQ(portId);
- }
- else
- {
- RX_INC(portId,rxUnexpectedError);
- IX_ETH_ACC_FATAL_LOG(
- "ixEthAccRxPortFreeReplenish:Error: %u\n",
- qStatus, 0, 0, 0, 0, 0);
- }
- }
- }
- else
- {
- RX_INC(portId,rxUnexpectedError);
- IX_ETH_ACC_FATAL_LOG(
- "ixEthAccRxPortFreeReplenish:Error: qStatus = %u\n",
- (UINT32)qStatus, 0, 0, 0, 0, 0);
- return(IX_ETH_ACC_FAIL);
- }
- return (IX_ETH_ACC_SUCCESS);
-}
-
-
-IX_ETH_ACC_PUBLIC
-IxEthAccStatus ixEthAccTxSchedulingDisciplineSetPriv(IxEthAccPortId portId,
- IxEthAccSchedulerDiscipline
- sched)
-{
- if (!IX_ETH_ACC_IS_PORT_VALID(portId))
- {
- return (IX_ETH_ACC_INVALID_PORT);
- }
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("ixEthAccTxSchedulingDisciplineSet: Unavailable Eth %d: Cannot set Tx Scheduling Discipline.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- if (sched != FIFO_PRIORITY && sched != FIFO_NO_PRIORITY)
- {
- return (IX_ETH_ACC_INVALID_ARG);
- }
-
- ixEthAccPortData[portId].ixEthAccTxData.schDiscipline = sched;
- return (IX_ETH_ACC_SUCCESS);
-}
-
-IX_ETH_ACC_PUBLIC
-IxEthAccStatus ixEthAccRxSchedulingDisciplineSetPriv(IxEthAccSchedulerDiscipline
- sched)
-{
- if (sched != FIFO_PRIORITY && sched != FIFO_NO_PRIORITY)
- {
- return (IX_ETH_ACC_INVALID_ARG);
- }
-
- ixEthAccDataInfo.schDiscipline = sched;
-
- return (IX_ETH_ACC_SUCCESS);
-}
-
-
-/**
- * @fn ixEthRxFrameProcess(IxEthAccPortId portId, IX_OSAL_MBUF *mbufPtr)
- *
- * @brief process incoming frame :
- *
- * @param @ref IxQMgrCallback IxQMgrMultiBufferCallback
- *
- * @return none
- *
- * @internal
- *
- */
-IX_ETH_ACC_PRIVATE BOOL
-ixEthRxFrameProcess(IxEthAccPortId portId, IX_OSAL_MBUF *mbufPtr)
-{
- UINT32 flags;
- IxEthDBStatus result;
-
-#ifndef NDEBUG
- /* Prudent to at least check the port is within range */
- if (portId >= IX_ETH_ACC_NUMBER_OF_PORTS)
- {
- ixEthAccDataStats.unexpectedError++;
- IX_ETH_ACC_FATAL_LOG(
- "ixEthRxFrameProcess: Illegal port: %u\n",
- (UINT32)portId, 0, 0, 0, 0, 0);
- return FALSE;
- }
-#endif
-
- /* convert fields from mbuf header */
- ixEthAccMbufFromRxQ(mbufPtr);
-
- /* check about any special processing for this frame */
- flags = IX_ETHACC_NE_FLAGS(mbufPtr);
- if ((flags & (IX_ETHACC_NE_FILTERMASK | IX_ETHACC_NE_NEWSRCMASK)) == 0)
- {
- /* "best case" scenario : nothing special to do for this frame */
- return TRUE;
- }
-
-#ifdef CONFIG_IXP425_COMPONENT_ETHDB
- /* if a new source MAC address is detected by the NPE,
- * update IxEthDB with the portId and the MAC address.
- */
- if ((flags & IX_ETHACC_NE_NEWSRCMASK & ixEthAccNewSrcMask) != 0)
- {
- result = ixEthDBFilteringDynamicEntryProvision(portId,
- (IxEthDBMacAddr *) IX_ETHACC_NE_SOURCEMAC(mbufPtr));
-
- if (result != IX_ETH_DB_SUCCESS && result != IX_ETH_DB_FEATURE_UNAVAILABLE)
- {
- if ((ixEthAccMacState[portId].portDisableState == ACTIVE) && (result != IX_ETH_DB_BUSY))
- {
- RX_STATS_INC(portId, rxUnexpectedError);
- IX_ETH_ACC_FATAL_LOG("ixEthRxFrameProcess: Failed to add source MAC \
- to the Learning/Filtering database\n", 0, 0, 0, 0, 0, 0);
- }
- else
- {
- /* we expect this to fail during PortDisable, as EthDB is disabled for
- * that port and will refuse to learn new addresses
- */
- }
- }
- else
- {
- RX_STATS_INC(portId, rxUnlearnedMacAddress);
- }
- }
-#endif
-
- /* check if this frame should have been filtered
- * by the NPE and take the appropriate action
- */
- if (((flags & IX_ETHACC_NE_FILTERMASK) != 0)
- && (ixEthAccMacState[portId].portDisableState == ACTIVE))
- {
- /* If the mbuf was allocated with a small data size, or the current data pointer is not
- * within the allocated data area, then the buffer is non-standard and has to be
- * replenished with the minimum size only
- */
- if( (IX_OSAL_MBUF_ALLOCATED_BUFF_LEN(mbufPtr) < IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MIN)
- || ((UINT8 *)IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(mbufPtr) > IX_OSAL_MBUF_MDATA(mbufPtr))
- || ((UINT8 *)(IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(mbufPtr) +
- IX_OSAL_MBUF_ALLOCATED_BUFF_LEN(mbufPtr))
- < IX_OSAL_MBUF_MDATA(mbufPtr)) )
- {
- /* set to minimum length */
- IX_OSAL_MBUF_MLEN(mbufPtr) = IX_OSAL_MBUF_PKT_LEN(mbufPtr) =
- IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MIN;
- }
- else
- {
- /* restore original length */
- IX_OSAL_MBUF_MLEN(mbufPtr) = IX_OSAL_MBUF_PKT_LEN(mbufPtr) =
- ( IX_OSAL_MBUF_ALLOCATED_BUFF_LEN(mbufPtr) -
- (IX_OSAL_MBUF_MDATA(mbufPtr) - (UINT8 *)IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(mbufPtr)) );
- }
-
- /* replenish from here */
- if (ixEthAccPortRxFreeReplenish(portId, mbufPtr) != IX_ETH_ACC_SUCCESS)
- {
- IX_ETH_ACC_FATAL_LOG("ixEthRxFrameProcess: Failed to replenish with filtered frame\
- on port %d\n", portId, 0, 0, 0, 0, 0);
- }
-
- RX_STATS_INC(portId, rxFiltered);
-
- /* indicate that frame should not be subjected to further processing */
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/**
- * @fn ixEthRxFrameQMCallback
- *
- * @brief receive callback for Frame receive Q from NPE
- *
- * Frames are passed one-at-a-time to the user
- *
- * @param @ref IxQMgrCallback
- *
- * @return none
- *
- * @internal
- *
- * Design note : while processing the entry X, entry X+1 is preloaded
- * into memory to reduce the number of stall cycles
- *
- */
-void ixEthRxFrameQMCallback(IxQMgrQId qId, IxQMgrCallbackId callbackId)
-{
- IX_OSAL_MBUF *mbufPtr;
- IX_OSAL_MBUF *nextMbufPtr;
- UINT32 qEntry;
- UINT32 nextQEntry;
- UINT32 *qEntryPtr;
- UINT32 portId;
- UINT32 destPortId;
- UINT32 npeId;
- UINT32 rxQReadStatus;
-
- /*
- * Design note : entries are read in a buffer, This buffer contains
- * an extra zeroed entry so the loop will
- * always terminate on a null entry, whatever the result of Burst read is.
- */
- UINT32 rxQEntry[IX_ETH_ACC_MAX_RX_FRAME_CONSUME_PER_CALLBACK + 1];
-
- /*
- * Indication of the number of times the callback is used.
- */
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.rxCallbackCounter);
-
- do
- {
- /*
- * Indication of the number of times the queue is drained
- */
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.rxCallbackBurstRead);
-
- /* ensure the last entry of the array contains a zeroed value */
- qEntryPtr = rxQEntry;
- qEntryPtr[IX_ETH_ACC_MAX_RX_FRAME_CONSUME_PER_CALLBACK] = 0;
-
- rxQReadStatus = ixQMgrQBurstRead(qId,
- IX_ETH_ACC_MAX_RX_FRAME_CONSUME_PER_CALLBACK,
- qEntryPtr);
-
-#ifndef NDEBUG
- if ((rxQReadStatus != IX_QMGR_Q_UNDERFLOW)
- && (rxQReadStatus != IX_SUCCESS))
- {
- ixEthAccDataStats.unexpectedError++;
- /*major error*/
- IX_ETH_ACC_FATAL_LOG(
- "ixEthRxFrameQMCallback:Error: %u\n",
- (UINT32)rxQReadStatus, 0, 0, 0, 0, 0);
- return;
- }
-#endif
-
- /* convert and preload the next entry
- * (the conversion function takes care about null pointers which
- * are used to mark the end of the loop)
- */
- nextQEntry = *qEntryPtr;
- nextMbufPtr = ixEthAccEntryFromQConvert(nextQEntry,
- IX_ETHNPE_QM_Q_RXENET_ADDR_MASK);
-
- while(nextQEntry != 0)
- {
- /* get the next entry */
- qEntry = nextQEntry;
- mbufPtr = nextMbufPtr;
-
-#ifndef NDEBUG
- if (mbufPtr == NULL)
- {
- ixEthAccDataStats.unexpectedError++;
- IX_ETH_ACC_FATAL_LOG(
- "ixEthRxFrameQMCallback: Null Mbuf Ptr\n",
- 0, 0, 0, 0, 0, 0);
- return;
- }
-#endif
-
- /* convert the next entry
- * (the conversion function takes care about null pointers which
- * are used to mark the end of the loop)
- */
- nextQEntry = *(++qEntryPtr);
- nextMbufPtr = ixEthAccEntryFromQConvert(nextQEntry,
- IX_ETHNPE_QM_Q_RXENET_ADDR_MASK);
-
- /*
- * Get Port and Npe ID from message.
- */
- npeId = ((IX_ETHNPE_QM_Q_RXENET_NPEID_MASK &
- qEntry) >> IX_ETHNPE_QM_Q_FIELD_NPEID_R);
- portId = IX_ETH_ACC_NPE_TO_PORT_ID(npeId);
-
- /* process frame, check the return code and skip the remaining of
- * the loop if the frame is to be filtered out
- */
- if (ixEthRxFrameProcess(portId, mbufPtr))
- {
- /* destination portId for this packet */
- destPortId = IX_ETHACC_NE_DESTPORTID(mbufPtr);
-
- if (destPortId != IX_ETH_DB_UNKNOWN_PORT)
- {
- destPortId = IX_ETH_DB_NPE_LOGICAL_ID_TO_PORT_ID(destPortId);
- }
-
- /* test if QoS is enabled in ethAcc
- */
- if (ixEthAccDataInfo.schDiscipline == FIFO_PRIORITY)
- {
- /* check if there is a higher priority queue
- * which may require processing and then process it.
- */
- if (ixEthAccDataInfo.higherPriorityQueue[qId] < IX_QMGR_MAX_NUM_QUEUES)
- {
- ixEthRxFrameQMCallback(ixEthAccDataInfo.higherPriorityQueue[qId],
- callbackId);
- }
- }
-
- /*
- * increment priority stats
- */
- RX_STATS_INC(portId,rxPriority[IX_ETHACC_NE_QOS(mbufPtr)]);
-
- /*
- * increment callback count stats
- */
- RX_STATS_INC(portId,rxFrameClientCallback);
-
- /*
- * Call user level callback.
- */
- ixEthAccPortData[portId].ixEthAccRxData.rxCallbackFn(
- ixEthAccPortData[portId].ixEthAccRxData.rxCallbackTag,
- mbufPtr,
- destPortId);
- }
- }
- } while (rxQReadStatus == IX_SUCCESS);
-}
-
-/**
- * @fn ixEthRxMultiBufferQMCallback
- *
- * @brief receive callback for Frame receive Q from NPE
- *
- * Frames are passed as an array to the user
- *
- * @param @ref IxQMgrCallback
- *
- * @return none
- *
- * @internal
- *
- * Design note : while processing the entry X, entry X+1 is preloaded
- * into memory to reduce the number of stall cycles
- *
- */
-void ixEthRxMultiBufferQMCallback(IxQMgrQId qId, IxQMgrCallbackId callbackId)
-{
- IX_OSAL_MBUF *mbufPtr;
- IX_OSAL_MBUF *nextMbufPtr;
- UINT32 qEntry;
- UINT32 nextQEntry;
- UINT32 *qEntryPtr;
- UINT32 portId;
- UINT32 npeId;
- UINT32 rxQReadStatus;
- /*
- * Design note : entries are read in a static buffer, This buffer contains
- * an extra zeroed entry so the loop will
- * always terminate on a null entry, whatever the result of Burst read is.
- */
- static UINT32 rxQEntry[IX_ETH_ACC_MAX_RX_FRAME_CONSUME_PER_CALLBACK + 1];
- static IX_OSAL_MBUF *rxMbufPortArray[IX_ETH_ACC_NUMBER_OF_PORTS][IX_ETH_ACC_MAX_RX_FRAME_CONSUME_PER_CALLBACK + 1];
- IX_OSAL_MBUF **rxMbufPtr[IX_ETH_ACC_NUMBER_OF_PORTS];
-
- for (portId = 0; portId < IX_ETH_ACC_NUMBER_OF_PORTS; portId++)
- {
- rxMbufPtr[portId] = rxMbufPortArray[portId];
- }
-
- /*
- * Indication of the number of times the callback is used.
- */
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.rxCallbackCounter);
-
- do
- {
- /*
- * Indication of the number of times the queue is drained
- */
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.rxCallbackBurstRead);
-
- /* ensure the last entry of the array contains a zeroed value */
- qEntryPtr = rxQEntry;
- qEntryPtr[IX_ETH_ACC_MAX_RX_FRAME_CONSUME_PER_CALLBACK] = 0;
-
- rxQReadStatus = ixQMgrQBurstRead(qId,
- IX_ETH_ACC_MAX_RX_FRAME_CONSUME_PER_CALLBACK,
- qEntryPtr);
-
-#ifndef NDEBUG
- if ((rxQReadStatus != IX_QMGR_Q_UNDERFLOW)
- && (rxQReadStatus != IX_SUCCESS))
- {
- ixEthAccDataStats.unexpectedError++;
- /*major error*/
- IX_ETH_ACC_FATAL_LOG(
- "ixEthRxFrameMultiBufferQMCallback:Error: %u\n",
- (UINT32)rxQReadStatus, 0, 0, 0, 0, 0);
- return;
- }
-#endif
-
- /* convert and preload the next entry
- * (the conversion function takes care about null pointers which
- * are used to mark the end of the loop)
- */
- nextQEntry = *qEntryPtr;
- nextMbufPtr = ixEthAccEntryFromQConvert(nextQEntry,
- IX_ETHNPE_QM_Q_RXENET_ADDR_MASK);
-
- while(nextQEntry != 0)
- {
- /* get the next entry */
- qEntry = nextQEntry;
- mbufPtr = nextMbufPtr;
-
-#ifndef NDEBUG
- if (mbufPtr == NULL)
- {
- ixEthAccDataStats.unexpectedError++;
- IX_ETH_ACC_FATAL_LOG(
- "ixEthRxFrameMultiBufferQMCallback:Error: Null Mbuf Ptr\n",
- 0, 0, 0, 0, 0, 0);
- return;
- }
-#endif
-
- /* convert the next entry
- * (the conversion function takes care about null pointers which
- * are used to mark the end of the loop)
- */
- nextQEntry = *(++qEntryPtr);
- nextMbufPtr = ixEthAccEntryFromQConvert(nextQEntry,
- IX_ETHNPE_QM_Q_RXENET_ADDR_MASK);
-
- /*
- * Get Port and Npe ID from message.
- */
- npeId = ((IX_ETHNPE_QM_Q_RXENET_NPEID_MASK &
- qEntry) >>
- IX_ETHNPE_QM_Q_FIELD_NPEID_R);
- portId = IX_ETH_ACC_NPE_TO_PORT_ID(npeId);
-
- /* skip the remaining of the loop if the frame is
- * to be filtered out
- */
- if (ixEthRxFrameProcess(portId, mbufPtr))
- {
- /* store a mbuf pointer in an array */
- *rxMbufPtr[portId]++ = mbufPtr;
-
- /*
- * increment priority stats
- */
- RX_STATS_INC(portId,rxPriority[IX_ETHACC_NE_QOS(mbufPtr)]);
- }
-
- /* test for QoS enabled in ethAcc */
- if (ixEthAccDataInfo.schDiscipline == FIFO_PRIORITY)
- {
- /* check if there is a higher priority queue
- * which may require processing and then process it.
- */
- if (ixEthAccDataInfo.higherPriorityQueue[qId] < IX_QMGR_MAX_NUM_QUEUES)
- {
- ixEthRxMultiBufferQMCallback(ixEthAccDataInfo.higherPriorityQueue[qId],
- callbackId);
- }
- }
- }
-
- /* check if any of the the arrays contains any entry */
- for (portId = 0; portId < IX_ETH_ACC_NUMBER_OF_PORTS; portId++)
- {
- if (rxMbufPtr[portId] != rxMbufPortArray[portId])
- {
- /* add a last NULL pointer at the end of the
- * array of mbuf pointers
- */
- *rxMbufPtr[portId] = NULL;
-
- /*
- * increment callback count stats
- */
- RX_STATS_INC(portId,rxFrameClientCallback);
-
- /*
- * Call user level callback with an array of
- * buffers (NULL terminated)
- */
- ixEthAccPortData[portId].ixEthAccRxData.
- rxMultiBufferCallbackFn(
- ixEthAccPortData[portId].ixEthAccRxData.
- rxMultiBufferCallbackTag,
- rxMbufPortArray[portId]);
-
- /* reset the buffer pointer to the beginning of
- * the array
- */
- rxMbufPtr[portId] = rxMbufPortArray[portId];
- }
- }
-
- } while (rxQReadStatus == IX_SUCCESS);
-}
-
-
-/**
- * @brief rxFree low event handler
- *
- */
-void ixEthRxFreeQMCallback(IxQMgrQId qId, IxQMgrCallbackId callbackId)
-{
- IxEthAccPortId portId = (IxEthAccPortId) callbackId;
- int lockVal;
- UINT32 maxQWritesToPerform = IX_ETH_ACC_MAX_RX_FREE_BUFFERS_LOAD;
- IX_STATUS qStatus = IX_SUCCESS;
-
- /*
- * We have reached a low threshold on one of the Rx Free Qs
- */
-
- /*note that due to the fact that we are working off an Empty threshold, this callback
- need only write a single entry to the Rx Free queue in order to re-arm the notification
- */
-
- RX_STATS_INC(portId,rxFreeLowCallback);
-
- /*
- * Get buffers from approprite S/W Rx freeBufferList Q.
- */
-
-#ifndef NDEBUG
- if (!IX_ETH_ACC_IS_PORT_VALID(portId))
- {
- ixEthAccDataStats.unexpectedError++;
- IX_ETH_ACC_FATAL_LOG(
- "ixEthRxFreeQMCallback:Error: Invalid Port 0x%08X\n",
- portId, 0, 0, 0, 0, 0);
- return;
- }
-#endif
- IX_ETH_ACC_DATA_PLANE_LOCK(lockVal);
- if (IX_ETH_ACC_DATAPLANE_IS_Q_EMPTY(ixEthAccPortData[portId].
- ixEthAccRxData.freeBufferList))
- {
- /*
- * Turn off Q callback notification for Q in Question.
- */
- qStatus = ixQMgrNotificationDisable(
- IX_ETH_ACC_PORT_TO_RX_FREE_Q_ID(portId));
-
-
- IX_ETH_ACC_DATA_PLANE_UNLOCK(lockVal);
-
- if (qStatus != IX_SUCCESS)
- {
- RX_INC(portId,rxUnexpectedError);
- IX_ETH_ACC_FATAL_LOG(
- "ixEthRxFreeQMCallback:Error: unexpected QM status 0x%08X\n",
- qStatus, 0, 0, 0, 0, 0);
- return;
- }
- }
- else
- {
- IX_ETH_ACC_DATA_PLANE_UNLOCK(lockVal);
- /*
- * Load the H/W Q with buffers from the s/w Q.
- */
-
- do
- {
- /*
- * Consume Q entries. - Note Q contains Physical addresss,
- * and have already been flushed to memory,
- * And endianess converted if required.
- */
- if (ixEthAccRxFreeFromSwQ(portId) != IX_SUCCESS)
- {
- /*
- * No more entries in s/w Q.
- * Turn off Q callback indication
- */
-
- IX_ETH_ACC_DATA_PLANE_LOCK(lockVal);
- if (IX_ETH_ACC_DATAPLANE_IS_Q_EMPTY(ixEthAccPortData[portId].
- ixEthAccRxData.freeBufferList))
- {
- qStatus = ixQMgrNotificationDisable(
- IX_ETH_ACC_PORT_TO_RX_FREE_Q_ID(portId));
- }
- IX_ETH_ACC_DATA_PLANE_UNLOCK(lockVal);
- break;
- }
- }
- while (--maxQWritesToPerform);
- }
-}
-/**
- * @fn Tx queue low event handler
- *
- */
-void
-ixEthTxFrameQMCallback(IxQMgrQId qId, IxQMgrCallbackId callbackId)
-{
- IxEthAccPortId portId = (IxEthAccPortId) callbackId;
- int lockVal;
- UINT32 maxQWritesToPerform = IX_ETH_ACC_MAX_TX_FRAME_TX_CONSUME_PER_CALLBACK;
- IX_STATUS qStatus = IX_SUCCESS;
- IxEthAccTxPriority highestPriority;
-
-
- /*
- * We have reached a low threshold on the Tx Q, and are being asked to
- * supply a buffer for transmission from our S/W TX queues
- */
- TX_STATS_INC(portId,txLowThreshCallback);
-
- /*
- * Get buffers from approprite Q.
- */
-
-#ifndef NDEBUG
- if (!IX_ETH_ACC_IS_PORT_VALID(portId))
- {
- ixEthAccDataStats.unexpectedError++;
- IX_ETH_ACC_FATAL_LOG(
- "ixEthTxFrameQMCallback:Error: Invalid Port 0x%08X\n",
- portId, 0, 0, 0, 0, 0);
- return;
- }
-#endif
-
- do
- {
- /*
- * Consume Q entries. - Note Q contains Physical addresss,
- * and have already been flushed to memory,
- * and endianess already sone if required.
- */
-
- IX_ETH_ACC_DATA_PLANE_LOCK(lockVal);
-
- if(ixEthAccTxSwQHighestPriorityGet(portId, &highestPriority) ==
- IX_ETH_ACC_FAIL)
- {
- /*
- * No more entries in s/w Q.
- * Turn off Q callback indication
- */
- qStatus = ixQMgrNotificationDisable(
- IX_ETH_ACC_PORT_TO_TX_Q_ID(portId));
-
- IX_ETH_ACC_DATA_PLANE_UNLOCK(lockVal);
-
- if (qStatus != IX_SUCCESS)
- {
- ixEthAccDataStats.unexpectedError++;
- IX_ETH_ACC_FATAL_LOG(
- "ixEthTxFrameQMCallback:Error: unexpected QM status 0x%08X\n",
- qStatus, 0, 0, 0, 0, 0);
- }
-
- return;
- }
- else
- {
- IX_ETH_ACC_DATA_PLANE_UNLOCK(lockVal);
- if (ixEthAccTxFromSwQ(portId,highestPriority)!=IX_SUCCESS)
- {
- /* nothing left in the sw queue or the hw queues are
- * full. There is no point to continue to drain the
- * sw queues
- */
- return;
- }
- }
- }
- while (--maxQWritesToPerform);
-}
-
-/**
- * @brief TxDone event handler
- *
- * Design note : while processing the entry X, entry X+1 is preloaded
- * into memory to reduce the number of stall cycles
- *
- */
-
-void
-ixEthTxFrameDoneQMCallback(IxQMgrQId qId, IxQMgrCallbackId callbackId)
-{
- IX_OSAL_MBUF *mbufPtr;
- UINT32 qEntry;
- UINT32 *qEntryPtr;
- UINT32 txDoneQReadStatus;
- UINT32 portId;
- UINT32 npeId;
-
- /*
- * Design note : entries are read in a static buffer, This buffer contains
- * an extra entyry (which is zeroed by the compiler), so the loop will
- * always terminate on a null entry, whatever the result of Burst read is.
- */
- static UINT32 txDoneQEntry[IX_ETH_ACC_MAX_TX_FRAME_DONE_CONSUME_PER_CALLBACK + 1];
-
- /*
- * Indication that Tx frames have been transmitted from the NPE.
- */
-
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.txDoneCallbackCounter);
-
- do{
- qEntryPtr = txDoneQEntry;
- txDoneQReadStatus = ixQMgrQBurstRead(IX_ETH_ACC_TX_FRAME_DONE_ETH_Q,
- IX_ETH_ACC_MAX_TX_FRAME_DONE_CONSUME_PER_CALLBACK,
- qEntryPtr);
-
-#ifndef NDEBUG
- if (txDoneQReadStatus != IX_QMGR_Q_UNDERFLOW
- && (txDoneQReadStatus != IX_SUCCESS))
- {
- /*major error*/
- ixEthAccDataStats.unexpectedError++;
- IX_ETH_ACC_FATAL_LOG(
- "ixEthTxFrameDoneQMCallback:Error: %u\n",
- (UINT32)txDoneQReadStatus, 0, 0, 0, 0, 0);
- return;
- }
-#endif
-
- qEntry = *qEntryPtr;
-
- while(qEntry != 0)
- {
- mbufPtr = ixEthAccEntryFromQConvert(qEntry,
- IX_ETHNPE_QM_Q_TXENET_ADDR_MASK);
-
-#ifndef NDEBUG
- if (mbufPtr == NULL)
- {
- ixEthAccDataStats.unexpectedError++;
- IX_ETH_ACC_FATAL_LOG(
- "ixEthTxFrameDoneQMCallback:Error: Null Mbuf Ptr\n",
- 0, 0, 0, 0, 0, 0);
- return;
- }
-#endif
-
- /* endianness conversions and stats updates */
- ixEthAccMbufFromTxQ(mbufPtr);
-
- /*
- * Get NPE id from message, then convert to portId.
- */
- npeId = ((IX_ETHNPE_QM_Q_TXENETDONE_NPEID_MASK &
- qEntry) >>
- IX_ETHNPE_QM_Q_FIELD_NPEID_R);
- portId = IX_ETH_ACC_NPE_TO_PORT_ID(npeId);
-
-#ifndef NDEBUG
- /* Prudent to at least check the port is within range */
- if (portId >= IX_ETH_ACC_NUMBER_OF_PORTS)
- {
- ixEthAccDataStats.unexpectedError++;
- IX_ETH_ACC_FATAL_LOG(
- "ixEthTxFrameDoneQMCallback: Illegal port: %u\n",
- (UINT32)portId, 0, 0, 0, 0, 0);
- return;
- }
-#endif
-
- TX_STATS_INC(portId,txDoneClientCallback);
-
- /*
- * Call user level callback.
- */
- ixEthAccPortData[portId].ixEthAccTxData.txBufferDoneCallbackFn(
- ixEthAccPortData[portId].ixEthAccTxData.txCallbackTag,
- mbufPtr);
-
- /* move to next queue entry */
- qEntry = *(++qEntryPtr);
-
- }
- } while( txDoneQReadStatus == IX_SUCCESS );
-}
-
-IX_ETH_ACC_PUBLIC
-void ixEthAccDataPlaneShow(void)
-{
- UINT32 numTx0Entries;
- UINT32 numTx1Entries;
- UINT32 numTxDoneEntries;
- UINT32 numRxEntries;
- UINT32 numRxFree0Entries;
- UINT32 numRxFree1Entries;
- UINT32 portId;
-#ifdef __ixp46X
- UINT32 numTx2Entries;
- UINT32 numRxFree2Entries;
-#endif
-#ifndef NDEBUG
- UINT32 priority;
- UINT32 numBuffersInRx=0;
- UINT32 numBuffersInTx=0;
- UINT32 numBuffersInSwQ=0;
- UINT32 totalBuffers=0;
- UINT32 rxFreeCallbackCounter = 0;
- UINT32 txCallbackCounter = 0;
-#endif
- UINT32 key;
-
- /* snapshot of stats */
- IxEthAccTxDataStats tx[IX_ETH_ACC_NUMBER_OF_PORTS];
- IxEthAccRxDataStats rx[IX_ETH_ACC_NUMBER_OF_PORTS];
- IxEthAccDataPlaneStats stats;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return;
- }
-
- /* get a reliable snapshot */
- key = ixOsalIrqLock();
-
- numTx0Entries = 0;
- ixQMgrQNumEntriesGet(IX_ETH_ACC_TX_FRAME_ENET0_Q, &numTx0Entries);
- numTx1Entries = 0;
- ixQMgrQNumEntriesGet(IX_ETH_ACC_TX_FRAME_ENET1_Q, &numTx1Entries);
- numTxDoneEntries = 0;
- ixQMgrQNumEntriesGet( IX_ETH_ACC_TX_FRAME_DONE_ETH_Q, &numTxDoneEntries);
- numRxEntries = 0;
- ixEthAccQMgrRxQEntryGet(&numRxEntries);
- numRxFree0Entries = 0;
- ixQMgrQNumEntriesGet(IX_ETH_ACC_RX_FREE_BUFF_ENET0_Q, &numRxFree0Entries);
- numRxFree1Entries = 0;
- ixQMgrQNumEntriesGet(IX_ETH_ACC_RX_FREE_BUFF_ENET1_Q, &numRxFree1Entries);
-
-#ifdef __ixp46X
- numTx2Entries = 0;
- ixQMgrQNumEntriesGet(IX_ETH_ACC_TX_FRAME_ENET2_Q, &numTx2Entries);
- numRxFree2Entries = 0;
- ixQMgrQNumEntriesGet(IX_ETH_ACC_RX_FREE_BUFF_ENET2_Q, &numRxFree2Entries);
-#endif
-
- for(portId=IX_ETH_PORT_1; portId < IX_ETH_ACC_NUMBER_OF_PORTS; portId++)
- {
- memcpy(&tx[portId],
- &ixEthAccPortData[portId].ixEthAccTxData.stats,
- sizeof(tx[portId]));
- memcpy(&rx[portId],
- &ixEthAccPortData[portId].ixEthAccRxData.stats,
- sizeof(rx[portId]));
- }
- memcpy(&stats, &ixEthAccDataStats, sizeof(stats));
-
- ixOsalIrqUnlock(key);
-
-#ifdef NDEBUG
- printf("Detailed statistics collection not supported in this load\n");
-#endif
-
- /* print snapshot */
- for(portId=0; portId < IX_ETH_ACC_NUMBER_OF_PORTS; portId++)
- {
- /* If not IXP42X A0 stepping, proceed to check for existence of coprocessors */
- if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
- (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
- || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
- {
- if ((IX_ETH_PORT_1 == portId) &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH0) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- continue ;
- }
- if ((IX_ETH_PORT_2 == portId) &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH1) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- continue ;
- }
- if ((IX_ETH_PORT_3 == portId) &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA_ETH) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- continue ;
- }
- }
-
- printf("PORT %u --------------------------------\n",
- portId);
-#ifndef NDEBUG
- printf("Tx Done Frames : %u\n",
- tx[portId].txDoneClientCallback +
- tx[portId].txDoneSwQDuringDisable +
- tx[portId].txDoneDuringDisable);
- printf("Tx Frames : %u\n",
- tx[portId].txQOK + tx[portId].txQDelayed);
- printf("Tx H/W Q Added OK : %u\n",
- tx[portId].txQOK);
- printf("Tx H/W Q Delayed : %u\n",
- tx[portId].txQDelayed);
- printf("Tx From S/W Q Added OK : %u\n",
- tx[portId].txFromSwQOK);
- printf("Tx From S/W Q Delayed : %u\n",
- tx[portId].txFromSwQDelayed);
- printf("Tx Overflow : %u\n",
- tx[portId].txOverflow);
- printf("Tx Mutual Lock : %u\n",
- tx[portId].txLock);
- printf("Tx Late Ntf Enabled : %u\n",
- tx[portId].txLateNotificationEnabled);
- printf("Tx Low Thresh CB : %u\n",
- tx[portId].txLowThreshCallback);
- printf("Tx Done from H/W Q (Disable) : %u\n",
- tx[portId].txDoneDuringDisable);
- printf("Tx Done from S/W Q (Disable) : %u\n",
- tx[portId].txDoneSwQDuringDisable);
- for (priority = IX_ETH_ACC_TX_PRIORITY_0;
- priority <= IX_ETH_ACC_TX_PRIORITY_7;
- priority++)
- {
- if (tx[portId].txPriority[priority])
- {
- printf("Tx Priority %u : %u\n",
- priority,
- tx[portId].txPriority[priority]);
- }
- }
-#endif
- printf("Tx unexpected errors : %u (should be 0)\n",
- tx[portId].txUnexpectedError);
-
-#ifndef NDEBUG
- printf("Rx Frames : %u\n",
- rx[portId].rxFrameClientCallback +
- rx[portId].rxSwQDuringDisable+
- rx[portId].rxDuringDisable);
- printf("Rx Free Replenish : %u\n",
- rx[portId].rxFreeRepOK + rx[portId].rxFreeRepDelayed);
- printf("Rx Free H/W Q Added OK : %u\n",
- rx[portId].rxFreeRepOK);
- printf("Rx Free H/W Q Delayed : %u\n",
- rx[portId].rxFreeRepDelayed);
- printf("Rx Free From S/W Q Added OK : %u\n",
- rx[portId].rxFreeRepFromSwQOK);
- printf("Rx Free From S/W Q Delayed : %u\n",
- rx[portId].rxFreeRepFromSwQDelayed);
- printf("Rx Free Overflow : %u\n",
- rx[portId].rxFreeOverflow);
- printf("Rx Free Mutual Lock : %u\n",
- rx[portId].rxFreeLock);
- printf("Rx Free Late Ntf Enabled : %u\n",
- rx[portId].rxFreeLateNotificationEnabled);
- printf("Rx Free Low CB : %u\n",
- rx[portId].rxFreeLowCallback);
- printf("Rx From H/W Q (Disable) : %u\n",
- rx[portId].rxDuringDisable);
- printf("Rx From S/W Q (Disable) : %u\n",
- rx[portId].rxSwQDuringDisable);
- printf("Rx unlearned Mac Address : %u\n",
- rx[portId].rxUnlearnedMacAddress);
- printf("Rx Filtered (Rx => RxFree) : %u\n",
- rx[portId].rxFiltered);
-
- for (priority = IX_ETH_ACC_TX_PRIORITY_0;
- priority <= IX_ETH_ACC_TX_PRIORITY_7;
- priority++)
- {
- if (rx[portId].rxPriority[priority])
- {
- printf("Rx Priority %u : %u\n",
- priority,
- rx[portId].rxPriority[priority]);
- }
- }
-#endif
- printf("Rx unexpected errors : %u (should be 0)\n",
- rx[portId].rxUnexpectedError);
-
-#ifndef NDEBUG
- numBuffersInTx = tx[portId].txQOK +
- tx[portId].txQDelayed -
- tx[portId].txDoneClientCallback -
- tx[portId].txDoneSwQDuringDisable -
- tx[portId].txDoneDuringDisable;
-
- printf("# Tx Buffers currently for transmission : %u\n",
- numBuffersInTx);
-
- numBuffersInRx = rx[portId].rxFreeRepOK +
- rx[portId].rxFreeRepDelayed -
- rx[portId].rxFrameClientCallback -
- rx[portId].rxSwQDuringDisable -
- rx[portId].rxDuringDisable;
-
- printf("# Rx Buffers currently for reception : %u\n",
- numBuffersInRx);
-
- totalBuffers += numBuffersInRx + numBuffersInTx;
-#endif
- }
-
- printf("---------------------------------------\n");
-
-#ifndef NDEBUG
- printf("\n");
- printf("Mbufs :\n");
- printf("Tx Unchained mbufs : %u\n",
- stats.unchainedTxMBufs);
- printf("Tx Chained bufs : %u\n",
- stats.chainedTxMBufs);
- printf("TxDone Unchained mbufs : %u\n",
- stats.unchainedTxDoneMBufs);
- printf("TxDone Chained bufs : %u\n",
- stats.chainedTxDoneMBufs);
- printf("RxFree Unchained mbufs : %u\n",
- stats.unchainedRxFreeMBufs);
- printf("RxFree Chained bufs : %u\n",
- stats.chainedRxFreeMBufs);
- printf("Rx Unchained mbufs : %u\n",
- stats.unchainedRxMBufs);
- printf("Rx Chained bufs : %u\n",
- stats.chainedRxMBufs);
-
- printf("\n");
- printf("Software queue usage :\n");
- printf("Buffers added to S/W Q : %u\n",
- stats.addToSwQ);
- printf("Buffers removed from S/W Q : %u\n",
- stats.removeFromSwQ);
-
- printf("\n");
- printf("Hardware queues callbacks :\n");
-
- for(portId=0; portId < IX_ETH_ACC_NUMBER_OF_PORTS; portId++)
- {
- rxFreeCallbackCounter += rx[portId].rxFreeLowCallback;
- txCallbackCounter += tx[portId].txLowThreshCallback;
- }
- printf("Tx Done QM Callback invoked : %u\n",
- stats.txDoneCallbackCounter);
- printf("Tx QM Callback invoked : %u\n",
- txCallbackCounter);
- printf("Rx QM Callback invoked : %u\n",
- stats.rxCallbackCounter);
- printf("Rx QM Callback burst read : %u\n",
- stats.rxCallbackBurstRead);
- printf("Rx Free QM Callback invoked : %u\n",
- rxFreeCallbackCounter);
-#endif
- printf("Unexpected errors in CB : %u (should be 0)\n",
- stats.unexpectedError);
- printf("\n");
-
- printf("Hardware queues levels :\n");
- printf("Transmit Port 1 Q : %u \n",numTx0Entries);
- printf("Transmit Port 2 Q : %u \n",numTx1Entries);
-#ifdef __ixp46X
- printf("Transmit Port 3 Q : %u \n",numTx2Entries);
-#endif
- printf("Transmit Done Q : %u \n",numTxDoneEntries);
- printf("Receive Q : %u \n",numRxEntries);
- printf("Receive Free Port 1 Q : %u \n",numRxFree0Entries);
- printf("Receive Free Port 2 Q : %u \n",numRxFree1Entries);
-#ifdef __ixp46X
- printf("Receive Free Port 3 Q : %u \n",numRxFree2Entries);
-#endif
-
-#ifndef NDEBUG
- printf("\n");
- printf("# Total Buffers accounted for : %u\n",
- totalBuffers);
-
- numBuffersInSwQ = ixEthAccDataStats.addToSwQ -
- ixEthAccDataStats.removeFromSwQ;
-
- printf(" Buffers in S/W Qs : %u\n",
- numBuffersInSwQ);
- printf(" Buffers in H/W Qs or NPEs : %u\n",
- totalBuffers - numBuffersInSwQ);
-#endif
-
- printf("Rx QoS Discipline : %s\n",
- (ixEthAccDataInfo.schDiscipline ==
- FIFO_PRIORITY ) ? "Enabled" : "Disabled");
-
- for(portId=0; portId < IX_ETH_ACC_NUMBER_OF_PORTS; portId++)
- {
- printf("Tx QoS Discipline port %u : %s\n",
- portId,
- (ixEthAccPortData[portId].ixEthAccTxData.schDiscipline ==
- FIFO_PRIORITY ) ? "Enabled" : "Disabled");
- }
- printf("\n");
-}
-
-
-
-
-
diff --git a/cpu/ixp/npe/IxEthAccMac.c b/cpu/ixp/npe/IxEthAccMac.c
deleted file mode 100644
index d57e71678e..0000000000
--- a/cpu/ixp/npe/IxEthAccMac.c
+++ /dev/null
@@ -1,2641 +0,0 @@
-/**
- * @file IxEthAccMac.c
- *
- * @author Intel Corporation
- * @date
- *
- * @brief MAC control functions
- *
- * Design Notes:
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxOsal.h"
-#include "IxNpeMh.h"
-#ifdef CONFIG_IXP425_COMPONENT_ETHDB
-#include "IxEthDB.h"
-#endif
-#include "IxEthDBPortDefs.h"
-#include "IxEthNpe.h"
-#include "IxEthAcc.h"
-#include "IxEthAccDataPlane_p.h"
-#include "IxEthAcc_p.h"
-#include "IxEthAccMac_p.h"
-
-/* Maximum number of retries during ixEthAccPortDisable, which
- * is approximately 10 seconds
-*/
-#define IX_ETH_ACC_MAX_RETRY 500
-
-/* Maximum number of retries during ixEthAccPortDisable when expecting
- * timeout
- */
-#define IX_ETH_ACC_MAX_RETRY_TIMEOUT 5
-
-#define IX_ETH_ACC_VALIDATE_PORT_ID(portId) \
- do \
- { \
- if(!IX_ETH_ACC_IS_PORT_VALID(portId)) \
- { \
- return IX_ETH_ACC_INVALID_PORT; \
- } \
- } while(0)
-
-PUBLIC IxEthAccMacState ixEthAccMacState[IX_ETH_ACC_NUMBER_OF_PORTS];
-
-PRIVATE UINT32 ixEthAccMacBase[IX_ETH_ACC_NUMBER_OF_PORTS];
-
-/*Forward function declarations*/
-PRIVATE void
-ixEthAccPortDisableRx (IxEthAccPortId portId,
- IX_OSAL_MBUF * mBufPtr,
- BOOL useMultiBufferCallback);
-
-PRIVATE void
-ixEthAccPortDisableRxAndReplenish (IxEthAccPortId portId,
- IX_OSAL_MBUF * mBufPtr,
- BOOL useMultiBufferCallback);
-
-PRIVATE void
-ixEthAccPortDisableTxDone (UINT32 cbTag,
- IX_OSAL_MBUF *mbuf);
-
-PRIVATE void
-ixEthAccPortDisableTxDoneAndSubmit (UINT32 cbTag,
- IX_OSAL_MBUF *mbuf);
-
-PRIVATE void
-ixEthAccPortDisableRxCallback (UINT32 cbTag,
- IX_OSAL_MBUF * mBufPtr,
- UINT32 learnedPortId);
-
-PRIVATE void
-ixEthAccPortDisableMultiBufferRxCallback (UINT32 cbTag,
- IX_OSAL_MBUF **mBufPtr);
-
-PRIVATE IxEthAccStatus
-ixEthAccPortDisableTryTransmit(UINT32 portId);
-
-PRIVATE IxEthAccStatus
-ixEthAccPortDisableTryReplenish(UINT32 portId);
-
-PRIVATE IxEthAccStatus
-ixEthAccPortMulticastMacAddressGet (IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr);
-
-PRIVATE IxEthAccStatus
-ixEthAccPortMulticastMacFilterGet (IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr);
-
-PRIVATE void
-ixEthAccMacNpeStatsMessageCallback (IxNpeMhNpeId npeId,
- IxNpeMhMessage msg);
-
-PRIVATE void
-ixEthAccMacNpeStatsResetMessageCallback (IxNpeMhNpeId npeId,
- IxNpeMhMessage msg);
-
-PRIVATE void
-ixEthAccNpeLoopbackMessageCallback (IxNpeMhNpeId npeId,
- IxNpeMhMessage msg);
-
-PRIVATE void
-ixEthAccMulticastAddressSet(IxEthAccPortId portId);
-
-PRIVATE BOOL
-ixEthAccMacEqual(IxEthAccMacAddr *macAddr1,
- IxEthAccMacAddr *macAddr2);
-
-PRIVATE void
-ixEthAccMacPrint(IxEthAccMacAddr *m);
-
-PRIVATE void
-ixEthAccMacStateUpdate(IxEthAccPortId portId);
-
-IxEthAccStatus
-ixEthAccMacMemInit(void)
-{
- ixEthAccMacBase[IX_ETH_PORT_1] =
- (UINT32) IX_OSAL_MEM_MAP(IX_ETH_ACC_MAC_0_BASE,
- IX_OSAL_IXP400_ETHA_MAP_SIZE);
- ixEthAccMacBase[IX_ETH_PORT_2] =
- (UINT32) IX_OSAL_MEM_MAP(IX_ETH_ACC_MAC_1_BASE,
- IX_OSAL_IXP400_ETHB_MAP_SIZE);
-#ifdef __ixp46X
- ixEthAccMacBase[IX_ETH_PORT_3] =
- (UINT32) IX_OSAL_MEM_MAP(IX_ETH_ACC_MAC_2_BASE,
- IX_OSAL_IXP400_ETH_NPEA_MAP_SIZE);
- if (ixEthAccMacBase[IX_ETH_PORT_3] == 0)
- {
- ixOsalLog(IX_OSAL_LOG_LVL_FATAL,
- IX_OSAL_LOG_DEV_STDOUT,
- "EthAcc: Could not map MAC I/O memory\n",
- 0, 0, 0, 0, 0 ,0);
-
- return IX_ETH_ACC_FAIL;
- }
-#endif
-
- if (ixEthAccMacBase[IX_ETH_PORT_1] == 0
- || ixEthAccMacBase[IX_ETH_PORT_2] == 0)
- {
- ixOsalLog(IX_OSAL_LOG_LVL_FATAL,
- IX_OSAL_LOG_DEV_STDOUT,
- "EthAcc: Could not map MAC I/O memory\n",
- 0, 0, 0, 0, 0 ,0);
-
- return IX_ETH_ACC_FAIL;
- }
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-void
-ixEthAccMacUnload(void)
-{
- IX_OSAL_MEM_UNMAP(ixEthAccMacBase[IX_ETH_PORT_1]);
- IX_OSAL_MEM_UNMAP(ixEthAccMacBase[IX_ETH_PORT_2]);
-#ifdef __ixp46X
- IX_OSAL_MEM_UNMAP(ixEthAccMacBase[IX_ETH_PORT_3]);
- ixEthAccMacBase[IX_ETH_PORT_3] = 0;
-#endif
- ixEthAccMacBase[IX_ETH_PORT_2] = 0;
- ixEthAccMacBase[IX_ETH_PORT_1] = 0;
-}
-
-IxEthAccStatus
-ixEthAccPortEnablePriv(IxEthAccPortId portId)
-{
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot enable port.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- printf("EthAcc: (Mac) cannot enable port %d, port not initialized\n", portId);
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- if (ixEthAccPortData[portId].ixEthAccTxData.txBufferDoneCallbackFn == NULL)
- {
- /* TxDone callback not registered */
- printf("EthAcc: (Mac) cannot enable port %d, TxDone callback not registered\n", portId);
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- if ((ixEthAccPortData[portId].ixEthAccRxData.rxCallbackFn == NULL)
- && (ixEthAccPortData[portId].ixEthAccRxData.rxMultiBufferCallbackFn == NULL))
- {
- /* Receive callback not registered */
- printf("EthAcc: (Mac) cannot enable port %d, Rx callback not registered\n", portId);
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- if(!ixEthAccMacState[portId].initDone)
- {
- printf("EthAcc: (Mac) cannot enable port %d, MAC address not set\n", portId);
- return (IX_ETH_ACC_MAC_UNINITIALIZED);
- }
-
- /* if the state is being set to what it is already at, do nothing*/
- if (ixEthAccMacState[portId].enabled)
- {
- return IX_ETH_ACC_SUCCESS;
- }
-
-#ifdef CONFIG_IXP425_COMPONENT_ETHDB
- /* enable ethernet database for this port */
- if (ixEthDBPortEnable(portId) != IX_ETH_DB_SUCCESS)
- {
- printf("EthAcc: (Mac) cannot enable port %d, EthDB failure\n", portId);
- return IX_ETH_ACC_FAIL;
- }
-#endif
-
- /* set the MAC core registers */
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL2,
- IX_ETH_ACC_TX_CNTRL2_RETRIES_MASK);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RANDOM_SEED,
- IX_ETH_ACC_RANDOM_SEED_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_THRESH_P_EMPTY,
- IX_ETH_ACC_MAC_THRESH_P_EMPTY_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_THRESH_P_FULL,
- IX_ETH_ACC_MAC_THRESH_P_FULL_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_DEFER,
- IX_ETH_ACC_MAC_TX_DEFER_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_TWO_DEFER_1,
- IX_ETH_ACC_MAC_TX_TWO_DEFER_1_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_TWO_DEFER_2,
- IX_ETH_ACC_MAC_TX_TWO_DEFER_2_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_SLOT_TIME,
- IX_ETH_ACC_MAC_SLOT_TIME_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_INT_CLK_THRESH,
- IX_ETH_ACC_MAC_INT_CLK_THRESH_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_BUF_SIZE_TX,
- IX_ETH_ACC_MAC_BUF_SIZE_TX_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- IX_ETH_ACC_TX_CNTRL1_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- IX_ETH_ACC_RX_CNTRL1_DEFAULT);
-
- /* set the global state */
- ixEthAccMacState[portId].portDisableState = ACTIVE;
- ixEthAccMacState[portId].enabled = TRUE;
-
- /* rewrite the setup (including mac filtering) depending
- * on current options
- */
- ixEthAccMacStateUpdate(portId);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-/*
- * PortDisable local variables. They contain the intermediate steps
- * while the port is being disabled and the buffers being drained out
- * of the NPE.
- */
-typedef void (*IxEthAccPortDisableRx)(IxEthAccPortId portId,
- IX_OSAL_MBUF * mBufPtr,
- BOOL useMultiBufferCallback);
-static IxEthAccPortRxCallback
-ixEthAccPortDisableFn[IX_ETH_ACC_NUMBER_OF_PORTS];
-static IxEthAccPortMultiBufferRxCallback
-ixEthAccPortDisableMultiBufferFn[IX_ETH_ACC_NUMBER_OF_PORTS];
-static IxEthAccPortDisableRx
-ixEthAccPortDisableRxTable[IX_ETH_ACC_NUMBER_OF_PORTS];
-static UINT32
-ixEthAccPortDisableCbTag[IX_ETH_ACC_NUMBER_OF_PORTS];
-static UINT32
-ixEthAccPortDisableMultiBufferCbTag[IX_ETH_ACC_NUMBER_OF_PORTS];
-
-static IxEthAccPortTxDoneCallback
-ixEthAccPortDisableTxDoneFn[IX_ETH_ACC_NUMBER_OF_PORTS];
-static UINT32
-ixEthAccPortDisableTxDoneCbTag[IX_ETH_ACC_NUMBER_OF_PORTS];
-
-static UINT32
-ixEthAccPortDisableUserBufferCount[IX_ETH_ACC_NUMBER_OF_PORTS];
-
-/*
- * PortDisable private callbacks functions. They handle the user
- * traffic, and the special buffers (one for tx, one for rx) used
- * in portDisable.
- */
-PRIVATE void
-ixEthAccPortDisableTxDone(UINT32 cbTag,
- IX_OSAL_MBUF *mbuf)
-{
- IxEthAccPortId portId = (IxEthAccPortId)cbTag;
- volatile IxEthAccPortDisableState *txState = &ixEthAccMacState[portId].txState;
-
- /* check for the special mbuf used in portDisable */
- if (mbuf == ixEthAccMacState[portId].portDisableTxMbufPtr)
- {
- *txState = TRANSMIT_DONE;
- }
- else
- {
- /* increment the count of user traffic during portDisable */
- ixEthAccPortDisableUserBufferCount[portId]++;
-
- /* call client TxDone function */
- ixEthAccPortDisableTxDoneFn[portId](ixEthAccPortDisableTxDoneCbTag[portId], mbuf);
- }
-}
-
-PRIVATE IxEthAccStatus
-ixEthAccPortDisableTryTransmit(UINT32 portId)
-{
- int key;
- IxEthAccStatus status = IX_ETH_ACC_SUCCESS;
- volatile IxEthAccPortDisableState *txState = &ixEthAccMacState[portId].txState;
- /* transmit the special buffer again if it is transmitted
- * and update the txState
- * This section is protected because the portDisable context
- * run an identical code, so the system keeps transmitting at the
- * maximum rate.
- */
- key = ixOsalIrqLock();
- if (*txState == TRANSMIT_DONE)
- {
- IX_OSAL_MBUF *mbufTxPtr = ixEthAccMacState[portId].portDisableTxMbufPtr;
- *txState = TRANSMIT;
- status = ixEthAccPortTxFrameSubmit(portId,
- mbufTxPtr,
- IX_ETH_ACC_TX_DEFAULT_PRIORITY);
- }
- ixOsalIrqUnlock(key);
-
- return status;
-}
-
-PRIVATE void
-ixEthAccPortDisableTxDoneAndSubmit(UINT32 cbTag,
- IX_OSAL_MBUF *mbuf)
-{
- IxEthAccPortId portId = (IxEthAccPortId)cbTag;
-
- /* call the callback which forwards the traffic to the client */
- ixEthAccPortDisableTxDone(cbTag, mbuf);
-
- /* try to transmit the buffer used in portDisable
- * if seen in TxDone
- */
- ixEthAccPortDisableTryTransmit(portId);
-}
-
-PRIVATE void
-ixEthAccPortDisableRx (IxEthAccPortId portId,
- IX_OSAL_MBUF * mBufPtr,
- BOOL useMultiBufferCallback)
-{
- volatile IxEthAccPortDisableState *rxState = &ixEthAccMacState[portId].rxState;
- IX_OSAL_MBUF *mNextPtr;
-
- while (mBufPtr)
- {
- mNextPtr = IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(mBufPtr);
- IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(mBufPtr) = NULL;
-
- /* check for the special mbuf used in portDisable */
- if (mBufPtr == ixEthAccMacState[portId].portDisableRxMbufPtr)
- {
- *rxState = RECEIVE;
- }
- else
- {
- /* increment the count of user traffic during portDisable */
- ixEthAccPortDisableUserBufferCount[portId]++;
-
- /* reset the received payload length during portDisable */
- IX_OSAL_MBUF_MLEN(mBufPtr) = 0;
- IX_OSAL_MBUF_PKT_LEN(mBufPtr) = 0;
-
- if (useMultiBufferCallback)
- {
- /* call the user callback with one unchained
- * buffer, without payload. A small array is built
- * to be used as a parameter (the user callback expects
- * to receive an array ended by a NULL pointer.
- */
- IX_OSAL_MBUF *mBufPtrArray[2];
-
- mBufPtrArray[0] = mBufPtr;
- mBufPtrArray[1] = NULL;
- ixEthAccPortDisableMultiBufferFn[portId](
- ixEthAccPortDisableMultiBufferCbTag[portId],
- mBufPtrArray);
- }
- else
- {
- /* call the user callback with a unchained
- * buffer, without payload and the destination port is
- * unknown.
- */
- ixEthAccPortDisableFn[portId](
- ixEthAccPortDisableCbTag[portId],
- mBufPtr,
- IX_ETH_DB_UNKNOWN_PORT /* port not found */);
- }
- }
-
- mBufPtr = mNextPtr;
- }
-}
-
-PRIVATE IxEthAccStatus
-ixEthAccPortDisableTryReplenish(UINT32 portId)
-{
- int key;
- IxEthAccStatus status = IX_ETH_ACC_SUCCESS;
- volatile IxEthAccPortDisableState *rxState = &ixEthAccMacState[portId].rxState;
- /* replenish with the special buffer again if it is received
- * and update the rxState
- * This section is protected because the portDisable context
- * run an identical code, so the system keeps replenishing at the
- * maximum rate.
- */
- key = ixOsalIrqLock();
- if (*rxState == RECEIVE)
- {
- IX_OSAL_MBUF *mbufRxPtr = ixEthAccMacState[portId].portDisableRxMbufPtr;
- *rxState = REPLENISH;
- IX_OSAL_MBUF_MLEN(mbufRxPtr) = IX_ETHACC_RX_MBUF_MIN_SIZE;
- status = ixEthAccPortRxFreeReplenish(portId, mbufRxPtr);
- }
- ixOsalIrqUnlock(key);
-
- return status;
-}
-
-PRIVATE void
-ixEthAccPortDisableRxAndReplenish (IxEthAccPortId portId,
- IX_OSAL_MBUF * mBufPtr,
- BOOL useMultiBufferCallback)
-{
- /* call the callback which forwards the traffic to the client */
- ixEthAccPortDisableRx(portId, mBufPtr, useMultiBufferCallback);
-
- /* try to replenish with the buffer used in portDisable
- * if seen in Rx
- */
- ixEthAccPortDisableTryReplenish(portId);
-}
-
-PRIVATE void
-ixEthAccPortDisableRxCallback (UINT32 cbTag,
- IX_OSAL_MBUF * mBufPtr,
- UINT32 learnedPortId)
-{
- IxEthAccPortId portId = (IxEthAccPortId)cbTag;
-
- /* call the portDisable receive callback */
- (ixEthAccPortDisableRxTable[portId])(portId, mBufPtr, FALSE);
-}
-
-PRIVATE void
-ixEthAccPortDisableMultiBufferRxCallback (UINT32 cbTag,
- IX_OSAL_MBUF **mBufPtr)
-{
- IxEthAccPortId portId = (IxEthAccPortId)cbTag;
-
- while (*mBufPtr)
- {
- /* call the portDisable receive callback with one buffer at a time */
- (ixEthAccPortDisableRxTable[portId])(portId, *mBufPtr++, TRUE);
- }
-}
-
-IxEthAccStatus
-ixEthAccPortDisablePriv(IxEthAccPortId portId)
-{
- IxEthAccStatus status = IX_ETH_ACC_SUCCESS;
- int key;
- int retry, retryTimeout;
- volatile IxEthAccPortDisableState *state = &ixEthAccMacState[portId].portDisableState;
- volatile IxEthAccPortDisableState *rxState = &ixEthAccMacState[portId].rxState;
- volatile IxEthAccPortDisableState *txState = &ixEthAccMacState[portId].txState;
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot disable port.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /* if the state is being set to what it is already at, do nothing */
- if (!ixEthAccMacState[portId].enabled)
- {
- return IX_ETH_ACC_SUCCESS;
- }
-
- *state = DISABLED;
-
- /* disable MAC receive first */
- ixEthAccPortRxDisablePriv(portId);
-
-#ifdef CONFIG_IXP425_COMPONENT_ETHDB
- /* disable ethernet database for this port - It is done now to avoid
- * issuing ELT maintenance after requesting 'port disable' in an NPE
- */
- if (ixEthDBPortDisable(portId) != IX_ETH_DB_SUCCESS)
- {
- status = IX_ETH_ACC_FAIL;
- IX_ETH_ACC_FATAL_LOG("ixEthAccPortDisable: failed to disable EthDB for this port\n", 0, 0, 0, 0, 0, 0);
- }
-#endif
-
- /* enter the critical section */
- key = ixOsalIrqLock();
-
- /* swap the Rx and TxDone callbacks */
- ixEthAccPortDisableFn[portId] = ixEthAccPortData[portId].ixEthAccRxData.rxCallbackFn;
- ixEthAccPortDisableMultiBufferFn[portId] = ixEthAccPortData[portId].ixEthAccRxData.rxMultiBufferCallbackFn;
- ixEthAccPortDisableCbTag[portId] = ixEthAccPortData[portId].ixEthAccRxData.rxCallbackTag;
- ixEthAccPortDisableMultiBufferCbTag[portId] = ixEthAccPortData[portId].ixEthAccRxData.rxMultiBufferCallbackTag;
- ixEthAccPortDisableTxDoneFn[portId] = ixEthAccPortData[portId].ixEthAccTxData.txBufferDoneCallbackFn;
- ixEthAccPortDisableTxDoneCbTag[portId] = ixEthAccPortData[portId].ixEthAccTxData.txCallbackTag;
- ixEthAccPortDisableRxTable[portId] = ixEthAccPortDisableRx;
-
- /* register temporary callbacks */
- ixEthAccPortData[portId].ixEthAccRxData.rxCallbackFn = ixEthAccPortDisableRxCallback;
- ixEthAccPortData[portId].ixEthAccRxData.rxCallbackTag = portId;
-
- ixEthAccPortData[portId].ixEthAccRxData.rxMultiBufferCallbackFn = ixEthAccPortDisableMultiBufferRxCallback;
- ixEthAccPortData[portId].ixEthAccRxData.rxMultiBufferCallbackTag = portId;
-
- ixEthAccPortData[portId].ixEthAccTxData.txBufferDoneCallbackFn = ixEthAccPortDisableTxDone;
- ixEthAccPortData[portId].ixEthAccTxData.txCallbackTag = portId;
-
- /* initialise the Rx state and Tx states */
- *txState = TRANSMIT_DONE;
- *rxState = RECEIVE;
-
- /* exit the critical section */
- ixOsalIrqUnlock(key);
-
- /* enable a NPE loopback */
- if (ixEthAccNpeLoopbackEnablePriv(portId) != IX_ETH_ACC_SUCCESS)
- {
- status = IX_ETH_ACC_FAIL;
- }
-
- if (status == IX_ETH_ACC_SUCCESS)
- {
- retry = 0;
-
- /* Step 1 : Drain Tx traffic and TxDone queues :
- *
- * Transmit and replenish at least once with the
- * special buffers until both of them are seen
- * in the callback hook
- *
- * (the receive callback keeps replenishing, so once we see
- * the special Tx buffer, we can be sure that Tx drain is complete)
- */
- ixEthAccPortDisableRxTable[portId]
- = ixEthAccPortDisableRxAndReplenish;
- ixEthAccPortData[portId].ixEthAccTxData.txBufferDoneCallbackFn
- = ixEthAccPortDisableTxDone;
-
- do
- {
- /* keep replenishing */
- status = ixEthAccPortDisableTryReplenish(portId);
- if (status == IX_ETH_ACC_SUCCESS)
- {
- /* keep transmitting */
- status = ixEthAccPortDisableTryTransmit(portId);
- }
- if (status == IX_ETH_ACC_SUCCESS)
- {
- /* wait for some traffic being processed */
- ixOsalSleep(IX_ETH_ACC_PORT_DISABLE_DELAY_MSECS);
- }
- }
- while ((status == IX_ETH_ACC_SUCCESS)
- && (retry++ < IX_ETH_ACC_MAX_RETRY)
- && (*txState == TRANSMIT));
-
- /* Step 2 : Drain Rx traffic, RxFree and Rx queues :
- *
- * Transmit and replenish at least once with the
- * special buffers until both of them are seen
- * in the callback hook
- * (the transmit callback keeps transmitting, and when we see
- * the special Rx buffer, we can be sure that rxFree drain
- * is complete)
- *
- * The nested loop helps to retry if the user was keeping
- * replenishing or transmitting during portDisable.
- *
- * The 2 nested loops ensure more retries if user traffic is
- * seen during portDisable : the user should not replenish
- * or transmit while portDisable is running. However, because of
- * the queueing possibilities in ethAcc dataplane, it is possible
- * that a lot of traffic is left in the queues (e.g. when
- * transmitting over a low speed link) and therefore, more
- * retries are allowed to help flushing the buffers out.
- */
- ixEthAccPortDisableRxTable[portId]
- = ixEthAccPortDisableRx;
- ixEthAccPortData[portId].ixEthAccTxData.txBufferDoneCallbackFn
- = ixEthAccPortDisableTxDoneAndSubmit;
-
- do
- {
- do
- {
- ixEthAccPortDisableUserBufferCount[portId] = 0;
-
- /* keep replenishing */
- status = ixEthAccPortDisableTryReplenish(portId);
- if (status == IX_ETH_ACC_SUCCESS)
- {
- /* keep transmitting */
- status = ixEthAccPortDisableTryTransmit(portId);
- }
- if (status == IX_ETH_ACC_SUCCESS)
- {
- /* wait for some traffic being processed */
- ixOsalSleep(IX_ETH_ACC_PORT_DISABLE_DELAY_MSECS);
- }
- }
- while ((status == IX_ETH_ACC_SUCCESS)
- && (retry++ < IX_ETH_ACC_MAX_RETRY)
- && ((ixEthAccPortDisableUserBufferCount[portId] != 0)
- || (*rxState == REPLENISH)));
-
- /* After the first iteration, change the receive callbacks,
- * to process only 1 buffer at a time
- */
- ixEthAccPortDisableRxTable[portId]
- = ixEthAccPortDisableRx;
- ixEthAccPortData[portId].ixEthAccTxData.txBufferDoneCallbackFn
- = ixEthAccPortDisableTxDone;
-
- /* repeat the whole process while user traffic is seen in TxDone
- *
- * The conditions to stop the loop are
- * - Xscale has both Rx and Tx special buffers
- * (txState = transmit, rxState = receive)
- * - any error in txSubmit or rxReplenish
- * - no user traffic seen
- * - an excessive amount of retries
- */
- }
- while ((status == IX_ETH_ACC_SUCCESS)
- && (retry < IX_ETH_ACC_MAX_RETRY)
- && (*txState == TRANSMIT));
-
- /* check the loop exit conditions. The NPE should not hold
- * the special buffers.
- */
- if ((*rxState == REPLENISH) || (*txState == TRANSMIT))
- {
- status = IX_ETH_ACC_FAIL;
- }
-
- if (status == IX_ETH_ACC_SUCCESS)
- {
- /* Step 3 : Replenish without transmitting until a timeout
- * occurs, in order to drain the internal NPE fifos
- *
- * we can expect a few frames srill held
- * in the NPE.
- *
- * The 2 nested loops take care about the NPE dropping traffic
- * (including loopback traffic) when the Rx queue is full.
- *
- * The timeout value is very conservative
- * since the loopback used keeps replenishhing.
- *
- */
- do
- {
- ixEthAccPortDisableRxTable[portId] = ixEthAccPortDisableRxAndReplenish;
- ixEthAccPortDisableUserBufferCount[portId] = 0;
- retryTimeout = 0;
- do
- {
- /* keep replenishing */
- status = ixEthAccPortDisableTryReplenish(portId);
- if (status == IX_ETH_ACC_SUCCESS)
- {
- /* wait for some traffic being processed */
- ixOsalSleep(IX_ETH_ACC_PORT_DISABLE_DELAY_MSECS);
- }
- }
- while ((status == IX_ETH_ACC_SUCCESS)
- && (retryTimeout++ < IX_ETH_ACC_MAX_RETRY_TIMEOUT));
-
- /* Step 4 : Transmit once. Stop replenish
- *
- * After the Rx timeout, we are sure that the NPE does not
- * hold any frame in its internal NPE fifos.
- *
- * At this point, the NPE still holds the last rxFree buffer.
- * By transmitting a single frame, this should unblock the
- * last rxFree buffer. This code just transmit once and
- * wait for both frames seen in TxDone and in rxFree.
- *
- */
- ixEthAccPortDisableRxTable[portId] = ixEthAccPortDisableRx;
- status = ixEthAccPortDisableTryTransmit(portId);
-
- /* the NPE should immediatelyt release
- * the last Rx buffer and the last transmitted buffer
- * unless the last Tx frame was dropped (rx queue full)
- */
- if (status == IX_ETH_ACC_SUCCESS)
- {
- retryTimeout = 0;
- do
- {
- ixOsalSleep(IX_ETH_ACC_PORT_DISABLE_DELAY_MSECS);
- }
- while ((*rxState == REPLENISH)
- && (retryTimeout++ < IX_ETH_ACC_MAX_RETRY_TIMEOUT));
- }
-
- /* the NPE may have dropped the traffic because of Rx
- * queue being full. This code ensures that the last
- * Tx and Rx frames are both received.
- */
- }
- while ((status == IX_ETH_ACC_SUCCESS)
- && (retry++ < IX_ETH_ACC_MAX_RETRY)
- && ((*txState == TRANSMIT)
- || (*rxState == REPLENISH)
- || (ixEthAccPortDisableUserBufferCount[portId] != 0)));
-
- /* Step 5 : check the final states : the NPE has
- * no buffer left, nor in Tx , nor in Rx directions.
- */
- if ((*rxState == REPLENISH) || (*txState == TRANSMIT))
- {
- status = IX_ETH_ACC_FAIL;
- }
- }
-
- /* now all the buffers are drained, disable NPE loopback
- * This is done regardless of the logic to drain the queues and
- * the internal buffers held by the NPE.
- */
- if (ixEthAccNpeLoopbackDisablePriv(portId) != IX_ETH_ACC_SUCCESS)
- {
- status = IX_ETH_ACC_FAIL;
- }
- }
-
- /* disable MAC Tx and Rx services */
- ixEthAccMacState[portId].enabled = FALSE;
- ixEthAccMacStateUpdate(portId);
-
- /* restore the Rx and TxDone callbacks (within a critical section) */
- key = ixOsalIrqLock();
-
- ixEthAccPortData[portId].ixEthAccRxData.rxCallbackFn = ixEthAccPortDisableFn[portId];
- ixEthAccPortData[portId].ixEthAccRxData.rxCallbackTag = ixEthAccPortDisableCbTag[portId];
- ixEthAccPortData[portId].ixEthAccRxData.rxMultiBufferCallbackFn = ixEthAccPortDisableMultiBufferFn[portId];
- ixEthAccPortData[portId].ixEthAccRxData.rxMultiBufferCallbackTag = ixEthAccPortDisableMultiBufferCbTag[portId];
- ixEthAccPortData[portId].ixEthAccTxData.txBufferDoneCallbackFn = ixEthAccPortDisableTxDoneFn[portId];
- ixEthAccPortData[portId].ixEthAccTxData.txCallbackTag = ixEthAccPortDisableTxDoneCbTag[portId];
-
- ixOsalIrqUnlock(key);
-
- /* the MAC core rx/tx disable may left the MAC hardware in an
- * unpredictable state. A hw reset is executed before resetting
- * all the MAC parameters to a known value.
- */
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_CORE_CNTRL,
- IX_ETH_ACC_CORE_RESET);
-
- ixOsalSleep(IX_ETH_ACC_MAC_RESET_DELAY);
-
- /* rewrite all parameters to their current value */
- ixEthAccMacStateUpdate(portId);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_INT_CLK_THRESH,
- IX_ETH_ACC_MAC_INT_CLK_THRESH_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_CORE_CNTRL,
- IX_ETH_ACC_CORE_MDC_EN);
-
- return status;
-}
-
-IxEthAccStatus
-ixEthAccPortEnabledQueryPriv(IxEthAccPortId portId, BOOL *enabled)
-{
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot enable port.\n",(INT32)portId,0,0,0,0,0);
-
- /* Since Eth NPE is not available, port must be disabled */
- *enabled = FALSE ;
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- /* Since Eth NPE is not available, port must be disabled */
- *enabled = FALSE ;
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- *enabled = ixEthAccMacState[portId].enabled;
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortMacResetPriv(IxEthAccPortId portId)
-{
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Eth %d: Cannot reset Ethernet coprocessor.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_CORE_CNTRL,
- IX_ETH_ACC_CORE_RESET);
-
- ixOsalSleep(IX_ETH_ACC_MAC_RESET_DELAY);
-
- /* rewrite all parameters to their current value */
- ixEthAccMacStateUpdate(portId);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_INT_CLK_THRESH,
- IX_ETH_ACC_MAC_INT_CLK_THRESH_DEFAULT);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_CORE_CNTRL,
- IX_ETH_ACC_CORE_MDC_EN);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortLoopbackEnable(IxEthAccPortId portId)
-{
- UINT32 regval;
-
- /* Turn off promiscuous mode */
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Eth %d: Cannot enable loopback.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /* read register */
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval);
-
- /* update register */
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval | IX_ETH_ACC_RX_CNTRL1_LOOP_EN);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-PRIVATE void
-ixEthAccNpeLoopbackMessageCallback (IxNpeMhNpeId npeId,
- IxNpeMhMessage msg)
-{
- IxEthAccPortId portId = IX_ETH_ACC_NPE_TO_PORT_ID(npeId);
-
-#ifndef NDEBUG
- /* Prudent to at least check the port is within range */
- if (portId >= IX_ETH_ACC_NUMBER_OF_PORTS)
- {
- IX_ETH_ACC_FATAL_LOG("IXETHACC:ixEthAccPortDisableMessageCallback: Illegal port: %u\n",
- (UINT32) portId, 0, 0, 0, 0, 0);
-
- return;
- }
-#endif
-
- /* unlock message reception mutex */
- ixOsalMutexUnlock(&ixEthAccMacState[portId].npeLoopbackMessageLock);
-}
-
-IxEthAccStatus
-ixEthAccNpeLoopbackEnablePriv(IxEthAccPortId portId)
-{
- IX_STATUS npeMhStatus;
- IxNpeMhMessage message;
- IxEthAccStatus status = IX_ETH_ACC_SUCCESS;
-
- /* Turn off promiscuous mode */
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Eth %d: Cannot enable NPE loopback.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /* enable NPE loopback (lsb of the message contains the value 1) */
- message.data[0] = (IX_ETHNPE_SETLOOPBACK_MODE << IX_ETH_ACC_MAC_MSGID_SHL)
- | 0x01;
- message.data[1] = 0;
-
- npeMhStatus = ixNpeMhMessageWithResponseSend(IX_ETH_ACC_PORT_TO_NPE_ID(portId),
- message,
- IX_ETHNPE_SETLOOPBACK_MODE_ACK,
- ixEthAccNpeLoopbackMessageCallback,
- IX_NPEMH_SEND_RETRIES_DEFAULT);
-
- if (npeMhStatus != IX_SUCCESS)
- {
- status = IX_ETH_ACC_FAIL;
- }
- else
- {
- /* wait for NPE loopbackEnable response */
- if (ixOsalMutexLock(&ixEthAccMacState[portId]. npeLoopbackMessageLock,
- IX_ETH_ACC_PORT_DISABLE_DELAY_MSECS)
- != IX_SUCCESS)
- {
- status = IX_ETH_ACC_FAIL;
- }
- }
-
- return status;
-}
-
-IxEthAccStatus
-ixEthAccPortTxEnablePriv(IxEthAccPortId portId)
-{
- UINT32 regval;
-
- /* Turn off promiscuous mode */
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Eth %d: Cannot enable TX.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /* read register */
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval);
-
- /* update register */
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval | IX_ETH_ACC_TX_CNTRL1_TX_EN);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortRxEnablePriv(IxEthAccPortId portId)
-{
- UINT32 regval;
-
- /* Turn off promiscuous mode */
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Eth %d: Cannot enable RX.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /* read register */
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval);
-
- /* update register */
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval | IX_ETH_ACC_RX_CNTRL1_RX_EN);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortLoopbackDisable(IxEthAccPortId portId)
-{
- UINT32 regval;
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Eth %d: Cannot disable loopback.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /*disable MAC loopabck */
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- (regval & ~IX_ETH_ACC_RX_CNTRL1_LOOP_EN));
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccNpeLoopbackDisablePriv(IxEthAccPortId portId)
-{
- IX_STATUS npeMhStatus;
- IxNpeMhMessage message;
- IxEthAccStatus status = IX_ETH_ACC_SUCCESS;
-
- /* Turn off promiscuous mode */
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Eth %d: Cannot enable NPE loopback.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /* disable NPE loopback (lsb of the message contains the value 0) */
- message.data[0] = (IX_ETHNPE_SETLOOPBACK_MODE << IX_ETH_ACC_MAC_MSGID_SHL);
- message.data[1] = 0;
-
- npeMhStatus = ixNpeMhMessageWithResponseSend(IX_ETH_ACC_PORT_TO_NPE_ID(portId),
- message,
- IX_ETHNPE_SETLOOPBACK_MODE_ACK,
- ixEthAccNpeLoopbackMessageCallback,
- IX_NPEMH_SEND_RETRIES_DEFAULT);
-
- if (npeMhStatus != IX_SUCCESS)
- {
- status = IX_ETH_ACC_FAIL;
- }
- else
- {
- /* wait for NPE loopbackEnable response */
- if (ixOsalMutexLock(&ixEthAccMacState[portId].npeLoopbackMessageLock,
- IX_ETH_ACC_PORT_DISABLE_DELAY_MSECS)
- != IX_SUCCESS)
- {
- status = IX_ETH_ACC_FAIL;
- }
- }
-
- return status;
-}
-
-IxEthAccStatus
-ixEthAccPortTxDisablePriv(IxEthAccPortId portId)
-{
- UINT32 regval;
-
- /* Turn off promiscuous mode */
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Eth %d: Cannot disable TX.\n", (INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /* read register */
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval);
-
- /* update register */
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- (regval & ~IX_ETH_ACC_TX_CNTRL1_TX_EN));
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortRxDisablePriv(IxEthAccPortId portId)
-{
- UINT32 regval;
-
- /* Turn off promiscuous mode */
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Eth %d: Cannot disable RX.\n", (INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /* read register */
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval);
-
- /* update register */
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- (regval & ~IX_ETH_ACC_RX_CNTRL1_RX_EN));
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortPromiscuousModeClearPriv(IxEthAccPortId portId)
-{
- UINT32 regval;
-
- /* Turn off promiscuous mode */
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot clear promiscuous mode.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /*set bit 5 of Rx control 1 - enable address filtering*/
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval | IX_ETH_ACC_RX_CNTRL1_ADDR_FLTR_EN);
-
- ixEthAccMacState[portId].promiscuous = FALSE;
-
- ixEthAccMulticastAddressSet(portId);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortPromiscuousModeSetPriv(IxEthAccPortId portId)
-{
- UINT32 regval;
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot set promiscuous mode.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /*
- * Set bit 5 of Rx control 1 - We enable address filtering even in
- * promiscuous mode because we want the MAC to set the appropriate
- * bits in m_flags which doesn't happen if we turn off filtering.
- */
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval | IX_ETH_ACC_RX_CNTRL1_ADDR_FLTR_EN);
-
- ixEthAccMacState[portId].promiscuous = TRUE;
-
- ixEthAccMulticastAddressSet(portId);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortUnicastMacAddressSetPriv (IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr)
-{
- UINT32 i;
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot set Unicast Mac Address.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
-
- if (macAddr == NULL)
- {
- return IX_ETH_ACC_FAIL;
- }
-
- if ( macAddr->macAddress[0] & IX_ETH_ACC_ETH_MAC_BCAST_MCAST_BIT )
- {
- /* This is a multicast/broadcast address cant set it ! */
- return IX_ETH_ACC_FAIL;
- }
-
- if ( macAddr->macAddress[0] == 0 &&
- macAddr->macAddress[1] == 0 &&
- macAddr->macAddress[2] == 0 &&
- macAddr->macAddress[3] == 0 &&
- macAddr->macAddress[4] == 0 &&
- macAddr->macAddress[5] == 0 )
- {
- /* This is an invalid mac address cant set it ! */
- return IX_ETH_ACC_FAIL;
- }
-
-#ifdef CONFIG_IXP425_COMPONENT_ETHDB
- /* update the MAC address in the ethernet database */
- if (ixEthDBPortAddressSet(portId, (IxEthDBMacAddr *) macAddr) != IX_ETH_DB_SUCCESS)
- {
- return IX_ETH_ACC_FAIL;
- }
-#endif
-
- /*Set the Unicast MAC to the specified value*/
- for(i=0;i<IX_IEEE803_MAC_ADDRESS_SIZE;i++)
- {
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_UNI_ADDR_1 + i*sizeof(UINT32),
- macAddr->macAddress[i]);
- }
- ixEthAccMacState[portId].initDone = TRUE;
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortUnicastMacAddressGetPriv (IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr)
-{
- /*Return the current value of the Unicast MAC from h/w
- for the specified port*/
- UINT32 i;
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot get Unicast Mac Address.\n",(INT32)portId,0,0,0,0,0);
- /* Since Eth Npe is unavailable, return invalid MAC Address = 00:00:00:00:00:00 */
- for(i=0;i<IX_IEEE803_MAC_ADDRESS_SIZE;i++)
- {
- macAddr->macAddress[i] = 0;
- }
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if(!ixEthAccMacState[portId].initDone)
- {
- return (IX_ETH_ACC_MAC_UNINITIALIZED);
- }
-
- if (macAddr == NULL)
- {
- return IX_ETH_ACC_FAIL;
- }
-
-
- for(i=0;i<IX_IEEE803_MAC_ADDRESS_SIZE;i++)
- {
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_UNI_ADDR_1 + i*sizeof(UINT32),
- macAddr->macAddress[i]);
- }
- return IX_ETH_ACC_SUCCESS;
-}
-
-PRIVATE IxEthAccStatus
-ixEthAccPortMulticastMacAddressGet (IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr)
-{
- /*Return the current value of the Multicast MAC from h/w
- for the specified port*/
- UINT32 i;
-
- for(i=0;i<IX_IEEE803_MAC_ADDRESS_SIZE;i++)
- {
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_ADDR_1 + i*sizeof(UINT32),
- macAddr->macAddress[i]);
- }
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-PRIVATE IxEthAccStatus
-ixEthAccPortMulticastMacFilterGet (IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr)
-{
- /*Return the current value of the Multicast MAC from h/w
- for the specified port*/
- UINT32 i;
-
- for(i=0;i<IX_IEEE803_MAC_ADDRESS_SIZE;i++)
- {
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_ADDR_MASK_1 + i*sizeof(UINT32),
- macAddr->macAddress[i]);
- }
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortMulticastAddressJoinPriv (IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr)
-{
- UINT32 i;
- IxEthAccMacAddr broadcastAddr = {{0xff,0xff,0xff,0xff,0xff,0xff}};
-
- /*Check that the port parameter is valid*/
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot join Multicast Mac Address.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /*Check that the mac address is valid*/
- if(macAddr == NULL)
- {
- return IX_ETH_ACC_FAIL;
- }
-
- /* Check that this is a multicast address */
- if (!(macAddr->macAddress[0] & IX_ETH_ACC_ETH_MAC_BCAST_MCAST_BIT))
- {
- return IX_ETH_ACC_FAIL;
- }
-
- /* We don't add the Broadcast address */
- if(ixEthAccMacEqual(&broadcastAddr, macAddr))
- {
- return IX_ETH_ACC_FAIL;
- }
-
- for (i = 0;
- i<ixEthAccMacState[portId].mcastAddrIndex;
- i++)
- {
- /*Check if the current entry already match an existing matches*/
- if(ixEthAccMacEqual(&ixEthAccMacState[portId].mcastAddrsTable[i], macAddr))
- {
- /* Address found in the list and already configured,
- * return a success status
- */
- return IX_ETH_ACC_SUCCESS;
- }
- }
-
- /* check for availability at the end of the current table */
- if(ixEthAccMacState[portId].mcastAddrIndex >= IX_ETH_ACC_MAX_MULTICAST_ADDRESSES)
- {
- return IX_ETH_ACC_FAIL;
- }
-
- /*First add the address to the multicast table for the
- specified port*/
- i=ixEthAccMacState[portId].mcastAddrIndex;
-
- memcpy(&ixEthAccMacState[portId].mcastAddrsTable[i],
- &macAddr->macAddress,
- IX_IEEE803_MAC_ADDRESS_SIZE);
-
- /*Increment the index into the table, this must be done here
- as MulticastAddressSet below needs to know about the latest
- entry.
- */
- ixEthAccMacState[portId].mcastAddrIndex++;
-
- /*Then calculate the new value to be written to the address and
- address mask registers*/
- ixEthAccMulticastAddressSet(portId);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-
-IxEthAccStatus
-ixEthAccPortMulticastAddressJoinAllPriv (IxEthAccPortId portId)
-{
- IxEthAccMacAddr mcastMacAddr = {{0x1,0x0,0x0,0x0,0x0,0x0}};
-
- /*Check that the port parameter is valid*/
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot join all Multicast Address.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /* remove all entries from the database and
- * insert a multicast entry
- */
- memcpy(&ixEthAccMacState[portId].mcastAddrsTable[0],
- &mcastMacAddr.macAddress,
- IX_IEEE803_MAC_ADDRESS_SIZE);
-
- ixEthAccMacState[portId].mcastAddrIndex = 1;
- ixEthAccMacState[portId].joinAll = TRUE;
-
- ixEthAccMulticastAddressSet(portId);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortMulticastAddressLeavePriv (IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr)
-{
- UINT32 i;
- IxEthAccMacAddr mcastMacAddr = {{0x1,0x0,0x0,0x0,0x0,0x0}};
-
- /*Check that the port parameter is valid*/
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot leave Multicast Address.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /*Check that the mac address is valid*/
- if(macAddr == NULL)
- {
- return IX_ETH_ACC_FAIL;
- }
- /* Remove this mac address from the mask for the specified port
- * we copy down all entries above the blanked entry, and
- * decrement the index
- */
- i=0;
-
- while(i<ixEthAccMacState[portId].mcastAddrIndex)
- {
- /*Check if the current entry matches*/
- if(ixEthAccMacEqual(&ixEthAccMacState[portId].mcastAddrsTable[i],
- macAddr))
- {
- if(ixEthAccMacEqual(macAddr, &mcastMacAddr))
- {
- ixEthAccMacState[portId].joinAll = FALSE;
- }
- /*Decrement the index into the multicast address table
- for the current port*/
- ixEthAccMacState[portId].mcastAddrIndex--;
-
- /*Copy down all entries above the current entry*/
- while(i<ixEthAccMacState[portId].mcastAddrIndex)
- {
- memcpy(&ixEthAccMacState[portId].mcastAddrsTable[i],
- &ixEthAccMacState[portId].mcastAddrsTable[i+1],
- IX_IEEE803_MAC_ADDRESS_SIZE);
- i++;
- }
- /*recalculate the mask and write it to the MAC*/
- ixEthAccMulticastAddressSet(portId);
-
- return IX_ETH_ACC_SUCCESS;
- }
- /* search the next entry */
- i++;
- }
- /* no matching entry found */
- return IX_ETH_ACC_NO_SUCH_ADDR;
-}
-
-IxEthAccStatus
-ixEthAccPortMulticastAddressLeaveAllPriv (IxEthAccPortId portId)
-{
- /*Check that the port parameter is valid*/
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot leave all Multicast Address.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- ixEthAccMacState[portId].mcastAddrIndex = 0;
- ixEthAccMacState[portId].joinAll = FALSE;
-
- ixEthAccMulticastAddressSet(portId);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-
-IxEthAccStatus
-ixEthAccPortUnicastAddressShowPriv (IxEthAccPortId portId)
-{
- IxEthAccMacAddr macAddr;
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot show Unicast Address.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- /*Get the MAC (UINICAST) address from hardware*/
- if(ixEthAccPortUnicastMacAddressGetPriv(portId, &macAddr) != IX_ETH_ACC_SUCCESS)
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: MAC address uninitialised port %u\n",
- (INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_MAC_UNINITIALIZED;
- }
-
- /*print it out*/
- ixEthAccMacPrint(&macAddr);
- printf("\n");
- return IX_ETH_ACC_SUCCESS;
-}
-
-
-
-void
-ixEthAccPortMulticastAddressShowPriv(IxEthAccPortId portId)
-{
- IxEthAccMacAddr macAddr;
- UINT32 i;
-
- if(!IX_ETH_ACC_IS_PORT_VALID(portId))
- {
- return;
- }
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot show Multicast Address.\n",(INT32)portId,0,0,0,0,0);
- return ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return;
- }
-
- printf("Multicast MAC: ");
- /*Get the MAC (MULTICAST) address from hardware*/
- ixEthAccPortMulticastMacAddressGet(portId, &macAddr);
- /*print it out*/
- ixEthAccMacPrint(&macAddr);
- /*Get the MAC (MULTICAST) filter from hardware*/
- ixEthAccPortMulticastMacFilterGet(portId, &macAddr);
- /*print it out*/
- printf(" ( ");
- ixEthAccMacPrint(&macAddr);
- printf(" )\n");
- printf("Constituent Addresses:\n");
- for(i=0;i<ixEthAccMacState[portId].mcastAddrIndex;i++)
- {
- ixEthAccMacPrint(&ixEthAccMacState[portId].mcastAddrsTable[i]);
- printf("\n");
- }
- return;
-}
-
-/*Set the duplex mode*/
-IxEthAccStatus
-ixEthAccPortDuplexModeSetPriv (IxEthAccPortId portId,
- IxEthAccDuplexMode mode)
-{
- UINT32 txregval;
- UINT32 rxregval;
-
- /*This is bit 1 of the transmit control reg, set to 1 for half
- duplex, 0 for full duplex*/
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot set Duplex Mode.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- txregval);
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- rxregval);
-
- if (mode == IX_ETH_ACC_FULL_DUPLEX)
- {
- /*Clear half duplex bit in TX*/
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- txregval & ~IX_ETH_ACC_TX_CNTRL1_DUPLEX);
-
- /*We must set the pause enable in the receive logic when in
- full duplex mode*/
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- rxregval | IX_ETH_ACC_RX_CNTRL1_PAUSE_EN);
- ixEthAccMacState[portId].fullDuplex = TRUE;
-
- }
- else if (mode == IX_ETH_ACC_HALF_DUPLEX)
- {
- /*Set half duplex bit in TX*/
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- txregval | IX_ETH_ACC_TX_CNTRL1_DUPLEX);
-
- /*We must clear pause enable in the receive logic when in
- half duplex mode*/
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- rxregval & ~IX_ETH_ACC_RX_CNTRL1_PAUSE_EN);
-
- ixEthAccMacState[portId].fullDuplex = FALSE;
- }
- else
- {
- return IX_ETH_ACC_FAIL;
- }
-
-
- return IX_ETH_ACC_SUCCESS;
-
-}
-
-
-
-IxEthAccStatus
-ixEthAccPortDuplexModeGetPriv (IxEthAccPortId portId,
- IxEthAccDuplexMode *mode)
-{
- /*Return the duplex mode for the specified port*/
- UINT32 regval;
-
- /*This is bit 1 of the transmit control reg, set to 1 for half
- duplex, 0 for full duplex*/
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot get Duplex Mode.\n",(INT32)portId,0,0,0,0,0);
- /* return hald duplex */
- *mode = IX_ETH_ACC_HALF_DUPLEX ;
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- if (mode == NULL)
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval);
-
- if( regval & IX_ETH_ACC_TX_CNTRL1_DUPLEX)
- {
- *mode = IX_ETH_ACC_HALF_DUPLEX;
- }
- else
- {
- *mode = IX_ETH_ACC_FULL_DUPLEX;
- }
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-
-
-IxEthAccStatus
-ixEthAccPortTxFrameAppendPaddingEnablePriv (IxEthAccPortId portId)
-{
- UINT32 regval;
- /*Enable FCS computation by the MAC and appending to the
- frame*/
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot enable Tx Frame Append Padding.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval |
- IX_ETH_ACC_TX_CNTRL1_PAD_EN);
-
- ixEthAccMacState[portId].txPADAppend = TRUE;
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortTxFrameAppendPaddingDisablePriv (IxEthAccPortId portId)
-{
- UINT32 regval;
-
- /*disable FCS computation and appending*/
- /*Set bit 4 of Tx control register one to zero*/
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot disble Tx Frame Append Padding.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval & ~IX_ETH_ACC_TX_CNTRL1_PAD_EN);
-
- ixEthAccMacState[portId].txPADAppend = FALSE;
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortTxFrameAppendFCSEnablePriv (IxEthAccPortId portId)
-{
- UINT32 regval;
-
- /*Enable FCS computation by the MAC and appending to the
- frame*/
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot enable Tx Frame Append FCS.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval | IX_ETH_ACC_TX_CNTRL1_FCS_EN);
-
- ixEthAccMacState[portId].txFCSAppend = TRUE;
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortTxFrameAppendFCSDisablePriv (IxEthAccPortId portId)
-{
- UINT32 regval;
-
- /*disable FCS computation and appending*/
- /*Set bit 4 of Tx control register one to zero*/
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot disable Tx Frame Append FCS.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval & ~IX_ETH_ACC_TX_CNTRL1_FCS_EN);
-
- ixEthAccMacState[portId].txFCSAppend = FALSE;
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortRxFrameAppendFCSEnablePriv (IxEthAccPortId portId)
-{
- /*Set bit 2 of Rx control 1*/
- UINT32 regval;
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot enable Rx Frame Append FCS.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval | IX_ETH_ACC_RX_CNTRL1_CRC_EN);
-
- ixEthAccMacState[portId].rxFCSAppend = TRUE;
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccPortRxFrameAppendFCSDisablePriv (IxEthAccPortId portId)
-{
- UINT32 regval;
-
- /*Clear bit 2 of Rx control 1*/
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot disable Rx Frame Append FCS.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval & ~IX_ETH_ACC_RX_CNTRL1_CRC_EN);
-
- ixEthAccMacState[portId].rxFCSAppend = FALSE;
- return IX_ETH_ACC_SUCCESS;
-}
-
-
-
-PRIVATE void
-ixEthAccMacNpeStatsMessageCallback (IxNpeMhNpeId npeId,
- IxNpeMhMessage msg)
-{
- IxEthAccPortId portId = IX_ETH_ACC_NPE_TO_PORT_ID(npeId);
-
-#ifndef NDEBUG
- /* Prudent to at least check the port is within range */
- if (portId >= IX_ETH_ACC_NUMBER_OF_PORTS)
- {
- IX_ETH_ACC_FATAL_LOG(
- "IXETHACC:ixEthAccMacNpeStatsMessageCallback: Illegal port: %u\n",
- (UINT32)portId, 0, 0, 0, 0, 0);
- return;
- }
-#endif
-
- /*Unblock Stats Get call*/
- ixOsalMutexUnlock(&ixEthAccMacState[portId].ackMIBStatsLock);
-
-}
-
-PRIVATE void
-ixEthAccMibIIStatsEndianConvert (IxEthEthObjStats *retStats)
-{
- /* endianness conversion */
-
- /* Rx stats */
- retStats->dot3StatsAlignmentErrors =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->dot3StatsAlignmentErrors);
- retStats->dot3StatsFCSErrors =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->dot3StatsFCSErrors);
- retStats->dot3StatsInternalMacReceiveErrors =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->dot3StatsInternalMacReceiveErrors);
- retStats->RxOverrunDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->RxOverrunDiscards);
- retStats->RxLearnedEntryDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->RxLearnedEntryDiscards);
- retStats->RxLargeFramesDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->RxLargeFramesDiscards);
- retStats->RxSTPBlockedDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->RxSTPBlockedDiscards);
- retStats->RxVLANTypeFilterDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->RxVLANTypeFilterDiscards);
- retStats->RxVLANIdFilterDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->RxVLANIdFilterDiscards);
- retStats->RxInvalidSourceDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->RxInvalidSourceDiscards);
- retStats->RxBlackListDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->RxBlackListDiscards);
- retStats->RxWhiteListDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->RxWhiteListDiscards);
- retStats->RxUnderflowEntryDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->RxUnderflowEntryDiscards);
-
- /* Tx stats */
- retStats->dot3StatsSingleCollisionFrames =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->dot3StatsSingleCollisionFrames);
- retStats->dot3StatsMultipleCollisionFrames =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->dot3StatsMultipleCollisionFrames);
- retStats->dot3StatsDeferredTransmissions =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->dot3StatsDeferredTransmissions);
- retStats->dot3StatsLateCollisions =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->dot3StatsLateCollisions);
- retStats->dot3StatsExcessiveCollsions =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->dot3StatsExcessiveCollsions);
- retStats->dot3StatsInternalMacTransmitErrors =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->dot3StatsInternalMacTransmitErrors);
- retStats->dot3StatsCarrierSenseErrors =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->dot3StatsCarrierSenseErrors);
- retStats->TxLargeFrameDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->TxLargeFrameDiscards);
- retStats->TxVLANIdFilterDiscards =
- IX_OSAL_SWAP_BE_SHARED_LONG(retStats->TxVLANIdFilterDiscards);
-}
-
-IxEthAccStatus
-ixEthAccMibIIStatsGet (IxEthAccPortId portId,
- IxEthEthObjStats *retStats )
-{
- IxNpeMhMessage message;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- printf("EthAcc: ixEthAccMibIIStatsGet (Mac) EthAcc service is not initialized\n");
- return (IX_ETH_ACC_FAIL);
- }
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (retStats == NULL)
- {
- printf("EthAcc: ixEthAccMibIIStatsGet (Mac) NULL argument\n");
- return (IX_ETH_ACC_FAIL);
- }
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- printf("EthAcc: ixEthAccMibIIStatsGet (Mac) NPE for port %d is not available\n", portId);
-
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot get MIB II Stats.\n",(INT32)portId,0,0,0,0,0);
-
- /* Return all zero stats */
- IX_ETH_ACC_MEMSET(retStats, 0, sizeof(IxEthEthObjStats));
-
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- printf("EthAcc: ixEthAccMibIIStatsGet (Mac) port %d is not initialized\n", portId);
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- IX_OSAL_CACHE_INVALIDATE(retStats, sizeof(IxEthEthObjStats));
-
- message.data[0] = IX_ETHNPE_GETSTATS << IX_ETH_ACC_MAC_MSGID_SHL;
- message.data[1] = (UINT32) IX_OSAL_MMU_VIRT_TO_PHYS(retStats);
-
- /* Permit only one task to request MIB statistics Get operation
- at a time */
- ixOsalMutexLock(&ixEthAccMacState[portId].MIBStatsGetAccessLock, IX_OSAL_WAIT_FOREVER);
-
- if(ixNpeMhMessageWithResponseSend(IX_ETH_ACC_PORT_TO_NPE_ID(portId),
- message,
- IX_ETHNPE_GETSTATS,
- ixEthAccMacNpeStatsMessageCallback,
- IX_NPEMH_SEND_RETRIES_DEFAULT)
- != IX_SUCCESS)
- {
- ixOsalMutexUnlock(&ixEthAccMacState[portId].MIBStatsGetAccessLock);
-
- printf("EthAcc: (Mac) StatsGet failed to send NPE message\n");
-
- return IX_ETH_ACC_FAIL;
- }
-
- /* Wait for callback invocation indicating response to
- this request - we need this mutex in order to ensure
- that the return from this function is synchronous */
- ixOsalMutexLock(&ixEthAccMacState[portId].ackMIBStatsLock, IX_ETH_ACC_MIB_STATS_DELAY_MSECS);
-
- /* Permit other tasks to perform MIB statistics Get operation */
- ixOsalMutexUnlock(&ixEthAccMacState[portId].MIBStatsGetAccessLock);
-
- ixEthAccMibIIStatsEndianConvert (retStats);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-
-PRIVATE void
-ixEthAccMacNpeStatsResetMessageCallback (IxNpeMhNpeId npeId,
- IxNpeMhMessage msg)
-{
- IxEthAccPortId portId = IX_ETH_ACC_NPE_TO_PORT_ID(npeId);
-
-#ifndef NDEBUG
- /* Prudent to at least check the port is within range */
- if (portId >= IX_ETH_ACC_NUMBER_OF_PORTS)
- {
- IX_ETH_ACC_FATAL_LOG(
- "IXETHACC:ixEthAccMacNpeStatsResetMessageCallback: Illegal port: %u\n",
- (UINT32)portId, 0, 0, 0, 0, 0);
- return;
- }
-#endif
-
- /*Unblock Stats Get & reset call*/
- ixOsalMutexUnlock(&ixEthAccMacState[portId].ackMIBStatsResetLock);
-
-}
-
-
-
-IxEthAccStatus
-ixEthAccMibIIStatsGetClear (IxEthAccPortId portId,
- IxEthEthObjStats *retStats)
-{
- IxNpeMhMessage message;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- printf("EthAcc: ixEthAccMibIIStatsGetClear (Mac) EthAcc service is not initialized\n");
- return (IX_ETH_ACC_FAIL);
- }
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (retStats == NULL)
- {
- printf("EthAcc: ixEthAccMibIIStatsGetClear (Mac) NULL argument\n");
- return (IX_ETH_ACC_FAIL);
- }
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- printf("EthAcc: ixEthAccMibIIStatsGetClear (Mac) NPE for port %d is not available\n", portId);
-
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot get and clear MIB II Stats.\n", (INT32)portId, 0, 0, 0, 0, 0);
-
- /* Return all zero stats */
- IX_ETH_ACC_MEMSET(retStats, 0, sizeof(IxEthEthObjStats));
-
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if (!IX_ETH_IS_PORT_INITIALIZED(portId))
- {
- printf("EthAcc: ixEthAccMibIIStatsGetClear (Mac) port %d is not initialized\n", portId);
- return (IX_ETH_ACC_PORT_UNINITIALIZED);
- }
-
- IX_OSAL_CACHE_INVALIDATE(retStats, sizeof(IxEthEthObjStats));
-
- message.data[0] = IX_ETHNPE_RESETSTATS << IX_ETH_ACC_MAC_MSGID_SHL;
- message.data[1] = (UINT32) IX_OSAL_MMU_VIRT_TO_PHYS(retStats);
-
- /* Permit only one task to request MIB statistics Get-Reset operation at a time */
- ixOsalMutexLock(&ixEthAccMacState[portId].MIBStatsGetResetAccessLock, IX_OSAL_WAIT_FOREVER);
-
- if(ixNpeMhMessageWithResponseSend(IX_ETH_ACC_PORT_TO_NPE_ID(portId),
- message,
- IX_ETHNPE_RESETSTATS,
- ixEthAccMacNpeStatsResetMessageCallback,
- IX_NPEMH_SEND_RETRIES_DEFAULT)
- != IX_SUCCESS)
- {
- ixOsalMutexUnlock(&ixEthAccMacState[portId].MIBStatsGetResetAccessLock);
-
- printf("EthAcc: (Mac) ixEthAccMibIIStatsGetClear failed to send NPE message\n");
-
- return IX_ETH_ACC_FAIL;
- }
-
- /* Wait for callback invocation indicating response to this request */
- ixOsalMutexLock(&ixEthAccMacState[portId].ackMIBStatsResetLock, IX_ETH_ACC_MIB_STATS_DELAY_MSECS);
-
- /* permit other tasks to get and reset MIB stats*/
- ixOsalMutexUnlock(&ixEthAccMacState[portId].MIBStatsGetResetAccessLock);
-
- ixEthAccMibIIStatsEndianConvert(retStats);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-IxEthAccStatus
-ixEthAccMibIIStatsClear (IxEthAccPortId portId)
-{
- static IxEthEthObjStats retStats;
- IxEthAccStatus status;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot clear MIB II Stats.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- /* there is no reset operation without a corresponding Get */
- status = ixEthAccMibIIStatsGetClear(portId, &retStats);
-
- return status;
-}
-
-/* Initialize the ethernet MAC settings */
-IxEthAccStatus
-ixEthAccMacInit(IxEthAccPortId portId)
-{
- IX_OSAL_MBUF_POOL* portDisablePool;
- UINT8 *data;
-
- IX_ETH_ACC_VALIDATE_PORT_ID(portId);
-
- if (IX_ETH_ACC_SUCCESS != ixEthAccSingleEthNpeCheck(portId))
- {
- IX_ETH_ACC_WARNING_LOG("EthAcc: Unavailable Eth %d: Cannot initialize Mac.\n",(INT32)portId,0,0,0,0,0);
- return IX_ETH_ACC_SUCCESS ;
- }
-
- if(ixEthAccMacState[portId].macInitialised == FALSE)
- {
- ixEthAccMacState[portId].fullDuplex = TRUE;
- ixEthAccMacState[portId].rxFCSAppend = TRUE;
- ixEthAccMacState[portId].txFCSAppend = TRUE;
- ixEthAccMacState[portId].txPADAppend = TRUE;
- ixEthAccMacState[portId].enabled = FALSE;
- ixEthAccMacState[portId].promiscuous = TRUE;
- ixEthAccMacState[portId].joinAll = FALSE;
- ixEthAccMacState[portId].initDone = FALSE;
- ixEthAccMacState[portId].macInitialised = TRUE;
-
- /* initialize MIB stats mutexes */
- ixOsalMutexInit(&ixEthAccMacState[portId].ackMIBStatsLock);
- ixOsalMutexLock(&ixEthAccMacState[portId].ackMIBStatsLock, IX_OSAL_WAIT_FOREVER);
-
- ixOsalMutexInit(&ixEthAccMacState[portId].ackMIBStatsResetLock);
- ixOsalMutexLock(&ixEthAccMacState[portId].ackMIBStatsResetLock, IX_OSAL_WAIT_FOREVER);
-
- ixOsalMutexInit(&ixEthAccMacState[portId].MIBStatsGetAccessLock);
-
- ixOsalMutexInit(&ixEthAccMacState[portId].MIBStatsGetResetAccessLock);
-
- ixOsalMutexInit(&ixEthAccMacState[portId].npeLoopbackMessageLock);
-
- ixEthAccMacState[portId].portDisableRxMbufPtr = NULL;
- ixEthAccMacState[portId].portDisableTxMbufPtr = NULL;
-
- portDisablePool = IX_OSAL_MBUF_POOL_INIT(2,
- IX_ETHACC_RX_MBUF_MIN_SIZE,
- "portDisable Pool");
-
- IX_OSAL_ENSURE(portDisablePool != NULL, "Failed to initialize PortDisable pool");
-
- ixEthAccMacState[portId].portDisableRxMbufPtr = IX_OSAL_MBUF_POOL_GET(portDisablePool);
- ixEthAccMacState[portId].portDisableTxMbufPtr = IX_OSAL_MBUF_POOL_GET(portDisablePool);
-
- IX_OSAL_ENSURE(ixEthAccMacState[portId].portDisableRxMbufPtr != NULL,
- "Pool allocation failed");
- IX_OSAL_ENSURE(ixEthAccMacState[portId].portDisableTxMbufPtr != NULL,
- "Pool allocation failed");
- /* fill the payload of the Rx mbuf used in portDisable */
- IX_OSAL_MBUF_MLEN(ixEthAccMacState[portId].portDisableRxMbufPtr) = IX_ETHACC_RX_MBUF_MIN_SIZE;
-
- memset(IX_OSAL_MBUF_MDATA(ixEthAccMacState[portId].portDisableRxMbufPtr),
- 0xAA,
- IX_ETHACC_RX_MBUF_MIN_SIZE);
-
- /* fill the payload of the Tx mbuf used in portDisable (64 bytes) */
- IX_OSAL_MBUF_MLEN(ixEthAccMacState[portId].portDisableTxMbufPtr) = 64;
- IX_OSAL_MBUF_PKT_LEN(ixEthAccMacState[portId].portDisableTxMbufPtr) = 64;
-
- data = (UINT8 *) IX_OSAL_MBUF_MDATA(ixEthAccMacState[portId].portDisableTxMbufPtr);
- memset(data, 0xBB, 64);
- data[0] = 0x00; /* unicast destination MAC address */
- data[6] = 0x00; /* unicast source MAC address */
- data[12] = 0x08; /* typelength : IP frame */
- data[13] = 0x00; /* typelength : IP frame */
-
- IX_OSAL_CACHE_FLUSH(data, 64);
- }
-
- IX_OSAL_ASSERT (ixEthAccMacBase[portId] != 0);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_CORE_CNTRL,
- IX_ETH_ACC_CORE_RESET);
-
- ixOsalSleep(IX_ETH_ACC_MAC_RESET_DELAY);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_CORE_CNTRL,
- IX_ETH_ACC_CORE_MDC_EN);
-
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_INT_CLK_THRESH,
- IX_ETH_ACC_MAC_INT_CLK_THRESH_DEFAULT);
-
- ixEthAccMacStateUpdate(portId);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-/* PRIVATE Functions*/
-
-PRIVATE void
-ixEthAccMacStateUpdate(IxEthAccPortId portId)
-{
- UINT32 regval;
-
- if ( ixEthAccMacState[portId].enabled == FALSE )
- {
- /* Just disable both the transmitter and reciver in the MAC. */
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval);
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval & ~IX_ETH_ACC_RX_CNTRL1_RX_EN);
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval);
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval & ~IX_ETH_ACC_TX_CNTRL1_TX_EN);
- }
-
- if(ixEthAccMacState[portId].fullDuplex)
- {
- ixEthAccPortDuplexModeSetPriv (portId, IX_ETH_ACC_FULL_DUPLEX);
- }
- else
- {
- ixEthAccPortDuplexModeSetPriv (portId, IX_ETH_ACC_HALF_DUPLEX);
- }
-
- if(ixEthAccMacState[portId].rxFCSAppend)
- {
- ixEthAccPortRxFrameAppendFCSEnablePriv (portId);
- }
- else
- {
- ixEthAccPortRxFrameAppendFCSDisablePriv (portId);
- }
-
- if(ixEthAccMacState[portId].txFCSAppend)
- {
- ixEthAccPortTxFrameAppendFCSEnablePriv (portId);
- }
- else
- {
- ixEthAccPortTxFrameAppendFCSDisablePriv (portId);
- }
-
- if(ixEthAccMacState[portId].txPADAppend)
- {
- ixEthAccPortTxFrameAppendPaddingEnablePriv (portId);
- }
- else
- {
- ixEthAccPortTxFrameAppendPaddingDisablePriv (portId);
- }
-
- if(ixEthAccMacState[portId].promiscuous)
- {
- ixEthAccPortPromiscuousModeSetPriv(portId);
- }
- else
- {
- ixEthAccPortPromiscuousModeClearPriv(portId);
- }
-
- if ( ixEthAccMacState[portId].enabled == TRUE )
- {
- /* Enable both the transmitter and reciver in the MAC. */
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval);
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_RX_CNTRL1,
- regval | IX_ETH_ACC_RX_CNTRL1_RX_EN);
-
- REG_READ(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval);
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_TX_CNTRL1,
- regval | IX_ETH_ACC_TX_CNTRL1_TX_EN);
- }
-}
-
-
-PRIVATE BOOL
-ixEthAccMacEqual(IxEthAccMacAddr *macAddr1,
- IxEthAccMacAddr *macAddr2)
-{
- UINT32 i;
- for(i=0;i<IX_IEEE803_MAC_ADDRESS_SIZE; i++)
- {
- if(macAddr1->macAddress[i] != macAddr2->macAddress[i])
- {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-PRIVATE void
-ixEthAccMacPrint(IxEthAccMacAddr *m)
-{
- printf("%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x",
- m->macAddress[0], m->macAddress[1],
- m->macAddress[2], m->macAddress[3],
- m->macAddress[4], m->macAddress[5]);
-}
-
-/* Set the multicast address and address mask registers
- *
- * A bit in the address mask register must be set if
- * all multicast addresses always have that bit set, or if
- * all multicast addresses always have that bit cleared.
- *
- * A bit in the address register must be set if all multicast
- * addresses have that bit set, otherwise, it should be cleared
- */
-
-PRIVATE void
-ixEthAccMulticastAddressSet(IxEthAccPortId portId)
-{
- UINT32 i;
- UINT32 j;
- IxEthAccMacAddr addressMask;
- IxEthAccMacAddr address;
- IxEthAccMacAddr alwaysClearBits;
- IxEthAccMacAddr alwaysSetBits;
-
- /* calculate alwaysClearBits and alwaysSetBits:
- * alwaysClearBits is calculated by ORing all
- * multicast addresses, those bits that are always
- * clear are clear in the result
- *
- * alwaysSetBits is calculated by ANDing all
- * multicast addresses, those bits that are always set
- * are set in the result
- */
-
- if (ixEthAccMacState[portId].promiscuous == TRUE)
- {
- /* Promiscuous Mode is set, and filtering
- * allow all packets, and enable the mcast and
- * bcast detection.
- */
- memset(&addressMask.macAddress,
- 0,
- IX_IEEE803_MAC_ADDRESS_SIZE);
- memset(&address.macAddress,
- 0,
- IX_IEEE803_MAC_ADDRESS_SIZE);
- }
- else
- {
- if(ixEthAccMacState[portId].joinAll == TRUE)
- {
- /* Join all is set. The mask and address are
- * the multicast settings.
- */
- IxEthAccMacAddr macAddr = {{0x1,0x0,0x0,0x0,0x0,0x0}};
-
- memcpy(addressMask.macAddress,
- macAddr.macAddress,
- IX_IEEE803_MAC_ADDRESS_SIZE);
- memcpy(address.macAddress,
- macAddr.macAddress,
- IX_IEEE803_MAC_ADDRESS_SIZE);
- }
- else if(ixEthAccMacState[portId].mcastAddrIndex == 0)
- {
- /* No entry in the filtering database,
- * Promiscuous Mode is cleared, Broadcast filtering
- * is configured.
- */
- memset(addressMask.macAddress,
- IX_ETH_ACC_MAC_ALL_BITS_SET,
- IX_IEEE803_MAC_ADDRESS_SIZE);
- memset(address.macAddress,
- IX_ETH_ACC_MAC_ALL_BITS_SET,
- IX_IEEE803_MAC_ADDRESS_SIZE);
- }
- else
- {
- /* build a mask and an address which mix all entreis
- * from the list of multicast addresses
- */
- memset(alwaysClearBits.macAddress,
- 0,
- IX_IEEE803_MAC_ADDRESS_SIZE);
- memset(alwaysSetBits.macAddress,
- IX_ETH_ACC_MAC_ALL_BITS_SET,
- IX_IEEE803_MAC_ADDRESS_SIZE);
-
- for(i=0;i<ixEthAccMacState[portId].mcastAddrIndex;i++)
- {
- for(j=0;j<IX_IEEE803_MAC_ADDRESS_SIZE;j++)
- {
- alwaysClearBits.macAddress[j] |=
- ixEthAccMacState[portId].mcastAddrsTable[i].macAddress[j];
- alwaysSetBits.macAddress[j] &=
- ixEthAccMacState[portId].mcastAddrsTable[i].macAddress[j];
- }
- }
-
- for(i=0;i<IX_IEEE803_MAC_ADDRESS_SIZE;i++)
- {
- addressMask.macAddress[i] = alwaysSetBits.macAddress[i]
- | ~alwaysClearBits.macAddress[i];
- address.macAddress[i] = alwaysSetBits.macAddress[i];
- }
- }
- }
-
- /*write the new addr filtering to h/w*/
- for(i=0;i<IX_IEEE803_MAC_ADDRESS_SIZE;i++)
- {
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_ADDR_MASK_1+i*sizeof(UINT32),
- addressMask.macAddress[i]);
- REG_WRITE(ixEthAccMacBase[portId],
- IX_ETH_ACC_MAC_ADDR_1+i*sizeof(UINT32),
- address.macAddress[i]);
- }
-}
diff --git a/cpu/ixp/npe/IxEthAccMii.c b/cpu/ixp/npe/IxEthAccMii.c
deleted file mode 100644
index 86368a4734..0000000000
--- a/cpu/ixp/npe/IxEthAccMii.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/**
- * @file IxEthAccMii.c
- *
- * @author Intel Corporation
- * @date
- *
- * @brief MII control functions
- *
- * Design Notes:
- *
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxOsal.h"
-#include "IxEthAcc.h"
-#include "IxEthAcc_p.h"
-#include "IxEthAccMac_p.h"
-#include "IxEthAccMii_p.h"
-
-
-PRIVATE UINT32 miiBaseAddressVirt;
-PRIVATE IxOsalMutex miiAccessLock;
-
-PUBLIC UINT32 ixEthAccMiiRetryCount = IX_ETH_ACC_MII_TIMEOUT_10TH_SECS;
-PUBLIC UINT32 ixEthAccMiiAccessTimeout = IX_ETH_ACC_MII_10TH_SEC_IN_MILLIS;
-
-/* -----------------------------------
- * private function prototypes
- */
-PRIVATE void
-ixEthAccMdioCmdWrite(UINT32 mdioCommand);
-
-PRIVATE void
-ixEthAccMdioCmdRead(UINT32 *data);
-
-PRIVATE void
-ixEthAccMdioStatusRead(UINT32 *data);
-
-
-PRIVATE void
-ixEthAccMdioCmdWrite(UINT32 mdioCommand)
-{
- REG_WRITE(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_CMD_1,
- mdioCommand & 0xff);
-
- REG_WRITE(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_CMD_2,
- (mdioCommand >> 8) & 0xff);
-
- REG_WRITE(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_CMD_3,
- (mdioCommand >> 16) & 0xff);
-
- REG_WRITE(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_CMD_4,
- (mdioCommand >> 24) & 0xff);
-}
-
-PRIVATE void
-ixEthAccMdioCmdRead(UINT32 *data)
-{
- UINT32 regval;
-
- REG_READ(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_CMD_1,
- regval);
-
- *data = regval & 0xff;
-
- REG_READ(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_CMD_2,
- regval);
-
- *data |= (regval & 0xff) << 8;
-
- REG_READ(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_CMD_3,
- regval);
-
- *data |= (regval & 0xff) << 16;
-
- REG_READ(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_CMD_4,
- regval);
-
- *data |= (regval & 0xff) << 24;
-
-}
-
-PRIVATE void
-ixEthAccMdioStatusRead(UINT32 *data)
-{
- UINT32 regval;
-
- REG_READ(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_STS_1,
- regval);
-
- *data = regval & 0xff;
-
- REG_READ(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_STS_2,
- regval);
-
- *data |= (regval & 0xff) << 8;
-
- REG_READ(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_STS_3,
- regval);
-
- *data |= (regval & 0xff) << 16;
-
- REG_READ(miiBaseAddressVirt,
- IX_ETH_ACC_MAC_MDIO_STS_4,
- regval);
-
- *data |= (regval & 0xff) << 24;
-
-}
-
-
-/********************************************************************
- * ixEthAccMiiInit
- */
-IxEthAccStatus
-ixEthAccMiiInit()
-{
- if(ixOsalMutexInit(&miiAccessLock)!= IX_SUCCESS)
- {
- return IX_ETH_ACC_FAIL;
- }
-
- miiBaseAddressVirt = (UINT32) IX_OSAL_MEM_MAP(IX_ETH_ACC_MAC_0_BASE, IX_OSAL_IXP400_ETHA_MAP_SIZE);
-
- if (miiBaseAddressVirt == 0)
- {
- ixOsalLog(IX_OSAL_LOG_LVL_FATAL,
- IX_OSAL_LOG_DEV_STDOUT,
- "EthAcc: Could not map MII I/O mapped memory\n",
- 0, 0, 0, 0, 0, 0);
-
- return IX_ETH_ACC_FAIL;
- }
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-void
-ixEthAccMiiUnload(void)
-{
- IX_OSAL_MEM_UNMAP(miiBaseAddressVirt);
-
- miiBaseAddressVirt = 0;
-}
-
-PUBLIC IxEthAccStatus
-ixEthAccMiiAccessTimeoutSet(UINT32 timeout, UINT32 retryCount)
-{
- if (retryCount < 1) return IX_ETH_ACC_FAIL;
-
- ixEthAccMiiRetryCount = retryCount;
- ixEthAccMiiAccessTimeout = timeout;
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-/*********************************************************************
- * ixEthAccMiiReadRtn - read a 16 bit value from a PHY
- */
-IxEthAccStatus
-ixEthAccMiiReadRtn (UINT8 phyAddr,
- UINT8 phyReg,
- UINT16 *value)
-{
- UINT32 mdioCommand;
- UINT32 regval;
- UINT32 miiTimeout;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- if ((phyAddr >= IXP425_ETH_ACC_MII_MAX_ADDR)
- || (phyReg >= IXP425_ETH_ACC_MII_MAX_REG))
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- if (value == NULL)
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&miiAccessLock, IX_OSAL_WAIT_FOREVER);
- mdioCommand = phyReg << IX_ETH_ACC_MII_REG_SHL
- | phyAddr << IX_ETH_ACC_MII_ADDR_SHL;
- mdioCommand |= IX_ETH_ACC_MII_GO;
-
- ixEthAccMdioCmdWrite(mdioCommand);
-
- miiTimeout = ixEthAccMiiRetryCount;
-
- while(miiTimeout)
- {
-
- ixEthAccMdioCmdRead(&regval);
-
- if((regval & IX_ETH_ACC_MII_GO) == 0x0)
- {
- break;
- }
- /* Sleep for a while */
- ixOsalSleep(ixEthAccMiiAccessTimeout);
- miiTimeout--;
- }
-
-
-
- if(miiTimeout == 0)
- {
- ixOsalMutexUnlock(&miiAccessLock);
- *value = 0xffff;
- return IX_ETH_ACC_FAIL;
- }
-
-
- ixEthAccMdioStatusRead(&regval);
- if(regval & IX_ETH_ACC_MII_READ_FAIL)
- {
- ixOsalMutexUnlock(&miiAccessLock);
- *value = 0xffff;
- return IX_ETH_ACC_FAIL;
- }
-
- *value = regval & 0xffff;
- ixOsalMutexUnlock(&miiAccessLock);
- return IX_ETH_ACC_SUCCESS;
-
-}
-
-
-/*********************************************************************
- * ixEthAccMiiWriteRtn - write a 16 bit value to a PHY
- */
-IxEthAccStatus
-ixEthAccMiiWriteRtn (UINT8 phyAddr,
- UINT8 phyReg,
- UINT16 value)
-{
- UINT32 mdioCommand;
- UINT32 regval;
- UINT16 readVal;
- UINT32 miiTimeout;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- if ((phyAddr >= IXP425_ETH_ACC_MII_MAX_ADDR)
- || (phyReg >= IXP425_ETH_ACC_MII_MAX_REG))
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- /* ensure that a PHY is present at this address */
- if(ixEthAccMiiReadRtn(phyAddr,
- IX_ETH_ACC_MII_CTRL_REG,
- &readVal) != IX_ETH_ACC_SUCCESS)
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&miiAccessLock, IX_OSAL_WAIT_FOREVER);
- mdioCommand = phyReg << IX_ETH_ACC_MII_REG_SHL
- | phyAddr << IX_ETH_ACC_MII_ADDR_SHL ;
- mdioCommand |= IX_ETH_ACC_MII_GO | IX_ETH_ACC_MII_WRITE | value;
-
- ixEthAccMdioCmdWrite(mdioCommand);
-
- miiTimeout = ixEthAccMiiRetryCount;
-
- while(miiTimeout)
- {
-
- ixEthAccMdioCmdRead(&regval);
-
- /*The "GO" bit is reset to 0 when the write completes*/
- if((regval & IX_ETH_ACC_MII_GO) == 0x0)
- {
- break;
- }
- /* Sleep for a while */
- ixOsalSleep(ixEthAccMiiAccessTimeout);
- miiTimeout--;
- }
-
- ixOsalMutexUnlock(&miiAccessLock);
- if(miiTimeout == 0)
- {
- return IX_ETH_ACC_FAIL;
- }
- return IX_ETH_ACC_SUCCESS;
-}
-
-
-/*****************************************************************
- *
- * Phy query functions
- *
- */
-IxEthAccStatus
-ixEthAccMiiStatsShow (UINT32 phyAddr)
-{
- UINT16 regval;
- printf("Regisers on PHY at address 0x%x\n", phyAddr);
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_ACC_MII_CTRL_REG, &regval);
- printf(" Control Register : 0x%4.4x\n", regval);
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_ACC_MII_STAT_REG, &regval);
- printf(" Status Register : 0x%4.4x\n", regval);
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_ACC_MII_PHY_ID1_REG, &regval);
- printf(" PHY ID1 Register : 0x%4.4x\n", regval);
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_ACC_MII_PHY_ID2_REG, &regval);
- printf(" PHY ID2 Register : 0x%4.4x\n", regval);
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_ACC_MII_AN_ADS_REG, &regval);
- printf(" Auto Neg ADS Register : 0x%4.4x\n", regval);
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_ACC_MII_AN_PRTN_REG, &regval);
- printf(" Auto Neg Partner Ability Register : 0x%4.4x\n", regval);
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_ACC_MII_AN_EXP_REG, &regval);
- printf(" Auto Neg Expansion Register : 0x%4.4x\n", regval);
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_ACC_MII_AN_NEXT_REG, &regval);
- printf(" Auto Neg Next Register : 0x%4.4x\n", regval);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
-
-/*****************************************************************
- *
- * Interface query functions
- *
- */
-IxEthAccStatus
-ixEthAccMdioShow (void)
-{
- UINT32 regval;
-
- if (!IX_ETH_ACC_IS_SERVICE_INITIALIZED())
- {
- return (IX_ETH_ACC_FAIL);
- }
-
- ixOsalMutexLock(&miiAccessLock, IX_OSAL_WAIT_FOREVER);
- ixEthAccMdioCmdRead(&regval);
- ixOsalMutexUnlock(&miiAccessLock);
-
- printf("MDIO command register\n");
- printf(" Go bit : 0x%x\n", (regval & BIT(31)) >> 31);
- printf(" MDIO Write : 0x%x\n", (regval & BIT(26)) >> 26);
- printf(" PHY address : 0x%x\n", (regval >> 21) & 0x1f);
- printf(" Reg address : 0x%x\n", (regval >> 16) & 0x1f);
-
- ixOsalMutexLock(&miiAccessLock, IX_OSAL_WAIT_FOREVER);
- ixEthAccMdioStatusRead(&regval);
- ixOsalMutexUnlock(&miiAccessLock);
-
- printf("MDIO status register\n");
- printf(" Read OK : 0x%x\n", (regval & BIT(31)) >> 31);
- printf(" Read Data : 0x%x\n", (regval >> 16) & 0xff);
-
- return IX_ETH_ACC_SUCCESS;
-}
-
diff --git a/cpu/ixp/npe/IxEthDBAPI.c b/cpu/ixp/npe/IxEthDBAPI.c
deleted file mode 100644
index b2bfb72606..0000000000
--- a/cpu/ixp/npe/IxEthDBAPI.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/**
- * @file IxEthDBAPI.c
- *
- * @brief Implementation of the public API
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxEthDB_p.h"
-#include "IxFeatureCtrl.h"
-
-extern HashTable dbHashtable;
-extern IxEthDBPortMap overflowUpdatePortList;
-extern BOOL ixEthDBPortUpdateRequired[IX_ETH_DB_MAX_RECORD_TYPE_INDEX + 1];
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringStaticEntryProvision(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_LEARNING);
-
- return ixEthDBTriggerAddPortUpdate(macAddr, portID, TRUE);
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringDynamicEntryProvision(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_LEARNING);
-
- return ixEthDBTriggerAddPortUpdate(macAddr, portID, FALSE);
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringEntryDelete(IxEthDBMacAddr *macAddr)
-{
- HashNode *searchResult;
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_ALL_FILTERING_RECORDS);
-
- if (searchResult == NULL)
- {
- return IX_ETH_DB_NO_SUCH_ADDR; /* not found */
- }
-
- ixEthDBReleaseHashNode(searchResult);
-
- /* build a remove event and place it on the event queue */
- return ixEthDBTriggerRemovePortUpdate(macAddr, ((MacDescriptor *) searchResult->data)->portID);
-}
-
-IX_ETH_DB_PUBLIC
-void ixEthDBDatabaseMaintenance()
-{
- HashIterator iterator;
- UINT32 portIndex;
- BOOL agingRequired = FALSE;
-
- /* ports who will have deleted records and therefore will need updating */
- IxEthDBPortMap triggerPorts;
-
- if (IX_FEATURE_CTRL_SWCONFIG_ENABLED !=
- ixFeatureCtrlSwConfigurationCheck (IX_FEATURECTRL_ETH_LEARNING))
- {
- return;
- }
-
- SET_EMPTY_DEPENDENCY_MAP(triggerPorts);
-
- /* check if there's at least a port that needs aging */
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- if (ixEthDBPortInfo[portIndex].agingEnabled && ixEthDBPortInfo[portIndex].enabled)
- {
- agingRequired = TRUE;
- }
- }
-
- if (agingRequired)
- {
- /* ask each NPE port to write back the database for aging inspection */
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- if (ixEthDBPortDefinitions[portIndex].type == IX_ETH_NPE
- && ixEthDBPortInfo[portIndex].agingEnabled
- && ixEthDBPortInfo[portIndex].enabled)
- {
- IxNpeMhMessage message;
- IX_STATUS result;
-
- /* send EDB_GetMACAddressDatabase message */
- FILL_GETMACADDRESSDATABASE(message,
- 0 /* unused */,
- IX_OSAL_MMU_VIRT_TO_PHYS(ixEthDBPortInfo[portIndex].updateMethod.npeUpdateZone));
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portIndex), message, result);
-
- if (result == IX_SUCCESS)
- {
- /* analyze NPE copy */
- ixEthDBNPESyncScan(portIndex, ixEthDBPortInfo[portIndex].updateMethod.npeUpdateZone, FULL_ELT_BYTE_SIZE);
-
- IX_ETH_DB_SUPPORT_TRACE("DB: (API) Finished scanning NPE tree on port %d\n", portIndex);
- }
- else
- {
- ixEthDBPortInfo[portIndex].agingEnabled = FALSE;
- ixEthDBPortInfo[portIndex].updateMethod.updateEnabled = FALSE;
- ixEthDBPortInfo[portIndex].updateMethod.userControlled = TRUE;
-
- ixOsalLog(IX_OSAL_LOG_LVL_FATAL,
- IX_OSAL_LOG_DEV_STDOUT,
- "EthDB: (Maintenance) warning, disabling aging and updates for port %d (assumed dead)\n",
- portIndex, 0, 0, 0, 0, 0);
-
- ixEthDBDatabaseClear(portIndex, IX_ETH_DB_ALL_RECORD_TYPES);
- }
- }
- }
-
- /* browse database and age entries */
- BUSY_RETRY(ixEthDBInitHashIterator(&dbHashtable, &iterator));
-
- while (IS_ITERATOR_VALID(&iterator))
- {
- MacDescriptor *descriptor = (MacDescriptor *) iterator.node->data;
- UINT32 *age = NULL;
- BOOL staticEntry = TRUE;
-
- if (descriptor->type == IX_ETH_DB_FILTERING_RECORD)
- {
- age = &descriptor->recordData.filteringData.age;
- staticEntry = descriptor->recordData.filteringData.staticEntry;
- }
- else if (descriptor->type == IX_ETH_DB_FILTERING_VLAN_RECORD)
- {
- age = &descriptor->recordData.filteringVlanData.age;
- staticEntry = descriptor->recordData.filteringVlanData.staticEntry;
- }
- else
- {
- staticEntry = TRUE;
- }
-
- if (ixEthDBPortInfo[descriptor->portID].agingEnabled && (staticEntry == FALSE))
- {
- /* manually increment the age if the port has no such capability */
- if ((ixEthDBPortDefinitions[descriptor->portID].capabilities & IX_ETH_ENTRY_AGING) == 0)
- {
- *age += (IX_ETH_DB_MAINTENANCE_TIME / 60);
- }
-
- /* age entry if it exceeded the maximum time to live */
- if (*age >= (IX_ETH_DB_LEARNING_ENTRY_AGE_TIME / 60))
- {
- /* add port to the set of update trigger ports */
- JOIN_PORT_TO_MAP(triggerPorts, descriptor->portID);
-
- /* delete entry */
- BUSY_RETRY(ixEthDBRemoveEntryAtHashIterator(&dbHashtable, &iterator));
- }
- else
- {
- /* move to the next record */
- BUSY_RETRY(ixEthDBIncrementHashIterator(&dbHashtable, &iterator));
- }
- }
- else
- {
- /* move to the next record */
- BUSY_RETRY(ixEthDBIncrementHashIterator(&dbHashtable, &iterator));
- }
- }
-
- /* update ports which lost records */
- ixEthDBUpdatePortLearningTrees(triggerPorts);
- }
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBDatabaseClear(IxEthDBPortId portID, IxEthDBRecordType recordType)
-{
- IxEthDBPortMap triggerPorts;
- HashIterator iterator;
-
- if (portID >= IX_ETH_DB_NUMBER_OF_PORTS && portID != IX_ETH_DB_ALL_PORTS)
- {
- return IX_ETH_DB_INVALID_PORT;
- }
-
- /* check if the user passes some extra bits */
- if ((recordType | IX_ETH_DB_ALL_RECORD_TYPES) != IX_ETH_DB_ALL_RECORD_TYPES)
- {
- return IX_ETH_DB_INVALID_ARG;
- }
-
- SET_EMPTY_DEPENDENCY_MAP(triggerPorts);
-
- /* browse database and age entries */
- BUSY_RETRY(ixEthDBInitHashIterator(&dbHashtable, &iterator));
-
- while (IS_ITERATOR_VALID(&iterator))
- {
- MacDescriptor *descriptor = (MacDescriptor *) iterator.node->data;
-
- if (((descriptor->portID == portID) || (portID == IX_ETH_DB_ALL_PORTS))
- && ((descriptor->type & recordType) != 0))
- {
- /* add to trigger if automatic updates are required */
- if (ixEthDBPortUpdateRequired[descriptor->type])
- {
- /* add port to the set of update trigger ports */
- JOIN_PORT_TO_MAP(triggerPorts, descriptor->portID);
- }
-
- /* delete entry */
- BUSY_RETRY(ixEthDBRemoveEntryAtHashIterator(&dbHashtable, &iterator));
- }
- else
- {
- /* move to the next record */
- BUSY_RETRY(ixEthDBIncrementHashIterator(&dbHashtable, &iterator));
- }
- }
-
- /* update ports which lost records */
- ixEthDBUpdatePortLearningTrees(triggerPorts);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringPortSearch(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
-{
- HashNode *searchResult;
- IxEthDBStatus result = IX_ETH_DB_NO_SUCH_ADDR;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_LEARNING);
-
- searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_ALL_FILTERING_RECORDS);
-
- if (searchResult == NULL)
- {
- return IX_ETH_DB_NO_SUCH_ADDR; /* not found */
- }
-
- if (((MacDescriptor *) (searchResult->data))->portID == portID)
- {
- result = IX_ETH_DB_SUCCESS; /* address and port match */
- }
-
- ixEthDBReleaseHashNode(searchResult);
-
- return result;
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringDatabaseSearch(IxEthDBPortId *portID, IxEthDBMacAddr *macAddr)
-{
- HashNode *searchResult;
-
- IX_ETH_DB_CHECK_REFERENCE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_ALL_FILTERING_RECORDS);
-
- if (searchResult == NULL)
- {
- return IX_ETH_DB_NO_SUCH_ADDR; /* not found */
- }
-
- /* return the port ID */
- *portID = ((MacDescriptor *) searchResult->data)->portID;
-
- ixEthDBReleaseHashNode(searchResult);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortAgingDisable(IxEthDBPortId portID)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_LEARNING);
-
- ixEthDBPortInfo[portID].agingEnabled = FALSE;
-
- return IX_ETH_DB_SUCCESS;
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortAgingEnable(IxEthDBPortId portID)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_LEARNING);
-
- ixEthDBPortInfo[portID].agingEnabled = TRUE;
-
- return IX_ETH_DB_SUCCESS;
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringPortUpdatingSearch(IxEthDBPortId *portID, IxEthDBMacAddr *macAddr)
-{
- HashNode *searchResult;
- MacDescriptor *descriptor;
-
- IX_ETH_DB_CHECK_REFERENCE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_ALL_FILTERING_RECORDS);
-
- if (searchResult == NULL)
- {
- return IX_ETH_DB_NO_SUCH_ADDR; /* not found */
- }
-
- descriptor = (MacDescriptor *) searchResult->data;
-
- /* return the port ID */
- *portID = descriptor->portID;
-
- /* reset entry age */
- if (descriptor->type == IX_ETH_DB_FILTERING_RECORD)
- {
- descriptor->recordData.filteringData.age = 0;
- }
- else
- {
- descriptor->recordData.filteringVlanData.age = 0;
- }
-
- ixEthDBReleaseHashNode(searchResult);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortDependencyMapSet(IxEthDBPortId portID, IxEthDBPortMap dependencyPortMap)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(dependencyPortMap);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_FILTERING);
-
- /* force bit at offset 255 to 0 (reserved) */
- dependencyPortMap[31] &= 0xFE;
-
- COPY_DEPENDENCY_MAP(ixEthDBPortInfo[portID].dependencyPortMap, dependencyPortMap);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortDependencyMapGet(IxEthDBPortId portID, IxEthDBPortMap dependencyPortMap)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(dependencyPortMap);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_FILTERING);
-
- COPY_DEPENDENCY_MAP(dependencyPortMap, ixEthDBPortInfo[portID].dependencyPortMap);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortUpdateEnableSet(IxEthDBPortId portID, BOOL enableUpdate)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_FILTERING);
-
- ixEthDBPortInfo[portID].updateMethod.updateEnabled = enableUpdate;
- ixEthDBPortInfo[portID].updateMethod.userControlled = TRUE;
-
- return IX_ETH_DB_SUCCESS;
-}
diff --git a/cpu/ixp/npe/IxEthDBAPISupport.c b/cpu/ixp/npe/IxEthDBAPISupport.c
deleted file mode 100644
index 86d5573045..0000000000
--- a/cpu/ixp/npe/IxEthDBAPISupport.c
+++ /dev/null
@@ -1,650 +0,0 @@
-/**
- * @file IxEthDBAPISupport.c
- *
- * @brief Public API support functions
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include <IxEthDB.h>
-#include <IxNpeMh.h>
-#include <IxFeatureCtrl.h>
-
-#include "IxEthDB_p.h"
-#include "IxEthDBMessages_p.h"
-#include "IxEthDB_p.h"
-#include "IxEthDBLog_p.h"
-
-#ifdef IX_UNIT_TEST
-
-int dbAccessCounter = 0;
-int overflowEvent = 0;
-
-#endif
-
-/*
- * External declaration
- */
-extern HashTable dbHashtable;
-
-/*
- * Internal declaration
- */
-IX_ETH_DB_PUBLIC
-PortInfo ixEthDBPortInfo[IX_ETH_DB_NUMBER_OF_PORTS];
-
-IX_ETH_DB_PRIVATE
-struct
-{
- BOOL saved;
- IxEthDBPriorityTable priorityTable;
- IxEthDBVlanSet vlanMembership;
- IxEthDBVlanSet transmitTaggingInfo;
- IxEthDBFrameFilter frameFilter;
- IxEthDBTaggingAction taggingAction;
- IxEthDBFirewallMode firewallMode;
- BOOL stpBlocked;
- BOOL srcAddressFilterEnabled;
- UINT32 maxRxFrameSize;
- UINT32 maxTxFrameSize;
-} ixEthDBPortState[IX_ETH_DB_NUMBER_OF_PORTS];
-
-#define IX_ETH_DB_DEFAULT_FRAME_SIZE (1518)
-
-/**
- * @brief initializes a port
- *
- * @param portID ID of the port to be initialized
- *
- * Note that redundant initializations are silently
- * dealt with and do not constitute an error
- *
- * This function is fully documented in the main
- * header file, IxEthDB.h
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBPortInit(IxEthDBPortId portID)
-{
- PortInfo *portInfo;
-
- if (portID >= IX_ETH_DB_NUMBER_OF_PORTS)
- {
- return;
- }
-
- portInfo = &ixEthDBPortInfo[portID];
-
- if (ixEthDBSingleEthNpeCheck(portID) != IX_ETH_DB_SUCCESS)
- {
- WARNING_LOG("EthDB: Unavailable Eth %d: Cannot initialize EthDB Port.\n", (UINT32) portID);
-
- return;
- }
-
- if (portInfo->initialized)
- {
- /* redundant */
- return;
- }
-
- /* initialize core fields */
- portInfo->portID = portID;
- SET_DEPENDENCY_MAP(portInfo->dependencyPortMap, portID);
-
- /* default values */
- portInfo->agingEnabled = FALSE;
- portInfo->enabled = FALSE;
- portInfo->macAddressUploaded = FALSE;
- portInfo->maxRxFrameSize = IX_ETHDB_DEFAULT_FRAME_SIZE;
- portInfo->maxTxFrameSize = IX_ETHDB_DEFAULT_FRAME_SIZE;
-
- /* default update control values */
- portInfo->updateMethod.searchTree = NULL;
- portInfo->updateMethod.searchTreePendingWrite = FALSE;
- portInfo->updateMethod.treeInitialized = FALSE;
- portInfo->updateMethod.updateEnabled = FALSE;
- portInfo->updateMethod.userControlled = FALSE;
-
- /* default WiFi parameters */
- memset(portInfo->bbsid, 0, sizeof (portInfo->bbsid));
- portInfo->frameControlDurationID = 0;
-
- /* Ethernet NPE-specific initializations */
- if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
- {
- /* update handler */
- portInfo->updateMethod.updateHandler = ixEthDBNPEUpdateHandler;
- }
-
- /* initialize state save */
- ixEthDBPortState[portID].saved = FALSE;
-
- portInfo->initialized = TRUE;
-}
-
-/**
- * @brief enables a port
- *
- * @param portID ID of the port to enable
- *
- * This function is fully documented in the main
- * header file, IxEthDB.h
- *
- * @return IX_ETH_DB_SUCCESS if enabling was
- * accomplished, or a meaningful error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortEnable(IxEthDBPortId portID)
-{
- IxEthDBPortMap triggerPorts;
- PortInfo *portInfo;
-
- IX_ETH_DB_CHECK_PORT_EXISTS(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- portInfo = &ixEthDBPortInfo[portID];
-
- if (portInfo->enabled)
- {
- /* redundant */
- return IX_ETH_DB_SUCCESS;
- }
-
- SET_DEPENDENCY_MAP(triggerPorts, portID);
-
- /* mark as enabled */
- portInfo->enabled = TRUE;
-
- /* Operation stops here when Ethernet Learning is not enabled */
- if(IX_FEATURE_CTRL_SWCONFIG_DISABLED ==
- ixFeatureCtrlSwConfigurationCheck(IX_FEATURECTRL_ETH_LEARNING))
- {
- return IX_ETH_DB_SUCCESS;
- }
-
- if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE && !portInfo->macAddressUploaded)
- {
- IX_ETH_DB_SUPPORT_TRACE("DB: (Support) MAC address not set on port %d, enable failed\n", portID);
-
- /* must use UnicastAddressSet() before enabling an NPE port */
- return IX_ETH_DB_MAC_UNINITIALIZED;
- }
-
- if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
- {
- IX_ETH_DB_SUPPORT_TRACE("DB: (Support) Attempting to enable the NPE callback for port %d...\n", portID);
-
- if (!portInfo->updateMethod.userControlled
- && ((portInfo->featureCapability & IX_ETH_DB_FILTERING) != 0))
- {
- portInfo->updateMethod.updateEnabled = TRUE;
- }
-
- /* if this is first time initialization then we already have
- write access to the tree and can AccessRelease directly */
- if (!portInfo->updateMethod.treeInitialized)
- {
- IX_ETH_DB_SUPPORT_TRACE("DB: (Support) Initializing tree for port %d\n", portID);
-
- /* create an initial tree and release access into it */
- ixEthDBUpdatePortLearningTrees(triggerPorts);
-
- /* mark tree as being initialized */
- portInfo->updateMethod.treeInitialized = TRUE;
- }
- }
-
- if (ixEthDBPortState[portID].saved)
- {
- /* previous configuration data stored, restore state */
- if ((portInfo->featureCapability & IX_ETH_DB_FIREWALL) != 0)
- {
- ixEthDBFirewallModeSet(portID, ixEthDBPortState[portID].firewallMode);
- ixEthDBFirewallInvalidAddressFilterEnable(portID, ixEthDBPortState[portID].srcAddressFilterEnabled);
- }
-
-
- if ((portInfo->featureCapability & IX_ETH_DB_SPANNING_TREE_PROTOCOL) != 0)
- {
- ixEthDBSpanningTreeBlockingStateSet(portID, ixEthDBPortState[portID].stpBlocked);
- }
-
- ixEthDBFilteringPortMaximumRxFrameSizeSet(portID, ixEthDBPortState[portID].maxRxFrameSize);
- ixEthDBFilteringPortMaximumTxFrameSizeSet(portID, ixEthDBPortState[portID].maxTxFrameSize);
-
- /* discard previous save */
- ixEthDBPortState[portID].saved = FALSE;
- }
-
- IX_ETH_DB_SUPPORT_TRACE("DB: (Support) Enabling succeeded for port %d\n", portID);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief disables a port
- *
- * @param portID ID of the port to disable
- *
- * This function is fully documented in the
- * main header file, IxEthDB.h
- *
- * @return IX_ETH_DB_SUCCESS if disabling was
- * successful or an appropriate error message
- * otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortDisable(IxEthDBPortId portID)
-{
- HashIterator iterator;
- IxEthDBPortMap triggerPorts; /* ports who will have deleted records and therefore will need updating */
- BOOL result;
- PortInfo *portInfo;
- IxEthDBFeature learningEnabled;
-
- IX_ETH_DB_CHECK_PORT_EXISTS(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- portInfo = &ixEthDBPortInfo[portID];
-
- if (!portInfo->enabled)
- {
- /* redundant */
- return IX_ETH_DB_SUCCESS;
- }
-
- if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
- {
- /* save filtering state */
- ixEthDBPortState[portID].firewallMode = portInfo->firewallMode;
- ixEthDBPortState[portID].frameFilter = portInfo->frameFilter;
- ixEthDBPortState[portID].taggingAction = portInfo->taggingAction;
- ixEthDBPortState[portID].stpBlocked = portInfo->stpBlocked;
- ixEthDBPortState[portID].srcAddressFilterEnabled = portInfo->srcAddressFilterEnabled;
- ixEthDBPortState[portID].maxRxFrameSize = portInfo->maxRxFrameSize;
- ixEthDBPortState[portID].maxTxFrameSize = portInfo->maxTxFrameSize;
-
- memcpy(ixEthDBPortState[portID].vlanMembership, portInfo->vlanMembership, sizeof (IxEthDBVlanSet));
- memcpy(ixEthDBPortState[portID].transmitTaggingInfo, portInfo->transmitTaggingInfo, sizeof (IxEthDBVlanSet));
- memcpy(ixEthDBPortState[portID].priorityTable, portInfo->priorityTable, sizeof (IxEthDBPriorityTable));
-
- ixEthDBPortState[portID].saved = TRUE;
-
- /* now turn off all EthDB filtering features on the port */
-
-
- /* STP */
- if ((portInfo->featureCapability & IX_ETH_DB_SPANNING_TREE_PROTOCOL) != 0)
- {
- ixEthDBSpanningTreeBlockingStateSet((IxEthDBPortId) portID, FALSE);
- }
-
- /* Firewall */
- if ((portInfo->featureCapability & IX_ETH_DB_FIREWALL) != 0)
- {
- ixEthDBFirewallModeSet((IxEthDBPortId) portID, IX_ETH_DB_FIREWALL_BLACK_LIST);
- ixEthDBFirewallTableDownload((IxEthDBPortId) portID);
- ixEthDBFirewallInvalidAddressFilterEnable((IxEthDBPortId) portID, FALSE);
- }
-
- /* Frame size filter */
- ixEthDBFilteringPortMaximumFrameSizeSet((IxEthDBPortId) portID, IX_ETH_DB_DEFAULT_FRAME_SIZE);
-
- /* WiFi */
- if ((portInfo->featureCapability & IX_ETH_DB_WIFI_HEADER_CONVERSION) != 0)
- {
- ixEthDBWiFiConversionTableDownload((IxEthDBPortId) portID);
- }
-
- /* save and disable the learning feature bit */
- learningEnabled = portInfo->featureStatus & IX_ETH_DB_LEARNING;
- portInfo->featureStatus &= ~IX_ETH_DB_LEARNING;
- }
- else
- {
- /* save the learning feature bit */
- learningEnabled = portInfo->featureStatus & IX_ETH_DB_LEARNING;
- }
-
- SET_EMPTY_DEPENDENCY_MAP(triggerPorts);
-
- ixEthDBUpdateLock();
-
- /* wipe out current entries for this port */
- BUSY_RETRY(ixEthDBInitHashIterator(&dbHashtable, &iterator));
-
- while (IS_ITERATOR_VALID(&iterator))
- {
- MacDescriptor *descriptor = (MacDescriptor *) iterator.node->data;
-
- /* check if the port match. If so, remove the entry */
- if (descriptor->portID == portID
- && (descriptor->type == IX_ETH_DB_FILTERING_RECORD || descriptor->type == IX_ETH_DB_FILTERING_VLAN_RECORD)
- && !descriptor->recordData.filteringData.staticEntry)
- {
- /* delete entry */
- BUSY_RETRY(ixEthDBRemoveEntryAtHashIterator(&dbHashtable, &iterator));
-
- /* add port to the set of update trigger ports */
- JOIN_PORT_TO_MAP(triggerPorts, portID);
- }
- else
- {
- /* move to the next record */
- BUSY_RETRY(ixEthDBIncrementHashIterator(&dbHashtable, &iterator));
- }
- }
-
- if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
- {
- if (portInfo->updateMethod.searchTree != NULL)
- {
- ixEthDBFreeMacTreeNode(portInfo->updateMethod.searchTree);
- portInfo->updateMethod.searchTree = NULL;
- }
-
- ixEthDBNPEUpdateHandler(portID, IX_ETH_DB_FILTERING_RECORD);
- }
-
- /* mark as disabled */
- portInfo->enabled = FALSE;
-
- /* disable updates unless the user has specifically altered the default behavior */
- if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
- {
- if (!portInfo->updateMethod.userControlled)
- {
- portInfo->updateMethod.updateEnabled = FALSE;
- }
-
- /* make sure we re-initialize the NPE learning tree when the port is re-enabled */
- portInfo->updateMethod.treeInitialized = FALSE;
- }
-
- ixEthDBUpdateUnlock();
-
- /* restore learning feature bit */
- portInfo->featureStatus |= learningEnabled;
-
- /* if we've removed any records or lost any events make sure to force an update */
- IS_EMPTY_DEPENDENCY_MAP(result, triggerPorts);
-
- if (!result)
- {
- ixEthDBUpdatePortLearningTrees(triggerPorts);
- }
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief sends the updated maximum Tx/Rx frame lengths to the NPE
- *
- * @param portID ID of the port to update
- *
- * @return IX_ETH_DB_SUCCESS if the update completed
- * successfully or an appropriate error message otherwise
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-IxEthDBStatus ixEthDBPortFrameLengthsUpdate(IxEthDBPortId portID)
-{
- IxNpeMhMessage message;
- PortInfo *portInfo = &ixEthDBPortInfo[portID];
- IX_STATUS result;
-
- FILL_SETMAXFRAMELENGTHS_MSG(message, portID, portInfo->maxRxFrameSize, portInfo->maxTxFrameSize);
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- return result;
-}
-
-/**
- * @brief sets the port maximum Rx frame size
- *
- * @param portID ID of the port to set the frame size on
- * @param maximumRxFrameSize maximum Rx frame size
- *
- * This function updates the internal data structures and
- * calls ixEthDBPortFrameLengthsUpdate() for NPE update.
- *
- * This function is fully documented in the main header
- * file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation was
- * successfull or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringPortMaximumRxFrameSizeSet(IxEthDBPortId portID, UINT32 maximumRxFrameSize)
-{
- IX_ETH_DB_CHECK_PORT_EXISTS(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- if (!ixEthDBPortInfo[portID].initialized)
- {
- return IX_ETH_DB_PORT_UNINITIALIZED;
- }
-
- if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
- {
- if ((maximumRxFrameSize < IX_ETHDB_MIN_NPE_FRAME_SIZE) ||
- (maximumRxFrameSize > IX_ETHDB_MAX_NPE_FRAME_SIZE))
- {
- return IX_ETH_DB_INVALID_ARG;
- }
- }
- else
- {
- return IX_ETH_DB_NO_PERMISSION;
- }
-
- /* update internal structure */
- ixEthDBPortInfo[portID].maxRxFrameSize = maximumRxFrameSize;
-
- /* update the maximum frame size in the NPE */
- return ixEthDBPortFrameLengthsUpdate(portID);
-}
-
-/**
- * @brief sets the port maximum Tx frame size
- *
- * @param portID ID of the port to set the frame size on
- * @param maximumTxFrameSize maximum Tx frame size
- *
- * This function updates the internal data structures and
- * calls ixEthDBPortFrameLengthsUpdate() for NPE update.
- *
- * This function is fully documented in the main header
- * file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation was
- * successfull or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringPortMaximumTxFrameSizeSet(IxEthDBPortId portID, UINT32 maximumTxFrameSize)
-{
- IX_ETH_DB_CHECK_PORT_EXISTS(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- if (!ixEthDBPortInfo[portID].initialized)
- {
- return IX_ETH_DB_PORT_UNINITIALIZED;
- }
-
- if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
- {
- if ((maximumTxFrameSize < IX_ETHDB_MIN_NPE_FRAME_SIZE) ||
- (maximumTxFrameSize > IX_ETHDB_MAX_NPE_FRAME_SIZE))
- {
- return IX_ETH_DB_INVALID_ARG;
- }
- }
- else
- {
- return IX_ETH_DB_NO_PERMISSION;
- }
-
- /* update internal structure */
- ixEthDBPortInfo[portID].maxTxFrameSize = maximumTxFrameSize;
-
- /* update the maximum frame size in the NPE */
- return ixEthDBPortFrameLengthsUpdate(portID);
-}
-
-/**
- * @brief sets the port maximum Tx and Rx frame sizes
- *
- * @param portID ID of the port to set the frame size on
- * @param maximumFrameSize maximum Tx and Rx frame sizes
- *
- * This function updates the internal data structures and
- * calls ixEthDBPortFrameLengthsUpdate() for NPE update.
- *
- * Note that both the maximum Tx and Rx frame size are set
- * to the same value. This function is kept for compatibility
- * reasons.
- *
- * This function is fully documented in the main header
- * file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation was
- * successfull or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringPortMaximumFrameSizeSet(IxEthDBPortId portID, UINT32 maximumFrameSize)
-{
- IX_ETH_DB_CHECK_PORT_EXISTS(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- if (!ixEthDBPortInfo[portID].initialized)
- {
- return IX_ETH_DB_PORT_UNINITIALIZED;
- }
-
- if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
- {
- if ((maximumFrameSize < IX_ETHDB_MIN_NPE_FRAME_SIZE) ||
- (maximumFrameSize > IX_ETHDB_MAX_NPE_FRAME_SIZE))
- {
- return IX_ETH_DB_INVALID_ARG;
- }
- }
- else
- {
- return IX_ETH_DB_NO_PERMISSION;
- }
-
- /* update internal structure */
- ixEthDBPortInfo[portID].maxRxFrameSize = maximumFrameSize;
- ixEthDBPortInfo[portID].maxTxFrameSize = maximumFrameSize;
-
- /* update the maximum frame size in the NPE */
- return ixEthDBPortFrameLengthsUpdate(portID);
-}
-
-/**
- * @brief sets the MAC address of an NPE port
- *
- * @param portID port ID to set the MAC address on
- * @param macAddr pointer to the 6-byte MAC address
- *
- * This function is called by the EthAcc
- * ixEthAccUnicastMacAddressSet() and should not be
- * manually invoked unless required by special circumstances.
- *
- * @return IX_ETH_DB_SUCCESS if the operation succeeded
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortAddressSet(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
-{
- IxNpeMhMessage message;
- IxOsalMutex *ackPortAddressLock;
- IX_STATUS result;
-
- /* use this macro instead CHECK_PORT
- as the port doesn't need to be enabled */
- IX_ETH_DB_CHECK_PORT_EXISTS(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- if (!ixEthDBPortInfo[portID].initialized)
- {
- return IX_ETH_DB_PORT_UNINITIALIZED;
- }
-
- ackPortAddressLock = &ixEthDBPortInfo[portID].npeAckLock;
-
- /* Operation stops here when Ethernet Learning is not enabled */
- if(IX_FEATURE_CTRL_SWCONFIG_DISABLED ==
- ixFeatureCtrlSwConfigurationCheck(IX_FEATURECTRL_ETH_LEARNING))
- {
- return IX_ETH_DB_SUCCESS;
- }
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- /* exit if the port is not an Ethernet NPE */
- if (ixEthDBPortDefinitions[portID].type != IX_ETH_NPE)
- {
- return IX_ETH_DB_INVALID_PORT;
- }
-
- /* populate message */
- FILL_SETPORTADDRESS_MSG(message, portID, macAddr->macAddress);
-
- IX_ETH_DB_SUPPORT_TRACE("DB: (Support) Sending SetPortAddress on port %d...\n", portID);
-
- /* send a SetPortAddress message */
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- if (result == IX_SUCCESS)
- {
- ixEthDBPortInfo[portID].macAddressUploaded = TRUE;
- }
-
- return result;
-}
diff --git a/cpu/ixp/npe/IxEthDBCore.c b/cpu/ixp/npe/IxEthDBCore.c
deleted file mode 100644
index 25b7cbb8b8..0000000000
--- a/cpu/ixp/npe/IxEthDBCore.c
+++ /dev/null
@@ -1,463 +0,0 @@
-/**
- * @file IxEthDBDBCore.c
- *
- * @brief Database support functions
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxEthDB_p.h"
-
-/* list of database hashtables */
-IX_ETH_DB_PUBLIC HashTable dbHashtable;
-IX_ETH_DB_PUBLIC MatchFunction matchFunctions[IX_ETH_DB_MAX_KEY_INDEX + 1];
-IX_ETH_DB_PUBLIC BOOL ixEthDBPortUpdateRequired[IX_ETH_DB_MAX_RECORD_TYPE_INDEX + 1];
-IX_ETH_DB_PUBLIC UINT32 ixEthDBKeyType[IX_ETH_DB_MAX_RECORD_TYPE_INDEX + 1];
-
-/* private initialization flag */
-IX_ETH_DB_PRIVATE BOOL ethDBInitializationComplete = FALSE;
-
-/**
- * @brief initializes EthDB
- *
- * This function must be called to initialize the component.
- *
- * It does the following things:
- * - checks the port definition structure
- * - scans the capabilities of the NPE images and sets the
- * capabilities of the ports accordingly
- * - initializes the memory pools internally used in EthDB
- * for storing database records and handling data
- * - registers automatic update handlers for add and remove
- * operations
- * - registers hashing match functions, depending on key sets
- * - initializes the main database hashtable
- * - allocates contiguous memory zones to be used for NPE
- * updates
- * - registers the serialize methods used to convert data
- * into NPE-readable format
- * - starts the event processor
- *
- * Note that this function is documented in the public
- * component header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS or an appropriate error if the
- * component failed to initialize correctly
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBInit(void)
-{
- IxEthDBStatus result;
-
- if (ethDBInitializationComplete)
- {
- /* redundant */
- return IX_ETH_DB_SUCCESS;
- }
-
- /* trap an invalid port definition structure */
- IX_ETH_DB_PORTS_ASSERTION;
-
- /* memory management */
- ixEthDBInitMemoryPools();
-
- /* register hashing search methods */
- ixEthDBMatchMethodsRegister(matchFunctions);
-
- /* register type-based automatic port updates */
- ixEthDBUpdateTypeRegister(ixEthDBPortUpdateRequired);
-
- /* register record to key type mappings */
- ixEthDBKeyTypeRegister(ixEthDBKeyType);
-
- /* hash table */
- ixEthDBInitHash(&dbHashtable, NUM_BUCKETS, ixEthDBEntryXORHash, matchFunctions, (FreeFunction) ixEthDBFreeMacDescriptor);
-
- /* NPE update zones */
- ixEthDBNPEUpdateAreasInit();
-
- /* register record serialization methods */
- ixEthDBRecordSerializeMethodsRegister();
-
- /* start the event processor */
- result = ixEthDBEventProcessorInit();
-
- /* scan NPE features */
- if (result == IX_ETH_DB_SUCCESS)
- {
- ixEthDBFeatureCapabilityScan();
- }
-
- ethDBInitializationComplete = TRUE;
-
- return result;
-}
-
-/**
- * @brief prepares EthDB for unloading
- *
- * This function must be called before removing the
- * EthDB component from memory (e.g. doing rmmod in
- * Linux) if the component is to be re-initialized again
- * without rebooting the platform.
- *
- * All the EthDB ports must be disabled before this
- * function is to be called. Failure to disable all
- * the ports will return the IX_ETH_DB_BUSY error.
- *
- * This function will destroy mutexes, deallocate
- * memory and stop the event processor.
- *
- * Note that this function is fully documented in the
- * main component header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if de-initialization
- * completed successfully or an appropriate error
- * message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBUnload(void)
-{
- IxEthDBPortId portIndex;
-
- if (!ethDBInitializationComplete)
- {
- /* redundant */
- return IX_ETH_DB_SUCCESS;
- }
-
- /* check if any ports are enabled */
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- if (ixEthDBPortInfo[portIndex].enabled)
- {
- return IX_ETH_DB_BUSY;
- }
- }
-
- /* free port resources */
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- if (ixEthDBPortDefinitions[portIndex].type == IX_ETH_NPE)
- {
- ixOsalMutexDestroy(&ixEthDBPortInfo[portIndex].npeAckLock);
- }
-
- ixEthDBPortInfo[portIndex].initialized = FALSE;
- }
-
- /* shutdown event processor */
- ixEthDBStopLearningFunction();
-
- /* deallocate NPE update zones */
- ixEthDBNPEUpdateAreasUnload();
-
- ethDBInitializationComplete = FALSE;
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief adds a new entry to the Ethernet database
- *
- * @param newRecordTemplate address of the record template to use
- * @param updateTrigger port map containing the update triggers
- * resulting from this update operation
- *
- * Creates a new database entry, populates it with the data
- * copied from the given template and adds the record to the
- * database hash table.
- * It also checks whether the new record type is registered to trigger
- * automatic updates; if it is, the update trigger will contain the
- * port on which the record insertion was performed, as well as the
- * old port in case the addition was a record migration (from one port
- * to the other). The caller can use the updateTrigger to trigger
- * automatic updates on the ports changed as a result of this addition.
- *
- * @retval IX_ETH_DB_SUCCESS addition successful
- * @retval IX_ETH_DB_NOMEM insertion failed, no memory left in the mac descriptor memory pool
- * @retval IX_ETH_DB_BUSY database busy, cannot insert due to locking
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBAdd(MacDescriptor *newRecordTemplate, IxEthDBPortMap updateTrigger)
-{
- IxEthDBStatus result;
- MacDescriptor *newDescriptor;
- IxEthDBPortId originalPortID;
- HashNode *node = NULL;
-
- BUSY_RETRY(ixEthDBSearchHashEntry(&dbHashtable, ixEthDBKeyType[newRecordTemplate->type], newRecordTemplate, &node));
-
- TEST_FIXTURE_INCREMENT_DB_CORE_ACCESS_COUNTER;
-
- if (node == NULL)
- {
- /* not found, create a new one */
- newDescriptor = ixEthDBAllocMacDescriptor();
-
- if (newDescriptor == NULL)
- {
- return IX_ETH_DB_NOMEM; /* no memory */
- }
-
- /* old port does not exist, avoid unnecessary updates */
- originalPortID = newRecordTemplate->portID;
- }
- else
- {
- /* a node with the same key exists, will update node */
- newDescriptor = (MacDescriptor *) node->data;
-
- /* save original port id */
- originalPortID = newDescriptor->portID;
- }
-
- /* copy/update fields into new record */
- memcpy(newDescriptor->macAddress, newRecordTemplate->macAddress, sizeof (IxEthDBMacAddr));
- memcpy(&newDescriptor->recordData, &newRecordTemplate->recordData, sizeof (IxEthDBRecordData));
-
- newDescriptor->type = newRecordTemplate->type;
- newDescriptor->portID = newRecordTemplate->portID;
- newDescriptor->user = newRecordTemplate->user;
-
- if (node == NULL)
- {
- /* new record, insert into hashtable */
- BUSY_RETRY_WITH_RESULT(ixEthDBAddHashEntry(&dbHashtable, newDescriptor), result);
-
- if (result != IX_ETH_DB_SUCCESS)
- {
- ixEthDBFreeMacDescriptor(newDescriptor);
-
- return result; /* insertion failed */
- }
- }
-
- if (node != NULL)
- {
- /* release access */
- ixEthDBReleaseHashNode(node);
- }
-
- /* trigger add/remove update if required by type */
- if (updateTrigger != NULL &&
- ixEthDBPortUpdateRequired[newRecordTemplate->type])
- {
- /* add new port to update list */
- JOIN_PORT_TO_MAP(updateTrigger, newRecordTemplate->portID);
-
- /* check if record has moved, we'll need to update the old port as well */
- if (originalPortID != newDescriptor->portID)
- {
- JOIN_PORT_TO_MAP(updateTrigger, originalPortID);
- }
- }
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief remove a record from the Ethernet database
- *
- * @param templateRecord template record used to determine
- * what record is to be removed
- * @param updateTrigger port map containing the update triggers
- * resulting from this update operation
- *
- * This function will examine the template record it receives
- * and attempts to delete a record of the same type and containing
- * the same keys as the template record. If deletion is successful
- * and the record type is registered for automatic port updates the
- * port will also be set in the updateTrigger port map, so that the
- * client can perform an update of the port.
- *
- * @retval IX_ETH_DB_SUCCESS removal was successful
- * @retval IX_ETH_DB_NO_SUCH_ADDR the record with the given MAC address was not found
- * @retval IX_ETH_DB_BUSY database busy, cannot remove due to locking
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBRemove(MacDescriptor *templateRecord, IxEthDBPortMap updateTrigger)
-{
- IxEthDBStatus result;
-
- TEST_FIXTURE_INCREMENT_DB_CORE_ACCESS_COUNTER;
-
- BUSY_RETRY_WITH_RESULT(ixEthDBRemoveHashEntry(&dbHashtable, ixEthDBKeyType[templateRecord->type], templateRecord), result);
-
- if (result != IX_ETH_DB_SUCCESS)
- {
- return IX_ETH_DB_NO_SUCH_ADDR; /* not found */
- }
-
- /* trigger add/remove update if required by type */
- if (updateTrigger != NULL
- &&ixEthDBPortUpdateRequired[templateRecord->type])
- {
- /* add new port to update list */
- JOIN_PORT_TO_MAP(updateTrigger, templateRecord->portID);
- }
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief register record key types
- *
- * This function registers the appropriate key types,
- * depending on record types.
- *
- * All filtering records use the MAC address as the key.
- * WiFi and Firewall records use a compound key consisting
- * in both the MAC address and the port ID.
- *
- * @return the number of registered record types
- */
-IX_ETH_DB_PUBLIC
-UINT32 ixEthDBKeyTypeRegister(UINT32 *keyType)
-{
- /* safety */
- memset(keyType, 0, sizeof (keyType));
-
- /* register all known record types */
- keyType[IX_ETH_DB_FILTERING_RECORD] = IX_ETH_DB_MAC_KEY;
- keyType[IX_ETH_DB_FILTERING_VLAN_RECORD] = IX_ETH_DB_MAC_KEY;
- keyType[IX_ETH_DB_ALL_FILTERING_RECORDS] = IX_ETH_DB_MAC_KEY;
- keyType[IX_ETH_DB_WIFI_RECORD] = IX_ETH_DB_MAC_PORT_KEY;
- keyType[IX_ETH_DB_FIREWALL_RECORD] = IX_ETH_DB_MAC_PORT_KEY;
-
- return 5;
-}
-
-/**
- * @brief Sets a user-defined field into a database record
- *
- * Note that this function is fully documented in the main component
- * header file.
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBUserFieldSet(IxEthDBRecordType recordType, IxEthDBMacAddr *macAddr, IxEthDBPortId portID, IxEthDBVlanId vlanID, void *field)
-{
- HashNode *result = NULL;
-
- if (macAddr == NULL)
- {
- return IX_ETH_DB_INVALID_ARG;
- }
-
- if (recordType == IX_ETH_DB_FILTERING_RECORD)
- {
- result = ixEthDBSearch(macAddr, recordType);
- }
- else if (recordType == IX_ETH_DB_FILTERING_VLAN_RECORD)
- {
- result = ixEthDBVlanSearch(macAddr, vlanID, recordType);
- }
- else if (recordType == IX_ETH_DB_WIFI_RECORD || recordType == IX_ETH_DB_FIREWALL_RECORD)
- {
- IX_ETH_DB_CHECK_PORT_EXISTS(portID);
-
- result = ixEthDBPortSearch(macAddr, portID, recordType);
- }
- else
- {
- return IX_ETH_DB_INVALID_ARG;
- }
-
- if (result == NULL)
- {
- return IX_ETH_DB_NO_SUCH_ADDR;
- }
-
- ((MacDescriptor *) result->data)->user = field;
-
- ixEthDBReleaseHashNode(result);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief Retrieves a user-defined field from a database record
- *
- * Note that this function is fully documented in the main component
- * header file.
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBUserFieldGet(IxEthDBRecordType recordType, IxEthDBMacAddr *macAddr, IxEthDBPortId portID, IxEthDBVlanId vlanID, void **field)
-{
- HashNode *result = NULL;
-
- if (macAddr == NULL || field == NULL)
- {
- return IX_ETH_DB_INVALID_ARG;
- }
-
- if (recordType == IX_ETH_DB_FILTERING_RECORD)
- {
- result = ixEthDBSearch(macAddr, recordType);
- }
- else if (recordType == IX_ETH_DB_FILTERING_VLAN_RECORD)
- {
- result = ixEthDBVlanSearch(macAddr, vlanID, recordType);
- }
- else if (recordType == IX_ETH_DB_WIFI_RECORD || recordType == IX_ETH_DB_FIREWALL_RECORD)
- {
- IX_ETH_DB_CHECK_PORT_EXISTS(portID);
-
- result = ixEthDBPortSearch(macAddr, portID, recordType);
- }
- else
- {
- return IX_ETH_DB_INVALID_ARG;
- }
-
- if (result == NULL)
- {
- return IX_ETH_DB_NO_SUCH_ADDR;
- }
-
- *field = ((MacDescriptor *) result->data)->user;
-
- ixEthDBReleaseHashNode(result);
-
- return IX_ETH_DB_SUCCESS;
-}
diff --git a/cpu/ixp/npe/IxEthDBEvents.c b/cpu/ixp/npe/IxEthDBEvents.c
deleted file mode 100644
index 4d44e03337..0000000000
--- a/cpu/ixp/npe/IxEthDBEvents.c
+++ /dev/null
@@ -1,520 +0,0 @@
-/**
- * @file IxEthDBEvents.c
- *
- * @brief Implementation of the event processor component
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include <IxNpeMh.h>
-#include <IxFeatureCtrl.h>
-
-#include "IxEthDB_p.h"
-
-/* forward prototype declarations */
-IX_ETH_DB_PUBLIC void ixEthDBEventProcessorLoop(void *);
-IX_ETH_DB_PUBLIC void ixEthDBNPEEventCallback(IxNpeMhNpeId npeID, IxNpeMhMessage msg);
-IX_ETH_DB_PRIVATE void ixEthDBProcessEvent(PortEvent *local_event, IxEthDBPortMap triggerPorts);
-IX_ETH_DB_PRIVATE IxEthDBStatus ixEthDBTriggerPortUpdate(UINT32 eventType, IxEthDBMacAddr *macAddr, IxEthDBPortId portID, BOOL staticEntry);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBStartLearningFunction(void);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBStopLearningFunction(void);
-
-/* data */
-IX_ETH_DB_PRIVATE IxOsalSemaphore eventQueueSemaphore;
-IX_ETH_DB_PRIVATE PortEventQueue eventQueue;
-IX_ETH_DB_PRIVATE IxOsalMutex eventQueueLock;
-IX_ETH_DB_PRIVATE IxOsalMutex portUpdateLock;
-
-IX_ETH_DB_PRIVATE BOOL ixEthDBLearningShutdown = FALSE;
-IX_ETH_DB_PRIVATE BOOL ixEthDBEventProcessorRunning = FALSE;
-
-/* imported data */
-extern HashTable dbHashtable;
-
-/**
- * @brief initializes the event processor
- *
- * Initializes the event processor queue and processing thread.
- * Called from ixEthDBInit() DB-subcomponent master init function.
- *
- * @warning do not call directly
- *
- * @retval IX_ETH_DB_SUCCESS initialization was successful
- * @retval IX_ETH_DB_FAIL initialization failed (OSAL or mutex init failure)
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBEventProcessorInit(void)
-{
- if (ixOsalMutexInit(&portUpdateLock) != IX_SUCCESS)
- {
- return IX_ETH_DB_FAIL;
- }
-
- if (ixOsalMutexInit(&eventQueueLock) != IX_SUCCESS)
- {
- return IX_ETH_DB_FAIL;
- }
-
- if (IX_FEATURE_CTRL_SWCONFIG_ENABLED ==
- ixFeatureCtrlSwConfigurationCheck (IX_FEATURECTRL_ETH_LEARNING))
- {
-
- /* start processor loop thread */
- if (ixEthDBStartLearningFunction() != IX_ETH_DB_SUCCESS)
- {
- return IX_ETH_DB_FAIL;
- }
- }
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief initializes the event queue and the event processor
- *
- * This function is called by the component initialization
- * function, ixEthDBInit().
- *
- * @warning do not call directly
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or IX_ETH_DB_FAIL otherwise
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBStartLearningFunction(void)
-{
- IxOsalThread eventProcessorThread;
- IxOsalThreadAttr threadAttr;
-
- threadAttr.name = "EthDB event thread";
- threadAttr.stackSize = 32 * 1024; /* 32kbytes */
- threadAttr.priority = 128;
-
- /* reset event queue */
- ixOsalMutexLock(&eventQueueLock, IX_OSAL_WAIT_FOREVER);
-
- RESET_QUEUE(&eventQueue);
-
- ixOsalMutexUnlock(&eventQueueLock);
-
- /* init event queue semaphore */
- if (ixOsalSemaphoreInit(&eventQueueSemaphore, 0) != IX_SUCCESS)
- {
- return IX_ETH_DB_FAIL;
- }
-
- ixEthDBLearningShutdown = FALSE;
-
- /* create processor loop thread */
- if (ixOsalThreadCreate(&eventProcessorThread, &threadAttr, ixEthDBEventProcessorLoop, NULL) != IX_SUCCESS)
- {
- return IX_ETH_DB_FAIL;
- }
-
- /* start event processor */
- ixOsalThreadStart(&eventProcessorThread);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief stops the event processor
- *
- * Stops the event processor and frees the event queue semaphore
- * Called by the component de-initialization function, ixEthDBUnload()
- *
- * @warning do not call directly
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or IX_ETH_DB_FAIL otherwise;
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBStopLearningFunction(void)
-{
- ixEthDBLearningShutdown = TRUE;
-
- /* wake up event processing loop to actually process the shutdown event */
- ixOsalSemaphorePost(&eventQueueSemaphore);
-
- if (ixOsalSemaphoreDestroy(&eventQueueSemaphore) != IX_SUCCESS)
- {
- return IX_ETH_DB_FAIL;
- }
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief default NPE event processing callback
- *
- * @param npeID ID of the NPE that generated the event
- * @param msg NPE message (encapsulated event)
- *
- * Creates an event object on the Ethernet event processor queue
- * and signals the new event by incrementing the event queue semaphore.
- * Events are processed by @ref ixEthDBEventProcessorLoop() which runs
- * at user level.
- *
- * @see ixEthDBEventProcessorLoop()
- *
- * @warning do not call directly
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBNPEEventCallback(IxNpeMhNpeId npeID, IxNpeMhMessage msg)
-{
- PortEvent *local_event;
-
- IX_ETH_DB_IRQ_EVENTS_TRACE("DB: (Events) new event received by processor callback from port %d, id 0x%X\n", IX_ETH_DB_NPE_TO_PORT_ID(npeID), NPE_MSG_ID(msg), 0, 0, 0, 0);
-
- if (CAN_ENQUEUE(&eventQueue))
- {
- TEST_FIXTURE_LOCK_EVENT_QUEUE;
-
- local_event = QUEUE_HEAD(&eventQueue);
-
- /* create event structure on queue */
- local_event->eventType = NPE_MSG_ID(msg);
- local_event->portID = IX_ETH_DB_NPE_TO_PORT_ID(npeID);
-
- /* update queue */
- PUSH_UPDATE_QUEUE(&eventQueue);
-
- TEST_FIXTURE_UNLOCK_EVENT_QUEUE;
-
- IX_ETH_DB_IRQ_EVENTS_TRACE("DB: (Events) Waking up main processor loop...\n", 0, 0, 0, 0, 0, 0);
-
- /* increment event queue semaphore */
- ixOsalSemaphorePost(&eventQueueSemaphore);
- }
- else
- {
- IX_ETH_DB_IRQ_EVENTS_TRACE("DB: (Events) Warning: could not enqueue event (overflow)\n", 0, 0, 0, 0, 0, 0);
- }
-}
-
-/**
- * @brief Ethernet event processor loop
- *
- * Extracts at most EVENT_PROCESSING_LIMIT batches of events and
- * sends them for processing to @ref ixEthDBProcessEvent().
- * Triggers port updates which normally follow learning events.
- *
- * @warning do not call directly, executes in separate thread
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBEventProcessorLoop(void *unused1)
-{
- IxEthDBPortMap triggerPorts;
- IxEthDBPortId portIndex;
-
- ixEthDBEventProcessorRunning = TRUE;
-
- IX_ETH_DB_EVENTS_TRACE("DB: (Events) Event processor loop was started\n");
-
- while (!ixEthDBLearningShutdown)
- {
- BOOL keepProcessing = TRUE;
- UINT32 processedEvents = 0;
-
- IX_ETH_DB_EVENTS_VERBOSE_TRACE("DB: (Events) Waiting for new learning event...\n");
-
- ixOsalSemaphoreWait(&eventQueueSemaphore, IX_OSAL_WAIT_FOREVER);
-
- IX_ETH_DB_EVENTS_VERBOSE_TRACE("DB: (Events) Received new event\n");
-
- if (!ixEthDBLearningShutdown)
- {
- /* port update handling */
- SET_EMPTY_DEPENDENCY_MAP(triggerPorts);
-
- while (keepProcessing)
- {
- PortEvent local_event;
- UINT32 intLockKey;
-
- /* lock queue */
- ixOsalMutexLock(&eventQueueLock, IX_OSAL_WAIT_FOREVER);
-
- /* lock NPE interrupts */
- intLockKey = ixOsalIrqLock();
-
- /* extract event */
- local_event = *(QUEUE_TAIL(&eventQueue));
-
- SHIFT_UPDATE_QUEUE(&eventQueue);
-
- ixOsalIrqUnlock(intLockKey);
-
- ixOsalMutexUnlock(&eventQueueLock);
-
- IX_ETH_DB_EVENTS_TRACE("DB: (Events) Processing event with ID 0x%X\n", local_event.eventType);
-
- ixEthDBProcessEvent(&local_event, triggerPorts);
-
- processedEvents++;
-
- if (processedEvents > EVENT_PROCESSING_LIMIT /* maximum burst reached? */
- || ixOsalSemaphoreTryWait(&eventQueueSemaphore) != IX_SUCCESS) /* or empty queue? */
- {
- keepProcessing = FALSE;
- }
- }
-
- ixEthDBUpdatePortLearningTrees(triggerPorts);
- }
- }
-
- /* turn off automatic updates */
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- ixEthDBPortInfo[portIndex].updateMethod.updateEnabled = FALSE;
- }
-
- ixEthDBEventProcessorRunning = FALSE;
-}
-
-/**
- * @brief event processor routine
- *
- * @param event event to be processed
- * @param triggerPorts port map accumulating ports to be updated
- *
- * Processes learning events by synchronizing the database with
- * newly learnt data. Called only by @ref ixEthDBEventProcessorLoop().
- *
- * @warning do not call directly
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBProcessEvent(PortEvent *local_event, IxEthDBPortMap triggerPorts)
-{
- MacDescriptor recordTemplate;
-
- switch (local_event->eventType)
- {
- case IX_ETH_DB_ADD_FILTERING_RECORD:
- /* add record */
- memset(&recordTemplate, 0, sizeof (recordTemplate));
- memcpy(recordTemplate.macAddress, local_event->macAddr.macAddress, sizeof (IxEthDBMacAddr));
-
- recordTemplate.type = IX_ETH_DB_FILTERING_RECORD;
- recordTemplate.portID = local_event->portID;
- recordTemplate.recordData.filteringData.staticEntry = local_event->staticEntry;
-
- ixEthDBAdd(&recordTemplate, triggerPorts);
-
- IX_ETH_DB_EVENTS_TRACE("DB: (Events) Added record on port %d\n", local_event->portID);
-
- break;
-
- case IX_ETH_DB_REMOVE_FILTERING_RECORD:
- /* remove record */
- memset(&recordTemplate, 0, sizeof (recordTemplate));
- memcpy(recordTemplate.macAddress, local_event->macAddr.macAddress, sizeof (IxEthDBMacAddr));
-
- recordTemplate.type = IX_ETH_DB_FILTERING_RECORD | IX_ETH_DB_FILTERING_VLAN_RECORD;
-
- ixEthDBRemove(&recordTemplate, triggerPorts);
-
- IX_ETH_DB_EVENTS_TRACE("DB: (Events) Removed record on port %d\n", local_event->portID);
-
- break;
-
- default:
- /* can't handle/not interested in this event type */
- ERROR_LOG("DB: (Events) Event processor received an unknown event type (0x%X)\n", local_event->eventType);
-
- return;
- }
-}
-
-/**
- * @brief asynchronously adds a filtering record
- * by posting an ADD_FILTERING_RECORD event to the event queue
- *
- * @param macAddr MAC address of the new record
- * @param portID port ID of the new record
- * @param staticEntry TRUE if record is static, FALSE if dynamic
- *
- * @return IX_ETH_DB_SUCCESS if the event creation was
- * successfull or IX_ETH_DB_BUSY if the event queue is full
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBTriggerAddPortUpdate(IxEthDBMacAddr *macAddr, IxEthDBPortId portID, BOOL staticEntry)
-{
- MacDescriptor reference;
-
- TEST_FIXTURE_INCREMENT_DB_CORE_ACCESS_COUNTER;
-
- /* fill search fields */
- memcpy(reference.macAddress, macAddr, sizeof (IxEthDBMacAddr));
- reference.portID = portID;
-
- /* set acceptable record types */
- reference.type = IX_ETH_DB_ALL_FILTERING_RECORDS;
-
- if (ixEthDBPeekHashEntry(&dbHashtable, IX_ETH_DB_MAC_PORT_KEY, &reference) == IX_ETH_DB_SUCCESS)
- {
- /* already have an identical record */
- return IX_ETH_DB_SUCCESS;
- }
- else
- {
- return ixEthDBTriggerPortUpdate(IX_ETH_DB_ADD_FILTERING_RECORD, macAddr, portID, staticEntry);
- }
-}
-
-/**
- * @brief asynchronously removes a filtering record
- * by posting a REMOVE_FILTERING_RECORD event to the event queue
- *
- * @param macAddr MAC address of the record to remove
- * @param portID port ID of the record to remove
- *
- * @return IX_ETH_DB_SUCCESS if the event creation was
- * successfull or IX_ETH_DB_BUSY if the event queue is full
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBTriggerRemovePortUpdate(IxEthDBMacAddr *macAddr, IxEthDBPortId portID)
-{
- if (ixEthDBPeek(macAddr, IX_ETH_DB_ALL_FILTERING_RECORDS) != IX_ETH_DB_NO_SUCH_ADDR)
- {
- return ixEthDBTriggerPortUpdate(IX_ETH_DB_REMOVE_FILTERING_RECORD, macAddr, portID, FALSE);
- }
- else
- {
- return IX_ETH_DB_NO_SUCH_ADDR;
- }
-}
-
-/**
- * @brief adds an ADD or REMOVE event to the main event queue
- *
- * @param eventType event type - IX_ETH_DB_ADD_FILTERING_RECORD
- * to add and IX_ETH_DB_REMOVE_FILTERING_RECORD to remove a
- * record.
- *
- * @return IX_ETH_DB_SUCCESS if the event was successfully
- * sent or IX_ETH_DB_BUSY if the event queue is full
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-IxEthDBStatus ixEthDBTriggerPortUpdate(UINT32 eventType, IxEthDBMacAddr *macAddr, IxEthDBPortId portID, BOOL staticEntry)
-{
- UINT32 intLockKey;
-
- /* lock interrupts to protect queue */
- intLockKey = ixOsalIrqLock();
-
- if (CAN_ENQUEUE(&eventQueue))
- {
- PortEvent *queueEvent = QUEUE_HEAD(&eventQueue);
-
- /* update fields on the queue */
- memcpy(queueEvent->macAddr.macAddress, macAddr->macAddress, sizeof (IxEthDBMacAddr));
-
- queueEvent->eventType = eventType;
- queueEvent->portID = portID;
- queueEvent->staticEntry = staticEntry;
-
- PUSH_UPDATE_QUEUE(&eventQueue);
-
- /* imcrement event queue semaphore */
- ixOsalSemaphorePost(&eventQueueSemaphore);
-
- /* unlock interrupts */
- ixOsalIrqUnlock(intLockKey);
-
- return IX_ETH_DB_SUCCESS;
- }
- else /* event queue full */
- {
- /* unlock interrupts */
- ixOsalIrqUnlock(intLockKey);
-
- return IX_ETH_DB_BUSY;
- }
-}
-
-/**
- * @brief Locks learning tree updates and port disable
- *
- *
- * This function locks portUpdateLock single mutex. It is primarily used
- * to avoid executing 'port disable' during ELT maintenance.
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBUpdateLock(void)
-{
- ixOsalMutexLock(&portUpdateLock, IX_OSAL_WAIT_FOREVER);
-}
-
-/**
- * @brief Unlocks learning tree updates and port disable
- *
- *
- * This function unlocks a portUpdateLock mutex. It is primarily used
- * to avoid executing 'port disable' during ELT maintenance.
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBUpdateUnlock(void)
-{
- ixOsalMutexUnlock(&portUpdateLock);
-}
-
diff --git a/cpu/ixp/npe/IxEthDBFeatures.c b/cpu/ixp/npe/IxEthDBFeatures.c
deleted file mode 100644
index 7a58d268ca..0000000000
--- a/cpu/ixp/npe/IxEthDBFeatures.c
+++ /dev/null
@@ -1,662 +0,0 @@
-/**
- * @file IxEthDBFeatures.c
- *
- * @brief Implementation of the EthDB feature control API
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxNpeDl.h"
-#include "IxEthDBQoS.h"
-#include "IxEthDB_p.h"
-
-/**
- * @brief scans the capabilities of the loaded NPE images
- *
- * This function MUST be called by the ixEthDBInit() function.
- * No EthDB features (including learning and filtering) are enabled
- * before this function is called.
- *
- * @return none
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBFeatureCapabilityScan(void)
-{
- IxNpeDlImageId imageId, npeAImageId;
- IxEthDBPortId portIndex;
- PortInfo *portInfo;
- IxEthDBPriorityTable defaultPriorityTable;
- IX_STATUS result;
- UINT32 queueIndex;
- UINT32 queueStructureIndex;
- UINT32 trafficClassDefinitionIndex;
-
- /* read version of NPE A - required to set the AQM queues for B and C */
- npeAImageId.functionalityId = 0;
- ixNpeDlLoadedImageGet(IX_NPEDL_NPEID_NPEA, &npeAImageId);
-
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- IxNpeMhMessage msg;
-
- portInfo = &ixEthDBPortInfo[portIndex];
-
- /* check and bypass if NPE B or C is fused out */
- if (ixEthDBSingleEthNpeCheck(portIndex) != IX_ETH_DB_SUCCESS) continue;
-
- /* all ports are capable of LEARNING by default */
- portInfo->featureCapability |= IX_ETH_DB_LEARNING;
- portInfo->featureStatus |= IX_ETH_DB_LEARNING;
-
- if (ixEthDBPortDefinitions[portIndex].type == IX_ETH_NPE)
- {
-
- if (ixNpeDlLoadedImageGet(IX_ETH_DB_PORT_ID_TO_NPE(portIndex), &imageId) != IX_SUCCESS)
- {
- WARNING_LOG("DB: (FeatureScan) NpeDl did not provide the image ID for NPE port %d\n", portIndex);
- }
- else
- {
- /* initialize and empty NPE response mutex */
- ixOsalMutexInit(&portInfo->npeAckLock);
- ixOsalMutexLock(&portInfo->npeAckLock, IX_OSAL_WAIT_FOREVER);
-
- /* check NPE response to GetStatus */
- msg.data[0] = IX_ETHNPE_NPE_GETSTATUS << 24;
- msg.data[1] = 0;
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portIndex), msg, result);
- if (result != IX_SUCCESS)
- {
- WARNING_LOG("DB: (FeatureScan) warning, could not send message to the NPE\n");
- continue;
- }
-
-
- if (imageId.functionalityId == 0x00
- || imageId.functionalityId == 0x03
- || imageId.functionalityId == 0x04
- || imageId.functionalityId == 0x80)
- {
- portInfo->featureCapability |= IX_ETH_DB_FILTERING;
- portInfo->featureCapability |= IX_ETH_DB_FIREWALL;
- portInfo->featureCapability |= IX_ETH_DB_SPANNING_TREE_PROTOCOL;
- }
- else if (imageId.functionalityId == 0x01
- || imageId.functionalityId == 0x81)
- {
- portInfo->featureCapability |= IX_ETH_DB_FILTERING;
- portInfo->featureCapability |= IX_ETH_DB_FIREWALL;
- portInfo->featureCapability |= IX_ETH_DB_SPANNING_TREE_PROTOCOL;
- portInfo->featureCapability |= IX_ETH_DB_VLAN_QOS;
- }
- else if (imageId.functionalityId == 0x02
- || imageId.functionalityId == 0x82)
- {
- portInfo->featureCapability |= IX_ETH_DB_WIFI_HEADER_CONVERSION;
- portInfo->featureCapability |= IX_ETH_DB_FIREWALL;
- portInfo->featureCapability |= IX_ETH_DB_SPANNING_TREE_PROTOCOL;
- portInfo->featureCapability |= IX_ETH_DB_VLAN_QOS;
- }
-
- /* reset AQM queues */
- memset(portInfo->ixEthDBTrafficClassAQMAssignments, 0, sizeof (portInfo->ixEthDBTrafficClassAQMAssignments));
-
- /* ensure there's at least one traffic class record in the definition table, otherwise we have no default case, hence no queues */
- IX_ENSURE(sizeof (ixEthDBTrafficClassDefinitions) != 0, "DB: no traffic class definitions found, check IxEthDBQoS.h");
-
- /* find the traffic class definition index compatible with the current NPE A functionality ID */
- for (trafficClassDefinitionIndex = 0 ;
- trafficClassDefinitionIndex < sizeof (ixEthDBTrafficClassDefinitions) / sizeof (ixEthDBTrafficClassDefinitions[0]);
- trafficClassDefinitionIndex++)
- {
- if (ixEthDBTrafficClassDefinitions[trafficClassDefinitionIndex][IX_ETH_DB_NPE_A_FUNCTIONALITY_ID_INDEX] == npeAImageId.functionalityId)
- {
- /* found it */
- break;
- }
- }
-
- /* select the default case if we went over the array boundary */
- if (trafficClassDefinitionIndex == sizeof (ixEthDBTrafficClassDefinitions) / sizeof (ixEthDBTrafficClassDefinitions[0]))
- {
- trafficClassDefinitionIndex = 0; /* the first record is the default case */
- }
-
- /* select queue assignment structure based on the traffic class configuration index */
- queueStructureIndex = ixEthDBTrafficClassDefinitions[trafficClassDefinitionIndex][IX_ETH_DB_QUEUE_ASSIGNMENT_INDEX];
-
- /* only traffic class 0 is active at initialization time */
- portInfo->ixEthDBTrafficClassCount = 1;
-
- /* enable port, VLAN and Firewall feature bits to initialize QoS/VLAN/Firewall configuration */
- portInfo->featureStatus |= IX_ETH_DB_VLAN_QOS;
- portInfo->featureStatus |= IX_ETH_DB_FIREWALL;
- portInfo->enabled = TRUE;
-
-#define CONFIG_WITH_VLAN /* test-only: VLAN support not included to save space!!! */
-#ifdef CONFIG_WITH_VLAN /* test-only: VLAN support not included to save space!!! */
- /* set VLAN initial configuration (permissive) */
- if ((portInfo->featureCapability & IX_ETH_DB_VLAN_QOS) != 0) /* QoS-enabled image */
- {
- /* QoS capable */
- portInfo->ixEthDBTrafficClassAvailable = ixEthDBTrafficClassDefinitions[trafficClassDefinitionIndex][IX_ETH_DB_TRAFFIC_CLASS_COUNT_INDEX];
-
- /* set AQM queues */
- for (queueIndex = 0 ; queueIndex < IX_IEEE802_1Q_QOS_PRIORITY_COUNT ; queueIndex++)
- {
- portInfo->ixEthDBTrafficClassAQMAssignments[queueIndex] = ixEthDBQueueAssignments[queueStructureIndex][queueIndex];
- }
-
- /* set default PVID (0) and default traffic class 0 */
- ixEthDBPortVlanTagSet(portIndex, 0);
-
- /* enable reception of all frames */
- ixEthDBAcceptableFrameTypeSet(portIndex, IX_ETH_DB_ACCEPT_ALL_FRAMES);
-
- /* clear full VLAN membership */
- ixEthDBPortVlanMembershipRangeRemove(portIndex, 0, IX_ETH_DB_802_1Q_MAX_VLAN_ID);
-
- /* clear TTI table - no VLAN tagged frames will be transmitted */
- ixEthDBEgressVlanRangeTaggingEnabledSet(portIndex, 0, 4094, FALSE);
-
- /* set membership on 0, otherwise no Tx or Rx is working */
- ixEthDBPortVlanMembershipAdd(portIndex, 0);
- }
- else /* QoS not available in this image */
-#endif /* test-only */
- {
- /* initialize traffic class availability (only class 0 is available) */
- portInfo->ixEthDBTrafficClassAvailable = 1;
-
- /* point all AQM queues to traffic class 0 */
- for (queueIndex = 0 ; queueIndex < IX_IEEE802_1Q_QOS_PRIORITY_COUNT ; queueIndex++)
- {
- portInfo->ixEthDBTrafficClassAQMAssignments[queueIndex] =
- ixEthDBQueueAssignments[queueStructureIndex][0];
- }
- }
-
-#ifdef CONFIG_WITH_VLAN /* test-only: VLAN support not included to save space!!! */
- /* download priority mapping table and Rx queue configuration */
- memset (defaultPriorityTable, 0, sizeof (defaultPriorityTable));
- ixEthDBPriorityMappingTableSet(portIndex, defaultPriorityTable);
-#endif
-
- /* by default we turn off invalid source MAC address filtering */
- ixEthDBFirewallInvalidAddressFilterEnable(portIndex, FALSE);
-
- /* disable port, VLAN, Firewall feature bits */
- portInfo->featureStatus &= ~IX_ETH_DB_VLAN_QOS;
- portInfo->featureStatus &= ~IX_ETH_DB_FIREWALL;
- portInfo->enabled = FALSE;
-
- /* enable filtering by default if present */
- if ((portInfo->featureCapability & IX_ETH_DB_FILTERING) != 0)
- {
- portInfo->featureStatus |= IX_ETH_DB_FILTERING;
- }
- }
- }
- }
-}
-
-/**
- * @brief returns the capability of a port
- *
- * @param portID ID of the port
- * @param featureSet location to store the port capability in
- *
- * This function will save the capability set of the given port
- * into the given location. Capabilities are bit-ORed, each representing
- * a bit of the feature set.
- *
- * Note that this function is documented in the main component
- * public header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or IX_ETH_DB_INVALID_PORT if the given port is invalid
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFeatureCapabilityGet(IxEthDBPortId portID, IxEthDBFeature *featureSet)
-{
- IX_ETH_DB_CHECK_PORT_INITIALIZED(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(featureSet);
-
- *featureSet = ixEthDBPortInfo[portID].featureCapability;
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief enables or disables a port capability
- *
- * @param portID ID of the port
- * @param feature feature to enable or disable
- * @param enabled TRUE to enable the selected feature or FALSE to disable it
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFeatureEnable(IxEthDBPortId portID, IxEthDBFeature feature, BOOL enable)
-{
- PortInfo *portInfo;
- IxEthDBPriorityTable defaultPriorityTable;
- IxEthDBVlanSet vlanSet;
- IxEthDBStatus status = IX_ETH_DB_SUCCESS;
- BOOL portEnabled;
-
- IX_ETH_DB_CHECK_PORT_INITIALIZED(portID);
-
- portInfo = &ixEthDBPortInfo[portID];
- portEnabled = portInfo->enabled;
-
- /* check that only one feature is selected */
- if (!ixEthDBCheckSingleBitValue(feature))
- {
- return IX_ETH_DB_FEATURE_UNAVAILABLE;
- }
-
- /* port capable of this feature? */
- if ((portInfo->featureCapability & feature) == 0)
- {
- return IX_ETH_DB_FEATURE_UNAVAILABLE;
- }
-
- /* mutual exclusion between learning and WiFi header conversion */
- if (enable && ((feature | portInfo->featureStatus) & (IX_ETH_DB_FILTERING | IX_ETH_DB_WIFI_HEADER_CONVERSION))
- == (IX_ETH_DB_FILTERING | IX_ETH_DB_WIFI_HEADER_CONVERSION))
- {
- return IX_ETH_DB_NO_PERMISSION;
- }
-
- /* learning must be enabled before filtering */
- if (enable && (feature == IX_ETH_DB_FILTERING) && ((portInfo->featureStatus & IX_ETH_DB_LEARNING) == 0))
- {
- return IX_ETH_DB_NO_PERMISSION;
- }
-
- /* filtering must be disabled before learning */
- if (!enable && (feature == IX_ETH_DB_LEARNING) && ((portInfo->featureStatus & IX_ETH_DB_FILTERING) != 0))
- {
- return IX_ETH_DB_NO_PERMISSION;
- }
-
- /* redundant enabling or disabling */
- if ((!enable && ((portInfo->featureStatus & feature) == 0))
- || (enable && ((portInfo->featureStatus & feature) != 0)))
- {
- /* do nothing */
- return IX_ETH_DB_SUCCESS;
- }
-
- /* force port enabled */
- portInfo->enabled = TRUE;
-
- if (enable)
- {
- /* turn on enable bit */
- portInfo->featureStatus |= feature;
-
-#ifdef CONFIG_WITH_VLAN /* test-only: VLAN support not included to save space!!! */
- /* if this is VLAN/QoS set the default priority table */
- if (feature == IX_ETH_DB_VLAN_QOS)
- {
- /* turn on VLAN/QoS (most permissive mode):
- - set default 802.1Q priority mapping table, in accordance to the
- availability of traffic classes
- - set the acceptable frame filter to accept all
- - set the Ingress tagging mode to pass-through
- - set full VLAN membership list
- - set full TTI table
- - set the default 802.1Q tag to 0 (VLAN ID 0, Pri 0, CFI 0)
- - enable TPID port extraction
- */
-
- portInfo->ixEthDBTrafficClassCount = portInfo->ixEthDBTrafficClassAvailable;
-
- /* set default 802.1Q priority mapping table - note that C indexing starts from 0, so we substract 1 here */
- memcpy (defaultPriorityTable,
- (const void *) ixEthIEEE802_1QUserPriorityToTrafficClassMapping[portInfo->ixEthDBTrafficClassCount - 1],
- sizeof (defaultPriorityTable));
-
- /* update priority mapping and AQM queue assignments */
- status = ixEthDBPriorityMappingTableSet(portID, defaultPriorityTable);
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBAcceptableFrameTypeSet(portID, IX_ETH_DB_ACCEPT_ALL_FRAMES);
- }
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBIngressVlanTaggingEnabledSet(portID, IX_ETH_DB_PASS_THROUGH);
- }
-
- /* set membership and TTI tables */
- memset (vlanSet, 0xFF, sizeof (vlanSet));
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- /* use the internal function to bypass PVID check */
- status = ixEthDBPortVlanTableSet(portID, portInfo->vlanMembership, vlanSet);
- }
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- /* use the internal function to bypass PVID check */
- status = ixEthDBPortVlanTableSet(portID, portInfo->transmitTaggingInfo, vlanSet);
- }
-
- /* reset the PVID */
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBPortVlanTagSet(portID, 0);
- }
-
- /* enable TPID port extraction */
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBVlanPortExtractionEnable(portID, TRUE);
- }
- }
- else if (feature == IX_ETH_DB_FIREWALL)
-#endif
- {
- /* firewall starts in black-list mode unless otherwise configured before *
- * note that invalid source MAC address filtering is disabled by default */
- if (portInfo->firewallMode != IX_ETH_DB_FIREWALL_BLACK_LIST
- && portInfo->firewallMode != IX_ETH_DB_FIREWALL_WHITE_LIST)
- {
- status = ixEthDBFirewallModeSet(portID, IX_ETH_DB_FIREWALL_BLACK_LIST);
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBFirewallInvalidAddressFilterEnable(portID, FALSE);
- }
- }
- }
-
- if (status != IX_ETH_DB_SUCCESS)
- {
- /* checks failed, disable */
- portInfo->featureStatus &= ~feature;
- }
- }
- else
- {
- /* turn off features */
- if (feature == IX_ETH_DB_FIREWALL)
- {
- /* turning off the firewall is equivalent to:
- - set to black-list mode
- - clear all the entries and download the new table
- - turn off the invalid source address checking
- */
-
- status = ixEthDBDatabaseClear(portID, IX_ETH_DB_FIREWALL_RECORD);
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBFirewallModeSet(portID, IX_ETH_DB_FIREWALL_BLACK_LIST);
- }
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBFirewallInvalidAddressFilterEnable(portID, FALSE);
- }
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBFirewallTableDownload(portID);
- }
- }
- else if (feature == IX_ETH_DB_WIFI_HEADER_CONVERSION)
- {
- /* turn off header conversion */
- status = ixEthDBDatabaseClear(portID, IX_ETH_DB_WIFI_RECORD);
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBWiFiConversionTableDownload(portID);
- }
- }
-#ifdef CONFIG_WITH_VLAN /* test-only: VLAN support not included to save space!!! */
- else if (feature == IX_ETH_DB_VLAN_QOS)
- {
- /* turn off VLAN/QoS:
- - set a priority mapping table with one traffic class
- - set the acceptable frame filter to accept all
- - set the Ingress tagging mode to pass-through
- - clear the VLAN membership list
- - clear the TTI table
- - set the default 802.1Q tag to 0 (VLAN ID 0, Pri 0, CFI 0)
- - disable TPID port extraction
- */
-
- /* initialize all => traffic class 0 priority mapping table */
- memset (defaultPriorityTable, 0, sizeof (defaultPriorityTable));
- portInfo->ixEthDBTrafficClassCount = 1;
- status = ixEthDBPriorityMappingTableSet(portID, defaultPriorityTable);
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBAcceptableFrameTypeSet(portID, IX_ETH_DB_ACCEPT_ALL_FRAMES);
- }
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBIngressVlanTaggingEnabledSet(portID, IX_ETH_DB_PASS_THROUGH);
- }
-
- /* clear membership and TTI tables */
- memset (vlanSet, 0, sizeof (vlanSet));
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- /* use the internal function to bypass PVID check */
- status = ixEthDBPortVlanTableSet(portID, portInfo->vlanMembership, vlanSet);
- }
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- /* use the internal function to bypass PVID check */
- status = ixEthDBPortVlanTableSet(portID, portInfo->transmitTaggingInfo, vlanSet);
- }
-
- /* reset the PVID */
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBPortVlanTagSet(portID, 0);
- }
-
- /* disable TPID port extraction */
- if (status == IX_ETH_DB_SUCCESS)
- {
- status = ixEthDBVlanPortExtractionEnable(portID, FALSE);
- }
- }
-#endif
-
- if (status == IX_ETH_DB_SUCCESS)
- {
- /* checks passed, disable */
- portInfo->featureStatus &= ~feature;
- }
- }
-
- /* restore port enabled state */
- portInfo->enabled = portEnabled;
-
- return status;
-}
-
-/**
- * @brief returns the status of a feature
- *
- * @param portID port ID
- * @param present location to store a boolean value indicating
- * if the feature is present (TRUE) or not (FALSE)
- * @param enabled location to store a booleam value indicating
- * if the feature is present (TRUE) or not (FALSE)
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFeatureStatusGet(IxEthDBPortId portID, IxEthDBFeature feature, BOOL *present, BOOL *enabled)
-{
- PortInfo *portInfo;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(present);
-
- IX_ETH_DB_CHECK_REFERENCE(enabled);
-
- portInfo = &ixEthDBPortInfo[portID];
-
- *present = (portInfo->featureCapability & feature) != 0;
- *enabled = (portInfo->featureStatus & feature) != 0;
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief returns the value of an EthDB property
- *
- * @param portID ID of the port
- * @param feature feature owning the property
- * @param property ID of the property
- * @param type location to store the property type into
- * @param value location to store the property value into
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFeaturePropertyGet(IxEthDBPortId portID, IxEthDBFeature feature, IxEthDBProperty property, IxEthDBPropertyType *type, void *value)
-{
- IX_ETH_DB_CHECK_PORT_EXISTS(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(type);
-
- IX_ETH_DB_CHECK_REFERENCE(value);
-
- if (feature == IX_ETH_DB_VLAN_QOS)
- {
- if (property == IX_ETH_DB_QOS_TRAFFIC_CLASS_COUNT_PROPERTY)
- {
- * (UINT32 *) value = ixEthDBPortInfo[portID].ixEthDBTrafficClassCount;
- *type = IX_ETH_DB_INTEGER_PROPERTY;
-
- return IX_ETH_DB_SUCCESS;
- }
- else if (property >= IX_ETH_DB_QOS_TRAFFIC_CLASS_0_RX_QUEUE_PROPERTY
- && property <= IX_ETH_DB_QOS_TRAFFIC_CLASS_7_RX_QUEUE_PROPERTY)
- {
- UINT32 classDelta = property - IX_ETH_DB_QOS_TRAFFIC_CLASS_0_RX_QUEUE_PROPERTY;
-
- if (classDelta >= ixEthDBPortInfo[portID].ixEthDBTrafficClassCount)
- {
- return IX_ETH_DB_FAIL;
- }
-
- * (UINT32 *) value = ixEthDBPortInfo[portID].ixEthDBTrafficClassAQMAssignments[classDelta];
- *type = IX_ETH_DB_INTEGER_PROPERTY;
-
- return IX_ETH_DB_SUCCESS;
- }
- }
-
- return IX_ETH_DB_INVALID_ARG;
-}
-
-/**
- * @brief sets the value of an EthDB property
- *
- * @param portID ID of the port
- * @param feature feature owning the property
- * @param property ID of the property
- * @param value location containing the property value
- *
- * This function implements a private property intended
- * only for EthAcc usage. Upon setting the IX_ETH_DB_QOS_QUEUE_CONFIGURATION_COMPLETE
- * property (the value is ignored), the availability of traffic classes is
- * frozen to whatever traffic class structure is currently in use.
- * This means that if VLAN_QOS has been enabled before EthAcc
- * initialization then all the defined traffic classes will be available;
- * otherwise only one traffic class (0) will be available.
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h as not accepting any parameters. The
- * current implementation is only intended for the private use of EthAcc.
- *
- * Also note that once this function is called the effect is irreversible,
- * unless EthDB is complete unloaded and re-initialized.
- *
- * @return IX_ETH_DB_INVALID_ARG (no read-write properties are
- * supported in this release)
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFeaturePropertySet(IxEthDBPortId portID, IxEthDBFeature feature, IxEthDBProperty property, void *value)
-{
- IX_ETH_DB_CHECK_PORT_EXISTS(portID);
-
- if ((feature == IX_ETH_DB_VLAN_QOS) && (property == IX_ETH_DB_QOS_QUEUE_CONFIGURATION_COMPLETE))
- {
- ixEthDBPortInfo[portID].ixEthDBTrafficClassAvailable = ixEthDBPortInfo[portID].ixEthDBTrafficClassCount;
-
- return IX_ETH_DB_SUCCESS;
- }
-
- return IX_ETH_DB_INVALID_ARG;
-}
diff --git a/cpu/ixp/npe/IxEthDBFirewall.c b/cpu/ixp/npe/IxEthDBFirewall.c
deleted file mode 100644
index eb46174b6c..0000000000
--- a/cpu/ixp/npe/IxEthDBFirewall.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * @file IxEthDBFirewall.c
- *
- * @brief Implementation of the firewall API
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-#include "IxEthDB_p.h"
-
-/**
- * @brief updates the NPE firewall operating mode and
- * firewall address table
- *
- * @param portID ID of the port
- * @param epDelta initial entry point for binary searches (NPE optimization)
- * @param address address of the firewall MAC address table
- *
- * This function will send a message to the NPE configuring the
- * firewall mode (white list or black list), invalid source
- * address filtering and downloading a new MAC address database
- * to be used for firewall matching.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or IX_ETH_DB_FAIL otherwise
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFirewallUpdate(IxEthDBPortId portID, void *address, UINT32 epDelta)
-{
- IxNpeMhMessage message;
- IX_STATUS result;
-
- UINT32 mode = 0;
- PortInfo *portInfo = &ixEthDBPortInfo[portID];
-
- mode = (portInfo->srcAddressFilterEnabled != FALSE) << 1 | (portInfo->firewallMode == IX_ETH_DB_FIREWALL_WHITE_LIST);
-
- FILL_SETFIREWALLMODE_MSG(message,
- IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID),
- epDelta,
- mode,
- IX_OSAL_MMU_VIRT_TO_PHYS(address));
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- return result;
-}
-
-/**
- * @brief configures the firewall white list/black list
- * access mode
- *
- * @param portID ID of the port
- * @param mode firewall filtering mode (IX_ETH_DB_FIREWALL_WHITE_LIST
- * or IX_ETH_DB_FIREWALL_BLACK_LIST)
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFirewallModeSet(IxEthDBPortId portID, IxEthDBFirewallMode mode)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_FIREWALL);
-
- if (mode != IX_ETH_DB_FIREWALL_WHITE_LIST
- && mode != IX_ETH_DB_FIREWALL_BLACK_LIST)
- {
- return IX_ETH_DB_INVALID_ARG;
- }
-
- ixEthDBPortInfo[portID].firewallMode = mode;
-
- return ixEthDBFirewallTableDownload(portID);
-}
-
-/**
- * @brief enables or disables the invalid source MAC address filter
- *
- * @param portID ID of the port
- * @param enable TRUE to enable invalid source MAC address filtering
- * or FALSE to disable it
- *
- * The invalid source MAC address filter will discard, when enabled,
- * frames whose source MAC address is a multicast or the broadcast MAC
- * address.
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFirewallInvalidAddressFilterEnable(IxEthDBPortId portID, BOOL enable)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_FIREWALL);
-
- ixEthDBPortInfo[portID].srcAddressFilterEnabled = enable;
-
- return ixEthDBFirewallTableDownload(portID);
-}
-
-/**
- * @brief adds a firewall record
- *
- * @param portID ID of the port
- * @param macAddr MAC address of the new record
- *
- * This function will add a new firewall record
- * on the specified port, using the specified
- * MAC address. If the record already exists this
- * function will silently return IX_ETH_DB_SUCCESS,
- * although no duplicate records are added.
- *
- * Note that this function is documented in the main
- * component header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFirewallEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
-{
- MacDescriptor recordTemplate;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_FIREWALL);
-
- memcpy(recordTemplate.macAddress, macAddr, sizeof (IxEthDBMacAddr));
-
- recordTemplate.type = IX_ETH_DB_FIREWALL_RECORD;
- recordTemplate.portID = portID;
-
- return ixEthDBAdd(&recordTemplate, NULL);
-}
-
-/**
- * @brief removes a firewall record
- *
- * @param portID ID of the port
- * @param macAddr MAC address of the record to remove
- *
- * This function will attempt to remove a firewall
- * record from the given port, using the specified
- * MAC address.
- *
- * Note that this function is documented in the main
- * component header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully of an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFirewallEntryRemove(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
-{
- MacDescriptor recordTemplate;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_FIREWALL);
-
- memcpy(recordTemplate.macAddress, macAddr, sizeof (IxEthDBMacAddr));
-
- recordTemplate.type = IX_ETH_DB_FIREWALL_RECORD;
- recordTemplate.portID = portID;
-
- return ixEthDBRemove(&recordTemplate, NULL);
-}
-
-/**
- * @brief downloads the firewall address table to an NPE
- *
- * @param portID ID of the port
- *
- * This function will download the firewall address table to
- * an NPE port.
- *
- * Note that this function is documented in the main
- * component header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or IX_ETH_DB_FAIL otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFirewallTableDownload(IxEthDBPortId portID)
-{
- IxEthDBPortMap query;
- IxEthDBStatus result;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_FIREWALL);
-
- SET_DEPENDENCY_MAP(query, portID);
-
- ixEthDBUpdateLock();
-
- ixEthDBPortInfo[portID].updateMethod.searchTree = ixEthDBQuery(NULL, query, IX_ETH_DB_FIREWALL_RECORD, MAX_FW_SIZE);
-
- result = ixEthDBNPEUpdateHandler(portID, IX_ETH_DB_FIREWALL_RECORD);
-
- ixEthDBUpdateUnlock();
-
- return result;
-}
diff --git a/cpu/ixp/npe/IxEthDBHashtable.c b/cpu/ixp/npe/IxEthDBHashtable.c
deleted file mode 100644
index f1b18e6b48..0000000000
--- a/cpu/ixp/npe/IxEthDBHashtable.c
+++ /dev/null
@@ -1,642 +0,0 @@
-/**
- * @file ethHash.c
- *
- * @brief Hashtable implementation
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-#include "IxEthDB_p.h"
-#include "IxEthDBLocks_p.h"
-
-/**
- * @addtogroup EthDB
- *
- * @{
- */
-
-/**
- * @brief initializes a hash table object
- *
- * @param hashTable uninitialized hash table structure
- * @param numBuckets number of buckets to use
- * @param entryHashFunction hash function used
- * to hash entire hash node data block (for adding)
- * @param matchFunctions array of match functions, indexed on type,
- * used to differentiate records with the same hash value
- * @param freeFunction function used to free node data blocks
- *
- * Initializes the given hash table object.
- *
- * @internal
- */
-void ixEthDBInitHash(HashTable *hashTable,
- UINT32 numBuckets,
- HashFunction entryHashFunction,
- MatchFunction *matchFunctions,
- FreeFunction freeFunction)
-{
- UINT32 bucketIndex;
- UINT32 hashSize = numBuckets * sizeof(HashNode *);
-
- /* entry hashing, matching and freeing methods */
- hashTable->entryHashFunction = entryHashFunction;
- hashTable->matchFunctions = matchFunctions;
- hashTable->freeFunction = freeFunction;
-
- /* buckets */
- hashTable->numBuckets = numBuckets;
-
- /* set to 0 all buckets */
- memset(hashTable->hashBuckets, 0, hashSize);
-
- /* init bucket locks - note that initially all mutexes are unlocked after MutexInit()*/
- for (bucketIndex = 0 ; bucketIndex < numBuckets ; bucketIndex++)
- {
- ixOsalFastMutexInit(&hashTable->bucketLocks[bucketIndex]);
- }
-}
-
-/**
- * @brief adds an entry to the hash table
- *
- * @param hashTable hash table to add the entry to
- * @param entry entry to add
- *
- * The entry will be hashed using the entry hashing function and added to the
- * hash table, unless a locking blockage occurs, in which case the caller
- * should retry.
- *
- * @retval IX_ETH_DB_SUCCESS if adding <i>entry</i> has succeeded
- * @retval IX_ETH_DB_NOMEM if there's no memory left in the hash node pool
- * @retval IX_ETH_DB_BUSY if there's a locking failure on the insertion path
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBAddHashEntry(HashTable *hashTable, void *entry)
-{
- UINT32 hashValue = hashTable->entryHashFunction(entry);
- UINT32 bucketIndex = hashValue % hashTable->numBuckets;
- HashNode *bucket = hashTable->hashBuckets[bucketIndex];
- HashNode *newNode;
-
- LockStack locks;
-
- INIT_STACK(&locks);
-
- /* lock bucket */
- PUSH_LOCK(&locks, &hashTable->bucketLocks[bucketIndex]);
-
- /* lock insertion element (first in chain), if any */
- if (bucket != NULL)
- {
- PUSH_LOCK(&locks, &bucket->lock);
- }
-
- /* get new node */
- newNode = ixEthDBAllocHashNode();
-
- if (newNode == NULL)
- {
- /* unlock everything */
- UNROLL_STACK(&locks);
-
- return IX_ETH_DB_NOMEM;
- }
-
- /* init lock - note that mutexes are unlocked after MutexInit */
- ixOsalFastMutexInit(&newNode->lock);
-
- /* populate new link */
- newNode->data = entry;
-
- /* add to bucket */
- newNode->next = bucket;
- hashTable->hashBuckets[bucketIndex] = newNode;
-
- /* unlock bucket and insertion point */
- UNROLL_STACK(&locks);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief removes an entry from the hashtable
- *
- * @param hashTable hash table to remove entry from
- * @param keyType type of record key used for matching
- * @param reference reference key used to identify the entry
- *
- * The reference key will be hashed using the key hashing function,
- * the entry is searched using the hashed value and then examined
- * against the reference entry using the match function. A positive
- * match will trigger the deletion of the entry.
- * Locking failures are reported and the caller should retry.
- *
- * @retval IX_ETH_DB_SUCCESS if the removal was successful
- * @retval IX_ETH_DB_NO_SUCH_ADDR if the entry was not found
- * @retval IX_ETH_DB_BUSY if a locking failure occured during the process
- *
- * @internal
- */
-IxEthDBStatus ixEthDBRemoveHashEntry(HashTable *hashTable, int keyType, void *reference)
-{
- UINT32 hashValue = hashTable->entryHashFunction(reference);
- UINT32 bucketIndex = hashValue % hashTable->numBuckets;
- HashNode *node = hashTable->hashBuckets[bucketIndex];
- HashNode *previousNode = NULL;
-
- LockStack locks;
-
- INIT_STACK(&locks);
-
- while (node != NULL)
- {
- /* try to lock node */
- PUSH_LOCK(&locks, &node->lock);
-
- if (hashTable->matchFunctions[keyType](reference, node->data))
- {
- /* found entry */
- if (node->next != NULL)
- {
- PUSH_LOCK(&locks, &node->next->lock);
- }
-
- if (previousNode == NULL)
- {
- /* node is head of chain */
- PUSH_LOCK(&locks, &hashTable->bucketLocks[bucketIndex]);
-
- hashTable->hashBuckets[bucketIndex] = node->next;
-
- POP_LOCK(&locks);
- }
- else
- {
- /* relink */
- previousNode->next = node->next;
- }
-
- UNROLL_STACK(&locks);
-
- /* free node */
- hashTable->freeFunction(node->data);
- ixEthDBFreeHashNode(node);
-
- return IX_ETH_DB_SUCCESS;
- }
- else
- {
- if (previousNode != NULL)
- {
- /* unlock previous node */
- SHIFT_STACK(&locks);
- }
-
- /* advance to next element in chain */
- previousNode = node;
- node = node->next;
- }
- }
-
- UNROLL_STACK(&locks);
-
- /* not found */
- return IX_ETH_DB_NO_SUCH_ADDR;
-}
-
-/**
- * @brief retrieves an entry from the hash table
- *
- * @param hashTable hash table to perform the search into
- * @param reference search key (a MAC address)
- * @param keyType type of record key used for matching
- * @param searchResult pointer where a reference to the located hash node
- * is placed
- *
- * Searches the entry with the same key as <i>reference</i> and places the
- * pointer to the resulting node in <i>searchResult</i>.
- * An implicit write access lock is granted after a search, which gives the
- * caller the opportunity to modify the entry.
- * Access should be released as soon as possible using @ref ixEthDBReleaseHashNode().
- *
- * @see ixEthDBReleaseHashNode()
- *
- * @retval IX_ETH_DB_SUCCESS if the search was completed successfully
- * @retval IX_ETH_DB_NO_SUCH_ADDRESS if no entry with the given key was found
- * @retval IX_ETH_DB_BUSY if a locking failure has occured, in which case
- * the caller should retry
- *
- * @warning unless the return value is <b>IX_ETH_DB_SUCCESS</b> the searchResult
- * location is NOT modified and therefore using a NULL comparison test when the
- * value was not properly initialized would be an error
- *
- * @internal
- */
-IxEthDBStatus ixEthDBSearchHashEntry(HashTable *hashTable, int keyType, void *reference, HashNode **searchResult)
-{
- UINT32 hashValue;
- HashNode *node;
-
- hashValue = hashTable->entryHashFunction(reference);
- node = hashTable->hashBuckets[hashValue % hashTable->numBuckets];
-
- while (node != NULL)
- {
- TRY_LOCK(&node->lock);
-
- if (hashTable->matchFunctions[keyType](reference, node->data))
- {
- *searchResult = node;
-
- return IX_ETH_DB_SUCCESS;
- }
- else
- {
- UNLOCK(&node->lock);
-
- node = node->next;
- }
- }
-
- /* not found */
- return IX_ETH_DB_NO_SUCH_ADDR;
-}
-
-/**
- * @brief reports the existence of an entry in the hash table
- *
- * @param hashTable hash table to perform the search into
- * @param reference search key (a MAC address)
- * @param keyType type of record key used for matching
- *
- * Searches the entry with the same key as <i>reference</i>.
- * No implicit write access lock is granted after a search, hence the
- * caller cannot access or modify the entry. The result is only temporary.
- *
- * @see ixEthDBReleaseHashNode()
- *
- * @retval IX_ETH_DB_SUCCESS if the search was completed successfully
- * @retval IX_ETH_DB_NO_SUCH_ADDRESS if no entry with the given key was found
- * @retval IX_ETH_DB_BUSY if a locking failure has occured, in which case
- * the caller should retry
- *
- * @internal
- */
-IxEthDBStatus ixEthDBPeekHashEntry(HashTable *hashTable, int keyType, void *reference)
-{
- UINT32 hashValue;
- HashNode *node;
-
- hashValue = hashTable->entryHashFunction(reference);
- node = hashTable->hashBuckets[hashValue % hashTable->numBuckets];
-
- while (node != NULL)
- {
- TRY_LOCK(&node->lock);
-
- if (hashTable->matchFunctions[keyType](reference, node->data))
- {
- UNLOCK(&node->lock);
-
- return IX_ETH_DB_SUCCESS;
- }
- else
- {
- UNLOCK(&node->lock);
-
- node = node->next;
- }
- }
-
- /* not found */
- return IX_ETH_DB_NO_SUCH_ADDR;
-}
-
-/**
- * @brief releases the write access lock
- *
- * @pre the node should have been obtained via @ref ixEthDBSearchHashEntry()
- *
- * @see ixEthDBSearchHashEntry()
- *
- * @internal
- */
-void ixEthDBReleaseHashNode(HashNode *node)
-{
- UNLOCK(&node->lock);
-}
-
-/**
- * @brief initializes a hash iterator
- *
- * @param hashTable hash table to be iterated
- * @param iterator iterator object
- *
- * If the initialization is successful the iterator will point to the
- * first hash table record (if any).
- * Testing if the iterator has not passed the end of the table should be
- * done using the IS_ITERATOR_VALID(iteratorPtr) macro.
- * An implicit write access lock is granted on the entry pointed by the iterator.
- * The access is automatically revoked when the iterator is incremented.
- * If the caller decides to terminate the iteration before the end of the table is
- * passed then the manual access release method, @ref ixEthDBReleaseHashIterator,
- * must be called.
- *
- * @see ixEthDBReleaseHashIterator()
- *
- * @retval IX_ETH_DB_SUCCESS if initialization was successful and the iterator points
- * to the first valid table node
- * @retval IX_ETH_DB_FAIL if the table is empty
- * @retval IX_ETH_DB_BUSY if a locking failure has occured, in which case the caller
- * should retry
- *
- * @warning do not use ixEthDBReleaseHashNode() on entries pointed by the iterator, as this
- * might place the database in a permanent invalid lock state
- *
- * @internal
- */
-IxEthDBStatus ixEthDBInitHashIterator(HashTable *hashTable, HashIterator *iterator)
-{
- iterator->bucketIndex = 0;
- iterator->node = NULL;
- iterator->previousNode = NULL;
-
- return ixEthDBIncrementHashIterator(hashTable, iterator);
-}
-
-/**
- * @brief releases the write access locks of the iterator nodes
- *
- * @warning use of this function is required only when the caller terminates an iteration
- * before reaching the end of the table
- *
- * @see ixEthDBInitHashIterator()
- * @see ixEthDBIncrementHashIterator()
- *
- * @param iterator iterator whose node(s) should be unlocked
- *
- * @internal
- */
-void ixEthDBReleaseHashIterator(HashIterator *iterator)
-{
- if (iterator->previousNode != NULL)
- {
- UNLOCK(&iterator->previousNode->lock);
- }
-
- if (iterator->node != NULL)
- {
- UNLOCK(&iterator->node->lock);
- }
-}
-
-/**
- * @brief incremenents an iterator so that it points to the next valid entry of the table
- * (if any)
- *
- * @param hashTable hash table to iterate
- * @param iterator iterator object
- *
- * @pre the iterator object must be initialized using @ref ixEthDBInitHashIterator()
- *
- * If the increment operation is successful the iterator will point to the
- * next hash table record (if any).
- * Testing if the iterator has not passed the end of the table should be
- * done using the IS_ITERATOR_VALID(iteratorPtr) macro.
- * An implicit write access lock is granted on the entry pointed by the iterator.
- * The access is automatically revoked when the iterator is re-incremented.
- * If the caller decides to terminate the iteration before the end of the table is
- * passed then the manual access release method, @ref ixEthDBReleaseHashIterator,
- * must be called.
- * Is is guaranteed that no other thread can remove or change the iterated entry until
- * the iterator is incremented successfully.
- *
- * @see ixEthDBReleaseHashIterator()
- *
- * @retval IX_ETH_DB_SUCCESS if the operation was successful and the iterator points
- * to the next valid table node
- * @retval IX_ETH_DB_FAIL if the iterator has passed the end of the table
- * @retval IX_ETH_DB_BUSY if a locking failure has occured, in which case the caller
- * should retry
- *
- * @warning do not use ixEthDBReleaseHashNode() on entries pointed by the iterator, as this
- * might place the database in a permanent invalid lock state
- *
- * @internal
- */
-IxEthDBStatus ixEthDBIncrementHashIterator(HashTable *hashTable, HashIterator *iterator)
-{
- /* unless iterator is just initialized... */
- if (iterator->node != NULL)
- {
- /* try next in chain */
- if (iterator->node->next != NULL)
- {
- TRY_LOCK(&iterator->node->next->lock);
-
- if (iterator->previousNode != NULL)
- {
- UNLOCK(&iterator->previousNode->lock);
- }
-
- iterator->previousNode = iterator->node;
- iterator->node = iterator->node->next;
-
- return IX_ETH_DB_SUCCESS;
- }
- else
- {
- /* last in chain, prepare for next bucket */
- iterator->bucketIndex++;
- }
- }
-
- /* try next used bucket */
- for (; iterator->bucketIndex < hashTable->numBuckets ; iterator->bucketIndex++)
- {
- HashNode **nodePtr = &(hashTable->hashBuckets[iterator->bucketIndex]);
- HashNode *node = *nodePtr;
-#if (CPU!=SIMSPARCSOLARIS) && !defined (__wince)
- if (((iterator->bucketIndex & IX_ETHDB_BUCKET_INDEX_MASK) == 0) &&
- (iterator->bucketIndex < (hashTable->numBuckets - IX_ETHDB_BUCKETPTR_AHEAD)))
- {
- /* preload next cache line (2 cache line ahead) */
- nodePtr += IX_ETHDB_BUCKETPTR_AHEAD;
- __asm__ ("pld [%0];\n": : "r" (nodePtr));
- }
-#endif
- if (node != NULL)
- {
- TRY_LOCK(&node->lock);
-
- /* unlock last one or two nodes in the previous chain */
- if (iterator->node != NULL)
- {
- UNLOCK(&iterator->node->lock);
-
- if (iterator->previousNode != NULL)
- {
- UNLOCK(&iterator->previousNode->lock);
- }
- }
-
- /* redirect iterator */
- iterator->previousNode = NULL;
- iterator->node = node;
-
- return IX_ETH_DB_SUCCESS;
- }
- }
-
- /* could not advance iterator */
- if (iterator->node != NULL)
- {
- UNLOCK(&iterator->node->lock);
-
- if (iterator->previousNode != NULL)
- {
- UNLOCK(&iterator->previousNode->lock);
- }
-
- iterator->node = NULL;
- }
-
- return IX_ETH_DB_END;
-}
-
-/**
- * @brief removes an entry pointed by an iterator
- *
- * @param hashTable iterated hash table
- * @param iterator iterator object
- *
- * Removes the entry currently pointed by the iterator and repositions the iterator
- * on the next valid entry (if any). Handles locking issues automatically and
- * implicitely grants write access lock to the new pointed entry.
- * Failures due to concurrent threads having write access locks in the same region
- * preserve the state of the database and the iterator object, leaving the caller
- * free to retry without loss of access. It is guaranteed that only the thread owning
- * the iterator can remove the object pointed by the iterator.
- *
- * @retval IX_ETH_DB_SUCCESS if removal has succeeded
- * @retval IX_ETH_DB_BUSY if a locking failure has occured, in which case the caller
- * should retry
- *
- * @internal
- */
-IxEthDBStatus ixEthDBRemoveEntryAtHashIterator(HashTable *hashTable, HashIterator *iterator)
-{
- HashIterator nextIteratorPos;
- LockStack locks;
-
- INIT_STACK(&locks);
-
- /* set initial bucket index for next position */
- nextIteratorPos.bucketIndex = iterator->bucketIndex;
-
- /* compute iterator position before removing anything and lock ahead */
- if (iterator->node->next != NULL)
- {
- PUSH_LOCK(&locks, &iterator->node->next->lock);
-
- /* reposition on the next node in the chain */
- nextIteratorPos.node = iterator->node->next;
- nextIteratorPos.previousNode = iterator->previousNode;
- }
- else
- {
- /* try next chain - don't know yet if we'll find anything */
- nextIteratorPos.node = NULL;
-
- /* if we find something it's a chain head */
- nextIteratorPos.previousNode = NULL;
-
- /* browse up in the buckets to find a non-null chain */
- while (++nextIteratorPos.bucketIndex < hashTable->numBuckets)
- {
- nextIteratorPos.node = hashTable->hashBuckets[nextIteratorPos.bucketIndex];
-
- if (nextIteratorPos.node != NULL)
- {
- /* found a non-empty chain, try to lock head */
- PUSH_LOCK(&locks, &nextIteratorPos.node->lock);
-
- break;
- }
- }
- }
-
- /* restore links over the to-be-deleted item */
- if (iterator->previousNode == NULL)
- {
- /* first in chain, lock bucket */
- PUSH_LOCK(&locks, &hashTable->bucketLocks[iterator->bucketIndex]);
-
- hashTable->hashBuckets[iterator->bucketIndex] = iterator->node->next;
-
- POP_LOCK(&locks);
- }
- else
- {
- /* relink */
- iterator->previousNode->next = iterator->node->next;
-
- /* unlock last remaining node in current chain when moving between chains */
- if (iterator->node->next == NULL)
- {
- UNLOCK(&iterator->previousNode->lock);
- }
- }
-
- /* delete entry */
- hashTable->freeFunction(iterator->node->data);
- ixEthDBFreeHashNode(iterator->node);
-
- /* reposition iterator */
- *iterator = nextIteratorPos;
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @}
- */
diff --git a/cpu/ixp/npe/IxEthDBLearning.c b/cpu/ixp/npe/IxEthDBLearning.c
deleted file mode 100644
index 2287dbe96c..0000000000
--- a/cpu/ixp/npe/IxEthDBLearning.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * @file IxEthDBLearning.c
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxEthDB_p.h"
-
-/**
- * @brief hashes the mac address in a mac descriptor with a XOR function
- *
- * @param entry pointer to a mac descriptor to be hashed
- *
- * This function only extracts the mac address and employs ixEthDBKeyXORHash()
- * to do the actual hashing.
- * Used only to add a whole entry to a hash table, as opposed to searching which
- * takes only a key and uses the key hashing directly.
- *
- * @see ixEthDBKeyXORHash()
- *
- * @return the hash value
- *
- * @internal
- */
-UINT32 ixEthDBEntryXORHash(void *entry)
-{
- MacDescriptor *descriptor = (MacDescriptor *) entry;
-
- return ixEthDBKeyXORHash(descriptor->macAddress);
-}
-
-/**
- * @brief hashes a mac address
- *
- * @param key pointer to a 6 byte structure (typically an IxEthDBMacAddr pointer)
- * to be hashed
- *
- * Given a 6 bytes MAC address, the hash used is:
- *
- * hash(MAC[0:5]) = MAC[0:1] ^ MAC[2:3] ^ MAC[4:5]
- *
- * Used by the hash table to search and remove entries based
- * solely on their keys (mac addresses).
- *
- * @return the hash value
- *
- * @internal
- */
-UINT32 ixEthDBKeyXORHash(void *key)
-{
- UINT32 hashValue;
- UINT8 *value = (UINT8 *) key;
-
- hashValue = (value[5] << 8) | value[4];
- hashValue ^= (value[3] << 8) | value[2];
- hashValue ^= (value[1] << 8) | value[0];
-
- return hashValue;
-}
-
-/**
- * @brief mac descriptor match function
- *
- * @param reference mac address (typically an IxEthDBMacAddr pointer) structure
- * @param entry pointer to a mac descriptor whose key (mac address) is to be
- * matched against the reference key
- *
- * Used by the hash table to retrieve entries. Hashing entries can produce
- * collisions, i.e. descriptors with different mac addresses and the same
- * hash value, where this function is used to differentiate entries.
- *
- * @retval TRUE if the entry matches the reference key (equal addresses)
- * @retval FALSE if the entry does not match the reference key
- *
- * @internal
- */
-BOOL ixEthDBAddressMatch(void *reference, void *entry)
-{
- return (ixEthDBAddressCompare(reference, ((MacDescriptor *) entry)->macAddress) == 0);
-}
-
-/**
- * @brief compares two mac addresses
- *
- * @param mac1 first mac address to compare
- * @param mac2 second mac address to compare
- *
- * This comparison works in a similar way to strcmp, producing similar results.
- * Used to insert values keyed on mac addresses into binary search trees.
- *
- * @retval -1 if mac1 < mac2
- * @retval 0 if ma1 == mac2
- * @retval 1 if mac1 > mac2
- */
-UINT32 ixEthDBAddressCompare(UINT8 *mac1, UINT8 *mac2)
-{
- UINT32 local_index;
-
- for (local_index = 0 ; local_index < IX_IEEE803_MAC_ADDRESS_SIZE ; local_index++)
- {
- if (mac1[local_index] > mac2[local_index])
- {
- return 1;
- }
- else if (mac1[local_index] < mac2[local_index])
- {
- return -1;
- }
- }
-
- return 0;
-}
-
diff --git a/cpu/ixp/npe/IxEthDBMem.c b/cpu/ixp/npe/IxEthDBMem.c
deleted file mode 100644
index 133cbef8d6..0000000000
--- a/cpu/ixp/npe/IxEthDBMem.c
+++ /dev/null
@@ -1,649 +0,0 @@
-/**
- * @file IxEthDBDBMem.c
- *
- * @brief Memory handling routines for the MAC address database
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-#include "IxEthDB_p.h"
-
-IX_ETH_DB_PRIVATE HashNode *nodePool = NULL;
-IX_ETH_DB_PRIVATE MacDescriptor *macPool = NULL;
-IX_ETH_DB_PRIVATE MacTreeNode *treePool = NULL;
-
-IX_ETH_DB_PRIVATE HashNode nodePoolArea[NODE_POOL_SIZE];
-IX_ETH_DB_PRIVATE MacDescriptor macPoolArea[MAC_POOL_SIZE];
-IX_ETH_DB_PRIVATE MacTreeNode treePoolArea[TREE_POOL_SIZE];
-
-IX_ETH_DB_PRIVATE IxOsalMutex nodePoolLock;
-IX_ETH_DB_PRIVATE IxOsalMutex macPoolLock;
-IX_ETH_DB_PRIVATE IxOsalMutex treePoolLock;
-
-#define LOCK_NODE_POOL { ixOsalMutexLock(&nodePoolLock, IX_OSAL_WAIT_FOREVER); }
-#define UNLOCK_NODE_POOL { ixOsalMutexUnlock(&nodePoolLock); }
-
-#define LOCK_MAC_POOL { ixOsalMutexLock(&macPoolLock, IX_OSAL_WAIT_FOREVER); }
-#define UNLOCK_MAC_POOL { ixOsalMutexUnlock(&macPoolLock); }
-
-#define LOCK_TREE_POOL { ixOsalMutexLock(&treePoolLock, IX_OSAL_WAIT_FOREVER); }
-#define UNLOCK_TREE_POOL { ixOsalMutexUnlock(&treePoolLock); }
-
-/* private function prototypes */
-IX_ETH_DB_PRIVATE MacDescriptor* ixEthDBPoolAllocMacDescriptor(void);
-IX_ETH_DB_PRIVATE void ixEthDBPoolFreeMacDescriptor(MacDescriptor *macDescriptor);
-
-/**
- * @addtogroup EthMemoryManagement
- *
- * @{
- */
-
-/**
- * @brief initializes the memory pools used by the ethernet database component
- *
- * Initializes the hash table node, mac descriptor and mac tree node pools.
- * Called at initialization time by @ref ixEthDBInit().
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBInitMemoryPools(void)
-{
- int local_index;
-
- /* HashNode pool */
- ixOsalMutexInit(&nodePoolLock);
-
- for (local_index = 0 ; local_index < NODE_POOL_SIZE ; local_index++)
- {
- HashNode *freeNode = &nodePoolArea[local_index];
-
- freeNode->nextFree = nodePool;
- nodePool = freeNode;
- }
-
- /* MacDescriptor pool */
- ixOsalMutexInit(&macPoolLock);
-
- for (local_index = 0 ; local_index < MAC_POOL_SIZE ; local_index++)
- {
- MacDescriptor *freeDescriptor = &macPoolArea[local_index];
-
- freeDescriptor->nextFree = macPool;
- macPool = freeDescriptor;
- }
-
- /* MacTreeNode pool */
- ixOsalMutexInit(&treePoolLock);
-
- for (local_index = 0 ; local_index < TREE_POOL_SIZE ; local_index++)
- {
- MacTreeNode *freeNode = &treePoolArea[local_index];
-
- freeNode->nextFree = treePool;
- treePool = freeNode;
- }
-}
-
-/**
- * @brief allocates a hash node from the pool
- *
- * Allocates a hash node and resets its value.
- *
- * @return the allocated hash node or NULL if the pool is empty
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-HashNode* ixEthDBAllocHashNode(void)
-{
- HashNode *allocatedNode = NULL;
-
- if (nodePool != NULL)
- {
- LOCK_NODE_POOL;
-
- allocatedNode = nodePool;
- nodePool = nodePool->nextFree;
-
- UNLOCK_NODE_POOL;
-
- memset(allocatedNode, 0, sizeof(HashNode));
- }
-
- return allocatedNode;
-}
-
-/**
- * @brief frees a hash node into the pool
- *
- * @param hashNode node to be freed
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBFreeHashNode(HashNode *hashNode)
-{
- if (hashNode != NULL)
- {
- LOCK_NODE_POOL;
-
- hashNode->nextFree = nodePool;
- nodePool = hashNode;
-
- UNLOCK_NODE_POOL;
- }
-}
-
-/**
- * @brief allocates a mac descriptor from the pool
- *
- * Allocates a mac descriptor and resets its value.
- * This function is not used directly, instead @ref ixEthDBAllocMacDescriptor()
- * is used, which keeps track of the pointer reference count.
- *
- * @see ixEthDBAllocMacDescriptor()
- *
- * @warning this function is not used directly by any other function
- * apart from ixEthDBAllocMacDescriptor()
- *
- * @return the allocated mac descriptor or NULL if the pool is empty
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-MacDescriptor* ixEthDBPoolAllocMacDescriptor(void)
-{
- MacDescriptor *allocatedDescriptor = NULL;
-
- if (macPool != NULL)
- {
- LOCK_MAC_POOL;
-
- allocatedDescriptor = macPool;
- macPool = macPool->nextFree;
-
- UNLOCK_MAC_POOL;
-
- memset(allocatedDescriptor, 0, sizeof(MacDescriptor));
- }
-
- return allocatedDescriptor;
-}
-
-/**
- * @brief allocates and initializes a mac descriptor smart pointer
- *
- * Uses @ref ixEthDBPoolAllocMacDescriptor() to allocate a mac descriptor
- * from the pool and initializes its reference count.
- *
- * @see ixEthDBPoolAllocMacDescriptor()
- *
- * @return the allocated mac descriptor or NULL if the pool is empty
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-MacDescriptor* ixEthDBAllocMacDescriptor(void)
-{
- MacDescriptor *allocatedDescriptor = ixEthDBPoolAllocMacDescriptor();
-
- if (allocatedDescriptor != NULL)
- {
- LOCK_MAC_POOL;
-
- allocatedDescriptor->refCount++;
-
- UNLOCK_MAC_POOL;
- }
-
- return allocatedDescriptor;
-}
-
-/**
- * @brief frees a mac descriptor back into the pool
- *
- * @param macDescriptor mac descriptor to be freed
- *
- * @warning this function is not to be called by anyone but
- * ixEthDBFreeMacDescriptor()
- *
- * @see ixEthDBFreeMacDescriptor()
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBPoolFreeMacDescriptor(MacDescriptor *macDescriptor)
-{
- LOCK_MAC_POOL;
-
- macDescriptor->nextFree = macPool;
- macPool = macDescriptor;
-
- UNLOCK_MAC_POOL;
-}
-
-/**
- * @brief frees or reduces the usage count of a mac descriptor smart pointer
- *
- * If the reference count reaches 0 (structure is no longer used anywhere)
- * then the descriptor is freed back into the pool using ixEthDBPoolFreeMacDescriptor().
- *
- * @see ixEthDBPoolFreeMacDescriptor()
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBFreeMacDescriptor(MacDescriptor *macDescriptor)
-{
- if (macDescriptor != NULL)
- {
- LOCK_MAC_POOL;
-
- if (macDescriptor->refCount > 0)
- {
- macDescriptor->refCount--;
-
- if (macDescriptor->refCount == 0)
- {
- UNLOCK_MAC_POOL;
-
- ixEthDBPoolFreeMacDescriptor(macDescriptor);
- }
- else
- {
- UNLOCK_MAC_POOL;
- }
- }
- else
- {
- UNLOCK_MAC_POOL;
- }
- }
-}
-
-/**
- * @brief clones a mac descriptor smart pointer
- *
- * @param macDescriptor mac descriptor to clone
- *
- * Increments the usage count of the smart pointer
- *
- * @returns the cloned smart pointer
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-MacDescriptor* ixEthDBCloneMacDescriptor(MacDescriptor *macDescriptor)
-{
- LOCK_MAC_POOL;
-
- if (macDescriptor->refCount == 0)
- {
- UNLOCK_MAC_POOL;
-
- return NULL;
- }
-
- macDescriptor->refCount++;
-
- UNLOCK_MAC_POOL;
-
- return macDescriptor;
-}
-
-/**
- * @brief allocates a mac tree node from the pool
- *
- * Allocates and initializes a mac tree node from the pool.
- *
- * @return the allocated mac tree node or NULL if the pool is empty
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-MacTreeNode* ixEthDBAllocMacTreeNode(void)
-{
- MacTreeNode *allocatedNode = NULL;
-
- if (treePool != NULL)
- {
- LOCK_TREE_POOL;
-
- allocatedNode = treePool;
- treePool = treePool->nextFree;
-
- UNLOCK_TREE_POOL;
-
- memset(allocatedNode, 0, sizeof(MacTreeNode));
- }
-
- return allocatedNode;
-}
-
-/**
- * @brief frees a mac tree node back into the pool
- *
- * @param macNode mac tree node to be freed
- *
- * @warning not to be used except from ixEthDBFreeMacTreeNode().
- *
- * @see ixEthDBFreeMacTreeNode()
- *
- * @internal
- */
-void ixEthDBPoolFreeMacTreeNode(MacTreeNode *macNode)
-{
- if (macNode != NULL)
- {
- LOCK_TREE_POOL;
-
- macNode->nextFree = treePool;
- treePool = macNode;
-
- UNLOCK_TREE_POOL;
- }
-}
-
-/**
- * @brief frees or reduces the usage count of a mac tree node smart pointer
- *
- * @param macNode mac tree node to free
- *
- * Reduces the usage count of the given mac node. If the usage count
- * reaches 0 the node is freed back into the pool using ixEthDBPoolFreeMacTreeNode()
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBFreeMacTreeNode(MacTreeNode *macNode)
-{
- if (macNode->descriptor != NULL)
- {
- ixEthDBFreeMacDescriptor(macNode->descriptor);
- }
-
- if (macNode->left != NULL)
- {
- ixEthDBFreeMacTreeNode(macNode->left);
- }
-
- if (macNode->right != NULL)
- {
- ixEthDBFreeMacTreeNode(macNode->right);
- }
-
- ixEthDBPoolFreeMacTreeNode(macNode);
-}
-
-/**
- * @brief clones a mac tree node
- *
- * @param macNode mac tree node to be cloned
- *
- * Increments the usage count of the node, <i>its associated descriptor
- * and <b>recursively</b> of all its child nodes</i>.
- *
- * @warning this function is recursive and clones whole trees/subtrees, use only for
- * root nodes
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-MacTreeNode* ixEthDBCloneMacTreeNode(MacTreeNode *macNode)
-{
- if (macNode != NULL)
- {
- MacTreeNode *clonedMacNode = ixEthDBAllocMacTreeNode();
-
- if (clonedMacNode != NULL)
- {
- if (macNode->right != NULL)
- {
- clonedMacNode->right = ixEthDBCloneMacTreeNode(macNode->right);
- }
-
- if (macNode->left != NULL)
- {
- clonedMacNode->left = ixEthDBCloneMacTreeNode(macNode->left);
- }
-
- if (macNode->descriptor != NULL)
- {
- clonedMacNode->descriptor = ixEthDBCloneMacDescriptor(macNode->descriptor);
- }
- }
-
- return clonedMacNode;
- }
- else
- {
- return NULL;
- }
-}
-
-#ifndef NDEBUG
-/* Debug statistical functions for memory usage */
-
-extern HashTable dbHashtable;
-int ixEthDBNumHashElements(void);
-
-int ixEthDBNumHashElements(void)
-{
- UINT32 bucketIndex;
- int numElements = 0;
- HashTable *hashTable = &dbHashtable;
-
- for (bucketIndex = 0 ; bucketIndex < hashTable->numBuckets ; bucketIndex++)
- {
- if (hashTable->hashBuckets[bucketIndex] != NULL)
- {
- HashNode *node = hashTable->hashBuckets[bucketIndex];
-
- while (node != NULL)
- {
- numElements++;
-
- node = node->next;
- }
- }
- }
-
- return numElements;
-}
-
-UINT32 ixEthDBSearchTreeUsageGet(MacTreeNode *tree)
-{
- if (tree == NULL)
- {
- return 0;
- }
- else
- {
- return 1 /* this node */ + ixEthDBSearchTreeUsageGet(tree->left) + ixEthDBSearchTreeUsageGet(tree->right);
- }
-}
-
-int ixEthDBShowMemoryStatus(void)
-{
- MacDescriptor *mac;
- MacTreeNode *tree;
- HashNode *node;
-
- int macCounter = 0;
- int treeCounter = 0;
- int nodeCounter = 0;
-
- int totalTreeUsage = 0;
- int totalDescriptorUsage = 0;
- int totalCloneDescriptorUsage = 0;
- int totalNodeUsage = 0;
-
- UINT32 portIndex;
-
- LOCK_NODE_POOL;
- LOCK_MAC_POOL;
- LOCK_TREE_POOL;
-
- mac = macPool;
- tree = treePool;
- node = nodePool;
-
- while (mac != NULL)
- {
- macCounter++;
-
- mac = mac->nextFree;
-
- if (macCounter > MAC_POOL_SIZE)
- {
- break;
- }
- }
-
- while (tree != NULL)
- {
- treeCounter++;
-
- tree = tree->nextFree;
-
- if (treeCounter > TREE_POOL_SIZE)
- {
- break;
- }
- }
-
- while (node != NULL)
- {
- nodeCounter++;
-
- node = node->nextFree;
-
- if (nodeCounter > NODE_POOL_SIZE)
- {
- break;
- }
- }
-
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- int treeUsage = ixEthDBSearchTreeUsageGet(ixEthDBPortInfo[portIndex].updateMethod.searchTree);
-
- totalTreeUsage += treeUsage;
- totalCloneDescriptorUsage += treeUsage; /* each tree node contains a descriptor */
- }
-
- totalNodeUsage = ixEthDBNumHashElements();
- totalDescriptorUsage += totalNodeUsage; /* each hash table entry contains a descriptor */
-
- UNLOCK_NODE_POOL;
- UNLOCK_MAC_POOL;
- UNLOCK_TREE_POOL;
-
- printf("Ethernet database memory usage stats:\n\n");
-
- if (macCounter <= MAC_POOL_SIZE)
- {
- printf("\tMAC descriptor pool : %d free out of %d entries (%d%%)\n", macCounter, MAC_POOL_SIZE, macCounter * 100 / MAC_POOL_SIZE);
- }
- else
- {
- printf("\tMAC descriptor pool : invalid state (ring within the pool), normally %d entries\n", MAC_POOL_SIZE);
- }
-
- if (treeCounter <= TREE_POOL_SIZE)
- {
- printf("\tTree node pool : %d free out of %d entries (%d%%)\n", treeCounter, TREE_POOL_SIZE, treeCounter * 100 / TREE_POOL_SIZE);
- }
- else
- {
- printf("\tTREE descriptor pool : invalid state (ring within the pool), normally %d entries\n", TREE_POOL_SIZE);
- }
-
- if (nodeCounter <= NODE_POOL_SIZE)
- {
- printf("\tHash node pool : %d free out of %d entries (%d%%)\n", nodeCounter, NODE_POOL_SIZE, nodeCounter * 100 / NODE_POOL_SIZE);
- }
- else
- {
- printf("\tNODE descriptor pool : invalid state (ring within the pool), normally %d entries\n", NODE_POOL_SIZE);
- }
-
- printf("\n");
- printf("\tMAC descriptor usage : %d entries, %d cloned\n", totalDescriptorUsage, totalCloneDescriptorUsage);
- printf("\tTree node usage : %d entries\n", totalTreeUsage);
- printf("\tHash node usage : %d entries\n", totalNodeUsage);
- printf("\n");
-
- /* search for duplicate nodes in the mac pool */
- {
- MacDescriptor *reference = macPool;
-
- while (reference != NULL)
- {
- MacDescriptor *comparison = reference->nextFree;
-
- while (comparison != NULL)
- {
- if (reference == comparison)
- {
- printf("Warning: reached a duplicate (%p), invalid MAC pool state\n", reference);
-
- return 1;
- }
-
- comparison = comparison->nextFree;
- }
-
- reference = reference->nextFree;
- }
- }
-
- printf("No duplicates found in the MAC pool (sanity check ok)\n");
-
- return 0;
-}
-
-#endif /* NDEBUG */
-
-/**
- * @} EthMemoryManagement
- */
diff --git a/cpu/ixp/npe/IxEthDBNPEAdaptor.c b/cpu/ixp/npe/IxEthDBNPEAdaptor.c
deleted file mode 100644
index 112a46c998..0000000000
--- a/cpu/ixp/npe/IxEthDBNPEAdaptor.c
+++ /dev/null
@@ -1,719 +0,0 @@
-/**
- * @file IxEthDBDBNPEAdaptor.c
- *
- * @brief Routines that read and write learning/search trees in NPE-specific format
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxEthDB_p.h"
-#include "IxEthDBLog_p.h"
-
-/* forward prototype declarations */
-IX_ETH_DB_PUBLIC void ixEthDBELTShow(IxEthDBPortId portID);
-IX_ETH_DB_PUBLIC void ixEthDBShowNpeMsgHistory(void);
-
-/* data */
-UINT8* ixEthDBNPEUpdateArea[IX_ETH_DB_NUMBER_OF_PORTS];
-UINT32 dumpEltSize;
-
-/* private data */
-IX_ETH_DB_PRIVATE IxEthDBNoteWriteFn ixEthDBNPENodeWrite[IX_ETH_DB_MAX_RECORD_TYPE_INDEX + 1];
-
-#define IX_ETH_DB_MAX_DELTA_ZONES (6) /* at most 6 EP Delta zones, according to NPE FS */
-IX_ETH_DB_PRIVATE UINT32 ixEthDBEPDeltaOffset[IX_ETH_DB_MAX_RECORD_TYPE_INDEX + 1][IX_ETH_DB_MAX_DELTA_ZONES];
-IX_ETH_DB_PRIVATE UINT32 ixEthDBEPDelta[IX_ETH_DB_MAX_RECORD_TYPE_INDEX + 1][IX_ETH_DB_MAX_DELTA_ZONES];
-
-/**
- * @brief allocates non-cached or contiguous NPE tree update areas for all the ports
- *
- * This function is called only once at initialization time from
- * @ref ixEthDBInit().
- *
- * @warning do not call manually
- *
- * @see ixEthDBInit()
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBNPEUpdateAreasInit(void)
-{
- UINT32 portIndex;
- PortUpdateMethod *update;
-
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- update = &ixEthDBPortInfo[portIndex].updateMethod;
-
- if (ixEthDBPortDefinitions[portIndex].type == IX_ETH_NPE)
- {
- update->npeUpdateZone = IX_OSAL_CACHE_DMA_MALLOC(FULL_ELT_BYTE_SIZE);
- update->npeGwUpdateZone = IX_OSAL_CACHE_DMA_MALLOC(FULL_GW_BYTE_SIZE);
- update->vlanUpdateZone = IX_OSAL_CACHE_DMA_MALLOC(FULL_VLAN_BYTE_SIZE);
-
- if (update->npeUpdateZone == NULL
- || update->npeGwUpdateZone == NULL
- || update->vlanUpdateZone == NULL)
- {
- ERROR_LOG("Fatal error: IX_ACC_DRV_DMA_MALLOC() returned NULL, no NPE update zones available\n");
- }
- else
- {
- memset(update->npeUpdateZone, 0, FULL_ELT_BYTE_SIZE);
- memset(update->npeGwUpdateZone, 0, FULL_GW_BYTE_SIZE);
- memset(update->vlanUpdateZone, 0, FULL_VLAN_BYTE_SIZE);
- }
- }
- else
- {
- /* unused */
- update->npeUpdateZone = NULL;
- update->npeGwUpdateZone = NULL;
- update->vlanUpdateZone = NULL;
- }
- }
-}
-
-/**
- * @brief deallocates the NPE update areas for all the ports
- *
- * This function is called at component de-initialization time
- * by @ref ixEthDBUnload().
- *
- * @warning do not call manually
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBNPEUpdateAreasUnload(void)
-{
- UINT32 portIndex;
-
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- if (ixEthDBPortDefinitions[portIndex].type == IX_ETH_NPE)
- {
- IX_OSAL_CACHE_DMA_FREE(ixEthDBPortInfo[portIndex].updateMethod.npeUpdateZone);
- IX_OSAL_CACHE_DMA_FREE(ixEthDBPortInfo[portIndex].updateMethod.npeGwUpdateZone);
- IX_OSAL_CACHE_DMA_FREE(ixEthDBPortInfo[portIndex].updateMethod.vlanUpdateZone);
- }
- }
-}
-
-/**
- * @brief general-purpose NPE callback function
- *
- * @param npeID NPE ID
- * @param msg NPE message
- *
- * This function will unblock the caller by unlocking
- * the npeAckLock mutex defined for each NPE port
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBNpeMsgAck(IxNpeMhNpeId npeID, IxNpeMhMessage msg)
-{
- IxEthDBPortId portID = IX_ETH_DB_NPE_TO_PORT_ID(npeID);
- PortInfo *portInfo;
-
- if (portID >= IX_ETH_DB_NUMBER_OF_PORTS)
- {
- /* invalid port */
- return;
- }
-
- if (ixEthDBPortDefinitions[portID].type != IX_ETH_NPE)
- {
- /* not an NPE */
- return;
- }
-
- portInfo = &ixEthDBPortInfo[portID];
-
- ixOsalMutexUnlock(&portInfo->npeAckLock);
-}
-
-/**
- * @brief synchronizes the database with tree
- *
- * @param portID port ID of the NPE whose tree is to be scanned
- * @param eltBaseAddress memory base address of the NPE serialized tree
- * @param eltSize size in bytes of the NPE serialized tree
- *
- * Scans the NPE learning tree and resets the age of active database records.
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBNPESyncScan(IxEthDBPortId portID, void *eltBaseAddress, UINT32 eltSize)
-{
- UINT32 eltEntryOffset;
- UINT32 entryPortID;
-
- /* invalidate cache */
- IX_OSAL_CACHE_INVALIDATE(eltBaseAddress, eltSize);
-
- for (eltEntryOffset = ELT_ROOT_OFFSET ; eltEntryOffset < eltSize ; eltEntryOffset += ELT_ENTRY_SIZE)
- {
- /* (eltBaseAddress + eltEntryOffset) points to a valid NPE tree node
- *
- * the format of the node is MAC[6 bytes]:PortID[1 byte]:Reserved[6 bits]:Active[1 bit]:Valid[1 bit]
- * therefore we can just use the pointer for database searches as only the first 6 bytes are checked
- */
- void *eltNodeAddress = (void *) ((UINT32) eltBaseAddress + eltEntryOffset);
-
- /* debug */
- IX_ETH_DB_NPE_VERBOSE_TRACE("DB: (NPEAdaptor) checking node at offset %d...\n", eltEntryOffset / ELT_ENTRY_SIZE);
-
- if (IX_EDB_NPE_NODE_VALID(eltNodeAddress) != TRUE)
- {
- IX_ETH_DB_NPE_VERBOSE_TRACE("\t... node is empty\n");
- }
- else if (eltEntryOffset == ELT_ROOT_OFFSET)
- {
- IX_ETH_DB_NPE_VERBOSE_TRACE("\t... node is root\n");
- }
-
- if (IX_EDB_NPE_NODE_VALID(eltNodeAddress))
- {
- entryPortID = IX_ETH_DB_NPE_LOGICAL_ID_TO_PORT_ID(IX_EDB_NPE_NODE_PORT_ID(eltNodeAddress));
-
- /* check only active entries belonging to this port */
- if (ixEthDBPortInfo[portID].agingEnabled && IX_EDB_NPE_NODE_ACTIVE(eltNodeAddress) && (portID == entryPortID)
- && ((ixEthDBPortDefinitions[portID].capabilities & IX_ETH_ENTRY_AGING) == 0))
- {
- /* search record */
- HashNode *node = ixEthDBSearch((IxEthDBMacAddr *) eltNodeAddress, IX_ETH_DB_ALL_FILTERING_RECORDS);
-
- /* safety check, maybe user deleted record right before sync? */
- if (node != NULL)
- {
- /* found record */
- MacDescriptor *descriptor = (MacDescriptor *) node->data;
-
- IX_ETH_DB_NPE_VERBOSE_TRACE("DB: (NPEAdaptor) synced entry [%s] already in the database, updating fields\n", mac2string(eltNodeAddress));
-
- /* reset age - set to -1 so that maintenance will restore it to 0 (or more) when incrementing */
- if (!descriptor->recordData.filteringData.staticEntry)
- {
- if (descriptor->type == IX_ETH_DB_FILTERING_RECORD)
- {
- descriptor->recordData.filteringData.age = AGE_RESET;
- }
- else if (descriptor->type == IX_ETH_DB_FILTERING_VLAN_RECORD)
- {
- descriptor->recordData.filteringVlanData.age = AGE_RESET;
- }
- }
-
- /* end transaction */
- ixEthDBReleaseHashNode(node);
- }
- }
- else
- {
- IX_ETH_DB_NPE_VERBOSE_TRACE("\t... found portID %d, we check only port %d\n", entryPortID, portID);
- }
- }
- }
-}
-
-/**
- * @brief writes a search tree in NPE format
- *
- * @param type type of records to be written into the NPE update zone
- * @param totalSize maximum size of the linearized tree
- * @param baseAddress memory base address where to write the NPE tree into
- * @param tree search tree to write in NPE format
- * @param blocks number of written 64-byte blocks
- * @param startIndex optimal binary search start index
- *
- * Serializes the given tree in NPE linear format
- *
- * @return none
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBNPETreeWrite(IxEthDBRecordType type, UINT32 totalSize, void *baseAddress, MacTreeNode *tree, UINT32 *epDelta, UINT32 *blocks)
-{
- MacTreeNodeStack *stack;
- UINT32 maxOffset = 0;
- UINT32 emptyOffset;
-
- stack = ixOsalCacheDmaMalloc(sizeof (MacTreeNodeStack));
-
- if (stack == NULL)
- {
- ERROR_LOG("DB: (NPEAdaptor) failed to allocate the node stack for learning tree linearization, out of memory?\n");
- return;
- }
-
- /* zero out empty root */
- memset(baseAddress, 0, ELT_ENTRY_SIZE);
-
- NODE_STACK_INIT(stack);
-
- if (tree != NULL)
- {
- /* push tree root at offset 1 */
- NODE_STACK_PUSH(stack, tree, 1);
-
- maxOffset = 1;
- }
-
- while (NODE_STACK_NONEMPTY(stack))
- {
- MacTreeNode *node;
- UINT32 offset;
-
- NODE_STACK_POP(stack, node, offset);
-
- /* update maximum offset */
- if (offset > maxOffset)
- {
- maxOffset = offset;
- }
-
- IX_ETH_DB_NPE_VERBOSE_TRACE("DB: (NPEAdaptor) writing MAC [%s] at offset %d\n", mac2string(node->descriptor->macAddress), offset);
-
- /* add node to NPE ELT at position indicated by offset */
- if (offset < MAX_ELT_SIZE)
- {
- ixEthDBNPENodeWrite[type]((void *) (((UINT32) baseAddress) + offset * ELT_ENTRY_SIZE), node);
- }
-
- if (node->left != NULL)
- {
- NODE_STACK_PUSH(stack, node->left, LEFT_CHILD_OFFSET(offset));
- }
- else
- {
- /* ensure this entry is zeroed */
- memset((void *) ((UINT32) baseAddress + LEFT_CHILD_OFFSET(offset) * ELT_ENTRY_SIZE), 0, ELT_ENTRY_SIZE);
- }
-
- if (node->right != NULL)
- {
- NODE_STACK_PUSH(stack, node->right, RIGHT_CHILD_OFFSET(offset));
- }
- else
- {
- /* ensure this entry is zeroed */
- memset((void *) ((UINT32) baseAddress + RIGHT_CHILD_OFFSET(offset) * ELT_ENTRY_SIZE), 0, ELT_ENTRY_SIZE);
- }
- }
-
- emptyOffset = maxOffset + 1;
-
- /* zero out rest of the tree */
- IX_ETH_DB_NPE_TRACE("DB: (NPEAdaptor) Emptying tree from offset %d, address 0x%08X, %d bytes\n",
- emptyOffset, ((UINT32) baseAddress) + emptyOffset * ELT_ENTRY_SIZE, totalSize - (emptyOffset * ELT_ENTRY_SIZE));
-
- if (emptyOffset < MAX_ELT_SIZE - 1)
- {
- memset((void *) (((UINT32) baseAddress) + (emptyOffset * ELT_ENTRY_SIZE)), 0, totalSize - (emptyOffset * ELT_ENTRY_SIZE));
- }
-
- /* flush cache */
- IX_OSAL_CACHE_FLUSH(baseAddress, totalSize);
-
- /* debug */
- IX_ETH_DB_NPE_TRACE("DB: (NPEAdaptor) Ethernet learning/filtering tree XScale wrote at address 0x%08X (max %d bytes):\n\n",
- (UINT32) baseAddress, FULL_ELT_BYTE_SIZE);
-
- IX_ETH_DB_NPE_DUMP_ELT(baseAddress, FULL_ELT_BYTE_SIZE);
-
- /* compute number of 64-byte blocks */
- if (blocks != NULL)
- {
- *blocks = maxOffset != 0 ? 1 + maxOffset / 8 : 0;
-
- IX_ETH_DB_NPE_TRACE("DB: (NPEAdaptor) Wrote %d 64-byte blocks\n", *blocks);
- }
-
- /* compute epDelta - start index for binary search */
- if (epDelta != NULL)
- {
- UINT32 deltaIndex = 0;
-
- *epDelta = 0;
-
- for (; deltaIndex < IX_ETH_DB_MAX_DELTA_ZONES ; deltaIndex ++)
- {
- if (ixEthDBEPDeltaOffset[type][deltaIndex] >= maxOffset)
- {
- *epDelta = ixEthDBEPDelta[type][deltaIndex];
- break;
- }
- }
-
- IX_ETH_DB_NPE_TRACE("DB: (NPEAdaptor) Computed epDelta %d (based on maxOffset %d)\n", *epDelta, maxOffset);
- }
-
- ixOsalCacheDmaFree(stack);
-}
-
-/**
- * @brief implements a dummy node serialization function
- *
- * @param address address of where the node is to be serialized (unused)
- * @param node tree node to be serialized (unused)
- *
- * This function is registered for safety reasons and should
- * never be called. It will display an error message if this
- * function is called.
- *
- * @return none
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBNullSerialize(void *address, MacTreeNode *node)
-{
- IX_ETH_DB_NPE_TRACE("DB: (NPEAdaptor) Warning, the NullSerialize function was called, wrong record type?\n");
-}
-
-/**
- * @brief writes a filtering entry in NPE linear format
- *
- * @param address memory address to write node to
- * @param node node to be written
- *
- * Used by @ref ixEthDBNPETreeWrite to liniarize a search tree
- * in NPE-readable format.
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBNPELearningNodeWrite(void *address, MacTreeNode *node)
-{
- /* copy mac address */
- memcpy(address, node->descriptor->macAddress, IX_IEEE803_MAC_ADDRESS_SIZE);
-
- /* copy port ID */
- NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_ELT_PORT_ID_OFFSET) = IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(node->descriptor->portID);
-
- /* copy flags (valid and not active, as the NPE sets it to active) and clear reserved section (bits 2-7) */
- NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_ELT_FLAGS_OFFSET) = (UINT8) IX_EDB_FLAGS_INACTIVE_VALID;
-
- IX_ETH_DB_NPE_VERBOSE_TRACE("DB: (NPEAdaptor) writing ELT node 0x%08x:0x%08x\n", * (UINT32 *) address, * (((UINT32 *) (address)) + 1));
-}
-
-/**
- * @brief writes a WiFi header conversion record in
- * NPE linear format
- *
- * @param address memory address to write node to
- * @param node node to be written
- *
- * Used by @ref ixEthDBNPETreeWrite to liniarize a search tree
- * in NPE-readable format.
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBNPEWiFiNodeWrite(void *address, MacTreeNode *node)
-{
- /* copy mac address */
- memcpy(address, node->descriptor->macAddress, IX_IEEE803_MAC_ADDRESS_SIZE);
-
- /* copy index */
- NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_WIFI_INDEX_OFFSET) = node->descriptor->recordData.wifiData.gwAddressIndex;
-
- /* copy flags (type and valid) */
- NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_WIFI_FLAGS_OFFSET) = node->descriptor->recordData.wifiData.type << 1 | IX_EDB_FLAGS_VALID;
-}
-
-/**
- * @brief writes a WiFi gateway header conversion record in
- * NPE linear format
- *
- * @param address memory address to write node to
- * @param node node to be written
- *
- * Used by @ref ixEthDBNPETreeWrite to liniarize a search tree
- * in NPE-readable format.
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBNPEGatewayNodeWrite(void *address, MacTreeNode *node)
-{
- /* copy mac address */
- memcpy(address, node->descriptor->recordData.wifiData.gwMacAddress, IX_IEEE803_MAC_ADDRESS_SIZE);
-
- /* set reserved field, two bytes */
- NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_FW_RESERVED_OFFSET) = 0;
- NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_FW_RESERVED_OFFSET + 1) = 0;
-}
-
-/**
- * @brief writes a firewall record in
- * NPE linear format
- *
- * @param address memory address to write node to
- * @param node node to be written
- *
- * Used by @ref ixEthDBNPETreeWrite to liniarize a search tree
- * in NPE-readable format.
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBNPEFirewallNodeWrite(void *address, MacTreeNode *node)
-{
- /* set reserved field */
- NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_FW_RESERVED_OFFSET) = 0;
-
- /* set flags */
- NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_FW_FLAGS_OFFSET) = IX_EDB_FLAGS_VALID;
-
- /* copy mac address */
- memcpy((void *) ((UINT32) address + IX_EDB_NPE_NODE_FW_ADDR_OFFSET), node->descriptor->macAddress, IX_IEEE803_MAC_ADDRESS_SIZE);
-}
-
-/**
- * @brief registers the NPE serialization methods
- *
- * This functions registers NPE serialization methods
- * for writing the following types of records in NPE
- * readable linear format:
- * - filtering records
- * - WiFi header conversion records
- * - WiFi gateway header conversion records
- * - firewall records
- *
- * Note that this function should be called by the
- * component initialization function.
- *
- * @return number of registered record types
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-UINT32 ixEthDBRecordSerializeMethodsRegister()
-{
- int i;
-
- /* safety - register a blank method for everybody first */
- for ( i = 0 ; i < IX_ETH_DB_MAX_RECORD_TYPE_INDEX + 1 ; i++)
- {
- ixEthDBNPENodeWrite[i] = ixEthDBNullSerialize;
- }
-
- /* register real methods */
- ixEthDBNPENodeWrite[IX_ETH_DB_FILTERING_RECORD] = ixEthDBNPELearningNodeWrite;
- ixEthDBNPENodeWrite[IX_ETH_DB_FILTERING_VLAN_RECORD] = ixEthDBNPELearningNodeWrite;
- ixEthDBNPENodeWrite[IX_ETH_DB_WIFI_RECORD] = ixEthDBNPEWiFiNodeWrite;
- ixEthDBNPENodeWrite[IX_ETH_DB_FIREWALL_RECORD] = ixEthDBNPEFirewallNodeWrite;
- ixEthDBNPENodeWrite[IX_ETH_DB_GATEWAY_RECORD] = ixEthDBNPEGatewayNodeWrite;
-
- /* EP Delta arrays */
- memset(ixEthDBEPDeltaOffset, 0, sizeof (ixEthDBEPDeltaOffset));
- memset(ixEthDBEPDelta, 0, sizeof (ixEthDBEPDelta));
-
- /* filtering records */
- ixEthDBEPDeltaOffset[IX_ETH_DB_FILTERING_RECORD][0] = 1;
- ixEthDBEPDelta[IX_ETH_DB_FILTERING_RECORD][0] = 0;
-
- ixEthDBEPDeltaOffset[IX_ETH_DB_FILTERING_RECORD][1] = 3;
- ixEthDBEPDelta[IX_ETH_DB_FILTERING_RECORD][1] = 7;
-
- ixEthDBEPDeltaOffset[IX_ETH_DB_FILTERING_RECORD][2] = 511;
- ixEthDBEPDelta[IX_ETH_DB_FILTERING_RECORD][2] = 14;
-
- /* wifi records */
- ixEthDBEPDeltaOffset[IX_ETH_DB_WIFI_RECORD][0] = 1;
- ixEthDBEPDelta[IX_ETH_DB_WIFI_RECORD][0] = 0;
-
- ixEthDBEPDeltaOffset[IX_ETH_DB_WIFI_RECORD][1] = 3;
- ixEthDBEPDelta[IX_ETH_DB_WIFI_RECORD][1] = 7;
-
- ixEthDBEPDeltaOffset[IX_ETH_DB_WIFI_RECORD][2] = 511;
- ixEthDBEPDelta[IX_ETH_DB_WIFI_RECORD][2] = 14;
-
- /* firewall records */
- ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][0] = 0;
- ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][0] = 0;
-
- ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][1] = 1;
- ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][1] = 5;
-
- ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][2] = 3;
- ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][2] = 13;
-
- ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][3] = 7;
- ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][3] = 21;
-
- ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][4] = 15;
- ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][4] = 29;
-
- ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][5] = 31;
- ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][5] = 37;
-
- return 5; /* 5 methods registered */
-}
-
-#ifndef IX_NDEBUG
-
-IX_ETH_DB_PUBLIC UINT32 npeMsgHistory[IX_ETH_DB_NPE_MSG_HISTORY_DEPTH][2];
-IX_ETH_DB_PUBLIC UINT32 npeMsgHistoryLen = 0;
-
-/**
- * When compiled in DEBUG mode, this function can be used to display
- * the history of messages sent to the NPEs (up to 100).
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBShowNpeMsgHistory()
-{
- UINT32 i = 0;
- UINT32 base, len;
-
- if (npeMsgHistoryLen <= IX_ETH_DB_NPE_MSG_HISTORY_DEPTH)
- {
- base = 0;
- len = npeMsgHistoryLen;
- }
- else
- {
- base = npeMsgHistoryLen % IX_ETH_DB_NPE_MSG_HISTORY_DEPTH;
- len = IX_ETH_DB_NPE_MSG_HISTORY_DEPTH;
- }
-
- printf("NPE message history [last %d messages, from least to most recent]:\n", len);
-
- for (; i < len ; i++)
- {
- UINT32 pos = (base + i) % IX_ETH_DB_NPE_MSG_HISTORY_DEPTH;
- printf("msg[%d]: 0x%08x:0x%08x\n", i, npeMsgHistory[pos][0], npeMsgHistory[pos][1]);
- }
-}
-
-IX_ETH_DB_PUBLIC
-void ixEthDBELTShow(IxEthDBPortId portID)
-{
- IxNpeMhMessage message;
- IX_STATUS result;
-
- /* send EDB_GetMACAddressDatabase message */
- FILL_GETMACADDRESSDATABASE(message,
- 0 /* reserved */,
- IX_OSAL_MMU_VIRT_TO_PHYS(ixEthDBPortInfo[portID].updateMethod.npeUpdateZone));
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- if (result == IX_SUCCESS)
- {
- /* analyze NPE copy */
- UINT32 eltEntryOffset;
- UINT32 entryPortID;
-
- UINT32 eltBaseAddress = (UINT32) ixEthDBPortInfo[portID].updateMethod.npeUpdateZone;
- UINT32 eltSize = FULL_ELT_BYTE_SIZE;
-
- /* invalidate cache */
- IX_OSAL_CACHE_INVALIDATE((void *) eltBaseAddress, eltSize);
-
- printf("Listing records in main learning tree for port %d\n", portID);
-
- for (eltEntryOffset = ELT_ROOT_OFFSET ; eltEntryOffset < eltSize ; eltEntryOffset += ELT_ENTRY_SIZE)
- {
- /* (eltBaseAddress + eltEntryOffset) points to a valid NPE tree node
- *
- * the format of the node is MAC[6 bytes]:PortID[1 byte]:Reserved[6 bits]:Active[1 bit]:Valid[1 bit]
- * therefore we can just use the pointer for database searches as only the first 6 bytes are checked
- */
- void *eltNodeAddress = (void *) ((UINT32) eltBaseAddress + eltEntryOffset);
-
- if (IX_EDB_NPE_NODE_VALID(eltNodeAddress))
- {
- HashNode *node;
-
- entryPortID = IX_ETH_DB_NPE_LOGICAL_ID_TO_PORT_ID(IX_EDB_NPE_NODE_PORT_ID(eltNodeAddress));
-
- /* search record */
- node = ixEthDBSearch((IxEthDBMacAddr *) eltNodeAddress, IX_ETH_DB_ALL_RECORD_TYPES);
-
- printf("%s - port %d - %s ", mac2string((unsigned char *) eltNodeAddress), entryPortID,
- IX_EDB_NPE_NODE_ACTIVE(eltNodeAddress) ? "active" : "inactive");
-
- /* safety check, maybe user deleted record right before sync? */
- if (node != NULL)
- {
- /* found record */
- MacDescriptor *descriptor = (MacDescriptor *) node->data;
-
- printf("- %s ",
- descriptor->type == IX_ETH_DB_FILTERING_RECORD ? "filtering" :
- descriptor->type == IX_ETH_DB_FILTERING_VLAN_RECORD ? "vlan" :
- descriptor->type == IX_ETH_DB_WIFI_RECORD ? "wifi" : "other (check main DB)");
-
- if (descriptor->type == IX_ETH_DB_FILTERING_RECORD) printf("- age %d - %s ",
- descriptor->recordData.filteringData.age,
- descriptor->recordData.filteringData.staticEntry ? "static" : "dynamic");
-
- if (descriptor->type == IX_ETH_DB_FILTERING_VLAN_RECORD) printf("- age %d - %s - tci %d ",
- descriptor->recordData.filteringVlanData.age,
- descriptor->recordData.filteringVlanData.staticEntry ? "static" : "dynamic",
- descriptor->recordData.filteringVlanData.ieee802_1qTag);
-
- /* end transaction */
- ixEthDBReleaseHashNode(node);
- }
- else
- {
- printf("- not synced");
- }
-
- printf("\n");
- }
- }
- }
- else
- {
- ixOsalLog(IX_OSAL_LOG_LVL_FATAL, IX_OSAL_LOG_DEV_STDOUT,
- "EthDB: (ShowELT) Could not complete action (communication failure)\n",
- portID, 0, 0, 0, 0, 0);
- }
-}
-
-#endif
diff --git a/cpu/ixp/npe/IxEthDBPortUpdate.c b/cpu/ixp/npe/IxEthDBPortUpdate.c
deleted file mode 100644
index cdf114bfc4..0000000000
--- a/cpu/ixp/npe/IxEthDBPortUpdate.c
+++ /dev/null
@@ -1,740 +0,0 @@
-/**
- * @file IxEthDBDBPortUpdate.c
- *
- * @brief Implementation of dependency and port update handling
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxEthDB_p.h"
-
-/* forward prototype declarations */
-IX_ETH_DB_PRIVATE MacTreeNode* ixEthDBTreeInsert(MacTreeNode *searchTree, MacDescriptor *descriptor);
-IX_ETH_DB_PRIVATE void ixEthDBCreateTrees(IxEthDBPortMap updatePorts);
-IX_ETH_DB_PRIVATE MacTreeNode* ixEthDBTreeRebalance(MacTreeNode *searchTree);
-IX_ETH_DB_PRIVATE void ixEthDBRebalanceTreeToVine(MacTreeNode *root, UINT32 *size);
-IX_ETH_DB_PRIVATE void ixEthDBRebalanceVineToTree(MacTreeNode *root, UINT32 size);
-IX_ETH_DB_PRIVATE void ixEthDBRebalanceCompression(MacTreeNode *root, UINT32 count);
-IX_ETH_DB_PRIVATE UINT32 ixEthDBRebalanceLog2Floor(UINT32 x);
-
-extern HashTable dbHashtable;
-
-/**
- * @brief register types requiring automatic updates
- *
- * @param typeArray array indexed on record types, each
- * element indicating whether the record type requires an
- * automatic update (TRUE) or not (FALSE)
- *
- * Automatic updates are done for registered record types
- * upon adding, updating (that is, updating the record portID)
- * and removing records. Whenever an automatic update is triggered
- * the appropriate ports will be provided with new database
- * information.
- *
- * It is assumed that the typeArray parameter is allocated large
- * enough to hold all the user defined types. Also, the type
- * array should be initialized to FALSE as this function only
- * caters for types which do require automatic updates.
- *
- * Note that this function should be called by the component
- * initialization function.
- *
- * @return number of record types registered for automatic
- * updates
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-UINT32 ixEthDBUpdateTypeRegister(BOOL *typeArray)
-{
- typeArray[IX_ETH_DB_FILTERING_RECORD] = TRUE;
- typeArray[IX_ETH_DB_FILTERING_VLAN_RECORD] = TRUE;
-
- return 2;
-}
-
-/**
- * @brief computes dependencies and triggers port learning tree updates
- *
- * @param triggerPorts port map consisting in the ports which triggered the update
- *
- * This function browses through all the ports and determines how to waterfall the update
- * event from the trigger ports to all other ports depending on them.
- *
- * Once the list of ports to be updated is determined this function
- * calls @ref ixEthDBCreateTrees.
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBUpdatePortLearningTrees(IxEthDBPortMap triggerPorts)
-{
- IxEthDBPortMap updatePorts;
- UINT32 portIndex;
-
- ixEthDBUpdateLock();
-
- SET_EMPTY_DEPENDENCY_MAP(updatePorts);
-
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- PortInfo *port = &ixEthDBPortInfo[portIndex];
- BOOL mapsCollide;
-
- MAPS_COLLIDE(mapsCollide, triggerPorts, port->dependencyPortMap);
-
- if (mapsCollide /* do triggers influence this port? */
- && !IS_PORT_INCLUDED(portIndex, updatePorts) /* and it's not already in the update list */
- && port->updateMethod.updateEnabled) /* and we're allowed to update it */
- {
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) Adding port %d to update set\n", portIndex);
-
- JOIN_PORT_TO_MAP(updatePorts, portIndex);
- }
- else
- {
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) Didn't add port %d to update set, reasons follow:\n", portIndex);
-
- if (!mapsCollide)
- {
- IX_ETH_DB_UPDATE_TRACE("\tMaps don't collide on port %d\n", portIndex);
- }
-
- if (IS_PORT_INCLUDED(portIndex, updatePorts))
- {
- IX_ETH_DB_UPDATE_TRACE("\tPort %d is already in the update set\n", portIndex);
- }
-
- if (!port->updateMethod.updateEnabled)
- {
- IX_ETH_DB_UPDATE_TRACE("\tPort %d doesn't have updateEnabled set\n", portIndex);
- }
- }
- }
-
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) Updating port set\n");
-
- ixEthDBCreateTrees(updatePorts);
-
- ixEthDBUpdateUnlock();
-}
-
-/**
- * @brief creates learning trees and calls the port update handlers
- *
- * @param updatePorts set of ports in need of learning trees
- *
- * This function determines the optimal method of creating learning
- * trees using a minimal number of database queries, keeping in mind
- * that different ports can either use the same learning trees or they
- * can partially share them. The actual tree building routine is
- * @ref ixEthDBQuery.
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBCreateTrees(IxEthDBPortMap updatePorts)
-{
- UINT32 portIndex;
- BOOL result;
- BOOL portsLeft = TRUE;
-
- while (portsLeft)
- {
- /* get port with minimal dependency map and NULL search tree */
- UINT32 minPortIndex = MAX_PORT_SIZE;
- UINT32 minimalSize = MAX_PORT_SIZE;
-
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- UINT32 size;
- PortInfo *port = &ixEthDBPortInfo[portIndex];
-
- /* generate trees only for ports that need them */
- if (!port->updateMethod.searchTreePendingWrite && IS_PORT_INCLUDED(portIndex, updatePorts))
- {
- GET_MAP_SIZE(port->dependencyPortMap, size);
-
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) Dependency map for port %d: size %d\n",
- portIndex, size);
-
- if (size < minimalSize)
- {
- minPortIndex = portIndex;
- minimalSize = size;
- }
- }
- else
- {
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) Skipped port %d from tree diff (%s)\n", portIndex,
- port->updateMethod.searchTreePendingWrite ? "pending write access" : "ignored by query");
- }
- }
-
- /* if a port was found than minimalSize is not MAX_PORT_SIZE */
- if (minimalSize != MAX_PORT_SIZE)
- {
- /* minPortIndex is the port we seek */
- PortInfo *port = &ixEthDBPortInfo[minPortIndex];
-
- IxEthDBPortMap query;
- MacTreeNode *baseTree;
-
- /* now try to find a port with minimal map difference */
- PortInfo *minimalDiffPort = NULL;
- UINT32 minimalDiff = MAX_PORT_SIZE;
-
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) Minimal size port is %d\n", minPortIndex);
-
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- PortInfo *diffPort = &ixEthDBPortInfo[portIndex];
- BOOL mapIsSubset;
-
- IS_MAP_SUBSET(mapIsSubset, diffPort->dependencyPortMap, port->dependencyPortMap);
-
-
- if (portIndex != minPortIndex
- && diffPort->updateMethod.searchTree != NULL
- && mapIsSubset)
- {
- /* compute size and pick only minimal size difference */
- UINT32 diffPortSize;
- UINT32 sizeDifference;
-
- GET_MAP_SIZE(diffPort->dependencyPortMap, diffPortSize);
-
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) Checking port %d for differences...\n", portIndex);
-
- sizeDifference = minimalSize - diffPortSize;
-
- if (sizeDifference < minimalDiff)
- {
- minimalDiffPort = diffPort;
- minimalDiff = sizeDifference;
-
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) Minimal difference 0x%x was found on port %d\n",
- minimalDiff, portIndex);
- }
- }
- }
-
- /* check if filtering is enabled on this port */
- if ((port->featureStatus & IX_ETH_DB_FILTERING) != 0)
- {
- /* if minimalDiff is not MAX_PORT_SIZE minimalDiffPort points to the most similar port */
- if (minimalDiff != MAX_PORT_SIZE)
- {
- baseTree = ixEthDBCloneMacTreeNode(minimalDiffPort->updateMethod.searchTree);
- DIFF_MAPS(query, port->dependencyPortMap , minimalDiffPort->dependencyPortMap);
-
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) Found minimal diff, extending tree %d on query\n",
- minimalDiffPort->portID);
- }
- else /* .. otherwise no similar port was found, build tree from scratch */
- {
- baseTree = NULL;
-
- COPY_DEPENDENCY_MAP(query, port->dependencyPortMap);
-
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) No similar diff, creating tree from query\n");
- }
-
- IS_EMPTY_DEPENDENCY_MAP(result, query);
-
- if (!result) /* otherwise we don't need anything more on top of the cloned tree */
- {
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) Adding query tree to port %d\n", minPortIndex);
-
- /* build learning tree */
- port->updateMethod.searchTree = ixEthDBQuery(baseTree, query, IX_ETH_DB_ALL_FILTERING_RECORDS, MAX_ELT_SIZE);
- }
- else
- {
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) Query is empty, assuming identical nearest tree\n");
-
- port->updateMethod.searchTree = baseTree;
- }
- }
- else
- {
- /* filtering is not enabled, will download an empty tree */
- if (port->updateMethod.searchTree != NULL)
- {
- ixEthDBFreeMacTreeNode(port->updateMethod.searchTree);
- }
-
- port->updateMethod.searchTree = NULL;
- }
-
- /* mark tree as valid */
- port->updateMethod.searchTreePendingWrite = TRUE;
- }
- else
- {
- portsLeft = FALSE;
-
- IX_ETH_DB_UPDATE_TRACE("DB: (Update) No trees to create this round\n");
- }
- }
-
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- PortInfo *updatePort = &ixEthDBPortInfo[portIndex];
-
- if (updatePort->updateMethod.searchTreePendingWrite)
- {
- IX_ETH_DB_UPDATE_TRACE("DB: (PortUpdate) Starting procedure to upload new search tree (%snull) into NPE %d\n",
- updatePort->updateMethod.searchTree != NULL ? "not " : "",
- portIndex);
-
- updatePort->updateMethod.updateHandler(portIndex, IX_ETH_DB_FILTERING_RECORD);
- }
- }
-}
-
-/**
- * @brief standard NPE update handler
- *
- * @param portID id of the port to be updated
- * @param type record type to be pushed during this update
- *
- * The NPE update handler manages updating the NPE databases
- * given a certain record type.
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBNPEUpdateHandler(IxEthDBPortId portID, IxEthDBRecordType type)
-{
- UINT32 epDelta, blockCount;
- IxNpeMhMessage message;
- UINT32 treeSize = 0;
- PortInfo *port = &ixEthDBPortInfo[portID];
-
- /* size selection and type check */
- if (type == IX_ETH_DB_FILTERING_RECORD || type == IX_ETH_DB_WIFI_RECORD)
- {
- treeSize = FULL_ELT_BYTE_SIZE;
- }
- else if (type == IX_ETH_DB_FIREWALL_RECORD)
- {
- treeSize = FULL_FW_BYTE_SIZE;
- }
- else
- {
- return IX_ETH_DB_INVALID_ARG;
- }
-
- /* serialize tree into memory */
- ixEthDBNPETreeWrite(type, treeSize, port->updateMethod.npeUpdateZone, port->updateMethod.searchTree, &epDelta, &blockCount);
-
- /* free internal copy */
- if (port->updateMethod.searchTree != NULL)
- {
- ixEthDBFreeMacTreeNode(port->updateMethod.searchTree);
- }
-
- /* forget last used search tree */
- port->updateMethod.searchTree = NULL;
- port->updateMethod.searchTreePendingWrite = FALSE;
-
- /* dependending on the update type we do different things */
- if (type == IX_ETH_DB_FILTERING_RECORD || type == IX_ETH_DB_WIFI_RECORD)
- {
- IX_STATUS result;
-
- FILL_SETMACADDRESSDATABASE_MSG(message, IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID),
- epDelta, blockCount,
- IX_OSAL_MMU_VIRT_TO_PHYS(port->updateMethod.npeUpdateZone));
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- if (result == IX_SUCCESS)
- {
- IX_ETH_DB_UPDATE_TRACE("DB: (PortUpdate) Finished downloading NPE tree on port %d\n", portID);
- }
- else
- {
- ixEthDBPortInfo[portID].agingEnabled = FALSE;
- ixEthDBPortInfo[portID].updateMethod.updateEnabled = FALSE;
- ixEthDBPortInfo[portID].updateMethod.userControlled = TRUE;
-
- ERROR_LOG("EthDB: (PortUpdate) disabling aging and updates on port %d (assumed dead)\n", portID);
-
- ixEthDBDatabaseClear(portID, IX_ETH_DB_ALL_RECORD_TYPES);
-
- return IX_ETH_DB_FAIL;
- }
-
- return IX_ETH_DB_SUCCESS;
- }
- else if (type == IX_ETH_DB_FIREWALL_RECORD)
- {
- return ixEthDBFirewallUpdate(portID, port->updateMethod.npeUpdateZone, epDelta);
- }
-
- return IX_ETH_DB_INVALID_ARG;
-}
-
-/**
- * @brief queries the database for a set of records to be inserted into a given tree
- *
- * @param searchTree pointer to a tree where insertions will be performed; can be NULL
- * @param query set of ports that a database record must match to be inserted into the tree
- *
- * The query method browses through the database, extracts all the descriptors matching
- * the given query parameter and inserts them into the given learning tree.
- * Note that this is an append procedure, the given tree needs not to be empty.
- * A "descriptor matching the query" is a descriptor whose port id is in the query map.
- * If the given tree is empty (NULL) a new tree is created and returned.
- *
- * @return the tree root
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-MacTreeNode* ixEthDBQuery(MacTreeNode *searchTree, IxEthDBPortMap query, IxEthDBRecordType recordFilter, UINT32 maxEntries)
-{
- HashIterator iterator;
- UINT32 entryCount = 0;
-
- /* browse database */
- BUSY_RETRY(ixEthDBInitHashIterator(&dbHashtable, &iterator));
-
- while (IS_ITERATOR_VALID(&iterator))
- {
- MacDescriptor *descriptor = (MacDescriptor *) iterator.node->data;
-
- IX_ETH_DB_UPDATE_TRACE("DB: (PortUpdate) querying [%s]:%d on port map ... ",
- mac2string(descriptor->macAddress),
- descriptor->portID);
-
- if ((descriptor->type & recordFilter) != 0
- && IS_PORT_INCLUDED(descriptor->portID, query))
- {
- MacDescriptor *descriptorClone = ixEthDBCloneMacDescriptor(descriptor);
-
- IX_ETH_DB_UPDATE_TRACE("match\n");
-
- if (descriptorClone != NULL)
- {
- /* add descriptor to tree */
- searchTree = ixEthDBTreeInsert(searchTree, descriptorClone);
-
- entryCount++;
- }
- }
- else
- {
- IX_ETH_DB_UPDATE_TRACE("no match\n");
- }
-
- if (entryCount < maxEntries)
- {
- /* advance to the next record */
- BUSY_RETRY(ixEthDBIncrementHashIterator(&dbHashtable, &iterator));
- }
- else
- {
- /* the NPE won't accept more entries so we can stop now */
- ixEthDBReleaseHashIterator(&iterator);
-
- IX_ETH_DB_UPDATE_TRACE("DB: (PortUpdate) number of elements reached maximum supported by port\n");
-
- break;
- }
- }
-
- IX_ETH_DB_UPDATE_TRACE("DB: (PortUpdate) query inserted %d records in the search tree\n", entryCount);
-
- return ixEthDBTreeRebalance(searchTree);
-}
-
-/**
- * @brief inserts a mac descriptor into an tree
- *
- * @param searchTree tree where the insertion is to be performed (may be NULL)
- * @param descriptor descriptor to insert into tree
- *
- * @return the tree root
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-MacTreeNode* ixEthDBTreeInsert(MacTreeNode *searchTree, MacDescriptor *descriptor)
-{
- MacTreeNode *currentNode = searchTree;
- MacTreeNode *insertLocation = NULL;
- MacTreeNode *newNode;
- INT32 insertPosition = RIGHT;
-
- if (descriptor == NULL)
- {
- return searchTree;
- }
-
- /* create a new node */
- newNode = ixEthDBAllocMacTreeNode();
-
- if (newNode == NULL)
- {
- /* out of memory */
- ERROR_LOG("Warning: ixEthDBAllocMacTreeNode returned NULL in file %s:%d (out of memory?)\n", __FILE__, __LINE__);
-
- ixEthDBFreeMacDescriptor(descriptor);
-
- return NULL;
- }
-
- /* populate node */
- newNode->descriptor = descriptor;
-
- /* an empty initial tree is a special case */
- if (searchTree == NULL)
- {
- return newNode;
- }
-
- /* get insertion location */
- while (insertLocation == NULL)
- {
- MacTreeNode *nextNode;
-
- /* compare given key with current node key */
- insertPosition = ixEthDBAddressCompare(descriptor->macAddress, currentNode->descriptor->macAddress);
-
- /* navigate down */
- if (insertPosition == RIGHT)
- {
- nextNode = currentNode->right;
- }
- else if (insertPosition == LEFT)
- {
- nextNode = currentNode->left;
- }
- else
- {
- /* error, duplicate key */
- ERROR_LOG("Warning: trapped insertion of a duplicate MAC address in an NPE search tree\n");
-
- /* this will free the MAC descriptor as well */
- ixEthDBFreeMacTreeNode(newNode);
-
- return searchTree;
- }
-
- /* when we can no longer dive through the tree we found the insertion place */
- if (nextNode != NULL)
- {
- currentNode = nextNode;
- }
- else
- {
- insertLocation = currentNode;
- }
- }
-
- /* insert node */
- if (insertPosition == RIGHT)
- {
- insertLocation->right = newNode;
- }
- else
- {
- insertLocation->left = newNode;
- }
-
- return searchTree;
-}
-
-/**
- * @brief balance a tree
- *
- * @param searchTree tree to balance
- *
- * Converts a tree into a balanced tree and returns the root of
- * the balanced tree. The resulting tree is <i>route balanced</i>
- * not <i>perfectly balanced</i>. This makes no difference to the
- * average tree search time which is the same in both cases, O(log2(n)).
- *
- * @return root of the balanced tree or NULL if there's no memory left
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-MacTreeNode* ixEthDBTreeRebalance(MacTreeNode *searchTree)
-{
- MacTreeNode *pseudoRoot = ixEthDBAllocMacTreeNode();
- UINT32 size;
-
- if (pseudoRoot == NULL)
- {
- /* out of memory */
- return NULL;
- }
-
- pseudoRoot->right = searchTree;
-
- ixEthDBRebalanceTreeToVine(pseudoRoot, &size);
- ixEthDBRebalanceVineToTree(pseudoRoot, size);
-
- searchTree = pseudoRoot->right;
-
- /* remove pseudoRoot right branch, otherwise it will free the entire tree */
- pseudoRoot->right = NULL;
-
- ixEthDBFreeMacTreeNode(pseudoRoot);
-
- return searchTree;
-}
-
-/**
- * @brief converts a tree into a vine
- *
- * @param root root of tree to convert
- * @param size depth of vine (equal to the number of nodes in the tree)
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBRebalanceTreeToVine(MacTreeNode *root, UINT32 *size)
-{
- MacTreeNode *vineTail = root;
- MacTreeNode *remainder = vineTail->right;
- MacTreeNode *tempPtr;
-
- *size = 0;
-
- while (remainder != NULL)
- {
- if (remainder->left == NULL)
- {
- /* move tail down one */
- vineTail = remainder;
- remainder = remainder->right;
- (*size)++;
- }
- else
- {
- /* rotate around remainder */
- tempPtr = remainder->left;
- remainder->left = tempPtr->right;
- tempPtr->right = remainder;
- remainder = tempPtr;
- vineTail->right = tempPtr;
- }
- }
-}
-
-/**
- * @brief converts a vine into a balanced tree
- *
- * @param root vine to convert
- * @param size depth of vine
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBRebalanceVineToTree(MacTreeNode *root, UINT32 size)
-{
- UINT32 leafCount = size + 1 - (1 << ixEthDBRebalanceLog2Floor(size + 1));
-
- ixEthDBRebalanceCompression(root, leafCount);
-
- size = size - leafCount;
-
- while (size > 1)
- {
- ixEthDBRebalanceCompression(root, size / 2);
-
- size /= 2;
- }
-}
-
-/**
- * @brief compresses a vine/tree stage into a more balanced vine/tree
- *
- * @param root root of the tree to compress
- * @param count number of "spine" nodes
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBRebalanceCompression(MacTreeNode *root, UINT32 count)
-{
- MacTreeNode *scanner = root;
- MacTreeNode *child;
- UINT32 local_index;
-
- for (local_index = 0 ; local_index < count ; local_index++)
- {
- child = scanner->right;
- scanner->right = child->right;
- scanner = scanner->right;
- child->right = scanner->left;
- scanner->left = child;
- }
-}
-
-/**
- * @brief computes |_log2(x)_| (a.k.a. floor(log2(x)))
- *
- * @param x number to compute |_log2(x)_| for
- *
- * @return |_log2(x)_|
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-UINT32 ixEthDBRebalanceLog2Floor(UINT32 x)
-{
- UINT32 log = 0;
- UINT32 val = 1;
-
- while (val < x)
- {
- log++;
- val <<= 1;
- }
-
- return val == x ? log : log - 1;
-}
-
diff --git a/cpu/ixp/npe/IxEthDBReports.c b/cpu/ixp/npe/IxEthDBReports.c
deleted file mode 100644
index 9c7ae1cc6a..0000000000
--- a/cpu/ixp/npe/IxEthDBReports.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/**
- * @file IxEthDBAPI.c
- *
- * @brief Implementation of the public API
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxEthDB_p.h"
-
-extern HashTable dbHashtable;
-IX_ETH_DB_PRIVATE void ixEthDBPortInfoShow(IxEthDBPortId portID, IxEthDBRecordType recordFilter);
-IX_ETH_DB_PRIVATE IxEthDBStatus ixEthDBHeaderShow(IxEthDBRecordType recordFilter);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBDependencyPortMapShow(IxEthDBPortId portID, IxEthDBPortMap map);
-
-/**
- * @brief displays a port dependency map
- *
- * @param portID ID of the port
- * @param map port map to display
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBDependencyPortMapShow(IxEthDBPortId portID, IxEthDBPortMap map)
-{
- UINT32 portIndex;
- BOOL mapSelf = TRUE, mapNone = TRUE, firstPort = TRUE;
-
- /* dependency port maps */
- printf("Dependency port map: ");
-
- /* browse the port map */
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- if (IS_PORT_INCLUDED(portIndex, map))
- {
- mapNone = FALSE;
-
- if (portIndex != portID)
- {
- mapSelf = FALSE;
- }
-
- printf("%s%d", firstPort ? "{" : ", ", portIndex);
-
- firstPort = FALSE;
- }
- }
-
- if (mapNone)
- {
- mapSelf = FALSE;
- }
-
- printf("%s (%s)\n", firstPort ? "" : "}", mapSelf ? "self" : mapNone ? "none" : "group");
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief displays all the filtering records belonging to a port
- *
- * @param portID ID of the port to display
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @warning deprecated, use @ref ixEthDBFilteringDatabaseShowRecords()
- * instead. Calling this function is equivalent to calling
- * ixEthDBFilteringDatabaseShowRecords(portID, IX_ETH_DB_FILTERING_RECORD)
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringDatabaseShow(IxEthDBPortId portID)
-{
- IxEthDBStatus local_result;
- HashIterator iterator;
- PortInfo *portInfo;
- UINT32 recordCount = 0;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- portInfo = &ixEthDBPortInfo[portID];
-
- /* display table header */
- printf("Ethernet database records for port ID [%d]\n", portID);
-
- ixEthDBDependencyPortMapShow(portID, portInfo->dependencyPortMap);
-
- if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
- {
- printf("NPE updates are %s\n\n", portInfo->updateMethod.updateEnabled ? "enabled" : "disabled");
- }
- else
- {
- printf("updates disabled (not an NPE)\n\n");
- }
-
- printf(" MAC address | Age | Type \n");
- printf("___________________________________\n");
-
- /* browse database */
- BUSY_RETRY(ixEthDBInitHashIterator(&dbHashtable, &iterator));
-
- while (IS_ITERATOR_VALID(&iterator))
- {
- MacDescriptor *descriptor = (MacDescriptor *) iterator.node->data;
-
- if (descriptor->portID == portID && descriptor->type == IX_ETH_DB_FILTERING_RECORD)
- {
- recordCount++;
-
- /* display entry */
- printf(" %02X:%02X:%02X:%02X:%02X:%02X | %5d | %s\n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5],
- descriptor->recordData.filteringData.age,
- descriptor->recordData.filteringData.staticEntry ? "static" : "dynamic");
- }
-
- /* move to the next record */
- BUSY_RETRY_WITH_RESULT(ixEthDBIncrementHashIterator(&dbHashtable, &iterator), local_result);
-
- /* debug */
- if (local_result == IX_ETH_DB_BUSY)
- {
- return IX_ETH_DB_FAIL;
- }
- }
-
- /* display number of records */
- printf("\nFound %d records\n", recordCount);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief displays all the filtering records belonging to all the ports
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @warning deprecated, use @ref ixEthDBFilteringDatabaseShowRecords()
- * instead. Calling this function is equivalent to calling
- * ixEthDBFilteringDatabaseShowRecords(IX_ETH_DB_ALL_PORTS, IX_ETH_DB_FILTERING_RECORD)
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBFilteringDatabaseShowAll()
-{
- IxEthDBPortId portIndex;
-
- printf("\nEthernet learning/filtering database: listing %d ports\n\n", (UINT32) IX_ETH_DB_NUMBER_OF_PORTS);
-
- for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
- {
- ixEthDBFilteringDatabaseShow(portIndex);
-
- if (portIndex < IX_ETH_DB_NUMBER_OF_PORTS - 1)
- {
- printf("\n");
- }
- }
-}
-
-/**
- * @brief displays one record in a format depending on the record filter
- *
- * @param descriptor pointer to the record
- * @param recordFilter format filter
- *
- * This function will display the fields in a record depending on the
- * selected record filter.
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBRecordShow(MacDescriptor *descriptor, IxEthDBRecordType recordFilter)
-{
- if (recordFilter == IX_ETH_DB_FILTERING_VLAN_RECORD
- || recordFilter == (IX_ETH_DB_FILTERING_RECORD | IX_ETH_DB_FILTERING_VLAN_RECORD))
- {
- /* display VLAN record header - leave this commented code in place, its purpose is to align the print format with the header
- printf(" MAC address | Age | Type | VLAN ID | CFI | QoS class \n");
- printf("___________________________________________________________________\n"); */
-
- if (descriptor->type == IX_ETH_DB_FILTERING_VLAN_RECORD)
- {
- printf("%02X:%02X:%02X:%02X:%02X:%02X | %3d | %s | %d | %d | %d\n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5],
- descriptor->recordData.filteringVlanData.age,
- descriptor->recordData.filteringVlanData.staticEntry ? "static" : "dynamic",
- IX_ETH_DB_GET_VLAN_ID(descriptor->recordData.filteringVlanData.ieee802_1qTag),
- (descriptor->recordData.filteringVlanData.ieee802_1qTag & 0x1000) >> 12,
- IX_ETH_DB_GET_QOS_PRIORITY(descriptor->recordData.filteringVlanData.ieee802_1qTag));
- }
- else if (descriptor->type == IX_ETH_DB_FILTERING_RECORD)
- {
- printf("%02X:%02X:%02X:%02X:%02X:%02X | %3d | %s | - | - | -\n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5],
- descriptor->recordData.filteringData.age,
- descriptor->recordData.filteringData.staticEntry ? "static" : "dynamic");
- }
- }
- else if (recordFilter == IX_ETH_DB_FILTERING_RECORD)
- {
- /* display filtering record header - leave this commented code in place, its purpose is to align the print format with the header
- printf(" MAC address | Age | Type \n");
- printf("_______________________________________\n"); */
-
- if (descriptor->type == IX_ETH_DB_FILTERING_RECORD)
- {
- printf("%02X:%02X:%02X:%02X:%02X:%02X | %3d | %s \n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5],
- descriptor->recordData.filteringData.age,
- descriptor->recordData.filteringData.staticEntry ? "static" : "dynamic");
- }
- }
- else if (recordFilter == IX_ETH_DB_WIFI_RECORD)
- {
- /* display WiFi record header - leave this commented code in place, its purpose is to align the print format with the header
- printf(" MAC address | GW MAC address \n");
- printf("_______________________________________\n"); */
-
- if (descriptor->type == IX_ETH_DB_WIFI_RECORD)
- {
- if (descriptor->recordData.wifiData.type == IX_ETH_DB_WIFI_AP_TO_AP)
- {
- /* gateway address present */
- printf("%02X:%02X:%02X:%02X:%02X:%02X | %02X:%02X:%02X:%02X:%02X:%02X \n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5],
- descriptor->recordData.wifiData.gwMacAddress[0],
- descriptor->recordData.wifiData.gwMacAddress[1],
- descriptor->recordData.wifiData.gwMacAddress[2],
- descriptor->recordData.wifiData.gwMacAddress[3],
- descriptor->recordData.wifiData.gwMacAddress[4],
- descriptor->recordData.wifiData.gwMacAddress[5]);
- }
- else
- {
- /* no gateway */
- printf("%02X:%02X:%02X:%02X:%02X:%02X | ----no gateway----- \n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5]);
- }
- }
- }
- else if (recordFilter == IX_ETH_DB_FIREWALL_RECORD)
- {
- /* display Firewall record header - leave this commented code in place, its purpose is to align the print format with the header
- printf(" MAC address \n");
- printf("__________________\n"); */
-
- if (descriptor->type == IX_ETH_DB_FIREWALL_RECORD)
- {
- printf("%02X:%02X:%02X:%02X:%02X:%02X \n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5]);
- }
- }
- else if (recordFilter == IX_ETH_DB_ALL_RECORD_TYPES)
- {
- /* display composite record header - leave this commented code in place, its purpose is to align the print format with the header
- printf(" MAC address | Record | Age| Type | VLAN |CFI| QoS | GW MAC address \n");
- printf("_______________________________________________________________________________\n"); */
-
- if (descriptor->type == IX_ETH_DB_FILTERING_VLAN_RECORD)
- {
- printf("%02X:%02X:%02X:%02X:%02X:%02X | VLAN | %2d | %s | %4d | %1d | %1d | -----------------\n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5],
- descriptor->recordData.filteringVlanData.age,
- descriptor->recordData.filteringVlanData.staticEntry ? "static " : "dynamic",
- IX_ETH_DB_GET_VLAN_ID(descriptor->recordData.filteringVlanData.ieee802_1qTag),
- (descriptor->recordData.filteringVlanData.ieee802_1qTag & 0x1000) >> 12,
- IX_ETH_DB_GET_QOS_PRIORITY(descriptor->recordData.filteringVlanData.ieee802_1qTag));
- }
- else if (descriptor->type == IX_ETH_DB_FILTERING_RECORD)
- {
- printf("%02X:%02X:%02X:%02X:%02X:%02X | Filter | %2d | %s | ---- | - | --- | -----------------\n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5],
- descriptor->recordData.filteringData.age,
- descriptor->recordData.filteringData.staticEntry ? "static " : "dynamic");
- }
- else if (descriptor->type == IX_ETH_DB_WIFI_RECORD)
- {
- if (descriptor->recordData.wifiData.type == IX_ETH_DB_WIFI_AP_TO_AP)
- {
- /* gateway address present */
- printf("%02X:%02X:%02X:%02X:%02X:%02X | WiFi | -- | AP=>AP | ---- | - | --- | %02X:%02X:%02X:%02X:%02X:%02X\n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5],
- descriptor->recordData.wifiData.gwMacAddress[0],
- descriptor->recordData.wifiData.gwMacAddress[1],
- descriptor->recordData.wifiData.gwMacAddress[2],
- descriptor->recordData.wifiData.gwMacAddress[3],
- descriptor->recordData.wifiData.gwMacAddress[4],
- descriptor->recordData.wifiData.gwMacAddress[5]);
- }
- else
- {
- /* no gateway */
- printf("%02X:%02X:%02X:%02X:%02X:%02X | WiFi | -- | AP=>ST | ---- | - | --- | -- no gateway -- \n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5]);
- }
- }
- else if (descriptor->type == IX_ETH_DB_FIREWALL_RECORD)
- {
- printf("%02X:%02X:%02X:%02X:%02X:%02X | FW | -- | ------- | ---- | - | --- | -----------------\n",
- descriptor->macAddress[0],
- descriptor->macAddress[1],
- descriptor->macAddress[2],
- descriptor->macAddress[3],
- descriptor->macAddress[4],
- descriptor->macAddress[5]);
- }
- }
- else
- {
- printf("invalid record filter\n");
- }
-}
-
-/**
- * @brief displays the status, records and configuration information of a port
- *
- * @param portID ID of the port
- * @param recordFilter record filter to display
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBPortInfoShow(IxEthDBPortId portID, IxEthDBRecordType recordFilter)
-{
- PortInfo *portInfo = &ixEthDBPortInfo[portID];
- UINT32 recordCount = 0;
- HashIterator iterator;
- IxEthDBStatus local_result;
-
- /* display port status */
- printf("== Port ID %d ==\n", portID);
-
- /* display capabilities */
- printf("- Capabilities: ");
-
- if ((portInfo->featureCapability & IX_ETH_DB_LEARNING) != 0)
- {
- printf("Learning (%s) ", ((portInfo->featureStatus & IX_ETH_DB_LEARNING) != 0) ? "on" : "off");
- }
-
- if ((portInfo->featureCapability & IX_ETH_DB_VLAN_QOS) != 0)
- {
- printf("VLAN/QoS (%s) ", ((portInfo->featureStatus & IX_ETH_DB_VLAN_QOS) != 0) ? "on" : "off");
- }
-
- if ((portInfo->featureCapability & IX_ETH_DB_FIREWALL) != 0)
- {
- printf("Firewall (%s) ", ((portInfo->featureStatus & IX_ETH_DB_FIREWALL) != 0) ? "on" : "off");
- }
-
- if ((portInfo->featureCapability & IX_ETH_DB_WIFI_HEADER_CONVERSION) != 0)
- {
- printf("WiFi (%s) ", ((portInfo->featureStatus & IX_ETH_DB_WIFI_HEADER_CONVERSION) != 0) ? "on" : "off");
- }
-
- if ((portInfo->featureCapability & IX_ETH_DB_SPANNING_TREE_PROTOCOL) != 0)
- {
- printf("STP (%s) ", ((portInfo->featureStatus & IX_ETH_DB_SPANNING_TREE_PROTOCOL) != 0) ? "on" : "off");
- }
-
- printf("\n");
-
- /* dependency map */
- ixEthDBDependencyPortMapShow(portID, portInfo->dependencyPortMap);
-
- /* NPE dynamic updates */
- if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
- {
- printf(" - NPE dynamic update is %s\n", portInfo->updateMethod.updateEnabled ? "enabled" : "disabled");
- }
- else
- {
- printf(" - dynamic update disabled (not an NPE)\n");
- }
-
- if ((portInfo->featureCapability & IX_ETH_DB_WIFI_HEADER_CONVERSION) != 0)
- {
- if ((portInfo->featureStatus & IX_ETH_DB_WIFI_HEADER_CONVERSION) != 0)
- {
- /* WiFi header conversion */
- if ((portInfo->frameControlDurationID
- + portInfo->bbsid[0]
- + portInfo->bbsid[1]
- + portInfo->bbsid[2]
- + portInfo->bbsid[3]
- + portInfo->bbsid[4]
- + portInfo->bbsid[5]) == 0)
- {
- printf(" - WiFi header conversion not configured\n");
- }
- else
- {
- printf(" - WiFi header conversion: BBSID [%02X:%02X:%02X:%02X:%02X:%02X], Frame Control 0x%X, Duration/ID 0x%X\n",
- portInfo->bbsid[0],
- portInfo->bbsid[1],
- portInfo->bbsid[2],
- portInfo->bbsid[3],
- portInfo->bbsid[4],
- portInfo->bbsid[5],
- portInfo->frameControlDurationID >> 16,
- portInfo->frameControlDurationID & 0xFFFF);
- }
- }
- else
- {
- printf(" - WiFi header conversion not enabled\n");
- }
- }
-
- /* Firewall */
- if ((portInfo->featureCapability & IX_ETH_DB_FIREWALL) != 0)
- {
- if ((portInfo->featureStatus & IX_ETH_DB_FIREWALL) != 0)
- {
- printf(" - Firewall is in %s-list mode\n", portInfo->firewallMode == IX_ETH_DB_FIREWALL_BLACK_LIST ? "black" : "white");
- printf(" - Invalid source MAC address filtering is %s\n", portInfo->srcAddressFilterEnabled ? "enabled" : "disabled");
- }
- else
- {
- printf(" - Firewall not enabled\n");
- }
- }
-
- /* browse database if asked to display records */
- if (recordFilter != IX_ETH_DB_NO_RECORD_TYPE)
- {
- printf("\n");
- ixEthDBHeaderShow(recordFilter);
-
- BUSY_RETRY(ixEthDBInitHashIterator(&dbHashtable, &iterator));
-
- while (IS_ITERATOR_VALID(&iterator))
- {
- MacDescriptor *descriptor = (MacDescriptor *) iterator.node->data;
-
- if (descriptor->portID == portID && (descriptor->type & recordFilter) != 0)
- {
- recordCount++;
-
- /* display entry */
- ixEthDBRecordShow(descriptor, recordFilter);
- }
-
- /* move to the next record */
- BUSY_RETRY_WITH_RESULT(ixEthDBIncrementHashIterator(&dbHashtable, &iterator), local_result);
-
- /* debug */
- if (local_result == IX_ETH_DB_BUSY)
- {
- printf("EthDB (API): Error, database browser failed (no access), giving up\n");
- }
- }
-
- printf("\nFound %d records\n\n", recordCount);
- }
-}
-
-/**
- * @brief displays a record header
- *
- * @param recordFilter record type filter
- *
- * This function displays a record header, depending on
- * the given record type filter. It is useful when used
- * in conjunction with ixEthDBRecordShow which will display
- * record fields formatted for the header, provided the same
- * record filter is used.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or IX_ETH_DB_INVALID_ARG if the recordFilter
- * parameter is invalid or not supported
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-IxEthDBStatus ixEthDBHeaderShow(IxEthDBRecordType recordFilter)
-{
- if (recordFilter == IX_ETH_DB_FILTERING_VLAN_RECORD
- || recordFilter == (IX_ETH_DB_FILTERING_RECORD | IX_ETH_DB_FILTERING_VLAN_RECORD))
- {
- /* display VLAN record header */
- printf(" MAC address | Age | Type | VLAN ID | CFI | QoS class \n");
- printf("___________________________________________________________________\n");
- }
- else if (recordFilter == IX_ETH_DB_FILTERING_RECORD)
- {
- /* display filtering record header */
- printf(" MAC address | Age | Type \n");
- printf("_______________________________________\n");
- }
- else if (recordFilter == IX_ETH_DB_WIFI_RECORD)
- {
- /* display WiFi record header */
- printf(" MAC address | GW MAC address \n");
- printf("_______________________________________\n");
- }
- else if (recordFilter == IX_ETH_DB_FIREWALL_RECORD)
- {
- /* display Firewall record header */
- printf(" MAC address \n");
- printf("__________________\n");
- }
- else if (recordFilter == IX_ETH_DB_ALL_RECORD_TYPES)
- {
- /* display composite record header */
- printf(" MAC address | Record | Age| Type | VLAN |CFI| QoS | GW MAC address \n");
- printf("_______________________________________________________________________________\n");
- }
- else
- {
- return IX_ETH_DB_INVALID_ARG;
- }
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief displays database information (records and port information)
- *
- * @param portID ID of the port to display (or IX_ETH_DB_ALL_PORTS for all the ports)
- * @param recordFilter record filter (use IX_ETH_DB_NO_RECORD_TYPE to display only
- * port information)
- *
- * Note that this function is documented in the main component header
- * file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully or
- * an appropriate error code otherwise
- *
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringDatabaseShowRecords(IxEthDBPortId portID, IxEthDBRecordType recordFilter)
-{
- IxEthDBPortId currentPort;
- BOOL showAllPorts = (portID == IX_ETH_DB_ALL_PORTS);
-
- IX_ETH_DB_CHECK_PORT_ALL(portID);
-
- printf("\nEthernet learning/filtering database: listing %d port(s)\n\n", showAllPorts ? (UINT32) IX_ETH_DB_NUMBER_OF_PORTS : 1);
-
- currentPort = showAllPorts ? 0 : portID;
-
- while (currentPort != IX_ETH_DB_NUMBER_OF_PORTS)
- {
- /* display port info */
- ixEthDBPortInfoShow(currentPort, recordFilter);
-
- /* next port */
- currentPort = showAllPorts ? currentPort + 1 : IX_ETH_DB_NUMBER_OF_PORTS;
- }
-
- return IX_ETH_DB_SUCCESS;
-}
-
diff --git a/cpu/ixp/npe/IxEthDBSearch.c b/cpu/ixp/npe/IxEthDBSearch.c
deleted file mode 100644
index 4a10878b68..0000000000
--- a/cpu/ixp/npe/IxEthDBSearch.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/**
- * @file IxEthDBSearch.c
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxEthDB_p.h"
-
-extern HashTable dbHashtable;
-
-/**
- * @brief matches two database records based on their MAC addresses
- *
- * @param untypedReference record to match against
- * @param untypedEntry record to match
- *
- * @return TRUE if the match is successful or FALSE otherwise
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-BOOL ixEthDBAddressRecordMatch(void *untypedReference, void *untypedEntry)
-{
- MacDescriptor *entry = (MacDescriptor *) untypedEntry;
- MacDescriptor *reference = (MacDescriptor *) untypedReference;
-
- /* check accepted record types */
- if ((entry->type & reference->type) == 0) return FALSE;
-
- return (ixEthDBAddressCompare((UINT8 *) entry->macAddress, (UINT8 *) reference->macAddress) == 0);
-}
-
-/**
- * @brief matches two database records based on their MAC addresses
- * and VLAN IDs
- *
- * @param untypedReference record to match against
- * @param untypedEntry record to match
- *
- * @return TRUE if the match is successful or FALSE otherwise
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-BOOL ixEthDBVlanRecordMatch(void *untypedReference, void *untypedEntry)
-{
- MacDescriptor *entry = (MacDescriptor *) untypedEntry;
- MacDescriptor *reference = (MacDescriptor *) untypedReference;
-
- /* check accepted record types */
- if ((entry->type & reference->type) == 0) return FALSE;
-
- return (IX_ETH_DB_GET_VLAN_ID(entry->recordData.filteringVlanData.ieee802_1qTag) ==
- IX_ETH_DB_GET_VLAN_ID(reference->recordData.filteringVlanData.ieee802_1qTag)) &&
- (ixEthDBAddressCompare(entry->macAddress, reference->macAddress) == 0);
-}
-
-/**
- * @brief matches two database records based on their MAC addresses
- * and port IDs
- *
- * @param untypedReference record to match against
- * @param untypedEntry record to match
- *
- * @return TRUE if the match is successful or FALSE otherwise
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-BOOL ixEthDBPortRecordMatch(void *untypedReference, void *untypedEntry)
-{
- MacDescriptor *entry = (MacDescriptor *) untypedEntry;
- MacDescriptor *reference = (MacDescriptor *) untypedReference;
-
- /* check accepted record types */
- if ((entry->type & reference->type) == 0) return FALSE;
-
- return (entry->portID == reference->portID) &&
- (ixEthDBAddressCompare(entry->macAddress, reference->macAddress) == 0);
-}
-
-/**
- * @brief dummy matching function, registered for safety
- *
- * @param reference record to match against (unused)
- * @param entry record to match (unused)
- *
- * This function is registered in the matching functions
- * array on invalid types. Calling it will display an
- * error message, indicating an error in the component logic.
- *
- * @return FALSE
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-BOOL ixEthDBNullMatch(void *reference, void *entry)
-{
- /* display an error message */
-
- ixOsalLog(IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT, "DB: (Search) The NullMatch function was called, wrong key type?\n", 0, 0, 0, 0, 0, 0);
-
-
- return FALSE;
-}
-
-/**
- * @brief registers hash matching methods
- *
- * @param matchFunctions table of match functions to be populated
- *
- * This function registers the available record matching functions
- * by indexing them on record types into the given function array.
- *
- * Note that it is compulsory to call this in ixEthDBInit(),
- * otherwise hashtable searching and removal will not work
- *
- * @return number of registered functions
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-UINT32 ixEthDBMatchMethodsRegister(MatchFunction *matchFunctions)
-{
- UINT32 i;
-
- /* safety first */
- for ( i = 0 ; i < IX_ETH_DB_MAX_KEY_INDEX + 1 ; i++)
- {
- matchFunctions[i] = ixEthDBNullMatch;
- }
-
- /* register MAC search method */
- matchFunctions[IX_ETH_DB_MAC_KEY] = ixEthDBAddressRecordMatch;
-
- /* register MAC/PortID search method */
- matchFunctions[IX_ETH_DB_MAC_PORT_KEY] = ixEthDBPortRecordMatch;
-
- /* register MAC/VLAN ID search method */
- matchFunctions[IX_ETH_DB_MAC_VLAN_KEY] = ixEthDBVlanRecordMatch;
-
- return 3; /* three methods */
-}
-
-/**
- * @brief search a record in the Ethernet datbase
- *
- * @param macAddress MAC address to perform the search on
- * @param typeFilter type of records to consider for matching
- *
- * @warning if searching is successful an implicit write lock
- * to the search result is granted, therefore unlock the
- * entry using @ref ixEthDBReleaseHashNode() as soon as possible.
- *
- * @see ixEthDBReleaseHashNode()
- *
- * @return the search result, or NULL if a record with the given
- * MAC address was not found
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-HashNode* ixEthDBSearch(IxEthDBMacAddr *macAddress, IxEthDBRecordType typeFilter)
-{
- HashNode *searchResult = NULL;
- MacDescriptor reference;
-
- TEST_FIXTURE_INCREMENT_DB_CORE_ACCESS_COUNTER;
-
- if (macAddress == NULL)
- {
- return NULL;
- }
-
- /* fill search fields */
- memcpy(reference.macAddress, macAddress, sizeof (IxEthDBMacAddr));
-
- /* set acceptable record types */
- reference.type = typeFilter;
-
- BUSY_RETRY(ixEthDBSearchHashEntry(&dbHashtable, IX_ETH_DB_MAC_KEY, &reference, &searchResult));
-
- return searchResult;
-}
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPeek(IxEthDBMacAddr *macAddress, IxEthDBRecordType typeFilter)
-{
- MacDescriptor reference;
- IxEthDBStatus result;
-
- TEST_FIXTURE_INCREMENT_DB_CORE_ACCESS_COUNTER;
-
- if (macAddress == NULL)
- {
- return IX_ETH_DB_INVALID_ARG;
- }
-
- /* fill search fields */
- memcpy(reference.macAddress, macAddress, sizeof (IxEthDBMacAddr));
-
- /* set acceptable record types */
- reference.type = typeFilter;
-
- result = ixEthDBPeekHashEntry(&dbHashtable, IX_ETH_DB_MAC_KEY, &reference);
-
- return result;
-}
-
-/**
- * @brief search a record in the Ethernet datbase
- *
- * @param macAddress MAC address to perform the search on
- * @param portID port ID to perform the search on
- * @param typeFilter type of records to consider for matching
- *
- * @warning if searching is successful an implicit write lock
- * to the search result is granted, therefore unlock the
- * entry using @ref ixEthDBReleaseHashNode() as soon as possible.
- *
- * @see ixEthDBReleaseHashNode()
- *
- * @return the search result, or NULL if a record with the given
- * MAC address/port ID combination was not found
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-HashNode* ixEthDBPortSearch(IxEthDBMacAddr *macAddress, IxEthDBPortId portID, IxEthDBRecordType typeFilter)
-{
- HashNode *searchResult = NULL;
- MacDescriptor reference;
-
- if (macAddress == NULL)
- {
- return NULL;
- }
-
- /* fill search fields */
- memcpy(reference.macAddress, macAddress, sizeof (IxEthDBMacAddr));
- reference.portID = portID;
-
- /* set acceptable record types */
- reference.type = typeFilter;
-
- BUSY_RETRY(ixEthDBSearchHashEntry(&dbHashtable, IX_ETH_DB_MAC_PORT_KEY, &reference, &searchResult));
-
- return searchResult;
-}
-
-/**
- * @brief search a record in the Ethernet datbase
- *
- * @param macAddress MAC address to perform the search on
- * @param vlanID VLAN ID to perform the search on
- * @param typeFilter type of records to consider for matching
- *
- * @warning if searching is successful an implicit write lock
- * to the search result is granted, therefore unlock the
- * entry using @ref ixEthDBReleaseHashNode() as soon as possible.
- *
- * @see ixEthDBReleaseHashNode()
- *
- * @return the search result, or NULL if a record with the given
- * MAC address/VLAN ID combination was not found
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-HashNode* ixEthDBVlanSearch(IxEthDBMacAddr *macAddress, IxEthDBVlanId vlanID, IxEthDBRecordType typeFilter)
-{
- HashNode *searchResult = NULL;
- MacDescriptor reference;
-
- if (macAddress == NULL)
- {
- return NULL;
- }
-
- /* fill search fields */
- memcpy(reference.macAddress, macAddress, sizeof (IxEthDBMacAddr));
- reference.recordData.filteringVlanData.ieee802_1qTag =
- IX_ETH_DB_SET_VLAN_ID(reference.recordData.filteringVlanData.ieee802_1qTag, vlanID);
-
- /* set acceptable record types */
- reference.type = typeFilter;
-
- BUSY_RETRY(ixEthDBSearchHashEntry(&dbHashtable, IX_ETH_DB_MAC_VLAN_KEY, &reference, &searchResult));
-
- return searchResult;
-}
diff --git a/cpu/ixp/npe/IxEthDBSpanningTree.c b/cpu/ixp/npe/IxEthDBSpanningTree.c
deleted file mode 100644
index 6d9fd6ec18..0000000000
--- a/cpu/ixp/npe/IxEthDBSpanningTree.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * @file IxEthDBSpanningTree.c
- *
- * @brief Implementation of the STP API
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-#include "IxEthDB_p.h"
-
-/**
- * @brief sets the STP blocking state of a port
- *
- * @param portID ID of the port
- * @param blocked TRUE to block the port or FALSE to unblock it
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBSpanningTreeBlockingStateSet(IxEthDBPortId portID, BOOL blocked)
-{
- IxNpeMhMessage message;
- IX_STATUS result;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_SPANNING_TREE_PROTOCOL);
-
- ixEthDBPortInfo[portID].stpBlocked = blocked;
-
- FILL_SETBLOCKINGSTATE_MSG(message, portID, blocked);
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- return result;
-}
-
-/**
- * @brief retrieves the STP blocking state of a port
- *
- * @param portID ID of the port
- * @param blocked address to write the blocked status into
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBSpanningTreeBlockingStateGet(IxEthDBPortId portID, BOOL *blocked)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_SPANNING_TREE_PROTOCOL);
-
- IX_ETH_DB_CHECK_REFERENCE(blocked);
-
- *blocked = ixEthDBPortInfo[portID].stpBlocked;
-
- return IX_ETH_DB_SUCCESS;
-}
diff --git a/cpu/ixp/npe/IxEthDBUtil.c b/cpu/ixp/npe/IxEthDBUtil.c
deleted file mode 100644
index e708bf1bce..0000000000
--- a/cpu/ixp/npe/IxEthDBUtil.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * @file ethUtil.c
- *
- * @brief Utility functions
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-#include "IxFeatureCtrl.h"
-#include "IxEthDB_p.h"
-
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBSingleEthNpeCheck(IxEthDBPortId portID)
-{
- /* If not IXP42X A0 stepping, proceed to check for existence of coprocessors */
- if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
- (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
- || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
- {
- if ((portID == 0) &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH0) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- return IX_ETH_DB_FAIL;
- }
-
- if ((portID == 1) &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH1) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- return IX_ETH_DB_FAIL;
- }
-
- if ((portID == 2) &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA_ETH) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- return IX_ETH_DB_FAIL;
- }
- }
-
- return IX_ETH_DB_SUCCESS;
-}
-
-IX_ETH_DB_PUBLIC
-BOOL ixEthDBCheckSingleBitValue(UINT32 value)
-{
-#if (CPU != SIMSPARCSOLARIS) && !defined (__wince)
- UINT32 shift;
-
- /* use the count-leading-zeros XScale instruction */
- __asm__ ("clz %0, %1\n" : "=r" (shift) : "r" (value));
-
- return ((value << shift) == 0x80000000UL);
-
-#else
-
- while (value != 0)
- {
- if (value == 1) return TRUE;
- else if ((value & 1) == 1) return FALSE;
-
- value >>= 1;
- }
-
- return FALSE;
-
-#endif
-}
-
-const char *mac2string(const unsigned char *mac)
-{
- static char str[19];
-
- if (mac == NULL)
- {
- return NULL;
- }
-
- sprintf(str, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
-
- return str;
-}
diff --git a/cpu/ixp/npe/IxEthDBVlan.c b/cpu/ixp/npe/IxEthDBVlan.c
deleted file mode 100644
index e2efb9b339..0000000000
--- a/cpu/ixp/npe/IxEthDBVlan.c
+++ /dev/null
@@ -1,1179 +0,0 @@
-/**
- * @file IxEthDBVlan.c
- *
- * @brief Implementation of the VLAN API
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxEthDB.h"
-#include "IxEthDB_p.h"
-
-/* forward prototypes */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBUpdateTrafficClass(IxEthDBPortId portID, UINT32 classIndex);
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBVlanTableGet(IxEthDBPortId portID, IxEthDBVlanSet portVlanTable, IxEthDBVlanSet vlanSet);
-
-/* contants used by various functions as "action" parameter */
-#define ADD_VLAN (0x1)
-#define REMOVE_VLAN (0x2)
-
-/**
- * @brief adds or removes a VLAN from a VLAN set
- *
- * @param vlanID VLAN ID to add or remove
- * @param table VLAN set to add into or remove from
- * @param action ADD_VLAN or REMOVE_VLAN
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-void ixEthDBLocalVlanMembershipChange(UINT32 vlanID, IxEthDBVlanSet table, UINT32 action)
-{
- UINT32 setOffset;
-
- /* add/remove VID to membership table */
- setOffset = VLAN_SET_OFFSET(vlanID); /* we need 9 bits to index the 512 byte membership array */
-
- if (action == ADD_VLAN)
- {
- table[setOffset] |= 1 << VLAN_SET_MASK(vlanID);
- }
- else if (action == REMOVE_VLAN)
- {
- table[setOffset] &= ~(1 << VLAN_SET_MASK(vlanID));
- }
-}
-
-/**
- * @brief updates a set of 8 VLANs in an NPE
- *
- * @param portID ID of the port
- * @param setOffset offset of the 8 VLANs
- *
- * This function updates the VLAN membership table
- * and Transmit Tagging Info table for 8 consecutive
- * VLAN IDs indexed by setOffset.
- *
- * For example, a setOffset of 0 indexes VLAN IDs 0
- * through 7, 1 indexes VLAN IDs 8 through 9 etc.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-IxEthDBStatus ixEthDBVlanTableEntryUpdate(IxEthDBPortId portID, UINT32 setOffset)
-{
- PortInfo *portInfo = &ixEthDBPortInfo[portID];
- IxNpeMhMessage message;
- IX_STATUS result;
-
- FILL_SETPORTVLANTABLEENTRY_MSG(message, IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID),
- 2 * setOffset,
- portInfo->vlanMembership[setOffset],
- portInfo->transmitTaggingInfo[setOffset]);
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- return result;
-}
-
-/**
- * @brief updates a VLAN range in an NPE
- *
- * @param portID ID of the port
- *
- * This function is similar to @ref ixEthDBVlanTableEntryUpdate
- * except that it can update more than one VLAN set (up to
- * the entire VLAN membership and TTI tables if the offset is 0
- * and length is sizeof (IxEthDBVlanSet) (512 bytes).
- *
- * Updating the NPE via this method is slower as it requires
- * a memory copy from SDRAM, hence it is recommended that the
- * ixEthDBVlanTableEntryUpdate function is used where possible.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-IxEthDBStatus ixEthDBVlanTableRangeUpdate(IxEthDBPortId portID)
-{
- PortInfo *portInfo = &ixEthDBPortInfo[portID];
- UINT8 *vlanUpdateZone = (UINT8 *) portInfo->updateMethod.vlanUpdateZone;
- IxNpeMhMessage message;
- UINT32 setIndex;
- IX_STATUS result;
-
- /* copy membership info and transmit tagging into into exchange area */
- for (setIndex = 0 ; setIndex < sizeof (portInfo->vlanMembership) ; setIndex++)
- {
- /* membership and TTI data are interleaved */
- vlanUpdateZone[setIndex * 2] = portInfo->vlanMembership[setIndex];
- vlanUpdateZone[setIndex * 2 + 1] = portInfo->transmitTaggingInfo[setIndex];
- }
-
- IX_OSAL_CACHE_FLUSH(vlanUpdateZone, FULL_VLAN_BYTE_SIZE);
-
- /* build NPE message */
- FILL_SETPORTVLANTABLERANGE_MSG(message, IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID), 0, 0,
- IX_OSAL_MMU_VIRT_TO_PHYS(vlanUpdateZone));
-
- /* send message */
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- return result;
-}
-
-/**
- * @brief adds or removes a VLAN from a port's VLAN membership table
- * or Transmit Tagging Information table
- *
- * @param portID ID of the port
- * @param vlanID VLAN ID to add or remove
- * @param table to add or remove from
- * @param action ADD_VLAN or REMOVE_VLAN
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-IxEthDBStatus ixEthDBPortVlanMembershipChange(IxEthDBPortId portID, IxEthDBVlanId vlanID, IxEthDBVlanSet table, UINT32 action)
-{
- /* change VLAN in local membership table */
- ixEthDBLocalVlanMembershipChange(vlanID, table, action);
-
- /* send updated entry to NPE */
- return ixEthDBVlanTableEntryUpdate(portID, VLAN_SET_OFFSET(vlanID));
-}
-
-/**
- * @brief sets the default port VLAN tag (the lower 3 bytes are the PVID)
- *
- * @param portID ID of the port
- * @param vlanTag port VLAN tag (802.1Q tag)
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanTagSet(IxEthDBPortId portID, IxEthDBVlanTag vlanTag)
-{
- IxNpeMhMessage message;
- IX_STATUS result;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_VLAN_TAG(vlanTag);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- /* add VLAN ID to local membership table */
- ixEthDBPortVlanMembershipChange(portID,
- vlanTag & IX_ETH_DB_802_1Q_VLAN_MASK,
- ixEthDBPortInfo[portID].vlanMembership,
- ADD_VLAN);
-
- /* set tag in portInfo */
- ixEthDBPortInfo[portID].vlanTag = vlanTag;
-
- /* build VLAN_SetDefaultRxVID message */
- FILL_SETDEFAULTRXVID_MSG(message,
- IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID),
- IX_IEEE802_1Q_VLAN_TPID,
- vlanTag);
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- return result;
-}
-
-/**
- * @brief retrieves the default port VLAN tag (the lower 3 bytes are the PVID)
- *
- * @param portID ID of the port
- * @param vlanTag address to write the port VLAN tag (802.1Q tag) into
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanTagGet(IxEthDBPortId portID, IxEthDBVlanTag *vlanTag)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- IX_ETH_DB_CHECK_REFERENCE(vlanTag);
-
- *vlanTag = ixEthDBPortInfo[portID].vlanTag;
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief sets the VLAN tag (the lower 3 bytes are the PVID) of a
- * database filtering record
- *
- * @param portID ID of the port
- * @param vlanTag VLAN tag (802.1Q tag)
- *
- * Important: filtering records are automatically converted to
- * IX_ETH_DB_FILTERING_VLAN record when added a VLAN tag.
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBVlanTagSet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag vlanTag)
-{
- HashNode *searchResult;
- MacDescriptor *descriptor;
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- IX_ETH_DB_CHECK_VLAN_TAG(vlanTag);
-
- searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_ALL_FILTERING_RECORDS);
-
- if (searchResult == NULL)
- {
- return IX_ETH_DB_NO_SUCH_ADDR;
- }
-
- descriptor = (MacDescriptor *) searchResult->data;
-
- /* set record type to VLAN if not already set */
- descriptor->type = IX_ETH_DB_FILTERING_VLAN_RECORD;
-
- /* add vlan tag */
- descriptor->recordData.filteringVlanData.ieee802_1qTag = vlanTag;
-
- /* transaction completed */
- ixEthDBReleaseHashNode(searchResult);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief retrieves the VLAN tag (the lower 3 bytes are the PVID) from a
- * database VLAN filtering record
- *
- * @param portID ID of the port
- * @param vlanTag address to write the VLAN tag (802.1Q tag) into
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBVlanTagGet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag *vlanTag)
-{
- HashNode *searchResult;
- MacDescriptor *descriptor;
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- IX_ETH_DB_CHECK_REFERENCE(vlanTag);
-
- searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_FILTERING_VLAN_RECORD);
-
- if (searchResult == NULL)
- {
- return IX_ETH_DB_NO_SUCH_ADDR;
- }
-
- descriptor = (MacDescriptor *) searchResult->data;
-
- /* get vlan tag */
- *vlanTag = descriptor->recordData.filteringVlanData.ieee802_1qTag;
-
- /* transaction completed */
- ixEthDBReleaseHashNode(searchResult);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief adds a VLAN to a port's VLAN membership table
- *
- * @param portID ID of the port
- * @param vlanID VLAN ID to add
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipAdd(IxEthDBPortId portID, IxEthDBVlanId vlanID)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_VLAN_ID(vlanID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- return ixEthDBPortVlanMembershipChange(portID, vlanID, ixEthDBPortInfo[portID].vlanMembership, ADD_VLAN);
-}
-
-/**
- * @brief removes a VLAN from a port's VLAN membership table
- *
- * @param portID ID of the port
- * @param vlanID VLAN ID to remove
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipRemove(IxEthDBPortId portID, IxEthDBVlanId vlanID)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- IX_ETH_DB_CHECK_VLAN_ID(vlanID);
-
- /* for safety isolate only the VLAN ID in the tag (the lower 12 bits) */
- vlanID = vlanID & IX_ETH_DB_802_1Q_VLAN_MASK;
-
- /* check we're not asked to remove the default port VID */
- if (vlanID == IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag))
- {
- return IX_ETH_DB_NO_PERMISSION;
- }
-
- return ixEthDBPortVlanMembershipChange(portID, vlanID, ixEthDBPortInfo[portID].vlanMembership, REMOVE_VLAN);
-}
-
-/**
- * @brief adds or removes a VLAN range from a port's
- * VLAN membership table or TTI table
- *
- * @param portID ID of the port
- * @param vlanIDMin start of the VLAN range
- * @param vlanIDMax end of the VLAN range
- * @param table VLAN set to add or remove from
- * @param action ADD_VLAN or REMOVE_VLAN
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-IxEthDBStatus ixEthDBPortVlanMembershipRangeChange(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax, IxEthDBVlanSet table, UINT32 action)
-{
- UINT32 setOffsetMin, setOffsetMax;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- IX_ETH_DB_CHECK_VLAN_ID(vlanIDMin);
-
- IX_ETH_DB_CHECK_VLAN_ID(vlanIDMax);
-
- /* for safety isolate only the VLAN ID in the tags (the lower 12 bits) */
- vlanIDMin = vlanIDMin & IX_ETH_DB_802_1Q_VLAN_MASK;
- vlanIDMax = vlanIDMax & IX_ETH_DB_802_1Q_VLAN_MASK;
-
- /* is this a range? */
- if (vlanIDMax < vlanIDMin)
- {
- return IX_ETH_DB_INVALID_VLAN;
- }
-
- /* check that we're not specifically asked to remove the default port VID */
- if (action == REMOVE_VLAN && vlanIDMax == vlanIDMin && IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag) == vlanIDMin)
- {
- return IX_ETH_DB_NO_PERMISSION;
- }
-
- /* compute set offsets */
- setOffsetMin = VLAN_SET_OFFSET(vlanIDMin);
- setOffsetMax = VLAN_SET_OFFSET(vlanIDMax);
-
- /* change VLAN range */
- for (; vlanIDMin <= vlanIDMax ; vlanIDMin++)
- {
- /* change vlan in local membership table */
- ixEthDBLocalVlanMembershipChange(vlanIDMin, table, action);
- }
-
- /* if the range is within one set (max 8 VLANs in one table byte) we can just update that entry in the NPE */
- if (setOffsetMin == setOffsetMax)
- {
- /* send updated entry to NPE */
- return ixEthDBVlanTableEntryUpdate(portID, setOffsetMin);
- }
- else
- {
- /* update a zone of the membership/transmit tag info table */
- return ixEthDBVlanTableRangeUpdate(portID);
- }
-}
-
-/**
- * @brief adds a VLAN range to a port's VLAN membership table
- *
- * @param portID ID of the port
- * @param vlanIDMin start of the VLAN range
- * @param vlanIDMax end of the VLAN range
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipRangeAdd(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- return ixEthDBPortVlanMembershipRangeChange(portID, vlanIDMin, vlanIDMax, ixEthDBPortInfo[portID].vlanMembership, ADD_VLAN);
-}
-
-/**
- * @brief removes a VLAN range from a port's VLAN membership table
- *
- * @param portID ID of the port
- * @param vlanIDMin start of the VLAN range
- * @param vlanIDMax end of the VLAN range
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipRangeRemove(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- return ixEthDBPortVlanMembershipRangeChange(portID, vlanIDMin, vlanIDMax, ixEthDBPortInfo[portID].vlanMembership, REMOVE_VLAN);
-}
-
-/**
- * @brief sets a port's VLAN membership table or TTI table and
- * updates the NPE VLAN configuration
- *
- * @param portID ID of the port
- * @param portVlanTable port VLAN table to set
- * @param vlanSet new set contents
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanTableSet(IxEthDBPortId portID, IxEthDBVlanSet portVlanTable, IxEthDBVlanSet vlanSet)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- IX_ETH_DB_CHECK_REFERENCE(vlanSet);
-
- memcpy(portVlanTable, vlanSet, sizeof (IxEthDBVlanSet));
-
- return ixEthDBVlanTableRangeUpdate(portID);
-}
-
-/**
- * @brief retireves a port's VLAN membership table or TTI table
- *
- * @param portID ID of the port
- * @param portVlanTable port VLAN table to retrieve
- * @param vlanSet address to
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBVlanTableGet(IxEthDBPortId portID, IxEthDBVlanSet portVlanTable, IxEthDBVlanSet vlanSet)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- IX_ETH_DB_CHECK_REFERENCE(vlanSet);
-
- memcpy(vlanSet, portVlanTable, sizeof (IxEthDBVlanSet));
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief sets a port's VLAN membership table
- *
- * @param portID ID of the port
- * @param vlanSet new VLAN membership table
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipSet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
-{
- IxEthDBVlanId vlanID;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(vlanSet);
-
- /* set the bit corresponding to the PVID just in case */
- vlanID = IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag);
- vlanSet[VLAN_SET_OFFSET(vlanID)] |= 1 << VLAN_SET_MASK(vlanID);
-
- return ixEthDBPortVlanTableSet(portID, ixEthDBPortInfo[portID].vlanMembership, vlanSet);
-}
-
-/**
- * @brief retrieves a port's VLAN membership table
- *
- * @param portID ID of the port
- * @param vlanSet location to store the port's VLAN membership table
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- return ixEthDBVlanTableGet(portID, ixEthDBPortInfo[portID].vlanMembership, vlanSet);
-}
-
-/**
- * @brief enables or disables Egress tagging for one VLAN ID
- *
- * @param portID ID of the port
- * @param vlanID VLAN ID to enable or disable Egress tagging on
- * @param enabled TRUE to enable and FALSE to disable tagging
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL enabled)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_VLAN_ID(vlanID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- return ixEthDBPortVlanMembershipChange(portID, vlanID, ixEthDBPortInfo[portID].transmitTaggingInfo, enabled? ADD_VLAN : REMOVE_VLAN);
-}
-
-/**
- * @brief retrieves the Egress tagging status for one VLAN ID
- *
- * @param portID ID of the port
- * @param vlanID VLAN ID to retrieve the tagging status for
- * @param enabled location to store the tagging status
- * (TRUE - tagging enabled, FALSE - tagging disabled)
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL *enabled)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- IX_ETH_DB_CHECK_REFERENCE(enabled);
-
- IX_ETH_DB_CHECK_VLAN_ID(vlanID);
-
- *enabled = ((ixEthDBPortInfo[portID].transmitTaggingInfo[VLAN_SET_OFFSET(vlanID)] & (1 << VLAN_SET_MASK(vlanID))) != 0);
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief enables or disables Egress VLAN tagging for a VLAN range
- *
- * @param portID ID of the port
- * @param vlanIDMin start of VLAN range
- * @param vlanIDMax end of VLAN range
- * @param enabled TRUE to enable or FALSE to disable VLAN tagging
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBEgressVlanRangeTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax, BOOL enabled)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- return ixEthDBPortVlanMembershipRangeChange(portID, vlanIDMin, vlanIDMax, ixEthDBPortInfo[portID].transmitTaggingInfo, enabled? ADD_VLAN : REMOVE_VLAN);
-}
-
-/**
- * @brief sets the Egress VLAN tagging table (the Transmit Tagging
- * Information table)
- *
- * @param portID ID of the port
- * @param vlanSet new TTI table
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBEgressVlanTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
-{
- IxEthDBVlanId vlanID;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(vlanSet);
-
- /* set the PVID bit just in case */
- vlanID = IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag);
- vlanSet[VLAN_SET_OFFSET(vlanID)] |= 1 << VLAN_SET_MASK(vlanID);
-
- return ixEthDBPortVlanTableSet(portID, ixEthDBPortInfo[portID].transmitTaggingInfo, vlanSet);
-}
-
-/**
- * @brief retrieves the Egress VLAN tagging table (the Transmit
- * Tagging Information table)
- *
- * @param portID ID of the port
- * @param vlanSet location to store the port's TTI table
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBEgressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- return ixEthDBVlanTableGet(portID, ixEthDBPortInfo[portID].transmitTaggingInfo, vlanSet);
-}
-
-/**
- * @brief sends the NPE the updated frame filter and default
- * Ingress tagging
- *
- * @param portID ID of the port
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-IxEthDBStatus ixEthDBIngressVlanModeUpdate(IxEthDBPortId portID)
-{
- PortInfo *portInfo = &ixEthDBPortInfo[portID];
- IxNpeMhMessage message;
- IX_STATUS result;
-
- FILL_SETRXTAGMODE_MSG(message, portID, portInfo->npeFrameFilter, portInfo->npeTaggingAction);
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- return result;
-}
-
-/**
- * @brief sets the default Ingress tagging behavior
- *
- * @param portID ID of the port
- * @param taggingAction default tagging behavior
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBIngressVlanTaggingEnabledSet(IxEthDBPortId portID, IxEthDBTaggingAction taggingAction)
-{
- PortInfo *portInfo;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- portInfo = &ixEthDBPortInfo[portID];
-
- if (taggingAction == IX_ETH_DB_PASS_THROUGH)
- {
- portInfo->npeTaggingAction = 0x00;
- }
- else if (taggingAction == IX_ETH_DB_ADD_TAG)
- {
- portInfo->npeTaggingAction = 0x02;
- }
- else if (taggingAction == IX_ETH_DB_REMOVE_TAG)
- {
- portInfo->npeTaggingAction = 0x01;
- }
- else
- {
- return IX_ETH_DB_INVALID_ARG;
- }
-
- portInfo->taggingAction = taggingAction;
-
- return ixEthDBIngressVlanModeUpdate(portID);
-}
-
-/**
- * @brief retrieves the default Ingress tagging behavior of a port
- *
- * @param portID ID of the port
- * @param taggingAction location to save the default tagging behavior
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBIngressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBTaggingAction *taggingAction)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- IX_ETH_DB_CHECK_REFERENCE(taggingAction);
-
- *taggingAction = ixEthDBPortInfo[portID].taggingAction;
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief sets the Ingress acceptable frame type filter
- *
- * @param portID ID of the port
- * @param frameFilter acceptable frame type filter
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBAcceptableFrameTypeSet(IxEthDBPortId portID, IxEthDBFrameFilter frameFilter)
-{
- PortInfo *portInfo;
- IxEthDBStatus result = IX_ETH_DB_SUCCESS;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- /* check parameter range
- the ORed value of the valid values is 0x7
- a value having extra bits is invalid */
- if ((frameFilter | 0x7) != 0x7 || frameFilter == 0)
- {
- return IX_ETH_DB_INVALID_ARG;
- }
-
- portInfo = &ixEthDBPortInfo[portID];
-
- portInfo->frameFilter = frameFilter;
- portInfo->npeFrameFilter = 0; /* allow all by default */
-
- /* if accepting priority tagged but not all VLAN tagged
- set the membership table to contain only VLAN ID 0
- hence remove vlans 1-4094 and add VLAN ID 0 */
- if (((frameFilter & IX_ETH_DB_PRIORITY_TAGGED_FRAMES) != 0)
- && ((frameFilter & IX_ETH_DB_VLAN_TAGGED_FRAMES) == 0))
- {
- result = ixEthDBPortVlanMembershipRangeChange(portID,
- 1, IX_ETH_DB_802_1Q_MAX_VLAN_ID, portInfo->vlanMembership, REMOVE_VLAN);
-
- if (result == IX_ETH_DB_SUCCESS)
- {
- ixEthDBLocalVlanMembershipChange(0, portInfo->vlanMembership, ADD_VLAN);
- result = ixEthDBVlanTableRangeUpdate(portID);
- }
- }
-
- /* untagged only? */
- if (frameFilter == IX_ETH_DB_UNTAGGED_FRAMES)
- {
- portInfo->npeFrameFilter = 0x01;
- }
-
- /* tagged only? */
- if ((frameFilter & IX_ETH_DB_UNTAGGED_FRAMES) == 0)
- {
- portInfo->npeFrameFilter = 0x02;
- }
-
- if (result == IX_ETH_DB_SUCCESS)
- {
- result = ixEthDBIngressVlanModeUpdate(portID);
- }
-
- return result;
-}
-
-/**
- * @brief retrieves the acceptable frame type filter for a port
- *
- * @param portID ID of the port
- * @param frameFilter location to store the frame filter
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBAcceptableFrameTypeGet(IxEthDBPortId portID, IxEthDBFrameFilter *frameFilter)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- IX_ETH_DB_CHECK_REFERENCE(frameFilter);
-
- *frameFilter = ixEthDBPortInfo[portID].frameFilter;
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief sends an NPE the updated configuration related
- * to one QoS priority (associated traffic class and AQM mapping)
- *
- * @param portID ID of the port
- * @param classIndex QoS priority (traffic class index)
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBUpdateTrafficClass(IxEthDBPortId portID, UINT32 classIndex)
-{
- IxNpeMhMessage message;
- IX_STATUS result;
-
- UINT32 trafficClass = ixEthDBPortInfo[portID].priorityTable[classIndex];
- UINT32 aqmQueue = ixEthDBPortInfo[portID].ixEthDBTrafficClassAQMAssignments[trafficClass];
-
- FILL_SETRXQOSENTRY(message, IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID), classIndex, trafficClass, aqmQueue);
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- return result;
-}
-
-/**
- * @brief sets the priority mapping table
- *
- * @param portID ID of the port
- * @param priorityTable new priority mapping table
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPriorityMappingTableSet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable)
-{
- UINT32 classIndex;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- IX_ETH_DB_CHECK_REFERENCE(priorityTable);
-
- for (classIndex = 0 ; classIndex < IX_IEEE802_1Q_QOS_PRIORITY_COUNT ; classIndex++)
- {
- /* check range */
- if (priorityTable[classIndex] >= ixEthDBPortInfo[portID].ixEthDBTrafficClassCount)
- {
- return IX_ETH_DB_INVALID_PRIORITY;
- }
- }
-
- /* set new traffic classes */
- for (classIndex = 0 ; classIndex < IX_IEEE802_1Q_QOS_PRIORITY_COUNT ; classIndex++)
- {
- ixEthDBPortInfo[portID].priorityTable[classIndex] = priorityTable[classIndex];
-
- if (ixEthDBUpdateTrafficClass(portID, classIndex) != IX_ETH_DB_SUCCESS)
- {
- return IX_ETH_DB_FAIL;
- }
- }
-
- return IX_ETH_DB_SUCCESS;
- }
-
-/**
- * @brief retrieves a port's priority mapping table
- *
- * @param portID ID of the port
- * @param priorityTable location to store the priority table
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPriorityMappingTableGet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- IX_ETH_DB_CHECK_REFERENCE(priorityTable);
-
- memcpy(priorityTable, ixEthDBPortInfo[portID].priorityTable, sizeof (IxEthDBPriorityTable));
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief sets one QoS priority => traffic class mapping
- *
- * @param portID ID of the port
- * @param userPriority QoS (user) priority
- * @param trafficClass associated traffic class
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPriorityMappingClassSet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority trafficClass)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- /* check ranges for userPriority and trafficClass */
- if (userPriority >= IX_IEEE802_1Q_QOS_PRIORITY_COUNT || trafficClass >= ixEthDBPortInfo[portID].ixEthDBTrafficClassCount)
- {
- return IX_ETH_DB_INVALID_PRIORITY;
- }
-
- ixEthDBPortInfo[portID].priorityTable[userPriority] = trafficClass;
-
- return ixEthDBUpdateTrafficClass(portID, userPriority);
-}
-
-/**
- * @brief retrieves one QoS priority => traffic class mapping
- *
- * @param portID ID of the port
- * @param userPriority QoS (user) priority
- * @param trafficClass location to store the associated traffic class
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPriorityMappingClassGet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority *trafficClass)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- IX_ETH_DB_CHECK_REFERENCE(trafficClass);
-
- /* check userPriority range */
- if (userPriority >= IX_IEEE802_1Q_QOS_PRIORITY_COUNT)
- {
- return IX_ETH_DB_INVALID_PRIORITY;
- }
-
- *trafficClass = ixEthDBPortInfo[portID].priorityTable[userPriority];
-
- return IX_ETH_DB_SUCCESS;
-}
-
-/**
- * @brief enables or disables the source port extraction
- * from the VLAN TPID field
- *
- * @param portID ID of the port
- * @param enable TRUE to enable or FALSE to disable
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBVlanPortExtractionEnable(IxEthDBPortId portID, BOOL enable)
-{
- IxNpeMhMessage message;
- IX_STATUS result;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
-
- FILL_SETPORTIDEXTRACTIONMODE(message, portID, enable);
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- return result;
-}
diff --git a/cpu/ixp/npe/IxEthDBWiFi.c b/cpu/ixp/npe/IxEthDBWiFi.c
deleted file mode 100644
index 0a6043f364..0000000000
--- a/cpu/ixp/npe/IxEthDBWiFi.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/**
- * @file IxEthDBAPI.c
- *
- * @brief Implementation of the public API
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxEthDB_p.h"
-
-/* forward prototypes */
-IX_ETH_DB_PUBLIC
-MacTreeNode *ixEthDBGatewaySelect(MacTreeNode *stations);
-
-/**
- * @brief sets the BBSID value for the WiFi header conversion feature
- *
- * @param portID ID of the port
- * @param bbsid pointer to the 6-byte BBSID value
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiBBSIDSet(IxEthDBPortId portID, IxEthDBMacAddr *bbsid)
-{
- IxNpeMhMessage message;
- IX_STATUS result;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_WIFI_HEADER_CONVERSION);
-
- IX_ETH_DB_CHECK_REFERENCE(bbsid);
-
- memcpy(ixEthDBPortInfo[portID].bbsid, bbsid, sizeof (IxEthDBMacAddr));
-
- FILL_SETBBSID_MSG(message, portID, bbsid);
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- return result;
-}
-
-/**
- * @brief updates the Frame Control and Duration/ID WiFi header
- * conversion parameters in an NPE
- *
- * @param portID ID of the port
- *
- * This function will send a message to the NPE updating the
- * frame conversion parameters for 802.3 => 802.11 header conversion.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or IX_ETH_DB_FAIL otherwise
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-IxEthDBStatus ixEthDBWiFiFrameControlDurationIDUpdate(IxEthDBPortId portID)
-{
- IxNpeMhMessage message;
- IX_STATUS result;
-
- FILL_SETFRAMECONTROLDURATIONID(message, portID, ixEthDBPortInfo[portID].frameControlDurationID);
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- return result;
-}
-
-/**
- * @brief sets the Duration/ID WiFi frame header conversion parameter
- *
- * @param portID ID of the port
- * @param durationID 16-bit value containing the new Duration/ID parameter
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiDurationIDSet(IxEthDBPortId portID, UINT16 durationID)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_WIFI_HEADER_CONVERSION);
-
- ixEthDBPortInfo[portID].frameControlDurationID = (ixEthDBPortInfo[portID].frameControlDurationID & 0xFFFF0000) | durationID;
-
- return ixEthDBWiFiFrameControlDurationIDUpdate(portID);
-}
-
-/**
- * @brief sets the Frame Control WiFi frame header conversion parameter
- *
- * @param portID ID of the port
- * @param durationID 16-bit value containing the new Frame Control parameter
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiFrameControlSet(IxEthDBPortId portID, UINT16 frameControl)
-{
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_WIFI_HEADER_CONVERSION);
-
- ixEthDBPortInfo[portID].frameControlDurationID = (ixEthDBPortInfo[portID].frameControlDurationID & 0xFFFF) | (frameControl << 16);
-
- return ixEthDBWiFiFrameControlDurationIDUpdate(portID);
-}
-
-/**
- * @brief removes a WiFi header conversion record
- *
- * @param portID ID of the port
- * @param macAddr MAC address of the record to remove
- *
- * Note that this function is documented in the main
- * component header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiEntryRemove(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
-{
- MacDescriptor recordTemplate;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_WIFI_HEADER_CONVERSION);
-
- memcpy(recordTemplate.macAddress, macAddr, sizeof (IxEthDBMacAddr));
-
- recordTemplate.type = IX_ETH_DB_WIFI_RECORD;
- recordTemplate.portID = portID;
-
- return ixEthDBRemove(&recordTemplate, NULL);
-}
-
-/**
- * @brief adds a WiFi header conversion record
- *
- * @param portID ID of the port
- * @param macAddr MAC address of the record to add
- * @param gatewayMacAddr address of the gateway (or
- * NULL if this is a station record)
- *
- * This function adds a record of type AP_TO_AP (gateway is not NULL)
- * or AP_TO_STA (gateway is NULL) in the main database as a
- * WiFi header conversion record.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- *
- * @internal
- */
-IX_ETH_DB_PRIVATE
-IxEthDBStatus ixEthDBWiFiEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr, IxEthDBMacAddr *gatewayMacAddr)
-{
- MacDescriptor recordTemplate;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_REFERENCE(macAddr);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_WIFI_HEADER_CONVERSION);
-
- memcpy(recordTemplate.macAddress, macAddr, sizeof (IxEthDBMacAddr));
-
- recordTemplate.type = IX_ETH_DB_WIFI_RECORD;
- recordTemplate.portID = portID;
-
- if (gatewayMacAddr != NULL)
- {
- memcpy(recordTemplate.recordData.wifiData.gwMacAddress, gatewayMacAddr, sizeof (IxEthDBMacAddr));
-
- recordTemplate.recordData.wifiData.type = IX_ETH_DB_WIFI_AP_TO_AP;
- }
- else
- {
- memset(recordTemplate.recordData.wifiData.gwMacAddress, 0, sizeof (IxEthDBMacAddr));
-
- recordTemplate.recordData.wifiData.type = IX_ETH_DB_WIFI_AP_TO_STA;
- }
-
- return ixEthDBAdd(&recordTemplate, NULL);
-}
-
-/**
- * @brief adds a WiFi header conversion record
- *
- * @param portID ID of the port
- * @param macAddr MAC address of the record to add
- * @param gatewayMacAddr address of the gateway
- *
- * This function adds a record of type AP_TO_AP
- * in the main database as a WiFi header conversion record.
- *
- * This is simply a wrapper over @ref ixEthDBWiFiEntryAdd().
- *
- * Note that this function is documented in the main
- * component header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiAccessPointEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr, IxEthDBMacAddr *gatewayMacAddr)
-{
- IX_ETH_DB_CHECK_REFERENCE(gatewayMacAddr);
-
- return ixEthDBWiFiEntryAdd(portID, macAddr, gatewayMacAddr);
-}
-
-/**
- * @brief adds a WiFi header conversion record
- *
- * @param portID ID of the port
- * @param macAddr MAC address of the record to add
- *
- * This function adds a record of type AP_TO_STA
- * in the main database as a WiFi header conversion record.
- *
- * This is simply a wrapper over @ref ixEthDBWiFiEntryAdd().
- *
- * Note that this function is documented in the main
- * component header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed
- * successfully or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiStationEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
-{
- return ixEthDBWiFiEntryAdd(portID, macAddr, NULL);
-}
-
-/**
- * @brief selects a set of gateways from a tree of
- * WiFi header conversion records
- *
- * @param stations binary tree containing pointers to WiFi header
- * conversion records
- *
- * This function browses through the input binary tree, identifies
- * records of type AP_TO_AP, clones these records and appends them
- * to a vine (a single right-branch binary tree) which is returned
- * as result. A maximum of MAX_GW_SIZE entries containing gateways
- * will be cloned from the original tree.
- *
- * @return vine (linear binary tree) containing record
- * clones of AP_TO_AP type, which have a gateway field
- *
- * @internal
- */
-IX_ETH_DB_PUBLIC
-MacTreeNode *ixEthDBGatewaySelect(MacTreeNode *stations)
-{
- MacTreeNodeStack *stack;
- MacTreeNode *gateways, *insertionPlace;
- UINT32 gwIndex = 1; /* skip the empty root */
-
- if (stations == NULL)
- {
- return NULL;
- }
-
- stack = ixOsalCacheDmaMalloc(sizeof (MacTreeNodeStack));
-
- if (stack == NULL)
- {
- ERROR_LOG("DB: (WiFi) failed to allocate the node stack for gateway tree linearization, out of memory?\n");
- return NULL;
- }
-
- /* initialize root node */
- gateways = insertionPlace = NULL;
-
- /* start browsing the station tree */
- NODE_STACK_INIT(stack);
-
- /* initialize stack by pushing the tree root at offset 0 */
- NODE_STACK_PUSH(stack, stations, 0);
-
- while (NODE_STACK_NONEMPTY(stack))
- {
- MacTreeNode *node;
- UINT32 offset;
-
- NODE_STACK_POP(stack, node, offset);
-
- /* we can store maximum 31 (32 total, 1 empty root) entries in the gateway tree */
- if (offset > (MAX_GW_SIZE - 1)) break;
-
- /* check if this record has a gateway address */
- if (node->descriptor != NULL && node->descriptor->recordData.wifiData.type == IX_ETH_DB_WIFI_AP_TO_AP)
- {
- /* found a record, create an insertion place */
- if (insertionPlace != NULL)
- {
- insertionPlace->right = ixEthDBAllocMacTreeNode();
- insertionPlace = insertionPlace->right;
- }
- else
- {
- gateways = ixEthDBAllocMacTreeNode();
- insertionPlace = gateways;
- }
-
- if (insertionPlace == NULL)
- {
- /* no nodes left, bail out with what we have */
- ixOsalCacheDmaFree(stack);
- return gateways;
- }
-
- /* clone the original record for the gateway tree */
- insertionPlace->descriptor = ixEthDBCloneMacDescriptor(node->descriptor);
-
- /* insert and update the offset in the original record */
- node->descriptor->recordData.wifiData.gwAddressIndex = gwIndex++;
- }
-
- /* browse the tree */
- if (node->left != NULL)
- {
- NODE_STACK_PUSH(stack, node->left, LEFT_CHILD_OFFSET(offset));
- }
-
- if (node->right != NULL)
- {
- NODE_STACK_PUSH(stack, node->right, RIGHT_CHILD_OFFSET(offset));
- }
- }
-
- ixOsalCacheDmaFree(stack);
- return gateways;
-}
-
-/**
- * @brief downloads the WiFi header conversion table to an NPE
- *
- * @param portID ID of the port
- *
- * This function prepares the WiFi header conversion tables and
- * downloads them to the specified NPE port.
- *
- * The header conversion tables consist in the main table of
- * addresses and the secondary table of gateways. AP_TO_AP records
- * from the first table contain index fields into the second table
- * for gateway selection.
- *
- * Note that this function is documented in the main component
- * header file, IxEthDB.h.
- *
- * @return IX_ETH_DB_SUCCESS if the operation completed successfully
- * or an appropriate error message otherwise
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiConversionTableDownload(IxEthDBPortId portID)
-{
- IxEthDBPortMap query;
- MacTreeNode *stations = NULL, *gateways = NULL, *gateway = NULL;
- IxNpeMhMessage message;
- PortInfo *portInfo;
- IX_STATUS result;
-
- IX_ETH_DB_CHECK_PORT(portID);
-
- IX_ETH_DB_CHECK_SINGLE_NPE(portID);
-
- IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_WIFI_HEADER_CONVERSION);
-
- portInfo = &ixEthDBPortInfo[portID];
-
- SET_DEPENDENCY_MAP(query, portID);
-
- ixEthDBUpdateLock();
-
- stations = ixEthDBQuery(NULL, query, IX_ETH_DB_WIFI_RECORD, MAX_ELT_SIZE);
- gateways = ixEthDBGatewaySelect(stations);
-
- /* clean up gw area */
- memset((void *) portInfo->updateMethod.npeGwUpdateZone, FULL_GW_BYTE_SIZE, 0);
-
- /* write all gateways */
- gateway = gateways;
-
- while (gateway != NULL)
- {
- ixEthDBNPEGatewayNodeWrite((void *) (((UINT32) portInfo->updateMethod.npeGwUpdateZone)
- + gateway->descriptor->recordData.wifiData.gwAddressIndex * ELT_ENTRY_SIZE),
- gateway);
-
- gateway = gateway->right;
- }
-
- /* free the gateway tree */
- if (gateways != NULL)
- {
- ixEthDBFreeMacTreeNode(gateways);
- }
-
- FILL_SETAPMACTABLE_MSG(message,
- IX_OSAL_MMU_VIRT_TO_PHYS(portInfo->updateMethod.npeGwUpdateZone));
-
- IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
-
- if (result == IX_SUCCESS)
- {
- /* update the main tree (the stations tree) */
- portInfo->updateMethod.searchTree = stations;
-
- result = ixEthDBNPEUpdateHandler(portID, IX_ETH_DB_WIFI_RECORD);
- }
-
- ixEthDBUpdateUnlock();
-
- return result;
-}
diff --git a/cpu/ixp/npe/IxEthMii.c b/cpu/ixp/npe/IxEthMii.c
deleted file mode 100644
index 4d92f17eef..0000000000
--- a/cpu/ixp/npe/IxEthMii.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/**
- * @file IxEthMii.c
- *
- * @author Intel Corporation
- * @date
- *
- * @brief MII control functions
- *
- * Design Notes:
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxOsal.h"
-
-#include "IxEthAcc.h"
-#include "IxEthMii_p.h"
-
-#ifdef __wince
-#include "IxOsPrintf.h"
-#endif
-
-/* Array to store the phy IDs of the discovered phys */
-PRIVATE UINT32 ixEthMiiPhyId[IXP425_ETH_ACC_MII_MAX_ADDR];
-
-/*********************************************************
- *
- * Scan for PHYs on the MII bus. This function returns
- * an array of booleans, one for each PHY address.
- * If a PHY is found at a particular address, the
- * corresponding entry in the array is set to TRUE.
- *
- */
-
-PUBLIC IX_STATUS
-ixEthMiiPhyScan(BOOL phyPresent[], UINT32 maxPhyCount)
-{
- UINT32 i;
- UINT16 regval, regvalId1, regvalId2;
-
- /*Search for PHYs on the MII*/
- /*Search for existant phys on the MDIO bus*/
-
- if ((phyPresent == NULL) ||
- (maxPhyCount > IXP425_ETH_ACC_MII_MAX_ADDR))
- {
- return IX_FAIL;
- }
-
- /* fill the array */
- for(i=0;
- i<IXP425_ETH_ACC_MII_MAX_ADDR;
- i++)
- {
- phyPresent[i] = FALSE;
- }
-
- /* iterate through the PHY addresses */
- for(i=0;
- maxPhyCount > 0 && i<IXP425_ETH_ACC_MII_MAX_ADDR;
- i++)
- {
- ixEthMiiPhyId[i] = IX_ETH_MII_INVALID_PHY_ID;
- if(ixEthAccMiiReadRtn(i,
- IX_ETH_MII_CTRL_REG,
- &regval) == IX_ETH_ACC_SUCCESS)
- {
- if((regval & 0xffff) != 0xffff)
- {
- maxPhyCount--;
- /*Need to read the register twice here to flush PHY*/
- ixEthAccMiiReadRtn(i, IX_ETH_MII_PHY_ID1_REG, &regvalId1);
- ixEthAccMiiReadRtn(i, IX_ETH_MII_PHY_ID1_REG, &regvalId1);
- ixEthAccMiiReadRtn(i, IX_ETH_MII_PHY_ID2_REG, &regvalId2);
- ixEthMiiPhyId[i] = (regvalId1 << IX_ETH_MII_REG_SHL) | regvalId2;
- if ((ixEthMiiPhyId[i] == IX_ETH_MII_KS8995_PHY_ID)
- || (ixEthMiiPhyId[i] == IX_ETH_MII_LXT971_PHY_ID)
- || (ixEthMiiPhyId[i] == IX_ETH_MII_LXT972_PHY_ID)
- || (ixEthMiiPhyId[i] == IX_ETH_MII_LXT973_PHY_ID)
- || (ixEthMiiPhyId[i] == IX_ETH_MII_LXT973A3_PHY_ID)
- || (ixEthMiiPhyId[i] == IX_ETH_MII_LXT9785_PHY_ID)
- )
- {
- /* supported phy */
- phyPresent[i] = TRUE;
- } /* end of if(ixEthMiiPhyId) */
- else
- {
- if (ixEthMiiPhyId[i] != IX_ETH_MII_INVALID_PHY_ID)
- {
- /* unsupported phy */
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixEthMiiPhyScan : unexpected Mii PHY ID %8.8x\n",
- ixEthMiiPhyId[i], 2, 3, 4, 5, 6);
- ixEthMiiPhyId[i] = IX_ETH_MII_UNKNOWN_PHY_ID;
- phyPresent[i] = TRUE;
- }
- }
- }
- }
- }
- return IX_SUCCESS;
-}
-
-/************************************************************
- *
- * Configure the PHY at the specified address
- *
- */
-PUBLIC IX_STATUS
-ixEthMiiPhyConfig(UINT32 phyAddr,
- BOOL speed100,
- BOOL fullDuplex,
- BOOL autonegotiate)
-{
- UINT16 regval=0;
-
- /* parameter check */
- if ((phyAddr < IXP425_ETH_ACC_MII_MAX_ADDR) &&
- (ixEthMiiPhyId[phyAddr] != IX_ETH_MII_INVALID_PHY_ID))
- {
- /*
- * set the control register
- */
- if(autonegotiate)
- {
- regval |= IX_ETH_MII_CR_AUTO_EN | IX_ETH_MII_CR_RESTART;
- }
- else
- {
- if(speed100)
- {
- regval |= IX_ETH_MII_CR_100;
- }
- if(fullDuplex)
- {
- regval |= IX_ETH_MII_CR_FDX;
- }
- } /* end of if-else() */
- if (ixEthAccMiiWriteRtn(phyAddr,
- IX_ETH_MII_CTRL_REG,
- regval) == IX_ETH_ACC_SUCCESS)
- {
- return IX_SUCCESS;
- }
- } /* end of if(phyAddr) */
- return IX_FAIL;
-}
-
-/******************************************************************
- *
- * Enable the PHY Loopback at the specified address
- */
-PUBLIC IX_STATUS
-ixEthMiiPhyLoopbackEnable (UINT32 phyAddr)
-{
- UINT16 regval ;
-
- if ((phyAddr < IXP425_ETH_ACC_MII_MAX_ADDR) &&
- (IX_ETH_MII_INVALID_PHY_ID != ixEthMiiPhyId[phyAddr]))
- {
- /* read/write the control register */
- if(ixEthAccMiiReadRtn (phyAddr,
- IX_ETH_MII_CTRL_REG,
- &regval)
- == IX_ETH_ACC_SUCCESS)
- {
- if(ixEthAccMiiWriteRtn (phyAddr,
- IX_ETH_MII_CTRL_REG,
- regval | IX_ETH_MII_CR_LOOPBACK)
- == IX_ETH_ACC_SUCCESS)
- {
- return IX_SUCCESS;
- }
- }
- }
- return IX_FAIL;
-}
-
-/******************************************************************
- *
- * Disable the PHY Loopback at the specified address
- */
-PUBLIC IX_STATUS
-ixEthMiiPhyLoopbackDisable (UINT32 phyAddr)
-{
- UINT16 regval ;
-
- if ((phyAddr < IXP425_ETH_ACC_MII_MAX_ADDR) &&
- (IX_ETH_MII_INVALID_PHY_ID != ixEthMiiPhyId[phyAddr]))
- {
- /* read/write the control register */
- if(ixEthAccMiiReadRtn (phyAddr,
- IX_ETH_MII_CTRL_REG,
- &regval)
- == IX_ETH_ACC_SUCCESS)
- {
- if(ixEthAccMiiWriteRtn (phyAddr,
- IX_ETH_MII_CTRL_REG,
- regval & (~IX_ETH_MII_CR_LOOPBACK))
- == IX_ETH_ACC_SUCCESS)
- {
- return IX_SUCCESS;
- }
- }
- }
- return IX_FAIL;
-}
-
-/******************************************************************
- *
- * Reset the PHY at the specified address
- */
-PUBLIC IX_STATUS
-ixEthMiiPhyReset(UINT32 phyAddr)
-{
- UINT32 timeout;
- UINT16 regval;
-
- if ((phyAddr < IXP425_ETH_ACC_MII_MAX_ADDR) &&
- (ixEthMiiPhyId[phyAddr] != IX_ETH_MII_INVALID_PHY_ID))
- {
- if ((ixEthMiiPhyId[phyAddr] == IX_ETH_MII_LXT971_PHY_ID) ||
- (ixEthMiiPhyId[phyAddr] == IX_ETH_MII_LXT972_PHY_ID) ||
- (ixEthMiiPhyId[phyAddr] == IX_ETH_MII_LXT973_PHY_ID) ||
- (ixEthMiiPhyId[phyAddr] == IX_ETH_MII_LXT973A3_PHY_ID) ||
- (ixEthMiiPhyId[phyAddr] == IX_ETH_MII_LXT9785_PHY_ID)
- )
- {
- /* use the control register to reset the phy */
- ixEthAccMiiWriteRtn(phyAddr,
- IX_ETH_MII_CTRL_REG,
- IX_ETH_MII_CR_RESET);
-
- /* poll until the reset bit is cleared */
- timeout = 0;
- do
- {
- ixOsalSleep (IX_ETH_MII_RESET_POLL_MS);
-
- /* read the control register and check for timeout */
- ixEthAccMiiReadRtn(phyAddr,
- IX_ETH_MII_CTRL_REG,
- &regval);
- if ((regval & IX_ETH_MII_CR_RESET) == 0)
- {
- /* timeout bit is self-cleared */
- break;
- }
- timeout += IX_ETH_MII_RESET_POLL_MS;
- }
- while (timeout < IX_ETH_MII_RESET_DELAY_MS);
-
- /* check for timeout */
- if (timeout >= IX_ETH_MII_RESET_DELAY_MS)
- {
- ixEthAccMiiWriteRtn(phyAddr, IX_ETH_MII_CTRL_REG,
- IX_ETH_MII_CR_NORM_EN);
- return IX_FAIL;
- }
-
- return IX_SUCCESS;
- } /* end of if(ixEthMiiPhyId) */
- else if (ixEthMiiPhyId[phyAddr] == IX_ETH_MII_KS8995_PHY_ID)
- {
- /* reset bit is reserved, just reset the control register */
- ixEthAccMiiWriteRtn(phyAddr, IX_ETH_MII_CTRL_REG,
- IX_ETH_MII_CR_NORM_EN);
- return IX_SUCCESS;
- }
- else
- {
- /* unknown PHY, set the control register reset bit,
- * wait 2 s. and clear the control register.
- */
- ixEthAccMiiWriteRtn(phyAddr, IX_ETH_MII_CTRL_REG,
- IX_ETH_MII_CR_RESET);
-
- ixOsalSleep (IX_ETH_MII_RESET_DELAY_MS);
-
- ixEthAccMiiWriteRtn(phyAddr, IX_ETH_MII_CTRL_REG,
- IX_ETH_MII_CR_NORM_EN);
- return IX_SUCCESS;
- } /* end of if-else(ixEthMiiPhyId) */
- } /* end of if(phyAddr) */
- return IX_FAIL;
-}
-
-/*****************************************************************
- *
- * Link state query functions
- */
-
-PUBLIC IX_STATUS
-ixEthMiiLinkStatus(UINT32 phyAddr,
- BOOL *linkUp,
- BOOL *speed100,
- BOOL *fullDuplex,
- BOOL *autoneg)
-{
- UINT16 ctrlRegval, statRegval, regval, regval4, regval5;
-
- /* check the parameters */
- if ((linkUp == NULL) ||
- (speed100 == NULL) ||
- (fullDuplex == NULL) ||
- (autoneg == NULL))
- {
- return IX_FAIL;
- }
-
- *linkUp = FALSE;
- *speed100 = FALSE;
- *fullDuplex = FALSE;
- *autoneg = FALSE;
-
- if ((phyAddr < IXP425_ETH_ACC_MII_MAX_ADDR) &&
- (ixEthMiiPhyId[phyAddr] != IX_ETH_MII_INVALID_PHY_ID))
- {
- if ((ixEthMiiPhyId[phyAddr] == IX_ETH_MII_LXT971_PHY_ID) ||
- (ixEthMiiPhyId[phyAddr] == IX_ETH_MII_LXT972_PHY_ID) ||
- (ixEthMiiPhyId[phyAddr] == IX_ETH_MII_LXT9785_PHY_ID)
- )
- {
- /* --------------------------------------------------*/
- /* Retrieve information from PHY specific register */
- /* --------------------------------------------------*/
- if (ixEthAccMiiReadRtn(phyAddr,
- IX_ETH_MII_STAT2_REG,
- &regval) != IX_ETH_ACC_SUCCESS)
- {
- return IX_FAIL;
- }
- *linkUp = ((regval & IX_ETH_MII_SR2_LINK) != 0);
- *speed100 = ((regval & IX_ETH_MII_SR2_100) != 0);
- *fullDuplex = ((regval & IX_ETH_MII_SR2_FD) != 0);
- *autoneg = ((regval & IX_ETH_MII_SR2_AUTO) != 0);
- return IX_SUCCESS;
- } /* end of if(ixEthMiiPhyId) */
- else
- {
- /* ----------------------------------------------------*/
- /* Retrieve information from status and ctrl registers */
- /* ----------------------------------------------------*/
- if (ixEthAccMiiReadRtn(phyAddr,
- IX_ETH_MII_CTRL_REG,
- &ctrlRegval) != IX_ETH_ACC_SUCCESS)
- {
- return IX_FAIL;
- }
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_MII_STAT_REG, &statRegval);
-
- *linkUp = ((statRegval & IX_ETH_MII_SR_LINK_STATUS) != 0);
- if (*linkUp)
- {
- *autoneg = ((ctrlRegval & IX_ETH_MII_CR_AUTO_EN) != 0) &&
- ((statRegval & IX_ETH_MII_SR_AUTO_SEL) != 0) &&
- ((statRegval & IX_ETH_MII_SR_AUTO_NEG) != 0);
-
- if (*autoneg)
- {
- /* mask the current stat values with the capabilities */
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_MII_AN_ADS_REG, &regval4);
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_MII_AN_PRTN_REG, &regval5);
- /* merge the flags from the 3 registers */
- regval = (statRegval & ((regval4 & regval5) << 6));
- /* initialise from status register values */
- if ((regval & IX_ETH_MII_SR_TX_FULL_DPX) != 0)
- {
- /* 100 Base X full dplx */
- *speed100 = TRUE;
- *fullDuplex = TRUE;
- return IX_SUCCESS;
- }
- if ((regval & IX_ETH_MII_SR_TX_HALF_DPX) != 0)
- {
- /* 100 Base X half dplx */
- *speed100 = TRUE;
- return IX_SUCCESS;
- }
- if ((regval & IX_ETH_MII_SR_10T_FULL_DPX) != 0)
- {
- /* 10 mb full dplx */
- *fullDuplex = TRUE;
- return IX_SUCCESS;
- }
- if ((regval & IX_ETH_MII_SR_10T_HALF_DPX) != 0)
- {
- /* 10 mb half dplx */
- return IX_SUCCESS;
- }
- } /* end of if(autoneg) */
- else
- {
- /* autonegotiate not complete, return setup parameters */
- *speed100 = ((ctrlRegval & IX_ETH_MII_CR_100) != 0);
- *fullDuplex = ((ctrlRegval & IX_ETH_MII_CR_FDX) != 0);
- }
- } /* end of if(linkUp) */
- } /* end of if-else(ixEthMiiPhyId) */
- } /* end of if(phyAddr) */
- else
- {
- return IX_FAIL;
- } /* end of if-else(phyAddr) */
- return IX_SUCCESS;
-}
-
-/*****************************************************************
- *
- * Link state display functions
- */
-
-PUBLIC IX_STATUS
-ixEthMiiPhyShow (UINT32 phyAddr)
-{
- BOOL linkUp, speed100, fullDuplex, autoneg;
- UINT16 cregval;
- UINT16 sregval;
-
-
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_MII_STAT_REG, &sregval);
- ixEthAccMiiReadRtn(phyAddr, IX_ETH_MII_CTRL_REG, &cregval);
-
- /* get link information */
- if (ixEthMiiLinkStatus(phyAddr,
- &linkUp,
- &speed100,
- &fullDuplex,
- &autoneg) != IX_ETH_ACC_SUCCESS)
- {
- printf("PHY Status unknown\n");
- return IX_FAIL;
- }
-
- printf("PHY ID [phyAddr]: %8.8x\n",ixEthMiiPhyId[phyAddr]);
- printf( " Status reg: %4.4x\n",sregval);
- printf( " control reg: %4.4x\n",cregval);
- /* display link information */
- printf("PHY Status:\n");
- printf(" Link is %s\n",
- (linkUp ? "Up" : "Down"));
- if((sregval & IX_ETH_MII_SR_REMOTE_FAULT) != 0)
- {
- printf(" Remote fault detected\n");
- }
- printf(" Auto Negotiation %s\n",
- (autoneg ? "Completed" : "Not Completed"));
-
- printf("PHY Configuration:\n");
- printf(" Speed %sMb/s\n",
- (speed100 ? "100" : "10"));
- printf(" %s Duplex\n",
- (fullDuplex ? "Full" : "Half"));
- printf(" Auto Negotiation %s\n",
- (autoneg ? "Enabled" : "Disabled"));
- return IX_SUCCESS;
-}
-
diff --git a/cpu/ixp/npe/IxFeatureCtrl.c b/cpu/ixp/npe/IxFeatureCtrl.c
deleted file mode 100644
index e02aabfb40..0000000000
--- a/cpu/ixp/npe/IxFeatureCtrl.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/**
- * @file IxFeatureCtrl.c
- *
- * @author Intel Corporation
- * @date 29-Jan-2003
- *
- * @brief Feature Control Public API Implementation
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-#include "IxOsal.h"
-#include "IxVersionId.h"
-#include "IxFeatureCtrl.h"
-
-/* Macro to read from the Feature Control Register */
-#define IX_FEATURE_CTRL_READ(result) \
-do { \
-ixFeatureCtrlExpMap(); \
-(result) = IX_OSAL_READ_LONG(ixFeatureCtrlRegister); \
-} while (0)
-
-/* Macro to write to the Feature Control Register */
-#define IX_FEATURE_CTRL_WRITE(value) \
-do { \
-ixFeatureCtrlExpMap(); \
-IX_OSAL_WRITE_LONG(ixFeatureCtrlRegister, (value)); \
-} while (0)
-
-/*
- * This is the offset of the feature register relative to the base of the
- * Expansion Bus Controller MMR.
- */
-#define IX_FEATURE_CTRL_REG_OFFSET (0x00000028)
-
-
-/* Boolean to mark the fact that the EXP_CONFIG address space was mapped */
-PRIVATE BOOL ixFeatureCtrlExpCfgRegionMapped = FALSE;
-
-/* Pointer holding the virtual address of the Feature Control Register */
-PRIVATE VUINT32 *ixFeatureCtrlRegister = NULL;
-
-/* Place holder to store the software configuration */
-PRIVATE BOOL swConfiguration[IX_FEATURECTRL_SWCONFIG_MAX];
-
-/* Flag to control swConfiguration[] is initialized once */
-PRIVATE BOOL swConfigurationFlag = FALSE ;
-
-/* Array containing component mask values */
-#ifdef __ixp42X
-UINT32 componentMask[IX_FEATURECTRL_MAX_COMPONENTS] = {
- (0x1<<IX_FEATURECTRL_RCOMP),
- (0x1<<IX_FEATURECTRL_USB),
- (0x1<<IX_FEATURECTRL_HASH),
- (0x1<<IX_FEATURECTRL_AES),
- (0x1<<IX_FEATURECTRL_DES),
- (0x1<<IX_FEATURECTRL_HDLC),
- (0x1<<IX_FEATURECTRL_AAL),
- (0x1<<IX_FEATURECTRL_HSS),
- (0x1<<IX_FEATURECTRL_UTOPIA),
- (0x1<<IX_FEATURECTRL_ETH0),
- (0x1<<IX_FEATURECTRL_ETH1),
- (0x1<<IX_FEATURECTRL_NPEA),
- (0x1<<IX_FEATURECTRL_NPEB),
- (0x1<<IX_FEATURECTRL_NPEC),
- (0x1<<IX_FEATURECTRL_PCI),
- IX_FEATURECTRL_COMPONENT_NOT_AVAILABLE,
- (0x3<<IX_FEATURECTRL_UTOPIA_PHY_LIMIT),
- (0x1<<IX_FEATURECTRL_UTOPIA_PHY_LIMIT_BIT2),
- IX_FEATURECTRL_COMPONENT_NOT_AVAILABLE,
- IX_FEATURECTRL_COMPONENT_NOT_AVAILABLE,
- IX_FEATURECTRL_COMPONENT_NOT_AVAILABLE,
- IX_FEATURECTRL_COMPONENT_NOT_AVAILABLE,
- IX_FEATURECTRL_COMPONENT_NOT_AVAILABLE
-};
-#elif defined (__ixp46X)
-UINT32 componentMask[IX_FEATURECTRL_MAX_COMPONENTS] = {
- (0x1<<IX_FEATURECTRL_RCOMP),
- (0x1<<IX_FEATURECTRL_USB),
- (0x1<<IX_FEATURECTRL_HASH),
- (0x1<<IX_FEATURECTRL_AES),
- (0x1<<IX_FEATURECTRL_DES),
- (0x1<<IX_FEATURECTRL_HDLC),
- IX_FEATURECTRL_COMPONENT_ALWAYS_AVAILABLE, /* AAL component is always on */
- (0x1<<IX_FEATURECTRL_HSS),
- (0x1<<IX_FEATURECTRL_UTOPIA),
- (0x1<<IX_FEATURECTRL_ETH0),
- (0x1<<IX_FEATURECTRL_ETH1),
- (0x1<<IX_FEATURECTRL_NPEA),
- (0x1<<IX_FEATURECTRL_NPEB),
- (0x1<<IX_FEATURECTRL_NPEC),
- (0x1<<IX_FEATURECTRL_PCI),
- (0x1<<IX_FEATURECTRL_ECC_TIMESYNC),
- (0x3<<IX_FEATURECTRL_UTOPIA_PHY_LIMIT),
- (0x1<<IX_FEATURECTRL_UTOPIA_PHY_LIMIT_BIT2), /* NOT TO BE USED */
- (0x1<<IX_FEATURECTRL_USB_HOST_CONTROLLER),
- (0x1<<IX_FEATURECTRL_NPEA_ETH),
- (0x1<<IX_FEATURECTRL_NPEB_ETH),
- (0x1<<IX_FEATURECTRL_RSA),
- (0x3<<IX_FEATURECTRL_XSCALE_MAX_FREQ),
- (0x1<<IX_FEATURECTRL_XSCALE_MAX_FREQ_BIT2)
-};
-#endif /* __ixp42X */
-
-/**
- * Forward declaration
- */
-PRIVATE
-void ixFeatureCtrlExpMap(void);
-
-PRIVATE
-void ixFeatureCtrlSwConfigurationInit(void);
-
-/**
- * Function to map EXP_CONFIG space
- */
-PRIVATE
-void ixFeatureCtrlExpMap(void)
-{
- UINT32 expCfgBaseAddress = 0;
-
- /* If the EXP Configuration space has already been mapped then
- * return */
- if (ixFeatureCtrlExpCfgRegionMapped == TRUE)
- {
- return;
- }
-
- /* Map (get virtual address) for the EXP_CONFIG space */
- expCfgBaseAddress = (UINT32)
- (IX_OSAL_MEM_MAP(IX_OSAL_IXP400_EXP_BUS_REGS_PHYS_BASE,
- IX_OSAL_IXP400_EXP_REG_MAP_SIZE));
-
- /* Assert that the mapping operation succeeded */
- IX_OSAL_ASSERT(expCfgBaseAddress);
-
- /* Set the address of the Feature register */
- ixFeatureCtrlRegister =
- (VUINT32 *) (expCfgBaseAddress + IX_FEATURE_CTRL_REG_OFFSET);
-
- /* Mark the fact that the EXP_CONFIG space has already been mapped */
- ixFeatureCtrlExpCfgRegionMapped = TRUE;
-}
-
-/**
- * Function definition: ixFeatureCtrlSwConfigurationInit
- * This function will only initialize software configuration once.
- */
-PRIVATE void ixFeatureCtrlSwConfigurationInit(void)
-{
- UINT32 i;
- if (FALSE == swConfigurationFlag)
- {
- for (i=0; i<IX_FEATURECTRL_SWCONFIG_MAX ; i++)
- {
- /* By default, all software configuration are enabled */
- swConfiguration[i]= TRUE ;
- }
- /*Make sure this function only initializes swConfiguration[] once*/
- swConfigurationFlag = TRUE ;
- }
-}
-
-/**
- * Function definition: ixFeatureCtrlRead
- */
-IxFeatureCtrlReg
-ixFeatureCtrlRead (void)
-{
- IxFeatureCtrlReg result;
-
-#if CPU!=SIMSPARCSOLARIS
- /* Read the feature control register */
- IX_FEATURE_CTRL_READ(result);
- return result;
-#else
- /* Return an invalid value for VxWorks simulation */
- result = 0xFFFFFFFF;
- return result;
-#endif
-}
-
-/**
- * Function definition: ixFeatureCtrlWrite
- */
-void
-ixFeatureCtrlWrite (IxFeatureCtrlReg expUnitReg)
-{
-#if CPU!=SIMSPARCSOLARIS
- /* Write value to feature control register */
- IX_FEATURE_CTRL_WRITE(expUnitReg);
-#endif
-}
-
-
-/**
- * Function definition: ixFeatureCtrlHwCapabilityRead
- */
-IxFeatureCtrlReg
-ixFeatureCtrlHwCapabilityRead (void)
-{
- IxFeatureCtrlReg currentReg, hwCapability;
-
- /* Capture a copy of feature control register */
- currentReg = ixFeatureCtrlRead();
-
- /* Try to enable all hardware components.
- * Only software disable hardware can be enabled again */
- ixFeatureCtrlWrite(0);
-
- /* Read feature control register to know the hardware capability. */
- hwCapability = ixFeatureCtrlRead();
-
- /* Restore initial feature control value */
- ixFeatureCtrlWrite(currentReg);
-
- /* return Hardware Capability */
- return hwCapability;
-}
-
-
-/**
- * Function definition: ixFeatureCtrlComponentCheck
- */
-IX_STATUS
-ixFeatureCtrlComponentCheck (IxFeatureCtrlComponentType componentType)
-{
- IxFeatureCtrlReg expUnitReg;
- UINT32 mask = 0;
-
- /* Lookup mask of component */
- mask=componentMask[componentType];
-
- /* Check if mask is available or not */
- if(IX_FEATURECTRL_COMPONENT_NOT_AVAILABLE == mask)
- {
- return IX_FEATURE_CTRL_COMPONENT_DISABLED;
- }
-
- if(IX_FEATURECTRL_COMPONENT_ALWAYS_AVAILABLE == mask)
- {
- return IX_FEATURE_CTRL_COMPONENT_ENABLED;
- }
-
- /* Read feature control register to know current hardware capability. */
- expUnitReg = ixFeatureCtrlRead();
-
- /* For example: To check for Hashing Coprocessor (bit-2)
- * expUniteg = 0x0010
- * ~expUnitReg = 0x1101
- * componentType = 0x0100
- * ~expUnitReg & componentType = 0x0100 (Not zero)
- */
-
- /*
- * Inverse the bit value because available component is 0 in value
- */
- expUnitReg = ~expUnitReg ;
-
- if (expUnitReg & mask)
- {
- return (IX_FEATURE_CTRL_COMPONENT_ENABLED);
- }
- else
- {
- return (IX_FEATURE_CTRL_COMPONENT_DISABLED);
- }
-}
-
-
-/**
- * Function definition: ixFeatureCtrlProductIdRead
- */
-IxFeatureCtrlProductId
-ixFeatureCtrlProductIdRead ()
-{
-#if CPU!=SIMSPARCSOLARIS
- IxFeatureCtrlProductId pdId = 0 ;
-
- /* Use ARM instruction to move register0 from coprocessor to ARM register */
-
-#ifndef __wince
- __asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(pdId) :);
-#else
-
-#ifndef IN_KERNEL
- BOOL mode;
-#endif
- extern IxFeatureCtrlProductId AsmixFeatureCtrlProductIdRead();
-
-#ifndef IN_KERNEL
- mode = SetKMode(TRUE);
-#endif
- pdId = AsmixFeatureCtrlProductIdRead();
-#ifndef IN_KERNEL
- SetKMode(mode);
-#endif
-
-#endif
- return (pdId);
-#else
- /* Return an invalid value for VxWorks simulation */
- return 0xffffffff;
-#endif
-}
-
-/**
- * Function definition: ixFeatureCtrlDeviceRead
- */
-IxFeatureCtrlDeviceId
-ixFeatureCtrlDeviceRead ()
-{
- return ((ixFeatureCtrlProductIdRead() >> IX_FEATURE_CTRL_DEVICE_TYPE_OFFSET)
- & IX_FEATURE_CTRL_DEVICE_TYPE_MASK);
-} /* End function ixFeatureCtrlDeviceRead */
-
-
-/**
- * Function definition: ixFeatureCtrlSwConfigurationCheck
- */
-IX_STATUS
-ixFeatureCtrlSwConfigurationCheck (IxFeatureCtrlSwConfig swConfigType)
-{
- if (swConfigType >= IX_FEATURECTRL_SWCONFIG_MAX)
- {
- ixOsalLog(IX_OSAL_LOG_LVL_WARNING,
- IX_OSAL_LOG_DEV_STDOUT,
- "FeatureCtrl: Invalid software configuraiton input.\n",
- 0, 0, 0, 0, 0, 0);
-
- return IX_FEATURE_CTRL_SWCONFIG_DISABLED;
- }
-
- /* The function will only initialize once. */
- ixFeatureCtrlSwConfigurationInit();
-
- /* Check and return software configuration */
- return ((swConfiguration[(UINT32)swConfigType] == TRUE) ? IX_FEATURE_CTRL_SWCONFIG_ENABLED: IX_FEATURE_CTRL_SWCONFIG_DISABLED);
-}
-
-/**
- * Function definition: ixFeatureCtrlSwConfigurationWrite
- */
-void
-ixFeatureCtrlSwConfigurationWrite (IxFeatureCtrlSwConfig swConfigType, BOOL enabled)
-{
- if (swConfigType >= IX_FEATURECTRL_SWCONFIG_MAX)
- {
- ixOsalLog(IX_OSAL_LOG_LVL_WARNING,
- IX_OSAL_LOG_DEV_STDOUT,
- "FeatureCtrl: Invalid software configuraiton input.\n",
- 0, 0, 0, 0, 0, 0);
-
- return;
- }
-
- /* The function will only initialize once. */
- ixFeatureCtrlSwConfigurationInit();
-
- /* Write software configuration */
- swConfiguration[(UINT32)swConfigType]=enabled ;
-}
-
-/**
- * Function definition: ixFeatureCtrlIxp400SwVersionShow
- */
-void
-ixFeatureCtrlIxp400SwVersionShow (void)
-{
- printf ("\nIXP400 Software Release %s %s\n\n", IX_VERSION_ID, IX_VERSION_INTERNAL_ID);
-
-}
-
-/**
- * Function definition: ixFeatureCtrlSoftwareBuildGet
- */
-IxFeatureCtrlBuildDevice
-ixFeatureCtrlSoftwareBuildGet (void)
-{
- #ifdef __ixp42X
- return IX_FEATURE_CTRL_SW_BUILD_IXP42X;
- #else
- return IX_FEATURE_CTRL_SW_BUILD_IXP46X;
- #endif
-}
diff --git a/cpu/ixp/npe/IxNpeDl.c b/cpu/ixp/npe/IxNpeDl.c
deleted file mode 100644
index ffe355c511..0000000000
--- a/cpu/ixp/npe/IxNpeDl.c
+++ /dev/null
@@ -1,972 +0,0 @@
-/**
- * @file IxNpeDl.c
- *
- * @author Intel Corporation
- * @date 08 January 2002
- *
- * @brief This file contains the implementation of the public API for the
- * IXP425 NPE Downloader component
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/*
- * Put the system defined include files required
- */
-
-/*
- * Put the user defined include files required
- */
-#include "IxNpeDl.h"
-#include "IxNpeDlImageMgr_p.h"
-#include "IxNpeDlNpeMgr_p.h"
-#include "IxNpeDlMacros_p.h"
-#include "IxFeatureCtrl.h"
-#include "IxOsal.h"
-/*
- * #defines used in this file
- */
- #define IMAGEID_MAJOR_NUMBER_DEFAULT 0
- #define IMAGEID_MINOR_NUMBER_DEFAULT 0
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-typedef struct
-{
- BOOL validImage;
- IxNpeDlImageId imageId;
-} IxNpeDlNpeState;
-
-/* module statistics counters */
-typedef struct
-{
- UINT32 attemptedDownloads;
- UINT32 successfulDownloads;
- UINT32 criticalFailDownloads;
-} IxNpeDlStats;
-
-/*
- * Variable declarations global to this file only. Externs are followed
- * by static variables.
- */
-static IxNpeDlNpeState ixNpeDlNpeState[IX_NPEDL_NPEID_MAX] =
-{
- {FALSE, {IX_NPEDL_NPEID_MAX, 0, 0, 0}},
- {FALSE, {IX_NPEDL_NPEID_MAX, 0, 0, 0}},
- {FALSE, {IX_NPEDL_NPEID_MAX, 0, 0, 0}}
-};
-
-static IxNpeDlStats ixNpeDlStats;
-
-/*
- * Software guard to prevent NPE from being started multiple times.
- */
-static BOOL ixNpeDlNpeStarted[IX_NPEDL_NPEID_MAX] ={FALSE, FALSE, FALSE} ;
-
-
-/*
- * static function prototypes.
- */
-PRIVATE IX_STATUS
-ixNpeDlNpeInitAndStartInternal (UINT32 *imageLibrary, UINT32 imageId);
-
-/*
- * Function definition: ixNpeDlMicrocodeImageLibraryOverride
- */
-PUBLIC IX_STATUS
-ixNpeDlMicrocodeImageLibraryOverride (UINT32 *clientImageLibrary)
-{
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlMicrocodeImageLibraryOverride\n");
-
- if (clientImageLibrary == NULL)
- {
- status = IX_NPEDL_PARAM_ERR;
- IX_NPEDL_ERROR_REPORT ("ixNpeDlMicrocodeImageLibraryOverride - "
- "invalid parameter\n");
- }
- else
- {
- status = ixNpeDlImageMgrMicrocodeImageLibraryOverride (clientImageLibrary);
- if (status != IX_SUCCESS)
- {
- status = IX_FAIL;
- }
- } /* end of if-else(clientImageLibrary) */
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlMicrocodeImageLibraryOverride : "
- "status = %d\n", status);
- return status;
-}
-
-/*
- * Function definition: ixNpeDlImageDownload
- */
-PUBLIC IX_STATUS
-ixNpeDlImageDownload (IxNpeDlImageId *imageIdPtr,
- BOOL verify)
-{
- UINT32 imageSize;
- UINT32 *imageCodePtr = NULL;
- IX_STATUS status;
- IxNpeDlNpeId npeId = imageIdPtr->npeId;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlImageDownload\n");
-
- ixNpeDlStats.attemptedDownloads++;
-
- /* Check input parameters */
- if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0))
- {
- status = IX_NPEDL_PARAM_ERR;
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageDownload - invalid parameter\n");
- }
- else
- {
- /* Ensure initialisation has been completed */
- ixNpeDlNpeMgrInit();
-
- /* If not IXP42X A0 stepping, proceed to check for existence of npe's */
- if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
- (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
- || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
- {
- if (npeId == IX_NPEDL_NPEID_NPEA)
- {
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does"
- " not exist\n");
- return IX_SUCCESS;
- }
- } /* end of if(npeId) */
- else if (npeId == IX_NPEDL_NPEID_NPEB)
- {
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified"
- " does not exist\n");
- return IX_SUCCESS;
- }
- } /* end of elseif(npeId) */
- else if (npeId == IX_NPEDL_NPEID_NPEC)
- {
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified"
- " does not exist\n");
- return IX_SUCCESS;
- }
- } /* end of elseif(npeId) */
- } /* end of if(IX_FEATURE_CTRL_SILICON_TYPE_B0) */ /*End of Silicon Type Check*/
-
- /* stop and reset the NPE */
- if (IX_SUCCESS != ixNpeDlNpeStopAndReset (npeId))
- {
- IX_NPEDL_ERROR_REPORT ("Failed to stop and reset NPE\n");
- return IX_FAIL;
- }
-
- /* Locate image */
- status = ixNpeDlImageMgrImageLocate (imageIdPtr, &imageCodePtr,
- &imageSize);
- if (IX_SUCCESS == status)
- {
- /*
- * If download was successful, store image Id in list of
- * currently loaded images. If a critical error occured
- * during download, record that the NPE has an invalid image
- */
- status = ixNpeDlNpeMgrImageLoad (npeId, imageCodePtr,
- verify);
- if (IX_SUCCESS == status)
- {
- ixNpeDlNpeState[npeId].imageId = *imageIdPtr;
- ixNpeDlNpeState[npeId].validImage = TRUE;
- ixNpeDlStats.successfulDownloads++;
-
- status = ixNpeDlNpeExecutionStart (npeId);
- }
- else if ((status == IX_NPEDL_CRITICAL_NPE_ERR) ||
- (status == IX_NPEDL_CRITICAL_MICROCODE_ERR))
- {
- ixNpeDlNpeState[npeId].imageId = *imageIdPtr;
- ixNpeDlNpeState[npeId].validImage = FALSE;
- ixNpeDlStats.criticalFailDownloads++;
- }
- } /* end of if(IX_SUCCESS) */ /* condition: image located successfully in microcode image */
- } /* end of if-else(npeId) */ /* condition: parameter checks ok */
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlImageDownload : status = %d\n", status);
- return status;
-}
-
-/*
- * Function definition: ixNpeDlAvailableImagesCountGet
- */
-PUBLIC IX_STATUS
-ixNpeDlAvailableImagesCountGet (UINT32 *numImagesPtr)
-{
- IX_STATUS status;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlAvailableImagesCountGet\n");
-
- /* Check input parameters */
- if (numImagesPtr == NULL)
- {
- status = IX_NPEDL_PARAM_ERR;
- IX_NPEDL_ERROR_REPORT ("ixNpeDlAvailableImagesCountGet - "
- "invalid parameter\n");
- }
- else
- {
- /*
- * Use ImageMgr module to get no. of images listed in Image Library Header.
- * If NULL is passed as imageListPtr parameter to following function,
- * it will only fill number of images into numImagesPtr
- */
- status = ixNpeDlImageMgrImageListExtract (NULL, numImagesPtr);
- } /* end of if-else(numImagesPtr) */
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlAvailableImagesCountGet : "
- "status = %d\n", status);
- return status;
-}
-
-/*
- * Function definition: ixNpeDlAvailableImagesListGet
- */
-PUBLIC IX_STATUS
-ixNpeDlAvailableImagesListGet (IxNpeDlImageId *imageIdListPtr,
- UINT32 *listSizePtr)
-{
- IX_STATUS status;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlAvailableImagesListGet\n");
-
- /* Check input parameters */
- if ((imageIdListPtr == NULL) || (listSizePtr == NULL))
- {
- status = IX_NPEDL_PARAM_ERR;
- IX_NPEDL_ERROR_REPORT ("ixNpeDlAvailableImagesListGet - "
- "invalid parameter\n");
- }
- else
- {
- /* Call ImageMgr to get list of images listed in Image Library Header */
- status = ixNpeDlImageMgrImageListExtract (imageIdListPtr,
- listSizePtr);
- } /* end of if-else(imageIdListPtr) */
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlAvailableImagesListGet : status = %d\n",
- status);
- return status;
-}
-
-/*
- * Function definition: ixNpeDlLoadedImageGet
- */
-PUBLIC IX_STATUS
-ixNpeDlLoadedImageGet (IxNpeDlNpeId npeId,
- IxNpeDlImageId *imageIdPtr)
-{
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlLoadedImageGet\n");
-
- /* Check input parameters */
- if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0) || (imageIdPtr == NULL))
- {
- status = IX_NPEDL_PARAM_ERR;
- IX_NPEDL_ERROR_REPORT ("ixNpeDlLoadedImageGet - invalid parameter\n");
- }
- else
- {
-
- /* If not IXP42X A0 stepping, proceed to check for existence of npe's */
- if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
- (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
- || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
- {
- if (npeId == IX_NPEDL_NPEID_NPEA &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does"
- " not exist\n");
- return IX_SUCCESS;
- } /* end of if(npeId) */
-
- if (npeId == IX_NPEDL_NPEID_NPEB &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified does"
- " not exist\n");
- return IX_SUCCESS;
- } /* end of if(npeId) */
-
- if (npeId == IX_NPEDL_NPEID_NPEC &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified does"
- " not exist\n");
- return IX_SUCCESS;
- } /* end of if(npeId) */
- } /* end of if not IXP42x-A0 silicon */
-
- if (ixNpeDlNpeState[npeId].validImage)
- {
- /* use npeId to get imageId from list of currently loaded
- images */
- *imageIdPtr = ixNpeDlNpeState[npeId].imageId;
- }
- else
- {
- status = IX_FAIL;
- } /* end of if-else(ixNpeDlNpeState) */
- } /* end of if-else(npeId) */
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlLoadedImageGet : status = %d\n",
- status);
- return status;
-}
-
-/*
- * Function definition: ixNpeDlLatestImageGet
- */
-PUBLIC IX_STATUS
-ixNpeDlLatestImageGet (
- IxNpeDlNpeId npeId,
- IxNpeDlFunctionalityId functionalityId,
- IxNpeDlImageId *imageIdPtr)
-{
- IX_STATUS status;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlLatestImageGet\n");
-
- /* Check input parameters */
- if ((npeId >= IX_NPEDL_NPEID_MAX) ||
- (npeId < 0) ||
- (imageIdPtr == NULL))
- {
- status = IX_NPEDL_PARAM_ERR;
- IX_NPEDL_ERROR_REPORT ("ixNpeDlLatestImageGet - "
- "invalid parameter\n");
- } /* end of if(npeId) */
- else
- {
-
- /* If not IXP42X A0 stepping, proceed to check for existence of npe's */
- if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
- (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
- || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
- {
- if (npeId == IX_NPEDL_NPEID_NPEA &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does"
- " not exist\n");
- return IX_SUCCESS;
- } /* end of if(npeId) */
-
- if (npeId == IX_NPEDL_NPEID_NPEB &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified does"
- " not exist\n");
- return IX_SUCCESS;
- } /* end of if(npeId) */
-
- if (npeId == IX_NPEDL_NPEID_NPEC &&
- (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED))
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified does"
- " not exist\n");
- return IX_SUCCESS;
- } /* end of if(npeId) */
- } /* end of if not IXP42x-A0 silicon */
-
- imageIdPtr->npeId = npeId;
- imageIdPtr->functionalityId = functionalityId;
- imageIdPtr->major = IMAGEID_MAJOR_NUMBER_DEFAULT;
- imageIdPtr->minor = IMAGEID_MINOR_NUMBER_DEFAULT;
- /* Call ImageMgr to get list of images listed in Image Library Header */
- status = ixNpeDlImageMgrLatestImageExtract(imageIdPtr);
- } /* end of if-else(npeId) */
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlLatestImageGet : status = %d\n",
- status);
-
- return status;
-}
-
-/*
- * Function definition: ixNpeDlNpeStopAndReset
- */
-PUBLIC IX_STATUS
-ixNpeDlNpeStopAndReset (IxNpeDlNpeId npeId)
-{
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeStopAndReset\n");
-
- /* Ensure initialisation has been completed */
- ixNpeDlNpeMgrInit();
-
- /* If not IXP42X A0 stepping, proceed to check for existence of npe's */
- if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
- (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
- || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
- {
- /*
- * Check whether NPE is present
- */
- if (IX_NPEDL_NPEID_NPEA == npeId)
- {
- /* Check whether NPE A is present */
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- /* NPE A does not present */
- IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeStopAndReset - Warning:NPEA does not present.\n");
- return IX_SUCCESS;
- }
- } /* end of if(IX_NPEDL_NPEID_NPEA) */
- else if (IX_NPEDL_NPEID_NPEB == npeId)
- {
- /* Check whether NPE B is present */
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- /* NPE B does not present */
- IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeStopAndReset - Warning:NPEB does not present.\n");
- return IX_SUCCESS;
- }
- } /* end of elseif(IX_NPEDL_NPEID_NPEB) */
- else if (IX_NPEDL_NPEID_NPEC == npeId)
- {
- /* Check whether NPE C is present */
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- /* NPE C does not present */
- IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeStopAndReset - Warning:NPEC does not present.\n");
- return IX_SUCCESS;
- }
- } /* end of elseif(IX_NPEDL_NPEID_NPEC) */
- else
- {
- /* Invalid NPE ID */
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeStopAndReset - invalid Npe ID\n");
- status = IX_NPEDL_PARAM_ERR;
- } /* end of if-else(IX_NPEDL_NPEID_NPEC) */
- } /* end of if not IXP42x-A0 Silicon */
-
- if (status == IX_SUCCESS)
- {
- /* call NpeMgr function to stop the NPE */
- status = ixNpeDlNpeMgrNpeStop (npeId);
- if (status == IX_SUCCESS)
- {
- /* call NpeMgr function to reset the NPE */
- status = ixNpeDlNpeMgrNpeReset (npeId);
- }
- } /* end of if(status) */
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeStopAndReset : status = %d\n", status);
-
- if (IX_SUCCESS == status)
- {
- /* Indicate NPE has been stopped */
- ixNpeDlNpeStarted[npeId] = FALSE ;
- }
-
- return status;
-}
-
-/*
- * Function definition: ixNpeDlNpeExecutionStart
- */
-PUBLIC IX_STATUS
-ixNpeDlNpeExecutionStart (IxNpeDlNpeId npeId)
-{
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeExecutionStart\n");
-
- /* If not IXP42X A0 stepping, proceed to check for existence of npe's */
- if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
- (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
- || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
- {
- /*
- * Check whether NPE is present
- */
- if (IX_NPEDL_NPEID_NPEA == npeId)
- {
- /* Check whether NPE A is present */
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- /* NPE A does not present */
- IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStart - Warning:NPEA does not present.\n");
- return IX_SUCCESS;
- }
- } /* end of if(IX_NPEDL_NPEID_NPEA) */
- else if (IX_NPEDL_NPEID_NPEB == npeId)
- {
- /* Check whether NPE B is present */
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- /* NPE B does not present */
- IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStart - Warning:NPEB does not present.\n");
- return IX_SUCCESS;
- }
- } /* end of elseif(IX_NPEDL_NPEID_NPEB) */
- else if (IX_NPEDL_NPEID_NPEC == npeId)
- {
- /* Check whether NPE C is present */
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- /* NPE C does not present */
- IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStart - Warning:NPEC does not present.\n");
- return IX_SUCCESS;
- }
- } /* end of elseif(IX_NPEDL_NPEID_NPEC) */
- else
- {
- /* Invalid NPE ID */
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeExecutionStart - invalid Npe ID\n");
- return IX_NPEDL_PARAM_ERR;
- } /* end of if-else(IX_NPEDL_NPEID_NPEC) */
- } /* end of if not IXP42x-A0 Silicon */
-
- if (TRUE == ixNpeDlNpeStarted[npeId])
- {
- /* NPE has been started. */
- return IX_SUCCESS ;
- }
-
- /* Ensure initialisation has been completed */
- ixNpeDlNpeMgrInit();
-
- /* call NpeMgr function to start the NPE */
- status = ixNpeDlNpeMgrNpeStart (npeId);
-
- if (IX_SUCCESS == status)
- {
- /* Indicate NPE has started */
- ixNpeDlNpeStarted[npeId] = TRUE ;
- }
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeExecutionStart : status = %d\n",
- status);
-
- return status;
-}
-
-/*
- * Function definition: ixNpeDlNpeExecutionStop
- */
-PUBLIC IX_STATUS
-ixNpeDlNpeExecutionStop (IxNpeDlNpeId npeId)
-{
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeExecutionStop\n");
-
- /* Ensure initialisation has been completed */
- ixNpeDlNpeMgrInit();
-
- /* If not IXP42X A0 stepping, proceed to check for existence of npe's */
- if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
- (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
- || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
- {
- /*
- * Check whether NPE is present
- */
- if (IX_NPEDL_NPEID_NPEA == npeId)
- {
- /* Check whether NPE A is present */
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- /* NPE A does not present */
- IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStop - Warning:NPEA does not present.\n");
- return IX_SUCCESS;
- }
- } /* end of if(IX_NPEDL_NPEID_NPEA) */
- else if (IX_NPEDL_NPEID_NPEB == npeId)
- {
- /* Check whether NPE B is present */
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- /* NPE B does not present */
- IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStop - Warning:NPEB does not present.\n");
- return IX_SUCCESS;
- }
- } /* end of elseif(IX_NPEDL_NPEID_NPEB) */
- else if (IX_NPEDL_NPEID_NPEC == npeId)
- {
- /* Check whether NPE C is present */
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- /* NPE C does not present */
- IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStop - Warning:NPEC does not present.\n");
- return IX_SUCCESS;
- }
- } /* end of elseif(IX_NPEDL_NPEID_NPEC) */
- else
- {
- /* Invalid NPE ID */
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeExecutionStop - invalid Npe ID\n");
- status = IX_NPEDL_PARAM_ERR;
- } /* end of if-else(IX_NPEDL_NPEID_NPEC) */
- } /* end of if not IXP42X-AO Silicon */
-
- if (status == IX_SUCCESS)
- {
- /* call NpeMgr function to stop the NPE */
- status = ixNpeDlNpeMgrNpeStop (npeId);
- }
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeExecutionStop : status = %d\n",
- status);
-
- if (IX_SUCCESS == status)
- {
- /* Indicate NPE has been stopped */
- ixNpeDlNpeStarted[npeId] = FALSE ;
- }
-
- return status;
-}
-
-/*
- * Function definition: ixNpeDlUnload
- */
-PUBLIC IX_STATUS
-ixNpeDlUnload (void)
-{
- IX_STATUS status;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlUnload\n");
-
- status = ixNpeDlNpeMgrUninit();
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlUnload : status = %d\n",
- status);
- return status;
-}
-
-/*
- * Function definition: ixNpeDlStatsShow
- */
-PUBLIC void
-ixNpeDlStatsShow (void)
-{
- ixOsalLog (IX_OSAL_LOG_LVL_USER,
- IX_OSAL_LOG_DEV_STDOUT,
- "\nixNpeDlStatsShow:\n"
- "\tDownloads Attempted by user: %u\n"
- "\tSuccessful Downloads: %u\n"
- "\tFailed Downloads (due to Critical Error): %u\n\n",
- ixNpeDlStats.attemptedDownloads,
- ixNpeDlStats.successfulDownloads,
- ixNpeDlStats.criticalFailDownloads,
- 0,0,0);
-
- ixNpeDlImageMgrStatsShow ();
- ixNpeDlNpeMgrStatsShow ();
-}
-
-/*
- * Function definition: ixNpeDlStatsReset
- */
-PUBLIC void
-ixNpeDlStatsReset (void)
-{
- ixNpeDlStats.attemptedDownloads = 0;
- ixNpeDlStats.successfulDownloads = 0;
- ixNpeDlStats.criticalFailDownloads = 0;
-
- ixNpeDlImageMgrStatsReset ();
- ixNpeDlNpeMgrStatsReset ();
-}
-
-/*
- * Function definition: ixNpeDlNpeInitAndStartInternal
- */
-PRIVATE IX_STATUS
-ixNpeDlNpeInitAndStartInternal (UINT32 *imageLibrary,
- UINT32 imageId)
-{
- UINT32 imageSize;
- UINT32 *imageCodePtr = NULL;
- IX_STATUS status;
- IxNpeDlNpeId npeId = IX_NPEDL_NPEID_FROM_IMAGEID_GET(imageId);
- IxFeatureCtrlDeviceId deviceId = IX_NPEDL_DEVICEID_FROM_IMAGEID_GET(imageId);
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeInitAndStartInternal\n");
-
- ixNpeDlStats.attemptedDownloads++;
-
- /* Check input parameter device correctness */
- if ((deviceId >= IX_FEATURE_CTRL_DEVICE_TYPE_MAX) ||
- (deviceId < IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X))
- {
- status = IX_NPEDL_PARAM_ERR;
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeInitAndStartInternal - "
- "invalid parameter\n");
- } /* End valid device id checking */
-
- /* Check input parameters */
- else if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0))
- {
- status = IX_NPEDL_PARAM_ERR;
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeInitAndStartInternal - "
- "invalid parameter\n");
- }
-
- else
- {
- /* Ensure initialisation has been completed */
- ixNpeDlNpeMgrInit();
-
- /* Checking if image being loaded is meant for device that is running.
- * Image is forward compatible. i.e Image built for IXP42X should run
- * on IXP46X but not vice versa.*/
- if (deviceId > (ixFeatureCtrlDeviceRead() & IX_FEATURE_CTRL_DEVICE_TYPE_MASK))
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeInitAndStartInternal - "
- "Device type mismatch. NPE Image not "
- "meant for device in use \n");
- return IX_NPEDL_DEVICE_ERR;
- }/* if statement - matching image device and current device */
-
- /* If not IXP42X A0 stepping, proceed to check for existence of npe's */
- if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 !=
- (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK))
- || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ()))
- {
- if (npeId == IX_NPEDL_NPEID_NPEA)
- {
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) ==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does"
- " not exist\n");
- return IX_SUCCESS;
- }
- } /* end of if(npeId) */
- else if (npeId == IX_NPEDL_NPEID_NPEB)
- {
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified"
- " does not exist\n");
- return IX_SUCCESS;
- }
- } /* end of elseif(npeId) */
- else if (npeId == IX_NPEDL_NPEID_NPEC)
- {
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)==
- IX_FEATURE_CTRL_COMPONENT_DISABLED)
- {
- IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified"
- " does not exist\n");
- return IX_SUCCESS;
- }
- } /* end of elseif(npeId) */
- } /* end of if not IXP42X-A0 Silicon */
-
- /* stop and reset the NPE */
- status = ixNpeDlNpeStopAndReset (npeId);
- if (IX_SUCCESS != status)
- {
- IX_NPEDL_ERROR_REPORT ("Failed to stop and reset NPE\n");
- return status;
- }
-
- /* Locate image */
- status = ixNpeDlImageMgrImageFind (imageLibrary, imageId,
- &imageCodePtr, &imageSize);
- if (IX_SUCCESS == status)
- {
- /*
- * If download was successful, store image Id in list of
- * currently loaded images. If a critical error occured
- * during download, record that the NPE has an invalid image
- */
- status = ixNpeDlNpeMgrImageLoad (npeId, imageCodePtr, TRUE);
- if (IX_SUCCESS == status)
- {
- ixNpeDlNpeState[npeId].validImage = TRUE;
- ixNpeDlStats.successfulDownloads++;
-
- status = ixNpeDlNpeExecutionStart (npeId);
- }
- else if ((status == IX_NPEDL_CRITICAL_NPE_ERR) ||
- (status == IX_NPEDL_CRITICAL_MICROCODE_ERR))
- {
- ixNpeDlNpeState[npeId].validImage = FALSE;
- ixNpeDlStats.criticalFailDownloads++;
- }
-
- /* NOTE - The following section of code is here to support
- * a deprecated function ixNpeDlLoadedImageGet(). When that
- * function is removed from the API, this code should be revised.
- */
- ixNpeDlNpeState[npeId].imageId.npeId = npeId;
- ixNpeDlNpeState[npeId].imageId.functionalityId =
- IX_NPEDL_FUNCTIONID_FROM_IMAGEID_GET(imageId);
- ixNpeDlNpeState[npeId].imageId.major =
- IX_NPEDL_MAJOR_FROM_IMAGEID_GET(imageId);
- ixNpeDlNpeState[npeId].imageId.minor =
- IX_NPEDL_MINOR_FROM_IMAGEID_GET(imageId);
- } /* end of if(IX_SUCCESS) */ /* condition: image located successfully in microcode image */
- } /* end of if-else(npeId-deviceId) */ /* condition: parameter checks ok */
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeInitAndStartInternal : "
- "status = %d\n", status);
- return status;
-}
-
-/*
- * Function definition: ixNpeDlCustomImageNpeInitAndStart
- */
-PUBLIC IX_STATUS
-ixNpeDlCustomImageNpeInitAndStart (UINT32 *imageLibrary,
- UINT32 imageId)
-{
- IX_STATUS status;
-
- if (imageLibrary == NULL)
- {
- status = IX_NPEDL_PARAM_ERR;
- IX_NPEDL_ERROR_REPORT ("ixNpeDlCustomImageNpeInitAndStart "
- "- invalid parameter\n");
- }
- else
- {
- status = ixNpeDlNpeInitAndStartInternal (imageLibrary, imageId);
- } /* end of if-else(imageLibrary) */
-
- return status;
-}
-
-/*
- * Function definition: ixNpeDlNpeInitAndStart
- */
-PUBLIC IX_STATUS
-ixNpeDlNpeInitAndStart (UINT32 imageId)
-{
- return ixNpeDlNpeInitAndStartInternal (NULL, imageId);
-}
-
-/*
- * Function definition: ixNpeDlLoadedImageFunctionalityGet
- */
-PUBLIC IX_STATUS
-ixNpeDlLoadedImageFunctionalityGet (IxNpeDlNpeId npeId,
- UINT8 *functionalityId)
-{
- /* Check input parameters */
- if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0))
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlLoadedImageFunctionalityGet "
- "- invalid parameter\n");
- return IX_NPEDL_PARAM_ERR;
- }
- if (functionalityId == NULL)
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlLoadedImageFunctionalityGet "
- "- invalid parameter\n");
- return IX_NPEDL_PARAM_ERR;
- }
-
- if (ixNpeDlNpeState[npeId].validImage)
- {
- *functionalityId = ixNpeDlNpeState[npeId].imageId.functionalityId;
- return IX_SUCCESS;
- }
- else
- {
- return IX_FAIL;
- }
-}
diff --git a/cpu/ixp/npe/IxNpeDlImageMgr.c b/cpu/ixp/npe/IxNpeDlImageMgr.c
deleted file mode 100644
index e05c228537..0000000000
--- a/cpu/ixp/npe/IxNpeDlImageMgr.c
+++ /dev/null
@@ -1,675 +0,0 @@
-/**
- * @file IxNpeDlImageMgr.c
- *
- * @author Intel Corporation
- * @date 09 January 2002
- *
- * @brief This file contains the implementation of the private API for the
- * IXP425 NPE Downloader ImageMgr module
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-
-/*
- * Put the system defined include files required.
- */
-#include "IxOsal.h"
-
-/*
- * Put the user defined include files required.
- */
-#include "IxNpeDlImageMgr_p.h"
-#include "IxNpeDlMacros_p.h"
-
-/*
- * define the flag which toggles the firmare inclusion
- */
-#define IX_NPE_MICROCODE_FIRMWARE_INCLUDED 1
-#include "IxNpeMicrocode.h"
-
-/*
- * Indicates the start of an NPE Image, in new NPE Image Library format.
- * 2 consecutive occurances indicates the end of the NPE Image Library
- */
-#define NPE_IMAGE_MARKER 0xfeedf00d
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-/*
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * TO BE DEPRECATED IN A FUTURE RELEASE
- */
-typedef struct
-{
- UINT32 size;
- UINT32 offset;
- UINT32 id;
-} IxNpeDlImageMgrImageEntry;
-
-/*
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * TO BE DEPRECATED IN A FUTURE RELEASE
- */
-typedef union
-{
- IxNpeDlImageMgrImageEntry image;
- UINT32 eohMarker;
-} IxNpeDlImageMgrHeaderEntry;
-
-/*
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * TO BE DEPRECATED IN A FUTURE RELEASE
- */
-typedef struct
-{
- UINT32 signature;
- /* 1st entry in the header (there may be more than one) */
- IxNpeDlImageMgrHeaderEntry entry[1];
-} IxNpeDlImageMgrImageLibraryHeader;
-
-
-/*
- * NPE Image Header definition, used in new NPE Image Library format
- */
-typedef struct
-{
- UINT32 marker;
- UINT32 id;
- UINT32 size;
-} IxNpeDlImageMgrImageHeader;
-
-/* module statistics counters */
-typedef struct
-{
- UINT32 invalidSignature;
- UINT32 imageIdListOverflow;
- UINT32 imageIdNotFound;
-} IxNpeDlImageMgrStats;
-
-
-/*
- * Variable declarations global to this file only. Externs are followed by
- * static variables.
- */
-static IxNpeDlImageMgrStats ixNpeDlImageMgrStats;
-
-/* default image */
-#ifdef IX_NPEDL_READ_MICROCODE_FROM_FILE
-static UINT32 *IxNpeMicroCodeImageLibrary = NULL; /* Gets set to proper value at runtime */
-#else
-static UINT32 *IxNpeMicroCodeImageLibrary = (UINT32 *)IxNpeMicrocode_array;
-#endif
-
-
-/*
- * static function prototypes.
- */
-PRIVATE BOOL
-ixNpeDlImageMgrSignatureCheck (UINT32 *microCodeImageLibrary);
-
-PRIVATE void
-ixNpeDlImageMgrImageIdFormat (UINT32 rawImageId, IxNpeDlImageId *imageId);
-
-PRIVATE BOOL
-ixNpeDlImageMgrImageIdCompare (IxNpeDlImageId *imageIdA,
- IxNpeDlImageId *imageIdB);
-
-PRIVATE BOOL
-ixNpeDlImageMgrNpeFunctionIdCompare (IxNpeDlImageId *imageIdA,
- IxNpeDlImageId *imageIdB);
-
-PRIVATE IX_STATUS
-ixNpeDlImageMgrImageFind_legacy (UINT32 *imageLibrary,
- UINT32 imageId,
- UINT32 **imagePtr,
- UINT32 *imageSize);
-
-/*
- * Function definition: ixNpeDlImageMgrMicrocodeImageLibraryOverride
- *
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
- */
-IX_STATUS
-ixNpeDlImageMgrMicrocodeImageLibraryOverride (
- UINT32 *clientImageLibrary)
-{
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlImageMgrMicrocodeImageLibraryOverride\n");
-
- if (ixNpeDlImageMgrSignatureCheck (clientImageLibrary))
- {
- IxNpeMicroCodeImageLibrary = clientImageLibrary;
- }
- else
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrMicrocodeImageLibraryOverride: "
- "Client-supplied image has invalid signature\n");
- status = IX_FAIL;
- }
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlImageMgrMicrocodeImageLibraryOverride: status = %d\n",
- status);
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlImageMgrImageListExtract
- *
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
- */
-IX_STATUS
-ixNpeDlImageMgrImageListExtract (
- IxNpeDlImageId *imageListPtr,
- UINT32 *numImages)
-{
- UINT32 rawImageId;
- IxNpeDlImageId formattedImageId;
- IX_STATUS status = IX_SUCCESS;
- UINT32 imageCount = 0;
- IxNpeDlImageMgrImageLibraryHeader *header;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlImageMgrImageListExtract\n");
-
- header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary;
-
- if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary))
- {
- /* for each image entry in the image header ... */
- while (header->entry[imageCount].eohMarker !=
- IX_NPEDL_IMAGEMGR_END_OF_HEADER)
- {
- /*
- * if the image list container from calling function has capacity,
- * add the image id to the list
- */
- if ((imageListPtr != NULL) && (imageCount < *numImages))
- {
- rawImageId = header->entry[imageCount].image.id;
- ixNpeDlImageMgrImageIdFormat (rawImageId, &formattedImageId);
- imageListPtr[imageCount] = formattedImageId;
- }
- /* imageCount reflects no. of image entries in image library header */
- imageCount++;
- }
-
- /*
- * if image list container from calling function was too small to
- * contain all image ids in the header, set return status to FAIL
- */
- if ((imageListPtr != NULL) && (imageCount > *numImages))
- {
- status = IX_FAIL;
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageListExtract: "
- "number of Ids found exceeds list capacity\n");
- ixNpeDlImageMgrStats.imageIdListOverflow++;
- }
- /* return number of image ids found in image library header */
- *numImages = imageCount;
- }
- else
- {
- status = IX_FAIL;
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageListExtract: "
- "invalid signature in image\n");
- }
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlImageMgrImageListExtract: status = %d\n",
- status);
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlImageMgrImageLocate
- *
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
- */
-IX_STATUS
-ixNpeDlImageMgrImageLocate (
- IxNpeDlImageId *imageId,
- UINT32 **imagePtr,
- UINT32 *imageSize)
-{
- UINT32 imageOffset;
- UINT32 rawImageId;
- IxNpeDlImageId formattedImageId;
- /* used to index image entries in image library header */
- UINT32 imageCount = 0;
- IX_STATUS status = IX_FAIL;
- IxNpeDlImageMgrImageLibraryHeader *header;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlImageMgrImageLocate\n");
-
- header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary;
-
- if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary))
- {
- /* for each image entry in the image library header ... */
- while (header->entry[imageCount].eohMarker !=
- IX_NPEDL_IMAGEMGR_END_OF_HEADER)
- {
- rawImageId = header->entry[imageCount].image.id;
- ixNpeDlImageMgrImageIdFormat (rawImageId, &formattedImageId);
- /* if a match for imageId is found in the image library header... */
- if (ixNpeDlImageMgrImageIdCompare (imageId, &formattedImageId))
- {
- /*
- * get pointer to the image in the image library using offset from
- * 1st word in image library
- */
- imageOffset = header->entry[imageCount].image.offset;
- *imagePtr = &IxNpeMicroCodeImageLibrary[imageOffset];
- /* get the image size */
- *imageSize = header->entry[imageCount].image.size;
- status = IX_SUCCESS;
- break;
- }
- imageCount++;
- }
- if (status != IX_SUCCESS)
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageLocate: "
- "imageId not found in image library header\n");
- ixNpeDlImageMgrStats.imageIdNotFound++;
- }
- }
- else
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageLocate: "
- "invalid signature in image library\n");
- }
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlImageMgrImageLocate: status = %d\n", status);
- return status;
-}
-
-/*
- * Function definition: ixNpeDlImageMgrLatestImageExtract
- *
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
- */
-IX_STATUS
-ixNpeDlImageMgrLatestImageExtract (IxNpeDlImageId *imageId)
-{
- UINT32 imageCount = 0;
- UINT32 rawImageId;
- IxNpeDlImageId formattedImageId;
- IX_STATUS status = IX_FAIL;
- IxNpeDlImageMgrImageLibraryHeader *header;
-
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlImageMgrLatestImageExtract\n");
-
- header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary;
-
- if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary))
- {
- /* for each image entry in the image library header ... */
- while (header->entry[imageCount].eohMarker !=
- IX_NPEDL_IMAGEMGR_END_OF_HEADER)
- {
- rawImageId = header->entry[imageCount].image.id;
- ixNpeDlImageMgrImageIdFormat (rawImageId, &formattedImageId);
- /*
- * if a match for the npe Id and functionality Id of the imageId is
- * found in the image library header...
- */
- if(ixNpeDlImageMgrNpeFunctionIdCompare(imageId, &formattedImageId))
- {
- if(imageId->major <= formattedImageId.major)
- {
- if(imageId->minor < formattedImageId.minor)
- {
- imageId->minor = formattedImageId.minor;
- }
- imageId->major = formattedImageId.major;
- }
- status = IX_SUCCESS;
- }
- imageCount++;
- }
- if (status != IX_SUCCESS)
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrLatestImageExtract: "
- "imageId not found in image library header\n");
- ixNpeDlImageMgrStats.imageIdNotFound++;
- }
- }
- else
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrLatestImageGet: "
- "invalid signature in image library\n");
- }
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlImageMgrLatestImageGet: status = %d\n", status);
- return status;
-}
-
-/*
- * Function definition: ixNpeDlImageMgrSignatureCheck
- *
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
- */
-PRIVATE BOOL
-ixNpeDlImageMgrSignatureCheck (UINT32 *microCodeImageLibrary)
-{
- IxNpeDlImageMgrImageLibraryHeader *header =
- (IxNpeDlImageMgrImageLibraryHeader *) microCodeImageLibrary;
- BOOL result = TRUE;
-
- if (header->signature != IX_NPEDL_IMAGEMGR_SIGNATURE)
- {
- result = FALSE;
- ixNpeDlImageMgrStats.invalidSignature++;
- }
-
- return result;
-}
-
-
-/*
- * Function definition: ixNpeDlImageMgrImageIdFormat
- *
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
- */
-PRIVATE void
-ixNpeDlImageMgrImageIdFormat (
- UINT32 rawImageId,
- IxNpeDlImageId *imageId)
-{
- imageId->npeId = (rawImageId >>
- IX_NPEDL_IMAGEID_NPEID_OFFSET) &
- IX_NPEDL_NPEIMAGE_FIELD_MASK;
- imageId->functionalityId = (rawImageId >>
- IX_NPEDL_IMAGEID_FUNCTIONID_OFFSET) &
- IX_NPEDL_NPEIMAGE_FIELD_MASK;
- imageId->major = (rawImageId >>
- IX_NPEDL_IMAGEID_MAJOR_OFFSET) &
- IX_NPEDL_NPEIMAGE_FIELD_MASK;
- imageId->minor = (rawImageId >>
- IX_NPEDL_IMAGEID_MINOR_OFFSET) &
- IX_NPEDL_NPEIMAGE_FIELD_MASK;
-
-}
-
-
-/*
- * Function definition: ixNpeDlImageMgrImageIdCompare
- *
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
- */
-PRIVATE BOOL
-ixNpeDlImageMgrImageIdCompare (
- IxNpeDlImageId *imageIdA,
- IxNpeDlImageId *imageIdB)
-{
- if ((imageIdA->npeId == imageIdB->npeId) &&
- (imageIdA->functionalityId == imageIdB->functionalityId) &&
- (imageIdA->major == imageIdB->major) &&
- (imageIdA->minor == imageIdB->minor))
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
-}
-
-/*
- * Function definition: ixNpeDlImageMgrNpeFunctionIdCompare
- *
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
- */
-PRIVATE BOOL
-ixNpeDlImageMgrNpeFunctionIdCompare (
- IxNpeDlImageId *imageIdA,
- IxNpeDlImageId *imageIdB)
-{
- if ((imageIdA->npeId == imageIdB->npeId) &&
- (imageIdA->functionalityId == imageIdB->functionalityId))
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
-}
-
-
-/*
- * Function definition: ixNpeDlImageMgrStatsShow
- */
-void
-ixNpeDlImageMgrStatsShow (void)
-{
- ixOsalLog (IX_OSAL_LOG_LVL_USER,
- IX_OSAL_LOG_DEV_STDOUT,
- "\nixNpeDlImageMgrStatsShow:\n"
- "\tInvalid Image Signatures: %u\n"
- "\tImage Id List capacity too small: %u\n"
- "\tImage Id not found: %u\n\n",
- ixNpeDlImageMgrStats.invalidSignature,
- ixNpeDlImageMgrStats.imageIdListOverflow,
- ixNpeDlImageMgrStats.imageIdNotFound,
- 0,0,0);
-}
-
-
-/*
- * Function definition: ixNpeDlImageMgrStatsReset
- */
-void
-ixNpeDlImageMgrStatsReset (void)
-{
- ixNpeDlImageMgrStats.invalidSignature = 0;
- ixNpeDlImageMgrStats.imageIdListOverflow = 0;
- ixNpeDlImageMgrStats.imageIdNotFound = 0;
-}
-
-
-/*
- * Function definition: ixNpeDlImageMgrImageFind_legacy
- *
- * FOR BACKWARD-COMPATIBILITY WITH OLD NPE IMAGE LIBRARY FORMAT
- * AND/OR LEGACY API FUNCTIONS. TO BE DEPRECATED IN A FUTURE RELEASE
- */
-PRIVATE IX_STATUS
-ixNpeDlImageMgrImageFind_legacy (
- UINT32 *imageLibrary,
- UINT32 imageId,
- UINT32 **imagePtr,
- UINT32 *imageSize)
-{
- UINT32 imageOffset;
- /* used to index image entries in image library header */
- UINT32 imageCount = 0;
- IX_STATUS status = IX_FAIL;
- IxNpeDlImageMgrImageLibraryHeader *header;
- BOOL imageFound = FALSE;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlImageMgrImageFind\n");
-
-
- /* If user didn't specify a library to use, use the default
- * one from IxNpeMicrocode.h
- */
- if (imageLibrary == NULL)
- {
- imageLibrary = IxNpeMicroCodeImageLibrary;
- }
-
- if (ixNpeDlImageMgrSignatureCheck (imageLibrary))
- {
- header = (IxNpeDlImageMgrImageLibraryHeader *) imageLibrary;
-
- /* for each image entry in the image library header ... */
- while ((header->entry[imageCount].eohMarker !=
- IX_NPEDL_IMAGEMGR_END_OF_HEADER) && !(imageFound))
- {
- /* if a match for imageId is found in the image library header... */
- if (imageId == header->entry[imageCount].image.id)
- {
- /*
- * get pointer to the image in the image library using offset from
- * 1st word in image library
- */
- imageOffset = header->entry[imageCount].image.offset;
- *imagePtr = &imageLibrary[imageOffset];
- /* get the image size */
- *imageSize = header->entry[imageCount].image.size;
- status = IX_SUCCESS;
- imageFound = TRUE;
- }
- imageCount++;
- }
- if (status != IX_SUCCESS)
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageFind: "
- "imageId not found in image library header\n");
- ixNpeDlImageMgrStats.imageIdNotFound++;
- }
- }
- else
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageFind: "
- "invalid signature in image library\n");
- }
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlImageMgrImageFind: status = %d\n", status);
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlImageMgrImageFind
- */
-IX_STATUS
-ixNpeDlImageMgrImageFind (
- UINT32 *imageLibrary,
- UINT32 imageId,
- UINT32 **imagePtr,
- UINT32 *imageSize)
-{
- IxNpeDlImageMgrImageHeader *image;
- UINT32 offset = 0;
-
- /* If user didn't specify a library to use, use the default
- * one from IxNpeMicrocode.h
- */
- if (imageLibrary == NULL)
- {
-#ifdef IX_NPEDL_READ_MICROCODE_FROM_FILE
- if (ixNpeMicrocode_binaryArray == NULL)
- {
- printk (KERN_ERR "ixp400.o: ERROR, no Microcode found in memory\n");
- return IX_FAIL;
- }
- else
- {
- imageLibrary = ixNpeMicrocode_binaryArray;
- }
-#else
- imageLibrary = IxNpeMicroCodeImageLibrary;
-#endif /* IX_NPEDL_READ_MICROCODE_FROM_FILE */
- }
-
- /* For backward's compatibility with previous image format */
- if (ixNpeDlImageMgrSignatureCheck(imageLibrary))
- {
- return ixNpeDlImageMgrImageFind_legacy(imageLibrary,
- imageId,
- imagePtr,
- imageSize);
- }
-
- while (*(imageLibrary+offset) == NPE_IMAGE_MARKER)
- {
- image = (IxNpeDlImageMgrImageHeader *)(imageLibrary+offset);
- offset += sizeof(IxNpeDlImageMgrImageHeader)/sizeof(UINT32);
-
- if (image->id == imageId)
- {
- *imagePtr = imageLibrary + offset;
- *imageSize = image->size;
- return IX_SUCCESS;
- }
- /* 2 consecutive NPE_IMAGE_MARKER's indicates end of library */
- else if (image->id == NPE_IMAGE_MARKER)
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageFind: "
- "imageId not found in image library header\n");
- ixNpeDlImageMgrStats.imageIdNotFound++;
- /* reached end of library, image not found */
- return IX_FAIL;
- }
- offset += image->size;
- }
-
- /* If we get here, our image library may be corrupted */
- IX_NPEDL_ERROR_REPORT ("ixNpeDlImageMgrImageFind: "
- "image library format may be invalid or corrupted\n");
- return IX_FAIL;
-}
-
diff --git a/cpu/ixp/npe/IxNpeDlNpeMgr.c b/cpu/ixp/npe/IxNpeDlNpeMgr.c
deleted file mode 100644
index f5a4c5f508..0000000000
--- a/cpu/ixp/npe/IxNpeDlNpeMgr.c
+++ /dev/null
@@ -1,936 +0,0 @@
-/**
- * @file IxNpeDlNpeMgr.c
- *
- * @author Intel Corporation
- * @date 09 January 2002
- *
- * @brief This file contains the implementation of the private API for the
- * IXP425 NPE Downloader NpeMgr module
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-
-/*
- * Put the user defined include files required.
- */
-
-
-/*
- * Put the user defined include files required.
- */
-#include "IxOsal.h"
-#include "IxNpeDl.h"
-#include "IxNpeDlNpeMgr_p.h"
-#include "IxNpeDlNpeMgrUtils_p.h"
-#include "IxNpeDlNpeMgrEcRegisters_p.h"
-#include "IxNpeDlMacros_p.h"
-#include "IxFeatureCtrl.h"
-
-/*
- * #defines and macros used in this file.
- */
-#define IX_NPEDL_BYTES_PER_WORD 4
-
-/* used to read download map from version in microcode image */
-#define IX_NPEDL_BLOCK_TYPE_INSTRUCTION 0x00000000
-#define IX_NPEDL_BLOCK_TYPE_DATA 0x00000001
-#define IX_NPEDL_BLOCK_TYPE_STATE 0x00000002
-#define IX_NPEDL_END_OF_DOWNLOAD_MAP 0x0000000F
-
-/*
- * masks used to extract address info from State information context
- * register addresses as read from microcode image
- */
-#define IX_NPEDL_MASK_STATE_ADDR_CTXT_REG 0x0000000F
-#define IX_NPEDL_MASK_STATE_ADDR_CTXT_NUM 0x000000F0
-
-/* LSB offset of Context Number field in State-Info Context Address */
-#define IX_NPEDL_OFFSET_STATE_ADDR_CTXT_NUM 4
-
-/* size (in words) of single State Information entry (ctxt reg address|data) */
-#define IX_NPEDL_STATE_INFO_ENTRY_SIZE 2
-
-
- #define IX_NPEDL_RESET_NPE_PARITY 0x0800
- #define IX_NPEDL_PARITY_BIT_MASK 0x3F00FFFF
- #define IX_NPEDL_CONFIG_CTRL_REG_MASK 0x3F3FFFFF
-
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-typedef struct
-{
- UINT32 type;
- UINT32 offset;
-} IxNpeDlNpeMgrDownloadMapBlockEntry;
-
-typedef union
-{
- IxNpeDlNpeMgrDownloadMapBlockEntry block;
- UINT32 eodmMarker;
-} IxNpeDlNpeMgrDownloadMapEntry;
-
-typedef struct
-{
- /* 1st entry in the download map (there may be more than one) */
- IxNpeDlNpeMgrDownloadMapEntry entry[1];
-} IxNpeDlNpeMgrDownloadMap;
-
-
-/* used to access an instruction or data block in a microcode image */
-typedef struct
-{
- UINT32 npeMemAddress;
- UINT32 size;
- UINT32 data[1];
-} IxNpeDlNpeMgrCodeBlock;
-
-/* used to access each Context Reg entry state-information block */
-typedef struct
-{
- UINT32 addressInfo;
- UINT32 value;
-} IxNpeDlNpeMgrStateInfoCtxtRegEntry;
-
-/* used to access a state-information block in a microcode image */
-typedef struct
-{
- UINT32 size;
- IxNpeDlNpeMgrStateInfoCtxtRegEntry ctxtRegEntry[1];
-} IxNpeDlNpeMgrStateInfoBlock;
-
-/* used to store some useful NPE information for easy access */
-typedef struct
-{
- UINT32 baseAddress;
- UINT32 insMemSize;
- UINT32 dataMemSize;
-} IxNpeDlNpeInfo;
-
-/* used to distinguish instruction and data memory operations */
-typedef enum
-{
- IX_NPEDL_MEM_TYPE_INSTRUCTION = 0,
- IX_NPEDL_MEM_TYPE_DATA
-} IxNpeDlNpeMemType;
-
-/* used to hold a reset value for a particular ECS register */
-typedef struct
-{
- UINT32 regAddr;
- UINT32 regResetVal;
-} IxNpeDlEcsRegResetValue;
-
-/* prototype of function to write either Instruction or Data memory */
-typedef IX_STATUS (*IxNpeDlNpeMgrMemWrite) (UINT32 npeBaseAddress,
- UINT32 npeMemAddress,
- UINT32 npeMemData,
- BOOL verify);
-
-/* module statistics counters */
-typedef struct
-{
- UINT32 instructionBlocksLoaded;
- UINT32 dataBlocksLoaded;
- UINT32 stateInfoBlocksLoaded;
- UINT32 criticalNpeErrors;
- UINT32 criticalMicrocodeErrors;
- UINT32 npeStarts;
- UINT32 npeStops;
- UINT32 npeResets;
-} IxNpeDlNpeMgrStats;
-
-
-/*
- * Variable declarations global to this file only. Externs are followed by
- * static variables.
- */
-static IxNpeDlNpeInfo ixNpeDlNpeInfo[] =
-{
- {
- 0,
- IX_NPEDL_INS_MEMSIZE_WORDS_NPEA,
- IX_NPEDL_DATA_MEMSIZE_WORDS_NPEA
- },
- {
- 0,
- IX_NPEDL_INS_MEMSIZE_WORDS_NPEB,
- IX_NPEDL_DATA_MEMSIZE_WORDS_NPEB
- },
- {
- 0,
- IX_NPEDL_INS_MEMSIZE_WORDS_NPEC,
- IX_NPEDL_DATA_MEMSIZE_WORDS_NPEC
- }
-};
-
-/* contains Reset values for Context Store Registers */
-static UINT32 ixNpeDlCtxtRegResetValues[] =
-{
- IX_NPEDL_CTXT_REG_RESET_STEVT,
- IX_NPEDL_CTXT_REG_RESET_STARTPC,
- IX_NPEDL_CTXT_REG_RESET_REGMAP,
- IX_NPEDL_CTXT_REG_RESET_CINDEX,
-};
-
-/* contains Reset values for Context Store Registers */
-static IxNpeDlEcsRegResetValue ixNpeDlEcsRegResetValues[] =
-{
- {IX_NPEDL_ECS_BG_CTXT_REG_0, IX_NPEDL_ECS_BG_CTXT_REG_0_RESET},
- {IX_NPEDL_ECS_BG_CTXT_REG_1, IX_NPEDL_ECS_BG_CTXT_REG_1_RESET},
- {IX_NPEDL_ECS_BG_CTXT_REG_2, IX_NPEDL_ECS_BG_CTXT_REG_2_RESET},
- {IX_NPEDL_ECS_PRI_1_CTXT_REG_0, IX_NPEDL_ECS_PRI_1_CTXT_REG_0_RESET},
- {IX_NPEDL_ECS_PRI_1_CTXT_REG_1, IX_NPEDL_ECS_PRI_1_CTXT_REG_1_RESET},
- {IX_NPEDL_ECS_PRI_1_CTXT_REG_2, IX_NPEDL_ECS_PRI_1_CTXT_REG_2_RESET},
- {IX_NPEDL_ECS_PRI_2_CTXT_REG_0, IX_NPEDL_ECS_PRI_2_CTXT_REG_0_RESET},
- {IX_NPEDL_ECS_PRI_2_CTXT_REG_1, IX_NPEDL_ECS_PRI_2_CTXT_REG_1_RESET},
- {IX_NPEDL_ECS_PRI_2_CTXT_REG_2, IX_NPEDL_ECS_PRI_2_CTXT_REG_2_RESET},
- {IX_NPEDL_ECS_DBG_CTXT_REG_0, IX_NPEDL_ECS_DBG_CTXT_REG_0_RESET},
- {IX_NPEDL_ECS_DBG_CTXT_REG_1, IX_NPEDL_ECS_DBG_CTXT_REG_1_RESET},
- {IX_NPEDL_ECS_DBG_CTXT_REG_2, IX_NPEDL_ECS_DBG_CTXT_REG_2_RESET},
- {IX_NPEDL_ECS_INSTRUCT_REG, IX_NPEDL_ECS_INSTRUCT_REG_RESET}
-};
-
-static IxNpeDlNpeMgrStats ixNpeDlNpeMgrStats;
-
-/* Set when NPE register memory has been mapped */
-static BOOL ixNpeDlMemInitialised = FALSE;
-
-
-/*
- * static function prototypes.
- */
-PRIVATE IX_STATUS
-ixNpeDlNpeMgrMemLoad (IxNpeDlNpeId npeId, UINT32 npeBaseAddress,
- IxNpeDlNpeMgrCodeBlock *codeBlockPtr,
- BOOL verify, IxNpeDlNpeMemType npeMemType);
-PRIVATE IX_STATUS
-ixNpeDlNpeMgrStateInfoLoad (UINT32 npeBaseAddress,
- IxNpeDlNpeMgrStateInfoBlock *codeBlockPtr,
- BOOL verify);
-PRIVATE BOOL
-ixNpeDlNpeMgrBitsSetCheck (UINT32 npeBaseAddress, UINT32 regOffset,
- UINT32 expectedBitsSet);
-
-PRIVATE UINT32
-ixNpeDlNpeMgrBaseAddressGet (IxNpeDlNpeId npeId);
-
-/*
- * Function definition: ixNpeDlNpeMgrBaseAddressGet
- */
-PRIVATE UINT32
-ixNpeDlNpeMgrBaseAddressGet (IxNpeDlNpeId npeId)
-{
- IX_OSAL_ASSERT (ixNpeDlMemInitialised);
- return ixNpeDlNpeInfo[npeId].baseAddress;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrInit
- */
-void
-ixNpeDlNpeMgrInit (void)
-{
- /* Only map the memory once */
- if (!ixNpeDlMemInitialised)
- {
- UINT32 virtAddr;
-
- /* map the register memory for NPE-A */
- virtAddr = (UINT32) IX_OSAL_MEM_MAP (IX_NPEDL_NPEBASEADDRESS_NPEA,
- IX_OSAL_IXP400_NPEA_MAP_SIZE);
- IX_OSAL_ASSERT(virtAddr);
- ixNpeDlNpeInfo[IX_NPEDL_NPEID_NPEA].baseAddress = virtAddr;
-
- /* map the register memory for NPE-B */
- virtAddr = (UINT32) IX_OSAL_MEM_MAP (IX_NPEDL_NPEBASEADDRESS_NPEB,
- IX_OSAL_IXP400_NPEB_MAP_SIZE);
- IX_OSAL_ASSERT(virtAddr);
- ixNpeDlNpeInfo[IX_NPEDL_NPEID_NPEB].baseAddress = virtAddr;
-
- /* map the register memory for NPE-C */
- virtAddr = (UINT32) IX_OSAL_MEM_MAP (IX_NPEDL_NPEBASEADDRESS_NPEC,
- IX_OSAL_IXP400_NPEC_MAP_SIZE);
- IX_OSAL_ASSERT(virtAddr);
- ixNpeDlNpeInfo[IX_NPEDL_NPEID_NPEC].baseAddress = virtAddr;
-
- ixNpeDlMemInitialised = TRUE;
- }
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrUninit
- */
-IX_STATUS
-ixNpeDlNpeMgrUninit (void)
-{
- if (!ixNpeDlMemInitialised)
- {
- return IX_FAIL;
- }
-
- IX_OSAL_MEM_UNMAP (ixNpeDlNpeInfo[IX_NPEDL_NPEID_NPEA].baseAddress);
- IX_OSAL_MEM_UNMAP (ixNpeDlNpeInfo[IX_NPEDL_NPEID_NPEB].baseAddress);
- IX_OSAL_MEM_UNMAP (ixNpeDlNpeInfo[IX_NPEDL_NPEID_NPEC].baseAddress);
-
- ixNpeDlNpeInfo[IX_NPEDL_NPEID_NPEA].baseAddress = 0;
- ixNpeDlNpeInfo[IX_NPEDL_NPEID_NPEB].baseAddress = 0;
- ixNpeDlNpeInfo[IX_NPEDL_NPEID_NPEC].baseAddress = 0;
-
- ixNpeDlMemInitialised = FALSE;
-
- return IX_SUCCESS;
-}
-
-/*
- * Function definition: ixNpeDlNpeMgrImageLoad
- */
-IX_STATUS
-ixNpeDlNpeMgrImageLoad (
- IxNpeDlNpeId npeId,
- UINT32 *imageCodePtr,
- BOOL verify)
-{
- UINT32 npeBaseAddress;
- IxNpeDlNpeMgrDownloadMap *downloadMap;
- UINT32 *blockPtr;
- UINT32 mapIndex = 0;
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrImageLoad\n");
-
- /* get base memory address of NPE from npeId */
- npeBaseAddress = ixNpeDlNpeMgrBaseAddressGet (npeId);
-
- /* check execution status of NPE to verify NPE Stop was successful */
- if (!ixNpeDlNpeMgrBitsSetCheck (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXCTL,
- IX_NPEDL_EXCTL_STATUS_STOP))
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrImageDownload - "
- "NPE was not stopped before download\n");
- status = IX_FAIL;
- }
- else
- {
- /*
- * Read Download Map, checking each block type and calling
- * appropriate function to perform download
- */
- downloadMap = (IxNpeDlNpeMgrDownloadMap *) imageCodePtr;
- while ((downloadMap->entry[mapIndex].eodmMarker !=
- IX_NPEDL_END_OF_DOWNLOAD_MAP)
- && (status == IX_SUCCESS))
- {
- /* calculate pointer to block to be downloaded */
- blockPtr = imageCodePtr +
- downloadMap->entry[mapIndex].block.offset;
-
- switch (downloadMap->entry[mapIndex].block.type)
- {
- case IX_NPEDL_BLOCK_TYPE_INSTRUCTION:
- status = ixNpeDlNpeMgrMemLoad (npeId, npeBaseAddress,
- (IxNpeDlNpeMgrCodeBlock *)blockPtr,
- verify,
- IX_NPEDL_MEM_TYPE_INSTRUCTION);
- break;
- case IX_NPEDL_BLOCK_TYPE_DATA:
- status = ixNpeDlNpeMgrMemLoad (npeId, npeBaseAddress,
- (IxNpeDlNpeMgrCodeBlock *)blockPtr,
- verify, IX_NPEDL_MEM_TYPE_DATA);
- break;
- case IX_NPEDL_BLOCK_TYPE_STATE:
- status = ixNpeDlNpeMgrStateInfoLoad (npeBaseAddress,
- (IxNpeDlNpeMgrStateInfoBlock *) blockPtr,
- verify);
- break;
- default:
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrImageLoad: "
- "unknown block type in download map\n");
- status = IX_NPEDL_CRITICAL_MICROCODE_ERR;
- ixNpeDlNpeMgrStats.criticalMicrocodeErrors++;
- break;
- }
- mapIndex++;
- }/* loop: for each entry in download map, while status == SUCCESS */
- }/* condition: NPE stopped before attempting download */
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrImageLoad : status = %d\n",
- status);
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrMemLoad
- */
-PRIVATE IX_STATUS
-ixNpeDlNpeMgrMemLoad (
- IxNpeDlNpeId npeId,
- UINT32 npeBaseAddress,
- IxNpeDlNpeMgrCodeBlock *blockPtr,
- BOOL verify,
- IxNpeDlNpeMemType npeMemType)
-{
- UINT32 npeMemAddress;
- UINT32 blockSize;
- UINT32 memSize = 0;
- IxNpeDlNpeMgrMemWrite memWriteFunc = NULL;
- UINT32 localIndex = 0;
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrMemLoad\n");
-
- /*
- * select NPE EXCTL reg read/write commands depending on memory
- * type (instruction/data) to be accessed
- */
- if (npeMemType == IX_NPEDL_MEM_TYPE_INSTRUCTION)
- {
- memSize = ixNpeDlNpeInfo[npeId].insMemSize;
- memWriteFunc = (IxNpeDlNpeMgrMemWrite) ixNpeDlNpeMgrInsMemWrite;
- }
- else if (npeMemType == IX_NPEDL_MEM_TYPE_DATA)
- {
- memSize = ixNpeDlNpeInfo[npeId].dataMemSize;
- memWriteFunc = (IxNpeDlNpeMgrMemWrite) ixNpeDlNpeMgrDataMemWrite;
- }
-
- /*
- * NPE memory is loaded contiguously from each block, so only address
- * of 1st word in block is needed
- */
- npeMemAddress = blockPtr->npeMemAddress;
- /* number of words of instruction/data microcode in block to download */
- blockSize = blockPtr->size;
- if ((npeMemAddress + blockSize) > memSize)
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrMemLoad: "
- "Block size too big for NPE memory\n");
- status = IX_NPEDL_CRITICAL_MICROCODE_ERR;
- ixNpeDlNpeMgrStats.criticalMicrocodeErrors++;
- }
- else
- {
- for (localIndex = 0; localIndex < blockSize; localIndex++)
- {
- status = memWriteFunc (npeBaseAddress, npeMemAddress,
- blockPtr->data[localIndex], verify);
-
- if (status != IX_SUCCESS)
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrMemLoad: "
- "write to NPE memory failed\n");
- status = IX_NPEDL_CRITICAL_NPE_ERR;
- ixNpeDlNpeMgrStats.criticalNpeErrors++;
- break; /* abort download */
- }
- /* increment target (word)address in NPE memory */
- npeMemAddress++;
- }
- }/* condition: block size will fit in NPE memory */
-
- if (status == IX_SUCCESS)
- {
- if (npeMemType == IX_NPEDL_MEM_TYPE_INSTRUCTION)
- {
- ixNpeDlNpeMgrStats.instructionBlocksLoaded++;
- }
- else if (npeMemType == IX_NPEDL_MEM_TYPE_DATA)
- {
- ixNpeDlNpeMgrStats.dataBlocksLoaded++;
- }
- }
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrMemLoad : status = %d\n", status);
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrStateInfoLoad
- */
-PRIVATE IX_STATUS
-ixNpeDlNpeMgrStateInfoLoad (
- UINT32 npeBaseAddress,
- IxNpeDlNpeMgrStateInfoBlock *blockPtr,
- BOOL verify)
-{
- UINT32 blockSize;
- UINT32 ctxtRegAddrInfo;
- UINT32 ctxtRegVal;
- IxNpeDlCtxtRegNum ctxtReg; /* identifies Context Store reg (0-3) */
- UINT32 ctxtNum; /* identifies Context number (0-16) */
- UINT32 i;
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrStateInfoLoad\n");
-
- /* block size contains number of words of state-info in block */
- blockSize = blockPtr->size;
-
- ixNpeDlNpeMgrDebugInstructionPreExec (npeBaseAddress);
-
- /* for each state-info context register entry in block */
- for (i = 0; i < (blockSize/IX_NPEDL_STATE_INFO_ENTRY_SIZE); i++)
- {
- /* each state-info entry is 2 words (address, value) in length */
- ctxtRegAddrInfo = (blockPtr->ctxtRegEntry[i]).addressInfo;
- ctxtRegVal = (blockPtr->ctxtRegEntry[i]).value;
-
- ctxtReg = (ctxtRegAddrInfo & IX_NPEDL_MASK_STATE_ADDR_CTXT_REG);
- ctxtNum = (ctxtRegAddrInfo & IX_NPEDL_MASK_STATE_ADDR_CTXT_NUM) >>
- IX_NPEDL_OFFSET_STATE_ADDR_CTXT_NUM;
-
- /* error-check Context Register No. and Context Number values */
- /* NOTE that there is no STEVT register for Context 0 */
- if ((ctxtReg < 0) ||
- (ctxtReg >= IX_NPEDL_CTXT_REG_MAX) ||
- (ctxtNum > IX_NPEDL_CTXT_NUM_MAX) ||
- ((ctxtNum == 0) && (ctxtReg == IX_NPEDL_CTXT_REG_STEVT)))
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrStateInfoLoad: "
- "invalid Context Register Address\n");
- status = IX_NPEDL_CRITICAL_MICROCODE_ERR;
- ixNpeDlNpeMgrStats.criticalMicrocodeErrors++;
- break; /* abort download */
- }
-
- status = ixNpeDlNpeMgrCtxtRegWrite (npeBaseAddress, ctxtNum, ctxtReg,
- ctxtRegVal, verify);
- if (status != IX_SUCCESS)
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrStateInfoLoad: "
- "write of state-info to NPE failed\n");
- status = IX_NPEDL_CRITICAL_NPE_ERR;
- ixNpeDlNpeMgrStats.criticalNpeErrors++;
- break; /* abort download */
- }
- }/* loop: for each context reg entry in State Info block */
-
- ixNpeDlNpeMgrDebugInstructionPostExec (npeBaseAddress);
-
- if (status == IX_SUCCESS)
- {
- ixNpeDlNpeMgrStats.stateInfoBlocksLoaded++;
- }
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrStateInfoLoad : status = %d\n",
- status);
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrNpeReset
- */
-IX_STATUS
-ixNpeDlNpeMgrNpeReset (
- IxNpeDlNpeId npeId)
-{
- UINT32 npeBaseAddress;
- IxNpeDlCtxtRegNum ctxtReg; /* identifies Context Store reg (0-3) */
- UINT32 ctxtNum; /* identifies Context number (0-16) */
- UINT32 regAddr;
- UINT32 regVal;
- UINT32 localIndex;
- UINT32 indexMax;
- IX_STATUS status = IX_SUCCESS;
- IxFeatureCtrlReg unitFuseReg;
- UINT32 ixNpeConfigCtrlRegVal;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrNpeReset\n");
-
- /* get base memory address of NPE from npeId */
- npeBaseAddress = ixNpeDlNpeMgrBaseAddressGet (npeId);
-
- /* pre-store the NPE Config Control Register Value */
- IX_NPEDL_REG_READ (npeBaseAddress, IX_NPEDL_REG_OFFSET_CTL, &ixNpeConfigCtrlRegVal);
-
- ixNpeConfigCtrlRegVal |= 0x3F000000;
-
- /* disable the parity interrupt */
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_CTL, (ixNpeConfigCtrlRegVal & IX_NPEDL_PARITY_BIT_MASK));
-
- ixNpeDlNpeMgrDebugInstructionPreExec (npeBaseAddress);
-
- /*
- * clear the FIFOs
- */
- while (ixNpeDlNpeMgrBitsSetCheck (npeBaseAddress,
- IX_NPEDL_REG_OFFSET_WFIFO,
- IX_NPEDL_MASK_WFIFO_VALID))
- {
- /* read from the Watch-point FIFO until empty */
- IX_NPEDL_REG_READ (npeBaseAddress, IX_NPEDL_REG_OFFSET_WFIFO,
- &regVal);
- }
-
- while (ixNpeDlNpeMgrBitsSetCheck (npeBaseAddress,
- IX_NPEDL_REG_OFFSET_STAT,
- IX_NPEDL_MASK_STAT_OFNE))
- {
- /* read from the outFIFO until empty */
- IX_NPEDL_REG_READ (npeBaseAddress, IX_NPEDL_REG_OFFSET_FIFO,
- &regVal);
- }
-
- while (ixNpeDlNpeMgrBitsSetCheck (npeBaseAddress,
- IX_NPEDL_REG_OFFSET_STAT,
- IX_NPEDL_MASK_STAT_IFNE))
- {
- /*
- * step execution of the NPE intruction to read inFIFO using
- * the Debug Executing Context stack
- */
- status = ixNpeDlNpeMgrDebugInstructionExec (npeBaseAddress,
- IX_NPEDL_INSTR_RD_FIFO, 0, 0);
-
- if (IX_SUCCESS != status)
- {
- return status;
- }
-
- }
-
- /*
- * Reset the mailbox reg
- */
- /* ...from XScale side */
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_MBST,
- IX_NPEDL_REG_RESET_MBST);
- /* ...from NPE side */
- status = ixNpeDlNpeMgrDebugInstructionExec (npeBaseAddress,
- IX_NPEDL_INSTR_RESET_MBOX, 0, 0);
-
- if (IX_SUCCESS != status)
- {
- return status;
- }
-
- /*
- * Reset the physical registers in the NPE register file:
- * Note: no need to save/restore REGMAP for Context 0 here
- * since all Context Store regs are reset in subsequent code
- */
- for (regAddr = 0;
- (regAddr < IX_NPEDL_TOTAL_NUM_PHYS_REG) && (status != IX_FAIL);
- regAddr++)
- {
- /* for each physical register in the NPE reg file, write 0 : */
- status = ixNpeDlNpeMgrPhysicalRegWrite (npeBaseAddress, regAddr,
- 0, TRUE);
- if (status != IX_SUCCESS)
- {
- return status; /* abort reset */
- }
- }
-
-
- /*
- * Reset the context store:
- */
- for (ctxtNum = IX_NPEDL_CTXT_NUM_MIN;
- ctxtNum <= IX_NPEDL_CTXT_NUM_MAX; ctxtNum++)
- {
- /* set each context's Context Store registers to reset values: */
- for (ctxtReg = 0; ctxtReg < IX_NPEDL_CTXT_REG_MAX; ctxtReg++)
- {
- /* NOTE that there is no STEVT register for Context 0 */
- if (!((ctxtNum == 0) && (ctxtReg == IX_NPEDL_CTXT_REG_STEVT)))
- {
- regVal = ixNpeDlCtxtRegResetValues[ctxtReg];
- status = ixNpeDlNpeMgrCtxtRegWrite (npeBaseAddress, ctxtNum,
- ctxtReg, regVal, TRUE);
- if (status != IX_SUCCESS)
- {
- return status; /* abort reset */
- }
- }
- }
- }
-
- ixNpeDlNpeMgrDebugInstructionPostExec (npeBaseAddress);
-
- /* write Reset values to Execution Context Stack registers */
- indexMax = sizeof (ixNpeDlEcsRegResetValues) /
- sizeof (IxNpeDlEcsRegResetValue);
- for (localIndex = 0; localIndex < indexMax; localIndex++)
- {
- regAddr = ixNpeDlEcsRegResetValues[localIndex].regAddr;
- regVal = ixNpeDlEcsRegResetValues[localIndex].regResetVal;
- ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, regAddr, regVal);
- }
-
- /* clear the profile counter */
- ixNpeDlNpeMgrCommandIssue (npeBaseAddress,
- IX_NPEDL_EXCTL_CMD_CLR_PROFILE_CNT);
-
- /* clear registers EXCT, AP0, AP1, AP2 and AP3 */
- for (regAddr = IX_NPEDL_REG_OFFSET_EXCT;
- regAddr <= IX_NPEDL_REG_OFFSET_AP3;
- regAddr += IX_NPEDL_BYTES_PER_WORD)
- {
- IX_NPEDL_REG_WRITE (npeBaseAddress, regAddr, 0);
- }
-
- /* Reset the Watch-count register */
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_WC, 0);
-
- /*
- * WR IXA00055043 - Remove IMEM Parity Introduced by NPE Reset Operation
- */
-
- /*
- * Call the feature control API to fused out and reset the NPE and its
- * coprocessor - to reset internal states and remove parity error
- */
- unitFuseReg = ixFeatureCtrlRead ();
- unitFuseReg |= (IX_NPEDL_RESET_NPE_PARITY << npeId);
- ixFeatureCtrlWrite (unitFuseReg);
-
- /* call the feature control API to un-fused and un-reset the NPE & COP */
- unitFuseReg &= (~(IX_NPEDL_RESET_NPE_PARITY << npeId));
- ixFeatureCtrlWrite (unitFuseReg);
-
- /*
- * Call NpeMgr function to stop the NPE again after the Feature Control
- * has unfused and Un-Reset the NPE and its associated Coprocessors
- */
- status = ixNpeDlNpeMgrNpeStop (npeId);
-
- /* restore NPE configuration bus Control Register - Parity Settings */
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_CTL,
- (ixNpeConfigCtrlRegVal & IX_NPEDL_CONFIG_CTRL_REG_MASK));
-
- ixNpeDlNpeMgrStats.npeResets++;
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrNpeReset : status = %d\n", status);
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrNpeStart
- */
-IX_STATUS
-ixNpeDlNpeMgrNpeStart (
- IxNpeDlNpeId npeId)
-{
- UINT32 npeBaseAddress;
- UINT32 ecsRegVal;
- BOOL npeRunning;
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrNpeStart\n");
-
- /* get base memory address of NPE from npeId */
- npeBaseAddress = ixNpeDlNpeMgrBaseAddressGet (npeId);
-
- /*
- * ensure only Background Context Stack Level is Active by turning off
- * the Active bit in each of the other Executing Context Stack levels
- */
- ecsRegVal = ixNpeDlNpeMgrExecAccRegRead (npeBaseAddress,
- IX_NPEDL_ECS_PRI_1_CTXT_REG_0);
- ecsRegVal &= ~IX_NPEDL_MASK_ECS_REG_0_ACTIVE;
- ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_PRI_1_CTXT_REG_0,
- ecsRegVal);
-
- ecsRegVal = ixNpeDlNpeMgrExecAccRegRead (npeBaseAddress,
- IX_NPEDL_ECS_PRI_2_CTXT_REG_0);
- ecsRegVal &= ~IX_NPEDL_MASK_ECS_REG_0_ACTIVE;
- ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_PRI_2_CTXT_REG_0,
- ecsRegVal);
-
- ecsRegVal = ixNpeDlNpeMgrExecAccRegRead (npeBaseAddress,
- IX_NPEDL_ECS_DBG_CTXT_REG_0);
- ecsRegVal &= ~IX_NPEDL_MASK_ECS_REG_0_ACTIVE;
- ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_DBG_CTXT_REG_0,
- ecsRegVal);
-
- /* clear the pipeline */
- ixNpeDlNpeMgrCommandIssue (npeBaseAddress, IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE);
-
- /* start NPE execution by issuing command through EXCTL register on NPE */
- ixNpeDlNpeMgrCommandIssue (npeBaseAddress, IX_NPEDL_EXCTL_CMD_NPE_START);
-
- /*
- * check execution status of NPE to verify NPE Start operation was
- * successful
- */
- npeRunning = ixNpeDlNpeMgrBitsSetCheck (npeBaseAddress,
- IX_NPEDL_REG_OFFSET_EXCTL,
- IX_NPEDL_EXCTL_STATUS_RUN);
- if (npeRunning)
- {
- ixNpeDlNpeMgrStats.npeStarts++;
- }
- else
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrNpeStart: "
- "failed to start NPE execution\n");
- status = IX_FAIL;
- }
-
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrNpeStart : status = %d\n", status);
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrNpeStop
- */
-IX_STATUS
-ixNpeDlNpeMgrNpeStop (
- IxNpeDlNpeId npeId)
-{
- UINT32 npeBaseAddress;
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrNpeStop\n");
-
- /* get base memory address of NPE from npeId */
- npeBaseAddress = ixNpeDlNpeMgrBaseAddressGet (npeId);
-
- /* stop NPE execution by issuing command through EXCTL register on NPE */
- ixNpeDlNpeMgrCommandIssue (npeBaseAddress, IX_NPEDL_EXCTL_CMD_NPE_STOP);
-
- /* verify that NPE Stop was successful */
- if (! ixNpeDlNpeMgrBitsSetCheck (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXCTL,
- IX_NPEDL_EXCTL_STATUS_STOP))
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrNpeStop: "
- "failed to stop NPE execution\n");
- status = IX_FAIL;
- }
-
- ixNpeDlNpeMgrStats.npeStops++;
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrNpeStop : status = %d\n", status);
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrBitsSetCheck
- */
-PRIVATE BOOL
-ixNpeDlNpeMgrBitsSetCheck (
- UINT32 npeBaseAddress,
- UINT32 regOffset,
- UINT32 expectedBitsSet)
-{
- UINT32 regVal;
- IX_NPEDL_REG_READ (npeBaseAddress, regOffset, &regVal);
-
- return expectedBitsSet == (expectedBitsSet & regVal);
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrStatsShow
- */
-void
-ixNpeDlNpeMgrStatsShow (void)
-{
- ixOsalLog (IX_OSAL_LOG_LVL_USER,
- IX_OSAL_LOG_DEV_STDOUT,
- "\nixNpeDlNpeMgrStatsShow:\n"
- "\tInstruction Blocks loaded: %u\n"
- "\tData Blocks loaded: %u\n"
- "\tState Information Blocks loaded: %u\n"
- "\tCritical NPE errors: %u\n"
- "\tCritical Microcode errors: %u\n",
- ixNpeDlNpeMgrStats.instructionBlocksLoaded,
- ixNpeDlNpeMgrStats.dataBlocksLoaded,
- ixNpeDlNpeMgrStats.stateInfoBlocksLoaded,
- ixNpeDlNpeMgrStats.criticalNpeErrors,
- ixNpeDlNpeMgrStats.criticalMicrocodeErrors,
- 0);
-
- ixOsalLog (IX_OSAL_LOG_LVL_USER,
- IX_OSAL_LOG_DEV_STDOUT,
- "\tSuccessful NPE Starts: %u\n"
- "\tSuccessful NPE Stops: %u\n"
- "\tSuccessful NPE Resets: %u\n\n",
- ixNpeDlNpeMgrStats.npeStarts,
- ixNpeDlNpeMgrStats.npeStops,
- ixNpeDlNpeMgrStats.npeResets,
- 0,0,0);
-
- ixNpeDlNpeMgrUtilsStatsShow ();
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrStatsReset
- */
-void
-ixNpeDlNpeMgrStatsReset (void)
-{
- ixNpeDlNpeMgrStats.instructionBlocksLoaded = 0;
- ixNpeDlNpeMgrStats.dataBlocksLoaded = 0;
- ixNpeDlNpeMgrStats.stateInfoBlocksLoaded = 0;
- ixNpeDlNpeMgrStats.criticalNpeErrors = 0;
- ixNpeDlNpeMgrStats.criticalMicrocodeErrors = 0;
- ixNpeDlNpeMgrStats.npeStarts = 0;
- ixNpeDlNpeMgrStats.npeStops = 0;
- ixNpeDlNpeMgrStats.npeResets = 0;
-
- ixNpeDlNpeMgrUtilsStatsReset ();
-}
diff --git a/cpu/ixp/npe/IxNpeDlNpeMgrUtils.c b/cpu/ixp/npe/IxNpeDlNpeMgrUtils.c
deleted file mode 100644
index 9dcf3c1e4d..0000000000
--- a/cpu/ixp/npe/IxNpeDlNpeMgrUtils.c
+++ /dev/null
@@ -1,806 +0,0 @@
-/**
- * @file IxNpeDlNpeMgrUtils.c
- *
- * @author Intel Corporation
- * @date 18 February 2002
- *
- * @brief This file contains the implementation of the private API for the
- * IXP425 NPE Downloader NpeMgr Utils module
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-
-/*
- * Put the system defined include files required.
- */
-#define IX_NPE_DL_MAX_NUM_OF_RETRIES 1000000 /**< Maximum number of
- * retries before
- * timeout
- */
-
-/*
- * Put the user defined include files required.
- */
-#include "IxOsal.h"
-#include "IxNpeDl.h"
-#include "IxNpeDlNpeMgrUtils_p.h"
-#include "IxNpeDlNpeMgrEcRegisters_p.h"
-#include "IxNpeDlMacros_p.h"
-
-/*
- * #defines and macros used in this file.
- */
-
-/* used to bit-mask a number of bytes */
-#define IX_NPEDL_MASK_LOWER_BYTE_OF_WORD 0x000000FF
-#define IX_NPEDL_MASK_LOWER_SHORT_OF_WORD 0x0000FFFF
-#define IX_NPEDL_MASK_FULL_WORD 0xFFFFFFFF
-
-#define IX_NPEDL_BYTES_PER_WORD 4
-#define IX_NPEDL_BYTES_PER_SHORT 2
-
-#define IX_NPEDL_REG_SIZE_BYTE 8
-#define IX_NPEDL_REG_SIZE_SHORT 16
-#define IX_NPEDL_REG_SIZE_WORD 32
-
-/*
- * Introduce extra read cycles after issuing read command to NPE
- * so that we read the register after the NPE has updated it
- * This is to overcome race condition between XScale and NPE
- */
-#define IX_NPEDL_DELAY_READ_CYCLES 2
-/*
- * To mask top three MSBs of 32bit word to download into NPE IMEM
- */
-#define IX_NPEDL_MASK_UNUSED_IMEM_BITS 0x1FFFFFFF;
-
-
-/*
- * typedefs
- */
-typedef struct
-{
- UINT32 regAddress;
- UINT32 regSize;
-} IxNpeDlCtxtRegAccessInfo;
-
-/* module statistics counters */
-typedef struct
-{
- UINT32 insMemWrites;
- UINT32 insMemWriteFails;
- UINT32 dataMemWrites;
- UINT32 dataMemWriteFails;
- UINT32 ecsRegWrites;
- UINT32 ecsRegReads;
- UINT32 dbgInstructionExecs;
- UINT32 contextRegWrites;
- UINT32 physicalRegWrites;
- UINT32 nextPcWrites;
-} IxNpeDlNpeMgrUtilsStats;
-
-
-/*
- * Variable declarations global to this file only. Externs are followed by
- * static variables.
- */
-
-/*
- * contains useful address and function pointers to read/write Context Regs,
- * eliminating some switch or if-else statements in places
- */
-static IxNpeDlCtxtRegAccessInfo ixNpeDlCtxtRegAccInfo[IX_NPEDL_CTXT_REG_MAX] =
-{
- {
- IX_NPEDL_CTXT_REG_ADDR_STEVT,
- IX_NPEDL_REG_SIZE_BYTE
- },
- {
- IX_NPEDL_CTXT_REG_ADDR_STARTPC,
- IX_NPEDL_REG_SIZE_SHORT
- },
- {
- IX_NPEDL_CTXT_REG_ADDR_REGMAP,
- IX_NPEDL_REG_SIZE_SHORT
- },
- {
- IX_NPEDL_CTXT_REG_ADDR_CINDEX,
- IX_NPEDL_REG_SIZE_BYTE
- }
-};
-
-static UINT32 ixNpeDlSavedExecCount = 0;
-static UINT32 ixNpeDlSavedEcsDbgCtxtReg2 = 0;
-
-static IxNpeDlNpeMgrUtilsStats ixNpeDlNpeMgrUtilsStats;
-
-
-/*
- * static function prototypes.
- */
-PRIVATE __inline__ void
-ixNpeDlNpeMgrWriteCommandIssue (UINT32 npeBaseAddress, UINT32 cmd,
- UINT32 addr, UINT32 data);
-
-PRIVATE __inline__ UINT32
-ixNpeDlNpeMgrReadCommandIssue (UINT32 npeBaseAddress, UINT32 cmd, UINT32 addr);
-
-PRIVATE IX_STATUS
-ixNpeDlNpeMgrLogicalRegRead (UINT32 npeBaseAddress, UINT32 regAddr,
- UINT32 regSize, UINT32 ctxtNum, UINT32 *regVal);
-
-PRIVATE IX_STATUS
-ixNpeDlNpeMgrLogicalRegWrite (UINT32 npeBaseAddress, UINT32 regAddr,
- UINT32 regVal, UINT32 regSize,
- UINT32 ctxtNum, BOOL verify);
-
-/*
- * Function definition: ixNpeDlNpeMgrWriteCommandIssue
- */
-PRIVATE __inline__ void
-ixNpeDlNpeMgrWriteCommandIssue (
- UINT32 npeBaseAddress,
- UINT32 cmd,
- UINT32 addr,
- UINT32 data)
-{
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXDATA, data);
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXAD, addr);
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXCTL, cmd);
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrReadCommandIssue
- */
-PRIVATE __inline__ UINT32
-ixNpeDlNpeMgrReadCommandIssue (
- UINT32 npeBaseAddress,
- UINT32 cmd,
- UINT32 addr)
-{
- UINT32 data = 0;
- int i;
-
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXAD, addr);
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXCTL, cmd);
- for (i = 0; i <= IX_NPEDL_DELAY_READ_CYCLES; i++)
- {
- IX_NPEDL_REG_READ (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXDATA, &data);
- }
-
- return data;
-}
-
-/*
- * Function definition: ixNpeDlNpeMgrInsMemWrite
- */
-IX_STATUS
-ixNpeDlNpeMgrInsMemWrite (
- UINT32 npeBaseAddress,
- UINT32 insMemAddress,
- UINT32 insMemData,
- BOOL verify)
-{
- UINT32 insMemDataRtn;
-
- ixNpeDlNpeMgrWriteCommandIssue (npeBaseAddress,
- IX_NPEDL_EXCTL_CMD_WR_INS_MEM,
- insMemAddress, insMemData);
- if (verify)
- {
- /* write invalid data to this reg, so we can see if we're reading
- the EXDATA register too early */
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXDATA,
- ~insMemData);
-
- /*Disabled since top 3 MSB are not used for Azusa hardware Refer WR:IXA00053900*/
- insMemData&=IX_NPEDL_MASK_UNUSED_IMEM_BITS;
-
- insMemDataRtn=ixNpeDlNpeMgrReadCommandIssue (npeBaseAddress,
- IX_NPEDL_EXCTL_CMD_RD_INS_MEM,
- insMemAddress);
-
- insMemDataRtn&=IX_NPEDL_MASK_UNUSED_IMEM_BITS;
-
- if (insMemData != insMemDataRtn)
- {
- ixNpeDlNpeMgrUtilsStats.insMemWriteFails++;
- return IX_FAIL;
- }
- }
-
- ixNpeDlNpeMgrUtilsStats.insMemWrites++;
- return IX_SUCCESS;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrDataMemWrite
- */
-IX_STATUS
-ixNpeDlNpeMgrDataMemWrite (
- UINT32 npeBaseAddress,
- UINT32 dataMemAddress,
- UINT32 dataMemData,
- BOOL verify)
-{
- ixNpeDlNpeMgrWriteCommandIssue (npeBaseAddress,
- IX_NPEDL_EXCTL_CMD_WR_DATA_MEM,
- dataMemAddress, dataMemData);
- if (verify)
- {
- /* write invalid data to this reg, so we can see if we're reading
- the EXDATA register too early */
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXDATA, ~dataMemData);
-
- if (dataMemData !=
- ixNpeDlNpeMgrReadCommandIssue (npeBaseAddress,
- IX_NPEDL_EXCTL_CMD_RD_DATA_MEM,
- dataMemAddress))
- {
- ixNpeDlNpeMgrUtilsStats.dataMemWriteFails++;
- return IX_FAIL;
- }
- }
-
- ixNpeDlNpeMgrUtilsStats.dataMemWrites++;
- return IX_SUCCESS;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrExecAccRegWrite
- */
-void
-ixNpeDlNpeMgrExecAccRegWrite (
- UINT32 npeBaseAddress,
- UINT32 regAddress,
- UINT32 regData)
-{
- ixNpeDlNpeMgrWriteCommandIssue (npeBaseAddress,
- IX_NPEDL_EXCTL_CMD_WR_ECS_REG,
- regAddress, regData);
- ixNpeDlNpeMgrUtilsStats.ecsRegWrites++;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrExecAccRegRead
- */
-UINT32
-ixNpeDlNpeMgrExecAccRegRead (
- UINT32 npeBaseAddress,
- UINT32 regAddress)
-{
- ixNpeDlNpeMgrUtilsStats.ecsRegReads++;
- return ixNpeDlNpeMgrReadCommandIssue (npeBaseAddress,
- IX_NPEDL_EXCTL_CMD_RD_ECS_REG,
- regAddress);
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrCommandIssue
- */
-void
-ixNpeDlNpeMgrCommandIssue (
- UINT32 npeBaseAddress,
- UINT32 command)
-{
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrCommandIssue\n");
-
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXCTL, command);
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrCommandIssue\n");
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrDebugInstructionPreExec
- */
-void
-ixNpeDlNpeMgrDebugInstructionPreExec(
- UINT32 npeBaseAddress)
-{
- /* turn off the halt bit by clearing Execution Count register. */
- /* save reg contents 1st and restore later */
- IX_NPEDL_REG_READ (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXCT,
- &ixNpeDlSavedExecCount);
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXCT, 0);
-
- /* ensure that IF and IE are on (temporarily), so that we don't end up
- * stepping forever */
- ixNpeDlSavedEcsDbgCtxtReg2 = ixNpeDlNpeMgrExecAccRegRead (npeBaseAddress,
- IX_NPEDL_ECS_DBG_CTXT_REG_2);
-
- ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_DBG_CTXT_REG_2,
- (ixNpeDlSavedEcsDbgCtxtReg2 |
- IX_NPEDL_MASK_ECS_DBG_REG_2_IF |
- IX_NPEDL_MASK_ECS_DBG_REG_2_IE));
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrDebugInstructionExec
- */
-IX_STATUS
-ixNpeDlNpeMgrDebugInstructionExec(
- UINT32 npeBaseAddress,
- UINT32 npeInstruction,
- UINT32 ctxtNum,
- UINT32 ldur)
-{
- UINT32 ecsDbgRegVal;
- UINT32 oldWatchcount, newWatchcount;
- UINT32 retriesCount = 0;
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrDebugInstructionExec\n");
-
- /* set the Active bit, and the LDUR, in the debug level */
- ecsDbgRegVal = IX_NPEDL_MASK_ECS_REG_0_ACTIVE |
- (ldur << IX_NPEDL_OFFSET_ECS_REG_0_LDUR);
-
- ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_DBG_CTXT_REG_0,
- ecsDbgRegVal);
-
- /*
- * set CCTXT at ECS DEBUG L3 to specify in which context to execute the
- * instruction, and set SELCTXT at ECS DEBUG Level to specify which context
- * store to access.
- * Debug ECS Level Reg 1 has form 0x000n000n, where n = context number
- */
- ecsDbgRegVal = (ctxtNum << IX_NPEDL_OFFSET_ECS_REG_1_CCTXT) |
- (ctxtNum << IX_NPEDL_OFFSET_ECS_REG_1_SELCTXT);
-
- ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_DBG_CTXT_REG_1,
- ecsDbgRegVal);
-
- /* clear the pipeline */
- ixNpeDlNpeMgrCommandIssue (npeBaseAddress, IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE);
-
- /* load NPE instruction into the instruction register */
- ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_INSTRUCT_REG,
- npeInstruction);
-
- /* we need this value later to wait for completion of NPE execution step */
- IX_NPEDL_REG_READ (npeBaseAddress, IX_NPEDL_REG_OFFSET_WC, &oldWatchcount);
-
- /* issue a Step One command via the Execution Control register */
- ixNpeDlNpeMgrCommandIssue (npeBaseAddress, IX_NPEDL_EXCTL_CMD_NPE_STEP);
-
- /* Watch Count register increments when NPE completes an instruction */
- IX_NPEDL_REG_READ (npeBaseAddress, IX_NPEDL_REG_OFFSET_WC,
- &newWatchcount);
-
- /*
- * force the XScale to wait until the NPE has finished execution step
- * NOTE that this delay will be very small, just long enough to allow a
- * single NPE instruction to complete execution; if instruction execution
- * is not completed before timeout retries, exit the while loop
- */
- while ((IX_NPE_DL_MAX_NUM_OF_RETRIES > retriesCount)
- && (newWatchcount == oldWatchcount))
- {
- /* Watch Count register increments when NPE completes an instruction */
- IX_NPEDL_REG_READ (npeBaseAddress, IX_NPEDL_REG_OFFSET_WC,
- &newWatchcount);
-
- retriesCount++;
- }
-
- if (IX_NPE_DL_MAX_NUM_OF_RETRIES > retriesCount)
- {
- ixNpeDlNpeMgrUtilsStats.dbgInstructionExecs++;
- }
- else
- {
- /* Return timeout status as the instruction has not been executed
- * after maximum retries */
- status = IX_NPEDL_CRITICAL_NPE_ERR;
- }
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrDebugInstructionExec\n");
-
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrDebugInstructionPostExec
- */
-void
-ixNpeDlNpeMgrDebugInstructionPostExec(
- UINT32 npeBaseAddress)
-{
- /* clear active bit in debug level */
- ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_DBG_CTXT_REG_0,
- 0);
-
- /* clear the pipeline */
- ixNpeDlNpeMgrCommandIssue (npeBaseAddress, IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE);
-
- /* restore Execution Count register contents. */
- IX_NPEDL_REG_WRITE (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXCT,
- ixNpeDlSavedExecCount);
-
- /* restore IF and IE bits to original values */
- ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress, IX_NPEDL_ECS_DBG_CTXT_REG_2,
- ixNpeDlSavedEcsDbgCtxtReg2);
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrLogicalRegRead
- */
-PRIVATE IX_STATUS
-ixNpeDlNpeMgrLogicalRegRead (
- UINT32 npeBaseAddress,
- UINT32 regAddr,
- UINT32 regSize,
- UINT32 ctxtNum,
- UINT32 *regVal)
-{
- IX_STATUS status = IX_SUCCESS;
- UINT32 npeInstruction = 0;
- UINT32 mask = 0;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrLogicalRegRead\n");
-
- switch (regSize)
- {
- case IX_NPEDL_REG_SIZE_BYTE:
- npeInstruction = IX_NPEDL_INSTR_RD_REG_BYTE;
- mask = IX_NPEDL_MASK_LOWER_BYTE_OF_WORD; break;
- case IX_NPEDL_REG_SIZE_SHORT:
- npeInstruction = IX_NPEDL_INSTR_RD_REG_SHORT;
- mask = IX_NPEDL_MASK_LOWER_SHORT_OF_WORD; break;
- case IX_NPEDL_REG_SIZE_WORD:
- npeInstruction = IX_NPEDL_INSTR_RD_REG_WORD;
- mask = IX_NPEDL_MASK_FULL_WORD; break;
- }
-
- /* make regAddr be the SRC and DEST operands (e.g. movX d0, d0) */
- npeInstruction |= (regAddr << IX_NPEDL_OFFSET_INSTR_SRC) |
- (regAddr << IX_NPEDL_OFFSET_INSTR_DEST);
-
- /* step execution of NPE intruction using Debug Executing Context stack */
- status = ixNpeDlNpeMgrDebugInstructionExec (npeBaseAddress, npeInstruction,
- ctxtNum, IX_NPEDL_RD_INSTR_LDUR);
-
- if (IX_SUCCESS != status)
- {
- return status;
- }
-
- /* read value of register from Execution Data register */
- IX_NPEDL_REG_READ (npeBaseAddress, IX_NPEDL_REG_OFFSET_EXDATA, regVal);
-
- /* align value from left to right */
- *regVal = (*regVal >> (IX_NPEDL_REG_SIZE_WORD - regSize)) & mask;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrLogicalRegRead\n");
-
- return IX_SUCCESS;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrLogicalRegWrite
- */
-PRIVATE IX_STATUS
-ixNpeDlNpeMgrLogicalRegWrite (
- UINT32 npeBaseAddress,
- UINT32 regAddr,
- UINT32 regVal,
- UINT32 regSize,
- UINT32 ctxtNum,
- BOOL verify)
-{
- UINT32 npeInstruction = 0;
- UINT32 mask = 0;
- IX_STATUS status = IX_SUCCESS;
- UINT32 retRegVal;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrLogicalRegWrite\n");
-
- if (regSize == IX_NPEDL_REG_SIZE_WORD)
- {
- /* NPE register addressing is left-to-right: e.g. |d0|d1|d2|d3| */
- /* Write upper half-word (short) to |d0|d1| */
- status = ixNpeDlNpeMgrLogicalRegWrite (npeBaseAddress, regAddr,
- regVal >> IX_NPEDL_REG_SIZE_SHORT,
- IX_NPEDL_REG_SIZE_SHORT,
- ctxtNum, verify);
-
- if (IX_SUCCESS != status)
- {
- return status;
- }
-
- /* Write lower half-word (short) to |d2|d3| */
- status = ixNpeDlNpeMgrLogicalRegWrite (npeBaseAddress,
- regAddr + IX_NPEDL_BYTES_PER_SHORT,
- regVal & IX_NPEDL_MASK_LOWER_SHORT_OF_WORD,
- IX_NPEDL_REG_SIZE_SHORT,
- ctxtNum, verify);
-
- if (IX_SUCCESS != status)
- {
- return status;
- }
- }
- else
- {
- switch (regSize)
- {
- case IX_NPEDL_REG_SIZE_BYTE:
- npeInstruction = IX_NPEDL_INSTR_WR_REG_BYTE;
- mask = IX_NPEDL_MASK_LOWER_BYTE_OF_WORD; break;
- case IX_NPEDL_REG_SIZE_SHORT:
- npeInstruction = IX_NPEDL_INSTR_WR_REG_SHORT;
- mask = IX_NPEDL_MASK_LOWER_SHORT_OF_WORD; break;
- }
- /* mask out any redundant bits, so verify will work later */
- regVal &= mask;
-
- /* fill dest operand field of instruction with destination reg addr */
- npeInstruction |= (regAddr << IX_NPEDL_OFFSET_INSTR_DEST);
-
- /* fill src operand field of instruction with least-sig 5 bits of val*/
- npeInstruction |= ((regVal & IX_NPEDL_MASK_IMMED_INSTR_SRC_DATA) <<
- IX_NPEDL_OFFSET_INSTR_SRC);
-
- /* fill coprocessor field of instruction with most-sig 11 bits of val*/
- npeInstruction |= ((regVal & IX_NPEDL_MASK_IMMED_INSTR_COPROC_DATA) <<
- IX_NPEDL_DISPLACE_IMMED_INSTR_COPROC_DATA);
-
- /* step execution of NPE intruction using Debug ECS */
- status = ixNpeDlNpeMgrDebugInstructionExec(npeBaseAddress, npeInstruction,
- ctxtNum, IX_NPEDL_WR_INSTR_LDUR);
-
- if (IX_SUCCESS != status)
- {
- return status;
- }
- }/* condition: if reg to be written is 8-bit or 16-bit (not 32-bit) */
-
- if (verify)
- {
- status = ixNpeDlNpeMgrLogicalRegRead (npeBaseAddress, regAddr,
- regSize, ctxtNum, &retRegVal);
-
- if (IX_SUCCESS == status)
- {
- if (regVal != retRegVal)
- {
- status = IX_FAIL;
- }
- }
- }
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrLogicalRegWrite : status = %d\n",
- status);
-
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrPhysicalRegWrite
- */
-IX_STATUS
-ixNpeDlNpeMgrPhysicalRegWrite (
- UINT32 npeBaseAddress,
- UINT32 regAddr,
- UINT32 regValue,
- BOOL verify)
-{
- IX_STATUS status;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrPhysicalRegWrite\n");
-
-/*
- * There are 32 physical registers used in an NPE. These are
- * treated as 16 pairs of 32-bit registers. To write one of the pair,
- * write the pair number (0-16) to the REGMAP for Context 0. Then write
- * the value to register 0 or 4 in the regfile, depending on which
- * register of the pair is to be written
- */
-
- /*
- * set REGMAP for context 0 to (regAddr >> 1) to choose which pair (0-16)
- * of physical registers to write
- */
- status = ixNpeDlNpeMgrLogicalRegWrite (npeBaseAddress,
- IX_NPEDL_CTXT_REG_ADDR_REGMAP,
- (regAddr >>
- IX_NPEDL_OFFSET_PHYS_REG_ADDR_REGMAP),
- IX_NPEDL_REG_SIZE_SHORT, 0, verify);
- if (status == IX_SUCCESS)
- {
- /* regAddr = 0 or 4 */
- regAddr = (regAddr & IX_NPEDL_MASK_PHYS_REG_ADDR_LOGICAL_ADDR) *
- IX_NPEDL_BYTES_PER_WORD;
-
- status = ixNpeDlNpeMgrLogicalRegWrite (npeBaseAddress, regAddr, regValue,
- IX_NPEDL_REG_SIZE_WORD, 0, verify);
- }
-
- if (status != IX_SUCCESS)
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrPhysicalRegWrite: "
- "error writing to physical register\n");
- }
-
- ixNpeDlNpeMgrUtilsStats.physicalRegWrites++;
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrPhysicalRegWrite : status = %d\n",
- status);
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrCtxtRegWrite
- */
-IX_STATUS
-ixNpeDlNpeMgrCtxtRegWrite (
- UINT32 npeBaseAddress,
- UINT32 ctxtNum,
- IxNpeDlCtxtRegNum ctxtReg,
- UINT32 ctxtRegVal,
- BOOL verify)
-{
- UINT32 tempRegVal;
- UINT32 ctxtRegAddr;
- UINT32 ctxtRegSize;
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT,
- "Entering ixNpeDlNpeMgrCtxtRegWrite\n");
-
- /*
- * Context 0 has no STARTPC. Instead, this value is used to set
- * NextPC for Background ECS, to set where NPE starts executing code
- */
- if ((ctxtNum == 0) && (ctxtReg == IX_NPEDL_CTXT_REG_STARTPC))
- {
- /* read BG_CTXT_REG_0, update NEXTPC bits, and write back to reg */
- tempRegVal = ixNpeDlNpeMgrExecAccRegRead (npeBaseAddress,
- IX_NPEDL_ECS_BG_CTXT_REG_0);
- tempRegVal &= ~IX_NPEDL_MASK_ECS_REG_0_NEXTPC;
- tempRegVal |= (ctxtRegVal << IX_NPEDL_OFFSET_ECS_REG_0_NEXTPC) &
- IX_NPEDL_MASK_ECS_REG_0_NEXTPC;
-
- ixNpeDlNpeMgrExecAccRegWrite (npeBaseAddress,
- IX_NPEDL_ECS_BG_CTXT_REG_0, tempRegVal);
-
- ixNpeDlNpeMgrUtilsStats.nextPcWrites++;
- }
- else
- {
- ctxtRegAddr = ixNpeDlCtxtRegAccInfo[ctxtReg].regAddress;
- ctxtRegSize = ixNpeDlCtxtRegAccInfo[ctxtReg].regSize;
- status = ixNpeDlNpeMgrLogicalRegWrite (npeBaseAddress, ctxtRegAddr,
- ctxtRegVal, ctxtRegSize,
- ctxtNum, verify);
- if (status != IX_SUCCESS)
- {
- IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeMgrCtxtRegWrite: "
- "error writing to context store register\n");
- }
-
- ixNpeDlNpeMgrUtilsStats.contextRegWrites++;
- }
-
- IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT,
- "Exiting ixNpeDlNpeMgrCtxtRegWrite : status = %d\n",
- status);
-
- return status;
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrUtilsStatsShow
- */
-void
-ixNpeDlNpeMgrUtilsStatsShow (void)
-{
- ixOsalLog (IX_OSAL_LOG_LVL_USER,
- IX_OSAL_LOG_DEV_STDOUT,
- "\nixNpeDlNpeMgrUtilsStatsShow:\n"
- "\tInstruction Memory writes: %u\n"
- "\tInstruction Memory writes failed: %u\n"
- "\tData Memory writes: %u\n"
- "\tData Memory writes failed: %u\n",
- ixNpeDlNpeMgrUtilsStats.insMemWrites,
- ixNpeDlNpeMgrUtilsStats.insMemWriteFails,
- ixNpeDlNpeMgrUtilsStats.dataMemWrites,
- ixNpeDlNpeMgrUtilsStats.dataMemWriteFails,
- 0,0);
-
- ixOsalLog (IX_OSAL_LOG_LVL_USER,
- IX_OSAL_LOG_DEV_STDOUT,
- "\tExecuting Context Stack Register writes: %u\n"
- "\tExecuting Context Stack Register reads: %u\n"
- "\tPhysical Register writes: %u\n"
- "\tContext Store Register writes: %u\n"
- "\tExecution Backgound Context NextPC writes: %u\n"
- "\tDebug Instructions Executed: %u\n\n",
- ixNpeDlNpeMgrUtilsStats.ecsRegWrites,
- ixNpeDlNpeMgrUtilsStats.ecsRegReads,
- ixNpeDlNpeMgrUtilsStats.physicalRegWrites,
- ixNpeDlNpeMgrUtilsStats.contextRegWrites,
- ixNpeDlNpeMgrUtilsStats.nextPcWrites,
- ixNpeDlNpeMgrUtilsStats.dbgInstructionExecs);
-}
-
-
-/*
- * Function definition: ixNpeDlNpeMgrUtilsStatsReset
- */
-void
-ixNpeDlNpeMgrUtilsStatsReset (void)
-{
- ixNpeDlNpeMgrUtilsStats.insMemWrites = 0;
- ixNpeDlNpeMgrUtilsStats.insMemWriteFails = 0;
- ixNpeDlNpeMgrUtilsStats.dataMemWrites = 0;
- ixNpeDlNpeMgrUtilsStats.dataMemWriteFails = 0;
- ixNpeDlNpeMgrUtilsStats.ecsRegWrites = 0;
- ixNpeDlNpeMgrUtilsStats.ecsRegReads = 0;
- ixNpeDlNpeMgrUtilsStats.physicalRegWrites = 0;
- ixNpeDlNpeMgrUtilsStats.contextRegWrites = 0;
- ixNpeDlNpeMgrUtilsStats.nextPcWrites = 0;
- ixNpeDlNpeMgrUtilsStats.dbgInstructionExecs = 0;
-}
diff --git a/cpu/ixp/npe/IxNpeMh.c b/cpu/ixp/npe/IxNpeMh.c
deleted file mode 100644
index 8703def8bc..0000000000
--- a/cpu/ixp/npe/IxNpeMh.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/**
- * @file IxNpeMh.c
- *
- * @author Intel Corporation
- * @date 18 Jan 2002
- *
- * @brief This file contains the implementation of the public API for the
- * IXP425 NPE Message Handler component.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/*
- * Put the system defined include files required.
- */
-
-/*
- * Put the user defined include files required.
- */
-
-#include "IxOsal.h"
-#include "IxNpeMhMacros_p.h"
-
-#include "IxNpeMh.h"
-
-#include "IxNpeMhConfig_p.h"
-#include "IxNpeMhReceive_p.h"
-#include "IxNpeMhSend_p.h"
-#include "IxNpeMhSolicitedCbMgr_p.h"
-#include "IxNpeMhUnsolicitedCbMgr_p.h"
-
-/*
- * #defines and macros used in this file.
- */
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-/*
- * Variable declarations global to this file only. Externs are followed by
- * static variables.
- */
-
-PRIVATE BOOL ixNpeMhInitialized = FALSE;
-
-/*
- * Extern function prototypes.
- */
-
-/*
- * Static function prototypes.
- */
-
-/*
- * Function definition: ixNpeMhInitialize
- */
-
-PUBLIC IX_STATUS ixNpeMhInitialize (
- IxNpeMhNpeInterrupts npeInterrupts)
-{
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhInitialize\n");
-
- /* check the npeInterrupts parameter */
- if ((npeInterrupts != IX_NPEMH_NPEINTERRUPTS_NO) &&
- (npeInterrupts != IX_NPEMH_NPEINTERRUPTS_YES))
- {
- IX_NPEMH_ERROR_REPORT ("Illegal npeInterrupts parameter value\n");
- return IX_FAIL;
- }
-
- /* parameters are ok ... */
-
- /* initialize the Receive module */
- ixNpeMhReceiveInitialize ();
-
- /* initialize the Solicited Callback Manager module */
- ixNpeMhSolicitedCbMgrInitialize ();
-
- /* initialize the Unsolicited Callback Manager module */
- ixNpeMhUnsolicitedCbMgrInitialize ();
-
- /* initialize the Configuration module
- *
- * NOTE: This module was originally configured before the
- * others, but the sequence was changed so that interrupts
- * would only be enabled after the handler functions were
- * set up. The above modules need to be initialised to
- * handle the NPE interrupts. See SCR #2231.
- */
- ixNpeMhConfigInitialize (npeInterrupts);
-
- ixNpeMhInitialized = TRUE;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhInitialize\n");
-
- return IX_SUCCESS;
-}
-
-/*
- * Function definition: ixNpeMhUnload
- */
-
-PUBLIC IX_STATUS ixNpeMhUnload (void)
-{
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhUnload\n");
-
- if (!ixNpeMhInitialized)
- {
- return IX_FAIL;
- }
-
- /* Uninitialize the Configuration module */
- ixNpeMhConfigUninit ();
-
- ixNpeMhInitialized = FALSE;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhUnload\n");
-
- return IX_SUCCESS;
-}
-
-
-/*
- * Function definition: ixNpeMhUnsolicitedCallbackRegister
- */
-
-PUBLIC IX_STATUS ixNpeMhUnsolicitedCallbackRegister (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId messageId,
- IxNpeMhCallback unsolicitedCallback)
-{
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhUnsolicitedCallbackRegister\n");
-
- /* check that we are initialized */
- if (!ixNpeMhInitialized)
- {
- IX_NPEMH_ERROR_REPORT ("IxNpeMh component is not initialized\n");
- return IX_FAIL;
- }
-
- /* check the npeId parameter */
- if (!ixNpeMhConfigNpeIdIsValid (npeId))
- {
- IX_NPEMH_ERROR_REPORT ("NPE ID invalid\n");
- return IX_FAIL;
- }
-
- /* check the messageId parameter */
- if ((messageId < IX_NPEMH_MIN_MESSAGE_ID)
- || (messageId > IX_NPEMH_MAX_MESSAGE_ID))
- {
- IX_NPEMH_ERROR_REPORT ("Message ID is out of range\n");
- return IX_FAIL;
- }
-
- /* the unsolicitedCallback parameter is allowed to be NULL */
-
- /* parameters are ok ... */
-
- /* get the lock to prevent other clients from entering */
- ixNpeMhConfigLockGet (npeId);
-
- /* save the unsolicited callback for the message ID */
- ixNpeMhUnsolicitedCbMgrCallbackSave (
- npeId, messageId, unsolicitedCallback);
-
- /* release the lock to allow other clients back in */
- ixNpeMhConfigLockRelease (npeId);
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhUnsolicitedCallbackRegister\n");
-
- return IX_SUCCESS;
-}
-
-/*
- * Function definition: ixNpeMhUnsolicitedCallbackForRangeRegister
- */
-
-PUBLIC IX_STATUS ixNpeMhUnsolicitedCallbackForRangeRegister (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId minMessageId,
- IxNpeMhMessageId maxMessageId,
- IxNpeMhCallback unsolicitedCallback)
-{
- IxNpeMhMessageId messageId;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhUnsolicitedCallbackForRangeRegister\n");
-
- /* check that we are initialized */
- if (!ixNpeMhInitialized)
- {
- IX_NPEMH_ERROR_REPORT ("IxNpeMh component is not initialized\n");
- return IX_FAIL;
- }
-
- /* check the npeId parameter */
- if (!ixNpeMhConfigNpeIdIsValid (npeId))
- {
- IX_NPEMH_ERROR_REPORT ("NPE ID invalid\n");
- return IX_FAIL;
- }
-
- /* check the minMessageId parameter */
- if ((minMessageId < IX_NPEMH_MIN_MESSAGE_ID)
- || (minMessageId > IX_NPEMH_MAX_MESSAGE_ID))
- {
- IX_NPEMH_ERROR_REPORT ("Min message ID is out of range\n");
- return IX_FAIL;
- }
-
- /* check the maxMessageId parameter */
- if ((maxMessageId < IX_NPEMH_MIN_MESSAGE_ID)
- || (maxMessageId > IX_NPEMH_MAX_MESSAGE_ID))
- {
- IX_NPEMH_ERROR_REPORT ("Max message ID is out of range\n");
- return IX_FAIL;
- }
-
- /* check the semantics of the message range parameters */
- if (minMessageId > maxMessageId)
- {
- IX_NPEMH_ERROR_REPORT ("Min message ID greater than max message "
- "ID\n");
- return IX_FAIL;
- }
-
- /* the unsolicitedCallback parameter is allowed to be NULL */
-
- /* parameters are ok ... */
-
- /* get the lock to prevent other clients from entering */
- ixNpeMhConfigLockGet (npeId);
-
- /* for each message ID in the range ... */
- for (messageId = minMessageId; messageId <= maxMessageId; messageId++)
- {
- /* save the unsolicited callback for the message ID */
- ixNpeMhUnsolicitedCbMgrCallbackSave (
- npeId, messageId, unsolicitedCallback);
- }
-
- /* release the lock to allow other clients back in */
- ixNpeMhConfigLockRelease (npeId);
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhUnsolicitedCallbackForRangeRegister\n");
-
- return IX_SUCCESS;
-}
-
-/*
- * Function definition: ixNpeMhMessageSend
- */
-
-PUBLIC IX_STATUS ixNpeMhMessageSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- UINT32 maxSendRetries)
-{
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhMessageSend\n");
-
- /* check that we are initialized */
- if (!ixNpeMhInitialized)
- {
- IX_NPEMH_ERROR_REPORT ("IxNpeMh component is not initialized\n");
- return IX_FAIL;
- }
-
- /* check the npeId parameter */
- if (!ixNpeMhConfigNpeIdIsValid (npeId))
- {
- IX_NPEMH_ERROR_REPORT ("NPE ID invalid\n");
- return IX_FAIL;
- }
-
- /* parameters are ok ... */
-
- /* get the lock to prevent other clients from entering */
- ixNpeMhConfigLockGet (npeId);
-
- /* send the message */
- status = ixNpeMhSendMessageSend (npeId, message, maxSendRetries);
- if (status != IX_SUCCESS)
- {
- IX_NPEMH_ERROR_REPORT ("Failed to send message\n");
- }
-
- /* release the lock to allow other clients back in */
- ixNpeMhConfigLockRelease (npeId);
-
- IX_NPEMH_TRACE1 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhMessageSend"
- " : status = %d\n", status);
-
- return status;
-}
-
-/*
- * Function definition: ixNpeMhMessageWithResponseSend
- */
-
-PUBLIC IX_STATUS ixNpeMhMessageWithResponseSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback solicitedCallback,
- UINT32 maxSendRetries)
-{
- IX_STATUS status = IX_SUCCESS;
- IxNpeMhCallback unsolicitedCallback = NULL;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhMessageWithResponseSend\n");
-
- /* check that we are initialized */
- if (!ixNpeMhInitialized)
- {
- IX_NPEMH_ERROR_REPORT ("IxNpeMh component is not initialized\n");
- return IX_FAIL;
- }
-
- /* the solicitecCallback parameter is allowed to be NULL. this */
- /* signifies the client is not interested in the response message */
-
- /* check the npeId parameter */
- if (!ixNpeMhConfigNpeIdIsValid (npeId))
- {
- IX_NPEMH_ERROR_REPORT ("NPE ID invalid\n");
- return IX_FAIL;
- }
-
- /* check the solicitedMessageId parameter */
- if ((solicitedMessageId < IX_NPEMH_MIN_MESSAGE_ID)
- || (solicitedMessageId > IX_NPEMH_MAX_MESSAGE_ID))
- {
- IX_NPEMH_ERROR_REPORT ("Solicited message ID is out of range\n");
- return IX_FAIL;
- }
-
- /* check the solicitedMessageId parameter. if an unsolicited */
- /* callback has been registered for the specified message ID then */
- /* report an error and return failure */
- ixNpeMhUnsolicitedCbMgrCallbackRetrieve (
- npeId, solicitedMessageId, &unsolicitedCallback);
- if (unsolicitedCallback != NULL)
- {
- IX_NPEMH_ERROR_REPORT ("Solicited message ID conflicts with "
- "unsolicited message ID\n");
- return IX_FAIL;
- }
-
- /* parameters are ok ... */
-
- /* get the lock to prevent other clients from entering */
- ixNpeMhConfigLockGet (npeId);
-
- /* send the message */
- status = ixNpeMhSendMessageWithResponseSend (
- npeId, message, solicitedMessageId, solicitedCallback,
- maxSendRetries);
- if (status != IX_SUCCESS)
- {
- IX_NPEMH_ERROR_REPORT ("Failed to send message\n");
- }
-
- /* release the lock to allow other clients back in */
- ixNpeMhConfigLockRelease (npeId);
-
- IX_NPEMH_TRACE1 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhMessageWithResponseSend"
- " : status = %d\n", status);
-
- return status;
-}
-
-/*
- * Function definition: ixNpeMhMessagesReceive
- */
-
-PUBLIC IX_STATUS ixNpeMhMessagesReceive (
- IxNpeMhNpeId npeId)
-{
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhMessagesReceive\n");
-
- /* check that we are initialized */
- if (!ixNpeMhInitialized)
- {
- IX_NPEMH_ERROR_REPORT ("IxNpeMh component is not initialized\n");
- return IX_FAIL;
- }
-
- /* check the npeId parameter */
- if (!ixNpeMhConfigNpeIdIsValid (npeId))
- {
- IX_NPEMH_ERROR_REPORT ("NPE ID invalid\n");
- return IX_FAIL;
- }
-
- /* parameters are ok ... */
-
- /* get the lock to prevent other clients from entering */
- ixNpeMhConfigLockGet (npeId);
-
- /* receive messages from the NPE */
- status = ixNpeMhReceiveMessagesReceive (npeId);
-
- if (status != IX_SUCCESS)
- {
- IX_NPEMH_ERROR_REPORT ("Failed to receive message\n");
- }
-
- /* release the lock to allow other clients back in */
- ixNpeMhConfigLockRelease (npeId);
-
- IX_NPEMH_TRACE1 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhMessagesReceive"
- " : status = %d\n", status);
-
- return status;
-}
-
-/*
- * Function definition: ixNpeMhShow
- */
-
-PUBLIC IX_STATUS ixNpeMhShow (
- IxNpeMhNpeId npeId)
-{
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhShow\n");
-
- /* check that we are initialized */
- if (!ixNpeMhInitialized)
- {
- IX_NPEMH_ERROR_REPORT ("IxNpeMh component is not initialized\n");
- return IX_FAIL;
- }
-
- /* check the npeId parameter */
- if (!ixNpeMhConfigNpeIdIsValid (npeId))
- {
- IX_NPEMH_ERROR_REPORT ("NPE ID invalid\n");
- return IX_FAIL;
- }
-
- /* parameters are ok ... */
-
- /* note we don't get the lock here as printing the statistics */
- /* to a console may take some time and we don't want to impact */
- /* system performance. this means that the statistics displayed */
- /* may be in a state of flux and make not represent a consistent */
- /* snapshot. */
-
- /* display a header */
- ixOsalLog (IX_OSAL_LOG_LVL_USER, IX_OSAL_LOG_DEV_STDOUT,
- "Current state of NPE ID %d:\n\n", npeId, 0, 0, 0, 0, 0);
-
- /* show the current state of each module */
-
- /* show the current state of the Configuration module */
- ixNpeMhConfigShow (npeId);
-
- /* show the current state of the Receive module */
- ixNpeMhReceiveShow (npeId);
-
- /* show the current state of the Send module */
- ixNpeMhSendShow (npeId);
-
- /* show the current state of the Solicited Callback Manager module */
- ixNpeMhSolicitedCbMgrShow (npeId);
-
- /* show the current state of the Unsolicited Callback Manager module */
- ixNpeMhUnsolicitedCbMgrShow (npeId);
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhShow\n");
-
- return IX_SUCCESS;
-}
-
-/*
- * Function definition: ixNpeMhShowReset
- */
-
-PUBLIC IX_STATUS ixNpeMhShowReset (
- IxNpeMhNpeId npeId)
-{
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhShowReset\n");
-
- /* check that we are initialized */
- if (!ixNpeMhInitialized)
- {
- IX_NPEMH_ERROR_REPORT ("IxNpeMh component is not initialized\n");
- return IX_FAIL;
- }
-
- /* check the npeId parameter */
- if (!ixNpeMhConfigNpeIdIsValid (npeId))
- {
- IX_NPEMH_ERROR_REPORT ("NPE ID invalid\n");
- return IX_FAIL;
- }
-
- /* parameters are ok ... */
-
- /* note we don't get the lock here as resetting the statistics */
- /* shouldn't impact system performance. */
-
- /* reset the current state of each module */
-
- /* reset the current state of the Configuration module */
- ixNpeMhConfigShowReset (npeId);
-
- /* reset the current state of the Receive module */
- ixNpeMhReceiveShowReset (npeId);
-
- /* reset the current state of the Send module */
- ixNpeMhSendShowReset (npeId);
-
- /* reset the current state of the Solicited Callback Manager module */
- ixNpeMhSolicitedCbMgrShowReset (npeId);
-
- /* reset the current state of the Unsolicited Callback Manager module */
- ixNpeMhUnsolicitedCbMgrShowReset (npeId);
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhShowReset\n");
-
- return IX_SUCCESS;
-}
diff --git a/cpu/ixp/npe/IxNpeMhConfig.c b/cpu/ixp/npe/IxNpeMhConfig.c
deleted file mode 100644
index 50c8f21138..0000000000
--- a/cpu/ixp/npe/IxNpeMhConfig.c
+++ /dev/null
@@ -1,608 +0,0 @@
-/**
- * @file IxNpeMhConfig.c
- *
- * @author Intel Corporation
- * @date 18 Jan 2002
- *
- * @brief This file contains the implementation of the private API for the
- * Configuration module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/*
- * Put the system defined include files required.
- */
-
-
-/*
- * Put the user defined include files required.
- */
-
-#include "IxOsal.h"
-
-#include "IxNpeMhMacros_p.h"
-
-#include "IxNpeMhConfig_p.h"
-
-/*
- * #defines and macros used in this file.
- */
-#define IX_NPE_MH_MAX_NUM_OF_RETRIES 1000000 /**< Maximum number of
- * retries before
- * timeout
- */
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-/**
- * @struct IxNpeMhConfigStats
- *
- * @brief This structure is used to maintain statistics for the
- * Configuration module.
- */
-
-typedef struct
-{
- UINT32 outFifoReads; /**< outFifo reads */
- UINT32 inFifoWrites; /**< inFifo writes */
- UINT32 maxInFifoFullRetries; /**< max retries if inFIFO full */
- UINT32 maxOutFifoEmptyRetries; /**< max retries if outFIFO empty */
-} IxNpeMhConfigStats;
-
-/*
- * Variable declarations global to this file only. Externs are followed by
- * static variables.
- */
-
-IxNpeMhConfigNpeInfo ixNpeMhConfigNpeInfo[IX_NPEMH_NUM_NPES] =
-{
- {
- 0,
- IX_NPEMH_NPEA_INT,
- 0,
- 0,
- 0,
- 0,
- 0,
- NULL,
- FALSE
- },
- {
- 0,
- IX_NPEMH_NPEB_INT,
- 0,
- 0,
- 0,
- 0,
- 0,
- NULL,
- FALSE
- },
- {
- 0,
- IX_NPEMH_NPEC_INT,
- 0,
- 0,
- 0,
- 0,
- 0,
- NULL,
- FALSE
- }
-};
-
-PRIVATE IxNpeMhConfigStats ixNpeMhConfigStats[IX_NPEMH_NUM_NPES];
-
-/*
- * Extern function prototypes.
- */
-
-/*
- * Static function prototypes.
- */
-PRIVATE
-void ixNpeMhConfigIsr (void *parameter);
-
-/*
- * Function definition: ixNpeMhConfigIsr
- */
-
-PRIVATE
-void ixNpeMhConfigIsr (void *parameter)
-{
- IxNpeMhNpeId npeId = (IxNpeMhNpeId)parameter;
- UINT32 ofint;
- volatile UINT32 *statusReg =
- (UINT32 *)ixNpeMhConfigNpeInfo[npeId].statusRegister;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhConfigIsr\n");
-
- /* get the OFINT (OutFifo interrupt) bit of the status register */
- IX_NPEMH_REGISTER_READ_BITS (statusReg, &ofint, IX_NPEMH_NPE_STAT_OFINT);
-
- /* if the OFINT status bit is set */
- if (ofint)
- {
- /* if there is an ISR registered for this NPE */
- if (ixNpeMhConfigNpeInfo[npeId].isr != NULL)
- {
- /* invoke the ISR routine */
- ixNpeMhConfigNpeInfo[npeId].isr (npeId);
- }
- else
- {
- /* if we don't service the interrupt the NPE will continue */
- /* to trigger the interrupt indefinitely */
- IX_NPEMH_ERROR_REPORT ("No ISR registered to service "
- "interrupt\n");
- }
- }
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhConfigIsr\n");
-}
-
-/*
- * Function definition: ixNpeMhConfigInitialize
- */
-
-void ixNpeMhConfigInitialize (
- IxNpeMhNpeInterrupts npeInterrupts)
-{
- IxNpeMhNpeId npeId;
- UINT32 virtualAddr[IX_NPEMH_NUM_NPES];
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhConfigInitialize\n");
-
- /* Request a mapping for the NPE-A config register address space */
- virtualAddr[IX_NPEMH_NPEID_NPEA] =
- (UINT32) IX_OSAL_MEM_MAP (IX_NPEMH_NPEA_BASE,
- IX_OSAL_IXP400_NPEA_MAP_SIZE);
- IX_OSAL_ASSERT (virtualAddr[IX_NPEMH_NPEID_NPEA]);
-
- /* Request a mapping for the NPE-B config register address space */
- virtualAddr[IX_NPEMH_NPEID_NPEB] =
- (UINT32) IX_OSAL_MEM_MAP (IX_NPEMH_NPEB_BASE,
- IX_OSAL_IXP400_NPEB_MAP_SIZE);
- IX_OSAL_ASSERT (virtualAddr[IX_NPEMH_NPEID_NPEB]);
-
- /* Request a mapping for the NPE-C config register address space */
- virtualAddr[IX_NPEMH_NPEID_NPEC] =
- (UINT32) IX_OSAL_MEM_MAP (IX_NPEMH_NPEC_BASE,
- IX_OSAL_IXP400_NPEC_MAP_SIZE);
- IX_OSAL_ASSERT (virtualAddr[IX_NPEMH_NPEID_NPEC]);
-
- /* for each NPE ... */
- for (npeId = 0; npeId < IX_NPEMH_NUM_NPES; npeId++)
- {
- /* declare a convenience pointer */
- IxNpeMhConfigNpeInfo *npeInfo = &ixNpeMhConfigNpeInfo[npeId];
-
- /* store the virtual addresses of the NPE registers for later use */
- npeInfo->virtualRegisterBase = virtualAddr[npeId];
- npeInfo->statusRegister = virtualAddr[npeId] + IX_NPEMH_NPESTAT_OFFSET;
- npeInfo->controlRegister = virtualAddr[npeId] + IX_NPEMH_NPECTL_OFFSET;
- npeInfo->inFifoRegister = virtualAddr[npeId] + IX_NPEMH_NPEFIFO_OFFSET;
- npeInfo->outFifoRegister = virtualAddr[npeId] + IX_NPEMH_NPEFIFO_OFFSET;
-
- /* for test purposes - to verify the register addresses */
- IX_NPEMH_TRACE2 (IX_NPEMH_DEBUG, "NPE %d status register = "
- "0x%08X\n", npeId, npeInfo->statusRegister);
- IX_NPEMH_TRACE2 (IX_NPEMH_DEBUG, "NPE %d control register = "
- "0x%08X\n", npeId, npeInfo->controlRegister);
- IX_NPEMH_TRACE2 (IX_NPEMH_DEBUG, "NPE %d inFifo register = "
- "0x%08X\n", npeId, npeInfo->inFifoRegister);
- IX_NPEMH_TRACE2 (IX_NPEMH_DEBUG, "NPE %d outFifo register = "
- "0x%08X\n", npeId, npeInfo->outFifoRegister);
-
- /* connect our ISR to the NPE interrupt */
- (void) ixOsalIrqBind (
- npeInfo->interruptId, ixNpeMhConfigIsr, (void *)npeId);
-
- /* initialise a mutex for this NPE */
- (void) ixOsalMutexInit (&npeInfo->mutex);
-
- /* if we should service the NPE's "outFIFO not empty" interrupt */
- if (npeInterrupts == IX_NPEMH_NPEINTERRUPTS_YES)
- {
- /* enable the NPE's "outFIFO not empty" interrupt */
- ixNpeMhConfigNpeInterruptEnable (npeId);
- }
- else
- {
- /* disable the NPE's "outFIFO not empty" interrupt */
- ixNpeMhConfigNpeInterruptDisable (npeId);
- }
- }
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhConfigInitialize\n");
-}
-
-/*
- * Function definition: ixNpeMhConfigUninit
- */
-
-void ixNpeMhConfigUninit (void)
-{
- IxNpeMhNpeId npeId;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhConfigUninit\n");
-
- /* for each NPE ... */
- for (npeId = 0; npeId < IX_NPEMH_NUM_NPES; npeId++)
- {
- /* declare a convenience pointer */
- IxNpeMhConfigNpeInfo *npeInfo = &ixNpeMhConfigNpeInfo[npeId];
-
- /* disconnect ISR */
- ixOsalIrqUnbind(npeInfo->interruptId);
-
- /* destroy mutex associated with this NPE */
- ixOsalMutexDestroy(&npeInfo->mutex);
-
- IX_OSAL_MEM_UNMAP (npeInfo->virtualRegisterBase);
-
- npeInfo->virtualRegisterBase = 0;
- npeInfo->statusRegister = 0;
- npeInfo->controlRegister = 0;
- npeInfo->inFifoRegister = 0;
- npeInfo->outFifoRegister = 0;
- }
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhConfigUninit\n");
-}
-
-/*
- * Function definition: ixNpeMhConfigIsrRegister
- */
-
-void ixNpeMhConfigIsrRegister (
- IxNpeMhNpeId npeId,
- IxNpeMhConfigIsr isr)
-{
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhConfigIsrRegister\n");
-
- /* check if there is already an ISR registered for this NPE */
- if (ixNpeMhConfigNpeInfo[npeId].isr != NULL)
- {
- IX_NPEMH_TRACE0 (IX_NPEMH_DEBUG, "Over-writing registered NPE ISR\n");
- }
-
- /* save the ISR routine with the NPE info */
- ixNpeMhConfigNpeInfo[npeId].isr = isr;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhConfigIsrRegister\n");
-}
-
-/*
- * Function definition: ixNpeMhConfigNpeInterruptEnable
- */
-
-BOOL ixNpeMhConfigNpeInterruptEnable (
- IxNpeMhNpeId npeId)
-{
- UINT32 ofe;
- volatile UINT32 *controlReg =
- (UINT32 *)ixNpeMhConfigNpeInfo[npeId].controlRegister;
-
- /* get the OFE (OutFifoEnable) bit of the control register */
- IX_NPEMH_REGISTER_READ_BITS (controlReg, &ofe, IX_NPEMH_NPE_CTL_OFE);
-
- /* if the interrupt is disabled then we must enable it */
- if (!ofe)
- {
- /* set the OFE (OutFifoEnable) bit of the control register */
- /* we must set the OFEWE (OutFifoEnableWriteEnable) at the same */
- /* time for the write to have effect */
- IX_NPEMH_REGISTER_WRITE_BITS (controlReg,
- (IX_NPEMH_NPE_CTL_OFE |
- IX_NPEMH_NPE_CTL_OFEWE),
- (IX_NPEMH_NPE_CTL_OFE |
- IX_NPEMH_NPE_CTL_OFEWE));
- }
-
- /* return the previous state of the interrupt */
- return (ofe != 0);
-}
-
-/*
- * Function definition: ixNpeMhConfigNpeInterruptDisable
- */
-
-BOOL ixNpeMhConfigNpeInterruptDisable (
- IxNpeMhNpeId npeId)
-{
- UINT32 ofe;
- volatile UINT32 *controlReg =
- (UINT32 *)ixNpeMhConfigNpeInfo[npeId].controlRegister;
-
- /* get the OFE (OutFifoEnable) bit of the control register */
- IX_NPEMH_REGISTER_READ_BITS (controlReg, &ofe, IX_NPEMH_NPE_CTL_OFE);
-
- /* if the interrupt is enabled then we must disable it */
- if (ofe)
- {
- /* unset the OFE (OutFifoEnable) bit of the control register */
- /* we must set the OFEWE (OutFifoEnableWriteEnable) at the same */
- /* time for the write to have effect */
- IX_NPEMH_REGISTER_WRITE_BITS (controlReg,
- (0 |
- IX_NPEMH_NPE_CTL_OFEWE),
- (IX_NPEMH_NPE_CTL_OFE |
- IX_NPEMH_NPE_CTL_OFEWE));
- }
-
- /* return the previous state of the interrupt */
- return (ofe != 0);
-}
-
-/*
- * Function definition: ixNpeMhConfigMessageIdGet
- */
-
-IxNpeMhMessageId ixNpeMhConfigMessageIdGet (
- IxNpeMhMessage message)
-{
- /* return the most-significant byte of the first word of the */
- /* message */
- return ((IxNpeMhMessageId) ((message.data[0] >> 24) & 0xFF));
-}
-
-/*
- * Function definition: ixNpeMhConfigNpeIdIsValid
- */
-
-BOOL ixNpeMhConfigNpeIdIsValid (
- IxNpeMhNpeId npeId)
-{
- /* check that the npeId parameter is within the range of valid IDs */
- return (npeId >= 0 && npeId < IX_NPEMH_NUM_NPES);
-}
-
-/*
- * Function definition: ixNpeMhConfigLockGet
- */
-
-void ixNpeMhConfigLockGet (
- IxNpeMhNpeId npeId)
-{
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhConfigLockGet\n");
-
- /* lock the mutex for this NPE */
- (void) ixOsalMutexLock (&ixNpeMhConfigNpeInfo[npeId].mutex,
- IX_OSAL_WAIT_FOREVER);
-
- /* disable the NPE's "outFIFO not empty" interrupt */
- ixNpeMhConfigNpeInfo[npeId].oldInterruptState =
- ixNpeMhConfigNpeInterruptDisable (npeId);
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhConfigLockGet\n");
-}
-
-/*
- * Function definition: ixNpeMhConfigLockRelease
- */
-
-void ixNpeMhConfigLockRelease (
- IxNpeMhNpeId npeId)
-{
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhConfigLockRelease\n");
-
- /* if the interrupt was previously enabled */
- if (ixNpeMhConfigNpeInfo[npeId].oldInterruptState)
- {
- /* enable the NPE's "outFIFO not empty" interrupt */
- ixNpeMhConfigNpeInfo[npeId].oldInterruptState =
- ixNpeMhConfigNpeInterruptEnable (npeId);
- }
-
- /* unlock the mutex for this NPE */
- (void) ixOsalMutexUnlock (&ixNpeMhConfigNpeInfo[npeId].mutex);
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhConfigLockRelease\n");
-}
-
-/*
- * Function definition: ixNpeMhConfigInFifoWrite
- */
-
-IX_STATUS ixNpeMhConfigInFifoWrite (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message)
-{
- volatile UINT32 *npeInFifo =
- (UINT32 *)ixNpeMhConfigNpeInfo[npeId].inFifoRegister;
- UINT32 retriesCount = 0;
-
- /* write the first word of the message to the NPE's inFIFO */
- IX_NPEMH_REGISTER_WRITE (npeInFifo, message.data[0]);
-
- /* need to wait for room to write second word - see SCR #493,
- poll for maximum number of retries, if exceed maximum
- retries, exit from while loop */
- while ((IX_NPE_MH_MAX_NUM_OF_RETRIES > retriesCount)
- && ixNpeMhConfigInFifoIsFull (npeId))
- {
- retriesCount++;
- }
-
- /* Return TIMEOUT status to caller, indicate that NPE Hang / Halt */
- if (IX_NPE_MH_MAX_NUM_OF_RETRIES == retriesCount)
- {
- return IX_NPEMH_CRITICAL_NPE_ERR;
- }
-
- /* write the second word of the message to the NPE's inFIFO */
- IX_NPEMH_REGISTER_WRITE (npeInFifo, message.data[1]);
-
- /* record in the stats the maximum number of retries needed */
- if (ixNpeMhConfigStats[npeId].maxInFifoFullRetries < retriesCount)
- {
- ixNpeMhConfigStats[npeId].maxInFifoFullRetries = retriesCount;
- }
-
- /* update statistical info */
- ixNpeMhConfigStats[npeId].inFifoWrites++;
-
- return IX_SUCCESS;
-}
-
-/*
- * Function definition: ixNpeMhConfigOutFifoRead
- */
-
-IX_STATUS ixNpeMhConfigOutFifoRead (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage *message)
-{
- volatile UINT32 *npeOutFifo =
- (UINT32 *)ixNpeMhConfigNpeInfo[npeId].outFifoRegister;
- UINT32 retriesCount = 0;
-
- /* read the first word of the message from the NPE's outFIFO */
- IX_NPEMH_REGISTER_READ (npeOutFifo, &message->data[0]);
-
- /* need to wait for NPE to write second word - see SCR #493
- poll for maximum number of retries, if exceed maximum
- retries, exit from while loop */
- while ((IX_NPE_MH_MAX_NUM_OF_RETRIES > retriesCount)
- && ixNpeMhConfigOutFifoIsEmpty (npeId))
- {
- retriesCount++;
- }
-
- /* Return TIMEOUT status to caller, indicate that NPE Hang / Halt */
- if (IX_NPE_MH_MAX_NUM_OF_RETRIES == retriesCount)
- {
- return IX_NPEMH_CRITICAL_NPE_ERR;
- }
-
- /* read the second word of the message from the NPE's outFIFO */
- IX_NPEMH_REGISTER_READ (npeOutFifo, &message->data[1]);
-
- /* record in the stats the maximum number of retries needed */
- if (ixNpeMhConfigStats[npeId].maxOutFifoEmptyRetries < retriesCount)
- {
- ixNpeMhConfigStats[npeId].maxOutFifoEmptyRetries = retriesCount;
- }
-
- /* update statistical info */
- ixNpeMhConfigStats[npeId].outFifoReads++;
-
- return IX_SUCCESS;
-}
-
-/*
- * Function definition: ixNpeMhConfigShow
- */
-
-void ixNpeMhConfigShow (
- IxNpeMhNpeId npeId)
-{
- /* show the message fifo read counter */
- IX_NPEMH_SHOW ("Message FIFO reads",
- ixNpeMhConfigStats[npeId].outFifoReads);
-
- /* show the message fifo write counter */
- IX_NPEMH_SHOW ("Message FIFO writes",
- ixNpeMhConfigStats[npeId].inFifoWrites);
-
- /* show the max retries performed when inFIFO full */
- IX_NPEMH_SHOW ("Max inFIFO Full retries",
- ixNpeMhConfigStats[npeId].maxInFifoFullRetries);
-
- /* show the max retries performed when outFIFO empty */
- IX_NPEMH_SHOW ("Max outFIFO Empty retries",
- ixNpeMhConfigStats[npeId].maxOutFifoEmptyRetries);
-
- /* show the current status of the inFifo */
- ixOsalLog (IX_OSAL_LOG_LVL_USER, IX_OSAL_LOG_DEV_STDOUT,
- "InFifo is %s and %s\n",
- (ixNpeMhConfigInFifoIsEmpty (npeId) ?
- (int) "EMPTY" : (int) "NOT EMPTY"),
- (ixNpeMhConfigInFifoIsFull (npeId) ?
- (int) "FULL" : (int) "NOT FULL"),
- 0, 0, 0, 0);
-
- /* show the current status of the outFifo */
- ixOsalLog (IX_OSAL_LOG_LVL_USER, IX_OSAL_LOG_DEV_STDOUT,
- "OutFifo is %s and %s\n",
- (ixNpeMhConfigOutFifoIsEmpty (npeId) ?
- (int) "EMPTY" : (int) "NOT EMPTY"),
- (ixNpeMhConfigOutFifoIsFull (npeId) ?
- (int) "FULL" : (int) "NOT FULL"),
- 0, 0, 0, 0);
-}
-
-/*
- * Function definition: ixNpeMhConfigShowReset
- */
-
-void ixNpeMhConfigShowReset (
- IxNpeMhNpeId npeId)
-{
- /* reset the message fifo read counter */
- ixNpeMhConfigStats[npeId].outFifoReads = 0;
-
- /* reset the message fifo write counter */
- ixNpeMhConfigStats[npeId].inFifoWrites = 0;
-
- /* reset the max inFIFO Full retries counter */
- ixNpeMhConfigStats[npeId].maxInFifoFullRetries = 0;
-
- /* reset the max outFIFO empty retries counter */
- ixNpeMhConfigStats[npeId].maxOutFifoEmptyRetries = 0;
-}
-
-
diff --git a/cpu/ixp/npe/IxNpeMhReceive.c b/cpu/ixp/npe/IxNpeMhReceive.c
deleted file mode 100644
index 57c8be30e5..0000000000
--- a/cpu/ixp/npe/IxNpeMhReceive.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/**
- * @file IxNpeMhReceive.c
- *
- * @author Intel Corporation
- * @date 18 Jan 2002
- *
- * @brief This file contains the implementation of the private API for the
- * Receive module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/*
- * Put the system defined include files required.
- */
-
-
-/*
- * Put the user defined include files required.
- */
-#include "IxOsal.h"
-#include "IxNpeMhMacros_p.h"
-#include "IxNpeMhConfig_p.h"
-#include "IxNpeMhReceive_p.h"
-#include "IxNpeMhSolicitedCbMgr_p.h"
-#include "IxNpeMhUnsolicitedCbMgr_p.h"
-
-/*
- * #defines and macros used in this file.
- */
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-/**
- * @struct IxNpeMhReceiveStats
- *
- * @brief This structure is used to maintain statistics for the Receive
- * module.
- */
-
-typedef struct
-{
- UINT32 isrs; /**< receive ISR invocations */
- UINT32 receives; /**< receive messages invocations */
- UINT32 messages; /**< messages received */
- UINT32 solicited; /**< solicited messages received */
- UINT32 unsolicited; /**< unsolicited messages received */
- UINT32 callbacks; /**< callbacks invoked */
-} IxNpeMhReceiveStats;
-
-/*
- * Variable declarations global to this file only. Externs are followed by
- * static variables.
- */
-
-PRIVATE IxNpeMhReceiveStats ixNpeMhReceiveStats[IX_NPEMH_NUM_NPES];
-
-/*
- * Extern function prototypes.
- */
-
-/*
- * Static function prototypes.
- */
-PRIVATE
-void ixNpeMhReceiveIsr (int npeId);
-
-PRIVATE
-void ixNpeMhReceiveIsr (int npeId)
-{
- int lockKey;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhReceiveIsr\n");
-
- lockKey = ixOsalIrqLock ();
-
- /* invoke the message receive routine to get messages from the NPE */
- ixNpeMhReceiveMessagesReceive (npeId);
-
- /* update statistical info */
- ixNpeMhReceiveStats[npeId].isrs++;
-
- ixOsalIrqUnlock (lockKey);
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhReceiveIsr\n");
-}
-
-/*
- * Function definition: ixNpeMhReceiveInitialize
- */
-
-void ixNpeMhReceiveInitialize (void)
-{
- IxNpeMhNpeId npeId = 0;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhReceiveInitialize\n");
-
- /* for each NPE ... */
- for (npeId = 0; npeId < IX_NPEMH_NUM_NPES; npeId++)
- {
- /* register our internal ISR for the NPE to handle "outFIFO not */
- /* empty" interrupts */
- ixNpeMhConfigIsrRegister (npeId, ixNpeMhReceiveIsr);
- }
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhReceiveInitialize\n");
-}
-
-/*
- * Function definition: ixNpeMhReceiveMessagesReceive
- */
-
-IX_STATUS ixNpeMhReceiveMessagesReceive (
- IxNpeMhNpeId npeId)
-{
- IxNpeMhMessage message = { { 0, 0 } };
- IxNpeMhMessageId messageId = 0;
- IxNpeMhCallback callback = NULL;
- IX_STATUS status;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhReceiveMessagesReceive\n");
-
- /* update statistical info */
- ixNpeMhReceiveStats[npeId].receives++;
-
- /* while the NPE has messages in its outFIFO */
- while (!ixNpeMhConfigOutFifoIsEmpty (npeId))
- {
- /* read a message from the NPE's outFIFO */
- status = ixNpeMhConfigOutFifoRead (npeId, &message);
-
- if (IX_SUCCESS != status)
- {
- return status;
- }
-
- /* get the ID of the message */
- messageId = ixNpeMhConfigMessageIdGet (message);
-
- IX_NPEMH_TRACE2 (IX_NPEMH_DEBUG,
- "Received message from NPE %d with ID 0x%02X\n",
- npeId, messageId);
-
- /* update statistical info */
- ixNpeMhReceiveStats[npeId].messages++;
-
- /* try to find a matching unsolicited callback for this message. */
-
- /* we assume the message is unsolicited. only if there is no */
- /* unsolicited callback for this message type do we assume the */
- /* message is solicited. it is much faster to check for an */
- /* unsolicited callback, so doing this check first should result */
- /* in better performance. */
-
- ixNpeMhUnsolicitedCbMgrCallbackRetrieve (
- npeId, messageId, &callback);
-
- if (callback != NULL)
- {
- IX_NPEMH_TRACE0 (IX_NPEMH_DEBUG,
- "Found matching unsolicited callback\n");
-
- /* update statistical info */
- ixNpeMhReceiveStats[npeId].unsolicited++;
- }
-
- /* if no unsolicited callback was found try to find a matching */
- /* solicited callback for this message */
- if (callback == NULL)
- {
- ixNpeMhSolicitedCbMgrCallbackRetrieve (
- npeId, messageId, &callback);
-
- if (callback != NULL)
- {
- IX_NPEMH_TRACE0 (IX_NPEMH_DEBUG,
- "Found matching solicited callback\n");
-
- /* update statistical info */
- ixNpeMhReceiveStats[npeId].solicited++;
- }
- }
-
- /* if a callback (either unsolicited or solicited) was found */
- if (callback != NULL)
- {
- /* invoke the callback to pass the message back to the client */
- callback (npeId, message);
-
- /* update statistical info */
- ixNpeMhReceiveStats[npeId].callbacks++;
- }
- else /* no callback (neither unsolicited nor solicited) was found */
- {
- IX_NPEMH_TRACE2 (IX_NPEMH_WARNING,
- "No matching callback for NPE %d"
- " and ID 0x%02X, discarding message\n",
- npeId, messageId);
-
- /* the message will be discarded. this is normal behaviour */
- /* if the client passes a NULL solicited callback when */
- /* sending a message. this indicates that the client is not */
- /* interested in receiving the response. alternatively a */
- /* NULL callback here may signify an unsolicited message */
- /* with no appropriate registered callback. */
- }
- }
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhReceiveMessagesReceive\n");
-
- return IX_SUCCESS;
-}
-
-/*
- * Function definition: ixNpeMhReceiveShow
- */
-
-void ixNpeMhReceiveShow (
- IxNpeMhNpeId npeId)
-{
- /* show the ISR invocation counter */
- IX_NPEMH_SHOW ("Receive ISR invocations",
- ixNpeMhReceiveStats[npeId].isrs);
-
- /* show the receive message invocation counter */
- IX_NPEMH_SHOW ("Receive messages invocations",
- ixNpeMhReceiveStats[npeId].receives);
-
- /* show the message received counter */
- IX_NPEMH_SHOW ("Messages received",
- ixNpeMhReceiveStats[npeId].messages);
-
- /* show the solicited message counter */
- IX_NPEMH_SHOW ("Solicited messages received",
- ixNpeMhReceiveStats[npeId].solicited);
-
- /* show the unsolicited message counter */
- IX_NPEMH_SHOW ("Unsolicited messages received",
- ixNpeMhReceiveStats[npeId].unsolicited);
-
- /* show the callback invoked counter */
- IX_NPEMH_SHOW ("Callbacks invoked",
- ixNpeMhReceiveStats[npeId].callbacks);
-
- /* show the message discarded counter */
- IX_NPEMH_SHOW ("Received messages discarded",
- (ixNpeMhReceiveStats[npeId].messages -
- ixNpeMhReceiveStats[npeId].callbacks));
-}
-
-/*
- * Function definition: ixNpeMhReceiveShowReset
- */
-
-void ixNpeMhReceiveShowReset (
- IxNpeMhNpeId npeId)
-{
- /* reset the ISR invocation counter */
- ixNpeMhReceiveStats[npeId].isrs = 0;
-
- /* reset the receive message invocation counter */
- ixNpeMhReceiveStats[npeId].receives = 0;
-
- /* reset the message received counter */
- ixNpeMhReceiveStats[npeId].messages = 0;
-
- /* reset the solicited message counter */
- ixNpeMhReceiveStats[npeId].solicited = 0;
-
- /* reset the unsolicited message counter */
- ixNpeMhReceiveStats[npeId].unsolicited = 0;
-
- /* reset the callback invoked counter */
- ixNpeMhReceiveStats[npeId].callbacks = 0;
-}
diff --git a/cpu/ixp/npe/IxNpeMhSend.c b/cpu/ixp/npe/IxNpeMhSend.c
deleted file mode 100644
index 318913ac84..0000000000
--- a/cpu/ixp/npe/IxNpeMhSend.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/**
- * @file IxNpeMhSend.c
- *
- * @author Intel Corporation
- * @date 18 Jan 2002
- *
- * @brief This file contains the implementation of the private API for the
- * Send module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/*
- * Put the system defined include files required.
- */
-
-
-/*
- * Put the user defined include files required.
- */
-
-#include "IxNpeMhMacros_p.h"
-
-#include "IxNpeMhConfig_p.h"
-#include "IxNpeMhSend_p.h"
-#include "IxNpeMhSolicitedCbMgr_p.h"
-
-/*
- * #defines and macros used in this file.
- */
-
-/**
- * @def IX_NPEMH_INFIFO_RETRY_DELAY_US
- *
- * @brief Amount of time (uSecs) to delay between retries
- * while inFIFO is Full when attempting to send a message
- */
-#define IX_NPEMH_INFIFO_RETRY_DELAY_US (1)
-
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-/**
- * @struct IxNpeMhSendStats
- *
- * @brief This structure is used to maintain statistics for the Send
- * module.
- */
-
-typedef struct
-{
- UINT32 sends; /**< send invocations */
- UINT32 sendWithResponses; /**< send with response invocations */
- UINT32 queueFulls; /**< fifo queue full occurrences */
- UINT32 queueFullRetries; /**< fifo queue full retry occurrences */
- UINT32 maxQueueFullRetries; /**< max fifo queue full retries */
- UINT32 callbackFulls; /**< callback list full occurrences */
-} IxNpeMhSendStats;
-
-/*
- * Variable declarations global to this file only. Externs are followed by
- * static variables.
- */
-
-PRIVATE IxNpeMhSendStats ixNpeMhSendStats[IX_NPEMH_NUM_NPES];
-
-/*
- * Extern function prototypes.
- */
-
-/*
- * Static function prototypes.
- */
-PRIVATE
-BOOL ixNpeMhSendInFifoIsFull(
- IxNpeMhNpeId npeId,
- UINT32 maxSendRetries);
-
-/*
- * Function definition: ixNpeMhSendInFifoIsFull
- */
-
-PRIVATE
-BOOL ixNpeMhSendInFifoIsFull(
- IxNpeMhNpeId npeId,
- UINT32 maxSendRetries)
-{
- BOOL isFull = FALSE;
- UINT32 numRetries = 0;
-
- /* check the NPE's inFIFO */
- isFull = ixNpeMhConfigInFifoIsFull (npeId);
-
- /* we retry a few times, just to give the NPE a chance to read from */
- /* the FIFO if the FIFO is currently full */
- while (isFull && (numRetries++ < maxSendRetries))
- {
- if (numRetries >= IX_NPEMH_SEND_RETRIES_DEFAULT)
- {
- /* Delay here for as short a time as possible (1 us). */
- /* Adding a delay here should ensure we are not hogging */
- /* the AHB bus while we are retrying */
- ixOsalBusySleep (IX_NPEMH_INFIFO_RETRY_DELAY_US);
- }
-
- /* re-check the NPE's inFIFO */
- isFull = ixNpeMhConfigInFifoIsFull (npeId);
-
- /* update statistical info */
- ixNpeMhSendStats[npeId].queueFullRetries++;
- }
-
- /* record the highest number of retries that occurred */
- if (ixNpeMhSendStats[npeId].maxQueueFullRetries < numRetries)
- {
- ixNpeMhSendStats[npeId].maxQueueFullRetries = numRetries;
- }
-
- if (isFull)
- {
- /* update statistical info */
- ixNpeMhSendStats[npeId].queueFulls++;
- }
-
- return isFull;
-}
-
-/*
- * Function definition: ixNpeMhSendMessageSend
- */
-
-IX_STATUS ixNpeMhSendMessageSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- UINT32 maxSendRetries)
-{
- IX_STATUS status;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhSendMessageSend\n");
-
- /* update statistical info */
- ixNpeMhSendStats[npeId].sends++;
-
- /* check if the NPE's inFIFO is full - if so return an error */
- if (ixNpeMhSendInFifoIsFull (npeId, maxSendRetries))
- {
- IX_NPEMH_TRACE0 (IX_NPEMH_WARNING, "NPE's inFIFO is full\n");
- return IX_FAIL;
- }
-
- /* write the message to the NPE's inFIFO */
- status = ixNpeMhConfigInFifoWrite (npeId, message);
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhSendMessageSend\n");
-
- return status;
-}
-
-/*
- * Function definition: ixNpeMhSendMessageWithResponseSend
- */
-
-IX_STATUS ixNpeMhSendMessageWithResponseSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback solicitedCallback,
- UINT32 maxSendRetries)
-{
- IX_STATUS status = IX_SUCCESS;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhSendMessageWithResponseSend\n");
-
- /* update statistical info */
- ixNpeMhSendStats[npeId].sendWithResponses++;
-
- /* sr: this sleep will call the receive routine (no interrupts used!!!) */
- ixOsalSleep (IX_NPEMH_INFIFO_RETRY_DELAY_US);
-
- /* check if the NPE's inFIFO is full - if so return an error */
- if (ixNpeMhSendInFifoIsFull (npeId, maxSendRetries))
- {
- IX_NPEMH_TRACE0 (IX_NPEMH_WARNING, "NPE's inFIFO is full\n");
- return IX_FAIL;
- }
-
- /* save the solicited callback */
- status = ixNpeMhSolicitedCbMgrCallbackSave (
- npeId, solicitedMessageId, solicitedCallback);
- if (status != IX_SUCCESS)
- {
- IX_NPEMH_ERROR_REPORT ("Failed to save solicited callback\n");
-
- /* update statistical info */
- ixNpeMhSendStats[npeId].callbackFulls++;
-
- return status;
- }
-
- /* write the message to the NPE's inFIFO */
- status = ixNpeMhConfigInFifoWrite (npeId, message);
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhSendMessageWithResponseSend\n");
-
- return status;
-}
-
-/*
- * Function definition: ixNpeMhSendShow
- */
-
-void ixNpeMhSendShow (
- IxNpeMhNpeId npeId)
-{
- /* show the message send invocation counter */
- IX_NPEMH_SHOW ("Send invocations",
- ixNpeMhSendStats[npeId].sends);
-
- /* show the message send with response invocation counter */
- IX_NPEMH_SHOW ("Send with response invocations",
- ixNpeMhSendStats[npeId].sendWithResponses);
-
- /* show the fifo queue full occurrence counter */
- IX_NPEMH_SHOW ("Fifo queue full occurrences",
- ixNpeMhSendStats[npeId].queueFulls);
-
- /* show the fifo queue full retry occurrence counter */
- IX_NPEMH_SHOW ("Fifo queue full retry occurrences",
- ixNpeMhSendStats[npeId].queueFullRetries);
-
- /* show the fifo queue full maximum retries counter */
- IX_NPEMH_SHOW ("Maximum fifo queue full retries",
- ixNpeMhSendStats[npeId].maxQueueFullRetries);
-
- /* show the callback list full occurrence counter */
- IX_NPEMH_SHOW ("Solicited callback list full occurrences",
- ixNpeMhSendStats[npeId].callbackFulls);
-}
-
-/*
- * Function definition: ixNpeMhSendShowReset
- */
-
-void ixNpeMhSendShowReset (
- IxNpeMhNpeId npeId)
-{
- /* reset the message send invocation counter */
- ixNpeMhSendStats[npeId].sends = 0;
-
- /* reset the message send with response invocation counter */
- ixNpeMhSendStats[npeId].sendWithResponses = 0;
-
- /* reset the fifo queue full occurrence counter */
- ixNpeMhSendStats[npeId].queueFulls = 0;
-
- /* reset the fifo queue full retry occurrence counter */
- ixNpeMhSendStats[npeId].queueFullRetries = 0;
-
- /* reset the max fifo queue full retries counter */
- ixNpeMhSendStats[npeId].maxQueueFullRetries = 0;
-
- /* reset the callback list full occurrence counter */
- ixNpeMhSendStats[npeId].callbackFulls = 0;
-}
diff --git a/cpu/ixp/npe/IxNpeMhSolicitedCbMgr.c b/cpu/ixp/npe/IxNpeMhSolicitedCbMgr.c
deleted file mode 100644
index 8e083a63bf..0000000000
--- a/cpu/ixp/npe/IxNpeMhSolicitedCbMgr.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/**
- * @file IxNpeMhSolicitedCbMgr.c
- *
- * @author Intel Corporation
- * @date 18 Jan 2002
- *
- * @brief This file contains the implementation of the private API for the
- * Solicited Callback Manager module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-#ifndef IXNPEMHCONFIG_P_H
-# define IXNPEMHSOLICITEDCBMGR_C
-#else
-# error "Error, IxNpeMhConfig_p.h should not be included before this definition."
-#endif
-
-/*
- * Put the system defined include files required.
- */
-
-
-/*
- * Put the user defined include files required.
- */
-
-#include "IxOsal.h"
-
-#include "IxNpeMhMacros_p.h"
-#include "IxNpeMhSolicitedCbMgr_p.h"
-#include "IxNpeMhConfig_p.h"
-/*
- * #defines and macros used in this file.
- */
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-/**
- * @struct IxNpeMhSolicitedCallbackListEntry
- *
- * @brief This structure is used to store the information associated with
- * an entry in the callback list. This consists of the ID of the send
- * message (which indicates the ID of the corresponding response message)
- * and the callback function pointer itself.
- *
- */
-
-typedef struct IxNpeMhSolicitedCallbackListEntry
-{
- /** message ID */
- IxNpeMhMessageId messageId;
-
- /** callback function pointer */
- IxNpeMhCallback callback;
-
- /** pointer to next entry in the list */
- struct IxNpeMhSolicitedCallbackListEntry *next;
-} IxNpeMhSolicitedCallbackListEntry;
-
-/**
- * @struct IxNpeMhSolicitedCallbackList
- *
- * @brief This structure is used to maintain the list of response
- * callbacks. The number of entries in this list will be variable, and
- * they will be stored in a linked list fashion for ease of addition and
- * removal. The entries themselves are statically allocated, and are
- * organised into a "free" list and a "callback" list. Adding an entry
- * means taking an entry from the "free" list and adding it to the
- * "callback" list. Removing an entry means removing it from the
- * "callback" list and returning it to the "free" list.
- */
-
-typedef struct
-{
- /** pointer to the head of the free list */
- IxNpeMhSolicitedCallbackListEntry *freeHead;
-
- /** pointer to the head of the callback list */
- IxNpeMhSolicitedCallbackListEntry *callbackHead;
-
- /** pointer to the tail of the callback list */
- IxNpeMhSolicitedCallbackListEntry *callbackTail;
-
- /** array of entries - the first entry is used as a dummy entry to */
- /* avoid the scenario of having an empty list, hence '+ 1' */
- IxNpeMhSolicitedCallbackListEntry entries[IX_NPEMH_MAX_CALLBACKS + 1];
-} IxNpeMhSolicitedCallbackList;
-
-/**
- * @struct IxNpeMhSolicitedCbMgrStats
- *
- * @brief This structure is used to maintain statistics for the Solicited
- * Callback Manager module.
- */
-
-typedef struct
-{
- UINT32 saves; /**< callback list saves */
- UINT32 retrieves; /**< callback list retrieves */
-} IxNpeMhSolicitedCbMgrStats;
-
-/*
- * Variable declarations global to this file only. Externs are followed by
- * static variables.
- */
-
-PRIVATE IxNpeMhSolicitedCallbackList
-ixNpeMhSolicitedCbMgrCallbackLists[IX_NPEMH_NUM_NPES];
-
-PRIVATE IxNpeMhSolicitedCbMgrStats
-ixNpeMhSolicitedCbMgrStats[IX_NPEMH_NUM_NPES];
-
-/*
- * Extern function prototypes.
- */
-
-/*
- * Static function prototypes.
- */
-
-/*
- * Function definition: ixNpeMhSolicitedCbMgrInitialize
- */
-
-void ixNpeMhSolicitedCbMgrInitialize (void)
-{
- IxNpeMhNpeId npeId;
- UINT32 localIndex;
- IxNpeMhSolicitedCallbackList *list = NULL;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhSolicitedCbMgrInitialize\n");
-
- /* for each NPE ... */
- for (npeId = 0; npeId < IX_NPEMH_NUM_NPES; npeId++)
- {
- /* initialise a pointer to the list for convenience */
- list = &ixNpeMhSolicitedCbMgrCallbackLists[npeId];
-
- /* for each entry in the list, after the dummy entry ... */
- for (localIndex = 1; localIndex <= IX_NPEMH_MAX_CALLBACKS; localIndex++)
- {
- /* initialise the entry */
- list->entries[localIndex].messageId = 0x00;
- list->entries[localIndex].callback = NULL;
-
- /* if this entry is before the last entry */
- if (localIndex < IX_NPEMH_MAX_CALLBACKS)
- {
- /* chain this entry to the following entry */
- list->entries[localIndex].next = &(list->entries[localIndex + 1]);
- }
- else /* this entry is the last entry */
- {
- /* the last entry isn't chained to anything */
- list->entries[localIndex].next = NULL;
- }
- }
-
- /* set the free list pointer to point to the first real entry */
- /* (all real entries begin chained together on the free list) */
- list->freeHead = &(list->entries[1]);
-
- /* set the callback list pointers to point to the dummy entry */
- /* (the callback list is initially empty) */
- list->callbackHead = &(list->entries[0]);
- list->callbackTail = &(list->entries[0]);
- }
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhSolicitedCbMgrInitialize\n");
-}
-
-/*
- * Function definition: ixNpeMhSolicitedCbMgrCallbackSave
- */
-
-IX_STATUS ixNpeMhSolicitedCbMgrCallbackSave (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback solicitedCallback)
-{
- IxNpeMhSolicitedCallbackList *list = NULL;
- IxNpeMhSolicitedCallbackListEntry *callbackEntry = NULL;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhSolicitedCbMgrCallbackSave\n");
-
- /* initialise a pointer to the list for convenience */
- list = &ixNpeMhSolicitedCbMgrCallbackLists[npeId];
-
- /* check to see if there are any entries in the free list */
- if (list->freeHead == NULL)
- {
- IX_NPEMH_ERROR_REPORT ("Solicited callback list is full\n");
- return IX_FAIL;
- }
-
- /* there is an entry in the free list we can use */
-
- /* update statistical info */
- ixNpeMhSolicitedCbMgrStats[npeId].saves++;
-
- /* remove a callback entry from the start of the free list */
- callbackEntry = list->freeHead;
- list->freeHead = callbackEntry->next;
-
- /* fill in the callback entry with the new data */
- callbackEntry->messageId = solicitedMessageId;
- callbackEntry->callback = solicitedCallback;
-
- /* the new callback entry will be added to the tail of the callback */
- /* list, so it isn't chained to anything */
- callbackEntry->next = NULL;
-
- /* chain new callback entry to the last entry of the callback list */
- list->callbackTail->next = callbackEntry;
- list->callbackTail = callbackEntry;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhSolicitedCbMgrCallbackSave\n");
-
- return IX_SUCCESS;
-}
-
-/*
- * Function definition: ixNpeMhSolicitedCbMgrCallbackRetrieve
- */
-
-void ixNpeMhSolicitedCbMgrCallbackRetrieve (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback *solicitedCallback)
-{
- IxNpeMhSolicitedCallbackList *list = NULL;
- IxNpeMhSolicitedCallbackListEntry *callbackEntry = NULL;
- IxNpeMhSolicitedCallbackListEntry *previousEntry = NULL;
-
- /* initialise a pointer to the list for convenience */
- list = &ixNpeMhSolicitedCbMgrCallbackLists[npeId];
-
- /* initialise the callback entry to the first entry of the callback */
- /* list - we must skip over the dummy entry, which is the previous */
- callbackEntry = list->callbackHead->next;
- previousEntry = list->callbackHead;
-
- /* traverse the callback list looking for an entry with a matching */
- /* message ID. note we also save the previous entry's pointer to */
- /* allow us to unchain the matching entry from the callback list */
- while ((callbackEntry != NULL) &&
- (callbackEntry->messageId != solicitedMessageId))
- {
- previousEntry = callbackEntry;
- callbackEntry = callbackEntry->next;
- }
-
- /* if we didn't find a matching callback entry */
- if (callbackEntry == NULL)
- {
- /* return a NULL callback in the outgoing parameter */
- *solicitedCallback = NULL;
- }
- else /* we found a matching callback entry */
- {
- /* update statistical info */
- ixNpeMhSolicitedCbMgrStats[npeId].retrieves++;
-
- /* return the callback in the outgoing parameter */
- *solicitedCallback = callbackEntry->callback;
-
- /* unchain callback entry by chaining previous entry to next */
- previousEntry->next = callbackEntry->next;
-
- /* if the callback entry is at the tail of the list */
- if (list->callbackTail == callbackEntry)
- {
- /* update the tail of the callback list */
- list->callbackTail = previousEntry;
- }
-
- /* re-initialise the callback entry */
- callbackEntry->messageId = 0x00;
- callbackEntry->callback = NULL;
-
- /* add the callback entry to the start of the free list */
- callbackEntry->next = list->freeHead;
- list->freeHead = callbackEntry;
- }
-}
-
-/*
- * Function definition: ixNpeMhSolicitedCbMgrShow
- */
-
-void ixNpeMhSolicitedCbMgrShow (
- IxNpeMhNpeId npeId)
-{
- /* show the solicited callback list save counter */
- IX_NPEMH_SHOW ("Solicited callback list saves",
- ixNpeMhSolicitedCbMgrStats[npeId].saves);
-
- /* show the solicited callback list retrieve counter */
- IX_NPEMH_SHOW ("Solicited callback list retrieves",
- ixNpeMhSolicitedCbMgrStats[npeId].retrieves);
-}
-
-/*
- * Function definition: ixNpeMhSolicitedCbMgrShowReset
- */
-
-void ixNpeMhSolicitedCbMgrShowReset (
- IxNpeMhNpeId npeId)
-{
- /* reset the solicited callback list save counter */
- ixNpeMhSolicitedCbMgrStats[npeId].saves = 0;
-
- /* reset the solicited callback list retrieve counter */
- ixNpeMhSolicitedCbMgrStats[npeId].retrieves = 0;
-}
diff --git a/cpu/ixp/npe/IxNpeMhUnsolicitedCbMgr.c b/cpu/ixp/npe/IxNpeMhUnsolicitedCbMgr.c
deleted file mode 100644
index d37f9f9306..0000000000
--- a/cpu/ixp/npe/IxNpeMhUnsolicitedCbMgr.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/**
- * @file IxNpeMhUnsolicitedCbMgr.c
- *
- * @author Intel Corporation
- * @date 18 Jan 2002
- *
- * @brief This file contains the implementation of the private API for
- * the Unsolicited Callback Manager module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/*
- * Put the system defined include files required.
- */
-
-
-/*
- * Put the user defined include files required.
- */
-#include "IxOsal.h"
-
-#include "IxNpeMhMacros_p.h"
-
-#include "IxNpeMhUnsolicitedCbMgr_p.h"
-
-
-/*
- * #defines and macros used in this file.
- */
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-/**
- * @struct IxNpeMhUnsolicitedCallbackTable
- *
- * @brief This structure is used to maintain the list of registered
- * callbacks. One entry exists for each message ID, and a NULL entry will
- * signify that no callback has been registered for that ID.
- */
-
-typedef struct
-{
- /** array of entries */
- IxNpeMhCallback entries[IX_NPEMH_MAX_MESSAGE_ID + 1];
-} IxNpeMhUnsolicitedCallbackTable;
-
-/**
- * @struct IxNpeMhUnsolicitedCbMgrStats
- *
- * @brief This structure is used to maintain statistics for the Unsolicited
- * Callback Manager module.
- */
-
-typedef struct
-{
- UINT32 saves; /**< callback table saves */
- UINT32 overwrites; /**< callback table overwrites */
-} IxNpeMhUnsolicitedCbMgrStats;
-
-/*
- * Variable declarations global to this file only. Externs are followed by
- * static variables.
- */
-
-PRIVATE IxNpeMhUnsolicitedCallbackTable
-ixNpeMhUnsolicitedCallbackTables[IX_NPEMH_NUM_NPES];
-
-PRIVATE IxNpeMhUnsolicitedCbMgrStats
-ixNpeMhUnsolicitedCbMgrStats[IX_NPEMH_NUM_NPES];
-
-/*
- * Extern function prototypes.
- */
-
-/*
- * Static function prototypes.
- */
-
-/*
- * Function definition: ixNpeMhUnsolicitedCbMgrInitialize
- */
-
-void ixNpeMhUnsolicitedCbMgrInitialize (void)
-{
- IxNpeMhNpeId npeId = 0;
- IxNpeMhUnsolicitedCallbackTable *table = NULL;
- IxNpeMhMessageId messageId = 0;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhUnsolicitedCbMgrInitialize\n");
-
- /* for each NPE ... */
- for (npeId = 0; npeId < IX_NPEMH_NUM_NPES; npeId++)
- {
- /* initialise a pointer to the table for convenience */
- table = &ixNpeMhUnsolicitedCallbackTables[npeId];
-
- /* for each message ID ... */
- for (messageId = IX_NPEMH_MIN_MESSAGE_ID;
- messageId <= IX_NPEMH_MAX_MESSAGE_ID; messageId++)
- {
- /* initialise the callback for this message ID to NULL */
- table->entries[messageId] = NULL;
- }
- }
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhUnsolicitedCbMgrInitialize\n");
-}
-
-/*
- * Function definition: ixNpeMhUnsolicitedCbMgrCallbackSave
- */
-
-void ixNpeMhUnsolicitedCbMgrCallbackSave (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId unsolicitedMessageId,
- IxNpeMhCallback unsolicitedCallback)
-{
- IxNpeMhUnsolicitedCallbackTable *table = NULL;
-
- /* initialise a pointer to the table for convenience */
- table = &ixNpeMhUnsolicitedCallbackTables[npeId];
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering "
- "ixNpeMhUnsolicitedCbMgrCallbackSave\n");
-
- /* update statistical info */
- ixNpeMhUnsolicitedCbMgrStats[npeId].saves++;
-
- /* check if there is a callback already registered for this NPE and */
- /* message ID */
- if (table->entries[unsolicitedMessageId] != NULL)
- {
- /* if we are overwriting an existing callback */
- if (unsolicitedCallback != NULL)
- {
- IX_NPEMH_TRACE2 (IX_NPEMH_DEBUG, "Unsolicited callback "
- "overwriting existing callback for NPE ID %d "
- "message ID 0x%02X\n", npeId, unsolicitedMessageId);
- }
- else /* if we are clearing an existing callback */
- {
- IX_NPEMH_TRACE2 (IX_NPEMH_DEBUG, "NULL unsolicited callback "
- "clearing existing callback for NPE ID %d "
- "message ID 0x%02X\n", npeId, unsolicitedMessageId);
- }
-
- /* update statistical info */
- ixNpeMhUnsolicitedCbMgrStats[npeId].overwrites++;
- }
-
- /* save the callback into the table */
- table->entries[unsolicitedMessageId] = unsolicitedCallback;
-
- IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting "
- "ixNpeMhUnsolicitedCbMgrCallbackSave\n");
-}
-
-/*
- * Function definition: ixNpeMhUnsolicitedCbMgrCallbackRetrieve
- */
-
-void ixNpeMhUnsolicitedCbMgrCallbackRetrieve (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId unsolicitedMessageId,
- IxNpeMhCallback *unsolicitedCallback)
-{
- IxNpeMhUnsolicitedCallbackTable *table = NULL;
-
- /* initialise a pointer to the table for convenience */
- table = &ixNpeMhUnsolicitedCallbackTables[npeId];
-
- /* retrieve the callback from the table */
- *unsolicitedCallback = table->entries[unsolicitedMessageId];
-}
-
-/*
- * Function definition: ixNpeMhUnsolicitedCbMgrShow
- */
-
-void ixNpeMhUnsolicitedCbMgrShow (
- IxNpeMhNpeId npeId)
-{
- /* show the unsolicited callback table save counter */
- IX_NPEMH_SHOW ("Unsolicited callback table saves",
- ixNpeMhUnsolicitedCbMgrStats[npeId].saves);
-
- /* show the unsolicited callback table overwrite counter */
- IX_NPEMH_SHOW ("Unsolicited callback table overwrites",
- ixNpeMhUnsolicitedCbMgrStats[npeId].overwrites);
-}
-
-/*
- * Function definition: ixNpeMhUnsolicitedCbMgrShowReset
- */
-
-void ixNpeMhUnsolicitedCbMgrShowReset (
- IxNpeMhNpeId npeId)
-{
- /* reset the unsolicited callback table save counter */
- ixNpeMhUnsolicitedCbMgrStats[npeId].saves = 0;
-
- /* reset the unsolicited callback table overwrite counter */
- ixNpeMhUnsolicitedCbMgrStats[npeId].overwrites = 0;
-}
diff --git a/cpu/ixp/npe/IxOsalBufferMgt.c b/cpu/ixp/npe/IxOsalBufferMgt.c
deleted file mode 100644
index fa8db477af..0000000000
--- a/cpu/ixp/npe/IxOsalBufferMgt.c
+++ /dev/null
@@ -1,800 +0,0 @@
-/**
- * @file IxOsalBufferMgt.c
- *
- * @brief Default buffer pool management and buffer management
- * Implementation.
- *
- * Design Notes:
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/*
- * OS may choose to use default bufferMgt by defining
- * IX_OSAL_USE_DEFAULT_BUFFER_MGT in IxOsalOsBufferMgt.h
- */
-
-#include "IxOsal.h"
-
-#define IX_OSAL_BUFFER_FREE_PROTECTION /* Define this to enable Illegal MBuf Freed Protection*/
-
-/*
- * The implementation is only used when the following
- * is defined.
- */
-#ifdef IX_OSAL_USE_DEFAULT_BUFFER_MGT
-
-
-#define IX_OSAL_MBUF_SYS_SIGNATURE (0x8BADF00D)
-#define IX_OSAL_MBUF_SYS_SIGNATURE_MASK (0xEFFFFFFF)
-#define IX_OSAL_MBUF_USED_FLAG (0x10000000)
-#define IX_OSAL_MBUF_SYS_SIGNATURE_INIT(bufPtr) IX_OSAL_MBUF_SIGNATURE (bufPtr) = (UINT32)IX_OSAL_MBUF_SYS_SIGNATURE
-
-/*
-* This implementation is protect, the buffer pool management's ixOsalMBufFree
-* against an invalid MBUF pointer argument that already has been freed earlier
-* or in other words resides in the free pool of MBUFs. This added feature,
-* checks the MBUF "USED" FLAG. The Flag tells if the MBUF is still not freed
-* back to the Buffer Pool.
-* Disable this feature for performance reasons by undef
-* IX_OSAL_BUFFER_FREE_PROTECTION macro.
-*/
-#ifdef IX_OSAL_BUFFER_FREE_PROTECTION /*IX_OSAL_BUFFER_FREE_PROTECTION With Buffer Free protection*/
-
-#define IX_OSAL_MBUF_GET_SYS_SIGNATURE(bufPtr) (IX_OSAL_MBUF_SIGNATURE (bufPtr)&(IX_OSAL_MBUF_SYS_SIGNATURE_MASK) )
-#define IX_OSAL_MBUF_SET_SYS_SIGNATURE(bufPtr) do { \
- IX_OSAL_MBUF_SIGNATURE (bufPtr)&(~IX_OSAL_MBUF_SYS_SIGNATURE_MASK);\
- IX_OSAL_MBUF_SIGNATURE (bufPtr)|=IX_OSAL_MBUF_SYS_SIGNATURE; \
- }while(0)
-
-#define IX_OSAL_MBUF_SET_USED_FLAG(bufPtr) IX_OSAL_MBUF_SIGNATURE (bufPtr)|=IX_OSAL_MBUF_USED_FLAG
-#define IX_OSAL_MBUF_CLEAR_USED_FLAG(bufPtr) IX_OSAL_MBUF_SIGNATURE (bufPtr)&=~IX_OSAL_MBUF_USED_FLAG
-#define IX_OSAL_MBUF_ISSET_USED_FLAG(bufPtr) (IX_OSAL_MBUF_SIGNATURE (bufPtr)&IX_OSAL_MBUF_USED_FLAG)
-
-#else
-
-#define IX_OSAL_MBUF_GET_SYS_SIGNATURE(bufPtr) IX_OSAL_MBUF_SIGNATURE (bufPtr)
-#define IX_OSAL_MBUF_SET_SYS_SIGNATURE(bufPtr) IX_OSAL_MBUF_SIGNATURE (bufPtr) = IX_OSAL_MBUF_SYS_SIGNATURE
-
-#endif /*IX_OSAL_BUFFER_FREE_PROTECTION With Buffer Free protection*/
-/*
- * Variable declarations global to this file only. Externs are followed by
- * static variables.
- */
-
-/*
- * A unit of 32, used to provide bit-shift for pool
- * management. Needs some work if users want more than 32 pools.
- */
-#define IX_OSAL_BUFF_FREE_BITS 32
-
-PRIVATE UINT32 ixOsalBuffFreePools[IX_OSAL_MBUF_MAX_POOLS /
- IX_OSAL_BUFF_FREE_BITS];
-
-PUBLIC IX_OSAL_MBUF_POOL ixOsalBuffPools[IX_OSAL_MBUF_MAX_POOLS];
-
-static int ixOsalBuffPoolsInUse = 0;
-
-#ifdef IX_OSAL_BUFFER_ALLOC_SEPARATELY
-PRIVATE IX_OSAL_MBUF *
-ixOsalBuffPoolMbufInit (UINT32 mbufSizeAligned,
- UINT32 dataSizeAligned,
- IX_OSAL_MBUF_POOL *poolPtr);
-#endif
-
-PRIVATE IX_OSAL_MBUF_POOL * ixOsalPoolAlloc (void);
-
-/*
- * Function definition: ixOsalPoolAlloc
- */
-
-/****************************/
-
-PRIVATE IX_OSAL_MBUF_POOL *
-ixOsalPoolAlloc (void)
-{
- register unsigned int i = 0;
-
- /*
- * Scan for the first free buffer. Free buffers are indicated by 0
- * on the corrsponding bit in ixOsalBuffFreePools.
- */
- if (ixOsalBuffPoolsInUse >= IX_OSAL_MBUF_MAX_POOLS)
- {
- /*
- * Fail to grab a ptr this time
- */
- return NULL;
- }
-
- while (ixOsalBuffFreePools[i / IX_OSAL_BUFF_FREE_BITS] &
- (1 << (i % IX_OSAL_BUFF_FREE_BITS)))
- i++;
- /*
- * Free buffer found. Mark it as busy and initialize.
- */
- ixOsalBuffFreePools[i / IX_OSAL_BUFF_FREE_BITS] |=
- (1 << (i % IX_OSAL_BUFF_FREE_BITS));
-
- memset (&ixOsalBuffPools[i], 0, sizeof (IX_OSAL_MBUF_POOL));
-
- ixOsalBuffPools[i].poolIdx = i;
- ixOsalBuffPoolsInUse++;
-
- return &ixOsalBuffPools[i];
-}
-
-
-#ifdef IX_OSAL_BUFFER_ALLOC_SEPARATELY
-PRIVATE IX_OSAL_MBUF *
-ixOsalBuffPoolMbufInit (UINT32 mbufSizeAligned,
- UINT32 dataSizeAligned,
- IX_OSAL_MBUF_POOL *poolPtr)
-{
- UINT8 *dataPtr;
- IX_OSAL_MBUF *realMbufPtr;
- /* Allocate cache-aligned memory for mbuf header */
- realMbufPtr = (IX_OSAL_MBUF *) IX_OSAL_CACHE_DMA_MALLOC (mbufSizeAligned);
- IX_OSAL_ASSERT (realMbufPtr != NULL);
- memset (realMbufPtr, 0, mbufSizeAligned);
-
- /* Allocate cache-aligned memory for mbuf data */
- dataPtr = (UINT8 *) IX_OSAL_CACHE_DMA_MALLOC (dataSizeAligned);
- IX_OSAL_ASSERT (dataPtr != NULL);
- memset (dataPtr, 0, dataSizeAligned);
-
- /* Fill in mbuf header fields */
- IX_OSAL_MBUF_MDATA (realMbufPtr) = dataPtr;
- IX_OSAL_MBUF_ALLOCATED_BUFF_DATA (realMbufPtr) = (UINT32)dataPtr;
-
- IX_OSAL_MBUF_MLEN (realMbufPtr) = dataSizeAligned;
- IX_OSAL_MBUF_ALLOCATED_BUFF_LEN (realMbufPtr) = dataSizeAligned;
-
- IX_OSAL_MBUF_NET_POOL (realMbufPtr) = (IX_OSAL_MBUF_POOL *) poolPtr;
-
- IX_OSAL_MBUF_SYS_SIGNATURE_INIT(realMbufPtr);
-
- /* update some statistical information */
- poolPtr->mbufMemSize += mbufSizeAligned;
- poolPtr->dataMemSize += dataSizeAligned;
-
- return realMbufPtr;
-}
-#endif /* #ifdef IX_OSAL_BUFFER_ALLOC_SEPARATELY */
-
-/*
- * Function definition: ixOsalBuffPoolInit
- */
-
-PUBLIC IX_OSAL_MBUF_POOL *
-ixOsalPoolInit (UINT32 count, UINT32 size, const char *name)
-{
-
- /* These variables are only used if UX_OSAL_BUFFER_ALLOC_SEPERATELY
- * is defined .
- */
-#ifdef IX_OSAL_BUFFER_ALLOC_SEPARATELY
- UINT32 i, mbufSizeAligned, dataSizeAligned;
- IX_OSAL_MBUF *currentMbufPtr = NULL;
-#else
- void *poolBufPtr;
- void *poolDataPtr;
- int mbufMemSize;
- int dataMemSize;
-#endif
-
- IX_OSAL_MBUF_POOL *poolPtr = NULL;
-
- if (count <= 0)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalPoolInit(): " "count = 0 \n", 0, 0, 0, 0, 0, 0);
- return NULL;
- }
-
- if (name == NULL)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalPoolInit(): " "NULL name \n", 0, 0, 0, 0, 0, 0);
- return NULL;
- }
-
- if (strlen (name) > IX_OSAL_MBUF_POOL_NAME_LEN)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalPoolInit(): "
- "ERROR - name length should be no greater than %d \n",
- IX_OSAL_MBUF_POOL_NAME_LEN, 0, 0, 0, 0, 0);
- return NULL;
- }
-
-/* OS can choose whether to allocate all buffers all together (if it
- * can handle a huge single alloc request), or to allocate buffers
- * separately by the defining IX_OSAL_BUFFER_ALLOC_SEPARATELY.
- */
-#ifdef IX_OSAL_BUFFER_ALLOC_SEPARATELY
- /* Get a pool Ptr */
- poolPtr = ixOsalPoolAlloc ();
-
- if (poolPtr == NULL)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalPoolInit(): " "Fail to Get PoolPtr \n", 0, 0, 0, 0, 0, 0);
- return NULL;
- }
-
- mbufSizeAligned = IX_OSAL_MBUF_POOL_SIZE_ALIGN (sizeof (IX_OSAL_MBUF));
- dataSizeAligned = IX_OSAL_MBUF_POOL_SIZE_ALIGN(size);
-
- poolPtr->nextFreeBuf = NULL;
- poolPtr->mbufMemPtr = NULL;
- poolPtr->dataMemPtr = NULL;
- poolPtr->bufDataSize = dataSizeAligned;
- poolPtr->totalBufsInPool = count;
- poolPtr->poolAllocType = IX_OSAL_MBUF_POOL_TYPE_SYS_ALLOC;
- strcpy (poolPtr->name, name);
-
-
- for (i = 0; i < count; i++)
- {
- /* create an mbuf */
- currentMbufPtr = ixOsalBuffPoolMbufInit (mbufSizeAligned,
- dataSizeAligned,
- poolPtr);
-
-#ifdef IX_OSAL_BUFFER_FREE_PROTECTION
-/* Set the Buffer USED Flag. If not, ixOsalMBufFree will fail.
- ixOsalMbufFree used here is in a special case whereby, it's
- used to add MBUF to the Pool. By specification, ixOsalMbufFree
- deallocates an allocated MBUF from Pool.
-*/
- IX_OSAL_MBUF_SET_USED_FLAG(currentMbufPtr);
-#endif
- /* Add it to the pool */
- ixOsalMbufFree (currentMbufPtr);
-
- /* flush the pool information to RAM */
- IX_OSAL_CACHE_FLUSH (currentMbufPtr, mbufSizeAligned);
- }
-
- /*
- * update the number of free buffers in the pool
- */
- poolPtr->freeBufsInPool = count;
-
-#else
-/* Otherwise allocate buffers in a continuous block fashion */
- poolBufPtr = IX_OSAL_MBUF_POOL_MBUF_AREA_ALLOC (count, mbufMemSize);
- IX_OSAL_ASSERT (poolBufPtr != NULL);
- poolDataPtr =
- IX_OSAL_MBUF_POOL_DATA_AREA_ALLOC (count, size, dataMemSize);
- IX_OSAL_ASSERT (poolDataPtr != NULL);
-
- poolPtr = ixOsalNoAllocPoolInit (poolBufPtr, poolDataPtr,
- count, size, name);
- if (poolPtr == NULL)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalPoolInit(): " "Fail to get pool ptr \n", 0, 0, 0, 0, 0, 0);
- return NULL;
- }
-
- poolPtr->poolAllocType = IX_OSAL_MBUF_POOL_TYPE_SYS_ALLOC;
-
-#endif /* IX_OSAL_BUFFER_ALLOC_SEPARATELY */
- return poolPtr;
-}
-
-PUBLIC IX_OSAL_MBUF_POOL *
-ixOsalNoAllocPoolInit (void *poolBufPtr,
- void *poolDataPtr, UINT32 count, UINT32 size, const char *name)
-{
- UINT32 i, mbufSizeAligned, sizeAligned;
- IX_OSAL_MBUF *currentMbufPtr = NULL;
- IX_OSAL_MBUF *nextMbufPtr = NULL;
- IX_OSAL_MBUF_POOL *poolPtr = NULL;
-
- /*
- * check parameters
- */
- if (poolBufPtr == NULL)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalNoAllocPoolInit(): "
- "ERROR - NULL poolBufPtr \n", 0, 0, 0, 0, 0, 0);
- return NULL;
- }
-
- if (count <= 0)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalNoAllocPoolInit(): "
- "ERROR - count must > 0 \n", 0, 0, 0, 0, 0, 0);
- return NULL;
- }
-
- if (name == NULL)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalNoAllocPoolInit(): "
- "ERROR - NULL name ptr \n", 0, 0, 0, 0, 0, 0);
- return NULL;
- }
-
- if (strlen (name) > IX_OSAL_MBUF_POOL_NAME_LEN)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalNoAllocPoolInit(): "
- "ERROR - name length should be no greater than %d \n",
- IX_OSAL_MBUF_POOL_NAME_LEN, 0, 0, 0, 0, 0);
- return NULL;
- }
-
- poolPtr = ixOsalPoolAlloc ();
-
- if (poolPtr == NULL)
- {
- return NULL;
- }
-
- /*
- * Adjust sizes to ensure alignment on cache line boundaries
- */
- mbufSizeAligned =
- IX_OSAL_MBUF_POOL_SIZE_ALIGN (sizeof (IX_OSAL_MBUF));
- /*
- * clear the mbuf memory area
- */
- memset (poolBufPtr, 0, mbufSizeAligned * count);
-
- if (poolDataPtr != NULL)
- {
- /*
- * Adjust sizes to ensure alignment on cache line boundaries
- */
- sizeAligned = IX_OSAL_MBUF_POOL_SIZE_ALIGN (size);
- /*
- * clear the data memory area
- */
- memset (poolDataPtr, 0, sizeAligned * count);
- }
- else
- {
- sizeAligned = 0;
- }
-
- /*
- * initialise pool fields
- */
- strcpy ((poolPtr)->name, name);
-
- poolPtr->dataMemPtr = poolDataPtr;
- poolPtr->mbufMemPtr = poolBufPtr;
- poolPtr->bufDataSize = sizeAligned;
- poolPtr->totalBufsInPool = count;
- poolPtr->mbufMemSize = mbufSizeAligned * count;
- poolPtr->dataMemSize = sizeAligned * count;
-
- currentMbufPtr = (IX_OSAL_MBUF *) poolBufPtr;
-
- poolPtr->nextFreeBuf = currentMbufPtr;
-
- for (i = 0; i < count; i++)
- {
- if (i < (count - 1))
- {
- nextMbufPtr =
- (IX_OSAL_MBUF *) ((unsigned) currentMbufPtr +
- mbufSizeAligned);
- }
- else
- { /* last mbuf in chain */
- nextMbufPtr = NULL;
- }
- IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR (currentMbufPtr) = nextMbufPtr;
- IX_OSAL_MBUF_NET_POOL (currentMbufPtr) = poolPtr;
-
- IX_OSAL_MBUF_SYS_SIGNATURE_INIT(currentMbufPtr);
-
- if (poolDataPtr != NULL)
- {
- IX_OSAL_MBUF_MDATA (currentMbufPtr) = poolDataPtr;
- IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(currentMbufPtr) = (UINT32) poolDataPtr;
-
- IX_OSAL_MBUF_MLEN (currentMbufPtr) = sizeAligned;
- IX_OSAL_MBUF_ALLOCATED_BUFF_LEN(currentMbufPtr) = sizeAligned;
-
- poolDataPtr = (void *) ((unsigned) poolDataPtr + sizeAligned);
- }
-
- currentMbufPtr = nextMbufPtr;
- }
-
- /*
- * update the number of free buffers in the pool
- */
- poolPtr->freeBufsInPool = count;
-
- poolPtr->poolAllocType = IX_OSAL_MBUF_POOL_TYPE_USER_ALLOC;
-
- return poolPtr;
-}
-
-/*
- * Get a mbuf ptr from the pool
- */
-PUBLIC IX_OSAL_MBUF *
-ixOsalMbufAlloc (IX_OSAL_MBUF_POOL * poolPtr)
-{
- int lock;
- IX_OSAL_MBUF *newBufPtr = NULL;
-
- /*
- * check parameters
- */
- if (poolPtr == NULL)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalMbufAlloc(): "
- "ERROR - Invalid Parameter\n", 0, 0, 0, 0, 0, 0);
- return NULL;
- }
-
- lock = ixOsalIrqLock ();
-
- newBufPtr = poolPtr->nextFreeBuf;
- if (newBufPtr)
- {
- poolPtr->nextFreeBuf =
- IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR (newBufPtr);
- IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR (newBufPtr) = NULL;
-
- /*
- * update the number of free buffers in the pool
- */
- poolPtr->freeBufsInPool--;
- }
- else
- {
- /* Return NULL to indicate to caller that request is denied. */
- ixOsalIrqUnlock (lock);
-
- return NULL;
- }
-
-#ifdef IX_OSAL_BUFFER_FREE_PROTECTION
- /* Set Buffer Used Flag to indicate state.*/
- IX_OSAL_MBUF_SET_USED_FLAG(newBufPtr);
-#endif
-
- ixOsalIrqUnlock (lock);
-
- return newBufPtr;
-}
-
-PUBLIC IX_OSAL_MBUF *
-ixOsalMbufFree (IX_OSAL_MBUF * bufPtr)
-{
- int lock;
- IX_OSAL_MBUF_POOL *poolPtr;
-
- IX_OSAL_MBUF *nextBufPtr = NULL;
-
- /*
- * check parameters
- */
- if (bufPtr == NULL)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalMbufFree(): "
- "ERROR - Invalid Parameter\n", 0, 0, 0, 0, 0, 0);
- return NULL;
- }
-
-
-
- lock = ixOsalIrqLock ();
-
-#ifdef IX_OSAL_BUFFER_FREE_PROTECTION
-
- /* Prevention for Buffer freed more than once*/
- if(!IX_OSAL_MBUF_ISSET_USED_FLAG(bufPtr))
- {
- return NULL;
- }
- IX_OSAL_MBUF_CLEAR_USED_FLAG(bufPtr);
-#endif
-
- poolPtr = IX_OSAL_MBUF_NET_POOL (bufPtr);
-
- /*
- * check the mbuf wrapper signature (if mbuf wrapper was used)
- */
- if (poolPtr->poolAllocType == IX_OSAL_MBUF_POOL_TYPE_SYS_ALLOC)
- {
- IX_OSAL_ENSURE ( (IX_OSAL_MBUF_GET_SYS_SIGNATURE(bufPtr) == IX_OSAL_MBUF_SYS_SIGNATURE),
- "ixOsalBuffPoolBufFree: ERROR - Invalid mbuf signature.");
- }
-
- nextBufPtr = IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR (bufPtr);
-
- IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR (bufPtr) = poolPtr->nextFreeBuf;
- poolPtr->nextFreeBuf = bufPtr;
-
- /*
- * update the number of free buffers in the pool
- */
- poolPtr->freeBufsInPool++;
-
- ixOsalIrqUnlock (lock);
-
- return nextBufPtr;
-}
-
-PUBLIC void
-ixOsalMbufChainFree (IX_OSAL_MBUF * bufPtr)
-{
- while ((bufPtr = ixOsalMbufFree (bufPtr)));
-}
-
-/*
- * Function definition: ixOsalBuffPoolShow
- */
-PUBLIC void
-ixOsalMbufPoolShow (IX_OSAL_MBUF_POOL * poolPtr)
-{
- IX_OSAL_MBUF *nextBufPtr;
- int count = 0;
- int lock;
-
- /*
- * check parameters
- */
- if (poolPtr == NULL)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalBuffPoolShow(): "
- "ERROR - Invalid Parameter", 0, 0, 0, 0, 0, 0);
- /*
- * return IX_FAIL;
- */
- return;
- }
-
- lock = ixOsalIrqLock ();
- count = poolPtr->freeBufsInPool;
- nextBufPtr = poolPtr->nextFreeBuf;
- ixOsalIrqUnlock (lock);
-
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE,
- IX_OSAL_LOG_DEV_STDOUT, "=== POOL INFORMATION ===\n", 0, 0, 0,
- 0, 0, 0);
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
- "Pool Name: %s\n",
- (unsigned int) poolPtr->name, 0, 0, 0, 0, 0);
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
- "Pool Allocation Type: %d\n",
- (unsigned int) poolPtr->poolAllocType, 0, 0, 0, 0, 0);
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
- "Pool Mbuf Mem Usage (bytes): %d\n",
- (unsigned int) poolPtr->mbufMemSize, 0, 0, 0, 0, 0);
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
- "Pool Data Mem Usage (bytes): %d\n",
- (unsigned int) poolPtr->dataMemSize, 0, 0, 0, 0, 0);
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
- "Mbuf Data Capacity (bytes): %d\n",
- (unsigned int) poolPtr->bufDataSize, 0, 0, 0, 0, 0);
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
- "Total Mbufs in Pool: %d\n",
- (unsigned int) poolPtr->totalBufsInPool, 0, 0, 0, 0, 0);
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
- "Available Mbufs: %d\n", (unsigned int) count, 0,
- 0, 0, 0, 0);
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
- "Next Available Mbuf: %p\n", (unsigned int) nextBufPtr,
- 0, 0, 0, 0, 0);
-
- if (poolPtr->poolAllocType == IX_OSAL_MBUF_POOL_TYPE_USER_ALLOC)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE,
- IX_OSAL_LOG_DEV_STDOUT,
- "Mbuf Mem Area Start address: %p\n",
- (unsigned int) poolPtr->mbufMemPtr, 0, 0, 0, 0, 0);
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT,
- "Data Mem Area Start address: %p\n",
- (unsigned int) poolPtr->dataMemPtr, 0, 0, 0, 0, 0);
- }
-}
-
-PUBLIC void
-ixOsalMbufDataPtrReset (IX_OSAL_MBUF * bufPtr)
-{
- IX_OSAL_MBUF_POOL *poolPtr;
- UINT8 *poolDataPtr;
-
- if (bufPtr == NULL)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalBuffPoolBufDataPtrReset"
- ": ERROR - Invalid Parameter\n", 0, 0, 0, 0, 0, 0);
- return;
- }
-
- poolPtr = (IX_OSAL_MBUF_POOL *) IX_OSAL_MBUF_NET_POOL (bufPtr);
- poolDataPtr = poolPtr->dataMemPtr;
-
- if (poolPtr->poolAllocType == IX_OSAL_MBUF_POOL_TYPE_SYS_ALLOC)
- {
- if (IX_OSAL_MBUF_GET_SYS_SIGNATURE(bufPtr) != IX_OSAL_MBUF_SYS_SIGNATURE)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalBuffPoolBufDataPtrReset"
- ": invalid mbuf, cannot reset mData pointer\n", 0, 0,
- 0, 0, 0, 0);
- return;
- }
- IX_OSAL_MBUF_MDATA (bufPtr) = (UINT8*)IX_OSAL_MBUF_ALLOCATED_BUFF_DATA (bufPtr);
- }
- else
- {
- if (poolDataPtr)
- {
- unsigned int bufSize = poolPtr->bufDataSize;
- unsigned int bufDataAddr =
- (unsigned int) IX_OSAL_MBUF_MDATA (bufPtr);
- unsigned int poolDataAddr = (unsigned int) poolDataPtr;
-
- /*
- * the pointer is still pointing somewhere in the mbuf payload.
- * This operation moves the pointer to the beginning of the
- * mbuf payload
- */
- bufDataAddr = ((bufDataAddr - poolDataAddr) / bufSize) * bufSize;
- IX_OSAL_MBUF_MDATA (bufPtr) = &poolDataPtr[bufDataAddr];
- }
- else
- {
- ixOsalLog (IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalBuffPoolBufDataPtrReset"
- ": cannot be used if user supplied NULL pointer for pool data area "
- "when pool was created\n", 0, 0, 0, 0, 0, 0);
- return;
- }
- }
-
-}
-
-/*
- * Function definition: ixOsalBuffPoolUninit
- */
-PUBLIC IX_STATUS
-ixOsalBuffPoolUninit (IX_OSAL_MBUF_POOL * pool)
-{
- if (!pool)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalBuffPoolUninit: NULL ptr \n", 0, 0, 0, 0, 0, 0);
- return IX_FAIL;
- }
-
- if (pool->freeBufsInPool != pool->totalBufsInPool)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalBuffPoolUninit: need to return all ptrs to the pool first! \n",
- 0, 0, 0, 0, 0, 0);
- return IX_FAIL;
- }
-
- if (pool->poolAllocType == IX_OSAL_MBUF_POOL_TYPE_SYS_ALLOC)
- {
-#ifdef IX_OSAL_BUFFER_ALLOC_SEPARATELY
- UINT32 i;
- IX_OSAL_MBUF* pBuf;
-
- pBuf = pool->nextFreeBuf;
- /* Freed the Buffer one by one till all the Memory is freed*/
- for (i= pool->freeBufsInPool; i >0 && pBuf!=NULL ;i--){
- IX_OSAL_MBUF* pBufTemp;
- pBufTemp = IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(pBuf);
- /* Freed MBUF Data Memory area*/
- IX_OSAL_CACHE_DMA_FREE( (void *) (IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(pBuf)) );
- /* Freed MBUF Struct Memory area*/
- IX_OSAL_CACHE_DMA_FREE(pBuf);
- pBuf = pBufTemp;
- }
-
-#else
- IX_OSAL_CACHE_DMA_FREE (pool->mbufMemPtr);
- IX_OSAL_CACHE_DMA_FREE (pool->dataMemPtr);
-#endif
- }
-
- ixOsalBuffFreePools[pool->poolIdx / IX_OSAL_BUFF_FREE_BITS] &=
- ~(1 << (pool->poolIdx % IX_OSAL_BUFF_FREE_BITS));
- ixOsalBuffPoolsInUse--;
- return IX_SUCCESS;
-}
-
-/*
- * Function definition: ixOsalBuffPoolDataAreaSizeGet
- */
-PUBLIC UINT32
-ixOsalBuffPoolDataAreaSizeGet (int count, int size)
-{
- UINT32 memorySize;
- memorySize = count * IX_OSAL_MBUF_POOL_SIZE_ALIGN (size);
- return memorySize;
-}
-
-/*
- * Function definition: ixOsalBuffPoolMbufAreaSizeGet
- */
-PUBLIC UINT32
-ixOsalBuffPoolMbufAreaSizeGet (int count)
-{
- UINT32 memorySize;
- memorySize =
- count * IX_OSAL_MBUF_POOL_SIZE_ALIGN (sizeof (IX_OSAL_MBUF));
- return memorySize;
-}
-
-/*
- * Function definition: ixOsalBuffPoolFreeCountGet
- */
-PUBLIC UINT32 ixOsalBuffPoolFreeCountGet(IX_OSAL_MBUF_POOL * poolPtr)
-
-{
-
- return poolPtr->freeBufsInPool;
-
-}
-
-#endif /* IX_OSAL_USE_DEFAULT_BUFFER_MGT */
diff --git a/cpu/ixp/npe/IxOsalIoMem.c b/cpu/ixp/npe/IxOsalIoMem.c
deleted file mode 100644
index 9e540c18e0..0000000000
--- a/cpu/ixp/npe/IxOsalIoMem.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/**
- * @file IxOsalIoMem.c
- *
- * @brief OS-independent IO/Mem implementation
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/* Access to the global mem map is only allowed in this file */
-#define IxOsalIoMem_C
-
-#include "IxOsal.h"
-
-#define SEARCH_PHYSICAL_ADDRESS (1)
-#define SEARCH_VIRTUAL_ADDRESS (2)
-
-/*
- * Searches for map using one of the following criteria:
- *
- * - enough room to include a zone starting with the physical "requestedAddress" of size "size" (for mapping)
- * - includes the virtual "requestedAddress" in its virtual address space (already mapped, for unmapping)
- * - correct coherency
- *
- * Returns a pointer to the map or NULL if a suitable map is not found.
- */
-PRIVATE IxOsalMemoryMap *
-ixOsalMemMapFind (UINT32 requestedAddress,
- UINT32 size, UINT32 searchCriteria, UINT32 requestedEndianType)
-{
- UINT32 mapIndex;
-
- UINT32 numMapElements =
- sizeof (ixOsalGlobalMemoryMap) / sizeof (IxOsalMemoryMap);
-
- for (mapIndex = 0; mapIndex < numMapElements; mapIndex++)
- {
- IxOsalMemoryMap *map = &ixOsalGlobalMemoryMap[mapIndex];
-
- if (searchCriteria == SEARCH_PHYSICAL_ADDRESS
- && requestedAddress >= map->physicalAddress
- && (requestedAddress + size) <= (map->physicalAddress + map->size)
- && (map->mapEndianType & requestedEndianType) != 0)
- {
- return map;
- }
- else if (searchCriteria == SEARCH_VIRTUAL_ADDRESS
- && requestedAddress >= map->virtualAddress
- && requestedAddress <= (map->virtualAddress + map->size)
- && (map->mapEndianType & requestedEndianType) != 0)
- {
- return map;
- }
- else if (searchCriteria == SEARCH_PHYSICAL_ADDRESS)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3,
- IX_OSAL_LOG_DEV_STDOUT,
- "Osal: Checking [phys addr 0x%x:size 0x%x:endianType %d]\n",
- map->physicalAddress, map->size, map->mapEndianType, 0, 0, 0);
- }
- }
-
- /*
- * not found
- */
- return NULL;
-}
-
-/*
- * This function maps an I/O mapped physical memory zone of the given size
- * into a virtual memory zone accessible by the caller and returns a cookie -
- * the start address of the virtual memory zone.
- * IX_OSAL_MMAP_PHYS_TO_VIRT should NOT therefore be used on the returned
- * virtual address.
- * The memory zone is to be unmapped using ixOsalMemUnmap once the caller has
- * finished using this zone (e.g. on driver unload) using the cookie as
- * parameter.
- * The IX_OSAL_READ/WRITE_LONG/SHORT macros should be used to read and write
- * the mapped memory, adding the necessary offsets to the address cookie.
- *
- * Note: this function is not to be used directly. Use IX_OSAL_MEM_MAP
- * instead.
- */
-PUBLIC void *
-ixOsalIoMemMap (UINT32 requestedAddress,
- UINT32 size, IxOsalMapEndianessType requestedEndianType)
-{
- IxOsalMemoryMap *map;
-
- ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3,
- IX_OSAL_LOG_DEV_STDOUT,
- "OSAL: Mapping [addr 0x%x:size 0x%x:endianType %d]\n",
- requestedAddress, size, requestedEndianType, 0, 0, 0);
-
- if (requestedEndianType == IX_OSAL_LE)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalIoMemMap: Please specify component coherency mode to use MEM functions \n",
- 0, 0, 0, 0, 0, 0);
- return (NULL);
- }
- map = ixOsalMemMapFind (requestedAddress,
- size, SEARCH_PHYSICAL_ADDRESS, requestedEndianType);
- if (map != NULL)
- {
- UINT32 offset = requestedAddress - map->physicalAddress;
-
- ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3,
- IX_OSAL_LOG_DEV_STDOUT, "OSAL: Found map [", 0, 0, 0, 0, 0, 0);
- ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3,
- IX_OSAL_LOG_DEV_STDOUT, map->name, 0, 0, 0, 0, 0, 0);
- ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3,
- IX_OSAL_LOG_DEV_STDOUT,
- ":addr 0x%x: virt 0x%x:size 0x%x:ref %d:endianType %d]\n",
- map->physicalAddress, map->virtualAddress,
- map->size, map->refCount, map->mapEndianType, 0);
-
- if (map->type == IX_OSAL_DYNAMIC_MAP && map->virtualAddress == 0)
- {
- if (map->mapFunction != NULL)
- {
- map->mapFunction (map);
-
- if (map->virtualAddress == 0)
- {
- /*
- * failed
- */
- ixOsalLog (IX_OSAL_LOG_LVL_FATAL,
- IX_OSAL_LOG_DEV_STDERR,
- "OSAL: Remap failed - [addr 0x%x:size 0x%x:endianType %d]\n",
- requestedAddress, size, requestedEndianType, 0, 0, 0);
- return NULL;
- }
- }
- else
- {
- /*
- * error, no map function for a dynamic map
- */
- ixOsalLog (IX_OSAL_LOG_LVL_FATAL,
- IX_OSAL_LOG_DEV_STDERR,
- "OSAL: No map function for a dynamic map - "
- "[addr 0x%x:size 0x%x:endianType %d]\n",
- requestedAddress, size, requestedEndianType, 0, 0, 0);
-
- return NULL;
- }
- }
-
- /*
- * increment reference count
- */
- map->refCount++;
-
- return (void *) (map->virtualAddress + offset);
- }
-
- /*
- * requested address is not described in the global memory map
- */
- ixOsalLog (IX_OSAL_LOG_LVL_FATAL,
- IX_OSAL_LOG_DEV_STDERR,
- "OSAL: No mapping found - [addr 0x%x:size 0x%x:endianType %d]\n",
- requestedAddress, size, requestedEndianType, 0, 0, 0);
- return NULL;
-}
-
-/*
- * This function unmaps a previously mapped I/O memory zone using
- * the cookie obtained in the mapping operation. The memory zone in question
- * becomes unavailable to the caller once unmapped and the cookie should be
- * discarded.
- *
- * This function cannot fail if the given parameter is correct and does not
- * return a value.
- *
- * Note: this function is not to be used directly. Use IX_OSAL_MEM_UNMAP
- * instead.
- */
-PUBLIC void
-ixOsalIoMemUnmap (UINT32 requestedAddress, UINT32 endianType)
-{
- IxOsalMemoryMap *map;
-
- if (endianType == IX_OSAL_LE)
- {
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalIoMemUnmap: Please specify component coherency mode to use MEM functions \n",
- 0, 0, 0, 0, 0, 0);
- return;
- }
-
- if (requestedAddress == 0)
- {
- /*
- * invalid virtual address
- */
- return;
- }
-
- map =
- ixOsalMemMapFind (requestedAddress, 0, SEARCH_VIRTUAL_ADDRESS,
- endianType);
-
- if (map != NULL)
- {
- if (map->refCount > 0)
- {
- /*
- * decrement reference count
- */
- map->refCount--;
-
- if (map->refCount == 0)
- {
- /*
- * no longer used, deallocate
- */
- if (map->type == IX_OSAL_DYNAMIC_MAP
- && map->unmapFunction != NULL)
- {
- map->unmapFunction (map);
- }
- }
- }
- }
- else
- {
- ixOsalLog (IX_OSAL_LOG_LVL_WARNING,
- IX_OSAL_LOG_DEV_STDERR,
- "OSAL: ixOsServMemUnmap didn't find the requested map "
- "[virt addr 0x%x: endianType %d], ignoring call\n",
- requestedAddress, endianType, 0, 0, 0, 0);
- }
-}
-
-/*
- * This function Converts a virtual address into a physical
- * address, including the dynamically mapped memory.
- *
- * Parameters virtAddr - virtual address to convert
- * Return value: corresponding physical address, or NULL
- * if there is no physical address addressable
- * by the given virtual address
- * OS: VxWorks, Linux, WinCE, QNX, eCos
- * Reentrant: Yes
- * IRQ safe: Yes
- */
-PUBLIC UINT32
-ixOsalIoMemVirtToPhys (UINT32 virtualAddress, UINT32 requestedCoherency)
-{
- IxOsalMemoryMap *map =
- ixOsalMemMapFind (virtualAddress, 0, SEARCH_VIRTUAL_ADDRESS,
- requestedCoherency);
-
- if (map != NULL)
- {
- return map->physicalAddress + virtualAddress - map->virtualAddress;
- }
- else
- {
- return (UINT32) IX_OSAL_MMU_VIRT_TO_PHYS (virtualAddress);
- }
-}
-
-/*
- * This function Converts a virtual address into a physical
- * address, including the dynamically mapped memory.
- *
- * Parameters virtAddr - virtual address to convert
- * Return value: corresponding physical address, or NULL
- * if there is no physical address addressable
- * by the given virtual address
- * OS: VxWorks, Linux, WinCE, QNX, eCos
- * Reentrant: Yes
- * IRQ safe: Yes
- */
-PUBLIC UINT32
-ixOsalIoMemPhysToVirt (UINT32 physicalAddress, UINT32 requestedCoherency)
-{
- IxOsalMemoryMap *map =
- ixOsalMemMapFind (physicalAddress, 0, SEARCH_PHYSICAL_ADDRESS,
- requestedCoherency);
-
- if (map != NULL)
- {
- return map->virtualAddress + physicalAddress - map->physicalAddress;
- }
- else
- {
- return (UINT32) IX_OSAL_MMU_PHYS_TO_VIRT (physicalAddress);
- }
-}
diff --git a/cpu/ixp/npe/IxOsalOsCacheMMU.c b/cpu/ixp/npe/IxOsalOsCacheMMU.c
deleted file mode 100644
index 3db1a70da9..0000000000
--- a/cpu/ixp/npe/IxOsalOsCacheMMU.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * @file IxOsalOsCacheMMU.c (linux)
- *
- * @brief Cache MemAlloc and MemFree.
- *
- *
- * @par
- * IXP400 SW Release version 1.5
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxOsal.h"
-
-#include <malloc.h>
-
-/*
- * Allocate on a cache line boundary (null pointers are
- * not affected by this operation). This operation is NOT cache safe.
- */
-void *
-ixOsalCacheDmaMalloc (UINT32 n)
-{
- return malloc(n);
-}
-
-/*
- *
- */
-void
-ixOsalCacheDmaFree (void *ptr)
-{
- free(ptr);
-}
diff --git a/cpu/ixp/npe/IxOsalOsMsgQ.c b/cpu/ixp/npe/IxOsalOsMsgQ.c
deleted file mode 100644
index 45a5c68b16..0000000000
--- a/cpu/ixp/npe/IxOsalOsMsgQ.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * @file IxOsalOsMsgQ.c (eCos)
- *
- * @brief OS-specific Message Queue implementation.
- *
- *
- * @par
- * IXP400 SW Release version 1.5
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxOsal.h"
-
-/*******************************
- * Public functions
- *******************************/
-PUBLIC IX_STATUS
-ixOsalMessageQueueCreate (IxOsalMessageQueue * queue,
- UINT32 msgCount, UINT32 msgLen)
-{
- diag_printf("%s called\n", __FUNCTION__);
- return IX_FAIL;
-}
-
-PUBLIC IX_STATUS
-ixOsalMessageQueueDelete (IxOsalMessageQueue * queue)
-{
- diag_printf("%s called\n", __FUNCTION__);
- return IX_FAIL;
-}
-
-PUBLIC IX_STATUS
-ixOsalMessageQueueSend (IxOsalMessageQueue * queue, UINT8 * message)
-{
- diag_printf("%s called\n", __FUNCTION__);
- return IX_FAIL;
-}
-
-PUBLIC IX_STATUS
-ixOsalMessageQueueReceive (IxOsalMessageQueue * queue, UINT8 * message)
-{
- diag_printf("%s called\n", __FUNCTION__);
- return IX_FAIL;
-}
-
diff --git a/cpu/ixp/npe/IxOsalOsSemaphore.c b/cpu/ixp/npe/IxOsalOsSemaphore.c
deleted file mode 100644
index 443aefd4fc..0000000000
--- a/cpu/ixp/npe/IxOsalOsSemaphore.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file IxOsalOsSemaphore.c (eCos)
- *
- * @brief Implementation for semaphore and mutex.
- *
- *
- * @par
- * IXP400 SW Release version 1.5
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxOsal.h"
-#include "IxNpeMhReceive_p.h"
-
-/* Define a large number */
-#define IX_OSAL_MAX_LONG (0x7FFFFFFF)
-
-/* Max timeout in MS, used to guard against possible overflow */
-#define IX_OSAL_MAX_TIMEOUT_MS (IX_OSAL_MAX_LONG/HZ)
-
-
-PUBLIC IX_STATUS
-ixOsalSemaphoreInit (IxOsalSemaphore * sid, UINT32 start_value)
-{
- diag_printf("%s called\n", __FUNCTION__);
- return IX_SUCCESS;
-}
-
-/**
- * DESCRIPTION: If the semaphore is 'empty', the calling thread is blocked.
- * If the semaphore is 'full', it is taken and control is returned
- * to the caller. If the time indicated in 'timeout' is reached,
- * the thread will unblock and return an error indication. If the
- * timeout is set to 'IX_OSAL_WAIT_NONE', the thread will never block;
- * if it is set to 'IX_OSAL_WAIT_FOREVER', the thread will block until
- * the semaphore is available.
- *
- *
- */
-
-
-PUBLIC IX_STATUS
-ixOsalSemaphoreWait (IxOsalOsSemaphore * sid, INT32 timeout)
-{
- diag_printf("%s called\n", __FUNCTION__);
- return IX_SUCCESS;
-}
-
-/*
- * Attempt to get semaphore, return immediately,
- * no error info because users expect some failures
- * when using this API.
- */
-PUBLIC IX_STATUS
-ixOsalSemaphoreTryWait (IxOsalSemaphore * sid)
-{
- diag_printf("%s called\n", __FUNCTION__);
- return IX_FAIL;
-}
-
-/**
- *
- * DESCRIPTION: This function causes the next available thread in the pend queue
- * to be unblocked. If no thread is pending on this semaphore, the
- * semaphore becomes 'full'.
- */
-PUBLIC IX_STATUS
-ixOsalSemaphorePost (IxOsalSemaphore * sid)
-{
- diag_printf("%s called\n", __FUNCTION__);
- return IX_SUCCESS;
-}
-
-PUBLIC IX_STATUS
-ixOsalSemaphoreGetValue (IxOsalSemaphore * sid, UINT32 * value)
-{
- diag_printf("%s called\n", __FUNCTION__);
- return IX_FAIL;
-}
-
-PUBLIC IX_STATUS
-ixOsalSemaphoreDestroy (IxOsalSemaphore * sid)
-{
- diag_printf("%s called\n", __FUNCTION__);
- return IX_FAIL;
-}
-
-/****************************
- * Mutex
- ****************************/
-
-static void drv_mutex_init(IxOsalMutex *mutex)
-{
- *mutex = 0;
-}
-
-static void drv_mutex_destroy(IxOsalMutex *mutex)
-{
- *mutex = -1;
-}
-
-static int drv_mutex_trylock(IxOsalMutex *mutex)
-{
- int result = TRUE;
-
- if (*mutex == 1)
- result = FALSE;
-
- return result;
-}
-
-static void drv_mutex_unlock(IxOsalMutex *mutex)
-{
- if (*mutex == 1)
- printf("Trying to unlock unlocked mutex!");
-
- *mutex = 0;
-}
-
-PUBLIC IX_STATUS
-ixOsalMutexInit (IxOsalMutex * mutex)
-{
- drv_mutex_init(mutex);
- return IX_SUCCESS;
-}
-
-PUBLIC IX_STATUS
-ixOsalMutexLock (IxOsalMutex * mutex, INT32 timeout)
-{
- int tries;
-
- if (timeout == IX_OSAL_WAIT_NONE) {
- if (drv_mutex_trylock(mutex))
- return IX_SUCCESS;
- else
- return IX_FAIL;
- }
-
- tries = (timeout * 1000) / 50;
- while (1) {
- if (drv_mutex_trylock(mutex))
- return IX_SUCCESS;
- if (timeout != IX_OSAL_WAIT_FOREVER && tries-- <= 0)
- break;
- udelay(50);
- }
- return IX_FAIL;
-}
-
-PUBLIC IX_STATUS
-ixOsalMutexUnlock (IxOsalMutex * mutex)
-{
- drv_mutex_unlock(mutex);
- return IX_SUCCESS;
-}
-
-/*
- * Attempt to get mutex, return immediately,
- * no error info because users expect some failures
- * when using this API.
- */
-PUBLIC IX_STATUS
-ixOsalMutexTryLock (IxOsalMutex * mutex)
-{
- if (drv_mutex_trylock(mutex))
- return IX_SUCCESS;
- return IX_FAIL;
-}
-
-PUBLIC IX_STATUS
-ixOsalMutexDestroy (IxOsalMutex * mutex)
-{
- drv_mutex_destroy(mutex);
- return IX_SUCCESS;
-}
-
-PUBLIC IX_STATUS
-ixOsalFastMutexInit (IxOsalFastMutex * mutex)
-{
- return ixOsalMutexInit(mutex);
-}
-
-PUBLIC IX_STATUS ixOsalFastMutexTryLock(IxOsalFastMutex *mutex)
-{
- return ixOsalMutexTryLock(mutex);
-}
-
-
-PUBLIC IX_STATUS
-ixOsalFastMutexUnlock (IxOsalFastMutex * mutex)
-{
- return ixOsalMutexUnlock(mutex);
-}
-
-PUBLIC IX_STATUS
-ixOsalFastMutexDestroy (IxOsalFastMutex * mutex)
-{
- return ixOsalMutexDestroy(mutex);
-}
diff --git a/cpu/ixp/npe/IxOsalOsServices.c b/cpu/ixp/npe/IxOsalOsServices.c
deleted file mode 100644
index a4bc5a0ee5..0000000000
--- a/cpu/ixp/npe/IxOsalOsServices.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/**
- * @file IxOsalOsServices.c (linux)
- *
- * @brief Implementation for Irq, Mem, sleep.
- *
- *
- * @par
- * IXP400 SW Release version 1.5
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include <config.h>
-#include <common.h>
-#include "IxOsal.h"
-#include <IxEthAcc.h>
-#include <IxEthDB.h>
-#include <IxNpeDl.h>
-#include <IxQMgr.h>
-#include <IxNpeMh.h>
-
-static char *traceHeaders[] = {
- "",
- "[fatal] ",
- "[error] ",
- "[warning] ",
- "[message] ",
- "[debug1] ",
- "[debug2] ",
- "[debug3] ",
- "[all]"
-};
-
-/* by default trace all but debug message */
-PRIVATE int ixOsalCurrLogLevel = IX_OSAL_LOG_LVL_MESSAGE;
-
-/**************************************
- * Irq services
- *************************************/
-
-PUBLIC IX_STATUS
-ixOsalIrqBind (UINT32 vector, IxOsalVoidFnVoidPtr routine, void *parameter)
-{
- return IX_FAIL;
-}
-
-PUBLIC IX_STATUS
-ixOsalIrqUnbind (UINT32 vector)
-{
- return IX_FAIL;
-}
-
-PUBLIC UINT32
-ixOsalIrqLock ()
-{
- return 0;
-}
-
-/* Enable interrupts and task scheduling,
- * input parameter: irqEnable status returned
- * by ixOsalIrqLock().
- */
-PUBLIC void
-ixOsalIrqUnlock (UINT32 lockKey)
-{
-}
-
-PUBLIC UINT32
-ixOsalIrqLevelSet (UINT32 level)
-{
- return IX_FAIL;
-}
-
-PUBLIC void
-ixOsalIrqEnable (UINT32 irqLevel)
-{
-}
-
-PUBLIC void
-ixOsalIrqDisable (UINT32 irqLevel)
-{
-}
-
-/*********************
- * Log function
- *********************/
-
-INT32
-ixOsalLog (IxOsalLogLevel level,
- IxOsalLogDevice device,
- char *format, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6)
-{
- /*
- * Return -1 for custom display devices
- */
- if ((device != IX_OSAL_LOG_DEV_STDOUT)
- && (device != IX_OSAL_LOG_DEV_STDERR))
- {
- debug("ixOsalLog: only IX_OSAL_LOG_DEV_STDOUT and IX_OSAL_LOG_DEV_STDERR are supported \n");
- return (IX_OSAL_LOG_ERROR);
- }
-
- if (level <= ixOsalCurrLogLevel && level != IX_OSAL_LOG_LVL_NONE)
- {
- int headerByteCount = (level == IX_OSAL_LOG_LVL_USER) ? 0 : strlen(traceHeaders[level - 1]);
-
- return headerByteCount + strlen(format);
- }
- else
- {
- /*
- * Return error
- */
- return (IX_OSAL_LOG_ERROR);
- }
-}
-
-PUBLIC UINT32
-ixOsalLogLevelSet (UINT32 level)
-{
- UINT32 oldLevel;
-
- /*
- * Check value first
- */
- if ((level < IX_OSAL_LOG_LVL_NONE) || (level > IX_OSAL_LOG_LVL_ALL))
- {
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE,
- IX_OSAL_LOG_DEV_STDOUT,
- "ixOsalLogLevelSet: Log Level is between %d and%d \n",
- IX_OSAL_LOG_LVL_NONE, IX_OSAL_LOG_LVL_ALL, 0, 0, 0, 0);
- return IX_OSAL_LOG_LVL_NONE;
- }
- oldLevel = ixOsalCurrLogLevel;
-
- ixOsalCurrLogLevel = level;
-
- return oldLevel;
-}
-
-/**************************************
- * Task services
- *************************************/
-
-PUBLIC void
-ixOsalBusySleep (UINT32 microseconds)
-{
- udelay(microseconds);
-}
-
-PUBLIC void
-ixOsalSleep (UINT32 milliseconds)
-{
- if (milliseconds != 0) {
- /*
- * sr: We poll while we wait because interrupts are off in U-Boot
- * and CSR expects messages, etc to be dispatched while sleeping.
- */
- int i;
- IxQMgrDispatcherFuncPtr qDispatcherFunc;
-
- ixQMgrDispatcherLoopGet(&qDispatcherFunc);
-
- while (milliseconds--) {
- for (i = 1; i <= 2; i++)
- ixNpeMhMessagesReceive(i);
- (*qDispatcherFunc)(IX_QMGR_QUELOW_GROUP);
-
- udelay(1000);
- }
- }
-}
-
-/**************************************
- * Memory functions
- *************************************/
-
-void *
-ixOsalMemAlloc (UINT32 size)
-{
- return (void *)0;
-}
-
-void
-ixOsalMemFree (void *ptr)
-{
-}
-
-/*
- * Copy count bytes from src to dest ,
- * returns pointer to the dest mem zone.
- */
-void *
-ixOsalMemCopy (void *dest, void *src, UINT32 count)
-{
- IX_OSAL_ASSERT (dest != NULL);
- IX_OSAL_ASSERT (src != NULL);
- return (memcpy (dest, src, count));
-}
-
-/*
- * Fills a memory zone with a given constant byte,
- * returns pointer to the memory zone.
- */
-void *
-ixOsalMemSet (void *ptr, UINT8 filler, UINT32 count)
-{
- IX_OSAL_ASSERT (ptr != NULL);
- return (memset (ptr, filler, count));
-}
diff --git a/cpu/ixp/npe/IxOsalOsThread.c b/cpu/ixp/npe/IxOsalOsThread.c
deleted file mode 100644
index e6a4967fcd..0000000000
--- a/cpu/ixp/npe/IxOsalOsThread.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * @file IxOsalOsThread.c (eCos)
- *
- * @brief OS-specific thread implementation.
- *
- *
- * @par
- * IXP400 SW Release version 1.5
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxOsal.h"
-
-/* Thread attribute is ignored */
-PUBLIC IX_STATUS
-ixOsalThreadCreate (IxOsalThread * ptrTid,
- IxOsalThreadAttr * threadAttr, IxOsalVoidFnVoidPtr entryPoint, void *arg)
-{
- return IX_SUCCESS;
-}
-
-/*
- * Start thread after given its thread handle
- */
-PUBLIC IX_STATUS
-ixOsalThreadStart (IxOsalThread * tId)
-{
- /* Thread already started upon creation */
- return IX_SUCCESS;
-}
-
-/*
- * In Linux threadKill does not actually destroy the thread,
- * it will stop the signal handling.
- */
-PUBLIC IX_STATUS
-ixOsalThreadKill (IxOsalThread * tid)
-{
- return IX_SUCCESS;
-}
-
-PUBLIC void
-ixOsalThreadExit (void)
-{
-}
-
-PUBLIC IX_STATUS
-ixOsalThreadPrioritySet (IxOsalOsThread * tid, UINT32 priority)
-{
- return IX_SUCCESS;
-}
-
-PUBLIC IX_STATUS
-ixOsalThreadSuspend (IxOsalThread * tId)
-{
- return IX_SUCCESS;
-
-}
-
-PUBLIC IX_STATUS
-ixOsalThreadResume (IxOsalThread * tId)
-{
- return IX_SUCCESS;
-}
diff --git a/cpu/ixp/npe/IxQMgrAqmIf.c b/cpu/ixp/npe/IxQMgrAqmIf.c
deleted file mode 100644
index b27b3a2877..0000000000
--- a/cpu/ixp/npe/IxQMgrAqmIf.c
+++ /dev/null
@@ -1,963 +0,0 @@
-/*
- * @file: IxQMgrAqmIf.c
- *
- * @author Intel Corporation
- * @date 30-Oct-2001
- *
- * @brief This component provides a set of functions for
- * perfoming I/O on the AQM hardware.
- *
- * Design Notes:
- * These functions are intended to be as fast as possible
- * and as a result perform NO PARAMETER CHECKING.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/*
- * Inlines are compiled as function when this is defined.
- * N.B. Must be placed before #include of "IxQMgrAqmIf_p.h
- */
-#ifndef IXQMGRAQMIF_P_H
-# define IXQMGRAQMIF_C
-#else
-# error
-#endif
-
-/*
- * User defined include files.
- */
-#include "IxOsal.h"
-#include "IxQMgr.h"
-#include "IxQMgrAqmIf_p.h"
-#include "IxQMgrLog_p.h"
-
-
-/*
- * #defines and macros used in this file.
- */
-
-/* These defines are the bit offsets of the various fields of
- * the queue configuration register
- */
-#define IX_QMGR_Q_CONFIG_WRPTR_OFFSET 0x00
-#define IX_QMGR_Q_CONFIG_RDPTR_OFFSET 0x07
-#define IX_QMGR_Q_CONFIG_BADDR_OFFSET 0x0E
-#define IX_QMGR_Q_CONFIG_ESIZE_OFFSET 0x16
-#define IX_QMGR_Q_CONFIG_BSIZE_OFFSET 0x18
-#define IX_QMGR_Q_CONFIG_NE_OFFSET 0x1A
-#define IX_QMGR_Q_CONFIG_NF_OFFSET 0x1D
-
-#define IX_QMGR_BASE_ADDR_16_WORD_ALIGN 0x40
-#define IX_QMGR_BASE_ADDR_16_WORD_SHIFT 0x6
-
-#define IX_QMGR_NE_NF_CLEAR_MASK 0x03FFFFFF
-#define IX_QMGR_NE_MASK 0x7
-#define IX_QMGR_NF_MASK 0x7
-#define IX_QMGR_SIZE_MASK 0x3
-#define IX_QMGR_ENTRY_SIZE_MASK 0x3
-#define IX_QMGR_BADDR_MASK 0x003FC000
-#define IX_QMGR_RDPTR_MASK 0x7F
-#define IX_QMGR_WRPTR_MASK 0x7F
-#define IX_QMGR_RDWRPTR_MASK 0x00003FFF
-
-#define IX_QMGR_AQM_ADDRESS_SPACE_SIZE_IN_WORDS 0x1000
-
-/* Base address of AQM SRAM */
-#define IX_QMGR_AQM_SRAM_BASE_ADDRESS_OFFSET \
-((IX_QMGR_QUECONFIG_BASE_OFFSET) + (IX_QMGR_QUECONFIG_SIZE))
-
-/* Min buffer size used for generating buffer size in QUECONFIG */
-#define IX_QMGR_MIN_BUFFER_SIZE 16
-
-/* Reset values of QMgr hardware registers */
-#define IX_QMGR_QUELOWSTAT_RESET_VALUE 0x33333333
-#define IX_QMGR_QUEUOSTAT_RESET_VALUE 0x00000000
-#define IX_QMGR_QUEUPPSTAT0_RESET_VALUE 0xFFFFFFFF
-#define IX_QMGR_QUEUPPSTAT1_RESET_VALUE 0x00000000
-#define IX_QMGR_INT0SRCSELREG_RESET_VALUE 0x00000000
-#define IX_QMGR_QUEIEREG_RESET_VALUE 0x00000000
-#define IX_QMGR_QINTREG_RESET_VALUE 0xFFFFFFFF
-#define IX_QMGR_QUECONFIG_RESET_VALUE 0x00000000
-
-#define IX_QMGR_PHYSICAL_AQM_BASE_ADDRESS IX_OSAL_IXP400_QMGR_PHYS_BASE
-
-#define IX_QMGR_QUELOWSTAT_BITS_PER_Q (BITS_PER_WORD/IX_QMGR_QUELOWSTAT_NUM_QUE_PER_WORD)
-
-#define IX_QMGR_QUELOWSTAT_QID_MASK 0x7
-#define IX_QMGR_Q_CONFIG_ADDR_GET(qId)\
- (((qId) * IX_QMGR_NUM_BYTES_PER_WORD) +\
- IX_QMGR_QUECONFIG_BASE_OFFSET)
-
-#define IX_QMGR_ENTRY1_OFFSET 0
-#define IX_QMGR_ENTRY2_OFFSET 1
-#define IX_QMGR_ENTRY4_OFFSET 3
-
-/*
- * Variable declarations global to this file. Externs are followed by
- * statics.
- */
-UINT32 aqmBaseAddress = 0;
-/* Store addresses and bit-masks for certain queue access and status registers.
- * This is to facilitate inlining of QRead, QWrite and QStatusGet functions
- * in IxQMgr,h
- */
-extern IxQMgrQInlinedReadWriteInfo ixQMgrQInlinedReadWriteInfo[];
-UINT32 * ixQMgrAqmIfQueAccRegAddr[IX_QMGR_MAX_NUM_QUEUES];
-UINT32 ixQMgrAqmIfQueLowStatRegAddr[IX_QMGR_MIN_QUEUPP_QID];
-UINT32 ixQMgrAqmIfQueLowStatBitsOffset[IX_QMGR_MIN_QUEUPP_QID];
-UINT32 ixQMgrAqmIfQueLowStatBitsMask;
-UINT32 ixQMgrAqmIfQueUppStat0RegAddr;
-UINT32 ixQMgrAqmIfQueUppStat1RegAddr;
-UINT32 ixQMgrAqmIfQueUppStat0BitMask[IX_QMGR_MIN_QUEUPP_QID];
-UINT32 ixQMgrAqmIfQueUppStat1BitMask[IX_QMGR_MIN_QUEUPP_QID];
-
-/*
- * Fast mutexes, one for each queue, used to protect peek & poke functions
- */
-IxOsalFastMutex ixQMgrAqmIfPeekPokeFastMutex[IX_QMGR_MAX_NUM_QUEUES];
-
-/*
- * Function prototypes
- */
-PRIVATE unsigned
-watermarkToAqmWatermark (IxQMgrWMLevel watermark );
-
-PRIVATE unsigned
-entrySizeToAqmEntrySize (IxQMgrQEntrySizeInWords entrySize);
-
-PRIVATE unsigned
-bufferSizeToAqmBufferSize (unsigned bufferSizeInWords);
-
-PRIVATE void
-ixQMgrAqmIfRegistersReset (void);
-
-PRIVATE void
-ixQMgrAqmIfEntryAddressGet (unsigned int entryIndex,
- UINT32 configRegWord,
- unsigned int qEntrySizeInwords,
- unsigned int qSizeInWords,
- UINT32 **address);
-/*
- * Function definitions
- */
-void
-ixQMgrAqmIfInit (void)
-{
- UINT32 aqmVirtualAddr;
- int i;
-
- /* The value of aqmBaseAddress depends on the logical address
- * assigned by the MMU.
- */
- aqmVirtualAddr =
- (UINT32) IX_OSAL_MEM_MAP(IX_QMGR_PHYSICAL_AQM_BASE_ADDRESS,
- IX_OSAL_IXP400_QMGR_MAP_SIZE);
- IX_OSAL_ASSERT (aqmVirtualAddr);
-
- ixQMgrAqmIfBaseAddressSet (aqmVirtualAddr);
-
- ixQMgrAqmIfRegistersReset ();
-
- for (i = 0; i< IX_QMGR_MAX_NUM_QUEUES; i++)
- {
- ixOsalFastMutexInit(&ixQMgrAqmIfPeekPokeFastMutex[i]);
-
- /********************************************************************
- * Register addresses and bit masks are calculated and stored here to
- * facilitate inlining of QRead, QWrite and QStatusGet functions in
- * IxQMgr.h.
- * These calculations are normally performed dynamically in inlined
- * functions in IxQMgrAqmIf_p.h, and their semantics are reused here.
- */
-
- /* AQM Queue access reg addresses, per queue */
- ixQMgrAqmIfQueAccRegAddr[i] =
- (UINT32 *)(aqmBaseAddress + IX_QMGR_Q_ACCESS_ADDR_GET(i));
- ixQMgrQInlinedReadWriteInfo[i].qAccRegAddr =
- (volatile UINT32 *)(aqmBaseAddress + IX_QMGR_Q_ACCESS_ADDR_GET(i));
-
-
- ixQMgrQInlinedReadWriteInfo[i].qConfigRegAddr =
- (volatile UINT32 *)(aqmBaseAddress + IX_QMGR_Q_CONFIG_ADDR_GET(i));
-
- /* AQM Queue lower-group (0-31), only */
- if (i < IX_QMGR_MIN_QUEUPP_QID)
- {
- /* AQM Q underflow/overflow status register addresses, per queue */
- ixQMgrQInlinedReadWriteInfo[i].qUOStatRegAddr =
- (volatile UINT32 *)(aqmBaseAddress +
- IX_QMGR_QUEUOSTAT0_OFFSET +
- ((i / IX_QMGR_QUEUOSTAT_NUM_QUE_PER_WORD) *
- IX_QMGR_NUM_BYTES_PER_WORD));
-
- /* AQM Q underflow status bit masks for status register per queue */
- ixQMgrQInlinedReadWriteInfo[i].qUflowStatBitMask =
- (IX_QMGR_UNDERFLOW_BIT_OFFSET + 1) <<
- ((i & (IX_QMGR_QUEUOSTAT_NUM_QUE_PER_WORD - 1)) *
- (BITS_PER_WORD / IX_QMGR_QUEUOSTAT_NUM_QUE_PER_WORD));
-
- /* AQM Q overflow status bit masks for status register, per queue */
- ixQMgrQInlinedReadWriteInfo[i].qOflowStatBitMask =
- (IX_QMGR_OVERFLOW_BIT_OFFSET + 1) <<
- ((i & (IX_QMGR_QUEUOSTAT_NUM_QUE_PER_WORD - 1)) *
- (BITS_PER_WORD / IX_QMGR_QUEUOSTAT_NUM_QUE_PER_WORD));
-
- /* AQM Q lower-group (0-31) status register addresses, per queue */
- ixQMgrAqmIfQueLowStatRegAddr[i] = aqmBaseAddress +
- IX_QMGR_QUELOWSTAT0_OFFSET +
- ((i / IX_QMGR_QUELOWSTAT_NUM_QUE_PER_WORD) *
- IX_QMGR_NUM_BYTES_PER_WORD);
-
- /* AQM Q lower-group (0-31) status register bit offset */
- ixQMgrAqmIfQueLowStatBitsOffset[i] =
- (i & (IX_QMGR_QUELOWSTAT_NUM_QUE_PER_WORD - 1)) *
- (BITS_PER_WORD / IX_QMGR_QUELOWSTAT_NUM_QUE_PER_WORD);
- }
- else /* AQM Q upper-group (32-63), only */
- {
- /* AQM Q upper-group (32-63) Nearly Empty status reg bit masks */
- ixQMgrAqmIfQueUppStat0BitMask[i - IX_QMGR_MIN_QUEUPP_QID] =
- (1 << (i - IX_QMGR_MIN_QUEUPP_QID));
-
- /* AQM Q upper-group (32-63) Full status register bit masks */
- ixQMgrAqmIfQueUppStat1BitMask[i - IX_QMGR_MIN_QUEUPP_QID] =
- (1 << (i - IX_QMGR_MIN_QUEUPP_QID));
- }
- }
-
- /* AQM Q lower-group (0-31) status register bit mask */
- ixQMgrAqmIfQueLowStatBitsMask = (1 <<
- (BITS_PER_WORD /
- IX_QMGR_QUELOWSTAT_NUM_QUE_PER_WORD)) - 1;
-
- /* AQM Q upper-group (32-63) Nearly Empty status register address */
- ixQMgrAqmIfQueUppStat0RegAddr = aqmBaseAddress + IX_QMGR_QUEUPPSTAT0_OFFSET;
-
- /* AQM Q upper-group (32-63) Full status register address */
- ixQMgrAqmIfQueUppStat1RegAddr = aqmBaseAddress + IX_QMGR_QUEUPPSTAT1_OFFSET;
-}
-
-/*
- * Uninitialise the AqmIf module by unmapping memory, etc
- */
-void
-ixQMgrAqmIfUninit (void)
-{
- UINT32 virtAddr;
-
- ixQMgrAqmIfBaseAddressGet (&virtAddr);
- IX_OSAL_MEM_UNMAP (virtAddr);
- ixQMgrAqmIfBaseAddressSet (0);
-}
-
-/*
- * Set the the logical base address of AQM
- */
-void
-ixQMgrAqmIfBaseAddressSet (UINT32 address)
-{
- aqmBaseAddress = address;
-}
-
-/*
- * Get the logical base address of AQM
- */
-void
-ixQMgrAqmIfBaseAddressGet (UINT32 *address)
-{
- *address = aqmBaseAddress;
-}
-
-/*
- * Get the logical base address of AQM SRAM
- */
-void
-ixQMgrAqmIfSramBaseAddressGet (UINT32 *address)
-{
- *address = aqmBaseAddress +
- IX_QMGR_AQM_SRAM_BASE_ADDRESS_OFFSET;
-}
-
-/*
- * This function will write the status bits of a queue
- * specified by qId.
- */
-void
-ixQMgrAqmIfQRegisterBitsWrite (IxQMgrQId qId,
- UINT32 registerBaseAddrOffset,
- unsigned queuesPerRegWord,
- UINT32 value)
-{
- volatile UINT32 *registerAddress;
- UINT32 registerWord;
- UINT32 statusBitsMask;
- UINT32 bitsPerQueue;
-
- bitsPerQueue = BITS_PER_WORD / queuesPerRegWord;
-
- /*
- * Calculate the registerAddress
- * multiple queues split accross registers
- */
- registerAddress = (UINT32*)(aqmBaseAddress +
- registerBaseAddrOffset +
- ((qId / queuesPerRegWord) *
- IX_QMGR_NUM_BYTES_PER_WORD));
-
- /* Read the current data */
- ixQMgrAqmIfWordRead (registerAddress, &registerWord);
-
-
- if( (registerBaseAddrOffset == IX_QMGR_INT0SRCSELREG0_OFFSET) &&
- (qId == IX_QMGR_QUEUE_0) )
- {
- statusBitsMask = 0x7 ;
-
- /* Queue 0 at INT0SRCSELREG should not corrupt the value bit-3 */
- value &= 0x7 ;
- }
- else
- {
- /* Calculate the mask for the status bits for this queue. */
- statusBitsMask = ((1 << bitsPerQueue) - 1);
- statusBitsMask <<= ((qId & (queuesPerRegWord - 1)) * bitsPerQueue);
-
- /* Mask out bits in value that would overwrite other q data */
- value <<= ((qId & (queuesPerRegWord - 1)) * bitsPerQueue);
- value &= statusBitsMask;
- }
-
- /* Mask out bits to write to */
- registerWord &= ~statusBitsMask;
-
-
- /* Set the write bits */
- registerWord |= value;
-
- /*
- * Write the data
- */
- ixQMgrAqmIfWordWrite (registerAddress, registerWord);
-}
-
-/*
- * This function generates the parameters that can be used to
- * check if a Qs status matches the specified source select.
- * It calculates which status word to check (statusWordOffset),
- * the value to check the status against (checkValue) and the
- * mask (mask) to mask out all but the bits to check in the status word.
- */
-void
-ixQMgrAqmIfQStatusCheckValsCalc (IxQMgrQId qId,
- IxQMgrSourceId srcSel,
- unsigned int *statusWordOffset,
- UINT32 *checkValue,
- UINT32 *mask)
-{
- UINT32 shiftVal;
-
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- switch (srcSel)
- {
- case IX_QMGR_Q_SOURCE_ID_E:
- *checkValue = IX_QMGR_Q_STATUS_E_BIT_MASK;
- *mask = IX_QMGR_Q_STATUS_E_BIT_MASK;
- break;
- case IX_QMGR_Q_SOURCE_ID_NE:
- *checkValue = IX_QMGR_Q_STATUS_NE_BIT_MASK;
- *mask = IX_QMGR_Q_STATUS_NE_BIT_MASK;
- break;
- case IX_QMGR_Q_SOURCE_ID_NF:
- *checkValue = IX_QMGR_Q_STATUS_NF_BIT_MASK;
- *mask = IX_QMGR_Q_STATUS_NF_BIT_MASK;
- break;
- case IX_QMGR_Q_SOURCE_ID_F:
- *checkValue = IX_QMGR_Q_STATUS_F_BIT_MASK;
- *mask = IX_QMGR_Q_STATUS_F_BIT_MASK;
- break;
- case IX_QMGR_Q_SOURCE_ID_NOT_E:
- *checkValue = 0;
- *mask = IX_QMGR_Q_STATUS_E_BIT_MASK;
- break;
- case IX_QMGR_Q_SOURCE_ID_NOT_NE:
- *checkValue = 0;
- *mask = IX_QMGR_Q_STATUS_NE_BIT_MASK;
- break;
- case IX_QMGR_Q_SOURCE_ID_NOT_NF:
- *checkValue = 0;
- *mask = IX_QMGR_Q_STATUS_NF_BIT_MASK;
- break;
- case IX_QMGR_Q_SOURCE_ID_NOT_F:
- *checkValue = 0;
- *mask = IX_QMGR_Q_STATUS_F_BIT_MASK;
- break;
- default:
- /* Should never hit */
- IX_OSAL_ASSERT(0);
- break;
- }
-
- /* One nibble of status per queue so need to shift the
- * check value and mask out to the correct position.
- */
- shiftVal = (qId % IX_QMGR_QUELOWSTAT_NUM_QUE_PER_WORD) *
- IX_QMGR_QUELOWSTAT_BITS_PER_Q;
-
- /* Calculate the which status word to check from the qId,
- * 8 Qs status per word
- */
- *statusWordOffset = qId / IX_QMGR_QUELOWSTAT_NUM_QUE_PER_WORD;
-
- *checkValue <<= shiftVal;
- *mask <<= shiftVal;
- }
- else
- {
- /* One status word */
- *statusWordOffset = 0;
- /* Single bits per queue and int source bit hardwired NE,
- * Qs start at 32.
- */
- *mask = 1 << (qId - IX_QMGR_MIN_QUEUPP_QID);
- *checkValue = *mask;
- }
-}
-
-void
-ixQMgrAqmIfQInterruptEnable (IxQMgrQId qId)
-{
- volatile UINT32 *registerAddress;
- UINT32 registerWord;
- UINT32 actualBitOffset;
-
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- registerAddress = (UINT32*)(aqmBaseAddress + IX_QMGR_QUEIEREG0_OFFSET);
- }
- else
- {
- registerAddress = (UINT32*)(aqmBaseAddress + IX_QMGR_QUEIEREG1_OFFSET);
- }
-
- actualBitOffset = 1 << (qId % IX_QMGR_MIN_QUEUPP_QID);
-
- ixQMgrAqmIfWordRead (registerAddress, &registerWord);
- ixQMgrAqmIfWordWrite (registerAddress, (registerWord | actualBitOffset));
-}
-
-void
-ixQMgrAqmIfQInterruptDisable (IxQMgrQId qId)
-{
- volatile UINT32 *registerAddress;
- UINT32 registerWord;
- UINT32 actualBitOffset;
-
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- registerAddress = (UINT32*)(aqmBaseAddress + IX_QMGR_QUEIEREG0_OFFSET);
- }
- else
- {
- registerAddress = (UINT32*)(aqmBaseAddress + IX_QMGR_QUEIEREG1_OFFSET);
- }
-
- actualBitOffset = 1 << (qId % IX_QMGR_MIN_QUEUPP_QID);
-
- ixQMgrAqmIfWordRead (registerAddress, &registerWord);
- ixQMgrAqmIfWordWrite (registerAddress, registerWord & (~actualBitOffset));
-}
-
-void
-ixQMgrAqmIfQueCfgWrite (IxQMgrQId qId,
- IxQMgrQSizeInWords qSizeInWords,
- IxQMgrQEntrySizeInWords entrySizeInWords,
- UINT32 freeSRAMAddress)
-{
- volatile UINT32 *cfgAddress = NULL;
- UINT32 qCfg = 0;
- UINT32 baseAddress = 0;
- unsigned aqmEntrySize = 0;
- unsigned aqmBufferSize = 0;
-
- /* Build config register */
- aqmEntrySize = entrySizeToAqmEntrySize (entrySizeInWords);
- qCfg |= (aqmEntrySize&IX_QMGR_ENTRY_SIZE_MASK) <<
- IX_QMGR_Q_CONFIG_ESIZE_OFFSET;
-
- aqmBufferSize = bufferSizeToAqmBufferSize (qSizeInWords);
- qCfg |= (aqmBufferSize&IX_QMGR_SIZE_MASK) << IX_QMGR_Q_CONFIG_BSIZE_OFFSET;
-
- /* baseAddress, calculated relative to aqmBaseAddress and start address */
- baseAddress = freeSRAMAddress -
- (aqmBaseAddress + IX_QMGR_QUECONFIG_BASE_OFFSET);
-
- /* Verify base address aligned to a 16 word boundary */
- if ((baseAddress % IX_QMGR_BASE_ADDR_16_WORD_ALIGN) != 0)
- {
- IX_QMGR_LOG_ERROR0("ixQMgrAqmIfQueCfgWrite () address is not on 16 word boundary\n");
- }
- /* Now convert it to a 16 word pointer as required by QUECONFIG register */
- baseAddress >>= IX_QMGR_BASE_ADDR_16_WORD_SHIFT;
-
-
- qCfg |= (baseAddress << IX_QMGR_Q_CONFIG_BADDR_OFFSET);
-
-
- cfgAddress = (UINT32*)(aqmBaseAddress +
- IX_QMGR_Q_CONFIG_ADDR_GET(qId));
-
-
- /* NOTE: High and Low watermarks are set to zero */
- ixQMgrAqmIfWordWrite (cfgAddress, qCfg);
-}
-
-void
-ixQMgrAqmIfQueCfgRead (IxQMgrQId qId,
- unsigned int numEntries,
- UINT32 *baseAddress,
- unsigned int *ne,
- unsigned int *nf,
- UINT32 *readPtr,
- UINT32 *writePtr)
-{
- UINT32 qcfg;
- UINT32 *cfgAddress = (UINT32*)(aqmBaseAddress + IX_QMGR_Q_CONFIG_ADDR_GET(qId));
- unsigned int qEntrySizeInwords;
- unsigned int qSizeInWords;
- UINT32 *readPtr_ = NULL;
-
- /* Read the queue configuration register */
- ixQMgrAqmIfWordRead (cfgAddress, &qcfg);
-
- /* Extract the base address */
- *baseAddress = (UINT32)((qcfg & IX_QMGR_BADDR_MASK) >>
- (IX_QMGR_Q_CONFIG_BADDR_OFFSET));
-
- /* Base address is a 16 word pointer from the start of AQM SRAM.
- * Convert to absolute word address.
- */
- *baseAddress <<= IX_QMGR_BASE_ADDR_16_WORD_SHIFT;
- *baseAddress += (UINT32)IX_QMGR_QUECONFIG_BASE_OFFSET;
-
- /*
- * Extract the watermarks. 0->0 entries, 1->1 entries, 2->2 entries, 3->4 entries......
- * If ne > 0 ==> neInEntries = 2^(ne - 1)
- * If ne == 0 ==> neInEntries = 0
- * The same applies.
- */
- *ne = ((qcfg) >> (IX_QMGR_Q_CONFIG_NE_OFFSET)) & IX_QMGR_NE_MASK;
- *nf = ((qcfg) >> (IX_QMGR_Q_CONFIG_NF_OFFSET)) & IX_QMGR_NF_MASK;
-
- if (0 != *ne)
- {
- *ne = 1 << (*ne - 1);
- }
- if (0 != *nf)
- {
- *nf = 1 << (*nf - 1);
- }
-
- /* Get the queue entry size in words */
- qEntrySizeInwords = ixQMgrQEntrySizeInWordsGet (qId);
-
- /* Get the queue size in words */
- qSizeInWords = ixQMgrQSizeInWordsGet (qId);
-
- ixQMgrAqmIfEntryAddressGet (0/* Entry 0. i.e the readPtr*/,
- qcfg,
- qEntrySizeInwords,
- qSizeInWords,
- &readPtr_);
- *readPtr = (UINT32)readPtr_;
- *readPtr -= (UINT32)aqmBaseAddress;/* Offset, not absolute address */
-
- *writePtr = (qcfg >> IX_QMGR_Q_CONFIG_WRPTR_OFFSET) & IX_QMGR_WRPTR_MASK;
- *writePtr = *baseAddress + (*writePtr * (IX_QMGR_NUM_BYTES_PER_WORD));
- return;
-}
-
-unsigned
-ixQMgrAqmIfLog2 (unsigned number)
-{
- unsigned count = 0;
-
- /*
- * N.B. this function will return 0
- * for ixQMgrAqmIfLog2 (0)
- */
- while (number/2)
- {
- number /=2;
- count++;
- }
-
- return count;
-}
-
-void ixQMgrAqmIfIntSrcSelReg0Bit3Set (void)
-{
-
- volatile UINT32 *registerAddress;
- UINT32 registerWord;
-
- /*
- * Calculate the registerAddress
- * multiple queues split accross registers
- */
- registerAddress = (UINT32*)(aqmBaseAddress +
- IX_QMGR_INT0SRCSELREG0_OFFSET);
-
- /* Read the current data */
- ixQMgrAqmIfWordRead (registerAddress, &registerWord);
-
- /* Set the write bits */
- registerWord |= (1<<IX_QMGR_INT0SRCSELREG0_BIT3) ;
-
- /*
- * Write the data
- */
- ixQMgrAqmIfWordWrite (registerAddress, registerWord);
-}
-
-
-void
-ixQMgrAqmIfIntSrcSelWrite (IxQMgrQId qId,
- IxQMgrSourceId sourceId)
-{
- ixQMgrAqmIfQRegisterBitsWrite (qId,
- IX_QMGR_INT0SRCSELREG0_OFFSET,
- IX_QMGR_INTSRC_NUM_QUE_PER_WORD,
- sourceId);
-}
-
-
-
-void
-ixQMgrAqmIfWatermarkSet (IxQMgrQId qId,
- unsigned ne,
- unsigned nf)
-{
- volatile UINT32 *address = 0;
- UINT32 value = 0;
- unsigned aqmNeWatermark = 0;
- unsigned aqmNfWatermark = 0;
-
- address = (UINT32*)(aqmBaseAddress +
- IX_QMGR_Q_CONFIG_ADDR_GET(qId));
-
- aqmNeWatermark = watermarkToAqmWatermark (ne);
- aqmNfWatermark = watermarkToAqmWatermark (nf);
-
- /* Read the current watermarks */
- ixQMgrAqmIfWordRead (address, &value);
-
- /* Clear out the old watermarks */
- value &= IX_QMGR_NE_NF_CLEAR_MASK;
-
- /* Generate the value to write */
- value |= (aqmNeWatermark << IX_QMGR_Q_CONFIG_NE_OFFSET) |
- (aqmNfWatermark << IX_QMGR_Q_CONFIG_NF_OFFSET);
-
- ixQMgrAqmIfWordWrite (address, value);
-
-}
-
-PRIVATE void
-ixQMgrAqmIfEntryAddressGet (unsigned int entryIndex,
- UINT32 configRegWord,
- unsigned int qEntrySizeInwords,
- unsigned int qSizeInWords,
- UINT32 **address)
-{
- UINT32 readPtr;
- UINT32 baseAddress;
- UINT32 *topOfAqmSram;
-
- topOfAqmSram = ((UINT32 *)aqmBaseAddress + IX_QMGR_AQM_ADDRESS_SPACE_SIZE_IN_WORDS);
-
- /* Extract the base address */
- baseAddress = (UINT32)((configRegWord & IX_QMGR_BADDR_MASK) >>
- (IX_QMGR_Q_CONFIG_BADDR_OFFSET));
-
- /* Base address is a 16 word pointer from the start of AQM SRAM.
- * Convert to absolute word address.
- */
- baseAddress <<= IX_QMGR_BASE_ADDR_16_WORD_SHIFT;
- baseAddress += ((UINT32)aqmBaseAddress + (UINT32)IX_QMGR_QUECONFIG_BASE_OFFSET);
-
- /* Extract the read pointer. Read pointer is a word pointer */
- readPtr = (UINT32)((configRegWord >>
- IX_QMGR_Q_CONFIG_RDPTR_OFFSET)&IX_QMGR_RDPTR_MASK);
-
- /* Read/Write pointers(word pointers) are offsets from the queue buffer space base address.
- * Calculate the absolute read pointer address. NOTE: Queues are circular buffers.
- */
- readPtr = (readPtr + (entryIndex * qEntrySizeInwords)) & (qSizeInWords - 1); /* Mask by queue size */
- *address = (UINT32 *)(baseAddress + (readPtr * (IX_QMGR_NUM_BYTES_PER_WORD)));
-
- switch (qEntrySizeInwords)
- {
- case IX_QMGR_Q_ENTRY_SIZE1:
- IX_OSAL_ASSERT((*address + IX_QMGR_ENTRY1_OFFSET) < topOfAqmSram);
- break;
- case IX_QMGR_Q_ENTRY_SIZE2:
- IX_OSAL_ASSERT((*address + IX_QMGR_ENTRY2_OFFSET) < topOfAqmSram);
- break;
- case IX_QMGR_Q_ENTRY_SIZE4:
- IX_OSAL_ASSERT((*address + IX_QMGR_ENTRY4_OFFSET) < topOfAqmSram);
- break;
- default:
- IX_QMGR_LOG_ERROR0("Invalid Q Entry size passed to ixQMgrAqmIfEntryAddressGet");
- break;
- }
-
-}
-
-IX_STATUS
-ixQMgrAqmIfQPeek (IxQMgrQId qId,
- unsigned int entryIndex,
- unsigned int *entry)
-{
- UINT32 *cfgRegAddress = (UINT32*)(aqmBaseAddress + IX_QMGR_Q_CONFIG_ADDR_GET(qId));
- UINT32 *entryAddress = NULL;
- UINT32 configRegWordOnEntry;
- UINT32 configRegWordOnExit;
- unsigned int qEntrySizeInwords;
- unsigned int qSizeInWords;
-
- /* Get the queue entry size in words */
- qEntrySizeInwords = ixQMgrQEntrySizeInWordsGet (qId);
-
- /* Get the queue size in words */
- qSizeInWords = ixQMgrQSizeInWordsGet (qId);
-
- /* Read the config register */
- ixQMgrAqmIfWordRead (cfgRegAddress, &configRegWordOnEntry);
-
- /* Get the entry address */
- ixQMgrAqmIfEntryAddressGet (entryIndex,
- configRegWordOnEntry,
- qEntrySizeInwords,
- qSizeInWords,
- &entryAddress);
-
- /* Get the lock or return busy */
- if (IX_SUCCESS != ixOsalFastMutexTryLock(&ixQMgrAqmIfPeekPokeFastMutex[qId]))
- {
- return IX_FAIL;
- }
-
- while(qEntrySizeInwords--)
- {
- ixQMgrAqmIfWordRead (entryAddress++, entry++);
- }
-
- /* Release the lock */
- ixOsalFastMutexUnlock(&ixQMgrAqmIfPeekPokeFastMutex[qId]);
-
- /* Read the config register */
- ixQMgrAqmIfWordRead (cfgRegAddress, &configRegWordOnExit);
-
- /* Check that the read and write pointers have not changed */
- if (configRegWordOnEntry != configRegWordOnExit)
- {
- return IX_FAIL;
- }
-
- return IX_SUCCESS;
-}
-
-IX_STATUS
-ixQMgrAqmIfQPoke (IxQMgrQId qId,
- unsigned entryIndex,
- unsigned int *entry)
-{
- UINT32 *cfgRegAddress = (UINT32*)(aqmBaseAddress + IX_QMGR_Q_CONFIG_ADDR_GET(qId));
- UINT32 *entryAddress = NULL;
- UINT32 configRegWordOnEntry;
- UINT32 configRegWordOnExit;
- unsigned int qEntrySizeInwords;
- unsigned int qSizeInWords;
-
- /* Get the queue entry size in words */
- qEntrySizeInwords = ixQMgrQEntrySizeInWordsGet (qId);
-
- /* Get the queue size in words */
- qSizeInWords = ixQMgrQSizeInWordsGet (qId);
-
- /* Read the config register */
- ixQMgrAqmIfWordRead (cfgRegAddress, &configRegWordOnEntry);
-
- /* Get the entry address */
- ixQMgrAqmIfEntryAddressGet (entryIndex,
- configRegWordOnEntry,
- qEntrySizeInwords,
- qSizeInWords,
- &entryAddress);
-
- /* Get the lock or return busy */
- if (IX_SUCCESS != ixOsalFastMutexTryLock(&ixQMgrAqmIfPeekPokeFastMutex[qId]))
- {
- return IX_FAIL;
- }
-
- /* Else read the entry directly from SRAM. This will not move the read pointer */
- while(qEntrySizeInwords--)
- {
- ixQMgrAqmIfWordWrite (entryAddress++, *entry++);
- }
-
- /* Release the lock */
- ixOsalFastMutexUnlock(&ixQMgrAqmIfPeekPokeFastMutex[qId]);
-
- /* Read the config register */
- ixQMgrAqmIfWordRead (cfgRegAddress, &configRegWordOnExit);
-
- /* Check that the read and write pointers have not changed */
- if (configRegWordOnEntry != configRegWordOnExit)
- {
- return IX_FAIL;
- }
-
- return IX_SUCCESS;
-}
-
-PRIVATE unsigned
-watermarkToAqmWatermark (IxQMgrWMLevel watermark )
-{
- unsigned aqmWatermark = 0;
-
- /*
- * Watermarks 0("000"),1("001"),2("010"),4("011"),
- * 8("100"),16("101"),32("110"),64("111")
- */
- aqmWatermark = ixQMgrAqmIfLog2 (watermark * 2);
-
- return aqmWatermark;
-}
-
-PRIVATE unsigned
-entrySizeToAqmEntrySize (IxQMgrQEntrySizeInWords entrySize)
-{
- /* entrySize 1("00"),2("01"),4("10") */
- return (ixQMgrAqmIfLog2 (entrySize));
-}
-
-PRIVATE unsigned
-bufferSizeToAqmBufferSize (unsigned bufferSizeInWords)
-{
- /* bufferSize 16("00"),32("01),64("10"),128("11") */
- return (ixQMgrAqmIfLog2 (bufferSizeInWords / IX_QMGR_MIN_BUFFER_SIZE));
-}
-
-/*
- * Reset AQM registers to default values.
- */
-PRIVATE void
-ixQMgrAqmIfRegistersReset (void)
-{
- volatile UINT32 *qConfigWordAddress = NULL;
- unsigned int i;
-
- /*
- * Need to initialize AQM hardware registers to an initial
- * value as init may have been called as a result of a soft
- * reset. i.e. soft reset does not reset hardware registers.
- */
-
- /* Reset queues 0..31 status registers 0..3 */
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QUELOWSTAT0_OFFSET),
- IX_QMGR_QUELOWSTAT_RESET_VALUE);
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QUELOWSTAT1_OFFSET),
- IX_QMGR_QUELOWSTAT_RESET_VALUE);
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QUELOWSTAT2_OFFSET),
- IX_QMGR_QUELOWSTAT_RESET_VALUE);
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QUELOWSTAT3_OFFSET),
- IX_QMGR_QUELOWSTAT_RESET_VALUE);
-
- /* Reset underflow/overflow status registers 0..1 */
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QUEUOSTAT0_OFFSET),
- IX_QMGR_QUEUOSTAT_RESET_VALUE);
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QUEUOSTAT1_OFFSET),
- IX_QMGR_QUEUOSTAT_RESET_VALUE);
-
- /* Reset queues 32..63 nearly empty status registers */
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QUEUPPSTAT0_OFFSET),
- IX_QMGR_QUEUPPSTAT0_RESET_VALUE);
-
- /* Reset queues 32..63 full status registers */
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QUEUPPSTAT1_OFFSET),
- IX_QMGR_QUEUPPSTAT1_RESET_VALUE);
-
- /* Reset int0 status flag source select registers 0..3 */
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_INT0SRCSELREG0_OFFSET),
- IX_QMGR_INT0SRCSELREG_RESET_VALUE);
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_INT0SRCSELREG1_OFFSET),
- IX_QMGR_INT0SRCSELREG_RESET_VALUE);
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_INT0SRCSELREG2_OFFSET),
- IX_QMGR_INT0SRCSELREG_RESET_VALUE);
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_INT0SRCSELREG3_OFFSET),
- IX_QMGR_INT0SRCSELREG_RESET_VALUE);
-
- /* Reset queue interrupt enable register 0..1 */
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QUEIEREG0_OFFSET),
- IX_QMGR_QUEIEREG_RESET_VALUE);
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QUEIEREG1_OFFSET),
- IX_QMGR_QUEIEREG_RESET_VALUE);
-
- /* Reset queue interrupt register 0..1 */
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QINTREG0_OFFSET),
- IX_QMGR_QINTREG_RESET_VALUE);
- ixQMgrAqmIfWordWrite((UINT32 *)(aqmBaseAddress + IX_QMGR_QINTREG1_OFFSET),
- IX_QMGR_QINTREG_RESET_VALUE);
-
- /* Reset queue configuration words 0..63 */
- qConfigWordAddress = (UINT32 *)(aqmBaseAddress + IX_QMGR_QUECONFIG_BASE_OFFSET);
- for (i = 0; i < (IX_QMGR_QUECONFIG_SIZE / sizeof(UINT32)); i++)
- {
- ixQMgrAqmIfWordWrite(qConfigWordAddress,
- IX_QMGR_QUECONFIG_RESET_VALUE);
- /* Next word */
- qConfigWordAddress++;
- }
-}
-
diff --git a/cpu/ixp/npe/IxQMgrDispatcher.c b/cpu/ixp/npe/IxQMgrDispatcher.c
deleted file mode 100644
index 09f69ce322..0000000000
--- a/cpu/ixp/npe/IxQMgrDispatcher.c
+++ /dev/null
@@ -1,1347 +0,0 @@
-/**
- * @file IxQMgrDispatcher.c
- *
- * @author Intel Corporation
- * @date 20-Dec-2001
- *
- * @brief This file contains the implementation of the Dispatcher sub component
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/*
- * User defined include files.
- */
-#include "IxQMgr.h"
-#include "IxQMgrAqmIf_p.h"
-#include "IxQMgrQCfg_p.h"
-#include "IxQMgrDispatcher_p.h"
-#include "IxQMgrLog_p.h"
-#include "IxQMgrDefines_p.h"
-#include "IxFeatureCtrl.h"
-#include "IxOsal.h"
-
-
-
-/*
- * #defines and macros used in this file.
- */
-
-
-/*
- * This constant is used to indicate the number of priority levels supported
- */
-#define IX_QMGR_NUM_PRIORITY_LEVELS 3
-
-/*
- * This constant is used to set the size of the array of status words
- */
-#define MAX_Q_STATUS_WORDS 4
-
-/*
- * This macro is used to check if a given priority is valid
- */
-#define IX_QMGR_DISPATCHER_PRIORITY_CHECK(priority) \
-(((priority) >= IX_QMGR_Q_PRIORITY_0) && ((priority) <= IX_QMGR_Q_PRIORITY_2))
-
-/*
- * This macto is used to check that a given interrupt source is valid
- */
-#define IX_QMGR_DISPATCHER_SOURCE_ID_CHECK(srcSel) \
-(((srcSel) >= IX_QMGR_Q_SOURCE_ID_E) && ((srcSel) <= IX_QMGR_Q_SOURCE_ID_NOT_F))
-
-/*
- * Number of times a dummy callback is called before logging a trace
- * message
- */
-#define LOG_THROTTLE_COUNT 1000000
-
-/* Priority tables limits */
-#define IX_QMGR_MIN_LOW_QUE_PRIORITY_TABLE_INDEX (0)
-#define IX_QMGR_MID_LOW_QUE_PRIORITY_TABLE_INDEX (16)
-#define IX_QMGR_MAX_LOW_QUE_PRIORITY_TABLE_INDEX (31)
-#define IX_QMGR_MIN_UPP_QUE_PRIORITY_TABLE_INDEX (32)
-#define IX_QMGR_MID_UPP_QUE_PRIORITY_TABLE_INDEX (48)
-#define IX_QMGR_MAX_UPP_QUE_PRIORITY_TABLE_INDEX (63)
-
-/*
- * This macro is used to check if a given callback type is valid
- */
-#define IX_QMGR_DISPATCHER_CALLBACK_TYPE_CHECK(type) \
- (((type) >= IX_QMGR_TYPE_REALTIME_OTHER) && \
- ((type) <= IX_QMGR_TYPE_REALTIME_SPORADIC))
-
-/*
- * define max index in lower queue to use in loops
- */
-#define IX_QMGR_MAX_LOW_QUE_TABLE_INDEX (31)
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-/*
- * Information on a queue needed by the Dispatcher
- */
-typedef struct
-{
- IxQMgrCallback callback; /* Notification callback */
- IxQMgrCallbackId callbackId; /* Notification callback identifier */
- unsigned dummyCallbackCount; /* Number of times runs of dummy callback */
- IxQMgrPriority priority; /* Dispatch priority */
- unsigned int statusWordOffset; /* Offset to the status word to check */
- UINT32 statusMask; /* Status mask */
- UINT32 statusCheckValue; /* Status check value */
- UINT32 intRegCheckMask; /* Interrupt register check mask */
-} IxQMgrQInfo;
-
-/*
- * Variable declarations global to this file. Externs are followed by
- * statics.
- */
-
-/*
- * Flag to keep record of what dispatcher set in featureCtrl when ixQMgrInit()
- * is called. This is needed because it is possible that a client might
- * change whether the live lock prevention dispatcher is used between
- * calls to ixQMgrInit() and ixQMgrDispatcherLoopGet().
- */
-PRIVATE IX_STATUS ixQMgrOrigB0Dispatcher = IX_FEATURE_CTRL_COMPONENT_ENABLED;
-
-/*
- * keep record of Q types - not in IxQMgrQInfo for performance as
- * it is only used with ixQMgrDispatcherLoopRunB0LLP()
- */
-PRIVATE IxQMgrType ixQMgrQTypes[IX_QMGR_MAX_NUM_QUEUES];
-
-/*
- * This array contains a list of queue identifiers ordered by priority. The table
- * is split logically between queue identifiers 0-31 and 32-63.
- */
-static IxQMgrQId priorityTable[IX_QMGR_MAX_NUM_QUEUES];
-
-/*
- * This flag indicates to the dispatcher that the priority table needs to be rebuilt.
- */
-static BOOL rebuildTable = FALSE;
-
-/* Dispatcher statistics */
-static IxQMgrDispatcherStats dispatcherStats;
-
-/* Table of queue information */
-static IxQMgrQInfo dispatchQInfo[IX_QMGR_MAX_NUM_QUEUES];
-
-/* Masks use to identify the first queues in the priority tables
-* when comparing with the interrupt register
-*/
-static unsigned int lowPriorityTableFirstHalfMask;
-static unsigned int uppPriorityTableFirstHalfMask;
-
-/*
- * Static function prototypes
- */
-
-/*
- * This function is the default callback for all queues
- */
-PRIVATE void
-dummyCallback (IxQMgrQId qId,
- IxQMgrCallbackId cbId);
-
-PRIVATE void
-ixQMgrDispatcherReBuildPriorityTable (void);
-
-/*
- * Function definitions.
- */
-void
-ixQMgrDispatcherInit (void)
-{
- int i;
- IxFeatureCtrlProductId productId = 0;
- IxFeatureCtrlDeviceId deviceId = 0;
- BOOL stickyIntSilicon = TRUE;
-
- /* Set default priorities */
- for (i=0; i< IX_QMGR_MAX_NUM_QUEUES; i++)
- {
- dispatchQInfo[i].callback = dummyCallback;
- dispatchQInfo[i].callbackId = 0;
- dispatchQInfo[i].dummyCallbackCount = 0;
- dispatchQInfo[i].priority = IX_QMGR_Q_PRIORITY_2;
- dispatchQInfo[i].statusWordOffset = 0;
- dispatchQInfo[i].statusCheckValue = 0;
- dispatchQInfo[i].statusMask = 0;
- /*
- * There are two interrupt registers, 32 bits each. One for the lower
- * queues(0-31) and one for the upper queues(32-63). Therefore need to
- * mod by 32 i.e the min upper queue identifier.
- */
- dispatchQInfo[i].intRegCheckMask = (1<<(i%(IX_QMGR_MIN_QUEUPP_QID)));
-
- /*
- * Set the Q types - will only be used with livelock
- */
- ixQMgrQTypes[i] = IX_QMGR_TYPE_REALTIME_OTHER;
-
- /* Reset queue statistics */
- dispatcherStats.queueStats[i].callbackCnt = 0;
- dispatcherStats.queueStats[i].priorityChangeCnt = 0;
- dispatcherStats.queueStats[i].intNoCallbackCnt = 0;
- dispatcherStats.queueStats[i].intLostCallbackCnt = 0;
- dispatcherStats.queueStats[i].notificationEnabled = FALSE;
- dispatcherStats.queueStats[i].srcSel = 0;
-
- }
-
- /* Priority table. Order the table from queue 0 to 63 */
- ixQMgrDispatcherReBuildPriorityTable();
-
- /* Reset statistics */
- dispatcherStats.loopRunCnt = 0;
-
- /* Get the device ID for the underlying silicon */
- deviceId = ixFeatureCtrlDeviceRead();
-
- /* Get the product ID for the underlying silicon */
- productId = ixFeatureCtrlProductIdRead();
-
- /*
- * Check featureCtrl to see if Livelock prevention is required
- */
- ixQMgrOrigB0Dispatcher = ixFeatureCtrlSwConfigurationCheck(
- IX_FEATURECTRL_ORIGB0_DISPATCHER);
-
- /*
- * Check if the silicon supports the sticky interrupt feature.
- * IF (IXP42X AND A0) -> No sticky interrupt feature supported
- */
- if ((IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X ==
- (IX_FEATURE_CTRL_DEVICE_TYPE_MASK & deviceId)) &&
- (IX_FEATURE_CTRL_SILICON_TYPE_A0 ==
- (IX_FEATURE_CTRL_SILICON_STEPPING_MASK & productId)))
- {
- stickyIntSilicon = FALSE;
- }
-
- /*
- * IF user wants livelock prev option AND silicon supports sticky interrupt
- * feature -> enable the sticky interrupt bit
- */
- if ((IX_FEATURE_CTRL_SWCONFIG_DISABLED == ixQMgrOrigB0Dispatcher) &&
- stickyIntSilicon)
- {
- ixQMgrStickyInterruptRegEnable();
- }
-}
-
-IX_STATUS
-ixQMgrDispatcherPrioritySet (IxQMgrQId qId,
- IxQMgrPriority priority)
-{
- int ixQMgrLockKey;
-
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-
- if (!IX_QMGR_DISPATCHER_PRIORITY_CHECK(priority))
- {
- return IX_QMGR_Q_INVALID_PRIORITY;
- }
-
- ixQMgrLockKey = ixOsalIrqLock();
-
- /* Change priority */
- dispatchQInfo[qId].priority = priority;
- /* Set flag */
- rebuildTable = TRUE;
-
- ixOsalIrqUnlock(ixQMgrLockKey);
-
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.queueStats[qId].priorityChangeCnt++;
-#endif
-
- return IX_SUCCESS;
-}
-
-IX_STATUS
-ixQMgrNotificationCallbackSet (IxQMgrQId qId,
- IxQMgrCallback callback,
- IxQMgrCallbackId callbackId)
-{
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-
- if (NULL == callback)
- {
- /* Reset to dummy callback */
- dispatchQInfo[qId].callback = dummyCallback;
- dispatchQInfo[qId].dummyCallbackCount = 0;
- dispatchQInfo[qId].callbackId = 0;
- }
- else
- {
- dispatchQInfo[qId].callback = callback;
- dispatchQInfo[qId].callbackId = callbackId;
- }
-
- return IX_SUCCESS;
-}
-
-IX_STATUS
-ixQMgrNotificationEnable (IxQMgrQId qId,
- IxQMgrSourceId srcSel)
-{
- IxQMgrQStatus qStatusOnEntry;/* The queue status on entry/exit */
- IxQMgrQStatus qStatusOnExit; /* to this function */
- int ixQMgrLockKey;
-
-#ifndef NDEBUG
- if (!ixQMgrQIsConfigured (qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-
- if ((qId < IX_QMGR_MIN_QUEUPP_QID) &&
- !IX_QMGR_DISPATCHER_SOURCE_ID_CHECK(srcSel))
- {
- /* QId 0-31 source id invalid */
- return IX_QMGR_INVALID_INT_SOURCE_ID;
- }
-
- if ((IX_QMGR_Q_SOURCE_ID_NE != srcSel) &&
- (qId >= IX_QMGR_MIN_QUEUPP_QID))
- {
- /*
- * For queues 32-63 the interrupt source is fixed to the Nearly
- * Empty status flag and therefore should have a srcSel of NE.
- */
- return IX_QMGR_INVALID_INT_SOURCE_ID;
- }
-#endif
-
-#ifndef NDEBUG
- dispatcherStats.queueStats[qId].notificationEnabled = TRUE;
- dispatcherStats.queueStats[qId].srcSel = srcSel;
-#endif
-
- /* Get the current queue status */
- ixQMgrAqmIfQueStatRead (qId, &qStatusOnEntry);
-
- /*
- * Enabling interrupts results in Read-Modify-Write
- * so need critical section
- */
-
- ixQMgrLockKey = ixOsalIrqLock();
-
- /* Calculate the checkMask and checkValue for this q */
- ixQMgrAqmIfQStatusCheckValsCalc (qId,
- srcSel,
- &dispatchQInfo[qId].statusWordOffset,
- &dispatchQInfo[qId].statusCheckValue,
- &dispatchQInfo[qId].statusMask);
-
-
- /* Set the interupt source is this queue is in the range 0-31 */
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- ixQMgrAqmIfIntSrcSelWrite (qId, srcSel);
- }
-
- /* Enable the interrupt */
- ixQMgrAqmIfQInterruptEnable (qId);
-
- ixOsalIrqUnlock(ixQMgrLockKey);
-
- /* Get the current queue status */
- ixQMgrAqmIfQueStatRead (qId, &qStatusOnExit);
-
- /* If the status has changed return a warning */
- if (qStatusOnEntry != qStatusOnExit)
- {
- return IX_QMGR_WARNING;
- }
-
- return IX_SUCCESS;
-}
-
-
-IX_STATUS
-ixQMgrNotificationDisable (IxQMgrQId qId)
-{
- int ixQMgrLockKey;
-
-#ifndef NDEBUG
- /* Validate parameters */
- if (!ixQMgrQIsConfigured (qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-#endif
-
- /*
- * Enabling interrupts results in Read-Modify-Write
- * so need critical section
- */
-#ifndef NDEBUG
- dispatcherStats.queueStats[qId].notificationEnabled = FALSE;
-#endif
-
- ixQMgrLockKey = ixOsalIrqLock();
-
- ixQMgrAqmIfQInterruptDisable (qId);
-
- ixOsalIrqUnlock(ixQMgrLockKey);
-
- return IX_SUCCESS;
-}
-
-void
-ixQMgrStickyInterruptRegEnable(void)
-{
- /* Use Aqm If function to set Interrupt Register0 Bit-3 */
- ixQMgrAqmIfIntSrcSelReg0Bit3Set ();
-}
-
-#if !defined __XSCALE__ || defined __linux
-
-/* Count the number of leading zero bits in a word,
- * and return the same value than the CLZ instruction.
- *
- * word (in) return value (out)
- * 0x80000000 0
- * 0x40000000 1
- * ,,, ,,,
- * 0x00000002 30
- * 0x00000001 31
- * 0x00000000 32
- *
- * The C version of this function is used as a replacement
- * for system not providing the equivalent of the CLZ
- * assembly language instruction.
- *
- * Note that this version is big-endian
- */
-unsigned int
-ixQMgrCountLeadingZeros(UINT32 word)
-{
- unsigned int leadingZerosCount = 0;
-
- if (word == 0)
- {
- return 32;
- }
- /* search the first bit set by testing the MSB and shifting the input word */
- while ((word & 0x80000000) == 0)
- {
- word <<= 1;
- leadingZerosCount++;
- }
- return leadingZerosCount;
-}
-#endif /* not __XSCALE__ or __linux */
-
-void
-ixQMgrDispatcherLoopGet (IxQMgrDispatcherFuncPtr *qDispatcherFuncPtr)
-{
- IxFeatureCtrlProductId productId = 0;
- IxFeatureCtrlDeviceId deviceId = 0;
-
- /* Get the device ID for the underlying silicon */
- deviceId = ixFeatureCtrlDeviceRead();
-
- /* Get the product ID for the underlying silicon */
- productId = ixFeatureCtrlProductIdRead ();
-
- /* IF (IXP42X AND A0 silicon) -> use ixQMgrDispatcherLoopRunA0 */
- if ((IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X ==
- (IX_FEATURE_CTRL_DEVICE_TYPE_MASK & deviceId)) &&
- (IX_FEATURE_CTRL_SILICON_TYPE_A0 ==
- (IX_FEATURE_CTRL_SILICON_STEPPING_MASK & productId)))
- {
- /*For IXP42X A0 silicon */
- *qDispatcherFuncPtr = &ixQMgrDispatcherLoopRunA0 ;
- }
- else /*For IXP42X B0 or IXP46X silicon*/
- {
- if (IX_FEATURE_CTRL_SWCONFIG_ENABLED == ixQMgrOrigB0Dispatcher)
- {
- /* Default for IXP42X B0 and IXP46X silicon */
- *qDispatcherFuncPtr = &ixQMgrDispatcherLoopRunB0;
- }
- else
- {
- /* FeatureCtrl indicated that livelock dispatcher be used */
- *qDispatcherFuncPtr = &ixQMgrDispatcherLoopRunB0LLP;
- }
- }
-}
-
-void
-ixQMgrDispatcherLoopRunA0 (IxQMgrDispatchGroup group)
-{
- UINT32 intRegVal; /* Interrupt reg val */
- UINT32 intRegValAfterWrite; /* Interrupt reg val after writing back */
- UINT32 intRegCheckMask; /* Mask for checking interrupt bits */
- UINT32 qStatusWordsB4Write[MAX_Q_STATUS_WORDS]; /* Status b4 interrupt write */
- UINT32 qStatusWordsAfterWrite[MAX_Q_STATUS_WORDS]; /* Status after interrupt write */
- IxQMgrQInfo *currDispatchQInfo;
- BOOL statusChangeFlag;
-
- int priorityTableIndex;/* Priority table index */
- int qIndex; /* Current queue being processed */
- int endIndex; /* Index of last queue to process */
-
-#ifndef NDEBUG
- IX_OSAL_ASSERT((group == IX_QMGR_QUEUPP_GROUP) ||
- (group == IX_QMGR_QUELOW_GROUP));
-#endif
-
- /* Read Q status registers before interrupt status read/write */
- ixQMgrAqmIfQStatusRegsRead (group, qStatusWordsB4Write);
-
- /* Read the interrupt register */
- ixQMgrAqmIfQInterruptRegRead (group, &intRegVal);
-
- /* No bit set : nothing to process (the reaminder of the algorithm is
- * based on the fact that the interrupt register value contains at
- * least one bit set
- */
- if (intRegVal == 0)
- {
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.loopRunCnt++;
-#endif
-
- /* Rebuild the priority table if needed */
- if (rebuildTable)
- {
- ixQMgrDispatcherReBuildPriorityTable ();
- }
-
- return;
- }
-
- /* Write it back to clear the interrupt */
- ixQMgrAqmIfQInterruptRegWrite (group, intRegVal);
-
- /* Read Q status registers after interrupt status read/write */
- ixQMgrAqmIfQStatusRegsRead (group, qStatusWordsAfterWrite);
-
- /* get the first queue Id from the interrupt register value */
- qIndex = (BITS_PER_WORD - 1) - ixQMgrCountLeadingZeros(intRegVal);
-
- /* check if any change occured during hw register modifications */
- if (IX_QMGR_QUELOW_GROUP == group)
- {
- statusChangeFlag =
- (qStatusWordsB4Write[0] != qStatusWordsAfterWrite[0]) ||
- (qStatusWordsB4Write[1] != qStatusWordsAfterWrite[1]) ||
- (qStatusWordsB4Write[2] != qStatusWordsAfterWrite[2]) ||
- (qStatusWordsB4Write[3] != qStatusWordsAfterWrite[3]);
- }
- else
- {
- statusChangeFlag =
- (qStatusWordsB4Write[0] != qStatusWordsAfterWrite[0]);
- /* Set the queue range based on the queue group to proccess */
- qIndex += IX_QMGR_MIN_QUEUPP_QID;
- }
-
- if (statusChangeFlag == FALSE)
- {
- /* check if the interrupt register contains
- * only 1 bit set (happy day scenario)
- */
- currDispatchQInfo = &dispatchQInfo[qIndex];
- if (intRegVal == currDispatchQInfo->intRegCheckMask)
- {
- /* only 1 queue event triggered a notification *
- * Call the callback function for this queue
- */
- currDispatchQInfo->callback (qIndex,
- currDispatchQInfo->callbackId);
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.queueStats[qIndex].callbackCnt++;
-#endif
- }
- else
- {
- /* the event is triggered by more than 1 queue,
- * the queue search will be starting from the beginning
- * or the middle of the priority table
- *
- * the serach will end when all the bits of the interrupt
- * register are cleared. There is no need to maintain
- * a seperate value and test it at each iteration.
- */
- if (IX_QMGR_QUELOW_GROUP == group)
- {
- /* check if any bit related to queues in the first
- * half of the priority table is set
- */
- if (intRegVal & lowPriorityTableFirstHalfMask)
- {
- priorityTableIndex = IX_QMGR_MIN_LOW_QUE_PRIORITY_TABLE_INDEX;
- }
- else
- {
- priorityTableIndex = IX_QMGR_MID_LOW_QUE_PRIORITY_TABLE_INDEX;
- }
- }
- else
- {
- /* check if any bit related to queues in the first
- * half of the priority table is set
- */
- if (intRegVal & uppPriorityTableFirstHalfMask)
- {
- priorityTableIndex = IX_QMGR_MIN_UPP_QUE_PRIORITY_TABLE_INDEX;
- }
- else
- {
- priorityTableIndex = IX_QMGR_MID_UPP_QUE_PRIORITY_TABLE_INDEX;
- }
- }
-
- /* iterate following the priority table until all the bits
- * of the interrupt register are cleared.
- */
- do
- {
- qIndex = priorityTable[priorityTableIndex++];
- currDispatchQInfo = &dispatchQInfo[qIndex];
- intRegCheckMask = currDispatchQInfo->intRegCheckMask;
-
- /* If this queue caused this interrupt to be raised */
- if (intRegVal & intRegCheckMask)
- {
- /* Call the callback function for this queue */
- currDispatchQInfo->callback (qIndex,
- currDispatchQInfo->callbackId);
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.queueStats[qIndex].callbackCnt++;
-#endif
-
- /* Clear the interrupt register bit */
- intRegVal &= ~intRegCheckMask;
- }
- }
- while(intRegVal);
- }
- }
- else
- {
- /* A change in queue status occured during the hw interrupt
- * register update. To maintain the interrupt consistency, it
- * is necessary to iterate through all queues of the queue group.
- */
-
- /* Read interrupt status again */
- ixQMgrAqmIfQInterruptRegRead (group, &intRegValAfterWrite);
-
- if (IX_QMGR_QUELOW_GROUP == group)
- {
- priorityTableIndex = IX_QMGR_MIN_LOW_QUE_PRIORITY_TABLE_INDEX;
- endIndex = IX_QMGR_MAX_LOW_QUE_PRIORITY_TABLE_INDEX;
- }
- else
- {
- priorityTableIndex = IX_QMGR_MIN_UPP_QUE_PRIORITY_TABLE_INDEX;
- endIndex = IX_QMGR_MAX_UPP_QUE_PRIORITY_TABLE_INDEX;
- }
-
- for ( ; priorityTableIndex<=endIndex; priorityTableIndex++)
- {
- qIndex = priorityTable[priorityTableIndex];
- currDispatchQInfo = &dispatchQInfo[qIndex];
- intRegCheckMask = currDispatchQInfo->intRegCheckMask;
-
- /* If this queue caused this interrupt to be raised */
- if (intRegVal & intRegCheckMask)
- {
- /* Call the callback function for this queue */
- currDispatchQInfo->callback (qIndex,
- currDispatchQInfo->callbackId);
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.queueStats[qIndex].callbackCnt++;
-#endif
-
- } /* if (intRegVal .. */
-
- /*
- * If interrupt bit is set in intRegValAfterWrite don't
- * proceed as this will be caught in next interrupt
- */
- else if ((intRegValAfterWrite & intRegCheckMask) == 0)
- {
- /* Check if an interrupt was lost for this Q */
- if (ixQMgrAqmIfQStatusCheck(qStatusWordsB4Write,
- qStatusWordsAfterWrite,
- currDispatchQInfo->statusWordOffset,
- currDispatchQInfo->statusCheckValue,
- currDispatchQInfo->statusMask))
- {
- /* Call the callback function for this queue */
- currDispatchQInfo->callback (qIndex,
- dispatchQInfo[qIndex].callbackId);
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.queueStats[qIndex].callbackCnt++;
- dispatcherStats.queueStats[qIndex].intLostCallbackCnt++;
-#endif
- } /* if ixQMgrAqmIfQStatusCheck(.. */
- } /* else if ((intRegValAfterWrite ... */
- } /* for (priorityTableIndex=0 ... */
- }
-
- /* Rebuild the priority table if needed */
- if (rebuildTable)
- {
- ixQMgrDispatcherReBuildPriorityTable ();
- }
-
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.loopRunCnt++;
-#endif
-}
-
-
-
-void
-ixQMgrDispatcherLoopRunB0 (IxQMgrDispatchGroup group)
-{
- UINT32 intRegVal; /* Interrupt reg val */
- UINT32 intRegCheckMask; /* Mask for checking interrupt bits */
- IxQMgrQInfo *currDispatchQInfo;
-
-
- int priorityTableIndex; /* Priority table index */
- int qIndex; /* Current queue being processed */
-
-#ifndef NDEBUG
- IX_OSAL_ASSERT((group == IX_QMGR_QUEUPP_GROUP) ||
- (group == IX_QMGR_QUELOW_GROUP));
- IX_OSAL_ASSERT((group == IX_QMGR_QUEUPP_GROUP) ||
- (group == IX_QMGR_QUELOW_GROUP));
-#endif
-
- /* Read the interrupt register */
- ixQMgrAqmIfQInterruptRegRead (group, &intRegVal);
-
-
- /* No queue has interrupt register set */
- if (intRegVal != 0)
- {
-
- /* Write it back to clear the interrupt */
- ixQMgrAqmIfQInterruptRegWrite (group, intRegVal);
-
- /* get the first queue Id from the interrupt register value */
- qIndex = (BITS_PER_WORD - 1) - ixQMgrCountLeadingZeros(intRegVal);
-
- if (IX_QMGR_QUEUPP_GROUP == group)
- {
- /* Set the queue range based on the queue group to proccess */
- qIndex += IX_QMGR_MIN_QUEUPP_QID;
- }
-
- /* check if the interrupt register contains
- * only 1 bit set
- * For example:
- * intRegVal = 0x0010
- * currDispatchQInfo->intRegCheckMask = 0x0010
- * intRegVal == currDispatchQInfo->intRegCheckMask is TRUE.
- */
- currDispatchQInfo = &dispatchQInfo[qIndex];
- if (intRegVal == currDispatchQInfo->intRegCheckMask)
- {
- /* only 1 queue event triggered a notification *
- * Call the callback function for this queue
- */
- currDispatchQInfo->callback (qIndex,
- currDispatchQInfo->callbackId);
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.queueStats[qIndex].callbackCnt++;
-#endif
- }
- else
- {
- /* the event is triggered by more than 1 queue,
- * the queue search will be starting from the beginning
- * or the middle of the priority table
- *
- * the serach will end when all the bits of the interrupt
- * register are cleared. There is no need to maintain
- * a seperate value and test it at each iteration.
- */
- if (IX_QMGR_QUELOW_GROUP == group)
- {
- /* check if any bit related to queues in the first
- * half of the priority table is set
- */
- if (intRegVal & lowPriorityTableFirstHalfMask)
- {
- priorityTableIndex = IX_QMGR_MIN_LOW_QUE_PRIORITY_TABLE_INDEX;
- }
- else
- {
- priorityTableIndex = IX_QMGR_MID_LOW_QUE_PRIORITY_TABLE_INDEX;
- }
- }
- else
- {
- /* check if any bit related to queues in the first
- * half of the priority table is set
- */
- if (intRegVal & uppPriorityTableFirstHalfMask)
- {
- priorityTableIndex = IX_QMGR_MIN_UPP_QUE_PRIORITY_TABLE_INDEX;
- }
- else
- {
- priorityTableIndex = IX_QMGR_MID_UPP_QUE_PRIORITY_TABLE_INDEX;
- }
- }
-
- /* iterate following the priority table until all the bits
- * of the interrupt register are cleared.
- */
- do
- {
- qIndex = priorityTable[priorityTableIndex++];
- currDispatchQInfo = &dispatchQInfo[qIndex];
- intRegCheckMask = currDispatchQInfo->intRegCheckMask;
-
- /* If this queue caused this interrupt to be raised */
- if (intRegVal & intRegCheckMask)
- {
- /* Call the callback function for this queue */
- currDispatchQInfo->callback (qIndex,
- currDispatchQInfo->callbackId);
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.queueStats[qIndex].callbackCnt++;
-#endif
-
- /* Clear the interrupt register bit */
- intRegVal &= ~intRegCheckMask;
- }
- }
- while(intRegVal);
- } /*End of intRegVal == currDispatchQInfo->intRegCheckMask */
- } /* End of intRegVal != 0 */
-
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.loopRunCnt++;
-#endif
-
- /* Rebuild the priority table if needed */
- if (rebuildTable)
- {
- ixQMgrDispatcherReBuildPriorityTable ();
- }
-}
-
-void
-ixQMgrDispatcherLoopRunB0LLP (IxQMgrDispatchGroup group)
-{
- UINT32 intRegVal =0; /* Interrupt reg val */
- UINT32 intRegCheckMask; /* Mask for checking interrupt bits */
- IxQMgrQInfo *currDispatchQInfo;
-
- int priorityTableIndex; /* Priority table index */
- int qIndex; /* Current queue being processed */
-
- UINT32 intRegValCopy = 0;
- UINT32 intEnableRegVal = 0;
- UINT8 i = 0;
-
-#ifndef NDEBUG
- IX_OSAL_ASSERT((group == IX_QMGR_QUEUPP_GROUP) ||
- (group == IX_QMGR_QUELOW_GROUP));
-#endif
-
- /* Read the interrupt register */
- ixQMgrAqmIfQInterruptRegRead (group, &intRegVal);
-
- /*
- * mask any interrupts that are not enabled
- */
- ixQMgrAqmIfQInterruptEnableRegRead (group, &intEnableRegVal);
- intRegVal &= intEnableRegVal;
-
- /* No queue has interrupt register set */
- if (intRegVal != 0)
- {
- if (IX_QMGR_QUELOW_GROUP == group)
- {
- /*
- * As the sticky bit is set, the interrupt register will
- * not clear if write back at this point because the condition
- * has not been cleared. Take a copy and write back later after
- * the condition has been cleared
- */
- intRegValCopy = intRegVal;
- }
- else
- {
- /* no sticky for upper Q's, so write back now */
- ixQMgrAqmIfQInterruptRegWrite (group, intRegVal);
- }
-
- /* get the first queue Id from the interrupt register value */
- qIndex = (BITS_PER_WORD - 1) - ixQMgrCountLeadingZeros(intRegVal);
-
- if (IX_QMGR_QUEUPP_GROUP == group)
- {
- /* Set the queue range based on the queue group to proccess */
- qIndex += IX_QMGR_MIN_QUEUPP_QID;
- }
-
- /* check if the interrupt register contains
- * only 1 bit set
- * For example:
- * intRegVal = 0x0010
- * currDispatchQInfo->intRegCheckMask = 0x0010
- * intRegVal == currDispatchQInfo->intRegCheckMask is TRUE.
- */
- currDispatchQInfo = &dispatchQInfo[qIndex];
- if (intRegVal == currDispatchQInfo->intRegCheckMask)
- {
-
- /*
- * check if Q type periodic - only lower queues can
- * have there type set to periodic
- */
- if (IX_QMGR_TYPE_REALTIME_PERIODIC == ixQMgrQTypes[qIndex])
- {
- /*
- * Disable the notifications on any sporadics
- */
- for (i=0; i <= IX_QMGR_MAX_LOW_QUE_TABLE_INDEX; i++)
- {
- if (IX_QMGR_TYPE_REALTIME_SPORADIC == ixQMgrQTypes[i])
- {
- ixQMgrNotificationDisable(i);
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.queueStats[i].disableCount++;
-#endif
- }
- }
- }
-
- currDispatchQInfo->callback (qIndex,
- currDispatchQInfo->callbackId);
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.queueStats[qIndex].callbackCnt++;
-#endif
- }
- else
- {
- /* the event is triggered by more than 1 queue,
- * the queue search will be starting from the beginning
- * or the middle of the priority table
- *
- * the serach will end when all the bits of the interrupt
- * register are cleared. There is no need to maintain
- * a seperate value and test it at each iteration.
- */
- if (IX_QMGR_QUELOW_GROUP == group)
- {
- /* check if any bit related to queues in the first
- * half of the priority table is set
- */
- if (intRegVal & lowPriorityTableFirstHalfMask)
- {
- priorityTableIndex =
- IX_QMGR_MIN_LOW_QUE_PRIORITY_TABLE_INDEX;
- }
- else
- {
- priorityTableIndex =
- IX_QMGR_MID_LOW_QUE_PRIORITY_TABLE_INDEX;
- }
- }
- else
- {
- /* check if any bit related to queues in the first
- * half of the priority table is set
- */
- if (intRegVal & uppPriorityTableFirstHalfMask)
- {
- priorityTableIndex =
- IX_QMGR_MIN_UPP_QUE_PRIORITY_TABLE_INDEX;
- }
- else
- {
- priorityTableIndex =
- IX_QMGR_MID_UPP_QUE_PRIORITY_TABLE_INDEX;
- }
- }
-
- /* iterate following the priority table until all the bits
- * of the interrupt register are cleared.
- */
- do
- {
- qIndex = priorityTable[priorityTableIndex++];
- currDispatchQInfo = &dispatchQInfo[qIndex];
- intRegCheckMask = currDispatchQInfo->intRegCheckMask;
-
- /* If this queue caused this interrupt to be raised */
- if (intRegVal & intRegCheckMask)
- {
- /*
- * check if Q type periodic - only lower queues can
- * have there type set to periodic. There can only be one
- * periodic queue, so the sporadics are only disabled once.
- */
- if (IX_QMGR_TYPE_REALTIME_PERIODIC == ixQMgrQTypes[qIndex])
- {
- /*
- * Disable the notifications on any sporadics
- */
- for (i=0; i <= IX_QMGR_MAX_LOW_QUE_TABLE_INDEX; i++)
- {
- if (IX_QMGR_TYPE_REALTIME_SPORADIC ==
- ixQMgrQTypes[i])
- {
- ixQMgrNotificationDisable(i);
- /*
- * remove from intRegVal as we don't want
- * to service any sporadics now
- */
- intRegVal &= ~dispatchQInfo[i].intRegCheckMask;
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.queueStats[i].disableCount++;
-#endif
- }
- }
- }
-
- currDispatchQInfo->callback (qIndex,
- currDispatchQInfo->callbackId);
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.queueStats[qIndex].callbackCnt++;
-#endif
- /* Clear the interrupt register bit */
- intRegVal &= ~intRegCheckMask;
- }
- }
- while(intRegVal);
- } /*End of intRegVal == currDispatchQInfo->intRegCheckMask */
- } /* End of intRegVal != 0 */
-
-#ifndef NDEBUG
- /* Update statistics */
- dispatcherStats.loopRunCnt++;
-#endif
-
- if ((intRegValCopy != 0) && (IX_QMGR_QUELOW_GROUP == group))
- {
- /*
- * lower groups (therefore sticky) AND at least one enabled interrupt
- * Write back to clear the interrupt
- */
- ixQMgrAqmIfQInterruptRegWrite (IX_QMGR_QUELOW_GROUP, intRegValCopy);
- }
-
- /* Rebuild the priority table if needed */
- if (rebuildTable)
- {
- ixQMgrDispatcherReBuildPriorityTable ();
- }
-}
-
-PRIVATE void
-ixQMgrDispatcherReBuildPriorityTable (void)
-{
- UINT32 qIndex;
- UINT32 priority;
- int lowQuePriorityTableIndex = IX_QMGR_MIN_LOW_QUE_PRIORITY_TABLE_INDEX;
- int uppQuePriorityTableIndex = IX_QMGR_MIN_UPP_QUE_PRIORITY_TABLE_INDEX;
-
- /* Reset the rebuild flag */
- rebuildTable = FALSE;
-
- /* initialize the mak used to identify the queues in the first half
- * of the priority table
- */
- lowPriorityTableFirstHalfMask = 0;
- uppPriorityTableFirstHalfMask = 0;
-
- /* For each priority level */
- for(priority=0; priority<IX_QMGR_NUM_PRIORITY_LEVELS; priority++)
- {
- /* Foreach low queue in this priority */
- for(qIndex=0; qIndex<IX_QMGR_MIN_QUEUPP_QID; qIndex++)
- {
- if (dispatchQInfo[qIndex].priority == priority)
- {
- /* build the priority table bitmask which match the
- * queues of the first half of the priority table
- */
- if (lowQuePriorityTableIndex < IX_QMGR_MID_LOW_QUE_PRIORITY_TABLE_INDEX)
- {
- lowPriorityTableFirstHalfMask |= dispatchQInfo[qIndex].intRegCheckMask;
- }
- /* build the priority table */
- priorityTable[lowQuePriorityTableIndex++] = qIndex;
- }
- }
- /* Foreach upp queue */
- for(qIndex=IX_QMGR_MIN_QUEUPP_QID; qIndex<=IX_QMGR_MAX_QID; qIndex++)
- {
- if (dispatchQInfo[qIndex].priority == priority)
- {
- /* build the priority table bitmask which match the
- * queues of the first half of the priority table
- */
- if (uppQuePriorityTableIndex < IX_QMGR_MID_UPP_QUE_PRIORITY_TABLE_INDEX)
- {
- uppPriorityTableFirstHalfMask |= dispatchQInfo[qIndex].intRegCheckMask;
- }
- /* build the priority table */
- priorityTable[uppQuePriorityTableIndex++] = qIndex;
- }
- }
- }
-}
-
-IxQMgrDispatcherStats*
-ixQMgrDispatcherStatsGet (void)
-{
- return &dispatcherStats;
-}
-
-PRIVATE void
-dummyCallback (IxQMgrQId qId,
- IxQMgrCallbackId cbId)
-{
- /* Throttle the trace message */
- if ((dispatchQInfo[qId].dummyCallbackCount % LOG_THROTTLE_COUNT) == 0)
- {
- IX_QMGR_LOG_WARNING2("--> dummyCallback: qId (%d), callbackId (%d)\n",qId,cbId);
- }
- dispatchQInfo[qId].dummyCallbackCount++;
-
-#ifndef NDEBUG
- /* Update statistcs */
- dispatcherStats.queueStats[qId].intNoCallbackCnt++;
-#endif
-}
-void
-ixQMgrLLPShow (int resetStats)
-{
-#ifndef NDEBUG
- UINT8 i = 0;
- IxQMgrQInfo *q;
- UINT32 intEnableRegVal = 0;
-
- printf ("Livelock statistics are printed on the fly.\n");
- printf ("qId Type EnableCnt DisableCnt IntEnableState Callbacks\n");
- printf ("=== ======== ========= ========== ============== =========\n");
-
- for (i=0; i<= IX_QMGR_MAX_LOW_QUE_TABLE_INDEX; i++)
- {
- q = &dispatchQInfo[i];
-
- if (ixQMgrQTypes[i] != IX_QMGR_TYPE_REALTIME_OTHER)
- {
- printf (" %2d ", i);
-
- if (ixQMgrQTypes[i] == IX_QMGR_TYPE_REALTIME_SPORADIC)
- {
- printf ("Sporadic");
- }
- else
- {
- printf ("Periodic");
- }
-
-
- ixQMgrAqmIfQInterruptEnableRegRead (IX_QMGR_QUELOW_GROUP,
- &intEnableRegVal);
-
-
- intEnableRegVal &= dispatchQInfo[i].intRegCheckMask;
- intEnableRegVal = intEnableRegVal >> i;
-
- printf (" %10d %10d %10d %10d\n",
- dispatcherStats.queueStats[i].enableCount,
- dispatcherStats.queueStats[i].disableCount,
- intEnableRegVal,
- dispatcherStats.queueStats[i].callbackCnt);
-
- if (resetStats)
- {
- dispatcherStats.queueStats[i].enableCount =
- dispatcherStats.queueStats[i].disableCount =
- dispatcherStats.queueStats[i].callbackCnt = 0;
- }
- }
- }
-#else
- IX_QMGR_LOG0("Livelock Prevention statistics are only collected in debug mode\n");
-#endif
-}
-
-void
-ixQMgrPeriodicDone (void)
-{
- UINT32 i = 0;
- UINT32 ixQMgrLockKey = 0;
-
- /*
- * for the lower queues
- */
- for (i=0; i <= IX_QMGR_MAX_LOW_QUE_TABLE_INDEX; i++)
- {
- /*
- * check for sporadics
- */
- if (IX_QMGR_TYPE_REALTIME_SPORADIC == ixQMgrQTypes[i])
- {
- /*
- * enable any sporadics
- */
- ixQMgrLockKey = ixOsalIrqLock();
- ixQMgrAqmIfQInterruptEnable(i);
- ixOsalIrqUnlock(ixQMgrLockKey);
-#ifndef NDEBUG
- /*
- * Update statistics
- */
- dispatcherStats.queueStats[i].enableCount++;
- dispatcherStats.queueStats[i].notificationEnabled = TRUE;
-#endif
- }
- }
-}
-IX_STATUS
-ixQMgrCallbackTypeSet (IxQMgrQId qId,
- IxQMgrType type)
-{
- UINT32 ixQMgrLockKey = 0;
- IxQMgrType ixQMgrOldType =0;
-
-#ifndef NDEBUG
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
- if (qId >= IX_QMGR_MIN_QUEUPP_QID)
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
- if(!IX_QMGR_DISPATCHER_CALLBACK_TYPE_CHECK(type))
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
-#endif
-
- ixQMgrOldType = ixQMgrQTypes[qId];
- ixQMgrQTypes[qId] = type;
-
- /*
- * check if Q has been changed from type SPORADIC
- */
- if (IX_QMGR_TYPE_REALTIME_SPORADIC == ixQMgrOldType)
- {
- /*
- * previously Q was a SPORADIC, this means that LLP
- * might have had it disabled. enable it now.
- */
- ixQMgrLockKey = ixOsalIrqLock();
- ixQMgrAqmIfQInterruptEnable(qId);
- ixOsalIrqUnlock(ixQMgrLockKey);
-
-#ifndef NDEBUG
- /*
- * Update statistics
- */
- dispatcherStats.queueStats[qId].enableCount++;
-#endif
- }
-
- return IX_SUCCESS;
-}
-
-IX_STATUS
-ixQMgrCallbackTypeGet (IxQMgrQId qId,
- IxQMgrType *type)
-{
-#ifndef NDEBUG
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
- if (qId >= IX_QMGR_MIN_QUEUPP_QID)
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
- if(type == NULL)
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
-#endif
-
- *type = ixQMgrQTypes[qId];
- return IX_SUCCESS;
-}
diff --git a/cpu/ixp/npe/IxQMgrInit.c b/cpu/ixp/npe/IxQMgrInit.c
deleted file mode 100644
index b00c22d08e..0000000000
--- a/cpu/ixp/npe/IxQMgrInit.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file IxQMgrInit.c
- *
- * @author Intel Corporation
- * @date 30-Oct-2001
- *
- * @brief: Provided initialization of the QMgr component and its subcomponents.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/*
- * System defined include files.
- */
-
-/*
- * User defined include files.
- */
-#include "IxOsal.h"
-#include "IxQMgr.h"
-#include "IxQMgrQCfg_p.h"
-#include "IxQMgrDispatcher_p.h"
-#include "IxQMgrLog_p.h"
-#include "IxQMgrQAccess_p.h"
-#include "IxQMgrDefines_p.h"
-#include "IxQMgrAqmIf_p.h"
-
-/*
- * Set to true if initialized
- * N.B. global so integration/unit tests can reinitialize
- */
-BOOL qMgrIsInitialized = FALSE;
-
-/*
- * Function definitions.
- */
-IX_STATUS
-ixQMgrInit (void)
-{
- if (qMgrIsInitialized)
- {
- IX_QMGR_LOG0("ixQMgrInit: IxQMgr already initialised\n");
- return IX_FAIL;
- }
-
- /* Initialise the QCfg component */
- ixQMgrQCfgInit ();
-
- /* Initialise the Dispatcher component */
- ixQMgrDispatcherInit ();
-
- /* Initialise the Access component */
- ixQMgrQAccessInit ();
-
- /* Initialization complete */
- qMgrIsInitialized = TRUE;
-
- return IX_SUCCESS;
-}
-
-IX_STATUS
-ixQMgrUnload (void)
-{
- if (!qMgrIsInitialized)
- {
- return IX_FAIL;
- }
-
- /* Uninitialise the QCfg component */
- ixQMgrQCfgUninit ();
-
- /* Uninitialization complete */
- qMgrIsInitialized = FALSE;
-
- return IX_SUCCESS;
-}
-
-void
-ixQMgrShow (void)
-{
- IxQMgrQCfgStats *qCfgStats = NULL;
- IxQMgrDispatcherStats *dispatcherStats = NULL;
- int i;
- UINT32 lowIntRegRead, upIntRegRead;
-
- qCfgStats = ixQMgrQCfgStatsGet ();
- dispatcherStats = ixQMgrDispatcherStatsGet ();
- ixQMgrAqmIfQInterruptRegRead (IX_QMGR_QUELOW_GROUP, &lowIntRegRead);
- ixQMgrAqmIfQInterruptRegRead (IX_QMGR_QUEUPP_GROUP, &upIntRegRead);
- printf("Generic Stats........\n");
- printf("=====================\n");
- printf("Loop Run Count..........%u\n",dispatcherStats->loopRunCnt);
- printf("Watermark set count.....%d\n", qCfgStats->wmSetCnt);
- printf("===========================================\n");
- printf("On the fly Interrupt Register Stats........\n");
- printf("===========================================\n");
- printf("Lower Interrupt Register............0x%08x\n",lowIntRegRead);
- printf("Upper Interrupt Register............0x%08x\n",upIntRegRead);
- printf("==============================================\n");
- printf("Queue Specific Stats........\n");
- printf("============================\n");
-
- for (i=0; i<IX_QMGR_MAX_NUM_QUEUES; i++)
- {
- if (ixQMgrQIsConfigured(i))
- {
- ixQMgrQShow(i);
- }
- }
-
- printf("============================\n");
-}
-
-IX_STATUS
-ixQMgrQShow (IxQMgrQId qId)
-{
- IxQMgrQCfgStats *qCfgStats = NULL;
- IxQMgrDispatcherStats *dispatcherStats = NULL;
-
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-
- dispatcherStats = ixQMgrDispatcherStatsGet ();
- qCfgStats = ixQMgrQCfgQStatsGet (qId);
-
- printf("QId %d\n", qId);
- printf("======\n");
- printf(" IxQMgrQCfg Stats\n");
- printf(" Name..................... \"%s\"\n", qCfgStats->qStats[qId].qName);
- printf(" Size in words............ %u\n", qCfgStats->qStats[qId].qSizeInWords);
- printf(" Entry size in words...... %u\n", qCfgStats->qStats[qId].qEntrySizeInWords);
- printf(" Nearly empty watermark... %u\n", qCfgStats->qStats[qId].ne);
- printf(" Nearly full watermark.... %u\n", qCfgStats->qStats[qId].nf);
- printf(" Number of full entries... %u\n", qCfgStats->qStats[qId].numEntries);
- printf(" Sram base address........ 0x%X\n", qCfgStats->qStats[qId].baseAddress);
- printf(" Read pointer............. 0x%X\n", qCfgStats->qStats[qId].readPtr);
- printf(" Write pointer............ 0x%X\n", qCfgStats->qStats[qId].writePtr);
-
-#ifndef NDEBUG
- if (dispatcherStats->queueStats[qId].notificationEnabled)
- {
- char *localEvent = "none ????";
- switch (dispatcherStats->queueStats[qId].srcSel)
- {
- case IX_QMGR_Q_SOURCE_ID_E:
- localEvent = "Empty";
- break;
- case IX_QMGR_Q_SOURCE_ID_NE:
- localEvent = "Nearly Empty";
- break;
- case IX_QMGR_Q_SOURCE_ID_NF:
- localEvent = "Nearly Full";
- break;
- case IX_QMGR_Q_SOURCE_ID_F:
- localEvent = "Full";
- break;
- case IX_QMGR_Q_SOURCE_ID_NOT_E:
- localEvent = "Not Empty";
- break;
- case IX_QMGR_Q_SOURCE_ID_NOT_NE:
- localEvent = "Not Nearly Empty";
- break;
- case IX_QMGR_Q_SOURCE_ID_NOT_NF:
- localEvent = "Not Nearly Full";
- break;
- case IX_QMGR_Q_SOURCE_ID_NOT_F:
- localEvent = "Not Full";
- break;
- default :
- break;
- }
- printf(" Notifications localEvent...... %s\n", localEvent);
- }
- else
- {
- printf(" Notifications............ not enabled\n");
- }
- printf(" IxQMgrDispatcher Stats\n");
- printf(" Callback count................%d\n",
- dispatcherStats->queueStats[qId].callbackCnt);
- printf(" Priority change count.........%d\n",
- dispatcherStats->queueStats[qId].priorityChangeCnt);
- printf(" Interrupt no callback count...%d\n",
- dispatcherStats->queueStats[qId].intNoCallbackCnt);
- printf(" Interrupt lost callback count...%d\n",
- dispatcherStats->queueStats[qId].intLostCallbackCnt);
-#endif
-
- return IX_SUCCESS;
-}
-
-
-
-
diff --git a/cpu/ixp/npe/IxQMgrQAccess.c b/cpu/ixp/npe/IxQMgrQAccess.c
deleted file mode 100644
index 2c3e302696..0000000000
--- a/cpu/ixp/npe/IxQMgrQAccess.c
+++ /dev/null
@@ -1,796 +0,0 @@
-/**
- * @file IxQMgrQAccess.c
- *
- * @author Intel Corporation
- * @date 30-Oct-2001
- *
- * @brief This file contains functions for putting entries on a queue and
- * removing entries from a queue.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/*
- * Inlines are compiled as function when this is defined.
- * N.B. Must be placed before #include of "IxQMgr.h"
- */
-#ifndef IXQMGR_H
-# define IXQMGRQACCESS_C
-#else
-# error
-#endif
-
-/*
- * System defined include files.
- */
-
-/*
- * User defined include files.
- */
-#include "IxQMgr.h"
-#include "IxQMgrAqmIf_p.h"
-#include "IxQMgrQAccess_p.h"
-#include "IxQMgrQCfg_p.h"
-#include "IxQMgrDefines_p.h"
-
-/*
- * Global variables and extern definitions
- */
-extern IxQMgrQInlinedReadWriteInfo ixQMgrQInlinedReadWriteInfo[];
-
-/*
- * Function definitions.
- */
-void
-ixQMgrQAccessInit (void)
-{
-}
-
-IX_STATUS
-ixQMgrQReadWithChecks (IxQMgrQId qId,
- UINT32 *entry)
-{
- IxQMgrQEntrySizeInWords entrySizeInWords;
- IxQMgrQInlinedReadWriteInfo *infoPtr;
-
- if (NULL == entry)
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
-
- /* Check QId */
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-
- /* Get the q entry size in words */
- entrySizeInWords = ixQMgrQEntrySizeInWordsGet (qId);
-
- ixQMgrAqmIfQPop (qId, entrySizeInWords, entry);
-
- /* reset the current read count if the counter wrapped around
- * (unsigned arithmetic)
- */
- infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- if (infoPtr->qReadCount-- > infoPtr->qSizeInEntries)
- {
- infoPtr->qReadCount = 0;
- }
-
- /* Check if underflow occurred on the read */
- if (ixQMgrAqmIfUnderflowCheck (qId))
- {
- return IX_QMGR_Q_UNDERFLOW;
- }
-
- return IX_SUCCESS;
-}
-
-/* this function reads the remaining of the q entry
- * for queues configured with many words.
- * (the first word of the entry is already read
- * in the inlined function and the entry pointer already
- * incremented
- */
-IX_STATUS
-ixQMgrQReadMWordsMinus1 (IxQMgrQId qId,
- UINT32 *entry)
-{
- IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- UINT32 entrySize = infoPtr->qEntrySizeInWords;
- volatile UINT32 *qAccRegAddr = infoPtr->qAccRegAddr;
-
- while (--entrySize)
- {
- /* read the entry and accumulate the result */
- *(++entry) = IX_OSAL_READ_LONG(++qAccRegAddr);
- }
- /* underflow is available for lower queues only */
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- /* get the queue status */
- UINT32 status = IX_OSAL_READ_LONG(infoPtr->qUOStatRegAddr);
-
- /* check the underflow status */
- if (status & infoPtr->qUflowStatBitMask)
- {
- /* the queue is empty
- * clear the underflow status bit if it was set
- */
- IX_OSAL_WRITE_LONG(infoPtr->qUOStatRegAddr,
- status & ~infoPtr->qUflowStatBitMask);
- return IX_QMGR_Q_UNDERFLOW;
- }
- }
- return IX_SUCCESS;
-}
-
-IX_STATUS
-ixQMgrQWriteWithChecks (IxQMgrQId qId,
- UINT32 *entry)
-{
- IxQMgrQEntrySizeInWords entrySizeInWords;
- IxQMgrQInlinedReadWriteInfo *infoPtr;
-
- if (NULL == entry)
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
-
- /* Check QId */
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-
- /* Get the q entry size in words */
- entrySizeInWords = ixQMgrQEntrySizeInWordsGet (qId);
-
- ixQMgrAqmIfQPush (qId, entrySizeInWords, entry);
-
- /* reset the current read count if the counter wrapped around
- * (unsigned arithmetic)
- */
- infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- if (infoPtr->qWriteCount++ >= infoPtr->qSizeInEntries)
- {
- infoPtr->qWriteCount = infoPtr->qSizeInEntries;
- }
-
- /* Check if overflow occurred on the write*/
- if (ixQMgrAqmIfOverflowCheck (qId))
- {
- return IX_QMGR_Q_OVERFLOW;
- }
-
- return IX_SUCCESS;
-}
-
-IX_STATUS
-ixQMgrQPeek (IxQMgrQId qId,
- unsigned int entryIndex,
- UINT32 *entry)
-{
- unsigned int numEntries;
-
-#ifndef NDEBUG
- if ((NULL == entry) || (entryIndex >= IX_QMGR_Q_SIZE_INVALID))
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
-
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-#endif
-
- if (IX_SUCCESS != ixQMgrQNumEntriesGet (qId, &numEntries))
- {
- return IX_FAIL;
- }
-
- if (entryIndex >= numEntries) /* entryIndex starts at 0 */
- {
- return IX_QMGR_ENTRY_INDEX_OUT_OF_BOUNDS;
- }
-
- return ixQMgrAqmIfQPeek (qId, entryIndex, entry);
-}
-
-IX_STATUS
-ixQMgrQPoke (IxQMgrQId qId,
- unsigned entryIndex,
- UINT32 *entry)
-{
- unsigned int numEntries;
-
-#ifndef NDEBUG
- if ((NULL == entry) || (entryIndex > 128))
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
-
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-#endif
-
- if (IX_SUCCESS != ixQMgrQNumEntriesGet (qId, &numEntries))
- {
- return IX_FAIL;
- }
-
- if (numEntries < (entryIndex + 1)) /* entryIndex starts at 0 */
- {
- return IX_QMGR_ENTRY_INDEX_OUT_OF_BOUNDS;
- }
-
- return ixQMgrAqmIfQPoke (qId, entryIndex, entry);
-}
-
-IX_STATUS
-ixQMgrQStatusGetWithChecks (IxQMgrQId qId,
- IxQMgrQStatus *qStatus)
-{
- if (NULL == qStatus)
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
-
- if (!ixQMgrQIsConfigured (qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-
- ixQMgrAqmIfQueStatRead (qId, qStatus);
-
- return IX_SUCCESS;
-}
-
-IX_STATUS
-ixQMgrQNumEntriesGet (IxQMgrQId qId,
- unsigned *numEntriesPtr)
-{
- UINT32 qPtrs;
- UINT32 qStatus;
- unsigned numEntries;
- IxQMgrQInlinedReadWriteInfo *infoPtr;
-
-
-#ifndef NDEBUG
- if (NULL == numEntriesPtr)
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
-
- /* Check QId */
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-#endif
-
- /* get fast access data */
- infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
-
- /* get snapshot */
- qPtrs = IX_OSAL_READ_LONG(infoPtr->qConfigRegAddr);
-
- /* Mod subtraction of pointers to get number of words in Q. */
- numEntries = (qPtrs - (qPtrs >> 7)) & 0x7f;
-
- if (numEntries == 0)
- {
- /*
- * Could mean either full or empty queue
- * so look at status
- */
- ixQMgrAqmIfQueStatRead (qId, &qStatus);
-
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- if (qStatus & IX_QMGR_Q_STATUS_E_BIT_MASK)
- {
- /* Empty */
- *numEntriesPtr = 0;
- }
- else if (qStatus & IX_QMGR_Q_STATUS_F_BIT_MASK)
- {
- /* Full */
- *numEntriesPtr = infoPtr->qSizeInEntries;
- }
- else
- {
- /*
- * Queue status and read/write pointers are volatile.
- * The queue state has changed since we took the
- * snapshot of the read and write pointers.
- * Client can retry if they wish
- */
- *numEntriesPtr = 0;
- return IX_QMGR_WARNING;
- }
- }
- else /* It is an upper queue which does not have an empty status bit maintained */
- {
- if (qStatus & IX_QMGR_Q_STATUS_F_BIT_MASK)
- {
- /* The queue is Full at the time of snapshot. */
- *numEntriesPtr = infoPtr->qSizeInEntries;
- }
- else
- {
- /* The queue is either empty, either moving,
- * Client can retry if they wish
- */
- *numEntriesPtr = 0;
- return IX_QMGR_WARNING;
- }
- }
- }
- else
- {
- *numEntriesPtr = (numEntries / infoPtr->qEntrySizeInWords) & (infoPtr->qSizeInEntries - 1);
- }
-
- return IX_SUCCESS;
-}
-
-#if defined(__wince) && defined(NO_INLINE_APIS)
-
-PUBLIC IX_STATUS
-ixQMgrQRead (IxQMgrQId qId,
- UINT32 *entryPtr)
-{
- extern IxQMgrQInlinedReadWriteInfo ixQMgrQInlinedReadWriteInfo[];
- IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- UINT32 entry, entrySize;
-
- /* get a new entry */
- entrySize = infoPtr->qEntrySizeInWords;
- entry = IX_OSAL_READ_LONG(infoPtr->qAccRegAddr);
-
- if (entrySize != IX_QMGR_Q_ENTRY_SIZE1)
- {
- *entryPtr = entry;
- /* process the remaining part of the entry */
- return ixQMgrQReadMWordsMinus1(qId, entryPtr);
- }
-
- /* underflow is available for lower queues only */
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- /* the counter of queue entries is decremented. In happy
- * day scenario there are many entries in the queue
- * and the counter does not reach zero.
- */
- if (infoPtr->qReadCount-- == 0)
- {
- /* There is maybe no entry in the queue
- * qReadCount is now negative, but will be corrected before
- * the function returns.
- */
- UINT32 qPtrs; /* queue internal pointers */
-
- /* when a queue is empty, the hw guarantees to return
- * a null value. If the value is not null, the queue is
- * not empty.
- */
- if (entry == 0)
- {
- /* get the queue status */
- UINT32 status = IX_OSAL_READ_LONG(infoPtr->qUOStatRegAddr);
-
- /* check the underflow status */
- if (status & infoPtr->qUflowStatBitMask)
- {
- /* the queue is empty
- * clear the underflow status bit if it was set
- */
- IX_OSAL_WRITE_LONG(infoPtr->qUOStatRegAddr,
- status & ~infoPtr->qUflowStatBitMask);
- *entryPtr = 0;
- infoPtr->qReadCount = 0;
- return IX_QMGR_Q_UNDERFLOW;
- }
- }
- /* store the result */
- *entryPtr = entry;
-
- /* No underflow occured : someone is filling the queue
- * or the queue contains null entries.
- * The current counter needs to be
- * updated from the current number of entries in the queue
- */
-
- /* get snapshot of queue pointers */
- qPtrs = IX_OSAL_READ_LONG(infoPtr->qConfigRegAddr);
-
- /* Mod subtraction of pointers to get number of words in Q. */
- qPtrs = (qPtrs - (qPtrs >> 7)) & 0x7f;
-
- if (qPtrs == 0)
- {
- /* no entry in the queue */
- infoPtr->qReadCount = 0;
- }
- else
- {
- /* convert the number of words inside the queue
- * to a number of entries
- */
- infoPtr->qReadCount = qPtrs & (infoPtr->qSizeInEntries - 1);
- }
- return IX_SUCCESS;
- }
- }
- *entryPtr = entry;
- return IX_SUCCESS;
-}
-
-PUBLIC IX_STATUS
-ixQMgrQBurstRead (IxQMgrQId qId,
- UINT32 numEntries,
- UINT32 *entries)
-{
- extern IxQMgrQInlinedReadWriteInfo ixQMgrQInlinedReadWriteInfo[];
- IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- UINT32 nullCheckEntry;
-
- if (infoPtr->qEntrySizeInWords == IX_QMGR_Q_ENTRY_SIZE1)
- {
- volatile UINT32 *qAccRegAddr = infoPtr->qAccRegAddr;
-
- /* the code is optimized to take care of data dependencies:
- * Durig a read, there are a few cycles needed to get the
- * read complete. During these cycles, it is poossible to
- * do some CPU, e.g. increment pointers and decrement
- * counters.
- */
-
- /* fetch a queue entry */
- nullCheckEntry = IX_OSAL_READ_LONG(infoPtr->qAccRegAddr);
-
- /* iterate the specified number of queue entries */
- while (--numEntries)
- {
- /* check the result of the previous read */
- if (nullCheckEntry == 0)
- {
- /* if we read a NULL entry, stop. We have underflowed */
- break;
- }
- else
- {
- /* write the entry */
- *entries = nullCheckEntry;
- /* fetch next entry */
- nullCheckEntry = IX_OSAL_READ_LONG(qAccRegAddr);
- /* increment the write address */
- entries++;
- }
- }
- /* write the pre-fetched entry */
- *entries = nullCheckEntry;
- }
- else
- {
- IxQMgrQEntrySizeInWords entrySizeInWords = infoPtr->qEntrySizeInWords;
- /* read the specified number of queue entries */
- nullCheckEntry = 0;
- while (numEntries--)
- {
- int i;
-
- for (i = 0; i < entrySizeInWords; i++)
- {
- *entries = IX_OSAL_READ_LONG(infoPtr->qAccRegAddr + i);
- nullCheckEntry |= *entries++;
- }
-
- /* if we read a NULL entry, stop. We have underflowed */
- if (nullCheckEntry == 0)
- {
- break;
- }
- nullCheckEntry = 0;
- }
- }
-
- /* reset the current read count : next access to the read function
- * will force a underflow status check
- */
- infoPtr->qWriteCount = 0;
-
- /* Check if underflow occurred on the read */
- if (nullCheckEntry == 0 && qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- /* get the queue status */
- UINT32 status = IX_OSAL_READ_LONG(infoPtr->qUOStatRegAddr);
-
- if (status & infoPtr->qUflowStatBitMask)
- {
- /* clear the underflow status bit if it was set */
- IX_OSAL_WRITE_LONG(infoPtr->qUOStatRegAddr,
- status & ~infoPtr->qUflowStatBitMask);
- return IX_QMGR_Q_UNDERFLOW;
- }
- }
-
- return IX_SUCCESS;
-}
-
-PUBLIC IX_STATUS
-ixQMgrQWrite (IxQMgrQId qId,
- UINT32 *entry)
-{
- extern IxQMgrQInlinedReadWriteInfo ixQMgrQInlinedReadWriteInfo[];
- IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- UINT32 entrySize;
-
- /* write the entry */
- IX_OSAL_WRITE_LONG(infoPtr->qAccRegAddr, *entry);
- entrySize = infoPtr->qEntrySizeInWords;
-
- if (entrySize != IX_QMGR_Q_ENTRY_SIZE1)
- {
- /* process the remaining part of the entry */
- volatile UINT32 *qAccRegAddr = infoPtr->qAccRegAddr;
- while (--entrySize)
- {
- ++entry;
- IX_OSAL_WRITE_LONG(++qAccRegAddr, *entry);
- }
- entrySize = infoPtr->qEntrySizeInWords;
- }
-
- /* overflow is available for lower queues only */
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- UINT32 qSize = infoPtr->qSizeInEntries;
- /* increment the current number of entries in the queue
- * and check for overflow
- */
- if (infoPtr->qWriteCount++ == qSize)
- {
- /* the queue may have overflow */
- UINT32 qPtrs; /* queue internal pointers */
-
- /* get the queue status */
- UINT32 status = IX_OSAL_READ_LONG(infoPtr->qUOStatRegAddr);
-
- /* read the status twice because the status may
- * not be immediately ready after the write operation
- */
- if ((status & infoPtr->qOflowStatBitMask) ||
- ((status = IX_OSAL_READ_LONG(infoPtr->qUOStatRegAddr))
- & infoPtr->qOflowStatBitMask))
- {
- /* the queue is full, clear the overflow status
- * bit if it was set
- */
- IX_OSAL_WRITE_LONG(infoPtr->qUOStatRegAddr,
- status & ~infoPtr->qOflowStatBitMask);
- infoPtr->qWriteCount = infoPtr->qSizeInEntries;
- return IX_QMGR_Q_OVERFLOW;
- }
- /* No overflow occured : someone is draining the queue
- * and the current counter needs to be
- * updated from the current number of entries in the queue
- */
-
- /* get q pointer snapshot */
- qPtrs = IX_OSAL_READ_LONG(infoPtr->qConfigRegAddr);
-
- /* Mod subtraction of pointers to get number of words in Q. */
- qPtrs = (qPtrs - (qPtrs >> 7)) & 0x7f;
-
- if (qPtrs == 0)
- {
- /* the queue may be full at the time of the
- * snapshot. Next access will check
- * the overflow status again.
- */
- infoPtr->qWriteCount = qSize;
- }
- else
- {
- /* convert the number of words to a number of entries */
- if (entrySize == IX_QMGR_Q_ENTRY_SIZE1)
- {
- infoPtr->qWriteCount = qPtrs & (qSize - 1);
- }
- else
- {
- infoPtr->qWriteCount = (qPtrs / entrySize) & (qSize - 1);
- }
- }
- }
- }
- return IX_SUCCESS;
-}
-
-PUBLIC IX_STATUS
-ixQMgrQBurstWrite (IxQMgrQId qId,
- unsigned numEntries,
- UINT32 *entries)
-{
- extern IxQMgrQInlinedReadWriteInfo ixQMgrQInlinedReadWriteInfo[];
- IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- UINT32 status;
-
- /* update the current write count */
- infoPtr->qWriteCount += numEntries;
-
- if (infoPtr->qEntrySizeInWords == IX_QMGR_Q_ENTRY_SIZE1)
- {
- volatile UINT32 *qAccRegAddr = infoPtr->qAccRegAddr;
- while (numEntries--)
- {
- IX_OSAL_WRITE_LONG(qAccRegAddr, *entries);
- entries++;
- }
- }
- else
- {
- IxQMgrQEntrySizeInWords entrySizeInWords = infoPtr->qEntrySizeInWords;
- int i;
-
- /* write each queue entry */
- while (numEntries--)
- {
- /* write the queueEntrySize number of words for each entry */
- for (i = 0; i < entrySizeInWords; i++)
- {
- IX_OSAL_WRITE_LONG((infoPtr->qAccRegAddr + i), *entries);
- entries++;
- }
- }
- }
-
- /* check if the write count overflows */
- if (infoPtr->qWriteCount > infoPtr->qSizeInEntries)
- {
- /* reset the current write count */
- infoPtr->qWriteCount = infoPtr->qSizeInEntries;
- }
-
- /* Check if overflow occurred on the write operation */
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- /* get the queue status */
- status = IX_OSAL_READ_LONG(infoPtr->qUOStatRegAddr);
-
- /* read the status twice because the status may
- * not be ready at the time of the write
- */
- if ((status & infoPtr->qOflowStatBitMask) ||
- ((status = IX_OSAL_READ_LONG(infoPtr->qUOStatRegAddr))
- & infoPtr->qOflowStatBitMask))
- {
- /* clear the underflow status bit if it was set */
- IX_OSAL_WRITE_LONG(infoPtr->qUOStatRegAddr,
- status & ~infoPtr->qOflowStatBitMask);
- return IX_QMGR_Q_OVERFLOW;
- }
- }
-
- return IX_SUCCESS;
-}
-
-PUBLIC IX_STATUS
-ixQMgrQStatusGet (IxQMgrQId qId,
- IxQMgrQStatus *qStatus)
-{
- /* read the status of a queue in the range 0-31 */
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- extern UINT32 ixQMgrAqmIfQueLowStatRegAddr[];
- extern UINT32 ixQMgrAqmIfQueLowStatBitsOffset[];
- extern UINT32 ixQMgrAqmIfQueLowStatBitsMask;
- extern IxQMgrQInlinedReadWriteInfo ixQMgrQInlinedReadWriteInfo[];
- IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- volatile UINT32 *lowStatRegAddr = (UINT32*)ixQMgrAqmIfQueLowStatRegAddr[qId];
- volatile UINT32 *qUOStatRegAddr = infoPtr->qUOStatRegAddr;
-
- UINT32 lowStatBitsOffset = ixQMgrAqmIfQueLowStatBitsOffset[qId];
- UINT32 lowStatBitsMask = ixQMgrAqmIfQueLowStatBitsMask;
- UINT32 underflowBitMask = infoPtr->qUflowStatBitMask;
- UINT32 overflowBitMask = infoPtr->qOflowStatBitMask;
-
- /* read the status register for this queue */
- *qStatus = IX_OSAL_READ_LONG(lowStatRegAddr);
- /* mask out the status bits relevant only to this queue */
- *qStatus = (*qStatus >> lowStatBitsOffset) & lowStatBitsMask;
-
- /* Check if the queue has overflowed */
- if (IX_OSAL_READ_LONG(qUOStatRegAddr) & overflowBitMask)
- {
- /* clear the overflow status bit if it was set */
- IX_OSAL_WRITE_LONG(qUOStatRegAddr,
- (IX_OSAL_READ_LONG(qUOStatRegAddr) &
- ~overflowBitMask));
- *qStatus |= IX_QMGR_Q_STATUS_OF_BIT_MASK;
- }
-
- /* Check if the queue has underflowed */
- if (IX_OSAL_READ_LONG(qUOStatRegAddr) & underflowBitMask)
- {
- /* clear the underflow status bit if it was set */
- IX_OSAL_WRITE_LONG(qUOStatRegAddr,
- (IX_OSAL_READ_LONG(qUOStatRegAddr) &
- ~underflowBitMask));
- *qStatus |= IX_QMGR_Q_STATUS_UF_BIT_MASK;
- }
- }
- else /* read status of a queue in the range 32-63 */
- {
- extern UINT32 ixQMgrAqmIfQueUppStat0RegAddr;
- extern UINT32 ixQMgrAqmIfQueUppStat1RegAddr;
- extern UINT32 ixQMgrAqmIfQueUppStat0BitMask[];
- extern UINT32 ixQMgrAqmIfQueUppStat1BitMask[];
-
- volatile UINT32 *qNearEmptyStatRegAddr = (UINT32*)ixQMgrAqmIfQueUppStat0RegAddr;
- volatile UINT32 *qFullStatRegAddr = (UINT32*)ixQMgrAqmIfQueUppStat1RegAddr;
- int maskIndex = qId - IX_QMGR_MIN_QUEUPP_QID;
- UINT32 qNearEmptyStatBitMask = ixQMgrAqmIfQueUppStat0BitMask[maskIndex];
- UINT32 qFullStatBitMask = ixQMgrAqmIfQueUppStat1BitMask[maskIndex];
-
- /* Reset the status bits */
- *qStatus = 0;
-
- /* Check if the queue is nearly empty */
- if (IX_OSAL_READ_LONG(qNearEmptyStatRegAddr) & qNearEmptyStatBitMask)
- {
- *qStatus |= IX_QMGR_Q_STATUS_NE_BIT_MASK;
- }
-
- /* Check if the queue is full */
- if (IX_OSAL_READ_LONG(qFullStatRegAddr) & qFullStatBitMask)
- {
- *qStatus |= IX_QMGR_Q_STATUS_F_BIT_MASK;
- }
- }
- return IX_SUCCESS;
-}
-#endif /* def NO_INLINE_APIS */
diff --git a/cpu/ixp/npe/IxQMgrQCfg.c b/cpu/ixp/npe/IxQMgrQCfg.c
deleted file mode 100644
index ec7d837c38..0000000000
--- a/cpu/ixp/npe/IxQMgrQCfg.c
+++ /dev/null
@@ -1,543 +0,0 @@
-/**
- * @file QMgrQCfg.c
- *
- * @author Intel Corporation
- * @date 30-Oct-2001
- *
- * @brief This modules provides an interface for setting up the static
- * configuration of AQM queues.This file contains the following
- * functions:
- *
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/*
- * System defined include files.
- */
-
-/*
- * User defined include files.
- */
-#include "IxOsal.h"
-#include "IxQMgr.h"
-#include "IxQMgrAqmIf_p.h"
-#include "IxQMgrQCfg_p.h"
-#include "IxQMgrDefines_p.h"
-
-/*
- * #defines and macros used in this file.
- */
-
-#define IX_QMGR_MIN_ENTRY_SIZE_IN_WORDS 16
-
-/* Total size of SRAM */
-#define IX_QMGR_AQM_SRAM_SIZE_IN_BYTES 0x4000
-
-/*
- * Check that qId is a valid queue identifier. This is provided to
- * make the code easier to read.
- */
-#define IX_QMGR_QID_IS_VALID(qId) \
-(((qId) >= (IX_QMGR_MIN_QID)) && ((qId) <= (IX_QMGR_MAX_QID)))
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-/*
- * This struct describes an AQM queue.
- * N.b. bufferSizeInWords and qEntrySizeInWords are stored in the queue
- * as these are requested by Access in the data path. sizeInEntries is
- * not required by the data path so it can be calculated dynamically.
- *
- */
-typedef struct
-{
- char qName[IX_QMGR_MAX_QNAME_LEN+1]; /* Textual description of a queue*/
- IxQMgrQSizeInWords qSizeInWords; /* The number of words in the queue */
- IxQMgrQEntrySizeInWords qEntrySizeInWords; /* Number of words per queue entry*/
- BOOL isConfigured; /* This flag is TRUE if the queue has
- * been configured
- */
-} IxQMgrCfgQ;
-
-/*
- * Variable declarations global to this file. Externs are followed by
- * statics.
- */
-
-extern UINT32 * ixQMgrAqmIfQueAccRegAddr[];
-
-/* Store data required to inline read and write access
- */
-IxQMgrQInlinedReadWriteInfo ixQMgrQInlinedReadWriteInfo[IX_QMGR_MAX_NUM_QUEUES];
-
-static IxQMgrCfgQ cfgQueueInfo[IX_QMGR_MAX_NUM_QUEUES];
-
-/* This pointer holds the starting address of AQM SRAM not used by
- * the AQM queues.
- */
-static UINT32 freeSramAddress=0;
-
-/* 4 words of zeroed memory for inline access */
-static UINT32 zeroedPlaceHolder[4] = { 0, 0, 0, 0 };
-
-static BOOL cfgInitialized = FALSE;
-
-static IxOsalMutex ixQMgrQCfgMutex;
-
-/*
- * Statistics
- */
-static IxQMgrQCfgStats stats;
-
-/*
- * Function declarations
- */
-PRIVATE BOOL
-watermarkLevelIsOk (IxQMgrQId qId, IxQMgrWMLevel level);
-
-PRIVATE BOOL
-qSizeInWordsIsOk (IxQMgrQSizeInWords qSize);
-
-PRIVATE BOOL
-qEntrySizeInWordsIsOk (IxQMgrQEntrySizeInWords entrySize);
-
-/*
- * Function definitions.
- */
-void
-ixQMgrQCfgInit (void)
-{
- int loopIndex;
-
- for (loopIndex=0; loopIndex < IX_QMGR_MAX_NUM_QUEUES;loopIndex++)
- {
- /* info for code inlining */
- ixQMgrAqmIfQueAccRegAddr[loopIndex] = zeroedPlaceHolder;
-
- /* info for code inlining */
- ixQMgrQInlinedReadWriteInfo[loopIndex].qReadCount = 0;
- ixQMgrQInlinedReadWriteInfo[loopIndex].qWriteCount = 0;
- ixQMgrQInlinedReadWriteInfo[loopIndex].qAccRegAddr = zeroedPlaceHolder;
- ixQMgrQInlinedReadWriteInfo[loopIndex].qUOStatRegAddr = zeroedPlaceHolder;
- ixQMgrQInlinedReadWriteInfo[loopIndex].qUflowStatBitMask = 0;
- ixQMgrQInlinedReadWriteInfo[loopIndex].qOflowStatBitMask = 0;
- ixQMgrQInlinedReadWriteInfo[loopIndex].qEntrySizeInWords = 0;
- ixQMgrQInlinedReadWriteInfo[loopIndex].qSizeInEntries = 0;
- ixQMgrQInlinedReadWriteInfo[loopIndex].qConfigRegAddr = zeroedPlaceHolder;
- }
-
- /* Initialise the AqmIf component */
- ixQMgrAqmIfInit ();
-
- /* Reset all queues to have queue name = NULL, entry size = 0 and
- * isConfigured = false
- */
- for (loopIndex=0; loopIndex < IX_QMGR_MAX_NUM_QUEUES;loopIndex++)
- {
- strcpy (cfgQueueInfo[loopIndex].qName, "");
- cfgQueueInfo[loopIndex].qSizeInWords = 0;
- cfgQueueInfo[loopIndex].qEntrySizeInWords = 0;
- cfgQueueInfo[loopIndex].isConfigured = FALSE;
-
- /* Statistics */
- stats.qStats[loopIndex].isConfigured = FALSE;
- stats.qStats[loopIndex].qName = cfgQueueInfo[loopIndex].qName;
- }
-
- /* Statistics */
- stats.wmSetCnt = 0;
-
- ixQMgrAqmIfSramBaseAddressGet (&freeSramAddress);
-
- ixOsalMutexInit(&ixQMgrQCfgMutex);
-
- cfgInitialized = TRUE;
-}
-
-void
-ixQMgrQCfgUninit (void)
-{
- cfgInitialized = FALSE;
-
- /* Uninitialise the AqmIf component */
- ixQMgrAqmIfUninit ();
-}
-
-IX_STATUS
-ixQMgrQConfig (char *qName,
- IxQMgrQId qId,
- IxQMgrQSizeInWords qSizeInWords,
- IxQMgrQEntrySizeInWords qEntrySizeInWords)
-{
- UINT32 aqmLocalBaseAddress;
-
- if (!cfgInitialized)
- {
- return IX_FAIL;
- }
-
- if (!IX_QMGR_QID_IS_VALID(qId))
- {
- return IX_QMGR_INVALID_Q_ID;
- }
-
- else if (NULL == qName)
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
-
- else if (strlen (qName) > IX_QMGR_MAX_QNAME_LEN)
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
-
- else if (!qSizeInWordsIsOk (qSizeInWords))
- {
- return IX_QMGR_INVALID_QSIZE;
- }
-
- else if (!qEntrySizeInWordsIsOk (qEntrySizeInWords))
- {
- return IX_QMGR_INVALID_Q_ENTRY_SIZE;
- }
-
- else if (cfgQueueInfo[qId].isConfigured)
- {
- return IX_QMGR_Q_ALREADY_CONFIGURED;
- }
-
- ixOsalMutexLock(&ixQMgrQCfgMutex, IX_OSAL_WAIT_FOREVER);
-
- /* Write the config register */
- ixQMgrAqmIfQueCfgWrite (qId,
- qSizeInWords,
- qEntrySizeInWords,
- freeSramAddress);
-
-
- strcpy (cfgQueueInfo[qId].qName, qName);
- cfgQueueInfo[qId].qSizeInWords = qSizeInWords;
- cfgQueueInfo[qId].qEntrySizeInWords = qEntrySizeInWords;
-
- /* store pre-computed information in the same cache line
- * to facilitate inlining of QRead and QWrite functions
- * in IxQMgr.h
- */
- ixQMgrQInlinedReadWriteInfo[qId].qReadCount = 0;
- ixQMgrQInlinedReadWriteInfo[qId].qWriteCount = 0;
- ixQMgrQInlinedReadWriteInfo[qId].qEntrySizeInWords = qEntrySizeInWords;
- ixQMgrQInlinedReadWriteInfo[qId].qSizeInEntries =
- (UINT32)qSizeInWords / (UINT32)qEntrySizeInWords;
-
- /* Calculate the new freeSramAddress from the size of the queue
- * currently being configured.
- */
- freeSramAddress += (qSizeInWords * IX_QMGR_NUM_BYTES_PER_WORD);
-
- /* Get the virtual SRAM address */
- ixQMgrAqmIfBaseAddressGet (&aqmLocalBaseAddress);
-
- IX_OSAL_ASSERT((freeSramAddress - (aqmLocalBaseAddress + (IX_QMGR_QUEBUFFER_SPACE_OFFSET))) <=
- IX_QMGR_QUE_BUFFER_SPACE_SIZE);
-
- /* The queue is now configured */
- cfgQueueInfo[qId].isConfigured = TRUE;
-
- ixOsalMutexUnlock(&ixQMgrQCfgMutex);
-
-#ifndef NDEBUG
- /* Update statistics */
- stats.qStats[qId].isConfigured = TRUE;
- stats.qStats[qId].qName = cfgQueueInfo[qId].qName;
-#endif
- return IX_SUCCESS;
-}
-
-IxQMgrQSizeInWords
-ixQMgrQSizeInWordsGet (IxQMgrQId qId)
-{
- /* No parameter checking as this is used on the data path */
- return (cfgQueueInfo[qId].qSizeInWords);
-}
-
-IX_STATUS
-ixQMgrQSizeInEntriesGet (IxQMgrQId qId,
- unsigned *qSizeInEntries)
-{
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-
- if(NULL == qSizeInEntries)
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
-
- *qSizeInEntries = (UINT32)(cfgQueueInfo[qId].qSizeInWords) /
- (UINT32)cfgQueueInfo[qId].qEntrySizeInWords;
-
- return IX_SUCCESS;
-}
-
-IxQMgrQEntrySizeInWords
-ixQMgrQEntrySizeInWordsGet (IxQMgrQId qId)
-{
- /* No parameter checking as this is used on the data path */
- return (cfgQueueInfo[qId].qEntrySizeInWords);
-}
-
-IX_STATUS
-ixQMgrWatermarkSet (IxQMgrQId qId,
- IxQMgrWMLevel ne,
- IxQMgrWMLevel nf)
-{
- IxQMgrQStatus qStatusOnEntry;/* The queue status on entry/exit */
- IxQMgrQStatus qStatusOnExit; /* to this function */
-
- if (!ixQMgrQIsConfigured(qId))
- {
- return IX_QMGR_Q_NOT_CONFIGURED;
- }
-
- if (!watermarkLevelIsOk (qId, ne))
- {
- return IX_QMGR_INVALID_Q_WM;
- }
-
- if (!watermarkLevelIsOk (qId, nf))
- {
- return IX_QMGR_INVALID_Q_WM;
- }
-
- /* Get the current queue status */
- ixQMgrAqmIfQueStatRead (qId, &qStatusOnEntry);
-
-#ifndef NDEBUG
- /* Update statistics */
- stats.wmSetCnt++;
-#endif
-
- ixQMgrAqmIfWatermarkSet (qId,
- ne,
- nf);
-
- /* Get the current queue status */
- ixQMgrAqmIfQueStatRead (qId, &qStatusOnExit);
-
- /* If the status has changed return a warning */
- if (qStatusOnEntry != qStatusOnExit)
- {
- return IX_QMGR_WARNING;
- }
-
- return IX_SUCCESS;
-}
-
-IX_STATUS
-ixQMgrAvailableSramAddressGet (UINT32 *address,
- unsigned *sizeOfFreeRam)
-{
- UINT32 aqmLocalBaseAddress;
-
- if ((NULL == address)||(NULL == sizeOfFreeRam))
- {
- return IX_QMGR_PARAMETER_ERROR;
- }
- if (!cfgInitialized)
- {
- return IX_FAIL;
- }
-
- *address = freeSramAddress;
-
- /* Get the virtual SRAM address */
- ixQMgrAqmIfBaseAddressGet (&aqmLocalBaseAddress);
-
- /*
- * Calculate the size in bytes of free sram
- * i.e. current free SRAM virtual pointer from
- * (base + total size)
- */
- *sizeOfFreeRam =
- (aqmLocalBaseAddress +
- IX_QMGR_AQM_SRAM_SIZE_IN_BYTES) -
- freeSramAddress;
-
- if (0 == *sizeOfFreeRam)
- {
- return IX_QMGR_NO_AVAILABLE_SRAM;
- }
-
- return IX_SUCCESS;
-}
-
-BOOL
-ixQMgrQIsConfigured (IxQMgrQId qId)
-{
- if (!IX_QMGR_QID_IS_VALID(qId))
- {
- return FALSE;
- }
-
- return cfgQueueInfo[qId].isConfigured;
-}
-
-IxQMgrQCfgStats*
-ixQMgrQCfgStatsGet (void)
-{
- return &stats;
-}
-
-IxQMgrQCfgStats*
-ixQMgrQCfgQStatsGet (IxQMgrQId qId)
-{
- unsigned int ne;
- unsigned int nf;
- UINT32 baseAddress;
- UINT32 readPtr;
- UINT32 writePtr;
-
- stats.qStats[qId].qSizeInWords = cfgQueueInfo[qId].qSizeInWords;
- stats.qStats[qId].qEntrySizeInWords = cfgQueueInfo[qId].qEntrySizeInWords;
-
- if (IX_SUCCESS != ixQMgrQNumEntriesGet (qId, &stats.qStats[qId].numEntries))
- {
- if (IX_QMGR_WARNING != ixQMgrQNumEntriesGet (qId, &stats.qStats[qId].numEntries))
- {
- IX_QMGR_LOG_WARNING1("Failed to get the number of entries in queue.... %d\n", qId);
- }
- }
-
- ixQMgrAqmIfQueCfgRead (qId,
- stats.qStats[qId].numEntries,
- &baseAddress,
- &ne,
- &nf,
- &readPtr,
- &writePtr);
-
- stats.qStats[qId].baseAddress = baseAddress;
- stats.qStats[qId].ne = ne;
- stats.qStats[qId].nf = nf;
- stats.qStats[qId].readPtr = readPtr;
- stats.qStats[qId].writePtr = writePtr;
-
- return &stats;
-}
-
-/*
- * Static function definitions
- */
-
-PRIVATE BOOL
-watermarkLevelIsOk (IxQMgrQId qId, IxQMgrWMLevel level)
-{
- unsigned qSizeInEntries;
-
- switch (level)
- {
- case IX_QMGR_Q_WM_LEVEL0:
- case IX_QMGR_Q_WM_LEVEL1:
- case IX_QMGR_Q_WM_LEVEL2:
- case IX_QMGR_Q_WM_LEVEL4:
- case IX_QMGR_Q_WM_LEVEL8:
- case IX_QMGR_Q_WM_LEVEL16:
- case IX_QMGR_Q_WM_LEVEL32:
- case IX_QMGR_Q_WM_LEVEL64:
- break;
- default:
- return FALSE;
- }
-
- /* Check watermark is not bigger than the qSizeInEntries */
- ixQMgrQSizeInEntriesGet(qId, &qSizeInEntries);
-
- if ((unsigned)level > qSizeInEntries)
- {
- return FALSE;
- }
-
- return TRUE;
-}
-
-PRIVATE BOOL
-qSizeInWordsIsOk (IxQMgrQSizeInWords qSize)
-{
- BOOL status;
-
- switch (qSize)
- {
- case IX_QMGR_Q_SIZE16:
- case IX_QMGR_Q_SIZE32:
- case IX_QMGR_Q_SIZE64:
- case IX_QMGR_Q_SIZE128:
- status = TRUE;
- break;
- default:
- status = FALSE;
- break;
- }
-
- return status;
-}
-
-PRIVATE BOOL
-qEntrySizeInWordsIsOk (IxQMgrQEntrySizeInWords entrySize)
-{
- BOOL status;
-
- switch (entrySize)
- {
- case IX_QMGR_Q_ENTRY_SIZE1:
- case IX_QMGR_Q_ENTRY_SIZE2:
- case IX_QMGR_Q_ENTRY_SIZE4:
- status = TRUE;
- break;
- default:
- status = FALSE;
- break;
- }
-
- return status;
-}
diff --git a/cpu/ixp/npe/Makefile b/cpu/ixp/npe/Makefile
deleted file mode 100644
index 4de34fd5b9..0000000000
--- a/cpu/ixp/npe/Makefile
+++ /dev/null
@@ -1,100 +0,0 @@
-#
-# (C) Copyright 2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB := $(obj)libnpe.a
-
-LOCAL_CFLAGS += -I$(TOPDIR)/cpu/ixp/npe/include -DCONFIG_IXP425_COMPONENT_ETHDB
-CFLAGS += $(LOCAL_CFLAGS)
-HOST_CFLAGS += $(LOCAL_CFLAGS)
-
-COBJS := npe.o \
- miiphy.o \
- IxOsalBufferMgt.o \
- IxOsalIoMem.o \
- IxOsalOsCacheMMU.o \
- IxOsalOsMsgQ.o \
- IxOsalOsSemaphore.o \
- IxOsalOsServices.o \
- IxOsalOsThread.o \
- IxEthAcc.o \
- IxEthAccCommon.o \
- IxEthAccControlInterface.o \
- IxEthAccDataPlane.o \
- IxEthAccMac.o \
- IxEthAccMii.o \
- IxEthDBAPI.o \
- IxEthDBAPISupport.o \
- IxEthDBCore.o \
- IxEthDBEvents.o \
- IxEthDBFeatures.o \
- IxEthDBFirewall.o \
- IxEthDBHashtable.o \
- IxEthDBLearning.o \
- IxEthDBMem.o \
- IxEthDBNPEAdaptor.o \
- IxEthDBPortUpdate.o \
- IxEthDBReports.o \
- IxEthDBSearch.o \
- IxEthDBSpanningTree.o \
- IxEthDBUtil.o \
- IxEthDBVlan.o \
- IxEthDBWiFi.o \
- IxEthMii.o \
- IxQMgrAqmIf.o \
- IxQMgrDispatcher.o \
- IxQMgrInit.o \
- IxQMgrQAccess.o \
- IxQMgrQCfg.o \
- IxFeatureCtrl.o \
- IxNpeDl.o \
- IxNpeDlImageMgr.o \
- IxNpeDlNpeMgr.o \
- IxNpeDlNpeMgrUtils.o \
- IxNpeMicrocode.o \
- IxNpeMh.o \
- IxNpeMhConfig.o \
- IxNpeMhReceive.o \
- IxNpeMhSend.o \
- IxNpeMhSolicitedCbMgr.o \
- IxNpeMhUnsolicitedCbMgr.o
-
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(LIB)
-
-$(LIB): $(obj).depend $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/ixp/npe/include/IxAssert.h b/cpu/ixp/npe/include/IxAssert.h
deleted file mode 100644
index eae8b3f273..0000000000
--- a/cpu/ixp/npe/include/IxAssert.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * @file IxAssert.h
- *
- * @date 21-MAR-2002 (replaced by OSAL)
- *
- * @brief This file contains assert and ensure macros used by the IXP400 software
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxAssert IXP400 Assertion Macros (IxAssert) API
- *
- * @brief Assertion support
- *
- * @{
- */
-
-#ifndef IXASSERT_H
-
-#ifndef __doxygen_HIDE
-#define IXASSERT_H
-#endif /* __doxygen_HIDE */
-
-#include "IxOsalBackward.h"
-
-#endif /* IXASSERT_H */
-
-/**
- * @} addtogroup IxAssert
- */
-
-
-
diff --git a/cpu/ixp/npe/include/IxAtmSch.h b/cpu/ixp/npe/include/IxAtmSch.h
deleted file mode 100644
index 73c3be29ab..0000000000
--- a/cpu/ixp/npe/include/IxAtmSch.h
+++ /dev/null
@@ -1,504 +0,0 @@
-/**
- * @file IxAtmSch.h
- *
- * @date 23-NOV-2001
- *
- * @brief Header file for the IXP400 ATM Traffic Shaper
- *
- * This component demonstrates an ATM Traffic Shaper implementation. It
- * will perform shaping on upto 12 ports and total of 44 VCs accross all ports,
- * 32 are intended for AAL0/5 and 12 for OAM (1 per port).
- * The supported traffic types are;1 rt-VBR VC where PCR = SCR.
- * (Effectively CBR) and Up-to 44 VBR VCs.
- *
- * This component models the ATM ports and VCs and is capable of producing
- * a schedule of ATM cells per port which can be supplied to IxAtmdAcc
- * for execution on the data path.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- *
- * @sa IxAtmm.h
- *
- */
-
-/**
- * @defgroup IxAtmSch IXP400 ATM Transmit Scheduler (IxAtmSch) API
- *
- * @brief IXP400 ATM scheduler component Public API
- *
- * @{
- */
-
-#ifndef IXATMSCH_H
-#define IXATMSCH_H
-
-#include "IxOsalTypes.h"
-#include "IxAtmTypes.h"
-
-/*
- * #defines and macros used in this file.
- */
-
-/* Return codes */
-
-/**
- * @ingroup IxAtmSch
- *
- * @def IX_ATMSCH_RET_NOT_ADMITTED
- * @brief Indicates that CAC function has rejected VC registration due
- * to insufficient line capacity.
-*/
-#define IX_ATMSCH_RET_NOT_ADMITTED 2
-
-/**
- * @ingroup IxAtmSch
- *
- * @def IX_ATMSCH_RET_QUEUE_FULL
- * @brief Indicates that the VC queue is full, no more demand can be
- * queued at this time.
- */
-#define IX_ATMSCH_RET_QUEUE_FULL 3
-
-/**
- * @ingroup IxAtmSch
- *
- * @def IX_ATMSCH_RET_QUEUE_EMPTY
- * @brief Indicates that all VC queues on this port are empty and
- * therefore there are no cells to be scheduled at this time.
- */
-#define IX_ATMSCH_RET_QUEUE_EMPTY 4
-
-/*
- * Function declarations
- */
-
-/**
- * @ingroup IxAtmSch
- *
- * @fn ixAtmSchInit(void)
- *
- * @brief This function is used to initialize the ixAtmSch component. It
- * should be called before any other IxAtmSch API function.
- *
- * @param None
- *
- * @return
- * - <b>IX_SUCCESS :</b> indicates that
- * -# The ATM scheduler component has been successfully initialized.
- * -# The scheduler is ready to accept Port modelling requests.
- * - <b>IX_FAIL :</b> Some internal error has prevented the scheduler component
- * from initialising.
- */
-PUBLIC IX_STATUS
-ixAtmSchInit(void);
-
-/**
- * @ingroup IxAtmSch
- *
- * @fn ixAtmSchPortModelInitialize( IxAtmLogicalPort port,
- unsigned int portRate,
- unsigned int minCellsToSchedule)
- *
- * @brief This function shall be called first to initialize an ATM port before
- * any other ixAtmSch API calls may be made for that port.
- *
- * @param port @ref IxAtmLogicalPort [in] - The specific port to initialize. Valid
- * values range from 0 to IX_UTOPIA_MAX_PORTS - 1, representing a
- * maximum of IX_UTOPIA_MAX_PORTS possible ports.
- *
- * @param portRate unsigned int [in] - Value indicating the upstream capacity
- * of the indicated port. The value should be supplied in
- * units of ATM (53 bytes) cells per second.
- * A port rate of 800Kbits/s is the equivalent
- * of 1886 cells per second
- *
- * @param minCellsToSchedule unsigned int [in] - This parameter specifies the minimum
- * number of cells which the scheduler will put in a schedule
- * table for this port. This value sets the worst case CDVT for VCs
- * on this port i.e. CDVT = 1*minCellsToSchedule/portRate.
- * @return
- * - <b>IX_SUCCESS :</b> indicates that
- * -# The ATM scheduler has been successfully initialized.
- * -# The requested port model has been established.
- * -# The scheduler is ready to accept VC modelling requests
- * on the ATM port.
- * - <b>IX_FAIL :</b> indicates the requested port could not be
- * initialized. */
-PUBLIC IX_STATUS
-ixAtmSchPortModelInitialize( IxAtmLogicalPort port,
- unsigned int portRate,
- unsigned int minCellsToSchedule);
-
-/**
- * @ingroup IxAtmSch
- *
- * @fn ixAtmSchPortRateModify( IxAtmLogicalPort port,
- unsigned int portRate)
- *
- * @brief This function is called to modify the portRate on a
- * previously initialized port, typically in the event that
- * the line condition of the port changes.
- *
- * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port which is to be
- * modified.
- *
- * @param portRate unsigned int [in] - Value indicating the new upstream
- * capacity for this port in cells/second.
- * A port rate of 800Kbits/s is the equivalent
- * of 1886 cells per second
- *
- * @return
- * - <b>IX_SUCCESS :</b> The port rate has been successfully modified.<br>
- * - <b>IX_FAIL :</b> The port rate could not be modified, either
- * because the input data was invalid, or the new port rate is
- * insufficient to support established ATM VC contracts on this
- * port.
- *
- * @warning The IxAtmSch component will validate the supplied port
- * rate is sufficient to support all established VC
- * contracts on the port. If the new port rate is
- * insufficient to support all established contracts then
- * the request to modify the port rate will be rejected.
- * In this event, the user is expected to remove
- * established contracts using the ixAtmSchVcModelRemove
- * interface and then retry this interface.
- *
- * @sa ixAtmSchVcModelRemove() */
-PUBLIC IX_STATUS
-ixAtmSchPortRateModify( IxAtmLogicalPort port,
- unsigned int portRate);
-
-
-/**
- * @ingroup IxAtmSch
- *
- * @fn ixAtmSchVcModelSetup( IxAtmLogicalPort port,
- IxAtmTrafficDescriptor *trafficDesc,
- IxAtmSchedulerVcId *vcId)
- *
- * @brief A client calls this interface to set up an upstream
- * (transmitting) virtual connection model (VC) on the
- * specified ATM port. This function also provides the
- * virtual * connection admission control (CAC) service to the
- * client.
- *
- * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the upstream
- * VC is to be established.
- *
- * @param *trafficDesc @ref IxAtmTrafficDescriptor [in] - Pointer to a structure
- * describing the requested traffic contract of the VC to be
- * established. This structure contains the typical ATM
- * traffic descriptor values (e.g. PCR, SCR, MBS, CDVT, etc.)
- * defined by the ATM standard.
- *
- * @param *vcId @ref IxAtmSchedulerVcId [out] - This value will be filled with the
- * port-unique identifier for this virtual connection. A
- * valid identification is a non-negative number.
- *
- * @return
- * - <b>IX_SUCCESS :</b> The VC has been successfully established on
- * this port. The client may begin to submit demand on this VC.
- * - <b>IX_ATMSCH_RET_NOT_ADMITTED :</b> The VC cannot be established
- * on this port because there is insufficient upstream capacity
- * available to support the requested traffic contract descriptor
- * - <b>IX_FAIL :</b>Input data are invalid. VC has not been
- * established.
- */
-PUBLIC IX_STATUS
-ixAtmSchVcModelSetup( IxAtmLogicalPort port,
- IxAtmTrafficDescriptor *trafficDesc,
- IxAtmSchedulerVcId *vcId);
-
-/**
- * @ingroup IxAtmSch
- *
- * @fn ixAtmSchVcConnIdSet( IxAtmLogicalPort port,
- IxAtmSchedulerVcId vcId,
- IxAtmConnId vcUserConnId)
- *
- * @brief A client calls this interface to set the vcUserConnId for a VC on
- * the specified ATM port. This vcUserConnId will default to
- * IX_ATM_IDLE_CELLS_CONNID if this function is not called for a VC.
- * Hence if the client does not call this function for a VC then only idle
- * cells will be scheduled for this VC.
- *
- * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the upstream
- * VC is has been established.
- *
- * @param vcId @ref IxAtmSchedulerVcId [in] - This is the unique identifier for this virtual
- * connection. A valid identification is a non-negative number and is
- * all ports.
- *
- * @param vcUserConnId @ref IxAtmConnId [in] - The connId is used to refer to a VC in schedule
- * table entries. It is treated as the Id by which the scheduler client
- * knows the VC. It is used in any communicatations from the Scheduler
- * to the scheduler user e.g. schedule table entries.
- *
- * @return
- * - <b>IX_SUCCESS :</b> The id has successfully been set.
- * - <b>IX_FAIL :</b>Input data are invalid. connId id is not established.
- */
-PUBLIC IX_STATUS
-ixAtmSchVcConnIdSet( IxAtmLogicalPort port,
- IxAtmSchedulerVcId vcId,
- IxAtmConnId vcUserConnId);
-
-/**
- * @ingroup IxAtmSch
- *
- * @fn ixAtmSchVcModelRemove( IxAtmLogicalPort port,
- IxAtmSchedulerVcId vcId)
- *
- * @brief Interface called by the client to remove a previously
- * established VC on a particular port.
- *
- * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the VC to be
- * removed is established.
- *
- * @param vcId @ref IxAtmSchedulerVcId [in] - Identifies the VC to be removed. This is the
- * value returned by the @ref ixAtmSchVcModelSetup call which
- * established the relevant VC.
- *
- * @return
- * - <b>IX_SUCCESS :</b> The VC has been successfully removed from
- * this port. It is no longer modelled on this port.
- * - <b>IX_FAIL :</b>Input data are invalid. The VC is still being modeled
- * by the traffic shaper.
- *
- * @sa ixAtmSchVcModelSetup()
- */
-PUBLIC IX_STATUS
-ixAtmSchVcModelRemove( IxAtmLogicalPort port,
- IxAtmSchedulerVcId vcId);
-
-/**
- * @ingroup IxAtmSch
- *
- * @fn ixAtmSchVcQueueUpdate( IxAtmLogicalPort port,
- IxAtmSchedulerVcId vcId,
- unsigned int numberOfCells)
- *
- * @brief The client calls this function to notify IxAtmSch that the
- * user of a VC has submitted cells for transmission.
- *
- * This information is stored, aggregated from a number of calls to
- * ixAtmSchVcQueueUpdate and eventually used in the call to
- * ixAtmSchTableUpdate.
- *
- * Normally IxAtmSch will update the VC queue by adding the number of
- * cells to the current queue length. However, if IxAtmSch
- * determines that the user has over-submitted for the VC and
- * exceeded its transmission quota the queue request can be rejected.
- * The user should resubmit the request later when the queue has been
- * depleted.
- *
- * This implementation of ixAtmSchVcQueueUpdate uses no operating
- * system or external facilities, either directly or indirectly.
- * This allows clients to call this function form within an interrupt handler.
- *
- * This interface is structurally compatible with the
- * IxAtmdAccSchQueueUpdate callback type definition required for
- * IXP400 ATM scheduler interoperability.
- *
- * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the VC to be
- * updated is established.
- *
- * @param vcId @ref IxAtmSchedulerVcId [in] - Identifies the VC to be updated. This is the
- * value returned by the @ref ixAtmSchVcModelSetup call which
- * established the relevant VC.
- *
- * @param numberOfCells unsigned int [in] - Indicates how many ATM cells should
- * be added to the queue for this VC.
- *
- * @return
- * - <b>IX_SUCCESS :</b> The VC queue has been successfully updated.
- * - <b>IX_ATMSCH_RET_QUEUE_FULL :</b> The VC queue has reached a
- * preset limit. This indicates the client has over-submitted
- * and exceeded its transmission quota. The request is
- * rejected. The VC queue is not updated. The VC user is
- * advised to resubmit the request later.
- * - <b>IX_FAIL :</b> The input are invalid. No VC queue is updated.
- *
- * @warning IxAtmSch assumes that the calling software ensures that
- * calls to ixAtmSchVcQueueUpdate, ixAtmSchVcQueueClear and
- * ixAtmSchTableUpdate are both self and mutually exclusive
- * for the same port.
- *
- * @sa ixAtmSchVcQueueUpdate(), ixAtmSchVcQueueClear(), ixAtmSchTableUpdate(). */
-PUBLIC IX_STATUS
-ixAtmSchVcQueueUpdate( IxAtmLogicalPort port,
- IxAtmSchedulerVcId vcId,
- unsigned int numberOfCells);
-
-/**
- * @ingroup IxAtmSch
- *
- * @fn ixAtmSchVcQueueClear( IxAtmLogicalPort port,
- IxAtmSchedulerVcId vcId)
- *
- * @brief The client calls this function to remove all currently
- * queued cells from a registered VC. The pending cell count
- * for the specified VC is reset to zero.
- *
- * This interface is structurally compatible with the
- * IxAtmdAccSchQueueClear callback type definition required for
- * IXP400 ATM scheduler interoperability.
- *
- * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the VC to be
- * cleared is established.
- *
- * @param vcId @ref IxAtmSchedulerVcId [in] - Identifies the VC to be cleared. This is the
- * value returned by the @ref ixAtmSchVcModelSetup call which
- * established the relevant VC.
- *
- * @return
- * - <b>IX_SUCCESS :</b> The VC queue has been successfully cleared.
- * - <b>IX_FAIL :</b> The input are invalid. No VC queue is modified.
- *
- * @warning IxAtmSch assumes that the calling software ensures that
- * calls to ixAtmSchVcQueueUpdate, ixAtmSchVcQueueClear and
- * ixAtmSchTableUpdate are both self and mutually exclusive
- * for the same port.
- *
- * @sa ixAtmSchVcQueueUpdate(), ixAtmSchVcQueueClear(), ixAtmSchTableUpdate(). */
-PUBLIC IX_STATUS
-ixAtmSchVcQueueClear( IxAtmLogicalPort port,
- IxAtmSchedulerVcId vcId);
-
-/**
- * @ingroup IxAtmSch
- *
- * @fn ixAtmSchTableUpdate( IxAtmLogicalPort port,
- unsigned int maxCells,
- IxAtmScheduleTable **rettable)
- *
- * @brief The client calls this function to request an update of the
- * schedule table for a particular ATM port.
- *
- * This is called when the client decides it needs a new sequence of
- * cells to send (probably because the transmit queue is near to
- * empty for this ATM port). The scheduler will use its stored
- * information on the cells submitted for transmit (i.e. data
- * supplied via @ref ixAtmSchVcQueueUpdate function) with the traffic
- * descriptor information of all established VCs on the ATM port to
- * decide the sequence of cells to be sent and fill the schedule
- * table for a period of time into the future.
- *
- * IxAtmSch will guarantee a minimum of minCellsToSchedule if there
- * is at least one cell ready to send. If there are no cells then
- * IX_ATMSCH_RET_QUEUE_EMPTY is returned.
- *
- * This implementation of ixAtmSchTableUpdate uses no operating
- * system or external facilities, either directly or indirectly.
- * This allows clients to call this function form within an FIQ
- * interrupt handler.
- *
- * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port for which requested
- * schedule table is to be generated.
- *
- * @param maxCells unsigned [in] - Specifies the maximum number of cells
- * that must be scheduled in the supplied table during any
- * call to the interface.
- *
- * @param **table @ref IxAtmScheduleTable [out] - A pointer to an area of
- * storage is returned which contains the generated
- * schedule table. The client should not modify the
- * contents of this table.
- *
- * @return
- * - <b>IX_SUCCESS :</b> The schedule table has been published.
- * Currently there is at least one VC queue that is nonempty.
- * - <b>IX_ATMSCH_RET_QUEUE_EMPTY :</b> Currently all VC queues on
- * this port are empty. The schedule table returned is set to
- * NULL. The client is not expected to invoke this function
- * again until more cells have been submitted on this port
- * through the @ref ixAtmSchVcQueueUpdate function.
- * - <b>IX_FAIL :</b> The input are invalid. No action is taken.
- *
- * @warning IxAtmSch assumes that the calling software ensures that
- * calls to ixAtmSchVcQueueUpdate, ixAtmSchVcQueueClear and
- * ixAtmSchTableUpdate are both self and mutually exclusive
- * for the same port.
- *
- * @warning Subsequent calls to this function for the same port will
- * overwrite the contents of previously supplied schedule
- * tables. The client must be completely finished with the
- * previously supplied schedule table before calling this
- * function again for the same port.
- *
- * @sa ixAtmSchVcQueueUpdate(), ixAtmSchVcQueueClear(), ixAtmSchTableUpdate(). */
-PUBLIC IX_STATUS
-ixAtmSchTableUpdate( IxAtmLogicalPort port,
- unsigned int maxCells,
- IxAtmScheduleTable **rettable);
-
-/**
- * @ingroup IxAtmSch
- *
- * @fn ixAtmSchShow(void)
- *
- * @brief Utility function which will print statistics on the current
- * and accumulated state of VCs and traffic in the ATM
- * scheduler component. Output is sent to the default output
- * device.
- *
- * @param none
- * @return none
- */
-PUBLIC void
-ixAtmSchShow(void);
-
-/**
- * @ingroup IxAtmSch
- *
- * @fn ixAtmSchStatsClear(void)
- *
- * @brief Utility function which will reset all counter statistics in
- * the ATM scheduler to zero.
- *
- * @param none
- * @return none
- */
-PUBLIC void
-ixAtmSchStatsClear(void);
-
-#endif
-/* IXATMSCH_H */
-
-/** @} */
diff --git a/cpu/ixp/npe/include/IxAtmTypes.h b/cpu/ixp/npe/include/IxAtmTypes.h
deleted file mode 100644
index 8624c3328e..0000000000
--- a/cpu/ixp/npe/include/IxAtmTypes.h
+++ /dev/null
@@ -1,409 +0,0 @@
-/**
- * @file IxAtmTypes.h
- *
- * @date 24-MAR-2002
- *
- * @brief This file contains Atm types common to a number of Atm components.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/* ------------------------------------------------------
- Doxygen group definitions
- ------------------------------------------------------ */
-/**
- * @defgroup IxAtmTypes IXP400 ATM Types (IxAtmTypes)
- *
- * @brief The common set of types used in many Atm components
- *
- * @{ */
-
-#ifndef IXATMTYPES_H
-#define IXATMTYPES_H
-
-#include "IxNpeA.h"
-
-/**
- * @enum IxAtmLogicalPort
- *
- * @brief Logical Port Definitions :
- *
- * Only 1 port is available in SPHY configuration
- * 12 ports are enabled in MPHY configuration
- *
- */
-typedef enum
-{
- IX_UTOPIA_PORT_0 = 0, /**< Port 0 */
-#ifdef IX_NPE_MPHYMULTIPORT
- IX_UTOPIA_PORT_1, /**< Port 1 */
- IX_UTOPIA_PORT_2, /**< Port 2 */
- IX_UTOPIA_PORT_3, /**< Port 3 */
- IX_UTOPIA_PORT_4, /**< Port 4 */
- IX_UTOPIA_PORT_5, /**< Port 5 */
- IX_UTOPIA_PORT_6, /**< Port 6 */
- IX_UTOPIA_PORT_7, /**< Port 7 */
- IX_UTOPIA_PORT_8, /**< Port 8 */
- IX_UTOPIA_PORT_9, /**< Port 9 */
- IX_UTOPIA_PORT_10, /**< Port 10 */
- IX_UTOPIA_PORT_11, /**< Port 11 */
-#endif /* IX_NPE_MPHY */
- IX_UTOPIA_MAX_PORTS /**< Not a port - just a definition for the
- * maximum possible ports
- */
-} IxAtmLogicalPort;
-
-/**
- * @def IX_ATM_CELL_PAYLOAD_SIZE
- * @brief Size of a ATM cell payload
- */
-#define IX_ATM_CELL_PAYLOAD_SIZE (48)
-
-/**
- * @def IX_ATM_CELL_SIZE
- * @brief Size of a ATM cell, including header
- */
-#define IX_ATM_CELL_SIZE (53)
-
-/**
- * @def IX_ATM_CELL_SIZE_NO_HEC
- * @brief Size of a ATM cell, excluding HEC byte
- */
-#define IX_ATM_CELL_SIZE_NO_HEC (IX_ATM_CELL_SIZE - 1)
-
-/**
- * @def IX_ATM_OAM_CELL_SIZE_NO_HEC
- * @brief Size of a OAM cell, excluding HEC byte
- */
-#define IX_ATM_OAM_CELL_SIZE_NO_HEC IX_ATM_CELL_SIZE_NO_HEC
-
-/**
- * @def IX_ATM_AAL0_48_CELL_PAYLOAD_SIZE
- * @brief Size of a AAL0 48 Cell payload
- */
-#define IX_ATM_AAL0_48_CELL_PAYLOAD_SIZE IX_ATM_CELL_PAYLOAD_SIZE
-
-/**
- * @def IX_ATM_AAL5_CELL_PAYLOAD_SIZE
- * @brief Size of a AAL5 Cell payload
- */
-#define IX_ATM_AAL5_CELL_PAYLOAD_SIZE IX_ATM_CELL_PAYLOAD_SIZE
-
-/**
- * @def IX_ATM_AAL0_52_CELL_SIZE_NO_HEC
- * @brief Size of a AAL0 52 Cell, excluding HEC byte
- */
-#define IX_ATM_AAL0_52_CELL_SIZE_NO_HEC IX_ATM_CELL_SIZE_NO_HEC
-
-
-/**
- * @def IX_ATM_MAX_VPI
- * @brief Maximum value of an ATM VPI
- */
-#define IX_ATM_MAX_VPI 255
-
-/**
- * @def IX_ATM_MAX_VCI
- * @brief Maximum value of an ATM VCI
- */
-#define IX_ATM_MAX_VCI 65535
-
- /**
- * @def IX_ATM_MAX_NUM_AAL_VCS
- * @brief Maximum number of active AAL5/AAL0 VCs in the system
- */
-#define IX_ATM_MAX_NUM_AAL_VCS 32
-
-/**
- * @def IX_ATM_MAX_NUM_VC
- * @brief Maximum number of active AAL5/AAL0 VCs in the system
- * The use of this macro is depreciated, it is retained for
- * backward compatiblity. For current software release
- * and beyond the define IX_ATM_MAX_NUM_AAL_VC should be used.
- */
-#define IX_ATM_MAX_NUM_VC IX_ATM_MAX_NUM_AAL_VCS
-
-
-
-/**
- * @def IX_ATM_MAX_NUM_OAM_TX_VCS
- * @brief Maximum number of active OAM Tx VCs in the system,
- * 1 OAM VC per port
- */
-#define IX_ATM_MAX_NUM_OAM_TX_VCS IX_UTOPIA_MAX_PORTS
-
-/**
- * @def IX_ATM_MAX_NUM_OAM_RX_VCS
- * @brief Maximum number of active OAM Rx VCs in the system,
- * 1 OAM VC shared accross all ports
- */
-#define IX_ATM_MAX_NUM_OAM_RX_VCS 1
-
-/**
- * @def IX_ATM_MAX_NUM_AAL_OAM_TX_VCS
- * @brief Maximum number of active AAL5/AAL0/OAM Tx VCs in the system
- */
-#define IX_ATM_MAX_NUM_AAL_OAM_TX_VCS (IX_ATM_MAX_NUM_AAL_VCS + IX_ATM_MAX_NUM_OAM_TX_VCS)
-
-/**
- * @def IX_ATM_MAX_NUM_AAL_OAM_RX_VCS
- * @brief Maximum number of active AAL5/AAL0/OAM Rx VCs in the system
- */
-#define IX_ATM_MAX_NUM_AAL_OAM_RX_VCS (IX_ATM_MAX_NUM_AAL_VCS + IX_ATM_MAX_NUM_OAM_RX_VCS)
-
-/**
- * @def IX_ATM_IDLE_CELLS_CONNID
- * @brief VC Id used to indicate idle cells in the returned schedule table.
- */
-#define IX_ATM_IDLE_CELLS_CONNID 0
-
-
-/**
- * @def IX_ATM_CELL_HEADER_VCI_GET
- * @brief get the VCI field from a cell header
- */
-#define IX_ATM_CELL_HEADER_VCI_GET(cellHeader) \
- (((cellHeader) >> 4) & IX_OAM_VCI_BITS_MASK);
-
-/**
- * @def IX_ATM_CELL_HEADER_VPI_GET
- * @brief get the VPI field from a cell header
- */
-#define IX_ATM_CELL_HEADER_VPI_GET(cellHeader) \
- (((cellHeader) >> 20) & IX_OAM_VPI_BITS_MASK);
-
-/**
- * @def IX_ATM_CELL_HEADER_PTI_GET
- * @brief get the PTI field from a cell header
- */
-#define IX_ATM_CELL_HEADER_PTI_GET(cellHeader) \
- ((cellHeader) >> 1) & IX_OAM_PTI_BITS_MASK;
-
-/**
- * @typedef IxAtmCellHeader
- *
- * @brief ATM Cell Header, does not contain 4 byte HEC, added by NPE-A
- */
-typedef unsigned int IxAtmCellHeader;
-
-
-/**
- * @enum IxAtmServiceCategory
- *
- * @brief Enumerated type representing available ATM service categories.
- * For more informatoin on these categories, see "Traffic Management
- * Specification" v4.1, published by the ATM Forum -
- * http://www.atmforum.com
- */
-typedef enum
-{
- IX_ATM_CBR, /**< Constant Bit Rate */
- IX_ATM_RTVBR, /**< Real Time Variable Bit Rate */
- IX_ATM_VBR, /**< Variable Bit Rate */
- IX_ATM_UBR, /**< Unspecified Bit Rate */
- IX_ATM_ABR /**< Available Bit Rate (not supported) */
-
-} IxAtmServiceCategory;
-
-/**
- *
- * @enum IxAtmRxQueueId
- *
- * @brief Rx Queue Type for RX traffic
- *
- * IxAtmRxQueueId defines the queues involved for receiving data.
- *
- * There are two queues to facilitate prioritisation handling
- * and processing the 2 queues with different algorithms and
- * constraints
- *
- * e.g. : one queue can carry voice (or time-critical traffic), the
- * other queue can carry non-voice traffic
- *
- */
-typedef enum
-{
- IX_ATM_RX_A = 0, /**< RX queue A */
- IX_ATM_RX_B, /**< RX queue B */
- IX_ATM_MAX_RX_STREAMS /**< Maximum number of RX streams */
-} IxAtmRxQueueId;
-
-/**
- * @brief Structure describing an ATM traffic contract for a Virtual
- * Connection (VC).
- *
- * Structure is used to specify the requested traffic contract for a
- * VC to the IxAtmSch component using the @ref ixAtmSchVcModelSetup
- * interface.
- *
- * These parameters are defined by the ATM forum working group
- * (http://www.atmforum.com).
- *
- * @note Typical values for a voice channel 64 Kbit/s
- * - atmService @a IX_ATM_RTVBR
- * - pcr 400 (include IP overhead, and AAL5 trailer)
- * - cdvt 5000000 (5 ms)
- * - scr = pcr
- *
- * @note Typical values for a data channel 800 Kbit/s
- * - atmService @a IX_ATM_UBR
- * - pcr 1962 (include IP overhead, and AAL5 trailer)
- * - cdvt 5000000 (5 ms)
- *
- */
-typedef struct
-{
- IxAtmServiceCategory atmService; /**< ATM service category */
- unsigned pcr; /**< Peak Cell Rate - cells per second */
- unsigned cdvt; /**< Cell Delay Variation Tolerance - in nanoseconds */
- unsigned scr; /**< Sustained Cell Rate - cells per second */
- unsigned mbs; /**< Max Burst Size - cells */
- unsigned mcr; /**< Minimum Cell Rate - cells per second */
- unsigned mfs; /**< Max Frame Size - cells */
-} IxAtmTrafficDescriptor;
-
-/**
- * @typedef IxAtmConnId
- *
- * @brief ATM VC data connection identifier.
- *
- * This is is generated by IxAtmdAcc when a successful connection is
- * made on a VC. The is the ID by which IxAtmdAcc knows an active
- * VC and should be used in IxAtmdAcc API calls to reference a
- * specific VC.
- */
-typedef unsigned int IxAtmConnId;
-
-/**
- * @typedef IxAtmSchedulerVcId
- *
- * @brief ATM VC scheduling connection identifier.
- *
- * This id is generated and used by ATM Tx controller, generally
- * the traffic shaper (e.g. IxAtmSch). The IxAtmdAcc component
- * will request one of these Ids whenever a data connection on
- * a Tx VC is requested. This ID will be used in callbacks to
- * the ATM Transmission Ctrl s/w (e.g. IxAtmm) to reference a
- * particular VC.
- */
-typedef int IxAtmSchedulerVcId;
-
-/**
- * @typedef IxAtmNpeRxVcId
- *
- * @brief ATM Rx VC identifier used by the ATM Npe.
- *
- * This Id is generated by IxAtmdAcc when a successful data connection
- * is made on a rx VC.
- */
-typedef unsigned int IxAtmNpeRxVcId;
-
-/**
- * @brief ATM Schedule Table entry
- *
- * This IxAtmScheduleTableEntry is used by an ATM scheduler to inform
- * IxAtmdAcc about the data to transmit (in term of cells per VC)
- *
- * This structure defines
- * @li the number of cells to be transmitted (numberOfCells)
- * @li the VC connection to be used for transmission (connId).
- *
- * @note - When the connection Id value is IX_ATM_IDLE_CELLS_CONNID, the
- * corresponding number of idle cells will be transmitted to the hardware.
- *
- */
-typedef struct
-{
- IxAtmConnId connId; /**< connection Id
- *
- * Identifier of VC from which cells are to be transmitted.
- * When this valus is IX_ATM_IDLE_CELLS_CONNID, this indicates
- * that the system should transmit the specified number
- * of idle cells. Unknown connIds result in the transmission
- * idle cells.
- */
- unsigned int numberOfCells; /**< number of cells to transmit
- *
- * The number of contiguous cells to schedule from this VC
- * at this point. The valid range is from 1 to
- * @a IX_ATM_SCHEDULETABLE_MAXCELLS_PER_ENTRY. This
- * number can swap over mbufs and pdus. OverSchduling results
- * in the transmission of idle cells.
- */
-} IxAtmScheduleTableEntry;
-
-/**
- * @brief This structure defines a schedule table which gives details
- * on which data (from which VCs) should be transmitted for a
- * forthcoming period of time for a particular port and the
- * order in which that data should be transmitted.
- *
- * The schedule table consists of a series of entries each of which
- * will schedule one or more cells from a particular registered VC.
- * The total number of cells scheduled and the total number of
- * entries in the table are also indicated.
- *
- */
-typedef struct
-{
- unsigned tableSize; /**< Number of entries
- *
- * Indicates the total number of
- * entries in the table.
- */
- unsigned totalCellSlots; /**< Number of cells
- *
- * Indicates the total number of ATM
- * cells which are scheduled by all the
- * entries in the table.
- */
- IxAtmScheduleTableEntry *table; /**< Pointer to schedule entries
- *
- * Pointer to an array
- * containing tableSize entries
- */
-} IxAtmScheduleTable;
-
-#endif /* IXATMTYPES_H */
-
-/**
- * @} defgroup IxAtmTypes
- */
-
-
diff --git a/cpu/ixp/npe/include/IxAtmdAcc.h b/cpu/ixp/npe/include/IxAtmdAcc.h
deleted file mode 100644
index ae7b2434c3..0000000000
--- a/cpu/ixp/npe/include/IxAtmdAcc.h
+++ /dev/null
@@ -1,1194 +0,0 @@
-
-/**
- * @file IxAtmdAcc.h
- *
- * @date 07-Nov-2001
- *
- * @brief IxAtmdAcc Public API
- *
- * This file contains the public API of IxAtmdAcc, related to the
- * data functions of the component
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/* ------------------------------------------------------
- Doxygen group definitions
- ------------------------------------------------------ */
-
-/**
- *
- * @defgroup IxAtmdAccAPI IXP400 ATM Driver Access (IxAtmdAcc) API
- *
- * @brief The public API for the IXP400 Atm Driver Data component
- *
- * IxAtmdAcc is the low level interface by which AAL0/AAL5 and
- * OAM data gets transmitted to,and received from the Utopia bus.
- *
- * For AAL0/AAL5 services transmit and receive connections may
- * be established independantly for unique combinations of
- * port,VPI,and VCI.
- *
- * Two AAL0 services supporting 48 or 52 byte cell data are provided.
- * Submitted AAL0 PDUs must be a multiple of the cell data size (48/52).
- * AAL0_52 is a raw cell service the client must format
- * the PDU with an ATM cell header (excluding HEC) at the start of
- * each cell, note that AtmdAcc does not validate the cell headers in
- * a submitted PDU.
- *
- * OAM cells cannot be received over the AAL0 service but instead
- * are received over a dedicated OAM service.
- *
- * For the OAM service an "OAM Tx channel" may be enabled for a port
- * by establishing a single dedicated OAM Tx connection on that port.
- * A single "OAM Rx channel" for all ports may be enabled by
- * establishing a dedicated OAM Rx connection.
- *
- * The OAM service allows buffers containing 52 byte OAM F4/F5 cells
- * to be transmitted and received over the dedicated OAM channels.
- * HEC is appended/removed, and CRC-10 performed by the NPE. The OAM
- * service offered by AtmdAcc is a raw cell transport service.
- * It is assumed that ITU I.610 procedures that make use of this
- * service are implemented above AtmdAcc.
- *
- * Note that the dedicated OAM connections are established on
- * reserved VPI,VCI, and (in the case of Rx) port values defined below.
- * These values are used purely to descriminate the dedicated OAM channels
- * and do not identify a particular OAM F4/F5 flow. F4/F5 flows may be
- * realised for particluar VPI/VCIs by manipulating the VPI,VCI
- * fields of the ATM cell headers of cells in the buffers passed
- * to AtmdAcc. Note that AtmdAcc does not validate the cell headers
- * in a submitted OAM PDU.
- *
- *
- *
- * This part is related to the User datapath processing
- *
- * @{
- */
-
-#ifndef IXATMDACC_H
-#define IXATMDACC_H
-
-#include "IxAtmTypes.h"
-
-/* ------------------------------------------------------
- AtmdAcc Data Types definition
- ------------------------------------------------------ */
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @def IX_ATMDACC_WARNING
- *
- * @brief Warning return code
- *
- * This constant is used to tell IxAtmDAcc user about a special case.
- *
- */
-#define IX_ATMDACC_WARNING 2
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @def IX_ATMDACC_BUSY
- *
- * @brief Busy return code
- *
- * This constant is used to tell IxAtmDAcc user that the request
- * is correct, but cannot be processed because the IxAtmAcc resources
- * are already used. The user has to retry its request later
- *
- */
-#define IX_ATMDACC_BUSY 3
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @def IX_ATMDACC_RESOURCES_STILL_ALLOCATED
- *
- * @brief Disconnect return code
- *
- * This constant is used to tell IxAtmDAcc user that the disconnect
- * functions are not complete because the resources used by the driver
- * are not yet released. The user has to retry the disconnect call
- * later.
- *
- */
-#define IX_ATMDACC_RESOURCES_STILL_ALLOCATED 4
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @def IX_ATMDACC_DEFAULT_REPLENISH_COUNT
- *
- * @brief Default resources usage for RxVcFree replenish mechanism
- *
- * This constant is used to tell IxAtmDAcc to allocate and use
- * the minimum of resources for rx free replenish.
- *
- * @sa ixAtmdAccRxVcConnect
- */
-#define IX_ATMDACC_DEFAULT_REPLENISH_COUNT 0
-
-
-/**
- * @ingroup IxAtmdAccAPI
- *
- * @def IX_ATMDACC_OAM_TX_VPI
- *
- * @brief The reserved value used for the dedicated OAM
- * Tx connection. This "well known" value is used by atmdAcc and
- * its clients to dsicriminate the OAM channel, and should be chosen so
- * that it does not coencide with the VPI value used in an AAL0/AAL5 connection.
- * Any attempt to connect a service type other than OAM on this VPI will fail.
- *
- *
- */
-#define IX_ATMDACC_OAM_TX_VPI 0
-
-/**
- * @ingroup IxAtmdAccAPI
- *
- * @def IX_ATMDACC_OAM_TX_VCI
- *
- * @brief The reserved value used for the dedicated OAM
- * Tx connection. This "well known" value is used by atmdAcc and
- * its clients to dsicriminate the OAM channel, and should be chosen so
- * that it does not coencide with the VCI value used in an AAL0/AAL5 connection.
- * Any attempt to connect a service type other than OAM on this VCI will fail.
- */
-#define IX_ATMDACC_OAM_TX_VCI 0
-
-
- /**
- * @ingroup IxAtmdAccAPI
- *
- * @def IX_ATMDACC_OAM_RX_PORT
- *
- * @brief The reserved dummy PORT used for all dedicated OAM
- * Rx connections. Note that this is not a real port but must
- * have a value that lies within the valid range of port values.
- */
-#define IX_ATMDACC_OAM_RX_PORT IX_UTOPIA_PORT_0
-
- /**
- * @ingroup IxAtmdAccAPI
- *
- * @def IX_ATMDACC_OAM_RX_VPI
- *
- * @brief The reserved value value used for the dedicated OAM
- * Rx connection. This value should be chosen so that it does not
- * coencide with the VPI value used in an AAL0/AAL5 connection.
- * Any attempt to connect a service type other than OAM on this VPI will fail.
- */
-#define IX_ATMDACC_OAM_RX_VPI 0
-
-/**
- * @ingroup IxAtmdAccAPI
- *
- * @def IX_ATMDACC_OAM_RX_VCI
- *
- * @brief The reserved value value used for the dedicated OAM
- * Rx connection. This value should be chosen so that it does not
- * coencide with the VCI value used in an AAL0/AAL5 connection.
- * Any attempt to connect a service type other than OAM on this VCI will fail.
- */
-#define IX_ATMDACC_OAM_RX_VCI 0
-
-
-/**
- * @enum IxAtmdAccPduStatus
- *
- * @ingroup IxAtmdAccAPI
- *
- * @brief IxAtmdAcc Pdu status :
- *
- * IxAtmdAccPduStatus is used during a RX operation to indicate
- * the status of the received PDU
- *
- */
-
-typedef enum
-{
- IX_ATMDACC_AAL0_VALID = 0, /**< aal0 pdu */
- IX_ATMDACC_OAM_VALID, /**< OAM pdu */
- IX_ATMDACC_AAL2_VALID, /**< aal2 pdu @b reserved for future use */
- IX_ATMDACC_AAL5_VALID, /**< aal5 pdu complete and trailer is valid */
- IX_ATMDACC_AAL5_PARTIAL, /**< aal5 pdu not complete, trailer is missing */
- IX_ATMDACC_AAL5_CRC_ERROR, /**< aal5 pdu not complete, crc error/length error */
- IX_ATMDACC_MBUF_RETURN /**< empty buffer returned to the user */
-} IxAtmdAccPduStatus;
-
-
-/**
- *
- * @enum IxAtmdAccAalType
- *
- * @ingroup IxAtmdAccAPI
- *
- * @brief IxAtmdAcc AAL Service Type :
- *
- * IxAtmdAccAalType defines the type of traffic to run on this VC
- *
- */
-typedef enum
-{
- IX_ATMDACC_AAL5, /**< ITU-T AAL5 */
- IX_ATMDACC_AAL2, /**< ITU-T AAL2 @b reserved for future use */
- IX_ATMDACC_AAL0_48, /**< AAL0 48 byte payloads (cell header is added by NPE)*/
- IX_ATMDACC_AAL0_52, /**< AAL0 52 byte cell data (HEC is added by NPE) */
- IX_ATMDACC_OAM, /**< OAM cell transport service (HEC is added by NPE)*/
- IX_ATMDACC_MAX_SERVICE_TYPE /**< not a service, used for parameter validation */
-} IxAtmdAccAalType;
-
-/**
- *
- * @enum IxAtmdAccClpStatus
- *
- * @ingroup IxAtmdAccAPI
- *
- * @brief IxAtmdAcc CLP indication
- *
- * IxAtmdAccClpStatus defines the CLP status of the current PDU
- *
- */
-typedef enum
-{
- IX_ATMDACC_CLP_NOT_SET = 0, /**< CLP indication is not set */
- IX_ATMDACC_CLP_SET = 1 /**< CLP indication is set */
-} IxAtmdAccClpStatus;
-
-/**
- * @typedef IxAtmdAccUserId
- *
- * @ingroup IxAtmdAccAPI
- *
- * @brief User-supplied Id
- *
- * IxAtmdAccUserId is passed through callbacks and allows the
- * IxAtmdAcc user to identify the source of a call back. The range of
- * this user-owned Id is [0...2^32-1)].
- *
- * The user provides this own Ids on a per-channel basis as a parameter
- * in a call to @a ixAtmdAccRxVcConnect() or @a ixAtmdAccRxVcConnect()
- *
- * @sa ixAtmdAccRxVcConnect
- * @sa ixAtmdAccTxVcConnect
- *
- */
-typedef unsigned int IxAtmdAccUserId;
-
-/* ------------------------------------------------------
- Part of the IxAtmdAcc interface related to RX traffic
- ------------------------------------------------------ */
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @brief Rx callback prototype
- *
- * IxAtmdAccRxVcRxCallback is the prototype of the Rx callback user
- * function called once per PDU to pass a receive Pdu to a user on a
- * partilcular connection. The callback is likely to push the mbufs
- * to a protocol layer, and recycle the mbufs for a further use.
- *
- * @note -This function is called ONLY in the context of
- * the @a ixAtmdAccRxDispatch() function
- *
- * @sa ixAtmdAccRxDispatch
- * @sa ixAtmdAccRxVcConnect
- *
- * @param port @ref IxAtmLogicalPort [in] - the port on which this PDU was received
- * a logical PHY port [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
- * @param userId @ref IxAtmdAccUserId [in] - user Id provided in the call
- * to @a ixAtmdAccRxVcConnect()
- * @param status @ref IxAtmdAccPduStatus [in] - an indication about the PDU validity.
- * In the case of AAL0 the only possibile value is
- * AAL0_VALID, in this case the client may optionally determine
- * that an rx timeout occured by checking if the mbuf is
- * compleletly or only partially filled, the later case
- * indicating a timeout.
- * In the case of OAM the only possible value is OAM valid.
- * The status is set to @a IX_ATMDACC_MBUF_RETURN when
- * the mbuf is released during a disconnect process.
- * @param clp @ref IxAtmdAccClpStatus [in] - clp indication for this PDU.
- * For AAL5/AAL0_48 this information
- * is set if the clp bit of any rx cell is set
- * For AAL0-52/OAM the client may inspect the CLP in individual
- * cell headers in the PDU, and this parameter is set to 0.
- * @param *mbufPtr @ref IX_OSAL_MBUF [in] - depending on the servive type a pointer to
- * an mbuf (AAL5/AAL0/OAM) or mbuf chain (AAL5 only),
- * that comprises the complete PDU data.
- *
- * This parameter is guaranteed not to be a null pointer.
- *
- */
-typedef void (*IxAtmdAccRxVcRxCallback) (IxAtmLogicalPort port,
- IxAtmdAccUserId userId,
- IxAtmdAccPduStatus status,
- IxAtmdAccClpStatus clp,
- IX_OSAL_MBUF * mbufPtr);
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @brief Callback prototype for free buffer level is low.
- *
- * IxAtmdAccRxVcFreeLowCallback is the prototype of the user function
- * which get called on a per-VC basis, when more mbufs are needed to
- * continue the ATM data reception. This function is likely to supply
- * more available mbufs by one or many calls to the replenish function
- * @a ixAtmdAccRxVcFreeReplenish()
- *
- * This function is called when the number of available buffers for
- * reception is going under the threshold level as defined
- * in @a ixAtmdAccRxVcFreeLowCallbackRegister()
- *
- * This function is called inside an Qmgr dispatch context. No system
- * resource or interrupt-unsafe feature should be used inside this
- * callback.
- *
- * @sa ixAtmdAccRxVcFreeLowCallbackRegister
- * @sa IxAtmdAccRxVcFreeLowCallback
- * @sa ixAtmdAccRxVcFreeReplenish
- * @sa ixAtmdAccRxVcFreeEntriesQuery
- * @sa ixAtmdAccRxVcConnect
- *
- * @param userId @ref IxAtmdAccUserId [in] - user Id provided in the call
- * to @a ixAtmdAccRxVcConnect()
- *
- * @return None
- *
- */
-typedef void (*IxAtmdAccRxVcFreeLowCallback) (IxAtmdAccUserId userId);
-
-/* ------------------------------------------------------
- Part of the IxAtmdAcc interface related to TX traffic
- ------------------------------------------------------ */
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @brief Buffer callback prototype.
- *
- * This function is called to relinguish ownership of a transmitted
- * buffer chain to the user.
- *
- * @note -In the case of a chained mbuf the AmtdAcc component can
- * chain many user buffers together and pass ownership to the user in
- * one function call.
- *
- * @param userId @ref IxAtmdAccUserId [in] - user If provided at registration of this
- * callback.
- * @param mbufPtr @ref IX_OSAL_MBUF [in] - a pointer to mbufs or chain of mbufs and is
- * guaranteed not to be a null pointer.
- *
- */
-typedef void (*IxAtmdAccTxVcBufferReturnCallback) (IxAtmdAccUserId userId,
- IX_OSAL_MBUF * mbufPtr);
-
-/* ------------------------------------------------------
- Part of the IxAtmdAcc interface related to Initialisation
- ------------------------------------------------------ */
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccInit (void)
- *
- * @brief Initialise the IxAtmdAcc Component
- *
- * This function initialise the IxAtmdAcc component. This function shall
- * be called before any other function of the API. Its role is to
- * initialise all internal resources of the IxAtmdAcc component.
- *
- * The ixQmgr component needs to be initialized prior the use of
- * @a ixAtmdAccInit()
- *
- * @param none
- *
- * Failing to initilialize the IxAtmdAcc API before any use of it will
- * result in a failed status.
- * If the specified component is not present, a success status will still be
- * returned, however, a warning indicating the NPE to download to is not
- * present will be issued.
- *
- * @return @li IX_SUCCESS initialisation is complete (in case of component not
- * being present, a warning is clearly indicated)
- * @return @li IX_FAIL unable to process this request either
- * because this IxAtmdAcc is already initialised
- * or some unspecified error has occrred.
- */
-PUBLIC IX_STATUS ixAtmdAccInit (void);
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccShow (void)
- *
- * @brief Show IxAtmdAcc configuration on a per port basis
- *
- * @param none
- *
- * @return none
- *
- * @note - Display use printf() and are redirected to stdout
- */
-PUBLIC void
-ixAtmdAccShow (void);
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccStatsShow (void)
- *
- * @brief Show all IxAtmdAcc stats
- *
- * @param none
- *
- * @return none
- *
- * @note - Stats display use printf() and are redirected to stdout
- */
-PUBLIC void
-ixAtmdAccStatsShow (void);
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccStatsReset (void)
- *
- * @brief Reset all IxAtmdAcc stats
- *
- * @param none
- *
- * @return none
- *
- */
-PUBLIC void
-ixAtmdAccStatsReset (void);
-
-/* ------------------------------------------------------
- Part of the IxAtmdAcc interface related to RX traffic
- ------------------------------------------------------ */
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccRxVcConnect (IxAtmLogicalPort port,
- unsigned int vpi,
- unsigned int vci,
- IxAtmdAccAalType aalServiceType,
- IxAtmRxQueueId rxQueueId,
- IxAtmdAccUserId userCallbackId,
- IxAtmdAccRxVcRxCallback rxCallback,
- unsigned int minimumReplenishCount,
- IxAtmConnId * connIdPtr,
- IxAtmNpeRxVcId * npeVcIdPtr )
- *
- * @brief Connect to a Aal Pdu receive service for a particular
- * port/vpi/vci, and service type.
- *
- * This function allows a user to connect to an Aal5/Aal0/OAM Pdu receive service
- * for a particular port/vpi/vci. It registers the callback and allocates
- * internal resources and a Connection Id to be used in further API calls
- * related to this VCC.
- *
- * The function will setup VC receive service on the specified rx queue.
- *
- * This function is blocking and makes use internal locks, and hence
- * should not be called from an interrupt context.
- *
- * On return from @a ixAtmdAccRxVcConnect() with a failure status, the
- * connection Id parameter is unspecified. Its value cannot be used.
- * A connId is the reference by which IxAtmdAcc refers to a
- * connected VC. This identifier is the result of a succesful call
- * to a connect function. This identifier is invalid after a
- * sucessful call to a disconnect function.
- *
- * Calling this function for the same combination of Vpi, Vci and more
- * than once without calling @a ixAtmdAccRxVcTryDisconnect() will result in a
- * failure status.
- *
- * If this function returns success the user should supply receive
- * buffers by calling @a ixAtmdAccRxVcFreeReplenish() and then call
- * @a ixAtmdAccRxVcEnable() to begin receiving pdus.
- *
- * There is a choice of two receive Qs on which the VC pdus could be
- * receive. The user must associate the VC with one of these. Essentially
- * having two qs allows more flexible system configuration such as have
- * high prioriy traffic on one q (e.g. voice) and low priority traffic on
- * the other (e.g. data). The high priority Q could be serviced in
- * preference to the low priority Q. One queue may be configured to be
- * serviced as soon as there is traffic, the other queue may be configured
- * to be serviced by a polling mechanism running at idle time.
- *
- * Two AAL0 services supporting 48 or 52 byte cell data are provided.
- * Received AAL0 PDUs will be be a multiple of the cell data size (48/52).
- * AAL0_52 is a raw cell service and includes an ATM cell header
- * (excluding HEC) at the start of each cell.
- *
- * A single "OAM Rx channel" for all ports may be enabled by
- * establishing a dedicated OAM Rx connection.
- *
- * The OAM service allows buffers containing 52 byte OAM F4/F5 cells
- * to be transmitted and received over the dedicated OAM channels.
- * HEC is appended/removed, and CRC-10 performed by the NPE. The OAM
- * service offered by AtmdAcc is a raw cell transport service.
- * It is assumed that ITU I.610 procedures that make use of this
- * service are implemented above AtmdAcc.
- *
- * Note that the dedicated OAM connections are established on
- * reserved VPI,VCI, and (in the case of Rx) port values.
- * These values are used purely to descriminate the dedicated OAM channels
- * and do not identify a particular OAM F4/F5 flow. F4/F5 flows may be
- * realised for particluar VPI/VCIs by manipulating the VPI,VCI
- * fields of the ATM cell headers of cells in the buffers passed
- * to AtmdAcc.
- *
- * Calling this function prior to enable the port will fail.
- *
- * @sa ixAtmdAccRxDispatch
- * @sa ixAtmdAccRxVcEnable
- * @sa ixAtmdAccRxVcDisable
- * @sa ixAtmdAccRxVcTryDisconnect
- * @sa ixAtmdAccPortEnable
- *
- * @param port @ref IxAtmLogicalPort [in] - VC identification : logical PHY port
- * [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
- * @param vpi unsigned int [in] - VC identification : ATM Vpi [0..255] or IX_ATMDACC_OAM_VPI
- * @param vci unsigned int [in] - VC identification : ATM Vci [0..65535] or IX_ATMDACC_OAM_VCI
- * @param aalServiceType @ref IxAtmdAccAalType [in] - type of service: AAL5, AAL0_48, AAL0_52, or OAM
- * @param rxQueueId @ref IxAtmRxQueueId [in] - this identifieds which of two Qs the VC
- * should use.when icoming traffic is processed
- * @param userCallbackId @ref IxAtmdAccUserId [in] - user Id used later as a parameter to
- * the supplied rxCallback.
- * @param rxCallback [in] @ref IxAtmdAccRxVxRxCallback - function called when mbufs are received.
- * This parameter cannot be a null pointer.
- * @param bufferFreeCallback [in] - function to be called to return
- * ownership of buffers to IxAtmdAcc user.
- * @param minimumReplenishCount unsigned int [in] - For AAL5/AAL0 the number of free mbufs
- * to be used with this channel. Use a high number when the expected traffic
- * rate on this channel is high, or when the user's mbufs are small, or when
- * the RxVcFreeLow Notification has to be invoked less often. When this
- * value is IX_ATMDACC_DEFAULT_REPLENISH_COUNT, the minimum of
- * resources will be used. Depending on traffic rate, pdu
- * size and mbuf size, rxfree queue size, polling/interrupt rate, this value may
- * require to be replaced by a different value in the range 1-128
- * For OAM the rxFree queue size is fixed by atmdAcc and this parameter is ignored.
- * @param connIdPtr @ref IxAtmConnId [out] - pointer to a connection Id
- * This parameter cannot be a null pointer.
- * @param npeVcIdPtr @ref IxAtmNpeRxVcId [out] - pointer to an npe Vc Id
- * This parameter cannot be a null pointer.
- *
- * @return @li IX_SUCCESS successful call to IxAtmdAccRxVcConnect
- * @return @li IX_ATMDACC_BUSY cannot process this request :
- * no VC is available
- * @return @li IX_FAIL
- * parameter error,
- * VC already in use,
- * attempt to connect AAL service on reserved OAM VPI/VCI,
- * attempt to connect OAM service on VPI/VCI other than the reserved OAM VPI/VCI,
- * port is not initialised,
- * or some other error occurs during processing.
- *
- */
-PUBLIC IX_STATUS ixAtmdAccRxVcConnect (IxAtmLogicalPort port,
- unsigned int vpi,
- unsigned int vci,
- IxAtmdAccAalType aalServiceType,
- IxAtmRxQueueId rxQueueId,
- IxAtmdAccUserId userCallbackId,
- IxAtmdAccRxVcRxCallback rxCallback,
- unsigned int minimumReplenishCount,
- IxAtmConnId * connIdPtr,
- IxAtmNpeRxVcId * npeVcIdPtr );
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccRxVcFreeReplenish (IxAtmConnId connId,
- IX_OSAL_MBUF * mbufPtr)
- *
- * @brief Provide free mbufs for data reception on a connection.
- *
- * This function provides mbufs for data reception by the hardware. This
- * function needs to be called by the user on a regular basis to ensure
- * no packet loss. Providing free buffers is a connection-based feature;
- * each connection can have different requirements in terms of buffer size
- * number of buffers, recycling rate. This function could be invoked from
- * within the context of a @a IxAtmdAccRxVcFreeLowCallback() callback
- * for a particular VC
- *
- * Mbufs provided through this function call can be chained. They will be
- * unchained internally. A call to this function with chained mbufs or
- * multiple calls with unchained mbufs are equivalent, but calls with
- * unchained mbufs are more efficients.
- *
- * Mbufs provided to this interface need to be able to hold at least one
- * full cell payload (48/52 bytes, depending on service type).
- * Chained buffers with a size less than the size supported by the hardware
- * will be returned through the rx callback provided during the connect step.
- *
- * Failing to invoke this function prior to enabling the RX traffic
- * can result in packet loss.
- *
- * This function is not reentrant for the same connId.
- *
- * This function does not use system resources and can be
- * invoked from an interrupt context.
- *
- * @note - Over replenish is detected, and extra mbufs are returned through
- * the rx callback provided during the connect step.
- *
- * @note - Mbuf provided to the replenish function should have a length greater or
- * equal to 48/52 bytes according to service type.
- *
- * @note - The memory cache of mMbuf payload should be invalidated prior to Mbuf
- * submission. Flushing the Mbuf headers is handled by IxAtmdAcc.
- *
- * @note - When a chained mbuf is provided, this function process the mbufs
- * up to the hardware limit and invokes the user-supplied callback
- * to release extra buffers.
- *
- * @sa ixAtmdAccRxVcFreeLowCallbackRegister
- * @sa IxAtmdAccRxVcFreeLowCallback
- * @sa ixAtmdAccRxVcConnect
- *
- * @param connId @ref IxAtmConnId [in] - connection Id as returned from a succesfull call to
- * @a IxAtmdAccRxVcConnect()
- * @param mbufPtr @ref IX_OSAL_MBUF [in] - pointer to a mbuf structure to be used for data
- * reception. The mbuf pointed to by this parameter can be chained
- * to an other mbuf.
- *
- * @return @li IX_SUCCESS successful call to @a ixAtmdAccRxVcFreeReplenish()
- * and the mbuf is now ready to use for incoming traffic.
- * @return @li IX_ATMDACC_BUSY cannot process this request because
- * the max number of outstanding free buffers has been reached
- * or the internal resources have exhausted for this VC.
- * The user is responsible for retrying this request later.
- * @return @li IX_FAIL cannot process this request because of parameter
- * errors or some unspecified internal error has occurred.
- *
- * @note - It is not always guaranteed the replenish step to be as fast as the
- * hardware is consuming Rx Free mbufs. There is nothing in IxAtmdAcc to
- * guarantee that replenish reaches the rxFree threshold level. If the
- * threshold level is not reached, the next rxFree low notification for
- * this channel will not be triggered.
- * The preferred ways to replenish can be as follows (depending on
- * applications and implementations) :
- * @li Replenish in a rxFree low notification until the function
- * ixAtmdAccRxVcFreeReplenish() returns IX_ATMDACC_BUSY
- * @li Query the queue level using @sa ixAtmdAccRxVcFreeEntriesQuery, then
- * , replenish using @a ixAtmdAccRxVcFreeReplenish(), then query the queue
- * level again, and replenish if the threshold is still not reached.
- * @li Trigger replenish from an other event source and use rxFree starvation
- * to throttle the Rx traffic.
- *
- */
-PUBLIC IX_STATUS ixAtmdAccRxVcFreeReplenish (IxAtmConnId connId,
- IX_OSAL_MBUF * mbufPtr);
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccRxVcFreeLowCallbackRegister (IxAtmConnId connId,
- unsigned int numberOfMbufs,
- IxAtmdAccRxVcFreeLowCallback callback)
- *
- * @brief Configure the RX Free threshold value and register a callback
- * to handle threshold notifications.
- *
- * The function ixAtmdAccRxVcFreeLowCallbackRegister sets the threshold value for
- * a particular RX VC. When the number of buffers reaches this threshold
- * the callback is invoked.
- *
- * This function should be called once per VC before RX traffic is
- * enabled.This function will fail if the curent level of the free buffers
- * is equal or less than the threshold value.
- *
- * @sa ixAtmdAccRxVcFreeLowCallbackRegister
- * @sa IxAtmdAccRxVcFreeLowCallback
- * @sa ixAtmdAccRxVcFreeReplenish
- * @sa ixAtmdAccRxVcFreeEntriesQuery
- * @sa ixAtmdAccRxVcConnect
- *
- * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call
- * to @a IxAtmdAccRxVcConnect()
- * @param numberOfMbufs unsigned int [in] - threshold number of buffers. This number
- * has to be a power of 2, one of the values 0,1,2,4,8,16,32....
- * The maximum value cannot be more than half of the rxFree queue
- * size (which can be retrieved using @a ixAtmdAccRxVcFreeEntriesQuery()
- * before any use of the @a ixAtmdAccRxVcFreeReplenish() function)
- * @param callback @ref IxAtmdAccRxVcFreeLowCallback [in] - function telling the user that the number of
- * free buffers has reduced to the threshold value.
- *
- * @return @li IX_SUCCESS Threshold set successfully.
- * @return @li IX_FAIL parameter error or the current number of free buffers
- * is less than or equal to the threshold supplied or some
- * unspecified error has occrred.
- *
- * @note - the callback will be called when the threshold level will drop from
- * exactly (numberOfMbufs + 1) to (numberOfMbufs).
- *
- */
-PUBLIC IX_STATUS ixAtmdAccRxVcFreeLowCallbackRegister (IxAtmConnId connId,
- unsigned int numberOfMbufs,
- IxAtmdAccRxVcFreeLowCallback callback);
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccRxVcFreeEntriesQuery (IxAtmConnId connId,
- unsigned int *numberOfMbufsPtr)
- *
- * @brief Get the number of rx mbufs the system can accept to replenish the
- * the rx reception mechanism on a particular channel
- *
- * The ixAtmdAccRxVcFreeEntriesQuery function is used to retrieve the current
- * number of available mbuf entries for reception, on a per-VC basis. This
- * function can be used to know the number of mbufs which can be provided
- * using @a ixAtmdAccRxVcFreeReplenish().
- *
- * This function can be used from a timer context, or can be associated
- * with a threshold event, or can be used inside an active polling
- * mechanism which is under user control.
- *
- * This function is reentrant and does not use system resources and can
- * be invoked from an interrupt context.
- *
- * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call
- * to @a IxAtmdAccRxVcConnect()
- * @param numberOfMbufsPtr unsigned int [out] - Pointer to the number of available entries.
- * . This parameter cannot be a null pointer.
- *
- * @return @li IX_SUCCESS the current number of mbufs not yet used for incoming traffic
- * @return @li IX_FAIL invalid parameter
- *
- * @sa ixAtmdAccRxVcFreeReplenish
- *
- */
-PUBLIC IX_STATUS ixAtmdAccRxVcFreeEntriesQuery (IxAtmConnId connId,
- unsigned int *numberOfMbufsPtr);
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccRxVcEnable (IxAtmConnId connId)
- *
- * @brief Start the RX service on a VC.
- *
- * This functions kicks-off the traffic reception for a particular VC.
- * Once invoked, incoming PDUs will be made available by the hardware
- * and are eventually directed to the @a IxAtmdAccRxVcRxCallback() callback
- * registered for the connection.
- *
- * If the traffic is already running, this function returns IX_SUCCESS.
- * This function can be invoked many times.
- *
- * IxAtmdAccRxVcFreeLowCallback event will occur only after
- * @a ixAtmdAccRxVcEnable() function is invoked.
- *
- * Before using this function, the @a ixAtmdAccRxVcFreeReplenish() function
- * has to be used to replenish the RX Free queue. If not, incoming traffic
- * may be discarded.and in the case of interrupt driven reception the
- * @a IxAtmdAccRxVcFreeLowCallback() callback may be invoked as a side effect
- * during a replenish action.
- *
- * This function is not reentrant and should not be used inside an
- * interrupt context.
- *
- * For an VC connection this function can be called after a call to
- * @a ixAtmdAccRxVcDisable() and should not be called after
- * @a ixAtmdAccRxVcTryDisconnect()
- *
- * @sa ixAtmdAccRxVcDisable
- * @sa ixAtmdAccRxVcConnect
- * @sa ixAtmdAccRxVcFreeReplenish
- *
- * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call
- * to @a IxAtmdAccRxVcConnect()
- *
- * @return @li IX_SUCCESS successful call to ixAtmdAccRxVcEnable
- * @return @li IX_ATMDACC_WARNING the channel is already enabled
- * @return @li IX_FAIL invalid parameters or some unspecified internal
- * error occured.
- *
- */
-PUBLIC IX_STATUS ixAtmdAccRxVcEnable (IxAtmConnId connId);
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccRxVcDisable (IxAtmConnId connId)
- *
- * @brief Stop the RX service on a VC.
- *
- * This functions stops the traffic reception for a particular VC connection.
- *
- * Once invoked, incoming Pdus are discarded by the hardware. Any Pdus
- * pending will be freed to the user
- *
- * Hence once this function returns no more receive callbacks will be
- * called for that VC. However, buffer free callbacks will be invoked
- * until such time as all buffers supplied by the user have been freed
- * back to the user
- *
- * Calling this function doe not invalidate the connId.
- * @a ixAtmdAccRxVcEnable() can be invoked to enable Pdu reception again.
- *
- * If the traffic is already stopped, this function returns IX_SUCCESS.
- *
- * This function is not reentrant and should not be used inside an
- * interrupt context.
- *
- * @sa ixAtmdAccRxVcConnect
- * @sa ixAtmdAccRxVcEnable
- * @sa ixAtmdAccRxVcDisable
- *
- * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call to @a
- * IxAtmdAccRxVcConnect()
- *
- * @return @li IX_SUCCESS successful call to @a ixAtmdAccRxVcDisable().
- * @return @li IX_ATMDACC_WARNING the channel is already disabled
- * @return @li IX_FAIL invalid parameters or some unspecified internal error occured
- *
- */
-PUBLIC IX_STATUS ixAtmdAccRxVcDisable (IxAtmConnId connId);
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccRxVcTryDisconnect (IxAtmConnId connId)
- *
- * @brief Disconnect a VC from the RX service.
- *
- * This function deregisters the VC and guarantees that all resources
- * associated with this VC are free. After its execution, the connection
- * Id is not available.
- *
- * This function will fail until such time as all resources allocated to
- * the VC connection have been freed. The user is responsible to delay and
- * call again this function many times until a success status is returned.
- *
- * This function needs internal locks and should not be called from an
- * interrupt context
- *
- * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call to
- * @a IxAtmdAccRxVcConnect()
- *
- * @return @li IX_SUCCESS successful call to ixAtmdAccRxVcDisable
- * @return @li IX_ATMDACC_RESOURCES_STILL_ALLOCATED not all resources
- * associated with the connection have been freed.
- * @return @li IX_FAIL cannot process this request because of a parameter
- * error
- *
- */
-PUBLIC IX_STATUS ixAtmdAccRxVcTryDisconnect (IxAtmConnId connId);
-
-/* ------------------------------------------------------
- Part of the IxAtmdAcc interface related to TX traffic
- ------------------------------------------------------ */
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccTxVcConnect (IxAtmLogicalPort port,
- unsigned int vpi,
- unsigned int vci,
- IxAtmdAccAalType aalServiceType,
- IxAtmdAccUserId userId,
- IxAtmdAccTxVcBufferReturnCallback bufferFreeCallback,
- IxAtmConnId * connIdPtr)
- *
- * @brief Connect to a Aal Pdu transmit service for a particular
- * port/vpi/vci and service type.
- *
- * This function allows a user to connect to an Aal5/Aal0/OAM Pdu transmit service
- * for a particular port/vpi/vci. It registers the callback and allocates
- * internal resources and a Connection Id to be used in further API calls
- * related to this VC.
- *
- * The function will setup VC transmit service on the specified on the
- * specified port. A connId is the reference by which IxAtmdAcc refers to a
- * connected VC. This identifier is the result of a succesful call
- * to a connect function. This identifier is invalid after a
- * sucessful call to a disconnect function.
- *
- * This function needs internal locks, and hence should not be called
- * from an interrupt context.
- *
- * On return from @a ixAtmdAccTxVcConnect() with a failure status, the
- * connection Id parameter is unspecified. Its value cannot be used.
- *
- * Calling this function for the same combination of port, Vpi, Vci and
- * more than once without calling @a ixAtmdAccTxVcTryDisconnect() will result
- * in a failure status.
- *
- * Two AAL0 services supporting 48 or 52 byte cell data are provided.
- * Submitted AAL0 PDUs must be a multiple of the cell data size (48/52).
- * AAL0_52 is a raw cell service the client must format
- * the PDU with an ATM cell header (excluding HEC) at the start of
- * each cell, note that AtmdAcc does not validate the cell headers in
- * a submitted PDU.
- *
- * For the OAM service an "OAM Tx channel" may be enabled for a port
- * by establishing a single dedicated OAM Tx connection on that port.
- *
- * The OAM service allows buffers containing 52 byte OAM F4/F5 cells
- * to be transmitted and received over the dedicated OAM channels.
- * HEC is appended/removed, and CRC-10 performed by the NPE. The OAM
- * service offered by AtmdAcc is a raw cell transport service.
- * It is assumed that ITU I.610 procedures that make use of this
- * service are implemented above AtmdAcc.
- *
- * Note that the dedicated OAM connections are established on
- * reserved VPI,VCI, and (in the case of Rx) port values.
- * These values are used purely to descriminate the dedicated OAM channels
- * and do not identify a particular OAM F4/F5 flow. F4/F5 flows may be
- * realised for particluar VPI/VCIs by manipulating the VPI,VCI
- * fields of the ATM cell headers of cells in the buffers passed
- * to AtmdAcc.
- *
- * Calling this function before enabling the port will fail.
- *
- * @sa ixAtmdAccTxVcTryDisconnect
- * @sa ixAtmdAccPortTxScheduledModeEnable
- * @sa ixAtmdAccPortEnable
- *
- * @param port @ref IxAtmLogicalPort [in] - VC identification : logical PHY port
- * [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
- * @param vpi unsigned int [in] - VC identification : ATM Vpi [0..255] or IX_ATMDACC_OAM_VPI
- * @param vci unsigned int [in] - VC identification : ATM Vci [0..65535] or IX_ATMDACC_OAM_VCI
- * @param aalServiceType @ref IxAtmdAccAalType [in] - type of service AAL5, AAL0_48, AAL0_52, or OAM
- * @param userId @ref IxAtmdAccUserId [in] - user id to be used later during callbacks related
- * to this channel
- * @param bufferFreeCallback @ref IxAtmdAccTxVcBufferReturnCallback [in] - function called when mbufs
- * transmission is complete. This parameter cannot be a null
- * pointer.
- * @param connIdPtr @ref IxAtmConnId [out] - Pointer to a connection Id.
- * This parameter cannot be a null pointer.
- *
- * @return @li IX_SUCCESS successful call to @a IxAtmdAccRxVcConnect().
- * @return @li IX_ATMDACC_BUSY cannot process this request
- * because no VC is available
- * @return @li IX_FAIL
- * parameter error,
- * VC already in use,
- * attempt to connect AAL service on reserved OAM VPI/VCI,
- * attempt to connect OAM service on VPI/VCI other than the reserved OAM VPI/VCI,
- * port is not initialised,
- * or some other error occurs during processing.
- *
- * @note - Unscheduled mode is not supported in ixp425 1.0. Therefore, the
- * function @a ixAtmdAccPortTxScheduledModeEnable() need to be called
- * for this port before any establishing a Tx Connection
- */
-PUBLIC IX_STATUS ixAtmdAccTxVcConnect (IxAtmLogicalPort port,
- unsigned int vpi,
- unsigned int vci,
- IxAtmdAccAalType aalServiceType,
- IxAtmdAccUserId userId,
- IxAtmdAccTxVcBufferReturnCallback bufferFreeCallback,
- IxAtmConnId * connIdPtr);
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccTxVcPduSubmit (IxAtmConnId connId,
- IX_OSAL_MBUF * mbufPtr,
- IxAtmdAccClpStatus clp,
- unsigned int numberOfCells)
- *
- * @brief Submit a Pdu for transmission on connection.
- *
- * A data user calls this function to submit an mbufs containing a Pdu
- * to be transmitted. The buffer supplied can be chained and the Pdu it
- * contains must be complete.
- *
- * The transmission behavior of this call depends on the operational mode
- * of the port on which the connection is made.
- *
- * In unscheduled mode the mbuf will be submitted to the hardware
- * immediately if sufficent resource is available. Otherwise the function
- * will return failure.
- *
- * In scheduled mode the buffer is queued internally in IxAtmdAcc. The cell
- * demand is made known to the traffic shaping entity. Cells from the
- * buffers are MUXed onto the port some time later as dictated by the
- * traffic shaping entity. The traffic shaping entity does this by sending
- * transmit schedules to IxAtmdAcc via @a ixAtmdAccPortTxProcess() function call.
- *
- * Note that the dedicated OAM channel is scheduled just like any
- * other channel. This means that any OAM traffic relating to an
- * active AAL0/AAL5 connection will be scheduled independantly of the
- * AAL0/AAL5 traffic for that connection.
- *
- * When transmission is complete, the TX Done mechanism will give the
- * owmnership of these buffers back to the customer. The tx done mechanism
- * must be in operation before transmission is attempted.
- *
- * For AAL0/OAM submitted AAL0 PDUs must be a multiple of the cell data
- * size (48/52). AAL0_52 and OAM are raw cell services, and the client
- * must format the PDU with an ATM cell header (excluding HEC) at the
- * start of each cell, note that AtmdAcc does not validate the cell headers in
- * a submitted PDU.
- *
- *
- * @sa IxAtmdAccTxVcBufferReturnCallback
- * @sa ixAtmdAccTxDoneDispatch
- *
- * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call to
- * @a ixAtmdAccTxVcConnect()
- * @param mbufPtr @ref IX_OSAL_MBUF [in] - pointer to a chained structure of mbufs to transmit.
- * This parameter cannot be a null pointer.
- * @param clp @ref IxAtmdAccClpStatus [in] - clp indication for this PDU. All cells of this pdu
- * will be sent with the clp bit set
- * @param numberOfCells unsigned int [in] - number of cells in the PDU.
- *
- * @return @li IX_SUCCESS successful call to @a ixAtmdAccTxVcPduSubmit()
- * The pdu pointed by the mbufPtr parameter will be
- * transmitted
- * @return @li IX_ATMDACC_BUSY unable to process this request because
- * internal resources are all used. The caller is responsible
- * for retrying this request later.
- * @return @li IX_FAIL unable to process this request because of error
- * in the parameters (wrong connId supplied,
- * or wrong mbuf pointer supplied), the total length of all buffers
- * in the chain should be a multiple of the cell size
- * ( 48/52 depending on the service type ),
- * or unspecified error during processing
- *
- * @note - This function in not re-entrant for the same VC (e.g. : two
- * thread cannot send PDUs for the same VC). But two threads can
- * safely call this function with a different connection Id
- *
- * @note - In unscheduled mode, this function is not re-entrant on a per
- * port basis. The size of pdus is limited to 8Kb.
- *
- * @note - 0-length mbufs should be removed from the chain before submission.
- * The total length of the pdu (sdu + padding +trailer) has to be
- * updated in the header of the first mbuf of a chain of mbufs.
- *
- * @note - Aal5 trailer information (UUI, CPI, SDU length) has to be supplied
- * before submission.
- *
- * @note - The payload memory cache should be flushed, if needed, prior to
- * transmission. Mbuf headers are flushed by IxAtmdAcc
- *
- * @note - This function does not use system resources and can be used
- * inside an interrupt context
- */
-PUBLIC IX_STATUS ixAtmdAccTxVcPduSubmit (IxAtmConnId connId,
- IX_OSAL_MBUF * mbufPtr,
- IxAtmdAccClpStatus clp,
- unsigned int numberOfCells);
-
-/**
- *
- * @ingroup IxAtmdAccAPI
- *
- * @fn ixAtmdAccTxVcTryDisconnect (IxAtmConnId connId)
- *
- * @brief Disconnect from a Aal Pdu transmit service for a particular
- * port/vpi/vci.
- *
- * This function deregisters the VC and guarantees that all resources
- * associated with this VC are free. After its execution, the connection
- * Id is not available.
- *
- * This function will fail until such time as all resources allocated to
- * the VC connection have been freed. The user is responsible to delay
- * and call again this function many times until a success status is
- * returned.
- *
- * After its execution, the connection Id is not available.
- *
- * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call to
- * @a ixAtmdAccTxVcConnect()
- *
- * @return @li IX_SUCCESS successful call to @a ixAtmdAccTxVcTryDisconnect()
- * @return @li IX_ATMDACC_RESOURCES_STILL_ALLOCATED not all resources
- * associated with the connection have been freed. This condition will
- * disappear after Tx and TxDone is complete for this channel.
- * @return @li IX_FAIL unable to process this request because of errors
- * in the parameters (wrong connId supplied)
- *
- * @note - This function needs internal locks and should not be called
- * from an interrupt context
- *
- * @note - If the @a IX_ATMDACC_RESOURCES_STILL_ALLOCATED error does not
- * clear after a while, this may be linked to a previous problem
- * of cell overscheduling. Diabling the port and retry a disconnect
- * will free the resources associated with this channel.
- *
- * @sa ixAtmdAccPortTxProcess
- *
- */
-PUBLIC IX_STATUS ixAtmdAccTxVcTryDisconnect (IxAtmConnId connId);
-
-#endif /* IXATMDACC_H */
-
-/**
- * @} defgroup IxAtmdAccAPI
- */
-
-
diff --git a/cpu/ixp/npe/include/IxAtmdAccCtrl.h b/cpu/ixp/npe/include/IxAtmdAccCtrl.h
deleted file mode 100644
index e2230493f2..0000000000
--- a/cpu/ixp/npe/include/IxAtmdAccCtrl.h
+++ /dev/null
@@ -1,1958 +0,0 @@
-
-/**
- * @file IxAtmdAccCtrl.h
- *
- * @date 20-Mar-2002
- *
- * @brief IxAtmdAcc Public API
- *
- * This file contains the public API of IxAtmdAcc, related to the
- * control functions of the component.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/* ------------------------------------------------------
- Doxygen group definitions
- ------------------------------------------------------ */
-
-/**
- *
- * @defgroup IxAtmdAccCtrlAPI IXP400 ATM Driver Access (IxAtmdAcc) Control API
- *
- * @brief The public API for the IXP400 Atm Driver Control component
- *
- * IxAtmdAcc is the low level interface by which AAL PDU get transmitted
- * to,and received from the Utopia bus
- *
- * This part is related to the Control configuration
- *
- * @{
- */
-
-#ifndef IXATMDACCCTRL_H
-#define IXATMDACCCTRL_H
-
-#include "IxAtmdAcc.h"
-
-/* ------------------------------------------------------
- AtmdAccCtrl Data Types definition
- ------------------------------------------------------ */
-
-/**
-*
-* @ingroup IxAtmdAccCtrlAPI
-*
-* @def IX_ATMDACC_PORT_DISABLE_IN_PROGRESS
-*
-* @brief Port enable return code
-*
-* This constant is used to tell IxAtmDAcc user that the port disable
-* functions are not complete. The user can call ixAtmdAccPortDisableComplete()
-* to find out when the disable has finished. The port enable can then proceed.
-*
-*/
-#define IX_ATMDACC_PORT_DISABLE_IN_PROGRESS 5
-
-/**
-*
-* @ingroup IxAtmdAccCtrlAPI
-*
-* @def IX_ATMDACC_ALLPDUS
-*
-* @brief All PDUs
-*
-* This constant is used to tell IxAtmDAcc to process all PDUs from
-* the RX queue or the TX Done
-*
-* @sa IxAtmdAccRxDispatcher
-* @sa IxAtmdAccTxDoneDispatcher
-*
-*/
-#define IX_ATMDACC_ALLPDUS 0xffffffff
-
-/* ------------------------------------------------------
- Part of the IxAtmdAcc interface related to RX traffic
- ------------------------------------------------------ */
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @brief Callback prototype for notification of available PDUs for
- * an Rx Q.
- *
- * This a protoype for a function which is called when there is at
- * least one Pdu available for processing on a particular Rx Q.
- *
- * This function should call @a ixAtmdAccRxDispatch() with
- * the aprropriate number of parameters to read and process the Rx Q.
- *
- * @sa ixAtmdAccRxDispatch
- * @sa ixAtmdAccRxVcConnect
- * @sa ixAtmdAccRxDispatcherRegister
- *
- * @param rxQueueId @ref IxAtmRxQueueId [in] indicates which RX queue to has Pdus to process.
- * @param numberOfPdusToProcess unsigned int [in] indicates the minimum number of
- * PDUs available to process all PDUs from the queue.
- * @param reservedPtr unsigned int* [out] pointer to a int location which can
- * be written to, but does not retain written values. This is
- * provided to make this prototype compatible
- * with @a ixAtmdAccRxDispatch()
- *
- * @return @li int - ignored.
- *
- */
-typedef IX_STATUS (*IxAtmdAccRxDispatcher) (IxAtmRxQueueId rxQueueId,
- unsigned int numberOfPdusToProcess,
- unsigned int *reservedPtr);
-
-/* ------------------------------------------------------
- Part of the IxAtmdAcc interface related to TX traffic
- ------------------------------------------------------ */
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @brief Callback prototype for transmitted mbuf when threshold level is
- * crossed.
- *
- * IxAtmdAccTxDoneDispatcher is the prototype of the user function
- * which get called when pdus are completely transmitted. This function
- * is likely to call the @a ixAtmdAccTxDoneDispatch() function.
- *
- * This function is called when the number of available pdus for
- * reception is crossing the threshold level as defined
- * in @a ixAtmdAccTxDoneDispatcherRegister()
- *
- * This function is called inside an Qmgr dispatch context. No system
- * resource or interrupt-unsafe feature should be used inside this
- * callback.
- *
- * Transmitted buffers recycling implementation is a sytem-wide mechanism
- * and needs to be set before any traffic is started. If this threshold
- * mechanism is not used, the user is responsible for polling the
- * transmitted buffers with @a ixAtmdAccTxDoneDispatch()
- * and @a ixAtmdAccTxDoneLevelQuery() functions.
- *
- * @sa ixAtmdAccTxDoneDispatcherRegister
- * @sa ixAtmdAccTxDoneDispatch
- * @sa ixAtmdAccTxDoneLevelQuery
- *
- * @param numberOfPdusToProcess unsigned int [in] - The current number of pdus currently
- * available for recycling
- * @param *reservedPtr unsigned int [out] - pointer to a int location which can be
- * written to but does not retain written values. This is provided
- * to make this prototype compatible
- * with @a ixAtmdAccTxDoneDispatch()
- *
- * @return @li IX_SUCCESS This is provided to make
- * this prototype compatible with @a ixAtmdAccTxDoneDispatch()
- * @return @li IX_FAIL invalid parameters or some unspecified internal
- * error occured. This is provided to make
- * this prototype compatible with @a ixAtmdAccTxDoneDispatch()
- *
- */
-typedef IX_STATUS (*IxAtmdAccTxDoneDispatcher) (unsigned int numberOfPdusToProcess,
- unsigned int *reservedPtr);
-
-/**
-*
-* @ingroup IxAtmdAccCtrlAPI
-*
-* @brief Notification that the threshold number of scheduled cells
-* remains in a port's transmit Q.
-*
-* The is the prototype for of the user notification function which
-* gets called on a per-port basis, when the number of remaining
-* scheduled cells to be transmitted decreases to the threshold level.
-* The number of cells passed as a parameter can be used for scheduling
-* purposes as the maximum number of cells that can be passed in a
-* schedule table to the @a ixAtmdAccPortTxProcess() function.
-*
-* @sa ixAtmdAccPortTxCallbackRegister
-* @sa ixAtmdAccPortTxProcess
-* @sa ixAtmdAccPortTxFreeEntriesQuery
-*
-* @param port @ref IxAtmLogicalPort [in] - logical PHY port [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
-* @param numberOfAvailableCells unsigned int [in] - number of available
-* cell entries.for the port
-*
-* @note - This functions shall not use system resources when used
-* inside an interrupt context.
-*
-*/
-typedef void (*IxAtmdAccPortTxLowCallback) (IxAtmLogicalPort port,
- unsigned int numberOfAvailableCells);
-
-/**
-*
-* @ingroup IxAtmdAccCtrlAPI
-*
-* @brief Prototype to submit cells for transmission
-*
-* IxAtmdAccTxVcDemandUpdateCallback is the prototype of the callback
-* function used by AtmD to notify an ATM Scheduler that the user of
-* a VC has submitted cells for transmission.
-*
-* @sa IxAtmdAccTxVcDemandUpdateCallback
-* @sa IxAtmdAccTxVcDemandClearCallback
-* @sa IxAtmdAccTxSchVcIdGetCallback
-* @sa ixAtmdAccPortTxScheduledModeEnable
-*
-* @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the VC to be updated
-* is established
-* @param vcId int [in] - Identifies the VC to be updated. This is the value
-* returned by the @a IxAtmdAccTxSchVcIdGetCallback() call .
-* @param numberOfCells unsigned int [in] - Indicates how many ATM cells should be added
-* to the queue for this VC.
-*
-* @return @li IX_SUCCESS the function is registering the cell demand for
-* this VC.
-* @return @li IX_FAIL the function cannot register cell for this VC : the
-* scheduler maybe overloaded or misconfigured
-*
-*/
-typedef IX_STATUS (*IxAtmdAccTxVcDemandUpdateCallback) (IxAtmLogicalPort port,
- int vcId,
- unsigned int numberOfCells);
-
-/**
-*
-* @ingroup IxAtmdAccCtrlAPI
-*
-* @brief prototype to remove all currently queued cells from a
-* registered VC
-*
-* IxAtmdAccTxVcDemandClearCallback is the prototype of the function
-* to remove all currently queued cells from a registered VC. The
-* pending cell count for the specified VC is reset to zero. After the
-* use of this callback, the scheduler shall not schedule more cells
-* for this VC.
-*
-* This callback function is called during a VC disconnection
-* @a ixAtmdAccTxVcTryDisconnect()
-*
-* @sa IxAtmdAccTxVcDemandUpdateCallback
-* @sa IxAtmdAccTxVcDemandClearCallback
-* @sa IxAtmdAccTxSchVcIdGetCallback
-* @sa ixAtmdAccPortTxScheduledModeEnable
-* @sa ixAtmdAccTxVcTryDisconnect
-*
-* @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the VC to be cleared
-* is established
-* @param vcId int [in] - Identifies the VC to be cleared. This is the value
-* returned by the @a IxAtmdAccTxSchVcIdGetCallback() call .
-*
-* @return none
-*
-*/
-typedef void (*IxAtmdAccTxVcDemandClearCallback) (IxAtmLogicalPort port,
- int vcId);
-
-/**
-*
-* @ingroup IxAtmdAccCtrlAPI
-*
-* @brief prototype to get a scheduler vc id
-*
-* IxAtmdAccTxSchVcIdGetCallback is the prototype of the function to get
-* a scheduler vcId
-*
-* @sa IxAtmdAccTxVcDemandUpdateCallback
-* @sa IxAtmdAccTxVcDemandClearCallback
-* @sa IxAtmdAccTxSchVcIdGetCallback
-* @sa ixAtmdAccPortTxScheduledModeEnable
-*
-* @param port @ref IxAtmLogicalPort [in] - Specifies the ATM logical port on which the VC is
-* established
-* @param vpi unsigned int [in] - For AAL0/AAL5 specifies the ATM vpi on which the
-* VC is established.
-* For OAM specifies the dedicated "OAM Tx channel" VPI.
-* @param vci unsigned int [in] - For AAL0/AAL5 specifies the ATM vci on which the
-* VC is established.
-* For OAM specifies the dedicated "OAM Tx channel" VCI.
-* @param connId @ref IxAtmConnId [in] - specifies the IxAtmdAcc connection Id already
-* associated with this VC
-* @param vcId int* [out] - pointer to a vcId
-*
-* @return @li IX_SUCCESS the function is returning a Scheduler vcId for this
-* VC
-* @return @li IX_FAIL the function cannot process scheduling for this VC.
-* the contents of vcId is unspecified
-*
-*/
-typedef IX_STATUS (*IxAtmdAccTxSchVcIdGetCallback) (IxAtmLogicalPort port,
- unsigned int vpi,
- unsigned int vci,
- IxAtmConnId connId,
- int *vcId);
-
-/* ------------------------------------------------------
- Part of the IxAtmdAcc interface related to RX traffic
- ------------------------------------------------------ */
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccRxDispatcherRegister (
- IxAtmRxQueueId queueId,
- IxAtmdAccRxDispatcher callback)
- *
- * @brief Register a notification callback to be invoked when there is
- * at least one entry on a particular Rx queue.
- *
- * This function registers a callback to be invoked when there is at
- * least one entry in a particular queue. The registered callback is
- * called every time when the hardware adds one or more pdus to the
- * specified Rx queue.
- *
- * This function cannot be used when a Rx Vc using this queue is
- * already existing.
- *
- * @note -The callback function can be the API function
- * @a ixAtmdAccRxDispatch() : every time the threhold level
- * of the queue is reached, the ixAtmdAccRxDispatch() is
- * invoked to remove all entries from the queue.
- *
- * @sa ixAtmdAccRxDispatch
- * @sa IxAtmdAccRxDispatcher
- *
- * @param queueId @ref IxAtmRxQueueId [in] RX queue identification
- * @param callback @ref IxAtmdAccRxDispatcher [in] function triggering the delivery of incoming
- * traffic. This parameter cannot be a null pointer.
- *
- * @return @li IX_SUCCESS Successful call to @a ixAtmdAccRxDispatcherRegister()
- * @return @li IX_FAIL error in the parameters, or there is an
- * already active RX VC for this queue or some unspecified
- * internal error occurred.
- *
- */
-PUBLIC IX_STATUS ixAtmdAccRxDispatcherRegister (
- IxAtmRxQueueId queueId,
- IxAtmdAccRxDispatcher callback);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccRxDispatch (IxAtmRxQueueId rxQueueId,
- unsigned int numberOfPdusToProcess,
- unsigned int *numberOfPdusProcessedPtr)
- *
- *
- * @brief Control function which executes Rx processing for a particular
- * Rx stream.
- *
- * The @a IxAtmdAccRxDispatch() function is used to process received Pdus
- * available from one of the two incoming RX streams. When this function
- * is invoked, the incoming traffic (up to the number of PDUs passed as
- * a parameter) will be transferred to the IxAtmdAcc users through the
- * callback @a IxAtmdAccRxVcRxCallback(), as registered during the
- * @a ixAtmdAccRxVcConnect() call.
- *
- * The user receive callbacks will be executed in the context of this
- * function.
- *
- * Failing to use this function on a regular basis when there is traffic
- * will block incoming traffic and can result in Pdus being dropped by
- * the hardware.
- *
- * This should be used to control when received pdus are handed off from
- * the hardware to Aal users from a particluar stream. The function can
- * be used from a timer context, or can be registered as a callback in
- * response to an rx stream threshold event, or can be used inside an
- * active polling mechanism which is under user control.
- *
- * @note - The signature of this function is directly compatible with the
- * callback prototype which can be register with @a ixAtmdAccRxDispatcherRegister().
- *
- * @sa ixAtmdAccRxDispatcherRegister
- * @sa IxAtmdAccRxVcRxCallback
- * @sa ixAtmdAccRxVcFreeEntriesQuery
- *
- * @param rxQueueId @ref IxAtmRxQueueId [in] - indicates which RX queue to process.
- * @param numberOfPdusToProcess unsigned int [in] - indicates the maxiumum number of PDU to
- * remove from the RX queue. A value of IX_ATMDACC_ALLPDUS indicates
- * to process all PDUs from the queue. This includes at least the PDUs
- * in the queue when the fuction is invoked. Because of real-time
- * constraints, there is no guarantee thatthe queue will be empty
- * when the function exits. If this parameter is greater than the
- * number of entries of the queues, the function will succeed
- * and the parameter numberOfPdusProcessedPtr will reflect the exact
- * number of PDUs processed.
- * @param *numberOfPdusProcessedPtr unsigned int [out] - indicates the actual number of PDU
- * processed during this call. This parameter cannot be a null
- * pointer.
- *
- * @return @li IX_SUCCESS the number of PDUs as indicated in
- * numberOfPdusProcessedPtr are removed from the RX queue and the VC callback
- * are called.
- * @return @li IX_FAIL invalid parameters or some unspecified internal
- * error occured.
- *
- */
-PUBLIC IX_STATUS ixAtmdAccRxDispatch (IxAtmRxQueueId rxQueueId,
- unsigned int numberOfPdusToProcess,
- unsigned int *numberOfPdusProcessedPtr);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccRxLevelQuery (IxAtmRxQueueId rxQueueId,
- unsigned int *numberOfPdusPtr)
- *
- * @brief Query the number of entries in a particular RX queue.
- *
- * This function is used to retrieve the number of pdus received by
- * the hardware and ready for distribution to users.
- *
- * @param rxQueueId @ref IxAtmRxQueueId [in] - indicates which of two RX queues to query.
- * @param numberOfPdusPtr unsigned int* [out] - Pointer to store the number of available
- * PDUs in the RX queue. This parameter cannot be a null pointer.
- *
- * @return @li IX_SUCCESS the value in numberOfPdusPtr specifies the
- * number of incoming pdus waiting in this queue
- * @return @li IX_FAIL an error occurs during processing.
- * The value in numberOfPdusPtr is unspecified.
- *
- * @note - This function is reentrant, doesn't use system resources
- * and can be used from an interrupt context.
- *
- */
-PUBLIC IX_STATUS ixAtmdAccRxLevelQuery (IxAtmRxQueueId rxQueueId,
- unsigned int *numberOfPdusPtr);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccRxQueueSizeQuery (IxAtmRxQueueId rxQueueId,
- unsigned int *numberOfPdusPtr)
- *
- * @brief Query the size of a particular RX queue.
- *
- * This function is used to retrieve the number of pdus the system is
- * able to queue when reception is complete.
- *
- * @param rxQueueId @ref IxAtmRxQueueId [in] - indicates which of two RX queues to query.
- * @param numberOfPdusPtr unsigned int* [out] - Pointer to store the number of pdus
- * the system is able to queue in the RX queue. This parameter
- * cannot be a null pointer.
- *
- * @return @li IX_SUCCESS the value in numberOfPdusPtr specifies the
- * number of pdus the system is able to queue.
- * @return @li IX_FAIL an error occurs during processing.
- * The value in numberOfPdusPtr is unspecified.
- *
- * @note - This function is reentrant, doesn't use system resources
- * and can be used from an interrupt context.
- *
- */
-PUBLIC IX_STATUS ixAtmdAccRxQueueSizeQuery (IxAtmRxQueueId rxQueueId,
- unsigned int *numberOfPdusPtr);
-
-/* ------------------------------------------------------
- Part of the IxAtmdAcc interface related to TX traffic
- ------------------------------------------------------ */
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccPortTxFreeEntriesQuery (IxAtmLogicalPort port,
- unsigned int *numberOfCellsPtr)
- *
- * @brief Get the number of available cells the system can accept for
- * transmission.
- *
- * The function is used to retrieve the number of cells that can be
- * queued for transmission to the hardware.
- *
- * This number is based on the worst schedule table where one cell
- * is stored in one schedule table entry, depending on the pdus size
- * and mbuf size and fragmentation.
- *
- * This function doesn't use system resources and can be used from a
- * timer context, or can be associated with a threshold event, or can
- * be used inside an active polling mechanism
- *
- * @param port @ref IxAtmLogicalPort [in] - logical PHY port [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
- * @param numberOfCellsPtr unsigned int* [out] - number of available cells.
- * This parameter cannot be a null pointer.
- *
- * @sa ixAtmdAccPortTxProcess
- *
- * @return @li IX_SUCCESS numberOfCellsPtr contains the number of cells that can be scheduled
- * for this port.
- * @return @li IX_FAIL error in the parameters, or some processing error
- * occured.
- *
- */
-PUBLIC IX_STATUS ixAtmdAccPortTxFreeEntriesQuery (IxAtmLogicalPort port,
- unsigned int *numberOfCellsPtr);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccPortTxCallbackRegister (IxAtmLogicalPort port,
- unsigned int numberOfCells,
- IxAtmdAccPortTxLowCallback callback)
- *
- * @brief Configure the Tx port threshold value and register a callback to handle
- * threshold notifications.
- *
- * This function sets the threshold in cells
- *
- * @sa ixAtmdAccPortTxCallbackRegister
- * @sa ixAtmdAccPortTxProcess
- * @sa ixAtmdAccPortTxFreeEntriesQuery
- *
- * @param port @ref IxAtmLogicalPort [in] - logical PHY port [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
- * @param numberOfCells unsigned int [in] - threshold value which triggers the callback
- * invocation, This number has to be one of the
- * values 0,1,2,4,8,16,32 ....
- * The maximum value cannot be more than half of the txVc queue
- * size (which can be retrieved using @a ixAtmdAccPortTxFreeEntriesQuery()
- * before any Tx traffic is sent for this port)
- * @param callback @ref IxAtmdAccPortTxLowCallback [in] - callback function to invoke when the threshold
- * level is reached.
- * This parameter cannot be a null pointer.
- *
- * @return @li IX_SUCCESS Successful call to @a ixAtmdAccPortTxCallbackRegister()
- * @return @li IX_FAIL error in the parameters, Tx channel already set for this port
- * threshold level is not correct or within the range regarding the
- * queue size:or unspecified error during processing:
- *
- * @note - This callback function get called when the threshold level drops from
- * (numberOfCells+1) cells to (numberOfCells) cells
- *
- * @note - This function should be called during system initialisation,
- * outside an interrupt context
- *
- */
-PUBLIC IX_STATUS ixAtmdAccPortTxCallbackRegister (IxAtmLogicalPort port,
- unsigned int numberOfCells,
- IxAtmdAccPortTxLowCallback callback);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccPortTxScheduledModeEnable (IxAtmLogicalPort port,
- IxAtmdAccTxVcDemandUpdateCallback vcDemandUpdateCallback,
- IxAtmdAccTxVcDemandClearCallback vcDemandClearCallback,
- IxAtmdAccTxSchVcIdGetCallback vcIdGetCallback)
- *
- * @brief Put the port into Scheduled Mode
- *
- * This function puts the specified port into scheduled mode of
- * transmission which means an external s/w entity controls the
- * transmission of cells on this port. This faciltates traffic shaping on
- * the port.
- *
- * Any buffers submitted on a VC for this port will be queued in IxAtmdAcc.
- * The transmission of these buffers to and by the hardware will be driven
- * by a transmit schedule submitted regulary in calls to
- * @a ixAtmdAccPortTxProcess() by traffic shaping entity.
- *
- * The transmit schedule is expected to be dynamic in nature based on
- * the demand in cells for each VC on the port. Hence the callback
- * parameters provided to this function allow IxAtmdAcc to inform the
- * shaping entity of demand changes for each VC on the port.
- *
- * By default a port is in Unscheduled Mode so if this function is not
- * called, transmission of data is done without sheduling rules, on a
- * first-come, first-out basis.
- *
- * Once a port is put in scheduled mode it cannot be reverted to
- * un-scheduled mode. Note that unscheduled mode is not supported
- * in ixp425 1.0
- *
- * @note - This function should be called before any VCs have be
- * connected on a port. Otherwise this function call will return failure.
- *
- * @note - This function uses internal locks and should not be called from
- * an interrupt context
- *
- * @sa IxAtmdAccTxVcDemandUpdateCallback
- * @sa IxAtmdAccTxVcDemandClearCallback
- * @sa IxAtmdAccTxSchVcIdGetCallback
- * @sa ixAtmdAccPortTxProcess
- *
- * @param port @ref IxAtmLogicalPort [in] - logical PHY port [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
- * @param vcDemandUpdateCallback @ref IxAtmdAccTxVcDemandUpdateCallback [in] - callback function used to update
- * the number of outstanding cells for transmission. This parameter
- * cannot be a null pointer.
- * @param vcDemandClearCallback @ref IxAtmdAccTxVcDemandClearCallback [in] - callback function used to remove all
- * clear the number of outstanding cells for a VC. This parameter
- * cannot be a null pointer.
- * @param vcIdGetCallback @ref IxAtmdAccTxSchVcIdGetCallback [in] - callback function used to exchange vc
- * Identifiers between IxAtmdAcc and the entity supplying the
- * transmit schedule. This parameter cannot be a null pointer.
- *
- * @return @li IX_SUCCESS scheduler registration is complete and the port
- * is now in scheduled mode.
- * @return @li IX_FAIL failed (wrong parameters, or traffic is already
- * enabled on this port, possibly without ATM shaping)
- *
- */
-PUBLIC IX_STATUS ixAtmdAccPortTxScheduledModeEnable (IxAtmLogicalPort port,
- IxAtmdAccTxVcDemandUpdateCallback vcDemandUpdateCallback,
- IxAtmdAccTxVcDemandClearCallback vcDemandClearCallback,
- IxAtmdAccTxSchVcIdGetCallback vcIdGetCallback);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccPortTxProcess (IxAtmLogicalPort port,
- IxAtmScheduleTable* scheduleTablePtr)
- *
- * @brief Transmit queue cells to the H/W based on the supplied schedule
- * table.
- *
- * This function @a ixAtmdAccPortTxProcess() process the schedule
- * table provided as a parameter to the function. As a result cells are
- * sent to the underlaying hardware for transmission.
- *
- * The schedule table is executed in its entirety or not at all. So the
- * onus is on the caller not to submit a table containing more cells than
- * can be transmitted at that point. The maximum numbers that can be
- * transmitted is guaranteed to be the number of cells as returned by the
- * function @a ixAtmdAccPortTxFreeEntriesQuery().
- *
- * When the scheduler is invoked on a threshold level, IxAtmdAcc gives the
- * minimum number of cells (to ensure the callback will fire again later)
- * and the maximum number of cells that @a ixAtmdAccPortTxProcess()
- * will be able to process (assuming the ATM scheduler is able
- * to produce the worst-case schedule table, i.e. one entry per cell).
- *
- * When invoked ouside a threshold level, the overall number of cells of
- * the schedule table should be less than the number of cells returned
- * by the @a ixAtmdAccPortTxFreeEntriesQuery() function.
- *
- * After invoking the @a ixAtmdAccPortTxProcess() function, it is the
- * user choice to query again the queue level with the function
- * @a ixAtmdAccPortTxFreeEntriesQuery() and, depending on a new cell
- * number, submit an other schedule table.
- *
- * IxAtmdAcc will check that the number of cells in the schedule table
- * is compatible with the current transmit level. If the
- *
- * Obsolete or invalid connection Id will be silently discarded.
- *
- * This function is not reentrant for the same port.
- *
- * This functions doesn't use system resources and can be used inside an
- * interrupt context.
- *
- * This function is used as a response to the hardware requesting more
- * cells to transmit.
- *
- * @sa ixAtmdAccPortTxScheduledModeEnable
- * @sa ixAtmdAccPortTxFreeEntriesQuery
- * @sa ixAtmdAccPortTxCallbackRegister
- * @sa ixAtmdAccPortEnable
- *
- * @param port @ref IxAtmLogicalPort [in] - logical PHY port [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
- * @param scheduleTablePtr @ref IxAtmScheduleTable* [in] - pointer to a scheduler update table. The
- * content of this table is not modified by this function. This
- * parameter cannot be a null pointer.
- *
- * @return @li IX_SUCCESS the schedule table process is complete
- * and cells are transmitted to the hardware
- * @return @li IX_ATMDACC_WARNING : Traffic will be dropped: the schedule table exceed
- * the hardware capacity If this error is ignored, further traffic
- * and schedule will work correctly.
- * Overscheduling does not occur when the schedule table does
- * not contain more entries that the number of free entries returned
- * by @a ixAtmdAccPortTxFreeEntriesQuery().
- * However, Disconnect attempts just after this error will fail permanently
- * with the error code @a IX_ATMDACC_RESOURCES_STILL_ALLOCATED, and it is
- * necessary to disable the port to make @a ixAtmdAccTxVcTryDisconnect()
- * successful.
- * @return @li IX_FAIL a wrong parameter is supplied, or the format of
- * the schedule table is invalid, or the port is not Enabled, or
- * an internal severe error occured. No cells is transmitted to the hardware
- *
- * @note - If the failure is linked to an overschedule of data cells
- * the result is an inconsistency in the output traffic (one or many
- * cells may be missing and the traffic contract is not respected).
- *
- */
-PUBLIC IX_STATUS ixAtmdAccPortTxProcess (IxAtmLogicalPort port,
- IxAtmScheduleTable* scheduleTablePtr);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccTxDoneDispatch (unsigned int numberOfPdusToProcess,
- unsigned int *numberOfPdusProcessedPtr)
- *
- * @brief Process a number of pending transmit done pdus from the hardware.
- *
- * As a by-product of Atm transmit operation buffers which transmission
- * is complete need to be recycled to users. This function is invoked
- * to service the oustanding list of transmitted buffers and pass them
- * to VC users.
- *
- * Users are handed back pdus by invoking the free callback registered
- * during the @a ixAtmdAccTxVcConnect() call.
- *
- * There is a single Tx done stream servicing all active Atm Tx ports
- * which can contain a maximum of 64 entries. If this stream fills port
- * transmission will stop so this function must be call sufficently
- * frequently to ensure no disruption to the transmit operation.
- *
- * This function can be used from a timer context, or can be associated
- * with a TxDone level threshold event (see @a ixAtmdAccTxDoneDispatcherRegister() ),
- * or can be used inside an active polling mechanism under user control.
- *
- * For ease of use the signature of this function is compatible with the
- * TxDone threshold event callback prototype.
- *
- * This functions can be used inside an interrupt context.
- *
- * @sa ixAtmdAccTxDoneDispatcherRegister
- * @sa IxAtmdAccTxVcBufferReturnCallback
- * @sa ixAtmdAccTxDoneLevelQuery
- *
- * @param numberOfPdusToProcess unsigned int [in] - maxiumum number of pdus to remove
- * from the TX Done queue
- * @param *numberOfPdusProcessedPtr unsigned int [out] - number of pdus removed from
- * the TX Done queue. This parameter cannot be a null pointer.
- *
- * @return @li IX_SUCCESS the number of pdus as indicated in
- * numberOfPdusToProcess are removed from the TX Done hardware
- * and passed to the user through the Tx Done callback registered
- * during a call to @a ixAtmdAccTxVcConnect()
- * @return @li IX_FAIL invalid parameters or numberOfPdusProcessedPtr is
- * a null pointer or some unspecified internal error occured.
- *
- */
-PUBLIC IX_STATUS
-ixAtmdAccTxDoneDispatch (unsigned int numberOfPdusToProcess,
- unsigned int *numberOfPdusProcessedPtr);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccTxDoneLevelQuery (unsigned int *numberOfPdusPtr)
- *
- * @brief Query the current number of transmit pdus ready for
- * recycling.
- *
- * This function is used to get the number of transmitted pdus which
- * the hardware is ready to hand back to user.
- *
- * This function can be used from a timer context, or can be associated
- * with a threshold event, on can be used inside an active polling
- * mechanism
- *
- * @sa ixAtmdAccTxDoneDispatch
- *
- * @param *numberOfPdusPtr unsigned int [out] - Pointer to the number of pdus transmitted
- * at the time of this function call, and ready for recycling
- * This parameter cannot be a null pointer.
- *
- * @return @li IX_SUCCESS numberOfPdusPtr contains the number of pdus
- * ready for recycling at the time of this function call
- *
- * @return @li IX_FAIL wrong parameter (null pointer as parameter).or
- * unspecified rocessing error occurs..The value in numberOfPdusPtr
- * is unspecified.
- *
- */
-PUBLIC IX_STATUS
-ixAtmdAccTxDoneLevelQuery (unsigned int *numberOfPdusPtr);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccTxDoneQueueSizeQuery (unsigned int *numberOfPdusPtr)
- *
- * @brief Query the TxDone queue size.
- *
- * This function is used to get the number of pdus which
- * the hardware is able to store after transmission is complete
- *
- * The returned value can be used to set a threshold and enable
- * a callback to be notified when the number of pdus is going over
- * the threshold.
- *
- * @sa ixAtmdAccTxDoneDispatcherRegister
- *
- * @param *numberOfPdusPtr unsigned int [out] - Pointer to the number of pdus the system
- * is able to queue after transmission
- *
- * @return @li IX_SUCCESS numberOfPdusPtr contains the the number of
- * pdus the system is able to queue after transmission
- * @return @li IX_FAIL wrong parameter (null pointer as parameter).or
- * unspecified rocessing error occurs..The value in numberOfPdusPtr
- * is unspecified.
- *
- * @note - This function is reentrant, doesn't use system resources
- * and can be used from an interrupt context.
- */
-PUBLIC IX_STATUS
-ixAtmdAccTxDoneQueueSizeQuery (unsigned int *numberOfPdusPtr);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccTxDoneDispatcherRegister (unsigned int numberOfPdus,
- IxAtmdAccTxDoneDispatcher notificationCallback)
- *
- * @brief Configure the Tx Done stream threshold value and register a
- * callback to handle threshold notifications.
- *
- * This function sets the threshold level in term of number of pdus at
- * which the supplied notification function should be called.
- *
- * The higher the threshold value is, the less events will be necessary
- * to process transmitted buffers.
- *
- * Transmitted buffers recycling implementation is a sytem-wide mechanism
- * and needs to be set prior any traffic is started. If this threshold
- * mechanism is not used, the user is responsible for polling the
- * transmitted buffers thanks to @a ixAtmdAccTxDoneDispatch() and
- * @a ixAtmdAccTxDoneLevelQuery() functions.
- *
- * This function should be called during system initialisation outside
- * an interrupt context
- *
- * @sa ixAtmdAccTxDoneDispatcherRegister
- * @sa ixAtmdAccTxDoneDispatch
- * @sa ixAtmdAccTxDoneLevelQuery
- *
- * @param numberOfPdus unsigned int [in] - The number of TxDone pdus which triggers the
- * callback invocation This number has to be a power of 2, one of the
- * values 0,1,2,4,8,16,32 ...
- * The maximum value cannot be more than half of the txDone queue
- * size (which can be retrieved using @a ixAtmdAccTxDoneQueueSizeQuery())
- * @param notificationCallback @ref IxAtmdAccTxDoneDispatcher [in] - The function to invoke. (This
- * parameter can be @a ixAtmdAccTxDoneDispatch()).This
- * parameter ust not be a null pointer.
- *
- * @return @li IX_SUCCESS Successful call to ixAtmdAccTxDoneDispatcherRegister
- * @return @li IX_FAIL error in the parameters:
- *
- * @note - The notificationCallback will be called exactly when the threshold level
- * will increase from (numberOfPdus) to (numberOfPdus+1)
- *
- * @note - If there is no Tx traffic, there is no guarantee that TxDone Pdus will
- * be released to the user (when txDone level is permanently under the threshold
- * level. One of the preffered way to return resources to the user is to use
- * a mix of txDone notifications, used together with a slow
- * rate timer and an exclusion mechanism protecting from re-entrancy
- *
- * @note - The TxDone threshold will only hand back buffers when the threshold level is
- * crossed. Setting this threshold to a great number reduce the interrupt rate
- * and the cpu load, but also increase the number of outstanding mbufs and has
- * a system wide impact when these mbufs are needed by other components.
- *
- */
-PUBLIC IX_STATUS ixAtmdAccTxDoneDispatcherRegister (unsigned int numberOfPdus,
- IxAtmdAccTxDoneDispatcher notificationCallback);
-
-/* ------------------------------------------------------
- Part of the IxAtmdAcc interface related to Utopia config
- ------------------------------------------------------ */
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @defgroup IxAtmdAccUtopiaCtrlAPI IXP400 ATM Driver Access (IxAtmdAcc) Utopia Control API
- *
- * @brief The public API for the IXP400 Atm Driver Control component
- *
- * IxAtmdAcc is the low level interface by which AAL PDU get
- * transmitted to,and received from the Utopia bus
- *
- * This part is related to the UTOPIA configuration.
- *
- * @{
- */
-
-/**
- *
- * @brief Utopia configuration
- *
- * This structure is used to set the Utopia parameters
- * @li contains the values of Utopia registers, to be set during initialisation
- * @li contains debug commands for NPE, to be used during development steps
- *
- * @note - the exact description of all parameters is done in the Utopia reference
- * documents.
- *
- */
-typedef struct
-{
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtTxConfig_
- * @brief Utopia Tx Config Register
- */
- struct UtTxConfig_
- {
-
- unsigned int reserved_1:1; /**< [31] These bits are always 0.*/
- unsigned int txInterface:1; /**< [30] Utopia Transmit Interface. The following encoding
- * is used to set the Utopia Transmit interface as ATM master
- * or PHY slave:
- * @li 1 - PHY
- * @li 0 - ATM
- */
- unsigned int txMode:1; /**< [29] Utopia Transmit Mode. The following encoding is used
- * to set the Utopia Transmit mode to SPHY or MPHY:
- * @li 1 - SPHY
- * @li 0 - MPHY
- */
- unsigned int txOctet:1; /**< [28] Utopia Transmit cell transfer protocol. Used to set
- * the Utopia cell transfer protocol to Octet-level handshaking.
- * Note this is only applicable in SPHY mode.
- * @li 1 - Octet-handshaking enabled
- * @li 0 - Cell-handshaking enabled
- */
- unsigned int txParity:1; /**< [27] Utopia Transmit parity enabled when set. TxEvenParity
- * defines the parity format odd/even.
- * @li 1 - Enable Parity generation.
- * @li 0 - ut_op_prty held low.
- */
- unsigned int txEvenParity:1; /**< [26] Utopia Transmit Parity Mode
- * @li 1 - Even Parity Generated.
- * @li 0 - Odd Parity Generated.
- */
- unsigned int txHEC:1; /**< [25] Header Error Check Insertion Mode. Specifies if the transmit
- * cell header check byte is calculated and inserted when set.
- * @li 1 - Generate HEC.
- * @li 0 - Disable HEC generation.
- */
- unsigned int txCOSET:1; /**< [24] If enabled the HEC is Exclusive-ORÆed with the value 0x55 before
- * being presented on the Utopia bus.
- * @li 1 - Enable HEC ExOR with value 0x55
- * @li 0 - Use generated HEC value.
- */
-
- unsigned int reserved_2:1; /**< [23] These bits are always 0
- */
- unsigned int txCellSize:7; /**< [22:16] Transmit expected cell size. Configures the cell size
- * for the transmit module: Values between 52-64 are valid.
- */
- unsigned int reserved_3:3; /**< [15:13] These bits are always 0 */
- unsigned int txAddrRange:5; /**< [12:8] When configured as an ATM master in MPHY mode this
- * register specifies the upper limit of the PHY polling logical
- * range. The number of active PHYs are TxAddrRange + 1.
- */
- unsigned int reserved_4:3; /**< [7:5] These bits are always 0 */
- unsigned int txPHYAddr:5; /**< [4:0] When configured as a slave in an MPHY system this register
- * specifies the physical address of the PHY.
- */
- }
-
- utTxConfig; /**< Tx config Utopia register */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtTxStatsConfig_
- * @brief Utopia Tx stats Register
- */
- struct UtTxStatsConfig_
- {
-
- unsigned int vpi:12; /**< [31:20] ATM VPI [11:0] OR GFC [3:0] and VPI [7:0]
- @li Note: if VCStatsTxGFC is set to 0 the GFC field is ignored in test. */
-
- unsigned int vci:16; /**< [19:4] ATM VCI [15:0] or PHY Address[4] */
-
- unsigned int pti:3; /**< [3:1] ATM PTI [2:0] or PHY Address[3:1]
- @li Note: if VCStatsTxPTI is set to 0 the PTI field is ignored in test.
- @li Note: if VCStatsTxEnb is set to 0 only the transmit PHY port
- address as defined by this register is used for ATM statistics [4:0]. */
-
- unsigned int clp:1; /**< [0] ATM CLP or PHY Address [0]
- @li Note: if VCStatsTxCLP is set to 0 the CLP field is ignored in test.
- @li Note: if VCStatsTxEnb is set to 0 only the transmit PHY port
- address as defined by this register is used for ATM statistics [4:0]. */
- }
-
- utTxStatsConfig; /**< Tx stats config Utopia register */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtTxDefineIdle_
- * @brief Utopia Tx idle cells Register
- */
- struct UtTxDefineIdle_
- {
-
- unsigned int vpi:12; /**< [31:20] ATM VPI [11:0] OR GFC [3:0] and VPI [7:0]
- @li Note: if VCIdleTxGFC is set to 0 the GFC field is ignored in test. */
-
- unsigned int vci:16; /**< [19:4] ATM VCI [15:0] */
-
- unsigned int pti:3; /**< [3:1] ATM PTI PTI [2:0]
- @li Note: if VCIdleTxPTI is set to 0 the PTI field is ignored in test.*/
-
- unsigned int clp:1; /**< [0] ATM CLP [0]
- @li Note: if VCIdleTxCLP is set to 0 the CLP field is ignored in test.*/
- }
-
- utTxDefineIdle; /**< Tx idle cell config Utopia register */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtTxEnableFields_
- * @brief Utopia Tx ienable fields Register
- */
- struct UtTxEnableFields_
- {
-
- unsigned int defineTxIdleGFC:1; /**< [31] This register is used to include or exclude the GFC
- field of the ATM header when testing for Idle cells.
- @li 1 - GFC field is valid.
- @li 0 - GFC field ignored.*/
-
- unsigned int defineTxIdlePTI:1; /**< [30] This register is used to include or exclude the PTI
- field of the ATM header when testing for Idle cells.
- @li 1 - PTI field is valid
- @li 0 - PTI field ignored.*/
-
- unsigned int defineTxIdleCLP:1; /**< [29] This register is used to include or
- exclude the CLP field of the ATM header when testing for Idle cells.
- @li 1 - CLP field is valid.
- @li 0 - CLP field ignored. */
-
- unsigned int phyStatsTxEnb:1; /**< [28] This register is used to enable or disable ATM
- statistics gathering based on the specified PHY address as defined
- in TxStatsConfig register.
- @li 1 - Enable statistics for specified transmit PHY address.
- @li 0 - Disable statistics for specified transmit PHY address. */
-
- unsigned int vcStatsTxEnb:1; /**< [27] This register is used to change the ATM
- statistics-gathering mode from the specified logical PHY address
- to a specific VPI/VCI address.
- @li 1 - Enable statistics for specified VPI/VCI address.
- @li 0 - Disable statistics for specified VPI/VCI address */
-
- unsigned int vcStatsTxGFC:1; /**< [26] This register is used to include or exclude the GFC
- field of the ATM header when ATM VPI/VCI statistics are enabled.
- GFC is only available at the UNI and uses the first 4-bits of
- the VPI field.
- @li 1 - GFC field is valid
- @li 0 - GFC field ignored.*/
-
- unsigned int vcStatsTxPTI:1; /**< [25] This register is used to include or exclude the PTI
- field of the ATM header when ATM VPI/VCI statistics are enabled.
- @li 1 - PTI field is valid
- @li 0 - PTI field ignored.*/
-
- unsigned int vcStatsTxCLP:1; /**< [24] This register is used to include or exclude the CLP
- field of the ATM header when ATM VPI/VCI statistics are enabled.
- @li 1 - CLP field is valid
- @li 0 - CLP field ignored. */
-
- unsigned int reserved_1:3; /**< [23-21] These bits are always 0 */
-
- unsigned int txPollStsInt:1; /**< [20] Enable the assertion of the ucp_tx_poll_sts condition
- where there is a change in polling status.
- @li 1 - ucp_tx_poll_sts asserted whenever there is a change in status
- @li 0 - ucp_tx_poll_sts asserted if ANY transmit PHY is available
- */
- unsigned int txCellOvrInt:1; /**< [19] Enable TxCellCount overflow CBI Transmit Status condition
- assertion.
- @li 1 - If TxCellCountOvr is set assert the Transmit Status Condition.
- @li 0 - No CBI Transmit Status condition assertion */
-
- unsigned int txIdleCellOvrInt:1; /**< [18] Enable TxIdleCellCount overflow Transmit Status Condition
- @li 1 - If TxIdleCellCountOvr is set assert the Transmit Status Condition
- @li 0 - No CBI Transmit Status condition assertion..*/
-
- unsigned int enbIdleCellCnt:1; /**< [17] Enable Transmit Idle Cell Count.
- @li 1 - Enable count of Idle cells transmitted.
- @li 0 - No count is maintained. */
-
- unsigned int enbTxCellCnt:1; /**< [16] Enable Transmit Valid Cell Count of non-idle/non-error cells
- @li 1 - Enable count of valid cells transmitted- non-idle/non-error
- @li 0 - No count is maintained.*/
-
- unsigned int reserved_2:16; /**< [15:0] These bits are always 0 */
- } utTxEnableFields; /**< Tx enable Utopia register */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtTxTransTable0_
- * @brief Utopia Tx translation table Register
- */
- struct UtTxTransTable0_
- {
-
- unsigned int phy0:5; /**< [31-27] Tx Mapping value of logical phy 0 */
-
- unsigned int phy1:5; /**< [26-22] Tx Mapping value of logical phy 1 */
-
- unsigned int phy2:5; /**< [21-17] Tx Mapping value of logical phy 2 */
-
- unsigned int reserved_1:1; /**< [16] These bits are always 0.*/
-
- unsigned int phy3:5; /**< [15-11] Tx Mapping value of logical phy 3 */
-
- unsigned int phy4:5; /**< [10-6] Tx Mapping value of logical phy 4 */
-
- unsigned int phy5:5; /**< [5-1] Tx Mapping value of logical phy 5 */
-
- unsigned int reserved_2:1; /**< [0] These bits are always 0 */
- } utTxTransTable0; /**< Tx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtTxTransTable1_
- * @brief Utopia Tx translation table Register
- */
- struct UtTxTransTable1_
- {
-
- unsigned int phy6:5; /**< [31-27] Tx Mapping value of logical phy 6 */
-
- unsigned int phy7:5; /**< [26-22] Tx Mapping value of logical phy 7 */
-
- unsigned int phy8:5; /**< [21-17] Tx Mapping value of logical phy 8 */
-
- unsigned int reserved_1:1; /**< [16-0] These bits are always 0 */
-
- unsigned int phy9:5; /**< [15-11] Tx Mapping value of logical phy 3 */
-
- unsigned int phy10:5; /**< [10-6] Tx Mapping value of logical phy 4 */
-
- unsigned int phy11:5; /**< [5-1] Tx Mapping value of logical phy 5 */
-
- unsigned int reserved_2:1; /**< [0] These bits are always 0 */
- } utTxTransTable1; /**< Tx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtTxTransTable2_
- * @brief Utopia Tx translation table Register
- */
- struct UtTxTransTable2_
- {
-
- unsigned int phy12:5; /**< [31-27] Tx Mapping value of logical phy 6 */
-
- unsigned int phy13:5; /**< [26-22] Tx Mapping value of logical phy 7 */
-
- unsigned int phy14:5; /**< [21-17] Tx Mapping value of logical phy 8 */
-
- unsigned int reserved_1:1; /**< [16-0] These bits are always 0 */
-
- unsigned int phy15:5; /**< [15-11] Tx Mapping value of logical phy 3 */
-
- unsigned int phy16:5; /**< [10-6] Tx Mapping value of logical phy 4 */
-
- unsigned int phy17:5; /**< [5-1] Tx Mapping value of logical phy 5 */
-
- unsigned int reserved_2:1; /**< [0] These bits are always 0 */
- } utTxTransTable2; /**< Tx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtTxTransTable3_
- * @brief Utopia Tx translation table Register
- */
- struct UtTxTransTable3_
- {
-
- unsigned int phy18:5; /**< [31-27] Tx Mapping value of logical phy 6 */
-
- unsigned int phy19:5; /**< [26-22] Tx Mapping value of logical phy 7 */
-
- unsigned int phy20:5; /**< [21-17] Tx Mapping value of logical phy 8 */
-
- unsigned int reserved_1:1; /**< [16-0] These bits are always 0 */
-
- unsigned int phy21:5; /**< [15-11] Tx Mapping value of logical phy 3 */
-
- unsigned int phy22:5; /**< [10-6] Tx Mapping value of logical phy 4 */
-
- unsigned int phy23:5; /**< [5-1] Tx Mapping value of logical phy 5 */
-
- unsigned int reserved_2:1; /**< [0] These bits are always 0 */
- } utTxTransTable3; /**< Tx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtTxTransTable4_
- * @brief Utopia Tx translation table Register
- */
- struct UtTxTransTable4_
- {
-
- unsigned int phy24:5; /**< [31-27] Tx Mapping value of logical phy 6 */
-
- unsigned int phy25:5; /**< [26-22] Tx Mapping value of logical phy 7 */
-
- unsigned int phy26:5; /**< [21-17] Tx Mapping value of logical phy 8 */
-
- unsigned int reserved_1:1; /**< [16-0] These bits are always 0 */
-
- unsigned int phy27:5; /**< [15-11] Tx Mapping value of logical phy 3 */
-
- unsigned int phy28:5; /**< [10-6] Tx Mapping value of logical phy 4 */
-
- unsigned int phy29:5; /**< [5-1] Tx Mapping value of logical phy 5 */
-
- unsigned int reserved_2:1; /**< [0] These bits are always 0 */
- } utTxTransTable4; /**< Tx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtTxTransTable5_
- * @brief Utopia Tx translation table Register
- */
- struct UtTxTransTable5_
- {
-
- unsigned int phy30:5; /**< [31-27] Tx Mapping value of logical phy 6 */
-
- unsigned int reserved_1:27; /**< [26-0] These bits are always 0 */
-
- } utTxTransTable5; /**< Tx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtRxConfig_
- * @brief Utopia Rx config Register
- */
- struct UtRxConfig_
- {
-
- unsigned int rxInterface:1; /**< [31] Utopia Receive Interface. The following encoding is used
- to set the Utopia Receive interface as ATM master or PHY slave:
- @li 1 - PHY
- @li 0 - ATM */
-
- unsigned int rxMode:1; /**< [30] Utopia Receive Mode. The following encoding is used to set
- the Utopia Receive mode to SPHY or MPHY:
- @li 1 - SPHY
- @li 0 - MPHY */
-
- unsigned int rxOctet:1; /**< [29] Utopia Receive cell transfer protocol. Used to set the Utopia
- cell transfer protocol to Octet-level handshaking. Note this is only
- applicable in SPHY mode.
- @li 1 - Octet-handshaking enabled
- @li 0 - Cell-handshaking enabled */
-
- unsigned int rxParity:1; /**< [28] Utopia Receive Parity Checking enable.
- @li 1 - Parity checking enabled
- @li 0 - Parity checking disabled */
-
- unsigned int rxEvenParity:1;/**< [27] Utopia Receive Parity Mode
- @li 1 - Check for Even Parity
- @li 0 - Check for Odd Parity.*/
-
- unsigned int rxHEC:1; /**< [26] RxHEC Header Error Check Mode. Enables/disables cell header
- error checking on the received cell header.
- @li 1 - HEC checking enabled
- @li 0 - HEC checking disabled */
-
- unsigned int rxCOSET:1; /**< [25] If enabled the HEC is Exclusive-ORÆed with the value 0x55
- before being tested with the received HEC.
- @li 1 - Enable HEC ExOR with value 0x55.
- @li 0 - Use generated HEC value.*/
-
- unsigned int rxHECpass:1; /**< [24] Specifies if the incoming cell HEC byte should be transferred
- after optional processing to the NPE2 Coprocessor Bus Interface or
- if it should be discarded.
- @li 1 - HEC maintained 53-byte/UDC cell sent to NPE2.
- @li 0 - HEC discarded 52-byte/UDC cell sent to NPE2 coprocessor.*/
-
- unsigned int reserved_1:1; /**< [23] These bits are always 0 */
-
- unsigned int rxCellSize:7; /**< [22:16] Receive cell size. Configures the receive cell size.
- Values between 52-64 are valid */
-
- unsigned int rxHashEnbGFC:1; /**< [15] Specifies if the VPI field [11:8]/GFC field should be
- included in the Hash data input or if the bits should be padded
- with 1Æb0.
- @li 1 - VPI [11:8]/GFC field valid and used in Hash residue calculation.
- @li 0 - VPI [11:8]/GFC field padded with 1Æb0 */
-
- unsigned int rxPreHash:1; /**< [14] Enable Pre-hash value generation. Specifies if the
- incoming cell data should be pre-hashed to allow VPI/VCI header look-up
- in a hash table.
- @li 1 - Pre-hashing enabled
- @li 0 - Pre-hashing disabled */
-
- unsigned int reserved_2:1; /**< [13] These bits are always 0 */
-
- unsigned int rxAddrRange:5; /**< [12:8] In ATM master, MPHY mode,
- * this register specifies the upper
- * limit of the PHY polling logical range. The number of active PHYs are
- * RxAddrRange + 1.
- */
- unsigned int reserved_3:3; /**< [7-5] These bits are always 0 .*/
- unsigned int rxPHYAddr:5; /**< [4:0] When configured as a slave in an MPHY system this register
- * specifies the physical address of the PHY.
- */
- } utRxConfig; /**< Rx config Utopia register */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtRxStatsConfig_
- * @brief Utopia Rx stats config Register
- */
- struct UtRxStatsConfig_
- {
-
- unsigned int vpi:12; /**< [31:20] ATM VPI VPI [11:0] OR GFC [3:0] and VPI [7:0]
- @li Note: if VCStatsRxGFC is set to 0 the GFC field is ignored in test. */
-
- unsigned int vci:16; /**< [19:4] VCI [15:0] or PHY Address [4] */
-
- unsigned int pti:3; /**< [3:1] PTI [2:0] or or PHY Address [3:1]
- @li Note: if VCStatsRxPTI is set to 0 the PTI field is ignored in test.
- @li Note: if VCStatsRxEnb is set to 0 only the PHY port address is used
- for statistics gathering.. */
-
- unsigned int clp:1; /**< [0] CLP [0] or PHY Address [0]
- @li Note: if VCStatsRxCLP is set to 0 the CLP field is ignored in test.
- @li Note: if VCStatsRxEnb is set to 0 only the PHY port address is used
- for statistics gathering.. */
- } utRxStatsConfig; /**< Rx stats config Utopia register */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtRxDefineIdle_
- * @brief Utopia Rx idle cells config Register
- */
- struct UtRxDefineIdle_
- {
-
- unsigned int vpi:12; /**< [31:20] ATM VPI [11:0] OR GFC [3:0] and VPI [7:0]
- @li Note: if VCIdleRxGFC is set to 0 the GFC field is ignored in test. */
-
- unsigned int vci:16; /**< [19:4] ATM VCI [15:0] */
-
- unsigned int pti:3; /**< [3:1] ATM PTI PTI [2:0]
- @li Note: if VCIdleRxPTI is set to 0 the PTI field is ignored in test.*/
-
- unsigned int clp:1; /**< [0] ATM CLP [0]
- @li Note: if VCIdleRxCLP is set to 0 the CLP field is ignored in test.*/
- } utRxDefineIdle; /**< Rx idle cell config Utopia register */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtRxEnableFields_
- * @brief Utopia Rx enable Register
- */
- struct UtRxEnableFields_
- {
-
- unsigned int defineRxIdleGFC:1;/**< [31] This register is used to include or exclude the GFC
- field of the ATM header when testing for Idle cells.
- @li 1 - GFC field is valid.
- @li 0 - GFC field ignored.*/
-
- unsigned int defineRxIdlePTI:1;/**< [30] This register is used to include or exclude the PTI
- field of the ATM header when testing for Idle cells.
- @li 1 - PTI field is valid.
- @li 0 - PTI field ignored.*/
-
- unsigned int defineRxIdleCLP:1;/**< [29] This register is used to include or exclude the CLP
- field of the ATM header when testing for Idle cells.
- @li 1 - CLP field is valid.
- @li 0 - CLP field ignored.*/
-
- unsigned int phyStatsRxEnb:1;/**< [28] This register is used to enable or disable ATM statistics
- gathering based on the specified PHY address as defined in RxStatsConfig
- register.
- @li 1 - Enable statistics for specified receive PHY address.
- @li 0 - Disable statistics for specified receive PHY address.*/
-
- unsigned int vcStatsRxEnb:1;/**< [27] This register is used to enable or disable ATM statistics
- gathering based on a specific VPI/VCI address.
- @li 1 - Enable statistics for specified VPI/VCI address.
- @li 0 - Disable statistics for specified VPI/VCI address.*/
-
- unsigned int vcStatsRxGFC:1;/**< [26] This register is used to include or exclude the GFC field
- of the ATM header when ATM VPI/VCI statistics are enabled. GFC is only
- available at the UNI and uses the first 4-bits of the VPI field.
- @li 1 - GFC field is valid.
- @li 0 - GFC field ignored. */
-
- unsigned int vcStatsRxPTI:1;/**< [25] This register is used to include or exclude the PTI field
- of the ATM header when ATM VPI/VCI statistics are enabled.
- @li 1 - PTI field is valid.
- @li 0 - PTI field ignored.*/
-
- unsigned int vcStatsRxCLP:1;/**< [24] This register is used to include or exclude the CLP field
- of the ATM header when ATM VPI/VCI statistics are enabled.
- @li 1 - CLP field is valid.
- @li 0 - CLP field ignored. */
-
- unsigned int discardHecErr:1;/**< [23] Discard cells with an invalid HEC.
- @li 1 - Discard cells with HEC errors
- @li 0 - Cells with HEC errors are passed */
-
- unsigned int discardParErr:1;/**< [22] Discard cells containing parity errors.
- @li 1 - Discard cells with parity errors
- @li 0 - Cells with parity errors are passed */
-
- unsigned int discardIdle:1; /**< [21] Discard Idle Cells based on DefineIdle register values
- @li 1 - Discard IDLE cells
- @li 0 - IDLE cells passed */
-
- unsigned int enbHecErrCnt:1;/**< [20] Enable Receive HEC Error Count.
- @li 1 - Enable count of received cells containing HEC errors
- @li 0 - No count is maintained. */
-
- unsigned int enbParErrCnt:1;/**< [19] Enable Parity Error Count
- @li 1 - Enable count of received cells containing Parity errors
- @li 0 - No count is maintained. */
-
- unsigned int enbIdleCellCnt:1;/**< [18] Enable Receive Idle Cell Count.
- @li 1 - Enable count of Idle cells received.
- @li 0 - No count is maintained.*/
-
- unsigned int enbSizeErrCnt:1;/**< [17] Enable Receive Size Error Count.
- @li 1 - Enable count of received cells of incorrect size
- @li 0 - No count is maintained. */
-
- unsigned int enbRxCellCnt:1;/**< [16] Enable Receive Valid Cell Count of non-idle/non-error cells.
- @li 1 - Enable count of valid cells received - non-idle/non-error
- @li 0 - No count is maintained. */
-
- unsigned int reserved_1:3; /**< [15:13] These bits are always 0 */
-
- unsigned int rxCellOvrInt:1; /**< [12] Enable CBI Utopia Receive Status Condition if the RxCellCount
- register overflows.
- @li 1 - CBI Receive Status asserted.
- @li 0 - No CBI Receive Status asserted.*/
-
- unsigned int invalidHecOvrInt:1; /**< [11] Enable CBI Receive Status Condition if the InvalidHecCount
- register overflows.
- @li 1 - CBI Receive Condition asserted.
- @li 0 - No CBI Receive Condition asserted */
-
- unsigned int invalidParOvrInt:1; /**< [10] Enable CBI Receive Status Condition if the InvalidParCount
- register overflows
- @li 1 - CBI Receive Condition asserted.
- @li 0 - No CBI Receive Condition asserted */
-
- unsigned int invalidSizeOvrInt:1; /**< [9] Enable CBI Receive Status Condition if the InvalidSizeCount
- register overflows.
- @li 1 - CBI Receive Status Condition asserted.
- @li¸0 - No CBI Receive Status asserted */
-
- unsigned int rxIdleOvrInt:1; /**< [8] Enable CBI Receive Status Condition if the RxIdleCount overflows.
- @li 1 - CBI Receive Condition asserted.
- @li 0 - No CBI Receive Condition asserted */
-
- unsigned int reserved_2:3; /**< [7:5] These bits are always 0 */
-
- unsigned int rxAddrMask:5; /**< [4:0] This register is used as a mask to allow the user to increase
- the PHY receive address range. The register should be programmed with
- the address-range limit, i.e. if set to 0x3 the address range increases
- to a maximum of 4 addresses. */
- } utRxEnableFields; /**< Rx enable Utopia register */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtRxTransTable0_
- * @brief Utopia Rx translation table Register
- */
- struct UtRxTransTable0_
- {
-
- unsigned int phy0:5; /**< [31-27] Rx Mapping value of logical phy 0 */
-
- unsigned int phy1:5; /**< [26-22] Rx Mapping value of logical phy 1 */
-
- unsigned int phy2:5; /**< [21-17] Rx Mapping value of logical phy 2 */
-
- unsigned int reserved_1:1; /**< [16] These bits are always 0 */
-
- unsigned int phy3:5; /**< [15-11] Rx Mapping value of logical phy 3 */
-
- unsigned int phy4:5; /**< [10-6] Rx Mapping value of logical phy 4 */
-
- unsigned int phy5:5; /**< [5-1] Rx Mapping value of logical phy 5 */
-
- unsigned int reserved_2:1; /**< [0] These bits are always 0 */
- }
-
- utRxTransTable0; /**< Rx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtRxTransTable1_
- * @brief Utopia Rx translation table Register
- */
- struct UtRxTransTable1_
- {
-
- unsigned int phy6:5; /**< [31-27] Rx Mapping value of logical phy 6 */
-
- unsigned int phy7:5; /**< [26-22] Rx Mapping value of logical phy 7 */
-
- unsigned int phy8:5; /**< [21-17] Rx Mapping value of logical phy 8 */
-
- unsigned int reserved_1:1; /**< [16-0] These bits are always 0 */
-
- unsigned int phy9:5; /**< [15-11] Rx Mapping value of logical phy 3 */
-
- unsigned int phy10:5; /**< [10-6] Rx Mapping value of logical phy 4 */
-
- unsigned int phy11:5; /**< [5-1] Rx Mapping value of logical phy 5 */
-
- unsigned int reserved_2:1; /**< [0] These bits are always 0 */
- }
-
- utRxTransTable1; /**< Rx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtRxTransTable2_
- * @brief Utopia Rx translation table Register
- */
- struct UtRxTransTable2_
- {
-
- unsigned int phy12:5; /**< [31-27] Rx Mapping value of logical phy 6 */
-
- unsigned int phy13:5; /**< [26-22] Rx Mapping value of logical phy 7 */
-
- unsigned int phy14:5; /**< [21-17] Rx Mapping value of logical phy 8 */
-
- unsigned int reserved_1:1; /**< [16-0] These bits are always 0 */
-
- unsigned int phy15:5; /**< [15-11] Rx Mapping value of logical phy 3 */
-
- unsigned int phy16:5; /**< [10-6] Rx Mapping value of logical phy 4 */
-
- unsigned int phy17:5; /**< [5-1] Rx Mapping value of logical phy 5 */
-
- unsigned int reserved_2:1; /**< [0] These bits are always 0 */
- } utRxTransTable2; /**< Rx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtRxTransTable3_
- * @brief Utopia Rx translation table Register
- */
- struct UtRxTransTable3_
- {
-
- unsigned int phy18:5; /**< [31-27] Rx Mapping value of logical phy 6 */
-
- unsigned int phy19:5; /**< [26-22] Rx Mapping value of logical phy 7 */
-
- unsigned int phy20:5; /**< [21-17] Rx Mapping value of logical phy 8 */
-
- unsigned int reserved_1:1; /**< [16-0] These bits are always 0 */
-
- unsigned int phy21:5; /**< [15-11] Rx Mapping value of logical phy 3 */
-
- unsigned int phy22:5; /**< [10-6] Rx Mapping value of logical phy 4 */
-
- unsigned int phy23:5; /**< [5-1] Rx Mapping value of logical phy 5 */
-
- unsigned int reserved_2:1; /**< [0] These bits are always 0 */
- } utRxTransTable3; /**< Rx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtRxTransTable4_
- * @brief Utopia Rx translation table Register
- */
- struct UtRxTransTable4_
- {
-
- unsigned int phy24:5; /**< [31-27] Rx Mapping value of logical phy 6 */
-
- unsigned int phy25:5; /**< [26-22] Rx Mapping value of logical phy 7 */
-
- unsigned int phy26:5; /**< [21-17] Rx Mapping value of logical phy 8 */
-
- unsigned int reserved_1:1; /**< [16-0] These bits are always 0 */
-
- unsigned int phy27:5; /**< [15-11] Rx Mapping value of logical phy 3 */
-
- unsigned int phy28:5; /**< [10-6] Rx Mapping value of logical phy 4 */
-
- unsigned int phy29:5; /**< [5-1] Rx Mapping value of logical phy 5 */
-
- unsigned int reserved_2:1; /**< [0] These bits are always 0 */
- } utRxTransTable4; /**< Rx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtRxTransTable5_
- * @brief Utopia Rx translation table Register
- */
- struct UtRxTransTable5_
- {
-
- unsigned int phy30:5; /**< [31-27] Rx Mapping value of logical phy 6 */
-
- unsigned int reserved_1:27; /**< [26-0] These bits are always 0 */
-
- } utRxTransTable5; /**< Rx translation table */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtSysConfig_
- * @brief NPE setup Register
- */
- struct UtSysConfig_
- {
-
- unsigned int reserved_1:2; /**< [31-30] These bits are always 0 */
- unsigned int txEnbFSM:1; /**< [29] Enables the operation ofthe Utopia Transmit FSM
- * @li 1 - FSM enabled
- * @li 0 - FSM inactive
- */
- unsigned int rxEnbFSM:1; /**< [28] Enables the operation ofthe Utopia Revieve FSM
- * @li 1 - FSM enabled
- * @li 0 - FSM inactive
- */
- unsigned int disablePins:1; /**< [27] Disable Utopia interface I/O pins forcing the signals to an
- * inactive state. Note that this bit is set on reset and must be
- * de-asserted
- * @li 0 - Normal data transfer
- * @li 1 - Utopia interface pins are forced inactive
- */
- unsigned int tstLoop:1; /**< [26] Test Loop Back Enable.
- * @li Note: For loop back to function RxMode and Tx Mode must both be set
- * to single PHY mode.
- * @li 0 - Loop back
- * @li 1 - Normal operating mode
- */
-
- unsigned int txReset:1; /**< [25] Resets the Utopia Coprocessor transmit module to a known state.
- * @li Note: All transmit configuration and status registers will be reset
- * to their reset values.
- * @li 0 - Normal operating mode¸
- * @li 1 - Reset transmit modules
- */
-
- unsigned int rxReset:1; /**< [24] Resets the Utopia Coprocessor receive module to a known state.
- * @li Note: All receive configuration and status registers will be reset
- * to their reset values.
- * @li 0 - Normal operating mode
- * @li 1 - Reset receive modules
- */
-
- unsigned int reserved_2:24; /**< [23-0] These bits are always 0 */
- } utSysConfig; /**< NPE debug config */
-
-}
-IxAtmdAccUtopiaConfig;
-
-/**
-*
-* @brief Utopia status
-*
-* This structure is used to set/get the Utopia status parameters
-* @li contains debug cell counters, to be accessed during a read operation
-*
-* @note - the exact description of all parameters is done in the Utopia reference
-* documents.
-*
-*/
-typedef struct
-{
-
- unsigned int utTxCellCount; /**< count of cells transmitted */
-
- unsigned int utTxIdleCellCount; /**< count of idle cells transmitted */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtTxCellConditionStatus_
- * @brief Utopia Tx Status Register
- */
- struct UtTxCellConditionStatus_
- {
-
- unsigned int reserved_1:2; /**< [31:30] These bits are always 0 */
- unsigned int txFIFO2Underflow:1; /**< [29] This bit is set if 64-byte
- * Transmit FIFO2 indicates a FIFO underflow
- * error condition.
- */
- unsigned int txFIFO1Underflow:1; /**< [28] This bit is set if
- * 64-byte Transmit FIFO1 indicates a FIFO
- * underflow error condition.
- */
- unsigned int txFIFO2Overflow:1; /**< [27] This bit is set if 64-byte
- * Transmit FIFO2 indicates a FIFO overflow
- * error condition.
- */
- unsigned int txFIFO1Overflow:1; /**< [26] This bit is set if 64-byte
- * Transmit FIFO1 indicates a FIFO overflow
- * error condition.
- */
- unsigned int txIdleCellCountOvr:1; /**< [25] This bit is set if the
- * TxIdleCellCount register overflows.
- */
- unsigned int txCellCountOvr:1; /**< [24] This bit is set if the
- * TxCellCount register overflows
- */
- unsigned int reserved_2:24; /**< [23:0] These bits are always 0 */
- } utTxCellConditionStatus; /**< Tx cells condition status */
-
- unsigned int utRxCellCount; /**< count of cell received */
- unsigned int utRxIdleCellCount; /**< count of idle cell received */
- unsigned int utRxInvalidHECount; /**< count of invalid cell
- * received because of HEC errors
- */
- unsigned int utRxInvalidParCount; /**< count of invalid cell received
- * because of parity errors
- */
- unsigned int utRxInvalidSizeCount; /**< count of invalid cell
- * received because of cell
- * size errors
- */
-
- /**
- * @ingroup IxAtmdAccUtopiaCtrlAPI
- * @struct UtRxCellConditionStatus_
- * @brief Utopia Rx Status Register
- */
- struct UtRxCellConditionStatus_
- {
-
- unsigned int reserved_1:3; /**< [31:29] These bits are always 0.*/
- unsigned int rxCellCountOvr:1; /**< [28] This bit is set if the RxCellCount register overflows. */
- unsigned int invalidHecCountOvr:1; /**< [27] This bit is set if the InvalidHecCount register overflows.*/
- unsigned int invalidParCountOvr:1; /**< [26] This bit is set if the InvalidParCount register overflows.*/
- unsigned int invalidSizeCountOvr:1; /**< [25] This bit is set if the InvalidSizeCount register overflows.*/
- unsigned int rxIdleCountOvr:1; /**< [24] This bit is set if the RxIdleCount register overflows.*/
- unsigned int reserved_2:4; /**< [23:20] These bits are always 0 */
- unsigned int rxFIFO2Underflow:1; /**< [19] This bit is set if 64-byte Receive FIFO2
- * indicates a FIFO underflow error condition.
- */
- unsigned int rxFIFO1Underflow:1; /**< [18] This bit is set if 64-byte Receive
- * FIFO1 indicates a FIFO underflow error condition
- . */
- unsigned int rxFIFO2Overflow:1; /**< [17] This bit is set if 64-byte Receive FIFO2
- * indicates a FIFO overflow error condition.
- */
- unsigned int rxFIFO1Overflow:1; /**< [16] This bit is set if 64-byte Receive FIFO1
- * indicates a FIFO overflow error condition.
- */
- unsigned int reserved_3:16; /**< [15:0] These bits are always 0. */
- } utRxCellConditionStatus; /**< Rx cells condition status */
-
-} IxAtmdAccUtopiaStatus;
-
-/**
- * @} defgroup IxAtmdAccUtopiaCtrlAPI
- */
-
- /**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccUtopiaConfigSet (const IxAtmdAccUtopiaConfig *
- ixAtmdAccUtopiaConfigPtr)
- *
- * @brief Send the configuration structure to the Utopia interface
- *
- * This function downloads the @a IxAtmdAccUtopiaConfig structure to
- * the Utopia and has the following effects
- * @li setup the Utopia interface
- * @li initialise the NPE
- * @li reset the Utopia cell counters and status registers to known values
- *
- * This action has to be done once at initialisation. A lock is preventing
- * the concurrent use of @a ixAtmdAccUtopiaStatusGet() and
- * @A ixAtmdAccUtopiaConfigSet()
- *
- * @param *ixAtmdAccNPEConfigPtr @ref IxAtmdAccUtopiaConfig [in] - pointer to a structure to download to
- * Utopia. This parameter cannot be a null pointer.
- *
- * @return @li IX_SUCCESS successful download
- * @return @li IX_FAIL error in the parameters, or configuration is not
- * complete or failed
- *
- * @sa ixAtmdAccUtopiaStatusGet
- *
- */
-PUBLIC IX_STATUS ixAtmdAccUtopiaConfigSet (const IxAtmdAccUtopiaConfig *
- ixAtmdAccUtopiaConfigPtr);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccUtopiaStatusGet (IxAtmdAccUtopiaStatus *
- ixAtmdAccUtopiaStatus)
- *
- * @brief Get the Utopia interface configuration.
- *
- * This function reads the Utopia registers and the Cell counts
- * and fills the @a IxAtmdAccUtopiaStatus structure
- *
- * A lock is preventing the concurrent
- * use of @a ixAtmdAccUtopiaStatusGet() and @A ixAtmdAccUtopiaConfigSet()
- *
- * @param ixAtmdAccUtopiaStatus @ref IxAtmdAccUtopiaStatus [out] - pointer to structure to be updated from internal
- * hardware counters. This parameter cannot be a NULL pointer.
- *
- * @return @li IX_SUCCESS successful read
- * @return @li IX_FAIL error in the parameters null pointer, or
- * configuration read is not complete or failed
- *
- * @sa ixAtmdAccUtopiaConfigSet
- *
- */
-PUBLIC IX_STATUS ixAtmdAccUtopiaStatusGet (IxAtmdAccUtopiaStatus *
- ixAtmdAccUtopiaStatus);
-
-/**
- *
- * @ingroup IxAtmdAcc
- *
- * @fn ixAtmdAccPortEnable (IxAtmLogicalPort port)
- *
- * @brief enable a PHY logical port
- *
- * This function enables the transmission over one port. It should be
- * called before accessing any resource from this port and before the
- * establishment of a VC.
- *
- * When a port is enabled, the cell transmission to the Utopia interface
- * is started. If there is no traffic already running, idle cells are
- * sent over the interface.
- *
- * This function can be called multiple times.
- *
- * @param port @ref IxAtmLogicalPort [in] - logical PHY port [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
- *
- * @return @li IX_SUCCESS enable is complete
- * @return @li IX_ATMDACC_WARNING port already enabled
- * @return @li IX_FAIL enable failed, wrong parameter, or cannot
- * initialise this port (the port is maybe already in use,
- * or there is a hardware issue)
- *
- * @note - This function needs internal locks and should not be
- * called from an interrupt context
- *
- * @sa ixAtmdAccPortDisable
- *
- */
-PUBLIC IX_STATUS ixAtmdAccPortEnable (IxAtmLogicalPort port);
-
-/**
- *
- * @ingroup IxAtmdAccCtrlAPI
- *
- * @fn ixAtmdAccPortDisable (IxAtmLogicalPort port)
- *
- * @brief disable a PHY logical port
- *
- * This function disable the transmission over one port.
- *
- * When a port is disabled, the cell transmission to the Utopia interface
- * is stopped.
- *
- * @param port @ref IxAtmLogicalPort [in] - logical PHY port [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
- *
- * @return @li IX_SUCCESS disable is complete
- * @return @li IX_ATMDACC_WARNING port already disabled
- * @return @li IX_FAIL disable failed, wrong parameter .
- *
- * @note - This function needs internal locks and should not be called
- * from an interrupt context
- *
- * @note - The response from hardware is done through the txDone mechanism
- * to ensure the synchrnisation with tx resources. Therefore, the
- * txDone mechanism needs to be serviced to make a PortDisable complete.
- *
- * @sa ixAtmdAccPortEnable
- * @sa ixAtmdAccPortDisableComplete
- * @sa ixAtmdAccTxDoneDispatch
- *
- */
-PUBLIC IX_STATUS ixAtmdAccPortDisable (IxAtmLogicalPort port);
-
-/**
-*
-* @ingroup IxAtmdAccCtrlAPI
-*
-* @fn ixAtmdAccPortDisableComplete (IxAtmLogicalPort port)
-*
-* @brief disable a PHY logical port
-*
-* This function indicates if the port disable for a port has completed. This
-* function will return TRUE if the port has never been enabled.
-*
-* @param port @ref IxAtmLogicalPort [in] - logical PHY port [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
-*
-* @return @li TRUE disable is complete
-* @return @li FALSE disable failed, wrong parameter .
-*
-* @note - This function needs internal locks and should not be called
-* from an interrupt context
-*
-* @sa ixAtmdAccPortEnable
-* @sa ixAtmdAccPortDisable
-*
-*/
-PUBLIC BOOL ixAtmdAccPortDisableComplete (IxAtmLogicalPort port);
-
-#endif /* IXATMDACCCTRL_H */
-
-/**
- * @} defgroup IxAtmdAccCtrlAPI
- */
-
-
diff --git a/cpu/ixp/npe/include/IxAtmm.h b/cpu/ixp/npe/include/IxAtmm.h
deleted file mode 100644
index fcf523fca4..0000000000
--- a/cpu/ixp/npe/include/IxAtmm.h
+++ /dev/null
@@ -1,795 +0,0 @@
-/**
- * @file IxAtmm.h
- *
- * @date 3-DEC-2001
- *
- * @brief Header file for the IXP400 ATM Manager component (IxAtmm)
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-/**
- * @defgroup IxAtmm IXP400 ATM Manager (IxAtmm) API
- *
- * @brief IXP400 ATM Manager component Public API
- *
- * @{
- */
-
-#ifndef IXATMM_H
-#define IXATMM_H
-
-/*
- * Put the user defined include files required
- */
-#include "IxAtmSch.h"
-#include "IxOsalTypes.h"
-
-/*
- * #defines and macros used in this file.
- */
-
-/**
- * @def IX_ATMM_RET_ALREADY_INITIALIZED
- *
- * @brief Component has already been initialized
- */
-#define IX_ATMM_RET_ALREADY_INITIALIZED 2
-
-/**
- * @def IX_ATMM_RET_INVALID_PORT
- *
- * @brief Specified port does not exist or is out of range */
-#define IX_ATMM_RET_INVALID_PORT 3
-
-/**
- * @def IX_ATMM_RET_INVALID_VC_DESCRIPTOR
- *
- * @brief The VC description does not adhere to ATM standards */
-#define IX_ATMM_RET_INVALID_VC_DESCRIPTOR 4
-
-/**
- * @def IX_ATMM_RET_VC_CONFLICT
- *
- * @brief The VPI/VCI values supplied are either reserved, or they
- * conflict with a previously registered VC on this port */
-#define IX_ATMM_RET_VC_CONFLICT 5
-
-/**
- * @def IX_ATMM_RET_PORT_CAPACITY_IS_FULL
- *
- * @brief The virtual connection cannot be established on the port
- * because the remaining port capacity is not sufficient to
- * support it */
-#define IX_ATMM_RET_PORT_CAPACITY_IS_FULL 6
-
-/**
- * @def IX_ATMM_RET_NO_SUCH_VC
- *
- * @brief No registered VC, as described by the supplied VCI/VPI or
- * VC identifier values, exists on this port */
-#define IX_ATMM_RET_NO_SUCH_VC 7
-
-/**
- * @def IX_ATMM_RET_INVALID_VC_ID
- *
- * @brief The specified VC identifier is out of range. */
-#define IX_ATMM_RET_INVALID_VC_ID 8
-
-/**
- * @def IX_ATMM_RET_INVALID_PARAM_PTR
- *
- * @brief A pointer parameter was NULL. */
-#define IX_ATMM_RET_INVALID_PARAM_PTR 9
-
-/**
- * @def IX_ATMM_UTOPIA_SPHY_ADDR
- *
- * @brief The phy address when in SPHY mode */
-#define IX_ATMM_UTOPIA_SPHY_ADDR 31
-
-/**
- * @def IX_ATMM_THREAD_PRI_HIGH
- *
- * @brief The value of high priority thread */
-#define IX_ATMM_THREAD_PRI_HIGH 90
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-/** @brief Definition for use in the @ref IxAtmmVc structure.
- * Indicates the direction of a VC */
-typedef enum
-{
- IX_ATMM_VC_DIRECTION_TX=0, /**< Atmm Vc direction transmit*/
- IX_ATMM_VC_DIRECTION_RX, /**< Atmm Vc direction receive*/
- IX_ATMM_VC_DIRECTION_INVALID /**< Atmm Vc direction invalid*/
-} IxAtmmVcDirection;
-
-/** @brief Definition for use with @ref IxAtmmVcChangeCallback
- * callback. Indicates that the event type represented by the
- * callback for this VC. */
-typedef enum
-{
- IX_ATMM_VC_CHANGE_EVENT_REGISTER=0, /**< Atmm Vc event register*/
- IX_ATMM_VC_CHANGE_EVENT_DEREGISTER, /**< Atmm Vc event de-register*/
- IX_ATMM_VC_CHANGE_EVENT_INVALID /**< Atmm Vc event invalid*/
-} IxAtmmVcChangeEvent;
-
-/** @brief Definitions for use with @ref ixAtmmUTOPIAInit interface to
- * indicate that UTOPIA loopback should be enabled or disabled
- * on initialisation. */
-typedef enum
-{
- IX_ATMM_UTOPIA_LOOPBACK_DISABLED=0, /**< Atmm Utopia loopback mode disabled*/
- IX_ATMM_UTOPIA_LOOPBACK_ENABLED, /**< Atmm Utopia loopback mode enabled*/
- IX_ATMM_UTOPIA_LOOPBACK_INVALID /**< Atmm Utopia loopback mode invalid*/
-} IxAtmmUtopiaLoopbackMode;
-
-/** @brief This structure describes the required attributes of a
- * virtual connection.
-*/
-typedef struct {
- unsigned vpi; /**< VPI value of this virtual connection */
- unsigned vci; /**< VCI value of this virtual connection. */
- IxAtmmVcDirection direction; /**< VC direction */
-
- /** Traffic descriptor of this virtual connection. This structure
- * is defined by the @ref IxAtmSch component. */
- IxAtmTrafficDescriptor trafficDesc;
-} IxAtmmVc;
-
-
-/** @brief Definitions for use with @ref ixAtmmUtopiaInit interface to
- * indicate that UTOPIA multi-phy/single-phy mode is used.
- */
-typedef enum
-{
- IX_ATMM_MPHY_MODE = 0, /**< Atmm phy mode mphy*/
- IX_ATMM_SPHY_MODE, /**< Atmm phy mode sphy*/
- IX_ATMM_PHY_MODE_INVALID /**< Atmm phy mode invalid*/
-} IxAtmmPhyMode;
-
-
-/** @brief Structure contains port-specific information required to
- * initialize IxAtmm, and specifically, the IXP400 UTOPIA
- * Level-2 device. */
-typedef struct {
- unsigned reserved_1:11; /**< [31:21] Should be zero */
- unsigned UtopiaTxPhyAddr:5; /**< [20:16] Address of the
- * transmit (Tx) PHY for this
- * port on the 5-bit UTOPIA
- * Level-2 address bus */
- unsigned reserved_2:11; /**< [15:5] Should be zero */
- unsigned UtopiaRxPhyAddr:5; /**< [4:0] Address of the receive
- * (Rx) PHY for this port on the
- * 5-bit UTOPIA Level-2
- * address bus */
-} IxAtmmPortCfg;
-
-/** @brief Callback type used with @ref ixAtmmVcChangeCallbackRegister interface
- * Defines a callback type which will be used to notify registered
- * users of registration/deregistration events on a particular port
- *
- * @param eventType @ref IxAtmmVcChangeEvent [in] - Event indicating
- * whether the VC supplied has been added or
- * removed
- *
- * @param port @ref IxAtmLogicalPort [in] - Specifies the port on which the event has
- * occurred
- *
- * @param vcChanged @ref IxAtmmVc* [in] - Pointer to a structure which gives
- * details of the VC which has been added
- * or removed on the port
- */
-typedef void (*IxAtmmVcChangeCallback) (IxAtmmVcChangeEvent eventType,
- IxAtmLogicalPort port,
- const IxAtmmVc* vcChanged);
-
-/*
- * Variable declarations global to this file only. Externs are followed by
- * static variables.
- */
-
-/*
- * Extern function prototypes
- */
-
-/*
- * Function declarations
- */
-
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmInit (void)
- *
- * @brief Interface to initialize the IxAtmm software component. Can
- * be called once only.
- *
- * Must be called before any other IxAtmm API is called.
- *
- * @param "none"
- *
- * @return @li IX_SUCCESS : IxAtmm has been successfully initialized.
- * Calls to other IxAtmm interfaces may now be performed.
- * @return @li IX_FAIL : IxAtmm has already been initialized.
- */
-PUBLIC IX_STATUS
-ixAtmmInit (void);
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmUtopiaInit (unsigned numPorts,
- IxAtmmPhyMode phyMode,
- IxAtmmPortCfg portCfgs[],
- IxAtmmUtopiaLoopbackMode loopbackMode)
- *
- * @brief Interface to initialize the UTOPIA Level-2 ATM coprocessor
- * for the specified number of physical ports. The function
- * must be called before the ixAtmmPortInitialize interface
- * can operate successfully.
- *
- * @param numPorts unsigned [in] - Indicates the total number of logical
- * ports that are active on the device. Up to 12 ports are
- * supported.
- *
- * @param phyMode @ref IxAtmmPhyMode [in] - Put the Utopia coprocessor in SPHY
- * or MPHY mode.
- *
- * @param portCfgs[] @ref IxAtmmPortCfg [in] - Pointer to an array of elements
- * detailing the UTOPIA specific port characteristics. The
- * length of the array must be equal to the number of ports
- * activated. ATM ports are referred to by the relevant
- * offset in this array in all subsequent IxAtmm interface
- * calls.
- *
- * @param loopbackMode @ref IxAtmmUtopiaLoopbackMode [in] - Value must be one of
- * @ref IX_ATMM_UTOPIA_LOOPBACK_ENABLED or @ref
- * IX_ATMM_UTOPIA_LOOPBACK_DISABLED indicating whether
- * loopback should be enabled on the device. Loopback can
- * only be supported on a single PHY, therefore the numPorts
- * parameter must be 1 if loopback is enabled.
- *
- * @return @li IX_SUCCESS : Indicates that the UTOPIA device has been
- * successfully initialized for the supplied ports.
- * @return @li IX_ATMM_RET_ALREADY_INITIALIZED : The UTOPIA device has
- * already been initialized.
- * @return @li IX_FAIL : The supplied parameters are invalid or have been
- * rejected by the UTOPIA-NPE device.
- *
- * @warning
- * This interface may only be called once.
- * Port identifiers are assumed to range from 0 to (numPorts - 1) in all
- * instances.
- * In all subsequent calls to interfaces supplied by IxAtmm, the specified
- * port value is expected to represent the offset in the portCfgs array
- * specified in this interface. i.e. The first port in this array will
- * subsequently be represented as port 0, the second port as port 1,
- * and so on.*/
-PUBLIC IX_STATUS
-ixAtmmUtopiaInit (unsigned numPorts,
- IxAtmmPhyMode phyMode,
- IxAtmmPortCfg portCfgs[],
- IxAtmmUtopiaLoopbackMode loopbackMode);
-
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmPortInitialize (IxAtmLogicalPort port,
- unsigned txPortRate,
- unsigned rxPortRate)
- *
- * @brief The interface is called following @ref ixAtmmUtopiaInit ()
- * and before calls to any other IxAtmm interface. It serves
- * to activate the registered ATM port with IxAtmm.
- *
- * The transmit and receive port rates are specified in bits per
- * second. This translates to ATM cells per second according to the
- * following formula: CellsPerSecond = portRate / (53*8) The
- * IXP400 device supports only 53 byte cells. The client shall make
- * sure that the off-chip physical layer device has already been
- * initialized.
- *
- * IxAtmm will configure IxAtmdAcc and IxAtmSch to enable scheduling
- * on the port.
- *
- * This interface must be called once for each active port in the
- * system. The first time the interface is invoked, it will configure
- * the mechanism by which the handling of transmit, transmit-done and
- * receive are driven with the IxAtmdAcc component.
- *
- * This function is reentrant.
- *
- * @note The minimum tx rate that will be accepted is 424 bit/s which equates
- * to 1 cell (53 bytes) per second.
- *
- * @param port @ref IxAtmLogicalPort [in] - Identifies the port which is to be
- * initialized.
- *
- * @param txPortRate unsigned [in] - Value specifies the
- * transmit port rate for this port in
- * bits/second. This value is used by the ATM Scheduler
- * component is evaluating VC access requests for the port.
- *
- * @param rxPortRate unsigned [in] - Value specifies the
- * receive port rate for this port in bits/second.
- *
- * @return @li IX_SUCCESS : The specificed ATM port has been successfully
- * initialized. IxAtmm is ready to accept VC registrations on
- * this port.
- *
- * @return @li IX_ATMM_RET_ALREADY_INITIALIZED : ixAtmmPortInitialize has
- * already been called successfully on this port. The current
- * call is rejected.
- *
- * @return @li IX_ATMM_RET_INVALID_PORT : The port value indicated in the
- * input is not valid. The request is rejected.
- *
- * @return @li IX_FAIL : IxAtmm could not initialize the port because the
- * inputs are not understood.
- *
- * @sa ixAtmmPortEnable, ixAtmmPortDisable
- *
- */
-PUBLIC IX_STATUS
-ixAtmmPortInitialize (IxAtmLogicalPort port,
- unsigned txPortRate,
- unsigned rxPortRate);
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmPortModify (IxAtmLogicalPort port,
- unsigned txPortRate,
- unsigned rxPortRate)
- *
- * @brief A client may call this interface to change the existing
- * port rate (expressed in bits/second) on an established ATM
- * port.
- *
- * @param port @ref IxAtmLogicalPort [in] - Identifies the port which is to be
- * initialized.
- *
- * @param txPortRate unsigned [in] - Value specifies the``
- * transmit port rate for this port in
- * bits/second. This value is used by the ATM Scheduler
- * component is evaluating VC access requests for the port.
- *
- * @param rxPortRate unsigned [in] - Value specifies the
- * receive port rate for this port in
- * bits/second.
- *
- * @return @li IX_SUCCESS : The indicated ATM port rates have been
- * successfully modified.
- *
- * @return @li IX_ATMM_RET_INVALID_PORT : The port value indicated in the
- * input is not valid. The request is rejected.
- *
- * @return @li IX_FAIL : IxAtmm could not update the port because the
- * inputs are not understood, or the interface was called before
- * the port was initialized. */
-PUBLIC IX_STATUS
-ixAtmmPortModify (IxAtmLogicalPort port,
- unsigned txPortRate,
- unsigned rxPortRate);
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmPortQuery (IxAtmLogicalPort port,
- unsigned *txPortRate,
- unsigned *rxPortRate);
-
- *
- * @brief The client may call this interface to request details on
- * currently registered transmit and receive rates for an ATM
- * port.
- *
- * @param port @ref IxAtmLogicalPort [in] - Value identifies the port from which the
- * rate details are requested.
- *
- * @param *txPortRate unsigned [out] - Pointer to a value
- * which will be filled with the value of the transmit port
- * rate specified in bits/second.
- *
- * @param *rxPortRate unsigned [out] - Pointer to a value
- * which will be filled with the value of the receive port
- * rate specified in bits/second.
- *
- * @return @li IX_SUCCESS : The information requested on the specified
- * port has been successfully supplied in the output.
- *
- * @return @li IX_ATMM_RET_INVALID_PORT : The port value indicated in the
- * input is not valid. The request is rejected.
- *
- * @return @li IX_ATMM_RET_INVALID_PARAM_PTR : A pointer parameter was
- * NULL.
- *
- * @return @li IX_FAIL : IxAtmm could not update the port because the
- * inputs are not understood, or the interface was called before
- * the port was initialized. */
-PUBLIC IX_STATUS
-ixAtmmPortQuery (IxAtmLogicalPort port,
- unsigned *txPortRate,
- unsigned *rxPortRate);
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmPortEnable(IxAtmLogicalPort port)
- *
- * @brief The client call this interface to enable transmit for an ATM
- * port. At initialisation, all the ports are disabled.
- *
- * @param port @ref IxAtmLogicalPort [in] - Value identifies the port
- *
- * @return @li IX_SUCCESS : Transmission over this port is started.
- *
- * @return @li IX_FAIL : The port parameter is not valid, or the
- * port is already enabled
- *
- * @note - When a port is disabled, Rx and Tx VC Connect requests will fail
- *
- * @note - This function uses system resources and should not be used
- * inside an interrupt context.
- *
- * @sa ixAtmmPortDisable */
-PUBLIC IX_STATUS
-ixAtmmPortEnable(IxAtmLogicalPort port);
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmPortDisable(IxAtmLogicalPort port)
- *
- * @brief The client call this interface to disable transmit for an ATM
- * port. At initialisation, all the ports are disabled.
- *
- * @param port @ref IxAtmLogicalPort [in] - Value identifies the port
- *
- * @return @li IX_SUCCESS : Transmission over this port is stopped.
- *
- * @return @li IX_FAIL : The port parameter is not valid, or the
- * port is already disabled
- *
- * @note - When a port is disabled, Rx and Tx VC Connect requests will fail
- *
- * @note - This function call does not stop RX traffic. It is supposed
- * that this function is invoked when a serious problem
- * is detected (e.g. physical layer broken). Then, the RX traffic
- * is not passing.
- *
- * @note - This function is blocking until the hw acknowledge that the
- * transmission is stopped.
- *
- * @note - This function uses system resources and should not be used
- * inside an interrupt context.
- *
- * @sa ixAtmmPortEnable */
-PUBLIC IX_STATUS
-ixAtmmPortDisable(IxAtmLogicalPort port);
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmVcRegister (IxAtmLogicalPort port,
- IxAtmmVc *vcToAdd,
- IxAtmSchedulerVcId *vcId)
- *
- * @brief This interface is used to register an ATM Virtual
- * Connection on the specified ATM port.
- *
- * Each call to this interface registers a unidirectional virtual
- * connection with the parameters specified. If a bi-directional VC
- * is needed, the function should be called twice (once for each
- * direction, Tx & Rx) where the VPI and VCI and port parameters in
- * each call are identical.
- *
- * With the addition of each new VC to a port, a series of
- * callback functions are invoked by the IxAtmm component to notify
- * possible external components of the change. The callback functions
- * are registered using the @ref ixAtmmVcChangeCallbackRegister interface.
- *
- * The IxAtmSch component is notified of the registration of transmit
- * VCs.
- *
- * @param port @ref IxAtmLogicalPort [in] - Identifies port on which the specified VC is
- * to be registered.
- *
- * @param *vcToAdd @ref IxAtmmVc [in] - Pointer to an @ref IxAtmmVc structure
- * containing a description of the VC to be registered. The
- * client shall fill the vpi, vci and direction and relevant
- * trafficDesc members of this structure before calling this
- * function.
- *
- * @param *vcId @ref IxAtmSchedulerVcId [out] - Pointer to an integer value which is filled
- * with the per-port unique identifier value for this VC.
- * This identifier will be required when a request is
- * made to deregister or change this VC. VC identifiers
- * for transmit VCs will have a value between 0-43,
- * i.e. 32 data Tx VCs + 12 OAM Tx Port VCs.
- * Receive VCs will have a value between 44-66,
- * i.e. 32 data Rx VCs + 1 OAM Rx VC.
- *
- * @return @li IX_SUCCESS : The VC has been successfully registered on
- * this port. The VC is ready for a client to configure IxAtmdAcc
- * for receive and transmit operations on the VC.
- * @return @li IX_ATMM_RET_INVALID_PORT : The port value indicated in the
- * input is not valid or has not been initialized. The request
- * is rejected.
- * @return @li IX_ATMM_RET_INVALID_VC_DESCRIPTOR : The descriptor
- * pointed to by vcToAdd is invalid. The registration request
- * is rejected.
- * @return @li IX_ATMM_RET_VC_CONFLICT : The VC requested conflicts with
- * reserved VPI and/or VCI values or with another VC already activated
- * on this port.
- * @return @li IX_ATMM_RET_PORT_CAPACITY_IS_FULL : The VC cannot be
- * registered in the port becuase the port capacity is
- * insufficient to support the requested ATM traffic contract.
- * The registration request is rejected.
- * @return @li IX_ATMM_RET_INVALID_PARAM_PTR : A pointer parameter was
- * NULL.
- *
- * @warning IxAtmm has no capability of signaling or negotiating a virtual
- * connection. Negotiation of the admission of the VC to the network
- * is beyond the scope of this function. This is assumed to be
- * performed by the calling client, if appropriate,
- * before or after this function is called.
- */
-PUBLIC IX_STATUS
-ixAtmmVcRegister (IxAtmLogicalPort port,
- IxAtmmVc *vcToAdd,
- IxAtmSchedulerVcId *vcId);
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmVcDeregister (IxAtmLogicalPort port, IxAtmSchedulerVcId vcId)
- *
- * @brief Function called by a client to deregister a VC from the
- * system.
- *
- * With the removal of each new VC from a port, a series of
- * registered callback functions are invoked by the IxAtmm component
- * to notify possible external components of the change. The callback
- * functions are registered using the @ref ixAtmmVcChangeCallbackRegister.
- *
- * The IxAtmSch component is notified of the removal of transmit VCs.
- *
- * @param port @ref IxAtmLogicalPort [in] - Identifies port on which the VC to be
- * removed is currently registered.
- *
- * @param vcId @ref IxAtmSchedulerVcId [in] - VC identifier value of the VC to
- * be deregistered. This value was supplied to the client when
- the VC was originally registered. This value can also be
- queried from the IxAtmm component through the @ref ixAtmmVcQuery
- * interface.
- *
- * @return @li IX_SUCCESS : The specified VC has been successfully
- * removed from this port.
- * @return @li IX_ATMM_RET_INVALID_PORT : The port value indicated in the
- * input is not valid or has not been initialized. The request
- * is rejected.
- * @return @li IX_FAIL : There is no registered VC associated with the
- * supplied identifier registered on this port. */
-PUBLIC IX_STATUS
-ixAtmmVcDeregister (IxAtmLogicalPort port, IxAtmSchedulerVcId vcId);
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmVcQuery (IxAtmLogicalPort port,
- unsigned vpi,
- unsigned vci,
- IxAtmmVcDirection direction,
- IxAtmSchedulerVcId *vcId,
- IxAtmmVc *vcDesc)
- *
- * @brief This interface supplies information about an active VC on a
- * particular port when supplied with the VPI, VCI and
- * direction of that VC.
- *
- * @param port @ref IxAtmLogicalPort [in] - Identifies port on which the VC to be
- * queried is currently registered.
- *
- * @param vpi unsigned [in] - ATM VPI value of the requested VC.
- *
- * @param vci unsigned [in] - ATM VCI value of the requested VC.
- *
- * @param direction @ref IxAtmmVcDirection [in] - One of @ref
- * IX_ATMM_VC_DIRECTION_TX or @ref IX_ATMM_VC_DIRECTION_RX
- * indicating the direction (Tx or Rx) of the requested VC.
- *
- * @param *vcId @ref IxAtmSchedulerVcId [out] - Pointer to an integer value which will be
- * filled with the VC identifier value for the requested
- * VC (as returned by @ref ixAtmmVcRegister), if it
- * exists on this port.
- *
- * @param *vcDesc @ref IxAtmmVc [out] - Pointer to an @ref IxAtmmVc structure
- * which will be filled with the specific details of the
- * requested VC, if it exists on this port.
- *
- * @return @li IX_SUCCESS : The specified VC has been found on this port
- * and the requested details have been returned.
- * @return @li IX_ATMM_RET_INVALID_PORT : The port value indicated in the
- * input is not valid or has not been initialized. The request
- * is rejected.
- * @return @li IX_ATMM_RET_NO_SUCH_VC : No VC exists on the specified
- * port which matches the search criteria (VPI, VCI, direction)
- * given. No data is returned.
- * @return @li IX_ATMM_RET_INVALID_PARAM_PTR : A pointer parameter was
- * NULL.
- *
- */
-PUBLIC IX_STATUS
-ixAtmmVcQuery (IxAtmLogicalPort port,
- unsigned vpi,
- unsigned vci,
- IxAtmmVcDirection direction,
- IxAtmSchedulerVcId *vcId,
- IxAtmmVc *vcDesc);
-
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmVcIdQuery (IxAtmLogicalPort port, IxAtmSchedulerVcId vcId, IxAtmmVc *vcDesc)
- *
- * @brief This interface supplies information about an active VC on a
- * particular port when supplied with a vcId for that VC.
- *
- * @param port @ref IxAtmLogicalPort [in] - Identifies port on which the VC to be
- * queried is currently registered.
- *
- * @param vcId @ref IxAtmSchedulerVcId [in] - Value returned by @ref ixAtmmVcRegister which
- * uniquely identifies the requested VC on this port.
- *
- * @param *vcDesc @ref IxAtmmVc [out] - Pointer to an @ref IxAtmmVc structure
- * which will be filled with the specific details of the
- * requested VC, if it exists on this port.
- *
- * @return @li IX_SUCCESS : The specified VC has been found on this port
- * and the requested details have been returned.
- * @return @li IX_ATMM_RET_INVALID_PORT : The port value indicated in the
- * input is not valid or has not been initialized. The request
- * is rejected.
- * @return @li IX_ATMM_RET_NO_SUCH_VC : No VC exists on the specified
- * port which matches the supplied identifier. No data is
- * returned.
- * @return @li IX_ATMM_RET_INVALID_PARAM_PTR : A pointer parameter was
- * NULL.
- */
-PUBLIC IX_STATUS
-ixAtmmVcIdQuery (IxAtmLogicalPort port, IxAtmSchedulerVcId vcId, IxAtmmVc *vcDesc);
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmVcChangeCallbackRegister (IxAtmmVcChangeCallback callback)
- *
- * @brief This interface is invoked to supply a function to IxAtmm
- * which will be called to notify the client if a new VC is
- * registered with IxAtmm or an existing VC is removed.
- *
- * The callback, when invoked, will run within the context of the call
- * to @ref ixAtmmVcRegister or @ref ixAtmmVcDeregister which caused
- * the change of state.
- *
- * A maximum of 32 calbacks may be registered in with IxAtmm.
- *
- * @param callback @ref IxAtmmVcChangeCallback [in] - Callback which complies
- * with the @ref IxAtmmVcChangeCallback definition. This
- * function will be invoked by IxAtmm with the appropiate
- * parameters for the relevant VC when any VC has been
- * registered or deregistered with IxAtmm.
- *
- * @return @li IX_SUCCESS : The specified callback has been registered
- * successfully with IxAtmm and will be invoked when appropriate.
- * @return @li IX_FAIL : Either the supplied callback is invalid, or
- * IxAtmm has already registered 32 and connot accommodate
- * any further registrations of this type. The request is
- * rejected.
- *
- * @warning The client must not call either the @ref
- * ixAtmmVcRegister or @ref ixAtmmVcDeregister interfaces
- * from within the supplied callback function. */
-PUBLIC IX_STATUS ixAtmmVcChangeCallbackRegister (IxAtmmVcChangeCallback callback);
-
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmVcChangeCallbackDeregister (IxAtmmVcChangeCallback callback)
- *
- * @brief This interface is invoked to deregister a previously supplied
- * callback function.
- *
- * @param callback @ref IxAtmmVcChangeCallback [in] - Callback which complies
- * with the @ref IxAtmmVcChangeCallback definition. This
- * function will removed from the table of callbacks.
- *
- * @return @li IX_SUCCESS : The specified callback has been deregistered
- * successfully from IxAtmm.
- * @return @li IX_FAIL : Either the supplied callback is invalid, or
- * is not currently registered with IxAtmm.
- */
-PUBLIC IX_STATUS
-ixAtmmVcChangeCallbackDeregister (IxAtmmVcChangeCallback callback);
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmUtopiaStatusShow (void)
- *
- * @brief Display utopia status counters
- *
- * @param "none"
- *
- * @return @li IX_SUCCESS : Show function was successful
- * @return @li IX_FAIL : Internal failure
- */
-PUBLIC IX_STATUS
-ixAtmmUtopiaStatusShow (void);
-
-/**
- * @ingroup IxAtmm
- *
- * @fn ixAtmmUtopiaCfgShow (void)
- *
- * @brief Display utopia information(config registers and status registers)
- *
- * @param "none"
- *
- * @return @li IX_SUCCESS : Show function was successful
- * @return @li IX_FAIL : Internal failure
- */
-PUBLIC IX_STATUS
-ixAtmmUtopiaCfgShow (void);
-
-#endif
-/* IXATMM_H */
-
-/** @} */
diff --git a/cpu/ixp/npe/include/IxDmaAcc.h b/cpu/ixp/npe/include/IxDmaAcc.h
deleted file mode 100644
index 53d2625591..0000000000
--- a/cpu/ixp/npe/include/IxDmaAcc.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/**
- * @file IxDmaAcc.h
- *
- * @date 15 October 2002
- *
- * @brief API of the IXP400 DMA Access Driver Component (IxDma)
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/*---------------------------------------------------------------------
- Doxygen group definitions
- ---------------------------------------------------------------------*/
-
-#ifndef IXDMAACC_H
-#define IXDMAACC_H
-
-#include "IxOsal.h"
-#include "IxNpeDl.h"
-/**
- * @defgroup IxDmaTypes IXP400 DMA Types (IxDmaTypes)
- * @brief The common set of types used in the DMA component
- * @{
- */
-
-/**
- * @ingroup IxDmaTypes
- * @enum IxDmaReturnStatus
- * @brief Dma return status definitions
- */
-typedef enum
-{
- IX_DMA_SUCCESS = IX_SUCCESS, /**< DMA Transfer Success */
- IX_DMA_FAIL = IX_FAIL, /**< DMA Transfer Fail */
- IX_DMA_INVALID_TRANSFER_WIDTH, /**< Invalid transfer width */
- IX_DMA_INVALID_TRANSFER_LENGTH, /**< Invalid transfer length */
- IX_DMA_INVALID_TRANSFER_MODE, /**< Invalid transfer mode */
- IX_DMA_INVALID_ADDRESS_MODE, /**< Invalid address mode */
- IX_DMA_REQUEST_FIFO_FULL /**< DMA request queue is full */
-} IxDmaReturnStatus;
-
-/**
- * @ingroup IxDmaTypes
- * @enum IxDmaTransferMode
- * @brief Dma transfer mode definitions
- * @note Copy and byte swap, and copy and reverse modes only support multiples of word data length.
- */
-typedef enum
-{
- IX_DMA_COPY_CLEAR = 0, /**< copy and clear source*/
- IX_DMA_COPY, /**< copy */
- IX_DMA_COPY_BYTE_SWAP, /**< copy and byte swap (endian) */
- IX_DMA_COPY_REVERSE, /**< copy and reverse */
- IX_DMA_TRANSFER_MODE_INVALID /**< Invalid transfer mode */
-} IxDmaTransferMode;
-
-/**
- * @ingroup IxDmaTypes
- * @enum IxDmaAddressingMode
- * @brief Dma addressing mode definitions
- * @note Fixed source address to fixed destination address addressing mode is not supported.
- */
-typedef enum
-{
- IX_DMA_INC_SRC_INC_DST = 0, /**< Incremental source address to incremental destination address */
- IX_DMA_INC_SRC_FIX_DST, /**< Incremental source address to incremental destination address */
- IX_DMA_FIX_SRC_INC_DST, /**< Incremental source address to incremental destination address */
- IX_DMA_FIX_SRC_FIX_DST, /**< Incremental source address to incremental destination address */
- IX_DMA_ADDRESSING_MODE_INVALID /**< Invalid Addressing Mode */
-} IxDmaAddressingMode;
-
-/**
- * @ingroup IxDmaTypes
- * @enum IxDmaTransferWidth
- * @brief Dma transfer width definitions
- * @Note Fixed addresses (either source or destination) do not support burst transfer width.
- */
-typedef enum
-{
- IX_DMA_32_SRC_32_DST = 0, /**< 32-bit src to 32-bit dst */
- IX_DMA_32_SRC_16_DST, /**< 32-bit src to 16-bit dst */
- IX_DMA_32_SRC_8_DST, /**< 32-bit src to 8-bit dst */
- IX_DMA_16_SRC_32_DST, /**< 16-bit src to 32-bit dst */
- IX_DMA_16_SRC_16_DST, /**< 16-bit src to 16-bit dst */
- IX_DMA_16_SRC_8_DST, /**< 16-bit src to 8-bit dst */
- IX_DMA_8_SRC_32_DST, /**< 8-bit src to 32-bit dst */
- IX_DMA_8_SRC_16_DST, /**< 8-bit src to 16-bit dst */
- IX_DMA_8_SRC_8_DST, /**< 8-bit src to 8-bit dst */
- IX_DMA_8_SRC_BURST_DST, /**< 8-bit src to burst dst - Not supported for fixed destination address */
- IX_DMA_16_SRC_BURST_DST, /**< 16-bit src to burst dst - Not supported for fixed destination address */
- IX_DMA_32_SRC_BURST_DST, /**< 32-bit src to burst dst - Not supported for fixed destination address */
- IX_DMA_BURST_SRC_8_DST, /**< burst src to 8-bit dst - Not supported for fixed source address */
- IX_DMA_BURST_SRC_16_DST, /**< burst src to 16-bit dst - Not supported for fixed source address */
- IX_DMA_BURST_SRC_32_DST, /**< burst src to 32-bit dst - Not supported for fixed source address*/
- IX_DMA_BURST_SRC_BURST_DST, /**< burst src to burst dst - Not supported for fixed source and destination address
-*/
- IX_DMA_TRANSFER_WIDTH_INVALID /**< Invalid transfer width */
-} IxDmaTransferWidth;
-
-/**
- * @ingroup IxDmaTypes
- * @enum IxDmaNpeId
- * @brief NpeId numbers to identify NPE A, B or C
- */
-typedef enum
-{
- IX_DMA_NPEID_NPEA = 0, /**< Identifies NPE A */
- IX_DMA_NPEID_NPEB, /**< Identifies NPE B */
- IX_DMA_NPEID_NPEC, /**< Identifies NPE C */
- IX_DMA_NPEID_MAX /**< Total Number of NPEs */
-} IxDmaNpeId;
-/* @} */
-/**
- * @defgroup IxDmaAcc IXP400 DMA Access Driver (IxDmaAcc) API
- *
- * @brief The public API for the IXP400 IxDmaAcc component
- *
- * @{
- */
-
-/**
- * @ingroup IxDmaAcc
- * @brief DMA Request Id type
- */
-typedef UINT32 IxDmaAccRequestId;
-
-/**
- * @ingroup IxDmaAcc
- * @def IX_DMA_REQUEST_FULL
- * @brief DMA request queue is full
- * This constant is a return value used to tell the user that the IxDmaAcc
- * queue is full.
- *
- */
-#define IX_DMA_REQUEST_FULL 16
-
-/**
- * @ingroup IxDmaAcc
- * @brief DMA completion notification
- * This function is called to notify a client that the DMA has been completed
- * @param status @ref IxDmaReturnStatus [out] - reporting to client
- *
- */
-typedef void (*IxDmaAccDmaCompleteCallback) (IxDmaReturnStatus status);
-
-/**
- * @ingroup IxDmaAcc
- *
- * @fn ixDmaAccInit(IxNpeDlNpeId npeId)
- *
- * @brief Initialise the DMA Access component
- * This function will initialise the DMA Access component internals
- * @param npeId @ref IxNpeDlNpeId [in] - NPE to use for Dma Transfer
- * @return @li IX_SUCCESS succesfully initialised the component
- * @return @li IX_FAIL Initialisation failed for some unspecified
- * internal reason.
- */
-PUBLIC IX_STATUS
-ixDmaAccInit(IxNpeDlNpeId npeId);
-
-/**
- * @ingroup IxDmaAcc
- *
- * @fn ixDmaAccDmaTransfer(
- IxDmaAccDmaCompleteCallback callback,
- UINT32 SourceAddr,
- UINT32 DestinationAddr,
- UINT16 TransferLength,
- IxDmaTransferMode TransferMode,
- IxDmaAddressingMode AddressingMode,
- IxDmaTransferWidth TransferWidth)
- *
- * @brief Perform DMA transfer
- * This function will perform DMA transfer between devices within the
- * IXP400 memory map.
- * @note The following are restrictions for IxDmaAccDmaTransfer:
- * @li The function is non re-entrant.
- * @li The function assumes host devices are operating in big-endian mode.
- * @li Fixed address does not suport burst transfer width
- * @li Fixed source address to fixed destinatiom address mode is not suported
- * @li The incrementing source address for expansion bus will not support a burst transfer width and copy and clear mode
- *
- * @param callback @ref IxDmaAccDmaCompleteCallback [in] - function pointer to be stored and called when the DMA transfer is completed. This cannot be NULL.
- * @param SourceAddr UINT32 [in] - Starting address of DMA source. Must be a valid IXP400 memory map address.
- * @param DestinationAddr UINT32 [in] - Starting address of DMA destination. Must be a valid IXP400 memory map address.
- * @param TransferLength UINT16 [in] - The size of DMA data transfer. The range must be from 1-64Kbyte
- * @param TransferMode @ref IxDmaTransferMode [in] - The DMA transfer mode
- * @param AddressingMode @ref IxDmaAddressingMode [in] - The DMA addressing mode
- * @param TransferWidth @ref IxDmaTransferWidth [in] - The DMA transfer width
- *
- * @return @li IX_DMA_SUCCESS Notification that the DMA request is succesful
- * @return @li IX_DMA_FAIL IxDmaAcc not yet initialised or some internal error has occured
- * @return @li IX_DMA_INVALID_TRANSFER_WIDTH Transfer width is nit valid
- * @return @li IX_DMA_INVALID_TRANSFER_LENGTH Transfer length outside of valid range
- * @return @li IX_DMA_INVALID_TRANSFER_MODE Transfer Mode not valid
- * @return @li IX_DMA_REQUEST_FIFO_FULL IxDmaAcc request queue is full
- */
-PUBLIC IxDmaReturnStatus
-ixDmaAccDmaTransfer(
- IxDmaAccDmaCompleteCallback callback,
- UINT32 SourceAddr,
- UINT32 DestinationAddr,
- UINT16 TransferLength,
- IxDmaTransferMode TransferMode,
- IxDmaAddressingMode AddressingMode,
- IxDmaTransferWidth TransferWidth);
-/**
- * @ingroup IxDmaAcc
- *
- * @fn ixDmaAccShow(void)
- *
- * @brief Display some component information for debug purposes
- * Show some internal operation information relating to the DMA service.
- * At a minimum the following will show.
- * - the number of the DMA pend (in queue)
- * @param None
- * @return @li None
- */
-PUBLIC IX_STATUS
-ixDmaAccShow(void);
-
-#endif /* IXDMAACC_H */
-
diff --git a/cpu/ixp/npe/include/IxEthAcc.h b/cpu/ixp/npe/include/IxEthAcc.h
deleted file mode 100644
index b424648e9d..0000000000
--- a/cpu/ixp/npe/include/IxEthAcc.h
+++ /dev/null
@@ -1,2512 +0,0 @@
-/** @file IxEthAcc.h
- *
- * @brief this file contains the public API of @ref IxEthAcc component
- *
- * Design notes:
- * The IX_OSAL_MBUF address is to be specified on bits [31-5] and must
- * be cache aligned (bits[4-0] cleared)
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- *
- */
-
-#ifndef IxEthAcc_H
-#define IxEthAcc_H
-
-#include <IxOsBuffMgt.h>
-#include <IxTypes.h>
-
-/**
- * @defgroup IxEthAcc IXP400 Ethernet Access (IxEthAcc) API
- *
- * @brief ethAcc is a library that does provides access to the internal IXP400 10/100Bt Ethernet MACs.
- *
- *@{
- */
-
-/**
- * @ingroup IxEthAcc
- * @brief Definition of the Ethernet Access status
- */
-typedef enum /* IxEthAccStatus */
-{
- IX_ETH_ACC_SUCCESS = IX_SUCCESS, /**< return success*/
- IX_ETH_ACC_FAIL = IX_FAIL, /**< return fail*/
- IX_ETH_ACC_INVALID_PORT, /**< return invalid port*/
- IX_ETH_ACC_PORT_UNINITIALIZED, /**< return uninitialized*/
- IX_ETH_ACC_MAC_UNINITIALIZED, /**< return MAC uninitialized*/
- IX_ETH_ACC_INVALID_ARG, /**< return invalid arg*/
- IX_ETH_TX_Q_FULL, /**< return tx queue is full*/
- IX_ETH_ACC_NO_SUCH_ADDR /**< return no such address*/
-} IxEthAccStatus;
-
-/**
- * @ingroup IxEthAcc
- * @enum IxEthAccPortId
- * @brief Definition of the IXP400 Mac Ethernet device.
- */
-typedef enum
-{
- IX_ETH_PORT_1 = 0, /**< Ethernet Port 1 */
- IX_ETH_PORT_2 = 1 /**< Ethernet port 2 */
- ,IX_ETH_PORT_3 = 2 /**< Ethernet port 3 */
-} IxEthAccPortId;
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETH_ACC_NUMBER_OF_PORTS
- *
- * @brief Definition of the number of ports
- *
- */
-#ifdef __ixp46X
-#define IX_ETH_ACC_NUMBER_OF_PORTS (3)
-#else
-#define IX_ETH_ACC_NUMBER_OF_PORTS (2)
-#endif
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_IEEE803_MAC_ADDRESS_SIZE
- *
- * @brief Definition of the size of the MAC address
- *
- */
-#define IX_IEEE803_MAC_ADDRESS_SIZE (6)
-
-
-/**
- *
- * @brief Definition of the IEEE 802.3 Ethernet MAC address structure.
- *
- * The data should be packed with bytes xx:xx:xx:xx:xx:xx
- * @note
- * The data must be packed in network byte order.
- */
-typedef struct
-{
- UINT8 macAddress[IX_IEEE803_MAC_ADDRESS_SIZE]; /**< MAC address */
-} IxEthAccMacAddr;
-
-/**
- * @ingroup IxEthAcc
- * @def IX_ETH_ACC_NUM_TX_PRIORITIES
- * @brief Definition of the number of transmit priorities
- *
- */
-#define IX_ETH_ACC_NUM_TX_PRIORITIES (8)
-
-/**
- * @ingroup IxEthAcc
- * @enum IxEthAccTxPriority
- * @brief Definition of the relative priority used to transmit a frame
- *
- */
-typedef enum
-{
- IX_ETH_ACC_TX_PRIORITY_0 = 0, /**<Lowest Priority submission */
- IX_ETH_ACC_TX_PRIORITY_1 = 1, /**<submission prority of 1 (0 is lowest)*/
- IX_ETH_ACC_TX_PRIORITY_2 = 2, /**<submission prority of 2 (0 is lowest)*/
- IX_ETH_ACC_TX_PRIORITY_3 = 3, /**<submission prority of 3 (0 is lowest)*/
- IX_ETH_ACC_TX_PRIORITY_4 = 4, /**<submission prority of 4 (0 is lowest)*/
- IX_ETH_ACC_TX_PRIORITY_5 = 5, /**<submission prority of 5 (0 is lowest)*/
- IX_ETH_ACC_TX_PRIORITY_6 = 6, /**<submission prority of 6 (0 is lowest)*/
- IX_ETH_ACC_TX_PRIORITY_7 = 7, /**<Highest priority submission */
-
- IX_ETH_ACC_TX_DEFAULT_PRIORITY = IX_ETH_ACC_TX_PRIORITY_0 /**< By default send all
- packets with lowest priority */
-} IxEthAccTxPriority;
-
-/**
- * @ingroup IxEthAcc
- * @enum IxEthAccRxFrameType
- * @brief Identify the type of a frame.
- *
- * @sa IX_ETHACC_NE_FLAGS
- * @sa IX_ETHACC_NE_LINKMASK
- */
-typedef enum
-{
- IX_ETHACC_RX_LLCTYPE = 0x00, /**< 802.3 - 8802, with LLC/SNAP */
- IX_ETHACC_RX_ETHTYPE = 0x10, /**< 802.3 (Ethernet) without LLC/SNAP */
- IX_ETHACC_RX_STATYPE = 0x20, /**< 802.11, AP <=> STA */
- IX_ETHACC_RX_APTYPE = 0x30 /**< 802.11, AP <=> AP */
-} IxEthAccRxFrameType;
-
-/**
- * @ingroup IxEthAcc
- * @enum IxEthAccDuplexMode
- * @brief Definition to provision the duplex mode of the MAC.
- *
- */
-typedef enum
-{
- IX_ETH_ACC_FULL_DUPLEX, /**< Full duplex operation of the MAC */
- IX_ETH_ACC_HALF_DUPLEX /**< Half duplex operation of the MAC */
-} IxEthAccDuplexMode;
-
-
-/**
- * @ingroup IxEthAcc
- * @struct IxEthAccNe
- * @brief Definition of service-specific informations.
- *
- * This structure defines the Ethernet service-specific informations
- * and enable QoS and VLAN features.
- */
-typedef struct
-{
- UINT32 ixReserved_next; /**< reserved for chaining */
- UINT32 ixReserved_lengths; /**< reserved for buffer lengths */
- UINT32 ixReserved_data; /**< reserved for buffer pointer */
- UINT8 ixDestinationPortId; /**< Destination portId for this packet, if known by NPE */
- UINT8 ixSourcePortId; /**< Source portId for this packet */
- UINT16 ixFlags; /**< BitField of option for this frame */
- UINT8 ixQoS; /**< QoS class of the frame */
- UINT8 ixReserved; /**< reserved */
- UINT16 ixVlanTCI; /**< Vlan TCI */
- UINT8 ixDestMac[IX_IEEE803_MAC_ADDRESS_SIZE]; /**< Destination MAC address */
- UINT8 ixSourceMac[IX_IEEE803_MAC_ADDRESS_SIZE]; /**< Source MAC address */
-} IxEthAccNe;
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_PORT_UNKNOWN
- *
- * @brief Contents of the field @a IX_ETHACC_NE_DESTPORTID when no
- * destination port can be found by the NPE for this frame.
- *
- */
-#define IX_ETHACC_NE_PORT_UNKNOWN (0xff)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_DESTMAC
- *
- * @brief The location of the destination MAC address in the Mbuf header.
- *
- */
-#define IX_ETHACC_NE_DESTMAC(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixDestMac
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_SOURCEMAC
- *
- * @brief The location of the source MAC address in the Mbuf header.
- *
- */
-#define IX_ETHACC_NE_SOURCEMAC(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixSourceMac
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_VLANTCI
- *
- * @brief The VLAN Tag Control Information associated with this frame
- *
- * The VLAN Tag Control Information associated with this frame. On Rx
- * path, this field is extracted from the packet header.
- * On Tx path, the value of this field is inserted in the frame when
- * the port is configured to insert or replace vlan tags in the
- * egress frames.
- *
- * @sa IX_ETHACC_NE_FLAGS
- */
-#define IX_ETHACC_NE_VLANTCI(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixVlanTCI
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_SOURCEPORTID
- *
- * @brief The port where this frame came from.
- *
- * The port where this frame came from. This field is set on receive
- * with the port information. This field is ignored on Transmit path.
- */
-#define IX_ETHACC_NE_SOURCEPORTID(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixSourcePortId
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_DESTPORTID
- *
- * @brief The destination port where this frame should be sent.
- *
- * The destination port where this frame should be sent.
- *
- * @li In the transmit direction, this field contains the destination port
- * and is ignored unless @a IX_ETHACC_NE_FLAG_DST is set.
- *
- * @li In the receive direction, this field contains the port where the
- * destination MAC addresses has been learned. If the destination
- * MAC address is unknown, then this value is set to the reserved value
- * @a IX_ETHACC_NE_PORT_UNKNOWN
- *
- */
-#define IX_ETHACC_NE_DESTPORTID(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixDestinationPortId
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_QOS
- *
- * @brief QualityOfService class (QoS) for this received frame.
- *
- */
-#define IX_ETHACC_NE_QOS(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixQoS
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_FLAGS
- *
- * @brief Bit Mask of the different flags associated with a frame
- *
- * The flags are the bit-oring combination
- * of the following different fields :
- *
- * @li IP flag (Rx @a IX_ETHACC_NE_IPMASK)
- * @li Spanning Tree flag (Rx @a IX_ETHACC_NE_STMASK)
- * @li Link layer type (Rx and Tx @a IX_ETHACC_NE_LINKMASK)
- * @li VLAN Tagged Frame (Rx @a IX_ETHACC_NE_VLANMASK)
- * @li New source MAC address (Rx @a IX_ETHACC_NE_NEWSRCMASK)
- * @li Multicast flag (Rx @a IX_ETHACC_NE_MCASTMASK)
- * @li Broadcast flag (Rx @a IX_ETHACC_NE_BCASTMASK)
- * @li Destination port flag (Tx @a IX_ETHACC_NE_PORTMASK)
- * @li Tag/Untag Tx frame (Tx @a IX_ETHACC_NE_TAGMODEMASK)
- * @li Overwrite destination port (Tx @a IX_ETHACC_NE_PORTOVERMASK)
- * @li Filtered frame (Rx @a IX_ETHACC_NE_STMASK)
- * @li VLAN Enabled (Rx and Tx @a IX_ETHACC_NE_VLANENABLEMASK)
- */
-#define IX_ETHACC_NE_FLAGS(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixFlags
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_BCASTMASK
- *
- * @brief This mask defines if a received frame is a broadcast frame.
- *
- * This mask defines if a received frame is a broadcast frame.
- * The BCAST flag is set when the destination MAC address of
- * a frame is broadcast.
- *
- * @sa IX_ETHACC_NE_FLAGS
- *
- */
-#define IX_ETHACC_NE_BCASTMASK (0x1)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_MCASTMASK
- *
- * @brief This mask defines if a received frame is a multicast frame.
- *
- * This mask defines if a received frame is a multicast frame.
- * The MCAST flag is set when the destination MAC address of
- * a frame is multicast.
- *
- * @sa IX_ETHACC_NE_FLAGS
- *
- */
-#define IX_ETHACC_NE_MCASTMASK (0x1 << 1)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_IPMASK
- *
- * @brief This mask defines if a received frame is a IP frame.
- *
- * This mask applies to @a IX_ETHACC_NE_FLAGS and defines if a received
- * frame is a IP frame. The IP flag is set on Rx direction, depending on
- * the frame contents. The flag is set when the length/type field of a
- * received frame is 0x8000.
- *
- * @sa IX_ETHACC_NE_FLAGS
- *
- */
-#define IX_ETHACC_NE_IPMASK (0x1 << 2)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_VLANMASK
- *
- * @brief This mask defines if a received frame is VLAN tagged.
- *
- * This mask defines if a received frame is VLAN tagged.
- * When set, the Rx frame is VLAN-tagged and the tag value
- * is available thru @a IX_ETHACC_NE_VLANID.
- * Note that when sending frames which are already tagged
- * this flag should be set, to avoid inserting another VLAN tag.
- *
- * @sa IX_ETHACC_NE_FLAGS
- * @sa IX_ETHACC_NE_VLANID
- *
- */
-#define IX_ETHACC_NE_VLANMASK (0x1 << 3)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_LINKMASK
- *
- * @brief This mask is the link layer protocol indicator
- *
- * This mask applies to @a IX_ETHACC_NE_FLAGS.
- * It reflects the state of a frame as it exits an NPE on the Rx path
- * or enters an NPE on the Tx path. Its values are as follows:
- * @li 0x00 - IEEE802.3 - 8802 (Rx) / IEEE802.3 - 8802 (Tx)
- * @li 0x01 - IEEE802.3 - Ethernet (Rx) / IEEE802.3 - Ethernet (Tx)
- * @li 0x02 - IEEE802.11 AP -> STA (Rx) / IEEE802.11 STA -> AP (Tx)
- * @li 0x03 - IEEE802.11 AP -> AP (Rx) / IEEE802.11 AP->AP (Tx)
- *
- * @sa IX_ETHACC_NE_FLAGS
- *
- */
-#define IX_ETHACC_NE_LINKMASK (0x3 << 4)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_STMASK
- *
- * @brief This mask defines if a received frame is a Spanning Tree frame.
- *
- * This mask applies to @a IX_ETHACC_NE_FLAGS.
- * On rx direction, it defines if a received if frame is a Spanning Tree frame.
- * Setting this fkag on transmit direction overrides the port settings
- * regarding the VLAN options and
- *
- * @sa IX_ETHACC_NE_FLAGS
- *
- */
-#define IX_ETHACC_NE_STMASK (0x1 << 6)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_FILTERMASK
- *
- * @brief This bit indicates whether a frame has been filtered by the Rx service.
- *
- * This mask applies to @a IX_ETHACC_NE_FLAGS.
- * Certain frames, which should normally be fully filtered by the NPE to due
- * the destination MAC address being on the same segment as the Rx port are
- * still forwarded to the XScale (although the payload is invalid) in order
- * to learn the MAC address of the transmitting station, if this is unknown.
- * Normally EthAcc will filter and recycle these framess internally and no
- * frames with the FILTER bit set will be received by the client.
- *
- * @sa IX_ETHACC_NE_FLAGS
- *
- */
-#define IX_ETHACC_NE_FILTERMASK (0x1 << 7)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_PORTMASK
- *
- * @brief This mask defines the rule to transmit a frame
- *
- * This mask defines the rule to transmit a frame. When set, a frame
- * is transmitted to the destination port as set by the macro
- * @a IX_ETHACC_NE_DESTPORTID. If not set, the destination port
- * is searched using the destination MAC address.
- *
- * @note This flag is meaningful only for multiport Network Engines.
- *
- * @sa IX_ETHACC_NE_FLAGS
- * @sa IX_ETHACC_NE_DESTPORTID
- *
- */
-#define IX_ETHACC_NE_PORTOVERMASK (0x1 << 8)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_TAGMODEMASK
- *
- * @brief This mask defines the tagging rules to apply to a transmit frame.
- *
- * This mask defines the tagging rules to apply to a transmit frame
- * regardless of the default setting for a port. When used together
- * with @a IX_ETHACC_NE_TAGOVERMASK and when set, the
- * frame will be tagged prior to transmission. When not set,
- * the frame will be untagged prior to transmission. This is accomplished
- * irrespective of the Egress tagging rules, constituting a per-frame override.
- *
- * @sa IX_ETHACC_NE_FLAGS
- * @sa IX_ETHACC_NE_TAGOVERMASK
- *
- */
-#define IX_ETHACC_NE_TAGMODEMASK (0x1 << 9)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_TAGOVERMASK
- *
- * @brief This mask defines the rule to transmit a frame
- *
- * This mask defines the rule to transmit a frame. When set, the
- * default transmit rules of a port are overriden.
- * When not set, the default rules as set by @ref IxEthDB should apply.
- *
- * @sa IX_ETHACC_NE_FLAGS
- * @sa IX_ETHACC_NE_TAGMODEMASK
- *
- */
-#define IX_ETHACC_NE_TAGOVERMASK (0x1 << 10)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_VLANENABLEMASK
- *
- * @brief This mask defines if a frame is a VLAN frame or not
- *
- * When set, frames undergo normal VLAN processing on the Tx path
- * (membership filtering, tagging, tag removal etc). If this flag is
- * not set, the frame is considered to be a regular non-VLAN frame
- * and no VLAN processing will be performed.
- *
- * Note that VLAN-enabled NPE images will always set this flag in all
- * Rx frames, and images which are not VLAN enabled will clear this
- * flag for all received frames.
- *
- * @sa IX_ETHACC_NE_FLAGS
- *
- */
-#define IX_ETHACC_NE_VLANENABLEMASK (0x1 << 14)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IX_ETHACC_NE_NEWSRCMASK
- *
- * @brief This mask defines if a received frame has been learned.
- *
- * This mask defines if the source MAC address of a frame is
- * already known. If the bit is set, the source MAC address was
- * unknown to the NPE at the time the frame was received.
- *
- * @sa IX_ETHACC_NE_FLAGS
- *
- */
-#define IX_ETHACC_NE_NEWSRCMASK (0x1 << 15)
-
-/**
- * @ingroup IxEthAcc
- *
- * @brief This defines the recommanded minimum size of MBUF's submitted
- * to the frame receive service.
- *
- */
-#define IX_ETHACC_RX_MBUF_MIN_SIZE (2048)
-
-/**
- * @ingroup IxEthAcc
- *
- * @brief This defines the highest MII address of any attached PHYs
- *
- * The maximum number for PHY address is 31, add on for range checking.
- *
- */
-#define IXP425_ETH_ACC_MII_MAX_ADDR 32
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccInit(void)
- *
- * @brief Initializes the IXP400 Ethernet Access Service.
- *
- * @li Reentrant - no
- * @li ISR Callable - no
- *
- * This should be called once per module initialization.
- * @pre
- * The NPE must first be downloaded with the required microcode which supports all
- * required features.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_FAIL : Service has failed to initialize.
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus ixEthAccInit(void);
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccUnload(void)
- *
- * @brief Unload the Ethernet Access Service.
- *
- * @li Reentrant - no
- * @li ISR Callable - no
- *
- * @return void
- *
- * <hr>
- */
-PUBLIC void ixEthAccUnload(void);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortInit( IxEthAccPortId portId)
- *
- * @brief Initializes an NPE/Ethernet MAC Port.
- *
- * The NPE/Ethernet port initialisation includes the following steps
- * @li Initialize the NPE/Ethernet MAC hardware.
- * @li Verify NPE downloaded and operational.
- * @li The NPE shall be available for usage once this API returns.
- * @li Verify that the Ethernet port is present before initializing
- *
- * @li Reentrant - no
- * @li ISR Callable - no
- *
- * This should be called once per mac device.
- * The NPE/MAC shall be in disabled state after init.
- *
- * @pre
- * The component must be initialized via @a ixEthAccInit
- * The NPE must first be downloaded with the required microcode which supports all
- * required features.
- *
- * Dependant on Services: (Must be initialized before using this service may be initialized)
- * ixNPEmh - NPE Message handling service.
- * ixQmgr - Queue Manager component.
- *
- * @param portId @ref IxEthAccPortId [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS: if the ethernet port is not present, a warning is issued.
- * @li @a IX_ETH_ACC_FAIL : The NPE processor has failed to initialize.
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus ixEthAccPortInit(IxEthAccPortId portId);
-
-
-/*************************************************************************
-
- ##### ## ##### ## ##### ## ##### # #
- # # # # # # # # # # # # # #
- # # # # # # # # # # # # ######
- # # ###### # ###### ##### ###### # # #
- # # # # # # # # # # # # #
- ##### # # # # # # # # # # #
-
-*************************************************************************/
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortTxFrameSubmit(
- IxEthAccPortId portId,
- IX_OSAL_MBUF *buffer,
- IxEthAccTxPriority priority)
- *
- * @brief This function shall be used to submit MBUFs buffers for transmission on a particular MAC device.
- *
- * When the frame is transmitted, the buffer shall be returned thru the
- * callback @a IxEthAccPortTxDoneCallback.
- *
- * In case of over-submitting, the order of the frames on the
- * network may be modified.
- *
- * Buffers shall be not queued for transmission if the port is disabled.
- * The port can be enabled using @a ixEthAccPortEnable
- *
- *
- * @li Reentrant - yes
- * @li ISR Callable - yes
- *
- *
- * @pre
- * @a ixEthAccPortTxDoneCallbackRegister must be called to register a function to allow this service to
- * return the buffer to the calling service.
- *
- * @note
- * If the buffer submit fails for any reason the user has retained ownership of the buffer.
- *
- * @param portId @ref IxEthAccPortId [in] - MAC port ID to transmit Ethernet frame on.
- * @param buffer @ref IX_OSAL_MBUF [in] - pointer to an MBUF formatted buffer. Chained buffers are supported for transmission.
- * Chained packets are not supported and the field IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR is ignored.
- * @param priority @ref IxEthAccTxPriority [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_FAIL : Failed to queue frame for transmission.
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-
-PUBLIC IxEthAccStatus ixEthAccPortTxFrameSubmit(
- IxEthAccPortId portId,
- IX_OSAL_MBUF *buffer,
- IxEthAccTxPriority priority);
-
-/**
- * @ingroup IxEthAcc
- *
- * @brief Function prototype for Ethernet Tx Buffer Done callback. Registered
- * via @a ixEthAccTxBufferDoneCallbackRegister
- *
- * This function is called once the previously submitted buffer is no longer required by this service.
- * It may be returned upon successful transmission of the frame or during the shutdown of
- * the port prior to the transmission of a queued frame.
- * The calling of this registered function is not a guarantee of successful transmission of the buffer.
- *
- *
- * @li Reentrant - yes , The user provided function should be reentrant.
- * @li ISR Callable - yes , The user provided function must be callable from an ISR.
- *
- *
- * <b>Calling Context </b>:
- * @par
- * This callback is called in the context of the queue manager dispatch loop @a ixQmgrgrDispatcherLoopRun
- * within the @ref IxQMgrAPI component. The calling context may be from interrupt or high priority thread.
- * The decision is system specific.
- *
- * @param callbackTag UINT32 [in] - This tag is that provided when the callback was registered for a particular MAC
- * via @a ixEthAccPortTxDoneCallbackRegister. It allows the same callback to be used for multiple MACs.
- * @param mbuf @ref IX_OSAL_MBUF [in] - Pointer to the Tx mbuf descriptor.
- *
- * @return void
- *
- * @note
- * The field IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR is modified by the access layer and reset to NULL.
- *
- * <hr>
- */
-typedef void (*IxEthAccPortTxDoneCallback) ( UINT32 callbackTag, IX_OSAL_MBUF *buffer );
-
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortTxDoneCallbackRegister( IxEthAccPortId portId,
- IxEthAccPortTxDoneCallback txCallbackFn,
- UINT32 callbackTag)
- *
- * @brief Register a callback function to allow
- * the transmitted buffers to return to the user.
- *
- * This function registers the transmit buffer done function callback for a particular port.
- *
- * The registered callback function is called once the previously submitted buffer is no longer required by this service.
- * It may be returned upon successful transmission of the frame or shutdown of port prior to submission.
- * The calling of this registered function is not a guarantee of successful transmission of the buffer.
- *
- * If called several times the latest callback shall be registered for a particular port.
- *
- * @li Reentrant - yes
- * @li ISR Callable - yes
- *
- * @pre
- * The port must be initialized via @a ixEthAccPortInit
- *
- *
- * @param portId @ref IxEthAccPortId [in] - Register callback for a particular MAC device.
- * @param txCallbackFn @ref IxEthAccPortTxDoneCallback [in] - Function to be called to return transmit buffers to the user.
- * @param callbackTag UINT32 [in] - This tag shall be provided to the callback function.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- * @li @a IX_ETH_ACC_INVALID_ARG : An argument other than portId is invalid.
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortTxDoneCallbackRegister(IxEthAccPortId portId,
- IxEthAccPortTxDoneCallback txCallbackFn,
- UINT32 callbackTag);
-
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @brief Function prototype for Ethernet Frame Rx callback. Registered via @a ixEthAccPortRxCallbackRegister
- *
- * It is the responsibility of the user function to free any MBUF's which it receives.
- *
- * @li Reentrant - yes , The user provided function should be reentrant.
- * @li ISR Callable - yes , The user provided function must be callable from an ISR.
- * @par
- *
- * This function dispatches frames to the user level
- * via the provided function. The invocation shall be made for each
- * frame dequeued from the Ethernet QM queue. The user is required to free any MBUF's
- * supplied via this callback. In addition the registered callback must free up MBUF's
- * from the receive free queue when the port is disabled
- *
- * If called several times the latest callback shall be registered for a particular port.
- *
- * <b>Calling Context </b>:
- * @par
- * This callback is called in the context of the queue manager dispatch loop @a ixQmgrgrDispatcherLoopRun
- * within the @ref IxQMgrAPI component. The calling context may be from interrupt or high priority thread.
- * The decision is system specific.
- *
- *
- * @param callbackTag UINT32 [in] - This tag is that provided when the callback was registered for a particular MAC
- * via @a ixEthAccPortRxCallbackRegister. It allows the same callback to be used for multiple MACs.
- * @param mbuf @ref IX_OSAL_MBUF [in] - Pointer to the Rx mbuf header. Mbufs may be chained if
- * the frame length is greater than the supplied mbuf length.
- * @param reserved [in] - deprecated parameter The information is passed
- * thru the IxEthAccNe header destination port ID field
- * (@sa IX_ETHACC_NE_DESTPORTID). For backward
- * compatibility,the value is equal to IX_ETH_DB_UNKNOWN_PORT (0xff).
- *
- * @return void
- *
- * @note
- * Buffers may not be filled up to the length supplied in
- * @a ixEthAccPortRxFreeReplenish(). The firmware fills
- * them to the previous 64 bytes boundary. The user has to be aware
- * that the length of the received mbufs may be smaller than the length
- * of the supplied mbufs.
- * The mbuf header contains the following modified field
- * @li @a IX_OSAL_MBUF_PKT_LEN is set in the header of the first mbuf and indicates
- * the total frame size
- * @li @a IX_OSAL_MBUF_MLEN is set each mbuf header and indicates the payload length
- * @li @a IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR contains a pointer to the next
- * mbuf, or NULL at the end of a chain.
- * @li @a IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR is modified. Its value is reset to NULL
- * @li @a IX_OSAL_MBUF_FLAGS contains the bit 4 set for a broadcast packet and the bit 5
- * set for a multicast packet. Other bits are unmodified.
- *
- * <hr>
- */
-typedef void (*IxEthAccPortRxCallback) (UINT32 callbackTag, IX_OSAL_MBUF *buffer, UINT32 reserved);
-
-/**
- * @ingroup IxEthAcc
- *
- * @brief Function prototype for Ethernet Frame Rx callback. Registered via @a ixEthAccPortMultiBufferRxCallbackRegister
- *
- * It is the responsibility of the user function to free any MBUF's which it receives.
- *
- * @li Reentrant - yes , The user provided function should be reentrant.
- * @li ISR Callable - yes , The user provided function must be callable from an ISR.
- * @par
- *
- * This function dispatches many frames to the user level
- * via the provided function. The invocation shall be made for multiple frames
- * dequeued from the Ethernet QM queue. The user is required to free any MBUF's
- * supplied via this callback. In addition the registered callback must free up MBUF's
- * from the receive free queue when the port is disabled
- *
- * If called several times the latest callback shall be registered for a particular port.
- *
- * <b>Calling Context </b>:
- * @par
- * This callback is called in the context of the queue manager dispatch loop @a ixQmgrDispatcherLoopRun
- * within the @ref IxQMgrAPI component. The calling context may be from interrupt or high priority thread.
- * The decision is system specific.
- *
- *
- * @param callbackTag - This tag is that provided when the callback was registered for a particular MAC
- * via @a ixEthAccPortMultiBufferRxCallbackRegister. It allows the same callback to be used for multiple MACs.
- * @param mbuf - Pointer to an array of Rx mbuf headers. Mbufs
- * may be chained if
- * the frame length is greater than the supplied mbuf length.
- * The end of the array contains a zeroed entry (NULL pointer).
- *
- * @return void
- *
- * @note The mbufs passed to this callback have the same structure than the
- * buffers passed to @a IxEthAccPortRxCallback interfac.
- *
- * @note The usage of this callback is exclusive with the usage of
- * @a ixEthAccPortRxCallbackRegister and @a IxEthAccPortRxCallback
- *
- * @sa ixEthAccPortMultiBufferRxCallbackRegister
- * @sa IxEthAccPortMultiBufferRxCallback
- * @sa ixEthAccPortRxCallbackRegister
- * @sa IxEthAccPortRxCallback
- * <hr>
- */
-
-typedef void (*IxEthAccPortMultiBufferRxCallback) (UINT32 callbackTag, IX_OSAL_MBUF **buffer);
-
-
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortRxCallbackRegister( IxEthAccPortId portId, IxEthAccPortRxCallback rxCallbackFn, UINT32 callbackTag)
- *
- * @brief Register a callback function to allow
- * the reception of frames.
- *
- * The registered callback function is called once a frame is received by this service.
- *
- * If called several times the latest callback shall be registered for a particular port.
- *
- *
- * @li Reentrant - yes
- * @li ISR Callable - yes
- *
- *
- * @param portId @ref IxEthAccPortId [in] - Register callback for a particular MAC device.
- * @param rxCallbackFn @ref IxEthAccPortRxCallback [in] - Function to be called when Ethernet frames are availble.
- * @param callbackTag UINT32 [in] - This tag shall be provided to the callback function.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- * @li @a IX_ETH_ACC_INVALID_ARG : An argument other than portId is invalid.
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortRxCallbackRegister(IxEthAccPortId portId,
- IxEthAccPortRxCallback rxCallbackFn,
- UINT32 callbackTag);
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortMultiBufferRxCallbackRegister( IxEthAccPortId portId, IxEthAccPortMultiBufferRxCallback rxCallbackFn, UINT32 callbackTag)
- *
- * @brief Register a callback function to allow
- * the reception of frames.
- *
- * The registered callback function is called once a frame is
- * received by this service. If many frames are already received,
- * the function is called once.
- *
- * If called several times the latest callback shall be registered for a particular port.
- *
- * @li Reentrant - yes
- * @li ISR Callable - yes
- *
- *
- * @param portId - Register callback for a particular MAC device.
- * @param rxCallbackFn - @a IxEthAccMultiBufferRxCallbackFn - Function to be called when Ethernet frames are availble.
- * @param callbackTag - This tag shall be provided to the callback function.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- * @li @a IX_ETH_ACC_INVALID_ARG : An argument other than portId is invalid.
- *
- * @sa ixEthAccPortMultiBufferRxCallbackRegister
- * @sa IxEthAccPortMultiBufferRxCallback
- * @sa ixEthAccPortRxCallbackRegister
- * @sa IxEthAccPortRxCallback
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortMultiBufferRxCallbackRegister(IxEthAccPortId portId,
- IxEthAccPortMultiBufferRxCallback rxCallbackFn,
- UINT32 callbackTag);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortRxFreeReplenish( IxEthAccPortId portId, IX_OSAL_MBUF *buffer)
- *
- * @brief This function provides buffers for the Ethernet receive path.
- *
- * This component does not have a buffer management mechanisms built in. All Rx buffers must be supplied to it
- * via this interface.
- *
- * @li Reentrant - yes
- * @li ISR Callable - yes
- *
- * @param portId @ref IxEthAccPortId [in] - Provide buffers only to specific Rx MAC.
- * @param buffer @ref IX_OSAL_MBUF [in] - Provide an MBUF to the Ethernet receive mechanism.
- * Buffers size smaller than IX_ETHACC_RX_MBUF_MIN_SIZE may result in poor
- * performances and excessive buffer chaining. Buffers
- * larger than this size may be suitable for jumbo frames.
- * Chained packets are not supported and the field IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR must be NULL.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_FAIL : Buffer has was not able to queue the
- * buffer in the receive service.
- * @li @a IX_ETH_ACC_FAIL : Buffer size is less than IX_ETHACC_RX_MBUF_MIN_SIZE
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * @note
- * If the buffer replenish operation fails it is the responsibility
- * of the user to free the buffer.
- *
- * @note
- * Sufficient buffers must be supplied to the component to maintain
- * receive throughput and avoid rx buffer underflow conditions.
- * To meet this goal, It is expected that the user preload the
- * component with a sufficent number of buffers prior to enabling the
- * NPE Ethernet receive path. The recommended minimum number of
- * buffers is 8.
- *
- * @note
- * For maximum performances, the mbuf size should be greater
- * than the maximum frame size (Ethernet header, payload and FCS) + 64.
- * Supplying smaller mbufs to the service results in mbuf
- * chaining and degraded performances. The recommended size
- * is @a IX_ETHACC_RX_MBUF_MIN_SIZE, which is
- * enough to take care of 802.3 frames and "baby jumbo" frames without
- * chaining, and "jumbo" frame within chaining.
- *
- * @note
- * Buffers may not be filled up to their length. The firware fills
- * them up to the previous 64 bytes boundary. The user has to be aware
- * that the length of the received mbufs may be smaller than the length
- * of the supplied mbufs.
- *
- * @warning This function checks the parameters if the NDEBUG
- * flag is not defined. Turning on the argument checking (disabled by
- * default) results in a lower EthAcc performance as this function
- * is part of the data path.
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortRxFreeReplenish( IxEthAccPortId portId, IX_OSAL_MBUF *buffer);
-
-
-
-/***************************************************************
-
- #### #### # # ##### ##### #### #
- # # # # ## # # # # # # #
- # # # # # # # # # # # #
- # # # # # # # ##### # # #
- # # # # # ## # # # # # #
- #### #### # # # # # #### ######
-
-
- ##### # ## # # ######
- # # # # # ## # #
- # # # # # # # # #####
- ##### # ###### # # # #
- # # # # # ## #
- # ###### # # # # ######
-
-***************************************************************/
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortEnable(IxEthAccPortId portId)
- *
- * @brief This enables an Ethernet port for both Tx and Rx.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @pre The port must first be initialized via @a ixEthAccPortInit and the MAC address
- * must be set using @a ixEthAccUnicastMacAddressSet before enabling it
- * The rx and Tx Done callbacks registration via @a
- * ixEthAccPortTxDoneCallbackRegister amd @a ixEthAccPortRxCallbackRegister
- * has to be done before enabling the traffic.
- *
- * @param portId @ref IxEthAccPortId [in] - Port id to act upon.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is not initialized
- * @li @a IX_ETH_ACC_MAC_UNINITIALIZED : port MAC address is not initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus ixEthAccPortEnable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortDisable(IxEthAccPortId portId)
- *
- * @brief This disables an Ethernet port for both Tx and Rx.
- *
- * Free MBufs are returned to the user via the registered callback when the port is disabled
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @pre The port must be enabled with @a ixEthAccPortEnable, otherwise this
- * function has no effect
- *
- * @param portId @ref IxEthAccPortId [in] - Port id to act upon.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is not initialized
- * @li @a IX_ETH_ACC_MAC_UNINITIALIZED : port MAC address is not initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus ixEthAccPortDisable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortEnabledQuery(IxEthAccPortId portId, BOOL *enabled)
- *
- * @brief Get the enabled state of a port.
- *
- * @li Reentrant - yes
- * @li ISR Callable - yes
- *
- * @pre The port must first be initialized via @a ixEthAccPortInit
- *
- * @param portId @ref IxEthAccPortId [in] - Port id to act upon.
- * @param enabled BOOL [out] - location to store the state of the port
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortEnabledQuery(IxEthAccPortId portId, BOOL *enabled);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortPromiscuousModeClear(IxEthAccPortId portId)
- *
- * @brief Put the Ethernet MAC device in non-promiscuous mode.
- *
- * In non-promiscuous mode the MAC filters all frames other than
- * destination MAC address which matches the following criteria:
- * @li Unicast address provisioned via @a ixEthAccUnicastMacAddressSet
- * @li All broadcast frames.
- * @li Multicast addresses provisioned via @a ixEthAccMulticastAddressJoin
- *
- * Other functions modify the MAC filtering
- *
- * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
- * frames are forwarded to the application
- * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
- * effects of @a ixEthAccPortMulticastAddressJoinAll()
- * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
- * filtering address
- * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
- * filtering address
- * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
- * forwarded to the application regardless of the multicast
- * address provisioned
- * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
- * to the application following the multicast address provisioned
- *
- * In all cases, unicast and broadcast addresses are forwarded to
- * the application.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @sa ixEthAccPortPromiscuousModeSet
- *
- * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus ixEthAccPortPromiscuousModeClear(IxEthAccPortId portId);
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortPromiscuousModeSet(IxEthAccPortId portId)
- *
- * @brief Put the MAC device in promiscuous mode.
- *
- * If the device is in promiscuous mode then all all received frames shall be forwared
- * to the NPE for processing.
- *
- * Other functions modify the MAC filtering
- *
- * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
- * frames are forwarded to the application
- * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
- * effects of @a ixEthAccPortMulticastAddressJoinAll()
- * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
- * filtering address
- * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
- * filtering address
- * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
- * forwarded to the application regardless of the multicast
- * address provisioned
- * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
- * to the application following the multicast address provisioned
- *
- * In all cases, unicast and broadcast addresses are forwarded to
- * the application.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @sa ixEthAccPortPromiscuousModeClear
- *
- * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus ixEthAccPortPromiscuousModeSet(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortUnicastMacAddressSet( IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr)
- *
- * @brief Configure unicast MAC address for a particular port
- *
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
- * @param *macAddr @ref IxEthAccMacAddr [in] - Ethernet Mac address.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus ixEthAccPortUnicastMacAddressSet(IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortUnicastMacAddressGet( IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr)
- *
- * @brief Get unicast MAC address for a particular MAC port
- *
- * @pre
- * The MAC address must first be set via @a ixEthAccMacPromiscuousModeSet
- * If the MAC address has not been set, the function returns a
- * IX_ETH_ACC_MAC_UNINITIALIZED status
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
- * @param *macAddr @ref IxEthAccMacAddr [out] - Ethernet MAC address.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_MAC_UNINITIALIZED : port MAC address is not initialized.
- * @li @a IX_ETH_ACC_FAIL : macAddr is invalid.
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortUnicastMacAddressGet(IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr);
-
-
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortMulticastAddressJoin( IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr)
- *
- * @brief Add a multicast address to the MAC address table.
- *
- * @note
- * Due to the operation of the Ethernet MAC multicast filtering mechanism, frames which do not
- * have a multicast destination address which were provisioned via this API may be forwarded
- * to the NPE's. This is a result of the hardware comparison algorithm used in the destination mac address logic
- * within the Ethernet MAC.
- *
- * See Also: IXP425 hardware development manual.
- *
- * Other functions modify the MAC filtering
- *
- * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
- * frames are forwarded to the application
- * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
- * effects of @a ixEthAccPortMulticastAddressJoinAll()
- * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
- * filtering address
- * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
- * filtering address
- * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
- * forwarded to the application regardless of the multicast
- * address provisioned
- * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
- * to the application following the multicast address provisioned
- *
- * In all cases, unicast and broadcast addresses are forwarded to
- * the application.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
- * @param *macAddr @ref IxEthAccMacAddr [in] - Ethernet Mac address.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_FAIL : Error writing to the MAC registers
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortMulticastAddressJoin(IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortMulticastAddressJoinAll( IxEthAccPortId portId)
- *
- * @brief Filter all frames with multicast dest.
- *
- * This function clears the MAC address table, and then sets
- * the MAC to forward ALL multicast frames to the NPE.
- * Specifically, it forwards all frames whose destination address
- * has the LSB of the highest byte set (01:00:00:00:00:00). This
- * bit is commonly referred to as the "multicast bit".
- * Broadcast frames will still be forwarded.
- *
- * Other functions modify the MAC filtering
- *
- * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
- * frames are forwarded to the application
- * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
- * effects of @a ixEthAccPortMulticastAddressJoinAll()
- * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
- * filtering address
- * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
- * filtering address
- * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
- * forwarded to the application regardless of the multicast
- * address provisioned
- * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
- * to the application following the multicast address provisioned
- *
- * In all cases, unicast and broadcast addresses are forwarded to
- * the application.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortMulticastAddressJoinAll(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortMulticastAddressLeave( IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr)
- *
- * @brief Remove a multicast address from the MAC address table.
- *
- * Other functions modify the MAC filtering
- *
- * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
- * frames are forwarded to the application
- * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
- * effects of @a ixEthAccPortMulticastAddressJoinAll()
- * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
- * filtering address
- * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
- * filtering address
- * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
- * forwarded to the application regardless of the multicast
- * address provisioned
- * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
- * to the application following the multicast address provisioned
- *
- * In all cases, unicast and broadcast addresses are forwarded to
- * the application.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
- * @param *macAddr @ref IxEthAccMacAddr [in] - Ethernet Mac address.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_NO_SUCH_ADDR : Failed if MAC address was not in the table.
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortMulticastAddressLeave(IxEthAccPortId portId,
- IxEthAccMacAddr *macAddr);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortMulticastAddressLeaveAll( IxEthAccPortId portId)
- *
- * @brief This function unconfigures the multicast filtering settings
- *
- * This function first clears the MAC address table, and then sets
- * the MAC as configured by the promiscuous mode current settings.
- *
- * Other functions modify the MAC filtering
- *
- * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
- * frames are forwarded to the application
- * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
- * effects of @a ixEthAccPortMulticastAddressJoinAll()
- * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
- * filtering address
- * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
- * filtering address
- * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
- * forwarded to the application regardless of the multicast
- * address provisioned
- * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
- * to the application following the multicast address provisioned
- *
- * In all cases, unicast and broadcast addresses are forwarded to
- * the application.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortMulticastAddressLeaveAll(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortUnicastAddressShow(IxEthAccPortId portId)
- *
- * @brief Displays unicast MAC address
- *
- * Displays unicast address which is configured using
- * @a ixEthAccUnicastMacAddressSet. This function also displays the MAC filter used
- * to filter multicast frames.
- *
- * Other functions modify the MAC filtering
- *
- * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
- * frames are forwarded to the application
- * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
- * effects of @a ixEthAccPortMulticastAddressJoinAll()
- * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
- * filtering address
- * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
- * filtering address
- * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
- * forwarded to the application regardless of the multicast
- * address provisioned
- * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
- * to the application following the multicast address provisioned
- *
- * In all cases, unicast and broadcast addresses are forwarded to
- * the application.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
- *
- * @return void
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus ixEthAccPortUnicastAddressShow(IxEthAccPortId portId);
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortMulticastAddressShow( IxEthAccPortId portId)
- *
- * @brief Displays multicast MAC address
- *
- * Displays multicast address which have been configured using @a ixEthAccMulticastAddressJoin
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
- *
- * @return void
- *
- * <hr>
- */
-PUBLIC void ixEthAccPortMulticastAddressShow( IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortDuplexModeSet( IxEthAccPortId portId, IxEthAccDuplexMode mode )
- *
- * @brief Set the duplex mode for the MAC.
- *
- * Configure the IXP400 MAC to either full or half duplex.
- *
- * @note
- * The configuration should match that provisioned on the PHY.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in]
- * @param mode @ref IxEthAccDuplexMode [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortDuplexModeSet(IxEthAccPortId portId,IxEthAccDuplexMode mode);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortDuplexModeGet( IxEthAccPortId portId, IxEthAccDuplexMode *mode )
- *
- * @brief Get the duplex mode for the MAC.
- *
- * return the duplex configuration of the IXP400 MAC.
- *
- * @note
- * The configuration should match that provisioned on the PHY.
- * See @a ixEthAccDuplexModeSet
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in]
- * @param *mode @ref IxEthAccDuplexMode [out]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- *
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortDuplexModeGet(IxEthAccPortId portId,IxEthAccDuplexMode *mode );
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortTxFrameAppendPaddingEnable( IxEthAccPortId portId)
- *
- * @brief Enable padding bytes to be appended to runt frames submitted to
- * this port
- *
- * Enable up to 60 null-bytes padding bytes to be appended to runt frames
- * submitted to this port. This is the default behavior of the access
- * component.
- *
- * @warning Do not change this behaviour while the port is enabled.
- *
- * @note When Tx padding is enabled, Tx FCS generation is turned on
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @sa ixEthAccPortTxFrameAppendFCSDusable
- *
- * @param portId @ref IxEthAccPortId [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortTxFrameAppendPaddingEnable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortTxFrameAppendPaddingDisable( IxEthAccPortId portId)
- *
- * @brief Disable padding bytes to be appended to runt frames submitted to
- * this port
- *
- * Disable padding bytes to be appended to runt frames
- * submitted to this port. This is not the default behavior of the access
- * component.
- *
- * @warning Do not change this behaviour while the port is enabled.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortTxFrameAppendPaddingDisable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortTxFrameAppendFCSEnable( IxEthAccPortId portId)
- *
- * @brief Enable the appending of Ethernet FCS to all frames submitted to this port
- *
- * When enabled, the FCS is added to the submitted frames. This is the default
- * behavior of the access component.
- * Do not change this behaviour while the port is enabled.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortTxFrameAppendFCSEnable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortTxFrameAppendFCSDisable( IxEthAccPortId portId)
- *
- * @brief Disable the appending of Ethernet FCS to all frames submitted to this port.
- *
- * When disabled, the Ethernet FCS is not added to the submitted frames.
- * This is not the default
- * behavior of the access component.
- *
- * @note Since the FCS is not appended to the frame it is expected that the frame submitted to the
- * component includes a valid FCS at the end of the data, although this will not be validated.
- *
- * The component shall forward the frame to the Ethernet MAC WITHOUT modification.
- *
- * Do not change this behaviour while the port is enabled.
- *
- * @note Tx FCS append is not disabled while Tx padding is enabled.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @sa ixEthAccPortTxFrameAppendPaddingEnable
- *
- * @param portId @ref IxEthAccPortId [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortTxFrameAppendFCSDisable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortRxFrameAppendFCSEnable( IxEthAccPortId portId)
- *
- * @brief Forward frames with FCS included in the receive buffer.
- *
- * The FCS is not striped from the receive buffer.
- * The received frame length includes the FCS size (4 bytes). ie.
- * A minimum sized ethernet frame shall have a length of 64bytes.
- *
- * Frame FCS validity checks are still carried out on all received frames.
- *
- * This is not the default
- * behavior of the access component.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortRxFrameAppendFCSEnable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccPortRxFrameAppendFCSDisable( IxEthAccPortId portId)
- *
- * @brief Do not forward the FCS portion of the received Ethernet frame to the user.
- * The FCS is striped from the receive buffer.
- * The received frame length does not include the FCS size (4 bytes).
- * Frame FCS validity checks are still carried out on all received frames.
- *
- * This is the default behavior of the component.
- * Do not change this behaviour while the port is enabled.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortRxFrameAppendFCSDisable(IxEthAccPortId portId);
-
-
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @enum IxEthAccSchedulerDiscipline
- *
- * @brief Definition for the port scheduling discipline
- *
- * Select the port scheduling discipline on receive and transmit path
- * @li FIFO : No Priority : In this configuration all frames are processed
- * in the access component in the strict order in which
- * the component received them.
- * @li FIFO : Priority : This shall be a very simple priority mechanism.
- * Higher prior-ity frames shall be forwarded
- * before lower priority frames. There shall be no
- * fairness mechanisms applied across different
- * priorities. Higher priority frames could starve
- * lower priority frames indefinitely.
- */
-typedef enum
-{
- FIFO_NO_PRIORITY, /**<frames submitted with no priority*/
- FIFO_PRIORITY /**<higher prority frames submitted before lower priority*/
-}IxEthAccSchedulerDiscipline;
-
-/**
- * @ingroup IxEthAcc
- *
- * @def IxEthAccTxSchedulerDiscipline
- *
- * @brief Deprecated definition for the port transmit scheduling discipline
- */
-#define IxEthAccTxSchedulerDiscipline IxEthAccSchedulerDiscipline
-
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccTxSchedulingDisciplineSet( IxEthAccPortId portId, IxEthAccSchedulerDiscipline sched)
- *
- * @brief Set the port scheduling to one of @a IxEthAccSchedulerDiscipline
- *
- * The default behavior of the component is @a FIFO_NO_PRIORITY.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @pre
- *
- *
- * @param portId @ref IxEthAccPortId [in]
- * @param sched @ref IxEthAccSchedulerDiscipline [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS : Set appropriate discipline.
- * @li @a IX_ETH_ACC_FAIL : Invalid/unsupported discipline.
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccTxSchedulingDisciplineSet(IxEthAccPortId portId,
- IxEthAccSchedulerDiscipline sched);
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccRxSchedulingDisciplineSet(IxEthAccSchedulerDiscipline sched)
- *
- * @brief Set the Rx scheduling to one of @a IxEthAccSchedulerDiscipline
- *
- * The default behavior of the component is @a FIFO_NO_PRIORITY.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @pre
- *
- * @param sched : @a IxEthAccSchedulerDiscipline
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS : Set appropriate discipline.
- * @li @a IX_ETH_ACC_FAIL : Invalid/unsupported discipline.
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccRxSchedulingDisciplineSet(IxEthAccSchedulerDiscipline sched);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn IxEthAccStatus ixEthAccNpeLoopbackEnable(IxEthAccPortId portId)
- *
- * @brief Enable NPE loopback
- *
- * When this loopback mode is enabled all the transmitted frames are
- * received on the same port, without payload.
- *
- * This function is recommended for power-up diagnostic checks and
- * should never be used under normal Ethernet traffic operations.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @pre
- *
- * @param portId : ID of the port
- *
- * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
- * guaranteed to restore correct Ethernet Tx/Rx operation.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS : NPE loopback mode enabled
- * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortNpeLoopbackEnable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn IxEthAccStatus ixEthAccPortNpeLoopbackDisable(IxEthAccPortId portId)
- *
- * @brief Disable NPE loopback
- *
- * This function is used to disable the NPE loopback if previously
- * enabled using ixEthAccNpeLoopbackEnable.
- *
- * This function is recommended for power-up diagnostic checks and
- * should never be used under normal Ethernet traffic operations.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @pre
- *
- * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
- * guaranteed to restore correct Ethernet Tx/Rx operation.
- *
- * @param portId : ID of the port
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS : NPE loopback successfully disabled
- * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortNpeLoopbackDisable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn IxEthAccStatus ixEthAccPortTxEnable(IxEthAccPortId portId)
- *
- * @brief Enable Tx on the port
- *
- * This function is the complement of ixEthAccPortTxDisable and should
- * be used only after Tx was disabled. A MAC core reset is required before
- * this function is called (see @a ixEthAccPortMacReset).
- *
- * This function is the recommended usage scenario for emergency security
- * shutdown and hardware failure recovery and should never be used for throttling
- * traffic.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @pre
- *
- * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
- * guaranteed to restore correct Ethernet Tx/Rx operation.
- *
- * @param portId : ID of the port
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS : Tx successfully enabled
- * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortTxEnable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn IxEthAccStatus ixEthAccPortTxDisable(IxEthAccPortId portId)
- *
- * @brief Disable Tx on the port
- *
- * This function can be used to disable Tx in the MAC core.
- * Tx can be re-enabled, although this is not guaranteed, by performing
- * a MAC core reset (@a ixEthAccPortMacReset) and calling ixEthAccPortTxEnable.
- * Note that using this function is not recommended, except for shutting
- * down Tx for emergency reasons. For proper port shutdown and re-enabling
- * see ixEthAccPortEnable and ixEthAccPortDisable.
- *
- * This function is the recommended usage scenario for emergency security
- * shutdown and hardware failure recovery and should never be used for throttling
- * traffic.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
- * guaranteed to restore correct Ethernet Tx/Rx operation.
- *
- * @pre
- *
- * @param portId : ID of the port
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS : Tx successfully disabled
- * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortTxDisable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn IxEthAccStatus ixEthAccPortRxEnable(IxEthAccPortId portId)
- *
- * @brief Enable Rx on the port
- *
- * This function is the complement of ixEthAccPortRxDisable and should
- * be used only after Rx was disabled.
- *
- * This function is the recommended usage scenario for emergency security
- * shutdown and hardware failure recovery and should never be used for throttling
- * traffic.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
- * guaranteed to restore correct Ethernet Tx/Rx operation.
- *
- * @pre
- *
- * @param portId : ID of the port
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS : Rx successfully enabled
- * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortRxEnable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn IxEthAccStatus ixEthAccPortRxDisable(IxEthAccPortId portId)
- *
- * @brief Disable Rx on the port
- *
- * This function can be used to disable Rx in the MAC core.
- * Rx can be re-enabled, although this is not guaranteed, by performing
- * a MAC core reset (@a ixEthAccPortMacReset) and calling ixEthAccPortRxEnable.
- * Note that using this function is not recommended, except for shutting
- * down Rx for emergency reasons. For proper port shutdown and re-enabling
- * see ixEthAccPortEnable and ixEthAccPortDisable.
- *
- * This function is the recommended usage scenario for emergency security
- * shutdown and hardware failure recovery and should never be used for throttling
- * traffic.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @pre
- *
- * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
- * guaranteed to restore correct Ethernet Tx/Rx operation.
- *
- * @param portId : ID of the port
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS : Rx successfully disabled
- * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortRxDisable(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn IxEthAccStatus ixEthAccPortMacReset(IxEthAccPortId portId)
- *
- * @brief Reset MAC core on the port
- *
- * This function will perform a MAC core reset (NPE Ethernet coprocessor).
- * This function is inherently unsafe and the NPE recovery is not guaranteed
- * after this function is called. The proper manner of performing port disable
- * and enable (which will reset the MAC as well) is ixEthAccPortEnable/ixEthAccPortDisable.
- *
- * This function is the recommended usage scenario for hardware failure recovery
- * and should never be used for throttling traffic.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @pre
- *
- * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
- * guaranteed to restore correct Ethernet Tx/Rx operation.
- *
- * @param portId : ID of the port
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS : MAC core reset
- * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccPortMacReset(IxEthAccPortId portId);
-
-/*********************************************************************************
- #### ##### ## ##### # #### ##### # #### ####
- # # # # # # # # # # # #
- #### # # # # # #### # # # ####
- # # ###### # # # # # # #
- # # # # # # # # # # # # # # #
- #### # # # # # #### # # #### ####
-**********************************************************************************/
-
-
-/**
- *
- * @brief This struct defines the statistics returned by this component.
- *
- * The component returns MIB2 EthObj variables which are obtained from the
- * hardware or maintained by this component.
- *
- *
- */
-typedef struct
-{
- UINT32 dot3StatsAlignmentErrors; /**< link error count (rx) */
- UINT32 dot3StatsFCSErrors; /**< link error count (rx) */
- UINT32 dot3StatsInternalMacReceiveErrors; /**< link error count (rx) */
- UINT32 RxOverrunDiscards; /**< NPE: discarded frames count (rx) */
- UINT32 RxLearnedEntryDiscards; /**< NPE: discarded frames count(rx) */
- UINT32 RxLargeFramesDiscards; /**< NPE: discarded frames count(rx) */
- UINT32 RxSTPBlockedDiscards; /**< NPE: discarded frames count(rx) */
- UINT32 RxVLANTypeFilterDiscards; /**< NPE: discarded frames count (rx) */
- UINT32 RxVLANIdFilterDiscards; /**< NPE: discarded frames count (rx) */
- UINT32 RxInvalidSourceDiscards; /**< NPE: discarded frames count (rx) */
- UINT32 RxBlackListDiscards; /**< NPE: discarded frames count (rx) */
- UINT32 RxWhiteListDiscards; /**< NPE: discarded frames count (rx) */
- UINT32 RxUnderflowEntryDiscards; /**< NPE: discarded frames count (rx) */
- UINT32 dot3StatsSingleCollisionFrames; /**< link error count (tx) */
- UINT32 dot3StatsMultipleCollisionFrames; /**< link error count (tx) */
- UINT32 dot3StatsDeferredTransmissions; /**< link error count (tx) */
- UINT32 dot3StatsLateCollisions; /**< link error count (tx) */
- UINT32 dot3StatsExcessiveCollsions; /**< link error count (tx) */
- UINT32 dot3StatsInternalMacTransmitErrors; /**< link error count (tx) */
- UINT32 dot3StatsCarrierSenseErrors; /**< link error count (tx) */
- UINT32 TxLargeFrameDiscards; /**< NPE: discarded frames count (tx) */
- UINT32 TxVLANIdFilterDiscards; /**< NPE: discarded frames count (tx) */
-
-}IxEthEthObjStats;
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccMibIIStatsGet(IxEthAccPortId portId ,IxEthEthObjStats *retStats )
- *
- * @brief Returns the statistics maintained for a port.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @pre
- *
- *
- * @param portId @ref IxEthAccPortId [in]
- * @param retStats @ref IxEthEthObjStats [out]
- * @note Please note the user is responsible for cache coheriency of the retStat
- * buffer. The data is actually populated via the NPE's. As such cache safe
- * memory should be used in the retStats argument.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_FAIL : Invalid arguments.
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccMibIIStatsGet(IxEthAccPortId portId, IxEthEthObjStats *retStats );
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccMibIIStatsGetClear(IxEthAccPortId portId, IxEthEthObjStats *retStats)
- *
- * @brief Returns and clears the statistics maintained for a port.
- *
- * @li Reentrant - yes
- * @li ISR Callable - yes
- *
- * @pre
- *
- * @param portId @ref IxEthAccPortId [in]
- * @param retStats @ref IxEthEthObjStats [out]
- * @note Please note the user is responsible for cache coheriency of the retStats
- * buffer. The data is actually populated via the NPE's. As such cache safe
- * memory should be used in the retStats argument.
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_FAIL : invalid arguments.
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccMibIIStatsGetClear(IxEthAccPortId portId, IxEthEthObjStats *retStats);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccMibIIStatsClear(IxEthAccPortId portId)
- *
- * @brief Clears the statistics maintained for a port.
- *
- * @li Reentrant - yes
- * @li ISR Callable - no
- *
- * @pre
- *
- * @param portId @ref IxEthAccPortId [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_FAIL : Invalid arguments.
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus ixEthAccMibIIStatsClear(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccMacInit(IxEthAccPortId portId)
- *
- * @brief Initializes the ethernet MAC settings
- *
- * @li Reentrant - no
- * @li ISR Callable - no
- *
- * @param portId @ref IxEthAccPortId [in]
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus ixEthAccMacInit(IxEthAccPortId portId);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccStatsShow(IxEthAccPortId portId)
- *
- *
- * @brief Displays a ports statistics on the standard io console using printf.
- *
- * @li Reentrant - no
- * @li ISR Callable - no
- *
- * @pre
- *
- * @param portId @ref IxEthAccPortId [in]
- *
- * @return void
- *
- * <hr>
- */
-PUBLIC void ixEthAccStatsShow(IxEthAccPortId portId);
-
-/*************************************************************************
-
- # # # # # # ##### # ####
- ## ## # # ## ## # # # # #
- # ## # # # # ## # # # # # #
- # # # # # # # # # # #
- # # # # # # # # # # #
- # # # # # # ##### # ####
-
-*************************************************************************/
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccMiiReadRtn (UINT8 phyAddr,
- UINT8 phyReg,
- UINT16 *value)
- *
- *
- * @brief Reads a 16 bit value from a PHY
- *
- * Reads a 16-bit word from a register of a MII-compliant PHY. Reading
- * is performed through the MII management interface. This function returns
- * when the read operation has successfully completed, or when a timeout has elapsed.
- *
- * @li Reentrant - no
- * @li ISR Callable - no
- *
- * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
- *
- * @param phyAddr UINT8 [in] - the address of the Ethernet PHY (0-31)
- * @param phyReg UINT8 [in] - the number of the MII register to read (0-31)
- * @param value UINT16 [in] - the value read from the register
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_FAIL : failed to read the register.
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccMiiReadRtn (UINT8 phyAddr, UINT8 phyReg, UINT16 *value);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccMiiWriteRtn (UINT8 phyAddr,
- UINT8 phyReg,
- UINT16 value)
- *
- *
- * @brief Writes a 16 bit value to a PHY
- *
- * Writes a 16-bit word from a register of a MII-compliant PHY. Writing
- * is performed through the MII management interface. This function returns
- * when the write operation has successfully completed, or when a timeout has elapsed.
- *
- * @li Reentrant - no
- * @li ISR Callable - no
- *
- * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
- *
- * @param phyAddr UINT8 [in] - the address of the Ethernet PHY (0-31)
- * @param phyReg UINT8 [in] - the number of the MII register to write (0-31)
- * @param value UINT16 [out] - the value to write to the register
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_FAIL : failed to write register.
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccMiiWriteRtn (UINT8 phyAddr, UINT8 phyReg, UINT16 value);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccMiiAccessTimeoutSet(UINT32 timeout)
- *
- * @brief Overrides the default timeout value and retry count when reading or
- * writing MII registers using ixEthAccMiiWriteRtn or ixEthAccMiiReadRtn
- *
- * The default behavior of the component is to use a IX_ETH_ACC_MII_10TH_SEC_IN_MILLIS ms
- * timeout (declared as 100 in IxEthAccMii_p.h) and a retry count of IX_ETH_ACC_MII_TIMEOUT_10TH_SECS
- * (declared as 5 in IxEthAccMii_p.h).
- *
- * The MII read and write functions will attempt to read the status of the register up
- * to the retry count times, delaying between each attempt with the timeout value.
- *
- * @li Reentrant - no
- * @li ISR Callable - no
- *
- * @pre
- *
- * @param timeout UINT32 [in] - new timeout value, in milliseconds
- * @param timeout UINT32 [in] - new retry count (a minimum value of 1 must be used)
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_FAIL : invalid parameter(s)
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus
-ixEthAccMiiAccessTimeoutSet(UINT32 timeout, UINT32 retryCount);
-
-/**
- * @ingroup IxEthAcc
- *
- * @fn ixEthAccMiiStatsShow (UINT32 phyAddr)
- *
- *
- * @brief Displays detailed information on a specified PHY
- *
- * Displays the current values of the first eigth MII registers for a PHY,
- *
- * @li Reentrant - no
- * @li ISR Callable - no
- *
- * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and
- * generating the MDIO clock.
- *
- * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
- *
- * @return IxEthAccStatus
- * @li @a IX_ETH_ACC_SUCCESS
- * @li @a IX_ETH_ACC_FAIL : invalid arguments.
- *
- * <hr>
- */
-PUBLIC IxEthAccStatus ixEthAccMiiStatsShow (UINT32 phyAddr);
-
-
-
-/******* BOARD SPECIFIC DEPRECATED API *********/
-
-/* The following functions are high level functions which rely
- * on the properties and interface of some Ethernet PHYs. The
- * implementation is hardware specific and has been moved to
- * the hardware-specific component IxEthMii.
- */
-
- #include "IxEthMii.h"
-
-/**
- * @ingroup IxEthAcc
- *
- * @def ixEthAccMiiPhyScan
- *
- * @brief : deprecated API entry point. This definition
- * ensures backward compatibility
- *
- * See @ref ixEthMiiPhyScan
- *
- * @note this feature is board specific
- *
- */
-#define ixEthAccMiiPhyScan(phyPresent) ixEthMiiPhyScan(phyPresent,IXP425_ETH_ACC_MII_MAX_ADDR)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def ixEthAccMiiPhyConfig
- *
- * @brief : deprecated API entry point. This definition
- * ensures backward compatibility
- *
- * See @ref ixEthMiiPhyConfig
- *
- * @note this feature is board specific
- */
-#define ixEthAccMiiPhyConfig(phyAddr,speed100,fullDuplex,autonegotiate) \
- ixEthMiiPhyConfig(phyAddr,speed100,fullDuplex,autonegotiate)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def ixEthAccMiiPhyReset
- *
- * @brief : deprecated API entry point. This definition
- * ensures backward compatibility
- *
- * See @ref ixEthMiiPhyReset
- *
- * @note this feature is board specific
- */
-#define ixEthAccMiiPhyReset(phyAddr) \
- ixEthMiiPhyReset(phyAddr)
-
-/**
- * @ingroup IxEthAcc
- *
- * @def ixEthAccMiiLinkStatus
- *
- * @brief : deprecated API entry point. This definition
- * ensures backward compatibility
- *
- * See @ref ixEthMiiLinkStatus
- *
- * @note this feature is board specific
- */
-#define ixEthAccMiiLinkStatus(phyAddr,linkUp,speed100,fullDuplex,autoneg) \
- ixEthMiiLinkStatus(phyAddr,linkUp,speed100,fullDuplex,autoneg)
-
-
-
-/**
- * @ingroup IxEthAcc
- *
- * @def ixEthAccMiiShow
- *
- * @brief : deprecated API entry point. This definition
- * ensures backward compatibility
- *
- * See @ref ixEthMiiPhyShow
- *
- * @note this feature is board specific
- */
-#define ixEthAccMiiShow(phyAddr) \
- ixEthMiiPhyShow(phyAddr)
-
-#endif /* ndef IxEthAcc_H */
-/**
- *@}
- */
diff --git a/cpu/ixp/npe/include/IxEthAccDataPlane_p.h b/cpu/ixp/npe/include/IxEthAccDataPlane_p.h
deleted file mode 100644
index b909386c26..0000000000
--- a/cpu/ixp/npe/include/IxEthAccDataPlane_p.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * @file IxEthAccDataPlane_p.h
- *
- * @author Intel Corporation
- * @date 12-Feb-2002
- *
- * @brief Internal Header file for IXP425 Ethernet Access component.
- *
- * Design Notes:
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-
-#ifndef IxEthAccDataPlane_p_H
-#define IxEthAccDataPlane_p_H
-
-#include <IxOsal.h>
-#include <IxQMgr.h>
-
-/**
- * @addtogroup IxEthAccPri
- *@{
- */
-
-/* typedefs global to this file*/
-
-typedef struct
-{
- IX_OSAL_MBUF *pHead;
- IX_OSAL_MBUF *pTail;
-}IxEthAccDataPlaneQList;
-
-
-/**
- * @struct IxEthAccDataPlaneStats
- * @brief Statistics data structure associated with the data plane
- *
- */
-typedef struct
-{
- UINT32 addToSwQ;
- UINT32 removeFromSwQ;
- UINT32 unchainedTxMBufs;
- UINT32 chainedTxMBufs;
- UINT32 unchainedTxDoneMBufs;
- UINT32 chainedTxDoneMBufs;
- UINT32 unchainedRxMBufs;
- UINT32 chainedRxMBufs;
- UINT32 unchainedRxFreeMBufs;
- UINT32 chainedRxFreeMBufs;
- UINT32 rxCallbackCounter;
- UINT32 rxCallbackBurstRead;
- UINT32 txDoneCallbackCounter;
- UINT32 unexpectedError;
-} IxEthAccDataPlaneStats;
-
-/**
- * @fn ixEthAccMbufFromSwQ
- * @brief used during disable steps to convert mbufs from
- * swq format, ready to be pushed into hw queues for NPE,
- * back into XScale format
- */
-IX_OSAL_MBUF *ixEthAccMbufFromSwQ(IX_OSAL_MBUF *mbuf);
-
-/**
- * @fn ixEthAccDataPlaneShow
- * @brief Show function (for data plane statistics
- */
-void ixEthAccDataPlaneShow(void);
-
-/*
- * lock dataplane when atomic operation is required
- */
-#define IX_ETH_ACC_DATA_PLANE_LOCK(arg) arg = ixOsalIrqLock();
-#define IX_ETH_ACC_DATA_PLANE_UNLOCK(arg) ixOsalIrqUnlock(arg);
-
-/*
- * Use MBUF fields
- */
-#define IX_ETHACC_NE_SHARED(mBufPtr) \
- ((IxEthAccNe *)&((mBufPtr)->ix_ne))
-
-
-#define IX_ETHACC_NE_NEXT(mBufPtr) (mBufPtr)->ix_ne.reserved[0]
-
-/* tm - wrong!! len and pkt_len are in the second word - #define IX_ETHACC_NE_LEN(mBufPtr) (mBufPtr)->ix_ne.reserved[3] */
-#define IX_ETHACC_NE_LEN(mBufPtr) (mBufPtr)->ix_ne.reserved[1]
-
-#define IX_ETHACC_NE_DATA(mBufPtr)(mBufPtr)->ix_ne.reserved[2]
-
-
-/*
- * Use MBUF next pointer field to chain data.
- */
-#define IX_ETH_ACC_MBUF_NEXT_PKT_CHAIN_MEMBER(mbuf) (mbuf)->ix_ctrl.ix_chain
-
-
-
-#define IX_ETH_ACC_DATAPLANE_IS_Q_EMPTY(mbuf_list) ((mbuf_list.pHead) == NULL)
-
-
-#define IX_ETH_ACC_DATAPLANE_ADD_MBUF_TO_Q_HEAD(mbuf_list,mbuf_to_add) \
- do { \
- int lockVal; \
- IX_ETH_ACC_DATA_PLANE_LOCK(lockVal); \
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.addToSwQ); \
- if ( (mbuf_list.pHead) != NULL ) \
- { \
- (IX_ETH_ACC_MBUF_NEXT_PKT_CHAIN_MEMBER((mbuf_to_add))) = (mbuf_list.pHead);\
- (mbuf_list.pHead) = (mbuf_to_add); \
- } \
- else { \
- (mbuf_list.pTail) = (mbuf_list.pHead) = (mbuf_to_add); \
- IX_ETH_ACC_MBUF_NEXT_PKT_CHAIN_MEMBER((mbuf_to_add)) = NULL; \
- } \
- IX_ETH_ACC_DATA_PLANE_UNLOCK(lockVal); \
- } while(0)
-
-
-#define IX_ETH_ACC_DATAPLANE_ADD_MBUF_TO_Q_TAIL(mbuf_list,mbuf_to_add) \
- do { \
- int lockVal; \
- IX_ETH_ACC_DATA_PLANE_LOCK(lockVal); \
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.addToSwQ); \
- if ( (mbuf_list.pHead) == NULL ) \
- { \
- (mbuf_list.pHead) = mbuf_to_add; \
- IX_ETH_ACC_MBUF_NEXT_PKT_CHAIN_MEMBER((mbuf_to_add)) = NULL; \
- } \
- else { \
- IX_ETH_ACC_MBUF_NEXT_PKT_CHAIN_MEMBER((mbuf_list.pTail)) = (mbuf_to_add); \
- IX_ETH_ACC_MBUF_NEXT_PKT_CHAIN_MEMBER((mbuf_to_add)) = NULL; \
- } \
- (mbuf_list.pTail) = mbuf_to_add; \
- IX_ETH_ACC_DATA_PLANE_UNLOCK(lockVal); \
- } while (0)
-
-
-#define IX_ETH_ACC_DATAPLANE_REMOVE_MBUF_FROM_Q_HEAD(mbuf_list,mbuf_to_rem) \
- do { \
- int lockVal; \
- IX_ETH_ACC_DATA_PLANE_LOCK(lockVal); \
- if ( (mbuf_list.pHead) != NULL ) \
- { \
- IX_ETH_ACC_STATS_INC(ixEthAccDataStats.removeFromSwQ); \
- (mbuf_to_rem) = (mbuf_list.pHead) ; \
- (mbuf_list.pHead) = (IX_ETH_ACC_MBUF_NEXT_PKT_CHAIN_MEMBER((mbuf_to_rem)));\
- } \
- else { \
- (mbuf_to_rem) = NULL; \
- } \
- IX_ETH_ACC_DATA_PLANE_UNLOCK(lockVal); \
- } while (0)
-
-
-/**
- * @brief message handler QManager entries for NPE id => port ID conversion (NPE_B => 0, NPE_C => 1)
- */
-#define IX_ETH_ACC_PORT_TO_NPE_ID(port) \
- ixEthAccPortData[(port)].npeId
-
-#define IX_ETH_ACC_NPE_TO_PORT_ID(npe) ((npe == 0 ? 2 : (npe == 1 ? 0 : ( npe == 2 ? 1 : -1 ))))
-
-#define IX_ETH_ACC_PORT_TO_TX_Q_ID(port) \
- ixEthAccPortData[(port)].ixEthAccTxData.txQueue
-
-#define IX_ETH_ACC_PORT_TO_RX_FREE_Q_ID(port) \
- ixEthAccPortData[(port)].ixEthAccRxData.rxFreeQueue
-
-#define IX_ETH_ACC_PORT_TO_TX_Q_SOURCE(port) (port == IX_ETH_PORT_1 ? IX_ETH_ACC_TX_FRAME_ENET0_Q_SOURCE : (port == IX_ETH_PORT_2 ? IX_ETH_ACC_TX_FRAME_ENET1_Q_SOURCE : IX_ETH_ACC_TX_FRAME_ENET2_Q_SOURCE))
-
-#define IX_ETH_ACC_PORT_TO_RX_FREE_Q_SOURCE(port) (port == IX_ETH_PORT_1 ? IX_ETH_ACC_RX_FREE_BUFF_ENET0_Q_SOURCE : (port == IX_ETH_PORT_2 ? IX_ETH_ACC_RX_FREE_BUFF_ENET1_Q_SOURCE : IX_ETH_ACC_RX_FREE_BUFF_ENET2_Q_SOURCE ))
-
-/* Flush the mbufs chain and all data pointed to by the mbuf */
-
-#ifndef NDEBUG
-#define IX_ETH_ACC_STATS_INC(x) (x++)
-#else
-#define IX_ETH_ACC_STATS_INC(x)
-#endif
-
-#define IX_ETH_ACC_MAX_TX_FRAMES_TO_SUBMIT 128
-
-void ixEthRxFrameQMCallback(IxQMgrQId qId, IxQMgrCallbackId callbackId);
-void ixEthRxMultiBufferQMCallback(IxQMgrQId qId, IxQMgrCallbackId callbackId);
-void ixEthTxFrameDoneQMCallback(IxQMgrQId qId, IxQMgrCallbackId callbackId);
-
-#endif /* IxEthAccDataPlane_p_H */
-
-
-/**
- *@}
- */
-
diff --git a/cpu/ixp/npe/include/IxEthAccMac_p.h b/cpu/ixp/npe/include/IxEthAccMac_p.h
deleted file mode 100644
index 93e9d98e76..0000000000
--- a/cpu/ixp/npe/include/IxEthAccMac_p.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-
-#ifndef IxEthAccMac_p_H
-#define IxEthAccMac_p_H
-
-#include "IxOsal.h"
-
-#define IX_ETH_ACC_MAX_MULTICAST_ADDRESSES 256
-#define IX_ETH_ACC_NUM_PORTS 3
-#define IX_ETH_ACC_MAX_FRAME_SIZE_DEFAULT 1536
-#define IX_ETH_ACC_MAX_FRAME_SIZE_UPPER_RANGE (65536-64)
-#define IX_ETH_ACC_MAX_FRAME_SIZE_LOWER_RANGE 64
-
-/*
- *
- * MAC register definitions
- *
- */
-#define IX_ETH_ACC_MAC_0_BASE IX_OSAL_IXP400_ETHA_PHYS_BASE
-#define IX_ETH_ACC_MAC_1_BASE IX_OSAL_IXP400_ETHB_PHYS_BASE
-#define IX_ETH_ACC_MAC_2_BASE IX_OSAL_IXP400_ETH_NPEA_PHYS_BASE
-
-#define IX_ETH_ACC_MAC_TX_CNTRL1 0x000
-#define IX_ETH_ACC_MAC_TX_CNTRL2 0x004
-#define IX_ETH_ACC_MAC_RX_CNTRL1 0x010
-#define IX_ETH_ACC_MAC_RX_CNTRL2 0x014
-#define IX_ETH_ACC_MAC_RANDOM_SEED 0x020
-#define IX_ETH_ACC_MAC_THRESH_P_EMPTY 0x030
-#define IX_ETH_ACC_MAC_THRESH_P_FULL 0x038
-#define IX_ETH_ACC_MAC_BUF_SIZE_TX 0x040
-#define IX_ETH_ACC_MAC_TX_DEFER 0x050
-#define IX_ETH_ACC_MAC_RX_DEFER 0x054
-#define IX_ETH_ACC_MAC_TX_TWO_DEFER_1 0x060
-#define IX_ETH_ACC_MAC_TX_TWO_DEFER_2 0x064
-#define IX_ETH_ACC_MAC_SLOT_TIME 0x070
-#define IX_ETH_ACC_MAC_MDIO_CMD_1 0x080
-#define IX_ETH_ACC_MAC_MDIO_CMD_2 0x084
-#define IX_ETH_ACC_MAC_MDIO_CMD_3 0x088
-#define IX_ETH_ACC_MAC_MDIO_CMD_4 0x08c
-#define IX_ETH_ACC_MAC_MDIO_STS_1 0x090
-#define IX_ETH_ACC_MAC_MDIO_STS_2 0x094
-#define IX_ETH_ACC_MAC_MDIO_STS_3 0x098
-#define IX_ETH_ACC_MAC_MDIO_STS_4 0x09c
-#define IX_ETH_ACC_MAC_ADDR_MASK_1 0x0A0
-#define IX_ETH_ACC_MAC_ADDR_MASK_2 0x0A4
-#define IX_ETH_ACC_MAC_ADDR_MASK_3 0x0A8
-#define IX_ETH_ACC_MAC_ADDR_MASK_4 0x0AC
-#define IX_ETH_ACC_MAC_ADDR_MASK_5 0x0B0
-#define IX_ETH_ACC_MAC_ADDR_MASK_6 0x0B4
-#define IX_ETH_ACC_MAC_ADDR_1 0x0C0
-#define IX_ETH_ACC_MAC_ADDR_2 0x0C4
-#define IX_ETH_ACC_MAC_ADDR_3 0x0C8
-#define IX_ETH_ACC_MAC_ADDR_4 0x0CC
-#define IX_ETH_ACC_MAC_ADDR_5 0x0D0
-#define IX_ETH_ACC_MAC_ADDR_6 0x0D4
-#define IX_ETH_ACC_MAC_INT_CLK_THRESH 0x0E0
-#define IX_ETH_ACC_MAC_UNI_ADDR_1 0x0F0
-#define IX_ETH_ACC_MAC_UNI_ADDR_2 0x0F4
-#define IX_ETH_ACC_MAC_UNI_ADDR_3 0x0F8
-#define IX_ETH_ACC_MAC_UNI_ADDR_4 0x0FC
-#define IX_ETH_ACC_MAC_UNI_ADDR_5 0x100
-#define IX_ETH_ACC_MAC_UNI_ADDR_6 0x104
-#define IX_ETH_ACC_MAC_CORE_CNTRL 0x1FC
-
-
-/*
- *
- *Bit definitions
- *
- */
-
-/* TX Control Register 1*/
-
-#define IX_ETH_ACC_TX_CNTRL1_TX_EN BIT(0)
-#define IX_ETH_ACC_TX_CNTRL1_DUPLEX BIT(1)
-#define IX_ETH_ACC_TX_CNTRL1_RETRY BIT(2)
-#define IX_ETH_ACC_TX_CNTRL1_PAD_EN BIT(3)
-#define IX_ETH_ACC_TX_CNTRL1_FCS_EN BIT(4)
-#define IX_ETH_ACC_TX_CNTRL1_2DEFER BIT(5)
-#define IX_ETH_ACC_TX_CNTRL1_RMII BIT(6)
-
-/* TX Control Register 2 */
-#define IX_ETH_ACC_TX_CNTRL2_RETRIES_MASK 0xf
-
-/* RX Control Register 1 */
-#define IX_ETH_ACC_RX_CNTRL1_RX_EN BIT(0)
-#define IX_ETH_ACC_RX_CNTRL1_PADSTRIP_EN BIT(1)
-#define IX_ETH_ACC_RX_CNTRL1_CRC_EN BIT(2)
-#define IX_ETH_ACC_RX_CNTRL1_PAUSE_EN BIT(3)
-#define IX_ETH_ACC_RX_CNTRL1_LOOP_EN BIT(4)
-#define IX_ETH_ACC_RX_CNTRL1_ADDR_FLTR_EN BIT(5)
-#define IX_ETH_ACC_RX_CNTRL1_RX_RUNT_EN BIT(6)
-#define IX_ETH_ACC_RX_CNTRL1_BCAST_DIS BIT(7)
-
-/* RX Control Register 2 */
-#define IX_ETH_ACC_RX_CNTRL2_DEFER_EN BIT(0)
-
-
-
-/* Core Control Register */
-#define IX_ETH_ACC_CORE_RESET BIT(0)
-#define IX_ETH_ACC_CORE_RX_FIFO_FLUSH BIT(1)
-#define IX_ETH_ACC_CORE_TX_FIFO_FLUSH BIT(2)
-#define IX_ETH_ACC_CORE_SEND_JAM BIT(3)
-#define IX_ETH_ACC_CORE_MDC_EN BIT(4)
-
-/* 1st bit of 1st MAC octet */
-#define IX_ETH_ACC_ETH_MAC_BCAST_MCAST_BIT ( 1)
-
-
-/*
- *
- * Default values
- *
- */
-
-
-#define IX_ETH_ACC_TX_CNTRL1_DEFAULT (IX_ETH_ACC_TX_CNTRL1_TX_EN | \
- IX_ETH_ACC_TX_CNTRL1_RETRY | \
- IX_ETH_ACC_TX_CNTRL1_FCS_EN | \
- IX_ETH_ACC_TX_CNTRL1_2DEFER | \
- IX_ETH_ACC_TX_CNTRL1_PAD_EN)
-
-#define IX_ETH_ACC_TX_MAX_RETRIES_DEFAULT 0x0f
-
-#define IX_ETH_ACC_RX_CNTRL1_DEFAULT (IX_ETH_ACC_RX_CNTRL1_CRC_EN \
- | IX_ETH_ACC_RX_CNTRL1_RX_EN)
-
-#define IX_ETH_ACC_RX_CNTRL2_DEFAULT 0x0
-
-/* Thresholds determined by NPE firmware FS */
-#define IX_ETH_ACC_MAC_THRESH_P_EMPTY_DEFAULT 0x12
-#define IX_ETH_ACC_MAC_THRESH_P_FULL_DEFAULT 0x30
-
-/* Number of bytes that must be in the tx fifo before
- transmission commences*/
-#define IX_ETH_ACC_MAC_BUF_SIZE_TX_DEFAULT 0x8
-
-/* One-part deferral values */
-#define IX_ETH_ACC_MAC_TX_DEFER_DEFAULT 0x15
-#define IX_ETH_ACC_MAC_RX_DEFER_DEFAULT 0x16
-
-/* Two-part deferral values... */
-#define IX_ETH_ACC_MAC_TX_TWO_DEFER_1_DEFAULT 0x08
-#define IX_ETH_ACC_MAC_TX_TWO_DEFER_2_DEFAULT 0x07
-
-/* This value applies to MII */
-#define IX_ETH_ACC_MAC_SLOT_TIME_DEFAULT 0x80
-
-/* This value applies to RMII */
-#define IX_ETH_ACC_MAC_SLOT_TIME_RMII_DEFAULT 0xFF
-
-#define IX_ETH_ACC_MAC_ADDR_MASK_DEFAULT 0xFF
-
-#define IX_ETH_ACC_MAC_INT_CLK_THRESH_DEFAULT 0x1
-/*The following is a value chosen at random*/
-#define IX_ETH_ACC_RANDOM_SEED_DEFAULT 0x8
-
-/*By default we must configure the MAC to generate the
- MDC clock*/
-#define IX_ETH_ACC_CORE_DEFAULT (IX_ETH_ACC_CORE_MDC_EN)
-
-#define IXP425_ETH_ACC_MAX_PHY 2
-#define IXP425_ETH_ACC_MAX_AN_ENTRIES 20
-#define IX_ETH_ACC_MAC_RESET_DELAY 1
-
-#define IX_ETH_ACC_MAC_ALL_BITS_SET 0xFF
-
-#define IX_ETH_ACC_MAC_MSGID_SHL 24
-
-#define IX_ETH_ACC_PORT_DISABLE_DELAY_MSECS 20
-#define IX_ETH_ACC_PORT_DISABLE_DELAY_COUNT 200 /* 4 seconds timeout */
-#define IX_ETH_ACC_PORT_DISABLE_RETRY_COUNT 3
-#define IX_ETH_ACC_MIB_STATS_DELAY_MSECS 2000 /* 2 seconds delay for ethernet stats */
-
-/*Register access macros*/
-#if (CPU == SIMSPARCSOLARIS)
-extern void registerWriteStub (UINT32 base, UINT32 offset, UINT32 val);
-extern UINT32 registerReadStub (UINT32 base, UINT32 offset);
-
-#define REG_WRITE(b,o,v) registerWriteStub(b, o, v)
-#define REG_READ(b,o,v) do { v = registerReadStub(b, o); } while (0)
-#else
-#define REG_WRITE(b,o,v) IX_OSAL_WRITE_LONG((volatile UINT32 *)(b + o), v)
-#define REG_READ(b,o,v) (v = IX_OSAL_READ_LONG((volatile UINT32 *)(b + o)))
-
-#endif
-
-void ixEthAccMacUnload(void);
-IxEthAccStatus ixEthAccMacMemInit(void);
-
-/* MAC core loopback */
-IxEthAccStatus ixEthAccPortLoopbackEnable(IxEthAccPortId portId);
-IxEthAccStatus ixEthAccPortLoopbackDisable(IxEthAccPortId portId);
-
-/* MAC core traffic control */
-IxEthAccStatus ixEthAccPortTxEnablePriv(IxEthAccPortId portId);
-IxEthAccStatus ixEthAccPortTxDisablePriv(IxEthAccPortId portId);
-IxEthAccStatus ixEthAccPortRxEnablePriv(IxEthAccPortId portId);
-IxEthAccStatus ixEthAccPortRxDisablePriv(IxEthAccPortId portId);
-IxEthAccStatus ixEthAccPortMacResetPriv(IxEthAccPortId portId);
-
-/* NPE software loopback */
-IxEthAccStatus ixEthAccNpeLoopbackDisablePriv(IxEthAccPortId portId);
-IxEthAccStatus ixEthAccNpeLoopbackEnablePriv(IxEthAccPortId portId);
-
-#endif /*IxEthAccMac_p_H*/
-
diff --git a/cpu/ixp/npe/include/IxEthAccMii_p.h b/cpu/ixp/npe/include/IxEthAccMii_p.h
deleted file mode 100644
index aa42f9c2a1..0000000000
--- a/cpu/ixp/npe/include/IxEthAccMii_p.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * @file IxEthAccMii_p.h
- *
- * @author Intel Corporation
- * @date
- *
- * @brief MII Header file
- *
- * Design Notes:
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxEthAccMii_p_H
-#define IxEthAccMii_p_H
-
-/* MII definitions - these have been verified against the LXT971 and LXT972 PHYs*/
-
-#define IXP425_ETH_ACC_MII_MAX_REG 32 /* max register per phy */
-
-#define IX_ETH_ACC_MII_REG_SHL 16
-#define IX_ETH_ACC_MII_ADDR_SHL 21
-
-/* Definitions for MII access routines*/
-
-#define IX_ETH_ACC_MII_GO BIT(31)
-#define IX_ETH_ACC_MII_WRITE BIT(26)
-#define IX_ETH_ACC_MII_TIMEOUT_10TH_SECS 5
-#define IX_ETH_ACC_MII_10TH_SEC_IN_MILLIS 100
-#define IX_ETH_ACC_MII_READ_FAIL BIT(31)
-
-#define IX_ETH_ACC_MII_PHY_DEF_DELAY 300 /* max delay before link up, etc. */
-#define IX_ETH_ACC_MII_PHY_NO_DELAY 0x0 /* do not delay */
-#define IX_ETH_ACC_MII_PHY_NULL 0xff /* PHY is not present */
-#define IX_ETH_ACC_MII_PHY_DEF_ADDR 0x0 /* default PHY's logical address */
-
-#ifndef IX_ETH_ACC_MII_MONITOR_DELAY
-# define IX_ETH_ACC_MII_MONITOR_DELAY 0x5 /* in seconds */
-#endif
-
-/* Register definition */
-
-#define IX_ETH_ACC_MII_CTRL_REG 0x0 /* Control Register */
-#define IX_ETH_ACC_MII_STAT_REG 0x1 /* Status Register */
-#define IX_ETH_ACC_MII_PHY_ID1_REG 0x2 /* PHY identifier 1 Register */
-#define IX_ETH_ACC_MII_PHY_ID2_REG 0x3 /* PHY identifier 2 Register */
-#define IX_ETH_ACC_MII_AN_ADS_REG 0x4 /* Auto-Negotiation */
- /* Advertisement Register */
-#define IX_ETH_ACC_MII_AN_PRTN_REG 0x5 /* Auto-Negotiation */
- /* partner ability Register */
-#define IX_ETH_ACC_MII_AN_EXP_REG 0x6 /* Auto-Negotiation */
- /* Expansion Register */
-#define IX_ETH_ACC_MII_AN_NEXT_REG 0x7 /* Auto-Negotiation */
- /* next-page transmit Register */
-
-IxEthAccStatus ixEthAccMdioShow (void);
-IxEthAccStatus ixEthAccMiiInit(void);
-void ixEthAccMiiUnload(void);
-
-#endif /*IxEthAccMii_p_H*/
diff --git a/cpu/ixp/npe/include/IxEthAccQueueAssign_p.h b/cpu/ixp/npe/include/IxEthAccQueueAssign_p.h
deleted file mode 100644
index e5fd16e2fb..0000000000
--- a/cpu/ixp/npe/include/IxEthAccQueueAssign_p.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * @file IxEthAccQueueAssign_p.h
- *
- * @author Intel Corporation
- * @date 06-Mar-2002
- *
- * @brief Mapping from QMgr Q's to internal assignment
- *
- * Design Notes:
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @addtogroup IxEthAccPri
- *@{
- */
-
-/*
- * Os/System dependancies.
- */
-#include "IxOsal.h"
-
-/*
- * Intermodule dependancies
- */
-#include "IxQMgr.h"
-#include "IxQueueAssignments.h"
-
-/* Check range of Q's assigned to this component. */
-#if IX_ETH_ACC_RX_FRAME_ETH_Q >= (IX_QMGR_MIN_QUEUPP_QID ) | \
- IX_ETH_ACC_RX_FREE_BUFF_ENET0_Q >= (IX_QMGR_MIN_QUEUPP_QID) | \
- IX_ETH_ACC_RX_FREE_BUFF_ENET1_Q >= (IX_QMGR_MIN_QUEUPP_QID) | \
- IX_ETH_ACC_TX_FRAME_ENET0_Q >= (IX_QMGR_MIN_QUEUPP_QID) | \
- IX_ETH_ACC_TX_FRAME_ENET1_Q >= (IX_QMGR_MIN_QUEUPP_QID) | \
- IX_ETH_ACC_TX_FRAME_DONE_ETH_Q >= (IX_QMGR_MIN_QUEUPP_QID)
-#error "Not all Ethernet Access Queues are betweem 1-31, requires full functionalty Q's unless otherwise validated "
-#endif
-
-/**
-*
-* @typedef IxEthAccQregInfo
-*
-* @brief
-*
-*/
-typedef struct
-{
- IxQMgrQId qId;
- char *qName;
- IxQMgrCallback qCallback;
- IxQMgrCallbackId callbackTag;
- IxQMgrQSizeInWords qSize;
- IxQMgrQEntrySizeInWords qWords;
- BOOL qNotificationEnableAtStartup;
- IxQMgrSourceId qConditionSource;
- IxQMgrWMLevel AlmostEmptyThreshold;
- IxQMgrWMLevel AlmostFullThreshold;
-
-} IxEthAccQregInfo;
-
-/*
- * Prototypes for all QM callbacks.
- */
-
-/*
- * Rx Callbacks
- */
-IX_ETH_ACC_PUBLIC
-void ixEthRxFrameQMCallback(IxQMgrQId, IxQMgrCallbackId);
-
-IX_ETH_ACC_PUBLIC
-void ixEthRxMultiBufferQMCallback(IxQMgrQId, IxQMgrCallbackId);
-
-IX_ETH_ACC_PUBLIC
-void ixEthRxFreeQMCallback(IxQMgrQId, IxQMgrCallbackId);
-
-/*
- * Tx Callback.
- */
-IX_ETH_ACC_PUBLIC
-void ixEthTxFrameQMCallback(IxQMgrQId, IxQMgrCallbackId);
-
-IX_ETH_ACC_PUBLIC
-void ixEthTxFrameDoneQMCallback(IxQMgrQId, IxQMgrCallbackId );
-
-
-#define IX_ETH_ACC_QM_QUEUE_DISPATCH_PRIORITY (IX_QMGR_Q_PRIORITY_0) /* Highest priority */
-
-/*
- * Queue watermarks
- */
-#define IX_ETH_ACC_RX_FRAME_ETH_Q_SOURCE (IX_QMGR_Q_SOURCE_ID_NOT_E )
-#define IX_ETH_ACC_RX_FREE_BUFF_ENET0_Q_SOURCE (IX_QMGR_Q_SOURCE_ID_E )
-#define IX_ETH_ACC_RX_FREE_BUFF_ENET1_Q_SOURCE (IX_QMGR_Q_SOURCE_ID_E )
-#define IX_ETH_ACC_RX_FREE_BUFF_ENET2_Q_SOURCE (IX_QMGR_Q_SOURCE_ID_E )
-#define IX_ETH_ACC_TX_FRAME_ENET0_Q_SOURCE (IX_QMGR_Q_SOURCE_ID_E )
-#define IX_ETH_ACC_TX_FRAME_ENET1_Q_SOURCE (IX_QMGR_Q_SOURCE_ID_E )
-#define IX_ETH_ACC_TX_FRAME_ENET2_Q_SOURCE (IX_QMGR_Q_SOURCE_ID_E )
-#define IX_ETH_ACC_TX_FRAME_DONE_ETH_Q_SOURCE (IX_QMGR_Q_SOURCE_ID_NOT_E )
diff --git a/cpu/ixp/npe/include/IxEthAcc_p.h b/cpu/ixp/npe/include/IxEthAcc_p.h
deleted file mode 100644
index 37c55605d3..0000000000
--- a/cpu/ixp/npe/include/IxEthAcc_p.h
+++ /dev/null
@@ -1,325 +0,0 @@
-/**
- * @file IxEthAcc_p.h
- *
- * @author Intel Corporation
- * @date 12-Feb-2002
- *
- * @brief Internal Header file for IXP425 Ethernet Access component.
- *
- * Design Notes:
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @addtogroup IxEthAccPri
- *@{
- */
-
-#ifndef IxEthAcc_p_H
-#define IxEthAcc_p_H
-
-/*
- * Os/System dependancies.
- */
-#include "IxOsal.h"
-
-/*
- * Intermodule dependancies
- */
-#include "IxNpeDl.h"
-#include "IxQMgr.h"
-
-#include "IxEthNpe.h"
-
-/*
- * Intra module dependancies
- */
-
-#include "IxEthAccDataPlane_p.h"
-#include "IxEthAccMac_p.h"
-
-
-#define INLINE __inline__
-
-#ifdef NDEBUG
-
-#define IX_ETH_ACC_PRIVATE static
-
-#else
-
-#define IX_ETH_ACC_PRIVATE
-
-#endif /* ndef NDEBUG */
-
-#define IX_ETH_ACC_PUBLIC
-
-
-#define IX_ETH_ACC_IS_PORT_VALID(port) ((port) < IX_ETH_ACC_NUMBER_OF_PORTS ? TRUE : FALSE )
-
-
-
-#ifndef NDEBUG
-#define IX_ETH_ACC_FATAL_LOG(a,b,c,d,e,f,g) { ixOsalLog ( IX_OSAL_LOG_LVL_FATAL,IX_OSAL_LOG_DEV_STDOUT,a,b,c,d,e,f,g);}
-#define IX_ETH_ACC_WARNING_LOG(a,b,c,d,e,f,g) { ixOsalLog ( IX_OSAL_LOG_LVL_WARNING,IX_OSAL_LOG_DEV_STDOUT,a,b,c,d,e,f,g);}
-#define IX_ETH_ACC_DEBUG_LOG(a,b,c,d,e,f,g) { ixOsalLog ( IX_OSAL_LOG_LVL_FATAL,IX_OSAL_LOG_DEV_STDOUT,a,b,c,d,e,f,g);}
-#else
-#define IX_ETH_ACC_FATAL_LOG(a,b,c,d,e,f,g) { ixOsalLog ( IX_OSAL_LOG_LVL_FATAL,IX_OSAL_LOG_DEV_STDOUT,a,b,c,d,e,f,g);}
-#define IX_ETH_ACC_WARNING_LOG(a,b,c,d,e,f,g) { ixOsalLog ( IX_OSAL_LOG_LVL_WARNING,IX_OSAL_LOG_DEV_STDOUT,a,b,c,d,e,f,g);}
-#define IX_ETH_ACC_DEBUG_LOG(a,b,c,d,e,f,g) {}
-#endif
-
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccInitDataPlane(void);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccQMgrQueuesConfig(void);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccQMgrRxCallbacksRegister(IxQMgrCallback ixQMgrCallback);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccSingleEthNpeCheck(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC void ixEthAccQMgrRxQEntryGet(UINT32 *numRxQueueEntries);
-
-/* prototypes for the private control plane functions (used by the control interface wrapper) */
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortEnablePriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortDisablePriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortEnabledQueryPriv(IxEthAccPortId portId, BOOL *enabled);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortPromiscuousModeClearPriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortPromiscuousModeSetPriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortUnicastMacAddressSetPriv(IxEthAccPortId portId, IxEthAccMacAddr *macAddr);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortUnicastMacAddressGetPriv(IxEthAccPortId portId, IxEthAccMacAddr *macAddr);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortMulticastAddressJoinPriv(IxEthAccPortId portId, IxEthAccMacAddr *macAddr);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortMulticastAddressJoinAllPriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortMulticastAddressLeavePriv(IxEthAccPortId portId, IxEthAccMacAddr *macAddr);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortMulticastAddressLeaveAllPriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortUnicastAddressShowPriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC void ixEthAccPortMulticastAddressShowPriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortDuplexModeSetPriv(IxEthAccPortId portId, IxEthAccDuplexMode mode);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortDuplexModeGetPriv(IxEthAccPortId portId, IxEthAccDuplexMode *mode);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortTxFrameAppendPaddingEnablePriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortTxFrameAppendPaddingDisablePriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortTxFrameAppendFCSEnablePriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortTxFrameAppendFCSDisablePriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortRxFrameAppendFCSEnablePriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccPortRxFrameAppendFCSDisablePriv(IxEthAccPortId portId);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccTxSchedulingDisciplineSetPriv(IxEthAccPortId portId, IxEthAccSchedulerDiscipline sched);
-IX_ETH_ACC_PUBLIC IxEthAccStatus ixEthAccRxSchedulingDisciplineSetPriv(IxEthAccSchedulerDiscipline sched);
-
-/**
- * @struct ixEthAccRxDataStats
- * @brief Stats data structures for data path. - Not obtained from h/w
- *
- */
-typedef struct
-{
- UINT32 rxFrameClientCallback;
- UINT32 rxFreeRepOK;
- UINT32 rxFreeRepDelayed;
- UINT32 rxFreeRepFromSwQOK;
- UINT32 rxFreeRepFromSwQDelayed;
- UINT32 rxFreeLateNotificationEnabled;
- UINT32 rxFreeLowCallback;
- UINT32 rxFreeOverflow;
- UINT32 rxFreeLock;
- UINT32 rxDuringDisable;
- UINT32 rxSwQDuringDisable;
- UINT32 rxUnlearnedMacAddress;
- UINT32 rxPriority[IX_ETH_ACC_TX_PRIORITY_7 + 1];
- UINT32 rxUnexpectedError;
- UINT32 rxFiltered;
-} IxEthAccRxDataStats;
-
-/**
- * @struct IxEthAccTxDataStats
- * @brief Stats data structures for data path. - Not obtained from h/w
- *
- */
-typedef struct
-{
- UINT32 txQOK;
- UINT32 txQDelayed;
- UINT32 txFromSwQOK;
- UINT32 txFromSwQDelayed;
- UINT32 txLowThreshCallback;
- UINT32 txDoneClientCallback;
- UINT32 txDoneClientCallbackDisable;
- UINT32 txOverflow;
- UINT32 txLock;
- UINT32 txPriority[IX_ETH_ACC_TX_PRIORITY_7 + 1];
- UINT32 txLateNotificationEnabled;
- UINT32 txDoneDuringDisable;
- UINT32 txDoneSwQDuringDisable;
- UINT32 txUnexpectedError;
-} IxEthAccTxDataStats;
-
-/* port Disable state machine : list of states */
-typedef enum
-{
- /* general port states */
- DISABLED = 0,
- ACTIVE,
-
- /* particular Tx/Rx states */
- REPLENISH,
- RECEIVE,
- TRANSMIT,
- TRANSMIT_DONE
-} IxEthAccPortDisableState;
-
-typedef struct
-{
- BOOL fullDuplex;
- BOOL rxFCSAppend;
- BOOL txFCSAppend;
- BOOL txPADAppend;
- BOOL enabled;
- BOOL promiscuous;
- BOOL joinAll;
- IxOsalMutex ackMIBStatsLock;
- IxOsalMutex ackMIBStatsResetLock;
- IxOsalMutex MIBStatsGetAccessLock;
- IxOsalMutex MIBStatsGetResetAccessLock;
- IxOsalMutex npeLoopbackMessageLock;
- IxEthAccMacAddr mcastAddrsTable[IX_ETH_ACC_MAX_MULTICAST_ADDRESSES];
- UINT32 mcastAddrIndex;
- IX_OSAL_MBUF *portDisableTxMbufPtr;
- IX_OSAL_MBUF *portDisableRxMbufPtr;
-
- volatile IxEthAccPortDisableState portDisableState;
- volatile IxEthAccPortDisableState rxState;
- volatile IxEthAccPortDisableState txState;
-
- BOOL initDone;
- BOOL macInitialised;
-} IxEthAccMacState;
-
-/**
- * @struct IxEthAccRxInfo
- * @brief System-wide data structures associated with the data plane.
- *
- */
-typedef struct
-{
- IxQMgrQId higherPriorityQueue[IX_QMGR_MAX_NUM_QUEUES]; /**< higher priority queue list */
- IxEthAccSchedulerDiscipline schDiscipline; /**< Receive Xscale QoS type */
-} IxEthAccInfo;
-
-/**
- * @struct IxEthAccRxDataInfo
- * @brief Per Port data structures associated with the receive data plane.
- *
- */
-typedef struct
-{
- IxQMgrQId rxFreeQueue; /**< rxFree Queue for this port */
- IxEthAccPortRxCallback rxCallbackFn;
- UINT32 rxCallbackTag;
- IxEthAccDataPlaneQList freeBufferList;
- IxEthAccPortMultiBufferRxCallback rxMultiBufferCallbackFn;
- UINT32 rxMultiBufferCallbackTag;
- BOOL rxMultiBufferCallbackInUse;
- IxEthAccRxDataStats stats; /**< Receive s/w stats */
-} IxEthAccRxDataInfo;
-
-/**
- * @struct IxEthAccTxDataInfo
- * @brief Per Port data structures associated with the transmit data plane.
- *
- */
-typedef struct
-{
- IxEthAccPortTxDoneCallback txBufferDoneCallbackFn;
- UINT32 txCallbackTag;
- IxEthAccDataPlaneQList txQ[IX_ETH_ACC_NUM_TX_PRIORITIES]; /**< Transmit Q */
- IxEthAccSchedulerDiscipline schDiscipline; /**< Transmit Xscale QoS */
- IxQMgrQId txQueue; /**< txQueue for this port */
- IxEthAccTxDataStats stats; /**< Transmit s/w stats */
-} IxEthAccTxDataInfo;
-
-
-/**
- * @struct IxEthAccPortDataInfo
- * @brief Per Port data structures associated with the port data plane.
- *
- */
-typedef struct
-{
- BOOL portInitialized;
- UINT32 npeId; /**< NpeId for this port */
- IxEthAccTxDataInfo ixEthAccTxData; /**< Transmit data control structures */
- IxEthAccRxDataInfo ixEthAccRxData; /**< Recieve data control structures */
-} IxEthAccPortDataInfo;
-
-extern IxEthAccPortDataInfo ixEthAccPortData[];
-#define IX_ETH_IS_PORT_INITIALIZED(port) (ixEthAccPortData[port].portInitialized)
-
-extern BOOL ixEthAccServiceInit;
-#define IX_ETH_ACC_IS_SERVICE_INITIALIZED() (ixEthAccServiceInit == TRUE )
-
-/*
- * Maximum number of frames to consume from the Rx Frame Q.
- */
-
-#define IX_ETH_ACC_MAX_RX_FRAME_CONSUME_PER_CALLBACK (128)
-
-/*
- * Max number of times to load the Rx Free Q from callback.
- */
-#define IX_ETH_ACC_MAX_RX_FREE_BUFFERS_LOAD (256) /* Set greater than depth of h/w Q + drain time at line rate */
-
-/*
- * Max number of times to read from the Tx Done Q in one sitting.
- */
-
-#define IX_ETH_ACC_MAX_TX_FRAME_DONE_CONSUME_PER_CALLBACK (256)
-
-/*
- * Max number of times to take buffers from S/w queues and write them to the H/w Tx
- * queues on receipt of a Tx low threshold callback
- */
-
-#define IX_ETH_ACC_MAX_TX_FRAME_TX_CONSUME_PER_CALLBACK (16)
-
-
-#define IX_ETH_ACC_FLUSH_CACHE(addr,size) IX_OSAL_CACHE_FLUSH((addr),(size))
-#define IX_ETH_ACC_INVALIDATE_CACHE(addr,size) IX_OSAL_CACHE_INVALIDATE((addr),(size))
-
-
-#define IX_ETH_ACC_MEMSET(start,value,size) memset(start,value,size)
-
-#endif /* ndef IxEthAcc_p_H */
-
-
-
diff --git a/cpu/ixp/npe/include/IxEthDB.h b/cpu/ixp/npe/include/IxEthDB.h
deleted file mode 100644
index 1189c9a140..0000000000
--- a/cpu/ixp/npe/include/IxEthDB.h
+++ /dev/null
@@ -1,2373 +0,0 @@
-/** @file IxEthDB.h
- *
- * @brief this file contains the public API of @ref IxEthDB component
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- *
- */
-
-#ifndef IxEthDB_H
-#define IxEthDB_H
-
-#include <IxOsBuffMgt.h>
-#include <IxTypes.h>
-
-/**
- * @defgroup IxEthDB IXP400 Ethernet Database (IxEthDB) API
- *
- * @brief ethDB is a library that does provides a MAC address database learning/filtering capability
- *
- *@{
- */
-
-#define INLINE __inline__
-
-#define IX_ETH_DB_PRIVATE PRIVATE /* imported from IxTypes.h */
-
-#define IX_ETH_DB_PUBLIC PUBLIC
-
-/**
- * @brief port ID => message handler NPE id conversion (0 => NPE_B, 1 => NPE_C)
- */
-#define IX_ETH_DB_PORT_ID_TO_NPE(id) (id == 0 ? 1 : (id == 1 ? 2 : (id == 2 ? 0 : -1)))
-
-/**
- * @def IX_ETH_DB_NPE_TO_PORT_ID(npe)
- * @brief message handler NPE id => port ID conversion (NPE_B => 0, NPE_C => 1)
- */
-#define IX_ETH_DB_NPE_TO_PORT_ID(npe) (npe == 0 ? 2 : (npe == 1 ? 0 : (npe == 2 ? 1 : -1)))
-
-/* temporary define - won't work for Azusa */
-#define IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(id) (IX_ETH_DB_PORT_ID_TO_NPE(id) << 4)
-#define IX_ETH_DB_NPE_LOGICAL_ID_TO_PORT_ID(id) (IX_ETH_DB_NPE_TO_PORT_ID(id >> 4))
-
-/**
- * @def IX_IEEE803_MAC_ADDRESS_SIZE
- * @brief The size of the MAC address
- */
-#define IX_IEEE803_MAC_ADDRESS_SIZE (6)
-
-/**
- * @def IX_IEEE802_1Q_QOS_PRIORITY_COUNT
- * @brief Number of QoS priorities defined by IEEE802.1Q
- */
-#define IX_IEEE802_1Q_QOS_PRIORITY_COUNT (8)
-
-/**
- * @enum IxEthDBStatus
- * @brief Ethernet Database API return values
- */
-typedef enum /* IxEthDBStatus */
-{
- IX_ETH_DB_SUCCESS = IX_SUCCESS, /**< Success */
- IX_ETH_DB_FAIL = IX_FAIL, /**< Failure */
- IX_ETH_DB_INVALID_PORT, /**< Invalid port */
- IX_ETH_DB_PORT_UNINITIALIZED, /**< Port not initialized */
- IX_ETH_DB_MAC_UNINITIALIZED, /**< MAC not initialized */
- IX_ETH_DB_INVALID_ARG, /**< Invalid argument */
- IX_ETH_DB_NO_SUCH_ADDR, /**< Address not found for search or delete operations */
- IX_ETH_DB_NOMEM, /**< Learning database memory full */
- IX_ETH_DB_BUSY, /**< Learning database cannot complete operation, access temporarily blocked */
- IX_ETH_DB_END, /**< Database browser passed the end of the record set */
- IX_ETH_DB_INVALID_VLAN, /**< Invalid VLAN ID (valid range is 0..4094, 0 signifies no VLAN membership, used for priority tagged frames) */
- IX_ETH_DB_INVALID_PRIORITY, /**< Invalid QoS priority/traffic class (valid range for QoS priority is 0..7, valid range for traffic class depends on run-time configuration) */
- IX_ETH_DB_NO_PERMISSION, /**< No permission for attempted operation */
- IX_ETH_DB_FEATURE_UNAVAILABLE, /**< Feature not available (or not enabled) */
- IX_ETH_DB_INVALID_KEY, /**< Invalid search key */
- IX_ETH_DB_INVALID_RECORD_TYPE /**< Invalid record type */
-} IxEthDBStatus;
-
-/** @brief VLAN ID type, valid range is 0..4094, 0 signifying no VLAN membership */
-typedef UINT32 IxEthDBVlanId;
-
-/** @brief 802.1Q VLAN tag, contains 3 bits user priority, 1 bit CFI, 12 bits VLAN ID */
-typedef UINT32 IxEthDBVlanTag;
-
-/** @brief QoS priority/traffic class type, valid range is 0..7, 0 being the lowest */
-typedef UINT32 IxEthDBPriority;
-
-/** @brief Priority mapping table; 0..7 QoS priorities used to index, table contains traffic classes */
-typedef UINT8 IxEthDBPriorityTable[8];
-
-/** @brief A 4096 bit array used to map the complete VLAN ID range */
-typedef UINT8 IxEthDBVlanSet[512];
-
-#define IX_ETH_DB_802_1Q_VLAN_MASK (0xFFF)
-#define IX_ETH_DB_802_1Q_QOS_MASK (0x7)
-
-#define IX_ETH_DB_802_1Q_MAX_VLAN_ID (0xFFE)
-
-/**
- * @def IX_ETH_DB_SET_VLAN_ID
- * @brief returns the given 802.1Q tag with the VLAN ID field substituted with the given VLAN ID
- *
- * This macro is used to change the VLAN ID in a 802.1Q tag.
- *
- * Example:
- *
- * tag = IX_ETH_DB_SET_VLAN_ID(tag, 32)
- *
- * inserts the VLAN ID "32" in the given tag.
- */
-#define IX_ETH_DB_SET_VLAN_ID(vlanTag, vlanID) (((vlanTag) & 0xF000) | ((vlanID) & IX_ETH_DB_802_1Q_VLAN_MASK))
-
-/**
-* @def IX_ETH_DB_GET_VLAN_ID
-* @brief returns the VLAN ID from the given 802.1Q tag
-*/
-#define IX_ETH_DB_GET_VLAN_ID(vlanTag) ((vlanTag) & IX_ETH_DB_802_1Q_VLAN_MASK)
-
-#define IX_ETH_DB_GET_QOS_PRIORITY(vlanTag) (((vlanTag) >> 13) & IX_ETH_DB_802_1Q_QOS_MASK)
-
-#define IX_ETH_DB_SET_QOS_PRIORITY(vlanTag, priority) (((vlanTag) & 0x1FFF) | (((priority) & IX_ETH_DB_802_1Q_QOS_MASK) << 13))
-
-#define IX_ETH_DB_CHECK_VLAN_TAG(vlanTag) { if(((vlanTag & 0xFFFF0000) != 0) || (IX_ETH_DB_GET_VLAN_ID(vlanTag) > 4094)) return IX_ETH_DB_INVALID_VLAN; }
-
-#define IX_ETH_DB_CHECK_VLAN_ID(vlanId) { if (vlanId > IX_ETH_DB_802_1Q_MAX_VLAN_ID) return IX_ETH_DB_INVALID_VLAN; }
-
-#define IX_IEEE802_1Q_VLAN_TPID (0x8100)
-
-typedef enum
-{
- IX_ETH_DB_UNTAGGED_FRAMES = 0x1, /**< Accepts untagged frames */
- IX_ETH_DB_VLAN_TAGGED_FRAMES = 0x2, /**< Accepts tagged frames */
- IX_ETH_DB_PRIORITY_TAGGED_FRAMES = 0x4, /**< Accepts tagged frames with VLAN ID set to 0 (no VLAN membership) */
- IX_ETH_DB_ACCEPT_ALL_FRAMES =
- IX_ETH_DB_UNTAGGED_FRAMES | IX_ETH_DB_VLAN_TAGGED_FRAMES /**< Accepts all the frames */
-} IxEthDBFrameFilter;
-
-typedef enum
-{
- IX_ETH_DB_PASS_THROUGH = 0x1, /**< Leave frame as-is */
- IX_ETH_DB_ADD_TAG = 0x2, /**< Add default port VLAN tag */
- IX_ETH_DB_REMOVE_TAG = 0x3 /**< Remove VLAN tag from frame */
-} IxEthDBTaggingAction;
-
-typedef enum
-{
- IX_ETH_DB_FIREWALL_WHITE_LIST = 0x1, /**< Firewall operates in white-list mode (MAC address based admission) */
- IX_ETH_DB_FIREWALL_BLACK_LIST = 0x2 /**< Firewall operates in black-list mode (MAC address based blocking) */
-} IxEthDBFirewallMode;
-
-typedef enum
-{
- IX_ETH_DB_FILTERING_RECORD = 0x01, /**< <table><caption> Filtering record </caption>
- * <tr><td> MAC address <td> static/dynamic type <td> age
- * </table>
- */
- IX_ETH_DB_FILTERING_VLAN_RECORD = 0x02, /**< <table><caption> VLAN-enabled filtering record </caption>
- * <tr><td> MAC address <td> static/dynamic type <td> age <td> 802.1Q tag
- * </table>
- */
- IX_ETH_DB_WIFI_RECORD = 0x04, /**< <table><caption> WiFi header conversion record </caption>
- * <tr><td> MAC address <td> optional gateway MAC address <td>
- * </table>
- */
- IX_ETH_DB_FIREWALL_RECORD = 0x08, /**< <table><caption> Firewall record </caption>
- * <tr><td> MAC address
- * </table>
- */
- IX_ETH_DB_GATEWAY_RECORD = 0x10, /**< <i>For internal use only</i> */
- IX_ETH_DB_MAX_RECORD_TYPE_INDEX = 0x10, /**< <i>For internal use only</i> */
- IX_ETH_DB_NO_RECORD_TYPE = 0, /**< None of the registered record types */
- IX_ETH_DB_ALL_FILTERING_RECORDS = IX_ETH_DB_FILTERING_RECORD | IX_ETH_DB_FILTERING_VLAN_RECORD, /**< All the filtering records */
- IX_ETH_DB_ALL_RECORD_TYPES = IX_ETH_DB_FILTERING_RECORD | IX_ETH_DB_FILTERING_VLAN_RECORD |
- IX_ETH_DB_WIFI_RECORD | IX_ETH_DB_FIREWALL_RECORD /**< All the record types registered within EthDB */
-} IxEthDBRecordType;
-
-typedef enum
-{
- IX_ETH_DB_LEARNING = 0x01, /**< Learning feature; enables EthDB to learn MAC address (filtering) records, including 802.1Q enabled records */
- IX_ETH_DB_FILTERING = 0x02, /**< Filtering feature; enables EthDB to communicate with the NPEs for downloading filtering information in the NPEs; depends on the learning feature */
- IX_ETH_DB_VLAN_QOS = 0x04, /**< VLAN/QoS feature; enables EthDB to configure NPEs to operate in VLAN/QoS aware modes */
- IX_ETH_DB_FIREWALL = 0x08, /**< Firewall feature; enables EthDB to configure NPEs to operate in firewall mode, using white/black address lists */
- IX_ETH_DB_SPANNING_TREE_PROTOCOL = 0x10, /**< Spanning tree protocol feature; enables EthDB to configure the NPEs as STP nodes */
- IX_ETH_DB_WIFI_HEADER_CONVERSION = 0x20 /**< WiFi 802.3 to 802.11 header conversion feature; enables EthDB to handle WiFi conversion data */
-} IxEthDBFeature;
-
-typedef UINT32 IxEthDBProperty; /**< Property ID type */
-
-typedef enum
-{
- IX_ETH_DB_INTEGER_PROPERTY = 0x1, /**< 4 byte unsigned integer type */
- IX_ETH_DB_STRING_PROPERTY = 0x2, /**< NULL-terminated string type of maximum 255 characters (including the terminator) */
- IX_ETH_DB_MAC_ADDR_PROPERTY = 0x3, /**< 6 byte MAC address type */
- IX_ETH_DB_BOOL_PROPERTY = 0x4 /**< 4 byte boolean type; can contain only TRUE and FALSE values */
-} IxEthDBPropertyType;
-
-/* list of supported properties for the IX_ETH_DB_VLAN_QOS feature */
-#define IX_ETH_DB_QOS_TRAFFIC_CLASS_COUNT_PROPERTY (0x01) /**< Property identifying number the supported number of traffic classes */
-#define IX_ETH_DB_QOS_TRAFFIC_CLASS_0_RX_QUEUE_PROPERTY (0x10) /**< Rx queue assigned to traffic class 0 */
-#define IX_ETH_DB_QOS_TRAFFIC_CLASS_1_RX_QUEUE_PROPERTY (0x11) /**< Rx queue assigned to traffic class 1 */
-#define IX_ETH_DB_QOS_TRAFFIC_CLASS_2_RX_QUEUE_PROPERTY (0x12) /**< Rx queue assigned to traffic class 2 */
-#define IX_ETH_DB_QOS_TRAFFIC_CLASS_3_RX_QUEUE_PROPERTY (0x13) /**< Rx queue assigned to traffic class 3 */
-#define IX_ETH_DB_QOS_TRAFFIC_CLASS_4_RX_QUEUE_PROPERTY (0x14) /**< Rx queue assigned to traffic class 4 */
-#define IX_ETH_DB_QOS_TRAFFIC_CLASS_5_RX_QUEUE_PROPERTY (0x15) /**< Rx queue assigned to traffic class 5 */
-#define IX_ETH_DB_QOS_TRAFFIC_CLASS_6_RX_QUEUE_PROPERTY (0x16) /**< Rx queue assigned to traffic class 6 */
-#define IX_ETH_DB_QOS_TRAFFIC_CLASS_7_RX_QUEUE_PROPERTY (0x17) /**< Rx queue assigned to traffic class 7 */
-
-/* private property used by EthAcc to indicate queue configuration complete */
-#define IX_ETH_DB_QOS_QUEUE_CONFIGURATION_COMPLETE (0x18)
-
-/**
- *
- * @brief The IEEE 802.3 Ethernet MAC address structure.
- *
- * The data should be packed with bytes xx:xx:xx:xx:xx:xx
- *
- * @note The data must be packed in network byte order.
- */
-typedef struct
-{
- UINT8 macAddress[IX_IEEE803_MAC_ADDRESS_SIZE];
-} IxEthDBMacAddr;
-
-/**
- * @ingroup IxEthDB
- *
- * @brief Definition of an IXP400 port.
- */
-typedef UINT32 IxEthDBPortId;
-
-/**
- * @ingroup IxEthDB
- *
- * @brief Port dependency map definition
- */
-typedef UINT8 IxEthDBPortMap[32];
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBInit(void)
- *
- * @brief Initializes the Ethernet learning/filtering database
- *
- * @note calling this function multiple times does not constitute an error;
- * redundant calls will be ignored, returning IX_ETH_DB_SUCCESS
- *
- * @retval IX_ETH_DB_SUCCESS initialization was successful
- * @retval IX_ETH_DB_FAIL initialization failed (OS error)
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBInit(void);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBUnload(void)
- *
- * @brief Stops and prepares the EthDB component for unloading.
- *
- * @retval IX_ETH_DB_SUCCESS de-initialization was successful
- * @retval IX_ETH_DB_BUSY de-initialization failed, ports must be disabled first
- * @retval IX_ETH_DB_FAIL de-initialization failed (OS error)
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBUnload(void);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn void ixEthDBPortInit(IxEthDBPortId portID)
- *
- * @brief Initializes a port
- *
- * This function is called automatically by the Ethernet Access
- * ixEthAccPortInit() routine for Ethernet NPE ports and should be manually
- * called for any user-defined port (any port that is not one of
- * the two Ethernet NPEs).
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to be initialized
- *
- * @see IxEthDBPortDefs.h for port definitions
- *
- * @note calling this function multiple times does not constitute an error;
- * redundant calls will be ignored
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBPortInit(IxEthDBPortId portID);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortEnable(IxEthDBPortId portID)
- *
- * @brief Enables a port
- *
- * This function is called automatically from the Ethernet Access component
- * ixEthAccPortEnable() routine for Ethernet NPE ports and should be manually
- * called for any user-defined port (any port that is not one of
- * the Ethernet NPEs).
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to enable processing on
- *
- * @retval IX_ETH_DB_SUCCESS if enabling is successful
- * @retval IX_ETH_DB_FAIL if the enabling was not successful due to
- * a message handler error
- * @retval IX_ETH_DB_MAC_UNINITIALIZED the MAC address of this port was
- * not initialized (only for Ethernet NPEs)
- * @retval IX_ETH_DB_INVALID_PORT if portID is invalid
- *
- * @pre ixEthDBPortAddressSet needs to be called prior to enabling the port events
- * for Ethernet NPEs
- *
- * @see ixEthDBPortAddressSet
- *
- * @see IxEthDBPortDefs.h for port definitions
- *
- * @note calling this function multiple times does not constitute an error;
- * redundant calls will be ignored
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortEnable(IxEthDBPortId portID);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortDisable(IxEthDBPortId portID)
- *
- * @brief Disables processing on a port
- *
- * This function is called automatically from the Ethernet Access component
- * ixEthAccPortDisable() routine for Ethernet NPE ports and should be manually
- * called for any user-defined port (any port that is not one of
- * the Ethernet NPEs).
- *
- * @note Calling ixEthAccPortDisable() will disable the respective Ethernet NPE.
- * After Ethernet NPEs are disabled they are stopped therefore
- * when re-enabled they need to be reset, downloaded with microcode and started.
- * For learning to restart working the user needs to call again
- * ixEthAccPortUnicastMacAddressSet or ixEthDBUnicastAddressSet
- * with the respective port MAC address.
- * Residual MAC addresses learnt before the port was disabled are deleted as soon
- * as the port is disabled. This only applies to dynamic (learnt) entries, static
- * entries do not dissapear when the port is disabled.
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to disable processing on
- *
- * @retval IX_ETH_DB_SUCCESS if disabling is successful
- * @retval IX_ETH_DB_FAIL if the disabling was not successful due to
- * a message handler error
- * @retval IX_ETH_DB_INVALID_PORT if portID is invalid
- *
- * @note calling this function multiple times after the first time completed successfully
- * does not constitute an error; redundant calls will be ignored and return IX_ETH_DB_SUCCESS
-*/
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortDisable(IxEthDBPortId portID);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortAddressSet(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
- *
- * @brief Sets the port MAC address
- *
- * This function is to be called from the Ethernet Access component top-level
- * ixEthDBUnicastAddressSet(). Event processing cannot be enabled for a port
- * until its MAC address has been set.
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port whose MAC address is set
- * @param macAddr @ref IxEthDBMacAddr [in] - port MAC address
- *
- * @retval IX_ETH_DB_SUCCESS MAC address was set successfully
- * @retval IX_ETH_DB_FAIL MAC address was not set due to a message handler failure
- * @retval IX_ETH_DB_INVALID_PORT if the port is not an Ethernet NPE
- *
- * @see IxEthDBPortDefs.h for port definitions
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortAddressSet(IxEthDBPortId portID, IxEthDBMacAddr *macAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFilteringPortMaximumFrameSizeSet(IxEthDBPortId portID, UINT32 maximumFrameSize)
- *
- * @brief Set the maximum frame size supported on the given port ID
- *
- * This functions set the maximum frame size supported on a specific port ID
- *
- * - Reentrant - yes
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to configure
- * @param maximumFrameSize UINT32 [in] - maximum frame size to configure
- *
- * @retval IX_ETH_DB_SUCCESS the port is configured
- * @retval IX_ETH_DB_PORT_UNINITIALIZED the port has not been initialized
- * @retval IX_ETH_DB_INVALID_PORT portID is invalid
- * @retval IX_ETH_DB_INVALID_ARG size parameter is out of range
- * @retval IX_ETH_DB_NO_PERMISSION selected port is not an Ethernet NPE
- * @retval IX_FAIL unknown OS or NPE communication error
- *
- * @note
- * This maximum frame size is used to filter the frames based on their
- * destination addresses and the capabilities of the destination port.
- * The mximum value that can be set for a NPE port is 16320.
- * (IX_ETHNPE_ACC_FRAME_LENGTH_MAX)
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringPortMaximumFrameSizeSet(IxEthDBPortId portID, UINT32 maximumFrameSize);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFilteringStaticEntryProvision(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
- *
- * @brief Populate the Ethernet learning/filtering database with a static MAC address
- *
- * Populates the Ethernet learning/filtering database with a static MAC address. The entry will not be subject to aging.
- * If there is an entry (static or dynamic) with the corresponding MAC address on any port this entry will take precedence.
- * Any other entry with the same MAC address will be removed.
- *
- * - Reentrant - yes
- * - ISR Callable - yes
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to add the static address to
- * @param macAddr @ref IxEthDBMacAddr [in] - static MAC address to add
- *
- * @retval IX_ETH_DB_SUCCESS the add was successful
- * @retval IX_ETH_DB_FAIL failed to populate the database entry
- * @retval IX_ETH_DB_BUSY failed due to a temporary busy condition (i.e. lack of CPU cycles), try again later
- * @retval IX_ETH_DB_INVALID_PORT portID is invalid
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> pointer argument
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE learning feature is disabled
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringStaticEntryProvision(IxEthDBPortId portID, IxEthDBMacAddr *macAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFilteringDynamicEntryProvision(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
- *
- * @brief Populate the Ethernet learning/filtering database with a dynamic MAC address
- *
- * Populates the Ethernet learning/filtering database with a dynamic MAC address. This entry will be subject to normal
- * aging function, if aging is enabled on its port.
- * If there is an entry (static or dynamic) with the same MAC address on any port this entry will take precedence.
- * Any other entry with the same MAC address will be removed.
- *
- * - Reentrant - yes
- * - ISR Callable - yes
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to add the dynamic address to
- * @param macAddr @ref IxEthDBMacAddr [in] - static MAC address to add
- *
- * @retval IX_ETH_DB_SUCCESS the add was successful
- * @retval IX_ETH_DB_FAIL failed to populate the database entry
- * @retval IX_ETH_DB_BUSY failed due to a temporary busy condition (i.e. lack of CPU cycles), try again later
- * @retval IX_ETH_DB_INVALID_PORT portID is invalid
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> pointer argument
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE learning feature is disabled
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringDynamicEntryProvision(IxEthDBPortId portID, IxEthDBMacAddr *macAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFilteringEntryDelete(IxEthDBMacAddr *macAddr)
- *
- * @brief Removes a MAC address entry from the Ethernet learning/filtering database
- *
- * @param macAddr IxEthDBMacAddr [in] - MAC address to remove
- *
- * - Reentrant - yes
- * - ISR Callable - no
- *
- * @retval IX_ETH_DB_SUCCESS the removal was successful
- * @retval IX_ETH_DB_NO_SUCH_ADDR failed to remove the address (not in the database)
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> pointer argument
- * @retval IX_ETH_DB_BUSY failed due to a temporary busy condition (i.e. lack of CPU cycles), try again later
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringEntryDelete(IxEthDBMacAddr *macAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFilteringPortSearch(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
- *
- * @brief Search the Ethernet learning/filtering database for the given MAC address and port ID
- *
- * This functions searches the database for a specific port ID and MAC address. Both the port ID
- * and the MAC address have to match in order for the record to be reported as found.
- *
- * - Reentrant - yes
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to search for
- * @param macAddr @ref IxEthDBMacAddr [in] - MAC address to search for
- *
- * @retval IX_ETH_DB_SUCCESS the record exists in the database
- * @retval IX_ETH_DB_INVALID_ARG invalid macAddr pointer argument
- * @retval IX_ETH_DB_NO_SUCH_ADDR the record was not found in the database
- * @retval IX_ETH_DB_INVALID_PORT portID is invalid
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port ID is not initialized
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE learning feature is disabled
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringPortSearch(IxEthDBPortId portID, IxEthDBMacAddr *macAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFilteringDatabaseSearch(IxEthDBPortId *portID, IxEthDBMacAddr *macAddr)
- *
- * @brief Search the Ethernet learning/filtering database for a MAC address and return the port ID
- *
- * Searches the database for a MAC address. The function returns the portID for the
- * MAC address record, if found. If no match is found the function returns IX_ETH_DB_NO_SUCH_ADDR.
- * The portID is only valid if the function finds a match.
- *
- * - Reentrant - yes
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - port ID the address belongs to (populated only on a successful search)
- * @param macAddr @ref IxEthDBMacAddr [in] - MAC address to search for
- *
- * @retval IX_ETH_DB_SUCCESS the record exists in the database
- * @retval IX_ETH_DB_NO_SUCH_ADDR the record was not found in the database
- * @retval IX_ETH_DB_INVALID_ARG invalid macAddr or portID pointer argument(s)
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringDatabaseSearch(IxEthDBPortId *portID, IxEthDBMacAddr *macAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFilteringPortUpdatingSearch(IxEthDBPortId *portID, IxEthDBMacAddr *macAddr)
- *
- * @brief Search the filtering database for a MAC address, return the port ID and reset the record age
- *
- * Searches the database for a MAC address. The function returns the portID for the
- * MAC address record and resets the entry age to 0, if found.
- * If no match is found the function returns IX_ETH_DB_NO_SUCH_ADDR.
- * The portID is only valid if the function finds a match.
- *
- * - Reentrant - yes
- * - ISR Callable - no
- *
- * @retval IX_ETH_DB_SUCCESS the MAC address was found
- * @retval IX_ETH_DB_NO_SUCH_ADDR the MAC address was not found
- * @retval IX_ETH_DB_INVALID_ARG invalid macAddr or portID pointer argument(s)
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringPortUpdatingSearch(IxEthDBPortId *portID, IxEthDBMacAddr *macAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @def IX_ETH_DB_MAINTENANCE_TIME
- *
- * @brief The @ref ixEthDBDatabaseMaintenance must be called by the user at a frequency of
- * IX_ETH_DB_MAINTENANCE_TIME
- *
- */
-#define IX_ETH_DB_MAINTENANCE_TIME (1 * 60) /* 1 Minute */
-
-/**
- * @ingroup IxEthDB
- *
- * @def IX_ETH_DB_LEARNING_ENTRY_AGE_TIME
- *
- * @brief The define specifies the filtering database age entry time. Static entries older than
- * IX_ETH_DB_LEARNING_ENTRY_AGE_TIME +/- IX_ETH_DB_MAINTENANCE_TIME shall be removed.
- *
- */
-#define IX_ETH_DB_LEARNING_ENTRY_AGE_TIME (15 * 60 ) /* 15 Mins */
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortAgingDisable(IxEthDBPortId portID)
- *
- * @brief Disable the aging function for a specific port
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to disable aging on
- *
- * - Reentrant - yes
- * - ISR Callable - no
- *
- * @retval IX_ETH_DB_SUCCESS aging disabled successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is invalid
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port ID is not initialized
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE learning feature is disabled
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortAgingDisable(IxEthDBPortId portID);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortAgingEnable(IxEthDBPortId portID)
- *
- * @brief Enable the aging function for a specific port
- *
- * Enables the aging of dynamic MAC address entries stored in the learning/filtering database
- *
- * @note The aging function relies on the @ref ixEthDBDatabaseMaintenance being called with a period of
- * @ref IX_ETH_DB_MAINTENANCE_TIME seconds.
- *
- * - Reentrant - yes
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to enable aging on
- *
- * @retval IX_ETH_DB_SUCCESS aging enabled successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is invalid
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port ID is not initialized
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE learning feature is disabled
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortAgingEnable(IxEthDBPortId portID);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn void ixEthDBDatabaseMaintenance(void)
- *
- * @brief Performs a maintenance operation on the Ethernet learning/filtering database
- *
- * In order to perform a database maintenance this function must be called every
- * @ref IX_ETH_DB_MAINTENANCE_TIME seconds. It should be called regardless of whether learning is
- * enabled or not.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @note this function call will be ignored if the learning feature is disabled
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBDatabaseMaintenance(void);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFilteringDatabaseShow(IxEthDBPortId portID)
- *
- * @brief This function displays the Mac Ethernet MAC address filtering tables.
- *
- * It displays the MAC address, port ID, entry type (dynamic/static),and age for
- * the given port ID.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to display the MAC address entries
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is invalid
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port ID is not initialized
- * @retval IX_ETH_DB_FAIL record browser failed due to an internal busy or lock condition
- *
- * @note this function is deprecated and kept for compatibility reasons; use @ref ixEthDBFilteringDatabaseShowRecords instead
- *
- * @see ixEthDBFilteringDatabaseShowRecords
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringDatabaseShow(IxEthDBPortId portID);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn void ixEthDBFilteringDatabaseShowAll(void)
- *
- * @brief Displays the MAC address recorded in the filtering database for all registered
- * ports (see IxEthDBPortDefs.h), grouped by port ID.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @retval void
- *
- * @note this function is deprecated and kept for compatibility reasons; use @ref ixEthDBFilteringDatabaseShowRecords instead
- *
- * @see ixEthDBFilteringDatabaseShowRecords
- */
-IX_ETH_DB_PUBLIC
-void ixEthDBFilteringDatabaseShowAll(void);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFilteringDatabaseShowRecords(IxEthDBPortId portID, IxEthDBRecordType recordFilter)
- *
- * @brief This function displays per port database records, given a record type filter
- *
- * The supported record type filters are:
- *
- * - IX_ETH_DB_FILTERING_RECORD - displays the non-VLAN filtering records (MAC address, age, static/dynamic)
- * - IX_ETH_DB_FILTERING_VLAN_RECORD - displays the VLAN filtering records (MAC address, age, static/dynamic, VLAN ID, CFI, QoS class)
- * - IX_ETH_DB_FILTERING_RECORD | IX_ETH_DB_FILTERING_VLAN_RECORD - displays the previous two types of records
- * - IX_ETH_DB_WIFI_RECORD - displays the WiFi header conversion records (MAC address, optional gateway MAC address) and WiFi header conversion parameters (BBSID, Duration/ID)
- * - IX_ETH_DB_FIREWALL_RECORD - displays the firewall MAC address table and firewall operating mode (white list/black list)
- * - IX_ETH_DB_ALL_RECORD_TYPES - displays all the record types
- * - IX_ETH_DB_NO_RECORD_TYPE - displays only the port status (no records are displayed)
- *
- * Additionally, the status of each port will be displayed, containg the following information: type, capabilities, enabled status,
- * aging enabled status, group membership and maximum frame size.
- *
- * The port ID can either be an actual port or IX_ETH_DB_ALL_PORTS, in which case the requested information
- * will be displayed for all the ports (grouped by port)
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID ID of the port to display information on (use IX_ETH_DB_ALL_PORTS for all the ports)
- * @param recordFilter record type filter
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is invalid
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port ID is not initialized
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFilteringDatabaseShowRecords(IxEthDBPortId portID, IxEthDBRecordType recordFilter);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortDependencyMapSet(IxEthDBPortId portID, IxEthDBPortMap dependencyPortMap)
- *
- * @brief Sets the dependency port map for a port
- *
- * @param portID ID of the port to set the dependency map to
- * @param dependencyPortMap new dependency map (as bitmap, each bit set indicates a port being included)
- *
- * This function is used to share filtering information between ports.
- * By adding a port into another port's dependency map the target port
- * filtering data will import the filtering data from the port it depends on.
- * Any changes to filtering data for a port - such as adding, updating or removing records -
- * will trigger updates in the filtering information for all the ports depending on
- * on the updated port.
- *
- * For example, if ports 2 and 3 are set in the port 0 dependency map the filtering
- * information for port 0 will also include the filtering information from ports 2 and 3.
- * Adding a record to port 2 will also trigger an update not only on port 2 but also on
- * port 0.
- *
- * The dependency map is a 256 bit array where each bit corresponds to a port corresponding to the
- * bit offset (bit 0 - port 0, bit 1 - port 1 etc). Setting a bit to 1 indicates that the corresponding
- * port is the port map. For example, a dependency port map of 0x14 consists in the ports with IDs 2 and 4.
- * Note that the last bit (offset 255) is reserved and should never be set (it will be automatically
- * cleared by the function).
- *
- * By default, each port has a dependency port map consisting only of itself, i.e.
- *
- * @verbatim
- IxEthDBPortMap portMap;
-
- // clear all ports from port map
- memset(portMap, 0, sizeof (portMap));
-
- // include portID in port map
- portMap[portID / 8] = 1 << (portID % 8);
- @endverbatim
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @note Setting dependency maps is useful for NPE ports, which benefit from automatic updates
- * of filtering information. Setting dependency maps for user-defined ports is not an error
- * but will have no actual effect.
- *
- * @note Including a port in its own dependency map is not compulsory, however note that
- * in this case updating the port will not trigger an update on the port itself, which
- * might not be the intended behavior
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>dependencyPortMap</i> pointer
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE Filtering is not available or not enabled for the port
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortDependencyMapSet(IxEthDBPortId portID, IxEthDBPortMap dependencyPortMap);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortDependencyMapGet(IxEthDBPortId portID, IxEthDBPortMap dependencyPortMap)
- *
- * @brief Retrieves the dependency port map for a port
- *
- * @param portID ID of the port to set the dependency map to
- * @param dependencyPortMap location where the port dependency map is to be copied
- *
- * This function will copy the port dependency map to a user specified location.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>dependencyPortMap</i> pointer
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE Filtering is not available or not enabled for the port
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortDependencyMapGet(IxEthDBPortId portID, IxEthDBPortMap dependencyPortMap);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortVlanTagSet(IxEthDBPortId portID, IxEthDBVlanTag vlanTag)
- *
- * @brief Sets the default 802.1Q VLAN tag for a given port
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to set the default VLAN tag to
- * @param vlanTag @ref IxEthDBVlanTag [in] - default 802.1Q VLAN tag
- *
- * The tag format has 16 bits and it is defined in the IEEE802.1Q specification.
- * This tag will be used for tagging untagged frames (if enabled) and classifying
- * unexpedited traffic into an internal traffic class (using the user priority field).
- *
- * <table border="1"> <caption> 802.1Q tag format </caption>
- * <tr> <td> <b> 3 bits <td> <b> 1 bit <td> <b> 12 bits </b>
- * <tr> <td> user priority <td> CFI <td> VID
- * </table>
- *
- * User Priority : Defines user priority, giving eight (2^3) priority levels. IEEE 802.1P defines
- * the operation for these 3 user priority bits
- *
- * CFI : Canonical Format Indicator is always set to zero for Ethernet switches. CFI is used for
- * compatibility reason between Ethernet type network and Token Ring type network. If a frame received
- * at an Ethernet port has a CFI set to 1, then that frame should not be forwarded as it is to an untagged port.
- *
- * VID : VLAN ID is the identification of the VLAN, which is basically used by the standard 802.1Q.
- * It has 12 bits and allow the id entification of 4096 (2^12) VLANs. Of the 4096 possible VIDs, a VID of 0
- * is used to identify priority frames and value 4095 (FFF) is reserved, so the maximum possible VLAN
- * configurations are 4,094.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_ETH_DB_INVALID_VLAN <i>vlanTag</i> argument does not parse to a valid 802.1Q VLAN tag
- *
- * @note a VLAN ID value of 0 indicates that the port is not part of any VLAN
- * @note the value of the cannonical frame indicator (CFI) field is ignored, the
- * field being used only in frame tagging operations
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanTagSet(IxEthDBPortId portID, IxEthDBVlanTag vlanTag);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortVlanTagGet(IxEthDBPortId portID, IxEthDBVlanTag *vlanTag)
- *
- * @brief Retrieves the default 802.1Q port VLAN tag for a given port (see also @ref ixEthDBPortVlanTagSet)
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to retrieve the default VLAN tag from
- * @param vlanTag @ref IxEthDBVlanTag [out] - location to write the default port 802.1Q VLAN tag to
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid vlanTag pointer
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanTagGet(IxEthDBPortId portID, IxEthDBVlanTag *vlanTag);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBVlanTagSet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag vlanTag)
- *
- * @brief Sets the 802.1Q VLAN tag for a database record
- *
- * @param macAddr MAC address
- * @param vlanTag 802.1Q VLAN tag
- *
- * This function is used together with @ref ixEthDBVlanTagGet to provide MAC-based VLAN classification support.
- * Please note that the bridging application must contain specific code to make use of this feature (see below).
- *
- * VLAN tags can be set only in IX_ETH_DB_FILTERING_RECORD or IX_ETH_DB_FILTERING_VLAN_RECORD type records.
- * If to an IX_ETH_DB_FILTERING_RECORD type record is added a VLAN tag the record type is automatically
- * changed to IX_ETH_DB_FILTERING_VLAN_RECORD. Once this has occurred the record type will never
- * revert to a non-VLAN type (unless deleted and re-added).
- *
- * Record types used for different purposes (such as IX_ETH_DB_WIFI_RECORD) will be ignored by
- * this function.
- *
- * After using this function to associate a VLAN ID with a MAC address the VLAN ID can be extracted knowing the
- * MAC address using @ref ixEthDBVlanTagGet. This mechanism can be used to implement MAC-based VLAN classification
- * if a bridging application searches for the VLAN tag when receiving a frame based on the source MAC address
- * (contained in the <i>ixp_ne_src_mac</i> field of the buffer header).
- * If found in the database, the application can instruct the NPE to tag the frame by writing the VLAN tag
- * in the <i>ixp_ne_vlan_tci</i> field of the buffer header. This way the NPE will inspect the Egress tagging
- * rule associated with the given VLAN ID on the Tx port and tag the frame if Egress tagging on the VLAN is
- * allowed. Additionally, Egress tagging can be forced by setting the <i>ixp_ne_tx_flags.tag_over</i> and
- * <i>ixp_ne_tx_flags.tag_mode</i> flags in the buffer header.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @note this function will <b>not</b> add a filtering record, it can only be used to update an existing one
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> pointer
- * @retval IX_ETH_DB_NO_SUCH_ADDR a filtering record with the specified MAC address was not found
- * @retval IX_ETH_DB_INVALID_VLAN <i>vlanTag</i> argument does not parse to a valid 802.1Q VLAN tag
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBVlanTagSet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag vlanTag);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn ixEthDBVlanTagGet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag *vlanTag)
- *
- * @brief Retrieves the 802.1Q VLAN tag from a database record given the record MAC address
- *
- * @param macAddr MAC address
- * @param vlanTag location to write the record 802.1Q VLAN tag to
- *
- * @note VLAN tags can be retrieved only from IX_ETH_DB_FILTERING_VLAN_RECORD type records
- *
- * This function is used together with ixEthDBVlanTagSet to provide MAC-based VLAN classification support.
- * Please note that the bridging application must contain specific code to make use of this feature (see @ref ixEthDBVlanTagSet).
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> or <i>vlanTag</i> pointer
- * @retval IX_ETH_DB_NO_SUCH_ADDR a filtering record with the specified MAC address was not found
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBVlanTagGet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag *vlanTag);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortVlanMembershipAdd(IxEthDBPortId portID, IxEthDBVlanId vlanID)
- *
- * @brief Adds a VLAN ID to a port's VLAN membership table
- *
- * Adding a VLAN ID to a port's VLAN membership table will cause frames tagged with the specified
- * VLAN ID to be accepted by the frame filter, if Ingress VLAN membership filtering is enabled.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to add the VLAN ID membership to
- * @param vlanID @ref IxEthDBVlanId [in] - VLAN ID to be added to the port membership table
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_VLAN vlanID is not a valid VLAN ID
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- *
- * @note A port's default VLAN ID is always in its own membership table, hence there
- * is no need to explicitly add it using this function (although it is not an error
- * to do so)
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipAdd(IxEthDBPortId portID, IxEthDBVlanId vlanID);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortVlanMembershipRangeAdd(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax)
- *
- * @brief Adds a VLAN ID range to a port's VLAN membership table
- *
- * All the VLAN IDs in the specified range will be added to the port VLAN
- * membership table, including the range start and end VLAN IDs. Tagged frames with
- * VLAN IDs in the specified range will be accepted by the frame filter, if Ingress VLAN
- * membership filtering is enabled.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to add the VLAN membership range into
- * @param vlanIDMin @ref IxEthDBVlanId [in] - start of the VLAN ID range
- * @param vlanIDMax @ref IxEthDBVlanId [in] - end of the VLAN ID range
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_VLAN the specified VLAN IDs are invalid or do not constitute a range
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- *
- * @note Is is valid to use the same VLAN ID for both vlanIDMin and vlanIDMax, in which case this
- * function will behave as @ref ixEthDBPortVlanMembershipAdd
- *
- * @note A port's default VLAN ID is always in its own membership table, hence there is no need
- * to explicitly add it using this function (although it is not an error to do so)
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipRangeAdd(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortVlanMembershipRemove(IxEthDBPortId portID, IxEthDBVlanId vlanID)
- *
- * @brief Removes a VLAN ID from a port's VLAN membership table
- *
- * Frames tagged with a VLAN ID which is not in a port's VLAN membership table
- * will be discarded by the frame filter, if Ingress membership filtering is enabled.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to remove the VLAN ID membership from
- * @param vlanID @ref IxEthDBVlanId [in] - VLAN ID to be removed from the port membership table
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_INVALID_VLAN vlanID is not a valid VLAN ID
- * @retval IX_ETH_DB_NO_PERMISSION attempted to remove the default VLAN ID
- * from the port membership table (vlanID was set to the default port VLAN ID)
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- *
- * @note A port's default VLAN ID cannot be removed from the port's membership
- * table; attempting it will return IX_ETH_DB_NO_PERMISSION
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipRemove(IxEthDBPortId portID, IxEthDBVlanId vlanID);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortVlanMembershipRangeRemove(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax)
- *
- * @brief Removes a VLAN ID range from a port's VLAN membership table
- *
- * All the VLAN IDs in the specified range will be removed from the port VLAN
- * membership table, including the range start and end VLAN IDs. Tagged frames
- * with VLAN IDs in the range will be discarded by the frame filter, if Ingress
- * membership filtering is enabled.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to remove the VLAN membership range from
- * @param vlanIDMin @ref IxEthDBVlanId [in] - start of the VLAN ID range
- * @param vlanIDMax @ref IxEthDBVlanId [in] - end of the VLAN ID range
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_VLAN the specified VLAN IDs are invalid or do not constitute a range
- * @retval IX_ETH_DB_NO_PERMISSION attempted to remove the default VLAN ID
- * from the port membership table (both vlanIDMin and vlanIDMax were set to the default port VLAN ID)
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- *
- * @note Is is valid to use the same VLAN ID for both vlanIDMin and vlanIDMax, in which case
- * function will behave as @ref ixEthDBPortVlanMembershipRemove
- *
- * @note If the given range overlaps the default port VLAN ID this function
- * will remove all the VLAN IDs in the range except for the port VLAN ID from its
- * own membership table. This situation will be silently dealt with (no error message
- * will be returned) as long as the range contains more than one value (i.e. at least
- * one other value, apart from the default port VLAN ID). If the function is called
- * with the vlanIDMin and vlanIDMax parameters both set to the port default VLAN ID, the
- * function will infer that an attempt was specifically made to remove the default port
- * VLAN ID from the port membership table, in which case the return value will be
- * IX_ETH_DB_NO_PERMISSION.
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipRangeRemove(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortVlanMembershipSet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
- *
- * @brief Sets a port's VLAN membership table
- *
- * Sets a port's VLAN membership table from a complete VLAN table containing all the possible
- * 4096 VLAN IDs. The table format is an array containing 4096 bits (512 bytes), where each bit
- * indicates whether the VLAN at that bit index is in the port's membership list (if set) or
- * not (unset).
- *
- * The bit at index 0, indicating VLAN ID 0, indicates no VLAN membership and therefore no
- * other bit must be set if bit 0 is set.
- *
- * The bit at index 4095 is reserved and should never be set (it will be ignored if set).
- *
- * The bit referencing the same VLAN ID as the default port VLAN ID should always be set, as
- * the membership list must contain at least the default port VLAN ID.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to set the VLAN membership table to
- * @param vlanSet @ref IxEthDBVlanSet [in] - pointer to the VLAN membership table
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>vlanSet</i> pointer
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipSet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPortVlanMembershipGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
- *
- * @brief Retrieves a port's VLAN membership table
- *
- * Retrieves the complete VLAN membership table from a port, containing all the possible
- * 4096 VLAN IDs. The table format is an array containing 4096 bits (512 bytes), where each bit
- * indicates whether the VLAN at that bit index is in the port's membership list (if set) or
- * not (unset).
- *
- * The bit at index 0, indicating VLAN ID 0, indicates no VLAN membership and therefore no
- * other bit will be set if bit 0 is set.
- *
- * The bit at index 4095 is reserved and will not be set (it will be ignored if set).
- *
- * The bit referencing the same VLAN ID as the default port VLAN ID will always be set, as
- * the membership list must contain at least the default port VLAN ID.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to retrieve the VLAN membership table from
- * @param vlanSet @ref IxEthDBVlanSet [out] - pointer a location where the VLAN membership table will be
- * written to
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>vlanSet</i> pointer
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPortVlanMembershipGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBAcceptableFrameTypeSet(IxEthDBPortId portID, IxEthDBFrameFilter frameFilter)
- *
- * @brief Sets a port's acceptable frame type filter
- *
- * The acceptable frame type is one (or a combination) of the following values:
- * - IX_ETH_DB_ACCEPT_ALL_FRAMES - accepts all the frames
- * - IX_ETH_DB_UNTAGGED_FRAMES - accepts untagged frames
- * - IX_ETH_DB_VLAN_TAGGED_FRAMES - accepts tagged frames
- * - IX_ETH_DB_PRIORITY_TAGGED_FRAMES - accepts tagged frames with VLAN ID set to 0 (no VLAN membership)
- *
- * Except for using the exact values given above only the following combinations are valid:
- * - IX_ETH_DB_UNTAGGED_FRAMES | IX_ETH_DB_VLAN_TAGGED_FRAMES
- * - IX_ETH_DB_UNTAGGED_FRAMES | IX_ETH_DB_PRIORITY_TAGGED_FRAMES
- *
- * Please note that IX_ETH_DB_UNTAGGED_FRAMES | IX_ETH_DB_VLAN_TAGGED_FRAMES is equivalent
- * to IX_ETH_DB_ACCEPT_ALL_FRAMES.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @note by default the acceptable frame type filter is set to IX_ETH_DB_ACCEPT_ALL_FRAMES
- *
- * @note setting the acceptable frame type to PRIORITY_TAGGED_FRAMES is internally
- * accomplished by changing the frame filter to VLAN_TAGGED_FRAMES and setting the
- * VLAN membership list to include only VLAN ID 0; the membership list will need
- * to be restored manually to an appropriate value if the acceptable frame type
- * filter is changed back to ACCEPT_ALL_FRAMES or VLAN_TAGGED_FRAMES; failure to do so
- * will filter all VLAN traffic bar frames tagged with VLAN ID 0
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to set the acceptable frame type filter to
- * @param frameFilter @ref IxEthDBFrameFilter [in] - acceptable frame type filter
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid frame type filter
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBAcceptableFrameTypeSet(IxEthDBPortId portID, IxEthDBFrameFilter frameFilter);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBAcceptableFrameTypeGet(IxEthDBPortId portID, IxEthDBFrameFilter *frameFilter)
- *
- * @brief Retrieves a port's acceptable frame type filter
- *
- * For a description of the acceptable frame types see @ref ixEthDBAcceptableFrameTypeSet
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - port ID to retrieve the acceptable frame type filter from
- * @param frameFilter @ref IxEthDBFrameFilter [out] - location to store the acceptable frame type filter
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>frameFilter</i> pointer argument
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBAcceptableFrameTypeGet(IxEthDBPortId portID, IxEthDBFrameFilter *frameFilter);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPriorityMappingTableSet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable)
- *
- * @brief Sets a port's priority mapping table
- *
- * The priority mapping table is an 8x2 table mapping a QoS (user) priority into an internal
- * traffic class. There are 8 valid QoS priorities (0..7, 0 being the lowest) which can be
- * mapped into one of the 4 available traffic classes (0..3, 0 being the lowest).
- * If a custom priority mapping table is not specified using this function the following
- * default priority table will be used (as per IEEE 802.1Q and IEEE 802.1D):
- *
- * <table border="1"> <caption> QoS traffic classes </caption>
- * <tr> <td> <b> QoS priority <td> <b> Default traffic class <td> <b> Traffic type </b>
- * <tr> <td> 0 <td> 1 <td> Best effort, default class for unexpedited traffic
- * <tr> <td> 1 <td> 0 <td> Background traffic
- * <tr> <td> 2 <td> 0 <td> Spare bandwidth
- * <tr> <td> 3 <td> 1 <td> Excellent effort
- * <tr> <td> 4 <td> 2 <td> Controlled load
- * <tr> <td> 5 <td> 2 <td> Video traffic
- * <tr> <td> 6 <td> 3 <td> Voice traffic
- * <tr> <td> 7 <td> 3 <td> Network control
- * </table>
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - port ID of the port to set the priority mapping table to
- * @param priorityTable @ref IxEthDBPriorityTable [in] - location of the user priority table
- *
- * @note The provided table will be copied into internal data structures in EthDB and
- * can be deallocated by the called after this function has completed its execution, if
- * so desired
- *
- * @warning The number of available traffic classes differs depending on the NPE images
- * and queue configuration. Check IxEthDBQoS.h for up-to-date information on the availability of
- * traffic classes. Note that specifiying a traffic class in the priority map which exceeds
- * the system availability will produce an IX_ETH_DB_INVALID_PRIORITY return error code and no
- * priority will be remapped.
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>priorityTable</i> pointer
- * @retval IX_ETH_DB_INVALID_PRIORITY at least one priority value exceeds
- * the current number of available traffic classes
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPriorityMappingTableSet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPriorityMappingTableGet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable)
- *
- * @brief Retrieves a port's priority mapping table
- *
- * The priority mapping table for the given port will be copied in the location
- * specified by the caller using "priorityTable"
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID ID @ref IxEthDBPortId [in] - of the port to retrieve the priority mapping table from
- * @param priorityTable @ref IxEthDBPriorityTable [out] - pointer to a user specified location where the table will be copied to
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid priorityTable pointer
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPriorityMappingTableGet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPriorityMappingClassSet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority trafficClass)
- *
- * @brief Sets one QoS/user priority => traffic class mapping in a port's priority mapping table
- *
- * This function establishes a mapping between a user (QoS) priority and an internal traffic class.
- * The mapping will be saved in the port's priority mapping table. Use this function when not all
- * the QoS priorities need remapping (see also @ref ixEthDBPriorityMappingTableSet)
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to set the mapping to
- * @param userPriority @ref IxEthDBPriority [in] - user (QoS) priority, between 0 and 7 (0 being the lowest)
- * @param trafficClass @ref IxEthDBPriority [in] - internal traffic class, between 0 and 3 (0 being the lowest)
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_PRIORITY <i>userPriority</i> out of range or
- * <i>trafficClass</i> is beyond the number of currently available traffic classes
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPriorityMappingClassSet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority trafficClass);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBPriorityMappingClassGet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority *trafficClass)
- *
- * @brief Retrieves one QoS/user priority => traffic class mapping in a port's priority mapping table
- *
- * This function retrieves the internal traffic class associated with a QoS (user) priority from a given
- * port's priority mapping table. Use this function when not all the QoS priority mappings are
- * required (see also @ref ixEthDBPriorityMappingTableGet)
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to set the mapping to
- * @param userPriority @ref IxEthDBPriority [in] - user (QoS) priority, between 0 and 7 (0 being the lowest)
- * @param trafficClass @ref IxEthDBPriority [out] - location to write the corresponding internal traffic class to
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_PRIORITY invalid userPriority value (out of range)
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>trafficClass</i> pointer argument
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBPriorityMappingClassGet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority *trafficClass);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL enabled)
- *
- * @brief Enables or disables Egress VLAN tagging for a port and a given VLAN
- *
- * This function enables or disables Egress VLAN tagging for the given port and VLAN ID.
- * If the VLAN tagging for a certain VLAN ID is enabled then all the frames to be
- * transmitted on the given port tagged with the same VLAN ID will be transmitted in a tagged format.
- * If tagging is not enabled for the given VLAN ID, the VLAN tag from the frames matching
- * this VLAN ID will be removed (the frames will be untagged).
- *
- * VLAN ID 4095 is reserved and should never be used with this function.
- * VLAN ID 0 has the special meaning of "No VLAN membership" and it is used in this
- * context to allow the port to send priority-tagged frames or not.
- *
- * By default, no Egress VLAN tagging is enabled on any port.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to enable or disable the VLAN ID Egress tagging on
- * @param vlanID @ref IxEthDBVlanId [in] - VLAN ID to be matched against outgoing frames
- * @param enabled BOOL [in] - TRUE to enable Egress VLAN tagging on the port and given VLAN, and
- * FALSE to disable Egress VLAN tagging
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_VLAN invalid VLAN ID (out of range)
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL enabled);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL *enabled)
- *
- * @brief Retrieves the Egress VLAN tagging enabling status for a port and VLAN ID
- *
- * @param portID [in] - ID of the port to extract the Egress VLAN ID tagging status from
- * @param vlanID VLAN [in] - ID whose tagging status is to be extracted
- * @param enabled [in] - user-specifed location where the status is copied to; following
- * the successfull execution of this function the value will be TRUE if Egress VLAN
- * tagging is enabled for the given port and VLAN ID, and FALSE otherwise
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @see ixEthDBEgressVlanEntryTaggingEnabledGet
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_VLAN invalid VLAN ID (out of range)
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>enabled</i> argument pointer
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL *enabled);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBEgressVlanRangeTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax, BOOL enabled)
- *
- * @brief Enables or disables Egress VLAN tagging for a port and given VLAN range
- *
- * This function is very similar to @ref ixEthDBEgressVlanEntryTaggingEnabledSet with the
- * difference that it can manipulate the Egress tagging status on multiple VLAN IDs,
- * defined by a contiguous range. Note that both limits in the range are explicitly
- * included in the execution of this function.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to enable or disable the VLAN ID Egress tagging on
- * @param vlanIDMin @ref IxEthDBVlanId [in] - start of the VLAN range to be matched against outgoing frames
- * @param vlanIDMax @ref IxEthDBVlanId [in] - end of the VLAN range to be matched against outgoing frames
- * @param enabled BOOL [in] - TRUE to enable Egress VLAN tagging on the port and given VLAN range,
- * and FALSE to disable Egress VLAN tagging
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_VLAN invalid VLAN ID (out of range), or do not constitute a range
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_ETH_DB_NO_PERMISSION attempted to explicitly remove the default port VLAN ID from the tagging table
- * @retval IX_FAIL unknown OS or NPE communication error
- *
- * @note Specifically removing the default port VLAN ID from the Egress tagging table by setting both vlanIDMin and vlanIDMax
- * to the VLAN ID portion of the PVID is not allowed by this function and will return IX_ETH_DB_NO_PERMISSION.
- * However, this can be circumvented, should the user specifically desire this, by either using a
- * larger range (vlanIDMin < vlanIDMax) or by using ixEthDBEgressVlanEntryTaggingEnabledSet.
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBEgressVlanRangeTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax, BOOL enabled);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBEgressVlanTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
- *
- * @brief Sets the complete Egress VLAN tagging table for a port
- *
- * This function is used to set the VLAN tagging/untagging per VLAN ID for a given port
- * covering the entire VLAN ID range (0..4094). The <i>vlanSet</i> parameter is a 4096
- * bit array, each bit indicating the Egress behavior for the corresponding VLAN ID.
- * If a bit is set then outgoing frames with the corresponding VLAN ID will be transmitted
- * with the VLAN tag, otherwise the frame will be transmitted without the VLAN tag.
- *
- * Bit 0 has a special significance, indicating tagging or tag removal for priority-tagged
- * frames.
- *
- * Bit 4095 is reserved and should never be set (it will be ignored if set).
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port whose Egress VLAN tagging behavior is set
- * @param vlanSet @ref IxEthDBVlanSet [in] - 4096 bit array controlling per-VLAN tagging and untagging
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>vlanSet</i> pointer
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- *
- * @warning This function will automatically add the default port VLAN ID to the Egress tagging table
- * every time it is called. The user should manually call ixEthDBEgressVlanEntryTaggingEnabledSet to
- * prevent tagging on the default port VLAN ID if the default behavior is not intended.
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBEgressVlanTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBEgressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
- *
- * @brief Retrieves the complete Egress VLAN tagging table from a port
- *
- * This function copies the 4096 bit table controlling the Egress VLAN tagging into a user specified
- * area. Each bit in the array indicates whether tagging for the corresponding VLAN (the bit position
- * in the array) is enabled (the bit is set) or not (the bit is unset).
- *
- * Bit 4095 is reserved and should not be set (it will be ignored if set).
- *
- * @see ixEthDBEgressVlanTaggingEnabledSet
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port whose Egress VLAN tagging behavior is retrieved
- * @param vlanSet @ref IxEthDBVlanSet [out] - user location to copy the Egress tagging table into; should have
- * room to store 4096 bits (512 bytes)
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>vlanSet</i> pointer
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBEgressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBIngressVlanTaggingEnabledSet(IxEthDBPortId portID, IxEthDBTaggingAction taggingAction)
- *
- * @brief Sets the Ingress VLAN tagging behavior for a port
- *
- * A port's Ingress tagging behavior is controlled by the taggingAction parameter,
- * which can take one of the following values:
- *
- * - IX_ETH_DB_PASS_THROUGH - leaves the frame unchanged (does not add or remove the VLAN tag)
- * - IX_ETH_DB_ADD_TAG - adds the VLAN tag if not present, using the default port VID
- * - IX_ETH_DB_REMOVE_TAG - removes the VLAN tag if present
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port whose Ingress VLAN tagging behavior is set
- * @param taggingAction @ref IxEthDBTaggingAction [in] - tagging behavior for the port
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>taggingAction</i> argument
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBIngressVlanTaggingEnabledSet(IxEthDBPortId portID, IxEthDBTaggingAction taggingAction);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBIngressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBTaggingAction *taggingAction)
- *
- * @brief Retrieves the Ingress VLAN tagging behavior from a port (see @ref ixEthDBIngressVlanTaggingEnabledSet)
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port whose Ingress VLAN tagging behavior is set
- * @param taggingAction @ref IxEthDBTaggingAction [out] - location where the tagging behavior for the port is written to
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>taggingAction</i> pointer argument
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBIngressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBTaggingAction *taggingAction);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBVlanPortExtractionEnable(IxEthDBPortId portID, BOOL enable)
- *
- * @brief Enables or disables port ID extraction
- *
- * This feature can be used in the situation when a multi-port device (e.g. a switch)
- * is connected to an IXP4xx port and the device can provide incoming frame port
- * identification by tagging the TPID field in the Ethernet frame. Enabling
- * port extraction will instruct the NPE to copy the TPID field from the frame and
- * place it in the <i>ixp_ne_src_port</i> of the <i>ixp_buf</i> header. In addition,
- * the NPE restores the TPID field to 0.
- *
- * If the frame is not tagged the NPE will fill the <i>ixp_ne_src_port</i> with the
- * port ID of the MII interface the frame was received from.
- *
- * The TPID field is the least significant byte of the type/length field, which is
- * normally set to 0x8100 for 802.1Q-tagged frames.
- *
- * This feature is disabled by default.
- *
- * @param portID ID of the port to configure port ID extraction on
- * @param enable TRUE to enable port ID extraction and FALSE to disable it
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE VLAN/QoS feature is not available or not enabled for the port
- * @retval IX_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBVlanPortExtractionEnable(IxEthDBPortId portID, BOOL enable);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFeatureCapabilityGet(IxEthDBPortId portID, IxEthDBFeature *featureSet)
- *
- * @brief Retrieves the feature capability set for a port
- *
- * This function retrieves the feature capability set for a port or the common capabilities shared between all
- * the ports, writing the feature capability set in a user specified location.
- *
- * The feature capability set will consist of a set formed by OR-ing one or more of the following values:
- * - IX_ETH_DB_LEARNING - Learning feature; enables EthDB to learn MAC address (filtering) records, including 802.1Q enabled records
- * - IX_ETH_DB_FILTERING - Filtering feature; enables EthDB to communicate with the NPEs for downloading filtering information in the NPEs; depends on the learning feature
- * - IX_ETH_DB_VLAN_QOS - VLAN/QoS feature; enables EthDB to configure NPEs to operate in VLAN/QoS aware modes
- * - IX_ETH_DB_FIREWALL - Firewall feature; enables EthDB to configure NPEs to operate in firewall mode, using white/black address lists
- * - IX_ETH_DB_SPANNING_TREE_PROTOCOL - Spanning tree protocol feature; enables EthDB to configure the NPEs as STP nodes
- * - IX_ETH_DB_WIFI_HEADER_CONVERSION - WiFi 802.3 to 802.11 header conversion feature; enables EthDB to handle WiFi conversion data
- *
- * Note that EthDB provides only the LEARNING feature for non-NPE ports.
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to retrieve the capability set for
- * (use IX_ETH_DB_ALL_PORTS to retrieve the common capabilities shared between all the ports)
- * @param featureSet @ref IxEthDBFeature [out] - location where the capability set will be written to
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>featureSet</i> pointer
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFeatureCapabilityGet(IxEthDBPortId portID, IxEthDBFeature *featureSet);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFeatureEnable(IxEthDBPortId portID, IxEthDBFeature feature, BOOL enabled)
- *
- * @brief Enables or disables one or more EthDB features
- *
- * Selects one or more features (see @ref ixEthDBFeatureCapabilityGet for a description of the supported
- * features) to be enabled or disabled on the selected port (or all the ports).
- *
- * Note that some features are mutually incompatible:
- * - IX_ETH_DB_FILTERING is incompatible with IX_ETH_DB_WIFI_HEADER_CONVERSION
- *
- * Also note that some features require other features to be enabled:
- * - IX_ETH_DB_FILTERING requires IX_ETH_DB_LEARNING
- *
- * This function will either enable the entire selected feature set for the selected port (or all the ports),
- * in which case it will return IX_ETH_DB_SUCCESS, or in case of error it will not enable any feature at all
- * and return an appropriate error message.
- *
- * The following features are enabled by default (for ports with the respective capability),
- * for compatibility reasons with previous versions of CSR:
- * - IX_ETH_DB_LEARNING
- * - IX_ETH_DB_FILTERING
- *
- * All other features are disabled by default and require manual enabling using ixEthDBFeatureEnable.
- *
- * <b>Default settings for VLAN, QoS, Firewall and WiFi header conversion features:</b>
- *
- * <i>VLAN</i>
- *
- * When the VLAN/QoS feature is enabled for a port for the first time the default VLAN behavior
- * of the port is set to be as <b>permissive</b> (it will accept all the frames) and
- * <b>non-interferential</b> (it will not change any frames) as possible:
- * - the port VLAN ID (VID) is set to 0
- * - the Ingress acceptable frame filter is set to accept all frames
- * - the VLAN port membership is set to the complete VLAN range (0 - 4094)
- * - the Ingress tagging mode is set to pass-through (will not change frames)
- * - the Egress tagging mode is to send tagged frames in the entire VLAN range (0 - 4094)
- *
- * Note that further disabling and re-enabling the VLAN feature for a given port will not reset the port VLAN behavior
- * to the settings listed above. Any VLAN settings made by the user are kept.
- *
- * <i>QoS</i>
- *
- * The following default priority mapping table will be used (as per IEEE 802.1Q and IEEE 802.1D):
- *
- * <table border="1"> <caption> QoS traffic classes </caption>
- * <tr> <td> <b> QoS priority <td> <b> Default traffic class <td> <b> Traffic type </b>
- * <tr> <td> 0 <td> 1 <td> Best effort, default class for unexpedited traffic
- * <tr> <td> 1 <td> 0 <td> Background traffic
- * <tr> <td> 2 <td> 0 <td> Spare bandwidth
- * <tr> <td> 3 <td> 1 <td> Excellent effort
- * <tr> <td> 4 <td> 2 <td> Controlled load
- * <tr> <td> 5 <td> 2 <td> Video traffic
- * <tr> <td> 6 <td> 3 <td> Voice traffic
- * <tr> <td> 7 <td> 3 <td> Network control
- * </table>
- *
- * <i> Firewall </i>
- *
- * The port firewall is configured by default in <b>black-list mode</b>, and the firewall address table is empty.
- * This means the firewall will not filter any frames until the feature is configured and the firewall table is
- * downloaded to the NPE.
- *
- * <i> Spanning Tree </i>
- *
- * The port is set to <b>STP unblocked mode</b>, therefore it will accept all frames until re-configured.
- *
- * <i> WiFi header conversion </i>
- *
- * The WiFi header conversion database is empty, therefore no actual header conversion will take place until this
- * feature is configured and the conversion table downloaded to the NPE.
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port to enable or disable the features on (use IX_ETH_DB_ALL_PORTS for all the ports)
- * @param feature @ref IxEthDBFeature [in] - feature or feature set to enable or disable
- * @param enabled BOOL [in] - TRUE to enable the feature and FALSE to disable it
- *
- * @note Certain features, from a functional point of view, cannot be disabled as such at NPE level;
- * when such features are set to <i>disabled</i> using the EthDB API they will be configured in such
- * a way to determine a behavior equivalent to the feature being disabled. As well as this, disabled
- * features cannot be configured or accessed via the EthDB API (except for getting their status).
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_NO_PERMISSION attempted to enable mutually exclusive features,
- * or a feature that depends on another feature which is not present or enabled
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE at least one of the features selected is unavailable
- * @retval IX_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFeatureEnable(IxEthDBPortId portID, IxEthDBFeature feature, BOOL enabled);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFeatureStatusGet(IxEthDBPortId portID, IxEthDBFeature feature, BOOL *present, BOOL *enabled)
- *
- * @brief Retrieves the availability and status of a feature set
- *
- * This function returns the availability and status for a feature set.
- * Note that if more than one feature is selected (e.g. IX_ETH_DB_LEARNING | IX_ETH_DB_FILTERING)
- * the "present" and "enabled" return values will be set to TRUE only if all the features in the
- * feature set are present and enabled (not only some).
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param feature @ref IxEthDBFeature [in] - identifier of the feature to retrieve the status for
- * @param present BOOL [out] - location where a boolean flag indicating whether this feature is present will be written to
- * @param enabled BOOL [out] - location where a boolean flag indicating whether this feature is enabled will be written to
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG either <i>present</i> or <i>enabled</i> pointer argument is invalid
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFeatureStatusGet(IxEthDBPortId portID, IxEthDBFeature feature, BOOL *present, BOOL *enabled);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFeaturePropertyGet(IxEthDBPortId portID, IxEthDBFeature feature, IxEthDBProperty property, IxEthDBPropertyType *type, void *value)
- *
- * @brief Retrieves the value of a feature property
- *
- * The EthDB features usually contain feature-specific properties describing or
- * controlling how the feature operates. While essential properties (e.g. the
- * firewall operating mode) have their own API, secondary properties can be
- * retrieved using this function.
- *
- * Properties can be read-only or read-write. ixEthDBFeaturePropertyGet operates with
- * both types of features.
- *
- * Properties have types associated with them. A descriptor indicating the property
- * type is returned in the <i>type</i> argument for convenience.
- *
- * The currently supported properties and their corresponding features are as follows:
- *
- * <table border="1"> <caption> Properties for IX_ETH_DB_VLAN_QOS </caption>
- * <tr> <td> <b> Property identifier <td> <b> Property type <td> <b> Property value <td> <b> Read-Only </b>
- * <tr> <td> IX_ETH_DB_QOS_TRAFFIC_CLASS_COUNT_PROPERTY <td> IX_ETH_DB_INTEGER_PROPERTY <td> number of internal traffic classes <td> Yes
- * <tr> <td> IX_ETH_DB_QOS_TRAFFIC_CLASS_0_RX_QUEUE_PROPERTY <td> IX_ETH_DB_INTEGER_PROPERTY <td> queue assignment for traffic class 0 <td> Yes
- * <tr> <td> IX_ETH_DB_QOS_TRAFFIC_CLASS_1_RX_QUEUE_PROPERTY <td> IX_ETH_DB_INTEGER_PROPERTY <td> queue assignment for traffic class 1 <td> Yes
- * <tr> <td> IX_ETH_DB_QOS_TRAFFIC_CLASS_2_RX_QUEUE_PROPERTY <td> IX_ETH_DB_INTEGER_PROPERTY <td> queue assignment for traffic class 2 <td> Yes
- * <tr> <td> IX_ETH_DB_QOS_TRAFFIC_CLASS_3_RX_QUEUE_PROPERTY <td> IX_ETH_DB_INTEGER_PROPERTY <td> queue assignment for traffic class 3 <td> Yes
- * <tr> <td> IX_ETH_DB_QOS_TRAFFIC_CLASS_4_RX_QUEUE_PROPERTY <td> IX_ETH_DB_INTEGER_PROPERTY <td> queue assignment for traffic class 4 <td> Yes
- * <tr> <td> IX_ETH_DB_QOS_TRAFFIC_CLASS_5_RX_QUEUE_PROPERTY <td> IX_ETH_DB_INTEGER_PROPERTY <td> queue assignment for traffic class 5 <td> Yes
- * <tr> <td> IX_ETH_DB_QOS_TRAFFIC_CLASS_6_RX_QUEUE_PROPERTY <td> IX_ETH_DB_INTEGER_PROPERTY <td> queue assignment for traffic class 6 <td> Yes
- * <tr> <td> IX_ETH_DB_QOS_TRAFFIC_CLASS_7_RX_QUEUE_PROPERTY <td> IX_ETH_DB_INTEGER_PROPERTY <td> queue assignment for traffic class 7 <td> Yes
- * </table>
- *
- * @see ixEthDBFeaturePropertySet
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param feature @ref IxEthDBFeature [in] - EthDB feature for which the property is retrieved
- * @param property @ref IxEthDBProperty [in] - property identifier
- * @param type @ref IxEthDBPropertyType [out] - location where the property type will be stored
- * @param value void [out] - location where the property value will be stored
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_INVALID_ARG invalid property identifier, <i>type</i> or <i>value</i> pointer arguments
- * @retval IX_ETH_DB_FAIL incorrect property value or unknown error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFeaturePropertyGet(IxEthDBPortId portID, IxEthDBFeature feature, IxEthDBProperty property, IxEthDBPropertyType *type, void *value);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFeaturePropertySet(IxEthDBPortId portID, IxEthDBFeature feature, IxEthDBProperty property, void *value)
- *
- * @brief Sets the value of a feature property
- *
- * Unlike @ref ixEthDBFeaturePropertyGet, this function operates only with read-write properties
- *
- * The currently supported properties and their corresponding features are as follows:
- *
- * - IX_ETH_DB_QOS_QUEUE_CONFIGURATION_COMPLETE (for IX_ETH_DB_VLAN_QOS): freezes the availability of traffic classes
- * to the number of traffic classes currently in use
- *
- * Note that this function creates deep copies of the property values; once the function is invoked the client
- * can free or reuse the memory area containing the original property value.
- *
- * Copy behavior for different property types is defined as follows:
- *
- * - IX_ETH_DB_INTEGER_PROPERTY - 4 bytes are copied from the source location
- * - IX_ETH_DB_STRING_PROPERTY - the source string will be copied up to the NULL '\0' string terminator, maximum of 255 characters
- * - IX_ETH_DB_MAC_ADDR_PROPERTY - 6 bytes are copied from the source location
- * - IX_ETH_DB_BOOL_PROPERTY - 4 bytes are copied from the source location; the only allowed values are TRUE (1L) and false (0L)
- *
- * @see ixEthDBFeaturePropertySet
- *
- * @warning IX_ETH_DB_QOS_QUEUE_CONFIGURATION_COMPLETE is provided for EthAcc internal use;
- * do not attempt to set this property directly
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param feature @ref IxEthDBFeature [in] - EthDB feature for which the property is set
- * @param property @ref IxEthDBProperty [in] - property identifier
- * @param value void [in] - location where the property value is to be copied from
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_INVALID_ARG invalid property identifier, <i>value</i> pointer, or invalid property value
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFeaturePropertySet(IxEthDBPortId portID, IxEthDBFeature feature, IxEthDBProperty property, void *value);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBDatabaseClear(IxEthDBPortId portID, IxEthDBRecordType recordType)
- *
- * @brief Deletes a set of record types from the Ethernet Database
- *
- * This function deletes all the records of certain types (specified in the recordType filter)
- * associated with a port. Additionally, the IX_ETH_DB_ALL_PORTS value can be used as port ID
- * to indicate that the specified record types should be deleted for all the ports.
- *
- * The record type filter can be an ORed combination of the following types:
- *
- * <caption> Record types </caption>
- * - IX_ETH_DB_FILTERING_RECORD <table><caption> Filtering record </caption>
- * <tr><td> MAC address <td> static/dynamic type <td> age </tr>
- * </table>
- *
- * - IX_ETH_DB_FILTERING_VLAN_RECORD <table><caption> VLAN-enabled filtering record </caption>
- * <tr><td> MAC address <td> static/dynamic type <td> age <td> 802.1Q tag </tr>
- * </table>
- *
- * - IX_ETH_DB_WIFI_RECORD <table><caption> WiFi header conversion record </caption>
- * <tr><td> MAC address <td> optional gateway MAC address <td> </tr>
- * </table>
- *
- * - IX_ETH_DB_FIREWALL_RECORD <table><caption> Firewall record </caption>
- * <tr><td> MAC address </tr>
- * </table>
- * - IX_ETH_DB_ALL_RECORD_TYPES
- *
- * Any combination of the above types is valid e.g.
- *
- * (IX_ETH_DB_FILTERING_RECORD | IX_ETH_DB_FILTERING_VLAN_RECORD | IX_ETH_DB_FIREWALL_RECORD),
- *
- * although some might be redundant (it is not an error to do so) e.g.
- *
- * (IX_ETH_DB_FILTERING_RECORD | IX_ETH_DB_ALL_RECORD_TYPES)
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param recordType @ref IxEthDBRecordType [in] - record type filter
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>recordType</i> filter
- *
- * @note If the record type filter contains any unrecognized value (hence the
- * IX_ETH_DB_INVALID_ARG error value is returned) no actual records will be deleted.
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBDatabaseClear(IxEthDBPortId portID, IxEthDBRecordType recordType);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBWiFiStationEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
- *
- * @brief Adds an "Access Point to Station" record to the database, for 802.3 => 802.11 frame
- * header conversion
- *
- * Frame header conversion is controlled by the set of MAC addresses
- * added using @ref ixEthDBWiFiStationEntryAdd and @ref ixEthDBWiFiAccessPointEntryAdd.
- * Conversion arguments are added using @ref ixEthDBWiFiFrameControlSet,
- * @ref ixEthDBWiFiDurationIDSet and @ref ixEthDBWiFiBBSIDSet.
- *
- * Note that adding the same MAC address twice will not return an error
- * (but will not accomplish anything either), while re-adding a record previously added
- * as an "Access Point to Access Point" will migrate the record to the "Access Point
- * to Station" type.
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param macAddr @ref IxEthDBMacAddr [in] - MAC address to add
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_INVALID_ARG macAddr is an invalid pointer
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE WiFi feature not enabled
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> pointer argument
- * @retval IX_ETH_DB_NOMEM maximum number of records reached
- * @retval IX_ETH_DB_BUSY lock condition or transaction in progress, try again later
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiStationEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBWiFiAccessPointEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr, IxEthDBMacAddr *gatewayMacAddr)
- *
- * @brief Adds an "Access Point to Access Point" record to the database
- *
- * @see ixEthDBWiFiStationEntryAdd
- *
- * Note that adding the same MAC address twice will simply overwrite the previously
- * defined gateway MAC address value in the same record, if the record was previously of the
- * "Access Point to Access Point" type.
- *
- * Re-adding a MAC address as "Access Point to Access Point", which was previously added as
- * "Access Point to Station" will migrate the record type to "Access Point to Access Point" and
- * record the gateway MAC address.
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param macAddr @ref IxEthDBMacAddr [in] - MAC address to add
- * @param gatewayMacAddr @ref IxEthDBMacAddr [in] - MAC address of the gateway Access Point
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG macAddr is an invalid pointer
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE WiFi feature not enabled
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> or <i>gatewayMacAddr</i> pointer argument
- * @retval IX_ETH_DB_NOMEM maximum number of records reached
- * @retval IX_ETH_DB_BUSY lock condition or transaction in progress, try again later
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiAccessPointEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr, IxEthDBMacAddr *gatewayMacAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBWiFiEntryRemove(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
- *
- * @brief Removes a WiFi station record
- *
- * This function removes both types of WiFi records ("Access Point to Station" and
- * "Access Point to Access Point").
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param macAddr @ref IxEthDBMacAddr [in] - MAC address to remove
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port is not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> pointer argument
- * @retval IX_ETH_DB_NO_SUCH_ADDR specified address was not found in the database
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE WiFi feature not enabled
- * @retval IX_ETH_DB_BUSY lock condition or transaction in progress, try again later
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiEntryRemove(IxEthDBPortId portID, IxEthDBMacAddr *macAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBWiFiConversionTableDownload(IxEthDBPortId portID)
- *
- * @brief Downloads the MAC address table for 802.3 => 802.11 frame header
- * conversion to the NPE
- *
- * Note that the frame conversion MAC address table must be individually downloaded
- * to each NPE for which the frame header conversion feature is enabled (i.e. it
- * is not possible to specify IX_ETH_DB_ALL_PORTS).
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port not initialized
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE WiFi feature not enabled
- * @retval IX_ETH_DB_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiConversionTableDownload(IxEthDBPortId portID);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBWiFiFrameControlSet(IxEthDBPortId portID, UINT16 frameControl)
- *
- * @brief Sets the GlobalFrameControl field
- *
- * The GlobalFrameControl field is a 2-byte value inserted in the <i>Frame Control</i>
- * field for all 802.3 to 802.11 frame header conversions
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param frameControl UINT16 [in] - GlobalFrameControl value
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port not initialized
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE WiFi feature not enabled
- * @retval IX_ETH_DB_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiFrameControlSet(IxEthDBPortId portID, UINT16 frameControl);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBWiFiDurationIDSet(IxEthDBPortId portID, UINT16 durationID)
- *
- * @brief Sets the GlobalDurationID field
- *
- * The GlobalDurationID field is a 2-byte value inserted in the <i>Duration/ID</i>
- * field for all 802.3 to 802.11 frame header conversions
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param durationID UINT16 [in] - GlobalDurationID field
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port not initialized
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE WiFi feature not enabled
- * @retval IX_ETH_DB_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiDurationIDSet(IxEthDBPortId portID, UINT16 durationID);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBWiFiBBSIDSet(IxEthDBPortId portID, IxEthDBMacAddr *bbsid)
- *
- * @brief Sets the BBSID field
- *
- * The BBSID field is a 6-byte value which
- * identifies the infrastructure of the service set managed
- * by the Access Point having the IXP400 as its processor. The value
- * is written in the <i>BBSID</i> field of the 802.11 frame header.
- * The BBSID value is the MAC address of the Access Point.
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param bbsid @ref IxEthDBMacAddr [in] - pointer to 6 bytes containing the BSSID
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>bbsid</i> pointer argument
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE WiFi feature not enabled
- * @retval IX_ETH_DB_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBWiFiBBSIDSet(IxEthDBPortId portID, IxEthDBMacAddr *bbsid);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBSpanningTreeBlockingStateSet(IxEthDBPortId portID, BOOL blocked)
- *
- * @brief Sets the STP blocked/unblocked state for a port
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param blocked BOOL [in] - TRUE to set the port as STP blocked, FALSE to set it as unblocked
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port not initialized
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE Spanning Tree Protocol feature not enabled
- * @retval IX_ETH_DB_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBSpanningTreeBlockingStateSet(IxEthDBPortId portID, BOOL blocked);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBSpanningTreeBlockingStateGet(IxEthDBPortId portID, BOOL *blocked)
- *
- * @brief Retrieves the STP blocked/unblocked state for a port
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param blocked BOOL * [in] - set to TRUE if the port is STP blocked, FALSE otherwise
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>blocked</i> pointer argument
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE Spanning Tree Protocol feature not enabled
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBSpanningTreeBlockingStateGet(IxEthDBPortId portID, BOOL *blocked);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFirewallModeSet(IxEthDBPortId portID, IxEthDBFirewallMode mode)
- *
- * @brief Sets the firewall mode to use white or black listing
- *
- * When enabled, the NPE MAC address based firewall support operates in two modes:
- *
- * - white-list mode (MAC address based admission)
- * - <i>mode</i> set to IX_ETH_DB_FIREWALL_WHITE_LIST
- * - only packets originating from MAC addresses contained in the firewall address list
- * are allowed on the Rx path
- * - black-list mode (MAC address based blocking)
- * - <i>mode</i> set to IX_ETH_DB_FIREWALL_BLACK_LIST
- * - packets originating from MAC addresses contained in the firewall address list
- * are discarded
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param mode @ref IxEthDBFirewallMode [in] - firewall mode (IX_ETH_DB_FIREWALL_WHITE_LIST or IX_ETH_DB_FIREWALL_BLACK_LIST)
- *
- * @note by default the firewall operates in black-list mode with an empty address
- * list, hence it doesn't filter any packets
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port not initialized
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE Firewall feature not enabled
- * @retval IX_ETH_DB_INVALID_ARGUMENT <i>mode</i> argument is not a valid firewall configuration mode
- * @retval IX_ETH_DB_FAIL unknown OS or NPE communication error
-*/
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFirewallModeSet(IxEthDBPortId portID, IxEthDBFirewallMode mode);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn ixEthDBFirewallInvalidAddressFilterEnable(IxEthDBPortId portID, BOOL enable)
- *
- * @brief Enables or disables invalid MAC address filtering
- *
- * According to IEEE802 it is illegal for a source address to be a multicast
- * or broadcast address. If this feature is enabled the NPE inspects the source
- * MAC addresses of incoming frames and discards them if invalid addresses are
- * detected.
- *
- * By default this service is enabled, if the firewall feature is supported by the
- * NPE image.
- *
- * @param portID ID of the port
- * @param enable TRUE to enable invalid MAC address filtering and FALSE to disable it
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port not initialized
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE Firewall feature not enabled
- * @retval IX_ETH_DB_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFirewallInvalidAddressFilterEnable(IxEthDBPortId portID, BOOL enable);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFirewallEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
- *
- * @brief Adds a MAC address to the firewall address list
- *
- * Note that adding the same MAC address twice will not return an error
- * but will not actually accomplish anything.
- *
- * The firewall MAC address list has a limited number of entries; once
- * the maximum number of entries has been reached this function will failed
- * to add more addresses, returning IX_ETH_DB_NOMEM.
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param macAddr @ref IxEthDBMacAddr [in] - MAC address to be added
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> pointer argument
- * @retval IX_ETH_DB_NOMEM maximum number of records reached
- * @retval IX_ETH_DB_BUSY lock condition or transaction in progress, try again later
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE Firewall feature not enabled
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFirewallEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFirewallEntryRemove(IxEthDBPortId portID, IxEthDBMacAddr *macAddr)
- *
- * @brief Removes a MAC address from the firewall address list
- *
- * @param portID @ref IxEthDBPortId [in] - ID of the port
- * @param macAddr @ref IxEthDBMacAddr [in] - MAC address to be removed
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port not initialized
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> pointer argument
- * @retval IX_ETH_DB_NO_SUCH_ADDR address not found
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE Firewall feature not enabled
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFirewallEntryRemove(IxEthDBPortId portID, IxEthDBMacAddr *macAddr);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBFirewallTableDownload(IxEthDBPortId portID)
- *
- * @brief Downloads the MAC firewall table to a port
- *
- * @param portID ID of the port
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID is not a valid port identifier
- * @retval IX_ETH_DB_PORT_UNINITIALIZED port not initialized
- * @retval IX_ETH_DB_FEATURE_UNAVAILABLE Firewall feature not enabled
- * @retval IX_ETH_DB_FAIL unknown OS or NPE communication error
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBFirewallTableDownload(IxEthDBPortId portID);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBUserFieldSet(IxEthDBRecordType recordType, IxEthDBMacAddr *macAddr, IxEthDBPortId portID, IxEthDBVlanId vlanID, void *field)
- *
- * @brief Adds a user-defined field to a database record
- *
- * This function associates a user-defined field to a database record.
- * The user-defined field is passed as a <i>(void *)</i> parameter, hence it can be used
- * for any purpose (such as identifying a structure). Retrieving the user-defined field from
- * a record is done using @ref ixEthDBUserFieldGet. Note that EthDB never uses the user-defined
- * field for any internal operation and it is not aware of the significance of its contents. The
- * field is only stored as a pointer.
- *
- * The database record is identified using a combination of the given parameters, depending on the record type.
- * All the record types require the record MAC address.
- *
- * - IX_ETH_DB_FILTERING_RECORD requires only the MAC address
- * - IX_ETH_DB_VLAN_FILTERING_RECORD requires the MAC address and the VLAN ID
- * - IX_ETH_DB_WIFI_RECORD requires the MAC address and the portID
- * - IX_ETH_DB_FIREWALL_RECORD requires the MAC address and the portID
- *
- * Please note that if a parameter is not required it is completely ignored (it does not undergo parameter checking).
- * The user-defined field can be cleared using a <b>NULL</b> <i>field</i> parameter.
- *
- * @param recordType @ref IxEthDBRecordType [in] - type of record (can be IX_ETH_DB_FILTERING_RECORD,
- * IX_ETH_DB_FILTERING_VLAN_RECORD, IX_ETH_DB_WIFI_RECORD or IX_ETH_DB_FIREWALL_RECORD)
- * @param portID @ref IxEthDBPortId [in] - ID of the port (required only for WIFI and FIREWALL records)
- * @param macAddr @ref IxEthDBMacAddr * [in] - MAC address of the record
- * @param vlanID @ref IxEthDBVlanId [in] - VLAN ID of the record (required only for FILTERING_VLAN records)
- * @param field void * [in] - user defined field
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID was required but it is not a valid port identifier
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> pointer argument
- * @retval IX_ETH_DB_NO_SUCH_ADDR record not found
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBUserFieldSet(IxEthDBRecordType recordType, IxEthDBMacAddr *macAddr, IxEthDBPortId portID, IxEthDBVlanId vlanID, void *field);
-
-/**
- * @ingroup IxEthDB
- *
- * @fn IxEthDBStatus ixEthDBUserFieldGet(IxEthDBRecordType recordType, IxEthDBMacAddr *macAddr, IxEthDBPortId portID, IxEthDBVlanId vlanID, void **field)
- *
- * @brief Retrieves a user-defined field from a database record
- *
- * The database record is identified using a combination of the given parameters, depending on the record type.
- * All the record types require the record MAC address.
- *
- * - IX_ETH_DB_FILTERING_RECORD requires only the MAC address
- * - IX_ETH_DB_VLAN_FILTERING_RECORD requires the MAC address and the VLAN ID
- * - IX_ETH_DB_WIFI_RECORD requires the MAC address and the portID
- * - IX_ETH_DB_FIREWALL_RECORD requires the MAC address and the portID
- *
- * Please note that if a parameter is not required it is completely ignored (it does not undergo parameter checking).
- *
- * If no user-defined field was registered with the specified record then <b>NULL</b> will be written
- * at the location specified by <i>field</i>.
- *
- * @param recordType type of record (can be IX_ETH_DB_FILTERING_RECORD, IX_ETH_DB_FILTERING_VLAN_RECORD, IX_ETH_DB_WIFI_RECORD
- * or IX_ETH_DB_FIREWALL_RECORD)
- * @param portID ID of the port (required only for WIFI and FIREWALL records)
- * @param macAddr MAC address of the record
- * @param vlanID VLAN ID of the record (required only for FILTERING_VLAN records)
- * @param field location to write the user defined field into
- *
- * @retval IX_ETH_DB_SUCCESS operation completed successfully
- * @retval IX_ETH_DB_INVALID_PORT portID was required but it is not a valid port identifier
- * @retval IX_ETH_DB_INVALID_ARG invalid <i>macAddr</i> or <i>field</i> pointer arguments
- * @retval IX_ETH_DB_NO_SUCH_ADDR record not found
- */
-IX_ETH_DB_PUBLIC
-IxEthDBStatus ixEthDBUserFieldGet(IxEthDBRecordType recordType, IxEthDBMacAddr *macAddr, IxEthDBPortId portId, IxEthDBVlanId vlanID, void **field);
-
-/**
- * @}
- */
-
-#endif /* IxEthDB_H */
diff --git a/cpu/ixp/npe/include/IxEthDBLocks_p.h b/cpu/ixp/npe/include/IxEthDBLocks_p.h
deleted file mode 100644
index 1d8b24fdf6..0000000000
--- a/cpu/ixp/npe/include/IxEthDBLocks_p.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * @file IxEthAccDBLocks_p.h
- *
- * @brief Definition of transaction lock stacks and lock utility macros
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxEthAccDBLocks_p_H
-#define IxEthAccDBLocks_p_H
-
-#include "IxOsPrintf.h"
-
-/* Lock and lock stacks */
-typedef struct
-{
- IxOsalFastMutex* locks[MAX_LOCKS];
- UINT32 stackPointer, basePointer;
-} LockStack;
-
-#define TRY_LOCK(mutex) \
- { \
- if (ixOsalFastMutexTryLock(mutex) != IX_SUCCESS) \
- { \
- return IX_ETH_DB_BUSY; \
- } \
- }
-
-
-#define UNLOCK(mutex) { ixOsalFastMutexUnlock(mutex); }
-
-#define INIT_STACK(stack) \
- { \
- (stack)->basePointer = 0; \
- (stack)->stackPointer = 0; \
- }
-
-#define PUSH_LOCK(stack, lock) \
- { \
- if ((stack)->stackPointer == MAX_LOCKS) \
- { \
- ERROR_LOG("Ethernet DB: maximum number of elements in a lock stack has been exceeded on push, heavy chaining?\n"); \
- UNROLL_STACK(stack); \
- \
- return IX_ETH_DB_NOMEM; \
- } \
- \
- if (ixOsalFastMutexTryLock(lock) == IX_SUCCESS) \
- { \
- (stack)->locks[(stack)->stackPointer++] = (lock); \
- } \
- else \
- { \
- UNROLL_STACK(stack); \
- \
- return IX_ETH_DB_BUSY; \
- } \
- }
-
-#define POP_LOCK(stack) \
- { \
- ixOsalFastMutexUnlock((stack)->locks[--(stack)->stackPointer]); \
- }
-
-#define UNROLL_STACK(stack) \
- { \
- while ((stack)->stackPointer > (stack)->basePointer) \
- { \
- POP_LOCK(stack); \
- } \
- }
-
-#define SHIFT_STACK(stack) \
- { \
- if ((stack)->basePointer == MAX_LOCKS - 1) \
- { \
- ERROR_LOG("Ethernet DB: maximum number of elements in a lock stack has been exceeded on shift, heavy chaining?\n"); \
- UNROLL_STACK(stack); \
- \
- return IX_ETH_DB_BUSY; \
- } \
- \
- ixOsalFastMutexUnlock((stack)->locks[(stack)->basePointer++]); \
- }
-
-#endif /* IxEthAccDBLocks_p_H */
diff --git a/cpu/ixp/npe/include/IxEthDBLog_p.h b/cpu/ixp/npe/include/IxEthDBLog_p.h
deleted file mode 100644
index 1d6b0bb20d..0000000000
--- a/cpu/ixp/npe/include/IxEthDBLog_p.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/**
- * @file IxEthDBLog_p.h
- *
- * @brief definitions of log macros and log configuration
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include <IxOsal.h>
-
-#ifdef IX_UNIT_TEST
-#define NULL_PRINT_ROUTINE(format, arg...) /* nothing */
-#else
-#define NULL_PRINT_ROUTINE if(0) printf
-#endif
-
-/***************************************************
- * Globals *
- ***************************************************/
-/* safe to permanently leave these on */
-#define HAS_ERROR_LOG
-#define HAS_ERROR_IRQ_LOG
-#define HAS_WARNING_LOG
-
-/***************************************************
- * Log Configuration *
- ***************************************************/
-
-/* debug output can be turned on unless specifically
- declared as a non-debug build */
-#ifndef NDEBUG
-
-#undef HAS_EVENTS_TRACE
-#undef HAS_EVENTS_VERBOSE_TRACE
-
-#undef HAS_SUPPORT_TRACE
-#undef HAS_SUPPORT_VERBOSE_TRACE
-
-#undef HAS_NPE_TRACE
-#undef HAS_NPE_VERBOSE_TRACE
-#undef HAS_DUMP_NPE_TREE
-
-#undef HAS_UPDATE_TRACE
-#undef HAS_UPDATE_VERBOSE_TRACE
-
-#endif /* NDEBUG */
-
-
-/***************************************************
- * Log Macros *
- ***************************************************/
-
-/************** Globals ******************/
-
-#ifdef HAS_ERROR_LOG
-
- #define ERROR_LOG printf
-
-#else
-
- #define ERROR_LOG NULL_PRINT_ROUTINE
-
-#endif
-
-#ifdef HAS_ERROR_IRQ_LOG
-
- #define ERROR_IRQ_LOG(format, arg1, arg2, arg3, arg4, arg5, arg6) ixOsalLog(IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT, format, arg1, arg2, arg3, arg4, arg5, arg6)
-
-#else
-
- #define ERROR_IRQ_LOG(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */
-
-#endif
-
-#ifdef HAS_WARNING_LOG
-
- #define WARNING_LOG printf
-
-#else
-
- #define WARNING_LOG NULL_PRINT_ROUTINE
-
-#endif
-
-/************** Events *******************/
-
-#ifdef HAS_EVENTS_TRACE
-
- #define IX_ETH_DB_EVENTS_TRACE printf
- #define IX_ETH_DB_IRQ_EVENTS_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) ixOsalLog(IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, format, arg1, arg2, arg3, arg4, arg5, arg6)
-
- #ifdef HAS_EVENTS_VERBOSE_TRACE
-
- #define IX_ETH_DB_EVENTS_VERBOSE_TRACE printf
-
- #else
-
- #define IX_ETH_DB_EVENTS_VERBOSE_TRACE NULL_PRINT_ROUTINE
-
- #endif /* HAS_EVENTS_VERBOSE_TRACE */
-
-#else
-
- #define IX_ETH_DB_EVENTS_TRACE NULL_PRINT_ROUTINE
- #define IX_ETH_DB_EVENTS_VERBOSE_TRACE NULL_PRINT_ROUTINE
- #define IX_ETH_DB_IRQ_EVENTS_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */
-
-#endif /* HAS_EVENTS_TRACE */
-
-/************** Support *******************/
-
-#ifdef HAS_SUPPORT_TRACE
-
- #define IX_ETH_DB_SUPPORT_TRACE printf
- #define IX_ETH_DB_SUPPORT_IRQ_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) ixOsalLog(IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, format, arg1, arg2, arg3, arg4, arg5, arg6)
-
- #ifdef HAS_SUPPORT_VERBOSE_TRACE
-
- #define IX_ETH_DB_SUPPORT_VERBOSE_TRACE printf
-
- #else
-
- #define IX_ETH_DB_SUPPORT_VERBOSE_TRACE NULL_PRINT_ROUTINE
-
- #endif /* HAS_SUPPORT_VERBOSE_TRACE */
-
-#else
-
- #define IX_ETH_DB_SUPPORT_TRACE NULL_PRINT_ROUTINE
- #define IX_ETH_DB_SUPPORT_VERBOSE_TRACE NULL_PRINT_ROUTINE
- #define IX_ETH_DB_SUPPORT_IRQ_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */
-
-#endif /* HAS_SUPPORT_TRACE */
-
-/************** NPE Adaptor *******************/
-
-#ifdef HAS_NPE_TRACE
-
- #define IX_ETH_DB_NPE_TRACE printf
- #define IX_ETH_DB_NPE_IRQ_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) ixOsalLog(IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, format, arg1, arg2, arg3, arg4, arg5, arg6)
-
- #ifdef HAS_NPE_VERBOSE_TRACE
-
- #define IX_ETH_DB_NPE_VERBOSE_TRACE printf
-
- #else
-
- #define IX_ETH_DB_NPE_VERBOSE_TRACE NULL_PRINT_ROUTINE
-
- #endif /* HAS_NPE_VERBOSE_TRACE */
-
-#else
-
- #define IX_ETH_DB_NPE_TRACE NULL_PRINT_ROUTINE
- #define IX_ETH_DB_NPE_VERBOSE_TRACE NULL_PRINT_ROUTINE
- #define IX_ETH_DB_NPE_IRQ_TRACE(format, arg1, arg2, arg3, arg4, arg5, arg6) /* nothing */
-
-#endif /* HAS_NPE_TRACE */
-
-#ifdef HAS_DUMP_NPE_TREE
-
-#define IX_ETH_DB_NPE_DUMP_ELT(eltBaseAddress, eltSize) ixEthELTDumpTree(eltBaseAddress, eltSize)
-
-#else
-
-#define IX_ETH_DB_NPE_DUMP_ELT(eltBaseAddress, eltSize) /* nothing */
-
-#endif /* HAS_DUMP_NPE_TREE */
-
-/************** Port Update *******************/
-
-#ifdef HAS_UPDATE_TRACE
-
- #define IX_ETH_DB_UPDATE_TRACE printf
-
- #ifdef HAS_UPDATE_VERBOSE_TRACE
-
- #define IX_ETH_DB_UPDATE_VERBOSE_TRACE printf
-
- #else
-
- #define IX_ETH_DB_UPDATE_VERBOSE_TRACE NULL_PRINT_ROUTINE
-
- #endif
-
-#else /* HAS_UPDATE_VERBOSE_TRACE */
-
- #define IX_ETH_DB_UPDATE_TRACE NULL_PRINT_ROUTINE
- #define IX_ETH_DB_UPDATE_VERBOSE_TRACE NULL_PRINT_ROUTINE
-
-#endif /* HAS_UPDATE_TRACE */
diff --git a/cpu/ixp/npe/include/IxEthDBMessages_p.h b/cpu/ixp/npe/include/IxEthDBMessages_p.h
deleted file mode 100644
index ff18160c1f..0000000000
--- a/cpu/ixp/npe/include/IxEthDBMessages_p.h
+++ /dev/null
@@ -1,258 +0,0 @@
-/**
- * @file IxEthDBMessages_p.h
- *
- * @brief Definitions of NPE messages
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxEthDBMessages_p_H
-#define IxEthDBMessages_p_H
-
-#include <IxEthNpe.h>
-#include <IxOsCacheMMU.h>
-#include "IxEthDB_p.h"
-
-/* events watched by the Eth event processor */
-#define IX_ETH_DB_MIN_EVENT_ID (IX_ETHNPE_EDB_GETMACADDRESSDATABASE)
-#define IX_ETH_DB_MAX_EVENT_ID (IX_ETHNPE_PC_SETAPMACTABLE)
-
-/* macros to fill and extract data from NPE messages - place any endian conversions here */
-#define RESET_ELT_MESSAGE(message) { memset((void *) &(message), 0, sizeof((message))); }
-#define NPE_MSG_ID(msg) ((msg).data[0] >> 24)
-
-#define FILL_SETPORTVLANTABLEENTRY_MSG(message, portID, setOffset, vlanMembershipSet, ttiSet) \
- do { \
- message.data[0] = (IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY << 24) | (portID << 16) | (setOffset * 2); \
- message.data[1] = (vlanMembershipSet << 8) | ttiSet; \
- } while (0);
-
-#define FILL_SETPORTVLANTABLERANGE_MSG(message, portID, offset, length, zone) \
- do { \
- message.data[0] = IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE << 24 | portID << 16 | offset << 9 | length << 1; \
- message.data[1] = (UINT32) zone; \
- } while (0);
-
-#define FILL_SETDEFAULTRXVID_MSG(message, portID, tpid, vlanTag) \
- do { \
- message.data[0] = (IX_ETHNPE_VLAN_SETDEFAULTRXVID << 24) \
- | (portID << 16); \
- \
- message.data[1] = (tpid << 16) | vlanTag; \
- } while (0);
-
-#define FILL_SETRXTAGMODE_MSG(message, portID, filterMode, tagMode) \
- do { \
- message.data[0] = IX_ETHNPE_VLAN_SETRXTAGMODE << 24 \
- | portID << 16 \
- | filterMode << 2 \
- | tagMode; \
- \
- message.data[1] = 0; \
- } while (0);
-
-#define FILL_SETRXQOSENTRY(message, portID, classIndex, trafficClass, aqmQueue) \
- do { \
- message.data[0] = IX_ETHNPE_VLAN_SETRXQOSENTRY << 24 \
- | portID << 16 \
- | classIndex; \
- \
- message.data[1] = trafficClass << 24 \
- | 0x1 << 23 \
- | aqmQueue << 16 \
- | aqmQueue << 4; \
- } while (0);
-
-#define FILL_SETPORTIDEXTRACTIONMODE(message, portID, enable) \
- do { \
- message.data[0] = IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE << 24 \
- | portID << 16 \
- | (enable ? 0x1 : 0x0); \
- \
- message.data[1] = 0; \
- } while (0);
-
-
-#define FILL_SETBLOCKINGSTATE_MSG(message, portID, blocked) \
- do { \
- message.data[0] = IX_ETHNPE_STP_SETBLOCKINGSTATE << 24 \
- | portID << 16 \
- | (blocked ? 0x1 : 0x0); \
- \
- message.data[1] = 0; \
- } while (0);
-
-#define FILL_SETBBSID_MSG(message, portID, bbsid) \
- do { \
- message.data[0] = IX_ETHNPE_PC_SETBBSID << 24 \
- | portID << 16 \
- | bbsid->macAddress[0] << 8 \
- | bbsid->macAddress[1]; \
- \
- message.data[1] = bbsid->macAddress[2] << 24 \
- | bbsid->macAddress[3] << 16 \
- | bbsid->macAddress[4] << 8 \
- | bbsid->macAddress[5]; \
- } while (0);
-
-#define FILL_SETFRAMECONTROLDURATIONID(message, portID, frameControlDurationID) \
- do { \
- message.data[0] = (IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID << 24) | (portID << 16); \
- message.data[1] = frameControlDurationID; \
- } while (0);
-
-#define FILL_SETAPMACTABLE_MSG(message, zone) \
- do { \
- message.data[0] = IX_ETHNPE_PC_SETAPMACTABLE << 24 \
- | 0 << 8 /* always use index 0 */ \
- | 64; /* 32 entries, 8 bytes each, 4 bytes in a word */ \
- message.data[1] = (UINT32) zone; \
- } while (0);
-
-#define FILL_SETFIREWALLMODE_MSG(message, portID, epDelta, mode, address) \
- do { \
- message.data[0] = IX_ETHNPE_FW_SETFIREWALLMODE << 24 \
- | portID << 16 \
- | (epDelta & 0xFF) << 8 \
- | mode; \
- \
- message.data[1] = (UINT32) address; \
- } while (0);
-
-#define FILL_SETMACADDRESSDATABASE_MSG(message, portID, epDelta, blockCount, address) \
- do { \
- message.data[0] = IX_ETHNPE_EDB_SETMACADDRESSSDATABASE << 24 \
- | (epDelta & 0xFF) << 8 \
- | (blockCount & 0xFF); \
- \
- message.data[1] = (UINT32) address; \
- } while (0);
-
-#define FILL_GETMACADDRESSDATABASE(message, npeId, zone) \
- do { \
- message.data[0] = IX_ETHNPE_EDB_GETMACADDRESSDATABASE << 24; \
- message.data[1] = (UINT32) zone; \
- } while (0);
-
-#define FILL_SETMAXFRAMELENGTHS_MSG(message, portID, maxRxFrameSize, maxTxFrameSize) \
- do { \
- message.data[0] = IX_ETHNPE_SETMAXFRAMELENGTHS << 24 \
- | portID << 16 \
- | ((maxRxFrameSize + 63) / 64) << 8 /* max Rx 64-byte blocks */ \
- | (maxTxFrameSize + 63) / 64; /* max Tx 64-byte blocks */ \
- \
- message.data[1] = maxRxFrameSize << 16 | maxTxFrameSize; \
- } while (0);
-
-#define FILL_SETPORTADDRESS_MSG(message, portID, macAddress) \
- do { \
- message.data[0] = IX_ETHNPE_EDB_SETPORTADDRESS << 24 \
- | portID << 16 \
- | macAddress[0] << 8 \
- | macAddress[1]; \
- \
- message.data[1] = macAddress[2] << 24 \
- | macAddress[3] << 16 \
- | macAddress[4] << 8 \
- | macAddress[5]; \
- } while (0);
-
-/* access to a MAC node in the NPE tree */
-#define NPE_NODE_BYTE(eltNodeAddr, offset) (((UINT8 *) (eltNodeAddr))[offset])
-
-/* browsing of the implicit linear binary tree structure of the NPE tree */
-#define LEFT_CHILD_OFFSET(offset) ((offset) << 1)
-#define RIGHT_CHILD_OFFSET(offset) (((offset) << 1) + 1)
-
-#define IX_EDB_FLAGS_ACTIVE (0x2)
-#define IX_EDB_FLAGS_VALID (0x1)
-#define IX_EDB_FLAGS_RESERVED (0xfc)
-#define IX_EDB_FLAGS_INACTIVE_VALID (0x1)
-
-#define IX_EDB_NPE_NODE_ELT_PORT_ID_OFFSET (6)
-#define IX_EDB_NPE_NODE_ELT_FLAGS_OFFSET (7)
-#define IX_EDB_NPE_NODE_WIFI_INDEX_OFFSET (6)
-#define IX_EDB_NPE_NODE_WIFI_FLAGS_OFFSET (7)
-#define IX_EDB_NPE_NODE_FW_FLAGS_OFFSET (1)
-#define IX_EDB_NPE_NODE_FW_RESERVED_OFFSET (6)
-#define IX_EDB_NPE_NODE_FW_ADDR_OFFSET (2)
-
-#define IX_EDB_NPE_NODE_VALID(address) ((NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_ELT_FLAGS_OFFSET) & IX_EDB_FLAGS_VALID) != 0)
-#define IX_EDB_NPE_NODE_ACTIVE(address) ((NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_ELT_FLAGS_OFFSET) & IX_EDB_FLAGS_ACTIVE) != 0)
-#define IX_EDB_NPE_NODE_PORT_ID(address) (NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_ELT_PORT_ID_OFFSET))
-
-/* macros to send messages to the NPEs */
-#define IX_ETHDB_ASYNC_SEND_NPE_MSG(npeId, msg, result) \
- do { \
- result = ixNpeMhMessageSend(npeId, msg, IX_NPEMH_SEND_RETRIES_DEFAULT); \
- \
- if (result != IX_SUCCESS) \
- { \
- ERROR_LOG("DB: Failed to send NPE message\n"); \
- } \
- } while (0);
-
-#define IX_ETHDB_SYNC_SEND_NPE_MSG(npeId, msg, result) \
- do { \
- result = ixNpeMhMessageWithResponseSend(npeId, msg, msg.data[0] >> 24, ixEthDBNpeMsgAck, IX_NPEMH_SEND_RETRIES_DEFAULT); \
- \
- if (result == IX_SUCCESS) \
- { \
- result = ixOsalMutexLock(&ixEthDBPortInfo[IX_ETH_DB_NPE_TO_PORT_ID(npeId)].npeAckLock, IX_ETH_DB_NPE_TIMEOUT); \
- \
- if (result != IX_SUCCESS) \
- { \
- ERROR_LOG("DB: NPE failed to respond within %dms\n", IX_ETH_DB_NPE_TIMEOUT); \
- } \
- } \
- else \
- { \
- ERROR_LOG("DB: Failed to send NPE message\n"); \
- } \
- } while (0);
-
-#ifndef IX_NDEBUG
-#define IX_ETH_DB_NPE_MSG_HISTORY_DEPTH (100)
-extern IX_ETH_DB_PUBLIC UINT32 npeMsgHistory[IX_ETH_DB_NPE_MSG_HISTORY_DEPTH][2];
-extern IX_ETH_DB_PUBLIC UINT32 npeMsgHistoryLen;
-#endif
-
-#define IX_ETHDB_SEND_NPE_MSG(npeId, msg, result) { LOG_NPE_MSG(msg); IX_ETHDB_SYNC_SEND_NPE_MSG(npeId, msg, result); }
-
-#endif /* IxEthDBMessages_p_H */
diff --git a/cpu/ixp/npe/include/IxEthDBPortDefs.h b/cpu/ixp/npe/include/IxEthDBPortDefs.h
deleted file mode 100644
index c3acbdddef..0000000000
--- a/cpu/ixp/npe/include/IxEthDBPortDefs.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- * @file IxEthDBPortDefs.h
- *
- * @brief Public definition of the ports and port capabilities
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxEthDBPortDefs IXP400 Ethernet Database Port Definitions (IxEthDBPortDefs)
- *
- * @brief IXP400 Public definition of the ports and port capabilities
- *
- * @{
- */
-
-#ifndef IxEthDBPortDefs_H
-#define IxEthDBPortDefs_H
-
-/**
- * @brief Port types - currently only Ethernet NPEs are recognized as specific types
- * All other (user-defined) ports must be specified as IX_ETH_GENERIC
- */
-typedef enum
-{
- IX_ETH_GENERIC = 0, /**< generic ethernet port */
- IX_ETH_NPE /**< specific Ethernet NPE */
-} IxEthDBPortType;
-
-/**
- * @brief Port capabilities - used by ixEthAccDatabaseMaintenance to decide whether it
- * should manually age entries or not depending on the port capabilities.
- *
- * Ethernet NPEs have aging capabilities, meaning that they will age the entries
- * automatically (by themselves).*/
-typedef enum
-{
- IX_ETH_NO_CAPABILITIES = 0, /**< no aging capabilities */
- IX_ETH_ENTRY_AGING = 0x1 /**< aging capabilities present */
-} IxEthDBPortCapability;
-
-/**
- * @brief Port Definition - a structure contains the Port type and capabilities
- */
-typedef struct
-{
- IxEthDBPortType type;
- IxEthDBPortCapability capabilities;
-} IxEthDBPortDefinition;
-
-/**
- * @brief Port definitions structure, indexed on the port ID
- * @warning Ports 0 and 1 are used by the Ethernet access component therefore
- * it is essential to be left untouched. Port 2 here (WAN) is given as
- * an example port. The NPE firmware also assumes the NPE B to be
- * the port 0 and NPE C to be the port 1.
- *
- * @note that only 32 ports (0..31) are supported by EthDB
- */
-static const IxEthDBPortDefinition ixEthDBPortDefinitions[] =
-{
- /* id type capabilities */
- { /* 0 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE B */
- { /* 1 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE C */
- { /* 2 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE A */
- { /* 3 */ IX_ETH_GENERIC, IX_ETH_NO_CAPABILITIES }, /* WAN port */
-};
-
-/**
- * @def IX_ETH_DB_NUMBER_OF_PORTS
- * @brief number of supported ports
- */
-#define IX_ETH_DB_NUMBER_OF_PORTS (sizeof (ixEthDBPortDefinitions) / sizeof (ixEthDBPortDefinitions[0]))
-
-/**
- * @def IX_ETH_DB_UNKNOWN_PORT
- * @brief definition of an unknown port
- */
-#define IX_ETH_DB_UNKNOWN_PORT (0xff)
-
-/**
- * @def IX_ETH_DB_ALL_PORTS
- * @brief Special port ID indicating all the ports
- * @note This port ID can be used only by a subset of the EthDB API; each
- * function specifically mentions whether this is a valid parameter as the port ID
- */
-#define IX_ETH_DB_ALL_PORTS (IX_ETH_DB_NUMBER_OF_PORTS + 1)
-
-/**
- * @def IX_ETH_DB_PORTS_ASSERTION
- * @brief catch invalid port definitions (<2) with a
- * compile-time assertion resulting in a duplicate case error.
- */
-#define IX_ETH_DB_PORTS_ASSERTION { switch(0) { case 0 : ; case 1 : ; case IX_ETH_DB_NUMBER_OF_PORTS : ; }}
-
-/**
- * @def IX_ETH_DB_CHECK_PORT(portID)
- * @brief safety checks to verify whether the port is invalid or uninitialized
- */
-#define IX_ETH_DB_CHECK_PORT(portID) \
-{ \
- if ((portID) >= IX_ETH_DB_NUMBER_OF_PORTS) \
- { \
- return IX_ETH_DB_INVALID_PORT; \
- } \
- \
- if (!ixEthDBPortInfo[(portID)].enabled) \
- { \
- return IX_ETH_DB_PORT_UNINITIALIZED; \
- } \
-}
-
-/**
- * @def IX_ETH_DB_CHECK_PORT_ALL(portID)
- * @brief safety checks to verify whether the port is invalid or uninitialized;
- * tolerates the use of IX_ETH_DB_ALL_PORTS
- */
-#define IX_ETH_DB_CHECK_PORT_ALL(portID) \
-{ \
- if ((portID) != IX_ETH_DB_ALL_PORTS) \
- IX_ETH_DB_CHECK_PORT(portID) \
-}
-
-#endif /* IxEthDBPortDefs_H */
-/**
- *@}
- */
diff --git a/cpu/ixp/npe/include/IxEthDBQoS.h b/cpu/ixp/npe/include/IxEthDBQoS.h
deleted file mode 100644
index 6d34889452..0000000000
--- a/cpu/ixp/npe/include/IxEthDBQoS.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * @file IxEthDBQoS.h
- *
- * @brief Public definitions for QoS traffic classes
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxEthDBPortDefs IXP400 Ethernet QoS definitions
- *
- * @brief IXP00 Public definitions for QoS traffic classes
- *
- * @{
- */
-
-#ifndef IxEthDBQoS_H
-#define IxEthDBQoS_H
-
-/**
- * @def IX_ETH_DB_QUEUE_UNAVAILABLE
- * @brief alias to indicate a queue (traffic class) is not available
- */
-#define IX_ETH_DB_QUEUE_UNAVAILABLE (0)
-
-#ifndef IX_IEEE802_1Q_QOS_PRIORITY_COUNT
-/**
- * @def IX_IEEE802_1Q_QOS_PRIORITY_COUNT
- * @brief number of QoS priorities, according to IEEE 802.1Q
- */
-#define IX_IEEE802_1Q_QOS_PRIORITY_COUNT (8)
-#endif
-
-/**
- * @brief array containing all the supported traffic class configurations
- */
-static const
-UINT8 ixEthDBQueueAssignments[][IX_IEEE802_1Q_QOS_PRIORITY_COUNT] =
-{
- { 4, 5, 6, 7, IX_ETH_DB_QUEUE_UNAVAILABLE, IX_ETH_DB_QUEUE_UNAVAILABLE, IX_ETH_DB_QUEUE_UNAVAILABLE, IX_ETH_DB_QUEUE_UNAVAILABLE },
- { 15, 16, 17, 18, IX_ETH_DB_QUEUE_UNAVAILABLE, IX_ETH_DB_QUEUE_UNAVAILABLE, IX_ETH_DB_QUEUE_UNAVAILABLE, IX_ETH_DB_QUEUE_UNAVAILABLE },
- { 11, 23, 26, IX_ETH_DB_QUEUE_UNAVAILABLE, IX_ETH_DB_QUEUE_UNAVAILABLE, IX_ETH_DB_QUEUE_UNAVAILABLE, IX_ETH_DB_QUEUE_UNAVAILABLE, IX_ETH_DB_QUEUE_UNAVAILABLE },
- { 4, 5, 6, 7, 8, 9, 10, 11 }
- /* add here all other cases of queue configuration structures and update ixEthDBTrafficClassDefinitions to use them */
-};
-
-/**
- * @brief value used to index the NPE A functionality ID in the traffic class definition table
- */
-#define IX_ETH_DB_NPE_A_FUNCTIONALITY_ID_INDEX (0)
-
-/**
- * @brief value used to index the traffic class count in the traffic class definition table
- */
-#define IX_ETH_DB_TRAFFIC_CLASS_COUNT_INDEX (1)
-
-/**
- * @brief value used to index the queue assignment index in the traffic class definition table
- */
-#define IX_ETH_DB_QUEUE_ASSIGNMENT_INDEX (2)
-
-/**
- * @brief traffic class definitions
- *
- * This array contains the default traffic class definition configuration,
- * as well as any special cases dictated by the functionality ID of NPE A.
- *
- * The default case should not be removed (otherwise the Ethernet
- * components will assert a fatal failure on initialization).
- */
-static const
-UINT8 ixEthDBTrafficClassDefinitions[][3] =
-{
- /* NPE A functionality ID | traffic class count | queue assignment index (points to the queue enumeration in ixEthDBQueueAssignments) */
- { 0x00, 4, 0 }, /* default case - DO NOT REMOVE */
- { 0x04, 4, 1 }, /* NPE A image ID 0.4.0.0 */
- { 0x09, 3, 2 }, /* NPE A image ID 0.9.0.0 */
- { 0x80, 8, 3 }, /* NPE A image ID 10.80.02.0 */
- { 0x81, 8, 3 }, /* NPE A image ID 10.81.02.0 */
- { 0x82, 8, 3 } /* NPE A image ID 10.82.02.0 */
-};
-
-/**
- * @brief IEEE 802.1Q recommended QoS Priority => traffic class maps
- *
- * @verbatim
- Number of available traffic classes
- 1 2 3 4 5 6 7 8
- QoS Priority
- 0 0 0 0 1 1 1 1 2
- 1 0 0 0 0 0 0 0 0
- 2 0 0 0 0 0 0 0 1
- 3 0 0 0 1 1 2 2 3
- 4 0 1 1 2 2 3 3 4
- 5 0 1 1 2 3 4 4 5
- 6 0 1 2 3 4 5 5 6
- 7 0 1 2 3 4 5 6 7
-
- @endverbatim
- */
-static const
-UINT8 ixEthIEEE802_1QUserPriorityToTrafficClassMapping[IX_IEEE802_1Q_QOS_PRIORITY_COUNT][IX_IEEE802_1Q_QOS_PRIORITY_COUNT] =
- {
- { 0, 0, 0, 0, 0, 0, 0, 0 }, /* 1 traffic class available */
- { 0, 0, 0, 0, 1, 1, 1, 1 }, /* 2 traffic classes available */
- { 0, 0, 0, 0, 1, 1, 2, 2 }, /* 3 traffic classes available */
- { 1, 0, 0, 1, 2, 2, 3, 3 }, /* 4 traffic classes available */
- { 1, 0, 0, 1, 2, 3, 4, 4 }, /* 5 traffic classes available */
- { 1, 0, 0, 2, 3, 4, 5, 5 }, /* 6 traffic classes available */
- { 1, 0, 0, 2, 3, 4, 5, 6 }, /* 7 traffic classes available */
- { 2, 0, 1, 3, 4, 5, 6, 7 } /* 8 traffic classes available */
- };
-
-#endif /* IxEthDBQoS_H */
-
-/**
- *@}
- */
diff --git a/cpu/ixp/npe/include/IxEthDB_p.h b/cpu/ixp/npe/include/IxEthDB_p.h
deleted file mode 100644
index e7c67ae520..0000000000
--- a/cpu/ixp/npe/include/IxEthDB_p.h
+++ /dev/null
@@ -1,712 +0,0 @@
-/**
- * @file IxEthDB_p.h
- *
- * @brief Private MAC learning API
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxEthDB_p_H
-#define IxEthDB_p_H
-
-#include <IxTypes.h>
-#include <IxOsal.h>
-#include <IxEthDB.h>
-#include <IxNpeMh.h>
-#include <IxEthDBPortDefs.h>
-
-#include "IxEthDBMessages_p.h"
-#include "IxEthDBLog_p.h"
-
-#if (CPU==SIMSPARCSOLARIS)
-
-/* when running unit tests intLock() won't protect the event queue so we lock it manually */
-#define TEST_FIXTURE_LOCK_EVENT_QUEUE { ixOsalMutexLock(&eventQueueLock, IX_OSAL_WAIT_FOREVER); }
-#define TEST_FIXTURE_UNLOCK_EVENT_QUEUE { ixOsalMutexUnlock(&eventQueueLock); }
-
-#else
-
-#define TEST_FIXTURE_LOCK_EVENT_QUEUE /* nothing */
-#define TEST_FIXTURE_UNLOCK_EVENT_QUEUE /* nothing */
-
-#endif /* #if(CPU==SIMSPARCSOLARIS) */
-
-#ifndef IX_UNIT_TEST
-
-#define TEST_FIXTURE_INCREMENT_DB_CORE_ACCESS_COUNTER /* nothing */
-#define TEST_FIXTURE_MARK_OVERFLOW_EVENT /* nothing */
-
-#else
-
-extern int dbAccessCounter;
-extern int overflowEvent;
-
-#define TEST_FIXTURE_INCREMENT_DB_CORE_ACCESS_COUNTER { dbAccessCounter++; }
-#define TEST_FIXTURE_MARK_OVERFLOW_EVENT { overflowEvent = 1; }
-
-#endif
-
-/* code readability markers */
-#define __mempool__ /* memory pool marker */
-#define __lock__ /* hash write locking marker */
-#define __smartpointer__ /* smart pointer marker - warning: use only clone() when duplicating! */
-#define __alignment__ /* marker for data used only as alignment zones */
-
-/* constants */
-#define IX_ETH_DB_NPE_TIMEOUT (100) /* NPE response timeout, in ms */
-
-/**
- * number of hash table buckets
- * it should be at least 8x the predicted number of entries for performance
- * each bucket needs 8 bytes
- */
-#define NUM_BUCKETS (8192)
-
-/**
- * number of hash table buckets to preload when incrementing bucket iterator
- * = two cache lines
- */
-#define IX_ETHDB_CACHE_LINE_AHEAD (2)
-
-#define IX_ETHDB_BUCKETPTR_AHEAD ((IX_ETHDB_CACHE_LINE_AHEAD * IX_OSAL_CACHE_LINE_SIZE)/sizeof(void *))
-
-#define IX_ETHDB_BUCKET_INDEX_MASK (((IX_OSAL_CACHE_LINE_SIZE)/sizeof(void *)) - 1)
-
-/* locks */
-#define MAX_LOCKS (20) /**< maximum number of locks used simultaneously, do not tamper with */
-
-/* learning tree constants */
-#define INITIAL_ELT_SIZE (8) /**< initial byte size of tree (empty unused root size) */
-#define MAX_ELT_SIZE (512) /**< maximum number of entries (includes unused root) */
-#define MAX_GW_SIZE (32) /**< maximum number of gateway entries (including unused root) */
-#define MAX_FW_SIZE (32) /**< maximum number of firewall entries (including unused root) */
-#define ELT_ENTRY_SIZE (8) /**< entry size, in bytes */
-#define ELT_ROOT_OFFSET (ELT_ENTRY_SIZE) /**< tree root offset, in bytes - node preceeding root is unused */
-#define FULL_ELT_BYTE_SIZE (MAX_ELT_SIZE * ELT_ENTRY_SIZE) /**< full size of tree, in bytes, including unused root */
-#define FULL_GW_BYTE_SIZE (MAX_GW_SIZE * ELT_ENTRY_SIZE) /**< full size of gateway list, in bytes, including unused root */
-#define FULL_FW_BYTE_SIZE (MAX_FW_SIZE * ELT_ENTRY_SIZE) /**< full size of firewall table, in bytes, including unused root */
-
-/* maximum size of the VLAN table:
- * 4096 bits (one per VLAN)
- * 8 bits in one byte
- * interleaved VLAN membership and VLAN TTI (*2) */
-#define FULL_VLAN_BYTE_SIZE (4096 / 8 * 2)
-
-/* upper 9 bits used as set index, lower 3 bits as byte index */
-#define VLAN_SET_OFFSET(vlanID) ((vlanID) >> 3)
-#define VLAN_SET_MASK(vlanID) (0x7 - ((vlanID) & 0x7))
-
-/* Update zone definitions */
-#define NPE_TREE_MEM_SIZE (4096) /* ((511 entries + 1 unused root) * 8 bytes/entry) */
-
-/* check the above value, we rely on 4k */
-#if NPE_TREE_MEM_SIZE != 4096
- #error NPE_TREE_MEM_SIZE is not defined to 4096 bytes!
-#endif
-
-/* Size Filtering limits (Jumbo frame filtering) */
-#define IX_ETHDB_MAX_FRAME_SIZE 65535 /* other ports than NPE ports */
-#define IX_ETHDB_MIN_FRAME_SIZE 1 /* other ports than NPE ports */
-#define IX_ETHDB_MAX_NPE_FRAME_SIZE 16320 /* NPE ports firmware limit */
-#define IX_ETHDB_MIN_NPE_FRAME_SIZE 1 /* NPE ports firmware limit */
-#define IX_ETHDB_DEFAULT_FRAME_SIZE 1522
-
-/* memory management pool sizes */
-
-/*
- * Note:
- *
- * NODE_POOL_SIZE controls the maximum number of elements in the database at any one time.
- * It should be large enough to cover all the search trees of all the ports simultaneously.
- *
- * MAC_POOL_SIZE should be higher than NODE_POOL_SIZE by at least the total number of MAC addresses
- * possible to be held at any time in all the ports.
- *
- * TREE_POOL_SIZE should follow the same guideline as for MAC_POOL_SIZE.
- *
- * The database structure described here (2000/4000/4000) is enough for two NPEs holding at most 511
- * entries each plus one PCI NIC holding at most 900 entries.
- */
-
-#define NODE_POOL_SIZE (2000) /**< number of HashNode objects - also master number of elements in the database; each entry has 16 bytes */
-#define MAC_POOL_SIZE (4000) /**< number of MacDescriptor objects; each entry has 28 bytes */
-#define TREE_POOL_SIZE (4000) /**< number of MacTreeNode objects; each entry has 16 bytes */
-
-/* retry policies */
-#define BUSY_RETRY_ENABLED (TRUE) /**< if set to TRUE the API will retry automatically calls returning BUSY */
-#define FOREVER_RETRY (TRUE) /**< if set to TRUE the API will retry forever BUSY calls */
-#define MAX_RETRIES (400) /**< upper retry limit - used only when FOREVER_RETRY is FALSE */
-#define BUSY_RETRY_YIELD (5) /**< ticks to yield for every failed retry */
-
-/* event management */
-#define EVENT_QUEUE_SIZE (500) /**< size of the sink collecting events from the Message Handler FIFO */
-#define EVENT_PROCESSING_LIMIT (100) /**< batch processing control size (how many events are extracted from the queue at once) */
-
-/* MAC descriptors */
-#define STATIC_ENTRY (TRUE)
-#define DYNAMIC_ENTRY (FALSE)
-
-/* age reset on next maintenance - incrementing by 1 will reset to 0 */
-#define AGE_RESET (0xFFFFFFFF)
-
-/* dependency maps */
-#define EMPTY_DEPENDENCY_MAP (0)
-
-/* trees */
-#define RIGHT (1)
-#define LEFT (-1)
-
-/* macros */
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
-#define IX_ETH_DB_CHECK_PORT_EXISTS(portID) \
-{ \
- if ((portID) >= IX_ETH_DB_NUMBER_OF_PORTS) \
- { \
- return IX_ETH_DB_INVALID_PORT; \
- } \
-}
-
-#define IX_ETH_DB_CHECK_PORT_INITIALIZED(portID) \
-{ \
- if ((portID) >= IX_ETH_DB_NUMBER_OF_PORTS) \
- { \
- return IX_ETH_DB_INVALID_PORT; \
- } \
- else \
- { \
- if (!ixEthDBPortInfo[portID].initialized) \
- { \
- return IX_ETH_DB_PORT_UNINITIALIZED; \
- } \
- } \
-}
-
-/* single NPE check */
-#define IX_ETH_DB_CHECK_SINGLE_NPE(portID) \
- if (ixEthDBSingleEthNpeCheck(portID) != IX_ETH_DB_SUCCESS) \
- { \
- WARNING_LOG("EthDB: port ID %d is unavailable\n",(UINT32) portID); \
- \
- return IX_ETH_DB_INVALID_PORT; \
- }
-
-/* feature check */
-#define IX_ETH_DB_CHECK_FEATURE(portID, feature) \
- if ((ixEthDBPortInfo[portID].featureStatus & feature) == 0) \
- { \
- return IX_ETH_DB_FEATURE_UNAVAILABLE; \
- }
-
-/* busy retrying */
-#define BUSY_RETRY(functionCall) \
- { \
- UINT32 retries = 0; \
- IxEthDBStatus br_result; \
- \
- while ((br_result = functionCall) == IX_ETH_DB_BUSY \
- && BUSY_RETRY_ENABLED && (FOREVER_RETRY || ++retries < MAX_RETRIES)) { ixOsalSleep(BUSY_RETRY_YIELD); }; \
- \
- if ((!FOREVER_RETRY && retries == MAX_RETRIES) || (br_result == IX_ETH_DB_FAIL)) \
- {\
- ERROR_LOG("Ethernet Learning Database Error: BUSY_RETRY failed at %s:%d\n", __FILE__, __LINE__); \
- }\
- }
-
-#define BUSY_RETRY_WITH_RESULT(functionCall, brwr_result) \
- { \
- UINT32 retries = 0; \
- \
- while ((brwr_result = functionCall) == IX_ETH_DB_BUSY \
- && BUSY_RETRY_ENABLED && (FOREVER_RETRY || ++retries < MAX_RETRIES)) { ixOsalSleep(BUSY_RETRY_YIELD); }; \
- \
- if ((!FOREVER_RETRY && retries == MAX_RETRIES) || (brwr_result == IX_ETH_DB_FAIL)) \
- {\
- ERROR_LOG("Ethernet Learning Database Error: BUSY_RETRY_WITH_RESULT failed at %s:%d\n", __FILE__, __LINE__); \
- }\
- }
-
-/* iterators */
-#define IS_ITERATOR_VALID(iteratorPtr) ((iteratorPtr)->node != NULL)
-
-/* dependency port maps */
-
-/* Warning: if port indexing starts from 1 replace (portID) with (portID - 1) in DEPENDENCY_MAP (and make sure IX_ETH_DB_NUMBER_OF_PORTS is big enough) */
-
-/* gives an empty dependency map */
-#define SET_EMPTY_DEPENDENCY_MAP(map) { int i = 0; for (; i < 32 ; i++) map[i] = 0; }
-
-#define IS_EMPTY_DEPENDENCY_MAP(result, map) { int i = 0 ; result = TRUE; for (; i < 32 ; i++) if (map[i] != 0) { result = FALSE; break; }}
-
-/**
- * gives a map consisting only of 'portID'
- */
-#define SET_DEPENDENCY_MAP(map, portID) {SET_EMPTY_DEPENDENCY_MAP(map); map[portID >> 3] = 1 << (portID & 0x7);}
-
-/**
- * gives a map resulting from joining map1 and map2
- */
-#define JOIN_MAPS(map, map1, map2) { int i = 0; for (; i < 32 ; i++) map[i] = map1[i] | map2[i]; }
-
-/**
- * gives the map resulting from joining portID and map
- */
-#define JOIN_PORT_TO_MAP(map, portID) { map[portID >> 3] |= 1 << (portID & 0x7); }
-
-/**
- * gives the map resulting from excluding portID from map
- */
-#define EXCLUDE_PORT_FROM_MAP(map, portID) { map[portID >> 3] &= ~(1 << (portID & 0x7); }
-
-/**
- * returns TRUE if map1 is a subset of map2 and FALSE otherwise
- */
-#define IS_MAP_SUBSET(result, map1, map2) { int i = 0; result = TRUE; for (; i < 32 ; i++) if ((map1[i] | map2[i]) != map2[i]) result = FALSE; }
-
-/**
- * returns TRUE is portID is part of map and FALSE otherwise
- */
-#define IS_PORT_INCLUDED(portID, map) ((map[portID >> 3] & (1 << (portID & 0x7))) != 0)
-
-/**
- * returns the difference between map1 and map2 (ports included in map1 and not included in map2)
- */
-#define DIFF_MAPS(map, map1, map2) { int i = 0; for (; i < 32 ; i++) map[i] = map1[i] ^ (map1[i] & map2[i]); }
-
-/**
- * returns TRUE if the maps collide (have at least one port in common) and FALSE otherwise
- */
-#define MAPS_COLLIDE(result, map1, map2) { int i = 0; result = FALSE; for (; i < 32 ; i++) if ((map1[i] & map2[i]) != 0) result = TRUE; }
-
-/* size (number of ports) of a dependency map */
-#define GET_MAP_SIZE(map, size) { int i = 0, b = 0; size = 0; for (; i < 32 ; i++) { char y = map[i]; for (; b < 8 && (y >>= 1); b++) size += (y & 1); }}
-
-/* copy map2 into map1 */
-#define COPY_DEPENDENCY_MAP(map1, map2) { memcpy (map1, map2, sizeof (map1)); }
-
-/* definition of a port map size/port number which cannot be reached (we support at most 32 ports) */
-#define MAX_PORT_SIZE (0xFF)
-#define MAX_PORT_NUMBER (0xFF)
-
-#define IX_ETH_DB_CHECK_REFERENCE(ptr) { if ((ptr) == NULL) { return IX_ETH_DB_INVALID_ARG; } }
-#define IX_ETH_DB_CHECK_MAP(portID, map) { if (!IS_PORT_INCLUDED(portID, map)) { return IX_ETH_DB_INVALID_ARG; } }
-
-/* event queue macros */
-#define EVENT_QUEUE_WRAP(offset) ((offset) >= EVENT_QUEUE_SIZE ? (offset) - EVENT_QUEUE_SIZE : (offset))
-
-#define CAN_ENQUEUE(eventQueuePtr) ((eventQueuePtr)->length < EVENT_QUEUE_SIZE)
-
-#define QUEUE_HEAD(eventQueuePtr) (&(eventQueuePtr)->queue[EVENT_QUEUE_WRAP((eventQueuePtr)->base + (eventQueuePtr)->length)])
-
-#define QUEUE_TAIL(eventQueuePtr) (&(eventQueuePtr)->queue[(eventQueuePtr)->base])
-
-#define PUSH_UPDATE_QUEUE(eventQueuePtr) { (eventQueuePtr)->length++; }
-
-#define SHIFT_UPDATE_QUEUE(eventQueuePtr) \
- { \
- (eventQueuePtr)->base = EVENT_QUEUE_WRAP((eventQueuePtr)->base + 1); \
- (eventQueuePtr)->length--; \
- }
-
-#define RESET_QUEUE(eventQueuePtr) \
- { \
- (eventQueuePtr)->base = 0; \
- (eventQueuePtr)->length = 0; \
- }
-
-/* node stack macros - used to browse a tree without using a recursive function */
-#define NODE_STACK_INIT(stack) { (stack)->nodeCount = 0; }
-#define NODE_STACK_PUSH(stack, node, offset) { (stack)->nodes[(stack)->nodeCount] = (node); (stack)->offsets[(stack)->nodeCount++] = (offset); }
-#define NODE_STACK_POP(stack, node, offset) { (node) = (stack)->nodes[--(stack)->nodeCount]; offset = (stack)->offsets[(stack)->nodeCount]; }
-#define NODE_STACK_NONEMPTY(stack) ((stack)->nodeCount != 0)
-
-#ifndef IX_NDEBUG
-#define IX_ETH_DB_NPE_MSG_HISTORY_DEPTH (100)
-#define LOG_NPE_MSG(msg) \
- do { \
- UINT32 npeMsgHistoryIndex = (npeMsgHistoryLen++) % IX_ETH_DB_NPE_MSG_HISTORY_DEPTH; \
- npeMsgHistory[npeMsgHistoryIndex][0] = msg.data[0]; \
- npeMsgHistory[npeMsgHistoryIndex][1] = msg.data[1]; \
- } while (0);
-#else
-#define LOG_NPE_MSG() /* nothing */
-#endif
-
-/* ----------- Data -------------- */
-
-/* typedefs */
-
-typedef UINT32 (*HashFunction)(void *entity);
-typedef BOOL (*MatchFunction)(void *reference, void *entry);
-typedef void (*FreeFunction)(void *entry);
-
-/**
- * basic component of a hash table
- */
-typedef struct HashNode_t
-{
- void *data; /**< specific data */
- struct HashNode_t *next; /**< used for bucket chaining */
-
- __mempool__ struct HashNode_t *nextFree; /**< memory pool management */
-
- __lock__ IxOsalFastMutex lock; /**< node lock */
-} HashNode;
-
-/**
- * @brief hash table iterator definition
- *
- * an iterator is an object which can be used
- * to browse a hash table
- */
-typedef struct
-{
- UINT32 bucketIndex; /**< index of the currently iterated bucket */
- HashNode *previousNode; /**< reference to the previously iterated node within the current bucket */
- HashNode *node; /**< reference to the currently iterated node */
-} HashIterator;
-
-/**
- * definition of a MAC descriptor (a database record)
- */
-
-typedef enum
-{
- IX_ETH_DB_WIFI_AP_TO_STA = 0x0,
- IX_ETH_DB_WIFI_AP_TO_AP = 0x1
-} IxEthDBWiFiRecordType;
-
-typedef union
-{
- struct
- {
- UINT32 age;
- BOOL staticEntry; /**< TRUE if this address is static (doesn't age) */
- } filteringData;
-
- struct
- {
- UINT32 age;
- BOOL staticEntry;
- UINT32 ieee802_1qTag;
- } filteringVlanData;
-
- struct
- {
- IxEthDBWiFiRecordType type; /**< AP_TO_AP (0x1) or AP_TO_STA (0x0) */
- UINT32 gwAddressIndex; /**< used only when linearizing the entries for NPE usage */
- UINT8 gwMacAddress[IX_IEEE803_MAC_ADDRESS_SIZE];
-
- __alignment__ UINT8 reserved2[2];
- } wifiData;
-} IxEthDBRecordData;
-
-typedef struct MacDescriptor_t
-{
- UINT8 macAddress[IX_IEEE803_MAC_ADDRESS_SIZE];
-
- __alignment__ UINT8 reserved1[2];
-
- UINT32 portID;
- IxEthDBRecordType type;
- IxEthDBRecordData recordData;
-
- /* used for internal operations, such as NPE linearization */
- void *internal;
-
- /* custom user data */
- void *user;
-
- __mempool__ struct MacDescriptor_t *nextFree; /**< memory pool management */
- __smartpointer__ UINT32 refCount; /**< smart pointer reference counter */
-} MacDescriptor;
-
-/**
- * hash table definition
- */
-typedef struct
-{
- HashNode *hashBuckets[NUM_BUCKETS];
- UINT32 numBuckets;
-
- __lock__ IxOsalFastMutex bucketLocks[NUM_BUCKETS];
-
- HashFunction entryHashFunction;
- MatchFunction *matchFunctions;
- FreeFunction freeFunction;
-} HashTable;
-
-typedef enum
-{
- IX_ETH_DB_MAC_KEY = 1,
- IX_ETH_DB_MAC_PORT_KEY = 2,
- IX_ETH_DB_MAC_VLAN_KEY = 3,
- IX_ETH_DB_MAX_KEY_INDEX = 3
-} IxEthDBSearchKeyType;
-
-typedef struct MacTreeNode_t
-{
- __smartpointer__ MacDescriptor *descriptor;
- struct MacTreeNode_t *left, *right;
-
- __mempool__ struct MacTreeNode_t *nextFree;
-} MacTreeNode;
-
-typedef IxEthDBStatus (*IxEthDBPortUpdateHandler)(IxEthDBPortId portID, IxEthDBRecordType type);
-
-typedef void (*IxEthDBNoteWriteFn)(void *address, MacTreeNode *node);
-
-typedef struct
-{
- BOOL updateEnabled; /**< TRUE if updates are enabled for port */
- BOOL userControlled; /**< TRUE if the user has manually used ixEthDBPortUpdateEnableSet */
- BOOL treeInitialized; /**< TRUE if the NPE has received an initial tree */
- IxEthDBPortUpdateHandler updateHandler; /**< port update handler routine */
- void *npeUpdateZone; /**< port update memory zone */
- void *npeGwUpdateZone; /**< port update memory zone for gateways */
- void *vlanUpdateZone; /**< port update memory zone for VLAN tables */
- MacTreeNode *searchTree; /**< internal search tree, in MacTreeNode representation */
- BOOL searchTreePendingWrite; /**< TRUE if searchTree holds a tree pending write to the port */
-} PortUpdateMethod;
-
-typedef struct
-{
- IxEthDBPortId portID; /**< port ID */
- BOOL enabled; /**< TRUE if the port is enabled */
- BOOL agingEnabled; /**< TRUE if aging on this port is enabled */
- BOOL initialized;
- IxEthDBPortMap dependencyPortMap; /**< dependency port map for this port */
- PortUpdateMethod updateMethod; /**< update method structure */
- BOOL macAddressUploaded; /**< TRUE if the MAC address was uploaded into the port */
- UINT32 maxRxFrameSize; /**< maximum Rx frame size for this port */
- UINT32 maxTxFrameSize; /**< maximum Rx frame size for this port */
-
- UINT8 bbsid[6];
- __alignment__ UINT8 reserved[2];
- UINT32 frameControlDurationID; /**< Frame Control - Duration/ID WiFi control */
-
- IxEthDBVlanTag vlanTag; /**< default VLAN tag for port */
- IxEthDBPriorityTable priorityTable; /**< QoS <=> internal priority mapping */
- IxEthDBVlanSet vlanMembership;
- IxEthDBVlanSet transmitTaggingInfo;
- IxEthDBFrameFilter frameFilter;
- IxEthDBTaggingAction taggingAction;
-
- UINT32 npeFrameFilter;
- UINT32 npeTaggingAction;
-
- IxEthDBFirewallMode firewallMode;
- BOOL srcAddressFilterEnabled;
-
- BOOL stpBlocked;
-
- IxEthDBFeature featureCapability;
- IxEthDBFeature featureStatus;
-
- UINT32 ixEthDBTrafficClassAQMAssignments[IX_IEEE802_1Q_QOS_PRIORITY_COUNT];
-
- UINT32 ixEthDBTrafficClassCount;
-
- UINT32 ixEthDBTrafficClassAvailable;
-
-
-
- __lock__ IxOsalMutex npeAckLock;
-} PortInfo;
-
-/* list of port information structures indexed on port Ids */
-extern IX_ETH_DB_PUBLIC PortInfo ixEthDBPortInfo[IX_ETH_DB_NUMBER_OF_PORTS];
-
-typedef enum
-{
- IX_ETH_DB_ADD_FILTERING_RECORD = 0xFF0001,
- IX_ETH_DB_REMOVE_FILTERING_RECORD = 0xFF0002
-} PortEventType;
-
-typedef struct
-{
- UINT32 eventType;
- IxEthDBPortId portID;
- IxEthDBMacAddr macAddr;
- BOOL staticEntry;
-} PortEvent;
-
-typedef struct
-{
- PortEvent queue[EVENT_QUEUE_SIZE];
- UINT32 base;
- UINT32 length;
-} PortEventQueue;
-
-typedef struct
-{
- IxEthDBPortId portID; /**< originating port */
- MacDescriptor *macDescriptors[MAX_ELT_SIZE]; /**< addresses to be synced into db */
- UINT32 addressCount; /**< number of addresses */
-} TreeSyncInfo;
-
-typedef struct
-{
- MacTreeNode *nodes[MAX_ELT_SIZE];
- UINT32 offsets[MAX_ELT_SIZE];
- UINT32 nodeCount;
-} MacTreeNodeStack;
-
-/* Prototypes */
-
-/* ----------- Memory management -------------- */
-
-IX_ETH_DB_PUBLIC void ixEthDBInitMemoryPools(void);
-
-IX_ETH_DB_PUBLIC HashNode* ixEthDBAllocHashNode(void);
-IX_ETH_DB_PUBLIC void ixEthDBFreeHashNode(HashNode *);
-
-IX_ETH_DB_PUBLIC __smartpointer__ MacDescriptor* ixEthDBAllocMacDescriptor(void);
-IX_ETH_DB_PUBLIC __smartpointer__ MacDescriptor* ixEthDBCloneMacDescriptor(MacDescriptor *macDescriptor);
-IX_ETH_DB_PUBLIC __smartpointer__ void ixEthDBFreeMacDescriptor(MacDescriptor *);
-
-IX_ETH_DB_PUBLIC __smartpointer__ MacTreeNode* ixEthDBAllocMacTreeNode(void);
-IX_ETH_DB_PUBLIC __smartpointer__ MacTreeNode* ixEthDBCloneMacTreeNode(MacTreeNode *);
-IX_ETH_DB_PUBLIC __smartpointer__ void ixEthDBFreeMacTreeNode(MacTreeNode *);
-
-IX_ETH_DB_PUBLIC void ixEthDBPoolFreeMacTreeNode(MacTreeNode *);
-IX_ETH_DB_PUBLIC UINT32 ixEthDBSearchTreeUsageGet(MacTreeNode *tree);
-IX_ETH_DB_PUBLIC int ixEthDBShowMemoryStatus(void);
-
-/* Hash Table */
-IX_ETH_DB_PUBLIC void ixEthDBInitHash(HashTable *hashTable, UINT32 numBuckets, HashFunction entryHashFunction, MatchFunction *matchFunctions, FreeFunction freeFunction);
-
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBAddHashEntry(HashTable *hashTable, void *entry);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBRemoveHashEntry(HashTable *hashTable, int keyType, void *reference);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBSearchHashEntry(HashTable *hashTable, int keyType, void *reference, HashNode **searchResult);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPeekHashEntry(HashTable *hashTable, int keyType, void *reference);
-IX_ETH_DB_PUBLIC void ixEthDBReleaseHashNode(HashNode *node);
-
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBInitHashIterator(HashTable *hashTable, HashIterator *iterator);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBIncrementHashIterator(HashTable *hashTable, HashIterator *iterator);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBRemoveEntryAtHashIterator(HashTable *hashTable, HashIterator *iterator);
-IX_ETH_DB_PUBLIC void ixEthDBReleaseHashIterator(HashIterator *iterator);
-
-/* API Support */
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPortAddressSet(IxEthDBPortId portID, IxEthDBMacAddr *macAddr);
-IX_ETH_DB_PUBLIC void ixEthDBMaximumFrameSizeAckCallback(IxNpeMhNpeId npeID, IxNpeMhMessage msg);
-
-/* DB Core functions */
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBInit(void);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBAdd(MacDescriptor *newRecordTemplate, IxEthDBPortMap updateTrigger);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBRemove(MacDescriptor *templateRecord, IxEthDBPortMap updateTrigger);
-IX_ETH_DB_PUBLIC HashNode* ixEthDBSearch(IxEthDBMacAddr *macAddress, IxEthDBRecordType typeFilter);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPeek(IxEthDBMacAddr *macAddress, IxEthDBRecordType typeFilter);
-
-/* Learning support */
-IX_ETH_DB_PUBLIC UINT32 ixEthDBAddressCompare(UINT8 *mac1, UINT8 *mac2);
-IX_ETH_DB_PUBLIC BOOL ixEthDBAddressMatch(void *reference, void *entry);
-IX_ETH_DB_PUBLIC UINT32 ixEthDBEntryXORHash(void *macDescriptor);
-IX_ETH_DB_PUBLIC UINT32 ixEthDBKeyXORHash(void *macAddress);
-
-/* Port updates */
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBNPEUpdateHandler(IxEthDBPortId portID, IxEthDBRecordType type);
-IX_ETH_DB_PUBLIC void ixEthDBUpdatePortLearningTrees(IxEthDBPortMap triggerPorts);
-IX_ETH_DB_PUBLIC void ixEthDBNPEAccessRequest(IxEthDBPortId portID);
-IX_ETH_DB_PUBLIC void ixEthDBUpdateLock(void);
-IX_ETH_DB_PUBLIC void ixEthDBUpdateUnlock(void);
-IX_ETH_DB_PUBLIC MacTreeNode* ixEthDBQuery(MacTreeNode *searchTree, IxEthDBPortMap query, IxEthDBRecordType recordFilter, UINT32 maximumEntries);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBFirewallUpdate(IxEthDBPortId portID, void *address, UINT32 epDelta);
-
-/* Init/unload */
-IX_ETH_DB_PUBLIC void ixEthDBPortSetAckCallback(IxNpeMhNpeId npeID, IxNpeMhMessage msg);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBEventProcessorInit(void);
-IX_ETH_DB_PUBLIC void ixEthDBPortInit(IxEthDBPortId portID);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPortEnable(IxEthDBPortId portID);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPortDisable(IxEthDBPortId portID);
-IX_ETH_DB_PUBLIC void ixEthDBNPEUpdateAreasInit(void);
-IX_ETH_DB_PUBLIC UINT32 ixEthDBMatchMethodsRegister(MatchFunction *matchFunctions);
-IX_ETH_DB_PUBLIC UINT32 ixEthDBRecordSerializeMethodsRegister(void);
-IX_ETH_DB_PUBLIC UINT32 ixEthDBUpdateTypeRegister(BOOL *typeArray);
-IX_ETH_DB_PUBLIC void ixEthDBNPEUpdateAreasUnload(void);
-IX_ETH_DB_PUBLIC void ixEthDBFeatureCapabilityScan(void);
-IX_ETH_DB_PUBLIC UINT32 ixEthDBKeyTypeRegister(UINT32 *keyType);
-
-/* Event processing */
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBDefaultEventCallbackEnable(IxEthDBPortId portID, BOOL enable);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBTriggerAddPortUpdate(IxEthDBMacAddr *macAddr, IxEthDBPortId portID, BOOL staticEntry);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBTriggerRemovePortUpdate(IxEthDBMacAddr *macAddr, IxEthDBPortId portID);
-IX_ETH_DB_PUBLIC void ixEthDBNPEEventCallback(IxNpeMhNpeId npeID, IxNpeMhMessage msg);
-
-/* NPE adaptor */
-IX_ETH_DB_PUBLIC void ixEthDBGetMacDatabaseCbk(IxNpeMhNpeId npeID, IxNpeMhMessage msg);
-IX_ETH_DB_PUBLIC void ixEthDBNpeMsgAck(IxNpeMhNpeId npeID, IxNpeMhMessage msg);
-IX_ETH_DB_PUBLIC void ixEthDBNPESyncScan(IxEthDBPortId portID, void *eltBaseAddress, UINT32 eltSize);
-IX_ETH_DB_PUBLIC void ixEthDBNPETreeWrite(IxEthDBRecordType type, UINT32 totalSize, void *baseAddress, MacTreeNode *tree, UINT32 *blocks, UINT32 *startIndex);
-IX_ETH_DB_PUBLIC void ixEthDBNPEGatewayNodeWrite(void *address, MacTreeNode *node);
-
-/* Other public API functions */
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBStartLearningFunction(void);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBStopLearningFunction(void);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPortUpdateEnableSet(IxEthDBPortId portID, BOOL enableUpdate);
-
-/* Maximum Tx/Rx public functions */
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBFilteringPortMaximumRxFrameSizeSet(IxEthDBPortId portID, UINT32 maximumRxFrameSize);
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBFilteringPortMaximumTxFrameSizeSet(IxEthDBPortId portID, UINT32 maximumTxFrameSize);
-
-/* VLAN-related */
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPortVlanTableSet(IxEthDBPortId portID, IxEthDBVlanSet portVlanTable, IxEthDBVlanSet vlanSet);
-
-/* Record search */
-IX_ETH_DB_PUBLIC BOOL ixEthDBAddressRecordMatch(void *untypedReference, void *untypedEntry);
-IX_ETH_DB_PUBLIC BOOL ixEthDBVlanRecordMatch(void *untypedReference, void *untypedEntry);
-IX_ETH_DB_PUBLIC BOOL ixEthDBPortRecordMatch(void *untypedReference, void *untypedEntry);
-IX_ETH_DB_PUBLIC BOOL ixEthDBNullMatch(void *reference, void *entry);
-IX_ETH_DB_PUBLIC HashNode* ixEthDBPortSearch(IxEthDBMacAddr *macAddress, IxEthDBPortId portID, IxEthDBRecordType typeFilter);
-IX_ETH_DB_PUBLIC HashNode* ixEthDBVlanSearch(IxEthDBMacAddr *macAddress, IxEthDBVlanId vlanID, IxEthDBRecordType typeFilter);
-
-/* Utilities */
-IX_ETH_DB_PUBLIC const char* mac2string(const unsigned char *mac);
-IX_ETH_DB_PUBLIC void showHashInfo(void);
-IX_ETH_DB_PUBLIC int ixEthDBAnalyzeHash(void);
-IX_ETH_DB_PUBLIC const char* errorString(IxEthDBStatus error);
-IX_ETH_DB_PUBLIC int numHashElements(void);
-IX_ETH_DB_PUBLIC void zapHashtable(void);
-IX_ETH_DB_PUBLIC BOOL ixEthDBCheckSingleBitValue(UINT32 value);
-
-/* Single Eth NPE Check */
-IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBSingleEthNpeCheck(IxEthDBPortId portId);
-
-#endif /* IxEthDB_p_H */
-
diff --git a/cpu/ixp/npe/include/IxEthMii.h b/cpu/ixp/npe/include/IxEthMii.h
deleted file mode 100644
index a1bfe06724..0000000000
--- a/cpu/ixp/npe/include/IxEthMii.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/**
- * @file IxEthMii.h
- *
- * @brief this file contains the public API of @ref IxEthMii component
- *
- * Design notes :
- * The main intent of this API is to inplement MII high level fonctionalitoes
- * to support the codelets provided with the IXP400 software releases. It
- * superceedes previous interfaces provided with @ref IxEThAcc component.
- *
- * This API has been tested with the PHYs provided with the
- * IXP400 development platforms. It may not work for specific Ethernet PHYs
- * used on specific boards.
- *
- * This source code detects and interface the LXT972, LXT973 and KS6995
- * Ethernet PHYs.
- *
- * This source code should be considered as an example which may need
- * to be adapted for different hardware implementations.
- *
- * It is strongly recommended to use public domain and GPL utilities
- * like libmii, mii-diag for MII interface support.
- *
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxEthMii_H
-#define IxEthMii_H
-
-#include <IxTypes.h>
-
-/**
- * @defgroup IxEthMii IXP400 Ethernet Phy Access (IxEthMii) API
- *
- * @brief ethMii is a library that does provides access to the
- * Ethernet PHYs
- *
- *@{
- */
-
-/**
- * @ingroup IxEthMii
- *
- * @fn ixEthMiiPhyScan(BOOL phyPresent[], UINT32 maxPhyCount)
- *
- * @brief Scan the MDIO bus for PHYs
- * This function scans PHY addresses 0 through 31, and sets phyPresent[n] to
- * TRUE if a phy is discovered at address n.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
- *
- * @param phyPresent BOOL [in] - boolean array of IXP425_ETH_ACC_MII_MAX_ADDR entries
- * @param maxPhyCount UINT32 [in] - number of PHYs to search for (the scan will stop when
- * the indicated number of PHYs is found).
- *
- * @return IX_STATUS
- * - IX_ETH_ACC_SUCCESS
- * - IX_ETH_ACC_FAIL : invalid arguments.
- *
- * <hr>
- */
-PUBLIC IX_STATUS ixEthMiiPhyScan(BOOL phyPresent[], UINT32 maxPhyCount);
-
-/**
- * @ingroup IxEthMii
- *
- * @fn ixEthMiiPhyConfig(UINT32 phyAddr,
- BOOL speed100,
- BOOL fullDuplex,
- BOOL autonegotiate)
- *
- *
- * @brief Configure a PHY
- * Configure a PHY's speed, duplex and autonegotiation status
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
- *
- * @param phyAddr UINT32 [in]
- * @param speed100 BOOL [in] - set to TRUE for 100Mbit/s operation, FALSE for 10Mbit/s
- * @param fullDuplex BOOL [in] - set to TRUE for Full Duplex, FALSE for Half Duplex
- * @param autonegotiate BOOL [in] - set to TRUE to enable autonegotiation
- *
- * @return IX_STATUS
- * - IX_SUCCESS
- * - IX_FAIL : invalid arguments.
- *
- * <hr>
- */
-PUBLIC IX_STATUS ixEthMiiPhyConfig(UINT32 phyAddr,
- BOOL speed100,
- BOOL fullDuplex,
- BOOL autonegotiate);
-
-/**
- * @ingroup IxEthMii
- *
- * @fn ixEthMiiPhyLoopbackEnable(UINT32 phyAddr)
- *
- *
- * @brief Enable PHY Loopback in a specific Eth MII port
- *
- * @note When PHY Loopback is enabled, frames sent out to the PHY from the
- * IXP400 will be looped back to the IXP400. They will not be transmitted out
- * on the wire.
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
- *
- * @return IX_STATUS
- * - IX_SUCCESS
- * - IX_FAIL : invalid arguments.
- * <hr>
- */
-PUBLIC IX_STATUS
-ixEthMiiPhyLoopbackEnable (UINT32 phyAddr);
-
-/**
- * @ingroup IxEthMii
- *
- * @fn ixEthMiiPhyLoopbackDisable(UINT32 phyAddr)
- *
- *
- * @brief Disable PHY Loopback in a specific Eth MII port
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
- *
- * @return IX_STATUS
- * - IX_SUCCESS
- * - IX_FAIL : invalid arguments.
- * <hr>
- */
-PUBLIC IX_STATUS
-ixEthMiiPhyLoopbackDisable (UINT32 phyAddr);
-
-/**
- * @ingroup IxEthMii
- *
- * @fn ixEthMiiPhyReset(UINT32 phyAddr)
- *
- * @brief Reset a PHY
- * Reset a PHY
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
- *
- * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
- *
- * @return IX_STATUS
- * - IX_SUCCESS
- * - IX_FAIL : invalid arguments.
- *
- * <hr>
- */
-PUBLIC IX_STATUS ixEthMiiPhyReset(UINT32 phyAddr);
-
-
-/**
- * @ingroup IxEthMii
- *
- * @fn ixEthMiiLinkStatus(UINT32 phyAddr,
- BOOL *linkUp,
- BOOL *speed100,
- BOOL *fullDuplex,
- BOOL *autoneg)
- *
- * @brief Retrieve the current status of a PHY
- * Retrieve the link, speed, duplex and autonegotiation status of a PHY
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
- *
- * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
- * @param linkUp BOOL [out] - set to TRUE if the link is up
- * @param speed100 BOOL [out] - set to TRUE indicates 100Mbit/s, FALSE indicates 10Mbit/s
- * @param fullDuplex BOOL [out] - set to TRUE indicates Full Duplex, FALSE indicates Half Duplex
- * @param autoneg BOOL [out] - set to TRUE indicates autonegotiation is enabled, FALSE indicates autonegotiation is disabled
- *
- * @return IX_STATUS
- * - IX_SUCCESS
- * - IX_FAIL : invalid arguments.
- *
- * <hr>
- */
-PUBLIC IX_STATUS ixEthMiiLinkStatus(UINT32 phyAddr,
- BOOL *linkUp,
- BOOL *speed100,
- BOOL *fullDuplex,
- BOOL *autoneg);
-
-/**
- * @ingroup IxEthMii
- *
- * @fn ixEthMiiPhyShow (UINT32 phyAddr)
- *
- *
- * @brief Display information on a specified PHY
- * Display link status, speed, duplex and Auto Negotiation status
- *
- * - Reentrant - no
- * - ISR Callable - no
- *
- * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
- *
- * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
- *
- * @return IX_STATUS
- * - IX_SUCCESS
- * - IX_FAIL : invalid arguments.
- *
- * <hr>
- */
-PUBLIC IX_STATUS ixEthMiiPhyShow (UINT32 phyAddr);
-
-#endif /* ndef IxEthMii_H */
-/**
- *@}
- */
diff --git a/cpu/ixp/npe/include/IxEthMii_p.h b/cpu/ixp/npe/include/IxEthMii_p.h
deleted file mode 100644
index 104b65c1f0..0000000000
--- a/cpu/ixp/npe/include/IxEthMii_p.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- * @file IxEthMii_p.h
- *
- * @author Intel Corporation
- * @date
- *
- * @brief MII Header file
- *
- * Design Notes:
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxEthMii_p_H
-#define IxEthMii_p_H
-
-
-/* MII definitions - these have been verified against the LXT971 and
- LXT972 PHYs*/
-
-#define IX_ETH_MII_MAX_REG_NUM 0x20 /* max number of registers */
-
-#define IX_ETH_MII_CTRL_REG 0x0 /* Control Register */
-#define IX_ETH_MII_STAT_REG 0x1 /* Status Register */
-#define IX_ETH_MII_PHY_ID1_REG 0x2 /* PHY identifier 1 Register */
-#define IX_ETH_MII_PHY_ID2_REG 0x3 /* PHY identifier 2 Register */
-#define IX_ETH_MII_AN_ADS_REG 0x4 /* Auto-Negotiation */
- /* Advertisement Register */
-#define IX_ETH_MII_AN_PRTN_REG 0x5 /* Auto-Negotiation */
- /* partner ability Register */
-#define IX_ETH_MII_AN_EXP_REG 0x6 /* Auto-Negotiation */
- /* Expansion Register */
-#define IX_ETH_MII_AN_NEXT_REG 0x7 /* Auto-Negotiation */
- /* next-page transmit Register */
-
-#define IX_ETH_MII_STAT2_REG 0x11 /* Status Register 2*/
-
-
-/* MII control register bit */
-
-#define IX_ETH_MII_CR_COLL_TEST 0x0080 /* collision test */
-#define IX_ETH_MII_CR_FDX 0x0100 /* FDX =1, half duplex =0 */
-#define IX_ETH_MII_CR_RESTART 0x0200 /* restart auto negotiation */
-#define IX_ETH_MII_CR_ISOLATE 0x0400 /* isolate PHY from MII */
-#define IX_ETH_MII_CR_POWER_DOWN 0x0800 /* power down */
-#define IX_ETH_MII_CR_AUTO_EN 0x1000 /* auto-negotiation enable */
-#define IX_ETH_MII_CR_100 0x2000 /* 0 = 10mb, 1 = 100mb */
-#define IX_ETH_MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */
-#define IX_ETH_MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */
-#define IX_ETH_MII_CR_NORM_EN 0x0000 /* just enable the PHY */
-#define IX_ETH_MII_CR_DEF_0_MASK 0xca7f /* they must return zero */
-#define IX_ETH_MII_CR_RES_MASK 0x007f /* reserved bits, return zero */
-
-/* MII Status register bit definitions */
-
-#define IX_ETH_MII_SR_LINK_STATUS 0x0004 /* link Status -- 1 = link */
-#define IX_ETH_MII_SR_AUTO_SEL 0x0008 /* auto speed select capable */
-#define IX_ETH_MII_SR_REMOTE_FAULT 0x0010 /* Remote fault detect */
-#define IX_ETH_MII_SR_AUTO_NEG 0x0020 /* auto negotiation complete */
-#define IX_ETH_MII_SR_10T_HALF_DPX 0x0800 /* 10BaseT HD capable */
-#define IX_ETH_MII_SR_10T_FULL_DPX 0x1000 /* 10BaseT FD capable */
-#define IX_ETH_MII_SR_TX_HALF_DPX 0x2000 /* TX HD capable */
-#define IX_ETH_MII_SR_TX_FULL_DPX 0x4000 /* TX FD capable */
-#define IX_ETH_MII_SR_T4 0x8000 /* T4 capable */
-#define IX_ETH_MII_SR_ABIL_MASK 0xff80 /* abilities mask */
-#define IX_ETH_MII_SR_EXT_CAP 0x0001 /* extended capabilities */
-
-
-/* LXT971/2 Status 2 register bit definitions */
-#define IX_ETH_MII_SR2_100 0x4000
-#define IX_ETH_MII_SR2_TX 0x2000
-#define IX_ETH_MII_SR2_RX 0x1000
-#define IX_ETH_MII_SR2_COL 0x0800
-#define IX_ETH_MII_SR2_LINK 0x0400
-#define IX_ETH_MII_SR2_FD 0x0200
-#define IX_ETH_MII_SR2_AUTO 0x0100
-#define IX_ETH_MII_SR2_AUTO_CMPLT 0x0080
-#define IX_ETH_MII_SR2_POLARITY 0x0020
-#define IX_ETH_MII_SR2_PAUSE 0x0010
-#define IX_ETH_MII_SR2_ERROR 0x0008
-
-/* MII Link Code word bit definitions */
-
-#define IX_ETH_MII_BP_FAULT 0x2000 /* remote fault */
-#define IX_ETH_MII_BP_ACK 0x4000 /* acknowledge */
-#define IX_ETH_MII_BP_NP 0x8000 /* nexp page is supported */
-
-/* MII Next Page bit definitions */
-
-#define IX_ETH_MII_NP_TOGGLE 0x0800 /* toggle bit */
-#define IX_ETH_MII_NP_ACK2 0x1000 /* acknowledge two */
-#define IX_ETH_MII_NP_MSG 0x2000 /* message page */
-#define IX_ETH_MII_NP_ACK1 0x4000 /* acknowledge one */
-#define IX_ETH_MII_NP_NP 0x8000 /* nexp page will follow */
-
-/* MII Expansion Register bit definitions */
-
-#define IX_ETH_MII_EXP_FAULT 0x0010 /* parallel detection fault */
-#define IX_ETH_MII_EXP_PRTN_NP 0x0008 /* link partner next-page able */
-#define IX_ETH_MII_EXP_LOC_NP 0x0004 /* local PHY next-page able */
-#define IX_ETH_MII_EXP_PR 0x0002 /* full page received */
-#define IX_ETH_MII_EXP_PRT_AN 0x0001 /* link partner auto neg able */
-
-/* technology ability field bit definitions */
-
-#define IX_ETH_MII_TECH_10BASE_T 0x0020 /* 10Base-T */
-#define IX_ETH_MII_TECH_10BASE_FD 0x0040 /* 10Base-T Full Duplex */
-#define IX_ETH_MII_TECH_100BASE_TX 0x0080 /* 100Base-TX */
-#define IX_ETH_MII_TECH_100BASE_TX_FD 0x0100 /* 100Base-TX Full Duplex */
-
-#define IX_ETH_MII_TECH_100BASE_T4 0x0200 /* 100Base-T4 */
-#define IX_ETH_MII_ADS_TECH_MASK 0x1fe0 /* technology abilities mask */
-#define IX_ETH_MII_TECH_MASK IX_ETH_MII_ADS_TECH_MASK
-#define IX_ETH_MII_ADS_SEL_MASK 0x001f /* selector field mask */
-
-#define IX_ETH_MII_AN_FAIL 0x10 /* auto-negotiation fail */
-#define IX_ETH_MII_STAT_FAIL 0x20 /* errors in the status register */
-#define IX_ETH_MII_PHY_NO_ABLE 0x40 /* the PHY lacks some abilities */
-
-/* Definitions for MII access routines*/
-
-#define IX_ETH_MII_GO BIT(31)
-#define IX_ETH_MII_WRITE BIT(26)
-#define IX_ETH_MII_TIMEOUT_10TH_SECS (5)
-#define IX_ETH_MII_10TH_SEC_IN_MILLIS (100)
-#define IX_ETH_MII_READ_FAIL BIT(31)
-
-/* When we reset the PHY we delay for 2 seconds to allow the reset to
- complete*/
-#define IX_ETH_MII_RESET_DELAY_MS (2000)
-#define IX_ETH_MII_RESET_POLL_MS (50)
-
-#define IX_ETH_MII_REG_SHL 16
-#define IX_ETH_MII_ADDR_SHL 21
-
-/* supported PHYs */
-#define IX_ETH_MII_LXT971_PHY_ID 0x001378E0
-#define IX_ETH_MII_LXT972_PHY_ID 0x001378E2
-#define IX_ETH_MII_LXT973_PHY_ID 0x00137A10
-#define IX_ETH_MII_LXT973A3_PHY_ID 0x00137A11
-#define IX_ETH_MII_KS8995_PHY_ID 0x00221450
-#define IX_ETH_MII_LXT9785_PHY_ID 0x001378FF
-
-
-#define IX_ETH_MII_INVALID_PHY_ID 0x00000000
-#define IX_ETH_MII_UNKNOWN_PHY_ID 0xffffffff
-
-#endif /*IxEthAccMii_p_H*/
diff --git a/cpu/ixp/npe/include/IxEthNpe.h b/cpu/ixp/npe/include/IxEthNpe.h
deleted file mode 100644
index 21bdedc5a7..0000000000
--- a/cpu/ixp/npe/include/IxEthNpe.h
+++ /dev/null
@@ -1,695 +0,0 @@
-#ifndef __doxygen_HIDE /* This file is not part of the API */
-
-/**
- * @file IxEthNpe.h
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxEthNpe IXP400 Ethernet NPE (IxEthNpe) API
- *
- * @brief Contains the API for Ethernet NPE.
- *
- * All messages given to NPE, get back an acknowledgment. The acknowledgment
- * is identical to the message sent to the NPE (except for NPE_GETSTATUS message).
- *
- * @{
- */
-
-
-/*--------------------------------------------------------------------------
- * APB Message IDs - XScale->NPE
- *------------------------------------------------------------------------*/
-
-/**
- * @def IX_ETHNPE_NPE_GETSTATUS
- *
- * @brief Request from the XScale client for the NPE to return the firmware
- * version of the currently executing image.
- *
- * Acknowledgment message id is same as the request message id.
- * NPE returns the firmware version ID to XScale.
- */
-#define IX_ETHNPE_NPE_GETSTATUS 0x00
-
-/**
- * @def IX_ETHNPE_EDB_SETPORTADDRESS
- *
- * @brief Request from the XScale client for the NPE to set the Ethernet
- * port's port ID and MAC address.
- */
-#define IX_ETHNPE_EDB_SETPORTADDRESS 0x01
-
-/**
- * @def IX_ETHNPE_EDB_GETMACADDRESSDATABASE
- *
- * @brief Request from XScale client to the NPE requesting upload of
- * Ethernet Filtering Database or Header Conversion Database from NPE's
- * data memory to XScale accessible SDRAM.
- */
-#define IX_ETHNPE_EDB_GETMACADDRESSDATABASE 0x02
-
-/**
- * @def IX_ETHNPE_EDB_SETMACADDRESSSDATABASE
- *
- * @brief Request from XScale client to the NPE requesting download of
- * Ethernet Filtering Database or Header Conversion Database from SDRAM
- * to the NPE's datamemory.
- */
-#define IX_ETHNPE_EDB_SETMACADDRESSSDATABASE 0x03
-
-/**
- * @def IX_ETHNPE_GETSTATS
- *
- * @brief Request from the XScale client for the current MAC port statistics
- * data to be written to the (empty) statistics structure and the specified
- * location in externa memory.
- */
-#define IX_ETHNPE_GETSTATS 0x04
-
-/**
- * @def IX_ETHNPE_RESETSTATS
- *
- * @brief Request from the XScale client to the NPE to reset all of its internal
- * MAC port statistics state variables.
- *
- * As a side effect, this message entails an implicit request that the NPE
- * write the current MAC port statistics into the MAC statistics structure
- * at the specified location in external memory.
- */
-#define IX_ETHNPE_RESETSTATS 0x05
-
-/**
- * @def IX_ETHNPE_SETMAXFRAMELENGTHS
- *
- * @brief Request from the XScale client to the NPE to configure maximum framelengths
- * and block sizes in receive and transmit direction.
- */
-#define IX_ETHNPE_SETMAXFRAMELENGTHS 0x06
-
-/**
- * @def IX_ETHNPE_VLAN_SETRXTAGMODE
- *
- * @brief Request from the XScale client to the NPE to configure VLAN frame type
- * filtering and VLAN the tagging mode for the receiver.
- */
-#define IX_ETHNPE_VLAN_SETRXTAGMODE 0x07
-
-/**
- * @def IX_ETHNPE_VLAN_SETDEFAULTRXVID
- *
- * @brief Request from the XScale client to the NPE to set receiver's default
- * VLAN tag (PVID)and internal traffic class.
- */
-#define IX_ETHNPE_VLAN_SETDEFAULTRXVID 0x08
-
-/**
- * @def IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY
- *
- * @brief Request from the XScale client to the NPE to configure VLAN Port
- * membership and Tx tagging for 8 consecutive VLANID's.
- */
-#define IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY 0x09
-
-/**
- * @def IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE
- *
- * @brief Request from the XScale client to the NPE to configure VLAN Port
- * membership and Tx tagging for a range of VLANID's.
- */
-#define IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE 0x0A
-
-/**
- * @def IX_ETHNPE_VLAN_SETRXQOSENTRY
- *
- * @brief Request from the XScale client to the NPE to map a user priority
- * to QoS class and an AQM queue number.
- */
-#define IX_ETHNPE_VLAN_SETRXQOSENTRY 0x0B
-
-/**
- * @def IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE
- *
- * @brief Request from the XScale client to the NPE to enable or disable
- * portID extraction from VLAN-tagged frames for the specified port.
- */
-#define IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE 0x0C
-
-/**
- * @def IX_ETHNPE_STP_SETBLOCKINGSTATE
- *
- * @brief Request from the XScale client to the NPE to block or unblock
- * forwarding for spanning tree BPDUs.
- */
-#define IX_ETHNPE_STP_SETBLOCKINGSTATE 0x0D
-
-/**
- * @def IX_ETHNPE_FW_SETFIREWALLMODE
- *
- * @brief Request from the XScale client to the NPE to configure firewall
- * services modes of operation and/or download Ethernet Firewall Database from
- * SDRAM to NPE.
- */
-#define IX_ETHNPE_FW_SETFIREWALLMODE 0x0E
-
-/**
- * @def IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID
- *
- * @brief Request from the XScale client to the NPE to set global frame control
- * and duration/ID field for the 802.3 to 802.11 protocol header conversion
- * service.
- */
-#define IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID 0x0F
-
-/**
- * @def IX_ETHNPE_PC_SETBBSID
- *
- * @brief Request from the XScale client to the NPE to set global BBSID field
- * value for the 802.3 to 802.11 protocol header conversion service.
- */
-#define IX_ETHNPE_PC_SETBBSID 0x10
-
-/**
- * @def IX_ETHNPE_PC_SETAPMACTABLE
- *
- * @brief Request from the XScale client to the NPE to update a block/section/
- * range of the AP MAC Address Table.
- */
-#define IX_ETHNPE_PC_SETAPMACTABLE 0x11
-
-/**
- * @def IX_ETHNPE_SETLOOPBACK_MODE
- *
- * @brief Turn on or off the NPE frame loopback.
- */
-#define IX_ETHNPE_SETLOOPBACK_MODE (0x12)
-
-/*--------------------------------------------------------------------------
- * APB Message IDs - NPE->XScale
- *------------------------------------------------------------------------*/
-
-/**
- * @def IX_ETHNPE_NPE_GETSTATUS_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_NPE_GETSTATUS message. NPE firmware version
- * id is returned in the message.
- */
-#define IX_ETHNPE_NPE_GETSTATUS_ACK 0x00
-
-/**
- * @def IX_ETHNPE_EDB_SETPORTADDRESS_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_EDB_SETPORTADDRESS message.
- */
-#define IX_ETHNPE_EDB_SETPORTADDRESS_ACK 0x01
-
-/**
- * @def IX_ETHNPE_EDB_GETMACADDRESSDATABASE_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_EDB_GETMACADDRESSDATABASE message
- */
-#define IX_ETHNPE_EDB_GETMACADDRESSDATABASE_ACK 0x02
-
-/**
- * @def IX_ETHNPE_EDB_SETMACADDRESSSDATABASE_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_EDB_SETMACADDRESSSDATABASE message.
- */
-#define IX_ETHNPE_EDB_SETMACADDRESSSDATABASE_ACK 0x03
-
-/**
- * @def IX_ETHNPE_GETSTATS_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_GETSTATS message.
- */
-#define IX_ETHNPE_GETSTATS_ACK 0x04
-
-/**
- * @def IX_ETHNPE_RESETSTATS_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_RESETSTATS message.
- */
-#define IX_ETHNPE_RESETSTATS_ACK 0x05
-
-/**
- * @def IX_ETHNPE_SETMAXFRAMELENGTHS_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_SETMAXFRAMELENGTHS message.
- */
-#define IX_ETHNPE_SETMAXFRAMELENGTHS_ACK 0x06
-
-/**
- * @def IX_ETHNPE_VLAN_SETRXTAGMODE_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_VLAN_SETRXTAGMODE message.
- */
-#define IX_ETHNPE_VLAN_SETRXTAGMODE_ACK 0x07
-
-/**
- * @def IX_ETHNPE_VLAN_SETDEFAULTRXVID_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_VLAN_SETDEFAULTRXVID message.
- */
-#define IX_ETHNPE_VLAN_SETDEFAULTRXVID_ACK 0x08
-
-/**
- * @def IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY message.
- */
-#define IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY_ACK 0x09
-
-/**
- * @def IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE message.
- */
-#define IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE_ACK 0x0A
-
-/**
- * @def IX_ETHNPE_VLAN_SETRXQOSENTRY_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_VLAN_SETRXQOSENTRY message.
- */
-#define IX_ETHNPE_VLAN_SETRXQOSENTRY_ACK 0x0B
-
-/**
- * @def IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE message.
- */
-#define IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE_ACK 0x0C
-
-/**
- * @def IX_ETHNPE_STP_SETBLOCKINGSTATE_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_STP_SETBLOCKINGSTATE message.
- */
-#define IX_ETHNPE_STP_SETBLOCKINGSTATE_ACK 0x0D
-
-/**
- * @def IX_ETHNPE_FW_SETFIREWALLMODE_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_FW_SETFIREWALLMODE message.
- */
-#define IX_ETHNPE_FW_SETFIREWALLMODE_ACK 0x0E
-
-/**
- * @def IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID message.
- */
-#define IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID_ACK 0x0F
-
-/**
- * @def IX_ETHNPE_PC_SETBBSID_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_PC_SETBBSID message.
- */
-#define IX_ETHNPE_PC_SETBBSID_ACK 0x10
-
-/**
- * @def IX_ETHNPE_PC_SETAPMACTABLE_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_PC_SETAPMACTABLE message.
- */
-#define IX_ETHNPE_PC_SETAPMACTABLE_ACK 0x11
-
-/**
- * @def IX_ETHNPE_SETLOOPBACK_MODE_ACK
- *
- * @brief Acknowledgment to IX_ETHNPE_SETLOOPBACK_MODE message.
- */
-#define IX_ETHNPE_SETLOOPBACK_MODE_ACK (0x12)
-
-/*--------------------------------------------------------------------------
- * Queue Manager Queue entry bit field boundary definitions
- *------------------------------------------------------------------------*/
-
-/**
- * @def MASK(hi,lo)
- *
- * @brief Macro for mask
- */
-#define MASK(hi,lo) (((1 << (1 + ((hi) - (lo)))) - 1) << (lo))
-
-/**
- * @def BITS(x,hi,lo)
- *
- * @brief Macro for bits
- */
-#define BITS(x,hi,lo) (((x) & MASK(hi,lo)) >> (lo))
-
-/**
- * @def IX_ETHNPE_QM_Q_RXENET_LENGTH_MASK
- *
- * @brief QMgr Queue LENGTH field mask
- */
-#define IX_ETHNPE_QM_Q_RXENET_LENGTH_MASK 0x3fff
-
-/**
- * @def IX_ETHNPE_QM_Q_FIELD_FLAG_R
- *
- * @brief QMgr Queue FLAG field right boundary
- */
-#define IX_ETHNPE_QM_Q_FIELD_FLAG_R 20
-
-/**
- * @def IX_ETHNPE_QM_Q_FIELD_FLAG_MASK
- *
- * @brief QMgr Queue FLAG field mask
- *
- * Multicast bit : BIT(4)
- * Broadcast bit : BIT(5)
- * IP bit : BIT(6) (linux only)
- *
- */
-#ifdef __vxworks
-#define IX_ETHNPE_QM_Q_FIELD_FLAG_MASK 0x30
-#else
-#define IX_ETHNPE_QM_Q_FIELD_FLAG_MASK 0x70
-#endif
-
-
-/**
- * @def IX_ETHNPE_QM_Q_FIELD_NPEID_L
- *
- * @brief QMgr Queue NPE ID field left boundary
- */
-#define IX_ETHNPE_QM_Q_FIELD_NPEID_L 1
-
-/**
- * @def IX_ETHNPE_QM_Q_FIELD_NPEID_R
- *
- * @brief QMgr Queue NPE ID field right boundary
- */
-#define IX_ETHNPE_QM_Q_FIELD_NPEID_R 0
-
-/**
- * @def IX_ETHNPE_QM_Q_FIELD_PRIOR_L
- *
- * @brief QMgr Queue Priority field left boundary
- */
-#define IX_ETHNPE_QM_Q_FIELD_PRIOR_L 2
-
-/**
- * @def IX_ETHNPE_QM_Q_FIELD_PRIOR_R
- *
- * @brief QMgr Queue Priority field right boundary
- */
-#define IX_ETHNPE_QM_Q_FIELD_PRIOR_R 0
-
-/**
- * @def IX_ETHNPE_QM_Q_FIELD_ADDR_L
- *
- * @brief QMgr Queue Address field left boundary
- */
-#define IX_ETHNPE_QM_Q_FIELD_ADDR_L 31
-
-/**
- * @def IX_ETHNPE_QM_Q_FIELD_ADDR_R
- *
- * @brief QMgr Queue Address field right boundary
- */
-#define IX_ETHNPE_QM_Q_FIELD_ADDR_R 5
-
-/*--------------------------------------------------------------------------
- * Queue Manager Queue entry bit field masks
- *------------------------------------------------------------------------*/
-
-/**
- * @def IX_ETHNPE_QM_Q_FREEENET_ADDR_MASK
- *
- * @brief Macro to mask the Address field of the FreeEnet Queue Manager Entry
- */
-#define IX_ETHNPE_QM_Q_FREEENET_ADDR_MASK \
- MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
- IX_ETHNPE_QM_Q_FIELD_ADDR_R)
-
-/**
- * @def IX_ETHNPE_QM_Q_RXENET_NPEID_MASK
- *
- * @brief Macro to mask the NPE ID field of the RxEnet Queue Manager Entry
- */
-#define IX_ETHNPE_QM_Q_RXENET_NPEID_MASK \
- MASK (IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
- IX_ETHNPE_QM_Q_FIELD_NPEID_R)
-
-/**
- * @def IX_ETHNPE_QM_Q_RXENET_ADDR_MASK
- *
- * @brief Macro to mask the Mbuf Address field of the RxEnet Queue Manager Entry
- */
-#define IX_ETHNPE_QM_Q_RXENET_ADDR_MASK \
- MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
- IX_ETHNPE_QM_Q_FIELD_ADDR_R)
-
-/**
- * @def IX_ETHNPE_QM_Q_TXENET_PRIOR_MASK
- *
- * @brief Macro to mask the Priority field of the TxEnet Queue Manager Entry
- */
-#define IX_ETHNPE_QM_Q_TXENET_PRIOR_MASK \
- MASK (IX_ETHNPE_QM_Q_FIELD_PRIOR_L, \
- IX_ETHNPE_QM_Q_FIELD_PRIOR_R)
-
-/**
- * @def IX_ETHNPE_QM_Q_TXENET_ADDR_MASK
- *
- * @brief Macro to mask the Mbuf Address field of the TxEnet Queue Manager Entry
- */
-#define IX_ETHNPE_QM_Q_TXENET_ADDR_MASK \
- MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
- IX_ETHNPE_QM_Q_FIELD_ADDR_R)
-
-/**
- * @def IX_ETHNPE_QM_Q_TXENETDONE_NPEID_MASK
- *
- * @brief Macro to mask the NPE ID field of the TxEnetDone Queue Manager Entry
- */
-#define IX_ETHNPE_QM_Q_TXENETDONE_NPEID_MASK \
- MASK (IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
- IX_ETHNPE_QM_Q_FIELD_NPEID_R)
-
-/**
- * @def IX_ETHNPE_QM_Q_TXENETDONE_ADDR_MASK
- *
- * @brief Macro to mask the Mbuf Address field of the TxEnetDone Queue Manager
- * Entry
- */
-#define IX_ETHNPE_QM_Q_TXENETDONE_ADDR_MASK \
- MASK (IX_ETHNPE_QM_Q_FIELD_ADDR_L, \
- IX_ETHNPE_QM_Q_FIELD_ADDR_R)
-
-/*--------------------------------------------------------------------------
- * Queue Manager Queue entry bit field value extraction macros
- *------------------------------------------------------------------------*/
-
-/**
- * @def IX_ETHNPE_QM_Q_FREEENET_ADDR_VAL(x)
- *
- * @brief Extraction macro for Address field of FreeNet Queue Manager Entry
- *
- * Pointer to an mbuf buffer descriptor
- */
-#define IX_ETHNPE_QM_Q_FREEENET_ADDR_VAL(x) \
- ((x) & IX_ETHNPE_QM_Q_FREEENET_ADDR_MASK)
-
-/**
- * @def IX_ETHNPE_QM_Q_RXENET_NPEID_VAL(x)
- *
- * @brief Extraction macro for NPE ID field of RxEnet Queue Manager Entry
- *
- * Set to 0 for entries originating from the Eth0 NPE;
- * Set to 1 for entries originating from the Eth1 NPE.
- */
-#define IX_ETHNPE_QM_Q_RXENET_NPEID_VAL(x) \
- BITS (x, IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
- IX_ETHNPE_QM_Q_FIELD_NPEID_R)
-
-/**
- * @def IX_ETHNPE_QM_Q_RXENET_PORTID_VAL(x)
- *
- * @brief Extraction macro for Port ID field of RxEnet Queue Manager Entry
- *
- * 0-5: Assignable (by the XScale client) to any of the physical ports.
- * 6: It is reserved
- * 7: Indication that the NPE did not find the associated frame's destination MAC address within
- * its internal filtering database.
- */
-#define IX_ETHNPE_QM_Q_RXENET_PORTID_VAL(x) \
- BITS (x, IX_ETHNPE_QM_Q_FIELD_PORTID_L, \
- IX_ETHNPE_QM_Q_Field_PortID_R)
-
-/**
- * @def IX_ETHNPE_QM_Q_RXENET_ADDR_VAL(x)
- *
- * @brief Extraction macro for Address field of RxEnet Queue Manager Entry
- *
- * Pointer to an mbuf buffer descriptor
- */
-#define IX_ETHNPE_QM_Q_RXENET_ADDR_VAL(x) \
- ((x) & IX_ETHNPE_QM_Q_RXENET_ADDR_MASK)
-
-/**
- * @def IX_ETHNPE_QM_Q_TXENET_PRIOR_VAL(x)
- *
- * @brief Extraction macro for Priority field of TxEnet Queue Manager Entry
- *
- * Priority of the packet (as described in IEEE 802.1D). This field is
- * cleared upon return from the Ethernet NPE to the TxEnetDone queue.
- */
-#define IX_ETHNPE_QM_Q_TXENET_PRIOR_VAL(x) \
- BITS (x, IX_ETHNPE_QM_Q_FIELD_PRIOR_L, \
- IX_ETHNPE_QM_Q_FIELD_PRIOR_R)
-
-/**
- * @def IX_ETHNPE_QM_Q_TXENET_ADDR_VAL(x)
- *
- * @brief Extraction macro for Address field of Queue Manager TxEnet Queue
- * Manager Entry
- *
- * Pointer to an mbuf buffer descriptor
- */
-#define IX_ETHNPE_QM_Q_TXENET_ADDR_VAL(x) \
- ((x) & IX_ETHNPE_QM_Q_TXENET_ADDR_MASK)
-
-/**
- * @def IX_ETHNPE_QM_Q_TXENETDONE_NPEID_VAL(x)
- *
- * @brief Extraction macro for NPE ID field of TxEnetDone Queue Manager Entry
- *
- * Set to 0 for entries originating from the Eth0 NPE; set to 1 for en-tries
- * originating from the Eth1 NPE.
- */
-#define IX_ETHNPE_QM_Q_TXENETDONE_NPEID_VAL(x) \
- BITS (x, IX_ETHNPE_QM_Q_FIELD_NPEID_L, \
- IX_ETHNPE_QM_Q_FIELD_NPEID_R)
-
-/**
- * @def IX_ETHNPE_QM_Q_TXENETDONE_ADDR_VAL(x)
- *
- * @brief Extraction macro for Address field of TxEnetDone Queue Manager Entry
- *
- * Pointer to an mbuf buffer descriptor
- */
-#define IX_ETHNPE_QM_Q_TXENETDONE_ADDR_VAL(x) \
- ((x) & IX_ETHNPE_QM_Q_TXENETDONE_ADDR_MASK)
-
-
-/*--------------------------------------------------------------------------
- * NPE limits
- *------------------------------------------------------------------------*/
-
-/**
- * @def IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MIN
- *
- * @brief Macro to check the minimum length of a rx free buffer
- */
-#define IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MIN (64)
-
-/**
- * @def IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MASK
- *
- * @brief Mask to apply to the mbuf length before submitting it to the NPE
- * (the NPE handles only rx free mbufs which are multiple of 64)
- *
- * @sa IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MASK
- */
-#define IX_ETHNPE_ACC_RXFREE_BUFFER_LENGTH_MASK (~63)
-
-/**
- * @def IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_UP(size)
- *
- * @brief Round up to get the size necessary to receive without chaining
- * the frames which are (size) bytes (the NPE operates by multiple of 64)
- * e.g. To receive 1514 bytes frames, the size of the buffers in replenish
- * has to be at least (1514+63)&(~63) = 1536 bytes.
- *
- */
-#define IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_UP(size) (((size) + 63) & ~63)
-
-/**
- * @def IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_DOWN(size)
- *
- * @brief Round down to apply to the mbuf length before submitting
- * it to the NPE. (the NPE operates by multiple of 64)
- *
- */
-#define IX_ETHNPE_ACC_RXFREE_BUFFER_ROUND_DOWN(size) ((size) & ~63)
-
-/**
- * @def IX_ETHNPE_ACC_FRAME_LENGTH_MAX
- *
- * @brief maximum mbuf length supported by the NPE
- *
- * @sa IX_ETHNPE_ACC_FRAME_LENGTH_MAX
- */
-#define IX_ETHNPE_ACC_FRAME_LENGTH_MAX (16320)
-
-/**
- * @def IX_ETHNPE_ACC_FRAME_LENGTH_DEFAULT
- *
- * @brief default mbuf length supported by the NPE
- *
- * @sa IX_ETHNPE_ACC_FRAME_LENGTH_DEFAULT
- */
-#define IX_ETHNPE_ACC_FRAME_LENGTH_DEFAULT (1522)
-
-/**
- * @def IX_ETHNPE_ACC_LENGTH_OFFSET
- *
- * @brief Offset of the cluster length field in the word shared with the NPEs
- */
-#define IX_ETHNPE_ACC_LENGTH_OFFSET 16
-
-/**
- * @def IX_ETHNPE_ACC_PKTLENGTH_MASK
- *
- * @brief Mask of the cluster length field in the word shared with the NPEs
- */
-#define IX_ETHNPE_ACC_PKTLENGTH_MASK 0x3fff
-
-
-/**
- *@}
- */
-
-#endif /* __doxygen_HIDE */
diff --git a/cpu/ixp/npe/include/IxFeatureCtrl.h b/cpu/ixp/npe/include/IxFeatureCtrl.h
deleted file mode 100644
index dabc38e25e..0000000000
--- a/cpu/ixp/npe/include/IxFeatureCtrl.h
+++ /dev/null
@@ -1,742 +0,0 @@
-/**
- * @file IxFeatureCtrl.h
- *
- * @date 30-Jan-2003
-
- * @brief This file contains the public API of the IXP400 Feature Control
- * component.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-/* ------------------------------------------------------
- Doxygen group definitions
- ------------------------------------------------------ */
-/**
- * @defgroup IxFeatureCtrlAPI IXP400 Feature Control (IxFeatureCtrl) API
- *
- * @brief The Public API for the IXP400 Feature Control.
- *
- * @{
- */
-
-#ifndef IXFEATURECTRL_H
-#define IXFEATURECTRL_H
-
-/*
- * User defined include files
- */
-#include "IxOsal.h"
-
-/*
- * #defines and macros
- */
-
-/*************************************************************
- * The following are IxFeatureCtrlComponentCheck return values.
- ************************************************************/
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURE_CTRL_COMPONENT_DISABLED
- *
- * @brief Hardware Component is disabled/unavailable.
- * Return status by ixFeatureCtrlComponentCheck()
- */
-#define IX_FEATURE_CTRL_COMPONENT_DISABLED 0
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURE_CTRL_COMPONENT_ENABLED
- *
- * @brief Hardware Component is available.
- * Return status by ixFeatureCtrlComponentCheck()
- */
-#define IX_FEATURE_CTRL_COMPONENT_ENABLED 1
-
-/***********************************************************************************
- * Product ID in XScale CP15 - Register 0
- * - It contains information on the maximum XScale Core Frequency and
- * Silicon Stepping.
- * - XScale Core Frequency Id indicates only the maximum XScale frequency
- * achievable and not the running XScale frequency (maybe stepped down).
- * - The register is read by using ixFeatureCtrlProductIdRead.
- * - Usage example:
- * productId = ixFeatureCtrlProductIdRead();
- * if( (productId & IX_FEATURE_CTRL_SILICON_STEPPING_MASK) ==
- * IX_FEATURE_CTRL_SILICON_TYPE_A0 )
- * if( (productId & IX_FEATURE_CTRL_XSCALE_FREQ_MASK) ==
- * IX_FEATURE_CTRL_XSCALE_FREQ_533 )
- *
- * 31 28 27 24 23 20 19 16 15 12 11 9 8 4 3 0
- * --------------------------------------------------------------------------------
- * | 0x6 | 0x9 | 0x0 | 0x5 | 0x4 | Device ID | XScale Core Freq Id | Si Stepping Id |
- * --------------------------------------------------------------------------------
- *
- * Maximum Achievable XScale Core Frequency Id : 533MHz - 0x1C
- * 400MHz - 0x1D
- * 266MHz - 0x1F
- *
- * <b>THE CORE FREQUENCY ID IS NOT APPLICABLE TO IXP46X <\b>
- *
- * The above is applicable to IXP42X only. CP15 in IXP46X does not contain any
- * Frequency ID.
- *
- * Si Stepping Id : A - 0x0
- * B - 0x1
- *
- * XScale Core freq Id - Device ID [11:9] : IXP42X - 0x0
- * IXP46X - 0x1
- *************************************************************************************/
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURE_CTRL_SILICON_TYPE_A0
- *
- * @brief This is the value of A0 Silicon in product ID.
- */
-#define IX_FEATURE_CTRL_SILICON_TYPE_A0 0
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURE_CTRL_SILICON_TYPE_B0
- *
- * @brief This is the value of B0 Silicon in product ID.
- */
-#define IX_FEATURE_CTRL_SILICON_TYPE_B0 1
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURE_CTRL_SILICON_STEPPING_MASK
- *
- * @brief This is the mask of silicon stepping in product ID.
- */
-#define IX_FEATURE_CTRL_SILICON_STEPPING_MASK 0xF
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURE_CTRL_DEVICE_TYPE_MASK
- *
- * @brief This is the mask of silicon stepping in product ID.
- */
-#define IX_FEATURE_CTRL_DEVICE_TYPE_MASK (0x7)
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURE_CTRL_DEVICE_TYPE_OFFSET
- *
- * @brief This is the mask of silicon stepping in product ID.
- */
-#define IX_FEATURE_CTRL_DEVICE_TYPE_OFFSET 9
-
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURE_CTRL_XSCALE_FREQ_533
- *
- * @brief This is the value of 533MHz XScale Core in product ID.
- */
-#define IX_FEATURE_CTRL_XSCALE_FREQ_533 ((0x1C)<<4)
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURE_CTRL_XSCALE_FREQ_400
- *
- * @brief This is the value of 400MHz XScale Core in product ID.
- */
-#define IX_FEATURE_CTRL_XSCALE_FREQ_400 ((0x1D)<<4)
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURE_CTRL_XSCALE_FREQ_266
- *
- * @brief This is the value of 266MHz XScale Core in product ID.
- */
-#define IX_FEATURE_CTRL_XSCALE_FREQ_266 ((0x1F)<<4)
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURE_CTRL_XSCALE_FREQ_MASK
- *
- * @brief This is the mask of XScale Core in product ID.
- */
-#define IX_FEATURE_CTRL_XSCALE_FREQ_MASK ((0xFF)<<4)
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURECTRL_REG_UTOPIA_32PHY
- *
- * @brief Maximum UTOPIA PHY available is 32.
- *
- */
-#define IX_FEATURECTRL_REG_UTOPIA_32PHY 0x0
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURECTRL_REG_UTOPIA_16PHY
- *
- * @brief Maximum UTOPIA PHY available is 16.
- *
- */
-#define IX_FEATURECTRL_REG_UTOPIA_16PHY 0x1
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURECTRL_REG_UTOPIA_8PHY
- *
- * @brief Maximum UTOPIA PHY available to is 8.
- *
- */
-#define IX_FEATURECTRL_REG_UTOPIA_8PHY 0x2
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURECTRL_REG_UTOPIA_4PHY
- *
- * @brief Maximum UTOPIA PHY available to is 4.
- *
- */
-#define IX_FEATURECTRL_REG_UTOPIA_4PHY 0x3
-
-#ifdef __ixp46X
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURECTRL_REG_XSCALE_533FREQ
- *
- * @brief Maximum frequency available to IXP46x is 533 MHz.
- *
- */
-#define IX_FEATURECTRL_REG_XSCALE_533FREQ 0x0
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURECTRL_REG_XSCALE_667FREQ
- *
- * @brief Maximum frequency available to IXP46x is 667 MHz.
- *
- */
-#define IX_FEATURECTRL_REG_XSCALE_667FREQ 0x1
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURECTRL_REG_XSCALE_400FREQ
- *
- * @brief Maximum frequency available to IXP46x is 400 MHz.
- *
- */
-#define IX_FEATURECTRL_REG_XSCALE_400FREQ 0x2
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURECTRL_REG_XSCALE_266FREQ
- *
- * @brief Maximum frequency available to IXP46x is 266 MHz.
- *
- */
-#define IX_FEATURECTRL_REG_XSCALE_266FREQ 0x3
-
-#endif /* __ixp46X */
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURECTRL_COMPONENT_NOT_AVAILABLE
- *
- * @brief Component selected is not available for device
- *
- */
-#define IX_FEATURECTRL_COMPONENT_NOT_AVAILABLE 0x0000
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @def IX_FEATURECTRL_COMPONENT_ALWAYS_AVAILABLE
- *
- * @brief Component selected is not available for device
- *
- */
-#define IX_FEATURECTRL_COMPONENT_ALWAYS_AVAILABLE 0xffff
-
-/**
- * @defgroup IxFeatureCtrlSwConfig Software Configuration for Access Component
- *
- * @ingroup IxFeatureCtrlAPI
- *
- * @brief This section describes software configuration in access component. The
- * configuration can be changed at run-time. ixFeatureCtrlSwConfigurationCheck( )
- * will be used across applicable access component to check the configuration.
- * ixFeatureCtrlSwConfigurationWrite( ) is used to write the software configuration.
- *
- * @note <b>All software configurations are default to be enabled.</b>
- *
- * @{
- */
-/**
- * @ingroup IxFeatureCtrlSwConfig
- *
- * @def IX_FEATURE_CTRL_SWCONFIG_DISABLED
- *
- * @brief Software configuration is disabled.
- *
- */
-#define IX_FEATURE_CTRL_SWCONFIG_DISABLED 0
-
-/**
- * @ingroup IxFeatureCtrlSwConfig
- *
- * @def IX_FEATURE_CTRL_SWCONFIG_ENABLED
- *
- * @brief Software configuration is enabled.
- *
- */
-#define IX_FEATURE_CTRL_SWCONFIG_ENABLED 1
-
-/**
- * Section for enums
- **/
-
-/**
- * @ingroup IxFeatureCtrlBuildDevice
- *
- * @enum IxFeatureCtrlBuildDevice
- *
- * @brief Indicates software build type.
- *
- * Default build type is IXP42X
- *
- */
-typedef enum
-{
- IX_FEATURE_CTRL_SW_BUILD_IXP42X = 0, /**<Build type is IXP42X */
- IX_FEATURE_CTRL_SW_BUILD_IXP46X /**<Build type is IXP46X */
-} IxFeatureCtrlBuildDevice;
-
-/**
- * @ingroup IxFeatureCtrlSwConfig
- *
- * @enum IxFeatureCtrlSwConfig
- *
- * @brief Enumeration for software configuration in access components.
- *
- * Entry for new run-time software configuration should be added here.
- */
-typedef enum
-{
- IX_FEATURECTRL_ETH_LEARNING = 0, /**< EthDB Learning Feature */
- IX_FEATURECTRL_ORIGB0_DISPATCHER, /**< IXP42X B0 and IXP46X dispatcher without
- livelock prevention functionality Feature */
- IX_FEATURECTRL_SWCONFIG_MAX /**< Maximum boudary for IxFeatureCtrlSwConfig */
-} IxFeatureCtrlSwConfig;
-
-
-/************************************************************************
- * IXP400 Feature Control Register
- * - It contains the information (available/unavailable) of IXP425&IXP46X
- * hardware components in their corresponding bit location.
- * - Bit value of 0 means the hardware component is available
- * or not software disabled. Hardware component that is available
- * can be software disabled.
- * - Bit value of 1 means the hardware is unavailable or software
- * disabled.Hardware component that is unavailable cannot be software
- * enabled.
- * - Use ixFeatureCtrlHwCapabilityRead() to read the hardware component's
- * availability.
- * - Use ixFeatureCtrlRead() to get the current IXP425/IXP46X feature control
- * register value.
- *
- * Bit Field Description (Hardware Component Availability)
- * --- ---------------------------------------------------
- * 0 RComp Circuitry
- * 1 USB Controller
- * 2 Hashing Coprocessor
- * 3 AES Coprocessor
- * 4 DES Coprocessor
- * 5 HDLC Coprocessor
- * 6 AAL Coprocessor - Always available in IXP46X
- * 7 HSS Coprocesspr
- * 8 Utopia Coprocessor
- * 9 Ethernet 0 Coprocessor
- * 10 Ethernet 1 Coprocessor
- * 11 NPE A
- * 12 NPE B
- * 13 NPE C
- * 14 PCI Controller
- * 15 ECC/TimeSync Coprocessor - Only applicable to IXP46X
- * 16-17 Utopia PHY Limit Status : 0x0 - 32 PHY
- * 0x1 - 16 PHY
- * 0x2 - 8 PHY
- * 0x3 - 4 PHY
- *
- * Portions below are only applicable to IXP46X
- * 18 USB Host Coprocessor
- * 19 NPE A Ethernet - 0 for Enable if Utopia = 1
- * 20 NPE B Ethernet coprocessor 1-3.
- * 21 RSA Crypto Block coprocessor.
- * 22-23 Processor frequency : 0x0 - 533 MHz
- * 0x1 - 667 MHz
- * 0x2 - 400 MHz
- * 0x3 - 266 MHz
- * 24-31 Reserved
- *
- ************************************************************************/
-/*Section generic to both IXP42X and IXP46X*/
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @enum IxFeatureCtrlComponentType
- *
- * @brief Enumeration for components availavble
- *
- */
-typedef enum
-{
- IX_FEATURECTRL_RCOMP = 0, /**<bit location for RComp Circuitry*/
- IX_FEATURECTRL_USB, /**<bit location for USB Controller*/
- IX_FEATURECTRL_HASH, /**<bit location for Hashing Coprocessor*/
- IX_FEATURECTRL_AES, /**<bit location for AES Coprocessor*/
- IX_FEATURECTRL_DES, /**<bit location for DES Coprocessor*/
- IX_FEATURECTRL_HDLC, /**<bit location for HDLC Coprocessor*/
- IX_FEATURECTRL_AAL, /**<bit location for AAL Coprocessor*/
- IX_FEATURECTRL_HSS, /**<bit location for HSS Coprocessor*/
- IX_FEATURECTRL_UTOPIA, /**<bit location for UTOPIA Coprocessor*/
- IX_FEATURECTRL_ETH0, /**<bit location for Ethernet 0 Coprocessor*/
- IX_FEATURECTRL_ETH1, /**<bit location for Ethernet 1 Coprocessor*/
- IX_FEATURECTRL_NPEA, /**<bit location for NPE A*/
- IX_FEATURECTRL_NPEB, /**<bit location for NPE B*/
- IX_FEATURECTRL_NPEC, /**<bit location for NPE C*/
- IX_FEATURECTRL_PCI, /**<bit location for PCI Controller*/
- IX_FEATURECTRL_ECC_TIMESYNC, /**<bit location for TimeSync Coprocessor*/
- IX_FEATURECTRL_UTOPIA_PHY_LIMIT, /**<bit location for Utopia PHY Limit Status*/
- IX_FEATURECTRL_UTOPIA_PHY_LIMIT_BIT2, /**<2nd bit of PHY limit status*/
- IX_FEATURECTRL_USB_HOST_CONTROLLER, /**<bit location for USB host controller*/
- IX_FEATURECTRL_NPEA_ETH, /**<bit location for NPE-A Ethernet Disable*/
- IX_FEATURECTRL_NPEB_ETH, /**<bit location for NPE-B Ethernet 1-3 Coprocessors Disable*/
- IX_FEATURECTRL_RSA, /**<bit location for RSA Crypto block Coprocessors Disable*/
- IX_FEATURECTRL_XSCALE_MAX_FREQ, /**<bit location for XScale max frequency*/
- IX_FEATURECTRL_XSCALE_MAX_FREQ_BIT2, /**<2nd xscale max freq bit NOT TO BE USED */
- IX_FEATURECTRL_MAX_COMPONENTS
-} IxFeatureCtrlComponentType;
-
-/**
- * @ingroup IxFeatureCtrlDeviceId
- *
- * @enum IxFeatureCtrlDeviceId
- *
- * @brief Enumeration for device type.
- *
- * @warning This enum is closely related to the npe image. Its format should comply
- * with formats used in the npe image ImageID. This is indicated by the
- * first nibble of the image ID. This should also be in sync with the
- * with what is defined in CP15. Current available formats are
- * - IXP42X - 0000
- * - IXP46X - 0001
- *
- */
-typedef enum
-{
- IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X = 0, /**<Device type is IXP42X */
- IX_FEATURE_CTRL_DEVICE_TYPE_IXP46X, /**<Device type is IXP46X */
- IX_FEATURE_CTRL_DEVICE_TYPE_MAX /**<Max devices */
-} IxFeatureCtrlDeviceId;
-
-
-/**
- * @} addtogroup IxFeatureCtrlSwConfig
- */
-
-/*
- * Typedefs
- */
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @typedef IxFeatureCtrlReg
- *
- * @brief Feature Control Register that contains hardware components'
- * availability information.
- */
-typedef UINT32 IxFeatureCtrlReg;
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @typedef IxFeatureCtrlProductId
- *
- * @brief Product ID of Silicon that contains Silicon Stepping and
- * Maximum XScale Core Frequency information.
- */
-typedef UINT32 IxFeatureCtrlProductId;
-
-/*
- * Prototypes for interface functions
- */
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @fn IxFeatureCtrlReg ixFeatureCtrlRead (void)
- *
- * @brief This function reads out the CURRENT value of Feature Control Register.
- * The current value may not be the same as that of the hardware component
- * availability.
- *
- * The bit location of each hardware component is defined above.
- * A value of '1' in bit means the hardware component is not available. A value of '0'
- * means the hardware component is available.
- *
- * @return
- * - IxFeatureCtrlReg - the current value of IXP400 Feature Control Register
- */
-PUBLIC IxFeatureCtrlReg
-ixFeatureCtrlRead (void);
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @fn IxFeatureDeviceId ixFeatureCtrlDeviceRead (void)
- *
- * @brief This function gets the type of device that the software is currently running
- * on
- *
- * This function reads the feature Ctrl register specifically to obtain the device id.
- * The definitions of the avilable IDs are as above.
- *
- * @return
- * - IxFeatureCtrlDeviceId - the type of device currently running
- */
-IxFeatureCtrlDeviceId
-ixFeatureCtrlDeviceRead (void);
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @fn IxFeatureCtrlBuildDevice ixFeatureCtrlSoftwareBuildGet (void)
- *
- * @brief This function refers to the value set by the compiler flag to determine
- * the type of device the software is built for.
- *
- * The function reads the compiler flag to determine the device the software is
- * built for. When the user executes build in the command line,
- * a compile time flag (__ixp42X/__ixp46X is set. This API reads this
- * flag and returns the software build type to the calling client.
- *
- * @return
- * - IxFeatureCtrlBuildDevice - the type of device software is built for.
- */
-IxFeatureCtrlBuildDevice
-ixFeatureCtrlSoftwareBuildGet (void);
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @fn IxFeatureCtrlReg ixFeatureCtrlHwCapabilityRead (void)
- *
- * @brief This function reads out the hardware capability of a silicon type as defined in
- * feature control register.This value is different from that returned by
- * ixFeatureCtrlRead() because this function returns the actual hardware component
- * availability.
- *
- * The bit location of each hardware component is defined above.
- * A value of '1' in bit means the hardware component is not available. A value of '0'
- * means the hardware component is available.
- *
- * @return
- * - IxFeatureCtrlReg - the hardware capability of IXP400.
- *
- * @warning
- * - This function must not be called when IXP400 is running as the result
- * is undefined.
- */
-PUBLIC IxFeatureCtrlReg
-ixFeatureCtrlHwCapabilityRead (void);
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @fn void ixFeatureCtrlWrite (IxFeatureCtrlReg expUnitReg)
- *
- * @brief This function write the value stored in IxFeatureCtrlReg expUnitReg
- * to the Feature Control Register.
- *
- * The bit location of each hardware component is defined above.
- * The write is only effective on available hardware components. Writing '1' in a
- * bit will software disable the respective hardware component. A '0' will mean that
- * the hardware component will remain to be operable.
- *
- * @param expUnitReg @ref IxFeatureCtrlReg [in] - The value to be written to feature control
- * register.
- *
- * @return none
- *
- */
-PUBLIC void
-ixFeatureCtrlWrite (IxFeatureCtrlReg expUnitReg);
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @fn IX_STATUS ixFeatureCtrlComponentCheck (IxFeatureCtrlComponentType componentType)
- *
- * @brief This function will check the availability of hardware component specified
- * as componentType value.
- *
- * Usage Example:<br>
- * - if(IX_FEATURE_CTRL_COMPONENT_DISABLED !=
- * ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH0)) <br>
- * - if(IX_FEATURE_CTRL_COMPONENT_ENABLED ==
- * ixFeatureCtrlComponentCheck(IX_FEATURECTRL_PCI)) <br>
- *
- * This function is typically called during component initialization time.
- *
- * @param componentType @ref IxFeatureCtrlComponentType [in] - the type of a component as
- * defined above as IX_FEATURECTRL_XXX (Exp: IX_FEATURECTRL_PCI, IX_FEATURECTRL_ETH0)
-
- *
- * @return
- * - IX_FEATURE_CTRL_COMPONENT_ENABLED if component is available
- * - IX_FEATURE_CTRL_COMPONENT_DISABLED if component is unavailable
- */
-PUBLIC IX_STATUS
-ixFeatureCtrlComponentCheck (IxFeatureCtrlComponentType componentType);
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @fn IxFeatureCtrlProductId ixFeatureCtrlProductIdRead (void)
- *
- * @brief This function will return IXP400 product ID i.e. CP15,
- * Register 0.
- *
- * @return
- * - IxFeatureCtrlProductId - the value of product ID.
- *
- */
-PUBLIC IxFeatureCtrlProductId
-ixFeatureCtrlProductIdRead (void) ;
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @fn IX_STATUS ixFeatureCtrlSwConfigurationCheck (IxFeatureCtrlSwConfig swConfigType)
- *
- * @brief This function checks whether the specified software configuration is
- * enabled or disabled.
- *
- * Usage Example:<br>
- * - if(IX_FEATURE_CTRL_SWCONFIG_DISABLED !=
- * ixFeatureCtrlSwConfigurationCheck(IX_FEATURECTRL_ETH_LEARNING)) <br>
- * - if(IX_FEATURE_CTRL_SWCONFIG_ENABLED ==
- * ixFeatureCtrlSwConfigurationCheck(IX_FEATURECTRL_ETH_LEARNING)) <br>
- *
- * This function is typically called during access component initialization time.
- *
- * @param swConfigType @ref IxFeatureCtrlSwConfig [in] - the type of a software configuration
- * defined in IxFeatureCtrlSwConfig enumeration.
- *
- * @return
- * - IX_FEATURE_CTRL_SWCONFIG_ENABLED if software configuration is enabled.
- * - IX_FEATURE_CTRL_SWCONFIG_DISABLED if software configuration is disabled.
- */
-PUBLIC IX_STATUS
-ixFeatureCtrlSwConfigurationCheck (IxFeatureCtrlSwConfig swConfigType);
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @fn void ixFeatureCtrlSwConfigurationWrite (IxFeatureCtrlSwConfig swConfigType, BOOL enabled)
- *
- * @brief This function enable/disable the specified software configuration.
- *
- * Usage Example:<br>
- * - ixFeatureCtrlSwConfigurationWrite(IX_FEATURECTRL_ETH_LEARNING, TRUE) is used
- * to enable Ethernet Learning Feature <br>
- * - ixFeatureCtrlSwConfigurationWrite(IX_FEATURECTRL_ETH_LEARNING, FALSE) is used
- * to disable Ethernet Learning Feature <br>
- *
- * @param swConfigType IxFeatureCtrlSwConfig [in] - the type of a software configuration
- * defined in IxFeatureCtrlSwConfig enumeration.
- * @param enabled BOOL [in] - To enable(TRUE) / disable (FALSE) the specified software
- * configuration.
- *
- * @return none
- *
- */
-PUBLIC void
-ixFeatureCtrlSwConfigurationWrite (IxFeatureCtrlSwConfig swConfigType, BOOL enabled);
-
-/**
- * @ingroup IxFeatureCtrlAPI
- *
- * @fn void ixFeatureCtrlIxp400SwVersionShow (void)
- *
- * @brief This function shows the current software release information for IXP400
- *
- * @return none
- *
- */
-PUBLIC void
-ixFeatureCtrlIxp400SwVersionShow (void);
-
-#endif /* IXFEATURECTRL_H */
-
-/**
- * @} defgroup IxFeatureCtrlAPI
- */
diff --git a/cpu/ixp/npe/include/IxHssAcc.h b/cpu/ixp/npe/include/IxHssAcc.h
deleted file mode 100644
index 07bb119b0b..0000000000
--- a/cpu/ixp/npe/include/IxHssAcc.h
+++ /dev/null
@@ -1,1316 +0,0 @@
-/**
- * @file IxHssAcc.h
- *
- * @date 07-DEC-2001
- *
- * @brief This file contains the public API of the IXP400 HSS Access
- * component
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/* ------------------------------------------------------
- Doxygen group definitions
- ------------------------------------------------------ */
-/**
- * @defgroup IxHssAccAPI IXP400 HSS Access (IxHssAcc) API
- *
- * @brief The public API for the IXP400 HssAccess component
- *
- * IxHssAcc is the access layer to the HSS packetised and channelised
- * services
- *
- * <b> Design Notes </b><br>
- * <UL>
- * <LI>When a packet-pipe is configured for 56Kbps RAW mode, byte alignment of
- * the transmitted data is not preserved. All raw data that is transmitted
- * will be received in proper order by the receiver, but the first bit of
- * the packet may be seen at any offset within a byte; all subsequent bytes
- * will have the same offset for the duration of the packet. The same offset
- * also applies to all subsequent packets received on the packet-pipe too.
- * (Similar results will occur for data received from remote end.) While
- * this behavior will also occur for 56Kbps HDLC mode, the HDLC
- * encoding/decoding will preserve the original byte alignment at the
- * receiver end.
- * </UL>
- *
- * <b> 56Kbps Packetised Service Bandwidth Limitation </b><br>
- * <UL>
- * <LI>IxHssAcc supports 56Kbps packetised service at a maximum aggregate rate
- * for all HSS ports/HDLC channels of 12.288Mbps[1] in each direction, i.e.
- * it supports 56Kbps packetised service on up to 8 T1 trunks. It does
- * not support 56Kbps packetised service on 8 E1 trunks (i.e. 4 trunks per
- * HSS port) unless those trunks are running 'fractional E1' with maximum
- * aggregate rate of 12.288 Mbps in each direction.<br>
- * [1] 12.288Mbps = 1.536Mbp * 8 T1
- * </UL>
- * @{ */
-
-#ifndef IXHSSACC_H
-#define IXHSSACC_H
-
-#include "IxOsal.h"
-
-/*
- * #defines for function return types, etc.
- */
-
-/**
- * @def IX_HSSACC_TSLOTS_PER_HSS_PORT
- *
- * @brief The max number of TDM timeslots supported per HSS port - 4E1's =
- * 32x4 = 128
- */
-#define IX_HSSACC_TSLOTS_PER_HSS_PORT 128
-
-/* -----------------------------------------------------------
- The following are HssAccess return values returned through
- service interfaces. The globally defined IX_SUCCESS (0) and
- IX_FAIL (1) in IxOsalTypes.h are also used.
- ----------------------------------------------------------- */
-/**
- * @def IX_HSSACC_PARAM_ERR
- *
- * @brief HssAccess function return value for a parameter error
- */
-#define IX_HSSACC_PARAM_ERR 2
-
-/**
- * @def IX_HSSACC_RESOURCE_ERR
- *
- * @brief HssAccess function return value for a resource error
- */
-#define IX_HSSACC_RESOURCE_ERR 3
-
-/**
- * @def IX_HSSACC_PKT_DISCONNECTING
- *
- * @brief Indicates that a disconnect call is progressing and will
- * disconnect soon
- */
-#define IX_HSSACC_PKT_DISCONNECTING 4
-
-/**
- * @def IX_HSSACC_Q_WRITE_OVERFLOW
- *
- * @brief Indicates that an attempt to Tx or to replenish an
- * RxFree Q failed due to Q overflow.
- */
-#define IX_HSSACC_Q_WRITE_OVERFLOW 5
-
-/* -------------------------------------------------------------------
- The following errors are HSS/NPE errors returned on error retrieval
- ------------------------------------------------------------------- */
-/**
- * @def IX_HSSACC_NO_ERROR
- *
- * @brief HSS port no error present
- */
-#define IX_HSSACC_NO_ERROR 0
-
-/**
- * @def IX_HSSACC_TX_FRM_SYNC_ERR
- *
- * @brief HSS port TX Frame Sync error
- */
-#define IX_HSSACC_TX_FRM_SYNC_ERR 1
-
-/**
- * @def IX_HSSACC_TX_OVER_RUN_ERR
- *
- * @brief HSS port TX over-run error
- */
-#define IX_HSSACC_TX_OVER_RUN_ERR 2
-
-/**
- * @def IX_HSSACC_CHANNELISED_SW_TX_ERR
- *
- * @brief NPE software error in channelised TX
- */
-#define IX_HSSACC_CHANNELISED_SW_TX_ERR 3
-
-/**
- * @def IX_HSSACC_PACKETISED_SW_TX_ERR
- *
- * @brief NPE software error in packetised TX
- */
-#define IX_HSSACC_PACKETISED_SW_TX_ERR 4
-
-/**
- * @def IX_HSSACC_RX_FRM_SYNC_ERR
- *
- * @brief HSS port RX Frame Sync error
- */
-#define IX_HSSACC_RX_FRM_SYNC_ERR 5
-
-/**
- * @def IX_HSSACC_RX_OVER_RUN_ERR
- *
- * @brief HSS port RX over-run error
- */
-#define IX_HSSACC_RX_OVER_RUN_ERR 6
-
-/**
- * @def IX_HSSACC_CHANNELISED_SW_RX_ERR
- *
- * @brief NPE software error in channelised RX
- */
-#define IX_HSSACC_CHANNELISED_SW_RX_ERR 7
-
-/**
- * @def IX_HSSACC_PACKETISED_SW_RX_ERR
- *
- * @brief NPE software error in packetised TX
- */
-#define IX_HSSACC_PACKETISED_SW_RX_ERR 8
-
-/* -----------------------------------
- Packetised service specific defines
- ----------------------------------- */
-
-/**
- * @def IX_HSSACC_PKT_MIN_RX_MBUF_SIZE
- *
- * @brief Minimum size of the Rx mbuf in bytes which the client must supply
- * to the component.
- */
-#define IX_HSSACC_PKT_MIN_RX_MBUF_SIZE 64
-
-/* --------------------------------------------------------------------
- Enumerated Types - these enumerated values may be used in setting up
- the contents of hardware registers
- -------------------------------------------------------------------- */
-/**
- * @enum IxHssAccHssPort
- * @brief The HSS port ID - There are two identical ports (0-1).
- *
- */
-typedef enum
-{
- IX_HSSACC_HSS_PORT_0, /**< HSS Port 0 */
- IX_HSSACC_HSS_PORT_1, /**< HSS Port 1 */
- IX_HSSACC_HSS_PORT_MAX /**< Delimiter for error checks */
-} IxHssAccHssPort;
-
-/**
- * @enum IxHssAccHdlcPort
- * @brief The HDLC port ID - There are four identical HDLC ports (0-3) per
- * HSS port and they correspond to the 4 E1/T1 trunks.
- *
- */
-typedef enum
-{
- IX_HSSACC_HDLC_PORT_0, /**< HDLC Port 0 */
- IX_HSSACC_HDLC_PORT_1, /**< HDLC Port 1 */
- IX_HSSACC_HDLC_PORT_2, /**< HDLC Port 2 */
- IX_HSSACC_HDLC_PORT_3, /**< HDLC Port 3 */
- IX_HSSACC_HDLC_PORT_MAX /**< Delimiter for error checks */
-} IxHssAccHdlcPort;
-
-/**
- * @enum IxHssAccTdmSlotUsage
- * @brief The HSS TDM stream timeslot assignment types
- *
- */
-typedef enum
-{
- IX_HSSACC_TDMMAP_UNASSIGNED, /**< Unassigned */
- IX_HSSACC_TDMMAP_HDLC, /**< HDLC - packetised */
- IX_HSSACC_TDMMAP_VOICE56K, /**< Voice56K - channelised */
- IX_HSSACC_TDMMAP_VOICE64K, /**< Voice64K - channelised */
- IX_HSSACC_TDMMAP_MAX /**< Delimiter for error checks */
-} IxHssAccTdmSlotUsage;
-
-/**
- * @enum IxHssAccFrmSyncType
- * @brief The HSS frame sync pulse type
- *
- */
-typedef enum
-{
- IX_HSSACC_FRM_SYNC_ACTIVE_LOW, /**< Frame sync is sampled low */
- IX_HSSACC_FRM_SYNC_ACTIVE_HIGH, /**< sampled high */
- IX_HSSACC_FRM_SYNC_FALLINGEDGE, /**< sampled on a falling edge */
- IX_HSSACC_FRM_SYNC_RISINGEDGE, /**< sampled on a rising edge */
- IX_HSSACC_FRM_SYNC_TYPE_MAX /**< Delimiter for error checks */
-} IxHssAccFrmSyncType;
-
-/**
- * @enum IxHssAccFrmSyncEnable
- * @brief The IxHssAccFrmSyncEnable determines how the frame sync pulse is
- * used
- * */
-typedef enum
-{
- IX_HSSACC_FRM_SYNC_INPUT, /**< Frame sync is sampled as an input */
- IX_HSSACC_FRM_SYNC_INVALID_VALUE, /**< 1 is not used */
- IX_HSSACC_FRM_SYNC_OUTPUT_FALLING, /**< Frame sync is an output generated
- off a falling clock edge */
- IX_HSSACC_FRM_SYNC_OUTPUT_RISING, /**< Frame sync is an output generated
- off a rising clock edge */
- IX_HSSACC_FRM_SYNC_ENABLE_MAX /**< Delimiter for error checks */
-} IxHssAccFrmSyncEnable;
-
-/**
- * @enum IxHssAccClkEdge
- * @brief IxHssAccClkEdge is used to determine the clk edge to use for
- * framing and data
- *
- */
-typedef enum
-{
- IX_HSSACC_CLK_EDGE_FALLING, /**< Clock sampled off a falling edge */
- IX_HSSACC_CLK_EDGE_RISING, /**< Clock sampled off a rising edge */
- IX_HSSACC_CLK_EDGE_MAX /**< Delimiter for error checks */
-} IxHssAccClkEdge;
-
-/**
- * @enum IxHssAccClkDir
- * @brief The HSS clock direction
- *
- */
-typedef enum
-{
- IX_HSSACC_SYNC_CLK_DIR_INPUT, /**< Clock is an input */
- IX_HSSACC_SYNC_CLK_DIR_OUTPUT, /**< Clock is an output */
- IX_HSSACC_SYNC_CLK_DIR_MAX /**< Delimiter for error checks */
-} IxHssAccClkDir;
-
-/**
- * @enum IxHssAccFrmPulseUsage
- * @brief The HSS frame pulse usage
- *
- */
-typedef enum
-{
- IX_HSSACC_FRM_PULSE_ENABLED, /**< Generate/Receive frame pulses */
- IX_HSSACC_FRM_PULSE_DISABLED, /**< Disregard frame pulses */
- IX_HSSACC_FRM_PULSE_MAX /**< Delimiter for error checks */
-} IxHssAccFrmPulseUsage;
-
-/**
- * @enum IxHssAccDataRate
- * @brief The HSS Data rate in relation to the clock
- *
- */
-typedef enum
-{
- IX_HSSACC_CLK_RATE, /**< Data rate is at the configured clk speed */
- IX_HSSACC_HALF_CLK_RATE, /**< Data rate is half the configured clk speed */
- IX_HSSACC_DATA_RATE_MAX /**< Delimiter for error checks */
-} IxHssAccDataRate;
-
-/**
- * @enum IxHssAccDataPolarity
- * @brief The HSS data polarity type
- *
- */
-typedef enum
-{
- IX_HSSACC_DATA_POLARITY_SAME, /**< Don't invert data between NPE and
- HSS FIFOs */
- IX_HSSACC_DATA_POLARITY_INVERT, /**< Invert data between NPE and HSS
- FIFOs */
- IX_HSSACC_DATA_POLARITY_MAX /**< Delimiter for error checks */
-} IxHssAccDataPolarity;
-
-/**
- * @enum IxHssAccBitEndian
- * @brief HSS Data endianness
- *
- */
-typedef enum
-{
- IX_HSSACC_LSB_ENDIAN, /**< TX/RX Least Significant Bit first */
- IX_HSSACC_MSB_ENDIAN, /**< TX/RX Most Significant Bit first */
- IX_HSSACC_ENDIAN_MAX /**< Delimiter for the purposes of error checks */
-} IxHssAccBitEndian;
-
-
-/**
- * @enum IxHssAccDrainMode
- * @brief Tx pin open drain mode
- *
- */
-typedef enum
-{
- IX_HSSACC_TX_PINS_NORMAL, /**< Normal mode */
- IX_HSSACC_TX_PINS_OPEN_DRAIN, /**< Open Drain mode */
- IX_HSSACC_TX_PINS_MAX /**< Delimiter for error checks */
-} IxHssAccDrainMode;
-
-/**
- * @enum IxHssAccSOFType
- * @brief HSS start of frame types
- *
- */
-typedef enum
-{
- IX_HSSACC_SOF_FBIT, /**< Framing bit transmitted and expected on rx */
- IX_HSSACC_SOF_DATA, /**< Framing bit not transmitted nor expected on rx */
- IX_HSSACC_SOF_MAX /**< Delimiter for error checks */
-} IxHssAccSOFType;
-
-/**
- * @enum IxHssAccDataEnable
- * @brief IxHssAccDataEnable is used to determine whether or not to drive
- * the data pins
- *
- */
-typedef enum
-{
- IX_HSSACC_DE_TRI_STATE, /**< TRI-State the data pins */
- IX_HSSACC_DE_DATA, /**< Push data out the data pins */
- IX_HSSACC_DE_MAX /**< Delimiter for error checks */
-} IxHssAccDataEnable;
-
-/**
- * @enum IxHssAccTxSigType
- * @brief IxHssAccTxSigType is used to determine how to drive the data pins
- *
- */
-typedef enum
-{
- IX_HSSACC_TXSIG_LOW, /**< Drive the data pins low */
- IX_HSSACC_TXSIG_HIGH, /**< Drive the data pins high */
- IX_HSSACC_TXSIG_HIGH_IMP, /**< Drive the data pins with high impedance */
- IX_HSSACC_TXSIG_MAX /**< Delimiter for error checks */
-} IxHssAccTxSigType;
-
-/**
- * @enum IxHssAccFbType
- * @brief IxHssAccFbType determines how to drive the Fbit
- *
- * @warning This will only be used for T1 @ 1.544MHz
- *
- */
-typedef enum
-{
- IX_HSSACC_FB_FIFO, /**< Fbit is dictated in FIFO */
- IX_HSSACC_FB_HIGH_IMP, /**< Fbit is high impedance */
- IX_HSSACC_FB_MAX /**< Delimiter for error checks */
-} IxHssAccFbType;
-
-/**
- * @enum IxHssAcc56kEndianness
- * @brief 56k data endianness when using the 56k type
- *
- */
-typedef enum
-{
- IX_HSSACC_56KE_BIT_7_UNUSED, /**< High bit is unused */
- IX_HSSACC_56KE_BIT_0_UNUSED, /**< Low bit is unused */
- IX_HSSACC_56KE_MAX /**< Delimiter for error checks */
-} IxHssAcc56kEndianness;
-
-/**
- * @enum IxHssAcc56kSel
- * @brief 56k data transmission type when using the 56k type
- *
- */
-typedef enum
-{
- IX_HSSACC_56KS_32_8_DATA, /**< 32/8 bit data */
- IX_HSSACC_56KS_56K_DATA, /**< 56K data */
- IX_HSSACC_56KS_MAX /**< Delimiter for error checks */
-} IxHssAcc56kSel;
-
-
-/**
- * @enum IxHssAccClkSpeed
- * @brief IxHssAccClkSpeed represents the HSS clock speeds available
- *
- */
-typedef enum
-{
- IX_HSSACC_CLK_SPEED_512KHZ, /**< 512KHz */
- IX_HSSACC_CLK_SPEED_1536KHZ, /**< 1.536MHz */
- IX_HSSACC_CLK_SPEED_1544KHZ, /**< 1.544MHz */
- IX_HSSACC_CLK_SPEED_2048KHZ, /**< 2.048MHz */
- IX_HSSACC_CLK_SPEED_4096KHZ, /**< 4.096MHz */
- IX_HSSACC_CLK_SPEED_8192KHZ, /**< 8.192MHz */
- IX_HSSACC_CLK_SPEED_MAX /**< Delimiter for error checking */
-} IxHssAccClkSpeed;
-
-/**
- * @enum IxHssAccPktStatus
- * @brief Indicates the status of packets passed to the client
- *
- */
-typedef enum
-{
- IX_HSSACC_PKT_OK, /**< Error free.*/
- IX_HSSACC_STOP_SHUTDOWN_ERROR, /**< Errored due to stop or shutdown
- occurrance.*/
- IX_HSSACC_HDLC_ALN_ERROR, /**< HDLC alignment error */
- IX_HSSACC_HDLC_FCS_ERROR, /**< HDLC Frame Check Sum error.*/
- IX_HSSACC_RXFREE_Q_EMPTY_ERROR, /**< RxFree Q became empty
- while receiving this packet.*/
- IX_HSSACC_HDLC_MAX_FRAME_SIZE_EXCEEDED, /**< HDLC frame size
- received is greater than
- max specified at connect.*/
- IX_HSSACC_HDLC_ABORT_ERROR, /**< HDLC frame received is invalid due to an
- abort sequence received.*/
- IX_HSSACC_DISCONNECT_IN_PROGRESS /**< Packet returned
- because a disconnect is in progress */
-} IxHssAccPktStatus;
-
-
-/**
- * @enum IxHssAccPktCrcType
- * @brief HDLC CRC type
- *
- */
-typedef enum
-{
- IX_HSSACC_PKT_16_BIT_CRC = 16, /**< 16 bit CRC is being used */
- IX_HSSACC_PKT_32_BIT_CRC = 32 /**< 32 bit CRC is being used */
-} IxHssAccPktCrcType;
-
-/**
- * @enum IxHssAccPktHdlcIdleType
- * @brief HDLC idle transmission type
- *
- */
-typedef enum
-{
- IX_HSSACC_HDLC_IDLE_ONES, /**< idle tx/rx will be a succession of ones */
- IX_HSSACC_HDLC_IDLE_FLAGS /**< idle tx/rx will be repeated flags */
-} IxHssAccPktHdlcIdleType;
-
-/**
- * @brief Structure containing HSS port configuration parameters
- *
- * Note: All of these are used for TX. Only some are specific to RX.
- *
- */
-typedef struct
-{
- IxHssAccFrmSyncType frmSyncType; /**< frame sync pulse type (tx/rx) */
- IxHssAccFrmSyncEnable frmSyncIO; /**< how the frame sync pulse is
- used (tx/rx) */
- IxHssAccClkEdge frmSyncClkEdge; /**< frame sync clock edge type
- (tx/rx) */
- IxHssAccClkEdge dataClkEdge; /**< data clock edge type (tx/rx) */
- IxHssAccClkDir clkDirection; /**< clock direction (tx/rx) */
- IxHssAccFrmPulseUsage frmPulseUsage; /**< whether to use the frame sync
- pulse or not (tx/rx) */
- IxHssAccDataRate dataRate; /**< data rate in relation to the
- clock (tx/rx) */
- IxHssAccDataPolarity dataPolarity; /**< data polarity type (tx/rx) */
- IxHssAccBitEndian dataEndianness; /**< data endianness (tx/rx) */
- IxHssAccDrainMode drainMode; /**< tx pin open drain mode (tx) */
- IxHssAccSOFType fBitUsage; /**< start of frame types (tx/rx) */
- IxHssAccDataEnable dataEnable; /**< whether or not to drive the data
- pins (tx) */
- IxHssAccTxSigType voice56kType; /**< how to drive the data pins for
- voice56k type (tx) */
- IxHssAccTxSigType unassignedType; /**< how to drive the data pins for
- unassigned type (tx) */
- IxHssAccFbType fBitType; /**< how to drive the Fbit (tx) */
- IxHssAcc56kEndianness voice56kEndian;/**< 56k data endianness when using
- the 56k type (tx) */
- IxHssAcc56kSel voice56kSel; /**< 56k data transmission type when
- using the 56k type (tx) */
- unsigned frmOffset; /**< frame pulse offset in bits wrt
- the first timeslot (0-1023) (tx/rx) */
- unsigned maxFrmSize; /**< frame size in bits (1-1024)
- (tx/rx) */
-} IxHssAccPortConfig;
-
-/**
- * @brief Structure containing HSS configuration parameters
- *
- */
-typedef struct
-{
- IxHssAccPortConfig txPortConfig; /**< HSS tx port configuration */
- IxHssAccPortConfig rxPortConfig; /**< HSS rx port configuration */
- unsigned numChannelised; /**< The number of channelised
- timeslots (0-32) */
- unsigned hssPktChannelCount; /**< The number of packetised
- clients (0 - 4) */
- UINT8 channelisedIdlePattern; /**< The byte to be transmitted on
- channelised service when there
- is no client data to tx */
- BOOL loopback; /**< The HSS loopback state */
- unsigned packetizedIdlePattern; /**< The data to be transmitted on
- packetised service when there is
- no client data to tx */
- IxHssAccClkSpeed clkSpeed; /**< The HSS clock speed */
-} IxHssAccConfigParams;
-
-/**
- * @brief This structure contains 56Kbps, HDLC-mode configuration parameters
- *
- */
-typedef struct
-{
- BOOL hdlc56kMode; /**< 56kbps(TRUE)/64kbps(FALSE) HDLC */
- IxHssAcc56kEndianness hdlc56kEndian; /**< 56kbps data endianness
- - ignored if hdlc56kMode is FALSE*/
- BOOL hdlc56kUnusedBitPolarity0; /**< The polarity '0'(TRUE)/'1'(FALSE) of the unused
- bit while in 56kbps mode
- - ignored if hdlc56kMode is FALSE*/
-} IxHssAccHdlcMode;
-
-/**
- * @brief This structure contains information required by the NPE to
- * configure the HDLC co-processor
- *
- */
-typedef struct
-{
- IxHssAccPktHdlcIdleType hdlcIdleType; /**< What to transmit when a HDLC port is idle */
- IxHssAccBitEndian dataEndian; /**< The HDLC data endianness */
- IxHssAccPktCrcType crcType; /**< The CRC type to be used for this HDLC port */
-} IxHssAccPktHdlcFraming;
-
-/**
- * @typedef UINT32 IxHssAccPktUserId
- *
- * @brief The client supplied value which will be supplied as a parameter
- * with a given callback.
- *
- * This value will be passed into the ixHssAccPktPortConnect function once each
- * with given callbacks. This value will then be passed back to the client
- * as one of the parameters to each of these callbacks,
- * when these callbacks are called.
- */
-typedef UINT32 IxHssAccPktUserId;
-
-
-/**
- * @typedef IxHssAccLastErrorCallback
- * @brief Prototype of the clients function to accept notification of the
- * last error
- *
- * This function is registered through the config. The client will initiate
- * the last error retrieval. The HssAccess component will send a message to
- * the NPE through the NPE Message Handler. When a response to the read is
- * received, the NPE Message Handler will callback the HssAccess component
- * which will execute this function in the same IxNpeMh context. The client
- * will be passed the last error and the related service port (packetised
- * 0-3, channelised 0)
- *
- * @param lastHssError unsigned [in] - The last Hss error registered that
- * has been registered.
- * @param servicePort unsigned [in] - This is the service port number.
- * (packetised 0-3, channelised 0)
- *
- * @return void
- */
-typedef void (*IxHssAccLastErrorCallback) (unsigned lastHssError,
- unsigned servicePort);
-
-/**
- * @typedef IxHssAccPktRxCallback
- * @brief Prototype of the clients function to accept notification of
- * packetised rx
- *
- * This function is registered through the ixHssAccPktPortConnect. hssPktAcc will pass
- * received data in the form of mbufs to the client. The mbuf passed back
- * to the client could contain a chain of buffers, depending on the packet
- * size received.
- *
- * @param *buffer @ref IX_OSAL_MBUF [in] - This is the mbuf which contains the
- * payload received.
- * @param numHssErrs unsigned [in] - This is the number of hssErrors
- * the Npe has received
- * @param pktStatus @ref IxHssAccPktStatus [in] - This is the status of the
- * mbuf that has been received.
- * @param rxUserId @ref IxHssAccPktUserId [in] - This is the client supplied value
- * passed in at ixHssAccPktPortConnect time which is now returned to the client.
- *
- * @return void
- */
-typedef void (*IxHssAccPktRxCallback) (IX_OSAL_MBUF *buffer,
- unsigned numHssErrs,
- IxHssAccPktStatus pktStatus,
- IxHssAccPktUserId rxUserId);
-
-/**
- * @typedef IxHssAccPktRxFreeLowCallback
- * @brief Prototype of the clients function to accept notification of
- * requirement of more Rx Free buffers
- *
- * The client can choose to register a callback of this type when
- * calling a connecting. This function is registered through the ixHssAccPktPortConnect.
- * If defined, the access layer will provide the trigger for
- * this callback. The callback will be responsible for supplying mbufs to
- * the access layer for use on the receive path from the HSS using
- * ixHssPktAccFreeBufReplenish.
- *
- * @return void
- */
-typedef void (*IxHssAccPktRxFreeLowCallback) (IxHssAccPktUserId rxFreeLowUserId);
-
-/**
- * @typedef IxHssAccPktTxDoneCallback
- * @brief Prototype of the clients function to accept notification of
- * completion with Tx buffers
- *
- * This function is registered through the ixHssAccPktPortConnect. It enables
- * the hssPktAcc to pass buffers back to the client
- * when transmission is complete.
- *
- * @param *buffer @ref IX_OSAL_MBUF [in] - This is the mbuf which contained
- * the payload that was for Tx.
- * @param numHssErrs unsigned [in] - This is the number of hssErrors
- * the Npe has received
- * @param pktStatus @ref IxHssAccPktStatus [in] - This is the status of the
- * mbuf that has been transmitted.
- * @param txDoneUserId @ref IxHssAccPktUserId [in] - This is the client supplied value
- * passed in at ixHssAccPktPortConnect time which is now returned to the client.
- *
- * @return void
- */
-typedef void (*IxHssAccPktTxDoneCallback) (IX_OSAL_MBUF *buffer,
- unsigned numHssErrs,
- IxHssAccPktStatus pktStatus,
- IxHssAccPktUserId txDoneUserId);
-
-/**
- * @typedef IxHssAccChanRxCallback
- * @brief Prototype of the clients function to accept notification of
- * channelised rx
- *
- * This callback, if defined by the client in the connect, will get called
- * in the context of an IRQ. The IRQ will be triggered when the hssSyncQMQ
- * is not empty. The queued entry will be dequeued and this function will
- * be executed.
- *
- * @param hssPortId @ref IxHssAccHssPort - The HSS port Id. There are two
- * identical ports (0-1).
- * @param txOffset unsigned [in] - an offset indicating from where within
- * the txPtrList the NPE is currently transmitting from.
- * @param rxOffset unsigned [in] - an offset indicating where within the
- * receive buffers the NPE has just written the received data to.
- * @param numHssErrs unsigned [in] - This is the number of hssErrors
- * the Npe has received
- *
- * @return void
- */
-typedef void (*IxHssAccChanRxCallback) (IxHssAccHssPort hssPortId,
- unsigned rxOffset,
- unsigned txOffset,
- unsigned numHssErrs);
-
-/*
- * Prototypes for interface functions.
- */
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccPortInit (IxHssAccHssPort hssPortId,
- IxHssAccConfigParams *configParams,
- IxHssAccTdmSlotUsage *tdmMap,
- IxHssAccLastErrorCallback lastHssErrorCallback)
- *
- * @brief Initialise a HSS port. No channelised or packetised connections
- * should exist in the HssAccess layer while this interface is being called.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- * @param *configParams @ref IxHssAccConfigParams [in] - A pointer to the HSS
- * configuration structure
- * @param *tdmMap @ref IxHssAccTdmSlotUsage [in] - A pointer to an array of size
- * IX_HSSACC_TSLOTS_PER_HSS_PORT, defining the slot usage over the HSS port
- * @param lastHssErrorCallback @ref IxHssAccLastErrorCallback [in] - Client
- * callback to report last error
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- */
-PUBLIC IX_STATUS
-ixHssAccPortInit (IxHssAccHssPort hssPortId,
- IxHssAccConfigParams *configParams,
- IxHssAccTdmSlotUsage *tdmMap,
- IxHssAccLastErrorCallback lastHssErrorCallback);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccLastErrorRetrievalInitiate (
- IxHssAccHssPort hssPortId)
- *
- * @brief Initiate the retrieval of the last HSS error. The HSS port
- * should be configured before attempting to call this interface.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - the HSS port ID
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- */
-PUBLIC IX_STATUS
-ixHssAccLastErrorRetrievalInitiate (IxHssAccHssPort hssPortId);
-
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccInit ()
- *
- * @brief This function is responsible for initialising resources for use
- * by the packetised and channelised clients. It should be called after
- * HSS NPE image has been downloaded into NPE-A and before any other
- * HssAccess interface is called.
- * No other HssAccPacketised interface should be called while this interface
- * is being processed.
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_RESOURCE_ERR The function did not execute successfully due
- * to a resource error
- */
-PUBLIC IX_STATUS
-ixHssAccInit (void);
-
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn ixHssAccPktPortConnect (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId,
- BOOL hdlcFraming,
- IxHssAccHdlcMode hdlcMode,
- BOOL hdlcBitInvert,
- unsigned blockSizeInWords,
- UINT32 rawIdleBlockPattern,
- IxHssAccPktHdlcFraming hdlcTxFraming,
- IxHssAccPktHdlcFraming hdlcRxFraming,
- unsigned frmFlagStart,
- IxHssAccPktRxCallback rxCallback,
- IxHssAccPktUserId rxUserId,
- IxHssAccPktRxFreeLowCallback rxFreeLowCallback,
- IxHssAccPktUserId rxFreeLowUserId,
- IxHssAccPktTxDoneCallback txDoneCallback,
- IxHssAccPktUserId txDoneUserId)
- *
- * @brief This function is responsible for connecting a client to one of
- * the 4 available HDLC ports. The HSS port should be configured before
- * attempting a connect. No other HssAccPacketised interface should be
- * called while this connect is being processed.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- * @param hdlcPortId @ref IxHssAccHdlcPort [in] - This is the number of the HDLC port and
- * it corresponds to the physical E1/T1 trunk i.e. 0, 1, 2, 3
- * @param hdlcFraming BOOL [in] - This value determines whether the service
- * will use HDLC data or the debug, raw data type i.e. no HDLC processing
- * @param hdlcMode @ref IxHssAccHdlcMode [in] - This structure contains 56Kbps, HDLC-mode
- * configuration parameters
- * @param hdlcBitInvert BOOL [in] - This value determines whether bit inversion
- * will occur between HDLC and HSS co-processors i.e. post-HDLC processing for
- * transmit and pre-HDLC processing for receive, for the specified HDLC Termination
- * Point
- * @param blockSizeInWords unsigned [in] - The max tx/rx block size
- * @param rawIdleBlockPattern UINT32 [in] - Tx idle pattern in raw mode
- * @param hdlcTxFraming @ref IxHssAccPktHdlcFraming [in] - This structure contains
- * the following information required by the NPE to configure the HDLC
- * co-processor for TX
- * @param hdlcRxFraming @ref IxHssAccPktHdlcFraming [in] - This structure contains
- * the following information required by the NPE to configure the HDLC
- * co-processor for RX
- * @param frmFlagStart unsigned - Number of flags to precede to
- * transmitted flags (0-2).
- * @param rxCallback @ref IxHssAccPktRxCallback [in] - Pointer to
- * the clients packet receive function.
- * @param rxUserId @ref IxHssAccPktUserId [in] - The client supplied rx value
- * to be passed back as an argument to the supplied rxCallback
- * @param rxFreeLowCallback @ref IxHssAccPktRxFreeLowCallback [in] - Pointer to
- * the clients Rx free buffer request function. If NULL, assume client will
- * trigger independently.
- * @param rxFreeLowUserId @ref IxHssAccPktUserId [in] - The client supplied RxFreeLow value
- * to be passed back as an argument to the supplied rxFreeLowCallback
- * @param txDoneCallback @ref IxHssAccPktTxDoneCallback [in] - Pointer to the
- * clients Tx done callback function
- * @param txDoneUserId @ref IxHssAccPktUserId [in] - The client supplied txDone value
- * to be passed back as an argument to the supplied txDoneCallback
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- * - IX_HSSACC_RESOURCE_ERR The function did not execute successfully due
- * to a resource error
- */
-PUBLIC IX_STATUS
-ixHssAccPktPortConnect (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId,
- BOOL hdlcFraming,
- IxHssAccHdlcMode hdlcMode,
- BOOL hdlcBitInvert,
- unsigned blockSizeInWords,
- UINT32 rawIdleBlockPattern,
- IxHssAccPktHdlcFraming hdlcTxFraming,
- IxHssAccPktHdlcFraming hdlcRxFraming,
- unsigned frmFlagStart,
- IxHssAccPktRxCallback rxCallback,
- IxHssAccPktUserId rxUserId,
- IxHssAccPktRxFreeLowCallback rxFreeLowCallback,
- IxHssAccPktUserId rxFreeLowUserId,
- IxHssAccPktTxDoneCallback txDoneCallback,
- IxHssAccPktUserId txDoneUserId);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccPktPortEnable (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId)
- *
- * @brief This function is responsible for enabling a packetised service
- * for the specified HSS/HDLC port combination. It enables the RX flow. The
- * client must have already connected to a packetised service and is responsible
- * for ensuring an adequate amount of RX mbufs have been supplied to the access
- * component before enabling the packetised service. This function must be called
- * on a given port before any call to ixHssAccPktPortTx on the same port.
- * No other HssAccPacketised interface should be called while this interface is
- * being processed.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- * @param hdlcPortId @ref IxHssAccHdlcPort [in] - The port id (0,1,2,3) to enable the service
- * on.
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- */
-PUBLIC IX_STATUS
-ixHssAccPktPortEnable (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId);
-
-/**
- * @fn IX_STATUS ixHssAccPktPortDisable (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId)
- *
- * @brief This function is responsible for disabling a packetised service
- * for the specified HSS/HDLC port combination. It disables the RX flow.
- * The client must have already connected to and enabled a packetised service
- * for the specified HDLC port. This disable interface can be called before a
- * disconnect, but is not required to.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- * @param hdlcPortId @ref IxHssAccHdlcPort [in] - The port id (0,1,2,3) to disable
- * the service on.
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- */
-PUBLIC IX_STATUS
-ixHssAccPktPortDisable (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccPktPortDisconnect (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId)
- *
- * @brief This function is responsible for disconnecting a client from one
- * of the 4 available HDLC ports. It is not required that the Rx Flow
- * has been disabled before calling this function. If the RX Flow has not been
- * disabled, the disconnect will disable it before proceeding with the
- * disconnect. No other HssAccPacketised
- * interface should be called while this interface is being processed.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- * @param hdlcPortId @ref IxHssAccHdlcPort [in] - This is the number of the HDLC port
- * to disconnect and it corresponds to the physical E1/T1 trunk i.e. 0, 1, 2, 3
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PKT_DISCONNECTING The function has initiated the disconnecting
- * procedure but it has not completed yet.
- */
-PUBLIC IX_STATUS
-ixHssAccPktPortDisconnect (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn BOOL ixHssAccPktPortIsDisconnectComplete (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId)
- *
- * @brief This function is called to check if a given HSS/HDLC port
- * combination is in a connected state or not. This function may be called
- * at any time to determine a ports state. No other HssAccPacketised
- * interface should be called while this interface is being processed.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- * @param hdlcPortId @ref IxHssAccHdlcPort [in] - This is the number of the HDLC port
- * to disconnect and it corresponds to the physical E1/T1 trunk i.e. 0, 1, 2, 3
- *
- * @return
- * - TRUE The state of this HSS/HDLC port combination is disconnected,
- * so if a disconnect was called, it is now completed.
- * - FALSE The state of this HSS/HDLC port combination is connected,
- * so if a disconnect was called, it is not yet completed.
- */
-PUBLIC BOOL
-ixHssAccPktPortIsDisconnectComplete (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId);
-
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccPktPortRxFreeReplenish (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId,
- IX_OSAL_MBUF *buffer)
- *
- * @brief Function which the client calls at regular intervals to provide
- * mbufs to the access component for RX. A connection should exist for
- * the specified hssPortId/hdlcPortId combination before attempting to call this
- * interface. Also, the connection should not be in a disconnecting state.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- * @param hdlcPortId @ref IxHssAccHdlcPort [in] - This is the number of the HDLC port
- * and it corresponds to the physical E1/T1 trunk i.e. 0, 1, 2, 3
- * @param *buffer @ref IX_OSAL_MBUF [in] - A pointer to a free mbuf to filled with payload.
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- * - IX_HSSACC_RESOURCE_ERR The function did not execute successfully due
- * to a resource error
- * - IX_HSSACC_Q_WRITE_OVERFLOW The function did not succeed due to a Q
- * overflow
- */
-PUBLIC IX_STATUS
-ixHssAccPktPortRxFreeReplenish (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId,
- IX_OSAL_MBUF *buffer);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccPktPortTx (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId,
- IX_OSAL_MBUF *buffer)
- *
- * @brief Function which the client calls when it wants to transmit
- * packetised data. An enabled connection should exist on the specified
- * hssPortId/hdlcPortId combination before attempting to call this interface.
- * No other HssAccPacketised
- * interface should be called while this interface is being processed.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- * @param hdlcPortId @ref IxHssAccHdlcPort [in] - This is the number of the HDLC port
- * and it corresponds to the physical E1/T1 trunk i.e. 0, 1, 2, 3
- * @param *buffer @ref IX_OSAL_MBUF [in] - A pointer to a chain of mbufs which the
- * client has filled with the payload
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- * - IX_HSSACC_RESOURCE_ERR The function did not execute successfully due
- * to a resource error. See note.
- * - IX_HSSACC_Q_WRITE_OVERFLOW The function did not succeed due to a Q
- * overflow
- *
- * @note IX_HSSACC_RESOURCE_ERR is returned when a free descriptor cannot be
- * obtained to send the chain of mbufs to the NPE. This is a normal scenario.
- * HssAcc has a pool of descriptors and this error means that they are currently
- * all in use.
- * The recommended approach to this is to retry until a descriptor becomes free
- * and the packet is successfully transmitted.
- * Alternatively, the user could wait until the next IxHssAccPktTxDoneCallback
- * callback is triggered, and then retry, as it is this event that causes a
- * transmit descriptor to be freed.
- */
-PUBLIC IX_STATUS
-ixHssAccPktPortTx (IxHssAccHssPort hssPortId,
- IxHssAccHdlcPort hdlcPortId,
- IX_OSAL_MBUF *buffer);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccChanConnect (IxHssAccHssPort hssPortId,
- unsigned bytesPerTSTrigger,
- UINT8 *rxCircular,
- unsigned numRxBytesPerTS,
- UINT32 *txPtrList,
- unsigned numTxPtrLists,
- unsigned numTxBytesPerBlk,
- IxHssAccChanRxCallback rxCallback)
- *
- * @brief This function allows the client to connect to the Tx/Rx NPE
- * Channelised Service. There can only be one client per HSS port. The
- * client is responsible for ensuring that the HSS port is configured
- * appropriately before its connect request. No other HssAccChannelised
- * interface should be called while this interface is being processed.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- * @param bytesPerTSTrigger unsigned [in] - The NPE will trigger the access
- * component after bytesPerTSTrigger have been received for all trunk
- * timeslots. This figure is a multiple of 8 e.g. 8 for 1ms trigger, 16 for
- * 2ms trigger.
- * @param *rxCircular UINT8 [in] - A pointer to memory allocated by the
- * client to be filled by data received. The buffer at this address is part
- * of a pool of buffers to be accessed in a circular fashion. This address
- * will be written to by the NPE. Therefore, it needs to be a physical address.
- * @param numRxBytesPerTS unsigned [in] - The number of bytes allocated per
- * timeslot within the receive memory. This figure will depend on the
- * latency of the system. It needs to be deep enough for data to be read by
- * the client before the NPE re-writes over that memory e.g. if the client
- * samples at a rate of 40bytes per timeslot, numRxBytesPerTS may need to
- * be 40bytes * 3. This would give the client 3 * 5ms of time before
- * received data is over-written.
- * @param *txPtrList UINT32 [in] - The address of an area of contiguous
- * memory allocated by the client to be populated with pointers to data for
- * transmission. Each pointer list contains a pointer per active channel.
- * The txPtrs will point to data to be transmitted by the NPE. Therefore,
- * they must point to physical addresses.
- * @param numTxPtrLists unsigned [in] - The number of pointer lists in
- * txPtrList. This figure is dependent on jitter.
- * @param numTxBytesPerBlk unsigned [in] - The size of the Tx data, in
- * bytes, that each pointer within the PtrList points to.
- * @param rxCallback @ref IxHssAccChanRxCallback [in] - A client function
- * pointer to be called back to handle the actual tx/rx of channelised
- * data. If this is not NULL, an ISR will call this function. If this
- * pointer is NULL, it implies that the client will use a polling mechanism
- * to detect when the tx and rx of channelised data is to occur. The client
- * will use hssChanAccStatus for this.
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- */
-
-PUBLIC IX_STATUS
-ixHssAccChanConnect (IxHssAccHssPort hssPortId,
- unsigned bytesPerTSTrigger,
- UINT8 *rxCircular,
- unsigned numRxBytesPerTS,
- UINT32 *txPtrList,
- unsigned numTxPtrLists,
- unsigned numTxBytesPerBlk,
- IxHssAccChanRxCallback rxCallback);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccChanPortEnable (IxHssAccHssPort hssPortId)
- *
- * @brief This function is responsible for enabling a channelised service
- * for the specified HSS port. It enables the NPE RX flow. The client must
- * have already connected to a channelised service before enabling the
- * channelised service. No other HssAccChannelised
- * interface should be called while this interface is being processed.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- */
-PUBLIC IX_STATUS
-ixHssAccChanPortEnable (IxHssAccHssPort hssPortId);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccChanPortDisable (IxHssAccHssPort hssPortId)
- *
- * @brief This function is responsible for disabling a channelised service
- * for the specified HSS port. It disables the NPE RX flow. The client must
- * have already connected to and enabled a channelised service for the
- * specified HSS port. This disable interface can be called before a
- * disconnect, but is not required to. No other HssAccChannelised
- * interface should be called while this interface is being processed.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- */
-PUBLIC IX_STATUS
-ixHssAccChanPortDisable (IxHssAccHssPort hssPortId);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccChanDisconnect (IxHssAccHssPort hssPortId)
- *
- * @brief This function allows the client to Disconnect from a channelised
- * service. If the NPE RX Flow has not been disabled, the disconnect will
- * disable it before proceeding with other disconnect functionality.
- * No other HssAccChannelised interface should be called while this
- * interface is being processed.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- */
-PUBLIC IX_STATUS
-ixHssAccChanDisconnect (IxHssAccHssPort hssPortId);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn IX_STATUS ixHssAccChanStatusQuery (IxHssAccHssPort hssPortId,
- BOOL *dataRecvd,
- unsigned *rxOffset,
- unsigned *txOffset,
- unsigned *numHssErrs)
- *
- * @brief This function is called by the client to query whether or not
- * channelised data has been received. If there is, hssChanAcc will return
- * the details in the output parameters. An enabled connection should
- * exist on the specified hssPortId before attempting to call this interface.
- * No other HssAccChannelised interface should be called while this
- * interface is being processed.
- *
- * @param hssPortId @ref IxHssAccHssPort [in] - The HSS port Id. There are two
- * identical ports (0-1).
- * @param *dataRecvd BOOL [out] - This BOOL indicates to the client whether
- * or not the access component has read any data for the client. If
- * FALSE, the other output parameters will not have been written to.
- * @param *rxOffset unsigned [out] - An offset to indicate to the client
- * where within the receive buffers the NPE has just written the received
- * data to.
- * @param *txOffset unsigned [out] - An offset to indicate to the client
- * from where within the txPtrList the NPE is currently transmitting from
- * @param *numHssErrs unsigned [out] - The total number of HSS port errors
- * since initial port configuration
- *
- *
- * @return
- * - IX_SUCCESS The function executed successfully
- * - IX_FAIL The function did not execute successfully
- * - IX_HSSACC_PARAM_ERR The function did not execute successfully due to a
- * parameter error
- */
-PUBLIC IX_STATUS
-ixHssAccChanStatusQuery (IxHssAccHssPort hssPortId,
- BOOL *dataRecvd,
- unsigned *rxOffset,
- unsigned *txOffset,
- unsigned *numHssErrs);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn void ixHssAccShow (void)
- *
- * @brief This function will display the current state of the IxHssAcc
- * component. The output is sent to stdout.
- *
- * @return void
- */
-PUBLIC void
-ixHssAccShow (void);
-
-/**
- *
- * @ingroup IxHssAccAPI
- *
- * @fn void ixHssAccStatsInit (void)
- *
- * @brief This function will reset the IxHssAcc statistics.
- *
- * @return void
- */
-PUBLIC void
-ixHssAccStatsInit (void);
-
-#endif /* IXHSSACC_H */
-
-/**
- * @} defgroup IxHssAcc
- */
diff --git a/cpu/ixp/npe/include/IxI2cDrv.h b/cpu/ixp/npe/include/IxI2cDrv.h
deleted file mode 100644
index 2472f31a71..0000000000
--- a/cpu/ixp/npe/include/IxI2cDrv.h
+++ /dev/null
@@ -1,867 +0,0 @@
-/**
- * @file IxI2cDrv.h
- *
- * @brief Header file for the IXP400 I2C Driver (IxI2cDrv)
- *
- * @version $Revision: 0.1 $
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxI2cDrv IXP400 I2C Driver(IxI2cDrv) API
- *
- * @brief IXP400 I2C Driver Public API
- *
- * @{
- */
-#ifndef IXI2CDRV_H
-#define IXI2CDRV_H
-
-#ifdef __ixp46X
-#include "IxOsal.h"
-
-/*
- * Section for #define
- */
-
-/**
- * @ingroup IxI2cDrv
- * @brief The interval of micro/mili seconds the IXP will wait before it polls for
- * status from the ixI2cIntrXferStatus; Every 20us is 1 byte @
- * 400Kbps and 4 bytes @ 100Kbps. This is dependent on delay type selected
- * through the API ixI2cDrvDelayTypeSelect.
- */
-#define IX_I2C_US_POLL_FOR_XFER_STATUS 20
-
-/**
- * @ingroup IxI2cDrv
- * @brief The number of tries that will be attempted to call a callback
- * function if the callback does not or is unable to resolve the
- * issue it is called to resolve
- */
-#define IX_I2C_NUM_OF_TRIES_TO_CALL_CALLBACK_FUNC 10
-
-
-/**
- * @ingroup IxI2cDrv
- * @brief Number of tries slave will poll the IDBR Rx full bit before it
- * gives up
- */
-#define IX_I2C_NUM_TO_POLL_IDBR_RX_FULL 0x100
-
-/**
- * @ingroup IxI2cDrv
- * @brief Number of tries slave will poll the IDBR Tx empty bit before it
- * gives up
- */
-#define IX_I2C_NUM_TO_POLL_IDBR_TX_EMPTY 0x100
-
-/*
- * Section for enum
- */
-
-/**
- * @ingroup IxI2cDrv
- *
- * @enum IxI2cMasterStatus
- *
- * @brief The master status - transfer complete, bus error or arbitration loss
- */
-typedef enum
-{
- IX_I2C_MASTER_XFER_COMPLETE = IX_SUCCESS,
- IX_I2C_MASTER_XFER_BUS_ERROR,
- IX_I2C_MASTER_XFER_ARB_LOSS
-} IxI2cMasterStatus;
-
-
-/**
- * @ingroup IxI2cDrv
- *
- * @enum IX_I2C_STATUS
- *
- * @brief The status that can be returned in a I2C driver initialization
- */
-typedef enum
-{
- IX_I2C_SUCCESS = IX_SUCCESS, /**< Success status */
- IX_I2C_FAIL, /**< Fail status */
- IX_I2C_NOT_SUPPORTED, /**< hardware does not have dedicated I2C hardware */
- IX_I2C_NULL_POINTER, /**< parameter passed in is NULL */
- IX_I2C_INVALID_SPEED_MODE_ENUM_VALUE, /**< speed mode selected is invalid */
- IX_I2C_INVALID_FLOW_MODE_ENUM_VALUE, /**< flow mode selected is invalid */
- IX_I2C_SLAVE_ADDR_CB_MISSING, /**< slave callback is NULL */
- IX_I2C_GEN_CALL_CB_MISSING, /**< general callback is NULL */
- IX_I2C_INVALID_SLAVE_ADDR, /**< invalid slave address specified */
- IX_I2C_INT_BIND_FAIL, /**< interrupt bind fail */
- IX_I2C_INT_UNBIND_FAIL, /**< interrupt unbind fail */
- IX_I2C_NOT_INIT, /**< I2C is not initialized yet */
- IX_I2C_MASTER_BUS_BUSY, /**< master detected a I2C bus busy */
- IX_I2C_MASTER_ARB_LOSS, /**< master experienced arbitration loss */
- IX_I2C_MASTER_XFER_ERROR, /**< master experienced a transfer error */
- IX_I2C_MASTER_BUS_ERROR, /**< master detected a I2C bus error */
- IX_I2C_MASTER_NO_BUFFER, /**< no buffer provided for master transfer */
- IX_I2C_MASTER_INVALID_XFER_MODE, /**< xfer mode selected is invalid */
- IX_I2C_SLAVE_ADDR_NOT_DETECTED, /**< polled slave addr not detected */
- IX_I2C_GEN_CALL_ADDR_DETECTED, /**< polling detected general call */
- IX_I2C_SLAVE_READ_DETECTED, /**< polling detected slave read request */
- IX_I2C_SLAVE_WRITE_DETECTED, /**< polling detected slave write request */
- IX_I2C_SLAVE_NO_BUFFER, /**< no buffer provided for slave transfers */
- IX_I2C_DATA_SIZE_ZERO, /**< data size transfer is zero - invalid */
- IX_I2C_SLAVE_WRITE_BUFFER_EMPTY, /**< slave buffer is used till empty */
- IX_I2C_SLAVE_WRITE_ERROR, /**< slave write experienced an error */
- IX_I2C_SLAVE_OR_GEN_READ_BUFFER_FULL, /**< slave buffer is filled up */
- IX_I2C_SLAVE_OR_GEN_READ_ERROR /**< slave read experienced an error */
-} IX_I2C_STATUS;
-
-/**
- * @ingroup IxI2cDrv
- *
- * @enum IxI2cSpeedMode
- *
- * @brief Type of speed modes supported by the I2C hardware.
- */
-typedef enum
-{
- IX_I2C_NORMAL_MODE = 0x0,
- IX_I2C_FAST_MODE
-} IxI2cSpeedMode;
-
-/**
- * @ingroup IxI2cDrv
- *
- * @enum IxI2cXferMode
- *
- * @brief Used for indicating it is a repeated start or normal transfer
- */
-typedef enum
-{
- IX_I2C_NORMAL = 0x0,
- IX_I2C_REPEATED_START
-} IxI2cXferMode;
-
-/**
- * @ingroup IxI2cDrv
- *
- * @enum IxI2cFlowMode
- *
- * @brief Used for indicating it is a poll or interrupt mode
- */
-typedef enum
-{
- IX_I2C_POLL_MODE = 0x0,
- IX_I2C_INTERRUPT_MODE
-} IxI2cFlowMode;
-
-/**
- * @ingroup IxI2cDrv
- *
- * @enum IxI2cDelayMode
- *
- * @brief Used for selecting looping delay or OS scheduler delay
- */
-typedef enum
-{
- IX_I2C_LOOP_DELAY = 1, /**< delay in microseconds */
- IX_I2C_SCHED_DELAY /**< delay in miliseconds */
-} IxI2cDelayMode;
-
-/**
- * @ingroup IxI2cDrv
- *
- * @brief The pointer to the function that will be called when the master
- * has completed its receive. The parameter that is passed will
- * provide the status of the read (success, arb loss, or bus
- * error), the transfer mode (normal or repeated start, the
- * buffer pointer and number of bytes transferred.
- */
-typedef void (*IxI2cMasterReadCallbackP)(IxI2cMasterStatus, IxI2cXferMode, char*, UINT32);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @brief The pointer to the function that will be called when the master
- * has completed its transmit. The parameter that is passed will
- * provide the status of the write (success, arb loss, or buss
- * error), the transfer mode (normal or repeated start), the
- * buffer pointer and number of bytes transferred.
- */
-typedef void (*IxI2cMasterWriteCallbackP)(IxI2cMasterStatus, IxI2cXferMode, char*, UINT32);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @brief The pointer to the function that will be called when a slave
- * address detected in interrupt mode for a read. The parameters
- * that is passed will provide the read status, buffer pointer,
- * buffer size, and the bytes received. When a start of a read
- * is initiated there will be no buffer allocated and this callback
- * will be called to request for a buffer. While receiving, if the
- * buffer gets filled, this callback will be called to request for
- * a new buffer while sending the filled buffer's pointer and size,
- * and data size received. When the receive is complete, this
- * callback will be called to process the data and free the memory
- * by passing the buffer's pointer and size, and data size received.
- */
-typedef void (*IxI2cSlaveReadCallbackP)(IX_I2C_STATUS, char*, UINT32, UINT32);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @brief The pointer to the function that will be called when a slave
- * address detected in interrupt mode for a write. The parameters
- * that is passed will provide the write status, buffer pointer,
- * buffer size, and the bytes received. When a start of a write is
- * initiated there will be no buffer allocated and this callback
- * will be called to request for a buffer and to fill it with data.
- * While transmitting, if the data in the buffer empties, this
- * callback will be called to request for more data to be filled in
- * the same or new buffer. When the transmit is complete, this
- * callback will be called to free the memory or other actions to
- * be taken.
- */
-typedef void (*IxI2cSlaveWriteCallbackP)(IX_I2C_STATUS, char*, UINT32, UINT32);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @brief The pointer to the function that will be called when a general
- * call detected in interrupt mode for a read. The parameters that
- * is passed will provide the read status, buffer pointer, buffer
- * size, and the bytes received. When a start of a read is
- * initiated there will be no buffer allocated and this callback
- * will be called to request for a buffer. While receiving, if the
- * buffer gets filled, this callback will be called to request for
- * a new buffer while sending the filled buffer's pointer and size,
- * and data size received. When the receive is complete, this
- * callback will be called to process the data and free the memory
- * by passing the buffer's pointer and size, and data size received.
- */
-typedef void (*IxI2cGenCallCallbackP)(IX_I2C_STATUS, char*, UINT32, UINT32);
-
-/*
- * Section for struct
- */
-
-/**
- * @brief contains all the variables required to initialize the I2C unit
- *
- * Structure to be filled and used for calling initialization
- */
-typedef struct
-{
- IxI2cSpeedMode I2cSpeedSelect; /**<Select either normal (100kbps)
- or fast mode (400kbps)*/
- IxI2cFlowMode I2cFlowSelect; /**<Select interrupt or poll mode*/
- IxI2cMasterReadCallbackP MasterReadCBP;
- /**<The master read callback pointer */
- IxI2cMasterWriteCallbackP MasterWriteCBP;
- /**<The master write callback pointer */
- IxI2cSlaveReadCallbackP SlaveReadCBP;
- /**<The slave read callback pointer */
- IxI2cSlaveWriteCallbackP SlaveWriteCBP;
- /**<The slave write callback pointer */
- IxI2cGenCallCallbackP GenCallCBP;
- /**<The general call callback pointer */
- BOOL I2cGenCallResponseEnable; /**<Enable/disable the unit to
- respond to generall calls.*/
- BOOL I2cSlaveAddrResponseEnable;/**<Enable/disable the unit to
- respond to the slave address set in
- ISAR*/
- BOOL SCLEnable; /**<Enable/disable the unit from
- driving the SCL line during master
- mode operation*/
- UINT8 I2cHWAddr; /**<The address the unit will
- response to as a slave device*/
-} IxI2cInitVars;
-
-/**
- * @brief contains results of counters and their overflow
- *
- * Structure contains all values of counters and associated overflows.
- */
-typedef struct
-{
- UINT32 ixI2cMasterXmitCounter; /**<Total bytes transmitted as
- master.*/
- UINT32 ixI2cMasterFailedXmitCounter; /**<Total bytes failed for
- transmission as master.*/
- UINT32 ixI2cMasterRcvCounter; /**<Total bytes received as
- master.*/
- UINT32 ixI2cMasterFailedRcvCounter; /**<Total bytes failed for
- receival as master.*/
- UINT32 ixI2cSlaveXmitCounter; /**<Total bytes transmitted as
- slave.*/
- UINT32 ixI2cSlaveFailedXmitCounter; /**<Total bytes failed for
- transmission as slave.*/
- UINT32 ixI2cSlaveRcvCounter; /**<Total bytes received as
- slave.*/
- UINT32 ixI2cSlaveFailedRcvCounter; /**<Total bytes failed for
- receival as slave.*/
- UINT32 ixI2cGenAddrCallSucceedCounter; /**<Total bytes successfully
- transmitted for general address.*/
- UINT32 ixI2cGenAddrCallFailedCounter; /**<Total bytes failed transmission
- for general address.*/
- UINT32 ixI2cArbLossCounter; /**<Total instances of arbitration
- loss has occured.*/
-} IxI2cStatsCounters;
-
-
-/*
- * Section for prototypes interface functions
- */
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvInit(
- IxI2cInitVars *InitVarsSelected)
- *
- * @brief Initializes the I2C Driver.
- *
- * @param "IxI2cInitVars [in] *InitVarsSelected" - struct containing required
- * variables for initialization
- *
- * Global Data :
- * - None.
- *
- * This API will check if the hardware supports this I2C driver and the validity
- * of the parameters passed in. It will continue to process the parameters
- * passed in by setting the speed of the I2C unit (100kbps or 400kbps), setting
- * the flow to either interrupt or poll mode, setting the address of the I2C unit,
- * enabling/disabling the respond to General Calls, enabling/disabling the respond
- * to Slave Address and SCL line driving. If it is interrupt mode, then it will
- * register the callback routines for master, slavetransfer and general call receive.
- *
- * @return
- * - IX_I2C_SUCCESS - Successfully initialize and enable the I2C
- * hardware.
- * - IX_I2C_NOT_SUPPORTED - The hardware does not support or have a
- * dedicated I2C unit to support this driver
- * - IX_I2C_NULL_POINTER - The parameter passed in is a NULL pointed
- * - IX_I2C_INVALID_SPEED_MODE_ENUM_VALUE - The speed mode selected in the
- * InitVarsSelected is invalid
- * - IX_I2C_INVALID_FLOW_MODE_ENUM_VALUE - The flow mode selected in the
- * InitVarsSelected is invalid
- * - IX_I2C_INVALID_SLAVE_ADDR - The address 0x0 is reserved for
- * general call.
- * - IX_I2C_SLAVE_ADDR_CB_MISSING - interrupt mode is selected but
- * slave address callback pointer is NULL
- * - IX_I2C_GEN_CALL_CB_MISSING - interrupt mode is selected but
- * general call callback pointer is NULL
- * - IX_I2C_INT_BIND_FAIL - The ISR for the I2C failed to bind
- * - IX_I2C_INT_UNBIND_FAIL - The ISR for the I2C failed to unbind
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_I2C_STATUS
-ixI2cDrvInit(IxI2cInitVars *InitVarsSelected);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvUninit(
- void)
- *
- * @brief Disables the I2C hardware
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will disable the I2C hardware, unbind interrupt, and unmap memory.
- *
- * @return
- * - IX_I2C_SUCCESS - successfully un-initialized I2C
- * - IX_I2C_INT_UNBIND_FAIL - failed to unbind the I2C interrupt
- * - IX_I2C_NOT_INIT - I2C not init yet.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_I2C_STATUS
-ixI2cDrvUninit(void);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvSlaveAddrSet(
- UINT8 SlaveAddrSet)
- *
- * @brief Sets the I2C Slave Address
- *
- * @param "UINT8 [in] SlaveAddrSet" - Slave Address to be inserted into ISAR
- *
- * Global Data :
- * - None.
- *
- * This API will insert the SlaveAddrSet into the ISAR.
- *
- * @return
- * - IX_I2C_SUCCESS - successfuly set the slave addr
- * - IX_I2C_INVALID_SLAVE_ADDR - invalid slave address (zero) specified
- * - IX_I2C_NOT_INIT - I2C not init yet.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_I2C_STATUS
-ixI2cDrvSlaveAddrSet(UINT8 SlaveAddrSet);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvBusScan(
- void)
- *
- * @brief scans the I2C bus for slave devices
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will prompt all slave addresses for a reply except its own
- *
- * @return
- * - IX_I2C_SUCCESS - found at least one slave device
- * - IX_I2C_FAIL - Fail to find even one slave device
- * - IX_I2C_BUS_BUSY - The I2C bus is busy (held by another I2C master)
- * - IX_I2C_ARB_LOSS - The I2C bus was loss to another I2C master
- * - IX_I2C_NOT_INIT - I2C not init yet.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_I2C_STATUS
-ixI2cDrvBusScan(void);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvWriteTransfer(
- UINT8 SlaveAddr,
- char *bufP,
- UINT32 dataSize,
- IxI2cXferMode XferModeSelect)
- *
- * @param "UINT8 [in] SlaveAddr" - The slave address to request data from.
- * @param "char [in] *bufP" - The pointer to the data to be transmitted.
- * @param "UINT32 [in] dataSize" - The number of bytes requested.
- * @param "IxI2cXferMode [in] XferModeSelect" - the transfer mode selected,
- * either repeated start (ends w/o stop) or normal (start and stop)
- *
- * Global Data :
- * - None.
- *
- * This API will try to obtain master control of the I2C bus and transmit the
- * number of bytes, specified by dataSize, to the user specified slave
- * address from the buffer pointer. It will use either interrupt or poll mode
- * depending on the method selected.
- *
- * If in interrupt mode and IxI2cMasterWriteCallbackP is not NULL, the driver
- * will initiate the transfer and return immediately. The function pointed to
- * by IxI2cMasterWriteCallbackP will be called in the interrupt service
- * handlers when the operation is complete.
- *
- * If in interrupt mode and IxI2cMasterWriteCallbackP is NULL, then the driver
- * will wait for the operation to complete, and then return.
- *
- * And if the repeated start transfer mode is selected, then it will not send a
- * stop signal at the end of all the transfers.
- * *NOTE*: If repeated start transfer mode is selected, it has to end with a
- * normal mode transfer mode else the bus will continue to be held
- * by the IXP.
- *
- * @return
- * - IX_I2C_SUCCESS - Successfuuly wrote data to slave.
- * - IX_I2C_MASTER_BUS_BUSY - The I2C bus is busy (held by another I2C master)
- * - IX_I2C_MASTER_ARB_LOSS - The I2C bus was loss to another I2C master
- * - IX_I2C_MASTER_XFER_ERROR - There was a transfer error
- * - IX_I2C_MASTER_BUS_ERROR - There was a bus error during transfer
- * - IX_I2C_MASTER_NO_BUFFER - buffer pointer is NULL
- * - IX_I2C_MASTER_INVALID_XFER_MODE - Xfer mode selected is invalid
- * - IX_I2C_DATA_SIZE_ZERO - dataSize passed in is zero, which is invalid
- * - IX_I2C_NOT_INIT - I2C not init yet.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IX_I2C_STATUS
-ixI2cDrvWriteTransfer(
- UINT8 SlaveAddr,
- char *bufP,
- UINT32 dataSize,
- IxI2cXferMode XferModeSelect);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvReadTransfer(
- UINT8 SlaveAddr,
- char *bufP,
- UINT32 dataSize,
- IxI2cXferMode XferModeSelect)
- *
- * @brief Initiates a transfer to receive bytes of data from a slave
- * device through the I2C bus.
- *
- * @param "UINT8 [in] SlaveAddr" - The slave address to request data from.
- * @param "char [out] *bufP" - The pointer to the buffer to store the
- * requested data.
- * @param "UINT32 [in] dataSize" - The number of bytes requested.
- * @param "IxI2cXferMode [in] XferModeSelect" - the transfer mode selected,
- * either repeated start (ends w/o stop) or normal (start and stop)
- *
- * Global Data :
- * - None.
- *
- * This API will try to obtain master control of the I2C bus and receive the
- * number of bytes, specified by dataSize, from the user specified address
- * into the receive buffer. It will use either interrupt or poll mode depending
- * on the mode selected.
- *
- * If in interrupt mode and IxI2cMasterReadCallbackP is not NULL, the driver
- * will initiate the transfer and return immediately. The function pointed to
- * by IxI2cMasterReadCallbackP will be called in the interrupt service
- * handlers when the operation is complete.
- *
- * If in interrupt mode and IxI2cMasterReadCallbackP is NULL, then the driver will
- * wait for the operation to complete, and then return.
- *
- * And if the repeated start transfer mode is selected, then it will not send a
- * stop signal at the end of all the transfers.
- * *NOTE*: If repeated start transfer mode is selected, it has to end with a
- * normal mode transfer mode else the bus will continue to be held
- * by the IXP.
- *
- * @return
- * - IX_I2C_SUCCESS - Successfuuly read slave data
- * - IX_I2C_MASTER_BUS_BUSY - The I2C bus is busy (held by another I2C master)
- * - IX_I2C_MASTER_ARB_LOSS - The I2C bus was loss to another I2C master
- * - IX_I2C_MASTER_XFER_ERROR - There was a bus error during transfer
- * - IX_I2C_MASTER_BUS_ERROR - There was a bus error during transfer
- * - IX_I2C_MASTER_NO_BUFFER - buffer pointer is NULL
- * - IX_I2C_MASTER_INVALID_XFER_MODE - Xfer mode selected is invalid
- * - IX_I2C_INVALID_SLAVE_ADDR - invalid slave address (zero) specified
- * - IX_I2C_DATA_SIZE_ZERO - dataSize passed in is zero, which is invalid
- * - IX_I2C_NOT_INIT - I2C not init yet.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IX_I2C_STATUS
-ixI2cDrvReadTransfer(
- UINT8 SlaveAddr,
- char *bufP,
- UINT32 dataSize,
- IxI2cXferMode XferModeSelect);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvSlaveAddrAndGenCallDetectedCheck(
- void)
- *
- * @brief Checks the I2C Status Register to determine if a slave address is
- * detected
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API is used in polled mode to determine if the I2C unit is requested
- * for a slave or general call transfer. If it is requested for a slave
- * transfer then it will determine if it is a general call (read only), read,
- * or write transfer requested.
- *
- * @return
- * - IX_I2C_SLAVE_ADDR_NOT_DETECTED - The I2C unit is not requested for slave
- * transfer
- * - IX_I2C_GEN_CALL_ADDR_DETECTED - The I2C unit is not requested for slave
- * transfer but for general call
- * - IX_I2C_SLAVE_READ_DETECTED - The I2C unit is requested for a read
- * - IX_I2C_SLAVE_WRITE_DETECTED - The I2C unit is requested for a write
- * - IX_I2C_NOT_INIT - I2C not init yet.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IX_I2C_STATUS
-ixI2cDrvSlaveAddrAndGenCallDetectedCheck(void);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvSlaveOrGenDataReceive(
- char *bufP,
- UINT32 bufSize,
- UINT32 *dataSizeRcvd)
- *
- * @brief Performs the slave receive or general call receive data transfer
- *
- * @param "char [in] *bufP" - the pointer to the buffer to store data
- * "UINT32 [in] bufSize" - the buffer size allocated
- * "UINT32 [in] *dataSizeRcvd" - the length of data received in bytes
- *
- * Global Data :
- * - None.
- *
- * This API is only used in polled mode to perform the slave read or general call
- * receive data. It will continuously store the data received into bufP until
- * complete or until bufP is full in which it will return
- * IX_I2C_SLAVE_OR_GEN_READ_BUFFER_FULL. If in interrupt mode, the callback will be
- * used.
- *
- * @return
- * - IX_I2C_SUCCESS - The I2C driver transferred the data successfully.
- * - IX_I2C_SLAVE_OR_GEN_READ_BUFFER_FULL - The I2C driver has ran out of
- * space to store the received data.
- * - IX_I2C_SLAVE_OR_GEN_READ_ERROR - The I2C driver didn't manage to
- * detect the IDBR Rx Full bit
- * - IX_I2C_DATA_SIZE_ZERO - bufSize passed in is zero, which is invalid
- * - IX_I2C_SLAVE_NO_BUFFER - buffer pointer is NULL
- * - IX_I2C_NULL_POINTER - dataSizeRcvd is NULL
- * - IX_I2C_NOT_INIT - I2C not init yet.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IX_I2C_STATUS
-ixI2cDrvSlaveOrGenDataReceive(
- char *bufP,
- UINT32 bufSize,
- UINT32 *dataSizeRcvd);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvSlaveDataTransmit(
- char *bufP,
- UINT32 dataSize,
- UINT32 *dataSizeXmtd)
- *
- * @brief Performs the slave write data transfer
- *
- * @param "char [in] *bufP" - the pointer to the buffer for data to be
- * transmitted
- * "UINT32 [in] bufSize" - the buffer size allocated
- * "UINT32 [in] *dataSizeRcvd" - the length of data trasnmitted in
- * bytes
- *
- * Global Data :
- * - None.
- *
- * This API is only used in polled mode to perform the slave transmit data. It
- * will continuously transmit the data from bufP until complete or until bufP
- * is empty in which it will return IX_I2C_SLAVE_WRITE_BUFFER_EMPTY. If in
- * interrupt mode, the callback will be used.
- *
- * @return
- * - IX_I2C_SUCCESS - The I2C driver transferred the data successfully.
- * - IX_I2C_SLAVE_WRITE_BUFFER_EMPTY - The I2C driver needs more data to
- * transmit.
- * - IX_I2C_SLAVE_WRITE_ERROR -The I2C driver didn't manage to detect the
- * IDBR Tx empty bit or the slave stop bit.
- * - IX_I2C_DATA_SIZE_ZERO - dataSize passed in is zero, which is invalid
- * - IX_I2C_SLAVE_NO_BUFFER - buffer pointer is NULL
- * - IX_I2C_NULL_POINTER - dataSizeXmtd is NULL
- * - IX_I2C_NOT_INIT - I2C not init yet.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IX_I2C_STATUS
-ixI2cDrvSlaveDataTransmit(
- char *bufP,
- UINT32 dataSize,
- UINT32 *dataSizeXmtd);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvSlaveOrGenCallBufReplenish(
- char *bufP,
- UINT32 bufSize)
- *
- * @brief Replenishes the buffer which stores buffer info for both slave and
- * general call
- *
- * @param "char [in] *bufP" - pointer to the buffer allocated
- * "UINT32 [in] bufSize" - size of the buffer
- *
- * Global Data :
- * - None.
- *
- * This API is only used in interrupt mode for replenishing the same buffer
- * that is used by both slave and generall call by updating the buffer info
- * with new info and clearing previous offsets set by previous transfers.
- *
- * @return
- * - None
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC void
-ixI2cDrvSlaveOrGenCallBufReplenish(
- char *bufP,
- UINT32 bufSize);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvStatsGet(IxI2cStatsCounters *I2cStats)
- *
- * @brief Returns the I2C Statistics through the pointer passed in
- *
- * @param - "IxI2cStatsCounters [out] *I2cStats" - I2C statistics counter will
- * be read and written to the location pointed by this pointer.
- *
- * Global Data :
- * - None.
- *
- * This API will return the statistics counters of the I2C driver.
- *
- * @return
- * - IX_I2C_NULL_POINTER - pointer passed in is NULL
- * - IX_I2C_SUCCESS - successfully obtained I2C statistics
- *
- * @li Reentrant : yes
- * @li ISR Callable : no
- *
- */
-PUBLIC IX_I2C_STATUS
-ixI2cDrvStatsGet(IxI2cStatsCounters *I2cStats);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvStatsReset(void)
- *
- * @brief Reset I2C statistics counters.
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will reset the statistics counters of the I2C driver.
- *
- * @return
- * - None
- *
- * @li Reentrant : yes
- * @li ISR Callable : no
- *
- */
-PUBLIC void
-ixI2cDrvStatsReset(void);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvShow(void)
- *
- * @brief Displays the I2C status register and the statistics counter.
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will display the I2C Status register and is useful if any error
- * occurs. It displays the detection of bus error, slave address, general call,
- * address, IDBR receive full, IDBR transmit empty, arbitration loss, slave
- * STOP signal, I2C bus busy, unit busy, ack/nack, and read/write mode. It will
- * also call the ixI2cDrvGetStats and then display the statistics counter.
- *
- * @return
- * - IX_I2C_SUCCESS - successfully displayed statistics and status register
- * - IX_I2C_NOT_INIT - I2C not init yet.
- *
- * @li Reentrant : yes
- * @li ISR Callable : no
- *
- */
-PUBLIC IX_I2C_STATUS
-ixI2cDrvShow(void);
-
-/**
- * @ingroup IxI2cDrv
- *
- * @fn ixI2cDrvDelayTypeSelect (IxI2cDelayMode delayMechanismSelect)
- *
- * @brief Sets the delay type of either looping delay or OS scheduler delay
- * according to the argument provided.
- *
- * @param - "IxI2cDelayMode [in] delayTypeSelect" - the I2C delay type selected
- *
- * Global Data :
- * - None.
- *
- * This API will set the delay type used by the I2C Driver to either looping
- * delay or OS scheduler delay.
- *
- * @return
- * - None
- *
- * @li Reentrant : yes
- * @li ISR Callable : no
- *
- */
-PUBLIC void
-ixI2cDrvDelayTypeSelect (IxI2cDelayMode delayTypeSelect);
-
-#endif /* __ixp46X */
-#endif /* IXI2CDRV_H */
diff --git a/cpu/ixp/npe/include/IxNpeA.h b/cpu/ixp/npe/include/IxNpeA.h
deleted file mode 100644
index 7427cc41c8..0000000000
--- a/cpu/ixp/npe/include/IxNpeA.h
+++ /dev/null
@@ -1,782 +0,0 @@
-#ifndef __doxygen_HIDE /* This file is not part of the API */
-
-/**
- * @file IxNpeA.h
- *
- * @date 22-Mar-2002
- *
- * @brief Header file for the IXP400 ATM NPE API
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxNpeA IXP400 NPE-A (IxNpeA) API
- *
- * @brief The Public API for the IXP400 NPE-A
- *
- * @{
- */
-
-#ifndef IX_NPE_A_H
-#define IX_NPE_A_H
-
-#include "IxQMgr.h"
-#include "IxOsal.h"
-#include "IxQueueAssignments.h"
-
-/* General Message Ids */
-
-/* ATM Message Ids */
-
-/**
- * @def IX_NPE_A_MSSG_ATM_UTOPIA_CONFIG_WRITE
- *
- * @brief ATM Message ID command to write the data to the offset in the
- * Utopia Configuration Table
- */
-#define IX_NPE_A_MSSG_ATM_UTOPIA_CONFIG_WRITE 0x20
-
-/**
- * @def IX_NPE_A_MSSG_ATM_UTOPIA_CONFIG_LOAD
- *
- * @brief ATM Message ID command triggers the NPE to copy the Utopia
- * Configuration Table to the Utopia coprocessor
- */
-#define IX_NPE_A_MSSG_ATM_UTOPIA_CONFIG_LOAD 0x21
-
-/**
- * @def IX_NPE_A_MSSG_ATM_UTOPIA_STATUS_UPLOAD
- *
- * @brief ATM Message ID command triggers the NPE to read-back the Utopia
- * status registers and update the Utopia Status Table.
- */
-#define IX_NPE_A_MSSG_ATM_UTOPIA_STATUS_UPLOAD 0x22
-
-/**
- * @def IX_NPE_A_MSSG_ATM_UTOPIA_STATUS_READ
- *
- * @brief ATM Message ID command to read the Utopia Status Table at the
- * specified offset.
- */
-#define IX_NPE_A_MSSG_ATM_UTOPIA_STATUS_READ 0x23
-
-/**
- * @def IX_NPE_A_MSSG_ATM_TX_ENABLE
- *
- * @brief ATM Message ID command triggers the NPE to re-enable processing
- * of any entries on the TxVcQ for this port.
- *
- * This command will be ignored for a port already enabled
- */
-#define IX_NPE_A_MSSG_ATM_TX_ENABLE 0x25
-
- /**
- * @def IX_NPE_A_MSSG_ATM_TX_DISABLE
- *
- * @brief ATM Message ID command triggers the NPE to disable processing on
- * this port
- *
- * This command will be ignored for a port already disabled
- */
-#define IX_NPE_A_MSSG_ATM_TX_DISABLE 0x26
-
-/**
- * @def IX_NPE_A_MSSG_ATM_RX_ENABLE
- *
- * @brief ATM Message ID command triggers the NPE to process any received
- * cells for this VC according to the VC Lookup Table.
- *
- * Re-issuing this command with different contents for a VC that is not
- * disabled will cause unpredictable behavior.
- */
-#define IX_NPE_A_MSSG_ATM_RX_ENABLE 0x27
-
-/**
- * @def IX_NPE_A_MSSG_ATM_RX_DISABLE
- *
- * @brief ATM Message ID command triggers the NPE to disable processing for
- * this VC.
- *
- * This command will be ignored for a VC already disabled
- */
-#define IX_NPE_A_MSSG_ATM_RX_DISABLE 0x28
-
-/**
- * @def IX_NPE_A_MSSG_ATM_STATUS_READ
- *
- * @brief ATM Message ID command to read the ATM status. The data is returned via
- * a response message
- */
-#define IX_NPE_A_MSSG_ATM_STATUS_READ 0x29
-
-/*--------------------------------------------------------------------------
- * HSS Message IDs
- *--------------------------------------------------------------------------*/
-
-/**
- * @def IX_NPE_A_MSSG_HSS_PORT_CONFIG_WRITE
- *
- * @brief HSS Message ID command writes the ConfigWord value to the location
- * in the HSS_CONFIG_TABLE specified by offset for HSS port hPort.
- */
-#define IX_NPE_A_MSSG_HSS_PORT_CONFIG_WRITE 0x40
-
-/**
- * @def IX_NPE_A_MSSG_HSS_PORT_CONFIG_LOAD
- *
- * @brief HSS Message ID command triggers the NPE to copy the contents of the
- * HSS Configuration Table to the appropriate configuration registers in the
- * HSS coprocessor for the port specified by hPort.
- */
-#define IX_NPE_A_MSSG_HSS_PORT_CONFIG_LOAD 0x41
-
-/**
- * @def IX_NPE_A_MSSG_HSS_PORT_ERROR_READ
- *
- * @brief HSS Message ID command triggers the NPE to return an HssErrorReadResponse
- * message for HSS port hPort.
- */
-#define IX_NPE_A_MSSG_HSS_PORT_ERROR_READ 0x42
-
-/**
- * @def IX_NPE_A_MSSG_HSS_CHAN_FLOW_ENABLE
- *
- * @brief HSS Message ID command triggers the NPE to reset internal status and
- * enable the HssChannelized operation on the HSS port specified by hPort.
- */
-#define IX_NPE_A_MSSG_HSS_CHAN_FLOW_ENABLE 0x43
-
-/**
- * @def IX_NPE_A_MSSG_HSS_CHAN_FLOW_DISABLE
- *
- * @brief HSS Message ID command triggers the NPE to disable the HssChannelized
- * operation on the HSS port specified by hPort.
- */
-#define IX_NPE_A_MSSG_HSS_CHAN_FLOW_DISABLE 0x44
-
-/**
- * @def IX_NPE_A_MSSG_HSS_CHAN_IDLE_PATTERN_WRITE
- *
- * @brief HSS Message ID command writes the HSSnC_IDLE_PATTERN value for HSS
- * port hPort. (n=hPort)
- */
-#define IX_NPE_A_MSSG_HSS_CHAN_IDLE_PATTERN_WRITE 0x45
-
-/**
- * @def IX_NPE_A_MSSG_HSS_CHAN_NUM_CHANS_WRITE
- *
- * @brief HSS Message ID command writes the HSSnC_NUM_CHANNELS value for HSS
- * port hPort. (n=hPort)
- */
-#define IX_NPE_A_MSSG_HSS_CHAN_NUM_CHANS_WRITE 0x46
-
-/**
- * @def IX_NPE_A_MSSG_HSS_CHAN_RX_BUF_ADDR_WRITE
- *
- * @brief HSS Message ID command writes the HSSnC_RX_BUF_ADDR value for HSS
- * port hPort. (n=hPort)
- */
-#define IX_NPE_A_MSSG_HSS_CHAN_RX_BUF_ADDR_WRITE 0x47
-
-/**
- * @def IX_NPE_A_MSSG_HSS_CHAN_RX_BUF_CFG_WRITE
- *
- * @brief HSS Message ID command writes the HSSnC_RX_BUF_SIZEB and
- * HSSnC_RX_TRIG_PERIOD values for HSS port hPort. (n=hPort)
- */
-#define IX_NPE_A_MSSG_HSS_CHAN_RX_BUF_CFG_WRITE 0x48
-
-/**
- * @def IX_NPE_A_MSSG_HSS_CHAN_TX_BLK_CFG_WRITE
- *
- * @brief HSS Message ID command writes the HSSnC_TX_BLK1_SIZEB,
- * HSSnC_TX_BLK1_SIZEW, HSSnC_TX_BLK2_SIZEB, and HSSnC_TX_BLK2_SIZEW values
- * for HSS port hPort. (n=hPort)
- */
-#define IX_NPE_A_MSSG_HSS_CHAN_TX_BLK_CFG_WRITE 0x49
-
-/**
- * @def IX_NPE_A_MSSG_HSS_CHAN_TX_BUF_ADDR_WRITE
- * @brief HSS Message ID command writes the HSSnC_TX_BUF_ADDR value for HSS
- * port hPort. (n=hPort)
- */
-#define IX_NPE_A_MSSG_HSS_CHAN_TX_BUF_ADDR_WRITE 0x4A
-
-/**
- * @def IX_NPE_A_MSSG_HSS_CHAN_TX_BUF_SIZE_WRITE
- *
- * @brief HSS Message ID command writes the HSSnC_TX_BUF_SIZEN value for HSS
- * port hPort. (n=hPort)
- */
-#define IX_NPE_A_MSSG_HSS_CHAN_TX_BUF_SIZE_WRITE 0x4B
-
-/**
- * @def IX_NPE_A_MSSG_HSS_PKT_PIPE_FLOW_ENABLE
- *
- * @brief HSS Message ID command triggers the NPE to reset internal status and
- * enable the HssPacketized operation for the flow specified by pPipe on
- * the HSS port specified by hPort.
- */
-#define IX_NPE_A_MSSG_HSS_PKT_PIPE_FLOW_ENABLE 0x50
-
-/**
- * @def IX_NPE_A_MSSG_HSS_PKT_PIPE_FLOW_DISABLE
- * @brief HSS Message ID command triggers the NPE to disable the HssPacketized
- * operation for the flow specified by pPipe on the HSS port specified by hPort.
- */
-#define IX_NPE_A_MSSG_HSS_PKT_PIPE_FLOW_DISABLE 0x51
-
-/**
- * @def IX_NPE_A_MSSG_HSS_PKT_NUM_PIPES_WRITE
- * @brief HSS Message ID command writes the HSSnP_NUM_PIPES value for HSS
- * port hPort.(n=hPort)
- */
-#define IX_NPE_A_MSSG_HSS_PKT_NUM_PIPES_WRITE 0x52
-
-/**
- * @def IX_NPE_A_MSSG_HSS_PKT_PIPE_FIFO_SIZEW_WRITE
- *
- * @brief HSS Message ID command writes the HSSnP_PIPEp_FIFOSIZEW value for
- * packet-pipe pPipe on HSS port hPort. (n=hPort, p=pPipe)
- */
-#define IX_NPE_A_MSSG_HSS_PKT_PIPE_FIFO_SIZEW_WRITE 0x53
-
-/**
- * @def IX_NPE_A_MSSG_HSS_PKT_PIPE_HDLC_CFG_WRITE
- *
- * @brief HSS Message ID command writes the HSSnP_PIPEp_HDLC_RXCFG and
- * HSSnP_PIPEp_HDLC_TXCFG values for packet-pipe pPipe on HSS port hPort.
- * (n=hPort, p=pPipe)
- */
-#define IX_NPE_A_MSSG_HSS_PKT_PIPE_HDLC_CFG_WRITE 0x54
-
-/**
- * @def IX_NPE_A_MSSG_HSS_PKT_PIPE_IDLE_PATTERN_WRITE
- *
- * @brief HSS Message ID command writes the HSSnP_PIPEp_IDLE_PATTERN value
- * for packet-pipe pPipe on HSS port hPort. (n=hPort, p=pPipe)
- */
-#define IX_NPE_A_MSSG_HSS_PKT_PIPE_IDLE_PATTERN_WRITE 0x55
-
-/**
- * @def IX_NPE_A_MSSG_HSS_PKT_PIPE_RX_SIZE_WRITE
- *
- * @brief HSS Message ID command writes the HSSnP_PIPEp_RXSIZEB value for
- * packet-pipe pPipe on HSS port hPort. (n=hPort, p=pPipe)
- */
-#define IX_NPE_A_MSSG_HSS_PKT_PIPE_RX_SIZE_WRITE 0x56
-
-/**
- * @def IX_NPE_A_MSSG_HSS_PKT_PIPE_MODE_WRITE
- *
- * @brief HSS Message ID command writes the HSSnP_PIPEp_MODE value for
- * packet-pipe pPipe on HSS port hPort. (n=hPort, p=pPipe)
- */
-#define IX_NPE_A_MSSG_HSS_PKT_PIPE_MODE_WRITE 0x57
-
-
-
-/* Queue Entry Masks */
-
-/*--------------------------------------------------------------------------
- * ATM Descriptor Structure offsets
- *--------------------------------------------------------------------------*/
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_STATUS_OFFSET
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor Status field
- *
- * It is used for descriptor error reporting.
- */
-#define IX_NPE_A_RXDESCRIPTOR_STATUS_OFFSET 0
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_VCID_OFFSET
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor VC ID field
- *
- * It is used to hold an identifier number for this VC
- */
-#define IX_NPE_A_RXDESCRIPTOR_VCID_OFFSET 1
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_CURRMBUFSIZE_OFFSET
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor Current Mbuf
- * Size field
- *
- * Number of bytes the current mbuf data buffer can hold
- */
-#define IX_NPE_A_RXDESCRIPTOR_CURRMBUFSIZE_OFFSET 2
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_ATMHEADER_OFFSET
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor ATM Header
- */
-#define IX_NPE_A_RXDESCRIPTOR_ATMHEADER_OFFSET 4
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_CURRMBUFLEN_OFFSET
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor Current MBuf length
- *
- *
- * RX - Initialized to zero. The NPE updates this field as each cell is received and
- * zeroes it with every new mbuf for chaining. Will not be bigger than currBbufSize.
- */
-#define IX_NPE_A_RXDESCRIPTOR_CURRMBUFLEN_OFFSET 12
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_TIMELIMIT__OFFSET
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor Time Limit field
- *
- * Contains the Payload Reassembly Time Limit (used for aal0_xx only)
- */
-#define IX_NPE_A_RXDESCRIPTOR_TIMELIMIT_OFFSET 14
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_PCURRMBUFF_OFFSET
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor Current MBuf Pointer
- *
- * The current mbuf pointer of a chain of mbufs.
- */
-#define IX_NPE_A_RXDESCRIPTOR_PCURRMBUFF_OFFSET 20
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_PCURRMBUFDATA_OFFSET
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor Current MBuf Pointer
- *
- * Pointer to the next byte to be read or next free location to be written.
- */
-#define IX_NPE_A_RXDESCRIPTOR_PCURRMBUFDATA_OFFSET 24
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_PNEXTMBUF_OFFSET
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor Next MBuf Pointer
- *
- * Pointer to the next MBuf in a chain of MBufs.
- */
-#define IX_NPE_A_RXDESCRIPTOR_PNEXTMBUF_OFFSET 28
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_TOTALLENGTH_OFFSET
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor Total Length
- *
- * Total number of bytes written to the chain of MBufs by the NPE
- */
-#define IX_NPE_A_RXDESCRIPTOR_TOTALLENGTH_OFFSET 32
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_AAL5CRCRESIDUE_OFFSET
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor AAL5 CRC Residue
- *
- * Current CRC value for a PDU
- */
-#define IX_NPE_A_RXDESCRIPTOR_AAL5CRCRESIDUE_OFFSET 36
-
-/**
- * @def IX_NPE_A_RXDESCRIPTOR_SIZE
- *
- * @brief ATM Descriptor structure offset for Receive Descriptor Size
- *
- * The size of the Receive descriptor
- */
-#define IX_NPE_A_RXDESCRIPTOR_SIZE 40
-
-/**
- * @def IX_NPE_A_TXDESCRIPTOR_PORT_OFFSET
- *
- * @brief ATM Descriptor structure offset for Transmit Descriptor Port
- *
- * Port identifier.
- */
-#define IX_NPE_A_TXDESCRIPTOR_PORT_OFFSET 0
-
-/**
- * @def IX_NPE_A_TXDESCRIPTOR_RSVD_OFFSET
- *
- * @brief ATM Descriptor structure offset for Transmit Descriptor RSVD
- */
-#define IX_NPE_A_TXDESCRIPTOR_RSVD_OFFSET 1
-
-/**
- * @def IX_NPE_A_TXDESCRIPTOR_CURRMBUFLEN_OFFSET
- *
- * @brief ATM Descriptor structure offset for Transmit Descriptor Current MBuf Length
- *
- * TX - Initialized by the XScale to the number of bytes in the current MBuf data buffer.
- * The NPE decrements this field for every transmitted cell. Thus, when the NPE writes a
- * descriptor the TxDone queue, this field will equal zero.
- */
-#define IX_NPE_A_TXDESCRIPTOR_CURRMBUFLEN_OFFSET 2
-
-/**
- * @def IX_NPE_A_TXDESCRIPTOR_ATMHEADER_OFFSET
- * @brief ATM Descriptor structure offset for Transmit Descriptor ATM Header
- */
-#define IX_NPE_A_TXDESCRIPTOR_ATMHEADER_OFFSET 4
-
-/**
- * @def IX_NPE_A_TXDESCRIPTOR_PCURRMBUFF_OFFSET
- *
- * @brief ATM Descriptor structure offset for Transmit Descriptor Pointer to the current MBuf chain
- */
-#define IX_NPE_A_TXDESCRIPTOR_PCURRMBUFF_OFFSET 8
-
-/**
- * @def IX_NPE_A_TXDESCRIPTOR_PCURRMBUFDATA_OFFSET
- *
- * @brief ATM Descriptor structure offset for Transmit Descriptor Pointer to the current MBuf Data
- *
- * Pointer to the next byte to be read or next free location to be written.
- */
-#define IX_NPE_A_TXDESCRIPTOR_PCURRMBUFDATA_OFFSET 12
-
-/**
- * @def IX_NPE_A_TXDESCRIPTOR_PNEXTMBUF_OFFSET
- *
- * @brief ATM Descriptor structure offset for Transmit Descriptor Pointer to the Next MBuf chain
- */
-#define IX_NPE_A_TXDESCRIPTOR_PNEXTMBUF_OFFSET 16
-
-/**
- * @def IX_NPE_A_TXDESCRIPTOR_TOTALLENGTH_OFFSET
- *
- * @brief ATM Descriptor structure offset for Transmit Descriptor Total Length
- *
- * Total number of bytes written to the chain of MBufs by the NPE
- */
-#define IX_NPE_A_TXDESCRIPTOR_TOTALLENGTH_OFFSET 20
-
-/**
- * @def IX_NPE_A_TXDESCRIPTOR_AAL5CRCRESIDUE_OFFSET
- *
- * @brief ATM Descriptor structure offset for Transmit Descriptor AAL5 CRC Residue
- *
- * Current CRC value for a PDU
- */
-#define IX_NPE_A_TXDESCRIPTOR_AAL5CRCRESIDUE_OFFSET 24
-
-/**
- * @def IX_NPE_A_TXDESCRIPTOR_SIZE
- *
- * @brief ATM Descriptor structure offset for Transmit Descriptor Size
- */
-#define IX_NPE_A_TXDESCRIPTOR_SIZE 28
-
-/**
- * @def IX_NPE_A_CHAIN_DESC_COUNT_MAX
- *
- * @brief Maximum number of chained MBufs that can be chained together
- */
-#define IX_NPE_A_CHAIN_DESC_COUNT_MAX 256
-
-/*
- * Definition of the ATM cell header
- *
- * This would most conviently be defined as the bit field shown below.
- * Endian portability prevents this, therefore a set of macros
- * are defined to access the fields within the cell header assumed to
- * be passed as a UINT32.
- *
- * Changes to field sizes or orders must be reflected in the offset
- * definitions above.
- *
- * typedef struct
- * {
- * unsigned int gfc:4;
- * unsigned int vpi:8;
- * unsigned int vci:16;
- * unsigned int pti:3;
- * unsigned int clp:1;
- * } IxNpeA_AtmCellHeader;
- *
- */
-
-/** Mask to acess GFC */
-#define GFC_MASK 0xf0000000
-
-/** return GFC from ATM cell header */
-#define IX_NPE_A_ATMCELLHEADER_GFC_GET( header ) \
-(((header) & GFC_MASK) >> 28)
-
-/** set GFC into ATM cell header */
-#define IX_NPE_A_ATMCELLHEADER_GFC_SET( header,gfc ) \
-do { \
- (header) &= ~GFC_MASK; \
- (header) |= (((gfc) << 28) & GFC_MASK); \
-} while(0)
-
-/** Mask to acess VPI */
-#define VPI_MASK 0x0ff00000
-
-/** return VPI from ATM cell header */
-#define IX_NPE_A_ATMCELLHEADER_VPI_GET( header ) \
-(((header) & VPI_MASK) >> 20)
-
-/** set VPI into ATM cell header */
-#define IX_NPE_A_ATMCELLHEADER_VPI_SET( header, vpi ) \
-do { \
- (header) &= ~VPI_MASK; \
- (header) |= (((vpi) << 20) & VPI_MASK); \
-} while(0)
-
-/** Mask to acess VCI */
-#define VCI_MASK 0x000ffff0
-
-/** return VCI from ATM cell header */
-#define IX_NPE_A_ATMCELLHEADER_VCI_GET( header ) \
-(((header) & VCI_MASK) >> 4)
-
-/** set VCI into ATM cell header */
-#define IX_NPE_A_ATMCELLHEADER_VCI_SET( header, vci ) \
-do { \
- (header) &= ~VCI_MASK; \
- (header) |= (((vci) << 4) & VCI_MASK); \
-} while(0)
-
-/** Mask to acess PTI */
-#define PTI_MASK 0x0000000e
-
-/** return PTI from ATM cell header */
-#define IX_NPE_A_ATMCELLHEADER_PTI_GET( header ) \
-(((header) & PTI_MASK) >> 1)
-
-/** set PTI into ATM cell header */
-#define IX_NPE_A_ATMCELLHEADER_PTI_SET( header, pti ) \
-do { \
- (header) &= ~PTI_MASK; \
- (header) |= (((pti) << 1) & PTI_MASK); \
-} while(0)
-
-/** Mask to acess CLP */
-#define CLP_MASK 0x00000001
-
-/** return CLP from ATM cell header */
-#define IX_NPE_A_ATMCELLHEADER_CLP_GET( header ) \
-((header) & CLP_MASK)
-
-/** set CLP into ATM cell header */
-#define IX_NPE_A_ATMCELLHEADER_CLP_SET( header, clp ) \
-do { \
- (header) &= ~CLP_MASK; \
- (header) |= ((clp) & CLP_MASK); \
-} while(0)
-
-
-/*
-* Definition of the Rx bitfield
-*
-* This would most conviently be defined as the bit field shown below.
-* Endian portability prevents this, therefore a set of macros
-* are defined to access the fields within the rxBitfield assumed to
-* be passed as a UINT32.
-*
-* Changes to field sizes or orders must be reflected in the offset
-* definitions above.
-*
-* Rx bitfield
-* struct
-* { IX_NPEA_RXBITFIELD(
-* unsigned int status:1,
-* unsigned int port:7,
-* unsigned int vcId:8,
-* unsigned int currMbufSize:16);
-* } rxBitField;
-*
-*/
-
-/** Mask to acess the rxBitField status */
-#define STATUS_MASK 0x80000000
-
-/** return the rxBitField status */
-#define IX_NPE_A_RXBITFIELD_STATUS_GET( rxbitfield ) \
-(((rxbitfield) & STATUS_MASK) >> 31)
-
-/** set the rxBitField status */
-#define IX_NPE_A_RXBITFIELD_STATUS_SET( rxbitfield, status ) \
-do { \
- (rxbitfield) &= ~STATUS_MASK; \
- (rxbitfield) |= (((status) << 31) & STATUS_MASK); \
-} while(0)
-
-/** Mask to acess the rxBitField port */
-#define PORT_MASK 0x7f000000
-
-/** return the rxBitField port */
-#define IX_NPE_A_RXBITFIELD_PORT_GET( rxbitfield ) \
-(((rxbitfield) & PORT_MASK) >> 24)
-
-/** set the rxBitField port */
-#define IX_NPE_A_RXBITFIELD_PORT_SET( rxbitfield, port ) \
-do { \
- (rxbitfield) &= ~PORT_MASK; \
- (rxbitfield) |= (((port) << 24) & PORT_MASK); \
-} while(0)
-
-/** Mask to acess the rxBitField vcId */
-#define VCID_MASK 0x00ff0000
-
-/** return the rxBitField vcId */
-#define IX_NPE_A_RXBITFIELD_VCID_GET( rxbitfield ) \
-(((rxbitfield) & VCID_MASK) >> 16)
-
-/** set the rxBitField vcId */
-#define IX_NPE_A_RXBITFIELD_VCID_SET( rxbitfield, vcid ) \
-do { \
- (rxbitfield) &= ~VCID_MASK; \
- (rxbitfield) |= (((vcid) << 16) & VCID_MASK); \
-} while(0)
-
-/** Mask to acess the rxBitField mbuf size */
-#define CURRMBUFSIZE_MASK 0x0000ffff
-
-/** return the rxBitField mbuf size */
-#define IX_NPE_A_RXBITFIELD_CURRMBUFSIZE_GET( rxbitfield ) \
-((rxbitfield) & CURRMBUFSIZE_MASK)
-
-/** set the rxBitField mbuf size */
-#define IX_NPE_A_RXBITFIELD_CURRMBUFSIZE_SET( rxbitfield, currmbufsize ) \
-do { \
- (rxbitfield) &= ~CURRMBUFSIZE_MASK; \
- (rxbitfield) |= ((currmbufsize) & CURRMBUFSIZE_MASK); \
-} while(0)
-
-
-
-/**
- * @brief Tx Descriptor definition
- */
-typedef struct
-{
- UINT8 port; /**< Tx Port number */
- UINT8 aalType; /**< AAL Type */
- UINT16 currMbufLen; /**< mbuf length */
- UINT32 atmCellHeader; /**< ATM cell header */
- IX_OSAL_MBUF *pCurrMbuf; /**< pointer to mbuf */
- unsigned char *pCurrMbufData; /**< Pointer to mbuf->dat */
- IX_OSAL_MBUF *pNextMbuf; /**< Pointer to next mbuf */
- UINT32 totalLen; /**< Total Length */
- UINT32 aal5CrcResidue; /**< AAL5 CRC Residue */
-} IxNpeA_TxAtmVc;
-
-/* Changes to field sizes or orders must be reflected in the offset
- * definitions above. */
-
-
-
-
-/**
- * @brief Rx Descriptor definition
- */
-typedef struct
-{
- UINT32 rxBitField; /**< Recieved bit field */
- UINT32 atmCellHeader; /**< ATM Cell Header */
- UINT32 rsvdWord0; /**< Reserved field */
- UINT16 currMbufLen; /**< Mbuf Length */
- UINT8 timeLimit; /**< Payload Reassembly timeLimit (used for aal0_xx only) */
- UINT8 rsvdByte0; /**< Reserved field */
- UINT32 rsvdWord1; /**< Reserved field */
- IX_OSAL_MBUF *pCurrMbuf; /**< Pointer to current mbuf */
- unsigned char *pCurrMbufData; /**< Pointer to current mbuf->data */
- IX_OSAL_MBUF *pNextMbuf; /**< Pointer to next mbuf */
- UINT32 totalLen; /**< Total Length */
- UINT32 aal5CrcResidue; /**< AAL5 CRC Residue */
-} IxNpeA_RxAtmVc;
-
-
-/**
- * @brief NPE-A AAL Type
- */
-typedef enum
-{
- IX_NPE_A_AAL_TYPE_INVALID = 0, /**< Invalid AAL type */
- IX_NPE_A_AAL_TYPE_0_48 = 0x1, /**< AAL0 - 48 byte */
- IX_NPE_A_AAL_TYPE_0_52 = 0x2, /**< AAL0 - 52 byte */
- IX_NPE_A_AAL_TYPE_5 = 0x5, /**< AAL5 */
- IX_NPE_A_AAL_TYPE_OAM = 0xF /**< OAM */
-} IxNpeA_AalType;
-
-/**
- * @brief NPE-A Payload format 52-bytes & 48-bytes
- */
-typedef enum
-{
- IX_NPE_A_52_BYTE_PAYLOAD = 0, /**< 52 byte payload */
- IX_NPE_A_48_BYTE_PAYLOAD /**< 48 byte payload */
-} IxNpeA_PayloadFormat;
-
-/**
- * @brief HSS Packetized NpePacket Descriptor Structure
- */
-typedef struct
-{
- UINT8 status; /**< Status of the packet passed to the client */
- UINT8 errorCount; /**< Number of errors */
- UINT8 chainCount; /**< Mbuf chain count e.g. 0 - No mbuf chain */
- UINT8 rsvdByte0; /**< Reserved byte to make the descriptor word align */
-
- UINT16 packetLength; /**< Packet Length */
- UINT16 rsvdShort0; /**< Reserved short to make the descriptor a word align */
-
- IX_OSAL_MBUF *pRootMbuf; /**< Pointer to Root mbuf */
- IX_OSAL_MBUF *pNextMbuf; /**< Pointer to next mbuf */
- UINT8 *pMbufData; /**< Pointer to the current mbuf->data */
- UINT32 mbufLength; /**< Current mbuf length */
-
-} IxNpeA_NpePacketDescriptor;
-
-
-#endif
-/**
- *@}
- */
-
-#endif /* __doxygen_HIDE */
diff --git a/cpu/ixp/npe/include/IxNpeDl.h b/cpu/ixp/npe/include/IxNpeDl.h
deleted file mode 100644
index 86f69f4144..0000000000
--- a/cpu/ixp/npe/include/IxNpeDl.h
+++ /dev/null
@@ -1,980 +0,0 @@
-/**
- * @file IxNpeDl.h
- *
- * @date 14 December 2001
-
- * @brief This file contains the public API of the IXP400 NPE Downloader
- * component.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxNpeDl IXP400 NPE-Downloader (IxNpeDl) API
- *
- * @brief The Public API for the IXP400 NPE Downloader
- *
- * @{
- */
-
-#ifndef IXNPEDL_H
-#define IXNPEDL_H
-
-/*
- * Put the user defined include files required
- */
-#include "IxOsalTypes.h"
-#include "IxNpeMicrocode.h"
-
-/*
- * #defines for function return types, etc.
- */
-
-/**
- * @def IX_NPEDL_PARAM_ERR
- *
- * @brief NpeDl function return value for a parameter error
- */
-#define IX_NPEDL_PARAM_ERR 2
-
-/**
- * @def IX_NPEDL_RESOURCE_ERR
- *
- * @brief NpeDl function return value for a resource error
- */
-#define IX_NPEDL_RESOURCE_ERR 3
-
-/**
- * @def IX_NPEDL_CRITICAL_NPE_ERR
- *
- * @brief NpeDl function return value for a Critical NPE error occuring during
- download. Assume NPE is left in unstable condition if this value is
- returned or NPE is hang / halt.
- */
-#define IX_NPEDL_CRITICAL_NPE_ERR 4
-
-/**
- * @def IX_NPEDL_CRITICAL_MICROCODE_ERR
- *
- * @brief NpeDl function return value for a Critical Microcode error
- * discovered during download. Assume NPE is left in unstable condition
- * if this value is returned.
- */
-#define IX_NPEDL_CRITICAL_MICROCODE_ERR 5
-
-/**
- * @def IX_NPEDL_DEVICE_ERR
- *
- * @brief NpeDl function return value when image being downloaded
- * is not meant for the device in use
- */
-#define IX_NPEDL_DEVICE_ERR 6
-
-/**
- * @defgroup NPEImageID IXP400 NPE Image ID Definition
- *
- * @ingroup IxNpeDl
- *
- * @brief Definition of NPE Image ID to be passed to ixNpeDlNpeInitAndStart()
- * as input of type UINT32 which has the following fields format:
- *
- * Field [Bit Location] <BR>
- * -------------------- <BR>
- * Device ID [31 - 28] <BR>
- * NPE ID [27 - 24] <BR>
- * NPE Functionality ID [23 - 16] <BR>
- * Major Release Number [15 - 8] <BR>
- * Minor Release Number [7 - 0] <BR>
- *
- *
- * @{
- */
-
-/**
- * @def IX_NPEDL_NPEIMAGE_FIELD_MASK
- *
- * @brief Mask for NPE Image ID's Field
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define IX_NPEDL_NPEIMAGE_FIELD_MASK 0xff
-
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEID_MASK
- *
- * @brief Mask for NPE Image NPE ID's Field
- *
- */
-#define IX_NPEDL_NPEIMAGE_NPEID_MASK 0xf
-
-/**
- * @def IX_NPEDL_NPEIMAGE_DEVICEID_MASK
- *
- * @brief Mask for NPE Image Device ID's Field
- *
- */
-#define IX_NPEDL_NPEIMAGE_DEVICEID_MASK 0xf
-
-/**
- * @def IX_NPEDL_NPEIMAGE_BIT_LOC_NPEID
- *
- * @brief Location of NPE ID field in term of bit.
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define IX_NPEDL_NPEIMAGE_BIT_LOC_NPEID 24
-
-/**
- * @def IX_NPEDL_NPEIMAGE_BIT_LOC_FUNCTIONALITYID
- *
- * @brief Location of Functionality ID field in term of bit.
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define IX_NPEDL_NPEIMAGE_BIT_LOC_FUNCTIONALITYID 16
-
-/**
- * @def IX_NPEDL_NPEIMAGE_BIT_LOC_MAJOR
- *
- * @brief Location of Major Release Number field in term of bit.
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define IX_NPEDL_NPEIMAGE_BIT_LOC_MAJOR 8
-
-/**
- * @def IX_NPEDL_NPEIMAGE_BIT_LOC_MINOR
- *
- * @brief Location of Minor Release Number field in term of bit.
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define IX_NPEDL_NPEIMAGE_BIT_LOC_MINOR 0
-
-/**
- * @} addtogroup NPEImageID
- */
-
-/**
- * @def ixNpeDlMicrocodeImageOverride(x)
- *
- * @brief Map old terminology that uses term "image" to new term
- * "image library"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define ixNpeDlMicrocodeImageOverride(x) ixNpeDlMicrocodeImageLibraryOverride(x)
-
-/**
- * @def IxNpeDlVersionId
- *
- * @brief Map old terminology that uses term "version" to new term
- * "image"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define IxNpeDlVersionId IxNpeDlImageId
-
-/**
- * @def ixNpeDlVersionDownload
- *
- * @brief Map old terminology that uses term "version" to new term
- * "image"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define ixNpeDlVersionDownload(x,y) ixNpeDlImageDownload(x,y)
-
-/**
- * @def ixNpeDlAvailableVersionsCountGet
- *
- * @brief Map old terminology that uses term "version" to new term
- * "image"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define ixNpeDlAvailableVersionsCountGet(x) ixNpeDlAvailableImagesCountGet(x)
-
-/**
- * @def ixNpeDlAvailableVersionsListGet
- *
- * @brief Map old terminology that uses term "version" to new term
- * "image"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define ixNpeDlAvailableVersionsListGet(x,y) ixNpeDlAvailableImagesListGet(x,y)
-
- /**
- * @def ixNpeDlLoadedVersionGet
- *
- * @brief Map old terminology that uses term "version" to new term
- * "image"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define ixNpeDlLoadedVersionGet(x,y) ixNpeDlLoadedImageGet(x,y)
-
- /**
- * @def clientImage
- *
- * @brief Map old terminology that uses term "image" to new term
- * "image library"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define clientImage clientImageLibrary
-
- /**
- * @def versionIdPtr
- *
- * @brief Map old terminology that uses term "version" to new term
- * "image"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define versionIdPtr imageIdPtr
-
- /**
- * @def numVersionsPtr
- *
- * @brief Map old terminology that uses term "version" to new term
- * "image"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define numVersionsPtr numImagesPtr
-
-/**
- * @def versionIdListPtr
- *
- * @brief Map old terminology that uses term "version" to new term
- * "image"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define versionIdListPtr imageIdListPtr
-
-/**
- * @def IxNpeDlBuildId
- *
- * @brief Map old terminology that uses term "buildId" to new term
- * "functionalityId"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define IxNpeDlBuildId IxNpeDlFunctionalityId
-
-/**
- * @def buildId
- *
- * @brief Map old terminology that uses term "buildId" to new term
- * "functionalityId"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define buildId functionalityId
-
-/**
- * @def IX_NPEDL_MicrocodeImage
- *
- * @brief Map old terminology that uses term "image" to new term
- * "image library"
- *
- * @warning <b>THIS #define HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-#define IX_NPEDL_MicrocodeImage IX_NPEDL_MicrocodeImageLibrary
-
-/*
- * Typedefs
- */
-
-/**
- * @typedef IxNpeDlFunctionalityId
- * @brief Used to make up Functionality ID field of Image Id
- *
- * @warning <b>THIS typedef HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-typedef UINT8 IxNpeDlFunctionalityId;
-
-/**
- * @typedef IxNpeDlMajor
- * @brief Used to make up Major Release field of Image Id
- *
- * @warning <b>THIS typedef HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-typedef UINT8 IxNpeDlMajor;
-
-/**
- * @typedef IxNpeDlMinor
- * @brief Used to make up Minor Revision field of Image Id
- *
- * @warning <b>THIS typedef HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-typedef UINT8 IxNpeDlMinor;
-
-/*
- * Enums
- */
-
-/**
- * @brief NpeId numbers to identify NPE A, B or C
- * @note In this context, for IXP425 Silicon (B0):<br>
- * - NPE-A has HDLC, HSS, AAL and UTOPIA Coprocessors.<br>
- * - NPE-B has Ethernet Coprocessor.<br>
- * - NPE-C has Ethernet, AES, DES and HASH Coprocessors.<br>
- * - IXP400 Product Line have different combinations of coprocessors.
- */
-typedef enum
-{
- IX_NPEDL_NPEID_NPEA = 0, /**< Identifies NPE A */
- IX_NPEDL_NPEID_NPEB, /**< Identifies NPE B */
- IX_NPEDL_NPEID_NPEC, /**< Identifies NPE C */
- IX_NPEDL_NPEID_MAX /**< Total Number of NPEs */
-} IxNpeDlNpeId;
-
-/*
- * Structs
- */
-
-/**
- * @brief Image Id to identify each image contained in an image library
- *
- * @warning <b>THIS struct HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart for more information.
- */
-typedef struct
-{
- IxNpeDlNpeId npeId; /**< NPE ID */
- IxNpeDlFunctionalityId functionalityId; /**< Build ID indicates functionality of image */
- IxNpeDlMajor major; /**< Major Release Number */
- IxNpeDlMinor minor; /**< Minor Revision Number */
-} IxNpeDlImageId;
-
-/*
- * Prototypes for interface functions
- */
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC IX_STATUS ixNpeDlNpeInitAndStart (UINT32 imageId)
- *
- * @brief Stop, reset, download microcode (firmware) and finally start NPE.
- *
- * @param imageId UINT32 [in] - Id of the microcode image to download.
- *
- * This function locates the image specified by the <i>imageId</i> parameter
- * from the default microcode image library which is included internally by
- * this component.
- * It then stops and resets the NPE, loads the firmware image onto the NPE,
- * and then restarts the NPE.
- *
- * @note A list of valid image IDs is included in this header file.
- * See #defines with prefix IX_NPEDL_NPEIMAGE_...
- *
- * @note This function, along with @ref ixNpeDlCustomImageNpeInitAndStart
- * and @ref ixNpeDlLoadedImageFunctionalityGet, supercedes the following
- * functions which are deprecated and will be removed completely in a
- * future release:
- * - @ref ixNpeDlImageDownload
- * - @ref ixNpeDlAvailableImagesCountGet
- * - @ref ixNpeDlAvailableImagesListGet
- * - @ref ixNpeDlLatestImageGet
- * - @ref ixNpeDlLoadedImageGet
- * - @ref ixNpeDlMicrocodeImageLibraryOverride
- * - @ref ixNpeDlNpeExecutionStop
- * - @ref ixNpeDlNpeStopAndReset
- * - @ref ixNpeDlNpeExecutionStart
- *
- * @pre
- * - The Client is responsible for ensuring mutual access to the NPE.
- * @post
- * - The NPE Instruction Pipeline will be cleared if State Information
- * has been downloaded.
- * - If the download fails with a critical error, the NPE may
- * be left in an ususable state.
- * @return
- * - IX_SUCCESS if the download was successful;
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_NPEDL_CRITICAL_NPE_ERR if a critical NPE error occured during
- * download
- * - IX_NPEDL_CRITICAL_MICROCODE_ERR if a critical microcode error
- * occured during download
- * - IX_NPEDL_DEVICE_ERR if the image being loaded is not meant for
- * the device currently running.
- * - IX_FAIL if NPE is not available or image is failed to be located.
- * A warning is issued if the NPE is not present.
- */
-PUBLIC IX_STATUS
-ixNpeDlNpeInitAndStart (UINT32 npeImageId);
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC IX_STATUS ixNpeDlCustomImageNpeInitAndStart (UINT32 *imageLibrary,
- UINT32 imageId)
- *
- * @brief Stop, reset, download microcode (firmware) and finally start NPE
- *
- * @param imageId UINT32 [in] - Id of the microcode image to download.
- *
- * This function locates the image specified by the <i>imageId</i> parameter
- * from the specified microcode image library which is pointed to by the
- * <i>imageLibrary</i> parameter.
- * It then stops and resets the NPE, loads the firmware image onto the NPE,
- * and then restarts the NPE.
- *
- * This is a facility for users who wish to use an image from an external
- * library of NPE firmware images. To use a standard image from the
- * built-in library, see @ref ixNpeDlNpeInitAndStart instead.
- *
- * @note A list of valid image IDs is included in this header file.
- * See #defines with prefix IX_NPEDL_NPEIMAGE_...
- *
- * @note This function, along with @ref ixNpeDlNpeInitAndStart
- * and @ref ixNpeDlLoadedImageFunctionalityGet, supercedes the following
- * functions which are deprecated and will be removed completely in a
- * future release:
- * - @ref ixNpeDlImageDownload
- * - @ref ixNpeDlAvailableImagesCountGet
- * - @ref ixNpeDlAvailableImagesListGet
- * - @ref ixNpeDlLatestImageGet
- * - @ref ixNpeDlLoadedImageGet
- * - @ref ixNpeDlMicrocodeImageLibraryOverride
- * - @ref ixNpeDlNpeExecutionStop
- * - @ref ixNpeDlNpeStopAndReset
- * - @ref ixNpeDlNpeExecutionStart
- *
- * @pre
- * - The Client is responsible for ensuring mutual access to the NPE.
- * - The image library supplied must be in the correct format for use
- * by the NPE Downloader (IxNpeDl) component. Details of the library
- * format are contained in the Functional Specification document for
- * IxNpeDl.
- * @post
- * - The NPE Instruction Pipeline will be cleared if State Information
- * has been downloaded.
- * - If the download fails with a critical error, the NPE may
- * be left in an ususable state.
- * @return
- * - IX_SUCCESS if the download was successful;
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_NPEDL_CRITICAL_NPE_ERR if a critical NPE error occured during
- * download
- * - IX_NPEDL_CRITICAL_MICROCODE_ERR if a critical microcode error
- * occured during download
- * - IX_NPEDL_DEVICE_ERR if the image being loaded is not meant for
- * the device currently running.
- * - IX_FAIL if NPE is not available or image is failed to be located.
- * A warning is issued if the NPE is not present.
- */
-PUBLIC IX_STATUS
-ixNpeDlCustomImageNpeInitAndStart (UINT32 *imageLibrary,
- UINT32 npeImageId);
-
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC IX_STATUS ixNpeDlLoadedImageFunctionalityGet (IxNpeDlNpeId npeId,
- UINT8 *functionalityId)
- *
- * @brief Gets the functionality of the image last loaded on a particular NPE
- *
- * @param npeId @ref IxNpeDlNpeId [in] - Id of the target NPE.
- * @param functionalityId UINT8* [out] - the functionality ID of the image
- * last loaded on the NPE.
- *
- * This function retrieves the functionality ID of the image most recently
- * downloaded successfully to the specified NPE. If the NPE does not contain
- * a valid image, this function returns a FAIL status.
- *
- * @warning This function is not intended for general use, as a knowledge of
- * how to interpret the functionality ID is required. As such, this function
- * should only be used by other Access Layer components of the IXP400 Software
- * Release.
- *
- * @pre
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_FAIL if the NPE does not have a valid image loaded
- */
-PUBLIC IX_STATUS
-ixNpeDlLoadedImageFunctionalityGet (IxNpeDlNpeId npeId,
- UINT8 *functionalityId);
-
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn IX_STATUS ixNpeDlMicrocodeImageLibraryOverride (UINT32 *clientImageLibrary)
- *
- * @brief This instructs NPE Downloader to use client-supplied microcode image library.
- *
- * @param clientImageLibrary UINT32* [in] - Pointer to the client-supplied
- * NPE microcode image library
- *
- * This function sets NPE Downloader to use a client-supplied microcode image library
- * instead of the standard image library which is included by the NPE Downloader.
- * <b>This function is provided mainly for increased testability and should not
- * be used in normal circumstances.</b> When not used, NPE Downloader will use
- * a "built-in" image library, local to this component, which should always contain the
- * latest microcode for the NPEs.
- *
- * @warning <b>THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlCustomImageNpeInitAndStart.
- *
- * @pre
- * - <i>clientImageLibrary</i> should point to a microcode image library valid for use
- * by the NPE Downloader component.
- *
- * @post
- * - the client-supplied image library will be used for all subsequent operations
- * performed by the NPE Downloader
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_FAIL if the client-supplied image library did not contain a valid signature
- */
-PUBLIC IX_STATUS
-ixNpeDlMicrocodeImageLibraryOverride (UINT32 *clientImageLibrary);
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC IX_STATUS ixNpeDlImageDownload (IxNpeDlImageId *imageIdPtr,
- BOOL verify)
- *
- * @brief Stop, reset, download microcode and finally start NPE.
- *
- * @param imageIdPtr @ref IxNpeDlImageId* [in] - Pointer to Id of the microcode
- * image to download.
- * @param verify BOOL [in] - ON/OFF option to verify the download. If ON
- * (verify == TRUE), the Downloader will read back
- * each word written to the NPE registers to
- * ensure the download operation was successful.
- *
- * Using the <i>imageIdPtr</i>, this function locates a particular image of
- * microcode in the microcode image library in memory, and downloads the microcode
- * to a particular NPE.
- *
- * @warning <b>THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart and @ref ixNpeDlCustomImageNpeInitAndStart.
- *
- * @pre
- * - The Client is responsible for ensuring mutual access to the NPE.
- * - The Client should use ixNpeDlLatestImageGet() to obtain the latest
- * version of the image before attempting download.
- * @post
- * - The NPE Instruction Pipeline will be cleared if State Information
- * has been downloaded.
- * - If the download fails with a critical error, the NPE may
- * be left in an ususable state.
- * @return
- * - IX_SUCCESS if the download was successful;
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_NPEDL_CRITICAL_NPE_ERR if a critical NPE error occured during
- * download
- * - IX_PARAM_CRITICAL_MICROCODE_ERR if a critical microcode error
- * occured during download
- * - IX_FAIL if NPE is not available or image is failed to be located.
- * A warning is issued if the NPE is not present.
- */
-PUBLIC IX_STATUS
-ixNpeDlImageDownload (IxNpeDlImageId *imageIdPtr,
- BOOL verify);
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC IX_STATUS ixNpeDlAvailableImagesCountGet (UINT32 *numImagesPtr)
- *
- * @brief Get the number of Images available in a microcode image library
- *
- * @param numImagesPtr UINT32* [out] - A pointer to the number of images in
- * the image library.
- *
- * Gets the number of images available in the microcode image library.
- * Then returns this in a variable pointed to by <i>numImagesPtr</i>.
- *
- * @warning <b>THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart and @ref ixNpeDlCustomImageNpeInitAndStart.
- *
- * @pre
- * - The Client should declare the variable to which numImagesPtr points
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_FAIL otherwise
- */
-PUBLIC IX_STATUS
-ixNpeDlAvailableImagesCountGet (UINT32 *numImagesPtr);
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC IX_STATUS ixNpeDlAvailableImagesListGet (IxNpeDlImageId *imageIdListPtr,
- UINT32 *listSizePtr)
- *
- * @brief Get a list of the images available in a microcode image library
- *
- * @param imageIdListPtr @ref IxNpeDlImageId* [out] - Array to contain list of
- * image Ids (memory
- * allocated by Client).
- * @param listSizePtr UINT32* [inout] - As an input, this param should point
- * to the max number of Ids the
- * <i>imageIdListPtr</i> array can
- * hold. NpeDl will replace the input
- * value of this parameter with the
- * number of image Ids actually filled
- * into the array before returning.
- *
- * Finds list of images available in the microcode image library.
- * Fills these into the array pointed to by <i>imageIdListPtr</i>
- *
- * @warning <b>THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart and @ref ixNpeDlCustomImageNpeInitAndStart.
- *
- * @pre
- * - The Client should declare the variable to which numImagesPtr points
- * - The Client should create an array (<i>imageIdListPtr</i>) large
- * enough to contain all the image Ids in the image library
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_FAIL otherwise
- */
-PUBLIC IX_STATUS
-ixNpeDlAvailableImagesListGet (IxNpeDlImageId *imageIdListPtr,
- UINT32 *listSizePtr);
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC IX_STATUS ixNpeDlLoadedImageGet (IxNpeDlNpeId npeId,
- IxNpeDlImageId *imageIdPtr)
- *
- * @brief Gets the Id of the image currently loaded on a particular NPE
- *
- * @param npeId @ref IxNpeDlNpeId [in] - Id of the target NPE.
- * @param imageIdPtr @ref IxNpeDlImageId* [out] - Pointer to the where the
- * image id should be stored.
- *
- * If an image of microcode was previously downloaded successfully to the NPE
- * by NPE Downloader, this function returns in <i>imageIdPtr</i> the image
- * Id of that image loaded on the NPE.
- *
- * @pre
- * - The Client has allocated memory to the <i>imageIdPtr</i> pointer.
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_FAIL if the NPE doesn't currently have a image loaded
- */
-PUBLIC IX_STATUS
-ixNpeDlLoadedImageGet (IxNpeDlNpeId npeId,
- IxNpeDlImageId *imageIdPtr);
-
-/**
- * @fn PUBLIC IX_STATUS ixNpeDlLatestImageGet (IxNpeDlNpeId npeId, IxNpeDlFunctionalityId
- functionalityId, IxNpeDlImageId *imageIdPtr)
- *
- * @brief This instructs NPE Downloader to get Id of the latest version for an
- * image that is specified by the client.
- *
- * @param npeId @ref IxNpeDlNpeId [in] - Id of the target NPE.
- * @param functionalityId @ref IxNpeDlFunctionalityId [in] - functionality of the image
- * @param imageIdPtr @ref IxNpeDlImageId* [out] - Pointer to the where the
- * image id should be stored.
- *
- * This function sets NPE Downloader to return the id of the latest version for
- * image. The user will select the image by providing a particular NPE
- * (specifying <i>npeId</i>) with particular functionality (specifying
- * <i>FunctionalityId</i>). The most recent version available as determined by the
- * highest Major and Minor revision numbers is returned in <i>imageIdPtr</i>.
- *
- * @warning <b>THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart and @ref ixNpeDlCustomImageNpeInitAndStart.
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_FAIL otherwise
- */
-PUBLIC IX_STATUS
-ixNpeDlLatestImageGet (IxNpeDlNpeId npeId,
- IxNpeDlFunctionalityId functionalityId,
- IxNpeDlImageId *imageIdPtr);
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC IX_STATUS ixNpeDlNpeStopAndReset (IxNpeDlNpeId npeId)
- *
- * @brief Stops and Resets an NPE
- *
- * @param npeId @ref IxNpeDlNpeId [in] - Id of the target NPE.
- *
- * This function performs a soft NPE reset by writing reset values to
- * particular NPE registers. Note that this does not reset NPE co-processors.
- * This implicitly stops NPE code execution before resetting the NPE.
- *
- * @note It is no longer necessary to call this function before downloading
- * a new image to the NPE. It is left on the API only to allow greater control
- * of NPE execution if required. Where appropriate, use @ref ixNpeDlNpeInitAndStart
- * or @ref ixNpeDlCustomImageNpeInitAndStart instead.
- *
- * @warning <b>THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart and @ref ixNpeDlCustomImageNpeInitAndStart.
- *
- * @pre
- * - The Client is responsible for ensuring mutual access to the NPE.
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_FAIL otherwise
- * - IX_NPEDL_CRITICAL_NPE_ERR failed to reset NPE due to timeout error.
- * Timeout error could happen if NPE hang
- */
-PUBLIC IX_STATUS
-ixNpeDlNpeStopAndReset (IxNpeDlNpeId npeId);
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC IX_STATUS ixNpeDlNpeExecutionStart (IxNpeDlNpeId npeId)
- *
- * @brief Starts code execution on a NPE
- *
- * @param npeId @ref IxNpeDlNpeId [in] - Id of the target NPE
- *
- * Starts execution of code on a particular NPE. A client would typically use
- * this after a download to NPE is performed, to start/restart code execution
- * on the NPE.
- *
- * @note It is no longer necessary to call this function after downloading
- * a new image to the NPE. It is left on the API only to allow greater control
- * of NPE execution if required. Where appropriate, use @ref ixNpeDlNpeInitAndStart
- * or @ref ixNpeDlCustomImageNpeInitAndStart instead.
- *
- * @warning <b>THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart and @ref ixNpeDlCustomImageNpeInitAndStart.
- *
- * @pre
- * - The Client is responsible for ensuring mutual access to the NPE.
- * - Note that this function does not set the NPE Next Program Counter
- * (NextPC), so it should be set beforehand if required by downloading
- * appropriate State Information (using ixNpeDlVersionDownload()).
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_FAIL otherwise
- */
-PUBLIC IX_STATUS
-ixNpeDlNpeExecutionStart (IxNpeDlNpeId npeId);
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC IX_STATUS ixNpeDlNpeExecutionStop (IxNpeDlNpeId npeId)
- *
- * @brief Stops code execution on a NPE
- *
- * @param npeId @ref IxNpeDlNpeId [in] - Id of the target NPE
- *
- * Stops execution of code on a particular NPE. This would typically be used
- * by a client before a download to NPE is performed, to stop code execution on
- * an NPE, unless ixNpeDlNpeStopAndReset() is used instead. Unlike
- * ixNpeDlNpeStopAndReset(), this function only halts the NPE and leaves
- * all registers and settings intact. This is useful, for example, between
- * stages of a multi-stage download, to stop the NPE prior to downloading the
- * next image while leaving the current state of the NPE intact..
- *
- * @warning <b>THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.</b>
- * It will be removed in a future release.
- * See @ref ixNpeDlNpeInitAndStart and @ref ixNpeDlCustomImageNpeInitAndStart.
- *
- * @pre
- * - The Client is responsible for ensuring mutual access to the NPE.
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_NPEDL_PARAM_ERR if a parameter error occured
- * - IX_FAIL otherwise
- */
-PUBLIC IX_STATUS
-ixNpeDlNpeExecutionStop (IxNpeDlNpeId npeId);
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC IX_STATUS ixNpeDlUnload (void)
- *
- * @brief This function will uninitialise the IxNpeDl component.
- *
- * This function will uninitialise the IxNpeDl component. It should only be
- * called once, and only if the IxNpeDl component has already been initialised by
- * calling any of the following functions:
- * - @ref ixNpeDlNpeInitAndStart
- * - @ref ixNpeDlCustomImageNpeInitAndStart
- * - @ref ixNpeDlImageDownload (deprecated)
- * - @ref ixNpeDlNpeStopAndReset (deprecated)
- * - @ref ixNpeDlNpeExecutionStop (deprecated)
- * - @ref ixNpeDlNpeExecutionStart (deprecated)
- *
- * If possible, this function should be called before a soft reboot or unloading
- * a kernel module to perform any clean up operations required for IxNpeDl.
- *
- * The following actions will be performed by this function:
- * - Unmapping of any kernel memory mapped by IxNpeDl
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_FAIL otherwise
- */
-
-PUBLIC IX_STATUS
-ixNpeDlUnload (void);
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC void ixNpeDlStatsShow (void)
- *
- * @brief This function will display run-time statistics from the IxNpeDl
- * component
- *
- * @return none
- */
-PUBLIC void
-ixNpeDlStatsShow (void);
-
-/**
- * @ingroup IxNpeDl
- *
- * @fn PUBLIC void ixNpeDlStatsReset (void)
- *
- * @brief This function will reset the statistics of the IxNpeDl component
- *
- * @return none
- */
-PUBLIC void
-ixNpeDlStatsReset (void);
-
-#endif /* IXNPEDL_H */
-
-/**
- * @} defgroup IxNpeDl
- */
-
-
diff --git a/cpu/ixp/npe/include/IxNpeDlImageMgr_p.h b/cpu/ixp/npe/include/IxNpeDlImageMgr_p.h
deleted file mode 100644
index 622f879a41..0000000000
--- a/cpu/ixp/npe/include/IxNpeDlImageMgr_p.h
+++ /dev/null
@@ -1,363 +0,0 @@
-/**
- * @file IxNpeDlImageMgr_p.h
- *
- * @author Intel Corporation
- * @date 14 December 2001
-
- * @brief This file contains the private API for the ImageMgr module
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxNpeDlImageMgr_p IxNpeDlImageMgr_p
- *
- * @brief The private API for the IxNpeDl ImageMgr module
- *
- * @{
- */
-
-#ifndef IXNPEDLIMAGEMGR_P_H
-#define IXNPEDLIMAGEMGR_P_H
-
-
-/*
- * Put the user defined include files required.
- */
-#include "IxNpeDl.h"
-#include "IxOsalTypes.h"
-
-
-/*
- * #defines and macros
- */
-
-/**
- * @def IX_NPEDL_IMAGEMGR_SIGNATURE
- *
- * @brief Signature found as 1st word in a microcode image library
- */
-#define IX_NPEDL_IMAGEMGR_SIGNATURE 0xDEADBEEF
-
-/**
- * @def IX_NPEDL_IMAGEMGR_END_OF_HEADER
- *
- * @brief Marks end of header in a microcode image library
- */
-#define IX_NPEDL_IMAGEMGR_END_OF_HEADER 0xFFFFFFFF
-
-/**
- * @def IX_NPEDL_IMAGEID_NPEID_OFFSET
- *
- * @brief Offset from LSB of NPE ID field in Image ID
- */
-#define IX_NPEDL_IMAGEID_NPEID_OFFSET 24
-
-/**
- * @def IX_NPEDL_IMAGEID_DEVICEID_OFFSET
- *
- * @brief Offset from LSB of Device ID field in Image ID
- */
-#define IX_NPEDL_IMAGEID_DEVICEID_OFFSET 28
-
-/**
- * @def IX_NPEDL_IMAGEID_FUNCTIONID_OFFSET
- *
- * @brief Offset from LSB of Functionality ID field in Image ID
- */
-#define IX_NPEDL_IMAGEID_FUNCTIONID_OFFSET 16
-
-/**
- * @def IX_NPEDL_IMAGEID_MAJOR_OFFSET
- *
- * @brief Offset from LSB of Major revision field in Image ID
- */
-#define IX_NPEDL_IMAGEID_MAJOR_OFFSET 8
-
-/**
- * @def IX_NPEDL_IMAGEID_MINOR_OFFSET
- *
- * @brief Offset from LSB of Minor revision field in Image ID
- */
-#define IX_NPEDL_IMAGEID_MINOR_OFFSET 0
-
-
-/**
- * @def IX_NPEDL_NPEID_FROM_IMAGEID_GET
- *
- * @brief Macro to extract NPE ID field from Image ID
- */
-#define IX_NPEDL_NPEID_FROM_IMAGEID_GET(imageId) \
- (((imageId) >> IX_NPEDL_IMAGEID_NPEID_OFFSET) & \
- IX_NPEDL_NPEIMAGE_NPEID_MASK)
-
-/**
- * @def IX_NPEDL_DEVICEID_FROM_IMAGEID_GET
- *
- * @brief Macro to extract NPE ID field from Image ID
- */
-#define IX_NPEDL_DEVICEID_FROM_IMAGEID_GET(imageId) \
- (((imageId) >> IX_NPEDL_IMAGEID_DEVICEID_OFFSET) & \
- IX_NPEDL_NPEIMAGE_DEVICEID_MASK)
-
-/**
- * @def IX_NPEDL_FUNCTIONID_FROM_IMAGEID_GET
- *
- * @brief Macro to extract Functionality ID field from Image ID
- */
-#define IX_NPEDL_FUNCTIONID_FROM_IMAGEID_GET(imageId) \
- (((imageId) >> IX_NPEDL_IMAGEID_FUNCTIONID_OFFSET) & \
- IX_NPEDL_NPEIMAGE_FIELD_MASK)
-
-/**
- * @def IX_NPEDL_MAJOR_FROM_IMAGEID_GET
- *
- * @brief Macro to extract Major revision field from Image ID
- */
-#define IX_NPEDL_MAJOR_FROM_IMAGEID_GET(imageId) \
- (((imageId) >> IX_NPEDL_IMAGEID_MAJOR_OFFSET) & \
- IX_NPEDL_NPEIMAGE_FIELD_MASK)
-
-/**
- * @def IX_NPEDL_MINOR_FROM_IMAGEID_GET
- *
- * @brief Macro to extract Minor revision field from Image ID
- */
-#define IX_NPEDL_MINOR_FROM_IMAGEID_GET(imageId) \
- (((imageId) >> IX_NPEDL_IMAGEID_MINOR_OFFSET) & \
- IX_NPEDL_NPEIMAGE_FIELD_MASK)
-
-
-/*
- * Prototypes for interface functions
- */
-
-/**
- * @fn IX_STATUS ixNpeDlImageMgrMicrocodeImageLibraryOverride (UINT32 *clientImageLibrary)
- *
- * @brief This instructs NPE Downloader to use client-supplied microcode image library.
- *
- * This function sets NPE Downloader to use a client-supplied microcode image library
- * instead of the standard image library which is included by the NPE Downloader.
- *
- * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.
- * It will be removed in a future release.
- * See API header file IxNpeDl.h for more information.
- *
- * @pre
- * - <i>clientImageLibrary</i> should point to a microcode image library valid for use
- * by the NPE Downloader component.
- *
- * @post
- * - the client-supplied image uibrary will be used for all subsequent operations
- * performed by the NPE Downloader
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_FAIL if the client-supplied image library did not contain a valid signature
- */
-IX_STATUS
-ixNpeDlImageMgrMicrocodeImageLibraryOverride (UINT32 *clientImageLibrary);
-
-
-/**
- * @fn IX_STATUS ixNpeDlImageMgrImageListExtract (IxNpeDlImageId *imageListPtr,
- UINT32 *numImages)
- *
- * @brief Extracts a list of images available in the NPE microcode image library.
- *
- * @param IxNpeDlImageId* [out] imageListPtr - pointer to array to contain
- * a list of images. If NULL,
- * only the number of images
- * is returned (in
- * <i>numImages</i>)
- * @param UINT32* [inout] numImages - As input, it points to a variable
- * containing the number of images which
- * can be stored in the
- * <i>imageListPtr</i> array. Its value
- * is ignored as input if
- * <i>imageListPtr</i> is NULL. As an
- * output, it will contain number of
- * images in the image library.
- *
- * This function reads the header of the microcode image library and extracts a list of the
- * images available in the image library. It can also be used to find the number of
- * images in the image library.
- *
- * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.
- * It will be removed in a future release.
- * See API header file IxNpeDl.h for more information.
- *
- * @pre
- * - if <i>imageListPtr</i> != NULL, <i>numImages</i> should reflect the
- * number of image Id elements the <i>imageListPtr</i> can contain.
- *
- * @post
- * - <i>numImages</i> will reflect the number of image Id's found in the
- * microcode image library.
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_FAIL otherwise
- */
-IX_STATUS
-ixNpeDlImageMgrImageListExtract (IxNpeDlImageId *imageListPtr,
- UINT32 *numImages);
-
-
-/**
- * @fn IX_STATUS ixNpeDlImageMgrImageLocate (IxNpeDlImageId *imageId,
- UINT32 **imagePtr,
- UINT32 *imageSize)
- *
- * @brief Finds a image block in the NPE microcode image library.
- *
- * @param IxNpeDlImageId* [in] imageId - the id of the image to locate
- * @param UINT32** [out] imagePtr - pointer to the image in memory
- * @param UINT32* [out] imageSize - size (in 32-bit words) of image
- *
- * This function examines the header of the microcode image library for the location
- * and size of the specified image.
- *
- * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.
- * It will be removed in a future release.
- * See API header file IxNpeDl.h for more information.
- *
- * @pre
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_FAIL otherwise
- */
-IX_STATUS
-ixNpeDlImageMgrImageLocate (IxNpeDlImageId *imageId,
- UINT32 **imagePtr,
- UINT32 *imageSize);
-
-/**
- * @fn IX_STATUS ixNpeDlImageMgrLatestImageExtract (IxNpeDlImageId *imageId)
- *
- * @brief Finds the most recent version of an image in the NPE image library.
- *
- * @param IxNpeDlImageId* [inout] imageId - the id of the image
- *
- * This function determines the most recent version of a specified image by its
- * higest major release and minor revision numbers
- *
- * @note THIS FUNCTION HAS BEEN DEPRECATED AND SHOULD NOT BE USED.
- * It will be removed in a future release.
- * See API header file IxNpeDl.h for more information.
- *
- * @pre
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_FAIL otherwise
- */
-IX_STATUS
-ixNpeDlImageMgrLatestImageExtract (IxNpeDlImageId *imageId);
-
-/**
- * @fn void ixNpeDlImageMgrStatsShow (void)
- *
- * @brief This function will display the statistics of the IxNpeDl ImageMgr
- * module
- *
- * @return none
- */
-void
-ixNpeDlImageMgrStatsShow (void);
-
-
-/**
- * @fn void ixNpeDlImageMgrStatsReset (void)
- *
- * @brief This function will reset the statistics of the IxNpeDl ImageMgr
- * module
- *
- * @return none
- */
-void
-ixNpeDlImageMgrStatsReset (void);
-
-
-/**
- * @fn IX_STATUS ixNpeDlImageMgrImageGet (UINT32 *imageLibrary,
- UINT32 imageId,
- UINT32 **imagePtr,
- UINT32 *imageSize)
- *
- * @brief Finds a image block in the NPE microcode image library.
- *
- * @param UINT32* [in] imageLibrary - the image library to use
- * @param UINT32 [in] imageId - the id of the image to locate
- * @param UINT32** [out] imagePtr - pointer to the image in memory
- * @param UINT32* [out] imageSize - size (in 32-bit words) of image
- *
- * This function examines the header of the specified microcode image library
- * for the location and size of the specified image. It returns a pointer to
- * the image in the <i>imagePtr</i> parameter.
- * If no image library is specified (imageLibrary == NULL), then the default
- * built-in image library will be used.
- *
- * @pre
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_FAIL otherwise
- */
-IX_STATUS
-ixNpeDlImageMgrImageFind (UINT32 *imageLibrary,
- UINT32 imageId,
- UINT32 **imagePtr,
- UINT32 *imageSize);
-
-
-#endif /* IXNPEDLIMAGEMGR_P_H */
-
-/**
- * @} defgroup IxNpeDlImageMgr_p
- */
diff --git a/cpu/ixp/npe/include/IxNpeDlMacros_p.h b/cpu/ixp/npe/include/IxNpeDlMacros_p.h
deleted file mode 100644
index e32906a63a..0000000000
--- a/cpu/ixp/npe/include/IxNpeDlMacros_p.h
+++ /dev/null
@@ -1,414 +0,0 @@
-/**
- * @file IxNpeDlMacros_p.h
- *
- * @author Intel Corporation
- * @date 21 January 2002
- *
- * @brief This file contains the macros for the IxNpeDl component.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxNpeDlMacros_p IxNpeDlMacros_p
- *
- * @brief Macros for the IxNpeDl component.
- *
- * @{
- */
-
-#ifndef IXNPEDLMACROS_P_H
-#define IXNPEDLMACROS_P_H
-
-
-/*
- * Put the user defined include files required.
- */
-#if (CPU != XSCALE)
-/* To support IxNpeDl unit tests... */
-#include <stdio.h>
-#include "test/IxNpeDlTestReg.h"
-
-#else
-#include "IxOsal.h"
-
-#endif
-
-
-/*
- * Typedefs
- */
-
-/**
- * @typedef IxNpeDlTraceTypes
- * @brief Enumeration defining IxNpeDl trace levels
- */
-typedef enum
-{
- IX_NPEDL_TRACE_OFF, /**< no trace */
- IX_NPEDL_DEBUG, /**< debug */
- IX_NPEDL_FN_ENTRY_EXIT /**< function entry/exit */
-} IxNpeDlTraceTypes;
-
-
-/*
- * #defines and macros.
- */
-
-/* Implementation of the following macros for use with IxNpeDl unit test code */
-#if (CPU != XSCALE)
-
-
-/**
- * @def IX_NPEDL_TRACE_LEVEL
- *
- * @brief IxNpeDl debug trace level
- */
-#define IX_NPEDL_TRACE_LEVEL IX_NPEDL_FN_ENTRY_EXIT
-
-/**
- * @def IX_NPEDL_ERROR_REPORT
- *
- * @brief Mechanism for reporting IxNpeDl software errors
- *
- * @param char* [in] STR - Error string to report
- *
- * This macro simply prints the error string passed.
- * Intended for use with IxNpeDl unit test code.
- *
- * @return none
- */
-#define IX_NPEDL_ERROR_REPORT(STR) printf ("IxNpeDl ERROR: %s\n", (STR));
-
-/**
- * @def IX_NPEDL_WARNING_REPORT
- *
- * @brief Mechanism for reporting IxNpeDl software errors
- *
- * @param char* [in] STR - Error string to report
- *
- * This macro simply prints the error string passed.
- * Intended for use with IxNpeDl unit test code.
- *
- * @return none
- */
-#define IX_NPEDL_WARNING_REPORT(STR) printf ("IxNpeDl WARNING: %s\n", (STR));
-
-/**
- * @def IX_NPEDL_TRACE0
- *
- * @brief Mechanism for tracing debug for the IxNpeDl component, for no arguments
- *
- * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
- * @param char* [in] STR - Trace string
- *
- * This macro simply prints the trace string passed, if the level is supported.
- * Intended for use with IxNpeDl unit test code.
- *
- * @return none
- */
-#define IX_NPEDL_TRACE0(LEVEL, STR) \
-{ \
- if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
- { \
- printf ("IxNpeDl TRACE: "); \
- printf ((STR)); \
- printf ("\n"); \
- } \
-}
-
- /**
- * @def IX_NPEDL_TRACE1
- *
- * @brief Mechanism for tracing debug for the IxNpeDl component, with 1 argument
- *
- * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
- * @param char* [in] STR - Trace string
- * @param argType [in] ARG1 - Argument to trace
- *
- * This macro simply prints the trace string passed, if the level is supported.
- * Intended for use with IxNpeDl unit test code.
- *
- * @return none
- */
-#define IX_NPEDL_TRACE1(LEVEL, STR, ARG1) \
-{ \
- if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
- { \
- printf ("IxNpeDl TRACE: "); \
- printf (STR, ARG1); \
- printf ("\n"); \
- } \
-}
-
-/**
- * @def IX_NPEDL_TRACE2
- *
- * @brief Mechanism for tracing debug for the IxNpeDl component, with 2 arguments
- *
- * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
- * @param char* [in] STR - Trace string
- * @param argType [in] ARG1 - Argument to trace
- * @param argType [in] ARG2 - Argument to trace
- *
- * This macro simply prints the trace string passed, if the level is supported.
- * Intended for use with IxNpeDl unit test code.
- *
- * @return none
- */
-#define IX_NPEDL_TRACE2(LEVEL, STR, ARG1, ARG2) \
-{ \
- if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
- { \
- printf ("IxNpeDl TRACE: "); \
- printf (STR, ARG1, ARG2); \
- printf ("\n"); \
- } \
-}
-
-
-/**
- * @def IX_NPEDL_REG_WRITE
- *
- * @brief Mechanism for writing to a memory-mapped register
- *
- * @param UINT32 [in] base - Base memory address for this NPE's registers
- * @param UINT32 [in] offset - Offset from base memory address
- * @param UINT32 [in] value - Value to write to register
- *
- * This macro calls a function from Unit Test code to write a register. This
- * allows extra flexibility for unit testing of the IxNpeDl component.
- *
- * @return none
- */
-#define IX_NPEDL_REG_WRITE(base, offset, value) \
-{ \
- ixNpeDlTestRegWrite (base, offset, value); \
-}
-
-
-/**
- * @def IX_NPEDL_REG_READ
- *
- * @brief Mechanism for reading from a memory-mapped register
- *
- * @param UINT32 [in] base - Base memory address for this NPE's registers
- * @param UINT32 [in] offset - Offset from base memory address
- * @param UINT32 *[out] value - Value read from register
- *
- * This macro calls a function from Unit Test code to read a register. This
- * allows extra flexibility for unit testing of the IxNpeDl component.
- *
- * @return none
- */
-#define IX_NPEDL_REG_READ(base, offset, value) \
-{ \
- ixNpeDlTestRegRead (base, offset, value); \
-}
-
-
-/* Implementation of the following macros when integrated with IxOsal */
-#else /* #if (CPU != XSCALE) */
-
-
-/**
- * @def IX_NPEDL_TRACE_LEVEL
- *
- * @brief IxNpeDl debug trace level
- */
-#define IX_NPEDL_TRACE_LEVEL IX_NPEDL_DEBUG
-
-
-/**
- * @def IX_NPEDL_ERROR_REPORT
- *
- * @brief Mechanism for reporting IxNpeDl software errors
- *
- * @param char* [in] STR - Error string to report
- *
- * This macro is used to report IxNpeDl software errors.
- *
- * @return none
- */
-#define IX_NPEDL_ERROR_REPORT(STR) \
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDERR, STR, 0, 0, 0, 0, 0, 0);
-
-/**
- * @def IX_NPEDL_WARNING_REPORT
- *
- * @brief Mechanism for reporting IxNpeDl software warnings
- *
- * @param char* [in] STR - Warning string to report
- *
- * This macro is used to report IxNpeDl software warnings.
- *
- * @return none
- */
-#define IX_NPEDL_WARNING_REPORT(STR) \
- ixOsalLog (IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT, STR, 0, 0, 0, 0, 0, 0);
-
-
-/**
- * @def IX_NPEDL_TRACE0
- *
- * @brief Mechanism for tracing debug for the IxNpeDl component, for no arguments
- *
- * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
- * @param char* [in] STR - Trace string
- *
- * This macro simply prints the trace string passed, if the level is supported.
- *
- * @return none
- */
-#define IX_NPEDL_TRACE0(LEVEL, STR) \
-{ \
- if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
- { \
- if (LEVEL == IX_NPEDL_FN_ENTRY_EXIT) \
- { \
- ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3, IX_OSAL_LOG_DEV_STDOUT, STR, 0, 0, 0, 0, 0, 0); \
- } \
- else if (LEVEL == IX_NPEDL_DEBUG) \
- { \
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, STR, 0, 0, 0, 0, 0, 0); \
- } \
- } \
-}
-
-/**
- * @def IX_NPEDL_TRACE1
- *
- * @brief Mechanism for tracing debug for the IxNpeDl component, with 1 argument
- *
- * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
- * @param char* [in] STR - Trace string
- * @param argType [in] ARG1 - Argument to trace
- *
- * This macro simply prints the trace string passed, if the level is supported.
- *
- * @return none
- */
-#define IX_NPEDL_TRACE1(LEVEL, STR, ARG1) \
-{ \
- if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
- { \
- if (LEVEL == IX_NPEDL_FN_ENTRY_EXIT) \
- { \
- ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, 0, 0, 0, 0, 0); \
- } \
- else if (LEVEL == IX_NPEDL_DEBUG) \
- { \
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, 0, 0, 0, 0, 0); \
- } \
- } \
-}
-
-/**
- * @def IX_NPEDL_TRACE2
- *
- * @brief Mechanism for tracing debug for the IxNpeDl component, with 2 arguments
- *
- * @param unsigned [in] LEVEL - one of IxNpeDlTraceTypes enumerated values
- * @param char* [in] STR - Trace string
- * @param argType [in] ARG1 - Argument to trace
- * @param argType [in] ARG2 - Argument to trace
- *
- * This macro simply prints the trace string passed, if the level is supported.
- *
- * @return none
- */
-#define IX_NPEDL_TRACE2(LEVEL, STR, ARG1, ARG2) \
-{ \
- if (LEVEL <= IX_NPEDL_TRACE_LEVEL) \
- { \
- if (LEVEL == IX_NPEDL_FN_ENTRY_EXIT) \
- { \
- ixOsalLog (IX_OSAL_LOG_LVL_DEBUG3, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, ARG2, 0, 0, 0, 0); \
- } \
- else if (LEVEL == IX_NPEDL_DEBUG) \
- { \
- ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, STR, ARG1, ARG2, 0, 0, 0, 0); \
- } \
- } \
-}
-
-/**
- * @def IX_NPEDL_REG_WRITE
- *
- * @brief Mechanism for writing to a memory-mapped register
- *
- * @param UINT32 [in] base - Base memory address for this NPE's registers
- * @param UINT32 [in] offset - Offset from base memory address
- * @param UINT32 [in] value - Value to write to register
- *
- * This macro forms the address of the register from base address + offset, and
- * dereferences that address to write the contents of the register.
- *
- * @return none
- */
-#define IX_NPEDL_REG_WRITE(base, offset, value) \
- IX_OSAL_WRITE_LONG(((base) + (offset)), (value))
-
-
-
-/**
- * @def IX_NPEDL_REG_READ
- *
- * @brief Mechanism for reading from a memory-mapped register
- *
- * @param UINT32 [in] base - Base memory address for this NPE's registers
- * @param UINT32 [in] offset - Offset from base memory address
- * @param UINT32 *[out] value - Value read from register
- *
- * This macro forms the address of the register from base address + offset, and
- * dereferences that address to read the register contents.
- *
- * @return none
- */
-#define IX_NPEDL_REG_READ(base, offset, value) \
- *(value) = IX_OSAL_READ_LONG(((base) + (offset)))
-
-#endif /* #if (CPU != XSCALE) */
-
-#endif /* IXNPEDLMACROS_P_H */
-
-/**
- * @} defgroup IxNpeDlMacros_p
- */
diff --git a/cpu/ixp/npe/include/IxNpeDlNpeMgrEcRegisters_p.h b/cpu/ixp/npe/include/IxNpeDlNpeMgrEcRegisters_p.h
deleted file mode 100644
index f682126677..0000000000
--- a/cpu/ixp/npe/include/IxNpeDlNpeMgrEcRegisters_p.h
+++ /dev/null
@@ -1,893 +0,0 @@
-/**
- * @file IxNpeDlNpeMgrEcRegisters_p.h
- *
- * @author Intel Corporation
- * @date 14 December 2001
-
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-
-#ifndef IXNPEDLNPEMGRECREGISTERS_P_H
-#define IXNPEDLNPEMGRECREGISTERS_P_H
-
-#include "IxOsal.h"
-
-/*
- * Base Memory Addresses for accessing NPE registers
- */
-
-#define IX_NPEDL_NPE_BASE (IX_OSAL_IXP400_PERIPHERAL_PHYS_BASE)
-
-#define IX_NPEDL_NPEA_OFFSET (0x6000) /**< NPE-A register base offset */
-#define IX_NPEDL_NPEB_OFFSET (0x7000) /**< NPE-B register base offset */
-#define IX_NPEDL_NPEC_OFFSET (0x8000) /**< NPE-C register base offset */
-
-/**
- * @def IX_NPEDL_NPEBASEADDRESS_NPEA
- * @brief Base Memory Address of NPE-A Configuration Bus registers
- */
-#define IX_NPEDL_NPEBASEADDRESS_NPEA (IX_NPEDL_NPE_BASE + IX_NPEDL_NPEA_OFFSET)
-
-/**
- * @def IX_NPEDL_NPEBASEADDRESS_NPEB
- * @brief Base Memory Address of NPE-B Configuration Bus registers
- */
-#define IX_NPEDL_NPEBASEADDRESS_NPEB (IX_NPEDL_NPE_BASE + IX_NPEDL_NPEB_OFFSET)
-
-/**
- * @def IX_NPEDL_NPEBASEADDRESS_NPEC
- * @brief Base Memory Address of NPE-C Configuration Bus registers
- */
-#define IX_NPEDL_NPEBASEADDRESS_NPEC (IX_NPEDL_NPE_BASE + IX_NPEDL_NPEC_OFFSET)
-
-
-/*
- * Instruction Memory Size (in words) for each NPE
- */
-
-/**
- * @def IX_NPEDL_INS_MEMSIZE_WORDS_NPEA
- * @brief Size (in words) of NPE-A Instruction Memory
- */
-#define IX_NPEDL_INS_MEMSIZE_WORDS_NPEA 4096
-
-/**
- * @def IX_NPEDL_INS_MEMSIZE_WORDS_NPEB
- * @brief Size (in words) of NPE-B Instruction Memory
- */
-#define IX_NPEDL_INS_MEMSIZE_WORDS_NPEB 2048
-
-/**
- * @def IX_NPEDL_INS_MEMSIZE_WORDS_NPEC
- * @brief Size (in words) of NPE-B Instruction Memory
- */
-#define IX_NPEDL_INS_MEMSIZE_WORDS_NPEC 2048
-
-
-/*
- * Data Memory Size (in words) for each NPE
- */
-
-/**
- * @def IX_NPEDL_DATA_MEMSIZE_WORDS_NPEA
- * @brief Size (in words) of NPE-A Data Memory
- */
-#define IX_NPEDL_DATA_MEMSIZE_WORDS_NPEA 2048
-
-/**
- * @def IX_NPEDL_DATA_MEMSIZE_WORDS_NPEB
- * @brief Size (in words) of NPE-B Data Memory
- */
-#define IX_NPEDL_DATA_MEMSIZE_WORDS_NPEB 2048
-
-/**
- * @def IX_NPEDL_DATA_MEMSIZE_WORDS_NPEC
- * @brief Size (in words) of NPE-C Data Memory
- */
-#define IX_NPEDL_DATA_MEMSIZE_WORDS_NPEC 2048
-
-
-/*
- * Configuration Bus Register offsets (in bytes) from NPE Base Address
- */
-
-/**
- * @def IX_NPEDL_REG_OFFSET_EXAD
- * @brief Offset (in bytes) of EXAD (Execution Address) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_EXAD 0x00000000
-
-/**
- * @def IX_NPEDL_REG_OFFSET_EXDATA
- * @brief Offset (in bytes) of EXDATA (Execution Data) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_EXDATA 0x00000004
-
-/**
- * @def IX_NPEDL_REG_OFFSET_EXCTL
- * @brief Offset (in bytes) of EXCTL (Execution Control) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_EXCTL 0x00000008
-
-/**
- * @def IX_NPEDL_REG_OFFSET_EXCT
- * @brief Offset (in bytes) of EXCT (Execution Count) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_EXCT 0x0000000C
-
-/**
- * @def IX_NPEDL_REG_OFFSET_AP0
- * @brief Offset (in bytes) of AP0 (Action Point 0) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_AP0 0x00000010
-
-/**
- * @def IX_NPEDL_REG_OFFSET_AP1
- * @brief Offset (in bytes) of AP1 (Action Point 1) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_AP1 0x00000014
-
-/**
- * @def IX_NPEDL_REG_OFFSET_AP2
- * @brief Offset (in bytes) of AP2 (Action Point 2) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_AP2 0x00000018
-
-/**
- * @def IX_NPEDL_REG_OFFSET_AP3
- * @brief Offset (in bytes) of AP3 (Action Point 3) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_AP3 0x0000001C
-
-/**
- * @def IX_NPEDL_REG_OFFSET_WFIFO
- * @brief Offset (in bytes) of WFIFO (Watchpoint FIFO) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_WFIFO 0x00000020
-
-/**
- * @def IX_NPEDL_REG_OFFSET_WC
- * @brief Offset (in bytes) of WC (Watch Count) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_WC 0x00000024
-
-/**
- * @def IX_NPEDL_REG_OFFSET_PROFCT
- * @brief Offset (in bytes) of PROFCT (Profile Count) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_PROFCT 0x00000028
-
-/**
- * @def IX_NPEDL_REG_OFFSET_STAT
- * @brief Offset (in bytes) of STAT (Messaging Status) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_STAT 0x0000002C
-
-/**
- * @def IX_NPEDL_REG_OFFSET_CTL
- * @brief Offset (in bytes) of CTL (Messaging Control) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_CTL 0x00000030
-
-/**
- * @def IX_NPEDL_REG_OFFSET_MBST
- * @brief Offset (in bytes) of MBST (Mailbox Status) register from NPE Base
- * Address
- */
-#define IX_NPEDL_REG_OFFSET_MBST 0x00000034
-
-/**
- * @def IX_NPEDL_REG_OFFSET_FIFO
- * @brief Offset (in bytes) of FIFO (messaging in/out FIFO) register from NPE
- * Base Address
- */
-#define IX_NPEDL_REG_OFFSET_FIFO 0x00000038
-
-
-/*
- * Non-zero reset values for the Configuration Bus registers
- */
-
-/**
- * @def IX_NPEDL_REG_RESET_FIFO
- * @brief Reset value for Mailbox (MBST) register
- * NOTE that if used, it should be complemented with an NPE intruction
- * to clear the Mailbox at the NPE side as well
- */
-#define IX_NPEDL_REG_RESET_MBST 0x0000F0F0
-
-
-/*
- * Bit-masks used to read/write particular bits in Configuration Bus registers
- */
-
-/**
- * @def IX_NPEDL_MASK_WFIFO_VALID
- * @brief Masks the VALID bit in the WFIFO register
- */
-#define IX_NPEDL_MASK_WFIFO_VALID 0x80000000
-
-/**
- * @def IX_NPEDL_MASK_STAT_OFNE
- * @brief Masks the OFNE bit in the STAT register
- */
-#define IX_NPEDL_MASK_STAT_OFNE 0x00010000
-
-/**
- * @def IX_NPEDL_MASK_STAT_IFNE
- * @brief Masks the IFNE bit in the STAT register
- */
-#define IX_NPEDL_MASK_STAT_IFNE 0x00080000
-
-
-/*
- * EXCTL (Execution Control) Register commands
-*/
-
-/**
- * @def IX_NPEDL_EXCTL_CMD_NPE_STEP
- * @brief EXCTL Command to Step execution of an NPE Instruction
- */
-
-#define IX_NPEDL_EXCTL_CMD_NPE_STEP 0x01
-
-/**
- * @def IX_NPEDL_EXCTL_CMD_NPE_START
- * @brief EXCTL Command to Start NPE execution
- */
-#define IX_NPEDL_EXCTL_CMD_NPE_START 0x02
-
-/**
- * @def IX_NPEDL_EXCTL_CMD_NPE_STOP
- * @brief EXCTL Command to Stop NPE execution
- */
-#define IX_NPEDL_EXCTL_CMD_NPE_STOP 0x03
-
-/**
- * @def IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE
- * @brief EXCTL Command to Clear NPE instruction pipeline
- */
-#define IX_NPEDL_EXCTL_CMD_NPE_CLR_PIPE 0x04
-
-/**
- * @def IX_NPEDL_EXCTL_CMD_RD_INS_MEM
- * @brief EXCTL Command to read NPE instruction memory at address in EXAD
- * register and return value in EXDATA register
- */
-#define IX_NPEDL_EXCTL_CMD_RD_INS_MEM 0x10
-
-/**
- * @def IX_NPEDL_EXCTL_CMD_WR_INS_MEM
- * @brief EXCTL Command to write NPE instruction memory at address in EXAD
- * register with data in EXDATA register
- */
-#define IX_NPEDL_EXCTL_CMD_WR_INS_MEM 0x11
-
-/**
- * @def IX_NPEDL_EXCTL_CMD_RD_DATA_MEM
- * @brief EXCTL Command to read NPE data memory at address in EXAD
- * register and return value in EXDATA register
- */
-#define IX_NPEDL_EXCTL_CMD_RD_DATA_MEM 0x12
-
-/**
- * @def IX_NPEDL_EXCTL_CMD_WR_DATA_MEM
- * @brief EXCTL Command to write NPE data memory at address in EXAD
- * register with data in EXDATA register
- */
-#define IX_NPEDL_EXCTL_CMD_WR_DATA_MEM 0x13
-
-/**
- * @def IX_NPEDL_EXCTL_CMD_RD_ECS_REG
- * @brief EXCTL Command to read Execution Access register at address in EXAD
- * register and return value in EXDATA register
- */
-#define IX_NPEDL_EXCTL_CMD_RD_ECS_REG 0x14
-
-/**
- * @def IX_NPEDL_EXCTL_CMD_WR_ECS_REG
- * @brief EXCTL Command to write Execution Access register at address in EXAD
- * register with data in EXDATA register
- */
-#define IX_NPEDL_EXCTL_CMD_WR_ECS_REG 0x15
-
-/**
- * @def IX_NPEDL_EXCTL_CMD_CLR_PROFILE_CNT
- * @brief EXCTL Command to clear Profile Count register
- */
-#define IX_NPEDL_EXCTL_CMD_CLR_PROFILE_CNT 0x0C
-
-
-/*
- * EXCTL (Execution Control) Register status bit masks
- */
-
-/**
- * @def IX_NPEDL_EXCTL_STATUS_RUN
- * @brief Masks the RUN status bit in the EXCTL register
- */
-#define IX_NPEDL_EXCTL_STATUS_RUN 0x80000000
-
-/**
- * @def IX_NPEDL_EXCTL_STATUS_STOP
- * @brief Masks the STOP status bit in the EXCTL register
- */
-#define IX_NPEDL_EXCTL_STATUS_STOP 0x40000000
-
-/**
- * @def IX_NPEDL_EXCTL_STATUS_CLEAR
- * @brief Masks the CLEAR status bit in the EXCTL register
- */
-#define IX_NPEDL_EXCTL_STATUS_CLEAR 0x20000000
-
-/**
- * @def IX_NPEDL_EXCTL_STATUS_ECS_K
- * @brief Masks the K (pipeline Klean) status bit in the EXCTL register
- */
-#define IX_NPEDL_EXCTL_STATUS_ECS_K 0x00800000
-
-
-/*
- * Executing Context Stack (ECS) level registers
- */
-
-/**
- * @def IX_NPEDL_ECS_BG_CTXT_REG_0
- * @brief Execution Access register address for register 0 at Backgound
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_BG_CTXT_REG_0 0x00
-
-/**
- * @def IX_NPEDL_ECS_BG_CTXT_REG_1
- * @brief Execution Access register address for register 1 at Backgound
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_BG_CTXT_REG_1 0x01
-
-/**
- * @def IX_NPEDL_ECS_BG_CTXT_REG_2
- * @brief Execution Access register address for register 2 at Backgound
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_BG_CTXT_REG_2 0x02
-
-/**
- * @def IX_NPEDL_ECS_PRI_1_CTXT_REG_0
- * @brief Execution Access register address for register 0 at Priority 1
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_PRI_1_CTXT_REG_0 0x04
-
-/**
- * @def IX_NPEDL_ECS_PRI_1_CTXT_REG_1
- * @brief Execution Access register address for register 1 at Priority 1
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_PRI_1_CTXT_REG_1 0x05
-
-/**
- * @def IX_NPEDL_ECS_PRI_1_CTXT_REG_2
- * @brief Execution Access register address for register 2 at Priority 1
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_PRI_1_CTXT_REG_2 0x06
-
-/**
- * @def IX_NPEDL_ECS_PRI_2_CTXT_REG_0
- * @brief Execution Access register address for register 0 at Priority 2
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_PRI_2_CTXT_REG_0 0x08
-
-/**
- * @def IX_NPEDL_ECS_PRI_2_CTXT_REG_1
- * @brief Execution Access register address for register 1 at Priority 2
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_PRI_2_CTXT_REG_1 0x09
-
-/**
- * @def IX_NPEDL_ECS_PRI_2_CTXT_REG_2
- * @brief Execution Access register address for register 2 at Priority 2
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_PRI_2_CTXT_REG_2 0x0A
-
-/**
- * @def IX_NPEDL_ECS_DBG_CTXT_REG_0
- * @brief Execution Access register address for register 0 at Debug
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_DBG_CTXT_REG_0 0x0C
-
-/**
- * @def IX_NPEDL_ECS_DBG_CTXT_REG_1
- * @brief Execution Access register address for register 1 at Debug
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_DBG_CTXT_REG_1 0x0D
-
-/**
- * @def IX_NPEDL_ECS_DBG_CTXT_REG_2
- * @brief Execution Access register address for register 2 at Debug
- * Executing Context Stack level
- */
-#define IX_NPEDL_ECS_DBG_CTXT_REG_2 0x0E
-
-/**
- * @def IX_NPEDL_ECS_INSTRUCT_REG
- * @brief Execution Access register address for NPE Instruction Register
- */
-#define IX_NPEDL_ECS_INSTRUCT_REG 0x11
-
-
-/*
- * Execution Access register reset values
- */
-
-/**
- * @def IX_NPEDL_ECS_BG_CTXT_REG_0_RESET
- * @brief Reset value for Execution Access Background ECS level register 0
- */
-#define IX_NPEDL_ECS_BG_CTXT_REG_0_RESET 0xA0000000
-
-/**
- * @def IX_NPEDL_ECS_BG_CTXT_REG_1_RESET
- * @brief Reset value for Execution Access Background ECS level register 1
- */
-#define IX_NPEDL_ECS_BG_CTXT_REG_1_RESET 0x01000000
-
-/**
- * @def IX_NPEDL_ECS_BG_CTXT_REG_2_RESET
- * @brief Reset value for Execution Access Background ECS level register 2
- */
-#define IX_NPEDL_ECS_BG_CTXT_REG_2_RESET 0x00008000
-
-/**
- * @def IX_NPEDL_ECS_PRI_1_CTXT_REG_0_RESET
- * @brief Reset value for Execution Access Priority 1 ECS level register 0
- */
-#define IX_NPEDL_ECS_PRI_1_CTXT_REG_0_RESET 0x20000080
-
-/**
- * @def IX_NPEDL_ECS_PRI_1_CTXT_REG_1_RESET
- * @brief Reset value for Execution Access Priority 1 ECS level register 1
- */
-#define IX_NPEDL_ECS_PRI_1_CTXT_REG_1_RESET 0x01000000
-
-/**
- * @def IX_NPEDL_ECS_PRI_1_CTXT_REG_2_RESET
- * @brief Reset value for Execution Access Priority 1 ECS level register 2
- */
-#define IX_NPEDL_ECS_PRI_1_CTXT_REG_2_RESET 0x00008000
-
-/**
- * @def IX_NPEDL_ECS_PRI_2_CTXT_REG_0_RESET
- * @brief Reset value for Execution Access Priority 2 ECS level register 0
- */
-#define IX_NPEDL_ECS_PRI_2_CTXT_REG_0_RESET 0x20000080
-
-/**
- * @def IX_NPEDL_ECS_PRI_2_CTXT_REG_1_RESET
- * @brief Reset value for Execution Access Priority 2 ECS level register 1
- */
-#define IX_NPEDL_ECS_PRI_2_CTXT_REG_1_RESET 0x01000000
-
-/**
- * @def IX_NPEDL_ECS_PRI_2_CTXT_REG_2_RESET
- * @brief Reset value for Execution Access Priority 2 ECS level register 2
- */
-#define IX_NPEDL_ECS_PRI_2_CTXT_REG_2_RESET 0x00008000
-
-/**
- * @def IX_NPEDL_ECS_DBG_CTXT_REG_0_RESET
- * @brief Reset value for Execution Access Debug ECS level register 0
- */
-#define IX_NPEDL_ECS_DBG_CTXT_REG_0_RESET 0x20000000
-
-/**
- * @def IX_NPEDL_ECS_DBG_CTXT_REG_1_RESET
- * @brief Reset value for Execution Access Debug ECS level register 1
- */
-#define IX_NPEDL_ECS_DBG_CTXT_REG_1_RESET 0x00000000
-
-/**
- * @def IX_NPEDL_ECS_DBG_CTXT_REG_2_RESET
- * @brief Reset value for Execution Access Debug ECS level register 2
- */
-#define IX_NPEDL_ECS_DBG_CTXT_REG_2_RESET 0x001E0000
-
-/**
- * @def IX_NPEDL_ECS_INSTRUCT_REG_RESET
- * @brief Reset value for Execution Access NPE Instruction Register
- */
-#define IX_NPEDL_ECS_INSTRUCT_REG_RESET 0x1003C00F
-
-
-/*
- * masks used to read/write particular bits in Execution Access registers
- */
-
-/**
- * @def IX_NPEDL_MASK_ECS_REG_0_ACTIVE
- * @brief Mask the A (Active) bit in Execution Access Register 0 of all ECS
- * levels
- */
-#define IX_NPEDL_MASK_ECS_REG_0_ACTIVE 0x80000000
-
-/**
- * @def IX_NPEDL_MASK_ECS_REG_0_NEXTPC
- * @brief Mask the NextPC bits in Execution Access Register 0 of all ECS
- * levels (except Debug ECS level)
- */
-#define IX_NPEDL_MASK_ECS_REG_0_NEXTPC 0x1FFF0000
-
-/**
- * @def IX_NPEDL_MASK_ECS_REG_0_LDUR
- * @brief Mask the LDUR bits in Execution Access Register 0 of all ECS levels
- */
-#define IX_NPEDL_MASK_ECS_REG_0_LDUR 0x00000700
-
-/**
- * @def IX_NPEDL_MASK_ECS_REG_1_CCTXT
- * @brief Mask the NextPC bits in Execution Access Register 1 of all ECS levels
- */
-#define IX_NPEDL_MASK_ECS_REG_1_CCTXT 0x000F0000
-
-/**
- * @def IX_NPEDL_MASK_ECS_REG_1_SELCTXT
- * @brief Mask the NextPC bits in Execution Access Register 1 of all ECS levels
- */
-#define IX_NPEDL_MASK_ECS_REG_1_SELCTXT 0x0000000F
-
-/**
- * @def IX_NPEDL_MASK_ECS_DBG_REG_2_IF
- * @brief Mask the IF bit in Execution Access Register 2 of Debug ECS level
- */
-#define IX_NPEDL_MASK_ECS_DBG_REG_2_IF 0x00100000
-
-/**
- * @def IX_NPEDL_MASK_ECS_DBG_REG_2_IE
- * @brief Mask the IE bit in Execution Access Register 2 of Debug ECS level
- */
-#define IX_NPEDL_MASK_ECS_DBG_REG_2_IE 0x00080000
-
-
-/*
- * Bit-Offsets from LSB of particular bit-fields in Execution Access registers
- */
-
-/**
- * @def IX_NPEDL_OFFSET_ECS_REG_0_NEXTPC
- * @brief LSB-offset of NextPC field in Execution Access Register 0 of all ECS
- * levels (except Debug ECS level)
- */
-#define IX_NPEDL_OFFSET_ECS_REG_0_NEXTPC 16
-
-/**
- * @def IX_NPEDL_OFFSET_ECS_REG_0_LDUR
- * @brief LSB-offset of LDUR field in Execution Access Register 0 of all ECS
- * levels
- */
-#define IX_NPEDL_OFFSET_ECS_REG_0_LDUR 8
-
-/**
- * @def IX_NPEDL_OFFSET_ECS_REG_1_CCTXT
- * @brief LSB-offset of CCTXT field in Execution Access Register 1 of all ECS
- * levels
- */
-#define IX_NPEDL_OFFSET_ECS_REG_1_CCTXT 16
-
-/**
- * @def IX_NPEDL_OFFSET_ECS_REG_1_SELCTXT
- * @brief LSB-offset of SELCTXT field in Execution Access Register 1 of all ECS
- * levels
- */
-#define IX_NPEDL_OFFSET_ECS_REG_1_SELCTXT 0
-
-
-/*
- * NPE core & co-processor instruction templates to load into NPE Instruction
- * Register, for read/write of NPE register file registers
- */
-
-/**
- * @def IX_NPEDL_INSTR_RD_REG_BYTE
- * @brief NPE Instruction, used to read an 8-bit NPE internal logical register
- * and return the value in the EXDATA register (aligned to MSB).
- * NPE Assembler instruction: "mov8 d0, d0 &&& DBG_WrExec"
- */
-#define IX_NPEDL_INSTR_RD_REG_BYTE 0x0FC00000
-
-/**
- * @def IX_NPEDL_INSTR_RD_REG_SHORT
- * @brief NPE Instruction, used to read a 16-bit NPE internal logical register
- * and return the value in the EXDATA register (aligned to MSB).
- * NPE Assembler instruction: "mov16 d0, d0 &&& DBG_WrExec"
- */
-#define IX_NPEDL_INSTR_RD_REG_SHORT 0x0FC08010
-
-/**
- * @def IX_NPEDL_INSTR_RD_REG_WORD
- * @brief NPE Instruction, used to read a 16-bit NPE internal logical register
- * and return the value in the EXDATA register.
- * NPE Assembler instruction: "mov32 d0, d0 &&& DBG_WrExec"
- */
-#define IX_NPEDL_INSTR_RD_REG_WORD 0x0FC08210
-
-/**
- * @def IX_NPEDL_INSTR_WR_REG_BYTE
- * @brief NPE Immediate-Mode Instruction, used to write an 8-bit NPE internal
- * logical register.
- * NPE Assembler instruction: "mov8 d0, #0"
- */
-#define IX_NPEDL_INSTR_WR_REG_BYTE 0x00004000
-
-/**
- * @def IX_NPEDL_INSTR_WR_REG_SHORT
- * @brief NPE Immediate-Mode Instruction, used to write a 16-bit NPE internal
- * logical register.
- * NPE Assembler instruction: "mov16 d0, #0"
- */
-#define IX_NPEDL_INSTR_WR_REG_SHORT 0x0000C000
-
-/**
- * @def IX_NPEDL_INSTR_RD_FIFO
- * @brief NPE Immediate-Mode Instruction, used to write a 16-bit NPE internal
- * logical register.
- * NPE Assembler instruction: "cprd32 d0 &&& DBG_RdInFIFO"
- */
-#define IX_NPEDL_INSTR_RD_FIFO 0x0F888220
-
-/**
- * @def IX_NPEDL_INSTR_RESET_MBOX
- * @brief NPE Instruction, used to reset Mailbox (MBST) register
- * NPE Assembler instruction: "mov32 d0, d0 &&& DBG_ClearM"
- */
-#define IX_NPEDL_INSTR_RESET_MBOX 0x0FAC8210
-
-
-/*
- * Bit-offsets from LSB, of particular bit-fields in an NPE instruction
- */
-
-/**
- * @def IX_NPEDL_OFFSET_INSTR_SRC
- * @brief LSB-offset to SRC (source operand) field of an NPE Instruction
- */
-#define IX_NPEDL_OFFSET_INSTR_SRC 4
-
-/**
- * @def IX_NPEDL_OFFSET_INSTR_DEST
- * @brief LSB-offset to DEST (destination operand) field of an NPE Instruction
- */
-#define IX_NPEDL_OFFSET_INSTR_DEST 9
-
-/**
- * @def IX_NPEDL_OFFSET_INSTR_COPROC
- * @brief LSB-offset to COPROC (coprocessor instruction) field of an NPE
- * Instruction
- */
-#define IX_NPEDL_OFFSET_INSTR_COPROC 18
-
-
-/*
- * masks used to read/write particular bits of an NPE Instruction
- */
-
-/**
- * @def IX_NPEDL_MASK_IMMED_INSTR_SRC_DATA
- * @brief Mask the bits of 16-bit data value (least-sig 5 bits) to be used in
- * SRC field of immediate-mode NPE instruction
- */
-#define IX_NPEDL_MASK_IMMED_INSTR_SRC_DATA 0x1F
-
-/**
- * @def IX_NPEDL_MASK_IMMED_INSTR_COPROC_DATA
- * @brief Mask the bits of 16-bit data value (most-sig 11 bits) to be used in
- * COPROC field of immediate-mode NPE instruction
- */
-#define IX_NPEDL_MASK_IMMED_INSTR_COPROC_DATA 0xFFE0
-
-/**
- * @def IX_NPEDL_OFFSET_IMMED_INSTR_COPROC_DATA
- * @brief LSB offset of the bit-field of 16-bit data value (most-sig 11 bits)
- * to be used in COPROC field of immediate-mode NPE instruction
- */
-#define IX_NPEDL_OFFSET_IMMED_INSTR_COPROC_DATA 5
-
-/**
- * @def IX_NPEDL_DISPLACE_IMMED_INSTR_COPROC_DATA
- * @brief Number of left-shifts required to align most-sig 11 bits of 16-bit
- * data value into COPROC field of immediate-mode NPE instruction
- */
-#define IX_NPEDL_DISPLACE_IMMED_INSTR_COPROC_DATA \
- (IX_NPEDL_OFFSET_INSTR_COPROC - IX_NPEDL_OFFSET_IMMED_INSTR_COPROC_DATA)
-
-/**
- * @def IX_NPEDL_WR_INSTR_LDUR
- * @brief LDUR value used with immediate-mode NPE Instructions by the NpeDl
- * for writing to NPE internal logical registers
- */
-#define IX_NPEDL_WR_INSTR_LDUR 1
-
-/**
- * @def IX_NPEDL_RD_INSTR_LDUR
- * @brief LDUR value used with NON-immediate-mode NPE Instructions by the NpeDl
- * for reading from NPE internal logical registers
- */
-#define IX_NPEDL_RD_INSTR_LDUR 0
-
-
-/**
- * @enum IxNpeDlCtxtRegNum
- * @brief Numeric values to identify the NPE internal Context Store registers
- */
-typedef enum
-{
- IX_NPEDL_CTXT_REG_STEVT = 0, /**< identifies STEVT */
- IX_NPEDL_CTXT_REG_STARTPC, /**< identifies STARTPC */
- IX_NPEDL_CTXT_REG_REGMAP, /**< identifies REGMAP */
- IX_NPEDL_CTXT_REG_CINDEX, /**< identifies CINDEX */
- IX_NPEDL_CTXT_REG_MAX /**< Total number of Context Store registers */
-} IxNpeDlCtxtRegNum;
-
-
-/*
- * NPE Context Store register logical addresses
- */
-
-/**
- * @def IX_NPEDL_CTXT_REG_ADDR_STEVT
- * @brief Logical address of STEVT NPE internal Context Store register
- */
-#define IX_NPEDL_CTXT_REG_ADDR_STEVT 0x0000001B
-
-/**
- * @def IX_NPEDL_CTXT_REG_ADDR_STARTPC
- * @brief Logical address of STARTPC NPE internal Context Store register
- */
-#define IX_NPEDL_CTXT_REG_ADDR_STARTPC 0x0000001C
-
-/**
- * @def IX_NPEDL_CTXT_REG_ADDR_REGMAP
- * @brief Logical address of REGMAP NPE internal Context Store register
- */
-#define IX_NPEDL_CTXT_REG_ADDR_REGMAP 0x0000001E
-
-/**
- * @def IX_NPEDL_CTXT_REG_ADDR_CINDEX
- * @brief Logical address of CINDEX NPE internal Context Store register
- */
-#define IX_NPEDL_CTXT_REG_ADDR_CINDEX 0x0000001F
-
-
-/*
- * NPE Context Store register reset values
- */
-
-/**
- * @def IX_NPEDL_CTXT_REG_RESET_STEVT
- * @brief Reset value of STEVT NPE internal Context Store register
- * (STEVT = off, 0x80)
- */
-#define IX_NPEDL_CTXT_REG_RESET_STEVT 0x80
-
-/**
- * @def IX_NPEDL_CTXT_REG_RESET_STARTPC
- * @brief Reset value of STARTPC NPE internal Context Store register
- * (STARTPC = 0x0000)
- */
-#define IX_NPEDL_CTXT_REG_RESET_STARTPC 0x0000
-
-/**
- * @def IX_NPEDL_CTXT_REG_RESET_REGMAP
- * @brief Reset value of REGMAP NPE internal Context Store register
- * (REGMAP = d0->p0, d8->p2, d16->p4)
- */
-#define IX_NPEDL_CTXT_REG_RESET_REGMAP 0x0820
-
-/**
- * @def IX_NPEDL_CTXT_REG_RESET_CINDEX
- * @brief Reset value of CINDEX NPE internal Context Store register
- * (CINDEX = 0)
- */
-#define IX_NPEDL_CTXT_REG_RESET_CINDEX 0x00
-
-
-/*
- * numeric range of context levels available on an NPE
- */
-
-/**
- * @def IX_NPEDL_CTXT_NUM_MIN
- * @brief Lowest NPE Context number in range
- */
-#define IX_NPEDL_CTXT_NUM_MIN 0
-
-/**
- * @def IX_NPEDL_CTXT_NUM_MAX
- * @brief Highest NPE Context number in range
- */
-#define IX_NPEDL_CTXT_NUM_MAX 15
-
-
-/*
- * Physical NPE internal registers
- */
-
-/**
- * @def IX_NPEDL_TOTAL_NUM_PHYS_REG
- * @brief Number of Physical registers currently supported
- * Initial NPE implementations will have a 32-word register file.
- * Later implementations may have a 64-word register file.
- */
-#define IX_NPEDL_TOTAL_NUM_PHYS_REG 32
-
-/**
- * @def IX_NPEDL_OFFSET_PHYS_REG_ADDR_REGMAP
- * @brief LSB-offset of Regmap number in Physical NPE register address, used
- * for Physical To Logical register address mapping in the NPE
- */
-#define IX_NPEDL_OFFSET_PHYS_REG_ADDR_REGMAP 1
-
-/**
- * @def IX_NPEDL_MASK_PHYS_REG_ADDR_LOGICAL_ADDR
- * @brief Mask to extract a logical NPE register address from a physical
- * register address, used for Physical To Logical address mapping
- */
-#define IX_NPEDL_MASK_PHYS_REG_ADDR_LOGICAL_ADDR 0x1
-
-#endif /* IXNPEDLNPEMGRECREGISTERS_P_H */
diff --git a/cpu/ixp/npe/include/IxNpeDlNpeMgrUtils_p.h b/cpu/ixp/npe/include/IxNpeDlNpeMgrUtils_p.h
deleted file mode 100644
index a752f26e88..0000000000
--- a/cpu/ixp/npe/include/IxNpeDlNpeMgrUtils_p.h
+++ /dev/null
@@ -1,405 +0,0 @@
-/**
- * @file IxNpeDlNpeMgrUtils_p.h
- *
- * @author Intel Corporation
- * @date 18 February 2002
- * @brief This file contains the private API for the NpeMgr module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-
-/**
- * @defgroup IxNpeDlNpeMgrUtils_p IxNpeDlNpeMgrUtils_p
- *
- * @brief The private API for the IxNpeDl NpeMgr Utils module
- *
- * @{
- */
-
-#ifndef IXNPEDLNPEMGRUTILS_P_H
-#define IXNPEDLNPEMGRUTILS_P_H
-
-
-/*
- * Put the user defined include files required.
- */
-#include "IxNpeDl.h"
-#include "IxOsalTypes.h"
-#include "IxNpeDlNpeMgrEcRegisters_p.h"
-
-
-/*
- * Function Prototypes
- */
-
-/**
- * @fn IX_STATUS ixNpeDlNpeMgrInsMemWrite (UINT32 npeBaseAddress,
- UINT32 insMemAddress,
- UINT32 insMemData,
- BOOL verify)
- *
- * @brief Writes a word to NPE Instruction memory
- *
- * @param UINT32 [in] npeBaseAddress - Base Address of NPE
- * @param UINT32 [in] insMemAddress - NPE instruction memory address to write
- * @param UINT32 [in] insMemData - data to write to instruction memory
- * @param BOOL [in] verify - if TRUE, verify the memory location is
- * written successfully.
- *
- * This function is used to write a single word of data to a location in NPE
- * instruction memory. If the <i>verify</i> option is ON, NpeDl will read back
- * from the memory location to verify that it was written successfully
- *
- * @pre
- *
- * @post
- *
- * @return
- * - IX_FAIL if verify is TRUE and the memory location was not written
- * successfully
- * - IX_SUCCESS otherwise
- */
-IX_STATUS
-ixNpeDlNpeMgrInsMemWrite (UINT32 npeBaseAddress, UINT32 insMemAddress,
- UINT32 insMemData, BOOL verify);
-
-
-/**
- * @fn IX_STATUS ixNpeDlNpeMgrDataMemWrite (UINT32 npeBaseAddress,
- UINT32 dataMemAddress,
- UINT32 dataMemData,
- BOOL verify)
- *
- * @brief Writes a word to NPE Data memory
- *
- * @param UINT32 [in] npeBaseAddress - Base Address of NPE
- * @param UINT32 [in] dataMemAddress - NPE data memory address to write
- * @param UINT32 [in] dataMemData - data to write to NPE data memory
- * @param BOOL [in] verify - if TRUE, verify the memory location is
- * written successfully.
- *
- * This function is used to write a single word of data to a location in NPE
- * data memory. If the <i>verify</i> option is ON, NpeDl will read back from
- * the memory location to verify that it was written successfully
- *
- * @pre
- *
- * @post
- *
- * @return
- * - IX_FAIL if verify is TRUE and the memory location was not written
- * successfully
- * - IX_SUCCESS otherwise
- */
-IX_STATUS
-ixNpeDlNpeMgrDataMemWrite (UINT32 npeBaseAddress, UINT32 dataMemAddress,
- UINT32 dataMemData, BOOL verify);
-
-
-/**
- * @fn void ixNpeDlNpeMgrExecAccRegWrite (UINT32 npeBaseAddress,
- UINT32 regAddress,
- UINT32 regData)
- *
- * @brief Writes a word to an NPE Execution Access register
- *
- * @param UINT32 [in] npeBaseAddress - Base Address of NPE
- * @param UINT32 [in] regAddress - NPE Execution Access register address
- * @param UINT32 [in] regData - data to write to register
- *
- * This function is used to write a single word of data to an NPE Execution
- * Access register.
- *
- * @pre
- *
- * @post
- *
- * @return none
- */
-void
-ixNpeDlNpeMgrExecAccRegWrite (UINT32 npeBaseAddress, UINT32 regAddress,
- UINT32 regData);
-
-
-/**
- * @fn UINT32 ixNpeDlNpeMgrExecAccRegRead (UINT32 npeBaseAddress,
- UINT32 regAddress)
- *
- * @brief Reads the contents of an NPE Execution Access register
- *
- * @param UINT32 [in] npeBaseAddress - Base Address of NPE
- * @param UINT32 [in] regAddress - NPE Execution Access register address
- *
- * This function is used to read the contents of an NPE Execution
- * Access register.
- *
- * @pre
- *
- * @post
- *
- * @return The value read from the Execution Access register
- */
-UINT32
-ixNpeDlNpeMgrExecAccRegRead (UINT32 npeBaseAddress, UINT32 regAddress);
-
-
-/**
- * @fn void ixNpeDlNpeMgrCommandIssue (UINT32 npeBaseAddress,
- UINT32 command)
- *
- * @brief Issues an NPE Execution Control command
- *
- * @param UINT32 [in] npeBaseAddress - Base Address of NPE
- * @param UINT32 [in] command - Command to issue
- *
- * This function is used to issue a stand-alone NPE Execution Control command
- * (e.g. command to Stop NPE execution)
- *
- * @pre
- *
- * @post
- *
- * @return none
- */
-void
-ixNpeDlNpeMgrCommandIssue (UINT32 npeBaseAddress, UINT32 command);
-
-
-/**
- * @fn void ixNpeDlNpeMgrDebugInstructionPreExec (UINT32 npeBaseAddress)
- *
- * @brief Prepare to executes one or more NPE instructions in the Debug
- * Execution Stack level.
- *
- * @param UINT32 [in] npeBaseAddress - Base Address of NPE
- *
- * This function should be called once before a sequence of calls to
- * ixNpeDlNpeMgrDebugInstructionExec().
- *
- * @pre
- *
- * @post
- * - ixNpeDlNpeMgrDebugInstructionPostExec() should be called to restore
- * registers values altered by this function
- *
- * @return none
- */
-void
-ixNpeDlNpeMgrDebugInstructionPreExec (UINT32 npeBaseAddress);
-
-
-/**
- * @fn IX_STATUS ixNpeDlNpeMgrDebugInstructionExec (UINT32 npeBaseAddress,
- UINT32 npeInstruction,
- UINT32 ctxtNum,
- UINT32 ldur)
- *
- * @brief Executes a single instruction on the NPE at the Debug Execution Stack
- * level
- *
- * @param UINT32 [in] npeBaseAddress - Base Address of NPE
- * @param UINT32 [in] npeInstruction - Value to write to INSTR (Instruction)
- * register
- * @param UINT32 [in] ctxtNum - context the instruction will be executed
- * in and which context store it may access
- * @param UINT32 [in] ldur - Long Immediate Duration, set to non-zero
- * to use long-immediate mode instruction
- *
- * This function is used to execute a single instruction in the NPE pipeline at
- * the debug Execution Context Stack level. It won't disturb the state of other
- * executing contexts. Its useful for performing NPE operations, such as
- * writing to NPE Context Store registers and physical registers, that cannot
- * be carried out directly using the Configuration Bus registers. This function
- * will return TIMEOUT status if NPE not responding due to NPS is hang / halt.
- *
- * @pre
- * - The NPE should be stopped and in a clean state
- * - ixNpeDlNpeMgrDebugInstructionPreExec() should be called once before
- * a sequential of 1 or more calls to this function
- *
- * @post
- * - ixNpeDlNpeMgrDebugInstructionPostExec() should be called after
- * a sequence of calls to this function
- *
- * @return
- * - IX_NPEDL_CRITICAL_NPE_ERR if execution of instruction failed / timeout
- * - IX_SUCCESS otherwise
- */
-IX_STATUS
-ixNpeDlNpeMgrDebugInstructionExec (UINT32 npeBaseAddress,
- UINT32 npeInstruction,
- UINT32 ctxtNum, UINT32 ldur);
-
-
-/**
- * @fn void ixNpeDlNpeMgrDebugInstructionPostExec (UINT32 npeBaseAddress)
- *
- * @brief Clean up after executing one or more NPE instructions in the
- * Debug Stack Level
- *
- * @param UINT32 [in] npeBaseAddress - Base Address of NPE
- *
- * This function should be called once following a sequence of calls to
- * ixNpeDlNpeMgrDebugInstructionExec().
- *
- * @pre
- * - ixNpeDlNpeMgrDebugInstructionPreExec() was called earlier
- *
- * @post
- * - The Instruction Pipeline will cleared
- *
- * @return none
- */
-void
-ixNpeDlNpeMgrDebugInstructionPostExec (UINT32 npeBaseAddress);
-
-
-/**
- * @fn IX_STATUS ixNpeDlNpeMgrPhysicalRegWrite (UINT32 npeBaseAddress,
- UINT32 regAddr,
- UINT32 regValue,
- BOOL verify)
- *
- * @brief Write one of the 32* 32-bit physical registers in the NPE data
- * register file
- *
- * @param UINT32 [in] npeBaseAddress - Base Address of NPE
- * @param UINT32 [in] regAddr - number of the physical register (0-31)*
- * @param UINT32 [in] regValue - value to write to the physical register
- * @param BOOL [in] verify - if TRUE, verify the register is written
- * successfully.
- *
- * This function writes a physical register in the NPE data register file.
- * If the <i>verify</i> option is ON, NpeDl will read back the register to
- * verify that it was written successfully
- * *Note that release 1.0 of this software supports 32 physical
- * registers, but 64 may be supported in future versions.
- *
- * @pre
- * - The NPE should be stopped and in a clean state
- * - ixNpeDlNpeMgrDebugInstructionPreExec() should be called once before
- * a sequential of 1 or more calls to this function
- *
- * @post
- * - Contents of REGMAP Context Store register for Context 0 will be altered
- * - ixNpeDlNpeMgrDebugInstructionPostExec() should be called after
- * a sequence of calls to this function
- *
- * @return
- * - IX_FAIL if verify is TRUE and the Context Register was not written
- * successfully
- * - IX_SUCCESS if Context Register was written successfully
- * - IX_NPEDL_CRITICAL_NPE_ERR if Context Register was not written
- * successfully due to timeout error where NPE is not responding
- */
-IX_STATUS
-ixNpeDlNpeMgrPhysicalRegWrite (UINT32 npeBaseAddress, UINT32 regAddr,
- UINT32 regValue, BOOL verify);
-
-
-/**
- * @fn IX_STATUS ixNpeDlNpeMgrCtxtRegWrite (UINT32 npeBaseAddress,
- UINT32 ctxtNum,
- IxNpeDlCtxtRegNum ctxtReg,
- UINT32 ctxtRegVal,
- BOOL verify)
- *
- * @brief Writes a value to a Context Store register on an NPE
- *
- * @param UINT32 [in] npeBaseAddress - Base Address of NPE
- * @param UINT32 [in] ctxtNum - context store to access
- * @param IxNpeDlCtxtRegNum [in] ctxtReg - which Context Store reg to write
- * @param UINT32 [in] ctxtRegVal - value to write to the Context Store
- * register
- * @param BOOL [in] verify - if TRUE, verify the register is
- * written successfully.
- *
- * This function writes the contents of a Context Store register in the NPE
- * register file. If the <i>verify</i> option is ON, NpeDl will read back the
- * register to verify that it was written successfully
- *
- * @pre
- * - The NPE should be stopped and in a clean state
- * - ixNpeDlNpeMgrDebugInstructionPreExec() should be called once before
- * a sequential of 1 or more calls to this function
- *
- * @post
- * - ixNpeDlNpeMgrDebugInstructionPostExec() should be called after
- * a sequence of calls to this function
- *
- * @return
- * - IX_FAIL if verify is TRUE and the Context Register was not written
- * successfully
- * - IX_SUCCESS if Context Register was written successfully
- * - IX_NPEDL_CRITICAL_NPE_ERR if Context Register was not written
- * successfully due to timeout error where NPE is not responding
- */
-IX_STATUS
-ixNpeDlNpeMgrCtxtRegWrite (UINT32 npeBaseAddress, UINT32 ctxtNum,
- IxNpeDlCtxtRegNum ctxtReg, UINT32 ctxtRegVal,
- BOOL verify);
-
-
-/**
- * @fn void ixNpeDlNpeMgrUtilsStatsShow (void)
- *
- * @brief This function will display the statistics of the IxNpeDl NpeMgrUtils
- * module
- *
- * @return none
- */
-void
-ixNpeDlNpeMgrUtilsStatsShow (void);
-
-
-/**
- * @fn void ixNpeDlNpeMgrUtilsStatsReset (void)
- *
- * @brief This function will reset the statistics of the IxNpeDl NpeMgrUtils
- * module
- *
- * @return none
- */
-void
-ixNpeDlNpeMgrUtilsStatsReset (void);
-
-
-#endif /* IXNPEDLNPEMGRUTILS_P_H */
diff --git a/cpu/ixp/npe/include/IxNpeDlNpeMgr_p.h b/cpu/ixp/npe/include/IxNpeDlNpeMgr_p.h
deleted file mode 100644
index b7fb0f0217..0000000000
--- a/cpu/ixp/npe/include/IxNpeDlNpeMgr_p.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/**
- * @file IxNpeDlNpeMgr_p.h
- *
- * @author Intel Corporation
- * @date 14 December 2001
- * @brief This file contains the private API for the NpeMgr module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-
-/**
- * @defgroup IxNpeDlNpeMgr_p IxNpeDlNpeMgr_p
- *
- * @brief The private API for the IxNpeDl NpeMgr module
- *
- * @{
- */
-
-#ifndef IXNPEDLNPEMGR_P_H
-#define IXNPEDLNPEMGR_P_H
-
-
-/*
- * Put the user defined include files required.
- */
-#include "IxNpeDl.h"
-#include "IxOsalTypes.h"
-
-
-/*
- * Function Prototypes
- */
-
-
-/**
- * @fn void ixNpeDlNpeMgrInit (void)
- *
- * @brief Initialises the NpeMgr module
- *
- * @param none
- *
- * This function initialises the NpeMgr module.
- * It should be called before any other function in this module is called.
- * It only needs to be called once, but can be called multiple times safely.
- * The code will ASSERT on failure.
- *
- * @pre
- * - It must be called before any other function in this module
- *
- * @post
- * - NPE Configuration Register memory space will be mapped using
- * IxOsal. This memory will not be unmapped by this module.
- *
- * @return none
- */
-void
-ixNpeDlNpeMgrInit (void);
-
-
-/**
- * @fn IX_STATUS ixNpeMhNpeMgrUninit (void)
- *
- * @brief This function will uninitialise the IxNpeDlNpeMgr sub-component.
- *
- * This function will uninitialise the IxNpeDlNpeMgr sub-component.
- * It should only be called once, and only if the IxNpeDlNpeMgr sub-component
- * has already been initialised by calling @ref ixNpeDlNpeMgrInit().
- * No other IxNpeDlNpeMgr sub-component API functions should be called
- * until @ref ixNpeDlNpeMgrInit() is called again.
- * If possible, this function should be called before a soft reboot or unloading
- * a kernel module to perform any clean up operations required for IxNpeMh.
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_FAIL otherwise
- */
-
-IX_STATUS ixNpeDlNpeMgrUninit (void);
-
-
-/**
- * @fn IX_STATUS ixNpeDlNpeMgrImageLoad (IxNpeDlNpeId npeId,
- UINT32 *imageCodePtr,
- BOOL verify)
- *
- * @brief Loads a image of microcode onto an NPE
- *
- * @param IxNpeDlNpeId [in] npeId - Id of target NPE
- * @param UINT32* [in] imageCodePtr - pointer to image code in image to be
- * downloaded
- * @param BOOL [in] verify - if TRUE, verify each word written to
- * NPE memory.
- *
- * This function loads a image containing blocks of microcode onto a
- * particular NPE. If the <i>verify</i> option is ON, NpeDl will read back each
- * word written and verify that it was written successfully
- *
- * @pre
- * - The NPE should be stopped beforehand
- *
- * @post
- * - The NPE Instruction Pipeline may be flushed clean
- *
- * @return
- * - IX_SUCCESS if the download was successful
- * - IX_FAIL if the download failed
- * - IX_NPEDL_CRITICAL_NPE_ERR if the download failed due to timeout error
- * where NPE is not responding
- */
-IX_STATUS
-ixNpeDlNpeMgrImageLoad (IxNpeDlNpeId npeId, UINT32 *imageCodePtr,
- BOOL verify);
-
-
-/**
- * @fn IX_STATUS ixNpeDlNpeMgrNpeReset (IxNpeDlNpeId npeId)
- *
- * @brief sets a NPE to RESET state
- *
- * @param IxNpeDlNpeId [in] npeId - id of target NPE
- *
- * This function performs a soft NPE reset by writing reset values to the
- * Configuration Bus Execution Control registers, the Execution Context Stack
- * registers, the Physical Register file, and the Context Store registers for
- * each context number. It also clears inFIFO, outFIFO and Watchpoint FIFO.
- * It does not reset NPE Co-processors.
- *
- * @pre
- * - The NPE should be stopped beforehand
- *
- * @post
- * - NPE NextProgram Counter (NextPC) will be set to a fixed initial value,
- * such as 0. This should be explicitly set by downloading State
- * Information before starting NPE Execution.
- * - The NPE Instruction Pipeline will be in a clean state.
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_FAIL if the operation failed
- * - IX_NPEDL_CRITICAL_NPE_ERR if the operation failed due to NPE hang
- */
-IX_STATUS
-ixNpeDlNpeMgrNpeReset (IxNpeDlNpeId npeId);
-
-
-/**
- * @fn IX_STATUS ixNpeDlNpeMgrNpeStart (IxNpeDlNpeId npeId)
- *
- * @brief Starts NPE Execution
- *
- * @param IxNpeDlNpeId [in] npeId - Id of target NPE
- *
- * Ensures only background Execution Stack Level is Active, clears instruction
- * pipeline, and starts Execution on a NPE by sending a Start NPE command to
- * the NPE. Checks the execution status of the NPE to verify that it is
- * running.
- *
- * @pre
- * - The NPE should be stopped beforehand.
- * - Note that this function does not set the NPE Next Program Counter
- * (NextPC), so it should be set beforehand if required by downloading
- * appropriate State Information.
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_FAIL otherwise
- */
-IX_STATUS
-ixNpeDlNpeMgrNpeStart (IxNpeDlNpeId npeId);
-
-
-/**
- * @fn IX_STATUS ixNpeDlNpeMgrNpeStop (IxNpeDlNpeId npeId)
- *
- * @brief Halts NPE Execution
- *
- * @param IxNpeDlNpeId [in] npeId - id of target NPE
- *
- * Stops execution on an NPE by sending a Stop NPE command to the NPE.
- * Checks the execution status of the NPE to verify that it has stopped.
- *
- * @pre
- *
- * @post
- *
- * @return
- * - IX_SUCCESS if the operation was successful
- * - IX_FAIL otherwise
- */
-IX_STATUS
-ixNpeDlNpeMgrNpeStop (IxNpeDlNpeId npeId);
-
-
-/**
- * @fn void ixNpeDlNpeMgrStatsShow (void)
- *
- * @brief This function will display statistics of the IxNpeDl NpeMgr module
- *
- * @return none
- */
-void
-ixNpeDlNpeMgrStatsShow (void);
-
-
-/**
- * @fn void ixNpeDlNpeMgrStatsReset (void)
- *
- * @brief This function will reset the statistics of the IxNpeDl NpeMgr module
- *
- * @return none
- */
-void
-ixNpeDlNpeMgrStatsReset (void);
-
-
-#endif /* IXNPEDLIMAGEMGR_P_H */
-
-/**
- * @} defgroup IxNpeDlNpeMgr_p
- */
diff --git a/cpu/ixp/npe/include/IxNpeMh.h b/cpu/ixp/npe/include/IxNpeMh.h
deleted file mode 100644
index 20ee38b062..0000000000
--- a/cpu/ixp/npe/include/IxNpeMh.h
+++ /dev/null
@@ -1,497 +0,0 @@
-/**
- * @file IxNpeMh.h
- *
- * @date 14 Dec 2001
- *
- * @brief This file contains the public API for the IXP400 NPE Message
- * Handler component.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxNpeMh IXP400 NPE Message Handler (IxNpeMh) API
- *
- * @brief The public API for the IXP400 NPE Message Handler component.
- *
- * @{
- */
-
-#ifndef IXNPEMH_H
-#define IXNPEMH_H
-
-#include "IxOsalTypes.h"
-
-/*
- * #defines for function return types, etc.
- */
-
-#define IX_NPEMH_MIN_MESSAGE_ID (0x00) /**< minimum valid message ID */
-#define IX_NPEMH_MAX_MESSAGE_ID (0xFF) /**< maximum valid message ID */
-
-#define IX_NPEMH_SEND_RETRIES_DEFAULT (3) /**< default msg send retries */
-
-
-/**
- * @def IX_NPEMH_CRITICAL_NPE_ERR
- *
- * @brief NpeMH function return value for a Critical NPE error occuring during
- sending/receiving message. Assume NPE hang / halt if this value is
- returned.
- */
-#define IX_NPEMH_CRITICAL_NPE_ERR 2
-
-/**
- * @enum IxNpeMhNpeId
- *
- * @brief The ID of a particular NPE.
- * @note In this context, for IXP425 Silicon (B0):<br>
- * - NPE-A has HDLC, HSS, AAL and UTOPIA Coprocessors.<br>
- * - NPE-B has Ethernet Coprocessor.<br>
- * - NPE-C has Ethernet, AES, DES and HASH Coprocessors.<br>
- * - IXP400 Product Line have different combinations of coprocessors.
- */
-
-typedef enum
-{
- IX_NPEMH_NPEID_NPEA = 0, /**< ID for NPE-A */
- IX_NPEMH_NPEID_NPEB, /**< ID for NPE-B */
- IX_NPEMH_NPEID_NPEC, /**< ID for NPE-C */
- IX_NPEMH_NUM_NPES /**< Number of NPEs */
-} IxNpeMhNpeId;
-
-/**
- * @enum IxNpeMhNpeInterrupts
- *
- * @brief Indicator specifying whether or not NPE interrupts should drive
- * receiving of messages from the NPEs.
- */
-
-typedef enum
-{
- IX_NPEMH_NPEINTERRUPTS_NO = 0, /**< Don't use NPE interrupts */
- IX_NPEMH_NPEINTERRUPTS_YES /**< Do use NPE interrupts */
-} IxNpeMhNpeInterrupts;
-
-/**
- * @brief The 2-word message structure to send to and receive from the
- * NPEs.
- */
-
-typedef struct
-{
- UINT32 data[2]; /**< the actual data of the message */
-} IxNpeMhMessage;
-
-/** message ID */
-typedef UINT32 IxNpeMhMessageId;
-
-/**
- * @typedef IxNpeMhCallback
- *
- * @brief This prototype shows the format of a message callback function.
- *
- * This prototype shows the format of a message callback function. The
- * message callback will be passed the message to be handled and will also
- * be told from which NPE the message was received. The message callback
- * will either be registered by ixNpeMhUnsolicitedCallbackRegister() or
- * passed as a parameter to ixNpeMhMessageWithResponseSend(). It will be
- * called from within an ISR triggered by the NPE's "outFIFO not empty"
- * interrupt (see ixNpeMhInitialize()). The parameters passed are the ID
- * of the NPE that the message was received from, and the message to be
- * handled.<P><B>Re-entrancy:</B> This function is only a prototype, and
- * will be implemented by the client. It does not need to be re-entrant.
- */
-
-typedef void (*IxNpeMhCallback) (IxNpeMhNpeId, IxNpeMhMessage);
-
-/*
- * Prototypes for interface functions.
- */
-
-/**
- * @ingroup IxNpeMh
- *
- * @fn IX_STATUS ixNpeMhInitialize (
- IxNpeMhNpeInterrupts npeInterrupts)
- *
- * @brief This function will initialise the IxNpeMh component.
- *
- * @param npeInterrupts @ref IxNpeMhNpeInterrupts [in] - This parameter
- * dictates whether or not the IxNpeMh component will service NPE "outFIFO
- * not empty" interrupts to trigger receiving and processing of messages
- * from the NPEs. If not then the client must use ixNpeMhMessagesReceive()
- * to control message receiving and processing.
- *
- * This function will initialise the IxNpeMh component. It should only be
- * called once, prior to using the IxNpeMh component. The following
- * actions will be performed by this function:<OL><LI>Initialization of
- * internal data structures (e.g. solicited and unsolicited callback
- * tables).</LI><LI>Configuration of the interface with the NPEs (e.g.
- * enabling of NPE "outFIFO not empty" interrupts).</LI><LI>Registration of
- * ISRs that will receive and handle messages when the NPEs' "outFIFO not
- * empty" interrupts fire (if npeInterrupts equals
- * IX_NPEMH_NPEINTERRUPTS_YES).</LI></OL>
- *
- * @return The function returns a status indicating success or failure.
- */
-
-PUBLIC IX_STATUS ixNpeMhInitialize (
- IxNpeMhNpeInterrupts npeInterrupts);
-
-/**
- * @ingroup IxNpeMh
- *
- * @fn IX_STATUS ixNpeMhUnload (void)
- *
- * @brief This function will uninitialise the IxNpeMh component.
- *
- * This function will uninitialise the IxNpeMh component. It should only be
- * called once, and only if the IxNpeMh component has already been initialised.
- * No other IxNpeMh API functions should be called until @ref ixNpeMhInitialize
- * is called again.
- * If possible, this function should be called before a soft reboot or unloading
- * a kernel module to perform any clean up operations required for IxNpeMh.
- *
- * The following actions will be performed by this function:
- * <OL><LI>Unmapping of kernel memory mapped by the function
- * @ref ixNpeMhInitialize.</LI></OL>
- *
- * @return The function returns a status indicating success or failure.
- */
-
-PUBLIC IX_STATUS ixNpeMhUnload (void);
-
-/**
- * @ingroup IxNpeMh
- *
- * @fn IX_STATUS ixNpeMhUnsolicitedCallbackRegister (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId messageId,
- IxNpeMhCallback unsolicitedCallback)
- *
- * @brief This function will register an unsolicited callback for a
- * particular NPE and message ID.
- *
- * @param npeId @ref IxNpeMhNpeId [in] - The ID of the NPE whose messages
- * the unsolicited callback will handle.
- * @param messageId @ref IxNpeMhMessageId [in] - The ID of the messages the
- * unsolicited callback will handle.
- * @param unsolicitedCallback @ref IxNpeMhCallback [in] - The unsolicited
- * callback function. A value of NULL will deregister any previously
- * registered callback for this NPE and message ID.
- *
- * This function will register an unsolicited message callback for a
- * particular NPE and message ID.<P>If an unsolicited callback is already
- * registered for the specified NPE and message ID then the callback will
- * be overwritten. Only one client will be responsible for handling a
- * particular message ID associated with a NPE. Registering a NULL
- * unsolicited callback will deregister any previously registered
- * callback.<P>The callback function will be called from an ISR that will
- * be triggered by the NPE's "outFIFO not empty" interrupt (see
- * ixNpeMhInitialize()) to handle any unsolicited messages of the specific
- * message ID received from the NPE. Unsolicited messages will be handled
- * in the order they are received.<P>If no unsolicited callback can be
- * found for a received message then it is assumed that the message is
- * solicited.<P>If more than one client may be interested in a particular
- * unsolicited message then the suggested strategy is to register a
- * callback for the message that can itself distribute the message to
- * multiple clients as necessary.<P>See also
- * ixNpeMhUnsolicitedCallbackForRangeRegister().<P><B>Re-entrancy:</B> This
- * function will be callable from any thread at any time. IxOsal
- * will be used for any necessary resource protection.
- *
- * @return The function returns a status indicating success or failure.
- */
-
-PUBLIC IX_STATUS ixNpeMhUnsolicitedCallbackRegister (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId messageId,
- IxNpeMhCallback unsolicitedCallback);
-
-/**
- * @ingroup IxNpeMh
- *
- * @fn IX_STATUS ixNpeMhUnsolicitedCallbackForRangeRegister (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId minMessageId,
- IxNpeMhMessageId maxMessageId,
- IxNpeMhCallback unsolicitedCallback)
- *
- * @brief This function will register an unsolicited callback for a
- * particular NPE and range of message IDs.
- *
- * @param npeId @ref IxNpeMhNpeId [in] - The ID of the NPE whose messages the
- * unsolicited callback will handle.
- * @param minMessageId @ref IxNpeMhMessageId [in] - The minimum message ID in
- * the range of message IDs the unsolicited callback will handle.
- * @param maxMessageId @ref IxNpeMhMessageId [in] - The maximum message ID in
- * the range of message IDs the unsolicited callback will handle.
- * @param unsolicitedCallback @ref IxNpeMhCallback [in] - The unsolicited
- * callback function. A value of NULL will deregister any previously
- * registered callback(s) for this NPE and range of message IDs.
- *
- * This function will register an unsolicited callback for a particular NPE
- * and range of message IDs. It is a convenience function that is
- * effectively the same as calling ixNpeMhUnsolicitedCallbackRegister() for
- * each ID in the specified range. See
- * ixNpeMhUnsolicitedCallbackRegister() for more
- * information.<P><B>Re-entrancy:</B> This function will be callable from
- * any thread at any time. IxOsal will be used for any necessary
- * resource protection.
- *
- * @return The function returns a status indicating success or failure.
- */
-
-PUBLIC IX_STATUS ixNpeMhUnsolicitedCallbackForRangeRegister (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId minMessageId,
- IxNpeMhMessageId maxMessageId,
- IxNpeMhCallback unsolicitedCallback);
-
-/**
- * @ingroup IxNpeMh
- *
- * @fn IX_STATUS ixNpeMhMessageSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- UINT32 maxSendRetries)
- *
- * @brief This function will send a message to a particular NPE.
- *
- * @param npeId @ref IxNpeMhNpeId [in] - The ID of the NPE to send the message
- * to.
- * @param message @ref IxNpeMhMessage [in] - The message to send.
- * @param maxSendRetries UINT32 [in] - Max num. of retries to perform
- * if the NPE's inFIFO is full.
- *
- * This function will send a message to a particular NPE. It will be the
- * client's responsibility to ensure that the message is properly formed.
- * The return status will signify to the client if the message was
- * successfully sent or not.<P>If the message is sent to the NPE then this
- * function will return a status of success. Note that this will only mean
- * the message has been placed in the NPE's inFIFO. There will be no way
- * of knowing that the NPE has actually read the message, but once in the
- * incoming message queue it will be safe to assume that the NPE will
- * process it.
- * <P>The inFIFO may fill up sometimes if the Xscale is sending messages
- * faster than the NPE can handle them. This forces us to retry attempts
- * to send the message until the NPE services the inFIFO. The client should
- * specify a ceiling value for the number of retries suitable to their
- * needs. IX_NPEMH_SEND_RETRIES_DEFAULT can be used as a default value for
- * the <i>maxSendRetries</i> parameter for this function. Each retry
- * exceeding this default number will incur a blocking delay of 1 microsecond,
- * to avoid consuming too much AHB bus bandwidth while performing retries.
- * <P>Note this function <B>must</B> only be used for messages.
- * that do not solicit responses. If the message being sent will solicit a
- * response then the ixNpeMhMessageWithResponseSend() function <B>must</B>
- * be used to ensure that the response is correctly
- * handled. <P> This function will return timeout status if NPE hang / halt
- * while sending message. The timeout error is not related to the
- * <i>maxSendRetries</i> as mentioned above. The timeout error will only occur
- * if the first word of the message has been sent to NPE (not exceeding
- * <i>maxSendRetries</i> when sending 1st message word), but the second word of
- * the message can't be written to NPE's inFIFO due to NPE hang / halt after
- * maximum waiting time (IX_NPE_MH_MAX_NUM_OF_RETRIES).
- * <P><B>Re-entrancy:</B> This function will be callable from any
- * thread at any time. IxOsal will be used for any necessary
- * resource protection.
- *
- * @return The function returns a status indicating success, failure or timeout.
- */
-
-PUBLIC IX_STATUS ixNpeMhMessageSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- UINT32 maxSendRetries);
-
-/**
- * @ingroup IxNpeMh
- *
- * @fn IX_STATUS ixNpeMhMessageWithResponseSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback solicitedCallback,
- UINT32 maxSendRetries)
- *
- * @brief This function is equivalent to the ixNpeMhMessageSend() function,
- * but must be used when the message being sent will solicited a response.
- *
- * @param npeId @ref IxNpeMhNpeId [in] - The ID of the NPE to send the message
- * to.
- * @param message @ref IxNpeMhMessage [in] - The message to send.
- * @param solicitedMessageId @ref IxNpeMhMessageId [in] - The ID of the
- * solicited response message.
- * @param solicitedCallback @ref IxNpeMhCallback [in] - The function to use to
- * pass the response message back to the client. A value of NULL will
- * cause the response message to be discarded.
- * @param maxSendRetries UINT32 [in] - Max num. of retries to perform
- * if the NPE's inFIFO is full.
- *
- * This function is equivalent to the ixNpeMhMessageSend() function, but
- * must be used when the message being sent will solicited a
- * response.<P>The client must specify the ID of the solicited response
- * message to allow the response to be recognised when it is received. The
- * client must also specify a callback function to handle the received
- * response. The IxNpeMh component will not offer the facility to send a
- * message to a NPE and receive a response within the same context.<P>Note
- * if the client is not interested in the response, specifying a NULL
- * callback will cause the response message to be discarded.<P>The
- * solicited callback will be stored and called some time later from an ISR
- * that will be triggered by the NPE's "outFIFO not empty" interrupt (see
- * ixNpeMhInitialize()) to handle the response message corresponding to the
- * message sent. Response messages will be handled in the order they are
- * received.<P>
- * <P>The inFIFO may fill up sometimes if the Xscale is sending messages
- * faster than the NPE can handle them. This forces us to retry attempts
- * to send the message until the NPE services the inFIFO. The client should
- * specify a ceiling value for the number of retries suitable to their
- * needs. IX_NPEMH_SEND_RETRIES_DEFAULT can be used as a default value for
- * the <i>maxSendRetries</i> parameter for this function. Each retry
- * exceeding this default number will incur a blocking delay of 1 microsecond,
- * to avoid consuming too much AHB bus bandwidth while performing retries.
- * <P> This function will return timeout status if NPE hang / halt
- * while sending message. The timeout error is not related to the
- * <i>maxSendRetries</i> as mentioned above. The timeout error will only occur
- * if the first word of the message has been sent to NPE (not exceeding
- * <i>maxSendRetries</i> when sending 1st message word), but the second word of
- * the message can't be written to NPE's inFIFO due to NPE hang / halt after
- * maximum waiting time (IX_NPE_MH_MAX_NUM_OF_RETRIES).
- * <P><B>Re-entrancy:</B> This function will be callable from any
- * thread at any time. IxOsal will be used for any necessary
- * resource protection.
- *
- * @return The function returns a status indicating success or failure.
- */
-
-PUBLIC IX_STATUS ixNpeMhMessageWithResponseSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback solicitedCallback,
- UINT32 maxSendRetries);
-
-/**
- * @ingroup IxNpeMh
- *
- * @fn IX_STATUS ixNpeMhMessagesReceive (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will receive messages from a particular NPE and
- * pass each message to the client via a solicited callback (for solicited
- * messages) or an unsolicited callback (for unsolicited messages).
- *
- * @param npeId @ref IxNpeMhNpeId [in] - The ID of the NPE to receive and
- * process messages from.
- *
- * This function will receive messages from a particular NPE and pass each
- * message to the client via a solicited callback (for solicited messages)
- * or an unsolicited callback (for unsolicited messages).<P>If the IxNpeMh
- * component is initialised to service NPE "outFIFO not empty" interrupts
- * (see ixNpeMhInitialize()) then there is no need to call this function.
- * This function is only provided as an alternative mechanism to control
- * the receiving and processing of messages from the NPEs.<P> This function
- * will return timeout status if NPE hang / halt while receiving message. The
- * timeout error will only occur if this function has read the first word of
- * the message and can't read second word of the message from NPE's outFIFO
- * after maximum retries (IX_NPE_MH_MAX_NUM_OF_RETRIES).
- * <P>Note this function cannot be called from within
- * an ISR as it will use resource protection mechanisms.<P><B>Re-entrancy:</B>
- * This function will be callable from any thread at any time. IxOsal will be
- * used for any necessary resource protection.
- *
- * @return The function returns a status indicating success, failure or timeout.
- */
-
-PUBLIC IX_STATUS ixNpeMhMessagesReceive (
- IxNpeMhNpeId npeId);
-
-/**
- * @ingroup IxNpeMh
- *
- * @fn IX_STATUS ixNpeMhShow (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will display the current state of the IxNpeMh
- * component.
- *
- * <B>Re-entrancy:</B> This function will be callable from
- * any thread at any time. However, no resource protection will be used
- * so as not to impact system performance. As this function is only
- * reading statistical information then this is acceptable.
- *
- * @param npeId @ref IxNpeMhNpeId [in] - The ID of the NPE to display state
- * information for.
- *
- * @return The function returns a status indicating success or failure.
- */
-
-PUBLIC IX_STATUS ixNpeMhShow (
- IxNpeMhNpeId npeId);
-
-/**
- * @ingroup IxNpeMh
- *
- * @fn IX_STATUS ixNpeMhShowReset (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will reset the current state of the IxNpeMh
- * component.
- *
- * <B>Re-entrancy:</B> This function will be callable from
- * any thread at any time. However, no resource protection will be used
- * so as not to impact system performance. As this function is only
- * writing statistical information then this is acceptable.
- *
- * @param npeId @ref IxNpeMhNpeId [in] - The ID of the NPE to reset state
- * information for.
- *
- * @return The function returns a status indicating success or failure.
- */
-
-PUBLIC IX_STATUS ixNpeMhShowReset (
- IxNpeMhNpeId npeId);
-
-#endif /* IXNPEMH_H */
-
-/**
- * @} defgroup IxNpeMh
- */
diff --git a/cpu/ixp/npe/include/IxNpeMhConfig_p.h b/cpu/ixp/npe/include/IxNpeMhConfig_p.h
deleted file mode 100644
index 375b3468e6..0000000000
--- a/cpu/ixp/npe/include/IxNpeMhConfig_p.h
+++ /dev/null
@@ -1,555 +0,0 @@
-/**
- * @file IxNpeMhConfig_p.h
- *
- * @author Intel Corporation
- * @date 18 Jan 2002
- *
- * @brief This file contains the private API for the Configuration module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxNpeMhConfig_p IxNpeMhConfig_p
- *
- * @brief The private API for the Configuration module.
- *
- * @{
- */
-
-#ifndef IXNPEMHCONFIG_P_H
-#define IXNPEMHCONFIG_P_H
-
-#include "IxOsal.h"
-
-#include "IxNpeMh.h"
-#include "IxNpeMhMacros_p.h"
-
-/*
- * inline definition
- */
-/* enable function inlining for performances */
-#ifdef IXNPEMHSOLICITEDCBMGR_C
-/* Non-inline functions will be defined in this translation unit.
- Reason is that in GNU Compiler, if the Optimization is turn off, all extern inline
- functions will not be compiled.
-*/
-# ifndef __wince
-# ifndef IXNPEMHCONFIG_INLINE
-# define IXNPEMHCONFIG_INLINE
-# endif
-# else
-# ifndef IXNPEMHCONFIG_INLINE
-# define IXNPEMHCONFIG_INLINE IX_OSAL_INLINE_EXTERN
-# endif
-# endif /* __wince*/
-
-#else
-
-# ifndef IXNPEMHCONFIG_INLINE
-# define IXNPEMHCONFIG_INLINE IX_OSAL_INLINE_EXTERN
-# endif /* IXNPEMHCONFIG_INLINE */
-#endif /* IXNPEMHSOLICITEDCBMGR_C */
-/*
- * Typedefs and #defines, etc.
- */
-
-typedef void (*IxNpeMhConfigIsr) (int); /**< ISR function pointer */
-
-/**
- * @struct IxNpeMhConfigNpeInfo
- *
- * @brief This structure is used to maintain the configuration information
- * associated with an NPE.
- */
-
-typedef struct
-{
- IxOsalMutex mutex; /**< mutex */
- UINT32 interruptId; /**< interrupt ID */
- UINT32 virtualRegisterBase; /**< register virtual base address */
- UINT32 statusRegister; /**< status register virtual address */
- UINT32 controlRegister; /**< control register virtual address */
- UINT32 inFifoRegister; /**< inFIFO register virutal address */
- UINT32 outFifoRegister; /**< outFIFO register virtual address */
- IxNpeMhConfigIsr isr; /**< isr routine for handling interrupt */
- BOOL oldInterruptState; /**< old interrupt state (TRUE => enabled) */
-} IxNpeMhConfigNpeInfo;
-
-
-/*
- * #defines for function return types, etc.
- */
-
-/**< NPE register base address */
-#define IX_NPEMH_NPE_BASE (IX_OSAL_IXP400_PERIPHERAL_PHYS_BASE)
-
-#define IX_NPEMH_NPEA_OFFSET (0x6000) /**< NPE-A register base offset */
-#define IX_NPEMH_NPEB_OFFSET (0x7000) /**< NPE-B register base offset */
-#define IX_NPEMH_NPEC_OFFSET (0x8000) /**< NPE-C register base offset */
-
-#define IX_NPEMH_NPESTAT_OFFSET (0x002C) /**< NPE status register offset */
-#define IX_NPEMH_NPECTL_OFFSET (0x0030) /**< NPE control register offset */
-#define IX_NPEMH_NPEFIFO_OFFSET (0x0038) /**< NPE FIFO register offset */
-
-/** NPE-A register base address */
-#define IX_NPEMH_NPEA_BASE (IX_NPEMH_NPE_BASE + IX_NPEMH_NPEA_OFFSET)
-/** NPE-B register base address */
-#define IX_NPEMH_NPEB_BASE (IX_NPEMH_NPE_BASE + IX_NPEMH_NPEB_OFFSET)
-/** NPE-C register base address */
-#define IX_NPEMH_NPEC_BASE (IX_NPEMH_NPE_BASE + IX_NPEMH_NPEC_OFFSET)
-
-/* NPE-A configuration */
-
-/** NPE-A interrupt */
-#define IX_NPEMH_NPEA_INT (IX_OSAL_IXP400_NPEA_IRQ_LVL)
-/** NPE-A FIFO register */
-#define IX_NPEMH_NPEA_FIFO (IX_NPEMH_NPEA_BASE + IX_NPEMH_NPEFIFO_OFFSET)
-/** NPE-A control register */
-#define IX_NPEMH_NPEA_CTL (IX_NPEMH_NPEA_BASE + IX_NPEMH_NPECTL_OFFSET)
-/** NPE-A status register */
-#define IX_NPEMH_NPEA_STAT (IX_NPEMH_NPEA_BASE + IX_NPEMH_NPESTAT_OFFSET)
-
-/* NPE-B configuration */
-
-/** NPE-B interrupt */
-#define IX_NPEMH_NPEB_INT (IX_OSAL_IXP400_NPEB_IRQ_LVL)
-/** NPE-B FIFO register */
-#define IX_NPEMH_NPEB_FIFO (IX_NPEMH_NPEB_BASE + IX_NPEMH_NPEFIFO_OFFSET)
-/** NPE-B control register */
-#define IX_NPEMH_NPEB_CTL (IX_NPEMH_NPEB_BASE + IX_NPEMH_NPECTL_OFFSET)
-/** NPE-B status register */
-#define IX_NPEMH_NPEB_STAT (IX_NPEMH_NPEB_BASE + IX_NPEMH_NPESTAT_OFFSET)
-
-/* NPE-C configuration */
-
-/** NPE-C interrupt */
-#define IX_NPEMH_NPEC_INT (IX_OSAL_IXP400_NPEC_IRQ_LVL)
-/** NPE-C FIFO register */
-#define IX_NPEMH_NPEC_FIFO (IX_NPEMH_NPEC_BASE + IX_NPEMH_NPEFIFO_OFFSET)
-/** NPE-C control register */
-#define IX_NPEMH_NPEC_CTL (IX_NPEMH_NPEC_BASE + IX_NPEMH_NPECTL_OFFSET)
-/** NPE-C status register */
-#define IX_NPEMH_NPEC_STAT (IX_NPEMH_NPEC_BASE + IX_NPEMH_NPESTAT_OFFSET)
-
-/* NPE control register bit definitions */
-#define IX_NPEMH_NPE_CTL_OFE (1 << 16) /**< OutFifoEnable */
-#define IX_NPEMH_NPE_CTL_IFE (1 << 17) /**< InFifoEnable */
-#define IX_NPEMH_NPE_CTL_OFEWE (1 << 24) /**< OutFifoEnableWriteEnable */
-#define IX_NPEMH_NPE_CTL_IFEWE (1 << 25) /**< InFifoEnableWriteEnable */
-
-/* NPE status register bit definitions */
-#define IX_NPEMH_NPE_STAT_OFNE (1 << 16) /**< OutFifoNotEmpty */
-#define IX_NPEMH_NPE_STAT_IFNF (1 << 17) /**< InFifoNotFull */
-#define IX_NPEMH_NPE_STAT_OFNF (1 << 18) /**< OutFifoNotFull */
-#define IX_NPEMH_NPE_STAT_IFNE (1 << 19) /**< InFifoNotEmpty */
-#define IX_NPEMH_NPE_STAT_MBINT (1 << 20) /**< Mailbox interrupt */
-#define IX_NPEMH_NPE_STAT_IFINT (1 << 21) /**< InFifo interrupt */
-#define IX_NPEMH_NPE_STAT_OFINT (1 << 22) /**< OutFifo interrupt */
-#define IX_NPEMH_NPE_STAT_WFINT (1 << 23) /**< WatchFifo interrupt */
-
-
-/**
- * Variable declarations. Externs are followed by static variables.
- */
-extern IxNpeMhConfigNpeInfo ixNpeMhConfigNpeInfo[IX_NPEMH_NUM_NPES];
-
-
-/*
- * Prototypes for interface functions.
- */
-
-/**
- * @fn void ixNpeMhConfigInitialize (
- IxNpeMhNpeInterrupts npeInterrupts)
- *
- * @brief This function initialises the Configuration module.
- *
- * @param IxNpeMhNpeInterrupts npeInterrupts (in) - whether or not to
- * service the NPE "outFIFO not empty" interrupts.
- *
- * @return No return value.
- */
-
-void ixNpeMhConfigInitialize (
- IxNpeMhNpeInterrupts npeInterrupts);
-
-/**
- * @fn void ixNpeMhConfigUninit (void)
- *
- * @brief This function uninitialises the Configuration module.
- *
- * @return No return value.
- */
-
-void ixNpeMhConfigUninit (void);
-
-/**
- * @fn void ixNpeMhConfigIsrRegister (
- IxNpeMhNpeId npeId,
- IxNpeMhConfigIsr isr)
- *
- * @brief This function registers an ISR to handle NPE "outFIFO not
- * empty" interrupts.
- *
- * @param IxNpeMhNpeId npeId (in) - the ID of the NPE whose interrupt will
- * be handled.
- * @param IxNpeMhConfigIsr isr (in) - the ISR function pointer that the
- * interrupt will trigger.
- *
- * @return No return value.
- */
-
-void ixNpeMhConfigIsrRegister (
- IxNpeMhNpeId npeId,
- IxNpeMhConfigIsr isr);
-
-/**
- * @fn BOOL ixNpeMhConfigNpeInterruptEnable (
- IxNpeMhNpeId npeId)
- *
- * @brief This function enables a NPE's "outFIFO not empty" interrupt.
- *
- * @param IxNpeMhNpeId npeId (in) - the ID of the NPE whose interrupt will
- * be enabled.
- *
- * @return Returns the previous state of the interrupt (TRUE => enabled).
- */
-
-BOOL ixNpeMhConfigNpeInterruptEnable (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn BOOL ixNpeMhConfigNpeInterruptDisable (
- IxNpeMhNpeId npeId)
- *
- * @brief This function disables a NPE's "outFIFO not empty" interrupt
- *
- * @param IxNpeMhNpeId npeId (in) - the ID of the NPE whose interrupt will
- * be disabled.
- *
- * @return Returns the previous state of the interrupt (TRUE => enabled).
- */
-
-BOOL ixNpeMhConfigNpeInterruptDisable (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn IxNpeMhMessageId ixNpeMhConfigMessageIdGet (
- IxNpeMhMessage message)
- *
- * @brief This function gets the ID of a message.
- *
- * @param IxNpeMhMessage message (in) - the message to get the ID of.
- *
- * @return the ID of the message
- */
-
-IxNpeMhMessageId ixNpeMhConfigMessageIdGet (
- IxNpeMhMessage message);
-
-/**
- * @fn BOOL ixNpeMhConfigNpeIdIsValid (
- IxNpeMhNpeId npeId)
- *
- * @brief This function checks to see if a NPE ID is valid.
- *
- * @param IxNpeMhNpeId npeId (in) - the NPE ID to validate.
- *
- * @return True if the NPE ID is valid, otherwise False.
- */
-
-BOOL ixNpeMhConfigNpeIdIsValid (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn void ixNpeMhConfigLockGet (
- IxNpeMhNpeId npeId)
- *
- * @brief This function gets a lock for exclusive NPE interaction, and
- * disables the NPE's "outFIFO not empty" interrupt.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE for which to get the
- * lock and disable its interrupt.
- *
- * @return No return value.
- */
-
-void ixNpeMhConfigLockGet (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn void ixNpeMhConfigLockRelease (
- IxNpeMhNpeId npeId)
- *
- * @brief This function releases a lock for exclusive NPE interaction, and
- * enables the NPE's "outFIFO not empty" interrupt.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE for which to release
- * the lock and enable its interrupt.
- *
- * @return No return value.
- */
-
-void ixNpeMhConfigLockRelease (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn BOOL ixNpeMhConfigInFifoIsEmpty (
- IxNpeMhNpeId npeId)
- *
- * @brief This inline function checks if a NPE's inFIFO is empty.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE for which the inFIFO
- * will be checked.
- *
- * @return True if the inFIFO is empty, otherwise False.
- */
-
-IXNPEMHCONFIG_INLINE BOOL ixNpeMhConfigInFifoIsEmpty (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn BOOL ixNpeMhConfigInFifoIsFull (
- IxNpeMhNpeId npeId)
- *
- * @brief This inline function checks if a NPE's inFIFO is full.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE for which the inFIFO
- * will be checked.
- *
- * @return True if the inFIFO is full, otherwise False.
- */
-
-IXNPEMHCONFIG_INLINE BOOL ixNpeMhConfigInFifoIsFull (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn BOOL ixNpeMhConfigOutFifoIsEmpty (
- IxNpeMhNpeId npeId)
- *
- * @brief This inline function checks if a NPE's outFIFO is empty.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE for which the outFIFO
- * will be checked.
- *
- * @return True if the outFIFO is empty, otherwise False.
- */
-
-IXNPEMHCONFIG_INLINE BOOL ixNpeMhConfigOutFifoIsEmpty (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn BOOL ixNpeMhConfigOutFifoIsFull (
- IxNpeMhNpeId npeId)
- *
- * @brief This inline function checks if a NPE's outFIFO is full.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE for which the outFIFO
- * will be checked.
- *
- * @return True if the outFIFO is full, otherwise False.
- */
-
-IXNPEMHCONFIG_INLINE BOOL ixNpeMhConfigOutFifoIsFull (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn IX_STATUS ixNpeMhConfigInFifoWrite (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message)
- *
- * @brief This function writes a message to a NPE's inFIFO. The caller
- * must first check that the NPE's inFifo is not full. After writing the first
- * word of the message, this function will keep polling NPE's inFIFO is not
- * full to write the second word. If inFIFO is not available after maximum
- * retries (IX_NPE_MH_MAX_NUM_OF_RETRIES), this function will return TIMEOUT
- * status to indicate NPE hang / halt.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE for which the inFIFO
- * will be written to.
- * @param IxNpeMhMessage message (in) - The message to write.
- *
- * @return The function returns a status indicating success, failure or timeout.
- */
-
-IX_STATUS ixNpeMhConfigInFifoWrite (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message);
-
-/**
- * @fn IX_STATUS ixNpeMhConfigOutFifoRead (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage *message)
- *
- * @brief This function reads a message from a NPE's outFIFO. The caller
- * must first check that the NPE's outFifo is not empty. After reading the first
- * word of the message, this function will keep polling NPE's outFIFO is not
- * empty to read the second word. If outFIFO is empty after maximum
- * retries (IX_NPE_MH_MAX_NUM_OF_RETRIES), this function will return TIMEOUT
- * status to indicate NPE hang / halt.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE for which the outFIFO
- * will be read from.
- * @param IxNpeMhMessage message (out) - The message read.
- *
- * @return The function returns a status indicating success, failure or timeout.
- */
-
-IX_STATUS ixNpeMhConfigOutFifoRead (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage *message);
-
-/**
- * @fn void ixNpeMhConfigShow (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will display the current state of the Configuration
- * module.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to display state
- * information for.
- *
- * @return No return value.
- */
-
-void ixNpeMhConfigShow (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn void ixNpeMhConfigShowReset (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will reset the current state of the Configuration
- * module.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to reset state
- * information for.
- *
- * @return No return value.
- */
-
-void ixNpeMhConfigShowReset (
- IxNpeMhNpeId npeId);
-
-/*
- * Inline functions
- */
-
-/*
- * This inline function checks if a NPE's inFIFO is empty.
- */
-
-IXNPEMHCONFIG_INLINE
-BOOL ixNpeMhConfigInFifoIsEmpty (
- IxNpeMhNpeId npeId)
-{
- UINT32 ifne;
- volatile UINT32 *statusReg =
- (UINT32 *)ixNpeMhConfigNpeInfo[npeId].statusRegister;
-
- /* get the IFNE (InFifoNotEmpty) bit of the status register */
- IX_NPEMH_REGISTER_READ_BITS (statusReg, &ifne, IX_NPEMH_NPE_STAT_IFNE);
-
- /* if the IFNE status bit is unset then the inFIFO is empty */
- return (ifne == 0);
-}
-
-
-/*
- * This inline function checks if a NPE's inFIFO is full.
- */
-IXNPEMHCONFIG_INLINE
-BOOL ixNpeMhConfigInFifoIsFull (
- IxNpeMhNpeId npeId)
-{
- UINT32 ifnf;
- volatile UINT32 *statusReg =
- (UINT32 *)ixNpeMhConfigNpeInfo[npeId].statusRegister;
-
- /* get the IFNF (InFifoNotFull) bit of the status register */
- IX_NPEMH_REGISTER_READ_BITS (statusReg, &ifnf, IX_NPEMH_NPE_STAT_IFNF);
-
- /* if the IFNF status bit is unset then the inFIFO is full */
- return (ifnf == 0);
-}
-
-
-/*
- * This inline function checks if a NPE's outFIFO is empty.
- */
-IXNPEMHCONFIG_INLINE
-BOOL ixNpeMhConfigOutFifoIsEmpty (
- IxNpeMhNpeId npeId)
-{
- UINT32 ofne;
- volatile UINT32 *statusReg =
- (UINT32 *)ixNpeMhConfigNpeInfo[npeId].statusRegister;
-
- /* get the OFNE (OutFifoNotEmpty) bit of the status register */
- IX_NPEMH_REGISTER_READ_BITS (statusReg, &ofne, IX_NPEMH_NPE_STAT_OFNE);
-
- /* if the OFNE status bit is unset then the outFIFO is empty */
- return (ofne == 0);
-}
-
-/*
- * This inline function checks if a NPE's outFIFO is full.
- */
-IXNPEMHCONFIG_INLINE
-BOOL ixNpeMhConfigOutFifoIsFull (
- IxNpeMhNpeId npeId)
-{
- UINT32 ofnf;
- volatile UINT32 *statusReg =
- (UINT32 *)ixNpeMhConfigNpeInfo[npeId].statusRegister;
-
- /* get the OFNF (OutFifoNotFull) bit of the status register */
- IX_NPEMH_REGISTER_READ_BITS (statusReg, &ofnf, IX_NPEMH_NPE_STAT_OFNF);
-
- /* if the OFNF status bit is unset then the outFIFO is full */
- return (ofnf == 0);
-}
-
-#endif /* IXNPEMHCONFIG_P_H */
-
-/**
- * @} defgroup IxNpeMhConfig_p
- */
diff --git a/cpu/ixp/npe/include/IxNpeMhMacros_p.h b/cpu/ixp/npe/include/IxNpeMhMacros_p.h
deleted file mode 100644
index 68f34ef357..0000000000
--- a/cpu/ixp/npe/include/IxNpeMhMacros_p.h
+++ /dev/null
@@ -1,296 +0,0 @@
-/**
- * @file IxNpeMhMacros_p.h
- *
- * @author Intel Corporation
- * @date 21 Jan 2002
- *
- * @brief This file contains the macros for the IxNpeMh component.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxNpeMhMacros_p IxNpeMhMacros_p
- *
- * @brief Macros for the IxNpeMh component.
- *
- * @{
- */
-
-#ifndef IXNPEMHMACROS_P_H
-#define IXNPEMHMACROS_P_H
-
-/* if we are running as a unit test */
-#ifdef IX_UNIT_TEST
-#undef NDEBUG
-#endif /* #ifdef IX_UNIT_TEST */
-
-#include "IxOsal.h"
-
-/*
- * #defines for function return types, etc.
- */
-
-#define IX_NPEMH_SHOW_TEXT_WIDTH (40) /**< text width for stats display */
-#define IX_NPEMH_SHOW_STAT_WIDTH (10) /**< stat width for stats display */
-
-/**
- * @def IX_NPEMH_SHOW
- *
- * @brief Macro for displaying a stat preceded by a textual description.
- */
-
-#define IX_NPEMH_SHOW(TEXT, STAT) \
- ixOsalLog (IX_OSAL_LOG_LVL_USER, IX_OSAL_LOG_DEV_STDOUT, \
- "%-40s: %10d\n", (int) TEXT, (int) STAT, 0, 0, 0, 0)
-
-/*
- * Prototypes for interface functions.
- */
-
-/**
- * @typedef IxNpeMhTraceTypes
- *
- * @brief Enumeration defining IxNpeMh trace levels
- */
-
-typedef enum
-{
- IX_NPEMH_TRACE_OFF = IX_OSAL_LOG_LVL_NONE, /**< no trace */
- IX_NPEMH_WARNING = IX_OSAL_LOG_LVL_WARNING, /**< warning */
- IX_NPEMH_DEBUG = IX_OSAL_LOG_LVL_MESSAGE, /**< debug */
- IX_NPEMH_FN_ENTRY_EXIT = IX_OSAL_LOG_LVL_DEBUG3 /**< function entry/exit */
-} IxNpeMhTraceTypes;
-
-#ifdef IX_UNIT_TEST
-#define IX_NPEMH_TRACE_LEVEL (IX_NPEMH_FN_ENTRY_EXIT) /**< trace level */
-#else
-#define IX_NPEMH_TRACE_LEVEL (IX_NPEMH_TRACE_OFF) /**< trace level */
-#endif
-
-/**
- * @def IX_NPEMH_TRACE0
- *
- * @brief Trace macro taking 0 arguments.
- */
-
-#define IX_NPEMH_TRACE0(LEVEL, STR) \
- IX_NPEMH_TRACE6(LEVEL, STR, 0, 0, 0, 0, 0, 0)
-
-/**
- * @def IX_NPEMH_TRACE1
- *
- * @brief Trace macro taking 1 argument.
- */
-
-#define IX_NPEMH_TRACE1(LEVEL, STR, ARG1) \
- IX_NPEMH_TRACE6(LEVEL, STR, ARG1, 0, 0, 0, 0, 0)
-
-/**
- * @def IX_NPEMH_TRACE2
- *
- * @brief Trace macro taking 2 arguments.
- */
-
-#define IX_NPEMH_TRACE2(LEVEL, STR, ARG1, ARG2) \
- IX_NPEMH_TRACE6(LEVEL, STR, ARG1, ARG2, 0, 0, 0, 0)
-
-/**
- * @def IX_NPEMH_TRACE3
- *
- * @brief Trace macro taking 3 arguments.
- */
-
-#define IX_NPEMH_TRACE3(LEVEL, STR, ARG1, ARG2, ARG3) \
- IX_NPEMH_TRACE6(LEVEL, STR, ARG1, ARG2, ARG3, 0, 0, 0)
-
-/**
- * @def IX_NPEMH_TRACE4
- *
- * @brief Trace macro taking 4 arguments.
- */
-
-#define IX_NPEMH_TRACE4(LEVEL, STR, ARG1, ARG2, ARG3, ARG4) \
- IX_NPEMH_TRACE6(LEVEL, STR, ARG1, ARG2, ARG3, ARG4, 0, 0)
-
-/**
- * @def IX_NPEMH_TRACE5
- *
- * @brief Trace macro taking 5 arguments.
- */
-
-#define IX_NPEMH_TRACE5(LEVEL, STR, ARG1, ARG2, ARG3, ARG4, ARG5) \
- IX_NPEMH_TRACE6(LEVEL, STR, ARG1, ARG2, ARG3, ARG4, ARG5, 0)
-
-/**
- * @def IX_NPEMH_TRACE6
- *
- * @brief Trace macro taking 6 arguments.
- */
-
-#define IX_NPEMH_TRACE6(LEVEL, STR, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
-{ \
- if (LEVEL <= IX_NPEMH_TRACE_LEVEL) \
- { \
- (void) ixOsalLog (LEVEL, IX_OSAL_LOG_DEV_STDOUT, (STR), \
- (int)(ARG1), (int)(ARG2), (int)(ARG3), \
- (int)(ARG4), (int)(ARG5), (int)(ARG6)); \
- } \
-}
-
-/**
- * @def IX_NPEMH_ERROR_REPORT
- *
- * @brief Error reporting facility.
- */
-
-#define IX_NPEMH_ERROR_REPORT(STR) \
-{ \
- (void) ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDERR, \
- (STR), 0, 0, 0, 0, 0, 0); \
-}
-
-/* if we are running on XScale, i.e. real environment */
-#if CPU==XSCALE
-
-/**
- * @def IX_NPEMH_REGISTER_READ
- *
- * @brief This macro reads a memory-mapped register.
- */
-
-#define IX_NPEMH_REGISTER_READ(registerAddress, value) \
-{ \
- *value = IX_OSAL_READ_LONG(registerAddress); \
-}
-
-/**
- * @def IX_NPEMH_REGISTER_READ_BITS
- *
- * @brief This macro partially reads a memory-mapped register.
- */
-
-#define IX_NPEMH_REGISTER_READ_BITS(registerAddress, value, mask) \
-{ \
- *value = (IX_OSAL_READ_LONG(registerAddress) & mask); \
-}
-
-/**
- * @def IX_NPEMH_REGISTER_WRITE
- *
- * @brief This macro writes a memory-mapped register.
- */
-
-#define IX_NPEMH_REGISTER_WRITE(registerAddress, value) \
-{ \
- IX_OSAL_WRITE_LONG(registerAddress, value); \
-}
-
-/**
- * @def IX_NPEMH_REGISTER_WRITE_BITS
- *
- * @brief This macro partially writes a memory-mapped register.
- */
-
-#define IX_NPEMH_REGISTER_WRITE_BITS(registerAddress, value, mask) \
-{ \
- UINT32 orig = IX_OSAL_READ_LONG(registerAddress); \
- orig &= (~mask); \
- orig |= (value & mask); \
- IX_OSAL_WRITE_LONG(registerAddress, orig); \
-}
-
-
-/* if we are running as a unit test */
-#else /* #if CPU==XSCALE */
-
-#include "IxNpeMhTestRegister.h"
-
-/**
- * @def IX_NPEMH_REGISTER_READ
- *
- * @brief This macro reads a memory-mapped register.
- */
-
-#define IX_NPEMH_REGISTER_READ(registerAddress, value) \
-{ \
- ixNpeMhTestRegisterRead (registerAddress, value); \
-}
-
-/**
- * @def IX_NPEMH_REGISTER_READ_BITS
- *
- * @brief This macro partially reads a memory-mapped register.
- */
-
-#define IX_NPEMH_REGISTER_READ_BITS(registerAddress, value, mask) \
-{ \
- ixNpeMhTestRegisterReadBits (registerAddress, value, mask); \
-}
-
-/**
- * @def IX_NPEMH_REGISTER_WRITE
- *
- * @brief This macro writes a memory-mapped register.
- */
-
-#define IX_NPEMH_REGISTER_WRITE(registerAddress, value) \
-{ \
- ixNpeMhTestRegisterWrite (registerAddress, value); \
-}
-
-/**
- * @def IX_NPEMH_REGISTER_WRITE_BITS
- *
- * @brief This macro partially writes a memory-mapped register.
- */
-
-#define IX_NPEMH_REGISTER_WRITE_BITS(registerAddress, value, mask) \
-{ \
- ixNpeMhTestRegisterWriteBits (registerAddress, value, mask); \
-}
-
-#endif /* #if CPU==XSCALE */
-
-#endif /* IXNPEMHMACROS_P_H */
-
-/**
- * @} defgroup IxNpeMhMacros_p
- */
diff --git a/cpu/ixp/npe/include/IxNpeMhReceive_p.h b/cpu/ixp/npe/include/IxNpeMhReceive_p.h
deleted file mode 100644
index 6416bedcbc..0000000000
--- a/cpu/ixp/npe/include/IxNpeMhReceive_p.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- * @file IxNpeMhReceive_p.h
- *
- * @author Intel Corporation
- * @date 18 Jan 2002
- *
- * @brief This file contains the private API for the Receive module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxNpeMhReceive_p IxNpeMhReceive_p
- *
- * @brief The private API for the Receive module.
- *
- * @{
- */
-
-#ifndef IXNPEMHRECEIVE_P_H
-#define IXNPEMHRECEIVE_P_H
-
-#include "IxNpeMh.h"
-#include "IxOsalTypes.h"
-
-/*
- * #defines for function return types, etc.
- */
-
-/*
- * Prototypes for interface functions.
- */
-
-/**
- * @fn void ixNpeMhReceiveInitialize (void)
- *
- * @brief This function registers an internal ISR to handle the NPEs'
- * "outFIFO not empty" interrupts and receive messages from the NPEs when
- * they become available.
- *
- * @return No return value.
- */
-
-void ixNpeMhReceiveInitialize (void);
-
-/**
- * @fn IX_STATUS ixNpeMhReceiveMessagesReceive (
- IxNpeMhNpeId npeId)
- *
- * @brief This function reads messages from a particular NPE's outFIFO
- * until the outFIFO is empty, and for each message looks first for an
- * unsolicited callback, then a solicited callback, to pass the message
- * back to the client. If no callback can be found the message is
- * discarded and an error reported. This function will return TIMEOUT
- * status if NPE hang / halt.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to receive
- * messages from.
- *
- * @return The function returns a status indicating success, failure or timeout.
- */
-
-IX_STATUS ixNpeMhReceiveMessagesReceive (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn void ixNpeMhReceiveShow (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will display the current state of the Receive
- * module.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to display state
- * information for.
- *
- * @return No return status.
- */
-
-void ixNpeMhReceiveShow (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn void ixNpeMhReceiveShowReset (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will reset the current state of the Receive
- * module.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to reset state
- * information for.
- *
- * @return No return status.
- */
-
-void ixNpeMhReceiveShowReset (
- IxNpeMhNpeId npeId);
-
-#endif /* IXNPEMHRECEIVE_P_H */
-
-/**
- * @} defgroup IxNpeMhReceive_p
- */
diff --git a/cpu/ixp/npe/include/IxNpeMhSend_p.h b/cpu/ixp/npe/include/IxNpeMhSend_p.h
deleted file mode 100644
index 977cc94a7f..0000000000
--- a/cpu/ixp/npe/include/IxNpeMhSend_p.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- * @file IxNpeMhSend_p.h
- *
- * @author Intel Corporation
- * @date 18 Jan 2002
- *
- * @brief This file contains the private API for the Send module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxNpeMhSend_p IxNpeMhSend_p
- *
- * @brief The private API for the Send module.
- *
- * @{
- */
-
-#ifndef IXNPEMHSEND_P_H
-#define IXNPEMHSEND_P_H
-
-#include "IxNpeMh.h"
-#include "IxOsalTypes.h"
-
-/*
- * #defines for function return types, etc.
- */
-
-/*
- * Prototypes for interface functions.
- */
-
-/**
- * @fn IX_STATUS ixNpeMhSendMessageSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- UINT32 maxSendRetries)
- *
- * @brief This function writes a message to the specified NPE's inFIFO,
- * and must be used when the message being sent does not solicit a response
- * from the NPE. This function will return TIMEOUT status if NPE hang / halt.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to send the message
- * to.
- * @param IxNpeMhMessage message (in) - The message to send.
- * @param UINT32 maxSendRetries (in) - Max num. of retries to perform
- * if the NPE's inFIFO is full.
- *
- * @return The function returns a status indicating success, failure or timeout.
- */
-
-IX_STATUS ixNpeMhSendMessageSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- UINT32 maxSendRetries);
-
-/**
- * @fn IX_STATUS ixNpeMhSendMessageWithResponseSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback solicitedCallback,
- UINT32 maxSendRetries)
- *
- * @brief This function writes a message to the specified NPE's inFIFO,
- * and must be used when the message being sent solicits a response from
- * the NPE. The ID of the solicited response must be specified so that it
- * can be recognised, and a callback provided to pass the response back to
- * the client. This function will return TIMEOUT status if NPE hang / halt.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to send the message
- * to.
- * @param IxNpeMhMessage message (in) - The message to send.
- * @param IxNpeMhMessageId solicitedMessageId (in) - The ID of the
- * solicited response.
- * @param IxNpeMhCallback solicitedCallback (in) - The callback to pass the
- * solicited response back to the client.
- * @param UINT32 maxSendRetries (in) - Max num. of retries to perform
- * if the NPE's inFIFO is full.
- *
- * @return The function returns a status indicating success, failure or timeout.
- */
-
-IX_STATUS ixNpeMhSendMessageWithResponseSend (
- IxNpeMhNpeId npeId,
- IxNpeMhMessage message,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback solicitedCallback,
- UINT32 maxSendRetries);
-
-/**
- * @fn void ixNpeMhSendShow (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will display the current state of the Send module.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to display state
- * information for.
- *
- * @return No return value.
- */
-
-void ixNpeMhSendShow (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn void ixNpeMhSendShowReset (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will reset the current state of the Send module.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to reset state
- * information for.
- *
- * @return No return value.
- */
-
-void ixNpeMhSendShowReset (
- IxNpeMhNpeId npeId);
-
-#endif /* IXNPEMHSEND_P_H */
-
-/**
- * @} defgroup IxNpeMhSend_p
- */
diff --git a/cpu/ixp/npe/include/IxNpeMhSolicitedCbMgr_p.h b/cpu/ixp/npe/include/IxNpeMhSolicitedCbMgr_p.h
deleted file mode 100644
index 40cd496c94..0000000000
--- a/cpu/ixp/npe/include/IxNpeMhSolicitedCbMgr_p.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * @file IxNpeMhSolicitedCbMgr_p.h
- *
- * @author Intel Corporation
- * @date 18 Jan 2002
- *
- * @brief This file contains the private API for the Solicited Callback
- * Manager module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxNpeMhSolicitedCbMgr_p IxNpeMhSolicitedCbMgr_p
- *
- * @brief The private API for the Solicited Callback Manager module.
- *
- * @{
- */
-
-#ifndef IXNPEMHSOLICITEDCBMGR_P_H
-#define IXNPEMHSOLICITEDCBMGR_P_H
-
-#include "IxNpeMh.h"
-#include "IxOsalTypes.h"
-
-/*
- * #defines for function return types, etc.
- */
-
-/** Maximum number of solicited callbacks that can be stored in the list */
-#define IX_NPEMH_MAX_CALLBACKS (16)
-
-/*
- * Prototypes for interface functions.
- */
-
-/**
- * @fn void ixNpeMhSolicitedCbMgrInitialize (void)
- *
- * @brief This function initializes the Solicited Callback Manager module,
- * setting up a callback data structure for each NPE.
- *
- * @return No return value.
- */
-
-void ixNpeMhSolicitedCbMgrInitialize (void);
-
-/**
- * @fn IX_STATUS ixNpeMhSolicitedCbMgrCallbackSave (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback solicitedCallback)
- *
- * @brief This function saves a callback in the specified NPE's callback
- * list. If the callback list is full the function will fail.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE in whose callback
- * list the callback will be saved.
- * @param IxNpeMhMessageId solicitedMessageId (in) - The ID of the message
- * that this callback is for.
- * @param IxNpeMhCallback solicitedCallback (in) - The callback function
- * pointer to save.
- *
- * @return The function returns a status indicating success or failure.
- */
-
-IX_STATUS ixNpeMhSolicitedCbMgrCallbackSave (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback solicitedCallback);
-
-/**
- * @fn void ixNpeMhSolicitedCbMgrCallbackRetrieve (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback *solicitedCallback)
- *
- * @brief This function retrieves the first ID-matching callback from the
- * specified NPE's callback list. If no matching callback can be found the
- * function will fail.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE from whose callback
- * list the callback will be retrieved.
- * @param IxNpeMhMessageId solicitedMessageId (in) - The ID of the message
- * that the callback is for.
- * @param IxNpeMhCallback solicitedCallback (out) - The callback function
- * pointer retrieved.
- *
- * @return No return value.
- */
-
-void ixNpeMhSolicitedCbMgrCallbackRetrieve (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId solicitedMessageId,
- IxNpeMhCallback *solicitedCallback);
-
-/**
- * @fn void ixNpeMhSolicitedCbMgrShow (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will display the current state of the Solicited
- * Callback Manager module.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to display state
- * information for.
- *
- * @return No return value.
- */
-
-void ixNpeMhSolicitedCbMgrShow (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn void ixNpeMhSolicitedCbMgrShowReset (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will reset the current state of the Solicited
- * Callback Manager module.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to reset state
- * information for.
- *
- * @return No return value.
- */
-
-void ixNpeMhSolicitedCbMgrShowReset (
- IxNpeMhNpeId npeId);
-
-#endif /* IXNPEMHSOLICITEDCBMGR_P_H */
-
-/**
- * @} defgroup IxNpeMhSolicitedCbMgr_p
- */
diff --git a/cpu/ixp/npe/include/IxNpeMhUnsolicitedCbMgr_p.h b/cpu/ixp/npe/include/IxNpeMhUnsolicitedCbMgr_p.h
deleted file mode 100644
index dea8cafa25..0000000000
--- a/cpu/ixp/npe/include/IxNpeMhUnsolicitedCbMgr_p.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * @file IxNpeMhUnsolicitedCbMgr_p.h
- *
- * @author Intel Corporation
- * @date 18 Jan 2002
- *
- * @brief This file contains the private API for the Unsolicited Callback
- * Manager module.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxNpeMhUnsolicitedCbMgr_p IxNpeMhUnsolicitedCbMgr_p
- *
- * @brief The private API for the Unsolicited Callback Manager module.
- *
- * @{
- */
-
-#ifndef IXNPEMHUNSOLICITEDCBMGR_P_H
-#define IXNPEMHUNSOLICITEDCBMGR_P_H
-
-#include "IxNpeMh.h"
-#include "IxOsalTypes.h"
-
-/*
- * #defines for function return types, etc.
- */
-
-/*
- * Prototypes for interface functions.
- */
-
-/**
- * @fn void ixNpeMhUnsolicitedCbMgrInitialize (void)
- *
- * @brief This function initializes the Unsolicited Callback Manager
- * module, setting up a callback data structure for each NPE.
- *
- * @return No return value.
- */
-
-void ixNpeMhUnsolicitedCbMgrInitialize (void);
-
-/**
- * @fn void ixNpeMhUnsolicitedCbMgrCallbackSave (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId unsolicitedMessageId,
- IxNpeMhCallback unsolicitedCallback)
- *
- * @brief This function saves a callback in the specified NPE's callback
- * table. If a callback already exists for the specified ID then it will
- * be overwritten.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE in whose callback
- * table the callback will be saved.
- * @param IxNpeMhMessageId unsolicitedMessageId (in) - The ID of the
- * messages that this callback is for.
- * @param IxNpeMhCallback unsolicitedCallback (in) - The callback function
- * pointer to save.
- *
- * @return No return value.
- */
-
-void ixNpeMhUnsolicitedCbMgrCallbackSave (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId unsolicitedMessageId,
- IxNpeMhCallback unsolicitedCallback);
-
-/**
- * @fn void ixNpeMhUnsolicitedCbMgrCallbackRetrieve (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId unsolicitedMessageId,
- IxNpeMhCallback *unsolicitedCallback)
- *
- * @brief This function retrieves the callback for the specified ID from
- * the specified NPE's callback table. If no callback is registered for
- * the specified ID and NPE then a callback value of NULL will be returned.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE from whose callback
- * table the callback will be retrieved.
- * @param IxNpeMhMessageId unsolicitedMessageId (in) - The ID of the
- * messages that the callback is for.
- * @param IxNpeMhCallback unsolicitedCallback (out) - The callback function
- * pointer retrieved.
- *
- * @return No return value.
- */
-
-void ixNpeMhUnsolicitedCbMgrCallbackRetrieve (
- IxNpeMhNpeId npeId,
- IxNpeMhMessageId unsolicitedMessageId,
- IxNpeMhCallback *unsolicitedCallback);
-
-/**
- * @fn void ixNpeMhUnsolicitedCbMgrShow (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will display the current state of the Unsolicited
- * Callback Manager module.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to display state
- * information for.
- *
- * @return No return value.
- */
-
-void ixNpeMhUnsolicitedCbMgrShow (
- IxNpeMhNpeId npeId);
-
-/**
- * @fn void ixNpeMhUnsolicitedCbMgrShowReset (
- IxNpeMhNpeId npeId)
- *
- * @brief This function will reset the current state of the Unsolicited
- * Callback Manager module.
- *
- * @param IxNpeMhNpeId npeId (in) - The ID of the NPE to reset state
- * information for.
- *
- * @return No return value.
- */
-
-void ixNpeMhUnsolicitedCbMgrShowReset (
- IxNpeMhNpeId npeId);
-
-#endif /* IXNPEMHUNSOLICITEDCBMGR_P_H */
-
-/**
- * @} defgroup IxNpeMhUnsolicitedCbMgr_p
- */
diff --git a/cpu/ixp/npe/include/IxNpeMicrocode.h b/cpu/ixp/npe/include/IxNpeMicrocode.h
deleted file mode 100644
index 893d8030a1..0000000000
--- a/cpu/ixp/npe/include/IxNpeMicrocode.h
+++ /dev/null
@@ -1,296 +0,0 @@
-/**
- * @date April 18, 2005
- *
- * @brief IXP400 NPE Microcode Image file
- *
- * This file was generated by the IxNpeDlImageGen tool.
- * It contains a NPE microcode image suitable for use
- * with the NPE Downloader (IxNpeDl) component in the
- * IXP400 Access Driver software library.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxNpeMicrocode IXP400 NPE Microcode Image Library
- *
- * @brief Library containing a set of NPE firmware images, for use
- * with NPE Downloader s/w component
- *
- * @{
- */
-
-/**
- * @def IX_NPE_IMAGE_INCLUDE
- *
- * @brief Wrap the following Image identifiers with "#if IX_NPE_IMAGE_INCLUDE ... #endif" to include the image in the library
- */
-#define IX_NPE_IMAGE_INCLUDE 1
-
-/**
- * @def IX_NPE_IMAGE_OMIT
- *
- * @brief Wrap the following Image identifiers with "#if IX_NPE_IMAGE_OMIT ... #endif" to OMIT the image from the library
- */
-#define IX_NPE_IMAGE_OMIT 0
-
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEA_HSS0
- *
- * @brief NPE Image Id for NPE-A with HSS-0 Only feature. It supports 32 channelized and 4 packetized.
- */
-#define IX_NPEDL_NPEIMAGE_NPEA_HSS0 0x00010000
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_SPHY_1_PORT
- *
- * @brief NPE Image Id for NPE-A with HSS-0 and ATM feature. For HSS, it supports 16/32 channelized and 4/0 packetized. For ATM, it supports AAL5, AAL0 and OAM for UTOPIA SPHY, 1 logical port, 32 VCs. It also has Fast Path support.
- */
-#define IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_SPHY_1_PORT 0x00020000
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_MPHY_1_PORT
- *
- * @brief NPE Image Id for NPE-A with HSS-0 and ATM feature. For HSS, it supports 16/32 channelized and 4/0 packetized. For ATM, it supports AAL5, AAL0 and OAM for UTOPIA MPHY, 1 logical port, 32 VCs. It also has Fast Path support.
- */
-#define IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_MPHY_1_PORT 0x00030000
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEA_ATM_MPHY_12_PORT
- *
- * @brief NPE Image Id for NPE-A with ATM-Only feature. It supports AAL5, AAL0 and OAM for UTOPIA MPHY, 12 logical ports, 32 VCs. It also has Fast Path support.
- */
-#define IX_NPEDL_NPEIMAGE_NPEA_ATM_MPHY_12_PORT 0x00040000
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEA_DMA
- *
- * @brief NPE Image Id for NPE-A with DMA-Only feature.
- */
-#define IX_NPEDL_NPEIMAGE_NPEA_DMA 0x00150100
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEA_HSS_2_PORT
- *
- * @brief NPE Image Id for NPE-A with HSS-0 and HSS-1 feature. Each HSS port supports 32 channelized and 4 packetized.
- */
-#define IX_NPEDL_NPEIMAGE_NPEA_HSS_2_PORT 0x00090000
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEA_ETH
- *
- * @brief NPE Image Id for NPE-A with Basic Ethernet Rx/Tx which includes: MAC_FILTERING, MAC_LEARNING, SPANNING_TREE, FIREWALL
- */
-#define IX_NPEDL_NPEIMAGE_NPEA_ETH 0x10800200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL
- *
- * @brief NPE Image Id for NPE-A with Basic Ethernet Rx/Tx which includes: MAC_FILTERING, MAC_LEARNING, SPANNING_TREE, FIREWALL
- */
-#define IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL 0x10800200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
- *
- * @brief NPE Image Id for NPE-A with Ethernet Rx/Tx which includes: MAC_FILTERING, MAC_LEARNING, SPANNING_TREE, FIREWALL, VLAN_QOS
- */
-#define IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS 0x10810200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
- *
- * @brief NPE Image Id for NPE-A with Ethernet Rx/Tx which includes: SPANNING_TREE, FIREWALL, VLAN_QOS, HEADER_CONVERSION
- */
-#define IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV 0x10820200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEB_ETH
- *
- * @brief NPE Image Id for NPE-B with Basic Ethernet Rx/Tx which includes: MAC_FILTERING, MAC_LEARNING, SPANNING_TREE, FIREWALL
- */
-#define IX_NPEDL_NPEIMAGE_NPEB_ETH 0x01000200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL
- *
- * @brief NPE Image Id for NPE-B with Basic Ethernet Rx/Tx which includes: MAC_FILTERING, MAC_LEARNING, SPANNING_TREE, FIREWALL
- */
-#define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL 0x01000200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
- *
- * @brief NPE Image Id for NPE-B with Ethernet Rx/Tx which includes: MAC_FILTERING, MAC_LEARNING, SPANNING_TREE, FIREWALL, VLAN_QOS
- */
-#define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS 0x01010200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
- *
- * @brief NPE Image Id for NPE-B with Ethernet Rx/Tx which includes: SPANNING_TREE, FIREWALL, VLAN_QOS, HEADER_CONVERSION
- */
-#define IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV 0x01020200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEB_DMA
- *
- * @brief NPE Image Id for NPE-B with DMA-Only feature.
- */
-#define IX_NPEDL_NPEIMAGE_NPEB_DMA 0x01020100
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEC_ETH
- *
- * @brief NPE Image Id for NPE-C with Basic Ethernet Rx/Tx which includes: MAC_FILTERING, MAC_LEARNING, SPANNING_TREE, FIREWALL
- */
-#define IX_NPEDL_NPEIMAGE_NPEC_ETH 0x02000200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL
- *
- * @brief NPE Image Id for NPE-C with Basic Ethernet Rx/Tx which includes: MAC_FILTERING, MAC_LEARNING, SPANNING_TREE, FIREWALL
- */
-#define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL 0x02000200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
- *
- * @brief NPE Image Id for NPE-C with Ethernet Rx/Tx which includes: MAC_FILTERING, MAC_LEARNING, SPANNING_TREE, FIREWALL, VLAN_QOS
- */
-#define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS 0x02010200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
- *
- * @brief NPE Image Id for NPE-C with Ethernet Rx/Tx which includes: SPANNING_TREE, FIREWALL, VLAN_QOS, HEADER_CONVERSION
- */
-#define IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV 0x02020200
-#endif
-
-#if IX_NPE_IMAGE_INCLUDE
-/**
- * @def IX_NPEDL_NPEIMAGE_NPEC_DMA
- *
- * @brief NPE Image Id for NPE-C with DMA-Only feature.
- */
-#define IX_NPEDL_NPEIMAGE_NPEC_DMA 0x02080100
-#endif
-
-/* Number of NPE firmware images in this library */
-#define IX_NPE_MICROCODE_AVAILABLE_VERSIONS_COUNT 17
-
-/* Location of Microcode Images */
-#ifdef IX_NPE_MICROCODE_FIRMWARE_INCLUDED
-#ifdef IX_NPEDL_READ_MICROCODE_FROM_FILE
-
-extern UINT32* ixNpeMicrocode_binaryArray;
-
-#else
-
-extern unsigned IxNpeMicrocode_array[];
-
-#endif
-#endif
-
-/*
- * sr: undef all but the bare minimum to reduce flash usage for U-Boot
- */
-#undef IX_NPEDL_NPEIMAGE_NPEA_HSS0
-#undef IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_SPHY_1_PORT
-#undef IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_MPHY_1_PORT
-#undef IX_NPEDL_NPEIMAGE_NPEA_ATM_MPHY_12_PORT
-#undef IX_NPEDL_NPEIMAGE_NPEA_DMA
-#undef IX_NPEDL_NPEIMAGE_NPEA_HSS_2_PORT
-#undef IX_NPEDL_NPEIMAGE_NPEA_ETH
-#undef IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL
-#undef IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
-#undef IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
-#undef IX_NPEDL_NPEIMAGE_NPEB_ETH
-#undef IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL
-/* #undef IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS */
-#undef IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
-#undef IX_NPEDL_NPEIMAGE_NPEB_DMA
-#undef IX_NPEDL_NPEIMAGE_NPEC_ETH
-#undef IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL
-/* #undef IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS */
-#undef IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
-#undef IX_NPEDL_NPEIMAGE_NPEC_DMA
-
-/**
- * @} defgroup IxNpeMicrocode
- */
diff --git a/cpu/ixp/npe/include/IxOsBufLib.h b/cpu/ixp/npe/include/IxOsBufLib.h
deleted file mode 100644
index a297a97d8b..0000000000
--- a/cpu/ixp/npe/include/IxOsBufLib.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * @file IxOsBufLib.h (Replaced by OSAL)
- *
- * @date 9 Oct 2002
- *
- * @brief This file contains the mbuf pool initialisation entry point
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- *
- */
-
-#ifndef IXOSBUFLIB_H
-#define IXOSBUFLIB_H
-
-#include "IxOsalBackward.h"
-
-#endif /* IXOSBUFLIB_H */
-
diff --git a/cpu/ixp/npe/include/IxOsBuffMgt.h b/cpu/ixp/npe/include/IxOsBuffMgt.h
deleted file mode 100644
index b7de712bc5..0000000000
--- a/cpu/ixp/npe/include/IxOsBuffMgt.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * @file (Replaced by OSAL)
- *
- * @brief This file includes the OS dependant MBUF header files.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-#ifndef IxOsBuffMgt_inc
-#define IxOsBuffMgt_inc
-
-#include "IxOsalBackward.h"
-
-#endif /* ndef IxOsBuffMgt_inc */
diff --git a/cpu/ixp/npe/include/IxOsBuffPoolMgt.h b/cpu/ixp/npe/include/IxOsBuffPoolMgt.h
deleted file mode 100644
index 4a983c7911..0000000000
--- a/cpu/ixp/npe/include/IxOsBuffPoolMgt.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file IxOsBuffPoolMgt.h (Replaced by OSAL)
- *
- * @date 9 Oct 2002
- *
- * @brief This file contains the mbuf pool implementation API
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- * This module contains the implementation of the OS Services buffer pool
- * management service. This module provides routines for creating pools
- * of buffers for exchange of network data, getting and returning buffers
- * from and to the pool, and some other utility functions.
- * <P>
- * Currently, the pool has 2 underlying implementations - one for the vxWorks
- * OS, and another which attempts to be OS-agnostic so that it can be used on
- * other OS's such as Linux. The API is largely the same for all OS's,
- * but there are some differences to be aware of. These are documented
- * in the API descriptions below.
- * <P>
- * The most significant difference is this: when this module is used with
- * the WindRiver VxWorks OS, it will create a pool of vxWorks "MBufs".
- * These can be used directly with the vxWorks "netBufLib" OS Library.
- * For other OS's, it will create a pool of generic buffers. These may need
- * to be converted into other buffer types (sk_buff's in Linux, for example)
- * before being used with any built-in OS routines available for
- * manipulating network data buffers.
- *
- * @sa IxOsBuffMgt.h
- */
-
-#ifndef IXOSBUFFPOOLMGT_H
-#define IXOSBUFFPOOLMGT_H
-
-#include "IxOsalBackward.h"
-
-#endif /* IXOSBUFFPOOLMGT_H */
-
diff --git a/cpu/ixp/npe/include/IxOsCacheMMU.h b/cpu/ixp/npe/include/IxOsCacheMMU.h
deleted file mode 100644
index 2c8592fe80..0000000000
--- a/cpu/ixp/npe/include/IxOsCacheMMU.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * @file IxOsCacheMMU.h
- *
- * @brief this file contains the API of the @ref IxCacheMMU component
- *
- * <hr>
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsCacheMMU_H
-
-#ifndef __doxygen_hide
-#define IxOsCacheMMU_H
-#endif /* __doxygen_hide */
-
-#ifdef __doxygen_HIDE
-#define IX_OS_CACHE_DOXYGEN
-#endif /* __doxygen_HIDE */
-
-#include "IxOsalBackward.h"
-
-#endif /* IxOsCacheMMU_H */
-
diff --git a/cpu/ixp/npe/include/IxOsPrintf.h b/cpu/ixp/npe/include/IxOsPrintf.h
deleted file mode 100644
index 218e140934..0000000000
--- a/cpu/ixp/npe/include/IxOsPrintf.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * @file IxOsPrintf.h
- *
- * @brief this file contains the API of the @ref IxOsServices component
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#include "IxTypes.h"
-
-#ifndef IxOsPrintf_H
-
-#ifndef __doxygen_hide
-#define IxOsPrintf_H
-#endif /* __doxygen_hide */
-
-#ifdef __wince
-
-#ifndef IX_USE_SERCONSOLE
-
-static int
-ixLogMsg(
- char *pFormat,
- ...
- )
-{
-#ifndef IN_KERNEL
- static WCHAR pOutputString[256];
- static char pNarrowStr[256];
- int returnCnt = 0;
- va_list ap;
-
- pOutputString[0] = 0;
- pNarrowStr[0] = 0;
-
- va_start(ap, pFormat);
-
- returnCnt = _vsnprintf(pNarrowStr, 256, pFormat, ap);
-
- MultiByteToWideChar(
- CP_ACP,
- MB_PRECOMPOSED,
- pNarrowStr,
- -1,
- pOutputString,
- 256
- );
-
- OutputDebugString(pOutputString);
-
- return returnCnt;
-#else
- return 0;
-#endif
-}
-#define printf ixLogMsg
-
-#endif /* IX_USE_SERCONSOLE */
-
-#endif /* __wince */
-
-/**
- * @} IxOsPrintf
- */
-
-#endif /* IxOsPrintf_H */
diff --git a/cpu/ixp/npe/include/IxOsServices.h b/cpu/ixp/npe/include/IxOsServices.h
deleted file mode 100644
index 62e8a790b9..0000000000
--- a/cpu/ixp/npe/include/IxOsServices.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * @file (Replaced by OSAL)
- *
- * @brief this file contains the API of the @ref IxOsServices component
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-#ifndef IxOsServices_H
-
-#ifndef __doxygen_hide
-#define IxOsServices_H
-#endif /* __doxygen_hide */
-
-#include "IxOsalBackward.h"
-
-#endif /* IxOsServices_H */
-
-
diff --git a/cpu/ixp/npe/include/IxOsServicesComponents.h b/cpu/ixp/npe/include/IxOsServicesComponents.h
deleted file mode 100644
index d662cd3eee..0000000000
--- a/cpu/ixp/npe/include/IxOsServicesComponents.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * @file IxOsServicesComponents.h (Replaced by OSAL)
- *
- * @brief Header file for memory access
- *
- * @par
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsServicesComponents_H
-#define IxOsServicesComponents_H
-
-#include "IxOsalBackward.h"
- * codelets_parityENAcc
- * timeSyncAcc
- * parityENAcc
- * sspAcc
- * i2c
- * integration_sspAcc
- * integration_i2c
-#define ix_timeSyncAcc 36
-#define ix_parityENAcc 37
-#define ix_codelets_parityENAcc 38
-#define ix_sspAcc 39
-#define ix_i2c 40
-#define ix_integration_sspAcc 41
-#define ix_integration_i2c 42
-#define ix_osal 43
-#define ix_integration_parityENAcc 44
-#define ix_integration_timeSyncAcc 45
-
-/***************************
- * timeSyncAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_timeSyncAcc)
-
-#if defined (IX_OSSERV_VXWORKS_LE)
-
-#define CSR_LE_DATA_COHERENT_MAPPING
-
-#endif /* IX_OSSERV_VXWORKS_LE */
-
-#endif /* timeSyncAcc */
-
-/***************************
- * parityENAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_parityENAcc)
-
-#if defined (IX_OSSERV_VXWORKS_LE)
-
-#define CSR_LE_DATA_COHERENT_MAPPING
-
-#endif /* IX_OSSERV_VXWORKS_LE */
-
-#endif /* parityENAcc */
-
-/***************************
- * codelets_parityENAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_codelets_parityENAcc)
-
-#if defined (IX_OSSERV_VXWORKS_LE)
-
-#define CSR_LE_DATA_COHERENT_MAPPING
-
-#endif /* IX_OSSERV_VXWORKS_LE */
-
-#endif /* codelets_parityENAcc */
-
-#endif /* IxOsServicesComponents_H */
-
-/***************************
- * integration_timeSyncAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_integration_timeSyncAcc)
-
-#if defined (IX_OSSERV_VXWORKS_LE)
-
-#define CSR_LE_DATA_COHERENT_MAPPING
-
-#endif /* IX_OSSERV_VXWORKS_LE */
-
-#endif /* integration_timeSyncAcc */
-
-/***************************
- * integration_parityENAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_integration_parityENAcc)
-
-#if defined (IX_OSSERV_VXWORKS_LE)
-
-#define CSR_LE_DATA_COHERENT_MAPPING
-
-#endif /* IX_OSSERV_VXWORKS_LE */
-
-#endif /* integration_parityENAcc */
diff --git a/cpu/ixp/npe/include/IxOsServicesEndianess.h b/cpu/ixp/npe/include/IxOsServicesEndianess.h
deleted file mode 100644
index 0d6cd8ccef..0000000000
--- a/cpu/ixp/npe/include/IxOsServicesEndianess.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * @file IxOsServicesEndianess.h (Replaced by OSAL)
- *
- * @brief Header file for determining system endianess and OS
- *
- * @par
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsServicesEndianess_H
-#define IxOsServicesEndianess_H
-
-#include "IxOsalBackward.h"
-
-#endif /* IxOsServicesEndianess_H */
diff --git a/cpu/ixp/npe/include/IxOsServicesMemAccess.h b/cpu/ixp/npe/include/IxOsServicesMemAccess.h
deleted file mode 100644
index 58e9941065..0000000000
--- a/cpu/ixp/npe/include/IxOsServicesMemAccess.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * @file IxOsServicesMemAccess.h (Replaced by OSAL)
- *
- * @brief Header file for memory access
- *
- * @par
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsServicesMemAccess_H
-#define IxOsServicesMemAccess_H
-
-#include "IxOsalBackward.h"
-
-#endif /* IxOsServicesMemAccess_H */
diff --git a/cpu/ixp/npe/include/IxOsServicesMemMap.h b/cpu/ixp/npe/include/IxOsServicesMemMap.h
deleted file mode 100644
index 4ce37c3f67..0000000000
--- a/cpu/ixp/npe/include/IxOsServicesMemMap.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * @file IxOsServicesMemMap.h (Replaced by OSAL)
- *
- * @brief Header file for memory access maps
- *
- * @par
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsServicesMemMap_H
-#define IxOsServicesMemMap_H
-
-#include "IxOsalBackward.h"
-#define IX_OSSERV_ETH_NPEA_MAP_SIZE (0x1000) /**< Eth for NPEA map size */
-#define IX_OSSERV_ETH_NPEA_PHYS_BASE IXP425_Eth_NPEA_BASE_PHYS
-
-#endif /* IxOsServicesMemMap_H */
diff --git a/cpu/ixp/npe/include/IxOsal.h b/cpu/ixp/npe/include/IxOsal.h
deleted file mode 100644
index b2a93a5dba..0000000000
--- a/cpu/ixp/npe/include/IxOsal.h
+++ /dev/null
@@ -1,1517 +0,0 @@
-/**
- * @file IxOsal.h
- *
- * @brief Top include file for OSAL
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsal_H
-#define IxOsal_H
-
-/* Basic types */
-#include "IxOsalTypes.h"
-
-/* Include assert */
-#include "IxOsalAssert.h"
-
-/*
- * Config header gives users option to choose IO MEM
- * and buffer management modules
- */
-
-#include "IxOsalConfig.h"
-
-/*
- * Symbol file needed by some OS.
- */
-#include "IxOsalUtilitySymbols.h"
-
-/* OS-specific header */
-#include "IxOsalOs.h"
-
-
-/**
- * @defgroup IxOsal Operating System Abstraction Layer (IxOsal) API
- *
- * @brief This service provides a thin layer of OS dependency services.
- *
- * This file contains the API to the functions which are some what OS dependant and would
- * require porting to a particular OS.
- * A primary focus of the component development is to make them as OS independent as possible.
- * All other components should abstract their OS dependency to this module.
- * Services overview
- * -# Data types, constants, defines
- * -# Interrupts
- * - bind interrupts to handlers
- * - unbind interrupts from handlers
- * - disables all interrupts
- * - enables all interrupts
- * - selectively disables interrupts
- * - enables an interrupt level
- * - disables an interrupt level
- * -# Memory
- * - allocates memory
- * - frees memory
- * - copies memory zones
- * - fills a memory zone
- * - allocates cache-safe memory
- * - frees cache-safe memory
- * - physical to virtual address translation
- * - virtual to physical address translation
- * - cache to memory flush
- * - cache line invalidate
- * -# Threads
- * - creates a new thread
- * - starts a newly created thread
- * - kills an existing thread
- * - exits a running thread
- * - sets the priority of an existing thread
- * - suspends thread execution
- * - resumes thread execution
- * -# IPC
- * - creates a message queue
- * - deletes a message queue
- * - sends a message to a message queue
- * - receives a message from a message queue
- * -# Thread Synchronisation
- * - initializes a mutex
- * - locks a mutex
- * - unlocks a mutex
- * - non-blocking attempt to lock a mutex
- * - destroys a mutex object
- * - initializes a fast mutex
- * - non-blocking attempt to lock a fast mutex
- * - unlocks a fast mutex
- * - destroys a fast mutex object
- * - initializes a semaphore
- * - posts to (increments) a semaphore
- * - waits on (decrements) a semaphore
- * - non-blocking wait on semaphore
- * - gets semaphore value
- * - destroys a semaphore object
- * - yields execution of current thread
- * -# Time functions
- * - yielding sleep for a number of milliseconds
- * - busy sleep for a number of microseconds
- * - value of the timestamp counter
- * - resolution of the timestamp counter
- * - system clock rate, in ticks
- * - current system time
- * - converts ixOsalTimeVal into ticks
- * - converts ticks into ixOsalTimeVal
- * - converts ixOsalTimeVal to milliseconds
- * - converts milliseconds to IxOsalTimeval
- * - "equal" comparison for IxOsalTimeval
- * - "less than" comparison for IxOsalTimeval
- * - "greater than" comparison for IxOsalTimeval
- * - "add" operator for IxOsalTimeval
- * - "subtract" operator for IxOsalTimeval
- * -# Logging
- * - sets the current logging verbosity level
- * - interrupt-safe logging function
- * -# Timer services
- * - schedules a repeating timer
- * - schedules a single-shot timer
- * - cancels a running timer
- * - displays all the running timers
- * -# Optional Modules
- * - Buffer management module
- * - I/O memory and endianess support module
- *
- * @{
- */
-
-
-/*
- * Prototypes
- */
-
-/* ========================== Interrupts ================================
- *
- */
-
-/**
- * @ingroup IxOsal
- *
- * @brief Binds an interrupt handler to an interrupt level
- *
- * @param irqLevel (in) - interrupt level
- * @param irqHandler (in) - interrupt handler
- * @param parameter (in) - custom parameter to be passed to the
- * interrupt handler
- *
- * Binds an interrupt handler to an interrupt level. The operation will
- * fail if the wrong level is selected, if the handler is NULL, or if the
- * interrupt is already bound. This functions binds the specified C
- * routine to an interrupt level. When called, the "parameter" value will
- * be passed to the routine.
- *
- * Reentrant: no
- * IRQ safe: no
- *
- * @return IX_SUCCESS if the operation succeeded or IX_FAIL otherwise
- */
-PUBLIC IX_STATUS ixOsalIrqBind (UINT32 irqLevel,
- IxOsalVoidFnVoidPtr irqHandler,
- void *parameter);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Unbinds an interrupt handler from an interrupt level
- *
- * @param irqLevel (in) - interrupt level
- *
- * Unbinds the selected interrupt level from any previously registered
- * handler
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return IX_SUCCESS if the operation succeeded or IX_FAIL otherwise
- */
-PUBLIC IX_STATUS ixOsalIrqUnbind (UINT32 irqLevel);
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief Disables all interrupts
- *
- * @param - none
- *
- * Disables all the interrupts and prevents tasks scheduling
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return interrupt enable status prior to locking
- */
-PUBLIC UINT32 ixOsalIrqLock (void);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Enables all interrupts
- *
- * @param irqEnable (in) - interrupt enable status, prior to interrupt
- * locking
- *
- * Enables the interrupts and task scheduling, cancelling the effect
- * of ixOsalIrqLock()
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return IX_SUCCESS if the operation succeeded or IX_FAIL otherwise
- */
-PUBLIC void ixOsalIrqUnlock (UINT32 irqEnable);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Selectively disables interrupts
- *
- * @param irqLevel ­ new interrupt level
- *
- * Disables the interrupts below the specified interrupt level
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @note Depending on the implementation this function can disable all
- * the interrupts
- *
- * @return previous interrupt level
- */
-PUBLIC UINT32 ixOsalIrqLevelSet (UINT32 irqLevel);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Enables an interrupt level
- *
- * @param irqLevel ­ interrupt level to enable
- *
- * Enables the specified interrupt level
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return - none
- */
-PUBLIC void ixOsalIrqEnable (UINT32 irqLevel);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Disables an interrupt level
- *
- * @param irqLevel ­ interrupt level to disable
- *
- * Disables the specified interrupt level
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return - none
- */
-PUBLIC void ixOsalIrqDisable (UINT32 irqLevel);
-
-
-/* ============================= Memory =================================
- *
- */
-
-/**
- * @ingroup IxOsal
- *
- * @brief Allocates memory
- *
- * @param size - memory size to allocate, in bytes
- *
- * Allocates a memory zone of a given size
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return Pointer to the allocated zone or NULL if the allocation failed
- */
-PUBLIC void *ixOsalMemAlloc (UINT32 size);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Frees memory
- *
- * @param ptr - pointer to the memory zone
- *
- * Frees a previously allocated memory zone
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - none
- */
-PUBLIC void ixOsalMemFree (void *ptr);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Copies memory zones
- *
- * @param dest - destination memory zone
- * @param src - source memory zone
- * @param count - number of bytes to copy
- *
- * Copies count bytes from the source memory zone pointed by src into the
- * memory zone pointed by dest.
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return Pointer to the destination memory zone
- */
-PUBLIC void *ixOsalMemCopy (void *dest, void *src, UINT32 count);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Fills a memory zone
- *
- * @param ptr - pointer to the memory zone
- * @param filler - byte to fill the memory zone with
- * @param count - number of bytes to fill
- *
- * Fills a memory zone with a given constant byte
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return Pointer to the memory zone
- */
-PUBLIC void *ixOsalMemSet (void *ptr, UINT8 filler, UINT32 count);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Allocates cache-safe memory
- *
- * @param size - size, in bytes, of the allocated zone
- *
- * Allocates a cache-safe memory zone of at least "size" bytes and returns
- * the pointer to the memory zone. This memory zone, depending on the
- * platform, is either uncached or aligned on a cache line boundary to make
- * the CACHE_FLUSH and CACHE_INVALIDATE macros safe to use. The memory
- * allocated with this function MUST be freed with ixOsalCacheDmaFree(),
- * otherwise memory corruption can occur.
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return Pointer to the memory zone or NULL if allocation failed
- *
- * @note It is important to note that cache coherence is maintained in
- * software by using the IX_OSAL_CACHE_FLUSH and IX_OSAL_CACHE_INVALIDATE
- * macros to maintain consistency between cache and external memory.
- */
-PUBLIC void *ixOsalCacheDmaMalloc (UINT32 size);
-
-/* Macros for ixOsalCacheDmaMalloc*/
-#define IX_OSAL_CACHE_DMA_MALLOC(size) ixOsalCacheDmaMalloc(size)
-
-/**
- * @ingroup IxOsal
- *
- * @brief Frees cache-safe memory
- *
- * @param ptr - pointer to the memory zone
- *
- * Frees a memory zone previously allocated with ixOsalCacheDmaMalloc()
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - none
- */
-PUBLIC void ixOsalCacheDmaFree (void *ptr);
-
-#define IX_OSAL_CACHE_DMA_FREE(ptr) ixOsalCacheDmaFree(ptr)
-
-/**
- * @ingroup IxOsal
- *
- * @brief physical to virtual address translation
- *
- * @param physAddr - physical address
- *
- * Converts a physical address into its equivalent MMU-mapped virtual address
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return Corresponding virtual address, as UINT32
- */
-#define IX_OSAL_MMU_PHYS_TO_VIRT(physAddr) \
- IX_OSAL_OS_MMU_PHYS_TO_VIRT(physAddr)
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief virtual to physical address translation
- *
- * @param virtAddr - virtual address
- *
- * Converts a virtual address into its equivalent MMU-mapped physical address
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return Corresponding physical address, as UINT32
- */
-#define IX_OSAL_MMU_VIRT_TO_PHYS(virtAddr) \
- IX_OSAL_OS_MMU_VIRT_TO_PHYS(virtAddr)
-
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief cache to memory flush
- *
- * @param addr - memory address to flush from cache
- * @param size - number of bytes to flush (rounded up to a cache line)
- *
- * Flushes the cached value of the memory zone pointed by "addr" into memory,
- * rounding up to a cache line. Use before the zone is to be read by a
- * processing unit which is not cache coherent with the main CPU.
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return - none
- */
-#define IX_OSAL_CACHE_FLUSH(addr, size) IX_OSAL_OS_CACHE_FLUSH(addr, size)
-
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief cache line invalidate
- *
- * @param addr - memory address to invalidate in cache
- * @param size - number of bytes to invalidate (rounded up to a cache line)
- *
- * Invalidates the cached value of the memory zone pointed by "addr",
- * rounding up to a cache line. Use before reading the zone from the main
- * CPU, if the zone has been updated by a processing unit which is not cache
- * coherent with the main CPU.
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return - none
- */
-#define IX_OSAL_CACHE_INVALIDATE(addr, size) IX_OSAL_OS_CACHE_INVALIDATE(addr, size)
-
-
-/* ============================= Threads =================================
- *
- */
-
-/**
- * @ingroup IxOsal
- *
- * @brief Creates a new thread
- *
- * @param thread - handle of the thread to be created
- * @param threadAttr - pointer to a thread attribute object
- * @param startRoutine - thread entry point
- * @param arg - argument given to the thread
- *
- * Creates a thread given a thread handle and a thread attribute object. The
- * same thread attribute object can be used to create separate threads. "NULL"
- * can be specified as the attribute, in which case the default values will
- * be used. The thread needs to be explicitly started using ixOsalThreadStart().
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalThreadCreate (IxOsalThread * thread,
- IxOsalThreadAttr * threadAttr,
- IxOsalVoidFnVoidPtr startRoutine,
- void *arg);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Starts a newly created thread
- *
- * @param thread - handle of the thread to be started
- *
- * Starts a thread given its thread handle. This function is to be called
- * only once, following the thread initialization.
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalThreadStart (IxOsalThread * thread);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Kills an existing thread
- *
- * @param thread - handle of the thread to be killed
- *
- * Kills a thread given its thread handle.
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @note It is not possible to kill threads in Linux kernel mode. This
- * function will only send a SIGTERM signal, and it is the responsibility
- * of the thread to check for the presence of this signal with
- * signal_pending().
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalThreadKill (IxOsalThread * thread);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Exits a running thread
- *
- * Terminates the calling thread
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - This function never returns
- */
-PUBLIC void ixOsalThreadExit (void);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Sets the priority of an existing thread
- *
- * @param thread - handle of the thread
- * @param priority - new priority, between 0 and 255 (0 being the highest)
- *
- * Sets the thread priority
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalThreadPrioritySet (IxOsalThread * thread,
- UINT32 priority);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Suspends thread execution
- *
- * @param thread - handle of the thread
- *
- * Suspends the thread execution
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalThreadSuspend (IxOsalThread * thread);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Resumes thread execution
- *
- * @param thread - handle of the thread
- *
- * Resumes the thread execution
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalThreadResume (IxOsalThread * thread);
-
-
-/* ======================= Message Queues (IPC) ==========================
- *
- */
-
-/**
- * @ingroup IxOsal
- *
- * @brief Creates a message queue
- *
- * @param queue - queue handle
- * @param msgCount - maximum number of messages to hold in the queue
- * @param msgLen - maximum length of each message, in bytes
- *
- * Creates a message queue of msgCount messages, each containing msgLen bytes
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalMessageQueueCreate (IxOsalMessageQueue * queue,
- UINT32 msgCount, UINT32 msgLen);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Deletes a message queue
- *
- * @param queue - queue handle
- *
- * Deletes a message queue
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalMessageQueueDelete (IxOsalMessageQueue * queue);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Sends a message to a message queue
- *
- * @param queue - queue handle
- * @param message - message to send
- *
- * Sends a message to the message queue. The message will be copied (at the
- * configured size of the message) into the queue.
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalMessageQueueSend (IxOsalMessageQueue * queue,
- UINT8 * message);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Receives a message from a message queue
- *
- * @param queue - queue handle
- * @param message - pointer to where the message should be copied to
- *
- * Retrieves the first message from the message queue
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalMessageQueueReceive (IxOsalMessageQueue * queue,
- UINT8 * message);
-
-
-/* ======================= Thread Synchronisation ========================
- *
- */
-
-/**
- * @ingroup IxOsal
- *
- * @brief initializes a mutex
- *
- * @param mutex - mutex handle
- *
- * Initializes a mutex object
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalMutexInit (IxOsalMutex * mutex);
-
-/**
- * @ingroup IxOsal
- *
- * @brief locks a mutex
- *
- * @param mutex - mutex handle
- * @param timeout - timeout in ms; IX_OSAL_WAIT_FOREVER (-1) to wait forever
- * or IX_OSAL_WAIT_NONE to return immediately
- *
- * Locks a mutex object
- *
- * @li Reentrant: yes
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalMutexLock (IxOsalMutex * mutex, INT32 timeout);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Unlocks a mutex
- *
- * @param mutex - mutex handle
- *
- * Unlocks a mutex object
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalMutexUnlock (IxOsalMutex * mutex);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Non-blocking attempt to lock a mutex
- *
- * @param mutex - mutex handle
- *
- * Attempts to lock a mutex object, returning immediately with IX_SUCCESS if
- * the lock was successful or IX_FAIL if the lock failed
- *
- * @li Reentrant: yes
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalMutexTryLock (IxOsalMutex * mutex);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Destroys a mutex object
- *
- * @param mutex - mutex handle
- * @param
- *
- * Destroys a mutex object; the caller should ensure that no thread is
- * blocked on this mutex
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalMutexDestroy (IxOsalMutex * mutex);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Initializes a fast mutex
- *
- * @param mutex - fast mutex handle
- *
- * Initializes a fast mutex object
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalFastMutexInit (IxOsalFastMutex * mutex);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Non-blocking attempt to lock a fast mutex
- *
- * @param mutex - fast mutex handle
- *
- * Attempts to lock a fast mutex object, returning immediately with
- * IX_SUCCESS if the lock was successful or IX_FAIL if the lock failed
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalFastMutexTryLock (IxOsalFastMutex * mutex);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Unlocks a fast mutex
- *
- * @param mutex - fast mutex handle
- *
- * Unlocks a fast mutex object
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalFastMutexUnlock (IxOsalFastMutex * mutex);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Destroys a fast mutex object
- *
- * @param mutex - fast mutex handle
- *
- * Destroys a fast mutex object
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalFastMutexDestroy (IxOsalFastMutex * mutex);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Initializes a semaphore
- *
- * @param semaphore - semaphore handle
- * @param value - initial semaphore value
- *
- * Initializes a semaphore object
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalSemaphoreInit (IxOsalSemaphore * semaphore,
- UINT32 value);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Posts to (increments) a semaphore
- *
- * @param semaphore - semaphore handle
- *
- * Increments a semaphore object
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalSemaphorePost (IxOsalSemaphore * semaphore);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Waits on (decrements) a semaphore
- *
- * @param semaphore - semaphore handle
- * @param timeout - timeout, in ms; IX_OSAL_WAIT_FOREVER (-1) if the thread
- * is to block indefinitely or IX_OSAL_WAIT_NONE (0) if the thread is to
- * return immediately even if the call fails
- *
- * Decrements a semaphore, blocking if the semaphore is
- * unavailable (value is 0).
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalSemaphoreWait (IxOsalSemaphore * semaphore,
- INT32 timeout);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Non-blocking wait on semaphore
- *
- * @param semaphore - semaphore handle
- *
- * Decrements a semaphore, not blocking the calling thread if the semaphore
- * is unavailable
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalSemaphoreTryWait (IxOsalSemaphore * semaphore);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Gets semaphore value
- *
- * @param semaphore - semaphore handle
- * @param value - location to store the semaphore value
- *
- * Retrieves the current value of a semaphore object
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalSemaphoreGetValue (IxOsalSemaphore * semaphore,
- UINT32 * value);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Destroys a semaphore object
- *
- * @param semaphore - semaphore handle
- *
- * Destroys a semaphore object; the caller should ensure that no thread is
- * blocked on this semaphore
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalSemaphoreDestroy (IxOsalSemaphore * semaphore);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Yields execution of current thread
- *
- * Yields the execution of the current thread
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - none
- */
-PUBLIC void ixOsalYield (void);
-
-
-/* ========================== Time functions ===========================
- *
- */
-
-/**
- * @ingroup IxOsal
- *
- * @brief Yielding sleep for a number of milliseconds
- *
- * @param milliseconds - number of milliseconds to sleep
- *
- * The calling thread will sleep for the specified number of milliseconds.
- * This sleep is yielding, hence other tasks will be scheduled by the
- * operating system during the sleep period. Calling this function with an
- * argument of 0 will place the thread at the end of the current scheduling
- * loop.
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - none
- */
-PUBLIC void ixOsalSleep (UINT32 milliseconds);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Busy sleep for a number of microseconds
- *
- * @param microseconds - number of microseconds to sleep
- *
- * Sleeps for the specified number of microseconds, without explicitly
- * yielding thread execution to the OS scheduler
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - none
- */
-PUBLIC void ixOsalBusySleep (UINT32 microseconds);
-
-/**
- * @ingroup IxOsal
- *
- * @brief XXX
- *
- * Retrieves the current timestamp
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - The current timestamp
- *
- * @note The implementation of this function is platform-specific. Not
- * all the platforms provide a high-resolution timestamp counter.
- */
-PUBLIC UINT32 ixOsalTimestampGet (void);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Resolution of the timestamp counter
- *
- * Retrieves the resolution (frequency) of the timestamp counter.
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - The resolution of the timestamp counter
- *
- * @note The implementation of this function is platform-specific. Not all
- * the platforms provide a high-resolution timestamp counter.
- */
-PUBLIC UINT32 ixOsalTimestampResolutionGet (void);
-
-/**
- * @ingroup IxOsal
- *
- * @brief System clock rate, in ticks
- *
- * Retrieves the resolution (number of ticks per second) of the system clock
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - The system clock rate
- *
- * @note The implementation of this function is platform and OS-specific.
- * The system clock rate is not always available - e.g. Linux does not
- * provide this information in user mode
- */
-PUBLIC UINT32 ixOsalSysClockRateGet (void);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Current system time
- *
- * @param tv - pointer to an IxOsalTimeval structure to store the current
- * time in
- *
- * Retrieves the current system time (real-time)
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - none
- *
- * @note The implementation of this function is platform-specific. Not all
- * platforms have a real-time clock.
- */
-PUBLIC void ixOsalTimeGet (IxOsalTimeval * tv);
-
-
-
-/* Internal function to convert timer val to ticks.
- * NOTE - This should not be called by the user.
- * Use the macro IX_OSAL_TIMEVAL_TO_TICKS
- * OS-independent, implemented in framework.
- */
-PUBLIC UINT32 ixOsalTimevalToTicks (IxOsalTimeval tv);
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief Converts ixOsalTimeVal into ticks
- *
- * @param tv - an IxOsalTimeval structure
- *
- * Converts an IxOsalTimeval structure into OS ticks
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - Corresponding number of ticks
- *
- * Note: This function is OS-independent. Implemented by core.
- */
-#define IX_OSAL_TIMEVAL_TO_TICKS(tv) ixOsalTimevalToTicks(tv)
-
-
-
-/* Internal function to convert ticks to timer val
- * NOTE - This should not be called by the user.
- * Use the macro IX_OSAL_TICKS_TO_TIMEVAL
- */
-
-PUBLIC void ixOsalTicksToTimeval (UINT32 ticks, IxOsalTimeval * pTv);
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief Converts ticks into ixOsalTimeVal
- *
- * @param ticks - number of ticks
- * @param pTv - pointer to the destination structure
- *
- * Converts the specified number of ticks into an IxOsalTimeval structure
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - Corresponding IxOsalTimeval structure
- * Note: This function is OS-independent. Implemented by core.
- */
-#define IX_OSAL_TICKS_TO_TIMEVAL(ticks, pTv) \
- ixOsalTicksToTimeval(ticks, pTv)
-
-
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief Converts ixOsalTimeVal to milliseconds
- *
- * @param tv - IxOsalTimeval structure to convert
- *
- * Converts an IxOsalTimeval structure into milliseconds
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - Corresponding number of milliseconds
- * Note: This function is OS-independent. Implemented by core.
- */
-#define IX_OSAL_TIMEVAL_TO_MS(tv) ((tv.secs * 1000) + (tv.nsecs / 1000000))
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief Converts milliseconds to IxOsalTimeval
- *
- * @param milliseconds - number of milliseconds to convert
- * @param pTv - pointer to the destination structure
- *
- * Converts a millisecond value into an IxOsalTimeval structure
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - Corresponding IxOsalTimeval structure
- * Note: This function is OS-independent. Implemented by core.
- */
-#define IX_OSAL_MS_TO_TIMEVAL(milliseconds, pTv) \
- ((IxOsalTimeval *) pTv)->secs = milliseconds / 1000; \
- ((IxOsalTimeval *) pTv)->nsecs = (milliseconds % 1000) * 1000000
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief "equal" comparison for IxOsalTimeval
- *
- * @param tvA, tvB - IxOsalTimeval structures to compare
- *
- * Compares two IxOsalTimeval structures for equality
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - TRUE if the structures are equal
- * - FALSE otherwise
- * Note: This function is OS-independant
- */
-#define IX_OSAL_TIME_EQ(tvA, tvB) \
- ((tvA).secs == (tvB).secs && (tvA).nsecs == (tvB).nsecs)
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief "less than" comparison for IxOsalTimeval
- *
- * @param tvA, tvB - IxOsalTimeval structures to compare
- *
- * Compares two IxOsalTimeval structures to determine if the first one is
- * less than the second one
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - TRUE if tvA < tvB
- * - FALSE otherwise
- * Note: This function is OS-independent. Implemented by core.
- */
-#define IX_OSAL_TIME_LT(tvA,tvB) \
- ((tvA).secs < (tvB).secs || \
- ((tvA).secs == (tvB).secs && (tvA).nsecs < (tvB).nsecs))
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief "greater than" comparison for IxOsalTimeval
- *
- * @param tvA, tvB - IxOsalTimeval structures to compare
- *
- * Compares two IxOsalTimeval structures to determine if the first one is
- * greater than the second one
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - TRUE if tvA > tvB
- * - FALSE otherwise
- * Note: This function is OS-independent.
- */
-#define IX_OSAL_TIME_GT(tvA, tvB) \
- ((tvA).secs > (tvB).secs || \
- ((tvA).secs == (tvB).secs && (tvA).nsecs > (tvB).nsecs))
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief "add" operator for IxOsalTimeval
- *
- * @param tvA, tvB - IxOsalTimeval structures to add
- *
- * Adds the second IxOsalTimevalStruct to the first one (equivalent to
- * tvA += tvB)
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - none
- * Note: This function is OS-independent.
- */
-#define IX_OSAL_TIME_ADD(tvA, tvB) \
- (tvA).secs += (tvB).secs; \
- (tvA).nsecs += (tvB).nsecs; \
- if ((tvA).nsecs >= IX_OSAL_BILLION) \
- { \
- (tvA).secs++; \
- (tvA).nsecs -= IX_OSAL_BILLION; }
-
-
-/**
- * @ingroup IxOsal
- *
- * @brief "subtract" operator for IxOsalTimeval
- *
- * @param tvA, tvB - IxOsalTimeval structures to subtract
- *
- * Subtracts the second IxOsalTimevalStruct from the first one (equivalent
- * to tvA -= tvB)
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - none
- * Note: This function is OS-independent. Implemented by core.
- */
-#define IX_OSAL_TIME_SUB(tvA, tvB) \
- if ((tvA).nsecs >= (tvB).nsecs) \
- { \
- (tvA).secs -= (tvB).secs; \
- (tvA).nsecs -= (tvB).nsecs; \
- } \
- else \
- { \
- (tvA).secs -= ((tvB).secs + 1); \
- (tvA).nsecs += IX_OSAL_BILLION - (tvB).nsecs; \
- }
-
-
-/* ============================= Logging ==============================
- *
- */
-
-/**
- * @ingroup IxOsal
- *
- * @brief Interrupt-safe logging function
- *
- * @param level - identifier prefix for the message
- * @param device - output device
- * @param format - message format, in a printf format
- * @param ... - up to 6 arguments to be printed
- *
- * IRQ-safe logging function, similar to printf. Accepts up to 6 arguments
- * to print (excluding the level, device and the format). This function will
- * actually display the message only if the level is lower than the current
- * verbosity level or if the IX_OSAL_LOG_USER level is used. An output device
- * must be specified (see IxOsalTypes.h).
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - Beside the exceptions documented in the note below, the returned
- * value is the number of printed characters, or -1 if the parameters are
- * incorrect (NULL format, unknown output device)
- *
- * @note The exceptions to the return value are:
- * VxWorks: The return value is 32 if the specified level is 1 and 64
- * if the specified level is greater than 1 and less or equal than 9.
- * WinCE: If compiled for EBOOT then the return value is always 0.
- *
- * @note The given print format should take into account the specified
- * output device. IX_OSAL_STDOUT supports all the usual print formats,
- * however a custom hex display specified by IX_OSAL_HEX would support
- * only a fixed number of hexadecimal digits.
- */
-PUBLIC INT32 ixOsalLog (IxOsalLogLevel level,
- IxOsalLogDevice device,
- char *format,
- int arg1,
- int arg2, int arg3, int arg4, int arg5, int arg6);
-
-/**
- * @ingroup IxOsal
- *
- * @brief sets the current logging verbosity level
- *
- * @param level - new log verbosity level
- *
- * Sets the log verbosity level. The default value is IX_OSAL_LOG_ERROR.
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * @return - Old log verbosity level
- */
-PUBLIC UINT32 ixOsalLogLevelSet (UINT32 level);
-
-
-/* ============================= Logging ==============================
- *
- */
-
-/**
- * @ingroup IxOsal
- *
- * @brief Schedules a repeating timer
- *
- * @param timer - handle of the timer object
- * @param period - timer trigger period, in milliseconds
- * @param priority - timer priority (0 being the highest)
- * @param callback - user callback to invoke when the timer triggers
- * @param param - custom parameter passed to the callback
- *
- * Schedules a timer to be called every period milliseconds. The timer
- * will invoke the specified callback function possibly in interrupt
- * context, passing the given parameter. If several timers trigger at the
- * same time contention issues are dealt according to the specified timer
- * priorities.
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalRepeatingTimerSchedule (IxOsalTimer * timer,
- UINT32 period,
- UINT32 priority,
- IxOsalVoidFnVoidPtr callback,
- void *param);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Schedules a single-shot timer
- *
- * @param timer - handle of the timer object
- * @param period - timer trigger period, in milliseconds
- * @param priority - timer priority (0 being the highest)
- * @param callback - user callback to invoke when the timer triggers
- * @param param - custom parameter passed to the callback
- *
- * Schedules a timer to be called after period milliseconds. The timer
- * will cease to function past its first trigger. The timer will invoke
- * the specified callback function, possibly in interrupt context, passing
- * the given parameter. If several timers trigger at the same time contention
- * issues are dealt according to the specified timer priorities.
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS
-ixOsalSingleShotTimerSchedule (IxOsalTimer * timer,
- UINT32 period,
- UINT32 priority,
- IxOsalVoidFnVoidPtr callback, void *param);
-
-/**
- * @ingroup IxOsal
- *
- * @brief Cancels a running timer
- *
- * @param timer - handle of the timer object
- *
- * Cancels a single-shot or repeating timer.
- *
- * @li Reentrant: no
- * @li IRQ safe: yes
- *
- * @return - IX_SUCCESS/IX_FAIL
- */
-PUBLIC IX_STATUS ixOsalTimerCancel (IxOsalTimer * timer);
-
-/**
- * @ingroup IxOsal
- *
- * @brief displays all the running timers
- *
- * Displays a list with all the running timers and their parameters (handle,
- * period, type, priority, callback and user parameter)
- *
- * @li Reentrant: no
- * @li IRQ safe: no
- *
- * @return - none
- */
-PUBLIC void ixOsalTimersShow (void);
-
-
-/* ============================= Version ==============================
- *
- */
-
-/**
- * @ingroup IxOsal
- *
- * @brief provides the name of the Operating System running
- *
- * @param osName - Pointer to a NULL-terminated string of characters
- * that holds the name of the OS running.
- * This is both an input and an ouput parameter
- * @param maxSize - Input parameter that defines the maximum number of
- * bytes that can be stored in osName
- *
- * Returns a string of characters that describe the Operating System name
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * return - IX_SUCCESS for successful retrieval
- * - IX_FAIL if (osType == NULL | maxSize =< 0)
- */
-PUBLIC IX_STATUS ixOsalOsNameGet (INT8* osName, INT32 maxSize);
-
-/**
- * @ingroup IxOsal
- *
- * @brief provides the version of the Operating System running
- *
- * @param osVersion - Pointer to a NULL terminated string of characters
- * that holds the version of the OS running.
- * This is both an input and an ouput parameter
- * @param maxSize - Input parameter that defines the maximum number of
- * bytes that can be stored in osVersion
- *
- * Returns a string of characters that describe the Operating System's version
- *
- * @li Reentrant: yes
- * @li IRQ safe: yes
- *
- * return - IX_SUCCESS for successful retrieval
- * - IX_FAIL if (osVersion == NULL | maxSize =< 0)
- */
-PUBLIC IX_STATUS ixOsalOsVersionGet(INT8* osVersion, INT32 maxSize);
-
-
-
-/**
- * @} IxOsal
- */
-
-#endif /* IxOsal_H */
diff --git a/cpu/ixp/npe/include/IxOsalAssert.h b/cpu/ixp/npe/include/IxOsalAssert.h
deleted file mode 100644
index 45cebcdaa6..0000000000
--- a/cpu/ixp/npe/include/IxOsalAssert.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * @file IxOsalAssert.h
- * @author Intel Corporation
- * @date 25-08-2004
- *
- * @brief description goes here
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IX_OSAL_ASSERT_H
-#define IX_OSAL_ASSERT_H
-
-/*
- * Put the system defined include files required
- * @par
- * <TAGGED>
- */
-
-#include "IxOsalOsAssert.h"
-
-/**
- * @brief Assert macro, assert the condition is true. This
- * will not be compiled out.
- * N.B. will result in a system crash if it is false.
- */
-#define IX_OSAL_ASSERT(c) IX_OSAL_OS_ASSERT(c)
-
-
-/**
- * @brief Ensure macro, ensure the condition is true.
- * This will be conditionally compiled out and
- * may be used for test purposes.
- */
-#ifdef IX_OSAL_ENSURE_ON
-#define IX_OSAL_ENSURE(c, str) do { \
-if (!(c)) ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE, IX_OSAL_LOG_DEV_STDOUT, str, \
-0, 0, 0, 0, 0, 0); } while (0)
-
-#else
-#define IX_OSAL_ENSURE(c, str)
-#endif
-
-
-#endif /* IX_OSAL_ASSERT_H */
diff --git a/cpu/ixp/npe/include/IxOsalBackward.h b/cpu/ixp/npe/include/IxOsalBackward.h
deleted file mode 100644
index ea9f30731a..0000000000
--- a/cpu/ixp/npe/include/IxOsalBackward.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * This file is intended to provide backward
- * compatibility for main osService/OSSL
- * APIs.
- *
- * It shall be phased out gradually and users
- * are strongly recommended to use IX_OSAL API.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IX_OSAL_BACKWARD_H
-#define IX_OSAL_BACKWARD_H
-
-#include "IxOsal.h"
-
-#include "IxOsalBackwardCacheMMU.h"
-
-#include "IxOsalBackwardOsServices.h"
-
-#include "IxOsalBackwardMemMap.h"
-
-#include "IxOsalBackwardBufferMgt.h"
-
-#include "IxOsalBackwardOssl.h"
-
-#include "IxOsalBackwardAssert.h"
-
-#endif /* IX_OSAL_BACKWARD_H */
diff --git a/cpu/ixp/npe/include/IxOsalBackwardAssert.h b/cpu/ixp/npe/include/IxOsalBackwardAssert.h
deleted file mode 100644
index be1e27255d..0000000000
--- a/cpu/ixp/npe/include/IxOsalBackwardAssert.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * This file is intended to provide backward
- * compatibility for main osService/OSSL
- * APIs.
- *
- * It shall be phased out gradually and users
- * are strongly recommended to use IX_OSAL API.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IX_OSAL_BACKWARD_ASSERT_H
-#define IX_OSAL_BACKWARD_ASSERT_H
-
-#define IX_ENSURE(c, str) IX_OSAL_ENSURE(c, str)
-#define IX_ASSERT(c) IX_OSAL_ASSERT(c)
-
-#endif /* IX_OSAL_BACKWARD_ASSERT_H */
diff --git a/cpu/ixp/npe/include/IxOsalBackwardBufferMgt.h b/cpu/ixp/npe/include/IxOsalBackwardBufferMgt.h
deleted file mode 100644
index 5ac3f0cac0..0000000000
--- a/cpu/ixp/npe/include/IxOsalBackwardBufferMgt.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * This file is intended to provide backward
- * compatibility for main osService/OSSL
- * APIs.
- *
- * It shall be phased out gradually and users
- * are strongly recommended to use IX_OSAL API.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IX_OSAL_BACKWARD_BUFFER_MGT_H
-#define IX_OSAL_BACKWARD_BUFFER_MGT_H
-
-typedef IX_OSAL_MBUF IX_MBUF;
-
-typedef IX_OSAL_MBUF_POOL IX_MBUF_POOL;
-
-
-#define IX_MBUF_NEXT_BUFFER_IN_PKT_PTR(m_blk_ptr) \
- IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(m_blk_ptr)
-
-
-#define IX_MBUF_NEXT_PKT_IN_CHAIN_PTR(m_blk_ptr) \
- IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m_blk_ptr)
-
-
-#define IX_MBUF_MDATA(m_blk_ptr) \
- IX_OSAL_MBUF_MDATA(m_blk_ptr)
-
-
-#define IX_MBUF_MLEN(m_blk_ptr) \
- IX_OSAL_MBUF_MLEN(m_blk_ptr)
-
-
-#define IX_MBUF_TYPE(m_blk_ptr) \
- IX_OSAL_MBUF_MTYPE(m_blk_ptr)
-
-/* Same as IX_MBUF_TYPE */
-#define IX_MBUF_MTYPE(m_blk_ptr) \
- IX_OSAL_MBUF_MTYPE(m_blk_ptr)
-
-#define IX_MBUF_FLAGS(m_blk_ptr) \
- IX_OSAL_MBUF_FLAGS(m_blk_ptr)
-
-
-#define IX_MBUF_NET_POOL(m_blk_ptr) \
- IX_OSAL_MBUF_NET_POOL(m_blk_ptr)
-
-
-#define IX_MBUF_PKT_LEN(m_blk_ptr) \
- IX_OSAL_MBUF_PKT_LEN(m_blk_ptr)
-
-
-#define IX_MBUF_PRIV(m_blk_ptr) \
- IX_OSAL_MBUF_PRIV(m_blk_ptr)
-
-
-#define IX_MBUF_ALLOCATED_BUFF_LEN(m_blk_ptr) \
- IX_OSAL_MBUF_ALLOCATED_BUFF_LEN(m_blk_ptr)
-
-
-#define IX_MBUF_ALLOCATED_BUFF_DATA(m_blk_ptr) \
- IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(m_blk_ptr)
-
-
-#define IX_MBUF_POOL_SIZE_ALIGN(size) \
- IX_OSAL_MBUF_POOL_SIZE_ALIGN(size)
-
-
-#define IX_MBUF_POOL_MBUF_AREA_SIZE_ALIGNED(count) \
- IX_OSAL_MBUF_POOL_MBUF_AREA_SIZE_ALIGNED(count)
-
-
-#define IX_MBUF_POOL_DATA_AREA_SIZE_ALIGNED(count, size) \
- IX_OSAL_MBUF_POOL_DATA_AREA_SIZE_ALIGNED(count, size)
-
-
-#define IX_MBUF_POOL_MBUF_AREA_ALLOC(count, memAreaSize) \
- IX_OSAL_MBUF_POOL_MBUF_AREA_ALLOC(count, memAreaSize)
-
-
-#define IX_MBUF_POOL_DATA_AREA_ALLOC(count, size, memAreaSize) \
- IX_OSAL_MBUF_POOL_DATA_AREA_ALLOC(count, size, memAreaSize)
-
-IX_STATUS
-ixOsalOsIxp400BackwardPoolInit (IX_OSAL_MBUF_POOL ** poolPtrPtr,
- UINT32 count, UINT32 size, const char *name);
-
-
-/* This one needs extra steps*/
-#define IX_MBUF_POOL_INIT(poolPtr, count, size, name) \
- ixOsalOsIxp400BackwardPoolInit( poolPtr, count, size, name)
-
-
-#define IX_MBUF_POOL_INIT_NO_ALLOC(poolPtrPtr, bufPtr, dataPtr, count, size, name) \
- (*poolPtrPtr = IX_OSAL_MBUF_NO_ALLOC_POOL_INIT(bufPtr, dataPtr, count, size, name))
-
-
-IX_STATUS
-ixOsalOsIxp400BackwardMbufPoolGet (IX_OSAL_MBUF_POOL * poolPtr,
- IX_OSAL_MBUF ** newBufPtrPtr);
-
-#define IX_MBUF_POOL_GET(poolPtr, bufPtrPtr) \
- ixOsalOsIxp400BackwardMbufPoolGet(poolPtr, bufPtrPtr)
-
-
-#define IX_MBUF_POOL_PUT(bufPtr) \
- IX_OSAL_MBUF_POOL_PUT(bufPtr)
-
-
-#define IX_MBUF_POOL_PUT_CHAIN(bufPtr) \
- IX_OSAL_MBUF_POOL_PUT_CHAIN(bufPtr)
-
-
-#define IX_MBUF_POOL_SHOW(poolPtr) \
- IX_OSAL_MBUF_POOL_SHOW(poolPtr)
-
-
-#define IX_MBUF_POOL_MDATA_RESET(bufPtr) \
- IX_OSAL_MBUF_POOL_MDATA_RESET(bufPtr)
-
-#endif /* IX_OSAL_BACKWARD_BUFFER_MGT_H */
diff --git a/cpu/ixp/npe/include/IxOsalBackwardCacheMMU.h b/cpu/ixp/npe/include/IxOsalBackwardCacheMMU.h
deleted file mode 100644
index fe570e6417..0000000000
--- a/cpu/ixp/npe/include/IxOsalBackwardCacheMMU.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * This file is intended to provide backward
- * compatibility for main osService/OSSL
- * APIs.
- *
- * It shall be phased out gradually and users
- * are strongly recommended to use IX_OSAL API.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IX_OSAL_BACKWARD_CACHE_MMU_H
-#define IX_OSAL_BACKWARD_CACHE_MMU_H
-
-#ifdef IX_OSAL_CACHED
-#define IX_ACC_CACHE_ENABLED
-#endif
-
-#define IX_XSCALE_CACHE_LINE_SIZE IX_OSAL_CACHE_LINE_SIZE
-
-#define IX_ACC_DRV_DMA_MALLOC(size) IX_OSAL_CACHE_DMA_MALLOC(size)
-
-#define IX_ACC_DRV_DMA_FREE(ptr,size) IX_OSAL_CACHE_DMA_FREE(ptr)
-
-#define IX_MMU_VIRTUAL_TO_PHYSICAL_TRANSLATION(addr) IX_OSAL_MMU_VIRT_TO_PHYS(addr)
-
-#define IX_MMU_PHYSICAL_TO_VIRTUAL_TRANSLATION(addr) IX_OSAL_MMU_PHYS_TO_VIRT(addr)
-
-#define IX_ACC_DATA_CACHE_INVALIDATE(addr,size) IX_OSAL_CACHE_INVALIDATE(addr, size)
-
-#define IX_ACC_DATA_CACHE_FLUSH(addr,size) IX_OSAL_CACHE_FLUSH(addr,size)
-
-#endif /* IX_OSAL_BACKWARD_CACHE_MMU_H */
diff --git a/cpu/ixp/npe/include/IxOsalBackwardMemMap.h b/cpu/ixp/npe/include/IxOsalBackwardMemMap.h
deleted file mode 100644
index 18f8f24df4..0000000000
--- a/cpu/ixp/npe/include/IxOsalBackwardMemMap.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * This file is intended to provide backward
- * compatibility for main osService/OSSL
- * APIs.
- *
- * It shall be phased out gradually and users
- * are strongly recommended to use IX_OSAL API.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-#ifndef IX_OSAL_BACKWARD_MEM_MAP_H
-#define IX_OSAL_BACKWARD_MEM_MAP_H
-
-#include "IxOsal.h"
-
-#define IX_OSSERV_SWAP_LONG(wData) IX_OSAL_SWAP_LONG(wData)
-#define IX_OSSERV_SWAP_SHORT(sData) IX_OSAL_SWAP_SHORT(sData)
-
-#define IX_OSSERV_SWAP_SHORT_ADDRESS(sAddr) IX_OSAL_SWAP_SHORT_ADDRESS(sAddr)
-#define IX_OSSERV_SWAP_BYTE_ADDRESS(bAddr) IX_OSAL_SWAP_BYTE_ADDRESS(bAddr)
-
-#define IX_OSSERV_BE_XSTOBUSL(wData) IX_OSAL_BE_XSTOBUSL(wData)
-#define IX_OSSERV_BE_XSTOBUSS(sData) IX_OSAL_BE_XSTOBUSS(sData)
-#define IX_OSSERV_BE_XSTOBUSB(bData) IX_OSAL_BE_XSTOBUSB(bData)
-#define IX_OSSERV_BE_BUSTOXSL(wData) IX_OSAL_BE_BUSTOXSL(wData)
-#define IX_OSSERV_BE_BUSTOXSS(sData) IX_OSAL_BE_BUSTOXSS(sData)
-#define IX_OSSERV_BE_BUSTOXSB(bData) IX_OSAL_BE_BUSTOXSB(bData)
-
-#define IX_OSSERV_LE_AC_XSTOBUSL(wAddr) IX_OSAL_LE_AC_XSTOBUSL(wAddr)
-#define IX_OSSERV_LE_AC_XSTOBUSS(sAddr) IX_OSAL_LE_AC_XSTOBUSS(sAddr)
-#define IX_OSSERV_LE_AC_XSTOBUSB(bAddr) IX_OSAL_LE_AC_XSTOBUSB(bAddr)
-#define IX_OSSERV_LE_AC_BUSTOXSL(wAddr) IX_OSAL_LE_AC_BUSTOXSL(wAddr)
-#define IX_OSSERV_LE_AC_BUSTOXSS(sAddr) IX_OSAL_LE_AC_BUSTOXSS(sAddr)
-#define IX_OSSERV_LE_AC_BUSTOXSB(bAddr) IX_OSAL_LE_AC_BUSTOXSB(bAddr)
-
-#define IX_OSSERV_LE_DC_XSTOBUSL(wData) IX_OSAL_LE_DC_XSTOBUSL(wData)
-#define IX_OSSERV_LE_DC_XSTOBUSS(sData) IX_OSAL_LE_DC_XSTOBUSS(sData)
-#define IX_OSSERV_LE_DC_XSTOBUSB(bData) IX_OSAL_LE_DC_XSTOBUSB(bData)
-#define IX_OSSERV_LE_DC_BUSTOXSL(wData) IX_OSAL_LE_DC_BUSTOXSL(wData)
-#define IX_OSSERV_LE_DC_BUSTOXSS(sData) IX_OSAL_LE_DC_BUSTOXSS(sData)
-#define IX_OSSERV_LE_DC_BUSTOXSB(bData) IX_OSAL_LE_DC_BUSTOXSB(bData)
-
-#define IX_OSSERV_READ_LONG(wAddr) IX_OSAL_READ_LONG(wAddr)
-#define IX_OSSERV_READ_SHORT(sAddr) IX_OSAL_READ_SHORT(sAddr)
-#define IX_OSSERV_READ_BYTE(bAddr) IX_OSAL_READ_BYTE(bAddr)
-#define IX_OSSERV_WRITE_LONG(wAddr, wData) IX_OSAL_WRITE_LONG(wAddr, wData)
-#define IX_OSSERV_WRITE_SHORT(sAddr, sData) IX_OSAL_WRITE_SHORT(sAddr, sData)
-#define IX_OSSERV_WRITE_BYTE(bAddr, bData) IX_OSAL_WRITE_BYTE(bAddr, bData)
-
-
-#define IX_OSSERV_READ_NPE_SHARED_LONG(wAddr) IX_OSAL_READ_BE_SHARED_LONG(wAddr)
-#define IX_OSSERV_READ_NPE_SHARED_SHORT(sAddr) IX_OSAL_READ_BE_SHARED_SHORT(sAddr)
-#define IX_OSSERV_WRITE_NPE_SHARED_LONG(wAddr, wData) IX_OSAL_WRITE_BE_SHARED_LONG(wAddr, wData)
-#define IX_OSSERV_WRITE_NPE_SHARED_SHORT(sAddr, sData) IX_OSAL_WRITE_BE_SHARED_SHORT(sAddr, sData)
-
-#define IX_OSSERV_SWAP_NPE_SHARED_LONG(wData) IX_OSAL_SWAP_BE_SHARED_LONG(wData)
-#define IX_OSSERV_SWAP_NPE_SHARED_SHORT(sData) IX_OSAL_SWAP_BE_SHARED_SHORT(sData)
-
-
-/* Map osServ address/size */
-#define IX_OSSERV_QMGR_MAP_SIZE IX_OSAL_IXP400_QMGR_MAP_SIZE
-#define IX_OSSERV_EXP_REG_MAP_SIZE IX_OSAL_IXP400_EXP_REG_MAP_SIZE
-#define IX_OSSERV_UART1_MAP_SIZE IX_OSAL_IXP400_UART1_MAP_SIZE
-#define IX_OSSERV_UART2_MAP_SIZE IX_OSAL_IXP400_UART2_MAP_SIZE
-#define IX_OSSERV_PMU_MAP_SIZE IX_OSAL_IXP400_PMU_MAP_SIZE
-#define IX_OSSERV_OSTS_MAP_SIZE IX_OSAL_IXP400_OSTS_MAP_SIZE
-#define IX_OSSERV_NPEA_MAP_SIZE IX_OSAL_IXP400_NPEA_MAP_SIZE
-#define IX_OSSERV_NPEB_MAP_SIZE IX_OSAL_IXP400_NPEB_MAP_SIZE
-#define IX_OSSERV_NPEC_MAP_SIZE IX_OSAL_IXP400_NPEC_MAP_SIZE
-#define IX_OSSERV_ETHA_MAP_SIZE IX_OSAL_IXP400_ETHA_MAP_SIZE
-#define IX_OSSERV_ETHB_MAP_SIZE IX_OSAL_IXP400_ETHB_MAP_SIZE
-#define IX_OSSERV_USB_MAP_SIZE IX_OSAL_IXP400_USB_MAP_SIZE
-#define IX_OSSERV_GPIO_MAP_SIZE IX_OSAL_IXP400_GPIO_MAP_SIZE
-#define IX_OSSERV_EXP_BUS_MAP_SIZE IX_OSAL_IXP400_EXP_BUS_MAP_SIZE
-#define IX_OSSERV_EXP_BUS_CS0_MAP_SIZE IX_OSAL_IXP400_EXP_BUS_CS0_MAP_SIZE
-#define IX_OSSERV_EXP_BUS_CS1_MAP_SIZE IX_OSAL_IXP400_EXP_BUS_CS1_MAP_SIZE
-#define IX_OSSERV_EXP_BUS_CS4_MAP_SIZE IX_OSAL_IXP400_EXP_BUS_CS4_MAP_SIZE
-
-
-#define IX_OSSERV_GPIO_PHYS_BASE IX_OSAL_IXP400_GPIO_PHYS_BASE
-#define IX_OSSERV_UART1_PHYS_BASE IX_OSAL_IXP400_UART1_PHYS_BASE
-#define IX_OSSERV_UART2_PHYS_BASE IX_OSAL_IXP400_UART2_PHYS_BASE
-#define IX_OSSERV_ETHA_PHYS_BASE IX_OSAL_IXP400_ETHA_PHYS_BASE
-#define IX_OSSERV_ETHB_PHYS_BASE IX_OSAL_IXP400_ETHB_PHYS_BASE
-#define IX_OSSERV_NPEA_PHYS_BASE IX_OSAL_IXP400_NPEA_PHYS_BASE
-#define IX_OSSERV_NPEB_PHYS_BASE IX_OSAL_IXP400_NPEB_PHYS_BASE
-#define IX_OSSERV_NPEC_PHYS_BASE IX_OSAL_IXP400_NPEC_PHYS_BASE
-#define IX_OSSERV_PERIPHERAL_PHYS_BASE IX_OSAL_IXP400_PERIPHERAL_PHYS_BASE
-#define IX_OSSERV_QMGR_PHYS_BASE IX_OSAL_IXP400_QMGR_PHYS_BASE
-#define IX_OSSERV_OSTS_PHYS_BASE IX_OSAL_IXP400_OSTS_PHYS_BASE
-#define IX_OSSERV_USB_PHYS_BASE IX_OSAL_IXP400_USB_PHYS_BASE
-#define IX_OSSERV_EXP_BUS_PHYS_BASE IX_OSAL_IXP400_EXP_BUS_PHYS_BASE
-#define IX_OSSERV_EXP_BUS_BOOT_PHYS_BASE IX_OSAL_IXP400_EXP_BUS_BOOT_PHYS_BASE
-#define IX_OSSERV_EXP_BUS_CS0_PHYS_BASE IX_OSAL_IXP400_EXP_BUS_CS0_PHYS_BASE
-#define IX_OSSERV_EXP_BUS_CS1_PHYS_BASE IX_OSAL_IXP400_EXP_BUS_CS1_PHYS_BASE
-#define IX_OSSERV_EXP_BUS_CS4_PHYS_BASE IX_OSAL_IXP400_EXP_BUS_CS4_PHYS_BASE
-#define IX_OSSERV_EXP_BUS_REGS_PHYS_BASE IX_OSAL_IXP400_EXP_BUS_REGS_PHYS_BASE
-
-#define IX_OSSERV_MEM_MAP(physAddr, size) IX_OSAL_MEM_MAP(physAddr, size)
-
-#define IX_OSSERV_MEM_UNMAP(virtAddr) IX_OSAL_MEM_UNMAP(virtAddr)
-
-#endif /* IX_OSAL_BACKWARD_MEM_MAP_H */
diff --git a/cpu/ixp/npe/include/IxOsalBackwardOsServices.h b/cpu/ixp/npe/include/IxOsalBackwardOsServices.h
deleted file mode 100644
index 0ccff84aee..0000000000
--- a/cpu/ixp/npe/include/IxOsalBackwardOsServices.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * This file is intended to provide backward
- * compatibility for main osService/OSSL
- * APIs.
- *
- * It shall be phased out gradually and users
- * are strongly recommended to use IX_OSAL API.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IX_OSAL_BACKWARD_OSSERVICES_H
-#define IX_OSAL_BACKWARD_OSSERVICES_H
-
-#ifndef __vxworks
-typedef UINT32 IX_IRQ_STATUS;
-#else
-typedef int IX_IRQ_STATUS;
-#endif
-
-typedef IxOsalMutex IxMutex;
-
-typedef IxOsalFastMutex IxFastMutex;
-
-typedef IxOsalVoidFnVoidPtr IxVoidFnVoidPtr;
-
-typedef IxOsalVoidFnPtr IxVoidFnPtr;
-
-
-#define LOG_NONE IX_OSAL_LOG_LVL_NONE
-#define LOG_USER IX_OSAL_LOG_LVL_USER
-#define LOG_FATAL IX_OSAL_LOG_LVL_FATAL
-#define LOG_ERROR IX_OSAL_LOG_LVL_ERROR
-#define LOG_WARNING IX_OSAL_LOG_LVL_WARNING
-#define LOG_MESSAGE IX_OSAL_LOG_LVL_MESSAGE
-#define LOG_DEBUG1 IX_OSAL_LOG_LVL_DEBUG1
-#define LOG_DEBUG2 IX_OSAL_LOG_LVL_DEBUG2
-#define LOG_DEBUG3 IX_OSAL_LOG_LVL_DEBUG3
-#ifndef __vxworks
-#define LOG_ALL IX_OSAL_LOG_LVL_ALL
-#endif
-
-PUBLIC IX_STATUS
-ixOsServIntBind (int level, void (*routine) (void *), void *parameter);
-
-PUBLIC IX_STATUS ixOsServIntUnbind (int level);
-
-
-PUBLIC int ixOsServIntLock (void);
-
-PUBLIC void ixOsServIntUnlock (int lockKey);
-
-
-PUBLIC int ixOsServIntLevelSet (int level);
-
-PUBLIC IX_STATUS ixOsServMutexInit (IxMutex * mutex);
-
-PUBLIC IX_STATUS ixOsServMutexLock (IxMutex * mutex);
-
-PUBLIC IX_STATUS ixOsServMutexUnlock (IxMutex * mutex);
-
-PUBLIC IX_STATUS ixOsServMutexDestroy (IxMutex * mutex);
-
-PUBLIC IX_STATUS ixOsServFastMutexInit (IxFastMutex * mutex);
-
-PUBLIC IX_STATUS ixOsServFastMutexTryLock (IxFastMutex * mutex);
-
-PUBLIC IX_STATUS ixOsServFastMutexUnlock (IxFastMutex * mutex);
-
-PUBLIC int
-ixOsServLog (int level, char *format, int arg1, int arg2, int arg3, int arg4,
- int arg5, int arg6);
-
-
-PUBLIC int ixOsServLogLevelSet (int level);
-
-PUBLIC void ixOsServSleep (int microseconds);
-
-PUBLIC void ixOsServTaskSleep (int milliseconds);
-
-PUBLIC unsigned int ixOsServTimestampGet (void);
-
-
-PUBLIC void ixOsServUnload (void);
-
-PUBLIC void ixOsServYield (void);
-
-#endif
-/* IX_OSAL_BACKWARD_OSSERVICES_H */
diff --git a/cpu/ixp/npe/include/IxOsalBackwardOssl.h b/cpu/ixp/npe/include/IxOsalBackwardOssl.h
deleted file mode 100644
index 634b494aec..0000000000
--- a/cpu/ixp/npe/include/IxOsalBackwardOssl.h
+++ /dev/null
@@ -1,272 +0,0 @@
-/**
- * This file is intended to provide backward
- * compatibility for main osService/OSSL
- * APIs.
- *
- * It shall be phased out gradually and users
- * are strongly recommended to use IX_OSAL API.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IX_OSAL_BACKWARD_OSSL_H
-#define IX_OSAL_BACKWARD_OSSL_H
-
-
-typedef IxOsalThread ix_ossl_thread_t;
-
-typedef IxOsalSemaphore ix_ossl_sem_t;
-
-typedef IxOsalMutex ix_ossl_mutex_t;
-
-typedef IxOsalTimeval ix_ossl_time_t;
-
-
-/* Map sub-fields for ix_ossl_time_t */
-#define tv_sec secs
-#define tv_nec nsecs
-
-
-typedef IX_STATUS ix_error;
-
-typedef UINT32 ix_ossl_thread_priority;
-
-typedef UINT32 ix_uint32;
-
-
-#define IX_OSSL_ERROR_SUCCESS IX_SUCCESS
-
-#define IX_ERROR_SUCCESS IX_SUCCESS
-
-
-typedef enum
-{
- IX_OSSL_SEM_UNAVAILABLE = 0,
- IX_OSSL_SEM_AVAILABLE
-} ix_ossl_sem_state;
-
-
-typedef enum
-{
- IX_OSSL_MUTEX_UNLOCK = 0,
- IX_OSSL_MUTEX_LOCK
-} ix_ossl_mutex_state;
-
-
-typedef IxOsalVoidFnVoidPtr ix_ossl_thread_entry_point_t;
-
-
-#define IX_OSSL_THREAD_PRI_HIGH 90
-#define IX_OSSL_THREAD_PRI_MEDIUM 160
-#define IX_OSSL_THREAD_PRI_LOW 240
-
-
-#define IX_OSSL_WAIT_FOREVER IX_OSAL_WAIT_FOREVER
-
-#define IX_OSSL_WAIT_NONE IX_OSAL_WAIT_NONE
-
-#define BILLION IX_OSAL_BILLION
-
-#define IX_OSSL_TIME_EQ(a,b) IX_OSAL_TIME_EQ(a,b)
-
-#define IX_OSSL_TIME_GT(a,b) IX_OSAL_TIME_GT(a,b)
-
-#define IX_OSSL_TIME_LT(a,b) IX_OSAL_TIME_LT(a,b)
-
-#define IX_OSSL_TIME_ADD(a,b) IX_OSAL_TIME_ADD(a,b)
-
-#define IX_OSSL_TIME_SUB(a,b) IX_OSAL_TIME_SUB(a,b)
-
-
-/* a is tick, b is timeval */
-#define IX_OSSL_TIME_CONVERT_TO_TICK(a,b) \
- (a) = IX_OSAL_TIMEVAL_TO_TICKS(b)
-
-
-
-
-PUBLIC IX_STATUS
-ixOsalOsIxp400BackwardOsslThreadCreate (IxOsalVoidFnVoidPtr entryPoint,
- void *arg, IxOsalThread * ptrThread);
-
-#define ix_ossl_thread_create(entryPoint, arg, ptrTid) \
- ixOsalOsIxp400BackwardOsslThreadCreate(entryPoint, arg, ptrTid)
-
-
-/* void ix_ossl_thread_exit(ix_error retError, void* retObj) */
-#define ix_ossl_thread_exit(retError, retObj) \
- ixOsalThreadExit()
-
-
-PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslThreadKill (IxOsalThread tid);
-
-/* ix_error ix_ossl_thread_kill(tid) */
-#define ix_ossl_thread_kill(tid) \
- ixOsalOsIxp400BackwardOsslThreadKill(tid)
-
-
-PUBLIC IX_STATUS
-ixOsalOsIxp400BackwardOsslThreadSetPriority (IxOsalThread tid,
- UINT32 priority);
-
-
-/*
- * ix_error ix_ossl_thread_set_priority(ix_ossl_thread_t tid,
- * ix_ossl_thread_priority priority
- * );
- */
-
-#define ix_ossl_thread_set_priority(tid, priority) \
- ixOsalOsIxp400BackwardOsslThreadSetPriority(tid, priority)
-
-
-PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslTickGet (int *pticks);
-
-#define ix_ossl_tick_get(pticks) \
- ixOsalOsIxp400BackwardOsslTickGet(pticks)
-
-PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslThreadDelay (int ticks);
-
-#define ix_ossl_thread_delay(ticks) ixOsalOsIxp400BackwardOsslThreadDelay(ticks)
-
-
-
-/* ix_error ix_ossl_sem_init(int start_value, ix_ossl_sem_t* sid); */
-/* Note sid is a pointer to semaphore */
-#define ix_ossl_sem_init(value, sid) \
- ixOsalSemaphoreInit(sid, value)
-
-
-PUBLIC IX_STATUS
-ixOsalOsIxp400BackwardOsslSemaphoreWait (IxOsalSemaphore semaphore,
- INT32 timeout);
-
-
-/*
-ix_error ix_ossl_sem_take(
- ix_ossl_sem_t sid,
- ix_uint32 timeout
- );
-*/
-
-#define ix_ossl_sem_take( sid, timeout) \
- ixOsalOsIxp400BackwardOsslSemaphoreWait(sid, timeout)
-
-
-
-PUBLIC IX_STATUS
-ixOsalOsIxp400BackwardOsslSemaphorePost (IxOsalSemaphore sid);
-
-/*ix_error ix_ossl_sem_give(ix_ossl_sem_t sid); */
-#define ix_ossl_sem_give(sid) \
- ixOsalOsIxp400BackwardOsslSemaphorePost(sid);
-
-
-PUBLIC IX_STATUS ixOsalOsIxp400BackwardSemaphoreDestroy (IxOsalSemaphore sid);
-
-#define ix_ossl_sem_fini(sid) \
- ixOsalOsIxp400BackwardSemaphoreDestroy(sid)
-
-
-PUBLIC IX_STATUS
-ixOsalOsIxp400BackwardOsslMutexInit (ix_ossl_mutex_state start_state,
- IxOsalMutex * pMutex);
-
-
-/* ix_error ix_ossl_mutex_init(ix_ossl_mutex_state start_state, ix_ossl_mutex_t* mid); */
-#define ix_ossl_mutex_init(start_state, pMutex) \
- ixOsalOsIxp400BackwardOsslMutexInit(start_state, pMutex)
-
-
-PUBLIC IX_STATUS
-ixOsalOsIxp400BackwardOsslMutexLock (IxOsalMutex mid, INT32 timeout);
-
-/*
-ix_error ix_ossl_mutex_lock(
- ix_ossl_mutex_t mid,
- ix_uint32 timeout
- );
-*/
-#define ix_ossl_mutex_lock(mid, timeout) \
- ixOsalOsIxp400BackwardOsslMutexLock(mid, timout)
-
-
-PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslMutexUnlock (IxOsalMutex mid);
-
-/* ix_error ix_ossl_mutex_unlock(ix_ossl_mutex_t mid); */
-#define ix_ossl_mutex_unlock(mid) \
- ixOsalOsIxp400BackwardOsslMutexUnlock(mid)
-
-PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslMutexDestroy (IxOsalMutex mid);
-
-#define ix_ossl_mutex_fini(mid) \
- ixOsalOsIxp400BackwardOsslMutexDestroy(mid);
-
-#define ix_ossl_sleep(sleeptime_ms) \
- ixOsalSleep(sleeptime_ms)
-
-PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslSleepTick (UINT32 ticks);
-
-#define ix_ossl_sleep_tick(sleeptime_ticks) \
- ixOsalOsIxp400BackwardOsslSleepTick(sleeptime_ticks)
-
-
-PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslTimeGet (IxOsalTimeval * pTv);
-
-#define ix_ossl_time_get(pTv) \
- ixOsalOsIxp400BackwardOsslTimeGet(pTv)
-
-
-typedef UINT32 ix_ossl_size_t;
-
-#define ix_ossl_malloc(arg_size) \
- ixOsalMemAlloc(arg_size)
-
-#define ix_ossl_free(arg_pMemory) \
- ixOsalMemFree(arg_pMemory)
-
-
-#define ix_ossl_memcpy(arg_pDest, arg_pSrc,arg_Count) \
- ixOsalMemCopy(arg_pDest, arg_pSrc,arg_Count)
-
-#define ix_ossl_memset(arg_pDest, arg_pChar, arg_Count) \
- ixOsalMemSet(arg_pDest, arg_pChar, arg_Count)
-
-
-#endif /* IX_OSAL_BACKWARD_OSSL_H */
diff --git a/cpu/ixp/npe/include/IxOsalBufferMgt.h b/cpu/ixp/npe/include/IxOsalBufferMgt.h
deleted file mode 100644
index 497ed04710..0000000000
--- a/cpu/ixp/npe/include/IxOsalBufferMgt.h
+++ /dev/null
@@ -1,621 +0,0 @@
-/**
- * @file IxOsalBufferMgt.h
- *
- * @brief OSAL Buffer pool management and buffer management definitions.
- *
- * Design Notes:
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-/* @par
- * -- Copyright Notice --
- *
- * @par
- * Copyright 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsalBufferMgt_H
-#define IxOsalBufferMgt_H
-
-#include "IxOsal.h"
-/**
- * @defgroup IxOsalBufferMgt OSAL Buffer Management Module.
- *
- * @brief Buffer management module for IxOsal
- *
- * @{
- */
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_MAX_POOLS
- *
- * @brief The maximum number of pools that can be allocated, must be
- * a multiple of 32 as required by implementation logic.
- * @note This can safely be increased if more pools are required.
- */
-#define IX_OSAL_MBUF_MAX_POOLS 32
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_NAME_LEN
- *
- * @brief The maximum string length of the pool name
- */
-#define IX_OSAL_MBUF_POOL_NAME_LEN 64
-
-
-
-/**
- * Define IX_OSAL_MBUF
- */
-
-
-/* forward declaration of internal structure */
-struct __IXP_BUF;
-
-/*
- * OS can define it in IxOsalOs.h to skip the following
- * definition.
- */
-#ifndef IX_OSAL_ATTRIBUTE_ALIGN32
-#define IX_OSAL_ATTRIBUTE_ALIGN32 __attribute__ ((aligned(32)))
-#endif
-
-/* release v1.4 backward compatible definitions */
-struct __IX_MBUF
-{
- struct __IXP_BUF *ix_next IX_OSAL_ATTRIBUTE_ALIGN32;
- struct __IXP_BUF *ix_nextPacket;
- UINT8 *ix_data;
- UINT32 ix_len;
- unsigned char ix_type;
- unsigned char ix_flags;
- unsigned short ix_reserved;
- UINT32 ix_rsvd;
- UINT32 ix_PktLen;
- void *ix_priv;
-};
-
-struct __IX_CTRL
-{
- UINT32 ix_reserved[2]; /**< Reserved field */
- UINT32 ix_signature; /**< Field to indicate if buffers are allocated by the system */
- UINT32 ix_allocated_len; /**< Allocated buffer length */
- UINT32 ix_allocated_data; /**< Allocated buffer data pointer */
- void *ix_pool; /**< pointer to the buffer pool */
- struct __IXP_BUF *ix_chain; /**< chaining */
- void *ix_osbuf_ptr; /**< Storage for OS-specific buffer pointer */
-};
-
-struct __IX_NE_SHARED
-{
- UINT32 reserved[8] IX_OSAL_ATTRIBUTE_ALIGN32; /**< Reserved area for NPE Service-specific usage */
-};
-
-
-/*
- * IXP buffer structure
- */
-typedef struct __IXP_BUF
-{
- struct __IX_MBUF ix_mbuf IX_OSAL_ATTRIBUTE_ALIGN32; /**< buffer header */
- struct __IX_CTRL ix_ctrl; /**< buffer management */
- struct __IX_NE_SHARED ix_ne; /**< Reserved area for NPE Service-specific usage*/
-} IXP_BUF;
-
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def typedef IX_OSAL_MBUF
- *
- * @brief Generic IXP mbuf format.
- */
-typedef IXP_BUF IX_OSAL_MBUF;
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_IXP_NEXT_BUFFER_IN_PKT_PTR(m_blk_ptr)
- *
- * @brief Return pointer to the next mbuf in a single packet
- */
-#define IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(m_blk_ptr) \
- (m_blk_ptr)->ix_mbuf.ix_next
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m_blk_ptr)
- *
- * @brief Return pointer to the next packet in the chain
- */
-#define IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m_blk_ptr) \
- (m_blk_ptr)->ix_mbuf.ix_nextPacket
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_MDATA(m_blk_ptr)
- *
- * @brief Return pointer to the data in the mbuf
- */
-#define IX_OSAL_MBUF_MDATA(m_blk_ptr) (m_blk_ptr)->ix_mbuf.ix_data
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_MLEN(m_blk_ptr)
- *
- * @brief Return the data length
- */
-#define IX_OSAL_MBUF_MLEN(m_blk_ptr) \
- (m_blk_ptr)->ix_mbuf.ix_len
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_MTYPE(m_blk_ptr)
- *
- * @brief Return the data type in the mbuf
- */
-#define IX_OSAL_MBUF_MTYPE(m_blk_ptr) \
- (m_blk_ptr)->ix_mbuf.ix_type
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_FLAGS(m_blk_ptr)
- *
- * @brief Return the buffer flags
- */
-#define IX_OSAL_MBUF_FLAGS(m_blk_ptr) \
- (m_blk_ptr)->ix_mbuf.ix_flags
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_NET_POOL(m_blk_ptr)
- *
- * @brief Return pointer to a network pool
- */
-#define IX_OSAL_MBUF_NET_POOL(m_blk_ptr) \
- (m_blk_ptr)->ix_ctrl.ix_pool
-
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_PKT_LEN(m_blk_ptr)
- *
- * @brief Return the total length of all the data in
- * the mbuf chain for this packet
- */
-#define IX_OSAL_MBUF_PKT_LEN(m_blk_ptr) \
- (m_blk_ptr)->ix_mbuf.ix_PktLen
-
-
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_PRIV(m_blk_ptr)
- *
- * @brief Return the private field
- */
-#define IX_OSAL_MBUF_PRIV(m_blk_ptr) \
- (m_blk_ptr)->ix_mbuf.ix_priv
-
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_SIGNATURE(m_blk_ptr)
- *
- * @brief Return the signature field of IX_OSAL_MBUF
- */
-#define IX_OSAL_MBUF_SIGNATURE(m_blk_ptr) \
- (m_blk_ptr)->ix_ctrl.ix_signature
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_OSBUF_PTR(m_blk_ptr)
- *
- * @brief Return ix_osbuf_ptr field of IX_OSAL_MBUF, which is used to store OS-specific buffer pointer during a buffer conversion.
- */
-#define IX_OSAL_MBUF_OSBUF_PTR(m_blk_ptr) \
- (m_blk_ptr)->ix_ctrl.ix_osbuf_ptr
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_ALLOCATED_BUFF_LEN(m_blk_ptr)
- *
- * @brief Return the allocated buffer size
- */
-#define IX_OSAL_MBUF_ALLOCATED_BUFF_LEN(m_blk_ptr) \
- (m_blk_ptr)->ix_ctrl.ix_allocated_len
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(m_blk_ptr)
- *
- * @brief Return the allocated buffer pointer
- */
-#define IX_OSAL_MBUF_ALLOCATED_BUFF_DATA(m_blk_ptr) \
- (m_blk_ptr)->ix_ctrl.ix_allocated_data
-
-
-
-/* Name length */
-#define IX_OSAL_MBUF_POOL_NAME_LEN 64
-
-
-/****************************************************
- * Macros for buffer pool management
- ****************************************************/
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_FREE_COUNT(m_pool_ptr
- *
- * @brief Return the total number of freed buffers left in the pool.
- */
-#define IX_OSAL_MBUF_POOL_FREE_COUNT(m_pool_ptr) \
- ixOsalBuffPoolFreeCountGet(m_pool_ptr)
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_SIZE_ALIGN
- *
- * @brief This macro takes an integer as an argument and
- * rounds it up to be a multiple of the memory cache-line
- * size.
- *
- * @param int [in] size - the size integer to be rounded up
- *
- * @return int - the size, rounded up to a multiple of
- * the cache-line size
- */
-#define IX_OSAL_MBUF_POOL_SIZE_ALIGN(size) \
- ((((size) + (IX_OSAL_CACHE_LINE_SIZE - 1)) / \
- IX_OSAL_CACHE_LINE_SIZE) * \
- IX_OSAL_CACHE_LINE_SIZE)
-
-/* Don't use this directly, use macro */
-PUBLIC UINT32 ixOsalBuffPoolMbufAreaSizeGet (int count);
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_MBUF_AREA_SIZE_ALIGNED
- *
- * @brief This macro calculates, from the number of mbufs required, the
- * size of the memory area required to contain the mbuf headers for the
- * buffers in the pool. The size to be used for each mbuf header is
- * rounded up to a multiple of the cache-line size, to ensure
- * each mbuf header aligns on a cache-line boundary.
- * This macro is used by IX_OSAL_MBUF_POOL_MBUF_AREA_ALLOC()
- *
- * @param int [in] count - the number of buffers the pool will contain
- *
- * @return int - the total size required for the pool mbuf area (aligned)
- */
-#define IX_OSAL_MBUF_POOL_MBUF_AREA_SIZE_ALIGNED(count) \
- ixOsalBuffPoolMbufAreaSizeGet(count)
-
-
-/* Don't use this directly, use macro */
-PUBLIC UINT32 ixOsalBuffPoolDataAreaSizeGet (int count, int size);
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_DATA_AREA_SIZE_ALIGNED
- *
- * @brief This macro calculates, from the number of mbufs required and the
- * size of the data portion for each mbuf, the size of the data memory area
- * required. The size is adjusted to ensure alignment on cache line boundaries.
- * This macro is used by IX_OSAL_MBUF_POOL_DATA_AREA_ALLOC()
- *
- *
- * @param int [in] count - The number of mbufs in the pool.
- * @param int [in] size - The desired size for each mbuf data portion.
- * This size will be rounded up to a multiple of the
- * cache-line size to ensure alignment on cache-line
- * boundaries for each data block.
- *
- * @return int - the total size required for the pool data area (aligned)
- */
-#define IX_OSAL_MBUF_POOL_DATA_AREA_SIZE_ALIGNED(count, size) \
- ixOsalBuffPoolDataAreaSizeGet((count), (size))
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_MBUF_AREA_ALLOC
- *
- * @brief Allocates the memory area needed for the number of mbuf headers
- * specified by <i>count</i>.
- * This macro ensures the mbuf headers align on cache line boundaries.
- * This macro evaluates to a pointer to the memory allocated.
- *
- * @param int [in] count - the number of mbufs the pool will contain
- * @param int [out] memAreaSize - the total amount of memory allocated
- *
- * @return void * - a pointer to the allocated memory area
- */
-#define IX_OSAL_MBUF_POOL_MBUF_AREA_ALLOC(count, memAreaSize) \
- IX_OSAL_CACHE_DMA_MALLOC((memAreaSize = \
- IX_OSAL_MBUF_POOL_MBUF_AREA_SIZE_ALIGNED(count)))
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_DATA_AREA_ALLOC
- *
- * @brief Allocates the memory pool for the data portion of the pool mbufs.
- * The number of mbufs is specified by <i>count</i>. The size of the data
- * portion of each mbuf is specified by <i>size</i>.
- * This macro ensures the mbufs are aligned on cache line boundaries
- * This macro evaluates to a pointer to the memory allocated.
- *
- * @param int [in] count - the number of mbufs the pool will contain
- * @param int [in] size - the desired size (in bytes) required for the data
- * portion of each mbuf. Note that this size may be
- * rounded up to ensure alignment on cache-line
- * boundaries.
- * @param int [out] memAreaSize - the total amount of memory allocated
- *
- * @return void * - a pointer to the allocated memory area
- */
-#define IX_OSAL_MBUF_POOL_DATA_AREA_ALLOC(count, size, memAreaSize) \
- IX_OSAL_CACHE_DMA_MALLOC((memAreaSize = \
- IX_OSAL_MBUF_POOL_DATA_AREA_SIZE_ALIGNED(count,size)))
-
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_INIT
- *
- * @brief Wrapper macro for ixOsalPoolInit()
- * See function description below for details.
- */
-#define IX_OSAL_MBUF_POOL_INIT(count, size, name) \
- ixOsalPoolInit((count), (size), (name))
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_NO_ALLOC_POOL_INIT
- *
- * @return Pointer to the new pool or NULL if the initialization failed.
- *
- * @brief Wrapper macro for ixOsalNoAllocPoolInit()
- * See function description below for details.
- *
- */
-#define IX_OSAL_MBUF_NO_ALLOC_POOL_INIT(bufPtr, dataPtr, count, size, name) \
- ixOsalNoAllocPoolInit( (bufPtr), (dataPtr), (count), (size), (name))
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_GET
- *
- * @brief Wrapper macro for ixOsalMbufAlloc()
- * See function description below for details.
- */
-#define IX_OSAL_MBUF_POOL_GET(poolPtr) \
- ixOsalMbufAlloc(poolPtr)
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_PUT
- *
- * @brief Wrapper macro for ixOsalMbufFree()
- * See function description below for details.
- */
-#define IX_OSAL_MBUF_POOL_PUT(bufPtr) \
- ixOsalMbufFree(bufPtr)
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_PUT_CHAIN
- *
- * @brief Wrapper macro for ixOsalMbufChainFree()
- * See function description below for details.
- */
-#define IX_OSAL_MBUF_POOL_PUT_CHAIN(bufPtr) \
- ixOsalMbufChainFree(bufPtr)
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_SHOW
- *
- * @brief Wrapper macro for ixOsalMbufPoolShow()
- * See function description below for details.
- */
-#define IX_OSAL_MBUF_POOL_SHOW(poolPtr) \
- ixOsalMbufPoolShow(poolPtr)
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_MDATA_RESET
- *
- * @brief Wrapper macro for ixOsalMbufDataPtrReset()
- * See function description below for details.
- */
-#define IX_OSAL_MBUF_POOL_MDATA_RESET(bufPtr) \
- ixOsalMbufDataPtrReset(bufPtr)
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_MBUF_POOL_UNINIT
- *
- * @brief Wrapper macro for ixOsalBuffPoolUninit()
- * See function description below for details.
- */
-#define IX_OSAL_MBUF_POOL_UNINIT(m_pool_ptr) \
- ixOsalBuffPoolUninit(m_pool_ptr)
-
-/*
- * Include OS-specific bufferMgt definitions
- */
-#include "IxOsalOsBufferMgt.h"
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_CONVERT_OSBUF_TO_IXPBUF( osBufPtr, ixpBufPtr)
- *
- * @brief Convert pre-allocated os-specific buffer format to OSAL IXP_BUF (IX_OSAL_MBUF) format.
- * It is users' responsibility to provide pre-allocated and valid buffer pointers.
- * @param osBufPtr (in) - a pre-allocated os-specific buffer pointer.
- * @param ixpBufPtr (in)- a pre-allocated OSAL IXP_BUF pointer
- * @return None
- */
-#define IX_OSAL_CONVERT_OSBUF_TO_IXPBUF( osBufPtr, ixpBufPtr) \
- IX_OSAL_OS_CONVERT_OSBUF_TO_IXPBUF( osBufPtr, ixpBufPtr)
-
-
-/**
- * @ingroup IxOsalBufferMgt
- *
- * @def IX_OSAL_CONVERT_IXPBUF_TO_OSBUF( ixpBufPtr, osBufPtr)
- *
- * @brief Convert pre-allocated OSAL IXP_BUF (IX_OSAL_MBUF) format to os-specific buffer pointers.
- * @param ixpBufPtr (in) - OSAL IXP_BUF pointer
- * @param osBufPtr (out) - os-specific buffer pointer.
- * @return None
- */
-
-#define IX_OSAL_CONVERT_IXPBUF_TO_OSBUF( ixpBufPtr, osBufPtr) \
- IX_OSAL_OS_CONVERT_IXPBUF_TO_OSBUF( ixpBufPtr, osBufPtr)
-
-
-PUBLIC IX_OSAL_MBUF_POOL *ixOsalPoolInit (UINT32 count,
- UINT32 size, const char *name);
-
-PUBLIC IX_OSAL_MBUF_POOL *ixOsalNoAllocPoolInit (void *poolBufPtr,
- void *poolDataPtr,
- UINT32 count,
- UINT32 size,
- const char *name);
-
-PUBLIC IX_OSAL_MBUF *ixOsalMbufAlloc (IX_OSAL_MBUF_POOL * pool);
-
-PUBLIC IX_OSAL_MBUF *ixOsalMbufFree (IX_OSAL_MBUF * mbuf);
-
-PUBLIC void ixOsalMbufChainFree (IX_OSAL_MBUF * mbuf);
-
-PUBLIC void ixOsalMbufDataPtrReset (IX_OSAL_MBUF * mbuf);
-
-PUBLIC void ixOsalMbufPoolShow (IX_OSAL_MBUF_POOL * pool);
-
-PUBLIC IX_STATUS ixOsalBuffPoolUninit (IX_OSAL_MBUF_POOL * pool);
-
-PUBLIC UINT32 ixOsalBuffPoolFreeCountGet(IX_OSAL_MBUF_POOL * pool);
-
-
-/**
- * @} IxOsalBufferMgt
- */
-
-
-#endif /* IxOsalBufferMgt_H */
diff --git a/cpu/ixp/npe/include/IxOsalBufferMgtDefault.h b/cpu/ixp/npe/include/IxOsalBufferMgtDefault.h
deleted file mode 100644
index 684b52edb4..0000000000
--- a/cpu/ixp/npe/include/IxOsalBufferMgtDefault.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @file IxOsalBufferMgtDefault.h
- *
- * @brief Default buffer pool management and buffer management
- * definitions.
- *
- * Design Notes:
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IX_OSAL_BUFFER_MGT_DEFAULT_H
-#define IX_OSAL_BUFFER_MGT_DEFAULT_H
-
-/**
- * @enum IxMbufPoolAllocationType
- * @brief Used to indicate how the pool memory was allocated
- */
-
-typedef enum
-{
- IX_OSAL_MBUF_POOL_TYPE_SYS_ALLOC = 0, /**< mbuf pool allocated by the system */
- IX_OSAL_MBUF_POOL_TYPE_USER_ALLOC /**< mbuf pool allocated by the user */
-} IxOsalMbufPoolAllocationType;
-
-
-/**
- * @brief Implementation of buffer pool structure for use with non-VxWorks OS
- */
-
-typedef struct
-{
- IX_OSAL_MBUF *nextFreeBuf; /**< Pointer to the next free mbuf */
- void *mbufMemPtr; /**< Pointer to the mbuf memory area */
- void *dataMemPtr; /**< Pointer to the data memory area */
- int bufDataSize; /**< The size of the data portion of each mbuf */
- int totalBufsInPool; /**< Total number of mbufs in the pool */
- int freeBufsInPool; /**< Number of free mbufs currently in the pool */
- int mbufMemSize; /**< The size of the pool mbuf memory area */
- int dataMemSize; /**< The size of the pool data memory area */
- char name[IX_OSAL_MBUF_POOL_NAME_LEN + 1]; /**< Descriptive name for pool */
- IxOsalMbufPoolAllocationType poolAllocType;
- unsigned int poolIdx; /**< Pool Index */
-} IxOsalMbufPool;
-
-typedef IxOsalMbufPool IX_OSAL_MBUF_POOL;
-
-
-PUBLIC IX_STATUS ixOsalBuffPoolUninit (IX_OSAL_MBUF_POOL * pool);
-
-
-#endif /* IX_OSAL_BUFFER_MGT_DEFAULT_H */
diff --git a/cpu/ixp/npe/include/IxOsalConfig.h b/cpu/ixp/npe/include/IxOsalConfig.h
deleted file mode 100644
index d56e796393..0000000000
--- a/cpu/ixp/npe/include/IxOsalConfig.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * @file IxOsalConfig.h
- *
- * @brief OSAL Configuration header file
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/*
- * This file contains user-editable fields for modules inclusion.
- */
-#ifndef IxOsalConfig_H
-#define IxOsalConfig_H
-
-
-/*
- * Note: in the future these config options may
- * become build time decision.
- */
-
-/* Choose cache */
-#define IX_OSAL_CACHED
-/* #define IX_OSAL_UNCACHED */
-
-
-/*
- * Select the module headers to include
- */
-#include "IxOsalIoMem.h" /* I/O Memory Management module API */
-#include "IxOsalBufferMgt.h" /* Buffer Management module API */
-
-/*
- * Select main platform header file to use
- */
-#include "IxOsalOem.h"
-
-
-
-#endif /* IxOsalConfig_H */
diff --git a/cpu/ixp/npe/include/IxOsalEndianess.h b/cpu/ixp/npe/include/IxOsalEndianess.h
deleted file mode 100644
index 3b1c739474..0000000000
--- a/cpu/ixp/npe/include/IxOsalEndianess.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * @file IxOsalEndianess.h (Obsolete file)
- *
- * @brief Header file for determining system endianess and OS
- *
- * @par
- * @version $Revision: 1.1
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-#ifndef IxOsalEndianess_H
-#define IxOsalEndianess_H
-
-#if defined (__vxworks) || defined (__linux)
-
-/* get ntohl/ntohs/htohl/htons macros and CPU definitions for VxWorks */
-/* #include <netinet/in.h> */
-
-#elif defined (__wince)
-
-/* get ntohl/ntohs/htohl/htons macros definitions for WinCE */
-#include <Winsock2.h>
-
-#else
-
-#error Unknown OS, please add a section with the include file for htonl/htons/ntohl/ntohs
-
-#endif /* vxworks or linux or wince */
-
-/* Compiler specific endianness selector - WARNING this works only with arm gcc, use appropriate defines with diab */
-
-#ifndef __wince
-
-#if defined (__ARMEL__)
-
-#ifndef __LITTLE_ENDIAN
-
-#define __LITTLE_ENDIAN
-
-#endif /* _LITTLE_ENDIAN */
-
-#elif defined (__ARMEB__) || CPU == SIMSPARCSOLARIS
-
-#ifndef __BIG_ENDIAN
-
-#define __BIG_ENDIAN
-
-#endif /* __BIG_ENDIAN */
-
-#else
-
-#error Error, could not identify target endianness
-
-#endif /* endianness selector no WinCE OSes */
-
-#else /* ndef __wince */
-
-#define __LITTLE_ENDIAN
-
-#endif /* def __wince */
-
-
-/* OS mode selector */
-#if defined (__vxworks) && defined (__LITTLE_ENDIAN)
-
-#define IX_OSAL_VXWORKS_LE
-
-#elif defined (__vxworks) && defined (__BIG_ENDIAN)
-
-#define IX_OSAL_VXWORKS_BE
-
-#elif defined (__linux) && defined (__BIG_ENDIAN)
-
-#define IX_OSAL_LINUX_BE
-
-#elif defined (__linux) && defined (__LITTLE_ENDIAN)
-
-#define IX_OSAL_LINUX_LE
-
-#elif defined (BOOTLOADER_BLD) && defined (__LITTLE_ENDIAN)
-
-#define IX_OSAL_EBOOT_LE
-
-#elif defined (__wince) && defined (__LITTLE_ENDIAN)
-
-#define IX_OSAL_WINCE_LE
-
-#else
-
-#error Unknown OS/Endianess combination - only vxWorks BE LE, Linux BE LE, WinCE BE LE are supported
-
-#endif /* mode selector */
-
-
-
-#endif /* IxOsalEndianess_H */
diff --git a/cpu/ixp/npe/include/IxOsalIoMem.h b/cpu/ixp/npe/include/IxOsalIoMem.h
deleted file mode 100644
index ac0ce65703..0000000000
--- a/cpu/ixp/npe/include/IxOsalIoMem.h
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * @file IxOsalIoMem.h
- * @author Intel Corporation
- * @date 25-08-2004
- *
- * @brief description goes here
- */
-
-/**
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsalIoMem_H
-#define IxOsalIoMem_H
-
-
-/*
- * Decide OS and Endianess, such as IX_OSAL_VXWORKS_LE.
- */
-#include "IxOsalEndianess.h"
-
-/**
- * @defgroup IxOsalIoMem Osal IoMem module
- *
- * @brief I/O memory and endianess support.
- *
- * @{
- */
-
-/* Low-level conversion macros - DO NOT USE UNLESS ABSOLUTELY NEEDED */
-#ifndef __wince
-
-
-/*
- * Private function to swap word
- */
-#ifdef __XSCALE__
-static __inline__ UINT32
-ixOsalCoreWordSwap (UINT32 wordIn)
-{
- /*
- * Storage for the swapped word
- */
- UINT32 wordOut;
-
- /*
- * wordIn = A, B, C, D
- */
- __asm__ (" eor r1, %1, %1, ror #16;" /* R1 = A^C, B^D, C^A, D^B */
- " bic r1, r1, #0x00ff0000;" /* R1 = A^C, 0 , C^A, D^B */
- " mov %0, %1, ror #8;" /* wordOut = D, A, B, C */
- " eor %0, %0, r1, lsr #8;" /* wordOut = D, C, B, A */
- : "=r" (wordOut): "r" (wordIn):"r1");
-
- return wordOut;
-}
-
-#define IX_OSAL_SWAP_LONG(wData) (ixOsalCoreWordSwap(wData))
-#else
-#define IX_OSAL_SWAP_LONG(wData) ((wData >> 24) | (((wData >> 16) & 0xFF) << 8) | (((wData >> 8) & 0xFF) << 16) | ((wData & 0xFF) << 24))
-#endif
-
-#else /* ndef __wince */
-#define IX_OSAL_SWAP_LONG(wData) ((((UINT32)wData << 24) | ((UINT32)wData >> 24)) | (((wData << 8) & 0xff0000) | ((wData >> 8) & 0xff00)))
-#endif /* ndef __wince */
-
-#define IX_OSAL_SWAP_SHORT(sData) ((sData >> 8) | ((sData & 0xFF) << 8))
-#define IX_OSAL_SWAP_SHORT_ADDRESS(sAddr) ((sAddr) ^ 0x2)
-#define IX_OSAL_SWAP_BYTE_ADDRESS(bAddr) ((bAddr) ^ 0x3)
-
-#define IX_OSAL_BE_XSTOBUSL(wData) (wData)
-#define IX_OSAL_BE_XSTOBUSS(sData) (sData)
-#define IX_OSAL_BE_XSTOBUSB(bData) (bData)
-#define IX_OSAL_BE_BUSTOXSL(wData) (wData)
-#define IX_OSAL_BE_BUSTOXSS(sData) (sData)
-#define IX_OSAL_BE_BUSTOXSB(bData) (bData)
-
-#define IX_OSAL_LE_AC_XSTOBUSL(wAddr) (wAddr)
-#define IX_OSAL_LE_AC_XSTOBUSS(sAddr) IX_OSAL_SWAP_SHORT_ADDRESS(sAddr)
-#define IX_OSAL_LE_AC_XSTOBUSB(bAddr) IX_OSAL_SWAP_BYTE_ADDRESS(bAddr)
-#define IX_OSAL_LE_AC_BUSTOXSL(wAddr) (wAddr)
-#define IX_OSAL_LE_AC_BUSTOXSS(sAddr) IX_OSAL_SWAP_SHORT_ADDRESS(sAddr)
-#define IX_OSAL_LE_AC_BUSTOXSB(bAddr) IX_OSAL_SWAP_BYTE_ADDRESS(bAddr)
-
-#define IX_OSAL_LE_DC_XSTOBUSL(wData) IX_OSAL_SWAP_LONG(wData)
-#define IX_OSAL_LE_DC_XSTOBUSS(sData) IX_OSAL_SWAP_SHORT(sData)
-#define IX_OSAL_LE_DC_XSTOBUSB(bData) (bData)
-#define IX_OSAL_LE_DC_BUSTOXSL(wData) IX_OSAL_SWAP_LONG(wData)
-#define IX_OSAL_LE_DC_BUSTOXSS(sData) IX_OSAL_SWAP_SHORT(sData)
-#define IX_OSAL_LE_DC_BUSTOXSB(bData) (bData)
-
-
-/*
- * Decide SDRAM mapping, then implement read/write
- */
-#include "IxOsalMemAccess.h"
-
-
-/**
- * @ingroup IxOsalIoMem
- * @enum IxOsalMapEntryType
- * @brief This is an emum for OSAL I/O mem map type.
- */
-typedef enum
-{
- IX_OSAL_STATIC_MAP = 0, /**<Set map entry type to static map */
- IX_OSAL_DYNAMIC_MAP /**<Set map entry type to dynamic map */
-} IxOsalMapEntryType;
-
-
-/**
- * @ingroup IxOsalIoMem
- * @enum IxOsalMapEndianessType
- * @brief This is an emum for OSAL I/O mem Endianess and Coherency mode.
- */
-typedef enum
-{
- IX_OSAL_BE = 0x1, /**<Set map endian mode to Big Endian */
- IX_OSAL_LE_AC = 0x2, /**<Set map endian mode to Little Endian, Address Coherent */
- IX_OSAL_LE_DC = 0x4, /**<Set map endian mode to Little Endian, Data Coherent */
- IX_OSAL_LE = 0x8 /**<Set map endian mode to Little Endian without specifying coherency mode */
-} IxOsalMapEndianessType;
-
-
-/**
- * @struct IxOsalMemoryMap
- * @brief IxOsalMemoryMap structure
- */
-typedef struct _IxOsalMemoryMap
-{
- IxOsalMapEntryType type; /**< map type - IX_OSAL_STATIC_MAP or IX_OSAL_DYNAMIC_MAP */
-
- UINT32 physicalAddress; /**< physical address of the memory mapped I/O zone */
-
- UINT32 size; /**< size of the map */
-
- UINT32 virtualAddress; /**< virtual address of the zone; must be predefined
- in the global memory map for static maps and has
- to be NULL for dynamic maps (populated on allocation)
- */
- /*
- * pointer to a map function called to map a dynamic map;
- * will populate the virtualAddress field
- */
- void (*mapFunction) (struct _IxOsalMemoryMap * map); /**< pointer to a map function called to map a dynamic map */
-
- /*
- * pointer to a map function called to unmap a dynamic map;
- * will reset the virtualAddress field to NULL
- */
- void (*unmapFunction) (struct _IxOsalMemoryMap * map); /**< pointer to a map function called to unmap a dynamic map */
-
- /*
- * reference count describing how many components share this map;
- * actual allocation/deallocation for dynamic maps is done only
- * between 0 <=> 1 transitions of the counter
- */
- UINT32 refCount; /**< reference count describing how many components share this map */
-
- /*
- * memory endian type for the map; can be a combination of IX_OSAL_BE (Big
- * Endian) and IX_OSAL_LE or IX_OSAL_LE_AC or IX_OSAL_LE_DC
- * (Little Endian, Address Coherent or Data Coherent). Any combination is
- * allowed provided it contains at most one LE flag - e.g.
- * (IX_OSAL_BE), (IX_OSAL_LE_AC), (IX_OSAL_BE | IX_OSAL_LE_DC) are valid
- * combinations while (IX_OSAL_BE | IX_OSAL_LE_DC | IX_OSAL_LE_AC) is not.
- */
- IxOsalMapEndianessType mapEndianType; /**< memory endian type for the map */
-
- char *name; /**< user-friendly name */
-} IxOsalMemoryMap;
-
-
-
-
-/* Internal function to map a memory zone
- * NOTE - This should not be called by the user.
- * Use the macro IX_OSAL_MEM_MAP instead
- */
-PUBLIC void *ixOsalIoMemMap (UINT32 requestedAddress,
- UINT32 size,
- IxOsalMapEndianessType requestedCoherency);
-
-
-/* Internal function to unmap a memory zone mapped with ixOsalIoMemMap
- * NOTE - This should not be called by the user.
- * Use the macro IX_OSAL_MEM_UNMAP instead
- */
-PUBLIC void ixOsalIoMemUnmap (UINT32 requestedAddress, UINT32 coherency);
-
-
-/* Internal function to convert virtual address to physical address
- * NOTE - This should not be called by the user.
- * Use the macro IX_OSAL_MMAP_VIRT_TO_PHYS */
-PUBLIC UINT32 ixOsalIoMemVirtToPhys (UINT32 virtualAddress, UINT32 coherency);
-
-
-/* Internal function to convert physical address to virtual address
- * NOTE - This should not be called by the user.
- * Use the macro IX_OSAL_MMAP_PHYS_TO_VIRT */
-PUBLIC UINT32
-ixOsalIoMemPhysToVirt (UINT32 physicalAddress, UINT32 coherency);
-
-/**
- * @ingroup IxOsalIoMem
- *
- * @def IX_OSAL_MEM_MAP(physAddr, size)
- *
- * @brief Map an I/O mapped physical memory zone to virtual zone and return virtual
- * pointer.
- * @param physAddr - the physical address
- * @param size - the size
- * @return start address of the virtual memory zone.
- *
- * @note This function maps an I/O mapped physical memory zone of the given size
- * into a virtual memory zone accessible by the caller and returns a cookie -
- * the start address of the virtual memory zone.
- * IX_OSAL_MMAP_PHYS_TO_VIRT should NOT therefore be used on the returned
- * virtual address.
- * The memory zone is to be unmapped using IX_OSAL_MEM_UNMAP once the caller has
- * finished using this zone (e.g. on driver unload) using the cookie as
- * parameter.
- * The IX_OSAL_READ/WRITE_LONG/SHORT macros should be used to read and write
- * the mapped memory, adding the necessary offsets to the address cookie.
- */
-#define IX_OSAL_MEM_MAP(physAddr, size) \
- ixOsalIoMemMap((physAddr), (size), IX_OSAL_COMPONENT_MAPPING)
-
-
-/**
- * @ingroup IxOsalIoMem
- *
- * @def IX_OSAL_MEM_UNMAP(virtAddr)
- *
- * @brief Unmap a previously mapped I/O memory zone using virtual pointer obtained
- * during the mapping operation.
- * pointer.
- * @param virtAddr - the virtual pointer to the zone to be unmapped.
- * @return none
- *
- * @note This function unmaps a previously mapped I/O memory zone using
- * the cookie obtained in the mapping operation. The memory zone in question
- * becomes unavailable to the caller once unmapped and the cookie should be
- * discarded.
- *
- * This function cannot fail if the given parameter is correct and does not
- * return a value.
- */
-#define IX_OSAL_MEM_UNMAP(virtAddr) \
- ixOsalIoMemUnmap ((virtAddr), IX_OSAL_COMPONENT_MAPPING)
-
-/**
- * @ingroup IxOsalIoMem
- *
- * @def IX_OSAL_MMAP_VIRT_TO_PHYS(virtAddr)
- *
- * @brief This function Converts a virtual address into a physical
- * address, including the dynamically mapped memory.
- *
- * @param virtAddr - virtual address to convert
- * Return value: corresponding physical address, or NULL
- */
-#define IX_OSAL_MMAP_VIRT_TO_PHYS(virtAddr) \
- ixOsalIoMemVirtToPhys(virtAddr, IX_OSAL_COMPONENT_MAPPING)
-
-
-/**
- * @ingroup IxOsalIoMem
- *
- * @def IX_OSAL_MMAP_PHYS_TO_VIRT(physAddr)
- *
- * @brief This function Converts a virtual address into a physical
- * address, including the dynamically mapped memory.
- *
- * @param physAddr - physical address to convert
- * Return value: corresponding virtual address, or NULL
- *
- */
-#define IX_OSAL_MMAP_PHYS_TO_VIRT(physAddr) \
- ixOsalIoMemPhysToVirt(physAddr, IX_OSAL_COMPONENT_MAPPING)
-
-/**
- * @} IxOsalIoMem
- */
-
-#endif /* IxOsalIoMem_H */
diff --git a/cpu/ixp/npe/include/IxOsalMemAccess.h b/cpu/ixp/npe/include/IxOsalMemAccess.h
deleted file mode 100644
index 13565e44d8..0000000000
--- a/cpu/ixp/npe/include/IxOsalMemAccess.h
+++ /dev/null
@@ -1,459 +0,0 @@
-/**
- * @file IxOsalMemAccess.h
- *
- * @brief Header file for memory access
- *
- * @par
- * @version $Revision: 1.0 $
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsalMemAccess_H
-#define IxOsalMemAccess_H
-
-
-/* Global BE switch
- *
- * Should be set only in BE mode and only if the component uses I/O memory.
- */
-
-#if defined (__BIG_ENDIAN)
-
-#define IX_OSAL_BE_MAPPING
-
-#endif /* Global switch */
-
-
-/* By default only static memory maps in use;
- define IX_OSAL_DYNAMIC_MEMORY_MAP per component if dynamic maps are
- used instead in that component */
-#define IX_OSAL_STATIC_MEMORY_MAP
-
-
-/*
- * SDRAM coherency mode
- * Must be defined to BE, LE_DATA_COHERENT or LE_ADDRESS_COHERENT.
- * The mode changes depending on OS
- */
-#if defined (IX_OSAL_LINUX_BE) || defined (IX_OSAL_VXWORKS_BE)
-
-#define IX_SDRAM_BE
-
-#elif defined (IX_OSAL_VXWORKS_LE)
-
-#define IX_SDRAM_LE_DATA_COHERENT
-
-#elif defined (IX_OSAL_LINUX_LE)
-
-#define IX_SDRAM_LE_DATA_COHERENT
-
-#elif defined (IX_OSAL_WINCE_LE)
-
-#define IX_SDRAM_LE_DATA_COHERENT
-
-#elif defined (IX_OSAL_EBOOT_LE)
-
-#define IX_SDRAM_LE_ADDRESS_COHERENT
-
-#endif
-
-
-
-
-/**************************************
- * Retrieve current component mapping *
- **************************************/
-
-/*
- * Only use customized mapping for LE.
- *
- */
-#if defined (IX_OSAL_VXWORKS_LE) || defined (IX_OSAL_LINUX_LE) || defined (IX_OSAL_WINCE_LE) || defined (IX_OSAL_EBOOT_LE)
-
-#include "IxOsalOsIxp400CustomizedMapping.h"
-
-#endif
-
-
-/*******************************************************************
- * Turn off IX_STATIC_MEMORY map for components using dynamic maps *
- *******************************************************************/
-#ifdef IX_OSAL_DYNAMIC_MEMORY_MAP
-
-#undef IX_OSAL_STATIC_MEMORY_MAP
-
-#endif
-
-
-/************************************************************
- * Turn off BE access for components using LE or no mapping *
- ************************************************************/
-
-#if ( defined (IX_OSAL_LE_AC_MAPPING) || defined (IX_OSAL_LE_DC_MAPPING) || defined (IX_OSAL_NO_MAPPING) )
-
-#undef IX_OSAL_BE_MAPPING
-
-#endif
-
-
-/*****************
- * Safety checks *
- *****************/
-
-/* Default to no_mapping */
-#if !defined (IX_OSAL_BE_MAPPING) && !defined (IX_OSAL_LE_AC_MAPPING) && !defined (IX_OSAL_LE_DC_MAPPING) && !defined (IX_OSAL_NO_MAPPING)
-
-#define IX_OSAL_NO_MAPPING
-
-#endif /* check at least one mapping */
-
-/* No more than one mapping can be defined for a component */
-#if (defined (IX_OSAL_BE_MAPPING) && defined (IX_OSAL_LE_AC_MAPPING)) \
- ||(defined (IX_OSAL_BE_MAPPING) && defined (IX_OSAL_LE_DC_MAPPING)) \
- ||(defined (IX_OSAL_BE_MAPPING) && defined (IX_OSAL_NO_MAPPING)) \
- ||(defined (IX_OSAL_LE_DC_MAPPING) && defined (IX_OSAL_NO_MAPPING)) \
- ||(defined (IX_OSAL_LE_DC_MAPPING) && defined (IX_OSAL_LE_AC_MAPPING)) \
- ||(defined (IX_OSAL_LE_AC_MAPPING) && defined (IX_OSAL_NO_MAPPING))
-
-
-#ifdef IX_OSAL_BE_MAPPING
-#warning IX_OSAL_BE_MAPPING is defined
-#endif
-
-#ifdef IX_OSAL_LE_AC_MAPPING
-#warning IX_OSAL_LE_AC_MAPPING is defined
-#endif
-
-#ifdef IX_OSAL_LE_DC_MAPPING
-#warning IX_OSAL_LE_DC_MAPPING is defined
-#endif
-
-#ifdef IX_OSAL_NO_MAPPING
-#warning IX_OSAL_NO_MAPPING is defined
-#endif
-
-#error More than one I/O mapping is defined, please check your component mapping
-
-#endif /* check at most one mapping */
-
-
-/* Now set IX_OSAL_COMPONENT_MAPPING */
-
-#ifdef IX_OSAL_BE_MAPPING
-#define IX_OSAL_COMPONENT_MAPPING IX_OSAL_BE
-#endif
-
-#ifdef IX_OSAL_LE_AC_MAPPING
-#define IX_OSAL_COMPONENT_MAPPING IX_OSAL_LE_AC
-#endif
-
-#ifdef IX_OSAL_LE_DC_MAPPING
-#define IX_OSAL_COMPONENT_MAPPING IX_OSAL_LE_DC
-#endif
-
-#ifdef IX_OSAL_NO_MAPPING
-#define IX_OSAL_COMPONENT_MAPPING IX_OSAL_LE
-#endif
-
-
-/* SDRAM coherency should be defined */
-#if !defined (IX_SDRAM_BE) && !defined (IX_SDRAM_LE_DATA_COHERENT) && !defined (IX_SDRAM_LE_ADDRESS_COHERENT)
-
-#error SDRAM coherency must be defined
-
-#endif /* SDRAM coherency must be defined */
-
-/* SDRAM coherency cannot be defined in several ways */
-#if (defined (IX_SDRAM_BE) && (defined (IX_SDRAM_LE_DATA_COHERENT) || defined (IX_SDRAM_LE_ADDRESS_COHERENT))) \
- || (defined (IX_SDRAM_LE_DATA_COHERENT) && (defined (IX_SDRAM_BE) || defined (IX_SDRAM_LE_ADDRESS_COHERENT))) \
- || (defined (IX_SDRAM_LE_ADDRESS_COHERENT) && (defined (IX_SDRAM_BE) || defined (IX_SDRAM_LE_DATA_COHERENT)))
-
-#error SDRAM coherency cannot be defined in more than one way
-
-#endif /* SDRAM coherency must be defined exactly once */
-
-
-/*********************
- * Read/write macros *
- *********************/
-
-/* WARNING - except for addition of special cookie read/write macros (see below)
- these macros are NOT user serviceable. Please do not modify */
-
-#define IX_OSAL_READ_LONG_RAW(wAddr) (*(wAddr))
-#define IX_OSAL_READ_SHORT_RAW(sAddr) (*(sAddr))
-#define IX_OSAL_READ_BYTE_RAW(bAddr) (*(bAddr))
-#define IX_OSAL_WRITE_LONG_RAW(wAddr, wData) (*(wAddr) = (wData))
-#define IX_OSAL_WRITE_SHORT_RAW(sAddr,sData) (*(sAddr) = (sData))
-#define IX_OSAL_WRITE_BYTE_RAW(bAddr, bData) (*(bAddr) = (bData))
-
-#ifdef __linux
-
-/* Linux - specific cookie reads/writes.
- Redefine per OS if dynamic memory maps are used
- and I/O memory is accessed via functions instead of raw pointer access. */
-
-#define IX_OSAL_READ_LONG_COOKIE(wCookie) (readl((UINT32) (wCookie) ))
-#define IX_OSAL_READ_SHORT_COOKIE(sCookie) (readw((UINT32) (sCookie) ))
-#define IX_OSAL_READ_BYTE_COOKIE(bCookie) (readb((UINT32) (bCookie) ))
-#define IX_OSAL_WRITE_LONG_COOKIE(wCookie, wData) (writel(wData, (UINT32) (wCookie) ))
-#define IX_OSAL_WRITE_SHORT_COOKIE(sCookie, sData) (writew(sData, (UINT32) (sCookie) ))
-#define IX_OSAL_WRITE_BYTE_COOKIE(bCookie, bData) (writeb(bData, (UINT32) (bCookie) ))
-
-#endif /* linux */
-
-#ifdef __wince
-
-/* WinCE - specific cookie reads/writes. */
-
-static __inline__ UINT32
-ixOsalWinCEReadLCookie (volatile UINT32 * lCookie)
-{
- return *lCookie;
-}
-
-static __inline__ UINT16
-ixOsalWinCEReadWCookie (volatile UINT16 * wCookie)
-{
- return *wCookie;
-}
-
-static __inline__ UINT8
-ixOsalWinCEReadBCookie (volatile UINT8 * bCookie)
-{
- return *bCookie;
-}
-
-static __inline__ void
-ixOsalWinCEWriteLCookie (volatile UINT32 * lCookie, UINT32 lVal)
-{
- *lCookie = lVal;
-}
-
-static __inline__ void
-ixOsalWinCEWriteWCookie (volatile UINT16 * wCookie, UINT16 wVal)
-{
- *wCookie = wVal;
-}
-
-static __inline__ void
-ixOsalWinCEWriteBCookie (volatile UINT8 * bCookie, UINT8 bVal)
-{
- *bCookie = bVal;
-}
-
-
-#define IX_OSAL_READ_LONG_COOKIE(wCookie) (ixOsalWinCEReadLCookie(wCookie))
-#define IX_OSAL_READ_SHORT_COOKIE(sCookie) (ixOsalWinCEReadWCookie(sCookie))
-#define IX_OSAL_READ_BYTE_COOKIE(bCookie) (ixOsalWinCEReadBCookie(bCookie))
-#define IX_OSAL_WRITE_LONG_COOKIE(wCookie, wData) (ixOsalWinCEWriteLCookie(wCookie, wData))
-#define IX_OSAL_WRITE_SHORT_COOKIE(sCookie, sData) (ixOsalWinCEWriteWCookie(sCookie, sData))
-#define IX_OSAL_WRITE_BYTE_COOKIE(bCookie, bData) (ixOsalWinCEWriteBCookie(bCookie, bData))
-
-#endif /* wince */
-
-#if defined (__vxworks) || (defined (__linux) && defined (IX_OSAL_STATIC_MEMORY_MAP)) || \
- (defined (__wince) && defined (IX_OSAL_STATIC_MEMORY_MAP))
-
-#define IX_OSAL_READ_LONG_IO(wAddr) IX_OSAL_READ_LONG_RAW(wAddr)
-#define IX_OSAL_READ_SHORT_IO(sAddr) IX_OSAL_READ_SHORT_RAW(sAddr)
-#define IX_OSAL_READ_BYTE_IO(bAddr) IX_OSAL_READ_BYTE_RAW(bAddr)
-#define IX_OSAL_WRITE_LONG_IO(wAddr, wData) IX_OSAL_WRITE_LONG_RAW(wAddr, wData)
-#define IX_OSAL_WRITE_SHORT_IO(sAddr, sData) IX_OSAL_WRITE_SHORT_RAW(sAddr, sData)
-#define IX_OSAL_WRITE_BYTE_IO(bAddr, bData) IX_OSAL_WRITE_BYTE_RAW(bAddr, bData)
-
-#elif (defined (__linux) && !defined (IX_OSAL_STATIC_MEMORY_MAP)) || \
- (defined (__wince) && !defined (IX_OSAL_STATIC_MEMORY_MAP))
-
-#ifndef __wince
-#include <asm/io.h>
-#endif /* ndef __wince */
-
-#define IX_OSAL_READ_LONG_IO(wAddr) IX_OSAL_READ_LONG_COOKIE(wAddr)
-#define IX_OSAL_READ_SHORT_IO(sAddr) IX_OSAL_READ_SHORT_COOKIE(sAddr)
-#define IX_OSAL_READ_BYTE_IO(bAddr) IX_OSAL_READ_BYTE_COOKIE(bAddr)
-#define IX_OSAL_WRITE_LONG_IO(wAddr, wData) IX_OSAL_WRITE_LONG_COOKIE(wAddr, wData)
-#define IX_OSAL_WRITE_SHORT_IO(sAddr, sData) IX_OSAL_WRITE_SHORT_COOKIE(sAddr, sData)
-#define IX_OSAL_WRITE_BYTE_IO(bAddr, bData) IX_OSAL_WRITE_BYTE_COOKIE(bAddr, bData)
-
-#endif
-
-/* Define BE macros */
-#define IX_OSAL_READ_LONG_BE(wAddr) IX_OSAL_BE_BUSTOXSL(IX_OSAL_READ_LONG_IO((volatile UINT32 *) (wAddr) ))
-#define IX_OSAL_READ_SHORT_BE(sAddr) IX_OSAL_BE_BUSTOXSS(IX_OSAL_READ_SHORT_IO((volatile UINT16 *) (sAddr) ))
-#define IX_OSAL_READ_BYTE_BE(bAddr) IX_OSAL_BE_BUSTOXSB(IX_OSAL_READ_BYTE_IO((volatile UINT8 *) (bAddr) ))
-#define IX_OSAL_WRITE_LONG_BE(wAddr, wData) IX_OSAL_WRITE_LONG_IO((volatile UINT32 *) (wAddr), IX_OSAL_BE_XSTOBUSL((UINT32) (wData) ))
-#define IX_OSAL_WRITE_SHORT_BE(sAddr, sData) IX_OSAL_WRITE_SHORT_IO((volatile UINT16 *) (sAddr), IX_OSAL_BE_XSTOBUSS((UINT16) (sData) ))
-#define IX_OSAL_WRITE_BYTE_BE(bAddr, bData) IX_OSAL_WRITE_BYTE_IO((volatile UINT8 *) (bAddr), IX_OSAL_BE_XSTOBUSB((UINT8) (bData) ))
-
-/* Define LE AC macros */
-#define IX_OSAL_READ_LONG_LE_AC(wAddr) IX_OSAL_READ_LONG_IO((volatile UINT32 *) IX_OSAL_LE_AC_BUSTOXSL((UINT32) (wAddr) ))
-#define IX_OSAL_READ_SHORT_LE_AC(sAddr) IX_OSAL_READ_SHORT_IO((volatile UINT16 *) IX_OSAL_LE_AC_BUSTOXSS((UINT32) (sAddr) ))
-#define IX_OSAL_READ_BYTE_LE_AC(bAddr) IX_OSAL_READ_BYTE_IO((volatile UINT8 *) IX_OSAL_LE_AC_BUSTOXSB((UINT32) (bAddr) ))
-#define IX_OSAL_WRITE_LONG_LE_AC(wAddr, wData) IX_OSAL_WRITE_LONG_IO((volatile UINT32 *) IX_OSAL_LE_AC_XSTOBUSL((UINT32) (wAddr) ), (UINT32) (wData))
-#define IX_OSAL_WRITE_SHORT_LE_AC(sAddr, sData) IX_OSAL_WRITE_SHORT_IO((volatile UINT16 *) IX_OSAL_LE_AC_XSTOBUSS((UINT32) (sAddr) ), (UINT16) (sData))
-#define IX_OSAL_WRITE_BYTE_LE_AC(bAddr, bData) IX_OSAL_WRITE_BYTE_IO((volatile UINT8 *) IX_OSAL_LE_AC_XSTOBUSB((UINT32) (bAddr) ), (UINT8) (bData))
-
-
-/* Inline functions are required here to avoid reading the same I/O location 2 or 4 times for the byte swap */
-static __inline__ UINT32
-ixOsalDataCoherentLongReadSwap (volatile UINT32 * wAddr)
-{
- UINT32 wData = IX_OSAL_READ_LONG_IO (wAddr);
- return IX_OSAL_LE_DC_BUSTOXSL (wData);
-}
-
-static __inline__ UINT16
-ixOsalDataCoherentShortReadSwap (volatile UINT16 * sAddr)
-{
- UINT16 sData = IX_OSAL_READ_SHORT_IO (sAddr);
- return IX_OSAL_LE_DC_BUSTOXSS (sData);
-}
-
-static __inline__ void
-ixOsalDataCoherentLongWriteSwap (volatile UINT32 * wAddr, UINT32 wData)
-{
- wData = IX_OSAL_LE_DC_XSTOBUSL (wData);
- IX_OSAL_WRITE_LONG_IO (wAddr, wData);
-}
-
-static __inline__ void
-ixOsalDataCoherentShortWriteSwap (volatile UINT16 * sAddr, UINT16 sData)
-{
- sData = IX_OSAL_LE_DC_XSTOBUSS (sData);
- IX_OSAL_WRITE_SHORT_IO (sAddr, sData);
-}
-
-/* Define LE DC macros */
-
-#define IX_OSAL_READ_LONG_LE_DC(wAddr) ixOsalDataCoherentLongReadSwap((volatile UINT32 *) (wAddr) )
-#define IX_OSAL_READ_SHORT_LE_DC(sAddr) ixOsalDataCoherentShortReadSwap((volatile UINT16 *) (sAddr) )
-#define IX_OSAL_READ_BYTE_LE_DC(bAddr) IX_OSAL_LE_DC_BUSTOXSB(IX_OSAL_READ_BYTE_IO((volatile UINT8 *) (bAddr) ))
-#define IX_OSAL_WRITE_LONG_LE_DC(wAddr, wData) ixOsalDataCoherentLongWriteSwap((volatile UINT32 *) (wAddr), (UINT32) (wData))
-#define IX_OSAL_WRITE_SHORT_LE_DC(sAddr, sData) ixOsalDataCoherentShortWriteSwap((volatile UINT16 *) (sAddr), (UINT16) (sData))
-#define IX_OSAL_WRITE_BYTE_LE_DC(bAddr, bData) IX_OSAL_WRITE_BYTE_IO((volatile UINT8 *) (bAddr), IX_OSAL_LE_DC_XSTOBUSB((UINT8) (bData)))
-
-#if defined (IX_OSAL_BE_MAPPING)
-
-#define IX_OSAL_READ_LONG(wAddr) IX_OSAL_READ_LONG_BE(wAddr)
-#define IX_OSAL_READ_SHORT(sAddr) IX_OSAL_READ_SHORT_BE(sAddr)
-#define IX_OSAL_READ_BYTE(bAddr) IX_OSAL_READ_BYTE_BE(bAddr)
-#define IX_OSAL_WRITE_LONG(wAddr, wData) IX_OSAL_WRITE_LONG_BE(wAddr, wData)
-#define IX_OSAL_WRITE_SHORT(sAddr, sData) IX_OSAL_WRITE_SHORT_BE(sAddr, sData)
-#define IX_OSAL_WRITE_BYTE(bAddr, bData) IX_OSAL_WRITE_BYTE_BE(bAddr, bData)
-
-#elif defined (IX_OSAL_LE_AC_MAPPING)
-
-#define IX_OSAL_READ_LONG(wAddr) IX_OSAL_READ_LONG_LE_AC(wAddr)
-#define IX_OSAL_READ_SHORT(sAddr) IX_OSAL_READ_SHORT_LE_AC(sAddr)
-#define IX_OSAL_READ_BYTE(bAddr) IX_OSAL_READ_BYTE_LE_AC(bAddr)
-#define IX_OSAL_WRITE_LONG(wAddr, wData) IX_OSAL_WRITE_LONG_LE_AC(wAddr, wData)
-#define IX_OSAL_WRITE_SHORT(sAddr, sData) IX_OSAL_WRITE_SHORT_LE_AC(sAddr, sData)
-#define IX_OSAL_WRITE_BYTE(bAddr, bData) IX_OSAL_WRITE_BYTE_LE_AC(bAddr, bData)
-
-#elif defined (IX_OSAL_LE_DC_MAPPING)
-
-#define IX_OSAL_READ_LONG(wAddr) IX_OSAL_READ_LONG_LE_DC(wAddr)
-#define IX_OSAL_READ_SHORT(sAddr) IX_OSAL_READ_SHORT_LE_DC(sAddr)
-#define IX_OSAL_READ_BYTE(bAddr) IX_OSAL_READ_BYTE_LE_DC(bAddr)
-#define IX_OSAL_WRITE_LONG(wAddr, wData) IX_OSAL_WRITE_LONG_LE_DC(wAddr, wData)
-#define IX_OSAL_WRITE_SHORT(sAddr, sData) IX_OSAL_WRITE_SHORT_LE_DC(sAddr, sData)
-#define IX_OSAL_WRITE_BYTE(bAddr, bData) IX_OSAL_WRITE_BYTE_LE_DC(bAddr, bData)
-
-#endif /* End of BE and LE coherency mode switch */
-
-
-/* Reads/writes to and from memory shared with NPEs - depends on the SDRAM coherency */
-
-#if defined (IX_SDRAM_BE)
-
-#define IX_OSAL_READ_BE_SHARED_LONG(wAddr) IX_OSAL_READ_LONG_RAW(wAddr)
-#define IX_OSAL_READ_BE_SHARED_SHORT(sAddr) IX_OSAL_READ_SHORT_RAW(sAddr)
-#define IX_OSAL_READ_BE_SHARED_BYTE(bAddr) IX_OSAL_READ_BYTE_RAW(bAddr)
-
-#define IX_OSAL_WRITE_BE_SHARED_LONG(wAddr, wData) IX_OSAL_WRITE_LONG_RAW(wAddr, wData)
-#define IX_OSAL_WRITE_BE_SHARED_SHORT(sAddr, sData) IX_OSAL_WRITE_SHORT_RAW(sAddr, sData)
-#define IX_OSAL_WRITE_BE_SHARED_BYTE(bAddr, bData) IX_OSAL_WRITE_BYTE_RAW(bAddr, bData)
-
-#define IX_OSAL_SWAP_BE_SHARED_LONG(wData) (wData)
-#define IX_OSAL_SWAP_BE_SHARED_SHORT(sData) (sData)
-#define IX_OSAL_SWAP_BE_SHARED_BYTE(bData) (bData)
-
-#elif defined (IX_SDRAM_LE_ADDRESS_COHERENT)
-
-#define IX_OSAL_READ_BE_SHARED_LONG(wAddr) IX_OSAL_READ_LONG_RAW(wAddr)
-#define IX_OSAL_READ_BE_SHARED_SHORT(sAddr) IX_OSAL_READ_SHORT_RAW(IX_OSAL_SWAP_SHORT_ADDRESS(sAddr))
-#define IX_OSAL_READ_BE_SHARED_BYTE(bAddr) IX_OSAL_READ_BYTE_RAW(IX_OSAL_SWAP_BYTE_ADDRESS(bAddr))
-
-#define IX_OSAL_WRITE_BE_SHARED_LONG(wAddr, wData) IX_OSAL_WRITE_LONG_RAW(wAddr, wData)
-#define IX_OSAL_WRITE_BE_SHARED_SHORT(sAddr, sData) IX_OSAL_WRITE_SHORT_RAW(IX_OSAL_SWAP_SHORT_ADDRESS(sAddr), sData)
-#define IX_OSAL_WRITE_BE_SHARED_BYTE(bAddr, bData) IX_OSAL_WRITE_BYTE_RAW(IX_OSAL_SWAP_BYTE_ADDRESS(bAddr), bData)
-
-#define IX_OSAL_SWAP_BE_SHARED_LONG(wData) (wData)
-#define IX_OSAL_SWAP_BE_SHARED_SHORT(sData) (sData)
-#define IX_OSAL_SWAP_BE_SHARED_BYTE(bData) (bData)
-
-#elif defined (IX_SDRAM_LE_DATA_COHERENT)
-
-#define IX_OSAL_READ_BE_SHARED_LONG(wAddr) IX_OSAL_SWAP_LONG(IX_OSAL_READ_LONG_RAW(wAddr))
-#define IX_OSAL_READ_BE_SHARED_SHORT(sAddr) IX_OSAL_SWAP_SHORT(IX_OSAL_READ_SHORT_RAW(sAddr))
-#define IX_OSAL_READ_BE_SHARED_BYTE(bAddr) IX_OSAL_READ_BYTE_RAW(bAddr)
-
-#define IX_OSAL_WRITE_BE_SHARED_LONG(wAddr, wData) IX_OSAL_WRITE_LONG_RAW(wAddr, IX_OSAL_SWAP_LONG(wData))
-#define IX_OSAL_WRITE_BE_SHARED_SHORT(sAddr, sData) IX_OSAL_WRITE_SHORT_RAW(sAddr, IX_OSAL_SWAP_SHORT(sData))
-#define IX_OSAL_WRITE_BE_SHARED_BYTE(bAddr, bData) IX_OSAL_WRITE_BYTE_RAW(bAddr, bData)
-
-#define IX_OSAL_SWAP_BE_SHARED_LONG(wData) IX_OSAL_SWAP_LONG(wData)
-#define IX_OSAL_SWAP_BE_SHARED_SHORT(sData) IX_OSAL_SWAP_SHORT(sData)
-
-#endif
-
-
-#define IX_OSAL_COPY_BE_SHARED_LONG_ARRAY(wDestAddr, wSrcAddr, wCount) \
- { \
- UINT32 i; \
- \
- for ( i = 0 ; i < wCount ; i++ ) \
- { \
- * (((UINT32 *) wDestAddr) + i) = IX_OSAL_READ_BE_SHARED_LONG(((UINT32 *) wSrcAddr) + i); \
- }; \
- };
-
-#endif /* IxOsalMemAccess_H */
diff --git a/cpu/ixp/npe/include/IxOsalOem.h b/cpu/ixp/npe/include/IxOsalOem.h
deleted file mode 100644
index f89402620c..0000000000
--- a/cpu/ixp/npe/include/IxOsalOem.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * @file IxOsalIxpOem.h
- *
- * @brief this file contains platform-specific defines.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsalOem_H
-#define IxOsalOem_H
-
-#include "IxOsalTypes.h"
-
-/* OS-specific header for Platform package */
-#include "IxOsalOsIxp400.h"
-
-/*
- * Platform Name
- */
-#define IX_OSAL_PLATFORM_NAME ixp400
-
-/*
- * Cache line size
- */
-#define IX_OSAL_CACHE_LINE_SIZE (32)
-
-
-/* Platform-specific fastmutex implementation */
-PUBLIC IX_STATUS ixOsalOemFastMutexTryLock (IxOsalFastMutex * mutex);
-
-/* Platform-specific init (MemMap) */
-PUBLIC IX_STATUS
-ixOsalOemInit (void);
-
-/* Platform-specific unload (MemMap) */
-PUBLIC void
-ixOsalOemUnload (void);
-
-/* Default implementations */
-
-PUBLIC UINT32
-ixOsalIxp400SharedTimestampGet (void);
-
-
-UINT32
-ixOsalIxp400SharedTimestampRateGet (void);
-
-UINT32
-ixOsalIxp400SharedSysClockRateGet (void);
-
-void
-ixOsalIxp400SharedTimeGet (IxOsalTimeval * tv);
-
-
-INT32
-ixOsalIxp400SharedLog (UINT32 level, UINT32 device, char *format,
- int arg1, int arg2, int arg3, int arg4,
- int arg5, int arg6);
-
-#endif /* IxOsal_Oem_H */
diff --git a/cpu/ixp/npe/include/IxOsalOs.h b/cpu/ixp/npe/include/IxOsalOs.h
deleted file mode 100644
index 6c66613415..0000000000
--- a/cpu/ixp/npe/include/IxOsalOs.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef IxOsalOs_H
-#define IxOsalOs_H
-
-#ifndef IX_OSAL_CACHED
-#error "Uncached memory not supported in linux environment"
-#endif
-
-static inline unsigned long __v2p(unsigned long v)
-{
- if (v < 0x40000000)
- return (v & 0xfffffff);
- else
- return v;
-}
-
-#define IX_OSAL_OS_MMU_VIRT_TO_PHYS(addr) __v2p((u32)addr)
-#define IX_OSAL_OS_MMU_PHYS_TO_VIRT(addr) (addr)
-
-/*
- * Data cache not enabled (hopefully)
- */
-#define IX_OSAL_OS_CACHE_INVALIDATE(addr, size)
-#define IX_OSAL_OS_CACHE_FLUSH(addr, size)
-#define HAL_DCACHE_INVALIDATE(addr, size)
-#define HAL_DCACHE_FLUSH(addr, size)
-
-#define __ixp42X /* sr: U-Boot needs this define */
-
-#endif /* IxOsalOs_H */
-
diff --git a/cpu/ixp/npe/include/IxOsalOsAssert.h b/cpu/ixp/npe/include/IxOsalOsAssert.h
deleted file mode 100644
index e4c3e1f614..0000000000
--- a/cpu/ixp/npe/include/IxOsalOsAssert.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef IxOsalOsAssert_H
-#define IxOsalOsAssert_H
-
-#define IX_OSAL_OS_ASSERT(c) if(!(c)) \
- { \
- ixOsalLog (IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDOUT, "Assertion failure \n", 0, 0, 0, 0, 0, 0);\
- while(1); \
- }
-
-#endif /* IxOsalOsAssert_H */
diff --git a/cpu/ixp/npe/include/IxOsalOsBufferMgt.h b/cpu/ixp/npe/include/IxOsalOsBufferMgt.h
deleted file mode 100644
index 745fd8c443..0000000000
--- a/cpu/ixp/npe/include/IxOsalOsBufferMgt.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file IxOsalOsBufferMgt.h
- *
- * @brief vxworks-specific buffer management module definitions.
- *
- * Design Notes:
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-#ifndef IX_OSAL_OS_BUFFER_MGT_H
-#define IX_OSAL_OS_BUFFER_MGT_H
-
-/*
- * use the defaul bufferMgt provided by OSAL framework.
- */
-#define IX_OSAL_USE_DEFAULT_BUFFER_MGT
-
-#include "IxOsalBufferMgtDefault.h"
-
-
-#endif /* #define IX_OSAL_OS_BUFFER_MGT_H */
diff --git a/cpu/ixp/npe/include/IxOsalOsIxp400.h b/cpu/ixp/npe/include/IxOsalOsIxp400.h
deleted file mode 100644
index 44a94fb30f..0000000000
--- a/cpu/ixp/npe/include/IxOsalOsIxp400.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/**
- * @file IxOsalOsIxp400.h
- *
- * @brief OS and platform specific definitions
- *
- * Design Notes:
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsalOsIxp400_H
-#define IxOsalOsIxp400_H
-
-#define BIT(x) (1<<(x))
-
-#define IXP425_EthA_BASE 0xc8009000
-#define IXP425_EthB_BASE 0xc800a000
-
-#define IXP425_PSMA_BASE 0xc8006000
-#define IXP425_PSMB_BASE 0xc8007000
-#define IXP425_PSMC_BASE 0xc8008000
-
-#define IXP425_PERIPHERAL_BASE 0xc8000000
-
-#define IXP425_QMGR_BASE 0x60000000
-#define IXP425_OSTS 0xC8005000
-
-#define IXP425_INT_LVL_NPEA 0
-#define IXP425_INT_LVL_NPEB 1
-#define IXP425_INT_LVL_NPEC 2
-
-#define IXP425_INT_LVL_QM1 3
-#define IXP425_INT_LVL_QM2 4
-
-#define IXP425_EXPANSION_BUS_BASE1 0x50000000
-#define IXP425_EXPANSION_BUS_BASE2 0x50000000
-#define IXP425_EXPANSION_BUS_CS1_BASE 0x51000000
-
-#define IXP425_EXP_CONFIG_BASE 0xC4000000
-
-/* physical addresses to be used when requesting memory with IX_OSAL_MEM_MAP */
-#define IX_OSAL_IXP400_INTC_PHYS_BASE IXP425_INTC_BASE
-#define IX_OSAL_IXP400_GPIO_PHYS_BASE IXP425_GPIO_BASE
-#define IX_OSAL_IXP400_UART1_PHYS_BASE IXP425_UART1_BASE
-#define IX_OSAL_IXP400_UART2_PHYS_BASE IXP425_UART2_BASE
-#define IX_OSAL_IXP400_ETHA_PHYS_BASE IXP425_EthA_BASE
-#define IX_OSAL_IXP400_ETHB_PHYS_BASE IXP425_EthB_BASE
-#define IX_OSAL_IXP400_NPEA_PHYS_BASE IXP425_NPEA_BASE
-#define IX_OSAL_IXP400_NPEB_PHYS_BASE IXP425_NPEB_BASE
-#define IX_OSAL_IXP400_NPEC_PHYS_BASE IXP425_NPEC_BASE
-#define IX_OSAL_IXP400_PERIPHERAL_PHYS_BASE IXP425_PERIPHERAL_BASE
-#define IX_OSAL_IXP400_QMGR_PHYS_BASE IXP425_QMGR_BASE
-#define IX_OSAL_IXP400_OSTS_PHYS_BASE IXP425_TIMER_BASE
-#define IX_OSAL_IXP400_USB_PHYS_BASE IXP425_USB_BASE
-#define IX_OSAL_IXP400_EXP_CFG_PHYS_BASE IXP425_EXP_CFG_BASE
-#define IX_OSAL_IXP400_EXP_BUS_PHYS_BASE IXP425_EXP_BUS_BASE2
-#define IX_OSAL_IXP400_EXP_BUS_BOOT_PHYS_BASE IXP425_EXP_BUS_BASE1
-#define IX_OSAL_IXP400_EXP_BUS_CS0_PHYS_BASE IXP425_EXP_BUS_CS0_BASE
-#define IX_OSAL_IXP400_EXP_BUS_CS1_PHYS_BASE IXP425_EXP_BUS_CS1_BASE
-#define IX_OSAL_IXP400_EXP_BUS_CS4_PHYS_BASE IXP425_EXP_BUS_CS4_BASE
-#define IX_OSAL_IXP400_EXP_BUS_REGS_PHYS_BASE IXP425_EXP_CFG_BASE
-#define IX_OSAL_IXP400_PCI_CFG_PHYS_BASE IXP425_PCI_CFG_BASE
-
-/* map sizes to be used when requesting memory with IX_OSAL_MEM_MAP */
-#define IX_OSAL_IXP400_QMGR_MAP_SIZE (0x4000) /**< Queue Manager map size */
-#define IX_OSAL_IXP400_PERIPHERAL_MAP_SIZE (0xC000) /**< Peripheral space map size */
-#define IX_OSAL_IXP400_UART1_MAP_SIZE (0x1000) /**< UART1 map size */
-#define IX_OSAL_IXP400_UART2_MAP_SIZE (0x1000) /**< UART2 map size */
-#define IX_OSAL_IXP400_PMU_MAP_SIZE (0x1000) /**< PMU map size */
-#define IX_OSAL_IXP400_OSTS_MAP_SIZE (0x1000) /**< OS Timers map size */
-#define IX_OSAL_IXP400_NPEA_MAP_SIZE (0x1000) /**< NPE A map size */
-#define IX_OSAL_IXP400_NPEB_MAP_SIZE (0x1000) /**< NPE B map size */
-#define IX_OSAL_IXP400_NPEC_MAP_SIZE (0x1000) /**< NPE C map size */
-#define IX_OSAL_IXP400_ETHA_MAP_SIZE (0x1000) /**< Eth A map size */
-#define IX_OSAL_IXP400_ETHB_MAP_SIZE (0x1000) /**< Eth B map size */
-#define IX_OSAL_IXP400_USB_MAP_SIZE (0x1000) /**< USB map size */
-#define IX_OSAL_IXP400_GPIO_MAP_SIZE (0x1000) /**< GPIO map size */
-#define IX_OSAL_IXP400_EXP_REG_MAP_SIZE (0x1000) /**< Exp Bus Config Registers map size */
-#define IX_OSAL_IXP400_EXP_BUS_MAP_SIZE (0x08000000) /**< Expansion bus map size */
-#define IX_OSAL_IXP400_EXP_BUS_CS0_MAP_SIZE (0x01000000) /**< CS0 map size */
-#define IX_OSAL_IXP400_EXP_BUS_CS1_MAP_SIZE (0x01000000) /**< CS1 map size */
-#define IX_OSAL_IXP400_EXP_BUS_CS4_MAP_SIZE (0x01000000) /**< CS4 map size */
-#define IX_OSAL_IXP400_PCI_CFG_MAP_SIZE (0x1000) /**< PCI Bus Config Registers map size */
-
-#define IX_OSAL_IXP400_EXP_FUSE (IXP425_EXP_CONFIG_BASE + 0x28)
-#define IX_OSAL_IXP400_ETH_NPEA_PHYS_BASE 0xC800C000
-#define IX_OSAL_IXP400_ETH_NPEA_MAP_SIZE 0x1000
-
-/*
- * Interrupt Levels
- */
-#define IX_OSAL_IXP400_NPEA_IRQ_LVL (0)
-#define IX_OSAL_IXP400_NPEB_IRQ_LVL (1)
-#define IX_OSAL_IXP400_NPEC_IRQ_LVL (2)
-#define IX_OSAL_IXP400_QM1_IRQ_LVL (3)
-#define IX_OSAL_IXP400_QM2_IRQ_LVL (4)
-#define IX_OSAL_IXP400_TIMER1_IRQ_LVL (5)
-#define IX_OSAL_IXP400_GPIO0_IRQ_LVL (6)
-#define IX_OSAL_IXP400_GPIO1_IRQ_LVL (7)
-#define IX_OSAL_IXP400_PCI_INT_IRQ_LVL (8)
-#define IX_OSAL_IXP400_PCI_DMA1_IRQ_LVL (9)
-#define IX_OSAL_IXP400_PCI_DMA2_IRQ_LVL (10)
-#define IX_OSAL_IXP400_TIMER2_IRQ_LVL (11)
-#define IX_OSAL_IXP400_USB_IRQ_LVL (12)
-#define IX_OSAL_IXP400_UART2_IRQ_LVL (13)
-#define IX_OSAL_IXP400_TIMESTAMP_IRQ_LVL (14)
-#define IX_OSAL_IXP400_UART1_IRQ_LVL (15)
-#define IX_OSAL_IXP400_WDOG_IRQ_LVL (16)
-#define IX_OSAL_IXP400_AHB_PMU_IRQ_LVL (17)
-#define IX_OSAL_IXP400_XSCALE_PMU_IRQ_LVL (18)
-#define IX_OSAL_IXP400_GPIO2_IRQ_LVL (19)
-#define IX_OSAL_IXP400_GPIO3_IRQ_LVL (20)
-#define IX_OSAL_IXP400_GPIO4_IRQ_LVL (21)
-#define IX_OSAL_IXP400_GPIO5_IRQ_LVL (22)
-#define IX_OSAL_IXP400_GPIO6_IRQ_LVL (23)
-#define IX_OSAL_IXP400_GPIO7_IRQ_LVL (24)
-#define IX_OSAL_IXP400_GPIO8_IRQ_LVL (25)
-#define IX_OSAL_IXP400_GPIO9_IRQ_LVL (26)
-#define IX_OSAL_IXP400_GPIO10_IRQ_LVL (27)
-#define IX_OSAL_IXP400_GPIO11_IRQ_LVL (28)
-#define IX_OSAL_IXP400_GPIO12_IRQ_LVL (29)
-#define IX_OSAL_IXP400_SW_INT1_IRQ_LVL (30)
-#define IX_OSAL_IXP400_SW_INT2_IRQ_LVL (31)
-
-/* USB interrupt level mask */
-#define IX_OSAL_IXP400_INT_LVL_USB IRQ_IXP425_USB
-
-/* USB IRQ */
-#define IX_OSAL_IXP400_USB_IRQ IRQ_IXP425_USB
-
-/*
- * OS name retrieval
- */
-#define IX_OSAL_OEM_OS_NAME_GET(name, limit) \
-ixOsalOsIxp400NameGet((INT8*)(name), (INT32) (limit))
-
-/*
- * OS version retrieval
- */
-#define IX_OSAL_OEM_OS_VERSION_GET(version, limit) \
-ixOsalOsIxp400VersionGet((INT8*)(version), (INT32) (limit))
-
-/*
- * Function to retrieve the OS name
- */
-PUBLIC IX_STATUS ixOsalOsIxp400NameGet(INT8* osName, INT32 maxSize);
-
-/*
- * Function to retrieve the OS version
- */
-PUBLIC IX_STATUS ixOsalOsIxp400VersionGet(INT8* osVersion, INT32 maxSize);
-
-/*
- * TimestampGet
- */
-PUBLIC UINT32 ixOsalOsIxp400TimestampGet (void);
-
-/*
- * Timestamp
- */
-#define IX_OSAL_OEM_TIMESTAMP_GET ixOsalOsIxp400TimestampGet
-
-
-/*
- * Timestamp resolution
- */
-PUBLIC UINT32 ixOsalOsIxp400TimestampResolutionGet (void);
-
-#define IX_OSAL_OEM_TIMESTAMP_RESOLUTION_GET ixOsalOsIxp400TimestampResolutionGet
-
-/*
- * Retrieves the system clock rate
- */
-PUBLIC UINT32 ixOsalOsIxp400SysClockRateGet (void);
-
-#define IX_OSAL_OEM_SYS_CLOCK_RATE_GET ixOsalOsIxp400SysClockRateGet
-
-/*
- * required by FS but is not really platform-specific.
- */
-#define IX_OSAL_OEM_TIME_GET(pTv) ixOsalTimeGet(pTv)
-
-
-
-/* linux map/unmap functions */
-PUBLIC void ixOsalLinuxMemMap (IxOsalMemoryMap * map);
-
-PUBLIC void ixOsalLinuxMemUnmap (IxOsalMemoryMap * map);
-
-
-/*********************
- * Memory map
- ********************/
-
-/* Global memmap only visible to IO MEM module */
-
-#ifdef IxOsalIoMem_C
-
-IxOsalMemoryMap ixOsalGlobalMemoryMap[] = {
- {
- /* Global BE and LE_AC map */
- IX_OSAL_STATIC_MAP, /* type */
- 0x00000000, /* physicalAddress */
- 0x30000000, /* size */
- 0x00000000, /* virtualAddress */
- NULL, /* mapFunction */
- NULL, /* unmapFunction */
- 0, /* refCount */
- IX_OSAL_BE | IX_OSAL_LE_AC,/* endianType */
- "global_low" /* name */
- },
-
- /* SDRAM LE_DC alias */
- {
- IX_OSAL_STATIC_MAP, /* type */
- 0x00000000, /* physicalAddress */
- 0x10000000, /* size */
- 0x30000000, /* virtualAddress */
- NULL, /* mapFunction */
- NULL, /* unmapFunction */
- 0, /* refCount */
- IX_OSAL_LE_DC, /* endianType */
- "sdram_dc" /* name */
- },
-
- /* QMGR LE_DC alias */
- {
- IX_OSAL_STATIC_MAP, /* type */
- 0x60000000, /* physicalAddress */
- 0x00100000, /* size */
- 0x60000000, /* virtualAddress */
- NULL, /* mapFunction */
- NULL, /* unmapFunction */
- 0, /* refCount */
- IX_OSAL_LE_DC, /* endianType */
- "qmgr_dc" /* name */
- },
-
- /* QMGR BE alias */
- {
- IX_OSAL_STATIC_MAP, /* type */
- 0x60000000, /* physicalAddress */
- 0x00100000, /* size */
- 0x60000000, /* virtualAddress */
- NULL, /* mapFunction */
- NULL, /* unmapFunction */
- 0, /* refCount */
- IX_OSAL_BE | IX_OSAL_LE_AC,/* endianType */
- "qmgr_be" /* name */
- },
-
- /* Global BE and LE_AC map */
- {
- IX_OSAL_STATIC_MAP, /* type */
- 0x40000000, /* physicalAddress */
- 0x20000000, /* size */
- 0x40000000, /* virtualAddress */
- NULL, /* mapFunction */
- NULL, /* unmapFunction */
- 0, /* refCount */
- IX_OSAL_BE | IX_OSAL_LE_AC,/* endianType */
- "Misc Cfg" /* name */
- },
-
- /* Global BE and LE_AC map */
- {
- IX_OSAL_STATIC_MAP, /* type */
- 0x70000000, /* physicalAddress */
- 0x8FFFFFFF, /* size */
- 0x70000000, /* virtualAddress */
- NULL, /* mapFunction */
- NULL, /* unmapFunction */
- 0, /* refCount */
- IX_OSAL_BE | IX_OSAL_LE_AC,/* endianType */
- "Exp Cfg" /* name */
- },
-};
-
-#endif /* IxOsalIoMem_C */
-#endif /* #define IxOsalOsIxp400_H */
diff --git a/cpu/ixp/npe/include/IxOsalOsIxp400CustomizedMapping.h b/cpu/ixp/npe/include/IxOsalOsIxp400CustomizedMapping.h
deleted file mode 100644
index 47ce3a2d80..0000000000
--- a/cpu/ixp/npe/include/IxOsalOsIxp400CustomizedMapping.h
+++ /dev/null
@@ -1,404 +0,0 @@
-/**
- * @file IxOsalOsIxp400CustomizedMapping.h
- *
- * @brief Set LE coherency modes for components.
- * The default setting is IX_OSAL_NO_MAPPING for LE.
- *
- *
- * By default IX_OSAL_STATIC_MEMORY_MAP is defined for all the components.
- * If any component uses a dynamic memory map it must define
- * IX_OSAL_DYNAMIC_MEMORY_MAP in its corresponding section.
- *
- *
- * @par
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsalOsIxp400CustomizedMapping_H
-#define IxOsalOsIxp400CustomizedMapping_H
-
-/*
- * only include this file in Little Endian
- */
-
-#if defined (IX_OSAL_LINUX_BE)
-#error Only include IxOsalOsIxp400CustomizedMapping.h in Little Endian
-#endif
-
- /*
- * Components don't have to be in this list if
- * the default mapping is OK.
- */
-#define ix_osal 1
-#define ix_dmaAcc 2
-#define ix_atmdAcc 3
-
-#define ix_atmsch 5
-#define ix_ethAcc 6
-#define ix_npeMh 7
-#define ix_qmgr 8
-#define ix_npeDl 9
-#define ix_atmm 10
-#define ix_hssAcc 11
-#define ix_ethDB 12
-#define ix_ethMii 13
-#define ix_timerCtrl 14
-#define ix_adsl 15
-#define ix_usb 16
-#define ix_uartAcc 17
-#define ix_featureCtrl 18
-#define ix_cryptoAcc 19
-#define ix_unloadAcc 33
-#define ix_perfProfAcc 34
-#define ix_parityENAcc 49
-#define ix_sspAcc 51
-#define ix_timeSyncAcc 52
-#define ix_i2c 53
-
-#define ix_codelets_uartAcc 21
-#define ix_codelets_timers 22
-#define ix_codelets_atm 23
-#define ix_codelets_ethAal5App 24
-#define ix_codelets_demoUtils 26
-#define ix_codelets_usb 27
-#define ix_codelets_hssAcc 28
-#define ix_codelets_dmaAcc 40
-#define ix_codelets_cryptoAcc 41
-#define ix_codelets_perfProfAcc 42
-#define ix_codelets_ethAcc 43
-#define ix_codelets_parityENAcc 54
-#define ix_codelets_timeSyncAcc 55
-
-
-#endif /* IxOsalOsIxp400CustomizedMapping_H */
-
-
-/***************************
- * osal
- ***************************/
-#if (IX_COMPONENT_NAME == ix_osal)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* osal */
-
-/***************************
- * dmaAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_dmaAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* dmaAcc */
-
-/***************************
- * atmdAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_atmdAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* atmdAcc */
-
-/***************************
- * atmsch
- ***************************/
-#if (IX_COMPONENT_NAME == ix_atmsch)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* atmsch */
-
-/***************************
- * ethAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_ethAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* ethAcc */
-
-/***************************
- * npeMh
- ***************************/
-#if (IX_COMPONENT_NAME == ix_npeMh)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* npeMh */
-
-/***************************
- * qmgr
- ***************************/
-#if (IX_COMPONENT_NAME == ix_qmgr)
-
-#define IX_OSAL_LE_DC_MAPPING
-
-#endif /* qmgr */
-
-/***************************
- * npeDl
- ***************************/
-#if (IX_COMPONENT_NAME == ix_npeDl)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* npeDl */
-
-/***************************
- * atmm
- ***************************/
-#if (IX_COMPONENT_NAME == ix_atmm)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* atmm */
-
-/***************************
- * ethMii
- ***************************/
-#if (IX_COMPONENT_NAME == ix_ethMii)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* ethMii */
-
-
-/***************************
- * adsl
- ***************************/
-#if (IX_COMPONENT_NAME == ix_adsl)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* adsl */
-
-/***************************
- * usb
- ***************************/
-#if (IX_COMPONENT_NAME == ix_usb)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* usb */
-
-/***************************
- * uartAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_uartAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* uartAcc */
-
-/***************************
- * featureCtrl
- ***************************/
-#if (IX_COMPONENT_NAME == ix_featureCtrl)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* featureCtrl */
-
-/***************************
- * cryptoAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_cryptoAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* cryptoAcc */
-
-/***************************
- * codelets_usb
- ***************************/
-#if (IX_COMPONENT_NAME == ix_codelets_usb)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* codelets_usb */
-
-
-/***************************
- * codelets_uartAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_codelets_uartAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* codelets_uartAcc */
-
-
-
-/***************************
- * codelets_timers
- ***************************/
-#if (IX_COMPONENT_NAME == ix_codelets_timers)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* codelets_timers */
-
-/***************************
- * codelets_atm
- ***************************/
-#if (IX_COMPONENT_NAME == ix_codelets_atm)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* codelets_atm */
-
-/***************************
- * codelets_ethAal5App
- ***************************/
-#if (IX_COMPONENT_NAME == ix_codelets_ethAal5App)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* codelets_ethAal5App */
-
-/***************************
- * codelets_ethAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_codelets_ethAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* codelets_ethAcc */
-
-
-/***************************
- * codelets_demoUtils
- ***************************/
-#if (IX_COMPONENT_NAME == ix_codelets_demoUtils)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* codelets_demoUtils */
-
-
-
-/***************************
- * perfProfAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_perfProfAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* perfProfAcc */
-
-
-/***************************
- * unloadAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_unloadAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* unloadAcc */
-
-
-
-
-
-/***************************
- * parityENAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_parityENAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* parityENAcc */
-
-/***************************
- * codelets_parityENAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_codelets_parityENAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* codelets_parityENAcc */
-
-
-
-
-/***************************
- * timeSyncAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_timeSyncAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* timeSyncAcc */
-
-
-/***************************
- * codelets_timeSyncAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_codelets_timeSyncAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* codelets_timeSyncAcc */
-
-
-
-
-/***************************
- * i2c
- ***************************/
-#if (IX_COMPONENT_NAME == ix_i2c)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* i2c */
-
-
-
-/***************************
- * sspAcc
- ***************************/
-#if (IX_COMPONENT_NAME == ix_sspAcc)
-
-#define IX_OSAL_LE_AC_MAPPING
-
-#endif /* sspAcc */
-
-
diff --git a/cpu/ixp/npe/include/IxOsalOsTypes.h b/cpu/ixp/npe/include/IxOsalOsTypes.h
deleted file mode 100644
index 6e652411f5..0000000000
--- a/cpu/ixp/npe/include/IxOsalOsTypes.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef IxOsalOsTypes_H
-#define IxOsalOsTypes_H
-
-#include <asm/types.h>
-
-typedef s64 INT64;
-typedef u64 UINT64;
-typedef s32 INT32;
-typedef u32 UINT32;
-typedef s16 INT16;
-typedef u16 UINT16;
-typedef s8 INT8;
-typedef u8 UINT8;
-
-typedef u32 ULONG;
-typedef u16 USHORT;
-typedef u8 UCHAR;
-typedef u32 BOOL;
-
-
-#define IX_OSAL_OS_WAIT_FOREVER (-1L)
-#define IX_OSAL_OS_WAIT_NONE 0
-
-
-/* Thread handle is eventually an int type */
-typedef int IxOsalOsThread;
-
-/* Semaphore handle FIXME */
-typedef int IxOsalOsSemaphore;
-
-/* Mutex handle */
-typedef int IxOsalOsMutex;
-
-/*
- * Fast mutex handle - fast mutex operations are implemented in
- * native assembler code using atomic test-and-set instructions
- */
-typedef int IxOsalOsFastMutex;
-
-typedef struct
-{
-} IxOsalOsMessageQueue;
-
-
-#endif /* IxOsalOsTypes_H */
diff --git a/cpu/ixp/npe/include/IxOsalOsUtilitySymbols.h b/cpu/ixp/npe/include/IxOsalOsUtilitySymbols.h
deleted file mode 100644
index beb45a0794..0000000000
--- a/cpu/ixp/npe/include/IxOsalOsUtilitySymbols.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef IxOsalOsUtilitySymbols_H
-#define IxOsalOsUtilitySymbols_H
-
-#endif /* IxOsalOsUtilitySymbols_H */
diff --git a/cpu/ixp/npe/include/IxOsalTypes.h b/cpu/ixp/npe/include/IxOsalTypes.h
deleted file mode 100644
index c617ec5781..0000000000
--- a/cpu/ixp/npe/include/IxOsalTypes.h
+++ /dev/null
@@ -1,401 +0,0 @@
-/**
- * @file IxOsalTypes.h
- *
- * @brief Define OSAL basic data types.
- *
- * This file contains fundamental data types used by OSAL.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-
-#ifndef IxOsalTypes_H
-#define IxOsalTypes_H
-
-#include <config.h>
-#include <common.h>
-
-#define __ixp42X /* sr: U-Boot needs this define */
-#define IXP425_EXP_CFG_BASE 0xC4000000
-#define diag_printf debug
-
-#undef SIMSPARCSOLARIS
-#define SIMSPARCSOLARIS 0xaffe /* sr: U-Boot gets confused with this solaris define */
-
-/*
- * Include the OS-specific type definitions
- */
-#include "IxOsalOsTypes.h"
-/**
- * @defgroup IxOsalTypes Osal basic data types.
- *
- * @brief Basic data types for Osal
- *
- * @{
- */
-
-/**
- * @brief OSAL status
- *
- * @note Possible OSAL return status include IX_SUCCESS and IX_FAIL.
- */
-typedef UINT32 IX_STATUS;
-
-/**
- * @brief VUINT32
- *
- * @note volatile UINT32
- */
-typedef volatile UINT32 VUINT32;
-
-/**
- * @brief VINT32
- *
- * @note volatile INT32
- */
-typedef volatile INT32 VINT32;
-
-
-#ifndef NUMELEMS
-#define NUMELEMS(x) (sizeof(x) / sizeof((x)[0]))
-#endif
-
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_OSAL_BILLION
- *
- * @brief Alias for 1,000,000,000
- *
- */
-#define IX_OSAL_BILLION (1000000000)
-
-#ifndef TRUE
-#define TRUE 1L
-#endif
-
-#if TRUE != 1
-#error TRUE is not defined to 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0L
-#endif
-
-#if FALSE != 0
-#error FALSE is not defined to 0
-#endif
-
-#ifndef NULL
-#define NULL 0L
-#endif
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_SUCCESS
- *
- * @brief Success status
- *
- */
-#ifndef IX_SUCCESS
-#define IX_SUCCESS 0L /**< #defined as 0L */
-#endif
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_FAIL
- *
- * @brief Failure status
- *
- */
-#ifndef IX_FAIL
-#define IX_FAIL 1L /**< #defined as 1L */
-#endif
-
-
-#ifndef PRIVATE
-#ifdef IX_PRIVATE_OFF
-#define PRIVATE /* nothing */
-#else
-#define PRIVATE static /**< #defined as static, except for debug builds */
-#endif /* IX_PRIVATE_OFF */
-#endif /* PRIVATE */
-
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_OSAL_INLINE
- *
- * @brief Alias for __inline
- *
- */
-#ifndef IX_OSAL_INLINE
-#define IX_OSAL_INLINE __inline
-#endif /* IX_OSAL_INLINE */
-
-
-#ifndef __inline__
-#define __inline__ IX_OSAL_INLINE
-#endif
-
-
-/* Each OS can define its own PUBLIC, otherwise it will be empty. */
-#ifndef PUBLIC
-#define PUBLIC
-#endif /* PUBLIC */
-
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_OSAL_INLINE_EXTERN
- *
- * @brief Alias for __inline extern
- *
- */
-#ifndef IX_OSAL_INLINE_EXTERN
-#define IX_OSAL_INLINE_EXTERN IX_OSAL_INLINE extern
-#endif
-
-/**
- * @ingroup IxOsalTypes
- * @enum IxOsalLogDevice
- * @brief This is an emum for OSAL log devices.
- */
-typedef enum
-{
- IX_OSAL_LOG_DEV_STDOUT = 0, /**< standard output (implemented by default) */
- IX_OSAL_LOG_DEV_STDERR = 1, /**< standard error (implemented */
- IX_OSAL_LOG_DEV_HEX_DISPLAY = 2, /**< hexadecimal display (not implemented) */
- IX_OSAL_LOG_DEV_ASCII_DISPLAY = 3 /**< ASCII-capable display (not implemented) */
-} IxOsalLogDevice;
-
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_OSAL_LOG_ERROR
- *
- * @brief Alias for -1, used as log function error status
- *
- */
-#define IX_OSAL_LOG_ERROR (-1)
-
-/**
- * @ingroup IxOsalTypes
- * @enum IxOsalLogLevel
- * @brief This is an emum for OSAL log trace level.
- */
-typedef enum
-{
- IX_OSAL_LOG_LVL_NONE = 0, /**<No trace level */
- IX_OSAL_LOG_LVL_USER = 1, /**<Set trace level to user */
- IX_OSAL_LOG_LVL_FATAL = 2, /**<Set trace level to fatal */
- IX_OSAL_LOG_LVL_ERROR = 3, /**<Set trace level to error */
- IX_OSAL_LOG_LVL_WARNING = 4, /**<Set trace level to warning */
- IX_OSAL_LOG_LVL_MESSAGE = 5, /**<Set trace level to message */
- IX_OSAL_LOG_LVL_DEBUG1 = 6, /**<Set trace level to debug1 */
- IX_OSAL_LOG_LVL_DEBUG2 = 7, /**<Set trace level to debug2 */
- IX_OSAL_LOG_LVL_DEBUG3 = 8, /**<Set trace level to debug3 */
- IX_OSAL_LOG_LVL_ALL /**<Set trace level to all */
-} IxOsalLogLevel;
-
-
-/**
- * @ingroup IxOsalTypes
- * @brief Void function pointer prototype
- *
- * @note accepts a void pointer parameter
- * and does not return a value.
- */
-typedef void (*IxOsalVoidFnVoidPtr) (void *);
-
-typedef void (*IxOsalVoidFnPtr) (void);
-
-
-/**
- * @brief Timeval structure
- *
- * @note Contain subfields of seconds and nanoseconds..
- */
-typedef struct
-{
- UINT32 secs; /**< seconds */
- UINT32 nsecs; /**< nanoseconds */
-} IxOsalTimeval;
-
-
-/**
- * @ingroup IxOsalTypes
- * @brief IxOsalTimer
- *
- * @note OSAL timer handle
- *
- */
-typedef UINT32 IxOsalTimer;
-
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_OSAL_WAIT_FOREVER
- *
- * @brief Definition for timeout forever, OS-specific.
- *
- */
-#define IX_OSAL_WAIT_FOREVER IX_OSAL_OS_WAIT_FOREVER
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_OSAL_WAIT_NONE
- *
- * @brief Definition for timeout 0, OS-specific.
- *
- */
-#define IX_OSAL_WAIT_NONE IX_OSAL_OS_WAIT_NONE
-
-
-/**
- * @ingroup IxOsalTypes
- * @brief IxOsalMutex
- *
- * @note Mutex handle, OS-specific
- *
- */
-typedef IxOsalOsMutex IxOsalMutex;
-
-/**
- * @ingroup IxOsalTypes
- * @brief IxOsalFastMutex
- *
- * @note FastMutex handle, OS-specific
- *
- */
-typedef IxOsalOsFastMutex IxOsalFastMutex;
-
-/**
- * @ingroup IxOsalTypes
- * @brief IxOsalThread
- *
- * @note Thread handle, OS-specific
- *
- */
-typedef IxOsalOsThread IxOsalThread;
-
-/**
- * @ingroup IxOsalTypes
- * @brief IxOsalSemaphore
- *
- * @note Semaphore handle, OS-specific
- *
- */
-typedef IxOsalOsSemaphore IxOsalSemaphore;
-
-/**
- * @ingroup IxOsalTypes
- * @brief IxOsalMessageQueue
- *
- * @note Message Queue handle, OS-specific
- *
- */
-typedef IxOsalOsMessageQueue IxOsalMessageQueue;
-
-
-/**
- * @brief Thread Attribute
- * @note Default thread attribute
- */
-typedef struct
-{
- char *name; /**< name */
- UINT32 stackSize; /**< stack size */
- UINT32 priority; /**< priority */
-} IxOsalThreadAttr;
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_OSAL_THREAD_DEFAULT_STACK_SIZE
- *
- * @brief Default thread stack size, OS-specific.
- *
- */
-#define IX_OSAL_THREAD_DEFAULT_STACK_SIZE (IX_OSAL_OS_THREAD_DEFAULT_STACK_SIZE)
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_OSAL_THREAD_MAX_STACK_SIZE
- *
- * @brief Max stack size, OS-specific.
- *
- */
-#define IX_OSAL_THREAD_MAX_STACK_SIZE (IX_OSAL_OS_THREAD_MAX_STACK_SIZE)
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_OSAL_DEFAULT_THREAD_PRIORITY
- *
- * @brief Default thread priority, OS-specific.
- *
- */
-#define IX_OSAL_DEFAULT_THREAD_PRIORITY (IX_OSAL_OS_DEFAULT_THREAD_PRIORITY)
-
-/**
- * @ingroup IxOsalTypes
- *
- * @def IX_OSAL_MAX_THREAD_PRIORITY
- *
- * @brief Max thread priority, OS-specific.
- *
- */
-#define IX_OSAL_MAX_THREAD_PRIORITY (IX_OSAL_OS_MAX_THREAD_PRIORITY)
-
-/**
- * @} IxOsalTypes
- */
-
-
-#endif /* IxOsalTypes_H */
diff --git a/cpu/ixp/npe/include/IxOsalUtilitySymbols.h b/cpu/ixp/npe/include/IxOsalUtilitySymbols.h
deleted file mode 100644
index f2a73db8b9..0000000000
--- a/cpu/ixp/npe/include/IxOsalUtilitySymbols.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @file
- *
- * @brief OSAL Configuration header file
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxOsalUtilitySymbols_H
-#define IxOsalUtilitySymbols_H
-
-#include "IxOsalOsUtilitySymbols.h" /* OS-specific utility symbol definitions */
-
-#endif /* IxOsalUtilitySymbols_H */
diff --git a/cpu/ixp/npe/include/IxParityENAcc.h b/cpu/ixp/npe/include/IxParityENAcc.h
deleted file mode 100644
index 62fe1714f1..0000000000
--- a/cpu/ixp/npe/include/IxParityENAcc.h
+++ /dev/null
@@ -1,785 +0,0 @@
-/**
- * @file IxParityENAcc.h
- *
- * @author Intel Corporation
- * @date 24 Mar 2004
- *
- * @brief This file contains the public API for the IXP400 Parity Error
- * Notifier access component.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxParityENAcc IXP400 Parity Error Notifier (IxParityENAcc) API
- *
- * @brief The public API for the Parity Error Notifier
- *
- * @{
- */
-
-#ifndef IXPARITYENACC_H
-#define IXPARITYENACC_H
-
-#ifdef __ixp46X
-
-#include "IxOsal.h"
-
-/*
- * #defines for function return types, etc.
- */
-
-/**
- * @ingroup IxParityENAcc
- *
- * @enum IxParityENAccStatus
- *
- * @brief The status as returend from the API
- */
-typedef enum /**< IxParityENAccStatus */
-{
- IX_PARITYENACC_SUCCESS = IX_SUCCESS, /**< The request is successful */
- IX_PARITYENACC_INVALID_PARAMETERS, /**< Invalid or NULL parameters passed */
- IX_PARITYENACC_NOT_INITIALISED, /**< Access layer has not been initialised before accessing the APIs */
- IX_PARITYENACC_ALREADY_INITIALISED, /**< Access layer has already been initialised */
- IX_PARITYENACC_OPERATION_FAILED, /**< Operation did not succeed due to hardware failure */
- IX_PARITYENACC_NO_PARITY /**< No parity condition exits or has already been cleared */
-} IxParityENAccStatus;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @enum IxParityENAccParityType
- *
- * @brief Odd or Even Parity Type
- */
-typedef enum /**< IxParityENAccParityType */
-{
- IX_PARITYENACC_EVEN_PARITY, /**< Even Parity */
- IX_PARITYENACC_ODD_PARITY /**< Odd Parity */
-} IxParityENAccParityType;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @enum IxParityENAccConfigOption
- *
- * @brief The parity error enable/disable configuration option
- */
-typedef enum /**< IxParityENAccConfigOption */
-{
- IX_PARITYENACC_DISABLE, /**< Disable parity error detection */
- IX_PARITYENACC_ENABLE /**< Enable parity error detection */
-} IxParityENAccConfigOption;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @struct IxParityENAccNpeConfig
- *
- * @brief NPE parity detection is to be enabled/disabled
- */
-typedef struct /**< IxParityENAccNpeConfig */
-{
- IxParityENAccConfigOption ideEnabled; /**< NPE IMem, DMem and External */
- IxParityENAccParityType parityOddEven; /**< Parity - Odd or Even */
-} IxParityENAccNpeConfig ;
-
-
-/**
- * @ingroup IxParityENAcc
- *
- * @struct IxParityENAccMcuConfig
- *
- * @brief MCU pairty detection is to be enabled/disabled
- */
-typedef struct /**< IxParityENAccMcuConfig */
-{
- IxParityENAccConfigOption singlebitDetectEnabled; /**< Single-bit parity error detection */
- IxParityENAccConfigOption singlebitCorrectionEnabled; /**< Single-bit parity error correction */
- IxParityENAccConfigOption multibitDetectionEnabled; /**< Multi-bit parity error detection */
-} IxParityENAccMcuConfig ;
-
-
-/**
- * @ingroup IxParityENAcc
- *
- * @struct IxParityENAccEbcConfig
- *
- * @brief Expansion Bus Controller parity detection is to be enabled or disabled
- *
- * Note: All the Chip Select(s) and External Masters will have the same parity
- */
-typedef struct /**< IxParityENAccEbcConfig */
-{
- IxParityENAccConfigOption ebcCs0Enabled; /**< Expansion Bus Controller - Chip Select 0 */
- IxParityENAccConfigOption ebcCs1Enabled; /**< Expansion Bus Controller - Chip Select 1 */
- IxParityENAccConfigOption ebcCs2Enabled; /**< Expansion Bus Controller - Chip Select 2 */
- IxParityENAccConfigOption ebcCs3Enabled; /**< Expansion Bus Controller - Chip Select 3 */
- IxParityENAccConfigOption ebcCs4Enabled; /**< Expansion Bus Controller - Chip Select 4 */
- IxParityENAccConfigOption ebcCs5Enabled; /**< Expansion Bus Controller - Chip Select 5 */
- IxParityENAccConfigOption ebcCs6Enabled; /**< Expansion Bus Controller - Chip Select 6 */
- IxParityENAccConfigOption ebcCs7Enabled; /**< Expansion Bus Controller - Chip Select 7 */
- IxParityENAccConfigOption ebcExtMstEnabled; /**< External Master on Expansion bus */
- IxParityENAccParityType parityOddEven; /**< Parity - Odd or Even */
-} IxParityENAccEbcConfig ;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @struct IxParityENAccHWParityConfig
- *
- * @brief Parity error configuration of the Hardware Blocks
- */
-typedef struct /**< IxParityENAccHWParityConfig */
-{
- IxParityENAccNpeConfig npeAConfig; /**< NPE A parity detection is to be enabled/disabled */
- IxParityENAccNpeConfig npeBConfig; /**< NPE B parity detection is to be enabled/disabled */
- IxParityENAccNpeConfig npeCConfig; /**< NPE C parity detection is to be enabled/disabled */
- IxParityENAccMcuConfig mcuConfig; /**< MCU pairty detection is to be enabled/disabled */
- IxParityENAccConfigOption swcpEnabled; /**< SWCP parity detection is to be enabled */
- IxParityENAccConfigOption aqmEnabled; /**< AQM parity detection is to be enabled */
- IxParityENAccEbcConfig ebcConfig; /**< Expansion Bus Controller parity detection is to be enabled/disabled */
-} IxParityENAccHWParityConfig;
-
-
-/**
- * @ingroup IxParityENAcc
- *
- * @struct IxParityENAccNpeParityErrorStats
- *
- * @brief NPE parity error statistics
- */
-typedef struct /* IxParityENAccNpeParityErrorStats */
-{
- UINT32 parityErrorsIMem; /**< Parity errors in Instruction Memory */
- UINT32 parityErrorsDMem; /**< Parity errors in Data Memory */
- UINT32 parityErrorsExternal; /**< Parity errors in NPE External Entities */
-} IxParityENAccNpeParityErrorStats;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @struct IxParityENAccMcuParityErrorStats
- *
- * @brief DDR Memory Control Unit parity error statistics
- *
- * Note: There could be two outstanding parity errors at any given time whose address
- * details captured. If there is no room for the new interrupt then it would be treated
- * as overflow parity condition.
- */
-typedef struct /* IxParityENAccMcuParityErrorStats */
-{
- UINT32 parityErrorsSingleBit; /**< Parity errors of the type Single-Bit */
- UINT32 parityErrorsMultiBit; /**< Parity errors of the type Multi-Bit */
- UINT32 parityErrorsOverflow; /**< Parity errors when more than two parity errors occured */
-} IxParityENAccMcuParityErrorStats;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @struct IxParityENAccEbcParityErrorStats
- *
- * @brief Expansion Bus Controller parity error statistics
- */
-typedef struct /* IxParityENAccEbcParityErrorStats */
-{
- UINT32 parityErrorsInbound; /**< Odd bit parity errors on inbound transfers */
- UINT32 parityErrorsOutbound; /**< Odd bit parity errors on outbound transfers */
-} IxParityENAccEbcParityErrorStats;
-
-
-/**
- * @ingroup IxParityENAcc
- *
- * @struct IxParityENAccParityErrorStats
- *
- * @brief Parity Error Statistics for the all the hardware blocks
- */
-typedef struct /**< IxParityENAccParityErrorStats */
-{
- IxParityENAccNpeParityErrorStats npeStats; /**< NPE parity error statistics */
- IxParityENAccMcuParityErrorStats mcuStats; /**< MCU parity error statistics */
- IxParityENAccEbcParityErrorStats ebcStats; /**< EBC parity error statistics */
- UINT32 swcpStats; /**< SWCP parity error statistics */
- UINT32 aqmStats; /**< AQM parity error statistics */
-} IxParityENAccParityErrorStats;
-
-
-/**
- * @ingroup IxParityENAcc
- *
- * @enum IxParityENAccParityErrorSource
- *
- * @brief The source of the parity error notification
- */
-typedef enum /**< IxParityENAccParityErrorSource */
-{
- IX_PARITYENACC_NPE_A_IMEM, /**< NPE A - Instruction memory */
- IX_PARITYENACC_NPE_A_DMEM, /**< NPE A - Data memory */
- IX_PARITYENACC_NPE_A_EXT, /**< NPE A - External Entity*/
- IX_PARITYENACC_NPE_B_IMEM, /**< NPE B - Instruction memory */
- IX_PARITYENACC_NPE_B_DMEM, /**< NPE B - Data memory */
- IX_PARITYENACC_NPE_B_EXT, /**< NPE B - External Entity*/
- IX_PARITYENACC_NPE_C_IMEM, /**< NPE C - Instruction memory */
- IX_PARITYENACC_NPE_C_DMEM, /**< NPE C - Data memory */
- IX_PARITYENACC_NPE_C_EXT, /**< NPE C - External Entity*/
- IX_PARITYENACC_SWCP, /**< SWCP */
- IX_PARITYENACC_AQM, /**< AQM */
- IX_PARITYENACC_MCU_SBIT, /**< DDR Memory Controller Unit - Single bit parity */
- IX_PARITYENACC_MCU_MBIT, /**< DDR Memory Controller Unit - Multi bit parity */
- IX_PARITYENACC_MCU_OVERFLOW, /**< DDR Memory Controller Unit - Parity errors in excess of two */
- IX_PARITYENACC_EBC_CS, /**< Expansion Bus Controller - Chip Select */
- IX_PARITYENACC_EBC_EXTMST /**< Expansion Bus Controller - External Master */
-} IxParityENAccParityErrorSource;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @enum IxParityENAccParityErrorAccess
- *
- * @brief The type of access resulting in parity error
- */
-typedef enum /**< IxParityENAccParityErrorAccess */
-{
- IX_PARITYENACC_READ, /**< Read Access */
- IX_PARITYENACC_WRITE /**< Write Access */
-} IxParityENAccParityErrorAccess;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @typedef IxParityENAccParityErrorAddress
- *
- * @brief The memory location which has parity error
- */
-typedef UINT32 IxParityENAccParityErrorAddress;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @typedef IxParityENAccParityErrorData
- *
- * @brief The data read from the memory location which has parity error
- */
-typedef UINT32 IxParityENAccParityErrorData;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @enum IxParityENAccParityErrorRequester
- *
- * @brief The requester interface through which the SDRAM memory access
- * resulted in the parity error.
- */
-typedef enum /**< IxParityENAccParityErrorRequester */
-{
- IX_PARITYENACC_MPI, /**< Direct Memory Port Interface */
- IX_PARITYENACC_AHB_BUS /**< South or North AHB Bus */
-} IxParityENAccParityErrorRequester;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @enum IxParityENAccAHBErrorMaster
- *
- * @brief The Master on the AHB bus interface whose transaction might have
- * resulted in the parity error notification to XScale.
- */
-typedef enum /**< IxParityENAccAHBErrorMaster */
-{
- IX_PARITYENACC_AHBN_MST_NPE_A, /**< NPE - A */
- IX_PARITYENACC_AHBN_MST_NPE_B, /**< NPE - B */
- IX_PARITYENACC_AHBN_MST_NPE_C, /**< NPE - C */
- IX_PARITYENACC_AHBS_MST_XSCALE, /**< XScale Bus Interface Unit */
- IX_PARITYENACC_AHBS_MST_PBC, /**< PCI Bus Controller */
- IX_PARITYENACC_AHBS_MST_EBC, /**< Expansion Bus Controller */
- IX_PARITYENACC_AHBS_MST_AHB_BRIDGE, /**< AHB Bridge */
- IX_PARITYENACC_AHBS_MST_USBH /**< USB Host Controller */
-} IxParityENAccAHBErrorMaster;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @enum IxParityENAccAHBErrorSlave
- *
- * @brief The Slave on the AHB bus interface whose transaction might have
- * resulted in the parity error notification to XScale.
- */
-typedef enum /**< IxParityENAccAHBErrorSlave */
-{
- IX_PARITYENACC_AHBN_SLV_MCU, /**< Memory Control Unit */
- IX_PARITYENACC_AHBN_SLV_AHB_BRIDGE, /**< AHB Bridge */
- IX_PARITYENACC_AHBS_SLV_MCU, /**< XScale Bus Interface Unit */
- IX_PARITYENACC_AHBS_SLV_APB_BRIDGE, /**< APB Bridge */
- IX_PARITYENACC_AHBS_SLV_AQM, /**< AQM */
- IX_PARITYENACC_AHBS_SLV_RSA, /**< RSA (Crypto Bus) */
- IX_PARITYENACC_AHBS_SLV_PBC, /**< PCI Bus Controller */
- IX_PARITYENACC_AHBS_SLV_EBC, /**< Expansion Bus Controller */
- IX_PARITYENACC_AHBS_SLV_USBH /**< USB Host Controller */
-} IxParityENAccAHBErrorSlave;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @struct IxParityENAccAHBErrorTransaction
- *
- * @brief The Master and Slave on the AHB bus interface whose transaction might
- * have resulted in the parity error notification to XScale.
- *
- * NOTE: This information may be used in the data abort exception handler
- * to differentiate between the XScale and non-XScale access to the SDRAM
- * memory.
- */
-typedef struct /**< IxParityENAccAHBErrorTransaction */
-{
- IxParityENAccAHBErrorMaster ahbErrorMaster; /**< Master on AHB bus */
- IxParityENAccAHBErrorSlave ahbErrorSlave; /**< Slave on AHB bus */
-} IxParityENAccAHBErrorTransaction;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @struct IxParityENAccParityErrorContextMessage
- *
- * @brief Parity Error Context Message
- */
-typedef struct /**< IxParityENAccParityErrorContextMessage */
-{
- IxParityENAccParityErrorSource pecParitySource; /**< Source info of parity error */
- IxParityENAccParityErrorAccess pecAccessType; /**< Read or Write Access
- Read - NPE, SWCP, AQM, DDR MCU,
- Exp Bus Ctrlr (Outbound)
- Write - DDR MCU,
- Exp Bus Ctrlr (Inbound
- i.e., External Master) */
- IxParityENAccParityErrorAddress pecAddress; /**< Address faulty location
- Valid only for AQM, DDR MCU,
- Exp Bus Ctrlr */
- IxParityENAccParityErrorData pecData; /**< Data read from the faulty location
- Valid only for AQM and DDR MCU
- For DDR MCU it is the bit location
- of the Single-bit parity */
- IxParityENAccParityErrorRequester pecRequester; /**< Requester of SDRAM memory access
- Valid only for the DDR MCU */
- IxParityENAccAHBErrorTransaction ahbErrorTran; /**< Master and Slave information on the
- last AHB Error Transaction */
-} IxParityENAccParityErrorContextMessage;
-
-/**
- * @ingroup IxParityENAcc
- *
- * @typedef IxParityENAccCallback
- *
- * @brief This prototype shows the format of a callback function.
- *
- * The callback will be used to notify the parity error to the client application.
- * The callback will be registered by @ref ixParityENAccCallbackRegister.
- *
- * It will be called from an ISR when a parity error is detected and thus
- * needs to follow the interrupt callable function conventions.
- *
- */
-typedef void (*IxParityENAccCallback) (void);
-
-
-/*
- * Prototypes for interface functions.
- */
-
-/**
- * @ingroup IxParityENAcc
- *
- * @fn IxParityENAccStatus ixParityENAccInit(void)
- *
- * @brief This function will initialise the IxParityENAcc component.
- *
- * This function will initialise the IxParityENAcc component. It should only be
- * called once, prior to using the IxParityENAcc component.
- *
- * <OL><LI>It initialises the internal data structures, registers the ISR that
- * will be triggered when a parity error occurs in IXP4xx silicon.</LI></OL>
- *
- * @li Re-entrant : No
- * @li ISR Callable : No
- *
- * @return @li IX_PARITYENACC_SUCCESS - Initialization is successful
- * @li IX_PARITYENACC_ALREADY_INITIALISED - The access layer has already
- * been initialized
- * @li IX_PARITYENACC_OPERATION_FAILED - The request failed because the
- * operation didn't succeed on the hardware. Refer to error trace/log
- * for details.
- */
-
-PUBLIC IxParityENAccStatus ixParityENAccInit(void);
-
-/**
- * @ingroup IxParityENAcc
- *
- * @fn IxParityENAccStatus ixParityENAccCallbackRegister (
- IxParityENAccCallback parityErrNfyCallBack)
- *
- * @brief This function will register a new callback with IxParityENAcc component.
- * It can also reregister a new callback replacing the old callback.
- *
- * @param parityErrNfyCallBack [in] - This parameter will specify the call-back
- * function supplied by the client application.
- *
- * This interface registers the user application supplied call-back handler with
- * the parity error handling access component after the init.
- *
- * The callback function will be called from an ISR that will be triggered by the
- * parity error in the IXP400 silicon.
- *
- * The following actions will be performed by this function:
- * <OL><LI>Check for the prior initialisation of the module before registering or
- * re-registering of the callback.
- * Check for parity error detection disabled before re-registration of the callback.
- * </LI></OL>
- *
- * @li Re-entrant : No
- * @li ISR Callable : No
- *
- * @return @li IX_PARITYENACC_SUCCESS - The parameters check passed and the
- * registration is successful.
- * @li IX_PARITYENACC_INVALID_PARAMETERS - Request failed due to NULL
- * parameter passed.
- * @li IX_PARITYENACC_OPERATION_FAILED - The request failed because the
- * parity error detection not yet disabled.
- * @li IX_PARITYENACC_NOT_INITIALISED - The operation requested prior to
- * the initialisation of the access layer.
- */
-
-PUBLIC IxParityENAccStatus ixParityENAccCallbackRegister (
- IxParityENAccCallback parityErrNfyCallBack);
-
-/**
- * @ingroup IxParityENAcc
- *
- * @fn IxParityENAccStatus ixParityENAccParityDetectionConfigure (
- const IxParityENAccHWParityConfig *hwParityConfig)
- *
- * @brief This interface allows the client application to enable the parity
- * error detection on the underlying hardware block.
- *
- * @param hwParityConfig [in] - Hardware blocks for which the parity error
- * detection is to be enabled or disabled.
- *
- * The client application allocates and provides the reference to the buffer.
- *
- * It will also verify whether the specific hardware block is functional or not.
- *
- * NOTE: Failure in enabling or disabling of one or more components result in
- * trace message but still returns IX_PARITYENACC_SUCCESS. Refer to the function
- * @ref ixParityENAccParityDetectionQuery on how to verify the failures while
- * enabling/disabling paritys error detection.
- *
- * It shall be invoked after the Init and CallbackRegister functions but before
- * any other function of the IxParityENAcc layer.
- *
- * @li Re-entrant : No
- * @li ISR Callable : No
- *
- * @return @li IX_PARITYENACC_SUCCESS - The parameters check passed and the
- * request to enable/disable is successful.
- * @li IX_PARITYENACC_INVALID_PARAMETERS-The request failed due to
- * NULL parameter supplied.
- * @li IX_PARITYENACC_OPERATION_FAILED - The request failed because the
- * operation didn't succeed on the hardware.
- * @li IX_PARITYENACC_NOT_INITIALISED - The operation requested prior to
- * the initialisation of the access layer.
- */
-
-PUBLIC IxParityENAccStatus ixParityENAccParityDetectionConfigure (
- const IxParityENAccHWParityConfig *hwParityConfig);
-
-/**
- * @ingroup IxParityENAcc
- *
- * @fn IxParityENAccStatus ixParityENAccParityDetectionQuery (
- IxParityENAccHWParityConfig * const hwParityConfig)
- *
- * @brief This interface allows the client application to determine the
- * status of the parity error detection on the specified hardware blocks
- *
- * @param hwParityConfig [out] - Hardware blocks whose parity error detection
- * has been enabled or disabled.
- *
- * The client application allocates and provides the reference to the buffer.
- *
- * This interface can be used immediately after the interface @ref
- * ixParityENAccParityDetectionConfigure to see on which of the hardware blocks
- * the parity error detection has either been enabled or disabled based on the
- * client application request.
- *
- * @li Re-entrant : No
- * @li ISR Callable : No
- *
- * @return @li IX_PARITYENACC_SUCCESS - The parameters check passed and the
- * request to query on whether the hardware parity error detection
- * is enabled or disabled is successful.
- * @li IX_PARITYENACC_INVALID_PARAMETERS-The request failed due to
- * NULL parameter or invalid values supplied.
- * @li IX_PARITYENACC_NOT_INITIALISED - The operation requested prior
- * to the initialisation of the access layer.
- */
-
-PUBLIC IxParityENAccStatus ixParityENAccParityDetectionQuery(
- IxParityENAccHWParityConfig * const hwParityConfig);
-
-/**
- * @ingroup IxParityENAcc
- *
- * @fn IxParityENAccStatus ixParityENAccParityErrorContextGet(
- IxParityENAccParityErrorContextMessage * const pecMessage)
- *
- * @brief This interface allows the client application to determine the
- * status of the parity error context on hardware block for which the
- * current parity error interrupt triggered.
- *
- * @param pecMessage [out] - The parity error context information of the
- * parity interrupt currently being process.
- *
- * The client application allocates and provides the reference to the buffer.
- *
- * Refer to the data structure @ref IxParityENAccParityErrorContextMessage
- * for details.
- *
- * The routine will will fetch the parity error context in the following
- * priority, if multiple parity errors observed.
- *
- * <pre>
- * 0 - MCU (Multi-bit and single-bit in that order)
- * 1 - NPE-A
- * 2 - NPE-B
- * 3 - NPE-C
- * 4 - SWCP
- * 5 - QM
- * 6 - EXP
- *
- * NOTE: The information provided in the @ref IxParityENAccAHBErrorTransaction
- * may be of help for the client application to decide on the course of action
- * to take. This info is taken from the Performance Monitoring Unit register
- * which records most recent error observed on the AHB bus. This information
- * might have been overwritten by some other error by the time it is retrieved.
- * </pre>
- *
- * @li Re-entrant : No
- * @li ISR Callable : Yes
- *
- * @return @li IX_PARITYENACC_SUCCESS-The parameters check passed and the
- * request to get the parity error context information is successful.
- * @li IX_PARITYENACC_INVALID_PARAMETERS-The request failed due to
- * NULL parameter is passed
- * @li IX_PARITYENACC_OPERATION_FAILED - The request failed because
- * the operation didn't succeed on the hardware.
- * @li IX_PARITYENACC_NOT_INITIALISED - The operation requested prior
- * to the initialisation of the access layer.
- * @li IX_PARITYENACC_NO_PARITY - No parity condition exits or has
- * already been cleared
- */
-
-PUBLIC IxParityENAccStatus ixParityENAccParityErrorContextGet(
- IxParityENAccParityErrorContextMessage * const pecMessage);
-
-/**
- * @ingroup IxParityENAcc
- *
- * @fn IxParityENAccStatus ixParityENAccParityErrorInterruptClear (
- const IxParityENAccParityErrorContextMessage *pecMessage)
- *
- * @brief This interface helps the client application to clear off the
- * interrupt condition on the hardware block identified in the parity
- * error context message. Please refer to the table below as the operation
- * varies depending on the interrupt source.
- *
- * @param pecMessage [in] - The parity error context information of the
- * hardware block whose parity error interrupt condition is to disabled.
- *
- * The client application allocates and provides the reference to the buffer.
- *
- * <pre>
- * ****************************************************************************
- * Following actions will be taken during the interrupt clear for respective
- * hardware blocks.
- *
- * Parity Source Actions taken during Interrupt clear
- * ------------- -------------------------------------------------------
- * NPE-A Interrupt will be masked off at the interrupt controller
- * so that it will not trigger continuously.
- * Client application has to take appropriate action and
- * re-configure the parity error detection subsequently.
- * The client application will not be notified of further
- * interrupts, until the re-configuration is done using
- * @ref ixParityENAccParityDetectionConfigure.
- *
- * NPE-B Interrupt will be masked off at the interrupt controller
- * so that it will not trigger continuously.
- * Client application has to take appropriate action and
- * re-configure the parity error detection subsequently.
- * The client application will not be notified of further
- * interrupts, until the re-configuration is done using
- * @ref ixParityENAccParityDetectionConfigure.
- *
- * NPE-C Interrupt will be masked off at the interrupt controller
- * Client application has to take appropriate action and
- * re-configure the parity error detection subsequently.
- * The client application will not be notified of further
- * interrupts, until the re-configuration is done using
- * @ref ixParityENAccParityDetectionConfigure.
- *
- * SWCP Interrupt will be masked off at the interrupt controller.
- * Client application has to take appropriate action and
- * re-configure the parity error detection subsequently.
- * The client application will not be notified of further
- * interrupts, until the re-configuration is done using
- * @ref ixParityENAccParityDetectionConfigure.
- *
- * AQM Interrupt will be masked off at the interrupt controller.
- * Client application has to take appropriate action and
- * re-configure the parity error detection subsequently.
- * The client application will not be notified of further
- * interrupts, until the re-configuration is done using
- * @ref ixParityENAccParityDetectionConfigure.
- *
- * MCU Parity interrupt condition is cleared at the SDRAM MCU for
- * the following:
- * 1. Single-bit
- * 2. Multi-bit
- * 3. Overflow condition i.e., more than two parity conditions
- * occurred
- * Note that single-parity errors do not result in data abort
- * and not all data aborts caused by multi-bit parity error.
- *
- * EXP Parity interrupt condition is cleared at the expansion bus
- * controller for the following:
- * 1. External master initiated Inbound write
- * 2. Internal master (IXP400) initiated Outbound read
- * ****************************************************************************
- * </pre>
- * @li Re-entrant : No
- * @li ISR Callable : No
- *
- * @return @li IX_PARITYENACC_SUCCESS-The parameters check passed and the request
- * to clear the parity error interrupt condition is successful.
- * @li IX_PARITYENACC_INVALID_PARAMETERS-The request failed due to
- * NULL parameters have been passed or contents have been
- * supplied with invalid values.
- * @li IX_PARITYENACC_OPERATION_FAILED - The request failed because
- * the operation didn't succeed on the hardware.
- * @li IX_PARITYENACC_NOT_INITIALISED - The operation requested prior
- * to the initialisation of the access layer.
- */
-
-PUBLIC IxParityENAccStatus ixParityENAccParityErrorInterruptClear (
- const IxParityENAccParityErrorContextMessage *pecMessage);
-
-/**
- * @ingroup IxParityENAcc
- *
- * @fn IxParityENAccStatus ixParityENAccStatsGet (
- IxParityENAccParityErrorStats * const ixParityErrorStats)
- *
- * @brief This interface allows the client application to retrieve parity
- * error statistics for all the hardware blocks
- *
- * @param ixParityErrorStats - [out] The statistics for all the hardware blocks.
- *
- * The client application allocates and provides the reference to the buffer.
- *
- * @li Re-entrant : No
- * @li ISR Callable : Yes
- *
- * @return @li IX_PARITYENACC_SUCCESS-The parameters check passed and the
- * request to retrieve parity error statistics for the hardware
- * block is successful.
- * @li IX_PARITYENACC_INVALID_PARAMETERS-The request failed due to a
- * NULL parameter passed.
- * @li IX_PARITYENACC_NOT_INITIALISED - The operation requested prior
- * to the initialisation of the access layer.
- */
-
-PUBLIC IxParityENAccStatus ixParityENAccStatsGet (
- IxParityENAccParityErrorStats * const ixParityErrorStats);
-
-/**
- * @ingroup IxParityENAcc
- *
- * @fn IxParityENAccStatus ixParityENAccStatsShow (void)
- *
- * @brief This interface allows the client application to print all the
- * parity error statistics.
- *
- * @li Re-entrant : No
- * @li ISR Callable : No
- *
- * @return @li IX_PARITYENACC_SUCCESS - The request to show the pairty
- * error statistics is successful.
- * @li IX_PARITYENACC_NOT_INITIALISED - The operation requested
- * prior to the initialisation of the access layer.
- */
-
-PUBLIC IxParityENAccStatus ixParityENAccStatsShow (void);
-
-/**
- * @ingroup IxParityENAcc
- *
- * @fn IxParityENAccStatus ixParityENAccStatsReset (void)
- *
- * @brief This interface allows the client application to reset all the
- * parity error statistics.
- *
- * @li Re-entrant : No
- * @li ISR Callable : No
- *
- * @return @li IX_PARITYENACC_SUCCESS - The request to reset the parity
- * error statistics is successful.
- * @li IX_PARITYENACC_NOT_INITIALISED - The operation requested
- * prior to the initialisation of the access layer.
- */
-
-PUBLIC IxParityENAccStatus ixParityENAccStatsReset (void);
-
-#endif /* IXPARITYENACC_H */
-#endif /* __ixp46X */
-
-/**
- * @} defgroup IxParityENAcc
- */
-
diff --git a/cpu/ixp/npe/include/IxPerfProfAcc.h b/cpu/ixp/npe/include/IxPerfProfAcc.h
deleted file mode 100644
index 65c0ba96ab..0000000000
--- a/cpu/ixp/npe/include/IxPerfProfAcc.h
+++ /dev/null
@@ -1,1358 +0,0 @@
-/**
- * @file IxPerfProfAcc.h
- *
- * @brief Header file for the IXP400 Perf Prof component (IxPerfProfAcc)
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxPerfProfAcc IXP400 Performance Profiling (IxPerfProfAcc) API
- *
- * @brief IXP400 Performance Profiling Utility component Public API.
- * @li NOTE: Xcycle measurement is not supported in Linux.
- *
- *
- * @{
- */
-#ifndef IXPERFPROFACC_H
-#define IXPERFPROFACC_H
-
-#include "IxOsal.h"
-
-#ifdef __linux
-#include <linux/proc_fs.h>
-#endif
-
-/*
- * Section for #define
- */
-/**
- * @ingroup IxPerfProfAcc
- *
- * @def IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES
- *
- * @brief This is the maximum number of profiling samples allowed, which can be
- * modified according to the user's discretion
- */
-#define IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES 0xFFFF
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @def IX_PERFPROF_ACC_BUS_PMU_MAX_PECS
- *
- * @brief This is the maximum number of Programmable Event Counters available.
- * This is a hardware specific and fixed value. Do not change.
- *
- */
-#define IX_PERFPROF_ACC_BUS_PMU_MAX_PECS 7
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @def IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS
- *
- * @brief Max number of measurement allowed. This constant is used when
- * creating storage array for Xcycle. When run in continuous mode,
- * Xcycle will wrap around and re-use buffer.
- */
-#define IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS 600
-
-#ifdef __linux
-/**
- * @ingroup IxPerfProfAcc
- *
- * @def IX_PERFPROF_ACC_XSCALE_PMU_SYMBOL_ACCURACY
- *
- * @brief Level of accuracy required for matching the PC Address to
- * symbol address. This is used when the XScale PMU time/event
- * sampling functions get the PC address and search for the
- * corresponding symbol address.
- */
-#define IX_PERFPROF_ACC_XSCALE_PMU_SYMBOL_ACCURACY 0xffff
-
-#endif /*__linux*/
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @def IX_PERFPROF_ACC_LOG
- *
- * @brief Mechanism for logging a formatted message for the PerfProfAcc component
- *
- * @param level UINT32 [in] - trace level
- * @param device UINT32 [in] - output device
- * @param str char* [in] - format string, similar to printf().
- * @param a UINT32 [in] - first argument to display
- * @param b UINT32 [in] - second argument to display
- * @param c UINT32 [in] - third argument to display
- * @param d UINT32 [in] - fourth argument to display
- * @param e UINT32 [in] - fifth argument to display
- * @param f UINT32 [in] - sixth argument to display
- *
- * @return none
- */
-#ifndef NDEBUG
-#define IX_PERFPROF_ACC_LOG(level, device, str, a, b, c, d, e, f)\
- (ixOsalLog (level, device, str, a, b, c, d, e, f))
-#else /*do nothing*/
-#define IX_PERFPROF_ACC_LOG(level, device, str, a, b, c, d, e, f)
-#endif /*ifdef NDEBUG */
-
-/*
- * Section for struct
- */
-
-/**
- * @brief contains summary of samples taken
- *
- * Structure contains all details of each program counter value - frequency
- * that PC occurs
- */
-typedef struct
-{
- UINT32 programCounter; /**<the program counter value of the sample*/
- UINT32 freq; /**<the frequency of the occurence of the sample*/
-} IxPerfProfAccXscalePmuSamplePcProfile;
-
-/**
- * @brief contains results of a counter
- *
- * Structure contains the results of a counter, which are split into the lower
- * and upper 32 bits of the final count
- */
-typedef struct
-{
- UINT32 lower32BitsEventCount; /**<lower 32bits value of the event counter*/
- UINT32 upper32BitsEventCount; /**<upper 32bits value of the event counter*/
-} IxPerfProfAccXscalePmuEvtCnt;
-
-/**
- * @brief contains results of counters and their overflow
- *
- * Structure contains all values of counters and associated overflows. The
- * specific event and clock counters are determined by the user
- */
-typedef struct
-{
- UINT32 clk_value; /**<current value of clock counter*/
- UINT32 clk_samples; /**<number of clock counter overflows*/
- UINT32 event1_value; /**<current value of event 1 counter*/
- UINT32 event1_samples; /**<number of event 1 counter overflows*/
- UINT32 event2_value; /**<current value of event 2 counter*/
- UINT32 event2_samples; /**<number of event 2 counter overflows*/
- UINT32 event3_value; /**<current value of event 3 counter*/
- UINT32 event3_samples; /**<number of event 3 counter overflows*/
- UINT32 event4_value; /**<current value of event 4 counter*/
- UINT32 event4_samples; /**<number of event 4 counter overflows*/
-} IxPerfProfAccXscalePmuResults;
-
-/**
- *
- * @brief Results obtained from Xcycle run
- */
-typedef struct
-{
- float maxIdlePercentage; /**<maximum percentage of Idle cycles*/
- float minIdlePercentage; /**<minimum percentage of Idle cycles*/
- float aveIdlePercentage; /**<average percentage of Idle cycles*/
- UINT32 totalMeasurements; /**<total number of measurement made */
-} IxPerfProfAccXcycleResults;
-
-/**
- *
- * @brief Results obtained from running the Bus Pmu component. The results
- * are obtained when the get functions is called.
- *
- */
-typedef struct
-{
- UINT32 statsToGetLower27Bit[IX_PERFPROF_ACC_BUS_PMU_MAX_PECS]; /**<Lower 27 Bit of counter value */
- UINT32 statsToGetUpper32Bit[IX_PERFPROF_ACC_BUS_PMU_MAX_PECS]; /**<Upper 32 Bit of counter value */
-} IxPerfProfAccBusPmuResults;
-
-/*
- * Section for enum
- */
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @enum IxPerfProfAccBusPmuEventCounters1
- *
- * @brief Type of bus pmu events supported on PEC 1.
- *
- * Lists all bus pmu events.
- */
-typedef enum
-{
- IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEA_GRANT_SELECT = 1, /**< Select North NPEA grant on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEB_GRANT_SELECT, /**< Select North NPEB grant on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEC_GRANT_SELECT, /**< Select North NPEC grant on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_BUS_IDLE_SELECT, /**< Select North bus idle on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEA_REQ_SELECT, /**< Select North NPEA req on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEB_REQ_SELECT, /**< Select North NPEB req on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_NORTH_NPEC_REQ_SELECT, /**< Select North NPEC req on PEC1*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_GSKT_GRANT_SELECT, /**< Select south gasket grant on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_ABB_GRANT_SELECT, /**< Select south abb grant on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_PCI_GRANT_SELECT, /**< Select south pci grant on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_APB_GRANT_SELECT, /**< Select south apb grant on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_GSKT_REQ_SELECT, /**< Select south gasket request on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_ABB_REQ_SELECT, /**< Select south abb request on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_PCI_REQ_SELECT, /**< Select south pci request on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SOUTH_APB_REQ_SELECT, /**< Select south apb request on PEC1*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_0_HIT_SELECT, /**< Select sdram0 hit on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_1_HIT_SELECT, /**< Select sdram1 hit on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_2_HIT_SELECT, /**< Select sdram2 hit on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_3_HIT_SELECT, /**< Select sdram3 hit on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_4_MISS_SELECT, /**< Select sdram4 miss on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_5_MISS_SELECT, /**< Select sdram5 miss on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_6_MISS_SELECT, /**< Select sdram6 miss on PEC1*/
- IX_PERFPROF_ACC_BUS_PMU_PEC1_SDR_7_MISS_SELECT /**< Select sdram7 miss on PEC1*/
-} IxPerfProfAccBusPmuEventCounters1;
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @enum IxPerfProfAccBusPmuEventCounters2
- *
- * @brief Type of bus pmu events supported on PEC 2.
- *
- * Lists all bus pmu events.
- */
-typedef enum
-{
- IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEA_XFER_SELECT = 24, /**< Select North NPEA transfer on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEB_XFER_SELECT, /**< Select North NPEB transfer on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEC_XFER_SELECT, /**< Select North NPEC transfer on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_BUS_WRITE_SELECT, /**< Select North bus write on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEA_OWN_SELECT, /**< Select North NPEA own on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEB_OWN_SELECT, /**< Select North NPEB own on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_NORTH_NPEC_OWN_SELECT, /**< Select North NPEC own on PEC2*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_GSKT_XFER_SELECT, /**< Select South gasket transfer on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_ABB_XFER_SELECT, /**< Select South abb transfer on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_PCI_XFER_SELECT, /**< Select South pci transfer on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_APB_XFER_SELECT, /**< Select South apb transfer on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_GSKT_OWN_SELECT, /**< Select South gasket own on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_ABB_OWN_SELECT, /**< Select South abb own on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_PCI_OWN_SELECT, /**< Select South pci own on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SOUTH_APB_OWN_SELECT, /**< Select South apb own transfer on PEC2*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_1_HIT_SELECT, /**< Select sdram1 hit on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_2_HIT_SELECT, /**< Select sdram2 hit on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_3_HIT_SELECT, /**< Select sdram3 hit on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_4_HIT_SELECT, /**< Select sdram4 hit on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_5_MISS_SELECT, /**< Select sdram5 miss on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_6_MISS_SELECT, /**< Select sdram6 miss on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_7_MISS_SELECT, /**< Select sdram7 miss on PEC2*/
- IX_PERFPROF_ACC_BUS_PMU_PEC2_SDR_0_MISS_SELECT /**< Select sdram0 miss on PEC2*/
-} IxPerfProfAccBusPmuEventCounters2;
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @enum IxPerfProfAccBusPmuEventCounters3
- *
- * @brief Type of bus pmu events supported on PEC 3.
- *
- * Lists all bus pmu events.
- */
-typedef enum
-{
- IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEA_RETRY_SELECT = 47, /**< Select north NPEA retry on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEB_RETRY_SELECT, /**< Select north NPEB retry on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEC_RETRY_SELECT, /**< Select north NPEC retry on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_BUS_READ_SELECT, /**< Select north bus read on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEA_WRITE_SELECT, /**< Select north NPEA write on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEB_WRITE_SELECT, /**< Select north NPEB write on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_NORTH_NPEC_WRITE_SELECT, /**< Select north NPEC wirte on PEC3*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_GSKT_RETRY_SELECT, /**< Select south gasket retry on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_ABB_RETRY_SELECT, /**< Select south abb retry on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_PCI_RETRY_SELECT, /**< Select south pci retry on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_APB_RETRY_SELECT, /**< Select south apb retry on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_GSKT_WRITE_SELECT, /**< Select south gasket write on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_ABB_WRITE_SELECT, /**< Select south abb write on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_PCI_WRITE_SELECT, /**< Select south pci write on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SOUTH_APB_WRITE_SELECT, /**< Select south apb write on PEC3*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_2_HIT_SELECT, /**< Select sdram2 hit on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_3_HIT_SELECT, /**< Select sdram3 hit on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_4_HIT_SELECT, /**< Select sdram4 hit on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_5_HIT_SELECT, /**< Select sdram5 hit on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_6_MISS_SELECT, /**< Select sdram6 miss on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_7_MISS_SELECT, /**< Select sdram7 miss on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_0_MISS_SELECT, /**< Select sdram0 miss on PEC3*/
- IX_PERFPROF_ACC_BUS_PMU_PEC3_SDR_1_MISS_SELECT /**< Select sdram1 miss on PEC3*/
-} IxPerfProfAccBusPmuEventCounters3;
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @enum IxPerfProfAccBusPmuEventCounters4
- *
- * @brief Type of bus pmu events supported on PEC 4.
- *
- * Lists all bus pmu events.
- */
-typedef enum
-{
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_PCI_SPLIT_SELECT = 70, /**< Select south pci split on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_EXP_SPLIT_SELECT, /**< Select south expansion split on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_APB_GRANT_SELECT, /**< Select south apb grant on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_APB_XFER_SELECT, /**< Select south apb transfer on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_GSKT_READ_SELECT, /**< Select south gasket read on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_ABB_READ_SELECT, /**< Select south abb read on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_PCI_READ_SELECT, /**< Select south pci read on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SOUTH_APB_READ_SELECT, /**< Select south apb read on PEC4*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC4_NORTH_ABB_SPLIT_SELECT, /**< Select north abb split on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_NORTH_NPEA_REQ_SELECT, /**< Select north NPEA req on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_NORTH_NPEA_READ_SELECT, /**< Select north NPEA read on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_NORTH_NPEB_READ_SELECT, /**< Select north NPEB read on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_NORTH_NPEC_READ_SELECT, /**< Select north NPEC read on PEC4*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_3_HIT_SELECT, /**< Select sdram3 hit on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_4_HIT_SELECT, /**< Select sdram4 hit on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_5_HIT_SELECT, /**< Select sdram5 hit on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_6_HIT_SELECT, /**< Select sdram6 hit on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_7_MISS_SELECT, /**< Select sdram7 miss on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_0_MISS_SELECT, /**< Select sdram0 miss on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_1_MISS_SELECT, /**< Select sdram1 miss on PEC4*/
- IX_PERFPROF_ACC_BUS_PMU_PEC4_SDR_2_MISS_SELECT /**< Select sdram2 miss on PEC4*/
-} IxPerfProfAccBusPmuEventCounters4;
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @enum IxPerfProfAccBusPmuEventCounters5
- *
- * @brief Type of bus pmu events supported on PEC 5.
- *
- * Lists all bus pmu events.
- */
-typedef enum
-{
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_ABB_GRANT_SELECT = 91, /**< Select south abb grant on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_ABB_XFER_SELECT, /**< Select south abb transfer on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_ABB_RETRY_SELECT, /**< Select south abb retry on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_EXP_SPLIT_SELECT, /**< Select south expansion split on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_ABB_REQ_SELECT, /**< Select south abb request on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_ABB_OWN_SELECT, /**< Select south abb own on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SOUTH_BUS_IDLE_SELECT, /**< Select south bus idle on PEC5*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_GRANT_SELECT, /**< Select north NPEB grant on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_XFER_SELECT, /**< Select north NPEB transfer on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_RETRY_SELECT, /**< Select north NPEB retry on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_REQ_SELECT, /**< Select north NPEB request on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_OWN_SELECT, /**< Select north NPEB own on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_WRITE_SELECT, /**< Select north NPEB write on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_NORTH_NPEB_READ_SELECT, /**< Select north NPEB read on PEC5*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_4_HIT_SELECT, /**< Select north sdram4 hit on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_5_HIT_SELECT, /**< Select north sdram5 hit on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_6_HIT_SELECT, /**< Select north sdram6 hit on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_7_HIT_SELECT, /**< Select north sdram7 hit on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_0_MISS_SELECT, /**< Select north sdram0 miss on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_1_MISS_SELECT, /**< Select north sdram1 miss on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_2_MISS_SELECT, /**< Select north sdram2 miss on PEC5*/
- IX_PERFPROF_ACC_BUS_PMU_PEC5_SDR_3_MISS_SELECT /**< Select north sdram3 miss on PEC5*/
-} IxPerfProfAccBusPmuEventCounters5;
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @enum IxPerfProfAccBusPmuEventCounters6
- *
- * @brief Type of bus pmu events supported on PEC 6.
- *
- * Lists all bus pmu events.
- */
-typedef enum
-{
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_GRANT_SELECT = 113, /**< Select south pci grant on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_XFER_SELECT, /**< Select south pci transfer on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_RETRY_SELECT, /**< Select south pci retry on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_SPLIT_SELECT, /**< Select south pci split on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_REQ_SELECT, /**< Select south pci request on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_PCI_OWN_SELECT, /**< Select south pci own on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SOUTH_BUS_WRITE_SELECT, /**< Select south pci write on PEC6*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_GRANT_SELECT, /**< Select north NPEC grant on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_XFER_SELECT, /**< Select north NPEC transfer on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_RETRY_SELECT, /**< Select north NPEC retry on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_REQ_SELECT, /**< Select north NPEC request on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_OWN_SELECT, /**< Select north NPEC own on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEB_WRITE_SELECT, /**< Select north NPEB write on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_NORTH_NPEC_READ_SELECT, /**< Select north NPEC read on PEC6*/
-
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_5_HIT_SELECT, /**< Select sdram5 hit on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_6_HIT_SELECT, /**< Select sdram6 hit on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_7_HIT_SELECT, /**< Select sdram7 hit on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_0_HIT_SELECT, /**< Select sdram0 hit on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_1_MISS_SELECT, /**< Select sdram1 miss on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_2_MISS_SELECT, /**< Select sdram2 miss on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_3_MISS_SELECT, /**< Select sdram3 miss on PEC6*/
- IX_PERFPROF_ACC_BUS_PMU_PEC6_SDR_4_MISS_SELECT /**< Select sdram4 miss on PEC6*/
-} IxPerfProfAccBusPmuEventCounters6;
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @enum IxPerfProfAccBusPmuEventCounters7
- *
- * @brief Type of bus pmu events supported on PEC 7.
- *
- * Lists all bus pmu events.
- */
-typedef enum
-{
- IX_PERFPROF_ACC_BUS_PMU_PEC7_SOUTH_APB_RETRY_SELECT = 135, /**< Select south apb retry on PEC7*/
- IX_PERFPROF_ACC_BUS_PMU_PEC7_SOUTH_APB_REQ_SELECT, /**< Select south apb request on PEC7*/
- IX_PERFPROF_ACC_BUS_PMU_PEC7_SOUTH_APB_OWN_SELECT, /**< Select south apb own on PEC7*/
- IX_PERFPROF_ACC_BUS_PMU_PEC7_SOUTH_BUS_READ_SELECT, /**< Select south bus read on PEC7*/
- IX_PERFPROF_ACC_BUS_PMU_PEC7_CYCLE_COUNT_SELECT /**< Select cycle count on PEC7*/
-} IxPerfProfAccBusPmuEventCounters7;
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @enum IxPerfProfAccXscalePmuEvent
- *
- * @brief Type of xscale pmu events supported
- *
- * Lists all xscale pmu events. The maximum is a default value that the user
- * should not exceed.
- */
-typedef enum
-{
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_CACHE_MISS=0, /**< cache miss*/
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_CACHE_INSTRUCTION,/**< cache instruction*/
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_STALL, /**< event stall*/
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_INST_TLB_MISS, /**< instruction tlb miss*/
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_DATA_TLB_MISS, /**< data tlb miss*/
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_BRANCH_EXEC, /**< branch executed*/
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_BRANCH_MISPREDICT, /**<branch mispredict*/
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_INST_EXEC, /**< instruction executed*/
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_FULL_EVERYCYCLE, /**<
- *Stall - data cache
- *buffers are full.
- *This event occurs
- *every cycle where
- *condition present
- */
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_ONCE, /**<
- *Stall - data cache buffers are
- *full.This event occurs once
- *for each contiguous sequence
- */
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_DATA_CACHE_ACCESS, /**< data cache access*/
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_DATA_CACHE_MISS, /**< data cache miss*/
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_DATA_CACHE_WRITEBACK, /**<data cache
- *writeback
- */
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_SW_CHANGE_PC, /**< sw change pc*/
- IX_PERFPROF_ACC_XSCALE_PMU_EVENT_MAX /**< max value*/
-} IxPerfProfAccXscalePmuEvent;
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @enum IxPerfProfAccStatus
- *
- * @brief Invalid Status Definitions
- *
- * These status will be used by the APIs to return to the user.
- */
-typedef enum
-{
- IX_PERFPROF_ACC_STATUS_SUCCESS = IX_SUCCESS, /**< success*/
- IX_PERFPROF_ACC_STATUS_FAIL = IX_FAIL, /**< fail*/
- IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS,/**<another utility in
- *progress
- */
- IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS, /**<measurement in
- *progress
- */
- IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE, /**<no baseline yet*/
- IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_REQUEST_OUT_OF_RANGE, /**<
- * Measurement chosen
- * is out of range
- */
- IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_SET_FAIL, /**<
- * Cannot set
- * task priority
- */
- IX_PERFPROF_ACC_STATUS_XCYCLE_THREAD_CREATE_FAIL, /**<
- * Fail create thread
- */
- IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_RESTORE_FAIL, /**<
- *cannot restore
- *priority
- */
- IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_NOT_RUNNING, /**< xcycle not running*/
- IX_PERFPROF_ACC_STATUS_XSCALE_PMU_NUM_INVALID, /**< invalid number
- *entered
- */
- IX_PERFPROF_ACC_STATUS_XSCALE_PMU_EVENT_INVALID, /**< invalid pmu event*/
- IX_PERFPROF_ACC_STATUS_XSCALE_PMU_START_NOT_CALLED, /**<a start process
- *was not called
- *before attempting
- *a stop or results
- *get
- */
- IX_PERFPROF_ACC_STATUS_BUS_PMU_MODE_ERROR, /**< invalid mode*/
- IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC1_ERROR, /**< invalid pec1 entered*/
- IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC2_ERROR, /**< invalid pec2 entered*/
- IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC3_ERROR, /**< invalid pec3 entered*/
- IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC4_ERROR, /**< invalid pec4 entered*/
- IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC5_ERROR, /**< invalid pec5 entered*/
- IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC6_ERROR, /**< invalid pec6 entered*/
- IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC7_ERROR, /**< invalid pec7 entered*/
- IX_PERFPROF_ACC_STATUS_BUS_PMU_START_NOT_CALLED, /**<a start process
- *was not called
- *before attempting
- *a stop
- */
- IX_PERFPROF_ACC_STATUS_COMPONENT_NOT_SUPPORTED /**<Device or OS does not support component*/
-} IxPerfProfAccStatus;
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @enum IxPerfProfAccBusPmuMode
- *
- * @brief State selection of counters.
- *
- * These states will be used to determine the counters whose values are to be
- * read.
- */
-typedef enum
-{
- IX_PERFPROF_ACC_BUS_PMU_MODE_HALT=0, /**< halt state*/
- IX_PERFPROF_ACC_BUS_PMU_MODE_SOUTH, /**< south state*/
- IX_PERFPROF_ACC_BUS_PMU_MODE_NORTH, /**< north state*/
- IX_PERFPROF_ACC_BUS_PMU_MODE_SDRAM /**< SDRAM state*/
-} IxPerfProfAccBusPmuMode;
-
-/*
- * Section for prototypes interface functions
- */
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXscalePmuEventCountStart(
- BOOL clkCntDiv,
- UINT32 numEvents,
- IxPerfProfAccXscalePmuEvent pmuEvent1,
- IxPerfProfAccXscalePmuEvent pmuEvent2,
- IxPerfProfAccXscalePmuEvent pmuEvent3,
- IxPerfProfAccXscalePmuEvent pmuEvent4 )
- *
- * @brief This API will start the clock and event counting
- *
- * @param clkCntDiv BOOL [in] - enables/disables the clock divider. When
- * true, the divider is enabled and the clock count will be incremented
- * by one at each 64th processor clock cycle. When false, the divider
- * is disabled and the clock count will be incremented at every
- * processor clock cycle.
- * @param numEvents UINT32 [in] - the number of PMU events that are to be
- * monitored as specified by the user. For clock counting only, this
- * is set to zero.
- * @param pmuEvent1 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
- * event to be monitored by counter 1
- * @param pmuEvent2 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
- * event to be monitored by counter 2
- * @param pmuEvent3 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
- * event to be monitored by counter 3
- * @param pmuEvent4 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
- * event to be monitored by counter 4
- *
- * This API will start the clock and xscale PMU event counting. Up to
- * 4 events can be monitored simultaneously. This API has to be called before
- * ixPerfProfAccXscalePmuEventCountStop can be called.
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS if clock and events counting are
- * started successfully
- * - IX_PERFPROF_ACC_STATUS_FAIL if unable to start the counting
- * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_NUM_INVALID if the number of events
- * specified is out of the valid range
- * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_EVENT_INVALID if the value of the PMU
- * event specified does not exist
- * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility is
- * running
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IxPerfProfAccStatus
-ixPerfProfAccXscalePmuEventCountStart(
- BOOL clkCntDiv,
- UINT32 numEvents,
- IxPerfProfAccXscalePmuEvent pmuEvent1,
- IxPerfProfAccXscalePmuEvent pmuEvent2,
- IxPerfProfAccXscalePmuEvent pmuEvent3,
- IxPerfProfAccXscalePmuEvent pmuEvent4 );
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXscalePmuEventCountStop (
- IxPerfProfAccXscalePmuResults *eventCountStopResults)
- *
- * @brief This API will stop the clock and event counting
- *
- * @param *eventCountStopResults @ref IxPerfProfAccXscalePmuResults [out] - pointer
- * to struct containing results of counters and their overflow. It is the
- * users's responsibility to allocate the memory for this pointer.
- *
- * This API will stop the clock and xscale PMU events that are being counted.
- * The results of the clock and events count will be stored in the pointer
- * allocated by the user. It can only be called once
- * IxPerfProfAccEventCountStart has been called.
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS if clock and events counting are
- * stopped successfully
- * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_START_NOT_CALLED if
- * ixPerfProfAccXscalePmuEventCountStart is not called first.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-
-PUBLIC IxPerfProfAccStatus
-ixPerfProfAccXscalePmuEventCountStop(
- IxPerfProfAccXscalePmuResults *eventCountStopResults);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXscalePmuTimeSampStart(
- UINT32 samplingRate,
- BOOL clkCntDiv)
- *
- * @brief Starts the time based sampling
- *
- * @param samplingRate UINT32 [in] - sampling rate is the number of
- * clock counts before a counter overflow interrupt is generated,
- * at which, a sample is taken; the rate specified cannot be greater
- * than the counter size of 32bits or set to zero.
- * @param clkCntDiv BOOL [in] - enables/disables the clock divider. When
- * true, the divider is enabled and the clock count will be incremented
- * by one at each 64th processor clock cycle. When false, the divider
- * is disabled and the clock count will be incremented at every
- * processor clock cycle.
- *
- * This API starts the time based sampling to determine the frequency with
- * which lines of code are being executed. Sampling is done at the rate
- * specified by the user. At each sample,the value of the program counter
- * is determined. Each of these occurrences are recorded to determine the
- * frequency with which the Xscale code is being executed. This API has to be
- * called before ixPerfProfAccXscalePmuTimeSampStop can be called.
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS if time based sampling is started
- * successfully
- * - IX_PERFPROF_ACC_STATUS_FAIL if unable to start the sampling
- * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility is
- * running
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IxPerfProfAccStatus
-ixPerfProfAccXscalePmuTimeSampStart(
- UINT32 samplingRate,
- BOOL clkCntDiv);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXscalePmuTimeSampStop(
- IxPerfProfAccXscalePmuEvtCnt *clkCount,
- IxPerfProfAccXscalePmuSamplePcProfile *timeProfile)
- *
- * @brief Stops the time based sampling
- *
- * @param *clkCount @ref IxPerfProfAccXscalePmuEvtCnt [out] - pointer to the
- * struct containing the final clock count and its overflow. It is the
- * user's responsibility to allocate the memory for this pointer.
- * @param *timeProfile @ref IxPerfProfAccXscalePmuSamplePcProfile [out] -
- * pointer to the array of profiles for each program counter value;
- * the user should set the size of the array to
- * IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES. It is the user's
- * responsibility to allocate the memory for this pointer.
- *
- * This API stops the time based sampling. The results are stored in the
- * pointers allocated by the user. It can only be called once
- * ixPerfProfAccXscalePmuTimeSampStart has been called.
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS if time based sampling is stopped
- * successfully
- * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_START_NOT_CALLED if
- * ixPerfProfAccXscalePmuTimeSampStart not called first
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IxPerfProfAccStatus
-ixPerfProfAccXscalePmuTimeSampStop(
- IxPerfProfAccXscalePmuEvtCnt *clkCount,
- IxPerfProfAccXscalePmuSamplePcProfile *timeProfile);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXscalePmuEventSampStart(
- UINT32 numEvents,
- IxPerfProfAccXscalePmuEvent pmuEvent1,
- UINT32 eventRate1,
- IxPerfProfAccXscalePmuEvent pmuEvent2,
- UINT32 eventRate2,
- IxPerfProfAccXscalePmuEvent pmuEvent3,
- UINT32 eventRate3,
- IxPerfProfAccXscalePmuEvent pmuEvent4,
- UINT32 eventRate4)
- *
- * @brief Starts the event based sampling
- *
- * @param numEvents UINT32 [in] - the number of PMU events that are
- * to be monitored as specified by the user. The value should be
- * between 1-4 events at a time.
- * @param pmuEvent1 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
- * event to be monitored by counter 1
- * @param eventRate1 UINT32 [in] - sampling rate of counter 1. The rate is
- * the number of events before a sample taken. If 0 is specified, the
- * the full counter value (0xFFFFFFFF) is used. The rate must not be
- * greater than the full counter value.
- * @param pmuEvent2 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
- * event to be monitored by counter 2
- * @param eventRate2 UINT32 [in] - sampling rate of counter 2. The rate is
- * the number of events before a sample taken. If 0 is specified, the
- * full counter value (0xFFFFFFFF) is used. The rate must not be
- * greater than the full counter value.
- * @param pmuEvent3 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
- * event to be monitored by counter 3
- * @param eventRate3 UINT32 [in] - sampling rate of counter 3. The rate is
- * the number of events before a sample taken. If 0 is specified, the
- * full counter value (0xFFFFFFFF) is used. The rate must not be
- * greater than the full counter value.
- * @param pmuEvent4 @ref IxPerfProfAccXscalePmuEvent [in] - the specific PMU
- * event to be monitored by counter 4
- * @param eventRate4 UINT32 [in] - sampling rate of counter 4. The rate is
- * the number of events before a sample taken. If 0 is specified, the
- * full counter value (0xFFFFFFFF) is used. The rate must not be
- * greater than the full counter value.
- *
- * Starts the event based sampling to determine the frequency with
- * which events are being executed. The sampling rate is the number of events,
- * as specified by the user, before a counter overflow interrupt is
- * generated. A sample is taken at each counter overflow interrupt. At each
- * sample,the value of the program counter determines the corresponding
- * location in the code. Each of these occurrences are recorded to determine
- * the frequency with which the Xscale code in each event is executed. This API
- * has to be called before ixPerfProfAccXscalePmuEventSampStop can be called.
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS if event based sampling is started
- * successfully
- * - IX_PERFPROF_ACC_STATUS_FAIL if unable to start the sampling
- * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_NUM_INVALID if the number of events
- * specified is out of the valid range
- * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_EVENT_INVALID if the value of the
- * PMU event specified does not exist
- * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility is
- * running
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IxPerfProfAccStatus
-ixPerfProfAccXscalePmuEventSampStart(
- UINT32 numEvents,
- IxPerfProfAccXscalePmuEvent pmuEvent1,
- UINT32 eventRate1,
- IxPerfProfAccXscalePmuEvent pmuEvent2,
- UINT32 eventRate2,
- IxPerfProfAccXscalePmuEvent pmuEvent3,
- UINT32 eventRate3,
- IxPerfProfAccXscalePmuEvent pmuEvent4,
- UINT32 eventRate4);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXscalePmuEventSampStop(
- IxPerfProfAccXscalePmuSamplePcProfile *eventProfile1,
- IxPerfProfAccXscalePmuSamplePcProfile *eventProfile2,
- IxPerfProfAccXscalePmuSamplePcProfile *eventProfile3,
- IxPerfProfAccXscalePmuSamplePcProfile *eventProfile4)
- *
- * @brief Stops the event based sampling
- *
- * @param *eventProfile1 @ref IxPerfProfAccXscalePmuSamplePcProfile [out] -
- * pointer to the array of profiles for each program counter value;
- * the user should set the size of the array to
- * IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES. It is the
- * users's responsibility to allocate memory for this pointer.
- * @param *eventProfile2 @ref IxPerfProfAccXscalePmuSamplePcProfile [out] -
- * pointer to the array of profiles for each program counter value;
- * the user should set the size of the array to
- * IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES. It is the
- * users's responsibility to allocate memory for this pointer.
- * @param *eventProfile3 @ref IxPerfProfAccXscalePmuSamplePcProfile [out] -
- * pointer to the array of profiles for each program counter value;
- * the user should set the size of the array to
- * IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES. It is the
- * users's responsibility to allocate memory for this pointer.
- * @param *eventProfile4 @ref IxPerfProfAccXscalePmuSamplePcProfile [out] -
- * pointer to the array of profiles for each program counter value;
- * the user should set the size of the array to
- * IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES. It is the
- * users's responsibility to allocate memory for this pointer.
- *
- * This API stops the event based sampling. The results are stored in the
- * pointers allocated by the user. It can only be called once
- * ixPerfProfAccEventSampStart has been called.
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS if event based sampling is stopped
- * successfully
- * - IX_PERFPROF_ACC_STATUS_XSCALE_PMU_START_NOT_CALLED if
- * ixPerfProfAccEventSampStart not called first.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IxPerfProfAccStatus
-ixPerfProfAccXscalePmuEventSampStop(
- IxPerfProfAccXscalePmuSamplePcProfile *eventProfile1,
- IxPerfProfAccXscalePmuSamplePcProfile *eventProfile2,
- IxPerfProfAccXscalePmuSamplePcProfile *eventProfile3,
- IxPerfProfAccXscalePmuSamplePcProfile *eventProfile4);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXscalePmuResultsGet(IxPerfProfAccXscalePmuResults *results)
- *
- * @brief Reads the current value of the counters and their overflow
- *
- * @param *results @ref IxPerfProfAccXscalePmuResults [out] - pointer to the
- results struct. It is the user's responsibility to allocate memory
- for this pointer
- *
- * This API reads the value of all four event counters and the clock counter,
- * and the associated overflows. It does not give results associated with
- * sampling, i.e. PC and their frequencies. This API can be called at any time
- * once a process has been started. If it is called before a process has started
- * the user should be aware that the values it contains are default values and
- * might be meaningless. The values of the counters are stored in the pointer
- * allocated by the client.
- *
- * @return - none
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC void
-ixPerfProfAccXscalePmuResultsGet(IxPerfProfAccXscalePmuResults *results);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccBusPmuStart(
- IxPerfProfAccBusPmuMode mode,
- IxPerfProfAccBusPmuEventCounters1 pecEvent1,
- IxPerfProfAccBusPmuEventCounters2 pecEvent2,
- IxPerfProfAccBusPmuEventCounters3 pecEvent3,
- IxPerfProfAccBusPmuEventCounters4 pecEvent4,
- IxPerfProfAccBusPmuEventCounters5 pecEvent5,
- IxPerfProfAccBusPmuEventCounters6 pecEvent6,
- IxPerfProfAccBusPmuEventCounters7 pecEvent7)
- * @brief Initializes all the counters and selects events to be monitored.
- *
- * Function initializes all the counters and assigns the events associated
- * with the counters. Users send in the mode and events they want to count.
- * This API verifies if the combination chosen is appropriate
- * and sets all the registers accordingly. Selecting HALT mode will result
- * in an error. User should use ixPerfProfAccBusPmuStop() to HALT.
- *
- *
- * @param mode @ref IxPerfProfAccStateBusPmuMode [in] - Mode selection.
- * @param pecEvent1 @ref IxPerfProfAccBusPmuEventCounters1 [in] - Event for PEC1.
- * @param pecEvent2 @ref IxPerfProfAccBusPmuEventCounters2 [in] - Event for PEC2.
- * @param pecEvent3 @ref IxPerfProfAccBusPmuEventCounters3 [in] - Event for PEC3.
- * @param pecEvent4 @ref IxPerfProfAccBusPmuEventCounters4 [in] - Event for PEC4.
- * @param pecEvent5 @ref IxPerfProfAccBusPmuEventCounters5 [in] - Event for PEC5.
- * @param pecEvent6 @ref IxPerfProfAccBusPmuEventCounters6 [in] - Event for PEC6.
- * @param pecEvent7 @ref IxPerfProfAccBusPmuEventCounters7 [in] - Event for PEC7.
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS - Initialization executed
- * successfully.
- * - IX_PERFPROF_ACC_STATUS_BUS_PMU_MODE_ERROR - Error in selection of
- * mode. Only NORTH, SOUTH and SDRAM modes are allowed.
- * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC1_ERROR - Error in selection of
- * event for PEC1
- * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC2_ERROR - Error in selection of
- * event for PEC2
- * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC3_ERROR - Error in selection of
- * event for PEC3
- * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC4_ERROR - Error in selection of
- * event for PEC4
- * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC5_ERROR - Error in selection of
- * event for PEC5
- * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC6_ERROR - Error in selection of
- * event for PEC6
- * - IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC7_ERROR - Error in selection of
- * event for PEC7
- * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility
- * is running
- * - IX_PERFPROF_ACC_STATUS_FAIL - Failed to start because interrupt
- * service routine fails to bind.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- **/
-PUBLIC
-IxPerfProfAccStatus ixPerfProfAccBusPmuStart (
- IxPerfProfAccBusPmuMode mode,
- IxPerfProfAccBusPmuEventCounters1 pecEvent1,
- IxPerfProfAccBusPmuEventCounters2 pecEvent2,
- IxPerfProfAccBusPmuEventCounters3 pecEvent3,
- IxPerfProfAccBusPmuEventCounters4 pecEvent4,
- IxPerfProfAccBusPmuEventCounters5 pecEvent5,
- IxPerfProfAccBusPmuEventCounters6 pecEvent6,
- IxPerfProfAccBusPmuEventCounters7 pecEvent7);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccBusPmuStop(void)
- * @brief Stops all counters.
- *
- * This function stops all the PECs by setting the halt bit in the ESR.
- *
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS - Counters successfully halted.
- * - IX_PERFPROF_ACC_STATUS_FAIL - Counters could'nt be halted.
- * - IX_PERFPROF_ACC_STATUS_BUS_PMU_START_NOT_CALLED - the
- * ixPerfProfAccBusPmuStart() function is not called.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- **/
-PUBLIC IxPerfProfAccStatus
-ixPerfProfAccBusPmuStop (void);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccBusPmuResultsGet (
- IxPerfProfAccBusPmuResults *busPmuResults)
- * @brief Gets values of all counters
- *
- * This function is responsible for getting all the counter values from the
- * lower API and putting it into an array for the user.
- *
- * @param *busPmuResults @ref IxPerfProfAccBusPmuResults [out]
- * - Pointer to a structure of arrays to store all counter values.
- *
- * @return none
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- **/
-PUBLIC void
-ixPerfProfAccBusPmuResultsGet (IxPerfProfAccBusPmuResults *BusPmuResults);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccBusPmuPMSRGet (
- UINT32 *pmsrValue)
- * @brief Get values of PMSR
- *
- * This API gets the Previous Master Slave Register
- * value and returns it to the calling function. This value indicates
- * which master or slave accessed the north, south bus or sdram last.
- * The value returned by this function is a 32 bit value and is read
- * from location of an offset 0x0024 of the base value.
- *
- * The PMSR value returned indicate the following:
- * <pre>
- *
- * *************************************************************************************
- * * Bit * Name * Description *
- * * *
- * *************************************************************************************
- * * [31:18] *Reserved* *
- * *************************************************************************************
- * * [17:12] * PSS * Indicates which of the slaves on *
- * * * * ARBS was previously *
- * * * * accessed by the AHBS. *
- * * * * [000001] Expansion Bus *
- * * * * [000010] SDRAM Controller *
- * * * * [000100] PCI *
- * * * * [001000] Queue Manager *
- * * * * [010000] AHB-APB Bridge *
- * * * * [100000] Reserved *
- * *************************************************************************************
- * * [11:8] * PSN * Indicates which of the Slaves on *
- * * * * ARBN was previously *
- * * * * accessed the AHBN. *
- * * * * [0001] SDRAM Controller *
- * * * * [0010] AHB-AHB Bridge *
- * * * * [0100] Reserved *
- * * * * [1000] Reserved *
- * *************************************************************************************
- * * [7:4] * PMS * Indicates which of the Masters on *
- * * * * ARBS was previously *
- * * * * accessing the AHBS. *
- * * * * [0001] Gasket *
- * * * * [0010] AHB-AHB Bridge *
- * * * * [0100] PCI *
- * * * * [1000] APB *
- * *************************************************************************************
- * * [3:0] * PMN * Indicates which of the Masters on *
- * * * * ARBN was previously *
- * * * * accessing the AHBN. *
- * * * * [0001] NPEA *
- * * * * [0010] NPEB *
- * * * * [0100] NPEC *
- * * * * [1000] Reserved *
- * *************************************************************************************
- * </pre>
- *
- * @param *pmsrValue UINT32 [out] - Pointer to return PMSR value. Users need to
- * allocate storage for psmrValue.
- *
- * @return none
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- **/
-PUBLIC void
-ixPerfProfAccBusPmuPMSRGet (
-UINT32 *pmsrValue);
-
-
-/**
- * The APIs below are specifically used for Xcycle module.
- **/
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXcycleBaselineRun (
- UINT32 *numBaselineCycle)
- *
- * @brief Perform baseline for Xcycle
- *
- * @param *numBaselineCycle UINT32 [out] - pointer to baseline value after
- * calibration. Calling function are responsible for
- * allocating memory space for this pointer.
- *
- * Global Data :
- * - None.
- *
- * This function MUST be run before the Xcycle tool can be used. This
- * function must be run immediately when the OS boots up with no other
- * addition programs running.
- * Addition note : This API will measure the time needed to perform
- * a fix amount of CPU instructions (~ 1 second worth of loops) as a
- * highest priority task and with interrupt disabled. The time measured
- * is known as the baseline - interpreted as the shortest time
- * needed to complete the amount of CPU instructions. The baseline is
- * returned as unit of time in 66Mhz clock tick.
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful run, result is returned
- * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_SET_FAIL - failed to change
- * task priority
- * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_RESTORE_FAIL - failed to
- * restore task priority
- * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility
- * is running
- * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle
- * tool has already started
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IxPerfProfAccStatus
-ixPerfProfAccXcycleBaselineRun(
- UINT32 *numBaselineCycle);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXcycleStart(
- UINT32 numMeasurementsRequested);
- *
- * @brief Start the measurement
- *
- * @param numMeasurementsRequested UINT32 [in] - number of measurements
- * to perform. Value can be 0 to
- * IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS.
- * 0 indicate continuous measurement.
- *
- * Global Data :
- * - None.
- *
- *
- * Start the measurements immediately.
- * numMeasurementsRequested specifies number of measurements to run.
- * If numMeasurementsRequested is set to 0, the measurement will
- * be performed continuously until IxPerfProfAccXcycleStop()
- * is called.
- * It is estimated that 1 measurement takes approximately 1 second during
- * low CPU utilization, therefore 128 measurement takes approximately 128 sec.
- * When CPU utilization is high, the measurement will take longer.
- * This function spawn a task the perform the measurement and returns.
- * The measurement may continue even if this function returns.
- *
- * IMPORTANT: Under heavy CPU utilization, the task spawn by this
- * function may starve and fail to respond to stop command. User
- * may need to kill the task manually in this case.
- *
- * There are only IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS
- * storage available so storing is wrapped around if measurements are
- * more than IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS.
- *
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful start, a thread is created
- * in the background to perform measurement.
- * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_SET_FAIL - failed to set
- * task priority
- * - IX_PERFPROF_ACC_STATUS_XCYCLE_THREAD_CREATE_FAIL - failed to create
- * thread to perform measurement.
- * - IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE - baseline is not available
- * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_REQUEST_OUT_OF_RANGE -
- * value is larger than IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS
- * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle tool
- * has already started
- * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility is
- * running
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IxPerfProfAccStatus
-ixPerfProfAccXcycleStart (
- UINT32 numMeasurementsRequested);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXcycleStop(void);
- *
- * @brief Stop the Xcycle measurement
- *
- * @param None
- *
- * Global Data :
- * - None.
- *
- * Stop Xcycle measurements immediately. If the measurements have stopped
- * or not started, return IX_PERFPROF_STATUS_XCYCLE_MEASUREMENT_NOT_RUNNING.
- * Note: This function does not stop measurement cold. The measurement thread
- * may need a few seconds to complete the last measurement. User needs to use
- * ixPerfProfAccXcycleInProgress() to determine if measurement is indeed
- * completed.
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful measurement is stopped
- * - IX_PERFPROF_STATUS_XCYCLE_MEASUREMENT_NOT_RUNNING - no measurement running
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IxPerfProfAccStatus
-ixPerfProfAccXcycleStop(void);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXcycleResultsGet(
- IxPerfProfAccXcycleResults *xcycleResult )
- *
- * @brief Get the results of Xcycle measurement
- *
- * @param *xcycleResult @ref IxPerfProfAccXcycleResults [out] - Pointer to
- * results of last measurements. Calling function are
- * responsible for allocating memory space for this pointer.
- *
- * Global Data :
- * - None.
- *
- * Retrieve the results of last measurement. User should use
- * ixPerfProfAccXcycleInProgress() to check if measurement is completed
- * before getting the results.
- *
- * @return
- * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful
- * - IX_PERFPROF_ACC_STATUS_FAIL - result is not complete.
- * - IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE - baseline is performed
- * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle
- * tool is still running
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC IxPerfProfAccStatus
-ixPerfProfAccXcycleResultsGet (
- IxPerfProfAccXcycleResults *xcycleResult);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXcycleInProgress (void)
- *
- * @brief Check if Xcycle is running
- *
- * @param None
- * Global Data :
- * - None.
- *
- * Check if Xcycle measuring task is running.
- *
- * @return
- * - TRUE - Xcycle is running
- * - FALSE - Xcycle is not running
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-PUBLIC BOOL
-ixPerfProfAccXcycleInProgress(void);
-
-#ifdef __linux
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXscalePmuTimeSampCreateProcFile
- *
- * @brief Enables proc file to call module function
- *
- * @param None
- *
- * Global Data :
- * - None.
- *
- * This function is declared globally to enable /proc directory system to call
- * and execute the function when the registered file is called. This function is not meant to
- * be called by the user.
- *
- * @return
- * - Length of data written to file.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-int
-ixPerfProfAccXscalePmuTimeSampCreateProcFile (char *buf, char **start, off_t offset,
- int count, int *eof, void *data);
-
-/**
- * @ingroup IxPerfProfAcc
- *
- * @fn ixPerfProfAccXscalePmuEventSampCreateProcFile
- *
- * @brief Enables proc file to call module function
- *
- * @param None
- *
- * Global Data :
- * - None.
- *
- * This function is declared globally to enable /proc directory system to call
- * and execute the function when the registered file is called. This function is not meant to
- * be called by the user.
- *
- * @return
- * - Length of data written to file.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- */
-int
-ixPerfProfAccXscalePmuEventSampCreateProcFile (char *buf, char **start, off_t offset,
- int count, int *eof, void *data);
-
-
-#endif /* ifdef __linux */
-
-#endif /* ndef IXPERFPROFACC_H */
-
-/**
- *@} defgroup IxPerfProfAcc
- */
-
-
diff --git a/cpu/ixp/npe/include/IxQMgr.h b/cpu/ixp/npe/include/IxQMgr.h
deleted file mode 100644
index c083a2b322..0000000000
--- a/cpu/ixp/npe/include/IxQMgr.h
+++ /dev/null
@@ -1,2210 +0,0 @@
-/**
- * @file IxQMgr.h
- *
- * @date 30-Oct-2001
- *
- * @brief This file contains the public API of IxQMgr component.
- *
- * Some functions contained in this module are inline to achieve better
- * data-path performance. For this to work, the function definitions are
- * contained in this header file. The "normal" use of inline functions
- * is to use the inline functions in the module in which they are
- * defined. In this case these inline functions are used in external
- * modules and therefore the use of "inline extern". What this means
- * is as follows: if a function foo is declared as "inline extern" this
- * definition is only used for inlining, in no case is the function
- * compiled on its own. If the compiler cannot inline the function it
- * becomes an external reference. Therefore in IxQMgrQAccess.c all
- * inline functions are defined without the "inline extern" specifier
- * and so define the external references. In all other source files
- * including this header file, these funtions are defined as "inline
- * extern".
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/* ------------------------------------------------------
- Doxygen group definitions
- ------------------------------------------------------ */
-/**
- * @defgroup IxQMgrAPI IXP400 Queue Manager (IxQMgr) API
- *
- * @brief The public API for the IXP400 QMgr component.
- *
- * IxQMgr is a low level interface to the AHB Queue Manager
- *
- * @{
- */
-
-#ifndef IXQMGR_H
-#define IXQMGR_H
-
-/*
- * User defined include files
- */
-
-#include "IxOsal.h"
-
-/*
- * Define QMgr's IoMem macros, in DC mode if in LE
- * regular if in BE. (Note: For Linux LSP gold release
- * may need to adjust mode.
- */
-#if defined (__BIG_ENDIAN)
-
-#define IX_QMGR_INLINE_READ_LONG IX_OSAL_READ_LONG_BE
-#define IX_QMGR_INLINE_WRITE_LONG IX_OSAL_WRITE_LONG_BE
-
-#else
-
-#define IX_QMGR_INLINE_READ_LONG IX_OSAL_READ_LONG_LE_DC
-#define IX_QMGR_INLINE_WRITE_LONG IX_OSAL_WRITE_LONG_LE_DC
-
-#endif
-
-/*
- * #defines and macros
- */
-
-/**
-*
-* @ingroup IxQMgrAPI
-*
-* @def IX_QMGR_INLINE
-*
-* @brief Inline definition, for inlining of Queue Access functions on API
-*
-* Please read the header information in this file for more details on the
-* use of function inlining in this component.
-*
-*/
-
-#ifndef __wince
-
-#ifdef IXQMGRQACCESS_C
-/* If IXQMGRQACCESS_C is set then the IxQmgrQAccess.c is including this file
- and must instantiate a concrete definition for each inlineable API function
- whether or not that function actually gets inlined. */
-# ifdef NO_INLINE_APIS
-# undef NO_INLINE_APIS
-# endif
-# define IX_QMGR_INLINE /* Empty Define */
-#else
-# ifndef NO_INLINE_APIS
-# define IX_QMGR_INLINE IX_OSAL_INLINE_EXTERN
-# else
-# define IX_QMGR_INLINE /* Empty Define */
-# endif
-#endif
-
-#else /* ndef __wince */
-
-# ifndef NO_INLINE_APIS
-# define NO_INLINE_APIS
-# endif
-# define IX_QMGR_INLINE
-
-#endif
-
-
-/**
-*
-* @ingroup IxQMgrAPI
-*
-* @def IX_QMGR_MAX_NUM_QUEUES
-*
-* @brief Number of queues supported by the AQM.
-*
-* This constant is used to indicate the number of AQM queues
-*
-*/
-#define IX_QMGR_MAX_NUM_QUEUES 64
-
-/**
-*
-* @ingroup IxQMgrAPI
-*
-* @def IX_QMGR_MIN_QID
-*
-* @brief Minimum queue identifier.
-*
-* This constant is used to indicate the smallest queue identifier
-*
-*/
-#define IX_QMGR_MIN_QID IX_QMGR_QUEUE_0
-
-/**
-*
-* @ingroup IxQMgrAPI
-*
-* @def IX_QMGR_MAX_QID
-*
-* @brief Maximum queue identifier.
-*
-* This constant is used to indicate the largest queue identifier
-*
-*/
-#define IX_QMGR_MAX_QID IX_QMGR_QUEUE_63
-
-/**
-*
-* @ingroup IxQMgrAPI
-*
-* @def IX_QMGR_MIN_QUEUPP_QID
-*
-* @brief Minimum queue identifier for reduced functionality queues.
-*
-* This constant is used to indicate Minimum queue identifier for reduced
-* functionality queues
-*
-*/
-#define IX_QMGR_MIN_QUEUPP_QID 32
-
-/**
-*
-* @ingroup IxQMgrAPI
-*
-* @def IX_QMGR_MAX_QNAME_LEN
-*
-* @brief Maximum queue name length.
-*
-* This constant is used to indicate the maximum null terminated string length
-* (excluding '\0') for a queue name
-*
-*/
-#define IX_QMGR_MAX_QNAME_LEN 16
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_WARNING
- *
- * @brief Warning return code.
- *
- * Execution complete, but there is a special case to handle
- *
- */
-#define IX_QMGR_WARNING 2
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_PARAMETER_ERROR
- *
- * @brief Parameter error return code (NULL pointer etc..).
- *
- * parameter error out of range/invalid
- *
- */
-#define IX_QMGR_PARAMETER_ERROR 3
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_INVALID_Q_ENTRY_SIZE
- *
- * @brief Invalid entry size return code.
- *
- * Invalid queue entry size for a queue read/write
- *
- */
-#define IX_QMGR_INVALID_Q_ENTRY_SIZE 4
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_INVALID_Q_ID
- *
- * @brief Invalid queue identifier return code.
- *
- * Invalid queue id, not in range 0-63
- *
- */
-#define IX_QMGR_INVALID_Q_ID 5
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_INVALID_CB_ID
- *
- * @brief Invalid callback identifier return code.
- *
- * Invalid callback id
- */
-#define IX_QMGR_INVALID_CB_ID 6
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_CB_ALREADY_SET
- *
- * @brief Callback set error return code.
- *
- * The specified callback has already been for this queue
- *
- */
-#define IX_QMGR_CB_ALREADY_SET 7
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_NO_AVAILABLE_SRAM
- *
- * @brief Sram consumed return code.
- *
- * All AQM Sram is consumed by queue configuration
- *
- */
-#define IX_QMGR_NO_AVAILABLE_SRAM 8
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_INVALID_INT_SOURCE_ID
- *
- * @brief Invalid queue interrupt source identifier return code.
- *
- * Invalid queue interrupt source given for notification enable
- */
-#define IX_QMGR_INVALID_INT_SOURCE_ID 9
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_INVALID_QSIZE
- *
- * @brief Invalid queue size error code.
- *
- * Invalid queue size not one of 16,32, 64, 128
- *
- *
- */
-#define IX_QMGR_INVALID_QSIZE 10
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_INVALID_Q_WM
- *
- * @brief Invalid queue watermark return code.
- *
- * Invalid queue watermark given for watermark set
- */
-#define IX_QMGR_INVALID_Q_WM 11
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_Q_NOT_CONFIGURED
- *
- * @brief Queue not configured return code.
- *
- * Returned to the client when a function has been called on an unconfigured
- * queue
- *
- */
-#define IX_QMGR_Q_NOT_CONFIGURED 12
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_Q_ALREADY_CONFIGURED
- *
- * @brief Queue already configured return code.
- *
- * Returned to client to indicate that a queue has already been configured
- */
-#define IX_QMGR_Q_ALREADY_CONFIGURED 13
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_Q_UNDERFLOW
- *
- * @brief Underflow return code.
- *
- * Underflow on a queue read has occurred
- *
- */
-#define IX_QMGR_Q_UNDERFLOW 14
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_Q_OVERFLOW
- *
- * @brief Overflow return code.
- *
- * Overflow on a queue write has occurred
- *
- */
-#define IX_QMGR_Q_OVERFLOW 15
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_Q_INVALID_PRIORITY
- *
- * @brief Invalid priority return code.
- *
- * Invalid priority, not one of 0,1,2
- */
-#define IX_QMGR_Q_INVALID_PRIORITY 16
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_ENTRY_INDEX_OUT_OF_BOUNDS
- *
- * @brief Entry index out of bounds return code.
- *
- * Entry index is greater than number of entries in queue.
- */
-#define IX_QMGR_ENTRY_INDEX_OUT_OF_BOUNDS 17
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def ixQMgrDispatcherLoopRun
- *
- * @brief Map old function name ixQMgrDispatcherLoopRun ()
- * to @ref ixQMgrDispatcherLoopRunA0 ().
- *
- */
-#define ixQMgrDispatcherLoopRun ixQMgrDispatcherLoopRunA0
-
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @def IX_QMGR_QUEUE
- *
- * @brief Definition of AQM queue numbers
- *
- */
-#define IX_QMGR_QUEUE_0 (0) /**< Queue Number 0 */
-#define IX_QMGR_QUEUE_1 (1) /**< Queue Number 1 */
-#define IX_QMGR_QUEUE_2 (2) /**< Queue Number 2 */
-#define IX_QMGR_QUEUE_3 (3) /**< Queue Number 3 */
-#define IX_QMGR_QUEUE_4 (4) /**< Queue Number 4 */
-#define IX_QMGR_QUEUE_5 (5) /**< Queue Number 5 */
-#define IX_QMGR_QUEUE_6 (6) /**< Queue Number 6 */
-#define IX_QMGR_QUEUE_7 (7) /**< Queue Number 7 */
-#define IX_QMGR_QUEUE_8 (8) /**< Queue Number 8 */
-#define IX_QMGR_QUEUE_9 (9) /**< Queue Number 9 */
-#define IX_QMGR_QUEUE_10 (10) /**< Queue Number 10 */
-#define IX_QMGR_QUEUE_11 (11) /**< Queue Number 11 */
-#define IX_QMGR_QUEUE_12 (12) /**< Queue Number 12 */
-#define IX_QMGR_QUEUE_13 (13) /**< Queue Number 13 */
-#define IX_QMGR_QUEUE_14 (14) /**< Queue Number 14 */
-#define IX_QMGR_QUEUE_15 (15) /**< Queue Number 15 */
-#define IX_QMGR_QUEUE_16 (16) /**< Queue Number 16 */
-#define IX_QMGR_QUEUE_17 (17) /**< Queue Number 17 */
-#define IX_QMGR_QUEUE_18 (18) /**< Queue Number 18 */
-#define IX_QMGR_QUEUE_19 (19) /**< Queue Number 19 */
-#define IX_QMGR_QUEUE_20 (20) /**< Queue Number 20 */
-#define IX_QMGR_QUEUE_21 (21) /**< Queue Number 21 */
-#define IX_QMGR_QUEUE_22 (22) /**< Queue Number 22 */
-#define IX_QMGR_QUEUE_23 (23) /**< Queue Number 23 */
-#define IX_QMGR_QUEUE_24 (24) /**< Queue Number 24 */
-#define IX_QMGR_QUEUE_25 (25) /**< Queue Number 25 */
-#define IX_QMGR_QUEUE_26 (26) /**< Queue Number 26 */
-#define IX_QMGR_QUEUE_27 (27) /**< Queue Number 27 */
-#define IX_QMGR_QUEUE_28 (28) /**< Queue Number 28 */
-#define IX_QMGR_QUEUE_29 (29) /**< Queue Number 29 */
-#define IX_QMGR_QUEUE_30 (30) /**< Queue Number 30 */
-#define IX_QMGR_QUEUE_31 (31) /**< Queue Number 31 */
-#define IX_QMGR_QUEUE_32 (32) /**< Queue Number 32 */
-#define IX_QMGR_QUEUE_33 (33) /**< Queue Number 33 */
-#define IX_QMGR_QUEUE_34 (34) /**< Queue Number 34 */
-#define IX_QMGR_QUEUE_35 (35) /**< Queue Number 35 */
-#define IX_QMGR_QUEUE_36 (36) /**< Queue Number 36 */
-#define IX_QMGR_QUEUE_37 (37) /**< Queue Number 37 */
-#define IX_QMGR_QUEUE_38 (38) /**< Queue Number 38 */
-#define IX_QMGR_QUEUE_39 (39) /**< Queue Number 39 */
-#define IX_QMGR_QUEUE_40 (40) /**< Queue Number 40 */
-#define IX_QMGR_QUEUE_41 (41) /**< Queue Number 41 */
-#define IX_QMGR_QUEUE_42 (42) /**< Queue Number 42 */
-#define IX_QMGR_QUEUE_43 (43) /**< Queue Number 43 */
-#define IX_QMGR_QUEUE_44 (44) /**< Queue Number 44 */
-#define IX_QMGR_QUEUE_45 (45) /**< Queue Number 45 */
-#define IX_QMGR_QUEUE_46 (46) /**< Queue Number 46 */
-#define IX_QMGR_QUEUE_47 (47) /**< Queue Number 47 */
-#define IX_QMGR_QUEUE_48 (48) /**< Queue Number 48 */
-#define IX_QMGR_QUEUE_49 (49) /**< Queue Number 49 */
-#define IX_QMGR_QUEUE_50 (50) /**< Queue Number 50 */
-#define IX_QMGR_QUEUE_51 (51) /**< Queue Number 51 */
-#define IX_QMGR_QUEUE_52 (52) /**< Queue Number 52 */
-#define IX_QMGR_QUEUE_53 (53) /**< Queue Number 53 */
-#define IX_QMGR_QUEUE_54 (54) /**< Queue Number 54 */
-#define IX_QMGR_QUEUE_55 (55) /**< Queue Number 55 */
-#define IX_QMGR_QUEUE_56 (56) /**< Queue Number 56 */
-#define IX_QMGR_QUEUE_57 (57) /**< Queue Number 57 */
-#define IX_QMGR_QUEUE_58 (58) /**< Queue Number 58 */
-#define IX_QMGR_QUEUE_59 (59) /**< Queue Number 59 */
-#define IX_QMGR_QUEUE_60 (60) /**< Queue Number 60 */
-#define IX_QMGR_QUEUE_61 (61) /**< Queue Number 61 */
-#define IX_QMGR_QUEUE_62 (62) /**< Queue Number 62 */
-#define IX_QMGR_QUEUE_63 (63) /**< Queue Number 63 */
-#define IX_QMGR_QUEUE_INVALID (64) /**< AQM Queue Number Delimiter */
-
-
-/*
- * Typedefs
- */
-
-/**
- * @typedef IxQMgrQId
- *
- * @ingroup IxQMgrAPI
- *
- * @brief Used in the API to identify the AQM queues.
- *
- */
-typedef int IxQMgrQId;
-
-/**
- * @typedef IxQMgrQStatus
- *
- * @ingroup IxQMgrAPI
- *
- * @brief Queue status.
- *
- * A queues status is defined by its relative fullness or relative emptiness.
- * Each of the queues 0-31 have Nearly Empty, Nearly Full, Empty, Full,
- * Underflow and Overflow status flags. Queues 32-63 have just Nearly Empty and
- * Full status flags.
- * The flags bit positions are outlined below:
- *
- * OF - bit-5<br>
- * UF - bit-4<br>
- * F - bit-3<br>
- * NF - bit-2<br>
- * NE - bit-1<br>
- * E - bit-0<br>
- *
- */
-typedef UINT32 IxQMgrQStatus;
-
-/**
- * @enum IxQMgrQStatusMask
- *
- * @ingroup IxQMgrAPI
- *
- * @brief Queue status mask.
- *
- * Masks for extracting the individual status flags from the IxQMgrStatus
- * word.
- *
- */
-typedef enum
-{
- IX_QMGR_Q_STATUS_E_BIT_MASK = 0x1,
- IX_QMGR_Q_STATUS_NE_BIT_MASK = 0x2,
- IX_QMGR_Q_STATUS_NF_BIT_MASK = 0x4,
- IX_QMGR_Q_STATUS_F_BIT_MASK = 0x8,
- IX_QMGR_Q_STATUS_UF_BIT_MASK = 0x10,
- IX_QMGR_Q_STATUS_OF_BIT_MASK = 0x20
-} IxQMgrQStatusMask;
-
-/**
- * @enum IxQMgrSourceId
- *
- * @ingroup IxQMgrAPI
- *
- * @brief Queue interrupt source select.
- *
- * This enum defines the different source conditions on a queue that result in
- * an interupt being fired by the AQM. Interrupt source is configurable for
- * queues 0-31 only. The interrupt source for queues 32-63 is hardwired to the
- * NE(Nearly Empty) status flag.
- *
- */
-typedef enum
-{
- IX_QMGR_Q_SOURCE_ID_E = 0, /**< Queue Empty due to last read */
- IX_QMGR_Q_SOURCE_ID_NE, /**< Queue Nearly Empty due to last read */
- IX_QMGR_Q_SOURCE_ID_NF, /**< Queue Nearly Full due to last write */
- IX_QMGR_Q_SOURCE_ID_F, /**< Queue Full due to last write */
- IX_QMGR_Q_SOURCE_ID_NOT_E, /**< Queue Not Empty due to last write */
- IX_QMGR_Q_SOURCE_ID_NOT_NE, /**< Queue Not Nearly Empty due to last write */
- IX_QMGR_Q_SOURCE_ID_NOT_NF, /**< Queue Not Nearly Full due to last read */
- IX_QMGR_Q_SOURCE_ID_NOT_F /**< Queue Not Full due to last read */
-} IxQMgrSourceId;
-
-/**
- * @enum IxQMgrQEntrySizeInWords
- *
- * @ingroup IxQMgrAPI
- *
- * @brief QMgr queue entry sizes.
- *
- * The entry size of a queue specifies the size of a queues entry in words.
- *
- */
-typedef enum
-{
- IX_QMGR_Q_ENTRY_SIZE1 = 1, /**< 1 word entry */
- IX_QMGR_Q_ENTRY_SIZE2 = 2, /**< 2 word entry */
- IX_QMGR_Q_ENTRY_SIZE4 = 4 /**< 4 word entry */
-} IxQMgrQEntrySizeInWords;
-
-/**
- * @enum IxQMgrQSizeInWords
- *
- * @ingroup IxQMgrAPI
- *
- * @brief QMgr queue sizes.
- *
- * These values define the allowed queue sizes for AQM queue. The sizes are
- * specified in words.
- *
- */
-typedef enum
-{
- IX_QMGR_Q_SIZE16 = 16, /**< 16 word buffer */
- IX_QMGR_Q_SIZE32 = 32, /**< 32 word buffer */
- IX_QMGR_Q_SIZE64 = 64, /**< 64 word buffer */
- IX_QMGR_Q_SIZE128 = 128, /**< 128 word buffer */
- IX_QMGR_Q_SIZE_INVALID = 129 /**< Insure that this is greater than largest
- * queue size supported by the hardware
- */
-} IxQMgrQSizeInWords;
-
-/**
- * @enum IxQMgrWMLevel
- *
- * @ingroup IxQMgrAPI
- *
- * @brief QMgr watermark levels.
- *
- * These values define the valid watermark levels(in ENTRIES) for queues. Each
- * queue 0-63 have configurable Nearly full and Nearly empty watermarks. For
- * queues 32-63 the Nearly full watermark has NO EFFECT.
- * If the Nearly full watermark is set to IX_QMGR_Q_WM_LEVEL16 this means that
- * the nearly full flag will be set by the hardware when there are >= 16 empty
- * entries in the specified queue.
- * If the Nearly empty watermark is set to IX_QMGR_Q_WM_LEVEL16 this means that
- * the Nearly empty flag will be set by the hardware when there are <= 16 full
- * entries in the specified queue.
- */
-typedef enum
-{
- IX_QMGR_Q_WM_LEVEL0 = 0, /**< 0 entry watermark */
- IX_QMGR_Q_WM_LEVEL1 = 1, /**< 1 entry watermark */
- IX_QMGR_Q_WM_LEVEL2 = 2, /**< 2 entry watermark */
- IX_QMGR_Q_WM_LEVEL4 = 4, /**< 4 entry watermark */
- IX_QMGR_Q_WM_LEVEL8 = 8, /**< 8 entry watermark */
- IX_QMGR_Q_WM_LEVEL16 = 16, /**< 16 entry watermark */
- IX_QMGR_Q_WM_LEVEL32 = 32, /**< 32 entry watermark */
- IX_QMGR_Q_WM_LEVEL64 = 64 /**< 64 entry watermark */
-} IxQMgrWMLevel;
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @enum IxQMgrDispatchGroup
- *
- * @brief QMgr dispatch group select identifiers.
- *
- * This enum defines the groups over which the dispatcher will process when
- * called. One of the enum values must be used as a input to
- * @a ixQMgrDispatcherLoopRunA0, @a ixQMgrDispatcherLoopRunB0
- * or @a ixQMgrDispatcherLoopRunB0LLP.
- *
- */
-typedef enum
-{
- IX_QMGR_QUELOW_GROUP = 0, /**< Queues 0-31 */
- IX_QMGR_QUEUPP_GROUP /**< Queues 32-63 */
-} IxQMgrDispatchGroup;
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @enum IxQMgrPriority
- *
- * @brief Dispatcher priority levels.
- *
- * This enum defines the different queue dispatch priority levels.
- * The lowest priority number (0) is the highest priority level.
- *
- */
-typedef enum
-{
- IX_QMGR_Q_PRIORITY_0 = 0, /**< Priority level 0 */
- IX_QMGR_Q_PRIORITY_1, /**< Priority level 1 */
- IX_QMGR_Q_PRIORITY_2, /**< Priority level 2 */
- IX_QMGR_Q_PRIORITY_INVALID /**< Invalid Priority level */
-} IxQMgrPriority;
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @enum IxQMgrType
- *
- * @brief Callback types as used with livelock prevention
- *
- * This enum defines the different callback types.
- * These types are only used when Livelock prevention is enabled.
- * The default is IX_QMGR_TYPE_REALTIME_OTHER.
- *
- */
-
-typedef enum
-{
- IX_QMGR_TYPE_REALTIME_OTHER = 0, /**< Real time callbacks-always allowed run*/
- IX_QMGR_TYPE_REALTIME_PERIODIC, /**< Periodic callbacks-always allowed run */
- IX_QMGR_TYPE_REALTIME_SPORADIC /**< Sporadic callbacks-only run if no
- periodic callbacks are in progress */
-} IxQMgrType;
-
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @typedef IxQMgrCallbackId
- *
- * @brief Uniquely identifies a callback function.
- *
- * A unique callback identifier associated with each callback
- * registered by clients.
- *
- */
-typedef unsigned IxQMgrCallbackId;
-
-/**
- * @typedef IxQMgrCallback
- *
- * @brief QMgr notification callback type.
- *
- * This defines the interface to all client callback functions.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier
- * @param cbId @ref IxQMgrCallbackId [in] - the callback identifier
- */
-typedef void (*IxQMgrCallback)(IxQMgrQId qId,
- IxQMgrCallbackId cbId);
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @typedef IxQMgrDispatcherFuncPtr
- *
- * @brief QMgr Dispatcher Loop function pointer.
- *
- * This defines the interface for QMgr Dispather functions.
- *
- * @param group @ref IxQMgrDispatchGroup [in] - the group of the
- * queue of which the dispatcher will run
- */
-typedef void (*IxQMgrDispatcherFuncPtr)(IxQMgrDispatchGroup group);
-
-/*
- * Function Prototypes
- */
-
-/* ------------------------------------------------------------
- Initialisation related functions
- ---------------------------------------------------------- */
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrInit (void)
- *
- * @brief Initialise the QMgr.
- *
- * This function must be called before and other QMgr function. It
- * sets up internal data structures.
- *
- * @return @li IX_SUCCESS, the IxQMgr successfully initialised
- * @return @li IX_FAIL, failed to initialize the Qmgr
- *
- */
-PUBLIC IX_STATUS
-ixQMgrInit (void);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrUnload (void)
- *
- * @brief Uninitialise the QMgr.
- *
- * This function will perform the tasks required to unload the QMgr component
- * cleanly. This includes unmapping kernel memory.
- * This should be called before a soft reboot or unloading of a kernel module.
- *
- * @pre It should only be called if @ref ixQMgrInit has already been called.
- *
- * @post No QMgr functions should be called until ixQMgrInit is called again.
- *
- * @return @li IX_SUCCESS, the IxQMgr successfully uninitialised
- * @return @li IX_FAIL, failed to uninitialize the Qmgr
- *
- */
-PUBLIC IX_STATUS
-ixQMgrUnload (void);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrShow (void)
- *
- * @brief Describe queue configuration and statistics for active queues.
- *
- * This function shows active queues, their configurations and statistics.
- *
- * @return @li void
- *
- */
-PUBLIC void
-ixQMgrShow (void);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQShow (IxQMgrQId qId)
- *
- * @brief Display aqueue configuration and statistics for a queue.
- *
- * This function shows queue configuration and statistics for a queue.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- *
- * @return @li IX_SUCCESS, success
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId
- *
- */
-PUBLIC IX_STATUS
-ixQMgrQShow (IxQMgrQId qId);
-
-
-/* ------------------------------------------------------------
- Configuration related functions
- ---------------------------------------------------------- */
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQConfig (char *qName,
- IxQMgrQId qId,
- IxQMgrQSizeInWords qSizeInWords,
- IxQMgrQEntrySizeInWords qEntrySizeInWords)
- *
- * @brief Configure an AQM queue.
- *
- * This function is called by a client to setup a queue. The size and entrySize
- * qId and qName(NULL pointer) are checked for valid values. This function must
- * be called for each queue, before any queue accesses are made and after
- * ixQMgrInit() has been called. qName is assumed to be a '\0' terminated array
- * of 16 charachters or less.
- *
- * @param *qName char [in] - is the name provided by the client and is associated
- * with a QId by the QMgr.
- * @param qId @ref IxQMgrQId [in] - the qId of this queue
- * @param qSizeInWords @ref IxQMgrQSize [in] - the size of the queue can be one of 16,32
- * 64, 128 words.
- * @param qEntrySizeInWords @ref IxQMgrQEntrySizeInWords [in] - the size of a queue entry
- * can be one of 1,2,4 words.
- *
- * @return @li IX_SUCCESS, a specified queue has been successfully configured.
- * @return @li IX_FAIL, IxQMgr has not been initialised.
- * @return @li IX_QMGR_PARAMETER_ERROR, invalid parameter(s).
- * @return @li IX_QMGR_INVALID_QSIZE, invalid queue size
- * @return @li IX_QMGR_INVALID_Q_ID, invalid queue id
- * @return @li IX_QMGR_INVALID_Q_ENTRY_SIZE, invalid queue entry size
- * @return @li IX_QMGR_Q_ALREADY_CONFIGURED, queue already configured
- *
- */
-PUBLIC IX_STATUS
-ixQMgrQConfig (char *qName,
- IxQMgrQId qId,
- IxQMgrQSizeInWords qSizeInWords,
- IxQMgrQEntrySizeInWords qEntrySizeInWords);
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQSizeInEntriesGet (IxQMgrQId qId,
- unsigned *qSizeInEntries)
- *
- * @brief Return the size of a queue in entries.
- *
- * This function returns the the size of the queue in entriese.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier
- * @param *qSizeInEntries @ref IxQMgrQSize [out] - queue size in entries
- *
- * @return @li IX_SUCCESS, successfully retrieved the number of full entrie
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId
- * @return @li IX_QMGR_PARAMETER_ERROR, invalid parameter(s).
- *
- */
-PUBLIC IX_STATUS
-ixQMgrQSizeInEntriesGet (IxQMgrQId qId,
- unsigned *qSizeInEntries);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrWatermarkSet (IxQMgrQId qId,
- IxQMgrWMLevel ne,
- IxQMgrWMLevel nf)
- *
- * @brief Set the Nearly Empty and Nearly Full Watermarks fo a queue.
- *
- * This function is called by a client to set the watermarks NE and NF for the
- * queue specified by qId.
- * The queue must be empty at the time this function is called, it is the clients
- * responsibility to ensure that the queue is empty.
- * This function will read the status of the queue before the watermarks are set
- * and again after the watermarks are set. If the status register has changed,
- * due to a queue access by an NPE for example, a warning is returned.
- * Queues 32-63 only support the NE flag, therefore the value of nf will be ignored
- * for these queues.
- *
- * @param qId @ref IxQMgrQId [in] - the QId of the queue.
- * @param ne @ref IxQMgrWMLevel [in] - the NE(Nearly Empty) watermark for this
- * queue. Valid values are 0,1,2,4,8,16,32 and
- * 64 entries.
- * @param nf @ref IxQMgrWMLevel [in] - the NF(Nearly Full) watermark for this queue.
- * Valid values are 0,1,2,4,8,16,32 and 64
- * entries.
- *
- * @return @li IX_SUCCESS, watermarks have been set for the queu
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId
- * @return @li IX_QMGR_INVALID_Q_WM, invalid watermark
- * @return @li IX_QMGR_WARNING, the status register may not be constistent
- *
- */
-PUBLIC IX_STATUS
-ixQMgrWatermarkSet (IxQMgrQId qId,
- IxQMgrWMLevel ne,
- IxQMgrWMLevel nf);
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrAvailableSramAddressGet (UINT32 *address,
- unsigned *sizeOfFreeSram)
- *
- * @brief Return the address of available AQM SRAM.
- *
- * This function returns the starting address in AQM SRAM not used by the
- * current queue configuration and should only be called after all queues
- * have been configured.
- * Calling this function before all queues have been configured will will return
- * the currently available SRAM. A call to configure another queue will use some
- * of the available SRAM.
- * The amount of SRAM available is specified in sizeOfFreeSram. The address is the
- * address of the bottom of available SRAM. Available SRAM extends from address
- * from address to address + sizeOfFreeSram.
- *
- * @param **address UINT32 [out] - the address of the available SRAM, NULL if
- * none available.
- * @param *sizeOfFreeSram unsigned [out]- the size in words of available SRAM
- *
- * @return @li IX_SUCCESS, there is available SRAM and is pointed to by address
- * @return @li IX_QMGR_PARAMETER_ERROR, invalid parameter(s)
- * @return @li IX_QMGR_NO_AVAILABLE_SRAM, all AQM SRAM is consumed by the queue
- * configuration.
- *
- */
-PUBLIC IX_STATUS
-ixQMgrAvailableSramAddressGet (UINT32 *address,
- unsigned *sizeOfFreeSram);
-
-
-/* ------------------------------------------------------------
- Queue access related functions
- ---------------------------------------------------------- */
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQReadWithChecks (IxQMgrQId qId,
- UINT32 *entry)
- *
- * @brief Read an entry from a queue.
- *
- * This function reads an entire entry from a queue returning it in entry. The
- * queue configuration word is read to determine what entry size this queue is
- * configured for and then the number of words specified by the entry size is
- * read. entry must be a pointer to a previously allocated array of sufficient
- * size to hold an entry.
- *
- * @note - IX_QMGR_Q_UNDERFLOW is only returned for queues 0-31 as queues 32-63
- * do not have an underflow status maintained.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- * @param *entry UINT32 [out] - pointer to the entry word(s).
- *
- * @return @li IX_SUCCESS, entry was successfully read.
- * @return @li IX_QMGR_PARAMETER_ERROR, invalid paramter(s).
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId
- * @return @li IX_QMGR_Q_UNDERFLOW, attempt to read from an empty queue
- *
- */
-PUBLIC IX_STATUS
-ixQMgrQReadWithChecks (IxQMgrQId qId,
- UINT32 *entry);
-
-
-
-/**
- * @brief Internal structure to facilitate inlining functions in IxQMgr.h
- */
-typedef struct
-{
- /* fields related to write functions */
- UINT32 qOflowStatBitMask; /**< overflow status mask */
- UINT32 qWriteCount; /**< queue write count */
-
- /* fields related to read and write functions */
- volatile UINT32 *qAccRegAddr; /**< access register */
- volatile UINT32 *qUOStatRegAddr; /**< status register */
- volatile UINT32 *qConfigRegAddr; /**< config register */
- UINT32 qEntrySizeInWords; /**< queue entry size in words */
- UINT32 qSizeInEntries; /**< queue size in entries */
-
- /* fields related to read functions */
- UINT32 qUflowStatBitMask; /**< underflow status mask */
- UINT32 qReadCount; /**< queue read count */
-} IxQMgrQInlinedReadWriteInfo;
-
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQReadMWordsMinus1 (IxQMgrQId qId,
- UINT32 *entry)
- *
- * @brief This function reads the remaining of the q entry
- * for queues configured with many words.
- * (the first word of the entry is already read
- * in the inlined function and the entry pointer already
- * incremented
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- * @param *entry UINT32 [out] - pointer to the entry word(s).
- *
- * @return @li IX_SUCCESS, entry was successfully read.
- * @return @li IX_QMGR_Q_UNDERFLOW, attempt to read from an empty queue
- *
- */
-PUBLIC IX_STATUS
-ixQMgrQReadMWordsMinus1 (IxQMgrQId qId,
- UINT32 *entry);
-
-
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQRead (IxQMgrQId qId,
- UINT32 *entry)
- *
- * @brief Fast read of an entry from a queue.
- *
- * This function is a heavily streamlined version of ixQMgrQReadWithChecks(),
- * but performs essentially the same task. It reads an entire entry from a
- * queue, returning it in entry which must be a pointer to a previously
- * allocated array of sufficient size to hold an entry.
- *
- * @note - This function is inlined, to reduce unnecessary function call
- * overhead. It does not perform any parameter checks, or update any statistics.
- * Also, it does not check that the queue specified by qId has been configured.
- * or is in range. It simply reads an entry from the queue, and checks for
- * underflow.
- *
- * @note - IX_QMGR_Q_UNDERFLOW is only returned for queues 0-31 as queues 32-63
- * do not have an underflow status maintained.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- * @param *entry UINT32 [out] - pointer to the entry word(s).
- *
- * @return @li IX_SUCCESS, entry was successfully read.
- * @return @li IX_QMGR_Q_UNDERFLOW, attempt to read from an empty queue
- *
- */
-#ifdef NO_INLINE_APIS
-PUBLIC IX_STATUS
-ixQMgrQRead (IxQMgrQId qId,
- UINT32 *entryPtr);
-#else
-extern IxQMgrQInlinedReadWriteInfo ixQMgrQInlinedReadWriteInfo[];
-extern IX_STATUS ixQMgrQReadMWordsMinus1 (IxQMgrQId qId, UINT32 *entryPtr);
-
-IX_QMGR_INLINE PUBLIC IX_STATUS
-ixQMgrQRead (IxQMgrQId qId,
- UINT32 *entryPtr);
-#endif
-
-IX_QMGR_INLINE PUBLIC IX_STATUS
-ixQMgrQRead (IxQMgrQId qId,
- UINT32 *entryPtr)
-#ifdef NO_INLINE_APIS
- ;
-#else
-{
- IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- UINT32 entry, entrySize;
-
- /* get a new entry */
- entrySize = infoPtr->qEntrySizeInWords;
- entry = IX_QMGR_INLINE_READ_LONG(infoPtr->qAccRegAddr);
-
- if (entrySize != IX_QMGR_Q_ENTRY_SIZE1)
- {
- *entryPtr = entry;
- /* process the remaining part of the entry */
- return ixQMgrQReadMWordsMinus1(qId, entryPtr);
- }
-
- /* underflow is available for lower queues only */
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- /* the counter of queue entries is decremented. In happy
- * day scenario there are many entries in the queue
- * and the counter does not reach zero.
- */
- if (infoPtr->qReadCount-- == 0)
- {
- /* There is maybe no entry in the queue
- * qReadCount is now negative, but will be corrected before
- * the function returns.
- */
- UINT32 qPtrs; /* queue internal pointers */
-
- /* when a queue is empty, the hw guarantees to return
- * a null value. If the value is not null, the queue is
- * not empty.
- */
- if (entry == 0)
- {
- /* get the queue status */
- UINT32 status = IX_QMGR_INLINE_READ_LONG(infoPtr->qUOStatRegAddr);
-
- /* check the underflow status */
- if (status & infoPtr->qUflowStatBitMask)
- {
- /* the queue is empty
- * clear the underflow status bit if it was set
- */
- IX_QMGR_INLINE_WRITE_LONG(infoPtr->qUOStatRegAddr,
- status & ~infoPtr->qUflowStatBitMask);
- *entryPtr = 0;
- infoPtr->qReadCount = 0;
- return IX_QMGR_Q_UNDERFLOW;
- }
- }
- /* store the result */
- *entryPtr = entry;
-
- /* No underflow occured : someone is filling the queue
- * or the queue contains null entries.
- * The current counter needs to be
- * updated from the current number of entries in the queue
- */
-
- /* get snapshot of queue pointers */
- qPtrs = IX_QMGR_INLINE_READ_LONG(infoPtr->qConfigRegAddr);
-
- /* Mod subtraction of pointers to get number of words in Q. */
- qPtrs = (qPtrs - (qPtrs >> 7)) & 0x7f;
-
- if (qPtrs == 0)
- {
- /* no entry in the queue */
- infoPtr->qReadCount = 0;
- }
- else
- {
- /* convert the number of words inside the queue
- * to a number of entries
- */
- infoPtr->qReadCount = qPtrs & (infoPtr->qSizeInEntries - 1);
- }
- return IX_SUCCESS;
- }
- }
- *entryPtr = entry;
- return IX_SUCCESS;
-}
-#endif
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQBurstRead (IxQMgrQId qId,
- UINT32 numEntries,
- UINT32 *entries)
- *
- * @brief Read a number of entries from an AQM queue.
- *
- * This function will burst read a number of entries from the specified queue.
- * The entry size of queue is auto-detected. The function will attempt to
- * read as many entries as specified by the numEntries parameter and will
- * return an UNDERFLOW if any one of the individual entry reads fail.
- *
- * @warning
- * IX_QMGR_Q_UNDERFLOW is only returned for queues 0-31 as queues 32-63
- * do not have an underflow status maintained, hence there is a potential for
- * silent failure here. This function must be used with caution.
- *
- * @note
- * This function is intended for fast draining of queues, so to make it
- * as efficient as possible, it has the following features:
- * - This function is inlined, to reduce unnecessary function call overhead.
- * - It does not perform any parameter checks, or update any statistics.
- * - It does not check that the queue specified by qId has been configured.
- * - It does not check that the queue has the number of full entries that
- * have been specified to be read. It will read until it finds a NULL entry or
- * until the number of specified entries have been read. It always checks for
- * underflow after all the reads have been performed.
- * Therefore, the client should ensure before calling this function that there
- * are enough entries in the queue to read. ixQMgrQNumEntriesGet() will
- * provide the number of full entries in a queue.
- * ixQMgrQRead() or ixQMgrQReadWithChecks(), which only reads
- * a single queue entry per call, should be used instead if the user requires
- * checks for UNDERFLOW after each entry read.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- * @param numEntries unsigned [in] - the number of entries to read.
- * This number should be greater than 0
- * @param *entries UINT32 [out] - the word(s) read.
- *
- * @return @li IX_SUCCESS, entries were successfully read.
- * @return @li IX_QMGR_Q_UNDERFLOW, attempt to read from an empty queue
- *
- */
-#ifdef NO_INLINE_APIS
-PUBLIC IX_STATUS
-ixQMgrQBurstRead (IxQMgrQId qId,
- UINT32 numEntries,
- UINT32 *entries);
-#else
-IX_QMGR_INLINE PUBLIC IX_STATUS
-ixQMgrQBurstRead (IxQMgrQId qId,
- UINT32 numEntries,
- UINT32 *entries);
-#endif /* endif NO_INLINE_APIS */
-
-IX_QMGR_INLINE PUBLIC IX_STATUS
-ixQMgrQBurstRead (IxQMgrQId qId,
- UINT32 numEntries,
- UINT32 *entries)
-#ifdef NO_INLINE_APIS
-;
-#else
-{
- IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- UINT32 nullCheckEntry;
-
- if (infoPtr->qEntrySizeInWords == IX_QMGR_Q_ENTRY_SIZE1)
- {
- volatile UINT32 *qAccRegAddr = infoPtr->qAccRegAddr;
-
- /* the code is optimized to take care of data dependencies:
- * Durig a read, there are a few cycles needed to get the
- * read complete. During these cycles, it is poossible to
- * do some CPU, e.g. increment pointers and decrement
- * counters.
- */
-
- /* fetch a queue entry */
- nullCheckEntry = IX_QMGR_INLINE_READ_LONG(infoPtr->qAccRegAddr);
-
- /* iterate the specified number of queue entries */
- while (--numEntries)
- {
- /* check the result of the previous read */
- if (nullCheckEntry == 0)
- {
- /* if we read a NULL entry, stop. We have underflowed */
- break;
- }
- else
- {
- /* write the entry */
- *entries = nullCheckEntry;
- /* fetch next entry */
- nullCheckEntry = IX_QMGR_INLINE_READ_LONG(qAccRegAddr);
- /* increment the write address */
- entries++;
- }
- }
- /* write the pre-fetched entry */
- *entries = nullCheckEntry;
- }
- else
- {
- IxQMgrQEntrySizeInWords entrySizeInWords = infoPtr->qEntrySizeInWords;
- /* read the specified number of queue entries */
- nullCheckEntry = 0;
- while (numEntries--)
- {
- UINT32 i;
-
- for (i = 0; i < (UINT32)entrySizeInWords; i++)
- {
- *entries = IX_QMGR_INLINE_READ_LONG(infoPtr->qAccRegAddr + i);
- nullCheckEntry |= *entries++;
- }
-
- /* if we read a NULL entry, stop. We have underflowed */
- if (nullCheckEntry == 0)
- {
- break;
- }
- nullCheckEntry = 0;
- }
- }
-
- /* reset the current read count : next access to the read function
- * will force a underflow status check
- */
- infoPtr->qReadCount = 0;
-
- /* Check if underflow occurred on the read */
- if (nullCheckEntry == 0 && qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- /* get the queue status */
- UINT32 status = IX_QMGR_INLINE_READ_LONG(infoPtr->qUOStatRegAddr);
-
- if (status & infoPtr->qUflowStatBitMask)
- {
- /* clear the underflow status bit if it was set */
- IX_QMGR_INLINE_WRITE_LONG(infoPtr->qUOStatRegAddr,
- status & ~infoPtr->qUflowStatBitMask);
- return IX_QMGR_Q_UNDERFLOW;
- }
- }
-
- return IX_SUCCESS;
-}
-#endif
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQPeek (IxQMgrQId qId,
- unsigned int entryIndex,
- UINT32 *entry)
- *
- * @brief Read an entry from a queue without moving the read pointer.
- *
- * This function inspects an entry in a queue. The entry is inspected directly
- * in AQM SRAM and is not read from queue access registers. The entry is NOT removed
- * from the queue and the read/write pointers are unchanged.
- * N.B: The queue should not be accessed when this function is called.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- * @param entryIndex unsigned int [in] - index of entry in queue in the range
- * [0].......[current number of entries in queue].
- * @param *entry UINT32 [out] - pointer to the entry word(s).
- *
- * @return @li IX_SUCCESS, entry was successfully inspected.
- * @return @li IX_QMGR_PARAMETER_ERROR, invalid paramter(s).
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId.
- * @return @li IX_QMGR_ENTRY_INDEX_OUT_OF_BOUNDS, an entry does not exist at
- * specified index.
- * @return @li IX_FAIL, failed to inpected the queue entry.
- */
-PUBLIC IX_STATUS
-ixQMgrQPeek (IxQMgrQId qId,
- unsigned int entryIndex,
- UINT32 *entry);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQWriteWithChecks (IxQMgrQId qId,
- UINT32 *entry)
- *
- * @brief Write an entry to an AQM queue.
- *
- * This function will write the entry size number of words pointed to by entry to
- * the queue specified by qId. The queue configuration word is read to
- * determine the entry size of queue and the corresponding number of words is
- * then written to the queue.
- *
- * @note - IX_QMGR_Q_OVERFLOW is only returned for queues 0-31 as queues 32-63
- * do not have an overflow status maintained.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- * @param *entry UINT32 [in] - the word(s) to write.
- *
- * @return @li IX_SUCCESS, value was successfully written.
- * @return @li IX_QMGR_PARAMETER_ERROR, invalid paramter(s).
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId
- * @return @li IX_QMGR_Q_OVERFLOW, attempt to write to a full queue
- *
- */
-PUBLIC IX_STATUS
-ixQMgrQWriteWithChecks (IxQMgrQId qId,
- UINT32 *entry);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQWrite (IxQMgrQId qId,
- UINT32 *entry)
- *
- * @brief Fast write of an entry to a queue.
- *
- * This function is a heavily streamlined version of ixQMgrQWriteWithChecks(),
- * but performs essentially the same task. It will write the entry size number
- * of words pointed to by entry to the queue specified by qId.
- *
- * @note - This function is inlined, to reduce unnecessary function call
- * overhead. It does not perform any parameter checks, or update any
- * statistics. Also, it does not check that the queue specified by qId has
- * been configured. It simply writes an entry to the queue, and checks for
- * overflow.
- *
- * @note - IX_QMGR_Q_OVERFLOW is only returned for queues 0-31 as queues 32-63
- * do not have an overflow status maintained.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- * @param *entry UINT32 [in] - pointer to the entry word(s).
- *
- * @return @li IX_SUCCESS, entry was successfully read.
- * @return @li IX_QMGR_Q_OVERFLOW, attempt to write to a full queue
- *
- */
-#ifdef NO_INLINE_APIS
-PUBLIC IX_STATUS
-ixQMgrQWrite (IxQMgrQId qId,
- UINT32 *entry);
-#else
-IX_QMGR_INLINE PUBLIC IX_STATUS
-ixQMgrQWrite (IxQMgrQId qId,
- UINT32 *entry);
-#endif /* NO_INLINE_APIS */
-
-IX_QMGR_INLINE PUBLIC IX_STATUS
-ixQMgrQWrite (IxQMgrQId qId,
- UINT32 *entry)
-#ifdef NO_INLINE_APIS
- ;
-#else
-{
- IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- UINT32 entrySize;
-
- /* write the entry */
- IX_QMGR_INLINE_WRITE_LONG(infoPtr->qAccRegAddr, *entry);
- entrySize = infoPtr->qEntrySizeInWords;
-
- if (entrySize != IX_QMGR_Q_ENTRY_SIZE1)
- {
- /* process the remaining part of the entry */
- volatile UINT32 *qAccRegAddr = infoPtr->qAccRegAddr;
- while (--entrySize)
- {
- ++entry;
- IX_QMGR_INLINE_WRITE_LONG(++qAccRegAddr, *entry);
- }
- entrySize = infoPtr->qEntrySizeInWords;
- }
-
- /* overflow is available for lower queues only */
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- UINT32 qSize = infoPtr->qSizeInEntries;
- /* increment the current number of entries in the queue
- * and check for overflow
- */
- if (infoPtr->qWriteCount++ == qSize)
- {
- /* the queue may have overflow */
- UINT32 qPtrs; /* queue internal pointers */
-
- /* get the queue status */
- UINT32 status = IX_QMGR_INLINE_READ_LONG(infoPtr->qUOStatRegAddr);
-
- /* read the status twice because the status may
- * not be immediately ready after the write operation
- */
- if ((status & infoPtr->qOflowStatBitMask) ||
- ((status = IX_QMGR_INLINE_READ_LONG(infoPtr->qUOStatRegAddr))
- & infoPtr->qOflowStatBitMask))
- {
- /* the queue is full, clear the overflow status
- * bit if it was set
- */
- IX_QMGR_INLINE_WRITE_LONG(infoPtr->qUOStatRegAddr,
- status & ~infoPtr->qOflowStatBitMask);
- infoPtr->qWriteCount = infoPtr->qSizeInEntries;
- return IX_QMGR_Q_OVERFLOW;
- }
- /* No overflow occured : someone is draining the queue
- * and the current counter needs to be
- * updated from the current number of entries in the queue
- */
-
- /* get q pointer snapshot */
- qPtrs = IX_QMGR_INLINE_READ_LONG(infoPtr->qConfigRegAddr);
-
- /* Mod subtraction of pointers to get number of words in Q. */
- qPtrs = (qPtrs - (qPtrs >> 7)) & 0x7f;
-
- if (qPtrs == 0)
- {
- /* the queue may be full at the time of the
- * snapshot. Next access will check
- * the overflow status again.
- */
- infoPtr->qWriteCount = qSize;
- }
- else
- {
- /* convert the number of words to a number of entries */
- if (entrySize == IX_QMGR_Q_ENTRY_SIZE1)
- {
- infoPtr->qWriteCount = qPtrs & (qSize - 1);
- }
- else
- {
- infoPtr->qWriteCount = (qPtrs / entrySize) & (qSize - 1);
- }
- }
- }
- }
- return IX_SUCCESS;
-}
-#endif
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQBurstWrite (IxQMgrQId qId,
- unsigned numEntries,
- UINT32 *entries)
- *
- * @brief Write a number of entries to an AQM queue.
- *
- * This function will burst write a number of entries to the specified queue.
- * The entry size of queue is auto-detected. The function will attempt to
- * write as many entries as specified by the numEntries parameter and will
- * return an OVERFLOW if any one of the individual entry writes fail.
- *
- * @warning
- * IX_QMGR_Q_OVERFLOW is only returned for queues 0-31 as queues 32-63
- * do not have an overflow status maintained, hence there is a potential for
- * silent failure here. This function must be used with caution.
- *
- * @note
- * This function is intended for fast population of queues, so to make it
- * as efficient as possible, it has the following features:
- * - This function is inlined, to reduce unnecessary function call overhead.
- * - It does not perform any parameter checks, or update any statistics.
- * - It does not check that the queue specified by qId has been configured.
- * - It does not check that the queue has enough free space to hold the entries
- * before writing, and only checks for overflow after all writes have been
- * performed. Therefore, the client should ensure before calling this function
- * that there is enough free space in the queue to hold the number of entries
- * to be written. ixQMgrQWrite() or ixQMgrQWriteWithChecks(), which only writes
- * a single queue entry per call, should be used instead if the user requires
- * checks for OVERFLOW after each entry written.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- * @param numEntries unsigned [in] - the number of entries to write.
- * @param *entries UINT32 [in] - the word(s) to write.
- *
- * @return @li IX_SUCCESS, value was successfully written.
- * @return @li IX_QMGR_Q_OVERFLOW, attempt to write to a full queue
- *
- */
-#ifdef NO_INLINE_APIS
-PUBLIC IX_STATUS
-ixQMgrQBurstWrite (IxQMgrQId qId,
- unsigned numEntries,
- UINT32 *entries);
-#else
-IX_QMGR_INLINE PUBLIC IX_STATUS
-ixQMgrQBurstWrite (IxQMgrQId qId,
- unsigned numEntries,
- UINT32 *entries);
-#endif /* NO_INLINE_APIS */
-
-IX_QMGR_INLINE PUBLIC IX_STATUS
-ixQMgrQBurstWrite (IxQMgrQId qId,
- unsigned numEntries,
- UINT32 *entries)
-#ifdef NO_INLINE_APIS
-;
-#else
-{
- IxQMgrQInlinedReadWriteInfo *infoPtr = &ixQMgrQInlinedReadWriteInfo[qId];
- UINT32 status;
-
- /* update the current write count */
- infoPtr->qWriteCount += numEntries;
-
- if (infoPtr->qEntrySizeInWords == IX_QMGR_Q_ENTRY_SIZE1)
- {
- volatile UINT32 *qAccRegAddr = infoPtr->qAccRegAddr;
- while (numEntries--)
- {
- IX_QMGR_INLINE_WRITE_LONG(qAccRegAddr, *entries);
- entries++;
- }
- }
- else
- {
- IxQMgrQEntrySizeInWords entrySizeInWords = infoPtr->qEntrySizeInWords;
- UINT32 i;
-
- /* write each queue entry */
- while (numEntries--)
- {
- /* write the queueEntrySize number of words for each entry */
- for (i = 0; i < (UINT32)entrySizeInWords; i++)
- {
- IX_QMGR_INLINE_WRITE_LONG((infoPtr->qAccRegAddr + i), *entries);
- entries++;
- }
- }
- }
-
- /* check if the write count overflows */
- if (infoPtr->qWriteCount > infoPtr->qSizeInEntries)
- {
- /* reset the current write count */
- infoPtr->qWriteCount = infoPtr->qSizeInEntries;
- }
-
- /* Check if overflow occurred on the write operation */
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- /* get the queue status */
- status = IX_QMGR_INLINE_READ_LONG(infoPtr->qUOStatRegAddr);
-
- /* read the status twice because the status may
- * not be ready at the time of the write
- */
- if ((status & infoPtr->qOflowStatBitMask) ||
- ((status = IX_QMGR_INLINE_READ_LONG(infoPtr->qUOStatRegAddr))
- & infoPtr->qOflowStatBitMask))
- {
- /* clear the underflow status bit if it was set */
- IX_QMGR_INLINE_WRITE_LONG(infoPtr->qUOStatRegAddr,
- status & ~infoPtr->qOflowStatBitMask);
- return IX_QMGR_Q_OVERFLOW;
- }
- }
-
- return IX_SUCCESS;
-}
-#endif
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQPoke (IxQMgrQId qId,
- unsigned int entryIndex,
- UINT32 *entry)
- *
- * @brief Write an entry to a queue without moving the write pointer.
- *
- * This function modifies an entry in a queue. The entry is modified directly
- * in AQM SRAM and not using the queue access registers. The entry is NOT added to the
- * queue and the read/write pointers are unchanged.
- * N.B: The queue should not be accessed when this function is called.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- * @param entryIndex unsigned int [in] - index of entry in queue in the range
- * [0].......[current number of entries in queue].
- * @param *entry UINT32 [in] - pointer to the entry word(s).
- *
- * @return @li IX_SUCCESS, entry was successfully modified.
- * @return @li IX_QMGR_PARAMETER_ERROR, invalid paramter(s).
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId.
- * @return @li IX_QMGR_ENTRY_INDEX_OUT_OF_BOUNDS, an entry does not exist at
- * specified index.
- * @return @li IX_FAIL, failed to modify the queue entry.
- */
-PUBLIC IX_STATUS
-ixQMgrQPoke (IxQMgrQId qId,
- unsigned int entryIndex,
- UINT32 *entry);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQNumEntriesGet (IxQMgrQId qId,
- unsigned *numEntries)
- *
- * @brief Get a snapshot of the number of entries in a queue.
- *
- * This function gets the number of entries in a queue.
- *
- * @param qId @ref IxQMgrQId [in] qId - the queue idenfifier
- * @param *numEntries unsigned [out] - the number of entries in a queue
- *
- * @return @li IX_SUCCESS, got the number of entries for the queue
- * @return @li IX_QMGR_PARAMETER_ERROR, invalid paramter(s).
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, the specified qId has not been configured
- * @return @li IX_QMGR_WARNING, could not determine num entries at this time
- *
- */
-PUBLIC IX_STATUS
-ixQMgrQNumEntriesGet (IxQMgrQId qId,
- unsigned *numEntries);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQStatusGetWithChecks (IxQMgrQId qId,
- IxQMgrQStatus *qStatus)
- *
- * @brief Get a queues status.
- *
- * This function reads the specified queues status. A queues status is defined
- * by its status flags. For queues 0-31 these flags are E,NE,NF,F. For
- * queues 32-63 these flags are NE and F.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- * @param &qStatus @ref IxQMgrQStatus [out] - the status of the specified queue.
- *
- * @return @li IX_SUCCESS, queue status was successfully read.
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, the specified qId has not been configured
- * @return @li IX_QMGR_PARAMETER_ERROR, invalid paramter.
- *
- */
-PUBLIC IX_STATUS
-ixQMgrQStatusGetWithChecks (IxQMgrQId qId,
- IxQMgrQStatus *qStatus);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrQStatusGet (IxQMgrQId qId,
- IxQMgrQStatus *qStatus)
- *
- * @brief Fast get of a queue's status.
- *
- * This function is a streamlined version of ixQMgrQStatusGetWithChecks(), but
- * performs essentially the same task. It reads the specified queue's status.
- * A queues status is defined by its status flags. For queues 0-31 these flags
- * are E,NE,NF,F. For queues 32-63 these flags are NE and F.
- *
- * @note - This function is inlined, to reduce unnecessary function call
- * overhead. It does not perform any parameter checks, or update any
- * statistics. Also, it does not check that the queue specified by qId has
- * been configured. It simply reads the specified queue's status.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier.
- * @param *qStatus @ref IxQMgrQStatus [out] - the status of the specified queue.
- *
- * @return @li void.
- *
- */
-
-#ifdef NO_INLINE_APIS
-PUBLIC IX_STATUS
-ixQMgrQStatusGet (IxQMgrQId qId,
- IxQMgrQStatus *qStatus);
-#else
-extern UINT32 ixQMgrAqmIfQueLowStatRegAddr[];
-extern UINT32 ixQMgrAqmIfQueLowStatBitsOffset[];
-extern UINT32 ixQMgrAqmIfQueLowStatBitsMask;
-extern UINT32 ixQMgrAqmIfQueUppStat0RegAddr;
-extern UINT32 ixQMgrAqmIfQueUppStat1RegAddr;
-extern UINT32 ixQMgrAqmIfQueUppStat0BitMask[];
-extern UINT32 ixQMgrAqmIfQueUppStat1BitMask[];
-
-IX_QMGR_INLINE PUBLIC IX_STATUS
-ixQMgrQStatusGet (IxQMgrQId qId,
- IxQMgrQStatus *qStatus);
-#endif /* endif NO_INLINE_APIS */
-
-IX_QMGR_INLINE PUBLIC IX_STATUS
-ixQMgrQStatusGet (IxQMgrQId qId,
- IxQMgrQStatus *qStatus)
-#ifdef NO_INLINE_APIS
- ;
-#else
-{
- /* read the status of a queue in the range 0-31 */
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- volatile UINT32 *lowStatRegAddr = (UINT32*)ixQMgrAqmIfQueLowStatRegAddr[qId];
-
- UINT32 lowStatBitsOffset = ixQMgrAqmIfQueLowStatBitsOffset[qId];
- UINT32 lowStatBitsMask = ixQMgrAqmIfQueLowStatBitsMask;
-
- /* read the status register for this queue */
- *qStatus = IX_QMGR_INLINE_READ_LONG(lowStatRegAddr);
-
- /* mask out the status bits relevant only to this queue */
- *qStatus = (*qStatus >> lowStatBitsOffset) & lowStatBitsMask;
-
- }
- else /* read status of a queue in the range 32-63 */
- {
-
- volatile UINT32 *qNearEmptyStatRegAddr = (UINT32*)ixQMgrAqmIfQueUppStat0RegAddr;
- volatile UINT32 *qFullStatRegAddr = (UINT32*)ixQMgrAqmIfQueUppStat1RegAddr;
- int maskIndex = qId - IX_QMGR_MIN_QUEUPP_QID;
- UINT32 qNearEmptyStatBitMask = ixQMgrAqmIfQueUppStat0BitMask[maskIndex];
- UINT32 qFullStatBitMask = ixQMgrAqmIfQueUppStat1BitMask[maskIndex];
-
- /* Reset the status bits */
- *qStatus = 0;
-
- /* Check if the queue is nearly empty */
- if (IX_QMGR_INLINE_READ_LONG(qNearEmptyStatRegAddr) & qNearEmptyStatBitMask)
- {
- *qStatus |= IX_QMGR_Q_STATUS_NE_BIT_MASK;
- }
-
- /* Check if the queue is full */
- if (IX_QMGR_INLINE_READ_LONG(qFullStatRegAddr) & qFullStatBitMask)
- {
- *qStatus |= IX_QMGR_Q_STATUS_F_BIT_MASK;
- }
- }
- return IX_SUCCESS;
-}
-#endif
-
-/* ------------------------------------------------------------
- Queue dispatch related functions
- ---------------------------------------------------------- */
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrDispatcherPrioritySet (IxQMgrQId qId,
- IxQMgrPriority priority)
- *
- * @brief Set the dispatch priority of a queue.
- *
- * This function is called to set the dispatch priority of queue. The effect of
- * this function is to add a priority change request to a queue. This queue is
- * serviced by @a ixQMgrDispatcherLoopRunA0, @a ixQMgrDispatcherLoopRunB0 or
- * @a ixQMgrDispatcherLoopRunB0LLP.
- *
- * This function is re-entrant. and can be used from an interrupt context
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier
- * @param priority @ref IxQMgrPriority [in] - the new queue dispatch priority
- *
- * @return @li IX_SUCCESS, priority change request is queued
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, the specified qId has not been configured
- * @return @li IX_QMGR_Q_INVALID_PRIORITY, specified priority is invalid
- *
- */
-PUBLIC IX_STATUS
-ixQMgrDispatcherPrioritySet (IxQMgrQId qId,
- IxQMgrPriority priority);
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrNotificationEnable (IxQMgrQId qId,
- IxQMgrSourceId sourceId)
- *
- * @brief Enable notification on a queue for a specified queue source flag.
- *
- * This function is called by a client of the QMgr to enable notifications on a
- * specified condition.
- * If the condition for the notification is set after the client has called this
- * function but before the function has enabled the interrupt source, then the
- * notification will not occur.
- * For queues 32-63 the notification source is fixed to the NE(Nearly Empty) flag
- * and cannot be changed so the sourceId parameter is ignored for these queues.
- * The status register is read before the notofication is enabled and is read again
- * after the notification has been enabled, if they differ then the warning status
- * is returned.
- *
- * This function is re-entrant. and can be used from an interrupt context
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier
- * @param sourceId @ref IxQMgrSourceId [in] - the interrupt src condition identifier
- *
- * @return @li IX_SUCCESS, the interrupt has been enabled for the specified source
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, the specified qId has not been configured
- * @return @li IX_QMGR_INVALID_INT_SOURCE_ID, interrupt source invalid for this queue
- * @return @li IX_QMGR_WARNING, the status register may not be constistent
- *
- */
-PUBLIC IX_STATUS
-ixQMgrNotificationEnable (IxQMgrQId qId,
- IxQMgrSourceId sourceId);
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrNotificationDisable (IxQMgrQId qId)
- *
- * @brief Disable notifications on a queue.
- *
- * This function is called to disable notifications on a specified queue.
- *
- * This function is re-entrant. and can be used from an interrupt context
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier
- *
- * @return @li IX_SUCCESS, the interrupt has been disabled
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, the specified qId has not been configured
- *
- */
-PUBLIC IX_STATUS
-ixQMgrNotificationDisable (IxQMgrQId qId);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrDispatcherLoopRunA0 (IxQMgrDispatchGroup group)
- *
- * @brief Run the callback dispatcher.
- *
- * This function runs the dispatcher for a group of queues.
- * Callbacks are made for interrupts that have occurred on queues within
- * the group that have registered callbacks. The order in which queues are
- * serviced depends on the queue priorities set by the client.
- * This function may be called from interrupt or task context.
- * For optimisations that were introduced in IXP42X B0 and supported IXP46X
- * the @a ixQMgrDispatcherLoopRunB0, or @a ixQMgrDispatcherLoopRunB0LLP
- * should be used.
- *
- * This function is not re-entrant.
- *
- * @param group @ref IxQMgrDispatchGroup [in] - the group of queues over which the
- * dispatcher will run
- *
- * @return @li void
- *
- * @note This function may be called from interrupt or task context.
- * However, for optimal performance the choice of context depends also on the
- * operating system used.
- *
- */
-PUBLIC void
-ixQMgrDispatcherLoopRunA0 (IxQMgrDispatchGroup group);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrDispatcherLoopRunB0 (IxQMgrDispatchGroup group)
- *
- * @brief Run the callback dispatcher.
- *
- * The enhanced version of @a ixQMgrDispatcherLoopRunA0 that is optimised for
- * features introduced in IXP42X B0 silicon and supported on IXP46X.
- * This is the default dispatcher for IXP42X B0 and IXP46X silicon.
- * The function runs the dispatcher for a group of queues.
- * Callbacks are made for interrupts that have occurred on queues within
- * the group that have registered callbacks. The order in which queues are
- * serviced depends on the queue priorities set by the client.
- * This function may be called from interrupt or task context.
- *
- * This function is not re-entrant.
- *
- * @param group @ref IxQMgrDispatchGroup [in] - the group of queues over which the
- * dispatcher will run
- *
- * @return @li void
- *
- *
- * @note This function may be called from interrupt or task context.
- * However, for optimal performance the choice of context depends also on the
- * operating system used.
- *
- */
-PUBLIC void
-ixQMgrDispatcherLoopRunB0 (IxQMgrDispatchGroup group);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrDispatcherLoopRunB0LLP (IxQMgrDispatchGroup group)
- *
- * @brief Run the callback dispatcher.
- *
- * This is a version of the optimised dispatcher for IXP42X B0 and IXP46X,
- * @a ixQMgrDispatcherLoopRunB0, with added support for livelock prevention.
- * This dispatcher will only be used for the IXP42X B0 or IXP46X silicon if
- * feature control indicates that IX_FEATURECTRL_ORIGB0_DISPATCHER is set to
- * IX_FEATURE_CTRL_SWCONFIG_DISABLED. Otherwise the @a ixQMgrDispatcherLoopRunB0
- * dispatcher will be used (Default).
- *
- * When this dispatcher notifies for a queue that is type
- * IX_QMGR_TYPE_REALTIME_PERIODIC, notifications for queues that are set
- * as type IX_QMGR_REALTIME_SPORADIC are not processed and disabled.
- * This helps prevent any tasks resulting from the notification of the
- * IX_QMGR_TYPE_REALTIME_PERIODIC type queue to being subject to livelock.
- * The function runs the dispatcher for a group of queues.
- * Callbacks are made for interrupts that have occurred on queues within
- * the group that have registered callbacks. The order in which queues are
- * serviced depends on their type along with the queue priorities set by the
- * client. This function may be called from interrupt or task context.
- *
- * This function is not re-entrant.
- *
- * @param group @ref IxQMgrDispatchGroup [in] - the group of queues over which
- * the dispatcher will run
- *
- * @return @li void
- *
- * @note This function may be called from interrupt or task context.
- * However, for optimal performance the choice of context depends also on the
- * operating system used.
- *
- */
-PUBLIC void
-ixQMgrDispatcherLoopRunB0LLP (IxQMgrDispatchGroup group);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrNotificationCallbackSet (IxQMgrQId qId,
- IxQMgrCallback callback,
- IxQMgrCallbackId callbackId)
- *
- * @brief Set the notification callback for a queue.
- *
- * This function sets the callback for the specified queue. This callback will
- * be called by the dispatcher, and may be called in the context of a interrupt
- * If callback has a value of NULL the previously registered callback, if one
- * exists will be unregistered.
- *
- * @param qId @ref IxQMgrQId [in] - the queue idenfifier
- * @param callback @ref IxQMgrCallback [in] - the callback registered for this queue
- * @param callbackId @ref IxQMgrCallbackId [in] - the callback identifier
- *
- * @return @li IX_SUCCESS, the callback for the specified queue has been set
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, the specified qId has not been configured
- *
- */
-PUBLIC IX_STATUS
-ixQMgrNotificationCallbackSet (IxQMgrQId qId,
- IxQMgrCallback callback,
- IxQMgrCallbackId callbackId);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrDispatcherLoopGet (IxQMgrDispatcherFuncPtr *qDispatcherFuncPtr)
- *
- * @brief Get QMgr DispatcherLoopRun for respective silicon device
- *
- * This function gets a function pointer to ixQMgrDispatcherLoopRunA0() for IXP42X A0
- * Silicon. If the IXP42X B0 or 46X Silicon, the default is the ixQMgrDispatcherLoopRunB0()
- * function, however if live lock prevention is enabled a function pointer to
- * ixQMgrDispatcherLoopRunB0LLP() is given.
- *
- * @param *qDispatchFuncPtr @ref IxQMgrDispatcherFuncPtr [out] -
- * the function pointer of QMgr Dispatcher
- *
- */
-PUBLIC void
-ixQMgrDispatcherLoopGet (IxQMgrDispatcherFuncPtr *qDispatcherFuncPtr);
-
-/**
- *
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrStickyInterruptRegEnable(void)
- *
- * @brief Enable AQM's sticky interrupt register behaviour only available
- * on B0 Silicon.
- *
- * When AQM's sticky interrupt register is enabled, interrupt register bit will
- * only be cleared when a '1' is written to interrupt register bit and the
- * interrupting condition is satisfied, i.e.queue condition does not exist.
- *
- * @note This function must be called before any queue is enabled.
- * Calling this function after queue is enabled will cause
- * undefined results.
- *
- * @return none
- *
- */
-PUBLIC void
-ixQMgrStickyInterruptRegEnable(void);
-
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrCallbackTypeSet(IxQMgrQId qId,
- IxQMgrType type)
- *
- * @brief Set the Callback Type of a queue.
- *
- * This function is only used for live lock prevention.
- * This function allows the callback type of a queue to be set. The default for
- * all queues is IX_QMGR_TYPE_REALTIME_OTHER. Setting the type to
- * IX_QMGR_TYPE_REALTIME_SPORADIC means that this queue will have it's
- * notifications disabled while there is a task associated with a
- * queue of type IX_QMGR_TYPE_REALTIME_PERIODIC running. As live lock
- * prevention operates on lower queues, this function should
- * be called for lower queues only.
- * This function is not re-entrant.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier
- * @param type @ref IxQMgrType [in] - the type of callback
- *
- * @return @li IX_SUCCESS, successfully set callback type for the queue entry
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId
- * @return @li IX_QMGR_PARAMETER_ERROR, invalid parameter(s).
- *
- */
-PUBLIC IX_STATUS
-ixQMgrCallbackTypeSet(IxQMgrQId qId,
- IxQMgrType type);
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrCallbackTypeGet(IxQMgrQId qId,
- IxQMgrType *type)
- *
- * @brief Get the Callback Type of a queue.
- *
- * This function allows the callback type of a queue to be got. As live lock
- * prevention operates on lower queues, this function should
- * be called for lower queues only.
- * This function is re-entrant.
- *
- * @param qId @ref IxQMgrQId [in] - the queue identifier
- * @param *type @ref IxQMgrType [out] - the type of callback
- *
- * @return @li IX_SUCCESS, successfully set callback type for the queue entry
- * @return @li IX_QMGR_Q_NOT_CONFIGURED, queue not configured for this QId
- * @return @li IX_QMGR_PARAMETER_ERROR, invalid parameter(s)
- *
- */
-PUBLIC IX_STATUS
-ixQMgrCallbackTypeGet(IxQMgrQId qId,
- IxQMgrType *type);
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrPeriodicDone(void)
- *
- * @brief Indicate that the Periodic task is completed for LLP
- *
- * This function is used as part of live lock prevention.
- * A periodic task is a task that results from a queue that
- * is set as type IX_QMGR_TYPE_REALTIME_PERIODIC. This function
- * should be called to indicate to the dispatcher that the
- * the periodic task is completed. This ensures that the notifications
- * for queues set as type sporadic queues are re-enabled.
- * This function is re-entrant.
- *
- */
-PUBLIC void
-ixQMgrPeriodicDone(void);
-
-
-/**
- * @ingroup IxQMgrAPI
- *
- * @fn ixQMgrLLPShow(int resetStats)
- *
- * @brief Print out the live lock prevention statistics when in debug mode.
- *
- * This function prints out statistics related to the livelock. These
- * statistics are only collected in debug mode.
- * This function is not re-entrant.
- *
- * @param resetStats @ref int [in] - if set the the stats are reset.
- *
- */
-PUBLIC void
-ixQMgrLLPShow(int resetStats);
-
-
-#endif /* IXQMGR_H */
-
-/**
- * @} defgroup IxQMgrAPI
- */
-
-
diff --git a/cpu/ixp/npe/include/IxQMgrAqmIf_p.h b/cpu/ixp/npe/include/IxQMgrAqmIf_p.h
deleted file mode 100644
index 7f5733c5d2..0000000000
--- a/cpu/ixp/npe/include/IxQMgrAqmIf_p.h
+++ /dev/null
@@ -1,927 +0,0 @@
-/**
- * @file IxQMgrAqmIf_p.h
- *
- * @author Intel Corporation
- * @date 30-Oct-2001
- *
- * @brief The IxQMgrAqmIf sub-component provides a number of inline
- * functions for performing I/O on the AQM.
- *
- * Because some functions contained in this module are inline and are
- * used in other modules (within the QMgr component) the definitions are
- * contained in this header file. The "normal" use of inline functions
- * is to use the inline functions in the module in which they are
- * defined. In this case these inline functions are used in external
- * modules and therefore the use of "inline extern". What this means
- * is as follows: if a function foo is declared as "inline extern"this
- * definition is only used for inlining, in no case is the function
- * compiled on its own. If the compiler cannot inline the function it
- * becomes an external reference. Therefore in IxQMgrAqmIf.c all
- * inline functions are defined without the "inline extern" specifier
- * and so define the external references. In all other modules these
- * funtions are defined as "inline extern".
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-#ifndef IXQMGRAQMIF_P_H
-#define IXQMGRAQMIF_P_H
-
-#include "IxOsalTypes.h"
-
-/*
- * inline definition
- */
-
-#ifdef IX_OSAL_INLINE_ALL
-/* If IX_OSAL_INLINE_ALL is set then each inlineable API functions will be defined as
- inline functions */
-#define IX_QMGR_AQMIF_INLINE IX_OSAL_INLINE_EXTERN
-#else
-#ifdef IXQMGRAQMIF_C
-#ifndef IX_QMGR_AQMIF_INLINE
-#define IX_QMGR_AQMIF_INLINE
-#endif
-#else
-#ifndef IX_QMGR_AQMIF_INLINE
-#define IX_QMGR_AQMIF_INLINE IX_OSAL_INLINE_EXTERN
-#endif
-#endif /* IXQMGRAQMIF_C */
-#endif /* IX_OSAL_INLINE */
-
-
-/*
- * User defined include files.
- */
-#include "IxQMgr.h"
-#include "IxQMgrLog_p.h"
-#include "IxQMgrQCfg_p.h"
-
-/* Because this file contains inline functions which will be compiled into
- * other components, we need to ensure that the IX_COMPONENT_NAME define
- * is set to ix_qmgr while this code is being compiled. This will ensure
- * that the correct implementation is provided for the memory access macros
- * IX_OSAL_READ_LONG and IX_OSAL_WRITE_LONG which are used in this file.
- * This must be done before including "IxOsalMemAccess.h"
- */
-#define IX_QMGR_AQMIF_SAVED_COMPONENT_NAME IX_COMPONENT_NAME
-#undef IX_COMPONENT_NAME
-#define IX_COMPONENT_NAME ix_qmgr
-#include "IxOsal.h"
-
-/*
- * #defines and macros used in this file.
- */
-
-/* Number of bytes per word */
-#define IX_QMGR_NUM_BYTES_PER_WORD 4
-
-/* Underflow bit mask */
-#define IX_QMGR_UNDERFLOW_BIT_OFFSET 0x0
-
-/* Overflow bit mask */
-#define IX_QMGR_OVERFLOW_BIT_OFFSET 0x1
-
-/* Queue access register, queue 0 */
-#define IX_QMGR_QUEACC0_OFFSET 0x0000
-
-/* Size of queue access register in words */
-#define IX_QMGR_QUEACC_SIZE 0x4/*words*/
-
-/* Queue status register, queues 0-7 */
-#define IX_QMGR_QUELOWSTAT0_OFFSET (IX_QMGR_QUEACC0_OFFSET +\
-(IX_QMGR_MAX_NUM_QUEUES * IX_QMGR_QUEACC_SIZE * IX_QMGR_NUM_BYTES_PER_WORD))
-
-/* Queue status register, queues 8-15 */
-#define IX_QMGR_QUELOWSTAT1_OFFSET (IX_QMGR_QUELOWSTAT0_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Queue status register, queues 16-23 */
-#define IX_QMGR_QUELOWSTAT2_OFFSET (IX_QMGR_QUELOWSTAT1_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Queue status register, queues 24-31 */
-#define IX_QMGR_QUELOWSTAT3_OFFSET (IX_QMGR_QUELOWSTAT2_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Queue status register Q status bits mask */
-#define IX_QMGR_QUELOWSTAT_QUE_STS_BITS_MASK 0xF
-
-/* Size of queue 0-31 status register */
-#define IX_QMGR_QUELOWSTAT_SIZE 0x4 /*words*/
-
-/* The number of queues' status specified per word */
-#define IX_QMGR_QUELOWSTAT_NUM_QUE_PER_WORD 0x8
-
-/* Queue UF/OF status register queues 0-15 */
-#define IX_QMGR_QUEUOSTAT0_OFFSET (IX_QMGR_QUELOWSTAT3_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-/* Queue UF/OF status register queues 16-31 */
-#define IX_QMGR_QUEUOSTAT1_OFFSET (IX_QMGR_QUEUOSTAT0_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* The number of queues' underflow/overflow status specified per word */
-#define IX_QMGR_QUEUOSTAT_NUM_QUE_PER_WORD 0x10
-
-/* Queue NE status register, queues 32-63 */
-#define IX_QMGR_QUEUPPSTAT0_OFFSET (IX_QMGR_QUEUOSTAT1_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Queue F status register, queues 32-63 */
-#define IX_QMGR_QUEUPPSTAT1_OFFSET (IX_QMGR_QUEUPPSTAT0_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Size of queue 32-63 status register */
-#define IX_QMGR_QUEUPPSTAT_SIZE 0x2 /*words*/
-
-/* The number of queues' status specified per word */
-#define IX_QMGR_QUEUPPSTAT_NUM_QUE_PER_WORD 0x20
-
-/* Queue INT source select register, queues 0-7 */
-#define IX_QMGR_INT0SRCSELREG0_OFFSET (IX_QMGR_QUEUPPSTAT1_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Queue INT source select register, queues 8-15 */
-#define IX_QMGR_INT0SRCSELREG1_OFFSET (IX_QMGR_INT0SRCSELREG0_OFFSET+\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Queue INT source select register, queues 16-23 */
-#define IX_QMGR_INT0SRCSELREG2_OFFSET (IX_QMGR_INT0SRCSELREG1_OFFSET+\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Queue INT source select register, queues 24-31 */
-#define IX_QMGR_INT0SRCSELREG3_OFFSET (IX_QMGR_INT0SRCSELREG2_OFFSET+\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Size of interrupt source select reegister */
-#define IX_QMGR_INT0SRCSELREG_SIZE 0x4 /*words*/
-
-/* The number of queues' interrupt source select specified per word*/
-#define IX_QMGR_INTSRC_NUM_QUE_PER_WORD 0x8
-
-/* Queue INT enable register, queues 0-31 */
-#define IX_QMGR_QUEIEREG0_OFFSET (IX_QMGR_INT0SRCSELREG3_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Queue INT enable register, queues 32-63 */
-#define IX_QMGR_QUEIEREG1_OFFSET (IX_QMGR_QUEIEREG0_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Queue INT register, queues 0-31 */
-#define IX_QMGR_QINTREG0_OFFSET (IX_QMGR_QUEIEREG1_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Queue INT register, queues 32-63 */
-#define IX_QMGR_QINTREG1_OFFSET (IX_QMGR_QINTREG0_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Size of interrupt register */
-#define IX_QMGR_QINTREG_SIZE 0x2 /*words*/
-
-/* Number of queues' status specified per word */
-#define IX_QMGR_QINTREG_NUM_QUE_PER_WORD 0x20
-
-/* Number of bits per queue interrupt status */
-#define IX_QMGR_QINTREG_BITS_PER_QUEUE 0x1
-#define IX_QMGR_QINTREG_BIT_OFFSET 0x1
-
-/* Size of address space not used by AQM */
-#define IX_QMGR_AQM_UNUSED_ADDRESS_SPACE_SIZE_IN_BYTES 0x1bC0
-
-/* Queue config register, queue 0 */
-#define IX_QMGR_QUECONFIG_BASE_OFFSET (IX_QMGR_QINTREG1_OFFSET +\
- IX_QMGR_NUM_BYTES_PER_WORD +\
- IX_QMGR_AQM_UNUSED_ADDRESS_SPACE_SIZE_IN_BYTES)
-
-/* Total size of configuration words */
-#define IX_QMGR_QUECONFIG_SIZE 0x100
-
-/* Start of SRAM queue buffer space */
-#define IX_QMGR_QUEBUFFER_SPACE_OFFSET (IX_QMGR_QUECONFIG_BASE_OFFSET +\
- IX_QMGR_MAX_NUM_QUEUES * IX_QMGR_NUM_BYTES_PER_WORD)
-
-/* Total bits in a word */
-#define BITS_PER_WORD 32
-
-/* Size of queue buffer space */
-#define IX_QMGR_QUE_BUFFER_SPACE_SIZE 0x1F00
-
-/*
- * This macro will return the address of the access register for the
- * queue specified by qId
- */
-#define IX_QMGR_Q_ACCESS_ADDR_GET(qId)\
- (((qId) * (IX_QMGR_QUEACC_SIZE * IX_QMGR_NUM_BYTES_PER_WORD))\
- + IX_QMGR_QUEACC0_OFFSET)
-
-/*
- * Bit location of bit-3 of INT0SRCSELREG0 register to enabled
- * sticky interrupt register.
- */
-#define IX_QMGR_INT0SRCSELREG0_BIT3 3
-
-/*
- * Variable declerations global to this file. Externs are followed by
- * statics.
- */
-extern UINT32 aqmBaseAddress;
-
-/*
- * Function declarations.
- */
-void
-ixQMgrAqmIfInit (void);
-
-void
-ixQMgrAqmIfUninit (void);
-
-unsigned
-ixQMgrAqmIfLog2 (unsigned number);
-
-void
-ixQMgrAqmIfQRegisterBitsWrite (IxQMgrQId qId,
- UINT32 registerBaseAddrOffset,
- unsigned queuesPerRegWord,
- UINT32 value);
-
-void
-ixQMgrAqmIfQStatusCheckValsCalc (IxQMgrQId qId,
- IxQMgrSourceId srcSel,
- unsigned int *statusWordOffset,
- UINT32 *checkValue,
- UINT32 *mask);
-/*
- * The Xscale software allways deals with logical addresses and so the
- * base address of the AQM memory space is not a hardcoded value. This
- * function must be called before any other function in this component.
- * NO CHECKING is performed to ensure that the base address has been
- * set.
- */
-void
-ixQMgrAqmIfBaseAddressSet (UINT32 address);
-
-/*
- * Get the base address of the AQM memory space.
- */
-void
-ixQMgrAqmIfBaseAddressGet (UINT32 *address);
-
-/*
- * Get the sram base address
- */
-void
-ixQMgrAqmIfSramBaseAddressGet (UINT32 *address);
-
-/*
- * Read a queue status
- */
-void
-ixQMgrAqmIfQueStatRead (IxQMgrQId qId,
- IxQMgrQStatus* status);
-
-
-/*
- * Set INT0SRCSELREG0 Bit3
- */
-void ixQMgrAqmIfIntSrcSelReg0Bit3Set (void);
-
-
-/*
- * Set the interrupt source
- */
-void
-ixQMgrAqmIfIntSrcSelWrite (IxQMgrQId qId,
- IxQMgrSourceId sourceId);
-
-/*
- * Enable interruptson a queue
- */
-void
-ixQMgrAqmIfQInterruptEnable (IxQMgrQId qId);
-
-/*
- * Disable interrupt on a quee
- */
-void
-ixQMgrAqmIfQInterruptDisable (IxQMgrQId qId);
-
-/*
- * Write the config register of the specified queue
- */
-void
-ixQMgrAqmIfQueCfgWrite (IxQMgrQId qId,
- IxQMgrQSizeInWords qSizeInWords,
- IxQMgrQEntrySizeInWords entrySizeInWords,
- UINT32 freeSRAMAddress);
-
-/*
- * read fields from the config of the specified queue.
- */
-void
-ixQMgrAqmIfQueCfgRead (IxQMgrQId qId,
- unsigned int numEntries,
- UINT32 *baseAddress,
- unsigned int *ne,
- unsigned int *nf,
- UINT32 *readPtr,
- UINT32 *writePtr);
-
-/*
- * Set the ne and nf watermark level on a queue.
- */
-void
-ixQMgrAqmIfWatermarkSet (IxQMgrQId qId,
- unsigned ne,
- unsigned nf);
-
-/* Inspect an entry without moving the read pointer */
-IX_STATUS
-ixQMgrAqmIfQPeek (IxQMgrQId qId,
- unsigned int entryIndex,
- unsigned int *entry);
-
-/* Modify an entry without moving the write pointer */
-IX_STATUS
-ixQMgrAqmIfQPoke (IxQMgrQId qId,
- unsigned int entryIndex,
- unsigned int *entry);
-
-/*
- * Function prototype for inline functions. For description refers to
- * the functions defintion below.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfWordWrite (VUINT32 *address,
- UINT32 word);
-
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfWordRead (VUINT32 *address,
- UINT32 *word);
-
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQPop (IxQMgrQId qId,
- IxQMgrQEntrySizeInWords numWords,
- UINT32 *entry);
-
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQPush (IxQMgrQId qId,
- IxQMgrQEntrySizeInWords numWords,
- UINT32 *entry);
-
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQStatusRegsRead (IxQMgrDispatchGroup group,
- UINT32 *qStatusWords);
-
-IX_QMGR_AQMIF_INLINE BOOL
-ixQMgrAqmIfQStatusCheck (UINT32 *oldQStatusWords,
- UINT32 *newQStatusWords,
- unsigned int statusWordOffset,
- UINT32 checkValue,
- UINT32 mask);
-
-IX_QMGR_AQMIF_INLINE BOOL
-ixQMgrAqmIfRegisterBitCheck (IxQMgrQId qId,
- UINT32 registerBaseAddrOffset,
- unsigned queuesPerRegWord,
- unsigned relativeBitOffset,
- BOOL reset);
-
-IX_QMGR_AQMIF_INLINE BOOL
-ixQMgrAqmIfUnderflowCheck (IxQMgrQId qId);
-
-IX_QMGR_AQMIF_INLINE BOOL
-ixQMgrAqmIfOverflowCheck (IxQMgrQId qId);
-
-IX_QMGR_AQMIF_INLINE UINT32
-ixQMgrAqmIfQRegisterBitsRead (IxQMgrQId qId,
- UINT32 registerBaseAddrOffset,
- unsigned queuesPerRegWord);
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQInterruptRegWrite (IxQMgrDispatchGroup group,
- UINT32 reg);
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQInterruptRegRead (IxQMgrDispatchGroup group,
- UINT32 *regVal);
-
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQueLowStatRead (IxQMgrQId qId,
- IxQMgrQStatus *status);
-
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQueUppStatRead (IxQMgrQId qId,
- IxQMgrQStatus *status);
-
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQueStatRead (IxQMgrQId qId,
- IxQMgrQStatus *qStatus);
-
-IX_QMGR_AQMIF_INLINE unsigned
-ixQMgrAqmIfPow2NumDivide (unsigned numerator,
- unsigned denominator);
-
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQInterruptEnableRegRead (IxQMgrDispatchGroup group,
- UINT32 *regVal);
-/*
- * Inline functions
- */
-
-/*
- * This inline function is used by other QMgr components to write one
- * word to the specified address.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfWordWrite (VUINT32 *address,
- UINT32 word)
-{
- IX_OSAL_WRITE_LONG(address, word);
-}
-
-/*
- * This inline function is used by other QMgr components to read a
- * word from the specified address.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfWordRead (VUINT32 *address,
- UINT32 *word)
-{
- *word = IX_OSAL_READ_LONG(address);
-}
-
-
-/*
- * This inline function is used by other QMgr components to pop an
- * entry off the specified queue.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQPop (IxQMgrQId qId,
- IxQMgrQEntrySizeInWords numWords,
- UINT32 *entry)
-{
- volatile UINT32 *accRegAddr;
-
- accRegAddr = (UINT32*)(aqmBaseAddress +
- IX_QMGR_Q_ACCESS_ADDR_GET(qId));
-
- switch (numWords)
- {
- case IX_QMGR_Q_ENTRY_SIZE1:
- ixQMgrAqmIfWordRead (accRegAddr, entry);
- break;
- case IX_QMGR_Q_ENTRY_SIZE2:
- ixQMgrAqmIfWordRead (accRegAddr++, entry++);
- ixQMgrAqmIfWordRead (accRegAddr, entry);
- break;
- case IX_QMGR_Q_ENTRY_SIZE4:
- ixQMgrAqmIfWordRead (accRegAddr++, entry++);
- ixQMgrAqmIfWordRead (accRegAddr++, entry++);
- ixQMgrAqmIfWordRead (accRegAddr++, entry++);
- ixQMgrAqmIfWordRead (accRegAddr, entry);
- break;
- default:
- IX_QMGR_LOG_ERROR0("Invalid Q Entry size passed to ixQMgrAqmIfQPop");
- break;
- }
-}
-
-/*
- * This inline function is used by other QMgr components to push an
- * entry to the specified queue.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQPush (IxQMgrQId qId,
- IxQMgrQEntrySizeInWords numWords,
- UINT32 *entry)
-{
- volatile UINT32 *accRegAddr;
-
- accRegAddr = (UINT32*)(aqmBaseAddress +
- IX_QMGR_Q_ACCESS_ADDR_GET(qId));
-
- switch (numWords)
- {
- case IX_QMGR_Q_ENTRY_SIZE1:
- ixQMgrAqmIfWordWrite (accRegAddr, *entry);
- break;
- case IX_QMGR_Q_ENTRY_SIZE2:
- ixQMgrAqmIfWordWrite (accRegAddr++, *entry++);
- ixQMgrAqmIfWordWrite (accRegAddr, *entry);
- break;
- case IX_QMGR_Q_ENTRY_SIZE4:
- ixQMgrAqmIfWordWrite (accRegAddr++, *entry++);
- ixQMgrAqmIfWordWrite (accRegAddr++, *entry++);
- ixQMgrAqmIfWordWrite (accRegAddr++, *entry++);
- ixQMgrAqmIfWordWrite (accRegAddr, *entry);
- break;
- default:
- IX_QMGR_LOG_ERROR0("Invalid Q Entry size passed to ixQMgrAqmIfQPush");
- break;
- }
-}
-
-/*
- * The AQM interrupt registers contains a bit for each AQM queue
- * specifying the queue (s) that cause an interrupt to fire. This
- * function is called by IxQMGrDispatcher component.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQStatusRegsRead (IxQMgrDispatchGroup group,
- UINT32 *qStatusWords)
-{
- volatile UINT32 *regAddress = NULL;
-
- if (group == IX_QMGR_QUELOW_GROUP)
- {
- regAddress = (UINT32*)(aqmBaseAddress +
- IX_QMGR_QUELOWSTAT0_OFFSET);
-
- ixQMgrAqmIfWordRead (regAddress++, qStatusWords++);
- ixQMgrAqmIfWordRead (regAddress++, qStatusWords++);
- ixQMgrAqmIfWordRead (regAddress++, qStatusWords++);
- ixQMgrAqmIfWordRead (regAddress, qStatusWords);
- }
- else /* We have the upper queues */
- {
- /* Only need to read the Nearly Empty status register for
- * queues 32-63 as for therse queues the interrtupt source
- * condition is fixed to Nearly Empty
- */
- regAddress = (UINT32*)(aqmBaseAddress +
- IX_QMGR_QUEUPPSTAT0_OFFSET);
- ixQMgrAqmIfWordRead (regAddress, qStatusWords);
- }
-}
-
-
-/*
- * This function check if the status for a queue has changed between
- * 2 snapshots and if it has, that the status matches a particular
- * value after masking.
- */
-IX_QMGR_AQMIF_INLINE BOOL
-ixQMgrAqmIfQStatusCheck (UINT32 *oldQStatusWords,
- UINT32 *newQStatusWords,
- unsigned int statusWordOffset,
- UINT32 checkValue,
- UINT32 mask)
-{
- if (((oldQStatusWords[statusWordOffset] & mask) !=
- (newQStatusWords[statusWordOffset] & mask)) &&
- ((newQStatusWords[statusWordOffset] & mask) == checkValue))
- {
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*
- * The AQM interrupt register contains a bit for each AQM queue
- * specifying the queue (s) that cause an interrupt to fire. This
- * function is called by IxQMgrDispatcher component.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQInterruptRegRead (IxQMgrDispatchGroup group,
- UINT32 *regVal)
-{
- volatile UINT32 *regAddress;
-
- if (group == IX_QMGR_QUELOW_GROUP)
- {
- regAddress = (UINT32*)(aqmBaseAddress +
- IX_QMGR_QINTREG0_OFFSET);
- }
- else
- {
- regAddress = (UINT32*)(aqmBaseAddress +
- IX_QMGR_QINTREG1_OFFSET);
- }
-
- ixQMgrAqmIfWordRead (regAddress, regVal);
-}
-
-/*
- * The AQM interrupt enable register contains a bit for each AQM queue.
- * This function reads the interrupt enable register. This
- * function is called by IxQMgrDispatcher component.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQInterruptEnableRegRead (IxQMgrDispatchGroup group,
- UINT32 *regVal)
-{
- volatile UINT32 *regAddress;
-
- if (group == IX_QMGR_QUELOW_GROUP)
- {
- regAddress = (UINT32*)(aqmBaseAddress +
- IX_QMGR_QUEIEREG0_OFFSET);
- }
- else
- {
- regAddress = (UINT32*)(aqmBaseAddress +
- IX_QMGR_QUEIEREG1_OFFSET);
- }
-
- ixQMgrAqmIfWordRead (regAddress, regVal);
-}
-
-
-/*
- * This inline function will read the status bit of a queue
- * specified by qId. If reset is TRUE the bit is cleared.
- */
-IX_QMGR_AQMIF_INLINE BOOL
-ixQMgrAqmIfRegisterBitCheck (IxQMgrQId qId,
- UINT32 registerBaseAddrOffset,
- unsigned queuesPerRegWord,
- unsigned relativeBitOffset,
- BOOL reset)
-{
- UINT32 actualBitOffset;
- volatile UINT32 *registerAddress;
- UINT32 registerWord;
-
- /*
- * Calculate the registerAddress
- * multiple queues split accross registers
- */
- registerAddress = (UINT32*)(aqmBaseAddress +
- registerBaseAddrOffset +
- ((qId / queuesPerRegWord) *
- IX_QMGR_NUM_BYTES_PER_WORD));
-
- /*
- * Get the status word
- */
- ixQMgrAqmIfWordRead (registerAddress, &registerWord);
-
- /*
- * Calculate the actualBitOffset
- * status for multiple queues stored in one register
- */
- actualBitOffset = (relativeBitOffset + 1) <<
- ((qId & (queuesPerRegWord - 1)) * (BITS_PER_WORD / queuesPerRegWord));
-
- /* Check if the status bit is set */
- if (registerWord & actualBitOffset)
- {
- /* Clear the bit if reset */
- if (reset)
- {
- ixQMgrAqmIfWordWrite (registerAddress, registerWord & (~actualBitOffset));
- }
- return TRUE;
- }
-
- /* Bit not set */
- return FALSE;
-}
-
-
-/*
- * @ingroup IxQmgrAqmIfAPI
- *
- * @brief Read the underflow status of a queue
- *
- * This inline function will read the underflow status of a queue
- * specified by qId.
- *
- */
-IX_QMGR_AQMIF_INLINE BOOL
-ixQMgrAqmIfUnderflowCheck (IxQMgrQId qId)
-{
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- return (ixQMgrAqmIfRegisterBitCheck (qId,
- IX_QMGR_QUEUOSTAT0_OFFSET,
- IX_QMGR_QUEUOSTAT_NUM_QUE_PER_WORD,
- IX_QMGR_UNDERFLOW_BIT_OFFSET,
- TRUE/*reset*/));
- }
- else
- {
- /* Qs 32-63 have no underflow status */
- return FALSE;
- }
-}
-
-/*
- * This inline function will read the overflow status of a queue
- * specified by qId.
- */
-IX_QMGR_AQMIF_INLINE BOOL
-ixQMgrAqmIfOverflowCheck (IxQMgrQId qId)
-{
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- return (ixQMgrAqmIfRegisterBitCheck (qId,
- IX_QMGR_QUEUOSTAT0_OFFSET,
- IX_QMGR_QUEUOSTAT_NUM_QUE_PER_WORD,
- IX_QMGR_OVERFLOW_BIT_OFFSET,
- TRUE/*reset*/));
- }
- else
- {
- /* Qs 32-63 have no overflow status */
- return FALSE;
- }
-}
-
-/*
- * This inline function will read the status bits of a queue
- * specified by qId.
- */
-IX_QMGR_AQMIF_INLINE UINT32
-ixQMgrAqmIfQRegisterBitsRead (IxQMgrQId qId,
- UINT32 registerBaseAddrOffset,
- unsigned queuesPerRegWord)
-{
- volatile UINT32 *registerAddress;
- UINT32 registerWord;
- UINT32 statusBitsMask;
- UINT32 bitsPerQueue;
-
- bitsPerQueue = BITS_PER_WORD / queuesPerRegWord;
-
- /*
- * Calculate the registerAddress
- * multiple queues split accross registers
- */
- registerAddress = (UINT32*)(aqmBaseAddress +
- registerBaseAddrOffset +
- ((qId / queuesPerRegWord) *
- IX_QMGR_NUM_BYTES_PER_WORD));
- /*
- * Read the status word
- */
- ixQMgrAqmIfWordRead (registerAddress, &registerWord);
-
-
- /*
- * Calculate the mask for the status bits for this queue.
- */
- statusBitsMask = ((1 << bitsPerQueue) - 1);
-
- /*
- * Shift the status word so it is right justified
- */
- registerWord >>= ((qId & (queuesPerRegWord - 1)) * bitsPerQueue);
-
- /*
- * Mask out all bar the status bits for this queue
- */
- return (registerWord &= statusBitsMask);
-}
-
-/*
- * This function is called by IxQMgrDispatcher to set the contents of
- * the AQM interrupt register.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQInterruptRegWrite (IxQMgrDispatchGroup group,
- UINT32 reg)
-{
- volatile UINT32 *address;
-
- if (group == IX_QMGR_QUELOW_GROUP)
- {
- address = (UINT32*)(aqmBaseAddress +
- IX_QMGR_QINTREG0_OFFSET);
- }
- else
- {
- address = (UINT32*)(aqmBaseAddress +
- IX_QMGR_QINTREG1_OFFSET);
- }
-
- ixQMgrAqmIfWordWrite (address, reg);
-}
-
-/*
- * Read the status of a queue in the range 0-31.
- *
- * This function is used by other QMgr components to read the
- * status of the queue specified by qId.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQueLowStatRead (IxQMgrQId qId,
- IxQMgrQStatus *status)
-{
- /* Read the general status bits */
- *status = ixQMgrAqmIfQRegisterBitsRead (qId,
- IX_QMGR_QUELOWSTAT0_OFFSET,
- IX_QMGR_QUELOWSTAT_NUM_QUE_PER_WORD);
-}
-
-/*
- * This function will read the status of the queue specified
- * by qId.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQueUppStatRead (IxQMgrQId qId,
- IxQMgrQStatus *status)
-{
- /* Reset the status bits */
- *status = 0;
-
- /*
- * Check if the queue is nearly empty,
- * N.b. QUPP stat register contains status for regs 32-63 at each
- * bit position so subtract 32 to get bit offset
- */
- if (ixQMgrAqmIfRegisterBitCheck ((qId - IX_QMGR_MIN_QUEUPP_QID),
- IX_QMGR_QUEUPPSTAT0_OFFSET,
- IX_QMGR_QUEUPPSTAT_NUM_QUE_PER_WORD,
- 0/*relativeBitOffset*/,
- FALSE/*!reset*/))
- {
- *status |= IX_QMGR_Q_STATUS_NE_BIT_MASK;
- }
-
- /*
- * Check if the queue is full,
- * N.b. QUPP stat register contains status for regs 32-63 at each
- * bit position so subtract 32 to get bit offset
- */
- if (ixQMgrAqmIfRegisterBitCheck ((qId - IX_QMGR_MIN_QUEUPP_QID),
- IX_QMGR_QUEUPPSTAT1_OFFSET,
- IX_QMGR_QUEUPPSTAT_NUM_QUE_PER_WORD,
- 0/*relativeBitOffset*/,
- FALSE/*!reset*/))
- {
- *status |= IX_QMGR_Q_STATUS_F_BIT_MASK;
- }
-}
-
-/*
- * This function is used by other QMgr components to read the
- * status of the queue specified by qId.
- */
-IX_QMGR_AQMIF_INLINE void
-ixQMgrAqmIfQueStatRead (IxQMgrQId qId,
- IxQMgrQStatus *qStatus)
-{
- if (qId < IX_QMGR_MIN_QUEUPP_QID)
- {
- ixQMgrAqmIfQueLowStatRead (qId, qStatus);
- }
- else
- {
- ixQMgrAqmIfQueUppStatRead (qId, qStatus);
- }
-}
-
-
-/*
- * This function performs a mod division
- */
-IX_QMGR_AQMIF_INLINE unsigned
-ixQMgrAqmIfPow2NumDivide (unsigned numerator,
- unsigned denominator)
-{
- /* Number is evenly divisable by 2 */
- return (numerator >> ixQMgrAqmIfLog2 (denominator));
-}
-
-/* Restore IX_COMPONENT_NAME */
-#undef IX_COMPONENT_NAME
-#define IX_COMPONENT_NAME IX_QMGR_AQMIF_SAVED_COMPONENT_NAME
-
-#endif/*IXQMGRAQMIF_P_H*/
diff --git a/cpu/ixp/npe/include/IxQMgrDefines_p.h b/cpu/ixp/npe/include/IxQMgrDefines_p.h
deleted file mode 100644
index 0183596af5..0000000000
--- a/cpu/ixp/npe/include/IxQMgrDefines_p.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * @file IxQMgrDefines_p.h
- *
- * @author Intel Corporation
- * @date 19-Jul-2002
- *
- * @brief IxQMgr Defines and tuneable constants
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-#ifndef IXQMGRDEFINES_P_H
-#define IXQMGRDEFINES_P_H
-
-#define IX_QMGR_PARM_CHECKS_ENABLED 1
-#define IX_QMGR_STATS_UPDATE_ENABLED 1
-
-#endif /* IXQMGRDEFINES_P_H */
diff --git a/cpu/ixp/npe/include/IxQMgrDispatcher_p.h b/cpu/ixp/npe/include/IxQMgrDispatcher_p.h
deleted file mode 100644
index 71a3f8588e..0000000000
--- a/cpu/ixp/npe/include/IxQMgrDispatcher_p.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * @file IxQMgrDispatcher_p.h
- *
- * @author Intel Corporation
- * @date 07-Feb-2002
- *
- * @brief This file contains the internal functions for dispatcher
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-#ifndef IXQMGRDISPATCHER_P_H
-#define IXQMGRDISPATCHER_P_H
-
-/*
- * User defined include files
- */
-#include "IxQMgr.h"
-
-/*
- * This structure defines the statistic data for a queue
- */
-typedef struct
-{
- unsigned callbackCnt; /* Call count of callback */
- unsigned priorityChangeCnt; /* Priority change count */
- unsigned intNoCallbackCnt; /* Interrupt fired but no callback set count */
- unsigned intLostCallbackCnt; /* Interrupt lost and detected ; SCR541 */
- BOOL notificationEnabled; /* Interrupt enabled for this queue */
- IxQMgrSourceId srcSel; /* interrupt source */
- unsigned enableCount; /* num times notif enabled by LLP */
- unsigned disableCount; /* num of times notif disabled by LLP */
-} IxQMgrDispatcherQStats;
-
-/*
- * This structure defines statistic data for the disatcher
- */
-typedef struct
- {
- unsigned loopRunCnt; /* ixQMgrDispatcherLoopRun count */
-
- IxQMgrDispatcherQStats queueStats[IX_QMGR_MAX_NUM_QUEUES];
-
-} IxQMgrDispatcherStats;
-
-/*
- * Initialise the dispatcher component
- */
-void
-ixQMgrDispatcherInit (void);
-
-/*
- * Get the dispatcher statistics
- */
-IxQMgrDispatcherStats*
-ixQMgrDispatcherStatsGet (void);
-
-/**
- * Retrieve the number of leading zero bits starting from the MSB
- * This function is implemented as an (extremely fast) asm routine
- * for XSCALE processor (see clz instruction) and as a (slower) C
- * function for other systems.
- */
-unsigned int
-ixQMgrCountLeadingZeros(unsigned int value);
-
-#endif/*IXQMGRDISPATCHER_P_H*/
-
-
diff --git a/cpu/ixp/npe/include/IxQMgrLog_p.h b/cpu/ixp/npe/include/IxQMgrLog_p.h
deleted file mode 100644
index 6b685b8a28..0000000000
--- a/cpu/ixp/npe/include/IxQMgrLog_p.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * @file IxQMgrLog_p.h
- *
- * @author Intel Corporation
- * @date 07-Feb-2002
- *
- * @brief This file contains the internal functions for config
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-#ifndef IXQMGRLOG_P_H
-#define IXQMGRLOG_P_H
-
-/*
- * User defined header files
- */
-#include "IxOsal.h"
-
-/*
- * Macros
- */
-
-#define IX_QMGR_LOG0(string) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_USER, IX_OSAL_LOG_DEV_STDOUT, string, 0, 0, 0, 0, 0, 0);\
-}while(0);
-
-#define IX_QMGR_LOG1(string, arg1) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_USER, IX_OSAL_LOG_DEV_STDOUT, string, (int)arg1, 0, 0, 0, 0, 0);\
-}while(0);
-
-#define IX_QMGR_LOG2(string, arg1, arg2) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_USER, IX_OSAL_LOG_DEV_STDOUT, string, (int)arg1, (int)arg2, 0, 0, 0, 0);\
-}while(0);
-
-#define IX_QMGR_LOG3(string, arg1, arg2, arg3) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_USER, IX_OSAL_LOG_DEV_STDOUT, string, (int)arg1, (int)arg2, (int)arg3, 0, 0, 0);\
-}while(0);
-
-#define IX_QMGR_LOG6(string, arg1, arg2, arg3, arg4, arg5, arg6) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_USER, IX_OSAL_LOG_DEV_STDOUT, string, (int)arg1, (int)arg2, (int)arg3, (int)arg4, (int)arg5, (int)arg6); \
-}while(0);
-
-#define IX_QMGR_LOG_WARNING0(string) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT, string, 0, 0, 0, 0, 0, 0);\
-}while(0);
-
-#define IX_QMGR_LOG_WARNING1(string, arg1) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT, string, (int)arg1, 0, 0, 0, 0, 0);\
-}while(0);
-
-#define IX_QMGR_LOG_WARNING2(string, arg1, arg2) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_WARNING, IX_OSAL_LOG_DEV_STDOUT, string, (int)arg1, (int)arg2, 0, 0, 0, 0);\
-}while(0);
-
-#define IX_QMGR_LOG_ERROR0(string) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDERR, string, 0, 0, 0, 0, 0, 0);\
-}while(0);
-
-#define IX_QMGR_LOG_ERROR1(string, arg1) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDERR, string, (int)arg1, 0, 0, 0, 0, 0);\
-}while(0);
-
-#define IX_QMGR_LOG_ERROR2(string, arg1, arg2) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDERR, string, (int)arg1, (int)arg2, 0, 0, 0, 0);\
-}while(0);
-
-#define IX_QMGR_LOG_ERROR3(string, arg1, arg2, arg3) do\
-{\
- ixOsalLog(IX_OSAL_LOG_LVL_ERROR, IX_OSAL_LOG_DEV_STDERR, string, (int)arg1, (int)arg2, (int)arg3, 0, 0, 0);\
-}while(0);
-#endif /* IX_QMGRLOG_P_H */
-
-
-
-
diff --git a/cpu/ixp/npe/include/IxQMgrQAccess_p.h b/cpu/ixp/npe/include/IxQMgrQAccess_p.h
deleted file mode 100644
index 8612670a17..0000000000
--- a/cpu/ixp/npe/include/IxQMgrQAccess_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * @file IxQMgrQAccess_p.h
- *
- * @author Intel Corporation
- * @date 30-Oct-2001
- *
- * @brief QAccess private header file
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-#ifndef IXQMGRQACCESS_P_H
-#define IXQMGRQACCESS_P_H
-
-/*
- * User defined header files
- */
-#include "IxQMgr.h"
-
-/*
- * Global variables declarations.
- */
-extern volatile UINT32 * ixQMgrAqmIfQueAccRegAddr[];
-
-/*
- * Initialise the Queue Access component
- */
-void
-ixQMgrQAccessInit (void);
-
-/*
- * read the remainder of a multi-word queue entry
- * (the first word is already read)
- */
-IX_STATUS
-ixQMgrQReadMWordsMinus1 (IxQMgrQId qId,
- UINT32 *entry);
-
-/*
- * Fast access : pop a q entry from a single word queue
- */
-extern __inline__ UINT32 ixQMgrQAccessPop(IxQMgrQId qId);
-
-extern __inline__ UINT32 ixQMgrQAccessPop(IxQMgrQId qId)
-{
- return *(ixQMgrAqmIfQueAccRegAddr[qId]);
-}
-
-/*
- * Fast access : push a q entry in a single word queue
- */
-extern __inline__ void ixQMgrQAccessPush(IxQMgrQId qId, UINT32 entry);
-
-extern __inline__ void ixQMgrQAccessPush(IxQMgrQId qId, UINT32 entry)
-{
- *(ixQMgrAqmIfQueAccRegAddr[qId]) = entry;
-}
-
-#endif/*IXQMGRQACCESS_P_H*/
diff --git a/cpu/ixp/npe/include/IxQMgrQCfg_p.h b/cpu/ixp/npe/include/IxQMgrQCfg_p.h
deleted file mode 100644
index c9dae1ef04..0000000000
--- a/cpu/ixp/npe/include/IxQMgrQCfg_p.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * @file IxQMgrQCfg_p.h
- *
- * @author Intel Corporation
- * @date 07-Feb-2002
- *
- * @brief This file contains the internal functions for config
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-#ifndef IXQMGRQCFG_P_H
-#define IXQMGRQCFG_P_H
-
-/*
- * User defined header files
- */
-#include "IxQMgr.h"
-
-/*
- * Typedefs
- */
-typedef struct
-{
- unsigned wmSetCnt;
-
- struct
- {
- char *qName;
- BOOL isConfigured;
- unsigned int qSizeInWords;
- unsigned int qEntrySizeInWords;
- unsigned int ne;
- unsigned int nf;
- unsigned int numEntries;
- UINT32 baseAddress;
- UINT32 readPtr;
- UINT32 writePtr;
- } qStats[IX_QMGR_MAX_NUM_QUEUES];
-
-} IxQMgrQCfgStats;
-
-/*
- * Initialize the QCfg subcomponent
- */
-void
-ixQMgrQCfgInit (void);
-
-/*
- * Uninitialize the QCfg subcomponent
- */
-void
-ixQMgrQCfgUninit (void);
-
-/*
- * Get the Q size in words
- */
-IxQMgrQSizeInWords
-ixQMgrQSizeInWordsGet (IxQMgrQId qId);
-
-/*
- * Get the Q entry size in words
- */
-IxQMgrQEntrySizeInWords
-ixQMgrQEntrySizeInWordsGet (IxQMgrQId qId);
-
-/*
- * Get the generic cfg stats
- */
-IxQMgrQCfgStats*
-ixQMgrQCfgStatsGet (void);
-
-/*
- * Get queue specific stats
- */
-IxQMgrQCfgStats*
-ixQMgrQCfgQStatsGet (IxQMgrQId qId);
-
-/*
- * Check is the queue configured
- */
-BOOL
-ixQMgrQIsConfigured(IxQMgrQId qId);
-
-#endif /* IX_QMGRQCFG_P_H */
diff --git a/cpu/ixp/npe/include/IxQueueAssignments.h b/cpu/ixp/npe/include/IxQueueAssignments.h
deleted file mode 100644
index 0c1543fa79..0000000000
--- a/cpu/ixp/npe/include/IxQueueAssignments.h
+++ /dev/null
@@ -1,516 +0,0 @@
-/**
- * @file IxQueueAssignments.h
- *
- * @author Intel Corporation
- * @date 29-Oct-2004
- *
- * @brief Central definition for queue assignments
- *
- * Design Notes:
- * This file contains queue assignments used by Ethernet (EthAcc),
- * HSS (HssAcc), ATM (atmdAcc) and DMA (dmaAcc) access libraries.
- *
- * Note: Ethernet QoS traffic class definitions are managed separately
- * by EthDB in IxEthDBQoS.h.
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-#ifndef IxQueueAssignments_H
-#define IxQueueAssignments_H
-
-#include "IxQMgr.h"
-
-/***************************************************************************
- * Queue assignments for ATM
- ***************************************************************************/
-
-/**
- * @brief Global compiler switch to select between 3 possible NPE Modes
- * Define this macro to enable MPHY mode
- *
- * Default(No Switch) = MultiPHY Utopia2
- * IX_UTOPIAMODE = 1 for single Phy Utopia1
- * IX_MPHYSINGLEPORT = 1 for single Phy Utopia2
- */
-#define IX_NPE_MPHYMULTIPORT 1
-#if IX_UTOPIAMODE == 1
-#undef IX_NPE_MPHYMULTIPORT
-#endif
-#if IX_MPHYSINGLEPORT == 1
-#undef IX_NPE_MPHYMULTIPORT
-#endif
-
-/**
- * @def IX_NPE_A_TXDONE_QUEUE_HIGHWATERMARK
- *
- * @brief The NPE reserves the High Watermark for its operation. But it must be set by the Xscale
- */
-#define IX_NPE_A_TXDONE_QUEUE_HIGHWATERMARK 2
-
-/**
- * @def IX_NPE_A_QMQ_ATM_TX_DONE
- *
- * @brief Queue ID for ATM Transmit Done queue
- */
-#define IX_NPE_A_QMQ_ATM_TX_DONE IX_QMGR_QUEUE_1
-
-/**
- * @def IX_NPE_A_QMQ_ATM_TX0
- *
- * @brief Queue ID for ATM transmit Queue in a single phy configuration
- */
-#define IX_NPE_A_QMQ_ATM_TX0 IX_QMGR_QUEUE_2
-
-
-/**
- * @def IX_NPE_A_QMQ_ATM_TXID_MIN
- *
- * @brief Queue Manager Queue ID for ATM transmit Queue with minimum number of queue
- *
- */
-
-/**
- * @def IX_NPE_A_QMQ_ATM_TXID_MAX
- *
- * @brief Queue Manager Queue ID for ATM transmit Queue with maximum number of queue
- *
- */
-
-/**
- * @def IX_NPE_A_QMQ_ATM_RX_HI
- *
- * @brief Queue Manager Queue ID for ATM Receive high Queue
- *
- */
-
-/**
- * @def IX_NPE_A_QMQ_ATM_RX_LO
- *
- * @brief Queue Manager Queue ID for ATM Receive low Queue
- */
-
-#ifdef IX_NPE_MPHYMULTIPORT
-/**
- * @def IX_NPE_A_QMQ_ATM_TX1
- *
- * @brief Queue ID for ATM transmit Queue Multiphy from 1 to 11
- */
-#define IX_NPE_A_QMQ_ATM_TX1 IX_NPE_A_QMQ_ATM_TX0+1
-#define IX_NPE_A_QMQ_ATM_TX2 IX_NPE_A_QMQ_ATM_TX1+1
-#define IX_NPE_A_QMQ_ATM_TX3 IX_NPE_A_QMQ_ATM_TX2+1
-#define IX_NPE_A_QMQ_ATM_TX4 IX_NPE_A_QMQ_ATM_TX3+1
-#define IX_NPE_A_QMQ_ATM_TX5 IX_NPE_A_QMQ_ATM_TX4+1
-#define IX_NPE_A_QMQ_ATM_TX6 IX_NPE_A_QMQ_ATM_TX5+1
-#define IX_NPE_A_QMQ_ATM_TX7 IX_NPE_A_QMQ_ATM_TX6+1
-#define IX_NPE_A_QMQ_ATM_TX8 IX_NPE_A_QMQ_ATM_TX7+1
-#define IX_NPE_A_QMQ_ATM_TX9 IX_NPE_A_QMQ_ATM_TX8+1
-#define IX_NPE_A_QMQ_ATM_TX10 IX_NPE_A_QMQ_ATM_TX9+1
-#define IX_NPE_A_QMQ_ATM_TX11 IX_NPE_A_QMQ_ATM_TX10+1
-#define IX_NPE_A_QMQ_ATM_TXID_MIN IX_NPE_A_QMQ_ATM_TX0
-#define IX_NPE_A_QMQ_ATM_TXID_MAX IX_NPE_A_QMQ_ATM_TX11
-#define IX_NPE_A_QMQ_ATM_RX_HI IX_QMGR_QUEUE_21
-#define IX_NPE_A_QMQ_ATM_RX_LO IX_QMGR_QUEUE_22
-#else
-#define IX_NPE_A_QMQ_ATM_TXID_MIN IX_NPE_A_QMQ_ATM_TX0
-#define IX_NPE_A_QMQ_ATM_TXID_MAX IX_NPE_A_QMQ_ATM_TX0
-#define IX_NPE_A_QMQ_ATM_RX_HI IX_QMGR_QUEUE_10
-#define IX_NPE_A_QMQ_ATM_RX_LO IX_QMGR_QUEUE_11
-#endif /* MPHY */
-
-/**
- * @def IX_NPE_A_QMQ_ATM_FREE_VC0
- *
- * @brief Hardware QMgr Queue ID for ATM Free VC Queue.
- *
- * There are 32 Hardware QMgr Queue ID; from IX_NPE_A_QMQ_ATM_FREE_VC1 to
- * IX_NPE_A_QMQ_ATM_FREE_VC30
- */
-#define IX_NPE_A_QMQ_ATM_FREE_VC0 IX_QMGR_QUEUE_32
-#define IX_NPE_A_QMQ_ATM_FREE_VC1 IX_NPE_A_QMQ_ATM_FREE_VC0+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC2 IX_NPE_A_QMQ_ATM_FREE_VC1+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC3 IX_NPE_A_QMQ_ATM_FREE_VC2+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC4 IX_NPE_A_QMQ_ATM_FREE_VC3+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC5 IX_NPE_A_QMQ_ATM_FREE_VC4+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC6 IX_NPE_A_QMQ_ATM_FREE_VC5+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC7 IX_NPE_A_QMQ_ATM_FREE_VC6+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC8 IX_NPE_A_QMQ_ATM_FREE_VC7+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC9 IX_NPE_A_QMQ_ATM_FREE_VC8+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC10 IX_NPE_A_QMQ_ATM_FREE_VC9+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC11 IX_NPE_A_QMQ_ATM_FREE_VC10+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC12 IX_NPE_A_QMQ_ATM_FREE_VC11+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC13 IX_NPE_A_QMQ_ATM_FREE_VC12+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC14 IX_NPE_A_QMQ_ATM_FREE_VC13+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC15 IX_NPE_A_QMQ_ATM_FREE_VC14+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC16 IX_NPE_A_QMQ_ATM_FREE_VC15+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC17 IX_NPE_A_QMQ_ATM_FREE_VC16+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC18 IX_NPE_A_QMQ_ATM_FREE_VC17+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC19 IX_NPE_A_QMQ_ATM_FREE_VC18+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC20 IX_NPE_A_QMQ_ATM_FREE_VC19+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC21 IX_NPE_A_QMQ_ATM_FREE_VC20+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC22 IX_NPE_A_QMQ_ATM_FREE_VC21+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC23 IX_NPE_A_QMQ_ATM_FREE_VC22+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC24 IX_NPE_A_QMQ_ATM_FREE_VC23+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC25 IX_NPE_A_QMQ_ATM_FREE_VC24+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC26 IX_NPE_A_QMQ_ATM_FREE_VC25+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC27 IX_NPE_A_QMQ_ATM_FREE_VC26+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC28 IX_NPE_A_QMQ_ATM_FREE_VC27+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC29 IX_NPE_A_QMQ_ATM_FREE_VC28+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC30 IX_NPE_A_QMQ_ATM_FREE_VC29+1
-#define IX_NPE_A_QMQ_ATM_FREE_VC31 IX_NPE_A_QMQ_ATM_FREE_VC30+1
-
-/**
- * @def IX_NPE_A_QMQ_ATM_RXFREE_MIN
- *
- * @brief The minimum queue ID for FreeVC queue
- */
-#define IX_NPE_A_QMQ_ATM_RXFREE_MIN IX_NPE_A_QMQ_ATM_FREE_VC0
-
-/**
- * @def IX_NPE_A_QMQ_ATM_RXFREE_MAX
- *
- * @brief The maximum queue ID for FreeVC queue
- */
-#define IX_NPE_A_QMQ_ATM_RXFREE_MAX IX_NPE_A_QMQ_ATM_FREE_VC31
-
-/**
- * @def IX_NPE_A_QMQ_OAM_FREE_VC
- * @brief OAM Rx Free queue ID
- */
-#ifdef IX_NPE_MPHYMULTIPORT
-#define IX_NPE_A_QMQ_OAM_FREE_VC IX_QMGR_QUEUE_14
-#else
-#define IX_NPE_A_QMQ_OAM_FREE_VC IX_QMGR_QUEUE_3
-#endif /* MPHY */
-
-/****************************************************************************
- * Queue assignments for HSS
- ****************************************************************************/
-
-/**** HSS Port 0 ****/
-
-/**
- * @def IX_NPE_A_QMQ_HSS0_CHL_RX_TRIG
- *
- * @brief Hardware QMgr Queue ID for HSS Port 0 Channelized Receive trigger
- */
-#define IX_NPE_A_QMQ_HSS0_CHL_RX_TRIG IX_QMGR_QUEUE_12
-
-/**
- * @def IX_NPE_A_QMQ_HSS0_PKT_RX
- *
- * @brief Hardware QMgr Queue ID for HSS Port 0 Packetized Receive
- */
-#define IX_NPE_A_QMQ_HSS0_PKT_RX IX_QMGR_QUEUE_13
-
-/**
- * @def IX_NPE_A_QMQ_HSS0_PKT_TX0
- *
- * @brief Hardware QMgr Queue ID for HSS Port 0 Packetized Transmit queue 0
- */
-#define IX_NPE_A_QMQ_HSS0_PKT_TX0 IX_QMGR_QUEUE_14
-
-/**
- * @def IX_NPE_A_QMQ_HSS0_PKT_TX1
- *
- * @brief Hardware QMgr Queue ID for HSS Port 0 Packetized Transmit queue 1
- */
-#define IX_NPE_A_QMQ_HSS0_PKT_TX1 IX_QMGR_QUEUE_15
-
-/**
- * @def IX_NPE_A_QMQ_HSS0_PKT_TX2
- *
- * @brief Hardware QMgr Queue ID for HSS Port 0 Packetized Transmit queue 2
- */
-#define IX_NPE_A_QMQ_HSS0_PKT_TX2 IX_QMGR_QUEUE_16
-
-/**
- * @def IX_NPE_A_QMQ_HSS0_PKT_TX3
- *
- * @brief Hardware QMgr Queue ID for HSS Port 0 Packetized Transmit queue 3
- */
-#define IX_NPE_A_QMQ_HSS0_PKT_TX3 IX_QMGR_QUEUE_17
-
-/**
- * @def IX_NPE_A_QMQ_HSS0_PKT_RX_FREE0
- *
- * @brief Hardware QMgr Queue ID for HSS Port 0 Packetized Receive Free queue 0
- */
-#define IX_NPE_A_QMQ_HSS0_PKT_RX_FREE0 IX_QMGR_QUEUE_18
-
-/**
- * @def IX_NPE_A_QMQ_HSS0_PKT_RX_FREE1
- *
- * @brief Hardware QMgr Queue ID for HSS Port 0 Packetized Receive Free queue 1
- */
-#define IX_NPE_A_QMQ_HSS0_PKT_RX_FREE1 IX_QMGR_QUEUE_19
-
-/**
- * @def IX_NPE_A_QMQ_HSS0_PKT_RX_FREE2
- *
- * @brief Hardware QMgr Queue ID for HSS Port 0 Packetized Receive Free queue 2
- */
-#define IX_NPE_A_QMQ_HSS0_PKT_RX_FREE2 IX_QMGR_QUEUE_20
-
-/**
- * @def IX_NPE_A_QMQ_HSS0_PKT_RX_FREE3
- *
- * @brief Hardware QMgr Queue ID for HSS Port 0 Packetized Receive Free queue 3
- */
-#define IX_NPE_A_QMQ_HSS0_PKT_RX_FREE3 IX_QMGR_QUEUE_21
-
-/**
- * @def IX_NPE_A_QMQ_HSS0_PKT_TX_DONE
- *
- * @brief Hardware QMgr Queue ID for HSS Port 0 Packetized Transmit Done queue
- */
-#define IX_NPE_A_QMQ_HSS0_PKT_TX_DONE IX_QMGR_QUEUE_22
-
-/**** HSS Port 1 ****/
-
-/**
- * @def IX_NPE_A_QMQ_HSS1_CHL_RX_TRIG
- *
- * @brief Hardware QMgr Queue ID for HSS Port 1 Channelized Receive trigger
- */
-#define IX_NPE_A_QMQ_HSS1_CHL_RX_TRIG IX_QMGR_QUEUE_10
-
-/**
- * @def IX_NPE_A_QMQ_HSS1_PKT_RX
- *
- * @brief Hardware QMgr Queue ID for HSS Port 1 Packetized Receive
- */
-#define IX_NPE_A_QMQ_HSS1_PKT_RX IX_QMGR_QUEUE_0
-
-/**
- * @def IX_NPE_A_QMQ_HSS1_PKT_TX0
- *
- * @brief Hardware QMgr Queue ID for HSS Port 1 Packetized Transmit queue 0
- */
-#define IX_NPE_A_QMQ_HSS1_PKT_TX0 IX_QMGR_QUEUE_5
-
-/**
- * @def IX_NPE_A_QMQ_HSS1_PKT_TX1
- *
- * @brief Hardware QMgr Queue ID for HSS Port 1 Packetized Transmit queue 1
- */
-#define IX_NPE_A_QMQ_HSS1_PKT_TX1 IX_QMGR_QUEUE_6
-
-/**
- * @def IX_NPE_A_QMQ_HSS1_PKT_TX2
- *
- * @brief Hardware QMgr Queue ID for HSS Port 1 Packetized Transmit queue 2
- */
-#define IX_NPE_A_QMQ_HSS1_PKT_TX2 IX_QMGR_QUEUE_7
-
-/**
- * @def IX_NPE_A_QMQ_HSS1_PKT_TX3
- *
- * @brief Hardware QMgr Queue ID for HSS Port 1 Packetized Transmit queue 3
- */
-#define IX_NPE_A_QMQ_HSS1_PKT_TX3 IX_QMGR_QUEUE_8
-
-/**
- * @def IX_NPE_A_QMQ_HSS1_PKT_RX_FREE0
- *
- * @brief Hardware QMgr Queue ID for HSS Port 1 Packetized Receive Free queue 0
- */
-#define IX_NPE_A_QMQ_HSS1_PKT_RX_FREE0 IX_QMGR_QUEUE_1
-
-/**
- * @def IX_NPE_A_QMQ_HSS1_PKT_RX_FREE1
- *
- * @brief Hardware QMgr Queue ID for HSS Port 1 Packetized Receive Free queue 1
- */
-#define IX_NPE_A_QMQ_HSS1_PKT_RX_FREE1 IX_QMGR_QUEUE_2
-
-/**
- * @def IX_NPE_A_QMQ_HSS1_PKT_RX_FREE2
- *
- * @brief Hardware QMgr Queue ID for HSS Port 1 Packetized Receive Free queue 2
- */
-#define IX_NPE_A_QMQ_HSS1_PKT_RX_FREE2 IX_QMGR_QUEUE_3
-
-/**
- * @def IX_NPE_A_QMQ_HSS1_PKT_RX_FREE3
- *
- * @brief Hardware QMgr Queue ID for HSS Port 1 Packetized Receive Free queue 3
- */
-#define IX_NPE_A_QMQ_HSS1_PKT_RX_FREE3 IX_QMGR_QUEUE_4
-
-/**
- * @def IX_NPE_A_QMQ_HSS1_PKT_TX_DONE
- *
- * @brief Hardware QMgr Queue ID for HSS Port 1 Packetized Transmit Done queue
- */
-#define IX_NPE_A_QMQ_HSS1_PKT_TX_DONE IX_QMGR_QUEUE_9
-
-/*****************************************************************************************
- * Queue assignments for DMA
- *****************************************************************************************/
-
-#define IX_DMA_NPE_A_REQUEST_QID IX_QMGR_QUEUE_19 /**< Queue Id for NPE A DMA Request */
-#define IX_DMA_NPE_A_DONE_QID IX_QMGR_QUEUE_20 /**< Queue Id for NPE A DMA Done */
-#define IX_DMA_NPE_B_REQUEST_QID IX_QMGR_QUEUE_24 /**< Queue Id for NPE B DMA Request */
-#define IX_DMA_NPE_B_DONE_QID IX_QMGR_QUEUE_26 /**< Queue Id for NPE B DMA Done */
-#define IX_DMA_NPE_C_REQUEST_QID IX_QMGR_QUEUE_25 /**< Queue Id for NPE C DMA Request */
-#define IX_DMA_NPE_C_DONE_QID IX_QMGR_QUEUE_27 /**< Queue Id for NPE C DMA Done */
-
-
-/*****************************************************************************************
- * Queue assignments for Ethernet
- *
- * Note: Rx queue definitions, which include QoS traffic class definitions
- * are managed by EthDB and declared in IxEthDBQoS.h
- *****************************************************************************************/
-
-/**
-*
-* @def IX_ETH_ACC_RX_FRAME_ETH_Q
-*
-* @brief Eth0/Eth1 NPE Frame Recieve Q.
-*
-* @note THIS IS NOT USED - the Rx queues are read from EthDB QoS configuration
-*
-*/
-#define IX_ETH_ACC_RX_FRAME_ETH_Q (IX_QMGR_QUEUE_4)
-
-/**
-*
-* @def IX_ETH_ACC_RX_FREE_BUFF_ENET0_Q
-*
-* @brief Supply Rx Buffers Ethernet Q for NPEB - Eth 0 - Port 1
-*
-*/
-#define IX_ETH_ACC_RX_FREE_BUFF_ENET0_Q (IX_QMGR_QUEUE_27)
-
-/**
-*
-* @def IX_ETH_ACC_RX_FREE_BUFF_ENET1_Q
-*
-* @brief Supply Rx Buffers Ethernet Q for NPEC - Eth 1 - Port 2
-*
-*/
-#define IX_ETH_ACC_RX_FREE_BUFF_ENET1_Q (IX_QMGR_QUEUE_28)
-
-/**
-*
-* @def IX_ETH_ACC_RX_FREE_BUFF_ENET2_Q
-*
-* @brief Supply Rx Buffers Ethernet Q for NPEA - Eth 2 - Port 3
-*
-*/
-#define IX_ETH_ACC_RX_FREE_BUFF_ENET2_Q (IX_QMGR_QUEUE_26)
-
-
-/**
-*
-* @def IX_ETH_ACC_TX_FRAME_ENET0_Q
-*
-* @brief Submit frame Q for NPEB Eth 0 - Port 1
-*
-*/
-#define IX_ETH_ACC_TX_FRAME_ENET0_Q (IX_QMGR_QUEUE_24)
-
-
-/**
-*
-* @def IX_ETH_ACC_TX_FRAME_ENET1_Q
-*
-* @brief Submit frame Q for NPEC Eth 1 - Port 2
-*
-*/
-#define IX_ETH_ACC_TX_FRAME_ENET1_Q (IX_QMGR_QUEUE_25)
-
-/**
-*
-* @def IX_ETH_ACC_TX_FRAME_ENET2_Q
-*
-* @brief Submit frame Q for NPEA Eth 2 - Port 3
-*
-*/
-#define IX_ETH_ACC_TX_FRAME_ENET2_Q (IX_QMGR_QUEUE_23)
-
-/**
-*
-* @def IX_ETH_ACC_TX_FRAME_DONE_ETH_Q
-*
-* @brief Transmit complete Q for NPE Eth 0/1, Port 1&2
-*
-*/
-#define IX_ETH_ACC_TX_FRAME_DONE_ETH_Q (IX_QMGR_QUEUE_31)
-
-/*****************************************************************************************
- * Queue assignments for Crypto
- *****************************************************************************************/
-
-/** Crypto Service Request Queue */
-#define IX_CRYPTO_ACC_CRYPTO_REQ_Q (IX_QMGR_QUEUE_29)
-
-/** Crypto Service Done Queue */
-#define IX_CRYPTO_ACC_CRYPTO_DONE_Q (IX_QMGR_QUEUE_30)
-
-/** Crypto Req Q CB tag */
-#define IX_CRYPTO_ACC_CRYPTO_REQ_Q_CB_TAG (0)
-
-/** Crypto Done Q CB tag */
-#define IX_CRYPTO_ACC_CRYPTO_DONE_Q_CB_TAG (1)
-
-/** WEP Service Request Queue */
-#define IX_CRYPTO_ACC_WEP_REQ_Q (IX_QMGR_QUEUE_21)
-
-/** WEP Service Done Queue */
-#define IX_CRYPTO_ACC_WEP_DONE_Q (IX_QMGR_QUEUE_22)
-
-/** WEP Req Q CB tag */
-#define IX_CRYPTO_ACC_WEP_REQ_Q_CB_TAG (2)
-
-/** WEP Done Q CB tag */
-#define IX_CRYPTO_ACC_WEP_DONE_Q_CB_TAG (3)
-
-/** Number of queues allocate to crypto hardware accelerator services */
-#define IX_CRYPTO_ACC_NUM_OF_CRYPTO_Q (2)
-
-/** Number of queues allocate to WEP NPE services */
-#define IX_CRYPTO_ACC_NUM_OF_WEP_NPE_Q (2)
-
-/** Number of queues allocate to CryptoAcc component */
-#define IX_CRYPTO_ACC_NUM_OF_Q (IX_CRYPTO_ACC_NUM_OF_CRYPTO_Q + IX_CRYPTO_ACC_NUM_OF_WEP_NPE_Q)
-
-#endif /* IxQueueAssignments_H */
diff --git a/cpu/ixp/npe/include/IxSspAcc.h b/cpu/ixp/npe/include/IxSspAcc.h
deleted file mode 100644
index 35e7abf06f..0000000000
--- a/cpu/ixp/npe/include/IxSspAcc.h
+++ /dev/null
@@ -1,1271 +0,0 @@
-/**
- * @file IxSspAcc.h
- *
- * @brief Header file for the IXP400 SSP Serial Port Access (IxSspAcc)
- *
- * @version $Revision: 0.1 $
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxSspAcc IXP400 SSP Serial Port Access (IxSspAcc) API
- *
- * @brief IXP400 SSP Serial Port Access Public API
- *
- * @{
- */
-#ifndef IXSSPACC_H
-#define IXSSPACC_H
-
-#ifdef __ixp46X
-
-#include "IxOsal.h"
-
-/*
- * Section for enum
- */
-/**
- * @ingroup IxSspAcc
- *
- * @enum IxSspAccDataSize
- *
- * @brief The data sizes in bits that are supported by the protocol
- */
-typedef enum
-{
- DATA_SIZE_TOO_SMALL = 0x2,
- DATA_SIZE_4 = 0x3,
- DATA_SIZE_5,
- DATA_SIZE_6,
- DATA_SIZE_7,
- DATA_SIZE_8,
- DATA_SIZE_9,
- DATA_SIZE_10,
- DATA_SIZE_11,
- DATA_SIZE_12,
- DATA_SIZE_13,
- DATA_SIZE_14,
- DATA_SIZE_15,
- DATA_SIZE_16,
- DATA_SIZE_TOO_BIG
-} IxSspAccDataSize;
-
-/**
- * @ingroup IxSspAcc
- *
- * @enum IxSspAccPortStatus
- *
- * @brief The status of the SSP port to be set to enable/disable
- */
-typedef enum
-{
- SSP_PORT_DISABLE = 0x0,
- SSP_PORT_ENABLE,
- INVALID_SSP_PORT_STATUS
-} IxSspAccPortStatus;
-
-/**
- * @ingroup IxSspAcc
- *
- * @enum IxSspAccFrameFormat
- *
- * @brief The frame format that is to be used - SPI, SSP, or Microwire
- */
-typedef enum
-{
- SPI_FORMAT = 0x0,
- SSP_FORMAT,
- MICROWIRE_FORMAT,
- INVALID_FORMAT
-} IxSspAccFrameFormat;
-
-/**
- * @ingroup IxSspAcc
- *
- * @enum IxSspAccClkSource
- *
- * @brief The source to produce the SSP serial clock
- */
-typedef enum
-{
- ON_CHIP_CLK = 0x0,
- EXTERNAL_CLK,
- INVALID_CLK_SOURCE
-} IxSspAccClkSource;
-
-/**
- * @ingroup IxSspAcc
- *
- * @enum IxSspAccSpiSclkPhase
- *
- * @brief The SPI SCLK Phase:
- * 0 - SCLK is inactive one cycle at the start of a frame and 1/2 cycle at the
- * end of a frame.
- * 1 - SCLK is inactive 1/2 cycle at the start of a frame and one cycle at the
- * end of a frame.
- */
-typedef enum
-{
- START_ONE_END_HALF = 0x0,
- START_HALF_END_ONE,
- INVALID_SPI_PHASE
-} IxSspAccSpiSclkPhase;
-
-/**
- * @ingroup IxSspAcc
- *
- * @enum IxSspAccSpiSclkPolarity
- *
- * @brief The SPI SCLK Polarity can be set to either low or high.
- */
-typedef enum
-{
- SPI_POLARITY_LOW = 0x0,
- SPI_POLARITY_HIGH,
- INVALID_SPI_POLARITY
-} IxSspAccSpiSclkPolarity;
-
-/**
- * @ingroup IxSspAcc
- *
- * @enum IxSspAccMicrowireCtlWord
- *
- * @brief The Microwire control word can be either 8 or 16 bit.
- */
-typedef enum
-{
- MICROWIRE_8_BIT = 0x0,
- MICROWIRE_16_BIT,
- INVALID_MICROWIRE_CTL_WORD
-} IxSspAccMicrowireCtlWord;
-
-/**
- * @ingroup IxSspAcc
- *
- * @enum IxSspAccFifoThreshold
- *
- * @brief The threshold in frames (each frame is defined by IxSspAccDataSize)
- * that can be set for the FIFO to trigger a threshold exceed when
- * checking with the ExceedThresholdCheck functions or an interrupt
- * when it is enabled.
- */
-typedef enum
-{
- FIFO_TSHLD_1 = 0x0,
- FIFO_TSHLD_2,
- FIFO_TSHLD_3,
- FIFO_TSHLD_4,
- FIFO_TSHLD_5,
- FIFO_TSHLD_6,
- FIFO_TSHLD_7,
- FIFO_TSHLD_8,
- FIFO_TSHLD_9,
- FIFO_TSHLD_10,
- FIFO_TSHLD_11,
- FIFO_TSHLD_12,
- FIFO_TSHLD_13,
- FIFO_TSHLD_14,
- FIFO_TSHLD_15,
- FIFO_TSHLD_16,
- INVALID_FIFO_TSHLD
-} IxSspAccFifoThreshold;
-
-/**
- * @ingroup IxSspAcc
- *
- * @enum IX_SSP_STATUS
- *
- * @brief The statuses that can be returned in a SSP Serial Port Access
- */
-typedef enum
-{
- IX_SSP_SUCCESS = IX_SUCCESS, /**< Success status */
- IX_SSP_FAIL, /**< Fail status */
- IX_SSP_RX_FIFO_OVERRUN_HANDLER_MISSING, /**<
- Rx FIFO Overrun handler is NULL. */
- IX_SSP_RX_FIFO_HANDLER_MISSING, /**<
- Rx FIFO threshold hit or above handler is NULL
- */
- IX_SSP_TX_FIFO_HANDLER_MISSING, /**<
- Tx FIFO threshold hit or below handler is NULL
- */
- IX_SSP_FIFO_NOT_EMPTY_FOR_SETTING_CTL_CMD, /**<
- Tx FIFO not empty and therefore microwire
- control command size setting is not allowed. */
- IX_SSP_INVALID_FRAME_FORMAT_ENUM_VALUE, /**<
- frame format selected is invalid. */
- IX_SSP_INVALID_DATA_SIZE_ENUM_VALUE, /**<
- data size selected is invalid. */
- IX_SSP_INVALID_CLOCK_SOURCE_ENUM_VALUE, /**<
- source clock selected is invalid. */
- IX_SSP_INVALID_TX_FIFO_THRESHOLD_ENUM_VALUE, /**<
- Tx FIFO threshold selected is invalid. */
- IX_SSP_INVALID_RX_FIFO_THRESHOLD_ENUM_VALUE, /**<
- Rx FIFO threshold selected is invalid. */
- IX_SSP_INVALID_SPI_PHASE_ENUM_VALUE, /**<
- SPI phase selected is invalid. */
- IX_SSP_INVALID_SPI_POLARITY_ENUM_VALUE, /**<
- SPI polarity selected is invalid. */
- IX_SSP_INVALID_MICROWIRE_CTL_CMD_ENUM_VALUE, /**<
- Microwire control command selected is invalid
- */
- IX_SSP_INT_UNBIND_FAIL, /**< Interrupt unbind fail to unbind SSP
- interrupt */
- IX_SSP_INT_BIND_FAIL, /**< Interrupt bind fail during init */
- IX_SSP_RX_FIFO_NOT_EMPTY, /**<
- Rx FIFO not empty while trying to change data
- size. */
- IX_SSP_TX_FIFO_NOT_EMPTY, /**<
- Rx FIFO not empty while trying to change data
- size or microwire control command size. */
- IX_SSP_POLL_MODE_BLOCKING, /**<
- poll mode selected blocks interrupt mode from
- being selected. */
- IX_SSP_TX_FIFO_HIT_BELOW_THRESHOLD, /**<
- Tx FIFO level hit or below threshold. */
- IX_SSP_TX_FIFO_EXCEED_THRESHOLD, /**<
- Tx FIFO level exceeded threshold. */
- IX_SSP_RX_FIFO_HIT_ABOVE_THRESHOLD, /**<
- Rx FIFO level hit or exceeded threshold. */
- IX_SSP_RX_FIFO_BELOW_THRESHOLD, /**<
- Rx FIFO level below threshold. */
- IX_SSP_BUSY, /**< SSP is busy. */
- IX_SSP_IDLE, /**< SSP is idle. */
- IX_SSP_OVERRUN_OCCURRED, /**<
- SSP has experienced an overrun. */
- IX_SSP_NO_OVERRUN, /**<
- SSP did not experience an overrun. */
- IX_SSP_NOT_SUPORTED, /**< hardware does not support SSP */
- IX_SSP_NOT_INIT, /**< SSP Access not intialized */
- IX_SSP_NULL_POINTER /**< parameter passed in is NULL */
-} IX_SSP_STATUS;
-
-/**
- * @ingroup IxSspAcc
- *
- * @brief SSP Rx FIFO Overrun handler
- *
- * This function is called for the client to handle Rx FIFO Overrun that occurs
- * in the SSP hardware
- */
-typedef void (*RxFIFOOverrunHandler)(void);
-
-/**
- * @ingroup IxSspAcc
- *
- * @brief SSP Rx FIFO Threshold hit or above handler
- *
- * This function is called for the client to handle Rx FIFO threshold hit or
- * or above that occurs in the SSP hardware
- */
-typedef void (*RxFIFOThresholdHandler)(void);
-
-/**
- * @ingroup IxSspAcc
- *
- * @brief SSP Tx FIFO Threshold hit or below handler
- *
- * This function is called for the client to handle Tx FIFO threshold hit or
- * or below that occurs in the SSP hardware
- */
-typedef void (*TxFIFOThresholdHandler)(void);
-
-
-/*
- * Section for struct
- */
-/**
- * @ingroup IxSspAcc
- *
- * @brief contains all the variables required to initialize the SSP serial port
- * hardware.
- *
- * Structure to be filled and used for calling initialization
- */
-typedef struct
-{
- IxSspAccFrameFormat FrameFormatSelected;/**<Select between SPI, SSP and
- Microwire. */
- IxSspAccDataSize DataSizeSelected; /**<Select between 4 and 16. */
- IxSspAccClkSource ClkSourceSelected; /**<Select clock source to be
- on-chip or external. */
- IxSspAccFifoThreshold TxFIFOThresholdSelected;
- /**<Select Tx FIFO threshold
- between 1 to 16. */
- IxSspAccFifoThreshold RxFIFOThresholdSelected;
- /**<Select Rx FIFO threshold
- between 1 to 16. */
- BOOL RxFIFOIntrEnable; /**<Enable/disable Rx FIFO
- threshold interrupt. Disabling
- this interrupt will require
- the use of the polling function
- RxFIFOExceedThresholdCheck. */
- BOOL TxFIFOIntrEnable; /**<Enable/disable Tx FIFO
- threshold interrupt. Disabling
- this interrupt will require
- the use of the polling function
- TxFIFOExceedThresholdCheck. */
- RxFIFOThresholdHandler RxFIFOThsldHdlr; /**<Pointer to function to handle
- a Rx FIFO interrupt. */
- TxFIFOThresholdHandler TxFIFOThsldHdlr; /**<Pointer to function to handle
- a Tx FIFO interrupt. */
- RxFIFOOverrunHandler RxFIFOOverrunHdlr; /**<Pointer to function to handle
- a Rx FIFO overrun interrupt. */
- BOOL LoopbackEnable; /**<Select operation mode to be
- normal or loopback mode. */
- IxSspAccSpiSclkPhase SpiSclkPhaseSelected;
- /**<Select SPI SCLK phase to start
- with one inactive cycle and end
- with 1/2 inactive cycle or
- start with 1/2 inactive cycle
- and end with one inactive
- cycle. (Only used in
- SPI format). */
- IxSspAccSpiSclkPolarity SpiSclkPolaritySelected;
- /**<Select SPI SCLK idle state
- to be low or high. (Only used in
- SPI format). */
- IxSspAccMicrowireCtlWord MicrowireCtlWordSelected;
- /**<Select Microwire control
- format to be 8 or 16-bit. (Only
- used in Microwire format). */
- UINT8 SerialClkRateSelected; /**<Select between 0 (1.8432Mbps)
- and 255 (7.2Kbps). The
- formula used is Bit rate =
- 3.6864x10^6 /
- (2 x (SerialClkRateSelect + 1))
- */
-} IxSspInitVars;
-
-/**
- * @ingroup IxSspAcc
- *
- * @brief contains counters of the SSP statistics
- *
- * Structure contains all values of counters and associated overflows.
- */
-typedef struct
-{
- UINT32 ixSspRcvCounter; /**<Total frames received. */
- UINT32 ixSspXmitCounter; /**<Total frames transmitted. */
- UINT32 ixSspOverflowCounter;/**<Total occurrences of overflow. */
-} IxSspAccStatsCounters;
-
-
-/*
- * Section for prototypes interface functions
- */
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccInit (
- IxSspInitVars *initVarsSelected);
- *
- * @brief Initializes the SSP Access module.
- *
- * @param "IxSspAccInitVars [in] *initVarsSelected" - struct containing required
- * variables for initialization
- *
- * Global Data :
- * - None.
- *
- * This API will initialize the SSP Serial Port hardware to the user specified
- * configuration. Then it will enable the SSP Serial Port.
- * *NOTE*: Once interrupt or polling mode is selected, the mode cannot be
- * changed via the interrupt enable/disable function but the init needs to be
- * called again to change it.
- *
- * @return
- * - IX_SSP_SUCCESS - Successfully initialize and enable the SSP
- * serial port.
- * - IX_SSP_RX_FIFO_HANDLER_MISSING - interrupt mode is selected but RX FIFO
- * handler pointer is NULL
- * - IX_SSP_TX_FIFO_HANDLER_MISSING - interrupt mode is selected but TX FIFO
- * handler pointer is NULL
- * - IX_SSP_RX_FIFO_OVERRUN_HANDLER_MISSING - interrupt mode is selected but
- * RX FIFO Overrun handler pointer is NULL
- * - IX_SSP_RX_FIFO_NOT_EMPTY - Rx FIFO not empty, data size change is not
- * allowed.
- * - IX_SSP_TX_FIFO_NOT_EMPTY - Tx FIFO not empty, data size change is not
- * allowed.
- * - IX_SSP_INVALID_FRAME_FORMAT_ENUM_VALUE - frame format selected is invalid
- * - IX_SSP_INVALID_DATA_SIZE_ENUM_VALUE - data size selected is invalid
- * - IX_SSP_INVALID_CLOCK_SOURCE_ENUM_VALUE - clock source selected is invalid
- * - IX_SSP_INVALID_TX_FIFO_THRESHOLD_ENUM_VALUE - Tx FIFO threshold level
- * selected is invalid
- * - IX_SSP_INVALID_RX_FIFO_THRESHOLD_ENUM_VALUE - Rx FIFO threshold level
- * selected is invalid
- * - IX_SSP_INVALID_SPI_PHASE_ENUM_VALUE - SPI phase selected is invalid
- * - IX_SSP_INVALID_SPI_POLARITY_ENUM_VALUE - SPI polarity selected is invalid
- * - IX_SSP_INVALID_MICROWIRE_CTL_CMD_ENUM_VALUE - microwire control command
- * size is invalid
- * - IX_SSP_INT_UNBIND_FAIL - interrupt handler failed to unbind SSP interrupt
- * - IX_SSP_INT_BIND_FAIL - interrupt handler failed to bind to SSP interrupt
- * hardware trigger
- * - IX_SSP_NOT_SUPORTED - hardware does not support SSP
- * - IX_SSP_NULL_POINTER - parameter passed in is NULL
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccInit (IxSspInitVars *initVarsSelected);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccUninit (
- void)
- *
- * @brief Un-initializes the SSP Serial Port Access component
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will disable the SSP Serial Port hardware. The client can call the
- * init function again if they wish to enable the SSP.
- *
- * @return
- * - IX_SSP_SUCCESS - successfully uninit SSP component
- * - IX_SSP_INT_UNBIND_FAIL - interrupt handler failed to unbind SSP interrupt
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccUninit (void);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccFIFODataSubmit (
- UINT16 *data,
- UINT32 amtOfData)
- *
- * @brief Inserts data into the SSP Serial Port's FIFO
- *
- * @param "UINT16 [in] *data" - pointer to the location to transmit the data
- * from
- * "UINT32 [in] amtOfData" - number of data to be transmitted.
- *
- * Global Data :
- * - None.
- *
- * This API will insert the amount of data specified by "amtOfData" from buffer
- * pointed to by "data" into the FIFO to be transmitted by the hardware.
- *
- * @return
- * - IX_SSP_SUCCESS - Data inserted successfully into FIFO
- * - IX_SSP_FAIL - FIFO insufficient space
- * - IX_SSP_NULL_POINTER - data pointer passed by client is NULL
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccFIFODataSubmit (
- UINT16* data,
- UINT32 amtOfData);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccFIFODataReceive (
- UINT16 *data,
- UINT32 amtOfData)
- *
- * @brief Extract data from the SSP Serial Port's FIFO
- *
- * @param "UINT16 [in] *data" - pointer to the location to receive the data into
- * "UINT32 [in] amtOfData" - number of data to be received.
- *
- * Global Data :
- * - None.
- *
- * This API will extract the amount of data specified by "amtOfData" from the
- * FIFO already received by the hardware into the buffer pointed to by "data".
- *
- * @return
- * - IX_SSP_SUCCESS - Data extracted successfully from FIFO
- * - IX_SSP_FAIL - FIFO has no data
- * - IX_SSP_NULL_POINTER - data pointer passed by client is NULL
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccFIFODataReceive (
- UINT16* data,
- UINT32 amtOfData);
-
-
-/**
- * Polling Functions
- */
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccTxFIFOHitOrBelowThresholdCheck (
- void)
- *
- * @brief Check if the Tx FIFO threshold has been hit or fallen below.
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will return whether the Tx FIFO threshold has been exceeded or not
- *
- * @return
- * - IX_SSP_TX_FIFO_HIT_BELOW_THRESHOLD - Tx FIFO level hit or below threshold .
- * - IX_SSP_TX_FIFO_EXCEED_THRESHOLD - Tx FIFO level exceeded threshold.
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccTxFIFOHitOrBelowThresholdCheck (
- void);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccRxFIFOHitOrAboveThresholdCheck (
- void)
- *
- * @brief Check if the Rx FIFO threshold has been hit or exceeded.
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will return whether the Rx FIFO level is below threshold or not
- *
- * @return
- * - IX_SSP_RX_FIFO_HIT_ABOVE_THRESHOLD - Rx FIFO level hit or exceeded threshold
- * - IX_SSP_RX_FIFO_BELOW_THRESHOLD - Rx FIFO level below threshold
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccRxFIFOHitOrAboveThresholdCheck (
- void);
-
-
-/**
- * Configuration functions
- *
- * NOTE: These configurations are not required to be called once init is called
- * unless configurations need to be changed on the fly.
- */
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccSSPPortStatusSet (
- IxSspAccPortStatus portStatusSelected)
- *
- * @brief Enables/disables the SSP Serial Port hardware.
- *
- * @param "IxSspAccPortStatus [in] portStatusSelected" - Set the SSP port to
- * enable or disable
- *
- * Global Data :
- * - None.
- *
- * This API will enable/disable the SSP Serial Port hardware.
- * NOTE: This function is called by init to enable the SSP after setting up the
- * configurations and by uninit to disable the SSP.
- *
- * @return
- * - IX_SSP_SUCCESS - Port status set with valid enum value
- * - IX_SSP_FAIL - invalid enum value
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccSSPPortStatusSet (
- IxSspAccPortStatus portStatusSelected);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccFrameFormatSelect (
- IxSspAccFrameFormat frameFormatSelected)
- *
- * @brief Sets the frame format for the SSP Serial Port hardware
- *
- * @param "IxSspAccFrameFormat [in] frameFormatSelected" - The frame format of
- * SPI, SSP or Microwire can be selected as the format
- *
- * Global Data :
- * - None.
- *
- * This API will set the format for the transfers via user input.
- * *NOTE*: The SSP hardware will be disabled to clear the FIFOs. Then its
- * previous state (enabled/disabled) restored after changing the format.
- *
- * @return
- * - IX_SSP_SUCCESS - frame format set with valid enum value
- * - IX_SSP_INVALID_FRAME_FORMAT_ENUM_VALUE - invalid frame format value
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccFrameFormatSelect (
- IxSspAccFrameFormat frameFormatSelected);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccDataSizeSelect (
- IxSspAccDataSize dataSizeSelected)
- *
- * @brief Sets the data size for transfers
- *
- * @param "IxSspAccDataSize [in] dataSizeSelected" - The data size between 4
- * and 16 that can be selected for data transfers
- *
- * Global Data :
- * - None.
- *
- * This API will set the data size for the transfers via user input. It will
- * disallow the change of the data size if either of the Rx/Tx FIFO is not
- * empty to prevent data loss.
- * *NOTE*: The SSP port will be disabled if the FIFOs are found to be empty and
- * if between the check and disabling of the SSP (which clears the
- * FIFOs) data is received into the FIFO, it might be lost.
- * *NOTE*: The FIFOs can be cleared by disabling the SSP Port if necessary to
- * force the data size change.
- *
- * @return
- * - IX_SSP_SUCCESS - data size set with valid enum value
- * - IX_SSP_RX_FIFO_NOT_EMPTY - Rx FIFO not empty, data size change is not
- * allowed.
- * - IX_SSP_TX_FIFO_NOT_EMPTY - Tx FIFO not empty, data size change is not
- * allowed.
- * - IX_SSP_INVALID_DATA_SIZE_ENUM_VALUE - invalid enum value
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccDataSizeSelect (
- IxSspAccDataSize dataSizeSelected);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccClockSourceSelect(
- IxSspAccClkSource clkSourceSelected)
- *
- * @brief Sets the clock source of the SSP Serial Port hardware
- *
- * @param "IxSspAccClkSource [in] clkSourceSelected" - The clock source from
- * either external source on on-chip can be selected as the source
- *
- * Global Data :
- * - None.
- *
- * This API will set the clock source for the transfers via user input.
- *
- * @return
- * - IX_SSP_SUCCESS - clock source set with valid enum value
- * - IX_SSP_INVALID_CLOCK_SOURCE_ENUM_VALUE - invalid enum value
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccClockSourceSelect (
- IxSspAccClkSource clkSourceSelected);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccSerialClockRateConfigure (
- UINT8 serialClockRateSelected)
- *
- * @brief Sets the on-chip Serial Clock Rate of the SSP Serial Port hardware.
- *
- * @param "UINT8 [in] serialClockRateSelected" - The serial clock rate that can
- * be set is between 7.2Kbps and 1.8432Mbps. The formula used is
- * Bit rate = 3.6864x10^6 / (2 x (SerialClockRateSelected + 1))
- *
- * Global Data :
- * - None.
- *
- * This API will set the serial clock rate for the transfers via user input.
- *
- * @return
- * - IX_SSP_SUCCESS - Serial clock rate configured successfully
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccSerialClockRateConfigure (
- UINT8 serialClockRateSelected);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccRxFIFOIntEnable (
- RxFIFOThresholdHandler rxFIFOIntrHandler)
- *
- * @brief Enables service request interrupt whenever the Rx FIFO hits its
- * threshold
- *
- * @param "void [in] *rxFIFOIntrHandler(UINT32)" - function pointer to the
- * interrupt handler for the Rx FIFO exceeded.
- *
- * Global Data :
- * - None.
- *
- * This API will enable the service request interrupt for the Rx FIFO
- *
- * @return
- * - IX_SSP_SUCCESS - Rx FIFO level interrupt enabled successfully
- * - IX_SSP_RX_FIFO_HANDLER_MISSING - missing handler for Rx FIFO level interrupt
- * - IX_SSP_POLL_MODE_BLOCKING - poll mode is selected at init, interrupt not
- * allowed to be enabled. Use init to enable interrupt mode.
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccRxFIFOIntEnable (
- RxFIFOThresholdHandler rxFIFOIntrHandler);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccRxFIFOIntDisable (
- void)
- *
- * @brief Disables service request interrupt of the Rx FIFO.
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will disable the service request interrupt of the Rx FIFO.
- *
- * @return
- * - IX_SSP_SUCCESS - Rx FIFO Interrupt disabled successfully
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccRxFIFOIntDisable (
- void);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccTxFIFOIntEnable (
- TxFIFOThresholdHandler txFIFOIntrHandler)
- *
- * @brief Enables service request interrupt of the Tx FIFO.
- *
- * @param "void [in] *txFIFOIntrHandler(UINT32)" - function pointer to the
- * interrupt handler for the Tx FIFO exceeded.
- *
- * Global Data :
- * - None.
- *
- * This API will enable the service request interrupt of the Tx FIFO.
- *
- * @return
- * - IX_SSP_SUCCESS - Tx FIFO level interrupt enabled successfully
- * - IX_SSP_TX_FIFO_HANDLER_MISSING - missing handler for Tx FIFO level interrupt
- * - IX_SSP_POLL_MODE_BLOCKING - poll mode is selected at init, interrupt not
- * allowed to be enabled. Use init to enable interrupt mode.
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccTxFIFOIntEnable (
- TxFIFOThresholdHandler txFIFOIntrHandler);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccTxFIFOIntDisable (
- void)
- *
- * @brief Disables service request interrupt of the Tx FIFO
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will disable the service request interrupt of the Tx FIFO
- *
- * @return
- * - IX_SSP_SUCCESS - Tx FIFO Interrupt disabled successfuly.
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccTxFIFOIntDisable (
- void);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccLoopbackEnable (
- BOOL loopbackEnable)
- *
- * @brief Enables/disables the loopback mode
- *
- * @param "BOOL [in] loopbackEnable" - True to enable and false to disable.
- *
- * Global Data :
- * - None.
- *
- * This API will set the mode of operation to either loopback or normal mode
- * according to the user input.
- *
- * @return
- * - IX_SSP_SUCCESS - Loopback enabled successfully
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccLoopbackEnable (
- BOOL loopbackEnable);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccSpiSclkPolaritySet (
- IxSspAccSpiSclkPolarity spiSclkPolaritySelected)
- *
- * @brief Sets the SPI SCLK Polarity to Low or High
- *
- * @param - "IxSspAccSpiSclkPolarity [in] spiSclkPolaritySelected" - SPI SCLK
- * polarity that can be selected to either high or low
- *
- * Global Data :
- * - None.
- *
- * This API is only used for the SPI frame format and will set the SPI SCLK polarity
- * to either low or high
- *
- * @return
- * - IX_SSP_SUCCESS - SPI Sclk polarity set with valid enum value
- * - IX_SSP_INVALID_SPI_POLARITY_ENUM_VALUE - invalid SPI polarity value
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccSpiSclkPolaritySet (
- IxSspAccSpiSclkPolarity spiSclkPolaritySelected);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccSpiSclkPhaseSet (
- IxSspAccSpiSclkPhase spiSclkPhaseSelected)
- *
- * @brief Sets the SPI SCLK Phase
- *
- * @param "IxSspAccSpiSclkPhase [in] spiSclkPhaseSelected" - Phase of either
- * the SCLK is inactive one cycle at the start of a frame and 1/2
- * cycle at the end of a frame, OR
- * the SCLK is inactive 1/2 cycle at the start of a frame and one
- * cycle at the end of a frame.
- *
- * Global Data :
- * - IX_SSP_SUCCESS - SPI Sclk phase set with valid enum value
- * - IX_SSP_INVALID_SPI_PHASE_ENUM_VALUE - invalid SPI phase value
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * This API is only used for the SPI frame format and will set the SPI SCLK
- * phase according to user input.
- *
- * @return
- * - None
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccSpiSclkPhaseSet (
- IxSspAccSpiSclkPhase spiSclkPhaseSelected);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccMicrowireControlWordSet (
- IxSspAccMicrowireCtlWord microwireCtlWordSelected)
- *
- * @brief Sets the Microwire control word to 8 or 16 bit format
- *
- * @param "IxSspAccMicrowireCtlWord [in] microwireCtlWordSelected" - Microwire
- * control word format can be either 8 or 16 bit format
- *
- * Global Data :
- * - None.
- *
- * This API is only used for the Microwire frame format and will set the
- * control word to 8 or 16 bit format
- *
- * @return
- * - IX_SSP_SUCCESS - Microwire Control Word set with valid enum value
- * - IX_SSP_TX_FIFO_NOT_EMPTY - Tx FIFO not empty, data size change is not
- * allowed.
- * - IX_SSP_INVALID_MICROWIRE_CTL_CMD_ENUM_VALUE - invalid enum value
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccMicrowireControlWordSet (
- IxSspAccMicrowireCtlWord microwireCtlWordSelected);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccTxFIFOThresholdSet (
- IxSspAccFifoThreshold txFIFOThresholdSelected)
- *
- * @brief Sets the Tx FIFO Threshold.
- *
- * @param "IxSspAccFifoThreshold [in] txFIFOThresholdSelected" - Threshold that
- * is set for a Tx FIFO service request to be triggered
- *
- * Global Data :
- * - None.
- *
- * This API will set the threshold for a Tx FIFO threshold to be triggered
- *
- * @return
- * - IX_SSP_SUCCESS - Tx FIFO Threshold set with valid enum value
- * - IX_SSP_INVALID_TX_FIFO_THRESHOLD_ENUM_VALUE - invalid enum value
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccTxFIFOThresholdSet (
- IxSspAccFifoThreshold txFIFOThresholdSelected);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccRxFIFOThresholdSet (
- IxSspAccFifoThreshold rxFIFOThresholdSelected)
- *
- * @brief Sets the Rx FIFO Threshold.
- *
- * @param "IxSspAccFifoThreshold [in] rxFIFOThresholdSelected" - Threshold that
- * is set for a Tx FIFO service request to be triggered
- *
- * Global Data :
- * - None.
- *
- * This API will will set the threshold for a Rx FIFO threshold to be triggered
- *
- * @return
- * - IX_SSP_SUCCESS - Rx FIFO Threshold set with valid enum value
- * - IX_SSP_INVALID_RX_FIFO_THRESHOLD_ENUM_VALUE - invalid enum value
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccRxFIFOThresholdSet (
- IxSspAccFifoThreshold rxFIFOThresholdSelected);
-
-
-/**
- * Debug functions
- */
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccStatsGet (
- IxSspAccStatsCounters *sspStats)
- *
- * @brief Returns the SSP Statistics through the pointer passed in
- *
- * @param "IxSspAccStatsCounters [in] *sspStats" - SSP statistics counter will
- * be read and written to the location pointed by this pointer.
- *
- * Global Data :
- * - None.
- *
- * This API will return the statistics counters of the SSP transfers.
- *
- * @return
- * - IX_SSP_SUCCESS - Stats obtained into the pointer provided successfully
- * - IX_SSP_FAIL - client provided pointer is NULL
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccStatsGet (
- IxSspAccStatsCounters *sspStats);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccStatsReset (
- void)
- *
- * @brief Resets the SSP Statistics
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will reset the SSP statistics counters.
- *
- * @return
- * - None
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC void
-ixSspAccStatsReset (
- void);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccShow (
- void)
- *
- * @brief Display SSP status registers and statistics counters.
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will display the status registers of the SSP and the statistics
- * counters.
- *
- * @return
- * - IX_SSP_SUCCESS - SSP show called successfully.
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccShow (
- void);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccSSPBusyCheck (
- void)
- *
- * @brief Determine the state of the SSP serial port hardware.
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will return the state of the SSP serial port hardware - busy or
- * idle
- *
- * @return
- * - IX_SSP_BUSY - SSP is busy
- * - IX_SSP_IDLE - SSP is idle.
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccSSPBusyCheck (
- void);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccTxFIFOLevelGet (
- void)
- *
- * @brief Obtain the Tx FIFO's level
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will return the level of the Tx FIFO
- *
- * @return
- * - 0..16; 0 can also mean SSP not initialized and will need to be init.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC UINT8
-ixSspAccTxFIFOLevelGet (
- void);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccRxFIFOLevelGet (
- void)
- *
- * @brief Obtain the Rx FIFO's level
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will return the level of the Rx FIFO
- *
- * @return
- * - 0..16; 0 can also mean SSP not initialized and will need to be init.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC UINT8
-ixSspAccRxFIFOLevelGet (
- void);
-
-/**
- * @ingroup IxSspAcc
- *
- * @fn ixSspAccRxFIFOOverrunCheck (
- void)
- *
- * @brief Check if the Rx FIFO has overrun its FIFOs
- *
- * @param - None
- *
- * Global Data :
- * - None.
- *
- * This API will return whether the Rx FIFO has overrun its 16 FIFOs
- *
- * @return
- * - IX_SSP_OVERRUN_OCCURRED - Rx FIFO overrun occurred
- * - IX_SSP_NO_OVERRUN - Rx FIFO did not overrun
- * - IX_SSP_NOT_INIT - SSP not initialized. SSP init needs to be called.
- *
- * @li Reentrant : yes
- * @li ISR Callable : yes
- *
- */
-PUBLIC IX_SSP_STATUS
-ixSspAccRxFIFOOverrunCheck (
- void);
-
-#endif /* __ixp46X */
-#endif /* IXSSPACC_H */
diff --git a/cpu/ixp/npe/include/IxTimeSyncAcc.h b/cpu/ixp/npe/include/IxTimeSyncAcc.h
deleted file mode 100644
index 25effed90b..0000000000
--- a/cpu/ixp/npe/include/IxTimeSyncAcc.h
+++ /dev/null
@@ -1,783 +0,0 @@
-/**
- * @file IxTimeSyncAcc.h
- *
- * @author Intel Corporation
- * @date 07 May 2004
- *
- * @brief Header file for IXP400 Access Layer to IEEE 1588(TM) Precision
- * Clock Synchronisation Protocol Hardware Assist
- *
- * @version 1
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxTimeSyncAcc IXP400 Time Sync Access Component API
- *
- * @brief Public API for IxTimeSyncAcc
- *
- * @{
- */
-#ifndef IXTIMESYNCACC_H
-#define IXTIMESYNCACC_H
-
-#ifdef __ixp46X
-
-#include "IxOsal.h"
-
-/**
- * Section for enum
- */
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @enum IxTimeSyncAccStatus
- *
- * @brief The status as returned from the API
- */
-typedef enum /**< IxTimeSyncAccStatus */
-{
- IX_TIMESYNCACC_SUCCESS = IX_SUCCESS, /**< Requested operation successful */
- IX_TIMESYNCACC_INVALIDPARAM, /**< An invalid parameter was passed */
- IX_TIMESYNCACC_NOTIMESTAMP, /**< While polling no time stamp available */
- IX_TIMESYNCACC_INTERRUPTMODEINUSE, /**< Polling not allowed while operating in interrupt mode */
- IX_TIMESYNCACC_FAILED /**< Internal error occurred */
-}IxTimeSyncAccStatus;
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @enum IxTimeSyncAccAuxMode
- *
- * @brief Master or Slave Auxiliary Time Stamp (Snap Shot)
- */
-typedef enum /**< IxTimeSyncAccAuxMode */
-{
- IX_TIMESYNCACC_AUXMODE_MASTER, /**< Auxiliary Master Mode */
- IX_TIMESYNCACC_AUXMODE_SLAVE, /**< Auxiliary Slave Mode */
- IX_TIMESYNCACC_AUXMODE_INVALID /**< Invalid Auxiliary Mode */
-}IxTimeSyncAccAuxMode;
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @enum IxTimeSyncAcc1588PTPPort
- *
- * @brief IEEE 1588 PTP Communication Port(Channel)
- */
-typedef enum /**< IxTimeSyncAcc1588PTPPort */
-{
- IX_TIMESYNCACC_NPE_A_1588PTP_PORT, /**< PTP Communication Port on NPE-A */
- IX_TIMESYNCACC_NPE_B_1588PTP_PORT, /**< PTP Communication Port on NPE-B */
- IX_TIMESYNCACC_NPE_C_1588PTP_PORT, /**< PTP Communication Port on NPE-C */
- IX_TIMESYNCACC_NPE_1588PORT_INVALID /**< Invalid PTP Communication Port */
-} IxTimeSyncAcc1588PTPPort;
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @enum IxTimeSyncAcc1588PTPPortMode
- *
- * @brief Master or Slave mode for IEEE 1588 PTP Communication Port
- */
-typedef enum /**< IxTimeSyncAcc1588PTPPortMode */
-{
- IX_TIMESYNCACC_1588PTP_PORT_MASTER, /**< PTP Communication Port in Master Mode */
- IX_TIMESYNCACC_1588PTP_PORT_SLAVE, /**< PTP Communication Port in Slave Mode */
- IX_TIMESYNCACC_1588PTP_PORT_ANYMODE, /**< PTP Communication Port in ANY Mode
- allows time stamping of all messages
- including non-1588 PTP */
- IX_TIMESYNCACC_1588PTP_PORT_MODE_INVALID /**< Invalid PTP Port Mode */
-}IxTimeSyncAcc1588PTPPortMode;
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @enum IxTimeSyncAcc1588PTPMsgType
- *
- * @brief 1588 PTP Messages types that can be detected on communication port
- *
- * Note that client code can determine this based on master/slave mode in which
- * it is already operating in and this information is made available for the sake
- * of convenience only.
- */
-typedef enum /**< IxTimeSyncAcc1588PTPMsgType */
-{
- IX_TIMESYNCACC_1588PTP_MSGTYPE_SYNC, /**< PTP Sync message sent by Master or received by Slave */
- IX_TIMESYNCACC_1588PTP_MSGTYPE_DELAYREQ, /**< PTP Delay_Req message sent by Slave or received by Master */
- IX_TIMESYNCACC_1588PTP_MSGTYPE_UNKNOWN /**< Other PTP and non-PTP message sent or received by both
- Master and/or Slave */
-} IxTimeSyncAcc1588PTPMsgType;
-
-/**
- * Section for struct
- */
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @struct IxTimeSyncAccTimeValue
- *
- * @brief Struct to hold 64 bit SystemTime and TimeStamp values
- */
-typedef struct /**< IxTimeSyncAccTimeValue */
-{
- UINT32 timeValueLowWord; /**< Lower 32 bits of the time value */
- UINT32 timeValueHighWord; /**< Upper 32 bits of the time value */
-} IxTimeSyncAccTimeValue;
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @struct IxTimeSyncAccUuid
- *
- * @brief Struct to hold 48 bit UUID values captured in Sync or Delay_Req messages
- */
-typedef struct /**< IxTimeSyncAccUuid */
-{
- UINT32 uuidValueLowWord; /**<The lower 32 bits of the UUID */
- UINT16 uuidValueHighHalfword; /**<The upper 16 bits of the UUID */
-} IxTimeSyncAccUuid;
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @struct IxTimeSyncAccPtpMsgData
- *
- * @brief Struct for data from the PTP message returned when TimeStamp available
- */
-typedef struct /**< IxTimeSyncAccPtpMsgData */
-{
- IxTimeSyncAcc1588PTPMsgType ptpMsgType; /**< PTP Messages type */
- IxTimeSyncAccTimeValue ptpTimeStamp; /**< 64 bit TimeStamp value from PTP Message */
- IxTimeSyncAccUuid ptpUuid; /**< 48 bit UUID value from the PTP Message */
- UINT16 ptpSequenceNumber; /**< 16 bit Sequence Number from PTP Message */
-} IxTimeSyncAccPtpMsgData;
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @struct IxTimeSyncAccStats
- *
- * @brief Statistics for the PTP messages
- */
-typedef struct /**< IxTimeSyncAccStats */
-{
- UINT32 rxMsgs; /**< Count of timestamps for received PTP Messages */
- UINT32 txMsgs; /**< Count of timestamps for transmitted PTP Messages */
-} IxTimeSyncAccStats;
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @typedef IxTimeSyncAccTargetTimeCallback
- *
- * @brief Callback for use by target time stamp interrupt
- */
-typedef void (*IxTimeSyncAccTargetTimeCallback)(IxTimeSyncAccTimeValue targetTime);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @typedef IxTimeSyncAccAuxTimeCallback
- *
- * @brief Callback for use by auxiliary time interrupts
- */
-typedef void (*IxTimeSyncAccAuxTimeCallback)(IxTimeSyncAccAuxMode auxMode,
- IxTimeSyncAccTimeValue auxTime);
-
-/*
- * Section for prototypes interface functions
- */
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPPortConfigSet(
- IxTimeSyncAcc1588PTPPort ptpPort,
- IxTimeSyncAcc1588PTPPortMode ptpPortMode)
- *
- * @brief Configures the IEEE 1588 message detect on particular PTP port.
- *
- * @param ptpPort [in] - PTP port to config
- * @param ptpPortMode [in]- Port to operate in Master or Slave mode
- *
- * This API will enable the time stamping on a particular PTP port.
- *
- * @li Re-entrant : No
- * @li ISR Callable : No
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccPTPPortConfigSet(IxTimeSyncAcc1588PTPPort ptpPort,
- IxTimeSyncAcc1588PTPPortMode ptpPortMode);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPPortConfigGet(
- IxTimeSyncAcc1588PTPPort ptpPort,
- IxTimeSyncAcc1588PTPPortMode *ptpPortMode)
- *
- * @brief Retrieves IEEE 1588 PTP operation mode on particular PTP port.
- *
- * @param ptpPort [in] - PTP port
- * @param ptpPortMode [in]- Mode of operation of PTP port (Master or Slave)
- *
- * This API will identify the time stamping capability of a PTP port by means
- * of obtaining its mode of operation.
- *
- * @li Re-entrant : No
- * @li ISR Callable : No
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccPTPPortConfigGet(IxTimeSyncAcc1588PTPPort ptpPort,
- IxTimeSyncAcc1588PTPPortMode *ptpPortMode);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPRxPoll(
- IxTimeSyncAcc1588PTPPort ptpPort,
- IxTimeSyncAccPtpMsgData *ptpMsgData)
- *
- * @brief Polls the IEEE 1588 message/time stamp detect status on a particular
- * PTP Port on the Receive side.
- *
- * @param ptpPort [in] - PTP port to poll
- * @param ptpMsgData [out] - Current TimeStamp and other Data
- *
- * This API will poll for the availability of a time stamp on the received Sync
- * (Slave) or Delay_Req (Master) messages.
- * The client application will provide the buffer.
- *
- * @li Re-entrant : No
- * @li ISR Callable : No
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
- * @li IX_TIMESYNCACC_NOTIMESTAMP - No time stamp available
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccPTPRxPoll(IxTimeSyncAcc1588PTPPort ptpPort,
- IxTimeSyncAccPtpMsgData *ptpMsgData);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPTxPoll(
- IxTimeSyncAcc1588PTPPort ptpPort,
- IxTimeSyncAccPtpMsgData *ptpMsgData)
- *
- *
- * @brief Polls the IEEE 1588 message/time stamp detect status on a particular
- * PTP Port on the Transmit side.
- *
- * @param ptpPort [in] - PTP port to poll
- * @param ptpMsgData [out] - Current TimeStamp and other Data
- *
- * This API will poll for the availability of a time stamp on the transmitted
- * Sync (Master) or Delay_Req (Slave) messages.
- * The client application will provide the buffer.
- *
- * @li Re-entrant : No
- * @li ISR Callable : No
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
- * @li IX_TIMESYNCACC_NOTIMESTAMP - No time stamp available
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccPTPTxPoll(IxTimeSyncAcc1588PTPPort ptpPort,
- IxTimeSyncAccPtpMsgData *ptpMsgData);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccSystemTimeSet(
- IxTimeSyncAccTimeValue systemTime)
- *
- * @brief Sets the System Time in the IEEE 1588 hardware assist block
- *
- * @param systemTime [in] - Value to set System Time
- *
- * This API will set the SystemTime to given value.
- *
- * @li Re-entrant : yes
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccSystemTimeSet(IxTimeSyncAccTimeValue systemTime);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccSystemTimeGet(
- IxTimeSyncAccTimeValue *systemTime)
- *
- * @brief Gets the System Time from the IEEE 1588 hardware assist block
- *
- * @param systemTime [out] - Copy the current System Time into the client
- * application provided buffer
- *
- * This API will get the SystemTime from IEEE1588 block and return to client
- *
- * @li Re-entrant : no
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccSystemTimeGet(IxTimeSyncAccTimeValue *systemTime);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccTickRateSet(
- UINT32 tickRate)
- *
- * @brief Sets the Tick Rate (Frequency Scaling Value) in the IEEE 1588
- * hardware assist block
- *
- * @param tickRate [in] - Value to set Tick Rate
- *
- * This API will set the Tick Rate (Frequency Scaling Value) in the IEEE
- * 1588 block to the given value. The Accumulator register (not client
- * visible) is incremented by this TickRate value every clock cycle. When
- * the Accumulator overflows, the SystemTime is incremented by one. This
- * TickValue can therefore be used to adjust the system timer.
- *
- * @li Re-entrant : yes
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccTickRateSet(UINT32 tickRate);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccTickRateGet(
- UINT32 *tickRate)
- *
- * @brief Gets the Tick Rate (Frequency Scaling Value) from the IEEE 1588
- * hardware assist block
- *
- * @param tickRate [out] - Current Tick Rate value in the IEEE 1588 block
- *
- * This API will get the TickRate on IEE15588 block. Refer to @ref
- * ixTimeSyncAccTickRateSet for notes on usage of this value.
- *
- * @li Reentrant : yes
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccTickRateGet(UINT32 *tickRate);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeInterruptEnable(
- IxTimeSyncAccTargetTimeCallback targetTimeCallback)
- *
- * @brief Enables the interrupt to verify the condition where the System Time
- * greater or equal to the Target Time in the IEEE 1588 hardware assist block.
- * If the condition is true an interrupt will be sent to XScale.
- *
- * @param targetTimeCallback [in] - Callback to be invoked when interrupt fires
- *
- * This API will enable the Target Time reached/hit condition interrupt.
- *
- * NOTE: The client application needs to ensure that the APIs
- * @ref ixTimeSyncAccTargetTimeInterruptEnable, @ref ixTimeSyncAccTargetTimeSet and
- * @ref ixTimeSyncAccTargetTimeInterruptDisable are accessed in mutual exclusive
- * manner with respect to each other.
- *
- * @li Re-entrant : no
- * @li ISR Callable : yes
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed for callback
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccTargetTimeInterruptEnable(IxTimeSyncAccTargetTimeCallback targetTimeCallback);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeInterruptDisable(
- void)
- *
- * @brief Disables the interrupt for the condition explained in the function
- * description of @ref ixTimeSyncAccTargetTimeInterruptEnable.
- *
- * This API will disable the Target Time interrupt.
- *
- * NOTE: The client application needs to ensure that the APIs
- * @ref ixTimeSyncAccTargetTimeInterruptEnable, @ref ixTimeSyncAccTargetTimeSet and
- * @ref ixTimeSyncAccTargetTimeInterruptDisable are accessed in mutual exclusive
- * manner with respect to each other.
- *
- * @li Re-entrant : no
- * @li ISR Callable : yes
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccTargetTimeInterruptDisable(void);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimePoll(
- BOOL *ttmPollFlag,
- IxTimeSyncAccTimeValue *targetTime)
- *
- * @brief Poll to verify the condition where the System Time greater or equal to
- * the Target Time in the IEEE 1588 hardware assist block. If the condition is
- * true an event flag is set in the hardware.
- *
- * @param ttmPollFlag [out] - TRUE if the target time reached/hit condition event set
- * FALSE if the target time reached/hit condition event is
- not set
- * @param targetTime [out] - Capture current targetTime into client provided buffer
- *
- * Poll the target time reached/hit condition status. Return true and the current
- * target time value, if the condition is true else return false.
- *
- * NOTE: The client application will need to clear the event flag that will be set
- * as long as the condition that the System Time greater or equal to the Target Time is
- * valid, in one of the following ways:
- * 1) Invoke the API to change the target time
- * 2) Change the system timer value
- *
- * @li Re-entrant : yes
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- * @li IX_TIMESYNCACC_INTERRUPTMODEINUSE - Interrupt mode in use
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccTargetTimePoll(BOOL *ttmPollFlag,
- IxTimeSyncAccTimeValue *targetTime);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeSet(
- IxTimeSyncAccTimeValue targetTime)
- *
- * @brief Sets the Target Time in the IEEE 1588 hardware assist block
- *
- * @param targetTime [in] - Value to set Target Time
- *
- * This API will set the Target Time to a given value.
- *
- * NOTE: The client application needs to ensure that the APIs
- * @ref ixTimeSyncAccTargetTimeInterruptEnable, @ref ixTimeSyncAccTargetTimeSet and
- * @ref ixTimeSyncAccTargetTimeInterruptDisable are accessed in mutual exclusive
- * manner with respect to each other.
- *
- * @li Reentrant : no
- * @li ISR Callable : yes
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccTargetTimeSet(IxTimeSyncAccTimeValue targetTime);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeGet(
- IxTimeSyncAccTimeValue *targetTime)
- *
- * @brief Gets the Target Time in the IEEE 1588 hardware assist block
- *
- * @param targetTime [out] - Copy current time to client provided buffer
- *
- * This API will get the Target Time from IEEE 1588 block and return to the
- * client application
- *
- * @li Re-entrant : yes
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccTargetTimeGet(IxTimeSyncAccTimeValue *targetTime);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccAuxTimeInterruptEnable(
- IxTimeSyncAccAuxMode auxMode,
- IxTimeSyncAccAuxTimeCallback auxTimeCallback)
- *
- * @brief Enables the interrupt notification for the given mode of Auxiliary Time
- * Stamp in the IEEE 1588 hardware assist block
- *
- * @param auxMode [in] - Auxiliary time stamp register (slave or master) to use
- * @param auxTimeCallback [in] - Callback to be invoked when interrupt fires
- *
- * This API will enable the Auxiliary Master/Slave Time stamp Interrupt.
- *
- * <pre>
- * NOTE: 1) An individual callback is to be registered for each Slave and Master
- * Auxiliary Time Stamp registers. Thus to register for both Master and Slave time
- * stamp interrupts either the same callback or two separate callbacks the API has
- * to be invoked twice.
- * 2) On the IXDP465 Development Platform, the Auxiliary Timestamp signal for
- * slave mode is tied to GPIO 8 pin. This signal is software routed by default to
- * PCI for backwards compatibility with the IXDP425 Development Platform. This
- * routing must be disabled for the auxiliary slave time stamp register to work
- * properly. The following commands may be used to accomplish this. However, refer
- * to the IXDP465 Development Platform Users Guide or the BSP/LSP documentation for
- * more specific information.
- *
- * For Linux (at the Redboot prompt i.e., before loading zImage):
- * mfill -b 0x54100000 -1 -l 1 -p 8
- * mfill -b 0x54100001 -1 -l 1 -p 0x7f
- * For vxWorks, at the prompt:
- * intDisable(25)
- * ixdp400FpgaIODetach(8)
- * </pre>
- *
- * @li Re-entrant : no
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed for callback or
- invalid auxiliary snapshot mode
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccAuxTimeInterruptEnable(IxTimeSyncAccAuxMode auxMode,
- IxTimeSyncAccAuxTimeCallback auxTimeCallback);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccAuxTimeInterruptDisable(
- IxTimeSyncAccAuxMode auxMode)
- *
- * @brief Disables the interrupt for the indicated mode of Auxiliary Time Stamp
- * in the IEEE 1588 hardware assist block
- *
- * @param auxMode [in] - Auxiliary time stamp mode (slave or master) using which
- * the interrupt will be disabled.
- *
- * This API will disable the Auxiliary Time Stamp Interrupt (Master or Slave)
- *
- * @li Re-entrant : yes
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccAuxTimeInterruptDisable(IxTimeSyncAccAuxMode auxMode);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccAuxTimePoll(
- IxTimeSyncAccAuxMode auxMode,
- BOOL *auxPollFlag,
- IxTimeSyncAccTimeValue *auxTime)
- *
- * @brief Poll for the Auxiliary Time Stamp captured for the mode indicated
- * (Master or Slave)
- *
- * @param auxMode [in] - Auxiliary Snapshot Register (Slave or Master) to be checked
- * @param auxPollFlag [out] - TRUE if the time stamp captured in auxiliary
- snapshot register
- * FALSE if the time stamp not captured in
- auxiliary snapshot register
- * @param auxTime [out] - Copy the current Auxiliary Snapshot Register value into the
- * client provided buffer
- *
- * Polls for the Time stamp in the appropriate Auxiliary Snapshot Registers based
- * on the mode specified. Return true and the contents of the Auxiliary snapshot,
- * if it is available else return false.
- *
- * Please refer to the note #2 of the API @ref ixTimeSyncAccAuxTimeInterruptEnable
- * for more information for Auxiliary Slave mode.
- *
- * @li Re-entrant : yes
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed for auxPollFlag,
- callback or invalid auxiliary snapshot mode
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- * @li IX_TIMESYNCACC_INTERRUPTMODEINUSE - Interrupt mode in use
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccAuxTimePoll(IxTimeSyncAccAuxMode auxMode,
- BOOL *auxPollFlag,
- IxTimeSyncAccTimeValue *auxTime);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccReset(void)
- *
- * @brief Resets the IEEE 1588 hardware assist block
- *
- * Sets the reset bit in the IEEE1588 silicon which fully resets the silicon block
- *
- * @li Reentrant : yes
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccReset(void);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccStatsGet(IxTimeSyncAccStats
- *timeSyncStats)
- *
- * @brief Returns the IxTimeSyncAcc Statistics in the client supplied buffer
- *
- * @param timeSyncStats [out] - TimeSync statistics counter values
- *
- * This API will return the statistics of the received or transmitted messages.
- *
- * NOTE: 1) These counters are updated only when the client polls for the time
- * stamps or interrupt are enabled. This is because the IxTimeSyncAcc module
- * does not either transmit or receive messages and does only run the code
- * when explicit requests received by client application.
- *
- * 2) These statistics reflect the number of valid PTP messages exchanged
- * in Master and Slave modes but includes all the messages (including valid
- * non-PTP messages) while operating in the Any mode.
- *
- * @li Reentrant : no
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_INVALIDPARAM - NULL parameter passed
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccStatsGet(IxTimeSyncAccStats *timeSyncStats);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn void ixTimeSyncAccStatsReset(void)
- *
- * @brief Reset Time Sync statistics
- *
- * This API will reset the statistics counters of the TimeSync access layer.
- *
- * @li Reentrant : yes
- * @li ISR Callable: no
- *
- * @return @li None
- */
-PUBLIC void
-ixTimeSyncAccStatsReset(void);
-
-/**
- * @ingroup IxTimeSyncAcc
- *
- * @fn IxTimeSyncAccStatus ixTimeSyncAccShow(void)
- *
- * @brief Displays the Time Sync current status
- *
- * This API will display status on the current configuration of the IEEE
- * 1588 hardware assist block, contents of the various time stamp registers,
- * outstanding interrupts and/or events.
- *
- * Note that this is intended for debug only, and in contrast to the other
- * functions, it does not clear the any of the status bits associated with
- * active timestamps and so is passive in its nature.
- *
- * @li Reentrant : yes
- * @li ISR Callable : no
- *
- * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
- * @li IX_TIMESYNCACC_FAILED - Internal error occurred
- */
-PUBLIC IxTimeSyncAccStatus
-ixTimeSyncAccShow(void);
-
-#endif /* __ixp46X */
-#endif /* IXTIMESYNCACC_H */
-
-/**
- * @} defgroup IxTimeSyncAcc
- */
-
diff --git a/cpu/ixp/npe/include/IxTimerCtrl.h b/cpu/ixp/npe/include/IxTimerCtrl.h
deleted file mode 100644
index 669dd3ef28..0000000000
--- a/cpu/ixp/npe/include/IxTimerCtrl.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/**
- * @file IxTimerCtrl.h
- * @brief
- * This is the header file for the Timer Control component.
- *
- * The timer callback control component provides a mechanism by which different
- * client components can start a timer and have a supplied callback function
- * invoked when the timer expires.
- * The callbacks are all dispatched from one thread inside this component.
- * Any component that needs to be called periodically should use this facility
- * rather than create its own task with a sleep loop.
- *
- * @par
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxTimerCtrl IXP400 Timer Control (IxTimerCtrl) API
- *
- * @brief The public API for the IXP400 Timer Control Component.
- *
- * @{
- */
-
-#ifndef IxTimerCtrl_H
-#define IxTimerCtrl_H
-
-
-#include "IxTypes.h"
-/* #include "Ossl.h" */
-
-/*
- * #defines and macros used in this file.
- */
-
-/**
- * @ingroup IxTimerCtrl
- *
- * @def IX_TIMERCTRL_NO_FREE_TIMERS
- *
- * @brief Timer schedule return code.
- *
- * Indicates that the request to start a timer failed because
- * all available timer resources are used.
- */
-#define IX_TIMERCTRL_NO_FREE_TIMERS 2
-
-
-/**
- * @ingroup IxTimerCtrl
- *
- * @def IX_TIMERCTRL_PARAM_ERROR
- *
- * @brief Timer schedule return code.
- *
- * Indicates that the request to start a timer failed because
- * the client has supplied invalid parameters.
- */
-#define IX_TIMERCTRL_PARAM_ERROR 3
-
-
-/*
- * Typedefs whose scope is limited to this file.
- */
-
-/**
- * @ingroup IxTimerCtrl
- *
- * @brief A typedef for a pointer to a timer callback function.
- * @para void * - This parameter is supplied by the client when the
- * timer is started and passed back to the client in the callback.
- * @note in general timer callback functions should not block or
- * take longer than 100ms. This constraint is required to ensure that
- * higher priority callbacks are not held up.
- * All callbacks are called from the same thread.
- * This thread is a shared resource.
- * The parameter passed is provided when the timer is scheduled.
- */
-typedef void (*IxTimerCtrlTimerCallback)(void *userParam);
-
-
-/**
- * @ingroup IxTimerCtrl
- *
- * @brief List used to identify the users of timers.
- * @note The order in this list indicates priority. Components appearing
- * higher in the list will be given priority over components lower in the
- * list. When adding components, please insert at an appropriate position
- * for priority ( i.e values should be less than IxTimerCtrlMaxPurpose ) .
- */
-typedef enum
-{
- IxTimerCtrlAdslPurpose,
- /* Insert new purposes above this line only
- */
- IxTimerCtrlMaxPurpose
-}
-IxTimerCtrlPurpose;
-
-
-/*
- * Function definition
- */
-
-/**
- * @ingroup IxTimerCtrl
- *
- * @fn ixTimerCtrlSchedule(IxTimerCtrlTimerCallback func,
- void *userParam,
- IxTimerCtrlPurpose purpose,
- UINT32 relativeTime,
- unsigned *timerId )
- *
- * @brief Schedules a callback function to be called after a period of "time".
- * The callback function should not block or run for more than 100ms.
- * This function
- *
- * @param func @ref IxTimerCtrlTimerCallback [in] - the callback function to be called.
- * @param userParam void [in] - a parameter to send to the callback function, can be NULL.
- * @param purpose @ref IxTimerCtrlPurpose [in] - the purpose of the callback, internally this component will
- * decide the priority of callbacks with different purpose.
- * @param relativeTime UINT32 [in] - time relative to now in milliseconds after which the callback
- * will be called. The time must be greater than the duration of one OS tick.
- * @param *timerId unsigned [out] - An id for the callback scheduled.
- * This id can be used to cancel the callback.
- * @return
- * @li IX_SUCCESS - The timer was started successfully.
- * @li IX_TIMERCTRL_NO_FREE_TIMERS - The timer was not started because the maximum number
- * of running timers has been exceeded.
- * @li IX_TIMERCTRL_PARAM_ERROR - The timer was not started because the client has supplied
- * a NULL callback func, or the requested timeout is less than one OS tick.
- * @note This function is re-entrant. The function accesses a list of running timers
- * and may suspend the calling thread if this list is being accesed by another thread.
- */
-PUBLIC IX_STATUS
-ixTimerCtrlSchedule(IxTimerCtrlTimerCallback func,
- void *userParam,
- IxTimerCtrlPurpose purpose,
- UINT32 relativeTime,
- unsigned *timerId );
-
-
-/**
- * @ingroup IxTimerCtrl
- *
- * @fn ixTimerCtrlScheduleRepeating(IxTimerCtrlTimerCallback func,
- void *param,
- IxTimerCtrlPurpose purpose,
- UINT32 interval,
- unsigned *timerId )
- *
- * @brief Schedules a callback function to be called after a period of "time".
- * The callback function should not block or run for more than 100ms.
- *
- * @param func @ref IxTimerCtrlTimerCallback [in] - the callback function to be called.
- * @param userParam void [in] - a parameter to send to the callback function, can be NULL.
- * @param purpose @ref IxTimerCtrlPurpose [in] - the purpose of the callback, internally this component will
- * decide the priority of callbacks with different purpose.
- * @param interval UINT32 [in] - the interval in milliseconds between calls to func.
- * @param timerId unsigned [out] - An id for the callback scheduled.
- * This id can be used to cancel the callback.
- * @return
- * @li IX_SUCCESS - The timer was started successfully.
- * @li IX_TIMERCTRL_NO_FREE_TIMERS - The timer was not started because the maximum number
- * of running timers has been exceeded.
- * @li IX_TIMERCTRL_PARAM_ERROR - The timer was not started because the client has supplied
- * a NULL callback func, or the requested timeout is less than one OS tick.
- * @note This function is re-entrant. The function accesses a list of running timers
- * and may suspend the calling thread if this list is being accesed by another thread.
- */
-PUBLIC IX_STATUS
-ixTimerCtrlScheduleRepeating(IxTimerCtrlTimerCallback func,
- void *param,
- IxTimerCtrlPurpose purpose,
- UINT32 interval,
- unsigned *timerId );
-
-/**
- * @ingroup IxTimerCtrl
- *
- * @fn ixTimerCtrlCancel (unsigned id)
- *
- * @brief Cancels a scheduled callback.
- *
- * @param id unsigned [in] - the id of the callback to be cancelled.
- * @return
- * @li IX_SUCCESS - The timer was successfully stopped.
- * @li IX_FAIL - The id parameter did not corrrespond to any running timer..
- * @note This function is re-entrant. The function accesses a list of running timers
- * and may suspend the calling thread if this list is being accesed by another thread.
- */
-PUBLIC IX_STATUS
-ixTimerCtrlCancel (unsigned id);
-
-/**
- * @ingroup IxTimerCtrl
- *
- * @fn ixTimerCtrlInit(void)
- *
- * @brief Initialise the Timer Control Component.
- * @return
- * @li IX_SUCCESS - The timer control component initialized successfully.
- * @li IX_FAIL - The timer control component initialization failed,
- * or the component was already initialized.
- * @note This must be done before any other API function is called.
- * This function should be called once only and is not re-entrant.
- */
-PUBLIC IX_STATUS
-ixTimerCtrlInit(void);
-
-
-/**
- * @ingroup IxTimerCtrl
- *
- * @fn ixTimerCtrlShow( void )
- *
- * @brief Display the status of the Timer Control Component.
- * @return void
- * @note Displays a list of running timers.
- * This function is not re-entrant. This function does not suspend the calling thread.
- */
-PUBLIC void
-ixTimerCtrlShow( void );
-
-#endif /* IXTIMERCTRL_H */
-
diff --git a/cpu/ixp/npe/include/IxTypes.h b/cpu/ixp/npe/include/IxTypes.h
deleted file mode 100644
index c4c5a2d267..0000000000
--- a/cpu/ixp/npe/include/IxTypes.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * @file IxTypes.h (Replaced by OSAL)
- *
- * @date 28-NOV-2001
-
- * @brief This file contains basic types used by the IXP400 software
- *
- * Design Notes:
- * This file shall only include fundamental types and definitions to be
- * shared by all the IXP400 components.
- * Please DO NOT add component-specific types here.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxTypes IXP400 Types (IxTypes)
- *
- * @brief Basic data types used by the IXP400 project
- *
- * @{
- */
-
-#ifndef IxTypes_H
-
-#ifndef __doxygen_HIDE
-
-#define IxTypes_H
-
-#endif /* __doxygen_HIDE */
-
-
-/* WR51880: Undefined data types workaround for backward compatibility */
-#ifdef __linux
-#ifndef __INCvxTypesOldh
-typedef int (*FUNCPTR)(void);
-typedef int STATUS;
-#define OK (0)
-#define ERROR (-1)
-#endif
-#endif
-
-#include "IxOsalBackward.h"
-
-#endif /* IxTypes_H */
-
-/**
- * @} addtogroup IxTypes
- */
diff --git a/cpu/ixp/npe/include/IxUART.h b/cpu/ixp/npe/include/IxUART.h
deleted file mode 100644
index 03a44441c5..0000000000
--- a/cpu/ixp/npe/include/IxUART.h
+++ /dev/null
@@ -1,458 +0,0 @@
-/**
- * @file IxUART.h
- *
- * @date 12-OCT-01
- *
- * @brief Public header for the Intel IXP400 internal UART, generic driver.
- *
- * Design Notes:
- * This driver allows you to perform the following functions:
- * Device Initialization,
- * send/receive characters.
- *
- * Perform Uart IOCTL for the following:
- * Set/Get the current baud rate,
- * set parity,
- * set the number of Stop bits,
- * set the character Length (5,6,7,8),
- * enable/disable Hardware flow control.
- *
- * Only Polled mode is supported for now.
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
-*/
-
-/**
- * @defgroup IxUARTAccAPI IXP400 UART Access (IxUARTAcc) API
- *
- * @brief IXP400 UARTAcc Driver Public API
- *
- * @{
- */
-
-
-/* Defaults */
-
-/**
- * @defgroup DefaultDefines Defines for Default Values
- *
- * @brief Default values which can be used for UART configuration
- *
- * @sa ixUARTDev
- */
-
-/**
- * @def IX_UART_DEF_OPTS
- *
- * @brief The default hardware options to set the UART to -
- * no flow control, 8 bit word, 1 stop bit, no parity
- *
- * @ingroup DefaultDefines
- */
-#define IX_UART_DEF_OPTS (CLOCAL | CS8)
-
-/**
- * @def IX_UART_DEF_XMIT
- *
- * @brief The default UART FIFO size - must be no bigger than 64
- *
- * @ingroup DefaultDefines
- */
-#define IX_UART_DEF_XMIT 64
-
-/**
- * @def IX_UART_DEF_BAUD
- *
- * @brief The default UART baud rate - 9600
- *
- * @ingroup DefaultDefines
- */
-#define IX_UART_DEF_BAUD 9600
-
-/**
- * @def IX_UART_MIN_BAUD
- *
- * @brief The minimum UART baud rate - 9600
- *
- * @ingroup DefaultDefines
- */
-#define IX_UART_MIN_BAUD 9600
-
-/**
- * @def IX_UART_MAX_BAUD
- *
- * @brief The maximum UART baud rate - 926100
- *
- * @ingroup DefaultDefines
- */
-#define IX_UART_MAX_BAUD 926100
-
-/**
- * @def IX_UART_XTAL
- *
- * @brief The UART clock speed
- *
- * @ingroup DefaultDefines
- */
-#define IX_UART_XTAL 14745600
-
-
-
-/* IOCTL commands (Request codes) */
-
-/**
- * @defgroup IoctlCommandDefines Defines for IOCTL Commands
- *
- * @brief IOCTL Commands (Request codes) which can be used
- * with @ref ixUARTIoctl
- */
-
-
-/**
- * @ingroup IoctlCommandDefines
- *
- * @def IX_BAUD_SET
- *
- * @brief Set the baud rate
- */
-#define IX_BAUD_SET 0
-
-/**
- * @ingroup IoctlCommandDefines
- *
- * @def IX_BAUD_GET
- *
- * @brief Get the baud rate
- */
-#define IX_BAUD_GET 1
-
-/**
- * @ingroup IoctlCommandDefines
- * @def IX_MODE_SET
- * @brief Set the UART mode of operation
- */
-#define IX_MODE_SET 2
-
-/**
- * @ingroup IoctlCommandDefines
- *
- * @def IX_MODE_GET
- *
- * @brief Get the current UART mode of operation
- */
-#define IX_MODE_GET 3
-
-/**
- * @ingroup IoctlCommandDefines
- *
- * @def IX_OPTS_SET
- *
- * @brief Set the UART device options
- */
-#define IX_OPTS_SET 4
-
-/**
- * @ingroup IoctlCommandDefines
- *
- * @def IX_OPTS_GET
- *
- * @brief Get the UART device options
- */
-#define IX_OPTS_GET 5
-
-/**
- * @ingroup IoctlCommandDefines
- *
- * @def IX_STATS_GET
- *
- * @brief Get the UART statistics
- */
-#define IX_STATS_GET 6
-
-
-/* POSIX style ioctl arguments */
-
-/**
- * @defgroup IoctlArgDefines Defines for IOCTL Arguments
- *
- * @brief POSIX style IOCTL arguments which can be used
- * with @ref ixUARTIoctl
- *
- * @sa ixUARTMode
- */
-
-
-/**
- * @ingroup IoctlArgDefines
- *
- * @def CLOCAL
- *
- * @brief Software flow control
- */
-#ifdef CLOCAL
-#undef CLOCAL
-#endif
-#define CLOCAL 0x1
-
-/**
- * @ingroup IoctlArgDefines
- *
- * @def CREAD
- *
- * @brief Enable interrupt receiver
- */
-#ifdef CREAD
-#undef CREAD
-#endif
-#define CREAD 0x2
-
-/**
- * @ingroup IoctlArgDefines
- *
- * @def CSIZE
- *
- * @brief Characters size
- */
-#ifdef CSIZE
-#undef CSIZE
-#endif
-#define CSIZE 0xc
-
-/**
- * @ingroup IoctlArgDefines
- *
- * @def CS5
- *
- * @brief 5 bits
- */
-#ifdef CS5
-#undef CS5
-#endif
-#define CS5 0x0
-
-/**
- * @ingroup IoctlArgDefines
- *
- * @def CS6
- *
- * @brief 6 bits
- */
-#ifdef CS6
-#undef CS6
-#endif
-#define CS6 0x4
-
-/**
- * @ingroup IoctlArgDefines
- *
- * @def CS7
- *
- * @brief 7 bits
- */
-#ifdef CS7
-#undef CS7
-#endif
-#define CS7 0x8
-
-/**
- * @ingroup IoctlArgDefines
- *
- * @def CS8
- *
- * @brief 8 bits
- */
-#ifdef CS8
-#undef CS8
-#endif
-#define CS8 0xc
-
-/**
- * @ingroup IoctlArgDefines
- *
- * @def STOPB
- *
- * @brief Send two stop bits (else one)
- */
-#define STOPB 0x20
-
-/**
- * @ingroup IoctlArgDefines
- *
- * @def PARENB
- *
- * @brief Parity detection enabled (else disabled)
- */
-#ifdef PARENB
-#undef PARENB
-#endif
-#define PARENB 0x40
-
-/**
- * @ingroup IoctlArgDefines
- *
- * @def PARODD
- *
- * @brief Odd parity (else even)
- */
-#ifdef PARODD
-#undef PARODD
-#endif
-#define PARODD 0x80
-
-/**
- * @enum ixUARTMode
- * @brief The mode to set to UART to.
- */
-typedef enum
-{
- INTERRUPT=0, /**< Interrupt mode */
- POLLED, /**< Polled mode */
- LOOPBACK /**< Loopback mode */
-} ixUARTMode;
-
-/**
- * @struct ixUARTStats
- * @brief Statistics for the UART.
- */
-typedef struct
-{
- UINT32 rxCount;
- UINT32 txCount;
- UINT32 overrunErr;
- UINT32 parityErr;
- UINT32 framingErr;
- UINT32 breakErr;
-} ixUARTStats;
-
-/**
- * @struct ixUARTDev
- * @brief Device descriptor for the UART.
- */
-typedef struct
-{
- UINT8 *addr; /**< device base address */
- ixUARTMode mode; /**< interrupt, polled or loopback */
- int baudRate; /**< baud rate */
- int freq; /**< UART clock frequency */
- int options; /**< hardware options */
- int fifoSize; /**< FIFO xmit size */
-
- ixUARTStats stats; /**< device statistics */
-} ixUARTDev;
-
-/**
- * @ingroup IxUARTAccAPI
- *
- * @fn IX_STATUS ixUARTInit(ixUARTDev* pUART)
- *
- * @param pUART @ref ixUARTDev [in] - pointer to UART structure describing our device.
- *
- * @brief Initialise the UART. This puts the chip in a quiescent state.
- *
- * @pre The base address for the UART must contain a valid value.
- * Also the baud rate and hardware options must contain sensible values
- * otherwise the defaults will be used as defined in ixUART.h
- *
- * @post UART is initialized and ready to send and receive data.
- *
- * @note This function should only be called once per device.
- *
- * @retval IX_SUCCESS - UART device successfully initialised.
- * @retval IX_FAIL - Critical error, device not initialised.
- ***************************************************************************/
-PUBLIC IX_STATUS ixUARTInit(ixUARTDev* pUART);
-
-/**
- * @ingroup IxUARTAccAPI
- *
- * @fn IX_STATUS ixUARTPollOutput(ixUARTDev* pUART, int outChar)
- *
- * @param pUART @ref ixUARTDev [out] - pointer to UART structure describing our device.
- * @param outChar int [out] - character to transmit.
- *
- * @brief Transmit a character in polled mode.
- *
- * @pre UART device must be initialised.
- *
- * @retval IX_SUCCESS - character was successfully transmitted.
- * @retval IX_FAIL - output buffer is full (try again).
- ***************************************************************************/
-PUBLIC IX_STATUS ixUARTPollOutput(ixUARTDev* pUART, int outChar);
-
-/**
- * @ingroup IxUARTAccAPI
- *
- * @fn IX_STATUS ixUARTPollInput(ixUARTDev* pUART, char *inChar)
- *
- * @param pUART @ref ixUARTDev [in] - pointer to UART structure describing our device.
- * @param *inChar char [in] - character read from the device.
- *
- * @brief Receive a character in polled mode.
- *
- * @pre UART device must be initialised.
- *
- * @retval IX_SUCCESS - character was successfully read.
- * @retval IX_FAIL - input buffer empty (try again).
- ***************************************************************************/
-PUBLIC IX_STATUS ixUARTPollInput(ixUARTDev* pUART, char *inChar);
-
-/**
- * @ingroup IxUARTAccAPI
- *
- * @fn IX_STATUS ixUARTIoctl(ixUARTDev* pUART, int cmd, void* arg)
- *
- * @param pUART @ref ixUARTDev [in] - pointer to UART structure describing our device.
- * @param cmd int [in] - an ioctl request code.
- * @param arg void* [in] - optional argument used to set the device mode,
- * baud rate, and hardware options.
- *
- * @brief Perform I/O control routines on the device.
- *
- * @retval IX_SUCCESS - requested feature was set/read successfully.
- * @retval IX_FAIL - error setting/reading the requested feature.
- *
- * @sa IoctlCommandDefines
- * @sa IoctlArgDefines
- ***************************************************************************/
-PUBLIC IX_STATUS ixUARTIoctl(ixUARTDev* pUART, int cmd, void* arg);
-
-/**
- * @} defgroup IxUARTAcc
- */
diff --git a/cpu/ixp/npe/include/IxVersionId.h b/cpu/ixp/npe/include/IxVersionId.h
deleted file mode 100644
index 27796ede84..0000000000
--- a/cpu/ixp/npe/include/IxVersionId.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * @file IxVersionId.h
- *
- * @date 22-Aug-2002
- *
- * @brief This file contains the IXP400 Software version identifier
- *
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- */
-
-/**
- * @defgroup IxVersionId IXP400 Version ID (IxVersionId)
- *
- * @brief Version Identifiers
- *
- * @{
- */
-
-#ifndef IXVERSIONID_H
-#define IXVERSIONID_H
-
-/**
- * @brief Version Identifier String
- *
- * This string will be updated with each customer release of the IXP400
- * Software.
- */
-#define IX_VERSION_ID "2_0"
-
-/**
- * This string will be updated with each customer release of the IXP400
- * ADSL driver package.
- */
-#define IX_VERSION_ADSL_ID "1_12"
-
-
-/**
- * This string will be updated with each customer release of the IXP400
- * USB Client driver package.
- */
-#define IX_VERSION_USBRNDIS_ID "1_9"
-
-/**
- * This string will be updated with each customer release of the IXP400
- * I2C Linux driver package.
- */
-#define IX_VERSION_I2C_LINUX_ID "1_0"
-
-/**
- * @brief Linux Ethernet Driver Patch Version Identifier String
- *
- * This string will be updated with each release of Linux Ethernet Patch
- */
-#define LINUX_ETHERNET_DRIVER_PATCH_ID "1_4"
-
-/**
- * @brief Linux Integration Patch Version Identifier String
- *
- * This String will be updated with each release of Linux Integration Patch
- */
-#define LINUX_INTEGRATION_PATCH_ID "1_3"
-
-/**
- * @brief Linux Ethernet Readme version Identifier String
- *
- * This string will be updated with each release of Linux Ethernet Readme
- */
-#define LINUX_ETHERNET_README_ID "1_3"
-
-/**
- * @brief Linux Integration Readme version Identifier String
- *
- * This string will be updated with each release of Linux Integration Readme
- */
-
-#define LINUX_INTEGRATION_README_ID "1_3"
-
-/**
- * @brief Linux I2C driver Readme version Identifier String
- *
- * This string will be updated with each release of Linux I2C Driver Readme
- */
-#define LINUX_I2C_DRIVER_README_ID "1_0"
-
-/**
- * @brief ixp425_eth_update_nf_bridge.patch version Identifier String
- *
- * This string will be updated with each release of ixp425_eth_update_nf_bridge.
-patch
- *
- */
-
-#define IXP425_ETH_UPDATE_NF_BRIDGE_ID "1_3"
-
-/**
- * @brief Internal Release Identifier String
- *
- * This string will be updated with each internal release (SQA drop)
- * of the IXP400 Software.
- */
-#define IX_VERSION_INTERNAL_ID "SQA3_5"
-
-/**
- * @brief Compatible Tornado Version Identifier
- */
-#define IX_VERSION_COMPATIBLE_TORNADO "Tornado2_2_1-PNE2_0"
-
-/**
- * @brief Compatible Linux Version Identifier
- */
-#define IX_VERSION_COMPATIBLE_LINUX "MVL3_1"
-
-
-#endif /* IXVERSIONID_H */
-
-/**
- * @} addtogroup IxVersionId
- */
diff --git a/cpu/ixp/npe/include/ix_error.h b/cpu/ixp/npe/include/ix_error.h
deleted file mode 100644
index d32ace20b5..0000000000
--- a/cpu/ixp/npe/include/ix_error.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * ============================================================================
- * = COPYRIGHT
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- * = PRODUCT
- * Intel(r) IXP425 Software Release
- *
- * = FILENAME
- * ix_error.h (Replaced by OSAL)
- *
- * = DESCRIPTION
- * This file will describe the basic error type and support functions that
- * will be used by the IXA SDK Framework API.
- *
- * = AUTHOR
- * Intel Corporation
- *
- * = CHANGE HISTORY
- * 4/22/2002 4:19:03 PM - creation time
- * ============================================================================
- */
-
-#if !defined(__IX_ERROR_H__)
-#define __IX_ERROR_H__
-
-#include "IxOsalBackward.h"
-
-#endif /* end !defined(__IX_ERROR_H__) */
-
diff --git a/cpu/ixp/npe/include/ix_macros.h b/cpu/ixp/npe/include/ix_macros.h
deleted file mode 100644
index 53f5942f97..0000000000
--- a/cpu/ixp/npe/include/ix_macros.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * ============================================================================
- * = COPYRIGHT
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- * = PRODUCT
- * Intel(r) IXP425 Software Release
- *
- * = FILENAME
- * ix_macros.h
- *
- * = DESCRIPTION
- * This file will define the basic preprocessor macros that are going to be used
- * the IXA SDK Framework API.
- *
- * = AUTHOR
- * Intel Corporation
- *
- * = CHANGE HISTORY
- * 4/22/2002 4:41:05 PM - creation time
- * ============================================================================
- */
-
-#if !defined(__IX_MACROS_H__)
-#define __IX_MACROS_H__
-
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif /* end defined(__cplusplus) */
-
-
-/**
- * MACRO NAME: IX_BIT_FIELD_MASK16
- *
- * DESCRIPTION: Builds the mask required to extract the bit field from a 16 bit unsigned integer value.
- *
- * @Param: - IN arg_FieldLSBBit an unsigned integer value representing the position of the least significant
- * bit of the bit field.
- * @Param: - IN arg_FieldMSBBit an unsigned integer value representing the position of the most significant
- * bit of the bit field.
- *
- * @Return: Returns a 16 bit mask that will extract the bit field from a 16 bit unsigned integer value.
- */
-#define IX_BIT_FIELD_MASK16( \
- arg_FieldLSBBit, \
- arg_FieldMSBBit \
- ) \
- ((ix_bit_mask16)((((ix_uint16)1 << (arg_FieldMSBBit + 1 - arg_FieldLSBBit)) - \
- (ix_uint16)1) << arg_FieldLSBBit))
-
-
-
-/**
- * MACRO NAME: IX_GET_BIT_FIELD16
- *
- * DESCRIPTION: Extracts a bit field from 16 bit unsigned integer. The returned value is normalized in
- * in the sense that will be right aligned.
- *
- * @Param: - IN arg_PackedData16 a 16 bit unsigned integer that contains the bit field of interest.
- * @Param: - IN arg_FieldLSBBit an unsigned integer value representing the position of the least significant
- * bit of the bit field.
- * @Param: - IN arg_FieldMSBBit an unsigned integer value representing the position of the most significant
- * bit of the bit field.
- *
- * @Return: Returns the value of the bit field. The value can be from 0 to (1 << (arg_FieldMSBBit + 1 -
- * arg_FieldLSBBit)) - 1.
- */
-#define IX_GET_BIT_FIELD16( \
- arg_PackedData16, \
- arg_FieldLSBBit, \
- arg_FieldMSBBit \
- ) \
- (((ix_uint16)(arg_PackedData16) & IX_BIT_FIELD_MASK16(arg_FieldLSBBit, arg_FieldMSBBit)) >> \
- arg_FieldLSBBit)
-
-
-/**
- * MACRO NAME: IX_MAKE_BIT_FIELD16
- *
- * DESCRIPTION: This macro will create a temporary 16 bit value with the bit field
- * desired set to the desired value.
- *
- * @Param: - IN arg_BitFieldValue is the new value of the bit field. The value can be from 0 to
- * (1 << (arg_FieldMSBBit + 1 - arg_FieldLSBBit)) - 1.
- * @Param: - IN arg_FieldLSBBit an unsigned integer value representing the position of the least significant
- * bit of the bit field.
- * @Param: - IN arg_FieldMSBBit an unsigned integer value representing the position of the most significant
- * bit of the bit field.
- *
- * @Return: Returns a temporary ix_uint16 value that has the bit field set to the appropriate value.
- */
-#define IX_MAKE_BIT_FIELD16( \
- arg_BitFieldValue, \
- arg_FieldLSBBit, \
- arg_FieldMSBBit \
- ) \
- (((ix_uint16)(arg_BitFieldValue) << arg_FieldLSBBit) & \
- IX_BIT_FIELD_MASK16(arg_FieldLSBBit, arg_FieldMSBBit))
-
-/**
- * MACRO NAME: IX_SET_BIT_FIELD16
- *
- * DESCRIPTION: Sets a new value for a bit field from a 16 bit unsigned integer.
- *
- * @Param: - IN arg_PackedData16 a 16 bit unsigned integer that contains the bit field of interest.
- * @Param: - IN arg_BitFieldValue is the new vale of the bit field. The value can be from 0 to
- * (1 << (arg_FieldMSBBit + 1 - arg_FieldLSBBit)) - 1.
- * @Param: - IN arg_FieldLSBBit an unsigned integer value representing the position of the least significant
- * bit of the bit field.
- * @Param: - IN arg_FieldMSBBit an unsigned integer value representing the position of the most significant
- * bit of the bit field.
- *
- * @Return: Returns the updated value of arg_PackedData16.
- */
-#define IX_SET_BIT_FIELD16( \
- arg_PackedData16, \
- arg_BitFieldValue, \
- arg_FieldLSBBit, \
- arg_FieldMSBBit \
- ) \
- (arg_PackedData16 = (((ix_uint16)(arg_PackedData16) & \
- ~(IX_BIT_FIELD_MASK16(arg_FieldLSBBit, arg_FieldMSBBit))) | \
- IX_MAKE_BIT_FIELD16(arg_BitFieldValue, arg_FieldLSBBit, arg_FieldMSBBit)))
-
-
-/**
- * MACRO NAME: IX_BIT_FIELD_MASK32
- *
- * DESCRIPTION: Builds the mask required to extract the bit field from a 32 bit unsigned integer value.
- *
- * @Param: - IN arg_FieldLSBBit an unsigned integer value representing the position of the least significant
- * bit of the bit field.
- * @Param: - IN arg_FieldMSBBit an unsigned integer value representing the position of the most significant
- * bit of the bit field.
- *
- * @Return: Returns a 32 bit mask that will extract the bit field from a 32 bit unsigned integer value.
- */
-#define IX_BIT_FIELD_MASK32( \
- arg_FieldLSBBit, \
- arg_FieldMSBBit \
- ) \
- ((ix_bit_mask32)((((ix_uint32)1 << (arg_FieldMSBBit + 1 - arg_FieldLSBBit)) - \
- (ix_uint32)1) << arg_FieldLSBBit))
-
-
-
-/**
- * MACRO NAME: IX_GET_BIT_FIELD32
- *
- * DESCRIPTION: Extracts a bit field from 32 bit unsigned integer. The returned value is normalized in
- * in the sense that will be right aligned.
- *
- * @Param: - IN arg_PackedData32 a 32 bit unsigned integer that contains the bit field of interest.
- * @Param: - IN arg_FieldLSBBit an unsigned integer value representing the position of the least significant
- * bit of the bit field.
- * @Param: - IN arg_FieldMSBBit an unsigned integer value representing the position of the most significant
- * bit of the bit field.
- *
- * @Return: Returns the value of the bit field. The value can be from 0 to (1 << (arg_FieldMSBBit + 1 -
- * arg_FieldLSBBit)) - 1.
- */
-#define IX_GET_BIT_FIELD32( \
- arg_PackedData32, \
- arg_FieldLSBBit, \
- arg_FieldMSBBit \
- ) \
- (((ix_uint32)(arg_PackedData32) & IX_BIT_FIELD_MASK32(arg_FieldLSBBit, arg_FieldMSBBit)) >> \
- arg_FieldLSBBit)
-
-
-
-
-/**
- * MACRO NAME: IX_MAKE_BIT_FIELD32
- *
- * DESCRIPTION: This macro will create a temporary 32 bit value with the bit field
- * desired set to the desired value.
- *
- * @Param: - IN arg_BitFieldValue is the new value of the bit field. The value can be from 0 to
- * (1 << (arg_FieldMSBBit + 1 - arg_FieldLSBBit)) - 1.
- * @Param: - IN arg_FieldLSBBit an unsigned integer value representing the position of the least significant
- * bit of the bit field.
- * @Param: - IN arg_FieldMSBBit an unsigned integer value representing the position of the most significant
- * bit of the bit field.
- *
- * @Return: Returns a temporary ix_uint32 value that has the bit field set to the appropriate value.
- */
-#define IX_MAKE_BIT_FIELD32( \
- arg_BitFieldValue, \
- arg_FieldLSBBit, \
- arg_FieldMSBBit \
- ) \
- (((ix_uint32)(arg_BitFieldValue) << arg_FieldLSBBit) & \
- IX_BIT_FIELD_MASK32(arg_FieldLSBBit, arg_FieldMSBBit))
-
-
-/**
- * MACRO NAME: IX_SET_BIT_FIELD32
- *
- * DESCRIPTION: Sets a new value for a bit field from a 32 bit unsigned integer.
- *
- * @Param: - IN arg_PackedData32 a 32 bit unsigned integer that contains the bit field of interest.
- * @Param: - IN arg_BitFieldValue is the new value of the bit field. The value can be from 0 to
- * (1 << (arg_FieldMSBBit + 1 - arg_FieldLSBBit)) - 1.
- * @Param: - IN arg_FieldLSBBit an unsigned integer value representing the position of the least significant
- * bit of the bit field.
- * @Param: - IN arg_FieldMSBBit an unsigned integer value representing the position of the most significant
- * bit of the bit field.
- *
- * @Return: Returns the updated value of arg_PackedData32.
- */
-#define IX_SET_BIT_FIELD32( \
- arg_PackedData32, \
- arg_BitFieldValue, \
- arg_FieldLSBBit, \
- arg_FieldMSBBit \
- ) \
- (arg_PackedData32 = (((ix_uint32)(arg_PackedData32) & \
- ~(IX_BIT_FIELD_MASK32(arg_FieldLSBBit, arg_FieldMSBBit))) | \
- IX_MAKE_BIT_FIELD32(arg_BitFieldValue, arg_FieldLSBBit, arg_FieldMSBBit)))
-
-
-
-#if defined(__cplusplus)
-}
-#endif /* end defined(__cplusplus) */
-
-#endif /* end !defined(__IX_MACROS_H__) */
diff --git a/cpu/ixp/npe/include/ix_os_type.h b/cpu/ixp/npe/include/ix_os_type.h
deleted file mode 100644
index 8575096722..0000000000
--- a/cpu/ixp/npe/include/ix_os_type.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * ============================================================================
- * = COPYRIGHT
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- * = PRODUCT
- * Intel(r) IXP425 Software Release
- *
- * = FILENAME
- * ix_os_type.h (Replaced by OSAL)
- *
- * = DESCRIPTION
- * This file provides protable symbol definitions for the current OS type.
- *
- * = AUTHOR
- * Intel Corporation
- *
- * = CHANGE HISTORY
- * 4/22/2002 4:43:30 PM - creation time
- * ============================================================================
- */
-
-#if !defined(__IX_OS_TYPE_H__)
-#define __IX_OS_TYPE_H__
-
-#include "IxOsalBackward.h"
-
-#endif /* end !defined(__IX_OS_TYPE_H__) */
-
diff --git a/cpu/ixp/npe/include/ix_ossl.h b/cpu/ixp/npe/include/ix_ossl.h
deleted file mode 100644
index b59f7d0873..0000000000
--- a/cpu/ixp/npe/include/ix_ossl.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/**
- * ============================================================================
- * = COPYRIGHT
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- * = PRODUCT
- * Intel(r) IXP425 Software Release
- *
- * = LIBRARY
- * OSSL - Operating System Services Library
- *
- * = MODULE
- * OSSL Abstraction layer header file
- *
- * = FILENAME
- * ix_ossl.h (Replaced by OSAL)
- *
- * = DESCRIPTION
- * This file contains the prototypes of OS-independent wrapper
- * functions which allow the programmer not to be tied to a specific
- * operating system. The OSSL functions can be divided into three classes:
- *
- * 1) synchronization-related wrapper functions around thread system calls
- * 2) thread-related wrapper functions around thread calls
- * 3) transactor/workbench osapi calls -- defined in osApi.h
- *
- * Both 1 and 2 classes of functions provide Thread Management, Thread
- * Synchronization, Mutual Exclusion and Timer primitives. Namely,
- * creation and deletion functions as well as the standard "wait" and
- * "exit". Additionally, a couple of utility functions which enable to
- * pause the execution of a thread are also provided.
- *
- * The 3rd class provides a slew of other OSAPI functions to handle
- * Transactor/WorkBench OS calls.
- *
- *
- * OSSL Thread APIs:
- * The OSSL thread functions that allow for thread creation,
- * get thread id, thread deletion and set thread priroity.
- *
- * ix_ossl_thread_create
- * ix_ossl_thread_get_id
- * ix_ossl_thread_exit
- * ix_ossl_thread_kill
- * ix_ossl_thread_set_priority
- * ix_ossl_thread__delay
- *
- * OSSL Semaphore APIs:
- * The OSSL semaphore functions that allow for initialization,
- * posting, waiting and deletion of semaphores.
- *
- * ix_ossl_sem_init
- * ix_ossl_sem_fini
- * ix_ossl_sem_take
- * ix_ossl_sem_give
- * ix_ossl_sem_flush
- *
- * OSSL Mutex APIs:
- * The OSSL wrapper functions that allow for initialization,
- * posting, waiting and deletion of mutexes.
- *
- * ix_ossl_mutex_init
- * ix_ossl_mutex_fini
- * ix_ossl_mutex_lock
- * ix_ossl_mutex_unlock
- *
- * OSSL Timer APIs:
- * The timer APIs provide sleep and get time functions.
- *
- * ix_ossl_sleep
- * ix_ossl_sleep_tick
- * ix_ossl_time_get
- *
- * OSAPIs for Transactor/WorkBench:
- * These OSAPI functions are used for transator OS calls.
- * They are defined in osApi.h.
- *
- * Sem_Init
- * Sem_Destroy
- * Sem_Wait
- * Sem_Wait
- * Thread_Create
- * Thread_Cancel
- * Thread_SetPriority
- * delayMs
- * delayTick
- *
- *
- *
- **********************************************************************
- *
- *
- * = AUTHOR
- * Intel Corporation
- *
- * = ACKNOWLEDGEMENTS
- *
- *
- * = CREATION TIME
- * 1/8/2002 1:53:42 PM
- *
- * = CHANGE HISTORY
- * 02/22/2002 : Renamed osapi.h os_api.h
- * Moved OS header file includes from OSSL.h to os_api.h
- * Moved OS specific datatypes to os_api.h
- * Modified data types, macros and functions as per
- * 'C' coding guidelines.
- *
- *
- * ============================================================================
- */
-
-#ifndef _IX_OSSL_H
-#ifndef __doxygen_hide
-#define _IX_OSSL_H
-#endif /* __doxygen_hide */
-
-#include "IxOsalBackward.h"
-
-#endif /* _IX_OSSL_H */
-
-/**
- * @} defgroup IxOSSL
- */
diff --git a/cpu/ixp/npe/include/ix_symbols.h b/cpu/ixp/npe/include/ix_symbols.h
deleted file mode 100644
index f7bb029d66..0000000000
--- a/cpu/ixp/npe/include/ix_symbols.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * ============================================================================
- * = COPYRIGHT
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- * = PRODUCT
- * Intel(r) IXP425 Software Release
- *
- * = FILENAME
- * ix_symbols.h
- *
- * = DESCRIPTION
- * This file declares all the global preprocessor symbols required by
- * the IXA SDK Framework API.
- *
- * = AUTHOR
- * Intel Corporation
- *
- * = CHANGE HISTORY
- * 4/23/2002 10:41:13 AM - creation time
- * ============================================================================
- */
-
-#if !defined(__IX_SYMBOLS_H__)
-#define __IX_SYMBOLS_H__
-
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif /* end defined(__cplusplus) */
-
-/**
- * The IX_EXPORT_FUNCTION symbol will be used for compilation on different platforms.
- * We are planning to provide a simulation version of the library that should work
- * with the Transactor rather than the hardware. This implementation will be done on
- * WIN32 in the form of a DLL that will need to export functions and symbols.
- */
-#if (_IX_OS_TYPE_ == _IX_OS_WIN32_)
-# if defined(_IX_LIB_INTERFACE_IMPLEMENTATION_)
-# define IX_EXPORT_FUNCTION __declspec( dllexport )
-# elif defined(_IX_LIB_INTERFACE_IMPORT_DLL_)
-# define IX_EXPORT_FUNCTION __declspec( dllimport )
-# else
-# define IX_EXPORT_FUNCTION extern
-# endif
-#elif (_IX_OS_TYPE_ == _IX_OS_WINCE_)
-# define IX_EXPORT_FUNCTION __declspec(dllexport)
-#else
-# define IX_EXPORT_FUNCTION extern
-#endif
-
-
-/**
- * This symbols should be defined when we want to build for a multithreaded environment
- */
-#define _IX_MULTI_THREADED_ 1
-
-
-/**
- * This symbol should be defined in the case we to buils for a multithreaded environment
- * but we want that our modules to work as if they are used in a single threaded environment.
- */
-/* #define _IX_RM_EXPLICIT_SINGLE_THREADED_ 1 */
-
-#if defined(__cplusplus)
-}
-#endif /* end defined(__cplusplus) */
-
-#endif /* end !defined(__IX_SYMBOLS_H__) */
diff --git a/cpu/ixp/npe/include/ix_types.h b/cpu/ixp/npe/include/ix_types.h
deleted file mode 100644
index fc7b1e993a..0000000000
--- a/cpu/ixp/npe/include/ix_types.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/**
- * ============================================================================
- * = COPYRIGHT
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- * = PRODUCT
- * Intel(r) IXP425 Software Release
- *
- * = FILENAME
- * ix_types.h
- *
- * = DESCRIPTION
- * This file will define generic types that will guarantee the protability
- * between different architectures and compilers. It should be used the entire
- * IXA SDK Framework API.
- *
- * = AUTHOR
- * Intel Corporation
- *
- * = CHANGE HISTORY
- * 4/22/2002 4:44:17 PM - creation time
- * ============================================================================
- */
-
-#if !defined(__IX_TYPES_H__)
-#define __IX_TYPES_H__
-
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif /* end defined(__cplusplus) */
-
-
-/**
- * Define generic integral data types that will guarantee the size.
- */
-
-/**
- * TYPENAME: ix_int8
- *
- * DESCRIPTION: This type defines an 8 bit signed integer value.
- *
- */
-typedef signed char ix_int8;
-
-
-/**
- * TYPENAME: ix_uint8
- *
- * DESCRIPTION: This type defines an 8 bit unsigned integer value.
- *
- */
-typedef unsigned char ix_uint8;
-
-
-/**
- * TYPENAME: ix_int16
- *
- * DESCRIPTION: This type defines an 16 bit signed integer value.
- *
- */
-typedef signed short int ix_int16;
-
-
-/**
- * TYPENAME: ix_uint16
- *
- * DESCRIPTION: This type defines an 16 bit unsigned integer value.
- *
- */
-typedef unsigned short int ix_uint16;
-
-
-/**
- * TYPENAME: ix_int32
- *
- * DESCRIPTION: This type defines an 32 bit signed integer value.
- *
- */
-typedef signed int ix_int32;
-
-
-/**
- * TYPENAME: ix_uint32
- *
- * DESCRIPTION: This type defines an 32 bit unsigned integer value.
- *
- */
-#ifndef __wince
-typedef unsigned int ix_uint32;
-#else
-typedef unsigned long ix_uint32;
-#endif
-
-/**
- * TYPENAME: ix_int64
- *
- * DESCRIPTION: This type defines an 64 bit signed integer value.
- *
- */
-#ifndef __wince
-__extension__ typedef signed long long int ix_int64;
-#endif
-
-/**
- * TYPENAME: ix_uint64
- *
- * DESCRIPTION: This type defines an 64 bit unsigned integer value.
- *
- */
-#ifndef __wince
-__extension__ typedef unsigned long long int ix_uint64;
-#endif
-
-
-/**
- * TYPENAME: ix_bit_mask8
- *
- * DESCRIPTION: This is a generic type for a 8 bit mask.
- */
-typedef ix_uint8 ix_bit_mask8;
-
-
-/**
- * TYPENAME: ix_bit_mask16
- *
- * DESCRIPTION: This is a generic type for a 16 bit mask.
- */
-typedef ix_uint16 ix_bit_mask16;
-
-
-/**
- * TYPENAME: ix_bit_mask32
- *
- * DESCRIPTION: This is a generic type for a 32 bit mask.
- */
-typedef ix_uint32 ix_bit_mask32;
-
-
-/**
- * TYPENAME: ix_bit_mask64
- *
- * DESCRIPTION: This is a generic type for a 64 bit mask.
- */
-#ifndef __wince
-typedef ix_uint64 ix_bit_mask64;
-#endif
-
-
-/**
- * TYPENAME: ix_handle
- *
- * DESCRIPTION: This type defines a generic handle.
- *
- */
-typedef ix_uint32 ix_handle;
-
-
-
-/**
- * DESCRIPTION: This symbol defines a NULL handle
- *
- */
-#define IX_NULL_HANDLE ((ix_handle)0)
-
-
-#if defined(__cplusplus)
-}
-#endif /* end defined(__cplusplus) */
-
-#endif /* end !defined(__IX_TYPES_H__) */
diff --git a/cpu/ixp/npe/include/npe.h b/cpu/ixp/npe/include/npe.h
deleted file mode 100644
index e53458defb..0000000000
--- a/cpu/ixp/npe/include/npe.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * (C) Copyright 2005
- * Stefan Roese, DENX Software Engineering, sr@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifndef NPE_H
-#define NPE_H
-
-/*
- * defines...
- */
-#define CFG_NPE_NUMS 1
-#ifdef CONFIG_HAS_ETH1
-#undef CFG_NPE_NUMS
-#define CFG_NPE_NUMS 2
-#endif
-
-#define NPE_NUM_PORTS 3
-#define ACTIVE_PORTS 1
-
-#define NPE_PKT_SIZE 1600
-
-#define CONFIG_DEVS_ETH_INTEL_NPE_MAX_RX_DESCRIPTORS 64
-#define CONFIG_DEVS_ETH_INTEL_NPE_MAX_TX_DESCRIPTORS 2
-
-#define NPE_MBUF_POOL_SIZE \
- ((CONFIG_DEVS_ETH_INTEL_NPE_MAX_TX_DESCRIPTORS + \
- CONFIG_DEVS_ETH_INTEL_NPE_MAX_RX_DESCRIPTORS) * \
- sizeof(IX_OSAL_MBUF) * ACTIVE_PORTS)
-
-#define NPE_PKT_POOL_SIZE \
- ((CONFIG_DEVS_ETH_INTEL_NPE_MAX_TX_DESCRIPTORS + \
- CONFIG_DEVS_ETH_INTEL_NPE_MAX_RX_DESCRIPTORS) * \
- NPE_PKT_SIZE * ACTIVE_PORTS)
-
-#define NPE_MEM_POOL_SIZE (NPE_MBUF_POOL_SIZE + NPE_PKT_POOL_SIZE)
-
-#define PHY_AUTONEGOTIATE_TIMEOUT 4000 /* 4000 ms autonegotiate timeout */
-
-/*
- * structs...
- */
-struct npe {
- u8 active; /* NPE active */
- u8 eth_id; /* IX_ETH_PORT_1 or IX_ETH_PORT_2 */
- u8 phy_no; /* which PHY (0 - 31) */
- u8 mac_address[6];
-
- IX_OSAL_MBUF *rxQHead;
- IX_OSAL_MBUF *txQHead;
-
- u8 *tx_pkts;
- u8 *rx_pkts;
- IX_OSAL_MBUF *rx_mbufs;
- IX_OSAL_MBUF *tx_mbufs;
-
- int print_speed;
-
- int rx_read;
- int rx_write;
- int rx_len[PKTBUFSRX];
-};
-
-/*
- * prototypes...
- */
-extern int npe_miiphy_read (char *devname, unsigned char addr,
- unsigned char reg, unsigned short *value);
-extern int npe_miiphy_write (char *devname, unsigned char addr,
- unsigned char reg, unsigned short value);
-
-#endif /* ifndef NPE_H */
diff --git a/cpu/ixp/npe/include/os_datatypes.h b/cpu/ixp/npe/include/os_datatypes.h
deleted file mode 100644
index 4387b2a052..0000000000
--- a/cpu/ixp/npe/include/os_datatypes.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * ============================================================================
- * = COPYRIGHT
- *
- * @par
- * IXP400 SW Release version 2.0
- *
- * -- Copyright Notice --
- *
- * @par
- * Copyright 2001-2005, Intel Corporation.
- * All rights reserved.
- *
- * @par
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @par
- * -- End of Copyright Notice --
- * = PRODUCT
- * Intel(r) IXP425 Software Release
- *
- * = LIBRARY
- * OSSL - Operating System Services Library
- *
- * = MODULE
- * OS Specific Data Types header file
- *
- * = FILENAME
- * OSSL.h (Replaced by OSAL)
- *
- * = DESCRIPTION
- * This file contains definitions and encapsulations for OS specific data types. These
- * encapsulated data types are used by OSSL header files and OS API functions.
- *
- *
- **********************************************************************
- *
- *
- * = AUTHOR
- * Intel Corporation
- *
- * = AKNOWLEDGEMENTS
- *
- *
- * = CREATION TIME
- * 1/8/2002 1:53:42 PM
- *
- * = CHANGE HISTORY
-
- * ============================================================================
- */
-
-#ifndef _OS_DATATYPES_H
-#define _OS_DATATYPES_H
-
-#include "IxOsalBackward.h"
-
-#endif /* _OS_DATATYPES_H */
-
diff --git a/cpu/ixp/npe/miiphy.c b/cpu/ixp/npe/miiphy.c
deleted file mode 100644
index c63c54e28f..0000000000
--- a/cpu/ixp/npe/miiphy.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-----------------------------------------------------------------------------+
- |
- | This source code has been made available to you by IBM on an AS-IS
- | basis. Anyone receiving this source is licensed under IBM
- | copyrights to use it in any way he or she deems fit, including
- | copying it, modifying it, compiling it, and redistributing it either
- | with or without modifications. No license under IBM patents or
- | patent applications is to be implied by the copyright license.
- |
- | Any user of this software should understand that IBM cannot provide
- | technical support for this software and will not be responsible for
- | any consequences resulting from the use of this software.
- |
- | Any person who transfers this source code or any derivative work
- | must include the IBM copyright notice, this paragraph, and the
- | preceding two paragraphs in the transferred software.
- |
- | COPYRIGHT I B M CORPORATION 1995
- | LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
- +-----------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------+
- |
- | File Name: miiphy.c
- |
- | Function: This module has utilities for accessing the MII PHY through
- | the EMAC3 macro.
- |
- | Author: Mark Wisner
- |
- | Change Activity-
- |
- | Date Description of Change BY
- | --------- --------------------- ---
- | 05-May-99 Created MKW
- | 01-Jul-99 Changed clock setting of sta_reg from 66Mhz to 50Mhz to
- | better match OPB speed. Also modified delay times. JWB
- | 29-Jul-99 Added Full duplex support MKW
- | 24-Aug-99 Removed printf from dp83843_duplex() JWB
- | 19-Jul-00 Ported to esd cpci405 sr
- | 23-Dec-03 Ported from miiphy.c to 440GX Travis Sawyer TBS
- | <travis.sawyer@sandburst.com>
- |
- +-----------------------------------------------------------------------------*/
-
-#include <common.h>
-#include <miiphy.h>
-#include "IxOsal.h"
-#include "IxEthAcc.h"
-#include "IxEthAcc_p.h"
-#include "IxEthAccMac_p.h"
-#include "IxEthAccMii_p.h"
-
-/***********************************************************/
-/* Dump out to the screen PHY regs */
-/***********************************************************/
-
-void miiphy_dump (char *devname, unsigned char addr)
-{
- unsigned long i;
- unsigned short data;
-
-
- for (i = 0; i < 0x1A; i++) {
- if (miiphy_read (devname, addr, i, &data)) {
- printf ("read error for reg %lx\n", i);
- return;
- }
- printf ("Phy reg %lx ==> %4x\n", i, data);
-
- /* jump to the next set of regs */
- if (i == 0x07)
- i = 0x0f;
-
- } /* end for loop */
-} /* end dump */
-
-
-/***********************************************************/
-/* (Re)start autonegotiation */
-/***********************************************************/
-int phy_setup_aneg (char *devname, unsigned char addr)
-{
- unsigned short ctl, adv;
-
- /* Setup standard advertise */
- miiphy_read (devname, addr, PHY_ANAR, &adv);
- adv |= (PHY_ANLPAR_ACK | PHY_ANLPAR_RF | PHY_ANLPAR_T4 |
- PHY_ANLPAR_TXFD | PHY_ANLPAR_TX | PHY_ANLPAR_10FD |
- PHY_ANLPAR_10);
- miiphy_write (devname, addr, PHY_ANAR, adv);
-
- /* Start/Restart aneg */
- miiphy_read (devname, addr, PHY_BMCR, &ctl);
- ctl |= (PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
- miiphy_write (devname, addr, PHY_BMCR, ctl);
-
- return 0;
-}
-
-
-int npe_miiphy_read (char *devname, unsigned char addr,
- unsigned char reg, unsigned short *value)
-{
- u16 val;
-
- ixEthAccMiiReadRtn(addr, reg, &val);
- *value = val;
-
- return 0;
-} /* phy_read */
-
-
-int npe_miiphy_write (char *devname, unsigned char addr,
- unsigned char reg, unsigned short value)
-{
- ixEthAccMiiWriteRtn(addr, reg, value);
- return 0;
-} /* phy_write */
diff --git a/cpu/ixp/npe/npe.c b/cpu/ixp/npe/npe.c
deleted file mode 100644
index 58d17d89b4..0000000000
--- a/cpu/ixp/npe/npe.c
+++ /dev/null
@@ -1,635 +0,0 @@
-/*
- * (C) Copyright 2005-2006
- * Stefan Roese, DENX Software Engineering, sr@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <common.h>
-#include <net.h>
-#include <miiphy.h>
-#include <malloc.h>
-#include <asm/processor.h>
-#include <asm/arch-ixp/ixp425.h>
-
-#include <IxOsal.h>
-#include <IxEthAcc.h>
-#include <IxEthDB.h>
-#include <IxNpeDl.h>
-#include <IxQMgr.h>
-#include <IxNpeMh.h>
-#include <ix_ossl.h>
-#include <IxFeatureCtrl.h>
-
-#include <npe.h>
-
-#ifdef CONFIG_IXP4XX_NPE
-
-static IxQMgrDispatcherFuncPtr qDispatcherFunc = NULL;
-static int npe_exists[NPE_NUM_PORTS];
-static int npe_used[NPE_NUM_PORTS];
-
-/* A little extra so we can align to cacheline. */
-static u8 npe_alloc_pool[NPE_MEM_POOL_SIZE + CONFIG_CACHELINE_SIZE - 1];
-static u8 *npe_alloc_end;
-static u8 *npe_alloc_free;
-
-static void *npe_alloc(int size)
-{
- static int count = 0;
- void *p = NULL;
-
- size = (size + (CONFIG_CACHELINE_SIZE-1)) & ~(CONFIG_CACHELINE_SIZE-1);
- count++;
-
- if ((npe_alloc_free + size) < npe_alloc_end) {
- p = npe_alloc_free;
- npe_alloc_free += size;
- } else {
- printf("%s: failed (count=%d, size=%d)!\n", count, size);
- }
- return p;
-}
-
-/* Not interrupt safe! */
-static void mbuf_enqueue(IX_OSAL_MBUF **q, IX_OSAL_MBUF *new)
-{
- IX_OSAL_MBUF *m = *q;
-
- IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(new) = NULL;
-
- if (m) {
- while(IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m))
- m = IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m);
- IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m) = new;
- } else
- *q = new;
-}
-
-/* Not interrupt safe! */
-static IX_OSAL_MBUF *mbuf_dequeue(IX_OSAL_MBUF **q)
-{
- IX_OSAL_MBUF *m = *q;
- if (m)
- *q = IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m);
- return m;
-}
-
-static void reset_tx_mbufs(struct npe* p_npe)
-{
- IX_OSAL_MBUF *m;
- int i;
-
- p_npe->txQHead = NULL;
-
- for (i = 0; i < CONFIG_DEVS_ETH_INTEL_NPE_MAX_TX_DESCRIPTORS; i++) {
- m = &p_npe->tx_mbufs[i];
-
- memset(m, 0, sizeof(*m));
-
- IX_OSAL_MBUF_MDATA(m) = (void *)&p_npe->tx_pkts[i * NPE_PKT_SIZE];
- IX_OSAL_MBUF_MLEN(m) = IX_OSAL_MBUF_PKT_LEN(m) = NPE_PKT_SIZE;
- mbuf_enqueue(&p_npe->txQHead, m);
- }
-}
-
-static void reset_rx_mbufs(struct npe* p_npe)
-{
- IX_OSAL_MBUF *m;
- int i;
-
- p_npe->rxQHead = NULL;
-
- HAL_DCACHE_INVALIDATE(p_npe->rx_pkts, NPE_PKT_SIZE *
- CONFIG_DEVS_ETH_INTEL_NPE_MAX_RX_DESCRIPTORS);
-
- for (i = 0; i < CONFIG_DEVS_ETH_INTEL_NPE_MAX_RX_DESCRIPTORS; i++) {
- m = &p_npe->rx_mbufs[i];
-
- memset(m, 0, sizeof(*m));
-
- IX_OSAL_MBUF_MDATA(m) = (void *)&p_npe->rx_pkts[i * NPE_PKT_SIZE];
- IX_OSAL_MBUF_MLEN(m) = IX_OSAL_MBUF_PKT_LEN(m) = NPE_PKT_SIZE;
-
- if(ixEthAccPortRxFreeReplenish(p_npe->eth_id, m) != IX_SUCCESS) {
- printf("ixEthAccPortRxFreeReplenish failed for port %d\n", p_npe->eth_id);
- break;
- }
- }
-}
-
-static void init_rx_mbufs(struct npe* p_npe)
-{
- p_npe->rxQHead = NULL;
-
- p_npe->rx_pkts = npe_alloc(NPE_PKT_SIZE *
- CONFIG_DEVS_ETH_INTEL_NPE_MAX_RX_DESCRIPTORS);
- if (p_npe->rx_pkts == NULL) {
- printf("alloc of packets failed.\n");
- return;
- }
-
- p_npe->rx_mbufs = (IX_OSAL_MBUF *)
- npe_alloc(sizeof(IX_OSAL_MBUF) *
- CONFIG_DEVS_ETH_INTEL_NPE_MAX_RX_DESCRIPTORS);
- if (p_npe->rx_mbufs == NULL) {
- printf("alloc of mbufs failed.\n");
- return;
- }
-
- reset_rx_mbufs(p_npe);
-}
-
-static void init_tx_mbufs(struct npe* p_npe)
-{
- p_npe->tx_pkts = npe_alloc(NPE_PKT_SIZE *
- CONFIG_DEVS_ETH_INTEL_NPE_MAX_TX_DESCRIPTORS);
- if (p_npe->tx_pkts == NULL) {
- printf("alloc of packets failed.\n");
- return;
- }
-
- p_npe->tx_mbufs = (IX_OSAL_MBUF *)
- npe_alloc(sizeof(IX_OSAL_MBUF) *
- CONFIG_DEVS_ETH_INTEL_NPE_MAX_TX_DESCRIPTORS);
- if (p_npe->tx_mbufs == NULL) {
- printf("alloc of mbufs failed.\n");
- return;
- }
-
- reset_tx_mbufs(p_npe);
-}
-
-/* Convert IX_ETH_PORT_n to IX_NPEMH_NPEID_NPEx */
-static int __eth_to_npe(int eth_id)
-{
- switch(eth_id) {
- case IX_ETH_PORT_1:
- return IX_NPEMH_NPEID_NPEB;
-
- case IX_ETH_PORT_2:
- return IX_NPEMH_NPEID_NPEC;
-
- case IX_ETH_PORT_3:
- return IX_NPEMH_NPEID_NPEA;
- }
- return 0;
-}
-
-/* Poll the CSR machinery. */
-static void npe_poll(int eth_id)
-{
- if (qDispatcherFunc != NULL) {
- ixNpeMhMessagesReceive(__eth_to_npe(eth_id));
- (*qDispatcherFunc)(IX_QMGR_QUELOW_GROUP);
- }
-}
-
-/* ethAcc RX callback */
-static void npe_rx_callback(u32 cbTag, IX_OSAL_MBUF *m, IxEthAccPortId portid)
-{
- struct npe* p_npe = (struct npe *)cbTag;
-
- if (IX_OSAL_MBUF_MLEN(m) > 0) {
- mbuf_enqueue(&p_npe->rxQHead, m);
-
- if (p_npe->rx_write == ((p_npe->rx_read-1) & (PKTBUFSRX-1))) {
- debug("Rx overflow: rx_write=%d rx_read=%d\n",
- p_npe->rx_write, p_npe->rx_read);
- } else {
- debug("Received message #%d (len=%d)\n", p_npe->rx_write,
- IX_OSAL_MBUF_MLEN(m));
- memcpy((void *)NetRxPackets[p_npe->rx_write], IX_OSAL_MBUF_MDATA(m),
- IX_OSAL_MBUF_MLEN(m));
- p_npe->rx_len[p_npe->rx_write] = IX_OSAL_MBUF_MLEN(m);
- p_npe->rx_write++;
- if (p_npe->rx_write == PKTBUFSRX)
- p_npe->rx_write = 0;
-
-#ifdef CONFIG_PRINT_RX_FRAMES
- {
- u8 *ptr = IX_OSAL_MBUF_MDATA(m);
- int i;
-
- for (i=0; i<60; i++) {
- debug("%02x ", *ptr++);
- }
- debug("\n");
- }
-#endif
- }
-
- m = mbuf_dequeue(&p_npe->rxQHead);
- } else {
- debug("Received frame with length 0!!!\n");
- m = mbuf_dequeue(&p_npe->rxQHead);
- }
-
- /* Now return mbuf to NPE */
- IX_OSAL_MBUF_MLEN(m) = IX_OSAL_MBUF_PKT_LEN(m) = NPE_PKT_SIZE;
- IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(m) = NULL;
- IX_OSAL_MBUF_FLAGS(m) = 0;
-
- if(ixEthAccPortRxFreeReplenish(p_npe->eth_id, m) != IX_SUCCESS) {
- debug("npe_rx_callback: Error returning mbuf.\n");
- }
-}
-
-/* ethAcc TX callback */
-static void npe_tx_callback(u32 cbTag, IX_OSAL_MBUF *m)
-{
- struct npe* p_npe = (struct npe *)cbTag;
-
- debug("%s\n", __FUNCTION__);
-
- IX_OSAL_MBUF_MLEN(m) = IX_OSAL_MBUF_PKT_LEN(m) = NPE_PKT_SIZE;
- IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR(m) = NULL;
- IX_OSAL_MBUF_FLAGS(m) = 0;
-
- mbuf_enqueue(&p_npe->txQHead, m);
-}
-
-
-static int npe_set_mac_address(struct eth_device *dev)
-{
- struct npe *p_npe = (struct npe *)dev->priv;
- IxEthAccMacAddr npeMac;
-
- debug("%s\n", __FUNCTION__);
-
- /* Set MAC address */
- memcpy(npeMac.macAddress, dev->enetaddr, 6);
-
- if (ixEthAccPortUnicastMacAddressSet(p_npe->eth_id, &npeMac) != IX_ETH_ACC_SUCCESS) {
- printf("Error setting unicast address! %02x:%02x:%02x:%02x:%02x:%02x\n",
- npeMac.macAddress[0], npeMac.macAddress[1],
- npeMac.macAddress[2], npeMac.macAddress[3],
- npeMac.macAddress[4], npeMac.macAddress[5]);
- return 0;
- }
-
- return 1;
-}
-
-/* Boot-time CSR library initialization. */
-static int npe_csr_load(void)
-{
- int i;
-
- if (ixQMgrInit() != IX_SUCCESS) {
- debug("Error initialising queue manager!\n");
- return 0;
- }
-
- ixQMgrDispatcherLoopGet(&qDispatcherFunc);
-
- if(ixNpeMhInitialize(IX_NPEMH_NPEINTERRUPTS_YES) != IX_SUCCESS) {
- printf("Error initialising NPE Message handler!\n");
- return 0;
- }
-
- if (npe_used[IX_ETH_PORT_1] && npe_exists[IX_ETH_PORT_1] &&
- ixNpeDlNpeInitAndStart(IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS)
- != IX_SUCCESS) {
- printf("Error downloading firmware to NPE-B!\n");
- return 0;
- }
-
- if (npe_used[IX_ETH_PORT_2] && npe_exists[IX_ETH_PORT_2] &&
- ixNpeDlNpeInitAndStart(IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS)
- != IX_SUCCESS) {
- printf("Error downloading firmware to NPE-C!\n");
- return 0;
- }
-
- /* don't need this for U-Boot */
- ixFeatureCtrlSwConfigurationWrite(IX_FEATURECTRL_ETH_LEARNING, FALSE);
-
- if (ixEthAccInit() != IX_ETH_ACC_SUCCESS) {
- printf("Error initialising Ethernet access driver!\n");
- return 0;
- }
-
- for (i = 0; i < IX_ETH_ACC_NUMBER_OF_PORTS; i++) {
- if (!npe_used[i] || !npe_exists[i])
- continue;
- if (ixEthAccPortInit(i) != IX_ETH_ACC_SUCCESS) {
- printf("Error initialising Ethernet port%d!\n", i);
- }
- if (ixEthAccTxSchedulingDisciplineSet(i, FIFO_NO_PRIORITY) != IX_ETH_ACC_SUCCESS) {
- printf("Error setting scheduling discipline for port %d.\n", i);
- }
- if (ixEthAccPortRxFrameAppendFCSDisable(i) != IX_ETH_ACC_SUCCESS) {
- printf("Error disabling RX FCS for port %d.\n", i);
- }
- if (ixEthAccPortTxFrameAppendFCSEnable(i) != IX_ETH_ACC_SUCCESS) {
- printf("Error enabling TX FCS for port %d.\n", i);
- }
- }
-
- return 1;
-}
-
-static int npe_init(struct eth_device *dev, bd_t * bis)
-{
- struct npe *p_npe = (struct npe *)dev->priv;
- int i;
- u16 reg_short;
- int speed;
- int duplex;
-
- debug("%s: 1\n", __FUNCTION__);
-
- miiphy_read (dev->name, p_npe->phy_no, PHY_BMSR, &reg_short);
-
- /*
- * Wait if PHY is capable of autonegotiation and autonegotiation is not complete
- */
- if ((reg_short & PHY_BMSR_AUTN_ABLE) && !(reg_short & PHY_BMSR_AUTN_COMP)) {
- puts ("Waiting for PHY auto negotiation to complete");
- i = 0;
- while (!(reg_short & PHY_BMSR_AUTN_COMP)) {
- /*
- * Timeout reached ?
- */
- if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
- puts (" TIMEOUT !\n");
- break;
- }
-
- if ((i++ % 1000) == 0) {
- putc ('.');
- miiphy_read (dev->name, p_npe->phy_no, PHY_BMSR, &reg_short);
- }
- udelay (1000); /* 1 ms */
- }
- puts (" done\n");
- udelay (500000); /* another 500 ms (results in faster booting) */
- }
-
- speed = miiphy_speed (dev->name, p_npe->phy_no);
- duplex = miiphy_duplex (dev->name, p_npe->phy_no);
-
- if (p_npe->print_speed) {
- p_npe->print_speed = 0;
- printf ("ENET Speed is %d Mbps - %s duplex connection\n",
- (int) speed, (duplex == HALF) ? "HALF" : "FULL");
- }
-
- npe_alloc_end = npe_alloc_pool + sizeof(npe_alloc_pool);
- npe_alloc_free = (u8 *)(((unsigned)npe_alloc_pool +
- CONFIG_CACHELINE_SIZE - 1) & ~(CONFIG_CACHELINE_SIZE - 1));
-
- /* initialize mbuf pool */
- init_rx_mbufs(p_npe);
- init_tx_mbufs(p_npe);
-
- if (ixEthAccPortRxCallbackRegister(p_npe->eth_id, npe_rx_callback,
- (u32)p_npe) != IX_ETH_ACC_SUCCESS) {
- printf("can't register RX callback!\n");
- return 0;
- }
-
- if (ixEthAccPortTxDoneCallbackRegister(p_npe->eth_id, npe_tx_callback,
- (u32)p_npe) != IX_ETH_ACC_SUCCESS) {
- printf("can't register TX callback!\n");
- return 0;
- }
-
- npe_set_mac_address(dev);
-
- if (ixEthAccPortEnable(p_npe->eth_id) != IX_ETH_ACC_SUCCESS) {
- printf("can't enable port!\n");
- return 0;
- }
-
- p_npe->active = 1;
-
- return 1;
-}
-
-
-static void npe_halt(struct eth_device *dev)
-{
- struct npe *p_npe = (struct npe *)dev->priv;
- int i;
-
- debug("%s\n", __FUNCTION__);
-
- /* Delay to give time for recovery of mbufs */
- for (i = 0; i < 100; i++) {
- npe_poll(p_npe->eth_id);
- udelay(100);
- }
-
- p_npe->active = 0;
-}
-
-
-static int npe_send(struct eth_device *dev, volatile void *packet, int len)
-{
- struct npe *p_npe = (struct npe *)dev->priv;
- u8 *dest;
- int err;
- IX_OSAL_MBUF *m;
-
- debug("%s\n", __FUNCTION__);
- m = mbuf_dequeue(&p_npe->txQHead);
- dest = IX_OSAL_MBUF_MDATA(m);
- IX_OSAL_MBUF_PKT_LEN(m) = IX_OSAL_MBUF_MLEN(m) = len;
- IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR(m) = NULL;
-
- memcpy(dest, (char *)packet, len);
-
- if ((err = ixEthAccPortTxFrameSubmit(p_npe->eth_id, m, IX_ETH_ACC_TX_DEFAULT_PRIORITY))
- != IX_ETH_ACC_SUCCESS) {
- printf("npe_send: Can't submit frame. err[%d]\n", err);
- mbuf_enqueue(&p_npe->txQHead, m);
- return 0;
- }
-
-#ifdef DEBUG_PRINT_TX_FRAMES
- {
- u8 *ptr = IX_OSAL_MBUF_MDATA(m);
- int i;
-
- for (i=0; i<IX_OSAL_MBUF_MLEN(m); i++) {
- printf("%02x ", *ptr++);
- }
- printf(" (tx-len=%d)\n", IX_OSAL_MBUF_MLEN(m));
- }
-#endif
-
- npe_poll(p_npe->eth_id);
-
- return len;
-}
-
-static int npe_rx(struct eth_device *dev)
-{
- struct npe *p_npe = (struct npe *)dev->priv;
-
- debug("%s\n", __FUNCTION__);
- npe_poll(p_npe->eth_id);
-
- debug("%s: rx_write=%d rx_read=%d\n", __FUNCTION__, p_npe->rx_write, p_npe->rx_read);
- while (p_npe->rx_write != p_npe->rx_read) {
- debug("Reading message #%d\n", p_npe->rx_read);
- NetReceive(NetRxPackets[p_npe->rx_read], p_npe->rx_len[p_npe->rx_read]);
- p_npe->rx_read++;
- if (p_npe->rx_read == PKTBUFSRX)
- p_npe->rx_read = 0;
- }
-
- return 0;
-}
-
-int npe_initialize(bd_t * bis)
-{
- static int virgin = 0;
- struct eth_device *dev;
- int eth_num = 0;
- struct npe *p_npe = NULL;
-
- for (eth_num = 0; eth_num < CFG_NPE_NUMS; eth_num++) {
-
- /* See if we can actually bring up the interface, otherwise, skip it */
- switch (eth_num) {
- default: /* fall through */
- case 0:
- if (memcmp (bis->bi_enetaddr, "\0\0\0\0\0\0", 6) == 0) {
- continue;
- }
- break;
-#ifdef CONFIG_HAS_ETH1
- case 1:
- if (memcmp (bis->bi_enet1addr, "\0\0\0\0\0\0", 6) == 0) {
- continue;
- }
- break;
-#endif
- }
-
- /* Allocate device structure */
- dev = (struct eth_device *)malloc(sizeof(*dev));
- if (dev == NULL) {
- printf ("%s: Cannot allocate eth_device %d\n", __FUNCTION__, eth_num);
- return -1;
- }
- memset(dev, 0, sizeof(*dev));
-
- /* Allocate our private use data */
- p_npe = (struct npe *)malloc(sizeof(struct npe));
- if (p_npe == NULL) {
- printf("%s: Cannot allocate private hw data for eth_device %d",
- __FUNCTION__, eth_num);
- free(dev);
- return -1;
- }
- memset(p_npe, 0, sizeof(struct npe));
-
- switch (eth_num) {
- default: /* fall through */
- case 0:
- memcpy(dev->enetaddr, bis->bi_enetaddr, 6);
- p_npe->eth_id = 0;
- p_npe->phy_no = CONFIG_PHY_ADDR;
- break;
-
-#ifdef CONFIG_HAS_ETH1
- case 1:
- memcpy(dev->enetaddr, bis->bi_enet1addr, 6);
- p_npe->eth_id = 1;
- p_npe->phy_no = CONFIG_PHY1_ADDR;
- break;
-#endif
- }
-
- sprintf(dev->name, "NPE%d", eth_num);
- dev->priv = (void *)p_npe;
- dev->init = npe_init;
- dev->halt = npe_halt;
- dev->send = npe_send;
- dev->recv = npe_rx;
-
- p_npe->print_speed = 1;
-
- if (0 == virgin) {
- virgin = 1;
-
- if (ixFeatureCtrlDeviceRead() == IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X) {
- switch (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK) {
- case IX_FEATURE_CTRL_SILICON_TYPE_B0:
- /*
- * If it is B0 Silicon, we only enable port when its corresponding
- * Eth Coprocessor is available.
- */
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH0) ==
- IX_FEATURE_CTRL_COMPONENT_ENABLED)
- npe_exists[IX_ETH_PORT_1] = TRUE;
-
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH1) ==
- IX_FEATURE_CTRL_COMPONENT_ENABLED)
- npe_exists[IX_ETH_PORT_2] = TRUE;
- break;
- case IX_FEATURE_CTRL_SILICON_TYPE_A0:
- /*
- * If it is A0 Silicon, we enable both as both Eth Coprocessors
- * are available.
- */
- npe_exists[IX_ETH_PORT_1] = TRUE;
- npe_exists[IX_ETH_PORT_2] = TRUE;
- break;
- }
- } else if (ixFeatureCtrlDeviceRead() == IX_FEATURE_CTRL_DEVICE_TYPE_IXP46X) {
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH0) ==
- IX_FEATURE_CTRL_COMPONENT_ENABLED)
- npe_exists[IX_ETH_PORT_1] = TRUE;
-
- if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_ETH1) ==
- IX_FEATURE_CTRL_COMPONENT_ENABLED)
- npe_exists[IX_ETH_PORT_2] = TRUE;
- }
-
- npe_used[IX_ETH_PORT_1] = 1;
- npe_used[IX_ETH_PORT_2] = 1;
-
- npe_alloc_end = npe_alloc_pool + sizeof(npe_alloc_pool);
- npe_alloc_free = (u8 *)(((unsigned)npe_alloc_pool +
- CONFIG_CACHELINE_SIZE - 1)
- & ~(CONFIG_CACHELINE_SIZE - 1));
-
- if (!npe_csr_load())
- return 0;
- }
-
- eth_register(dev);
-
-#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
- miiphy_register(dev->name, npe_miiphy_read, npe_miiphy_write);
-#endif
-
- } /* end for each supported device */
-
- return 1;
-}
-
-#endif /* CONFIG_IXP4XX_NPE */
diff --git a/cpu/ixp/pci.c b/cpu/ixp/pci.c
deleted file mode 100644
index 84c4339ee6..0000000000
--- a/cpu/ixp/pci.c
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- * IXP PCI Init
- * (C) Copyright 2004 eslab.whut.edu.cn
- * Yue Hu(huyue_whut@yahoo.com.cn), Ligong Xue(lgxue@hotmail.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <common.h>
-
-#ifdef CONFIG_PCI
-
-#include <asm/processor.h>
-#include <asm/io.h>
-#include <pci.h>
-#include <asm/arch/ixp425.h>
-#include <asm/arch/ixp425pci.h>
-
-static void non_prefetch_read (unsigned int addr, unsigned int cmd,
- unsigned int *data);
-static void non_prefetch_write (unsigned int addr, unsigned int cmd,
- unsigned int data);
-static void configure_pins (void);
-static void sys_pci_gpio_clock_config (void);
-static void pci_bus_scan (void);
-static int pci_device_exists (unsigned int deviceNo);
-static void sys_pci_bar_info_get (unsigned int devnum, unsigned int bus,
- unsigned int dev, unsigned int func);
-static void sys_pci_device_bars_write (void);
-static void calc_bars (PciBar * Bars[], unsigned int nBars,
- unsigned int startAddr);
-
-#define PCI_MEMORY_BUS 0x00000000
-#define PCI_MEMORY_PHY 0x48000000
-#define PCI_MEMORY_SIZE 0x04000000
-
-#define PCI_MEM_BUS 0x40000000
-#define PCI_MEM_PHY 0x00000000
-#define PCI_MEM_SIZE 0x04000000
-
-#define PCI_IO_BUS 0x40000000
-#define PCI_IO_PHY 0x50000000
-#define PCI_IO_SIZE 0x10000000
-
-struct pci_controller hose;
-
-unsigned int nDevices;
-unsigned int nMBars;
-unsigned int nIOBars;
-PciBar *memBars[IXP425_PCI_MAX_BAR];
-PciBar *ioBars[IXP425_PCI_MAX_BAR];
-PciDevice devices[IXP425_PCI_MAX_FUNC_ON_BUS];
-
-int pci_read_config_dword (pci_dev_t dev, int where, unsigned int *val)
-{
- unsigned int retval;
- unsigned int addr;
-
- /*address bits 31:28 specify the device 10:8 specify the function */
- /*Set the address to be read */
- addr = BIT ((31 - dev)) | (where & ~3);
- non_prefetch_read (addr, NP_CMD_CONFIGREAD, &retval);
-
- *val = retval;
-
- return (OK);
-}
-
-int pci_read_config_word (pci_dev_t dev, int where, unsigned short *val)
-{
- unsigned int n;
- unsigned int retval;
- unsigned int addr;
- unsigned int byteEnables;
-
- n = where % 4;
- /*byte enables are 4 bits active low, the position of each
- bit maps to the byte that it enables */
- byteEnables =
- (~(BIT (n) | BIT ((n + 1)))) &
- IXP425_PCI_BOTTOM_NIBBLE_OF_LONG_MASK;
- byteEnables = byteEnables << PCI_NP_CBE_BESL;
- /*address bits 31:28 specify the device 10:8 specify the function */
- /*Set the address to be read */
- addr = BIT ((31 - dev)) | (where & ~3);
- non_prefetch_read (addr, byteEnables | NP_CMD_CONFIGREAD, &retval);
-
- /*Pick out the word we are interested in */
- *val = (retval >> (8 * n));
-
- return (OK);
-}
-
-int pci_read_config_byte (pci_dev_t dev, int where, unsigned char *val)
-{
- unsigned int retval;
- unsigned int n;
- unsigned int byteEnables;
- unsigned int addr;
-
- n = where % 4;
- /*byte enables are 4 bits, active low, the position of each
- bit maps to the byte that it enables */
- byteEnables = (~BIT (n)) & IXP425_PCI_BOTTOM_NIBBLE_OF_LONG_MASK;
- byteEnables = byteEnables << PCI_NP_CBE_BESL;
-
- /*address bits 31:28 specify the device, 10:8 specify the function */
- /*Set the address to be read */
- addr = BIT ((31 - dev)) | (where & ~3);
- non_prefetch_read (addr, byteEnables | NP_CMD_CONFIGREAD, &retval);
- /*Pick out the byte we are interested in */
- *val = (retval >> (8 * n));
-
- return (OK);
-}
-
-int pci_write_config_byte (pci_dev_t dev, int where, unsigned char val)
-{
- unsigned int addr;
- unsigned int byteEnables;
- unsigned int n;
- unsigned int ldata;
-
- n = where % 4;
- /*byte enables are 4 bits active low, the position of each
- bit maps to the byte that it enables */
- byteEnables = (~BIT (n)) & IXP425_PCI_BOTTOM_NIBBLE_OF_LONG_MASK;
- byteEnables = byteEnables << PCI_NP_CBE_BESL;
- ldata = val << (8 * n);
- /*address bits 31:28 specify the device 10:8 specify the function */
- /*Set the address to be written */
- addr = BIT ((31 - dev)) | (where & ~3);
- non_prefetch_write (addr, byteEnables | NP_CMD_CONFIGWRITE, ldata);
-
- return (OK);
-}
-
-int pci_write_config_word (pci_dev_t dev, int where, unsigned short val)
-{
- unsigned int addr;
- unsigned int byteEnables;
- unsigned int n;
- unsigned int ldata;
-
- n = where % 4;
- /*byte enables are 4 bits active low, the position of each
- bit maps to the byte that it enables */
- byteEnables =
- (~(BIT (n) | BIT ((n + 1)))) &
- IXP425_PCI_BOTTOM_NIBBLE_OF_LONG_MASK;
- byteEnables = byteEnables << PCI_NP_CBE_BESL;
- ldata = val << (8 * n);
- /*address bits 31:28 specify the device 10:8 specify the function */
- /*Set the address to be written */
- addr = BIT (31 - dev) | (where & ~3);
- non_prefetch_write (addr, byteEnables | NP_CMD_CONFIGWRITE, ldata);
-
- return (OK);
-}
-
-int pci_write_config_dword (pci_dev_t dev, int where, unsigned int val)
-{
- unsigned int addr;
-
- /*address bits 31:28 specify the device 10:8 specify the function */
- /*Set the address to be written */
- addr = BIT (31 - dev) | (where & ~3);
- non_prefetch_write (addr, NP_CMD_CONFIGWRITE, val);
-
- return (OK);
-}
-
-void non_prefetch_read (unsigned int addr,
- unsigned int cmd, unsigned int *data)
-{
- REG_WRITE (PCI_CSR_BASE, PCI_NP_AD_OFFSET, addr);
-
- /*set up and execute the read */
- REG_WRITE (PCI_CSR_BASE, PCI_NP_CBE_OFFSET, cmd);
-
- /*The result of the read is now in np_rdata */
- REG_READ (PCI_CSR_BASE, PCI_NP_RDATA_OFFSET, *data);
-
- return;
-}
-
-void non_prefetch_write (unsigned int addr,
- unsigned int cmd, unsigned int data)
-{
-
- REG_WRITE (PCI_CSR_BASE, PCI_NP_AD_OFFSET, addr);
- /*set up the write */
- REG_WRITE (PCI_CSR_BASE, PCI_NP_CBE_OFFSET, cmd);
- /*Execute the write by writing to NP_WDATA */
- REG_WRITE (PCI_CSR_BASE, PCI_NP_WDATA_OFFSET, data);
-
- return;
-}
-
-/*
- * PCI controller config registers are accessed through these functions
- * i.e. these allow us to set up our own BARs etc.
- */
-void crp_read (unsigned int offset, unsigned int *data)
-{
- REG_WRITE (PCI_CSR_BASE, PCI_CRP_AD_CBE_OFFSET, offset);
- REG_READ (PCI_CSR_BASE, PCI_CRP_RDATA_OFFSET, *data);
-}
-
-void crp_write (unsigned int offset, unsigned int data)
-{
- /*The CRP address register bit 16 indicates that we want to do a write */
- REG_WRITE (PCI_CSR_BASE, PCI_CRP_AD_CBE_OFFSET,
- PCI_CRP_WRITE | offset);
- REG_WRITE (PCI_CSR_BASE, PCI_CRP_WDATA_OFFSET, data);
-}
-
-/*struct pci_controller *hose*/
-void pci_ixp_init (struct pci_controller *hose)
-{
- unsigned int regval;
-
- hose->first_busno = 0;
- hose->last_busno = 0x00;
-
- /* System memory space */
- pci_set_region (hose->regions + 0,
- PCI_MEMORY_BUS,
- PCI_MEMORY_PHY, PCI_MEMORY_SIZE, PCI_REGION_MEMORY);
-
- /* PCI memory space */
- pci_set_region (hose->regions + 1,
- PCI_MEM_BUS,
- PCI_MEM_PHY, PCI_MEM_SIZE, PCI_REGION_MEM);
- /* PCI I/O space */
- pci_set_region (hose->regions + 2,
- PCI_IO_BUS, PCI_IO_PHY, PCI_IO_SIZE, PCI_REGION_IO);
-
- hose->region_count = 3;
-
- pci_register_hose (hose);
-
-/*
- ==========================================================
- Init IXP PCI
- ==========================================================
-*/
- REG_READ (PCI_CSR_BASE, PCI_CSR_OFFSET, regval);
- regval |= 1 << 2;
- REG_WRITE (PCI_CSR_BASE, PCI_CSR_OFFSET, regval);
-
- configure_pins ();
-
- READ_GPIO_REG (IXP425_GPIO_GPOUTR, regval);
- WRITE_GPIO_REG (IXP425_GPIO_GPOUTR, regval & (~(1 << 13)));
- udelay (533);
- sys_pci_gpio_clock_config ();
- REG_WRITE (PCI_CSR_BASE, PCI_INTEN_OFFSET, 0);
- udelay (100);
- READ_GPIO_REG (IXP425_GPIO_GPOUTR, regval);
- WRITE_GPIO_REG (IXP425_GPIO_GPOUTR, regval | (1 << 13));
- udelay (533);
- crp_write (PCI_CFG_BASE_ADDRESS_0, IXP425_PCI_BAR_0_DEFAULT);
- crp_write (PCI_CFG_BASE_ADDRESS_1, IXP425_PCI_BAR_1_DEFAULT);
- crp_write (PCI_CFG_BASE_ADDRESS_2, IXP425_PCI_BAR_2_DEFAULT);
- crp_write (PCI_CFG_BASE_ADDRESS_3, IXP425_PCI_BAR_3_DEFAULT);
- crp_write (PCI_CFG_BASE_ADDRESS_4, IXP425_PCI_BAR_4_DEFAULT);
- crp_write (PCI_CFG_BASE_ADDRESS_5, IXP425_PCI_BAR_5_DEFAULT);
- /*Setup PCI-AHB and AHB-PCI address mappings */
- REG_WRITE (PCI_CSR_BASE, PCI_AHBMEMBASE_OFFSET,
- IXP425_PCI_AHBMEMBASE_DEFAULT);
-
- REG_WRITE (PCI_CSR_BASE, PCI_AHBIOBASE_OFFSET,
- IXP425_PCI_AHBIOBASE_DEFAULT);
-
- REG_WRITE (PCI_CSR_BASE, PCI_PCIMEMBASE_OFFSET,
- IXP425_PCI_PCIMEMBASE_DEFAULT);
-
- crp_write (PCI_CFG_SUB_VENDOR_ID, IXP425_PCI_SUB_VENDOR_SYSTEM);
-
- REG_READ (PCI_CSR_BASE, PCI_CSR_OFFSET, regval);
- regval |= PCI_CSR_IC | PCI_CSR_ABE | PCI_CSR_PDS;
- REG_WRITE (PCI_CSR_BASE, PCI_CSR_OFFSET, regval);
- crp_write (PCI_CFG_COMMAND, PCI_CFG_CMD_MAE | PCI_CFG_CMD_BME);
- udelay (1000);
-
- pci_write_config_word (0, PCI_CFG_COMMAND, INITIAL_PCI_CMD);
- REG_WRITE (PCI_CSR_BASE, PCI_ISR_OFFSET, PCI_ISR_PSE
- | PCI_ISR_PFE | PCI_ISR_PPE | PCI_ISR_AHBE);
-#ifdef CONFIG_PCI_SCAN_SHOW
- printf ("Device bus dev func deviceID vendorID \n");
-#endif
- pci_bus_scan ();
-}
-
-void configure_pins (void)
-{
- unsigned int regval;
-
- /* Disable clock on GPIO PIN 14 */
- READ_GPIO_REG (IXP425_GPIO_GPCLKR, regval);
- WRITE_GPIO_REG (IXP425_GPIO_GPCLKR, regval & (~(1 << 8)));
- READ_GPIO_REG (IXP425_GPIO_GPCLKR, regval);
-
- READ_GPIO_REG (IXP425_GPIO_GPOER, regval);
- WRITE_GPIO_REG (IXP425_GPIO_GPOER,
- (((~(3 << 13)) & regval) | (0xf << 8)));
- READ_GPIO_REG (IXP425_GPIO_GPOER, regval);
-
- READ_GPIO_REG (IXP425_GPIO_GPIT2R, regval);
- WRITE_GPIO_REG (IXP425_GPIO_GPIT2R,
- (regval &
- ((0x1 << 9) | (0x1 << 6) | (0x1 << 3) | 0x1)));
- READ_GPIO_REG (IXP425_GPIO_GPIT2R, regval);
-
- READ_GPIO_REG (IXP425_GPIO_GPISR, regval);
- WRITE_GPIO_REG (IXP425_GPIO_GPISR, (regval | (0xf << 8)));
- READ_GPIO_REG (IXP425_GPIO_GPISR, regval);
-}
-
-void sys_pci_gpio_clock_config (void)
-{
- unsigned int regval;
-
- READ_GPIO_REG (IXP425_GPIO_GPCLKR, regval);
- regval |= 0x1 << 4;
- WRITE_GPIO_REG (IXP425_GPIO_GPCLKR, regval);
- READ_GPIO_REG (IXP425_GPIO_GPCLKR, regval);
- regval |= 0x1 << 8;
- WRITE_GPIO_REG (IXP425_GPIO_GPCLKR, regval);
-}
-
-void pci_bus_scan (void)
-{
- unsigned int bus = 0, dev, func = 0;
- unsigned short data16;
- unsigned int data32;
- unsigned char intPin;
-
- /* Assign first device to ourselves */
- devices[0].bus = 0;
- devices[0].device = 0;
- devices[0].func = 0;
-
- crp_read (PCI_CFG_VENDOR_ID, &data32);
-
- devices[0].vendor_id = data32 & IXP425_PCI_BOTTOM_WORD_OF_LONG_MASK;
- devices[0].device_id = data32 >> 16;
- devices[0].error = FALSE;
- devices[0].bar[NO_BAR].size = 0; /*dummy - required */
-
- nDevices = 1;
-
- nMBars = 0;
- nIOBars = 0;
-
- for (dev = 0; dev < IXP425_PCI_MAX_DEV; dev++) {
-
- /*Check whether a device is present */
- if (pci_device_exists (dev) != TRUE) {
-
- /*Clear error bits in ISR, write 1 to clear */
- REG_WRITE (PCI_CSR_BASE, PCI_ISR_OFFSET, PCI_ISR_PSE
- | PCI_ISR_PFE | PCI_ISR_PPE |
- PCI_ISR_AHBE);
- continue;
- }
-
- /*A device is present, add an entry to the array */
- devices[nDevices].bus = bus;
- devices[nDevices].device = dev;
- devices[nDevices].func = func;
-
- pci_read_config_word (dev, PCI_CFG_VENDOR_ID, &data16);
-
- devices[nDevices].vendor_id = data16;
-
- pci_read_config_word (dev, PCI_CFG_DEVICE_ID, &data16);
- devices[nDevices].device_id = data16;
-
- /*The device is functioning correctly, set error to FALSE */
- devices[nDevices].error = FALSE;
-
- /*Figure out what BARs are on this device */
- sys_pci_bar_info_get (nDevices, bus, dev, func);
- /*Figure out what INTX# line the card uses */
- pci_read_config_byte (dev, PCI_CFG_DEV_INT_PIN, &intPin);
-
- /*assign the appropriate irq line */
- if (intPin > PCI_IRQ_LINES) {
- devices[nDevices].error = TRUE;
- } else if (intPin != 0) {
- /*This device uses an interrupt line */
- /*devices[nDevices].irq = ixp425PciIntTranslate[dev][intPin-1]; */
- devices[nDevices].irq = intPin;
- }
-#ifdef CONFIG_PCI_SCAN_SHOW
- printf ("%06d %03d %03d %04d %08d %08x\n", nDevices,
- devices[nDevices].vendor_id);
-#endif
- nDevices++;
-
- }
-
- calc_bars (memBars, nMBars, IXP425_PCI_BAR_MEM_BASE);
- sys_pci_device_bars_write ();
-
- REG_WRITE (PCI_CSR_BASE, PCI_ISR_OFFSET, PCI_ISR_PSE
- | PCI_ISR_PFE | PCI_ISR_PPE | PCI_ISR_AHBE);
-}
-
-void sys_pci_bar_info_get (unsigned int devnum,
- unsigned int bus,
- unsigned int dev, unsigned int func)
-{
- unsigned int data32;
- unsigned int tmp;
- unsigned int size;
-
- pci_write_config_dword (devnum,
- PCI_CFG_BASE_ADDRESS_0, IXP425_PCI_BAR_QUERY);
- pci_read_config_dword (devnum, PCI_CFG_BASE_ADDRESS_0, &data32);
-
- devices[devnum].bar[0].address = (data32 & 1);
-
- if (data32 & 1) {
- /* IO space */
- tmp = data32 & ~0x3;
- size = ~(tmp - 1);
- devices[devnum].bar[0].size = size;
-
- if (nIOBars < IXP425_PCI_MAX_BAR) {
- ioBars[nIOBars++] = &devices[devnum].bar[0];
- }
- } else {
- /* Mem space */
- tmp = data32 & ~IXP425_PCI_BOTTOM_NIBBLE_OF_LONG_MASK;
- size = ~(tmp - 1);
- devices[devnum].bar[0].size = size;
-
- if (nMBars < IXP425_PCI_MAX_BAR) {
- memBars[nMBars++] = &devices[devnum].bar[0];
- } else {
- devices[devnum].error = TRUE;
- }
-
- }
-
- devices[devnum].bar[1].size = 0;
-}
-
-void sortBars (PciBar * Bars[], unsigned int nBars)
-{
- unsigned int i, j;
- PciBar *tmp;
-
- if (nBars == 0) {
- return;
- }
-
- /* Sort biggest to smallest */
- for (i = 0; i < nBars - 1; i++) {
- for (j = i + 1; j < nBars; j++) {
- if (Bars[j]->size > Bars[i]->size) {
- /* swap them */
- tmp = Bars[i];
- Bars[i] = Bars[j];
- Bars[j] = tmp;
- }
- }
- }
-}
-
-void calc_bars (PciBar * Bars[], unsigned int nBars, unsigned int startAddr)
-{
- unsigned int i;
-
- if (nBars == 0) {
- return;
- }
-
- for (i = 0; i < nBars; i++) {
- Bars[i]->address |= startAddr;
- startAddr += Bars[i]->size;
- }
-}
-
-void sys_pci_device_bars_write (void)
-{
- unsigned int i;
- int addr;
-
- for (i = 1; i < nDevices; i++) {
- if (devices[i].error) {
- continue;
- }
-
- pci_write_config_dword (devices[i].device,
- PCI_CFG_BASE_ADDRESS_0,
- devices[i].bar[0].address);
- addr = BIT (31 - devices[i].device) |
- (0 << PCI_NP_AD_FUNCSL) |
- (PCI_CFG_BASE_ADDRESS_0 & ~3);
- pci_write_config_dword (devices[i].device,
- PCI_CFG_DEV_INT_LINE, devices[i].irq);
-
- pci_write_config_word (devices[i].device,
- PCI_CFG_COMMAND, INITIAL_PCI_CMD);
-
- }
-}
-
-
-int pci_device_exists (unsigned int deviceNo)
-{
- unsigned int vendorId;
- unsigned int regval;
-
- pci_read_config_dword (deviceNo, PCI_CFG_VENDOR_ID, &vendorId);
-
- /* There are two ways to find out an empty device.
- * 1. check Master Abort bit after the access.
- * 2. check whether the vendor id read back is 0x0.
- */
- REG_READ (PCI_CSR_BASE, PCI_ISR_OFFSET, regval);
- if ((vendorId != 0x0) && ((regval & PCI_ISR_PFE) == 0)) {
- return TRUE;
- }
- /*no device present, make sure that the master abort bit is reset */
-
- REG_WRITE (PCI_CSR_BASE, PCI_ISR_OFFSET, PCI_ISR_PFE);
- return FALSE;
-}
-
-pci_dev_t pci_find_devices (struct pci_device_id * ids, int devNo)
-{
- unsigned int i;
- unsigned int devdidvid;
- unsigned int didvid;
- unsigned int vendorId, deviceId;
-
- vendorId = ids->vendor;
- deviceId = ids->device;
- didvid = ((deviceId << 16) & IXP425_PCI_TOP_WORD_OF_LONG_MASK) |
- (vendorId & IXP425_PCI_BOTTOM_WORD_OF_LONG_MASK);
-
- for (i = devNo + 1; i < nDevices; i++) {
-
- pci_read_config_dword (devices[i].device, PCI_CFG_VENDOR_ID,
- &devdidvid);
-
- if (devdidvid == didvid) {
- return devices[i].device;
- }
- }
- return -1;
-}
-#endif /* CONFIG_PCI */
diff --git a/cpu/ixp/start.S b/cpu/ixp/start.S
deleted file mode 100644
index a37b307880..0000000000
--- a/cpu/ixp/start.S
+++ /dev/null
@@ -1,519 +0,0 @@
-/* vi: set ts=8 sw=8 noet: */
-/*
- * u-boot - Startup Code for XScale IXP
- *
- * Copyright (C) 2003 Kyle Harris <kharris@nexus-tech.net>
- *
- * Based on startup code example contained in the
- * Intel IXP4xx Programmer's Guide and past u-boot Start.S
- * samples.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <version.h>
-#include <asm/arch/ixp425.h>
-
-#define MMU_Control_M 0x001 /* Enable MMU */
-#define MMU_Control_A 0x002 /* Enable address alignment faults */
-#define MMU_Control_C 0x004 /* Enable cache */
-#define MMU_Control_W 0x008 /* Enable write-buffer */
-#define MMU_Control_P 0x010 /* Compatability: 32 bit code */
-#define MMU_Control_D 0x020 /* Compatability: 32 bit data */
-#define MMU_Control_L 0x040 /* Compatability: */
-#define MMU_Control_B 0x080 /* Enable Big-Endian */
-#define MMU_Control_S 0x100 /* Enable system protection */
-#define MMU_Control_R 0x200 /* Enable ROM protection */
-#define MMU_Control_I 0x1000 /* Enable Instruction cache */
-#define MMU_Control_X 0x2000 /* Set interrupt vectors at 0xFFFF0000 */
-#define MMU_Control_Init (MMU_Control_P|MMU_Control_D|MMU_Control_L)
-
-
-/*
- * Macro definitions
- */
- /* Delay a bit */
- .macro DELAY_FOR cycles, reg0
- ldr \reg0, =\cycles
- subs \reg0, \reg0, #1
- subne pc, pc, #0xc
- .endm
-
- /* wait for coprocessor write complete */
- .macro CPWAIT reg
- mrc p15,0,\reg,c2,c0,0
- mov \reg,\reg
- sub pc,pc,#4
- .endm
-
-.globl _start
-_start: b reset
- ldr pc, _undefined_instruction
- ldr pc, _software_interrupt
- ldr pc, _prefetch_abort
- ldr pc, _data_abort
- ldr pc, _not_used
- ldr pc, _irq
- ldr pc, _fiq
-
-_undefined_instruction: .word undefined_instruction
-_software_interrupt: .word software_interrupt
-_prefetch_abort: .word prefetch_abort
-_data_abort: .word data_abort
-_not_used: .word not_used
-_irq: .word irq
-_fiq: .word fiq
-
- .balignl 16,0xdeadbeef
-
-
-/*
- * Startup Code (reset vector)
- *
- * do important init only if we don't start from memory!
- * - relocate armboot to ram
- * - setup stack
- * - jump to second stage
- */
-
-_TEXT_BASE:
- .word TEXT_BASE
-
-.globl _armboot_start
-_armboot_start:
- .word _start
-
-/*
- * These are defined in the board-specific linker script.
- */
-.globl _bss_start
-_bss_start:
- .word __bss_start
-
-.globl _bss_end
-_bss_end:
- .word _end
-
-#ifdef CONFIG_USE_IRQ
-/* IRQ stack memory (calculated at run-time) */
-.globl IRQ_STACK_START
-IRQ_STACK_START:
- .word 0x0badc0de
-
-/* IRQ stack memory (calculated at run-time) */
-.globl FIQ_STACK_START
-FIQ_STACK_START:
- .word 0x0badc0de
-#endif
-
-/****************************************************************************/
-/* */
-/* the actual reset code */
-/* */
-/****************************************************************************/
-
-reset:
- /* disable mmu, set big-endian */
- mov r0, #0xf8
- mcr p15, 0, r0, c1, c0, 0
- CPWAIT r0
-
- /* invalidate I & D caches & BTB */
- mcr p15, 0, r0, c7, c7, 0
- CPWAIT r0
-
- /* invalidate I & Data TLB */
- mcr p15, 0, r0, c8, c7, 0
- CPWAIT r0
-
- /* drain write and fill buffers */
- mcr p15, 0, r0, c7, c10, 4
- CPWAIT r0
-
- /* disable write buffer coalescing */
- mrc p15, 0, r0, c1, c0, 1
- orr r0, r0, #1
- mcr p15, 0, r0, c1, c0, 1
- CPWAIT r0
-
- /* set EXP CS0 to the optimum timing */
- ldr r1, =CFG_EXP_CS0
- ldr r2, =IXP425_EXP_CS0
- str r1, [r2]
-
- /* make sure flash is visible at 0 */
- mov r1, #CFG_SDR_CONFIG
- ldr r2, =IXP425_SDR_CONFIG
- str r1, [r2]
-
- /* disable refresh cycles */
- mov r1, #0
- ldr r3, =IXP425_SDR_REFRESH
- str r1, [r3]
-
- /* send nop command */
- mov r1, #3
- ldr r4, =IXP425_SDR_IR
- str r1, [r4]
- DELAY_FOR 0x4000, r0
-
- /* set SDRAM internal refresh val */
- ldr r1, =CFG_SDRAM_REFRESH_CNT
- str r1, [r3]
- DELAY_FOR 0x4000, r0
-
- /* send precharge-all command to close all open banks */
- mov r1, #2
- str r1, [r4]
- DELAY_FOR 0x4000, r0
-
- /* provide 8 auto-refresh cycles */
- mov r1, #4
- mov r5, #8
-111: str r1, [r4]
- DELAY_FOR 0x100, r0
- subs r5, r5, #1
- bne 111b
-
- /* set mode register in sdram */
- mov r1, #CFG_SDR_MODE_CONFIG
- str r1, [r4]
- DELAY_FOR 0x4000, r0
-
- /* send normal operation command */
- mov r1, #6
- str r1, [r4]
- DELAY_FOR 0x4000, r0
-
- /* copy */
- mov r0, #0
- mov r4, r0
- add r2, r0, #CFG_MONITOR_LEN
- mov r1, #0x10000000
- mov r5, r1
-
- 30:
- ldr r3, [r0], #4
- str r3, [r1], #4
- cmp r0, r2
- bne 30b
-
- /* invalidate I & D caches & BTB */
- mcr p15, 0, r0, c7, c7, 0
- CPWAIT r0
-
- /* invalidate I & Data TLB */
- mcr p15, 0, r0, c8, c7, 0
- CPWAIT r0
-
- /* drain write and fill buffers */
- mcr p15, 0, r0, c7, c10, 4
- CPWAIT r0
-
- /* move flash to 0x50000000 */
- ldr r2, =IXP425_EXP_CFG0
- ldr r1, [r2]
- bic r1, r1, #0x80000000
- str r1, [r2]
-
- nop
- nop
- nop
- nop
- nop
- nop
-
- /* invalidate I & Data TLB */
- mcr p15, 0, r0, c8, c7, 0
- CPWAIT r0
-
- /* enable I cache */
- mrc p15, 0, r0, c1, c0, 0
- orr r0, r0, #MMU_Control_I
- mcr p15, 0, r0, c1, c0, 0
- CPWAIT r0
-
- mrs r0,cpsr /* set the cpu to SVC32 mode */
- bic r0,r0,#0x1f /* (superviser mode, M=10011) */
- orr r0,r0,#0x13
- msr cpsr,r0
-
-#ifndef CONFIG_SKIP_RELOCATE_UBOOT
-relocate: /* relocate U-Boot to RAM */
- adr r0, _start /* r0 <- current position of code */
- ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
- cmp r0, r1 /* don't reloc during debug */
- beq stack_setup
-
- ldr r2, _armboot_start
- ldr r3, _bss_start
- sub r2, r3, r2 /* r2 <- size of armboot */
- add r2, r0, r2 /* r2 <- source end address */
-
-copy_loop:
- ldmia r0!, {r3-r10} /* copy from source address [r0] */
- stmia r1!, {r3-r10} /* copy to target address [r1] */
- cmp r0, r2 /* until source end addreee [r2] */
- ble copy_loop
-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
-
- /* Set up the stack */
-stack_setup:
- ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
- sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
- sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
-#ifdef CONFIG_USE_IRQ
- sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
-#endif
- sub sp, r0, #12 /* leave 3 words for abort-stack */
-
-clear_bss:
- ldr r0, _bss_start /* find start of bss segment */
- ldr r1, _bss_end /* stop here */
- mov r2, #0x00000000 /* clear */
-
-clbss_l:str r2, [r0] /* clear loop... */
- add r0, r0, #4
- cmp r0, r1
- ble clbss_l
-
- ldr pc, _start_armboot
-
-_start_armboot: .word start_armboot
-
-
-/****************************************************************************/
-/* */
-/* Interrupt handling */
-/* */
-/****************************************************************************/
-
-/* IRQ stack frame */
-
-#define S_FRAME_SIZE 72
-
-#define S_OLD_R0 68
-#define S_PSR 64
-#define S_PC 60
-#define S_LR 56
-#define S_SP 52
-
-#define S_IP 48
-#define S_FP 44
-#define S_R10 40
-#define S_R9 36
-#define S_R8 32
-#define S_R7 28
-#define S_R6 24
-#define S_R5 20
-#define S_R4 16
-#define S_R3 12
-#define S_R2 8
-#define S_R1 4
-#define S_R0 0
-
-#define MODE_SVC 0x13
-
- /* use bad_save_user_regs for abort/prefetch/undef/swi ... */
-
- .macro bad_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} /* Calling r0-r12 */
- add r8, sp, #S_PC
-
- ldr r2, _armboot_start
- sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
- ldmia r2, {r2 - r4} /* get pc, cpsr, old_r0 */
- add r0, sp, #S_FRAME_SIZE /* restore sp_SVC */
-
- add r5, sp, #S_SP
- mov r1, lr
- stmia r5, {r0 - r4} /* save sp_SVC, lr_SVC, pc, cpsr, old_r */
- mov r0, sp
- .endm
-
-
- /* use irq_save_user_regs / irq_restore_user_regs for */
- /* IRQ/FIQ handling */
-
- .macro irq_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} /* Calling r0-r12 */
- add r8, sp, #S_PC
- stmdb r8, {sp, lr}^ /* Calling SP, LR */
- str lr, [r8, #0] /* Save calling PC */
- mrs r6, spsr
- str r6, [r8, #4] /* Save CPSR */
- str r0, [r8, #8] /* Save OLD_R0 */
- mov r0, sp
- .endm
-
- .macro irq_restore_user_regs
- ldmia sp, {r0 - lr}^ @ Calling r0 - lr
- mov r0, r0
- ldr lr, [sp, #S_PC] @ Get PC
- add sp, sp, #S_FRAME_SIZE
- subs pc, lr, #4 @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_bad_stack
- ldr r13, _armboot_start @ setup our mode stack
- sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
-
- str lr, [r13] @ save caller lr / spsr
- mrs lr, spsr
- str lr, [r13, #4]
-
- mov r13, #MODE_SVC @ prepare SVC-Mode
- msr spsr_c, r13
- mov lr, pc
- movs pc, lr
- .endm
-
- .macro get_irq_stack @ setup IRQ stack
- ldr sp, IRQ_STACK_START
- .endm
-
- .macro get_fiq_stack @ setup FIQ stack
- ldr sp, FIQ_STACK_START
- .endm
-
-
-/****************************************************************************/
-/* */
-/* exception handlers */
-/* */
-/****************************************************************************/
-
- .align 5
-undefined_instruction:
- get_bad_stack
- bad_save_user_regs
- bl do_undefined_instruction
-
- .align 5
-software_interrupt:
- get_bad_stack
- bad_save_user_regs
- bl do_software_interrupt
-
- .align 5
-prefetch_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_prefetch_abort
-
- .align 5
-data_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_data_abort
-
- .align 5
-not_used:
- get_bad_stack
- bad_save_user_regs
- bl do_not_used
-
-#ifdef CONFIG_USE_IRQ
-
- .align 5
-irq:
- get_irq_stack
- irq_save_user_regs
- bl do_irq
- irq_restore_user_regs
-
- .align 5
-fiq:
- get_fiq_stack
- irq_save_user_regs /* someone ought to write a more */
- bl do_fiq /* effiction fiq_save_user_regs */
- irq_restore_user_regs
-
-#else
-
- .align 5
-irq:
- get_bad_stack
- bad_save_user_regs
- bl do_irq
-
- .align 5
-fiq:
- get_bad_stack
- bad_save_user_regs
- bl do_fiq
-
-#endif
-
-/****************************************************************************/
-/* */
-/* Reset function: Use Watchdog to reset */
-/* */
-/****************************************************************************/
-
- .align 5
-.globl reset_cpu
-
-reset_cpu:
- ldr r1, =0x482e
- ldr r2, =IXP425_OSWK
- str r1, [r2]
- ldr r1, =0x0fff
- ldr r2, =IXP425_OSWT
- str r1, [r2]
- ldr r1, =0x5
- ldr r2, =IXP425_OSWE
- str r1, [r2]
- b reset_endless
-
-
-reset_endless:
-
- b reset_endless
-
-#ifdef CONFIG_USE_IRQ
-
-.LC0: .word loops_per_jiffy
-
-/*
- * 0 <= r0 <= 2000
- */
-.globl udelay
-udelay:
- mov r2, #0x6800
- orr r2, r2, #0x00db
- mul r0, r2, r0
- ldr r2, .LC0
- ldr r2, [r2] @ max = 0x0fffffff
- mov r0, r0, lsr #11 @ max = 0x00003fff
- mov r2, r2, lsr #11 @ max = 0x0003ffff
- mul r0, r2, r0 @ max = 2^32-1
- movs r0, r0, lsr #6
-
-delay_loop:
- subs r0, r0, #1
- bne delay_loop
- mov pc, lr
-
-#endif /* CONFIG_USE_IRQ */
diff --git a/cpu/ixp/timer.c b/cpu/ixp/timer.c
deleted file mode 100644
index 665f9a7f78..0000000000
--- a/cpu/ixp/timer.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * (C) Copyright 2006
- * Stefan Roese, DENX Software Engineering, sr@denx.de.
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/arch/ixp425.h>
-
-#ifndef CONFIG_USE_IRQ
-ulong get_timer (ulong base)
-{
- return get_timer_masked () - base;
-}
-
-void ixp425_udelay(unsigned long usec)
-{
- /*
- * This function has a max usec, but since it is called from udelay
- * we should not have to worry... be happy
- */
- unsigned long usecs = CFG_HZ/1000000L & ~IXP425_OST_RELOAD_MASK;
-
- *IXP425_OSST = IXP425_OSST_TIMER_1_PEND;
- usecs |= IXP425_OST_ONE_SHOT | IXP425_OST_ENABLE;
- *IXP425_OSRT1 = usecs;
- while (!(*IXP425_OSST & IXP425_OSST_TIMER_1_PEND));
-}
-
-static ulong reload_constant = 0xfffffff0;
-
-void reset_timer_masked (void)
-{
- ulong reload = reload_constant | IXP425_OST_ONE_SHOT | IXP425_OST_ENABLE;
-
- *IXP425_OSST = IXP425_OSST_TIMER_1_PEND;
- *IXP425_OSRT1 = reload;
-}
-
-ulong get_timer_masked (void)
-{
- /*
- * Note that it is possible for this to wrap!
- * In this case we return max.
- */
- ulong current = *IXP425_OST1;
- if (*IXP425_OSST & IXP425_OSST_TIMER_1_PEND)
- {
- return reload_constant;
- }
- return (reload_constant - current);
-}
-#endif /* #ifndef CONFIG_USE_IRQ */
diff --git a/cpu/lh7a40x/Makefile b/cpu/lh7a40x/Makefile
deleted file mode 100644
index bac2a640cb..0000000000
--- a/cpu/lh7a40x/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = cpu.o speed.o interrupts.o serial.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/lh7a40x/config.mk b/cpu/lh7a40x/config.mk
deleted file mode 100644
index 10e755bebe..0000000000
--- a/cpu/lh7a40x/config.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# (C) Copyright 2002
-# Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \
- -msoft-float
-
-PLATFORM_CPPFLAGS += -march=armv4
-# =========================================================================
-#
-# Supply options according to compiler version
-#
-# ========================================================================
-PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
diff --git a/cpu/lh7a40x/cpu.c b/cpu/lh7a40x/cpu.c
deleted file mode 100644
index 578eb73e8e..0000000000
--- a/cpu/lh7a40x/cpu.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * CPU specific code
- */
-
-#include <common.h>
-#include <command.h>
-#include <arm920t.h>
-
-#ifdef CONFIG_USE_IRQ
-DECLARE_GLOBAL_DATA_PTR;
-#endif
-
-/* read co-processor 15, register #1 (control register) */
-static unsigned long read_p15_c1 (void)
-{
- unsigned long value;
-
- __asm__ __volatile__(
- "mrc p15, 0, %0, c1, c0, 0 @ read control reg\n"
- : "=r" (value)
- :
- : "memory");
-
-#ifdef MMU_DEBUG
- printf ("p15/c1 is = %08lx\n", value);
-#endif
- return value;
-}
-
-/* write to co-processor 15, register #1 (control register) */
-static void write_p15_c1 (unsigned long value)
-{
-#ifdef MMU_DEBUG
- printf ("write %08lx to p15/c1\n", value);
-#endif
- __asm__ __volatile__(
- "mcr p15, 0, %0, c1, c0, 0 @ write it back\n"
- :
- : "r" (value)
- : "memory");
-
- read_p15_c1 ();
-}
-
-static void cp_delay (void)
-{
- volatile int i;
-
- /* copro seems to need some delay between reading and writing */
- for (i = 0; i < 100; i++);
-}
-
-/* See also ARM Ref. Man. */
-#define C1_MMU (1<<0) /* mmu off/on */
-#define C1_ALIGN (1<<1) /* alignment faults off/on */
-#define C1_DC (1<<2) /* dcache off/on */
-#define C1_BIG_ENDIAN (1<<7) /* big endian off/on */
-#define C1_SYS_PROT (1<<8) /* system protection */
-#define C1_ROM_PROT (1<<9) /* ROM protection */
-#define C1_IC (1<<12) /* icache off/on */
-#define C1_HIGH_VECTORS (1<<13) /* location of vectors: low/high addresses */
-#define RESERVED_1 (0xf << 3) /* must be 111b for R/W */
-
-int cpu_init (void)
-{
- /*
- * setup up stacks if necessary
- */
-#ifdef CONFIG_USE_IRQ
- IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
- FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
-#endif
- return 0;
-}
-
-int cleanup_before_linux (void)
-{
- /*
- * this function is called just before we call linux
- * it prepares the processor for linux
- *
- * we turn off caches etc ...
- */
-
- unsigned long i;
-
- disable_interrupts ();
-
- /* turn off I/D-cache */
- asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
- i &= ~(C1_DC | C1_IC);
- asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
-
- /* flush I/D-cache */
- i = 0;
- asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));
- return (0);
-}
-
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- disable_interrupts ();
- reset_cpu (0);
- /*NOTREACHED*/
- return (0);
-}
-
-void icache_enable (void)
-{
- ulong reg;
-
- reg = read_p15_c1 ();
- cp_delay ();
- write_p15_c1 (reg | C1_IC);
-}
-
-void icache_disable (void)
-{
- ulong reg;
-
- reg = read_p15_c1 ();
- cp_delay ();
- write_p15_c1 (reg & ~C1_IC);
-}
-
-int icache_status (void)
-{
- return (read_p15_c1 () & C1_IC) != 0;
-}
-
-#ifdef USE_920T_MMU
-/* It makes no sense to use the dcache if the MMU is not enabled */
-void dcache_enable (void)
-{
- ulong reg;
-
- reg = read_p15_c1 ();
- cp_delay ();
- write_p15_c1 (reg | C1_DC);
-}
-
-void dcache_disable (void)
-{
- ulong reg;
-
- reg = read_p15_c1 ();
- cp_delay ();
- reg &= ~C1_DC;
- write_p15_c1 (reg);
-}
-
-int dcache_status (void)
-{
- return (read_p15_c1 () & C1_DC) != 0;
-}
-#endif
diff --git a/cpu/lh7a40x/interrupts.c b/cpu/lh7a40x/interrupts.c
deleted file mode 100644
index 0699393706..0000000000
--- a/cpu/lh7a40x/interrupts.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * (C) Copyright 2002
- * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <arm920t.h>
-#include <lh7a40x.h>
-
-#include <asm/proc-armv/ptrace.h>
-
-static ulong timer_load_val = 0;
-
-/* macro to read the 16 bit timer */
-static inline ulong READ_TIMER(void)
-{
- lh7a40x_timers_t* timers = LH7A40X_TIMERS_PTR;
- lh7a40x_timer_t* timer = &timers->timer1;
-
- return (timer->value & 0x0000ffff);
-}
-
-#ifdef CONFIG_USE_IRQ
-/* enable IRQ interrupts */
-void enable_interrupts (void)
-{
- unsigned long temp;
- __asm__ __volatile__("mrs %0, cpsr\n"
- "bic %0, %0, #0x80\n"
- "msr cpsr_c, %0"
- : "=r" (temp)
- :
- : "memory");
-}
-
-
-/*
- * disable IRQ/FIQ interrupts
- * returns true if interrupts had been enabled before we disabled them
- */
-int disable_interrupts (void)
-{
- unsigned long old,temp;
- __asm__ __volatile__("mrs %0, cpsr\n"
- "orr %1, %0, #0xc0\n"
- "msr cpsr_c, %1"
- : "=r" (old), "=r" (temp)
- :
- : "memory");
- return (old & 0x80) == 0;
-}
-#else
-void enable_interrupts (void)
-{
- return;
-}
-int disable_interrupts (void)
-{
- return 0;
-}
-#endif
-
-
-void bad_mode (void)
-{
- panic ("Resetting CPU ...\n");
- reset_cpu (0);
-}
-
-void show_regs (struct pt_regs *regs)
-{
- unsigned long flags;
- const char *processor_modes[] = {
- "USER_26", "FIQ_26", "IRQ_26", "SVC_26",
- "UK4_26", "UK5_26", "UK6_26", "UK7_26",
- "UK8_26", "UK9_26", "UK10_26", "UK11_26",
- "UK12_26", "UK13_26", "UK14_26", "UK15_26",
- "USER_32", "FIQ_32", "IRQ_32", "SVC_32",
- "UK4_32", "UK5_32", "UK6_32", "ABT_32",
- "UK8_32", "UK9_32", "UK10_32", "UND_32",
- "UK12_32", "UK13_32", "UK14_32", "SYS_32",
- };
-
- flags = condition_codes (regs);
-
- printf ("pc : [<%08lx>] lr : [<%08lx>]\n"
- "sp : %08lx ip : %08lx fp : %08lx\n",
- instruction_pointer (regs),
- regs->ARM_lr, regs->ARM_sp, regs->ARM_ip, regs->ARM_fp);
- printf ("r10: %08lx r9 : %08lx r8 : %08lx\n",
- regs->ARM_r10, regs->ARM_r9, regs->ARM_r8);
- printf ("r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n",
- regs->ARM_r7, regs->ARM_r6, regs->ARM_r5, regs->ARM_r4);
- printf ("r3 : %08lx r2 : %08lx r1 : %08lx r0 : %08lx\n",
- regs->ARM_r3, regs->ARM_r2, regs->ARM_r1, regs->ARM_r0);
- printf ("Flags: %c%c%c%c",
- flags & CC_N_BIT ? 'N' : 'n',
- flags & CC_Z_BIT ? 'Z' : 'z',
- flags & CC_C_BIT ? 'C' : 'c', flags & CC_V_BIT ? 'V' : 'v');
- printf (" IRQs %s FIQs %s Mode %s%s\n",
- interrupts_enabled (regs) ? "on" : "off",
- fast_interrupts_enabled (regs) ? "on" : "off",
- processor_modes[processor_mode (regs)],
- thumb_mode (regs) ? " (T)" : "");
-}
-
-void do_undefined_instruction (struct pt_regs *pt_regs)
-{
- printf ("undefined instruction\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_software_interrupt (struct pt_regs *pt_regs)
-{
- printf ("software interrupt\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_prefetch_abort (struct pt_regs *pt_regs)
-{
- printf ("prefetch abort\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_data_abort (struct pt_regs *pt_regs)
-{
- printf ("data abort\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_not_used (struct pt_regs *pt_regs)
-{
- printf ("not used\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_fiq (struct pt_regs *pt_regs)
-{
- printf ("fast interrupt request\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_irq (struct pt_regs *pt_regs)
-{
- printf ("interrupt request\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-static ulong timestamp;
-static ulong lastdec;
-
-int interrupt_init (void)
-{
- lh7a40x_timers_t* timers = LH7A40X_TIMERS_PTR;
- lh7a40x_timer_t* timer = &timers->timer1;
-
- /* a periodic timer using the 508kHz source */
- timer->control = (TIMER_PER | TIMER_CLK508K);
-
- if (timer_load_val == 0) {
- /*
- * 10ms period with 508.469kHz clock = 5084
- */
- timer_load_val = CFG_HZ/100;
- }
-
- /* load value for 10 ms timeout */
- lastdec = timer->load = timer_load_val;
-
- /* auto load, start timer */
- timer->control = timer->control | TIMER_EN;
- timestamp = 0;
-
- return (0);
-}
-
-/*
- * timer without interrupts
- */
-
-void reset_timer (void)
-{
- reset_timer_masked ();
-}
-
-ulong get_timer (ulong base)
-{
- return (get_timer_masked() - base);
-}
-
-void set_timer (ulong t)
-{
- timestamp = t;
-}
-
-void reset_timer_masked (void)
-{
- /* reset time */
- lastdec = READ_TIMER();
- timestamp = 0;
-}
-
-ulong get_timer_masked (void)
-{
- ulong now = READ_TIMER();
-
- if (lastdec >= now) {
- /* normal mode */
- timestamp += (lastdec - now);
- } else {
- /* we have an overflow ... */
- timestamp += ((lastdec + timer_load_val) - now);
- }
- lastdec = now;
-
- return timestamp;
-}
diff --git a/cpu/lh7a40x/speed.c b/cpu/lh7a40x/speed.c
deleted file mode 100644
index 333ebb504a..0000000000
--- a/cpu/lh7a40x/speed.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * (C) Copyright 2001-2004
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2002
- * David Mueller, ELSOFT AG, d.mueller@elsoft.ch
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <lh7a40x.h>
-
-
-/* ------------------------------------------------------------------------- */
-/* NOTE: This describes the proper use of this file.
- *
- * CONFIG_SYS_CLK_FREQ should be defined as the input frequency of the PLL.
- *
- * get_FCLK(), get_HCLK(), get_PCLK() return the clock of
- * the specified bus in HZ.
- */
-/* ------------------------------------------------------------------------- */
-
-ulong get_PLLCLK (void)
-{
- return CONFIG_SYS_CLK_FREQ;
-}
-
-/* return FCLK frequency */
-ulong get_FCLK (void)
-{
- lh7a40x_csc_t* csc = LH7A40X_CSC_PTR;
- ulong maindiv1, maindiv2, prediv, ps;
-
- /*
- * from userguide 6.1.1.2
- *
- * FCLK = ((MAINDIV1 +2) * (MAINDIV2 +2) * 14.7456MHz) /
- * ((PREDIV+2) * (2^PS))
- */
- maindiv2 = (csc->clkset & CLKSET_MAINDIV2) >> 11;
- maindiv1 = (csc->clkset & CLKSET_MAINDIV1) >> 7;
- prediv = (csc->clkset & CLKSET_PREDIV) >> 2;
- ps = (csc->clkset & CLKSET_PS) >> 16;
-
- return (((maindiv2 + 2) * (maindiv1 + 2) * CONFIG_SYS_CLK_FREQ) /
- ((prediv + 2) * (1 << ps)));
-}
-
-
-/* return HCLK frequency */
-ulong get_HCLK (void)
-{
- lh7a40x_csc_t* csc = LH7A40X_CSC_PTR;
-
- return (get_FCLK () / ((csc->clkset & CLKSET_HCLKDIV) + 1));
-}
-
-/* return PCLK frequency */
-ulong get_PCLK (void)
-{
- lh7a40x_csc_t* csc = LH7A40X_CSC_PTR;
-
- return (get_HCLK () /
- (1 << (((csc->clkset & CLKSET_PCLKDIV) >> 16) + 1)));
-}
diff --git a/cpu/lh7a40x/start.S b/cpu/lh7a40x/start.S
deleted file mode 100644
index fb748cffc6..0000000000
--- a/cpu/lh7a40x/start.S
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * armboot - Startup Code for ARM920 CPU-core
- *
- * Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
- * Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
- * Copyright (c) 2002 Gary Jennejohn <gj@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-
-
-/*
- *************************************************************************
- *
- * Jump vector table as in table 3.1 in [1]
- *
- *************************************************************************
- */
-
-
-.globl _start
-_start: b reset
- ldr pc, _undefined_instruction
- ldr pc, _software_interrupt
- ldr pc, _prefetch_abort
- ldr pc, _data_abort
- ldr pc, _not_used
- ldr pc, _irq
- ldr pc, _fiq
-
-_undefined_instruction: .word undefined_instruction
-_software_interrupt: .word software_interrupt
-_prefetch_abort: .word prefetch_abort
-_data_abort: .word data_abort
-_not_used: .word not_used
-_irq: .word irq
-_fiq: .word fiq
-
- .balignl 16,0xdeadbeef
-
-
-/*
- *************************************************************************
- *
- * Startup Code (reset vector)
- *
- * do important init only if we don't start from memory!
- * relocate armboot to ram
- * setup stack
- * jump to second stage
- *
- *************************************************************************
- */
-
-_TEXT_BASE:
- .word TEXT_BASE
-
-.globl _armboot_start
-_armboot_start:
- .word _start
-
-/*
- * These are defined in the board-specific linker script.
- */
-.globl _bss_start
-_bss_start:
- .word __bss_start
-
-.globl _bss_end
-_bss_end:
- .word _end
-
-#ifdef CONFIG_USE_IRQ
-/* IRQ stack memory (calculated at run-time) */
-.globl IRQ_STACK_START
-IRQ_STACK_START:
- .word 0x0badc0de
-
-/* IRQ stack memory (calculated at run-time) */
-.globl FIQ_STACK_START
-FIQ_STACK_START:
- .word 0x0badc0de
-#endif
-
-
-/*
- * the actual reset code
- */
-
-reset:
- /*
- * set the cpu to SVC32 mode
- */
- mrs r0,cpsr
- bic r0,r0,#0x1f
- orr r0,r0,#0xd3
- msr cpsr,r0
-
-#define pWDTCTL 0x80001400 /* Watchdog Timer control register */
-#define pINTENC 0x8000050C /* Interupt-Controller enable clear register */
-#define pCLKSET 0x80000420 /* clock divisor register */
-
- /* disable watchdog, set watchdog control register to
- * all zeros (default reset)
- */
- ldr r0, =pWDTCTL
- mov r1, #0x0
- str r1, [r0]
-
- /*
- * mask all IRQs by setting all bits in the INTENC register (default)
- */
- mov r1, #0xffffffff
- ldr r0, =pINTENC
- str r1, [r0]
-
- /* FCLK:HCLK:PCLK = 1:2:2 */
- /* default FCLK is 200 MHz, using 14.7456 MHz fin */
- ldr r0, =pCLKSET
- ldr r1, =0x0004ee39
-@ ldr r1, =0x0005ee39 @ 1: 2: 4
- str r1, [r0]
-
- /*
- * we do sys-critical inits only at reboot,
- * not when booting from ram!
- */
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
- bl cpu_init_crit
-#endif
-
-#ifndef CONFIG_SKIP_RELOCATE_UBOOT
-relocate: /* relocate U-Boot to RAM */
- adr r0, _start /* r0 <- current position of code */
- ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
- cmp r0, r1 /* don't reloc during debug */
- beq stack_setup
-
- ldr r2, _armboot_start
- ldr r3, _bss_start
- sub r2, r3, r2 /* r2 <- size of armboot */
- add r2, r0, r2 /* r2 <- source end address */
-
-copy_loop:
- ldmia r0!, {r3-r10} /* copy from source address [r0] */
- stmia r1!, {r3-r10} /* copy to target address [r1] */
- cmp r0, r2 /* until source end addreee [r2] */
- blt copy_loop /* a 'ble' here actually copies */
- /* four bytes of bss */
-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
-
- /* Set up the stack */
-stack_setup:
- ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
- sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
- sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
-#ifdef CONFIG_USE_IRQ
- sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
-#endif
- sub sp, r0, #12 /* leave 3 words for abort-stack */
-
-clear_bss:
- ldr r0, _bss_start /* find start of bss segment */
- @add r0, r0, #4 /* start at first byte of bss */
- /* why inc. 4 bytes past then? */
- ldr r1, _bss_end /* stop here */
- mov r2, #0x00000000 /* clear */
-
-clbss_l:str r2, [r0] /* clear loop... */
- add r0, r0, #4
- cmp r0, r1
- ble clbss_l
-
- ldr pc, _start_armboot
-
-_start_armboot: .word start_armboot
-
-
-/*
- *************************************************************************
- *
- * CPU_init_critical registers
- *
- * setup important registers
- * setup memory timing
- *
- *************************************************************************
- */
-
-
-cpu_init_crit:
- /*
- * flush v4 I/D caches
- */
- mov r0, #0
- mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
- mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */
-
- /*
- * disable MMU stuff and caches
- */
- mrc p15, 0, r0, c1, c0, 0
- bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)
- bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM)
- orr r0, r0, #0x00000002 @ set bit 2 (A) Align
- orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
- orr r0, r0, #0x40000000 @ set bit 30 (nF) notFastBus
- mcr p15, 0, r0, c1, c0, 0
-
-
- /*
- * before relocating, we have to setup RAM timing
- * because memory timing is board-dependend, you will
- * find a lowlevel_init.S in your board directory.
- */
- mov ip, lr
- bl lowlevel_init
- mov lr, ip
-
- mov pc, lr
-
-
-/*
- *************************************************************************
- *
- * Interrupt handling
- *
- *************************************************************************
- */
-
-@
-@ IRQ stack frame.
-@
-#define S_FRAME_SIZE 72
-
-#define S_OLD_R0 68
-#define S_PSR 64
-#define S_PC 60
-#define S_LR 56
-#define S_SP 52
-
-#define S_IP 48
-#define S_FP 44
-#define S_R10 40
-#define S_R9 36
-#define S_R8 32
-#define S_R7 28
-#define S_R6 24
-#define S_R5 20
-#define S_R4 16
-#define S_R3 12
-#define S_R2 8
-#define S_R1 4
-#define S_R0 0
-
-#define MODE_SVC 0x13
-#define I_BIT 0x80
-
-/*
- * use bad_save_user_regs for abort/prefetch/undef/swi ...
- * use irq_save_user_regs / irq_restore_user_regs for IRQ/FIQ handling
- */
-
- .macro bad_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Calling r0-r12
- ldr r2, _armboot_start
- sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
- ldmia r2, {r2 - r3} @ get pc, cpsr
- add r0, sp, #S_FRAME_SIZE @ restore sp_SVC
-
- add r5, sp, #S_SP
- mov r1, lr
- stmia r5, {r0 - r3} @ save sp_SVC, lr_SVC, pc, cpsr
- mov r0, sp
- .endm
-
- .macro irq_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Calling r0-r12
- add r8, sp, #S_PC
- stmdb r8, {sp, lr}^ @ Calling SP, LR
- str lr, [r8, #0] @ Save calling PC
- mrs r6, spsr
- str r6, [r8, #4] @ Save CPSR
- str r0, [r8, #8] @ Save OLD_R0
- mov r0, sp
- .endm
-
- .macro irq_restore_user_regs
- ldmia sp, {r0 - lr}^ @ Calling r0 - lr
- mov r0, r0
- ldr lr, [sp, #S_PC] @ Get PC
- add sp, sp, #S_FRAME_SIZE
- subs pc, lr, #4 @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_bad_stack
- ldr r13, _armboot_start @ setup our mode stack
- sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
-
- str lr, [r13] @ save caller lr / spsr
- mrs lr, spsr
- str lr, [r13, #4]
-
- mov r13, #MODE_SVC @ prepare SVC-Mode
- @ msr spsr_c, r13
- msr spsr, r13
- mov lr, pc
- movs pc, lr
- .endm
-
- .macro get_irq_stack @ setup IRQ stack
- ldr sp, IRQ_STACK_START
- .endm
-
- .macro get_fiq_stack @ setup FIQ stack
- ldr sp, FIQ_STACK_START
- .endm
-
-/*
- * exception handlers
- */
- .align 5
-undefined_instruction:
- get_bad_stack
- bad_save_user_regs
- bl do_undefined_instruction
-
- .align 5
-software_interrupt:
- get_bad_stack
- bad_save_user_regs
- bl do_software_interrupt
-
- .align 5
-prefetch_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_prefetch_abort
-
- .align 5
-data_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_data_abort
-
- .align 5
-not_used:
- get_bad_stack
- bad_save_user_regs
- bl do_not_used
-
-#ifdef CONFIG_USE_IRQ
-
- .align 5
-irq:
- get_irq_stack
- irq_save_user_regs
- bl do_irq
- irq_restore_user_regs
-
- .align 5
-fiq:
- get_fiq_stack
- /* someone ought to write a more effiction fiq_save_user_regs */
- irq_save_user_regs
- bl do_fiq
- irq_restore_user_regs
-
-#else
-
- .align 5
-irq:
- get_bad_stack
- bad_save_user_regs
- bl do_irq
-
- .align 5
-fiq:
- get_bad_stack
- bad_save_user_regs
- bl do_fiq
-
-#endif
-
- .align 5
-.globl reset_cpu
-reset_cpu:
- bl disable_interrupts
-
- /* Disable watchdog */
- ldr r1, =pWDTCTL
- mov r3, #0
- str r3, [r1]
-
- /* reset counter */
- ldr r3, =0x00001984
- str r3, [r1, #4]
-
- /* Enable the watchdog */
- mov r3, #1
- str r3, [r1]
-
-_loop_forever:
- b _loop_forever
diff --git a/cpu/mcf52x2/Makefile b/cpu/mcf52x2/Makefile
deleted file mode 100644
index 70d57cf609..0000000000
--- a/cpu/mcf52x2/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-# CFLAGS += -DET_DEBUG
-
-LIB = $(obj)lib$(CPU).a
-
-START =
-COBJS = serial.o interrupts.o cpu.o speed.o cpu_init.o fec.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/mcf52x2/config.mk b/cpu/mcf52x2/config.mk
deleted file mode 100644
index 650db85831..0000000000
--- a/cpu/mcf52x2/config.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# (C) Copyright 2003 Josef Baumgartner <josef.baumgartner@telex.de>
-#
-# (C) Copyright 2000-2004
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -ffixed-d7 -msep-data
-PLATFORM_CPPFLAGS += -m5307
diff --git a/cpu/mcf52x2/cpu.c b/cpu/mcf52x2/cpu.c
deleted file mode 100644
index aa6b2bd670..0000000000
--- a/cpu/mcf52x2/cpu.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * (C) Copyright 2003
- * Josef Baumgartner <josef.baumgartner@telex.de>
- *
- * MCF5282 additionals
- * (C) Copyright 2005
- * BuS Elektronik GmbH & Co. KG <esw@bus-elektronik.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <command.h>
-
-#ifdef CONFIG_M5271
-#include <asm/immap_5271.h>
-#include <asm/m5271.h>
-#endif
-
-#ifdef CONFIG_M5272
-#include <asm/immap_5272.h>
-#include <asm/m5272.h>
-#endif
-
-#ifdef CONFIG_M5282
-#include <asm/m5282.h>
-#include <asm/immap_5282.h>
-#endif
-
-#ifdef CONFIG_M5249
-#include <asm/m5249.h>
-#endif
-
-#ifdef CONFIG_M5271
-int checkcpu (void)
-{
- char buf[32];
-
- printf ("CPU: Freescale Coldfire MCF5271 at %s MHz\n", strmhz(buf, CFG_CLK));
- return 0;
-}
-
-int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) {
- mbar_writeByte(MCF_RCM_RCR,
- MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT);
- return 0;
-};
-
-#if defined(CONFIG_WATCHDOG)
-void watchdog_reset (void)
-{
- mbar_writeShort(MCF_WTM_WSR, 0x5555);
- mbar_writeShort(MCF_WTM_WSR, 0xAAAA);
-}
-
-int watchdog_disable (void)
-{
- mbar_writeShort(MCF_WTM_WCR, 0);
- return (0);
-}
-
-int watchdog_init (void)
-{
- mbar_writeShort(MCF_WTM_WCR, MCF_WTM_WCR_EN);
- return (0);
-}
-#endif /* #ifdef CONFIG_WATCHDOG */
-
-#endif
-
-#ifdef CONFIG_M5272
-int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) {
- volatile wdog_t * wdp = (wdog_t *)(CFG_MBAR + MCFSIM_WRRR);
-
- wdp->wdog_wrrr = 0;
- udelay (1000);
-
- /* enable watchdog, set timeout to 0 and wait */
- wdp->wdog_wrrr = 1;
- while (1);
-
- /* we don't return! */
- return 0;
-};
-
-int checkcpu(void) {
- ulong *dirp = (ulong *)(CFG_MBAR + MCFSIM_DIR);
- uchar msk;
- char *suf;
-
- puts ("CPU: ");
- msk = (*dirp > 28) & 0xf;
- switch (msk) {
- case 0x2: suf = "1K75N"; break;
- case 0x4: suf = "3K75N"; break;
- default:
- suf = NULL;
- printf ("Freescale MCF5272 (Mask:%01x)\n", msk);
- break;
- }
-
- if (suf)
- printf ("Freescale MCF5272 %s\n", suf);
- return 0;
-};
-
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset (void)
-{
- volatile immap_t * regp = (volatile immap_t *)CFG_MBAR;
- regp->wdog_reg.wdog_wcr = 0;
-}
-
-int watchdog_disable (void)
-{
- volatile immap_t *regp = (volatile immap_t *)CFG_MBAR;
-
- regp->wdog_reg.wdog_wcr = 0; /* reset watchdog counter */
- regp->wdog_reg.wdog_wirr = 0; /* disable watchdog interrupt */
- regp->wdog_reg.wdog_wrrr = 0; /* disable watchdog timer */
-
- puts ("WATCHDOG:disabled\n");
- return (0);
-}
-
-int watchdog_init (void)
-{
- volatile immap_t *regp = (volatile immap_t *)CFG_MBAR;
-
- regp->wdog_reg.wdog_wirr = 0; /* disable watchdog interrupt */
-
- /* set timeout and enable watchdog */
- regp->wdog_reg.wdog_wrrr = ((CONFIG_WATCHDOG_TIMEOUT * CFG_HZ) / (32768 * 1000)) - 1;
- regp->wdog_reg.wdog_wcr = 0; /* reset watchdog counter */
-
- puts ("WATCHDOG:enabled\n");
- return (0);
-}
-#endif /* #ifdef CONFIG_WATCHDOG */
-
-#endif /* #ifdef CONFIG_M5272 */
-
-
-#ifdef CONFIG_M5282
-int checkcpu (void)
-{
- unsigned char resetsource = MCFRESET_RSR;
-
- printf ("CPU: Freescale Coldfire MCF5282 (PIN: %2.2x REV: %2.2x)\n",
- MCFCCM_CIR>>8,MCFCCM_CIR & MCFCCM_CIR_PRN_MASK);
- printf ("Reset:%s%s%s%s%s%s%s\n",
- (resetsource & MCFRESET_RSR_LOL) ? " Loss of Lock" : "",
- (resetsource & MCFRESET_RSR_LOC) ? " Loss of Clock" : "",
- (resetsource & MCFRESET_RSR_EXT) ? " External" : "",
- (resetsource & MCFRESET_RSR_POR) ? " Power On" : "",
- (resetsource & MCFRESET_RSR_WDR) ? " Watchdog" : "",
- (resetsource & MCFRESET_RSR_SOFT) ? " Software" : "",
- (resetsource & MCFRESET_RSR_LVD) ? " Low Voltage" : ""
- );
- return 0;
-}
-
-int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
-{
- MCFRESET_RCR = MCFRESET_RCR_SOFTRST;
- return 0;
-};
-#endif
-
-#ifdef CONFIG_M5249 /* test-only: todo... */
-int checkcpu (void)
-{
- char buf[32];
-
- printf ("CPU: Freescale Coldfire MCF5249 at %s MHz\n", strmhz(buf, CFG_CLK));
- return 0;
-}
-
-int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) {
- /* enable watchdog, set timeout to 0 and wait */
- mbar_writeByte(MCFSIM_SYPCR, 0xc0);
- while (1);
-
- /* we don't return! */
- return 0;
-};
-#endif
diff --git a/cpu/mcf52x2/cpu_init.c b/cpu/mcf52x2/cpu_init.c
deleted file mode 100644
index 1748ea9d9b..0000000000
--- a/cpu/mcf52x2/cpu_init.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * (C) Copyright 2003
- * Josef Baumgartner <josef.baumgartner@telex.de>
- *
- * MCF5282 additionals
- * (C) Copyright 2005
- * BuS Elektronik GmbH & Co. KG <esw@bus-elektronik.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <watchdog.h>
-
-#ifdef CONFIG_M5271
-#include <asm/m5271.h>
-#include <asm/immap_5271.h>
-#endif
-
-#ifdef CONFIG_M5272
-#include <asm/m5272.h>
-#include <asm/immap_5272.h>
-#endif
-
-#ifdef CONFIG_M5282
-#include <asm/m5282.h>
-#include <asm/immap_5282.h>
-#endif
-
-#ifdef CONFIG_M5249
-#include <asm/m5249.h>
-#endif
-
-#if defined(CONFIG_M5271)
-void cpu_init_f (void)
-{
-#ifndef CONFIG_WATCHDOG
- /* Disable the watchdog if we aren't using it */
- mbar_writeShort(MCF_WTM_WCR, 0);
-#endif
-
- /* Set clockspeed to 100MHz */
- mbar_writeShort(MCF_FMPLL_SYNCR,
- MCF_FMPLL_SYNCR_MFD(0) | MCF_FMPLL_SYNCR_RFD(0));
- while (!mbar_readByte(MCF_FMPLL_SYNSR) & MCF_FMPLL_SYNSR_LOCK);
-
- /* Enable UART pins */
- mbar_writeShort(MCF_GPIO_PAR_UART, MCF_GPIO_PAR_UART_U0TXD |
- MCF_GPIO_PAR_UART_U0RXD |
- MCF_GPIO_PAR_UART_U1RXD_UART1 |
- MCF_GPIO_PAR_UART_U1TXD_UART1);
-
- /* Enable Ethernet pins */
- mbar_writeByte(MCF_GPIO_PAR_FECI2C, CFG_FECI2C);
-}
-
-/*
- * initialize higher level parts of CPU like timers
- */
-int cpu_init_r (void)
-{
- return (0);
-}
-#endif
-
-#if defined(CONFIG_M5272)
-/*
- * Breath some life into the CPU...
- *
- * Set up the memory map,
- * initialize a bunch of registers,
- * initialize the UPM's
- */
-void cpu_init_f (void)
-{
- /* if we come from RAM we assume the CPU is
- * already initialized.
- */
-#ifndef CONFIG_MONITOR_IS_IN_RAM
- volatile immap_t *regp = (immap_t *)CFG_MBAR;
-
- volatile unsigned char *mbar;
- mbar = (volatile unsigned char *) CFG_MBAR;
-
- regp->sysctrl_reg.sc_scr = CFG_SCR;
- regp->sysctrl_reg.sc_spr = CFG_SPR;
-
- /* Setup Ports: */
- regp->gpio_reg.gpio_pacnt = CFG_PACNT;
- regp->gpio_reg.gpio_paddr = CFG_PADDR;
- regp->gpio_reg.gpio_padat = CFG_PADAT;
- regp->gpio_reg.gpio_pbcnt = CFG_PBCNT;
- regp->gpio_reg.gpio_pbddr = CFG_PBDDR;
- regp->gpio_reg.gpio_pbdat = CFG_PBDAT;
- regp->gpio_reg.gpio_pdcnt = CFG_PDCNT;
-
- /* Memory Controller: */
- regp->csctrl_reg.cs_br0 = CFG_BR0_PRELIM;
- regp->csctrl_reg.cs_or0 = CFG_OR0_PRELIM;
-
-#if (defined(CFG_OR1_PRELIM) && defined(CFG_BR1_PRELIM))
- regp->csctrl_reg.cs_br1 = CFG_BR1_PRELIM;
- regp->csctrl_reg.cs_or1 = CFG_OR1_PRELIM;
-#endif
-
-#if defined(CFG_OR2_PRELIM) && defined(CFG_BR2_PRELIM)
- regp->csctrl_reg.cs_br2 = CFG_BR2_PRELIM;
- regp->csctrl_reg.cs_or2 = CFG_OR2_PRELIM;
-#endif
-
-#if defined(CFG_OR3_PRELIM) && defined(CFG_BR3_PRELIM)
- regp->csctrl_reg.cs_br3 = CFG_BR3_PRELIM;
- regp->csctrl_reg.cs_or3 = CFG_OR3_PRELIM;
-#endif
-
-#if defined(CFG_OR4_PRELIM) && defined(CFG_BR4_PRELIM)
- regp->csctrl_reg.cs_br4 = CFG_BR4_PRELIM;
- regp->csctrl_reg.cs_or4 = CFG_OR4_PRELIM;
-#endif
-
-#if defined(CFG_OR5_PRELIM) && defined(CFG_BR5_PRELIM)
- regp->csctrl_reg.cs_br5 = CFG_BR5_PRELIM;
- regp->csctrl_reg.cs_or5 = CFG_OR5_PRELIM;
-#endif
-
-#if defined(CFG_OR6_PRELIM) && defined(CFG_BR6_PRELIM)
- regp->csctrl_reg.cs_br6 = CFG_BR6_PRELIM;
- regp->csctrl_reg.cs_or6 = CFG_OR6_PRELIM;
-#endif
-
-#if defined(CFG_OR7_PRELIM) && defined(CFG_BR7_PRELIM)
- regp->csctrl_reg.cs_br7 = CFG_BR7_PRELIM;
- regp->csctrl_reg.cs_or7 = CFG_OR7_PRELIM;
-#endif
-
-#endif /* #ifndef CONFIG_MONITOR_IS_IN_RAM */
-
- /* enable instruction cache now */
- icache_enable();
-
-}
-
-/*
- * initialize higher level parts of CPU like timers
- */
-int cpu_init_r (void)
-{
- return (0);
-}
-#endif /* #if defined(CONFIG_M5272) */
-
-
-#ifdef CONFIG_M5282
-/*
- * Breath some life into the CPU...
- *
- * Set up the memory map,
- * initialize a bunch of registers,
- * initialize the UPM's
- */
-void cpu_init_f (void)
-{
-#ifndef CONFIG_WATCHDOG
- /* disable watchdog if we aren't using it */
- MCFWTM_WCR = 0;
-#endif
-
-#ifndef CONFIG_MONITOR_IS_IN_RAM
- /* Set speed /PLL */
- MCFCLOCK_SYNCR = MCFCLOCK_SYNCR_MFD(CFG_MFD) | MCFCLOCK_SYNCR_RFD(CFG_RFD);
-
- /* Set up the GPIO ports */
-#ifdef CFG_PEPAR
- MCFGPIO_PEPAR = CFG_PEPAR;
-#endif
-#ifdef CFG_PFPAR
- MCFGPIO_PFPAR = CFG_PFPAR;
-#endif
-#ifdef CFG_PJPAR
- MCFGPIO_PJPAR = CFG_PJPAR;
-#endif
-#ifdef CFG_PSDPAR
- MCFGPIO_PSDPAR = CFG_PSDPAR;
-#endif
-#ifdef CFG_PASPAR
- MCFGPIO_PASPAR = CFG_PASPAR;
-#endif
-#ifdef CFG_PEHLPAR
- MCFGPIO_PEHLPAR = CFG_PEHLPAR;
-#endif
-#ifdef CFG_PQSPAR
- MCFGPIO_PQSPAR = CFG_PQSPAR;
-#endif
-#ifdef CFG_PTCPAR
- MCFGPIO_PTCPAR = CFG_PTCPAR;
-#endif
-#ifdef CFG_PTDPAR
- MCFGPIO_PTDPAR = CFG_PTDPAR;
-#endif
-#ifdef CFG_PUAPAR
- MCFGPIO_PUAPAR = CFG_PUAPAR;
-#endif
-
-#ifdef CFG_DDRUA
- MCFGPIO_DDRUA = CFG_DDRUA;
-#endif
-
- /* This is probably a bad place to setup chip selects, but everyone
- else is doing it! */
-
-#if defined(CFG_CS0_BASE) & defined(CFG_CS0_SIZE) & \
- defined(CFG_CS0_WIDTH) & defined(CFG_CS0_RO) & \
- defined(CFG_CS0_WS)
-
- MCFCSM_CSAR0 = (CFG_CS0_BASE >> 16) & 0xFFFF;
-
- #if (CFG_CS0_WIDTH == 8)
- #define CFG_CS0_PS MCFCSM_CSCR_PS_8
- #elif (CFG_CS0_WIDTH == 16)
- #define CFG_CS0_PS MCFCSM_CSCR_PS_16
- #elif (CFG_CS0_WIDTH == 32)
- #define CFG_CS0_PS MCFCSM_CSCR_PS_32
- #else
- #error "CFG_CS0_WIDTH: Fault - wrong bus with for CS0"
- #endif
- MCFCSM_CSCR0 = MCFCSM_CSCR_WS(CFG_CS0_WS)
- |CFG_CS0_PS
- |MCFCSM_CSCR_AA;
-
- #if (CFG_CS0_RO != 0)
- MCFCSM_CSMR0 = MCFCSM_CSMR_BAM(CFG_CS0_SIZE-1)
- |MCFCSM_CSMR_WP|MCFCSM_CSMR_V;
- #else
- MCFCSM_CSMR0 = MCFCSM_CSMR_BAM(CFG_CS0_SIZE-1)|MCFCSM_CSMR_V;
- #endif
-#else
- #waring "Chip Select 0 are not initialized/used"
-#endif
-
-#if defined(CFG_CS1_BASE) & defined(CFG_CS1_SIZE) & \
- defined(CFG_CS1_WIDTH) & defined(CFG_CS1_RO) & \
- defined(CFG_CS1_WS)
-
- MCFCSM_CSAR1 = (CFG_CS1_BASE >> 16) & 0xFFFF;
-
- #if (CFG_CS1_WIDTH == 8)
- #define CFG_CS1_PS MCFCSM_CSCR_PS_8
- #elif (CFG_CS1_WIDTH == 16)
- #define CFG_CS1_PS MCFCSM_CSCR_PS_16
- #elif (CFG_CS1_WIDTH == 32)
- #define CFG_CS1_PS MCFCSM_CSCR_PS_32
- #else
- #error "CFG_CS1_WIDTH: Fault - wrong bus with for CS1"
- #endif
- MCFCSM_CSCR1 = MCFCSM_CSCR_WS(CFG_CS1_WS)
- |CFG_CS1_PS
- |MCFCSM_CSCR_AA;
-
- #if (CFG_CS1_RO != 0)
- MCFCSM_CSMR1 = MCFCSM_CSMR_BAM(CFG_CS1_SIZE-1)
- |MCFCSM_CSMR_WP
- |MCFCSM_CSMR_V;
- #else
- MCFCSM_CSMR1 = MCFCSM_CSMR_BAM(CFG_CS1_SIZE-1)
- |MCFCSM_CSMR_V;
- #endif
-#else
- #warning "Chip Select 1 are not initialized/used"
-#endif
-
-#if defined(CFG_CS2_BASE) & defined(CFG_CS2_SIZE) & \
- defined(CFG_CS2_WIDTH) & defined(CFG_CS2_RO) & \
- defined(CFG_CS2_WS)
-
- MCFCSM_CSAR2 = (CFG_CS2_BASE >> 16) & 0xFFFF;
-
- #if (CFG_CS2_WIDTH == 8)
- #define CFG_CS2_PS MCFCSM_CSCR_PS_8
- #elif (CFG_CS2_WIDTH == 16)
- #define CFG_CS2_PS MCFCSM_CSCR_PS_16
- #elif (CFG_CS2_WIDTH == 32)
- #define CFG_CS2_PS MCFCSM_CSCR_PS_32
- #else
- #error "CFG_CS2_WIDTH: Fault - wrong bus with for CS2"
- #endif
- MCFCSM_CSCR2 = MCFCSM_CSCR_WS(CFG_CS2_WS)
- |CFG_CS2_PS
- |MCFCSM_CSCR_AA;
-
- #if (CFG_CS2_RO != 0)
- MCFCSM_CSMR2 = MCFCSM_CSMR_BAM(CFG_CS2_SIZE-1)
- |MCFCSM_CSMR_WP
- |MCFCSM_CSMR_V;
- #else
- MCFCSM_CSMR2 = MCFCSM_CSMR_BAM(CFG_CS2_SIZE-1)
- |MCFCSM_CSMR_V;
- #endif
-#else
- #warning "Chip Select 2 are not initialized/used"
-#endif
-
-#if defined(CFG_CS3_BASE) & defined(CFG_CS3_SIZE) & \
- defined(CFG_CS3_WIDTH) & defined(CFG_CS3_RO) & \
- defined(CFG_CS3_WS)
-
- MCFCSM_CSAR3 = (CFG_CS3_BASE >> 16) & 0xFFFF;
-
- #if (CFG_CS3_WIDTH == 8)
- #define CFG_CS3_PS MCFCSM_CSCR_PS_8
- #elif (CFG_CS3_WIDTH == 16)
- #define CFG_CS3_PS MCFCSM_CSCR_PS_16
- #elif (CFG_CS3_WIDTH == 32)
- #define CFG_CS3_PS MCFCSM_CSCR_PS_32
- #else
- #error "CFG_CS3_WIDTH: Fault - wrong bus with for CS1"
- #endif
- MCFCSM_CSCR3 = MCFCSM_CSCR_WS(CFG_CS3_WS)
- |CFG_CS3_PS
- |MCFCSM_CSCR_AA;
-
- #if (CFG_CS3_RO != 0)
- MCFCSM_CSMR3 = MCFCSM_CSMR_BAM(CFG_CS3_SIZE-1)
- |MCFCSM_CSMR_WP
- |MCFCSM_CSMR_V;
- #else
- MCFCSM_CSMR3 = MCFCSM_CSMR_BAM(CFG_CS3_SIZE-1)
- |MCFCSM_CSMR_V;
- #endif
-#else
- #warning "Chip Select 3 are not initialized/used"
-#endif
-
-#endif /* CONFIG_MONITOR_IS_IN_RAM */
-
- /* defer enabling cache until boot (see do_go) */
- /* icache_enable(); */
-}
-
-/*
- * initialize higher level parts of CPU like timers
- */
-int cpu_init_r (void)
-{
- return (0);
-}
-#endif
-
-#if defined(CONFIG_M5249)
-/*
- * Breath some life into the CPU...
- *
- * Set up the memory map,
- * initialize a bunch of registers,
- * initialize the UPM's
- */
-void cpu_init_f (void)
-{
-#ifndef CFG_PLL_BYPASS
- /*
- * Setup the PLL to run at the specified speed
- *
- */
- volatile unsigned long cpll = mbar2_readLong(MCFSIM_PLLCR);
- unsigned long pllcr;
-#ifdef CFG_FAST_CLK
- pllcr = 0x925a3100; /* ~140MHz clock (PLL bypass = 0) */
-#else
- pllcr = 0x135a4140; /* ~72MHz clock (PLL bypass = 0) */
-#endif
- cpll = cpll & 0xfffffffe; /* Set PLL bypass mode = 0 (PSTCLK = crystal) */
- mbar2_writeLong(MCFSIM_PLLCR, cpll); /* Set the PLL to bypass mode (PSTCLK = crystal) */
- mbar2_writeLong(MCFSIM_PLLCR, pllcr); /* set the clock speed */
- pllcr ^= 0x00000001; /* Set pll bypass to 1 */
- mbar2_writeLong(MCFSIM_PLLCR, pllcr); /* Start locking (pll bypass = 1) */
- udelay(0x20); /* Wait for a lock ... */
-#endif /* #ifndef CFG_PLL_BYPASS */
-
- /*
- * NOTE: by setting the GPIO_FUNCTION registers, we ensure that the UART pins
- * (UART0: gpio 30,27, UART1: gpio 31, 28) will be used as UART pins
- * which is their primary function.
- * ~Jeremy
- */
- mbar2_writeLong(MCFSIM_GPIO_FUNC, CFG_GPIO_FUNC);
- mbar2_writeLong(MCFSIM_GPIO1_FUNC, CFG_GPIO1_FUNC);
- mbar2_writeLong(MCFSIM_GPIO_EN, CFG_GPIO_EN);
- mbar2_writeLong(MCFSIM_GPIO1_EN, CFG_GPIO1_EN);
- mbar2_writeLong(MCFSIM_GPIO_OUT, CFG_GPIO_OUT);
- mbar2_writeLong(MCFSIM_GPIO1_OUT, CFG_GPIO1_OUT);
-
- /*
- * dBug Compliance:
- * You can verify these values by using dBug's 'ird'
- * (Internal Register Display) command
- * ~Jeremy
- *
- */
- mbar_writeByte(MCFSIM_MPARK, 0x30); /* 5249 Internal Core takes priority over DMA */
- mbar_writeByte(MCFSIM_SYPCR, 0x00);
- mbar_writeByte(MCFSIM_SWIVR, 0x0f);
- mbar_writeByte(MCFSIM_SWSR, 0x00);
- mbar_writeLong(MCFSIM_IMR, 0xfffffbff);
- mbar_writeByte(MCFSIM_SWDICR, 0x00);
- mbar_writeByte(MCFSIM_TIMER1ICR, 0x00);
- mbar_writeByte(MCFSIM_TIMER2ICR, 0x88);
- mbar_writeByte(MCFSIM_I2CICR, 0x00);
- mbar_writeByte(MCFSIM_UART1ICR, 0x00);
- mbar_writeByte(MCFSIM_UART2ICR, 0x00);
- mbar_writeByte(MCFSIM_ICR6, 0x00);
- mbar_writeByte(MCFSIM_ICR7, 0x00);
- mbar_writeByte(MCFSIM_ICR8, 0x00);
- mbar_writeByte(MCFSIM_ICR9, 0x00);
- mbar_writeByte(MCFSIM_QSPIICR, 0x00);
-
- mbar2_writeLong(MCFSIM_GPIO_INT_EN, 0x00000080);
- mbar2_writeByte(MCFSIM_INTBASE, 0x40); /* Base interrupts at 64 */
- mbar2_writeByte(MCFSIM_SPURVEC, 0x00);
- mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020); /* Enable a 1 cycle pre-drive cycle on CS1 */
-
- /* Setup interrupt priorities for gpio7 */
- /* mbar2_writeLong(MCFSIM_INTLEV5, 0x70000000); */
-
- /* IDE Config registers */
- mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020);
- mbar2_writeLong(MCFSIM_IDECONFIG2, 0x00000000);
-
- /*
- * Setup chip selects...
- */
-
- mbar_writeShort(MCFSIM_CSAR1, CFG_CSAR1);
- mbar_writeShort(MCFSIM_CSCR1, CFG_CSCR1);
- mbar_writeLong(MCFSIM_CSMR1, CFG_CSMR1);
-
- mbar_writeShort(MCFSIM_CSAR0, CFG_CSAR0);
- mbar_writeShort(MCFSIM_CSCR0, CFG_CSCR0);
- mbar_writeLong(MCFSIM_CSMR0, CFG_CSMR0);
-
- /* enable instruction cache now */
- icache_enable();
-}
-
-/*
- * initialize higher level parts of CPU like timers
- */
-int cpu_init_r (void)
-{
- return (0);
-}
-#endif /* #if defined(CONFIG_M5249) */
diff --git a/cpu/mcf52x2/interrupts.c b/cpu/mcf52x2/interrupts.c
deleted file mode 100644
index 116747ad3a..0000000000
--- a/cpu/mcf52x2/interrupts.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * (C) Copyright 2003 Josef Baumgartner <josef.baumgartner@telex.de>
- *
- * (C) Copyright 2000-2004
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <asm/processor.h>
-
-#ifdef CONFIG_M5271
-#include <asm/m5271.h>
-#include <asm/immap_5271.h>
-#endif
-
-#ifdef CONFIG_M5272
-#include <asm/m5272.h>
-#include <asm/immap_5272.h>
-#endif
-
-#ifdef CONFIG_M5282
-#include <asm/m5282.h>
-#include <asm/immap_5282.h>
-#endif
-
-#ifdef CONFIG_M5249
-#include <asm/m5249.h>
-#endif
-
-
-#define NR_IRQS 31
-
-/*
- * Interrupt vector functions.
- */
-struct interrupt_action {
- interrupt_handler_t *handler;
- void *arg;
-};
-
-static struct interrupt_action irq_vecs[NR_IRQS];
-
-static __inline__ unsigned short get_sr (void)
-{
- unsigned short sr;
-
- asm volatile ("move.w %%sr,%0":"=r" (sr):);
-
- return sr;
-}
-
-static __inline__ void set_sr (unsigned short sr)
-{
- asm volatile ("move.w %0,%%sr"::"r" (sr));
-}
-
-/************************************************************************/
-/*
- * Install and free an interrupt handler
- */
-void irq_install_handler (int vec, interrupt_handler_t * handler, void *arg)
-{
-#ifdef CONFIG_M5272
- volatile intctrl_t *intp = (intctrl_t *) (CFG_MBAR + MCFSIM_ICR1);
-#endif
- int vec_base = 0;
-
-#ifdef CONFIG_M5272
- vec_base = intp->int_pivr & 0xe0;
-#endif
-
- if ((vec < vec_base) || (vec > vec_base + NR_IRQS)) {
- printf ("irq_install_handler: wrong interrupt vector %d\n",
- vec);
- return;
- }
-
- irq_vecs[vec - vec_base].handler = handler;
- irq_vecs[vec - vec_base].arg = arg;
-}
-
-void irq_free_handler (int vec)
-{
-#ifdef CONFIG_M5272
- volatile intctrl_t *intp = (intctrl_t *) (CFG_MBAR + MCFSIM_ICR1);
-#endif
- int vec_base = 0;
-
-#ifdef CONFIG_M5272
- vec_base = intp->int_pivr & 0xe0;
-#endif
-
- if ((vec < vec_base) || (vec > vec_base + NR_IRQS)) {
- return;
- }
-
- irq_vecs[vec - vec_base].handler = NULL;
- irq_vecs[vec - vec_base].arg = NULL;
-}
-
-void enable_interrupts (void)
-{
- unsigned short sr;
-
- sr = get_sr ();
- set_sr (sr & ~0x0700);
-}
-
-int disable_interrupts (void)
-{
- unsigned short sr;
-
- sr = get_sr ();
- set_sr (sr | 0x0700);
-
- return ((sr & 0x0700) == 0); /* return TRUE, if interrupts were enabled before */
-}
-
-void int_handler (struct pt_regs *fp)
-{
-#ifdef CONFIG_M5272
- volatile intctrl_t *intp = (intctrl_t *) (CFG_MBAR + MCFSIM_ICR1);
-#endif
- int vec, vec_base = 0;
-
- vec = (fp->vector >> 2) & 0xff;
-#ifdef CONFIG_M5272
- vec_base = intp->int_pivr & 0xe0;
-#endif
-
- if (irq_vecs[vec - vec_base].handler != NULL) {
- irq_vecs[vec -
- vec_base].handler (irq_vecs[vec - vec_base].arg);
- } else {
- printf ("\nBogus External Interrupt Vector %d\n", vec);
- }
-}
-
-
-#ifdef CONFIG_M5272
-int interrupt_init (void)
-{
- volatile intctrl_t *intp = (intctrl_t *) (CFG_MBAR + MCFSIM_ICR1);
-
- /* disable all external interrupts */
- intp->int_icr1 = 0x88888888;
- intp->int_icr2 = 0x88888888;
- intp->int_icr3 = 0x88888888;
- intp->int_icr4 = 0x88888888;
- intp->int_pitr = 0x00000000;
- /* initialize vector register */
- intp->int_pivr = 0x40;
-
- enable_interrupts ();
-
- return 0;
-}
-#endif
-
-#if defined(CONFIG_M5282) || defined(CONFIG_M5271)
-int interrupt_init (void)
-{
- return 0;
-}
-#endif
-
-#ifdef CONFIG_M5249
-int interrupt_init (void)
-{
- enable_interrupts ();
-
- return 0;
-}
-#endif
diff --git a/cpu/mcf52x2/speed.c b/cpu/mcf52x2/speed.c
deleted file mode 100644
index ac860b2c67..0000000000
--- a/cpu/mcf52x2/speed.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * (C) Copyright 2003
- * Josef Baumgartner <josef.baumgartner@telex.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/*
- * get_clocks() fills in gd->cpu_clock and gd->bus_clk
- */
-int get_clocks (void)
-{
- gd->cpu_clk = CFG_CLK;
-#ifdef CONFIG_M5249
- gd->bus_clk = gd->cpu_clk / 2;
-#else
- gd->bus_clk = gd->cpu_clk;
-#endif
- return (0);
-}
diff --git a/cpu/mcf52x2/start.S b/cpu/mcf52x2/start.S
deleted file mode 100644
index e62880d7d0..0000000000
--- a/cpu/mcf52x2/start.S
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de>
- * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include "version.h"
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-
-#define _START _start
-#define _FAULT _fault
-
-
-#define SAVE_ALL \
- move.w #0x2700,%sr; /* disable intrs */ \
- subl #60,%sp; /* space for 15 regs */ \
- moveml %d0-%d7/%a0-%a6,%sp@; \
-
-#define RESTORE_ALL \
- moveml %sp@,%d0-%d7/%a0-%a6; \
- addl #60,%sp; /* space for 15 regs */ \
- rte
-
-/* If we come from a pre-loader we don't need an initial exception
- * table.
- */
-#if !defined(CONFIG_MONITOR_IS_IN_RAM)
-
-.text
-/*
- * Vector table. This is used for initial platform startup.
- * These vectors are to catch any un-intended traps.
- */
-_vectors:
-
-.long 0x00000000 /* Flash offset is 0 until we setup CS0 */
-#if defined(CONFIG_R5200)
-.long 0x400
-#elif defined(CONFIG_M5282)
-.long _start - TEXT_BASE
-#else
-.long _START
-#endif
-
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
-
-#endif
-
- .text
-
-
-#if defined(CFG_INT_FLASH_BASE) && \
- (defined(CONFIG_M5282) || defined(CONFIG_M5281))
- #if (TEXT_BASE == CFG_INT_FLASH_BASE)
- .long 0x55AA55AA,0xAA55AA55 /* CFM Backdoorkey */
- .long 0xFFFFFFFF /* all sectors protected */
- .long 0x00000000 /* supervisor/User restriction */
- .long 0x00000000 /* programm/data space restriction */
- .long 0x00000000 /* Flash security */
- #endif
-#endif
- .globl _start
-_start:
- nop
- nop
- move.w #0x2700,%sr
-
-#if defined(CONFIG_M5272) || defined(CONFIG_M5249)
- move.l #(CFG_MBAR + 1), %d0 /* set MBAR address + valid flag */
- move.c %d0, %MBAR
-
- /*** The 5249 has MBAR2 as well ***/
-#ifdef CFG_MBAR2
- move.l #(CFG_MBAR2 + 1), %d0 /* Get MBAR2 address */
- movec %d0, #0xc0e /* Set MBAR2 */
-#endif
-
- move.l #(CFG_INIT_RAM_ADDR + 1), %d0
- movec %d0, %RAMBAR0
-#endif /* #if defined(CONFIG_M5272) || defined(CONFIG_M5249) */
-
-#if defined(CONFIG_M5282) || defined(CONFIG_M5271)
- /* Initialize IPSBAR */
- move.l #(CFG_MBAR + 1), %d0 /* set IPSBAR address + valid flag */
- move.l %d0, 0x40000000
-
- /* Initialize RAMBAR1: locate SRAM and validate it */
- move.l #(CFG_INIT_RAM_ADDR + 0x21), %d0
- movec %d0, %RAMBAR1
-
-#if defined(CONFIG_M5282)
-#if (TEXT_BASE == CFG_INT_FLASH_BASE)
- /* Setup code in SRAM to initialize FLASHBAR, if start from internal Flash */
-
- move.l #(_flashbar_setup-CFG_INT_FLASH_BASE), %a0
- move.l #(_flashbar_setup_end-CFG_INT_FLASH_BASE), %a1
- move.l #(CFG_INIT_RAM_ADDR), %a2
-_copy_flash:
- move.l (%a0)+, (%a2)+
- cmp.l %a0, %a1
- bgt.s _copy_flash
- jmp CFG_INIT_RAM_ADDR
-
-_flashbar_setup:
- /* Initialize FLASHBAR: locate internal Flash and validate it */
- move.l #(CFG_INT_FLASH_BASE + 0x21), %d0
- movec %d0, %RAMBAR0
- jmp _after_flashbar_copy.L /* Force jump to absolute address */
-_flashbar_setup_end:
- nop
-_after_flashbar_copy:
-#else
- /* Setup code to initialize FLASHBAR, if start from external Memory */
- move.l #(CFG_INT_FLASH_BASE + 0x21), %d0
- movec %d0, %RAMBAR0
-#endif /* (TEXT_BASE == CFG_INT_FLASH_BASE) */
-
-#endif
-#endif
- /* if we come from a pre-loader we have no exception table and
- * therefore no VBR to set
- */
-#if !defined(CONFIG_MONITOR_IS_IN_RAM)
- move.l #CFG_FLASH_BASE, %d0
- movec %d0, %VBR
-#endif
-
-#ifdef CONFIG_R5200
- move.l #(_flash_setup-CFG_FLASH_BASE), %a0
- move.l #(_flash_setup_end-CFG_FLASH_BASE), %a1
- move.l #(CFG_INIT_RAM_ADDR), %a2
-_copy_flash:
- move.l (%a0)+, (%a2)+
- cmp.l %a0, %a1
- bgt.s _copy_flash
- jmp CFG_INIT_RAM_ADDR
-_after_flash_copy:
-#endif
-
-
- /* set stackpointer to end of internal ram to get some stackspace for the first c-code */
- move.l #(CFG_INIT_RAM_ADDR + CFG_INIT_SP_OFFSET), %sp
- clr.l %sp@-
-
- move.l #__got_start, %a5 /* put relocation table address to a5 */
-
- bsr cpu_init_f /* run low-level CPU init code (from flash) */
- bsr board_init_f /* run low-level board init code (from flash) */
-
- /* board_init_f() does not return */
-
-/*------------------------------------------------------------------------------*/
-
-#ifdef CONFIG_R5200
-_flash_setup:
- /* CSAR0 */
- move.l #((CFG_FLASH_BASE & 0xffff0000) >> 16), %d0
- move.w %d0, 0x40000080
-
- /* CSCR0 */
- move.l #0x2180, %d0 /* 8 wait states, 16bit port, auto ack, */
- move.w %d0, 0x4000008A
-
- /* CSMR0 */
- move.l #0x001f0001, %d0 /* 2 MB, valid */
- move.l %d0, 0x40000084
-
- jmp _after_flash_copy.L
-_flash_setup_end:
-#endif
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
- */
- .globl relocate_code
-relocate_code:
- link.w %a6,#0
- move.l 8(%a6), %sp /* set new stack pointer */
-
- move.l 12(%a6), %d0 /* Save copy of Global Data pointer */
- move.l 16(%a6), %a0 /* Save copy of Destination Address */
-
- move.l #CFG_MONITOR_BASE, %a1
- move.l #__init_end, %a2
- move.l %a0, %a3
- /* copy the code to RAM */
-1:
- move.l (%a1)+, (%a3)+
- cmp.l %a1,%a2
- bgt.s 1b
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
- move.l %a0, %a1
- add.l #(in_ram - CFG_MONITOR_BASE), %a1
- jmp (%a1)
-
-in_ram:
-
-clear_bss:
- /*
- * Now clear BSS segment
- */
- move.l %a0, %a1
- add.l #(_sbss - CFG_MONITOR_BASE),%a1
- move.l %a0, %d1
- add.l #(_ebss - CFG_MONITOR_BASE),%d1
-6:
- clr.l (%a1)+
- cmp.l %a1,%d1
- bgt.s 6b
-
- /*
- * fix got table in RAM
- */
- move.l %a0, %a1
- add.l #(__got_start - CFG_MONITOR_BASE),%a1
- move.l %a1,%a5 /* * fix got pointer register a5 */
-
- move.l %a0, %a2
- add.l #(__got_end - CFG_MONITOR_BASE),%a2
-
-7:
- move.l (%a1),%d1
- sub.l #_start,%d1
- add.l %a0,%d1
- move.l %d1,(%a1)+
- cmp.l %a2, %a1
- bne 7b
-
-#if defined(CONFIG_M5281) || defined(CONFIG_M5282)
- /* patch the 3 accesspoints to 3 ichache_state */
- /* quick and dirty */
-
- move.l %a0,%d1
- add.l #(icache_state - CFG_MONITOR_BASE),%d1
- move.l %a0,%a1
- add.l #(icache_state_access_1+2 - CFG_MONITOR_BASE),%a1
- move.l %d1,(%a1)
- move.l %a0,%a1
- add.l #(icache_state_access_2+2 - CFG_MONITOR_BASE),%a1
- move.l %d1,(%a1)
- move.l %a0,%a1
- add.l #(icache_state_access_3+2 - CFG_MONITOR_BASE),%a1
- move.l %d1,(%a1)
-#endif
-
- /* calculate relative jump to board_init_r in ram */
- move.l %a0, %a1
- add.l #(board_init_r - CFG_MONITOR_BASE), %a1
-
- /* set parameters for board_init_r */
- move.l %a0,-(%sp) /* dest_addr */
- move.l %d0,-(%sp) /* gd */
- #if defined(DEBUG) && (TEXT_BASE != CFG_INT_FLASH_BASE) && \
- defined(CFG_HALT_BEFOR_RAM_JUMP)
- halt
- #endif
- jsr (%a1)
-
-/*------------------------------------------------------------------------------*/
-/* exception code */
- .globl _fault
-_fault:
- jmp _fault
-
- .globl _exc_handler
-_exc_handler:
- SAVE_ALL
- movel %sp,%sp@-
- bsr exc_handler
- addql #4,%sp
- RESTORE_ALL
-
- .globl _int_handler
-_int_handler:
- SAVE_ALL
- movel %sp,%sp@-
- bsr int_handler
- addql #4,%sp
- RESTORE_ALL
-
-/*------------------------------------------------------------------------------*/
-/* cache functions */
-#ifdef CONFIG_M5272
- .globl icache_enable
-icache_enable:
- move.l #0x01000000, %d0 /* Invalidate cache cmd */
- movec %d0, %CACR /* Invalidate cache */
- move.l #0x0000c000, %d0 /* Setup cache mask */
- movec %d0, %ACR0 /* Enable cache */
- move.l #0xff00c000, %d0 /* Setup cache mask */
- movec %d0, %ACR1 /* Enable cache */
- move.l #0x80000100, %d0 /* Setup cache mask */
- movec %d0, %CACR /* Enable cache */
- moveq #1, %d0
- move.l %d0, icache_state
- rts
-#endif
-
-#ifdef CONFIG_M5282
- .globl icache_enable
-icache_enable:
- move.l #0x01000000, %d0 /* Invalidate cache cmd */
- movec %d0, %CACR /* Invalidate cache */
- move.l #0x0000c000, %d0 /* Setup cache mask */
- movec %d0, %ACR0 /* Enable cache */
- move.l #0xff00c000, %d0 /* Setup cache mask */
- movec %d0, %ACR1 /* Enable cache */
- move.l #0x80400100, %d0 /* Setup cache mask, data cache disabel*/
- movec %d0, %CACR /* Enable cache */
- moveq #1, %d0
-icache_state_access_1:
- move.l %d0, icache_state
- rts
-#endif
-
-#ifdef CONFIG_M5249
- .globl icache_enable
-icache_enable:
- /*
- * Note: The 5249 Documentation doesn't give a bit position for CINV!
- * From the 5272 and the 5307 documentation, I have deduced that it is
- * probably CACR[24]. Should someone say something to Motorola?
- * ~Jeremy
- */
- move.l #0x01000000, %d0 /* Invalidate whole cache */
- move.c %d0,%CACR
- move.l #0xff00c000, %d0 /* Set FLASH cachable: always match (SM=0b10) */
- move.c %d0, %ACR0
- move.l #0x0000c000, %d0 /* Set SDRAM cachable: always match (SM=0b10) */
- move.c %d0, %ACR1
- move.l #0x90000200, %d0 /* Set cache enable cmd */
- move.c %d0,%CACR
- moveq #1, %d0
- move.l %d0, icache_state
- rts
-#endif
-
- .globl icache_disable
-icache_disable:
- move.l #0x00000100, %d0 /* Setup cache mask */
- movec %d0, %CACR /* Enable cache */
- clr.l %d0 /* Setup cache mask */
- movec %d0, %ACR0 /* Enable cache */
- movec %d0, %ACR1 /* Enable cache */
- moveq #0, %d0
-icache_state_access_2:
- move.l %d0, icache_state
- rts
-
- .globl icache_status
-icache_status:
-icache_state_access_3:
- move.l icache_state, %d0
- rts
-
- .data
-icache_state:
- .long 0 /* cache is diabled on inirialization */
-
-/*------------------------------------------------------------------------------*/
-
- .globl version_string
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
diff --git a/cpu/microblaze/Makefile b/cpu/microblaze/Makefile
deleted file mode 100644
index fd544254f0..0000000000
--- a/cpu/microblaze/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = cpu.o interrupts.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/microblaze/cpu.c b/cpu/microblaze/cpu.c
deleted file mode 100644
index 4d2b270b23..0000000000
--- a/cpu/microblaze/cpu.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * (C) Copyright 2004 Atmark Techno, Inc.
- *
- * Yasushi SHOJI <yashi@atmark-techno.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* EMPTY FILE */
diff --git a/cpu/microblaze/interrupts.c b/cpu/microblaze/interrupts.c
deleted file mode 100644
index ccf67e1721..0000000000
--- a/cpu/microblaze/interrupts.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * (C) Copyright 2004 Atmark Techno, Inc.
- *
- * Yasushi SHOJI <yashi@atmark-techno.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-void enable_interrupts(void)
-{
-}
-
-int disable_interrupts(void)
-{
- return 0;
-}
diff --git a/cpu/microblaze/start.S b/cpu/microblaze/start.S
deleted file mode 100644
index 7efdbb0970..0000000000
--- a/cpu/microblaze/start.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * (C) Copyright 2004 Atmark Techno, Inc.
- *
- * Yasushi SHOJI <yashi@atmark-techno.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-
- .text
- .global _start
-_start:
-
- addi r1, r0, CFG_SDRAM_BASE /* init stack pointer */
- addi r1, r1, CFG_SDRAM_SIZE /* set sp to high up */
-
- brai board_init
-
-1: bri 1b
diff --git a/cpu/mips/Makefile b/cpu/mips/Makefile
deleted file mode 100644
index 92dcc167e8..0000000000
--- a/cpu/mips/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# (C) Copyright 2003-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = asc_serial.o au1x00_serial.o au1x00_eth.o au1x00_usb_ohci.o \
- cpu.o interrupts.o incaip_clock.o
-SOBJS = incaip_wdt.o cache.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/mips/au1x00_eth.c b/cpu/mips/au1x00_eth.c
deleted file mode 100644
index 078e8328b6..0000000000
--- a/cpu/mips/au1x00_eth.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/* Only eth0 supported for now
- *
- * (C) Copyright 2003
- * Thomas.Lange@corelatus.se
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <config.h>
-
-#ifdef CONFIG_AU1X00
-
-#if defined(CFG_DISCOVER_PHY)
-#error "PHY not supported yet"
-/* We just assume that we are running 100FD for now */
-/* We all use switches, right? ;-) */
-#endif
-
-/* I assume ethernet behaves like au1000 */
-
-#ifdef CONFIG_AU1000
-/* Base address differ between cpu:s */
-#define ETH0_BASE AU1000_ETH0_BASE
-#define MAC0_ENABLE AU1000_MAC0_ENABLE
-#else
-#ifdef CONFIG_AU1100
-#define ETH0_BASE AU1100_ETH0_BASE
-#define MAC0_ENABLE AU1100_MAC0_ENABLE
-#else
-#ifdef CONFIG_AU1500
-#define ETH0_BASE AU1500_ETH0_BASE
-#define MAC0_ENABLE AU1500_MAC0_ENABLE
-#else
-#ifdef CONFIG_AU1550
-#define ETH0_BASE AU1550_ETH0_BASE
-#define MAC0_ENABLE AU1550_MAC0_ENABLE
-#else
-#error "No valid cpu set"
-#endif
-#endif
-#endif
-#endif
-
-#include <common.h>
-#include <malloc.h>
-#include <net.h>
-#include <command.h>
-#include <asm/io.h>
-#include <asm/au1x00.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_MII)
-#include <miiphy.h>
-#endif
-
-/* Ethernet Transmit and Receive Buffers */
-#define DBUF_LENGTH 1520
-#define PKT_MAXBUF_SIZE 1518
-
-static char txbuf[DBUF_LENGTH];
-
-static int next_tx;
-static int next_rx;
-
-/* 4 rx and 4 tx fifos */
-#define NO_OF_FIFOS 4
-
-typedef struct{
- u32 status;
- u32 addr;
- u32 len; /* Only used for tx */
- u32 not_used;
-} mac_fifo_t;
-
-mac_fifo_t mac_fifo[NO_OF_FIFOS];
-
-#define MAX_WAIT 1000
-
-static int au1x00_send(struct eth_device* dev, volatile void *packet, int length){
- volatile mac_fifo_t *fifo_tx =
- (volatile mac_fifo_t*)(MAC0_TX_DMA_ADDR+MAC_TX_BUFF0_STATUS);
- int i;
- int res;
-
- /* tx fifo should always be idle */
- fifo_tx[next_tx].len = length;
- fifo_tx[next_tx].addr = (virt_to_phys(packet))|TX_DMA_ENABLE;
- au_sync();
-
- udelay(1);
- i=0;
- while(!(fifo_tx[next_tx].addr&TX_T_DONE)){
- if(i>MAX_WAIT){
- printf("TX timeout\n");
- break;
- }
- udelay(1);
- i++;
- }
-
- /* Clear done bit */
- fifo_tx[next_tx].addr = 0;
- fifo_tx[next_tx].len = 0;
- au_sync();
-
- res = fifo_tx[next_tx].status;
-
- next_tx++;
- if(next_tx>=NO_OF_FIFOS){
- next_tx=0;
- }
- return(res);
-}
-
-static int au1x00_recv(struct eth_device* dev){
- volatile mac_fifo_t *fifo_rx =
- (volatile mac_fifo_t*)(MAC0_RX_DMA_ADDR+MAC_RX_BUFF0_STATUS);
-
- int length;
- u32 status;
-
- for(;;){
- if(!(fifo_rx[next_rx].addr&RX_T_DONE)){
- /* Nothing has been received */
- return(-1);
- }
-
- status = fifo_rx[next_rx].status;
-
- length = status&0x3FFF;
-
- if(status&RX_ERROR){
- printf("Rx error 0x%x\n", status);
- }
- else{
- /* Pass the packet up to the protocol layers. */
- NetReceive(NetRxPackets[next_rx], length - 4);
- }
-
- fifo_rx[next_rx].addr = (virt_to_phys(NetRxPackets[next_rx]))|RX_DMA_ENABLE;
-
- next_rx++;
- if(next_rx>=NO_OF_FIFOS){
- next_rx=0;
- }
- } /* for */
-
- return(0); /* Does anyone use this? */
-}
-
-static int au1x00_init(struct eth_device* dev, bd_t * bd){
-
- volatile u32 *macen = (volatile u32*)MAC0_ENABLE;
- volatile u32 *mac_ctrl = (volatile u32*)(ETH0_BASE+MAC_CONTROL);
- volatile u32 *mac_addr_high = (volatile u32*)(ETH0_BASE+MAC_ADDRESS_HIGH);
- volatile u32 *mac_addr_low = (volatile u32*)(ETH0_BASE+MAC_ADDRESS_LOW);
- volatile u32 *mac_mcast_high = (volatile u32*)(ETH0_BASE+MAC_MCAST_HIGH);
- volatile u32 *mac_mcast_low = (volatile u32*)(ETH0_BASE+MAC_MCAST_LOW);
- volatile mac_fifo_t *fifo_tx =
- (volatile mac_fifo_t*)(MAC0_TX_DMA_ADDR+MAC_TX_BUFF0_STATUS);
- volatile mac_fifo_t *fifo_rx =
- (volatile mac_fifo_t*)(MAC0_RX_DMA_ADDR+MAC_RX_BUFF0_STATUS);
- int i;
-
- next_tx = TX_GET_DMA_BUFFER(fifo_tx[0].addr);
- next_rx = RX_GET_DMA_BUFFER(fifo_rx[0].addr);
-
- /* We have to enable clocks before releasing reset */
- *macen = MAC_EN_CLOCK_ENABLE;
- udelay(10);
-
- /* Enable MAC0 */
- /* We have to release reset before accessing registers */
- *macen = MAC_EN_CLOCK_ENABLE|MAC_EN_RESET0|
- MAC_EN_RESET1|MAC_EN_RESET2;
- udelay(10);
-
- for(i=0;i<NO_OF_FIFOS;i++){
- fifo_tx[i].len = 0;
- fifo_tx[i].addr = virt_to_phys(&txbuf[0]);
- fifo_rx[i].addr = (virt_to_phys(NetRxPackets[i]))|RX_DMA_ENABLE;
- }
-
- /* Put mac addr in little endian */
-#define ea eth_get_dev()->enetaddr
- *mac_addr_high = (ea[5] << 8) | (ea[4] ) ;
- *mac_addr_low = (ea[3] << 24) | (ea[2] << 16) |
- (ea[1] << 8) | (ea[0] ) ;
-#undef ea
- *mac_mcast_low = 0;
- *mac_mcast_high = 0;
-
- /* Make sure the MAC buffer is in the correct endian mode */
-#ifdef __LITTLE_ENDIAN
- *mac_ctrl = MAC_FULL_DUPLEX;
- udelay(1);
- *mac_ctrl = MAC_FULL_DUPLEX|MAC_RX_ENABLE|MAC_TX_ENABLE;
-#else
- *mac_ctrl = MAC_BIG_ENDIAN|MAC_FULL_DUPLEX;
- udelay(1);
- *mac_ctrl = MAC_BIG_ENDIAN|MAC_FULL_DUPLEX|MAC_RX_ENABLE|MAC_TX_ENABLE;
-#endif
-
- return(1);
-}
-
-static void au1x00_halt(struct eth_device* dev){
-}
-
-int au1x00_enet_initialize(bd_t *bis){
- struct eth_device* dev;
-
- if ((dev = (struct eth_device*)malloc(sizeof *dev)) == NULL) {
- puts ("malloc failed\n");
- return 0;
- }
-
- memset(dev, 0, sizeof *dev);
-
- sprintf(dev->name, "Au1X00 ethernet");
- dev->iobase = 0;
- dev->priv = 0;
- dev->init = au1x00_init;
- dev->halt = au1x00_halt;
- dev->send = au1x00_send;
- dev->recv = au1x00_recv;
-
- eth_register(dev);
-
-#if (CONFIG_COMMANDS & CFG_CMD_MII)
- miiphy_register(dev->name,
- au1x00_miiphy_read, au1x00_miiphy_write);
-#endif
-
- return 1;
-}
-
-#if (CONFIG_COMMANDS & CFG_CMD_MII)
-int au1x00_miiphy_read(char *devname, unsigned char addr,
- unsigned char reg, unsigned short * value)
-{
- volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL);
- volatile u32 *mii_data_reg = (volatile u32*)(ETH0_BASE+MAC_MII_DATA);
- u32 mii_control;
- unsigned int timedout = 20;
-
- while (*mii_control_reg & MAC_MII_BUSY) {
- udelay(1000);
- if (--timedout == 0) {
- printf("au1x00_eth: miiphy_read busy timeout!!\n");
- return -1;
- }
- }
-
- mii_control = MAC_SET_MII_SELECT_REG(reg) |
- MAC_SET_MII_SELECT_PHY(addr) | MAC_MII_READ;
-
- *mii_control_reg = mii_control;
-
- timedout = 20;
- while (*mii_control_reg & MAC_MII_BUSY) {
- udelay(1000);
- if (--timedout == 0) {
- printf("au1x00_eth: miiphy_read busy timeout!!\n");
- return -1;
- }
- }
- *value = *mii_data_reg;
- return 0;
-}
-
-int au1x00_miiphy_write(char *devname, unsigned char addr,
- unsigned char reg, unsigned short value)
-{
- volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL);
- volatile u32 *mii_data_reg = (volatile u32*)(ETH0_BASE+MAC_MII_DATA);
- u32 mii_control;
- unsigned int timedout = 20;
-
- while (*mii_control_reg & MAC_MII_BUSY) {
- udelay(1000);
- if (--timedout == 0) {
- printf("au1x00_eth: miiphy_write busy timeout!!\n");
- return;
- }
- }
-
- mii_control = MAC_SET_MII_SELECT_REG(reg) |
- MAC_SET_MII_SELECT_PHY(addr) | MAC_MII_WRITE;
-
- *mii_data_reg = value;
- *mii_control_reg = mii_control;
- return 0;
-}
-#endif /* CONFIG_COMMANDS & CFG_CMD_MII */
-
-#endif /* CONFIG_AU1X00 */
diff --git a/cpu/mips/cache.S b/cpu/mips/cache.S
deleted file mode 100644
index 9033a1fadd..0000000000
--- a/cpu/mips/cache.S
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Cache-handling routined for MIPS 4K CPUs
- *
- * Copyright (c) 2003 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-#include <asm/regdef.h>
-#include <asm/mipsregs.h>
-#include <asm/addrspace.h>
-#include <asm/cacheops.h>
-
-
- /* 16KB is the maximum size of instruction and data caches on
- * MIPS 4K.
- */
-#define MIPS_MAX_CACHE_SIZE 0x4000
-
-
-/*
- * cacheop macro to automate cache operations
- * first some helpers...
- */
-#define _mincache(size, maxsize) \
- bltu size,maxsize,9f ; \
- move size,maxsize ; \
-9:
-
-#define _align(minaddr, maxaddr, linesize) \
- .set noat ; \
- subu AT,linesize,1 ; \
- not AT ; \
- and minaddr,AT ; \
- addu maxaddr,-1 ; \
- and maxaddr,AT ; \
- .set at
-
-/* general operations */
-#define doop1(op1) \
- cache op1,0(a0)
-#define doop2(op1, op2) \
- cache op1,0(a0) ; \
- nop ; \
- cache op2,0(a0)
-
-/* specials for cache initialisation */
-#define doop1lw(op1) \
- lw zero,0(a0)
-#define doop1lw1(op1) \
- cache op1,0(a0) ; \
- lw zero,0(a0) ; \
- cache op1,0(a0)
-#define doop121(op1,op2) \
- cache op1,0(a0) ; \
- nop; \
- cache op2,0(a0) ; \
- nop; \
- cache op1,0(a0)
-
-#define _oploopn(minaddr, maxaddr, linesize, tag, ops) \
- .set noreorder ; \
-10: doop##tag##ops ; \
- bne minaddr,maxaddr,10b ; \
- add minaddr,linesize ; \
- .set reorder
-
-/* finally the cache operation macros */
-#define vcacheopn(kva, n, cacheSize, cacheLineSize, tag, ops) \
- blez n,11f ; \
- addu n,kva ; \
- _align(kva, n, cacheLineSize) ; \
- _oploopn(kva, n, cacheLineSize, tag, ops) ; \
-11:
-
-#define icacheopn(kva, n, cacheSize, cacheLineSize, tag, ops) \
- _mincache(n, cacheSize); \
- blez n,11f ; \
- addu n,kva ; \
- _align(kva, n, cacheLineSize) ; \
- _oploopn(kva, n, cacheLineSize, tag, ops) ; \
-11:
-
-#define vcacheop(kva, n, cacheSize, cacheLineSize, op) \
- vcacheopn(kva, n, cacheSize, cacheLineSize, 1, (op))
-
-#define icacheop(kva, n, cacheSize, cacheLineSize, op) \
- icacheopn(kva, n, cacheSize, cacheLineSize, 1, (op))
-
-/*******************************************************************************
-*
-* mips_cache_reset - low level initialisation of the primary caches
-*
-* This routine initialises the primary caches to ensure that they
-* have good parity. It must be called by the ROM before any cached locations
-* are used to prevent the possibility of data with bad parity being written to
-* memory.
-* To initialise the instruction cache it is essential that a source of data
-* with good parity is available. This routine
-* will initialise an area of memory starting at location zero to be used as
-* a source of parity.
-*
-* RETURNS: N/A
-*
-*/
- .globl mips_cache_reset
- .ent mips_cache_reset
-mips_cache_reset:
-
- li t2, CFG_ICACHE_SIZE
- li t3, CFG_DCACHE_SIZE
- li t4, CONFIG_CACHELINE_SIZE
- move t5, t4
-
-
- li v0, MIPS_MAX_CACHE_SIZE
-
- /* Now clear that much memory starting from zero.
- */
-
- li a0, KSEG1
- addu a1, a0, v0
-
-2: sw zero, 0(a0)
- sw zero, 4(a0)
- sw zero, 8(a0)
- sw zero, 12(a0)
- sw zero, 16(a0)
- sw zero, 20(a0)
- sw zero, 24(a0)
- sw zero, 28(a0)
- addu a0, 32
- bltu a0, a1, 2b
-
- /* Set invalid tag.
- */
-
- mtc0 zero, CP0_TAGLO
-
- /*
- * The caches are probably in an indeterminate state,
- * so we force good parity into them by doing an
- * invalidate, load/fill, invalidate for each line.
- */
-
- /* Assume bottom of RAM will generate good parity for the cache.
- */
-
- li a0, K0BASE
- move a2, t2 # icacheSize
- move a3, t4 # icacheLineSize
- move a1, a2
- icacheopn(a0,a1,a2,a3,121,(Index_Store_Tag_I,Fill))
-
- /* To support Orion/R4600, we initialise the data cache in 3 passes.
- */
-
- /* 1: initialise dcache tags.
- */
-
- li a0, K0BASE
- move a2, t3 # dcacheSize
- move a3, t5 # dcacheLineSize
- move a1, a2
- icacheop(a0,a1,a2,a3,Index_Store_Tag_D)
-
- /* 2: fill dcache.
- */
-
- li a0, K0BASE
- move a2, t3 # dcacheSize
- move a3, t5 # dcacheLineSize
- move a1, a2
- icacheopn(a0,a1,a2,a3,1lw,(dummy))
-
- /* 3: clear dcache tags.
- */
-
- li a0, K0BASE
- move a2, t3 # dcacheSize
- move a3, t5 # dcacheLineSize
- move a1, a2
- icacheop(a0,a1,a2,a3,Index_Store_Tag_D)
-
- j ra
- .end mips_cache_reset
-
-
-/*******************************************************************************
-*
-* dcache_status - get cache status
-*
-* RETURNS: 0 - cache disabled; 1 - cache enabled
-*
-*/
- .globl dcache_status
- .ent dcache_status
-dcache_status:
-
- mfc0 v0, CP0_CONFIG
- andi v0, v0, 1
- j ra
-
- .end dcache_status
-
-/*******************************************************************************
-*
-* dcache_disable - disable cache
-*
-* RETURNS: N/A
-*
-*/
- .globl dcache_disable
- .ent dcache_disable
-dcache_disable:
-
- mfc0 t0, CP0_CONFIG
- li t1, -8
- and t0, t0, t1
- ori t0, t0, CONF_CM_UNCACHED
- mtc0 t0, CP0_CONFIG
- j ra
-
- .end dcache_disable
-
-
-/*******************************************************************************
-*
-* mips_cache_lock - lock RAM area pointed to by a0 in cache.
-*
-* RETURNS: N/A
-*
-*/
-#if defined(CONFIG_PURPLE)
-# define CACHE_LOCK_SIZE (CFG_DCACHE_SIZE/2)
-#else
-# define CACHE_LOCK_SIZE (CFG_DCACHE_SIZE)
-#endif
- .globl mips_cache_lock
- .ent mips_cache_lock
-mips_cache_lock:
- li a1, K0BASE - CACHE_LOCK_SIZE
- addu a0, a1
- li a2, CACHE_LOCK_SIZE
- li a3, CONFIG_CACHELINE_SIZE
- move a1, a2
- icacheop(a0,a1,a2,a3,0x1d)
-
- j ra
- .end mips_cache_lock
diff --git a/cpu/mips/config.mk b/cpu/mips/config.mk
deleted file mode 100644
index b29986e26b..0000000000
--- a/cpu/mips/config.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# (C) Copyright 2003
-# Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-v=$(shell \
-$(CROSS_COMPILE)as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')
-MIPSFLAGS=$(shell \
-if [ "$v" -lt "14" ]; then \
- echo "-mcpu=4kc"; \
-else \
- echo "-march=4kc -mtune=4kc"; \
-fi)
-
-ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
-ENDIANNESS = -EL
-else
-ENDIANNESS = -EB
-endif
-
-MIPSFLAGS += $(ENDIANNESS) -mabicalls
-
-PLATFORM_CPPFLAGS += $(MIPSFLAGS)
diff --git a/cpu/mips/cpu.c b/cpu/mips/cpu.c
deleted file mode 100644
index f48675e996..0000000000
--- a/cpu/mips/cpu.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/inca-ip.h>
-#include <asm/mipsregs.h>
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-#if defined(CONFIG_INCA_IP)
- *INCA_IP_WDT_RST_REQ = 0x3f;
-#elif defined(CONFIG_PURPLE) || defined(CONFIG_TB0229)
- void (*f)(void) = (void *) 0xbfc00000;
-
- f();
-#endif
- fprintf(stderr, "*** reset failed ***\n");
- return 0;
-}
-
-void flush_cache (ulong start_addr, ulong size)
-{
-
-}
-
-void write_one_tlb( int index, u32 pagemask, u32 hi, u32 low0, u32 low1 ){
- write_32bit_cp0_register(CP0_ENTRYLO0, low0);
- write_32bit_cp0_register(CP0_PAGEMASK, pagemask);
- write_32bit_cp0_register(CP0_ENTRYLO1, low1);
- write_32bit_cp0_register(CP0_ENTRYHI, hi);
- write_32bit_cp0_register(CP0_INDEX, index);
- tlb_write_indexed();
-}
diff --git a/cpu/mips/incaip_clock.c b/cpu/mips/incaip_clock.c
deleted file mode 100644
index d0515ca673..0000000000
--- a/cpu/mips/incaip_clock.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/inca-ip.h>
-
-
-/*******************************************************************************
-*
-* get_cpuclk - returns the frequency of the CPU.
-*
-* Gets the value directly from the INCA-IP hardware.
-*
-* RETURNS:
-* 150.000.000 for 150 MHz
-* 133.333.333 for 133 Mhz (= 400MHz/3)
-* 100.000.000 for 100 Mhz (= 400MHz/4)
-* NOTE:
-* This functions should be used by the hardware driver to get the correct
-* frequency of the CPU. Don't use the macros, which are set to init the CPU
-* frequency in the ROM code.
-*/
-uint incaip_get_cpuclk (void)
-{
- /*-------------------------------------------------------------------------*/
- /* CPU Clock Input Multiplexer (MUX I) */
- /* Multiplexer MUX I selects the maximum input clock to the CPU. */
- /*-------------------------------------------------------------------------*/
- if (*((volatile ulong *) INCA_IP_CGU_CGU_MUXCR) &
- INCA_IP_CGU_CGU_MUXCR_MUXI) {
- /* MUX I set to 150 MHz clock */
- return 150000000;
- } else {
- /* MUX I set to 100/133 MHz clock */
- if (*((volatile ulong *) INCA_IP_CGU_CGU_DIVCR) & 0x40) {
- /* Division value is 1/3, maximum CPU operating */
- /* frequency is 133.3 MHz */
- return 133333333;
- } else {
- /* Division value is 1/4, maximum CPU operating */
- /* frequency is 100 MHz */
- return 100000000;
- }
- }
-}
-
-/*******************************************************************************
-*
-* get_fpiclk - returns the frequency of the FPI bus.
-*
-* Gets the value directly from the INCA-IP hardware.
-*
-* RETURNS: Frquency in Hz
-*
-* NOTE:
-* This functions should be used by the hardware driver to get the correct
-* frequency of the CPU. Don't use the macros, which are set to init the CPU
-* frequency in the ROM code.
-* The calculation for the
-*/
-uint incaip_get_fpiclk (void)
-{
- uint clkCPU;
-
- clkCPU = incaip_get_cpuclk ();
-
- switch (*((volatile ulong *) INCA_IP_CGU_CGU_DIVCR) & 0xC) {
- case 0x4:
- return clkCPU >> 1; /* devided by 2 */
- break;
- case 0x8:
- return clkCPU >> 2; /* devided by 4 */
- break;
- default:
- return clkCPU;
- break;
- }
-}
-
-int incaip_set_cpuclk (void)
-{
- extern void ebu_init(long);
- extern void cgu_init(long);
- extern void sdram_init(long);
- char tmp[64];
- ulong cpuclk;
-
- if (getenv_r ("cpuclk", tmp, sizeof (tmp)) > 0) {
- cpuclk = simple_strtoul (tmp, NULL, 10) * 1000000;
- cgu_init (cpuclk);
- ebu_init (cpuclk);
- sdram_init (cpuclk);
- }
-
- return 0;
-}
diff --git a/cpu/mips/incaip_wdt.S b/cpu/mips/incaip_wdt.S
deleted file mode 100644
index 71adaa19de..0000000000
--- a/cpu/mips/incaip_wdt.S
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * INCA-IP Watchdog timer management code.
- *
- * Copyright (c) 2003 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-#include <asm/regdef.h>
-
-
-#define WD_BASE 0xb8000000
-#define WD_CON0(value) 0x0020(value)
-#define WD_CON1(value) 0x0024(value)
-#define WD_DISABLE 0x00000008
-#define WD_ENABLE 0x00000000
-#define WD_WRITE_PW 0xFFFC00F8
-#define WD_WRITE_ENDINIT 0xFFFC00F3
-#define WD_WRITE_INIT 0xFFFC00F2
-
-
- .globl disable_incaip_wdt
-disable_incaip_wdt:
- li t0, WD_BASE
-
- /* Calculate password.
- */
- lw t2, WD_CON1(t0)
- and t2, 0xC
-
- lw t3, WD_CON0(t0)
- and t3, 0xFFFFFF01
-
- or t3, t2
- or t3, 0xF0
-
- sw t3, WD_CON0(t0) /* write password */
-
- /* Clear ENDINIT.
- */
- li t1, WD_WRITE_INIT
- sw t1, WD_CON0(t0)
-
-
- li t1, WD_DISABLE
- sw t1, WD_CON1(t0) /* disable watchdog */
- li t1, WD_WRITE_PW
- sw t1, WD_CON0(t0) /* write password */
- li t1, WD_WRITE_ENDINIT
- sw t1, WD_CON0(t0) /* end command */
-
- j ra
- nop
diff --git a/cpu/mips/interrupts.c b/cpu/mips/interrupts.c
deleted file mode 100644
index 87f7a9f7e6..0000000000
--- a/cpu/mips/interrupts.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-void enable_interrupts(void)
-{
-}
-
-int disable_interrupts(void)
-{
- return 0;
-}
diff --git a/cpu/mips/start.S b/cpu/mips/start.S
deleted file mode 100644
index e91e2137d7..0000000000
--- a/cpu/mips/start.S
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Startup Code for MIPS32 CPU-core
- *
- * Copyright (c) 2003 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-#include <asm/regdef.h>
-#include <asm/mipsregs.h>
-
-
-#define RVECENT(f,n) \
- b f; nop
-#define XVECENT(f,bev) \
- b f ; \
- li k0,bev
-
- .set noreorder
-
- .globl _start
- .text
-_start:
- RVECENT(reset,0) /* U-boot entry point */
- RVECENT(reset,1) /* software reboot */
-#if defined(CONFIG_INCA_IP)
- .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
- .word 0x00000000 /* phase of the flash */
-#elif defined(CONFIG_PURPLE)
- .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
- .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
-#else
- RVECENT(romReserved,2)
-#endif
- RVECENT(romReserved,3)
- RVECENT(romReserved,4)
- RVECENT(romReserved,5)
- RVECENT(romReserved,6)
- RVECENT(romReserved,7)
- RVECENT(romReserved,8)
- RVECENT(romReserved,9)
- RVECENT(romReserved,10)
- RVECENT(romReserved,11)
- RVECENT(romReserved,12)
- RVECENT(romReserved,13)
- RVECENT(romReserved,14)
- RVECENT(romReserved,15)
- RVECENT(romReserved,16)
- RVECENT(romReserved,17)
- RVECENT(romReserved,18)
- RVECENT(romReserved,19)
- RVECENT(romReserved,20)
- RVECENT(romReserved,21)
- RVECENT(romReserved,22)
- RVECENT(romReserved,23)
- RVECENT(romReserved,24)
- RVECENT(romReserved,25)
- RVECENT(romReserved,26)
- RVECENT(romReserved,27)
- RVECENT(romReserved,28)
- RVECENT(romReserved,29)
- RVECENT(romReserved,30)
- RVECENT(romReserved,31)
- RVECENT(romReserved,32)
- RVECENT(romReserved,33)
- RVECENT(romReserved,34)
- RVECENT(romReserved,35)
- RVECENT(romReserved,36)
- RVECENT(romReserved,37)
- RVECENT(romReserved,38)
- RVECENT(romReserved,39)
- RVECENT(romReserved,40)
- RVECENT(romReserved,41)
- RVECENT(romReserved,42)
- RVECENT(romReserved,43)
- RVECENT(romReserved,44)
- RVECENT(romReserved,45)
- RVECENT(romReserved,46)
- RVECENT(romReserved,47)
- RVECENT(romReserved,48)
- RVECENT(romReserved,49)
- RVECENT(romReserved,50)
- RVECENT(romReserved,51)
- RVECENT(romReserved,52)
- RVECENT(romReserved,53)
- RVECENT(romReserved,54)
- RVECENT(romReserved,55)
- RVECENT(romReserved,56)
- RVECENT(romReserved,57)
- RVECENT(romReserved,58)
- RVECENT(romReserved,59)
- RVECENT(romReserved,60)
- RVECENT(romReserved,61)
- RVECENT(romReserved,62)
- RVECENT(romReserved,63)
- XVECENT(romExcHandle,0x200) /* bfc00200: R4000 tlbmiss vector */
- RVECENT(romReserved,65)
- RVECENT(romReserved,66)
- RVECENT(romReserved,67)
- RVECENT(romReserved,68)
- RVECENT(romReserved,69)
- RVECENT(romReserved,70)
- RVECENT(romReserved,71)
- RVECENT(romReserved,72)
- RVECENT(romReserved,73)
- RVECENT(romReserved,74)
- RVECENT(romReserved,75)
- RVECENT(romReserved,76)
- RVECENT(romReserved,77)
- RVECENT(romReserved,78)
- RVECENT(romReserved,79)
- XVECENT(romExcHandle,0x280) /* bfc00280: R4000 xtlbmiss vector */
- RVECENT(romReserved,81)
- RVECENT(romReserved,82)
- RVECENT(romReserved,83)
- RVECENT(romReserved,84)
- RVECENT(romReserved,85)
- RVECENT(romReserved,86)
- RVECENT(romReserved,87)
- RVECENT(romReserved,88)
- RVECENT(romReserved,89)
- RVECENT(romReserved,90)
- RVECENT(romReserved,91)
- RVECENT(romReserved,92)
- RVECENT(romReserved,93)
- RVECENT(romReserved,94)
- RVECENT(romReserved,95)
- XVECENT(romExcHandle,0x300) /* bfc00300: R4000 cache vector */
- RVECENT(romReserved,97)
- RVECENT(romReserved,98)
- RVECENT(romReserved,99)
- RVECENT(romReserved,100)
- RVECENT(romReserved,101)
- RVECENT(romReserved,102)
- RVECENT(romReserved,103)
- RVECENT(romReserved,104)
- RVECENT(romReserved,105)
- RVECENT(romReserved,106)
- RVECENT(romReserved,107)
- RVECENT(romReserved,108)
- RVECENT(romReserved,109)
- RVECENT(romReserved,110)
- RVECENT(romReserved,111)
- XVECENT(romExcHandle,0x380) /* bfc00380: R4000 general vector */
- RVECENT(romReserved,113)
- RVECENT(romReserved,114)
- RVECENT(romReserved,115)
- RVECENT(romReserved,116)
- RVECENT(romReserved,116)
- RVECENT(romReserved,118)
- RVECENT(romReserved,119)
- RVECENT(romReserved,120)
- RVECENT(romReserved,121)
- RVECENT(romReserved,122)
- RVECENT(romReserved,123)
- RVECENT(romReserved,124)
- RVECENT(romReserved,125)
- RVECENT(romReserved,126)
- RVECENT(romReserved,127)
-
- /* We hope there are no more reserved vectors!
- * 128 * 8 == 1024 == 0x400
- * so this is address R_VEC+0x400 == 0xbfc00400
- */
-#ifdef CONFIG_PURPLE
-/* 0xbfc00400 */
- .word 0xdc870000
- .word 0xfca70000
- .word 0x20840008
- .word 0x20a50008
- .word 0x20c6ffff
- .word 0x14c0fffa
- .word 0x00000000
- .word 0x03e00008
- .word 0x00000000
- .word 0x00000000
-/* 0xbfc00428 */
- .word 0xdc870000
- .word 0xfca70000
- .word 0x20840008
- .word 0x20a50008
- .word 0x20c6ffff
- .word 0x14c0fffa
- .word 0x00000000
- .word 0x03e00008
- .word 0x00000000
- .word 0x00000000
-#endif /* CONFIG_PURPLE */
- .align 4
-reset:
-
- /* Clear watch registers.
- */
- mtc0 zero, CP0_WATCHLO
- mtc0 zero, CP0_WATCHHI
-
- /* STATUS register */
-#ifdef CONFIG_TB0229
- li k0, ST0_CU0
-#else
- mfc0 k0, CP0_STATUS
-#endif
- li k1, ~ST0_IE
- and k0, k1
- mtc0 k0, CP0_STATUS
-
- /* CAUSE register */
- mtc0 zero, CP0_CAUSE
-
- /* Init Timer */
- mtc0 zero, CP0_COUNT
- mtc0 zero, CP0_COMPARE
-
- /* CONFIG0 register */
- li t0, CONF_CM_UNCACHED
- mtc0 t0, CP0_CONFIG
-
- /* Initialize GOT pointer.
- */
- bal 1f
- nop
- .word _GLOBAL_OFFSET_TABLE_
- 1:
- move gp, ra
- lw t1, 0(ra)
- move gp, t1
-
-#ifdef CONFIG_INCA_IP
- /* Disable INCA-IP Watchdog.
- */
- la t9, disable_incaip_wdt
- jalr t9
- nop
-#endif
-
- /* Initialize any external memory.
- */
- la t9, lowlevel_init
- jalr t9
- nop
-
- /* Initialize caches...
- */
- la t9, mips_cache_reset
- jalr t9
- nop
-
- /* ... and enable them.
- */
- li t0, CONF_CM_CACHABLE_NONCOHERENT
- mtc0 t0, CP0_CONFIG
-
-
- /* Set up temporary stack.
- */
- li a0, CFG_INIT_SP_OFFSET
- la t9, mips_cache_lock
- jalr t9
- nop
-
- li t0, CFG_SDRAM_BASE + CFG_INIT_SP_OFFSET
- la sp, 0(t0)
-
- la t9, board_init_f
- j t9
- nop
-
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * a0 = addr_sp
- * a1 = gd
- * a2 = destination address
- */
- .globl relocate_code
- .ent relocate_code
-relocate_code:
- move sp, a0 /* Set new stack pointer */
-
- li t0, CFG_MONITOR_BASE
- la t3, in_ram
- lw t2, -12(t3) /* t2 <-- uboot_end_data */
- move t1, a2
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
- */
- move t6, gp
- sub gp, CFG_MONITOR_BASE
- add gp, a2 /* gp now adjusted */
- sub t6, gp, t6 /* t6 <-- relocation offset */
-
- /*
- * t0 = source address
- * t1 = target address
- * t2 = source end address
- */
- /* On the purple board we copy the code earlier in a special way
- * in order to solve flash problems
- */
-#ifndef CONFIG_PURPLE
-1:
- lw t3, 0(t0)
- sw t3, 0(t1)
- addu t0, 4
- ble t0, t2, 1b
- addu t1, 4 /* delay slot */
-#endif
-
- /* If caches were enabled, we would have to flush them here.
- */
-
- /* Jump to where we've relocated ourselves.
- */
- addi t0, a2, in_ram - _start
- j t0
- nop
-
- .word uboot_end_data
- .word uboot_end
- .word num_got_entries
-
-in_ram:
- /* Now we want to update GOT.
- */
- lw t3, -4(t0) /* t3 <-- num_got_entries */
- addi t4, gp, 8 /* Skipping first two entries. */
- li t2, 2
-1:
- lw t1, 0(t4)
- beqz t1, 2f
- add t1, t6
- sw t1, 0(t4)
-2:
- addi t2, 1
- blt t2, t3, 1b
- addi t4, 4 /* delay slot */
-
- /* Clear BSS.
- */
- lw t1, -12(t0) /* t1 <-- uboot_end_data */
- lw t2, -8(t0) /* t2 <-- uboot_end */
- add t1, t6 /* adjust pointers */
- add t2, t6
-
- sub t1, 4
-1: addi t1, 4
- bltl t1, t2, 1b
- sw zero, 0(t1) /* delay slot */
-
- move a0, a1
- la t9, board_init_r
- j t9
- move a1, a2 /* delay slot */
-
- .end relocate_code
-
-
- /* Exception handlers.
- */
-romReserved:
- b romReserved
-
-romExcHandle:
- b romExcHandle
diff --git a/cpu/mpc5xx/Makefile b/cpu/mpc5xx/Makefile
deleted file mode 100644
index 8aab0189d7..0000000000
--- a/cpu/mpc5xx/Makefile
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# (C) Copyright 2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# (C) Copyright 2003
-# Martin Winistoerfer, martinwinistoerfer@gmx.ch.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-#
-# File: cpu/mpc5xx/Makefile
-#
-# Discription: Makefile to build mpc5xx cpu configuration.
-# Will include top config.mk which itselfs
-# uses the definitions made in cpu/mpc5xx/config.mk
-#
-
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = serial.o cpu.o cpu_init.o interrupts.o traps.o speed.o spi.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/mpc5xx/config.mk b/cpu/mpc5xx/config.mk
deleted file mode 100644
index 5b26a76b3e..0000000000
--- a/cpu/mpc5xx/config.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# (C) Copyright 2003
-# Martin Winistoerfer, martinwinistoerfer@gmx.ch.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-#
-# File: config.mk
-#
-# Discription: compiler flags and make definitions
-#
-
-
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_5xx -ffixed-r2 -ffixed-r29 -mpowerpc -msoft-float
diff --git a/cpu/mpc5xx/cpu.c b/cpu/mpc5xx/cpu.c
deleted file mode 100644
index 4bef90c48a..0000000000
--- a/cpu/mpc5xx/cpu.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * (C) Copyright 2003
- * Martin Winistoerfer, martinwinistoerfer@gmx.ch.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation,
- */
-
-/*
- * File: cpu.c
- *
- * Discription: Some cpu specific function for watchdog,
- * cpu version test, clock setting ...
- *
- */
-
-
-#include <common.h>
-#include <watchdog.h>
-#include <command.h>
-#include <mpc5xx.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if (defined(CONFIG_MPC555))
-# define ID_STR "MPC555/556"
-
-/*
- * Check version of cpu with Processor Version Register (PVR)
- */
-static int check_cpu_version (long clock, uint pvr, uint immr)
-{
- char buf[32];
- /* The highest 16 bits should be 0x0002 for a MPC555/556 */
- if ((pvr >> 16) == 0x0002) {
- printf (" " ID_STR " Version %x", (pvr >> 16));
- printf (" at %s MHz:", strmhz (buf, clock));
- } else {
- printf ("Not supported cpu version");
- return -1;
- }
- return 0;
-}
-#endif /* CONFIG_MPC555 */
-
-
-/*
- * Check version of mpc5xx
- */
-int checkcpu (void)
-{
- ulong clock = gd->cpu_clk;
- uint immr = get_immr (0); /* Return full IMMR contents */
- uint pvr = get_pvr (); /* Retrieve PVR register */
-
- puts ("CPU: ");
-
- return check_cpu_version (clock, pvr, immr);
-}
-
-/*
- * Called by macro WATCHDOG_RESET
- */
-#if defined(CONFIG_WATCHDOG)
-void watchdog_reset (void)
-{
- int re_enable = disable_interrupts ();
-
- reset_5xx_watchdog ((immap_t *) CFG_IMMR);
- if (re_enable)
- enable_interrupts ();
-}
-
-/*
- * Will clear software reset
- */
-void reset_5xx_watchdog (volatile immap_t * immr)
-{
- /* Use the MPC5xx Internal Watchdog */
- immr->im_siu_conf.sc_swsr = 0x556c; /* Prevent SW time-out */
- immr->im_siu_conf.sc_swsr = 0xaa39;
-}
-
-#endif /* CONFIG_WATCHDOG */
-
-
-/*
- * Get timebase clock frequency
- */
-unsigned long get_tbclk (void)
-{
- volatile immap_t *immr = (volatile immap_t *) CFG_IMMR;
- ulong oscclk, factor;
-
- if (immr->im_clkrst.car_sccr & SCCR_TBS) {
- return (gd->cpu_clk / 16);
- }
-
- factor = (((CFG_PLPRCR) & PLPRCR_MF_MSK) >> PLPRCR_MF_SHIFT) + 1;
-
- oscclk = gd->cpu_clk / factor;
-
- if ((immr->im_clkrst.car_sccr & SCCR_RTSEL) == 0 || factor > 2) {
- return (oscclk / 4);
- }
- return (oscclk / 16);
-}
-
-void dcache_enable (void)
-{
- return;
-}
-
-void dcache_disable (void)
-{
- return;
-}
-
-int dcache_status (void)
-{
- return 0; /* always off */
-}
-
-/*
- * Reset board
- */
-int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
-{
-#if defined(CONFIG_PATI)
- volatile ulong *addr = (ulong *) CFG_RESET_ADDRESS;
- *addr = 1;
-#else
- ulong addr;
-
- /* Interrupts off, enable reset */
- __asm__ volatile (" mtspr 81, %r0 \n\t"
- " mfmsr %r3 \n\t"
- " rlwinm %r31,%r3,0,25,23\n\t"
- " mtmsr %r31 \n\t");
- /*
- * Trying to execute the next instruction at a non-existing address
- * should cause a machine check, resulting in reset
- */
-#ifdef CFG_RESET_ADDRESS
- addr = CFG_RESET_ADDRESS;
-#else
- /*
- * note: when CFG_MONITOR_BASE points to a RAM address, CFG_MONITOR_BASE * - sizeof (ulong) is usually a valid address. Better pick an address
- * known to be invalid on your system and assign it to CFG_RESET_ADDRESS.
- * "(ulong)-1" used to be a good choice for many systems...
- */
- addr = CFG_MONITOR_BASE - sizeof (ulong);
-#endif
- ((void (*) (void)) addr) ();
-#endif /* #if defined(CONFIG_PATI) */
- return 1;
-}
diff --git a/cpu/mpc5xx/cpu_init.c b/cpu/mpc5xx/cpu_init.c
deleted file mode 100644
index f4cd24bf7c..0000000000
--- a/cpu/mpc5xx/cpu_init.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * (C) Copyright 2003 Martin Winistoerfer, martinwinistoerfer@gmx.ch.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation,
- */
-
-/*
- * File: cpu_init.c
- *
- * Discription: Contains initialisation functions to setup
- * the cpu properly
- *
- */
-
-#include <common.h>
-#include <mpc5xx.h>
-#include <watchdog.h>
-
-/*
- * Setup essential cpu registers to run
- */
-void cpu_init_f (volatile immap_t * immr)
-{
- volatile memctl5xx_t *memctl = &immr->im_memctl;
- ulong reg;
-
- /* SYPCR - contains watchdog control. This will enable watchdog */
- /* if CONFIG_WATCHDOG is set */
- immr->im_siu_conf.sc_sypcr = CFG_SYPCR;
-
-#if defined(CONFIG_WATCHDOG)
- reset_5xx_watchdog (immr);
-#endif
-
- /* SIUMCR - contains debug pin configuration */
- immr->im_siu_conf.sc_siumcr |= CFG_SIUMCR;
-
- /* Initialize timebase. Unlock TBSCRK */
- immr->im_sitk.sitk_tbscrk = KAPWR_KEY;
- immr->im_sit.sit_tbscr = CFG_TBSCR;
-
- /* Full IMB bus speed */
- immr->im_uimb.uimb_umcr = CFG_UMCR;
-
- /* Time base and decrementer will be enables (TBE) */
- /* in init_timebase() in time.c called from board_init_f(). */
-
- /* Initialize the PIT. Unlock PISCRK */
- immr->im_sitk.sitk_piscrk = KAPWR_KEY;
- immr->im_sit.sit_piscr = CFG_PISCR;
-
-#if !defined(CONFIG_PATI)
- /* PATI sest PLL in start.S */
- /* PLL (CPU clock) settings */
- immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
-
- /* If CFG_PLPRCR (set in the various *_config.h files) tries to
- * set the MF field, then just copy CFG_PLPRCR over car_plprcr,
- * otherwise OR in CFG_PLPRCR so we do not change the currentMF
- * field value.
- */
-#if ((CFG_PLPRCR & PLPRCR_MF_MSK) != 0)
- reg = CFG_PLPRCR; /* reset control bits */
-#else
- reg = immr->im_clkrst.car_plprcr;
- reg &= PLPRCR_MF_MSK; /* isolate MF field */
- reg |= CFG_PLPRCR; /* reset control bits */
-#endif
- immr->im_clkrst.car_plprcr = reg;
-
-#endif /* !defined(CONFIG_PATI) */
-
- /* System integration timers. CFG_MASK has EBDF configuration */
- immr->im_clkrstk.cark_sccrk = KAPWR_KEY;
- reg = immr->im_clkrst.car_sccr;
- reg &= SCCR_MASK;
- reg |= CFG_SCCR;
- immr->im_clkrst.car_sccr = reg;
-
- /* Memory Controller */
- memctl->memc_br0 = CFG_BR0_PRELIM;
- memctl->memc_or0 = CFG_OR0_PRELIM;
-
-#if (defined(CFG_OR1_PRELIM) && defined(CFG_BR1_PRELIM))
- memctl->memc_or1 = CFG_OR1_PRELIM;
- memctl->memc_br1 = CFG_BR1_PRELIM;
-#endif
-
-#if defined(CFG_OR2_PRELIM) && defined(CFG_BR2_PRELIM)
- memctl->memc_or2 = CFG_OR2_PRELIM;
- memctl->memc_br2 = CFG_BR2_PRELIM;
-#endif
-
-#if defined(CFG_OR3_PRELIM) && defined(CFG_BR3_PRELIM)
- memctl->memc_or3 = CFG_OR3_PRELIM;
- memctl->memc_br3 = CFG_BR3_PRELIM;
-#endif
-
-}
-
-/*
- * Initialize higher level parts of cpu
- */
-int cpu_init_r (void)
-{
- /* Nothing to do at the moment */
- return (0);
-}
diff --git a/cpu/mpc5xx/interrupts.c b/cpu/mpc5xx/interrupts.c
deleted file mode 100644
index 5ee6703a62..0000000000
--- a/cpu/mpc5xx/interrupts.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * (C) Copyright 2000-2002 Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- * (C) Copyright 2003 Martin Winistoerfer, martinwinistoerfer@gmx.ch.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation,
- */
-
-/*
- * File: interrupt.c
- *
- * Discription: Contains interrupt routines needed by U-Boot
- *
- */
-
-#include <common.h>
-#include <command.h>
-#include <mpc5xx.h>
-#include <asm/processor.h>
-
-#if defined(CONFIG_PATI)
-/* PATI uses IRQs for PCI doorbell */
-#undef NR_IRQS
-#define NR_IRQS 16
-#endif
-
-struct interrupt_action {
- interrupt_handler_t *handler;
- void *arg;
- int count;
-};
-
-static struct interrupt_action irq_vecs[NR_IRQS];
-
-/*
- * Initialise interrupts
- */
-
-int interrupt_init_cpu (ulong *decrementer_count)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- int vec;
-
- /* Decrementer used here for status led */
- *decrementer_count = get_tbclk () / CFG_HZ;
-
- /* Disable all interrupts */
- immr->im_siu_conf.sc_simask = 0;
- for (vec=0; vec<NR_IRQS; vec++) {
- irq_vecs[vec].handler = NULL;
- irq_vecs[vec].arg = NULL;
- irq_vecs[vec].count = 0;
- }
-
- return (0);
-}
-
-/*
- * Handle external interrupts
- */
-void external_interrupt (struct pt_regs *regs)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- int irq;
- ulong simask, newmask;
- ulong vec, v_bit;
-
- /*
- * read the SIVEC register and shift the bits down
- * to get the irq number
- */
- vec = immr->im_siu_conf.sc_sivec;
- irq = vec >> 26;
- v_bit = 0x80000000UL >> irq;
-
- /*
- * Read Interrupt Mask Register and Mask Interrupts
- */
- simask = immr->im_siu_conf.sc_simask;
- newmask = simask & (~(0xFFFF0000 >> irq));
- immr->im_siu_conf.sc_simask = newmask;
-
- if (!(irq & 0x1)) { /* External Interrupt ? */
- ulong siel;
-
- /*
- * Read Interrupt Edge/Level Register
- */
- siel = immr->im_siu_conf.sc_siel;
-
- if (siel & v_bit) { /* edge triggered interrupt ? */
- /*
- * Rewrite SIPEND Register to clear interrupt
- */
- immr->im_siu_conf.sc_sipend = v_bit;
- }
- }
-
- if (irq_vecs[irq].handler != NULL) {
- irq_vecs[irq].handler (irq_vecs[irq].arg);
- } else {
- printf ("\nBogus External Interrupt IRQ %d Vector %ld\n",
- irq, vec);
- /* turn off the bogus interrupt to avoid it from now */
- simask &= ~v_bit;
- }
- /*
- * Re-Enable old Interrupt Mask
- */
- immr->im_siu_conf.sc_simask = simask;
-}
-
-/*
- * Install and free an interrupt handler
- */
-void irq_install_handler (int vec, interrupt_handler_t * handler,
- void *arg)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- /* SIU interrupt */
- if (irq_vecs[vec].handler != NULL) {
- printf ("SIU interrupt %d 0x%x\n",
- vec,
- (uint) handler);
- }
- irq_vecs[vec].handler = handler;
- irq_vecs[vec].arg = arg;
- immr->im_siu_conf.sc_simask |= 1 << (31 - vec);
-}
-
-void irq_free_handler (int vec)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- /* SIU interrupt */
- immr->im_siu_conf.sc_simask &= ~(1 << (31 - vec));
- irq_vecs[vec].handler = NULL;
- irq_vecs[vec].arg = NULL;
-}
-
-/*
- * Timer interrupt - gets called when bit 0 of DEC changes from
- * 0. Decrementer is enabled with bit TBE in TBSCR.
- */
-void timer_interrupt_cpu (struct pt_regs *regs)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
- /* Reset Timer Status Bit and Timers Interrupt Status */
- immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
- __asm__ ("nop");
- immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST;
-
- return;
-}
-
-#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
-/*******************************************************************************
- *
- * irqinfo - print information about IRQs
- *
- */
-int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- int vec;
-
- printf ("\nInterrupt-Information:\n");
- printf ("Nr Routine Arg Count\n");
-
- for (vec=0; vec<NR_IRQS; vec++) {
- if (irq_vecs[vec].handler != NULL) {
- printf ("%02d %08lx %08lx %d\n",
- vec,
- (ulong)irq_vecs[vec].handler,
- (ulong)irq_vecs[vec].arg,
- irq_vecs[vec].count);
- }
- }
- return 0;
-}
-
-
-#endif /* CONFIG_COMMANDS & CFG_CMD_IRQ */
diff --git a/cpu/mpc5xx/reginfo.c b/cpu/mpc5xx/reginfo.c
deleted file mode 100644
index e4765fe2b3..0000000000
--- a/cpu/mpc5xx/reginfo.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <common.h>
-
-void reginfo(void)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile memctl5xx_t *memctl = &immap->im_memctl;
- volatile sysconf5xx_t *sysconf = &immap->im_siu_conf;
- volatile sit5xx_t *timers = &immap->im_sit;
- volatile car5xx_t *car = &immap->im_clkrst;
- volatile uimb5xx_t *uimb = &immap->im_uimb;
-
- puts ("\nSystem Configuration registers\n");
- printf("\tIMMR\t0x%08X\tSIUMCR\t0x%08X \n", get_immr(0), sysconf->sc_siumcr);
- printf("\tSYPCR\t0x%08X\tSWSR\t0x%04X \n" ,sysconf->sc_sypcr, sysconf->sc_swsr);
- printf("\tSIPEND\t0x%08X\tSIMASK\t0x%08X \n", sysconf->sc_sipend, sysconf->sc_simask);
- printf("\tSIEL\t0x%08X\tSIVEC\t0x%08X \n", sysconf->sc_siel, sysconf->sc_sivec);
- printf("\tTESR\t0x%08X\n", sysconf->sc_tesr);
-
- puts ("\nMemory Controller Registers\n");
- printf("\tBR0\t0x%08X\tOR0\t0x%08X \n", memctl->memc_br0, memctl->memc_or0);
- printf("\tBR1\t0x%08X\tOR1\t0x%08X \n", memctl->memc_br1, memctl->memc_or1);
- printf("\tBR2\t0x%08X\tOR2\t0x%08X \n", memctl->memc_br2, memctl->memc_or2);
- printf("\tBR3\t0x%08X\tOR3\t0x%08X \n", memctl->memc_br3, memctl->memc_or3);
- printf("\tDMBR\t0x%08X\tDMOR\t0x%08X \n", memctl->memc_dmbr, memctl->memc_dmor );
- printf("\tMSTAT\t0x%08X\n", memctl->memc_mstat);
-
- puts ("\nSystem Integration Timers\n");
- printf("\tTBSCR\t0x%08X\tRTCSC\t0x%08X \n", timers->sit_tbscr, timers->sit_rtcsc);
- printf("\tPISCR\t0x%08X \n", timers->sit_piscr);
-
- puts ("\nClocks and Reset\n");
- printf("\tSCCR\t0x%08X\tPLPRCR\t0x%08X \n", car->car_sccr, car->car_plprcr);
-
- puts ("\nU-Bus to IMB3 Bus Interface\n");
- printf("\tUMCR\t0x%08X\tUIPEND\t0x%08X \n", uimb->uimb_umcr, uimb->uimb_uipend);
- puts ("\n\n");
-}
diff --git a/cpu/mpc5xx/speed.c b/cpu/mpc5xx/speed.c
deleted file mode 100644
index 6a1fa155e2..0000000000
--- a/cpu/mpc5xx/speed.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * (C) Copyright 2003
- * Martin Winistoerfer, martinwinistoerfer@gmx.ch.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation,
- */
-
-/*
- * File: speed.c
- *
- * Discription: Provides cpu speed calculation
- *
- */
-
-#include <common.h>
-#include <mpc5xx.h>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/*
- * Get cpu and bus clock
- */
-int get_clocks (void)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
-#ifndef CONFIG_5xx_GCLK_FREQ
- uint divf = (immr->im_clkrst.car_plprcr & PLPRCR_DIVF_MSK);
- uint mf = ((immr->im_clkrst.car_plprcr & PLPRCR_MF_MSK) >> PLPRCR_MF_SHIFT);
- ulong vcoout;
-
- vcoout = (CFG_OSC_CLK / (divf + 1)) * (mf + 1) * 2;
- if(immr->im_clkrst.car_plprcr & PLPRCR_CSRC_MSK) {
- gd->cpu_clk = vcoout / (2^(((immr->im_clkrst.car_sccr & SCCR_DFNL_MSK) >> SCCR_DFNL_SHIFT) + 1));
- } else {
- gd->cpu_clk = vcoout / (2^(immr->im_clkrst.car_sccr & SCCR_DFNH_MSK));
- }
-
-#else /* CONFIG_5xx_GCLK_FREQ */
- gd->bus_clk = CONFIG_5xx_GCLK_FREQ;
-#endif /* CONFIG_5xx_GCLK_FREQ */
-
- if ((immr->im_clkrst.car_sccr & SCCR_EBDF11) == 0) {
- /* No Bus Divider active */
- gd->bus_clk = gd->cpu_clk;
- } else {
- /* CLKOUT is GCLK / 2 */
- gd->bus_clk = gd->cpu_clk / 2;
- }
- return (0);
-}
diff --git a/cpu/mpc5xx/spi.c b/cpu/mpc5xx/spi.c
deleted file mode 100644
index 81c9ddbd4e..0000000000
--- a/cpu/mpc5xx/spi.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
- * Copyright (c) 2001 Navin Boppuri / Prashant Patel
- * <nboppuri@trinetcommunication.com>,
- * <pmpatel@trinetcommunication.com>
- * Copyright (c) 2001 Gerd Mennchen <Gerd.Mennchen@icn.siemens.de>
- * Copyright (c) 2001 Wolfgang Denk, DENX Software Engineering, <wd@denx.de>.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * MPC5xx CPM SPI interface.
- *
- * Parts of this code are probably not portable and/or specific to
- * the board which I used for the tests. Please send fixes/complaints
- * to wd@denx.de
- *
- * Ported to MPC5xx
- * Copyright (c) 2003 Denis Peter, MPL AG Switzerland, d.petr@mpl.ch.
- */
-
-#include <common.h>
-#include <mpc5xx.h>
-#include <asm/5xx_immap.h>
-#include <linux/ctype.h>
-#include <malloc.h>
-#include <post.h>
-#include <net.h>
-
-#if defined(CONFIG_SPI)
-
-#undef DEBUG
-
-#define SPI_EEPROM_WREN 0x06
-#define SPI_EEPROM_RDSR 0x05
-#define SPI_EEPROM_READ 0x03
-#define SPI_EEPROM_WRITE 0x02
-
-
-#ifdef DEBUG
-
-#define DPRINT(a) printf a;
-/* -----------------------------------------------
- * Helper functions to peek into tx and rx buffers
- * ----------------------------------------------- */
-static const char * const hex_digit = "0123456789ABCDEF";
-
-static char quickhex (int i)
-{
- return hex_digit[i];
-}
-
-static void memdump (void *pv, int num)
-{
- int i;
- unsigned char *pc = (unsigned char *) pv;
-
- for (i = 0; i < num; i++)
- printf ("%c%c ", quickhex (pc[i] >> 4), quickhex (pc[i] & 0x0f));
- printf ("\t");
- for (i = 0; i < num; i++)
- printf ("%c", isprint (pc[i]) ? pc[i] : '.');
- printf ("\n");
-}
-#else /* !DEBUG */
-
-#define DPRINT(a)
-
-#endif /* DEBUG */
-
-/* -------------------
- * Function prototypes
- * ------------------- */
-void spi_init (void);
-
-ssize_t spi_read (uchar *, int, uchar *, int);
-ssize_t spi_write (uchar *, int, uchar *, int);
-ssize_t spi_xfer (size_t);
-
-
-/* **************************************************************************
- *
- * Function: spi_init_f
- *
- * Description: Init SPI-Controller (ROM part)
- *
- * return: ---
- *
- * *********************************************************************** */
-
-void spi_init_f (void)
-{
- int i;
-
- volatile immap_t *immr;
- volatile qsmcm5xx_t *qsmcm;
-
- immr = (immap_t *) CFG_IMMR;
- qsmcm = (qsmcm5xx_t *)&immr->im_qsmcm;
-
- qsmcm->qsmcm_qsmcr = 0; /* all accesses enabled */
- qsmcm->qsmcm_qspi_il = 0; /* lowest IRQ */
-
- /* --------------------------------------------
- * GPIO or per. Function
- * PQSPAR[00] = 0 reserved
- * PQSPAR[01] = 1 [0x4000] -> PERI: (SPICS3)
- * PQSPAR[02] = 0 [0x0000] -> GPIO
- * PQSPAR[03] = 0 [0x0000] -> GPIO
- * PQSPAR[04] = 1 [0x0800] -> PERI: (SPICS0)
- * PQSPAR[05] = 0 reseved
- * PQSPAR[06] = 1 [0x0200] -> PERI: (SPIMOSI)
- * PQSPAR[07] = 1 [0x0100] -> PERI: (SPIMISO)
- * -------------------------------------------- */
- qsmcm->qsmcm_pqspar = 0x3 | (CFG_SPI_CS_USED << 3);
-
- /* --------------------------------------------
- * DDRQS[00] = 0 reserved
- * DDRQS[01] = 1 [0x0040] -> SPICS3 Output
- * DDRQS[02] = 0 [0x0000] -> GPIO Output
- * DDRQS[03] = 0 [0x0000] -> GPIO Output
- * DDRQS[04] = 1 [0x0008] -> SPICS0 Output
- * DDRQS[05] = 1 [0x0004] -> SPICLK Output
- * DDRQS[06] = 1 [0x0002] -> SPIMOSI Output
- * DDRQS[07] = 0 [0x0001] -> SPIMISO Input
- * -------------------------------------------- */
- qsmcm->qsmcm_ddrqs = 0x7E;
- /* --------------------------------------------
- * Base state for used SPI CS pins, if base = 0 active must be 1
- * PORTQS[00] = 0 reserved
- * PORTQS[01] = 0 reserved
- * PORTQS[02] = 0 reserved
- * PORTQS[03] = 0 reserved
- * PORTQS[04] = 0 [0x0000] RxD2
- * PORTQS[05] = 1 [0x0400] TxD2
- * PORTQS[06] = 0 [0x0000] RxD1
- * PORTQS[07] = 1 [0x0100] TxD1
- * PORTQS[08] = 0 reserved
- * PORTQS[09] = 0 [0x0000] -> SPICS3 Base Output
- * PORTQS[10] = 0 [0x0000] -> SPICS2 Base Output
- * PORTQS[11] = 0 [0x0000] -> SPICS1 Base Output
- * PORTQS[12] = 0 [0x0000] -> SPICS0 Base Output
- * PORTQS[13] = 0 [0x0004] -> SPICLK Output
- * PORTQS[14] = 0 [0x0002] -> SPIMOSI Output
- * PORTQS[15] = 0 [0x0001] -> SPIMISO Input
- * -------------------------------------------- */
- qsmcm->qsmcm_portqs |= (CFG_SPI_CS_BASE << 3);
- /* --------------------------------------------
- * Controll Register 0
- * SPCR0[00] = 1 (0x8000) Master
- * SPCR0[01] = 0 (0x0000) Wired-Or
- * SPCR0[2..5] = (0x2000) Bits per transfer (default 8)
- * SPCR0[06] = 0 (0x0000) Normal polarity
- * SPCR0[07] = 0 (0x0000) Normal Clock Phase
- * SPCR0[08..15] = 14 1.4MHz
- */
- qsmcm->qsmcm_spcr0=0xA00E;
- /* --------------------------------------------
- * Controll Register 1
- * SPCR1[00] = 0 (0x0000) QSPI enabled
- * SPCR1[1..7] = (0x7F00) Delay before Transfer
- * SPCR1[8..15] = (0x0000) Delay After transfer (204.8usec@40MHz)
- */
- qsmcm->qsmcm_spcr1=0x7F00;
- /* --------------------------------------------
- * Controll Register 2
- * SPCR2[00] = 0 (0x0000) SPI IRQs Disabeld
- * SPCR2[01] = 0 (0x0000) No Wrap around
- * SPCR2[02] = 0 (0x0000) Wrap to 0
- * SPCR2[3..7] = (0x0000) End Queue pointer = 0
- * SPCR2[8..10] = 0 (0x0000) reserved
- * SPCR2[11..15] = 0 (0x0000) NewQueue Address = 0
- */
- qsmcm->qsmcm_spcr2=0x0000;
- /* --------------------------------------------
- * Controll Register 3
- * SPCR3[00..04] = 0 (0x0000) reserved
- * SPCR3[05] = 0 (0x0000) Feedback disabled
- * SPCR3[06] = 0 (0x0000) IRQ on HALTA & MODF disabled
- * SPCR3[07] = 0 (0x0000) Not halted
- */
- qsmcm->qsmcm_spcr3=0x00;
- /* --------------------------------------------
- * SPSR (Controll Register 3) Read only/ reset Flags 08,09,10
- * SPCR3[08] = 1 (0x80) QSPI finished
- * SPCR3[09] = 1 (0x40) Mode Fault Flag
- * SPCR3[10] = 1 (0x20) HALTA
- * SPCR3[11..15] = 0 (0x0000) Last executed command
- */
- qsmcm->qsmcm_spsr=0xE0;
- /*-------------------------------------------
- * Setup RAM
- */
- for(i=0;i<32;i++) {
- qsmcm->qsmcm_recram[i]=0x0000;
- qsmcm->qsmcm_tranram[i]=0x0000;
- qsmcm->qsmcm_comdram[i]=0x00;
- }
- return;
-}
-
-/* **************************************************************************
- *
- * Function: spi_init_r
- * Dummy, all initializations have been done in spi_init_r
- * *********************************************************************** */
-void spi_init_r (void)
-{
- return;
-
-}
-
-/****************************************************************************
- * Function: spi_write
- **************************************************************************** */
-ssize_t short_spi_write (uchar *addr, int alen, uchar *buffer, int len)
-{
- int i,dlen;
- volatile immap_t *immr;
- volatile qsmcm5xx_t *qsmcm;
-
- immr = (immap_t *) CFG_IMMR;
- qsmcm = (qsmcm5xx_t *)&immr->im_qsmcm;
- for(i=0;i<32;i++) {
- qsmcm->qsmcm_recram[i]=0x0000;
- qsmcm->qsmcm_tranram[i]=0x0000;
- qsmcm->qsmcm_comdram[i]=0x00;
- }
- qsmcm->qsmcm_tranram[0] = SPI_EEPROM_WREN; /* write enable */
- spi_xfer(1);
- i=0;
- qsmcm->qsmcm_tranram[i++] = SPI_EEPROM_WRITE; /* WRITE memory array */
- qsmcm->qsmcm_tranram[i++] = addr[0];
- qsmcm->qsmcm_tranram[i++] = addr[1];
-
- for(dlen=0;dlen<len;dlen++) {
- qsmcm->qsmcm_tranram[i+dlen] = buffer[dlen]; /* WRITE memory array */
- }
- /* transmit it */
- spi_xfer(i+dlen);
- /* ignore received data */
- for (i = 0; i < 1000; i++) {
- qsmcm->qsmcm_tranram[0] = SPI_EEPROM_RDSR; /* read status */
- qsmcm->qsmcm_tranram[1] = 0;
- spi_xfer(2);
- if (!(qsmcm->qsmcm_recram[1] & 1)) {
- break;
- }
- udelay(1000);
- }
- if (i >= 1000) {
- printf ("*** spi_write: Time out while writing!\n");
- }
- return len;
-}
-
-#define TRANSFER_LEN 16
-
-ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
-{
- int index,i,newlen;
- uchar newaddr[2];
- int curraddr;
-
- curraddr=(addr[alen-2]<<8)+addr[alen-1];
- i=len;
- index=0;
- do {
- newaddr[1]=(curraddr & 0xff);
- newaddr[0]=((curraddr>>8) & 0xff);
- if(i>TRANSFER_LEN) {
- newlen=TRANSFER_LEN;
- i-=TRANSFER_LEN;
- }
- else {
- newlen=i;
- i=0;
- }
- short_spi_write (newaddr, 2, &buffer[index], newlen);
- index+=newlen;
- curraddr+=newlen;
- }while(i);
- return (len);
-}
-
-/****************************************************************************
- * Function: spi_read
- **************************************************************************** */
-ssize_t short_spi_read (uchar *addr, int alen, uchar *buffer, int len)
-{
- int i;
- volatile immap_t *immr;
- volatile qsmcm5xx_t *qsmcm;
-
- immr = (immap_t *) CFG_IMMR;
- qsmcm = (qsmcm5xx_t *)&immr->im_qsmcm;
-
- for(i=0;i<32;i++) {
- qsmcm->qsmcm_recram[i]=0x0000;
- qsmcm->qsmcm_tranram[i]=0x0000;
- qsmcm->qsmcm_comdram[i]=0x00;
- }
- i=0;
- qsmcm->qsmcm_tranram[i++] = (SPI_EEPROM_READ); /* READ memory array */
- qsmcm->qsmcm_tranram[i++] = addr[0] & 0xff;
- qsmcm->qsmcm_tranram[i++] = addr[1] & 0xff;
- spi_xfer(3 + len);
- for(i=0;i<len;i++) {
- *buffer++=(char)qsmcm->qsmcm_recram[i+3];
- }
- return len;
-}
-
-ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
-{
- int index,i,newlen;
- uchar newaddr[2];
- int curraddr;
-
- curraddr=(addr[alen-2]<<8)+addr[alen-1];
- i=len;
- index=0;
- do {
- newaddr[1]=(curraddr & 0xff);
- newaddr[0]=((curraddr>>8) & 0xff);
- if(i>TRANSFER_LEN) {
- newlen=TRANSFER_LEN;
- i-=TRANSFER_LEN;
- }
- else {
- newlen=i;
- i=0;
- }
- short_spi_read (newaddr, 2, &buffer[index], newlen);
- index+=newlen;
- curraddr+=newlen;
- }while(i);
- return (len);
-}
-
-/****************************************************************************
- * Function: spi_xfer
- **************************************************************************** */
-ssize_t spi_xfer (size_t count)
-{
- volatile immap_t *immr;
- volatile qsmcm5xx_t *qsmcm;
- int i;
- int tm;
- ushort status;
- immr = (immap_t *) CFG_IMMR;
- qsmcm = (qsmcm5xx_t *)&immr->im_qsmcm;
- DPRINT (("*** spi_xfer entered count %d***\n",count));
-
- /* Set CS for device */
- for(i=0;i<(count-1);i++)
- qsmcm->qsmcm_comdram[i] = 0x80 | CFG_SPI_CS_ACT; /* CS3 is connected to the SPI EEPROM */
-
- qsmcm->qsmcm_comdram[i] = CFG_SPI_CS_ACT; /* CS3 is connected to the SPI EEPROM */
- qsmcm->qsmcm_spcr2=((count-1)&0x1F)<<8;
-
- DPRINT (("*** spi_xfer: Bytes to be xferred: %d ***\n", count));
-
- qsmcm->qsmcm_spsr=0xE0; /* clear all flags */
-
- /* start spi transfer */
- DPRINT (("*** spi_xfer: Performing transfer ...\n"));
- qsmcm->qsmcm_spcr1 |= 0x8000; /* Start transmit */
-
- /* --------------------------------
- * Wait for SPI transmit to get out
- * or time out (1 second = 1000 ms)
- * -------------------------------- */
- for (tm=0; tm<1000; ++tm) {
- status=qsmcm->qsmcm_spcr1;
- if((status & 0x8000)==0)
- break;
- udelay (1000);
- }
- if (tm >= 1000) {
- printf ("*** spi_xfer: Time out while xferring to/from SPI!\n");
- }
-#ifdef DEBUG
- printf ("\nspi_xfer: txbuf after xfer\n");
- memdump ((void *) qsmcm->qsmcm_tranram, 32); /* dump of txbuf before transmit */
- printf ("spi_xfer: rxbuf after xfer\n");
- memdump ((void *) qsmcm->qsmcm_recram, 32); /* dump of rxbuf after transmit */
- printf ("\nspi_xfer: commbuf after xfer\n");
- memdump ((void *) qsmcm->qsmcm_comdram, 32); /* dump of txbuf before transmit */
- printf ("\n");
-#endif
-
- return count;
-}
-
-#endif /* CONFIG_SPI */
diff --git a/cpu/mpc5xx/start.S b/cpu/mpc5xx/start.S
deleted file mode 100644
index d8044f077b..0000000000
--- a/cpu/mpc5xx/start.S
+++ /dev/null
@@ -1,602 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2000, 2001, 2002 Wolfgang Denk <wd@denx.de>
- * Copyright (C) 2003 Martin Winistoerfer, martinwinistoerfer@gmx.ch.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * File: start.S
- *
- * Discription: startup code
- *
- */
-
-#include <config.h>
-#include <mpc5xx.h>
-#include <version.h>
-
-#define CONFIG_5xx 1 /* needed for Linux kernel header files */
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <linux/config.h>
-#include <asm/processor.h>
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-/* We don't have a MMU.
-*/
-#undef MSR_KERNEL
-#define MSR_KERNEL ( MSR_ME | MSR_RI ) /* Machine Check and Recoverable Interr. */
-
-/*
- * Set up GOT: Global Offset Table
- *
- * Use r14 to access the GOT
- */
- START_GOT
- GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_FIXUP_TABLE_)
-
- GOT_ENTRY(_start)
- GOT_ENTRY(_start_of_vectors)
- GOT_ENTRY(_end_of_vectors)
- GOT_ENTRY(transfer_to_handler)
-
- GOT_ENTRY(__init_end)
- GOT_ENTRY(_end)
- GOT_ENTRY(__bss_start)
- END_GOT
-
-/*
- * r3 - 1st arg to board_init(): IMMP pointer
- * r4 - 2nd arg to board_init(): boot flag
- */
- .text
- .long 0x27051956 /* U-Boot Magic Number */
- .globl version_string
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
-
- . = EXC_OFF_SYS_RESET
- .globl _start
-_start:
- mfspr r3, 638
- li r4, CFG_ISB /* Set ISB bit */
- or r3, r3, r4
- mtspr 638, r3
- li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
- b boot_cold
-
- . = EXC_OFF_SYS_RESET + 0x20
-
- .globl _start_warm
-_start_warm:
- li r21, BOOTFLAG_WARM /* Software reboot */
- b boot_warm
-
-boot_cold:
-boot_warm:
-
- /* Initialize machine status; enable machine check interrupt */
- /*----------------------------------------------------------------------*/
- li r3, MSR_KERNEL /* Set ME, RI flags */
- mtmsr r3
- mtspr SRR1, r3 /* Make SRR1 match MSR */
-
- /* Initialize debug port registers */
- /*----------------------------------------------------------------------*/
- xor r0, r0, r0 /* Clear R0 */
- mtspr LCTRL1, r0 /* Initialize debug port regs */
- mtspr LCTRL2, r0
- mtspr COUNTA, r0
- mtspr COUNTB, r0
-
-#if defined(CONFIG_PATI)
- /* the external flash access on PATI fails if programming the PLL to 40MHz.
- * Copy the PLL programming code to the internal RAM and execute it
- *----------------------------------------------------------------------*/
- lis r3, CFG_MONITOR_BASE@h
- ori r3, r3, CFG_MONITOR_BASE@l
- addi r3, r3, pll_prog_code_start - _start + EXC_OFF_SYS_RESET
-
- lis r4, CFG_INIT_RAM_ADDR@h
- ori r4, r4, CFG_INIT_RAM_ADDR@l
- mtlr r4
- addis r5,0,0x0
- ori r5,r5,((pll_prog_code_end - pll_prog_code_start) >>2)
- mtctr r5
- addi r3, r3, -4
- addi r4, r4, -4
-0:
- lwzu r0,4(r3)
- stwu r0,4(r4)
- bdnz 0b /* copy loop */
- blrl
-#endif
-
- /*
- * Calculate absolute address in FLASH and jump there
- *----------------------------------------------------------------------*/
-
- lis r3, CFG_MONITOR_BASE@h
- ori r3, r3, CFG_MONITOR_BASE@l
- addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
- mtlr r3
- blr
-
-in_flash:
-
- /* Initialize some SPRs that are hard to access from C */
- /*----------------------------------------------------------------------*/
-
- lis r3, CFG_IMMR@h /* Pass IMMR as arg1 to C routine */
- lis r2, CFG_INIT_SP_ADDR@h
- ori r1, r2, CFG_INIT_SP_ADDR@l /* Set up the stack in internal SRAM */
- /* Note: R0 is still 0 here */
- stwu r0, -4(r1) /* Clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
-
- /*
- * Disable serialized ifetch and show cycles
- * (i.e. set processor to normal mode) for maximum
- * performance.
- */
-
- li r2, 0x0007
- mtspr ICTRL, r2
-
- /* Set up debug mode entry */
-
- lis r2, CFG_DER@h
- ori r2, r2, CFG_DER@l
- mtspr DER, r2
-
- /* Let the C-code set up the rest */
- /* */
- /* Be careful to keep code relocatable ! */
- /*----------------------------------------------------------------------*/
-
- GET_GOT /* initialize GOT access */
-
- /* r3: IMMR */
- bl cpu_init_f /* run low-level CPU init code (from Flash) */
-
- mr r3, r21
- /* r3: BOOTFLAG */
- bl board_init_f /* run 1st part of board init code (from Flash) */
-
-
- .globl _start_of_vectors
-_start_of_vectors:
-
-/* Machine check */
- STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. "Never" generated on the 860. */
- STD_EXCEPTION(0x300, DataStorage, UnknownException)
-
-/* Instruction Storage exception. "Never" generated on the 860. */
- STD_EXCEPTION(0x400, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
- STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
-
-/* Alignment exception. */
- . = 0x600
-Alignment:
- EXCEPTION_PROLOG
- mfspr r4,DAR
- stw r4,_DAR(r21)
- mfspr r5,DSISR
- stw r5,_DSISR(r21)
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_Alignment:
- .long AlignmentException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
- . = 0x700
-ProgramCheck:
- EXCEPTION_PROLOG
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_ProgramCheck:
- .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
- /* FPU on MPC5xx available. We will use it later.
- */
- STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
-
- /* I guess we could implement decrementer, and may have
- * to someday for timekeeping.
- */
- STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
- STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
- STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
- STD_EXCEPTION(0xc00, SystemCall, UnknownException)
- STD_EXCEPTION(0xd00, SingleStep, UnknownException)
-
- STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
- STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
-
- /* On the MPC8xx, this is a software emulation interrupt. It occurs
- * for all unimplemented and illegal instructions.
- */
- STD_EXCEPTION(0x1000, SoftEmu, SoftEmuException)
- STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
- STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
- STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
- STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
-
- STD_EXCEPTION(0x1500, Reserved5, UnknownException)
- STD_EXCEPTION(0x1600, Reserved6, UnknownException)
- STD_EXCEPTION(0x1700, Reserved7, UnknownException)
- STD_EXCEPTION(0x1800, Reserved8, UnknownException)
- STD_EXCEPTION(0x1900, Reserved9, UnknownException)
- STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
- STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
-
- STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
- STD_EXCEPTION(0x1d00, InstructionBreakpoint, DebugException)
- STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
- STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
-
-
- .globl _end_of_vectors
-_end_of_vectors:
-
-
- . = 0x2000
-
-/*
- * This code finishes saving the registers to the exception frame
- * and jumps to the appropriate handler for the exception.
- * Register r21 is pointer into trap frame, r1 has new stack pointer.
- */
- .globl transfer_to_handler
-transfer_to_handler:
- stw r22,_NIP(r21)
- lis r22,MSR_POW@h
- andc r23,r23,r22
- stw r23,_MSR(r21)
- SAVE_GPR(7, r21)
- SAVE_4GPRS(8, r21)
- SAVE_8GPRS(12, r21)
- SAVE_8GPRS(24, r21)
- mflr r23
- andi. r24,r23,0x3f00 /* get vector offset */
- stw r24,TRAP(r21)
- li r22,0
- stw r22,RESULT(r21)
- mtspr SPRG2,r22 /* r1 is now kernel sp */
- lwz r24,0(r23) /* virtual address of handler */
- lwz r23,4(r23) /* where to go when done */
- mtspr SRR0,r24
- mtspr SRR1,r20
- mtlr r23
- SYNC
- rfi /* jump to handler, enable MMU */
-
-int_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr SRR0,r2
- mtspr SRR1,r0
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfi
-
-
-/*
- * unsigned int get_immr (unsigned int mask)
- *
- * return (mask ? (IMMR & mask) : IMMR);
- */
- .globl get_immr
-get_immr:
- mr r4,r3 /* save mask */
- mfspr r3, IMMR /* IMMR */
- cmpwi 0,r4,0 /* mask != 0 ? */
- beq 4f
- and r3,r3,r4 /* IMMR & mask */
-4:
- blr
-
- .globl get_pvr
-get_pvr:
- mfspr r3, PVR
- blr
-
-
-/*------------------------------------------------------------------------------*/
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
- */
- .globl relocate_code
-relocate_code:
- mr r1, r3 /* Set new stack pointer in SRAM */
- mr r9, r4 /* Save copy of global data pointer in SRAM */
- mr r10, r5 /* Save copy of monitor destination Address in SRAM */
-
- mr r3, r5 /* Destination Address */
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
- lwz r5, GOT(__init_end)
- sub r5, r5, r4
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
- *
- * Offset:
- */
- sub r15, r10, r4
-
- /* First our own GOT */
- add r14, r14, r15
- /* the the one used by the C code */
- add r30, r30, r15
-
- /*
- * Now relocate code
- */
-
- cmplw cr1,r3,r4
- addi r0,r5,3
- srwi. r0,r0,2
- beq cr1,4f /* In place copy is not necessary */
- beq 4f /* Protect against 0 count */
- mtctr r0
- bge cr1,2f
-
- la r8,-4(r4)
- la r7,-4(r3)
-1: lwzu r0,4(r8)
- stwu r0,4(r7)
- bdnz 1b
- b 4f
-
-2: slwi r0,r0,2
- add r8,r4,r0
- add r7,r3,r0
-3: lwzu r0,-4(r8)
- stwu r0,-4(r7)
- bdnz 3b
-
-4: sync
- isync
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-
- addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
- mtlr r0
- blr
-
-in_ram:
-
- /*
- * Relocation Function, r14 point to got2+0x8000
- *
- * Adjust got2 pointers, no need to check for 0, this code
- * already puts a few entries in the table.
- */
- li r0,__got2_entries@sectoff@l
- la r3,GOT(_GOT2_TABLE_)
- lwz r11,GOT(_GOT2_TABLE_)
- mtctr r0
- sub r11,r3,r11
- addi r3,r3,-4
-1: lwzu r0,4(r3)
- add r0,r0,r11
- stw r0,0(r3)
- bdnz 1b
-
- /*
- * Now adjust the fixups and the pointers to the fixups
- * in case we need to move ourselves again.
- */
-2: li r0,__fixup_entries@sectoff@l
- lwz r3,GOT(_FIXUP_TABLE_)
- cmpwi r0,0
- mtctr r0
- addi r3,r3,-4
- beq 4f
-3: lwzu r4,4(r3)
- lwzux r0,r4,r11
- add r0,r0,r11
- stw r10,0(r3)
- stw r0,0(r4)
- bdnz 3b
-4:
-clear_bss:
- /*
- * Now clear BSS segment
- */
- lwz r3,GOT(__bss_start)
- lwz r4,GOT(_end)
- cmplw 0, r3, r4
- beq 6f
-
- li r0, 0
-5:
- stw r0, 0(r3)
- addi r3, r3, 4
- cmplw 0, r3, r4
- bne 5b
-6:
-
- mr r3, r9 /* Global Data pointer */
- mr r4, r10 /* Destination Address */
- bl board_init_r
-
- /*
- * Copy exception vector code to low memory
- *
- * r3: dest_addr
- * r7: source address, r8: end address, r9: target address
- */
- .globl trap_init
-trap_init:
- lwz r7, GOT(_start)
- lwz r8, GOT(_end_of_vectors)
-
- li r9, 0x100 /* reset vector always at 0x100 */
-
- cmplw 0, r7, r8
- bgelr /* return if r7>=r8 - just in case */
-
- mflr r4 /* save link register */
-1:
- lwz r0, 0(r7)
- stw r0, 0(r9)
- addi r7, r7, 4
- addi r9, r9, 4
- cmplw 0, r7, r8
- bne 1b
-
- /*
- * relocate `hdlr' and `int_return' entries
- */
- li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
- li r8, Alignment - _start + EXC_OFF_SYS_RESET
-2:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 2b
-
- li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
- li r8, SystemCall - _start + EXC_OFF_SYS_RESET
-3:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 3b
-
- li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
- li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-4:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 4b
-
- mtlr r4 /* restore link register */
- blr
-
- /*
- * Function: relocate entries for one exception vector
- */
-trap_reloc:
- lwz r0, 0(r7) /* hdlr ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 0(r7)
-
- lwz r0, 4(r7) /* int_return ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 4(r7)
-
- sync
- isync
-
- blr
-
-
-#if defined(CONFIG_PATI)
-/* Program the PLL */
-pll_prog_code_start:
- lis r4, (CFG_IMMR + 0x002fc384)@h
- ori r4, r4, (CFG_IMMR + 0x002fc384)@l
- lis r3, (0x55ccaa33)@h
- ori r3, r3, (0x55ccaa33)@l
- stw r3, 0(r4)
- lis r4, (CFG_IMMR + 0x002fc284)@h
- ori r4, r4, (CFG_IMMR + 0x002fc284)@l
- lis r3, CFG_PLPRCR@h
- ori r3, r3, CFG_PLPRCR@l
- stw r3, 0(r4)
- addis r3,0,0x0
- ori r3,r3,0xA000
- mtctr r3
-..spinlp:
- bdnz ..spinlp /* spin loop */
- blr
-pll_prog_code_end:
- nop
- blr
-#endif
diff --git a/cpu/mpc5xx/traps.c b/cpu/mpc5xx/traps.c
deleted file mode 100644
index 14fd59e4fa..0000000000
--- a/cpu/mpc5xx/traps.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * linux/arch/ppc/kernel/traps.c
- *
- * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- * Modified by Cort Dougan (cort@cs.nmt.edu)
- * and Paul Mackerras (paulus@cs.anu.edu.au)
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * This file handles the architecture-dependent parts of hardware exceptions
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/processor.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
-extern void do_bedbug_breakpoint(struct pt_regs *);
-#endif
-
-/* Returns 0 if exception not found and fixup otherwise. */
-extern unsigned long search_exception_table(unsigned long);
-
-/* THIS NEEDS CHANGING to use the board info structure.
-*/
-#define END_OF_MEM 0x0001000
-
-
-/*
- * Print stack backtrace
- */
-void print_backtrace(unsigned long *sp)
-{
- int cnt = 0;
- unsigned long i;
-
- printf("Call backtrace: ");
- while (sp) {
- if ((uint)sp > END_OF_MEM)
- break;
-
- i = sp[1];
- if (cnt++ % 7 == 0)
- printf("\n");
- printf("%08lX ", i);
- if (cnt > 32) break;
- sp = (unsigned long *)*sp;
- }
- printf("\n");
-}
-
-/*
- * Print current registers
- */
-void show_regs(struct pt_regs * regs)
-{
- int i;
- printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
- regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
- printf("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
- regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
- regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
- regs->msr&MSR_IR ? 1 : 0,
- regs->msr&MSR_DR ? 1 : 0);
-
- printf("\n");
- for (i = 0; i < 32; i++) {
- if ((i % 8) == 0)
- {
- printf("GPR%02d: ", i);
- }
-
- printf("%08lX ", regs->gpr[i]);
- if ((i % 8) == 7)
- {
- printf("\n");
- }
- }
-}
-
-
-/*
- * General exception handler routine
- */
-void _exception(int signr, struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
-}
-
-/*
- * Machine check exception handler routine
- */
-void MachineCheckException(struct pt_regs *regs)
-{
- unsigned long fixup;
-
- /* Probing PCI using config cycles cause this exception
- * when a device is not present. Catch it and return to
- * the PCI exception handler.
- */
- if ((fixup = search_exception_table(regs->nip)) != 0) {
- regs->nip = fixup;
- return;
- }
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- printf("Machine check in kernel mode.\n");
- printf("Caused by (from msr): ");
- printf("regs %p ",regs);
- switch( regs->msr & 0x000F0000) {
- case (0x80000000>>12):
- printf("Machine check signal\n");
- break;
- case (0x80000000>>13):
- printf("Transfer error ack signal\n");
- break;
- case (0x80000000>>14):
- printf("Data parity signal\n");
- break;
- case (0x80000000>>15):
- printf("Address parity signal\n");
- break;
- default:
- printf("Unknown values in msr\n");
- }
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("machine check");
-}
-
-/*
- * Alignment exception handler routine
- */
-void AlignmentException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Alignment Exception");
-}
-
-/*
- * Program check exception handler routine
- */
-void ProgramCheckException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Program Check Exception");
-}
-
-/*
- * Software emulation exception handler routine
- */
-void SoftEmuException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Software Emulation Exception");
-}
-
-
-/*
- * Unknown exception handler routine
- */
-void UnknownException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
- regs->nip, regs->msr, regs->trap);
- _exception(0, regs);
-}
-
-/*
- * Debug exception handler routine
- */
-void DebugException(struct pt_regs *regs)
-{
- printf("Debugger trap at @ %lx\n", regs->nip );
- show_regs(regs);
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
- do_bedbug_breakpoint( regs );
-#endif
-}
diff --git a/cpu/mpc5xxx/Makefile b/cpu/mpc5xxx/Makefile
deleted file mode 100644
index e75f1d1e66..0000000000
--- a/cpu/mpc5xxx/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-obj-y += cpu.o
-obj-y += cpu_init.o
-obj-y += loadtask.o
-obj-y += speed.o
-obj-y += traps.o
-extra-y += start.o
-obj-$(CONFIG_MPC5200) += firmware_sc_task_bestcomm.impl.o
-obj-$(CONFIG_INTERRUPTS) += interrupts.o
-obj-$(CONFIG_REGINFO) += reginfo.o
-
-#obj-y += firmware_sc_task.impl.o
-#obj-y += io.o
-#obj-y += ide.o
-#obj-y += pci_mpc5200.o
diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c
deleted file mode 100644
index 1bb340dedb..0000000000
--- a/cpu/mpc5xxx/cpu.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * (C) Copyright 2000-2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * CPU specific code for the MPC5xxx CPUs
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/arch/mpc5xxx.h>
-#include <asm/processor.h>
-#include <asm/byteorder.h>
-#include <init.h>
-#include <types.h>
-#include <asm/arch/clocks.h>
-
-#if defined(CONFIG_OF_FLAT_TREE)
-#include <ft_build.h>
-#endif
-
-int checkcpu (void)
-{
- ulong clock = get_cpu_clock();
- char buf[32];
-#ifndef CONFIG_MGT5100
- uint svr, pvr;
-#endif
-
- puts ("CPU: ");
-
-#ifdef CONFIG_MGT5100
- puts (CPU_ID_STR);
- printf (" (JTAG ID %08lx)", *(vu_long *)MPC5XXX_CDM_JTAGID);
-#else
- svr = get_svr();
- pvr = get_pvr();
- switch (SVR_VER (svr)) {
- case SVR_MPC5200:
- printf ("MPC5200");
- break;
- default:
- printf ("MPC52?? (SVR %08x)", svr);
- break;
- }
-
- printf (" v%d.%d, Core v%d.%d", SVR_MJREV (svr), SVR_MNREV (svr),
- PVR_MAJ(pvr), PVR_MIN(pvr));
-#endif
- printf (" at %s MHz\n", strmhz (buf, clock));
- return 0;
-}
-
-/* ------------------------------------------------------------------------- */
-
-void do_reset (void)
-{
- ulong msr;
- /* Interrupts and MMU off */
- __asm__ __volatile__ ("mfmsr %0":"=r" (msr):);
-
- msr &= ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR);
- __asm__ __volatile__ ("mtmsr %0"::"r" (msr));
-
- /* Charge the watchdog timer */
- *(vu_long *)(MPC5XXX_GPT0_COUNTER) = 0x0001000f;
- *(vu_long *)(MPC5XXX_GPT0_ENABLE) = 0x9004; /* wden|ce|timer_ms */
- while(1);
-}
-
-/* ------------------------------------------------------------------------- */
-
-#ifdef CONFIG_OF_FLAT_TREE
-void
-ft_cpu_setup(void *blob, bd_t *bd)
-{
- u32 *p;
- int len;
-
- /* Core XLB bus frequency */
- p = ft_get_prop(blob, "/cpus/" OF_CPU "/bus-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(get_bus_clock());
-
- /* SOC peripherals use the IPB bus frequency */
- p = ft_get_prop(blob, "/" OF_SOC "/bus-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(get_ipb_clock());
-
- p = ft_get_prop(blob, "/" OF_SOC "/ethernet@3000/mac-address", &len);
- if (p != NULL)
- memcpy(p, bd->bi_enetaddr, 6);
-}
-#endif
-
-int cpu_init_board_data(bd_t *bd)
-{
- bd->bi_intfreq = get_cpu_clock(); /* Internal Freq, in Hz */
- bd->bi_busfreq = get_bus_clock(); /* Bus Freq, in Hz */
- bd->bi_mbar_base = CFG_MBAR; /* base of internal registers */
- bd->bi_ipbfreq = get_ipb_clock();
- bd->bi_pcifreq = get_pci_clock();
- return 0;
-}
diff --git a/cpu/mpc5xxx/cpu_init.c b/cpu/mpc5xxx/cpu_init.c
deleted file mode 100644
index b8c069f3a0..0000000000
--- a/cpu/mpc5xxx/cpu_init.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * (C) Copyright 2000-2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/arch/mpc5xxx.h>
-#include <types.h>
-
-/*
- * Breath some life into the CPU...
- *
- * Set up the memory map,
- * initialize a bunch of registers.
- */
-void cpu_init_f (void)
-{
- unsigned long addecr = (1 << 25); /* Boot_CS */
-#if defined(CFG_RAMBOOT) && defined(CONFIG_MGT5100)
- addecr |= (1 << 22); /* SDRAM enable */
-#endif
-
- /*
- * Memory Controller: configure chip selects and enable them
- */
-#if defined(CFG_BOOTCS_START) && defined(CFG_BOOTCS_SIZE)
- *(vu_long *)MPC5XXX_BOOTCS_START = START_REG(CFG_BOOTCS_START);
- *(vu_long *)MPC5XXX_BOOTCS_STOP = STOP_REG(CFG_BOOTCS_START,
- CFG_BOOTCS_SIZE);
-#endif
-#if defined(CFG_BOOTCS_CFG)
- *(vu_long *)MPC5XXX_BOOTCS_CFG = CFG_BOOTCS_CFG;
-#endif
-
-#if defined(CFG_CS0_START) && defined(CFG_CS0_SIZE)
- *(vu_long *)MPC5XXX_CS0_START = START_REG(CFG_CS0_START);
- *(vu_long *)MPC5XXX_CS0_STOP = STOP_REG(CFG_CS0_START, CFG_CS0_SIZE);
- /* CS0 and BOOT_CS cannot be enabled at once. */
- /* addecr |= (1 << 16); */
-#endif
-#if defined(CFG_CS0_CFG)
- *(vu_long *)MPC5XXX_CS0_CFG = CFG_CS0_CFG;
-#endif
-
-#if defined(CFG_CS1_START) && defined(CFG_CS1_SIZE)
- *(vu_long *)MPC5XXX_CS1_START = START_REG(CFG_CS1_START);
- *(vu_long *)MPC5XXX_CS1_STOP = STOP_REG(CFG_CS1_START, CFG_CS1_SIZE);
- addecr |= (1 << 17);
-#endif
-#if defined(CFG_CS1_CFG)
- *(vu_long *)MPC5XXX_CS1_CFG = CFG_CS1_CFG;
-#endif
-
-#if defined(CFG_CS2_START) && defined(CFG_CS2_SIZE)
- *(vu_long *)MPC5XXX_CS2_START = START_REG(CFG_CS2_START);
- *(vu_long *)MPC5XXX_CS2_STOP = STOP_REG(CFG_CS2_START, CFG_CS2_SIZE);
- addecr |= (1 << 18);
-#endif
-#if defined(CFG_CS2_CFG)
- *(vu_long *)MPC5XXX_CS2_CFG = CFG_CS2_CFG;
-#endif
-
-#if defined(CFG_CS3_START) && defined(CFG_CS3_SIZE)
- *(vu_long *)MPC5XXX_CS3_START = START_REG(CFG_CS3_START);
- *(vu_long *)MPC5XXX_CS3_STOP = STOP_REG(CFG_CS3_START, CFG_CS3_SIZE);
- addecr |= (1 << 19);
-#endif
-#if defined(CFG_CS3_CFG)
- *(vu_long *)MPC5XXX_CS3_CFG = CFG_CS3_CFG;
-#endif
-
-#if defined(CFG_CS4_START) && defined(CFG_CS4_SIZE)
- *(vu_long *)MPC5XXX_CS4_START = START_REG(CFG_CS4_START);
- *(vu_long *)MPC5XXX_CS4_STOP = STOP_REG(CFG_CS4_START, CFG_CS4_SIZE);
- addecr |= (1 << 20);
-#endif
-#if defined(CFG_CS4_CFG)
- *(vu_long *)MPC5XXX_CS4_CFG = CFG_CS4_CFG;
-#endif
-
-#if defined(CFG_CS5_START) && defined(CFG_CS5_SIZE)
- *(vu_long *)MPC5XXX_CS5_START = START_REG(CFG_CS5_START);
- *(vu_long *)MPC5XXX_CS5_STOP = STOP_REG(CFG_CS5_START, CFG_CS5_SIZE);
- addecr |= (1 << 21);
-#endif
-#if defined(CFG_CS5_CFG)
- *(vu_long *)MPC5XXX_CS5_CFG = CFG_CS5_CFG;
-#endif
-
-#if defined(CONFIG_MPC5200)
- addecr |= 1;
-#if defined(CFG_CS6_START) && defined(CFG_CS6_SIZE)
- *(vu_long *)MPC5XXX_CS6_START = START_REG(CFG_CS6_START);
- *(vu_long *)MPC5XXX_CS6_STOP = STOP_REG(CFG_CS6_START, CFG_CS6_SIZE);
- addecr |= (1 << 26);
-#endif
-#if defined(CFG_CS6_CFG)
- *(vu_long *)MPC5XXX_CS6_CFG = CFG_CS6_CFG;
-#endif
-
-#if defined(CFG_CS7_START) && defined(CFG_CS7_SIZE)
- *(vu_long *)MPC5XXX_CS7_START = START_REG(CFG_CS5_START);
- *(vu_long *)MPC5XXX_CS7_STOP = STOP_REG(CFG_CS7_START, CFG_CS7_SIZE);
- addecr |= (1 << 27);
-#endif
-#if defined(CFG_CS7_CFG)
- *(vu_long *)MPC5XXX_CS7_CFG = CFG_CS7_CFG;
-#endif
-
-#if defined(CFG_CS_BURST)
- *(vu_long *)MPC5XXX_CS_BURST = CFG_CS_BURST;
-#endif
-#if defined(CFG_CS_DEADCYCLE)
- *(vu_long *)MPC5XXX_CS_DEADCYCLE = CFG_CS_DEADCYCLE;
-#endif
-#endif /* CONFIG_MPC5200 */
-
- /* Enable chip selects */
- *(vu_long *)MPC5XXX_ADDECR = addecr;
- *(vu_long *)MPC5XXX_CS_CTRL = (1 << 24);
-
- /* Setup pin multiplexing */
-#if defined(CFG_GPS_PORT_CONFIG)
- *(vu_long *)MPC5XXX_GPS_PORT_CONFIG = CFG_GPS_PORT_CONFIG;
-#endif
-
-#if defined(CONFIG_MPC5200)
- /* enable timebase */
- *(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 13);
-
- /* Enable snooping for RAM */
- *(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 15);
- *(vu_long *)(MPC5XXX_XLBARB + 0x70) = CFG_SDRAM_BASE | 0x1d;
-
-# if defined(CFG_IPBSPEED_133)
- /* Motorola reports IPB should better run at 133 MHz. */
- *(vu_long *)MPC5XXX_ADDECR |= 1;
- /* pci_clk_sel = 0x02, ipb_clk_sel = 0x00; */
- addecr = *(vu_long *)MPC5XXX_CDM_CFG;
- addecr &= ~0x103;
-# if defined(CFG_PCISPEED_66)
- /* pci_clk_sel = 0x01 -> IPB_CLK/2 */
- addecr |= 0x01;
-# else
- /* pci_clk_sel = 0x02 -> XLB_CLK/4 = IPB_CLK/4 */
- addecr |= 0x02;
-# endif /* CFG_PCISPEED_66 */
- *(vu_long *)MPC5XXX_CDM_CFG = addecr;
-# endif /* CFG_IPBSPEED_133 */
- /* Configure the XLB Arbiter */
- *(vu_long *)MPC5XXX_XLBARB_MPRIEN = 0xff;
- *(vu_long *)MPC5XXX_XLBARB_MPRIVAL = 0x11111111;
-
-# if defined(CFG_XLB_PIPELINING)
- /* Enable piplining */
- *(vu_long *)(MPC5XXX_XLBARB + 0x40) &= ~(1 << 31);
-# endif
-#endif /* CONFIG_MPC5200 */
-}
-
-/*
- * initialize higher level parts of CPU like time base and timers
- */
-int cpu_init_r (void)
-{
- /* mask all interrupts */
-#if defined(CONFIG_MGT5100)
- *(vu_long *)MPC5XXX_ICTL_PER_MASK = 0xfffffc00;
-#elif defined(CONFIG_MPC5200)
- *(vu_long *)MPC5XXX_ICTL_PER_MASK = 0xffffff00;
-#endif
- *(vu_long *)MPC5XXX_ICTL_CRIT |= 0x0001ffff;
- *(vu_long *)MPC5XXX_ICTL_EXT &= ~0x00000f00;
- /* route critical ints to normal ints */
- *(vu_long *)MPC5XXX_ICTL_EXT |= 0x00000001;
-
-#ifdef CONFIG_DRIVER_NET_MPC5200
- /* load FEC microcode */
- loadtask(0, 2);
-#endif
-
- return (0);
-}
diff --git a/cpu/mpc5xxx/firmware_sc_task.impl.S b/cpu/mpc5xxx/firmware_sc_task.impl.S
deleted file mode 100644
index b668ee5cf8..0000000000
--- a/cpu/mpc5xxx/firmware_sc_task.impl.S
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Copyright (C) 2001, Software Center, Motorola China.
- *
- * This file contains microcode for the FEC controller of the MGT5100 CPU.
- */
-
-#include <config.h>
-
-#if defined(CONFIG_MGT5100)
-
-/* sas/sccg, gas target */
-.section smartdmaInitData,"aw",@progbits /* Initialized data for task variables */
-.section smartdmaTaskTable,"aw",@progbits /* Task tables */
-.globl taskTable
-taskTable:
-.globl scEthernetRecv_Entry
-scEthernetRecv_Entry: /* Task 0 */
-.long scEthernetRecv_TDT - taskTable /* Task 0 Descriptor Table */
-.long scEthernetRecv_TDT - taskTable + 0x000000a4
-.long scEthernetRecv_VarTab - taskTable /* Task 0 Variable Table */
-.long scEthernetRecv_FDT - taskTable + 0x03 /* Task 0 Function Descriptor Table & Flags */
-.long 0x00000000
-.long 0x00000000
-.long scEthernetRecv_CSave - taskTable /* Task 0 context save space */
-.long 0xf0000000
-.globl scEthernetXmit_Entry
-scEthernetXmit_Entry: /* Task 1 */
-.long scEthernetXmit_TDT - taskTable /* Task 1 Descriptor Table */
-.long scEthernetXmit_TDT - taskTable + 0x000000d0
-.long scEthernetXmit_VarTab - taskTable /* Task 1 Variable Table */
-.long scEthernetXmit_FDT - taskTable + 0x03 /* Task 1 Function Descriptor Table & Flags */
-.long 0x00000000
-.long 0x00000000
-.long scEthernetXmit_CSave - taskTable /* Task 1 context save space */
-.long 0xf0000000
-
-
-.globl scEthernetRecv_TDT
-scEthernetRecv_TDT: /* Task 0 Descriptor Table */
-.long 0xc4c50000 /* 0000: LCDEXT: idx0 = var9 + var10; idx0 once var0; idx0 += inc0 */
-.long 0x84c5e000 /* 0004: LCD: idx1 = var9 + var11; ; idx1 += inc0 */
-.long 0x10001f08 /* 0008: DRD1A: var7 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x10000380 /* 000C: DRD1A: var0 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000f88 /* 0010: DRD1A: var3 = *idx1; FN=0 init=0 WS=0 RS=0 */
-.long 0x81980000 /* 0014: LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
-.long 0x10000780 /* 0018: DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 001C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x010c504c /* 0020: DRD2B1: var4 = EU1(); EU1(var1,var12) */
-.long 0x82180349 /* 0024: LCD: idx0 = var4; idx0 != var13; idx0 += inc1 */
-.long 0x81c68004 /* 0028: LCD: idx1 = var3 + var13 + 4; idx1 once var0; idx1 += inc0 */
-.long 0x70000000 /* 002C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x018c504e /* 0030: DRD2B1: var6 = EU1(); EU1(var1,var14) */
-.long 0x70000000 /* 0034: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x020c504f /* 0038: DRD2B1: var8 = EU1(); EU1(var1,var15) */
-.long 0x00000b88 /* 003C: DRD1A: var2 = *idx1; FN=0 init=0 WS=0 RS=0 */
-.long 0x8000d184 /* 0040: LCDEXT: idx1 = 0xf0003184; ; */
-.long 0xc6990452 /* 0044: LCDEXT: idx2 = var13; idx2 < var17; idx2 += inc2 */
-.long 0x81486010 /* 0048: LCD: idx3 = var2 + var16; ; idx3 += inc2 */
-.long 0x006acf88 /* 004C: DRD1A: *idx3 = *idx1; FN=0 init=3 WS=1 RS=1 */
-.long 0x8000d184 /* 0050: LCDEXT: idx1 = 0xf0003184; ; */
-.long 0x86810492 /* 0054: LCD: idx2 = var13, idx3 = var2; idx2 < var18; idx2 += inc2, idx3 += inc2 */
-.long 0x006acf88 /* 0058: DRD1A: *idx3 = *idx1; FN=0 init=3 WS=1 RS=1 */
-.long 0x8000d184 /* 005C: LCDEXT: idx1 = 0xf0003184; ; */
-.long 0x868184d2 /* 0060: LCD: idx2 = var13, idx3 = var3; idx2 < var19; idx2 += inc2, idx3 += inc2 */
-.long 0x000acf88 /* 0064: DRD1A: *idx3 = *idx1; FN=0 init=0 WS=1 RS=1 */
-.long 0xc318839b /* 0068: LCDEXT: idx1 = var6; idx1 == var14; idx1 += inc3 */
-.long 0x80190000 /* 006C: LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
-.long 0x04008468 /* 0070: DRD1A: idx1 = var13; FN=0 INT init=0 WS=0 RS=0 */
-.long 0xc4038358 /* 0074: LCDEXT: idx1 = var8, idx2 = var7; idx1 == var13; idx1 += inc3, idx2 += inc0 */
-.long 0x81c50000 /* 0078: LCD: idx3 = var3 + var10; idx3 once var0; idx3 += inc0 */
-.long 0x1000cb18 /* 007C: DRD1A: *idx2 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000f18 /* 0080: DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
-.long 0xc4188364 /* 0084: LCDEXT: idx1 = var8; idx1 > var13; idx1 += inc4 */
-.long 0x83990000 /* 0088: LCD: idx2 = var7; idx2 once var0; idx2 += inc0 */
-.long 0x10000c00 /* 008C: DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x0000c800 /* 0090: DRD1A: *idx2 = var0; FN=0 init=0 WS=0 RS=0 */
-.long 0x81988000 /* 0094: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
-.long 0x10000788 /* 0098: DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 009C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x080c504c /* 00A0: DRD2B1: idx0 = EU1(); EU1(var1,var12) */
-.long 0x000001f8 /* 00A4(:0): NOP */
-
-
-.globl scEthernetXmit_TDT
-scEthernetXmit_TDT: /* Task 1 Descriptor Table */
-.long 0x80014800 /* 0000: LCDEXT: idx0 = 0xf0004800; ; */
-.long 0x85c60004 /* 0004: LCD: idx1 = var11 + var12 + 4; idx1 once var0; idx1 += inc0 */
-.long 0x10002308 /* 0008: DRD1A: var8 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x10000f88 /* 000C: DRD1A: var3 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000380 /* 0010: DRD1A: var0 = *idx0; FN=0 init=0 WS=0 RS=0 */
-.long 0x81980000 /* 0014: LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
-.long 0x10000780 /* 0018: DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 001C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x024c504d /* 0020: DRD2B1: var9 = EU1(); EU1(var1,var13) */
-.long 0x84980309 /* 0024: LCD: idx0 = var9; idx0 != var12; idx0 += inc1 */
-.long 0xc0004003 /* 0028: LCDEXT: idx1 = 0x00000003; ; */
-.long 0x81c60004 /* 002C: LCD: idx2 = var3 + var12 + 4; idx2 once var0; idx2 += inc0 */
-.long 0x70000000 /* 0030: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x010c504e /* 0034: DRD2B1: var4 = EU1(); EU1(var1,var14) */
-.long 0x70000000 /* 0038: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x014c504f /* 003C: DRD2B1: var5 = EU1(); EU1(var1,var15) */
-.long 0x70000000 /* 0040: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x028c5050 /* 0044: DRD2B1: var10 = EU1(); EU1(var1,var16) */
-.long 0x70000000 /* 0048: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x018c5051 /* 004C: DRD2B1: var6 = EU1(); EU1(var1,var17) */
-.long 0x10000b90 /* 0050: DRD1A: var2 = *idx2; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 0054: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x01cc50a1 /* 0058: DRD2B1: var7 = EU1(); EU1(var2,idx1) */
-.long 0xc2988312 /* 005C: LCDEXT: idx1 = var5; idx1 > var12; idx1 += inc2 */
-.long 0x83490000 /* 0060: LCD: idx2 = var6 + var18; idx2 once var0; idx2 += inc0 */
-.long 0x00001b10 /* 0064: DRD1A: var6 = idx2; FN=0 init=0 WS=0 RS=0 */
-.long 0x8000d1a4 /* 0068: LCDEXT: idx1 = 0xf00031a4; ; */
-.long 0x8301031c /* 006C: LCD: idx2 = var6, idx3 = var2; idx2 > var12; idx2 += inc3, idx3 += inc4 */
-.long 0x008ac798 /* 0070: DRD1A: *idx1 = *idx3; FN=0 init=4 WS=1 RS=1 */
-.long 0x8000d1a4 /* 0074: LCDEXT: idx1 = 0xf00031a4; ; */
-.long 0xc1430000 /* 0078: LCDEXT: idx2 = var2 + var6; idx2 once var0; idx2 += inc0 */
-.long 0x82998312 /* 007C: LCD: idx3 = var5; idx3 > var12; idx3 += inc2 */
-.long 0x088ac790 /* 0080: DRD1A: *idx1 = *idx2; FN=0 TFD init=4 WS=1 RS=1 */
-.long 0x81988000 /* 0084: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
-.long 0x60000100 /* 0088: DRD2A: EU0=0 EU1=1 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x0c4c5c4d /* 008C: DRD2B1: *idx1 = EU1(); EU1(*idx1,var13) */
-.long 0xc21883ad /* 0090: LCDEXT: idx1 = var4; idx1 == var14; idx1 += inc5 */
-.long 0x80190000 /* 0094: LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
-.long 0x04008460 /* 0098: DRD1A: idx1 = var12; FN=0 INT init=0 WS=0 RS=0 */
-.long 0xc4052305 /* 009C: LCDEXT: idx1 = var8, idx2 = var10; idx2 == var12; idx1 += inc0, idx2 += inc5 */
-.long 0x81c98000 /* 00A0: LCD: idx3 = var3 + var19; idx3 once var0; idx3 += inc0 */
-.long 0x1000c718 /* 00A4: DRD1A: *idx1 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000f18 /* 00A8: DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
-.long 0xc4188000 /* 00AC: LCDEXT: idx1 = var8; idx1 once var0; idx1 += inc0 */
-.long 0x85190312 /* 00B0: LCD: idx2 = var10; idx2 > var12; idx2 += inc2 */
-.long 0x10000c00 /* 00B4: DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x1000c400 /* 00B8: DRD1A: *idx1 = var0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00008860 /* 00BC: DRD1A: idx2 = var12; FN=0 init=0 WS=0 RS=0 */
-.long 0x81988000 /* 00C0: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
-.long 0x10000788 /* 00C4: DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 00C8: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x080c504d /* 00CC: DRD2B1: idx0 = EU1(); EU1(var1,var13) */
-.long 0x000001f8 /* 00D0(:0): NOP */
-
-.align 8
-
-.globl scEthernetRecv_VarTab
-scEthernetRecv_VarTab: /* Task 0 Variable Table */
-.long 0x00000000 /* var[0] */
-.long 0x00000000 /* var[1] */
-.long 0x00000000 /* var[2] */
-.long 0x00000000 /* var[3] */
-.long 0x00000000 /* var[4] */
-.long 0x00000000 /* var[5] */
-.long 0x00000000 /* var[6] */
-.long 0x00000000 /* var[7] */
-.long 0x00000000 /* var[8] */
-.long 0xf0004800 /* var[9] */
-.long 0x00000008 /* var[10] */
-.long 0x0000000c /* var[11] */
-.long 0x80000000 /* var[12] */
-.long 0x00000000 /* var[13] */
-.long 0x10000000 /* var[14] */
-.long 0x20000000 /* var[15] */
-.long 0x000005e4 /* var[16] */
-.long 0x0000000e /* var[17] */
-.long 0x000005e0 /* var[18] */
-.long 0x00000004 /* var[19] */
-.long 0x00000000 /* var[20] */
-.long 0x00000000 /* var[21] */
-.long 0x00000000 /* var[22] */
-.long 0x00000000 /* var[23] */
-.long 0x00000000 /* inc[0] */
-.long 0x60000000 /* inc[1] */
-.long 0x20000001 /* inc[2] */
-.long 0x80000000 /* inc[3] */
-.long 0x40000000 /* inc[4] */
-.long 0x00000000 /* inc[5] */
-.long 0x00000000 /* inc[6] */
-.long 0x00000000 /* inc[7] */
-
-.align 8
-
-.globl scEthernetXmit_VarTab
-scEthernetXmit_VarTab: /* Task 1 Variable Table */
-.long 0x00000000 /* var[0] */
-.long 0x00000000 /* var[1] */
-.long 0x00000000 /* var[2] */
-.long 0x00000000 /* var[3] */
-.long 0x00000000 /* var[4] */
-.long 0x00000000 /* var[5] */
-.long 0x00000000 /* var[6] */
-.long 0x00000000 /* var[7] */
-.long 0x00000000 /* var[8] */
-.long 0x00000000 /* var[9] */
-.long 0x00000000 /* var[10] */
-.long 0xf0004800 /* var[11] */
-.long 0x00000000 /* var[12] */
-.long 0x80000000 /* var[13] */
-.long 0x10000000 /* var[14] */
-.long 0x08000000 /* var[15] */
-.long 0x20000000 /* var[16] */
-.long 0x0000ffff /* var[17] */
-.long 0xffffffff /* var[18] */
-.long 0x00000008 /* var[19] */
-.long 0x00000000 /* var[20] */
-.long 0x00000000 /* var[21] */
-.long 0x00000000 /* var[22] */
-.long 0x00000000 /* var[23] */
-.long 0x00000000 /* inc[0] */
-.long 0x60000000 /* inc[1] */
-.long 0x40000000 /* inc[2] */
-.long 0x4000ffff /* inc[3] */
-.long 0xe0000001 /* inc[4] */
-.long 0x80000000 /* inc[5] */
-.long 0x00000000 /* inc[6] */
-.long 0x00000000 /* inc[7] */
-
-.align 8
-
-.globl scEthernetRecv_FDT
-scEthernetRecv_FDT: /* Task 0 Function Descriptor Table */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x05800000 /* and(), EU# 1 */
-.long 0x05400000 /* andn(), EU# 1 */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-
-.align 8
-
-.globl scEthernetXmit_FDT
-scEthernetXmit_FDT: /* Task 1 Function Descriptor Table */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x05800000 /* and(), EU# 1 */
-.long 0x05400000 /* andn(), EU# 1 */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-
-
-.align 8
-.globl scEthernetRecv_CSave
-scEthernetRecv_CSave: /* Task 0 context save space */
-.space 256, 0x0
-
-
-.align 8
-.globl scEthernetXmit_CSave
-scEthernetXmit_CSave: /* Task 1 context save space */
-.space 256, 0x0
-
-#endif /* CONFIG_MGT5100 */
diff --git a/cpu/mpc5xxx/firmware_sc_task_bestcomm.impl.S b/cpu/mpc5xxx/firmware_sc_task_bestcomm.impl.S
deleted file mode 100644
index 42d0e3ce08..0000000000
--- a/cpu/mpc5xxx/firmware_sc_task_bestcomm.impl.S
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * Copyright (C) 2001, Software Center, Motorola China.
- *
- * This file contains microcode for the FEC controller of the MPC5200 CPU.
- */
-
-/* sas/sccg, gas target */
-.section smartdmaInitData,"aw",@progbits /* Initialized data for task variables */
-.section smartdmaTaskTable,"aw",@progbits /* Task tables */
-.align 9
-
-.globl taskTable
-taskTable:
-
-.globl scEthernetRecv_Entry
-scEthernetRecv_Entry: /* Task 0 */
-.long scEthernetRecv_TDT - taskTable /* Task 0 Descriptor Table */
-.long scEthernetRecv_TDT - taskTable + 0x000000a4
-.long scEthernetRecv_VarTab - taskTable /* Task 0 Variable Table */
-.long scEthernetRecv_FDT - taskTable + 0x03 /* Task 0 Function Descriptor Table & Flags */
-.long 0x00000000
-.long 0x00000000
-.long scEthernetRecv_CSave - taskTable /* Task 0 context save space */
-.long 0xf0000000
-
-.globl scEthernetXmit_Entry
-scEthernetXmit_Entry: /* Task 1 */
-.long scEthernetXmit_TDT - taskTable /* Task 1 Descriptor Table */
-.long scEthernetXmit_TDT - taskTable + 0x000000d0
-.long scEthernetXmit_VarTab - taskTable /* Task 1 Variable Table */
-.long scEthernetXmit_FDT - taskTable + 0x03 /* Task 1 Function Descriptor Table & Flags */
-.long 0x00000000
-.long 0x00000000
-.long scEthernetXmit_CSave - taskTable /* Task 1 context save space */
-.long 0xf0000000
-
-
-.globl scEthernetRecv_TDT
-scEthernetRecv_TDT: /* Task 0 Descriptor Table */
-.long 0xc4c50000 /* 0000: LCDEXT: idx0 = var9 + var10; idx0 once var0; idx0 += inc0 */
-.long 0x84c5e000 /* 0004: LCD: idx1 = var9 + var11; ; idx1 += inc0 */
-.long 0x10001f08 /* 0008: DRD1A: var7 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x10000380 /* 000C: DRD1A: var0 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000f88 /* 0010: DRD1A: var3 = *idx1; FN=0 init=0 WS=0 RS=0 */
-.long 0x81980000 /* 0014: LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
-.long 0x10000780 /* 0018: DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 001C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x010cf04c /* 0020: DRD2B1: var4 = EU3(); EU3(var1,var12) */
-.long 0x82180349 /* 0024: LCD: idx0 = var4; idx0 != var13; idx0 += inc1 */
-.long 0x81c68004 /* 0028: LCD: idx1 = var3 + var13 + 4; idx1 once var0; idx1 += inc0 */
-.long 0x70000000 /* 002C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x018cf04e /* 0030: DRD2B1: var6 = EU3(); EU3(var1,var14) */
-.long 0x70000000 /* 0034: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x020cf04f /* 0038: DRD2B1: var8 = EU3(); EU3(var1,var15) */
-.long 0x00000b88 /* 003C: DRD1A: var2 = *idx1; FN=0 init=0 WS=0 RS=0 */
-.long 0x8000d184 /* 0040: LCDEXT: idx1 = 0xf0003184; ; */
-.long 0xc6990452 /* 0044: LCDEXT: idx2 = var13; idx2 < var17; idx2 += inc2 */
-.long 0x81486010 /* 0048: LCD: idx3 = var2 + var16; ; idx3 += inc2 */
-.long 0x006acf88 /* 004C: DRD1A: *idx3 = *idx1; FN=0 init=3 WS=1 RS=1 */
-.long 0x8000d184 /* 0050: LCDEXT: idx1 = 0xf0003184; ; */
-.long 0x86810492 /* 0054: LCD: idx2 = var13, idx3 = var2; idx2 < var18; idx2 += inc2, idx3 += inc2 */
-.long 0x006acf88 /* 0058: DRD1A: *idx3 = *idx1; FN=0 init=3 WS=1 RS=1 */
-.long 0x8000d184 /* 005C: LCDEXT: idx1 = 0xf0003184; ; */
-.long 0x868184d2 /* 0060: LCD: idx2 = var13, idx3 = var3; idx2 < var19; idx2 += inc2, idx3 += inc2 */
-.long 0x000acf88 /* 0064: DRD1A: *idx3 = *idx1; FN=0 init=0 WS=1 RS=1 */
-.long 0xc318839b /* 0068: LCDEXT: idx1 = var6; idx1 == var14; idx1 += inc3 */
-.long 0x80190000 /* 006C: LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
-.long 0x04008468 /* 0070: DRD1A: idx1 = var13; FN=0 INT init=0 WS=0 RS=0 */
-.long 0xc4038358 /* 0074: LCDEXT: idx1 = var8, idx2 = var7; idx1 == var13; idx1 += inc3, idx2 += inc0 */
-.long 0x81c50000 /* 0078: LCD: idx3 = var3 + var10; idx3 once var0; idx3 += inc0 */
-.long 0x1000cb18 /* 007C: DRD1A: *idx2 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000f18 /* 0080: DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
-.long 0xc4188364 /* 0084: LCDEXT: idx1 = var8; idx1 > var13; idx1 += inc4 */
-.long 0x83990000 /* 0088: LCD: idx2 = var7; idx2 once var0; idx2 += inc0 */
-.long 0x10000c00 /* 008C: DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x0000c800 /* 0090: DRD1A: *idx2 = var0; FN=0 init=0 WS=0 RS=0 */
-.long 0x81988000 /* 0094: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
-.long 0x10000788 /* 0098: DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 009C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x080cf04c /* 00A0: DRD2B1: idx0 = EU3(); EU3(var1,var12) */
-.long 0x000001f8 /* 00A4(:0): NOP */
-
-
-.globl scEthernetXmit_TDT
-scEthernetXmit_TDT: /* Task 1 Descriptor Table */
-.long 0x80024800 /* 0000: LCDEXT: idx0 = 0xf0008800; ; */
-.long 0x85c60004 /* 0004: LCD: idx1 = var11 + var12 + 4; idx1 once var0; idx1 += inc0 */
-.long 0x10002308 /* 0008: DRD1A: var8 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x10000f88 /* 000C: DRD1A: var3 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000380 /* 0010: DRD1A: var0 = *idx0; FN=0 init=0 WS=0 RS=0 */
-.long 0x81980000 /* 0014: LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
-.long 0x10000780 /* 0018: DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 001C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x024cf04d /* 0020: DRD2B1: var9 = EU3(); EU3(var1,var13) */
-.long 0x84980309 /* 0024: LCD: idx0 = var9; idx0 != var12; idx0 += inc1 */
-.long 0xc0004003 /* 0028: LCDEXT: idx1 = 0x00000003; ; */
-.long 0x81c60004 /* 002C: LCD: idx2 = var3 + var12 + 4; idx2 once var0; idx2 += inc0 */
-.long 0x70000000 /* 0030: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x010cf04e /* 0034: DRD2B1: var4 = EU3(); EU3(var1,var14) */
-.long 0x70000000 /* 0038: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x014cf04f /* 003C: DRD2B1: var5 = EU3(); EU3(var1,var15) */
-.long 0x70000000 /* 0040: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x028cf050 /* 0044: DRD2B1: var10 = EU3(); EU3(var1,var16) */
-.long 0x70000000 /* 0048: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x018cf051 /* 004C: DRD2B1: var6 = EU3(); EU3(var1,var17) */
-.long 0x10000b90 /* 0050: DRD1A: var2 = *idx2; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 0054: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x01ccf0a1 /* 0058: DRD2B1: var7 = EU3(); EU3(var2,idx1) */
-.long 0xc2988312 /* 005C: LCDEXT: idx1 = var5; idx1 > var12; idx1 += inc2 */
-.long 0x83490000 /* 0060: LCD: idx2 = var6 + var18; idx2 once var0; idx2 += inc0 */
-.long 0x00001b10 /* 0064: DRD1A: var6 = idx2; FN=0 init=0 WS=0 RS=0 */
-.long 0x8000d1a4 /* 0068: LCDEXT: idx1 = 0xf00031a4; ; */
-.long 0x8301031c /* 006C: LCD: idx2 = var6, idx3 = var2; idx2 > var12; idx2 += inc3, idx3 += inc4 */
-.long 0x008ac798 /* 0070: DRD1A: *idx1 = *idx3; FN=0 init=4 WS=1 RS=1 */
-.long 0x8000d1a4 /* 0074: LCDEXT: idx1 = 0xf00031a4; ; */
-.long 0xc1430000 /* 0078: LCDEXT: idx2 = var2 + var6; idx2 once var0; idx2 += inc0 */
-.long 0x82998312 /* 007C: LCD: idx3 = var5; idx3 > var12; idx3 += inc2 */
-.long 0x088ac790 /* 0080: DRD1A: *idx1 = *idx2; FN=0 TFD init=4 WS=1 RS=1 */
-.long 0x81988000 /* 0084: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
-.long 0x60000001 /* 0088: DRD2A: EU0=0 EU1=0 EU2=0 EU3=1 EXT init=0 WS=0 RS=0 */
-.long 0x0c4cfc4d /* 008C: DRD2B1: *idx1 = EU3(); EU3(*idx1,var13) */
-.long 0xc21883ad /* 0090: LCDEXT: idx1 = var4; idx1 == var14; idx1 += inc5 */
-.long 0x80190000 /* 0094: LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
-.long 0x04008460 /* 0098: DRD1A: idx1 = var12; FN=0 INT init=0 WS=0 RS=0 */
-.long 0xc4052305 /* 009C: LCDEXT: idx1 = var8, idx2 = var10; idx2 == var12; idx1 += inc0, idx2 += inc5 */
-.long 0x81c98000 /* 00A0: LCD: idx3 = var3 + var19; idx3 once var0; idx3 += inc0 */
-.long 0x1000c718 /* 00A4: DRD1A: *idx1 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000f18 /* 00A8: DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
-.long 0xc4188000 /* 00AC: LCDEXT: idx1 = var8; idx1 once var0; idx1 += inc0 */
-.long 0x85190312 /* 00B0: LCD: idx2 = var10; idx2 > var12; idx2 += inc2 */
-.long 0x10000c00 /* 00B4: DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x1000c400 /* 00B8: DRD1A: *idx1 = var0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00008860 /* 00BC: DRD1A: idx2 = var12; FN=0 init=0 WS=0 RS=0 */
-.long 0x81988000 /* 00C0: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
-.long 0x10000788 /* 00C4: DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 00C8: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x080cf04d /* 00CC: DRD2B1: idx0 = EU3(); EU3(var1,var13) */
-.long 0x000001f8 /* 00D0(:0): NOP */
-
-.align 8
-
-.globl scEthernetRecv_VarTab
-scEthernetRecv_VarTab: /* Task 0 Variable Table */
-.long 0x00000000 /* var[0] */
-.long 0x00000000 /* var[1] */
-.long 0x00000000 /* var[2] */
-.long 0x00000000 /* var[3] */
-.long 0x00000000 /* var[4] */
-.long 0x00000000 /* var[5] */
-.long 0x00000000 /* var[6] */
-.long 0x00000000 /* var[7] */
-.long 0x00000000 /* var[8] */
-.long 0xf0008800 /* var[9] */
-.long 0x00000008 /* var[10] */
-.long 0x0000000c /* var[11] */
-.long 0x80000000 /* var[12] */
-.long 0x00000000 /* var[13] */
-.long 0x10000000 /* var[14] */
-.long 0x20000000 /* var[15] */
-.long 0x000005e4 /* var[16] */
-.long 0x0000000e /* var[17] */
-.long 0x000005e0 /* var[18] */
-.long 0x00000004 /* var[19] */
-.long 0x00000000 /* var[20] */
-.long 0x00000000 /* var[21] */
-.long 0x00000000 /* var[22] */
-.long 0x00000000 /* var[23] */
-.long 0x00000000 /* inc[0] */
-.long 0x60000000 /* inc[1] */
-.long 0x20000001 /* inc[2] */
-.long 0x80000000 /* inc[3] */
-.long 0x40000000 /* inc[4] */
-.long 0x00000000 /* inc[5] */
-.long 0x00000000 /* inc[6] */
-.long 0x00000000 /* inc[7] */
-
-.align 8
-
-.globl scEthernetXmit_VarTab
-scEthernetXmit_VarTab: /* Task 1 Variable Table */
-.long 0x00000000 /* var[0] */
-.long 0x00000000 /* var[1] */
-.long 0x00000000 /* var[2] */
-.long 0x00000000 /* var[3] */
-.long 0x00000000 /* var[4] */
-.long 0x00000000 /* var[5] */
-.long 0x00000000 /* var[6] */
-.long 0x00000000 /* var[7] */
-.long 0x00000000 /* var[8] */
-.long 0x00000000 /* var[9] */
-.long 0x00000000 /* var[10] */
-.long 0xf0008800 /* var[11] */
-.long 0x00000000 /* var[12] */
-.long 0x80000000 /* var[13] */
-.long 0x10000000 /* var[14] */
-.long 0x08000000 /* var[15] */
-.long 0x20000000 /* var[16] */
-.long 0x0000ffff /* var[17] */
-.long 0xffffffff /* var[18] */
-.long 0x00000008 /* var[19] */
-.long 0x00000000 /* var[20] */
-.long 0x00000000 /* var[21] */
-.long 0x00000000 /* var[22] */
-.long 0x00000000 /* var[23] */
-.long 0x00000000 /* inc[0] */
-.long 0x60000000 /* inc[1] */
-.long 0x40000000 /* inc[2] */
-.long 0x4000ffff /* inc[3] */
-.long 0xe0000001 /* inc[4] */
-.long 0x80000000 /* inc[5] */
-.long 0x00000000 /* inc[6] */
-.long 0x00000000 /* inc[7] */
-
-.align 8
-
-.globl scEthernetRecv_FDT
-scEthernetRecv_FDT: /* Task 0 Function Descriptor Table */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x21800000 /* and(), EU# 3 */
-.long 0x21400000 /* andn(), EU# 3 */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-
-.align 8
-
-.globl scEthernetXmit_FDT
-scEthernetXmit_FDT: /* Task 1 Function Descriptor Table */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x21800000 /* and(), EU# 3 */
-.long 0x21400000 /* andn(), EU# 3 */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-
-
-.globl scEthernetRecv_CSave
-scEthernetRecv_CSave: /* Task 0 context save space */
-.space 128, 0x0
-
-
-.globl scEthernetXmit_CSave
-scEthernetXmit_CSave: /* Task 1 context save space */
-.space 128, 0x0
-
diff --git a/cpu/mpc5xxx/ide.c b/cpu/mpc5xxx/ide.c
deleted file mode 100644
index 29b99f6b15..0000000000
--- a/cpu/mpc5xxx/ide.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * (C) Copyright 2004
- * Pierre AUBERT, Staubli Faverges, <p.aubert@staubli.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- * Init is derived from Linux code.
- */
-#include <common.h>
-
-#ifdef CFG_CMD_IDE
-#include <mpc5xxx.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define CALC_TIMING(t) (t + period - 1) / period
-
-#ifdef CONFIG_IDE_RESET
-extern void init_ide_reset (void);
-#endif
-
-int ide_preinit (void)
-{
- long period, t0, t1, t2_8, t2_16, t4, ta;
- vu_long reg;
- struct mpc5xxx_sdma *psdma = (struct mpc5xxx_sdma *) MPC5XXX_SDMA;
-
- reg = *(vu_long *) MPC5XXX_GPS_PORT_CONFIG;
-#if defined(CONFIG_TOTAL5200)
- /* ATA cs0/1 on i2c2 clk/io */
- reg = (reg & ~0x03000000ul) | 0x02000000ul;
-#else
- /* ATA cs0/1 on Local Plus cs4/5 */
- reg = (reg & ~0x03000000ul) | 0x01000000ul;
-#endif /* CONFIG_TOTAL5200 */
- *(vu_long *) MPC5XXX_GPS_PORT_CONFIG = reg;
-
- /* All sample codes do that... */
- *(vu_long *) MPC5XXX_ATA_SHARE_COUNT = 0;
-
- /* Configure and reset host */
- *(vu_long *) MPC5XXX_ATA_HOST_CONFIG = MPC5xxx_ATA_HOSTCONF_IORDY |
- MPC5xxx_ATA_HOSTCONF_SMR | MPC5xxx_ATA_HOSTCONF_FR;
- udelay (10);
- *(vu_long *) MPC5XXX_ATA_HOST_CONFIG = MPC5xxx_ATA_HOSTCONF_IORDY;
-
- /* Disable prefetch on Commbus */
- psdma->PtdCntrl |= 1;
-
- /* Init timings : we use PIO mode 0 timings */
- period = 1000000000 / gd->ipb_clk; /* period in ns */
-
- t0 = CALC_TIMING (600);
- t2_8 = CALC_TIMING (290);
- t2_16 = CALC_TIMING (165);
- reg = (t0 << 24) | (t2_8 << 16) | (t2_16 << 8);
- *(vu_long *) MPC5XXX_ATA_PIO1 = reg;
-
- t4 = CALC_TIMING (30);
- t1 = CALC_TIMING (70);
- ta = CALC_TIMING (35);
- reg = (t4 << 24) | (t1 << 16) | (ta << 8);
-
- *(vu_long *) MPC5XXX_ATA_PIO2 = reg;
-
-#ifdef CONFIG_IDE_RESET
- init_ide_reset ();
-#endif /* CONFIG_IDE_RESET */
-
- return (0);
-}
-#endif /* CFG_CMD_IDE */
diff --git a/cpu/mpc5xxx/interrupts.c b/cpu/mpc5xxx/interrupts.c
deleted file mode 100644
index 8665a066b0..0000000000
--- a/cpu/mpc5xxx/interrupts.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * (C) Copyright 2006
- * Detlev Zundel, DENX Software Engineering, dzu@denx.de
- *
- * (C) Copyright -2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2001
- * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* this section was ripped out of arch/ppc/syslib/mpc52xx_pic.c in the
- * Linux 2.6 source with the following copyright.
- *
- * Based on (well, mostly copied from) the code from the 2.4 kernel by
- * Dale Farnsworth <dfarnsworth@mvista.com> and Kent Borg.
- *
- * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
- * Copyright (C) 2003 Montavista Software, Inc
- */
-
-#include <common.h>
-#include <asm/processor.h>
-#include <asm/io.h>
-#include <command.h>
-#include <asm/arch/sdma.h>
-#include <asm/bitops.h>
-#include <asm/arch/clocks.h>
-
-struct irq_action {
- interrupt_handler_t *handler;
- void *arg;
- ulong count;
-};
-
-static struct irq_action irq_handlers[NR_IRQS];
-
-static struct mpc5xxx_intr *intr;
-static struct mpc5xxx_sdma *sdma;
-
-static void mpc5xxx_ic_disable(unsigned int irq)
-{
- u32 val;
-
- if (irq == MPC5XXX_IRQ0) {
- val = in_be32(&intr->ctrl);
- val &= ~(1 << 11);
- out_be32(&intr->ctrl, val);
- } else if (irq < MPC5XXX_IRQ1) {
- BUG();
- } else if (irq <= MPC5XXX_IRQ3) {
- val = in_be32(&intr->ctrl);
- val &= ~(1 << (10 - (irq - MPC5XXX_IRQ1)));
- out_be32(&intr->ctrl, val);
- } else if (irq < MPC5XXX_SDMA_IRQ_BASE) {
- val = in_be32(&intr->main_mask);
- val |= 1 << (16 - (irq - MPC5XXX_MAIN_IRQ_BASE));
- out_be32(&intr->main_mask, val);
- } else if (irq < MPC5XXX_PERP_IRQ_BASE) {
- val = in_be32(&sdma->IntMask);
- val |= 1 << (irq - MPC5XXX_SDMA_IRQ_BASE);
- out_be32(&sdma->IntMask, val);
- } else {
- val = in_be32(&intr->per_mask);
- val |= 1 << (31 - (irq - MPC5XXX_PERP_IRQ_BASE));
- out_be32(&intr->per_mask, val);
- }
-}
-
-static void mpc5xxx_ic_enable(unsigned int irq)
-{
- u32 val;
-
- if (irq == MPC5XXX_IRQ0) {
- val = in_be32(&intr->ctrl);
- val |= 1 << 11;
- out_be32(&intr->ctrl, val);
- } else if (irq < MPC5XXX_IRQ1) {
- BUG();
- } else if (irq <= MPC5XXX_IRQ3) {
- val = in_be32(&intr->ctrl);
- val |= 1 << (10 - (irq - MPC5XXX_IRQ1));
- out_be32(&intr->ctrl, val);
- } else if (irq < MPC5XXX_SDMA_IRQ_BASE) {
- val = in_be32(&intr->main_mask);
- val &= ~(1 << (16 - (irq - MPC5XXX_MAIN_IRQ_BASE)));
- out_be32(&intr->main_mask, val);
- } else if (irq < MPC5XXX_PERP_IRQ_BASE) {
- val = in_be32(&sdma->IntMask);
- val &= ~(1 << (irq - MPC5XXX_SDMA_IRQ_BASE));
- out_be32(&sdma->IntMask, val);
- } else {
- val = in_be32(&intr->per_mask);
- val &= ~(1 << (31 - (irq - MPC5XXX_PERP_IRQ_BASE)));
- out_be32(&intr->per_mask, val);
- }
-}
-
-static void mpc5xxx_ic_ack(unsigned int irq)
-{
- u32 val;
-
- /*
- * Only some irqs are reset here, others in interrupting hardware.
- */
-
- switch (irq) {
- case MPC5XXX_IRQ0:
- val = in_be32(&intr->ctrl);
- val |= 0x08000000;
- out_be32(&intr->ctrl, val);
- break;
- case MPC5XXX_CCS_IRQ:
- val = in_be32(&intr->enc_status);
- val |= 0x00000400;
- out_be32(&intr->enc_status, val);
- break;
- case MPC5XXX_IRQ1:
- val = in_be32(&intr->ctrl);
- val |= 0x04000000;
- out_be32(&intr->ctrl, val);
- break;
- case MPC5XXX_IRQ2:
- val = in_be32(&intr->ctrl);
- val |= 0x02000000;
- out_be32(&intr->ctrl, val);
- break;
- case MPC5XXX_IRQ3:
- val = in_be32(&intr->ctrl);
- val |= 0x01000000;
- out_be32(&intr->ctrl, val);
- break;
- default:
- if (irq >= MPC5XXX_SDMA_IRQ_BASE
- && irq < (MPC5XXX_SDMA_IRQ_BASE + MPC5XXX_SDMA_IRQ_NUM)) {
- out_be32(&sdma->IntPend,
- 1 << (irq - MPC5XXX_SDMA_IRQ_BASE));
- }
- break;
- }
-}
-
-static void mpc5xxx_ic_disable_and_ack(unsigned int irq)
-{
- mpc5xxx_ic_disable(irq);
- mpc5xxx_ic_ack(irq);
-}
-
-static void mpc5xxx_ic_end(unsigned int irq)
-{
- mpc5xxx_ic_enable(irq);
-}
-
-void mpc5xxx_init_irq(void)
-{
- u32 intr_ctrl;
-
- /* Remap the necessary zones */
- intr = (struct mpc5xxx_intr *)(MPC5XXX_ICTL);
- sdma = (struct mpc5xxx_sdma *)(MPC5XXX_SDMA);
-
- /* Disable all interrupt sources. */
- out_be32(&sdma->IntPend, 0xffffffff); /* 1 means clear pending */
- out_be32(&sdma->IntMask, 0xffffffff); /* 1 means disabled */
- out_be32(&intr->per_mask, 0x7ffffc00); /* 1 means disabled */
- out_be32(&intr->main_mask, 0x00010fff); /* 1 means disabled */
- intr_ctrl = in_be32(&intr->ctrl);
- intr_ctrl |= 0x0f000000 | /* clear IRQ 0-3 */
- 0x00ff0000 | /* IRQ 0-3 level sensitive low active */
- 0x00001000 | /* MEE master external enable */
- 0x00000000 | /* 0 means disable IRQ 0-3 */
- 0x00000001; /* CEb route critical normally */
- out_be32(&intr->ctrl, intr_ctrl);
-
- /* Zero a bunch of the priority settings. */
- out_be32(&intr->per_pri1, 0);
- out_be32(&intr->per_pri2, 0);
- out_be32(&intr->per_pri3, 0);
- out_be32(&intr->main_pri1, 0);
- out_be32(&intr->main_pri2, 0);
-}
-
-int mpc5xxx_get_irq(struct pt_regs *regs)
-{
- u32 status;
- int irq = -1;
-
- status = in_be32(&intr->enc_status);
-
- if (status & 0x00000400) { /* critical */
- irq = (status >> 8) & 0x3;
- if (irq == 2) /* high priority peripheral */
- goto peripheral;
- irq += MPC5XXX_CRIT_IRQ_BASE;
- } else if (status & 0x00200000) { /* main */
- irq = (status >> 16) & 0x1f;
- if (irq == 4) /* low priority peripheral */
- goto peripheral;
- irq += MPC5XXX_MAIN_IRQ_BASE;
- } else if (status & 0x20000000) { /* peripheral */
- peripheral:
- irq = (status >> 24) & 0x1f;
- if (irq == 0) { /* bestcomm */
- status = in_be32(&sdma->IntPend);
- irq = ffs(status) + MPC5XXX_SDMA_IRQ_BASE - 1;
- } else
- irq += MPC5XXX_PERP_IRQ_BASE;
- }
-
- return irq;
-}
-
-/****************************************************************************/
-
-int interrupt_init_cpu(ulong * decrementer_count)
-{
- *decrementer_count = get_timebase_clock() / 1000;
-
- mpc5xxx_init_irq();
-
- return 0;
-}
-
-/****************************************************************************/
-
-/*
- * Handle external interrupts
- */
-void external_interrupt(struct pt_regs *regs)
-{
- int irq, unmask = 1;
-
- irq = mpc5xxx_get_irq(regs);
-
- mpc5xxx_ic_disable_and_ack(irq);
-
- enable_interrupts();
-
- if (irq_handlers[irq].handler != NULL)
- (*irq_handlers[irq].handler) (irq_handlers[irq].arg);
- else {
- printf("\nBogus External Interrupt IRQ %d\n", irq);
- /*
- * turn off the bogus interrupt, otherwise it
- * might repeat forever
- */
- unmask = 0;
- }
-
- if (unmask)
- mpc5xxx_ic_end(irq);
-}
-
-void timer_interrupt_cpu(struct pt_regs *regs)
-{
- /* nothing to do here */
- return;
-}
-
-/****************************************************************************/
-
-/*
- * Install and free a interrupt handler.
- */
-
-void irq_install_handler(int irq, interrupt_handler_t * handler, void *arg)
-{
- if (irq < 0 || irq >= NR_IRQS) {
- printf("irq_install_handler: bad irq number %d\n", irq);
- return;
- }
-
- if (irq_handlers[irq].handler != NULL)
- printf("irq_install_handler: 0x%08lx replacing 0x%08lx\n",
- (ulong) handler, (ulong) irq_handlers[irq].handler);
-
- irq_handlers[irq].handler = handler;
- irq_handlers[irq].arg = arg;
-
- mpc5xxx_ic_enable(irq);
-}
-
-void irq_free_handler(int irq)
-{
- if (irq < 0 || irq >= NR_IRQS) {
- printf("irq_free_handler: bad irq number %d\n", irq);
- return;
- }
-
- mpc5xxx_ic_disable(irq);
-
- irq_handlers[irq].handler = NULL;
- irq_handlers[irq].arg = NULL;
-}
-
-/****************************************************************************/
-
-#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
-void do_irqinfo(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char *argv[])
-{
- int irq, re_enable;
- u32 intr_ctrl;
- char *irq_config[] = { "level sensitive, active high",
- "edge sensitive, rising active edge",
- "edge sensitive, falling active edge",
- "level sensitive, active low"
- };
-
- re_enable = disable_interrupts();
-
- intr_ctrl = in_be32(&intr->ctrl);
- printf("Interrupt configuration:\n");
-
- for (irq = 0; irq <= 3; irq++) {
- printf("IRQ%d: %s\n", irq,
- irq_config[(intr_ctrl >> (22 - 2 * irq)) & 0x3]);
- }
-
- puts("\nInterrupt-Information:\n" "Nr Routine Arg Count\n");
-
- for (irq = 0; irq < NR_IRQS; irq++)
- if (irq_handlers[irq].handler != NULL)
- printf("%02d %08lx %08lx %ld\n", irq,
- (ulong) irq_handlers[irq].handler,
- (ulong) irq_handlers[irq].arg,
- irq_handlers[irq].count);
-
- if (re_enable)
- enable_interrupts();
-}
-#endif
diff --git a/cpu/mpc5xxx/io.S b/cpu/mpc5xxx/io.S
deleted file mode 100644
index 2178a26763..0000000000
--- a/cpu/mpc5xxx/io.S
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Andreas Heppel <aheppel@sysgo.de>
- * Copyright (C) 2003 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <ppc_asm.tmpl>
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in8 */
-/* Description: Input 8 bits */
-/* ------------------------------------------------------------------------------- */
- .globl in8
-in8:
- lbz r3,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in16 */
-/* Description: Input 16 bits */
-/* ------------------------------------------------------------------------------- */
- .globl in16
-in16:
- lhz r3,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in16r */
-/* Description: Input 16 bits and byte reverse */
-/* ------------------------------------------------------------------------------- */
- .globl in16r
-in16r:
- lhbrx r3,0,r3
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in32 */
-/* Description: Input 32 bits */
-/* ------------------------------------------------------------------------------- */
- .globl in32
-in32:
- lwz 3,0(3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in32r */
-/* Description: Input 32 bits and byte reverse */
-/* ------------------------------------------------------------------------------- */
- .globl in32r
-in32r:
- lwbrx r3,0,r3
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out8 */
-/* Description: Output 8 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out8
-out8:
- stb r4,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out16 */
-/* Description: Output 16 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out16
-out16:
- sth r4,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out16r */
-/* Description: Byte reverse and output 16 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out16r
-out16r:
- sthbrx r4,0,r3
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out32 */
-/* Description: Output 32 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out32
-out32:
- stw r4,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out32r */
-/* Description: Byte reverse and output 32 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out32r
-out32r:
- stwbrx r4,0,r3
- sync
- blr
diff --git a/cpu/mpc5xxx/loadtask.c b/cpu/mpc5xxx/loadtask.c
deleted file mode 100644
index 77ba8c89d2..0000000000
--- a/cpu/mpc5xxx/loadtask.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * This file is based on code
- * (C) Copyright Motorola, Inc., 2000
- */
-
-#include <common.h>
-#include <asm/arch/mpc5xxx.h>
-#include <types.h>
-
-/* BestComm/SmartComm microcode */
-extern int taskTable;
-
-void loadtask(int basetask, int tasks)
-{
- int *sram = (int *)MPC5XXX_SRAM;
- int *task_org = &taskTable;
- unsigned int start, offset, end;
- int i;
-
-#ifdef DEBUG
- printf("basetask = %d, tasks = %d\n", basetask, tasks);
- printf("task_org = 0x%08x\n", (unsigned int)task_org);
-#endif
-
- /* setup TaskBAR register */
- *(vu_long *)MPC5XXX_SDMA = MPC5XXX_SRAM;
-
- /* relocate task table entries */
- offset = (unsigned int)sram;
- for (i = basetask; i < basetask + tasks; i++) {
- sram[i * 8 + 0] = task_org[i * 8 + 0] + offset;
- sram[i * 8 + 1] = task_org[i * 8 + 1] + offset;
- sram[i * 8 + 2] = task_org[i * 8 + 2] + offset;
- sram[i * 8 + 3] = task_org[i * 8 + 3] + offset;
- sram[i * 8 + 4] = task_org[i * 8 + 4];
- sram[i * 8 + 5] = task_org[i * 8 + 5];
- sram[i * 8 + 6] = task_org[i * 8 + 6] + offset;
- sram[i * 8 + 7] = task_org[i * 8 + 7];
- }
-
- /* relocate task descriptors */
- start = (sram[basetask * 8] - (unsigned int)sram);
- end = (sram[(basetask + tasks - 1) * 8 + 1] - (unsigned int)sram);
-
-#ifdef DEBUG
- printf ("TDT start = 0x%08x, end = 0x%08x\n", start, end);
-#endif
-
- start /= 4;
- end /= 4;
- for (i = start; i <= end; i++) {
- sram[i] = task_org[i];
- }
-
- /* relocate variables */
- start = (sram[basetask * 8 + 2] - (unsigned int)sram);
- end = (sram[(basetask + tasks - 1) * 8 + 2] + 256 - (unsigned int)sram);
- start /= 4;
- end /= 4;
- for (i = start; i < end; i++) {
- sram[i] = task_org[i];
- }
-
- /* relocate function decriptors */
- start = ((sram[basetask * 8 + 3] & 0xfffffffc) - (unsigned int)sram);
- end = ((sram[(basetask + tasks - 1) * 8 + 3] & 0xfffffffc) + 256 - (unsigned int)sram);
- start /= 4;
- end /= 4;
- for (i = start; i < end; i++) {
- sram[i] = task_org[i];
- }
-
- asm volatile ("sync");
-}
diff --git a/cpu/mpc5xxx/pci_mpc5200.c b/cpu/mpc5xxx/pci_mpc5200.c
deleted file mode 100644
index a7de4a2268..0000000000
--- a/cpu/mpc5xxx/pci_mpc5200.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * (C) Copyright 2000-2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-#if defined(CONFIG_PCI) && defined(CONFIG_MPC5200)
-
-#include <asm/processor.h>
-#include <asm/io.h>
-#include <pci.h>
-#include <mpc5xxx.h>
-
-/* System RAM mapped over PCI */
-#define CONFIG_PCI_MEMORY_BUS CFG_SDRAM_BASE
-#define CONFIG_PCI_MEMORY_PHYS CFG_SDRAM_BASE
-#define CONFIG_PCI_MEMORY_SIZE (1024 * 1024 * 1024)
-
-/* PCIIWCR bit fields */
-#define IWCR_MEM (0 << 3)
-#define IWCR_IO (1 << 3)
-#define IWCR_READ (0 << 1)
-#define IWCR_READLINE (1 << 1)
-#define IWCR_READMULT (2 << 1)
-#define IWCR_EN (1 << 0)
-
-static int mpc5200_read_config_dword(struct pci_controller *hose,
- pci_dev_t dev, int offset, u32* value)
-{
- *(volatile u32 *)MPC5XXX_PCI_CAR = (1 << 31) | dev | offset;
- eieio();
- udelay(10);
-#if (defined CONFIG_PF5200 || defined CONFIG_CPCI5200)
- if (dev & 0x00ff0000) {
- u32 val;
- val = in_le16((volatile u16 *)(CONFIG_PCI_IO_PHYS+2));
- udelay(10);
- val = val << 16;
- val |= in_le16((volatile u16 *)(CONFIG_PCI_IO_PHYS+0));
- *value = val;
- } else {
- *value = in_le32((volatile u32 *)CONFIG_PCI_IO_PHYS);
- }
- udelay(10);
-#else
- *value = in_le32((volatile u32 *)CONFIG_PCI_IO_PHYS);
-#endif
- eieio();
- *(volatile u32 *)MPC5XXX_PCI_CAR = 0;
- udelay(10);
- return 0;
-}
-
-static int mpc5200_write_config_dword(struct pci_controller *hose,
- pci_dev_t dev, int offset, u32 value)
-{
- *(volatile u32 *)MPC5XXX_PCI_CAR = (1 << 31) | dev | offset;
- eieio();
- udelay(10);
- out_le32((volatile u32 *)CONFIG_PCI_IO_PHYS, value);
- eieio();
- *(volatile u32 *)MPC5XXX_PCI_CAR = 0;
- udelay(10);
- return 0;
-}
-
-void pci_mpc5xxx_init (struct pci_controller *hose)
-{
- hose->first_busno = 0;
- hose->last_busno = 0xff;
-
- /* System space */
- pci_set_region(hose->regions + 0,
- CONFIG_PCI_MEMORY_BUS,
- CONFIG_PCI_MEMORY_PHYS,
- CONFIG_PCI_MEMORY_SIZE,
- PCI_REGION_MEM | PCI_REGION_MEMORY);
-
- /* PCI memory space */
- pci_set_region(hose->regions + 1,
- CONFIG_PCI_MEM_BUS,
- CONFIG_PCI_MEM_PHYS,
- CONFIG_PCI_MEM_SIZE,
- PCI_REGION_MEM);
-
- /* PCI IO space */
- pci_set_region(hose->regions + 2,
- CONFIG_PCI_IO_BUS,
- CONFIG_PCI_IO_PHYS,
- CONFIG_PCI_IO_SIZE,
- PCI_REGION_IO);
-
- hose->region_count = 3;
-
- pci_register_hose(hose);
-
- /* GPIO Multiplexing - enable PCI */
- *(vu_long *)MPC5XXX_GPS_PORT_CONFIG &= ~(1 << 15);
-
- /* Set host bridge as pci master and enable memory decoding */
- *(vu_long *)MPC5XXX_PCI_CMD |=
- PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
-
- /* Set maximum latency timer */
- *(vu_long *)MPC5XXX_PCI_CFG |= (0xf800);
-
- /* Set cache line size */
- *(vu_long *)MPC5XXX_PCI_CFG = (*(vu_long *)MPC5XXX_PCI_CFG & ~0xff) |
- (CONFIG_CACHELINE_SIZE / 4);
-
- /* Map MBAR to PCI space */
- *(vu_long *)MPC5XXX_PCI_BAR0 = CFG_MBAR;
- *(vu_long *)MPC5XXX_PCI_TBATR0 = CFG_MBAR | 1;
-
- /* Map RAM to PCI space */
- *(vu_long *)MPC5XXX_PCI_BAR1 = CONFIG_PCI_MEMORY_BUS | (1 << 3);
- *(vu_long *)MPC5XXX_PCI_TBATR1 = CONFIG_PCI_MEMORY_PHYS | 1;
-
- /* Park XLB on PCI */
- *(vu_long *)(MPC5XXX_XLBARB + 0x40) &= ~((7 << 8) | (3 << 5));
- *(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (3 << 8) | (3 << 5);
-
- /* Disable interrupts from PCI controller */
- *(vu_long *)MPC5XXX_PCI_GSCR &= ~(7 << 12);
- *(vu_long *)MPC5XXX_PCI_ICR &= ~(7 << 24);
-
- /* Set PCI retry counter to 0 = infinite retry. */
- /* The default of 255 is too short for slow devices. */
- *(vu_long *)MPC5XXX_PCI_ICR &= 0xFFFFFF00;
-
- /* Disable initiator windows */
- *(vu_long *)MPC5XXX_PCI_IWCR = 0;
-
- /* Map PCI memory to physical space */
- *(vu_long *)MPC5XXX_PCI_IW0BTAR = CONFIG_PCI_MEM_PHYS |
- (((CONFIG_PCI_MEM_SIZE - 1) >> 8) & 0x00ff0000) |
- (CONFIG_PCI_MEM_BUS >> 16);
- *(vu_long *)MPC5XXX_PCI_IWCR |= (IWCR_MEM | IWCR_READ | IWCR_EN) << 24;
-
- /* Map PCI I/O to physical space */
- *(vu_long *)MPC5XXX_PCI_IW1BTAR = CONFIG_PCI_IO_PHYS |
- (((CONFIG_PCI_IO_SIZE - 1) >> 8) & 0x00ff0000) |
- (CONFIG_PCI_IO_BUS >> 16);
- *(vu_long *)MPC5XXX_PCI_IWCR |= (IWCR_IO | IWCR_READ | IWCR_EN) << 16;
-
- /* Reset the PCI bus */
- *(vu_long *)MPC5XXX_PCI_GSCR |= 1;
- udelay(1000);
- *(vu_long *)MPC5XXX_PCI_GSCR &= ~1;
- udelay(1000);
-
- pci_set_ops(hose,
- pci_hose_read_config_byte_via_dword,
- pci_hose_read_config_word_via_dword,
- mpc5200_read_config_dword,
- pci_hose_write_config_byte_via_dword,
- pci_hose_write_config_word_via_dword,
- mpc5200_write_config_dword);
-
- udelay(1000);
-
-#ifdef CONFIG_PCI_SCAN_SHOW
- printf("PCI: Bus Dev VenId DevId Class Int\n");
-#endif
-
- hose->last_busno = pci_hose_scan(hose);
-}
-#endif /* CONFIG_PCI && CONFIG_MPC5200 */
diff --git a/cpu/mpc5xxx/reginfo.c b/cpu/mpc5xxx/reginfo.c
deleted file mode 100644
index 130e0357d6..0000000000
--- a/cpu/mpc5xxx/reginfo.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <stdio.h>
-#include <config.h>
-#include <asm/arch/mpc5xxx.h>
-
-void reginfo(void)
-{
- puts ("\nMPC5200 registers\n");
- printf ("MBAR=%08x\n", CFG_MBAR);
- puts ("Memory map registers\n");
- printf ("\tCS0: start %08X\tstop %08X\tconfig %08X\ten %d\n",
- *(volatile ulong*)MPC5XXX_CS0_START,
- *(volatile ulong*)MPC5XXX_CS0_STOP,
- *(volatile ulong*)MPC5XXX_CS0_CFG,
- (*(volatile ulong*)MPC5XXX_ADDECR & 0x00010000) ? 1 : 0);
- printf ("\tCS1: start %08X\tstop %08X\tconfig %08X\ten %d\n",
- *(volatile ulong*)MPC5XXX_CS1_START,
- *(volatile ulong*)MPC5XXX_CS1_STOP,
- *(volatile ulong*)MPC5XXX_CS1_CFG,
- (*(volatile ulong*)MPC5XXX_ADDECR & 0x00020000) ? 1 : 0);
- printf ("\tCS2: start %08X\tstop %08X\tconfig %08X\ten %d\n",
- *(volatile ulong*)MPC5XXX_CS2_START,
- *(volatile ulong*)MPC5XXX_CS2_STOP,
- *(volatile ulong*)MPC5XXX_CS2_CFG,
- (*(volatile ulong*)MPC5XXX_ADDECR & 0x00040000) ? 1 : 0);
- printf ("\tCS3: start %08X\tstop %08X\tconfig %08X\ten %d\n",
- *(volatile ulong*)MPC5XXX_CS3_START,
- *(volatile ulong*)MPC5XXX_CS3_STOP,
- *(volatile ulong*)MPC5XXX_CS3_CFG,
- (*(volatile ulong*)MPC5XXX_ADDECR & 0x00080000) ? 1 : 0);
- printf ("\tCS4: start %08X\tstop %08X\tconfig %08X\ten %d\n",
- *(volatile ulong*)MPC5XXX_CS4_START,
- *(volatile ulong*)MPC5XXX_CS4_STOP,
- *(volatile ulong*)MPC5XXX_CS4_CFG,
- (*(volatile ulong*)MPC5XXX_ADDECR & 0x00100000) ? 1 : 0);
- printf ("\tCS5: start %08X\tstop %08X\tconfig %08X\ten %d\n",
- *(volatile ulong*)MPC5XXX_CS5_START,
- *(volatile ulong*)MPC5XXX_CS5_STOP,
- *(volatile ulong*)MPC5XXX_CS5_CFG,
- (*(volatile ulong*)MPC5XXX_ADDECR & 0x00200000) ? 1 : 0);
- printf ("\tCS6: start %08X\tstop %08X\tconfig %08X\ten %d\n",
- *(volatile ulong*)MPC5XXX_CS6_START,
- *(volatile ulong*)MPC5XXX_CS6_STOP,
- *(volatile ulong*)MPC5XXX_CS6_CFG,
- (*(volatile ulong*)MPC5XXX_ADDECR & 0x04000000) ? 1 : 0);
- printf ("\tCS7: start %08X\tstop %08X\tconfig %08X\ten %d\n",
- *(volatile ulong*)MPC5XXX_CS7_START,
- *(volatile ulong*)MPC5XXX_CS7_STOP,
- *(volatile ulong*)MPC5XXX_CS7_CFG,
- (*(volatile ulong*)MPC5XXX_ADDECR & 0x08000000) ? 1 : 0);
- printf ("\tBOOTCS: start %08X\tstop %08X\tconfig %08X\ten %d\n",
- *(volatile ulong*)MPC5XXX_BOOTCS_START,
- *(volatile ulong*)MPC5XXX_BOOTCS_STOP,
- *(volatile ulong*)MPC5XXX_BOOTCS_CFG,
- (*(volatile ulong*)MPC5XXX_ADDECR & 0x02000000) ? 1 : 0);
- printf ("\tSDRAMCS0: %08X\n",
- *(volatile ulong*)MPC5XXX_SDRAM_CS0CFG);
- printf ("\tSDRAMCS1: %08X\n",
- *(volatile ulong*)MPC5XXX_SDRAM_CS1CFG);
-}
diff --git a/cpu/mpc5xxx/speed.c b/cpu/mpc5xxx/speed.c
deleted file mode 100644
index 7207016831..0000000000
--- a/cpu/mpc5xxx/speed.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/arch/mpc5xxx.h>
-#include <init.h>
-#include <asm/processor.h>
-#include <types.h>
-
-/* Bus-to-Core Multipliers */
-
-static int bus2core[] = {
- 3, 2, 2, 2, 4, 4, 5, 9,
- 6, 11, 8, 10, 3, 12, 7, 0,
- 6, 5, 13, 2, 14, 4, 15, 9,
- 0, 11, 8, 10, 16, 12, 7, 0
-};
-
-unsigned long get_bus_clock(void)
-{
- unsigned long val, vco;
-
-#if !defined(CFG_MPC5XXX_CLKIN)
-#error clock measuring not implemented yet - define CFG_MPC5XXX_CLKIN
-#endif
-
- val = *(vu_long *)MPC5XXX_CDM_PORCFG;
- if (val & (1 << 6))
- vco = CFG_MPC5XXX_CLKIN * 12;
- else
- vco = CFG_MPC5XXX_CLKIN * 16;
-
- if (val & (1 << 5))
- return vco / 8;
- else
- return vco / 4;
-}
-
-unsigned long get_cpu_clock(void)
-{
- unsigned long val;
- val = *(vu_long *)MPC5XXX_CDM_PORCFG;
- return get_bus_clock() * bus2core[val & 0x1f] / 2;
-}
-
-unsigned long get_ipb_clock(void)
-{
- unsigned long val;
-
- val = *(vu_long *)MPC5XXX_CDM_CFG;
- if (val & (1 << 8))
- return get_bus_clock() / 2;
- else
- return get_bus_clock();
-}
-
-unsigned long get_pci_clock(void)
-{
- unsigned long val;
-
- val = *(vu_long *)MPC5XXX_CDM_CFG;
- switch (val & 3) {
- case 0:
- return get_ipb_clock();
- case 1:
- return get_ipb_clock() / 2;
- default:
- return get_bus_clock() / 4;
- }
-}
-
-unsigned long get_timebase_clock(void)
-{
- return (get_bus_clock() + 3L) / 4L;
-}
-
-int prt_mpc5xxx_clks (void)
-{
- printf(" Bus %ld MHz, IPB %ld MHz, PCI %ld MHz\n",
- get_bus_clock() / 1000000, get_ipb_clock() / 1000000,
- get_pci_clock() / 1000000);
-
- return 0;
-}
-
-late_initcall(prt_mpc5xxx_clks);
-
diff --git a/cpu/mpc5xxx/start.S b/cpu/mpc5xxx/start.S
deleted file mode 100644
index e9fe76ebbd..0000000000
--- a/cpu/mpc5xxx/start.S
+++ /dev/null
@@ -1,797 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2000 - 2003 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * U-Boot - Startup Code for MPC5xxx CPUs
- */
-#include <config.h>
-#include <asm/arch/mpc5xxx.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-/* We don't want the MMU yet.
-*/
-#undef MSR_KERNEL
-/* Floating Point enable, Machine Check and Recoverable Interr. */
-#ifdef DEBUG
-#define MSR_KERNEL (MSR_FP|MSR_RI)
-#else
-#define MSR_KERNEL (MSR_FP|MSR_ME|MSR_RI)
-#endif
-
-/*
- * Set up GOT: Global Offset Table
- *
- * Use r14 to access the GOT
- */
- START_GOT
- GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_FIXUP_TABLE_)
-
- GOT_ENTRY(_start)
- GOT_ENTRY(_start_of_vectors)
- GOT_ENTRY(_end_of_vectors)
- GOT_ENTRY(transfer_to_handler)
-
- GOT_ENTRY(__init_end)
- GOT_ENTRY(_end)
- GOT_ENTRY(__bss_start)
- END_GOT
-
-/*
- * Exception vectors
- */
- .text
- . = EXC_OFF_SYS_RESET
- .globl _start
-_start:
- li r21, BOOTFLAG_COLD /* Normal Power-On */
- nop
- b boot_cold
-
- . = EXC_OFF_SYS_RESET + 0x10
-
- .globl _start_warm
-_start_warm:
- li r21, BOOTFLAG_WARM /* Software reboot */
- b boot_warm
-
-boot_cold:
-boot_warm:
- mfmsr r5 /* save msr contents */
-
- /* Move CSBoot and adjust instruction pointer */
- /*--------------------------------------------------------------*/
-
-#if defined(CFG_LOWBOOT)
-# if defined(CFG_RAMBOOT)
-# error CFG_LOWBOOT is incompatible with CFG_RAMBOOT
-# endif /* CFG_RAMBOOT */
-# if defined(CONFIG_MGT5100)
-# error CFG_LOWBOOT is incompatible with MGT5100
-# endif /* CONFIG_MGT5100 */
- lis r4, CFG_DEFAULT_MBAR@h
- lis r3, START_REG(CFG_BOOTCS_START)@h
- ori r3, r3, START_REG(CFG_BOOTCS_START)@l
- stw r3, 0x4(r4) /* CS0 start */
- lis r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@h
- ori r3, r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@l
- stw r3, 0x8(r4) /* CS0 stop */
- lis r3, 0x02010000@h
- ori r3, r3, 0x02010000@l
- stw r3, 0x54(r4) /* CS0 and Boot enable */
-
- lis r3, lowboot_reentry@h /* jump from bootlow address space (0x0000xxxx) */
- ori r3, r3, lowboot_reentry@l /* to the address space the linker used */
- mtlr r3
- blr
-
-lowboot_reentry:
- lis r3, START_REG(CFG_BOOTCS_START)@h
- ori r3, r3, START_REG(CFG_BOOTCS_START)@l
- stw r3, 0x4c(r4) /* Boot start */
- lis r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@h
- ori r3, r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@l
- stw r3, 0x50(r4) /* Boot stop */
- lis r3, 0x02000001@h
- ori r3, r3, 0x02000001@l
- stw r3, 0x54(r4) /* Boot enable, CS0 disable */
-#endif /* CFG_LOWBOOT */
-
-#if defined(CFG_DEFAULT_MBAR) && !defined(CFG_RAMBOOT)
- lis r3, CFG_MBAR@h
- ori r3, r3, CFG_MBAR@l
-#if defined(CONFIG_MPC5200)
- /* MBAR is mirrored into the MBAR SPR */
- mtspr MBAR,r3
- rlwinm r3, r3, 16, 16, 31
-#endif
-#if defined(CONFIG_MGT5100)
- rlwinm r3, r3, 17, 15, 31
-#endif
- lis r4, CFG_DEFAULT_MBAR@h
- stw r3, 0(r4)
-#endif /* CFG_DEFAULT_MBAR */
-
- /* Initialise the MPC5xxx processor core */
- /*--------------------------------------------------------------*/
-
- bl init_5xxx_core
-
- /* initialize some things that are hard to access from C */
- /*--------------------------------------------------------------*/
-
- /* set up stack in on-chip SRAM */
- lis r3, CFG_INIT_RAM_ADDR@h
- ori r3, r3, CFG_INIT_RAM_ADDR@l
- ori r1, r3, CFG_INIT_SP_OFFSET
- li r0, 0 /* Make room for stack frame header and */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
-
- /* let the C-code set up the rest */
- /* */
- /* Be careful to keep code relocatable ! */
- /*--------------------------------------------------------------*/
-
- GET_GOT /* initialize GOT access */
-
- /* r3: IMMR */
- bl cpu_init_f /* run low-level CPU init code (in Flash)*/
-
- mr r3, r21
- /* r3: BOOTFLAG */
- bl initdram /* initialize sdram */
- /* r3: End of RAM */
-
- b _continue_init
-/*
- * Vector Table
- */
-
- .globl _start_of_vectors
-_start_of_vectors:
-
-/* Machine check */
- STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. */
- STD_EXCEPTION(0x300, DataStorage, UnknownException)
-
-/* Instruction Storage exception. */
- STD_EXCEPTION(0x400, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
-#ifdef CONFIG_INTERRUPTS
- STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
-#endif
-
-/* Alignment exception. */
- . = 0x600
-Alignment:
- EXCEPTION_PROLOG
- mfspr r4,DAR
- stw r4,_DAR(r21)
- mfspr r5,DSISR
- stw r5,_DSISR(r21)
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- rlwimi r20,r23,0,25,25 /* copy IP bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_Alignment:
- .long AlignmentException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
- . = 0x700
-ProgramCheck:
- EXCEPTION_PROLOG
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- rlwimi r20,r23,0,25,25 /* copy IP bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_ProgramCheck:
- .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
- STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
-
- /* I guess we could implement decrementer, and may have
- * to someday for timekeeping.
- */
-#ifdef CONFIG_INTERRUPTS
- STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
-#else
- STD_EXCEPTION(0x900, Decrementer, UnknownException)
-#endif
- STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
- STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
- STD_EXCEPTION(0xc00, SystemCall, UnknownException)
- STD_EXCEPTION(0xd00, SingleStep, UnknownException)
-
- STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
- STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
-
- STD_EXCEPTION(0x1000, InstructionTLBMiss, UnknownException)
- STD_EXCEPTION(0x1100, DataLoadTLBMiss, UnknownException)
- STD_EXCEPTION(0x1200, DataStoreTLBMiss, UnknownException)
-#ifdef DEBUG
- . = 0x1300
- /*
- * This exception occurs when the program counter matches the
- * Instruction Address Breakpoint Register (IABR).
- *
- * I want the cpu to halt if this occurs so I can hunt around
- * with the debugger and look at things.
- *
- * When DEBUG is defined, both machine check enable (in the MSR)
- * and checkstop reset enable (in the reset mode register) are
- * turned off and so a checkstop condition will result in the cpu
- * halting.
- *
- * I force the cpu into a checkstop condition by putting an illegal
- * instruction here (at least this is the theory).
- *
- * well - that didnt work, so just do an infinite loop!
- */
-1: b 1b
-#else
- STD_EXCEPTION(0x1300, InstructionBreakpoint, DebugException)
-#endif
- STD_EXCEPTION(0x1400, SMI, UnknownException)
-
- STD_EXCEPTION(0x1500, Trap_15, UnknownException)
- STD_EXCEPTION(0x1600, Trap_16, UnknownException)
- STD_EXCEPTION(0x1700, Trap_17, UnknownException)
- STD_EXCEPTION(0x1800, Trap_18, UnknownException)
- STD_EXCEPTION(0x1900, Trap_19, UnknownException)
- STD_EXCEPTION(0x1a00, Trap_1a, UnknownException)
- STD_EXCEPTION(0x1b00, Trap_1b, UnknownException)
- STD_EXCEPTION(0x1c00, Trap_1c, UnknownException)
- STD_EXCEPTION(0x1d00, Trap_1d, UnknownException)
- STD_EXCEPTION(0x1e00, Trap_1e, UnknownException)
- STD_EXCEPTION(0x1f00, Trap_1f, UnknownException)
- STD_EXCEPTION(0x2000, Trap_20, UnknownException)
- STD_EXCEPTION(0x2100, Trap_21, UnknownException)
- STD_EXCEPTION(0x2200, Trap_22, UnknownException)
- STD_EXCEPTION(0x2300, Trap_23, UnknownException)
- STD_EXCEPTION(0x2400, Trap_24, UnknownException)
- STD_EXCEPTION(0x2500, Trap_25, UnknownException)
- STD_EXCEPTION(0x2600, Trap_26, UnknownException)
- STD_EXCEPTION(0x2700, Trap_27, UnknownException)
- STD_EXCEPTION(0x2800, Trap_28, UnknownException)
- STD_EXCEPTION(0x2900, Trap_29, UnknownException)
- STD_EXCEPTION(0x2a00, Trap_2a, UnknownException)
- STD_EXCEPTION(0x2b00, Trap_2b, UnknownException)
- STD_EXCEPTION(0x2c00, Trap_2c, UnknownException)
- STD_EXCEPTION(0x2d00, Trap_2d, UnknownException)
- STD_EXCEPTION(0x2e00, Trap_2e, UnknownException)
- STD_EXCEPTION(0x2f00, Trap_2f, UnknownException)
-
-
- .globl _end_of_vectors
-_end_of_vectors:
-
- . = 0x3000
-
-_continue_init:
-
- mr r1, r3 /* Set new stack pointer at end of RAM */
- subi r1, r1, 0x10
- mr r9, r3 /* Save copy of end of RAM */
-
- lis r3, CFG_MONITOR_BASE@h /* Destination Address */
- ori r3, r3, CFG_MONITOR_BASE@l
- mr r10, r3 /* Save copy of Destination Address */
-
- bl calc_source /* Calculate Source Address */
-calc_source:
- mfspr r4, LR
- subi r4, r4, (calc_source - _start)
- subi r4, r4, 0x100
-
- lis r5, __init_size@h /* Size */
- ori r5, r5, __init_size@l
-
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
- *
- * Offset:
- */
- sub r15, r10, r4
-
- /* First our own GOT */
- add r14, r14, r15
- /* then the one used by the C code */
- add r30, r30, r15
-
- /*
- * Now relocate code
- */
-
- cmplw cr1,r3,r4
- addi r0,r5,3
- srwi. r0,r0,2
- beq cr1,4f /* In place copy is not necessary */
- beq 7f /* Protect against 0 count */
- mtctr r0
- bge cr1,2f
-
- la r8,-4(r4)
- la r7,-4(r3)
-1: lwzu r0,4(r8)
- stwu r0,4(r7)
- bdnz 1b
- b 4f
-
-2: slwi r0,r0,2
- add r8,r4,r0
- add r7,r3,r0
-3: lwzu r0,-4(r8)
- stwu r0,-4(r7)
- bdnz 3b
-
-/*
- * Now flush the cache: note that we must start from a cache aligned
- * address. Otherwise we might miss one cache line.
- */
-4: cmpwi r6,0
- add r5,r3,r5
- beq 7f /* Always flush prefetch queue in any case */
- subi r0,r6,1
- andc r3,r3,r0
- mfspr r7,HID0 /* don't do dcbst if dcache is disabled */
- rlwinm r7,r7,HID0_DCE_BITPOS+1,31,31
- cmpwi r7,0
- beq 9f
- mr r4,r3
-5: dcbst 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 5b
- sync /* Wait for all dcbst to complete on bus */
-9: mfspr r7,HID0 /* don't do icbi if icache is disabled */
- rlwinm r7,r7,HID0_ICE_BITPOS+1,31,31
- cmpwi r7,0
- beq 7f
- mr r4,r3
-6: icbi 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 6b
-7: sync /* Wait for all icbi to complete on bus */
- isync
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-
- addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
- mtlr r0
- blr
-
-in_ram:
-
- /*
- * Relocation Function, r14 point to got2+0x8000
- *
- * Adjust got2 pointers, no need to check for 0, this code
- * already puts a few entries in the table.
- */
- li r0,__got2_entries@sectoff@l
- la r3,GOT(_GOT2_TABLE_)
- lwz r11,GOT(_GOT2_TABLE_)
- mtctr r0
- sub r11,r3,r11
- addi r3,r3,-4
-1: lwzu r0,4(r3)
- add r0,r0,r11
- stw r0,0(r3)
- bdnz 1b
-
- /*
- * Now adjust the fixups and the pointers to the fixups
- * in case we need to move ourselves again.
- */
-2: li r0,__fixup_entries@sectoff@l
- lwz r3,GOT(_FIXUP_TABLE_)
- cmpwi r0,0
- mtctr r0
- addi r3,r3,-4
- beq 4f
-3: lwzu r4,4(r3)
- lwzux r0,r4,r11
- add r0,r0,r11
- stw r10,0(r3)
- stw r0,0(r4)
- bdnz 3b
-4:
-clear_bss:
- /*
- * Now clear BSS segment
- */
- lwz r3,GOT(__bss_start)
- lwz r4,GOT(_end)
-
- cmplw 0, r3, r4
- beq 6f
-
- li r0, 0
-5:
- stw r0, 0(r3)
- addi r3, r3, 4
- cmplw 0, r3, r4
- bne 5b
-6:
-
- mr r3, r9 /* end of RAM */
- bl board_init_r
-
-/*
- * This code finishes saving the registers to the exception frame
- * and jumps to the appropriate handler for the exception.
- * Register r21 is pointer into trap frame, r1 has new stack pointer.
- */
- .globl transfer_to_handler
-transfer_to_handler:
- stw r22,_NIP(r21)
- lis r22,MSR_POW@h
- andc r23,r23,r22
- stw r23,_MSR(r21)
- SAVE_GPR(7, r21)
- SAVE_4GPRS(8, r21)
- SAVE_8GPRS(12, r21)
- SAVE_8GPRS(24, r21)
- mflr r23
- andi. r24,r23,0x3f00 /* get vector offset */
- stw r24,TRAP(r21)
- li r22,0
- stw r22,RESULT(r21)
- lwz r24,0(r23) /* virtual address of handler */
- lwz r23,4(r23) /* where to go when done */
- mtspr SRR0,r24
- mtspr SRR1,r20
- mtlr r23
- SYNC
- rfi /* jump to handler, enable MMU */
-
-int_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr SRR0,r2
- mtspr SRR1,r0
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfi
-
-/*
- * This code initialises the MPC5xxx processor core
- * (conforms to PowerPC 603e spec)
- * Note: expects original MSR contents to be in r5.
- */
-
- .globl init_5xx_core
-init_5xxx_core:
-
- /* Initialize machine status; enable machine check interrupt */
- /*--------------------------------------------------------------*/
-
- li r3, MSR_KERNEL /* Set ME and RI flags */
- rlwimi r3, r5, 0, 25, 25 /* preserve IP bit set by HRCW */
-#ifdef DEBUG
- rlwimi r3, r5, 0, 21, 22 /* debugger might set SE & BE bits */
-#endif
- SYNC /* Some chip revs need this... */
- mtmsr r3
- SYNC
- mtspr SRR1, r3 /* Make SRR1 match MSR */
-
- /* Initialize the Hardware Implementation-dependent Registers */
- /* HID0 also contains cache control */
- /*--------------------------------------------------------------*/
-
- lis r3, CFG_HID0_INIT@h
- ori r3, r3, CFG_HID0_INIT@l
- SYNC
- mtspr HID0, r3
-
- lis r3, CFG_HID0_FINAL@h
- ori r3, r3, CFG_HID0_FINAL@l
- SYNC
- mtspr HID0, r3
-
- /* clear all BAT's */
- /*--------------------------------------------------------------*/
-
- li r0, 0
- mtspr DBAT0U, r0
- mtspr DBAT0L, r0
- mtspr DBAT1U, r0
- mtspr DBAT1L, r0
- mtspr DBAT2U, r0
- mtspr DBAT2L, r0
- mtspr DBAT3U, r0
- mtspr DBAT3L, r0
- mtspr DBAT4U, r0
- mtspr DBAT4L, r0
- mtspr DBAT5U, r0
- mtspr DBAT5L, r0
- mtspr DBAT6U, r0
- mtspr DBAT6L, r0
- mtspr DBAT7U, r0
- mtspr DBAT7L, r0
- mtspr IBAT0U, r0
- mtspr IBAT0L, r0
- mtspr IBAT1U, r0
- mtspr IBAT1L, r0
- mtspr IBAT2U, r0
- mtspr IBAT2L, r0
- mtspr IBAT3U, r0
- mtspr IBAT3L, r0
- mtspr IBAT4U, r0
- mtspr IBAT4L, r0
- mtspr IBAT5U, r0
- mtspr IBAT5L, r0
- mtspr IBAT6U, r0
- mtspr IBAT6L, r0
- mtspr IBAT7U, r0
- mtspr IBAT7L, r0
- SYNC
-
- /* invalidate all tlb's */
- /* */
- /* From the 603e User Manual: "The 603e provides the ability to */
- /* invalidate a TLB entry. The TLB Invalidate Entry (tlbie) */
- /* instruction invalidates the TLB entry indexed by the EA, and */
- /* operates on both the instruction and data TLBs simultaneously*/
- /* invalidating four TLB entries (both sets in each TLB). The */
- /* index corresponds to bits 15-19 of the EA. To invalidate all */
- /* entries within both TLBs, 32 tlbie instructions should be */
- /* issued, incrementing this field by one each time." */
- /* */
- /* "Note that the tlbia instruction is not implemented on the */
- /* 603e." */
- /* */
- /* bits 15-19 correspond to addresses 0x00000000 to 0x0001F000 */
- /* incrementing by 0x1000 each time. The code below is sort of */
- /* based on code in "flush_tlbs" from arch/ppc/kernel/head.S */
- /* */
- /*--------------------------------------------------------------*/
-
- li r3, 32
- mtctr r3
- li r3, 0
-1: tlbie r3
- addi r3, r3, 0x1000
- bdnz 1b
- SYNC
-
- /* Done! */
- /*--------------------------------------------------------------*/
-
- blr
-
-/* Cache functions.
- *
- * Note: requires that all cache bits in
- * HID0 are in the low half word.
- */
- .globl icache_enable
-icache_enable:
- mfspr r3, HID0
- ori r3, r3, HID0_ICE
- lis r4, 0
- ori r4, r4, HID0_ILOCK
- andc r3, r3, r4
- ori r4, r3, HID0_ICFI
- isync
- mtspr HID0, r4 /* sets enable and invalidate, clears lock */
- isync
- mtspr HID0, r3 /* clears invalidate */
- blr
-
- .globl icache_disable
-icache_disable:
- mfspr r3, HID0
- lis r4, 0
- ori r4, r4, HID0_ICE|HID0_ILOCK
- andc r3, r3, r4
- ori r4, r3, HID0_ICFI
- isync
- mtspr HID0, r4 /* sets invalidate, clears enable and lock */
- isync
- mtspr HID0, r3 /* clears invalidate */
- blr
-
- .globl icache_status
-icache_status:
- mfspr r3, HID0
- rlwinm r3, r3, HID0_ICE_BITPOS + 1, 31, 31
- blr
-
- .globl dcache_enable
-dcache_enable:
- mfspr r3, HID0
- ori r3, r3, HID0_DCE
- lis r4, 0
- ori r4, r4, HID0_DLOCK
- andc r3, r3, r4
- ori r4, r3, HID0_DCI
- sync
- mtspr HID0, r4 /* sets enable and invalidate, clears lock */
- sync
- mtspr HID0, r3 /* clears invalidate */
- blr
-
- .globl dcache_disable
-dcache_disable:
- mfspr r3, HID0
- lis r4, 0
- ori r4, r4, HID0_DCE|HID0_DLOCK
- andc r3, r3, r4
- ori r4, r3, HID0_DCI
- sync
- mtspr HID0, r4 /* sets invalidate, clears enable and lock */
- sync
- mtspr HID0, r3 /* clears invalidate */
- blr
-
- .globl dcache_status
-dcache_status:
- mfspr r3, HID0
- rlwinm r3, r3, HID0_DCE_BITPOS + 1, 31, 31
- blr
-
- .globl get_svr
-get_svr:
- mfspr r3, SVR
- blr
-
- .globl get_pvr
-get_pvr:
- mfspr r3, PVR
- blr
-
- /*
- * Copy exception vector code to low memory
- *
- * r3: dest_addr
- * r7: source address, r8: end address, r9: target address
- */
- .globl trap_init
-trap_init:
- lwz r7, GOT(_start)
- lwz r8, GOT(_end_of_vectors)
-
- li r9, 0x100 /* reset vector always at 0x100 */
-
- cmplw 0, r7, r8
- bgelr /* return if r7>=r8 - just in case */
-
- mflr r4 /* save link register */
-1:
- lwz r0, 0(r7)
- stw r0, 0(r9)
- addi r7, r7, 4
- addi r9, r9, 4
- cmplw 0, r7, r8
- bne 1b
-
- /*
- * relocate `hdlr' and `int_return' entries
- */
- li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
- li r8, Alignment - _start + EXC_OFF_SYS_RESET
-2:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 2b
-
- li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
- li r8, SystemCall - _start + EXC_OFF_SYS_RESET
-3:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 3b
-
- li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
- li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-4:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 4b
-
- mfmsr r3 /* now that the vectors have */
- lis r7, MSR_IP@h /* relocated into low memory */
- ori r7, r7, MSR_IP@l /* MSR[IP] can be turned off */
- andc r3, r3, r7 /* (if it was on) */
- SYNC /* Some chip revs need this... */
- mtmsr r3
- SYNC
-
- mtlr r4 /* restore link register */
- blr
-
- /*
- * Function: relocate entries for one exception vector
- */
-trap_reloc:
- lwz r0, 0(r7) /* hdlr ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 0(r7)
-
- lwz r0, 4(r7) /* int_return ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 4(r7)
-
- blr
diff --git a/cpu/mpc5xxx/traps.c b/cpu/mpc5xxx/traps.c
deleted file mode 100644
index 865a742fce..0000000000
--- a/cpu/mpc5xxx/traps.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * linux/arch/ppc/kernel/traps.c
- *
- * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- * Modified by Cort Dougan (cort@cs.nmt.edu)
- * and Paul Mackerras (paulus@cs.anu.edu.au)
- * fixed Machine Check Reasons by Reinhard Meyer (r.meyer@emk-elektronik.de)
- *
- * (C) Copyright 2000-2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * This file handles the architecture-dependent parts of hardware exceptions
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/processor.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
-/* Returns 0 if exception not found and fixup otherwise. */
-extern unsigned long search_exception_table(unsigned long);
-
-/* THIS NEEDS CHANGING to use the board info structure.
-*/
-#define END_OF_MEM 0x02000000
-
-/*
- * Trap & Exception support
- */
-
-void
-print_backtrace(unsigned long *sp)
-{
- int cnt = 0;
- unsigned long i;
-
- printf("Call backtrace: ");
- while (sp) {
- if ((uint)sp > END_OF_MEM)
- break;
-
- i = sp[1];
- if (cnt++ % 7 == 0)
- printf("\n");
- printf("%08lX ", i);
- if (cnt > 32) break;
- sp = (unsigned long *)*sp;
- }
- printf("\n");
-}
-
-void show_regs(struct pt_regs * regs)
-{
- int i;
-
- printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
- regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
- printf("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
- regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
- regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
- regs->msr&MSR_IR ? 1 : 0,
- regs->msr&MSR_DR ? 1 : 0);
-
- printf("\n");
- for (i = 0; i < 32; i++) {
- if ((i % 8) == 0)
- {
- printf("GPR%02d: ", i);
- }
-
- printf("%08lX ", regs->gpr[i]);
- if ((i % 8) == 7)
- {
- printf("\n");
- }
- }
-}
-
-
-void
-_exception(int signr, struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
-}
-
-void
-MachineCheckException(struct pt_regs *regs)
-{
- unsigned long fixup;
-
- /* Probing PCI using config cycles cause this exception
- * when a device is not present. Catch it and return to
- * the PCI exception handler.
- */
- if ((fixup = search_exception_table(regs->nip)) != 0) {
- regs->nip = fixup;
- return;
- }
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- printf("Machine check in kernel mode.\n");
- printf("Caused by (from msr): ");
- printf("regs %p ",regs);
- /* refer to 603e Manual (MPC603EUM/AD), chapter 4.5.2.1 */
- switch( regs->msr & 0x000F0000)
- {
- case (0x80000000>>12) :
- printf("Machine check signal - probably due to mm fault\n"
- "with mmu off\n");
- break;
- case (0x80000000>>13) :
- printf("Transfer error ack signal\n");
- break;
- case (0x80000000>>14) :
- printf("Data parity signal\n");
- break;
- case (0x80000000>>15) :
- printf("Address parity signal\n");
- break;
- default:
- printf("Unknown values in msr\n");
- }
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("machine check");
-}
-
-void
-AlignmentException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Alignment Exception");
-}
-
-void
-ProgramCheckException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Program Check Exception");
-}
-
-void
-SoftEmuException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Software Emulation Exception");
-}
-
-
-void
-UnknownException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
- regs->nip, regs->msr, regs->trap);
- _exception(0, regs);
-}
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
-extern void do_bedbug_breakpoint(struct pt_regs *);
-#endif
-
-void
-DebugException(struct pt_regs *regs)
-{
-
- printf("Debugger trap at @ %lx\n", regs->nip );
- show_regs(regs);
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
- do_bedbug_breakpoint( regs );
-#endif
-}
-
-/* Probe an address by reading. If not present, return -1, otherwise
- * return 0.
- */
-int
-addr_probe(uint *addr)
-{
- return 0;
-}
diff --git a/cpu/mpc8220/Makefile b/cpu/mpc8220/Makefile
deleted file mode 100644
index b4fad286dc..0000000000
--- a/cpu/mpc8220/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# (C) Copyright 2003-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-SOBJS = io.o fec_dma_tasks.o
-COBJS = cpu.o cpu_init.o dramSetup.o fec.o i2c.o \
- interrupts.o loadtask.o speed.o \
- traps.o uart.o pci.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/mpc8220/config.mk b/cpu/mpc8220/config.mk
deleted file mode 100644
index 6fec5dfe60..0000000000
--- a/cpu/mpc8220/config.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# (C) Copyright 2003
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_MPC8220 -ffixed-r2 -ffixed-r29 \
- -mstring -mcpu=603e -mmultiple
diff --git a/cpu/mpc8220/cpu.c b/cpu/mpc8220/cpu.c
deleted file mode 100644
index b4e351fe46..0000000000
--- a/cpu/mpc8220/cpu.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * (C) Copyright 2000-2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * CPU specific code for the MPC8220 CPUs
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <command.h>
-#include <mpc8220.h>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int checkcpu (void)
-{
- ulong clock = gd->cpu_clk;
- char buf[32];
-
- puts ("CPU: ");
-
- printf (CPU_ID_STR);
-
- printf (" (JTAG ID %08lx)", *(vu_long *) (CFG_MBAR + 0x50));
-
- printf (" at %s MHz\n", strmhz (buf, clock));
-
- return 0;
-}
-
-/* ------------------------------------------------------------------------- */
-
-int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
-{
- volatile gptmr8220_t *gptmr = (volatile gptmr8220_t *) MMAP_GPTMR;
- ulong msr;
-
- /* Interrupts and MMU off */
- __asm__ __volatile__ ("mfmsr %0":"=r" (msr):);
-
- msr &= ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR);
- __asm__ __volatile__ ("mtmsr %0"::"r" (msr));
-
- /* Charge the watchdog timer */
- gptmr->Prescl = 10;
- gptmr->Count = 1;
-
- gptmr->Mode = GPT_TMS_SGPIO;
-
- gptmr->Control = GPT_CTRL_WDEN | GPT_CTRL_CE;
-
- return 1;
-}
-
-/* ------------------------------------------------------------------------- */
-
-/*
- * Get timebase clock frequency (like cpu_clk in Hz)
- *
- */
-unsigned long get_tbclk (void)
-{
- ulong tbclk;
-
- tbclk = (gd->bus_clk + 3L) / 4L;
-
- return (tbclk);
-}
-
-/* ------------------------------------------------------------------------- */
-
-static int mpc8220_bd_init(void)
-{
- bd_t *bd = gd->bd;
-
- bd->bi_sramstart = CFG_SRAM_BASE; /* start of SRAM memory */
- bd->bi_sramsize = CFG_SRAM_SIZE; /* size of SRAM memory */
-
- bd->bi_mbar_base = CFG_MBAR; /* base of internal registers */
- bd->bi_inpfreq = gd->inp_clk;
- bd->bi_pcifreq = gd->pci_clk;
- bd->bi_vcofreq = gd->vco_clk;
- bd->bi_pevfreq = gd->pev_clk;
- bd->bi_flbfreq = gd->flb_clk;
-
- /* store bootparam to sram (backward compatible), here? */
- {
- u32 *sram = (u32 *)CFG_SRAM_BASE;
- *sram++ = gd->ram_size;
- *sram++ = gd->bus_clk;
- *sram++ = gd->inp_clk;
- *sram++ = gd->cpu_clk;
- *sram++ = gd->vco_clk;
- *sram++ = gd->flb_clk;
- *sram++ = 0xb8c3ba11; /* boot signature */
- }
-}
-
-bd_initcall(mpc8220_bd_init);
diff --git a/cpu/mpc8220/cpu_init.c b/cpu/mpc8220/cpu_init.c
deleted file mode 100644
index 3cf5f66a13..0000000000
--- a/cpu/mpc8220/cpu_init.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * (C) Copyright 2000-2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc8220.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/*
- * Breath some life into the CPU...
- *
- * Set up the memory map,
- * initialize a bunch of registers.
- */
-void cpu_init_f (void)
-{
- volatile flexbus8220_t *flexbus = (volatile flexbus8220_t *) MMAP_FB;
- volatile pcfg8220_t *portcfg = (volatile pcfg8220_t *) MMAP_PCFG;
- volatile xlbarb8220_t *xlbarb = (volatile xlbarb8220_t *) MMAP_XLBARB;
-
- /* Pointer is writable since we allocated a register for it */
- gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
-
- /* Clear initial global data */
- memset ((void *) gd, 0, sizeof (gd_t));
-
- /* Clear all port configuration */
- portcfg->pcfg0 = 0;
- portcfg->pcfg1 = 0;
- portcfg->pcfg2 = 0;
- portcfg->pcfg3 = 0;
- portcfg->pcfg2 = CFG_GP1_PORT2_CONFIG;
- portcfg->pcfg3 = CFG_PCI_PORT3_CONFIG | CFG_GP2_PORT3_CONFIG;
-
- /*
- * Flexbus Controller: configure chip selects and enable them
- */
-#if defined (CFG_CS0_BASE)
- flexbus->csar0 = CFG_CS0_BASE;
-
-/* Sorcery-C can hang-up after CTRL reg initialization */
-#if defined (CFG_CS0_CTRL)
- flexbus->cscr0 = CFG_CS0_CTRL;
-#endif
- flexbus->csmr0 = ((CFG_CS0_MASK - 1) & 0xffff0000) | 1;
- __asm__ volatile ("sync");
-#endif
-#if defined (CFG_CS1_BASE)
- flexbus->csar1 = CFG_CS1_BASE;
- flexbus->cscr1 = CFG_CS1_CTRL;
- flexbus->csmr1 = ((CFG_CS1_MASK - 1) & 0xffff0000) | 1;
- __asm__ volatile ("sync");
-#endif
-#if defined (CFG_CS2_BASE)
- flexbus->csar2 = CFG_CS2_BASE;
- flexbus->cscr2 = CFG_CS2_CTRL;
- flexbus->csmr2 = ((CFG_CS2_MASK - 1) & 0xffff0000) | 1;
- portcfg->pcfg3 |= CFG_CS2_PORT3_CONFIG;
- __asm__ volatile ("sync");
-#endif
-#if defined (CFG_CS3_BASE)
- flexbus->csar3 = CFG_CS3_BASE;
- flexbus->cscr3 = CFG_CS3_CTRL;
- flexbus->csmr3 = ((CFG_CS3_MASK - 1) & 0xffff0000) | 1;
- portcfg->pcfg3 |= CFG_CS3_PORT3_CONFIG;
- __asm__ volatile ("sync");
-#endif
-#if defined (CFG_CS4_BASE)
- flexbus->csar4 = CFG_CS4_BASE;
- flexbus->cscr4 = CFG_CS4_CTRL;
- flexbus->csmr4 = ((CFG_CS4_MASK - 1) & 0xffff0000) | 1;
- portcfg->pcfg3 |= CFG_CS4_PORT3_CONFIG;
- __asm__ volatile ("sync");
-#endif
-#if defined (CFG_CS5_BASE)
- flexbus->csar5 = CFG_CS5_BASE;
- flexbus->cscr5 = CFG_CS5_CTRL;
- flexbus->csmr5 = ((CFG_CS5_MASK - 1) & 0xffff0000) | 1;
- portcfg->pcfg3 |= CFG_CS5_PORT3_CONFIG;
- __asm__ volatile ("sync");
-#endif
-
- /* This section of the code cannot place in cpu_init_r(),
- it will cause the system to hang */
- /* enable timebase */
- xlbarb->addrTenTimeOut = 0x1000;
- xlbarb->dataTenTimeOut = 0x1000;
- xlbarb->busActTimeOut = 0x2000;
-
- xlbarb->config = 0x00002000;
-
- /* Master Priority Enable */
- xlbarb->mastPriority = 0;
- xlbarb->mastPriEn = 0xff;
-}
-
-/*
- * initialize higher level parts of CPU like time base and timers
- */
-int cpu_init_r (void)
-{
- /* this may belongs to disable interrupt section */
- /* mask all interrupts */
- *(vu_long *) 0xf0000700 = 0xfffffc00;
- *(vu_long *) 0xf0000714 |= 0x0001ffff;
- *(vu_long *) 0xf0000710 &= ~0x00000f00;
-
- /* route critical ints to normal ints */
- *(vu_long *) 0xf0000710 |= 0x00000001;
-
-#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_MPC8220_FEC)
- /* load FEC microcode */
- loadtask (0, 2);
-#endif
- return (0);
-}
diff --git a/cpu/mpc8220/dma.h b/cpu/mpc8220/dma.h
deleted file mode 100644
index d06ee63139..0000000000
--- a/cpu/mpc8220/dma.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * This file is based on code
- * (C) Copyright Motorola, Inc., 2000
- *
- * MPC8220 dma header file
- */
-
-#ifndef __MPC8220_DMA_H
-#define __MPC8220_DMA_H
-
-#include <common.h>
-#include <mpc8220.h>
-
-/* Task number assignment */
-#define FEC_RECV_TASK_NO 0
-#define FEC_XMIT_TASK_NO 1
-
-/*---------------------------------------------------------------------
- * Stuff for Ethernet Tx/Rx tasks
- *---------------------------------------------------------------------
- */
-
-/* Layout of Ethernet controller Parameter SRAM area:
- * ----------------------------------------------------------------
- * 0x00: TBD_BASE, base address of TX BD ring
- * 0x04: TBD_NEXT, address of next TX BD to be processed
- * 0x08: RBD_BASE, base address of RX BD ring
- * 0x0C: RBD_NEXT, address of next RX BD to be processed
- * ---------------------------------------------------------------
- * ALL PARAMETERS ARE ALL LONGWORDS (FOUR BYTES EACH).
- */
-
-/* base address of SRAM area to store parameters used by Ethernet tasks */
-#define FEC_PARAM_BASE (MMAP_SRAM + 0x5b00)
-
-/* base address of SRAM area for buffer descriptors */
-#define FEC_BD_BASE (MMAP_SRAM + 0x5b20)
-
-/*---------------------------------------------------------------------
- * common shortcuts used by driver C code
- *---------------------------------------------------------------------
- */
-
-/* Disable SmartDMA task */
-#define DMA_TASK_DISABLE(tasknum) \
-{ \
- volatile ushort *tcr = (ushort *)(MMAP_DMA + 0x0000001c + 2 * tasknum); \
- *tcr = (*tcr) & (~0x8000); \
-}
-
-/* Enable SmartDMA task */
-#define DMA_TASK_ENABLE(tasknum) \
-{ \
- volatile ushort *tcr = (ushort *) (MMAP_DMA + 0x0000001c + 2 * tasknum);\
- *tcr = (*tcr) | 0x8000; \
-}
-
-/* Clear interrupt pending bits */
-#define DMA_CLEAR_IEVENT(tasknum) \
-{ \
- struct mpc8220_dma *dma = (struct mpc8220_dma *)MMAP_DMA; \
- dma->IntPend = (1 << tasknum); \
-}
-
-#endif /* __MPC8220_DMA_H */
diff --git a/cpu/mpc8220/dramSetup.c b/cpu/mpc8220/dramSetup.c
deleted file mode 100644
index 08e3172f2b..0000000000
--- a/cpu/mpc8220/dramSetup.c
+++ /dev/null
@@ -1,752 +0,0 @@
-/*
- * (C) Copyright 2004, Freescale, Inc
- * TsiChung Liew, Tsi-Chung.Liew@freescale.com
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
-DESCRIPTION
-Read Dram spd and base on its information to calculate the memory size,
-characteristics to initialize the dram on MPC8220
-*/
-
-#include <common.h>
-#include <mpc8220.h>
-#include "i2cCore.h"
-#include "dramSetup.h"
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define SPD_SIZE CFG_SDRAM_SPD_SIZE
-#define DRAM_SPD (CFG_SDRAM_SPD_I2C_ADDR)<<1 /* on Board SPD eeprom */
-#define TOTAL_BANK CFG_SDRAM_TOTAL_BANKS
-
-int spd_status (volatile i2c8220_t * pi2c, u8 sta_bit, u8 truefalse)
-{
- int i;
-
- for (i = 0; i < I2C_POLL_COUNT; i++) {
- if ((pi2c->sr & sta_bit) == (truefalse ? sta_bit : 0))
- return (OK);
- }
-
- return (ERROR);
-}
-
-int spd_clear (volatile i2c8220_t * pi2c)
-{
- pi2c->adr = 0;
- pi2c->fdr = 0;
- pi2c->cr = 0;
- pi2c->sr = 0;
-
- return (OK);
-}
-
-int spd_stop (volatile i2c8220_t * pi2c)
-{
- pi2c->cr &= ~I2C_CTL_STA; /* Generate stop signal */
- if (spd_status (pi2c, I2C_STA_BB, 0) != OK)
- return ERROR;
-
- return (OK);
-}
-
-int spd_readbyte (volatile i2c8220_t * pi2c, u8 * readb, int *index)
-{
- pi2c->sr &= ~I2C_STA_IF; /* Clear Interrupt Bit */
- *readb = pi2c->dr; /* Read a byte */
-
- /*
- Set I2C_CTRL_TXAK will cause Transfer pending and
- set I2C_CTRL_STA will cause Interrupt pending
- */
- if (*index != 2) {
- if (spd_status (pi2c, I2C_STA_CF, 1) != OK) /* Transfer not complete? */
- return ERROR;
- }
-
- if (*index != 1) {
- if (spd_status (pi2c, I2C_STA_IF, 1) != OK)
- return ERROR;
- }
-
- return (OK);
-}
-
-int readSpdData (u8 * spdData)
-{
- volatile i2c8220_t *pi2cReg;
- volatile pcfg8220_t *pcfg;
- u8 slvAdr = DRAM_SPD;
- u8 Tmp;
- int Length = SPD_SIZE;
- int i = 0;
-
- /* Enable Port Configuration for SDA and SDL signals */
- pcfg = (volatile pcfg8220_t *) (MMAP_PCFG);
- __asm__ ("sync");
- pcfg->pcfg3 &= ~CFG_I2C_PORT3_CONFIG;
- __asm__ ("sync");
-
- /* Points the structure to I2c mbar memory offset */
- pi2cReg = (volatile i2c8220_t *) (MMAP_I2C);
-
-
- /* Clear FDR, ADR, SR and CR reg */
- pi2cReg->adr = 0;
- pi2cReg->fdr = 0;
- pi2cReg->cr = 0;
- pi2cReg->sr = 0;
-
- /* Set for fix XLB Bus Frequency */
- switch (gd->bus_clk) {
- case 60000000:
- pi2cReg->fdr = 0x15;
- break;
- case 70000000:
- pi2cReg->fdr = 0x16;
- break;
- case 80000000:
- pi2cReg->fdr = 0x3a;
- break;
- case 90000000:
- pi2cReg->fdr = 0x17;
- break;
- case 100000000:
- pi2cReg->fdr = 0x3b;
- break;
- case 110000000:
- pi2cReg->fdr = 0x18;
- break;
- case 120000000:
- pi2cReg->fdr = 0x19;
- break;
- case 130000000:
- pi2cReg->fdr = 0x1a;
- break;
- }
-
- pi2cReg->adr = CFG_I2C_SLAVE<<1;
-
- pi2cReg->cr = I2C_CTL_EN; /* Set Enable */
-
- /*
- The I2C bus should be in Idle state. If the bus is busy,
- clear the STA bit in control register
- */
- if (spd_status (pi2cReg, I2C_STA_BB, 0) != OK) {
- if ((pi2cReg->cr & I2C_CTL_STA) == I2C_CTL_STA)
- pi2cReg->cr &= ~I2C_CTL_STA;
-
- /* Check again if it is still busy, return error if found */
- if (spd_status (pi2cReg, I2C_STA_BB, 1) == OK)
- return ERROR;
- }
-
- pi2cReg->cr |= I2C_CTL_TX; /* Enable the I2c for TX, Ack */
- pi2cReg->cr |= I2C_CTL_STA; /* Generate start signal */
-
- if (spd_status (pi2cReg, I2C_STA_BB, 1) != OK)
- return ERROR;
-
-
- /* Write slave address */
- pi2cReg->sr &= ~I2C_STA_IF; /* Clear Interrupt */
- pi2cReg->dr = slvAdr; /* Write a byte */
-
- if (spd_status (pi2cReg, I2C_STA_CF, 1) != OK) { /* Transfer not complete? */
- spd_stop (pi2cReg);
- return ERROR;
- }
-
- if (spd_status (pi2cReg, I2C_STA_IF, 1) != OK) {
- spd_stop (pi2cReg);
- return ERROR;
- }
-
-
- /* Issue the offset to start */
- pi2cReg->sr &= ~I2C_STA_IF; /* Clear Interrupt */
- pi2cReg->dr = 0; /* Write a byte */
-
- if (spd_status (pi2cReg, I2C_STA_CF, 1) != OK) { /* Transfer not complete? */
- spd_stop (pi2cReg);
- return ERROR;
- }
-
- if (spd_status (pi2cReg, I2C_STA_IF, 1) != OK) {
- spd_stop (pi2cReg);
- return ERROR;
- }
-
-
- /* Set repeat start */
- pi2cReg->cr |= I2C_CTL_RSTA; /* Repeat Start */
-
- pi2cReg->sr &= ~I2C_STA_IF; /* Clear Interrupt */
- pi2cReg->dr = slvAdr | 1; /* Write a byte */
-
- if (spd_status (pi2cReg, I2C_STA_CF, 1) != OK) { /* Transfer not complete? */
- spd_stop (pi2cReg);
- return ERROR;
- }
-
- if (spd_status (pi2cReg, I2C_STA_IF, 1) != OK) {
- spd_stop (pi2cReg);
- return ERROR;
- }
-
- if (((pi2cReg->sr & 0x07) == 0x07) || (pi2cReg->sr & 0x01))
- return ERROR;
-
- pi2cReg->cr &= ~I2C_CTL_TX; /* Set receive mode */
-
- if (((pi2cReg->sr & 0x07) == 0x07) || (pi2cReg->sr & 0x01))
- return ERROR;
-
- /* Dummy Read */
- if (spd_readbyte (pi2cReg, &Tmp, &i) != OK) {
- spd_stop (pi2cReg);
- return ERROR;
- }
-
- i = 0;
- while (Length) {
- if (Length == 2)
- pi2cReg->cr |= I2C_CTL_TXAK;
-
- if (Length == 1)
- pi2cReg->cr &= ~I2C_CTL_STA;
-
- if (spd_readbyte (pi2cReg, spdData, &Length) != OK) {
- return spd_stop (pi2cReg);
- }
- i++;
- Length--;
- spdData++;
- }
-
- /* Stop the service */
- spd_stop (pi2cReg);
-
- return OK;
-}
-
-int getBankInfo (int bank, draminfo_t * pBank)
-{
- int status;
- int checksum;
- int count;
- u8 spdData[SPD_SIZE];
-
-
- if (bank > 2 || pBank == 0) {
- /* illegal values */
- return (-42);
- }
-
- status = readSpdData (&spdData[0]);
- if (status < 0)
- return (-1);
-
- /* check the checksum */
- for (count = 0, checksum = 0; count < LOC_CHECKSUM; count++)
- checksum += spdData[count];
-
- checksum = checksum - ((checksum / 256) * 256);
-
- if (checksum != spdData[LOC_CHECKSUM])
- return (-2);
-
- /* Get the memory type */
- if (!
- ((spdData[LOC_TYPE] == TYPE_DDR)
- || (spdData[LOC_TYPE] == TYPE_SDR)))
- /* not one of the types we support */
- return (-3);
-
- pBank->type = spdData[LOC_TYPE];
-
- /* Set logical banks */
- pBank->banks = spdData[LOC_LOGICAL_BANKS];
-
- /* Check that we have enough physical banks to cover the bank we are
- * figuring out. Odd-numbered banks correspond to the second bank
- * on the device.
- */
- if (bank & 1) {
- /* Second bank of a "device" */
- if (spdData[LOC_PHYS_BANKS] < 2)
- /* this bank doesn't exist on the "device" */
- return (-4);
-
- if (spdData[LOC_ROWS] & 0xf0)
- /* Two asymmetric banks */
- pBank->rows = spdData[LOC_ROWS] >> 4;
- else
- pBank->rows = spdData[LOC_ROWS];
-
- if (spdData[LOC_COLS] & 0xf0)
- /* Two asymmetric banks */
- pBank->cols = spdData[LOC_COLS] >> 4;
- else
- pBank->cols = spdData[LOC_COLS];
- } else {
- /* First bank of a "device" */
- pBank->rows = spdData[LOC_ROWS];
- pBank->cols = spdData[LOC_COLS];
- }
-
- pBank->width = spdData[LOC_WIDTH_HIGH] << 8 | spdData[LOC_WIDTH_LOW];
- pBank->bursts = spdData[LOC_BURSTS];
- pBank->CAS = spdData[LOC_CAS];
- pBank->CS = spdData[LOC_CS];
- pBank->WE = spdData[LOC_WE];
- pBank->Trp = spdData[LOC_Trp];
- pBank->Trcd = spdData[LOC_Trcd];
- pBank->buffered = spdData[LOC_Buffered] & 1;
- pBank->refresh = spdData[LOC_REFRESH];
-
- return (0);
-}
-
-
-/* checkMuxSetting -- given a row/column device geometry, return a mask
- * of the valid DRAM controller addr_mux settings for
- * that geometry.
- *
- * Arguments: u8 rows: number of row addresses in this device
- * u8 columns: number of column addresses in this device
- *
- * Returns: a mask of the allowed addr_mux settings for this
- * geometry. Each bit in the mask represents a
- * possible addr_mux settings (for example, the
- * (1<<2) bit in the mask represents the 0b10 setting)/
- *
- */
-u8 checkMuxSetting (u8 rows, u8 columns)
-{
- muxdesc_t *pIdx, *pMux;
- u8 mask;
- int lrows, lcolumns;
- u32 mux[4] = { 0x00080c04, 0x01080d03, 0x02080e02, 0xffffffff };
-
- /* Setup MuxDescriptor in SRAM space */
- /* MUXDESC AddressRuns [] = {
- { 0, 8, 12, 4 }, / setting, columns, rows, extra columns /
- { 1, 8, 13, 3 }, / setting, columns, rows, extra columns /
- { 2, 8, 14, 2 }, / setting, columns, rows, extra columns /
- { 0xff } / list terminator /
- }; */
-
- pIdx = (muxdesc_t *) & mux[0];
-
- /* Check rows x columns against each possible address mux setting */
- for (pMux = pIdx, mask = 0;; pMux++) {
- lrows = rows;
- lcolumns = columns;
-
- if (pMux->MuxValue == 0xff)
- break; /* end of list */
-
- /* For a given mux setting, since we want all the memory in a
- * device to be contiguous, we want the device "use up" the
- * address lines such that there are no extra column or row
- * address lines on the device.
- */
-
- lcolumns -= pMux->Columns;
- if (lcolumns < 0)
- /* Not enough columns to get to the rows */
- continue;
-
- lrows -= pMux->Rows;
- if (lrows > 0)
- /* we have extra rows left -- can't do that! */
- continue;
-
- /* At this point, we either have to have used up all the
- * rows or we have to have no columns left.
- */
-
- if (lcolumns != 0 && lrows != 0)
- /* rows AND columns are left. Bad! */
- continue;
-
- lcolumns -= pMux->MoreColumns;
-
- if (lcolumns <= 0)
- mask |= (1 << pMux->MuxValue);
- }
-
- return (mask);
-}
-
-
-u32 dramSetup (void)
-{
- draminfo_t DramInfo[TOTAL_BANK];
- draminfo_t *pDramInfo;
- u32 size, temp, cfg_value, mode_value, refresh;
- u8 *ptr;
- u8 bursts, Trp, Trcd, type, buffered;
- u8 muxmask, rows, columns;
- int count, banknum;
- u32 *prefresh, *pIdx;
- u32 refrate[8] = { 15625, 3900, 7800, 31300,
- 62500, 125000, 0xffffffff, 0xffffffff
- };
- volatile sysconf8220_t *sysconf;
- volatile memctl8220_t *memctl;
-
- sysconf = (volatile sysconf8220_t *) MMAP_MBAR;
- memctl = (volatile memctl8220_t *) MMAP_MEMCTL;
-
- /* Set everything in the descriptions to zero */
- ptr = (u8 *) & DramInfo[0];
- for (count = 0; count < sizeof (DramInfo); count++)
- *ptr++ = 0;
-
- for (banknum = 0; banknum < TOTAL_BANK; banknum++)
- sysconf->cscfg[banknum];
-
- /* Descriptions of row/column address muxing for various
- * addr_mux settings.
- */
-
- pIdx = prefresh = (u32 *) & refrate[0];
-
- /* Get all the info for all three logical banks */
- bursts = 0xff;
- Trp = 0;
- Trcd = 0;
- type = 0;
- buffered = 0xff;
- refresh = 0xffffffff;
- muxmask = 0xff;
-
- /* Two bank, CS0 and CS1 */
- for (banknum = 0, pDramInfo = &DramInfo[0];
- banknum < TOTAL_BANK; banknum++, pDramInfo++) {
- pDramInfo->ordinal = banknum; /* initial sorting */
- if (getBankInfo (banknum, pDramInfo) < 0)
- continue;
-
- /* get cumulative parameters of all three banks */
- if (type && pDramInfo->type != type)
- return 0;
-
- type = pDramInfo->type;
- rows = pDramInfo->rows;
- columns = pDramInfo->cols;
-
- /* This chip only supports 13 DRAM memory lines, but some devices
- * have 14 rows. To deal with this, ignore the 14th address line
- * by limiting the number of rows (and columns) to 13. This will
- * mean that for 14-row devices we will only be able to use
- * half of the memory, but it's better than nothing.
- */
- if (rows > 13)
- rows = 13;
- if (columns > 13)
- columns = 13;
-
- pDramInfo->size =
- ((1 << (rows + columns)) * pDramInfo->width);
- pDramInfo->size *= pDramInfo->banks;
- pDramInfo->size >>= 3;
-
- /* figure out which addr_mux configurations will support this device */
- muxmask &= checkMuxSetting (rows, columns);
- if (muxmask == 0)
- return 0;
-
- buffered = pDramInfo->buffered;
- bursts &= pDramInfo->bursts; /* union of all bursts */
- if (pDramInfo->Trp > Trp) /* worst case (longest) Trp */
- Trp = pDramInfo->Trp;
-
- if (pDramInfo->Trcd > Trcd) /* worst case (longest) Trcd */
- Trcd = pDramInfo->Trcd;
-
- prefresh = pIdx;
- /* worst case (shortest) Refresh period */
- if (refresh > prefresh[pDramInfo->refresh & 7])
- refresh = prefresh[pDramInfo->refresh & 7];
-
- } /* for loop */
-
-
- /* We only allow a burst length of 8! */
- if (!(bursts & 8))
- bursts = 8;
-
- /* Sort the devices. In order to get each chip select region
- * aligned properly, put the biggest device at the lowest address.
- * A simple bubble sort will do the trick.
- */
- for (banknum = 0, pDramInfo = &DramInfo[0];
- banknum < TOTAL_BANK; banknum++, pDramInfo++) {
- int i;
-
- for (i = 0; i < TOTAL_BANK; i++) {
- if (pDramInfo->size < DramInfo[i].size &&
- pDramInfo->ordinal < DramInfo[i].ordinal) {
- /* If the current bank is smaller, but if the ordinal is also
- * smaller, swap the ordinals
- */
- u8 temp8;
-
- temp8 = DramInfo[i].ordinal;
- DramInfo[i].ordinal = pDramInfo->ordinal;
- pDramInfo->ordinal = temp8;
- }
- }
- }
-
-
- /* Now figure out the base address for each bank. While
- * we're at it, figure out how much memory there is.
- *
- */
- size = 0;
- for (banknum = 0; banknum < TOTAL_BANK; banknum++) {
- int i;
-
- for (i = 0; i < TOTAL_BANK; i++) {
- if (DramInfo[i].ordinal == banknum
- && DramInfo[i].size != 0) {
- DramInfo[i].base = size;
- size += DramInfo[i].size;
- }
- }
- }
-
- /* Set up the Drive Strength register */
- sysconf->sdramds = CFG_SDRAM_DRIVE_STRENGTH;
-
- /* ********************** Cfg 1 ************************* */
-
- /* Set the single read to read/write/precharge delay */
- cfg_value = CFG1_SRD2RWP ((type == TYPE_DDR) ? 7 : 0xb);
-
- /* Set the single write to read/write/precharge delay.
- * This may or may not be correct. The controller spec
- * says "tWR", but "tWR" does not appear in the SPD. It
- * always seems to be 15nsec for the class of device we're
- * using, which turns out to be 2 clock cycles at 133MHz,
- * so that's what we're going to use.
- *
- * HOWEVER, because of a bug in the controller, for DDR
- * we need to set this to be the same as the value
- * calculated for bwt2rwp.
- */
- cfg_value |= CFG1_SWT2RWP ((type == TYPE_DDR) ? 7 : 2);
-
- /* Set the Read CAS latency. We're going to use a CL of
- * 2.5 for DDR and 2 SDR.
- */
- cfg_value |= CFG1_RLATENCY ((type == TYPE_DDR) ? 7 : 2);
-
-
- /* Set the Active to Read/Write delay. This depends
- * on Trcd which is reported as nanoseconds times 4.
- * We want to calculate Trcd (in nanoseconds) times XLB clock (in Hz)
- * which gives us a dimensionless quantity. Play games with
- * the divisions so we don't run out of dynamic ranges.
- */
- /* account for megaherz and the times 4 */
- temp = (Trcd * (gd->bus_clk / 1000000)) / 4;
-
- /* account for nanoseconds and round up, with a minimum value of 2 */
- temp = ((temp + 999) / 1000) - 1;
- if (temp < 2)
- temp = 2;
-
- cfg_value |= CFG1_ACT2WR (temp);
-
- /* Set the precharge to active delay. This depends
- * on Trp which is reported as nanoseconds times 4.
- * We want to calculate Trp (in nanoseconds) times XLB clock (in Hz)
- * which gives us a dimensionless quantity. Play games with
- * the divisions so we don't run out of dynamic ranges.
- */
- /* account for megaherz and the times 4 */
- temp = (Trp * (gd->bus_clk / 1000000)) / 4;
-
- /* account for nanoseconds and round up, then subtract 1, with a
- * minumum value of 1 and a maximum value of 7.
- */
- temp = (((temp + 999) / 1000) - 1) & 7;
- if (temp < 1)
- temp = 1;
-
- cfg_value |= CFG1_PRE2ACT (temp);
-
- /* Set refresh to active delay. This depends
- * on Trfc which is not reported in the SPD.
- * We'll use a nominal value of 75nsec which is
- * what the controller spec uses.
- */
- temp = (75 * (gd->bus_clk / 1000000));
- /* account for nanoseconds and round up, then subtract 1 */
- cfg_value |= CFG1_REF2ACT (((temp + 999) / 1000) - 1);
-
- /* Set the write latency, using the values given in the controller spec */
- cfg_value |= CFG1_WLATENCY ((type == TYPE_DDR) ? 3 : 0);
- memctl->cfg1 = cfg_value; /* cfg 1 */
- asm volatile ("sync");
-
-
- /* ********************** Cfg 2 ************************* */
-
- /* Set the burst read to read/precharge delay */
- cfg_value = CFG2_BRD2RP ((type == TYPE_DDR) ? 5 : 8);
-
- /* Set the burst write to read/precharge delay. Semi-magic numbers
- * based on the controller spec recommendations, assuming tWR is
- * two clock cycles.
- */
- cfg_value |= CFG2_BWT2RWP ((type == TYPE_DDR) ? 7 : 10);
-
- /* Set the Burst read to write delay. Semi-magic numbers
- * based on the DRAM controller documentation.
- */
- cfg_value |= CFG2_BRD2WT ((type == TYPE_DDR) ? 7 : 0xb);
-
- /* Set the burst length -- must be 8!! Well, 7, actually, becuase
- * it's burst lenght minus 1.
- */
- cfg_value |= CFG2_BURSTLEN (7);
- memctl->cfg2 = cfg_value; /* cfg 2 */
- asm volatile ("sync");
-
-
- /* ********************** mode ************************* */
-
- /* Set enable bit, CKE high/low bits, and the DDR/SDR mode bit,
- * disable automatic refresh.
- */
- cfg_value = CTL_MODE_ENABLE | CTL_CKE_HIGH |
- ((type == TYPE_DDR) ? CTL_DDR_MODE : 0);
-
- /* Set the address mux based on whichever setting(s) is/are common
- * to all the devices we have. If there is more than one, choose
- * one arbitrarily.
- */
- if (muxmask & 0x4)
- cfg_value |= CTL_ADDRMUX (2);
- else if (muxmask & 0x2)
- cfg_value |= CTL_ADDRMUX (1);
- else
- cfg_value |= CTL_ADDRMUX (0);
-
- /* Set the refresh interval. */
- temp = ((refresh * (gd->bus_clk / 1000000)) / (1000 * 64)) - 1;
- cfg_value |= CTL_REFRESH_INTERVAL (temp);
-
- /* Set buffered/non-buffered memory */
- if (buffered)
- cfg_value |= CTL_BUFFERED;
-
- memctl->ctrl = cfg_value; /* ctrl */
- asm volatile ("sync");
-
- if (type == TYPE_DDR) {
- /* issue precharge all */
- temp = cfg_value | CTL_PRECHARGE_CMD;
- memctl->ctrl = temp; /* ctrl */
- asm volatile ("sync");
- }
-
-
- /* Set up mode value for CAS latency */
-#if (CFG_SDRAM_CAS_LATENCY==5) /* CL=2.5 */
- mode_value = (MODE_MODE | MODE_BURSTLEN (MODE_BURSTLEN_8) |
- MODE_BT_SEQUENTIAL | MODE_CL (MODE_CL_2p5) | MODE_CMD);
-#else
- mode_value = (MODE_MODE | MODE_BURSTLEN (MODE_BURSTLEN_8) |
- MODE_BT_SEQUENTIAL | MODE_CL (MODE_CL_2) | MODE_CMD);
-#endif
- asm volatile ("sync");
-
- /* Write Extended Mode - enable DLL */
- if (type == TYPE_DDR) {
- temp = MODE_EXTENDED | MODE_X_DLL_ENABLE |
- MODE_X_DS_NORMAL | MODE_CMD;
- memctl->mode = (temp >> 16); /* mode */
- asm volatile ("sync");
-
- /* Write Mode - reset DLL, set CAS latency */
- temp = mode_value | MODE_OPMODE (MODE_OPMODE_RESETDLL);
- memctl->mode = (temp >> 16); /* mode */
- asm volatile ("sync");
- }
-
- /* Program the chip selects. */
- for (banknum = 0; banknum < TOTAL_BANK; banknum++) {
- if (DramInfo[banknum].size != 0) {
- u32 mask;
- int i;
-
- for (i = 0, mask = 1; i < 32; mask <<= 1, i++) {
- if (DramInfo[banknum].size & mask)
- break;
- }
- temp = (DramInfo[banknum].base & 0xfff00000) | (i -
- 1);
-
- sysconf->cscfg[banknum] = temp;
- asm volatile ("sync");
- }
- }
-
- /* Wait for DLL lock */
- udelay (200);
-
- temp = cfg_value | CTL_PRECHARGE_CMD; /* issue precharge all */
- memctl->ctrl = temp; /* ctrl */
- asm volatile ("sync");
-
- temp = cfg_value | CTL_REFRESH_CMD; /* issue precharge all */
- memctl->ctrl = temp; /* ctrl */
- asm volatile ("sync");
-
- memctl->ctrl = temp; /* ctrl */
- asm volatile ("sync");
-
- /* Write Mode - DLL normal */
- temp = mode_value | MODE_OPMODE (MODE_OPMODE_NORMAL);
- memctl->mode = (temp >> 16); /* mode */
- asm volatile ("sync");
-
- /* Enable refresh, enable DQS's (if DDR), and lock the control register */
- cfg_value &= ~CTL_MODE_ENABLE; /* lock register */
- cfg_value |= CTL_REFRESH_ENABLE; /* enable refresh */
-
- if (type == TYPE_DDR)
- cfg_value |= CTL_DQSOEN (0xf); /* enable DQS's for DDR */
-
- memctl->ctrl = cfg_value; /* ctrl */
- asm volatile ("sync");
-
- return size;
-}
diff --git a/cpu/mpc8220/dramSetup.h b/cpu/mpc8220/dramSetup.h
deleted file mode 100644
index 3b64e088cd..0000000000
--- a/cpu/mpc8220/dramSetup.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * dramSetup.h
- *
- * Prototypes, etc. for the Motorola MPC8220
- * embedded cpu chips
- *
- * 2004 (c) Freescale, Inc.
- * Author: TsiChung Liew <Tsi-Chung.Liew@freescale.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#ifndef __INCdramsetuph
-#define __INCdramsetuph
-#ifndef __ASSEMBLY__
-/* Where various things are in the SPD */
-#define LOC_TYPE 2
-#define LOC_CHECKSUM 63
-#define LOC_PHYS_BANKS 5
-#define LOC_LOGICAL_BANKS 17
-#define LOC_ROWS 3
-#define LOC_COLS 4
-#define LOC_WIDTH_HIGH 7
-#define LOC_WIDTH_LOW 6
-#define LOC_REFRESH 12
-#define LOC_BURSTS 16
-#define LOC_CAS 18
-#define LOC_CS 19
-#define LOC_WE 20
-#define LOC_Tcyc 9
-#define LOC_Tac 10
-#define LOC_Trp 27
-#define LOC_Trrd 28
-#define LOC_Trcd 29
-#define LOC_Tras 30
-#define LOC_Buffered 21
-/* Types of memory the SPD can tell us about.
- * We can actually only use SDRAM and DDR.
- */
-#define TYPE_DRAM 1 /* plain old dram */
-#define TYPE_EDO 2 /* EDO dram */
-#define TYPE_Nibble 3 /* serial nibble memory */
-#define TYPE_SDR 4 /* SDRAM */
-#define TYPE_ROM 5 /* */
-#define TYPE_SGRRAM 6 /* graphics memory */
-#define TYPE_DDR 7 /* DDR sdram */
-#define SDRAMDS_MASK 0x3 /* each field is 2 bits wide */
-#define SDRAMDS_SBE_SHIFT 8 /* Clock enable drive strength */
-#define SDRAMDS_SBC_SHIFT 6 /* Clocks drive strength */
-#define SDRAMDS_SBA_SHIFT 4 /* Address drive strength */
-#define SDRAMDS_SBS_SHIFT 2 /* SDR DQS drive strength */
-#define SDRAMDS_SBD_SHIFT 0 /* Data and DQS drive strength */
-#define DRIVE_STRENGTH_HIGH 0
-#define DRIVE_STRENGTH_MED 1
-#define DRIVE_STRENGTH_LOW 2
-#define DRIVE_STRENGTH_OFF 3
-
-#define OK 0
-#define ERROR -1
-/* Structure to hold information about address muxing. */
- typedef struct tagMuxDescriptor {
- u8 MuxValue;
- u8 Columns;
- u8 Rows;
- u8 MoreColumns;
-} muxdesc_t;
-
-/* Structure to define one physical bank of
- * memory. Note that dram size in bytes is
- * (2^^(rows+columns)) * width * banks / 8
-*/
-typedef struct tagDramInfo {
- u32 size; /* size in bytes */
- u32 base; /* base address */
- u8 ordinal; /* where in the memory map will we put this */
- u8 type;
- u8 rows;
- u8 cols;
- u16 width; /* width of each chip in bits */
- u8 banks; /* number of chips, aka logical banks */
- u8 bursts; /* bit-encoded allowable burst length */
- u8 CAS; /* bit-encoded CAS latency values */
- u8 CS; /* bit-encoded CS latency values */
- u8 WE; /* bit-encoded WE latency values */
- u8 Trp; /* bit-encoded row precharge time */
- u8 Trcd; /* bit-encoded RAS to CAS delay */
- u8 buffered; /* buffered or not */
- u8 refresh; /* encoded refresh rate */
-} draminfo_t;
-
-#endif /* __ASSEMBLY__ */
-
-#endif /* __INCdramsetuph */
diff --git a/cpu/mpc8220/fec.c b/cpu/mpc8220/fec.c
deleted file mode 100644
index 2ba87cd003..0000000000
--- a/cpu/mpc8220/fec.c
+++ /dev/null
@@ -1,988 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * This file is based on mpc4200fec.c,
- * (C) Copyright Motorola, Inc., 2000
- */
-
-#include <common.h>
-#include <mpc8220.h>
-#include <malloc.h>
-#include <net.h>
-#include <miiphy.h>
-#include "dma.h"
-#include "fec.h"
-
-#undef DEBUG
-#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
- defined(CONFIG_MPC8220_FEC)
-
-#if !(defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII))
-#error "CONFIG_MII has to be defined!"
-#endif
-
-#ifdef DEBUG
-static void tfifo_print (char *devname, mpc8220_fec_priv * fec);
-static void rfifo_print (char *devname, mpc8220_fec_priv * fec);
-#endif /* DEBUG */
-
-#ifdef DEBUG
-static u32 local_crc32 (char *string, unsigned int crc_value, int len);
-#endif
-
-typedef struct {
- u8 data[1500]; /* actual data */
- int length; /* actual length */
- int used; /* buffer in use or not */
- u8 head[16]; /* MAC header(6 + 6 + 2) + 2(aligned) */
-} NBUF;
-
-int fec8220_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal);
-int fec8220_miiphy_write (char *devname, u8 phyAddr, u8 regAddr, u16 data);
-
-/********************************************************************/
-#ifdef DEBUG
-static void mpc8220_fec_phydump (char *devname)
-{
- u16 phyStatus, i;
- u8 phyAddr = CONFIG_PHY_ADDR;
- u8 reg_mask[] = {
-#if CONFIG_PHY_TYPE == 0x79c874 /* AMD Am79C874 */
- /* regs to print: 0...7, 16...19, 21, 23, 24 */
- 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
-#else
- /* regs to print: 0...8, 16...20 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-#endif
- };
-
- for (i = 0; i < 32; i++) {
- if (reg_mask[i]) {
- miiphy_read (devname, phyAddr, i, &phyStatus);
- printf ("Mii reg %d: 0x%04x\n", i, phyStatus);
- }
- }
-}
-#endif
-
-/********************************************************************/
-static int mpc8220_fec_rbd_init (mpc8220_fec_priv * fec)
-{
- int ix;
- char *data;
- static int once = 0;
-
- for (ix = 0; ix < FEC_RBD_NUM; ix++) {
- if (!once) {
- data = (char *) malloc (FEC_MAX_PKT_SIZE);
- if (data == NULL) {
- printf ("RBD INIT FAILED\n");
- return -1;
- }
- fec->rbdBase[ix].dataPointer = (u32) data;
- }
- fec->rbdBase[ix].status = FEC_RBD_EMPTY;
- fec->rbdBase[ix].dataLength = 0;
- }
- once++;
-
- /*
- * have the last RBD to close the ring
- */
- fec->rbdBase[ix - 1].status |= FEC_RBD_WRAP;
- fec->rbdIndex = 0;
-
- return 0;
-}
-
-/********************************************************************/
-static void mpc8220_fec_tbd_init (mpc8220_fec_priv * fec)
-{
- int ix;
-
- for (ix = 0; ix < FEC_TBD_NUM; ix++) {
- fec->tbdBase[ix].status = 0;
- }
-
- /*
- * Have the last TBD to close the ring
- */
- fec->tbdBase[ix - 1].status |= FEC_TBD_WRAP;
-
- /*
- * Initialize some indices
- */
- fec->tbdIndex = 0;
- fec->usedTbdIndex = 0;
- fec->cleanTbdNum = FEC_TBD_NUM;
-}
-
-/********************************************************************/
-static void mpc8220_fec_rbd_clean (mpc8220_fec_priv * fec, FEC_RBD * pRbd)
-{
- /*
- * Reset buffer descriptor as empty
- */
- if ((fec->rbdIndex) == (FEC_RBD_NUM - 1))
- pRbd->status = (FEC_RBD_WRAP | FEC_RBD_EMPTY);
- else
- pRbd->status = FEC_RBD_EMPTY;
-
- pRbd->dataLength = 0;
-
- /*
- * Now, we have an empty RxBD, restart the SmartDMA receive task
- */
- DMA_TASK_ENABLE (FEC_RECV_TASK_NO);
-
- /*
- * Increment BD count
- */
- fec->rbdIndex = (fec->rbdIndex + 1) % FEC_RBD_NUM;
-}
-
-/********************************************************************/
-static void mpc8220_fec_tbd_scrub (mpc8220_fec_priv * fec)
-{
- FEC_TBD *pUsedTbd;
-
-#ifdef DEBUG
- printf ("tbd_scrub: fec->cleanTbdNum = %d, fec->usedTbdIndex = %d\n",
- fec->cleanTbdNum, fec->usedTbdIndex);
-#endif
-
- /*
- * process all the consumed TBDs
- */
- while (fec->cleanTbdNum < FEC_TBD_NUM) {
- pUsedTbd = &fec->tbdBase[fec->usedTbdIndex];
- if (pUsedTbd->status & FEC_TBD_READY) {
-#ifdef DEBUG
- printf ("Cannot clean TBD %d, in use\n",
- fec->cleanTbdNum);
-#endif
- return;
- }
-
- /*
- * clean this buffer descriptor
- */
- if (fec->usedTbdIndex == (FEC_TBD_NUM - 1))
- pUsedTbd->status = FEC_TBD_WRAP;
- else
- pUsedTbd->status = 0;
-
- /*
- * update some indeces for a correct handling of the TBD ring
- */
- fec->cleanTbdNum++;
- fec->usedTbdIndex = (fec->usedTbdIndex + 1) % FEC_TBD_NUM;
- }
-}
-
-/********************************************************************/
-static void mpc8220_fec_set_hwaddr (mpc8220_fec_priv * fec, char *mac)
-{
- u8 currByte; /* byte for which to compute the CRC */
- int byte; /* loop - counter */
- int bit; /* loop - counter */
- u32 crc = 0xffffffff; /* initial value */
-
- /*
- * The algorithm used is the following:
- * we loop on each of the six bytes of the provided address,
- * and we compute the CRC by left-shifting the previous
- * value by one position, so that each bit in the current
- * byte of the address may contribute the calculation. If
- * the latter and the MSB in the CRC are different, then
- * the CRC value so computed is also ex-ored with the
- * "polynomium generator". The current byte of the address
- * is also shifted right by one bit at each iteration.
- * This is because the CRC generatore in hardware is implemented
- * as a shift-register with as many ex-ores as the radixes
- * in the polynomium. This suggests that we represent the
- * polynomiumm itself as a 32-bit constant.
- */
- for (byte = 0; byte < 6; byte++) {
- currByte = mac[byte];
- for (bit = 0; bit < 8; bit++) {
- if ((currByte & 0x01) ^ (crc & 0x01)) {
- crc >>= 1;
- crc = crc ^ 0xedb88320;
- } else {
- crc >>= 1;
- }
- currByte >>= 1;
- }
- }
-
- crc = crc >> 26;
-
- /*
- * Set individual hash table register
- */
- if (crc >= 32) {
- fec->eth->iaddr1 = (1 << (crc - 32));
- fec->eth->iaddr2 = 0;
- } else {
- fec->eth->iaddr1 = 0;
- fec->eth->iaddr2 = (1 << crc);
- }
-
- /*
- * Set physical address
- */
- fec->eth->paddr1 =
- (mac[0] << 24) + (mac[1] << 16) + (mac[2] << 8) + mac[3];
- fec->eth->paddr2 = (mac[4] << 24) + (mac[5] << 16) + 0x8808;
-}
-
-/********************************************************************/
-static int mpc8220_fec_init (struct eth_device *dev, bd_t * bis)
-{
- mpc8220_fec_priv *fec = (mpc8220_fec_priv *) dev->priv;
- struct mpc8220_dma *dma = (struct mpc8220_dma *) MMAP_DMA;
- const u8 phyAddr = CONFIG_PHY_ADDR; /* Only one PHY */
-
-#ifdef DEBUG
- printf ("mpc8220_fec_init... Begin\n");
-#endif
-
- /*
- * Initialize RxBD/TxBD rings
- */
- mpc8220_fec_rbd_init (fec);
- mpc8220_fec_tbd_init (fec);
-
- /*
- * Set up Pin Muxing for FEC 1
- */
- *(vu_long *) MMAP_PCFG = 0;
- *(vu_long *) (MMAP_PCFG + 4) = 0;
- /*
- * Clear FEC-Lite interrupt event register(IEVENT)
- */
- fec->eth->ievent = 0xffffffff;
-
- /*
- * Set interrupt mask register
- */
- fec->eth->imask = 0x00000000;
-
- /*
- * Set FEC-Lite receive control register(R_CNTRL):
- */
- if (fec->xcv_type == SEVENWIRE) {
- /*
- * Frame length=1518; 7-wire mode
- */
- fec->eth->r_cntrl = 0x05ee0020; /*0x05ee0000;FIXME */
- } else {
- /*
- * Frame length=1518; MII mode;
- */
- fec->eth->r_cntrl = 0x05ee0024; /*0x05ee0004;FIXME */
- }
-
- fec->eth->x_cntrl = 0x00000000; /* half-duplex, heartbeat disabled */
- if (fec->xcv_type != SEVENWIRE) {
- /*
- * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
- * and do not drop the Preamble.
- */
- /* tbd - rtm */
- /*fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); */
- /* No MII for 7-wire mode */
- fec->eth->mii_speed = 0x00000030;
- }
-
- /*
- * Set Opcode/Pause Duration Register
- */
- fec->eth->op_pause = 0x00010020; /*FIXME0xffff0020; */
-
- /*
- * Set Rx FIFO alarm and granularity value
- */
- fec->eth->rfifo_cntrl = 0x0c000000;
- fec->eth->rfifo_alarm = 0x0000030c;
-#ifdef DEBUG
- if (fec->eth->rfifo_status & 0x00700000) {
- printf ("mpc8220_fec_init() RFIFO error\n");
- }
-#endif
-
- /*
- * Set Tx FIFO granularity value
- */
- /*fec->eth->tfifo_cntrl = 0x0c000000; */ /*tbd - rtm */
- fec->eth->tfifo_cntrl = 0x0e000000;
-#ifdef DEBUG
- printf ("tfifo_status: 0x%08x\n", fec->eth->tfifo_status);
- printf ("tfifo_alarm: 0x%08x\n", fec->eth->tfifo_alarm);
-#endif
-
- /*
- * Set transmit fifo watermark register(X_WMRK), default = 64
- */
- fec->eth->tfifo_alarm = 0x00000080;
- fec->eth->x_wmrk = 0x2;
-
- /*
- * Set individual address filter for unicast address
- * and set physical address registers.
- */
- mpc8220_fec_set_hwaddr (fec, (char *)(dev->enetaddr));
-
- /*
- * Set multicast address filter
- */
- fec->eth->gaddr1 = 0x00000000;
- fec->eth->gaddr2 = 0x00000000;
-
- /*
- * Turn ON cheater FSM: ????
- */
- fec->eth->xmit_fsm = 0x03000000;
-
-/*#if defined(CONFIG_MPC5200)*/
- /*
- * Turn off COMM bus prefetch in the MGT5200 BestComm. It doesn't
- * work w/ the current receive task.
- */
- dma->PtdCntrl |= 0x00000001;
-
- /*
- * Set priority of different initiators
- */
- dma->IPR0 = 7; /* always */
- dma->IPR3 = 6; /* Eth RX */
- dma->IPR4 = 5; /* Eth Tx */
-
- /*
- * Clear SmartDMA task interrupt pending bits
- */
- DMA_CLEAR_IEVENT (FEC_RECV_TASK_NO);
-
- /*
- * Initialize SmartDMA parameters stored in SRAM
- */
- *(int *) FEC_TBD_BASE = (int) fec->tbdBase;
- *(int *) FEC_RBD_BASE = (int) fec->rbdBase;
- *(int *) FEC_TBD_NEXT = (int) fec->tbdBase;
- *(int *) FEC_RBD_NEXT = (int) fec->rbdBase;
-
- if (fec->xcv_type != SEVENWIRE) {
- /*
- * Initialize PHY(LXT971A):
- *
- * Generally, on power up, the LXT971A reads its configuration
- * pins to check for forced operation, If not cofigured for
- * forced operation, it uses auto-negotiation/parallel detection
- * to automatically determine line operating conditions.
- * If the PHY device on the other side of the link supports
- * auto-negotiation, the LXT971A auto-negotiates with it
- * using Fast Link Pulse(FLP) Bursts. If the PHY partner does not
- * support auto-negotiation, the LXT971A automatically detects
- * the presence of either link pulses(10Mbps PHY) or Idle
- * symbols(100Mbps) and sets its operating conditions accordingly.
- *
- * When auto-negotiation is controlled by software, the following
- * steps are recommended.
- *
- * Note:
- * The physical address is dependent on hardware configuration.
- *
- */
- int timeout = 1;
- u16 phyStatus;
-
- /*
- * Reset PHY, then delay 300ns
- */
- miiphy_write (dev->name, phyAddr, 0x0, 0x8000);
- udelay (1000);
-
- if (fec->xcv_type == MII10) {
- /*
- * Force 10Base-T, FDX operation
- */
-#ifdef DEBUG
- printf ("Forcing 10 Mbps ethernet link... ");
-#endif
- miiphy_read (dev->name, phyAddr, 0x1, &phyStatus);
- /*
- miiphy_write(fec, phyAddr, 0x0, 0x0100);
- */
- miiphy_write (dev->name, phyAddr, 0x0, 0x0180);
-
- timeout = 20;
- do { /* wait for link status to go down */
- udelay (10000);
- if ((timeout--) == 0) {
-#ifdef DEBUG
- printf ("hmmm, should not have waited...");
-#endif
- break;
- }
- miiphy_read (dev->name, phyAddr, 0x1, &phyStatus);
-#ifdef DEBUG
- printf ("=");
-#endif
- } while ((phyStatus & 0x0004)); /* !link up */
-
- timeout = 1000;
- do { /* wait for link status to come back up */
- udelay (10000);
- if ((timeout--) == 0) {
- printf ("failed. Link is down.\n");
- break;
- }
- miiphy_read (dev->name, phyAddr, 0x1, &phyStatus);
-#ifdef DEBUG
- printf ("+");
-#endif
- } while (!(phyStatus & 0x0004)); /* !link up */
-
-#ifdef DEBUG
- printf ("done.\n");
-#endif
- } else { /* MII100 */
- /*
- * Set the auto-negotiation advertisement register bits
- */
- miiphy_write (dev->name, phyAddr, 0x4, 0x01e1);
-
- /*
- * Set MDIO bit 0.12 = 1(&& bit 0.9=1?) to enable auto-negotiation
- */
- miiphy_write (dev->name, phyAddr, 0x0, 0x1200);
-
- /*
- * Wait for AN completion
- */
- timeout = 5000;
- do {
- udelay (1000);
-
- if ((timeout--) == 0) {
-#ifdef DEBUG
- printf ("PHY auto neg 0 failed...\n");
-#endif
- return -1;
- }
-
- if (miiphy_read (dev->name, phyAddr, 0x1, &phyStatus) !=
- 0) {
-#ifdef DEBUG
- printf ("PHY auto neg 1 failed 0x%04x...\n", phyStatus);
-#endif
- return -1;
- }
- } while (!(phyStatus & 0x0004));
-
-#ifdef DEBUG
- printf ("PHY auto neg complete! \n");
-#endif
- }
-
- }
-
- /*
- * Enable FEC-Lite controller
- */
- fec->eth->ecntrl |= 0x00000006;
-
-#ifdef DEBUG
- if (fec->xcv_type != SEVENWIRE)
- mpc8220_fec_phydump (dev->name);
-#endif
-
- /*
- * Enable SmartDMA receive task
- */
- DMA_TASK_ENABLE (FEC_RECV_TASK_NO);
-
-#ifdef DEBUG
- printf ("mpc8220_fec_init... Done \n");
-#endif
-
- return 1;
-}
-
-/********************************************************************/
-static void mpc8220_fec_halt (struct eth_device *dev)
-{
- mpc8220_fec_priv *fec = (mpc8220_fec_priv *) dev->priv;
- int counter = 0xffff;
-
-#ifdef DEBUG
- if (fec->xcv_type != SEVENWIRE)
- mpc8220_fec_phydump (dev->name);
-#endif
-
- /*
- * mask FEC chip interrupts
- */
- fec->eth->imask = 0;
-
- /*
- * issue graceful stop command to the FEC transmitter if necessary
- */
- fec->eth->x_cntrl |= 0x00000001;
-
- /*
- * wait for graceful stop to register
- */
- while ((counter--) && (!(fec->eth->ievent & 0x10000000)));
-
- /*
- * Disable SmartDMA tasks
- */
- DMA_TASK_DISABLE (FEC_XMIT_TASK_NO);
- DMA_TASK_DISABLE (FEC_RECV_TASK_NO);
-
- /*
- * Disable the Ethernet Controller
- */
- fec->eth->ecntrl &= 0xfffffffd;
-
- /*
- * Clear FIFO status registers
- */
- fec->eth->rfifo_status &= 0x00700000;
- fec->eth->tfifo_status &= 0x00700000;
-
- fec->eth->reset_cntrl = 0x01000000;
-
- /*
- * Issue a reset command to the FEC chip
- */
- fec->eth->ecntrl |= 0x1;
-
- /*
- * wait at least 16 clock cycles
- */
- udelay (10);
-
-#ifdef DEBUG
- printf ("Ethernet task stopped\n");
-#endif
-}
-
-#ifdef DEBUG
-/********************************************************************/
-
-static void tfifo_print (char *devname, mpc8220_fec_priv * fec)
-{
- u16 phyAddr = CONFIG_PHY_ADDR;
- u16 phyStatus;
-
- if ((fec->eth->tfifo_lrf_ptr != fec->eth->tfifo_lwf_ptr)
- || (fec->eth->tfifo_rdptr != fec->eth->tfifo_wrptr)) {
-
- miiphy_read (devname, phyAddr, 0x1, &phyStatus);
- printf ("\nphyStatus: 0x%04x\n", phyStatus);
- printf ("ecntrl: 0x%08x\n", fec->eth->ecntrl);
- printf ("ievent: 0x%08x\n", fec->eth->ievent);
- printf ("x_status: 0x%08x\n", fec->eth->x_status);
- printf ("tfifo: status 0x%08x\n", fec->eth->tfifo_status);
-
- printf (" control 0x%08x\n", fec->eth->tfifo_cntrl);
- printf (" lrfp 0x%08x\n", fec->eth->tfifo_lrf_ptr);
- printf (" lwfp 0x%08x\n", fec->eth->tfifo_lwf_ptr);
- printf (" alarm 0x%08x\n", fec->eth->tfifo_alarm);
- printf (" readptr 0x%08x\n", fec->eth->tfifo_rdptr);
- printf (" writptr 0x%08x\n", fec->eth->tfifo_wrptr);
- }
-}
-
-static void rfifo_print (char *devname, mpc8220_fec_priv * fec)
-{
- u16 phyAddr = CONFIG_PHY_ADDR;
- u16 phyStatus;
-
- if ((fec->eth->rfifo_lrf_ptr != fec->eth->rfifo_lwf_ptr)
- || (fec->eth->rfifo_rdptr != fec->eth->rfifo_wrptr)) {
-
- miiphy_read (devname, phyAddr, 0x1, &phyStatus);
- printf ("\nphyStatus: 0x%04x\n", phyStatus);
- printf ("ecntrl: 0x%08x\n", fec->eth->ecntrl);
- printf ("ievent: 0x%08x\n", fec->eth->ievent);
- printf ("x_status: 0x%08x\n", fec->eth->x_status);
- printf ("rfifo: status 0x%08x\n", fec->eth->rfifo_status);
-
- printf (" control 0x%08x\n", fec->eth->rfifo_cntrl);
- printf (" lrfp 0x%08x\n", fec->eth->rfifo_lrf_ptr);
- printf (" lwfp 0x%08x\n", fec->eth->rfifo_lwf_ptr);
- printf (" alarm 0x%08x\n", fec->eth->rfifo_alarm);
- printf (" readptr 0x%08x\n", fec->eth->rfifo_rdptr);
- printf (" writptr 0x%08x\n", fec->eth->rfifo_wrptr);
- }
-}
-#endif /* DEBUG */
-
-/********************************************************************/
-
-static int mpc8220_fec_send (struct eth_device *dev, volatile void *eth_data,
- int data_length)
-{
- /*
- * This routine transmits one frame. This routine only accepts
- * 6-byte Ethernet addresses.
- */
- mpc8220_fec_priv *fec = (mpc8220_fec_priv *) dev->priv;
- FEC_TBD *pTbd;
-
-#ifdef DEBUG
- printf ("tbd status: 0x%04x\n", fec->tbdBase[0].status);
- tfifo_print (dev->name, fec);
-#endif
-
- /*
- * Clear Tx BD ring at first
- */
- mpc8220_fec_tbd_scrub (fec);
-
- /*
- * Check for valid length of data.
- */
- if ((data_length > 1500) || (data_length <= 0)) {
- return -1;
- }
-
- /*
- * Check the number of vacant TxBDs.
- */
- if (fec->cleanTbdNum < 1) {
-#ifdef DEBUG
- printf ("No available TxBDs ...\n");
-#endif
- return -1;
- }
-
- /*
- * Get the first TxBD to send the mac header
- */
- pTbd = &fec->tbdBase[fec->tbdIndex];
- pTbd->dataLength = data_length;
- pTbd->dataPointer = (u32) eth_data;
- pTbd->status |= FEC_TBD_LAST | FEC_TBD_TC | FEC_TBD_READY;
- fec->tbdIndex = (fec->tbdIndex + 1) % FEC_TBD_NUM;
-
-#ifdef DEBUG
- printf ("DMA_TASK_ENABLE, fec->tbdIndex = %d \n", fec->tbdIndex);
-#endif
-
- /*
- * Kick the MII i/f
- */
- if (fec->xcv_type != SEVENWIRE) {
- u16 phyStatus;
-
- miiphy_read (dev->name, 0, 0x1, &phyStatus);
- }
-
- /*
- * Enable SmartDMA transmit task
- */
-
-#ifdef DEBUG
- tfifo_print (dev->name, fec);
-#endif
-
- DMA_TASK_ENABLE (FEC_XMIT_TASK_NO);
-
-#ifdef DEBUG
- tfifo_print (dev->name, fec);
-#endif
-
-#ifdef DEBUG
- printf ("+");
-#endif
-
- fec->cleanTbdNum -= 1;
-
-#ifdef DEBUG
- printf ("smartDMA ethernet Tx task enabled\n");
-#endif
- /*
- * wait until frame is sent .
- */
- while (pTbd->status & FEC_TBD_READY) {
- udelay (10);
-#ifdef DEBUG
- printf ("TDB status = %04x\n", pTbd->status);
-#endif
- }
-
- return 0;
-}
-
-
-/********************************************************************/
-static int mpc8220_fec_recv (struct eth_device *dev)
-{
- /*
- * This command pulls one frame from the card
- */
- mpc8220_fec_priv *fec = (mpc8220_fec_priv *) dev->priv;
- FEC_RBD *pRbd = &fec->rbdBase[fec->rbdIndex];
- unsigned long ievent;
- int frame_length, len = 0;
- NBUF *frame;
-
-#ifdef DEBUG
- printf ("mpc8220_fec_recv %d Start...\n", fec->rbdIndex);
- printf ("-");
-#endif
-
- /*
- * Check if any critical events have happened
- */
- ievent = fec->eth->ievent;
- fec->eth->ievent = ievent;
- if (ievent & 0x20060000) {
- /* BABT, Rx/Tx FIFO errors */
- mpc8220_fec_halt (dev);
- mpc8220_fec_init (dev, NULL);
- return 0;
- }
- if (ievent & 0x80000000) {
- /* Heartbeat error */
- fec->eth->x_cntrl |= 0x00000001;
- }
- if (ievent & 0x10000000) {
- /* Graceful stop complete */
- if (fec->eth->x_cntrl & 0x00000001) {
- mpc8220_fec_halt (dev);
- fec->eth->x_cntrl &= ~0x00000001;
- mpc8220_fec_init (dev, NULL);
- }
- }
-
- if (!(pRbd->status & FEC_RBD_EMPTY)) {
- if ((pRbd->status & FEC_RBD_LAST)
- && !(pRbd->status & FEC_RBD_ERR)
- && ((pRbd->dataLength - 4) > 14)) {
-
- /*
- * Get buffer address and size
- */
- frame = (NBUF *) pRbd->dataPointer;
- frame_length = pRbd->dataLength - 4;
-
- /*
- * Fill the buffer and pass it to upper layers
- */
-/* memcpy(buff, frame->head, 14);
- memcpy(buff + 14, frame->data, frame_length);*/
- NetReceive ((volatile uchar *) pRbd->dataPointer,
- frame_length);
- len = frame_length;
- }
- /*
- * Reset buffer descriptor as empty
- */
- mpc8220_fec_rbd_clean (fec, pRbd);
- }
- DMA_CLEAR_IEVENT (FEC_RECV_TASK_NO);
- return len;
-}
-
-
-/********************************************************************/
-int mpc8220_fec_initialize (bd_t * bis)
-{
- mpc8220_fec_priv *fec;
-
-#ifdef CONFIG_HAS_ETH1
- mpc8220_fec_priv *fec2;
-#endif
- struct eth_device *dev;
- char *tmp, *end;
- char env_enetaddr[6];
-
-#ifdef CONFIG_HAS_ETH1
- char env_enet1addr[6];
-#endif
- int i;
-
- fec = (mpc8220_fec_priv *) malloc (sizeof (*fec));
- dev = (struct eth_device *) malloc (sizeof (*dev));
- memset (dev, 0, sizeof *dev);
-
- fec->eth = (ethernet_regs *) MMAP_FEC1;
-#ifdef CONFIG_HAS_ETH1
- fec2 = (mpc8220_fec_priv *) malloc (sizeof (*fec));
- fec2->eth = (ethernet_regs *) MMAP_FEC2;
-#endif
- fec->tbdBase = (FEC_TBD *) FEC_BD_BASE;
- fec->rbdBase =
- (FEC_RBD *) (FEC_BD_BASE + FEC_TBD_NUM * sizeof (FEC_TBD));
- fec->xcv_type = MII100;
-
- dev->priv = (void *) fec;
- dev->iobase = MMAP_FEC1;
- dev->init = mpc8220_fec_init;
- dev->halt = mpc8220_fec_halt;
- dev->send = mpc8220_fec_send;
- dev->recv = mpc8220_fec_recv;
-
- sprintf (dev->name, "FEC ETHERNET");
- eth_register (dev);
-
-#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
- miiphy_register (dev->name,
- fec8220_miiphy_read, fec8220_miiphy_write);
-#endif
-
- /*
- * Try to set the mac address now. The fec mac address is
- * a garbage after reset. When not using fec for booting
- * the Linux fec driver will try to work with this garbage.
- */
- tmp = getenv ("ethaddr");
- if (tmp) {
- for (i = 0; i < 6; i++) {
- env_enetaddr[i] =
- tmp ? simple_strtoul (tmp, &end, 16) : 0;
- if (tmp)
- tmp = (*end) ? end + 1 : end;
- }
- mpc8220_fec_set_hwaddr (fec, env_enetaddr);
- }
-#ifdef CONFIG_HAS_ETH1
- tmp = getenv ("eth1addr");
- if (tmp) {
- for (i = 0; i < 6; i++) {
- env_enet1addr[i] =
- tmp ? simple_strtoul (tmp, &end, 16) : 0;
- if (tmp)
- tmp = (*end) ? end + 1 : end;
- }
- mpc8220_fec_set_hwaddr (fec2, env_enet1addr);
- }
-#endif
-
- return 1;
-}
-
-/* MII-interface related functions */
-/********************************************************************/
-int fec8220_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal)
-{
- ethernet_regs *eth = (ethernet_regs *) MMAP_FEC1;
- u32 reg; /* convenient holder for the PHY register */
- u32 phy; /* convenient holder for the PHY */
- int timeout = 0xffff;
-
- /*
- * reading from any PHY's register is done by properly
- * programming the FEC's MII data register.
- */
- reg = regAddr << FEC_MII_DATA_RA_SHIFT;
- phy = phyAddr << FEC_MII_DATA_PA_SHIFT;
-
- eth->mii_data =
- (FEC_MII_DATA_ST | FEC_MII_DATA_OP_RD | FEC_MII_DATA_TA | phy
- | reg);
-
- /*
- * wait for the related interrupt
- */
- while ((timeout--) && (!(eth->ievent & 0x00800000)));
-
- if (timeout == 0) {
-#ifdef DEBUG
- printf ("Read MDIO failed...\n");
-#endif
- return -1;
- }
-
- /*
- * clear mii interrupt bit
- */
- eth->ievent = 0x00800000;
-
- /*
- * it's now safe to read the PHY's register
- */
- *retVal = (u16) eth->mii_data;
-
- return 0;
-}
-
-/********************************************************************/
-int fec8220_miiphy_write (char *devname, u8 phyAddr, u8 regAddr, u16 data)
-{
- ethernet_regs *eth = (ethernet_regs *) MMAP_FEC1;
- u32 reg; /* convenient holder for the PHY register */
- u32 phy; /* convenient holder for the PHY */
- int timeout = 0xffff;
-
- reg = regAddr << FEC_MII_DATA_RA_SHIFT;
- phy = phyAddr << FEC_MII_DATA_PA_SHIFT;
-
- eth->mii_data = (FEC_MII_DATA_ST | FEC_MII_DATA_OP_WR |
- FEC_MII_DATA_TA | phy | reg | data);
-
- /*
- * wait for the MII interrupt
- */
- while ((timeout--) && (!(eth->ievent & 0x00800000)));
-
- if (timeout == 0) {
-#ifdef DEBUG
- printf ("Write MDIO failed...\n");
-#endif
- return -1;
- }
-
- /*
- * clear MII interrupt bit
- */
- eth->ievent = 0x00800000;
-
- return 0;
-}
-
-#ifdef DEBUG
-static u32 local_crc32 (char *string, unsigned int crc_value, int len)
-{
- int i;
- char c;
- unsigned int crc, count;
-
- /*
- * crc32 algorithm
- */
- /*
- * crc = 0xffffffff; * The initialized value should be 0xffffffff
- */
- crc = crc_value;
-
- for (i = len; --i >= 0;) {
- c = *string++;
- for (count = 0; count < 8; count++) {
- if ((c & 0x01) ^ (crc & 0x01)) {
- crc >>= 1;
- crc = crc ^ 0xedb88320;
- } else {
- crc >>= 1;
- }
- c >>= 1;
- }
- }
-
- /*
- * In big endian system, do byte swaping for crc value
- */
- return crc;
-}
-#endif /* DEBUG */
-
-#endif /* CONFIG_MPC8220_FEC */
diff --git a/cpu/mpc8220/fec.h b/cpu/mpc8220/fec.h
deleted file mode 100644
index a8927fcdbb..0000000000
--- a/cpu/mpc8220/fec.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * (C) Copyright 2003-2004
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * This file is based on mpc4200fec.h
- * (C) Copyright Motorola, Inc., 2000
- *
- * odin ethernet header file
- */
-
-#ifndef __MPC8220_FEC_H
-#define __MPC8220_FEC_H
-
-#include <common.h>
-#include <mpc8220.h>
-#include "dma.h"
-
-typedef struct ethernet_register_set {
-
-/* [10:2]addr = 00 */
-
-/* Control and status Registers (offset 000-1FF) */
-
- volatile u32 fec_id; /* MBAR_ETH + 0x000 */
- volatile u32 ievent; /* MBAR_ETH + 0x004 */
- volatile u32 imask; /* MBAR_ETH + 0x008 */
-
- volatile u32 RES0[1]; /* MBAR_ETH + 0x00C */
- volatile u32 r_des_active; /* MBAR_ETH + 0x010 */
- volatile u32 x_des_active; /* MBAR_ETH + 0x014 */
- volatile u32 r_des_active_cl; /* MBAR_ETH + 0x018 */
- volatile u32 x_des_active_cl; /* MBAR_ETH + 0x01C */
- volatile u32 ivent_set; /* MBAR_ETH + 0x020 */
- volatile u32 ecntrl; /* MBAR_ETH + 0x024 */
-
- volatile u32 RES1[6]; /* MBAR_ETH + 0x028-03C */
- volatile u32 mii_data; /* MBAR_ETH + 0x040 */
- volatile u32 mii_speed; /* MBAR_ETH + 0x044 */
- volatile u32 mii_status; /* MBAR_ETH + 0x048 */
-
- volatile u32 RES2[5]; /* MBAR_ETH + 0x04C-05C */
- volatile u32 mib_data; /* MBAR_ETH + 0x060 */
- volatile u32 mib_control; /* MBAR_ETH + 0x064 */
-
- volatile u32 RES3[6]; /* MBAR_ETH + 0x068-7C */
- volatile u32 r_activate; /* MBAR_ETH + 0x080 */
- volatile u32 r_cntrl; /* MBAR_ETH + 0x084 */
- volatile u32 r_hash; /* MBAR_ETH + 0x088 */
- volatile u32 r_data; /* MBAR_ETH + 0x08C */
- volatile u32 ar_done; /* MBAR_ETH + 0x090 */
- volatile u32 r_test; /* MBAR_ETH + 0x094 */
- volatile u32 r_mib; /* MBAR_ETH + 0x098 */
- volatile u32 r_da_low; /* MBAR_ETH + 0x09C */
- volatile u32 r_da_high; /* MBAR_ETH + 0x0A0 */
-
- volatile u32 RES4[7]; /* MBAR_ETH + 0x0A4-0BC */
- volatile u32 x_activate; /* MBAR_ETH + 0x0C0 */
- volatile u32 x_cntrl; /* MBAR_ETH + 0x0C4 */
- volatile u32 backoff; /* MBAR_ETH + 0x0C8 */
- volatile u32 x_data; /* MBAR_ETH + 0x0CC */
- volatile u32 x_status; /* MBAR_ETH + 0x0D0 */
- volatile u32 x_mib; /* MBAR_ETH + 0x0D4 */
- volatile u32 x_test; /* MBAR_ETH + 0x0D8 */
- volatile u32 fdxfc_da1; /* MBAR_ETH + 0x0DC */
- volatile u32 fdxfc_da2; /* MBAR_ETH + 0x0E0 */
- volatile u32 paddr1; /* MBAR_ETH + 0x0E4 */
- volatile u32 paddr2; /* MBAR_ETH + 0x0E8 */
- volatile u32 op_pause; /* MBAR_ETH + 0x0EC */
-
- volatile u32 RES5[4]; /* MBAR_ETH + 0x0F0-0FC */
- volatile u32 instr_reg; /* MBAR_ETH + 0x100 */
- volatile u32 context_reg; /* MBAR_ETH + 0x104 */
- volatile u32 test_cntrl; /* MBAR_ETH + 0x108 */
- volatile u32 acc_reg; /* MBAR_ETH + 0x10C */
- volatile u32 ones; /* MBAR_ETH + 0x110 */
- volatile u32 zeros; /* MBAR_ETH + 0x114 */
- volatile u32 iaddr1; /* MBAR_ETH + 0x118 */
- volatile u32 iaddr2; /* MBAR_ETH + 0x11C */
- volatile u32 gaddr1; /* MBAR_ETH + 0x120 */
- volatile u32 gaddr2; /* MBAR_ETH + 0x124 */
- volatile u32 random; /* MBAR_ETH + 0x128 */
- volatile u32 rand1; /* MBAR_ETH + 0x12C */
- volatile u32 tmp; /* MBAR_ETH + 0x130 */
-
- volatile u32 RES6[3]; /* MBAR_ETH + 0x134-13C */
- volatile u32 fifo_id; /* MBAR_ETH + 0x140 */
- volatile u32 x_wmrk; /* MBAR_ETH + 0x144 */
- volatile u32 fcntrl; /* MBAR_ETH + 0x148 */
- volatile u32 r_bound; /* MBAR_ETH + 0x14C */
- volatile u32 r_fstart; /* MBAR_ETH + 0x150 */
- volatile u32 r_count; /* MBAR_ETH + 0x154 */
- volatile u32 r_lag; /* MBAR_ETH + 0x158 */
- volatile u32 r_read; /* MBAR_ETH + 0x15C */
- volatile u32 r_write; /* MBAR_ETH + 0x160 */
- volatile u32 x_count; /* MBAR_ETH + 0x164 */
- volatile u32 x_lag; /* MBAR_ETH + 0x168 */
- volatile u32 x_retry; /* MBAR_ETH + 0x16C */
- volatile u32 x_write; /* MBAR_ETH + 0x170 */
- volatile u32 x_read; /* MBAR_ETH + 0x174 */
-
- volatile u32 RES7[2]; /* MBAR_ETH + 0x178-17C */
- volatile u32 fm_cntrl; /* MBAR_ETH + 0x180 */
- volatile u32 rfifo_data; /* MBAR_ETH + 0x184 */
- volatile u32 rfifo_status; /* MBAR_ETH + 0x188 */
- volatile u32 rfifo_cntrl; /* MBAR_ETH + 0x18C */
- volatile u32 rfifo_lrf_ptr; /* MBAR_ETH + 0x190 */
- volatile u32 rfifo_lwf_ptr; /* MBAR_ETH + 0x194 */
- volatile u32 rfifo_alarm; /* MBAR_ETH + 0x198 */
- volatile u32 rfifo_rdptr; /* MBAR_ETH + 0x19C */
- volatile u32 rfifo_wrptr; /* MBAR_ETH + 0x1A0 */
- volatile u32 tfifo_data; /* MBAR_ETH + 0x1A4 */
- volatile u32 tfifo_status; /* MBAR_ETH + 0x1A8 */
- volatile u32 tfifo_cntrl; /* MBAR_ETH + 0x1AC */
- volatile u32 tfifo_lrf_ptr; /* MBAR_ETH + 0x1B0 */
- volatile u32 tfifo_lwf_ptr; /* MBAR_ETH + 0x1B4 */
- volatile u32 tfifo_alarm; /* MBAR_ETH + 0x1B8 */
- volatile u32 tfifo_rdptr; /* MBAR_ETH + 0x1BC */
- volatile u32 tfifo_wrptr; /* MBAR_ETH + 0x1C0 */
-
- volatile u32 reset_cntrl; /* MBAR_ETH + 0x1C4 */
- volatile u32 xmit_fsm; /* MBAR_ETH + 0x1C8 */
-
- volatile u32 RES8[3]; /* MBAR_ETH + 0x1CC-1D4 */
- volatile u32 rdes_data0; /* MBAR_ETH + 0x1D8 */
- volatile u32 rdes_data1; /* MBAR_ETH + 0x1DC */
- volatile u32 r_length; /* MBAR_ETH + 0x1E0 */
- volatile u32 x_length; /* MBAR_ETH + 0x1E4 */
- volatile u32 x_addr; /* MBAR_ETH + 0x1E8 */
- volatile u32 cdes_data; /* MBAR_ETH + 0x1EC */
- volatile u32 status; /* MBAR_ETH + 0x1F0 */
- volatile u32 dma_control; /* MBAR_ETH + 0x1F4 */
- volatile u32 des_cmnd; /* MBAR_ETH + 0x1F8 */
- volatile u32 data; /* MBAR_ETH + 0x1FC */
-
- /* MIB COUNTERS (Offset 200-2FF) */
-
- volatile u32 rmon_t_drop; /* MBAR_ETH + 0x200 */
- volatile u32 rmon_t_packets; /* MBAR_ETH + 0x204 */
- volatile u32 rmon_t_bc_pkt; /* MBAR_ETH + 0x208 */
- volatile u32 rmon_t_mc_pkt; /* MBAR_ETH + 0x20C */
- volatile u32 rmon_t_crc_align; /* MBAR_ETH + 0x210 */
- volatile u32 rmon_t_undersize; /* MBAR_ETH + 0x214 */
- volatile u32 rmon_t_oversize; /* MBAR_ETH + 0x218 */
- volatile u32 rmon_t_frag; /* MBAR_ETH + 0x21C */
- volatile u32 rmon_t_jab; /* MBAR_ETH + 0x220 */
- volatile u32 rmon_t_col; /* MBAR_ETH + 0x224 */
- volatile u32 rmon_t_p64; /* MBAR_ETH + 0x228 */
- volatile u32 rmon_t_p65to127; /* MBAR_ETH + 0x22C */
- volatile u32 rmon_t_p128to255; /* MBAR_ETH + 0x230 */
- volatile u32 rmon_t_p256to511; /* MBAR_ETH + 0x234 */
- volatile u32 rmon_t_p512to1023; /* MBAR_ETH + 0x238 */
- volatile u32 rmon_t_p1024to2047;/* MBAR_ETH + 0x23C */
- volatile u32 rmon_t_p_gte2048; /* MBAR_ETH + 0x240 */
- volatile u32 rmon_t_octets; /* MBAR_ETH + 0x244 */
- volatile u32 ieee_t_drop; /* MBAR_ETH + 0x248 */
- volatile u32 ieee_t_frame_ok; /* MBAR_ETH + 0x24C */
- volatile u32 ieee_t_1col; /* MBAR_ETH + 0x250 */
- volatile u32 ieee_t_mcol; /* MBAR_ETH + 0x254 */
- volatile u32 ieee_t_def; /* MBAR_ETH + 0x258 */
- volatile u32 ieee_t_lcol; /* MBAR_ETH + 0x25C */
- volatile u32 ieee_t_excol; /* MBAR_ETH + 0x260 */
- volatile u32 ieee_t_macerr; /* MBAR_ETH + 0x264 */
- volatile u32 ieee_t_cserr; /* MBAR_ETH + 0x268 */
- volatile u32 ieee_t_sqe; /* MBAR_ETH + 0x26C */
- volatile u32 t_fdxfc; /* MBAR_ETH + 0x270 */
- volatile u32 ieee_t_octets_ok; /* MBAR_ETH + 0x274 */
-
- volatile u32 RES9[2]; /* MBAR_ETH + 0x278-27C */
- volatile u32 rmon_r_drop; /* MBAR_ETH + 0x280 */
- volatile u32 rmon_r_packets; /* MBAR_ETH + 0x284 */
- volatile u32 rmon_r_bc_pkt; /* MBAR_ETH + 0x288 */
- volatile u32 rmon_r_mc_pkt; /* MBAR_ETH + 0x28C */
- volatile u32 rmon_r_crc_align; /* MBAR_ETH + 0x290 */
- volatile u32 rmon_r_undersize; /* MBAR_ETH + 0x294 */
- volatile u32 rmon_r_oversize; /* MBAR_ETH + 0x298 */
- volatile u32 rmon_r_frag; /* MBAR_ETH + 0x29C */
- volatile u32 rmon_r_jab; /* MBAR_ETH + 0x2A0 */
-
- volatile u32 rmon_r_resvd_0; /* MBAR_ETH + 0x2A4 */
-
- volatile u32 rmon_r_p64; /* MBAR_ETH + 0x2A8 */
- volatile u32 rmon_r_p65to127; /* MBAR_ETH + 0x2AC */
- volatile u32 rmon_r_p128to255; /* MBAR_ETH + 0x2B0 */
- volatile u32 rmon_r_p256to511; /* MBAR_ETH + 0x2B4 */
- volatile u32 rmon_r_p512to1023; /* MBAR_ETH + 0x2B8 */
- volatile u32 rmon_r_p1024to2047;/* MBAR_ETH + 0x2BC */
- volatile u32 rmon_r_p_gte2048; /* MBAR_ETH + 0x2C0 */
- volatile u32 rmon_r_octets; /* MBAR_ETH + 0x2C4 */
- volatile u32 ieee_r_drop; /* MBAR_ETH + 0x2C8 */
- volatile u32 ieee_r_frame_ok; /* MBAR_ETH + 0x2CC */
- volatile u32 ieee_r_crc; /* MBAR_ETH + 0x2D0 */
- volatile u32 ieee_r_align; /* MBAR_ETH + 0x2D4 */
- volatile u32 r_macerr; /* MBAR_ETH + 0x2D8 */
- volatile u32 r_fdxfc; /* MBAR_ETH + 0x2DC */
- volatile u32 ieee_r_octets_ok; /* MBAR_ETH + 0x2E0 */
-
- volatile u32 RES10[6]; /* MBAR_ETH + 0x2E4-2FC */
-
- volatile u32 RES11[64]; /* MBAR_ETH + 0x300-3FF */
-} ethernet_regs;
-
-/* Receive & Transmit Buffer Descriptor definitions */
-typedef struct BufferDescriptor {
- u16 status;
- u16 dataLength;
- u32 dataPointer;
-} FEC_RBD;
-
-typedef struct {
- u16 status;
- u16 dataLength;
- u32 dataPointer;
-} FEC_TBD;
-
-/* private structure */
-typedef enum {
- SEVENWIRE, /* 7-wire */
- MII10, /* MII 10Mbps */
- MII100 /* MII 100Mbps */
-} xceiver_type;
-
-typedef struct {
- ethernet_regs *eth;
- xceiver_type xcv_type; /* transceiver type */
- FEC_RBD *rbdBase; /* RBD ring */
- FEC_TBD *tbdBase; /* TBD ring */
- u16 rbdIndex; /* next receive BD to read */
- u16 tbdIndex; /* next transmit BD to send */
- u16 usedTbdIndex; /* next transmit BD to clean */
- u16 cleanTbdNum; /* the number of available transmit BDs */
-} mpc8220_fec_priv;
-
-/* Ethernet parameter area */
-#define FEC_TBD_BASE (FEC_PARAM_BASE + 0x00)
-#define FEC_TBD_NEXT (FEC_PARAM_BASE + 0x04)
-#define FEC_RBD_BASE (FEC_PARAM_BASE + 0x08)
-#define FEC_RBD_NEXT (FEC_PARAM_BASE + 0x0c)
-
-/* BD Numer definitions */
-#define FEC_TBD_NUM 48 /* The user can adjust this value */
-#define FEC_RBD_NUM 32 /* The user can adjust this value */
-
-/* packet size limit */
-#define FEC_MAX_PKT_SIZE 1536
-
-/* RBD bits definitions */
-#define FEC_RBD_EMPTY 0x8000 /* Buffer is empty */
-#define FEC_RBD_WRAP 0x2000 /* Last BD in ring */
-#define FEC_RBD_INT 0x1000 /* Interrupt */
-#define FEC_RBD_LAST 0x0800 /* Buffer is last in frame(useless) */
-#define FEC_RBD_MISS 0x0100 /* Miss bit for prom mode */
-#define FEC_RBD_BC 0x0080 /* The received frame is broadcast frame */
-#define FEC_RBD_MC 0x0040 /* The received frame is multicast frame */
-#define FEC_RBD_LG 0x0020 /* Frame length violation */
-#define FEC_RBD_NO 0x0010 /* Nonoctet align frame */
-#define FEC_RBD_SH 0x0008 /* Short frame */
-#define FEC_RBD_CR 0x0004 /* CRC error */
-#define FEC_RBD_OV 0x0002 /* Receive FIFO overrun */
-#define FEC_RBD_TR 0x0001 /* Frame is truncated */
-#define FEC_RBD_ERR (FEC_RBD_LG | FEC_RBD_NO | FEC_RBD_CR | \
- FEC_RBD_OV | FEC_RBD_TR)
-
-/* TBD bits definitions */
-#define FEC_TBD_READY 0x8000 /* Buffer is ready */
-#define FEC_TBD_WRAP 0x2000 /* Last BD in ring */
-#define FEC_TBD_INT 0x1000 /* Interrupt */
-#define FEC_TBD_LAST 0x0800 /* Buffer is last in frame */
-#define FEC_TBD_TC 0x0400 /* Transmit the CRC */
-#define FEC_TBD_ABC 0x0200 /* Append bad CRC */
-
-/* MII-related definitios */
-#define FEC_MII_DATA_ST 0x40000000 /* Start of frame delimiter */
-#define FEC_MII_DATA_OP_RD 0x20000000 /* Perform a read operation */
-#define FEC_MII_DATA_OP_WR 0x10000000 /* Perform a write operation */
-#define FEC_MII_DATA_PA_MSK 0x0f800000 /* PHY Address field mask */
-#define FEC_MII_DATA_RA_MSK 0x007c0000 /* PHY Register field mask */
-#define FEC_MII_DATA_TA 0x00020000 /* Turnaround */
-#define FEC_MII_DATA_DATAMSK 0x0000ffff /* PHY data field */
-
-#define FEC_MII_DATA_RA_SHIFT 18 /* MII Register address bits */
-#define FEC_MII_DATA_PA_SHIFT 23 /* MII PHY address bits */
-
-#endif /* __MPC8220_FEC_H */
diff --git a/cpu/mpc8220/fec_dma_tasks.S b/cpu/mpc8220/fec_dma_tasks.S
deleted file mode 100644
index 3f8a03bf15..0000000000
--- a/cpu/mpc8220/fec_dma_tasks.S
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * Copyright (C) 2004, Freescale Semiconductor, Inc.
- *
- * This file contains microcode for the FEC controller of the MPC8220.
- */
-
-#include <config.h>
-
-#if defined(CONFIG_MPC8220)
-
-/* sas/sccg, gas target */
-.section smartdmaInitData,"aw",@progbits /* Initialized data for task variables */
-.section smartdmaTaskTable,"aw",@progbits /* Task tables */
-.align 9
-.globl taskTable
-taskTable:
-.globl scEthernetRecv_Entry
-scEthernetRecv_Entry: /* Task 0 */
-.long scEthernetRecv_TDT - taskTable /* Task 0 Descriptor Table */
-.long scEthernetRecv_TDT - taskTable + 0x00000094
-.long scEthernetRecv_VarTab - taskTable /* Task 0 Variable Table */
-.long scEthernetRecv_FDT - taskTable + 0x03 /* Task 0 Function Descriptor Table & Flags */
-.long 0x00000000
-.long 0x00000000
-.long scEthernetRecv_CSave - taskTable /* Task 0 context save space */
-.long 0xf0000000
-.globl scEthernetXmit_Entry
-scEthernetXmit_Entry: /* Task 1 */
-.long scEthernetXmit_TDT - taskTable /* Task 1 Descriptor Table */
-.long scEthernetXmit_TDT - taskTable + 0x000000e0
-.long scEthernetXmit_VarTab - taskTable /* Task 1 Variable Table */
-.long scEthernetXmit_FDT - taskTable + 0x03 /* Task 1 Function Descriptor Table & Flags */
-.long 0x00000000
-.long 0x00000000
-.long scEthernetXmit_CSave - taskTable /* Task 1 context save space */
-.long 0xf0000000
-
-
-.globl scEthernetRecv_TDT
-scEthernetRecv_TDT: /* Task 0 Descriptor Table */
-.long 0xc4c50000 /* 0000(153): LCDEXT: idx0 = var9 + var10; idx0 once var0; idx0 += inc0 */
-.long 0x84c5e000 /* 0004(153): LCD: idx1 = var9 + var11; ; idx1 += inc0 */
-.long 0x10001f08 /* 0008(156): DRD1A: var7 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x10000380 /* 000C(157): DRD1A: var0 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000f88 /* 0010(158): DRD1A: var3 = *idx1; FN=0 init=0 WS=0 RS=0 */
-.long 0x81980000 /* 0014(162): LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
-.long 0x10000780 /* 0018(164): DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 001C(165): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x010cf04c /* 0020(165): DRD2B1: var4 = EU3(); EU3(var1,var12) */
-.long 0x82180349 /* 0024(169): LCD: idx0 = var4; idx0 != var13; idx0 += inc1 */
-.long 0x81c68004 /* 0028(172): LCD: idx1 = var3 + var13 + 4; idx1 once var0; idx1 += inc0 */
-.long 0x70000000 /* 002C(174): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x018cf04e /* 0030(174): DRD2B1: var6 = EU3(); EU3(var1,var14) */
-.long 0x70000000 /* 0034(175): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x020cf04f /* 0038(175): DRD2B1: var8 = EU3(); EU3(var1,var15) */
-.long 0x00000b88 /* 003C(176): DRD1A: var2 = *idx1; FN=0 init=0 WS=0 RS=0 */
-.long 0x80025184 /* 0040(205): LCDEXT: idx1 = 0xf0009184; ; */
-.long 0x86810412 /* 0044(205): LCD: idx2 = var13, idx3 = var2; idx2 < var16; idx2 += inc2, idx3 += inc2 */
-.long 0x0200cf88 /* 0048(209): DRD1A: *idx3 = *idx1; FN=0 init=16 WS=0 RS=0 */
-.long 0x80025184 /* 004C(217): LCDEXT: idx1 = 0xf0009184; ; */
-.long 0x8681845b /* 0050(217): LCD: idx2 = var13, idx3 = var3; idx2 < var17; idx2 += inc3, idx3 += inc3 */
-.long 0x0000cf88 /* 0054(221): DRD1A: *idx3 = *idx1; FN=0 init=0 WS=0 RS=0 */
-.long 0xc31883a4 /* 0058(225): LCDEXT: idx1 = var6; idx1 == var14; idx1 += inc4 */
-.long 0x80190000 /* 005C(225): LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
-.long 0x04008468 /* 0060(227): DRD1A: idx1 = var13; FN=0 INT init=0 WS=0 RS=0 */
-.long 0xc4038360 /* 0064(232): LCDEXT: idx1 = var8, idx2 = var7; idx1 == var13; idx1 += inc4, idx2 += inc0 */
-.long 0x81c50000 /* 0068(233): LCD: idx3 = var3 + var10; idx3 once var0; idx3 += inc0 */
-.long 0x1000cb18 /* 006C(235): DRD1A: *idx2 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000f18 /* 0070(236): DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
-.long 0xc418836d /* 0074(238): LCDEXT: idx1 = var8; idx1 > var13; idx1 += inc5 */
-.long 0x83990000 /* 0078(238): LCD: idx2 = var7; idx2 once var0; idx2 += inc0 */
-.long 0x10000c00 /* 007C(240): DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x0000c800 /* 0080(241): DRD1A: *idx2 = var0; FN=0 init=0 WS=0 RS=0 */
-.long 0x81988000 /* 0084(245): LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
-.long 0x10000788 /* 0088(247): DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 008C(248): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x080cf04c /* 0090(248): DRD2B1: idx0 = EU3(); EU3(var1,var12) */
-.long 0x000001f8 /* 0094(:0): NOP */
-
-
-.globl scEthernetXmit_TDT
-scEthernetXmit_TDT: /* Task 1 Descriptor Table */
-.long 0x80095b00 /* 0000(280): LCDEXT: idx0 = 0xf0025b00; ; */
-.long 0x85c60004 /* 0004(280): LCD: idx1 = var11 + var12 + 4; idx1 once var0; idx1 += inc0 */
-.long 0x10002308 /* 0008(283): DRD1A: var8 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x10000f88 /* 000C(284): DRD1A: var3 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000380 /* 0010(285): DRD1A: var0 = *idx0; FN=0 init=0 WS=0 RS=0 */
-.long 0x81980000 /* 0014(288): LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
-.long 0x10000780 /* 0018(290): DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 001C(291): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x024cf04d /* 0020(291): DRD2B1: var9 = EU3(); EU3(var1,var13) */
-.long 0x84980309 /* 0024(294): LCD: idx0 = var9; idx0 != var12; idx0 += inc1 */
-.long 0xc0004003 /* 0028(297): LCDEXT: idx1 = 0x00000003; ; */
-.long 0x81c60004 /* 002C(297): LCD: idx2 = var3 + var12 + 4; idx2 once var0; idx2 += inc0 */
-.long 0x70000000 /* 0030(299): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x010cf04e /* 0034(299): DRD2B1: var4 = EU3(); EU3(var1,var14) */
-.long 0x70000000 /* 0038(300): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x014cf04f /* 003C(300): DRD2B1: var5 = EU3(); EU3(var1,var15) */
-.long 0x70000000 /* 0040(301): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x028cf050 /* 0044(301): DRD2B1: var10 = EU3(); EU3(var1,var16) */
-.long 0x70000000 /* 0048(302): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
-.long 0x018cf051 /* 004C(302): DRD2B1: var6 = EU3(); EU3(var1,var17) */
-.long 0x10000b90 /* 0050(303): DRD1A: var2 = *idx2; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 0054(304): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x01ccf0a1 /* 0058(304): DRD2B1: var7 = EU3(); EU3(var2,idx1) */
-.long 0xc2988312 /* 005C(308): LCDEXT: idx1 = var5; idx1 > var12; idx1 += inc2 */
-.long 0x83490000 /* 0060(308): LCD: idx2 = var6 + var18; idx2 once var0; idx2 += inc0 */
-.long 0x00001b10 /* 0064(310): DRD1A: var6 = idx2; FN=0 init=0 WS=0 RS=0 */
-.long 0x800251a4 /* 0068(315): LCDEXT: idx1 = 0xf00091a4; ; */
-.long 0xc30104dc /* 006C(315): LCDEXT: idx2 = var6, idx3 = var2; idx2 >= var19; idx2 += inc3, idx3 += inc4 */
-.long 0x839a032d /* 0070(316): LCD: idx4 = var7; idx4 == var12; idx4 += inc5 */
-.long 0x0220c798 /* 0074(321): DRD1A: *idx1 = *idx3; FN=0 init=17 WS=0 RS=0 */
-.long 0x800251a4 /* 0078(329): LCDEXT: idx1 = 0xf00091a4; ; */
-.long 0x99198337 /* 007C(329): LCD: idx2 = idx2, idx3 = idx3; idx2 > var12; idx2 += inc6, idx3 += inc7 */
-.long 0x022ac798 /* 0080(333): DRD1A: *idx1 = *idx3; FN=0 init=17 WS=1 RS=1 */
-.long 0x800251a4 /* 0084(350): LCDEXT: idx1 = 0xf00091a4; ; */
-.long 0xc1430000 /* 0088(350): LCDEXT: idx2 = var2 + var6; idx2 once var0; idx2 += inc0 */
-.long 0x82998312 /* 008C(351): LCD: idx3 = var5; idx3 > var12; idx3 += inc2 */
-.long 0x0a2ac790 /* 0090(354): DRD1A: *idx1 = *idx2; FN=0 TFD init=17 WS=1 RS=1 */
-.long 0x81988000 /* 0094(359): LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
-.long 0x60000002 /* 0098(361): DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=0 RS=0 */
-.long 0x0c4cfc4d /* 009C(361): DRD2B1: *idx1 = EU3(); EU3(*idx1,var13) */
-.long 0xc21883ad /* 00A0(365): LCDEXT: idx1 = var4; idx1 == var14; idx1 += inc5 */
-.long 0x80190000 /* 00A4(365): LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
-.long 0x04008460 /* 00A8(367): DRD1A: idx1 = var12; FN=0 INT init=0 WS=0 RS=0 */
-.long 0xc4052305 /* 00AC(371): LCDEXT: idx1 = var8, idx2 = var10; idx2 == var12; idx1 += inc0, idx2 += inc5 */
-.long 0x81ca0000 /* 00B0(372): LCD: idx3 = var3 + var20; idx3 once var0; idx3 += inc0 */
-.long 0x1000c718 /* 00B4(374): DRD1A: *idx1 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00000f18 /* 00B8(375): DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
-.long 0xc4188000 /* 00BC(378): LCDEXT: idx1 = var8; idx1 once var0; idx1 += inc0 */
-.long 0x85190312 /* 00C0(378): LCD: idx2 = var10; idx2 > var12; idx2 += inc2 */
-.long 0x10000c00 /* 00C4(380): DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x1000c400 /* 00C8(381): DRD1A: *idx1 = var0; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x00008860 /* 00CC(382): DRD1A: idx2 = var12; FN=0 init=0 WS=0 RS=0 */
-.long 0x81988000 /* 00D0(386): LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
-.long 0x10000788 /* 00D4(388): DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
-.long 0x60000000 /* 00D8(389): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
-.long 0x080cf04d /* 00DC(389): DRD2B1: idx0 = EU3(); EU3(var1,var13) */
-.long 0x000001f8 /* 00E0(:0): NOP */
-
-.align 8
-
-.globl scEthernetRecv_VarTab
-scEthernetRecv_VarTab: /* Task 0 Variable Table */
-.long 0x00000000 /* var[0] */
-.long 0x00000000 /* var[1] */
-.long 0x00000000 /* var[2] */
-.long 0x00000000 /* var[3] */
-.long 0x00000000 /* var[4] */
-.long 0x00000000 /* var[5] */
-.long 0x00000000 /* var[6] */
-.long 0x00000000 /* var[7] */
-.long 0x00000000 /* var[8] */
-.long 0xf0025b00 /* var[9] */
-.long 0x00000008 /* var[10] */
-.long 0x0000000c /* var[11] */
-.long 0x80000000 /* var[12] */
-.long 0x00000000 /* var[13] */
-.long 0x10000000 /* var[14] */
-.long 0x20000000 /* var[15] */
-.long 0x00000800 /* var[16] */
-.long 0x00000001 /* var[17] */
-.long 0x00000000 /* var[18] */
-.long 0x00000000 /* var[19] */
-.long 0x00000000 /* var[20] */
-.long 0x00000000 /* var[21] */
-.long 0x00000000 /* var[22] */
-.long 0x00000000 /* var[23] */
-.long 0x00000000 /* inc[0] */
-.long 0x60000000 /* inc[1] */
-.long 0x20000004 /* inc[2] */
-.long 0x20000001 /* inc[3] */
-.long 0x80000000 /* inc[4] */
-.long 0x40000000 /* inc[5] */
-.long 0x00000000 /* inc[6] */
-.long 0x00000000 /* inc[7] */
-
-.align 8
-
-.globl scEthernetXmit_VarTab
-scEthernetXmit_VarTab: /* Task 1 Variable Table */
-.long 0x00000000 /* var[0] */
-.long 0x00000000 /* var[1] */
-.long 0x00000000 /* var[2] */
-.long 0x00000000 /* var[3] */
-.long 0x00000000 /* var[4] */
-.long 0x00000000 /* var[5] */
-.long 0x00000000 /* var[6] */
-.long 0x00000000 /* var[7] */
-.long 0x00000000 /* var[8] */
-.long 0x00000000 /* var[9] */
-.long 0x00000000 /* var[10] */
-.long 0xf0025b00 /* var[11] */
-.long 0x00000000 /* var[12] */
-.long 0x80000000 /* var[13] */
-.long 0x10000000 /* var[14] */
-.long 0x08000000 /* var[15] */
-.long 0x20000000 /* var[16] */
-.long 0x0000ffff /* var[17] */
-.long 0xffffffff /* var[18] */
-.long 0x00000004 /* var[19] */
-.long 0x00000008 /* var[20] */
-.long 0x00000000 /* var[21] */
-.long 0x00000000 /* var[22] */
-.long 0x00000000 /* var[23] */
-.long 0x00000000 /* inc[0] */
-.long 0x60000000 /* inc[1] */
-.long 0x40000000 /* inc[2] */
-.long 0xc000fffc /* inc[3] */
-.long 0xe0000004 /* inc[4] */
-.long 0x80000000 /* inc[5] */
-.long 0x4000ffff /* inc[6] */
-.long 0xe0000001 /* inc[7] */
-
-.align 8
-
-.globl scEthernetRecv_FDT
-scEthernetRecv_FDT: /* Task 0 Function Descriptor Table */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x21800000 /* and(), EU# 3 */
-.long 0x21e00000 /* or(), EU# 3 */
-.long 0x21400000 /* andn(), EU# 3 */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-
-.align 8
-
-.globl scEthernetXmit_FDT
-scEthernetXmit_FDT: /* Task 1 Function Descriptor Table */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x21800000 /* and(), EU# 3 */
-.long 0x21e00000 /* or(), EU# 3 */
-.long 0x21400000 /* andn(), EU# 3 */
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-.long 0x00000000
-
-
-.globl scEthernetRecv_CSave
-scEthernetRecv_CSave: /* Task 0 context save space */
-.space 128, 0x0
-
-
-.globl scEthernetXmit_CSave
-scEthernetXmit_CSave: /* Task 1 context save space */
-.space 128, 0x0
-
-#endif
diff --git a/cpu/mpc8220/i2c.c b/cpu/mpc8220/i2c.c
deleted file mode 100644
index 2c6a55d891..0000000000
--- a/cpu/mpc8220/i2c.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * (C) Copyright 2004, Freescale, Inc
- * TsiChung Liew, Tsi-Chung.Liew@freescale.com.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#ifdef CONFIG_HARD_I2C
-
-#include <mpc8220.h>
-#include <i2c.h>
-
-typedef struct mpc8220_i2c {
- volatile u32 adr; /* I2Cn + 0x00 */
- volatile u32 fdr; /* I2Cn + 0x04 */
- volatile u32 cr; /* I2Cn + 0x08 */
- volatile u32 sr; /* I2Cn + 0x0C */
- volatile u32 dr; /* I2Cn + 0x10 */
-} i2c_t;
-
-/* I2Cn control register bits */
-#define I2C_EN 0x80
-#define I2C_IEN 0x40
-#define I2C_STA 0x20
-#define I2C_TX 0x10
-#define I2C_TXAK 0x08
-#define I2C_RSTA 0x04
-#define I2C_INIT_MASK (I2C_EN | I2C_STA | I2C_TX | I2C_RSTA)
-
-/* I2Cn status register bits */
-#define I2C_CF 0x80
-#define I2C_AAS 0x40
-#define I2C_BB 0x20
-#define I2C_AL 0x10
-#define I2C_SRW 0x04
-#define I2C_IF 0x02
-#define I2C_RXAK 0x01
-
-#define I2C_TIMEOUT 100
-#define I2C_RETRIES 1
-
-struct mpc8220_i2c_tap {
- int scl2tap;
- int tap2tap;
-};
-
-static int mpc_reg_in (volatile u32 * reg);
-static void mpc_reg_out (volatile u32 * reg, int val, int mask);
-static int wait_for_bb (void);
-static int wait_for_pin (int *status);
-static int do_address (uchar chip, char rdwr_flag);
-static int send_bytes (uchar chip, char *buf, int len);
-static int receive_bytes (uchar chip, char *buf, int len);
-static int mpc_get_fdr (int);
-
-static int mpc_reg_in (volatile u32 * reg)
-{
- int ret;
- ret = *reg >> 24;
- __asm__ __volatile__ ("eieio");
- return ret;
-}
-
-static void mpc_reg_out (volatile u32 * reg, int val, int mask)
-{
- int tmp;
-
- if (!mask) {
- *reg = val << 24;
- } else {
- tmp = mpc_reg_in (reg);
- *reg = ((tmp & ~mask) | (val & mask)) << 24;
- }
- __asm__ __volatile__ ("eieio");
-
- return;
-}
-
-static int wait_for_bb (void)
-{
- i2c_t *regs = (i2c_t *) MMAP_I2C;
- int timeout = I2C_TIMEOUT;
- int status;
-
- status = mpc_reg_in (&regs->sr);
-
- while (timeout-- && (status & I2C_BB)) {
- volatile int temp;
-
- mpc_reg_out (&regs->cr, I2C_STA, I2C_STA);
- temp = mpc_reg_in (&regs->dr);
- mpc_reg_out (&regs->cr, 0, I2C_STA);
- mpc_reg_out (&regs->cr, 0, 0);
- mpc_reg_out (&regs->cr, I2C_EN, 0);
- udelay (1000);
- status = mpc_reg_in (&regs->sr);
- }
-
- return (status & I2C_BB);
-}
-
-static int wait_for_pin (int *status)
-{
- i2c_t *regs = (i2c_t *) MMAP_I2C;
- int timeout = I2C_TIMEOUT;
-
- *status = mpc_reg_in (&regs->sr);
-
- while (timeout-- && !(*status & I2C_IF)) {
- udelay (1000);
- *status = mpc_reg_in (&regs->sr);
- }
-
- if (!(*status & I2C_IF)) {
- return -1;
- }
-
- mpc_reg_out (&regs->sr, 0, I2C_IF);
- return 0;
-}
-
-static int do_address (uchar chip, char rdwr_flag)
-{
- i2c_t *regs = (i2c_t *) MMAP_I2C;
- int status;
-
- chip <<= 1;
-
- if (rdwr_flag)
- chip |= 1;
-
- mpc_reg_out (&regs->cr, I2C_TX, I2C_TX);
- mpc_reg_out (&regs->dr, chip, 0);
-
- if (wait_for_pin (&status))
- return -2;
- if (status & I2C_RXAK)
- return -3;
- return 0;
-}
-
-static int send_bytes (uchar chip, char *buf, int len)
-{
- i2c_t *regs = (i2c_t *) MMAP_I2C;
- int wrcount;
- int status;
-
- for (wrcount = 0; wrcount < len; ++wrcount) {
-
- mpc_reg_out (&regs->dr, buf[wrcount], 0);
-
- if (wait_for_pin (&status))
- break;
-
- if (status & I2C_RXAK)
- break;
-
- }
-
- return !(wrcount == len);
- return 0;
-}
-
-static int receive_bytes (uchar chip, char *buf, int len)
-{
- i2c_t *regs = (i2c_t *) MMAP_I2C;
- int dummy = 1;
- int rdcount = 0;
- int status;
- int i;
-
- mpc_reg_out (&regs->cr, 0, I2C_TX);
-
- for (i = 0; i < len; ++i) {
- buf[rdcount] = mpc_reg_in (&regs->dr);
-
- if (dummy)
- dummy = 0;
- else
- rdcount++;
-
- if (wait_for_pin (&status))
- return -4;
- }
-
- mpc_reg_out (&regs->cr, I2C_TXAK, I2C_TXAK);
- buf[rdcount++] = mpc_reg_in (&regs->dr);
-
- if (wait_for_pin (&status))
- return -5;
-
- mpc_reg_out (&regs->cr, 0, I2C_TXAK);
- return 0;
-}
-
-/**************** I2C API ****************/
-
-void i2c_init (int speed, int saddr)
-{
- i2c_t *regs = (i2c_t *) MMAP_I2C;
-
- mpc_reg_out (&regs->cr, 0, 0);
- mpc_reg_out (&regs->adr, saddr << 1, 0);
-
- /* Set clock
- */
- mpc_reg_out (&regs->fdr, mpc_get_fdr (speed), 0);
-
- /* Enable module
- */
- mpc_reg_out (&regs->cr, I2C_EN, I2C_INIT_MASK);
- mpc_reg_out (&regs->sr, 0, I2C_IF);
- return;
-}
-
-static int mpc_get_fdr (int speed)
-{
- static int fdr = -1;
-
- if (fdr == -1) {
- ulong best_speed = 0;
- ulong divider;
- ulong ipb, scl;
- ulong bestmatch = 0xffffffffUL;
- int best_i = 0, best_j = 0, i, j;
- int SCL_Tap[] = { 9, 10, 12, 15, 5, 6, 7, 8 };
- struct mpc8220_i2c_tap scltap[] = {
- {4, 1},
- {4, 2},
- {6, 4},
- {6, 8},
- {14, 16},
- {30, 32},
- {62, 64},
- {126, 128}
- };
-
- ipb = gd->bus_clk;
- for (i = 7; i >= 0; i--) {
- for (j = 7; j >= 0; j--) {
- scl = 2 * (scltap[j].scl2tap +
- (SCL_Tap[i] -
- 1) * scltap[j].tap2tap + 2);
- if (ipb <= speed * scl) {
- if ((speed * scl - ipb) < bestmatch) {
- bestmatch = speed * scl - ipb;
- best_i = i;
- best_j = j;
- best_speed = ipb / scl;
- }
- }
- }
- }
- divider = (best_i & 3) | ((best_i & 4) << 3) | (best_j << 2);
- if (gd->flags & GD_FLG_RELOC) {
- fdr = divider;
- } else {
- printf ("%ld kHz, ", best_speed / 1000);
- return divider;
- }
- }
-
- return fdr;
-}
-
-int i2c_probe (uchar chip)
-{
- i2c_t *regs = (i2c_t *) MMAP_I2C;
- int i;
-
- for (i = 0; i < I2C_RETRIES; i++) {
- mpc_reg_out (&regs->cr, I2C_STA, I2C_STA);
-
- if (!do_address (chip, 0)) {
- mpc_reg_out (&regs->cr, 0, I2C_STA);
- break;
- }
-
- mpc_reg_out (&regs->cr, 0, I2C_STA);
- udelay (50);
- }
-
- return (i == I2C_RETRIES);
-}
-
-int i2c_read (uchar chip, uint addr, int alen, uchar * buf, int len)
-{
- uchar xaddr[4];
- i2c_t *regs = (i2c_t *) MMAP_I2C;
- int ret = -1;
-
- xaddr[0] = (addr >> 24) & 0xFF;
- xaddr[1] = (addr >> 16) & 0xFF;
- xaddr[2] = (addr >> 8) & 0xFF;
- xaddr[3] = addr & 0xFF;
-
- if (wait_for_bb ()) {
- printf ("i2c_read: bus is busy\n");
- goto Done;
- }
-
- mpc_reg_out (&regs->cr, I2C_STA, I2C_STA);
- if (do_address (chip, 0)) {
- printf ("i2c_read: failed to address chip\n");
- goto Done;
- }
-
- if (send_bytes (chip, (char *)&xaddr[4 - alen], alen)) {
- printf ("i2c_read: send_bytes failed\n");
- goto Done;
- }
-
- mpc_reg_out (&regs->cr, I2C_RSTA, I2C_RSTA);
- if (do_address (chip, 1)) {
- printf ("i2c_read: failed to address chip\n");
- goto Done;
- }
-
- if (receive_bytes (chip, (char *)buf, len)) {
- printf ("i2c_read: receive_bytes failed\n");
- goto Done;
- }
-
- ret = 0;
- Done:
- mpc_reg_out (&regs->cr, 0, I2C_STA);
- return ret;
-}
-
-int i2c_write (uchar chip, uint addr, int alen, uchar * buf, int len)
-{
- uchar xaddr[4];
- i2c_t *regs = (i2c_t *) MMAP_I2C;
- int ret = -1;
-
- xaddr[0] = (addr >> 24) & 0xFF;
- xaddr[1] = (addr >> 16) & 0xFF;
- xaddr[2] = (addr >> 8) & 0xFF;
- xaddr[3] = addr & 0xFF;
-
- if (wait_for_bb ()) {
- printf ("i2c_write: bus is busy\n");
- goto Done;
- }
-
- mpc_reg_out (&regs->cr, I2C_STA, I2C_STA);
- if (do_address (chip, 0)) {
- printf ("i2c_write: failed to address chip\n");
- goto Done;
- }
-
- if (send_bytes (chip, (char *)&xaddr[4 - alen], alen)) {
- printf ("i2c_write: send_bytes failed\n");
- goto Done;
- }
-
- if (send_bytes (chip, (char *)buf, len)) {
- printf ("i2c_write: send_bytes failed\n");
- goto Done;
- }
-
- ret = 0;
- Done:
- mpc_reg_out (&regs->cr, 0, I2C_STA);
- return ret;
-}
-
-uchar i2c_reg_read (uchar chip, uchar reg)
-{
- uchar buf;
-
- i2c_read (chip, reg, 1, &buf, 1);
-
- return buf;
-}
-
-void i2c_reg_write (uchar chip, uchar reg, uchar val)
-{
- i2c_write (chip, reg, 1, &val, 1);
-
- return;
-}
-
-#endif /* CONFIG_HARD_I2C */
diff --git a/cpu/mpc8220/i2cCore.c b/cpu/mpc8220/i2cCore.c
deleted file mode 100644
index 4e690bc823..0000000000
--- a/cpu/mpc8220/i2cCore.c
+++ /dev/null
@@ -1,618 +0,0 @@
-/* I2cCore.c - MPC8220 PPC I2C Library */
-
-/* Copyright 2004 Freescale Semiconductor, Inc. */
-
-/*
-modification history
---------------------
-01c,29jun04,tcl 1.3 removed CR. Added two bytes offset support.
-01b,19jan04,tcl 1.2 removed i2cMsDelay and sysDecGet. renamed i2cMsDelay
- back to sysMsDelay
-01a,19jan04,tcl 1.1 created and seperated from i2c.c
-*/
-
-/*
-DESCRIPTION
-This file contain I2C low level handling library functions
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <vxWorks.h>
-#include <sysLib.h>
-#include <iosLib.h>
-#include <logLib.h>
-#include <tickLib.h>
-
-/* BSP Includes */
-#include "config.h"
-#include "mpc8220.h"
-#include "i2cCore.h"
-
-#ifdef DEBUG_I2CCORE
-int I2CCDbg = 0;
-#endif
-
-#define ABS(x) ((x < 0)? -x : x)
-
-char *I2CERR[16] = {
- "Transfer in Progress\n", /* 0 */
- "Transfer complete\n",
- "Not Addressed\n", /* 2 */
- "Addressed as a slave\n",
- "Bus is Idle\n", /* 4 */
- "Bus is busy\n",
- "Arbitration Lost\n", /* 6 */
- "Arbitration on Track\n",
- "Slave receive, master writing to slave\n", /* 8 */
- "Slave transmit, master reading from slave\n",
- "Interrupt is pending\n", /* 10 */
- "Interrupt complete\n",
- "Acknowledge received\n", /* 12 */
- "No acknowledge received\n",
- "Unknown status\n", /* 14 */
- "\n"
-};
-
-/******************************************************************************
- *
- * chk_status - Check I2C status bit
- *
- * RETURNS: OK, or ERROR if the bit encounter
- *
- */
-
-STATUS chk_status (PSI2C pi2c, UINT8 sta_bit, UINT8 truefalse)
-{
- int i, status = 0;
-
- for (i = 0; i < I2C_POLL_COUNT; i++) {
- if ((pi2c->sr & sta_bit) == (truefalse ? sta_bit : 0))
- return (OK);
- }
-
- I2CCDBG (L2, ("--- sr %x stabit %x truefalse %d\n",
- pi2c->sr, sta_bit, truefalse, 0, 0, 0));
-
- if (i == I2C_POLL_COUNT) {
- switch (sta_bit) {
- case I2C_STA_CF:
- status = 0;
- break;
- case I2C_STA_AAS:
- status = 2;
- break;
- case I2C_STA_BB:
- status = 4;
- break;
- case I2C_STA_AL:
- status = 6;
- break;
- case I2C_STA_SRW:
- status = 8;
- break;
- case I2C_STA_IF:
- status = 10;
- break;
- case I2C_STA_RXAK:
- status = 12;
- break;
- default:
- status = 14;
- break;
- }
-
- if (!truefalse)
- status++;
-
- I2CCDBG (NO, ("--- status %d\n", status, 0, 0, 0, 0, 0));
- I2CCDBG (NO, (I2CERR[status], 0, 0, 0, 0, 0, 0));
- }
-
- return (ERROR);
-}
-
-/******************************************************************************
- *
- * I2C Enable - Enable the I2C Controller
- *
- */
-STATUS i2c_enable (SI2C * pi2c, PI2CSET pi2cSet)
-{
- int fdr = pi2cSet->bit_rate;
- UINT8 adr = pi2cSet->i2c_adr;
-
- I2CCDBG (L2, ("i2c_enable fdr %d adr %x\n", fdr, adr, 0, 0, 0, 0));
-
- i2c_clear (pi2c); /* Clear FDR, ADR, SR and CR reg */
-
- SetI2cFDR (pi2c, fdr); /* Frequency */
- pi2c->adr = adr;
-
- pi2c->cr = I2C_CTL_EN; /* Set Enable */
-
- /*
- The I2C bus should be in Idle state. If the bus is busy,
- clear the STA bit in control register
- */
- if (chk_status (pi2c, I2C_STA_BB, 0) != OK) {
- if ((pi2c->cr & I2C_CTL_STA) == I2C_CTL_STA)
- pi2c->cr &= ~I2C_CTL_STA;
-
- /* Check again if it is still busy, return error if found */
- if (chk_status (pi2c, I2C_STA_BB, 1) == OK)
- return ERROR;
- }
-
- return (OK);
-}
-
-/******************************************************************************
- *
- * I2C Disable - Disable the I2C Controller
- *
- */
-STATUS i2c_disable (PSI2C pi2c)
-{
- i2c_clear (pi2c);
-
- pi2c->cr &= I2C_CTL_EN; /* Disable I2c */
-
- if ((pi2c->cr & I2C_CTL_STA) == I2C_CTL_STA)
- pi2c->cr &= ~I2C_CTL_STA;
-
- if (chk_status (pi2c, I2C_STA_BB, 0) != OK)
- return ERROR;
-
- return (OK);
-}
-
-/******************************************************************************
- *
- * I2C Clear - Clear the I2C Controller
- *
- */
-STATUS i2c_clear (PSI2C pi2c)
-{
- pi2c->adr = 0;
- pi2c->fdr = 0;
- pi2c->cr = 0;
- pi2c->sr = 0;
-
- return (OK);
-}
-
-
-STATUS i2c_start (PSI2C pi2c, PI2CSET pi2cSet)
-{
-#ifdef TWOBYTES
- UINT16 ByteOffset = pi2cSet->str_adr;
-#else
- UINT8 ByteOffset = pi2cSet->str_adr;
-#endif
- UINT8 tmp = 0;
- UINT8 Addr = pi2cSet->slv_adr;
-
- pi2c->cr |= I2C_CTL_STA; /* Generate start signal */
-
- if (chk_status (pi2c, I2C_STA_BB, 1) != OK)
- return ERROR;
-
- /* Write slave address */
- if (i2c_writebyte (pi2c, &Addr) != OK) {
- i2c_stop (pi2c); /* Disable I2c */
- return ERROR;
- }
-#ifdef TWOBYTES
- tmp = (ByteOffset >> 8) & 0xff;
- if (i2c_writebyte (pi2c, &tmp) != OK) {
- i2c_stop (pi2c); /* Disable I2c */
- return ERROR;
- }
- tmp = ByteOffset & 0xff;
- if (i2c_writebyte (pi2c, &tmp) != OK) {
- i2c_stop (pi2c); /* Disable I2c */
- return ERROR;
- }
-#else
- if (i2c_writebyte (pi2c, &ByteOffset) != OK) {
- i2c_stop (pi2c); /* Disable I2c */
- return ERROR;
- }
-#endif
-
- return (OK);
-}
-
-STATUS i2c_stop (PSI2C pi2c)
-{
- pi2c->cr &= ~I2C_CTL_STA; /* Generate stop signal */
- if (chk_status (pi2c, I2C_STA_BB, 0) != OK)
- return ERROR;
-
- return (OK);
-}
-
-/******************************************************************************
- *
- * Read Len bytes to the location pointed to by *Data from the device
- * with address Addr.
- */
-int i2c_readblock (SI2C * pi2c, PI2CSET pi2cSet, UINT8 * Data)
-{
- int i = 0;
- UINT8 Tmp;
-
-/* UINT8 ByteOffset = pi2cSet->str_adr; not used? */
- UINT8 Addr = pi2cSet->slv_adr;
- int Length = pi2cSet->xfer_size;
-
- I2CCDBG (L1, ("i2c_readblock addr %x data 0x%08x len %d offset %d\n",
- Addr, (int) Data, Length, ByteOffset, 0, 0));
-
- if (pi2c->sr & I2C_STA_AL) { /* Check if Arbitration lost */
- I2CCDBG (FN, ("Arbitration lost\n", 0, 0, 0, 0, 0, 0));
- pi2c->sr &= ~I2C_STA_AL; /* Clear Arbitration status bit */
- return ERROR;
- }
-
- pi2c->cr |= I2C_CTL_TX; /* Enable the I2c for TX, Ack */
-
- if (i2c_start (pi2c, pi2cSet) == ERROR)
- return ERROR;
-
- pi2c->cr |= I2C_CTL_RSTA; /* Repeat Start */
-
- Tmp = Addr | 1;
-
- if (i2c_writebyte (pi2c, &Tmp) != OK) {
- i2c_stop (pi2c); /* Disable I2c */
- return ERROR;
- }
-
- if (((pi2c->sr & 0x07) == 0x07) || (pi2c->sr & 0x01))
- return ERROR;
-
- pi2c->cr &= ~I2C_CTL_TX; /* Set receive mode */
-
- if (((pi2c->sr & 0x07) == 0x07) || (pi2c->sr & 0x01))
- return ERROR;
-
- /* Dummy Read */
- if (i2c_readbyte (pi2c, &Tmp, &i) != OK) {
- i2c_stop (pi2c); /* Disable I2c */
- return ERROR;
- }
-
- i = 0;
- while (Length) {
- if (Length == 2)
- pi2c->cr |= I2C_CTL_TXAK;
-
- if (Length == 1)
- pi2c->cr &= ~I2C_CTL_STA;
-
- if (i2c_readbyte (pi2c, Data, &Length) != OK) {
- return i2c_stop (pi2c);
- }
- i++;
- Length--;
- Data++;
- }
-
- if (i2c_stop (pi2c) == ERROR)
- return ERROR;
-
- return i;
-}
-
-STATUS i2c_writeblock (SI2C * pi2c, PI2CSET pi2cSet, UINT8 * Data)
-{
- int Length = pi2cSet->xfer_size;
-
-#ifdef TWOBYTES
- UINT16 ByteOffset = pi2cSet->str_adr;
-#else
- UINT8 ByteOffset = pi2cSet->str_adr;
-#endif
- int j, k;
-
- I2CCDBG (L2, ("i2c_writeblock\n", 0, 0, 0, 0, 0, 0));
-
- if (pi2c->sr & I2C_STA_AL) {
- /* Check if arbitration lost */
- I2CCDBG (L2, ("Arbitration lost\n", 0, 0, 0, 0, 0, 0));
- pi2c->sr &= ~I2C_STA_AL; /* Clear the condition */
- return ERROR;
- }
-
- pi2c->cr |= I2C_CTL_TX; /* Enable the I2c for TX, Ack */
-
- /* Do the not even offset first */
- if ((ByteOffset % 8) != 0) {
- int remain;
-
- if (Length > 8) {
- remain = 8 - (ByteOffset % 8);
- Length -= remain;
-
- pi2cSet->str_adr = ByteOffset;
-
- if (i2c_start (pi2c, pi2cSet) == ERROR)
- return ERROR;
-
- for (j = ByteOffset; j < remain; j++) {
- if (i2c_writebyte (pi2c, Data++) != OK)
- return ERROR;
- }
-
- if (i2c_stop (pi2c) == ERROR)
- return ERROR;
-
- sysMsDelay (32);
-
- /* Update the new ByteOffset */
- ByteOffset += remain;
- }
- }
-
- for (j = ByteOffset, k = 0; j < (Length + ByteOffset); j++) {
- if ((j % 8) == 0) {
- pi2cSet->str_adr = j;
- if (i2c_start (pi2c, pi2cSet) == ERROR)
- return ERROR;
- }
-
- k++;
-
- if (i2c_writebyte (pi2c, Data++) != OK)
- return ERROR;
-
- if ((j == (Length - 1)) || ((k % 8) == 0)) {
- if (i2c_stop (pi2c) == ERROR)
- return ERROR;
-
- sysMsDelay (50);
- }
-
- }
-
- return k;
-}
-
-STATUS i2c_readbyte (SI2C * pi2c, UINT8 * readb, int *index)
-{
- pi2c->sr &= ~I2C_STA_IF; /* Clear Interrupt Bit */
- *readb = pi2c->dr; /* Read a byte */
-
- /*
- Set I2C_CTRL_TXAK will cause Transfer pending and
- set I2C_CTRL_STA will cause Interrupt pending
- */
- if (*index != 2) {
- if (chk_status (pi2c, I2C_STA_CF, 1) != OK) /* Transfer not complete? */
- return ERROR;
- }
-
- if (*index != 1) {
- if (chk_status (pi2c, I2C_STA_IF, 1) != OK)
- return ERROR;
- }
-
- return (OK);
-}
-
-
-STATUS i2c_writebyte (SI2C * pi2c, UINT8 * writeb)
-{
- pi2c->sr &= ~I2C_STA_IF; /* Clear Interrupt */
- pi2c->dr = *writeb; /* Write a byte */
-
- if (chk_status (pi2c, I2C_STA_CF, 1) != OK) /* Transfer not complete? */
- return ERROR;
-
- if (chk_status (pi2c, I2C_STA_IF, 1) != OK)
- return ERROR;
-
- return OK;
-}
-
-STATUS i2c_write2byte (SI2C * pi2c, UINT16 * writeb)
-{
- UINT8 data;
-
- data = (UINT8) ((*writeb >> 8) & 0xff);
- if (i2c_writebyte (pi2c, &data) != OK)
- return ERROR;
- data = (UINT8) (*writeb & 0xff);
- if (i2c_writebyte (pi2c, &data) != OK)
- return ERROR;
- return OK;
-}
-
-/* FDR table base on 33Mhz - more detail please refer to Odini2c_dividers.xls
-FDR FDR scl sda scl2tap2
-510 432 tap tap tap tap scl_per sda_hold I2C Freq 0 1 2 3 4 5
-000 000 9 3 4 1 28 Clocks 9 Clocks 1190 KHz 0 0 0 0 0 0
-000 001 9 3 4 2 44 Clocks 11 Clocks 758 KHz 0 0 1 0 0 0
-000 010 9 3 6 4 80 Clocks 17 Clocks 417 KHz 0 0 0 1 0 0
-000 011 9 3 6 8 144 Clocks 25 Clocks 231 KHz 0 0 1 1 0 0
-000 100 9 3 14 16 288 Clocks 49 Clocks 116 KHz 0 0 0 0 1 0
-000 101 9 3 30 32 576 Clocks 97 Clocks 58 KHz 0 0 1 0 1 0
-000 110 9 3 62 64 1152 Clocks 193 Clocks 29 KHz 0 0 0 1 1 0
-000 111 9 3 126 128 2304 Clocks 385 Clocks 14 KHz 0 0 1 1 1 0
-001 000 10 3 4 1 30 Clocks 9 Clocks 1111 KHz1 0 0 0 0 0
-001 001 10 3 4 2 48 Clocks 11 Clocks 694 KHz 1 0 1 0 0 0
-001 010 10 3 6 4 88 Clocks 17 Clocks 379 KHz 1 0 0 1 0 0
-001 011 10 3 6 8 160 Clocks 25 Clocks 208 KHz 1 0 1 1 0 0
-001 100 10 3 14 16 320 Clocks 49 Clocks 104 KHz 1 0 0 0 1 0
-001 101 10 3 30 32 640 Clocks 97 Clocks 52 KHz 1 0 1 0 1 0
-001 110 10 3 62 64 1280 Clocks 193 Clocks 26 KHz 1 0 0 1 1 0
-001 111 10 3 126 128 2560 Clocks 385 Clocks 13 KHz 1 0 1 1 1 0
-010 000 12 4 4 1 34 Clocks 10 Clocks 980 KHz 0 1 0 0 0 0
-010 001 12 4 4 2 56 Clocks 13 Clocks 595 KHz 0 1 1 0 0 0
-010 010 12 4 6 4 104 Clocks 21 Clocks 321 KHz 0 1 0 1 0 0
-010 011 12 4 6 8 192 Clocks 33 Clocks 174 KHz 0 1 1 1 0 0
-010 100 12 4 14 16 384 Clocks 65 Clocks 87 KHz 0 1 0 0 1 0
-010 101 12 4 30 32 768 Clocks 129 Clocks 43 KHz 0 1 1 0 1 0
-010 110 12 4 62 64 1536 Clocks 257 Clocks 22 KHz 0 1 0 1 1 0
-010 111 12 4 126 128 3072 Clocks 513 Clocks 11 KHz 0 1 1 1 1 0
-011 000 15 4 4 1 40 Clocks 10 Clocks 833 KHz 1 1 0 0 0 0
-011 001 15 4 4 2 68 Clocks 13 Clocks 490 KHz 1 1 1 0 0 0
-011 010 15 4 6 4 128 Clocks 21 Clocks 260 KHz 1 1 0 1 0 0
-011 011 15 4 6 8 240 Clocks 33 Clocks 139 KHz 1 1 1 1 0 0
-011 100 15 4 14 16 480 Clocks 65 Clocks 69 KHz 1 1 0 0 1 0
-011 101 15 4 30 32 960 Clocks 129 Clocks 35 KHz 1 1 1 0 1 0
-011 110 15 4 62 64 1920 Clocks 257 Clocks 17 KHz 1 1 0 1 1 0
-011 111 15 4 126 128 3840 Clocks 513 Clocks 9 KHz 1 1 1 1 1 0
-100 000 5 1 4 1 20 Clocks 7 Clocks 1667 KHz 0 0 0 0 0 1
-100 001 5 1 4 2 28 Clocks 7 Clocks 1190 KHz 0 0 1 0 0 1
-100 010 5 1 6 4 48 Clocks 9 Clocks 694 KHz 0 0 0 1 0 1
-100 011 5 1 6 8 80 Clocks 9 Clocks 417 KHz 0 0 1 1 0 1
-100 100 5 1 14 16 160 Clocks 17 Clocks 208 KHz 0 0 0 0 1 1
-100 101 5 1 30 32 320 Clocks 33 Clocks 104 KHz 0 0 1 0 1 1
-100 110 5 1 62 64 640 Clocks 65 Clocks 52 KHz 0 0 0 1 1 1
-100 111 5 1 126 128 1280 Clocks 129 Clocks 26 KHz 0 0 1 1 1 1
-101 000 6 1 4 1 22 Clocks 7 Clocks 1515 KHz 1 0 0 0 0 1
-101 001 6 1 4 2 32 Clocks 7 Clocks 1042 KHz 1 0 1 0 0 1
-101 010 6 1 6 4 56 Clocks 9 Clocks 595 KHz 1 0 0 1 0 1
-101 011 6 1 6 8 96 Clocks 9 Clocks 347 KHz 1 0 1 1 0 1
-101 100 6 1 14 16 192 Clocks 17 Clocks 174 KHz 1 0 0 0 1 1
-101 101 6 1 30 32 384 Clocks 33 Clocks 87 KHz 1 0 1 0 1 1
-101 110 6 1 62 64 768 Clocks 65 Clocks 43 KHz 1 0 0 1 1 1
-101 111 6 1 126 128 1536 Clocks 129 Clocks 22 KHz 1 0 1 1 1 1
-110 000 7 2 4 1 24 Clocks 8 Clocks 1389 KHz 0 1 0 0 0 1
-110 001 7 2 4 2 36 Clocks 9 Clocks 926 KHz 0 1 1 0 0 1
-110 010 7 2 6 4 64 Clocks 13 Clocks 521 KHz 0 1 0 1 0 1
-110 011 7 2 6 8 112 Clocks 17 Clocks 298 KHz 0 1 1 1 0 1
-110 100 7 2 14 16 224 Clocks 33 Clocks 149 KHz 0 1 0 0 1 1
-110 101 7 2 30 32 448 Clocks 65 Clocks 74 KHz 0 1 1 0 1 1
-110 110 7 2 62 64 896 Clocks 129 Clocks 37 KHz 0 1 0 1 1 1
-110 111 7 2 126 128 1792 Clocks 257 Clocks 19 KHz 0 1 1 1 1 1
-111 000 8 2 4 1 26 Clocks 8 Clocks 1282 KHz 1 1 0 0 0 1
-111 001 8 2 4 2 40 Clocks 9 Clocks 833 KHz 1 1 1 0 0 1
-111 010 8 2 6 4 72 Clocks 13 Clocks 463 KHz 1 1 0 1 0 1
-111 011 8 2 6 8 128 Clocks 17 Clocks 260 KHz 1 1 1 1 0 1
-111 100 8 2 14 16 256 Clocks 33 Clocks 130 KHz 1 1 0 0 1 1
-111 101 8 2 30 32 512 Clocks 65 Clocks 65 KHz 1 1 1 0 1 1
-111 110 8 2 62 64 1024 Clocks 129 Clocks 33 KHz 1 1 0 1 1 1
-111 111 8 2 126 128 2048 Clocks 257 Clocks 16 KHz 1 1 1 1 1 1
-*/
-STATUS SetI2cFDR (PSI2C pi2cRegs, int bitrate)
-{
-/* Constants */
- const UINT8 div_hold[8][3] = { {9, 3}, {10, 3},
- {12, 4}, {15, 4},
- {5, 1}, {6, 1},
- {7, 2}, {8, 2}
- };
-
- const UINT8 scl_tap[8][2] = { {4, 1}, {4, 2},
- {6, 4}, {6, 8},
- {14, 16}, {30, 32},
- {62, 64}, {126, 128}
- };
-
- UINT8 mfdr_bits;
-
- int i = 0;
- int j = 0;
-
- int Diff, min;
- int WhichFreq, iRec, jRec;
- int SCL_Period;
- int SCL_Hold;
- int I2C_Freq;
-
- I2CCDBG (L2, ("Entering getBitRate: bitrate %d pi2cRegs 0x%08x\n",
- bitrate, (int) pi2cRegs, 0, 0, 0, 0));
-
- if (bitrate < 0) {
- I2CCDBG (NO, ("Invalid bitrate\n", 0, 0, 0, 0, 0, 0));
- return ERROR;
- }
-
- /* Initialize */
- mfdr_bits = 0;
- min = 0x7fffffff;
- WhichFreq = iRec = jRec = 0;
-
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- /* SCL Period = 2 * (scl2tap + [(SCL_Tap - 1) * tap2tap] + 2)
- * SCL Hold = scl2tap + ((SDA_Tap - 1) * tap2tap) + 3
- * Bit Rate (I2C Freq) = System Freq / SCL Period
- */
- SCL_Period =
- 2 * (scl_tap[i][0] +
- ((div_hold[j][0] - 1) * scl_tap[i][1]) +
- 2);
-
- /* Now get the I2C Freq */
- I2C_Freq = DEV_CLOCK_FREQ / SCL_Period;
-
- /* Take equal or slower */
- if (I2C_Freq > bitrate)
- continue;
-
- /* Take the differences */
- Diff = I2C_Freq - bitrate;
-
- Diff = ABS (Diff);
-
- /* Find the closer value */
- if (Diff < min) {
- min = Diff;
- WhichFreq = I2C_Freq;
- iRec = i;
- jRec = j;
- }
-
- I2CCDBG (L2,
- ("--- (%d,%d) I2C_Freq %d minDiff %d min %d\n",
- i, j, I2C_Freq, Diff, min, 0));
- }
- }
-
- SCL_Period =
- 2 * (scl_tap[iRec][0] +
- ((div_hold[jRec][0] - 1) * scl_tap[iRec][1]) + 2);
-
- I2CCDBG (L2, ("\nmin %d WhichFreq %d iRec %d jRec %d\n",
- min, WhichFreq, iRec, jRec, 0, 0));
- I2CCDBG (L2, ("--- scl2tap %d SCL_Tap %d tap2tap %d\n",
- scl_tap[iRec][0], div_hold[jRec][0], scl_tap[iRec][1],
- 0, 0, 0));
-
- /* This may no require */
- SCL_Hold =
- scl_tap[iRec][0] +
- ((div_hold[jRec][1] - 1) * scl_tap[iRec][1]) + 3;
- I2CCDBG (L2,
- ("--- SCL_Period %d SCL_Hold %d\n", SCL_Period, SCL_Hold, 0,
- 0, 0, 0));
-
- I2CCDBG (L2, ("--- mfdr_bits %x\n", mfdr_bits, 0, 0, 0, 0, 0));
-
- /* FDR 4,3,2 */
- if ((iRec & 1) == 1)
- mfdr_bits |= 0x04; /* FDR 2 */
- if ((iRec & 2) == 2)
- mfdr_bits |= 0x08; /* FDR 3 */
- if ((iRec & 4) == 4)
- mfdr_bits |= 0x10; /* FDR 4 */
- /* FDR 5,1,0 */
- if ((jRec & 1) == 1)
- mfdr_bits |= 0x01; /* FDR 0 */
- if ((jRec & 2) == 2)
- mfdr_bits |= 0x02; /* FDR 1 */
- if ((jRec & 4) == 4)
- mfdr_bits |= 0x20; /* FDR 5 */
-
- I2CCDBG (L2, ("--- mfdr_bits %x\n", mfdr_bits, 0, 0, 0, 0, 0));
-
- pi2cRegs->fdr = mfdr_bits;
-
- return OK;
-}
diff --git a/cpu/mpc8220/i2cCore.h b/cpu/mpc8220/i2cCore.h
deleted file mode 100644
index 72783fd48b..0000000000
--- a/cpu/mpc8220/i2cCore.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * i2cCore.h
- *
- * Prototypes, etc. for the Motorola MPC8220
- * embedded cpu chips
- *
- * 2004 (c) Freescale, Inc.
- * Author: TsiChung Liew <Tsi-Chung.Liew@freescale.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#ifndef __INCi2ccoreh
-#define __INCi2ccoreh
-#ifndef __ASSEMBLY__
-/* device types */
-#define I2C_DEVICE_TYPE_EEPROM 0
-#define I2C_EEPROM_ADRS 0xa0
-#define I2C_CTRL_ADRS I2C_EEPROM_ADRS
-#define EEPROM_ADDR0 0xA2 /* on Dimm SPD eeprom */
-#define EEPROM_ADDR1 0xA4 /* on Board SPD eeprom */
-#define EEPROM_ADDR2 0xD2 /* non-standard eeprom - clock generator */
-/* Control Register */
-#define I2C_CTL_EN 0x80 /* I2C Enable */
-#define I2C_CTL_IEN 0x40 /* I2C Interrupt Enable */
-#define I2C_CTL_STA 0x20 /* Master/Slave Mode select */
-#define I2C_CTL_TX 0x10 /* Transmit/Receive Mode Select */
-#define I2C_CTL_TXAK 0x08 /* Transmit Acknowledge Enable */
-#define I2C_CTL_RSTA 0x04 /* Repeat Start */
-/* Status Register */
-#define I2C_STA_CF 0x80 /* Data Transfer */
-#define I2C_STA_AAS 0x40 /* Adressed As Slave */
-#define I2C_STA_BB 0x20 /* Bus Busy */
-#define I2C_STA_AL 0x10 /* Arbitration Lost */
-#define I2C_STA_SRW 0x04 /* Slave Read/Write */
-#define I2C_STA_IF 0x02 /* I2C Interrupt */
-#define I2C_STA_RXAK 0x01 /* Receive Acknowledge */
-/* Interrupt Contol Register */
-#define I2C_INT_BNBE2 0x80 /* Bus Not Busy Enable 2 */
-#define I2C_INT_TE2 0x40 /* Transmit Enable 2 */
-#define I2C_INT_RE2 0x20 /* Receive Enable 2 */
-#define I2C_INT_IE2 0x10 /* Interrupt Enable 2 */
-#define I2C_INT_BNBE1 0x08 /* Bus Not Busy Enable 1 */
-#define I2C_INT_TE1 0x04 /* Transmit Enable 1 */
-#define I2C_INT_RE1 0x02 /* Receive Enable 1 */
-#define I2C_INT_IE1 0x01 /* Interrupt Enable 1 */
-#define I2C_POLL_COUNT 0x100000
-#define I2C_ENABLE 0x00000001
-#define I2C_DISABLE 0x00000002
-#define I2C_START 0x00000004
-#define I2C_REPSTART 0x00000008
-#define I2C_STOP 0x00000010
-#define I2C_BITRATE 0x00000020
-#define I2C_SLAVEADR 0x00000040
-#define I2C_STARTADR 0x00000080
-#undef TWOBYTES
-typedef struct i2c_settings {
- /* Device settings */
- int bit_rate; /* Device bit rate */
- u8 i2c_adr; /* I2C address */
- u8 slv_adr; /* Slave address */
-#ifdef TWOBYTES
- u16 str_adr; /* Start address */
-#else
- u8 str_adr; /* Start address */
-#endif
- int xfer_size; /* Transfer Size */
-
- int bI2c_en; /* Enable or Disable */
- int cmdFlag; /* I2c Command Flags */
-} i2cset_t;
-
-/*
-int check_status(PSI2C pi2c, u8 sta_bit, u8 truefalse);
-int i2c_enable(PSI2C pi2c, PI2CSET pi2cSet);
-int i2c_disable(PSI2C pi2c);
-int i2c_start(PSI2C pi2c, PI2CSET pi2cSet);
-int i2c_stop(PSI2C pi2c);
-int i2c_clear(PSI2C pi2c);
-int i2c_readblock (PSI2C pi2c, PI2CSET pi2cSet, u8 *Data);
-int i2c_writeblock (PSI2C pi2c, PI2CSET pi2cSet, u8 *Data);
-int i2c_readbyte(PSI2C pi2c, u8 *readb, int *index);
-int i2c_writebyte(PSI2C pi2c, u8 *writeb);
-int SetI2cFDR( PSI2C pi2cRegs, int bitrate );
-*/
-#endif /* __ASSEMBLY__ */
-
-#endif /* __INCi2ccoreh */
diff --git a/cpu/mpc8220/interrupts.c b/cpu/mpc8220/interrupts.c
deleted file mode 100644
index 036378c8bb..0000000000
--- a/cpu/mpc8220/interrupts.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * (C) Copyright -2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2001
- * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * interrupts.c - just enough support for the decrementer/timer
- */
-
-#include <common.h>
-#include <asm/processor.h>
-#include <command.h>
-
-int interrupt_init_cpu (ulong * decrementer_count)
-{
- *decrementer_count = get_tbclk () / CFG_HZ;
-
- return (0);
-}
-
-/****************************************************************************/
-
-/*
- * Handle external interrupts
- */
-void external_interrupt (struct pt_regs *regs)
-{
- puts ("external_interrupt (oops!)\n");
-}
-
-void timer_interrupt_cpu (struct pt_regs *regs)
-{
- /* nothing to do here */
- return;
-}
-
-/****************************************************************************/
-
-/*
- * Install and free a interrupt handler.
- */
-
-void irq_install_handler (int vec, interrupt_handler_t * handler, void *arg)
-{
-
-}
-
-void irq_free_handler (int vec)
-{
-
-}
-
-/****************************************************************************/
-
-void
-do_irqinfo (cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char *argv[])
-{
- puts ("IRQ related functions are unimplemented currently.\n");
-}
diff --git a/cpu/mpc8220/io.S b/cpu/mpc8220/io.S
deleted file mode 100644
index 5ecdf550a1..0000000000
--- a/cpu/mpc8220/io.S
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Andreas Heppel <aheppel@sysgo.de>
- * Copyright (C) 2003 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <ppc_asm.tmpl>
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in8 */
-/* Description: Input 8 bits */
-/* ------------------------------------------------------------------------------- */
- .globl in8
-in8:
- lbz r3,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in16 */
-/* Description: Input 16 bits */
-/* ------------------------------------------------------------------------------- */
- .globl in16
-in16:
- lhz r3,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in16r */
-/* Description: Input 16 bits and byte reverse */
-/* ------------------------------------------------------------------------------- */
- .globl in16r
-in16r:
- lhbrx r3,0,r3
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in32 */
-/* Description: Input 32 bits */
-/* ------------------------------------------------------------------------------- */
- .globl in32
-in32:
- lwz 3,0(3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: in32r */
-/* Description: Input 32 bits and byte reverse */
-/* ------------------------------------------------------------------------------- */
- .globl in32r
-in32r:
- lwbrx r3,0,r3
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out8 */
-/* Description: Output 8 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out8
-out8:
- stb r4,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out16 */
-/* Description: Output 16 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out16
-out16:
- sth r4,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out16r */
-/* Description: Byte reverse and output 16 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out16r
-out16r:
- sthbrx r4,0,r3
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out32 */
-/* Description: Output 32 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out32
-out32:
- stw r4,0(r3)
- sync
- blr
-
-/* ------------------------------------------------------------------------------- */
-/* Function: out32r */
-/* Description: Byte reverse and output 32 bits */
-/* ------------------------------------------------------------------------------- */
- .globl out32r
-out32r:
- stwbrx r4,0,r3
- sync
- blr
diff --git a/cpu/mpc8220/loadtask.c b/cpu/mpc8220/loadtask.c
deleted file mode 100644
index 6d8b627e8c..0000000000
--- a/cpu/mpc8220/loadtask.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * This file is based on code
- * (C) Copyright Motorola, Inc., 2000
- */
-
-#include <common.h>
-#include <mpc8220.h>
-
-/* Multichannel DMA microcode */
-extern int taskTable;
-
-void loadtask (int basetask, int tasks)
-{
- int *sram = (int *) (MMAP_SRAM + 512);
- int *task_org = &taskTable;
- unsigned int start, offset, end;
- int i;
-
-#ifdef DEBUG
- printf ("basetask = %d, tasks = %d\n", basetask, tasks);
- printf ("task_org = 0x%08x\n", (unsigned int) task_org);
-#endif
-
- /* setup TaskBAR register */
- *(vu_long *) MMAP_DMA = (MMAP_SRAM + 512);
-
- /* relocate task table entries */
- offset = (unsigned int) sram;
- for (i = basetask; i < basetask + tasks; i++) {
- sram[i * 8 + 0] = task_org[i * 8 + 0] + offset;
- sram[i * 8 + 1] = task_org[i * 8 + 1] + offset;
- sram[i * 8 + 2] = task_org[i * 8 + 2] + offset;
- sram[i * 8 + 3] = task_org[i * 8 + 3] + offset;
- sram[i * 8 + 4] = task_org[i * 8 + 4];
- sram[i * 8 + 5] = task_org[i * 8 + 5];
- sram[i * 8 + 6] = task_org[i * 8 + 6] + offset;
- sram[i * 8 + 7] = task_org[i * 8 + 7];
- }
-
- /* relocate task descriptors */
- start = (sram[basetask * 8] - (unsigned int) sram);
- end = (sram[(basetask + tasks - 1) * 8 + 1] - (unsigned int) sram);
-
-#ifdef DEBUG
- printf ("TDT start = 0x%08x, end = 0x%08x\n", start, end);
-#endif
-
- start /= 4;
- end /= 4;
- for (i = start; i <= end; i++) {
- sram[i] = task_org[i];
- }
-
- /* relocate variables */
- start = (sram[basetask * 8 + 2] - (unsigned int) sram);
- end = (sram[(basetask + tasks - 1) * 8 + 2] + 256 -
- (unsigned int) sram);
- start /= 4;
- end /= 4;
- for (i = start; i < end; i++) {
- sram[i] = task_org[i];
- }
-
- /* relocate function decriptors */
- start = ((sram[basetask * 8 + 3] & 0xfffffffc) - (unsigned int) sram);
- end = ((sram[(basetask + tasks - 1) * 8 + 3] & 0xfffffffc) + 256 -
- (unsigned int) sram);
- start /= 4;
- end /= 4;
- for (i = start; i < end; i++) {
- sram[i] = task_org[i];
- }
-
- asm volatile ("sync");
-}
diff --git a/cpu/mpc8220/pci.c b/cpu/mpc8220/pci.c
deleted file mode 100644
index 4ef214e540..0000000000
--- a/cpu/mpc8220/pci.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright 2004 Freescale Semiconductor.
- * Copyright (C) 2003 Motorola Inc.
- * Xianghua Xiao (x.xiao@motorola.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * PCI Configuration space access support for MPC8220 PCI Bridge
- */
-#include <common.h>
-#include <mpc8220.h>
-#include <pci.h>
-#include <asm/io.h>
-
-#if defined(CONFIG_PCI)
-
-/* System RAM mapped over PCI */
-#define CONFIG_PCI_SYS_MEM_BUS CFG_SDRAM_BASE
-#define CONFIG_PCI_SYS_MEM_PHYS CFG_SDRAM_BASE
-#define CONFIG_PCI_SYS_MEM_SIZE (1024 * 1024 * 1024)
-
-#define cfg_read(val, addr, type, op) *val = op((type)(addr));
-#define cfg_write(val, addr, type, op) op((type *)(addr), (val));
-
-#define PCI_OP(rw, size, type, op, mask) \
-int mpc8220_pci_##rw##_config_##size(struct pci_controller *hose, \
- pci_dev_t dev, int offset, type val) \
-{ \
- u32 addr = 0; \
- u16 cfg_type = 0; \
- addr = ((offset & 0xfc) | cfg_type | (dev) | 0x80000000); \
- out_be32(hose->cfg_addr, addr); \
- __asm__ __volatile__("sync"); \
- cfg_##rw(val, hose->cfg_data + (offset & mask), type, op); \
- out_be32(hose->cfg_addr, addr & 0x7fffffff); \
- __asm__ __volatile__("sync"); \
- return 0; \
-}
-
-PCI_OP(read, byte, u8 *, in_8, 3)
-PCI_OP(read, word, u16 *, in_le16, 2)
-PCI_OP(write, byte, u8, out_8, 3)
-PCI_OP(write, word, u16, out_le16, 2)
-PCI_OP(write, dword, u32, out_le32, 0)
-
-int mpc8220_pci_read_config_dword(struct pci_controller *hose, pci_dev_t dev,
- int offset, u32 *val)
-{
- u32 addr;
- u32 tmpv;
- u32 mask = 2; /* word access */
- /* Read lower 16 bits */
- addr = ((offset & 0xfc) | (dev) | 0x80000000);
- out_be32(hose->cfg_addr, addr);
- __asm__ __volatile__("sync");
- *val = (u32) in_le16((u16 *) (hose->cfg_data + (offset & mask)));
- out_be32(hose->cfg_addr, addr & 0x7fffffff);
- __asm__ __volatile__("sync");
-
- /* Read upper 16 bits */
- offset += 2;
- addr = ((offset & 0xfc) | 1 | (dev) | 0x80000000);
- out_be32(hose->cfg_addr, addr);
- __asm__ __volatile__("sync");
- tmpv = (u32) in_le16((u16 *) (hose->cfg_data + (offset & mask)));
- out_be32(hose->cfg_addr, addr & 0x7fffffff);
- __asm__ __volatile__("sync");
-
- /* combine results into dword value */
- *val = (tmpv << 16) | *val;
-
- return 0;
-}
-
-void
-pci_mpc8220_init(struct pci_controller *hose)
-{
- u32 win0, win1, win2;
- volatile mpc8220_xcpci_t *xcpci =
- (volatile mpc8220_xcpci_t *) MMAP_XCPCI;
-
- volatile pcfg8220_t *portcfg = (volatile pcfg8220_t *) MMAP_PCFG;
-
- win0 = (u32) CONFIG_PCI_MEM_PHYS;
- win1 = (u32) CONFIG_PCI_IO_PHYS;
- win2 = (u32) CONFIG_PCI_CFG_PHYS;
-
- /* Assert PCI reset */
- out_be32 (&xcpci->glb_stat_ctl, PCI_GLB_STAT_CTRL_PR);
-
- /* Disable prefetching but read-multiples will still prefetch */
- out_be32 (&xcpci->target_ctrl, 0x00000000);
-
- /* Initiator windows */
- out_be32 (&xcpci->init_win0, (win0 >> 16) | win0 | 0x003f0000);
- out_be32 (&xcpci->init_win1, ((win1 >> 16) | win1 ));
- out_be32 (&xcpci->init_win2, ((win2 >> 16) | win2 ));
-
- out_be32 (&xcpci->init_win_cfg,
- PCI_INIT_WIN_CFG_WIN0_CTRL_EN |
- PCI_INIT_WIN_CFG_WIN1_CTRL_EN | PCI_INIT_WIN_CFG_WIN1_CTRL_IO |
- PCI_INIT_WIN_CFG_WIN2_CTRL_EN | PCI_INIT_WIN_CFG_WIN2_CTRL_IO);
-
- out_be32 (&xcpci->init_ctrl, 0x00000000);
-
- /* Enable bus master and mem access */
- out_be32 (&xcpci->stat_cmd_reg, PCI_STAT_CMD_B | PCI_STAT_CMD_M);
-
- /* Cache line size and master latency */
- out_be32 (&xcpci->bist_htyp_lat_cshl, (0xf8 << PCI_CFG1_LT_SHIFT));
-
- out_be32 (&xcpci->base0, PCI_BASE_ADDR_REG0); /* 256MB - MBAR space */
- out_be32 (&xcpci->base1, PCI_BASE_ADDR_REG1); /* 1GB - SDRAM space */
-
- out_be32 (&xcpci->target_bar0,
- PCI_TARGET_BASE_ADDR_REG0 | PCI_TARGET_BASE_ADDR_EN);
- out_be32 (&xcpci->target_bar1,
- PCI_TARGET_BASE_ADDR_REG1 | PCI_TARGET_BASE_ADDR_EN);
-
- /* Deassert reset bit */
- out_be32 (&xcpci->glb_stat_ctl, 0x00000000);
-
- /* Enable PCI bus master support */
- /* Set PCIGNT1, PCIREQ1, PCIREQ0/PCIGNTIN, PCIGNT0/PCIREQOUT,
- PCIREQ2, PCIGNT2 */
- out_be32((volatile u32 *)&portcfg->pcfg3,
- (in_be32((volatile u32 *)&portcfg->pcfg3) & 0xFC3FCE7F));
- out_be32((volatile u32 *)&portcfg->pcfg3,
- (in_be32((volatile u32 *)&portcfg->pcfg3) | 0x01400180));
-
- hose->first_busno = 0;
- hose->last_busno = 0xff;
-
- pci_set_region(hose->regions + 0,
- CONFIG_PCI_MEM_BUS,
- CONFIG_PCI_MEM_PHYS,
- CONFIG_PCI_MEM_SIZE,
- PCI_REGION_MEM);
-
- pci_set_region(hose->regions + 1,
- CONFIG_PCI_IO_BUS,
- CONFIG_PCI_IO_PHYS,
- CONFIG_PCI_IO_SIZE,
- PCI_REGION_IO);
-
- pci_set_region(hose->regions + 2,
- CONFIG_PCI_SYS_MEM_BUS,
- CONFIG_PCI_SYS_MEM_PHYS,
- CONFIG_PCI_SYS_MEM_SIZE,
- PCI_REGION_MEM | PCI_REGION_MEMORY);
-
- hose->region_count = 3;
-
- hose->cfg_addr = &(xcpci->cfg_adr);
- hose->cfg_data = (volatile unsigned char *)CONFIG_PCI_CFG_BUS;
-
- pci_set_ops(hose,
- mpc8220_pci_read_config_byte,
- mpc8220_pci_read_config_word,
- mpc8220_pci_read_config_dword,
- mpc8220_pci_write_config_byte,
- mpc8220_pci_write_config_word,
- mpc8220_pci_write_config_dword);
-
- /* Hose scan */
- pci_register_hose(hose);
- hose->last_busno = pci_hose_scan(hose);
-
- out_be32 (&xcpci->base0, PCI_BASE_ADDR_REG0); /* 256MB - MBAR space */
- out_be32 (&xcpci->base1, PCI_BASE_ADDR_REG1); /* 1GB - SDRAM space */
-}
-
-#endif /* CONFIG_PCI */
diff --git a/cpu/mpc8220/speed.c b/cpu/mpc8220/speed.c
deleted file mode 100644
index 200a762711..0000000000
--- a/cpu/mpc8220/speed.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * (C) Copyright 2004, Freescale, Inc
- * TsiChung Liew, Tsi-Chung.Liew@freescale.com.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc8220.h>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-typedef struct pllmultiplier {
- u8 hid1;
- int multi;
- int vco_div;
-} pllcfg_t;
-
-/* ------------------------------------------------------------------------- */
-
-/*
- *
- */
-
-int get_clocks (void)
-{
- pllcfg_t bus2core[] = {
- {0x02, 2, 8}, /* 1 */
- {0x01, 2, 4},
- {0x0C, 3, 8}, /* 1.5 */
- {0x00, 3, 4},
- {0x18, 3, 2},
- {0x05, 4, 4}, /* 2 */
- {0x04, 4, 2},
- {0x11, 5, 4}, /* 2.5 */
- {0x06, 5, 2},
- {0x10, 6, 4}, /* 3 */
- {0x08, 6, 2},
- {0x0E, 7, 2}, /* 3.5 */
- {0x0A, 8, 2}, /* 4 */
- {0x07, 9, 2}, /* 4.5 */
- {0x0B, 10, 2}, /* 5 */
- {0x09, 11, 2}, /* 5.5 */
- {0x0D, 12, 2}, /* 6 */
- {0x12, 13, 2}, /* 6.5 */
- {0x14, 14, 2}, /* 7 */
- {0x16, 15, 2}, /* 7.5 */
- {0x1C, 16, 2} /* 8 */
- };
- u32 hid1;
- int i, size, pci2bus;
-
-#if !defined(CFG_MPC8220_CLKIN)
-#error clock measuring not implemented yet - define CFG_MPC8220_CLKIN
-#endif
-
- gd->inp_clk = CFG_MPC8220_CLKIN;
-
- /* Read XLB to PCI(INP) clock multiplier */
- pci2bus = (*((volatile u32 *)PCI_REG_PCIGSCR) &
- PCI_REG_PCIGSCR_PCI2XLB_CLK_MASK)>>PCI_REG_PCIGSCR_PCI2XLB_CLK_BIT;
-
- /* XLB bus clock */
- gd->bus_clk = CFG_MPC8220_CLKIN * pci2bus;
-
- /* PCI clock is same as input clock */
- gd->pci_clk = CFG_MPC8220_CLKIN;
-
- /* FlexBus is temporary set as the same as input clock */
- /* will do dynamic in the future */
- gd->flb_clk = CFG_MPC8220_CLKIN;
-
- /* CPU Clock - Read HID1 */
- asm volatile ("mfspr %0, 1009":"=r" (hid1):);
-
- size = sizeof (bus2core) / sizeof (pllcfg_t);
-
- hid1 >>= 27;
-
- for (i = 0; i < size; i++)
- if (hid1 == bus2core[i].hid1) {
- gd->cpu_clk = (bus2core[i].multi * gd->bus_clk) >> 1;
- gd->vco_clk = CFG_MPC8220_SYSPLL_VCO_MULTIPLIER * (gd->pci_clk * bus2core[i].vco_div)/2;
- break;
- }
-
- /* hardcoded 81MHz for now */
- gd->pev_clk = 81000000;
-
- return (0);
-}
-
-int prt_mpc8220_clks (void)
-{
- printf (" Bus %ld MHz, CPU %ld MHz, PCI %ld MHz, VCO %ld MHz\n",
- gd->bus_clk / 1000000, gd->cpu_clk / 1000000,
- gd->pci_clk / 1000000, gd->vco_clk / 1000000);
-
- return (0);
-}
-
-/* ------------------------------------------------------------------------- */
diff --git a/cpu/mpc8220/start.S b/cpu/mpc8220/start.S
deleted file mode 100644
index 966b32ef10..0000000000
--- a/cpu/mpc8220/start.S
+++ /dev/null
@@ -1,773 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2000 - 2003 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * U-Boot - Startup Code for MPC8220 CPUs
- */
-#include <config.h>
-#include <mpc8220.h>
-#include <version.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-/* We don't want the MMU yet.
-*/
-#undef MSR_KERNEL
-/* Floating Point enable, Machine Check and Recoverable Interr. */
-#ifdef DEBUG
-#define MSR_KERNEL (MSR_FP|MSR_RI)
-#else
-#define MSR_KERNEL (MSR_FP|MSR_ME|MSR_RI)
-#endif
-
-/*
- * Set up GOT: Global Offset Table
- *
- * Use r14 to access the GOT
- */
- START_GOT
- GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_FIXUP_TABLE_)
-
- GOT_ENTRY(_start)
- GOT_ENTRY(_start_of_vectors)
- GOT_ENTRY(_end_of_vectors)
- GOT_ENTRY(transfer_to_handler)
-
- GOT_ENTRY(__init_end)
- GOT_ENTRY(_end)
- GOT_ENTRY(__bss_start)
- END_GOT
-
-/*
- * Version string
- */
- .data
- .globl version_string
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
-
-/*
- * Exception vectors
- */
- .text
- . = EXC_OFF_SYS_RESET
- .globl _start
-_start:
- li r21, BOOTFLAG_COLD /* Normal Power-On */
- nop
- b boot_cold
-
- . = EXC_OFF_SYS_RESET + 0x10
-
- .globl _start_warm
-_start_warm:
- li r21, BOOTFLAG_WARM /* Software reboot */
- b boot_warm
-
-boot_cold:
-boot_warm:
- mfmsr r5 /* save msr contents */
-
- /* replace default MBAR base address from 0x80000000
- to 0xf0000000 */
-
-#if defined(CFG_DEFAULT_MBAR) && !defined(CFG_RAMBOOT)
- lis r3, CFG_MBAR@h
- ori r3, r3, CFG_MBAR@l
-
- /* MBAR is mirrored into the MBAR SPR */
- mtspr MBAR,r3
- mtspr SPRN_SPRG7W,r3
- lis r4, CFG_DEFAULT_MBAR@h
- stw r3, 0(r4)
-#endif /* CFG_DEFAULT_MBAR */
-
- /* Initialise the MPC8220 processor core */
- /*--------------------------------------------------------------*/
-
- bl init_8220_core
-
- /* initialize some things that are hard to access from C */
- /*--------------------------------------------------------------*/
-
- /* set up stack in on-chip SRAM */
- lis r3, CFG_INIT_RAM_ADDR@h
- ori r3, r3, CFG_INIT_RAM_ADDR@l
- ori r1, r3, CFG_INIT_SP_OFFSET
-
- li r0, 0 /* Make room for stack frame header and */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
-
- /* let the C-code set up the rest */
- /* */
- /* Be careful to keep code relocatable ! */
- /*--------------------------------------------------------------*/
-
- GET_GOT /* initialize GOT access */
-
- /* r3: IMMR */
- bl cpu_init_f /* run low-level CPU init code (in Flash)*/
-
- mr r3, r21
- /* r3: BOOTFLAG */
- bl board_init_f /* run 1st part of board init code (in Flash)*/
-
-/*
- * Vector Table
- */
-
- .globl _start_of_vectors
-_start_of_vectors:
-
-/* Machine check */
- STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. */
- STD_EXCEPTION(0x300, DataStorage, UnknownException)
-
-/* Instruction Storage exception. */
- STD_EXCEPTION(0x400, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
- STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
-
-/* Alignment exception. */
- . = 0x600
-Alignment:
- EXCEPTION_PROLOG
- mfspr r4,DAR
- stw r4,_DAR(r21)
- mfspr r5,DSISR
- stw r5,_DSISR(r21)
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- rlwimi r20,r23,0,25,25 /* copy IP bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_Alignment:
- .long AlignmentException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
- . = 0x700
-ProgramCheck:
- EXCEPTION_PROLOG
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- rlwimi r20,r23,0,25,25 /* copy IP bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_ProgramCheck:
- .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
- STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
-
- /* I guess we could implement decrementer, and may have
- * to someday for timekeeping.
- */
- STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
-
- STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
- STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
- STD_EXCEPTION(0xc00, SystemCall, UnknownException)
- STD_EXCEPTION(0xd00, SingleStep, UnknownException)
-
- STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
- STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
-
- STD_EXCEPTION(0x1000, InstructionTLBMiss, UnknownException)
- STD_EXCEPTION(0x1100, DataLoadTLBMiss, UnknownException)
- STD_EXCEPTION(0x1200, DataStoreTLBMiss, UnknownException)
-#ifdef DEBUG
- . = 0x1300
- /*
- * This exception occurs when the program counter matches the
- * Instruction Address Breakpoint Register (IABR).
- *
- * I want the cpu to halt if this occurs so I can hunt around
- * with the debugger and look at things.
- *
- * When DEBUG is defined, both machine check enable (in the MSR)
- * and checkstop reset enable (in the reset mode register) are
- * turned off and so a checkstop condition will result in the cpu
- * halting.
- *
- * I force the cpu into a checkstop condition by putting an illegal
- * instruction here (at least this is the theory).
- *
- * well - that didnt work, so just do an infinite loop!
- */
-1: b 1b
-#else
- STD_EXCEPTION(0x1300, InstructionBreakpoint, DebugException)
-#endif
- STD_EXCEPTION(0x1400, SMI, UnknownException)
-
- STD_EXCEPTION(0x1500, Trap_15, UnknownException)
- STD_EXCEPTION(0x1600, Trap_16, UnknownException)
- STD_EXCEPTION(0x1700, Trap_17, UnknownException)
- STD_EXCEPTION(0x1800, Trap_18, UnknownException)
- STD_EXCEPTION(0x1900, Trap_19, UnknownException)
- STD_EXCEPTION(0x1a00, Trap_1a, UnknownException)
- STD_EXCEPTION(0x1b00, Trap_1b, UnknownException)
- STD_EXCEPTION(0x1c00, Trap_1c, UnknownException)
- STD_EXCEPTION(0x1d00, Trap_1d, UnknownException)
- STD_EXCEPTION(0x1e00, Trap_1e, UnknownException)
- STD_EXCEPTION(0x1f00, Trap_1f, UnknownException)
- STD_EXCEPTION(0x2000, Trap_20, UnknownException)
- STD_EXCEPTION(0x2100, Trap_21, UnknownException)
- STD_EXCEPTION(0x2200, Trap_22, UnknownException)
- STD_EXCEPTION(0x2300, Trap_23, UnknownException)
- STD_EXCEPTION(0x2400, Trap_24, UnknownException)
- STD_EXCEPTION(0x2500, Trap_25, UnknownException)
- STD_EXCEPTION(0x2600, Trap_26, UnknownException)
- STD_EXCEPTION(0x2700, Trap_27, UnknownException)
- STD_EXCEPTION(0x2800, Trap_28, UnknownException)
- STD_EXCEPTION(0x2900, Trap_29, UnknownException)
- STD_EXCEPTION(0x2a00, Trap_2a, UnknownException)
- STD_EXCEPTION(0x2b00, Trap_2b, UnknownException)
- STD_EXCEPTION(0x2c00, Trap_2c, UnknownException)
- STD_EXCEPTION(0x2d00, Trap_2d, UnknownException)
- STD_EXCEPTION(0x2e00, Trap_2e, UnknownException)
- STD_EXCEPTION(0x2f00, Trap_2f, UnknownException)
-
-
- .globl _end_of_vectors
-_end_of_vectors:
-
- . = 0x3000
-
-/*
- * This code finishes saving the registers to the exception frame
- * and jumps to the appropriate handler for the exception.
- * Register r21 is pointer into trap frame, r1 has new stack pointer.
- */
- .globl transfer_to_handler
-transfer_to_handler:
- stw r22,_NIP(r21)
- lis r22,MSR_POW@h
- andc r23,r23,r22
- stw r23,_MSR(r21)
- SAVE_GPR(7, r21)
- SAVE_4GPRS(8, r21)
- SAVE_8GPRS(12, r21)
- SAVE_8GPRS(24, r21)
- mflr r23
- andi. r24,r23,0x3f00 /* get vector offset */
- stw r24,TRAP(r21)
- li r22,0
- stw r22,RESULT(r21)
- lwz r24,0(r23) /* virtual address of handler */
- lwz r23,4(r23) /* where to go when done */
- mtspr SRR0,r24
- mtspr SRR1,r20
- mtlr r23
- SYNC
- rfi /* jump to handler, enable MMU */
-
-int_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr SRR0,r2
- mtspr SRR1,r0
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfi
-
-/*
- * This code initialises the MPC8220 processor core
- * (conforms to PowerPC 603e spec)
- * Note: expects original MSR contents to be in r5.
- */
-
- .globl init_8220_core
-init_8220_core:
-
- /* Initialize machine status; enable machine check interrupt */
- /*--------------------------------------------------------------*/
-
- li r3, MSR_KERNEL /* Set ME and RI flags */
- rlwimi r3, r5, 0, 25, 25 /* preserve IP bit set by HRCW */
-#ifdef DEBUG
- rlwimi r3, r5, 0, 21, 22 /* debugger might set SE & BE bits */
-#endif
- SYNC /* Some chip revs need this... */
- mtmsr r3
- SYNC
- mtspr SRR1, r3 /* Make SRR1 match MSR */
-
- /* Initialize the Hardware Implementation-dependent Registers */
- /* HID0 also contains cache control */
- /*--------------------------------------------------------------*/
-
- lis r3, CFG_HID0_INIT@h
- ori r3, r3, CFG_HID0_INIT@l
- SYNC
- mtspr HID0, r3
-
- lis r3, CFG_HID0_FINAL@h
- ori r3, r3, CFG_HID0_FINAL@l
- SYNC
- mtspr HID0, r3
-
- /* Enable Extra BATs */
- mfspr r3, 1011 /* HID2 */
- lis r4, 0x0004
- ori r4, r4, 0x0000
- or r4, r4, r3
- mtspr 1011, r4
- sync
-
- /* clear all BAT's */
- /*--------------------------------------------------------------*/
-
- li r0, 0
- mtspr DBAT0U, r0
- mtspr DBAT0L, r0
- mtspr DBAT1U, r0
- mtspr DBAT1L, r0
- mtspr DBAT2U, r0
- mtspr DBAT2L, r0
- mtspr DBAT3U, r0
- mtspr DBAT3L, r0
- mtspr DBAT4U, r0
- mtspr DBAT4L, r0
- mtspr DBAT5U, r0
- mtspr DBAT5L, r0
- mtspr DBAT6U, r0
- mtspr DBAT6L, r0
- mtspr DBAT7U, r0
- mtspr DBAT7L, r0
- mtspr IBAT0U, r0
- mtspr IBAT0L, r0
- mtspr IBAT1U, r0
- mtspr IBAT1L, r0
- mtspr IBAT2U, r0
- mtspr IBAT2L, r0
- mtspr IBAT3U, r0
- mtspr IBAT3L, r0
- mtspr IBAT4U, r0
- mtspr IBAT4L, r0
- mtspr IBAT5U, r0
- mtspr IBAT5L, r0
- mtspr IBAT6U, r0
- mtspr IBAT6L, r0
- mtspr IBAT7U, r0
- mtspr IBAT7L, r0
- SYNC
-
- /* invalidate all tlb's */
- /* */
- /* From the 603e User Manual: "The 603e provides the ability to */
- /* invalidate a TLB entry. The TLB Invalidate Entry (tlbie) */
- /* instruction invalidates the TLB entry indexed by the EA, and */
- /* operates on both the instruction and data TLBs simultaneously*/
- /* invalidating four TLB entries (both sets in each TLB). The */
- /* index corresponds to bits 15-19 of the EA. To invalidate all */
- /* entries within both TLBs, 32 tlbie instructions should be */
- /* issued, incrementing this field by one each time." */
- /* */
- /* "Note that the tlbia instruction is not implemented on the */
- /* 603e." */
- /* */
- /* bits 15-19 correspond to addresses 0x00000000 to 0x0001F000 */
- /* incrementing by 0x1000 each time. The code below is sort of */
- /* based on code in "flush_tlbs" from arch/ppc/kernel/head.S */
- /* */
- /*--------------------------------------------------------------*/
-
- li r3, 32
- mtctr r3
- li r3, 0
-1: tlbie r3
- addi r3, r3, 0x1000
- bdnz 1b
- SYNC
-
- /* Done! */
- /*--------------------------------------------------------------*/
-
- blr
-
-/* Cache functions.
- *
- * Note: requires that all cache bits in
- * HID0 are in the low half word.
- */
- .globl icache_enable
-icache_enable:
- lis r4, 0
- ori r4, r4, CFG_HID0_INIT /* set ICE & ICFI bit */
- rlwinm r3, r4, 0, 21, 19 /* clear the ICFI bit */
-
- /*
- * The setting of the instruction cache enable (ICE) bit must be
- * preceded by an isync instruction to prevent the cache from being
- * enabled or disabled while an instruction access is in progress.
- */
- isync
- mtspr HID0, r4 /* Enable Instr Cache & Inval cache */
- mtspr HID0, r3 /* using 2 consec instructions */
- isync
- blr
-
- .globl icache_disable
-icache_disable:
- mfspr r3, HID0
- rlwinm r3, r3, 0, 17, 15 /* clear the ICE bit */
- mtspr HID0, r3
- isync
- blr
-
- .globl icache_status
-icache_status:
- mfspr r3, HID0
- rlwinm r3, r3, HID0_ICE_BITPOS + 1, 31, 31
- blr
-
- .globl dcache_enable
-dcache_enable:
- lis r4, 0
- ori r4, r4, HID0_DCE|HID0_DCFI /* set DCE & DCFI bit */
- rlwinm r3, r4, 0, 22, 20 /* clear the DCFI bit */
-
- /* Enable address translation in MSR bit */
- mfmsr r5
- ori r5, r5, 0x
-
-
- /*
- * The setting of the instruction cache enable (ICE) bit must be
- * preceded by an isync instruction to prevent the cache from being
- * enabled or disabled while an instruction access is in progress.
- */
- isync
- mtspr HID0, r4 /* Enable Data Cache & Inval cache*/
- mtspr HID0, r3 /* using 2 consec instructions */
- isync
- blr
-
- .globl dcache_disable
-dcache_disable:
- mfspr r3, HID0
- rlwinm r3, r3, 0, 18, 16 /* clear the DCE bit */
- mtspr HID0, r3
- isync
- blr
-
- .globl dcache_status
-dcache_status:
- mfspr r3, HID0
- rlwinm r3, r3, HID0_DCE_BITPOS + 1, 31, 31
- blr
-
- .globl get_pvr
-get_pvr:
- mfspr r3, PVR
- blr
-
-/*------------------------------------------------------------------------------*/
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
- */
- .globl relocate_code
-relocate_code:
- mr r1, r3 /* Set new stack pointer */
- mr r9, r4 /* Save copy of Global Data pointer */
- mr r10, r5 /* Save copy of Destination Address */
-
- mr r3, r5 /* Destination Address */
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
- lwz r5, GOT(__init_end)
- sub r5, r5, r4
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
- *
- * Offset:
- */
- sub r15, r10, r4
-
- /* First our own GOT */
- add r14, r14, r15
- /* then the one used by the C code */
- add r30, r30, r15
-
- /*
- * Now relocate code
- */
-
- cmplw cr1,r3,r4
- addi r0,r5,3
- srwi. r0,r0,2
- beq cr1,4f /* In place copy is not necessary */
- beq 7f /* Protect against 0 count */
- mtctr r0
- bge cr1,2f
-
- la r8,-4(r4)
- la r7,-4(r3)
-1: lwzu r0,4(r8)
- stwu r0,4(r7)
- bdnz 1b
- b 4f
-
-2: slwi r0,r0,2
- add r8,r4,r0
- add r7,r3,r0
-3: lwzu r0,-4(r8)
- stwu r0,-4(r7)
- bdnz 3b
-
-/*
- * Now flush the cache: note that we must start from a cache aligned
- * address. Otherwise we might miss one cache line.
- */
-4: cmpwi r6,0
- add r5,r3,r5
- beq 7f /* Always flush prefetch queue in any case */
- subi r0,r6,1
- andc r3,r3,r0
- mfspr r7,HID0 /* don't do dcbst if dcache is disabled */
- rlwinm r7,r7,HID0_DCE_BITPOS+1,31,31
- cmpwi r7,0
- beq 9f
- mr r4,r3
-5: dcbst 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 5b
- sync /* Wait for all dcbst to complete on bus */
-9: mfspr r7,HID0 /* don't do icbi if icache is disabled */
- rlwinm r7,r7,HID0_ICE_BITPOS+1,31,31
- cmpwi r7,0
- beq 7f
- mr r4,r3
-6: icbi 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 6b
-7: sync /* Wait for all icbi to complete on bus */
- isync
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-
- addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
- mtlr r0
- blr
-
-in_ram:
-
- /*
- * Relocation Function, r14 point to got2+0x8000
- *
- * Adjust got2 pointers, no need to check for 0, this code
- * already puts a few entries in the table.
- */
- li r0,__got2_entries@sectoff@l
- la r3,GOT(_GOT2_TABLE_)
- lwz r11,GOT(_GOT2_TABLE_)
- mtctr r0
- sub r11,r3,r11
- addi r3,r3,-4
-1: lwzu r0,4(r3)
- add r0,r0,r11
- stw r0,0(r3)
- bdnz 1b
-
- /*
- * Now adjust the fixups and the pointers to the fixups
- * in case we need to move ourselves again.
- */
-2: li r0,__fixup_entries@sectoff@l
- lwz r3,GOT(_FIXUP_TABLE_)
- cmpwi r0,0
- mtctr r0
- addi r3,r3,-4
- beq 4f
-3: lwzu r4,4(r3)
- lwzux r0,r4,r11
- add r0,r0,r11
- stw r10,0(r3)
- stw r0,0(r4)
- bdnz 3b
-4:
-clear_bss:
- /*
- * Now clear BSS segment
- */
- lwz r3,GOT(__bss_start)
- lwz r4,GOT(_end)
-
- cmplw 0, r3, r4
- beq 6f
-
- li r0, 0
-5:
- stw r0, 0(r3)
- addi r3, r3, 4
- cmplw 0, r3, r4
- bne 5b
-6:
-
- mr r3, r9 /* Global Data pointer */
- mr r4, r10 /* Destination Address */
- bl board_init_r
-
- /*
- * Copy exception vector code to low memory
- *
- * r3: dest_addr
- * r7: source address, r8: end address, r9: target address
- */
- .globl trap_init
-trap_init:
- lwz r7, GOT(_start)
- lwz r8, GOT(_end_of_vectors)
-
- li r9, 0x100 /* reset vector always at 0x100 */
-
- cmplw 0, r7, r8
- bgelr /* return if r7>=r8 - just in case */
-
- mflr r4 /* save link register */
-1:
- lwz r0, 0(r7)
- stw r0, 0(r9)
- addi r7, r7, 4
- addi r9, r9, 4
- cmplw 0, r7, r8
- bne 1b
-
- /*
- * relocate `hdlr' and `int_return' entries
- */
- li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
- li r8, Alignment - _start + EXC_OFF_SYS_RESET
-2:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 2b
-
- li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
- li r8, SystemCall - _start + EXC_OFF_SYS_RESET
-3:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 3b
-
- li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
- li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-4:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 4b
-
- mfmsr r3 /* now that the vectors have */
- lis r7, MSR_IP@h /* relocated into low memory */
- ori r7, r7, MSR_IP@l /* MSR[IP] can be turned off */
- andc r3, r3, r7 /* (if it was on) */
- SYNC /* Some chip revs need this... */
- mtmsr r3
- SYNC
-
- mtlr r4 /* restore link register */
- blr
-
- /*
- * Function: relocate entries for one exception vector
- */
-trap_reloc:
- lwz r0, 0(r7) /* hdlr ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 0(r7)
-
- lwz r0, 4(r7) /* int_return ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 4(r7)
-
- blr
diff --git a/cpu/mpc8220/traps.c b/cpu/mpc8220/traps.c
deleted file mode 100644
index f6bd1bbcf2..0000000000
--- a/cpu/mpc8220/traps.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * linux/arch/ppc/kernel/traps.c
- *
- * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- * Modified by Cort Dougan (cort@cs.nmt.edu)
- * and Paul Mackerras (paulus@cs.anu.edu.au)
- * fixed Machine Check Reasons by Reinhard Meyer (r.meyer@emk-elektronik.de)
- *
- * (C) Copyright 2000-2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * This file handles the architecture-dependent parts of hardware exceptions
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/processor.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-int (*debugger_exception_handler) (struct pt_regs *) = 0;
-#endif
-
-/* Returns 0 if exception not found and fixup otherwise. */
-extern unsigned long search_exception_table (unsigned long);
-
-/* THIS NEEDS CHANGING to use the board info structure.
-*/
-#define END_OF_MEM 0x02000000
-
-/*
- * Trap & Exception support
- */
-
-void print_backtrace (unsigned long *sp)
-{
- int cnt = 0;
- unsigned long i;
-
- printf ("Call backtrace: ");
- while (sp) {
- if ((uint) sp > END_OF_MEM)
- break;
-
- i = sp[1];
- if (cnt++ % 7 == 0)
- printf ("\n");
- printf ("%08lX ", i);
- if (cnt > 32)
- break;
- sp = (unsigned long *) *sp;
- }
- printf ("\n");
-}
-
-void show_regs (struct pt_regs *regs)
-{
- int i;
-
- printf ("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
- regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
- printf ("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
- regs->msr,
- regs->msr & MSR_EE ? 1 : 0, regs->msr & MSR_PR ? 1 : 0,
- regs->msr & MSR_FP ? 1 : 0, regs->msr & MSR_ME ? 1 : 0,
- regs->msr & MSR_IR ? 1 : 0, regs->msr & MSR_DR ? 1 : 0);
-
- printf ("\n");
- for (i = 0; i < 32; i++) {
- if ((i % 8) == 0) {
- printf ("GPR%02d: ", i);
- }
-
- printf ("%08lX ", regs->gpr[i]);
- if ((i % 8) == 7) {
- printf ("\n");
- }
- }
-}
-
-
-void _exception (int signr, struct pt_regs *regs)
-{
- show_regs (regs);
- print_backtrace ((unsigned long *) regs->gpr[1]);
- panic ("Exception in kernel pc %lx signal %d", regs->nip, signr);
-}
-
-void MachineCheckException (struct pt_regs *regs)
-{
- unsigned long fixup;
-
- /* Probing PCI using config cycles cause this exception
- * when a device is not present. Catch it and return to
- * the PCI exception handler.
- */
- if ((fixup = search_exception_table (regs->nip)) != 0) {
- regs->nip = fixup;
- return;
- }
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler
- && (*debugger_exception_handler) (regs))
- return;
-#endif
-
- printf ("Machine check in kernel mode.\n");
- printf ("Caused by (from msr): ");
- printf ("regs %p ", regs);
- /* refer to 603e Manual (MPC603EUM/AD), chapter 4.5.2.1 */
- switch (regs->msr & 0x000F0000) {
- case (0x80000000 >> 12):
- printf ("Machine check signal - probably due to mm fault\n"
- "with mmu off\n");
- break;
- case (0x80000000 >> 13):
- printf ("Transfer error ack signal\n");
- break;
- case (0x80000000 >> 14):
- printf ("Data parity signal\n");
- break;
- case (0x80000000 >> 15):
- printf ("Address parity signal\n");
- break;
- default:
- printf ("Unknown values in msr\n");
- }
- show_regs (regs);
- print_backtrace ((unsigned long *) regs->gpr[1]);
- panic ("machine check");
-}
-
-void AlignmentException (struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler
- && (*debugger_exception_handler) (regs))
- return;
-#endif
- show_regs (regs);
- print_backtrace ((unsigned long *) regs->gpr[1]);
- panic ("Alignment Exception");
-}
-
-void ProgramCheckException (struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler
- && (*debugger_exception_handler) (regs))
- return;
-#endif
- show_regs (regs);
- print_backtrace ((unsigned long *) regs->gpr[1]);
- panic ("Program Check Exception");
-}
-
-void SoftEmuException (struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler
- && (*debugger_exception_handler) (regs))
- return;
-#endif
- show_regs (regs);
- print_backtrace ((unsigned long *) regs->gpr[1]);
- panic ("Software Emulation Exception");
-}
-
-
-void UnknownException (struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler
- && (*debugger_exception_handler) (regs))
- return;
-#endif
- printf ("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
- regs->nip, regs->msr, regs->trap);
- _exception (0, regs);
-}
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
-extern void do_bedbug_breakpoint (struct pt_regs *);
-#endif
-
-void DebugException (struct pt_regs *regs)
-{
-
- printf ("Debugger trap at @ %lx\n", regs->nip);
- show_regs (regs);
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
- do_bedbug_breakpoint (regs);
-#endif
-}
-
-/* Probe an address by reading. If not present, return -1, otherwise
- * return 0.
- */
-int addr_probe (uint * addr)
-{
- return 0;
-}
diff --git a/cpu/mpc8220/uart.c b/cpu/mpc8220/uart.c
deleted file mode 100644
index 0c4b536b48..0000000000
--- a/cpu/mpc8220/uart.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * (C) Copyright 2004, Freescale, Inc
- * TsiChung Liew, Tsi-Chung.Liew@freescale.com.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- */
-
-/*
- * Minimal serial functions needed to use one of the PSC ports
- * as serial console interface.
- */
-
-#include <common.h>
-#include <mpc8220.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define PSC_BASE MMAP_PSC1
-
-#if defined(CONFIG_PSC_CONSOLE)
-int serial_init (void)
-{
- volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
- u32 counter;
-
- /* write to SICR: SIM2 = uart mode,dcd does not affect rx */
- psc->cr = 0;
- psc->ipcr_acr = 0;
- psc->isr_imr = 0;
-
- /* write to CSR: RX/TX baud rate from timers */
- psc->sr_csr = 0xdd000000;
-
- psc->mr1_2 = PSC_MR1_BITS_CHAR_8 | PSC_MR1_NO_PARITY | PSC_MR2_STOP_BITS_1;
-
- /* Setting up BaudRate */
- counter = ((gd->bus_clk / gd->baudrate)) >> 5;
- counter++;
-
- /* write to CTUR: divide counter upper byte */
- psc->ctur = ((counter & 0xff00) << 16);
- /* write to CTLR: divide counter lower byte */
- psc->ctlr = ((counter & 0x00ff) << 24);
-
- psc->cr = PSC_CR_RST_RX_CMD;
- psc->cr = PSC_CR_RST_TX_CMD;
- psc->cr = PSC_CR_RST_ERR_STS_CMD;
- psc->cr = PSC_CR_RST_BRK_INT_CMD;
- psc->cr = PSC_CR_RST_MR_PTR_CMD;
-
- psc->cr = PSC_CR_RX_ENABLE | PSC_CR_TX_ENABLE;
- return (0);
-}
-
-void serial_putc (const char c)
-{
- volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
-
- if (c == '\n')
- serial_putc ('\r');
-
- /* Wait for last character to go. */
- while (!(psc->sr_csr & PSC_SR_TXRDY));
-
- psc->xmitbuf[0] = c;
-}
-
-void serial_puts (const char *s)
-{
- while (*s) {
- serial_putc (*s++);
- }
-}
-
-int serial_getc (void)
-{
- volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
-
- /* Wait for a character to arrive. */
- while (!(psc->sr_csr & PSC_SR_RXRDY));
- return psc->xmitbuf[2];
-}
-
-int serial_tstc (void)
-{
- volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
-
- return (psc->sr_csr & PSC_SR_RXRDY);
-}
-
-void serial_setbrg (void)
-{
- volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
- u32 counter;
-
- counter = ((gd->bus_clk / gd->baudrate)) >> 5;
- counter++;
-
- /* write to CTUR: divide counter upper byte */
- psc->ctur = ((counter & 0xff00) << 16);
- /* write to CTLR: divide counter lower byte */
- psc->ctlr = ((counter & 0x00ff) << 24);
-
- psc->cr = PSC_CR_RST_RX_CMD;
- psc->cr = PSC_CR_RST_TX_CMD;
-
- psc->cr = PSC_CR_RX_ENABLE | PSC_CR_TX_ENABLE;
-}
-#endif /* CONFIG_PSC_CONSOLE */
diff --git a/cpu/mpc824x/Makefile b/cpu/mpc824x/Makefile
deleted file mode 100644
index f249dd7c3b..0000000000
--- a/cpu/mpc824x/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-ifneq ($(OBJTREE),$(SRCTREE))
-$(shell mkdir -p $(obj)drivers/epic)
-$(shell mkdir -p $(obj)drivers/i2c)
-endif
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = traps.o cpu.o cpu_init.o interrupts.o speed.o \
- drivers/epic/epic1.o drivers/i2c/i2c.o pci.o
-COBJS_LN = bedbug_603e.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) $(addprefix $(obj),$(COBJS_LN:.o=.c))
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS) $(COBJS_LN))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-$(obj)bedbug_603e.c:
- ln -s $(src)../mpc8260/bedbug_603e.c $(obj)bedbug_603e.c
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/mpc824x/config.mk b/cpu/mpc824x/config.mk
deleted file mode 100644
index dac61d8d3e..0000000000
--- a/cpu/mpc824x/config.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# (C) Copyright 2000
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
-
-PLATFORM_CPPFLAGS += -DCONFIG_MPC824X -ffixed-r2 -ffixed-r29 -mstring -mcpu=603e -msoft-float
diff --git a/cpu/mpc824x/cpu.c b/cpu/mpc824x/cpu.c
deleted file mode 100644
index 0a45cc8419..0000000000
--- a/cpu/mpc824x/cpu.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * (C) Copyright 2000 - 2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <mpc824x.h>
-#include <common.h>
-#include <command.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int checkcpu (void)
-{
- unsigned int pvr = get_pvr ();
- unsigned int version = pvr >> 16;
- unsigned char revision;
- ulong clock = gd->cpu_clk;
- char buf[32];
-
- puts ("CPU: ");
-
- switch (version) {
- case CPU_TYPE_8240:
- puts ("MPC8240");
- break;
-
- case CPU_TYPE_8245:
- puts ("MPC8245");
- break;
-
- default:
- return -1; /*not valid for this source */
- }
-
- CONFIG_READ_BYTE (REVID, revision);
-
- if (revision) {
- printf (" Revision %d.%d",
- (revision & 0xf0) >> 4,
- (revision & 0x0f));
- } else {
- return -1; /* no valid CPU revision info */
- }
-
- printf (" at %s MHz:", strmhz (buf, clock));
-
- printf (" %u kB I-Cache", checkicache () >> 10);
- printf (" %u kB D-Cache", checkdcache () >> 10);
-
- puts ("\n");
-
- return 0;
-}
-
-/* ------------------------------------------------------------------------- */
-/* L1 i-cache */
-
-int checkicache (void)
-{
- /*TODO*/
- return 128 * 4 * 32;
-};
-
-/* ------------------------------------------------------------------------- */
-/* L1 d-cache */
-
-int checkdcache (void)
-{
- /*TODO*/
- return 128 * 4 * 32;
-
-};
-
-/*------------------------------------------------------------------- */
-
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- ulong msr, addr;
-
- /* Interrupts and MMU off */
- __asm__ ("mtspr 81, 0");
-
- /* Interrupts and MMU off */
- __asm__ __volatile__ ("mfmsr %0":"=r" (msr):);
-
- msr &= ~0x1030;
- __asm__ __volatile__ ("mtmsr %0"::"r" (msr));
-
- /*
- * Trying to execute the next instruction at a non-existing address
- * should cause a machine check, resulting in reset
- */
-#ifdef CFG_RESET_ADDRESS
- addr = CFG_RESET_ADDRESS;
-#else
- /*
- * note: when CFG_MONITOR_BASE points to a RAM address,
- * CFG_MONITOR_BASE - sizeof (ulong) is usually a valid
- * address. Better pick an address known to be invalid on
- * your system and assign it to CFG_RESET_ADDRESS.
- * "(ulong)-1" used to be a good choice for many systems...
- */
- addr = CFG_MONITOR_BASE - sizeof (ulong);
-#endif
- ((void (*)(void)) addr) ();
- return 1;
-
-}
-
-/* ------------------------------------------------------------------------- */
-
-/*
- * Get timebase clock frequency (like cpu_clk in Hz)
- * This is the sys_logic_clk (memory bus) divided by 4
- */
-unsigned long get_tbclk (void)
-{
- return ((get_bus_freq (0) + 2L) / 4L);
-}
-
-/* ------------------------------------------------------------------------- */
-
-/*
- * The MPC824x has an integrated PCI controller known as the MPC107.
- * The following are MPC107 Bridge Controller and PCI Support functions
- *
- */
-
-/*
- * This procedure reads a 32-bit address MPC107 register, and returns
- * a 32 bit value. It swaps the address to little endian before
- * writing it to config address, and swaps the value to big endian
- * before returning to the caller.
- */
-unsigned int mpc824x_mpc107_getreg (unsigned int regNum)
-{
- unsigned int temp;
-
- /* swap the addr. to little endian */
- *(volatile unsigned int *) CHRP_REG_ADDR = PCISWAP (regNum);
- temp = *(volatile unsigned int *) CHRP_REG_DATA;
- return PCISWAP (temp); /* swap the data upon return */
-}
-
-/*
- * This procedure writes a 32-bit address MPC107 register. It swaps
- * the address to little endian before writing it to config address.
- */
-
-void mpc824x_mpc107_setreg (unsigned int regNum, unsigned int regVal)
-{
- /* swap the addr. to little endian */
- *(volatile unsigned int *) CHRP_REG_ADDR = PCISWAP (regNum);
- *(volatile unsigned int *) CHRP_REG_DATA = PCISWAP (regVal);
- return;
-}
-
-
-/*
- * Write a byte (8 bits) to a memory location.
- */
-void mpc824x_mpc107_write8 (unsigned int addr, unsigned char data)
-{
- *(unsigned char *) addr = data;
- __asm__ ("sync");
-}
-
-/*
- * Write a word (16 bits) to a memory location after the value
- * has been byte swapped (big to little endian or vice versa)
- */
-
-void mpc824x_mpc107_write16 (unsigned int address, unsigned short data)
-{
- *(volatile unsigned short *) address = BYTE_SWAP_16_BIT (data);
- __asm__ ("sync");
-}
-
-/*
- * Write a long word (32 bits) to a memory location after the value
- * has been byte swapped (big to little endian or vice versa)
- */
-
-void mpc824x_mpc107_write32 (unsigned int address, unsigned int data)
-{
- *(volatile unsigned int *) address = LONGSWAP (data);
- __asm__ ("sync");
-}
-
-/*
- * Read a byte (8 bits) from a memory location.
- */
-unsigned char mpc824x_mpc107_read8 (unsigned int addr)
-{
- return *(volatile unsigned char *) addr;
-}
-
-
-/*
- * Read a word (16 bits) from a memory location, and byte swap the
- * value before returning to the caller.
- */
-unsigned short mpc824x_mpc107_read16 (unsigned int address)
-{
- unsigned short retVal;
-
- retVal = BYTE_SWAP_16_BIT (*(unsigned short *) address);
- return retVal;
-}
-
-
-/*
- * Read a long word (32 bits) from a memory location, and byte
- * swap the value before returning to the caller.
- */
-unsigned int mpc824x_mpc107_read32 (unsigned int address)
-{
- unsigned int retVal;
-
- retVal = LONGSWAP (*(unsigned int *) address);
- return (retVal);
-}
-
-
-/*
- * Read a register in the Embedded Utilities Memory Block address
- * space.
- * Input: regNum - register number + utility base address. Example,
- * the base address of EPIC is 0x40000, the register number
- * being passed is 0x40000+the address of the target register.
- * (See epic.h for register addresses).
- * Output: The 32 bit little endian value of the register.
- */
-
-unsigned int mpc824x_eummbar_read (unsigned int regNum)
-{
- unsigned int temp;
-
- temp = *(volatile unsigned int *) (EUMBBAR_VAL + regNum);
- temp = PCISWAP (temp);
- return temp;
-}
-
-
-/*
- * Write a value to a register in the Embedded Utilities Memory
- * Block address space.
- * Input: regNum - register number + utility base address. Example,
- * the base address of EPIC is 0x40000, the register
- * number is 0x40000+the address of the target register.
- * (See epic.h for register addresses).
- * regVal - value to be written to the register.
- */
-
-void mpc824x_eummbar_write (unsigned int regNum, unsigned int regVal)
-{
- *(volatile unsigned int *) (EUMBBAR_VAL + regNum) = PCISWAP (regVal);
- return;
-}
-
-/* ------------------------------------------------------------------------- */
diff --git a/cpu/mpc824x/cpu_init.c b/cpu/mpc824x/cpu_init.c
deleted file mode 100644
index 64c7af5311..0000000000
--- a/cpu/mpc824x/cpu_init.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * (C) Copyright 2000
- * Rob Taylor. Flying Pig Systems. robt@flyingpig.com.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/processor.h>
-#include <mpc824x.h>
-
-#ifndef CFG_BANK0_ROW
-#define CFG_BANK0_ROW 0
-#endif
-#ifndef CFG_BANK1_ROW
-#define CFG_BANK1_ROW 0
-#endif
-#ifndef CFG_BANK2_ROW
-#define CFG_BANK2_ROW 0
-#endif
-#ifndef CFG_BANK3_ROW
-#define CFG_BANK3_ROW 0
-#endif
-#ifndef CFG_BANK4_ROW
-#define CFG_BANK4_ROW 0
-#endif
-#ifndef CFG_BANK5_ROW
-#define CFG_BANK5_ROW 0
-#endif
-#ifndef CFG_BANK6_ROW
-#define CFG_BANK6_ROW 0
-#endif
-#ifndef CFG_BANK7_ROW
-#define CFG_BANK7_ROW 0
-#endif
-#ifndef CFG_DBUS_SIZE2
-#define CFG_DBUS_SIZE2 0
-#endif
-
-/*
- * Breath some life into the CPU...
- *
- * Set up the memory map,
- * initialize a bunch of registers,
- */
-void
-cpu_init_f (void)
-{
-/* MOUSSE board is initialized in asm */
-#if !defined(CONFIG_MOUSSE) && !defined(CONFIG_BMW)
- register unsigned long val;
- CONFIG_WRITE_HALFWORD(PCICR, 0x06); /* Bus Master, respond to PCI memory space acesses*/
-/* CONFIG_WRITE_HALFWORD(PCISR, 0xffff); */ /*reset PCISR*/
-
-#if defined(CONFIG_MUSENKI) || defined(CONFIG_PN62)
-/* Why is this here, you ask? Try, just try setting 0x8000
- * in PCIACR with CONFIG_WRITE_HALFWORD()
- * this one was a stumper, and we are annoyed
- */
-
-#define M_CONFIG_WRITE_HALFWORD( addr, data ) \
- __asm__ __volatile__(" \
- stw %2,0(%0)\n \
- sync\n \
- sth %3,2(%1)\n \
- sync\n \
- " \
- : /* no output */ \
- : "r" (CONFIG_ADDR), "r" (CONFIG_DATA), \
- "r" (PCISWAP(addr & ~3)), "r" (PCISWAP(data << 16)) \
- );
-
- M_CONFIG_WRITE_HALFWORD(PCIACR, 0x8000);
-#endif
-
- CONFIG_WRITE_BYTE(PCLSR, 0x8); /* set PCI cache line size */
- CONFIG_WRITE_BYTE (PLTR, 0x40); /* set PCI latency timer */
- /*
- * Note that although this bit is cleared after a hard reset, it
- * must be explicitly set and then cleared by software during
- * initialization in order to guarantee correct operation of the
- * DLL and the SDRAM_CLK[0:3] signals (if they are used).
- */
- CONFIG_READ_BYTE (AMBOR, val);
- CONFIG_WRITE_BYTE(AMBOR, val & 0xDF);
- CONFIG_WRITE_BYTE(AMBOR, val | 0x20);
- CONFIG_WRITE_BYTE(AMBOR, val & 0xDF);
-#ifdef CONFIG_MPC8245
- /* silicon bug 28 MPC8245 */
- CONFIG_READ_BYTE(AMBOR,val);
- CONFIG_WRITE_BYTE(AMBOR,val|0x1);
-
-#endif
-
- CONFIG_READ_WORD(PICR1, val);
-#if defined(CONFIG_MPC8240)
- CONFIG_WRITE_WORD( PICR1,
- (val & (PICR1_ADDRESS_MAP | PICR1_RCS0)) |
- PIRC1_MSK | PICR1_PROC_TYPE_603E |
- PICR1_FLASH_WR_EN | PICR1_MCP_EN |
- PICR1_CF_DPARK | PICR1_EN_PCS |
- PICR1_CF_APARK );
-#elif defined(CONFIG_MPC8245)
- CONFIG_WRITE_WORD( PICR1,
- (val & (PICR1_RCS0)) |
- PICR1_PROC_TYPE_603E |
- PICR1_FLASH_WR_EN | PICR1_MCP_EN |
- PICR1_CF_DPARK | PICR1_NO_BUSW_CK |
- PICR1_DEC| PICR1_CF_APARK | 0x10); /* 8245 UM says bit 4 must be set */
-#else
-#error Specific type of MPC824x must be defined (i.e. CONFIG_MPC8240)
-#endif
-
- CONFIG_READ_WORD(PICR2, val);
- val= val & ~ (PICR2_CF_SNOOP_WS_MASK | PICR2_CF_APHASE_WS_MASK); /*mask off waitstate bits*/
-#ifndef CONFIG_PN62
- val |= PICR2_CF_SNOOP_WS_1WS | PICR2_CF_APHASE_WS_1WS; /*1 wait state*/
-#endif
- CONFIG_WRITE_WORD(PICR2, val);
-
- CONFIG_WRITE_WORD(EUMBBAR, CFG_EUMB_ADDR);
-#ifndef CFG_RAMBOOT
- CONFIG_WRITE_WORD(MCCR1, (CFG_ROMNAL << MCCR1_ROMNAL_SHIFT) |
- (CFG_BANK0_ROW) |
- (CFG_BANK1_ROW << MCCR1_BANK1ROW_SHIFT) |
- (CFG_BANK2_ROW << MCCR1_BANK2ROW_SHIFT) |
- (CFG_BANK3_ROW << MCCR1_BANK3ROW_SHIFT) |
- (CFG_BANK4_ROW << MCCR1_BANK4ROW_SHIFT) |
- (CFG_BANK5_ROW << MCCR1_BANK5ROW_SHIFT) |
- (CFG_BANK6_ROW << MCCR1_BANK6ROW_SHIFT) |
- (CFG_BANK7_ROW << MCCR1_BANK7ROW_SHIFT) |
- (CFG_ROMFAL << MCCR1_ROMFAL_SHIFT));
-#endif
-
-#if defined(CFG_ASRISE) && defined(CFG_ASFALL)
- CONFIG_WRITE_WORD(MCCR2, CFG_REFINT << MCCR2_REFINT_SHIFT |
- CFG_ASRISE << MCCR2_ASRISE_SHIFT |
- CFG_ASFALL << MCCR2_ASFALL_SHIFT);
-#else
- CONFIG_WRITE_WORD(MCCR2, CFG_REFINT << MCCR2_REFINT_SHIFT);
-#endif
-
-#if defined(CONFIG_MPC8240)
- CONFIG_WRITE_WORD(MCCR3,
- (((CFG_BSTOPRE & 0x003c) >> 2) << MCCR3_BSTOPRE2TO5_SHIFT) |
- (CFG_REFREC << MCCR3_REFREC_SHIFT) |
- (CFG_RDLAT << MCCR3_RDLAT_SHIFT));
-#elif defined(CONFIG_MPC8245)
- CONFIG_WRITE_WORD(MCCR3,
- (((CFG_BSTOPRE & 0x003c) >> 2) << MCCR3_BSTOPRE2TO5_SHIFT) |
- (CFG_REFREC << MCCR3_REFREC_SHIFT));
-#else
-#error Specific type of MPC824x must be defined (i.e. CONFIG_MPC8240)
-#endif
-
-/* this is gross. We think these should all be the same, and various boards
- * should define CFG_ACTORW to 0 if they don't want to set it, or even, if
- * its not set, we define it to zero in this file
- */
-#if defined(CONFIG_CU824) || defined(CONFIG_PN62)
- CONFIG_WRITE_WORD(MCCR4,
- (CFG_PRETOACT << MCCR4_PRETOACT_SHIFT) |
- (CFG_ACTTOPRE << MCCR4_ACTTOPRE_SHIFT) |
- MCCR4_BIT21 |
- (CFG_REGISTERD_TYPE_BUFFER ? MCCR4_REGISTERED: 0) |
- ((CFG_BSTOPRE & 0x0003) <<MCCR4_BSTOPRE0TO1_SHIFT ) |
- (((CFG_SDMODE_CAS_LAT <<4) | (CFG_SDMODE_WRAP <<3) |
- CFG_SDMODE_BURSTLEN) << MCCR4_SDMODE_SHIFT) |
- (CFG_ACTORW << MCCR4_ACTTORW_SHIFT) |
- (((CFG_BSTOPRE & 0x03c0) >> 6) << MCCR4_BSTOPRE6TO9_SHIFT));
-#elif defined(CONFIG_MPC8240)
- CONFIG_WRITE_WORD(MCCR4,
- (CFG_PRETOACT << MCCR4_PRETOACT_SHIFT) |
- (CFG_ACTTOPRE << MCCR4_ACTTOPRE_SHIFT) |
- MCCR4_BIT21 |
- (CFG_REGISTERD_TYPE_BUFFER ? MCCR4_REGISTERED: 0) |
- ((CFG_BSTOPRE & 0x0003) <<MCCR4_BSTOPRE0TO1_SHIFT ) |
- (((CFG_SDMODE_CAS_LAT <<4) | (CFG_SDMODE_WRAP <<3) |
- (CFG_SDMODE_BURSTLEN)) <<MCCR4_SDMODE_SHIFT) |
- (((CFG_BSTOPRE & 0x03c0) >> 6) <<MCCR4_BSTOPRE6TO9_SHIFT ));
-#elif defined(CONFIG_MPC8245)
- CONFIG_READ_WORD(MCCR1, val);
- val &= MCCR1_DBUS_SIZE0; /* test for 64-bit mem bus */
-
- CONFIG_WRITE_WORD(MCCR4,
- (CFG_PRETOACT << MCCR4_PRETOACT_SHIFT) |
- (CFG_ACTTOPRE << MCCR4_ACTTOPRE_SHIFT) |
- (CFG_EXTROM ? MCCR4_EXTROM : 0) |
- (CFG_REGDIMM ? MCCR4_REGDIMM : 0) |
- (CFG_REGISTERD_TYPE_BUFFER ? MCCR4_REGISTERED: 0) |
- ((CFG_BSTOPRE & 0x0003) <<MCCR4_BSTOPRE0TO1_SHIFT ) |
- (CFG_DBUS_SIZE2 << MCCR4_DBUS_SIZE2_SHIFT) |
- (((CFG_SDMODE_CAS_LAT <<4) | (CFG_SDMODE_WRAP <<3) |
- (val ? 2 : 3)) << MCCR4_SDMODE_SHIFT) |
- (CFG_ACTORW << MCCR4_ACTTORW_SHIFT) |
- (((CFG_BSTOPRE & 0x03c0) >> 6) <<MCCR4_BSTOPRE6TO9_SHIFT ));
-#else
-#error Specific type of MPC824x must be defined (i.e. CONFIG_MPC8240)
-#endif
-
- CONFIG_WRITE_WORD(MSAR1,
- ( (CFG_BANK0_START & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) |
- (((CFG_BANK1_START & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 8) |
- (((CFG_BANK2_START & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 16) |
- (((CFG_BANK3_START & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 24));
- CONFIG_WRITE_WORD(EMSAR1,
- ( (CFG_BANK0_START & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) |
- (((CFG_BANK1_START & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 8) |
- (((CFG_BANK2_START & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 16) |
- (((CFG_BANK3_START & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 24));
- CONFIG_WRITE_WORD(MSAR2,
- ( (CFG_BANK4_START & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) |
- (((CFG_BANK5_START & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 8) |
- (((CFG_BANK6_START & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 16) |
- (((CFG_BANK7_START & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 24));
- CONFIG_WRITE_WORD(EMSAR2,
- ( (CFG_BANK4_START & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) |
- (((CFG_BANK5_START & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 8) |
- (((CFG_BANK6_START & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 16) |
- (((CFG_BANK7_START & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 24));
- CONFIG_WRITE_WORD(MEAR1,
- ( (CFG_BANK0_END & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) |
- (((CFG_BANK1_END & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 8) |
- (((CFG_BANK2_END & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 16) |
- (((CFG_BANK3_END & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 24));
- CONFIG_WRITE_WORD(EMEAR1,
- ( (CFG_BANK0_END & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) |
- (((CFG_BANK1_END & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 8) |
- (((CFG_BANK2_END & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 16) |
- (((CFG_BANK3_END & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 24));
- CONFIG_WRITE_WORD(MEAR2,
- ( (CFG_BANK4_END & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) |
- (((CFG_BANK5_END & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 8) |
- (((CFG_BANK6_END & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 16) |
- (((CFG_BANK7_END & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) << 24));
- CONFIG_WRITE_WORD(EMEAR2,
- ( (CFG_BANK4_END & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) |
- (((CFG_BANK5_END & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 8) |
- (((CFG_BANK6_END & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 16) |
- (((CFG_BANK7_END & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) << 24));
-
- CONFIG_WRITE_BYTE(ODCR, CFG_ODCR);
-#ifdef CFG_DLL_MAX_DELAY
- CONFIG_WRITE_BYTE(MIOCR1, CFG_DLL_MAX_DELAY); /* needed to make DLL lock */
-#endif
-#if defined(CFG_DLL_EXTEND) && defined(CFG_PCI_HOLD_DEL)
- CONFIG_WRITE_BYTE(PMCR2, CFG_DLL_EXTEND | CFG_PCI_HOLD_DEL);
-#endif
-#if defined(MIOCR2) && defined(CFG_SDRAM_DSCD)
- CONFIG_WRITE_BYTE(MIOCR2, CFG_SDRAM_DSCD); /* change memory input */
-#endif /* setup & hold time */
-
- CONFIG_WRITE_BYTE(MBER,
- CFG_BANK0_ENABLE |
- (CFG_BANK1_ENABLE << 1) |
- (CFG_BANK2_ENABLE << 2) |
- (CFG_BANK3_ENABLE << 3) |
- (CFG_BANK4_ENABLE << 4) |
- (CFG_BANK5_ENABLE << 5) |
- (CFG_BANK6_ENABLE << 6) |
- (CFG_BANK7_ENABLE << 7));
-
-#ifdef CFG_PGMAX
- CONFIG_WRITE_BYTE(MPMR, CFG_PGMAX);
-#endif
-
- /* ! Wait 200us before initialize other registers */
- /*FIXME: write a decent udelay wait */
- __asm__ __volatile__(
- " mtctr %0 \n \
- 0: bdnz 0b\n"
- :
- : "r" (0x10000));
-
- CONFIG_READ_WORD(MCCR1, val);
- CONFIG_WRITE_WORD(MCCR1, val | MCCR1_MEMGO); /* set memory access going */
- __asm__ __volatile__("eieio");
-
-#endif /* !CONFIG_MOUSSE && !CONFIG_BMW */
-}
-
-
-#ifdef CONFIG_MOUSSE
-#ifdef INCLUDE_MPC107_REPORT
-struct MPC107_s {
- unsigned int iobase;
- char desc[120];
-} MPC107Regs[] = {
- { BMC_BASE + 0x00, "MPC107 Vendor/Device ID" },
- { BMC_BASE + 0x04, "MPC107 PCI Command/Status Register" },
- { BMC_BASE + 0x08, "MPC107 Revision" },
- { BMC_BASE + 0x0C, "MPC107 Cache Line Size" },
- { BMC_BASE + 0x10, "MPC107 LMBAR" },
- { BMC_BASE + 0x14, "MPC824x PCSR" },
- { BMC_BASE + 0xA8, "MPC824x PICR1" },
- { BMC_BASE + 0xAC, "MPC824x PICR2" },
- { BMC_BASE + 0x46, "MPC824x PACR" },
- { BMC_BASE + 0x310, "MPC824x ITWR" },
- { BMC_BASE + 0x300, "MPC824x OMBAR" },
- { BMC_BASE + 0x308, "MPC824x OTWR" },
- { BMC_BASE + 0x14, "MPC107 Peripheral Control and Status Register" },
- { BMC_BASE + 0x78, "MPC107 EUMBAR" },
- { BMC_BASE + 0xC0, "MPC107 Processor Bus Error Status" },
- { BMC_BASE + 0xC4, "MPC107 PCI Bus Error Status" },
- { BMC_BASE + 0xC8, "MPC107 Processor/PCI Error Address" },
- { BMC_BASE + 0xE0, "MPC107 AMBOR Register" },
- { BMC_BASE + 0xF0, "MPC107 MCCR1 Register" },
- { BMC_BASE + 0xF4, "MPC107 MCCR2 Register" },
- { BMC_BASE + 0xF8, "MPC107 MCCR3 Register" },
- { BMC_BASE + 0xFC, "MPC107 MCCR4 Register" },
-};
-#define N_MPC107_Regs (sizeof(MPC107Regs)/sizeof(MPC107Regs[0]))
-#endif /* INCLUDE_MPC107_REPORT */
-#endif /* CONFIG_MOUSSE */
-
-/*
- * initialize higher level parts of CPU like time base and timers
- */
-int cpu_init_r (void)
-{
-#ifdef CONFIG_MOUSSE
-#ifdef INCLUDE_MPC107_REPORT
- unsigned int tmp = 0, i;
-#endif
- /*
- * Initialize the EUMBBAR (Embedded Util Mem Block Base Addr Reg).
- * This is necessary before the EPIC, DMA ctlr, I2C ctlr, etc. can
- * be accessed.
- */
-
-#ifdef CONFIG_MPC8240 /* only on MPC8240 */
- mpc824x_mpc107_setreg (EUMBBAR, EUMBBAR_VAL);
- /* MOT/SPS: Issue #10002, PCI (FD Alias enable) */
- mpc824x_mpc107_setreg (AMBOR, 0x000000C0);
-#endif
-
-
-#ifdef INCLUDE_MPC107_REPORT
- /* Check MPC824x PCI Device and Vendor ID */
- while ((tmp = mpc824x_mpc107_getreg (BMC_BASE)) != 0x31057) {
- printf (" MPC107: offset=0x%x, val = 0x%x\n",
- BMC_BASE,
- tmp);
- }
-
- for (i = 0; i < N_MPC107_Regs; i++) {
- printf (" 0x%x/%s = 0x%x\n",
- MPC107Regs[i].iobase,
- MPC107Regs[i].desc,
- mpc824x_mpc107_getreg (MPC107Regs[i].iobase));
- }
-
- printf ("IBAT0L = 0x%08X\n", mfspr (IBAT0L));
- printf ("IBAT0U = 0x%08X\n", mfspr (IBAT0U));
- printf ("IBAT1L = 0x%08X\n", mfspr (IBAT1L));
- printf ("IBAT1U = 0x%08X\n", mfspr (IBAT1U));
- printf ("IBAT2L = 0x%08X\n", mfspr (IBAT2L));
- printf ("IBAT2U = 0x%08X\n", mfspr (IBAT2U));
- printf ("IBAT3L = 0x%08X\n", mfspr (IBAT3L));
- printf ("IBAT3U = 0x%08X\n", mfspr (IBAT3U));
- printf ("DBAT0L = 0x%08X\n", mfspr (DBAT0L));
- printf ("DBAT0U = 0x%08X\n", mfspr (DBAT0U));
- printf ("DBAT1L = 0x%08X\n", mfspr (DBAT1L));
- printf ("DBAT1U = 0x%08X\n", mfspr (DBAT1U));
- printf ("DBAT2L = 0x%08X\n", mfspr (DBAT2L));
- printf ("DBAT2U = 0x%08X\n", mfspr (DBAT2U));
- printf ("DBAT3L = 0x%08X\n", mfspr (DBAT3L));
- printf ("DBAT3U = 0x%08X\n", mfspr (DBAT3U));
-#endif /* INCLUDE_MPC107_REPORT */
-#endif /* CONFIG_MOUSSE */
- return (0);
-}
diff --git a/cpu/mpc824x/drivers/epic.h b/cpu/mpc824x/drivers/epic.h
deleted file mode 100644
index 2803f631cf..0000000000
--- a/cpu/mpc824x/drivers/epic.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "epic/epic.h"
diff --git a/cpu/mpc824x/drivers/epic/README b/cpu/mpc824x/drivers/epic/README
deleted file mode 100644
index 57989969b9..0000000000
--- a/cpu/mpc824x/drivers/epic/README
+++ /dev/null
@@ -1,102 +0,0 @@
-CONTENT:
-
- epic.h
- epic1.c
- epic2.s
-
-WHAT ARE THESE FILES:
-
-These files contain MPC8240 (Kahlua) EPIC
-driver routines. The driver routines are not
-written for any specific operating system.
-They serves the purpose of code sample, and
-jump-start for using the MPC8240 EPIC unit.
-
-For the reason of correctness of C language
-syntax, these files are compiled by Metaware
-C compiler and assembler.
-
-ENDIAN NOTATION:
-
-The algorithm is designed for big-endian mode,
-software is responsible for byte swapping.
-
-USAGE:
-
-1. The host system that is running on MPC8240
- shall link the files listed here. The memory
- location of driver routines shall take into
- account of that driver routines need to run
- in supervisor mode and they process external
- interrupts.
-
- The routine epic_exception shall be called by
- exception vector at location 0x500, i.e.,
- 603e core external exception vector.
-
-2. The host system is responsible for configuring
- the MPC8240 including Embedded Utilities Memory
- Block. All EPIC driver functions require the
- content of Embedded Utilities Memory Block
- Base Address Register, EUMBBAR, as the first
- parameter.
-
-3. Before EPIC unit of MPC8240 can be used,
- initialize EPIC unit by calling epicInit
- with the corresponding parameters.
-
- The initialization shall disable the 603e
- core External Exception by calling CoreExtIntDisable( ).
- Next, call epicInit( ). Last, enable the 603e core
- External Exception by calling CoreExtIntEnable( ).
-
-4. After EPIC unit has been successfully initialized,
- epicIntSourceSet( ) shall be used to register each
- external interrupt source. Anytime, an external
- interrupt source can be disabled or enabled by
- calling corresponding function, epicIntDisable( ),
- or epicIntEnable( ).
-
- Global Timers' resource, base count and frequency,
- can be changed by calling epicTmFrequencySet( )
- and epicTmBaseSet( ).
-
- To stop counting a specific global timer, use
- the function, epicTmInhibit while epicTmEnable
- can be used to start counting a timer.
-
-5. To mask a set of external interrupts that are
- are certain level below, epicIntPrioritySet( )
- can be used. For example, if the processor's
- current task priority register is set to 0x7,
- only interrupts of priority 0x8 or higher will
- be passed to the processor.
-
- Be careful when using this function. It may
- corrupt the current interrupt pending, selector,
- and request registers, resulting an invalid vetor.
-
- After enabling an interrupt, disable it may also
- cause an invalid vector. User may consider using
- the spurious vector interrupt service routine to
- handle this case.
-
-6. The EPIC driver routines contains a set
- of utilities, Set and Get, for host system
- to query and modify the desired EPIC source
- registers.
-
-7. Each external interrupt source shall register
- its interrupt service routine. The routine
- shall contain all interrupt source specific
- processes and keep as short as possible.
-
- Special customized end of interrupt routine
- is optional. If it is needed, it shall contain
- the external interrupt source specific end of
- interrupt process.
-
- External interrupt exception vector at 0x500
- shall always call the epicEOI just before
- rfi instruction. Refer to the routine,
- epic_exception, for a code sample.
diff --git a/cpu/mpc824x/drivers/epic/epic.h b/cpu/mpc824x/drivers/epic/epic.h
deleted file mode 100644
index 58f81c5dfd..0000000000
--- a/cpu/mpc824x/drivers/epic/epic.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*********************************************************************
- * mpc8240epic.h - EPIC module of the MPC8240 micro-controller
- *
- * Copyrigh 1999 Motorola Inc.
- *
- * Modification History:
- * =====================
- * 01a,04Feb99,My Created.
- * 15Nov200, robt -modified to use in U-Boot
- *
-*/
-
-#ifndef __INCEPICh
-#define __INCEPICh
-
-#define ULONG unsigned long
-#define MAXVEC 20
-#define MAXIRQ 5 /* IRQs */
-#define EPIC_DIRECT_IRQ 0 /* Direct interrupt type */
-
-/* EPIC register addresses */
-
-#define EPIC_EUMBBAR 0x40000 /* EUMBBAR of EPIC */
-#define EPIC_FEATURES_REG (EPIC_EUMBBAR + 0x01000)/* Feature reporting */
-#define EPIC_GLOBAL_REG (EPIC_EUMBBAR + 0x01020)/* Global config. */
-#define EPIC_INT_CONF_REG (EPIC_EUMBBAR + 0x01030)/* Interrupt config. */
-#define EPIC_VENDOR_ID_REG (EPIC_EUMBBAR + 0x01080)/* Vendor id */
-#define EPIC_PROC_INIT_REG (EPIC_EUMBBAR + 0x01090)/* Processor init. */
-#define EPIC_SPUR_VEC_REG (EPIC_EUMBBAR + 0x010e0)/* Spurious vector */
-#define EPIC_TM_FREQ_REG (EPIC_EUMBBAR + 0x010f0)/* Timer Frequency */
-
-#define EPIC_TM0_CUR_COUNT_REG (EPIC_EUMBBAR + 0x01100)/* Gbl TM0 Cur. Count*/
-#define EPIC_TM0_BASE_COUNT_REG (EPIC_EUMBBAR + 0x01110)/* Gbl TM0 Base Count*/
-#define EPIC_TM0_VEC_REG (EPIC_EUMBBAR + 0x01120)/* Gbl TM0 Vector Pri*/
-#define EPIC_TM0_DES_REG (EPIC_EUMBBAR + 0x01130)/* Gbl TM0 Dest. */
-
-#define EPIC_TM1_CUR_COUNT_REG (EPIC_EUMBBAR + 0x01140)/* Gbl TM1 Cur. Count*/
-#define EPIC_TM1_BASE_COUNT_REG (EPIC_EUMBBAR + 0x01150)/* Gbl TM1 Base Count*/
-#define EPIC_TM1_VEC_REG (EPIC_EUMBBAR + 0x01160)/* Gbl TM1 Vector Pri*/
-#define EPIC_TM1_DES_REG (EPIC_EUMBBAR + 0x01170)/* Gbl TM1 Dest. */
-
-#define EPIC_TM2_CUR_COUNT_REG (EPIC_EUMBBAR + 0x01180)/* Gbl TM2 Cur. Count*/
-#define EPIC_TM2_BASE_COUNT_REG (EPIC_EUMBBAR + 0x01190)/* Gbl TM2 Base Count*/
-#define EPIC_TM2_VEC_REG (EPIC_EUMBBAR + 0x011a0)/* Gbl TM2 Vector Pri*/
-#define EPIC_TM2_DES_REG (EPIC_EUMBBAR + 0x011b0)/* Gbl TM2 Dest */
-
-#define EPIC_TM3_CUR_COUNT_REG (EPIC_EUMBBAR + 0x011c0)/* Gbl TM3 Cur. Count*/
-#define EPIC_TM3_BASE_COUNT_REG (EPIC_EUMBBAR + 0x011d0)/* Gbl TM3 Base Count*/
-#define EPIC_TM3_VEC_REG (EPIC_EUMBBAR + 0x011e0)/* Gbl TM3 Vector Pri*/
-#define EPIC_TM3_DES_REG (EPIC_EUMBBAR + 0x011f0)/* Gbl TM3 Dest. */
-
-#define EPIC_EX_INT0_VEC_REG (EPIC_EUMBBAR + 0x10200)/* Ext. Int. Sr0 Des */
-#define EPIC_EX_INT0_DES_REG (EPIC_EUMBBAR + 0x10210)/* Ext. Int. Sr0 Vect*/
-#define EPIC_EX_INT1_VEC_REG (EPIC_EUMBBAR + 0x10220)/* Ext. Int. Sr1 Des */
-#define EPIC_EX_INT1_DES_REG (EPIC_EUMBBAR + 0x10230)/* Ext. Int. Sr1 Vect*/
-#define EPIC_EX_INT2_VEC_REG (EPIC_EUMBBAR + 0x10240)/* Ext. Int. Sr2 Des */
-#define EPIC_EX_INT2_DES_REG (EPIC_EUMBBAR + 0x10250)/* Ext. Int. Sr2 Vect*/
-#define EPIC_EX_INT3_VEC_REG (EPIC_EUMBBAR + 0x10260)/* Ext. Int. Sr3 Des */
-#define EPIC_EX_INT3_DES_REG (EPIC_EUMBBAR + 0x10270)/* Ext. Int. Sr3 Vect*/
-#define EPIC_EX_INT4_VEC_REG (EPIC_EUMBBAR + 0x10280)/* Ext. Int. Sr4 Des */
-#define EPIC_EX_INT4_DES_REG (EPIC_EUMBBAR + 0x10290)/* Ext. Int. Sr4 Vect*/
-
-#define EPIC_SR_INT0_VEC_REG (EPIC_EUMBBAR + 0x10200)/* Sr. Int. Sr0 Des */
-#define EPIC_SR_INT0_DES_REG (EPIC_EUMBBAR + 0x10210)/* Sr. Int. Sr0 Vect */
-#define EPIC_SR_INT1_VEC_REG (EPIC_EUMBBAR + 0x10220)/* Sr. Int. Sr1 Des */
-#define EPIC_SR_INT1_DES_REG (EPIC_EUMBBAR + 0x10230)/* Sr. Int. Sr1 Vect.*/
-#define EPIC_SR_INT2_VEC_REG (EPIC_EUMBBAR + 0x10240)/* Sr. Int. Sr2 Des */
-#define EPIC_SR_INT2_DES_REG (EPIC_EUMBBAR + 0x10250)/* Sr. Int. Sr2 Vect.*/
-#define EPIC_SR_INT3_VEC_REG (EPIC_EUMBBAR + 0x10260)/* Sr. Int. Sr3 Des */
-#define EPIC_SR_INT3_DES_REG (EPIC_EUMBBAR + 0x10270)/* Sr. Int. Sr3 Vect.*/
-#define EPIC_SR_INT4_VEC_REG (EPIC_EUMBBAR + 0x10280)/* Sr. Int. Sr4 Des */
-#define EPIC_SR_INT4_DES_REG (EPIC_EUMBBAR + 0x10290)/* Sr. Int. Sr4 Vect.*/
-
-#define EPIC_SR_INT5_VEC_REG (EPIC_EUMBBAR + 0x102a0)/* Sr. Int. Sr5 Des */
-#define EPIC_SR_INT5_DES_REG (EPIC_EUMBBAR + 0x102b0)/* Sr. Int. Sr5 Vect.*/
-#define EPIC_SR_INT6_VEC_REG (EPIC_EUMBBAR + 0x102c0)/* Sr. Int. Sr6 Des */
-#define EPIC_SR_INT6_DES_REG (EPIC_EUMBBAR + 0x102d0)/* Sr. Int. Sr6 Vect.*/
-#define EPIC_SR_INT7_VEC_REG (EPIC_EUMBBAR + 0x102e0)/* Sr. Int. Sr7 Des */
-#define EPIC_SR_INT7_DES_REG (EPIC_EUMBBAR + 0x102f0)/* Sr. Int. Sr7 Vect.*/
-#define EPIC_SR_INT8_VEC_REG (EPIC_EUMBBAR + 0x10300)/* Sr. Int. Sr8 Des */
-#define EPIC_SR_INT8_DES_REG (EPIC_EUMBBAR + 0x10310)/* Sr. Int. Sr8 Vect.*/
-#define EPIC_SR_INT9_VEC_REG (EPIC_EUMBBAR + 0x10320)/* Sr. Int. Sr9 Des */
-#define EPIC_SR_INT9_DES_REG (EPIC_EUMBBAR + 0x10330)/* Sr. Int. Sr9 Vect.*/
-
-#define EPIC_SR_INT10_VEC_REG (EPIC_EUMBBAR + 0x10340)/* Sr. Int. Sr10 Des */
-#define EPIC_SR_INT10_DES_REG (EPIC_EUMBBAR + 0x10350)/* Sr. Int. Sr10 Vect*/
-#define EPIC_SR_INT11_VEC_REG (EPIC_EUMBBAR + 0x10360)/* Sr. Int. Sr11 Des */
-#define EPIC_SR_INT11_DES_REG (EPIC_EUMBBAR + 0x10370)/* Sr. Int. Sr11 Vect*/
-#define EPIC_SR_INT12_VEC_REG (EPIC_EUMBBAR + 0x10380)/* Sr. Int. Sr12 Des */
-#define EPIC_SR_INT12_DES_REG (EPIC_EUMBBAR + 0x10390)/* Sr. Int. Sr12 Vect*/
-#define EPIC_SR_INT13_VEC_REG (EPIC_EUMBBAR + 0x103a0)/* Sr. Int. Sr13 Des */
-#define EPIC_SR_INT13_DES_REG (EPIC_EUMBBAR + 0x103b0)/* Sr. Int. Sr13 Vect*/
-#define EPIC_SR_INT14_VEC_REG (EPIC_EUMBBAR + 0x103c0)/* Sr. Int. Sr14 Des */
-#define EPIC_SR_INT14_DES_REG (EPIC_EUMBBAR + 0x103d0)/* Sr. Int. Sr14 Vect*/
-#define EPIC_SR_INT15_VEC_REG (EPIC_EUMBBAR + 0x103e0)/* Sr. Int. Sr15 Des */
-#define EPIC_SR_INT15_DES_REG (EPIC_EUMBBAR + 0x103f0)/* Sr. Int. Sr15 Vect*/
-
-#define EPIC_I2C_INT_VEC_REG (EPIC_EUMBBAR + 0x11020)/* I2C Int. Vect Pri.*/
-#define EPIC_I2C_INT_DES_REG (EPIC_EUMBBAR + 0x11030)/* I2C Int. Dest */
-#define EPIC_DMA0_INT_VEC_REG (EPIC_EUMBBAR + 0x11040)/* DMA0 Int. Vect Pri*/
-#define EPIC_DMA0_INT_DES_REG (EPIC_EUMBBAR + 0x11050)/* DMA0 Int. Dest */
-#define EPIC_DMA1_INT_VEC_REG (EPIC_EUMBBAR + 0x11060)/* DMA1 Int. Vect Pri*/
-#define EPIC_DMA1_INT_DES_REG (EPIC_EUMBBAR + 0x11070)/* DMA1 Int. Dest */
-#define EPIC_MSG_INT_VEC_REG (EPIC_EUMBBAR + 0x110c0)/* Msg Int. Vect Pri*/
-#define EPIC_MSG_INT_DES_REG (EPIC_EUMBBAR + 0x110d0)/* Msg Int. Dest */
-
-#define EPIC_PROC_CTASK_PRI_REG (EPIC_EUMBBAR + 0x20080)/* Proc. current task*/
-#define EPIC_PROC_INT_ACK_REG (EPIC_EUMBBAR + 0x200a0)/* Int. acknowledge */
-#define EPIC_PROC_EOI_REG (EPIC_EUMBBAR + 0x200b0)/* End of interrupt */
-
-#define EPIC_VEC_PRI_MASK 0x80000000 /* Mask Interrupt bit in IVPR */
-#define EPIC_VEC_PRI_DFLT_PRI 8 /* Interrupt Priority in IVPR */
-
-/* Error code */
-
-#define OK 0
-#define ERROR -1
-
-/* function prototypes */
-
-void epicVendorId( unsigned int *step,
- unsigned int *devId,
- unsigned int *venId
- );
-void epicFeatures( unsigned int *noIRQs,
- unsigned int *noCPUs,
- unsigned int *VerId );
-extern void epicInit( unsigned int IRQType, unsigned int clkRatio);
-ULONG sysEUMBBARRead ( ULONG regNum );
-void sysEUMBBARWrite ( ULONG regNum, ULONG regVal);
-extern void epicTmFrequencySet( unsigned int frq );
-extern unsigned int epicTmFrequencyGet(void);
-extern unsigned int epicTmBaseSet( ULONG srcAddr,
- unsigned int cnt,
- unsigned int inhibit );
-extern unsigned int epicTmBaseGet ( ULONG srcAddr, unsigned int *val );
-extern unsigned int epicTmCountGet( ULONG srcAddr, unsigned int *val );
-extern unsigned int epicTmInhibit( unsigned int timer );
-extern unsigned int epicTmEnable( ULONG srcAdr );
-extern void CoreExtIntEnable(void); /* Enable 603e external interrupts */
-extern void CoreExtIntDisable(void); /* Disable 603e external interrupts */
-extern unsigned char epicIntTaskGet(void);
-extern void epicIntTaskSet( unsigned char val );
-extern unsigned int epicIntAck(void);
-extern void epicSprSet( unsigned int eumbbar, unsigned char );
-extern void epicConfigGet( unsigned int *clkRatio,
- unsigned int *serEnable );
-extern void SrcVecTableInit(void);
-extern unsigned int epicModeGet(void);
-extern void epicIntEnable(int Vect);
-extern void epicIntDisable(int Vect);
-extern int epicIntSourceConfig(int Vect, int Polarity, int Sense, int Prio);
-extern unsigned int epicIntAck(void);
-extern void epicEOI(void);
-extern int epicCurTaskPrioSet(int Vect);
-
-struct SrcVecTable
- {
- ULONG srcAddr;
- char srcName[40];
- };
-
-#endif /* EPIC_H */
diff --git a/cpu/mpc824x/drivers/epic/epic1.c b/cpu/mpc824x/drivers/epic/epic1.c
deleted file mode 100644
index f89deed538..0000000000
--- a/cpu/mpc824x/drivers/epic/epic1.c
+++ /dev/null
@@ -1,517 +0,0 @@
-/**************************************************
- *
- * copyright @ motorola, 1999
- *
- *************************************************/
-#include <mpc824x.h>
-#include <common.h>
-#include "epic.h"
-
-
-#define PRINT(format, args...) printf(format , ## args)
-
-typedef void (*VOIDFUNCPTR) (void); /* ptr to function returning void */
-struct SrcVecTable SrcVecTable[MAXVEC] = /* Addr/Vector cross-reference tbl */
- {
- { EPIC_EX_INT0_VEC_REG, "External Direct/Serial Source 0"},
- { EPIC_EX_INT1_VEC_REG, "External Direct/Serial Source 1"},
- { EPIC_EX_INT2_VEC_REG, "External Direct/Serial Source 2"},
- { EPIC_EX_INT3_VEC_REG, "External Direct/Serial Source 3"},
- { EPIC_EX_INT4_VEC_REG, "External Direct/Serial Source 4"},
-
- { EPIC_SR_INT5_VEC_REG, "External Serial Source 5"},
- { EPIC_SR_INT6_VEC_REG, "External Serial Source 6"},
- { EPIC_SR_INT7_VEC_REG, "External Serial Source 7"},
- { EPIC_SR_INT8_VEC_REG, "External Serial Source 8"},
- { EPIC_SR_INT9_VEC_REG, "External Serial Source 9"},
- { EPIC_SR_INT10_VEC_REG, "External Serial Source 10"},
- { EPIC_SR_INT11_VEC_REG, "External Serial Source 11"},
- { EPIC_SR_INT12_VEC_REG, "External Serial Source 12"},
- { EPIC_SR_INT13_VEC_REG, "External Serial Source 13"},
- { EPIC_SR_INT14_VEC_REG, "External Serial Source 14"},
- { EPIC_SR_INT15_VEC_REG, "External Serial Source 15"},
-
- { EPIC_I2C_INT_VEC_REG, "Internal I2C Source"},
- { EPIC_DMA0_INT_VEC_REG, "Internal DMA0 Source"},
- { EPIC_DMA1_INT_VEC_REG, "Internal DMA1 Source"},
- { EPIC_MSG_INT_VEC_REG, "Internal Message Source"},
- };
-
-VOIDFUNCPTR intVecTbl[MAXVEC]; /* Interrupt vector table */
-
-
-/****************************************************************************
-* epicInit - Initialize the EPIC registers
-*
-* This routine resets the Global Configuration Register, thus it:
-* - Disables all interrupts
-* - Sets epic registers to reset values
-* - Sets the value of the Processor Current Task Priority to the
-* highest priority (0xF).
-* epicInit then sets the EPIC operation mode to Mixed Mode (vs. Pass
-* Through or 8259 compatible mode).
-*
-* If IRQType (input) is Direct IRQs:
-* - IRQType is written to the SIE bit of the EPIC Interrupt
-* Configuration register (ICR).
-* - clkRatio is ignored.
-* If IRQType is Serial IRQs:
-* - both IRQType and clkRatio will be written to the ICR register
-*/
-
-void epicInit
- (
- unsigned int IRQType, /* Direct or Serial */
- unsigned int clkRatio /* Clk Ratio for Serial IRQs */
- )
- {
- ULONG tmp;
-
- tmp = sysEUMBBARRead(EPIC_GLOBAL_REG);
- tmp |= 0xa0000000; /* Set the Global Conf. register */
- sysEUMBBARWrite(EPIC_GLOBAL_REG, tmp);
- /*
- * Wait for EPIC to reset - CLH
- */
- while( (sysEUMBBARRead(EPIC_GLOBAL_REG) & 0x80000000) == 1);
- sysEUMBBARWrite(EPIC_GLOBAL_REG, 0x20000000);
- tmp = sysEUMBBARRead(EPIC_INT_CONF_REG); /* Read interrupt conf. reg */
-
- if (IRQType == EPIC_DIRECT_IRQ) /* direct mode */
- sysEUMBBARWrite(EPIC_INT_CONF_REG, tmp & 0xf7ffffff);
- else /* Serial mode */
- {
- tmp = (clkRatio << 28) | 0x08000000; /* Set clock ratio */
- sysEUMBBARWrite(EPIC_INT_CONF_REG, tmp);
- }
-
- while (epicIntAck() != 0xff) /* Clear all pending interrupts */
- epicEOI();
-}
-
-/****************************************************************************
- * epicIntEnable - Enable an interrupt source
- *
- * This routine clears the mask bit of an external, an internal or
- * a Timer register to enable the interrupt.
- *
- * RETURNS: None
- */
-void epicIntEnable(int intVec)
-{
- ULONG tmp;
- ULONG srAddr;
-
- srAddr = SrcVecTable[intVec].srcAddr; /* Retrieve src Vec/Prio register */
- tmp = sysEUMBBARRead(srAddr);
- tmp &= ~EPIC_VEC_PRI_MASK; /* Clear the mask bit */
- tmp |= (EPIC_VEC_PRI_DFLT_PRI << 16); /* Set priority to Default - CLH */
- tmp |= intVec; /* Set Vector number */
- sysEUMBBARWrite(srAddr, tmp);
-
- return;
- }
-
-/****************************************************************************
- * epicIntDisable - Disable an interrupt source
- *
- * This routine sets the mask bit of an external, an internal or
- * a Timer register to disable the interrupt.
- *
- * RETURNS: OK or ERROR
- *
- */
-
-void epicIntDisable
- (
- int intVec /* Interrupt vector number */
- )
- {
-
- ULONG tmp, srAddr;
-
- srAddr = SrcVecTable[intVec].srcAddr;
- tmp = sysEUMBBARRead(srAddr);
- tmp |= 0x80000000; /* Set the mask bit */
- sysEUMBBARWrite(srAddr, tmp);
- return;
- }
-
-/****************************************************************************
- * epicIntSourceConfig - Set properties of an interrupt source
- *
- * This function sets interrupt properites (Polarity, Sense, Interrupt
- * Prority, and Interrupt Vector) of an Interrupt Source. The properties
- * can be set when the current source is not in-request or in-service,
- * which is determined by the Activity bit. This routine return ERROR
- * if the the Activity bit is 1 (in-request or in-service).
- *
- * This function assumes that the Source Vector/Priority register (input)
- * is a valid address.
- *
- * RETURNS: OK or ERROR
- */
-
-int epicIntSourceConfig
- (
- int Vect, /* interrupt source vector number */
- int Polarity, /* interrupt source polarity */
- int Sense, /* interrupt source Sense */
- int Prio /* interrupt source priority */
- )
-
- {
- ULONG tmp, newVal;
- ULONG actBit, srAddr;
-
- srAddr = SrcVecTable[Vect].srcAddr;
- tmp = sysEUMBBARRead(srAddr);
- actBit = (tmp & 40000000) >> 30; /* retrieve activity bit - bit 30 */
- if (actBit == 1)
- return ERROR;
-
- tmp &= 0xff30ff00; /* Erase previously set P,S,Prio,Vector bits */
- newVal = (Polarity << 23) | (Sense << 22) | (Prio << 16) | Vect;
- sysEUMBBARWrite(srAddr, tmp | newVal );
- return (OK);
- }
-
-/****************************************************************************
- * epicIntAck - acknowledge an interrupt
- *
- * This function reads the Interrupt acknowldge register and return
- * the vector number of the highest pending interrupt.
- *
- * RETURNS: Interrupt Vector number.
- */
-
-unsigned int epicIntAck(void)
-{
- return(sysEUMBBARRead( EPIC_PROC_INT_ACK_REG ));
-}
-
-/****************************************************************************
- * epicEOI - signal an end of interrupt
- *
- * This function writes 0x0 to the EOI register to signal end of interrupt.
- * It is usually called after an interrupt routine is served.
- *
- * RETURNS: None
- */
-
-void epicEOI(void)
- {
- sysEUMBBARWrite(EPIC_PROC_EOI_REG, 0x0);
- }
-
-/****************************************************************************
- * epicCurTaskPrioSet - sets the priority of the Processor Current Task
- *
- * This function should be called after epicInit() to lower the priority
- * of the processor current task.
- *
- * RETURNS: OK or ERROR
- */
-
-int epicCurTaskPrioSet
- (
- int prioNum /* New priority value */
- )
- {
-
- if ( (prioNum < 0) || (prioNum > 0xF))
- return ERROR;
- sysEUMBBARWrite(EPIC_PROC_CTASK_PRI_REG, prioNum);
- return OK;
- }
-
-
-/************************************************************************
- * function: epicIntTaskGet
- *
- * description: Get value of processor current interrupt task priority register
- *
- * note:
- ***********************************************************************/
-unsigned char epicIntTaskGet()
-{
- /* get the interrupt task priority register */
- ULONG reg;
- unsigned char rec;
-
- reg = sysEUMBBARRead( EPIC_PROC_CTASK_PRI_REG );
- rec = ( reg & 0x0F );
- return rec;
-}
-
-
-/**************************************************************
- * function: epicISR
- *
- * description: EPIC service routine called by the core exception
- * at 0x500
- *
- * note:
- **************************************************************/
-unsigned int epicISR(void)
-{
- return 0;
-}
-
-
-/************************************************************
- * function: epicModeGet
- *
- * description: query EPIC mode, return 0 if pass through mode
- * return 1 if mixed mode
- *
- * note:
- *************************************************************/
-unsigned int epicModeGet(void)
-{
- ULONG val;
-
- val = sysEUMBBARRead( EPIC_GLOBAL_REG );
- return (( val & 0x20000000 ) >> 29);
-}
-
-
-/*********************************************
- * function: epicConfigGet
- *
- * description: Get the EPIC interrupt Configuration
- * return 0 if not error, otherwise return 1
- *
- * note:
- ********************************************/
-void epicConfigGet( unsigned int *clkRatio, unsigned int *serEnable)
-{
- ULONG val;
-
- val = sysEUMBBARRead( EPIC_INT_CONF_REG );
- *clkRatio = ( val & 0x70000000 ) >> 28;
- *serEnable = ( val & 0x8000000 ) >> 27;
-}
-
-
-/*******************************************************************
- * sysEUMBBARRead - Read a 32-bit EUMBBAR register
- *
- * This routine reads the content of a register in the Embedded
- * Utilities Memory Block, and swaps to big endian before returning
- * the value.
- *
- * RETURNS: The content of the specified EUMBBAR register.
- */
-
-ULONG sysEUMBBARRead
- (
- ULONG regNum
- )
- {
- ULONG temp;
-
- temp = *(ULONG *) (CFG_EUMB_ADDR + regNum);
- return ( LONGSWAP(temp));
- }
-
-/*******************************************************************
- * sysEUMBBARWrite - Write a 32-bit EUMBBAR register
- *
- * This routine swaps the value to little endian then writes it to
- * a register in the Embedded Utilities Memory Block address space.
- *
- * RETURNS: N/A
- */
-
-void sysEUMBBARWrite
- (
- ULONG regNum, /* EUMBBAR register address */
- ULONG regVal /* Value to be written */
- )
- {
-
- *(ULONG *) (CFG_EUMB_ADDR + regNum) = LONGSWAP(regVal);
- return ;
- }
-
-
-/********************************************************
- * function: epicVendorId
- *
- * description: return the EPIC Vendor Identification
- * register:
- *
- * siliccon version, device id, and vendor id
- *
- * note:
- ********************************************************/
-void epicVendorId
- (
- unsigned int *step,
- unsigned int *devId,
- unsigned int *venId
- )
- {
- ULONG val;
- val = sysEUMBBARRead( EPIC_VENDOR_ID_REG );
- *step = ( val & 0x00FF0000 ) >> 16;
- *devId = ( val & 0x0000FF00 ) >> 8;
- *venId = ( val & 0x000000FF );
- }
-
-/**************************************************
- * function: epicFeatures
- *
- * description: return the number of IRQ supported,
- * number of CPU, and the version of the
- * OpenEPIC
- *
- * note:
- *************************************************/
-void epicFeatures
- (
- unsigned int *noIRQs,
- unsigned int *noCPUs,
- unsigned int *verId
- )
- {
- ULONG val;
-
- val = sysEUMBBARRead( EPIC_FEATURES_REG );
- *noIRQs = ( val & 0x07FF0000 ) >> 16;
- *noCPUs = ( val & 0x00001F00 ) >> 8;
- *verId = ( val & 0x000000FF );
-}
-
-
-/*********************************************************
- * function: epciTmFrequncySet
- *
- * description: Set the timer frequency reporting register
- ********************************************************/
-void epicTmFrequencySet( unsigned int frq )
-{
- sysEUMBBARWrite(EPIC_TM_FREQ_REG, frq);
-}
-
-/*******************************************************
- * function: epicTmFrequncyGet
- *
- * description: Get the current value of the Timer Frequency
- * Reporting register
- *
- ******************************************************/
-unsigned int epicTmFrequencyGet(void)
-{
- return( sysEUMBBARRead(EPIC_TM_FREQ_REG)) ;
-}
-
-
-/****************************************************
- * function: epicTmBaseSet
- *
- * description: Set the #n global timer base count register
- * return 0 if no error, otherwise return 1.
- *
- * note:
- ****************************************************/
-unsigned int epicTmBaseSet
- (
- ULONG srcAddr, /* Address of the Timer Base register */
- unsigned int cnt, /* Base count */
- unsigned int inhibit /* 1 - count inhibit */
- )
-{
-
- unsigned int val = 0x80000000;
- /* First inhibit counting the timer */
- sysEUMBBARWrite(srcAddr, val) ;
-
- /* set the new value */
- val = (cnt & 0x7fffffff) | ((inhibit & 0x1) << 31);
- sysEUMBBARWrite(srcAddr, val) ;
- return 0;
-}
-
-/***********************************************************************
- * function: epicTmBaseGet
- *
- * description: Get the current value of the global timer base count register
- * return 0 if no error, otherwise return 1.
- *
- * note:
- ***********************************************************************/
-unsigned int epicTmBaseGet( ULONG srcAddr, unsigned int *val )
-{
- *val = sysEUMBBARRead( srcAddr );
- *val = *val & 0x7fffffff;
- return 0;
-}
-
-/***********************************************************
- * function: epicTmCountGet
- *
- * description: Get the value of a given global timer
- * current count register
- * return 0 if no error, otherwise return 1
- * note:
- **********************************************************/
-unsigned int epicTmCountGet( ULONG srcAddr, unsigned int *val )
-{
- *val = sysEUMBBARRead( srcAddr );
- *val = *val & 0x7fffffff;
- return 0;
-}
-
-
-/***********************************************************
- * function: epicTmInhibit
- *
- * description: Stop counting of a given global timer
- * return 0 if no error, otherwise return 1
- *
- * note:
- ***********************************************************/
-unsigned int epicTmInhibit( unsigned int srcAddr )
-{
- ULONG val;
-
- val = sysEUMBBARRead( srcAddr );
- val |= 0x80000000;
- sysEUMBBARWrite( srcAddr, val );
- return 0;
-}
-
-/******************************************************************
- * function: epicTmEnable
- *
- * description: Enable counting of a given global timer
- * return 0 if no error, otherwise return 1
- *
- * note:
- *****************************************************************/
-unsigned int epicTmEnable( ULONG srcAddr )
-{
- ULONG val;
-
- val = sysEUMBBARRead( srcAddr );
- val &= 0x7fffffff;
- sysEUMBBARWrite( srcAddr, val );
- return 0;
-}
-
-void epicSourcePrint(int Vect)
- {
- ULONG srcVal;
-
- srcVal = sysEUMBBARRead(SrcVecTable[Vect].srcAddr);
- PRINT("%s\n", SrcVecTable[Vect].srcName);
- PRINT("Address = 0x%lx\n", SrcVecTable[Vect].srcAddr);
- PRINT("Vector = %ld\n", (srcVal & 0x000000FF) );
- PRINT("Mask = %ld\n", srcVal >> 31);
- PRINT("Activitiy = %ld\n", (srcVal & 40000000) >> 30);
- PRINT("Polarity = %ld\n", (srcVal & 0x00800000) >> 23);
- PRINT("Sense = %ld\n", (srcVal & 0x00400000) >> 22);
- PRINT("Priority = %ld\n", (srcVal & 0x000F0000) >> 16);
- }
diff --git a/cpu/mpc824x/drivers/epic/epic2.S b/cpu/mpc824x/drivers/epic/epic2.S
deleted file mode 100644
index 8cc2fc60bb..0000000000
--- a/cpu/mpc824x/drivers/epic/epic2.S
+++ /dev/null
@@ -1,196 +0,0 @@
-/**************************************
- *
- * copyright @ Motorola, 1999
- *
- **************************************/
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-#include <asm/processor.h>
-
-/*********************************************
- * function: CoreExtIntEnable
- *
- * description: Enable 603e core external interrupt
- *
- * note: mtmsr is context-synchronization
- **********************************************/
- .text
- .align 2
- .global CoreExtIntEnable
-CoreExtIntEnable:
- mfmsr r3
-
- ori r3,r3,0x8000 /* enable external interrupt */
- mtmsr r3
-
- bclr 20, 0
-
-/*******************************************
- * function: CoreExtIntDisable
- *
- * description: Disable 603e core external interrupt
- *
- * note:
- *******************************************/
- .text
- .align 2
- .global CoreExtIntDisable
-CoreExtIntDisable:
- mfmsr r4
-
- xor r3,r3,r3
- or r3,r3,r4
-
- andis. r4,r4,0xffff
- andi. r3,r3,0x7fff /* disable external interrupt */
-
- or r3,r3,r4
- mtmsr r3
-
- bclr 20, 0
-
-/*********************************************************
- * function: epicEOI
- *
- * description: signal the EOI and restore machine status
- * Input: r3 - value of eumbbar
- * Output: r3 - value of eumbbar
- * r4 - ISR vector value
- * note:
- ********************************************************/
- .text
- .align 2
- .global epicEOI
-epicEOI:
- lis r5,0x0006 /* Build End Of Interrupt Register offset */
- ori r5,r5,0x00b0
- xor r7,r7,r7 /* Clear r7 */
- stwbrx r7,r5,r3 /* Save r7, writing to this register will
- * intidate the end of processing the
- * highest interrupt.
- */
- sync
-
- /* ---RESTORE MACHINE STATE */
- mfmsr r13 /* Clear Recoverable Interrupt bit in MSR */
- or r7,r7,r13
-
- andis. r7,r7,0xffff
- andi. r13,r13,0x7ffd /* (and disable interrupts) */
- or r13,r13,r7
- mtmsr r13
-
- lwz r13,0x1c(r1) /* pull ctr */
- mtctr r13
-
- lwz r13,0x18(r1) /* pull xer */
- mtctr r13
-
- lwz r13,0x14(r1) /* pull lr */
- mtctr r13
-
- lwz r13,0x10(r1) /* Pull SRR1 from stack */
- mtspr SRR1,r13 /* Restore SRR1 */
-
- lwz r13,0xc(r1) /* Pull SRR0 from stack */
- mtspr SRR0,r13 /* Restore SRR0 */
-
- lwz r13,0x8(r1) /* Pull User stack pointer from stack */
- mtspr SPRG1,r13 /* Restore SPRG1 */
-
- lwz r4,0x4(r1) /* vector value */
- lwz r3,0x0(r1) /* eumbbar */
- sync
-
- addi r1,r1,0x20 /* Deallocate stack */
- mtspr SPRG0,r1 /* Save updated Supervisor stack pointer */
- mfspr r1,SPRG1 /* Restore User stack pointer */
-
- bclr 20,0
-
-/***********************************************************
- * function: exception routine called by exception vector
- * at 0x500, external interrupt
- *
- * description: Kahlua EPIC controller
- *
- * input: r3 - content of eumbbar
- * output: r3 - ISR return value
- * r4 - Interrupt vector number
- * note:
- ***********************************************************/
-
- .text
- .align 2
- .global epic_exception
-
-epic_exception:
-
- /*---SAVE MACHINE STATE TO A STACK */
- mtspr SPRG1,r1 /* Save User stack pointer to SPRG1 */
- mfspr r1,SPRG0 /* Load Supervisor stack pointer into r1 */
-
- stwu r3,-0x20(r1) /* Push the value of eumbbar onto stack */
-
- mfspr r3,SPRG1 /* Push User stack pointer onto stack */
- stw r3,0x8(r1)
- mfspr r3,SRR0 /* Push SRR0 onto stack */
- stw r1,0xc(r1)
- mfspr r3,SRR1 /* Push SRR1 onto stack */
- stw r3,0x10(r1)
- mflr r3
- stw r3,0x14(r1) /* Push LR */
- mfxer r3
- stw r3,0x18(r1) /* Push Xer */
- mfctr r3
- stw r3,0x1c(r1) /* Push CTR */
-
- mtspr SPRG0,r1 /* Save updated Supervisor stack pointer
- * value to SPRG0
- */
- mfmsr r3
- ori r3,r3,0x0002 /* Set Recoverable Interrupt bit in MSR */
- mtmsr r3
-
- /* ---READ IN THE EUMBAR REGISTER */
- lwz r6,0(r1) /* this is eumbbar */
- sync
-
- /* ---READ EPIC REGISTER: PROCESSOR INTERRUPT ACKNOWLEDGE REGISTER */
- lis r5,0x0006 /* Build Interrupt Acknowledge Register
- * offset
- */
- ori r5,r5,0x00a0
- lwbrx r7,r5,r6 /* Load interrupt vector into r7 */
- sync
-
- /* --MASK OFF ALL BITS EXCEPT THE VECTOR */
- xor r3,r3,r3
- xor r4,r4,r4
- or r3, r3, r6 /* eumbbar in r3 */
- andi. r4,r7,0x00ff /* Mask off bits, vector in r4 */
-
- stw r4,0x04(r1) /* save the vector value */
-
- lis r5,epicISR@ha
- ori r5,r5,epicISR@l
- mtlr r5
- blrl
-
- xor r30,r30,r30
- or r30,r30,r3 /* save the r3 which containts the return value from epicISR */
-
- /* ---READ IN THE EUMBAR REGISTER */
- lwz r3,0(r1)
- sync
-
- lis r5,epicEOI@ha
- ori r5,r5,epicEOI@l
- mtlr r5
- blrl
-
- xor r3,r3,r3
- or r3,r3,r30 /* restore the ISR return value */
-
- bclr 20,0
diff --git a/cpu/mpc824x/drivers/epic/epicutil.S b/cpu/mpc824x/drivers/epic/epicutil.S
deleted file mode 100644
index 4877050ba4..0000000000
--- a/cpu/mpc824x/drivers/epic/epicutil.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/**************************************
- *
- * copyright @ Motorola, 1999
- *
- *
- * This file contains two commonly used
- * lower level utility routines.
- *
- * The utility routines are also in other
- * Kahlua device driver libraries. The
- * need to be linked in only once.
- **************************************/
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-/**********************************************************
- * function: load_runtime_reg
- *
- * input: r3 - value of eumbbar
- * r4 - register offset in embedded utility space
- *
- * output: r3 - register content
- **********************************************************/
- .text
- .align 2
- .global load_runtime_reg
-
-load_runtime_reg:
-
- xor r5,r5,r5
- or r5,r5,r3 /* save eumbbar */
-
- lwbrx r3,r4,r5
- sync
-
- bclr 20, 0
-
-/****************************************************************
- * function: store_runtime_reg
- *
- * input: r3 - value of eumbbar
- * r4 - register offset in embedded utility space
- * r5 - new value to be stored
- *
- ****************************************************************/
- .text
- .align 2
- .global store_runtime_reg
-store_runtime_reg:
-
- xor r0,r0,r0
-
- stwbrx r5, r4, r3
- sync
-
- bclr 20,0
diff --git a/cpu/mpc824x/drivers/errors.h b/cpu/mpc824x/drivers/errors.h
deleted file mode 100644
index 887f284fc4..0000000000
--- a/cpu/mpc824x/drivers/errors.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Copyright Motorola, Inc. 1993, 1994
- ALL RIGHTS RESERVED
-
- You are hereby granted a copyright license to use, modify, and
- distribute the SOFTWARE so long as this entire notice is retained
- without alteration in any modified and/or redistributed versions,
- and that such modified versions are clearly identified as such.
- No licenses are granted by implication, estoppel or otherwise under
- any patents or trademarks of Motorola, Inc.
-
- The SOFTWARE is provided on an "AS IS" basis and without warranty.
- To the maximum extent permitted by applicable law, MOTOROLA DISCLAIMS
- ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, INCLUDING IMPLIED
- WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
- PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH
- REGARD TO THE SOFTWARE (INCLUDING ANY MODIFIED VERSIONS
- THEREOF) AND ANY ACCOMPANYING WRITTEN MATERIALS.
-
- To the maximum extent permitted by applicable law, IN NO EVENT SHALL
- MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
- (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF
- BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
- INFORMATION, OR OTHER PECUNIARY LOSS) ARISING OF THE USE OR
- INABILITY TO USE THE SOFTWARE. Motorola assumes no responsibility
- for the maintenance and support of the SOFTWARE.
-
-*/
-
-
-#include "config.h"
-
-/*
- 1 2 3 4 5 6 7 8
-01234567890123456789012345678901234567890123456789012345678901234567890123456789
-*/
-/* List define statements here */
-
-/* These are for all the toolboxes and functions to use. These will help
-to standardize the error handling in the current project */
-
- /* this is the "data type" for the error
- messages in the system */
-#define STATUS unsigned int
-
- /* this is a success status code */
-#define SUCCESS 1
-
- /* likewise this is failure */
-#define FAILURE 0
-
-#define NUM_ERRORS 47
-
-/* This first section of "defines" are for error codes ONLY. The called
- routine will return one of these error codes to the caller. If the final
- returned code is "VALID", then everything is a-okay. However, if one
- of the functions returns a non-valid status, that error code should be
- propogated back to all the callers. At the end, the last caller will
- call an error_processing function, and send in the status which was
- returned. It's up to the error_processing function to determine which
- error occured (as indicated by the status), and print an appropriate
- message back to the user.
-*/
-/*----------------------------------------------------------------------*/
-/* these are specifically for the parser routines */
-
-#define UNKNOWN_COMMAND 0xfb00 /* "unrecognized command " */
-#define UNKNOWN_REGISTER 0xfb01 /* "unknown register "*/
-#define ILLEGAL_RD_STAGE 0xfb02 /* cannot specify reg. family in range*/
-#define ILLEGAL_REG_FAMILY 0xfb03 /* "cannot specify a range of special
- or miscellaneous registers"*/
-#define RANGE_CROSS_FAMILY 0xfb04 /* "cannot specify a range across
- register families" */
-#define UNIMPLEMENTED_STAGE 0xfb05 /* invalid rd or rmm parameter format */
-#define REG_NOT_WRITEABLE 0xfb06 /* "unknown operator in arguements"*/
-#define INVALID_FILENAME 0xfb07 /* "invalid download filename" */
-#define INVALID_BAUD_RATE 0xfb08 /* invalid baud rate from sb command */
-#define UNSUPPORTED_REGISTER 0xfb09 /* Special register is not supported */
-#define FOR_BOARD_ONLY 0xfb0a /* "Not available for Unix." */
-
-
-/*----------------------------------------------------------------------*/
-/* these are for the error checking toolbox */
-
-#define INVALID 0xfd00 /* NOT valid */
-#define VALID 0xfd01 /* valid */
-
- /* This error is found in the fcn:
- is_right_size_input() to indicate
- that the input was not 8 characters
- long. */
-#define INVALID_SIZE 0xfd02
-
- /* This error is found in the fcn:
- is_valid_address_range() to indicate
- that the address given falls outside
- of valid memory defined by MEM_START
- to MEM_END.
- */
-#define OUT_OF_BOUNDS_ADDRESS 0xfd03
-
- /* This error is found in the fcn:
- is_valid_hex_input() to indicate that
- one of more of the characters entered
- are not valid hex characters. Valid
- hex characters are 0-9, A-F, a-f.
- */
-#define INVALID_HEX_INPUT 0xfd04
-
- /* This error is found in the fcn:
- is_valid_register_number() to indicate
- that a given register does not exist.
- */
-#define REG_NOT_READABLE 0xfd05
-
- /* This error is found in the fcn:
- is_word_aligned_address() to indicate
- that the given address is not word-
- aligned. A word-aligned address ends
- in 0x0,0x4,0x8,0xc.
- */
-#define NOT_WORD_ALIGNED 0xfd07
-
- /* This error is found in the fcn:
- is_valid_address_range() to indicate
- that the starting address is greater
- than the ending address.
- */
-#define REVERSED_ADDRESS 0xfd08
-
- /* this error tells us that the address
- specified as the destination is within
- the source addresses */
-#define RANGE_OVERLAP 0xfd09
-
-
-#define ERROR 0xfd0a /* An error occured */
-#define INVALID_PARAM 0xfd0b /* "invalid input parameter " */
-
-
-#define INVALID_FLAG 0xfd0c /* invalid flag */
-
-/*----------------------------------------------------------------------*/
-/* these are for the getarg toolbox */
-
-#define INVALID_NUMBER_ARGS 0xFE00 /* invalid number of commd arguements */
-#define UNKNOWN_PARAMETER 0xFE01 /* "unknown type of parameter "*/
-
-
-/*----------------------------------------------------------------------*/
-/* these are for the tokenizer toolbox */
-
-#define ILLEGAL_CHARACTER 0xFF00 /* unrecognized char. in input stream*/
-#define TTL_NOT_SORTED 0xFF01 /* token translation list not sorted */
-#define TTL_NOT_DEFINED 0xFF02 /* token translation list not assigned*/
-#define INVALID_STRING 0xFF03 /* unable to extract string from input */
-#define BUFFER_EMPTY 0xFF04 /* "input buffer is empty" */
-#define INVALID_MODE 0xFF05 /* input buf is in an unrecognized mode*/
-#define TOK_INTERNAL_ERROR 0xFF06 /* "internal tokenizer error" */
-#define TOO_MANY_IBS 0xFF07 /* "too many open input buffers" */
-#define NO_OPEN_IBS 0xFF08 /* "no open input buffers" */
-
-
-/* these are for the read from screen toolbox */
-
-#define RESERVED_WORD 0xFC00 /* used a reserved word as an arguement*/
-
-
-/* these are for the breakpoint routines */
-
-#define FULL_BPDS 0xFA00 /* breakpoint data structure is full */
-
-
-/* THESE are for the downloader */
-
-#define NOT_IN_S_RECORD_FORMAT 0xf900 /* "not in S-Record Format" */
-#define UNREC_RECORD_TYPE 0xf901 /* "unrecognized record type" */
-#define CONVERSION_ERROR 0xf902 /* "ascii to int conversion error" */
-#define INVALID_MEMORY 0xf903 /* "bad s-record memory address " */
-
-
-/* these are for the compression and decompression stuff */
-
-#define COMP_UNK_CHARACTER 0xf800 /* "unknown compressed character " */
-
-#define COMP_UNKNOWN_STATE 0xf801 /* "unknown binary state" */
-
-#define NOT_IN_COMPRESSED_FORMAT 0xf802 /* not in compressed S-Record format */
-
-
-/* these are for the DUART handling things */
-
- /* "unrecognized serial port configuration" */
-#define UNKNOWN_PORT_STATE 0xf700
-
-
-/* these are for the register toolbox */
-
- /* "cannot find register in special
- purpose register file " */
-#define SPR_NOT_FOUND 0xf600
-
-
-/* these are for the duart specific stuff */
-
- /* "transparent mode needs access to
- two serial ports" */
-#define TM_NEEDS_BOTH_PORTS 0xf500
-
-
-/*----------------------------------------------------------------------*/
-/* these are specifically for the flash routines */
-#define FLASH_ERROR 0xf100 /* general flash error */
diff --git a/cpu/mpc824x/drivers/i2c/i2c.c b/cpu/mpc824x/drivers/i2c/i2c.c
deleted file mode 100644
index 3add687514..0000000000
--- a/cpu/mpc824x/drivers/i2c/i2c.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * (C) Copyright 2003
- * Gleb Natapov <gnatapov@mrv.com>
- * Some bits are taken from linux driver writen by adrian@humboldt.co.uk
- *
- * Hardware I2C driver for MPC107 PCI bridge.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-#undef I2CDBG
-
-#ifdef CONFIG_HARD_I2C
-#include <i2c.h>
-
-#define TIMEOUT (CFG_HZ/4)
-
-#define I2C_Addr ((unsigned *)(CFG_EUMB_ADDR + 0x3000))
-
-#define I2CADR &I2C_Addr[0]
-#define I2CFDR &I2C_Addr[1]
-#define I2CCCR &I2C_Addr[2]
-#define I2CCSR &I2C_Addr[3]
-#define I2CCDR &I2C_Addr[4]
-
-#define MPC107_CCR_MEN 0x80
-#define MPC107_CCR_MIEN 0x40
-#define MPC107_CCR_MSTA 0x20
-#define MPC107_CCR_MTX 0x10
-#define MPC107_CCR_TXAK 0x08
-#define MPC107_CCR_RSTA 0x04
-
-#define MPC107_CSR_MCF 0x80
-#define MPC107_CSR_MAAS 0x40
-#define MPC107_CSR_MBB 0x20
-#define MPC107_CSR_MAL 0x10
-#define MPC107_CSR_SRW 0x04
-#define MPC107_CSR_MIF 0x02
-#define MPC107_CSR_RXAK 0x01
-
-#define I2C_READ 1
-#define I2C_WRITE 0
-
-/* taken from linux include/asm-ppc/io.h */
-inline unsigned in_le32 (volatile unsigned *addr)
-{
- unsigned ret;
-
- __asm__ __volatile__ ("lwbrx %0,0,%1;\n"
- "twi 0,%0,0;\n"
- "isync":"=r" (ret): "r" (addr), "m" (*addr));
- return ret;
-}
-
-inline void out_le32 (volatile unsigned *addr, int val)
-{
- __asm__ __volatile__ ("stwbrx %1,0,%2; eieio":"=m" (*addr):"r" (val),
- "r" (addr));
-}
-
-#define writel(val, addr) out_le32(addr, val)
-#define readl(addr) in_le32(addr)
-
-void i2c_init (int speed, int slaveadd)
-{
- /* stop I2C controller */
- writel (0x0, I2CCCR);
- /* set clock */
- writel (0x1020, I2CFDR);
- /* write slave address */
- writel (slaveadd, I2CADR);
- /* clear status register */
- writel (0x0, I2CCSR);
- /* start I2C controller */
- writel (MPC107_CCR_MEN, I2CCCR);
-
- return;
-}
-
-static __inline__ int i2c_wait4bus (void)
-{
- ulong timeval = get_timer (0);
-
- while (readl (I2CCSR) & MPC107_CSR_MBB)
- if (get_timer (timeval) > TIMEOUT)
- return -1;
-
- return 0;
-}
-
-static __inline__ int i2c_wait (int write)
-{
- u32 csr;
- ulong timeval = get_timer (0);
-
- do {
- csr = readl (I2CCSR);
-
- if (!(csr & MPC107_CSR_MIF))
- continue;
-
- writel (0x0, I2CCSR);
-
- if (csr & MPC107_CSR_MAL) {
-#ifdef I2CDBG
- printf ("i2c_wait: MAL\n");
-#endif
- return -1;
- }
-
- if (!(csr & MPC107_CSR_MCF)) {
-#ifdef I2CDBG
- printf ("i2c_wait: unfinished\n");
-#endif
- return -1;
- }
-
- if (write == I2C_WRITE && (csr & MPC107_CSR_RXAK)) {
-#ifdef I2CDBG
- printf ("i2c_wait: No RXACK\n");
-#endif
- return -1;
- }
-
- return 0;
- } while (get_timer (timeval) < TIMEOUT);
-
-#ifdef I2CDBG
- printf ("i2c_wait: timed out\n");
-#endif
- return -1;
-}
-
-static __inline__ int i2c_write_addr (u8 dev, u8 dir, int rsta)
-{
- writel (MPC107_CCR_MEN | MPC107_CCR_MSTA | MPC107_CCR_MTX |
- (rsta ? MPC107_CCR_RSTA : 0), I2CCCR);
-
- writel ((dev << 1) | dir, I2CCDR);
-
- if (i2c_wait (I2C_WRITE) < 0)
- return 0;
-
- return 1;
-}
-
-static __inline__ int __i2c_write (u8 * data, int length)
-{
- int i;
-
- writel (MPC107_CCR_MEN | MPC107_CCR_MSTA | MPC107_CCR_MTX, I2CCCR);
-
- for (i = 0; i < length; i++) {
- writel (data[i], I2CCDR);
-
- if (i2c_wait (I2C_WRITE) < 0)
- break;
- }
-
- return i;
-}
-
-static __inline__ int __i2c_read (u8 * data, int length)
-{
- int i;
-
- writel (MPC107_CCR_MEN | MPC107_CCR_MSTA |
- ((length == 1) ? MPC107_CCR_TXAK : 0), I2CCCR);
-
- /* dummy read */
- readl (I2CCDR);
-
- for (i = 0; i < length; i++) {
- if (i2c_wait (I2C_READ) < 0)
- break;
-
- /* Generate ack on last next to last byte */
- if (i == length - 2)
- writel (MPC107_CCR_MEN | MPC107_CCR_MSTA |
- MPC107_CCR_TXAK, I2CCCR);
-
- /* Generate stop on last byte */
- if (i == length - 1)
- writel (MPC107_CCR_MEN | MPC107_CCR_TXAK, I2CCCR);
-
- data[i] = readl (I2CCDR);
- }
-
- return i;
-}
-
-int i2c_read (u8 dev, uint addr, int alen, u8 * data, int length)
-{
- int i = 0;
- u8 *a = (u8 *) & addr;
-
- if (i2c_wait4bus () < 0)
- goto exit;
-
- if (i2c_write_addr (dev, I2C_WRITE, 0) == 0)
- goto exit;
-
- if (__i2c_write (&a[4 - alen], alen) != alen)
- goto exit;
-
- if (i2c_write_addr (dev, I2C_READ, 1) == 0)
- goto exit;
-
- i = __i2c_read (data, length);
-
-exit:
- writel (MPC107_CCR_MEN, I2CCCR);
-
- return !(i == length);
-}
-
-int i2c_write (u8 dev, uint addr, int alen, u8 * data, int length)
-{
- int i = 0;
- u8 *a = (u8 *) & addr;
-
- if (i2c_wait4bus () < 0)
- goto exit;
-
- if (i2c_write_addr (dev, I2C_WRITE, 0) == 0)
- goto exit;
-
- if (__i2c_write (&a[4 - alen], alen) != alen)
- goto exit;
-
- i = __i2c_write (data, length);
-
-exit:
- writel (MPC107_CCR_MEN, I2CCCR);
-
- return !(i == length);
-}
-
-int i2c_probe (uchar chip)
-{
- int tmp;
-
- /*
- * Try to read the first location of the chip. The underlying
- * driver doesn't appear to support sending just the chip address
- * and looking for an <ACK> back.
- */
- udelay (10000);
- return i2c_read (chip, 0, 1, (uchar *) &tmp, 1);
-}
-
-uchar i2c_reg_read (uchar i2c_addr, uchar reg)
-{
- uchar buf[1];
-
- i2c_read (i2c_addr, reg, 1, buf, 1);
-
- return (buf[0]);
-}
-
-void i2c_reg_write (uchar i2c_addr, uchar reg, uchar val)
-{
- i2c_write (i2c_addr, reg, 1, &val, 1);
-}
-
-#endif /* CONFIG_HARD_I2C */
diff --git a/cpu/mpc824x/drivers/i2c_export.h b/cpu/mpc824x/drivers/i2c_export.h
deleted file mode 100644
index 6264d189bb..0000000000
--- a/cpu/mpc824x/drivers/i2c_export.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef I2C_EXPORT_H
-#define I2C_EXPORT_H
-
-/****************************************************
- *
- * Copyright Motrola 1999
- *
- ****************************************************/
-
-/* These are the defined return values for the I2C_do_transaction function.
- * Any non-zero value indicates failure. Failure modes can be added for
- * more detailed error reporting.
- */
-typedef enum _i2c_status
-{
- I2C_SUCCESS = 0,
- I2C_ERROR,
-} I2C_Status;
-
-/* These are the defined tasks for I2C_do_transaction.
- * Modes for SLAVE_RCV and SLAVE_XMIT will be added.
- */
-typedef enum _i2c_transaction_mode
-{
- I2C_MASTER_RCV = 0,
- I2C_MASTER_XMIT = 1,
-} I2C_TRANSACTION_MODE;
-
-typedef enum _i2c_interrupt_mode
-{
- I2C_INT_DISABLE = 0,
- I2C_INT_ENABLE = 1,
-} I2C_INTERRUPT_MODE;
-
-typedef enum _i2c_stop
-{
- I2C_NO_STOP = 0,
- I2C_STOP = 1,
-} I2C_STOP_MODE;
-
-typedef enum _i2c_restart
-{
- I2C_NO_RESTART = 0,
- I2C_RESTART = 1,
-} I2C_RESTART_MODE;
-
-/******************** App. API ********************
- * The application API is for user level application
- * to use the functionality provided by I2C driver.
- * This is a "generic" I2C interface, it should contain
- * nothing specific to the Kahlua implementation.
- * Only the generic functions are exported by the library.
- *
- * Note: Its App.s responsibility to swap the data
- * byte. In our API, we just transfer whatever
- * we are given
- **************************************************/
-
-
-/* Initialize I2C unit with the following:
- * driver's slave address
- * interrupt enabled
- * optional pointer to application layer print function
- *
- * These parameters may be added:
- * desired clock rate
- * digital filter frequency sampling rate
- *
- * This function must be called before I2C unit can be used.
- */
-extern I2C_Status I2C_Initialize(
- unsigned char addr, /* driver's I2C slave address */
- I2C_INTERRUPT_MODE en_int, /* 1 - enable I2C interrupt
- * 0 - disable I2C interrupt
- */
- int (*app_print_function)(char *,...)); /* pointer to optional "printf"
- * provided by application
- */
-
-/* Perform the given I2C transaction, only MASTER_XMIT and MASTER_RCV
- * are implemented. Both are only in polling mode.
- *
- * en_int controls interrupt/polling mode
- * act is the type of transaction
- * addr is the I2C address of the slave device
- * len is the length of data to send or receive
- * buffer is the address of the data buffer
- * stop = I2C_NO_STOP, don't signal STOP at end of transaction
- * I2C_STOP, signal STOP at end of transaction
- * retry is the timeout retry value, currently ignored
- * rsta = I2C_NO_RESTART, this is not continuation of existing transaction
- * I2C_RESTART, this is a continuation of existing transaction
- */
-extern I2C_Status I2C_do_transaction( I2C_INTERRUPT_MODE en_int,
- I2C_TRANSACTION_MODE act,
- unsigned char i2c_addr,
- unsigned char data_addr,
- int len,
- char *buffer,
- I2C_STOP_MODE stop,
- int retry,
- I2C_RESTART_MODE rsta);
-#endif
diff --git a/cpu/mpc824x/interrupts.c b/cpu/mpc824x/interrupts.c
deleted file mode 100644
index acb8947e0d..0000000000
--- a/cpu/mpc824x/interrupts.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- * Rob Taylor, Flying Pig Systems. robt@flyingpig.com
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc824x.h>
-#include <asm/processor.h>
-#include <asm/pci_io.h>
-#include <commproc.h>
-#include "drivers/epic.h"
-
-int interrupt_init_cpu (unsigned *decrementer_count)
-{
- *decrementer_count = (get_bus_freq (0) / 4) / CFG_HZ;
-
- /*
- * It's all broken at the moment and I currently don't need
- * interrupts. If you want to fix it, have a look at the epic
- * drivers in dink32 v12. They do everthing and Motorola said
- * I could use the dink source in this project as long as
- * copyright notices remain intact.
- */
-
- epicInit (EPIC_DIRECT_IRQ, 0);
- /* EPIC won't generate INT unless Current Task Pri < 15 */
- epicCurTaskPrioSet(0);
-
- return (0);
-}
-
-/****************************************************************************/
-
-/*
- * Handle external interrupts
- */
-void external_interrupt (struct pt_regs *regs)
-{
- register unsigned long temp;
-
- pci_readl (CFG_EUMB_ADDR + EPIC_PROC_INT_ACK_REG, temp);
- sync (); /* i'm not convinced this is needed, but dink source has it */
- temp &= 0xff; /*get vector */
-
- /*TODO: handle them -... */
- epicEOI ();
-}
-
-/****************************************************************************/
-
-/*
- * blank int handlers.
- */
-
-void
-irq_install_handler (int vec, interrupt_handler_t * handler, void *arg)
-{
-}
-
-void irq_free_handler (int vec)
-{
-
-}
-
-/*TODO: some handlers for winbond and 87308 interrupts
- and what about generic pci inteerupts?
- vga?
- */
-
-void timer_interrupt_cpu (struct pt_regs *regs, ulong timestamp)
-{
- /* nothing to do here */
- return;
-}
diff --git a/cpu/mpc824x/pci.c b/cpu/mpc824x/pci.c
deleted file mode 100644
index 7e3c4c3b78..0000000000
--- a/cpu/mpc824x/pci.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * arch/ppc/kernel/mpc10x_common.c
- *
- * Common routines for the Motorola SPS MPC106, MPC107 and MPC8240 Host bridge,
- * Mem ctlr, EPIC, etc.
- *
- * Author: Mark A. Greer
- * mgreer@mvista.com
- *
- * Copyright 2001 MontaVista Software Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- */
-
-#include <common.h>
-
-#ifdef CONFIG_PCI
-
-#include <asm/processor.h>
-#include <asm/io.h>
-#include <pci.h>
-#include <mpc824x.h>
-
-void pci_mpc824x_init (struct pci_controller *hose)
-{
- hose->first_busno = 0;
- hose->last_busno = 0xff;
-
- /* System memory space */
- pci_set_region(hose->regions + 0,
- CHRP_PCI_MEMORY_BUS,
- CHRP_PCI_MEMORY_PHYS,
- CHRP_PCI_MEMORY_SIZE,
- PCI_REGION_MEM | PCI_REGION_MEMORY);
-
- /* PCI memory space */
- pci_set_region(hose->regions + 1,
- CHRP_PCI_MEM_BUS,
- CHRP_PCI_MEM_PHYS,
- CHRP_PCI_MEM_SIZE,
- PCI_REGION_MEM);
-
- /* ISA/PCI memory space */
- pci_set_region(hose->regions + 2,
- CHRP_ISA_MEM_BUS,
- CHRP_ISA_MEM_PHYS,
- CHRP_ISA_MEM_SIZE,
- PCI_REGION_MEM);
-
- /* PCI I/O space */
- pci_set_region(hose->regions + 3,
- CHRP_PCI_IO_BUS,
- CHRP_PCI_IO_PHYS,
- CHRP_PCI_IO_SIZE,
- PCI_REGION_IO);
-
- /* ISA/PCI I/O space */
- pci_set_region(hose->regions + 4,
- CHRP_ISA_IO_BUS,
- CHRP_ISA_IO_PHYS,
- CHRP_ISA_IO_SIZE,
- PCI_REGION_IO);
-
- hose->region_count = 5;
-
- pci_setup_indirect(hose,
- CHRP_REG_ADDR,
- CHRP_REG_DATA);
-
- pci_register_hose(hose);
-
- hose->last_busno = pci_hose_scan(hose);
-}
-
-#endif
diff --git a/cpu/mpc824x/speed.c b/cpu/mpc824x/speed.c
deleted file mode 100644
index fdcb9723cb..0000000000
--- a/cpu/mpc824x/speed.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * (C) Copyright 2001
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2002
- * Gregory E. Allen, gallen@arlut.utexas.edu
- * Applied Research Laboratories, The University of Texas at Austin
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc824x.h>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/* ------------------------------------------------------------------------- */
-/* NOTE: This describes the proper use of this file.
- *
- * CONFIG_SYS_CLK_FREQ should be defined as the input frequency on
- * PCI_SYNC_IN .
- *
- * CONFIG_PLL_PCI_TO_MEM_MULTIPLIER is only required on MPC8240
- * boards. It should be defined as the PCI to Memory Multiplier as
- * documented in the MPC8240 Hardware Specs.
- *
- * Other mpc824x boards don't need CONFIG_PLL_PCI_TO_MEM_MULTIPLIER
- * because they can determine it from the PCR.
- *
- * Gary Milliorn <gary.milliorn@motorola.com> (who should know since
- * he designed the Sandpoint) told us that the PCR is not in all revs
- * of the MPC8240 CPU, so it's not guaranteeable and we cannot do
- * away with CONFIG_PLL_PCI_TO_MEM_MULTIPLIER altogether.
- */
-/* ------------------------------------------------------------------------- */
-
-/* This gives the PCI to Memory multiplier times 10 */
-/* The index is the value of PLL_CFG[0:4] */
-/* This is documented in the MPC8240/5 Hardware Specs */
-
-short pll_pci_to_mem_multiplier[] = {
-#if defined(CONFIG_MPC8240)
- 30, 30, 10, 10, 20, 10, 0, 10,
- 10, 0, 20, 0, 20, 0, 20, 0,
- 30, 0, 15, 0, 20, 0, 20, 0,
- 25, 0, 10, 0, 15, 15, 0, 0,
-#elif defined(CONFIG_MPC8245)
- 30, 30, 10, 10, 20, 10, 10, 10,
- 10, 20, 20, 15, 20, 15, 20, 30,
- 30, 40, 15, 40, 20, 25, 20, 40,
- 25, 20, 10, 20, 15, 15, 15, 0,
-#else
-#error Specific type of MPC824x must be defined (i.e. CONFIG_MPC8240)
-#endif
-};
-
-#define CU824_PLL_STATE_REG 0xFE80002F
-#define PCR 0x800000E2
-
-/* ------------------------------------------------------------------------- */
-
-/* compute the memory bus clock frequency */
-ulong get_bus_freq (ulong dummy)
-{
- unsigned char pll_cfg;
-#if defined(CONFIG_MPC8240) && !defined(CONFIG_CU824)
- return (CONFIG_SYS_CLK_FREQ) * (CONFIG_PLL_PCI_TO_MEM_MULTIPLIER);
-#elif defined(CONFIG_CU824)
- pll_cfg = *(volatile unsigned char *) (CU824_PLL_STATE_REG);
- pll_cfg &= 0x1f;
-#else
- CONFIG_READ_BYTE(PCR, pll_cfg);
- pll_cfg = (pll_cfg >> 3) & 0x1f;
-#endif
- return ((CONFIG_SYS_CLK_FREQ) * pll_pci_to_mem_multiplier[pll_cfg] + 5) / 10;
-}
-
-
-/* ------------------------------------------------------------------------- */
-
-/* This gives the Memory to CPU Core multiplier times 10 */
-/* The index is the value of PLLRATIO in HID1 */
-/* This is documented in the MPC8240 Hardware Specs */
-/* This is not documented for MPC8245 ? FIXME */
-short pllratio_to_factor[] = {
- 0, 0, 0, 10, 20, 20, 25, 45,
- 30, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 10, 0, 0, 0, 45,
- 30, 0, 40, 0, 0, 0, 35, 0,
-};
-
-/* compute the CPU and memory bus clock frequencies */
-int get_clocks (void)
-{
- uint hid1 = mfspr(HID1);
- hid1 = (hid1 >> (32-5)) & 0x1f;
- gd->cpu_clk = (pllratio_to_factor[hid1] * get_bus_freq(0) + 5)
- / 10;
- gd->bus_clk = get_bus_freq(0);
- return (0);
-}
diff --git a/cpu/mpc824x/start.S b/cpu/mpc824x/start.S
deleted file mode 100644
index 3c89552b79..0000000000
--- a/cpu/mpc824x/start.S
+++ /dev/null
@@ -1,771 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2000,2001,2002 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* U-Boot - Startup Code for PowerPC based Embedded Boards
- *
- *
- * The processor starts at 0x00000100 and the code is executed
- * from flash. The code is organized to be at an other address
- * in memory, but as long we don't jump around before relocating.
- * board_init lies at a quite high address and when the cpu has
- * jumped there, everything is ok.
- * This works because the cpu gives the FLASH (CS0) the whole
- * address space at startup, and board_init lies as a echo of
- * the flash somewhere up there in the memorymap.
- *
- * board_init will change CS0 to be positioned at the correct
- * address and (s)dram will be positioned at address 0
- */
-#include <config.h>
-#include <mpc824x.h>
-#include <version.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-/* We don't want the MMU yet.
-*/
-#undef MSR_KERNEL
-/* FP, Machine Check and Recoverable Interr. */
-#define MSR_KERNEL ( MSR_FP | MSR_ME | MSR_RI )
-
-/*
- * Set up GOT: Global Offset Table
- *
- * Use r14 to access the GOT
- */
- START_GOT
- GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_FIXUP_TABLE_)
-
- GOT_ENTRY(_start)
- GOT_ENTRY(_start_of_vectors)
- GOT_ENTRY(_end_of_vectors)
- GOT_ENTRY(transfer_to_handler)
-
- GOT_ENTRY(__init_end)
- GOT_ENTRY(_end)
- GOT_ENTRY(__bss_start)
-#if defined(CONFIG_FADS)
- GOT_ENTRY(environment)
-#endif
- END_GOT
-
-/*
- * r3 - 1st arg to board_init(): IMMP pointer
- * r4 - 2nd arg to board_init(): boot flag
- */
- .text
- .long 0x27051956 /* U-Boot Magic Number */
- .globl version_string
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
-
- . = EXC_OFF_SYS_RESET
- .globl _start
-_start:
- li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
- b boot_cold
-
- . = EXC_OFF_SYS_RESET + 0x10
-
- .globl _start_warm
-_start_warm:
- li r21, BOOTFLAG_WARM /* Software reboot */
- b boot_warm
-
-boot_cold:
-boot_warm:
-
- /* Initialize machine status; enable machine check interrupt */
- /*----------------------------------------------------------------------*/
- li r3, MSR_KERNEL /* Set FP, ME, RI flags */
- mtmsr r3
- mtspr SRR1, r3 /* Make SRR1 match MSR */
-
- addis r0,0,0x0000 /* lets make sure that r0 is really 0 */
- mtspr HID0, r0 /* disable I and D caches */
-
- mfspr r3, ICR /* clear Interrupt Cause Register */
-
- mfmsr r3 /* turn off address translation */
- addis r4,0,0xffff
- ori r4,r4,0xffcf
- and r3,r3,r4
- mtmsr r3
- isync
- sync /* the MMU should be off... */
-
-
-in_flash:
-#if defined(CONFIG_BMW)
- bl early_init_f /* Must be ASM: no stack yet! */
-#endif
- /*
- * Setup BATs - cannot be done in C since we don't have a stack yet
- */
- bl setup_bats
-
- /* Enable MMU.
- */
- mfmsr r3
- ori r3, r3, (MSR_IR | MSR_DR)
- mtmsr r3
-#if !defined(CONFIG_BMW)
- /* Enable and invalidate data cache.
- */
- mfspr r3, HID0
- mr r2, r3
- ori r3, r3, HID0_DCE | HID0_DCI
- ori r2, r2, HID0_DCE
- sync
- mtspr HID0, r3
- mtspr HID0, r2
- sync
-
- /* Allocate Initial RAM in data cache.
- */
- lis r3, CFG_INIT_RAM_ADDR@h
- ori r3, r3, CFG_INIT_RAM_ADDR@l
- li r2, 128
- mtctr r2
-1:
- dcbz r0, r3
- addi r3, r3, 32
- bdnz 1b
-
- /* Lock way0 in data cache.
- */
- mfspr r3, 1011
- lis r2, 0xffff
- ori r2, r2, 0xff1f
- and r3, r3, r2
- ori r3, r3, 0x0080
- sync
- mtspr 1011, r3
-#endif /* !CONFIG_BMW */
- /*
- * Thisk the stack pointer *somewhere* sensible. Doesnt
- * matter much where as we'll move it when we relocate
- */
- lis r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@h
- ori r1, r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@l
-
- li r0, 0 /* Make room for stack frame header and */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
-
- /* let the C-code set up the rest */
- /* */
- /* Be careful to keep code relocatable ! */
- /*----------------------------------------------------------------------*/
-
- GET_GOT /* initialize GOT access */
-
- /* r3: IMMR */
- bl cpu_init_f /* run low-level CPU init code (from Flash) */
-
- mr r3, r21
- /* r3: BOOTFLAG */
- bl board_init_f /* run 1st part of board init code (from Flash) */
-
-
- .globl _start_of_vectors
-_start_of_vectors:
-
-/* Machine check */
- STD_EXCEPTION(EXC_OFF_MACH_CHCK, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. "Never" generated on the 860. */
- STD_EXCEPTION(EXC_OFF_DATA_STOR, DataStorage, UnknownException)
-
-/* Instruction Storage exception. "Never" generated on the 860. */
- STD_EXCEPTION(EXC_OFF_INS_STOR, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
- STD_EXCEPTION(EXC_OFF_EXTERNAL, ExtInterrupt, external_interrupt)
-
-/* Alignment exception. */
- . = EXC_OFF_ALIGN
-Alignment:
- EXCEPTION_PROLOG
- mfspr r4,DAR
- stw r4,_DAR(r21)
- mfspr r5,DSISR
- stw r5,_DSISR(r21)
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_Alignment:
- .long AlignmentException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
- . = EXC_OFF_PROGRAM
-ProgramCheck:
- EXCEPTION_PROLOG
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_ProgramCheck:
- .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
- /* No FPU on MPC8xx. This exception is not supposed to happen.
- */
- STD_EXCEPTION(EXC_OFF_FPUNAVAIL, FPUnavailable, UnknownException)
-
- /* I guess we could implement decrementer, and may have
- * to someday for timekeeping.
- */
- STD_EXCEPTION(EXC_OFF_DECR, Decrementer, timer_interrupt)
- STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
- STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
- STD_EXCEPTION(0xc00, SystemCall, UnknownException)
-
- STD_EXCEPTION(EXC_OFF_TRACE, SingleStep, UnknownException)
-
- STD_EXCEPTION(EXC_OFF_FPUNASSIST, Trap_0e, UnknownException)
- STD_EXCEPTION(EXC_OFF_PMI, Trap_0f, UnknownException)
-
- STD_EXCEPTION(EXC_OFF_ITME, InstructionTransMiss, UnknownException)
- STD_EXCEPTION(EXC_OFF_DLTME, DataLoadTransMiss, UnknownException)
- STD_EXCEPTION(EXC_OFF_DSTME, DataStoreTransMiss, UnknownException)
- STD_EXCEPTION(EXC_OFF_IABE, InstructionBreakpoint, DebugException)
- STD_EXCEPTION(EXC_OFF_SMIE, SysManageInt, UnknownException)
- STD_EXCEPTION(0x1500, Reserved5, UnknownException)
- STD_EXCEPTION(0x1600, Reserved6, UnknownException)
- STD_EXCEPTION(0x1700, Reserved7, UnknownException)
- STD_EXCEPTION(0x1800, Reserved8, UnknownException)
- STD_EXCEPTION(0x1900, Reserved9, UnknownException)
- STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
- STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
- STD_EXCEPTION(0x1c00, ReservedC, UnknownException)
- STD_EXCEPTION(0x1d00, ReservedD, UnknownException)
- STD_EXCEPTION(0x1e00, ReservedE, UnknownException)
- STD_EXCEPTION(0x1f00, ReservedF, UnknownException)
-
- STD_EXCEPTION(EXC_OFF_RMTE, RunModeTrace, UnknownException)
-
- .globl _end_of_vectors
-_end_of_vectors:
-
-
- . = 0x3000
-
-/*
- * This code finishes saving the registers to the exception frame
- * and jumps to the appropriate handler for the exception.
- * Register r21 is pointer into trap frame, r1 has new stack pointer.
- */
- .globl transfer_to_handler
-transfer_to_handler:
- stw r22,_NIP(r21)
- lis r22,MSR_POW@h
- andc r23,r23,r22
- stw r23,_MSR(r21)
- SAVE_GPR(7, r21)
- SAVE_4GPRS(8, r21)
- SAVE_8GPRS(12, r21)
- SAVE_8GPRS(24, r21)
- mflr r23
- andi. r24,r23,0x3f00 /* get vector offset */
- stw r24,TRAP(r21)
- li r22,0
- stw r22,RESULT(r21)
- mtspr SPRG2,r22 /* r1 is now kernel sp */
- lwz r24,0(r23) /* virtual address of handler */
- lwz r23,4(r23) /* where to go when done */
- mtspr SRR0,r24
- ori r20,r20,0x30 /* enable IR, DR */
- mtspr SRR1,r20
- mtlr r23
- SYNC
- rfi /* jump to handler, enable MMU */
-
-int_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr SRR0,r2
- mtspr SRR1,r0
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfi
-
-/* Cache functions.
-*/
- .globl icache_enable
-icache_enable:
- mfspr r5,HID0 /* turn on the I cache. */
- ori r5,r5,0x8800 /* Instruction cache only! */
- addis r6,0,0xFFFF
- ori r6,r6,0xF7FF
- and r6,r5,r6 /* clear the invalidate bit */
- sync
- mtspr HID0,r5
- mtspr HID0,r6
- isync
- sync
- blr
-
- .globl icache_disable
-icache_disable:
- mfspr r5,HID0
- addis r6,0,0xFFFF
- ori r6,r6,0x7FFF
- and r5,r5,r6
- sync
- mtspr HID0,r5
- isync
- sync
- blr
-
- .globl icache_status
-icache_status:
- mfspr r3, HID0
- srwi r3, r3, 15 /* >>15 & 1=> select bit 16 */
- andi. r3, r3, 1
- blr
-
- .globl dcache_enable
-dcache_enable:
- mfspr r5,HID0 /* turn on the D cache. */
- ori r5,r5,0x4400 /* Data cache only! */
- mfspr r4, PVR /* read PVR */
- srawi r3, r4, 16 /* shift off the least 16 bits */
- cmpi 0, 0, r3, 0xC /* Check for Max pvr */
- bne NotMax
- ori r5,r5,0x0040 /* setting the DCFA bit, for Max rev 1 errata */
-NotMax:
- addis r6,0,0xFFFF
- ori r6,r6,0xFBFF
- and r6,r5,r6 /* clear the invalidate bit */
- sync
- mtspr HID0,r5
- mtspr HID0,r6
- isync
- sync
- blr
-
- .globl dcache_disable
-dcache_disable:
- mfspr r5,HID0
- addis r6,0,0xFFFF
- ori r6,r6,0xBFFF
- and r5,r5,r6
- sync
- mtspr HID0,r5
- isync
- sync
- blr
-
- .globl dcache_status
-dcache_status:
- mfspr r3, HID0
- srwi r3, r3, 14 /* >>14 & 1=> select bit 17 */
- andi. r3, r3, 1
- blr
-
- .globl dc_read
-dc_read:
-/*TODO : who uses this, what should it do?
-*/
- blr
-
-
- .globl get_pvr
-get_pvr:
- mfspr r3, PVR
- blr
-
-
-/*------------------------------------------------------------------------------*/
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
- */
- .globl relocate_code
-relocate_code:
-
- mr r1, r3 /* Set new stack pointer */
- mr r9, r4 /* Save copy of Global Data pointer */
- mr r10, r5 /* Save copy of Destination Address */
-
- mr r3, r5 /* Destination Address */
-#ifdef CFG_RAMBOOT
- lis r4, CFG_SDRAM_BASE@h /* Source Address */
- ori r4, r4, CFG_SDRAM_BASE@l
-#else
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
-#endif
- lwz r5, GOT(__init_end)
- sub r5, r5, r4
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
- *
- * Offset:
- */
- sub r15, r10, r4
-
- /* First our own GOT */
- add r14, r14, r15
- /* the the one used by the C code */
- add r30, r30, r15
-
- /*
- * Now relocate code
- */
-
- cmplw cr1,r3,r4
- addi r0,r5,3
- srwi. r0,r0,2
- beq cr1,4f /* In place copy is not necessary */
- beq 7f /* Protect against 0 count */
- mtctr r0
- bge cr1,2f
-
- la r8,-4(r4)
- la r7,-4(r3)
-1: lwzu r0,4(r8)
- stwu r0,4(r7)
- bdnz 1b
- b 4f
-
-2: slwi r0,r0,2
- add r8,r4,r0
- add r7,r3,r0
-3: lwzu r0,-4(r8)
- stwu r0,-4(r7)
- bdnz 3b
-
-4:
-#if !defined(CONFIG_BMW)
-/* Unlock the data cache and invalidate locked area */
- xor r0, r0, r0
- mtspr 1011, r0
- lis r4, CFG_INIT_RAM_ADDR@h
- ori r4, r4, CFG_INIT_RAM_ADDR@l
- li r0, 128
- mtctr r0
-41:
- dcbi r0, r4
- addi r4, r4, 32
- bdnz 41b
-#endif
-
-/*
- * Now flush the cache: note that we must start from a cache aligned
- * address. Otherwise we might miss one cache line.
- */
- cmpwi r6,0
- add r5,r3,r5
- beq 7f /* Always flush prefetch queue in any case */
- subi r0,r6,1
- andc r3,r3,r0
- mr r4,r3
-5: dcbst 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 5b
- sync /* Wait for all dcbst to complete on bus */
- mr r4,r3
-6: icbi 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 6b
-7: sync /* Wait for all icbi to complete on bus */
- isync
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-
- addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
- mtlr r0
- blr
-
-in_ram:
-
- /*
- * Relocation Function, r14 point to got2+0x8000
- *
- * Adjust got2 pointers, no need to check for 0, this code
- * already puts a few entries in the table.
- */
- li r0,__got2_entries@sectoff@l
- la r3,GOT(_GOT2_TABLE_)
- lwz r11,GOT(_GOT2_TABLE_)
- mtctr r0
- sub r11,r3,r11
- addi r3,r3,-4
-1: lwzu r0,4(r3)
- add r0,r0,r11
- stw r0,0(r3)
- bdnz 1b
-
- /*
- * Now adjust the fixups and the pointers to the fixups
- * in case we need to move ourselves again.
- */
-2: li r0,__fixup_entries@sectoff@l
- lwz r3,GOT(_FIXUP_TABLE_)
- cmpwi r0,0
- mtctr r0
- addi r3,r3,-4
- beq 4f
-3: lwzu r4,4(r3)
- lwzux r0,r4,r11
- add r0,r0,r11
- stw r10,0(r3)
- stw r0,0(r4)
- bdnz 3b
-4:
-clear_bss:
- /*
- * Now clear BSS segment
- */
- lwz r3,GOT(__bss_start)
- lwz r4,GOT(_end)
-
- cmplw 0, r3, r4
- beq 6f
-
- li r0, 0
-5:
- stw r0, 0(r3)
- addi r3, r3, 4
- cmplw 0, r3, r4
- blt 5b
-6:
-
- mr r3, r9 /* Global Data pointer */
- mr r4, r10 /* Destination Address */
- bl board_init_r
-
- /*
- * Copy exception vector code to low memory
- *
- * r3: dest_addr
- * r7: source address, r8: end address, r9: target address
- */
- .globl trap_init
-trap_init:
- lwz r7, GOT(_start)
- lwz r8, GOT(_end_of_vectors)
-
- li r9, 0x100 /* reset vector always at 0x100 */
-
- cmplw 0, r7, r8
- bgelr /* return if r7>=r8 - just in case */
-
- mflr r4 /* save link register */
-1:
- lwz r0, 0(r7)
- stw r0, 0(r9)
- addi r7, r7, 4
- addi r9, r9, 4
- cmplw 0, r7, r8
- bne 1b
-
- /*
- * relocate `hdlr' and `int_return' entries
- */
- li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
- li r8, Alignment - _start + EXC_OFF_SYS_RESET
-2:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 2b
-
- li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
- li r8, SystemCall - _start + EXC_OFF_SYS_RESET
-3:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 3b
-
- li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
- li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-4:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 4b
-
- mtlr r4 /* restore link register */
- blr
-
- /*
- * Function: relocate entries for one exception vector
- */
-trap_reloc:
- lwz r0, 0(r7) /* hdlr ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 0(r7)
-
- lwz r0, 4(r7) /* int_return ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 4(r7)
-
- blr
-
- /* Setup the BAT registers.
- */
-setup_bats:
- lis r4, CFG_IBAT0L@h
- ori r4, r4, CFG_IBAT0L@l
- lis r3, CFG_IBAT0U@h
- ori r3, r3, CFG_IBAT0U@l
- mtspr IBAT0L, r4
- mtspr IBAT0U, r3
- isync
-
- lis r4, CFG_DBAT0L@h
- ori r4, r4, CFG_DBAT0L@l
- lis r3, CFG_DBAT0U@h
- ori r3, r3, CFG_DBAT0U@l
- mtspr DBAT0L, r4
- mtspr DBAT0U, r3
- isync
-
- lis r4, CFG_IBAT1L@h
- ori r4, r4, CFG_IBAT1L@l
- lis r3, CFG_IBAT1U@h
- ori r3, r3, CFG_IBAT1U@l
- mtspr IBAT1L, r4
- mtspr IBAT1U, r3
- isync
-
- lis r4, CFG_DBAT1L@h
- ori r4, r4, CFG_DBAT1L@l
- lis r3, CFG_DBAT1U@h
- ori r3, r3, CFG_DBAT1U@l
- mtspr DBAT1L, r4
- mtspr DBAT1U, r3
- isync
-
- lis r4, CFG_IBAT2L@h
- ori r4, r4, CFG_IBAT2L@l
- lis r3, CFG_IBAT2U@h
- ori r3, r3, CFG_IBAT2U@l
- mtspr IBAT2L, r4
- mtspr IBAT2U, r3
- isync
-
- lis r4, CFG_DBAT2L@h
- ori r4, r4, CFG_DBAT2L@l
- lis r3, CFG_DBAT2U@h
- ori r3, r3, CFG_DBAT2U@l
- mtspr DBAT2L, r4
- mtspr DBAT2U, r3
- isync
-
- lis r4, CFG_IBAT3L@h
- ori r4, r4, CFG_IBAT3L@l
- lis r3, CFG_IBAT3U@h
- ori r3, r3, CFG_IBAT3U@l
- mtspr IBAT3L, r4
- mtspr IBAT3U, r3
- isync
-
- lis r4, CFG_DBAT3L@h
- ori r4, r4, CFG_DBAT3L@l
- lis r3, CFG_DBAT3U@h
- ori r3, r3, CFG_DBAT3U@l
- mtspr DBAT3L, r4
- mtspr DBAT3U, r3
- isync
-
- /* Invalidate TLBs.
- * -> for (val = 0; val < 0x20000; val+=0x1000)
- * -> tlbie(val);
- */
- lis r3, 0
- lis r5, 2
-
-1:
- tlbie r3
- addi r3, r3, 0x1000
- cmp 0, 0, r3, r5
- blt 1b
-
- blr
diff --git a/cpu/mpc824x/traps.c b/cpu/mpc824x/traps.c
deleted file mode 100644
index b03f82d0f2..0000000000
--- a/cpu/mpc824x/traps.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * linux/arch/ppc/kernel/traps.c
- *
- * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- * Modified by Cort Dougan (cort@cs.nmt.edu)
- * and Paul Mackerras (paulus@cs.anu.edu.au)
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * This file handles the architecture-dependent parts of hardware exceptions
- */
-
-#include <common.h>
-#include <asm/processor.h>
-
-/* Returns 0 if exception not found and fixup otherwise. */
-extern unsigned long search_exception_table(unsigned long);
-
-/* THIS NEEDS CHANGING to use the board info structure.
-*/
-#define END_OF_MEM 0x00400000
-
-/*
- * Trap & Exception support
- */
-
-void
-print_backtrace(unsigned long *sp)
-{
- int cnt = 0;
- unsigned long i;
-
- printf("Call backtrace: ");
- while (sp) {
- if ((uint)sp > END_OF_MEM)
- break;
-
- i = sp[1];
- if (cnt++ % 7 == 0)
- printf("\n");
- printf("%08lX ", i);
- if (cnt > 32) break;
- sp = (unsigned long *)*sp;
- }
- printf("\n");
-}
-
-void show_regs(struct pt_regs * regs)
-{
- int i;
-
- printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
- regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
- printf("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
- regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
- regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
- regs->msr&MSR_IR ? 1 : 0,
- regs->msr&MSR_DR ? 1 : 0);
-
- printf("\n");
- for (i = 0; i < 32; i++) {
- if ((i % 8) == 0)
- {
- printf("GPR%02d: ", i);
- }
-
- printf("%08lX ", regs->gpr[i]);
- if ((i % 8) == 7)
- {
- printf("\n");
- }
- }
-}
-
-
-void
-_exception(int signr, struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
-}
-
-void
-MachineCheckException(struct pt_regs *regs)
-{
- unsigned long fixup;
-
- /* Probing PCI using config cycles cause this exception
- * when a device is not present. Catch it and return to
- * the PCI exception handler.
- */
- if ((fixup = search_exception_table(regs->nip)) != 0) {
- regs->nip = fixup;
- return;
- }
-
- printf("Machine check in kernel mode.\n");
- printf("Caused by (from msr): ");
- printf("regs %p ",regs);
- switch( regs->msr & 0x000F0000) {
- case (0x80000000>>12):
- printf("Machine check signal - probably due to mm fault\n"
- "with mmu off\n");
- break;
- case (0x80000000>>13):
- printf("Transfer error ack signal\n");
- break;
- case (0x80000000>>14):
- printf("Data parity signal\n");
- break;
- case (0x80000000>>15):
- printf("Address parity signal\n");
- break;
- default:
- printf("Unknown values in msr\n");
- }
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("machine check");
-}
-
-void
-AlignmentException(struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Alignment Exception");
-}
-
-void
-ProgramCheckException(struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Program Check Exception");
-}
-
-void
-SoftEmuException(struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Software Emulation Exception");
-}
-
-
-void
-UnknownException(struct pt_regs *regs)
-{
- printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
- regs->nip, regs->msr, regs->trap);
- _exception(0, regs);
-}
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
-extern void do_bedbug_breakpoint(struct pt_regs *);
-#endif
-
-void
-DebugException(struct pt_regs *regs)
-{
-
- printf("Debugger trap at @ %lx\n", regs->nip );
- show_regs(regs);
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
- do_bedbug_breakpoint( regs );
-#endif
-}
-
-/* Probe an address by reading. If not present, return -1, otherwise
- * return 0.
- */
-int
-addr_probe(uint *addr)
-{
- return 0;
-}
diff --git a/cpu/mpc8260/Makefile b/cpu/mpc8260/Makefile
deleted file mode 100644
index 80d785229c..0000000000
--- a/cpu/mpc8260/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o kgdb.o
-COBJS = traps.o serial_smc.o serial_scc.o cpu.o cpu_init.o speed.o \
- interrupts.o ether_scc.o ether_fcc.o i2c.o commproc.o \
- bedbug_603e.o pci.o spi.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS) $(obj)kgdb.o
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/mpc8260/bedbug_603e.c b/cpu/mpc8260/bedbug_603e.c
deleted file mode 100644
index be09cfb5c6..0000000000
--- a/cpu/mpc8260/bedbug_603e.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Bedbug Functions specific to the MPC603e core
- */
-
-#include <common.h>
-#include <command.h>
-#include <linux/ctype.h>
-#include <bedbug/type.h>
-#include <bedbug/bedbug.h>
-#include <bedbug/regs.h>
-#include <bedbug/ppc.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG) && (defined(CONFIG_MPC824X) || defined(CONFIG_MPC8260))
-
-#define MAX_BREAK_POINTS 1
-
-extern CPU_DEBUG_CTX bug_ctx;
-
-void bedbug603e_init __P((void));
-void bedbug603e_do_break __P((cmd_tbl_t*,int,int,char*[]));
-void bedbug603e_break_isr __P((struct pt_regs*));
-int bedbug603e_find_empty __P((void));
-int bedbug603e_set __P((int,unsigned long));
-int bedbug603e_clear __P((int));
-
-
-/* ======================================================================
- * Initialize the global bug_ctx structure for the processor. Clear all
- * of the breakpoints.
- * ====================================================================== */
-
-void bedbug603e_init( void )
-{
- int i;
- /* -------------------------------------------------- */
-
- bug_ctx.hw_debug_enabled = 0;
- bug_ctx.stopped = 0;
- bug_ctx.current_bp = 0;
- bug_ctx.regs = NULL;
-
- bug_ctx.do_break = bedbug603e_do_break;
- bug_ctx.break_isr = bedbug603e_break_isr;
- bug_ctx.find_empty = bedbug603e_find_empty;
- bug_ctx.set = bedbug603e_set;
- bug_ctx.clear = bedbug603e_clear;
-
- for( i = 1; i <= MAX_BREAK_POINTS; ++i )
- (*bug_ctx.clear)( i );
-
- puts ("BEDBUG:ready\n");
- return;
-} /* bedbug_init_breakpoints */
-
-
-
-/* ======================================================================
- * Set/clear/show the hardware breakpoint for the 603e. The "off"
- * string will disable a specific breakpoint. The "show" string will
- * display the current breakpoints. Otherwise an address will set a
- * breakpoint at that address. Setting a breakpoint uses the CPU-specific
- * set routine which will assign a breakpoint number.
- * ====================================================================== */
-
-void bedbug603e_do_break (cmd_tbl_t *cmdtp, int flag, int argc,
- char *argv[])
-{
- long addr; /* Address to break at */
- int which_bp; /* Breakpoint number */
- /* -------------------------------------------------- */
-
- if (argc < 2)
- {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return;
- }
-
- /* Turn off a breakpoint */
-
- if( strcmp( argv[ 1 ], "off" ) == 0 )
- {
- if( bug_ctx.hw_debug_enabled == 0 )
- {
- puts ( "No breakpoints enabled\n" );
- return;
- }
-
- which_bp = simple_strtoul( argv[ 2 ], NULL, 10 );
-
- if( bug_ctx.clear )
- (*bug_ctx.clear)( which_bp );
-
- printf( "Breakpoint %d removed\n", which_bp );
- return;
- }
-
- /* Show a list of breakpoints */
-
- if( strcmp( argv[ 1 ], "show" ) == 0 )
- {
- for( which_bp = 1; which_bp <= MAX_BREAK_POINTS; ++which_bp )
- {
-
- addr = GET_IABR();
-
- printf( "Breakpoint [%d]: ", which_bp );
- if( (addr & 0x00000002) == 0 )
- puts ( "NOT SET\n" );
- else
- disppc( (unsigned char *)(addr & 0xFFFFFFFC), 0, 1, bedbug_puts, F_RADHEX );
- }
- return;
- }
-
- /* Set a breakpoint at the address */
-
- if(!(( isdigit( argv[ 1 ][ 0 ] )) ||
- (( argv[ 1 ][ 0 ] >= 'a' ) && ( argv[ 1 ][ 0 ] <= 'f' )) ||
- (( argv[ 1 ][ 0 ] >= 'A' ) && ( argv[ 1 ][ 0 ] <= 'F' ))))
- {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return;
- }
-
- addr = simple_strtoul( argv[ 1 ], NULL, 16 );
-
- if(( bug_ctx.set ) && ( which_bp = (*bug_ctx.set)( 0, addr )) > 0 )
- {
- printf( "Breakpoint [%d]: ", which_bp );
- disppc( (unsigned char *)addr, 0, 1, bedbug_puts, F_RADHEX );
- }
-
- return;
-} /* bedbug603e_do_break */
-
-
-
-/* ======================================================================
- * Handle a breakpoint. Enter a mini main loop. Stay in the loop until
- * the stopped flag in the debug context is cleared.
- * ====================================================================== */
-
-void bedbug603e_break_isr( struct pt_regs *regs )
-{
- unsigned long addr; /* Address stopped at */
- /* -------------------------------------------------- */
-
- bug_ctx.current_bp = 1;
- addr = GET_IABR() & 0xFFFFFFFC;
-
- bedbug_main_loop( addr, regs );
- return;
-} /* bedbug603e_break_isr */
-
-
-
-/* ======================================================================
- * See if the hardware breakpoint is available.
- * ====================================================================== */
-
-int bedbug603e_find_empty( void )
-{
- /* -------------------------------------------------- */
-
- if( (GET_IABR() && 0x00000002) == 0 )
- return 1;
-
- return 0;
-} /* bedbug603e_find_empty */
-
-
-
-/* ======================================================================
- * Set a breakpoint. If 'which_bp' is zero then find an unused breakpoint
- * number, otherwise reassign the given breakpoint. If hardware debugging
- * is not enabled, then turn it on via the MSR and DBCR0. Set the break
- * address in the IABR register.
- * ====================================================================== */
-
-int bedbug603e_set( int which_bp, unsigned long addr )
-{
- /* -------------------------------------------------- */
-
- if(( addr & 0x00000003 ) != 0 )
- {
- puts ( "Breakpoints must be on a 32 bit boundary\n" );
- return 0;
- }
-
- /* Only look if which_bp == 0, else use which_bp */
- if(( bug_ctx.find_empty ) && ( !which_bp ) &&
- ( which_bp = (*bug_ctx.find_empty)()) == 0 )
- {
- puts ( "All breakpoints in use\n" );
- return 0;
- }
-
- if( which_bp < 1 || which_bp > MAX_BREAK_POINTS )
- {
- printf( "Invalid break point # %d\n", which_bp );
- return 0;
- }
-
- if( ! bug_ctx.hw_debug_enabled )
- {
- bug_ctx.hw_debug_enabled = 1;
- }
-
- SET_IABR( addr | 0x00000002 );
-
- return which_bp;
-} /* bedbug603e_set */
-
-
-
-/* ======================================================================
- * Disable a specific breakoint by setting the IABR register to zero.
- * ====================================================================== */
-
-int bedbug603e_clear( int which_bp )
-{
- /* -------------------------------------------------- */
-
- if( which_bp < 1 || which_bp > MAX_BREAK_POINTS )
- {
- printf( "Invalid break point # (%d)\n", which_bp );
- return -1;
- }
-
- SET_IABR( 0 );
-
- return 0;
-} /* bedbug603e_clear */
-
-
-/* ====================================================================== */
-#endif
diff --git a/cpu/mpc8260/commproc.c b/cpu/mpc8260/commproc.c
deleted file mode 100644
index 8777e77369..0000000000
--- a/cpu/mpc8260/commproc.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * This file is based on "arch/ppc/8260_io/commproc.c" - here is it's
- * copyright notice:
- *
- * General Purpose functions for the global management of the
- * 8260 Communication Processor Module.
- * Copyright (c) 1999 Dan Malek (dmalek@jlc.net)
- * Copyright (c) 2000 MontaVista Software, Inc (source@mvista.com)
- * 2.3.99 Updates
- *
- * In addition to the individual control of the communication
- * channels, there are a few functions that globally affect the
- * communication processor.
- *
- * Buffer descriptors must be allocated from the dual ported memory
- * space. The allocator for that is here. When the communication
- * process is reset, we reclaim the memory available. There is
- * currently no deallocator for this memory.
- */
-#include <common.h>
-#include <asm/cpm_8260.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-void
-m8260_cpm_reset(void)
-{
- volatile immap_t *immr = (immap_t *)CFG_IMMR;
- volatile ulong count;
-
- /* Reclaim the DP memory for our use.
- */
- gd->dp_alloc_base = CPM_DATAONLY_BASE;
- gd->dp_alloc_top = gd->dp_alloc_base + CPM_DATAONLY_SIZE;
-
- /*
- * Reset CPM
- */
- immr->im_cpm.cp_cpcr = CPM_CR_RST;
- count = 0;
- do { /* Spin until command processed */
- __asm__ __volatile__ ("eieio");
- } while ((immr->im_cpm.cp_cpcr & CPM_CR_FLG) && ++count < 1000000);
-
-#ifdef CONFIG_HARD_I2C
- *((unsigned short*)(&immr->im_dprambase[PROFF_I2C_BASE])) = 0;
-#endif
-}
-
-/* Allocate some memory from the dual ported ram.
- * To help protocols with object alignment restrictions, we do that
- * if they ask.
- */
-uint
-m8260_cpm_dpalloc(uint size, uint align)
-{
- volatile immap_t *immr = (immap_t *)CFG_IMMR;
- uint retloc;
- uint align_mask, off;
- uint savebase;
-
- align_mask = align - 1;
- savebase = gd->dp_alloc_base;
-
- if ((off = (gd->dp_alloc_base & align_mask)) != 0)
- gd->dp_alloc_base += (align - off);
-
- if ((off = size & align_mask) != 0)
- size += align - off;
-
- if ((gd->dp_alloc_base + size) >= gd->dp_alloc_top) {
- gd->dp_alloc_base = savebase;
- panic("m8260_cpm_dpalloc: ran out of dual port ram!");
- }
-
- retloc = gd->dp_alloc_base;
- gd->dp_alloc_base += size;
-
- memset((void *)&immr->im_dprambase[retloc], 0, size);
-
- return(retloc);
-}
-
-/* We also own one page of host buffer space for the allocation of
- * UART "fifos" and the like.
- */
-uint
-m8260_cpm_hostalloc(uint size, uint align)
-{
- /* the host might not even have RAM yet - just use dual port RAM */
- return (m8260_cpm_dpalloc(size, align));
-}
-
-/* Set a baud rate generator. This needs lots of work. There are
- * eight BRGs, which can be connected to the CPM channels or output
- * as clocks. The BRGs are in two different block of internal
- * memory mapped space.
- * The baud rate clock is the system clock divided by something.
- * It was set up long ago during the initial boot phase and is
- * is given to us.
- * Baud rate clocks are zero-based in the driver code (as that maps
- * to port numbers). Documentation uses 1-based numbering.
- */
-#define BRG_INT_CLK gd->brg_clk
-#define BRG_UART_CLK (BRG_INT_CLK / 16)
-
-/* This function is used by UARTs, or anything else that uses a 16x
- * oversampled clock.
- */
-void
-m8260_cpm_setbrg(uint brg, uint rate)
-{
- volatile immap_t *immr = (immap_t *)CFG_IMMR;
- volatile uint *bp;
- uint cd = BRG_UART_CLK / rate;
-
- if ((BRG_UART_CLK % rate) < (rate / 2))
- cd--;
- if (brg < 4) {
- bp = (uint *)&immr->im_brgc1;
- }
- else {
- bp = (uint *)&immr->im_brgc5;
- brg -= 4;
- }
- bp += brg;
- *bp = (cd << 1) | CPM_BRG_EN;
-}
-
-/* This function is used to set high speed synchronous baud rate
- * clocks.
- */
-void
-m8260_cpm_fastbrg(uint brg, uint rate, int div16)
-{
- volatile immap_t *immr = (immap_t *)CFG_IMMR;
- volatile uint *bp;
-
- /* This is good enough to get SMCs running.....
- */
- if (brg < 4) {
- bp = (uint *)&immr->im_brgc1;
- }
- else {
- bp = (uint *)&immr->im_brgc5;
- brg -= 4;
- }
- bp += brg;
- *bp = (((((BRG_INT_CLK+rate-1)/rate)-1)&0xfff)<<1)|CPM_BRG_EN;
- if (div16)
- *bp |= CPM_BRG_DIV16;
-}
-
-/* This function is used to set baud rate generators using an external
- * clock source and 16x oversampling.
- */
-
-void
-m8260_cpm_extcbrg(uint brg, uint rate, uint extclk, int pinsel)
-{
- volatile immap_t *immr = (immap_t *)CFG_IMMR;
- volatile uint *bp;
-
- if (brg < 4) {
- bp = (uint *)&immr->im_brgc1;
- }
- else {
- bp = (uint *)&immr->im_brgc5;
- brg -= 4;
- }
- bp += brg;
- *bp = ((((((extclk/16)+rate-1)/rate)-1)&0xfff)<<1)|CPM_BRG_EN;
- if (pinsel == 0)
- *bp |= CPM_BRG_EXTC_CLK3_9;
- else
- *bp |= CPM_BRG_EXTC_CLK5_15;
-}
-
-#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
-
-void post_word_store (ulong a)
-{
- volatile ulong *save_addr =
- (volatile ulong *)(CFG_IMMR + CPM_POST_WORD_ADDR);
-
- *save_addr = a;
-}
-
-ulong post_word_load (void)
-{
- volatile ulong *save_addr =
- (volatile ulong *)(CFG_IMMR + CPM_POST_WORD_ADDR);
-
- return *save_addr;
-}
-
-#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
-
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-
-void bootcount_store (ulong a)
-{
- volatile ulong *save_addr =
- (volatile ulong *)(CFG_IMMR + CPM_BOOTCOUNT_ADDR);
-
- save_addr[0] = a;
- save_addr[1] = BOOTCOUNT_MAGIC;
-}
-
-ulong bootcount_load (void)
-{
- volatile ulong *save_addr =
- (volatile ulong *)(CFG_IMMR + CPM_BOOTCOUNT_ADDR);
-
- if (save_addr[1] != BOOTCOUNT_MAGIC)
- return 0;
- else
- return save_addr[0];
-}
-
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
diff --git a/cpu/mpc8260/config.mk b/cpu/mpc8260/config.mk
deleted file mode 100644
index dd7a71fdf3..0000000000
--- a/cpu/mpc8260/config.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# (C) Copyright 2000
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_8260 -DCONFIG_CPM2 -ffixed-r2 -ffixed-r29 \
- -mstring -mcpu=603e -mmultiple
diff --git a/cpu/mpc8260/cpu.c b/cpu/mpc8260/cpu.c
deleted file mode 100644
index 94651dc4a6..0000000000
--- a/cpu/mpc8260/cpu.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * (C) Copyright 2000-2006
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * CPU specific code for the MPC825x / MPC826x / MPC827x / MPC828x
- *
- * written or collected and sometimes rewritten by
- * Magnus Damm <damm@bitsmart.com>
- *
- * modified by
- * Wolfgang Denk <wd@denx.de>
- *
- * modified for 8260 by
- * Murray Jensen <Murray.Jensen@cmst.csiro.au>
- *
- * added 8260 masks by
- * Marius Groeger <mag@sysgo.de>
- *
- * added HiP7 (824x/827x/8280) processors support by
- * Yuli Barcohen <yuli@arabellasw.com>
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <command.h>
-#include <mpc8260.h>
-#include <asm/processor.h>
-#include <asm/cpm_8260.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if defined(CONFIG_GET_CPU_STR_F)
-extern int get_cpu_str_f (char *buf);
-#endif
-
-int checkcpu (void)
-{
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- ulong clock = gd->cpu_clk;
- uint pvr = get_pvr ();
- uint immr, rev, m, k;
- char buf[32];
-
- puts ("CPU: ");
-
- switch (pvr) {
- case PVR_8260:
- case PVR_8260_HIP3:
- k = 3;
- break;
- case PVR_8260_HIP4:
- k = 4;
- break;
- case PVR_8260_HIP7R1:
- case PVR_8260_HIP7RA:
- case PVR_8260_HIP7:
- k = 7;
- break;
- default:
- return -1; /* whoops! not an MPC8260 */
- }
- rev = pvr & 0xff;
-
- immr = immap->im_memctl.memc_immr;
- if ((immr & IMMR_ISB_MSK) != CFG_IMMR)
- return -1; /* whoops! someone moved the IMMR */
-
-#if defined(CONFIG_GET_CPU_STR_F)
- get_cpu_str_f (buf);
- printf ("%s (HiP%d Rev %02x, Mask ", buf, k, rev);
-#else
- printf (CPU_ID_STR " (HiP%d Rev %02x, Mask ", k, rev);
-#endif
-
- /*
- * the bottom 16 bits of the immr are the Part Number and Mask Number
- * (4-34); the 16 bits at PROFF_REVNUM (0x8af0) in dual port ram is the
- * RISC Microcode Revision Number (13-10).
- * For the 8260, Motorola doesn't include the Microcode Revision
- * in the mask.
- */
- m = immr & (IMMR_PARTNUM_MSK | IMMR_MASKNUM_MSK);
- k = *((ushort *) & immap->im_dprambase[PROFF_REVNUM]);
-
- switch (m) {
- case 0x0000:
- puts ("0.2 2J24M");
- break;
- case 0x0010:
- puts ("A.0 K22A");
- break;
- case 0x0011:
- puts ("A.1 1K22A-XC");
- break;
- case 0x0001:
- puts ("B.1 1K23A");
- break;
- case 0x0021:
- puts ("B.2 2K23A-XC");
- break;
- case 0x0023:
- puts ("B.3 3K23A");
- break;
- case 0x0024:
- puts ("C.2 6K23A");
- break;
- case 0x0060:
- puts ("A.0(A) 2K25A");
- break;
- case 0x0062:
- puts ("B.1 4K25A");
- break;
- case 0x0064:
- puts ("C.0 5K25A");
- break;
- case 0x0A00:
- puts ("0.0 0K49M");
- break;
- case 0x0A01:
- puts ("0.1 1K49M");
- break;
- case 0x0A10:
- puts ("1.0 1K49M");
- break;
- case 0x0C00:
- puts ("0.0 0K50M");
- break;
- case 0x0C10:
- puts ("1.0 1K50M");
- break;
- case 0x0D00:
- puts ("0.0 0K50M");
- break;
- case 0x0D10:
- puts ("1.0 1K50M");
- break;
- default:
- printf ("unknown [immr=0x%04x,k=0x%04x]", m, k);
- break;
- }
-
- printf (") at %s MHz\n", strmhz (buf, clock));
-
- return 0;
-}
-
-/* ------------------------------------------------------------------------- */
-/* configures a UPM by writing into the UPM RAM array */
-/* uses bank 11 and a dummy physical address (=BRx_BA_MSK) */
-/* NOTE: the physical address chosen must not overlap into any other area */
-/* mapped by the memory controller because bank 11 has the lowest priority */
-
-void upmconfig (uint upm, uint * table, uint size)
-{
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- volatile memctl8260_t *memctl = &immap->im_memctl;
- volatile uchar *dummy = (uchar *) BRx_BA_MSK; /* set all BA bits */
- uint i;
-
- /* first set up bank 11 to reference the correct UPM at a dummy address */
-
- memctl->memc_or11 = ORxU_AM_MSK; /* set all AM bits */
-
- switch (upm) {
-
- case UPMA:
- memctl->memc_br11 =
- ((uint)dummy & BRx_BA_MSK) | BRx_PS_32 | BRx_MS_UPMA |
- BRx_V;
- memctl->memc_mamr = MxMR_OP_WARR;
- break;
-
- case UPMB:
- memctl->memc_br11 =
- ((uint)dummy & BRx_BA_MSK) | BRx_PS_32 | BRx_MS_UPMB |
- BRx_V;
- memctl->memc_mbmr = MxMR_OP_WARR;
- break;
-
- case UPMC:
- memctl->memc_br11 =
- ((uint)dummy & BRx_BA_MSK) | BRx_PS_32 | BRx_MS_UPMC |
- BRx_V;
- memctl->memc_mcmr = MxMR_OP_WARR;
- break;
-
- default:
- panic ("upmconfig passed invalid UPM number (%u)\n", upm);
- break;
-
- }
-
- /*
- * at this point, the dummy address is set up to access the selected UPM,
- * the MAD pointer is zero, and the MxMR OP is set for writing to RAM
- *
- * now we simply load the mdr with each word and poke the dummy address.
- * the MAD is incremented on each access.
- */
-
- for (i = 0; i < size; i++) {
- memctl->memc_mdr = table[i];
- *dummy = 0;
- }
-
- /* now kill bank 11 */
- memctl->memc_br11 = 0;
-}
-
-/* ------------------------------------------------------------------------- */
-
-#if !defined(CONFIG_HAVE_OWN_RESET)
-int
-do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
-{
- ulong msr, addr;
-
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
-
- immap->im_clkrst.car_rmr = RMR_CSRE; /* Checkstop Reset enable */
-
- /* Interrupts and MMU off */
- __asm__ __volatile__ ("mfmsr %0":"=r" (msr):);
-
- msr &= ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR);
- __asm__ __volatile__ ("mtmsr %0"::"r" (msr));
-
- /*
- * Trying to execute the next instruction at a non-existing address
- * should cause a machine check, resulting in reset
- */
-#ifdef CFG_RESET_ADDRESS
- addr = CFG_RESET_ADDRESS;
-#else
- /*
- * note: when CFG_MONITOR_BASE points to a RAM address, CFG_MONITOR_BASE
- * - sizeof (ulong) is usually a valid address. Better pick an address
- * known to be invalid on your system and assign it to CFG_RESET_ADDRESS.
- */
- addr = CFG_MONITOR_BASE - sizeof (ulong);
-#endif
- ((void (*)(void)) addr) ();
- return 1;
-
-}
-#endif /* CONFIG_HAVE_OWN_RESET */
-
-/* ------------------------------------------------------------------------- */
-
-/*
- * Get timebase clock frequency (like cpu_clk in Hz)
- *
- */
-unsigned long get_tbclk (void)
-{
- ulong tbclk;
-
- tbclk = (gd->bus_clk + 3L) / 4L;
-
- return (tbclk);
-}
-
-/* ------------------------------------------------------------------------- */
-
-#if defined(CONFIG_WATCHDOG)
-void watchdog_reset (void)
-{
- int re_enable = disable_interrupts ();
-
- reset_8260_watchdog ((immap_t *) CFG_IMMR);
- if (re_enable)
- enable_interrupts ();
-}
-#endif /* CONFIG_WATCHDOG */
-
-/* ------------------------------------------------------------------------- */
diff --git a/cpu/mpc8260/cpu_init.c b/cpu/mpc8260/cpu_init.c
deleted file mode 100644
index 7dcc94999d..0000000000
--- a/cpu/mpc8260/cpu_init.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc8260.h>
-#include <asm/cpm_8260.h>
-#include <ioports.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
-extern unsigned long board_get_cpu_clk_f (void);
-#endif
-
-static void config_8260_ioports (volatile immap_t * immr)
-{
- int portnum;
-
- for (portnum = 0; portnum < 4; portnum++) {
- uint pmsk = 0,
- ppar = 0,
- psor = 0,
- pdir = 0,
- podr = 0,
- pdat = 0;
- iop_conf_t *iopc = (iop_conf_t *) & iop_conf_tab[portnum][0];
- iop_conf_t *eiopc = iopc + 32;
- uint msk = 1;
-
- /*
- * NOTE:
- * index 0 refers to pin 31,
- * index 31 refers to pin 0
- */
- while (iopc < eiopc) {
- if (iopc->conf) {
- pmsk |= msk;
- if (iopc->ppar)
- ppar |= msk;
- if (iopc->psor)
- psor |= msk;
- if (iopc->pdir)
- pdir |= msk;
- if (iopc->podr)
- podr |= msk;
- if (iopc->pdat)
- pdat |= msk;
- }
-
- msk <<= 1;
- iopc++;
- }
-
- if (pmsk != 0) {
- volatile ioport_t *iop = ioport_addr (immr, portnum);
- uint tpmsk = ~pmsk;
-
- /*
- * the (somewhat confused) paragraph at the
- * bottom of page 35-5 warns that there might
- * be "unknown behaviour" when programming
- * PSORx and PDIRx, if PPARx = 1, so I
- * decided this meant I had to disable the
- * dedicated function first, and enable it
- * last.
- */
- iop->ppar &= tpmsk;
- iop->psor = (iop->psor & tpmsk) | psor;
- iop->podr = (iop->podr & tpmsk) | podr;
- iop->pdat = (iop->pdat & tpmsk) | pdat;
- iop->pdir = (iop->pdir & tpmsk) | pdir;
- iop->ppar |= ppar;
- }
- }
-}
-
-#define SET_VAL_MASK(a, b, mask) ((a & mask) | (b & ~mask))
-/*
- * Breath some life into the CPU...
- *
- * Set up the memory map,
- * initialize a bunch of registers,
- * initialize the UPM's
- */
-void cpu_init_f (volatile immap_t * immr)
-{
-#if !defined(CONFIG_COGENT) /* done in start.S for the cogent */
- uint sccr;
-#endif
-#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
- unsigned long cpu_clk;
-#endif
- volatile memctl8260_t *memctl = &immr->im_memctl;
- extern void m8260_cpm_reset (void);
-
- /* Pointer is writable since we allocated a register for it */
- gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
-
- /* Clear initial global data */
- memset ((void *) gd, 0, sizeof (gd_t));
-
- /* RSR - Reset Status Register - clear all status (5-4) */
- gd->reset_status = immr->im_clkrst.car_rsr;
- immr->im_clkrst.car_rsr = RSR_ALLBITS;
-
- /* RMR - Reset Mode Register - contains checkstop reset enable (5-5) */
- immr->im_clkrst.car_rmr = CFG_RMR;
-
- /* BCR - Bus Configuration Register (4-25) */
-#if defined(CFG_BCR_60x) && (CFG_BCR_SINGLE)
- if (immr->im_siu_conf.sc_bcr & BCR_EBM) {
- immr->im_siu_conf.sc_bcr = CFG_BCR_60x;
- } else {
- immr->im_siu_conf.sc_bcr = CFG_BCR_SINGLE;
- }
-#else
- immr->im_siu_conf.sc_bcr = CFG_BCR;
-#endif
-
- /* SIUMCR - contains debug pin configuration (4-31) */
-#if defined(CFG_SIUMCR_LOW) && (CFG_SIUMCR_HIGH)
- cpu_clk = board_get_cpu_clk_f ();
- if (cpu_clk >= 100000000) {
- immr->im_siu_conf.sc_siumcr = CFG_SIUMCR_HIGH;
- } else {
- immr->im_siu_conf.sc_siumcr = CFG_SIUMCR_LOW;
- }
-#else
- immr->im_siu_conf.sc_siumcr = CFG_SIUMCR;
-#endif
-
- config_8260_ioports (immr);
-
- /* initialize time counter status and control register (4-40) */
- immr->im_sit.sit_tmcntsc = CFG_TMCNTSC;
-
- /* initialize the PIT (4-42) */
- immr->im_sit.sit_piscr = CFG_PISCR;
-
-#if !defined(CONFIG_COGENT) /* done in start.S for the cogent */
- /* System clock control register (9-8) */
- sccr = immr->im_clkrst.car_sccr &
- (SCCR_PCI_MODE | SCCR_PCI_MODCK | SCCR_PCIDF_MSK);
- immr->im_clkrst.car_sccr = sccr |
- (CFG_SCCR & ~(SCCR_PCI_MODE | SCCR_PCI_MODCK | SCCR_PCIDF_MSK) );
-#endif /* !CONFIG_COGENT */
-
- /*
- * Memory Controller:
- */
-
- /* Map banks 0 and 1 to the FLASH banks 0 and 1 at preliminary
- * addresses - these have to be modified later when FLASH size
- * has been determined
- */
-
-#if defined(CFG_OR0_REMAP)
- memctl->memc_or0 = CFG_OR0_REMAP;
-#endif
-#if defined(CFG_OR1_REMAP)
- memctl->memc_or1 = CFG_OR1_REMAP;
-#endif
-
- /* now restrict to preliminary range */
- /* the PS came from the HRCW, don´t change it */
- memctl->memc_br0 = SET_VAL_MASK(memctl->memc_br0 , CFG_BR0_PRELIM, BRx_PS_MSK);
- memctl->memc_or0 = CFG_OR0_PRELIM;
-
-#if defined(CFG_BR1_PRELIM) && defined(CFG_OR1_PRELIM)
- memctl->memc_or1 = CFG_OR1_PRELIM;
- memctl->memc_br1 = CFG_BR1_PRELIM;
-#endif
-
-#if defined(CFG_BR2_PRELIM) && defined(CFG_OR2_PRELIM)
- memctl->memc_or2 = CFG_OR2_PRELIM;
- memctl->memc_br2 = CFG_BR2_PRELIM;
-#endif
-
-#if defined(CFG_BR3_PRELIM) && defined(CFG_OR3_PRELIM)
- memctl->memc_or3 = CFG_OR3_PRELIM;
- memctl->memc_br3 = CFG_BR3_PRELIM;
-#endif
-
-#if defined(CFG_BR4_PRELIM) && defined(CFG_OR4_PRELIM)
- memctl->memc_or4 = CFG_OR4_PRELIM;
- memctl->memc_br4 = CFG_BR4_PRELIM;
-#endif
-
-#if defined(CFG_BR5_PRELIM) && defined(CFG_OR5_PRELIM)
- memctl->memc_or5 = CFG_OR5_PRELIM;
- memctl->memc_br5 = CFG_BR5_PRELIM;
-#endif
-
-#if defined(CFG_BR6_PRELIM) && defined(CFG_OR6_PRELIM)
- memctl->memc_or6 = CFG_OR6_PRELIM;
- memctl->memc_br6 = CFG_BR6_PRELIM;
-#endif
-
-#if defined(CFG_BR7_PRELIM) && defined(CFG_OR7_PRELIM)
- memctl->memc_or7 = CFG_OR7_PRELIM;
- memctl->memc_br7 = CFG_BR7_PRELIM;
-#endif
-
-#if defined(CFG_BR8_PRELIM) && defined(CFG_OR8_PRELIM)
- memctl->memc_or8 = CFG_OR8_PRELIM;
- memctl->memc_br8 = CFG_BR8_PRELIM;
-#endif
-
-#if defined(CFG_BR9_PRELIM) && defined(CFG_OR9_PRELIM)
- memctl->memc_or9 = CFG_OR9_PRELIM;
- memctl->memc_br9 = CFG_BR9_PRELIM;
-#endif
-
-#if defined(CFG_BR10_PRELIM) && defined(CFG_OR10_PRELIM)
- memctl->memc_or10 = CFG_OR10_PRELIM;
- memctl->memc_br10 = CFG_BR10_PRELIM;
-#endif
-
-#if defined(CFG_BR11_PRELIM) && defined(CFG_OR11_PRELIM)
- memctl->memc_or11 = CFG_OR11_PRELIM;
- memctl->memc_br11 = CFG_BR11_PRELIM;
-#endif
-
- m8260_cpm_reset ();
-}
-
-/*
- * initialize higher level parts of CPU like time base and timers
- */
-int cpu_init_r (void)
-{
- volatile immap_t *immr = (immap_t *) gd->bd->bi_immr_base;
-
- immr->im_cpm.cp_rccr = CFG_RCCR;
-
- return (0);
-}
-
-/*
- * print out the reason for the reset
- */
-int prt_8260_rsr (void)
-{
- static struct {
- ulong mask;
- char *desc;
- } bits[] = {
- {
- RSR_JTRS, "JTAG"}, {
- RSR_CSRS, "Check Stop"}, {
- RSR_SWRS, "Software Watchdog"}, {
- RSR_BMRS, "Bus Monitor"}, {
- RSR_ESRS, "External Soft"}, {
- RSR_EHRS, "External Hard"}
- };
- static int n = sizeof bits / sizeof bits[0];
- ulong rsr = gd->reset_status;
- int i;
- char *sep;
-
- puts (CPU_ID_STR " Reset Status:");
-
- sep = " ";
- for (i = 0; i < n; i++)
- if (rsr & bits[i].mask) {
- printf ("%s%s", sep, bits[i].desc);
- sep = ", ";
- }
-
- puts ("\n\n");
- return (0);
-}
diff --git a/cpu/mpc8260/i2c.c b/cpu/mpc8260/i2c.c
deleted file mode 100644
index 34bd3897f6..0000000000
--- a/cpu/mpc8260/i2c.c
+++ /dev/null
@@ -1,768 +0,0 @@
-/*
- * (C) Copyright 2000
- * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
- *
- * (C) Copyright 2000 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-#if defined(CONFIG_HARD_I2C)
-
-#include <asm/cpm_8260.h>
-#include <i2c.h>
-
-/* define to enable debug messages */
-#undef DEBUG_I2C
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/* uSec to wait between polls of the i2c */
-#define DELAY_US 100
-/* uSec to wait for the CPM to start processing the buffer */
-#define START_DELAY_US 1000
-
-/*
- * tx/rx per-byte timeout: we delay DELAY_US uSec between polls so the
- * timeout will be (tx_length + rx_length) * DELAY_US * TOUT_LOOP
- */
-#define TOUT_LOOP 5
-
-/*-----------------------------------------------------------------------
- * Set default values
- */
-#ifndef CFG_I2C_SPEED
-#define CFG_I2C_SPEED 50000
-#endif
-
-#ifndef CFG_I2C_SLAVE
-#define CFG_I2C_SLAVE 0xFE
-#endif
-/*-----------------------------------------------------------------------
- */
-
-typedef void (*i2c_ecb_t)(int, int, void *); /* error callback function */
-
-/* This structure keeps track of the bd and buffer space usage. */
-typedef struct i2c_state {
- int rx_idx; /* index to next free Rx BD */
- int tx_idx; /* index to next free Tx BD */
- void *rxbd; /* pointer to next free Rx BD */
- void *txbd; /* pointer to next free Tx BD */
- int tx_space; /* number of Tx bytes left */
- unsigned char *tx_buf; /* pointer to free Tx area */
- i2c_ecb_t err_cb; /* error callback function */
- void *cb_data; /* private data to be passed */
-} i2c_state_t;
-
-/* flags for i2c_send() and i2c_receive() */
-#define I2CF_ENABLE_SECONDARY 0x01 /* secondary_address is valid */
-#define I2CF_START_COND 0x02 /* tx: generate start condition */
-#define I2CF_STOP_COND 0x04 /* tx: generate stop condition */
-
-/* return codes */
-#define I2CERR_NO_BUFFERS 1 /* no more BDs or buffer space */
-#define I2CERR_MSG_TOO_LONG 2 /* tried to send/receive to much data */
-#define I2CERR_TIMEOUT 3 /* timeout in i2c_doio() */
-#define I2CERR_QUEUE_EMPTY 4 /* i2c_doio called without send/receive */
-#define I2CERR_IO_ERROR 5 /* had an error during comms */
-
-/* error callback flags */
-#define I2CECB_RX_ERR 0x10 /* this is a receive error */
-#define I2CECB_RX_OV 0x02 /* receive overrun error */
-#define I2CECB_RX_MASK 0x0f /* mask for error bits */
-#define I2CECB_TX_ERR 0x20 /* this is a transmit error */
-#define I2CECB_TX_CL 0x01 /* transmit collision error */
-#define I2CECB_TX_UN 0x02 /* transmit underflow error */
-#define I2CECB_TX_NAK 0x04 /* transmit no ack error */
-#define I2CECB_TX_MASK 0x0f /* mask for error bits */
-#define I2CECB_TIMEOUT 0x40 /* this is a timeout error */
-
-#define ERROR_I2C_NONE 0
-#define ERROR_I2C_LENGTH 1
-
-#define I2C_WRITE_BIT 0x00
-#define I2C_READ_BIT 0x01
-
-#define I2C_RXTX_LEN 128 /* maximum tx/rx buffer length */
-
-
-#define NUM_RX_BDS 4
-#define NUM_TX_BDS 4
-#define MAX_TX_SPACE 256
-
-typedef struct I2C_BD
-{
- unsigned short status;
- unsigned short length;
- unsigned char *addr;
-} I2C_BD;
-#define BD_I2C_TX_START 0x0400 /* special status for i2c: Start condition */
-
-#define BD_I2C_TX_CL 0x0001 /* collision error */
-#define BD_I2C_TX_UN 0x0002 /* underflow error */
-#define BD_I2C_TX_NAK 0x0004 /* no acknowledge error */
-#define BD_I2C_TX_ERR (BD_I2C_TX_NAK|BD_I2C_TX_UN|BD_I2C_TX_CL)
-
-#define BD_I2C_RX_ERR BD_SC_OV
-
-#ifdef DEBUG_I2C
-#define PRINTD(x) printf x
-#else
-#define PRINTD(x)
-#endif
-
-/*
- * Returns the best value of I2BRG to meet desired clock speed of I2C with
- * input parameters (clock speed, filter, and predivider value).
- * It returns computer speed value and the difference between it and desired
- * speed.
- */
-static inline int
-i2c_roundrate(int hz, int speed, int filter, int modval,
- int *brgval, int *totspeed)
-{
- int moddiv = 1 << (5-(modval & 3)), brgdiv, div;
-
- PRINTD(("\t[I2C] trying hz=%d, speed=%d, filter=%d, modval=%d\n",
- hz, speed, filter, modval));
-
- div = moddiv * speed;
- brgdiv = (hz + div - 1) / div;
-
- PRINTD(("\t\tmoddiv=%d, brgdiv=%d\n", moddiv, brgdiv));
-
- *brgval = ((brgdiv + 1) / 2) - 3 - (2*filter);
-
- if ((*brgval < 0) || (*brgval > 255)) {
- PRINTD(("\t\trejected brgval=%d\n", *brgval));
- return -1;
- }
-
- brgdiv = 2 * (*brgval + 3 + (2 * filter));
- div = moddiv * brgdiv ;
- *totspeed = hz / div;
-
- PRINTD(("\t\taccepted brgval=%d, totspeed=%d\n", *brgval, *totspeed));
-
- return 0;
-}
-
-/*
- * Sets the I2C clock predivider and divider to meet required clock speed.
- */
-static int i2c_setrate(int hz, int speed)
-{
- immap_t *immap = (immap_t *)CFG_IMMR ;
- volatile i2c8260_t *i2c = (i2c8260_t *)&immap->im_i2c;
- int brgval,
- modval, /* 0-3 */
- bestspeed_diff = speed,
- bestspeed_brgval=0,
- bestspeed_modval=0,
- bestspeed_filter=0,
- totspeed,
- filter = 0; /* Use this fixed value */
-
- for (modval = 0; modval < 4; modval++)
- {
- if (i2c_roundrate (hz, speed, filter, modval, &brgval, &totspeed) == 0)
- {
- int diff = speed - totspeed ;
-
- if ((diff >= 0) && (diff < bestspeed_diff))
- {
- bestspeed_diff = diff ;
- bestspeed_modval = modval;
- bestspeed_brgval = brgval;
- bestspeed_filter = filter;
- }
- }
- }
-
- PRINTD(("[I2C] Best is:\n"));
- PRINTD(("[I2C] CPU=%dhz RATE=%d F=%d I2MOD=%08x I2BRG=%08x DIFF=%dhz\n",
- hz, speed,
- bestspeed_filter, bestspeed_modval, bestspeed_brgval,
- bestspeed_diff));
-
- i2c->i2c_i2mod |= ((bestspeed_modval & 3) << 1) | (bestspeed_filter << 3);
- i2c->i2c_i2brg = bestspeed_brgval & 0xff;
-
- PRINTD(("[I2C] i2mod=%08x i2brg=%08x\n", i2c->i2c_i2mod, i2c->i2c_i2brg));
-
- return 1 ;
-}
-
-void i2c_init(int speed, int slaveadd)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR ;
- volatile cpm8260_t *cp = (cpm8260_t *)&immap->im_cpm;
- volatile i2c8260_t *i2c = (i2c8260_t *)&immap->im_i2c;
- volatile iic_t *iip;
- ulong rbase, tbase;
- volatile I2C_BD *rxbd, *txbd;
- uint dpaddr;
-
-#ifdef CFG_I2C_INIT_BOARD
- /* call board specific i2c bus reset routine before accessing the */
- /* environment, which might be in a chip on that bus. For details */
- /* about this problem see doc/I2C_Edge_Conditions. */
- i2c_init_board();
-#endif
-
- dpaddr = *((unsigned short*)(&immap->im_dprambase[PROFF_I2C_BASE]));
- if (dpaddr == 0) {
- /* need to allocate dual port ram */
- dpaddr = m8260_cpm_dpalloc(64 +
- (NUM_RX_BDS * sizeof(I2C_BD)) + (NUM_TX_BDS * sizeof(I2C_BD)) +
- MAX_TX_SPACE, 64);
- *((unsigned short*)(&immap->im_dprambase[PROFF_I2C_BASE])) = dpaddr;
- }
-
- /*
- * initialise data in dual port ram:
- *
- * dpaddr -> parameter ram (64 bytes)
- * rbase -> rx BD (NUM_RX_BDS * sizeof(I2C_BD) bytes)
- * tbase -> tx BD (NUM_TX_BDS * sizeof(I2C_BD) bytes)
- * tx buffer (MAX_TX_SPACE bytes)
- */
-
- iip = (iic_t *)&immap->im_dprambase[dpaddr];
- memset((void*)iip, 0, sizeof(iic_t));
-
- rbase = dpaddr + 64;
- tbase = rbase + NUM_RX_BDS * sizeof(I2C_BD);
-
- /* Disable interrupts */
- i2c->i2c_i2mod = 0x00;
- i2c->i2c_i2cmr = 0x00;
- i2c->i2c_i2cer = 0xff;
- i2c->i2c_i2add = slaveadd;
-
- /*
- * Set the I2C BRG Clock division factor from desired i2c rate
- * and current CPU rate (we assume sccr dfbgr field is 0;
- * divide BRGCLK by 1)
- */
- PRINTD(("[I2C] Setting rate...\n"));
- i2c_setrate (gd->brg_clk, CFG_I2C_SPEED) ;
-
- /* Set I2C controller in master mode */
- i2c->i2c_i2com = 0x01;
-
- /* Initialize Tx/Rx parameters */
- iip->iic_rbase = rbase;
- iip->iic_tbase = tbase;
- rxbd = (I2C_BD *)((unsigned char *)&immap->im_dprambase[iip->iic_rbase]);
- txbd = (I2C_BD *)((unsigned char *)&immap->im_dprambase[iip->iic_tbase]);
-
- PRINTD(("[I2C] rbase = %04x\n", iip->iic_rbase));
- PRINTD(("[I2C] tbase = %04x\n", iip->iic_tbase));
- PRINTD(("[I2C] rxbd = %08x\n", (int)rxbd));
- PRINTD(("[I2C] txbd = %08x\n", (int)txbd));
-
- /* Set big endian byte order */
- iip->iic_tfcr = 0x10;
- iip->iic_rfcr = 0x10;
-
- /* Set maximum receive size. */
- iip->iic_mrblr = I2C_RXTX_LEN;
-
- cp->cp_cpcr = mk_cr_cmd(CPM_CR_I2C_PAGE,
- CPM_CR_I2C_SBLOCK,
- 0x00,
- CPM_CR_INIT_TRX) | CPM_CR_FLG;
- do {
- __asm__ __volatile__ ("eieio");
- } while (cp->cp_cpcr & CPM_CR_FLG);
-
- /* Clear events and interrupts */
- i2c->i2c_i2cer = 0xff;
- i2c->i2c_i2cmr = 0x00;
-}
-
-static
-void i2c_newio(i2c_state_t *state)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR ;
- volatile iic_t *iip;
- uint dpaddr;
-
- PRINTD(("[I2C] i2c_newio\n"));
-
- dpaddr = *((unsigned short*)(&immap->im_dprambase[PROFF_I2C_BASE]));
- iip = (iic_t *)&immap->im_dprambase[dpaddr];
- state->rx_idx = 0;
- state->tx_idx = 0;
- state->rxbd = (void*)&immap->im_dprambase[iip->iic_rbase];
- state->txbd = (void*)&immap->im_dprambase[iip->iic_tbase];
- state->tx_space = MAX_TX_SPACE;
- state->tx_buf = (uchar*)state->txbd + NUM_TX_BDS * sizeof(I2C_BD);
- state->err_cb = NULL;
- state->cb_data = NULL;
-
- PRINTD(("[I2C] rxbd = %08x\n", (int)state->rxbd));
- PRINTD(("[I2C] txbd = %08x\n", (int)state->txbd));
- PRINTD(("[I2C] tx_buf = %08x\n", (int)state->tx_buf));
-
- /* clear the buffer memory */
- memset((char *)state->tx_buf, 0, MAX_TX_SPACE);
-}
-
-static
-int i2c_send(i2c_state_t *state,
- unsigned char address,
- unsigned char secondary_address,
- unsigned int flags,
- unsigned short size,
- unsigned char *dataout)
-{
- volatile I2C_BD *txbd;
- int i,j;
-
- PRINTD(("[I2C] i2c_send add=%02d sec=%02d flag=%02d size=%d\n",
- address, secondary_address, flags, size));
-
- /* trying to send message larger than BD */
- if (size > I2C_RXTX_LEN)
- return I2CERR_MSG_TOO_LONG;
-
- /* no more free bds */
- if (state->tx_idx >= NUM_TX_BDS || state->tx_space < (2 + size))
- return I2CERR_NO_BUFFERS;
-
- txbd = (I2C_BD *)state->txbd;
- txbd->addr = state->tx_buf;
-
- PRINTD(("[I2C] txbd = %08x\n", (int)txbd));
-
- if (flags & I2CF_START_COND)
- {
- PRINTD(("[I2C] Formatting addresses...\n"));
- if (flags & I2CF_ENABLE_SECONDARY)
- {
- txbd->length = size + 2; /* Length of message plus dest addresses */
- txbd->addr[0] = address << 1;
- txbd->addr[1] = secondary_address;
- i = 2;
- }
- else
- {
- txbd->length = size + 1; /* Length of message plus dest address */
- txbd->addr[0] = address << 1; /* Write destination address to BD */
- i = 1;
- }
- }
- else
- {
- txbd->length = size; /* Length of message */
- i = 0;
- }
-
- /* set up txbd */
- txbd->status = BD_SC_READY;
- if (flags & I2CF_START_COND)
- txbd->status |= BD_I2C_TX_START;
- if (flags & I2CF_STOP_COND)
- txbd->status |= BD_SC_LAST | BD_SC_WRAP;
-
- /* Copy data to send into buffer */
- PRINTD(("[I2C] copy data...\n"));
- for(j = 0; j < size; i++, j++)
- txbd->addr[i] = dataout[j];
-
- PRINTD(("[I2C] txbd: length=0x%04x status=0x%04x addr[0]=0x%02x addr[1]=0x%02x\n",
- txbd->length,
- txbd->status,
- txbd->addr[0],
- txbd->addr[1]));
-
- /* advance state */
- state->tx_buf += txbd->length;
- state->tx_space -= txbd->length;
- state->tx_idx++;
- state->txbd = (void*)(txbd + 1);
-
- return 0;
-}
-
-static
-int i2c_receive(i2c_state_t *state,
- unsigned char address,
- unsigned char secondary_address,
- unsigned int flags,
- unsigned short size_to_expect,
- unsigned char *datain)
-{
- volatile I2C_BD *rxbd, *txbd;
-
- PRINTD(("[I2C] i2c_receive %02d %02d %02d\n", address, secondary_address, flags));
-
- /* Expected to receive too much */
- if (size_to_expect > I2C_RXTX_LEN)
- return I2CERR_MSG_TOO_LONG;
-
- /* no more free bds */
- if (state->tx_idx >= NUM_TX_BDS || state->rx_idx >= NUM_RX_BDS
- || state->tx_space < 2)
- return I2CERR_NO_BUFFERS;
-
- rxbd = (I2C_BD *)state->rxbd;
- txbd = (I2C_BD *)state->txbd;
-
- PRINTD(("[I2C] rxbd = %08x\n", (int)rxbd));
- PRINTD(("[I2C] txbd = %08x\n", (int)txbd));
-
- txbd->addr = state->tx_buf;
-
- /* set up TXBD for destination address */
- if (flags & I2CF_ENABLE_SECONDARY)
- {
- txbd->length = 2;
- txbd->addr[0] = address << 1; /* Write data */
- txbd->addr[1] = secondary_address; /* Internal address */
- txbd->status = BD_SC_READY;
- }
- else
- {
- txbd->length = 1 + size_to_expect;
- txbd->addr[0] = (address << 1) | 0x01;
- txbd->status = BD_SC_READY;
- memset(&txbd->addr[1], 0, txbd->length);
- }
-
- /* set up rxbd for reception */
- rxbd->status = BD_SC_EMPTY;
- rxbd->length = size_to_expect;
- rxbd->addr = datain;
-
- txbd->status |= BD_I2C_TX_START;
- if (flags & I2CF_STOP_COND)
- {
- txbd->status |= BD_SC_LAST | BD_SC_WRAP;
- rxbd->status |= BD_SC_WRAP;
- }
-
- PRINTD(("[I2C] txbd: length=0x%04x status=0x%04x addr[0]=0x%02x addr[1]=0x%02x\n",
- txbd->length,
- txbd->status,
- txbd->addr[0],
- txbd->addr[1]));
- PRINTD(("[I2C] rxbd: length=0x%04x status=0x%04x addr[0]=0x%02x addr[1]=0x%02x\n",
- rxbd->length,
- rxbd->status,
- rxbd->addr[0],
- rxbd->addr[1]));
-
- /* advance state */
- state->tx_buf += txbd->length;
- state->tx_space -= txbd->length;
- state->tx_idx++;
- state->txbd = (void*)(txbd + 1);
- state->rx_idx++;
- state->rxbd = (void*)(rxbd + 1);
-
- return 0;
-}
-
-
-static
-int i2c_doio(i2c_state_t *state)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR ;
- volatile iic_t *iip;
- volatile i2c8260_t *i2c = (i2c8260_t *)&immap->im_i2c;
- volatile I2C_BD *txbd, *rxbd;
- int n, i, b, rxcnt = 0, rxtimeo = 0, txcnt = 0, txtimeo = 0, rc = 0;
- uint dpaddr;
-
- PRINTD(("[I2C] i2c_doio\n"));
-
- if (state->tx_idx <= 0 && state->rx_idx <= 0) {
- PRINTD(("[I2C] No I/O is queued\n"));
- return I2CERR_QUEUE_EMPTY;
- }
-
- dpaddr = *((unsigned short*)(&immap->im_dprambase[PROFF_I2C_BASE]));
- iip = (iic_t *)&immap->im_dprambase[dpaddr];
- iip->iic_rbptr = iip->iic_rbase;
- iip->iic_tbptr = iip->iic_tbase;
-
- /* Enable I2C */
- PRINTD(("[I2C] Enabling I2C...\n"));
- i2c->i2c_i2mod |= 0x01;
-
- /* Begin transmission */
- i2c->i2c_i2com |= 0x80;
-
- /* Loop until transmit & receive completed */
-
- if ((n = state->tx_idx) > 0) {
-
- txbd = ((I2C_BD*)state->txbd) - n;
- for (i = 0; i < n; i++) {
- txtimeo += TOUT_LOOP * txbd->length;
- txbd++;
- }
-
- txbd--; /* wait until last in list is done */
-
- PRINTD(("[I2C] Transmitting...(txbd=0x%08lx)\n", (ulong)txbd));
-
- udelay(START_DELAY_US); /* give it time to start */
- while((txbd->status & BD_SC_READY) && (++txcnt < txtimeo)) {
- udelay(DELAY_US);
- if (ctrlc())
- return (-1);
- __asm__ __volatile__ ("eieio");
- }
- }
-
- if (txcnt < txtimeo && (n = state->rx_idx) > 0) {
-
- rxbd = ((I2C_BD*)state->rxbd) - n;
- for (i = 0; i < n; i++) {
- rxtimeo += TOUT_LOOP * rxbd->length;
- rxbd++;
- }
-
- rxbd--; /* wait until last in list is done */
-
- PRINTD(("[I2C] Receiving...(rxbd=0x%08lx)\n", (ulong)rxbd));
-
- udelay(START_DELAY_US); /* give it time to start */
- while((rxbd->status & BD_SC_EMPTY) && (++rxcnt < rxtimeo)) {
- udelay(DELAY_US);
- if (ctrlc())
- return (-1);
- __asm__ __volatile__ ("eieio");
- }
- }
-
- /* Turn off I2C */
- i2c->i2c_i2mod &= ~0x01;
-
- if ((n = state->tx_idx) > 0) {
- for (i = 0; i < n; i++) {
- txbd = ((I2C_BD*)state->txbd) - (n - i);
- if ((b = txbd->status & BD_I2C_TX_ERR) != 0) {
- if (state->err_cb != NULL)
- (*state->err_cb)(I2CECB_TX_ERR|b, i,
- state->cb_data);
- if (rc == 0)
- rc = I2CERR_IO_ERROR;
- }
- }
- }
-
- if ((n = state->rx_idx) > 0) {
- for (i = 0; i < n; i++) {
- rxbd = ((I2C_BD*)state->rxbd) - (n - i);
- if ((b = rxbd->status & BD_I2C_RX_ERR) != 0) {
- if (state->err_cb != NULL)
- (*state->err_cb)(I2CECB_RX_ERR|b, i,
- state->cb_data);
- if (rc == 0)
- rc = I2CERR_IO_ERROR;
- }
- }
- }
-
- if ((txtimeo > 0 && txcnt >= txtimeo) || \
- (rxtimeo > 0 && rxcnt >= rxtimeo)) {
- if (state->err_cb != NULL)
- (*state->err_cb)(I2CECB_TIMEOUT, -1, state->cb_data);
- if (rc == 0)
- rc = I2CERR_TIMEOUT;
- }
-
- return (rc);
-}
-
-static void
-i2c_probe_callback(int flags, int xnum, void *data)
-{
- /*
- * the only acceptable errors are a transmit NAK or a receive
- * overrun - tx NAK means the device does not exist, rx OV
- * means the device must have responded to the slave address
- * even though the transfer failed
- */
- if (flags == (I2CECB_TX_ERR|I2CECB_TX_NAK))
- *(int *)data |= 1;
- if (flags == (I2CECB_RX_ERR|I2CECB_RX_OV))
- *(int *)data |= 2;
-}
-
-int
-i2c_probe(uchar chip)
-{
- i2c_state_t state;
- int rc, err_flag;
- uchar buf[1];
-
- i2c_newio(&state);
-
- state.err_cb = i2c_probe_callback;
- state.cb_data = (void *) &err_flag;
- err_flag = 0;
-
- rc = i2c_receive(&state, chip, 0, I2CF_START_COND|I2CF_STOP_COND, 1, buf);
-
- if (rc != 0)
- return (rc); /* probe failed */
-
- rc = i2c_doio(&state);
-
- if (rc == 0)
- return (0); /* device exists - read succeeded */
-
- if (rc == I2CERR_TIMEOUT)
- return (-1); /* device does not exist - timeout */
-
- if (rc != I2CERR_IO_ERROR || err_flag == 0)
- return (rc); /* probe failed */
-
- if (err_flag & 1)
- return (-1); /* device does not exist - had transmit NAK */
-
- return (0); /* device exists - had receive overrun */
-}
-
-
-int
-i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
-{
- i2c_state_t state;
- uchar xaddr[4];
- int rc;
-
- xaddr[0] = (addr >> 24) & 0xFF;
- xaddr[1] = (addr >> 16) & 0xFF;
- xaddr[2] = (addr >> 8) & 0xFF;
- xaddr[3] = addr & 0xFF;
-
-#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
- /*
- * EEPROM chips that implement "address overflow" are ones
- * like Catalyst 24WC04/08/16 which has 9/10/11 bits of address
- * and the extra bits end up in the "chip address" bit slots.
- * This makes a 24WC08 (1Kbyte) chip look like four 256 byte
- * chips.
- *
- * Note that we consider the length of the address field to still
- * be one byte because the extra address bits are hidden in the
- * chip address.
- */
- chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
-#endif
-
- i2c_newio(&state);
-
- rc = i2c_send(&state, chip, 0, I2CF_START_COND, alen, &xaddr[4-alen]);
- if (rc != 0) {
- printf("i2c_read: i2c_send failed (%d)\n", rc);
- return 1;
- }
-
- rc = i2c_receive(&state, chip, 0, I2CF_STOP_COND, len, buffer);
- if (rc != 0) {
- printf("i2c_read: i2c_receive failed (%d)\n", rc);
- return 1;
- }
-
- rc = i2c_doio(&state);
- if (rc != 0) {
- printf("i2c_read: i2c_doio failed (%d)\n", rc);
- return 1;
- }
- return 0;
-}
-
-int
-i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
-{
- i2c_state_t state;
- uchar xaddr[4];
- int rc;
-
- xaddr[0] = (addr >> 24) & 0xFF;
- xaddr[1] = (addr >> 16) & 0xFF;
- xaddr[2] = (addr >> 8) & 0xFF;
- xaddr[3] = addr & 0xFF;
-
-#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
- /*
- * EEPROM chips that implement "address overflow" are ones
- * like Catalyst 24WC04/08/16 which has 9/10/11 bits of address
- * and the extra bits end up in the "chip address" bit slots.
- * This makes a 24WC08 (1Kbyte) chip look like four 256 byte
- * chips.
- *
- * Note that we consider the length of the address field to still
- * be one byte because the extra address bits are hidden in the
- * chip address.
- */
- chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
-#endif
-
- i2c_newio(&state);
-
- rc = i2c_send(&state, chip, 0, I2CF_START_COND, alen, &xaddr[4-alen]);
- if (rc != 0) {
- printf("i2c_write: first i2c_send failed (%d)\n", rc);
- return 1;
- }
-
- rc = i2c_send(&state, 0, 0, I2CF_STOP_COND, len, buffer);
- if (rc != 0) {
- printf("i2c_write: second i2c_send failed (%d)\n", rc);
- return 1;
- }
-
- rc = i2c_doio(&state);
- if (rc != 0) {
- printf("i2c_write: i2c_doio failed (%d)\n", rc);
- return 1;
- }
- return 0;
-}
-
-uchar
-i2c_reg_read(uchar chip, uchar reg)
-{
- uchar buf;
-
- i2c_read(chip, reg, 1, &buf, 1);
-
- return (buf);
-}
-
-void
-i2c_reg_write(uchar chip, uchar reg, uchar val)
-{
- i2c_write(chip, reg, 1, &val, 1);
-}
-
-#endif /* CONFIG_HARD_I2C */
diff --git a/cpu/mpc8260/interrupts.c b/cpu/mpc8260/interrupts.c
deleted file mode 100644
index 56e9a72137..0000000000
--- a/cpu/mpc8260/interrupts.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- * Hacked for MPC8260 by Murray.Jensen@cmst.csiro.au, 22-Oct-00
- */
-
-#include <common.h>
-#include <command.h>
-#include <mpc8260.h>
-#include <mpc8260_irq.h>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/****************************************************************************/
-
-struct irq_action {
- interrupt_handler_t *handler;
- void *arg;
- ulong count;
-};
-
-static struct irq_action irq_handlers[NR_IRQS];
-
-static ulong ppc_cached_irq_mask[NR_MASK_WORDS];
-
-/****************************************************************************/
-/* this section was ripped out of arch/ppc/kernel/ppc8260_pic.c in the */
-/* Linux/PPC 2.4.x source. There was no copyright notice in that file. */
-
-/* The 8260 internal interrupt controller. It is usually
- * the only interrupt controller.
- * There are two 32-bit registers (high/low) for up to 64
- * possible interrupts.
- *
- * Now, the fun starts.....Interrupt Numbers DO NOT MAP
- * in a simple arithmetic fashion to mask or pending registers.
- * That is, interrupt 4 does not map to bit position 4.
- * We create two tables, indexed by vector number, to indicate
- * which register to use and which bit in the register to use.
- */
-static u_char irq_to_siureg[] = {
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static u_char irq_to_siubit[] = {
- 31, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30,
- 29, 30, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 31,
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 15, 14, 13, 12, 11, 10, 9, 8,
- 7, 6, 5, 4, 3, 2, 1, 0
-};
-
-static void m8260_mask_irq (unsigned int irq_nr)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- int bit, word;
- volatile uint *simr;
-
- bit = irq_to_siubit[irq_nr];
- word = irq_to_siureg[irq_nr];
-
- simr = &(immr->im_intctl.ic_simrh);
- ppc_cached_irq_mask[word] &= ~(1 << (31 - bit));
- simr[word] = ppc_cached_irq_mask[word];
-}
-
-static void m8260_unmask_irq (unsigned int irq_nr)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- int bit, word;
- volatile uint *simr;
-
- bit = irq_to_siubit[irq_nr];
- word = irq_to_siureg[irq_nr];
-
- simr = &(immr->im_intctl.ic_simrh);
- ppc_cached_irq_mask[word] |= (1 << (31 - bit));
- simr[word] = ppc_cached_irq_mask[word];
-}
-
-static void m8260_mask_and_ack (unsigned int irq_nr)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- int bit, word;
- volatile uint *simr, *sipnr;
-
- bit = irq_to_siubit[irq_nr];
- word = irq_to_siureg[irq_nr];
-
- simr = &(immr->im_intctl.ic_simrh);
- sipnr = &(immr->im_intctl.ic_sipnrh);
- ppc_cached_irq_mask[word] &= ~(1 << (31 - bit));
- simr[word] = ppc_cached_irq_mask[word];
- sipnr[word] = 1 << (31 - bit);
-}
-
-static int m8260_get_irq (struct pt_regs *regs)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- int irq;
- unsigned long bits;
-
- /* For MPC8260, read the SIVEC register and shift the bits down
- * to get the irq number. */
- bits = immr->im_intctl.ic_sivec;
- irq = bits >> 26;
- return irq;
-}
-
-/* end of code ripped out of arch/ppc/kernel/ppc8260_pic.c */
-/****************************************************************************/
-
-int interrupt_init_cpu (unsigned *decrementer_count)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
- *decrementer_count = (gd->bus_clk / 4) / CFG_HZ;
-
- /* Initialize the default interrupt mapping priorities */
- immr->im_intctl.ic_sicr = 0;
- immr->im_intctl.ic_siprr = 0x05309770;
- immr->im_intctl.ic_scprrh = 0x05309770;
- immr->im_intctl.ic_scprrl = 0x05309770;
-
- /* disable all interrupts and clear all pending bits */
- immr->im_intctl.ic_simrh = ppc_cached_irq_mask[0] = 0;
- immr->im_intctl.ic_simrl = ppc_cached_irq_mask[1] = 0;
- immr->im_intctl.ic_sipnrh = 0xffffffff;
- immr->im_intctl.ic_sipnrl = 0xffffffff;
-
-#ifdef CONFIG_HYMOD
- /*
- * ensure all external interrupt sources default to trigger on
- * high-to-low transition (i.e. edge triggered active low)
- */
- immr->im_intctl.ic_siexr = -1;
-#endif
-
- return (0);
-}
-
-/****************************************************************************/
-
-/*
- * Handle external interrupts
- */
-void external_interrupt (struct pt_regs *regs)
-{
- int irq, unmask = 1;
-
- irq = m8260_get_irq (regs);
-
- m8260_mask_and_ack (irq);
-
- enable_interrupts ();
-
- if (irq_handlers[irq].handler != NULL)
- (*irq_handlers[irq].handler) (irq_handlers[irq].arg);
- else {
- printf ("\nBogus External Interrupt IRQ %d\n", irq);
- /*
- * turn off the bogus interrupt, otherwise it
- * might repeat forever
- */
- unmask = 0;
- }
-
- if (unmask)
- m8260_unmask_irq (irq);
-}
-
-/****************************************************************************/
-
-/*
- * Install and free an interrupt handler.
- */
-
-void
-irq_install_handler (int irq, interrupt_handler_t * handler, void *arg)
-{
- if (irq < 0 || irq >= NR_IRQS) {
- printf ("irq_install_handler: bad irq number %d\n", irq);
- return;
- }
-
- if (irq_handlers[irq].handler != NULL)
- printf ("irq_install_handler: 0x%08lx replacing 0x%08lx\n",
- (ulong) handler, (ulong) irq_handlers[irq].handler);
-
- irq_handlers[irq].handler = handler;
- irq_handlers[irq].arg = arg;
-
- m8260_unmask_irq (irq);
-}
-
-void irq_free_handler (int irq)
-{
- if (irq < 0 || irq >= NR_IRQS) {
- printf ("irq_free_handler: bad irq number %d\n", irq);
- return;
- }
-
- m8260_mask_irq (irq);
-
- irq_handlers[irq].handler = NULL;
- irq_handlers[irq].arg = NULL;
-}
-
-/****************************************************************************/
-
-void timer_interrupt_cpu (struct pt_regs *regs)
-{
- /* nothing to do here */
- return;
-}
-
-/****************************************************************************/
-
-#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
-
-/* ripped this out of ppc4xx/interrupts.c */
-
-/*******************************************************************************
-*
-* irqinfo - print information about PCI devices
-*
-*/
-void
-do_irqinfo (cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char *argv[])
-{
- int irq, re_enable;
-
- re_enable = disable_interrupts ();
-
- puts ("\nInterrupt-Information:\n"
- "Nr Routine Arg Count\n");
-
- for (irq = 0; irq < 32; irq++)
- if (irq_handlers[irq].handler != NULL)
- printf ("%02d %08lx %08lx %ld\n", irq,
- (ulong) irq_handlers[irq].handler,
- (ulong) irq_handlers[irq].arg,
- irq_handlers[irq].count);
-
- if (re_enable)
- enable_interrupts ();
-}
-
-#endif /* CONFIG_COMMANDS & CFG_CMD_IRQ */
diff --git a/cpu/mpc8260/kgdb.S b/cpu/mpc8260/kgdb.S
deleted file mode 100644
index 15a8a58294..0000000000
--- a/cpu/mpc8260/kgdb.S
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2000 Murray Jensen <Murray.Jensen@cmst.csiro.au>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <command.h>
-#include <mpc8260.h>
-#include <version.h>
-
-#define CONFIG_8260 1 /* needed for Linux kernel header files */
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-
- /*
- * cache flushing routines for kgdb
- */
-
- .globl kgdb_flush_cache_all
-kgdb_flush_cache_all:
- mfspr r3, HID0
- ori r3, r3, HID0_ICFI|HID0_DCI /* Invalidate All */
- SYNC
- mtspr HID0, r3
- blr
-
- .globl kgdb_flush_cache_range
-kgdb_flush_cache_range:
- li r5,CONFIG_CACHELINE_SIZE-1
- andc r3,r3,r5
- subf r4,r3,r4
- add r4,r4,r5
- srwi. r4,r4,CFG_CACHELINE_SHIFT
- beqlr
- mtctr r4
- mr r6,r3
-1: dcbst 0,r3
- addi r3,r3,CONFIG_CACHELINE_SIZE
- bdnz 1b
- sync /* wait for dcbst's to get to ram */
- mtctr r4
-2: icbi 0,r6
- addi r6,r6,CONFIG_CACHELINE_SIZE
- bdnz 2b
- SYNC
- blr
-
-#endif /* CFG_CMD_KGDB */
diff --git a/cpu/mpc8260/pci.c b/cpu/mpc8260/pci.c
deleted file mode 100644
index fe3e8cbd1a..0000000000
--- a/cpu/mpc8260/pci.c
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * Copyright (c) 2005 MontaVista Software, Inc.
- * Vitaly Bordug <vbordug@ru.mvista.com>
- * Added support for PCI bridge on MPC8272ADS
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-#ifdef CONFIG_PCI
-
-#include <pci.h>
-#include <mpc8260.h>
-#include <asm/m8260_pci.h>
-#include <asm/io.h>
-
-#if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272 || defined CONFIG_PM826
-DECLARE_GLOBAL_DATA_PTR;
-#endif
-
-/*
- * Local->PCI map (from CPU) controlled by
- * MPC826x master window
- *
- * 0x80000000 - 0xBFFFFFFF CPU2PCI space PCIBR0
- * 0xF4000000 - 0xF7FFFFFF CPU2PCI space PCIBR1
- *
- * 0x80000000 - 0x9FFFFFFF 0x80000000 - 0x9FFFFFFF (Outbound ATU #1)
- * PCI Mem with prefetch
- *
- * 0xA0000000 - 0xBFFFFFFF 0xA0000000 - 0xBFFFFFFF (Outbound ATU #2)
- * PCI Mem w/o prefetch
- *
- * 0xF4000000 - 0xF7FFFFFF 0x00000000 - 0x03FFFFFF (Outbound ATU #3)
- * 32-bit PCI IO
- *
- * PCI->Local map (from PCI)
- * MPC826x slave window controlled by
- *
- * 0x00000000 - 0x1FFFFFFF 0x00000000 - 0x1FFFFFFF (Inbound ATU #1)
- * MPC826x local memory
- */
-
-/*
- * Slave window that allows PCI masters to access MPC826x local memory.
- * This window is set up using the first set of Inbound ATU registers
- */
-
-#ifndef CFG_PCI_SLV_MEM_LOCAL
-#define PCI_SLV_MEM_LOCAL CFG_SDRAM_BASE /* Local base */
-#else
-#define PCI_SLV_MEM_LOCAL CFG_PCI_SLV_MEM_LOCAL
-#endif
-
-#ifndef CFG_PCI_SLV_MEM_BUS
-#define PCI_SLV_MEM_BUS 0x00000000 /* PCI base */
-#else
-#define PCI_SLV_MEM_BUS CFG_PCI_SLV_MEM_BUS
-#endif
-
-#ifndef CFG_PICMR0_MASK_ATTRIB
-#define PICMR0_MASK_ATTRIB (PICMR_MASK_512MB | PICMR_ENABLE | \
- PICMR_PREFETCH_EN)
-#else
-#define PICMR0_MASK_ATTRIB CFG_PICMR0_MASK_ATTRIB
-#endif
-
-/*
- * These are the windows that allow the CPU to access PCI address space.
- * All three PCI master windows, which allow the CPU to access PCI
- * prefetch, non prefetch, and IO space (see below), must all fit within
- * these windows.
- */
-
-/* PCIBR0 */
-#ifndef CFG_PCI_MSTR0_LOCAL
-#define PCI_MSTR0_LOCAL 0x80000000 /* Local base */
-#else
-#define PCI_MSTR0_LOCAL CFG_PCI_MSTR0_LOCAL
-#endif
-
-#ifndef CFG_PCIMSK0_MASK
-#define PCIMSK0_MASK PCIMSK_1GB /* Size of window */
-#else
-#define PCIMSK0_MASK CFG_PCIMSK0_MASK
-#endif
-
-/* PCIBR1 */
-#ifndef CFG_PCI_MSTR1_LOCAL
-#define PCI_MSTR1_LOCAL 0xF4000000 /* Local base */
-#else
-#define PCI_MSTR1_LOCAL CFG_PCI_MSTR1_LOCAL
-#endif
-
-#ifndef CFG_PCIMSK1_MASK
-#define PCIMSK1_MASK PCIMSK_64MB /* Size of window */
-#else
-#define PCIMSK1_MASK CFG_PCIMSK1_MASK
-#endif
-
-/*
- * Master window that allows the CPU to access PCI Memory (prefetch).
- * This window will be setup with the first set of Outbound ATU registers
- * in the bridge.
- */
-
-#ifndef CFG_PCI_MSTR_MEM_LOCAL
-#define PCI_MSTR_MEM_LOCAL 0x80000000 /* Local base */
-#else
-#define PCI_MSTR_MEM_LOCAL CFG_PCI_MSTR_MEM_LOCAL
-#endif
-
-#ifndef CFG_PCI_MSTR_MEM_BUS
-#define PCI_MSTR_MEM_BUS 0x80000000 /* PCI base */
-#else
-#define PCI_MSTR_MEM_BUS CFG_PCI_MSTR_MEM_BUS
-#endif
-
-#ifndef CFG_CPU_PCI_MEM_START
-#define CPU_PCI_MEM_START PCI_MSTR_MEM_LOCAL
-#else
-#define CPU_PCI_MEM_START CFG_CPU_PCI_MEM_START
-#endif
-
-#ifndef CFG_PCI_MSTR_MEM_SIZE
-#define PCI_MSTR_MEM_SIZE 0x10000000 /* 256MB */
-#else
-#define PCI_MSTR_MEM_SIZE CFG_PCI_MSTR_MEM_SIZE
-#endif
-
-#ifndef CFG_POCMR0_MASK_ATTRIB
-#define POCMR0_MASK_ATTRIB (POCMR_MASK_256MB | POCMR_ENABLE | POCMR_PREFETCH_EN)
-#else
-#define POCMR0_MASK_ATTRIB CFG_POCMR0_MASK_ATTRIB
-#endif
-
-/*
- * Master window that allows the CPU to access PCI Memory (non-prefetch).
- * This window will be setup with the second set of Outbound ATU registers
- * in the bridge.
- */
-
-#ifndef CFG_PCI_MSTR_MEMIO_LOCAL
-#define PCI_MSTR_MEMIO_LOCAL 0x90000000 /* Local base */
-#else
-#define PCI_MSTR_MEMIO_LOCAL CFG_PCI_MSTR_MEMIO_LOCAL
-#endif
-
-#ifndef CFG_PCI_MSTR_MEMIO_BUS
-#define PCI_MSTR_MEMIO_BUS 0x90000000 /* PCI base */
-#else
-#define PCI_MSTR_MEMIO_BUS CFG_PCI_MSTR_MEMIO_BUS
-#endif
-
-#ifndef CFG_CPU_PCI_MEMIO_START
-#define CPU_PCI_MEMIO_START PCI_MSTR_MEMIO_LOCAL
-#else
-#define CPU_PCI_MEMIO_START CFG_CPU_PCI_MEMIO_START
-#endif
-
-#ifndef CFG_PCI_MSTR_MEMIO_SIZE
-#define PCI_MSTR_MEMIO_SIZE 0x10000000 /* 256 MB */
-#else
-#define PCI_MSTR_MEMIO_SIZE CFG_PCI_MSTR_MEMIO_SIZE
-#endif
-
-#ifndef CFG_POCMR1_MASK_ATTRIB
-#define POCMR1_MASK_ATTRIB (POCMR_MASK_512MB | POCMR_ENABLE)
-#else
-#define POCMR1_MASK_ATTRIB CFG_POCMR1_MASK_ATTRIB
-#endif
-
-/*
- * Master window that allows the CPU to access PCI IO space.
- * This window will be setup with the third set of Outbound ATU registers
- * in the bridge.
- */
-
-#ifndef CFG_PCI_MSTR_IO_LOCAL
-#define PCI_MSTR_IO_LOCAL 0xA0000000 /* Local base */
-#else
-#define PCI_MSTR_IO_LOCAL CFG_PCI_MSTR_IO_LOCAL
-#endif
-
-#ifndef CFG_PCI_MSTR_IO_BUS
-#define PCI_MSTR_IO_BUS 0xA0000000 /* PCI base */
-#else
-#define PCI_MSTR_IO_BUS CFG_PCI_MSTR_IO_BUS
-#endif
-
-#ifndef CFG_CPU_PCI_IO_START
-#define CPU_PCI_IO_START PCI_MSTR_IO_LOCAL
-#else
-#define CPU_PCI_IO_START CFG_CPU_PCI_IO_START
-#endif
-
-#ifndef CFG_PCI_MSTR_IO_SIZE
-#define PCI_MSTR_IO_SIZE 0x10000000 /* 256MB */
-#else
-#define PCI_MSTR_IO_SIZE CFG_PCI_MSTR_IO_SIZE
-#endif
-
-#ifndef CFG_POCMR2_MASK_ATTRIB
-#define POCMR2_MASK_ATTRIB (POCMR_MASK_256MB | POCMR_ENABLE | POCMR_PCI_IO)
-#else
-#define POCMR2_MASK_ATTRIB CFG_POCMR2_MASK_ATTRIB
-#endif
-
-/* PCI bus configuration registers.
- */
-
-#define PCI_CLASS_BRIDGE_CTLR 0x06
-
-
-static inline void pci_outl (u32 addr, u32 data)
-{
- *(volatile u32 *) addr = cpu_to_le32 (data);
-}
-
-void pci_mpc8250_init (struct pci_controller *hose)
-{
- u16 tempShort;
-
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- pci_dev_t host_devno = PCI_BDF (0, 0, 0);
-
- pci_setup_indirect (hose, CFG_IMMR + PCI_CFG_ADDR_REG,
- CFG_IMMR + PCI_CFG_DATA_REG);
-
- /*
- * Setting required to enable local bus for PCI (SIUMCR [LBPC]).
- */
-#ifdef CONFIG_MPC8266ADS
- immap->im_siu_conf.sc_siumcr =
- (immap->im_siu_conf.sc_siumcr & ~SIUMCR_LBPC11)
- | SIUMCR_LBPC01;
-#elif defined CONFIG_MPC8272
- immap->im_siu_conf.sc_siumcr = (immap->im_siu_conf.sc_siumcr &
- ~SIUMCR_BBD &
- ~SIUMCR_ESE &
- ~SIUMCR_PBSE &
- ~SIUMCR_CDIS &
- ~SIUMCR_DPPC11 &
- ~SIUMCR_L2CPC11 &
- ~SIUMCR_LBPC11 &
- ~SIUMCR_APPC11 &
- ~SIUMCR_CS10PC11 &
- ~SIUMCR_BCTLC11 &
- ~SIUMCR_MMR11)
- | SIUMCR_DPPC11
- | SIUMCR_L2CPC01
- | SIUMCR_LBPC00
- | SIUMCR_APPC10
- | SIUMCR_CS10PC00
- | SIUMCR_BCTLC00
- | SIUMCR_MMR11;
-#elif defined(CONFIG_TQM8272)
- immap->im_siu_conf.sc_siumcr = 0x88000000;
-#else
- /*
- * Setting required to enable IRQ1-IRQ7 (SIUMCR [DPPC]),
- * and local bus for PCI (SIUMCR [LBPC]).
- */
- immap->im_siu_conf.sc_siumcr = (immap->im_siu_conf.sc_siumcr &
- ~SIUMCR_LBPC11 &
- ~SIUMCR_CS10PC11 &
- ~SIUMCR_LBPC11) |
- SIUMCR_LBPC01 |
- SIUMCR_CS10PC01 |
- SIUMCR_APPC10;
-#endif
-printf("%s siumcr: %x\n", __FUNCTION__, immap->im_siu_conf.sc_siumcr);
-
- /* Make PCI lowest priority */
- /* Each 4 bits is a device bus request and the MS 4bits
- is highest priority */
- /* Bus 4bit value
- --- ----------
- CPM high 0b0000
- CPM middle 0b0001
- CPM low 0b0010
- PCI reguest 0b0011
- Reserved 0b0100
- Reserved 0b0101
- Internal Core 0b0110
- External Master 1 0b0111
- External Master 2 0b1000
- External Master 3 0b1001
- The rest are reserved */
- immap->im_siu_conf.sc_ppc_alrh = 0x61207893;
-
- /* Park bus on core while modifying PCI Bus accesses */
- immap->im_siu_conf.sc_ppc_acr = 0x6;
-
- /*
- * Set up master windows that allow the CPU to access PCI space. These
- * windows are set up using the two SIU PCIBR registers.
- */
- immap->im_memctl.memc_pcimsk0 = PCIMSK0_MASK;
- immap->im_memctl.memc_pcibr0 = PCI_MSTR0_LOCAL | PCIBR_ENABLE;
-
-#if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272
- immap->im_memctl.memc_pcimsk1 = PCIMSK1_MASK;
- immap->im_memctl.memc_pcibr1 = PCI_MSTR1_LOCAL | PCIBR_ENABLE;
-#endif
-
- /* Release PCI RST (by default the PCI RST signal is held low) */
- immap->im_pci.pci_gcr = cpu_to_le32 (PCIGCR_PCI_BUS_EN);
-
- /* give it some time */
- {
-#if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272
- /* Give the PCI cards more time to initialize before query
- This might be good for other boards also
- */
- int i;
-
- for (i = 0; i < 1000; ++i)
-#endif
- udelay (1000);
- }
-
- /*
- * Set up master window that allows the CPU to access PCI Memory (prefetch)
- * space. This window is set up using the first set of Outbound ATU registers.
- */
- immap->im_pci.pci_potar0 = cpu_to_le32 (PCI_MSTR_MEM_BUS >> 12); /* PCI base */
- immap->im_pci.pci_pobar0 = cpu_to_le32 (PCI_MSTR_MEM_LOCAL >> 12); /* Local base */
- immap->im_pci.pci_pocmr0 = cpu_to_le32 (POCMR0_MASK_ATTRIB); /* Size & attribute */
-
- /*
- * Set up master window that allows the CPU to access PCI Memory (non-prefetch)
- * space. This window is set up using the second set of Outbound ATU registers.
- */
- immap->im_pci.pci_potar1 = cpu_to_le32 (PCI_MSTR_MEMIO_BUS >> 12); /* PCI base */
- immap->im_pci.pci_pobar1 = cpu_to_le32 (PCI_MSTR_MEMIO_LOCAL >> 12); /* Local base */
- immap->im_pci.pci_pocmr1 = cpu_to_le32 (POCMR1_MASK_ATTRIB); /* Size & attribute */
-
- /*
- * Set up master window that allows the CPU to access PCI IO space. This window
- * is set up using the third set of Outbound ATU registers.
- */
- immap->im_pci.pci_potar2 = cpu_to_le32 (PCI_MSTR_IO_BUS >> 12); /* PCI base */
- immap->im_pci.pci_pobar2 = cpu_to_le32 (PCI_MSTR_IO_LOCAL >> 12); /* Local base */
- immap->im_pci.pci_pocmr2 = cpu_to_le32 (POCMR2_MASK_ATTRIB); /* Size & attribute */
-
- /*
- * Set up slave window that allows PCI masters to access MPC826x local memory.
- * This window is set up using the first set of Inbound ATU registers
- */
- immap->im_pci.pci_pitar0 = cpu_to_le32 (PCI_SLV_MEM_LOCAL >> 12); /* PCI base */
- immap->im_pci.pci_pibar0 = cpu_to_le32 (PCI_SLV_MEM_BUS >> 12); /* Local base */
- immap->im_pci.pci_picmr0 = cpu_to_le32 (PICMR0_MASK_ATTRIB); /* Size & attribute */
-
- /* See above for description - puts PCI request as highest priority */
-#ifdef CONFIG_MPC8272
- immap->im_siu_conf.sc_ppc_alrh = 0x01236745;
-#else
- immap->im_siu_conf.sc_ppc_alrh = 0x03124567;
-#endif
-
- /* Park the bus on the PCI */
- immap->im_siu_conf.sc_ppc_acr = PPC_ACR_BUS_PARK_PCI;
-
- /* Host mode - specify the bridge as a host-PCI bridge */
-
- pci_hose_write_config_byte (hose, host_devno, PCI_CLASS_CODE,
- PCI_CLASS_BRIDGE_CTLR);
-
- /* Enable the host bridge to be a master on the PCI bus, and to act as a PCI memory target */
- pci_hose_read_config_word (hose, host_devno, PCI_COMMAND, &tempShort);
- pci_hose_write_config_word (hose, host_devno, PCI_COMMAND,
- tempShort | PCI_COMMAND_MASTER |
- PCI_COMMAND_MEMORY);
-
- /* do some bridge init, should be done on all 8260 based bridges */
- pci_hose_write_config_byte (hose, host_devno, PCI_CACHE_LINE_SIZE,
- 0x08);
- pci_hose_write_config_byte (hose, host_devno, PCI_LATENCY_TIMER,
- 0xF8);
-
- hose->first_busno = 0;
- hose->last_busno = 0xff;
-
- /* System memory space */
-#if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272 || defined CONFIG_PM826
- pci_set_region (hose->regions + 0,
- PCI_SLV_MEM_BUS,
- PCI_SLV_MEM_LOCAL,
- gd->ram_size, PCI_REGION_MEM | PCI_REGION_MEMORY);
-#else
- pci_set_region (hose->regions + 0,
- CFG_SDRAM_BASE,
- CFG_SDRAM_BASE,
- 0x4000000, PCI_REGION_MEM | PCI_REGION_MEMORY);
-#endif
-
- /* PCI memory space */
-#if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272
- pci_set_region (hose->regions + 1,
- PCI_MSTR_MEMIO_BUS,
- PCI_MSTR_MEMIO_LOCAL,
- PCI_MSTR_MEMIO_SIZE, PCI_REGION_MEM);
-#else
- pci_set_region (hose->regions + 1,
- PCI_MSTR_MEM_BUS,
- PCI_MSTR_MEM_LOCAL,
- PCI_MSTR_MEM_SIZE, PCI_REGION_MEM);
-#endif
-
- /* PCI I/O space */
- pci_set_region (hose->regions + 2,
- PCI_MSTR_IO_BUS,
- PCI_MSTR_IO_LOCAL, PCI_MSTR_IO_SIZE, PCI_REGION_IO);
-
- hose->region_count = 3;
-
- pci_register_hose (hose);
- /* Mask off master abort machine checks */
- immap->im_pci.pci_emr &= cpu_to_le32 (~PCI_ERROR_PCI_NO_RSP);
- eieio ();
-
- hose->last_busno = pci_hose_scan (hose);
-
-
- /* clear the error in the error status register */
- immap->im_pci.pci_esr = cpu_to_le32 (PCI_ERROR_PCI_NO_RSP);
-
- /* unmask master abort machine checks */
- immap->im_pci.pci_emr |= cpu_to_le32 (PCI_ERROR_PCI_NO_RSP);
-}
-
-#endif /* CONFIG_PCI */
diff --git a/cpu/mpc8260/speed.c b/cpu/mpc8260/speed.c
deleted file mode 100644
index c234a28d0d..0000000000
--- a/cpu/mpc8260/speed.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc8260.h>
-#include <asm/processor.h>
-
-#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
-extern unsigned long board_get_cpu_clk_f (void);
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/* ------------------------------------------------------------------------- */
-
-/* Bus-to-Core Multiplier */
-#define _1x 2
-#define _1_5x 3
-#define _2x 4
-#define _2_5x 5
-#define _3x 6
-#define _3_5x 7
-#define _4x 8
-#define _4_5x 9
-#define _5x 10
-#define _5_5x 11
-#define _6x 12
-#define _6_5x 13
-#define _7x 14
-#define _7_5x 15
-#define _8x 16
-#define _byp -1
-#define _off -2
-#define _unk -3
-
-typedef struct {
- int b2c_mult;
- int vco_div;
- char *freq_60x;
- char *freq_core;
-} corecnf_t;
-
-/*
- * this table based on "Errata to MPC8260 PowerQUICC II User's Manual",
- * Rev. 1, 8/2000, page 10.
- */
-corecnf_t corecnf_tab[] = {
- { _1_5x, 4, " 33-100", " 33-100" }, /* 0x00 */
- { _1x, 4, " 50-150", " 50-150" }, /* 0x01 */
- { _1x, 8, " 25-75 ", " 25-75 " }, /* 0x02 */
- { _byp, -1, " ?-? ", " ?-? " }, /* 0x03 */
- { _2x, 2, " 50-150", "100-300" }, /* 0x04 */
- { _2x, 4, " 25-75 ", " 50-150" }, /* 0x05 */
- { _2_5x, 2, " 40-120", "100-240" }, /* 0x06 */
- { _4_5x, 2, " 22-65 ", "100-300" }, /* 0x07 */
- { _3x, 2, " 33-100", "100-300" }, /* 0x08 */
- { _5_5x, 2, " 18-55 ", "100-300" }, /* 0x09 */
- { _4x, 2, " 25-75 ", "100-300" }, /* 0x0A */
- { _5x, 2, " 20-60 ", "100-300" }, /* 0x0B */
- { _1_5x, 8, " 16-50 ", " 16-50 " }, /* 0x0C */
- { _6x, 2, " 16-50 ", "100-300" }, /* 0x0D */
- { _3_5x, 2, " 30-85 ", "100-300" }, /* 0x0E */
- { _off, -1, " ?-? ", " ?-? " }, /* 0x0F */
- { _3x, 4, " 16-50 ", " 50-150" }, /* 0x10 */
- { _2_5x, 4, " 20-60 ", " 50-120" }, /* 0x11 */
- { _6_5x, 2, " 15-46 ", "100-300" }, /* 0x12 */
- { _byp, -1, " ?-? ", " ?-? " }, /* 0x13 */
- { _7x, 2, " 14-43 ", "100-300" }, /* 0x14 */
- { _2x, 4, " 25-75 ", " 50-150" }, /* 0x15 */
- { _7_5x, 2, " 13-40 ", "100-300" }, /* 0x16 */
- { _4_5x, 2, " 22-65 ", "100-300" }, /* 0x17 */
- { _unk, -1, " ?-? ", " ?-? " }, /* 0x18 */
- { _5_5x, 2, " 18-55 ", "100-300" }, /* 0x19 */
- { _4x, 2, " 25-75 ", "100-300" }, /* 0x1A */
- { _5x, 2, " 20-60 ", "100-300" }, /* 0x1B */
- { _8x, 2, " 12-38 ", "100-300" }, /* 0x1C */
- { _6x, 2, " 16-50 ", "100-300" }, /* 0x1D */
- { _3_5x, 2, " 30-85 ", "100-300" }, /* 0x1E */
- { _off, -1, " ?-? ", " ?-? " }, /* 0x1F */
-};
-
-/* ------------------------------------------------------------------------- */
-
-/*
- *
- */
-
-int get_clocks (void)
-{
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- ulong clkin;
- ulong sccr, dfbrg;
- ulong scmr, corecnf, busdf, cpmdf, plldf, pllmf;
- corecnf_t *cp;
-
-#if !defined(CONFIG_8260_CLKIN)
-#error clock measuring not implemented yet - define CONFIG_8260_CLKIN
-#else
-#if defined(CONFIG_BOARD_GET_CPU_CLK_F)
- clkin = board_get_cpu_clk_f ();
-#else
- clkin = CONFIG_8260_CLKIN;
-#endif
-#endif
-
- sccr = immap->im_clkrst.car_sccr;
- dfbrg = (sccr & SCCR_DFBRG_MSK) >> SCCR_DFBRG_SHIFT;
-
- scmr = immap->im_clkrst.car_scmr;
- corecnf = (scmr & SCMR_CORECNF_MSK) >> SCMR_CORECNF_SHIFT;
- cp = &corecnf_tab[corecnf];
-
- busdf = (scmr & SCMR_BUSDF_MSK) >> SCMR_BUSDF_SHIFT;
- cpmdf = (scmr & SCMR_CPMDF_MSK) >> SCMR_CPMDF_SHIFT;
-
- /* HiP7, HiP7 Rev01, HiP7 RevA */
- if ((get_pvr () == PVR_8260_HIP7) ||
- (get_pvr () == PVR_8260_HIP7R1) ||
- (get_pvr () == PVR_8260_HIP7RA)) {
- pllmf = (scmr & SCMR_PLLMF_MSKH7) >> SCMR_PLLMF_SHIFT;
- gd->vco_out = clkin * (pllmf + 1);
- } else { /* HiP3, HiP4 */
- pllmf = (scmr & SCMR_PLLMF_MSK) >> SCMR_PLLMF_SHIFT;
- plldf = (scmr & SCMR_PLLDF) ? 1 : 0;
- gd->vco_out = (clkin * 2 * (pllmf + 1)) / (plldf + 1);
- }
-
- gd->cpm_clk = gd->vco_out / 2;
- gd->bus_clk = clkin;
- gd->scc_clk = gd->vco_out / 4;
- gd->brg_clk = gd->vco_out / (1 << (2 * (dfbrg + 1)));
-
- if (cp->b2c_mult > 0) {
- gd->cpu_clk = (clkin * cp->b2c_mult) / 2;
- } else {
- gd->cpu_clk = clkin;
- }
-
- return (0);
-}
-
-int prt_8260_clks (void)
-{
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- ulong sccr, dfbrg;
- ulong scmr, corecnf, busdf, cpmdf, plldf, pllmf, pcidf;
- corecnf_t *cp;
-
- sccr = immap->im_clkrst.car_sccr;
- dfbrg = (sccr & SCCR_DFBRG_MSK) >> SCCR_DFBRG_SHIFT;
-
- scmr = immap->im_clkrst.car_scmr;
- corecnf = (scmr & SCMR_CORECNF_MSK) >> SCMR_CORECNF_SHIFT;
- busdf = (scmr & SCMR_BUSDF_MSK) >> SCMR_BUSDF_SHIFT;
- cpmdf = (scmr & SCMR_CPMDF_MSK) >> SCMR_CPMDF_SHIFT;
- plldf = (scmr & SCMR_PLLDF) ? 1 : 0;
- pllmf = (scmr & SCMR_PLLMF_MSK) >> SCMR_PLLMF_SHIFT;
- pcidf = (sccr & SCCR_PCIDF_MSK) >> SCCR_PCIDF_SHIFT;
-
- cp = &corecnf_tab[corecnf];
-
- puts (CPU_ID_STR " Clock Configuration\n - Bus-to-Core Mult ");
-
- switch (cp->b2c_mult) {
- case _byp:
- puts ("BYPASS");
- break;
-
- case _off:
- puts ("OFF");
- break;
-
- case _unk:
- puts ("UNKNOWN");
- break;
-
- default:
- printf ("%d%sx",
- cp->b2c_mult / 2,
- (cp->b2c_mult % 2) ? ".5" : "");
- break;
- }
-
- printf (", VCO Div %d, 60x Bus Freq %s, Core Freq %s\n",
- cp->vco_div, cp->freq_60x, cp->freq_core);
-
- printf (" - dfbrg %ld, corecnf 0x%02lx, busdf %ld, cpmdf %ld, "
- "plldf %ld, pllmf %ld, pcidf %ld\n",
- dfbrg, corecnf, busdf, cpmdf,
- plldf, pllmf, pcidf);
-
- printf (" - vco_out %10ld, scc_clk %10ld, brg_clk %10ld\n",
- gd->vco_out, gd->scc_clk, gd->brg_clk);
-
- printf (" - cpu_clk %10ld, cpm_clk %10ld, bus_clk %10ld\n",
- gd->cpu_clk, gd->cpm_clk, gd->bus_clk);
-
- if (sccr & SCCR_PCI_MODE) {
- uint pci_div;
- uint pcidf = (sccr & SCCR_PCIDF_MSK) >> SCCR_PCIDF_SHIFT;
-
- if (sccr & SCCR_PCI_MODCK) {
- pci_div = 2;
- if (pcidf == 9) {
- pci_div *= 5;
- } else if (pcidf == 0xB) {
- pci_div *= 6;
- } else {
- pci_div *= (pcidf + 1);
- }
- } else {
- pci_div = pcidf + 1;
- }
-
- printf (" - pci_clk %10ld\n", (gd->cpm_clk * 2) / pci_div);
- }
- putc ('\n');
-
- return (0);
-}
diff --git a/cpu/mpc8260/speed.h b/cpu/mpc8260/speed.h
deleted file mode 100644
index b66393bec5..0000000000
--- a/cpu/mpc8260/speed.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*-----------------------------------------------------------------------
- * Timer value for timer 2, ICLK = 10
- *
- * SPEED_FCOUNT2 = GCLK / (16 * (TIMER_TMR_PS + 1))
- * SPEED_TMR3_PS = (GCLK / (16 * SPEED_FCOUNT3)) - 1
- *
- * SPEED_FCOUNT2 timer 2 counting frequency
- * GCLK CPU clock
- * SPEED_TMR2_PS prescaler
- */
-#define SPEED_TMR2_PS (250 - 1) /* divide by 250 */
-
-/*-----------------------------------------------------------------------
- * Timer value for PIT
- *
- * PIT_TIME = SPEED_PITC / PITRTCLK
- * PITRTCLK = 8192
- */
-#define SPEED_PITC (82 << 16) /* start counting from 82 */
-
-/*
- * The new value for PTA is calculated from
- *
- * PTA = (gclk * Trefresh) / (2 ^ (2 * DFBRG) * PTP * NCS)
- *
- * gclk CPU clock (not bus clock !)
- * Trefresh Refresh cycle * 4 (four word bursts used)
- * DFBRG For normal mode (no clock reduction) always 0
- * PTP Prescaler (already adjusted for no. of banks and 4K / 8K refresh)
- * NCS Number of SDRAM banks (chip selects) on this UPM.
- */
diff --git a/cpu/mpc8260/spi.c b/cpu/mpc8260/spi.c
deleted file mode 100644
index c1a607ca5d..0000000000
--- a/cpu/mpc8260/spi.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * Copyright (c) 2001 Navin Boppuri / Prashant Patel
- * <nboppuri@trinetcommunication.com>,
- * <pmpatel@trinetcommunication.com>
- * Copyright (c) 2001 Gerd Mennchen <Gerd.Mennchen@icn.siemens.de>
- * Copyright (c) 2001-2003 Wolfgang Denk, DENX Software Engineering, <wd@denx.de>.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * MPC8260 CPM SPI interface.
- *
- * Parts of this code are probably not portable and/or specific to
- * the board which I used for the tests. Please send fixes/complaints
- * to wd@denx.de
- *
- */
-
-#include <common.h>
-#include <asm/cpm_8260.h>
-#include <linux/ctype.h>
-#include <malloc.h>
-#include <post.h>
-#include <net.h>
-
-#if defined(CONFIG_SPI)
-
-/* Warning:
- * You cannot enable DEBUG for early system initalization, i. e. when
- * this driver is used to read environment parameters like "baudrate"
- * from EEPROM which are used to initialize the serial port which is
- * needed to print the debug messages...
- */
-#undef DEBUG
-
-#define SPI_EEPROM_WREN 0x06
-#define SPI_EEPROM_RDSR 0x05
-#define SPI_EEPROM_READ 0x03
-#define SPI_EEPROM_WRITE 0x02
-
-/* ---------------------------------------------------------------
- * Offset for initial SPI buffers in DPRAM:
- * We need a 520 byte scratch DPRAM area to use at an early stage.
- * It is used between the two initialization calls (spi_init_f()
- * and spi_init_r()).
- * The value 0x2000 makes it far enough from the start of the data
- * area (as well as from the stack pointer).
- * --------------------------------------------------------------- */
-#ifndef CFG_SPI_INIT_OFFSET
-#define CFG_SPI_INIT_OFFSET 0x2000
-#endif
-
-#define CPM_SPI_BASE 0x100
-
-#ifdef DEBUG
-
-#define DPRINT(a) printf a;
-/* -----------------------------------------------
- * Helper functions to peek into tx and rx buffers
- * ----------------------------------------------- */
-static const char * const hex_digit = "0123456789ABCDEF";
-
-static char quickhex (int i)
-{
- return hex_digit[i];
-}
-
-static void memdump (void *pv, int num)
-{
- int i;
- unsigned char *pc = (unsigned char *) pv;
-
- for (i = 0; i < num; i++)
- printf ("%c%c ", quickhex (pc[i] >> 4), quickhex (pc[i] & 0x0f));
- printf ("\t");
- for (i = 0; i < num; i++)
- printf ("%c", isprint (pc[i]) ? pc[i] : '.');
- printf ("\n");
-}
-#else /* !DEBUG */
-
-#define DPRINT(a)
-
-#endif /* DEBUG */
-
-/* -------------------
- * Function prototypes
- * ------------------- */
-void spi_init (void);
-
-ssize_t spi_read (uchar *, int, uchar *, int);
-ssize_t spi_write (uchar *, int, uchar *, int);
-ssize_t spi_xfer (size_t);
-
-/* -------------------
- * Variables
- * ------------------- */
-
-#define MAX_BUFFER 0x104
-
-/* ----------------------------------------------------------------------
- * Initially we place the RX and TX buffers at a fixed location in DPRAM!
- * ---------------------------------------------------------------------- */
-static uchar *rxbuf =
- (uchar *)&((immap_t *)CFG_IMMR)->im_dprambase
- [CFG_SPI_INIT_OFFSET];
-static uchar *txbuf =
- (uchar *)&((immap_t *)CFG_IMMR)->im_dprambase
- [CFG_SPI_INIT_OFFSET+MAX_BUFFER];
-
-/* **************************************************************************
- *
- * Function: spi_init_f
- *
- * Description: Init SPI-Controller (ROM part)
- *
- * return: ---
- *
- * *********************************************************************** */
-void spi_init_f (void)
-{
- unsigned int dpaddr;
-
- volatile spi_t *spi;
- volatile immap_t *immr;
- volatile cpm8260_t *cp;
- volatile cbd_t *tbdf, *rbdf;
-
- immr = (immap_t *) CFG_IMMR;
- cp = (cpm8260_t *) &immr->im_cpm;
-
- *(ushort *)(&immr->im_dprambase[PROFF_SPI_BASE]) = PROFF_SPI;
- spi = (spi_t *)&immr->im_dprambase[PROFF_SPI];
-
-/* 1 */
- /* ------------------------------------------------
- * Initialize Port D SPI pins
- * (we are only in Master Mode !)
- * ------------------------------------------------ */
-
- /* --------------------------------------------
- * GPIO or per. Function
- * PPARD[16] = 1 [0x00008000] (SPIMISO)
- * PPARD[17] = 1 [0x00004000] (SPIMOSI)
- * PPARD[18] = 1 [0x00002000] (SPICLK)
- * PPARD[12] = 0 [0x00080000] -> GPIO: (CS for ATC EEPROM)
- * -------------------------------------------- */
- immr->im_ioport.iop_ppard |= 0x0000E000; /* set bits */
- immr->im_ioport.iop_ppard &= ~0x00080000; /* reset bit */
-
- /* ----------------------------------------------
- * In/Out or per. Function 0/1
- * PDIRD[16] = 0 [0x00008000] -> PERI1: SPIMISO
- * PDIRD[17] = 0 [0x00004000] -> PERI1: SPIMOSI
- * PDIRD[18] = 0 [0x00002000] -> PERI1: SPICLK
- * PDIRD[12] = 1 [0x00080000] -> GPIO OUT: CS for ATC EEPROM
- * ---------------------------------------------- */
- immr->im_ioport.iop_pdird &= ~0x0000E000;
- immr->im_ioport.iop_pdird |= 0x00080000;
-
- /* ----------------------------------------------
- * special option reg.
- * PSORD[16] = 1 [0x00008000] -> SPIMISO
- * PSORD[17] = 1 [0x00004000] -> SPIMOSI
- * PSORD[18] = 1 [0x00002000] -> SPICLK
- * ---------------------------------------------- */
- immr->im_ioport.iop_psord |= 0x0000E000;
-
- /* Initialize the parameter ram.
- * We need to make sure many things are initialized to zero
- */
- spi->spi_rstate = 0;
- spi->spi_rdp = 0;
- spi->spi_rbptr = 0;
- spi->spi_rbc = 0;
- spi->spi_rxtmp = 0;
- spi->spi_tstate = 0;
- spi->spi_tdp = 0;
- spi->spi_tbptr = 0;
- spi->spi_tbc = 0;
- spi->spi_txtmp = 0;
-
- /* Allocate space for one transmit and one receive buffer
- * descriptor in the DP ram
- */
-#ifdef CFG_ALLOC_DPRAM
- dpaddr = m8260_cpm_dpalloc (sizeof(cbd_t)*2, 8);
-#else
- dpaddr = CPM_SPI_BASE;
-#endif
-
-/* 3 */
- /* Set up the SPI parameters in the parameter ram */
- spi->spi_rbase = dpaddr;
- spi->spi_tbase = dpaddr + sizeof (cbd_t);
-
- /***********IMPORTANT******************/
-
- /*
- * Setting transmit and receive buffer descriptor pointers
- * initially to rbase and tbase. Only the microcode patches
- * documentation talks about initializing this pointer. This
- * is missing from the sample I2C driver. If you dont
- * initialize these pointers, the kernel hangs.
- */
- spi->spi_rbptr = spi->spi_rbase;
- spi->spi_tbptr = spi->spi_tbase;
-
-/* 4 */
- /* Init SPI Tx + Rx Parameters */
- while (cp->cp_cpcr & CPM_CR_FLG)
- ;
- cp->cp_cpcr = mk_cr_cmd(CPM_CR_SPI_PAGE, CPM_CR_SPI_SBLOCK,
- 0, CPM_CR_INIT_TRX) | CPM_CR_FLG;
- while (cp->cp_cpcr & CPM_CR_FLG)
- ;
-
-/* 6 */
- /* Set to big endian. */
- spi->spi_tfcr = CPMFCR_EB;
- spi->spi_rfcr = CPMFCR_EB;
-
-/* 7 */
- /* Set maximum receive size. */
- spi->spi_mrblr = MAX_BUFFER;
-
-/* 8 + 9 */
- /* tx and rx buffer descriptors */
- tbdf = (cbd_t *) & immr->im_dprambase[spi->spi_tbase];
- rbdf = (cbd_t *) & immr->im_dprambase[spi->spi_rbase];
-
- tbdf->cbd_sc &= ~BD_SC_READY;
- rbdf->cbd_sc &= ~BD_SC_EMPTY;
-
- /* Set the bd's rx and tx buffer address pointers */
- rbdf->cbd_bufaddr = (ulong) rxbuf;
- tbdf->cbd_bufaddr = (ulong) txbuf;
-
-/* 10 + 11 */
- immr->im_spi.spi_spie = SPI_EMASK; /* Clear all SPI events */
- immr->im_spi.spi_spim = 0x00; /* Mask all SPI events */
-
-
- return;
-}
-
-/* **************************************************************************
- *
- * Function: spi_init_r
- *
- * Description: Init SPI-Controller (RAM part) -
- * The malloc engine is ready and we can move our buffers to
- * normal RAM
- *
- * return: ---
- *
- * *********************************************************************** */
-void spi_init_r (void)
-{
- volatile spi_t *spi;
- volatile immap_t *immr;
- volatile cpm8260_t *cp;
- volatile cbd_t *tbdf, *rbdf;
-
- immr = (immap_t *) CFG_IMMR;
- cp = (cpm8260_t *) &immr->im_cpm;
-
- spi = (spi_t *)&immr->im_dprambase[PROFF_SPI];
-
- /* tx and rx buffer descriptors */
- tbdf = (cbd_t *) & immr->im_dprambase[spi->spi_tbase];
- rbdf = (cbd_t *) & immr->im_dprambase[spi->spi_rbase];
-
- /* Allocate memory for RX and TX buffers */
- rxbuf = (uchar *) malloc (MAX_BUFFER);
- txbuf = (uchar *) malloc (MAX_BUFFER);
-
- rbdf->cbd_bufaddr = (ulong) rxbuf;
- tbdf->cbd_bufaddr = (ulong) txbuf;
-
- return;
-}
-
-/****************************************************************************
- * Function: spi_write
- **************************************************************************** */
-ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
-{
- int i;
-
- memset(rxbuf, 0, MAX_BUFFER);
- memset(txbuf, 0, MAX_BUFFER);
- *txbuf = SPI_EEPROM_WREN; /* write enable */
- spi_xfer(1);
- memcpy(txbuf, addr, alen);
- *txbuf = SPI_EEPROM_WRITE; /* WRITE memory array */
- memcpy(alen + txbuf, buffer, len);
- spi_xfer(alen + len);
- /* ignore received data */
- for (i = 0; i < 1000; i++) {
- *txbuf = SPI_EEPROM_RDSR; /* read status */
- txbuf[1] = 0;
- spi_xfer(2);
- if (!(rxbuf[1] & 1)) {
- break;
- }
- udelay(1000);
- }
- if (i >= 1000) {
- printf ("*** spi_write: Time out while writing!\n");
- }
-
- return len;
-}
-
-/****************************************************************************
- * Function: spi_read
- **************************************************************************** */
-ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
-{
- memset(rxbuf, 0, MAX_BUFFER);
- memset(txbuf, 0, MAX_BUFFER);
- memcpy(txbuf, addr, alen);
- *txbuf = SPI_EEPROM_READ; /* READ memory array */
-
- /*
- * There is a bug in 860T (?) that cuts the last byte of input
- * if we're reading into DPRAM. The solution we choose here is
- * to always read len+1 bytes (we have one extra byte at the
- * end of the buffer).
- */
- spi_xfer(alen + len + 1);
- memcpy(buffer, alen + rxbuf, len);
-
- return len;
-}
-
-/****************************************************************************
- * Function: spi_xfer
- **************************************************************************** */
-ssize_t spi_xfer (size_t count)
-{
- volatile immap_t *immr;
- volatile cpm8260_t *cp;
- volatile spi_t *spi;
- cbd_t *tbdf, *rbdf;
- int tm;
-
- DPRINT (("*** spi_xfer entered ***\n"));
-
- immr = (immap_t *) CFG_IMMR;
- cp = (cpm8260_t *) &immr->im_cpm;
-
- spi = (spi_t *)&immr->im_dprambase[PROFF_SPI];
-
- tbdf = (cbd_t *) & immr->im_dprambase[spi->spi_tbase];
- rbdf = (cbd_t *) & immr->im_dprambase[spi->spi_rbase];
-
- /* Board-specific: Set CS for device (ATC EEPROM) */
- immr->im_ioport.iop_pdatd &= ~0x00080000;
-
- /* Setting tx bd status and data length */
- tbdf->cbd_sc = BD_SC_READY | BD_SC_LAST | BD_SC_WRAP;
- tbdf->cbd_datlen = count;
-
- DPRINT (("*** spi_xfer: Bytes to be xferred: %d ***\n",
- tbdf->cbd_datlen));
-
- /* Setting rx bd status and data length */
- rbdf->cbd_sc = BD_SC_EMPTY | BD_SC_WRAP;
- rbdf->cbd_datlen = 0; /* rx length has no significance */
-
- immr->im_spi.spi_spmode = SPMODE_REV |
- SPMODE_MSTR |
- SPMODE_EN |
- SPMODE_LEN(8) | /* 8 Bits per char */
- SPMODE_PM(0x8) ; /* medium speed */
- immr->im_spi.spi_spie = SPI_EMASK; /* Clear all SPI events */
- immr->im_spi.spi_spim = 0x00; /* Mask all SPI events */
-
- /* start spi transfer */
- DPRINT (("*** spi_xfer: Performing transfer ...\n"));
- immr->im_spi.spi_spcom |= SPI_STR; /* Start transmit */
-
- /* --------------------------------
- * Wait for SPI transmit to get out
- * or time out (1 second = 1000 ms)
- * -------------------------------- */
- for (tm=0; tm<1000; ++tm) {
- if (immr->im_spi.spi_spie & SPI_TXB) { /* Tx Buffer Empty */
- DPRINT (("*** spi_xfer: Tx buffer empty\n"));
- break;
- }
- if ((tbdf->cbd_sc & BD_SC_READY) == 0) {
- DPRINT (("*** spi_xfer: Tx BD done\n"));
- break;
- }
- udelay (1000);
- }
- if (tm >= 1000) {
- printf ("*** spi_xfer: Time out while xferring to/from SPI!\n");
- }
- DPRINT (("*** spi_xfer: ... transfer ended\n"));
-
-#ifdef DEBUG
- printf ("\nspi_xfer: txbuf after xfer\n");
- memdump ((void *) txbuf, 16); /* dump of txbuf before transmit */
- printf ("spi_xfer: rxbuf after xfer\n");
- memdump ((void *) rxbuf, 16); /* dump of rxbuf after transmit */
- printf ("\n");
-#endif
-
- /* Clear CS for device */
- immr->im_ioport.iop_pdatd |= 0x00080000;
-
- return count;
-}
-#endif /* CONFIG_SPI */
diff --git a/cpu/mpc8260/start.S b/cpu/mpc8260/start.S
deleted file mode 100644
index baaf8402fd..0000000000
--- a/cpu/mpc8260/start.S
+++ /dev/null
@@ -1,1045 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2000, 2001,2002 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * U-Boot - Startup Code for MPC8260 PowerPC based Embedded Boards
- */
-#include <config.h>
-#include <mpc8260.h>
-#include <version.h>
-
-#define CONFIG_8260 1 /* needed for Linux kernel header files */
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-/* We don't want the MMU yet.
-*/
-#undef MSR_KERNEL
-/* Floating Point enable, Machine Check and Recoverable Interr. */
-#ifdef DEBUG
-#define MSR_KERNEL (MSR_FP|MSR_RI)
-#else
-#define MSR_KERNEL (MSR_FP|MSR_ME|MSR_RI)
-#endif
-
-/*
- * Set up GOT: Global Offset Table
- *
- * Use r14 to access the GOT
- */
- START_GOT
- GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_FIXUP_TABLE_)
-
- GOT_ENTRY(_start)
- GOT_ENTRY(_start_of_vectors)
- GOT_ENTRY(_end_of_vectors)
- GOT_ENTRY(transfer_to_handler)
-
- GOT_ENTRY(__init_end)
- GOT_ENTRY(_end)
- GOT_ENTRY(__bss_start)
-#if defined(CONFIG_HYMOD)
- GOT_ENTRY(environment)
-#endif
- END_GOT
-
-/*
- * Version string - must be in data segment because MPC8260 uses the first
- * 256 bytes for the Hard Reset Configuration Word table (see below).
- * Similarly, can't have the U-Boot Magic Number as the first thing in
- * the image - don't know how this will affect the image tools, but I guess
- * I'll find out soon
- */
- .data
- .globl version_string
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
-
-/*
- * Hard Reset Configuration Word (HRCW) table
- *
- * The Hard Reset Configuration Word (HRCW) sets a number of useful things
- * such as whether there is an external memory controller, whether the
- * PowerPC core is disabled (i.e. only the communications processor is
- * active, accessed by another CPU on the bus), whether using external
- * arbitration, external bus mode, boot port size, core initial prefix,
- * internal space base, boot memory space, etc.
- *
- * These things dictate where the processor begins execution, where the
- * boot ROM appears in memory, the memory controller setup when access
- * boot ROM, etc. The HRCW is *extremely* important.
- *
- * The HRCW is read from the bus during reset. One CPU on the bus will
- * be a hard reset configuration master, any others will be hard reset
- * configuration slaves. The master reads eight HRCWs from flash during
- * reset - the first it uses for itself, the other 7 it communicates to
- * up to 7 configuration slaves by some complicated mechanism, which is
- * not really important here.
- *
- * The configuration master performs 32 successive reads starting at address
- * 0 and incrementing by 8 each read (i.e. on 64 bit boundaries) but only 8
- * bits is read, and always from byte lane D[0-7] (so that port size of the
- * boot device does not matter). The first four reads form the 32 bit HRCW
- * for the master itself. The second four reads form the HRCW for the first
- * slave, and so on, up to seven slaves. The 32 bit HRCW is formed by
- * concatenating the four bytes, with the first read placed in byte 0 (the
- * most significant byte), and so on with the fourth read placed in byte 3
- * (the least significant byte).
- */
-#define _HRCW_TABLE_ENTRY(w) \
- .fill 8,1,(((w)>>24)&0xff); \
- .fill 8,1,(((w)>>16)&0xff); \
- .fill 8,1,(((w)>> 8)&0xff); \
- .fill 8,1,(((w) )&0xff)
- .text
- .globl _hrcw_table
-_hrcw_table:
- _HRCW_TABLE_ENTRY(CFG_HRCW_MASTER)
- _HRCW_TABLE_ENTRY(CFG_HRCW_SLAVE1)
- _HRCW_TABLE_ENTRY(CFG_HRCW_SLAVE2)
- _HRCW_TABLE_ENTRY(CFG_HRCW_SLAVE3)
- _HRCW_TABLE_ENTRY(CFG_HRCW_SLAVE4)
- _HRCW_TABLE_ENTRY(CFG_HRCW_SLAVE5)
- _HRCW_TABLE_ENTRY(CFG_HRCW_SLAVE6)
- _HRCW_TABLE_ENTRY(CFG_HRCW_SLAVE7)
-/*
- * After configuration, a system reset exception is executed using the
- * vector at offset 0x100 relative to the base set by MSR[IP]. If MSR[IP]
- * is 0, the base address is 0x00000000. If MSR[IP] is 1, the base address
- * is 0xfff00000. In the case of a Power On Reset or Hard Reset, the value
- * of MSR[IP] is determined by the CIP field in the HRCW.
- *
- * Other bits in the HRCW set up the Base Address and Port Size in BR0.
- * This determines the location of the boot ROM (flash or EPROM) in the
- * processor's address space at boot time. As long as the HRCW is set up
- * so that we eventually end up executing the code below when the processor
- * executes the reset exception, the actual values used should not matter.
- *
- * Once we have got here, the address mask in OR0 is cleared so that the
- * bottom 32K of the boot ROM is effectively repeated all throughout the
- * processor's address space, after which we can jump to the absolute
- * address at which the boot ROM was linked at compile time, and proceed
- * to initialise the memory controller without worrying if the rug will be
- * pulled out from under us, so to speak (it will be fine as long as we
- * configure BR0 with the same boot ROM link address).
- */
- . = EXC_OFF_SYS_RESET
-
- .globl _start
-_start:
- li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH*/
- nop
- b boot_cold
-
- . = EXC_OFF_SYS_RESET + 0x10
-
- .globl _start_warm
-_start_warm:
- li r21, BOOTFLAG_WARM /* Software reboot */
- b boot_warm
-
-boot_cold:
-#if defined(CONFIG_MPC8260ADS) && defined(CFG_DEFAULT_IMMR)
- lis r3, CFG_DEFAULT_IMMR@h
- nop
- lwz r4, 0(r3)
- nop
- rlwinm r4, r4, 0, 8, 5
- nop
- oris r4, r4, 0x0200
- nop
- stw r4, 0(r3)
- nop
-#endif /* CONFIG_MPC8260ADS && CFG_DEFAULT_IMMR */
-boot_warm:
- mfmsr r5 /* save msr contents */
-
-#if defined(CONFIG_COGENT)
- /* this is what the cogent EPROM does */
- li r0, 0
- mtmsr r0
- isync
- bl cogent_init_8260
-#endif /* CONFIG_COGENT */
-
-#if defined(CFG_DEFAULT_IMMR)
- lis r3, CFG_IMMR@h
- ori r3, r3, CFG_IMMR@l
- lis r4, CFG_DEFAULT_IMMR@h
- stw r3, 0x1A8(r4)
-#endif /* CFG_DEFAULT_IMMR */
-
- /* Initialise the MPC8260 processor core */
- /*--------------------------------------------------------------*/
-
- bl init_8260_core
-
-#ifndef CFG_RAMBOOT
- /* When booting from ROM (Flash or EPROM), clear the */
- /* Address Mask in OR0 so ROM appears everywhere */
- /*--------------------------------------------------------------*/
-
- lis r3, (CFG_IMMR+IM_REGBASE)@h
- lwz r4, IM_OR0@l(r3)
- li r5, 0x7fff
- and r4, r4, r5
- stw r4, IM_OR0@l(r3)
-
- /* Calculate absolute address in FLASH and jump there */
- /*--------------------------------------------------------------*/
-
- lis r3, CFG_MONITOR_BASE@h
- ori r3, r3, CFG_MONITOR_BASE@l
- addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
- mtlr r3
- blr
-
-in_flash:
-#endif /* CFG_RAMBOOT */
-
- /* initialize some things that are hard to access from C */
- /*--------------------------------------------------------------*/
-
- lis r3, CFG_IMMR@h /* set up stack in internal DPRAM */
- ori r1, r3, CFG_INIT_SP_OFFSET
- li r0, 0 /* Make room for stack frame header and */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
-
- /* let the C-code set up the rest */
- /* */
- /* Be careful to keep code relocatable ! */
- /*--------------------------------------------------------------*/
-
- GET_GOT /* initialize GOT access */
-
- /* r3: IMMR */
- bl cpu_init_f /* run low-level CPU init code (in Flash)*/
-
-#ifdef DEBUG
- bl init_debug /* set up debugging stuff */
-#endif
-
- mr r3, r21
- /* r3: BOOTFLAG */
- bl board_init_f /* run 1st part of board init code (in Flash)*/
-
-/*
- * Vector Table
- */
-
- .globl _start_of_vectors
-_start_of_vectors:
-
-/* Machine check */
- STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. */
- STD_EXCEPTION(0x300, DataStorage, UnknownException)
-
-/* Instruction Storage exception. */
- STD_EXCEPTION(0x400, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
- STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
-
-/* Alignment exception. */
- . = 0x600
-Alignment:
- EXCEPTION_PROLOG
- mfspr r4,DAR
- stw r4,_DAR(r21)
- mfspr r5,DSISR
- stw r5,_DSISR(r21)
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- rlwimi r20,r23,0,25,25 /* copy IP bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_Alignment:
- .long AlignmentException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
- . = 0x700
-ProgramCheck:
- EXCEPTION_PROLOG
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- rlwimi r20,r23,0,25,25 /* copy IP bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_ProgramCheck:
- .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
- STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
-
- /* I guess we could implement decrementer, and may have
- * to someday for timekeeping.
- */
- STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
-
- STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
- STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
- STD_EXCEPTION(0xc00, SystemCall, UnknownException)
- STD_EXCEPTION(0xd00, SingleStep, UnknownException)
-
- STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
- STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
-
- STD_EXCEPTION(0x1000, InstructionTLBMiss, UnknownException)
- STD_EXCEPTION(0x1100, DataLoadTLBMiss, UnknownException)
- STD_EXCEPTION(0x1200, DataStoreTLBMiss, UnknownException)
-#ifdef DEBUG
- . = 0x1300
- /*
- * This exception occurs when the program counter matches the
- * Instruction Address Breakpoint Register (IABR).
- *
- * I want the cpu to halt if this occurs so I can hunt around
- * with the debugger and look at things.
- *
- * When DEBUG is defined, both machine check enable (in the MSR)
- * and checkstop reset enable (in the reset mode register) are
- * turned off and so a checkstop condition will result in the cpu
- * halting.
- *
- * I force the cpu into a checkstop condition by putting an illegal
- * instruction here (at least this is the theory).
- *
- * well - that didnt work, so just do an infinite loop!
- */
-1: b 1b
-#else
- STD_EXCEPTION(0x1300, InstructionBreakpoint, DebugException)
-#endif
- STD_EXCEPTION(0x1400, SMI, UnknownException)
-
- STD_EXCEPTION(0x1500, Trap_15, UnknownException)
- STD_EXCEPTION(0x1600, Trap_16, UnknownException)
- STD_EXCEPTION(0x1700, Trap_17, UnknownException)
- STD_EXCEPTION(0x1800, Trap_18, UnknownException)
- STD_EXCEPTION(0x1900, Trap_19, UnknownException)
- STD_EXCEPTION(0x1a00, Trap_1a, UnknownException)
- STD_EXCEPTION(0x1b00, Trap_1b, UnknownException)
- STD_EXCEPTION(0x1c00, Trap_1c, UnknownException)
- STD_EXCEPTION(0x1d00, Trap_1d, UnknownException)
- STD_EXCEPTION(0x1e00, Trap_1e, UnknownException)
- STD_EXCEPTION(0x1f00, Trap_1f, UnknownException)
- STD_EXCEPTION(0x2000, Trap_20, UnknownException)
- STD_EXCEPTION(0x2100, Trap_21, UnknownException)
- STD_EXCEPTION(0x2200, Trap_22, UnknownException)
- STD_EXCEPTION(0x2300, Trap_23, UnknownException)
- STD_EXCEPTION(0x2400, Trap_24, UnknownException)
- STD_EXCEPTION(0x2500, Trap_25, UnknownException)
- STD_EXCEPTION(0x2600, Trap_26, UnknownException)
- STD_EXCEPTION(0x2700, Trap_27, UnknownException)
- STD_EXCEPTION(0x2800, Trap_28, UnknownException)
- STD_EXCEPTION(0x2900, Trap_29, UnknownException)
- STD_EXCEPTION(0x2a00, Trap_2a, UnknownException)
- STD_EXCEPTION(0x2b00, Trap_2b, UnknownException)
- STD_EXCEPTION(0x2c00, Trap_2c, UnknownException)
- STD_EXCEPTION(0x2d00, Trap_2d, UnknownException)
- STD_EXCEPTION(0x2e00, Trap_2e, UnknownException)
- STD_EXCEPTION(0x2f00, Trap_2f, UnknownException)
-
-
- .globl _end_of_vectors
-_end_of_vectors:
-
- . = 0x3000
-
-/*
- * This code finishes saving the registers to the exception frame
- * and jumps to the appropriate handler for the exception.
- * Register r21 is pointer into trap frame, r1 has new stack pointer.
- */
- .globl transfer_to_handler
-transfer_to_handler:
- stw r22,_NIP(r21)
- lis r22,MSR_POW@h
- andc r23,r23,r22
- stw r23,_MSR(r21)
- SAVE_GPR(7, r21)
- SAVE_4GPRS(8, r21)
- SAVE_8GPRS(12, r21)
- SAVE_8GPRS(24, r21)
- mflr r23
- andi. r24,r23,0x3f00 /* get vector offset */
- stw r24,TRAP(r21)
- li r22,0
- stw r22,RESULT(r21)
- lwz r24,0(r23) /* virtual address of handler */
- lwz r23,4(r23) /* where to go when done */
- mtspr SRR0,r24
- mtspr SRR1,r20
- mtlr r23
- SYNC
- rfi /* jump to handler, enable MMU */
-
-int_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr SRR0,r2
- mtspr SRR1,r0
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfi
-
-#if defined(CONFIG_COGENT)
-
-/*
- * This code initialises the MPC8260 processor core
- * (conforms to PowerPC 603e spec)
- */
-
- .globl cogent_init_8260
-cogent_init_8260:
-
- /* Taken from page 14 of CMA282 manual */
- /*--------------------------------------------------------------*/
-
- lis r4, (CFG_IMMR+IM_REGBASE)@h
- lis r3, CFG_IMMR@h
- stw r3, IM_IMMR@l(r4)
- lwz r3, IM_IMMR@l(r4)
- stw r3, 0(r0)
- lis r3, CFG_SYPCR@h
- ori r3, r3, CFG_SYPCR@l
- stw r3, IM_SYPCR@l(r4)
- lwz r3, IM_SYPCR@l(r4)
- stw r3, 4(r0)
- lis r3, CFG_SCCR@h
- ori r3, r3, CFG_SCCR@l
- stw r3, IM_SCCR@l(r4)
- lwz r3, IM_SCCR@l(r4)
- stw r3, 8(r0)
-
- /* the rest of this was disassembled from the */
- /* EPROM code that came with my CMA282 CPU module */
- /*--------------------------------------------------------------*/
-
- lis r1, 0x1234
- ori r1, r1, 0x5678
- stw r1, 0x20(r0)
- lwz r1, 0x20(r0)
- stw r1, 0x24(r0)
- lwz r1, 0x24(r0)
- lis r3, 0x0e80
- ori r3, r3, 0
- stw r1, 4(r3)
- lwz r1, 4(r3)
-
- /* Done! */
- /*--------------------------------------------------------------*/
-
- blr
-
-#endif /* CONFIG_COGENT */
-
-/*
- * This code initialises the MPC8260 processor core
- * (conforms to PowerPC 603e spec)
- * Note: expects original MSR contents to be in r5.
- */
-
- .globl init_8260_core
-init_8260_core:
-
- /* Initialize machine status; enable machine check interrupt */
- /*--------------------------------------------------------------*/
-
- li r3, MSR_KERNEL /* Set ME and RI flags */
- rlwimi r3, r5, 0, 25, 25 /* preserve IP bit set by HRCW */
-#ifdef DEBUG
- rlwimi r3, r5, 0, 21, 22 /* debugger might set SE & BE bits */
-#endif
- SYNC /* Some chip revs need this... */
- mtmsr r3
- SYNC
- mtspr SRR1, r3 /* Make SRR1 match MSR */
-
- /* Initialise the SYPCR early, and reset the watchdog (if req) */
- /*--------------------------------------------------------------*/
-
- lis r3, (CFG_IMMR+IM_REGBASE)@h
-#if !defined(CONFIG_COGENT)
- lis r4, CFG_SYPCR@h
- ori r4, r4, CFG_SYPCR@l
- stw r4, IM_SYPCR@l(r3)
-#endif /* !CONFIG_COGENT */
-#if defined(CONFIG_WATCHDOG)
- li r4, 21868 /* = 0x556c */
- sth r4, IM_SWSR@l(r3)
- li r4, -21959 /* = 0xaa39 */
- sth r4, IM_SWSR@l(r3)
-#endif /* CONFIG_WATCHDOG */
-
- /* Initialize the Hardware Implementation-dependent Registers */
- /* HID0 also contains cache control */
- /*--------------------------------------------------------------*/
-
- lis r3, CFG_HID0_INIT@h
- ori r3, r3, CFG_HID0_INIT@l
- SYNC
- mtspr HID0, r3
-
- lis r3, CFG_HID0_FINAL@h
- ori r3, r3, CFG_HID0_FINAL@l
- SYNC
- mtspr HID0, r3
-
- lis r3, CFG_HID2@h
- ori r3, r3, CFG_HID2@l
- mtspr HID2, r3
-
- /* clear all BAT's */
- /*--------------------------------------------------------------*/
-
- li r0, 0
- mtspr DBAT0U, r0
- mtspr DBAT0L, r0
- mtspr DBAT1U, r0
- mtspr DBAT1L, r0
- mtspr DBAT2U, r0
- mtspr DBAT2L, r0
- mtspr DBAT3U, r0
- mtspr DBAT3L, r0
- mtspr IBAT0U, r0
- mtspr IBAT0L, r0
- mtspr IBAT1U, r0
- mtspr IBAT1L, r0
- mtspr IBAT2U, r0
- mtspr IBAT2L, r0
- mtspr IBAT3U, r0
- mtspr IBAT3L, r0
- SYNC
-
- /* invalidate all tlb's */
- /* */
- /* From the 603e User Manual: "The 603e provides the ability to */
- /* invalidate a TLB entry. The TLB Invalidate Entry (tlbie) */
- /* instruction invalidates the TLB entry indexed by the EA, and */
- /* operates on both the instruction and data TLBs simultaneously*/
- /* invalidating four TLB entries (both sets in each TLB). The */
- /* index corresponds to bits 15-19 of the EA. To invalidate all */
- /* entries within both TLBs, 32 tlbie instructions should be */
- /* issued, incrementing this field by one each time." */
- /* */
- /* "Note that the tlbia instruction is not implemented on the */
- /* 603e." */
- /* */
- /* bits 15-19 correspond to addresses 0x00000000 to 0x0001F000 */
- /* incrementing by 0x1000 each time. The code below is sort of */
- /* based on code in "flush_tlbs" from arch/ppc/kernel/head.S */
- /* */
- /*--------------------------------------------------------------*/
-
- li r3, 32
- mtctr r3
- li r3, 0
-1: tlbie r3
- addi r3, r3, 0x1000
- bdnz 1b
- SYNC
-
- /* Done! */
- /*--------------------------------------------------------------*/
-
- blr
-
-#ifdef DEBUG
-
-/*
- * initialise things related to debugging.
- *
- * must be called after the global offset table (GOT) is initialised
- * (GET_GOT) and after cpu_init_f() has executed.
- */
-
- .globl init_debug
-init_debug:
-
- lis r3, (CFG_IMMR+IM_REGBASE)@h
-
- /* Quick and dirty hack to enable the RAM and copy the */
- /* vectors so that we can take exceptions. */
- /*--------------------------------------------------------------*/
- /* write Memory Refresh Prescaler */
- li r4, CFG_MPTPR
- sth r4, IM_MPTPR@l(r3)
- /* write 60x Refresh Timer */
- li r4, CFG_PSRT
- stb r4, IM_PSRT@l(r3)
- /* init the 60x SDRAM Mode Register */
- lis r4, (CFG_PSDMR|PSDMR_OP_NORM)@h
- ori r4, r4, (CFG_PSDMR|PSDMR_OP_NORM)@l
- stw r4, IM_PSDMR@l(r3)
- /* write Precharge All Banks command */
- lis r4, (CFG_PSDMR|PSDMR_OP_PREA)@h
- ori r4, r4, (CFG_PSDMR|PSDMR_OP_PREA)@l
- stw r4, IM_PSDMR@l(r3)
- stb r0, 0(0)
- /* write eight CBR Refresh commands */
- lis r4, (CFG_PSDMR|PSDMR_OP_CBRR)@h
- ori r4, r4, (CFG_PSDMR|PSDMR_OP_CBRR)@l
- stw r4, IM_PSDMR@l(r3)
- stb r0, 0(0)
- stb r0, 0(0)
- stb r0, 0(0)
- stb r0, 0(0)
- stb r0, 0(0)
- stb r0, 0(0)
- stb r0, 0(0)
- stb r0, 0(0)
- /* write Mode Register Write command */
- lis r4, (CFG_PSDMR|PSDMR_OP_MRW)@h
- ori r4, r4, (CFG_PSDMR|PSDMR_OP_MRW)@l
- stw r4, IM_PSDMR@l(r3)
- stb r0, 0(0)
- /* write Normal Operation command and enable Refresh */
- lis r4, (CFG_PSDMR|PSDMR_OP_NORM|PSDMR_RFEN)@h
- ori r4, r4, (CFG_PSDMR|PSDMR_OP_NORM|PSDMR_RFEN)@l
- stw r4, IM_PSDMR@l(r3)
- stb r0, 0(0)
- /* RAM should now be operational */
-
-#define VEC_WRD_CNT ((_end_of_vectors - _start + EXC_OFF_SYS_RESET) / 4)
-
- lwz r3, GOT(_end_of_vectors)
- rlwinm r4, r3, 0, 18, 31 /* _end_of_vectors & 0x3FFF */
- lis r5, VEC_WRD_CNT@h
- ori r5, r5, VEC_WRD_CNT@l
- mtctr r5
-1:
- lwzu r5, -4(r3)
- stwu r5, -4(r4)
- bdnz 1b
-
- /* Load the Instruction Address Breakpoint Register (IABR). */
- /* */
- /* The address to load is stored in the first word of dual port */
- /* ram and should be preserved while the power is on, so you */
- /* can plug addresses into that location then reset the cpu and */
- /* this code will load that address into the IABR after the */
- /* reset. */
- /* */
- /* When the program counter matches the contents of the IABR, */
- /* an exception is generated (before the instruction at that */
- /* location completes). The vector for this exception is 0x1300 */
- /*--------------------------------------------------------------*/
- lis r3, CFG_IMMR@h
- lwz r3, 0(r3)
- mtspr IABR, r3
-
- /* Set the entire dual port RAM (where the initial stack */
- /* resides) to a known value - makes it easier to see where */
- /* the stack has been written */
- /*--------------------------------------------------------------*/
- lis r3, (CFG_IMMR + CFG_INIT_SP_OFFSET)@h
- ori r3, r3, (CFG_IMMR + CFG_INIT_SP_OFFSET)@l
- li r4, ((CFG_INIT_SP_OFFSET - 4) / 4)
- mtctr r4
- lis r4, 0xdeadbeaf@h
- ori r4, r4, 0xdeadbeaf@l
-1:
- stwu r4, -4(r3)
- bdnz 1b
-
- /* Done! */
- /*--------------------------------------------------------------*/
-
- blr
-#endif
-
-/* Cache functions.
- *
- * Note: requires that all cache bits in
- * HID0 are in the low half word.
- */
- .globl icache_enable
-icache_enable:
- mfspr r3, HID0
- ori r3, r3, HID0_ICE
- lis r4, 0
- ori r4, r4, HID0_ILOCK
- andc r3, r3, r4
- ori r4, r3, HID0_ICFI
- isync
- mtspr HID0, r4 /* sets enable and invalidate, clears lock */
- isync
- mtspr HID0, r3 /* clears invalidate */
- blr
-
- .globl icache_disable
-icache_disable:
- mfspr r3, HID0
- lis r4, 0
- ori r4, r4, HID0_ICE|HID0_ILOCK
- andc r3, r3, r4
- ori r4, r3, HID0_ICFI
- isync
- mtspr HID0, r4 /* sets invalidate, clears enable and lock */
- isync
- mtspr HID0, r3 /* clears invalidate */
- blr
-
- .globl icache_status
-icache_status:
- mfspr r3, HID0
- rlwinm r3, r3, HID0_ICE_BITPOS + 1, 31, 31
- blr
-
- .globl dcache_enable
-dcache_enable:
- mfspr r3, HID0
- ori r3, r3, HID0_DCE
- lis r4, 0
- ori r4, r4, HID0_DLOCK
- andc r3, r3, r4
- ori r4, r3, HID0_DCI
- sync
- mtspr HID0, r4 /* sets enable and invalidate, clears lock */
- sync
- mtspr HID0, r3 /* clears invalidate */
- blr
-
- .globl dcache_disable
-dcache_disable:
- mfspr r3, HID0
- lis r4, 0
- ori r4, r4, HID0_DCE|HID0_DLOCK
- andc r3, r3, r4
- ori r4, r3, HID0_DCI
- sync
- mtspr HID0, r4 /* sets invalidate, clears enable and lock */
- sync
- mtspr HID0, r3 /* clears invalidate */
- blr
-
- .globl dcache_status
-dcache_status:
- mfspr r3, HID0
- rlwinm r3, r3, HID0_DCE_BITPOS + 1, 31, 31
- blr
-
- .globl get_pvr
-get_pvr:
- mfspr r3, PVR
- blr
-
-/*------------------------------------------------------------------------------*/
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
- */
- .globl relocate_code
-relocate_code:
- mr r1, r3 /* Set new stack pointer */
- mr r9, r4 /* Save copy of Global Data pointer */
- mr r10, r5 /* Save copy of Destination Address */
-
- mr r3, r5 /* Destination Address */
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
- lwz r5, GOT(__init_end)
- sub r5, r5, r4
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
- *
- * Offset:
- */
- sub r15, r10, r4
-
- /* First our own GOT */
- add r14, r14, r15
- /* then the one used by the C code */
- add r30, r30, r15
-
- /*
- * Now relocate code
- */
-
- cmplw cr1,r3,r4
- addi r0,r5,3
- srwi. r0,r0,2
- beq cr1,4f /* In place copy is not necessary */
- beq 7f /* Protect against 0 count */
- mtctr r0
- bge cr1,2f
-
- la r8,-4(r4)
- la r7,-4(r3)
-1: lwzu r0,4(r8)
- stwu r0,4(r7)
- bdnz 1b
- b 4f
-
-2: slwi r0,r0,2
- add r8,r4,r0
- add r7,r3,r0
-3: lwzu r0,-4(r8)
- stwu r0,-4(r7)
- bdnz 3b
-
-/*
- * Now flush the cache: note that we must start from a cache aligned
- * address. Otherwise we might miss one cache line.
- */
-4: cmpwi r6,0
- add r5,r3,r5
- beq 7f /* Always flush prefetch queue in any case */
- subi r0,r6,1
- andc r3,r3,r0
- mfspr r7,HID0 /* don't do dcbst if dcache is disabled */
- rlwinm r7,r7,HID0_DCE_BITPOS+1,31,31
- cmpwi r7,0
- beq 9f
- mr r4,r3
-5: dcbst 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 5b
- sync /* Wait for all dcbst to complete on bus */
-9: mfspr r7,HID0 /* don't do icbi if icache is disabled */
- rlwinm r7,r7,HID0_ICE_BITPOS+1,31,31
- cmpwi r7,0
- beq 7f
- mr r4,r3
-6: icbi 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 6b
-7: sync /* Wait for all icbi to complete on bus */
- isync
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-
- addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
- mtlr r0
- blr
-
-in_ram:
-
- /*
- * Relocation Function, r14 point to got2+0x8000
- *
- * Adjust got2 pointers, no need to check for 0, this code
- * already puts a few entries in the table.
- */
- li r0,__got2_entries@sectoff@l
- la r3,GOT(_GOT2_TABLE_)
- lwz r11,GOT(_GOT2_TABLE_)
- mtctr r0
- sub r11,r3,r11
- addi r3,r3,-4
-1: lwzu r0,4(r3)
- add r0,r0,r11
- stw r0,0(r3)
- bdnz 1b
-
- /*
- * Now adjust the fixups and the pointers to the fixups
- * in case we need to move ourselves again.
- */
-2: li r0,__fixup_entries@sectoff@l
- lwz r3,GOT(_FIXUP_TABLE_)
- cmpwi r0,0
- mtctr r0
- addi r3,r3,-4
- beq 4f
-3: lwzu r4,4(r3)
- lwzux r0,r4,r11
- add r0,r0,r11
- stw r10,0(r3)
- stw r0,0(r4)
- bdnz 3b
-4:
-clear_bss:
- /*
- * Now clear BSS segment
- */
- lwz r3,GOT(__bss_start)
-#if defined(CONFIG_HYMOD)
- /*
- * For HYMOD - the environment is the very last item in flash.
- * The real .bss stops just before environment starts, so only
- * clear up to that point.
- *
- * taken from mods for FADS board
- */
- lwz r4,GOT(environment)
-#else
- lwz r4,GOT(_end)
-#endif
-
- cmplw 0, r3, r4
- beq 6f
-
- li r0, 0
-5:
- stw r0, 0(r3)
- addi r3, r3, 4
- cmplw 0, r3, r4
- bne 5b
-6:
-
- mr r3, r9 /* Global Data pointer */
- mr r4, r10 /* Destination Address */
- bl board_init_r
-
- /*
- * Copy exception vector code to low memory
- *
- * r3: dest_addr
- * r7: source address, r8: end address, r9: target address
- */
- .globl trap_init
-trap_init:
- lwz r7, GOT(_start)
- lwz r8, GOT(_end_of_vectors)
-
- li r9, 0x100 /* reset vector always at 0x100 */
-
- cmplw 0, r7, r8
- bgelr /* return if r7>=r8 - just in case */
-
- mflr r4 /* save link register */
-1:
- lwz r0, 0(r7)
- stw r0, 0(r9)
- addi r7, r7, 4
- addi r9, r9, 4
- cmplw 0, r7, r8
- bne 1b
-
- /*
- * relocate `hdlr' and `int_return' entries
- */
- li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
- li r8, Alignment - _start + EXC_OFF_SYS_RESET
-2:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 2b
-
- li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
- li r8, SystemCall - _start + EXC_OFF_SYS_RESET
-3:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 3b
-
- li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
- li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-4:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 4b
-
- mfmsr r3 /* now that the vectors have */
- lis r7, MSR_IP@h /* relocated into low memory */
- ori r7, r7, MSR_IP@l /* MSR[IP] can be turned off */
- andc r3, r3, r7 /* (if it was on) */
- SYNC /* Some chip revs need this... */
- mtmsr r3
- SYNC
-
- mtlr r4 /* restore link register */
- blr
-
- /*
- * Function: relocate entries for one exception vector
- */
-trap_reloc:
- lwz r0, 0(r7) /* hdlr ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 0(r7)
-
- lwz r0, 4(r7) /* int_return ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 4(r7)
-
- blr
diff --git a/cpu/mpc8260/traps.c b/cpu/mpc8260/traps.c
deleted file mode 100644
index 4f07531f93..0000000000
--- a/cpu/mpc8260/traps.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * linux/arch/ppc/kernel/traps.c
- *
- * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- * Modified by Cort Dougan (cort@cs.nmt.edu)
- * and Paul Mackerras (paulus@cs.anu.edu.au)
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * This file handles the architecture-dependent parts of hardware exceptions
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/processor.h>
-#include <asm/m8260_pci.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
-/* Returns 0 if exception not found and fixup otherwise. */
-extern unsigned long search_exception_table(unsigned long);
-
-/* THIS NEEDS CHANGING to use the board info structure.
-*/
-#define END_OF_MEM 0x02000000
-
-/*
- * Trap & Exception support
- */
-
-void
-print_backtrace(unsigned long *sp)
-{
- int cnt = 0;
- unsigned long i;
-
- puts ("Call backtrace: ");
- while (sp) {
- if ((uint)sp > END_OF_MEM)
- break;
-
- i = sp[1];
- if (cnt++ % 7 == 0)
- putc ('\n');
- printf("%08lX ", i);
- if (cnt > 32) break;
- sp = (unsigned long *)*sp;
- }
- putc ('\n');
-}
-
-void show_regs(struct pt_regs * regs)
-{
- int i;
-
- printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
- regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
- printf("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
- regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
- regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
- regs->msr&MSR_IR ? 1 : 0,
- regs->msr&MSR_DR ? 1 : 0);
-
- putc ('\n');
- for (i = 0; i < 32; i++) {
- if ((i % 8) == 0) {
- printf("GPR%02d: ", i);
- }
-
- printf("%08lX ", regs->gpr[i]);
- if ((i % 8) == 7) {
- putc ('\n');
- }
- }
-}
-
-
-void
-_exception(int signr, struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
-}
-
-#ifdef CONFIG_PCI
-void dump_pci (void)
-{
-
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
-
- printf ("PCI: err status %x err mask %x err ctrl %x\n",
- le32_to_cpu (immap->im_pci.pci_esr),
- le32_to_cpu (immap->im_pci.pci_emr),
- le32_to_cpu (immap->im_pci.pci_ecr));
- printf (" error address %x error data %x ctrl %x\n",
- le32_to_cpu (immap->im_pci.pci_eacr),
- le32_to_cpu (immap->im_pci.pci_edcr),
- le32_to_cpu (immap->im_pci.pci_eccr));
-
-}
-#endif
-
-void
-MachineCheckException(struct pt_regs *regs)
-{
- unsigned long fixup;
-
- /* Probing PCI using config cycles cause this exception
- * when a device is not present. Catch it and return to
- * the PCI exception handler.
- */
-#ifdef CONFIG_PCI
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
-#ifdef DEBUG
- dump_pci();
-#endif
- /* clear the error in the error status register */
- if(immap->im_pci.pci_esr & cpu_to_le32(PCI_ERROR_PCI_NO_RSP)) {
- immap->im_pci.pci_esr = cpu_to_le32(PCI_ERROR_PCI_NO_RSP);
- return;
- }
-#endif
- if ((fixup = search_exception_table(regs->nip)) != 0) {
- regs->nip = fixup;
- return;
- }
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- puts ("Machine check in kernel mode.\n"
- "Caused by (from msr): ");
- printf("regs %p ",regs);
- switch( regs->msr & 0x000F0000) {
- case (0x80000000>>12):
- puts ("Machine check signal - probably due to mm fault\n"
- "with mmu off\n");
- break;
- case (0x80000000>>13):
- puts ("Transfer error ack signal\n");
- break;
- case (0x80000000>>14):
- puts ("Data parity signal\n");
- break;
- case (0x80000000>>15):
- puts ("Address parity signal\n");
- break;
- default:
- puts ("Unknown values in msr\n");
- }
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
-#ifdef CONFIG_PCI
- dump_pci();
-#endif
- panic("machine check");
-}
-
-void
-AlignmentException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Alignment Exception");
-}
-
-void
-ProgramCheckException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Program Check Exception");
-}
-
-void
-SoftEmuException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Software Emulation Exception");
-}
-
-
-void
-UnknownException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
- regs->nip, regs->msr, regs->trap);
- _exception(0, regs);
-}
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
-extern void do_bedbug_breakpoint(struct pt_regs *);
-#endif
-
-void
-DebugException(struct pt_regs *regs)
-{
-
- printf("Debugger trap at @ %lx\n", regs->nip );
- show_regs(regs);
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
- do_bedbug_breakpoint( regs );
-#endif
-}
-
-/* Probe an address by reading. If not present, return -1, otherwise
- * return 0.
- */
-int
-addr_probe(uint *addr)
-{
- return 0;
-}
diff --git a/cpu/mpc83xx/Makefile b/cpu/mpc83xx/Makefile
deleted file mode 100644
index 4b9dcc8180..0000000000
--- a/cpu/mpc83xx/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# (C) Copyright 2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# Copyright 2004 Freescale Semiconductor, Inc.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o \
- spd_sdram.o qe_io.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/mpc83xx/config.mk b/cpu/mpc83xx/config.mk
deleted file mode 100644
index 8b4ff92b19..0000000000
--- a/cpu/mpc83xx/config.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Copyright 2004 Freescale Semiconductor, Inc.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_MPC83XX -DCONFIG_E300 \
- -ffixed-r2 -ffixed-r29 -msoft-float
diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
deleted file mode 100644
index 3331d9952f..0000000000
--- a/cpu/mpc83xx/cpu.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * Copyright (C) 2004-2006 Freescale Semiconductor, Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * CPU specific code for the MPC83xx family.
- *
- * Derived from the MPC8260 and MPC85xx.
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <command.h>
-#include <mpc83xx.h>
-#include <ft_build.h>
-#include <asm/processor.h>
-#include <init.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-
-int checkcpu(void)
-{
- volatile immap_t *immr;
- ulong clock = gd->cpu_clk;
- u32 pvr = get_pvr();
- u32 spridr;
- char buf[32];
-
- immr = (immap_t *)CFG_IMMR;
-
- if ((pvr & 0xFFFF0000) != PVR_83xx) {
- puts("Not MPC83xx Family!!!\n");
- return -1;
- }
-
- spridr = immr->sysconf.spridr;
- puts("CPU: ");
- switch(spridr) {
- case SPR_8349E_REV10:
- case SPR_8349E_REV11:
- puts("MPC8349E, ");
- break;
- case SPR_8349_REV10:
- case SPR_8349_REV11:
- puts("MPC8349, ");
- break;
- case SPR_8347E_REV10_TBGA:
- case SPR_8347E_REV11_TBGA:
- case SPR_8347E_REV10_PBGA:
- case SPR_8347E_REV11_PBGA:
- puts("MPC8347E, ");
- break;
- case SPR_8347_REV10_TBGA:
- case SPR_8347_REV11_TBGA:
- case SPR_8347_REV10_PBGA:
- case SPR_8347_REV11_PBGA:
- puts("MPC8347, ");
- break;
- case SPR_8343E_REV10:
- case SPR_8343E_REV11:
- puts("MPC8343E, ");
- break;
- case SPR_8343_REV10:
- case SPR_8343_REV11:
- puts("MPC8343, ");
- break;
- case SPR_8360E_REV10:
- case SPR_8360E_REV11:
- case SPR_8360E_REV12:
- puts("MPC8360E, ");
- break;
- case SPR_8360_REV10:
- case SPR_8360_REV11:
- case SPR_8360_REV12:
- puts("MPC8360, ");
- break;
- default:
- puts("Rev: Unknown\n");
- return -1; /* Not sure what this is */
- }
-
-#if defined(CONFIG_MPC8349)
- printf("Rev: %02x at %s MHz\n", (spridr & 0x0000FFFF)>>4 |(spridr & 0x0000000F), strmhz(buf, clock));
-#else
- printf("Rev: %02x at %s MHz\n", spridr & 0x0000FFFF, strmhz(buf, clock));
-#endif
- return 0;
-}
-
-
-/*
- * Program a UPM with the code supplied in the table.
- *
- * The 'dummy' variable is used to increment the MAD. 'dummy' is
- * supposed to be a pointer to the memory of the device being
- * programmed by the UPM. The data in the MDR is written into
- * memory and the MAD is incremented every time there's a read
- * from 'dummy'. Unfortunately, the current prototype for this
- * function doesn't allow for passing the address of this
- * device, and changing the prototype will break a number lots
- * of other code, so we need to use a round-about way of finding
- * the value for 'dummy'.
- *
- * The value can be extracted from the base address bits of the
- * Base Register (BR) associated with the specific UPM. To find
- * that BR, we need to scan all 8 BRs until we find the one that
- * has its MSEL bits matching the UPM we want. Once we know the
- * right BR, we can extract the base address bits from it.
- *
- * The MxMR and the BR and OR of the chosen bank should all be
- * configured before calling this function.
- *
- * Parameters:
- * upm: 0=UPMA, 1=UPMB, 2=UPMC
- * table: Pointer to an array of values to program
- * size: Number of elements in the array. Must be 64 or less.
- */
-void upmconfig (uint upm, uint *table, uint size)
-{
-#if defined(CONFIG_MPC834X)
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- volatile lbus83xx_t *lbus = &immap->lbus;
- volatile uchar *dummy = NULL;
- const u32 msel = (upm + 4) << BR_MSEL_SHIFT; /* What the MSEL field in BRn should be */
- volatile u32 *mxmr = &lbus->mamr + upm; /* Pointer to mamr, mbmr, or mcmr */
- uint i;
-
- /* Scan all the banks to determine the base address of the device */
- for (i = 0; i < 8; i++) {
- if ((lbus->bank[i].br & BR_MSEL) == msel) {
- dummy = (uchar *) (lbus->bank[i].br & BR_BA);
- break;
- }
- }
-
- if (!dummy) {
- printf("Error: %s() could not find matching BR\n", __FUNCTION__);
- hang();
- }
-
- /* Set the OP field in the MxMR to "write" and the MAD field to 000000 */
- *mxmr = (*mxmr & 0xCFFFFFC0) | 0x10000000;
-
- for (i = 0; i < size; i++) {
- lbus->mdr = table[i];
- __asm__ __volatile__ ("sync");
- *dummy; /* Write the value to memory and increment MAD */
- __asm__ __volatile__ ("sync");
- }
-
- /* Set the OP field in the MxMR to "normal" and the MAD field to 000000 */
- *mxmr &= 0xCFFFFFC0;
-#else
- printf("Error: %s() not defined for this configuration.\n", __FUNCTION__);
- hang();
-#endif
-}
-
-
-int
-do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
-{
- ulong msr;
-#ifndef MPC83xx_RESET
- ulong addr;
-#endif
-
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
-
-#ifdef MPC83xx_RESET
- /* Interrupts and MMU off */
- __asm__ __volatile__ ("mfmsr %0":"=r" (msr):);
-
- msr &= ~( MSR_EE | MSR_IR | MSR_DR);
- __asm__ __volatile__ ("mtmsr %0"::"r" (msr));
-
- /* enable Reset Control Reg */
- immap->reset.rpr = 0x52535445;
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("isync");
-
- /* confirm Reset Control Reg is enabled */
- while(!((immap->reset.rcer) & RCER_CRE));
-
- printf("Resetting the board.");
- printf("\n");
-
- udelay(200);
-
- /* perform reset, only one bit */
- immap->reset.rcr = RCR_SWHR;
-
-#else /* ! MPC83xx_RESET */
-
- immap->reset.rmr = RMR_CSRE; /* Checkstop Reset enable */
-
- /* Interrupts and MMU off */
- __asm__ __volatile__ ("mfmsr %0":"=r" (msr):);
-
- msr &= ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR);
- __asm__ __volatile__ ("mtmsr %0"::"r" (msr));
-
- /*
- * Trying to execute the next instruction at a non-existing address
- * should cause a machine check, resulting in reset
- */
- addr = CFG_RESET_ADDRESS;
-
- printf("resetting the board.");
- printf("\n");
- ((void (*)(void)) addr) ();
-#endif /* MPC83xx_RESET */
-
- return 1;
-}
-
-
-/*
- * Get timebase clock frequency (like cpu_clk in Hz)
- */
-
-unsigned long get_tbclk(void)
-{
- ulong tbclk;
-
- tbclk = (gd->bus_clk + 3L) / 4L;
-
- return tbclk;
-}
-
-
-#if defined(CONFIG_WATCHDOG)
-void watchdog_reset (void)
-{
-#ifdef CONFIG_MPC834X
- int re_enable = disable_interrupts();
-
- /* Reset the 83xx watchdog */
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- immr->wdt.swsrr = 0x556c;
- immr->wdt.swsrr = 0xaa39;
-
- if (re_enable)
- enable_interrupts ();
-#else
- hang();
-#endif
-}
-#endif
-
-#if defined(CONFIG_OF_FLAT_TREE)
-void
-ft_cpu_setup(void *blob, bd_t *bd)
-{
- u32 *p;
- int len;
- ulong clock;
-
- clock = bd->bi_busfreq;
- p = ft_get_prop(blob, "/cpus/" OF_CPU "/bus-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(clock);
-
- p = ft_get_prop(blob, "/" OF_SOC "/bus-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(clock);
-
- p = ft_get_prop(blob, "/" OF_SOC "/serial@4500/clock-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(clock);
-
- p = ft_get_prop(blob, "/" OF_SOC "/serial@4600/clock-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(clock);
-
-#ifdef CONFIG_MPC83XX_TSEC1
- p = ft_get_prop(blob, "/" OF_SOC "/ethernet@24000/local-mac-address", &len);
- memcpy(p, bd->bi_enetaddr, 6);
-#endif
-
-#ifdef CONFIG_MPC83XX_TSEC2
- p = ft_get_prop(blob, "/" OF_SOC "/ethernet@25000/local-mac-address", &len);
- memcpy(p, bd->bi_enet1addr, 6);
-#endif
-}
-#endif
-
-#if defined(CONFIG_DDR_ECC)
-void dma_init(void)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile dma83xx_t *dma = &immap->dma;
- volatile u32 status = swab32(dma->dmasr0);
- volatile u32 dmamr0 = swab32(dma->dmamr0);
-
- debug("DMA-init\n");
-
- /* initialize DMASARn, DMADAR and DMAABCRn */
- dma->dmadar0 = (u32)0;
- dma->dmasar0 = (u32)0;
- dma->dmabcr0 = 0;
-
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("isync");
-
- /* clear CS bit */
- dmamr0 &= ~DMA_CHANNEL_START;
- dma->dmamr0 = swab32(dmamr0);
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("isync");
-
- /* while the channel is busy, spin */
- while(status & DMA_CHANNEL_BUSY) {
- status = swab32(dma->dmasr0);
- }
-
- debug("DMA-init end\n");
-}
-
-uint dma_check(void)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile dma83xx_t *dma = &immap->dma;
- volatile u32 status = swab32(dma->dmasr0);
- volatile u32 byte_count = swab32(dma->dmabcr0);
-
- /* while the channel is busy, spin */
- while (status & DMA_CHANNEL_BUSY) {
- status = swab32(dma->dmasr0);
- }
-
- if (status & DMA_CHANNEL_TRANSFER_ERROR) {
- printf ("DMA Error: status = %x @ %d\n", status, byte_count);
- }
-
- return status;
-}
-
-int dma_xfer(void *dest, u32 count, void *src)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile dma83xx_t *dma = &immap->dma;
- volatile u32 dmamr0;
-
- /* initialize DMASARn, DMADAR and DMAABCRn */
- dma->dmadar0 = swab32((u32)dest);
- dma->dmasar0 = swab32((u32)src);
- dma->dmabcr0 = swab32(count);
-
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("isync");
-
- /* init direct transfer, clear CS bit */
- dmamr0 = (DMA_CHANNEL_TRANSFER_MODE_DIRECT |
- DMA_CHANNEL_SOURCE_ADDRESS_HOLD_8B |
- DMA_CHANNEL_SOURCE_ADRESSS_HOLD_EN);
-
- dma->dmamr0 = swab32(dmamr0);
-
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("isync");
-
- /* set CS to start DMA transfer */
- dmamr0 |= DMA_CHANNEL_START;
- dma->dmamr0 = swab32(dmamr0);
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("isync");
-
- return ((int)dma_check());
-}
-#endif /*CONFIG_DDR_ECC*/
-
-static int mpc5xxx_bd_init(void)
-{
- bd_t *bd = gd->bd;
-
- bd->bi_immrbar = CFG_IMMR;
-}
-
-bd_initcall(mpc5xxx_bd_init);
diff --git a/cpu/mpc83xx/cpu_init.c b/cpu/mpc83xx/cpu_init.c
deleted file mode 100644
index e5725fb91d..0000000000
--- a/cpu/mpc83xx/cpu_init.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Copyright (C) 2004-2006 Freescale Semiconductor, Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc83xx.h>
-#include <ioports.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#ifdef CONFIG_QE
-extern qe_iop_conf_t qe_iop_conf_tab[];
-extern void qe_config_iopin(u8 port, u8 pin, int dir,
- int open_drain, int assign);
-extern void qe_init(uint qe_base);
-extern void qe_reset(void);
-
-static void config_qe_ioports(void)
-{
- u8 port, pin;
- int dir, open_drain, assign;
- int i;
-
- for (i = 0; qe_iop_conf_tab[i].assign != QE_IOP_TAB_END; i++) {
- port = qe_iop_conf_tab[i].port;
- pin = qe_iop_conf_tab[i].pin;
- dir = qe_iop_conf_tab[i].dir;
- open_drain = qe_iop_conf_tab[i].open_drain;
- assign = qe_iop_conf_tab[i].assign;
- qe_config_iopin(port, pin, dir, open_drain, assign);
- }
-}
-#endif
-
-/*
- * Breathe some life into the CPU...
- *
- * Set up the memory map,
- * initialize a bunch of registers,
- * initialize the UPM's
- */
-void cpu_init_f (volatile immap_t * im)
-{
- /* Pointer is writable since we allocated a register for it */
- gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
-
- /* Clear initial global data */
- memset ((void *) gd, 0, sizeof (gd_t));
-
- /* system performance tweaking */
-
-#ifdef CFG_ACR_PIPE_DEP
- /* Arbiter pipeline depth */
- im->arbiter.acr = (im->arbiter.acr & ~ACR_PIPE_DEP) | (3 << ACR_PIPE_DEP_SHIFT);
-#endif
-
-#ifdef CFG_SPCR_TSEC1EP
- /* TSEC1 Emergency priority */
- im->sysconf.spcr = (im->sysconf.spcr & ~SPCR_TSEC1EP) | (3 << SPCR_TSEC1EP_SHIFT);
-#endif
-
-#ifdef CFG_SPCR_TSEC2EP
- /* TSEC2 Emergency priority */
- im->sysconf.spcr = (im->sysconf.spcr & ~SPCR_TSEC2EP) | (3 << SPCR_TSEC2EP_SHIFT);
-#endif
-
-#ifdef CFG_SCCR_TSEC1CM
- /* TSEC1 clock mode */
- im->clk.sccr = (im->clk.sccr & ~SCCR_TSEC1CM) | (1 << SCCR_TSEC1CM_SHIFT);
-#endif
-#ifdef CFG_SCCR_TSEC2CM
- /* TSEC2 & I2C1 clock mode */
- im->clk.sccr = (im->clk.sccr & ~SCCR_TSEC2CM) | (1 << SCCR_TSEC2CM_SHIFT);
-#endif
-
-#ifdef CFG_ACR_RPTCNT
- /* Arbiter repeat count */
- im->arbiter.acr = ((im->arbiter.acr & ~(ACR_RPTCNT)) | (3 << ACR_RPTCNT_SHIFT));
-#endif
-
- /* RSR - Reset Status Register - clear all status (4.6.1.3) */
- gd->reset_status = im->reset.rsr;
- im->reset.rsr = ~(RSR_RES);
-
- /*
- * RMR - Reset Mode Register
- * contains checkstop reset enable (4.6.1.4)
- */
- im->reset.rmr = (RMR_CSRE & (1<<RMR_CSRE_SHIFT));
-
- /* LCRR - Clock Ratio Register (10.3.1.16) */
- im->lbus.lcrr = CFG_LCRR;
-
- /* Enable Time Base & Decrimenter ( so we will have udelay() )*/
- im->sysconf.spcr |= SPCR_TBEN;
-
- /* System General Purpose Register */
-#ifdef CFG_SICRH
- im->sysconf.sicrh = CFG_SICRH;
-#endif
-#ifdef CFG_SICRL
- im->sysconf.sicrl = CFG_SICRL;
-#endif
-#ifdef CONFIG_QE
- /* Config QE ioports */
- config_qe_ioports();
-#endif
-
- /*
- * Memory Controller:
- */
-
- /* Map banks 0 and 1 to the FLASH banks 0 and 1 at preliminary
- * addresses - these have to be modified later when FLASH size
- * has been determined
- */
-
-#if defined(CFG_BR0_PRELIM) \
- && defined(CFG_OR0_PRELIM) \
- && defined(CFG_LBLAWBAR0_PRELIM) \
- && defined(CFG_LBLAWAR0_PRELIM)
- im->lbus.bank[0].br = CFG_BR0_PRELIM;
- im->lbus.bank[0].or = CFG_OR0_PRELIM;
- im->sysconf.lblaw[0].bar = CFG_LBLAWBAR0_PRELIM;
- im->sysconf.lblaw[0].ar = CFG_LBLAWAR0_PRELIM;
-#else
-#error CFG_BR0_PRELIM, CFG_OR0_PRELIM, CFG_LBLAWBAR0_PRELIM & CFG_LBLAWAR0_PRELIM must be defined
-#endif
-
-#if defined(CFG_BR1_PRELIM) && defined(CFG_OR1_PRELIM)
- im->lbus.bank[1].br = CFG_BR1_PRELIM;
- im->lbus.bank[1].or = CFG_OR1_PRELIM;
-#endif
-#if defined(CFG_LBLAWBAR1_PRELIM) && defined(CFG_LBLAWAR1_PRELIM)
- im->sysconf.lblaw[1].bar = CFG_LBLAWBAR1_PRELIM;
- im->sysconf.lblaw[1].ar = CFG_LBLAWAR1_PRELIM;
-#endif
-#if defined(CFG_BR2_PRELIM) && defined(CFG_OR2_PRELIM)
- im->lbus.bank[2].br = CFG_BR2_PRELIM;
- im->lbus.bank[2].or = CFG_OR2_PRELIM;
-#endif
-#if defined(CFG_LBLAWBAR2_PRELIM) && defined(CFG_LBLAWAR2_PRELIM)
- im->sysconf.lblaw[2].bar = CFG_LBLAWBAR2_PRELIM;
- im->sysconf.lblaw[2].ar = CFG_LBLAWAR2_PRELIM;
-#endif
-#if defined(CFG_BR3_PRELIM) && defined(CFG_OR3_PRELIM)
- im->lbus.bank[3].br = CFG_BR3_PRELIM;
- im->lbus.bank[3].or = CFG_OR3_PRELIM;
-#endif
-#if defined(CFG_LBLAWBAR3_PRELIM) && defined(CFG_LBLAWAR3_PRELIM)
- im->sysconf.lblaw[3].bar = CFG_LBLAWBAR3_PRELIM;
- im->sysconf.lblaw[3].ar = CFG_LBLAWAR3_PRELIM;
-#endif
-#if defined(CFG_BR4_PRELIM) && defined(CFG_OR4_PRELIM)
- im->lbus.bank[4].br = CFG_BR4_PRELIM;
- im->lbus.bank[4].or = CFG_OR4_PRELIM;
-#endif
-#if defined(CFG_LBLAWBAR4_PRELIM) && defined(CFG_LBLAWAR4_PRELIM)
- im->sysconf.lblaw[4].bar = CFG_LBLAWBAR4_PRELIM;
- im->sysconf.lblaw[4].ar = CFG_LBLAWAR4_PRELIM;
-#endif
-#if defined(CFG_BR5_PRELIM) && defined(CFG_OR5_PRELIM)
- im->lbus.bank[5].br = CFG_BR5_PRELIM;
- im->lbus.bank[5].or = CFG_OR5_PRELIM;
-#endif
-#if defined(CFG_LBLAWBAR5_PRELIM) && defined(CFG_LBLAWAR5_PRELIM)
- im->sysconf.lblaw[5].bar = CFG_LBLAWBAR5_PRELIM;
- im->sysconf.lblaw[5].ar = CFG_LBLAWAR5_PRELIM;
-#endif
-#if defined(CFG_BR6_PRELIM) && defined(CFG_OR6_PRELIM)
- im->lbus.bank[6].br = CFG_BR6_PRELIM;
- im->lbus.bank[6].or = CFG_OR6_PRELIM;
-#endif
-#if defined(CFG_LBLAWBAR6_PRELIM) && defined(CFG_LBLAWAR6_PRELIM)
- im->sysconf.lblaw[6].bar = CFG_LBLAWBAR6_PRELIM;
- im->sysconf.lblaw[6].ar = CFG_LBLAWAR6_PRELIM;
-#endif
-#if defined(CFG_BR7_PRELIM) && defined(CFG_OR7_PRELIM)
- im->lbus.bank[7].br = CFG_BR7_PRELIM;
- im->lbus.bank[7].or = CFG_OR7_PRELIM;
-#endif
-#if defined(CFG_LBLAWBAR7_PRELIM) && defined(CFG_LBLAWAR7_PRELIM)
- im->sysconf.lblaw[7].bar = CFG_LBLAWBAR7_PRELIM;
- im->sysconf.lblaw[7].ar = CFG_LBLAWAR7_PRELIM;
-#endif
-#ifdef CFG_GPIO1_PRELIM
- im->pgio[0].dir = CFG_GPIO1_DIR;
- im->pgio[0].dat = CFG_GPIO1_DAT;
-#endif
-#ifdef CFG_GPIO2_PRELIM
- im->pgio[1].dir = CFG_GPIO2_DIR;
- im->pgio[1].dat = CFG_GPIO2_DAT;
-#endif
-}
-
-int cpu_init_r (void)
-{
-#ifdef CONFIG_QE
- uint qe_base = CFG_IMMR + 0x00100000; /* QE immr base */
- qe_init(qe_base);
- qe_reset();
-#endif
- return 0;
-}
diff --git a/cpu/mpc83xx/interrupts.c b/cpu/mpc83xx/interrupts.c
deleted file mode 100644
index bb1fe1af3f..0000000000
--- a/cpu/mpc83xx/interrupts.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * Copyright 2004 Freescale Semiconductor, Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <command.h>
-#include <mpc83xx.h>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-struct irq_action {
- interrupt_handler_t *handler;
- void *arg;
- ulong count;
-};
-
-int interrupt_init_cpu (unsigned *decrementer_count)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
- *decrementer_count = (gd->bus_clk / 4) / CFG_HZ;
-
- /* Enable e300 time base */
-
- immr->sysconf.spcr |= 0x00400000;
-
- return 0;
-}
-
-
-/*
- * Handle external interrupts
- */
-
-void external_interrupt (struct pt_regs *regs)
-{
-}
-
-
-/*
- * Install and free an interrupt handler.
- */
-
-void
-irq_install_handler (int irq, interrupt_handler_t * handler, void *arg)
-{
-}
-
-
-void irq_free_handler (int irq)
-{
-}
-
-
-void timer_interrupt_cpu (struct pt_regs *regs)
-{
- /* nothing to do here */
- return;
-}
-
-
-#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
-
-/* ripped this out of ppc4xx/interrupts.c */
-
-/*
- * irqinfo - print information about PCI devices
- */
-
-void
-do_irqinfo(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
-{
-}
-
-#endif /* CONFIG_COMMANDS & CFG_CMD_IRQ */
diff --git a/cpu/mpc83xx/qe_io.c b/cpu/mpc83xx/qe_io.c
deleted file mode 100644
index ebe3487112..0000000000
--- a/cpu/mpc83xx/qe_io.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2006 Freescale Semiconductor, Inc.
- *
- * Dave Liu <daveliu@freescale.com>
- * based on source code of Shlomi Gridish
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include "common.h"
-#include "asm/errno.h"
-#include "asm/io.h"
-#include "asm/immap_83xx.h"
-
-#if defined(CONFIG_QE)
-#define NUM_OF_PINS 32
-void qe_config_iopin(u8 port, u8 pin, int dir, int open_drain, int assign)
-{
- u32 pin_2bit_mask;
- u32 pin_2bit_dir;
- u32 pin_2bit_assign;
- u32 pin_1bit_mask;
- u32 tmp_val;
- volatile immap_t *im = (volatile immap_t *)CFG_IMMR;
- volatile gpio83xx_t *par_io =(volatile gpio83xx_t *)&im->gpio;
-
- /* Caculate pin location and 2bit mask and dir */
- pin_2bit_mask = (u32)(0x3 << (NUM_OF_PINS-(pin%(NUM_OF_PINS/2)+1)*2));
- pin_2bit_dir = (u32)(dir << (NUM_OF_PINS-(pin%(NUM_OF_PINS/2)+1)*2));
-
- /* Setup the direction */
- tmp_val = (pin > (NUM_OF_PINS/2) - 1) ? \
- in_be32(&par_io->ioport[port].dir2) :
- in_be32(&par_io->ioport[port].dir1);
-
- if (pin > (NUM_OF_PINS/2) -1) {
- out_be32(&par_io->ioport[port].dir2, ~pin_2bit_mask & tmp_val);
- out_be32(&par_io->ioport[port].dir2, pin_2bit_dir | tmp_val);
- } else {
- out_be32(&par_io->ioport[port].dir1, ~pin_2bit_mask & tmp_val);
- out_be32(&par_io->ioport[port].dir1, pin_2bit_dir | tmp_val);
- }
-
- /* Calculate pin location for 1bit mask */
- pin_1bit_mask = (u32)(1 << (NUM_OF_PINS - (pin+1)));
-
- /* Setup the open drain */
- tmp_val = in_be32(&par_io->ioport[port].podr);
- if (open_drain) {
- out_be32(&par_io->ioport[port].podr, pin_1bit_mask | tmp_val);
- } else {
- out_be32(&par_io->ioport[port].podr, ~pin_1bit_mask & tmp_val);
- }
-
- /* Setup the assignment */
- tmp_val = (pin > (NUM_OF_PINS/2) - 1) ?
- in_be32(&par_io->ioport[port].ppar2):
- in_be32(&par_io->ioport[port].ppar1);
- pin_2bit_assign = (u32)(assign
- << (NUM_OF_PINS - (pin%(NUM_OF_PINS/2)+1)*2));
-
- /* Clear and set 2 bits mask */
- if (pin > (NUM_OF_PINS/2) - 1) {
- out_be32(&par_io->ioport[port].ppar2, ~pin_2bit_mask & tmp_val);
- out_be32(&par_io->ioport[port].ppar2, pin_2bit_assign | tmp_val);
- } else {
- out_be32(&par_io->ioport[port].ppar1, ~pin_2bit_mask & tmp_val);
- out_be32(&par_io->ioport[port].ppar1, pin_2bit_assign | tmp_val);
- }
-}
-
-#endif /* CONFIG_QE */
diff --git a/cpu/mpc83xx/spd_sdram.c b/cpu/mpc83xx/spd_sdram.c
deleted file mode 100644
index 0d93f2e1ea..0000000000
--- a/cpu/mpc83xx/spd_sdram.c
+++ /dev/null
@@ -1,620 +0,0 @@
-/*
- * (C) Copyright 2006 Freescale Semiconductor, Inc.
- *
- * (C) Copyright 2006
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * Copyright (C) 2004-2006 Freescale Semiconductor, Inc.
- * (C) Copyright 2003 Motorola Inc.
- * Xianghua Xiao (X.Xiao@motorola.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/processor.h>
-#include <i2c.h>
-#include <spd.h>
-#include <asm/mmu.h>
-#include <spd_sdram.h>
-
-#ifdef CONFIG_SPD_EEPROM
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
-extern void dma_init(void);
-extern uint dma_check(void);
-extern int dma_xfer(void *dest, uint count, void *src);
-#endif
-
-#ifndef CFG_READ_SPD
-#define CFG_READ_SPD i2c_read
-#endif
-
-/*
- * Convert picoseconds into clock cycles (rounding up if needed).
- */
-int
-picos_to_clk(int picos)
-{
- unsigned int ddr_bus_clk;
- int clks;
-
- ddr_bus_clk = gd->ddr_clk >> 1;
- clks = picos / ((1000000000 / ddr_bus_clk) * 1000);
- if (picos % ((1000000000 / ddr_bus_clk) * 1000) != 0)
- clks++;
-
- return clks;
-}
-
-unsigned int banksize(unsigned char row_dens)
-{
- return ((row_dens >> 2) | ((row_dens & 3) << 6)) << 24;
-}
-
-int read_spd(uint addr)
-{
- return ((int) addr);
-}
-
-#undef SPD_DEBUG
-#ifdef SPD_DEBUG
-static void spd_debug(spd_eeprom_t *spd)
-{
- printf ("\nDIMM type: %-18.18s\n", spd->mpart);
- printf ("SPD size: %d\n", spd->info_size);
- printf ("EEPROM size: %d\n", 1 << spd->chip_size);
- printf ("Memory type: %d\n", spd->mem_type);
- printf ("Row addr: %d\n", spd->nrow_addr);
- printf ("Column addr: %d\n", spd->ncol_addr);
- printf ("# of rows: %d\n", spd->nrows);
- printf ("Row density: %d\n", spd->row_dens);
- printf ("# of banks: %d\n", spd->nbanks);
- printf ("Data width: %d\n",
- 256 * spd->dataw_msb + spd->dataw_lsb);
- printf ("Chip width: %d\n", spd->primw);
- printf ("Refresh rate: %02X\n", spd->refresh);
- printf ("CAS latencies: %02X\n", spd->cas_lat);
- printf ("Write latencies: %02X\n", spd->write_lat);
- printf ("tRP: %d\n", spd->trp);
- printf ("tRCD: %d\n", spd->trcd);
- printf ("\n");
-}
-#endif /* SPD_DEBUG */
-
-long int spd_sdram()
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ddr83xx_t *ddr = &immap->ddr;
- volatile law83xx_t *ecm = &immap->sysconf.ddrlaw[0];
- spd_eeprom_t spd;
- unsigned int memsize;
- unsigned int law_size;
- unsigned char caslat, caslat_ctrl;
- unsigned char burstlen;
- unsigned int max_bus_clk;
- unsigned int max_data_rate, effective_data_rate;
- unsigned int ddrc_clk;
- unsigned int refresh_clk;
- unsigned sdram_cfg;
- unsigned int ddrc_ecc_enable;
-
- /* Read SPD parameters with I2C */
- CFG_READ_SPD(SPD_EEPROM_ADDRESS, 0, 1, (uchar *) & spd, sizeof (spd));
-#ifdef SPD_DEBUG
- spd_debug(&spd);
-#endif
- /* Check the memory type */
- if (spd.mem_type != SPD_MEMTYPE_DDR) {
- printf("DDR: Module mem type is %02X\n", spd.mem_type);
- return 0;
- }
-
- /* Check the number of physical bank */
- if (spd.nrows > 2) {
- printf("DDR: The number of physical bank is %02X\n", spd.nrows);
- return 0;
- }
-
- /* Check if the number of row of the module is in the range of DDRC */
- if (spd.nrow_addr < 12 || spd.nrow_addr > 14) {
- printf("DDR: Row number is out of range of DDRC, row=%02X\n",
- spd.nrow_addr);
- return 0;
- }
-
- /* Check if the number of col of the module is in the range of DDRC */
- if (spd.ncol_addr < 8 || spd.ncol_addr > 11) {
- printf("DDR: Col number is out of range of DDRC, col=%02X\n",
- spd.ncol_addr);
- return 0;
- }
- /* Setup DDR chip select register */
-#ifdef CFG_83XX_DDR_USES_CS0
- ddr->csbnds[0].csbnds = (banksize(spd.row_dens) >> 24) - 1;
- ddr->cs_config[0] = ( 1 << 31
- | (spd.nrow_addr - 12) << 8
- | (spd.ncol_addr - 8) );
- debug("\n");
- debug("cs0_bnds = 0x%08x\n",ddr->csbnds[0].csbnds);
- debug("cs0_config = 0x%08x\n",ddr->cs_config[0]);
-
- if (spd.nrows == 2) {
- ddr->csbnds[1].csbnds = ( (banksize(spd.row_dens) >> 8)
- | ((banksize(spd.row_dens) >> 23) - 1) );
- ddr->cs_config[1] = ( 1<<31
- | (spd.nrow_addr-12) << 8
- | (spd.ncol_addr-8) );
- debug("cs1_bnds = 0x%08x\n",ddr->csbnds[1].csbnds);
- debug("cs1_config = 0x%08x\n",ddr->cs_config[1]);
- }
-
-#else
- ddr->csbnds[2].csbnds = (banksize(spd.row_dens) >> 24) - 1;
- ddr->cs_config[2] = ( 1 << 31
- | (spd.nrow_addr - 12) << 8
- | (spd.ncol_addr - 8) );
- debug("\n");
- debug("cs2_bnds = 0x%08x\n",ddr->csbnds[2].csbnds);
- debug("cs2_config = 0x%08x\n",ddr->cs_config[2]);
-
- if (spd.nrows == 2) {
- ddr->csbnds[3].csbnds = ( (banksize(spd.row_dens) >> 8)
- | ((banksize(spd.row_dens) >> 23) - 1) );
- ddr->cs_config[3] = ( 1<<31
- | (spd.nrow_addr-12) << 8
- | (spd.ncol_addr-8) );
- debug("cs3_bnds = 0x%08x\n",ddr->csbnds[3].csbnds);
- debug("cs3_config = 0x%08x\n",ddr->cs_config[3]);
- }
-#endif
-
- if (spd.mem_type != 0x07) {
- puts("No DDR module found!\n");
- return 0;
- }
-
- /*
- * Figure out memory size in Megabytes.
- */
- memsize = spd.nrows * banksize(spd.row_dens) / 0x100000;
-
- /*
- * First supported LAW size is 16M, at LAWAR_SIZE_16M == 23.
- */
- law_size = 19 + __ilog2(memsize);
-
- /*
- * Set up LAWBAR for all of DDR.
- */
- ecm->bar = ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff);
- ecm->ar = (LAWAR_EN | LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & law_size));
- debug("DDR:bar=0x%08x\n", ecm->bar);
- debug("DDR:ar=0x%08x\n", ecm->ar);
-
- /*
- * Find the largest CAS by locating the highest 1 bit
- * in the spd.cas_lat field. Translate it to a DDR
- * controller field value:
- *
- * CAS Lat DDR I Ctrl
- * Clocks SPD Bit Value
- * -------+--------+---------
- * 1.0 0 001
- * 1.5 1 010
- * 2.0 2 011
- * 2.5 3 100
- * 3.0 4 101
- * 3.5 5 110
- * 4.0 6 111
- */
- caslat = __ilog2(spd.cas_lat);
-
- if (caslat > 6 ) {
- printf("DDR: Invalid SPD CAS Latency, caslat=%02X\n",
- spd.cas_lat);
- return 0;
- }
- max_bus_clk = 1000 *10 / (((spd.clk_cycle & 0xF0) >> 4) * 10
- + (spd.clk_cycle & 0x0f));
- max_data_rate = max_bus_clk * 2;
-
- debug("DDR:Module maximum data rate is: %dMhz\n", max_data_rate);
-
- ddrc_clk = gd->ddr_clk / 1000000;
-
- if (max_data_rate >= 390) { /* it is DDR 400 */
- if (ddrc_clk <= 410 && ddrc_clk > 350) {
- /* DDR controller clk at 350~410 */
- effective_data_rate = 400; /* 5ns */
- caslat = caslat;
- } else if (ddrc_clk <= 350 && ddrc_clk > 280) {
- /* DDR controller clk at 280~350 */
- effective_data_rate = 333; /* 6ns */
- if (spd.clk_cycle2 == 0x60)
- caslat = caslat - 1;
- else
- caslat = caslat;
- } else if (ddrc_clk <= 280 && ddrc_clk > 230) {
- /* DDR controller clk at 230~280 */
- effective_data_rate = 266; /* 7.5ns */
- if (spd.clk_cycle3 == 0x75)
- caslat = caslat - 2;
- else if (spd.clk_cycle2 == 0x60)
- caslat = caslat - 1;
- else
- caslat = caslat;
- } else if (ddrc_clk <= 230 && ddrc_clk > 90) {
- /* DDR controller clk at 90~230 */
- effective_data_rate = 200; /* 10ns */
- if (spd.clk_cycle3 == 0x75)
- caslat = caslat - 2;
- else if (spd.clk_cycle2 == 0x60)
- caslat = caslat - 1;
- else
- caslat = caslat;
- }
- } else if (max_data_rate >= 323) { /* it is DDR 333 */
- if (ddrc_clk <= 350 && ddrc_clk > 280) {
- /* DDR controller clk at 280~350 */
- effective_data_rate = 333; /* 6ns */
- caslat = caslat;
- } else if (ddrc_clk <= 280 && ddrc_clk > 230) {
- /* DDR controller clk at 230~280 */
- effective_data_rate = 266; /* 7.5ns */
- if (spd.clk_cycle2 == 0x75)
- caslat = caslat - 1;
- else
- caslat = caslat;
- } else if (ddrc_clk <= 230 && ddrc_clk > 90) {
- /* DDR controller clk at 90~230 */
- effective_data_rate = 200; /* 10ns */
- if (spd.clk_cycle3 == 0xa0)
- caslat = caslat - 2;
- else if (spd.clk_cycle2 == 0x75)
- caslat = caslat - 1;
- else
- caslat = caslat;
- }
- } else if (max_data_rate >= 256) { /* it is DDR 266 */
- if (ddrc_clk <= 350 && ddrc_clk > 280) {
- /* DDR controller clk at 280~350 */
- printf("DDR: DDR controller freq is more than "
- "max data rate of the module\n");
- return 0;
- } else if (ddrc_clk <= 280 && ddrc_clk > 230) {
- /* DDR controller clk at 230~280 */
- effective_data_rate = 266; /* 7.5ns */
- caslat = caslat;
- } else if (ddrc_clk <= 230 && ddrc_clk > 90) {
- /* DDR controller clk at 90~230 */
- effective_data_rate = 200; /* 10ns */
- if (spd.clk_cycle2 == 0xa0)
- caslat = caslat - 1;
- }
- } else if (max_data_rate >= 190) { /* it is DDR 200 */
- if (ddrc_clk <= 350 && ddrc_clk > 230) {
- /* DDR controller clk at 230~350 */
- printf("DDR: DDR controller freq is more than "
- "max data rate of the module\n");
- return 0;
- } else if (ddrc_clk <= 230 && ddrc_clk > 90) {
- /* DDR controller clk at 90~230 */
- effective_data_rate = 200; /* 10ns */
- caslat = caslat;
- }
- }
-
- debug("DDR:Effective data rate is: %dMhz\n", effective_data_rate);
- debug("DDR:The MSB 1 of CAS Latency is: %d\n", caslat);
-
- /*
- * Errata DDR6 work around: input enable 2 cycles earlier.
- * including MPC834x Rev1.0/1.1 and MPC8360 Rev1.1/1.2.
- */
- if (caslat == 2)
- ddr->debug_reg = 0x201c0000; /* CL=2 */
- else if (caslat == 3)
- ddr->debug_reg = 0x202c0000; /* CL=2.5 */
- else if (caslat == 4)
- ddr->debug_reg = 0x202c0000; /* CL=3.0 */
-
- __asm__ __volatile__ ("sync");
-
- debug("Errata DDR6 (debug_reg=0x%08x)\n", ddr->debug_reg);
-
- /*
- * note: caslat must also be programmed into ddr->sdram_mode
- * register.
- *
- * note: WRREC(Twr) and WRTORD(Twtr) are not in SPD,
- * use conservative value here.
- */
- caslat_ctrl = (caslat + 1) & 0x07; /* see as above */
-
- ddr->timing_cfg_1 =
- (((picos_to_clk(spd.trp * 250) & 0x07) << 28 ) |
- ((picos_to_clk(spd.tras * 1000) & 0x0f ) << 24 ) |
- ((picos_to_clk(spd.trcd * 250) & 0x07) << 20 ) |
- ((caslat_ctrl & 0x07) << 16 ) |
- (((picos_to_clk(spd.trfc * 1000) - 8) & 0x0f) << 12 ) |
- ( 0x300 ) |
- ((picos_to_clk(spd.trrd * 250) & 0x07) << 4) | 1);
-
- ddr->timing_cfg_2 = 0x00000800;
-
- debug("DDR:timing_cfg_1=0x%08x\n", ddr->timing_cfg_1);
- debug("DDR:timing_cfg_2=0x%08x\n", ddr->timing_cfg_2);
- /* Setup init value, but not enable */
- ddr->sdram_cfg = 0x42000000;
-
- /* Check DIMM data bus width */
- if (spd.dataw_lsb == 0x20) {
- burstlen = 0x03; /* 32 bit data bus, burst len is 8 */
- printf("\n DDR DIMM: data bus width is 32 bit");
- } else {
- burstlen = 0x02; /* Others act as 64 bit bus, burst len is 4 */
- printf("\n DDR DIMM: data bus width is 64 bit");
- }
-
- /* Is this an ECC DDR chip? */
- if (spd.config == 0x02)
- printf(" with ECC\n");
- else
- printf(" without ECC\n");
-
- /* Burst length is always 4 for 64 bit data bus, 8 for 32 bit data bus,
- Burst type is sequential
- */
- switch (caslat) {
- case 1:
- ddr->sdram_mode = 0x50 | burstlen; /* CL=1.5 */
- break;
- case 2:
- ddr->sdram_mode = 0x20 | burstlen; /* CL=2.0 */
- break;
- case 3:
- ddr->sdram_mode = 0x60 | burstlen; /* CL=2.5 */
- break;
- case 4:
- ddr->sdram_mode = 0x30 | burstlen; /* CL=3.0 */
- break;
- default:
- printf("DDR:only CL 1.5, 2.0, 2.5, 3.0 is supported\n");
- return 0;
- }
- debug("DDR:sdram_mode=0x%08x\n", ddr->sdram_mode);
-
- switch (spd.refresh) {
- case 0x00:
- case 0x80:
- refresh_clk = picos_to_clk(15625000);
- break;
- case 0x01:
- case 0x81:
- refresh_clk = picos_to_clk(3900000);
- break;
- case 0x02:
- case 0x82:
- refresh_clk = picos_to_clk(7800000);
- break;
- case 0x03:
- case 0x83:
- refresh_clk = picos_to_clk(31300000);
- break;
- case 0x04:
- case 0x84:
- refresh_clk = picos_to_clk(62500000);
- break;
- case 0x05:
- case 0x85:
- refresh_clk = picos_to_clk(125000000);
- break;
- default:
- refresh_clk = 0x512;
- break;
- }
-
- /*
- * Set BSTOPRE to 0x100 for page mode
- * If auto-charge is used, set BSTOPRE = 0
- */
- ddr->sdram_interval = ((refresh_clk & 0x3fff) << 16) | 0x100;
- debug("DDR:sdram_interval=0x%08x\n", ddr->sdram_interval);
-
- /* SS_EN = 0, source synchronous disable
- * CLK_ADJST = 0, MCK/MCK# is launched aligned with addr/cmd
- */
- ddr->sdram_clk_cntl = 0x00000000;
- debug("DDR:sdram_clk_cntl=0x%08x\n", ddr->sdram_clk_cntl);
-
- asm("sync;isync");
-
- udelay(600);
-
- /*
- * Figure out the settings for the sdram_cfg register. Build up
- * the value in 'sdram_cfg' before writing since the write into
- * the register will actually enable the memory controller, and all
- * settings must be done before enabling.
- *
- * sdram_cfg[0] = 1 (ddr sdram logic enable)
- * sdram_cfg[1] = 1 (self-refresh-enable)
- * sdram_cfg[6:7] = 2 (SDRAM type = DDR SDRAM)
- * sdram_cfg[12] = 0 (32_BE =0 , 64 bit bus mode)
- * sdram_cfg[13] = 0 (8_BE =0, 4-beat bursts)
- */
- sdram_cfg = 0xC2000000;
-
- /* sdram_cfg[3] = RD_EN - registered DIMM enable */
- if (spd.mod_attr & 0x02)
- sdram_cfg |= 0x10000000;
-
- /* The DIMM is 32bit width */
- if (spd.dataw_lsb == 0x20)
- sdram_cfg |= 0x000C0000;
-
- ddrc_ecc_enable = 0;
-
-#if defined(CONFIG_DDR_ECC)
- /* Enable ECC with sdram_cfg[2] */
- if (spd.config == 0x02) {
- sdram_cfg |= 0x20000000;
- ddrc_ecc_enable = 1;
- /* disable error detection */
- ddr->err_disable = ~ECC_ERROR_ENABLE;
- /* set single bit error threshold to maximum value,
- * reset counter to zero */
- ddr->err_sbe = (255 << ECC_ERROR_MAN_SBET_SHIFT) |
- (0 << ECC_ERROR_MAN_SBEC_SHIFT);
- }
-
- debug("DDR:err_disable=0x%08x\n", ddr->err_disable);
- debug("DDR:err_sbe=0x%08x\n", ddr->err_sbe);
-#endif
- printf(" DDRC ECC mode: %s\n", ddrc_ecc_enable ? "ON":"OFF");
-
-#if defined(CONFIG_DDR_2T_TIMING)
- /*
- * Enable 2T timing by setting sdram_cfg[16].
- */
- sdram_cfg |= SDRAM_CFG_2T_EN;
-#endif
- /* Enable controller, and GO! */
- ddr->sdram_cfg = sdram_cfg;
- asm("sync;isync");
- udelay(500);
-
- debug("DDR:sdram_cfg=0x%08x\n", ddr->sdram_cfg);
- return memsize; /*in MBytes*/
-}
-#endif /* CONFIG_SPD_EEPROM */
-
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
-/*
- * Use timebase counter, get_timer() is not availabe
- * at this point of initialization yet.
- */
-static __inline__ unsigned long get_tbms (void)
-{
- unsigned long tbl;
- unsigned long tbu1, tbu2;
- unsigned long ms;
- unsigned long long tmp;
-
- ulong tbclk = get_tbclk();
-
- /* get the timebase ticks */
- do {
- asm volatile ("mftbu %0":"=r" (tbu1):);
- asm volatile ("mftb %0":"=r" (tbl):);
- asm volatile ("mftbu %0":"=r" (tbu2):);
- } while (tbu1 != tbu2);
-
- /* convert ticks to ms */
- tmp = (unsigned long long)(tbu1);
- tmp = (tmp << 32);
- tmp += (unsigned long long)(tbl);
- ms = tmp/(tbclk/1000);
-
- return ms;
-}
-
-/*
- * Initialize all of memory for ECC, then enable errors.
- */
-/* #define CONFIG_DDR_ECC_INIT_VIA_DMA */
-void ddr_enable_ecc(unsigned int dram_size)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ddr83xx_t *ddr= &immap->ddr;
- unsigned long t_start, t_end;
- register u64 *p;
- register uint size;
- unsigned int pattern[2];
-#if defined(CONFIG_DDR_ECC_INIT_VIA_DMA)
- uint i;
-#endif
- icache_enable();
- t_start = get_tbms();
- pattern[0] = 0xdeadbeef;
- pattern[1] = 0xdeadbeef;
-
-#if !defined(CONFIG_DDR_ECC_INIT_VIA_DMA)
- debug("ddr init: CPU FP write method\n");
- size = dram_size;
- for (p = 0; p < (u64*)(size); p++) {
- ppcDWstore((u32*)p, pattern);
- }
- __asm__ __volatile__ ("sync");
-#else
- debug("ddr init: DMA method\n");
- size = 0x2000;
- for (p = 0; p < (u64*)(size); p++) {
- ppcDWstore((u32*)p, pattern);
- }
- __asm__ __volatile__ ("sync");
-
- /* Initialise DMA for direct transfer */
- dma_init();
- /* Start DMA to transfer */
- dma_xfer((uint *)0x2000, 0x2000, (uint *)0); /* 8K */
- dma_xfer((uint *)0x4000, 0x4000, (uint *)0); /* 16K */
- dma_xfer((uint *)0x8000, 0x8000, (uint *)0); /* 32K */
- dma_xfer((uint *)0x10000, 0x10000, (uint *)0); /* 64K */
- dma_xfer((uint *)0x20000, 0x20000, (uint *)0); /* 128K */
- dma_xfer((uint *)0x40000, 0x40000, (uint *)0); /* 256K */
- dma_xfer((uint *)0x80000, 0x80000, (uint *)0); /* 512K */
- dma_xfer((uint *)0x100000, 0x100000, (uint *)0); /* 1M */
- dma_xfer((uint *)0x200000, 0x200000, (uint *)0); /* 2M */
- dma_xfer((uint *)0x400000, 0x400000, (uint *)0); /* 4M */
-
- for (i = 1; i < dram_size / 0x800000; i++) {
- dma_xfer((uint *)(0x800000*i), 0x800000, (uint *)0);
- }
-#endif
-
- t_end = get_tbms();
- icache_disable();
-
- debug("\nREADY!!\n");
- debug("ddr init duration: %ld ms\n", t_end - t_start);
-
- /* Clear All ECC Errors */
- if ((ddr->err_detect & ECC_ERROR_DETECT_MME) == ECC_ERROR_DETECT_MME)
- ddr->err_detect |= ECC_ERROR_DETECT_MME;
- if ((ddr->err_detect & ECC_ERROR_DETECT_MBE) == ECC_ERROR_DETECT_MBE)
- ddr->err_detect |= ECC_ERROR_DETECT_MBE;
- if ((ddr->err_detect & ECC_ERROR_DETECT_SBE) == ECC_ERROR_DETECT_SBE)
- ddr->err_detect |= ECC_ERROR_DETECT_SBE;
- if ((ddr->err_detect & ECC_ERROR_DETECT_MSE) == ECC_ERROR_DETECT_MSE)
- ddr->err_detect |= ECC_ERROR_DETECT_MSE;
-
- /* Disable ECC-Interrupts */
- ddr->err_int_en &= ECC_ERR_INT_DISABLE;
-
- /* Enable errors for ECC */
- ddr->err_disable &= ECC_ERROR_ENABLE;
-
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("isync");
-}
-#endif /* CONFIG_DDR_ECC */
diff --git a/cpu/mpc83xx/speed.c b/cpu/mpc83xx/speed.c
deleted file mode 100644
index 7e53b1e606..0000000000
--- a/cpu/mpc83xx/speed.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * Copyright (C) 2004-2006 Freescale Semiconductor, Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc83xx.h>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/* ----------------------------------------------------------------- */
-
-typedef enum {
- _unk,
- _off,
- _byp,
- _x8,
- _x4,
- _x2,
- _x1,
- _1x,
- _1_5x,
- _2x,
- _2_5x,
- _3x
-} mult_t;
-
-typedef struct {
- mult_t core_csb_ratio;
- mult_t vco_divider;
-} corecnf_t;
-
-corecnf_t corecnf_tab[] = {
- {_byp, _byp}, /* 0x00 */
- {_byp, _byp}, /* 0x01 */
- {_byp, _byp}, /* 0x02 */
- {_byp, _byp}, /* 0x03 */
- {_byp, _byp}, /* 0x04 */
- {_byp, _byp}, /* 0x05 */
- {_byp, _byp}, /* 0x06 */
- {_byp, _byp}, /* 0x07 */
- {_1x, _x2}, /* 0x08 */
- {_1x, _x4}, /* 0x09 */
- {_1x, _x8}, /* 0x0A */
- {_1x, _x8}, /* 0x0B */
- {_1_5x, _x2}, /* 0x0C */
- {_1_5x, _x4}, /* 0x0D */
- {_1_5x, _x8}, /* 0x0E */
- {_1_5x, _x8}, /* 0x0F */
- {_2x, _x2}, /* 0x10 */
- {_2x, _x4}, /* 0x11 */
- {_2x, _x8}, /* 0x12 */
- {_2x, _x8}, /* 0x13 */
- {_2_5x, _x2}, /* 0x14 */
- {_2_5x, _x4}, /* 0x15 */
- {_2_5x, _x8}, /* 0x16 */
- {_2_5x, _x8}, /* 0x17 */
- {_3x, _x2}, /* 0x18 */
- {_3x, _x4}, /* 0x19 */
- {_3x, _x8}, /* 0x1A */
- {_3x, _x8}, /* 0x1B */
-};
-
-/* ----------------------------------------------------------------- */
-
-/*
- *
- */
-int get_clocks(void)
-{
- volatile immap_t *im = (immap_t *) CFG_IMMR;
- u32 pci_sync_in;
- u8 spmf;
- u8 clkin_div;
- u32 sccr;
- u32 corecnf_tab_index;
- u8 corepll;
- u32 lcrr;
-
- u32 csb_clk;
-#if defined(CONFIG_MPC8349)
- u32 tsec1_clk;
- u32 tsec2_clk;
- u32 usbmph_clk;
- u32 usbdr_clk;
-#endif
- u32 core_clk;
- u32 i2c1_clk;
- u32 i2c2_clk;
- u32 enc_clk;
- u32 lbiu_clk;
- u32 lclk_clk;
- u32 ddr_clk;
-#if defined (CONFIG_MPC8360)
- u32 qepmf;
- u32 qepdf;
- u32 ddr_sec_clk;
- u32 qe_clk;
- u32 brg_clk;
-#endif
-
- if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
- return -1;
-
- clkin_div = ((im->clk.spmr & SPMR_CKID) >> SPMR_CKID_SHIFT);
-
- if (im->reset.rcwh & HRCWH_PCI_HOST) {
-#if defined(CONFIG_83XX_CLKIN)
- pci_sync_in = CONFIG_83XX_CLKIN / (1 + clkin_div);
-#else
- pci_sync_in = 0xDEADBEEF;
-#endif
- } else {
-#if defined(CONFIG_83XX_PCICLK)
- pci_sync_in = CONFIG_83XX_PCICLK;
-#else
- pci_sync_in = 0xDEADBEEF;
-#endif
- }
-
- spmf = ((im->reset.rcwl & RCWL_SPMF) >> RCWL_SPMF_SHIFT);
- csb_clk = pci_sync_in * (1 + clkin_div) * spmf;
-
- sccr = im->clk.sccr;
-
-#if defined(CONFIG_MPC8349)
- switch ((sccr & SCCR_TSEC1CM) >> SCCR_TSEC1CM_SHIFT) {
- case 0:
- tsec1_clk = 0;
- break;
- case 1:
- tsec1_clk = csb_clk;
- break;
- case 2:
- tsec1_clk = csb_clk / 2;
- break;
- case 3:
- tsec1_clk = csb_clk / 3;
- break;
- default:
- /* unkown SCCR_TSEC1CM value */
- return -4;
- }
-
- switch ((sccr & SCCR_TSEC2CM) >> SCCR_TSEC2CM_SHIFT) {
- case 0:
- tsec2_clk = 0;
- break;
- case 1:
- tsec2_clk = csb_clk;
- break;
- case 2:
- tsec2_clk = csb_clk / 2;
- break;
- case 3:
- tsec2_clk = csb_clk / 3;
- break;
- default:
- /* unkown SCCR_TSEC2CM value */
- return -5;
- }
-
- i2c1_clk = tsec2_clk;
-
- switch ((sccr & SCCR_USBMPHCM) >> SCCR_USBMPHCM_SHIFT) {
- case 0:
- usbmph_clk = 0;
- break;
- case 1:
- usbmph_clk = csb_clk;
- break;
- case 2:
- usbmph_clk = csb_clk / 2;
- break;
- case 3:
- usbmph_clk = csb_clk / 3;
- break;
- default:
- /* unkown SCCR_USBMPHCM value */
- return -7;
- }
-
- switch ((sccr & SCCR_USBDRCM) >> SCCR_USBDRCM_SHIFT) {
- case 0:
- usbdr_clk = 0;
- break;
- case 1:
- usbdr_clk = csb_clk;
- break;
- case 2:
- usbdr_clk = csb_clk / 2;
- break;
- case 3:
- usbdr_clk = csb_clk / 3;
- break;
- default:
- /* unkown SCCR_USBDRCM value */
- return -8;
- }
-
- if (usbmph_clk != 0 && usbdr_clk != 0 && usbmph_clk != usbdr_clk) {
- /* if USB MPH clock is not disabled and
- * USB DR clock is not disabled then
- * USB MPH & USB DR must have the same rate
- */
- return -9;
- }
-#endif
-#if defined (CONFIG_MPC8360)
- i2c1_clk = csb_clk;
-#endif
- i2c2_clk = csb_clk; /* i2c-2 clk is equal to csb clk */
-
- switch ((sccr & SCCR_ENCCM) >> SCCR_ENCCM_SHIFT) {
- case 0:
- enc_clk = 0;
- break;
- case 1:
- enc_clk = csb_clk;
- break;
- case 2:
- enc_clk = csb_clk / 2;
- break;
- case 3:
- enc_clk = csb_clk / 3;
- break;
- default:
- /* unkown SCCR_ENCCM value */
- return -6;
- }
-#if defined(CONFIG_MPC8349) || defined(CONFIG_MPC8360)
- lbiu_clk = csb_clk *
- (1 + ((im->reset.rcwl & RCWL_LBIUCM) >> RCWL_LBIUCM_SHIFT));
-#else
-#error Unknown MPC83xx chip
-#endif
- lcrr = (im->lbus.lcrr & LCRR_CLKDIV) >> LCRR_CLKDIV_SHIFT;
- switch (lcrr) {
- case 2:
- case 4:
- case 8:
- lclk_clk = lbiu_clk / lcrr;
- break;
- default:
- /* unknown lcrr */
- return -10;
- }
-#if defined(CONFIG_MPC8349) || defined(CONFIG_MPC8360)
- ddr_clk = csb_clk *
- (1 + ((im->reset.rcwl & RCWL_DDRCM) >> RCWL_DDRCM_SHIFT));
- corepll = (im->reset.rcwl & RCWL_COREPLL) >> RCWL_COREPLL_SHIFT;
-#if defined (CONFIG_MPC8360)
- ddr_sec_clk = csb_clk * (1 +
- ((im->reset.rcwl & RCWL_LBIUCM) >> RCWL_LBIUCM_SHIFT));
-#endif
-#else
-#error Unknown MPC83xx chip
-#endif
-
- corecnf_tab_index = ((corepll & 0x1F) << 2) | ((corepll & 0x60) >> 5);
- if (corecnf_tab_index > (sizeof(corecnf_tab) / sizeof(corecnf_t))) {
- /* corecnf_tab_index is too high, possibly worng value */
- return -11;
- }
- switch (corecnf_tab[corecnf_tab_index].core_csb_ratio) {
- case _byp:
- case _x1:
- case _1x:
- core_clk = csb_clk;
- break;
- case _1_5x:
- core_clk = (3 * csb_clk) / 2;
- break;
- case _2x:
- core_clk = 2 * csb_clk;
- break;
- case _2_5x:
- core_clk = (5 * csb_clk) / 2;
- break;
- case _3x:
- core_clk = 3 * csb_clk;
- break;
- default:
- /* unkown core to csb ratio */
- return -12;
- }
-
-#if defined (CONFIG_MPC8360)
- qepmf = (im->reset.rcwl & RCWL_CEPMF) >> RCWL_CEPMF_SHIFT;
- qepdf = (im->reset.rcwl & RCWL_CEPDF) >> RCWL_CEPDF_SHIFT;
- qe_clk = (pci_sync_in * qepmf) / (1 + qepdf);
- brg_clk = qe_clk / 2;
-#endif
-
- gd->csb_clk = csb_clk;
-#if defined(CONFIG_MPC8349)
- gd->tsec1_clk = tsec1_clk;
- gd->tsec2_clk = tsec2_clk;
- gd->usbmph_clk = usbmph_clk;
- gd->usbdr_clk = usbdr_clk;
-#endif
- gd->core_clk = core_clk;
- gd->i2c1_clk = i2c1_clk;
- gd->i2c2_clk = i2c2_clk;
- gd->enc_clk = enc_clk;
- gd->lbiu_clk = lbiu_clk;
- gd->lclk_clk = lclk_clk;
- gd->ddr_clk = ddr_clk;
-#if defined (CONFIG_MPC8360)
- gd->ddr_sec_clk = ddr_sec_clk;
- gd->qe_clk = qe_clk;
- gd->brg_clk = brg_clk;
-#endif
- gd->cpu_clk = gd->core_clk;
- gd->bus_clk = gd->csb_clk;
- return 0;
-
-}
-
-/********************************************
- * get_bus_freq
- * return system bus freq in Hz
- *********************************************/
-ulong get_bus_freq(ulong dummy)
-{
- return gd->csb_clk;
-}
-
-int print_clock_conf(void)
-{
- printf("Clock configuration:\n");
- printf(" Coherent System Bus: %4d MHz\n", gd->csb_clk / 1000000);
- printf(" Core: %4d MHz\n", gd->core_clk / 1000000);
-#if defined (CONFIG_MPC8360)
- printf(" QE: %4d MHz\n", gd->qe_clk / 1000000);
-#endif
- printf(" Local Bus Controller:%4d MHz\n", gd->lbiu_clk / 1000000);
- printf(" Local Bus: %4d MHz\n", gd->lclk_clk / 1000000);
- printf(" DDR: %4d MHz\n", gd->ddr_clk / 1000000);
-#if defined (CONFIG_MPC8360)
- printf(" DDR Secondary: %4d MHz\n", gd->ddr_sec_clk / 1000000);
-#endif
- printf(" SEC: %4d MHz\n", gd->enc_clk / 1000000);
- printf(" I2C1: %4d MHz\n", gd->i2c1_clk / 1000000);
- printf(" I2C2: %4d MHz\n", gd->i2c2_clk / 1000000);
-#if defined(CONFIG_MPC8349)
- printf(" TSEC1: %4d MHz\n", gd->tsec1_clk / 1000000);
- printf(" TSEC2: %4d MHz\n", gd->tsec2_clk / 1000000);
- printf(" USB MPH: %4d MHz\n", gd->usbmph_clk / 1000000);
- printf(" USB DR: %4d MHz\n", gd->usbdr_clk / 1000000);
-#endif
- return 0;
-}
diff --git a/cpu/mpc83xx/start.S b/cpu/mpc83xx/start.S
deleted file mode 100644
index a6ceb7bf7b..0000000000
--- a/cpu/mpc83xx/start.S
+++ /dev/null
@@ -1,1274 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2000, 2001,2002 Wolfgang Denk <wd@denx.de>
- * Copyright Freescale Semiconductor, Inc. 2004, 2006. All rights reserved.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * U-Boot - Startup Code for MPC83xx PowerPC based Embedded Boards
- */
-
-#include <config.h>
-#include <mpc83xx.h>
-#include <version.h>
-
-#define CONFIG_83XX 1 /* needed for Linux kernel header files*/
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING "MPC83XX"
-#endif
-
-/* We don't want the MMU yet.
- */
-#undef MSR_KERNEL
-
-/*
- * Floating Point enable, Machine Check and Recoverable Interr.
- */
-#ifdef DEBUG
-#define MSR_KERNEL (MSR_FP|MSR_RI)
-#else
-#define MSR_KERNEL (MSR_FP|MSR_ME|MSR_RI)
-#endif
-
-/*
- * Set up GOT: Global Offset Table
- *
- * Use r14 to access the GOT
- */
- START_GOT
- GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_FIXUP_TABLE_)
-
- GOT_ENTRY(_start)
- GOT_ENTRY(_start_of_vectors)
- GOT_ENTRY(_end_of_vectors)
- GOT_ENTRY(transfer_to_handler)
-
- GOT_ENTRY(__init_end)
- GOT_ENTRY(_end)
- GOT_ENTRY(__bss_start)
- END_GOT
-
-/*
- * Version string - must be in data segment because MPC83xx uses the
- * first 256 bytes for the Hard Reset Configuration Word table (see
- * below). Similarly, can't have the U-Boot Magic Number as the first
- * thing in the image - don't know how this will affect the image tools,
- * but I guess I'll find out soon.
- */
- .data
- .globl version_string
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii " ", CONFIG_IDENT_STRING, "\0"
-
- .text
-#define _HRCW_TABLE_ENTRY(w) \
- .fill 8,1,(((w)>>24)&0xff); \
- .fill 8,1,(((w)>>16)&0xff); \
- .fill 8,1,(((w)>> 8)&0xff); \
- .fill 8,1,(((w) )&0xff)
-
- _HRCW_TABLE_ENTRY(CFG_HRCW_LOW)
- _HRCW_TABLE_ENTRY(CFG_HRCW_HIGH)
-
-
-#ifndef CONFIG_DEFAULT_IMMR
-#error CONFIG_DEFAULT_IMMR must be defined
-#endif /* CFG_DEFAULT_IMMR */
-#ifndef CFG_IMMR
-#define CFG_IMMR CONFIG_DEFAULT_IMMR
-#endif /* CFG_IMMR */
-
-/*
- * After configuration, a system reset exception is executed using the
- * vector at offset 0x100 relative to the base set by MSR[IP]. If
- * MSR[IP] is 0, the base address is 0x00000000. If MSR[IP] is 1, the
- * base address is 0xfff00000. In the case of a Power On Reset or Hard
- * Reset, the value of MSR[IP] is determined by the CIP field in the
- * HRCW.
- *
- * Other bits in the HRCW set up the Base Address and Port Size in BR0.
- * This determines the location of the boot ROM (flash or EPROM) in the
- * processor's address space at boot time. As long as the HRCW is set up
- * so that we eventually end up executing the code below when the
- * processor executes the reset exception, the actual values used should
- * not matter.
- *
- * Once we have got here, the address mask in OR0 is cleared so that the
- * bottom 32K of the boot ROM is effectively repeated all throughout the
- * processor's address space, after which we can jump to the absolute
- * address at which the boot ROM was linked at compile time, and proceed
- * to initialise the memory controller without worrying if the rug will
- * be pulled out from under us, so to speak (it will be fine as long as
- * we configure BR0 with the same boot ROM link address).
- */
- . = EXC_OFF_SYS_RESET
-
- .globl _start
-_start: /* time t 0 */
- li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH*/
- nop
- b boot_cold
-
- . = EXC_OFF_SYS_RESET + 0x10
-
- .globl _start_warm
-_start_warm:
- li r21, BOOTFLAG_WARM /* Software reboot */
- b boot_warm
-
-
-boot_cold: /* time t 3 */
- lis r4, CONFIG_DEFAULT_IMMR@h
- nop
-boot_warm: /* time t 5 */
- mfmsr r5 /* save msr contents */
- lis r3, CFG_IMMR@h
- ori r3, r3, CFG_IMMR@l
- stw r3, IMMRBAR(r4)
-
- /* Initialise the E300 processor core */
- /*------------------------------------------*/
-
- bl init_e300_core
-
-#ifndef CFG_RAMBOOT
-
- /* Inflate flash location so it appears everywhere, calculate */
- /* the absolute address in final location of the FLASH, jump */
- /* there and deflate the flash size back to minimal size */
- /*------------------------------------------------------------*/
- bl map_flash_by_law1
- lis r4, (CFG_MONITOR_BASE)@h
- ori r4, r4, (CFG_MONITOR_BASE)@l
- addi r5, r4, in_flash - _start + EXC_OFF_SYS_RESET
- mtlr r5
- blr
-in_flash:
- bl remap_flash_by_law0
-#endif /* CFG_RAMBOOT */
-
- /* setup the bats */
- bl setup_bats
- sync
-
- /*
- * Cache must be enabled here for stack-in-cache trick.
- * This means we need to enable the BATS.
- * This means:
- * 1) for the EVB, original gt regs need to be mapped
- * 2) need to have an IBAT for the 0xf region,
- * we are running there!
- * Cache should be turned on after BATs, since by default
- * everything is write-through.
- * The init-mem BAT can be reused after reloc. The old
- * gt-regs BAT can be reused after board_init_f calls
- * board_early_init_f (EVB only).
- */
- /* enable address translation */
- bl enable_addr_trans
- sync
-
- /* enable and invalidate the data cache */
- bl dcache_enable
- sync
-#ifdef CFG_INIT_RAM_LOCK
- bl lock_ram_in_cache
- sync
-#endif
-
- /* set up the stack pointer in our newly created
- * cache-ram (r1) */
- lis r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@h
- ori r1, r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@l
-
- li r0, 0 /* Make room for stack frame header and */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
-
-
- /* let the C-code set up the rest */
- /* */
- /* Be careful to keep code relocatable & stack humble */
- /*------------------------------------------------------*/
-
- GET_GOT /* initialize GOT access */
-
- /* r3: IMMR */
- lis r3, CFG_IMMR@h
- /* run low-level CPU init code (in Flash)*/
- bl cpu_init_f
-
- /* r3: BOOTFLAG */
- mr r3, r21
- /* run 1st part of board init code (in Flash)*/
- bl board_init_f
-
-/*
- * Vector Table
- */
-
- .globl _start_of_vectors
-_start_of_vectors:
-
-/* Machine check */
- STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. */
- STD_EXCEPTION(0x300, DataStorage, UnknownException)
-
-/* Instruction Storage exception. */
- STD_EXCEPTION(0x400, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
-#ifndef FIXME
- STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
-#endif
-
-/* Alignment exception. */
- . = 0x600
-Alignment:
- EXCEPTION_PROLOG
- mfspr r4,DAR
- stw r4,_DAR(r21)
- mfspr r5,DSISR
- stw r5,_DSISR(r21)
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- rlwimi r20,r23,0,25,25 /* copy IP bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_Alignment:
- .long AlignmentException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
- . = 0x700
-ProgramCheck:
- EXCEPTION_PROLOG
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- rlwimi r20,r23,0,25,25 /* copy IP bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_ProgramCheck:
- .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
- STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
-
- /* I guess we could implement decrementer, and may have
- * to someday for timekeeping.
- */
- STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
-
- STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
- STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
- STD_EXCEPTION(0xc00, SystemCall, UnknownException)
- STD_EXCEPTION(0xd00, SingleStep, UnknownException)
-
- STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
- STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
-
- STD_EXCEPTION(0x1000, InstructionTLBMiss, UnknownException)
- STD_EXCEPTION(0x1100, DataLoadTLBMiss, UnknownException)
- STD_EXCEPTION(0x1200, DataStoreTLBMiss, UnknownException)
-#ifdef DEBUG
- . = 0x1300
- /*
- * This exception occurs when the program counter matches the
- * Instruction Address Breakpoint Register (IABR).
- *
- * I want the cpu to halt if this occurs so I can hunt around
- * with the debugger and look at things.
- *
- * When DEBUG is defined, both machine check enable (in the MSR)
- * and checkstop reset enable (in the reset mode register) are
- * turned off and so a checkstop condition will result in the cpu
- * halting.
- *
- * I force the cpu into a checkstop condition by putting an illegal
- * instruction here (at least this is the theory).
- *
- * well - that didnt work, so just do an infinite loop!
- */
-1: b 1b
-#else
- STD_EXCEPTION(0x1300, InstructionBreakpoint, DebugException)
-#endif
- STD_EXCEPTION(0x1400, SMI, UnknownException)
-
- STD_EXCEPTION(0x1500, Trap_15, UnknownException)
- STD_EXCEPTION(0x1600, Trap_16, UnknownException)
- STD_EXCEPTION(0x1700, Trap_17, UnknownException)
- STD_EXCEPTION(0x1800, Trap_18, UnknownException)
- STD_EXCEPTION(0x1900, Trap_19, UnknownException)
- STD_EXCEPTION(0x1a00, Trap_1a, UnknownException)
- STD_EXCEPTION(0x1b00, Trap_1b, UnknownException)
- STD_EXCEPTION(0x1c00, Trap_1c, UnknownException)
- STD_EXCEPTION(0x1d00, Trap_1d, UnknownException)
- STD_EXCEPTION(0x1e00, Trap_1e, UnknownException)
- STD_EXCEPTION(0x1f00, Trap_1f, UnknownException)
- STD_EXCEPTION(0x2000, Trap_20, UnknownException)
- STD_EXCEPTION(0x2100, Trap_21, UnknownException)
- STD_EXCEPTION(0x2200, Trap_22, UnknownException)
- STD_EXCEPTION(0x2300, Trap_23, UnknownException)
- STD_EXCEPTION(0x2400, Trap_24, UnknownException)
- STD_EXCEPTION(0x2500, Trap_25, UnknownException)
- STD_EXCEPTION(0x2600, Trap_26, UnknownException)
- STD_EXCEPTION(0x2700, Trap_27, UnknownException)
- STD_EXCEPTION(0x2800, Trap_28, UnknownException)
- STD_EXCEPTION(0x2900, Trap_29, UnknownException)
- STD_EXCEPTION(0x2a00, Trap_2a, UnknownException)
- STD_EXCEPTION(0x2b00, Trap_2b, UnknownException)
- STD_EXCEPTION(0x2c00, Trap_2c, UnknownException)
- STD_EXCEPTION(0x2d00, Trap_2d, UnknownException)
- STD_EXCEPTION(0x2e00, Trap_2e, UnknownException)
- STD_EXCEPTION(0x2f00, Trap_2f, UnknownException)
-
-
- .globl _end_of_vectors
-_end_of_vectors:
-
- . = 0x3000
-
-/*
- * This code finishes saving the registers to the exception frame
- * and jumps to the appropriate handler for the exception.
- * Register r21 is pointer into trap frame, r1 has new stack pointer.
- */
- .globl transfer_to_handler
-transfer_to_handler:
- stw r22,_NIP(r21)
- lis r22,MSR_POW@h
- andc r23,r23,r22
- stw r23,_MSR(r21)
- SAVE_GPR(7, r21)
- SAVE_4GPRS(8, r21)
- SAVE_8GPRS(12, r21)
- SAVE_8GPRS(24, r21)
- mflr r23
- andi. r24,r23,0x3f00 /* get vector offset */
- stw r24,TRAP(r21)
- li r22,0
- stw r22,RESULT(r21)
- lwz r24,0(r23) /* virtual address of handler */
- lwz r23,4(r23) /* where to go when done */
- mtspr SRR0,r24
- mtspr SRR1,r20
- mtlr r23
- SYNC
- rfi /* jump to handler, enable MMU */
-
-int_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr SRR0,r2
- mtspr SRR1,r0
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfi
-
-/*
- * This code initialises the E300 processor core
- * (conforms to PowerPC 603e spec)
- * Note: expects original MSR contents to be in r5.
- */
- .globl init_e300_core
-init_e300_core: /* time t 10 */
- /* Initialize machine status; enable machine check interrupt */
- /*-----------------------------------------------------------*/
-
- li r3, MSR_KERNEL /* Set ME and RI flags */
- rlwimi r3, r5, 0, 25, 25 /* preserve IP bit set by HRCW */
-#ifdef DEBUG
- rlwimi r3, r5, 0, 21, 22 /* debugger might set SE & BE bits */
-#endif
- SYNC /* Some chip revs need this... */
- mtmsr r3
- SYNC
- mtspr SRR1, r3 /* Make SRR1 match MSR */
-
-
- lis r3, CFG_IMMR@h
-#if defined(CONFIG_WATCHDOG)
- /* Initialise the Wathcdog values and reset it (if req) */
- /*------------------------------------------------------*/
- lis r4, CFG_WATCHDOG_VALUE
- ori r4, r4, (SWCRR_SWEN | SWCRR_SWRI | SWCRR_SWPR)
- stw r4, SWCRR(r3)
-
- /* and reset it */
-
- li r4, 0x556C
- sth r4, SWSRR@l(r3)
- li r4, 0xAA39
- sth r4, SWSRR@l(r3)
-#else
- /* Disable Wathcdog */
- /*-------------------*/
- lwz r4, SWCRR(r3)
- /* Check to see if its enabled for disabling
- once disabled by SW you can't re-enable */
- andi. r4, r4, 0x4
- beq 1f
- xor r4, r4, r4
- stw r4, SWCRR(r3)
-1:
-#endif /* CONFIG_WATCHDOG */
-
- /* Initialize the Hardware Implementation-dependent Registers */
- /* HID0 also contains cache control */
- /*------------------------------------------------------*/
-
- lis r3, CFG_HID0_INIT@h
- ori r3, r3, CFG_HID0_INIT@l
- SYNC
- mtspr HID0, r3
-
- lis r3, CFG_HID0_FINAL@h
- ori r3, r3, CFG_HID0_FINAL@l
- SYNC
- mtspr HID0, r3
-
- lis r3, CFG_HID2@h
- ori r3, r3, CFG_HID2@l
- SYNC
- mtspr HID2, r3
-
- /* clear all BAT's */
- /*----------------------------------*/
-
- xor r0, r0, r0
- mtspr DBAT0U, r0
- mtspr DBAT0L, r0
- mtspr DBAT1U, r0
- mtspr DBAT1L, r0
- mtspr DBAT2U, r0
- mtspr DBAT2L, r0
- mtspr DBAT3U, r0
- mtspr DBAT3L, r0
- mtspr IBAT0U, r0
- mtspr IBAT0L, r0
- mtspr IBAT1U, r0
- mtspr IBAT1L, r0
- mtspr IBAT2U, r0
- mtspr IBAT2L, r0
- mtspr IBAT3U, r0
- mtspr IBAT3L, r0
- SYNC
-
- /* invalidate all tlb's
- *
- * From the 603e User Manual: "The 603e provides the ability to
- * invalidate a TLB entry. The TLB Invalidate Entry (tlbie)
- * instruction invalidates the TLB entry indexed by the EA, and
- * operates on both the instruction and data TLBs simultaneously
- * invalidating four TLB entries (both sets in each TLB). The
- * index corresponds to bits 15-19 of the EA. To invalidate all
- * entries within both TLBs, 32 tlbie instructions should be
- * issued, incrementing this field by one each time."
- *
- * "Note that the tlbia instruction is not implemented on the
- * 603e."
- *
- * bits 15-19 correspond to addresses 0x00000000 to 0x0001F000
- * incrementing by 0x1000 each time. The code below is sort of
- * based on code in "flush_tlbs" from arch/ppc/kernel/head.S
- *
- */
-
- li r3, 32
- mtctr r3
- li r3, 0
-1: tlbie r3
- addi r3, r3, 0x1000
- bdnz 1b
- SYNC
-
- /* Done! */
- /*------------------------------*/
- blr
-
- .globl invalidate_bats
-invalidate_bats:
- /* invalidate BATs */
- mtspr IBAT0U, r0
- mtspr IBAT1U, r0
- mtspr IBAT2U, r0
- mtspr IBAT3U, r0
-#if (CFG_HID2 & HID2_HBE)
- mtspr IBAT4U, r0
- mtspr IBAT5U, r0
- mtspr IBAT6U, r0
- mtspr IBAT7U, r0
-#endif
- isync
- mtspr DBAT0U, r0
- mtspr DBAT1U, r0
- mtspr DBAT2U, r0
- mtspr DBAT3U, r0
-#if (CFG_HID2 & HID2_HBE)
- mtspr DBAT4U, r0
- mtspr DBAT5U, r0
- mtspr DBAT6U, r0
- mtspr DBAT7U, r0
-#endif
- isync
- sync
- blr
-
- /* setup_bats - set them up to some initial state */
- .globl setup_bats
-setup_bats:
- addis r0, r0, 0x0000
-
- /* IBAT 0 */
- addis r4, r0, CFG_IBAT0L@h
- ori r4, r4, CFG_IBAT0L@l
- addis r3, r0, CFG_IBAT0U@h
- ori r3, r3, CFG_IBAT0U@l
- mtspr IBAT0L, r4
- mtspr IBAT0U, r3
- isync
-
- /* DBAT 0 */
- addis r4, r0, CFG_DBAT0L@h
- ori r4, r4, CFG_DBAT0L@l
- addis r3, r0, CFG_DBAT0U@h
- ori r3, r3, CFG_DBAT0U@l
- mtspr DBAT0L, r4
- mtspr DBAT0U, r3
- isync
-
- /* IBAT 1 */
- addis r4, r0, CFG_IBAT1L@h
- ori r4, r4, CFG_IBAT1L@l
- addis r3, r0, CFG_IBAT1U@h
- ori r3, r3, CFG_IBAT1U@l
- mtspr IBAT1L, r4
- mtspr IBAT1U, r3
- isync
-
- /* DBAT 1 */
- addis r4, r0, CFG_DBAT1L@h
- ori r4, r4, CFG_DBAT1L@l
- addis r3, r0, CFG_DBAT1U@h
- ori r3, r3, CFG_DBAT1U@l
- mtspr DBAT1L, r4
- mtspr DBAT1U, r3
- isync
-
- /* IBAT 2 */
- addis r4, r0, CFG_IBAT2L@h
- ori r4, r4, CFG_IBAT2L@l
- addis r3, r0, CFG_IBAT2U@h
- ori r3, r3, CFG_IBAT2U@l
- mtspr IBAT2L, r4
- mtspr IBAT2U, r3
- isync
-
- /* DBAT 2 */
- addis r4, r0, CFG_DBAT2L@h
- ori r4, r4, CFG_DBAT2L@l
- addis r3, r0, CFG_DBAT2U@h
- ori r3, r3, CFG_DBAT2U@l
- mtspr DBAT2L, r4
- mtspr DBAT2U, r3
- isync
-
- /* IBAT 3 */
- addis r4, r0, CFG_IBAT3L@h
- ori r4, r4, CFG_IBAT3L@l
- addis r3, r0, CFG_IBAT3U@h
- ori r3, r3, CFG_IBAT3U@l
- mtspr IBAT3L, r4
- mtspr IBAT3U, r3
- isync
-
- /* DBAT 3 */
- addis r4, r0, CFG_DBAT3L@h
- ori r4, r4, CFG_DBAT3L@l
- addis r3, r0, CFG_DBAT3U@h
- ori r3, r3, CFG_DBAT3U@l
- mtspr DBAT3L, r4
- mtspr DBAT3U, r3
- isync
-
-#if (CFG_HID2 & HID2_HBE)
- /* IBAT 4 */
- addis r4, r0, CFG_IBAT4L@h
- ori r4, r4, CFG_IBAT4L@l
- addis r3, r0, CFG_IBAT4U@h
- ori r3, r3, CFG_IBAT4U@l
- mtspr IBAT4L, r4
- mtspr IBAT4U, r3
- isync
-
- /* DBAT 4 */
- addis r4, r0, CFG_DBAT4L@h
- ori r4, r4, CFG_DBAT4L@l
- addis r3, r0, CFG_DBAT4U@h
- ori r3, r3, CFG_DBAT4U@l
- mtspr DBAT4L, r4
- mtspr DBAT4U, r3
- isync
-
- /* IBAT 5 */
- addis r4, r0, CFG_IBAT5L@h
- ori r4, r4, CFG_IBAT5L@l
- addis r3, r0, CFG_IBAT5U@h
- ori r3, r3, CFG_IBAT5U@l
- mtspr IBAT5L, r4
- mtspr IBAT5U, r3
- isync
-
- /* DBAT 5 */
- addis r4, r0, CFG_DBAT5L@h
- ori r4, r4, CFG_DBAT5L@l
- addis r3, r0, CFG_DBAT5U@h
- ori r3, r3, CFG_DBAT5U@l
- mtspr DBAT5L, r4
- mtspr DBAT5U, r3
- isync
-
- /* IBAT 6 */
- addis r4, r0, CFG_IBAT6L@h
- ori r4, r4, CFG_IBAT6L@l
- addis r3, r0, CFG_IBAT6U@h
- ori r3, r3, CFG_IBAT6U@l
- mtspr IBAT6L, r4
- mtspr IBAT6U, r3
- isync
-
- /* DBAT 6 */
- addis r4, r0, CFG_DBAT6L@h
- ori r4, r4, CFG_DBAT6L@l
- addis r3, r0, CFG_DBAT6U@h
- ori r3, r3, CFG_DBAT6U@l
- mtspr DBAT6L, r4
- mtspr DBAT6U, r3
- isync
-
- /* IBAT 7 */
- addis r4, r0, CFG_IBAT7L@h
- ori r4, r4, CFG_IBAT7L@l
- addis r3, r0, CFG_IBAT7U@h
- ori r3, r3, CFG_IBAT7U@l
- mtspr IBAT7L, r4
- mtspr IBAT7U, r3
- isync
-
- /* DBAT 7 */
- addis r4, r0, CFG_DBAT7L@h
- ori r4, r4, CFG_DBAT7L@l
- addis r3, r0, CFG_DBAT7U@h
- ori r3, r3, CFG_DBAT7U@l
- mtspr DBAT7L, r4
- mtspr DBAT7U, r3
- isync
-#endif
-
- /* Invalidate TLBs.
- * -> for (val = 0; val < 0x20000; val+=0x1000)
- * -> tlbie(val);
- */
- lis r3, 0
- lis r5, 2
-
-1:
- tlbie r3
- addi r3, r3, 0x1000
- cmp 0, 0, r3, r5
- blt 1b
-
- blr
-
- .globl enable_addr_trans
-enable_addr_trans:
- /* enable address translation */
- mfmsr r5
- ori r5, r5, (MSR_IR | MSR_DR)
- mtmsr r5
- isync
- blr
-
- .globl disable_addr_trans
-disable_addr_trans:
- /* disable address translation */
- mflr r4
- mfmsr r3
- andi. r0, r3, (MSR_IR | MSR_DR)
- beqlr
- andc r3, r3, r0
- mtspr SRR0, r4
- mtspr SRR1, r3
- rfi
-
-/* Cache functions.
- *
- * Note: requires that all cache bits in
- * HID0 are in the low half word.
- */
- .globl icache_enable
-icache_enable:
- mfspr r3, HID0
- ori r3, r3, HID0_ICE
- lis r4, 0
- ori r4, r4, HID0_ILOCK
- andc r3, r3, r4
- ori r4, r3, HID0_ICFI
- isync
- mtspr HID0, r4 /* sets enable and invalidate, clears lock */
- isync
- mtspr HID0, r3 /* clears invalidate */
- blr
-
- .globl icache_disable
-icache_disable:
- mfspr r3, HID0
- lis r4, 0
- ori r4, r4, HID0_ICE|HID0_ILOCK
- andc r3, r3, r4
- ori r4, r3, HID0_ICFI
- isync
- mtspr HID0, r4 /* sets invalidate, clears enable and lock*/
- isync
- mtspr HID0, r3 /* clears invalidate */
- blr
-
- .globl icache_status
-icache_status:
- mfspr r3, HID0
- rlwinm r3, r3, (31 - HID0_ICE_SHIFT + 1), 31, 31
- blr
-
- .globl dcache_enable
-dcache_enable:
- mfspr r3, HID0
- li r5, HID0_DCFI|HID0_DLOCK
- andc r3, r3, r5
- mtspr HID0, r3 /* no invalidate, unlock */
- ori r3, r3, HID0_DCE
- ori r5, r3, HID0_DCFI
- mtspr HID0, r5 /* enable + invalidate */
- mtspr HID0, r3 /* enable */
- sync
- blr
-
- .globl dcache_disable
-dcache_disable:
- mfspr r3, HID0
- lis r4, 0
- ori r4, r4, HID0_DCE|HID0_DLOCK
- andc r3, r3, r4
- ori r4, r3, HID0_DCI
- sync
- mtspr HID0, r4 /* sets invalidate, clears enable and lock */
- sync
- mtspr HID0, r3 /* clears invalidate */
- blr
-
- .globl dcache_status
-dcache_status:
- mfspr r3, HID0
- rlwinm r3, r3, (31 - HID0_DCE_SHIFT + 1), 31, 31
- blr
-
- .globl get_pvr
-get_pvr:
- mfspr r3, PVR
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: ppcDcbf */
-/* Description: Data Cache block flush */
-/* Input: r3 = effective address */
-/* Output: none. */
-/*------------------------------------------------------------------------------- */
- .globl ppcDcbf
-ppcDcbf:
- dcbf r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: ppcDcbi */
-/* Description: Data Cache block Invalidate */
-/* Input: r3 = effective address */
-/* Output: none. */
-/*------------------------------------------------------------------------------- */
- .globl ppcDcbi
-ppcDcbi:
- dcbi r0,r3
- blr
-
-/*--------------------------------------------------------------------------
- * Function: ppcDcbz
- * Description: Data Cache block zero.
- * Input: r3 = effective address
- * Output: none.
- *-------------------------------------------------------------------------- */
-
- .globl ppcDcbz
-ppcDcbz:
- dcbz r0,r3
- blr
-
- .globl ppcDWstore
-ppcDWstore:
- lfd 1, 0(r4)
- stfd 1, 0(r3)
- blr
-
- .globl ppcDWload
-ppcDWload:
- lfd 1, 0(r3)
- stfd 1, 0(r4)
- blr
-
-/*-------------------------------------------------------------------*/
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
- */
- .globl relocate_code
-relocate_code:
- mr r1, r3 /* Set new stack pointer */
- mr r9, r4 /* Save copy of Global Data pointer */
- mr r10, r5 /* Save copy of Destination Address */
-
- mr r3, r5 /* Destination Address */
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
- lwz r5, GOT(__init_end)
- sub r5, r5, r4
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE)
- * + Destination Address
- *
- * Offset:
- */
- sub r15, r10, r4
-
- /* First our own GOT */
- add r14, r14, r15
- /* then the one used by the C code */
- add r30, r30, r15
-
- /*
- * Now relocate code
- */
-
- cmplw cr1,r3,r4
- addi r0,r5,3
- srwi. r0,r0,2
- beq cr1,4f /* In place copy is not necessary */
- beq 7f /* Protect against 0 count */
- mtctr r0
- bge cr1,2f
- la r8,-4(r4)
- la r7,-4(r3)
-
- /* copy */
-1: lwzu r0,4(r8)
- stwu r0,4(r7)
- bdnz 1b
-
- addi r0,r5,3
- srwi. r0,r0,2
- mtctr r0
- la r8,-4(r4)
- la r7,-4(r3)
-
- /* and compare */
-20: lwzu r20,4(r8)
- lwzu r21,4(r7)
- xor. r22, r20, r21
- bne 30f
- bdnz 20b
- b 4f
-
- /* compare failed */
-30: li r3, 0
- blr
-
-2: slwi r0,r0,2 /* re copy in reverse order ... y do we needed it? */
- add r8,r4,r0
- add r7,r3,r0
-3: lwzu r0,-4(r8)
- stwu r0,-4(r7)
- bdnz 3b
-
-/*
- * Now flush the cache: note that we must start from a cache aligned
- * address. Otherwise we might miss one cache line.
- */
-4: cmpwi r6,0
- add r5,r3,r5
- beq 7f /* Always flush prefetch queue in any case */
- subi r0,r6,1
- andc r3,r3,r0
- mr r4,r3
-5: dcbst 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 5b
- sync /* Wait for all dcbst to complete on bus */
- mr r4,r3
-6: icbi 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 6b
-7: sync /* Wait for all icbi to complete on bus */
- isync
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
- addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
- mtlr r0
- blr
-
-in_ram:
-
- /*
- * Relocation Function, r14 point to got2+0x8000
- *
- * Adjust got2 pointers, no need to check for 0, this code
- * already puts a few entries in the table.
- */
- li r0,__got2_entries@sectoff@l
- la r3,GOT(_GOT2_TABLE_)
- lwz r11,GOT(_GOT2_TABLE_)
- mtctr r0
- sub r11,r3,r11
- addi r3,r3,-4
-1: lwzu r0,4(r3)
- add r0,r0,r11
- stw r0,0(r3)
- bdnz 1b
-
- /*
- * Now adjust the fixups and the pointers to the fixups
- * in case we need to move ourselves again.
- */
-2: li r0,__fixup_entries@sectoff@l
- lwz r3,GOT(_FIXUP_TABLE_)
- cmpwi r0,0
- mtctr r0
- addi r3,r3,-4
- beq 4f
-3: lwzu r4,4(r3)
- lwzux r0,r4,r11
- add r0,r0,r11
- stw r10,0(r3)
- stw r0,0(r4)
- bdnz 3b
-4:
-clear_bss:
- /*
- * Now clear BSS segment
- */
- lwz r3,GOT(__bss_start)
-#if defined(CONFIG_HYMOD)
- /*
- * For HYMOD - the environment is the very last item in flash.
- * The real .bss stops just before environment starts, so only
- * clear up to that point.
- *
- * taken from mods for FADS board
- */
- lwz r4,GOT(environment)
-#else
- lwz r4,GOT(_end)
-#endif
-
- cmplw 0, r3, r4
- beq 6f
-
- li r0, 0
-5:
- stw r0, 0(r3)
- addi r3, r3, 4
- cmplw 0, r3, r4
- bne 5b
-6:
-
- mr r3, r9 /* Global Data pointer */
- mr r4, r10 /* Destination Address */
- bl board_init_r
-
- /*
- * Copy exception vector code to low memory
- *
- * r3: dest_addr
- * r7: source address, r8: end address, r9: target address
- */
- .globl trap_init
-trap_init:
- lwz r7, GOT(_start)
- lwz r8, GOT(_end_of_vectors)
-
- li r9, 0x100 /* reset vector always at 0x100 */
-
- cmplw 0, r7, r8
- bgelr /* return if r7>=r8 - just in case */
-
- mflr r4 /* save link register */
-1:
- lwz r0, 0(r7)
- stw r0, 0(r9)
- addi r7, r7, 4
- addi r9, r9, 4
- cmplw 0, r7, r8
- bne 1b
-
- /*
- * relocate `hdlr' and `int_return' entries
- */
- li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
- li r8, Alignment - _start + EXC_OFF_SYS_RESET
-2:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 2b
-
- li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
- li r8, SystemCall - _start + EXC_OFF_SYS_RESET
-3:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 3b
-
- li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
- li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-4:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 4b
-
- mfmsr r3 /* now that the vectors have */
- lis r7, MSR_IP@h /* relocated into low memory */
- ori r7, r7, MSR_IP@l /* MSR[IP] can be turned off */
- andc r3, r3, r7 /* (if it was on) */
- SYNC /* Some chip revs need this... */
- mtmsr r3
- SYNC
-
- mtlr r4 /* restore link register */
- blr
-
- /*
- * Function: relocate entries for one exception vector
- */
-trap_reloc:
- lwz r0, 0(r7) /* hdlr ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 0(r7)
-
- lwz r0, 4(r7) /* int_return ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 4(r7)
-
- blr
-
-#ifdef CFG_INIT_RAM_LOCK
-lock_ram_in_cache:
- /* Allocate Initial RAM in data cache.
- */
- lis r3, (CFG_INIT_RAM_ADDR & ~31)@h
- ori r3, r3, (CFG_INIT_RAM_ADDR & ~31)@l
- li r2, ((CFG_INIT_RAM_END & ~31) + \
- (CFG_INIT_RAM_ADDR & 31) + 31) / 32
- mtctr r2
-1:
- dcbz r0, r3
- addi r3, r3, 32
- bdnz 1b
-
- /* Lock the data cache */
- mfspr r0, HID0
- ori r0, r0, 0x1000
- sync
- mtspr HID0, r0
- sync
- blr
-
-.globl unlock_ram_in_cache
-unlock_ram_in_cache:
- /* invalidate the INIT_RAM section */
- lis r3, (CFG_INIT_RAM_ADDR & ~31)@h
- ori r3, r3, (CFG_INIT_RAM_ADDR & ~31)@l
- li r2,512
- mtctr r2
-1: icbi r0, r3
- dcbi r0, r3
- addi r3, r3, 32
- bdnz 1b
- sync /* Wait for all icbi to complete on bus */
- isync
-
- /* Unlock the data cache and invalidate it */
- mfspr r3, HID0
- li r5, HID0_DLOCK|HID0_DCFI
- andc r3, r3, r5 /* no invalidate, unlock */
- ori r5, r3, HID0_DCFI /* invalidate, unlock */
- mtspr HID0, r5 /* invalidate, unlock */
- mtspr HID0, r3 /* no invalidate, unlock */
- sync
- blr
-#endif
-
-map_flash_by_law1:
- /* When booting from ROM (Flash or EPROM), clear the */
- /* Address Mask in OR0 so ROM appears everywhere */
- /*----------------------------------------------------*/
- lis r3, (CFG_IMMR)@h /* r3 <= CFG_IMMR */
- lwz r4, OR0@l(r3)
- li r5, 0x7fff /* r5 <= 0x00007FFFF */
- and r4, r4, r5
- stw r4, OR0@l(r3) /* OR0 <= OR0 & 0x00007FFFF */
-
- /* As MPC8349E User's Manual presented, when RCW[BMS] is set to 0,
- * system will boot from 0x0000_0100, and the LBLAWBAR0[BASE_ADDR]
- * reset value is 0x00000; when RCW[BMS] is set to 1, system will boot
- * from 0xFFF0_0100, and the LBLAWBAR0[BASE_ADDR] reset value is
- * 0xFF800. From the hard resetting to here, the processor fetched and
- * executed the instructions one by one. There is not absolutely
- * jumping happened. Laterly, the u-boot code has to do an absolutely
- * jumping to tell the CPU instruction fetching component what the
- * u-boot TEXT base address is. Because the TEXT base resides in the
- * boot ROM memory space, to garantee the code can run smoothly after
- * that jumping, we must map in the entire boot ROM by Local Access
- * Window. Sometimes, we desire an non-0x00000 or non-0xFF800 starting
- * address for boot ROM, such as 0xFE000000. In this case, the default
- * LBIU Local Access Widow 0 will not cover this memory space. So, we
- * need another window to map in it.
- */
- lis r4, (CFG_FLASH_BASE)@h
- ori r4, r4, (CFG_FLASH_BASE)@l
- stw r4, LBLAWBAR1(r3) /* LBLAWBAR1 <= CFG_FLASH_BASE */
-
- /* Store 0x80000012 + log2(CFG_FLASH_SIZE) into LBLAWAR1 */
- lis r4, (0x80000012)@h
- ori r4, r4, (0x80000012)@l
- li r5, CFG_FLASH_SIZE
-1: srawi. r5, r5, 1 /* r5 = r5 >> 1 */
- addi r4, r4, 1
- bne 1b
-
- stw r4, LBLAWAR1(r3) /* LBLAWAR1 <= 8MB Flash Size */
- blr
-
- /* Though all the LBIU Local Access Windows and LBC Banks will be
- * initialized in the C code, we'd better configure boot ROM's
- * window 0 and bank 0 correctly at here.
- */
-remap_flash_by_law0:
- /* Initialize the BR0 with the boot ROM starting address. */
- lwz r4, BR0(r3)
- li r5, 0x7FFF
- and r4, r4, r5
- lis r5, (CFG_FLASH_BASE & 0xFFFF8000)@h
- ori r5, r5, (CFG_FLASH_BASE & 0xFFFF8000)@l
- or r5, r5, r4
- stw r5, BR0(r3) /* r5 <= (CFG_FLASH_BASE & 0xFFFF8000) | (BR0 & 0x00007FFF) */
-
- lwz r4, OR0(r3)
- lis r5, ~((CFG_FLASH_SIZE << 4) - 1)
- or r4, r4, r5
- stw r4, OR0(r3)
-
- lis r4, (CFG_FLASH_BASE)@h
- ori r4, r4, (CFG_FLASH_BASE)@l
- stw r4, LBLAWBAR0(r3) /* LBLAWBAR0 <= CFG_FLASH_BASE */
-
- /* Store 0x80000012 + log2(CFG_FLASH_SIZE) into LBLAWAR0 */
- lis r4, (0x80000012)@h
- ori r4, r4, (0x80000012)@l
- li r5, CFG_FLASH_SIZE
-1: srawi. r5, r5, 1 /* r5 = r5 >> 1 */
- addi r4, r4, 1
- bne 1b
- stw r4, LBLAWAR0(r3) /* LBLAWAR0 <= Flash Size */
-
-
- xor r4, r4, r4
- stw r4, LBLAWBAR1(r3)
- stw r4, LBLAWAR1(r3) /* Off LBIU LAW1 */
- blr
diff --git a/cpu/mpc83xx/traps.c b/cpu/mpc83xx/traps.c
deleted file mode 100644
index ccca28718f..0000000000
--- a/cpu/mpc83xx/traps.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * This file handles the architecture-dependent parts of hardware
- * exceptions
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/processor.h>
-#include <asm/mpc8349_pci.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/* Returns 0 if exception not found and fixup otherwise. */
-extern unsigned long search_exception_table(unsigned long);
-
-#define END_OF_MEM (gd->bd->bi_memstart + gd->bd->bi_memsize)
-
-/*
- * Trap & Exception support
- */
-
-void
-print_backtrace(unsigned long *sp)
-{
- int cnt = 0;
- unsigned long i;
-
- puts ("Call backtrace: ");
- while (sp) {
- if ((uint)sp > END_OF_MEM)
- break;
-
- i = sp[1];
- if (cnt++ % 7 == 0)
- putc ('\n');
- printf("%08lX ", i);
- if (cnt > 32) break;
- sp = (unsigned long *)*sp;
- }
- putc ('\n');
-}
-
-void show_regs(struct pt_regs * regs)
-{
- int i;
-
- printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
- regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
- printf("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
- regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
- regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
- regs->msr&MSR_IR ? 1 : 0,
- regs->msr&MSR_DR ? 1 : 0);
-
- putc ('\n');
- for (i = 0; i < 32; i++) {
- if ((i % 8) == 0) {
- printf("GPR%02d: ", i);
- }
-
- printf("%08lX ", regs->gpr[i]);
- if ((i % 8) == 7) {
- putc ('\n');
- }
- }
-}
-
-
-void
-_exception(int signr, struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
-}
-
-#ifdef CONFIG_PCI
-void dump_pci (void)
-{
-/*
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- printf ("PCI: err status %x err mask %x err ctrl %x\n",
- le32_to_cpu (immap->im_pci.pci_esr),
- le32_to_cpu (immap->im_pci.pci_emr),
- le32_to_cpu (immap->im_pci.pci_ecr));
- printf (" error address %x error data %x ctrl %x\n",
- le32_to_cpu (immap->im_pci.pci_eacr),
- le32_to_cpu (immap->im_pci.pci_edcr),
- le32_to_cpu (immap->im_pci.pci_eccr));
-*/
-}
-#endif
-
-void
-MachineCheckException(struct pt_regs *regs)
-{
- unsigned long fixup;
-
- /* Probing PCI using config cycles cause this exception
- * when a device is not present. Catch it and return to
- * the PCI exception handler.
- */
-#ifdef CONFIG_PCI
-#endif /* CONFIG_PCI */
- if ((fixup = search_exception_table(regs->nip)) != 0) {
- regs->nip = fixup;
- return;
- }
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- puts ("Machine check in kernel mode.\n"
- "Caused by (from msr): ");
- printf("regs %p ",regs);
- switch( regs->msr & 0x000F0000) {
- case (0x80000000>>12):
- puts ("Machine check signal - probably due to mm fault\n"
- "with mmu off\n");
- break;
- case (0x80000000>>13):
- puts ("Transfer error ack signal\n");
- break;
- case (0x80000000>>14):
- puts ("Data parity signal\n");
- break;
- case (0x80000000>>15):
- puts ("Address parity signal\n");
- break;
- default:
- puts ("Unknown values in msr\n");
- }
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
-#ifdef CONFIG_PCI
- dump_pci();
-#endif
- panic("machine check");
-}
-
-void
-AlignmentException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Alignment Exception");
-}
-
-void
-ProgramCheckException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Program Check Exception");
-}
-
-void
-SoftEmuException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Software Emulation Exception");
-}
-
-
-void
-UnknownException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
- regs->nip, regs->msr, regs->trap);
- _exception(0, regs);
-}
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
-extern void do_bedbug_breakpoint(struct pt_regs *);
-#endif
-
-void
-DebugException(struct pt_regs *regs)
-{
- printf("Debugger trap at @ %lx\n", regs->nip );
- show_regs(regs);
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
- do_bedbug_breakpoint( regs );
-#endif
-}
-
-/* Probe an address by reading. If not present, return -1, otherwise
- * return 0.
- */
-int
-addr_probe(uint *addr)
-{
- return 0;
-}
diff --git a/cpu/mpc85xx/Makefile b/cpu/mpc85xx/Makefile
deleted file mode 100644
index ff67dcdd35..0000000000
--- a/cpu/mpc85xx/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# (C) Copyright 2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# (C) Copyright 2002,2003 Motorola Inc.
-# Xianghua Xiao,X.Xiao@motorola.com
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o resetvec.o
-COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o \
- pci.o serial_scc.o commproc.o ether_fcc.o spd_sdram.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/mpc85xx/commproc.c b/cpu/mpc85xx/commproc.c
deleted file mode 100644
index 3504d50cae..0000000000
--- a/cpu/mpc85xx/commproc.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Adapted for Motorola MPC8560 chips
- * Xianghua Xiao <x.xiao@motorola.com>
- *
- * This file is based on "arch/ppc/8260_io/commproc.c" - here is it's
- * copyright notice:
- *
- * General Purpose functions for the global management of the
- * 8220 Communication Processor Module.
- * Copyright (c) 1999 Dan Malek (dmalek@jlc.net)
- * Copyright (c) 2000 MontaVista Software, Inc (source@mvista.com)
- * 2.3.99 Updates
- * Copyright (c) 2003 Motorola,Inc.
- *
- * In addition to the individual control of the communication
- * channels, there are a few functions that globally affect the
- * communication processor.
- *
- * Buffer descriptors must be allocated from the dual ported memory
- * space. The allocator for that is here. When the communication
- * process is reset, we reclaim the memory available. There is
- * currently no deallocator for this memory.
- */
-#include <common.h>
-#include <asm/cpm_85xx.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if defined(CONFIG_CPM2)
-/*
- * because we have stack and init data in dual port ram
- * we must reduce the size
- */
-#undef CPM_DATAONLY_SIZE
-#define CPM_DATAONLY_SIZE ((uint)(8 * 1024) - CPM_DATAONLY_BASE)
-
-void
-m8560_cpm_reset(void)
-{
- volatile immap_t *immr = (immap_t *)CFG_IMMR;
- volatile ulong count;
-
- gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
-
- /* Reclaim the DP memory for our use.
- */
- gd->dp_alloc_base = CPM_DATAONLY_BASE;
- gd->dp_alloc_top = gd->dp_alloc_base + CPM_DATAONLY_SIZE;
-
- /*
- * Reset CPM
- */
- immr->im_cpm.im_cpm_cp.cpcr = CPM_CR_RST;
- count = 0;
- do { /* Spin until command processed */
- __asm__ __volatile__ ("eieio");
- } while ((immr->im_cpm.im_cpm_cp.cpcr & CPM_CR_FLG) && ++count < 1000000);
-}
-
-/* Allocate some memory from the dual ported ram.
- * To help protocols with object alignment restrictions, we do that
- * if they ask.
- */
-uint
-m8560_cpm_dpalloc(uint size, uint align)
-{
- volatile immap_t *immr = (immap_t *)CFG_IMMR;
- uint retloc;
- uint align_mask, off;
- uint savebase;
-
- align_mask = align - 1;
- savebase = gd->dp_alloc_base;
-
- if ((off = (gd->dp_alloc_base & align_mask)) != 0)
- gd->dp_alloc_base += (align - off);
-
- if ((off = size & align_mask) != 0)
- size += align - off;
-
- if ((gd->dp_alloc_base + size) >= gd->dp_alloc_top) {
- gd->dp_alloc_base = savebase;
- panic("m8560_cpm_dpalloc: ran out of dual port ram!");
- }
-
- retloc = gd->dp_alloc_base;
- gd->dp_alloc_base += size;
-
- memset((void *)&(immr->im_cpm.im_dprambase[retloc]), 0, size);
-
- return(retloc);
-}
-
-/* We also own one page of host buffer space for the allocation of
- * UART "fifos" and the like.
- */
-uint
-m8560_cpm_hostalloc(uint size, uint align)
-{
- /* the host might not even have RAM yet - just use dual port RAM */
- return (m8560_cpm_dpalloc(size, align));
-}
-
-/* Set a baud rate generator. This needs lots of work. There are
- * eight BRGs, which can be connected to the CPM channels or output
- * as clocks. The BRGs are in two different block of internal
- * memory mapped space.
- * The baud rate clock is the system clock divided by something.
- * It was set up long ago during the initial boot phase and is
- * is given to us.
- * Baud rate clocks are zero-based in the driver code (as that maps
- * to port numbers). Documentation uses 1-based numbering.
- */
-#define BRG_INT_CLK gd->brg_clk
-#define BRG_UART_CLK ((BRG_INT_CLK + 15) / 16)
-
-/* This function is used by UARTS, or anything else that uses a 16x
- * oversampled clock.
- */
-void
-m8560_cpm_setbrg(uint brg, uint rate)
-{
- volatile immap_t *immr = (immap_t *)CFG_IMMR;
- volatile uint *bp;
-
- /* This is good enough to get SMCs running.....
- */
- if (brg < 4) {
- bp = (uint *)&(immr->im_cpm.im_cpm_brg1.brgc1);
- }
- else {
- bp = (uint *)&(immr->im_cpm.im_cpm_brg2.brgc5);
- brg -= 4;
- }
- bp += brg;
- *bp = (((((BRG_UART_CLK+rate-1)/rate)-1)&0xfff)<<1)|CPM_BRG_EN;
-}
-
-/* This function is used to set high speed synchronous baud rate
- * clocks.
- */
-void
-m8560_cpm_fastbrg(uint brg, uint rate, int div16)
-{
- volatile immap_t *immr = (immap_t *)CFG_IMMR;
- volatile uint *bp;
-
- /* This is good enough to get SMCs running.....
- */
- if (brg < 4) {
- bp = (uint *)&(immr->im_cpm.im_cpm_brg1.brgc1);
- }
- else {
- bp = (uint *)&(immr->im_cpm.im_cpm_brg2.brgc5);
- brg -= 4;
- }
- bp += brg;
- *bp = (((((BRG_INT_CLK+rate-1)/rate)-1)&0xfff)<<1)|CPM_BRG_EN;
- if (div16)
- *bp |= CPM_BRG_DIV16;
-}
-
-/* This function is used to set baud rate generators using an external
- * clock source and 16x oversampling.
- */
-
-void
-m8560_cpm_extcbrg(uint brg, uint rate, uint extclk, int pinsel)
-{
- volatile immap_t *immr = (immap_t *)CFG_IMMR;
- volatile uint *bp;
-
- if (brg < 4) {
- bp = (uint *)&(immr->im_cpm.im_cpm_brg1.brgc1);
- }
- else {
- bp = (uint *)&(immr->im_cpm.im_cpm_brg2.brgc5);
- brg -= 4;
- }
- bp += brg;
- *bp = ((((((extclk/16)+rate-1)/rate)-1)&0xfff)<<1)|CPM_BRG_EN;
- if (pinsel == 0)
- *bp |= CPM_BRG_EXTC_CLK3_9;
- else
- *bp |= CPM_BRG_EXTC_CLK5_15;
-}
-
-#ifdef CONFIG_POST
-
-void post_word_store (ulong a)
-{
- volatile ulong *save_addr =
- (volatile ulong *)(CFG_IMMR + CPM_POST_WORD_ADDR);
-
- *save_addr = a;
-}
-
-ulong post_word_load (void)
-{
- volatile ulong *save_addr =
- (volatile ulong *)(CFG_IMMR + CPM_POST_WORD_ADDR);
-
- return *save_addr;
-}
-
-#endif /* CONFIG_POST */
-
-#endif /* CONFIG_CPM2 */
diff --git a/cpu/mpc85xx/config.mk b/cpu/mpc85xx/config.mk
deleted file mode 100644
index 6121074349..0000000000
--- a/cpu/mpc85xx/config.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# (C) Copyright 2002,2003 Motorola Inc.
-# Xianghua Xiao, X.Xiao@motorola.com
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx -DCONFIG_E500 -ffixed-r2 -ffixed-r29 -Wa,-me500 -msoft-float -mno-string
diff --git a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c
deleted file mode 100644
index 0507c47e6e..0000000000
--- a/cpu/mpc85xx/cpu.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Copyright 2004 Freescale Semiconductor.
- * (C) Copyright 2002, 2003 Motorola Inc.
- * Xianghua Xiao (X.Xiao@motorola.com)
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <command.h>
-#include <asm/cache.h>
-
-#if defined(CONFIG_OF_FLAT_TREE)
-#include <ft_build.h>
-#endif
-
-
-int checkcpu (void)
-{
- sys_info_t sysinfo;
- uint lcrr; /* local bus clock ratio register */
- uint clkdiv; /* clock divider portion of lcrr */
- uint pvr, svr;
- uint fam;
- uint ver;
- uint major, minor;
-
- svr = get_svr();
- ver = SVR_VER(svr);
- major = SVR_MAJ(svr);
- minor = SVR_MIN(svr);
-
- puts("CPU: ");
- switch (ver) {
- case SVR_8540:
- puts("8540");
- break;
- case SVR_8541:
- puts("8541");
- break;
- case SVR_8555:
- puts("8555");
- break;
- case SVR_8560:
- puts("8560");
- break;
- case SVR_8548:
- puts("8548");
- break;
- case SVR_8548_E:
- puts("8548_E");
- break;
- default:
- puts("Unknown");
- break;
- }
- printf(", Version: %d.%d, (0x%08x)\n", major, minor, svr);
-
- pvr = get_pvr();
- fam = PVR_FAM(pvr);
- ver = PVR_VER(pvr);
- major = PVR_MAJ(pvr);
- minor = PVR_MIN(pvr);
-
- printf("Core: ");
- switch (fam) {
- case PVR_FAM(PVR_85xx):
- puts("E500");
- break;
- default:
- puts("Unknown");
- break;
- }
- printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr);
-
- get_sys_info(&sysinfo);
-
- puts("Clock Configuration:\n");
- printf(" CPU:%4lu MHz, ", sysinfo.freqProcessor / 1000000);
- printf("CCB:%4lu MHz,\n", sysinfo.freqSystemBus / 1000000);
- printf(" DDR:%4lu MHz, ", sysinfo.freqSystemBus / 2000000);
-
-#if defined(CFG_LBC_LCRR)
- lcrr = CFG_LBC_LCRR;
-#else
- {
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_lbc_t *lbc= &immap->im_lbc;
-
- lcrr = lbc->lcrr;
- }
-#endif
- clkdiv = lcrr & 0x0f;
- if (clkdiv == 2 || clkdiv == 4 || clkdiv == 8) {
-#ifdef CONFIG_MPC8548
- /*
- * Yes, the entire PQ38 family use the same
- * bit-representation for twice the clock divider values.
- */
- clkdiv *= 2;
-#endif
- printf("LBC:%4lu MHz\n",
- sysinfo.freqSystemBus / 1000000 / clkdiv);
- } else {
- printf("LBC: unknown (lcrr: 0x%08x)\n", lcrr);
- }
-
- if (ver == SVR_8560) {
- printf("CPM: %lu Mhz\n",
- sysinfo.freqSystemBus / 1000000);
- }
-
- puts("L1: D-cache 32 kB enabled\n I-cache 32 kB enabled\n");
-
- return 0;
-}
-
-
-/* ------------------------------------------------------------------------- */
-
-int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
-{
- /*
- * Initiate hard reset in debug control register DBCR0
- * Make sure MSR[DE] = 1
- */
- unsigned long val;
-
- val = mfspr(DBCR0);
- val |= 0x70000000;
- mtspr(DBCR0,val);
-
- return 1;
-}
-
-
-/*
- * Get timebase clock frequency
- */
-unsigned long get_tbclk (void)
-{
-
- sys_info_t sys_info;
-
- get_sys_info(&sys_info);
- return ((sys_info.freqSystemBus + 7L) / 8L);
-}
-
-
-#if defined(CONFIG_WATCHDOG)
-void
-watchdog_reset(void)
-{
- int re_enable = disable_interrupts();
- reset_85xx_watchdog();
- if (re_enable) enable_interrupts();
-}
-
-void
-reset_85xx_watchdog(void)
-{
- /*
- * Clear TSR(WIS) bit by writing 1
- */
- unsigned long val;
- val = mfspr(tsr);
- val |= 0x40000000;
- mtspr(tsr, val);
-}
-#endif /* CONFIG_WATCHDOG */
-
-#if defined(CONFIG_DDR_ECC)
-void dma_init(void) {
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_dma_t *dma = &immap->im_dma;
-
- dma->satr0 = 0x02c40000;
- dma->datr0 = 0x02c40000;
- asm("sync; isync; msync");
- return;
-}
-
-uint dma_check(void) {
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_dma_t *dma = &immap->im_dma;
- volatile uint status = dma->sr0;
-
- /* While the channel is busy, spin */
- while((status & 4) == 4) {
- status = dma->sr0;
- }
-
- if (status != 0) {
- printf ("DMA Error: status = %x\n", status);
- }
- return status;
-}
-
-int dma_xfer(void *dest, uint count, void *src) {
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_dma_t *dma = &immap->im_dma;
-
- dma->dar0 = (uint) dest;
- dma->sar0 = (uint) src;
- dma->bcr0 = count;
- dma->mr0 = 0xf000004;
- asm("sync;isync;msync");
- dma->mr0 = 0xf000005;
- asm("sync;isync;msync");
- return dma_check();
-}
-#endif
-
-
-#ifdef CONFIG_OF_FLAT_TREE
-void
-ft_cpu_setup(void *blob, bd_t *bd)
-{
- u32 *p;
- ulong clock;
- int len;
-
- clock = bd->bi_busfreq;
- p = ft_get_prop(blob, "/cpus/" OF_CPU "/bus-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(clock);
-
- p = ft_get_prop(blob, "/" OF_SOC "/serial@4500/clock-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(clock);
-
- p = ft_get_prop(blob, "/" OF_SOC "/serial@4600/clock-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(clock);
-
-#if defined(CONFIG_MPC85XX_TSEC1)
- p = ft_get_prop(blob, "/" OF_SOC "/ethernet@24000/mac-address", &len);
- memcpy(p, bd->bi_enetaddr, 6);
-#endif
-
-#if defined(CONFIG_HAS_ETH1)
- p = ft_get_prop(blob, "/" OF_SOC "/ethernet@25000/mac-address", &len);
- memcpy(p, bd->bi_enet1addr, 6);
-#endif
-
-#if defined(CONFIG_HAS_ETH2)
- p = ft_get_prop(blob, "/" OF_SOC "/ethernet@26000/mac-address", &len);
- memcpy(p, bd->bi_enet2addr, 6);
-#endif
-
-#if defined(CONFIG_HAS_ETH3)
- p = ft_get_prop(blob, "/" OF_SOC "/ethernet@27000/mac-address", &len);
- memcpy(p, bd->bi_enet3addr, 6);
-#endif
-
-}
-#endif
diff --git a/cpu/mpc85xx/cpu_init.c b/cpu/mpc85xx/cpu_init.c
deleted file mode 100644
index 9f4d36c1ab..0000000000
--- a/cpu/mpc85xx/cpu_init.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * (C) Copyright 2003 Motorola Inc.
- * Modified by Xianghua Xiao, X.Xiao@motorola.com
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <asm/processor.h>
-#include <ioports.h>
-#include <asm/io.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-
-#ifdef CONFIG_CPM2
-static void config_8560_ioports (volatile immap_t * immr)
-{
- int portnum;
-
- for (portnum = 0; portnum < 4; portnum++) {
- uint pmsk = 0,
- ppar = 0,
- psor = 0,
- pdir = 0,
- podr = 0,
- pdat = 0;
- iop_conf_t *iopc = (iop_conf_t *) & iop_conf_tab[portnum][0];
- iop_conf_t *eiopc = iopc + 32;
- uint msk = 1;
-
- /*
- * NOTE:
- * index 0 refers to pin 31,
- * index 31 refers to pin 0
- */
- while (iopc < eiopc) {
- if (iopc->conf) {
- pmsk |= msk;
- if (iopc->ppar)
- ppar |= msk;
- if (iopc->psor)
- psor |= msk;
- if (iopc->pdir)
- pdir |= msk;
- if (iopc->podr)
- podr |= msk;
- if (iopc->pdat)
- pdat |= msk;
- }
-
- msk <<= 1;
- iopc++;
- }
-
- if (pmsk != 0) {
- volatile ioport_t *iop = ioport_addr (immr, portnum);
- uint tpmsk = ~pmsk;
-
- /*
- * the (somewhat confused) paragraph at the
- * bottom of page 35-5 warns that there might
- * be "unknown behaviour" when programming
- * PSORx and PDIRx, if PPARx = 1, so I
- * decided this meant I had to disable the
- * dedicated function first, and enable it
- * last.
- */
- iop->ppar &= tpmsk;
- iop->psor = (iop->psor & tpmsk) | psor;
- iop->podr = (iop->podr & tpmsk) | podr;
- iop->pdat = (iop->pdat & tpmsk) | pdat;
- iop->pdir = (iop->pdir & tpmsk) | pdir;
- iop->ppar |= ppar;
- }
- }
-}
-#endif
-
-/*
- * Breathe some life into the CPU...
- *
- * Set up the memory map
- * initialize a bunch of registers
- */
-
-void cpu_init_f (void)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_lbc_t *memctl = &immap->im_lbc;
- extern void m8560_cpm_reset (void);
-
- /* Pointer is writable since we allocated a register for it */
- gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
-
- /* Clear initial global data */
- memset ((void *) gd, 0, sizeof (gd_t));
-
-
-#ifdef CONFIG_CPM2
- config_8560_ioports(immap);
-#endif
-
- /* Map banks 0 and 1 to the FLASH banks 0 and 1 at preliminary
- * addresses - these have to be modified later when FLASH size
- * has been determined
- */
-#if defined(CFG_OR0_REMAP)
- memctl->or0 = CFG_OR0_REMAP;
-#endif
-#if defined(CFG_OR1_REMAP)
- memctl->or1 = CFG_OR1_REMAP;
-#endif
-
- /* now restrict to preliminary range */
-#if defined(CFG_BR0_PRELIM) && defined(CFG_OR0_PRELIM)
- memctl->br0 = CFG_BR0_PRELIM;
- memctl->or0 = CFG_OR0_PRELIM;
-#endif
-
-#if defined(CFG_BR1_PRELIM) && defined(CFG_OR1_PRELIM)
- memctl->or1 = CFG_OR1_PRELIM;
- memctl->br1 = CFG_BR1_PRELIM;
-#endif
-
-#if !defined(CONFIG_MPC85xx)
-#if defined(CFG_BR2_PRELIM) && defined(CFG_OR2_PRELIM)
- memctl->or2 = CFG_OR2_PRELIM;
- memctl->br2 = CFG_BR2_PRELIM;
-#endif
-#endif
-
-#if defined(CFG_BR3_PRELIM) && defined(CFG_OR3_PRELIM)
- memctl->or3 = CFG_OR3_PRELIM;
- memctl->br3 = CFG_BR3_PRELIM;
-#endif
-
-#if defined(CFG_BR4_PRELIM) && defined(CFG_OR4_PRELIM)
- memctl->or4 = CFG_OR4_PRELIM;
- memctl->br4 = CFG_BR4_PRELIM;
-#endif
-
-#if defined(CFG_BR5_PRELIM) && defined(CFG_OR5_PRELIM)
- memctl->or5 = CFG_OR5_PRELIM;
- memctl->br5 = CFG_BR5_PRELIM;
-#endif
-
-#if defined(CFG_BR6_PRELIM) && defined(CFG_OR6_PRELIM)
- memctl->or6 = CFG_OR6_PRELIM;
- memctl->br6 = CFG_BR6_PRELIM;
-#endif
-
-#if defined(CFG_BR7_PRELIM) && defined(CFG_OR7_PRELIM)
- memctl->or7 = CFG_OR7_PRELIM;
- memctl->br7 = CFG_BR7_PRELIM;
-#endif
-
-#if defined(CONFIG_CPM2)
- m8560_cpm_reset();
-#endif
-}
-
-
-/*
- * Initialize L2 as cache.
- *
- * The newer 8548, etc, parts have twice as much cache, but
- * use the same bit-encoding as the older 8555, etc, parts.
- *
- * FIXME: Use PVR_VER(pvr) == 1 test here instead of SVR_VER()?
- */
-
-int cpu_init_r(void)
-{
-#if defined(CONFIG_L2_CACHE)
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_l2cache_t *l2cache = &immap->im_l2cache;
- volatile uint cache_ctl;
- uint svr, ver;
-
- svr = get_svr();
- ver = SVR_VER(svr);
-
- asm("msync;isync");
- cache_ctl = l2cache->l2ctl;
-
- switch (cache_ctl & 0x30000000) {
- case 0x20000000:
- if (ver == SVR_8548 || ver == SVR_8548_E) {
- printf ("L2 cache 512KB:");
- } else {
- printf ("L2 cache 256KB:");
- }
- break;
- case 0x00000000:
- case 0x10000000:
- case 0x30000000:
- default:
- printf ("L2 cache unknown size (0x%08x)\n", cache_ctl);
- return -1;
- }
-
- asm("msync;isync");
- l2cache->l2ctl = 0x68000000; /* invalidate */
- cache_ctl = l2cache->l2ctl;
- asm("msync;isync");
-
- l2cache->l2ctl = 0xa8000000; /* enable 256KB L2 cache */
- cache_ctl = l2cache->l2ctl;
- asm("msync;isync");
-
- printf(" enabled\n");
-#else
- printf("L2 cache: disabled\n");
-#endif
-
- return 0;
-}
diff --git a/cpu/mpc85xx/interrupts.c b/cpu/mpc85xx/interrupts.c
deleted file mode 100644
index 832781bab8..0000000000
--- a/cpu/mpc85xx/interrupts.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2002 (440 port)
- * Scott McNutt, Artesyn Communication Producs, smcnutt@artsyncp.com
- *
- * (C) Copyright 2003 Motorola Inc. (MPC85xx port)
- * Xianghua Xiao (X.Xiao@motorola.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <command.h>
-#include <asm/processor.h>
-#include <ppc_asm.tmpl>
-
-unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
-
-static __inline__ unsigned long get_msr(void)
-{
- unsigned long msr;
-
- asm volatile("mfmsr %0" : "=r" (msr) :);
- return msr;
-}
-
-static __inline__ void set_msr(unsigned long msr)
-{
- asm volatile("mtmsr %0" : : "r" (msr));
- asm volatile("isync");
-}
-
-static __inline__ unsigned long get_dec (void)
-{
- unsigned long val;
-
- asm volatile ("mfdec %0":"=r" (val):);
-
- return val;
-}
-
-
-static __inline__ void set_dec (unsigned long val)
-{
- if (val)
- asm volatile ("mtdec %0"::"r" (val));
-}
-
-void enable_interrupts (void)
-{
- set_msr (get_msr() | MSR_EE);
-}
-
-/* returns flag if MSR_EE was set before */
-int disable_interrupts (void)
-{
- ulong msr = get_msr();
- set_msr (msr & ~MSR_EE);
- return ((msr & MSR_EE) != 0);
-}
-
-int interrupt_init (void)
-{
- volatile immap_t *immr = (immap_t *)CFG_IMMR;
-
- immr->im_pic.gcr = MPC85xx_PICGCR_RST;
- while (immr->im_pic.gcr & MPC85xx_PICGCR_RST);
- immr->im_pic.gcr = MPC85xx_PICGCR_M;
- decrementer_count = get_tbclk() / CFG_HZ;
- mtspr(SPRN_TCR, TCR_PIE);
- set_dec (decrementer_count);
- set_msr (get_msr () | MSR_EE);
- return (0);
-}
-
-/*
- * Install and free a interrupt handler. Not implemented yet.
- */
-
-void
-irq_install_handler(int vec, interrupt_handler_t *handler, void *arg)
-{
- return;
-}
-
-void
-irq_free_handler(int vec)
-{
- return;
-}
-
-/****************************************************************************/
-
-
-volatile ulong timestamp = 0;
-
-/*
- * timer_interrupt - gets called when the decrementer overflows,
- * with interrupts disabled.
- * Trivial implementation - no need to be really accurate.
- */
-void timer_interrupt(struct pt_regs *regs)
-{
- timestamp++;
- set_dec (decrementer_count);
- mtspr(SPRN_TSR, TSR_PIS);
-#if defined(CONFIG_WATCHDOG)
- if ((timestamp % 1000) == 0)
- reset_85xx_watchdog();
-#endif /* CONFIG_WATCHDOG */
-}
-
-void reset_timer (void)
-{
- timestamp = 0;
-}
-
-ulong get_timer (ulong base)
-{
- return (timestamp - base);
-}
-
-void set_timer (ulong t)
-{
- timestamp = t;
-}
-
-#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
-
-/*******************************************************************************
- *
- * irqinfo - print information about PCI devices,not implemented.
- *
- */
-int
-do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- printf ("\nInterrupt-unsupported:\n");
-
- return 0;
-}
-
-#endif /* CONFIG_COMMANDS & CFG_CMD_IRQ */
diff --git a/cpu/mpc85xx/pci.c b/cpu/mpc85xx/pci.c
deleted file mode 100644
index 84f839ae1e..0000000000
--- a/cpu/mpc85xx/pci.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright 2004 Freescale Semiconductor.
- * Copyright (C) 2003 Motorola Inc.
- * Xianghua Xiao (x.xiao@motorola.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * PCI Configuration space access support for MPC85xx PCI Bridge
- */
-#include <common.h>
-#include <asm/cpm_85xx.h>
-#include <pci.h>
-
-#if defined(CONFIG_OF_FLAT_TREE)
-#include <ft_build.h>
-#endif
-
-#if defined(CONFIG_PCI)
-
-static struct pci_controller *pci_hose;
-
-void
-pci_mpc85xx_init(struct pci_controller *board_hose)
-{
- u16 reg16;
- u32 dev;
-
- volatile immap_t *immap = (immap_t *)CFG_CCSRBAR;
- volatile ccsr_pcix_t *pcix = &immap->im_pcix;
-#ifdef CONFIG_MPC85XX_PCI2
- volatile ccsr_pcix_t *pcix2 = &immap->im_pcix2;
-#endif
- volatile ccsr_gur_t *gur = &immap->im_gur;
- struct pci_controller * hose;
-
- pci_hose = board_hose;
-
- hose = &pci_hose[0];
-
- hose->first_busno = 0;
- hose->last_busno = 0xff;
-
- pci_setup_indirect(hose,
- (CFG_IMMR+0x8000),
- (CFG_IMMR+0x8004));
-
- /*
- * Hose scan.
- */
- dev = PCI_BDF(hose->first_busno, 0, 0);
- pci_hose_read_config_word (hose, dev, PCI_COMMAND, &reg16);
- reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
- pci_hose_write_config_word(hose, dev, PCI_COMMAND, reg16);
-
- /*
- * Clear non-reserved bits in status register.
- */
- pci_hose_write_config_word(hose, dev, PCI_STATUS, 0xffff);
-
- if (!(gur->pordevsr & PORDEVSR_PCI)) {
- /* PCI-X init */
- if (CONFIG_SYS_CLK_FREQ < 66000000)
- printf("PCI-X will only work at 66 MHz\n");
-
- reg16 = PCI_X_CMD_MAX_SPLIT | PCI_X_CMD_MAX_READ
- | PCI_X_CMD_ERO | PCI_X_CMD_DPERR_E;
- pci_hose_write_config_word(hose, dev, PCIX_COMMAND, reg16);
- }
-
- pcix->potar1 = (CFG_PCI1_MEM_BASE >> 12) & 0x000fffff;
- pcix->potear1 = 0x00000000;
- pcix->powbar1 = (CFG_PCI1_MEM_PHYS >> 12) & 0x000fffff;
- pcix->powbear1 = 0x00000000;
- pcix->powar1 = (POWAR_EN | POWAR_MEM_READ |
- POWAR_MEM_WRITE | POWAR_MEM_512M);
-
- pcix->potar2 = (CFG_PCI1_IO_BASE >> 12) & 0x000fffff;
- pcix->potear2 = 0x00000000;
- pcix->powbar2 = (CFG_PCI1_IO_PHYS >> 12) & 0x000fffff;
- pcix->powbear2 = 0x00000000;
- pcix->powar2 = (POWAR_EN | POWAR_IO_READ |
- POWAR_IO_WRITE | POWAR_IO_1M);
-
- pcix->pitar1 = 0x00000000;
- pcix->piwbar1 = 0x00000000;
- pcix->piwar1 = (PIWAR_EN | PIWAR_PF | PIWAR_LOCAL |
- PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP | PIWAR_MEM_2G);
-
- pcix->powar3 = 0;
- pcix->powar4 = 0;
- pcix->piwar2 = 0;
- pcix->piwar3 = 0;
-
- pci_set_region(hose->regions + 0,
- CFG_PCI1_MEM_BASE,
- CFG_PCI1_MEM_PHYS,
- CFG_PCI1_MEM_SIZE,
- PCI_REGION_MEM);
-
- pci_set_region(hose->regions + 1,
- CFG_PCI1_IO_BASE,
- CFG_PCI1_IO_PHYS,
- CFG_PCI1_IO_SIZE,
- PCI_REGION_IO);
-
- hose->region_count = 2;
-
- pci_register_hose(hose);
-
-#if defined(CONFIG_MPC8555CDS) || defined(CONFIG_MPC8541CDS)
- /*
- * This is a SW workaround for an apparent HW problem
- * in the PCI controller on the MPC85555/41 CDS boards.
- * The first config cycle must be to a valid, known
- * device on the PCI bus in order to trick the PCI
- * controller state machine into a known valid state.
- * Without this, the first config cycle has the chance
- * of hanging the controller permanently, just leaving
- * it in a semi-working state, or leaving it working.
- *
- * Pick on the Tundra, Device 17, to get it right.
- */
- {
- u8 header_type;
-
- pci_hose_read_config_byte(hose,
- PCI_BDF(0,17,0),
- PCI_HEADER_TYPE,
- &header_type);
- }
-#endif
-
- hose->last_busno = pci_hose_scan(hose);
-
-#ifdef CONFIG_MPC85XX_PCI2
- hose = &pci_hose[1];
-
- hose->first_busno = pci_hose[0].last_busno + 1;
- hose->last_busno = 0xff;
-
- pci_setup_indirect(hose,
- (CFG_IMMR+0x9000),
- (CFG_IMMR+0x9004));
-
- dev = PCI_BDF(hose->first_busno, 0, 0);
- pci_hose_read_config_word (hose, dev, PCI_COMMAND, &reg16);
- reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
- pci_hose_write_config_word(hose, dev, PCI_COMMAND, reg16);
-
- /*
- * Clear non-reserved bits in status register.
- */
- pci_hose_write_config_word(hose, dev, PCI_STATUS, 0xffff);
-
- pcix2->potar1 = (CFG_PCI2_MEM_BASE >> 12) & 0x000fffff;
- pcix2->potear1 = 0x00000000;
- pcix2->powbar1 = (CFG_PCI2_MEM_PHYS >> 12) & 0x000fffff;
- pcix2->powbear1 = 0x00000000;
- pcix2->powar1 = (POWAR_EN | POWAR_MEM_READ |
- POWAR_MEM_WRITE | POWAR_MEM_512M);
-
- pcix2->potar2 = (CFG_PCI2_IO_BASE >> 12) & 0x000fffff;
- pcix2->potear2 = 0x00000000;
- pcix2->powbar2 = (CFG_PCI2_IO_PHYS >> 12) & 0x000fffff;
- pcix2->powbear2 = 0x00000000;
- pcix2->powar2 = (POWAR_EN | POWAR_IO_READ |
- POWAR_IO_WRITE | POWAR_IO_1M);
-
- pcix2->pitar1 = 0x00000000;
- pcix2->piwbar1 = 0x00000000;
- pcix2->piwar1 = (PIWAR_EN | PIWAR_PF | PIWAR_LOCAL |
- PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP | PIWAR_MEM_2G);
-
- pcix2->powar3 = 0;
- pcix2->powar4 = 0;
- pcix2->piwar2 = 0;
- pcix2->piwar3 = 0;
-
- pci_set_region(hose->regions + 0,
- CFG_PCI2_MEM_BASE,
- CFG_PCI2_MEM_PHYS,
- CFG_PCI2_MEM_SIZE,
- PCI_REGION_MEM);
-
- pci_set_region(hose->regions + 1,
- CFG_PCI2_IO_BASE,
- CFG_PCI2_IO_PHYS,
- CFG_PCI2_IO_SIZE,
- PCI_REGION_IO);
-
- hose->region_count = 2;
-
- /*
- * Hose scan.
- */
- pci_register_hose(hose);
-
- hose->last_busno = pci_hose_scan(hose);
-#endif
-}
-
-#ifdef CONFIG_OF_FLAT_TREE
-void
-ft_pci_setup(void *blob, bd_t *bd)
-{
- u32 *p;
- int len;
-
- p = (u32 *)ft_get_prop(blob, "/" OF_SOC "/pci@8000/bus-range", &len);
- if (p != NULL) {
- p[0] = pci_hose[0].first_busno;
- p[1] = pci_hose[0].last_busno;
- }
-
-#ifdef CONFIG_MPC85XX_PCI2
- p = (u32 *)ft_get_prop(blob, "/" OF_SOC "/pci@9000/bus-range", &len);
- if (p != NULL) {
- p[0] = pci_hose[1].first_busno;
- p[1] = pci_hose[1].last_busno;
- }
-#endif
-}
-#endif /* CONFIG_OF_FLAT_TREE */
-#endif /* CONFIG_PCI */
diff --git a/cpu/mpc85xx/resetvec.S b/cpu/mpc85xx/resetvec.S
deleted file mode 100644
index 29555d4a00..0000000000
--- a/cpu/mpc85xx/resetvec.S
+++ /dev/null
@@ -1,2 +0,0 @@
- .section .resetvec,"ax"
- b _start_e500
diff --git a/cpu/mpc85xx/spd_sdram.c b/cpu/mpc85xx/spd_sdram.c
deleted file mode 100644
index 4326bb7576..0000000000
--- a/cpu/mpc85xx/spd_sdram.c
+++ /dev/null
@@ -1,1094 +0,0 @@
-/*
- * Copyright 2004 Freescale Semiconductor.
- * (C) Copyright 2003 Motorola Inc.
- * Xianghua Xiao (X.Xiao@motorola.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/processor.h>
-#include <i2c.h>
-#include <spd.h>
-#include <asm/mmu.h>
-
-
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
-extern void dma_init(void);
-extern uint dma_check(void);
-extern int dma_xfer(void *dest, uint count, void *src);
-#endif
-
-#ifdef CONFIG_SPD_EEPROM
-
-#ifndef CFG_READ_SPD
-#define CFG_READ_SPD i2c_read
-#endif
-
-static unsigned int setup_laws_and_tlbs(unsigned int memsize);
-
-
-/*
- * Convert picoseconds into clock cycles (rounding up if needed).
- */
-
-int
-picos_to_clk(int picos)
-{
- int clks;
-
- clks = picos / (2000000000 / (get_bus_freq(0) / 1000));
- if (picos % (2000000000 / (get_bus_freq(0) / 1000)) != 0) {
- clks++;
- }
-
- return clks;
-}
-
-
-/*
- * Calculate the Density of each Physical Rank.
- * Returned size is in bytes.
- *
- * Study these table from Byte 31 of JEDEC SPD Spec.
- *
- * DDR I DDR II
- * Bit Size Size
- * --- ----- ------
- * 7 high 512MB 512MB
- * 6 256MB 256MB
- * 5 128MB 128MB
- * 4 64MB 16GB
- * 3 32MB 8GB
- * 2 16MB 4GB
- * 1 2GB 2GB
- * 0 low 1GB 1GB
- *
- * Reorder Table to be linear by stripping the bottom
- * 2 or 5 bits off and shifting them up to the top.
- */
-
-unsigned int
-compute_banksize(unsigned int mem_type, unsigned char row_dens)
-{
- unsigned int bsize;
-
- if (mem_type == SPD_MEMTYPE_DDR) {
- /* Bottom 2 bits up to the top. */
- bsize = ((row_dens >> 2) | ((row_dens & 3) << 6)) << 24;
- debug("DDR: DDR I rank density = 0x%08x\n", bsize);
- } else {
- /* Bottom 5 bits up to the top. */
- bsize = ((row_dens >> 5) | ((row_dens & 31) << 3)) << 27;
- debug("DDR: DDR II rank density = 0x%08x\n", bsize);
- }
- return bsize;
-}
-
-
-/*
- * Convert a two-nibble BCD value into a cycle time.
- * While the spec calls for nano-seconds, picos are returned.
- *
- * This implements the tables for bytes 9, 23 and 25 for both
- * DDR I and II. No allowance for distinguishing the invalid
- * fields absent for DDR I yet present in DDR II is made.
- * (That is, cycle times of .25, .33, .66 and .75 ns are
- * allowed for both DDR II and I.)
- */
-
-unsigned int
-convert_bcd_tenths_to_cycle_time_ps(unsigned int spd_val)
-{
- /*
- * Table look up the lower nibble, allow DDR I & II.
- */
- unsigned int tenths_ps[16] = {
- 0,
- 100,
- 200,
- 300,
- 400,
- 500,
- 600,
- 700,
- 800,
- 900,
- 250,
- 330,
- 660,
- 750,
- 0, /* undefined */
- 0 /* undefined */
- };
-
- unsigned int whole_ns = (spd_val & 0xF0) >> 4;
- unsigned int tenth_ns = spd_val & 0x0F;
- unsigned int ps = whole_ns * 1000 + tenths_ps[tenth_ns];
-
- return ps;
-}
-
-
-/*
- * Determine Refresh Rate. Ignore self refresh bit on DDR I.
- * Table from SPD Spec, Byte 12, converted to picoseconds and
- * filled in with "default" normal values.
- */
-unsigned int determine_refresh_rate(unsigned int spd_refresh)
-{
- unsigned int refresh_time_ns[8] = {
- 15625000, /* 0 Normal 1.00x */
- 3900000, /* 1 Reduced .25x */
- 7800000, /* 2 Extended .50x */
- 31300000, /* 3 Extended 2.00x */
- 62500000, /* 4 Extended 4.00x */
- 125000000, /* 5 Extended 8.00x */
- 15625000, /* 6 Normal 1.00x filler */
- 15625000, /* 7 Normal 1.00x filler */
- };
-
- return picos_to_clk(refresh_time_ns[spd_refresh & 0x7]);
-}
-
-
-long int
-spd_sdram(void)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_ddr_t *ddr = &immap->im_ddr;
- volatile ccsr_gur_t *gur = &immap->im_gur;
- spd_eeprom_t spd;
- unsigned int n_ranks;
- unsigned int rank_density;
- unsigned int odt_rd_cfg, odt_wr_cfg;
- unsigned int odt_cfg, mode_odt_enable;
- unsigned int refresh_clk;
-#ifdef MPC85xx_DDR_SDRAM_CLK_CNTL
- unsigned char clk_adjust;
-#endif
- unsigned int dqs_cfg;
- unsigned char twr_clk, twtr_clk, twr_auto_clk;
- unsigned int tCKmin_ps, tCKmax_ps;
- unsigned int max_data_rate, effective_data_rate;
- unsigned int busfreq;
- unsigned sdram_cfg;
- unsigned int memsize;
- unsigned char caslat, caslat_ctrl;
- unsigned int trfc, trfc_clk, trfc_low, trfc_high;
- unsigned int trcd_clk;
- unsigned int trtp_clk;
- unsigned char cke_min_clk;
- unsigned char add_lat;
- unsigned char wr_lat;
- unsigned char wr_data_delay;
- unsigned char four_act;
- unsigned char cpo;
- unsigned char burst_len;
- unsigned int mode_caslat;
- unsigned char sdram_type;
- unsigned char d_init;
-
- /*
- * Read SPD information.
- */
- CFG_READ_SPD(SPD_EEPROM_ADDRESS, 0, 1, (uchar *) &spd, sizeof(spd));
-
- /*
- * Check for supported memory module types.
- */
- if (spd.mem_type != SPD_MEMTYPE_DDR &&
- spd.mem_type != SPD_MEMTYPE_DDR2) {
- printf("Unable to locate DDR I or DDR II module.\n"
- " Fundamental memory type is 0x%0x\n",
- spd.mem_type);
- return 0;
- }
-
- /*
- * These test gloss over DDR I and II differences in interpretation
- * of bytes 3 and 4, but irrelevantly. Multiple asymmetric banks
- * are not supported on DDR I; and not encoded on DDR II.
- *
- * Also note that the 8548 controller can support:
- * 12 <= nrow <= 16
- * and
- * 8 <= ncol <= 11 (still, for DDR)
- * 6 <= ncol <= 9 (for FCRAM)
- */
- if (spd.nrow_addr < 12 || spd.nrow_addr > 14) {
- printf("DDR: Unsupported number of Row Addr lines: %d.\n",
- spd.nrow_addr);
- return 0;
- }
- if (spd.ncol_addr < 8 || spd.ncol_addr > 11) {
- printf("DDR: Unsupported number of Column Addr lines: %d.\n",
- spd.ncol_addr);
- return 0;
- }
-
- /*
- * Determine the number of physical banks controlled by
- * different Chip Select signals. This is not quite the
- * same as the number of DIMM modules on the board. Feh.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- n_ranks = spd.nrows;
- } else {
- n_ranks = (spd.nrows & 0x7) + 1;
- }
-
- debug("DDR: number of ranks = %d\n", n_ranks);
-
- if (n_ranks > 2) {
- printf("DDR: Only 2 chip selects are supported: %d\n",
- n_ranks);
- return 0;
- }
-
- /*
- * Adjust DDR II IO voltage biasing. It just makes it work.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR2) {
- gur->ddrioovcr = (0
- | 0x80000000 /* Enable */
- | 0x10000000 /* VSEL to 1.8V */
- );
- }
-
- /*
- * Determine the size of each Rank in bytes.
- */
- rank_density = compute_banksize(spd.mem_type, spd.row_dens);
-
-
- /*
- * Eg: Bounds: 0x0000_0000 to 0x0f000_0000 first 256 Meg
- */
- ddr->cs0_bnds = (rank_density >> 24) - 1;
-
- /*
- * ODT configuration recommendation from DDR Controller Chapter.
- */
- odt_rd_cfg = 0; /* Never assert ODT */
- odt_wr_cfg = 0; /* Never assert ODT */
- if (spd.mem_type == SPD_MEMTYPE_DDR2) {
- odt_wr_cfg = 1; /* Assert ODT on writes to CS0 */
- }
-
- ddr->cs0_config = ( 1 << 31
- | (odt_rd_cfg << 20)
- | (odt_wr_cfg << 16)
- | (spd.nrow_addr - 12) << 8
- | (spd.ncol_addr - 8) );
- debug("\n");
- debug("DDR: cs0_bnds = 0x%08x\n", ddr->cs0_bnds);
- debug("DDR: cs0_config = 0x%08x\n", ddr->cs0_config);
-
- if (n_ranks == 2) {
- /*
- * Eg: Bounds: 0x0f00_0000 to 0x1e0000_0000, second 256 Meg
- */
- ddr->cs1_bnds = ( (rank_density >> 8)
- | ((rank_density >> (24 - 1)) - 1) );
- ddr->cs1_config = ( 1<<31
- | (odt_rd_cfg << 20)
- | (odt_wr_cfg << 16)
- | (spd.nrow_addr - 12) << 8
- | (spd.ncol_addr - 8) );
- debug("DDR: cs1_bnds = 0x%08x\n", ddr->cs1_bnds);
- debug("DDR: cs1_config = 0x%08x\n", ddr->cs1_config);
- }
-
-
- /*
- * Find the largest CAS by locating the highest 1 bit
- * in the spd.cas_lat field. Translate it to a DDR
- * controller field value:
- *
- * CAS Lat DDR I DDR II Ctrl
- * Clocks SPD Bit SPD Bit Value
- * ------- ------- ------- -----
- * 1.0 0 0001
- * 1.5 1 0010
- * 2.0 2 2 0011
- * 2.5 3 0100
- * 3.0 4 3 0101
- * 3.5 5 0110
- * 4.0 4 0111
- * 4.5 1000
- * 5.0 5 1001
- */
- caslat = __ilog2(spd.cas_lat);
- if ((spd.mem_type == SPD_MEMTYPE_DDR)
- && (caslat > 5)) {
- printf("DDR I: Invalid SPD CAS Latency: 0x%x.\n", spd.cas_lat);
- return 0;
-
- } else if (spd.mem_type == SPD_MEMTYPE_DDR2
- && (caslat < 2 || caslat > 5)) {
- printf("DDR II: Invalid SPD CAS Latency: 0x%x.\n",
- spd.cas_lat);
- return 0;
- }
- debug("DDR: caslat SPD bit is %d\n", caslat);
-
- /*
- * Calculate the Maximum Data Rate based on the Minimum Cycle time.
- * The SPD clk_cycle field (tCKmin) is measured in tenths of
- * nanoseconds and represented as BCD.
- */
- tCKmin_ps = convert_bcd_tenths_to_cycle_time_ps(spd.clk_cycle);
- debug("DDR: tCKmin = %d ps\n", tCKmin_ps);
-
- /*
- * Double-data rate, scaled 1000 to picoseconds, and back down to MHz.
- */
- max_data_rate = 2 * 1000 * 1000 / tCKmin_ps;
- debug("DDR: Module max data rate = %d Mhz\n", max_data_rate);
-
-
- /*
- * Adjust the CAS Latency to allow for bus speeds that
- * are slower than the DDR module.
- */
- busfreq = get_bus_freq(0) / 1000000; /* MHz */
-
- effective_data_rate = max_data_rate;
- if (busfreq < 90) {
- /* DDR rate out-of-range */
- puts("DDR: platform frequency is not fit for DDR rate\n");
- return 0;
-
- } else if (90 <= busfreq && busfreq < 230 && max_data_rate >= 230) {
- /*
- * busfreq 90~230 range, treated as DDR 200.
- */
- effective_data_rate = 200;
- if (spd.clk_cycle3 == 0xa0) /* 10 ns */
- caslat -= 2;
- else if (spd.clk_cycle2 == 0xa0)
- caslat--;
-
- } else if (230 <= busfreq && busfreq < 280 && max_data_rate >= 280) {
- /*
- * busfreq 230~280 range, treated as DDR 266.
- */
- effective_data_rate = 266;
- if (spd.clk_cycle3 == 0x75) /* 7.5 ns */
- caslat -= 2;
- else if (spd.clk_cycle2 == 0x75)
- caslat--;
-
- } else if (280 <= busfreq && busfreq < 350 && max_data_rate >= 350) {
- /*
- * busfreq 280~350 range, treated as DDR 333.
- */
- effective_data_rate = 333;
- if (spd.clk_cycle3 == 0x60) /* 6.0 ns */
- caslat -= 2;
- else if (spd.clk_cycle2 == 0x60)
- caslat--;
-
- } else if (350 <= busfreq && busfreq < 460 && max_data_rate >= 460) {
- /*
- * busfreq 350~460 range, treated as DDR 400.
- */
- effective_data_rate = 400;
- if (spd.clk_cycle3 == 0x50) /* 5.0 ns */
- caslat -= 2;
- else if (spd.clk_cycle2 == 0x50)
- caslat--;
-
- } else if (460 <= busfreq && busfreq < 560 && max_data_rate >= 560) {
- /*
- * busfreq 460~560 range, treated as DDR 533.
- */
- effective_data_rate = 533;
- if (spd.clk_cycle3 == 0x3D) /* 3.75 ns */
- caslat -= 2;
- else if (spd.clk_cycle2 == 0x3D)
- caslat--;
-
- } else if (560 <= busfreq && busfreq < 700 && max_data_rate >= 700) {
- /*
- * busfreq 560~700 range, treated as DDR 667.
- */
- effective_data_rate = 667;
- if (spd.clk_cycle3 == 0x30) /* 3.0 ns */
- caslat -= 2;
- else if (spd.clk_cycle2 == 0x30)
- caslat--;
-
- } else if (700 <= busfreq) {
- /*
- * DDR rate out-of-range
- */
- printf("DDR: Bus freq %d MHz is not fit for DDR rate %d MHz\n",
- busfreq, max_data_rate);
- return 0;
- }
-
-
- /*
- * Convert caslat clocks to DDR controller value.
- * Force caslat_ctrl to be DDR Controller field-sized.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- caslat_ctrl = (caslat + 1) & 0x07;
- } else {
- caslat_ctrl = (2 * caslat - 1) & 0x0f;
- }
-
- debug("DDR: effective data rate is %d MHz\n", effective_data_rate);
- debug("DDR: caslat SPD bit is %d, controller field is 0x%x\n",
- caslat, caslat_ctrl);
-
- /*
- * Timing Config 0.
- * Avoid writing for DDR I. The new PQ38 DDR controller
- * dreams up non-zero default values to be backwards compatible.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR2) {
- unsigned char taxpd_clk = 8; /* By the book. */
- unsigned char tmrd_clk = 2; /* By the book. */
- unsigned char act_pd_exit = 2; /* Empirical? */
- unsigned char pre_pd_exit = 6; /* Empirical? */
-
- ddr->timing_cfg_0 = (0
- | ((act_pd_exit & 0x7) << 20) /* ACT_PD_EXIT */
- | ((pre_pd_exit & 0x7) << 16) /* PRE_PD_EXIT */
- | ((taxpd_clk & 0xf) << 8) /* ODT_PD_EXIT */
- | ((tmrd_clk & 0xf) << 0) /* MRS_CYC */
- );
- debug("DDR: timing_cfg_0 = 0x%08x\n", ddr->timing_cfg_0);
-
- } else {
- }
-
-
- /*
- * Some Timing Config 1 values now.
- * Sneak Extended Refresh Recovery in here too.
- */
-
- /*
- * For DDR I, WRREC(Twr) and WRTORD(Twtr) are not in SPD,
- * use conservative value.
- * For DDR II, they are bytes 36 and 37, in quarter nanos.
- */
-
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- twr_clk = 3; /* Clocks */
- twtr_clk = 1; /* Clocks */
- } else {
- twr_clk = picos_to_clk(spd.twr * 250);
- twtr_clk = picos_to_clk(spd.twtr * 250);
- }
-
- /*
- * Calculate Trfc, in picos.
- * DDR I: Byte 42 straight up in ns.
- * DDR II: Byte 40 and 42 swizzled some, in ns.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- trfc = spd.trfc * 1000; /* up to ps */
- } else {
- unsigned int byte40_table_ps[8] = {
- 0,
- 250,
- 330,
- 500,
- 660,
- 750,
- 0,
- 0
- };
-
- trfc = (((spd.trctrfc_ext & 0x1) * 256) + spd.trfc) * 1000
- + byte40_table_ps[(spd.trctrfc_ext >> 1) & 0x7];
- }
- trfc_clk = picos_to_clk(trfc);
-
- /*
- * Trcd, Byte 29, from quarter nanos to ps and clocks.
- */
- trcd_clk = picos_to_clk(spd.trcd * 250) & 0x7;
-
- /*
- * Convert trfc_clk to DDR controller fields. DDR I should
- * fit in the REFREC field (16-19) of TIMING_CFG_1, but the
- * 8548 controller has an extended REFREC field of three bits.
- * The controller automatically adds 8 clocks to this value,
- * so preadjust it down 8 first before splitting it up.
- */
- trfc_low = (trfc_clk - 8) & 0xf;
- trfc_high = ((trfc_clk - 8) >> 4) & 0x3;
-
- /*
- * Sneak in some Extended Refresh Recovery.
- */
- ddr->ext_refrec = (trfc_high << 16);
- debug("DDR: ext_refrec = 0x%08x\n", ddr->ext_refrec);
-
- ddr->timing_cfg_1 =
- (0
- | ((picos_to_clk(spd.trp * 250) & 0x07) << 28) /* PRETOACT */
- | ((picos_to_clk(spd.tras * 1000) & 0x0f ) << 24) /* ACTTOPRE */
- | (trcd_clk << 20) /* ACTTORW */
- | (caslat_ctrl << 16) /* CASLAT */
- | (trfc_low << 12) /* REFEC */
- | ((twr_clk & 0x07) << 8) /* WRRREC */
- | ((picos_to_clk(spd.trrd * 250) & 0x07) << 4) /* ACTTOACT */
- | ((twtr_clk & 0x07) << 0) /* WRTORD */
- );
-
- debug("DDR: timing_cfg_1 = 0x%08x\n", ddr->timing_cfg_1);
-
-
- /*
- * Timing_Config_2
- * Was: 0x00000800;
- */
-
- /*
- * Additive Latency
- * For DDR I, 0.
- * For DDR II, with ODT enabled, use "a value" less than ACTTORW,
- * which comes from Trcd, and also note that:
- * add_lat + caslat must be >= 4
- */
- add_lat = 0;
- if (spd.mem_type == SPD_MEMTYPE_DDR2
- && (odt_wr_cfg || odt_rd_cfg)
- && (caslat < 4)) {
- add_lat = 4 - caslat;
- if (add_lat > trcd_clk) {
- add_lat = trcd_clk - 1;
- }
- }
-
- /*
- * Write Data Delay
- * Historically 0x2 == 4/8 clock delay.
- * Empirically, 0x3 == 6/8 clock delay is suggested for DDR I 266.
- */
- wr_data_delay = 3;
-
- /*
- * Write Latency
- * Read to Precharge
- * Minimum CKE Pulse Width.
- * Four Activate Window
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- /*
- * This is a lie. It should really be 1, but if it is
- * set to 1, bits overlap into the old controller's
- * otherwise unused ACSM field. If we leave it 0, then
- * the HW will magically treat it as 1 for DDR 1. Oh Yea.
- */
- wr_lat = 0;
-
- trtp_clk = 2; /* By the book. */
- cke_min_clk = 1; /* By the book. */
- four_act = 1; /* By the book. */
-
- } else {
- wr_lat = caslat - 1;
-
- /* Convert SPD value from quarter nanos to picos. */
- trtp_clk = picos_to_clk(spd.trtp * 250);
-
- cke_min_clk = 3; /* By the book. */
- four_act = picos_to_clk(37500); /* By the book. 1k pages? */
- }
-
- /*
- * Empirically set ~MCAS-to-preamble override for DDR 2.
- * Your milage will vary.
- */
- cpo = 0;
- if (spd.mem_type == SPD_MEMTYPE_DDR2) {
- if (effective_data_rate == 266 || effective_data_rate == 333) {
- cpo = 0x7; /* READ_LAT + 5/4 */
- } else if (effective_data_rate == 400) {
- cpo = 0x9; /* READ_LAT + 7/4 */
- } else {
- /* Pure speculation */
- cpo = 0xb;
- }
- }
-
- ddr->timing_cfg_2 = (0
- | ((add_lat & 0x7) << 28) /* ADD_LAT */
- | ((cpo & 0x1f) << 23) /* CPO */
- | ((wr_lat & 0x7) << 19) /* WR_LAT */
- | ((trtp_clk & 0x7) << 13) /* RD_TO_PRE */
- | ((wr_data_delay & 0x7) << 10) /* WR_DATA_DELAY */
- | ((cke_min_clk & 0x7) << 6) /* CKE_PLS */
- | ((four_act & 0x1f) << 0) /* FOUR_ACT */
- );
-
- debug("DDR: timing_cfg_2 = 0x%08x\n", ddr->timing_cfg_2);
-
-
- /*
- * Determine the Mode Register Set.
- *
- * This is nominally part specific, but it appears to be
- * consistent for all DDR I devices, and for all DDR II devices.
- *
- * caslat must be programmed
- * burst length is always 4
- * burst type is sequential
- *
- * For DDR I:
- * operating mode is "normal"
- *
- * For DDR II:
- * other stuff
- */
-
- mode_caslat = 0;
-
- /*
- * Table lookup from DDR I or II Device Operation Specs.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- if (1 <= caslat && caslat <= 4) {
- unsigned char mode_caslat_table[4] = {
- 0x5, /* 1.5 clocks */
- 0x2, /* 2.0 clocks */
- 0x6, /* 2.5 clocks */
- 0x3 /* 3.0 clocks */
- };
- mode_caslat = mode_caslat_table[caslat - 1];
- } else {
- puts("DDR I: Only CAS Latencies of 1.5, 2.0, "
- "2.5 and 3.0 clocks are supported.\n");
- return 0;
- }
-
- } else {
- if (2 <= caslat && caslat <= 5) {
- mode_caslat = caslat;
- } else {
- puts("DDR II: Only CAS Latencies of 2.0, 3.0, "
- "4.0 and 5.0 clocks are supported.\n");
- return 0;
- }
- }
-
- /*
- * Encoded Burst Lenght of 4.
- */
- burst_len = 2; /* Fiat. */
-
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- twr_auto_clk = 0; /* Historical */
- } else {
- /*
- * Determine tCK max in picos. Grab tWR and convert to picos.
- * Auto-precharge write recovery is:
- * WR = roundup(tWR_ns/tCKmax_ns).
- *
- * Ponder: Is twr_auto_clk different than twr_clk?
- */
- tCKmax_ps = convert_bcd_tenths_to_cycle_time_ps(spd.tckmax);
- twr_auto_clk = (spd.twr * 250 + tCKmax_ps - 1) / tCKmax_ps;
- }
-
-
- /*
- * Mode Reg in bits 16 ~ 31,
- * Extended Mode Reg 1 in bits 0 ~ 15.
- */
- mode_odt_enable = 0x0; /* Default disabled */
- if (odt_wr_cfg || odt_rd_cfg) {
- /*
- * Bits 6 and 2 in Extended MRS(1)
- * Bit 2 == 0x04 == 75 Ohm, with 2 DIMM modules.
- * Bit 6 == 0x40 == 150 Ohm, with 1 DIMM module.
- */
- mode_odt_enable = 0x40; /* 150 Ohm */
- }
-
- ddr->sdram_mode =
- (0
- | (add_lat << (16 + 3)) /* Additive Latency in EMRS1 */
- | (mode_odt_enable << 16) /* ODT Enable in EMRS1 */
- | (twr_auto_clk << 9) /* Write Recovery Autopre */
- | (mode_caslat << 4) /* caslat */
- | (burst_len << 0) /* Burst length */
- );
-
- debug("DDR: sdram_mode = 0x%08x\n", ddr->sdram_mode);
-
-
- /*
- * Clear EMRS2 and EMRS3.
- */
- ddr->sdram_mode_2 = 0;
- debug("DDR: sdram_mode_2 = 0x%08x\n", ddr->sdram_mode_2);
-
- /*
- * Determine Refresh Rate.
- */
- refresh_clk = determine_refresh_rate(spd.refresh & 0x7);
-
- /*
- * Set BSTOPRE to 0x100 for page mode
- * If auto-charge is used, set BSTOPRE = 0
- */
- ddr->sdram_interval =
- (0
- | (refresh_clk & 0x3fff) << 16
- | 0x100
- );
- debug("DDR: sdram_interval = 0x%08x\n", ddr->sdram_interval);
-
- /*
- * Is this an ECC DDR chip?
- * But don't mess with it if the DDR controller will init mem.
- */
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
- if (spd.config == 0x02) {
- ddr->err_disable = 0x0000000d;
- ddr->err_sbe = 0x00ff0000;
- }
- debug("DDR: err_disable = 0x%08x\n", ddr->err_disable);
- debug("DDR: err_sbe = 0x%08x\n", ddr->err_sbe);
-#endif
-
- asm("sync;isync;msync");
- udelay(500);
-
- /*
- * SDRAM Cfg 2
- */
-
- /*
- * When ODT is enabled, Chap 9 suggests asserting ODT to
- * internal IOs only during reads.
- */
- odt_cfg = 0;
- if (odt_rd_cfg | odt_wr_cfg) {
- odt_cfg = 0x2; /* ODT to IOs during reads */
- }
-
- /*
- * Try to use differential DQS with DDR II.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- dqs_cfg = 0; /* No Differential DQS for DDR I */
- } else {
- dqs_cfg = 0x1; /* Differential DQS for DDR II */
- }
-
-#if defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
- /*
- * Use the DDR controller to auto initialize memory.
- */
- d_init = 1;
- ddr->sdram_data_init = CONFIG_MEM_INIT_VALUE;
- debug("DDR: ddr_data_init = 0x%08x\n", ddr->sdram_data_init);
-#else
- /*
- * Memory will be initialized via DMA, or not at all.
- */
- d_init = 0;
-#endif
-
- ddr->sdram_cfg_2 = (0
- | (dqs_cfg << 26) /* Differential DQS */
- | (odt_cfg << 21) /* ODT */
- | (d_init << 4) /* D_INIT auto init DDR */
- );
-
- debug("DDR: sdram_cfg_2 = 0x%08x\n", ddr->sdram_cfg_2);
-
-
-#ifdef MPC85xx_DDR_SDRAM_CLK_CNTL
- /*
- * Setup the clock control.
- * SDRAM_CLK_CNTL[0] = Source synchronous enable == 1
- * SDRAM_CLK_CNTL[5-7] = Clock Adjust
- * 0110 3/4 cycle late
- * 0111 7/8 cycle late
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR)
- clk_adjust = 0x6;
- else
- clk_adjust = 0x7;
-
- ddr->sdram_clk_cntl = (0
- | 0x80000000
- | (clk_adjust << 23)
- );
- debug("DDR: sdram_clk_cntl = 0x%08x\n", ddr->sdram_clk_cntl);
-#endif
-
- /*
- * Figure out the settings for the sdram_cfg register.
- * Build up the entire register in 'sdram_cfg' before writing
- * since the write into the register will actually enable the
- * memory controller; all settings must be done before enabling.
- *
- * sdram_cfg[0] = 1 (ddr sdram logic enable)
- * sdram_cfg[1] = 1 (self-refresh-enable)
- * sdram_cfg[5:7] = (SDRAM type = DDR SDRAM)
- * 010 DDR 1 SDRAM
- * 011 DDR 2 SDRAM
- */
- sdram_type = (spd.mem_type == SPD_MEMTYPE_DDR) ? 2 : 3;
- sdram_cfg = (0
- | (1 << 31) /* Enable */
- | (1 << 30) /* Self refresh */
- | (sdram_type << 24) /* SDRAM type */
- );
-
- /*
- * sdram_cfg[3] = RD_EN - registered DIMM enable
- * A value of 0x26 indicates micron registered DIMMS (micron.com)
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR && spd.mod_attr == 0x26) {
- sdram_cfg |= 0x10000000; /* RD_EN */
- }
-
-#if defined(CONFIG_DDR_ECC)
- /*
- * If the user wanted ECC (enabled via sdram_cfg[2])
- */
- if (spd.config == 0x02) {
- sdram_cfg |= 0x20000000; /* ECC_EN */
- }
-#endif
-
- /*
- * REV1 uses 1T timing.
- * REV2 may use 1T or 2T as configured by the user.
- */
- {
- uint pvr = get_pvr();
-
- if (pvr != PVR_85xx_REV1) {
-#if defined(CONFIG_DDR_2T_TIMING)
- /*
- * Enable 2T timing by setting sdram_cfg[16].
- */
- sdram_cfg |= 0x8000; /* 2T_EN */
-#endif
- }
- }
-
- /*
- * 200 painful micro-seconds must elapse between
- * the DDR clock setup and the DDR config enable.
- */
- udelay(200);
-
- /*
- * Go!
- */
- ddr->sdram_cfg = sdram_cfg;
-
- asm("sync;isync;msync");
- udelay(500);
-
- debug("DDR: sdram_cfg = 0x%08x\n", ddr->sdram_cfg);
-
-
-#if defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
- /*
- * Poll until memory is initialized.
- * 512 Meg at 400 might hit this 200 times or so.
- */
- while ((ddr->sdram_cfg_2 & (d_init << 4)) != 0) {
- udelay(1000);
- }
-#endif
-
-
- /*
- * Figure out memory size in Megabytes.
- */
- memsize = n_ranks * rank_density / 0x100000;
-
- /*
- * Establish Local Access Window and TLB mappings for DDR memory.
- */
- memsize = setup_laws_and_tlbs(memsize);
- if (memsize == 0) {
- return 0;
- }
-
- return memsize * 1024 * 1024;
-}
-
-
-/*
- * Setup Local Access Window and TLB1 mappings for the requested
- * amount of memory. Returns the amount of memory actually mapped
- * (usually the original request size), or 0 on error.
- */
-
-static unsigned int
-setup_laws_and_tlbs(unsigned int memsize)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_local_ecm_t *ecm = &immap->im_local_ecm;
- unsigned int tlb_size;
- unsigned int law_size;
- unsigned int ram_tlb_index;
- unsigned int ram_tlb_address;
-
- /*
- * Determine size of each TLB1 entry.
- */
- switch (memsize) {
- case 16:
- case 32:
- tlb_size = BOOKE_PAGESZ_16M;
- break;
- case 64:
- case 128:
- tlb_size = BOOKE_PAGESZ_64M;
- break;
- case 256:
- case 512:
- case 1024:
- case 2048:
- tlb_size = BOOKE_PAGESZ_256M;
- break;
- default:
- puts("DDR: only 16M,32M,64M,128M,256M,512M,1G and 2G are supported.\n");
-
- /*
- * The memory was not able to be mapped.
- */
- return 0;
- break;
- }
-
- /*
- * Configure DDR TLB1 entries.
- * Starting at TLB1 8, use no more than 8 TLB1 entries.
- */
- ram_tlb_index = 8;
- ram_tlb_address = (unsigned int)CFG_DDR_SDRAM_BASE;
- while (ram_tlb_address < (memsize * 1024 * 1024)
- && ram_tlb_index < 16) {
- mtspr(MAS0, TLB1_MAS0(1, ram_tlb_index, 0));
- mtspr(MAS1, TLB1_MAS1(1, 1, 0, 0, tlb_size));
- mtspr(MAS2, TLB1_MAS2(E500_TLB_EPN(ram_tlb_address),
- 0, 0, 0, 0, 0, 0, 0, 0));
- mtspr(MAS3, TLB1_MAS3(E500_TLB_RPN(ram_tlb_address),
- 0, 0, 0, 0, 0, 1, 0, 1, 0, 1));
- asm volatile("isync;msync;tlbwe;isync");
-
- debug("DDR: MAS0=0x%08x\n", TLB1_MAS0(1, ram_tlb_index, 0));
- debug("DDR: MAS1=0x%08x\n", TLB1_MAS1(1, 1, 0, 0, tlb_size));
- debug("DDR: MAS2=0x%08x\n",
- TLB1_MAS2(E500_TLB_EPN(ram_tlb_address),
- 0, 0, 0, 0, 0, 0, 0, 0));
- debug("DDR: MAS3=0x%08x\n",
- TLB1_MAS3(E500_TLB_RPN(ram_tlb_address),
- 0, 0, 0, 0, 0, 1, 0, 1, 0, 1));
-
- ram_tlb_address += (0x1000 << ((tlb_size - 1) * 2));
- ram_tlb_index++;
- }
-
-
- /*
- * First supported LAW size is 16M, at LAWAR_SIZE_16M == 23. Fnord.
- */
- law_size = 19 + __ilog2(memsize);
-
- /*
- * Set up LAWBAR for all of DDR.
- */
- ecm->lawbar1 = ((CFG_DDR_SDRAM_BASE >> 12) & 0xfffff);
- ecm->lawar1 = (LAWAR_EN
- | LAWAR_TRGT_IF_DDR
- | (LAWAR_SIZE & law_size));
- debug("DDR: LAWBAR1=0x%08x\n", ecm->lawbar1);
- debug("DDR: LARAR1=0x%08x\n", ecm->lawar1);
-
- /*
- * Confirm that the requested amount of memory was mapped.
- */
- return memsize;
-}
-
-#endif /* CONFIG_SPD_EEPROM */
-
-
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
-
-/*
- * Initialize all of memory for ECC, then enable errors.
- */
-
-void
-ddr_enable_ecc(unsigned int dram_size)
-{
- uint *p = 0;
- uint i = 0;
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_ddr_t *ddr= &immap->im_ddr;
-
- dma_init();
-
- for (*p = 0; p < (uint *)(8 * 1024); p++) {
- if (((unsigned int)p & 0x1f) == 0) {
- ppcDcbz((unsigned long) p);
- }
- *p = (unsigned int)CONFIG_MEM_INIT_VALUE;
- if (((unsigned int)p & 0x1c) == 0x1c) {
- ppcDcbf((unsigned long) p);
- }
- }
-
- dma_xfer((uint *)0x002000, 0x002000, (uint *)0); /* 8K */
- dma_xfer((uint *)0x004000, 0x004000, (uint *)0); /* 16K */
- dma_xfer((uint *)0x008000, 0x008000, (uint *)0); /* 32K */
- dma_xfer((uint *)0x010000, 0x010000, (uint *)0); /* 64K */
- dma_xfer((uint *)0x020000, 0x020000, (uint *)0); /* 128k */
- dma_xfer((uint *)0x040000, 0x040000, (uint *)0); /* 256k */
- dma_xfer((uint *)0x080000, 0x080000, (uint *)0); /* 512k */
- dma_xfer((uint *)0x100000, 0x100000, (uint *)0); /* 1M */
- dma_xfer((uint *)0x200000, 0x200000, (uint *)0); /* 2M */
- dma_xfer((uint *)0x400000, 0x400000, (uint *)0); /* 4M */
-
- for (i = 1; i < dram_size / 0x800000; i++) {
- dma_xfer((uint *)(0x800000*i), 0x800000, (uint *)0);
- }
-
- /*
- * Enable errors for ECC.
- */
- debug("DMA DDR: err_disable = 0x%08x\n", ddr->err_disable);
- ddr->err_disable = 0x00000000;
- asm("sync;isync;msync");
- debug("DMA DDR: err_disable = 0x%08x\n", ddr->err_disable);
-}
-
-#endif /* CONFIG_DDR_ECC && ! CONFIG_ECC_INIT_VIA_DDRCONTROLLER */
diff --git a/cpu/mpc85xx/speed.c b/cpu/mpc85xx/speed.c
deleted file mode 100644
index ca81ee7352..0000000000
--- a/cpu/mpc85xx/speed.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2004 Freescale Semiconductor.
- * (C) Copyright 2003 Motorola Inc.
- * Xianghua Xiao, (X.Xiao@motorola.com)
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <ppc_asm.tmpl>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/* --------------------------------------------------------------- */
-
-void get_sys_info (sys_info_t * sysInfo)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_gur_t *gur = &immap->im_gur;
- uint plat_ratio,e500_ratio;
-
- plat_ratio = (gur->porpllsr) & 0x0000003e;
- plat_ratio >>= 1;
- switch(plat_ratio) {
- case 0x02:
- case 0x03:
- case 0x04:
- case 0x05:
- case 0x06:
- case 0x08:
- case 0x09:
- case 0x0a:
- case 0x0c:
- case 0x10:
- sysInfo->freqSystemBus = plat_ratio * CONFIG_SYS_CLK_FREQ;
- break;
- default:
- sysInfo->freqSystemBus = 0;
- break;
- }
-
- e500_ratio = (gur->porpllsr) & 0x003f0000;
- e500_ratio >>= 16;
- switch(e500_ratio) {
- case 0x04:
- sysInfo->freqProcessor = 2*sysInfo->freqSystemBus;
- break;
- case 0x05:
- sysInfo->freqProcessor = 5*sysInfo->freqSystemBus/2;
- break;
- case 0x06:
- sysInfo->freqProcessor = 3*sysInfo->freqSystemBus;
- break;
- case 0x07:
- sysInfo->freqProcessor = 7*sysInfo->freqSystemBus/2;
- break;
- default:
- sysInfo->freqProcessor = 0;
- break;
- }
-}
-
-int get_clocks (void)
-{
- sys_info_t sys_info;
-#if defined(CONFIG_CPM2)
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- uint sccr, dfbrg;
-
- /* set VCO = 4 * BRG */
- immap->im_cpm.im_cpm_intctl.sccr &= 0xfffffffc;
- sccr = immap->im_cpm.im_cpm_intctl.sccr;
- dfbrg = (sccr & SCCR_DFBRG_MSK) >> SCCR_DFBRG_SHIFT;
-#endif
- get_sys_info (&sys_info);
- gd->cpu_clk = sys_info.freqProcessor;
- gd->bus_clk = sys_info.freqSystemBus;
-#if defined(CONFIG_CPM2)
- gd->vco_out = 2*sys_info.freqSystemBus;
- gd->cpm_clk = gd->vco_out / 2;
- gd->scc_clk = gd->vco_out / 4;
- gd->brg_clk = gd->vco_out / (1 << (2 * (dfbrg + 1)));
-#endif
-
- if(gd->cpu_clk != 0) return (0);
- else return (1);
-}
-
-
-/********************************************
- * get_bus_freq
- * return system bus freq in Hz
- *********************************************/
-ulong get_bus_freq (ulong dummy)
-{
- ulong val;
-
- sys_info_t sys_info;
-
- get_sys_info (&sys_info);
- val = sys_info.freqSystemBus;
-
- return val;
-}
diff --git a/cpu/mpc85xx/start.S b/cpu/mpc85xx/start.S
deleted file mode 100644
index 222b31441a..0000000000
--- a/cpu/mpc85xx/start.S
+++ /dev/null
@@ -1,1147 +0,0 @@
-/*
- * Copyright 2004 Freescale Semiconductor.
- * Copyright (C) 2003 Motorola,Inc.
- * Xianghua Xiao<X.Xiao@motorola.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* U-Boot Startup Code for Motorola 85xx PowerPC based Embedded Boards
- *
- * The processor starts at 0xfffffffc and the code is first executed in the
- * last 4K page(0xfffff000-0xffffffff) in flash/rom.
- *
- */
-
-#include <config.h>
-#include <mpc85xx.h>
-#include <version.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-#undef MSR_KERNEL
-#define MSR_KERNEL ( MSR_ME ) /* Machine Check */
-
-/*
- * Set up GOT: Global Offset Table
- *
- * Use r14 to access the GOT
- */
- START_GOT
- GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_FIXUP_TABLE_)
-
- GOT_ENTRY(_start)
- GOT_ENTRY(_start_of_vectors)
- GOT_ENTRY(_end_of_vectors)
- GOT_ENTRY(transfer_to_handler)
-
- GOT_ENTRY(__init_end)
- GOT_ENTRY(_end)
- GOT_ENTRY(__bss_start)
- END_GOT
-
-/*
- * e500 Startup -- after reset only the last 4KB of the effective
- * address space is mapped in the MMU L2 TLB1 Entry0. The .bootpg
- * section is located at THIS LAST page and basically does three
- * things: clear some registers, set up exception tables and
- * add more TLB entries for 'larger spaces'(e.g. the boot rom) to
- * continue the boot procedure.
-
- * Once the boot rom is mapped by TLB entries we can proceed
- * with normal startup.
- *
- */
-
- .section .bootpg,"ax"
- .globl _start_e500
-
-_start_e500:
- mfspr r0, PVR
- lis r1, PVR_85xx_REV1@h
- ori r1, r1, PVR_85xx_REV1@l
- cmpw r0, r1
- bne 1f
-
- /* Semi-bogus errata fixup for Rev 1 */
- li r0,0x2000
- mtspr 977,r0
-
- /*
- * Before invalidating MMU L1/L2, read TLB1 Entry 0 and then
- * write it back immediately to fixup a Rev 1 bug (Errata CPU4)
- * for this initial TLB1 entry 0, otherwise the TLB1 entry 0
- * will be invalidated (incorrectly).
- */
- lis r2,0x1000
- mtspr MAS0,r2
- tlbre
- tlbwe
- isync
-
-1:
- /*
- * Clear and set up some registers.
- * Note: Some registers need strict synchronization by
- * sync/mbar/msync/isync when being "mtspr".
- * BookE: isync before PID,tlbivax,tlbwe
- * BookE: isync after MSR,PID; msync_isync after tlbivax & tlbwe
- * E500: msync,isync before L1CSR0
- * E500: isync after BBEAR,BBTAR,BUCSR,DBCR0,DBCR1,HID0,HID1,
- * L1CSR0, L1CSR1, MAS[0,1,2,3,4,6],MMUCSR0, PID[0,1,2],
- * SPEFCSR
- */
-
- /* invalidate d-cache */
- mfspr r0,L1CSR0
- ori r0,r0,0x0002
- msync
- isync
- mtspr L1CSR0,r0
- isync
-
- /* disable d-cache */
- li r0,0x0
- mtspr L1CSR0,r0
-
- /* invalidate i-cache */
- mfspr r0,L1CSR1
- ori r0,r0,0x0002
- mtspr L1CSR1,r0
- isync
-
- /* disable i-cache */
- li r0,0x0
- mtspr L1CSR1,r0
- isync
-
- /* clear registers */
- li r0,0
- mtspr SRR0,r0
- mtspr SRR1,r0
- mtspr CSRR0,r0
- mtspr CSRR1,r0
- mtspr MCSRR0,r0
- mtspr MCSRR1,r0
-
- mtspr ESR,r0
- mtspr MCSR,r0
- mtspr DEAR,r0
-
- /* not needed and conflicts with some debuggers */
- /* mtspr DBCR0,r0 */
- mtspr DBCR1,r0
- mtspr DBCR2,r0
- /* not needed and conflicts with some debuggers */
- /* mtspr IAC1,r0 */
- /* mtspr IAC2,r0 */
- mtspr DAC1,r0
- mtspr DAC2,r0
-
- mfspr r1,DBSR
- mtspr DBSR,r1 /* Clear all valid bits */
-
- mtspr PID0,r0
- mtspr PID1,r0
- mtspr PID2,r0
- mtspr TCR,r0
-
- mtspr BUCSR,r0 /* disable branch prediction */
- mtspr MAS4,r0
- mtspr MAS6,r0
-#if defined(CONFIG_ENABLE_36BIT_PHYS)
- mtspr MAS7,r0
-#endif
- isync
-
- /* Setup interrupt vectors */
- lis r1,TEXT_BASE@h
- mtspr IVPR, r1
-
- li r1,0x0100
- mtspr IVOR0,r1 /* 0: Critical input */
- li r1,0x0200
- mtspr IVOR1,r1 /* 1: Machine check */
- li r1,0x0300
- mtspr IVOR2,r1 /* 2: Data storage */
- li r1,0x0400
- mtspr IVOR3,r1 /* 3: Instruction storage */
- li r1,0x0500
- mtspr IVOR4,r1 /* 4: External interrupt */
- li r1,0x0600
- mtspr IVOR5,r1 /* 5: Alignment */
- li r1,0x0700
- mtspr IVOR6,r1 /* 6: Program check */
- li r1,0x0800
- mtspr IVOR7,r1 /* 7: floating point unavailable */
- li r1,0x0900
- mtspr IVOR8,r1 /* 8: System call */
- /* 9: Auxiliary processor unavailable(unsupported) */
- li r1,0x0a00
- mtspr IVOR10,r1 /* 10: Decrementer */
- li r1,0x0b00
- mtspr IVOR11,r1 /* 11: Interval timer */
- li r1,0x0c00
- mtspr IVOR12,r1 /* 12: Watchdog timer */
- li r1,0x0d00
- mtspr IVOR13,r1 /* 13: Data TLB error */
- li r1,0x0e00
- mtspr IVOR14,r1 /* 14: Instruction TLB error */
- li r1,0x0f00
- mtspr IVOR15,r1 /* 15: Debug */
-
- /*
- * Invalidate MMU L1/L2
- *
- * Note: There is a fixup earlier for Errata CPU4 on
- * Rev 1 parts that must precede this MMU invalidation.
- */
- li r2, 0x001e
- mtspr MMUCSR0, r2
- isync
-
- /*
- * Invalidate all TLB0 entries.
- */
- li r3,4
- li r4,0
- tlbivax r4,r3
- /*
- * To avoid REV1 Errata CPU6 issues, make sure
- * the instruction following tlbivax is not a store.
- */
-
- /*
- * After reset, CCSRBAR is located at CFG_CCSRBAR_DEFAULT, i.e.
- * 0xff700000-0xff800000. We need add a TLB1 entry for this 1MB
- * region before we can access any CCSR registers such as L2
- * registers, Local Access Registers,etc. We will also re-allocate
- * CFG_CCSRBAR_DEFAULT to CFG_CCSRBAR immediately after TLB1 setup.
- *
- * Please refer to board-specif directory for TLB1 entry configuration.
- * (e.g. board/<yourboard>/init.S)
- *
- */
- bl tlb1_entry
- mr r5,r0
- li r1,0x0020 /* max 16 TLB1 plus some TLB0 entries */
- mtctr r1
- lwzu r4,0(r5) /* how many TLB1 entries we actually use */
-
-0: cmpwi r4,0
- beq 1f
- lwzu r0,4(r5)
- lwzu r1,4(r5)
- lwzu r2,4(r5)
- lwzu r3,4(r5)
- mtspr MAS0,r0
- mtspr MAS1,r1
- mtspr MAS2,r2
- mtspr MAS3,r3
- isync
- msync
- tlbwe
- isync
- addi r4,r4,-1
- bdnz 0b
-
-1:
-#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR)
- /* Special sequence needed to update CCSRBAR itself */
- lis r4, CFG_CCSRBAR_DEFAULT@h
- ori r4, r4, CFG_CCSRBAR_DEFAULT@l
-
- lis r5, CFG_CCSRBAR@h
- ori r5, r5, CFG_CCSRBAR@l
- srwi r6,r5,12
- stw r6, 0(r4)
- isync
-
- lis r5, 0xffff
- ori r5,r5,0xf000
- lwz r5, 0(r5)
- isync
-
- lis r3, CFG_CCSRBAR@h
- lwz r5, CFG_CCSRBAR@l(r3)
- isync
-#endif
-
-
- /* set up local access windows, defined at board/<boardname>/init.S */
- lis r7,CFG_CCSRBAR@h
- ori r7,r7,CFG_CCSRBAR@l
-
- bl law_entry
- mr r6,r0
- li r1,0x0007 /* 8 LAWs, but reserve one for boot-over-rio-or-pci */
- mtctr r1
- lwzu r5,0(r6) /* how many windows we actually use */
-
- li r2,0x0c28 /* the first pair is reserved for boot-over-rio-or-pci */
- li r1,0x0c30
-
-0: cmpwi r5,0
- beq 1f
- lwzu r4,4(r6)
- lwzu r3,4(r6)
- stwx r4,r7,r2
- stwx r3,r7,r1
- addi r5,r5,-1
- addi r2,r2,0x0020
- addi r1,r1,0x0020
- bdnz 0b
-
- /* Jump out the last 4K page and continue to 'normal' start */
-1: bl 3f
- b _start
-
-3: li r0,0
- mtspr SRR1,r0 /* Keep things disabled for now */
- mflr r1
- mtspr SRR0,r1
- rfi
-
-/*
- * r3 - 1st arg to board_init(): IMMP pointer
- * r4 - 2nd arg to board_init(): boot flag
- */
- .text
- .long 0x27051956 /* U-BOOT Magic Number */
- .globl version_string
-
- . = EXC_OFF_SYS_RESET
- .globl _start
-_start:
- /* Clear and set up some registers. */
- li r0,0x0000
- lis r1,0xffff
- mtspr DEC,r0 /* prevent dec exceptions */
- mttbl r0 /* prevent fit & wdt exceptions */
- mttbu r0
- mtspr TSR,r1 /* clear all timer exception status */
- mtspr TCR,r0 /* disable all */
- mtspr ESR,r0 /* clear exception syndrome register */
- mtspr MCSR,r0 /* machine check syndrome register */
- mtxer r0 /* clear integer exception register */
- lis r1,0x0002 /* set CE bit (Critical Exceptions) */
- ori r1,r1,0x1200 /* set ME/DE bit */
- mtmsr r1 /* change MSR */
- isync
-
- /* Enable Time Base and Select Time Base Clock */
- lis r0,HID0_EMCP@h /* Enable machine check */
- ori r0,r0,0x4000 /* time base is processor clock */
-#if defined(CONFIG_ENABLE_36BIT_PHYS)
- ori r0,r0,0x0080 /* enable MAS7 updates */
-#endif
- mtspr HID0,r0
-
-#if defined(CONFIG_ADDR_STREAMING)
- li r0,0x3000
-#else
- li r0,0x1000
-#endif
- mtspr HID1,r0
-
- /* Enable Branch Prediction */
-#if defined(CONFIG_BTB)
- li r0,0x201 /* BBFI = 1, BPEN = 1 */
- mtspr BUCSR,r0
-#endif
-
-#if defined(CFG_INIT_DBCR)
- lis r1,0xffff
- ori r1,r1,0xffff
- mtspr DBSR,r1 /* Clear all status bits */
- lis r0,CFG_INIT_DBCR@h /* DBCR0[IDM] must be set */
- ori r0,r0,CFG_INIT_DBCR@l
- mtspr DBCR0,r0
-#endif
-
-/* L1 DCache is used for initial RAM */
- mfspr r2, L1CSR0
- ori r2, r2, 0x0003
- oris r2, r2, 0x0001
- mtspr L1CSR0, r2 /* enable/invalidate L1 Dcache */
- isync
-
- /* Allocate Initial RAM in data cache.
- */
- lis r3, CFG_INIT_RAM_ADDR@h
- ori r3, r3, CFG_INIT_RAM_ADDR@l
- li r2, 512 /* 512*32=16K */
- mtctr r2
- li r0, 0
-1:
- dcbz r0, r3
- dcbtls 0,r0, r3
- addi r3, r3, 32
- bdnz 1b
-
-#ifndef CFG_RAMBOOT
- /* Calculate absolute address in FLASH and jump there */
- /*--------------------------------------------------------------*/
- lis r3, CFG_MONITOR_BASE@h
- ori r3, r3, CFG_MONITOR_BASE@l
- addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
- mtlr r3
- blr
-
-in_flash:
-#endif /* CFG_RAMBOOT */
-
- /* Setup the stack in initial RAM,could be L2-as-SRAM or L1 dcache*/
- lis r1,CFG_INIT_RAM_ADDR@h
- ori r1,r1,CFG_INIT_SP_OFFSET@l
-
- li r0,0
- stwu r0,-4(r1)
- stwu r0,-4(r1) /* Terminate call chain */
-
- stwu r1,-8(r1) /* Save back chain and move SP */
- lis r0,RESET_VECTOR@h /* Address of reset vector */
- ori r0,r0, RESET_VECTOR@l
- stwu r1,-8(r1) /* Save back chain and move SP */
- stw r0,+12(r1) /* Save return addr (underflow vect) */
-
- GET_GOT
- bl cpu_init_f
- bl icache_enable
- bl board_init_f
- isync
-
-/* --FIXME-- machine check with MCSRRn and rfmci */
-
- .globl _start_of_vectors
-_start_of_vectors:
-/* Machine check --FIXME-- Should be MACH_EXCEPTION */
- CRIT_EXCEPTION(0x0200, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. */
- STD_EXCEPTION(0x0300, DataStorage, UnknownException)
-
-/* Instruction Storage exception. */
- STD_EXCEPTION(0x0400, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
- STD_EXCEPTION(0x0500, ExtInterrupt, UnknownException)
-
-/* Alignment exception. */
- . = 0x0600
-Alignment:
- EXCEPTION_PROLOG
- mfspr r4,DAR
- stw r4,_DAR(r21)
- mfspr r5,DSISR
- stw r5,_DSISR(r21)
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_Alignment:
- .long AlignmentException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
- . = 0x0700
-ProgramCheck:
- EXCEPTION_PROLOG
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_ProgramCheck:
- .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
- /* No FPU on MPC85xx. This exception is not supposed to happen.
- */
- STD_EXCEPTION(0x0800, FPUnavailable, UnknownException)
-
- . = 0x0900
-/*
- * r0 - SYSCALL number
- * r3-... arguments
- */
-SystemCall:
- addis r11,r0,0 /* get functions table addr */
- ori r11,r11,0 /* Note: this code is patched in trap_init */
- addis r12,r0,0 /* get number of functions */
- ori r12,r12,0
-
- cmplw 0, r0, r12
- bge 1f
-
- rlwinm r0,r0,2,0,31 /* fn_addr = fn_tbl[r0] */
- add r11,r11,r0
- lwz r11,0(r11)
-
- li r20,0xd00-4 /* Get stack pointer */
- lwz r12,0(r20)
- subi r12,r12,12 /* Adjust stack pointer */
- li r0,0xc00+_end_back-SystemCall
- cmplw 0, r0, r12 /* Check stack overflow */
- bgt 1f
- stw r12,0(r20)
-
- mflr r0
- stw r0,0(r12)
- mfspr r0,SRR0
- stw r0,4(r12)
- mfspr r0,SRR1
- stw r0,8(r12)
-
- li r12,0xc00+_back-SystemCall
- mtlr r12
- mtspr SRR0,r11
-
-1: SYNC
- rfi
-_back:
-
- mfmsr r11 /* Disable interrupts */
- li r12,0
- ori r12,r12,MSR_EE
- andc r11,r11,r12
- SYNC /* Some chip revs need this... */
- mtmsr r11
- SYNC
-
- li r12,0xd00-4 /* restore regs */
- lwz r12,0(r12)
-
- lwz r11,0(r12)
- mtlr r11
- lwz r11,4(r12)
- mtspr SRR0,r11
- lwz r11,8(r12)
- mtspr SRR1,r11
-
- addi r12,r12,12 /* Adjust stack pointer */
- li r20,0xd00-4
- stw r12,0(r20)
-
- SYNC
- rfi
-_end_back:
-
- STD_EXCEPTION(0x0a00, Decrementer, timer_interrupt)
- STD_EXCEPTION(0x0b00, IntervalTimer, UnknownException)
- STD_EXCEPTION(0x0c00, WatchdogTimer, UnknownException)
-
- STD_EXCEPTION(0x0d00, DataTLBError, UnknownException)
- STD_EXCEPTION(0x0e00, InstructionTLBError, UnknownException)
-
- CRIT_EXCEPTION(0x0f00, DebugBreakpoint, DebugException )
-
- .globl _end_of_vectors
-_end_of_vectors:
-
-
- . = 0x2100
-
-/*
- * This code finishes saving the registers to the exception frame
- * and jumps to the appropriate handler for the exception.
- * Register r21 is pointer into trap frame, r1 has new stack pointer.
- */
- .globl transfer_to_handler
-transfer_to_handler:
- stw r22,_NIP(r21)
- lis r22,MSR_POW@h
- andc r23,r23,r22
- stw r23,_MSR(r21)
- SAVE_GPR(7, r21)
- SAVE_4GPRS(8, r21)
- SAVE_8GPRS(12, r21)
- SAVE_8GPRS(24, r21)
-
- mflr r23
- andi. r24,r23,0x3f00 /* get vector offset */
- stw r24,TRAP(r21)
- li r22,0
- stw r22,RESULT(r21)
- mtspr SPRG2,r22 /* r1 is now kernel sp */
-
- lwz r24,0(r23) /* virtual address of handler */
- lwz r23,4(r23) /* where to go when done */
- mtspr SRR0,r24
- mtspr SRR1,r20
- mtlr r23
- SYNC
- rfi /* jump to handler, enable MMU */
-
-int_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr SRR0,r2
- mtspr SRR1,r0
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfi
-
-crit_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr 990,r2 /* SRR2 */
- mtspr 991,r0 /* SRR3 */
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfci
-
-/* Cache functions.
-*/
-invalidate_icache:
- mfspr r0,L1CSR1
- ori r0,r0,0x0002
- mtspr L1CSR1,r0
- isync
- blr /* entire I cache */
-
-invalidate_dcache:
- mfspr r0,L1CSR0
- ori r0,r0,0x0002
- msync
- isync
- mtspr L1CSR0,r0
- isync
- blr
-
- .globl icache_enable
-icache_enable:
- mflr r8
- bl invalidate_icache
- mtlr r8
- isync
- mfspr r4,L1CSR1
- ori r4,r4,0x0001
- oris r4,r4,0x0001
- mtspr L1CSR1,r4
- isync
- blr
-
- .globl icache_disable
-icache_disable:
- mfspr r0,L1CSR1
- lis r1,0xfffffffe@h
- ori r1,r1,0xfffffffe@l
- and r0,r0,r1
- mtspr L1CSR1,r0
- isync
- blr
-
- .globl icache_status
-icache_status:
- mfspr r3,L1CSR1
- andi. r3,r3,1
- blr
-
- .globl dcache_enable
-dcache_enable:
- mflr r8
- bl invalidate_dcache
- mtlr r8
- isync
- mfspr r0,L1CSR0
- ori r0,r0,0x0001
- oris r0,r0,0x0001
- msync
- isync
- mtspr L1CSR0,r0
- isync
- blr
-
- .globl dcache_disable
-dcache_disable:
- mfspr r0,L1CSR0
- lis r1,0xfffffffe@h
- ori r1,r1,0xfffffffe@l
- and r0,r0,r1
- msync
- isync
- mtspr L1CSR0,r0
- isync
- blr
-
- .globl dcache_status
-dcache_status:
- mfspr r3,L1CSR0
- andi. r3,r3,1
- blr
-
- .globl get_pir
-get_pir:
- mfspr r3, PIR
- blr
-
- .globl get_pvr
-get_pvr:
- mfspr r3, PVR
- blr
-
- .globl get_svr
-get_svr:
- mfspr r3, SVR
- blr
-
- .globl wr_tcr
-wr_tcr:
- mtspr TCR, r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: in8 */
-/* Description: Input 8 bits */
-/*------------------------------------------------------------------------------- */
- .globl in8
-in8:
- lbz r3,0x0000(r3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: out8 */
-/* Description: Output 8 bits */
-/*------------------------------------------------------------------------------- */
- .globl out8
-out8:
- stb r4,0x0000(r3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: out16 */
-/* Description: Output 16 bits */
-/*------------------------------------------------------------------------------- */
- .globl out16
-out16:
- sth r4,0x0000(r3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: out16r */
-/* Description: Byte reverse and output 16 bits */
-/*------------------------------------------------------------------------------- */
- .globl out16r
-out16r:
- sthbrx r4,r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: out32 */
-/* Description: Output 32 bits */
-/*------------------------------------------------------------------------------- */
- .globl out32
-out32:
- stw r4,0x0000(r3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: out32r */
-/* Description: Byte reverse and output 32 bits */
-/*------------------------------------------------------------------------------- */
- .globl out32r
-out32r:
- stwbrx r4,r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: in16 */
-/* Description: Input 16 bits */
-/*------------------------------------------------------------------------------- */
- .globl in16
-in16:
- lhz r3,0x0000(r3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: in16r */
-/* Description: Input 16 bits and byte reverse */
-/*------------------------------------------------------------------------------- */
- .globl in16r
-in16r:
- lhbrx r3,r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: in32 */
-/* Description: Input 32 bits */
-/*------------------------------------------------------------------------------- */
- .globl in32
-in32:
- lwz 3,0x0000(3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: in32r */
-/* Description: Input 32 bits and byte reverse */
-/*------------------------------------------------------------------------------- */
- .globl in32r
-in32r:
- lwbrx r3,r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: ppcDcbf */
-/* Description: Data Cache block flush */
-/* Input: r3 = effective address */
-/* Output: none. */
-/*------------------------------------------------------------------------------- */
- .globl ppcDcbf
-ppcDcbf:
- dcbf r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: ppcDcbi */
-/* Description: Data Cache block Invalidate */
-/* Input: r3 = effective address */
-/* Output: none. */
-/*------------------------------------------------------------------------------- */
- .globl ppcDcbi
-ppcDcbi:
- dcbi r0,r3
- blr
-
-/*--------------------------------------------------------------------------
- * Function: ppcDcbz
- * Description: Data Cache block zero.
- * Input: r3 = effective address
- * Output: none.
- *-------------------------------------------------------------------------- */
-
- .globl ppcDcbz
-ppcDcbz:
- dcbz r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: ppcSync */
-/* Description: Processor Synchronize */
-/* Input: none. */
-/* Output: none. */
-/*------------------------------------------------------------------------------- */
- .globl ppcSync
-ppcSync:
- sync
- blr
-
-/*------------------------------------------------------------------------------*/
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
- */
- .globl relocate_code
-relocate_code:
- mr r1, r3 /* Set new stack pointer */
- mr r9, r4 /* Save copy of Init Data pointer */
- mr r10, r5 /* Save copy of Destination Address */
-
- mr r3, r5 /* Destination Address */
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
- lwz r5,GOT(__init_end)
- sub r5,r5,r4
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
- *
- * Offset:
- */
- sub r15, r10, r4
-
- /* First our own GOT */
- add r14, r14, r15
- /* the the one used by the C code */
- add r30, r30, r15
-
- /*
- * Now relocate code
- */
-
- cmplw cr1,r3,r4
- addi r0,r5,3
- srwi. r0,r0,2
- beq cr1,4f /* In place copy is not necessary */
- beq 7f /* Protect against 0 count */
- mtctr r0
- bge cr1,2f
-
- la r8,-4(r4)
- la r7,-4(r3)
-1: lwzu r0,4(r8)
- stwu r0,4(r7)
- bdnz 1b
- b 4f
-
-2: slwi r0,r0,2
- add r8,r4,r0
- add r7,r3,r0
-3: lwzu r0,-4(r8)
- stwu r0,-4(r7)
- bdnz 3b
-
-/*
- * Now flush the cache: note that we must start from a cache aligned
- * address. Otherwise we might miss one cache line.
- */
-4: cmpwi r6,0
- add r5,r3,r5
- beq 7f /* Always flush prefetch queue in any case */
- subi r0,r6,1
- andc r3,r3,r0
- mr r4,r3
-5: dcbst 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 5b
- sync /* Wait for all dcbst to complete on bus */
- mr r4,r3
-6: icbi 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 6b
-7: sync /* Wait for all icbi to complete on bus */
- isync
-
- /*
- * Re-point the IVPR at RAM
- */
- mtspr IVPR,r10
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-
- addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
- mtlr r0
- blr /* NEVER RETURNS! */
-
-in_ram:
-
- /*
- * Relocation Function, r14 point to got2+0x8000
- *
- * Adjust got2 pointers, no need to check for 0, this code
- * already puts a few entries in the table.
- */
- li r0,__got2_entries@sectoff@l
- la r3,GOT(_GOT2_TABLE_)
- lwz r11,GOT(_GOT2_TABLE_)
- mtctr r0
- sub r11,r3,r11
- addi r3,r3,-4
-1: lwzu r0,4(r3)
- add r0,r0,r11
- stw r0,0(r3)
- bdnz 1b
-
- /*
- * Now adjust the fixups and the pointers to the fixups
- * in case we need to move ourselves again.
- */
-2: li r0,__fixup_entries@sectoff@l
- lwz r3,GOT(_FIXUP_TABLE_)
- cmpwi r0,0
- mtctr r0
- addi r3,r3,-4
- beq 4f
-3: lwzu r4,4(r3)
- lwzux r0,r4,r11
- add r0,r0,r11
- stw r10,0(r3)
- stw r0,0(r4)
- bdnz 3b
-4:
-clear_bss:
- /*
- * Now clear BSS segment
- */
- lwz r3,GOT(__bss_start)
- lwz r4,GOT(_end)
-
- cmplw 0, r3, r4
- beq 6f
-
- li r0, 0
-5:
- stw r0, 0(r3)
- addi r3, r3, 4
- cmplw 0, r3, r4
- bne 5b
-6:
-
- mr r3, r9 /* Init Data pointer */
- mr r4, r10 /* Destination Address */
- bl board_init_r
-
- /*
- * Copy exception vector code to low memory
- *
- * r3: dest_addr
- * r7: source address, r8: end address, r9: target address
- */
- .globl trap_init
-trap_init:
- lwz r7, GOT(_start)
- lwz r8, GOT(_end_of_vectors)
-
- li r9, 0x100 /* reset vector always at 0x100 */
-
- cmplw 0, r7, r8
- bgelr /* return if r7>=r8 - just in case */
-
- mflr r4 /* save link register */
-1:
- lwz r0, 0(r7)
- stw r0, 0(r9)
- addi r7, r7, 4
- addi r9, r9, 4
- cmplw 0, r7, r8
- bne 1b
-
- /*
- * relocate `hdlr' and `int_return' entries
- */
- li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
- li r7, .L_DataStorage - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
- li r7, .L_InstStorage - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
- li r7, .L_ExtInterrupt - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
- li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
- li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
- li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
- li r7, .L_Decrementer - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
- li r7, .L_IntervalTimer - _start + EXC_OFF_SYS_RESET
- li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-2:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 2b
-
- lis r7,0x0
- mtspr IVPR, r7
-
- mtlr r4 /* restore link register */
- blr
-
- /*
- * Function: relocate entries for one exception vector
- */
-trap_reloc:
- lwz r0, 0(r7) /* hdlr ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 0(r7)
-
- lwz r0, 4(r7) /* int_return ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 4(r7)
-
- blr
-
-#ifdef CFG_INIT_RAM_LOCK
-.globl unlock_ram_in_cache
-unlock_ram_in_cache:
- /* invalidate the INIT_RAM section */
- lis r3, (CFG_INIT_RAM_ADDR & ~31)@h
- ori r3, r3, (CFG_INIT_RAM_ADDR & ~31)@l
- li r2,512
- mtctr r2
-1: icbi r0, r3
- dcbi r0, r3
- addi r3, r3, 32
- bdnz 1b
- sync /* Wait for all icbi to complete on bus */
- isync
- blr
-#endif
diff --git a/cpu/mpc85xx/traps.c b/cpu/mpc85xx/traps.c
deleted file mode 100644
index 904f052339..0000000000
--- a/cpu/mpc85xx/traps.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * linux/arch/ppc/kernel/traps.c
- *
- * Copyright (C) 2003 Motorola
- * Modified by Xianghua Xiao(x.xiao@motorola.com)
- *
- * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- * Modified by Cort Dougan (cort@cs.nmt.edu)
- * and Paul Mackerras (paulus@cs.anu.edu.au)
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * This file handles the architecture-dependent parts of hardware exceptions
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
-/* Returns 0 if exception not found and fixup otherwise. */
-extern unsigned long search_exception_table(unsigned long);
-
-/*
- * End of memory as shown by board info and determined by DDR setup.
- */
-#define END_OF_MEM (gd->bd->bi_memstart + gd->bd->bi_memsize)
-
-
-static __inline__ void set_tsr(unsigned long val)
-{
- asm volatile("mtspr 0x150, %0" : : "r" (val));
-}
-
-static __inline__ unsigned long get_esr(void)
-{
- unsigned long val;
- asm volatile("mfspr %0, 0x03e" : "=r" (val) :);
- return val;
-}
-
-#define ESR_MCI 0x80000000
-#define ESR_PIL 0x08000000
-#define ESR_PPR 0x04000000
-#define ESR_PTR 0x02000000
-#define ESR_DST 0x00800000
-#define ESR_DIZ 0x00400000
-#define ESR_U0F 0x00008000
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
-extern void do_bedbug_breakpoint(struct pt_regs *);
-#endif
-
-/*
- * Trap & Exception support
- */
-
-void
-print_backtrace(unsigned long *sp)
-{
- int cnt = 0;
- unsigned long i;
-
- printf("Call backtrace: ");
- while (sp) {
- if ((uint)sp > END_OF_MEM)
- break;
-
- i = sp[1];
- if (cnt++ % 7 == 0)
- printf("\n");
- printf("%08lX ", i);
- if (cnt > 32) break;
- sp = (unsigned long *)*sp;
- }
- printf("\n");
-}
-
-void show_regs(struct pt_regs * regs)
-{
- int i;
-
- printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
- regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
- printf("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
- regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
- regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
- regs->msr&MSR_IR ? 1 : 0,
- regs->msr&MSR_DR ? 1 : 0);
-
- printf("\n");
- for (i = 0; i < 32; i++) {
- if ((i % 8) == 0)
- {
- printf("GPR%02d: ", i);
- }
-
- printf("%08lX ", regs->gpr[i]);
- if ((i % 8) == 7)
- {
- printf("\n");
- }
- }
-}
-
-
-void
-_exception(int signr, struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
-}
-
-void
-CritcalInputException(struct pt_regs *regs)
-{
- panic("Critical Input Exception");
-}
-
-void
-MachineCheckException(struct pt_regs *regs)
-{
- unsigned long fixup;
-
- /* Probing PCI using config cycles cause this exception
- * when a device is not present. Catch it and return to
- * the PCI exception handler.
- */
- if ((fixup = search_exception_table(regs->nip)) != 0) {
- regs->nip = fixup;
- return;
- }
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- printf("Machine check in kernel mode.\n");
- printf("Caused by (from msr): ");
- printf("regs %p ",regs);
- switch( regs->msr & 0x000F0000) {
- case (0x80000000>>12):
- printf("Machine check signal - probably due to mm fault\n"
- "with mmu off\n");
- break;
- case (0x80000000>>13):
- printf("Transfer error ack signal\n");
- break;
- case (0x80000000>>14):
- printf("Data parity signal\n");
- break;
- case (0x80000000>>15):
- printf("Address parity signal\n");
- break;
- default:
- printf("Unknown values in msr\n");
- }
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("machine check");
-}
-
-void
-AlignmentException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Alignment Exception");
-}
-
-void
-ProgramCheckException(struct pt_regs *regs)
-{
- long esr_val;
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- show_regs(regs);
-
- esr_val = get_esr();
- if( esr_val & ESR_PIL )
- printf( "** Illegal Instruction **\n" );
- else if( esr_val & ESR_PPR )
- printf( "** Privileged Instruction **\n" );
- else if( esr_val & ESR_PTR )
- printf( "** Trap Instruction **\n" );
-
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Program Check Exception");
-}
-
-void
-PITException(struct pt_regs *regs)
-{
- /*
- * Reset PIT interrupt
- */
- set_tsr(0x0c000000);
-
- /*
- * Call timer_interrupt routine in interrupts.c
- */
- timer_interrupt(NULL);
-}
-
-
-void
-UnknownException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
- regs->nip, regs->msr, regs->trap);
- _exception(0, regs);
-}
-
-void
-DebugException(struct pt_regs *regs)
-{
- printf("Debugger trap at @ %lx\n", regs->nip );
- show_regs(regs);
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
- do_bedbug_breakpoint( regs );
-#endif
-}
-
-/* Probe an address by reading. If not present, return -1, otherwise
- * return 0.
- */
-int
-addr_probe(uint *addr)
-{
- return 0;
-}
diff --git a/cpu/mpc86xx/Makefile b/cpu/mpc86xx/Makefile
deleted file mode 100644
index fffcfd2402..0000000000
--- a/cpu/mpc86xx/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# (C) Copyright 2002,2003 Motorola Inc.
-# Xianghua Xiao,X.Xiao@motorola.com
-#
-# (C) Copyright 2004 Freescale Semiconductor. (MC86xx Port)
-# Jeff Brown
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o #resetvec.o
-SOBJS = cache.o
-COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o \
- pci.o pcie_indirect.o spd_sdram.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(ASOBJS) $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/mpc86xx/cache.S b/cpu/mpc86xx/cache.S
deleted file mode 100644
index f316b3ec13..0000000000
--- a/cpu/mpc86xx/cache.S
+++ /dev/null
@@ -1,374 +0,0 @@
-#include <config.h>
-#include <mpc86xx.h>
-#include <version.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#ifndef CACHE_LINE_SIZE
-# define CACHE_LINE_SIZE L1_CACHE_BYTES
-#endif
-
-#if CACHE_LINE_SIZE == 128
-#define LG_CACHE_LINE_SIZE 7
-#elif CACHE_LINE_SIZE == 32
-#define LG_CACHE_LINE_SIZE 5
-#elif CACHE_LINE_SIZE == 16
-#define LG_CACHE_LINE_SIZE 4
-#elif CACHE_LINE_SIZE == 8
-#define LG_CACHE_LINE_SIZE 3
-#else
-# error "Invalid cache line size!"
-#endif
-
-/*
- * Most of this code is taken from 74xx_7xx/cache.S
- * and then cleaned up a bit
- */
-
-/*
- * Invalidate L1 instruction cache.
- */
-_GLOBAL(invalidate_l1_instruction_cache)
- /* use invalidate-all bit in HID0 */
- mfspr r3,HID0
- ori r3,r3,HID0_ICFI
- mtspr HID0,r3
- isync
- blr
-
-/*
- * Invalidate L1 data cache.
- */
-_GLOBAL(invalidate_l1_data_cache)
- mfspr r3,HID0
- ori r3,r3,HID0_DCFI
- mtspr HID0,r3
- isync
- blr
-
-/*
- * Flush data cache.
- */
-_GLOBAL(flush_data_cache)
- lis r3,0
- lis r5,CACHE_LINE_SIZE
-flush:
- cmp 0,1,r3,r5
- bge done
- lwz r5,0(r3)
- lis r5,CACHE_LINE_SIZE
- addi r3,r3,0x4
- b flush
-done:
- blr
-/*
- * Write any modified data cache blocks out to memory
- * and invalidate the corresponding instruction cache blocks.
- * This is a no-op on the 601.
- *
- * flush_icache_range(unsigned long start, unsigned long stop)
- */
-_GLOBAL(flush_icache_range)
- li r5,CACHE_LINE_SIZE-1
- andc r3,r3,r5
- subf r4,r3,r4
- add r4,r4,r5
- srwi. r4,r4,LG_CACHE_LINE_SIZE
- beqlr
- mtctr r4
- mr r6,r3
-1: dcbst 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- sync /* wait for dcbst's to get to ram */
- mtctr r4
-2: icbi 0,r6
- addi r6,r6,CACHE_LINE_SIZE
- bdnz 2b
- sync /* additional sync needed on g4 */
- isync
- blr
-/*
- * Write any modified data cache blocks out to memory.
- * Does not invalidate the corresponding cache lines (especially for
- * any corresponding instruction cache).
- *
- * clean_dcache_range(unsigned long start, unsigned long stop)
- */
-_GLOBAL(clean_dcache_range)
- li r5,CACHE_LINE_SIZE-1
- andc r3,r3,r5 /* align r3 down to cache line */
- subf r4,r3,r4 /* r4 = offset of stop from start of cache line */
- add r4,r4,r5 /* r4 += cache_line_size-1 */
- srwi. r4,r4,LG_CACHE_LINE_SIZE /* r4 = number of cache lines to flush */
- beqlr /* if r4 == 0 return */
- mtctr r4 /* ctr = r4 */
-
- sync
-1: dcbst 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- sync /* wait for dcbst's to get to ram */
- blr
-
-/*
- * Write any modified data cache blocks out to memory
- * and invalidate the corresponding instruction cache blocks.
- *
- * flush_dcache_range(unsigned long start, unsigned long stop)
- */
-_GLOBAL(flush_dcache_range)
- li r5,CACHE_LINE_SIZE-1
- andc r3,r3,r5
- subf r4,r3,r4
- add r4,r4,r5
- srwi. r4,r4,LG_CACHE_LINE_SIZE
- beqlr
- mtctr r4
-
- sync
-1: dcbf 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- sync /* wait for dcbf's to get to ram */
- blr
-
-/*
- * Like above, but invalidate the D-cache. This is used by the 8xx
- * to invalidate the cache so the PPC core doesn't get stale data
- * from the CPM (no cache snooping here :-).
- *
- * invalidate_dcache_range(unsigned long start, unsigned long stop)
- */
-_GLOBAL(invalidate_dcache_range)
- li r5,CACHE_LINE_SIZE-1
- andc r3,r3,r5
- subf r4,r3,r4
- add r4,r4,r5
- srwi. r4,r4,LG_CACHE_LINE_SIZE
- beqlr
- mtctr r4
-
- sync
-1: dcbi 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- sync /* wait for dcbi's to get to ram */
- blr
-
-/*
- * Flush a particular page from the data cache to RAM.
- * Note: this is necessary because the instruction cache does *not*
- * snoop from the data cache.
- *
- * void __flush_page_to_ram(void *page)
- */
-_GLOBAL(__flush_page_to_ram)
- rlwinm r3,r3,0,0,19 /* Get page base address */
- li r4,4096/CACHE_LINE_SIZE /* Number of lines in a page */
- mtctr r4
- mr r6,r3
-0: dcbst 0,r3 /* Write line to ram */
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 0b
- sync
- mtctr r4
-1: icbi 0,r6
- addi r6,r6,CACHE_LINE_SIZE
- bdnz 1b
- sync
- isync
- blr
-
-/*
- * Flush a particular page from the instruction cache.
- * Note: this is necessary because the instruction cache does *not*
- * snoop from the data cache.
- *
- * void __flush_icache_page(void *page)
- */
-_GLOBAL(__flush_icache_page)
- li r4,4096/CACHE_LINE_SIZE /* Number of lines in a page */
- mtctr r4
-1: icbi 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- sync
- isync
- blr
-
-/*
- * Clear a page using the dcbz instruction, which doesn't cause any
- * memory traffic (except to write out any cache lines which get
- * displaced). This only works on cacheable memory.
- */
-_GLOBAL(clear_page)
- li r0,4096/CACHE_LINE_SIZE
- mtctr r0
-1: dcbz 0,r3
- addi r3,r3,CACHE_LINE_SIZE
- bdnz 1b
- blr
-
-/*
- * Enable L1 Instruction cache
- */
-_GLOBAL(icache_enable)
- mfspr r3, HID0
- li r5, HID0_ICFI|HID0_ILOCK
- andc r3, r3, r5
- ori r3, r3, HID0_ICE
- ori r5, r3, HID0_ICFI
- mtspr HID0, r5
- mtspr HID0, r3
- isync
- blr
-
-/*
- * Disable L1 Instruction cache
- */
-_GLOBAL(icache_disable)
- mfspr r3, HID0
- li r5, 0
- ori r5, r5, HID0_ICE
- andc r3, r3, r5
- mtspr HID0, r3
- isync
- blr
-
-/*
- * Is instruction cache enabled?
- */
-_GLOBAL(icache_status)
- mfspr r3, HID0
- andi. r3, r3, HID0_ICE
- blr
-
-
-_GLOBAL(l1dcache_enable)
- mfspr r3, HID0
- li r5, HID0_DCFI|HID0_DLOCK
- andc r3, r3, r5
- mtspr HID0, r3 /* no invalidate, unlock */
- ori r3, r3, HID0_DCE
- ori r5, r3, HID0_DCFI
- mtspr HID0, r5 /* enable + invalidate */
- mtspr HID0, r3 /* enable */
- sync
- blr
-
-/*
- * Enable data cache(s) - L1 and optionally L2
- * Calls l2cache_enable. LR saved in r5
- */
-_GLOBAL(dcache_enable)
- mfspr r3, HID0
- li r5, HID0_DCFI|HID0_DLOCK
- andc r3, r3, r5
- mtspr HID0, r3 /* no invalidate, unlock */
- ori r3, r3, HID0_DCE
- ori r5, r3, HID0_DCFI
- mtspr HID0, r5 /* enable + invalidate */
- mtspr HID0, r3 /* enable */
- sync
-#ifdef CFG_L2
- mflr r5
- bl l2cache_enable /* uses r3 and r4 */
- sync
- mtlr r5
-#endif
- blr
-
-
-/*
- * Disable data cache(s) - L1 and optionally L2
- * Calls flush_data_cache and l2cache_disable_no_flush.
- * LR saved in r4
- */
-_GLOBAL(dcache_disable)
- mflr r4 /* save link register */
- bl flush_data_cache /* uses r3 and r5 */
- sync
- mfspr r3, HID0
- li r5, HID0_DCFI|HID0_DLOCK
- andc r3, r3, r5
- mtspr HID0, r3 /* no invalidate, unlock */
- li r5, HID0_DCE|HID0_DCFI
- andc r3, r3, r5 /* no enable, no invalidate */
- mtspr HID0, r3
- sync
-#ifdef CFG_L2
- bl l2cache_disable_no_flush /* uses r3 */
-#endif
- mtlr r4 /* restore link register */
- blr
-
-/*
- * Is data cache enabled?
- */
-_GLOBAL(dcache_status)
- mfspr r3, HID0
- andi. r3, r3, HID0_DCE
- blr
-
-/*
- * Invalidate L2 cache using L2I, assume L2 is enabled
- */
-_GLOBAL(l2cache_invalidate)
- mfspr r3, l2cr
- rlwinm. r3, r3, 0, 0, 0
- beq 1f
-
- mfspr r3, l2cr
- rlwinm r3, r3, 0, 1, 31
-
-#ifdef CONFIG_ALTIVEC
- dssall
-#endif
- sync
- mtspr l2cr, r3
- sync
-1: mfspr r3, l2cr
- oris r3, r3, L2CR_L2I@h
- mtspr l2cr, r3
-
-invl2:
- mfspr r3, l2cr
- andi. r3, r3, L2CR_L2I@h
- bne invl2
- blr
-
-/*
- * Enable L2 cache
- * Calls l2cache_invalidate. LR is saved in r4
- */
-_GLOBAL(l2cache_enable)
- mflr r4 /* save link register */
- bl l2cache_invalidate /* uses r3 */
- sync
- lis r3, L2_ENABLE@h
- ori r3, r3, L2_ENABLE@l
- mtspr l2cr, r3
- isync
- mtlr r4 /* restore link register */
- blr
-
-/*
- * Disable L2 cache
- * Calls flush_data_cache. LR is saved in r4
- */
-_GLOBAL(l2cache_disable)
- mflr r4 /* save link register */
- bl flush_data_cache /* uses r3 and r5 */
- sync
- mtlr r4 /* restore link register */
-l2cache_disable_no_flush: /* provide way to disable L2 w/o flushing */
- lis r3, L2_INIT@h
- ori r3, r3, L2_INIT@l
- mtspr l2cr, r3
- isync
- blr
diff --git a/cpu/mpc86xx/config.mk b/cpu/mpc86xx/config.mk
deleted file mode 100644
index 3c54f4ad39..0000000000
--- a/cpu/mpc86xx/config.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# (C) Copyright 2004 Freescale Semiconductor.
-# Jeff Brown
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_MPC86xx -ffixed-r2 -ffixed-r29 -mstring
diff --git a/cpu/mpc86xx/cpu.c b/cpu/mpc86xx/cpu.c
deleted file mode 100644
index 551b243076..0000000000
--- a/cpu/mpc86xx/cpu.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Copyright 2006 Freescale Semiconductor
- * Jeff Brown
- * Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <command.h>
-#include <asm/cache.h>
-#include <mpc86xx.h>
-
-#if defined(CONFIG_OF_FLAT_TREE)
-#include <ft_build.h>
-#endif
-
-#ifdef CONFIG_MPC8641HPCN
-extern void mpc8641_reset_board(cmd_tbl_t *cmdtp, int flag,
- int argc, char *argv[]);
-#endif
-
-
-int
-checkcpu(void)
-{
- sys_info_t sysinfo;
- uint pvr, svr;
- uint ver;
- uint major, minor;
- uint lcrr; /* local bus clock ratio register */
- uint clkdiv; /* clock divider portion of lcrr */
-
- puts("Freescale PowerPC\n");
-
- pvr = get_pvr();
- ver = PVR_VER(pvr);
- major = PVR_MAJ(pvr);
- minor = PVR_MIN(pvr);
-
- puts("CPU:\n");
- puts(" Core: ");
-
- switch (ver) {
- case PVR_VER(PVR_86xx):
- puts("E600");
- break;
- default:
- puts("Unknown");
- break;
- }
- printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr);
-
- svr = get_svr();
- ver = SVR_VER(svr);
- major = SVR_MAJ(svr);
- minor = SVR_MIN(svr);
-
- puts(" System: ");
- switch (ver) {
- case SVR_8641:
- if (SVR_SUBVER(svr) == 1) {
- puts("8641D");
- } else {
- puts("8641");
- }
- break;
- default:
- puts("Unknown");
- break;
- }
- printf(", Version: %d.%d, (0x%08x)\n", major, minor, svr);
-
- get_sys_info(&sysinfo);
-
- puts(" Clocks: ");
- printf("CPU:%4lu MHz, ", sysinfo.freqProcessor / 1000000);
- printf("MPX:%4lu MHz, ", sysinfo.freqSystemBus / 1000000);
- printf("DDR:%4lu MHz, ", sysinfo.freqSystemBus / 2000000);
-
-#if defined(CFG_LBC_LCRR)
- lcrr = CFG_LBC_LCRR;
-#else
- {
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- volatile ccsr_lbc_t *lbc = &immap->im_lbc;
-
- lcrr = lbc->lcrr;
- }
-#endif
- clkdiv = lcrr & 0x0f;
- if (clkdiv == 2 || clkdiv == 4 || clkdiv == 8) {
- printf("LBC:%4lu MHz\n",
- sysinfo.freqSystemBus / 1000000 / clkdiv);
- } else {
- printf(" LBC: unknown (lcrr: 0x%08x)\n", lcrr);
- }
-
- puts(" L2: ");
- if (get_l2cr() & 0x80000000)
- puts("Enabled\n");
- else
- puts("Disabled\n");
-
- return 0;
-}
-
-
-static inline void
-soft_restart(unsigned long addr)
-{
-#ifndef CONFIG_MPC8641HPCN
-
- /*
- * SRR0 has system reset vector, SRR1 has default MSR value
- * rfi restores MSR from SRR1 and sets the PC to the SRR0 value
- */
-
- __asm__ __volatile__ ("mtspr 26, %0" :: "r" (addr));
- __asm__ __volatile__ ("li 4, (1 << 6)" ::: "r4");
- __asm__ __volatile__ ("mtspr 27, 4");
- __asm__ __volatile__ ("rfi");
-
-#else /* CONFIG_MPC8641HPCN */
-
- out8(PIXIS_BASE + PIXIS_RST, 0);
-
-#endif /* !CONFIG_MPC8641HPCN */
-
- while (1) ; /* not reached */
-}
-
-
-/*
- * No generic way to do board reset. Simply call soft_reset.
- */
-void
-do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-#ifndef CONFIG_MPC8641HPCN
-
-#ifdef CFG_RESET_ADDRESS
- ulong addr = CFG_RESET_ADDRESS;
-#else
- /*
- * note: when CFG_MONITOR_BASE points to a RAM address,
- * CFG_MONITOR_BASE - sizeof (ulong) is usually a valid
- * address. Better pick an address known to be invalid on your
- * system and assign it to CFG_RESET_ADDRESS.
- */
- ulong addr = CFG_MONITOR_BASE - sizeof(ulong);
-#endif
-
- /* flush and disable I/D cache */
- __asm__ __volatile__ ("mfspr 3, 1008" ::: "r3");
- __asm__ __volatile__ ("ori 5, 5, 0xcc00" ::: "r5");
- __asm__ __volatile__ ("ori 4, 3, 0xc00" ::: "r4");
- __asm__ __volatile__ ("andc 5, 3, 5" ::: "r5");
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("mtspr 1008, 4");
- __asm__ __volatile__ ("isync");
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("mtspr 1008, 5");
- __asm__ __volatile__ ("isync");
- __asm__ __volatile__ ("sync");
-
- soft_restart(addr);
-
-#else /* CONFIG_MPC8641HPCN */
-
- mpc8641_reset_board(cmdtp, flag, argc, argv);
-
-#endif /* !CONFIG_MPC8641HPCN */
-
- while (1) ; /* not reached */
-}
-
-
-/*
- * Get timebase clock frequency
- */
-unsigned long
-get_tbclk(void)
-{
- sys_info_t sys_info;
-
- get_sys_info(&sys_info);
- return (sys_info.freqSystemBus + 3L) / 4L;
-}
-
-
-#if defined(CONFIG_WATCHDOG)
-void
-watchdog_reset(void)
-{
-}
-#endif /* CONFIG_WATCHDOG */
-
-
-#if defined(CONFIG_DDR_ECC)
-void
-dma_init(void)
-{
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- volatile ccsr_dma_t *dma = &immap->im_dma;
-
- dma->satr0 = 0x00040000;
- dma->datr0 = 0x00040000;
- asm("sync; isync");
-}
-
-uint
-dma_check(void)
-{
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- volatile ccsr_dma_t *dma = &immap->im_dma;
- volatile uint status = dma->sr0;
-
- /* While the channel is busy, spin */
- while ((status & 4) == 4) {
- status = dma->sr0;
- }
-
- if (status != 0) {
- printf("DMA Error: status = %x\n", status);
- }
- return status;
-}
-
-int
-dma_xfer(void *dest, uint count, void *src)
-{
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- volatile ccsr_dma_t *dma = &immap->im_dma;
-
- dma->dar0 = (uint) dest;
- dma->sar0 = (uint) src;
- dma->bcr0 = count;
- dma->mr0 = 0xf000004;
- asm("sync;isync");
- dma->mr0 = 0xf000005;
- asm("sync;isync");
- return dma_check();
-}
-
-#endif /* CONFIG_DDR_ECC */
-
-
-#ifdef CONFIG_OF_FLAT_TREE
-void
-ft_cpu_setup(void *blob, bd_t *bd)
-{
- u32 *p;
- ulong clock;
- int len;
-
- clock = bd->bi_busfreq;
- p = ft_get_prop(blob, "/cpus/" OF_CPU "/bus-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(clock);
-
- p = ft_get_prop(blob, "/" OF_SOC "/serial@4500/clock-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(clock);
-
- p = ft_get_prop(blob, "/" OF_SOC "/serial@4600/clock-frequency", &len);
- if (p != NULL)
- *p = cpu_to_be32(clock);
-
-#if defined(CONFIG_MPC86XX_TSEC1)
- p = ft_get_prop(blob, "/" OF_SOC "/ethernet@24000/mac-address", &len);
- memcpy(p, bd->bi_enetaddr, 6);
-#endif
-
-#if defined(CONFIG_MPC86XX_TSEC2)
- p = ft_get_prop(blob, "/" OF_SOC "/ethernet@25000/mac-address", &len);
- memcpy(p, bd->bi_enet1addr, 6);
-#endif
-
-#if defined(CONFIG_MPC86XX_TSEC3)
- p = ft_get_prop(blob, "/" OF_SOC "/ethernet@26000/mac-address", &len);
- memcpy(p, bd->bi_enet2addr, 6);
-#endif
-
-#if defined(CONFIG_MPC86XX_TSEC4)
- p = ft_get_prop(blob, "/" OF_SOC "/ethernet@27000/mac-address", &len);
- memcpy(p, bd->bi_enet3addr, 6);
-#endif
-
-}
-#endif
diff --git a/cpu/mpc86xx/cpu_init.c b/cpu/mpc86xx/cpu_init.c
deleted file mode 100644
index 4673d05e71..0000000000
--- a/cpu/mpc86xx/cpu_init.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2004 Freescale Semiconductor.
- * Jeff Brown
- * Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * cpu_init.c - low level cpu init
- */
-
-#include <common.h>
-#include <mpc86xx.h>
-
-/*
- * Breathe some life into the CPU...
- *
- * Set up the memory map
- * initialize a bunch of registers
- */
-
-void cpu_init_f(void)
-{
- DECLARE_GLOBAL_DATA_PTR;
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_lbc_t *memctl = &immap->im_lbc;
-
- /* Pointer is writable since we allocated a register for it */
- gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
-
- /* Clear initial global data */
- memset ((void *) gd, 0, sizeof (gd_t));
-
- /* Map banks 0 and 1 to the FLASH banks 0 and 1 at preliminary
- * addresses - these have to be modified later when FLASH size
- * has been determined
- */
-
-#if defined(CFG_OR0_REMAP)
- memctl->or0 = CFG_OR0_REMAP;
-#endif
-#if defined(CFG_OR1_REMAP)
- memctl->or1 = CFG_OR1_REMAP;
-#endif
-
- /* now restrict to preliminary range */
-#if defined(CFG_BR0_PRELIM) && defined(CFG_OR0_PRELIM)
- memctl->br0 = CFG_BR0_PRELIM;
- memctl->or0 = CFG_OR0_PRELIM;
-#endif
-
-#if defined(CFG_BR1_PRELIM) && defined(CFG_OR1_PRELIM)
- memctl->or1 = CFG_OR1_PRELIM;
- memctl->br1 = CFG_BR1_PRELIM;
-#endif
-
-#if defined(CFG_BR2_PRELIM) && defined(CFG_OR2_PRELIM)
- memctl->or2 = CFG_OR2_PRELIM;
- memctl->br2 = CFG_BR2_PRELIM;
-#endif
-
-#if defined(CFG_BR3_PRELIM) && defined(CFG_OR3_PRELIM)
- memctl->or3 = CFG_OR3_PRELIM;
- memctl->br3 = CFG_BR3_PRELIM;
-#endif
-
-#if defined(CFG_BR4_PRELIM) && defined(CFG_OR4_PRELIM)
- memctl->or4 = CFG_OR4_PRELIM;
- memctl->br4 = CFG_BR4_PRELIM;
-#endif
-
-#if defined(CFG_BR5_PRELIM) && defined(CFG_OR5_PRELIM)
- memctl->or5 = CFG_OR5_PRELIM;
- memctl->br5 = CFG_BR5_PRELIM;
-#endif
-
-#if defined(CFG_BR6_PRELIM) && defined(CFG_OR6_PRELIM)
- memctl->or6 = CFG_OR6_PRELIM;
- memctl->br6 = CFG_BR6_PRELIM;
-#endif
-
-#if defined(CFG_BR7_PRELIM) && defined(CFG_OR7_PRELIM)
- memctl->or7 = CFG_OR7_PRELIM;
- memctl->br7 = CFG_BR7_PRELIM;
-#endif
-
- /* enable the timebase bit in HID0 */
- set_hid0(get_hid0() | 0x4000000);
-
- /* enable SYNCBE | ABE bits in HID1 */
- set_hid1(get_hid1() | 0x00000C00);
-}
-
-/*
- * initialize higher level parts of CPU like timers
- */
-int cpu_init_r(void)
-{
- return 0;
-}
diff --git a/cpu/mpc86xx/interrupts.c b/cpu/mpc86xx/interrupts.c
deleted file mode 100644
index 1df6cdc5b9..0000000000
--- a/cpu/mpc86xx/interrupts.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2002 (440 port)
- * Scott McNutt, Artesyn Communication Producs, smcnutt@artsyncp.com
- *
- * (C) Copyright 2003 Motorola Inc. (MPC85xx port)
- * Xianghua Xiao (X.Xiao@motorola.com)
- *
- * (C) Copyright 2004 Freescale Semiconductor. (MPC86xx Port)
- * Jeff Brown
- * Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc86xx.h>
-#include <command.h>
-#include <asm/processor.h>
-#include <ppc_asm.tmpl>
-
-unsigned long decrementer_count; /* count value for 1e6/HZ microseconds */
-unsigned long timestamp;
-
-
-static __inline__ unsigned long get_msr(void)
-{
- unsigned long msr;
-
- asm volatile ("mfmsr %0":"=r" (msr):);
-
- return msr;
-}
-
-static __inline__ void set_msr(unsigned long msr)
-{
- asm volatile ("mtmsr %0"::"r" (msr));
-}
-
-static __inline__ unsigned long get_dec(void)
-{
- unsigned long val;
-
- asm volatile ("mfdec %0":"=r" (val):);
-
- return val;
-}
-
-static __inline__ void set_dec(unsigned long val)
-{
- if (val)
- asm volatile ("mtdec %0"::"r" (val));
-}
-
-/* interrupt is not supported yet */
-int interrupt_init_cpu(unsigned *decrementer_count)
-{
- return 0;
-}
-
-int interrupt_init(void)
-{
- int ret;
-
- /* call cpu specific function from $(CPU)/interrupts.c */
- ret = interrupt_init_cpu(&decrementer_count);
-
- if (ret)
- return ret;
-
- decrementer_count = get_tbclk() / CFG_HZ;
- debug("interrupt init: tbclk() = %d MHz, decrementer_count = %d\n",
- (get_tbclk() / 1000000),
- decrementer_count);
-
- set_dec(decrementer_count);
-
- set_msr(get_msr() | MSR_EE);
-
- debug("MSR = 0x%08lx, Decrementer reg = 0x%08lx\n",
- get_msr(),
- get_dec());
-
- return 0;
-}
-
-void enable_interrupts(void)
-{
- set_msr(get_msr() | MSR_EE);
-}
-
-/* returns flag if MSR_EE was set before */
-int disable_interrupts(void)
-{
- ulong msr = get_msr();
-
- set_msr(msr & ~MSR_EE);
- return (msr & MSR_EE) != 0;
-}
-
-void increment_timestamp(void)
-{
- timestamp++;
-}
-
-/*
- * timer_interrupt - gets called when the decrementer overflows,
- * with interrupts disabled.
- * Trivial implementation - no need to be really accurate.
- */
-void timer_interrupt_cpu(struct pt_regs *regs)
-{
- /* nothing to do here */
-}
-
-void timer_interrupt(struct pt_regs *regs)
-{
- /* call cpu specific function from $(CPU)/interrupts.c */
- timer_interrupt_cpu(regs);
-
- timestamp++;
-
- ppcDcbf(&timestamp);
-
- /* Restore Decrementer Count */
- set_dec(decrementer_count);
-
-#if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG)
- if ((timestamp % (CFG_WATCHDOG_FREQ)) == 0)
- WATCHDOG_RESET();
-#endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */
-
-#ifdef CONFIG_STATUS_LED
- status_led_tick(timestamp);
-#endif /* CONFIG_STATUS_LED */
-
-#ifdef CONFIG_SHOW_ACTIVITY
- board_show_activity(timestamp);
-#endif /* CONFIG_SHOW_ACTIVITY */
-
-}
-
-void reset_timer(void)
-{
- timestamp = 0;
-}
-
-ulong get_timer(ulong base)
-{
- return timestamp - base;
-}
-
-void set_timer(ulong t)
-{
- timestamp = t;
-}
-
-/*
- * Install and free a interrupt handler. Not implemented yet.
- */
-
-void irq_install_handler(int vec, interrupt_handler_t *handler, void *arg)
-{
-}
-
-void irq_free_handler(int vec)
-{
-}
-
-/*
- * irqinfo - print information about PCI devices,not implemented.
- */
-int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- printf("\nInterrupt-unsupported:\n");
-
- return 0;
-}
-
-/*
- * Handle external interrupts
- */
-void external_interrupt(struct pt_regs *regs)
-{
- puts("external_interrupt (oops!)\n");
-}
diff --git a/cpu/mpc86xx/pci.c b/cpu/mpc86xx/pci.c
deleted file mode 100644
index b86548db4f..0000000000
--- a/cpu/mpc86xx/pci.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) Freescale Semiconductor,Inc.
- * 2005, 2006. All rights reserved.
- *
- * Ed Swarthout (ed.swarthout@freescale.com)
- * Jason Jin (Jason.jin@freescale.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * PCIE Configuration space access support for PCIE Bridge
- */
-#include <common.h>
-#include <pci.h>
-
-#if defined(CONFIG_PCI)
-void
-pci_mpc86xx_init(struct pci_controller *hose)
-{
- volatile immap_t *immap = (immap_t *) CFG_CCSRBAR;
- volatile ccsr_pex_t *pcie1 = &immap->im_pex1;
- u16 temp16;
- u32 temp32;
-
- volatile ccsr_gur_t *gur = &immap->im_gur;
- uint host1_agent = (gur->porbmsr & MPC86xx_PORBMSR_HA) >> 17;
- uint pcie1_host = (host1_agent == 2) || (host1_agent == 3);
- uint pcie1_agent = (host1_agent == 0) || (host1_agent == 1);
- uint devdisr = gur->devdisr;
- uint io_sel = (gur->pordevsr & MPC86xx_PORDEVSR_IO_SEL) >> 16;
-
- if ((io_sel == 2 || io_sel == 3 || io_sel == 5 || io_sel == 6 ||
- io_sel == 7 || io_sel == 0xf)
- && !(devdisr & MPC86xx_DEVDISR_PCIEX1)) {
- printf("PCI-EXPRESS 1: Configured as %s \n",
- pcie1_agent ? "Agent" : "Host");
- if (pcie1_agent)
- return; /*Don't scan bus when configured as agent */
- printf(" Scanning PCIE bus");
- debug("0x%08x=0x%08x ",
- &pcie1->pme_msg_det,
- pcie1->pme_msg_det);
- if (pcie1->pme_msg_det) {
- pcie1->pme_msg_det = 0xffffffff;
- debug(" with errors. Clearing. Now 0x%08x",
- pcie1->pme_msg_det);
- }
- debug("\n");
- } else {
- printf("PCI-EXPRESS 1 disabled!\n");
- return;
- }
-
- /*
- * Set first_bus=0 only skipped B0:D0:F0 which is
- * a reserved device in M1575, but make it easy for
- * most of the scan process.
- */
- hose->first_busno = 0x00;
- hose->last_busno = 0xfe;
-
- pcie_setup_indirect(hose, (CFG_IMMR + 0x8000), (CFG_IMMR + 0x8004));
-
- pci_hose_read_config_word(hose,
- PCI_BDF(0, 0, 0), PCI_COMMAND, &temp16);
- temp16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER |
- PCI_COMMAND_MEMORY | PCI_COMMAND_IO;
- pci_hose_write_config_word(hose,
- PCI_BDF(0, 0, 0), PCI_COMMAND, temp16);
-
- pci_hose_write_config_word(hose, PCI_BDF(0, 0, 0), PCI_STATUS, 0xffff);
- pci_hose_write_config_byte(hose,
- PCI_BDF(0, 0, 0), PCI_LATENCY_TIMER, 0x80);
-
- pci_hose_read_config_dword(hose, PCI_BDF(0, 0, 0), PCI_PRIMARY_BUS,
- &temp32);
- temp32 = (temp32 & 0xff000000) | (0xff) | (0x0 << 8) | (0xfe << 16);
- pci_hose_write_config_dword(hose, PCI_BDF(0, 0, 0), PCI_PRIMARY_BUS,
- temp32);
-
- pcie1->powar1 = 0;
- pcie1->powar2 = 0;
- pcie1->piwar1 = 0;
- pcie1->piwar1 = 0;
-
- pcie1->powbar1 = (CFG_PCI1_MEM_BASE >> 12) & 0x000fffff;
- pcie1->powar1 = 0x8004401c; /* 512M MEM space */
- pcie1->potar1 = (CFG_PCI1_MEM_BASE >> 12) & 0x000fffff;
- pcie1->potear1 = 0x00000000;
-
- pcie1->powbar2 = (CFG_PCI1_IO_BASE >> 12) & 0x000fffff;
- pcie1->powar2 = 0x80088017; /* 16M IO space */
- pcie1->potar2 = 0x00000000;
- pcie1->potear2 = 0x00000000;
-
- pcie1->pitar1 = 0x00000000;
- pcie1->piwbar1 = 0x00000000;
- /* Enable, Prefetch, Local Mem, * Snoop R/W, 2G */
- pcie1->piwar1 = 0xa0f5501e;
-
- pci_set_region(hose->regions + 0,
- CFG_PCI_MEMORY_BUS,
- CFG_PCI_MEMORY_PHYS,
- CFG_PCI_MEMORY_SIZE,
- PCI_REGION_MEM | PCI_REGION_MEMORY);
-
- pci_set_region(hose->regions + 1,
- CFG_PCI1_MEM_BASE,
- CFG_PCI1_MEM_PHYS,
- CFG_PCI1_MEM_SIZE,
- PCI_REGION_MEM);
-
- pci_set_region(hose->regions + 2,
- CFG_PCI1_IO_BASE,
- CFG_PCI1_IO_PHYS,
- CFG_PCI1_IO_SIZE,
- PCI_REGION_IO);
-
- hose->region_count = 3;
-
- pci_register_hose(hose);
-
- hose->last_busno = pci_hose_scan(hose);
- debug("pcie_mpc86xx_init: last_busno %x\n", hose->last_busno);
- debug("pcie_mpc86xx init: current_busno %x\n ", hose->current_busno);
-
- printf("....PCIE1 scan & enumeration done\n");
-}
-#endif /* CONFIG_PCI */
diff --git a/cpu/mpc86xx/pcie_indirect.c b/cpu/mpc86xx/pcie_indirect.c
deleted file mode 100644
index b00ad76ab8..0000000000
--- a/cpu/mpc86xx/pcie_indirect.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Support for indirect PCI bridges.
- *
- * Copyright (c) Freescale Semiconductor, Inc.
- * 2006. All rights reserved.
- *
- * Jason Jin <Jason.jin@freescale.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- * partly derived from
- * arch/powerpc/platforms/86xx/mpc86xx_pcie.c
- */
-
-#include <common.h>
-
-#ifdef CONFIG_PCI
-
-#include <asm/processor.h>
-#include <asm/io.h>
-#include <pci.h>
-
-#define PCI_CFG_OUT out_be32
-#define PEX_FIX out_be32(hose->cfg_addr+0x4, 0x0400ffff)
-
-static int
-indirect_read_config_pcie(struct pci_controller *hose,
- pci_dev_t dev,
- int offset,
- int len,
- u32 *val)
-{
- int bus = PCI_BUS(dev);
-
- volatile unsigned char *cfg_data;
- u32 temp;
-
- PEX_FIX;
- if (bus == 0xff) {
- PCI_CFG_OUT(hose->cfg_addr,
- dev | (offset & 0xfc) | 0x80000001);
- } else {
- PCI_CFG_OUT(hose->cfg_addr,
- dev | (offset & 0xfc) | 0x80000000);
- }
- /*
- * Note: the caller has already checked that offset is
- * suitably aligned and that len is 1, 2 or 4.
- */
- /* ERRATA PCI-Ex 12 - Configuration Address/Data Alignment */
- cfg_data = hose->cfg_data;
- PEX_FIX;
- temp = in_le32((u32 *) cfg_data);
- switch (len) {
- case 1:
- *val = (temp >> (((offset & 3)) * 8)) & 0xff;
- break;
- case 2:
- *val = (temp >> (((offset & 3)) * 8)) & 0xffff;
- break;
- default:
- *val = temp;
- break;
- }
-
- return 0;
-}
-
-static int
-indirect_write_config_pcie(struct pci_controller *hose,
- pci_dev_t dev,
- int offset,
- int len,
- u32 val)
-{
- int bus = PCI_BUS(dev);
- volatile unsigned char *cfg_data;
- u32 temp;
-
- PEX_FIX;
- if (bus == 0xff) {
- PCI_CFG_OUT(hose->cfg_addr,
- dev | (offset & 0xfc) | 0x80000001);
- } else {
- PCI_CFG_OUT(hose->cfg_addr,
- dev | (offset & 0xfc) | 0x80000000);
- }
-
- /*
- * Note: the caller has already checked that offset is
- * suitably aligned and that len is 1, 2 or 4.
- */
- /* ERRATA PCI-Ex 12 - Configuration Address/Data Alignment */
- cfg_data = hose->cfg_data;
- switch (len) {
- case 1:
- PEX_FIX;
- temp = in_le32((u32 *) cfg_data);
- temp = (temp & ~(0xff << ((offset & 3) * 8))) |
- (val << ((offset & 3) * 8));
- PEX_FIX;
- out_le32((u32 *) cfg_data, temp);
- break;
- case 2:
- PEX_FIX;
- temp = in_le32((u32 *) cfg_data);
- temp = (temp & ~(0xffff << ((offset & 3) * 8)));
- temp |= (val << ((offset & 3) * 8));
- PEX_FIX;
- out_le32((u32 *) cfg_data, temp);
- break;
- default:
- PEX_FIX;
- out_le32((u32 *) cfg_data, val);
- break;
- }
- PEX_FIX;
- return 0;
-}
-
-static int
-indirect_read_config_byte_pcie(struct pci_controller *hose,
- pci_dev_t dev,
- int offset,
- u8 *val)
-{
- u32 val32;
- indirect_read_config_pcie(hose, dev, offset, 1, &val32);
- *val = (u8) val32;
- return 0;
-}
-
-static int
-indirect_read_config_word_pcie(struct pci_controller *hose,
- pci_dev_t dev,
- int offset,
- u16 *val)
-{
- u32 val32;
- indirect_read_config_pcie(hose, dev, offset, 2, &val32);
- *val = (u16) val32;
- return 0;
-}
-
-static int
-indirect_read_config_dword_pcie(struct pci_controller *hose,
- pci_dev_t dev,
- int offset,
- u32 *val)
-{
- return indirect_read_config_pcie(hose, dev, offset, 4, val);
-}
-
-static int
-indirect_write_config_byte_pcie(struct pci_controller *hose,
- pci_dev_t dev,
- int offset,
- u8 val)
-{
- return indirect_write_config_pcie(hose, dev, offset, 1, (u32) val);
-}
-
-static int
-indirect_write_config_word_pcie(struct pci_controller *hose,
- pci_dev_t dev,
- int offset,
- unsigned short val)
-{
- return indirect_write_config_pcie(hose, dev, offset, 2, (u32) val);
-}
-
-static int
-indirect_write_config_dword_pcie(struct pci_controller *hose,
- pci_dev_t dev,
- int offset,
- u32 val)
-{
- return indirect_write_config_pcie(hose, dev, offset, 4, val);
-}
-
-void
-pcie_setup_indirect(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data)
-{
- pci_set_ops(hose,
- indirect_read_config_byte_pcie,
- indirect_read_config_word_pcie,
- indirect_read_config_dword_pcie,
- indirect_write_config_byte_pcie,
- indirect_write_config_word_pcie,
- indirect_write_config_dword_pcie);
-
- hose->cfg_addr = (unsigned int *)cfg_addr;
- hose->cfg_data = (unsigned char *)cfg_data;
-}
-
-#endif /* CONFIG_PCI */
diff --git a/cpu/mpc86xx/resetvec.S b/cpu/mpc86xx/resetvec.S
deleted file mode 100644
index 9a552f6624..0000000000
--- a/cpu/mpc86xx/resetvec.S
+++ /dev/null
@@ -1,2 +0,0 @@
- .section .resetvec,"ax"
- b _start
diff --git a/cpu/mpc86xx/spd_sdram.c b/cpu/mpc86xx/spd_sdram.c
deleted file mode 100644
index b18e8225de..0000000000
--- a/cpu/mpc86xx/spd_sdram.c
+++ /dev/null
@@ -1,1320 +0,0 @@
-/*
- * Copyright 2004 Freescale Semiconductor.
- * (C) Copyright 2003 Motorola Inc.
- * Xianghua Xiao (X.Xiao@motorola.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/processor.h>
-#include <i2c.h>
-#include <spd.h>
-#include <asm/mmu.h>
-
-
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
-extern void dma_init(void);
-extern uint dma_check(void);
-extern int dma_xfer(void *dest, uint count, void *src);
-#endif
-
-#ifdef CONFIG_SPD_EEPROM
-
-#ifndef CFG_READ_SPD
-#define CFG_READ_SPD i2c_read
-#endif
-
-/*
- * Only one of the following three should be 1; others should be 0
- * By default the cache line interleaving is selected if
- * the CONFIG_DDR_INTERLEAVE flag is defined
- */
-#define CFG_PAGE_INTERLEAVING 0
-#define CFG_BANK_INTERLEAVING 0
-#define CFG_SUPER_BANK_INTERLEAVING 0
-
-/*
- * Convert picoseconds into clock cycles (rounding up if needed).
- */
-
-int
-picos_to_clk(int picos)
-{
- int clks;
-
- clks = picos / (2000000000 / (get_bus_freq(0) / 1000));
- if (picos % (2000000000 / (get_bus_freq(0) / 1000)) != 0) {
- clks++;
- }
-
- return clks;
-}
-
-
-/*
- * Calculate the Density of each Physical Rank.
- * Returned size is in bytes.
- *
- * Study these table from Byte 31 of JEDEC SPD Spec.
- *
- * DDR I DDR II
- * Bit Size Size
- * --- ----- ------
- * 7 high 512MB 512MB
- * 6 256MB 256MB
- * 5 128MB 128MB
- * 4 64MB 16GB
- * 3 32MB 8GB
- * 2 16MB 4GB
- * 1 2GB 2GB
- * 0 low 1GB 1GB
- *
- * Reorder Table to be linear by stripping the bottom
- * 2 or 5 bits off and shifting them up to the top.
- */
-
-unsigned int
-compute_banksize(unsigned int mem_type, unsigned char row_dens)
-{
- unsigned int bsize;
-
- if (mem_type == SPD_MEMTYPE_DDR) {
- /* Bottom 2 bits up to the top. */
- bsize = ((row_dens >> 2) | ((row_dens & 3) << 6)) << 24;
- debug("DDR: DDR I rank density = 0x%08x\n", bsize);
- } else {
- /* Bottom 5 bits up to the top. */
- bsize = ((row_dens >> 5) | ((row_dens & 31) << 3)) << 27;
- debug("DDR: DDR II rank density = 0x%08x\n", bsize);
- }
- return bsize;
-}
-
-
-/*
- * Convert a two-nibble BCD value into a cycle time.
- * While the spec calls for nano-seconds, picos are returned.
- *
- * This implements the tables for bytes 9, 23 and 25 for both
- * DDR I and II. No allowance for distinguishing the invalid
- * fields absent for DDR I yet present in DDR II is made.
- * (That is, cycle times of .25, .33, .66 and .75 ns are
- * allowed for both DDR II and I.)
- */
-
-unsigned int
-convert_bcd_tenths_to_cycle_time_ps(unsigned int spd_val)
-{
- /*
- * Table look up the lower nibble, allow DDR I & II.
- */
- unsigned int tenths_ps[16] = {
- 0,
- 100,
- 200,
- 300,
- 400,
- 500,
- 600,
- 700,
- 800,
- 900,
- 250,
- 330,
- 660,
- 750,
- 0, /* undefined */
- 0 /* undefined */
- };
-
- unsigned int whole_ns = (spd_val & 0xF0) >> 4;
- unsigned int tenth_ns = spd_val & 0x0F;
- unsigned int ps = whole_ns * 1000 + tenths_ps[tenth_ns];
-
- return ps;
-}
-
-
-/*
- * Determine Refresh Rate. Ignore self refresh bit on DDR I.
- * Table from SPD Spec, Byte 12, converted to picoseconds and
- * filled in with "default" normal values.
- */
-unsigned int determine_refresh_rate(unsigned int spd_refresh)
-{
- unsigned int refresh_time_ns[8] = {
- 15625000, /* 0 Normal 1.00x */
- 3900000, /* 1 Reduced .25x */
- 7800000, /* 2 Extended .50x */
- 31300000, /* 3 Extended 2.00x */
- 62500000, /* 4 Extended 4.00x */
- 125000000, /* 5 Extended 8.00x */
- 15625000, /* 6 Normal 1.00x filler */
- 15625000, /* 7 Normal 1.00x filler */
- };
-
- return picos_to_clk(refresh_time_ns[spd_refresh & 0x7]);
-}
-
-
-long int
-spd_init(unsigned char i2c_address, unsigned int ddr_num,
- unsigned int dimm_num, unsigned int start_addr)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_ddr_t *ddr;
- volatile ccsr_gur_t *gur = &immap->im_gur;
- spd_eeprom_t spd;
- unsigned int n_ranks;
- unsigned int rank_density;
- unsigned int odt_rd_cfg, odt_wr_cfg;
- unsigned int odt_cfg, mode_odt_enable;
- unsigned int refresh_clk;
-#ifdef MPC86xx_DDR_SDRAM_CLK_CNTL
- unsigned char clk_adjust;
-#endif
- unsigned int dqs_cfg;
- unsigned char twr_clk, twtr_clk, twr_auto_clk;
- unsigned int tCKmin_ps, tCKmax_ps;
- unsigned int max_data_rate;
- unsigned int busfreq;
- unsigned int memsize;
- unsigned char caslat, caslat_ctrl;
- unsigned int trfc, trfc_clk, trfc_low, trfc_high;
- unsigned int trcd_clk;
- unsigned int trtp_clk;
- unsigned char cke_min_clk;
- unsigned char add_lat;
- unsigned char wr_lat;
- unsigned char wr_data_delay;
- unsigned char four_act;
- unsigned char cpo;
- unsigned char burst_len;
- unsigned int mode_caslat;
- unsigned char d_init;
- unsigned int tCycle_ps, modfreq;
-
- if (ddr_num == 1)
- ddr = &immap->im_ddr1;
- else
- ddr = &immap->im_ddr2;
-
- /*
- * Read SPD information.
- */
- debug("Performing SPD read at I2C address 0x%02lx\n",i2c_address);
- memset((void *)&spd, 0, sizeof(spd));
- CFG_READ_SPD(i2c_address, 0, 1, (uchar *) &spd, sizeof(spd));
-
- /*
- * Check for supported memory module types.
- */
- if (spd.mem_type != SPD_MEMTYPE_DDR &&
- spd.mem_type != SPD_MEMTYPE_DDR2) {
- debug("Warning: Unable to locate DDR I or DDR II module for DIMM %d of DDR controller %d.\n"
- " Fundamental memory type is 0x%0x\n",
- dimm_num,
- ddr_num,
- spd.mem_type);
- return 0;
- }
-
- debug("\nFound memory of type 0x%02lx ", spd.mem_type);
- if (spd.mem_type == SPD_MEMTYPE_DDR)
- debug("DDR I\n");
- else
- debug("DDR II\n");
-
- /*
- * These test gloss over DDR I and II differences in interpretation
- * of bytes 3 and 4, but irrelevantly. Multiple asymmetric banks
- * are not supported on DDR I; and not encoded on DDR II.
- *
- * Also note that the 8548 controller can support:
- * 12 <= nrow <= 16
- * and
- * 8 <= ncol <= 11 (still, for DDR)
- * 6 <= ncol <= 9 (for FCRAM)
- */
- if (spd.nrow_addr < 12 || spd.nrow_addr > 14) {
- printf("DDR: Unsupported number of Row Addr lines: %d.\n",
- spd.nrow_addr);
- return 0;
- }
- if (spd.ncol_addr < 8 || spd.ncol_addr > 11) {
- printf("DDR: Unsupported number of Column Addr lines: %d.\n",
- spd.ncol_addr);
- return 0;
- }
-
- /*
- * Determine the number of physical banks controlled by
- * different Chip Select signals. This is not quite the
- * same as the number of DIMM modules on the board. Feh.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- n_ranks = spd.nrows;
- } else {
- n_ranks = (spd.nrows & 0x7) + 1;
- }
-
- debug("DDR: number of ranks = %d\n", n_ranks);
-
- if (n_ranks > 2) {
- printf("DDR: Only 2 chip selects are supported: %d\n",
- n_ranks);
- return 0;
- }
-
- /*
- * Adjust DDR II IO voltage biasing. It just makes it work.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR2) {
- gur->ddrioovcr = (0
- | 0x80000000 /* Enable */
- | 0x10000000 /* VSEL to 1.8V */
- );
- }
-
- /*
- * Determine the size of each Rank in bytes.
- */
- rank_density = compute_banksize(spd.mem_type, spd.row_dens);
-
- debug("Start address for this controller is 0x%08lx\n", start_addr);
-
- /*
- * ODT configuration recommendation from DDR Controller Chapter.
- */
- odt_rd_cfg = 0; /* Never assert ODT */
- odt_wr_cfg = 0; /* Never assert ODT */
- if (spd.mem_type == SPD_MEMTYPE_DDR2) {
- odt_wr_cfg = 1; /* Assert ODT on writes to CS0 */
- }
-
-#ifdef CONFIG_DDR_INTERLEAVE
-
- if (dimm_num != 1) {
- printf("For interleaving memory on HPCN, need to use DIMM 1 for DDR Controller %d !\n", ddr_num);
- return 0;
- } else {
- /*
- * Since interleaved memory only uses CS0, the
- * memory sticks have to be identical in size and quantity
- * of ranks. That essentially gives double the size on
- * one rank, i.e on CS0 for both controllers put together.
- * Confirm this???
- */
- rank_density *= 2;
-
- /*
- * Eg: Bounds: 0x0000_0000 to 0x0f000_0000 first 256 Meg
- */
- start_addr = 0;
- ddr->cs0_bnds = (start_addr >> 8)
- | (((start_addr + rank_density - 1) >> 24));
- /*
- * Default interleaving mode to cache-line interleaving.
- */
- ddr->cs0_config = ( 1 << 31
-#if (CFG_PAGE_INTERLEAVING == 1)
- | (PAGE_INTERLEAVING)
-#elif (CFG_BANK_INTERLEAVING == 1)
- | (BANK_INTERLEAVING)
-#elif (CFG_SUPER_BANK_INTERLEAVING == 1)
- | (SUPER_BANK_INTERLEAVING)
-#else
- | (CACHE_LINE_INTERLEAVING)
-#endif
- | (odt_rd_cfg << 20)
- | (odt_wr_cfg << 16)
- | (spd.nrow_addr - 12) << 8
- | (spd.ncol_addr - 8) );
-
- debug("DDR: cs0_bnds = 0x%08x\n", ddr->cs0_bnds);
- debug("DDR: cs0_config = 0x%08x\n", ddr->cs0_config);
-
- /*
- * Adjustment for dual rank memory to get correct memory
- * size (return value of this function).
- */
- if (n_ranks == 2) {
- n_ranks = 1;
- rank_density /= 2;
- } else {
- rank_density /= 2;
- }
- }
-#else /* CONFIG_DDR_INTERLEAVE */
-
- if (dimm_num == 1) {
- /*
- * Eg: Bounds: 0x0000_0000 to 0x0f000_0000 first 256 Meg
- */
- ddr->cs0_bnds = (start_addr >> 8)
- | (((start_addr + rank_density - 1) >> 24));
-
- ddr->cs0_config = ( 1 << 31
- | (odt_rd_cfg << 20)
- | (odt_wr_cfg << 16)
- | (spd.nrow_addr - 12) << 8
- | (spd.ncol_addr - 8) );
-
- debug("DDR: cs0_bnds = 0x%08x\n", ddr->cs0_bnds);
- debug("DDR: cs0_config = 0x%08x\n", ddr->cs0_config);
-
- if (n_ranks == 2) {
- /*
- * Eg: Bounds: 0x1000_0000 to 0x1f00_0000,
- * second 256 Meg
- */
- ddr->cs1_bnds = (((start_addr + rank_density) >> 8)
- | (( start_addr + 2*rank_density - 1)
- >> 24));
- ddr->cs1_config = ( 1<<31
- | (odt_rd_cfg << 20)
- | (odt_wr_cfg << 16)
- | (spd.nrow_addr - 12) << 8
- | (spd.ncol_addr - 8) );
- debug("DDR: cs1_bnds = 0x%08x\n", ddr->cs1_bnds);
- debug("DDR: cs1_config = 0x%08x\n", ddr->cs1_config);
- }
-
- } else {
- /*
- * This is the 2nd DIMM slot for this controller
- */
- /*
- * Eg: Bounds: 0x0000_0000 to 0x0f000_0000 first 256 Meg
- */
- ddr->cs2_bnds = (start_addr >> 8)
- | (((start_addr + rank_density - 1) >> 24));
-
- ddr->cs2_config = ( 1 << 31
- | (odt_rd_cfg << 20)
- | (odt_wr_cfg << 16)
- | (spd.nrow_addr - 12) << 8
- | (spd.ncol_addr - 8) );
-
- debug("DDR: cs2_bnds = 0x%08x\n", ddr->cs2_bnds);
- debug("DDR: cs2_config = 0x%08x\n", ddr->cs2_config);
-
- if (n_ranks == 2) {
- /*
- * Eg: Bounds: 0x1000_0000 to 0x1f00_0000,
- * second 256 Meg
- */
- ddr->cs3_bnds = (((start_addr + rank_density) >> 8)
- | (( start_addr + 2*rank_density - 1)
- >> 24));
- ddr->cs3_config = ( 1<<31
- | (odt_rd_cfg << 20)
- | (odt_wr_cfg << 16)
- | (spd.nrow_addr - 12) << 8
- | (spd.ncol_addr - 8) );
- debug("DDR: cs3_bnds = 0x%08x\n", ddr->cs3_bnds);
- debug("DDR: cs3_config = 0x%08x\n", ddr->cs3_config);
- }
- }
-#endif /* CONFIG_DDR_INTERLEAVE */
-
- /*
- * Find the largest CAS by locating the highest 1 bit
- * in the spd.cas_lat field. Translate it to a DDR
- * controller field value:
- *
- * CAS Lat DDR I DDR II Ctrl
- * Clocks SPD Bit SPD Bit Value
- * ------- ------- ------- -----
- * 1.0 0 0001
- * 1.5 1 0010
- * 2.0 2 2 0011
- * 2.5 3 0100
- * 3.0 4 3 0101
- * 3.5 5 0110
- * 4.0 4 0111
- * 4.5 1000
- * 5.0 5 1001
- */
- caslat = __ilog2(spd.cas_lat);
- if ((spd.mem_type == SPD_MEMTYPE_DDR)
- && (caslat > 5)) {
- printf("DDR I: Invalid SPD CAS Latency: 0x%x.\n", spd.cas_lat);
- return 0;
-
- } else if (spd.mem_type == SPD_MEMTYPE_DDR2
- && (caslat < 2 || caslat > 5)) {
- printf("DDR II: Invalid SPD CAS Latency: 0x%x.\n",
- spd.cas_lat);
- return 0;
- }
- debug("DDR: caslat SPD bit is %d\n", caslat);
-
- /*
- * Calculate the Maximum Data Rate based on the Minimum Cycle time.
- * The SPD clk_cycle field (tCKmin) is measured in tenths of
- * nanoseconds and represented as BCD.
- */
- tCKmin_ps = convert_bcd_tenths_to_cycle_time_ps(spd.clk_cycle);
- debug("DDR: tCKmin = %d ps\n", tCKmin_ps);
-
- /*
- * Double-data rate, scaled 1000 to picoseconds, and back down to MHz.
- */
- max_data_rate = 2 * 1000 * 1000 / tCKmin_ps;
- debug("DDR: Module max data rate = %d Mhz\n", max_data_rate);
-
-
- /*
- * Adjust the CAS Latency to allow for bus speeds that
- * are slower than the DDR module.
- */
- busfreq = get_bus_freq(0) / 1000000; /* MHz */
- tCycle_ps = convert_bcd_tenths_to_cycle_time_ps(spd.clk_cycle3);
- modfreq = 2 * 1000 * 1000 / tCycle_ps;
-
- if ((spd.mem_type == SPD_MEMTYPE_DDR2) && (busfreq < 266)) {
- printf("DDR: platform frequency too low for correct DDR2 controller operation\n");
- return 0;
- } else if (busfreq < 90) {
- printf("DDR: platform frequency too low for correct DDR1 operation\n");
- return 0;
- }
-
- if ((busfreq <= modfreq) && (spd.cas_lat & (1 << (caslat - 2)))) {
- caslat -= 2;
- } else {
- tCycle_ps = convert_bcd_tenths_to_cycle_time_ps(spd.clk_cycle2);
- modfreq = 2 * 1000 * 1000 / tCycle_ps;
- if ((busfreq <= modfreq) && (spd.cas_lat & (1 << (caslat - 1))))
- caslat -= 1;
- else if (busfreq > max_data_rate) {
- printf("DDR: Bus freq %d MHz is not fit for DDR rate %d MHz\n",
- busfreq, max_data_rate);
- return 0;
- }
- }
-
- /*
- * Empirically set ~MCAS-to-preamble override for DDR 2.
- * Your milage will vary.
- */
- cpo = 0;
- if (spd.mem_type == SPD_MEMTYPE_DDR2) {
- if (busfreq <= 333) {
- cpo = 0x7;
- } else if (busfreq <= 400) {
- cpo = 0x9;
- } else {
- cpo = 0xa;
- }
- }
-
- /*
- * Convert caslat clocks to DDR controller value.
- * Force caslat_ctrl to be DDR Controller field-sized.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- caslat_ctrl = (caslat + 1) & 0x07;
- } else {
- caslat_ctrl = (2 * caslat - 1) & 0x0f;
- }
-
- debug("DDR: caslat SPD bit is %d, controller field is 0x%x\n",
- caslat, caslat_ctrl);
-
- /*
- * Timing Config 0.
- * Avoid writing for DDR I. The new PQ38 DDR controller
- * dreams up non-zero default values to be backwards compatible.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR2) {
- unsigned char taxpd_clk = 8; /* By the book. */
- unsigned char tmrd_clk = 2; /* By the book. */
- unsigned char act_pd_exit = 2; /* Empirical? */
- unsigned char pre_pd_exit = 6; /* Empirical? */
-
- ddr->timing_cfg_0 = (0
- | ((act_pd_exit & 0x7) << 20) /* ACT_PD_EXIT */
- | ((pre_pd_exit & 0x7) << 16) /* PRE_PD_EXIT */
- | ((taxpd_clk & 0xf) << 8) /* ODT_PD_EXIT */
- | ((tmrd_clk & 0xf) << 0) /* MRS_CYC */
- );
- debug("DDR: timing_cfg_0 = 0x%08x\n", ddr->timing_cfg_0);
-
- }
-
-
- /*
- * Some Timing Config 1 values now.
- * Sneak Extended Refresh Recovery in here too.
- */
-
- /*
- * For DDR I, WRREC(Twr) and WRTORD(Twtr) are not in SPD,
- * use conservative value.
- * For DDR II, they are bytes 36 and 37, in quarter nanos.
- */
-
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- twr_clk = 3; /* Clocks */
- twtr_clk = 1; /* Clocks */
- } else {
- twr_clk = picos_to_clk(spd.twr * 250);
- twtr_clk = picos_to_clk(spd.twtr * 250);
- }
-
- /*
- * Calculate Trfc, in picos.
- * DDR I: Byte 42 straight up in ns.
- * DDR II: Byte 40 and 42 swizzled some, in ns.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- trfc = spd.trfc * 1000; /* up to ps */
- } else {
- unsigned int byte40_table_ps[8] = {
- 0,
- 250,
- 330,
- 500,
- 660,
- 750,
- 0,
- 0
- };
-
- trfc = (((spd.trctrfc_ext & 0x1) * 256) + spd.trfc) * 1000
- + byte40_table_ps[(spd.trctrfc_ext >> 1) & 0x7];
- }
- trfc_clk = picos_to_clk(trfc);
-
- /*
- * Trcd, Byte 29, from quarter nanos to ps and clocks.
- */
- trcd_clk = picos_to_clk(spd.trcd * 250) & 0x7;
-
- /*
- * Convert trfc_clk to DDR controller fields. DDR I should
- * fit in the REFREC field (16-19) of TIMING_CFG_1, but the
- * 8548 controller has an extended REFREC field of three bits.
- * The controller automatically adds 8 clocks to this value,
- * so preadjust it down 8 first before splitting it up.
- */
- trfc_low = (trfc_clk - 8) & 0xf;
- trfc_high = ((trfc_clk - 8) >> 4) & 0x3;
-
- /*
- * Sneak in some Extended Refresh Recovery.
- */
- ddr->ext_refrec = (trfc_high << 16);
- debug("DDR: ext_refrec = 0x%08x\n", ddr->ext_refrec);
-
- ddr->timing_cfg_1 =
- (0
- | ((picos_to_clk(spd.trp * 250) & 0x07) << 28) /* PRETOACT */
- | ((picos_to_clk(spd.tras * 1000) & 0x0f ) << 24) /* ACTTOPRE */
- | (trcd_clk << 20) /* ACTTORW */
- | (caslat_ctrl << 16) /* CASLAT */
- | (trfc_low << 12) /* REFEC */
- | ((twr_clk & 0x07) << 8) /* WRRREC */
- | ((picos_to_clk(spd.trrd * 250) & 0x07) << 4) /* ACTTOACT */
- | ((twtr_clk & 0x07) << 0) /* WRTORD */
- );
-
- debug("DDR: timing_cfg_1 = 0x%08x\n", ddr->timing_cfg_1);
-
-
- /*
- * Timing_Config_2
- * Was: 0x00000800;
- */
-
- /*
- * Additive Latency
- * For DDR I, 0.
- * For DDR II, with ODT enabled, use "a value" less than ACTTORW,
- * which comes from Trcd, and also note that:
- * add_lat + caslat must be >= 4
- */
- add_lat = 0;
- if (spd.mem_type == SPD_MEMTYPE_DDR2
- && (odt_wr_cfg || odt_rd_cfg)
- && (caslat < 4)) {
- add_lat = 4 - caslat;
- if (add_lat >= trcd_clk) {
- add_lat = trcd_clk - 1;
- }
- }
-
- /*
- * Write Data Delay
- * Historically 0x2 == 4/8 clock delay.
- * Empirically, 0x3 == 6/8 clock delay is suggested for DDR I 266.
- */
- wr_data_delay = 3;
-
- /*
- * Write Latency
- * Read to Precharge
- * Minimum CKE Pulse Width.
- * Four Activate Window
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- /*
- * This is a lie. It should really be 1, but if it is
- * set to 1, bits overlap into the old controller's
- * otherwise unused ACSM field. If we leave it 0, then
- * the HW will magically treat it as 1 for DDR 1. Oh Yea.
- */
- wr_lat = 0;
-
- trtp_clk = 2; /* By the book. */
- cke_min_clk = 1; /* By the book. */
- four_act = 1; /* By the book. */
-
- } else {
- wr_lat = caslat - 1;
-
- /* Convert SPD value from quarter nanos to picos. */
- trtp_clk = picos_to_clk(spd.trtp * 250);
-
- cke_min_clk = 3; /* By the book. */
- four_act = picos_to_clk(37500); /* By the book. 1k pages? */
- }
-
- ddr->timing_cfg_2 = (0
- | ((add_lat & 0x7) << 28) /* ADD_LAT */
- | ((cpo & 0x1f) << 23) /* CPO */
- | ((wr_lat & 0x7) << 19) /* WR_LAT */
- | ((trtp_clk & 0x7) << 13) /* RD_TO_PRE */
- | ((wr_data_delay & 0x7) << 10) /* WR_DATA_DELAY */
- | ((cke_min_clk & 0x7) << 6) /* CKE_PLS */
- | ((four_act & 0x1f) << 0) /* FOUR_ACT */
- );
-
- debug("DDR: timing_cfg_2 = 0x%08x\n", ddr->timing_cfg_2);
-
-
- /*
- * Determine the Mode Register Set.
- *
- * This is nominally part specific, but it appears to be
- * consistent for all DDR I devices, and for all DDR II devices.
- *
- * caslat must be programmed
- * burst length is always 4
- * burst type is sequential
- *
- * For DDR I:
- * operating mode is "normal"
- *
- * For DDR II:
- * other stuff
- */
-
- mode_caslat = 0;
-
- /*
- * Table lookup from DDR I or II Device Operation Specs.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- if (1 <= caslat && caslat <= 4) {
- unsigned char mode_caslat_table[4] = {
- 0x5, /* 1.5 clocks */
- 0x2, /* 2.0 clocks */
- 0x6, /* 2.5 clocks */
- 0x3 /* 3.0 clocks */
- };
- mode_caslat = mode_caslat_table[caslat - 1];
- } else {
- puts("DDR I: Only CAS Latencies of 1.5, 2.0, "
- "2.5 and 3.0 clocks are supported.\n");
- return 0;
- }
-
- } else {
- if (2 <= caslat && caslat <= 5) {
- mode_caslat = caslat;
- } else {
- puts("DDR II: Only CAS Latencies of 2.0, 3.0, "
- "4.0 and 5.0 clocks are supported.\n");
- return 0;
- }
- }
-
- /*
- * Encoded Burst Length of 4.
- */
- burst_len = 2; /* Fiat. */
-
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- twr_auto_clk = 0; /* Historical */
- } else {
- /*
- * Determine tCK max in picos. Grab tWR and convert to picos.
- * Auto-precharge write recovery is:
- * WR = roundup(tWR_ns/tCKmax_ns).
- *
- * Ponder: Is twr_auto_clk different than twr_clk?
- */
- tCKmax_ps = convert_bcd_tenths_to_cycle_time_ps(spd.tckmax);
- twr_auto_clk = (spd.twr * 250 + tCKmax_ps - 1) / tCKmax_ps;
- }
-
- /*
- * Mode Reg in bits 16 ~ 31,
- * Extended Mode Reg 1 in bits 0 ~ 15.
- */
- mode_odt_enable = 0x0; /* Default disabled */
- if (odt_wr_cfg || odt_rd_cfg) {
- /*
- * Bits 6 and 2 in Extended MRS(1)
- * Bit 2 == 0x04 == 75 Ohm, with 2 DIMM modules.
- * Bit 6 == 0x40 == 150 Ohm, with 1 DIMM module.
- */
- mode_odt_enable = 0x40; /* 150 Ohm */
- }
-
- ddr->sdram_mode_1 =
- (0
- | (add_lat << (16 + 3)) /* Additive Latency in EMRS1 */
- | (mode_odt_enable << 16) /* ODT Enable in EMRS1 */
- | (twr_auto_clk << 9) /* Write Recovery Autopre */
- | (mode_caslat << 4) /* caslat */
- | (burst_len << 0) /* Burst length */
- );
-
- debug("DDR: sdram_mode = 0x%08x\n", ddr->sdram_mode_1);
-
- /*
- * Clear EMRS2 and EMRS3.
- */
- ddr->sdram_mode_2 = 0;
- debug("DDR: sdram_mode_2 = 0x%08x\n", ddr->sdram_mode_2);
-
- /*
- * Determine Refresh Rate.
- */
- refresh_clk = determine_refresh_rate(spd.refresh & 0x7);
-
- /*
- * Set BSTOPRE to 0x100 for page mode
- * If auto-charge is used, set BSTOPRE = 0
- */
- ddr->sdram_interval =
- (0
- | (refresh_clk & 0x3fff) << 16
- | 0x100
- );
- debug("DDR: sdram_interval = 0x%08x\n", ddr->sdram_interval);
-
-
- /*
- * Is this an ECC DDR chip?
- * But don't mess with it if the DDR controller will init mem.
- */
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
- if (spd.config == 0x02) {
- ddr->err_disable = 0x0000000d;
- ddr->err_sbe = 0x00ff0000;
- }
- debug("DDR: err_disable = 0x%08x\n", ddr->err_disable);
- debug("DDR: err_sbe = 0x%08x\n", ddr->err_sbe);
-#endif
-
- asm volatile("sync;isync");
- udelay(500);
-
- /*
- * SDRAM Cfg 2
- */
-
- /*
- * When ODT is enabled, Chap 9 suggests asserting ODT to
- * internal IOs only during reads.
- */
- odt_cfg = 0;
- if (odt_rd_cfg | odt_wr_cfg) {
- odt_cfg = 0x2; /* ODT to IOs during reads */
- }
-
- /*
- * Try to use differential DQS with DDR II.
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR) {
- dqs_cfg = 0; /* No Differential DQS for DDR I */
- } else {
- dqs_cfg = 0x1; /* Differential DQS for DDR II */
- }
-
-#if defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
- /*
- * Use the DDR controller to auto initialize memory.
- */
- d_init = 1;
- ddr->sdram_data_init = CONFIG_MEM_INIT_VALUE;
- debug("DDR: ddr_data_init = 0x%08x\n", ddr->sdram_data_init);
-#else
- /*
- * Memory will be initialized via DMA, or not at all.
- */
- d_init = 0;
-#endif
-
- ddr->sdram_cfg_2 = (0
- | (dqs_cfg << 26) /* Differential DQS */
- | (odt_cfg << 21) /* ODT */
- | (d_init << 4) /* D_INIT auto init DDR */
- );
-
- debug("DDR: sdram_cfg_2 = 0x%08x\n", ddr->sdram_cfg_2);
-
-
-#ifdef MPC86xx_DDR_SDRAM_CLK_CNTL
- /*
- * Setup the clock control.
- * SDRAM_CLK_CNTL[0] = Source synchronous enable == 1
- * SDRAM_CLK_CNTL[5-7] = Clock Adjust
- * 0110 3/4 cycle late
- * 0111 7/8 cycle late
- */
- if (spd.mem_type == SPD_MEMTYPE_DDR)
- clk_adjust = 0x6;
- else
- clk_adjust = 0x7;
-
- ddr->sdram_clk_cntl = (0
- | 0x80000000
- | (clk_adjust << 23)
- );
- debug("DDR: sdram_clk_cntl = 0x%08x\n", ddr->sdram_clk_cntl);
-#endif
-
- /*
- * Figure out memory size in Megabytes.
- */
- debug("# ranks = %d, rank_density = 0x%08lx\n", n_ranks, rank_density);
- memsize = n_ranks * rank_density / 0x100000;
- return memsize;
-}
-
-
-unsigned int enable_ddr(unsigned int ddr_num)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- spd_eeprom_t spd1,spd2;
- volatile ccsr_ddr_t *ddr;
- unsigned sdram_cfg_1;
- unsigned char sdram_type, mem_type, config, mod_attr;
- unsigned char d_init;
- unsigned int no_dimm1=0, no_dimm2=0;
-
- /* Set up pointer to enable the current ddr controller */
- if (ddr_num == 1)
- ddr = &immap->im_ddr1;
- else
- ddr = &immap->im_ddr2;
-
- /*
- * Read both dimm slots and decide whether
- * or not to enable this controller.
- */
- memset((void *)&spd1,0,sizeof(spd1));
- memset((void *)&spd2,0,sizeof(spd2));
-
- if (ddr_num == 1) {
- CFG_READ_SPD(SPD_EEPROM_ADDRESS1,
- 0, 1, (uchar *) &spd1, sizeof(spd1));
- CFG_READ_SPD(SPD_EEPROM_ADDRESS2,
- 0, 1, (uchar *) &spd2, sizeof(spd2));
- } else {
- CFG_READ_SPD(SPD_EEPROM_ADDRESS3,
- 0, 1, (uchar *) &spd1, sizeof(spd1));
- CFG_READ_SPD(SPD_EEPROM_ADDRESS4,
- 0, 1, (uchar *) &spd2, sizeof(spd2));
- }
-
- /*
- * Check for supported memory module types.
- */
- if (spd1.mem_type != SPD_MEMTYPE_DDR
- && spd1.mem_type != SPD_MEMTYPE_DDR2) {
- no_dimm1 = 1;
- } else {
- debug("\nFound memory of type 0x%02lx ",spd1.mem_type );
- if (spd1.mem_type == SPD_MEMTYPE_DDR)
- debug("DDR I\n");
- else
- debug("DDR II\n");
- }
-
- if (spd2.mem_type != SPD_MEMTYPE_DDR &&
- spd2.mem_type != SPD_MEMTYPE_DDR2) {
- no_dimm2 = 1;
- } else {
- debug("\nFound memory of type 0x%02lx ",spd2.mem_type );
- if (spd2.mem_type == SPD_MEMTYPE_DDR)
- debug("DDR I\n");
- else
- debug("DDR II\n");
- }
-
-#ifdef CONFIG_DDR_INTERLEAVE
- if (no_dimm1) {
- printf("For interleaved operation memory modules need to be present in CS0 DIMM slots of both DDR controllers!\n");
- return 0;
- }
-#endif
-
- /*
- * Memory is not present in DIMM1 and DIMM2 - so do not enable DDRn
- */
- if (no_dimm1 && no_dimm2) {
- printf("No memory modules found for DDR controller %d!!\n", ddr_num);
- return 0;
- } else {
- mem_type = no_dimm2 ? spd1.mem_type : spd2.mem_type;
-
- /*
- * Figure out the settings for the sdram_cfg register.
- * Build up the entire register in 'sdram_cfg' before
- * writing since the write into the register will
- * actually enable the memory controller; all settings
- * must be done before enabling.
- *
- * sdram_cfg[0] = 1 (ddr sdram logic enable)
- * sdram_cfg[1] = 1 (self-refresh-enable)
- * sdram_cfg[5:7] = (SDRAM type = DDR SDRAM)
- * 010 DDR 1 SDRAM
- * 011 DDR 2 SDRAM
- */
- sdram_type = (mem_type == SPD_MEMTYPE_DDR) ? 2 : 3;
- sdram_cfg_1 = (0
- | (1 << 31) /* Enable */
- | (1 << 30) /* Self refresh */
- | (sdram_type << 24) /* SDRAM type */
- );
-
- /*
- * sdram_cfg[3] = RD_EN - registered DIMM enable
- * A value of 0x26 indicates micron registered
- * DIMMS (micron.com)
- */
- mod_attr = no_dimm2 ? spd1.mod_attr : spd2.mod_attr;
- if (mem_type == SPD_MEMTYPE_DDR && mod_attr == 0x26) {
- sdram_cfg_1 |= 0x10000000; /* RD_EN */
- }
-
-#if defined(CONFIG_DDR_ECC)
-
- config = no_dimm2 ? spd1.config : spd2.config;
-
- /*
- * If the user wanted ECC (enabled via sdram_cfg[2])
- */
- if (config == 0x02) {
- ddr->err_disable = 0x00000000;
- asm volatile("sync;isync;");
- ddr->err_sbe = 0x00ff0000;
- ddr->err_int_en = 0x0000000d;
- sdram_cfg_1 |= 0x20000000; /* ECC_EN */
- }
-#endif
-
- /*
- * Set 1T or 2T timing based on 1 or 2 modules
- */
- {
- if (!(no_dimm1 || no_dimm2)) {
- /*
- * 2T timing,because both DIMMS are present.
- * Enable 2T timing by setting sdram_cfg[16].
- */
- sdram_cfg_1 |= 0x8000; /* 2T_EN */
- }
- }
-
- /*
- * 200 painful micro-seconds must elapse between
- * the DDR clock setup and the DDR config enable.
- */
- udelay(200);
-
- /*
- * Go!
- */
- ddr->sdram_cfg_1 = sdram_cfg_1;
-
- asm volatile("sync;isync");
- udelay(500);
-
- debug("DDR: sdram_cfg = 0x%08x\n", ddr->sdram_cfg_1);
-
-
-#if defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
- d_init = 1;
- debug("DDR: memory initializing\n");
-
- /*
- * Poll until memory is initialized.
- * 512 Meg at 400 might hit this 200 times or so.
- */
- while ((ddr->sdram_cfg_2 & (d_init << 4)) != 0) {
- udelay(1000);
- }
- debug("DDR: memory initialized\n\n");
-#endif
-
- debug("Enabled DDR Controller %d\n", ddr_num);
- return 1;
- }
-}
-
-
-long int
-spd_sdram(void)
-{
- int memsize_ddr1_dimm1 = 0;
- int memsize_ddr1_dimm2 = 0;
- int memsize_ddr2_dimm1 = 0;
- int memsize_ddr2_dimm2 = 0;
- int memsize_total = 0;
- int memsize_ddr1 = 0;
- int memsize_ddr2 = 0;
- unsigned int ddr1_enabled = 0;
- unsigned int ddr2_enabled = 0;
- unsigned int law_size_ddr1;
- unsigned int law_size_ddr2;
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_local_mcm_t *mcm = &immap->im_local_mcm;
-
-#ifdef CONFIG_DDR_INTERLEAVE
- unsigned int law_size_interleaved;
- volatile ccsr_ddr_t *ddr1 = &immap->im_ddr1;
- volatile ccsr_ddr_t *ddr2 = &immap->im_ddr2;
-
- memsize_ddr1_dimm1 = spd_init(SPD_EEPROM_ADDRESS1,
- 1, 1,
- (unsigned int)memsize_total * 1024*1024);
- memsize_total += memsize_ddr1_dimm1;
-
- memsize_ddr2_dimm1 = spd_init(SPD_EEPROM_ADDRESS3,
- 2, 1,
- (unsigned int)memsize_total * 1024*1024);
- memsize_total += memsize_ddr2_dimm1;
-
- if (memsize_ddr1_dimm1 != memsize_ddr2_dimm1) {
- if (memsize_ddr1_dimm1 < memsize_ddr2_dimm1)
- memsize_total -= memsize_ddr1_dimm1;
- else
- memsize_total -= memsize_ddr2_dimm1;
- debug("Total memory available for interleaving 0x%08lx\n",
- memsize_total * 1024 * 1024);
- debug("Adjusting CS0_BNDS to account for unequal DIMM sizes in interleaved memory\n");
- ddr1->cs0_bnds = ((memsize_total * 1024 * 1024) - 1) >> 24;
- ddr2->cs0_bnds = ((memsize_total * 1024 * 1024) - 1) >> 24;
- debug("DDR1: cs0_bnds = 0x%08x\n", ddr1->cs0_bnds);
- debug("DDR2: cs0_bnds = 0x%08x\n", ddr2->cs0_bnds);
- }
-
- ddr1_enabled = enable_ddr(1);
- ddr2_enabled = enable_ddr(2);
-
- /*
- * Both controllers need to be enabled for interleaving.
- */
- if (ddr1_enabled && ddr2_enabled) {
- law_size_interleaved = 19 + __ilog2(memsize_total);
-
- /*
- * Set up LAWBAR for DDR 1 space.
- */
- mcm->lawbar1 = ((CFG_DDR_SDRAM_BASE >> 12) & 0xfffff);
- mcm->lawar1 = (LAWAR_EN
- | LAWAR_TRGT_IF_DDR_INTERLEAVED
- | (LAWAR_SIZE & law_size_interleaved));
- debug("DDR: LAWBAR1=0x%08x\n", mcm->lawbar1);
- debug("DDR: LAWAR1=0x%08x\n", mcm->lawar1);
- debug("Interleaved memory size is 0x%08lx\n", memsize_total);
-
-#ifdef CONFIG_DDR_INTERLEAVE
-#if (CFG_PAGE_INTERLEAVING == 1)
- printf("Page ");
-#elif (CFG_BANK_INTERLEAVING == 1)
- printf("Bank ");
-#elif (CFG_SUPER_BANK_INTERLEAVING == 1)
- printf("Super-bank ");
-#else
- printf("Cache-line ");
-#endif
-#endif
- printf("Interleaved");
- return memsize_total * 1024 * 1024;
- } else {
- printf("Interleaved memory not enabled - check CS0 DIMM slots for both controllers.\n");
- return 0;
- }
-
-#else
- /*
- * Call spd_sdram() routine to init ddr1 - pass I2c address,
- * controller number, dimm number, and starting address.
- */
- memsize_ddr1_dimm1 = spd_init(SPD_EEPROM_ADDRESS1,
- 1, 1,
- (unsigned int)memsize_total * 1024*1024);
- memsize_total += memsize_ddr1_dimm1;
-
- memsize_ddr1_dimm2 = spd_init(SPD_EEPROM_ADDRESS2,
- 1, 2,
- (unsigned int)memsize_total * 1024*1024);
- memsize_total += memsize_ddr1_dimm2;
-
- /*
- * Enable the DDR controller - pass ddr controller number.
- */
- ddr1_enabled = enable_ddr(1);
-
- /* Keep track of memory to be addressed by DDR1 */
- memsize_ddr1 = memsize_ddr1_dimm1 + memsize_ddr1_dimm2;
-
- /*
- * First supported LAW size is 16M, at LAWAR_SIZE_16M == 23. Fnord.
- */
- if (ddr1_enabled) {
- law_size_ddr1 = 19 + __ilog2(memsize_ddr1);
-
- /*
- * Set up LAWBAR for DDR 1 space.
- */
- mcm->lawbar1 = ((CFG_DDR_SDRAM_BASE >> 12) & 0xfffff);
- mcm->lawar1 = (LAWAR_EN
- | LAWAR_TRGT_IF_DDR1
- | (LAWAR_SIZE & law_size_ddr1));
- debug("DDR: LAWBAR1=0x%08x\n", mcm->lawbar1);
- debug("DDR: LAWAR1=0x%08x\n", mcm->lawar1);
- }
-
-#if (CONFIG_NUM_DDR_CONTROLLERS > 1)
- memsize_ddr2_dimm1 = spd_init(SPD_EEPROM_ADDRESS3,
- 2, 1,
- (unsigned int)memsize_total * 1024*1024);
- memsize_total += memsize_ddr2_dimm1;
-
- memsize_ddr2_dimm2 = spd_init(SPD_EEPROM_ADDRESS4,
- 2, 2,
- (unsigned int)memsize_total * 1024*1024);
- memsize_total += memsize_ddr2_dimm2;
-
- ddr2_enabled = enable_ddr(2);
-
- /* Keep track of memory to be addressed by DDR2 */
- memsize_ddr2 = memsize_ddr2_dimm1 + memsize_ddr2_dimm2;
-
- if (ddr2_enabled) {
- law_size_ddr2 = 19 + __ilog2(memsize_ddr2);
-
- /*
- * Set up LAWBAR for DDR 2 space.
- */
- if (ddr1_enabled)
- mcm->lawbar8 = (((memsize_ddr1 * 1024 * 1024) >> 12)
- & 0xfffff);
- else
- mcm->lawbar8 = ((CFG_DDR_SDRAM_BASE >> 12) & 0xfffff);
-
- mcm->lawar8 = (LAWAR_EN
- | LAWAR_TRGT_IF_DDR2
- | (LAWAR_SIZE & law_size_ddr2));
- debug("\nDDR: LAWBAR8=0x%08x\n", mcm->lawbar8);
- debug("DDR: LAWAR8=0x%08x\n", mcm->lawar8);
- }
-#endif /* CONFIG_NUM_DDR_CONTROLLERS > 1 */
-
- debug("\nMemory sizes are DDR1 = 0x%08lx, DDR2 = 0x%08lx\n",
- memsize_ddr1, memsize_ddr2);
-
- /*
- * If neither DDR controller is enabled return 0.
- */
- if (!ddr1_enabled && !ddr2_enabled)
- return 0;
-
- printf("Non-interleaved");
- return memsize_total * 1024 * 1024;
-
-#endif /* CONFIG_DDR_INTERLEAVE */
-}
-
-
-#endif /* CONFIG_SPD_EEPROM */
-
-
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
-
-/*
- * Initialize all of memory for ECC, then enable errors.
- */
-
-void
-ddr_enable_ecc(unsigned int dram_size)
-{
- uint *p = 0;
- uint i = 0;
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile ccsr_ddr_t *ddr1= &immap->im_ddr1;
-
- dma_init();
-
- for (*p = 0; p < (uint *)(8 * 1024); p++) {
- if (((unsigned int)p & 0x1f) == 0) {
- ppcDcbz((unsigned long) p);
- }
- *p = (unsigned int)CONFIG_MEM_INIT_VALUE;
- if (((unsigned int)p & 0x1c) == 0x1c) {
- ppcDcbf((unsigned long) p);
- }
- }
-
- dma_xfer((uint *)0x002000, 0x002000, (uint *)0); /* 8K */
- dma_xfer((uint *)0x004000, 0x004000, (uint *)0); /* 16K */
- dma_xfer((uint *)0x008000, 0x008000, (uint *)0); /* 32K */
- dma_xfer((uint *)0x010000, 0x010000, (uint *)0); /* 64K */
- dma_xfer((uint *)0x020000, 0x020000, (uint *)0); /* 128k */
- dma_xfer((uint *)0x040000, 0x040000, (uint *)0); /* 256k */
- dma_xfer((uint *)0x080000, 0x080000, (uint *)0); /* 512k */
- dma_xfer((uint *)0x100000, 0x100000, (uint *)0); /* 1M */
- dma_xfer((uint *)0x200000, 0x200000, (uint *)0); /* 2M */
- dma_xfer((uint *)0x400000, 0x400000, (uint *)0); /* 4M */
-
- for (i = 1; i < dram_size / 0x800000; i++) {
- dma_xfer((uint *)(0x800000*i), 0x800000, (uint *)0);
- }
-
- /*
- * Enable errors for ECC.
- */
- debug("DMA DDR: err_disable = 0x%08x\n", ddr1->err_disable);
- ddr1->err_disable = 0x00000000;
- asm volatile("sync;isync");
- debug("DMA DDR: err_disable = 0x%08x\n", ddr1->err_disable);
-}
-
-#endif /* CONFIG_DDR_ECC && ! CONFIG_ECC_INIT_VIA_DDRCONTROLLER */
diff --git a/cpu/mpc86xx/speed.c b/cpu/mpc86xx/speed.c
deleted file mode 100644
index 312ca12827..0000000000
--- a/cpu/mpc86xx/speed.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2004 Freescale Semiconductor.
- * Jeff Brown
- * Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
- *
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc86xx.h>
-#include <asm/processor.h>
-
-
-void get_sys_info(sys_info_t *sysInfo)
-{
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- volatile ccsr_gur_t *gur = &immap->im_gur;
- uint plat_ratio, e600_ratio;
-
- plat_ratio = (gur->porpllsr) & 0x0000003e;
- plat_ratio >>= 1;
-
- switch (plat_ratio) {
- case 0x0:
- sysInfo->freqSystemBus = 16 * CONFIG_SYS_CLK_FREQ;
- break;
- case 0x02:
- case 0x03:
- case 0x04:
- case 0x05:
- case 0x06:
- case 0x08:
- case 0x09:
- case 0x0a:
- case 0x0c:
- case 0x10:
- sysInfo->freqSystemBus = plat_ratio * CONFIG_SYS_CLK_FREQ;
- break;
- default:
- sysInfo->freqSystemBus = 0;
- break;
- }
-
- e600_ratio = (gur->porpllsr) & 0x003f0000;
- e600_ratio >>= 16;
-
- switch (e600_ratio) {
- case 0x10:
- sysInfo->freqProcessor = 2 * sysInfo->freqSystemBus;
- break;
- case 0x19:
- sysInfo->freqProcessor = 5 * sysInfo->freqSystemBus / 2;
- break;
- case 0x20:
- sysInfo->freqProcessor = 3 * sysInfo->freqSystemBus;
- break;
- case 0x39:
- sysInfo->freqProcessor = 7 * sysInfo->freqSystemBus / 2;
- break;
- case 0x28:
- sysInfo->freqProcessor = 4 * sysInfo->freqSystemBus;
- break;
- case 0x1d:
- sysInfo->freqProcessor = 9 * sysInfo->freqSystemBus / 2;
- break;
- default:
- sysInfo->freqProcessor = e600_ratio + sysInfo->freqSystemBus;
- break;
- }
-}
-
-
-/*
- * Measure CPU clock speed (core clock GCLK1, GCLK2)
- * (Approx. GCLK frequency in Hz)
- */
-
-int get_clocks(void)
-{
- DECLARE_GLOBAL_DATA_PTR;
- sys_info_t sys_info;
-
- get_sys_info(&sys_info);
- gd->cpu_clk = sys_info.freqProcessor;
- gd->bus_clk = sys_info.freqSystemBus;
-
- if (gd->cpu_clk != 0)
- return 0;
- else
- return 1;
-}
-
-
-/*
- * get_bus_freq
- * Return system bus freq in Hz
- */
-
-ulong get_bus_freq(ulong dummy)
-{
- ulong val;
- sys_info_t sys_info;
-
- get_sys_info(&sys_info);
- val = sys_info.freqSystemBus;
-
- return val;
-}
diff --git a/cpu/mpc86xx/start.S b/cpu/mpc86xx/start.S
deleted file mode 100644
index beaddf6b1f..0000000000
--- a/cpu/mpc86xx/start.S
+++ /dev/null
@@ -1,1186 +0,0 @@
-/*
- * Copyright 2004 Freescale Semiconductor.
- * Srikanth Srinivasan <srikanth.srinivaan@freescale.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* U-Boot - Startup Code for 86xx PowerPC based Embedded Boards
- *
- *
- * The processor starts at 0xfff00100 and the code is executed
- * from flash. The code is organized to be at an other address
- * in memory, but as long we don't jump around before relocating.
- * board_init lies at a quite high address and when the cpu has
- * jumped there, everything is ok.
- */
-#include <config.h>
-#include <mpc86xx.h>
-#include <version.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-/* We don't want the MMU yet.
-*/
-#undef MSR_KERNEL
-/* Machine Check and Recoverable Interr. */
-#define MSR_KERNEL ( MSR_ME | MSR_RI )
-
-/*
- * Set up GOT: Global Offset Table
- *
- * Use r14 to access the GOT
- */
- START_GOT
- GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_FIXUP_TABLE_)
-
- GOT_ENTRY(_start)
- GOT_ENTRY(_start_of_vectors)
- GOT_ENTRY(_end_of_vectors)
- GOT_ENTRY(transfer_to_handler)
-
- GOT_ENTRY(__init_end)
- GOT_ENTRY(_end)
- GOT_ENTRY(__bss_start)
- END_GOT
-
-/*
- * r3 - 1st arg to board_init(): IMMP pointer
- * r4 - 2nd arg to board_init(): boot flag
- */
- .text
- .long 0x27051956 /* U-Boot Magic Number */
- .globl version_string
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
-
- . = EXC_OFF_SYS_RESET
- .globl _start
-_start:
- li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
- b boot_cold
- sync
-
- . = EXC_OFF_SYS_RESET + 0x10
-
- .globl _start_warm
-_start_warm:
- li r21, BOOTFLAG_WARM /* Software reboot */
- b boot_warm
- sync
-
- /* the boot code is located below the exception table */
-
- .globl _start_of_vectors
-_start_of_vectors:
-
-/* Machine check */
- STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. */
- STD_EXCEPTION(0x300, DataStorage, UnknownException)
-
-/* Instruction Storage exception. */
- STD_EXCEPTION(0x400, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
- STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
-
-/* Alignment exception. */
- . = 0x600
-Alignment:
- EXCEPTION_PROLOG
- mfspr r4,DAR
- stw r4,_DAR(r21)
- mfspr r5,DSISR
- stw r5,_DSISR(r21)
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_Alignment:
- .long AlignmentException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
- . = 0x700
-ProgramCheck:
- EXCEPTION_PROLOG
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_ProgramCheck:
- .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
- STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
-
- /* I guess we could implement decrementer, and may have
- * to someday for timekeeping.
- */
- STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
- STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
- STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
- STD_EXCEPTION(0xc00, SystemCall, UnknownException)
- STD_EXCEPTION(0xd00, SingleStep, UnknownException)
- STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
- STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
- STD_EXCEPTION(0x1000, SoftEmu, SoftEmuException)
- STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
- STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
- STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
- STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
- STD_EXCEPTION(0x1500, Reserved5, UnknownException)
- STD_EXCEPTION(0x1600, Reserved6, UnknownException)
- STD_EXCEPTION(0x1700, Reserved7, UnknownException)
- STD_EXCEPTION(0x1800, Reserved8, UnknownException)
- STD_EXCEPTION(0x1900, Reserved9, UnknownException)
- STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
- STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
- STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
- STD_EXCEPTION(0x1d00, InstructionBreakpoint, UnknownException)
- STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
- STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
-
- .globl _end_of_vectors
-_end_of_vectors:
-
- . = 0x2000
-
-boot_cold:
-boot_warm:
-
- /* if this is a multi-core system we need to check which cpu
- * this is, if it is not cpu 0 send the cpu to the linux reset
- * vector */
-#if (CONFIG_NUM_CPUS > 1)
- mfspr r0, MSSCR0
- andi. r0, r0, 0x0020
- rlwinm r0,r0,27,31,31
- mtspr PIR, r0
- beq 1f
-
- bl secondary_cpu_setup
-#endif
-
- /* disable everything */
-1: li r0, 0
- mtspr HID0, r0
- sync
- mtmsr 0
- bl invalidate_bats
- sync
-
-#ifdef CFG_L2
- /* init the L2 cache */
- addis r3, r0, L2_INIT@h
- ori r3, r3, L2_INIT@l
- mtspr l2cr, r3
- /* invalidate the L2 cache */
- bl l2cache_invalidate
- sync
-#endif
-
- /*
- * Calculate absolute address in FLASH and jump there
- *------------------------------------------------------*/
- lis r3, CFG_MONITOR_BASE@h
- ori r3, r3, CFG_MONITOR_BASE@l
- addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
- mtlr r3
- blr
-
-in_flash:
- /* let the C-code set up the rest */
- /* */
- /* Be careful to keep code relocatable ! */
- /*------------------------------------------------------*/
- /* perform low-level init */
-
- /* enable extended addressing */
- bl enable_ext_addr
-
- /* setup the bats */
- bl setup_bats
- sync
-
-#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR)
- /* setup ccsrbar */
- bl setup_ccsrbar
-#endif
-
- /* Fix for SMP linux - Changing arbitration to round-robin */
- lis r3, CFG_CCSRBAR@h
- ori r3, r3, 0x1000
- xor r4, r4, r4
- li r4, 0x1000
- stw r4, 0(r3)
-
- /* setup the law entries */
- bl law_entry
- sync
-
- /* Don't use this feature due to bug in 8641D PD4 */
- /* Disable ERD_DIS */
- lis r3, CFG_CCSRBAR@h
- ori r3, r3, 0x1008
- lwz r4, 0(r3)
- oris r4, r4, 0x4000
- stw r4, 0(r3)
- sync
-
-#if (EMULATOR_RUN == 1)
- /* On the emulator we want to adjust these ASAP */
- /* otherwise things are sloooow */
- /* Setup OR0 (LALE FIX)*/
- lis r3, CFG_CCSRBAR@h
- ori r3, r3, 0x5004
- li r4, 0x0FF3
- stw r4, 0(r3)
- sync
-
- /* Setup LCRR */
- lis r3, CFG_CCSRBAR@h
- ori r3, r3, 0x50D4
- lis r4, 0x8000
- ori r4, r4, 0x0002
- stw r4, 0(r3)
- sync
-#endif
- /* make sure timer enabled in guts register too */
- lis r3, CFG_CCSRBAR@h
- oris r3,r3, 0xE
- ori r3,r3,0x0070
- lwz r4, 0(r3)
- lis r5,0xFFFC
- ori r5,r5,0x5FFF
- and r4,r4,r5
- stw r4,0(r3)
- /*
- * Cache must be enabled here for stack-in-cache trick.
- * This means we need to enable the BATS.
- * Cache should be turned on after BATs, since by default
- * everything is write-through.
- */
-
- /* enable address translation */
- bl enable_addr_trans
- sync
-
- /* enable and invalidate the data cache */
-/* bl l1dcache_enable */
- bl dcache_enable
- sync
-
- bl icache_enable
-
-#ifdef CFG_INIT_RAM_LOCK
- bl lock_ram_in_cache
- sync
-#endif
-
- /* set up the stack pointer in our newly created
- * cache-ram (r1) */
- lis r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@h
- ori r1, r1, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@l
-
- li r0, 0 /* Make room for stack frame header and */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
-
- GET_GOT /* initialize GOT access */
-
- /* run low-level CPU init code (from Flash) */
- bl cpu_init_f
- sync
-
-#ifdef RUN_DIAG
-
- /* Sri: Code to run the diagnostic automatically */
-
- /* Load PX_AUX register address in r4 */
- lis r4, 0xf810
- ori r4, r4, 0x6
- /* Load contents of PX_AUX in r3 bits 24 to 31*/
- lbz r3, 0(r4)
-
- /* Mask and obtain the bit in r3 */
- rlwinm. r3, r3, 0, 24, 24
- /* If not zero, jump and continue with u-boot */
- bne diag_done
-
- /* Load back contents of PX_AUX in r3 bits 24 to 31 */
- lbz r3, 0(r4)
- /* Set the MSB of the register value */
- ori r3, r3, 0x80
- /* Write value in r3 back to PX_AUX */
- stb r3, 0(r4)
-
- /* Get the address to jump to in r3*/
- lis r3, CFG_DIAG_ADDR@h
- ori r3, r3, CFG_DIAG_ADDR@l
-
- /* Load the LR with the branch address */
- mtlr r3
-
- /* Branch to diagnostic */
- blr
-
-diag_done:
-#endif
-
-/* bl l2cache_enable */
- mr r3, r21
-
- /* r3: BOOTFLAG */
- /* run 1st part of board init code (from Flash) */
- bl board_init_f
- sync
-
- /* NOTREACHED */
-
- .globl invalidate_bats
-invalidate_bats:
-
- /* invalidate BATs */
- mtspr IBAT0U, r0
- mtspr IBAT1U, r0
- mtspr IBAT2U, r0
- mtspr IBAT3U, r0
- mtspr IBAT4U, r0
- mtspr IBAT5U, r0
- mtspr IBAT6U, r0
- mtspr IBAT7U, r0
-
- isync
- mtspr DBAT0U, r0
- mtspr DBAT1U, r0
- mtspr DBAT2U, r0
- mtspr DBAT3U, r0
- mtspr DBAT4U, r0
- mtspr DBAT5U, r0
- mtspr DBAT6U, r0
- mtspr DBAT7U, r0
-
- isync
- sync
- blr
-
-
- /* setup_bats - set them up to some initial state */
- .globl setup_bats
-setup_bats:
-
- addis r0, r0, 0x0000
-
- /* IBAT 0 */
- addis r4, r0, CFG_IBAT0L@h
- ori r4, r4, CFG_IBAT0L@l
- addis r3, r0, CFG_IBAT0U@h
- ori r3, r3, CFG_IBAT0U@l
- mtspr IBAT0L, r4
- mtspr IBAT0U, r3
- isync
-
- /* DBAT 0 */
- addis r4, r0, CFG_DBAT0L@h
- ori r4, r4, CFG_DBAT0L@l
- addis r3, r0, CFG_DBAT0U@h
- ori r3, r3, CFG_DBAT0U@l
- mtspr DBAT0L, r4
- mtspr DBAT0U, r3
- isync
-
- /* IBAT 1 */
- addis r4, r0, CFG_IBAT1L@h
- ori r4, r4, CFG_IBAT1L@l
- addis r3, r0, CFG_IBAT1U@h
- ori r3, r3, CFG_IBAT1U@l
- mtspr IBAT1L, r4
- mtspr IBAT1U, r3
- isync
-
- /* DBAT 1 */
- addis r4, r0, CFG_DBAT1L@h
- ori r4, r4, CFG_DBAT1L@l
- addis r3, r0, CFG_DBAT1U@h
- ori r3, r3, CFG_DBAT1U@l
- mtspr DBAT1L, r4
- mtspr DBAT1U, r3
- isync
-
- /* IBAT 2 */
- addis r4, r0, CFG_IBAT2L@h
- ori r4, r4, CFG_IBAT2L@l
- addis r3, r0, CFG_IBAT2U@h
- ori r3, r3, CFG_IBAT2U@l
- mtspr IBAT2L, r4
- mtspr IBAT2U, r3
- isync
-
- /* DBAT 2 */
- addis r4, r0, CFG_DBAT2L@h
- ori r4, r4, CFG_DBAT2L@l
- addis r3, r0, CFG_DBAT2U@h
- ori r3, r3, CFG_DBAT2U@l
- mtspr DBAT2L, r4
- mtspr DBAT2U, r3
- isync
-
- /* IBAT 3 */
- addis r4, r0, CFG_IBAT3L@h
- ori r4, r4, CFG_IBAT3L@l
- addis r3, r0, CFG_IBAT3U@h
- ori r3, r3, CFG_IBAT3U@l
- mtspr IBAT3L, r4
- mtspr IBAT3U, r3
- isync
-
- /* DBAT 3 */
- addis r4, r0, CFG_DBAT3L@h
- ori r4, r4, CFG_DBAT3L@l
- addis r3, r0, CFG_DBAT3U@h
- ori r3, r3, CFG_DBAT3U@l
- mtspr DBAT3L, r4
- mtspr DBAT3U, r3
- isync
-
- /* IBAT 4 */
- addis r4, r0, CFG_IBAT4L@h
- ori r4, r4, CFG_IBAT4L@l
- addis r3, r0, CFG_IBAT4U@h
- ori r3, r3, CFG_IBAT4U@l
- mtspr IBAT4L, r4
- mtspr IBAT4U, r3
- isync
-
- /* DBAT 4 */
- addis r4, r0, CFG_DBAT4L@h
- ori r4, r4, CFG_DBAT4L@l
- addis r3, r0, CFG_DBAT4U@h
- ori r3, r3, CFG_DBAT4U@l
- mtspr DBAT4L, r4
- mtspr DBAT4U, r3
- isync
-
- /* IBAT 5 */
- addis r4, r0, CFG_IBAT5L@h
- ori r4, r4, CFG_IBAT5L@l
- addis r3, r0, CFG_IBAT5U@h
- ori r3, r3, CFG_IBAT5U@l
- mtspr IBAT5L, r4
- mtspr IBAT5U, r3
- isync
-
- /* DBAT 5 */
- addis r4, r0, CFG_DBAT5L@h
- ori r4, r4, CFG_DBAT5L@l
- addis r3, r0, CFG_DBAT5U@h
- ori r3, r3, CFG_DBAT5U@l
- mtspr DBAT5L, r4
- mtspr DBAT5U, r3
- isync
-
- /* IBAT 6 */
- addis r4, r0, CFG_IBAT6L@h
- ori r4, r4, CFG_IBAT6L@l
- addis r3, r0, CFG_IBAT6U@h
- ori r3, r3, CFG_IBAT6U@l
- mtspr IBAT6L, r4
- mtspr IBAT6U, r3
- isync
-
- /* DBAT 6 */
- addis r4, r0, CFG_DBAT6L@h
- ori r4, r4, CFG_DBAT6L@l
- addis r3, r0, CFG_DBAT6U@h
- ori r3, r3, CFG_DBAT6U@l
- mtspr DBAT6L, r4
- mtspr DBAT6U, r3
- isync
-
- /* IBAT 7 */
- addis r4, r0, CFG_IBAT7L@h
- ori r4, r4, CFG_IBAT7L@l
- addis r3, r0, CFG_IBAT7U@h
- ori r3, r3, CFG_IBAT7U@l
- mtspr IBAT7L, r4
- mtspr IBAT7U, r3
- isync
-
- /* DBAT 7 */
- addis r4, r0, CFG_DBAT7L@h
- ori r4, r4, CFG_DBAT7L@l
- addis r3, r0, CFG_DBAT7U@h
- ori r3, r3, CFG_DBAT7U@l
- mtspr DBAT7L, r4
- mtspr DBAT7U, r3
- isync
-
-1:
- addis r3, 0, 0x0000
- addis r5, 0, 0x4 /* upper bound of 0x00040000 for 7400/750 */
- isync
-
-tlblp:
- tlbie r3
- sync
- addi r3, r3, 0x1000
- cmp 0, 0, r3, r5
- blt tlblp
-
- blr
-
- .globl enable_addr_trans
-enable_addr_trans:
- /* enable address translation */
- mfmsr r5
- ori r5, r5, (MSR_IR | MSR_DR)
- mtmsr r5
- isync
- blr
-
- .globl disable_addr_trans
-disable_addr_trans:
- /* disable address translation */
- mflr r4
- mfmsr r3
- andi. r0, r3, (MSR_IR | MSR_DR)
- beqlr
- andc r3, r3, r0
- mtspr SRR0, r4
- mtspr SRR1, r3
- rfi
-
-/*
- * This code finishes saving the registers to the exception frame
- * and jumps to the appropriate handler for the exception.
- * Register r21 is pointer into trap frame, r1 has new stack pointer.
- */
- .globl transfer_to_handler
-transfer_to_handler:
- stw r22,_NIP(r21)
- lis r22,MSR_POW@h
- andc r23,r23,r22
- stw r23,_MSR(r21)
- SAVE_GPR(7, r21)
- SAVE_4GPRS(8, r21)
- SAVE_8GPRS(12, r21)
- SAVE_8GPRS(24, r21)
- mflr r23
- andi. r24,r23,0x3f00 /* get vector offset */
- stw r24,TRAP(r21)
- li r22,0
- stw r22,RESULT(r21)
- mtspr SPRG2,r22 /* r1 is now kernel sp */
- lwz r24,0(r23) /* virtual address of handler */
- lwz r23,4(r23) /* where to go when done */
- mtspr SRR0,r24
- mtspr SRR1,r20
- mtlr r23
- SYNC
- rfi /* jump to handler, enable MMU */
-
-int_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr SRR0,r2
- mtspr SRR1,r0
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfi
-
- .globl dc_read
-dc_read:
- blr
-
- .globl get_pvr
-get_pvr:
- mfspr r3, PVR
- blr
-
- .globl get_svr
-get_svr:
- mfspr r3, SVR
- blr
-
-
-/*
- * Function: in8
- * Description: Input 8 bits
- */
- .globl in8
-in8:
- lbz r3,0x0000(r3)
- blr
-
-/*
- * Function: out8
- * Description: Output 8 bits
- */
- .globl out8
-out8:
- stb r4,0x0000(r3)
- blr
-
-/*
- * Function: out16
- * Description: Output 16 bits
- */
- .globl out16
-out16:
- sth r4,0x0000(r3)
- blr
-
-/*
- * Function: out16r
- * Description: Byte reverse and output 16 bits
- */
- .globl out16r
-out16r:
- sthbrx r4,r0,r3
- blr
-
-/*
- * Function: out32
- * Description: Output 32 bits
- */
- .globl out32
-out32:
- stw r4,0x0000(r3)
- blr
-
-/*
- * Function: out32r
- * Description: Byte reverse and output 32 bits
- */
- .globl out32r
-out32r:
- stwbrx r4,r0,r3
- blr
-
-/*
- * Function: in16
- * Description: Input 16 bits
- */
- .globl in16
-in16:
- lhz r3,0x0000(r3)
- blr
-
-/*
- * Function: in16r
- * Description: Input 16 bits and byte reverse
- */
- .globl in16r
-in16r:
- lhbrx r3,r0,r3
- blr
-
-/*
- * Function: in32
- * Description: Input 32 bits
- */
- .globl in32
-in32:
- lwz 3,0x0000(3)
- blr
-
-/*
- * Function: in32r
- * Description: Input 32 bits and byte reverse
- */
- .globl in32r
-in32r:
- lwbrx r3,r0,r3
- blr
-
-/*
- * Function: ppcDcbf
- * Description: Data Cache block flush
- * Input: r3 = effective address
- * Output: none.
- */
- .globl ppcDcbf
-ppcDcbf:
- dcbf r0,r3
- blr
-
-/*
- * Function: ppcDcbi
- * Description: Data Cache block Invalidate
- * Input: r3 = effective address
- * Output: none.
- */
- .globl ppcDcbi
-ppcDcbi:
- dcbi r0,r3
- blr
-
-/*
- * Function: ppcDcbz
- * Description: Data Cache block zero.
- * Input: r3 = effective address
- * Output: none.
- */
- .globl ppcDcbz
-ppcDcbz:
- dcbz r0,r3
- blr
-
-/*
- * Function: ppcSync
- * Description: Processor Synchronize
- * Input: none.
- * Output: none.
- */
- .globl ppcSync
-ppcSync:
- sync
- blr
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
- */
- .globl relocate_code
-relocate_code:
-
- mr r1, r3 /* Set new stack pointer */
- mr r9, r4 /* Save copy of Global Data pointer */
- mr r29, r9 /* Save for DECLARE_GLOBAL_DATA_PTR */
- mr r10, r5 /* Save copy of Destination Address */
-
- mr r3, r5 /* Destination Address */
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
- lwz r5, GOT(__init_end)
- sub r5, r5, r4
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
- *
- * Offset:
- */
- sub r15, r10, r4
-
- /* First our own GOT */
- add r14, r14, r15
- /* then the one used by the C code */
- add r30, r30, r15
-
- /*
- * Now relocate code
- */
-#ifdef CONFIG_ECC
- bl board_relocate_rom
- sync
- mr r3, r10 /* Destination Address */
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
- lwz r5, GOT(__init_end)
- sub r5, r5, r4
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-#else
- cmplw cr1,r3,r4
- addi r0,r5,3
- srwi. r0,r0,2
- beq cr1,4f /* In place copy is not necessary */
- beq 7f /* Protect against 0 count */
- mtctr r0
- bge cr1,2f
-
- la r8,-4(r4)
- la r7,-4(r3)
-1: lwzu r0,4(r8)
- stwu r0,4(r7)
- bdnz 1b
- b 4f
-
-2: slwi r0,r0,2
- add r8,r4,r0
- add r7,r3,r0
-3: lwzu r0,-4(r8)
- stwu r0,-4(r7)
- bdnz 3b
-#endif
-/*
- * Now flush the cache: note that we must start from a cache aligned
- * address. Otherwise we might miss one cache line.
- */
-4: cmpwi r6,0
- add r5,r3,r5
- beq 7f /* Always flush prefetch queue in any case */
- subi r0,r6,1
- andc r3,r3,r0
- mr r4,r3
-5: dcbst 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 5b
- sync /* Wait for all dcbst to complete on bus */
- mr r4,r3
-6: icbi 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 6b
-7: sync /* Wait for all icbi to complete on bus */
- isync
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
- addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
- mtlr r0
- blr
-
-in_ram:
-#ifdef CONFIG_ECC
- bl board_init_ecc
-#endif
- /*
- * Relocation Function, r14 point to got2+0x8000
- *
- * Adjust got2 pointers, no need to check for 0, this code
- * already puts a few entries in the table.
- */
- li r0,__got2_entries@sectoff@l
- la r3,GOT(_GOT2_TABLE_)
- lwz r11,GOT(_GOT2_TABLE_)
- mtctr r0
- sub r11,r3,r11
- addi r3,r3,-4
-1: lwzu r0,4(r3)
- add r0,r0,r11
- stw r0,0(r3)
- bdnz 1b
-
- /*
- * Now adjust the fixups and the pointers to the fixups
- * in case we need to move ourselves again.
- */
-2: li r0,__fixup_entries@sectoff@l
- lwz r3,GOT(_FIXUP_TABLE_)
- cmpwi r0,0
- mtctr r0
- addi r3,r3,-4
- beq 4f
-3: lwzu r4,4(r3)
- lwzux r0,r4,r11
- add r0,r0,r11
- stw r10,0(r3)
- stw r0,0(r4)
- bdnz 3b
-4:
-/* clear_bss: */
- /*
- * Now clear BSS segment
- */
- lwz r3,GOT(__bss_start)
- lwz r4,GOT(_end)
-
- cmplw 0, r3, r4
- beq 6f
-
- li r0, 0
-5:
- stw r0, 0(r3)
- addi r3, r3, 4
- cmplw 0, r3, r4
- bne 5b
-6:
- mr r3, r9 /* Init Date pointer */
- mr r4, r10 /* Destination Address */
- bl board_init_r
-
- /* not reached - end relocate_code */
-/*-----------------------------------------------------------------------*/
-
- /*
- * Copy exception vector code to low memory
- *
- * r3: dest_addr
- * r7: source address, r8: end address, r9: target address
- */
- .globl trap_init
-trap_init:
- lwz r7, GOT(_start)
- lwz r8, GOT(_end_of_vectors)
-
- li r9, 0x100 /* reset vector always at 0x100 */
-
- cmplw 0, r7, r8
- bgelr /* return if r7>=r8 - just in case */
-
- mflr r4 /* save link register */
-1:
- lwz r0, 0(r7)
- stw r0, 0(r9)
- addi r7, r7, 4
- addi r9, r9, 4
- cmplw 0, r7, r8
- bne 1b
-
- /*
- * relocate `hdlr' and `int_return' entries
- */
- li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
- li r8, Alignment - _start + EXC_OFF_SYS_RESET
-2:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 2b
-
- li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
- li r8, SystemCall - _start + EXC_OFF_SYS_RESET
-3:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 3b
-
- li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
- li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-4:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 4b
-
- /* enable execptions from RAM vectors */
- mfmsr r7
- li r8,MSR_IP
- andc r7,r7,r8
- mtmsr r7
-
- mtlr r4 /* restore link register */
- blr
-
- /*
- * Function: relocate entries for one exception vector
- */
-trap_reloc:
- lwz r0, 0(r7) /* hdlr ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 0(r7)
-
- lwz r0, 4(r7) /* int_return ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 4(r7)
-
- sync
- isync
-
- blr
-
-.globl enable_ext_addr
-enable_ext_addr:
- mfspr r0, HID0
- lis r0, (HID0_HIGH_BAT_EN | HID0_XBSEN | HID0_XAEN)@h
- ori r0, r0, (HID0_HIGH_BAT_EN | HID0_XBSEN | HID0_XAEN)@l
- mtspr HID0, r0
- sync
- isync
- blr
-
-#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR)
-.globl setup_ccsrbar
-setup_ccsrbar:
- /* Special sequence needed to update CCSRBAR itself */
- lis r4, CFG_CCSRBAR_DEFAULT@h
- ori r4, r4, CFG_CCSRBAR_DEFAULT@l
-
- lis r5, CFG_CCSRBAR@h
- ori r5, r5, CFG_CCSRBAR@l
- srwi r6,r5,12
- stw r6, 0(r4)
- isync
-
- lis r5, 0xffff
- ori r5,r5,0xf000
- lwz r5, 0(r5)
- isync
-
- lis r3, CFG_CCSRBAR@h
- lwz r5, CFG_CCSRBAR@l(r3)
- isync
-
- blr
-#endif
-
-#ifdef CFG_INIT_RAM_LOCK
-lock_ram_in_cache:
- /* Allocate Initial RAM in data cache.
- */
- lis r3, (CFG_INIT_RAM_ADDR & ~31)@h
- ori r3, r3, (CFG_INIT_RAM_ADDR & ~31)@l
- li r2, ((CFG_INIT_RAM_END & ~31) + \
- (CFG_INIT_RAM_ADDR & 31) + 31) / 32
- mtctr r2
-1:
- dcbz r0, r3
- addi r3, r3, 32
- bdnz 1b
-/* Lock the data cache */
- mfspr r0, HID0
- ori r0, r0, 0x1000
- sync
- mtspr HID0, r0
- sync
- blr
-
-.globl unlock_ram_in_cache
-unlock_ram_in_cache:
- /* invalidate the INIT_RAM section */
- lis r3, (CFG_INIT_RAM_ADDR & ~31)@h
- ori r3, r3, (CFG_INIT_RAM_ADDR & ~31)@l
- li r2, ((CFG_INIT_RAM_END & ~31) + \
- (CFG_INIT_RAM_ADDR & 31) + 31) / 32
- mtctr r2
-1: icbi r0, r3
- addi r3, r3, 32
- bdnz 1b
- sync /* Wait for all icbi to complete on bus */
- isync
-/* Unlock the data cache and invalidate it */
- mfspr r0, HID0
- li r3,0x1000
- andc r0,r0,r3
- li r3,0x0400
- or r0,r0,r3
- sync
- mtspr HID0, r0
- sync
- blr
-#endif
-
-/* If this is a multi-cpu system then we need to handle the
- * 2nd cpu. The assumption is that the 2nd cpu is being
- * held in boot holdoff mode until the 1st cpu unlocks it
- * from Linux. We'll do some basic cpu init and then pass
- * it to the Linux Reset Vector.
- * Sri: Much of this initialization is not required. Linux
- * rewrites the bats, and the sprs and also enables the L1 cache.
- */
-#if (CONFIG_NUM_CPUS > 1)
-.globl secondary_cpu_setup
-secondary_cpu_setup:
- /* Do only core setup on all cores except cpu0 */
- bl invalidate_bats
- sync
- bl enable_ext_addr
-
-#ifdef CFG_L2
- /* init the L2 cache */
- addis r3, r0, L2_INIT@h
- ori r3, r3, L2_INIT@l
- sync
- mtspr l2cr, r3
-#ifdef CONFIG_ALTIVEC
- dssall
-#endif
- /* invalidate the L2 cache */
- bl l2cache_invalidate
- sync
-#endif
-
- /* enable and invalidate the data cache */
- bl dcache_enable
- sync
-
- /* enable and invalidate the instruction cache*/
- bl icache_enable
- sync
-
- /* TBEN in HID0 */
- mfspr r4, HID0
- oris r4, r4, 0x0400
- mtspr HID0, r4
- sync
- isync
-
- /*SYNCBE|ABE in HID1*/
- mfspr r4, HID1
- ori r4, r4, 0x0C00
- mtspr HID1, r4
- sync
- isync
-
- lis r3, CONFIG_LINUX_RESET_VEC@h
- ori r3, r3, CONFIG_LINUX_RESET_VEC@l
- mtlr r3
- blr
-
- /* Never Returns, Running in Linux Now */
-#endif
diff --git a/cpu/mpc86xx/traps.c b/cpu/mpc86xx/traps.c
deleted file mode 100644
index 8ea14e575f..0000000000
--- a/cpu/mpc86xx/traps.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- * Modified by Cort Dougan (cort@cs.nmt.edu)
- * and Paul Mackerras (paulus@cs.anu.edu.au)
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * This file handles the architecture-dependent parts of hardware exceptions
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/processor.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
-/* Returns 0 if exception not found and fixup otherwise. */
-extern unsigned long search_exception_table(unsigned long);
-
-#define END_OF_MEM (gd->bd->bi_memstart + gd->bd->bi_memsize)
-
-/*
- * Trap & Exception support
- */
-
-void
-print_backtrace(unsigned long *sp)
-{
- DECLARE_GLOBAL_DATA_PTR;
-
- int cnt = 0;
- unsigned long i;
-
- printf("Call backtrace: ");
- while (sp) {
- if ((uint) sp > END_OF_MEM)
- break;
-
- i = sp[1];
- if (cnt++ % 7 == 0)
- printf("\n");
- printf("%08lX ", i);
- if (cnt > 32)
- break;
- sp = (unsigned long *)*sp;
- }
- printf("\n");
-}
-
-void
-show_regs(struct pt_regs *regs)
-{
- int i;
-
- printf("NIP: %08lX XER: %08lX LR: %08lX REGS:"
- " %p TRAP: %04lx DAR: %08lX\n",
- regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
- printf("MSR: %08lx EE: %01x PR: %01x FP:"
- " %01x ME: %01x IR/DR: %01x%01x\n",
- regs->msr, regs->msr & MSR_EE ? 1 : 0,
- regs->msr & MSR_PR ? 1 : 0, regs->msr & MSR_FP ? 1 : 0,
- regs->msr & MSR_ME ? 1 : 0, regs->msr & MSR_IR ? 1 : 0,
- regs->msr & MSR_DR ? 1 : 0);
-
- printf("\n");
- for (i = 0; i < 32; i++) {
- if ((i % 8) == 0) {
- printf("GPR%02d: ", i);
- }
-
- printf("%08lX ", regs->gpr[i]);
- if ((i % 8) == 7) {
- printf("\n");
- }
- }
-}
-
-
-void
-_exception(int signr, struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Exception in kernel pc %lx signal %d", regs->nip, signr);
-}
-
-void
-MachineCheckException(struct pt_regs *regs)
-{
- unsigned long fixup;
-
- /* Probing PCI using config cycles cause this exception
- * when a device is not present. Catch it and return to
- * the PCI exception handler.
- */
- if ((fixup = search_exception_table(regs->nip)) != 0) {
- regs->nip = fixup;
- return;
- }
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler) (regs))
- return;
-#endif
-
- printf("Machine check in kernel mode.\n");
- printf("Caused by (from msr): ");
- printf("regs %p ", regs);
- switch (regs->msr & 0x000F0000) {
- case (0x80000000 >> 12):
- printf("Machine check signal - probably due to mm fault\n"
- "with mmu off\n");
- break;
- case (0x80000000 >> 13):
- printf("Transfer error ack signal\n");
- break;
- case (0x80000000 >> 14):
- printf("Data parity signal\n");
- break;
- case (0x80000000 >> 15):
- printf("Address parity signal\n");
- break;
- default:
- printf("Unknown values in msr\n");
- }
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("machine check");
-}
-
-void
-AlignmentException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler) (regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Alignment Exception");
-}
-
-void
-ProgramCheckException(struct pt_regs *regs)
-{
- unsigned char *p = regs ? (unsigned char *)(regs->nip) : NULL;
- int i, j;
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler) (regs))
- return;
-#endif
- show_regs(regs);
-
- p = (unsigned char *)((unsigned long)p & 0xFFFFFFE0);
- p -= 32;
- for (i = 0; i < 256; i += 16) {
- printf("%08x: ", (unsigned int)p + i);
- for (j = 0; j < 16; j++) {
- printf("%02x ", p[i + j]);
- }
- printf("\n");
- }
-
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Program Check Exception");
-}
-
-void
-SoftEmuException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler) (regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Software Emulation Exception");
-}
-
-void
-UnknownException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler) (regs))
- return;
-#endif
- printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
- regs->nip, regs->msr, regs->trap);
- _exception(0, regs);
-}
-
-/*
- * Probe an address by reading.
- * If not present, return -1,
- * otherwise return 0.
- */
-int
-addr_probe(uint *addr)
-{
- return 0;
-}
diff --git a/cpu/mpc8xx/Makefile b/cpu/mpc8xx/Makefile
deleted file mode 100644
index 223b30cbcc..0000000000
--- a/cpu/mpc8xx/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-# CFLAGS += -DET_DEBUG
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o kgdb.o
-COBJS = bedbug_860.o commproc.o cpu.o cpu_init.o \
- fec.o i2c.o interrupts.o lcd.o scc.o \
- serial.o speed.o spi.o \
- traps.o upatch.o video.o
-SOBJS = plprcr_write.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS) $(obj)kgdb.o
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/mpc8xx/bedbug_860.c b/cpu/mpc8xx/bedbug_860.c
deleted file mode 100644
index e91a1006f7..0000000000
--- a/cpu/mpc8xx/bedbug_860.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Bedbug Functions specific to the MPC860 chip
- */
-
-#include <common.h>
-#include <command.h>
-#include <linux/ctype.h>
-#include <bedbug/bedbug.h>
-#include <bedbug/regs.h>
-#include <bedbug/ppc.h>
-#include <bedbug/type.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG) && defined(CONFIG_8xx)
-
-#define MAX_BREAK_POINTS 2
-
-extern CPU_DEBUG_CTX bug_ctx;
-
-void bedbug860_init __P((void));
-void bedbug860_do_break __P((cmd_tbl_t*,int,int,char*[]));
-void bedbug860_break_isr __P((struct pt_regs*));
-int bedbug860_find_empty __P((void));
-int bedbug860_set __P((int,unsigned long));
-int bedbug860_clear __P((int));
-
-
-/* ======================================================================
- * Initialize the global bug_ctx structure for the MPC860. Clear all
- * of the breakpoints.
- * ====================================================================== */
-
-void bedbug860_init( void )
-{
- int i;
- /* -------------------------------------------------- */
-
- bug_ctx.hw_debug_enabled = 0;
- bug_ctx.stopped = 0;
- bug_ctx.current_bp = 0;
- bug_ctx.regs = NULL;
-
- bug_ctx.do_break = bedbug860_do_break;
- bug_ctx.break_isr = bedbug860_break_isr;
- bug_ctx.find_empty = bedbug860_find_empty;
- bug_ctx.set = bedbug860_set;
- bug_ctx.clear = bedbug860_clear;
-
- for( i = 1; i <= MAX_BREAK_POINTS; ++i )
- (*bug_ctx.clear)( i );
-
- puts ("BEDBUG:ready\n");
- return;
-} /* bedbug_init_breakpoints */
-
-
-
-/* ======================================================================
- * Set/clear/show one of the hardware breakpoints for the 860. The "off"
- * string will disable a specific breakpoint. The "show" string will
- * display the current breakpoints. Otherwise an address will set a
- * breakpoint at that address. Setting a breakpoint uses the CPU-specific
- * set routine which will assign a breakpoint number.
- * ====================================================================== */
-
-void bedbug860_do_break (cmd_tbl_t *cmdtp, int flag, int argc,
- char *argv[])
-{
- long addr = 0; /* Address to break at */
- int which_bp; /* Breakpoint number */
- /* -------------------------------------------------- */
-
- if (argc < 2)
- {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return;
- }
-
- /* Turn off a breakpoint */
-
- if( strcmp( argv[ 1 ], "off" ) == 0 )
- {
- if( bug_ctx.hw_debug_enabled == 0 )
- {
- printf( "No breakpoints enabled\n" );
- return;
- }
-
- which_bp = simple_strtoul( argv[ 2 ], NULL, 10 );
-
- if( bug_ctx.clear )
- (*bug_ctx.clear)( which_bp );
-
- printf( "Breakpoint %d removed\n", which_bp );
- return;
- }
-
- /* Show a list of breakpoints */
-
- if( strcmp( argv[ 1 ], "show" ) == 0 )
- {
- for( which_bp = 1; which_bp <= MAX_BREAK_POINTS; ++which_bp )
- {
-
- switch( which_bp )
- {
- case 1: addr = GET_CMPA(); break;
- case 2: addr = GET_CMPB(); break;
- case 3: addr = GET_CMPC(); break;
- case 4: addr = GET_CMPD(); break;
- }
-
- printf( "Breakpoint [%d]: ", which_bp );
- if( addr == 0 )
- printf( "NOT SET\n" );
- else
- disppc( (unsigned char *)addr, 0, 1, bedbug_puts, F_RADHEX );
- }
- return;
- }
-
- /* Set a breakpoint at the address */
-
- if( !isdigit( argv[ 1 ][ 0 ]))
- {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return;
- }
-
- addr = simple_strtoul( argv[ 1 ], NULL, 16 ) & 0xfffffffc;
-
- if(( bug_ctx.set ) && ( which_bp = (*bug_ctx.set)( 0, addr )) > 0 )
- {
- printf( "Breakpoint [%d]: ", which_bp );
- disppc( (unsigned char *)addr, 0, 1, bedbug_puts, F_RADHEX );
- }
-
- return;
-} /* bedbug860_do_break */
-
-
-
-/* ======================================================================
- * Handle a breakpoint. First determine which breakpoint was hit by
- * looking at the DeBug Status Register (DBSR), clear the breakpoint
- * and enter a mini main loop. Stay in the loop until the stopped flag
- * in the debug context is cleared.
- * ====================================================================== */
-
-void bedbug860_break_isr( struct pt_regs *regs )
-{
- unsigned long addr; /* Address stopped at */
- unsigned long cause; /* Address stopped at */
- /* -------------------------------------------------- */
-
- cause = GET_ICR();
-
- if( !(cause & 0x00000004)) {
- printf( "Not an instruction breakpoint (ICR 0x%08lx)\n", cause );
- return;
- }
-
- addr = regs->nip;
-
- if( addr == GET_CMPA() )
- {
- bug_ctx.current_bp = 1;
- }
- else if( addr == GET_CMPB() )
- {
- bug_ctx.current_bp = 2;
- }
- else if( addr == GET_CMPC() )
- {
- bug_ctx.current_bp = 3;
- }
- else if( addr == GET_CMPD() )
- {
- bug_ctx.current_bp = 4;
- }
-
- bedbug_main_loop( addr, regs );
- return;
-} /* bedbug860_break_isr */
-
-
-
-/* ======================================================================
- * Look through all of the hardware breakpoints available to see if one
- * is unused.
- * ====================================================================== */
-
-int bedbug860_find_empty( void )
-{
- /* -------------------------------------------------- */
-
- if( GET_CMPA() == 0 )
- return 1;
-
- if( GET_CMPB() == 0 )
- return 2;
-
- if( GET_CMPC() == 0 )
- return 3;
-
- if( GET_CMPD() == 0 )
- return 4;
-
- return 0;
-} /* bedbug860_find_empty */
-
-
-
-/* ======================================================================
- * Set a breakpoint. If 'which_bp' is zero then find an unused breakpoint
- * number, otherwise reassign the given breakpoint. If hardware debugging
- * is not enabled, then turn it on via the MSR and DBCR0. Set the break
- * address in the appropriate IACx register and enable proper address
- * beakpoint in DBCR0.
- * ====================================================================== */
-
-int bedbug860_set( int which_bp, unsigned long addr )
-{
- /* -------------------------------------------------- */
-
- /* Only look if which_bp == 0, else use which_bp */
- if(( bug_ctx.find_empty ) && ( !which_bp ) &&
- ( which_bp = (*bug_ctx.find_empty)()) == 0 )
- {
- printf( "All breakpoints in use\n" );
- return 0;
- }
-
- if( which_bp < 1 || which_bp > MAX_BREAK_POINTS )
- {
- printf( "Invalid break point # %d\n", which_bp );
- return 0;
- }
-
- if( ! bug_ctx.hw_debug_enabled )
- {
- bug_ctx.hw_debug_enabled = 1;
- SET_DER( GET_DER() | 0x00000004 );
- }
-
- switch( which_bp )
- {
- case 1:
- SET_CMPA( addr );
- SET_ICTRL( GET_ICTRL() | 0x80080800 ); /* CTA=Equal,IW0=Match A,SIW0EN */
- break;
-
- case 2:
- SET_CMPB( addr );
- SET_ICTRL( GET_ICTRL() | 0x10020400 ); /* CTB=Equal,IW1=Match B,SIW1EN */
- break;
-
- case 3:
- SET_CMPC( addr );
- SET_ICTRL( GET_ICTRL() | 0x02008200 ); /* CTC=Equal,IW2=Match C,SIW2EN */
- break;
-
- case 4:
- SET_CMPD( addr );
- SET_ICTRL( GET_ICTRL() | 0x00404100 ); /* CTD=Equal,IW3=Match D,SIW3EN */
- break;
- }
-
- return which_bp;
-} /* bedbug860_set */
-
-
-
-/* ======================================================================
- * Disable a specific breakoint by setting the appropriate IACx register
- * to zero and claring the instruction address breakpoint in DBCR0.
- * ====================================================================== */
-
-int bedbug860_clear( int which_bp )
-{
- /* -------------------------------------------------- */
-
- if( which_bp < 1 || which_bp > MAX_BREAK_POINTS )
- {
- printf( "Invalid break point # (%d)\n", which_bp );
- return -1;
- }
-
- switch( which_bp )
- {
- case 1:
- SET_CMPA( 0 );
- SET_ICTRL( GET_ICTRL() & ~0x80080800 ); /* CTA=Equal,IW0=Match A,SIW0EN */
- break;
-
- case 2:
- SET_CMPB( 0 );
- SET_ICTRL( GET_ICTRL() & ~0x10020400 ); /* CTB=Equal,IW1=Match B,SIW1EN */
- break;
-
- case 3:
- SET_CMPC( 0 );
- SET_ICTRL( GET_ICTRL() & ~0x02008200 ); /* CTC=Equal,IW2=Match C,SIW2EN */
- break;
-
- case 4:
- SET_CMPD( 0 );
- SET_ICTRL( GET_ICTRL() & ~0x00404100 ); /* CTD=Equal,IW3=Match D,SIW3EN */
- break;
- }
-
- return 0;
-} /* bedbug860_clear */
-
-
-/* ====================================================================== */
-#endif
diff --git a/cpu/mpc8xx/commproc.c b/cpu/mpc8xx/commproc.c
deleted file mode 100644
index 07c763cfde..0000000000
--- a/cpu/mpc8xx/commproc.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <commproc.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#ifdef CFG_ALLOC_DPRAM
-
-int dpram_init (void)
-{
- /* Reclaim the DP memory for our use. */
- gd->dp_alloc_base = CPM_DATAONLY_BASE;
- gd->dp_alloc_top = CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE;
-
- return (0);
-}
-
-/* Allocate some memory from the dual ported ram. We may want to
- * enforce alignment restrictions, but right now everyone is a good
- * citizen.
- */
-uint dpram_alloc (uint size)
-{
- uint addr = gd->dp_alloc_base;
-
- if ((gd->dp_alloc_base + size) >= gd->dp_alloc_top)
- return (CPM_DP_NOSPACE);
-
- gd->dp_alloc_base += size;
-
- return addr;
-}
-
-uint dpram_base (void)
-{
- return gd->dp_alloc_base;
-}
-
-/* Allocate some memory from the dual ported ram. We may want to
- * enforce alignment restrictions, but right now everyone is a good
- * citizen.
- */
-uint dpram_alloc_align (uint size, uint align)
-{
- uint addr, mask = align - 1;
-
- addr = (gd->dp_alloc_base + mask) & ~mask;
-
- if ((addr + size) >= gd->dp_alloc_top)
- return (CPM_DP_NOSPACE);
-
- gd->dp_alloc_base = addr + size;
-
- return addr;
-}
-
-uint dpram_base_align (uint align)
-{
- uint mask = align - 1;
-
- return (gd->dp_alloc_base + mask) & ~mask;
-}
-#endif /* CFG_ALLOC_DPRAM */
-
-#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
-
-void post_word_store (ulong a)
-{
- volatile void *save_addr =
- ((immap_t *) CFG_IMMR)->im_cpm.cp_dpmem + CPM_POST_WORD_ADDR;
-
- *(volatile ulong *) save_addr = a;
-}
-
-ulong post_word_load (void)
-{
- volatile void *save_addr =
- ((immap_t *) CFG_IMMR)->im_cpm.cp_dpmem + CPM_POST_WORD_ADDR;
-
- return *(volatile ulong *) save_addr;
-}
-
-#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
-
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-
-void bootcount_store (ulong a)
-{
- volatile ulong *save_addr =
- (volatile ulong *)( ((immap_t *) CFG_IMMR)->im_cpm.cp_dpmem +
- CPM_BOOTCOUNT_ADDR );
-
- save_addr[0] = a;
- save_addr[1] = BOOTCOUNT_MAGIC;
-}
-
-ulong bootcount_load (void)
-{
- volatile ulong *save_addr =
- (volatile ulong *)( ((immap_t *) CFG_IMMR)->im_cpm.cp_dpmem +
- CPM_BOOTCOUNT_ADDR );
-
- if (save_addr[1] != BOOTCOUNT_MAGIC)
- return 0;
- else
- return save_addr[0];
-}
-
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
diff --git a/cpu/mpc8xx/config.mk b/cpu/mpc8xx/config.mk
deleted file mode 100644
index bfa6625fa8..0000000000
--- a/cpu/mpc8xx/config.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# (C) Copyright 2000
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
-
-PLATFORM_CPPFLAGS += -DCONFIG_8xx -ffixed-r2 -ffixed-r29 -mstring -mcpu=860 -msoft-float
diff --git a/cpu/mpc8xx/cpu.c b/cpu/mpc8xx/cpu.c
deleted file mode 100644
index 97112f03da..0000000000
--- a/cpu/mpc8xx/cpu.c
+++ /dev/null
@@ -1,634 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * m8xx.c
- *
- * CPU specific code
- *
- * written or collected and sometimes rewritten by
- * Magnus Damm <damm@bitsmart.com>
- *
- * minor modifications by
- * Wolfgang Denk <wd@denx.de>
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <command.h>
-#include <mpc8xx.h>
-#include <asm/cache.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static char *cpu_warning = "\n " \
- "*** Warning: CPU Core has Silicon Bugs -- Check the Errata ***";
-
-#if ((defined(CONFIG_MPC86x) || defined(CONFIG_MPC855)) && \
- !defined(CONFIG_MPC862))
-
-static int check_CPU (long clock, uint pvr, uint immr)
-{
- char *id_str =
-# if defined(CONFIG_MPC855)
- "PC855";
-# elif defined(CONFIG_MPC860P)
- "PC860P";
-# else
- NULL;
-# endif
- volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);
- uint k, m;
- char buf[32];
- char pre = 'X';
- char *mid = "xx";
- char *suf;
-
- /* the highest 16 bits should be 0x0050 for a 860 */
-
- if ((pvr >> 16) != 0x0050)
- return -1;
-
- k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
- m = 0;
- suf = "";
-
- /*
- * Some boards use sockets so different CPUs can be used.
- * We have to check chip version in run time.
- */
- switch (k) {
- case 0x00020001: pre = 'P'; break;
- case 0x00030001: break;
- case 0x00120003: suf = "A"; break;
- case 0x00130003: suf = "A3"; break;
-
- case 0x00200004: suf = "B"; break;
-
- case 0x00300004: suf = "C"; break;
- case 0x00310004: suf = "C1"; m = 1; break;
-
- case 0x00200064: mid = "SR"; suf = "B"; break;
- case 0x00300065: mid = "SR"; suf = "C"; break;
- case 0x00310065: mid = "SR"; suf = "C1"; m = 1; break;
- case 0x05010000: suf = "D3"; m = 1; break;
- case 0x05020000: suf = "D4"; m = 1; break;
- /* this value is not documented anywhere */
- case 0x40000000: pre = 'P'; suf = "D"; m = 1; break;
- /* MPC866P/MPC866T/MPC859T/MPC859DSL/MPC852T */
- case 0x08010004: /* Rev. A.0 */
- suf = "A";
- /* fall through */
- case 0x08000003: /* Rev. 0.3 */
- pre = 'M'; m = 1;
- if (id_str == NULL)
- id_str =
-# if defined(CONFIG_MPC852T)
- "PC852T";
-# elif defined(CONFIG_MPC859T)
- "PC859T";
-# elif defined(CONFIG_MPC859DSL)
- "PC859DSL";
-# elif defined(CONFIG_MPC866T)
- "PC866T";
-# else
- "PC866x"; /* Unknown chip from MPC866 family */
-# endif
- break;
- case 0x09000000: pre = 'M'; mid = suf = ""; m = 1;
- if (id_str == NULL)
- id_str = "PC885"; /* 870/875/880/885 */
- break;
-
- default: suf = NULL; break;
- }
-
- if (id_str == NULL)
- id_str = "PC86x"; /* Unknown 86x chip */
- if (suf)
- printf ("%c%s%sZPnn%s", pre, id_str, mid, suf);
- else
- printf ("unknown M%s (0x%08x)", id_str, k);
-
-
-#if defined(CFG_8xx_CPUCLK_MIN) && defined(CFG_8xx_CPUCLK_MAX)
- printf (" at %s MHz [%d.%d...%d.%d MHz]\n ",
- strmhz (buf, clock),
- CFG_8xx_CPUCLK_MIN / 1000000,
- ((CFG_8xx_CPUCLK_MIN % 1000000) + 50000) / 100000,
- CFG_8xx_CPUCLK_MAX / 1000000,
- ((CFG_8xx_CPUCLK_MAX % 1000000) + 50000) / 100000
- );
-#else
- printf (" at %s MHz: ", strmhz (buf, clock));
-#endif
- printf ("%u kB I-Cache %u kB D-Cache",
- checkicache () >> 10,
- checkdcache () >> 10
- );
-
- /* do we have a FEC (860T/P or 852/859/866/885)? */
-
- immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;
- if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {
- printf (" FEC present");
- }
-
- if (!m) {
- puts (cpu_warning);
- }
-
- putc ('\n');
-
-#ifdef DEBUG
- if(clock != measure_gclk()) {
- printf ("clock %ldHz != %dHz\n", clock, measure_gclk());
- }
-#endif
-
- return 0;
-}
-
-#elif defined(CONFIG_MPC862)
-
-static int check_CPU (long clock, uint pvr, uint immr)
-{
- volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);
- uint k, m;
- char buf[32];
- char pre = 'X';
- char *mid = "xx";
- char *suf;
-
- /* the highest 16 bits should be 0x0050 for a 8xx */
-
- if ((pvr >> 16) != 0x0050)
- return -1;
-
- k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
- m = 0;
-
- switch (k) {
-
- /* this value is not documented anywhere */
- case 0x06000000: mid = "P"; suf = "0"; break;
- case 0x06010001: mid = "P"; suf = "A"; m = 1; break;
- case 0x07000003: mid = "P"; suf = "B"; m = 1; break;
- default: suf = NULL; break;
- }
-
-#ifndef CONFIG_MPC857
- if (suf)
- printf ("%cPC862%sZPnn%s", pre, mid, suf);
- else
- printf ("unknown MPC862 (0x%08x)", k);
-#else
- if (suf)
- printf ("%cPC857TZPnn%s", pre, suf); /* only 857T tested right now! */
- else
- printf ("unknown MPC857 (0x%08x)", k);
-#endif
-
- printf (" at %s MHz:", strmhz (buf, clock));
-
- printf (" %u kB I-Cache", checkicache () >> 10);
- printf (" %u kB D-Cache", checkdcache () >> 10);
-
- /* lets check and see if we're running on a 862T (or P?) */
-
- immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;
- if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {
- printf (" FEC present");
- }
-
- if (!m) {
- puts (cpu_warning);
- }
-
- putc ('\n');
-
- return 0;
-}
-
-#elif defined(CONFIG_MPC823)
-
-static int check_CPU (long clock, uint pvr, uint immr)
-{
- volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);
- uint k, m;
- char buf[32];
- char *suf;
-
- /* the highest 16 bits should be 0x0050 for a 8xx */
-
- if ((pvr >> 16) != 0x0050)
- return -1;
-
- k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
- m = 0;
-
- switch (k) {
- /* MPC823 */
- case 0x20000000: suf = "0"; break;
- case 0x20010000: suf = "0.1"; break;
- case 0x20020000: suf = "Z2/3"; break;
- case 0x20020001: suf = "Z3"; break;
- case 0x21000000: suf = "A"; break;
- case 0x21010000: suf = "B"; m = 1; break;
- case 0x21010001: suf = "B2"; m = 1; break;
- /* MPC823E */
- case 0x24010000: suf = NULL;
- puts ("PPC823EZTnnB2");
- m = 1;
- break;
- default:
- suf = NULL;
- printf ("unknown MPC823 (0x%08x)", k);
- break;
- }
- if (suf)
- printf ("PPC823ZTnn%s", suf);
-
- printf (" at %s MHz:", strmhz (buf, clock));
-
- printf (" %u kB I-Cache", checkicache () >> 10);
- printf (" %u kB D-Cache", checkdcache () >> 10);
-
- /* lets check and see if we're running on a 860T (or P?) */
-
- immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;
- if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {
- puts (" FEC present");
- }
-
- if (!m) {
- puts (cpu_warning);
- }
-
- putc ('\n');
-
- return 0;
-}
-
-#elif defined(CONFIG_MPC850)
-
-static int check_CPU (long clock, uint pvr, uint immr)
-{
- volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);
- uint k, m;
- char buf[32];
-
- /* the highest 16 bits should be 0x0050 for a 8xx */
-
- if ((pvr >> 16) != 0x0050)
- return -1;
-
- k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
- m = 0;
-
- switch (k) {
- case 0x20020001:
- printf ("XPC850xxZT");
- break;
- case 0x21000065:
- printf ("XPC850xxZTA");
- break;
- case 0x21010067:
- printf ("XPC850xxZTB");
- m = 1;
- break;
- case 0x21020068:
- printf ("XPC850xxZTC");
- m = 1;
- break;
- default:
- printf ("unknown MPC850 (0x%08x)", k);
- }
- printf (" at %s MHz:", strmhz (buf, clock));
-
- printf (" %u kB I-Cache", checkicache () >> 10);
- printf (" %u kB D-Cache", checkdcache () >> 10);
-
- /* lets check and see if we're running on a 850T (or P?) */
-
- immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;
- if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {
- printf (" FEC present");
- }
-
- if (!m) {
- puts (cpu_warning);
- }
-
- putc ('\n');
-
- return 0;
-}
-#else
-#error CPU undefined
-#endif
-/* ------------------------------------------------------------------------- */
-
-int checkcpu (void)
-{
- ulong clock = gd->cpu_clk;
- uint immr = get_immr (0); /* Return full IMMR contents */
- uint pvr = get_pvr ();
-
- puts ("CPU: ");
-
- /* 850 has PARTNUM 20 */
- /* 801 has PARTNUM 10 */
- return check_CPU (clock, pvr, immr);
-}
-
-/* ------------------------------------------------------------------------- */
-/* L1 i-cache */
-/* the standard 860 has 128 sets of 16 bytes in 2 ways (= 4 kB) */
-/* the 860 P (plus) has 256 sets of 16 bytes in 4 ways (= 16 kB) */
-
-int checkicache (void)
-{
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- volatile memctl8xx_t *memctl = &immap->im_memctl;
- u32 cacheon = rd_ic_cst () & IDC_ENABLED;
-
-#ifdef CONFIG_IP86x
- u32 k = memctl->memc_br1 & ~0x00007fff; /* probe in flash memoryarea */
-#else
- u32 k = memctl->memc_br0 & ~0x00007fff; /* probe in flash memoryarea */
-#endif
- u32 m;
- u32 lines = -1;
-
- wr_ic_cst (IDC_UNALL);
- wr_ic_cst (IDC_INVALL);
- wr_ic_cst (IDC_DISABLE);
- __asm__ volatile ("isync");
-
- while (!((m = rd_ic_cst ()) & IDC_CERR2)) {
- wr_ic_adr (k);
- wr_ic_cst (IDC_LDLCK);
- __asm__ volatile ("isync");
-
- lines++;
- k += 0x10; /* the number of bytes in a cacheline */
- }
-
- wr_ic_cst (IDC_UNALL);
- wr_ic_cst (IDC_INVALL);
-
- if (cacheon)
- wr_ic_cst (IDC_ENABLE);
- else
- wr_ic_cst (IDC_DISABLE);
-
- __asm__ volatile ("isync");
-
- return lines << 4;
-};
-
-/* ------------------------------------------------------------------------- */
-/* L1 d-cache */
-/* the standard 860 has 128 sets of 16 bytes in 2 ways (= 4 kB) */
-/* the 860 P (plus) has 256 sets of 16 bytes in 2 ways (= 8 kB) */
-/* call with cache disabled */
-
-int checkdcache (void)
-{
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- volatile memctl8xx_t *memctl = &immap->im_memctl;
- u32 cacheon = rd_dc_cst () & IDC_ENABLED;
-
-#ifdef CONFIG_IP86x
- u32 k = memctl->memc_br1 & ~0x00007fff; /* probe in flash memoryarea */
-#else
- u32 k = memctl->memc_br0 & ~0x00007fff; /* probe in flash memoryarea */
-#endif
- u32 m;
- u32 lines = -1;
-
- wr_dc_cst (IDC_UNALL);
- wr_dc_cst (IDC_INVALL);
- wr_dc_cst (IDC_DISABLE);
-
- while (!((m = rd_dc_cst ()) & IDC_CERR2)) {
- wr_dc_adr (k);
- wr_dc_cst (IDC_LDLCK);
- lines++;
- k += 0x10; /* the number of bytes in a cacheline */
- }
-
- wr_dc_cst (IDC_UNALL);
- wr_dc_cst (IDC_INVALL);
-
- if (cacheon)
- wr_dc_cst (IDC_ENABLE);
- else
- wr_dc_cst (IDC_DISABLE);
-
- return lines << 4;
-};
-
-/* ------------------------------------------------------------------------- */
-
-void upmconfig (uint upm, uint * table, uint size)
-{
- uint i;
- uint addr = 0;
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
- volatile memctl8xx_t *memctl = &immap->im_memctl;
-
- for (i = 0; i < size; i++) {
- memctl->memc_mdr = table[i]; /* (16-15) */
- memctl->memc_mcr = addr | upm; /* (16-16) */
- addr++;
- }
-}
-
-/* ------------------------------------------------------------------------- */
-
-#ifndef CONFIG_LWMON
-
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- ulong msr, addr;
-
- volatile immap_t *immap = (immap_t *) CFG_IMMR;
-
- immap->im_clkrst.car_plprcr |= PLPRCR_CSR; /* Checkstop Reset enable */
-
- /* Interrupts and MMU off */
- __asm__ volatile ("mtspr 81, 0");
- __asm__ volatile ("mfmsr %0":"=r" (msr));
-
- msr &= ~0x1030;
- __asm__ volatile ("mtmsr %0"::"r" (msr));
-
- /*
- * Trying to execute the next instruction at a non-existing address
- * should cause a machine check, resulting in reset
- */
-#ifdef CFG_RESET_ADDRESS
- addr = CFG_RESET_ADDRESS;
-#else
- /*
- * note: when CFG_MONITOR_BASE points to a RAM address, CFG_MONITOR_BASE
- * - sizeof (ulong) is usually a valid address. Better pick an address
- * known to be invalid on your system and assign it to CFG_RESET_ADDRESS.
- * "(ulong)-1" used to be a good choice for many systems...
- */
- addr = CFG_MONITOR_BASE - sizeof (ulong);
-#endif
- ((void (*)(void)) addr) ();
- return 1;
-}
-
-#else /* CONFIG_LWMON */
-
-/*
- * On the LWMON board, the MCLR reset input of the PIC's on the board
- * uses a 47K/1n RC combination which has a 47us time constant. The
- * low signal on the HRESET pin of the CPU is only 512 clocks = 8 us
- * and thus too short to reset the external hardware. So we use the
- * watchdog to reset the board.
- */
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- /* prevent triggering the watchdog */
- disable_interrupts ();
-
- /* make sure the watchdog is running */
- reset_8xx_watchdog ((immap_t *) CFG_IMMR);
-
- /* wait for watchdog reset */
- while (1) {};
-
- /* NOTREACHED */
- return 1;
-}
-
-#endif /* CONFIG_LWMON */
-
-/* ------------------------------------------------------------------------- */
-
-/*
- * Get timebase clock frequency (like cpu_clk in Hz)
- *
- * See sections 14.2 and 14.6 of the User's Manual
- */
-unsigned long get_tbclk (void)
-{
- uint immr = get_immr (0); /* Return full IMMR contents */
- volatile immap_t *immap = (volatile immap_t *)(immr & 0xFFFF0000);
- ulong oscclk, factor, pll;
-
- if (immap->im_clkrst.car_sccr & SCCR_TBS) {
- return (gd->cpu_clk / 16);
- }
-
- pll = immap->im_clkrst.car_plprcr;
-
-#define PLPRCR_val(a) ((pll & PLPRCR_ ## a ## _MSK) >> PLPRCR_ ## a ## _SHIFT)
-
- /*
- * For newer PQ1 chips (MPC866/87x/88x families), PLL multiplication
- * factor is calculated as follows:
- *
- * MFN
- * MFI + -------
- * MFD + 1
- * factor = -----------------
- * (PDF + 1) * 2^S
- *
- * For older chips, it's just MF field of PLPRCR plus one.
- */
- if ((immr & 0x0FFF) >= MPC8xx_NEW_CLK) { /* MPC866/87x/88x series */
- factor = (PLPRCR_val(MFI) + PLPRCR_val(MFN)/(PLPRCR_val(MFD)+1))/
- (PLPRCR_val(PDF)+1) / (1<<PLPRCR_val(S));
- } else {
- factor = PLPRCR_val(MF)+1;
- }
-
- oscclk = gd->cpu_clk / factor;
-
- if ((immap->im_clkrst.car_sccr & SCCR_RTSEL) == 0 || factor > 2) {
- return (oscclk / 4);
- }
- return (oscclk / 16);
-}
-
-/* ------------------------------------------------------------------------- */
-
-#if defined(CONFIG_WATCHDOG)
-void watchdog_reset (void)
-{
- int re_enable = disable_interrupts ();
-
- reset_8xx_watchdog ((immap_t *) CFG_IMMR);
- if (re_enable)
- enable_interrupts ();
-}
-#endif /* CONFIG_WATCHDOG */
-
-#if defined(CONFIG_WATCHDOG) || defined(CONFIG_LWMON)
-
-void reset_8xx_watchdog (volatile immap_t * immr)
-{
-# if defined(CONFIG_LWMON)
- /*
- * The LWMON board uses a MAX6301 Watchdog
- * with the trigger pin connected to port PA.7
- *
- * (The old board version used a MAX706TESA Watchdog, which
- * had to be handled exactly the same.)
- */
-# define WATCHDOG_BIT 0x0100
- immr->im_ioport.iop_papar &= ~(WATCHDOG_BIT); /* GPIO */
- immr->im_ioport.iop_padir |= WATCHDOG_BIT; /* Output */
- immr->im_ioport.iop_paodr &= ~(WATCHDOG_BIT); /* active output */
-
- immr->im_ioport.iop_padat ^= WATCHDOG_BIT; /* Toggle WDI */
-# elif defined(CONFIG_KUP4K) || defined(CONFIG_KUP4X)
- /*
- * The KUP4 boards uses a TPS3705 Watchdog
- * with the trigger pin connected to port PA.5
- */
-# define WATCHDOG_BIT 0x0400
- immr->im_ioport.iop_papar &= ~(WATCHDOG_BIT); /* GPIO */
- immr->im_ioport.iop_padir |= WATCHDOG_BIT; /* Output */
- immr->im_ioport.iop_paodr &= ~(WATCHDOG_BIT); /* active output */
-
- immr->im_ioport.iop_padat ^= WATCHDOG_BIT; /* Toggle WDI */
-# else
- /*
- * All other boards use the MPC8xx Internal Watchdog
- */
- immr->im_siu_conf.sc_swsr = 0x556c; /* write magic1 */
- immr->im_siu_conf.sc_swsr = 0xaa39; /* write magic2 */
-# endif /* CONFIG_LWMON */
-}
-
-#endif /* CONFIG_WATCHDOG */
-
-/* ------------------------------------------------------------------------- */
diff --git a/cpu/mpc8xx/cpu_init.c b/cpu/mpc8xx/cpu_init.c
deleted file mode 100644
index c79e5780ad..0000000000
--- a/cpu/mpc8xx/cpu_init.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <watchdog.h>
-
-#include <mpc8xx.h>
-#include <commproc.h>
-
-#if defined(CFG_RTCSC) || defined(CFG_RMDS)
-DECLARE_GLOBAL_DATA_PTR;
-#endif
-
-#if defined(CFG_I2C_UCODE_PATCH) || defined(CFG_SPI_UCODE_PATCH)
-void cpm_load_patch (volatile immap_t * immr);
-#endif
-
-/*
- * Breath some life into the CPU...
- *
- * Set up the memory map,
- * initialize a bunch of registers,
- * initialize the UPM's
- */
-void cpu_init_f (volatile immap_t * immr)
-{
-#ifndef CONFIG_MBX
- volatile memctl8xx_t *memctl = &immr->im_memctl;
-# ifdef CFG_PLPRCR
- ulong mfmask;
-# endif
-#endif
- ulong reg;
-
- /* SYPCR - contains watchdog control (11-9) */
-
- immr->im_siu_conf.sc_sypcr = CFG_SYPCR;
-
-#if defined(CONFIG_WATCHDOG)
- reset_8xx_watchdog (immr);
-#endif /* CONFIG_WATCHDOG */
-
- /* SIUMCR - contains debug pin configuration (11-6) */
-#ifndef CONFIG_SVM_SC8xx
- immr->im_siu_conf.sc_siumcr |= CFG_SIUMCR;
-#else
- immr->im_siu_conf.sc_siumcr = CFG_SIUMCR;
-#endif
- /* initialize timebase status and control register (11-26) */
- /* unlock TBSCRK */
-
- immr->im_sitk.sitk_tbscrk = KAPWR_KEY;
- immr->im_sit.sit_tbscr = CFG_TBSCR;
-
- /* initialize the PIT (11-31) */
-
- immr->im_sitk.sitk_piscrk = KAPWR_KEY;
- immr->im_sit.sit_piscr = CFG_PISCR;
-
- /* System integration timers. Don't change EBDF! (15-27) */
-
- immr->im_clkrstk.cark_sccrk = KAPWR_KEY;
- reg = immr->im_clkrst.car_sccr;
- reg &= SCCR_MASK;
- reg |= CFG_SCCR;
- immr->im_clkrst.car_sccr = reg;
-
- /* PLL (CPU clock) settings (15-30) */
-
- immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
-
-#ifndef CONFIG_MBX /* MBX board does things different */
-
- /* If CFG_PLPRCR (set in the various *_config.h files) tries to
- * set the MF field, then just copy CFG_PLPRCR over car_plprcr,
- * otherwise OR in CFG_PLPRCR so we do not change the current MF
- * field value.
- *
- * For newer (starting MPC866) chips PLPRCR layout is different.
- */
-#ifdef CFG_PLPRCR
- if (get_immr(0xFFFF) >= MPC8xx_NEW_CLK)
- mfmask = PLPRCR_MFACT_MSK;
- else
- mfmask = PLPRCR_MF_MSK;
-
- if ((CFG_PLPRCR & mfmask) != 0)
- reg = CFG_PLPRCR; /* reset control bits */
- else {
- reg = immr->im_clkrst.car_plprcr;
- reg &= mfmask; /* isolate MF-related fields */
- reg |= CFG_PLPRCR; /* reset control bits */
- }
- immr->im_clkrst.car_plprcr = reg;
-#endif
-
- /*
- * Memory Controller:
- */
-
- /* perform BR0 reset that MPC850 Rev. A can't guarantee */
- reg = memctl->memc_br0;
- reg &= BR_PS_MSK; /* Clear everything except Port Size bits */
- reg |= BR_V; /* then add just the "Bank Valid" bit */
- memctl->memc_br0 = reg;
-
- /* Map banks 0 (and maybe 1) to the FLASH banks 0 (and 1) at
- * preliminary addresses - these have to be modified later
- * when FLASH size has been determined
- *
- * Depending on the size of the memory region defined by
- * CFG_OR0_REMAP some boards (wide address mask) allow to map the
- * CFG_MONITOR_BASE, while others (narrower address mask) can't
- * map CFG_MONITOR_BASE.
- *
- * For example, for CONFIG_IVMS8, the CFG_MONITOR_BASE is
- * 0xff000000, but CFG_OR0_REMAP's address mask is 0xfff80000.
- *
- * If BR0 wasn't loaded with address base 0xff000000, then BR0's
- * base address remains as 0x00000000. However, the address mask
- * have been narrowed to 512Kb, so CFG_MONITOR_BASE wasn't mapped
- * into the Bank0.
- *
- * This is why CONFIG_IVMS8 and similar boards must load BR0 with
- * CFG_BR0_PRELIM in advance.
- *
- * [Thanks to Michael Liao for this explanation.
- * I owe him a free beer. - wd]
- */
-
-#if defined(CONFIG_GTH) || \
- defined(CONFIG_HERMES) || \
- defined(CONFIG_ICU862) || \
- defined(CONFIG_IP860) || \
- defined(CONFIG_IVML24) || \
- defined(CONFIG_IVMS8) || \
- defined(CONFIG_LWMON) || \
- defined(CONFIG_MHPC) || \
- defined(CONFIG_PCU_E) || \
- defined(CONFIG_R360MPI) || \
- defined(CONFIG_RMU) || \
- defined(CONFIG_RPXCLASSIC) || \
- defined(CONFIG_RPXLITE) || \
- defined(CONFIG_SPC1920) || \
- defined(CONFIG_SPD823TS)
-
- memctl->memc_br0 = CFG_BR0_PRELIM;
-#endif
-
-#if defined(CFG_OR0_REMAP)
- memctl->memc_or0 = CFG_OR0_REMAP;
-#endif
-#if defined(CFG_OR1_REMAP)
- memctl->memc_or1 = CFG_OR1_REMAP;
-#endif
-#if defined(CFG_OR5_REMAP)
- memctl->memc_or5 = CFG_OR5_REMAP;
-#endif
-
- /* now restrict to preliminary range */
- memctl->memc_br0 = CFG_BR0_PRELIM;
- memctl->memc_or0 = CFG_OR0_PRELIM;
-
-#if (defined(CFG_OR1_PRELIM) && defined(CFG_BR1_PRELIM))
- memctl->memc_or1 = CFG_OR1_PRELIM;
- memctl->memc_br1 = CFG_BR1_PRELIM;
-#endif
-
-#if defined(CONFIG_IP860) /* disable CS0 now that Flash is mapped on CS1 */
- memctl->memc_br0 = 0;
-#endif
-
-#if defined(CFG_OR2_PRELIM) && defined(CFG_BR2_PRELIM)
- memctl->memc_or2 = CFG_OR2_PRELIM;
- memctl->memc_br2 = CFG_BR2_PRELIM;
-#endif
-
-#if defined(CFG_OR3_PRELIM) && defined(CFG_BR3_PRELIM)
- memctl->memc_or3 = CFG_OR3_PRELIM;
- memctl->memc_br3 = CFG_BR3_PRELIM;
-#endif
-
-#if defined(CFG_OR4_PRELIM) && defined(CFG_BR4_PRELIM)
- memctl->memc_or4 = CFG_OR4_PRELIM;
- memctl->memc_br4 = CFG_BR4_PRELIM;
-#endif
-
-#if defined(CFG_OR5_PRELIM) && defined(CFG_BR5_PRELIM)
- memctl->memc_or5 = CFG_OR5_PRELIM;
- memctl->memc_br5 = CFG_BR5_PRELIM;
-#endif
-
-#if defined(CFG_OR6_PRELIM) && defined(CFG_BR6_PRELIM)
- memctl->memc_or6 = CFG_OR6_PRELIM;
- memctl->memc_br6 = CFG_BR6_PRELIM;
-#endif
-
-#if defined(CFG_OR7_PRELIM) && defined(CFG_BR7_PRELIM)
- memctl->memc_or7 = CFG_OR7_PRELIM;
- memctl->memc_br7 = CFG_BR7_PRELIM;
-#endif
-
-#endif /* ! CONFIG_MBX */
-
- /*
- * Reset CPM
- */
- immr->im_cpm.cp_cpcr = CPM_CR_RST | CPM_CR_FLG;
- do { /* Spin until command processed */
- __asm__ ("eieio");
- } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG);
-
-#ifdef CONFIG_MBX
- /*
- * on the MBX, things are a little bit different:
- * - we need to read the VPD to get board information
- * - the plprcr is set up dynamically
- * - the memory controller is set up dynamically
- */
- mbx_init ();
-#endif /* CONFIG_MBX */
-
-#ifdef CONFIG_RPXCLASSIC
- rpxclassic_init ();
-#endif
-
-#if defined(CONFIG_RPXLITE) && defined(CFG_ENV_IS_IN_NVRAM)
- rpxlite_init ();
-#endif
-
-#ifdef CFG_RCCR /* must be done before cpm_load_patch() */
- /* write config value */
- immr->im_cpm.cp_rccr = CFG_RCCR;
-#endif
-
-#if defined(CFG_I2C_UCODE_PATCH) || defined(CFG_SPI_UCODE_PATCH)
- cpm_load_patch (immr); /* load mpc8xx microcode patch */
-#endif
-}
-
-/*
- * initialize higher level parts of CPU like timers
- */
-int cpu_init_r (void)
-{
-#if defined(CFG_RTCSC) || defined(CFG_RMDS)
- bd_t *bd = gd->bd;
- volatile immap_t *immr = (volatile immap_t *) (bd->bi_immr_base);
-#endif
-
-#ifdef CFG_RTCSC
- /* Unlock RTSC register */
- immr->im_sitk.sitk_rtcsck = KAPWR_KEY;
- /* write config value */
- immr->im_sit.sit_rtcsc = CFG_RTCSC;
-#endif
-
-#ifdef CFG_RMDS
- /* write config value */
- immr->im_cpm.cp_rmds = CFG_RMDS;
-#endif
- return (0);
-}
diff --git a/cpu/mpc8xx/i2c.c b/cpu/mpc8xx/i2c.c
deleted file mode 100644
index 6c59374e3f..0000000000
--- a/cpu/mpc8xx/i2c.c
+++ /dev/null
@@ -1,740 +0,0 @@
-/*
- * (C) Copyright 2000
- * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
- *
- * (C) Copyright 2000 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- * Back ported to the 8xx platform (from the 8260 platform) by
- * Murray.Jensen@cmst.csiro.au, 27-Jan-01.
- */
-
-#include <common.h>
-
-#ifdef CONFIG_HARD_I2C
-
-#include <commproc.h>
-#include <i2c.h>
-#ifdef CONFIG_LWMON
-#include <watchdog.h>
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/* define to enable debug messages */
-#undef DEBUG_I2C
-
-/*-----------------------------------------------------------------------
- * Set default values
- */
-#ifndef CFG_I2C_SPEED
-#define CFG_I2C_SPEED 50000
-#endif
-
-#ifndef CFG_I2C_SLAVE
-#define CFG_I2C_SLAVE 0xFE
-#endif
-/*-----------------------------------------------------------------------
- */
-
-/* tx/rx timeout (we need the i2c early, so we don't use get_timer()) */
-#define TOUT_LOOP 1000000
-
-#define NUM_RX_BDS 4
-#define NUM_TX_BDS 4
-#define MAX_TX_SPACE 256
-#define I2C_RXTX_LEN 128 /* maximum tx/rx buffer length */
-
-typedef struct I2C_BD
-{
- unsigned short status;
- unsigned short length;
- unsigned char *addr;
-} I2C_BD;
-#define BD_I2C_TX_START 0x0400 /* special status for i2c: Start condition */
-
-#define BD_I2C_TX_CL 0x0001 /* collision error */
-#define BD_I2C_TX_UN 0x0002 /* underflow error */
-#define BD_I2C_TX_NAK 0x0004 /* no acknowledge error */
-#define BD_I2C_TX_ERR (BD_I2C_TX_NAK|BD_I2C_TX_UN|BD_I2C_TX_CL)
-
-#define BD_I2C_RX_ERR BD_SC_OV
-
-typedef void (*i2c_ecb_t)(int, int); /* error callback function */
-
-/* This structure keeps track of the bd and buffer space usage. */
-typedef struct i2c_state {
- int rx_idx; /* index to next free Rx BD */
- int tx_idx; /* index to next free Tx BD */
- void *rxbd; /* pointer to next free Rx BD */
- void *txbd; /* pointer to next free Tx BD */
- int tx_space; /* number of Tx bytes left */
- unsigned char *tx_buf; /* pointer to free Tx area */
- i2c_ecb_t err_cb; /* error callback function */
-} i2c_state_t;
-
-
-/* flags for i2c_send() and i2c_receive() */
-#define I2CF_ENABLE_SECONDARY 0x01 /* secondary_address is valid */
-#define I2CF_START_COND 0x02 /* tx: generate start condition */
-#define I2CF_STOP_COND 0x04 /* tx: generate stop condition */
-
-/* return codes */
-#define I2CERR_NO_BUFFERS 0x01 /* no more BDs or buffer space */
-#define I2CERR_MSG_TOO_LONG 0x02 /* tried to send/receive to much data */
-#define I2CERR_TIMEOUT 0x03 /* timeout in i2c_doio() */
-#define I2CERR_QUEUE_EMPTY 0x04 /* i2c_doio called without send/receive */
-
-/* error callback flags */
-#define I2CECB_RX_ERR 0x10 /* this is a receive error */
-#define I2CECB_RX_ERR_OV 0x02 /* receive overrun error */
-#define I2CECB_RX_MASK 0x0f /* mask for error bits */
-#define I2CECB_TX_ERR 0x20 /* this is a transmit error */
-#define I2CECB_TX_CL 0x01 /* transmit collision error */
-#define I2CECB_TX_UN 0x02 /* transmit underflow error */
-#define I2CECB_TX_NAK 0x04 /* transmit no ack error */
-#define I2CECB_TX_MASK 0x0f /* mask for error bits */
-#define I2CECB_TIMEOUT 0x40 /* this is a timeout error */
-
-#ifdef DEBUG_I2C
-#define PRINTD(x) printf x
-#else
-#define PRINTD(x)
-#endif
-
-/*
- * Returns the best value of I2BRG to meet desired clock speed of I2C with
- * input parameters (clock speed, filter, and predivider value).
- * It returns computer speed value and the difference between it and desired
- * speed.
- */
-static inline int
-i2c_roundrate(int hz, int speed, int filter, int modval,
- int *brgval, int *totspeed)
-{
- int moddiv = 1 << (5-(modval & 3)), brgdiv, div;
-
- PRINTD(("\t[I2C] trying hz=%d, speed=%d, filter=%d, modval=%d\n",
- hz, speed, filter, modval));
-
- div = moddiv * speed;
- brgdiv = (hz + div - 1) / div;
-
- PRINTD(("\t\tmoddiv=%d, brgdiv=%d\n", moddiv, brgdiv));
-
- *brgval = ((brgdiv + 1) / 2) - 3 - (2*filter);
-
- if ((*brgval < 0) || (*brgval > 255)) {
- PRINTD(("\t\trejected brgval=%d\n", *brgval));
- return -1;
- }
-
- brgdiv = 2 * (*brgval + 3 + (2 * filter));
- div = moddiv * brgdiv ;
- *totspeed = hz / div;
-
- PRINTD(("\t\taccepted brgval=%d, totspeed=%d\n", *brgval, *totspeed));
-
- return 0;
-}
-
-/*
- * Sets the I2C clock predivider and divider to meet required clock speed.
- */
-static int
-i2c_setrate (int hz, int speed)
-{
- immap_t *immap = (immap_t *) CFG_IMMR;
- volatile i2c8xx_t *i2c = (i2c8xx_t *) & immap->im_i2c;
- int brgval,
- modval, /* 0-3 */
- bestspeed_diff = speed,
- bestspeed_brgval = 0,
- bestspeed_modval = 0,
- bestspeed_filter = 0,
- totspeed,
- filter = 0; /* Use this fixed value */
-
- for (modval = 0; modval < 4; modval++) {
- if (i2c_roundrate(hz,speed,filter,modval,&brgval,&totspeed) == 0) {
- int diff = speed - totspeed;
-
- if ((diff >= 0) && (diff < bestspeed_diff)) {
- bestspeed_diff = diff;
- bestspeed_modval = modval;
- bestspeed_brgval = brgval;
- bestspeed_filter = filter;
- }
- }
- }
-
- PRINTD (("[I2C] Best is:\n"));
- PRINTD (("[I2C] CPU=%dhz RATE=%d F=%d I2MOD=%08x I2BRG=%08x DIFF=%dhz\n",
- hz,
- speed,
- bestspeed_filter,
- bestspeed_modval,
- bestspeed_brgval,
- bestspeed_diff));
-
- i2c->i2c_i2mod |= ((bestspeed_modval & 3) << 1) | (bestspeed_filter << 3);
- i2c->i2c_i2brg = bestspeed_brgval & 0xff;
-
- PRINTD (("[I2C] i2mod=%08x i2brg=%08x\n", i2c->i2c_i2mod,
- i2c->i2c_i2brg));
-
- return 1;
-}
-
-void
-i2c_init(int speed, int slaveaddr)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR ;
- volatile cpm8xx_t *cp = (cpm8xx_t *)&immap->im_cpm;
- volatile i2c8xx_t *i2c = (i2c8xx_t *)&immap->im_i2c;
- volatile iic_t *iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];
- ulong rbase, tbase;
- volatile I2C_BD *rxbd, *txbd;
- uint dpaddr;
-
-#ifdef CFG_I2C_INIT_BOARD
- /* call board specific i2c bus reset routine before accessing the */
- /* environment, which might be in a chip on that bus. For details */
- /* about this problem see doc/I2C_Edge_Conditions. */
- i2c_init_board();
-#endif
-
-#ifdef CFG_I2C_UCODE_PATCH
- iip = (iic_t *)&cp->cp_dpmem[iip->iic_rpbase];
-#else
- /* Disable relocation */
- iip->iic_rpbase = 0;
-#endif
-
-#ifdef CFG_ALLOC_DPRAM
- dpaddr = iip->iic_rbase;
- if (dpaddr == 0) {
- /* need to allocate dual port ram */
- dpaddr = dpram_alloc_align(
- (NUM_RX_BDS * sizeof(I2C_BD)) + (NUM_TX_BDS * sizeof(I2C_BD)) +
- MAX_TX_SPACE, 8);
- }
-#else
- dpaddr = CPM_I2C_BASE;
-#endif
-
- /*
- * initialise data in dual port ram:
- *
- * dpaddr->rbase -> rx BD (NUM_RX_BDS * sizeof(I2C_BD) bytes)
- * tbase -> tx BD (NUM_TX_BDS * sizeof(I2C_BD) bytes)
- * tx buffer (MAX_TX_SPACE bytes)
- */
-
- rbase = dpaddr;
- tbase = rbase + NUM_RX_BDS * sizeof(I2C_BD);
-
- /* Initialize Port B I2C pins. */
- cp->cp_pbpar |= 0x00000030;
- cp->cp_pbdir |= 0x00000030;
- cp->cp_pbodr |= 0x00000030;
-
- /* Disable interrupts */
- i2c->i2c_i2mod = 0x00;
- i2c->i2c_i2cmr = 0x00;
- i2c->i2c_i2cer = 0xff;
- i2c->i2c_i2add = slaveaddr;
-
- /*
- * Set the I2C BRG Clock division factor from desired i2c rate
- * and current CPU rate (we assume sccr dfbgr field is 0;
- * divide BRGCLK by 1)
- */
- PRINTD(("[I2C] Setting rate...\n"));
- i2c_setrate (gd->cpu_clk, CFG_I2C_SPEED) ;
-
- /* Set I2C controller in master mode */
- i2c->i2c_i2com = 0x01;
-
- /* Set SDMA bus arbitration level to 5 (SDCR) */
- immap->im_siu_conf.sc_sdcr = 0x0001 ;
-
- /* Initialize Tx/Rx parameters */
- iip->iic_rbase = rbase;
- iip->iic_tbase = tbase;
- rxbd = (I2C_BD *)((unsigned char *)&cp->cp_dpmem[iip->iic_rbase]);
- txbd = (I2C_BD *)((unsigned char *)&cp->cp_dpmem[iip->iic_tbase]);
-
- PRINTD(("[I2C] rbase = %04x\n", iip->iic_rbase));
- PRINTD(("[I2C] tbase = %04x\n", iip->iic_tbase));
- PRINTD(("[I2C] rxbd = %08x\n", (int)rxbd));
- PRINTD(("[I2C] txbd = %08x\n", (int)txbd));
-
- /* Set big endian byte order */
- iip->iic_tfcr = 0x10;
- iip->iic_rfcr = 0x10;
-
- /* Set maximum receive size. */
- iip->iic_mrblr = I2C_RXTX_LEN;
-
-#ifdef CFG_I2C_UCODE_PATCH
- /*
- * Initialize required parameters if using microcode patch.
- */
- iip->iic_rbptr = iip->iic_rbase;
- iip->iic_tbptr = iip->iic_tbase;
- iip->iic_rstate = 0;
- iip->iic_tstate = 0;
-#else
- cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_I2C, CPM_CR_INIT_TRX) | CPM_CR_FLG;
- do {
- __asm__ __volatile__ ("eieio");
- } while (cp->cp_cpcr & CPM_CR_FLG);
-#endif
-
- /* Clear events and interrupts */
- i2c->i2c_i2cer = 0xff;
- i2c->i2c_i2cmr = 0x00;
-}
-
-static void
-i2c_newio(i2c_state_t *state)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR ;
- volatile cpm8xx_t *cp = (cpm8xx_t *)&immap->im_cpm;
- volatile iic_t *iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];
-
- PRINTD(("[I2C] i2c_newio\n"));
-
-#ifdef CFG_I2C_UCODE_PATCH
- iip = (iic_t *)&cp->cp_dpmem[iip->iic_rpbase];
-#endif
- state->rx_idx = 0;
- state->tx_idx = 0;
- state->rxbd = (void*)&cp->cp_dpmem[iip->iic_rbase];
- state->txbd = (void*)&cp->cp_dpmem[iip->iic_tbase];
- state->tx_space = MAX_TX_SPACE;
- state->tx_buf = (uchar*)state->txbd + NUM_TX_BDS * sizeof(I2C_BD);
- state->err_cb = NULL;
-
- PRINTD(("[I2C] rxbd = %08x\n", (int)state->rxbd));
- PRINTD(("[I2C] txbd = %08x\n", (int)state->txbd));
- PRINTD(("[I2C] tx_buf = %08x\n", (int)state->tx_buf));
-
- /* clear the buffer memory */
- memset((char *)state->tx_buf, 0, MAX_TX_SPACE);
-}
-
-static int
-i2c_send(i2c_state_t *state,
- unsigned char address,
- unsigned char secondary_address,
- unsigned int flags,
- unsigned short size,
- unsigned char *dataout)
-{
- volatile I2C_BD *txbd;
- int i,j;
-
- PRINTD(("[I2C] i2c_send add=%02d sec=%02d flag=%02d size=%d\n",
- address, secondary_address, flags, size));
-
- /* trying to send message larger than BD */
- if (size > I2C_RXTX_LEN)
- return I2CERR_MSG_TOO_LONG;
-
- /* no more free bds */
- if (state->tx_idx >= NUM_TX_BDS || state->tx_space < (2 + size))
- return I2CERR_NO_BUFFERS;
-
- txbd = (I2C_BD *)state->txbd;
- txbd->addr = state->tx_buf;
-
- PRINTD(("[I2C] txbd = %08x\n", (int)txbd));
-
- if (flags & I2CF_START_COND) {
- PRINTD(("[I2C] Formatting addresses...\n"));
- if (flags & I2CF_ENABLE_SECONDARY) {
- txbd->length = size + 2; /* Length of msg + dest addr */
- txbd->addr[0] = address << 1;
- txbd->addr[1] = secondary_address;
- i = 2;
- } else {
- txbd->length = size + 1; /* Length of msg + dest addr */
- txbd->addr[0] = address << 1; /* Write dest addr to BD */
- i = 1;
- }
- } else {
- txbd->length = size; /* Length of message */
- i = 0;
- }
-
- /* set up txbd */
- txbd->status = BD_SC_READY;
- if (flags & I2CF_START_COND)
- txbd->status |= BD_I2C_TX_START;
- if (flags & I2CF_STOP_COND)
- txbd->status |= BD_SC_LAST | BD_SC_WRAP;
-
- /* Copy data to send into buffer */
- PRINTD(("[I2C] copy data...\n"));
- for(j = 0; j < size; i++, j++)
- txbd->addr[i] = dataout[j];
-
- PRINTD(("[I2C] txbd: length=0x%04x status=0x%04x addr[0]=0x%02x addr[1]=0x%02x\n",
- txbd->length,
- txbd->status,
- txbd->addr[0],
- txbd->addr[1]));
-
- /* advance state */
- state->tx_buf += txbd->length;
- state->tx_space -= txbd->length;
- state->tx_idx++;
- state->txbd = (void*)(txbd + 1);
-
- return 0;
-}
-
-static int
-i2c_receive(i2c_state_t *state,
- unsigned char address,
- unsigned char secondary_address,
- unsigned int flags,
- unsigned short size_to_expect,
- unsigned char *datain)
-{
- volatile I2C_BD *rxbd, *txbd;
-
- PRINTD(("[I2C] i2c_receive %02d %02d %02d\n", address, secondary_address, flags));
-
- /* Expected to receive too much */
- if (size_to_expect > I2C_RXTX_LEN)
- return I2CERR_MSG_TOO_LONG;
-
- /* no more free bds */
- if (state->tx_idx >= NUM_TX_BDS || state->rx_idx >= NUM_RX_BDS
- || state->tx_space < 2)
- return I2CERR_NO_BUFFERS;
-
- rxbd = (I2C_BD *)state->rxbd;
- txbd = (I2C_BD *)state->txbd;
-
- PRINTD(("[I2C] rxbd = %08x\n", (int)rxbd));
- PRINTD(("[I2C] txbd = %08x\n", (int)txbd));
-
- txbd->addr = state->tx_buf;
-
- /* set up TXBD for destination address */
- if (flags & I2CF_ENABLE_SECONDARY) {
- txbd->length = 2;
- txbd->addr[0] = address << 1; /* Write data */
- txbd->addr[1] = secondary_address; /* Internal address */
- txbd->status = BD_SC_READY;
- } else {
- txbd->length = 1 + size_to_expect;
- txbd->addr[0] = (address << 1) | 0x01;
- txbd->status = BD_SC_READY;
- memset(&txbd->addr[1], 0, txbd->length);
- }
-
- /* set up rxbd for reception */
- rxbd->status = BD_SC_EMPTY;
- rxbd->length = size_to_expect;
- rxbd->addr = datain;
-
- txbd->status |= BD_I2C_TX_START;
- if (flags & I2CF_STOP_COND) {
- txbd->status |= BD_SC_LAST | BD_SC_WRAP;
- rxbd->status |= BD_SC_WRAP;
- }
-
- PRINTD(("[I2C] txbd: length=0x%04x status=0x%04x addr[0]=0x%02x addr[1]=0x%02x\n",
- txbd->length,
- txbd->status,
- txbd->addr[0],
- txbd->addr[1]));
- PRINTD(("[I2C] rxbd: length=0x%04x status=0x%04x addr[0]=0x%02x addr[1]=0x%02x\n",
- rxbd->length,
- rxbd->status,
- rxbd->addr[0],
- rxbd->addr[1]));
-
- /* advance state */
- state->tx_buf += txbd->length;
- state->tx_space -= txbd->length;
- state->tx_idx++;
- state->txbd = (void*)(txbd + 1);
- state->rx_idx++;
- state->rxbd = (void*)(rxbd + 1);
-
- return 0;
-}
-
-
-static int i2c_doio(i2c_state_t *state)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR ;
- volatile cpm8xx_t *cp = (cpm8xx_t *)&immap->im_cpm;
- volatile i2c8xx_t *i2c = (i2c8xx_t *)&immap->im_i2c;
- volatile iic_t *iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];
- volatile I2C_BD *txbd, *rxbd;
- volatile int j = 0;
-
- PRINTD(("[I2C] i2c_doio\n"));
-
-#ifdef CFG_I2C_UCODE_PATCH
- iip = (iic_t *)&cp->cp_dpmem[iip->iic_rpbase];
-#endif
-
- if (state->tx_idx <= 0 && state->rx_idx <= 0) {
- PRINTD(("[I2C] No I/O is queued\n"));
- return I2CERR_QUEUE_EMPTY;
- }
-
- iip->iic_rbptr = iip->iic_rbase;
- iip->iic_tbptr = iip->iic_tbase;
-
- /* Enable I2C */
- PRINTD(("[I2C] Enabling I2C...\n"));
- i2c->i2c_i2mod |= 0x01;
-
- /* Begin transmission */
- i2c->i2c_i2com |= 0x80;
-
- /* Loop until transmit & receive completed */
-
- if (state->tx_idx > 0) {
- txbd = ((I2C_BD*)state->txbd) - 1;
- PRINTD(("[I2C] Transmitting...(txbd=0x%08lx)\n", (ulong)txbd));
- while((txbd->status & BD_SC_READY) && (j++ < TOUT_LOOP)) {
- if (ctrlc()) {
- return (-1);
- }
- __asm__ __volatile__ ("eieio");
- }
- }
-
- if ((state->rx_idx > 0) && (j < TOUT_LOOP)) {
- rxbd = ((I2C_BD*)state->rxbd) - 1;
- PRINTD(("[I2C] Receiving...(rxbd=0x%08lx)\n", (ulong)rxbd));
- while((rxbd->status & BD_SC_EMPTY) && (j++ < TOUT_LOOP)) {
- if (ctrlc()) {
- return (-1);
- }
- __asm__ __volatile__ ("eieio");
- }
- }
-
- /* Turn off I2C */
- i2c->i2c_i2mod &= ~0x01;
-
- if (state->err_cb != NULL) {
- int n, i, b;
-
- /*
- * if we have an error callback function, look at the
- * error bits in the bd status and pass them back
- */
-
- if ((n = state->tx_idx) > 0) {
- for (i = 0; i < n; i++) {
- txbd = ((I2C_BD*)state->txbd) - (n - i);
- if ((b = txbd->status & BD_I2C_TX_ERR) != 0)
- (*state->err_cb)(I2CECB_TX_ERR|b, i);
- }
- }
-
- if ((n = state->rx_idx) > 0) {
- for (i = 0; i < n; i++) {
- rxbd = ((I2C_BD*)state->rxbd) - (n - i);
- if ((b = rxbd->status & BD_I2C_RX_ERR) != 0)
- (*state->err_cb)(I2CECB_RX_ERR|b, i);
- }
- }
-
- if (j >= TOUT_LOOP)
- (*state->err_cb)(I2CECB_TIMEOUT, 0);
- }
-
- return (j >= TOUT_LOOP) ? I2CERR_TIMEOUT : 0;
-}
-
-static int had_tx_nak;
-
-static void
-i2c_test_callback(int flags, int xnum)
-{
- if ((flags & I2CECB_TX_ERR) && (flags & I2CECB_TX_NAK))
- had_tx_nak = 1;
-}
-
-int i2c_probe(uchar chip)
-{
- i2c_state_t state;
- int rc;
- uchar buf[1];
-
- i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
-
- i2c_newio(&state);
-
- state.err_cb = i2c_test_callback;
- had_tx_nak = 0;
-
- rc = i2c_receive(&state, chip, 0, I2CF_START_COND|I2CF_STOP_COND, 1, buf);
-
- if (rc != 0)
- return (rc);
-
- rc = i2c_doio(&state);
-
- if ((rc != 0) && (rc != I2CERR_TIMEOUT))
- return (rc);
-
- return (had_tx_nak);
-}
-
-int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
-{
- i2c_state_t state;
- uchar xaddr[4];
- int rc;
-
-#ifdef CONFIG_LWMON
- WATCHDOG_RESET();
-#endif
-
- xaddr[0] = (addr >> 24) & 0xFF;
- xaddr[1] = (addr >> 16) & 0xFF;
- xaddr[2] = (addr >> 8) & 0xFF;
- xaddr[3] = addr & 0xFF;
-
-#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
- /*
- * EEPROM chips that implement "address overflow" are ones like
- * Catalyst 24WC04/08/16 which has 9/10/11 bits of address and the
- * extra bits end up in the "chip address" bit slots. This makes
- * a 24WC08 (1Kbyte) chip look like four 256 byte chips.
- *
- * Note that we consider the length of the address field to still
- * be one byte because the extra address bits are hidden in the
- * chip address.
- */
- chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
-#endif
-
- i2c_newio(&state);
-
- rc = i2c_send(&state, chip, 0, I2CF_START_COND, alen, &xaddr[4-alen]);
- if (rc != 0) {
- if (gd->have_console)
- printf("i2c_read: i2c_send failed (%d)\n", rc);
- return 1;
- }
-
- rc = i2c_receive(&state, chip, 0, I2CF_STOP_COND, len, buffer);
- if (rc != 0) {
- if (gd->have_console)
- printf("i2c_read: i2c_receive failed (%d)\n", rc);
- return 1;
- }
-
- rc = i2c_doio(&state);
- if (rc != 0) {
- if (gd->have_console)
- printf("i2c_read: i2c_doio failed (%d)\n", rc);
- return 1;
- }
- return 0;
-}
-
-int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
-{
- i2c_state_t state;
- uchar xaddr[4];
- int rc;
-
- xaddr[0] = (addr >> 24) & 0xFF;
- xaddr[1] = (addr >> 16) & 0xFF;
- xaddr[2] = (addr >> 8) & 0xFF;
- xaddr[3] = addr & 0xFF;
-
-#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
- /*
- * EEPROM chips that implement "address overflow" are ones like
- * Catalyst 24WC04/08/16 which has 9/10/11 bits of address and the
- * extra bits end up in the "chip address" bit slots. This makes
- * a 24WC08 (1Kbyte) chip look like four 256 byte chips.
- *
- * Note that we consider the length of the address field to still
- * be one byte because the extra address bits are hidden in the
- * chip address.
- */
- chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
-#endif
-
- i2c_newio(&state);
-
- rc = i2c_send(&state, chip, 0, I2CF_START_COND, alen, &xaddr[4-alen]);
- if (rc != 0) {
- if (gd->have_console)
- printf("i2c_write: first i2c_send failed (%d)\n", rc);
- return 1;
- }
-
- rc = i2c_send(&state, 0, 0, I2CF_STOP_COND, len, buffer);
- if (rc != 0) {
- if (gd->have_console)
- printf("i2c_write: second i2c_send failed (%d)\n", rc);
- return 1;
- }
-
- rc = i2c_doio(&state);
- if (rc != 0) {
- if (gd->have_console)
- printf("i2c_write: i2c_doio failed (%d)\n", rc);
- return 1;
- }
- return 0;
-}
-
-uchar
-i2c_reg_read(uchar i2c_addr, uchar reg)
-{
- uchar buf;
-
- i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
-
- i2c_read(i2c_addr, reg, 1, &buf, 1);
-
- return (buf);
-}
-
-void
-i2c_reg_write(uchar i2c_addr, uchar reg, uchar val)
-{
- i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
-
- i2c_write(i2c_addr, reg, 1, &val, 1);
-}
-
-#endif /* CONFIG_HARD_I2C */
diff --git a/cpu/mpc8xx/interrupts.c b/cpu/mpc8xx/interrupts.c
deleted file mode 100644
index 6a25425a5e..0000000000
--- a/cpu/mpc8xx/interrupts.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc8xx.h>
-#include <mpc8xx_irq.h>
-#include <asm/processor.h>
-#include <commproc.h>
-
-/************************************************************************/
-
-/*
- * CPM interrupt vector functions.
- */
-struct interrupt_action {
- interrupt_handler_t *handler;
- void *arg;
-};
-
-static struct interrupt_action cpm_vecs[CPMVEC_NR];
-static struct interrupt_action irq_vecs[NR_IRQS];
-
-static void cpm_interrupt_init (void);
-static void cpm_interrupt (void *regs);
-
-/************************************************************************/
-
-int interrupt_init_cpu (unsigned *decrementer_count)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
- *decrementer_count = get_tbclk () / CFG_HZ;
-
- /* disable all interrupts */
- immr->im_siu_conf.sc_simask = 0;
-
- /* Configure CPM interrupts */
- cpm_interrupt_init ();
-
- return (0);
-}
-
-/************************************************************************/
-
-/*
- * Handle external interrupts
- */
-void external_interrupt (struct pt_regs *regs)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- int irq;
- ulong simask, newmask;
- ulong vec, v_bit;
-
- /*
- * read the SIVEC register and shift the bits down
- * to get the irq number
- */
- vec = immr->im_siu_conf.sc_sivec;
- irq = vec >> 26;
- v_bit = 0x80000000UL >> irq;
-
- /*
- * Read Interrupt Mask Register and Mask Interrupts
- */
- simask = immr->im_siu_conf.sc_simask;
- newmask = simask & (~(0xFFFF0000 >> irq));
- immr->im_siu_conf.sc_simask = newmask;
-
- if (!(irq & 0x1)) { /* External Interrupt ? */
- ulong siel;
-
- /*
- * Read Interrupt Edge/Level Register
- */
- siel = immr->im_siu_conf.sc_siel;
-
- if (siel & v_bit) { /* edge triggered interrupt ? */
- /*
- * Rewrite SIPEND Register to clear interrupt
- */
- immr->im_siu_conf.sc_sipend = v_bit;
- }
- }
-
- if (irq_vecs[irq].handler != NULL) {
- irq_vecs[irq].handler (irq_vecs[irq].arg);
- } else {
- printf ("\nBogus External Interrupt IRQ %d Vector %ld\n",
- irq, vec);
- /* turn off the bogus interrupt to avoid it from now */
- simask &= ~v_bit;
- }
- /*
- * Re-Enable old Interrupt Mask
- */
- immr->im_siu_conf.sc_simask = simask;
-}
-
-/************************************************************************/
-
-/*
- * CPM interrupt handler
- */
-static void cpm_interrupt (void *regs)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- uint vec;
-
- /*
- * Get the vector by setting the ACK bit
- * and then reading the register.
- */
- immr->im_cpic.cpic_civr = 1;
- vec = immr->im_cpic.cpic_civr;
- vec >>= 11;
-
- if (cpm_vecs[vec].handler != NULL) {
- (*cpm_vecs[vec].handler) (cpm_vecs[vec].arg);
- } else {
- immr->im_cpic.cpic_cimr &= ~(1 << vec);
- printf ("Masking bogus CPM interrupt vector 0x%x\n", vec);
- }
- /*
- * After servicing the interrupt,
- * we have to remove the status indicator.
- */
- immr->im_cpic.cpic_cisr |= (1 << vec);
-}
-
-/*
- * The CPM can generate the error interrupt when there is a race
- * condition between generating and masking interrupts. All we have
- * to do is ACK it and return. This is a no-op function so we don't
- * need any special tests in the interrupt handler.
- */
-static void cpm_error_interrupt (void *dummy)
-{
-}
-
-/************************************************************************/
-/*
- * Install and free an interrupt handler
- */
-void irq_install_handler (int vec, interrupt_handler_t * handler,
- void *arg)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
- if ((vec & CPMVEC_OFFSET) != 0) {
- /* CPM interrupt */
- vec &= 0xffff;
- if (cpm_vecs[vec].handler != NULL) {
- printf ("CPM interrupt 0x%x replacing 0x%x\n",
- (uint) handler,
- (uint) cpm_vecs[vec].handler);
- }
- cpm_vecs[vec].handler = handler;
- cpm_vecs[vec].arg = arg;
- immr->im_cpic.cpic_cimr |= (1 << vec);
- } else {
- /* SIU interrupt */
- if (irq_vecs[vec].handler != NULL) {
- printf ("SIU interrupt %d 0x%x replacing 0x%x\n",
- vec,
- (uint) handler,
- (uint) cpm_vecs[vec].handler);
- }
- irq_vecs[vec].handler = handler;
- irq_vecs[vec].arg = arg;
- immr->im_siu_conf.sc_simask |= 1 << (31 - vec);
- }
-}
-
-void irq_free_handler (int vec)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
- if ((vec & CPMVEC_OFFSET) != 0) {
- /* CPM interrupt */
- vec &= 0xffff;
- immr->im_cpic.cpic_cimr &= ~(1 << vec);
- cpm_vecs[vec].handler = NULL;
- cpm_vecs[vec].arg = NULL;
- } else {
- /* SIU interrupt */
- immr->im_siu_conf.sc_simask &= ~(1 << (31 - vec));
- irq_vecs[vec].handler = NULL;
- irq_vecs[vec].arg = NULL;
- }
-}
-
-/************************************************************************/
-
-static void cpm_interrupt_init (void)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
- /*
- * Initialize the CPM interrupt controller.
- */
-
- immr->im_cpic.cpic_cicr =
- (CICR_SCD_SCC4 |
- CICR_SCC_SCC3 |
- CICR_SCB_SCC2 |
- CICR_SCA_SCC1) | ((CPM_INTERRUPT / 2) << 13) | CICR_HP_MASK;
-
- immr->im_cpic.cpic_cimr = 0;
-
- /*
- * Install the error handler.
- */
- irq_install_handler (CPMVEC_ERROR, cpm_error_interrupt, NULL);
-
- immr->im_cpic.cpic_cicr |= CICR_IEN;
-
- /*
- * Install the cpm interrupt handler
- */
- irq_install_handler (CPM_INTERRUPT, cpm_interrupt, NULL);
-}
-
-/************************************************************************/
-
-/*
- * timer_interrupt - gets called when the decrementer overflows,
- * with interrupts disabled.
- * Trivial implementation - no need to be really accurate.
- */
-void timer_interrupt_cpu (struct pt_regs *regs)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
- /* Reset Timer Expired and Timers Interrupt Status */
- immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
- __asm__ ("nop");
- /*
- Clear TEXPS (and TMIST on older chips). SPLSS (on older
- chips) is cleared too.
-
- Bitwise OR is a read-modify-write operation so ALL bits
- which are cleared by writing `1' would be cleared by
- operations like
-
- immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS;
-
- The same can be achieved by simple writing of the PLPRCR
- to itself. If a bit value should be preserved, read the
- register, ZERO the bit and write, not OR, the result back.
- */
- immr->im_clkrst.car_plprcr = immr->im_clkrst.car_plprcr;
-}
-
-/************************************************************************/
diff --git a/cpu/mpc8xx/kgdb.S b/cpu/mpc8xx/kgdb.S
deleted file mode 100644
index 67c5ad292c..0000000000
--- a/cpu/mpc8xx/kgdb.S
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2000 Murray Jensen <Murray.Jensen@cmst.csiro.au>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <command.h>
-#include <mpc8xx.h>
-#include <version.h>
-
-#define CONFIG_8xx 1 /* needed for Linux kernel header files */
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-
- /*
- * cache flushing routines for kgdb
- */
-
- .globl kgdb_flush_cache_all
-kgdb_flush_cache_all:
- lis r3, IDC_INVALL@h
- mtspr DC_CST, r3
- sync
- lis r3, IDC_INVALL@h
- mtspr IC_CST, r3
- SYNC
- blr
-
- .globl kgdb_flush_cache_range
-kgdb_flush_cache_range:
- li r5,CONFIG_CACHELINE_SIZE-1
- andc r3,r3,r5
- subf r4,r3,r4
- add r4,r4,r5
- srwi. r4,r4,CFG_CACHELINE_SHIFT
- beqlr
- mtctr r4
- mr r6,r3
-1: dcbst 0,r3
- addi r3,r3,CONFIG_CACHELINE_SIZE
- bdnz 1b
- sync /* wait for dcbst's to get to ram */
- mtctr r4
-2: icbi 0,r6
- addi r6,r6,CONFIG_CACHELINE_SIZE
- bdnz 2b
- SYNC
- blr
-
-#endif /* CFG_CMD_KGDB */
diff --git a/cpu/mpc8xx/lcd.c b/cpu/mpc8xx/lcd.c
deleted file mode 100644
index 4d47961305..0000000000
--- a/cpu/mpc8xx/lcd.c
+++ /dev/null
@@ -1,617 +0,0 @@
-/*
- * (C) Copyright 2001-2002
- * Wolfgang Denk, DENX Software Engineering -- wd@denx.de
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/************************************************************************/
-/* ** HEADER FILES */
-/************************************************************************/
-
-/* #define DEBUG */
-
-#include <config.h>
-#include <common.h>
-#include <command.h>
-#include <watchdog.h>
-#include <version.h>
-#include <stdarg.h>
-#include <lcdvideo.h>
-#include <linux/types.h>
-#include <devices.h>
-#if defined(CONFIG_POST)
-#include <post.h>
-#endif
-#include <lcd.h>
-
-#ifdef CONFIG_LCD
-
-/************************************************************************/
-/* ** CONFIG STUFF -- should be moved to board config file */
-/************************************************************************/
-#ifndef CONFIG_LCD_INFO
-#define CONFIG_LCD_INFO /* Display Logo, (C) and system info */
-#endif
-
-#if defined(CONFIG_V37) || defined(CONFIG_EDT32F10)
-#undef CONFIG_LCD_LOGO
-#undef CONFIG_LCD_INFO
-#endif
-
-/*----------------------------------------------------------------------*/
-#ifdef CONFIG_KYOCERA_KCS057QV1AJ
-/*
- * Kyocera KCS057QV1AJ-G23. Passive, color, single scan.
- */
-#define LCD_BPP LCD_COLOR4
-
-vidinfo_t panel_info = {
- 640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH,
- LCD_BPP, 1, 0, 1, 0, 5, 0, 0, 0
- /* wbl, vpw, lcdac, wbf */
-};
-#endif /* CONFIG_KYOCERA_KCS057QV1AJ */
-/*----------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------*/
-#ifdef CONFIG_HITACHI_SP19X001_Z1A
-/*
- * Hitachi SP19X001-. Active, color, single scan.
- */
-vidinfo_t panel_info = {
- 640, 480, 154, 116, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH,
- LCD_COLOR8, 1, 0, 1, 0, 0, 0, 0, 0
- /* wbl, vpw, lcdac, wbf */
-};
-#endif /* CONFIG_HITACHI_SP19X001_Z1A */
-/*----------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------*/
-#ifdef CONFIG_NEC_NL6448AC33
-/*
- * NEC NL6448AC33-18. Active, color, single scan.
- */
-vidinfo_t panel_info = {
- 640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
- 3, 0, 0, 1, 1, 144, 2, 0, 33
- /* wbl, vpw, lcdac, wbf */
-};
-#endif /* CONFIG_NEC_NL6448AC33 */
-/*----------------------------------------------------------------------*/
-
-#ifdef CONFIG_NEC_NL6448BC20
-/*
- * NEC NL6448BC20-08. 6.5", 640x480. Active, color, single scan.
- */
-vidinfo_t panel_info = {
- 640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
- 3, 0, 0, 1, 1, 144, 2, 0, 33
- /* wbl, vpw, lcdac, wbf */
-};
-#endif /* CONFIG_NEC_NL6448BC20 */
-/*----------------------------------------------------------------------*/
-
-#ifdef CONFIG_NEC_NL6448BC33_54
-/*
- * NEC NL6448BC33-54. 10.4", 640x480. Active, color, single scan.
- */
-vidinfo_t panel_info = {
- 640, 480, 212, 158, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
- 3, 0, 0, 1, 1, 144, 2, 0, 33
- /* wbl, vpw, lcdac, wbf */
-};
-#endif /* CONFIG_NEC_NL6448BC33_54 */
-/*----------------------------------------------------------------------*/
-
-#ifdef CONFIG_SHARP_LQ104V7DS01
-/*
- * SHARP LQ104V7DS01. 6.5", 640x480. Active, color, single scan.
- */
-vidinfo_t panel_info = {
- 640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_LOW,
- 3, 0, 0, 1, 1, 25, 1, 0, 33
- /* wbl, vpw, lcdac, wbf */
-};
-#endif /* CONFIG_SHARP_LQ104V7DS01 */
-/*----------------------------------------------------------------------*/
-
-#ifdef CONFIG_SHARP_16x9
-/*
- * Sharp 320x240. Active, color, single scan. It isn't 16x9, and I am
- * not sure what it is.......
- */
-vidinfo_t panel_info = {
- 320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH,
- 3, 0, 0, 1, 1, 15, 4, 0, 3
-};
-#endif /* CONFIG_SHARP_16x9 */
-/*----------------------------------------------------------------------*/
-
-#ifdef CONFIG_SHARP_LQ057Q3DC02
-/*
- * Sharp LQ057Q3DC02 display. Active, color, single scan.
- */
-#undef LCD_DF
-#define LCD_DF 12
-
-vidinfo_t panel_info = {
- 320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
- 3, 0, 0, 1, 1, 15, 4, 0, 3
- /* wbl, vpw, lcdac, wbf */
-};
-#define CONFIG_LCD_INFO_BELOW_LOGO
-#endif /* CONFIG_SHARP_LQ057Q3DC02 */
-/*----------------------------------------------------------------------*/
-
-#ifdef CONFIG_SHARP_LQ64D341
-/*
- * Sharp LQ64D341 display, 640x480. Active, color, single scan.
- */
-vidinfo_t panel_info = {
- 640, 480, 0, 0, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
- 3, 0, 0, 1, 1, 128, 16, 0, 32
- /* wbl, vpw, lcdac, wbf */
-};
-#endif /* CONFIG_SHARP_LQ64D341 */
-
-#ifdef CONFIG_SHARP_LQ065T9DR51U
-/*
- * Sharp LQ065T9DR51U display, 400x240. Active, color, single scan.
- */
-vidinfo_t panel_info = {
- 400, 240, 143, 79, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH,
- 3, 0, 0, 1, 1, 248, 4, 0, 35
- /* wbl, vpw, lcdac, wbf */
-};
-#define CONFIG_LCD_INFO_BELOW_LOGO
-#endif /* CONFIG_SHARP_LQ065T9DR51U */
-
-#ifdef CONFIG_SHARP_LQ084V1DG21
-/*
- * Sharp LQ084V1DG21 display, 640x480. Active, color, single scan.
- */
-vidinfo_t panel_info = {
- 640, 480, 171, 129, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_LOW,
- 3, 0, 0, 1, 1, 160, 3, 0, 48
- /* wbl, vpw, lcdac, wbf */
-};
-#endif /* CONFIG_SHARP_LQ084V1DG21 */
-
-/*----------------------------------------------------------------------*/
-
-#ifdef CONFIG_HLD1045
-/*
- * HLD1045 display, 640x480. Active, color, single scan.
- */
-vidinfo_t panel_info = {
- 640, 480, 0, 0, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
- 3, 0, 0, 1, 1, 160, 3, 0, 48
- /* wbl, vpw, lcdac, wbf */
-};
-#endif /* CONFIG_HLD1045 */
-/*----------------------------------------------------------------------*/
-
-#ifdef CONFIG_PRIMEVIEW_V16C6448AC
-/*
- * Prime View V16C6448AC
- */
-vidinfo_t panel_info = {
- 640, 480, 130, 98, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
- 3, 0, 0, 1, 1, 144, 2, 0, 35
- /* wbl, vpw, lcdac, wbf */
-};
-#endif /* CONFIG_PRIMEVIEW_V16C6448AC */
-
-/*----------------------------------------------------------------------*/
-
-#ifdef CONFIG_OPTREX_BW
-/*
- * Optrex CBL50840-2 NF-FW 99 22 M5
- * or
- * Hitachi LMG6912RPFC-00T
- * or
- * Hitachi SP14Q002
- *
- * 320x240. Black & white.
- */
-#define OPTREX_BPP 0 /* 0 - monochrome, 1 bpp */
- /* 1 - 4 grey levels, 2 bpp */
- /* 2 - 16 grey levels, 4 bpp */
-vidinfo_t panel_info = {
- 320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_LOW,
- OPTREX_BPP, 0, 0, 0, 0, 0, 0, 0, 0, 4
-};
-#endif /* CONFIG_OPTREX_BW */
-
-/*-----------------------------------------------------------------*/
-#ifdef CONFIG_EDT32F10
-/*
- * Emerging Display Technologies 320x240. Passive, monochrome, single scan.
- */
-#define LCD_BPP LCD_MONOCHROME
-#define LCD_DF 10
-
-vidinfo_t panel_info = {
- 320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_LOW,
- LCD_BPP, 0, 0, 0, 0, 33, 0, 0, 0
-};
-#endif
-/*----------------------------------------------------------------------*/
-
-
-int lcd_line_length;
-
-int lcd_color_fg;
-int lcd_color_bg;
-
-/*
- * Frame buffer memory information
- */
-void *lcd_base; /* Start of framebuffer memory */
-void *lcd_console_address; /* Start of console buffer */
-
-short console_col;
-short console_row;
-
-/************************************************************************/
-
-void lcd_ctrl_init (void *lcdbase);
-void lcd_enable (void);
-#if LCD_BPP == LCD_COLOR8
-void lcd_setcolreg (ushort regno,
- ushort red, ushort green, ushort blue);
-#endif
-#if LCD_BPP == LCD_MONOCHROME
-void lcd_initcolregs (void);
-#endif
-
-#if defined(CONFIG_RBC823)
-void lcd_disable (void);
-#endif
-
-/************************************************************************/
-
-/************************************************************************/
-/* ----------------- chipset specific functions ----------------------- */
-/************************************************************************/
-
-/*
- * Calculate fb size for VIDEOLFB_ATAG.
- */
-ulong calc_fbsize (void)
-{
- ulong size;
- int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
-
- size = line_length * panel_info.vl_row;
-
- return size;
-}
-
-void lcd_ctrl_init (void *lcdbase)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- volatile lcd823_t *lcdp = &immr->im_lcd;
-
- uint lccrtmp;
- uint lchcr_hpc_tmp;
-
- /* Initialize the LCD control register according to the LCD
- * parameters defined. We do everything here but enable
- * the controller.
- */
-
-#ifdef CONFIG_RPXLITE
- /* This is special for RPXlite_DW Software Development Platform **[Sam]** */
- panel_info.vl_dp = CFG_LOW;
-#endif
-
- lccrtmp = LCDBIT (LCCR_BNUM_BIT,
- (((panel_info.vl_row * panel_info.vl_col) * (1 << LCD_BPP)) / 128));
-
- lccrtmp |= LCDBIT (LCCR_CLKP_BIT, panel_info.vl_clkp) |
- LCDBIT (LCCR_OEP_BIT, panel_info.vl_oep) |
- LCDBIT (LCCR_HSP_BIT, panel_info.vl_hsp) |
- LCDBIT (LCCR_VSP_BIT, panel_info.vl_vsp) |
- LCDBIT (LCCR_DP_BIT, panel_info.vl_dp) |
- LCDBIT (LCCR_BPIX_BIT, panel_info.vl_bpix) |
- LCDBIT (LCCR_LBW_BIT, panel_info.vl_lbw) |
- LCDBIT (LCCR_SPLT_BIT, panel_info.vl_splt) |
- LCDBIT (LCCR_CLOR_BIT, panel_info.vl_clor) |
- LCDBIT (LCCR_TFT_BIT, panel_info.vl_tft);
-
-
- lcdp->lcd_lccr = lccrtmp;
- lcdp->lcd_lcsr = 0xFF; /* Clear pending interrupts */
-
- /* Initialize LCD controller bus priorities.
- */
-#ifdef CONFIG_RBC823
- immr->im_siu_conf.sc_sdcr = (immr->im_siu_conf.sc_sdcr & ~0x0f) | 1; /* RAID = 01, LAID = 00 */
-#else
- immr->im_siu_conf.sc_sdcr &= ~0x0f; /* RAID = LAID = 0 */
-
- /* set SHFT/CLOCK division factor 4
- * This needs to be set based upon display type and processor
- * speed. The TFT displays run about 20 to 30 MHz.
- * I was running 64 MHz processor speed.
- * The value for this divider must be chosen so the result is
- * an integer of the processor speed (i.e., divide by 3 with
- * 64 MHz would be bad).
- */
- immr->im_clkrst.car_sccr &= ~0x1F;
- immr->im_clkrst.car_sccr |= LCD_DF; /* was 8 */
-
-#endif /* CONFIG_RBC823 */
-
-#if defined(CONFIG_RBC823)
- /* Enable LCD on port D.
- */
- immr->im_ioport.iop_pddat &= 0x0300;
- immr->im_ioport.iop_pdpar |= 0x1CFF;
- immr->im_ioport.iop_pddir |= 0x1CFF;
-
- /* Configure LCD_ON, VEE_ON, CCFL_ON on port B.
- */
- immr->im_cpm.cp_pbdat &= ~0x00005001;
- immr->im_cpm.cp_pbpar &= ~0x00005001;
- immr->im_cpm.cp_pbdir |= 0x00005001;
-#elif !defined(CONFIG_EDT32F10)
- /* Enable LCD on port D.
- */
- immr->im_ioport.iop_pdpar |= 0x1FFF;
- immr->im_ioport.iop_pddir |= 0x1FFF;
-
- /* Enable LCD_A/B/C on port B.
- */
- immr->im_cpm.cp_pbpar |= 0x00005001;
- immr->im_cpm.cp_pbdir |= 0x00005001;
-#else
- /* Enable LCD on port D.
- */
- immr->im_ioport.iop_pdpar |= 0x1DFF;
- immr->im_ioport.iop_pdpar &= ~0x0200;
- immr->im_ioport.iop_pddir |= 0x1FFF;
- immr->im_ioport.iop_pddat |= 0x0200;
-#endif
-
- /* Load the physical address of the linear frame buffer
- * into the LCD controller.
- * BIG NOTE: This has to be modified to load A and B depending
- * upon the split mode of the LCD.
- */
- lcdp->lcd_lcfaa = (ulong)lcd_base;
- lcdp->lcd_lcfba = (ulong)lcd_base;
-
- /* MORE HACKS...This must be updated according to 823 manual
- * for different panels.
- * Udi Finkelstein - done - see below:
- * Note: You better not try unsupported combinations such as
- * 4-bit wide passive dual scan LCD at 4/8 Bit color.
- */
- lchcr_hpc_tmp =
- (panel_info.vl_col *
- (panel_info.vl_tft ? 8 :
- (((2 - panel_info.vl_lbw) << /* 4 bit=2, 8-bit = 1 */
- /* use << to mult by: single scan = 1, dual scan = 2 */
- panel_info.vl_splt) *
- (panel_info.vl_bpix | 1)))) >> 3; /* 2/4 BPP = 1, 8/16 BPP = 3 */
-
- lcdp->lcd_lchcr = LCHCR_BO |
- LCDBIT (LCHCR_AT_BIT, 4) |
- LCDBIT (LCHCR_HPC_BIT, lchcr_hpc_tmp) |
- panel_info.vl_wbl;
-
- lcdp->lcd_lcvcr = LCDBIT (LCVCR_VPW_BIT, panel_info.vl_vpw) |
- LCDBIT (LCVCR_LCD_AC_BIT, panel_info.vl_lcdac) |
- LCDBIT (LCVCR_VPC_BIT, panel_info.vl_row) |
- panel_info.vl_wbf;
-
-}
-
-/*----------------------------------------------------------------------*/
-
-#ifdef NOT_USED_SO_FAR
-static void
-lcd_getcolreg (ushort regno, ushort *red, ushort *green, ushort *blue)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- volatile cpm8xx_t *cp = &(immr->im_cpm);
- unsigned short colreg, *cmap_ptr;
-
- cmap_ptr = (unsigned short *)&cp->lcd_cmap[regno * 2];
-
- colreg = *cmap_ptr;
-#ifdef CFG_INVERT_COLORS
- colreg ^= 0x0FFF;
-#endif
-
- *red = (colreg >> 8) & 0x0F;
- *green = (colreg >> 4) & 0x0F;
- *blue = colreg & 0x0F;
-}
-#endif /* NOT_USED_SO_FAR */
-
-/*----------------------------------------------------------------------*/
-
-#if LCD_BPP == LCD_COLOR8
-void
-lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- volatile cpm8xx_t *cp = &(immr->im_cpm);
- unsigned short colreg, *cmap_ptr;
-
- cmap_ptr = (unsigned short *)&cp->lcd_cmap[regno * 2];
-
- colreg = ((red & 0x0F) << 8) |
- ((green & 0x0F) << 4) |
- (blue & 0x0F) ;
-#ifdef CFG_INVERT_COLORS
- colreg ^= 0x0FFF;
-#endif
- *cmap_ptr = colreg;
-
- debug ("setcolreg: reg %2d @ %p: R=%02X G=%02X B=%02X => %02X%02X\n",
- regno, &(cp->lcd_cmap[regno * 2]),
- red, green, blue,
- cp->lcd_cmap[ regno * 2 ], cp->lcd_cmap[(regno * 2) + 1]);
-}
-#endif /* LCD_COLOR8 */
-
-/*----------------------------------------------------------------------*/
-
-#if LCD_BPP == LCD_MONOCHROME
-static
-void lcd_initcolregs (void)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- volatile cpm8xx_t *cp = &(immr->im_cpm);
- ushort regno;
-
- for (regno = 0; regno < 16; regno++) {
- cp->lcd_cmap[regno * 2] = 0;
- cp->lcd_cmap[(regno * 2) + 1] = regno & 0x0f;
- }
-}
-#endif
-
-/*----------------------------------------------------------------------*/
-
-void lcd_enable (void)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- volatile lcd823_t *lcdp = &immr->im_lcd;
-
- /* Enable the LCD panel */
-#ifndef CONFIG_RBC823
- immr->im_siu_conf.sc_sdcr |= (1 << (31 - 25)); /* LAM = 1 */
-#endif
- lcdp->lcd_lccr |= LCCR_PON;
-
-#ifdef CONFIG_V37
- /* Turn on display backlight */
- immr->im_cpm.cp_pbpar |= 0x00008000;
- immr->im_cpm.cp_pbdir |= 0x00008000;
-#elif defined(CONFIG_RBC823)
- /* Turn on display backlight */
- immr->im_cpm.cp_pbdat |= 0x00004000;
-#endif
-
-#if defined(CONFIG_LWMON)
- { uchar c = pic_read (0x60);
-#if defined(CONFIG_LCD) && defined(CONFIG_LWMON) && (CONFIG_POST & CFG_POST_SYSMON)
- /* Enable LCD later in sysmon test, only if temperature is OK */
-#else
- c |= 0x07; /* Power on CCFL, Enable CCFL, Chip Enable LCD */
-#endif
- pic_write (0x60, c);
- }
-#endif /* CONFIG_LWMON */
-
-#if defined(CONFIG_R360MPI)
- {
- extern void r360_i2c_lcd_write (uchar data0, uchar data1);
- unsigned long bgi, ctr;
- char *p;
-
- if ((p = getenv("lcdbgi")) != NULL) {
- bgi = simple_strtoul (p, 0, 10) & 0xFFF;
- } else {
- bgi = 0xFFF;
- }
-
- if ((p = getenv("lcdctr")) != NULL) {
- ctr = simple_strtoul (p, 0, 10) & 0xFFF;
- } else {
- ctr=0x7FF;
- }
-
- r360_i2c_lcd_write(0x10, 0x01);
- r360_i2c_lcd_write(0x20, 0x01);
- r360_i2c_lcd_write(0x30 | ((bgi>>8) & 0xF), bgi & 0xFF);
- r360_i2c_lcd_write(0x40 | ((ctr>>8) & 0xF), ctr & 0xFF);
- }
-#endif /* CONFIG_R360MPI */
-#ifdef CONFIG_RBC823
- udelay(200000); /* wait 200ms */
- /* Turn VEE_ON first */
- immr->im_cpm.cp_pbdat |= 0x00000001;
- udelay(200000); /* wait 200ms */
- /* Now turn on LCD_ON */
- immr->im_cpm.cp_pbdat |= 0x00001000;
-#endif
-#ifdef CONFIG_RRVISION
- debug ("PC4->Output(1): enable LVDS\n");
- debug ("PC5->Output(0): disable PAL clock\n");
- immr->im_ioport.iop_pddir |= 0x1000;
- immr->im_ioport.iop_pcpar &= ~(0x0C00);
- immr->im_ioport.iop_pcdir |= 0x0C00 ;
- immr->im_ioport.iop_pcdat |= 0x0800 ;
- immr->im_ioport.iop_pcdat &= ~(0x0400);
- debug ("PDPAR=0x%04X PDDIR=0x%04X PDDAT=0x%04X\n",
- immr->im_ioport.iop_pdpar,
- immr->im_ioport.iop_pddir,
- immr->im_ioport.iop_pddat);
- debug ("PCPAR=0x%04X PCDIR=0x%04X PCDAT=0x%04X\n",
- immr->im_ioport.iop_pcpar,
- immr->im_ioport.iop_pcdir,
- immr->im_ioport.iop_pcdat);
-#endif
-}
-
-/*----------------------------------------------------------------------*/
-
-#if defined (CONFIG_RBC823)
-void lcd_disable (void)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- volatile lcd823_t *lcdp = &immr->im_lcd;
-
-#if defined(CONFIG_LWMON)
- { uchar c = pic_read (0x60);
- c &= ~0x07; /* Power off CCFL, Disable CCFL, Chip Disable LCD */
- pic_write (0x60, c);
- }
-#elif defined(CONFIG_R360MPI)
- {
- extern void r360_i2c_lcd_write (uchar data0, uchar data1);
-
- r360_i2c_lcd_write(0x10, 0x00);
- r360_i2c_lcd_write(0x20, 0x00);
- r360_i2c_lcd_write(0x30, 0x00);
- r360_i2c_lcd_write(0x40, 0x00);
- }
-#endif /* CONFIG_LWMON */
- /* Disable the LCD panel */
- lcdp->lcd_lccr &= ~LCCR_PON;
-#ifdef CONFIG_RBC823
- /* Turn off display backlight, VEE and LCD_ON */
- immr->im_cpm.cp_pbdat &= ~0x00005001;
-#else
- immr->im_siu_conf.sc_sdcr &= ~(1 << (31 - 25)); /* LAM = 0 */
-#endif /* CONFIG_RBC823 */
-}
-#endif /* NOT_USED_SO_FAR || CONFIG_RBC823 */
-
-
-/************************************************************************/
-
-#endif /* CONFIG_LCD */
diff --git a/cpu/mpc8xx/plprcr_write.S b/cpu/mpc8xx/plprcr_write.S
deleted file mode 100644
index e325671142..0000000000
--- a/cpu/mpc8xx/plprcr_write.S
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * (C) Copyright 2004
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <mpc8xx.h>
-#include <ppc_asm.tmpl>
-#include <asm/cache.h>
-
-#define CACHE_CMD_ENABLE 0x02000000
-#define CACHE_CMD_DISABLE 0x04000000
-#define CACHE_CMD_LOAD_LOCK 0x06000000
-#define CACHE_CMD_UNLOCK_LINE 0x08000000
-#define CACHE_CMD_UNLOCK_ALL 0x0A000000
-#define CACHE_CMD_INVALIDATE 0x0C000000
-#define SPEED_PLPRCR_WAIT_5CYC 150
-#define _CACHE_ALIGN_SIZE 16
-
-
- .text
- .align 2
- .globl plprcr_write_866
-
-/*
- * void plprcr_write_866 (long plprcr)
- * Write PLPRCR, including workaround for device errata SIU4 and SIU9.
- */
-
-plprcr_write_866:
- mfspr r10, LR /* save the Link Register value */
-
- /* turn instruction cache on (no MMU required for instructions)
- */
- lis r4, CACHE_CMD_ENABLE@h
- ori r4, r4, CACHE_CMD_ENABLE@l
- mtspr IC_CST, r4
- isync
-
- /* clear IC_CST error bits
- */
- mfspr r4, IC_CST
-
- bl plprcr_here
-
-plprcr_here:
- mflr r5
-
- /* calculate relocation offset
- */
- lis r4, plprcr_here@h
- ori r4, r4, plprcr_here@l
- sub r5, r5, r4
-
- /* calculate first address of this function
- */
- lis r6, plprcr_write_866@h
- ori r6, r6, plprcr_write_866@l
- add r6, r6, r5
-
- /* calculate end address of this function
- */
- lis r7, plprcr_end@h
- ori r7, r7, plprcr_end@l
- add r7, r7, r5
-
- /* load and lock code addresses
- */
- mr r5, r6
-
-plprcr_loop:
- mtspr IC_ADR, r5
- addi r5, r5, _CACHE_ALIGN_SIZE /* increment by one line */
-
- lis r4, CACHE_CMD_LOAD_LOCK@h
- ori r4, r4, CACHE_CMD_LOAD_LOCK@l
- mtspr IC_CST, r4
- isync
-
- cmpw r5, r7
- blt plprcr_loop
-
- /* IC_CST error bits not evaluated
- */
-
- /* switch PLPRCR
- */
- mfspr r4, IMMR /* read IMMR */
- rlwinm r4, r4, 0, 0, 15 /* only high 16 bits count */
-
- /* write sequence according to MPC866 Errata
- */
- stw r3, PLPRCR(r4)
- isync
-
- lis r3, SPEED_PLPRCR_WAIT_5CYC@h
- ori r3, r3, SPEED_PLPRCR_WAIT_5CYC@l
-
-plprcr_wait:
- cmpwi r3, 0
- beq plprcr_wait_end
- nop
- subi r3, r3, 1
- b plprcr_wait
-
-plprcr_wait_end:
-
- /* unlock instruction cache but leave it enabled
- */
- lis r4, CACHE_CMD_UNLOCK_ALL@h
- ori r4, r4, CACHE_CMD_UNLOCK_ALL@l
- mtspr IC_CST, r4
- isync
-
- mtspr LR, r10 /* restore original Link Register value */
- blr
-
-plprcr_end:
diff --git a/cpu/mpc8xx/reginfo.c b/cpu/mpc8xx/reginfo.c
deleted file mode 100644
index e3f9265b05..0000000000
--- a/cpu/mpc8xx/reginfo.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <common.h>
-
-void reginfo(void)
-{
- volatile immap_t *immap = (immap_t *)CFG_IMMR;
- volatile memctl8xx_t *memctl = &immap->im_memctl;
- volatile sysconf8xx_t *sysconf = &immap->im_siu_conf;
- volatile sit8xx_t *timers = &immap->im_sit;
-
- /* Hopefully more PowerPC knowledgable people will add code to display
- * other useful registers
- */
-
- printf ("\nSystem Configuration registers\n"
-
- "\tIMMR\t0x%08X\n", get_immr(0));
-
- printf("\tSIUMCR\t0x%08X", sysconf->sc_siumcr);
- printf("\tSYPCR\t0x%08X\n",sysconf->sc_sypcr);
-
- printf("\tSWT\t0x%08X", sysconf->sc_swt);
- printf("\tSWSR\t0x%04X\n", sysconf->sc_swsr);
-
- printf("\tSIPEND\t0x%08X\tSIMASK\t0x%08X\n",
- sysconf->sc_sipend, sysconf->sc_simask);
- printf("\tSIEL\t0x%08X\tSIVEC\t0x%08X\n",
- sysconf->sc_siel, sysconf->sc_sivec);
- printf("\tTESR\t0x%08X\tSDCR\t0x%08X\n",
- sysconf->sc_tesr, sysconf->sc_sdcr);
-
- printf ("Memory Controller Registers\n"
-
- "\tBR0\t0x%08X\tOR0\t0x%08X \n", memctl->memc_br0, memctl->memc_or0);
- printf("\tBR1\t0x%08X\tOR1\t0x%08X \n", memctl->memc_br1, memctl->memc_or1);
- printf("\tBR2\t0x%08X\tOR2\t0x%08X \n", memctl->memc_br2, memctl->memc_or2);
- printf("\tBR3\t0x%08X\tOR3\t0x%08X \n", memctl->memc_br3, memctl->memc_or3);
- printf("\tBR4\t0x%08X\tOR4\t0x%08X \n", memctl->memc_br4, memctl->memc_or4);
- printf("\tBR5\t0x%08X\tOR5\t0x%08X \n", memctl->memc_br5, memctl->memc_or5);
- printf("\tBR6\t0x%08X\tOR6\t0x%08X \n", memctl->memc_br6, memctl->memc_or6);
- printf("\tBR7\t0x%08X\tOR7\t0x%08X \n", memctl->memc_br7, memctl->memc_or7);
- printf ("\n"
- "\tmamr\t0x%08X\tmbmr\t0x%08X \n",
- memctl->memc_mamr, memctl->memc_mbmr );
- printf("\tmstat\t0x%08X\tmptpr\t0x%08X \n",
- memctl->memc_mstat, memctl->memc_mptpr );
- printf("\tmdr\t0x%08X \n", memctl->memc_mdr);
-
- printf ("\nSystem Integration Timers\n"
- "\tTBSCR\t0x%08X\tRTCSC\t0x%08X \n",
- timers->sit_tbscr, timers->sit_rtcsc);
- printf("\tPISCR\t0x%08X \n", timers->sit_piscr);
-
-/*
- * May be some CPM info here?
- */
-}
-
-
diff --git a/cpu/mpc8xx/scc.c b/cpu/mpc8xx/scc.c
deleted file mode 100644
index e1c3525f1c..0000000000
--- a/cpu/mpc8xx/scc.c
+++ /dev/null
@@ -1,539 +0,0 @@
-/*
- * File: scc.c
- * Description:
- * Basic ET HW initialization and packet RX/TX routines
- *
- * NOTE <<<IMPORTANT: PLEASE READ>>>:
- * Do not cache Rx/Tx buffers!
- */
-
-/*
- * MPC823 <-> MC68160 Connections:
- *
- * Setup MPC823 to work with MC68160 Enhanced Ethernet
- * Serial Tranceiver as follows:
- *
- * MPC823 Signal MC68160 Comments
- * ------ ------ ------- --------
- * PA-12 ETHTX --------> TX Eth. Port Transmit Data
- * PB-18 E_TENA --------> TENA Eth. Transmit Port Enable
- * PA-5 ETHTCK <-------- TCLK Eth. Port Transmit Clock
- * PA-13 ETHRX <-------- RX Eth. Port Receive Data
- * PC-8 E_RENA <-------- RENA Eth. Receive Enable
- * PA-6 ETHRCK <-------- RCLK Eth. Port Receive Clock
- * PC-9 E_CLSN <-------- CLSN Eth. Port Collision Indication
- *
- * FADS Board Signal MC68160 Comments
- * ----------------- ------- --------
- * (BCSR1) ETHEN* --------> CS2 Eth. Port Enable
- * (BSCR4) TPSQEL* --------> TPSQEL Twisted Pair Signal Quality Error Test Enable
- * (BCSR4) TPFLDL* --------> TPFLDL Twisted Pair Full-Duplex
- * (BCSR4) ETHLOOP --------> LOOP Eth. Port Diagnostic Loop-Back
- *
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <commproc.h>
-#include <net.h>
-#include <command.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(SCC_ENET)
-
-/* Ethernet Transmit and Receive Buffers */
-#define DBUF_LENGTH 1520
-
-#define TX_BUF_CNT 2
-
-#define TOUT_LOOP 10000 /* 10 ms to have a packet sent */
-
-static char txbuf[DBUF_LENGTH];
-
-static uint rxIdx; /* index of the current RX buffer */
-static uint txIdx; /* index of the current TX buffer */
-
-/*
- * SCC Ethernet Tx and Rx buffer descriptors allocated at the
- * immr->udata_bd address on Dual-Port RAM
- * Provide for Double Buffering
- */
-
-typedef volatile struct CommonBufferDescriptor {
- cbd_t rxbd[PKTBUFSRX]; /* Rx BD */
- cbd_t txbd[TX_BUF_CNT]; /* Tx BD */
-} RTXBD;
-
-static RTXBD *rtx;
-
-static int scc_send(struct eth_device* dev, volatile void *packet, int length);
-static int scc_recv(struct eth_device* dev);
-static int scc_init (struct eth_device* dev, bd_t * bd);
-static void scc_halt(struct eth_device* dev);
-
-int scc_initialize(bd_t *bis)
-{
- struct eth_device* dev;
-
- dev = (struct eth_device*) malloc(sizeof *dev);
- memset(dev, 0, sizeof *dev);
-
- sprintf(dev->name, "SCC ETHERNET");
- dev->iobase = 0;
- dev->priv = 0;
- dev->init = scc_init;
- dev->halt = scc_halt;
- dev->send = scc_send;
- dev->recv = scc_recv;
-
- eth_register(dev);
-
- return 1;
-}
-
-static int scc_send(struct eth_device* dev, volatile void *packet, int length)
-{
- int i, j=0;
-
- /* section 16.9.23.3
- * Wait for ready
- */
-
- while ((rtx->txbd[txIdx].cbd_sc & BD_ENET_TX_READY) && (j<TOUT_LOOP)) {
- udelay (1); /* will also trigger Wd if needed */
- j++;
- }
- if (j>=TOUT_LOOP) printf("TX not ready\n");
- rtx->txbd[txIdx].cbd_bufaddr = (uint)packet;
- rtx->txbd[txIdx].cbd_datlen = length;
- rtx->txbd[txIdx].cbd_sc |= (BD_ENET_TX_READY | BD_ENET_TX_LAST |BD_ENET_TX_WRAP);
- while ((rtx->txbd[txIdx].cbd_sc & BD_ENET_TX_READY) && (j<TOUT_LOOP)) {
- udelay (1); /* will also trigger Wd if needed */
- j++;
- }
- if (j>=TOUT_LOOP) printf("TX timeout\n");
-#ifdef ET_DEBUG
- printf("cycles: %d status: %x\n", j, rtx->txbd[txIdx].cbd_sc);
-#endif
- i = (rtx->txbd[txIdx].cbd_sc & BD_ENET_TX_STATS) /* return only status bits */;
- return i;
-}
-
-static int scc_recv (struct eth_device *dev)
-{
- int length;
-
- for (;;) {
- /* section 16.9.23.2 */
- if (rtx->rxbd[rxIdx].cbd_sc & BD_ENET_RX_EMPTY) {
- length = -1;
- break; /* nothing received - leave for() loop */
- }
-
- length = rtx->rxbd[rxIdx].cbd_datlen;
-
- if (rtx->rxbd[rxIdx].cbd_sc & 0x003f) {
-#ifdef ET_DEBUG
- printf ("err: %x\n", rtx->rxbd[rxIdx].cbd_sc);
-#endif
- } else {
- /* Pass the packet up to the protocol layers. */
- NetReceive (NetRxPackets[rxIdx], length - 4);
- }
-
-
- /* Give the buffer back to the SCC. */
- rtx->rxbd[rxIdx].cbd_datlen = 0;
-
- /* wrap around buffer index when necessary */
- if ((rxIdx + 1) >= PKTBUFSRX) {
- rtx->rxbd[PKTBUFSRX - 1].cbd_sc =
- (BD_ENET_RX_WRAP | BD_ENET_RX_EMPTY);
- rxIdx = 0;
- } else {
- rtx->rxbd[rxIdx].cbd_sc = BD_ENET_RX_EMPTY;
- rxIdx++;
- }
- }
- return length;
-}
-
-/**************************************************************
- *
- * SCC Ethernet Initialization Routine
- *
- *************************************************************/
-
-static int scc_init (struct eth_device *dev, bd_t * bis)
-{
-
- int i;
- scc_enet_t *pram_ptr;
-
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
-#if defined(CONFIG_LWMON)
- reset_phy();
-#endif
-
-#ifdef CONFIG_FADS
-#if defined(CONFIG_MPC86xADS) || defined(CONFIG_MPC860T)
- /* The MPC86xADS/FADS860T don't use the MODEM_EN or DATA_VOICE signals. */
- *((uint *) BCSR4) &= ~BCSR4_ETHLOOP;
- *((uint *) BCSR4) |= BCSR4_TFPLDL | BCSR4_TPSQEL;
- *((uint *) BCSR1) &= ~BCSR1_ETHEN;
-#else
- *((uint *) BCSR4) &= ~(BCSR4_ETHLOOP | BCSR4_MODEM_EN);
- *((uint *) BCSR4) |= BCSR4_TFPLDL | BCSR4_TPSQEL | BCSR4_DATA_VOICE;
- *((uint *) BCSR1) &= ~BCSR1_ETHEN;
-#endif
-#endif
-
- pram_ptr = (scc_enet_t *) & (immr->im_cpm.cp_dparam[PROFF_ENET]);
-
- rxIdx = 0;
- txIdx = 0;
-
-#ifdef CFG_ALLOC_DPRAM
- rtx = (RTXBD *) (immr->im_cpm.cp_dpmem +
- dpram_alloc_align (sizeof (RTXBD), 8));
-#else
- rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + CPM_SCC_BASE);
-#endif /* 0 */
-
-#if (defined(PA_ENET_RXD) && defined(PA_ENET_TXD))
- /* Configure port A pins for Txd and Rxd.
- */
- immr->im_ioport.iop_papar |= (PA_ENET_RXD | PA_ENET_TXD);
- immr->im_ioport.iop_padir &= ~(PA_ENET_RXD | PA_ENET_TXD);
- immr->im_ioport.iop_paodr &= ~PA_ENET_TXD;
-#elif (defined(PB_ENET_RXD) && defined(PB_ENET_TXD))
- /* Configure port B pins for Txd and Rxd.
- */
- immr->im_cpm.cp_pbpar |= (PB_ENET_RXD | PB_ENET_TXD);
- immr->im_cpm.cp_pbdir &= ~(PB_ENET_RXD | PB_ENET_TXD);
- immr->im_cpm.cp_pbodr &= ~PB_ENET_TXD;
-#else
-#error Configuration Error: exactly ONE of PA_ENET_[RT]XD, PB_ENET_[RT]XD must be defined
-#endif
-
-#if defined(PC_ENET_LBK)
- /* Configure port C pins to disable External Loopback
- */
- immr->im_ioport.iop_pcpar &= ~PC_ENET_LBK;
- immr->im_ioport.iop_pcdir |= PC_ENET_LBK;
- immr->im_ioport.iop_pcso &= ~PC_ENET_LBK;
- immr->im_ioport.iop_pcdat &= ~PC_ENET_LBK; /* Disable Loopback */
-#endif /* PC_ENET_LBK */
-
- /* Configure port C pins to enable CLSN and RENA.
- */
- immr->im_ioport.iop_pcpar &= ~(PC_ENET_CLSN | PC_ENET_RENA);
- immr->im_ioport.iop_pcdir &= ~(PC_ENET_CLSN | PC_ENET_RENA);
- immr->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA);
-
- /* Configure port A for TCLK and RCLK.
- */
- immr->im_ioport.iop_papar |= (PA_ENET_TCLK | PA_ENET_RCLK);
- immr->im_ioport.iop_padir &= ~(PA_ENET_TCLK | PA_ENET_RCLK);
-
- /*
- * Configure Serial Interface clock routing -- see section 16.7.5.3
- * First, clear all SCC bits to zero, then set the ones we want.
- */
-
- immr->im_cpm.cp_sicr &= ~SICR_ENET_MASK;
- immr->im_cpm.cp_sicr |= SICR_ENET_CLKRT;
-
-
- /*
- * Initialize SDCR -- see section 16.9.23.7
- * SDMA configuration register
- */
- immr->im_siu_conf.sc_sdcr = 0x01;
-
-
- /*
- * Setup SCC Ethernet Parameter RAM
- */
-
- pram_ptr->sen_genscc.scc_rfcr = 0x18; /* Normal Operation and Mot byte ordering */
- pram_ptr->sen_genscc.scc_tfcr = 0x18; /* Mot byte ordering, Normal access */
-
- pram_ptr->sen_genscc.scc_mrblr = DBUF_LENGTH; /* max. ET package len 1520 */
-
- pram_ptr->sen_genscc.scc_rbase = (unsigned int) (&rtx->rxbd[0]); /* Set RXBD tbl start at Dual Port */
- pram_ptr->sen_genscc.scc_tbase = (unsigned int) (&rtx->txbd[0]); /* Set TXBD tbl start at Dual Port */
-
- /*
- * Setup Receiver Buffer Descriptors (13.14.24.18)
- * Settings:
- * Empty, Wrap
- */
-
- for (i = 0; i < PKTBUFSRX; i++) {
- rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
- rtx->rxbd[i].cbd_datlen = 0; /* Reset */
- rtx->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
- }
-
- rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
-
- /*
- * Setup Ethernet Transmitter Buffer Descriptors (13.14.24.19)
- * Settings:
- * Add PADs to Short FRAMES, Wrap, Last, Tx CRC
- */
-
- for (i = 0; i < TX_BUF_CNT; i++) {
- rtx->txbd[i].cbd_sc =
- (BD_ENET_TX_PAD | BD_ENET_TX_LAST | BD_ENET_TX_TC);
- rtx->txbd[i].cbd_datlen = 0; /* Reset */
- rtx->txbd[i].cbd_bufaddr = (uint) (&txbuf[0]);
- }
-
- rtx->txbd[TX_BUF_CNT - 1].cbd_sc |= BD_ENET_TX_WRAP;
-
- /*
- * Enter Command: Initialize Rx Params for SCC
- */
-
- do { /* Spin until ready to issue command */
- __asm__ ("eieio");
- } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG);
- /* Issue command */
- immr->im_cpm.cp_cpcr =
- ((CPM_CR_INIT_RX << 8) | (CPM_CR_ENET << 4) | CPM_CR_FLG);
- do { /* Spin until command processed */
- __asm__ ("eieio");
- } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG);
-
- /*
- * Ethernet Specific Parameter RAM
- * see table 13-16, pg. 660,
- * pg. 681 (example with suggested settings)
- */
-
- pram_ptr->sen_cpres = ~(0x0); /* Preset CRC */
- pram_ptr->sen_cmask = 0xdebb20e3; /* Constant Mask for CRC */
- pram_ptr->sen_crcec = 0x0; /* Error Counter CRC (unused) */
- pram_ptr->sen_alec = 0x0; /* Alignment Error Counter (unused) */
- pram_ptr->sen_disfc = 0x0; /* Discard Frame Counter (unused) */
- pram_ptr->sen_pads = 0x8888; /* Short Frame PAD Characters */
-
- pram_ptr->sen_retlim = 15; /* Retry Limit Threshold */
- pram_ptr->sen_maxflr = 1518; /* MAX Frame Length Register */
- pram_ptr->sen_minflr = 64; /* MIN Frame Length Register */
-
- pram_ptr->sen_maxd1 = DBUF_LENGTH; /* MAX DMA1 Length Register */
- pram_ptr->sen_maxd2 = DBUF_LENGTH; /* MAX DMA2 Length Register */
-
- pram_ptr->sen_gaddr1 = 0x0; /* Group Address Filter 1 (unused) */
- pram_ptr->sen_gaddr2 = 0x0; /* Group Address Filter 2 (unused) */
- pram_ptr->sen_gaddr3 = 0x0; /* Group Address Filter 3 (unused) */
- pram_ptr->sen_gaddr4 = 0x0; /* Group Address Filter 4 (unused) */
-
-#define ea eth_get_dev()->enetaddr
- pram_ptr->sen_paddrh = (ea[5] << 8) + ea[4];
- pram_ptr->sen_paddrm = (ea[3] << 8) + ea[2];
- pram_ptr->sen_paddrl = (ea[1] << 8) + ea[0];
-#undef ea
-
- pram_ptr->sen_pper = 0x0; /* Persistence (unused) */
- pram_ptr->sen_iaddr1 = 0x0; /* Individual Address Filter 1 (unused) */
- pram_ptr->sen_iaddr2 = 0x0; /* Individual Address Filter 2 (unused) */
- pram_ptr->sen_iaddr3 = 0x0; /* Individual Address Filter 3 (unused) */
- pram_ptr->sen_iaddr4 = 0x0; /* Individual Address Filter 4 (unused) */
- pram_ptr->sen_taddrh = 0x0; /* Tmp Address (MSB) (unused) */
- pram_ptr->sen_taddrm = 0x0; /* Tmp Address (unused) */
- pram_ptr->sen_taddrl = 0x0; /* Tmp Address (LSB) (unused) */
-
- /*
- * Enter Command: Initialize Tx Params for SCC
- */
-
- do { /* Spin until ready to issue command */
- __asm__ ("eieio");
- } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG);
- /* Issue command */
- immr->im_cpm.cp_cpcr =
- ((CPM_CR_INIT_TX << 8) | (CPM_CR_ENET << 4) | CPM_CR_FLG);
- do { /* Spin until command processed */
- __asm__ ("eieio");
- } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG);
-
- /*
- * Mask all Events in SCCM - we use polling mode
- */
- immr->im_cpm.cp_scc[SCC_ENET].scc_sccm = 0;
-
- /*
- * Clear Events in SCCE -- Clear bits by writing 1's
- */
-
- immr->im_cpm.cp_scc[SCC_ENET].scc_scce = ~(0x0);
-
-
- /*
- * Initialize GSMR High 32-Bits
- * Settings: Normal Mode
- */
-
- immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrh = 0;
-
- /*
- * Initialize GSMR Low 32-Bits, but do not Enable Transmit/Receive
- * Settings:
- * TCI = Invert
- * TPL = 48 bits
- * TPP = Repeating 10's
- * MODE = Ethernet
- */
-
- immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrl = (SCC_GSMRL_TCI |
- SCC_GSMRL_TPL_48 |
- SCC_GSMRL_TPP_10 |
- SCC_GSMRL_MODE_ENET);
-
- /*
- * Initialize the DSR -- see section 13.14.4 (pg. 513) v0.4
- */
-
- immr->im_cpm.cp_scc[SCC_ENET].scc_dsr = 0xd555;
-
- /*
- * Initialize the PSMR
- * Settings:
- * CRC = 32-Bit CCITT
- * NIB = Begin searching for SFD 22 bits after RENA
- * FDE = Full Duplex Enable
- * LPB = Loopback Enable (Needed when FDE is set)
- * BRO = Reject broadcast packets
- * PROMISCOUS = Catch all packets regardless of dest. MAC adress
- */
- immr->im_cpm.cp_scc[SCC_ENET].scc_psmr = SCC_PSMR_ENCRC |
- SCC_PSMR_NIB22 |
-#if defined(CONFIG_SCC_ENET_FULL_DUPLEX)
- SCC_PSMR_FDE | SCC_PSMR_LPB |
-#endif
-#if defined(CONFIG_SCC_ENET_NO_BROADCAST)
- SCC_PSMR_BRO |
-#endif
-#if defined(CONFIG_SCC_ENET_PROMISCOUS)
- SCC_PSMR_PRO |
-#endif
- 0;
-
- /*
- * Configure Ethernet TENA Signal
- */
-
-#if (defined(PC_ENET_TENA) && !defined(PB_ENET_TENA))
- immr->im_ioport.iop_pcpar |= PC_ENET_TENA;
- immr->im_ioport.iop_pcdir &= ~PC_ENET_TENA;
-#elif (defined(PB_ENET_TENA) && !defined(PC_ENET_TENA))
- immr->im_cpm.cp_pbpar |= PB_ENET_TENA;
- immr->im_cpm.cp_pbdir |= PB_ENET_TENA;
-#else
-#error Configuration Error: exactly ONE of PB_ENET_TENA, PC_ENET_TENA must be defined
-#endif
-
-#if defined(CONFIG_ADS) && defined(CONFIG_MPC860)
- /*
- * Port C is used to control the PHY,MC68160.
- */
- immr->im_ioport.iop_pcdir |=
- (PC_ENET_ETHLOOP | PC_ENET_TPFLDL | PC_ENET_TPSQEL);
-
- immr->im_ioport.iop_pcdat |= PC_ENET_TPFLDL;
- immr->im_ioport.iop_pcdat &= ~(PC_ENET_ETHLOOP | PC_ENET_TPSQEL);
- *((uint *) BCSR1) &= ~BCSR1_ETHEN;
-#endif /* MPC860ADS */
-
-#if defined(CONFIG_AMX860)
- /*
- * Port B is used to control the PHY,MC68160.
- */
- immr->im_cpm.cp_pbdir |=
- (PB_ENET_ETHLOOP | PB_ENET_TPFLDL | PB_ENET_TPSQEL);
-
- immr->im_cpm.cp_pbdat |= PB_ENET_TPFLDL;
- immr->im_cpm.cp_pbdat &= ~(PB_ENET_ETHLOOP | PB_ENET_TPSQEL);
-
- immr->im_ioport.iop_pddir |= PD_ENET_ETH_EN;
- immr->im_ioport.iop_pddat &= ~PD_ENET_ETH_EN;
-#endif /* AMX860 */
-
-#ifdef CONFIG_RPXCLASSIC
- *((uchar *) BCSR0) &= ~BCSR0_ETHLPBK;
- *((uchar *) BCSR0) |= (BCSR0_ETHEN | BCSR0_COLTEST | BCSR0_FULLDPLX);
-#endif
-
-#ifdef CONFIG_RPXLITE
- *((uchar *) BCSR0) |= BCSR0_ETHEN;
-#endif
-
-#if defined(CONFIG_QS860T)
- /*
- * PB27=FDE-, set output low for full duplex
- * PB26=Link Test Enable, normally high output
- */
- immr->im_cpm.cp_pbdir |= 0x00000030;
- immr->im_cpm.cp_pbdat |= 0x00000020;
- immr->im_cpm.cp_pbdat &= ~0x00000010;
-#endif /* QS860T */
-
-#ifdef CONFIG_MBX
- board_ether_init ();
-#endif
-
-#if defined(CONFIG_NETVIA)
-#if defined(PA_ENET_PDN)
- immr->im_ioport.iop_papar &= ~PA_ENET_PDN;
- immr->im_ioport.iop_padir |= PA_ENET_PDN;
- immr->im_ioport.iop_padat |= PA_ENET_PDN;
-#elif defined(PB_ENET_PDN)
- immr->im_cpm.cp_pbpar &= ~PB_ENET_PDN;
- immr->im_cpm.cp_pbdir |= PB_ENET_PDN;
- immr->im_cpm.cp_pbdat |= PB_ENET_PDN;
-#elif defined(PC_ENET_PDN)
- immr->im_ioport.iop_pcpar &= ~PC_ENET_PDN;
- immr->im_ioport.iop_pcdir |= PC_ENET_PDN;
- immr->im_ioport.iop_pcdat |= PC_ENET_PDN;
-#elif defined(PD_ENET_PDN)
- immr->im_ioport.iop_pdpar &= ~PD_ENET_PDN;
- immr->im_ioport.iop_pddir |= PD_ENET_PDN;
- immr->im_ioport.iop_pddat |= PD_ENET_PDN;
-#endif
-#endif
-
- /*
- * Set the ENT/ENR bits in the GSMR Low -- Enable Transmit/Receive
- */
-
- immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrl |=
- (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
-
- /*
- * Work around transmit problem with first eth packet
- */
-#if defined (CONFIG_FADS)
- udelay (10000); /* wait 10 ms */
-#elif defined (CONFIG_AMX860) || defined(CONFIG_RPXCLASSIC)
- udelay (100000); /* wait 100 ms */
-#endif
-
- return 1;
-}
-
-
-static void scc_halt (struct eth_device *dev)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
-
- immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrl &=
- ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
-
- immr->im_ioport.iop_pcso &= ~(PC_ENET_CLSN | PC_ENET_RENA);
-}
-
-#endif /* CFG_CMD_NET, SCC_ENET */
diff --git a/cpu/mpc8xx/speed.c b/cpu/mpc8xx/speed.c
deleted file mode 100644
index 101d5f9cb3..0000000000
--- a/cpu/mpc8xx/speed.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * (C) Copyright 2000-2004
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <mpc8xx.h>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if !defined(CONFIG_8xx_CPUCLK_DEFAULT) || defined(CFG_MEASURE_CPUCLK) || defined(DEBUG)
-
-#define PITC_SHIFT 16
-#define PITR_SHIFT 16
-/* pitc values to time for 58/8192 seconds (about 70.8 milliseconds) */
-#define SPEED_PIT_COUNTS 58
-#define SPEED_PITC ((SPEED_PIT_COUNTS - 1) << PITC_SHIFT)
-#define SPEED_PITC_INIT ((SPEED_PIT_COUNTS + 1) << PITC_SHIFT)
-
-/* Access functions for the Machine State Register */
-static __inline__ unsigned long get_msr(void)
-{
- unsigned long msr;
-
- asm volatile("mfmsr %0" : "=r" (msr) :);
- return msr;
-}
-
-static __inline__ void set_msr(unsigned long msr)
-{
- asm volatile("mtmsr %0" : : "r" (msr));
-}
-
-/* ------------------------------------------------------------------------- */
-
-/*
- * Measure CPU clock speed (core clock GCLK1, GCLK2),
- * also determine bus clock speed (checking bus divider factor)
- *
- * (Approx. GCLK frequency in Hz)
- *
- * Initializes timer 2 and PIT, but disables them before return.
- * [Use timer 2, because MPC823 CPUs mask 0.x do not have timers 3 and 4]
- *
- * When measuring the CPU clock against the PIT, we count cpu clocks
- * for 58/8192 seconds with a prescale divide by 177 for the cpu clock.
- * These strange values for the timing interval and prescaling are used
- * because the formula for the CPU clock is:
- *
- * CPU clock = count * (177 * (8192 / 58))
- *
- * = count * 24999.7241
- *
- * which is very close to
- *
- * = count * 25000
- *
- * Since the count gives the CPU clock divided by 25000, we can get
- * the CPU clock rounded to the nearest 0.1 MHz by
- *
- * CPU clock = ((count + 2) / 4) * 100000;
- *
- * The rounding is important since the measurement is sometimes going
- * to be high or low by 0.025 MHz, depending on exactly how the clocks
- * and counters interact. By rounding we get the exact answer for any
- * CPU clock that is an even multiple of 0.1 MHz.
- */
-
-unsigned long measure_gclk(void)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- volatile cpmtimer8xx_t *timerp = &immr->im_cpmtimer;
- ulong timer2_val;
- ulong msr_val;
-
-#ifdef CFG_8XX_XIN
- /* dont use OSCM, only use EXTCLK/512 */
- immr->im_clkrst.car_sccr |= SCCR_RTSEL | SCCR_RTDIV;
-#else
- immr->im_clkrst.car_sccr &= ~(SCCR_RTSEL | SCCR_RTDIV);
-#endif
-
- /* Reset + Stop Timer 2, no cascading
- */
- timerp->cpmt_tgcr &= ~(TGCR_CAS2 | TGCR_RST2);
-
- /* Keep stopped, halt in debug mode
- */
- timerp->cpmt_tgcr |= (TGCR_FRZ2 | TGCR_STP2);
-
- /* Timer 2 setup:
- * Output ref. interrupt disable, int. clock
- * Prescale by 177. Note that prescaler divides by value + 1
- * so we must subtract 1 here.
- */
- timerp->cpmt_tmr2 = ((177 - 1) << TMR_PS_SHIFT) | TMR_ICLK_IN_GEN;
-
- timerp->cpmt_tcn2 = 0; /* reset state */
- timerp->cpmt_tgcr |= TGCR_RST2; /* enable timer 2 */
-
- /*
- * PIT setup:
- *
- * We want to time for SPEED_PITC_COUNTS counts (of 8192 Hz),
- * so the count value would be SPEED_PITC_COUNTS - 1.
- * But there would be an uncertainty in the start time of 1/4
- * count since when we enable the PIT the count is not
- * synchronized to the 32768 Hz oscillator. The trick here is
- * to start the count higher and wait until the PIT count
- * changes to the required value before starting timer 2.
- *
- * One count high should be enough, but occasionally the start
- * is off by 1 or 2 counts of 32768 Hz. With the start value
- * set two counts high it seems very reliable.
- */
-
- immr->im_sitk.sitk_pitck = KAPWR_KEY; /* PIT initialization */
- immr->im_sit.sit_pitc = SPEED_PITC_INIT;
-
- immr->im_sitk.sitk_piscrk = KAPWR_KEY;
- immr->im_sit.sit_piscr = CFG_PISCR;
-
- /*
- * Start measurement - disable interrupts, just in case
- */
- msr_val = get_msr ();
- set_msr (msr_val & ~MSR_EE);
-
- immr->im_sit.sit_piscr |= PISCR_PTE;
-
- /* spin until get exact count when we want to start */
- while (immr->im_sit.sit_pitr > SPEED_PITC);
-
- timerp->cpmt_tgcr &= ~TGCR_STP2; /* Start Timer 2 */
- while ((immr->im_sit.sit_piscr & PISCR_PS) == 0);
- timerp->cpmt_tgcr |= TGCR_STP2; /* Stop Timer 2 */
-
- /* re-enable external interrupts if they were on */
- set_msr (msr_val);
-
- /* Disable timer and PIT
- */
- timer2_val = timerp->cpmt_tcn2; /* save before reset timer */
-
- timerp->cpmt_tgcr &= ~(TGCR_RST2 | TGCR_FRZ2 | TGCR_STP2);
- immr->im_sit.sit_piscr &= ~PISCR_PTE;
-
-#if defined(CFG_8XX_XIN)
- /* not using OSCM, using XIN, so scale appropriately */
- return (((timer2_val + 2) / 4) * (CFG_8XX_XIN/512))/8192 * 100000L;
-#else
- return ((timer2_val + 2) / 4) * 100000L; /* convert to Hz */
-#endif
-}
-
-#endif
-
-#if !defined(CONFIG_8xx_CPUCLK_DEFAULT)
-
-/*
- * get_clocks() fills in gd->cpu_clock depending on CONFIG_8xx_GCLK_FREQ
- * or (if it is not defined) measure_gclk() (which uses the ref clock)
- * from above.
- */
-int get_clocks (void)
-{
- uint immr = get_immr (0); /* Return full IMMR contents */
- volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);
- uint sccr = immap->im_clkrst.car_sccr;
- /*
- * If for some reason measuring the gclk frequency won't
- * work, we return the hardwired value.
- * (For example, the cogent CMA286-60 CPU module has no
- * separate oscillator for PITRTCLK)
- */
-#if defined(CONFIG_8xx_GCLK_FREQ)
- gd->cpu_clk = CONFIG_8xx_GCLK_FREQ;
-#elif defined(CONFIG_8xx_OSCLK)
-#define PLPRCR_val(a) ((pll & PLPRCR_ ## a ## _MSK) >> PLPRCR_ ## a ## _SHIFT)
- uint pll = immap->im_clkrst.car_plprcr;
- uint clk;
-
- if ((immr & 0x0FFF) >= MPC8xx_NEW_CLK) { /* MPC866/87x/88x series */
- clk = ((CONFIG_8xx_OSCLK / (PLPRCR_val(PDF)+1)) *
- (PLPRCR_val(MFI) + PLPRCR_val(MFN) / (PLPRCR_val(MFD)+1))) /
- (1<<PLPRCR_val(S));
- } else {
- clk = CONFIG_8xx_OSCLK * (PLPRCR_val(MF)+1);
- }
- if (pll & PLPRCR_CSRC) { /* Low frequency division factor is used */
- gd->cpu_clk = clk / (2 << ((sccr >> 8) & 7));
- } else { /* High frequency division factor is used */
- gd->cpu_clk = clk / (1 << ((sccr >> 5) & 7));
- }
-#else
- gd->cpu_clk = measure_gclk();
-#endif /* CONFIG_8xx_GCLK_FREQ */
-
- if ((sccr & SCCR_EBDF11) == 0) {
- /* No Bus Divider active */
- gd->bus_clk = gd->cpu_clk;
- } else {
- /* The MPC8xx has only one BDF: half clock speed */
- gd->bus_clk = gd->cpu_clk / 2;
- }
-
- return (0);
-}
-
-#else /* CONFIG_8xx_CPUCLK_DEFAULT defined, use dynamic clock setting */
-
-static long init_pll_866 (long clk);
-
-/* This function sets up PLL (init_pll_866() is called) and
- * fills gd->cpu_clk and gd->bus_clk according to the environment
- * variable 'cpuclk' or to CONFIG_8xx_CPUCLK_DEFAULT (if 'cpuclk'
- * contains invalid value).
- * This functions requires an MPC866 or newer series CPU.
- */
-int get_clocks_866 (void)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- char tmp[64];
- long cpuclk = 0;
- long sccr_reg;
-
- if (getenv_r ("cpuclk", tmp, sizeof (tmp)) > 0)
- cpuclk = simple_strtoul (tmp, NULL, 10) * 1000000;
-
- if ((CFG_8xx_CPUCLK_MIN > cpuclk) || (CFG_8xx_CPUCLK_MAX < cpuclk))
- cpuclk = CONFIG_8xx_CPUCLK_DEFAULT;
-
- gd->cpu_clk = init_pll_866 (cpuclk);
-#if defined(CFG_MEASURE_CPUCLK)
- gd->cpu_clk = measure_gclk ();
-#endif
-
- /* if cpu clock <= 66 MHz then set bus division factor to 1,
- * otherwise set it to 2
- */
- sccr_reg = immr->im_clkrst.car_sccr;
- sccr_reg &= ~SCCR_EBDF11;
-#if defined(CONFIG_TQM885D)
- if (gd->cpu_clk <= 80000000) {
-#else
- if (gd->cpu_clk <= 66000000) {
-#endif
- sccr_reg |= SCCR_EBDF00; /* bus division factor = 1 */
- gd->bus_clk = gd->cpu_clk;
- } else {
- sccr_reg |= SCCR_EBDF01; /* bus division factor = 2 */
- gd->bus_clk = gd->cpu_clk / 2;
- }
- immr->im_clkrst.car_sccr = sccr_reg;
-
- return (0);
-}
-
-/* Adjust sdram refresh rate to actual CPU clock.
- */
-int sdram_adjust_866 (void)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- long mamr;
-
- mamr = immr->im_memctl.memc_mamr;
- mamr &= ~MAMR_PTA_MSK;
- mamr |= ((gd->cpu_clk / CFG_PTA_PER_CLK) << MAMR_PTA_SHIFT);
- immr->im_memctl.memc_mamr = mamr;
-
- return (0);
-}
-
-/* Configure PLL for MPC866/859/885 CPU series
- * PLL multiplication factor is set to the value nearest to the desired clk,
- * assuming a oscclk of 10 MHz.
- */
-static long init_pll_866 (long clk)
-{
- extern void plprcr_write_866 (long);
-
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- long n, plprcr;
- char mfi, mfn, mfd, s, pdf;
- long step_mfi, step_mfn;
-
- if (clk < 20000000) {
- clk *= 2;
- pdf = 1;
- } else {
- pdf = 0;
- }
-
- if (clk < 40000000) {
- s = 2;
- step_mfi = CONFIG_8xx_OSCLK / 4;
- mfd = 7;
- step_mfn = CONFIG_8xx_OSCLK / 30;
- } else if (clk < 80000000) {
- s = 1;
- step_mfi = CONFIG_8xx_OSCLK / 2;
- mfd = 14;
- step_mfn = CONFIG_8xx_OSCLK / 30;
- } else {
- s = 0;
- step_mfi = CONFIG_8xx_OSCLK;
- mfd = 29;
- step_mfn = CONFIG_8xx_OSCLK / 30;
- }
-
- /* Calculate integer part of multiplication factor
- */
- n = clk / step_mfi;
- mfi = (char)n;
-
- /* Calculate numerator of fractional part of multiplication factor
- */
- n = clk - (n * step_mfi);
- mfn = (char)(n / step_mfn);
-
- /* Calculate effective clk
- */
- n = ((mfi * step_mfi) + (mfn * step_mfn)) / (pdf + 1);
-
- immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
-
- plprcr = (immr->im_clkrst.car_plprcr & ~(PLPRCR_MFN_MSK
- | PLPRCR_MFD_MSK | PLPRCR_S_MSK
- | PLPRCR_MFI_MSK | PLPRCR_DBRMO
- | PLPRCR_PDF_MSK))
- | (mfn << PLPRCR_MFN_SHIFT)
- | (mfd << PLPRCR_MFD_SHIFT)
- | (s << PLPRCR_S_SHIFT)
- | (mfi << PLPRCR_MFI_SHIFT)
- | (pdf << PLPRCR_PDF_SHIFT);
-
- if( (mfn > 0) && ((mfd / mfn) > 10) )
- plprcr |= PLPRCR_DBRMO;
-
- plprcr_write_866 (plprcr); /* set value using SIU4/9 workaround */
- immr->im_clkrstk.cark_plprcrk = 0x00000000;
-
- return (n);
-}
-
-#endif /* CONFIG_8xx_CPUCLK_DEFAULT */
-
-#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \
- && !defined(CONFIG_TQM885D)
-/*
- * Adjust sdram refresh rate to actual CPU clock
- * and set timebase source according to actual CPU clock
- */
-int adjust_sdram_tbs_8xx (void)
-{
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- long mamr;
- long sccr;
-
- mamr = immr->im_memctl.memc_mamr;
- mamr &= ~MAMR_PTA_MSK;
- mamr |= ((gd->cpu_clk / CFG_PTA_PER_CLK) << MAMR_PTA_SHIFT);
- immr->im_memctl.memc_mamr = mamr;
-
- if (gd->cpu_clk < 67000000) {
- sccr = immr->im_clkrst.car_sccr;
- sccr |= SCCR_TBS;
- immr->im_clkrst.car_sccr = sccr;
- }
-
- return (0);
-}
-#endif /* CONFIG_TQM8xxL/M, !TQM866M, !TQM885D */
-
-/* ------------------------------------------------------------------------- */
diff --git a/cpu/mpc8xx/spi.c b/cpu/mpc8xx/spi.c
deleted file mode 100644
index e318ed0d29..0000000000
--- a/cpu/mpc8xx/spi.c
+++ /dev/null
@@ -1,560 +0,0 @@
-/*
- * Copyright (c) 2001 Navin Boppuri / Prashant Patel
- * <nboppuri@trinetcommunication.com>,
- * <pmpatel@trinetcommunication.com>
- * Copyright (c) 2001 Gerd Mennchen <Gerd.Mennchen@icn.siemens.de>
- * Copyright (c) 2001 Wolfgang Denk, DENX Software Engineering, <wd@denx.de>.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * MPC8xx CPM SPI interface.
- *
- * Parts of this code are probably not portable and/or specific to
- * the board which I used for the tests. Please send fixes/complaints
- * to wd@denx.de
- *
- */
-
-#include <common.h>
-#include <mpc8xx.h>
-#include <commproc.h>
-#include <linux/ctype.h>
-#include <malloc.h>
-#include <post.h>
-#include <serial.h>
-
-#if (defined(CONFIG_SPI)) || (CONFIG_POST & CFG_POST_SPI)
-
-/* Warning:
- * You cannot enable DEBUG for early system initalization, i. e. when
- * this driver is used to read environment parameters like "baudrate"
- * from EEPROM which are used to initialize the serial port which is
- * needed to print the debug messages...
- */
-#undef DEBUG
-
-#define SPI_EEPROM_WREN 0x06
-#define SPI_EEPROM_RDSR 0x05
-#define SPI_EEPROM_READ 0x03
-#define SPI_EEPROM_WRITE 0x02
-
-/* ---------------------------------------------------------------
- * Offset for initial SPI buffers in DPRAM:
- * We need a 520 byte scratch DPRAM area to use at an early stage.
- * It is used between the two initialization calls (spi_init_f()
- * and spi_init_r()).
- * The value 0xb00 makes it far enough from the start of the data
- * area (as well as from the stack pointer).
- * --------------------------------------------------------------- */
-#ifndef CFG_SPI_INIT_OFFSET
-#define CFG_SPI_INIT_OFFSET 0xB00
-#endif
-
-#ifdef DEBUG
-
-#define DPRINT(a) printf a;
-/* -----------------------------------------------
- * Helper functions to peek into tx and rx buffers
- * ----------------------------------------------- */
-static const char * const hex_digit = "0123456789ABCDEF";
-
-static char quickhex (int i)
-{
- return hex_digit[i];
-}
-
-static void memdump (void *pv, int num)
-{
- int i;
- unsigned char *pc = (unsigned char *) pv;
-
- for (i = 0; i < num; i++)
- printf ("%c%c ", quickhex (pc[i] >> 4), quickhex (pc[i] & 0x0f));
- printf ("\t");
- for (i = 0; i < num; i++)
- printf ("%c", isprint (pc[i]) ? pc[i] : '.');
- printf ("\n");
-}
-#else /* !DEBUG */
-
-#define DPRINT(a)
-
-#endif /* DEBUG */
-
-/* -------------------
- * Function prototypes
- * ------------------- */
-void spi_init (void);
-
-ssize_t spi_read (uchar *, int, uchar *, int);
-ssize_t spi_write (uchar *, int, uchar *, int);
-ssize_t spi_xfer (size_t);
-
-/* -------------------
- * Variables
- * ------------------- */
-
-#define MAX_BUFFER 0x104
-
-/* ----------------------------------------------------------------------
- * Initially we place the RX and TX buffers at a fixed location in DPRAM!
- * ---------------------------------------------------------------------- */
-static uchar *rxbuf =
- (uchar *)&((cpm8xx_t *)&((immap_t *)CFG_IMMR)->im_cpm)->cp_dpmem
- [CFG_SPI_INIT_OFFSET];
-static uchar *txbuf =
- (uchar *)&((cpm8xx_t *)&((immap_t *)CFG_IMMR)->im_cpm)->cp_dpmem
- [CFG_SPI_INIT_OFFSET+MAX_BUFFER];
-
-/* **************************************************************************
- *
- * Function: spi_init_f
- *
- * Description: Init SPI-Controller (ROM part)
- *
- * return: ---
- *
- * *********************************************************************** */
-void spi_init_f (void)
-{
- unsigned int dpaddr;
-
- volatile spi_t *spi;
- volatile immap_t *immr;
- volatile cpic8xx_t *cpi;
- volatile cpm8xx_t *cp;
- volatile iop8xx_t *iop;
- volatile cbd_t *tbdf, *rbdf;
-
- immr = (immap_t *) CFG_IMMR;
- cpi = (cpic8xx_t *)&immr->im_cpic;
- iop = (iop8xx_t *) &immr->im_ioport;
- cp = (cpm8xx_t *) &immr->im_cpm;
-
-#ifdef CFG_SPI_UCODE_PATCH
- spi = (spi_t *)&cp->cp_dpmem[spi->spi_rpbase];
-#else
- spi = (spi_t *)&cp->cp_dparam[PROFF_SPI];
- /* Disable relocation */
- spi->spi_rpbase = 0;
-#endif
-
-/* 1 */
- /* ------------------------------------------------
- * Initialize Port B SPI pins -> page 34-8 MPC860UM
- * (we are only in Master Mode !)
- * ------------------------------------------------ */
-
- /* --------------------------------------------
- * GPIO or per. Function
- * PBPAR[28] = 1 [0x00000008] -> PERI: (SPIMISO)
- * PBPAR[29] = 1 [0x00000004] -> PERI: (SPIMOSI)
- * PBPAR[30] = 1 [0x00000002] -> PERI: (SPICLK)
- * PBPAR[31] = 0 [0x00000001] -> GPIO: (CS for PCUE/CCM-EEPROM)
- * -------------------------------------------- */
- cp->cp_pbpar |= 0x0000000E; /* set bits */
- cp->cp_pbpar &= ~0x00000001; /* reset bit */
-
- /* ----------------------------------------------
- * In/Out or per. Function 0/1
- * PBDIR[28] = 1 [0x00000008] -> PERI1: SPIMISO
- * PBDIR[29] = 1 [0x00000004] -> PERI1: SPIMOSI
- * PBDIR[30] = 1 [0x00000002] -> PERI1: SPICLK
- * PBDIR[31] = 1 [0x00000001] -> GPIO OUT: CS for PCUE/CCM-EEPROM
- * ---------------------------------------------- */
- cp->cp_pbdir |= 0x0000000F;
-
- /* ----------------------------------------------
- * open drain or active output
- * PBODR[28] = 1 [0x00000008] -> open drain: SPIMISO
- * PBODR[29] = 0 [0x00000004] -> active output SPIMOSI
- * PBODR[30] = 0 [0x00000002] -> active output: SPICLK
- * PBODR[31] = 0 [0x00000001] -> active output: GPIO OUT: CS for PCUE/CCM
- * ---------------------------------------------- */
-
- cp->cp_pbodr |= 0x00000008;
- cp->cp_pbodr &= ~0x00000007;
-
- /* Initialize the parameter ram.
- * We need to make sure many things are initialized to zero
- */
- spi->spi_rstate = 0;
- spi->spi_rdp = 0;
- spi->spi_rbptr = 0;
- spi->spi_rbc = 0;
- spi->spi_rxtmp = 0;
- spi->spi_tstate = 0;
- spi->spi_tdp = 0;
- spi->spi_tbptr = 0;
- spi->spi_tbc = 0;
- spi->spi_txtmp = 0;
-
- /* Allocate space for one transmit and one receive buffer
- * descriptor in the DP ram
- */
-#ifdef CFG_ALLOC_DPRAM
- dpaddr = dpram_alloc_align (sizeof(cbd_t)*2, 8);
-#else
- dpaddr = CPM_SPI_BASE;
-#endif
-
-/* 3 */
- /* Set up the SPI parameters in the parameter ram */
- spi->spi_rbase = dpaddr;
- spi->spi_tbase = dpaddr + sizeof (cbd_t);
-
- /***********IMPORTANT******************/
-
- /*
- * Setting transmit and receive buffer descriptor pointers
- * initially to rbase and tbase. Only the microcode patches
- * documentation talks about initializing this pointer. This
- * is missing from the sample I2C driver. If you dont
- * initialize these pointers, the kernel hangs.
- */
- spi->spi_rbptr = spi->spi_rbase;
- spi->spi_tbptr = spi->spi_tbase;
-
-/* 4 */
-#ifdef CFG_SPI_UCODE_PATCH
- /*
- * Initialize required parameters if using microcode patch.
- */
- spi->spi_rstate = 0;
- spi->spi_tstate = 0;
-#else
- /* Init SPI Tx + Rx Parameters */
- while (cp->cp_cpcr & CPM_CR_FLG)
- ;
- cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SPI, CPM_CR_INIT_TRX) | CPM_CR_FLG;
- while (cp->cp_cpcr & CPM_CR_FLG)
- ;
-#endif /* CFG_SPI_UCODE_PATCH */
-
-/* 5 */
- /* Set SDMA configuration register */
- immr->im_siu_conf.sc_sdcr = 0x0001;
-
-/* 6 */
- /* Set to big endian. */
- spi->spi_tfcr = SMC_EB;
- spi->spi_rfcr = SMC_EB;
-
-/* 7 */
- /* Set maximum receive size. */
- spi->spi_mrblr = MAX_BUFFER;
-
-/* 8 + 9 */
- /* tx and rx buffer descriptors */
- tbdf = (cbd_t *) & cp->cp_dpmem[spi->spi_tbase];
- rbdf = (cbd_t *) & cp->cp_dpmem[spi->spi_rbase];
-
- tbdf->cbd_sc &= ~BD_SC_READY;
- rbdf->cbd_sc &= ~BD_SC_EMPTY;
-
- /* Set the bd's rx and tx buffer address pointers */
- rbdf->cbd_bufaddr = (ulong) rxbuf;
- tbdf->cbd_bufaddr = (ulong) txbuf;
-
-/* 10 + 11 */
- cp->cp_spim = 0; /* Mask all SPI events */
- cp->cp_spie = SPI_EMASK; /* Clear all SPI events */
-
- return;
-}
-
-/* **************************************************************************
- *
- * Function: spi_init_r
- *
- * Description: Init SPI-Controller (RAM part) -
- * The malloc engine is ready and we can move our buffers to
- * normal RAM
- *
- * return: ---
- *
- * *********************************************************************** */
-void spi_init_r (void)
-{
- volatile cpm8xx_t *cp;
- volatile spi_t *spi;
- volatile immap_t *immr;
- volatile cbd_t *tbdf, *rbdf;
-
- immr = (immap_t *) CFG_IMMR;
- cp = (cpm8xx_t *) &immr->im_cpm;
-
-#ifdef CFG_SPI_UCODE_PATCH
- spi = (spi_t *)&cp->cp_dpmem[spi->spi_rpbase];
-#else
- spi = (spi_t *)&cp->cp_dparam[PROFF_SPI];
- /* Disable relocation */
- spi->spi_rpbase = 0;
-#endif
-
- /* tx and rx buffer descriptors */
- tbdf = (cbd_t *) & cp->cp_dpmem[spi->spi_tbase];
- rbdf = (cbd_t *) & cp->cp_dpmem[spi->spi_rbase];
-
- /* Allocate memory for RX and TX buffers */
- rxbuf = (uchar *) malloc (MAX_BUFFER);
- txbuf = (uchar *) malloc (MAX_BUFFER);
-
- rbdf->cbd_bufaddr = (ulong) rxbuf;
- tbdf->cbd_bufaddr = (ulong) txbuf;
-
- return;
-}
-
-/****************************************************************************
- * Function: spi_write
- **************************************************************************** */
-ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
-{
- int i;
-
- memset(rxbuf, 0, MAX_BUFFER);
- memset(txbuf, 0, MAX_BUFFER);
- *txbuf = SPI_EEPROM_WREN; /* write enable */
- spi_xfer(1);
- memcpy(txbuf, addr, alen);
- *txbuf = SPI_EEPROM_WRITE; /* WRITE memory array */
- memcpy(alen + txbuf, buffer, len);
- spi_xfer(alen + len);
- /* ignore received data */
- for (i = 0; i < 1000; i++) {
- *txbuf = SPI_EEPROM_RDSR; /* read status */
- txbuf[1] = 0;
- spi_xfer(2);
- if (!(rxbuf[1] & 1)) {
- break;
- }
- udelay(1000);
- }
- if (i >= 1000) {
- printf ("*** spi_write: Time out while writing!\n");
- }
-
- return len;
-}
-
-/****************************************************************************
- * Function: spi_read
- **************************************************************************** */
-ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
-{
- memset(rxbuf, 0, MAX_BUFFER);
- memset(txbuf, 0, MAX_BUFFER);
- memcpy(txbuf, addr, alen);
- *txbuf = SPI_EEPROM_READ; /* READ memory array */
-
- /*
- * There is a bug in 860T (?) that cuts the last byte of input
- * if we're reading into DPRAM. The solution we choose here is
- * to always read len+1 bytes (we have one extra byte at the
- * end of the buffer).
- */
- spi_xfer(alen + len + 1);
- memcpy(buffer, alen + rxbuf, len);
-
- return len;
-}
-
-/****************************************************************************
- * Function: spi_xfer
- **************************************************************************** */
-ssize_t spi_xfer (size_t count)
-{
- volatile immap_t *immr;
- volatile cpm8xx_t *cp;
- volatile spi_t *spi;
- cbd_t *tbdf, *rbdf;
- ushort loop;
- int tm;
-
- DPRINT (("*** spi_xfer entered ***\n"));
-
- immr = (immap_t *) CFG_IMMR;
- cp = (cpm8xx_t *) &immr->im_cpm;
-
-#ifdef CFG_SPI_UCODE_PATCH
- spi = (spi_t *)&cp->cp_dpmem[spi->spi_rpbase];
-#else
- spi = (spi_t *)&cp->cp_dparam[PROFF_SPI];
- /* Disable relocation */
- spi->spi_rpbase = 0;
-#endif
-
- tbdf = (cbd_t *) & cp->cp_dpmem[spi->spi_tbase];
- rbdf = (cbd_t *) & cp->cp_dpmem[spi->spi_rbase];
-
- /* Set CS for device */
- cp->cp_pbdat &= ~0x0001;
-
- /* Setting tx bd status and data length */
- tbdf->cbd_sc = BD_SC_READY | BD_SC_LAST | BD_SC_WRAP;
- tbdf->cbd_datlen = count;
-
- DPRINT (("*** spi_xfer: Bytes to be xferred: %d ***\n",
- tbdf->cbd_datlen));
-
- /* Setting rx bd status and data length */
- rbdf->cbd_sc = BD_SC_EMPTY | BD_SC_WRAP;
- rbdf->cbd_datlen = 0; /* rx length has no significance */
-
- loop = cp->cp_spmode & SPMODE_LOOP;
- cp->cp_spmode = /*SPMODE_DIV16 |*/ /* BRG/16 mode not used here */
- loop |
- SPMODE_REV |
- SPMODE_MSTR |
- SPMODE_EN |
- SPMODE_LEN(8) | /* 8 Bits per char */
- SPMODE_PM(0x8) ; /* medium speed */
- cp->cp_spim = 0; /* Mask all SPI events */
- cp->cp_spie = SPI_EMASK; /* Clear all SPI events */
-
- /* start spi transfer */
- DPRINT (("*** spi_xfer: Performing transfer ...\n"));
- cp->cp_spcom |= SPI_STR; /* Start transmit */
-
- /* --------------------------------
- * Wait for SPI transmit to get out
- * or time out (1 second = 1000 ms)
- * -------------------------------- */
- for (tm=0; tm<1000; ++tm) {
- if (cp->cp_spie & SPI_TXB) { /* Tx Buffer Empty */
- DPRINT (("*** spi_xfer: Tx buffer empty\n"));
- break;
- }
- if ((tbdf->cbd_sc & BD_SC_READY) == 0) {
- DPRINT (("*** spi_xfer: Tx BD done\n"));
- break;
- }
- udelay (1000);
- }
- if (tm >= 1000) {
- printf ("*** spi_xfer: Time out while xferring to/from SPI!\n");
- }
- DPRINT (("*** spi_xfer: ... transfer ended\n"));
-
-#ifdef DEBUG
- printf ("\nspi_xfer: txbuf after xfer\n");
- memdump ((void *) txbuf, 16); /* dump of txbuf before transmit */
- printf ("spi_xfer: rxbuf after xfer\n");
- memdump ((void *) rxbuf, 16); /* dump of rxbuf after transmit */
- printf ("\n");
-#endif
-
- /* Clear CS for device */
- cp->cp_pbdat |= 0x0001;
-
- return count;
-}
-#endif /* CONFIG_SPI || (CONFIG_POST & CFG_POST_SPI) */
-
-/*
- * SPI test
- *
- * The Serial Peripheral Interface (SPI) is tested in the local loopback mode.
- * The interface is configured accordingly and several packets
- * are transfered. The configurable test parameters are:
- * TEST_MIN_LENGTH - minimum size of packet to transfer
- * TEST_MAX_LENGTH - maximum size of packet to transfer
- * TEST_NUM - number of tests
- */
-
-#if CONFIG_POST & CFG_POST_SPI
-
-#define TEST_MIN_LENGTH 1
-#define TEST_MAX_LENGTH MAX_BUFFER
-#define TEST_NUM 1
-
-static void packet_fill (char * packet, int length)
-{
- char c = (char) length;
- int i;
-
- for (i = 0; i < length; i++)
- {
- packet[i] = c++;
- }
-}
-
-static int packet_check (char * packet, int length)
-{
- char c = (char) length;
- int i;
-
- for (i = 0; i < length; i++) {
- if (packet[i] != c++) return -1;
- }
-
- return 0;
-}
-
-int spi_post_test (int flags)
-{
- int res = -1;
- volatile immap_t *immr = (immap_t *) CFG_IMMR;
- volatile cpm8xx_t *cp = (cpm8xx_t *) & immr->im_cpm;
- int i;
- int l;
-
- spi_init_f ();
- spi_init_r ();
-
- cp->cp_spmode |= SPMODE_LOOP;
-
- for (i = 0; i < TEST_NUM; i++) {
- for (l = TEST_MIN_LENGTH; l <= TEST_MAX_LENGTH; l += 8) {
- packet_fill ((char *)txbuf, l);
-
- spi_xfer (l);
-
- if (packet_check ((char *)rxbuf, l) < 0) {
- goto Done;
- }
- }
- }
-
- res = 0;
-
- Done:
-
- cp->cp_spmode &= ~SPMODE_LOOP;
-
- /*
- * SCC2 parameter RAM space overlaps
- * the SPI parameter RAM space. So we need to restore
- * the SCC2 configuration if it is used by UART.
- */
-
-#if !defined(CONFIG_8xx_CONS_NONE)
- serial_reinit_all ();
-#endif
-
- if (res != 0) {
- post_log ("SPI test failed\n");
- }
-
- return res;
-}
-#endif /* CONFIG_POST & CFG_POST_SPI */
diff --git a/cpu/mpc8xx/start.S b/cpu/mpc8xx/start.S
deleted file mode 100644
index 6fa0bc88ba..0000000000
--- a/cpu/mpc8xx/start.S
+++ /dev/null
@@ -1,700 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2000,2001,2002 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* U-Boot - Startup Code for PowerPC based Embedded Boards
- *
- *
- * The processor starts at 0x00000100 and the code is executed
- * from flash. The code is organized to be at an other address
- * in memory, but as long we don't jump around before relocating,
- * board_init lies at a quite high address and when the cpu has
- * jumped there, everything is ok.
- * This works because the cpu gives the FLASH (CS0) the whole
- * address space at startup, and board_init lies as a echo of
- * the flash somewhere up there in the memory map.
- *
- * board_init will change CS0 to be positioned at the correct
- * address and (s)dram will be positioned at address 0
- */
-#include <config.h>
-#include <mpc8xx.h>
-#include <version.h>
-
-#define CONFIG_8xx 1 /* needed for Linux kernel header files */
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-/* We don't want the MMU yet.
-*/
-#undef MSR_KERNEL
-#define MSR_KERNEL ( MSR_ME | MSR_RI ) /* Machine Check and Recoverable Interr. */
-
-/*
- * Set up GOT: Global Offset Table
- *
- * Use r14 to access the GOT
- */
- START_GOT
- GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_FIXUP_TABLE_)
-
- GOT_ENTRY(_start)
- GOT_ENTRY(_start_of_vectors)
- GOT_ENTRY(_end_of_vectors)
- GOT_ENTRY(transfer_to_handler)
-
- GOT_ENTRY(__init_end)
- GOT_ENTRY(_end)
- GOT_ENTRY(__bss_start)
- END_GOT
-
-/*
- * r3 - 1st arg to board_init(): IMMP pointer
- * r4 - 2nd arg to board_init(): boot flag
- */
- .text
- .long 0x27051956 /* U-Boot Magic Number */
- .globl version_string
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
-
- . = EXC_OFF_SYS_RESET
- .globl _start
-_start:
- lis r3, CFG_IMMR@h /* position IMMR */
- mtspr 638, r3
- li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
- b boot_cold
-
- . = EXC_OFF_SYS_RESET + 0x10
-
- .globl _start_warm
-_start_warm:
- li r21, BOOTFLAG_WARM /* Software reboot */
- b boot_warm
-
-boot_cold:
-boot_warm:
-
- /* Initialize machine status; enable machine check interrupt */
- /*----------------------------------------------------------------------*/
- li r3, MSR_KERNEL /* Set ME, RI flags */
- mtmsr r3
- mtspr SRR1, r3 /* Make SRR1 match MSR */
-
- mfspr r3, ICR /* clear Interrupt Cause Register */
-
- /* Initialize debug port registers */
- /*----------------------------------------------------------------------*/
- xor r0, r0, r0 /* Clear R0 */
- mtspr LCTRL1, r0 /* Initialize debug port regs */
- mtspr LCTRL2, r0
- mtspr COUNTA, r0
- mtspr COUNTB, r0
-
- /* Reset the caches */
- /*----------------------------------------------------------------------*/
-
- mfspr r3, IC_CST /* Clear error bits */
- mfspr r3, DC_CST
-
- lis r3, IDC_UNALL@h /* Unlock all */
- mtspr IC_CST, r3
- mtspr DC_CST, r3
-
- lis r3, IDC_INVALL@h /* Invalidate all */
- mtspr IC_CST, r3
- mtspr DC_CST, r3
-
- lis r3, IDC_DISABLE@h /* Disable data cache */
- mtspr DC_CST, r3
-
-#if !(defined(CONFIG_IP860) || defined(CONFIG_PCU_E) || defined (CONFIG_FLAGADM))
- /* On IP860 and PCU E,
- * we cannot enable IC yet
- */
- lis r3, IDC_ENABLE@h /* Enable instruction cache */
-#endif
- mtspr IC_CST, r3
-
- /* invalidate all tlb's */
- /*----------------------------------------------------------------------*/
-
- tlbia
- isync
-
- /*
- * Calculate absolute address in FLASH and jump there
- *----------------------------------------------------------------------*/
-
- lis r3, CFG_MONITOR_BASE@h
- ori r3, r3, CFG_MONITOR_BASE@l
- addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
- mtlr r3
- blr
-
-in_flash:
-
- /* initialize some SPRs that are hard to access from C */
- /*----------------------------------------------------------------------*/
-
- lis r3, CFG_IMMR@h /* pass IMMR as arg1 to C routine */
- ori r1, r3, CFG_INIT_SP_OFFSET /* set up the stack in internal DPRAM */
- /* Note: R0 is still 0 here */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
-
- /*
- * Disable serialized ifetch and show cycles
- * (i.e. set processor to normal mode).
- * This is also a silicon bug workaround, see errata
- */
-
- li r2, 0x0007
- mtspr ICTRL, r2
-
- /* Set up debug mode entry */
-
- lis r2, CFG_DER@h
- ori r2, r2, CFG_DER@l
- mtspr DER, r2
-
- /* let the C-code set up the rest */
- /* */
- /* Be careful to keep code relocatable ! */
- /*----------------------------------------------------------------------*/
-
- GET_GOT /* initialize GOT access */
-
- /* r3: IMMR */
- bl cpu_init_f /* run low-level CPU init code (from Flash) */
-
- mr r3, r21
- /* r3: BOOTFLAG */
- bl board_init_f /* run 1st part of board init code (from Flash) */
-
-
- .globl _start_of_vectors
-_start_of_vectors:
-
-/* Machine check */
- STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. "Never" generated on the 860. */
- STD_EXCEPTION(0x300, DataStorage, UnknownException)
-
-/* Instruction Storage exception. "Never" generated on the 860. */
- STD_EXCEPTION(0x400, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
- STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
-
-/* Alignment exception. */
- . = 0x600
-Alignment:
- EXCEPTION_PROLOG
- mfspr r4,DAR
- stw r4,_DAR(r21)
- mfspr r5,DSISR
- stw r5,_DSISR(r21)
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_Alignment:
- .long AlignmentException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
- . = 0x700
-ProgramCheck:
- EXCEPTION_PROLOG
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_ProgramCheck:
- .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
- /* No FPU on MPC8xx. This exception is not supposed to happen.
- */
- STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
-
- /* I guess we could implement decrementer, and may have
- * to someday for timekeeping.
- */
- STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
- STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
- STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
- STD_EXCEPTION(0xc00, SystemCall, UnknownException)
- STD_EXCEPTION(0xd00, SingleStep, UnknownException)
-
- STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
- STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
-
- /* On the MPC8xx, this is a software emulation interrupt. It occurs
- * for all unimplemented and illegal instructions.
- */
- STD_EXCEPTION(0x1000, SoftEmu, SoftEmuException)
-
- STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
- STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
- STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
- STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
-
- STD_EXCEPTION(0x1500, Reserved5, UnknownException)
- STD_EXCEPTION(0x1600, Reserved6, UnknownException)
- STD_EXCEPTION(0x1700, Reserved7, UnknownException)
- STD_EXCEPTION(0x1800, Reserved8, UnknownException)
- STD_EXCEPTION(0x1900, Reserved9, UnknownException)
- STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
- STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
-
- STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
- STD_EXCEPTION(0x1d00, InstructionBreakpoint, DebugException)
- STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
- STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
-
-
- .globl _end_of_vectors
-_end_of_vectors:
-
-
- . = 0x2000
-
-/*
- * This code finishes saving the registers to the exception frame
- * and jumps to the appropriate handler for the exception.
- * Register r21 is pointer into trap frame, r1 has new stack pointer.
- */
- .globl transfer_to_handler
-transfer_to_handler:
- stw r22,_NIP(r21)
- lis r22,MSR_POW@h
- andc r23,r23,r22
- stw r23,_MSR(r21)
- SAVE_GPR(7, r21)
- SAVE_4GPRS(8, r21)
- SAVE_8GPRS(12, r21)
- SAVE_8GPRS(24, r21)
- mflr r23
- andi. r24,r23,0x3f00 /* get vector offset */
- stw r24,TRAP(r21)
- li r22,0
- stw r22,RESULT(r21)
- mtspr SPRG2,r22 /* r1 is now kernel sp */
- lwz r24,0(r23) /* virtual address of handler */
- lwz r23,4(r23) /* where to go when done */
- mtspr SRR0,r24
- mtspr SRR1,r20
- mtlr r23
- SYNC
- rfi /* jump to handler, enable MMU */
-
-int_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr SRR0,r2
- mtspr SRR1,r0
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfi
-
-/* Cache functions.
-*/
- .globl icache_enable
-icache_enable:
- SYNC
- lis r3, IDC_INVALL@h
- mtspr IC_CST, r3
- lis r3, IDC_ENABLE@h
- mtspr IC_CST, r3
- blr
-
- .globl icache_disable
-icache_disable:
- SYNC
- lis r3, IDC_DISABLE@h
- mtspr IC_CST, r3
- blr
-
- .globl icache_status
-icache_status:
- mfspr r3, IC_CST
- srwi r3, r3, 31 /* >>31 => select bit 0 */
- blr
-
- .globl dcache_enable
-dcache_enable:
- lis r3, 0x0400 /* Set cache mode with MMU off */
- mtspr MD_CTR, r3
-
- lis r3, IDC_INVALL@h
- mtspr DC_CST, r3
- lis r3, IDC_ENABLE@h
- mtspr DC_CST, r3
- blr
-
- .globl dcache_disable
-dcache_disable:
- SYNC
- lis r3, IDC_DISABLE@h
- mtspr DC_CST, r3
- lis r3, IDC_INVALL@h
- mtspr DC_CST, r3
- blr
-
- .globl dcache_status
-dcache_status:
- mfspr r3, DC_CST
- srwi r3, r3, 31 /* >>31 => select bit 0 */
- blr
-
- .globl dc_read
-dc_read:
- mtspr DC_ADR, r3
- mfspr r3, DC_DAT
- blr
-
-/*
- * unsigned int get_immr (unsigned int mask)
- *
- * return (mask ? (IMMR & mask) : IMMR);
- */
- .globl get_immr
-get_immr:
- mr r4,r3 /* save mask */
- mfspr r3, IMMR /* IMMR */
- cmpwi 0,r4,0 /* mask != 0 ? */
- beq 4f
- and r3,r3,r4 /* IMMR & mask */
-4:
- blr
-
- .globl get_pvr
-get_pvr:
- mfspr r3, PVR
- blr
-
-
- .globl wr_ic_cst
-wr_ic_cst:
- mtspr IC_CST, r3
- blr
-
- .globl rd_ic_cst
-rd_ic_cst:
- mfspr r3, IC_CST
- blr
-
- .globl wr_ic_adr
-wr_ic_adr:
- mtspr IC_ADR, r3
- blr
-
-
- .globl wr_dc_cst
-wr_dc_cst:
- mtspr DC_CST, r3
- blr
-
- .globl rd_dc_cst
-rd_dc_cst:
- mfspr r3, DC_CST
- blr
-
- .globl wr_dc_adr
-wr_dc_adr:
- mtspr DC_ADR, r3
- blr
-
-/*------------------------------------------------------------------------------*/
-
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
- */
- .globl relocate_code
-relocate_code:
- mr r1, r3 /* Set new stack pointer */
- mr r9, r4 /* Save copy of Global Data pointer */
- mr r10, r5 /* Save copy of Destination Address */
-
- mr r3, r5 /* Destination Address */
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
- lwz r5, GOT(__init_end)
- sub r5, r5, r4
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
- *
- * Offset:
- */
- sub r15, r10, r4
-
- /* First our own GOT */
- add r14, r14, r15
- /* then the one used by the C code */
- add r30, r30, r15
-
- /*
- * Now relocate code
- */
-
- cmplw cr1,r3,r4
- addi r0,r5,3
- srwi. r0,r0,2
- beq cr1,4f /* In place copy is not necessary */
- beq 7f /* Protect against 0 count */
- mtctr r0
- bge cr1,2f
-
- la r8,-4(r4)
- la r7,-4(r3)
-1: lwzu r0,4(r8)
- stwu r0,4(r7)
- bdnz 1b
- b 4f
-
-2: slwi r0,r0,2
- add r8,r4,r0
- add r7,r3,r0
-3: lwzu r0,-4(r8)
- stwu r0,-4(r7)
- bdnz 3b
-
-/*
- * Now flush the cache: note that we must start from a cache aligned
- * address. Otherwise we might miss one cache line.
- */
-4: cmpwi r6,0
- add r5,r3,r5
- beq 7f /* Always flush prefetch queue in any case */
- subi r0,r6,1
- andc r3,r3,r0
- mr r4,r3
-5: dcbst 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 5b
- sync /* Wait for all dcbst to complete on bus */
- mr r4,r3
-6: icbi 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 6b
-7: sync /* Wait for all icbi to complete on bus */
- isync
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-
- addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
- mtlr r0
- blr
-
-in_ram:
-
- /*
- * Relocation Function, r14 point to got2+0x8000
- *
- * Adjust got2 pointers, no need to check for 0, this code
- * already puts a few entries in the table.
- */
- li r0,__got2_entries@sectoff@l
- la r3,GOT(_GOT2_TABLE_)
- lwz r11,GOT(_GOT2_TABLE_)
- mtctr r0
- sub r11,r3,r11
- addi r3,r3,-4
-1: lwzu r0,4(r3)
- add r0,r0,r11
- stw r0,0(r3)
- bdnz 1b
-
- /*
- * Now adjust the fixups and the pointers to the fixups
- * in case we need to move ourselves again.
- */
-2: li r0,__fixup_entries@sectoff@l
- lwz r3,GOT(_FIXUP_TABLE_)
- cmpwi r0,0
- mtctr r0
- addi r3,r3,-4
- beq 4f
-3: lwzu r4,4(r3)
- lwzux r0,r4,r11
- add r0,r0,r11
- stw r10,0(r3)
- stw r0,0(r4)
- bdnz 3b
-4:
-clear_bss:
- /*
- * Now clear BSS segment
- */
- lwz r3,GOT(__bss_start)
- lwz r4,GOT(_end)
-
- cmplw 0, r3, r4
- beq 6f
-
- li r0, 0
-5:
- stw r0, 0(r3)
- addi r3, r3, 4
- cmplw 0, r3, r4
- bne 5b
-6:
-
- mr r3, r9 /* Global Data pointer */
- mr r4, r10 /* Destination Address */
- bl board_init_r
-
- /*
- * Copy exception vector code to low memory
- *
- * r3: dest_addr
- * r7: source address, r8: end address, r9: target address
- */
- .globl trap_init
-trap_init:
- lwz r7, GOT(_start)
- lwz r8, GOT(_end_of_vectors)
-
- li r9, 0x100 /* reset vector always at 0x100 */
-
- cmplw 0, r7, r8
- bgelr /* return if r7>=r8 - just in case */
-
- mflr r4 /* save link register */
-1:
- lwz r0, 0(r7)
- stw r0, 0(r9)
- addi r7, r7, 4
- addi r9, r9, 4
- cmplw 0, r7, r8
- bne 1b
-
- /*
- * relocate `hdlr' and `int_return' entries
- */
- li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
- li r8, Alignment - _start + EXC_OFF_SYS_RESET
-2:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 2b
-
- li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
- li r8, SystemCall - _start + EXC_OFF_SYS_RESET
-3:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 3b
-
- li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
- li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-4:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 4b
-
- mtlr r4 /* restore link register */
- blr
-
- /*
- * Function: relocate entries for one exception vector
- */
-trap_reloc:
- lwz r0, 0(r7) /* hdlr ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 0(r7)
-
- lwz r0, 4(r7) /* int_return ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 4(r7)
-
- sync
- isync
-
- blr
diff --git a/cpu/mpc8xx/traps.c b/cpu/mpc8xx/traps.c
deleted file mode 100644
index 249e1837bf..0000000000
--- a/cpu/mpc8xx/traps.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * linux/arch/ppc/kernel/traps.c
- *
- * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- * Modified by Cort Dougan (cort@cs.nmt.edu)
- * and Paul Mackerras (paulus@cs.anu.edu.au)
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * This file handles the architecture-dependent parts of hardware exceptions
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/processor.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
-extern void do_bedbug_breakpoint(struct pt_regs *);
-#endif
-
-/* Returns 0 if exception not found and fixup otherwise. */
-extern unsigned long search_exception_table(unsigned long);
-
-/* THIS NEEDS CHANGING to use the board info structure.
-*/
-#define END_OF_MEM 0x02000000
-
-/*
- * Trap & Exception support
- */
-
-void
-print_backtrace(unsigned long *sp)
-{
- int cnt = 0;
- unsigned long i;
-
- printf("Call backtrace: ");
- while (sp) {
- if ((uint)sp > END_OF_MEM)
- break;
-
- i = sp[1];
- if (cnt++ % 7 == 0)
- printf("\n");
- printf("%08lX ", i);
- if (cnt > 32) break;
- sp = (unsigned long *)*sp;
- }
- printf("\n");
-}
-
-void show_regs(struct pt_regs * regs)
-{
- int i;
-
- printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
- regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
- printf("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
- regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
- regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
- regs->msr&MSR_IR ? 1 : 0,
- regs->msr&MSR_DR ? 1 : 0);
-
- printf("\n");
- for (i = 0; i < 32; i++) {
- if ((i % 8) == 0)
- {
- printf("GPR%02d: ", i);
- }
-
- printf("%08lX ", regs->gpr[i]);
- if ((i % 8) == 7)
- {
- printf("\n");
- }
- }
-}
-
-
-void
-_exception(int signr, struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
-}
-
-void
-MachineCheckException(struct pt_regs *regs)
-{
- unsigned long fixup;
-
- /* Probing PCI using config cycles cause this exception
- * when a device is not present. Catch it and return to
- * the PCI exception handler.
- */
- if ((fixup = search_exception_table(regs->nip)) != 0) {
- regs->nip = fixup;
- return;
- }
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- printf("Machine check in kernel mode.\n");
- printf("Caused by (from msr): ");
- printf("regs %p ",regs);
- switch( regs->msr & 0x000F0000) {
- case (0x80000000>>12):
- printf("Machine check signal - probably due to mm fault\n"
- "with mmu off\n");
- break;
- case (0x80000000>>13):
- printf("Transfer error ack signal\n");
- break;
- case (0x80000000>>14):
- printf("Data parity signal\n");
- break;
- case (0x80000000>>15):
- printf("Address parity signal\n");
- break;
- default:
- printf("Unknown values in msr\n");
- }
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("machine check");
-}
-
-void
-AlignmentException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Alignment Exception");
-}
-
-void
-ProgramCheckException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Program Check Exception");
-}
-
-void
-SoftEmuException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Software Emulation Exception");
-}
-
-
-void
-UnknownException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
- printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
- regs->nip, regs->msr, regs->trap);
- _exception(0, regs);
-}
-
-void
-DebugException(struct pt_regs *regs)
-{
- printf("Debugger trap at @ %lx\n", regs->nip );
- show_regs(regs);
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
- do_bedbug_breakpoint( regs );
-#endif
-}
-
-/* Probe an address by reading. If not present, return -1, otherwise
- * return 0.
- */
-int
-addr_probe(uint *addr)
-{
- return 0;
-}
diff --git a/cpu/mpc8xx/upatch.c b/cpu/mpc8xx/upatch.c
deleted file mode 100644
index eccff645e3..0000000000
--- a/cpu/mpc8xx/upatch.c
+++ /dev/null
@@ -1,102 +0,0 @@
-#include <common.h>
-#include <commproc.h>
-
-#if defined(CFG_I2C_UCODE_PATCH) || defined(CFG_SPI_UCODE_PATCH)
-
-static void UcodeCopy (volatile cpm8xx_t *cpm);
-
-void cpm_load_patch (volatile immap_t *immr)
-{
- immr->im_cpm.cp_rccr &= ~0x0003; /* Disable microcode program area */
-
- UcodeCopy ((cpm8xx_t *)&immr->im_cpm); /* Copy ucode patch to DPRAM */
-#ifdef CFG_SPI_UCODE_PATCH
- {
- volatile spi_t *spi = (spi_t *) & immr->im_cpm.cp_dparam[PROFF_SPI];
- /* Activate the microcode per the instructions in the microcode manual */
- /* NOTE: We're only relocating the SPI parameters (not I2C). */
- immr->im_cpm.cp_cpmcr1 = 0x802a; /* Write Trap register 1 value */
- immr->im_cpm.cp_cpmcr2 = 0x8028; /* Write Trap register 2 value */
- spi->spi_rpbase = CFG_SPI_DPMEM_OFFSET; /* Where to relocte SPI params */
- }
-#endif
-
-#ifdef CFG_I2C_UCODE_PATCH
- {
- volatile iic_t *iip = (iic_t *) & immr->im_cpm.cp_dparam[PROFF_IIC];
- /* Activate the microcode per the instructions in the microcode manual */
- /* NOTE: We're only relocating the I2C parameters (not SPI). */
- immr->im_cpm.cp_cpmcr3 = 0x802e; /* Write Trap register 3 value */
- immr->im_cpm.cp_cpmcr4 = 0x802c; /* Write Trap register 4 value */
- iip->iic_rpbase = CFG_I2C_DPMEM_OFFSET; /* Where to relocte I2C params */
- }
-#endif
-
- /*
- * Enable DPRAM microcode to execute from the first 512 bytes
- * and a 256 byte extension of DPRAM.
- */
- immr->im_cpm.cp_rccr |= 0x0001;
-}
-
-static ulong patch_2000[] = {
- 0x7FFFEFD9, 0x3FFD0000, 0x7FFB49F7, 0x7FF90000,
- 0x5FEFADF7, 0x5F88ADF7, 0x5FEFAFF7, 0x5F88AFF7,
- 0x3A9CFBC8, 0x77CAE1BB, 0xF4DE7FAD, 0xABAE9330,
- 0x4E08FDCF, 0x6E0FAFF8, 0x7CCF76CF, 0xFDAFF9CF,
- 0xABF88DC8, 0xAB5879F7, 0xB0927383, 0xDFD079F7,
- 0xB090E6BB, 0xE5BBE74F, 0xB3FA6F0F, 0x6FFB76CE,
- 0xEE0CF9CF, 0x2BFBEFEF, 0xCFEEF9CF, 0x76CEAD23,
- 0x90B3DF99, 0x7FDDD0C1, 0x4BF847FD, 0x7CCF76CE,
- 0xCFEF77CA, 0x7EAF7FAD, 0x7DFDF0B7, 0xEF7A7FCA,
- 0x77CAFBC8, 0x6079E722, 0xFBC85FFF, 0xDFFF5FB3,
- 0xFFFBFBC8, 0xF3C894A5, 0xE7C9EDF9, 0x7F9A7FAD,
- 0x5F36AFE8, 0x5F5BFFDF, 0xDF95CB9E, 0xAF7D5FC3,
- 0xAFED8C1B, 0x5FC3AFDD, 0x5FC5DF99, 0x7EFDB0B3,
- 0x5FB3FFFE, 0xABAE5FB3, 0xFFFE5FD0, 0x600BE6BB,
- 0x600B5FD0, 0xDFC827FB, 0xEFDF5FCA, 0xCFDE3A9C,
- 0xE7C9EDF9, 0xF3C87F9E, 0x54CA7FED, 0x2D3A3637,
- 0x756F7E9A, 0xF1CE37EF, 0x2E677FEE, 0x10EBADF8,
- 0xEFDECFEA, 0xE52F7D9F, 0xE12BF1CE, 0x5F647E9A,
- 0x4DF8CFEA, 0x5F717D9B, 0xEFEECFEA, 0x5F73E522,
- 0xEFDE5F73, 0xCFDA0B61, 0x7385DF61, 0xE7C9EDF9,
- 0x7E9A30D5, 0x1458BFFF, 0xF3C85FFF, 0xDFFFA7F8,
- 0x5F5BBFFE, 0x7F7D10D0, 0x144D5F33, 0xBFFFAF78,
- 0x5F5BBFFD, 0xA7F85F33, 0xBFFE77FD, 0x30BD4E08,
- 0xFDCFE5FF, 0x6E0FAFF8, 0x7EEF7E9F, 0xFDEFF1CF,
- 0x5F17ABF8, 0x0D5B5F5B, 0xFFEF79F7, 0x309EAFDD,
- 0x5F3147F8, 0x5F31AFED, 0x7FDD50AF, 0x497847FD,
- 0x7F9E7FED, 0x7DFD70A9, 0xEF7E7ECE, 0x6BA07F9E,
- 0x2D227EFD, 0x30DB5F5B, 0xFFFD5F5B, 0xFFEF5F5B,
- 0xFFDF0C9C, 0xAFED0A9A, 0xAFDD0C37, 0x5F37AFBD,
- 0x7FBDB081, 0x5F8147F8,
-};
-
-static ulong patch_2F00[] = {
- 0x3E303430, 0x34343737, 0xABBF9B99, 0x4B4FBDBD,
- 0x59949334, 0x9FFF37FB, 0x9B177DD9, 0x936956BB,
- 0xFBDD697B, 0xDD2FD113, 0x1DB9F7BB, 0x36313963,
- 0x79373369, 0x3193137F, 0x7331737A, 0xF7BB9B99,
- 0x9BB19795, 0x77FDFD3D, 0x573B773F, 0x737933F7,
- 0xB991D115, 0x31699315, 0x31531694, 0xBF4FBDBD,
- 0x35931497, 0x35376956, 0xBD697B9D, 0x96931313,
- 0x19797937, 0x69350000,
-};
-
-static void UcodeCopy (volatile cpm8xx_t *cpm)
-{
- vu_long *p;
- int i;
-
- p = (vu_long *)&(cpm->cp_dpmem[0x0000]);
- for (i=0; i < sizeof(patch_2000)/4; ++i) {
- p[i] = patch_2000[i];
- }
-
- p = (vu_long *)&(cpm->cp_dpmem[0x0F00]);
- for (i=0; i < sizeof(patch_2F00)/4; ++i) {
- p[i] = patch_2F00[i];
- }
-}
-
-#endif /* CFG_I2C_UCODE_PATCH, CFG_SPI_UCODE_PATCH */
diff --git a/cpu/mpc8xx/video.c b/cpu/mpc8xx/video.c
deleted file mode 100644
index bbc2ae767a..0000000000
--- a/cpu/mpc8xx/video.c
+++ /dev/null
@@ -1,1319 +0,0 @@
-/*
- * (C) Copyright 2000
- * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
- * (C) Copyright 2002
- * Wolfgang Denk, wd@denx.de
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/* #define DEBUG */
-
-/************************************************************************/
-/* ** HEADER FILES */
-/************************************************************************/
-
-#include <stdarg.h>
-#include <common.h>
-#include <config.h>
-#include <version.h>
-#include <i2c.h>
-#include <linux/types.h>
-#include <devices.h>
-
-#ifdef CONFIG_VIDEO
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/************************************************************************/
-/* ** DEBUG SETTINGS */
-/************************************************************************/
-
-
-/************************************************************************/
-/* ** VIDEO MODE SETTINGS */
-/************************************************************************/
-
-
-#define VIDEO_MODE_PAL
-
-
-#define VIDEO_INFO /* Show U-Boot information */
-#define VIDEO_INFO_X VIDEO_LOGO_WIDTH+8
-#define VIDEO_INFO_Y 16
-
-/************************************************************************/
-/* ** VIDEO ENCODER CONSTANTS */
-/************************************************************************/
-
-#ifdef CONFIG_VIDEO_ENCODER_AD7176
-
-#include <video_ad7176.h> /* Sets encoder data, mode, and visible and active area */
-
-#define VIDEO_I2C 1
-#define VIDEO_I2C_ADDR CONFIG_VIDEO_ENCODER_AD7176_ADDR
-#endif
-
-#ifdef CONFIG_VIDEO_ENCODER_AD7177
-
-#include <video_ad7177.h> /* Sets encoder data, mode, and visible and active area */
-
-#define VIDEO_I2C 1
-#define VIDEO_I2C_ADDR CONFIG_VIDEO_ENCODER_AD7177_ADDR
-#endif
-
-#ifdef CONFIG_VIDEO_ENCODER_AD7179
-
-#include <video_ad7179.h> /* Sets encoder data, mode, and visible and active area */
-
-#define VIDEO_I2C 1
-#define VIDEO_I2C_ADDR CONFIG_VIDEO_ENCODER_AD7179_ADDR
-#endif
-
-/************************************************************************/
-/* ** VIDEO MODE CONSTANTS */
-/************************************************************************/
-
-#ifdef VIDEO_MODE_EXTENDED
-#define VIDEO_COLS VIDEO_ACTIVE_COLS
-#define VIDEO_ROWS VIDEO_ACTIVE_ROWS
-#else
-#define VIDEO_COLS VIDEO_VISIBLE_COLS
-#define VIDEO_ROWS VIDEO_VISIBLE_ROWS
-#endif
-
-#define VIDEO_PIXEL_SIZE (VIDEO_MODE_BPP/8)
-#define VIDEO_SIZE (VIDEO_ROWS*VIDEO_COLS*VIDEO_PIXEL_SIZE) /* Total size of buffer */
-#define VIDEO_PIX_BLOCKS (VIDEO_SIZE >> 2) /* Number of ints */
-#define VIDEO_LINE_LEN (VIDEO_COLS*VIDEO_PIXEL_SIZE) /* Number of bytes per line */
-#define VIDEO_BURST_LEN (VIDEO_COLS/8)
-
-#ifdef VIDEO_MODE_YUYV
-#define VIDEO_BG_COL 0x80D880D8 /* Background color in YUYV format */
-#else
-#define VIDEO_BG_COL 0xF8F8F8F8 /* Background color in RGB format */
-#endif
-
-/************************************************************************/
-/* ** FONT AND LOGO DATA */
-/************************************************************************/
-
-#include <video_font.h> /* Get font data, width and height */
-
-#ifdef CONFIG_VIDEO_LOGO
-#include <video_logo.h> /* Get logo data, width and height */
-
-#define VIDEO_LOGO_WIDTH DEF_U_BOOT_LOGO_WIDTH
-#define VIDEO_LOGO_HEIGHT DEF_U_BOOT_LOGO_HEIGHT
-#define VIDEO_LOGO_ADDR &u_boot_logo
-#endif
-
-/************************************************************************/
-/* ** VIDEO CONTROLLER CONSTANTS */
-/************************************************************************/
-
-/* VCCR - VIDEO CONTROLLER CONFIGURATION REGISTER */
-
-#define VIDEO_VCCR_VON 0 /* Video controller ON */
-#define VIDEO_VCCR_CSRC 1 /* Clock source */
-#define VIDEO_VCCR_PDF 13 /* Pixel display format */
-#define VIDEO_VCCR_IEN 11 /* Interrupt enable */
-
-/* VSR - VIDEO STATUS REGISTER */
-
-#define VIDEO_VSR_CAS 6 /* Active set */
-#define VIDEO_VSR_EOF 0 /* End of frame */
-
-/* VCMR - VIDEO COMMAND REGISTER */
-
-#define VIDEO_VCMR_BD 0 /* Blank display */
-#define VIDEO_VCMR_ASEL 1 /* Active set selection */
-
-/* VBCB - VIDEO BACKGROUND COLOR BUFFER REGISTER */
-
-#define VIDEO_BCSR4_RESET_BIT 21 /* BCSR4 - Extern video encoder reset */
-#define VIDEO_BCSR4_EXTCLK_BIT 22 /* BCSR4 - Extern clock enable */
-#define VIDEO_BCSR4_VIDLED_BIT 23 /* BCSR4 - Video led disable */
-
-/************************************************************************/
-/* ** CONSOLE CONSTANTS */
-/************************************************************************/
-
-#ifdef CONFIG_VIDEO_LOGO
-#define CONSOLE_ROWS ((VIDEO_ROWS - VIDEO_LOGO_HEIGHT) / VIDEO_FONT_HEIGHT)
-#define VIDEO_LOGO_SKIP (VIDEO_COLS - VIDEO_LOGO_WIDTH)
-#else
-#define CONSOLE_ROWS (VIDEO_ROWS / VIDEO_FONT_HEIGHT)
-#endif
-
-#define CONSOLE_COLS (VIDEO_COLS / VIDEO_FONT_WIDTH)
-#define CONSOLE_ROW_SIZE (VIDEO_FONT_HEIGHT * VIDEO_LINE_LEN)
-#define CONSOLE_ROW_FIRST (video_console_address)
-#define CONSOLE_ROW_SECOND (video_console_address + CONSOLE_ROW_SIZE)
-#define CONSOLE_ROW_LAST (video_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE)
-#define CONSOLE_SIZE (CONSOLE_ROW_SIZE * CONSOLE_ROWS)
-#define CONSOLE_SCROLL_SIZE (CONSOLE_SIZE - CONSOLE_ROW_SIZE)
-
-/*
- * Simple color definitions
- */
-#define CONSOLE_COLOR_BLACK 0
-#define CONSOLE_COLOR_RED 1
-#define CONSOLE_COLOR_GREEN 2
-#define CONSOLE_COLOR_YELLOW 3
-#define CONSOLE_COLOR_BLUE 4
-#define CONSOLE_COLOR_MAGENTA 5
-#define CONSOLE_COLOR_CYAN 6
-#define CONSOLE_COLOR_GREY 13
-#define CONSOLE_COLOR_GREY2 14
-#define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */
-
-/************************************************************************/
-/* ** BITOPS MACROS */
-/************************************************************************/
-
-#define HISHORT(i) ((i >> 16)&0xffff)
-#define LOSHORT(i) (i & 0xffff)
-#define HICHAR(s) ((i >> 8)&0xff)
-#define LOCHAR(s) (i & 0xff)
-#define HI(c) ((c >> 4)&0xf)
-#define LO(c) (c & 0xf)
-#define SWAPINT(i) (HISHORT(i) | (LOSHORT(i) << 16))
-#define SWAPSHORT(s) (HICHAR(s) | (LOCHAR(s) << 8))
-#define SWAPCHAR(c) (HI(c) | (LO(c) << 4))
-#define BITMASK(b) (1 << (b))
-#define GETBIT(v,b) (((v) & BITMASK(b)) > 0)
-#define SETBIT(v,b,d) (v = (((d)>0) ? (v) | BITMASK(b): (v) & ~BITMASK(b)))
-
-/************************************************************************/
-/* ** STRUCTURES */
-/************************************************************************/
-
-typedef struct {
- unsigned char V, Y1, U, Y2;
-} tYUYV;
-
-/* This structure is based on the Video Ram in the MPC823. */
-typedef struct VRAM {
- unsigned hx:2, /* Horizontal sync */
- vx:2, /* Vertical sync */
- fx:2, /* Frame */
- bx:2, /* Blank */
- res1:6, /* Reserved */
- vds:2, /* Video Data Select */
- inter:1, /* Interrupt */
- res2:2, /* Reserved */
- lcyc:11, /* Loop/video cycles */
- lp:1, /* Loop start/end */
- lst:1; /* Last entry */
-} VRAM;
-
-/************************************************************************/
-/* ** VARIABLES */
-/************************************************************************/
-
-static int
- video_panning_range_x = 0, /* Video mode invisible pixels x range */
- video_panning_range_y = 0, /* Video mode invisible pixels y range */
- video_panning_value_x = 0, /* Video mode x panning value (absolute) */
- video_panning_value_y = 0, /* Video mode y panning value (absolute) */
- video_panning_factor_x = 0, /* Video mode x panning value (-127 +127) */
- video_panning_factor_y = 0, /* Video mode y panning value (-127 +127) */
- console_col = 0, /* Cursor col */
- console_row = 0, /* Cursor row */
- video_palette[16]; /* Our palette */
-
-static const int video_font_draw_table[] =
- { 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff };
-
-static char
- video_color_fg = 0, /* Current fg color index (0-15) */
- video_color_bg = 0, /* Current bg color index (0-15) */
- video_enable = 0; /* Video has been initialized? */
-
-static void
- *video_fb_address, /* Frame buffer address */
- *video_console_address; /* Console frame buffer start address */
-
-/************************************************************************/
-/* ** MEMORY FUNCTIONS (32bit) */
-/************************************************************************/
-
-static void memsetl (int *p, int c, int v)
-{
- while (c--)
- *(p++) = v;
-}
-
-static void memcpyl (int *d, int *s, int c)
-{
- while (c--)
- *(d++) = *(s++);
-}
-
-/************************************************************************/
-/* ** VIDEO DRAWING AND COLOR FUNCTIONS */
-/************************************************************************/
-
-static int video_maprgb (int r, int g, int b)
-{
-#ifdef VIDEO_MODE_YUYV
- unsigned int pR, pG, pB;
- tYUYV YUYV;
- unsigned int *ret = (unsigned int *) &YUYV;
-
- /* Transform (0-255) components to (0-100) */
-
- pR = r * 100 / 255;
- pG = g * 100 / 255;
- pB = b * 100 / 255;
-
- /* Calculate YUV values (0-255) from RGB beetween 0-100 */
-
- YUYV.Y1 = YUYV.Y2 = 209 * (pR + pG + pB) / 300 + 16;
- YUYV.U = pR - (pG * 3 / 4) - (pB / 4) + 128;
- YUYV.V = pB - (pR / 4) - (pG * 3 / 4) + 128;
- return *ret;
-#endif
-#ifdef VIDEO_MODE_RGB
- return ((r >> 3) << 11) | ((g > 2) << 6) | (b >> 3);
-#endif
-}
-
-static void video_setpalette (int color, int r, int g, int b)
-{
- color &= 0xf;
-
- video_palette[color] = video_maprgb (r, g, b);
-
- /* Swap values if our panning offset is odd */
- if (video_panning_value_x & 1)
- video_palette[color] = SWAPINT (video_palette[color]);
-}
-
-static void video_fill (int color)
-{
- memsetl (video_fb_address, VIDEO_PIX_BLOCKS, color);
-}
-
-static void video_setfgcolor (int i)
-{
- video_color_fg = i & 0xf;
-}
-
-static void video_setbgcolor (int i)
-{
- video_color_bg = i & 0xf;
-}
-
-static int video_pickcolor (int i)
-{
- return video_palette[i & 0xf];
-}
-
-/* Absolute console plotting functions */
-
-#ifdef VIDEO_BLINK
-static void video_revchar (int xx, int yy)
-{
- int rows;
- u8 *dest;
-
- dest = video_fb_address + yy * VIDEO_LINE_LEN + xx * 2;
-
- for (rows = VIDEO_FONT_HEIGHT; rows--; dest += VIDEO_LINE_LEN) {
- switch (VIDEO_FONT_WIDTH) {
- case 16:
- ((u32 *) dest)[6] ^= 0xffffffff;
- ((u32 *) dest)[7] ^= 0xffffffff;
- /* FALL THROUGH */
- case 12:
- ((u32 *) dest)[4] ^= 0xffffffff;
- ((u32 *) dest)[5] ^= 0xffffffff;
- /* FALL THROUGH */
- case 8:
- ((u32 *) dest)[2] ^= 0xffffffff;
- ((u32 *) dest)[3] ^= 0xffffffff;
- /* FALL THROUGH */
- case 4:
- ((u32 *) dest)[0] ^= 0xffffffff;
- ((u32 *) dest)[1] ^= 0xffffffff;
- }
- }
-}
-#endif
-
-static void video_drawchars (int xx, int yy, unsigned char *s, int count)
-{
- u8 *cdat, *dest, *dest0;
- int rows, offset, c;
- u32 eorx, fgx, bgx;
-
- offset = yy * VIDEO_LINE_LEN + xx * 2;
- dest0 = video_fb_address + offset;
-
- fgx = video_pickcolor (video_color_fg);
- bgx = video_pickcolor (video_color_bg);
-
- if (xx & 1) {
- fgx = SWAPINT (fgx);
- bgx = SWAPINT (bgx);
- }
-
- eorx = fgx ^ bgx;
-
- switch (VIDEO_FONT_WIDTH) {
- case 4:
- case 8:
- while (count--) {
- c = *s;
- cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
- for (rows = VIDEO_FONT_HEIGHT, dest = dest0;
- rows--;
- dest += VIDEO_LINE_LEN) {
- u8 bits = *cdat++;
-
- ((u32 *) dest)[0] =
- (video_font_draw_table[bits >> 6] & eorx) ^ bgx;
- ((u32 *) dest)[1] =
- (video_font_draw_table[bits >> 4 & 3] & eorx) ^ bgx;
- if (VIDEO_FONT_WIDTH == 8) {
- ((u32 *) dest)[2] =
- (video_font_draw_table[bits >> 2 & 3] & eorx) ^ bgx;
- ((u32 *) dest)[3] =
- (video_font_draw_table[bits & 3] & eorx) ^ bgx;
- }
- }
- dest0 += VIDEO_FONT_WIDTH * 2;
- s++;
- }
- break;
- case 12:
- case 16:
- while (count--) {
- cdat = video_fontdata + (*s) * (VIDEO_FONT_HEIGHT << 1);
- for (rows = VIDEO_FONT_HEIGHT, dest = dest0; rows--;
- dest += VIDEO_LINE_LEN) {
- u8 bits = *cdat++;
-
- ((u32 *) dest)[0] =
- (video_font_draw_table[bits >> 6] & eorx) ^ bgx;
- ((u32 *) dest)[1] =
- (video_font_draw_table[bits >> 4 & 3] & eorx) ^ bgx;
- ((u32 *) dest)[2] =
- (video_font_draw_table[bits >> 2 & 3] & eorx) ^ bgx;
- ((u32 *) dest)[3] =
- (video_font_draw_table[bits & 3] & eorx) ^ bgx;
- bits = *cdat++;
- ((u32 *) dest)[4] =
- (video_font_draw_table[bits >> 6] & eorx) ^ bgx;
- ((u32 *) dest)[5] =
- (video_font_draw_table[bits >> 4 & 3] & eorx) ^ bgx;
- if (VIDEO_FONT_WIDTH == 16) {
- ((u32 *) dest)[6] =
- (video_font_draw_table[bits >> 2 & 3] & eorx) ^ bgx;
- ((u32 *) dest)[7] =
- (video_font_draw_table[bits & 3] & eorx) ^ bgx;
- }
- }
- s++;
- dest0 += VIDEO_FONT_WIDTH * 2;
- }
- break;
- }
-}
-
-static inline void video_drawstring (int xx, int yy, char *s)
-{
- video_drawchars (xx, yy, (unsigned char *)s, strlen (s));
-}
-
-/* Relative to console plotting functions */
-
-static void video_putchars (int xx, int yy, unsigned char *s, int count)
-{
-#ifdef CONFIG_VIDEO_LOGO
- video_drawchars (xx, yy + VIDEO_LOGO_HEIGHT, s, count);
-#else
- video_drawchars (xx, yy, s, count);
-#endif
-}
-
-static void video_putchar (int xx, int yy, unsigned char c)
-{
-#ifdef CONFIG_VIDEO_LOGO
- video_drawchars (xx, yy + VIDEO_LOGO_HEIGHT, &c, 1);
-#else
- video_drawchars (xx, yy, &c, 1);
-#endif
-}
-
-static inline void video_putstring (int xx, int yy, unsigned char *s)
-{
- video_putchars (xx, yy, (unsigned char *)s, strlen ((char *)s));
-}
-
-/************************************************************************/
-/* ** VIDEO CONTROLLER LOW-LEVEL FUNCTIONS */
-/************************************************************************/
-
-#if !defined(CONFIG_RRVISION)
-static void video_mode_dupefield (VRAM * source, VRAM * dest, int entries)
-{
- int i;
-
- for (i = 0; i < entries; i++) {
- dest[i] = source[i]; /* Copy the entire record */
- dest[i].fx = (!dest[i].fx) * 3; /* Negate field bit */
- }
-
- dest[0].lcyc++; /* Add a cycle to the first entry */
- dest[entries - 1].lst = 1; /* Set end of ram entries */
-}
-#endif
-
-static void inline video_mode_addentry (VRAM * vr,
- int Hx, int Vx, int Fx, int Bx,
- int VDS, int INT, int LCYC, int LP, int LST)
-{
- vr->hx = Hx;
- vr->vx = Vx;
- vr->fx = Fx;
- vr->bx = Bx;
- vr->vds = VDS;
- vr->inter = INT;
- vr->lcyc = LCYC;
- vr->lp = LP;
- vr->lst = LST;
-}
-
-#define ADDENTRY(a,b,c,d,e,f,g,h,i) video_mode_addentry(&vr[entry++],a,b,c,d,e,f,g,h,i)
-
-static int video_mode_generate (void)
-{
- immap_t *immap = (immap_t *) CFG_IMMR;
- VRAM *vr = (VRAM *) (((void *) immap) + 0xb00); /* Pointer to the VRAM table */
- int DX, X1, X2, DY, Y1, Y2, entry = 0, fifo;
-
- /* CHECKING PARAMETERS */
-
- if (video_panning_factor_y < -128)
- video_panning_factor_y = -128;
-
- if (video_panning_factor_y > 128)
- video_panning_factor_y = 128;
-
- if (video_panning_factor_x < -128)
- video_panning_factor_x = -128;
-
- if (video_panning_factor_x > 128)
- video_panning_factor_x = 128;
-
- /* Setting panning */
-
- DX = video_panning_range_x = (VIDEO_ACTIVE_COLS - VIDEO_COLS) * 2;
- DY = video_panning_range_y = (VIDEO_ACTIVE_ROWS - VIDEO_ROWS) / 2;
-
- video_panning_value_x = (video_panning_factor_x + 128) * DX / 256;
- video_panning_value_y = (video_panning_factor_y + 128) * DY / 256;
-
- /* We assume these are burst units (multiplied by 2, we need it pari) */
- X1 = video_panning_value_x & 0xfffe;
- X2 = DX - X1;
-
- /* We assume these are field line units (divided by 2, we need it pari) */
- Y1 = video_panning_value_y & 0xfffe;
- Y2 = DY - Y1;
-
- debug("X1=%d, X2=%d, Y1=%d, Y2=%d, DX=%d, DY=%d VIDEO_COLS=%d \n",
- X1, X2, Y1, Y2, DX, DY, VIDEO_COLS);
-
-#ifdef VIDEO_MODE_NTSC
-/*
- * Hx Vx Fx Bx VDS INT LCYC LP LST
- *
- * Retrace blanking
- */
- ADDENTRY (0, 0, 3, 0, 1, 0, 3, 1, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 243, 0, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 1440, 0, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 32, 1, 0);
-/*
- * Vertical blanking
- */
- ADDENTRY (0, 0, 0, 0, 1, 0, 18, 1, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 243, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 1440, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 32, 1, 0);
-/*
- * Odd field active area (TOP)
- */
- if (Y1 > 0) {
- ADDENTRY (0, 0, 0, 0, 1, 0, Y1, 1, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 235, 0, 0);
- ADDENTRY (3, 0, 0, 3, 1, 0, 1448, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 32, 1, 0);
- }
-/*
- * Odd field active area
- */
- ADDENTRY (0, 0, 0, 0, 1, 0, 240 - DY, 1, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 235, 0, 0);
- ADDENTRY (3, 0, 0, 3, 1, 0, 8 + X1, 0, 0);
- ADDENTRY (3, 0, 0, 3, 0, 0, VIDEO_COLS * 2, 0, 0);
-
- if (X2 > 0)
- ADDENTRY (3, 0, 0, 3, 1, 0, X2, 0, 0);
-
- ADDENTRY (3, 0, 0, 0, 1, 0, 32, 1, 0);
-
-/*
- * Odd field active area (BOTTOM)
- */
- if (Y1 > 0) {
- ADDENTRY (0, 0, 0, 0, 1, 0, Y2, 1, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 235, 0, 0);
- ADDENTRY (3, 0, 0, 3, 1, 0, 1448, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 32, 1, 0);
- }
-/*
- * Vertical blanking
- */
- ADDENTRY (0, 0, 0, 0, 1, 0, 4, 1, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 243, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 1440, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 32, 1, 0);
-/*
- * Vertical blanking
- */
- ADDENTRY (0, 0, 3, 0, 1, 0, 19, 1, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 243, 0, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 1440, 0, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 32, 1, 0);
-/*
- * Even field active area (TOP)
- */
- if (Y1 > 0) {
- ADDENTRY (0, 0, 3, 0, 1, 0, Y1, 1, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 235, 0, 0);
- ADDENTRY (3, 0, 3, 3, 1, 0, 1448, 0, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 32, 1, 0);
- }
-/*
- * Even field active area (CENTER)
- */
- ADDENTRY (0, 0, 3, 0, 1, 0, 240 - DY, 1, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 235, 0, 0);
- ADDENTRY (3, 0, 3, 3, 1, 0, 8 + X1, 0, 0);
- ADDENTRY (3, 0, 3, 3, 0, 0, VIDEO_COLS * 2, 0, 0);
-
- if (X2 > 0)
- ADDENTRY (3, 0, 3, 3, 1, 0, X2, 0, 0);
-
- ADDENTRY (3, 0, 3, 0, 1, 0, 32, 1, 0);
-/*
- * Even field active area (BOTTOM)
- */
- if (Y1 > 0) {
- ADDENTRY (0, 0, 3, 0, 1, 0, Y2, 1, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 235, 0, 0);
- ADDENTRY (3, 0, 3, 3, 1, 0, 1448, 0, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 32, 1, 0);
- }
-/*
- * Vertical blanking
- */
- ADDENTRY (0, 0, 3, 0, 1, 0, 1, 1, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 243, 0, 0);
- ADDENTRY (3, 0, 3, 0, 1, 0, 1440, 0, 0);
- ADDENTRY (3, 0, 3, 0, 1, 1, 32, 1, 1);
-#endif
-
-#ifdef VIDEO_MODE_PAL
-
-#if defined(CONFIG_RRVISION)
-
-#define HPW 160 /* horizontal pulse width (was 139) */
-#define VPW 2 /* vertical pulse width */
-#define HBP 104 /* horizontal back porch (was 112) */
-#define VBP 19 /* vertical back porch (was 19) */
-#define VID_R 240 /* number of rows */
-
- debug ("[VIDEO CTRL] Starting to add controller entries...");
-/*
- * Even field
- */
- ADDENTRY (0, 3, 0, 3, 1, 0, 2, 0, 0);
- ADDENTRY (0, 0, 0, 3, 1, 0, HPW, 0, 0);
- ADDENTRY (3, 0, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 0, 0);
-
- ADDENTRY (0, 0, 0, 3, 1, 0, VPW, 1, 0);
- ADDENTRY (0, 0, 0, 3, 1, 0, HPW-1, 0, 0);
- ADDENTRY (3, 0, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 1, 0);
-
- ADDENTRY (0, 3, 0, 3, 1, 0, VBP, 1, 0);
- ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
- ADDENTRY (3, 3, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 1, 0);
-/*
- * Active area
- */
- ADDENTRY (0, 3, 0, 3, 1, 0, VID_R , 1, 0);
- ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
- ADDENTRY (3, 3, 0, 3, 1, 0, HBP, 0, 0);
- ADDENTRY (3, 3, 0, 3, 0, 0, VIDEO_COLS*2, 0, 0);
- ADDENTRY (3, 3, 0, 3, 1, 0, 72, 1, 1);
-
- ADDENTRY (0, 3, 0, 3, 1, 0, 51, 1, 0);
- ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
- ADDENTRY (3, 3, 0, 3, 1, 0, HBP +(VIDEO_COLS * 2) + 72 , 1, 0);
-/*
- * Odd field
- */
- ADDENTRY (0, 3, 0, 3, 1, 0, 2, 0, 0);
- ADDENTRY (0, 0, 0, 3, 1, 0, HPW, 0, 0);
- ADDENTRY (3, 0, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 0, 0);
-
- ADDENTRY (0, 0, 0, 3, 1, 0, VPW+1, 1, 0);
- ADDENTRY (0, 0, 0, 3, 1, 0, HPW-1, 0, 0);
- ADDENTRY (3, 0, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 1, 0);
-
- ADDENTRY (0, 3, 0, 3, 1, 0, VBP, 1, 0);
- ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
- ADDENTRY (3, 3, 0, 3, 1, 0, HBP + (VIDEO_COLS * 2) + 72, 1, 0);
-/*
- * Active area
- */
- ADDENTRY (0, 3, 0, 3, 1, 0, VID_R , 1, 0);
- ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
- ADDENTRY (3, 3, 0, 3, 1, 0, HBP, 0, 0);
- ADDENTRY (3, 3, 0, 3, 0, 0, VIDEO_COLS*2, 0, 0);
- ADDENTRY (3, 3, 0, 3, 1, 0, 72, 1, 1);
-
- ADDENTRY (0, 3, 0, 3, 1, 0, 51, 1, 0);
- ADDENTRY (0, 3, 0, 3, 1, 0, HPW-1, 0, 0);
- ADDENTRY (3, 3, 0, 3, 1, 0, HBP +(VIDEO_COLS * 2) + 72 , 1, 0);
-
- debug ("done\n");
-
-#else /* !CONFIG_RRVISION */
-
-/*
- * Hx Vx Fx Bx VDS INT LCYC LP LST
- *
- * vertical; blanking
- */
- ADDENTRY (0, 0, 0, 0, 1, 0, 22, 1, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 263, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 1440, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 24, 1, 0);
-/*
- * active area (TOP)
- */
- if (Y1 > 0) {
- ADDENTRY (0, 0, 0, 0, 1, 0, Y1, 1, 0); /* 11? */
- ADDENTRY (3, 0, 0, 0, 1, 0, 255, 0, 0);
- ADDENTRY (3, 0, 0, 3, 1, 0, 1448, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 24, 1, 0);
- }
-/*
- * field active area (CENTER)
- */
- ADDENTRY (0, 0, 0, 0, 1, 0, 288 - DY, 1, 0); /* 265? */
- ADDENTRY (3, 0, 0, 0, 1, 0, 255, 0, 0);
- ADDENTRY (3, 0, 0, 3, 1, 0, 8 + X1, 0, 0);
- ADDENTRY (3, 0, 0, 3, 0, 0, VIDEO_COLS * 2, 0, 0);
-
- if (X2 > 0)
- ADDENTRY (3, 0, 0, 1, 1, 0, X2, 0, 0);
-
- ADDENTRY (3, 0, 0, 0, 1, 0, 24, 1, 0);
-/*
- * field active area (BOTTOM)
- */
- if (Y2 > 0) {
- ADDENTRY (0, 0, 0, 0, 1, 0, Y2, 1, 0); /* 12? */
- ADDENTRY (3, 0, 0, 0, 1, 0, 255, 0, 0);
- ADDENTRY (3, 0, 0, 3, 1, 0, 1448, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 24, 1, 0);
- }
-/*
- * field vertical; blanking
- */
- ADDENTRY (0, 0, 0, 0, 1, 0, 2, 1, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 263, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 1440, 0, 0);
- ADDENTRY (3, 0, 0, 0, 1, 0, 24, 1, 0);
-/*
- * Create the other field (like this, but whit other field selected,
- * one more cycle loop and a last identifier)
- */
- video_mode_dupefield (vr, &vr[entry], entry);
-#endif /* CONFIG_RRVISION */
-
-#endif /* VIDEO_MODE_PAL */
-
- /* See what FIFO are we using */
- fifo = GETBIT (immap->im_vid.vid_vsr, VIDEO_VSR_CAS);
-
- /* Set number of lines and burst (only one frame for now) */
- if (fifo) {
- immap->im_vid.vid_vfcr0 = VIDEO_BURST_LEN |
- (VIDEO_BURST_LEN << 8) | ((VIDEO_ROWS / 2) << 19);
- } else {
- immap->im_vid.vid_vfcr1 = VIDEO_BURST_LEN |
- (VIDEO_BURST_LEN << 8) | ((VIDEO_ROWS / 2) << 19);
- }
-
- SETBIT (immap->im_vid.vid_vcmr, VIDEO_VCMR_ASEL, !fifo);
-
-/*
- * Wait until changes are applied (not done)
- * while (GETBIT(immap->im_vid.vid_vsr, VIDEO_VSR_CAS) == fifo) ;
- */
-
- /* Return number of VRAM entries */
- return entry * 2;
-}
-
-static void video_encoder_init (void)
-{
-#ifdef VIDEO_I2C
- int rc;
-
- /* Initialize the I2C */
- debug ("[VIDEO ENCODER] Initializing I2C bus...\n");
- i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
-
-#ifdef CONFIG_FADS
- /* Reset ADV7176 chip */
- debug ("[VIDEO ENCODER] Resetting encoder...\n");
- (*(int *) BCSR4) &= ~(1 << 21);
-
- /* Wait for 5 ms inside the reset */
- debug ("[VIDEO ENCODER] Waiting for encoder reset...\n");
- udelay (5000);
-
- /* Take ADV7176 out of reset */
- (*(int *) BCSR4) |= 1 << 21;
-
- /* Wait for 5 ms after the reset */
- udelay (5000);
-#endif /* CONFIG_FADS */
-
- /* Send configuration */
-#ifdef DEBUG
- {
- int i;
-
- puts ("[VIDEO ENCODER] Configuring the encoder...\n");
-
- printf ("Sending %d bytes (@ %08lX) to I2C 0x%X:\n ",
- sizeof(video_encoder_data),
- (ulong)video_encoder_data,
- VIDEO_I2C_ADDR);
- for (i=0; i<sizeof(video_encoder_data); ++i) {
- printf(" %02X", video_encoder_data[i]);
- }
- putc ('\n');
- }
-#endif /* DEBUG */
-
- if ((rc = i2c_write (VIDEO_I2C_ADDR, 0, 1,
- video_encoder_data,
- sizeof(video_encoder_data))) != 0) {
- printf ("i2c_send error: rc=%d\n", rc);
- return;
- }
-#endif /* VIDEO_I2C */
- return;
-}
-
-static void video_ctrl_init (void *memptr)
-{
- immap_t *immap = (immap_t *) CFG_IMMR;
-
- video_fb_address = memptr;
-
- /* Set background */
- debug ("[VIDEO CTRL] Setting background color...\n");
- immap->im_vid.vid_vbcb = VIDEO_BG_COL;
-
- /* Show the background */
- debug ("[VIDEO CTRL] Forcing background...\n");
- SETBIT (immap->im_vid.vid_vcmr, VIDEO_VCMR_BD, 1);
-
- /* Turn off video controller */
- debug ("[VIDEO CTRL] Turning off video controller...\n");
- SETBIT (immap->im_vid.vid_vccr, VIDEO_VCCR_VON, 0);
-
-#ifdef CONFIG_FADS
- /* Turn on Video Port LED */
- debug ("[VIDEO CTRL] Turning off video port led...\n");
- SETBIT (*(int *) BCSR4, VIDEO_BCSR4_VIDLED_BIT, 1);
-
- /* Disable internal clock */
- debug ("[VIDEO CTRL] Disabling internal clock...\n");
- SETBIT (*(int *) BCSR4, VIDEO_BCSR4_EXTCLK_BIT, 0);
-#endif
-
- /* Generate and make active a new video mode */
- debug ("[VIDEO CTRL] Generating video mode...\n");
- video_mode_generate ();
-
- /* Start of frame buffer (even and odd frame, to make it working with */
- /* any selected active set) */
- debug ("[VIDEO CTRL] Setting frame buffer address...\n");
- immap->im_vid.vid_vfaa1 =
- immap->im_vid.vid_vfaa0 = (u32) video_fb_address;
- immap->im_vid.vid_vfba1 =
- immap->im_vid.vid_vfba0 =
- (u32) video_fb_address + VIDEO_LINE_LEN;
-
- /* YUV, Big endian, SHIFT/CLK/CLK input (BEFORE ENABLING 27MHZ EXT CLOCK) */
- debug ("[VIDEO CTRL] Setting pixel mode and clocks...\n");
- immap->im_vid.vid_vccr = 0x2042;
-
- /* Configure port pins */
- debug ("[VIDEO CTRL] Configuring input/output pins...\n");
- immap->im_ioport.iop_pdpar = 0x1fff;
- immap->im_ioport.iop_pddir = 0x0000;
-
-#ifdef CONFIG_FADS
- /* Turn on Video Port Clock - ONLY AFTER SET VCCR TO ENABLE EXTERNAL CLOCK */
- debug ("[VIDEO CTRL] Turning on video clock...\n");
- SETBIT (*(int *) BCSR4, VIDEO_BCSR4_EXTCLK_BIT, 1);
-
- /* Turn on Video Port LED */
- debug ("[VIDEO CTRL] Turning on video port led...\n");
- SETBIT (*(int *) BCSR4, VIDEO_BCSR4_VIDLED_BIT, 0);
-#endif
-#ifdef CONFIG_RRVISION
- debug ("PC5->Output(1): enable PAL clock");
- immap->im_ioport.iop_pcpar &= ~(0x0400);
- immap->im_ioport.iop_pcdir |= 0x0400 ;
- immap->im_ioport.iop_pcdat |= 0x0400 ;
- debug ("PDPAR=0x%04X PDDIR=0x%04X PDDAT=0x%04X\n",
- immap->im_ioport.iop_pdpar,
- immap->im_ioport.iop_pddir,
- immap->im_ioport.iop_pddat);
- debug ("PCPAR=0x%04X PCDIR=0x%04X PCDAT=0x%04X\n",
- immap->im_ioport.iop_pcpar,
- immap->im_ioport.iop_pcdir,
- immap->im_ioport.iop_pcdat);
-#endif /* CONFIG_RRVISION */
-
- /* Blanking the screen. */
- debug ("[VIDEO CTRL] Blanking the screen...\n");
- video_fill (VIDEO_BG_COL);
-
- /*
- * Turns on Aggressive Mode. Normally, turning on the caches
- * will cause the screen to flicker when the caches try to
- * fill. This gives the FIFO's for the Video Controller
- * higher priority and prevents flickering because of
- * underrun. This may still be an issue when using FLASH,
- * since accessing data from Flash is so slow.
- */
- debug ("[VIDEO CTRL] Turning on aggressive mode...\n");
- immap->im_siu_conf.sc_sdcr = 0x40;
-
- /* Turn on video controller */
- debug ("[VIDEO CTRL] Turning on video controller...\n");
- SETBIT (immap->im_vid.vid_vccr, VIDEO_VCCR_VON, 1);
-
- /* Show the display */
- debug ("[VIDEO CTRL] Enabling the video...\n");
- SETBIT (immap->im_vid.vid_vcmr, VIDEO_VCMR_BD, 0);
-}
-
-/************************************************************************/
-/* ** CONSOLE FUNCTIONS */
-/************************************************************************/
-
-static void console_scrollup (void)
-{
- /* Copy up rows ignoring the first one */
- memcpyl (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE >> 2);
-
- /* Clear the last one */
- memsetl (CONSOLE_ROW_LAST, CONSOLE_ROW_SIZE >> 2, VIDEO_BG_COL);
-}
-
-static inline void console_back (void)
-{
- console_col--;
-
- if (console_col < 0) {
- console_col = CONSOLE_COLS - 1;
- console_row--;
- if (console_row < 0)
- console_row = 0;
- }
-
- video_putchar ( console_col * VIDEO_FONT_WIDTH,
- console_row * VIDEO_FONT_HEIGHT, ' ');
-}
-
-static inline void console_newline (void)
-{
- console_row++;
- console_col = 0;
-
- /* Check if we need to scroll the terminal */
- if (console_row >= CONSOLE_ROWS) {
- /* Scroll everything up */
- console_scrollup ();
-
- /* Decrement row number */
- console_row--;
- }
-}
-
-void video_putc (const char c)
-{
- if (!video_enable) {
- serial_putc (c);
- return;
- }
-
- switch (c) {
- case 13: /* Simply ignore this */
- break;
-
- case '\n': /* Next line, please */
- console_newline ();
- break;
-
- case 9: /* Tab (8 chars alignment) */
- console_col |= 0x0008; /* Next 8 chars boundary */
- console_col &= ~0x0007; /* Set this bit to zero */
-
- if (console_col >= CONSOLE_COLS)
- console_newline ();
- break;
-
- case 8: /* Eat last character */
- console_back ();
- break;
-
- default: /* Add to the console */
- video_putchar ( console_col * VIDEO_FONT_WIDTH,
- console_row * VIDEO_FONT_HEIGHT, c);
- console_col++;
- /* Check if we need to go to next row */
- if (console_col >= CONSOLE_COLS)
- console_newline ();
- }
-}
-
-void video_puts (const char *s)
-{
- int count = strlen (s);
-
- if (!video_enable)
- while (count--)
- serial_putc (*s++);
- else
- while (count--)
- video_putc (*s++);
-}
-
-/************************************************************************/
-/* ** CURSOR BLINKING FUNCTIONS */
-/************************************************************************/
-
-#ifdef VIDEO_BLINK
-
-#define BLINK_TIMER_ID 0
-#define BLINK_TIMER_HZ 2
-
-static unsigned char blink_enabled = 0;
-static timer_t blink_timer;
-
-static void blink_update (void)
-{
- static int blink_row = -1, blink_col = -1, blink_old = 0;
-
- /* Check if we have a new position to invert */
- if ((console_row != blink_row) || (console_col != blink_col)) {
- /* Check if we need to reverse last character */
- if (blink_old)
- video_revchar ( blink_col * VIDEO_FONT_WIDTH,
- (blink_row
-#ifdef CONFIG_VIDEO_LOGO
- + VIDEO_LOGO_HEIGHT
-#endif
- ) * VIDEO_FONT_HEIGHT);
-
- /* Update values */
- blink_row = console_row;
- blink_col = console_col;
- blink_old = 0;
- }
-
-/* Reverse this character */
- blink_old = !blink_old;
- video_revchar ( console_col * VIDEO_FONT_WIDTH,
- (console_row
-#ifdef CONFIG_VIDEO_LOGO
- + VIDEO_LOGO_HEIGHT
-#endif
- ) * VIDEO_FONT_HEIGHT);
-
-}
-
-/*
- * Handler for blinking cursor
- */
-static void blink_handler (void *arg)
-{
-/* Blink */
- blink_update ();
-/* Ack the timer */
- timer_ack (&blink_timer);
-}
-
-int blink_set (int blink)
-{
- int ret = blink_enabled;
-
- if (blink)
- timer_enable (&blink_timer);
- else
- timer_disable (&blink_timer);
-
- blink_enabled = blink;
-
- return ret;
-}
-
-static inline void blink_close (void)
-{
- timer_close (&blink_timer);
-}
-
-static inline void blink_init (void)
-{
- timer_init (&blink_timer,
- BLINK_TIMER_ID, BLINK_TIMER_HZ,
- blink_handler);
-}
-#endif
-
-/************************************************************************/
-/* ** LOGO PLOTTING FUNCTIONS */
-/************************************************************************/
-
-#ifdef CONFIG_VIDEO_LOGO
-void easylogo_plot (fastimage_t * image, void *screen, int width, int x,
- int y)
-{
- int skip = width - image->width, xcount, ycount = image->height;
-
-#ifdef VIDEO_MODE_YUYV
- ushort *source = (ushort *) image->data;
- ushort *dest = (ushort *) screen + y * width + x;
-
- while (ycount--) {
- xcount = image->width;
- while (xcount--)
- *dest++ = *source++;
- dest += skip;
- }
-#endif
-#ifdef VIDEO_MODE_RGB
- unsigned char
- *source = (unsigned short *) image->data,
- *dest = (unsigned short *) screen + ((y * width) + x) * 3;
-
- while (ycount--) {
- xcount = image->width * 3;
- memcpy (dest, source, xcount);
- source += xcount;
- dest += ycount;
- }
-#endif
-}
-
-static void *video_logo (void)
-{
- u16 *screen = video_fb_address, width = VIDEO_COLS;
-#ifdef VIDEO_INFO
-# ifndef CONFIG_FADS
- char temp[32];
-# endif
- char info[80];
-#endif /* VIDEO_INFO */
-
- easylogo_plot (VIDEO_LOGO_ADDR, screen, width, 0, 0);
-
-#ifdef VIDEO_INFO
- sprintf (info, "%s (%s - %s) ", U_BOOT_VERSION, __DATE__, __TIME__);
- video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, info);
-
- sprintf (info, "(C) 2002 DENX Software Engineering");
- video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT,
- info);
-
- sprintf (info, " Wolfgang DENK, wd@denx.de");
- video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT * 2,
- info);
-#ifndef CONFIG_FADS /* all normal boards */
- /* leave one blank line */
-
- sprintf (info, "MPC823 CPU at %s MHz, %ld MB RAM, %ld MB Flash",
- strmhz(temp, gd->cpu_clk),
- gd->ram_size >> 20,
- gd->bd->bi_flashsize >> 20 );
- video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT * 4,
- info);
-#else /* FADS :-( */
- sprintf (info, "MPC823 CPU at 50 MHz on FADS823 board");
- video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT,
- info);
-
- sprintf (info, "2MB FLASH - 8MB DRAM - 4MB SRAM");
- video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT * 2,
- info);
-#endif
-#endif
-
- return video_fb_address + VIDEO_LOGO_HEIGHT * VIDEO_LINE_LEN;
-}
-#endif
-
-/************************************************************************/
-/* ** VIDEO HIGH-LEVEL FUNCTIONS */
-/************************************************************************/
-
-static int video_init (void *videobase)
-{
- /* Initialize the encoder */
- debug ("[VIDEO] Initializing video encoder...\n");
- video_encoder_init ();
-
- /* Initialize the video controller */
- debug ("[VIDEO] Initializing video controller at %08x...\n",
- (int) videobase);
- video_ctrl_init (videobase);
-
- /* Setting the palette */
- video_setpalette (CONSOLE_COLOR_BLACK, 0, 0, 0);
- video_setpalette (CONSOLE_COLOR_RED, 0xFF, 0, 0);
- video_setpalette (CONSOLE_COLOR_GREEN, 0, 0xFF, 0);
- video_setpalette (CONSOLE_COLOR_YELLOW, 0xFF, 0xFF, 0);
- video_setpalette (CONSOLE_COLOR_BLUE, 0, 0, 0xFF);
- video_setpalette (CONSOLE_COLOR_MAGENTA, 0xFF, 0, 0xFF);
- video_setpalette (CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF);
- video_setpalette (CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA);
- video_setpalette (CONSOLE_COLOR_GREY2, 0xF8, 0xF8, 0xF8);
- video_setpalette (CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF);
-
-#ifndef CFG_WHITE_ON_BLACK
- video_setfgcolor (CONSOLE_COLOR_BLACK);
- video_setbgcolor (CONSOLE_COLOR_GREY2);
-#else
- video_setfgcolor (CONSOLE_COLOR_GREY2);
- video_setbgcolor (CONSOLE_COLOR_BLACK);
-#endif /* CFG_WHITE_ON_BLACK */
-
-#ifdef CONFIG_VIDEO_LOGO
- /* Paint the logo and retrieve tv base address */
- debug ("[VIDEO] Drawing the logo...\n");
- video_console_address = video_logo ();
-#else
- video_console_address = video_fb_address;
-#endif
-
-#ifdef VIDEO_BLINK
- /* Enable the blinking (under construction) */
- blink_init ();
- blink_set (0); /* To Fix! */
-#endif
-
- /* Initialize the console */
- console_col = 0;
- console_row = 0;
- video_enable = 1;
-
-#ifdef VIDEO_MODE_PAL
-# define VIDEO_MODE_TMP1 "PAL"
-#endif
-#ifdef VIDEO_MODE_NTSC
-# define VIDEO_MODE_TMP1 "NTSC"
-#endif
-#ifdef VIDEO_MODE_YUYV
-# define VIDEO_MODE_TMP2 "YCbYCr"
-#endif
-#ifdef VIDEO_MODE_RGB
-# define VIDEO_MODE_TMP2 "RGB"
-#endif
- debug ( VIDEO_MODE_TMP1
- " %dx%dx%d (" VIDEO_MODE_TMP2 ") on %s - console %dx%d\n",
- VIDEO_COLS, VIDEO_ROWS, VIDEO_MODE_BPP,
- VIDEO_ENCODER_NAME, CONSOLE_COLS, CONSOLE_ROWS);
- return 0;
-}
-
-int drv_video_init (void)
-{
- int error, devices = 1;
-
- device_t videodev;
-
- video_init ((void *)(gd->fb_base)); /* Video initialization */
-
-/* Device initialization */
-
- memset (&videodev, 0, sizeof (videodev));
-
- strcpy (videodev.name, "video");
- videodev.ext = DEV_EXT_VIDEO; /* Video extensions */
- videodev.flags = DEV_FLAGS_OUTPUT; /* Output only */
- videodev.putc = video_putc; /* 'putc' function */
- videodev.puts = video_puts; /* 'puts' function */
-
- error = device_register (&videodev);
-
- return (error == 0) ? devices : error;
-}
-
-/************************************************************************/
-/* ** ROM capable initialization part - needed to reserve FB memory */
-/************************************************************************/
-
-/*
- * This is called early in the system initialization to grab memory
- * for the video controller.
- * Returns new address for monitor, after reserving video buffer memory
- *
- * Note that this is running from ROM, so no write access to global data.
- */
-ulong video_setmem (ulong addr)
-{
- /* Allocate pages for the frame buffer. */
- addr -= VIDEO_SIZE;
-
- debug ("Reserving %dk for Video Framebuffer at: %08lx\n",
- VIDEO_SIZE>>10, addr);
-
- return (addr);
-}
-
-#endif
diff --git a/cpu/mpc8xx/wlkbd.c b/cpu/mpc8xx/wlkbd.c
deleted file mode 100644
index 13009e2641..0000000000
--- a/cpu/mpc8xx/wlkbd.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * (C) Copyright 2000
- * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <config.h>
-
-#ifdef CONFIG_WL_4PPM_KEYBOARD
-
-/* WIP: Wireless keyboard on SMC
- */
-int drv_wlkbd_init (void)
-{
- return 0 ;
-}
-
-#endif /* CONFIG_WL_4PPM_KEYBOARD */
diff --git a/cpu/nios/Makefile b/cpu/nios/Makefile
deleted file mode 100644
index ad1745608d..0000000000
--- a/cpu/nios/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-SOBJS = traps.o
-COBJS = cpu.o interrupts.o serial.o asmi.o spi.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/nios/asmi.c b/cpu/nios/asmi.c
deleted file mode 100644
index ce2863e5c6..0000000000
--- a/cpu/nios/asmi.c
+++ /dev/null
@@ -1,695 +0,0 @@
-/*
- * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-#if defined(CONFIG_NIOS_ASMI)
-#include <command.h>
-#include <nios-io.h>
-
-#if !defined(CFG_NIOS_ASMIBASE)
-#error "*** CFG_NIOS_ASMIBASE not defined ***"
-#endif
-
-/*-----------------------------------------------------------------------*/
-#define SHORT_HELP\
- "asmi - read/write Cyclone ASMI configuration device.\n"
-
-#define LONG_HELP\
- "\n"\
- "asmi erase start [end]\n"\
- " - erase sector start or sectors start through end.\n"\
- "asmi info\n"\
- " - display ASMI device information.\n"\
- "asmi protect on | off\n"\
- " - turn device protection on or off.\n"\
- "asmi read addr offset count\n"\
- " - read count bytes from offset to addr.\n"\
- "asmi write addr offset count\n"\
- " - write count bytes to offset from addr.\n"\
- "asmi verify addr offset count\n"\
- " - verify count bytes at offset from addr.\n"
-
-
-/*-----------------------------------------------------------------------*/
-/* Operation codes for serial configuration devices
- */
-#define ASMI_WRITE_ENA 0x06 /* Write enable */
-#define ASMI_WRITE_DIS 0x04 /* Write disable */
-#define ASMI_READ_STAT 0x05 /* Read status */
-#define ASMI_READ_BYTES 0x03 /* Read bytes */
-#define ASMI_READ_ID 0xab /* Read silicon id */
-#define ASMI_WRITE_STAT 0x01 /* Write status */
-#define ASMI_WRITE_BYTES 0x02 /* Write bytes */
-#define ASMI_ERASE_BULK 0xc7 /* Erase entire device */
-#define ASMI_ERASE_SECT 0xd8 /* Erase sector */
-
-/* Device status register bits
- */
-#define ASMI_STATUS_WIP (1<<0) /* Write in progress */
-#define ASMI_STATUS_WEL (1<<1) /* Write enable latch */
-
-static nios_asmi_t *asmi = (nios_asmi_t *)CFG_NIOS_ASMIBASE;
-
-/***********************************************************************
- * Device access
- ***********************************************************************/
-static void asmi_cs (int assert)
-{
- if (assert) {
- asmi->control |= NIOS_ASMI_SSO;
- } else {
- /* Let all bits shift out */
- while ((asmi->status & NIOS_ASMI_TMT) == 0)
- ;
- asmi->control &= ~NIOS_ASMI_SSO;
- }
-}
-
-static void asmi_tx (unsigned char c)
-{
- while ((asmi->status & NIOS_ASMI_TRDY) == 0)
- ;
- asmi->txdata = c;
-}
-
-static int asmi_rx (void)
-{
- while ((asmi->status & NIOS_ASMI_RRDY) == 0)
- ;
- return (asmi->rxdata);
-}
-
-static unsigned char bitrev[] = {
- 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e,
- 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f
-};
-
-static unsigned char asmi_bitrev( unsigned char c )
-{
- unsigned char val;
-
- val = bitrev[c>>4];
- val |= bitrev[c & 0x0f]<<4;
- return (val);
-}
-
-static void asmi_rcv (unsigned char *dst, int len)
-{
- while (len--) {
- asmi_tx (0);
- *dst++ = asmi_rx ();
- }
-}
-
-static void asmi_rrcv (unsigned char *dst, int len)
-{
- while (len--) {
- asmi_tx (0);
- *dst++ = asmi_bitrev (asmi_rx ());
- }
-}
-
-static void asmi_snd (unsigned char *src, int len)
-{
- while (len--) {
- asmi_tx (*src++);
- asmi_rx ();
- }
-}
-
-static void asmi_rsnd (unsigned char *src, int len)
-{
- while (len--) {
- asmi_tx (asmi_bitrev (*src++));
- asmi_rx ();
- }
-}
-
-static void asmi_wr_enable (void)
-{
- asmi_cs (1);
- asmi_tx (ASMI_WRITE_ENA);
- asmi_rx ();
- asmi_cs (0);
-}
-
-static unsigned char asmi_status_rd (void)
-{
- unsigned char status;
-
- asmi_cs (1);
- asmi_tx (ASMI_READ_STAT);
- asmi_rx ();
- asmi_tx (0);
- status = asmi_rx ();
- asmi_cs (0);
- return (status);
-}
-
-static void asmi_status_wr (unsigned char status)
-{
- asmi_wr_enable ();
- asmi_cs (1);
- asmi_tx (ASMI_WRITE_STAT);
- asmi_rx ();
- asmi_tx (status);
- asmi_rx ();
- asmi_cs (0);
- return;
-}
-
-/***********************************************************************
- * Device information
- ***********************************************************************/
-typedef struct asmi_devinfo_t {
- const char *name; /* Device name */
- unsigned char id; /* Device silicon id */
- unsigned char size; /* Total size log2(bytes)*/
- unsigned char num_sects; /* Number of sectors */
- unsigned char sz_sect; /* Sector size log2(bytes) */
- unsigned char sz_page; /* Page size log2(bytes) */
- unsigned char prot_mask; /* Protection mask */
-}asmi_devinfo_t;
-
-static struct asmi_devinfo_t devinfo[] = {
- { "EPCS1 ", 0x10, 17, 4, 15, 8, 0x0c },
- { "EPCS4 ", 0x12, 19, 8, 16, 8, 0x1c },
- { 0, 0, 0, 0, 0, 0 }
-};
-
-static asmi_devinfo_t *asmi_dev_find (void)
-{
- unsigned char buf[4];
- unsigned char id;
- int i;
- struct asmi_devinfo_t *dev = NULL;
-
- /* Read silicon id requires 3 "dummy bytes" before it's put
- * on the wire.
- */
- buf[0] = ASMI_READ_ID;
- buf[1] = 0;
- buf[2] = 0;
- buf[3] = 0;
-
- asmi_cs (1);
- asmi_snd (buf,4);
- asmi_rcv (buf,1);
- asmi_cs (0);
- id = buf[0];
-
- /* Find the info struct */
- i = 0;
- while (devinfo[i].name) {
- if (id == devinfo[i].id) {
- dev = &devinfo[i];
- break;
- }
- i++;
- }
-
- return (dev);
-}
-
-/***********************************************************************
- * Misc Utilities
- ***********************************************************************/
-static unsigned asmi_cfgsz (void)
-{
- unsigned sz = 0;
- unsigned char buf[128];
- unsigned char *p;
-
- /* Read in the first 128 bytes of the device */
- buf[0] = ASMI_READ_BYTES;
- buf[1] = 0;
- buf[2] = 0;
- buf[3] = 0;
-
- asmi_cs (1);
- asmi_snd (buf,4);
- asmi_rrcv (buf, sizeof(buf));
- asmi_cs (0);
-
- /* Search for the starting 0x6a which is followed by the
- * 4-byte 'register' and 4-byte bit-count.
- */
- p = buf;
- while (p < buf + sizeof(buf)-8) {
- if ( *p == 0x6a ) {
- /* Point to bit count and extract */
- p += 5;
- sz = *p++;
- sz |= *p++ << 8;
- sz |= *p++ << 16;
- sz |= *p++ << 24;
- /* Convert to byte count */
- sz += 7;
- sz >>= 3;
- } else if (*p == 0xff) {
- /* 0xff is ok ... just skip */
- p++;
- continue;
- } else {
- /* Not 0xff or 0x6a ... something's not
- * right ... report 'unknown' (sz=0).
- */
- break;
- }
- }
- return (sz);
-}
-
-static int asmi_erase (unsigned start, unsigned end)
-{
- unsigned off, sectsz;
- unsigned char buf[4];
- struct asmi_devinfo_t *dev = asmi_dev_find ();
-
- if (!dev || (start>end))
- return (-1);
-
- /* Erase the requested sectors. An address is required
- * that lies within the requested sector -- we'll just
- * use the first address in the sector.
- */
- printf ("asmi erasing sector %d ", start);
- if (start != end)
- printf ("to %d ", end);
- sectsz = (1 << dev->sz_sect);
- while (start <= end) {
- off = start * sectsz;
- start++;
-
- buf[0] = ASMI_ERASE_SECT;
- buf[1] = off >> 16;
- buf[2] = off >> 8;
- buf[3] = off;
-
- asmi_wr_enable ();
- asmi_cs (1);
- asmi_snd (buf,4);
- asmi_cs (0);
-
- printf ("."); /* Some user feedback */
-
- /* Wait for erase to complete */
- while (asmi_status_rd() & ASMI_STATUS_WIP)
- ;
- }
- printf (" done.\n");
- return (0);
-}
-
-static int asmi_read (ulong addr, ulong off, ulong cnt)
-{
- unsigned char buf[4];
-
- buf[0] = ASMI_READ_BYTES;
- buf[1] = off >> 16;
- buf[2] = off >> 8;
- buf[3] = off;
-
- asmi_cs (1);
- asmi_snd (buf,4);
- asmi_rrcv ((unsigned char *)addr, cnt);
- asmi_cs (0);
-
- return (0);
-}
-
-static
-int asmi_write (ulong addr, ulong off, ulong cnt)
-{
- ulong wrcnt;
- unsigned pgsz;
- unsigned char buf[4];
- struct asmi_devinfo_t *dev = asmi_dev_find ();
-
- if (!dev)
- return (-1);
-
- pgsz = (1<<dev->sz_page);
- while (cnt) {
- if (off % pgsz)
- wrcnt = pgsz - (off % pgsz);
- else
- wrcnt = pgsz;
- wrcnt = (wrcnt > cnt) ? cnt : wrcnt;
-
- buf[0] = ASMI_WRITE_BYTES;
- buf[1] = off >> 16;
- buf[2] = off >> 8;
- buf[3] = off;
-
- asmi_wr_enable ();
- asmi_cs (1);
- asmi_snd (buf,4);
- asmi_rsnd ((unsigned char *)addr, wrcnt);
- asmi_cs (0);
-
- /* Wait for write to complete */
- while (asmi_status_rd() & ASMI_STATUS_WIP)
- ;
-
- cnt -= wrcnt;
- off += wrcnt;
- addr += wrcnt;
- }
-
- return (0);
-}
-
-static
-int asmi_verify (ulong addr, ulong off, ulong cnt, ulong *err)
-{
- ulong rdcnt;
- unsigned char buf[256];
- unsigned char *start,*end;
- int i;
-
- start = end = (unsigned char *)addr;
- while (cnt) {
- rdcnt = (cnt>sizeof(buf)) ? sizeof(buf) : cnt;
- asmi_read ((ulong)buf, off, rdcnt);
- for (i=0; i<rdcnt; i++) {
- if (*end != buf[i]) {
- *err = end - start;
- return(-1);
- }
- end++;
- }
- cnt -= rdcnt;
- off += rdcnt;
- }
- return (0);
-}
-
-static int asmi_sect_erased (int sect, unsigned *offset,
- struct asmi_devinfo_t *dev)
-{
- unsigned char buf[128];
- unsigned off, end;
- unsigned sectsz;
- int i;
-
- sectsz = (1 << dev->sz_sect);
- off = sectsz * sect;
- end = off + sectsz;
-
- while (off < end) {
- asmi_read ((ulong)buf, off, sizeof(buf));
- for (i=0; i < sizeof(buf); i++) {
- if (buf[i] != 0xff) {
- *offset = off + i;
- return (0);
- }
- }
- off += sizeof(buf);
- }
- return (1);
-}
-
-
-/***********************************************************************
- * Commands
- ***********************************************************************/
-static
-void do_asmi_info (struct asmi_devinfo_t *dev, int argc, char *argv[])
-{
- int i;
- unsigned char stat;
- unsigned tmp;
- int erased;
-
- /* Basic device info */
- printf ("%s: %d kbytes (%d sectors x %d kbytes,"
- " %d bytes/page)\n",
- dev->name, 1 << (dev->size-10),
- dev->num_sects, 1 << (dev->sz_sect-10),
- 1 << dev->sz_page );
-
- /* Status -- for now protection is all-or-nothing */
- stat = asmi_status_rd();
- printf ("status: 0x%02x (WIP:%d, WEL:%d, PROT:%s)\n",
- stat,
- (stat & ASMI_STATUS_WIP) ? 1 : 0,
- (stat & ASMI_STATUS_WEL) ? 1 : 0,
- (stat & dev->prot_mask) ? "on" : "off" );
-
- /* Configuration */
- tmp = asmi_cfgsz ();
- if (tmp) {
- printf ("config: 0x%06x (%d) bytes\n", tmp, tmp );
- } else {
- printf ("config: unknown\n" );
- }
-
- /* Sector info */
- for (i=0; i<dev->num_sects; i++) {
- erased = asmi_sect_erased (i, &tmp, dev);
- printf (" %d: %06x ",
- i, i*(1<<dev->sz_sect) );
- if (erased)
- printf ("erased\n");
- else
- printf ("data @ 0x%06x\n", tmp);
- }
-
- return;
-}
-
-static
-void do_asmi_erase (struct asmi_devinfo_t *dev, int argc, char *argv[])
-{
- unsigned start,end;
-
- if ((argc < 3) || (argc > 4)) {
- printf ("USAGE: asmi erase sect [end]\n");
- return;
- }
- if ((asmi_status_rd() & dev->prot_mask) != 0) {
- printf ( "asmi: device protected.\n");
- return;
- }
-
- start = simple_strtoul (argv[2], NULL, 10);
- if (argc > 3)
- end = simple_strtoul (argv[3], NULL, 10);
- else
- end = start;
- if ((start >= dev->num_sects) || (start > end)) {
- printf ("asmi: invalid sector range: [%d:%d]\n",
- start, end );
- return;
- }
-
- asmi_erase (start, end);
-
- return;
-}
-
-static
-void do_asmi_protect (struct asmi_devinfo_t *dev, int argc, char *argv[])
-{
- unsigned char stat;
-
- /* For now protection is all-or-nothing to keep things
- * simple. The protection bits don't map in a linear
- * fashion ... and we would rather protect the bottom
- * of the device since it contains the config data and
- * leave the top unprotected for app use. But unfortunately
- * protection works from top-to-bottom so it does
- * really help very much from a software app point-of-view.
- */
- if (argc < 3) {
- printf ("USAGE: asmi protect on | off\n");
- return;
- }
- if (!dev)
- return;
-
- /* Protection on/off is just a matter of setting/clearing
- * all protection bits in the status register.
- */
- stat = asmi_status_rd ();
- if (strcmp ("on", argv[2]) == 0) {
- stat |= dev->prot_mask;
- } else if (strcmp ("off", argv[2]) == 0 ) {
- stat &= ~dev->prot_mask;
- } else {
- printf ("asmi: unknown protection: %s\n", argv[2]);
- return;
- }
- asmi_status_wr (stat);
- return;
-}
-
-static
-void do_asmi_read (struct asmi_devinfo_t *dev, int argc, char *argv[])
-{
- ulong addr,off,cnt;
- ulong sz;
-
- if (argc < 5) {
- printf ("USAGE: asmi read addr offset count\n");
- return;
- }
-
- sz = 1 << dev->size;
- addr = simple_strtoul (argv[2], NULL, 16);
- off = simple_strtoul (argv[3], NULL, 16);
- cnt = simple_strtoul (argv[4], NULL, 16);
- if (off > sz) {
- printf ("offset is greater than device size"
- "... aborting.\n");
- return;
- }
- if ((off + cnt) > sz) {
- printf ("request exceeds device size"
- "... truncating.\n");
- cnt = sz - off;
- }
- printf ("asmi: read %08lx <- %06lx (0x%lx bytes)\n",
- addr, off, cnt);
- asmi_read (addr, off, cnt);
-
- return;
-}
-
-static
-void do_asmi_write (struct asmi_devinfo_t *dev, int argc, char *argv[])
-{
- ulong addr,off,cnt;
- ulong sz;
- ulong err;
-
- if (argc < 5) {
- printf ("USAGE: asmi write addr offset count\n");
- return;
- }
- if ((asmi_status_rd() & dev->prot_mask) != 0) {
- printf ( "asmi: device protected.\n");
- return;
- }
-
- sz = 1 << dev->size;
- addr = simple_strtoul (argv[2], NULL, 16);
- off = simple_strtoul (argv[3], NULL, 16);
- cnt = simple_strtoul (argv[4], NULL, 16);
- if (off > sz) {
- printf ("offset is greater than device size"
- "... aborting.\n");
- return;
- }
- if ((off + cnt) > sz) {
- printf ("request exceeds device size"
- "... truncating.\n");
- cnt = sz - off;
- }
- printf ("asmi: write %08lx -> %06lx (0x%lx bytes)\n",
- addr, off, cnt);
- asmi_write (addr, off, cnt);
- if (asmi_verify (addr, off, cnt, &err) != 0)
- printf ("asmi: write error at offset %06lx\n", err);
-
- return;
-}
-
-static
-void do_asmi_verify (struct asmi_devinfo_t *dev, int argc, char *argv[])
-{
- ulong addr,off,cnt;
- ulong sz;
- ulong err;
-
- if (argc < 5) {
- printf ("USAGE: asmi verify addr offset count\n");
- return;
- }
-
- sz = 1 << dev->size;
- addr = simple_strtoul (argv[2], NULL, 16);
- off = simple_strtoul (argv[3], NULL, 16);
- cnt = simple_strtoul (argv[4], NULL, 16);
- if (off > sz) {
- printf ("offset is greater than device size"
- "... aborting.\n");
- return;
- }
- if ((off + cnt) > sz) {
- printf ("request exceeds device size"
- "... truncating.\n");
- cnt = sz - off;
- }
- printf ("asmi: verify %08lx -> %06lx (0x%lx bytes)\n",
- addr, off, cnt);
- if (asmi_verify (addr, off, cnt, &err) != 0)
- printf ("asmi: verify error at offset %06lx\n", err);
-
- return;
-}
-
-/*-----------------------------------------------------------------------*/
-int do_asmi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- int len;
- struct asmi_devinfo_t *dev = asmi_dev_find ();
-
- if (argc < 2) {
- printf ("Usage:%s", LONG_HELP);
- return (0);
- }
-
- if (!dev) {
- printf ("asmi: device not found.\n");
- return (0);
- }
-
- len = strlen (argv[1]);
- if (strncmp ("info", argv[1], len) == 0) {
- do_asmi_info ( dev, argc, argv);
- } else if (strncmp ("erase", argv[1], len) == 0) {
- do_asmi_erase (dev, argc, argv);
- } else if (strncmp ("protect", argv[1], len) == 0) {
- do_asmi_protect (dev, argc, argv);
- } else if (strncmp ("read", argv[1], len) == 0) {
- do_asmi_read (dev, argc, argv);
- } else if (strncmp ("write", argv[1], len) == 0) {
- do_asmi_write (dev, argc, argv);
- } else if (strncmp ("verify", argv[1], len) == 0) {
- do_asmi_verify (dev, argc, argv);
- } else {
- printf ("asmi: unknown operation: %s\n", argv[1]);
- }
-
- return (0);
-}
-
-/*-----------------------------------------------------------------------*/
-
-
-U_BOOT_CMD( asmi, 5, 0, do_asmi, SHORT_HELP, LONG_HELP );
-
-#endif /* CONFIG_NIOS_ASMI */
diff --git a/cpu/nios/config.mk b/cpu/nios/config.mk
deleted file mode 100644
index f228d7219a..0000000000
--- a/cpu/nios/config.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# (C) Copyright 2000
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS +=
diff --git a/cpu/nios/cpu.c b/cpu/nios/cpu.c
deleted file mode 100644
index d2bb2c09d1..0000000000
--- a/cpu/nios/cpu.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <nios.h>
-
-
-int checkcpu (void)
-{
- unsigned val;
- unsigned rev_major;
- unsigned rev_minor;
- short nregs, hi_limit, lo_limit;
-
- /* Get cpu version info */
- val = rdctl (CTL_CPU_ID);
- printf ("CPU: ");
- printf ("%s", (val & 0x00008000) ? "Nios-16 " : "Nios-32 ");
- rev_major = (val>>12) & 0x07;
- rev_minor = (val>>4) & 0x0ff;
- printf ("Rev. %d.%d (0x%04x)", rev_major, rev_minor,
- val & 0xffff);
- if (rev_major == 0x08)
- printf (" [OpenCore (R) Plus]");
- printf ("\n");
-
- /* Check register file */
- val = rdctl (CTL_WVALID);
- lo_limit = val & 0x01f;
- hi_limit = (val>>5) & 0x1f;
- nregs = (hi_limit + 2) * 16;
- printf ("Reg file size: %d LO_LIMIT/HI_LIMIT: %d/%d\n",
- nregs, lo_limit, hi_limit);
-
- return (0);
-}
-
-
-int do_reset (void)
-{
- /* trap 0 does the trick ... at least with the OCI debug
- * present -- haven't tested without it yet (stm).
- */
- disable_interrupts ();
- ipri (1);
- asm volatile ("trap 0\n");
-
- /* No return ;-) */
-
- return(0);
-}
-
-
-#if defined(CONFIG_WATCHDOG)
-void watchdog_reset (void)
-{
-}
-#endif /* CONFIG_WATCHDOG */
diff --git a/cpu/nios/interrupts.c b/cpu/nios/interrupts.c
deleted file mode 100644
index 48fc81e584..0000000000
--- a/cpu/nios/interrupts.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <nios.h>
-#include <nios-io.h>
-#include <asm/ptrace.h>
-#include <common.h>
-#include <command.h>
-#include <watchdog.h>
-#ifdef CONFIG_STATUS_LED
-#include <status_led.h>
-#endif
-
-/****************************************************************************/
-
-struct irq_action {
- interrupt_handler_t *handler;
- void *arg;
- int count;
-};
-
-static struct irq_action irq_vecs[64];
-
-/*************************************************************************/
-volatile ulong timestamp = 0;
-
-void reset_timer (void)
-{
- timestamp = 0;
-}
-
-ulong get_timer (ulong base)
-{
- WATCHDOG_RESET ();
- return (timestamp - base);
-}
-
-void set_timer (ulong t)
-{
- timestamp = t;
-}
-
-
-/* The board must handle this interrupt if a timer is not
- * provided.
- */
-#if defined(CFG_NIOS_TMRBASE)
-void timer_interrupt (struct pt_regs *regs)
-{
- /* Interrupt is cleared by writing anything to the
- * status register.
- */
- nios_timer_t *tmr = (nios_timer_t *)CFG_NIOS_TMRBASE;
- tmr->status = 0;
- timestamp += CFG_NIOS_TMRMS;
-#ifdef CONFIG_STATUS_LED
- status_led_tick(timestamp);
-#endif
-}
-#endif
-
-/*************************************************************************/
-int disable_interrupts (void)
-{
- int val = 0;
-
- /* Writing anything to CLR_IE disables interrupts */
- val = rdctl (CTL_STATUS);
- wrctl (CTL_CLR_IE, 0);
- return (val & STATUS_IE);
-}
-
-void enable_interrupts( void )
-{
- /* Writing anything SET_IE enables interrupts */
- wrctl (CTL_SET_IE, 0);
-}
-
-void external_interrupt (struct pt_regs *regs)
-{
- unsigned vec;
-
- vec = (regs->status & STATUS_IPRI) >> 9; /* ipri */
-
- irq_vecs[vec].count++;
- if (irq_vecs[vec].handler != NULL) {
- (*irq_vecs[vec].handler)(irq_vecs[vec].arg);
- } else {
- /* A sad side-effect of masking a bogus interrupt is
- * that lower priority interrupts will also be disabled.
- * This is probably not what we want ... so hang insted.
- */
- printf ("Unhandled interrupt: 0x%x\n", vec);
- disable_interrupts ();
- hang ();
- }
-}
-
-/*************************************************************************/
-int interrupt_init (void)
-{
- int vec;
-
-#if defined(CFG_NIOS_TMRBASE)
- nios_timer_t *tmr = (nios_timer_t *)CFG_NIOS_TMRBASE;
-
- tmr->control &= ~NIOS_TIMER_ITO;
- tmr->control |= NIOS_TIMER_STOP;
-#if defined(CFG_NIOS_TMRCNT)
- tmr->periodl = CFG_NIOS_TMRCNT & 0xffff;
- tmr->periodh = (CFG_NIOS_TMRCNT >> 16) & 0xffff;
-#endif
-#endif
-
- for (vec=0; vec<64; vec++ ) {
- irq_vecs[vec].handler = NULL;
- irq_vecs[vec].arg = NULL;
- irq_vecs[vec].count = 0;
- }
-
- /* Need timus interruptus -- start the lopri timer */
-#if defined(CFG_NIOS_TMRBASE)
- tmr->control |= ( NIOS_TIMER_ITO |
- NIOS_TIMER_CONT |
- NIOS_TIMER_START );
- ipri (CFG_NIOS_TMRIRQ + 1);
-#endif
- enable_interrupts ();
- return (0);
-}
-
-void irq_install_handler (int vec, interrupt_handler_t *handler, void *arg)
-{
- struct irq_action *irqa = irq_vecs;
- int i = vec;
- int flag;
-
- if (irqa[i].handler != NULL) {
- printf ("Interrupt vector %d: handler 0x%x "
- "replacing 0x%x\n",
- vec, (uint)handler, (uint)irqa[i].handler);
- }
-
- flag = disable_interrupts ();
- irqa[i].handler = handler;
- irqa[i].arg = arg;
- if (flag )
- enable_interrupts ();
-}
-
-/*************************************************************************/
-#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
-int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- int vec;
-
- printf ("\nInterrupt-Information:\n");
- printf ("Nr Routine Arg Count\n");
-
- for (vec=0; vec<64; vec++) {
- if (irq_vecs[vec].handler != NULL) {
- printf ("%02d %08lx %08lx %d\n",
- vec,
- (ulong)irq_vecs[vec].handler<<1,
- (ulong)irq_vecs[vec].arg,
- irq_vecs[vec].count);
- }
- }
-
- return (0);
-}
-#endif /* CONFIG_COMMANDS & CFG_CMD_IRQ */
diff --git a/cpu/nios/spi.c b/cpu/nios/spi.c
deleted file mode 100644
index f37146b793..0000000000
--- a/cpu/nios/spi.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
- * Stephan Linz <linz@li-pro.net>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <linux/ctype.h>
-
-#if defined(CONFIG_NIOS_SPI)
-#include <nios-io.h>
-#include <spi.h>
-
-#if !defined(CFG_NIOS_SPIBASE)
-#error "*** CFG_NIOS_SPIBASE not defined ***"
-#endif
-
-#if !defined(CFG_NIOS_SPIBITS)
-#error "*** CFG_NIOS_SPIBITS not defined ***"
-#endif
-
-#if (CFG_NIOS_SPIBITS != 8) && (CFG_NIOS_SPIBITS != 16)
-#error "*** CFG_NIOS_SPIBITS should be either 8 or 16 ***"
-#endif
-
-static nios_spi_t *spi = (nios_spi_t *)CFG_NIOS_SPIBASE;
-
-/* Warning:
- * You cannot enable DEBUG for early system initalization, i. e. when
- * this driver is used to read environment parameters like "baudrate"
- * from EEPROM which are used to initialize the serial port which is
- * needed to print the debug messages...
- */
-#undef DEBUG
-
-#ifdef DEBUG
-
-#define DPRINT(a) printf a;
-/* -----------------------------------------------
- * Helper functions to peek into tx and rx buffers
- * ----------------------------------------------- */
-static const char * const hex_digit = "0123456789ABCDEF";
-
-static char quickhex (int i)
-{
- return hex_digit[i];
-}
-
-static void memdump (void *pv, int num)
-{
- int i;
- unsigned char *pc = (unsigned char *) pv;
-
- for (i = 0; i < num; i++)
- printf ("%c%c ", quickhex (pc[i] >> 4), quickhex (pc[i] & 0x0f));
- printf ("\t");
- for (i = 0; i < num; i++)
- printf ("%c", isprint (pc[i]) ? pc[i] : '.');
- printf ("\n");
-}
-#else /* !DEBUG */
-
-#define DPRINT(a)
-#define memdump(p,n)
-
-#endif /* DEBUG */
-
-
-/*
- * SPI transfer:
- *
- * See include/spi.h and http://www.altera.com/literature/ds/ds_nios_spi.pdf
- * for more informations.
- */
-int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
-{
- int j;
-
- DPRINT(("spi_xfer: chipsel %08X dout %08X din %08X bitlen %d\n",
- (int)chipsel, *(uint *)dout, *(uint *)din, bitlen));
-
- memdump((void*)dout, (bitlen + 7) / 8);
-
- if(chipsel != NULL) {
- chipsel(1); /* select the target chip */
- }
-
- if (bitlen > CFG_NIOS_SPIBITS) { /* leave chip select active */
- spi->control |= NIOS_SPI_SSO;
- }
-
- for ( j = 0; /* count each byte in */
- j < ((bitlen + 7) / 8); /* dout[] and din[] */
-
-#if (CFG_NIOS_SPIBITS == 8)
- j++) {
-
- while ((spi->status & NIOS_SPI_TRDY) == 0)
- ;
- spi->txdata = (unsigned)(dout[j]);
-
- while ((spi->status & NIOS_SPI_RRDY) == 0)
- ;
- din[j] = (unsigned char)(spi->rxdata & 0xff);
-
-#elif (CFG_NIOS_SPIBITS == 16)
- j++, j++) {
-
- while ((spi->status & NIOS_SPI_TRDY) == 0)
- ;
- if ((j+1) < ((bitlen + 7) / 8))
- spi->txdata = (unsigned)((dout[j] << 8) | dout[j+1]);
- else
- spi->txdata = (unsigned)(dout[j] << 8);
-
- while ((spi->status & NIOS_SPI_RRDY) == 0)
- ;
- din[j] = (unsigned char)((spi->rxdata >> 8) & 0xff);
- if ((j+1) < ((bitlen + 7) / 8))
- din[j+1] = (unsigned char)(spi->rxdata & 0xff);
-
-#else
-#error "*** unsupported value of CFG_NIOS_SPIBITS ***"
-#endif
-
- }
-
- if (bitlen > CFG_NIOS_SPIBITS) {
- spi->control &= ~NIOS_SPI_SSO;
- }
-
- if(chipsel != NULL) {
- chipsel(0); /* deselect the target chip */
- }
-
- memdump((void*)din, (bitlen + 7) / 8);
-
- return 0;
-}
-
-#endif /* CONFIG_NIOS_SPI */
diff --git a/cpu/nios/start.S b/cpu/nios/start.S
deleted file mode 100644
index cb1af3c8b6..0000000000
--- a/cpu/nios/start.S
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-
-#if !defined(CONFIG_IDENT_STRING)
-#define CONFIG_IDENT_STRING ""
-#endif
-
-#define STATUS_INIT 0x8600 /* IE=1, IPRI=2 */
-
-/*************************************************************************
- * RESTART
- ************************************************************************/
-
- .text
- .global _start
-
-_start:
- bsr 0f
- nop
- .long _start
-
- /* GERMS -- The "standard-32" configuration GERMS monitor looks
- * for the string "Nios" at flash_base + 0xc (actually it only
- * tests for 'N', 'i'). You can leave support for this in place
- * as it's only a few words.
- */
- . = _start + 0x000c
- .string "Nios"
-
- .align 4
-0:
- /*
- * Early setup -- set cwp = HI_LIMIT, IPRI = 2, IE = 1 to
- * enable underflow exceptions. Disable cache.
- * NOTE: %o7 has return addr -- save in %g7 use later.
- */
- mov %g7, %o7
-
- pfx 2 /* WVALID */
- rdctl %g0
- lsri %g0, 1
- pfx %hi(STATUS_INIT)
- or %g0, %lo(STATUS_INIT)
- wrctl %g0 /* update status */
- nop
-
- /*
- * STACK
- */
- pfx %hi(CFG_INIT_SP)
- movi %sp, %lo(CFG_INIT_SP)
- pfx %xhi(CFG_INIT_SP)
- movhi %sp, %xlo(CFG_INIT_SP)
- mov %fp, %sp
-
- pfx %hi(4*16)
- subi %sp, %lo(4*16) /* Space for reg window mgmt */
-
- /*
- * RELOCATE -- %g7 has return addr from bsr at _start.
- */
- pfx %hi(__u_boot_cmd_end)
- movi %g5, %lo(__u_boot_cmd_end)
- pfx %xhi(__u_boot_cmd_end)
- movhi %g5, %xlo(__u_boot_cmd_end) /* %g5 <- end address */
-
- lsli %g7, 1 /* mem = retaddr << 1 */
- mov %g6, %g7
- subi %g6, 4 /* %g6 <- src addr */
- ld %g7, [%g7] /* %g7 <- dst addr */
-
- /* No need to move text sections if we're already located
- * at the proper address.
- */
- cmp %g7, %g6
- ifs cc_z
- br reloc
- nop /* delay slot */
-
-1: cmp %g7, %g5
- skps cc_nz
- br 2f
- nop /* delay slot */
-
- ld %g0, [%g6]
- addi %g6, 4 /* src++ */
- st [%g7], %g0
- addi %g7, 4 /* dst++ */
- br 1b
- nop /* delay slot */
-2:
-
- /*
- * Jump to relocation address
- */
- pfx %hi(reloc@h)
- movi %g0, %lo(reloc@h)
- pfx %xhi(reloc@h)
- movhi %g0, %xlo(reloc@h)
- jmp %g0
- nop /* delay slot */
-reloc:
-
- /*
- * CLEAR BSS
- */
- pfx %hi(__bss_end)
- movi %g5, %lo(__bss_end)
- pfx %xhi(__bss_end)
- movhi %g5, %xlo(__bss_end) /* %g5 <- end address */
- pfx %hi(__bss_start)
- movi %g7, %lo(__bss_start)
- pfx %xhi(__bss_start)
- movhi %g7, %xlo(__bss_start) /* %g7 <- end address */
-
- movi %g0, 0
-3: cmp %g7, %g5
- skps cc_nz
- br 4f
- nop /* delay slot */
-
- st [%g7], %g0
- addi %g7, 4 /* (delay slot) dst++ */
- br 3b
- nop /* delay slot */
-4:
-
- /*
- * INIT VECTOR TABLE
- */
- pfx %hi(CFG_VECT_BASE)
- movi %g0, %lo(CFG_VECT_BASE)
- pfx %xhi(CFG_VECT_BASE)
- movhi %g0, %xlo(CFG_VECT_BASE) /* dst */
- mov %l0, %g0
-
- pfx %hi(_vectors)
- movi %g1, %lo(_vectors)
- pfx %xhi(_vectors)
- movhi %g1, %xlo(_vectors) /* src */
- bgen %g2, 6 /* cnt = 64 */
-
- ldp %g3, [%l0, 3] /* bkpt vector */
- ldp %g4, [%l0, 4] /* single step vector */
-
-5: ld %g7, [%g1]
- addi %g1, 4 /* src++ */
- st [%g0], %g7
- addi %g0, 4 /* dst++ */
-
- subi %g2, 1 /* cnt-- */
- ifrnz %g2
- br 5b
- nop /* delay slot */
-
-#if defined(CONFIG_ROM_STUBS)
- /* Restore the breakpoint and single step exception
- * vectors to their original values.
- */
- stp [%l0,3], %g3 /* breakpoint */
- stp [%l0,4], %g4 /* single step */
-#endif
-
- /* For debug startup convenience ... software breakpoints
- * set prior to this point may not succeed ;-)
- */
- .global __start
-__start:
-
- /*
- * Call board_init -- never returns
- */
- pfx %hi(board_init@h)
- movi %g1, %lo(board_init@h)
- pfx %xhi(board_init@h)
- movhi %g1, %xlo(board_init@h)
- call %g1
- nop /* Delaly slot */
- /* NEVER RETURNS */
-
-/*
- * dly_clks -- Nios doesn't have a time/clk reference for simple
- * delay loops, so we do our best by counting instruction cycles.
- * A control register that counts system clock cycles would be
- * a handy feature -- hint for Altera ;-)
- */
- .globl dly_clks
- /* Each loop is 4 instructions as delay slot is always
- * executed. Each instruction is approximately 4 clocks
- * (according to some lame info from Altera). So ...
- * ... each loop is about 16 clocks.
- */
-
-dly_clks:
- lsri %o0, 4 /* cnt/16 */
-
-8: skprnz %o0
- br 9f
- subi %o0, 1 /* cnt--, Delay slot */
- br 8b
- nop
-
-9: lret
- nop /* Delay slot */
-
-
- .data
- .globl version_string
-
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
diff --git a/cpu/nios/traps.S b/cpu/nios/traps.S
deleted file mode 100644
index bc4d3f66da..0000000000
--- a/cpu/nios/traps.S
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-
-/*************************************************************************
- * Register window underflow
- *
- * The register window underflow exception occurs whenever the lowest
- * valid register window is in use (CWP=LO_LIMIT) and a save instruction
- * is issued. The save moves CWP below LO_LIMIT, %sp is set as normal,
- * then the exception is generated prior to executing the instruction
- * after the save.
- ************************************************************************/
- .text
- .global _cwp_lolimit
- .align 4
-
-_cwp_lolimit:
-
- /* Sixteen words are always allocated by the compiler in every
- * procedure's stack frame, always starting at %sp, for saving
- * 'in' and 'local' registers on a window overflow.
- *
- * Save the 'global' and 'in' regs on stack. They are restored
- * at cwp = HI_LIMIT. The 'local' regs aren't in-use at this point.
- */
- sts [%sp,0], %g0 /* Save 'global' regs*/
- sts [%sp,1], %g1
- sts [%sp,2], %g2
- sts [%sp,3], %g3
- sts [%sp,4], %g4
- sts [%sp,5], %g5
- sts [%sp,6], %g6
- sts [%sp,7], %g7
-
- sts [%sp,8], %i0 /* Save 'in' regs */
- sts [%sp,9], %i1
- sts [%sp,10], %i2
- sts [%sp,11], %i3
- sts [%sp,12], %i4
- sts [%sp,13], %i5
- sts [%sp,14], %i6
- sts [%sp,15], %i7
-
- /* Save current %sp and return address in a global so they are
- * available at cwp = HI_LIMIT ... where the 'global'/'in' regs
- * are restored. NOTE: %sp changes with cwp.
- */
- mov %g7, %o7
- mov %g6, %sp
-
- /* Get LO_LIMIT/HI_LIMIT to know where to start & stop. Note: in
- * the underflow exception, cwp is __NOT__ guaranteed to be zero.
- * If the OCI debug module is enabled the reset value for LO_LIMIT
- * is 2, not 1 -- so cwp can be 1 or 0.
- */
- pfx 2 /* WVALID */
- rdctl %g1
- mov %g2, %g1
- pfx 0
- and %g1, 0x1f /* g1 <- LO_LIMIT */
- lsri %g2, 5
- pfx 0
- and %g2,0x1f /* g2 <- HI_LIMIT */
-
- /* Set istatus so cwp = HI_LIMIT after tret
- */
- movi %g5, 0x1f
- lsli %g5, 4
- not %g5 /* mask to clr cwp */
- pfx 1 /* istatus */
- rdctl %g0
- and %g0, %g5 /* clear cwp field */
-
- mov %g4, %g2
- lsli %g4, 4
- or %g0, %g4 /* cwp = HI_LIMIT */
- pfx 1
- wrctl %g0 /* update istatus */
-
- /* Now move up the register file, saving as we go. When loop
- * is first entered, %g1 is at LO_LIMIT.
- */
-0:
- restore /* cwp++ */
- sts [%sp,0], %l0 /* Save "local" regs*/
- sts [%sp,1], %l1
- sts [%sp,2], %l2
- sts [%sp,3], %l3
- sts [%sp,4], %l4
- sts [%sp,5], %l5
- sts [%sp,6], %l6
- sts [%sp,7], %l7
-
- sts [%sp,8], %i0 /* Save 'in' regs */
- sts [%sp,9], %i1
- sts [%sp,10], %i2
- sts [%sp,11], %i3
- sts [%sp,12], %i4
- sts [%sp,13], %i5
- sts [%sp,14], %i6
- sts [%sp,15], %i7
-
- cmp %g1, %g2 /* cwp == HI_LIMIT ? */
- skps cc_ne /* if so, we're done */
- br 1f
- nop /* delay slot */
-
- inc %g1 /* g1 <- cwp++ */
- br 0b
- nop /* delay slot */
-
- /* At this point cwp = HI_LIMIT, so the global/in regs that were
- * in place when the underflow occurred must be restored using
- * the original stack pointer (saved in g6).
- */
-1:
- mov %o7, %g7 /* restore return addr */
- mov %sp, %g6 /* Restore original sp */
-
- lds %g0, [%sp,0] /* Restore 'global' regs*/
- lds %g1, [%sp,1]
- lds %g2, [%sp,2]
- lds %g3, [%sp,3]
- lds %g4, [%sp,4]
- lds %g5, [%sp,5]
- lds %g6, [%sp,6]
- lds %g7, [%sp,7]
-
- lds %i0, [%sp,8] /* Restore 'in' regs*/
- lds %i1, [%sp,9]
- lds %i2, [%sp,10]
- lds %i3, [%sp,11]
- lds %i4, [%sp,12]
- lds %i5, [%sp,13]
- lds %i6, [%sp,14]
- lds %i7, [%sp,15]
-
- tret %o7 /* All done */
-
-/*************************************************************************
- * Register window overflow
- *
- * The register window overflow exception occurs whenever the highest
- * valid register window is in use (cwp = HI_LIMIT) and a restore
- * instruction is issued. Control is transferred to the overflow handler
- * before the instruction following restore is executed.
- *
- * When a register window overflow exception is taken, the exception
- * handler sees cwp at HI_LIMIT.
- ************************************************************************/
- .text
- .global _cwp_hilimit
- .align 4
-
-_cwp_hilimit:
-
- /* Save 'global'/'in' regs on the stack -- will restore when cwp
- * is at LO_LIMIT. Locals don't need saving as they are going away.
- */
- sts [%sp,0], %g0 /* Save "global" regs*/
- sts [%sp,1], %g1
- sts [%sp,2], %g2
- sts [%sp,3], %g3
- sts [%sp,4], %g4
- sts [%sp,5], %g5
- sts [%sp,6], %g6
- sts [%sp,7], %g7
-
- sts [%sp,8], %i0 /* Save 'in' regs */
- sts [%sp,9], %i1
- sts [%sp,10], %i2
- sts [%sp,11], %i3
- sts [%sp,12], %i4
- sts [%sp,13], %i5
- sts [%sp,14], %i6
- sts [%sp,15], %i7
-
- /* The current %sp must be available in global to restore regs
- * saved on stack. Need return addr as well ;-)
- */
- mov %g7, %o7
- mov %g6, %sp
-
- /* Get HI_LIMIT & LO_LIMIT
- */
- pfx 2 /* WVALID */
- rdctl %g1
- mov %g2, %g1
- pfx 0
- and %g1, 0x1f /* g1 <- LO_LIMIT */
- lsri %g2, 5
- pfx 0
- and %g2,0x1f /* g2 <- HI_LIMIT */
-
- /* Set istatus so cwp = LO_LIMIT after tret
- */
- movi %g5, 0x1f
- lsli %g5, 4
- not %g5 /* mask to clr cwp */
- pfx 1 /* istatus */
- rdctl %g0
- and %g0, %g5 /* clear cwp field */
-
- mov %g4, %g1 /* g4 <- LO_LIMIT */
- lsli %g4, 4
- or %g0, %g4 /* cwp = LO_LIMIT */
- pfx 1
- wrctl %g0 /* update istatus */
-
- /* Move to cwp = LO_LIMIT-1 and restore 'in' regs.
- */
- subi %g4,(1 << 4) /* g4 <- LO_LIMIT - 1 */
- rdctl %g0
- and %g0, %g5 /* clear cwp field */
- or %g0, %g4 /* cwp = LO_LIMIT - 1 */
- wrctl %g0 /* update status */
- nop
-
- mov %sp, %g6 /* Restore sp */
- lds %i0, [%sp,8] /* Restore 'in' regs */
- lds %i1, [%sp,9]
- lds %i2, [%sp,10]
- lds %i3, [%sp,11]
- lds %i4, [%sp,12]
- lds %i5, [%sp,13]
- lds %i6, [%sp,14] /* sp in next window */
- lds %i7, [%sp,15]
-
- /* Starting at LO_LIMIT-1, move up the register file, restoring
- * along the way.
- */
-0:
- restore /* cwp++ */
- lds %l0, [%sp,0] /* Restore 'local' regs*/
- lds %l1, [%sp,1]
- lds %l2, [%sp,2]
- lds %l3, [%sp,3]
- lds %l4, [%sp,4]
- lds %l5, [%sp,5]
- lds %l6, [%sp,6]
- lds %l7, [%sp,7]
-
- lds %i0, [%sp,8] /* Restore 'in' regs */
- lds %i1, [%sp,9]
- lds %i2, [%sp,10]
- lds %i3, [%sp,11]
- lds %i4, [%sp,12]
- lds %i5, [%sp,13]
- lds %i6, [%sp,14] /* sp in next window */
- lds %i7, [%sp,15]
-
- cmp %g1, %g2 /* cwp == HI_LIMIT ? */
- skps cc_ne /* if so, we're done */
- br 1f
- nop /* delay slot */
-
- inc %g1 /* cwp++ */
- br 0b
- nop /* delay slot */
-
- /* All windows have been updated at this point, but the globals
- * still need to be restored. Go to cwp = LO_LIMIT-1 to get
- * some registers to use.
- */
-1:
- rdctl %g0
- and %g0, %g5 /* clear cwp field */
- or %g0, %g4 /* cwp = LO_LIMIT - 1 */
- wrctl %g0 /* update status */
- nop
-
- /* Now there are some registers available to use in restoring
- * the globals.
- */
- mov %sp, %g6
- mov %o7, %g7
-
- lds %g0, [%sp,0] /* Restore "global" regs*/
- lds %g1, [%sp,1]
- lds %g2, [%sp,2]
- lds %g3, [%sp,3]
- lds %g4, [%sp,4]
- lds %g5, [%sp,5]
- lds %g6, [%sp,6]
- lds %g7, [%sp,7]
-
- /* The tret moves istatus -> status. istatus was already set for
- * cwp = LO_LIMIT.
- */
-
- tret %o7 /* done */
-
-/*************************************************************************
- * Default exception handler
- *
- * The default handler passes control to external_interrupt(). So trap
- * or hardware interrupt hanlders can be installed using the familiar
- * irq_install_handler().
- *
- * Here, the stack is fixed-up and cwp is incremented prior to calling
- * external_interrupt(). This lets the underflow and overflow handlers
- * operate normally during the exception.
- ************************************************************************/
- .text
- .global _def_xhandler
- .align 4
-
-_def_xhandler:
-
- /* Allocate some stack space: 16 words at %sp to accomodate
- * a reg window underflow, 8 words to save interrupted task's
- * 'out' regs (which are now the 'in' regs), 8 words to preserve
- * the 'global' regs and 3 words to save the return address,
- * status and istatus. istatus must be saved in the event an
- * underflow occurs in a dispatched handler. status is saved so
- * a handler can access it on stack.
- */
- pfx %hi((16+16+3) * 4)
- subi %fp, %lo((16+16+3) * 4)
- mov %sp, %fp
-
- /* Save the 'global' regs and the interrupted task's 'out' regs
- * (our 'in' regs) along with the return addr, status & istatus.
- * First 16 words are for underflow exception.
- */
- rdctl %l0 /* status */
- pfx 1 /* istatus */
- rdctl %l1
-
- sts [%sp,16+0], %g0 /* Save 'global' regs*/
- sts [%sp,16+1], %g1
- sts [%sp,16+2], %g2
- sts [%sp,16+3], %g3
- sts [%sp,16+4], %g4
- sts [%sp,16+5], %g5
- sts [%sp,16+6], %g6
- sts [%sp,16+7], %g7
-
- sts [%sp,16+8], %i0 /* Save 'in' regs */
- sts [%sp,16+9], %i1
- sts [%sp,16+10], %i2
- sts [%sp,16+11], %i3
- sts [%sp,16+12], %i4
- sts [%sp,16+13], %i5
- sts [%sp,16+14], %i6
- sts [%sp,16+15], %i7
-
- sts [%sp,16+16], %l0 /* status */
- sts [%sp,16+17], %l1 /* istatus */
- sts [%sp,16+18], %o7 /* return addr */
-
- /* Move to cwp+1 ... this guarantees cwp is at or above LO_LIMIT.
- * Need to set IPRI=3 and IE=1 to enable underflow exceptions.
- * NOTE: only the 'out' regs have been saved ... can't touch
- * the 'in' or 'local' here.
- */
- restore /* cwp++ */
- rdctl %o0 /* o0 <- status */
-
- pfx %hi(0x7e00)
- movi %o1, %lo(0x7e00)
- not %o1
- and %o0, %o1 /* clear IPRI */
-
- pfx %hi(0x8600)
- movi %o1, %lo(0x8600)
- or %o0, %o1 /* IPRI=3, IE=1 */
-
- wrctl %o0 /* o0 -> status */
- nop
-
- /* It's ok to call a C routine now since cwp >= LO_LIMIT,
- * interrupt task's registers are/will be preserved, and
- * underflow exceptions can be handled.
- */
- pfx %hi(external_interrupt@h)
- movi %o1, %lo(external_interrupt@h)
- pfx %xhi(external_interrupt@h)
- movhi %o1, %xlo(external_interrupt@h)
- bgen %o0, 4+2 /* 16 * 4 */
- add %o0, %sp /* Ptr to regs */
- call %o1
- nop
-
- /* Move back to the exception register window, restore the 'out'
- * registers, then return from exception.
- */
- rdctl %o0 /* o0 <- status */
- subi %o0, 16
- wrctl %o0 /* cwp-- */
- nop
-
- mov %sp, %fp
- lds %g0, [%sp,16+0] /* Restore 'global' regs*/
- lds %g1, [%sp,16+1]
- lds %g2, [%sp,16+2]
- lds %g3, [%sp,16+3]
- lds %g4, [%sp,16+4]
- lds %g5, [%sp,16+5]
- lds %g6, [%sp,16+6]
- lds %g7, [%sp,16+7]
-
- lds %i0, [%sp,16+8] /* Restore 'in' regs*/
- lds %i1, [%sp,16+9]
- lds %i2, [%sp,16+10]
- lds %i3, [%sp,16+11]
- lds %i4, [%sp,16+12]
- lds %i5, [%sp,16+13]
- lds %i6, [%sp,16+14]
- lds %i7, [%sp,16+15]
-
- lds %l0, [%sp,16+16] /* status */
- lds %l1, [%sp,16+17] /* istatus */
- lds %o7, [%sp,16+18] /* return addr */
-
- pfx 1
- wrctl %l1 /* restore istatus */
-
- pfx %hi((16+16+3) * 4)
- addi %sp, %lo((16+16+3) * 4)
- mov %fp, %sp
-
- tret %o7 /* Done */
-
-
-/*************************************************************************
- * Timebase Timer Interrupt -- This has identical structure to above,
- * but calls timer_interrupt(). Doing it this way keeps things similar
- * to other architectures (e.g. ppc).
- ************************************************************************/
- .text
- .global _timebase_int
- .align 4
-
-_timebase_int:
-
- /* Allocate stack space.
- */
- pfx %hi((16+16+3) * 4)
- subi %fp, %lo((16+16+3) * 4)
- mov %sp, %fp
-
- /* Save the 'global' regs & 'out' regs (our 'in' regs)
- */
- rdctl %l0 /* status */
- pfx 1 /* istatus */
- rdctl %l1
-
- sts [%sp,16+0], %g0 /* Save 'global' regs*/
- sts [%sp,16+1], %g1
- sts [%sp,16+2], %g2
- sts [%sp,16+3], %g3
- sts [%sp,16+4], %g4
- sts [%sp,16+5], %g5
- sts [%sp,16+6], %g6
- sts [%sp,16+7], %g7
-
- sts [%sp,16+8], %i0 /* Save 'in' regs */
- sts [%sp,16+9], %i1
- sts [%sp,16+10], %i2
- sts [%sp,16+11], %i3
- sts [%sp,16+12], %i4
- sts [%sp,16+13], %i5
- sts [%sp,16+14], %i6
- sts [%sp,16+15], %i7
-
- sts [%sp,16+16], %l0 /* status */
- sts [%sp,16+17], %l1 /* istatus */
- sts [%sp,16+18], %o7 /* return addr */
-
- /* Move to cwp+1.
- */
- restore /* cwp++ */
- rdctl %o0 /* o0 <- status */
-
- pfx %hi(0x7e00)
- movi %o1, %lo(0x7e00)
- not %o1
- and %o0, %o1 /* clear IPRI */
-
- pfx %hi(0x8600)
- movi %o1, %lo(0x8600)
- or %o0, %o1 /* IPRI=3, IE=1 */
-
- wrctl %o0 /* o0 -> status */
- nop
-
- /* Call timer_interrupt()
- */
- pfx %hi(timer_interrupt@h)
- movi %o1, %lo(timer_interrupt@h)
- pfx %xhi(timer_interrupt@h)
- movhi %o1, %xlo(timer_interrupt@h)
- bgen %o0, 4+2 /* 16 * 4 */
- add %o0, %sp /* Ptr to regs */
- call %o1
- nop
-
- /* Move back to the exception register window, restore the 'out'
- * registers, then return from exception.
- */
- rdctl %o0 /* o0 <- status */
- subi %o0, 16
- wrctl %o0 /* cwp-- */
- nop
-
- mov %sp, %fp
- lds %g0, [%sp,16+0] /* Restore 'global' regs*/
- lds %g1, [%sp,16+1]
- lds %g2, [%sp,16+2]
- lds %g3, [%sp,16+3]
- lds %g4, [%sp,16+4]
- lds %g5, [%sp,16+5]
- lds %g6, [%sp,16+6]
- lds %g7, [%sp,16+7]
-
- lds %i0, [%sp,16+8] /* Restore 'in' regs*/
- lds %i1, [%sp,16+9]
- lds %i2, [%sp,16+10]
- lds %i3, [%sp,16+11]
- lds %i4, [%sp,16+12]
- lds %i5, [%sp,16+13]
- lds %i6, [%sp,16+14]
- lds %i7, [%sp,16+15]
-
- lds %l0, [%sp,16+16] /* status */
- lds %l1, [%sp,16+17] /* istatus */
- lds %o7, [%sp,16+18] /* return addr */
-
- pfx 1
- wrctl %l1 /* restore istatus */
-
- pfx %hi((16+16+3) * 4)
- addi %sp, %lo((16+16+3) * 4)
- mov %fp, %sp
-
- tret %o7 /* Done */
-
-/*************************************************************************
- * GDB stubs
- ************************************************************************/
- .text
- .global _brkpt_hw_int, _brkpt_sw_int
- .align 4
-
-_brkpt_hw_int:
- movi %l1, 9
- pfx 3
- wrctl %l1
- pfx 4
- wrctl %l1
-
-_brkpt_sw_int:
- movi %l1, 9
- pfx 3
- wrctl %l1
- pfx 4
- wrctl %l1
-
- tret %o7
diff --git a/cpu/nios2/Makefile b/cpu/nios2/Makefile
deleted file mode 100644
index 75f30b43a8..0000000000
--- a/cpu/nios2/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-SOBJS = exceptions.o
-COBJS = cpu.o interrupts.o serial.o sysid.o traps.o epcs.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/nios2/config.mk b/cpu/nios2/config.mk
deleted file mode 100644
index f228d7219a..0000000000
--- a/cpu/nios2/config.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# (C) Copyright 2000
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS +=
diff --git a/cpu/nios2/cpu.c b/cpu/nios2/cpu.c
deleted file mode 100644
index f4217a88cf..0000000000
--- a/cpu/nios2/cpu.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <nios2.h>
-#include <nios2-io.h>
-
-#if defined (CFG_NIOS_SYSID_BASE)
-extern void display_sysid (void);
-#endif /* CFG_NIOS_SYSID_BASE */
-
-int checkcpu (void)
-{
- printf ("CPU : Nios-II\n");
-#if !defined(CFG_NIOS_SYSID_BASE)
- printf ("SYSID : <unknown>\n");
-#else
- display_sysid ();
-#endif
- return (0);
-}
-
-
-int do_reset (void)
-{
- void (*rst)(void) = (void(*)(void))CFG_RESET_ADDR;
- disable_interrupts ();
- rst();
- return(0);
-}
diff --git a/cpu/nios2/epcs.c b/cpu/nios2/epcs.c
deleted file mode 100644
index 414c38c2b1..0000000000
--- a/cpu/nios2/epcs.c
+++ /dev/null
@@ -1,729 +0,0 @@
-/*
- * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-#if defined(CFG_NIOS_EPCSBASE)
-#include <command.h>
-#include <asm/io.h>
-#include <nios2-io.h>
-#include <nios2-epcs.h>
-
-
-/*-----------------------------------------------------------------------*/
-#define SHORT_HELP\
- "epcs - read/write Cyclone EPCS configuration device.\n"
-
-#define LONG_HELP\
- "\n"\
- "epcs erase start [end]\n"\
- " - erase sector start or sectors start through end.\n"\
- "epcs info\n"\
- " - display EPCS device information.\n"\
- "epcs protect on | off\n"\
- " - turn device protection on or off.\n"\
- "epcs read addr offset count\n"\
- " - read count bytes from offset to addr.\n"\
- "epcs write addr offset count\n"\
- " - write count bytes to offset from addr.\n"\
- "epcs verify addr offset count\n"\
- " - verify count bytes at offset from addr.\n"
-
-
-/*-----------------------------------------------------------------------*/
-/* Operation codes for serial configuration devices
- */
-#define EPCS_WRITE_ENA 0x06 /* Write enable */
-#define EPCS_WRITE_DIS 0x04 /* Write disable */
-#define EPCS_READ_STAT 0x05 /* Read status */
-#define EPCS_READ_BYTES 0x03 /* Read bytes */
-#define EPCS_READ_ID 0xab /* Read silicon id */
-#define EPCS_WRITE_STAT 0x01 /* Write status */
-#define EPCS_WRITE_BYTES 0x02 /* Write bytes */
-#define EPCS_ERASE_BULK 0xc7 /* Erase entire device */
-#define EPCS_ERASE_SECT 0xd8 /* Erase sector */
-
-/* Device status register bits
- */
-#define EPCS_STATUS_WIP (1<<0) /* Write in progress */
-#define EPCS_STATUS_WEL (1<<1) /* Write enable latch */
-
-/* Misc
- */
-#define EPCS_TIMEOUT 100 /* 100 msec timeout */
-
-static nios_spi_t *epcs = (nios_spi_t *)CFG_NIOS_EPCSBASE;
-
-/***********************************************************************
- * Device access
- ***********************************************************************/
-static int epcs_cs (int assert)
-{
- ulong start;
- unsigned tmp;
-
-
- if (assert) {
- tmp = readl (&epcs->control);
- writel (&epcs->control, tmp | NIOS_SPI_SSO);
- } else {
- /* Let all bits shift out */
- start = get_timer (0);
- while ((readl (&epcs->status) & NIOS_SPI_TMT) == 0)
- if (get_timer (start) > EPCS_TIMEOUT)
- return (-1);
- tmp = readl (&epcs->control);
- writel (&epcs->control, tmp & ~NIOS_SPI_SSO);
- }
- return (0);
-}
-
-static int epcs_tx (unsigned char c)
-{
- ulong start;
-
- start = get_timer (0);
- while ((readl (&epcs->status) & NIOS_SPI_TRDY) == 0)
- if (get_timer (start) > EPCS_TIMEOUT)
- return (-1);
- writel (&epcs->txdata, c);
- return (0);
-}
-
-static int epcs_rx (void)
-{
- ulong start;
-
- start = get_timer (0);
- while ((readl (&epcs->status) & NIOS_SPI_RRDY) == 0)
- if (get_timer (start) > EPCS_TIMEOUT)
- return (-1);
- return (readl (&epcs->rxdata));
-}
-
-static unsigned char bitrev[] = {
- 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e,
- 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f
-};
-
-static unsigned char epcs_bitrev (unsigned char c)
-{
- unsigned char val;
-
- val = bitrev[c>>4];
- val |= bitrev[c & 0x0f]<<4;
- return (val);
-}
-
-static void epcs_rcv (unsigned char *dst, int len)
-{
- while (len--) {
- epcs_tx (0);
- *dst++ = epcs_rx ();
- }
-}
-
-static void epcs_rrcv (unsigned char *dst, int len)
-{
- while (len--) {
- epcs_tx (0);
- *dst++ = epcs_bitrev (epcs_rx ());
- }
-}
-
-static void epcs_snd (unsigned char *src, int len)
-{
- while (len--) {
- epcs_tx (*src++);
- epcs_rx ();
- }
-}
-
-static void epcs_rsnd (unsigned char *src, int len)
-{
- while (len--) {
- epcs_tx (epcs_bitrev (*src++));
- epcs_rx ();
- }
-}
-
-static void epcs_wr_enable (void)
-{
- epcs_cs (1);
- epcs_tx (EPCS_WRITE_ENA);
- epcs_rx ();
- epcs_cs (0);
-}
-
-static unsigned char epcs_status_rd (void)
-{
- unsigned char status;
-
- epcs_cs (1);
- epcs_tx (EPCS_READ_STAT);
- epcs_rx ();
- epcs_tx (0);
- status = epcs_rx ();
- epcs_cs (0);
- return (status);
-}
-
-static void epcs_status_wr (unsigned char status)
-{
- epcs_wr_enable ();
- epcs_cs (1);
- epcs_tx (EPCS_WRITE_STAT);
- epcs_rx ();
- epcs_tx (status);
- epcs_rx ();
- epcs_cs (0);
- return;
-}
-
-/***********************************************************************
- * Device information
- ***********************************************************************/
-
-static struct epcs_devinfo_t devinfo[] = {
- { "EPCS1 ", 0x10, 17, 4, 15, 8, 0x0c },
- { "EPCS4 ", 0x12, 19, 8, 16, 8, 0x1c },
- { 0, 0, 0, 0, 0, 0 }
-};
-
-int epcs_reset (void)
-{
- /* When booting from an epcs controller, the epcs bootrom
- * code may leave the slave select in an asserted state.
- * This causes two problems: (1) The initial epcs access
- * will fail -- not a big deal, and (2) a software reset
- * will cause the bootrom code to hang since it does not
- * ensure the select is negated prior to first access -- a
- * big deal. Here we just negate chip select and everything
- * gets better :-)
- */
- epcs_cs (0); /* Negate chip select */
- return (0);
-}
-
-epcs_devinfo_t *epcs_dev_find (void)
-{
- unsigned char buf[4];
- unsigned char id;
- int i;
- struct epcs_devinfo_t *dev = NULL;
-
- /* Read silicon id requires 3 "dummy bytes" before it's put
- * on the wire.
- */
- buf[0] = EPCS_READ_ID;
- buf[1] = 0;
- buf[2] = 0;
- buf[3] = 0;
-
- epcs_cs (1);
- epcs_snd (buf,4);
- epcs_rcv (buf,1);
- if (epcs_cs (0) == -1)
- return (NULL);
- id = buf[0];
-
- /* Find the info struct */
- i = 0;
- while (devinfo[i].name) {
- if (id == devinfo[i].id) {
- dev = &devinfo[i];
- break;
- }
- i++;
- }
-
- return (dev);
-}
-
-/***********************************************************************
- * Misc Utilities
- ***********************************************************************/
-int epcs_cfgsz (void)
-{
- int sz = 0;
- unsigned char buf[128];
- unsigned char *p;
- struct epcs_devinfo_t *dev = epcs_dev_find ();
-
- if (!dev)
- return (-1);
-
- /* Read in the first 128 bytes of the device */
- buf[0] = EPCS_READ_BYTES;
- buf[1] = 0;
- buf[2] = 0;
- buf[3] = 0;
-
- epcs_cs (1);
- epcs_snd (buf,4);
- epcs_rrcv (buf, sizeof(buf));
- epcs_cs (0);
-
- /* Search for the starting 0x6a which is followed by the
- * 4-byte 'register' and 4-byte bit-count.
- */
- p = buf;
- while (p < buf + sizeof(buf)-8) {
- if ( *p == 0x6a ) {
- /* Point to bit count and extract */
- p += 5;
- sz = *p++;
- sz |= *p++ << 8;
- sz |= *p++ << 16;
- sz |= *p++ << 24;
- /* Convert to byte count */
- sz += 7;
- sz >>= 3;
- } else if (*p == 0xff) {
- /* 0xff is ok ... just skip */
- p++;
- continue;
- } else {
- /* Not 0xff or 0x6a ... something's not
- * right ... report 'unknown' (sz=0).
- */
- break;
- }
- }
- return (sz);
-}
-
-int epcs_erase (unsigned start, unsigned end)
-{
- unsigned off, sectsz;
- unsigned char buf[4];
- struct epcs_devinfo_t *dev = epcs_dev_find ();
-
- if (!dev || (start>end))
- return (-1);
-
- /* Erase the requested sectors. An address is required
- * that lies within the requested sector -- we'll just
- * use the first address in the sector.
- */
- printf ("epcs erasing sector %d ", start);
- if (start != end)
- printf ("to %d ", end);
- sectsz = (1 << dev->sz_sect);
- while (start <= end) {
- off = start * sectsz;
- start++;
-
- buf[0] = EPCS_ERASE_SECT;
- buf[1] = off >> 16;
- buf[2] = off >> 8;
- buf[3] = off;
-
- epcs_wr_enable ();
- epcs_cs (1);
- epcs_snd (buf,4);
- epcs_cs (0);
-
- printf ("."); /* Some user feedback */
-
- /* Wait for erase to complete */
- while (epcs_status_rd() & EPCS_STATUS_WIP)
- ;
- }
- printf (" done.\n");
- return (0);
-}
-
-int epcs_read (ulong addr, ulong off, ulong cnt)
-{
- unsigned char buf[4];
- struct epcs_devinfo_t *dev = epcs_dev_find ();
-
- if (!dev)
- return (-1);
-
- buf[0] = EPCS_READ_BYTES;
- buf[1] = off >> 16;
- buf[2] = off >> 8;
- buf[3] = off;
-
- epcs_cs (1);
- epcs_snd (buf,4);
- epcs_rrcv ((unsigned char *)addr, cnt);
- epcs_cs (0);
-
- return (0);
-}
-
-int epcs_write (ulong addr, ulong off, ulong cnt)
-{
- ulong wrcnt;
- unsigned pgsz;
- unsigned char buf[4];
- struct epcs_devinfo_t *dev = epcs_dev_find ();
-
- if (!dev)
- return (-1);
-
- pgsz = (1<<dev->sz_page);
- while (cnt) {
- if (off % pgsz)
- wrcnt = pgsz - (off % pgsz);
- else
- wrcnt = pgsz;
- wrcnt = (wrcnt > cnt) ? cnt : wrcnt;
-
- buf[0] = EPCS_WRITE_BYTES;
- buf[1] = off >> 16;
- buf[2] = off >> 8;
- buf[3] = off;
-
- epcs_wr_enable ();
- epcs_cs (1);
- epcs_snd (buf,4);
- epcs_rsnd ((unsigned char *)addr, wrcnt);
- epcs_cs (0);
-
- /* Wait for write to complete */
- while (epcs_status_rd() & EPCS_STATUS_WIP)
- ;
-
- cnt -= wrcnt;
- off += wrcnt;
- addr += wrcnt;
- }
-
- return (0);
-}
-
-int epcs_verify (ulong addr, ulong off, ulong cnt, ulong *err)
-{
- ulong rdcnt;
- unsigned char buf[256];
- unsigned char *start,*end;
- int i;
-
- start = end = (unsigned char *)addr;
- while (cnt) {
- rdcnt = (cnt>sizeof(buf)) ? sizeof(buf) : cnt;
- epcs_read ((ulong)buf, off, rdcnt);
- for (i=0; i<rdcnt; i++) {
- if (*end != buf[i]) {
- *err = end - start;
- return(-1);
- }
- end++;
- }
- cnt -= rdcnt;
- off += rdcnt;
- }
- return (0);
-}
-
-static int epcs_sect_erased (int sect, unsigned *offset,
- struct epcs_devinfo_t *dev)
-{
- unsigned char buf[128];
- unsigned off, end;
- unsigned sectsz;
- int i;
-
- sectsz = (1 << dev->sz_sect);
- off = sectsz * sect;
- end = off + sectsz;
-
- while (off < end) {
- epcs_read ((ulong)buf, off, sizeof(buf));
- for (i=0; i < sizeof(buf); i++) {
- if (buf[i] != 0xff) {
- *offset = off + i;
- return (0);
- }
- }
- off += sizeof(buf);
- }
- return (1);
-}
-
-
-/***********************************************************************
- * Commands
- ***********************************************************************/
-static
-void do_epcs_info (struct epcs_devinfo_t *dev, int argc, char *argv[])
-{
- int i;
- unsigned char stat;
- unsigned tmp;
- int erased;
-
- /* Basic device info */
- printf ("%s: %d kbytes (%d sectors x %d kbytes,"
- " %d bytes/page)\n",
- dev->name, 1 << (dev->size-10),
- dev->num_sects, 1 << (dev->sz_sect-10),
- 1 << dev->sz_page );
-
- /* Status -- for now protection is all-or-nothing */
- stat = epcs_status_rd();
- printf ("status: 0x%02x (WIP:%d, WEL:%d, PROT:%s)\n",
- stat,
- (stat & EPCS_STATUS_WIP) ? 1 : 0,
- (stat & EPCS_STATUS_WEL) ? 1 : 0,
- (stat & dev->prot_mask) ? "on" : "off" );
-
- /* Configuration */
- tmp = epcs_cfgsz ();
- if (tmp) {
- printf ("config: 0x%06x (%d) bytes\n", tmp, tmp );
- } else {
- printf ("config: unknown\n" );
- }
-
- /* Sector info */
- for (i=0; i<dev->num_sects; i++) {
- erased = epcs_sect_erased (i, &tmp, dev);
- printf (" %d: %06x ",
- i, i*(1<<dev->sz_sect) );
- if (erased)
- printf ("erased\n");
- else
- printf ("data @ 0x%06x\n", tmp);
- }
-
- return;
-}
-
-static
-void do_epcs_erase (struct epcs_devinfo_t *dev, int argc, char *argv[])
-{
- unsigned start,end;
-
- if ((argc < 3) || (argc > 4)) {
- printf ("USAGE: epcs erase sect [end]\n");
- return;
- }
- if ((epcs_status_rd() & dev->prot_mask) != 0) {
- printf ( "epcs: device protected.\n");
- return;
- }
-
- start = simple_strtoul (argv[2], NULL, 10);
- if (argc > 3)
- end = simple_strtoul (argv[3], NULL, 10);
- else
- end = start;
- if ((start >= dev->num_sects) || (start > end)) {
- printf ("epcs: invalid sector range: [%d:%d]\n",
- start, end );
- return;
- }
-
- epcs_erase (start, end);
-
- return;
-}
-
-static
-void do_epcs_protect (struct epcs_devinfo_t *dev, int argc, char *argv[])
-{
- unsigned char stat;
-
- /* For now protection is all-or-nothing to keep things
- * simple. The protection bits don't map in a linear
- * fashion ... and we would rather protect the bottom
- * of the device since it contains the config data and
- * leave the top unprotected for app use. But unfortunately
- * protection works from top-to-bottom so it does
- * really help very much from a software app point-of-view.
- */
- if (argc < 3) {
- printf ("USAGE: epcs protect on | off\n");
- return;
- }
- if (!dev)
- return;
-
- /* Protection on/off is just a matter of setting/clearing
- * all protection bits in the status register.
- */
- stat = epcs_status_rd ();
- if (strcmp ("on", argv[2]) == 0) {
- stat |= dev->prot_mask;
- } else if (strcmp ("off", argv[2]) == 0 ) {
- stat &= ~dev->prot_mask;
- } else {
- printf ("epcs: unknown protection: %s\n", argv[2]);
- return;
- }
- epcs_status_wr (stat);
- return;
-}
-
-static
-void do_epcs_read (struct epcs_devinfo_t *dev, int argc, char *argv[])
-{
- ulong addr,off,cnt;
- ulong sz;
-
- if (argc < 5) {
- printf ("USAGE: epcs read addr offset count\n");
- return;
- }
-
- sz = 1 << dev->size;
- addr = simple_strtoul (argv[2], NULL, 16);
- off = simple_strtoul (argv[3], NULL, 16);
- cnt = simple_strtoul (argv[4], NULL, 16);
- if (off > sz) {
- printf ("offset is greater than device size"
- "... aborting.\n");
- return;
- }
- if ((off + cnt) > sz) {
- printf ("request exceeds device size"
- "... truncating.\n");
- cnt = sz - off;
- }
- printf ("epcs: read %08lx <- %06lx (0x%lx bytes)\n",
- addr, off, cnt);
- epcs_read (addr, off, cnt);
-
- return;
-}
-
-static
-void do_epcs_write (struct epcs_devinfo_t *dev, int argc, char *argv[])
-{
- ulong addr,off,cnt;
- ulong sz;
- ulong err;
-
- if (argc < 5) {
- printf ("USAGE: epcs write addr offset count\n");
- return;
- }
- if ((epcs_status_rd() & dev->prot_mask) != 0) {
- printf ( "epcs: device protected.\n");
- return;
- }
-
- sz = 1 << dev->size;
- addr = simple_strtoul (argv[2], NULL, 16);
- off = simple_strtoul (argv[3], NULL, 16);
- cnt = simple_strtoul (argv[4], NULL, 16);
- if (off > sz) {
- printf ("offset is greater than device size"
- "... aborting.\n");
- return;
- }
- if ((off + cnt) > sz) {
- printf ("request exceeds device size"
- "... truncating.\n");
- cnt = sz - off;
- }
- printf ("epcs: write %08lx -> %06lx (0x%lx bytes)\n",
- addr, off, cnt);
- epcs_write (addr, off, cnt);
- if (epcs_verify (addr, off, cnt, &err) != 0)
- printf ("epcs: write error at offset %06lx\n", err);
-
- return;
-}
-
-static
-void do_epcs_verify (struct epcs_devinfo_t *dev, int argc, char *argv[])
-{
- ulong addr,off,cnt;
- ulong sz;
- ulong err;
-
- if (argc < 5) {
- printf ("USAGE: epcs verify addr offset count\n");
- return;
- }
-
- sz = 1 << dev->size;
- addr = simple_strtoul (argv[2], NULL, 16);
- off = simple_strtoul (argv[3], NULL, 16);
- cnt = simple_strtoul (argv[4], NULL, 16);
- if (off > sz) {
- printf ("offset is greater than device size"
- "... aborting.\n");
- return;
- }
- if ((off + cnt) > sz) {
- printf ("request exceeds device size"
- "... truncating.\n");
- cnt = sz - off;
- }
- printf ("epcs: verify %08lx -> %06lx (0x%lx bytes)\n",
- addr, off, cnt);
- if (epcs_verify (addr, off, cnt, &err) != 0)
- printf ("epcs: verify error at offset %06lx\n", err);
-
- return;
-}
-
-/*-----------------------------------------------------------------------*/
-int do_epcs (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- int len;
- struct epcs_devinfo_t *dev = epcs_dev_find ();
-
- if (!dev) {
- printf ("epcs: device not found.\n");
- return (-1);
- }
-
- if (argc < 2) {
- do_epcs_info (dev, argc, argv);
- return (0);
- }
-
- len = strlen (argv[1]);
- if (strncmp ("info", argv[1], len) == 0) {
- do_epcs_info (dev, argc, argv);
- } else if (strncmp ("erase", argv[1], len) == 0) {
- do_epcs_erase (dev, argc, argv);
- } else if (strncmp ("protect", argv[1], len) == 0) {
- do_epcs_protect (dev, argc, argv);
- } else if (strncmp ("read", argv[1], len) == 0) {
- do_epcs_read (dev, argc, argv);
- } else if (strncmp ("write", argv[1], len) == 0) {
- do_epcs_write (dev, argc, argv);
- } else if (strncmp ("verify", argv[1], len) == 0) {
- do_epcs_verify (dev, argc, argv);
- } else {
- printf ("epcs: unknown operation: %s\n", argv[1]);
- }
-
- return (0);
-}
-
-/*-----------------------------------------------------------------------*/
-
-
-U_BOOT_CMD( epcs, 5, 0, do_epcs, SHORT_HELP, LONG_HELP );
-
-#endif /* CONFIG_NIOS_EPCS */
diff --git a/cpu/nios2/exceptions.S b/cpu/nios2/exceptions.S
deleted file mode 100644
index b9c7a587e1..0000000000
--- a/cpu/nios2/exceptions.S
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <asm/opcodes.h>
-
-
- .text
- .align 4
-
- .global _exception
-
- .set noat
- .set nobreak
-
-_exception:
- /* SAVE ALL REGS -- this allows trap and unimplemented
- * instruction handlers to be coded conveniently in C
- */
- addi sp, sp, -(33*4)
- stw r0, 0(sp)
- stw r1, 4(sp)
- stw r2, 8(sp)
- stw r3, 12(sp)
- stw r4, 16(sp)
- stw r5, 20(sp)
- stw r6, 24(sp)
- stw r7, 28(sp)
- stw r8, 32(sp)
- stw r9, 36(sp)
- stw r10, 40(sp)
- stw r11, 44(sp)
- stw r12, 48(sp)
- stw r13, 52(sp)
- stw r14, 56(sp)
- stw r15, 60(sp)
- stw r16, 64(sp)
- stw r17, 68(sp)
- stw r19, 72(sp)
- stw r19, 76(sp)
- stw r20, 80(sp)
- stw r21, 84(sp)
- stw r22, 88(sp)
- stw r23, 92(sp)
- stw r24, 96(sp)
- stw r25, 100(sp)
- stw r26, 104(sp)
- stw r27, 108(sp)
- stw r28, 112(sp)
- stw r29, 116(sp)
- stw r30, 120(sp)
- stw r31, 124(sp)
- rdctl et, estatus
- stw et, 128(sp)
-
- /* If interrupts are disabled -- software interrupt */
- rdctl et, estatus
- andi et, et, 1
- beq et, r0, 0f
-
- /* If no interrupts are pending -- software interrupt */
- rdctl et, ipending
- beq et, r0, 0f
-
- /* HARDWARE INTERRUPT: Call interrupt handler */
- movhi r3, %hi(external_interrupt)
- ori r3, r3, %lo(external_interrupt)
- mov r4, sp /* ptr to regs */
- callr r3
-
- /* Return address fixup: execution resumes by re-issue of
- * interrupted instruction at ea-4 (ea == r29). Here we do
- * simple fixup to allow common exception return.
- */
- ldw r3, 116(sp)
- addi r3, r3, -4
- stw r3, 116(sp)
- br _exception_return
-
-0:
- /* TRAP EXCEPTION */
- movhi r3, %hi(OPC_TRAP)
- ori r3, r3, %lo(OPC_TRAP)
- addi r1, ea, -4
- ldw r1, 0(r1)
- bne r1, r3, 1f
- movhi r3, %hi(trap_handler)
- ori r3, r3, %lo(trap_handler)
- mov r4, sp /* ptr to regs */
- callr r3
- br _exception_return
-
-1:
- /* UNIMPLEMENTED INSTRUCTION EXCEPTION */
- movhi r3, %hi(soft_emulation)
- ori r3, r3, %lo(soft_emulation)
- mov r4, sp /* ptr to regs */
- callr r3
-
- /* Restore regsisters and return from exception*/
-_exception_return:
- ldw r1, 4(sp)
- ldw r2, 8(sp)
- ldw r3, 12(sp)
- ldw r4, 16(sp)
- ldw r5, 20(sp)
- ldw r6, 24(sp)
- ldw r7, 28(sp)
- ldw r8, 32(sp)
- ldw r9, 36(sp)
- ldw r10, 40(sp)
- ldw r11, 44(sp)
- ldw r12, 48(sp)
- ldw r13, 52(sp)
- ldw r14, 56(sp)
- ldw r15, 60(sp)
- ldw r16, 64(sp)
- ldw r17, 68(sp)
- ldw r19, 72(sp)
- ldw r19, 76(sp)
- ldw r20, 80(sp)
- ldw r21, 84(sp)
- ldw r22, 88(sp)
- ldw r23, 92(sp)
- ldw r24, 96(sp)
- ldw r25, 100(sp)
- ldw r26, 104(sp)
- ldw r27, 108(sp)
- ldw r28, 112(sp)
- ldw r29, 116(sp)
- ldw r30, 120(sp)
- ldw r31, 124(sp)
- addi sp, sp, (33*4)
- eret
-/*-------------------------------------------------------------*/
diff --git a/cpu/nios2/interrupts.c b/cpu/nios2/interrupts.c
deleted file mode 100644
index 4685161b88..0000000000
--- a/cpu/nios2/interrupts.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <nios2.h>
-#include <nios2-io.h>
-#include <asm/io.h>
-#include <asm/ptrace.h>
-#include <common.h>
-#include <command.h>
-#include <watchdog.h>
-#ifdef CONFIG_STATUS_LED
-#include <status_led.h>
-#endif
-
-#if defined(CFG_NIOS_TMRBASE) && !defined(CFG_NIOS_TMRIRQ)
-#error CFG_NIOS_TMRIRQ not defined (see documentation)
-#endif
-
-/****************************************************************************/
-
-struct irq_action {
- interrupt_handler_t *handler;
- void *arg;
- int count;
-};
-
-static struct irq_action vecs[32];
-
-/*************************************************************************/
-volatile ulong timestamp = 0;
-
-void reset_timer (void)
-{
- timestamp = 0;
-}
-
-ulong get_timer (ulong base)
-{
- WATCHDOG_RESET ();
- return (timestamp - base);
-}
-
-void set_timer (ulong t)
-{
- timestamp = t;
-}
-
-
-/* The board must handle this interrupt if a timer is not
- * provided.
- */
-#if defined(CFG_NIOS_TMRBASE)
-void tmr_isr (void *arg)
-{
- nios_timer_t *tmr = (nios_timer_t *)arg;
- /* Interrupt is cleared by writing anything to the
- * status register.
- */
- writel (&tmr->status, 0);
- timestamp += CFG_NIOS_TMRMS;
-#ifdef CONFIG_STATUS_LED
- status_led_tick(timestamp);
-#endif
-}
-
-static void tmr_init (void)
-{
- nios_timer_t *tmr =(nios_timer_t *)CFG_NIOS_TMRBASE;
-
- writel (&tmr->status, 0);
- writel (&tmr->control, 0);
- writel (&tmr->control, NIOS_TIMER_STOP);
-
-#if defined(CFG_NIOS_TMRCNT)
- writel (&tmr->periodl, CFG_NIOS_TMRCNT & 0xffff);
- writel (&tmr->periodh, (CFG_NIOS_TMRCNT >> 16) & 0xffff);
-#endif
- writel (&tmr->control, NIOS_TIMER_ITO | NIOS_TIMER_CONT |
- NIOS_TIMER_START );
- irq_install_handler (CFG_NIOS_TMRIRQ, tmr_isr, (void *)tmr);
-}
-
-#endif /* CFG_NIOS_TMRBASE */
-
-/*************************************************************************/
-int disable_interrupts (void)
-{
- int val = rdctl (CTL_STATUS);
- wrctl (CTL_STATUS, val & ~STATUS_IE);
- return (val & STATUS_IE);
-}
-
-void enable_interrupts( void )
-{
- int val = rdctl (CTL_STATUS);
- wrctl (CTL_STATUS, val | STATUS_IE);
-}
-
-void external_interrupt (struct pt_regs *regs)
-{
- unsigned irqs;
- struct irq_action *act;
-
- /* Evaluate only irqs that are both enabled AND pending */
- irqs = rdctl (CTL_IENABLE) & rdctl (CTL_IPENDING);
- act = vecs;
-
- /* Assume (as does the Nios2 HAL) that bit 0 is highest
- * priority. NOTE: There is ALWAYS a handler assigned
- * (the default if no other).
- */
- while (irqs) {
- if (irqs & 1) {
- act->handler (act->arg);
- act->count++;
- }
- irqs >>=1;
- act++;
- }
-}
-
-static void def_hdlr (void *arg)
-{
- unsigned irqs = rdctl (CTL_IENABLE);
-
- /* Disable the individual interrupt -- with gratuitous
- * warning.
- */
- irqs &= ~(1 << (int)arg);
- wrctl (CTL_IENABLE, irqs);
- printf ("WARNING: Disabling unhandled interrupt: %d\n",
- (int)arg);
-}
-
-/*************************************************************************/
-void irq_install_handler (int irq, interrupt_handler_t *hdlr, void *arg)
-{
-
- int flag;
- struct irq_action *act;
- unsigned ena = rdctl (CTL_IENABLE);
-
- if ((irq < 0) || (irq > 31))
- return;
- act = &vecs[irq];
-
- flag = disable_interrupts ();
- if (hdlr) {
- act->handler = hdlr;
- act->arg = arg;
- ena |= (1 << irq); /* enable */
- } else {
- act->handler = def_hdlr;
- act->arg = (void *)irq;
- ena &= ~(1 << irq); /* disable */
- }
- wrctl (CTL_IENABLE, ena);
- if (flag) enable_interrupts ();
-}
-
-
-int interrupt_init (void)
-{
- int i;
-
- /* Assign the default handler to all */
- for (i = 0; i < 32; i++) {
- vecs[i].handler = def_hdlr;
- vecs[i].arg = (void *)i;
- vecs[i].count = 0;
- }
-
-#if defined(CFG_NIOS_TMRBASE)
- tmr_init ();
-#endif
-
- enable_interrupts ();
- return (0);
-}
-
-
-/*************************************************************************/
-#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
-int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- int i;
- struct irq_action *act = vecs;
-
- printf ("\nInterrupt-Information:\n\n");
- printf ("Nr Routine Arg Count\n");
- printf ("-----------------------------\n");
-
- for (i=0; i<32; i++) {
- if (act->handler != def_hdlr) {
- printf ("%02d %08lx %08lx %d\n",
- i,
- (ulong)act->handler,
- (ulong)act->arg,
- act->count);
- }
- act++;
- }
- printf ("\n");
-
- return (0);
-}
-#endif /* CONFIG_COMMANDS & CFG_CMD_IRQ */
diff --git a/cpu/nios2/start.S b/cpu/nios2/start.S
deleted file mode 100644
index 4c6e47066a..0000000000
--- a/cpu/nios2/start.S
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-
-/*************************************************************************
- * RESTART
- ************************************************************************/
-
- .text
- .global _start
-
-_start:
- /* ICACHE INIT -- only the icache line at the reset address
- * is invalidated at reset. So the init must stay within
- * the cache line size (8 words). If GERMS is used, we'll
- * just be invalidating the cache a second time. If cache
- * is not implemented initi behaves as nop.
- */
- ori r4, r0, %lo(CFG_ICACHELINE_SIZE)
- movhi r5, %hi(CFG_ICACHE_SIZE)
- ori r5, r5, %lo(CFG_ICACHE_SIZE)
- mov r6, r0
-0: initi r6
- add r6, r6, r4
- bltu r6, r5, 0b
- br _except_end /* Skip the tramp */
-
- /* EXCEPTION TRAMPOLINE -- the following gets copied
- * to the exception address (below), but is otherwise at the
- * default exception vector offset (0x0020).
- */
-_except_start:
- movhi et, %hi(_exception)
- ori et, et, %lo(_exception)
- jmp et
-_except_end:
-
- /* INTERRUPTS -- for now, all interrupts masked and globally
- * disabled.
- */
- wrctl status, r0 /* Disable interrupts */
- wrctl ienable, r0 /* All disabled */
-
- /* DCACHE INIT -- if dcache not implemented, initd behaves as
- * nop.
- */
- movhi r4, %hi(CFG_DCACHELINE_SIZE)
- ori r4, r4, %lo(CFG_DCACHELINE_SIZE)
- movhi r5, %hi(CFG_DCACHE_SIZE)
- ori r5, r5, %lo(CFG_DCACHE_SIZE)
- mov r6, r0
-1: initd 0(r6)
- add r6, r6, r4
- bltu r6, r5, 1b
-
- /* RELOCATE CODE, DATA & COMMAND TABLE -- the following code
- * assumes code, data and the command table are all
- * contiguous. This lets us relocate everything as a single
- * block. Make sure the linker script matches this ;-)
- */
- nextpc r4
-_cur: movhi r5, %hi(_cur - _start)
- ori r5, r5, %lo(_cur - _start)
- sub r4, r4, r5 /* r4 <- cur _start */
- mov r8, r4
- movhi r5, %hi(_start)
- ori r5, r5, %lo(_start) /* r5 <- linked _start */
- beq r4, r5, 3f
-
- movhi r6, %hi(_edata)
- ori r6, r6, %lo(_edata)
-2: ldwio r7, 0(r4)
- addi r4, r4, 4
- stwio r7, 0(r5)
- addi r5, r5, 4
- bne r5, r6, 2b
-3:
-
- /* ZERO BSS/SBSS -- bss and sbss are assumed to be adjacent
- * and between __bss_start and _end.
- */
- movhi r5, %hi(__bss_start)
- ori r5, r5, %lo(__bss_start)
- movhi r6, %hi(_end)
- ori r6, r6, %lo(_end)
- beq r5, r6, 5f
-
-4: stwio r0, 0(r5)
- addi r5, r5, 4
- bne r5, r6, 4b
-5:
-
- /* GLOBAL POINTER -- the global pointer is used to reference
- * "small data" (see -G switch). The linker script must
- * provide the gp address.
- */
- movhi gp, %hi(_gp)
- ori gp, gp, %lo(_gp)
-
- /* JUMP TO RELOC ADDR */
- movhi r4, %hi(_reloc)
- ori r4, r4, %lo(_reloc)
- jmp r4
-_reloc:
-
- /* COPY EXCEPTION TRAMPOLINE -- copy the tramp to the
- * exception address. Define CONFIG_ROM_STUBS to prevent
- * the copy (e.g. exception in flash or in other
- * softare/firmware component).
- */
-#if !defined(CONFIG_ROM_STUBS)
- movhi r4, %hi(_except_start)
- ori r4, r4, %lo(_except_start)
- movhi r5, %hi(_except_end)
- ori r5, r5, %lo(_except_end)
- movhi r6, %hi(CFG_EXCEPTION_ADDR)
- ori r6, r6, %lo(CFG_EXCEPTION_ADDR)
- beq r4, r6, 7f /* Skip if at proper addr */
-
-6: ldwio r7, 0(r4)
- stwio r7, 0(r6)
- addi r4, r4, 4
- addi r6, r6, 4
- bne r4, r5, 6b
-7:
-#endif
-
- /* STACK INIT -- zero top two words for call back chain.
- */
- movhi sp, %hi(CFG_INIT_SP)
- ori sp, sp, %lo(CFG_INIT_SP)
- addi sp, sp, -8
- stw r0, 0(sp)
- stw r0, 4(sp)
- mov fp, sp
-
- /*
- * Call board_init -- never returns
- */
- movhi r4, %hi(board_init@h)
- ori r4, r4, %lo(board_init@h)
- callr r4
-
- /* NEVER RETURNS -- but branch to the _start just
- * in case ;-)
- */
- br _start
-
-
-/*
- * dly_clks -- Nios2 (like Nios1) doesn't have a timebase in
- * the core. For simple delay loops, we do our best by counting
- * instruction cycles.
- *
- * Instruction performance varies based on the core. For cores
- * with icache and static/dynamic branch prediction (II/f, II/s):
- *
- * Normal ALU (e.g. add, cmp, etc): 1 cycle
- * Branch (correctly predicted, taken): 2 cycles
- * Negative offset is predicted (II/s).
- *
- * For cores without icache and no branch prediction (II/e):
- *
- * Normal ALU (e.g. add, cmp, etc): 6 cycles
- * Branch (no prediction): 6 cycles
- *
- * For simplicity, if an instruction cache is implemented we
- * assume II/f or II/s. Otherwise, we use the II/e.
- *
- */
- .globl dly_clks
-
-dly_clks:
-
-#if (CFG_ICACHE_SIZE > 0)
- subi r4, r4, 3 /* 3 clocks/loop */
-#else
- subi r4, r4, 12 /* 12 clocks/loop */
-#endif
- bge r4, r0, dly_clks
- ret
-
-
-#if !defined(CONFIG_IDENT_STRING)
-#define CONFIG_IDENT_STRING ""
-#endif
- .data
- .globl version_string
-
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
diff --git a/cpu/nios2/sysid.c b/cpu/nios2/sysid.c
deleted file mode 100644
index b5a29593ea..0000000000
--- a/cpu/nios2/sysid.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-#if defined (CFG_NIOS_SYSID_BASE)
-
-#include <command.h>
-#include <asm/io.h>
-#include <nios2-io.h>
-#include <linux/time.h>
-
-void display_sysid (void)
-{
- struct nios_sysid_t *sysid = (struct nios_sysid_t *)CFG_NIOS_SYSID_BASE;
- struct tm t;
- char asc[32];
- time_t stamp;
-
- stamp = readl (&sysid->timestamp);
- localtime_r (&stamp, &t);
- asctime_r (&t, asc);
- printf ("SYSID : %08x, %s", readl (&sysid->id), asc);
-
-}
-
-int do_sysid (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- display_sysid ();
- return (0);
-}
-
-U_BOOT_CMD(
- sysid, 1, 1, do_sysid,
- "sysid - display Nios-II system id\n\n",
- "\n - display Nios-II system id\n"
-);
-#endif /* CFG_NIOS_SYSID_BASE */
diff --git a/cpu/nios2/traps.c b/cpu/nios2/traps.c
deleted file mode 100644
index 3f1517d61b..0000000000
--- a/cpu/nios2/traps.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <asm/ptrace.h>
-#include <common.h>
-
-void trap_handler (struct pt_regs *regs)
-{
- /* Just issue warning */
- printf ("\n\n*** WARNING: unimplemented trap @ %08x\n\n",
- regs->reg[29] - 4);
-}
-
-void soft_emulation (struct pt_regs *regs)
-{
- /* TODO: Software emulation of mul/div etc. Until this is
- * implemented, generate warning and hang.
- */
- printf ("\n\n*** ERROR: unimplemented instruction @ %08x\n",
- regs->reg[29] - 4);
- hang ();
-}
diff --git a/cpu/ppc4xx/405gp_pci.c b/cpu/ppc4xx/405gp_pci.c
deleted file mode 100644
index 9b711e2ebf..0000000000
--- a/cpu/ppc4xx/405gp_pci.c
+++ /dev/null
@@ -1,578 +0,0 @@
-/*-----------------------------------------------------------------------------+
- *
- * This source code has been made available to you by IBM on an AS-IS
- * basis. Anyone receiving this source is licensed under IBM
- * copyrights to use it in any way he or she deems fit, including
- * copying it, modifying it, compiling it, and redistributing it either
- * with or without modifications. No license under IBM patents or
- * patent applications is to be implied by the copyright license.
- *
- * Any user of this software should understand that IBM cannot provide
- * technical support for this software and will not be responsible for
- * any consequences resulting from the use of this software.
- *
- * Any person who transfers this source code or any derivative work
- * must include the IBM copyright notice, this paragraph, and the
- * preceding two paragraphs in the transferred software.
- *
- * COPYRIGHT I B M CORPORATION 1995
- * LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
- *-----------------------------------------------------------------------------*/
-/*----------------------------------------------------------------------------+
- *
- * File Name: 405gp_pci.c
- *
- * Function: Initialization code for the 405GP PCI Configuration regs.
- *
- * Author: Mark Game
- *
- * Change Activity-
- *
- * Date Description of Change BY
- * --------- --------------------- ---
- * 09-Sep-98 Created MCG
- * 02-Nov-98 Removed External arbiter selected message JWB
- * 27-Nov-98 Zero out PTMBAR2 and disable in PTM2MS JWB
- * 04-Jan-99 Zero out other unused PMM and PTM regs. Change bus scan MCG
- * from (0 to n) to (1 to n).
- * 17-May-99 Port to Walnut JWB
- * 17-Jun-99 Updated for VGA support JWB
- * 21-Jun-99 Updated to allow SRAM region to be a target from PCI bus JWB
- * 19-Jul-99 Updated for 405GP pass 1 errata #26 (Low PCI subsequent MCG
- * target latency timer values are not supported).
- * Should be fixed in pass 2.
- * 09-Sep-99 Removed use of PTM2 since the SRAM region no longer needs JWB
- * to be a PCI target. Zero out PTMBAR2 and disable in PTM2MS.
- * 10-Dec-99 Updated PCI_Write_CFG_Reg for pass2 errata #6 JWB
- * 11-Jan-00 Ensure PMMxMAs disabled before setting PMMxLAs. This is not
- * really required after a reset since PMMxMAs are already
- * disabled but is a good practice nonetheless. JWB
- * 12-Jun-01 stefan.roese@esd-electronics.com
- * - PCI host/adapter handling reworked
- * 09-Jul-01 stefan.roese@esd-electronics.com
- * - PCI host now configures from device 0 (not 1) to max_dev,
- * (host configures itself)
- * - On CPCI-405 pci base address and size is generated from
- * SDRAM and FLASH size (CFG regs not used anymore)
- * - Some minor changes for CPCI-405-A (adapter version)
- * 14-Sep-01 stefan.roese@esd-electronics.com
- * - CONFIG_PCI_SCAN_SHOW added to print pci devices upon startup
- * 28-Sep-01 stefan.roese@esd-electronics.com
- * - Changed pci master configuration for linux compatibility
- * (no need for bios_fixup() anymore)
- * 26-Feb-02 stefan.roese@esd-electronics.com
- * - Bug fixed in pci configuration (Andrew May)
- * - Removed pci class code init for CPCI405 board
- * 15-May-02 stefan.roese@esd-electronics.com
- * - New vga device handling
- * 29-May-02 stefan.roese@esd-electronics.com
- * - PCI class code init added (if defined)
- *----------------------------------------------------------------------------*/
-
-#include <common.h>
-#include <command.h>
-#if !defined(CONFIG_440)
-#include <405gp_pci.h>
-#endif
-#include <asm/processor.h>
-#include <pci.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
-
-#ifdef CONFIG_PCI
-
-#if defined(CONFIG_PMC405)
-ushort pmc405_pci_subsys_deviceid(void);
-#endif
-
-/*#define DEBUG*/
-
-/*-----------------------------------------------------------------------------+
- * pci_init. Initializes the 405GP PCI Configuration regs.
- *-----------------------------------------------------------------------------*/
-void pci_405gp_init(struct pci_controller *hose)
-{
- int i, reg_num = 0;
- bd_t *bd = gd->bd;
-
- unsigned short temp_short;
- unsigned long ptmpcila[2] = {CFG_PCI_PTM1PCI, CFG_PCI_PTM2PCI};
-#if defined(CONFIG_CPCI405) || defined(CONFIG_PMC405)
- char *ptmla_str, *ptmms_str;
-#endif
- unsigned long ptmla[2] = {CFG_PCI_PTM1LA, CFG_PCI_PTM2LA};
- unsigned long ptmms[2] = {CFG_PCI_PTM1MS, CFG_PCI_PTM2MS};
-#if defined(CONFIG_PIP405) || defined (CONFIG_MIP405)
- unsigned long pmmla[3] = {0x80000000, 0xA0000000, 0};
- unsigned long pmmma[3] = {0xE0000001, 0xE0000001, 0};
- unsigned long pmmpcila[3] = {0x80000000, 0x00000000, 0};
- unsigned long pmmpciha[3] = {0x00000000, 0x00000000, 0};
-#else
- unsigned long pmmla[3] = {0x80000000, 0,0};
- unsigned long pmmma[3] = {0xC0000001, 0,0};
- unsigned long pmmpcila[3] = {0x80000000, 0,0};
- unsigned long pmmpciha[3] = {0x00000000, 0,0};
-#endif
-#ifdef CONFIG_PCI_PNP
-#if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
- char *s;
-#endif
-#endif
-
-#if defined(CONFIG_CPCI405) || defined(CONFIG_PMC405)
- ptmla_str = getenv("ptm1la");
- ptmms_str = getenv("ptm1ms");
- if(NULL != ptmla_str && NULL != ptmms_str ) {
- ptmla[0] = simple_strtoul (ptmla_str, NULL, 16);
- ptmms[0] = simple_strtoul (ptmms_str, NULL, 16);
- }
-
- ptmla_str = getenv("ptm2la");
- ptmms_str = getenv("ptm2ms");
- if(NULL != ptmla_str && NULL != ptmms_str ) {
- ptmla[1] = simple_strtoul (ptmla_str, NULL, 16);
- ptmms[1] = simple_strtoul (ptmms_str, NULL, 16);
- }
-#endif
-
- /*
- * Register the hose
- */
- hose->first_busno = 0;
- hose->last_busno = 0xff;
-
- /* ISA/PCI I/O space */
- pci_set_region(hose->regions + reg_num++,
- MIN_PCI_PCI_IOADDR,
- MIN_PLB_PCI_IOADDR,
- 0x10000,
- PCI_REGION_IO);
-
- /* PCI I/O space */
- pci_set_region(hose->regions + reg_num++,
- 0x00800000,
- 0xe8800000,
- 0x03800000,
- PCI_REGION_IO);
-
- reg_num = 2;
-
- /* Memory spaces */
- for (i=0; i<2; i++)
- if (ptmms[i] & 1)
- {
- if (!i) hose->pci_fb = hose->regions + reg_num;
-
- pci_set_region(hose->regions + reg_num++,
- ptmpcila[i], ptmla[i],
- ~(ptmms[i] & 0xfffff000) + 1,
- PCI_REGION_MEM |
- PCI_REGION_MEMORY);
- }
-
- /* PCI memory spaces */
- for (i=0; i<3; i++)
- if (pmmma[i] & 1)
- {
- pci_set_region(hose->regions + reg_num++,
- pmmpcila[i], pmmla[i],
- ~(pmmma[i] & 0xfffff000) + 1,
- PCI_REGION_MEM);
- }
-
- hose->region_count = reg_num;
-
- pci_setup_indirect(hose,
- PCICFGADR,
- PCICFGDATA);
-
- if (hose->pci_fb)
- pciauto_region_init(hose->pci_fb);
-
- pci_register_hose(hose);
-
- /*--------------------------------------------------------------------------+
- * 405GP PCI Master configuration.
- * Map one 512 MB range of PLB/processor addresses to PCI memory space.
- * PLB address 0x80000000-0xBFFFFFFF ==> PCI address 0x80000000-0xBFFFFFFF
- * Use byte reversed out routines to handle endianess.
- *--------------------------------------------------------------------------*/
- out32r(PMM0MA, (pmmma[0]&~0x1)); /* disable, configure PMMxLA, PMMxPCILA first */
- out32r(PMM0LA, pmmla[0]);
- out32r(PMM0PCILA, pmmpcila[0]);
- out32r(PMM0PCIHA, pmmpciha[0]);
- out32r(PMM0MA, pmmma[0]);
-
- /*--------------------------------------------------------------------------+
- * PMM1 is not used. Initialize them to zero.
- *--------------------------------------------------------------------------*/
- out32r(PMM1MA, (pmmma[1]&~0x1));
- out32r(PMM1LA, pmmla[1]);
- out32r(PMM1PCILA, pmmpcila[1]);
- out32r(PMM1PCIHA, pmmpciha[1]);
- out32r(PMM1MA, pmmma[1]);
-
- /*--------------------------------------------------------------------------+
- * PMM2 is not used. Initialize them to zero.
- *--------------------------------------------------------------------------*/
- out32r(PMM2MA, (pmmma[2]&~0x1));
- out32r(PMM2LA, pmmla[2]);
- out32r(PMM2PCILA, pmmpcila[2]);
- out32r(PMM2PCIHA, pmmpciha[2]);
- out32r(PMM2MA, pmmma[2]);
-
- /*--------------------------------------------------------------------------+
- * 405GP PCI Target configuration. (PTM1)
- * Note: PTM1MS is hardwire enabled but we set the enable bit anyway.
- *--------------------------------------------------------------------------*/
- out32r(PTM1LA, ptmla[0]); /* insert address */
- out32r(PTM1MS, ptmms[0]); /* insert size, enable bit is 1 */
- pci_write_config_dword(PCIDEVID_405GP, PCI_BASE_ADDRESS_1, ptmpcila[0]);
-
- /*--------------------------------------------------------------------------+
- * 405GP PCI Target configuration. (PTM2)
- *--------------------------------------------------------------------------*/
- out32r(PTM2LA, ptmla[1]); /* insert address */
- pci_write_config_dword(PCIDEVID_405GP, PCI_BASE_ADDRESS_2, ptmpcila[1]);
-
- if (ptmms[1] == 0)
- {
- out32r(PTM2MS, 0x00000001); /* set enable bit */
- pci_write_config_dword(PCIDEVID_405GP, PCI_BASE_ADDRESS_2, 0x00000000);
- out32r(PTM2MS, 0x00000000); /* disable */
- }
- else
- {
- out32r(PTM2MS, ptmms[1]); /* insert size, enable bit is 1 */
- }
-
- /*
- * Insert Subsystem Vendor and Device ID
- */
- pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_VENDOR_ID, CFG_PCI_SUBSYS_VENDORID);
-#ifdef CONFIG_CPCI405
- if (mfdcr(strap) & PSR_PCI_ARBIT_EN)
- pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_ID, CFG_PCI_SUBSYS_DEVICEID);
- else
- pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_ID, CFG_PCI_SUBSYS_DEVICEID2);
-#else
- pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_ID, CFG_PCI_SUBSYS_DEVICEID);
-#endif
-
- /*
- * Insert Class-code
- */
-#ifdef CFG_PCI_CLASSCODE
- pci_write_config_word(PCIDEVID_405GP, PCI_CLASS_SUB_CODE, CFG_PCI_CLASSCODE);
-#endif /* CFG_PCI_CLASSCODE */
-
- /*--------------------------------------------------------------------------+
- * If PCI speed = 66Mhz, set 66Mhz capable bit.
- *--------------------------------------------------------------------------*/
- if (bd->bi_pci_busfreq >= 66000000) {
- pci_read_config_word(PCIDEVID_405GP, PCI_STATUS, &temp_short);
- pci_write_config_word(PCIDEVID_405GP,PCI_STATUS,(temp_short|PCI_STATUS_66MHZ));
- }
-
-#if (CONFIG_PCI_HOST != PCI_HOST_ADAPTER)
-#if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
- if ((mfdcr(strap) & PSR_PCI_ARBIT_EN) ||
- (((s = getenv("pciscan")) != NULL) && (strcmp(s, "yes") == 0)))
-#endif
- {
- /*--------------------------------------------------------------------------+
- * Write the 405GP PCI Configuration regs.
- * Enable 405GP to be a master on the PCI bus (PMM).
- * Enable 405GP to act as a PCI memory target (PTM).
- *--------------------------------------------------------------------------*/
- pci_read_config_word(PCIDEVID_405GP, PCI_COMMAND, &temp_short);
- pci_write_config_word(PCIDEVID_405GP, PCI_COMMAND, temp_short |
- PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
- }
-#endif
-
-#if defined(CONFIG_405EP) /* on ppc405ep vendor id is not set */
- pci_write_config_word(PCIDEVID_405GP, PCI_VENDOR_ID, 0x1014); /* IBM */
-#endif
-
- /*
- * Set HCE bit (Host Configuration Enabled)
- */
- pci_read_config_word(PCIDEVID_405GP, PCIBRDGOPT2, &temp_short);
- pci_write_config_word(PCIDEVID_405GP, PCIBRDGOPT2, (temp_short | 0x0001));
-
-#ifdef CONFIG_PCI_PNP
- /*--------------------------------------------------------------------------+
- * Scan the PCI bus and configure devices found.
- *--------------------------------------------------------------------------*/
-#if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
- if ((mfdcr(strap) & PSR_PCI_ARBIT_EN) ||
- (((s = getenv("pciscan")) != NULL) && (strcmp(s, "yes") == 0)))
-#endif
- {
-#ifdef CONFIG_PCI_SCAN_SHOW
- printf("PCI: Bus Dev VenId DevId Class Int\n");
-#endif
- hose->last_busno = pci_hose_scan(hose);
- }
-#endif /* CONFIG_PCI_PNP */
-
-}
-
-/*
- * drivers/pci.c skips every host bridge but the 405GP since it could
- * be set as an Adapter.
- *
- * I (Andrew May) don't know what we should do here, but I don't want
- * the auto setup of a PCI device disabling what is done pci_405gp_init
- * as has happened before.
- */
-void pci_405gp_setup_bridge(struct pci_controller *hose, pci_dev_t dev,
- struct pci_config_table *entry)
-{
-#ifdef DEBUG
- printf("405gp_setup_bridge\n");
-#endif
-}
-
-/*
- *
- */
-
-void pci_405gp_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
-{
- unsigned char int_line = 0xff;
-
- /*
- * Write pci interrupt line register (cpci405 specific)
- */
- switch (PCI_DEV(dev) & 0x03)
- {
- case 0:
- int_line = 27 + 2;
- break;
- case 1:
- int_line = 27 + 3;
- break;
- case 2:
- int_line = 27 + 0;
- break;
- case 3:
- int_line = 27 + 1;
- break;
- }
-
- pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, int_line);
-}
-
-void pci_405gp_setup_vga(struct pci_controller *hose, pci_dev_t dev,
- struct pci_config_table *entry)
-{
- unsigned int cmdstat = 0;
-
- pciauto_setup_device(hose, dev, 6, hose->pci_mem, hose->pci_prefetch, hose->pci_io);
-
- /* always enable io space on vga boards */
- pci_hose_read_config_dword(hose, dev, PCI_COMMAND, &cmdstat);
- cmdstat |= PCI_COMMAND_IO;
- pci_hose_write_config_dword(hose, dev, PCI_COMMAND, cmdstat);
-}
-
-#if !(defined(CONFIG_PIP405) || defined (CONFIG_MIP405))
-
-/*
- *As is these functs get called out of flash Not a horrible
- *thing, but something to keep in mind. (no statics?)
- */
-static struct pci_config_table pci_405gp_config_table[] = {
-/*if VendID is 0 it terminates the table search (ie Walnut)*/
-#ifdef CFG_PCI_SUBSYS_VENDORID
- {CFG_PCI_SUBSYS_VENDORID, PCI_ANY_ID, PCI_CLASS_BRIDGE_HOST,
- PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, pci_405gp_setup_bridge},
-#endif
- {PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA,
- PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, pci_405gp_setup_vga},
-
- {PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NOT_DEFINED_VGA,
- PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, pci_405gp_setup_vga},
-
- { }
-};
-
-static struct pci_controller hose = {
- fixup_irq: pci_405gp_fixup_irq,
- config_table: pci_405gp_config_table,
-};
-
-void pci_init_board(void)
-{
- /*we want the ptrs to RAM not flash (ie don't use init list)*/
- hose.fixup_irq = pci_405gp_fixup_irq;
- hose.config_table = pci_405gp_config_table;
- pci_405gp_init(&hose);
-}
-
-#endif
-
-#endif /* CONFIG_PCI */
-
-#endif /* CONFIG_405GP */
-
-/*-----------------------------------------------------------------------------+
- * CONFIG_440
- *-----------------------------------------------------------------------------*/
-#if defined(CONFIG_440) && defined(CONFIG_PCI)
-
-static struct pci_controller ppc440_hose = {0};
-
-
-void pci_440_init (struct pci_controller *hose)
-{
- int reg_num = 0;
-
-#ifndef CONFIG_DISABLE_PISE_TEST
- /*--------------------------------------------------------------------------+
- * The PCI initialization sequence enable bit must be set ... if not abort
- * pci setup since updating the bit requires chip reset.
- *--------------------------------------------------------------------------*/
-#if defined(CONFIG_440GX) || defined(CONFIG_440SP) || defined(CONFIG_440SPE)
- unsigned long strap;
-
- mfsdr(sdr_sdstp1,strap);
- if ((strap & SDR0_SDSTP1_PISE_MASK) == 0) {
- printf("PCI: SDR0_STRP1[PISE] not set.\n");
- printf("PCI: Configuration aborted.\n");
- return;
- }
-#elif defined(CONFIG_440GP)
- unsigned long strap;
-
- strap = mfdcr(cpc0_strp1);
- if ((strap & CPC0_STRP1_PISE_MASK) == 0) {
- printf("PCI: CPC0_STRP1[PISE] not set.\n");
- printf("PCI: Configuration aborted.\n");
- return;
- }
-#endif
-#endif /* CONFIG_DISABLE_PISE_TEST */
-
- /*--------------------------------------------------------------------------+
- * PCI controller init
- *--------------------------------------------------------------------------*/
- hose->first_busno = 0;
- hose->last_busno = 0xff;
-
- /* PCI I/O space */
- pci_set_region(hose->regions + reg_num++,
- 0x00000000,
- PCIX0_IOBASE,
- 0x10000,
- PCI_REGION_IO);
-
- /* PCI memory space */
- pci_set_region(hose->regions + reg_num++,
- CFG_PCI_TARGBASE,
- CFG_PCI_MEMBASE,
-#ifdef CFG_PCI_MEMSIZE
- CFG_PCI_MEMSIZE,
-#else
- 0x10000000,
-#endif
- PCI_REGION_MEM );
-
-#if defined(CONFIG_PCI_SYS_MEM_BUS) && defined(CONFIG_PCI_SYS_MEM_PHYS) && \
- defined(CONFIG_PCI_SYS_MEM_SIZE)
- /* System memory space */
- pci_set_region(hose->regions + reg_num++,
- CONFIG_PCI_SYS_MEM_BUS,
- CONFIG_PCI_SYS_MEM_PHYS,
- CONFIG_PCI_SYS_MEM_SIZE,
- PCI_REGION_MEM | PCI_REGION_MEMORY );
-#endif
-
- hose->region_count = reg_num;
-
- pci_setup_indirect(hose, PCIX0_CFGADR, PCIX0_CFGDATA);
-
-#if defined(CFG_PCI_PRE_INIT)
- /* Let board change/modify hose & do initial checks */
- if (pci_pre_init (hose) == 0) {
- printf("PCI: Board-specific initialization failed.\n");
- printf("PCI: Configuration aborted.\n");
- return;
- }
-#endif
-
- pci_register_hose( hose );
-
- /*--------------------------------------------------------------------------+
- * PCI target init
- *--------------------------------------------------------------------------*/
-#if defined(CFG_PCI_TARGET_INIT)
- pci_target_init(hose); /* Let board setup pci target */
-#else
- out16r( PCIX0_SBSYSVID, CFG_PCI_SUBSYS_VENDORID );
- out16r( PCIX0_SBSYSID, CFG_PCI_SUBSYS_ID );
- out16r( PCIX0_CLS, 0x00060000 ); /* Bridge, host bridge */
-#endif
-
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE)
- out32r( PCIX0_BRDGOPT1, 0x04000060 ); /* PLB Rq pri highest */
- out32r( PCIX0_BRDGOPT2, in32(PCIX0_BRDGOPT2) | 0x83 ); /* Enable host config, clear Timeout, ensure int src1 */
-#elif defined(PCIX0_BRDGOPT1)
- out32r( PCIX0_BRDGOPT1, 0x10000060 ); /* PLB Rq pri highest */
- out32r( PCIX0_BRDGOPT2, in32(PCIX0_BRDGOPT2) | 1 ); /* Enable host config */
-#endif
-
- /*--------------------------------------------------------------------------+
- * PCI master init: default is one 256MB region for PCI memory:
- * 0x3_00000000 - 0x3_0FFFFFFF ==> CFG_PCI_MEMBASE
- *--------------------------------------------------------------------------*/
-#if defined(CFG_PCI_MASTER_INIT)
- pci_master_init(hose); /* Let board setup pci master */
-#else
- out32r( PCIX0_POM0SA, 0 ); /* disable */
- out32r( PCIX0_POM1SA, 0 ); /* disable */
- out32r( PCIX0_POM2SA, 0 ); /* disable */
-#if defined(CONFIG_440SPE)
- out32r( PCIX0_POM0LAL, 0x10000000 );
- out32r( PCIX0_POM0LAH, 0x0000000c );
-#else
- out32r( PCIX0_POM0LAL, 0x00000000 );
- out32r( PCIX0_POM0LAH, 0x00000003 );
-#endif
- out32r( PCIX0_POM0PCIAL, CFG_PCI_MEMBASE );
- out32r( PCIX0_POM0PCIAH, 0x00000000 );
- out32r( PCIX0_POM0SA, 0xf0000001 ); /* 256MB, enabled */
- out32r( PCIX0_STS, in32r( PCIX0_STS ) & ~0x0000fff8 );
-#endif
-
- /*--------------------------------------------------------------------------+
- * PCI host configuration -- we don't make any assumptions here ... the
- * _board_must_indicate_ what to do -- there's just too many runtime
- * scenarios in environments like cPCI, PPMC, etc. to make a determination
- * based on hard-coded values or state of arbiter enable.
- *--------------------------------------------------------------------------*/
- if (is_pci_host(hose)) {
-#ifdef CONFIG_PCI_SCAN_SHOW
- printf("PCI: Bus Dev VenId DevId Class Int\n");
-#endif
-#if !defined(CONFIG_440EP) && !defined(CONFIG_440GR) && \
- !defined(CONFIG_440EPX) && !defined(CONFIG_440GRX)
- out16r( PCIX0_CMD, in16r( PCIX0_CMD ) | PCI_COMMAND_MASTER);
-#endif
- hose->last_busno = pci_hose_scan(hose);
- }
-}
-
-void pci_init_board(void)
-{
- pci_440_init (&ppc440_hose);
-#if defined(CONFIG_440SPE)
- pcie_setup_hoses();
-#endif
-}
-
-#endif /* CONFIG_440 & CONFIG_PCI */
diff --git a/cpu/ppc4xx/440spe_pcie.c b/cpu/ppc4xx/440spe_pcie.c
deleted file mode 100644
index 6130cd2839..0000000000
--- a/cpu/ppc4xx/440spe_pcie.c
+++ /dev/null
@@ -1,962 +0,0 @@
-/*
- * (C) Copyright 2006
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * Copyright (c) 2005 Cisco Systems. All rights reserved.
- * Roland Dreier <rolandd@cisco.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#include <asm/processor.h>
-#include <asm-ppc/io.h>
-#include <ppc4xx.h>
-#include <common.h>
-#include <pci.h>
-
-#include "440spe_pcie.h"
-
-#if defined(CONFIG_440SPE)
-#if defined(CONFIG_PCI)
-
-enum {
- PTYPE_ENDPOINT = 0x0,
- PTYPE_LEGACY_ENDPOINT = 0x1,
- PTYPE_ROOT_PORT = 0x4,
-
- LNKW_X1 = 0x1,
- LNKW_X4 = 0x4,
- LNKW_X8 = 0x8
-};
-
-static int pcie_read_config(struct pci_controller *hose, unsigned int devfn,
- int offset, int len, u32 *val) {
-
- *val = 0;
- /*
- * 440SPE implements only one function per port
- */
- if (!((PCI_FUNC(devfn) == 0) && (PCI_DEV(devfn) == 1)))
- return 0;
-
- devfn = PCI_BDF(0,0,0);
- offset += devfn << 4;
-
- switch (len) {
- case 1:
- *val = in_8(hose->cfg_data + offset);
- break;
- case 2:
- *val = in_le16((u16 *)(hose->cfg_data + offset));
- break;
- default:
- *val = in_le32((u32 *)(hose->cfg_data + offset));
- break;
- }
- return 0;
-}
-
-static int pcie_write_config(struct pci_controller *hose, unsigned int devfn,
- int offset, int len, u32 val) {
-
- /*
- * 440SPE implements only one function per port
- */
- if (!((PCI_FUNC(devfn) == 0) && (PCI_DEV(devfn) == 1)))
- return 0;
-
- devfn = PCI_BDF(0,0,0);
- offset += devfn << 4;
-
- switch (len) {
- case 1:
- out_8(hose->cfg_data + offset, val);
- break;
- case 2:
- out_le16((u16 *)(hose->cfg_data + offset), val);
- break;
- default:
- out_le32((u32 *)(hose->cfg_data + offset), val);
- break;
- }
- return 0;
-}
-
-int pcie_read_config_byte(struct pci_controller *hose,pci_dev_t dev,int offset,u8 *val)
-{
- u32 v;
- int rv;
-
- rv = pcie_read_config(hose, dev, offset, 1, &v);
- *val = (u8)v;
- return rv;
-}
-
-int pcie_read_config_word(struct pci_controller *hose,pci_dev_t dev,int offset,u16 *val)
-{
- u32 v;
- int rv;
-
- rv = pcie_read_config(hose, dev, offset, 2, &v);
- *val = (u16)v;
- return rv;
-}
-
-int pcie_read_config_dword(struct pci_controller *hose,pci_dev_t dev,int offset,u32 *val)
-{
- u32 v;
- int rv;
-
- rv = pcie_read_config(hose, dev, offset, 3, &v);
- *val = (u32)v;
- return rv;
-}
-
-int pcie_write_config_byte(struct pci_controller *hose,pci_dev_t dev,int offset,u8 val)
-{
- return pcie_write_config(hose,(u32)dev,offset,1,val);
-}
-
-int pcie_write_config_word(struct pci_controller *hose,pci_dev_t dev,int offset,u16 val)
-{
- return pcie_write_config(hose,(u32)dev,offset,2,(u32 )val);
-}
-
-int pcie_write_config_dword(struct pci_controller *hose,pci_dev_t dev,int offset,u32 val)
-{
- return pcie_write_config(hose,(u32)dev,offset,3,(u32 )val);
-}
-
-static void ppc440spe_setup_utl(u32 port) {
-
- volatile void *utl_base = NULL;
-
- /*
- * Map UTL registers
- */
- switch (port) {
- case 0:
- mtdcr(DCRN_PEGPL_REGBAH(PCIE0), 0x0000000c);
- mtdcr(DCRN_PEGPL_REGBAL(PCIE0), 0x20000000);
- mtdcr(DCRN_PEGPL_REGMSK(PCIE0), 0x00007001);
- mtdcr(DCRN_PEGPL_SPECIAL(PCIE0), 0x68782800);
- break;
-
- case 1:
- mtdcr(DCRN_PEGPL_REGBAH(PCIE1), 0x0000000c);
- mtdcr(DCRN_PEGPL_REGBAL(PCIE1), 0x20001000);
- mtdcr(DCRN_PEGPL_REGMSK(PCIE1), 0x00007001);
- mtdcr(DCRN_PEGPL_SPECIAL(PCIE1), 0x68782800);
- break;
-
- case 2:
- mtdcr(DCRN_PEGPL_REGBAH(PCIE2), 0x0000000c);
- mtdcr(DCRN_PEGPL_REGBAL(PCIE2), 0x20002000);
- mtdcr(DCRN_PEGPL_REGMSK(PCIE2), 0x00007001);
- mtdcr(DCRN_PEGPL_SPECIAL(PCIE2), 0x68782800);
- break;
- }
- utl_base = (unsigned int *)(CFG_PCIE_BASE + 0x1000 * port);
-
- /*
- * Set buffer allocations and then assert VRB and TXE.
- */
- out_be32(utl_base + PEUTL_OUTTR, 0x08000000);
- out_be32(utl_base + PEUTL_INTR, 0x02000000);
- out_be32(utl_base + PEUTL_OPDBSZ, 0x10000000);
- out_be32(utl_base + PEUTL_PBBSZ, 0x53000000);
- out_be32(utl_base + PEUTL_IPHBSZ, 0x08000000);
- out_be32(utl_base + PEUTL_IPDBSZ, 0x10000000);
- out_be32(utl_base + PEUTL_RCIRQEN, 0x00f00000);
- out_be32(utl_base + PEUTL_PCTL, 0x80800066);
-}
-
-static int check_error(void)
-{
- u32 valPE0, valPE1, valPE2;
- int err = 0;
-
- /* SDR0_PEGPLLLCT1 reset */
- if (!(valPE0 = SDR_READ(PESDR0_PLLLCT1) & 0x01000000)) {
- printf("PCIE: SDR0_PEGPLLLCT1 reset error 0x%x\n", valPE0);
- }
-
- valPE0 = SDR_READ(PESDR0_RCSSET);
- valPE1 = SDR_READ(PESDR1_RCSSET);
- valPE2 = SDR_READ(PESDR2_RCSSET);
-
- /* SDR0_PExRCSSET rstgu */
- if (!(valPE0 & 0x01000000) ||
- !(valPE1 & 0x01000000) ||
- !(valPE2 & 0x01000000)) {
- printf("PCIE: SDR0_PExRCSSET rstgu error\n");
- err = -1;
- }
-
- /* SDR0_PExRCSSET rstdl */
- if (!(valPE0 & 0x00010000) ||
- !(valPE1 & 0x00010000) ||
- !(valPE2 & 0x00010000)) {
- printf("PCIE: SDR0_PExRCSSET rstdl error\n");
- err = -1;
- }
-
- /* SDR0_PExRCSSET rstpyn */
- if ((valPE0 & 0x00001000) ||
- (valPE1 & 0x00001000) ||
- (valPE2 & 0x00001000)) {
- printf("PCIE: SDR0_PExRCSSET rstpyn error\n");
- err = -1;
- }
-
- /* SDR0_PExRCSSET hldplb */
- if ((valPE0 & 0x10000000) ||
- (valPE1 & 0x10000000) ||
- (valPE2 & 0x10000000)) {
- printf("PCIE: SDR0_PExRCSSET hldplb error\n");
- err = -1;
- }
-
- /* SDR0_PExRCSSET rdy */
- if ((valPE0 & 0x00100000) ||
- (valPE1 & 0x00100000) ||
- (valPE2 & 0x00100000)) {
- printf("PCIE: SDR0_PExRCSSET rdy error\n");
- err = -1;
- }
-
- /* SDR0_PExRCSSET shutdown */
- if ((valPE0 & 0x00000100) ||
- (valPE1 & 0x00000100) ||
- (valPE2 & 0x00000100)) {
- printf("PCIE: SDR0_PExRCSSET shutdown error\n");
- err = -1;
- }
- return err;
-}
-
-/*
- * Initialize PCI Express core
- */
-int ppc440spe_init_pcie(void)
-{
- int time_out = 20;
-
- /* Set PLL clock receiver to LVPECL */
- SDR_WRITE(PESDR0_PLLLCT1, SDR_READ(PESDR0_PLLLCT1) | 1 << 28);
-
- if (check_error())
- return -1;
-
- if (!(SDR_READ(PESDR0_PLLLCT2) & 0x10000))
- {
- printf("PCIE: PESDR_PLLCT2 resistance calibration failed (0x%08x)\n",
- SDR_READ(PESDR0_PLLLCT2));
- return -1;
- }
- /* De-assert reset of PCIe PLL, wait for lock */
- SDR_WRITE(PESDR0_PLLLCT1, SDR_READ(PESDR0_PLLLCT1) & ~(1 << 24));
- udelay(3);
-
- while (time_out) {
- if (!(SDR_READ(PESDR0_PLLLCT3) & 0x10000000)) {
- time_out--;
- udelay(1);
- } else
- break;
- }
- if (!time_out) {
- printf("PCIE: VCO output not locked\n");
- return -1;
- }
- return 0;
-}
-
-/*
- * Yucca board as End point and root point setup
- * and
- * testing inbound and out bound windows
- *
- * YUCCA board can be plugged into another yucca board or you can get PCI-E
- * cable which can be used to setup loop back from one port to another port.
- * Please rememeber that unless there is a endpoint plugged in to root port it
- * will not initialize. It is the same in case of endpoint , unless there is
- * root port attached it will not initialize.
- *
- * In this release of software all the PCI-E ports are configured as either
- * endpoint or rootpoint.In future we will have support for selective ports
- * setup as endpoint and root point in single board.
- *
- * Once your board came up as root point , you can verify by reading
- * /proc/bus/pci/devices. Where you can see the configuration registers
- * of end point device attached to the port.
- *
- * Enpoint cofiguration can be verified by connecting Yucca board to any
- * host or another yucca board. Then try to scan the device. In case of
- * linux use "lspci" or appripriate os command.
- *
- * How do I verify the inbound and out bound windows ?(yucca to yucca)
- * in this configuration inbound and outbound windows are setup to access
- * sram memroy area. SRAM is at 0x4 0000 0000 , on PLB bus. This address
- * is mapped at 0x90000000. From u-boot prompt write data 0xb000 0000,
- * This is waere your POM(PLB out bound memory window) mapped. then
- * read the data from other yucca board's u-boot prompt at address
- * 0x9000 0000(SRAM). Data should match.
- * In case of inbound , write data to u-boot command prompt at 0xb000 0000
- * which is mapped to 0x4 0000 0000. Now on rootpoint yucca u-boot prompt check
- * data at 0x9000 0000(SRAM).Data should match.
- */
-int ppc440spe_init_pcie_rootport(int port)
-{
- static int core_init;
- volatile u32 val = 0;
- int attempts;
-
- if (!core_init) {
- ++core_init;
- if (ppc440spe_init_pcie())
- return -1;
- }
-
- /*
- * Initialize various parts of the PCI Express core for our port:
- *
- * - Set as a root port and enable max width
- * (PXIE0 -> X8, PCIE1 and PCIE2 -> X4).
- * - Set up UTL configuration.
- * - Increase SERDES drive strength to levels suggested by AMCC.
- * - De-assert RSTPYN, RSTDL and RSTGU.
- *
- * NOTICE for revB chip: PESDRn_UTLSET2 is not set - we leave it with
- * default setting 0x11310000. The register has new fields,
- * PESDRn_UTLSET2[LKINE] in particular: clearing it leads to PCIE core
- * hang.
- */
- switch (port) {
- case 0:
- SDR_WRITE(PESDR0_DLPSET, 1 << 24 | PTYPE_ROOT_PORT << 20 | LNKW_X8 << 12);
-
- SDR_WRITE(PESDR0_UTLSET1, 0x21222222);
- if (!ppc440spe_revB())
- SDR_WRITE(PESDR0_UTLSET2, 0x11000000);
- SDR_WRITE(PESDR0_HSSL0SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL1SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL2SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL3SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL4SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL5SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL6SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL7SET1, 0x35000000);
- SDR_WRITE(PESDR0_RCSSET,
- (SDR_READ(PESDR0_RCSSET) & ~(1 << 24 | 1 << 16)) | 1 << 12);
- break;
-
- case 1:
- SDR_WRITE(PESDR1_DLPSET, 1 << 24 | PTYPE_ROOT_PORT << 20 | LNKW_X4 << 12);
- SDR_WRITE(PESDR1_UTLSET1, 0x21222222);
- if (!ppc440spe_revB())
- SDR_WRITE(PESDR1_UTLSET2, 0x11000000);
- SDR_WRITE(PESDR1_HSSL0SET1, 0x35000000);
- SDR_WRITE(PESDR1_HSSL1SET1, 0x35000000);
- SDR_WRITE(PESDR1_HSSL2SET1, 0x35000000);
- SDR_WRITE(PESDR1_HSSL3SET1, 0x35000000);
- SDR_WRITE(PESDR1_RCSSET,
- (SDR_READ(PESDR1_RCSSET) & ~(1 << 24 | 1 << 16)) | 1 << 12);
- break;
-
- case 2:
- SDR_WRITE(PESDR2_DLPSET, 1 << 24 | PTYPE_ROOT_PORT << 20 | LNKW_X4 << 12);
- SDR_WRITE(PESDR2_UTLSET1, 0x21222222);
- if (!ppc440spe_revB())
- SDR_WRITE(PESDR2_UTLSET2, 0x11000000);
- SDR_WRITE(PESDR2_HSSL0SET1, 0x35000000);
- SDR_WRITE(PESDR2_HSSL1SET1, 0x35000000);
- SDR_WRITE(PESDR2_HSSL2SET1, 0x35000000);
- SDR_WRITE(PESDR2_HSSL3SET1, 0x35000000);
- SDR_WRITE(PESDR2_RCSSET,
- (SDR_READ(PESDR2_RCSSET) & ~(1 << 24 | 1 << 16)) | 1 << 12);
- break;
- }
- /*
- * Notice: the following delay has critical impact on device
- * initialization - if too short (<50ms) the link doesn't get up.
- */
- mdelay(100);
-
- switch (port) {
- case 0:
- val = SDR_READ(PESDR0_RCSSTS);
- break;
- case 1:
- val = SDR_READ(PESDR1_RCSSTS);
- break;
- case 2:
- val = SDR_READ(PESDR2_RCSSTS);
- break;
- }
-
- if (val & (1 << 20)) {
- printf("PCIE%d: PGRST failed %08x\n", port, val);
- return -1;
- }
-
- /*
- * Verify link is up
- */
- val = 0;
- switch (port) {
- case 0:
- val = SDR_READ(PESDR0_LOOP);
- break;
- case 1:
- val = SDR_READ(PESDR1_LOOP);
- break;
- case 2:
- val = SDR_READ(PESDR2_LOOP);
- break;
- }
- if (!(val & 0x00001000)) {
- printf("PCIE%d: link is not up.\n", port);
- return -1;
- }
-
- /*
- * Setup UTL registers - but only on revA!
- * We use default settings for revB chip.
- */
- if (!ppc440spe_revB())
- ppc440spe_setup_utl(port);
-
- /*
- * We map PCI Express configuration access into the 512MB regions
- *
- * NOTICE: revB is very strict about PLB real addressess and ranges to
- * be mapped for config space; it seems to only work with d_nnnn_nnnn
- * range (hangs the core upon config transaction attempts when set
- * otherwise) while revA uses c_nnnn_nnnn.
- *
- * For revA:
- * PCIE0: 0xc_4000_0000
- * PCIE1: 0xc_8000_0000
- * PCIE2: 0xc_c000_0000
- *
- * For revB:
- * PCIE0: 0xd_0000_0000
- * PCIE1: 0xd_2000_0000
- * PCIE2: 0xd_4000_0000
- */
-
- switch (port) {
- case 0:
- if (ppc440spe_revB()) {
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE0), 0x0000000d);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE0), 0x00000000);
- } else {
- /* revA */
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE0), 0x0000000c);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE0), 0x40000000);
- }
- mtdcr(DCRN_PEGPL_CFGMSK(PCIE0), 0xe0000001); /* 512MB region, valid */
- break;
-
- case 1:
- if (ppc440spe_revB()) {
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE1), 0x0000000d);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE1), 0x20000000);
- } else {
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE1), 0x0000000c);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE1), 0x80000000);
- }
- mtdcr(DCRN_PEGPL_CFGMSK(PCIE1), 0xe0000001); /* 512MB region, valid */
- break;
-
- case 2:
- if (ppc440spe_revB()) {
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE2), 0x0000000d);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE2), 0x40000000);
- } else {
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE2), 0x0000000c);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE2), 0xc0000000);
- }
- mtdcr(DCRN_PEGPL_CFGMSK(PCIE2), 0xe0000001); /* 512MB region, valid */
- break;
- }
-
- /*
- * Check for VC0 active and assert RDY.
- */
- attempts = 10;
- switch (port) {
- case 0:
- while(!(SDR_READ(PESDR0_RCSSTS) & (1 << 16))) {
- if (!(attempts--)) {
- printf("PCIE0: VC0 not active\n");
- return -1;
- }
- mdelay(1000);
- }
- SDR_WRITE(PESDR0_RCSSET, SDR_READ(PESDR0_RCSSET) | 1 << 20);
- break;
- case 1:
- while(!(SDR_READ(PESDR1_RCSSTS) & (1 << 16))) {
- if (!(attempts--)) {
- printf("PCIE1: VC0 not active\n");
- return -1;
- }
- mdelay(1000);
- }
-
- SDR_WRITE(PESDR1_RCSSET, SDR_READ(PESDR1_RCSSET) | 1 << 20);
- break;
- case 2:
- while(!(SDR_READ(PESDR2_RCSSTS) & (1 << 16))) {
- if (!(attempts--)) {
- printf("PCIE2: VC0 not active\n");
- return -1;
- }
- mdelay(1000);
- }
-
- SDR_WRITE(PESDR2_RCSSET, SDR_READ(PESDR2_RCSSET) | 1 << 20);
- break;
- }
- mdelay(100);
-
- return 0;
-}
-
-int ppc440spe_init_pcie_endport(int port)
-{
- static int core_init;
- volatile u32 val = 0;
- int attempts;
-
- if (!core_init) {
- ++core_init;
- if (ppc440spe_init_pcie())
- return -1;
- }
-
- /*
- * Initialize various parts of the PCI Express core for our port:
- *
- * - Set as a end port and enable max width
- * (PXIE0 -> X8, PCIE1 and PCIE2 -> X4).
- * - Set up UTL configuration.
- * - Increase SERDES drive strength to levels suggested by AMCC.
- * - De-assert RSTPYN, RSTDL and RSTGU.
- *
- * NOTICE for revB chip: PESDRn_UTLSET2 is not set - we leave it with
- * default setting 0x11310000. The register has new fields,
- * PESDRn_UTLSET2[LKINE] in particular: clearing it leads to PCIE core
- * hang.
- */
- switch (port) {
- case 0:
- SDR_WRITE(PESDR0_DLPSET, 1 << 24 | PTYPE_LEGACY_ENDPOINT << 20 | LNKW_X8 << 12);
-
- SDR_WRITE(PESDR0_UTLSET1, 0x20222222);
- if (!ppc440spe_revB())
- SDR_WRITE(PESDR0_UTLSET2, 0x11000000);
- SDR_WRITE(PESDR0_HSSL0SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL1SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL2SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL3SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL4SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL5SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL6SET1, 0x35000000);
- SDR_WRITE(PESDR0_HSSL7SET1, 0x35000000);
- SDR_WRITE(PESDR0_RCSSET,
- (SDR_READ(PESDR0_RCSSET) & ~(1 << 24 | 1 << 16)) | 1 << 12);
- break;
-
- case 1:
- SDR_WRITE(PESDR1_DLPSET, 1 << 24 | PTYPE_LEGACY_ENDPOINT << 20 | LNKW_X4 << 12);
- SDR_WRITE(PESDR1_UTLSET1, 0x20222222);
- if (!ppc440spe_revB())
- SDR_WRITE(PESDR1_UTLSET2, 0x11000000);
- SDR_WRITE(PESDR1_HSSL0SET1, 0x35000000);
- SDR_WRITE(PESDR1_HSSL1SET1, 0x35000000);
- SDR_WRITE(PESDR1_HSSL2SET1, 0x35000000);
- SDR_WRITE(PESDR1_HSSL3SET1, 0x35000000);
- SDR_WRITE(PESDR1_RCSSET,
- (SDR_READ(PESDR1_RCSSET) & ~(1 << 24 | 1 << 16)) | 1 << 12);
- break;
-
- case 2:
- SDR_WRITE(PESDR2_DLPSET, 1 << 24 | PTYPE_LEGACY_ENDPOINT << 20 | LNKW_X4 << 12);
- SDR_WRITE(PESDR2_UTLSET1, 0x20222222);
- if (!ppc440spe_revB())
- SDR_WRITE(PESDR2_UTLSET2, 0x11000000);
- SDR_WRITE(PESDR2_HSSL0SET1, 0x35000000);
- SDR_WRITE(PESDR2_HSSL1SET1, 0x35000000);
- SDR_WRITE(PESDR2_HSSL2SET1, 0x35000000);
- SDR_WRITE(PESDR2_HSSL3SET1, 0x35000000);
- SDR_WRITE(PESDR2_RCSSET,
- (SDR_READ(PESDR2_RCSSET) & ~(1 << 24 | 1 << 16)) | 1 << 12);
- break;
- }
- /*
- * Notice: the following delay has critical impact on device
- * initialization - if too short (<50ms) the link doesn't get up.
- */
- mdelay(100);
-
- switch (port) {
- case 0: val = SDR_READ(PESDR0_RCSSTS); break;
- case 1: val = SDR_READ(PESDR1_RCSSTS); break;
- case 2: val = SDR_READ(PESDR2_RCSSTS); break;
- }
-
- if (val & (1 << 20)) {
- printf("PCIE%d: PGRST failed %08x\n", port, val);
- return -1;
- }
-
- /*
- * Verify link is up
- */
- val = 0;
- switch (port)
- {
- case 0:
- val = SDR_READ(PESDR0_LOOP);
- break;
- case 1:
- val = SDR_READ(PESDR1_LOOP);
- break;
- case 2:
- val = SDR_READ(PESDR2_LOOP);
- break;
- }
- if (!(val & 0x00001000)) {
- printf("PCIE%d: link is not up.\n", port);
- return -1;
- }
-
- /*
- * Setup UTL registers - but only on revA!
- * We use default settings for revB chip.
- */
- if (!ppc440spe_revB())
- ppc440spe_setup_utl(port);
-
- /*
- * We map PCI Express configuration access into the 512MB regions
- *
- * NOTICE: revB is very strict about PLB real addressess and ranges to
- * be mapped for config space; it seems to only work with d_nnnn_nnnn
- * range (hangs the core upon config transaction attempts when set
- * otherwise) while revA uses c_nnnn_nnnn.
- *
- * For revA:
- * PCIE0: 0xc_4000_0000
- * PCIE1: 0xc_8000_0000
- * PCIE2: 0xc_c000_0000
- *
- * For revB:
- * PCIE0: 0xd_0000_0000
- * PCIE1: 0xd_2000_0000
- * PCIE2: 0xd_4000_0000
- */
- switch (port) {
- case 0:
- if (ppc440spe_revB()) {
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE0), 0x0000000d);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE0), 0x00000000);
- } else {
- /* revA */
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE0), 0x0000000c);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE0), 0x40000000);
- }
- mtdcr(DCRN_PEGPL_CFGMSK(PCIE0), 0xe0000001); /* 512MB region, valid */
- break;
-
- case 1:
- if (ppc440spe_revB()) {
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE1), 0x0000000d);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE1), 0x20000000);
- } else {
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE1), 0x0000000c);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE1), 0x80000000);
- }
- mtdcr(DCRN_PEGPL_CFGMSK(PCIE1), 0xe0000001); /* 512MB region, valid */
- break;
-
- case 2:
- if (ppc440spe_revB()) {
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE2), 0x0000000d);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE2), 0x40000000);
- } else {
- mtdcr(DCRN_PEGPL_CFGBAH(PCIE2), 0x0000000c);
- mtdcr(DCRN_PEGPL_CFGBAL(PCIE2), 0xc0000000);
- }
- mtdcr(DCRN_PEGPL_CFGMSK(PCIE2), 0xe0000001); /* 512MB region, valid */
- break;
- }
-
- /*
- * Check for VC0 active and assert RDY.
- */
- attempts = 10;
- switch (port) {
- case 0:
- while(!(SDR_READ(PESDR0_RCSSTS) & (1 << 16))) {
- if (!(attempts--)) {
- printf("PCIE0: VC0 not active\n");
- return -1;
- }
- mdelay(1000);
- }
- SDR_WRITE(PESDR0_RCSSET, SDR_READ(PESDR0_RCSSET) | 1 << 20);
- break;
- case 1:
- while(!(SDR_READ(PESDR1_RCSSTS) & (1 << 16))) {
- if (!(attempts--)) {
- printf("PCIE1: VC0 not active\n");
- return -1;
- }
- mdelay(1000);
- }
-
- SDR_WRITE(PESDR1_RCSSET, SDR_READ(PESDR1_RCSSET) | 1 << 20);
- break;
- case 2:
- while(!(SDR_READ(PESDR2_RCSSTS) & (1 << 16))) {
- if (!(attempts--)) {
- printf("PCIE2: VC0 not active\n");
- return -1;
- }
- mdelay(1000);
- }
-
- SDR_WRITE(PESDR2_RCSSET, SDR_READ(PESDR2_RCSSET) | 1 << 20);
- break;
- }
- mdelay(100);
-
- return 0;
-}
-
-void ppc440spe_setup_pcie_rootpoint(struct pci_controller *hose, int port)
-{
- volatile void *mbase = NULL;
- volatile void *rmbase = NULL;
-
- pci_set_ops(hose,
- pcie_read_config_byte,
- pcie_read_config_word,
- pcie_read_config_dword,
- pcie_write_config_byte,
- pcie_write_config_word,
- pcie_write_config_dword);
-
- switch (port) {
- case 0:
- mbase = (u32 *)CFG_PCIE0_XCFGBASE;
- rmbase = (u32 *)CFG_PCIE0_CFGBASE;
- hose->cfg_data = (u8 *)CFG_PCIE0_CFGBASE;
- break;
- case 1:
- mbase = (u32 *)CFG_PCIE1_XCFGBASE;
- rmbase = (u32 *)CFG_PCIE1_CFGBASE;
- hose->cfg_data = (u8 *)CFG_PCIE1_CFGBASE;
- break;
- case 2:
- mbase = (u32 *)CFG_PCIE2_XCFGBASE;
- rmbase = (u32 *)CFG_PCIE2_CFGBASE;
- hose->cfg_data = (u8 *)CFG_PCIE2_CFGBASE;
- break;
- }
-
- /*
- * Set bus numbers on our root port
- */
- out_8((u8 *)mbase + PCI_PRIMARY_BUS, 0);
- out_8((u8 *)mbase + PCI_SECONDARY_BUS, 1);
- out_8((u8 *)mbase + PCI_SUBORDINATE_BUS, 1);
-
- /*
- * Set up outbound translation to hose->mem_space from PLB
- * addresses at an offset of 0xd_0000_0000. We set the low
- * bits of the mask to 11 to turn off splitting into 8
- * subregions and to enable the outbound translation.
- */
- out_le32(mbase + PECFG_POM0LAH, 0x00000000);
- out_le32(mbase + PECFG_POM0LAL, 0x00000000);
-
- switch (port) {
- case 0:
- mtdcr(DCRN_PEGPL_OMR1BAH(PCIE0), 0x0000000d);
- mtdcr(DCRN_PEGPL_OMR1BAL(PCIE0), CFG_PCIE_MEMBASE +
- port * CFG_PCIE_MEMSIZE);
- mtdcr(DCRN_PEGPL_OMR1MSKH(PCIE0), 0x7fffffff);
- mtdcr(DCRN_PEGPL_OMR1MSKL(PCIE0),
- ~(CFG_PCIE_MEMSIZE - 1) | 3);
- break;
- case 1:
- mtdcr(DCRN_PEGPL_OMR1BAH(PCIE1), 0x0000000d);
- mtdcr(DCRN_PEGPL_OMR1BAL(PCIE1), (CFG_PCIE_MEMBASE +
- port * CFG_PCIE_MEMSIZE));
- mtdcr(DCRN_PEGPL_OMR1MSKH(PCIE1), 0x7fffffff);
- mtdcr(DCRN_PEGPL_OMR1MSKL(PCIE1),
- ~(CFG_PCIE_MEMSIZE - 1) | 3);
- break;
- case 2:
- mtdcr(DCRN_PEGPL_OMR1BAH(PCIE2), 0x0000000d);
- mtdcr(DCRN_PEGPL_OMR1BAL(PCIE2), (CFG_PCIE_MEMBASE +
- port * CFG_PCIE_MEMSIZE));
- mtdcr(DCRN_PEGPL_OMR1MSKH(PCIE2), 0x7fffffff);
- mtdcr(DCRN_PEGPL_OMR1MSKL(PCIE2),
- ~(CFG_PCIE_MEMSIZE - 1) | 3);
- break;
- }
-
- /* Set up 16GB inbound memory window at 0 */
- out_le32(mbase + PCI_BASE_ADDRESS_0, 0);
- out_le32(mbase + PCI_BASE_ADDRESS_1, 0);
- out_le32(mbase + PECFG_BAR0HMPA, 0x7fffffc);
- out_le32(mbase + PECFG_BAR0LMPA, 0);
-
- out_le32(mbase + PECFG_PIM01SAH, 0xffff0000);
- out_le32(mbase + PECFG_PIM01SAL, 0x00000000);
- out_le32(mbase + PECFG_PIM0LAL, 0);
- out_le32(mbase + PECFG_PIM0LAH, 0);
- out_le32(mbase + PECFG_PIM1LAL, 0x00000000);
- out_le32(mbase + PECFG_PIM1LAH, 0x00000004);
- out_le32(mbase + PECFG_PIMEN, 0x1);
-
- /* Enable I/O, Mem, and Busmaster cycles */
- out_le16((u16 *)(mbase + PCI_COMMAND),
- in_le16((u16 *)(mbase + PCI_COMMAND)) |
- PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
- printf("PCIE:%d successfully set as rootpoint\n",port);
-}
-
-int ppc440spe_setup_pcie_endpoint(struct pci_controller *hose, int port)
-{
- volatile void *mbase = NULL;
- int attempts = 0;
-
- pci_set_ops(hose,
- pcie_read_config_byte,
- pcie_read_config_word,
- pcie_read_config_dword,
- pcie_write_config_byte,
- pcie_write_config_word,
- pcie_write_config_dword);
-
- switch (port) {
- case 0:
- mbase = (u32 *)CFG_PCIE0_XCFGBASE;
- hose->cfg_data = (u8 *)CFG_PCIE0_CFGBASE;
- break;
- case 1:
- mbase = (u32 *)CFG_PCIE1_XCFGBASE;
- hose->cfg_data = (u8 *)CFG_PCIE1_CFGBASE;
- break;
- case 2:
- mbase = (u32 *)CFG_PCIE2_XCFGBASE;
- hose->cfg_data = (u8 *)CFG_PCIE2_CFGBASE;
- break;
- }
-
- /*
- * Set up outbound translation to hose->mem_space from PLB
- * addresses at an offset of 0xd_0000_0000. We set the low
- * bits of the mask to 11 to turn off splitting into 8
- * subregions and to enable the outbound translation.
- */
- out_le32(mbase + PECFG_POM0LAH, 0x00001ff8);
- out_le32(mbase + PECFG_POM0LAL, 0x00001000);
-
- switch (port) {
- case 0:
- mtdcr(DCRN_PEGPL_OMR1BAH(PCIE0), 0x0000000d);
- mtdcr(DCRN_PEGPL_OMR1BAL(PCIE0), CFG_PCIE_MEMBASE +
- port * CFG_PCIE_MEMSIZE);
- mtdcr(DCRN_PEGPL_OMR1MSKH(PCIE0), 0x7fffffff);
- mtdcr(DCRN_PEGPL_OMR1MSKL(PCIE0),
- ~(CFG_PCIE_MEMSIZE - 1) | 3);
- break;
- case 1:
- mtdcr(DCRN_PEGPL_OMR1BAH(PCIE1), 0x0000000d);
- mtdcr(DCRN_PEGPL_OMR1BAL(PCIE1), (CFG_PCIE_MEMBASE +
- port * CFG_PCIE_MEMSIZE));
- mtdcr(DCRN_PEGPL_OMR1MSKH(PCIE1), 0x7fffffff);
- mtdcr(DCRN_PEGPL_OMR1MSKL(PCIE1),
- ~(CFG_PCIE_MEMSIZE - 1) | 3);
- break;
- case 2:
- mtdcr(DCRN_PEGPL_OMR1BAH(PCIE2), 0x0000000d);
- mtdcr(DCRN_PEGPL_OMR1BAL(PCIE2), (CFG_PCIE_MEMBASE +
- port * CFG_PCIE_MEMSIZE));
- mtdcr(DCRN_PEGPL_OMR1MSKH(PCIE2), 0x7fffffff);
- mtdcr(DCRN_PEGPL_OMR1MSKL(PCIE2),
- ~(CFG_PCIE_MEMSIZE - 1) | 3);
- break;
- }
-
- /* Set up 16GB inbound memory window at 0 */
- out_le32(mbase + PCI_BASE_ADDRESS_0, 0);
- out_le32(mbase + PCI_BASE_ADDRESS_1, 0);
- out_le32(mbase + PECFG_BAR0HMPA, 0x7fffffc);
- out_le32(mbase + PECFG_BAR0LMPA, 0);
- out_le32(mbase + PECFG_PIM0LAL, 0x00000000);
- out_le32(mbase + PECFG_PIM0LAH, 0x00000004); /* pointing to SRAM */
- out_le32(mbase + PECFG_PIMEN, 0x1);
-
- /* Enable I/O, Mem, and Busmaster cycles */
- out_le16((u16 *)(mbase + PCI_COMMAND),
- in_le16((u16 *)(mbase + PCI_COMMAND)) |
- PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
- out_le16(mbase + 0x200,0xcaad); /* Setting vendor ID */
- out_le16(mbase + 0x202,0xfeed); /* Setting device ID */
- attempts = 10;
- switch (port) {
- case 0:
- while (!(SDR_READ(PESDR0_RCSSTS) & (1 << 8))) {
- if (!(attempts--)) {
- printf("PCIE0: BMEN is not active\n");
- return -1;
- }
- mdelay(1000);
- }
- break;
- case 1:
- while (!(SDR_READ(PESDR1_RCSSTS) & (1 << 8))) {
- if (!(attempts--)) {
- printf("PCIE1: BMEN is not active\n");
- return -1;
- }
- mdelay(1000);
- }
- break;
- case 2:
- while (!(SDR_READ(PESDR2_RCSSTS) & (1 << 8))) {
- if (!(attempts--)) {
- printf("PCIE2: BMEN is not active\n");
- return -1;
- }
- mdelay(1000);
- }
- break;
- }
- printf("PCIE:%d successfully set as endpoint\n",port);
-
- return 0;
-}
-#endif /* CONFIG_PCI */
-#endif /* CONFIG_440SPE */
diff --git a/cpu/ppc4xx/440spe_pcie.h b/cpu/ppc4xx/440spe_pcie.h
deleted file mode 100644
index 2becc77722..0000000000
--- a/cpu/ppc4xx/440spe_pcie.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2005 Cisco Systems. All rights reserved.
- * Roland Dreier <rolandd@cisco.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- */
-
-#include <ppc4xx.h>
-#ifndef __440SPE_PCIE_H
-#define __440SPE_PCIE_H
-
-#define mdelay(n) ({unsigned long __ms=(n); while (__ms--) udelay(1000);})
-
-#define DCRN_SDR0_CFGADDR 0x00e
-#define DCRN_SDR0_CFGDATA 0x00f
-
-#define DCRN_PCIE0_BASE 0x100
-#define DCRN_PCIE1_BASE 0x120
-#define DCRN_PCIE2_BASE 0x140
-#define PCIE0 DCRN_PCIE0_BASE
-#define PCIE1 DCRN_PCIE1_BASE
-#define PCIE2 DCRN_PCIE2_BASE
-
-#define DCRN_PEGPL_CFGBAH(base) (base + 0x00)
-#define DCRN_PEGPL_CFGBAL(base) (base + 0x01)
-#define DCRN_PEGPL_CFGMSK(base) (base + 0x02)
-#define DCRN_PEGPL_MSGBAH(base) (base + 0x03)
-#define DCRN_PEGPL_MSGBAL(base) (base + 0x04)
-#define DCRN_PEGPL_MSGMSK(base) (base + 0x05)
-#define DCRN_PEGPL_OMR1BAH(base) (base + 0x06)
-#define DCRN_PEGPL_OMR1BAL(base) (base + 0x07)
-#define DCRN_PEGPL_OMR1MSKH(base) (base + 0x08)
-#define DCRN_PEGPL_OMR1MSKL(base) (base + 0x09)
-#define DCRN_PEGPL_REGBAH(base) (base + 0x12)
-#define DCRN_PEGPL_REGBAL(base) (base + 0x13)
-#define DCRN_PEGPL_REGMSK(base) (base + 0x14)
-#define DCRN_PEGPL_SPECIAL(base) (base + 0x15)
-
-/*
- * System DCRs (SDRs)
- */
-#define PESDR0_PLLLCT1 0x03a0
-#define PESDR0_PLLLCT2 0x03a1
-#define PESDR0_PLLLCT3 0x03a2
-
-#define PESDR0_UTLSET1 0x0300
-#define PESDR0_UTLSET2 0x0301
-#define PESDR0_DLPSET 0x0302
-#define PESDR0_LOOP 0x0303
-#define PESDR0_RCSSET 0x0304
-#define PESDR0_RCSSTS 0x0305
-#define PESDR0_HSSL0SET1 0x0306
-#define PESDR0_HSSL0SET2 0x0307
-#define PESDR0_HSSL0STS 0x0308
-#define PESDR0_HSSL1SET1 0x0309
-#define PESDR0_HSSL1SET2 0x030a
-#define PESDR0_HSSL1STS 0x030b
-#define PESDR0_HSSL2SET1 0x030c
-#define PESDR0_HSSL2SET2 0x030d
-#define PESDR0_HSSL2STS 0x030e
-#define PESDR0_HSSL3SET1 0x030f
-#define PESDR0_HSSL3SET2 0x0310
-#define PESDR0_HSSL3STS 0x0311
-#define PESDR0_HSSL4SET1 0x0312
-#define PESDR0_HSSL4SET2 0x0313
-#define PESDR0_HSSL4STS 0x0314
-#define PESDR0_HSSL5SET1 0x0315
-#define PESDR0_HSSL5SET2 0x0316
-#define PESDR0_HSSL5STS 0x0317
-#define PESDR0_HSSL6SET1 0x0318
-#define PESDR0_HSSL6SET2 0x0319
-#define PESDR0_HSSL6STS 0x031a
-#define PESDR0_HSSL7SET1 0x031b
-#define PESDR0_HSSL7SET2 0x031c
-#define PESDR0_HSSL7STS 0x031d
-#define PESDR0_HSSCTLSET 0x031e
-#define PESDR0_LANE_ABCD 0x031f
-#define PESDR0_LANE_EFGH 0x0320
-
-#define PESDR1_UTLSET1 0x0340
-#define PESDR1_UTLSET2 0x0341
-#define PESDR1_DLPSET 0x0342
-#define PESDR1_LOOP 0x0343
-#define PESDR1_RCSSET 0x0344
-#define PESDR1_RCSSTS 0x0345
-#define PESDR1_HSSL0SET1 0x0346
-#define PESDR1_HSSL0SET2 0x0347
-#define PESDR1_HSSL0STS 0x0348
-#define PESDR1_HSSL1SET1 0x0349
-#define PESDR1_HSSL1SET2 0x034a
-#define PESDR1_HSSL1STS 0x034b
-#define PESDR1_HSSL2SET1 0x034c
-#define PESDR1_HSSL2SET2 0x034d
-#define PESDR1_HSSL2STS 0x034e
-#define PESDR1_HSSL3SET1 0x034f
-#define PESDR1_HSSL3SET2 0x0350
-#define PESDR1_HSSL3STS 0x0351
-#define PESDR1_HSSCTLSET 0x0352
-#define PESDR1_LANE_ABCD 0x0353
-
-#define PESDR2_UTLSET1 0x0370
-#define PESDR2_UTLSET2 0x0371
-#define PESDR2_DLPSET 0x0372
-#define PESDR2_LOOP 0x0373
-#define PESDR2_RCSSET 0x0374
-#define PESDR2_RCSSTS 0x0375
-#define PESDR2_HSSL0SET1 0x0376
-#define PESDR2_HSSL0SET2 0x0377
-#define PESDR2_HSSL0STS 0x0378
-#define PESDR2_HSSL1SET1 0x0379
-#define PESDR2_HSSL1SET2 0x037a
-#define PESDR2_HSSL1STS 0x037b
-#define PESDR2_HSSL2SET1 0x037c
-#define PESDR2_HSSL2SET2 0x037d
-#define PESDR2_HSSL2STS 0x037e
-#define PESDR2_HSSL3SET1 0x037f
-#define PESDR2_HSSL3SET2 0x0380
-#define PESDR2_HSSL3STS 0x0381
-#define PESDR2_HSSCTLSET 0x0382
-#define PESDR2_LANE_ABCD 0x0383
-
-/*
- * UTL register offsets
- */
-#define PEUTL_PBBSZ 0x20
-#define PEUTL_OPDBSZ 0x68
-#define PEUTL_IPHBSZ 0x70
-#define PEUTL_IPDBSZ 0x78
-#define PEUTL_OUTTR 0x90
-#define PEUTL_INTR 0x98
-#define PEUTL_PCTL 0xa0
-#define PEUTL_RCIRQEN 0xb8
-
-/*
- * Config space register offsets
- */
-#define PECFG_BAR0LMPA 0x210
-#define PECFG_BAR0HMPA 0x214
-#define PECFG_BAR1MPA 0x218
-#define PECFG_BAR2MPA 0x220
-
-#define PECFG_PIMEN 0x33c
-#define PECFG_PIM0LAL 0x340
-#define PECFG_PIM0LAH 0x344
-#define PECFG_PIM1LAL 0x348
-#define PECFG_PIM1LAH 0x34c
-#define PECFG_PIM01SAL 0x350
-#define PECFG_PIM01SAH 0x354
-
-#define PECFG_POM0LAL 0x380
-#define PECFG_POM0LAH 0x384
-
-#define SDR_READ(offset) ({\
- mtdcr(DCRN_SDR0_CFGADDR, offset); \
- mfdcr(DCRN_SDR0_CFGDATA);})
-
-#define SDR_WRITE(offset, data) ({\
- mtdcr(DCRN_SDR0_CFGADDR, offset); \
- mtdcr(DCRN_SDR0_CFGDATA,data);})
-
-int ppc440spe_init_pcie(void);
-int ppc440spe_init_pcie_rootport(int port);
-void yucca_setup_pcie_fpga_rootpoint(int port);
-void ppc440spe_setup_pcie_rootpoint(struct pci_controller *hose, int port);
-int ppc440spe_setup_pcie_endpoint(struct pci_controller *hose, int port);
-int yucca_pcie_card_present(int port);
-int pcie_hose_scan(struct pci_controller *hose, int bus);
-#endif /* __440SPE_PCIE_H */
diff --git a/cpu/ppc4xx/Makefile b/cpu/ppc4xx/Makefile
deleted file mode 100644
index baecf70352..0000000000
--- a/cpu/ppc4xx/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o resetvec.o kgdb.o
-SOBJS = dcr.o
-COBJS = 405gp_pci.o 4xx_enet.o \
- bedbug_405.o commproc.o \
- cpu.o cpu_init.o i2c.o interrupts.o \
- miiphy.o ndfc.o sdram.o serial.o \
- spd_sdram.o speed.o traps.o usb_ohci.o usbdev.o \
- 440spe_pcie.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/ppc4xx/bedbug_405.c b/cpu/ppc4xx/bedbug_405.c
deleted file mode 100644
index a3c2119764..0000000000
--- a/cpu/ppc4xx/bedbug_405.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Bedbug Functions specific to the PPC405 chip
- */
-
-#include <common.h>
-#include <command.h>
-#include <linux/ctype.h>
-#include <bedbug/type.h>
-#include <bedbug/bedbug.h>
-#include <bedbug/regs.h>
-#include <bedbug/ppc.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG) && defined(CONFIG_4xx)
-
-#define MAX_BREAK_POINTS 4
-
-extern CPU_DEBUG_CTX bug_ctx;
-
-void bedbug405_init __P ((void));
-void bedbug405_do_break __P ((cmd_tbl_t *, int, int, char *[]));
-void bedbug405_break_isr __P ((struct pt_regs *));
-int bedbug405_find_empty __P ((void));
-int bedbug405_set __P ((int, unsigned long));
-int bedbug405_clear __P ((int));
-
-
-/* ======================================================================
- * Initialize the global bug_ctx structure for the AMCC PPC405. Clear all
- * of the breakpoints.
- * ====================================================================== */
-
-void bedbug405_init (void)
-{
- int i;
-
- /* -------------------------------------------------- */
-
- bug_ctx.hw_debug_enabled = 0;
- bug_ctx.stopped = 0;
- bug_ctx.current_bp = 0;
- bug_ctx.regs = NULL;
-
- bug_ctx.do_break = bedbug405_do_break;
- bug_ctx.break_isr = bedbug405_break_isr;
- bug_ctx.find_empty = bedbug405_find_empty;
- bug_ctx.set = bedbug405_set;
- bug_ctx.clear = bedbug405_clear;
-
- for (i = 1; i <= MAX_BREAK_POINTS; ++i)
- (*bug_ctx.clear) (i);
-
- puts ("BEDBUG:ready\n");
- return;
-} /* bedbug_init_breakpoints */
-
-
-
-/* ======================================================================
- * Set/clear/show one of the hardware breakpoints for the 405. The "off"
- * string will disable a specific breakpoint. The "show" string will
- * display the current breakpoints. Otherwise an address will set a
- * breakpoint at that address. Setting a breakpoint uses the CPU-specific
- * set routine which will assign a breakpoint number.
- * ====================================================================== */
-
-void bedbug405_do_break (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
-{
- long addr = 0; /* Address to break at */
- int which_bp; /* Breakpoint number */
-
- /* -------------------------------------------------- */
-
- if (argc < 2) {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return;
- }
-
- /* Turn off a breakpoint */
-
- if (strcmp (argv[1], "off") == 0) {
- if (bug_ctx.hw_debug_enabled == 0) {
- printf ("No breakpoints enabled\n");
- return;
- }
-
- which_bp = simple_strtoul (argv[2], NULL, 10);
-
- if (bug_ctx.clear)
- (*bug_ctx.clear) (which_bp);
-
- printf ("Breakpoint %d removed\n", which_bp);
- return;
- }
-
- /* Show a list of breakpoints */
-
- if (strcmp (argv[1], "show") == 0) {
- for (which_bp = 1; which_bp <= MAX_BREAK_POINTS; ++which_bp) {
-
- switch (which_bp) {
- case 1:
- addr = GET_IAC1 ();
- break;
- case 2:
- addr = GET_IAC2 ();
- break;
- case 3:
- addr = GET_IAC3 ();
- break;
- case 4:
- addr = GET_IAC4 ();
- break;
- }
-
- printf ("Breakpoint [%d]: ", which_bp);
- if (addr == 0)
- printf ("NOT SET\n");
- else
- disppc ((unsigned char *) addr, 0, 1, bedbug_puts,
- F_RADHEX);
- }
- return;
- }
-
- /* Set a breakpoint at the address */
-
- if (!isdigit (argv[1][0])) {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return;
- }
-
- addr = simple_strtoul (argv[1], NULL, 16) & 0xfffffffc;
-
- if ((bug_ctx.set) && (which_bp = (*bug_ctx.set) (0, addr)) > 0) {
- printf ("Breakpoint [%d]: ", which_bp);
- disppc ((unsigned char *) addr, 0, 1, bedbug_puts, F_RADHEX);
- }
-
- return;
-} /* bedbug405_do_break */
-
-
-
-/* ======================================================================
- * Handle a breakpoint. First determine which breakpoint was hit by
- * looking at the DeBug Status Register (DBSR), clear the breakpoint
- * and enter a mini main loop. Stay in the loop until the stopped flag
- * in the debug context is cleared.
- * ====================================================================== */
-
-void bedbug405_break_isr (struct pt_regs *regs)
-{
- unsigned long dbsr_val; /* Value of the DBSR */
- unsigned long addr = 0; /* Address stopped at */
-
- /* -------------------------------------------------- */
-
- dbsr_val = GET_DBSR ();
-
- if (dbsr_val & DBSR_IA1) {
- bug_ctx.current_bp = 1;
- addr = GET_IAC1 ();
- SET_DBSR (DBSR_IA1); /* Write a 1 to clear */
- } else if (dbsr_val & DBSR_IA2) {
- bug_ctx.current_bp = 2;
- addr = GET_IAC2 ();
- SET_DBSR (DBSR_IA2); /* Write a 1 to clear */
- } else if (dbsr_val & DBSR_IA3) {
- bug_ctx.current_bp = 3;
- addr = GET_IAC3 ();
- SET_DBSR (DBSR_IA3); /* Write a 1 to clear */
- } else if (dbsr_val & DBSR_IA4) {
- bug_ctx.current_bp = 4;
- addr = GET_IAC4 ();
- SET_DBSR (DBSR_IA4); /* Write a 1 to clear */
- }
-
- bedbug_main_loop (addr, regs);
- return;
-} /* bedbug405_break_isr */
-
-
-
-/* ======================================================================
- * Look through all of the hardware breakpoints available to see if one
- * is unused.
- * ====================================================================== */
-
-int bedbug405_find_empty (void)
-{
- /* -------------------------------------------------- */
-
- if (GET_IAC1 () == 0)
- return 1;
-
- if (GET_IAC2 () == 0)
- return 2;
-
- if (GET_IAC3 () == 0)
- return 3;
-
- if (GET_IAC4 () == 0)
- return 4;
-
- return 0;
-} /* bedbug405_find_empty */
-
-
-
-/* ======================================================================
- * Set a breakpoint. If 'which_bp' is zero then find an unused breakpoint
- * number, otherwise reassign the given breakpoint. If hardware debugging
- * is not enabled, then turn it on via the MSR and DBCR0. Set the break
- * address in the appropriate IACx register and enable proper address
- * beakpoint in DBCR0.
- * ====================================================================== */
-
-int bedbug405_set (int which_bp, unsigned long addr)
-{
- /* -------------------------------------------------- */
-
- /* Only look if which_bp == 0, else use which_bp */
- if ((bug_ctx.find_empty) && (!which_bp) &&
- (which_bp = (*bug_ctx.find_empty) ()) == 0) {
- printf ("All breakpoints in use\n");
- return 0;
- }
-
- if (which_bp < 1 || which_bp > MAX_BREAK_POINTS) {
- printf ("Invalid break point # %d\n", which_bp);
- return 0;
- }
-
- if (!bug_ctx.hw_debug_enabled) {
- SET_MSR (GET_MSR () | 0x200); /* set MSR[ DE ] */
- SET_DBCR0 (GET_DBCR0 () | DBCR0_IDM);
- bug_ctx.hw_debug_enabled = 1;
- }
-
- switch (which_bp) {
- case 1:
- SET_IAC1 (addr);
- SET_DBCR0 (GET_DBCR0 () | DBCR0_IA1);
- break;
-
- case 2:
- SET_IAC2 (addr);
- SET_DBCR0 (GET_DBCR0 () | DBCR0_IA2);
- break;
-
- case 3:
- SET_IAC3 (addr);
- SET_DBCR0 (GET_DBCR0 () | DBCR0_IA3);
- break;
-
- case 4:
- SET_IAC4 (addr);
- SET_DBCR0 (GET_DBCR0 () | DBCR0_IA4);
- break;
- }
-
- return which_bp;
-} /* bedbug405_set */
-
-
-
-/* ======================================================================
- * Disable a specific breakoint by setting the appropriate IACx register
- * to zero and claring the instruction address breakpoint in DBCR0.
- * ====================================================================== */
-
-int bedbug405_clear (int which_bp)
-{
- /* -------------------------------------------------- */
-
- if (which_bp < 1 || which_bp > MAX_BREAK_POINTS) {
- printf ("Invalid break point # (%d)\n", which_bp);
- return -1;
- }
-
- switch (which_bp) {
- case 1:
- SET_IAC1 (0);
- SET_DBCR0 (GET_DBCR0 () & ~DBCR0_IA1);
- break;
-
- case 2:
- SET_IAC2 (0);
- SET_DBCR0 (GET_DBCR0 () & ~DBCR0_IA2);
- break;
-
- case 3:
- SET_IAC3 (0);
- SET_DBCR0 (GET_DBCR0 () & ~DBCR0_IA3);
- break;
-
- case 4:
- SET_IAC4 (0);
- SET_DBCR0 (GET_DBCR0 () & ~DBCR0_IA4);
- break;
- }
-
- return 0;
-} /* bedbug405_clear */
-
-
-/* ====================================================================== */
-#endif
diff --git a/cpu/ppc4xx/commproc.c b/cpu/ppc4xx/commproc.c
deleted file mode 100644
index 68aab5b7ea..0000000000
--- a/cpu/ppc4xx/commproc.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * (C) Copyright 2000-2004
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Atapted for ppc4XX by Denis Peter
- */
-
-#include <common.h>
-#include <commproc.h>
-
-
-#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
-
-void post_word_store (ulong a)
-{
- volatile void *save_addr = (volatile void *)(CFG_OCM_DATA_ADDR + CFG_POST_WORD_ADDR);
- *(volatile ulong *) save_addr = a;
-}
-
-ulong post_word_load (void)
-{
- volatile void *save_addr = (volatile void *)(CFG_OCM_DATA_ADDR + CFG_POST_WORD_ADDR);
- return *(volatile ulong *) save_addr;
-}
-
-#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
-
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-
-void bootcount_store (ulong a)
-{
- volatile ulong *save_addr =
- (volatile ulong *)(CFG_OCM_DATA_ADDR + CFG_BOOTCOUNT_ADDR);
-
- save_addr[0] = a;
- save_addr[1] = BOOTCOUNT_MAGIC;
-}
-
-ulong bootcount_load (void)
-{
- volatile ulong *save_addr =
- (volatile ulong *)(CFG_OCM_DATA_ADDR + CFG_BOOTCOUNT_ADDR);
-
- if (save_addr[1] != BOOTCOUNT_MAGIC)
- return 0;
- else
- return save_addr[0];
-}
-
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
diff --git a/cpu/ppc4xx/config.mk b/cpu/ppc4xx/config.mk
deleted file mode 100644
index 119e061b89..0000000000
--- a/cpu/ppc4xx/config.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# (C) Copyright 2000
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
-
-PLATFORM_CPPFLAGS += -DCONFIG_4xx -ffixed-r2 -ffixed-r29 -mstring -Wa,-m405 -mcpu=405 -msoft-float
diff --git a/cpu/ppc4xx/cpu.c b/cpu/ppc4xx/cpu.c
deleted file mode 100644
index 9c5c9109b1..0000000000
--- a/cpu/ppc4xx/cpu.c
+++ /dev/null
@@ -1,500 +0,0 @@
-/*
- * (C) Copyright 2000-2006
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * CPU specific code
- *
- * written or collected and sometimes rewritten by
- * Magnus Damm <damm@bitsmart.com>
- *
- * minor modifications by
- * Wolfgang Denk <wd@denx.de>
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <command.h>
-#include <asm/cache.h>
-#include <ppc4xx.h>
-
-#if !defined(CONFIG_405)
-DECLARE_GLOBAL_DATA_PTR;
-#endif
-
-#if defined(CONFIG_BOARD_RESET)
-void board_reset(void);
-#endif
-
-#if defined(CONFIG_440)
-#define FREQ_EBC (sys_info.freqEPB)
-#else
-#define FREQ_EBC (sys_info.freqPLB / sys_info.pllExtBusDiv)
-#endif
-
-#if defined(CONFIG_405GP) || \
- defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-
-#define PCI_ASYNC
-
-int pci_async_enabled(void)
-{
-#if defined(CONFIG_405GP)
- return (mfdcr(strap) & PSR_PCI_ASYNC_EN);
-#endif
-
-#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
- unsigned long val;
-
- mfsdr(sdr_sdstp1, val);
- return (val & SDR0_SDSTP1_PAME_MASK);
-#endif
-}
-#endif
-
-#if defined(CONFIG_PCI) && !defined(CONFIG_IOP480) && !defined(CONFIG_405)
-int pci_arbiter_enabled(void)
-{
-#if defined(CONFIG_405GP)
- return (mfdcr(strap) & PSR_PCI_ARBIT_EN);
-#endif
-
-#if defined(CONFIG_405EP)
- return (mfdcr(cpc0_pci) & CPC0_PCI_ARBIT_EN);
-#endif
-
-#if defined(CONFIG_440GP)
- return (mfdcr(cpc0_strp1) & CPC0_STRP1_PAE_MASK);
-#endif
-
-#if defined(CONFIG_440GX) || \
- defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
- defined(CONFIG_440SP) || defined(CONFIG_440SPE)
- unsigned long val;
-
- mfsdr(sdr_sdstp1, val);
- return (val & SDR0_SDSTP1_PAE_MASK);
-#endif
-}
-#endif
-
-#if defined(CONFIG_405EP) || defined(CONFIG_440GX) || \
- defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
- defined(CONFIG_440SP) || defined(CONFIG_440SPE)
-
-#define I2C_BOOTROM
-
-int i2c_bootrom_enabled(void)
-{
-#if defined(CONFIG_405EP)
- return (mfdcr(cpc0_boot) & CPC0_BOOT_SEP);
-#else
- unsigned long val;
-
- mfsdr(sdr_sdcs, val);
- return (val & SDR0_SDCS_SDD);
-#endif
-}
-
-#if defined(CONFIG_440GX)
-#define SDR0_PINSTP_SHIFT 29
-static char *bootstrap_str[] = {
- "EBC (16 bits)",
- "EBC (8 bits)",
- "EBC (32 bits)",
- "EBC (8 bits)",
- "PCI",
- "I2C (Addr 0x54)",
- "Reserved",
- "I2C (Addr 0x50)",
-};
-#endif
-
-#if defined(CONFIG_440SP) || defined(CONFIG_440SPE)
-#define SDR0_PINSTP_SHIFT 30
-static char *bootstrap_str[] = {
- "EBC (8 bits)",
- "PCI",
- "I2C (Addr 0x54)",
- "I2C (Addr 0x50)",
-};
-#endif
-
-#if defined(CONFIG_440EP) || defined(CONFIG_440GR)
-#define SDR0_PINSTP_SHIFT 29
-static char *bootstrap_str[] = {
- "EBC (8 bits)",
- "PCI",
- "NAND (8 bits)",
- "EBC (16 bits)",
- "EBC (16 bits)",
- "I2C (Addr 0x54)",
- "PCI",
- "I2C (Addr 0x52)",
-};
-#endif
-
-#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-#define SDR0_PINSTP_SHIFT 29
-static char *bootstrap_str[] = {
- "EBC (8 bits)",
- "EBC (16 bits)",
- "EBC (16 bits)",
- "NAND (8 bits)",
- "PCI",
- "I2C (Addr 0x54)",
- "PCI",
- "I2C (Addr 0x52)",
-};
-#endif
-
-#if defined(SDR0_PINSTP_SHIFT)
-static int bootstrap_option(void)
-{
- unsigned long val;
-
- mfsdr(sdr_pinstp, val);
- return ((val & 0xe0000000) >> SDR0_PINSTP_SHIFT);
-}
-#endif /* SDR0_PINSTP_SHIFT */
-#endif
-
-
-#if defined(CONFIG_440)
-static int do_chip_reset(unsigned long sys0, unsigned long sys1);
-#endif
-
-
-int checkcpu (void)
-{
-#if !defined(CONFIG_405) /* not used on Xilinx 405 FPGA implementations */
- uint pvr = get_pvr();
- ulong clock = gd->cpu_clk;
- char buf[32];
-
-#if !defined(CONFIG_IOP480)
- char addstr[64] = "";
- sys_info_t sys_info;
-
- puts ("CPU: ");
-
- get_sys_info(&sys_info);
-
- puts("AMCC PowerPC 4");
-
-#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_405EP)
- puts("05");
-#endif
-#if defined(CONFIG_440)
- puts("40");
-#endif
-
- switch (pvr) {
- case PVR_405GP_RB:
- puts("GP Rev. B");
- break;
-
- case PVR_405GP_RC:
- puts("GP Rev. C");
- break;
-
- case PVR_405GP_RD:
- puts("GP Rev. D");
- break;
-
-#ifdef CONFIG_405GP
- case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */
- puts("GP Rev. E");
- break;
-#endif
-
- case PVR_405CR_RA:
- puts("CR Rev. A");
- break;
-
- case PVR_405CR_RB:
- puts("CR Rev. B");
- break;
-
-#ifdef CONFIG_405CR
- case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */
- puts("CR Rev. C");
- break;
-#endif
-
- case PVR_405GPR_RB:
- puts("GPr Rev. B");
- break;
-
- case PVR_405EP_RB:
- puts("EP Rev. B");
- break;
-
-#if defined(CONFIG_440)
- case PVR_440GP_RB:
- puts("GP Rev. B");
- /* See errata 1.12: CHIP_4 */
- if ((mfdcr(cpc0_sys0) != mfdcr(cpc0_strp0)) ||
- (mfdcr(cpc0_sys1) != mfdcr(cpc0_strp1)) ){
- puts ( "\n\t CPC0_SYSx DCRs corrupted. "
- "Resetting chip ...\n");
- udelay( 1000 * 1000 ); /* Give time for serial buf to clear */
- do_chip_reset ( mfdcr(cpc0_strp0),
- mfdcr(cpc0_strp1) );
- }
- break;
-
- case PVR_440GP_RC:
- puts("GP Rev. C");
- break;
-
- case PVR_440GX_RA:
- puts("GX Rev. A");
- break;
-
- case PVR_440GX_RB:
- puts("GX Rev. B");
- break;
-
- case PVR_440GX_RC:
- puts("GX Rev. C");
- break;
-
- case PVR_440GX_RF:
- puts("GX Rev. F");
- break;
-
- case PVR_440EP_RA:
- puts("EP Rev. A");
- break;
-
-#ifdef CONFIG_440EP
- case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */
- puts("EP Rev. B");
- break;
-
- case PVR_440EP_RC: /* 440EP rev C and 440GR rev B have same PVR */
- puts("EP Rev. C");
- break;
-#endif /* CONFIG_440EP */
-
-#ifdef CONFIG_440GR
- case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */
- puts("GR Rev. A");
- break;
-
- case PVR_440GR_RB: /* 440EP rev C and 440GR rev B have same PVR */
- puts("GR Rev. B");
- break;
-#endif /* CONFIG_440GR */
-#endif /* CONFIG_440 */
-
- case PVR_440EPX1_RA:
- puts("EPx Rev. A");
- strcpy(addstr, "Security/Kasumi support");
- break;
-
- case PVR_440EPX2_RA:
- puts("EPx Rev. A");
- strcpy(addstr, "No Security/Kasumi support");
- break;
-
- case PVR_440GRX1_RA:
- puts("GRx Rev. A");
- strcpy(addstr, "Security/Kasumi support");
- break;
-
- case PVR_440GRX2_RA:
- puts("GRx Rev. A");
- strcpy(addstr, "No Security/Kasumi support");
- break;
-
- case PVR_440SP_RA:
- puts("SP Rev. A");
- break;
-
- case PVR_440SP_RB:
- puts("SP Rev. B");
- break;
-
- case PVR_440SP_RC:
- puts("SP Rev. C");
- break;
-
- case PVR_440SPe_RA:
- puts("SPe Rev. A");
- break;
-
- case PVR_440SPe_RB:
- puts("SPe Rev. B");
- break;
-
- default:
- printf (" UNKNOWN (PVR=%08x)", pvr);
- break;
- }
-
- printf (" at %s MHz (PLB=%lu, OPB=%lu, EBC=%lu MHz)\n", strmhz(buf, clock),
- sys_info.freqPLB / 1000000,
- sys_info.freqPLB / sys_info.pllOpbDiv / 1000000,
- FREQ_EBC / 1000000);
-
- if (addstr[0] != 0)
- printf(" %s\n", addstr);
-
-#if defined(I2C_BOOTROM)
- printf (" I2C boot EEPROM %sabled\n", i2c_bootrom_enabled() ? "en" : "dis");
-#if defined(SDR0_PINSTP_SHIFT)
- printf (" Bootstrap Option %c - ", (char)bootstrap_option() + 'A');
- printf ("Boot ROM Location %s\n", bootstrap_str[bootstrap_option()]);
-#endif /* SDR0_PINSTP_SHIFT */
-#endif /* I2C_BOOTROM */
-
-#if defined(CONFIG_PCI)
- printf (" Internal PCI arbiter %sabled", pci_arbiter_enabled() ? "en" : "dis");
-#endif
-
-#if defined(PCI_ASYNC)
- if (pci_async_enabled()) {
- printf (", PCI async ext clock used");
- } else {
- printf (", PCI sync clock at %lu MHz",
- sys_info.freqPLB / sys_info.pllPciDiv / 1000000);
- }
-#endif
-
-#if defined(CONFIG_PCI)
- putc('\n');
-#endif
-
-#if defined(CONFIG_405EP)
- printf (" 16 kB I-Cache 16 kB D-Cache");
-#elif defined(CONFIG_440)
- printf (" 32 kB I-Cache 32 kB D-Cache");
-#else
- printf (" 16 kB I-Cache %d kB D-Cache",
- ((pvr | 0x00000001) == PVR_405GPR_RB) ? 16 : 8);
-#endif
-#endif /* !defined(CONFIG_IOP480) */
-
-#if defined(CONFIG_IOP480)
- printf ("PLX IOP480 (PVR=%08x)", pvr);
- printf (" at %s MHz:", strmhz(buf, clock));
- printf (" %u kB I-Cache", 4);
- printf (" %u kB D-Cache", 2);
-#endif
-
-#endif /* !defined(CONFIG_405) */
-
- putc ('\n');
-
- return 0;
-}
-
-#if defined (CONFIG_440SPE)
-int ppc440spe_revB() {
- unsigned int pvr;
-
- pvr = get_pvr();
- if (pvr == PVR_440SPe_RB)
- return 1;
- else
- return 0;
-}
-#endif
-
-/* ------------------------------------------------------------------------- */
-
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
-#if defined(CONFIG_BOARD_RESET)
- board_reset();
-#else
-#if defined(CFG_4xx_RESET_TYPE)
- mtspr(dbcr0, CFG_4xx_RESET_TYPE << 28);
-#else
- /*
- * Initiate system reset in debug control register DBCR
- */
- mtspr(dbcr0, 0x30000000);
-#endif /* defined(CFG_4xx_RESET_TYPE) */
-#endif /* defined(CONFIG_BOARD_RESET) */
-
- return 1;
-}
-
-#if defined(CONFIG_440)
-static int do_chip_reset (unsigned long sys0, unsigned long sys1)
-{
- /* Changes to cpc0_sys0 and cpc0_sys1 require chip
- * reset.
- */
- mtdcr (cntrl0, mfdcr (cntrl0) | 0x80000000); /* Set SWE */
- mtdcr (cpc0_sys0, sys0);
- mtdcr (cpc0_sys1, sys1);
- mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000); /* Clr SWE */
- mtspr (dbcr0, 0x20000000); /* Reset the chip */
-
- return 1;
-}
-#endif
-
-
-/*
- * Get timebase clock frequency
- */
-unsigned long get_tbclk (void)
-{
-#if !defined(CONFIG_IOP480)
- sys_info_t sys_info;
-
- get_sys_info(&sys_info);
- return (sys_info.freqProcessor);
-#else
- return (66000000);
-#endif
-
-}
-
-
-#if defined(CONFIG_WATCHDOG)
-void
-watchdog_reset(void)
-{
- int re_enable = disable_interrupts();
- reset_4xx_watchdog();
- if (re_enable) enable_interrupts();
-}
-
-void
-reset_4xx_watchdog(void)
-{
- /*
- * Clear TSR(WIS) bit
- */
- mtspr(tsr, 0x40000000);
-}
-#endif /* CONFIG_WATCHDOG */
diff --git a/cpu/ppc4xx/cpu_init.c b/cpu/ppc4xx/cpu_init.c
deleted file mode 100644
index db0559b04d..0000000000
--- a/cpu/ppc4xx/cpu_init.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * (C) Copyright 2000-2006
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <ppc4xx_enet.h>
-#include <asm/processor.h>
-#include <ppc4xx.h>
-
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
-DECLARE_GLOBAL_DATA_PTR;
-#endif
-
-#ifdef CFG_INIT_DCACHE_CS
-# if (CFG_INIT_DCACHE_CS == 0)
-# define PBxAP pb0ap
-# define PBxCR pb0cr
-# if (defined(CFG_EBC_PB0AP) && defined(CFG_EBC_PB0CR))
-# define PBxAP_VAL CFG_EBC_PB0AP
-# define PBxCR_VAL CFG_EBC_PB0CR
-# endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 1)
-# define PBxAP pb1ap
-# define PBxCR pb1cr
-# if (defined(CFG_EBC_PB1AP) && defined(CFG_EBC_PB1CR))
-# define PBxAP_VAL CFG_EBC_PB1AP
-# define PBxCR_VAL CFG_EBC_PB1CR
-# endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 2)
-# define PBxAP pb2ap
-# define PBxCR pb2cr
-# if (defined(CFG_EBC_PB2AP) && defined(CFG_EBC_PB2CR))
-# define PBxAP_VAL CFG_EBC_PB2AP
-# define PBxCR_VAL CFG_EBC_PB2CR
-# endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 3)
-# define PBxAP pb3ap
-# define PBxCR pb3cr
-# if (defined(CFG_EBC_PB3AP) && defined(CFG_EBC_PB3CR))
-# define PBxAP_VAL CFG_EBC_PB3AP
-# define PBxCR_VAL CFG_EBC_PB3CR
-# endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 4)
-# define PBxAP pb4ap
-# define PBxCR pb4cr
-# if (defined(CFG_EBC_PB4AP) && defined(CFG_EBC_PB4CR))
-# define PBxAP_VAL CFG_EBC_PB4AP
-# define PBxCR_VAL CFG_EBC_PB4CR
-# endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 5)
-# define PBxAP pb5ap
-# define PBxCR pb5cr
-# if (defined(CFG_EBC_PB5AP) && defined(CFG_EBC_PB5CR))
-# define PBxAP_VAL CFG_EBC_PB5AP
-# define PBxCR_VAL CFG_EBC_PB5CR
-# endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 6)
-# define PBxAP pb6ap
-# define PBxCR pb6cr
-# if (defined(CFG_EBC_PB6AP) && defined(CFG_EBC_PB6CR))
-# define PBxAP_VAL CFG_EBC_PB6AP
-# define PBxCR_VAL CFG_EBC_PB6CR
-# endif
-# endif
-# if (CFG_INIT_DCACHE_CS == 7)
-# define PBxAP pb7ap
-# define PBxCR pb7cr
-# if (defined(CFG_EBC_PB7AP) && defined(CFG_EBC_PB7CR))
-# define PBxAP_VAL CFG_EBC_PB7AP
-# define PBxCR_VAL CFG_EBC_PB7CR
-# endif
-# endif
-#endif /* CFG_INIT_DCACHE_CS */
-
-#if defined(CFG_440_GPIO_TABLE)
-gpio_param_s gpio_tab[GPIO_GROUP_MAX][GPIO_MAX] = CFG_440_GPIO_TABLE;
-
-void set_chip_gpio_configuration(gpio_param_s (*gpio_tab)[GPIO_GROUP_MAX][GPIO_MAX])
-{
- unsigned char i=0, j=0, reg_offset = 0, gpio_core;
- unsigned long gpio_reg, gpio_core_add;
-
- for (gpio_core=0; gpio_core<GPIO_GROUP_MAX; gpio_core++) {
- j = 0;
- reg_offset = 0;
- /* GPIO config of the GPIOs 0 to 31 */
- for (i=0; i<GPIO_MAX; i++, j++) {
- if (i == GPIO_MAX/2) {
- reg_offset = 4;
- j = i-16;
- }
-
- gpio_core_add = (*gpio_tab)[gpio_core][i].add;
-
- if (((*gpio_tab)[gpio_core][i].in_out == GPIO_IN) ||
- ((*gpio_tab)[gpio_core][i].in_out == GPIO_BI)) {
-
- switch ((*gpio_tab)[gpio_core][i].alt_nb) {
- case GPIO_SEL:
- break;
-
- case GPIO_ALT1:
- gpio_reg = in32(GPIO_IS1(gpio_core_add+reg_offset))
- & ~(GPIO_MASK >> (j*2));
- gpio_reg = gpio_reg | (GPIO_IN_SEL >> (j*2));
- out32(GPIO_IS1(gpio_core_add+reg_offset), gpio_reg);
- break;
-
- case GPIO_ALT2:
- gpio_reg = in32(GPIO_IS2(gpio_core_add+reg_offset))
- & ~(GPIO_MASK >> (j*2));
- gpio_reg = gpio_reg | (GPIO_IN_SEL >> (j*2));
- out32(GPIO_IS2(gpio_core_add+reg_offset), gpio_reg);
- break;
-
- case GPIO_ALT3:
- gpio_reg = in32(GPIO_IS3(gpio_core_add+reg_offset))
- & ~(GPIO_MASK >> (j*2));
- gpio_reg = gpio_reg | (GPIO_IN_SEL >> (j*2));
- out32(GPIO_IS3(gpio_core_add+reg_offset), gpio_reg);
- break;
- }
- }
-
- if (((*gpio_tab)[gpio_core][i].in_out == GPIO_OUT) ||
- ((*gpio_tab)[gpio_core][i].in_out == GPIO_BI)) {
-
- switch ((*gpio_tab)[gpio_core][i].alt_nb) {
- case GPIO_SEL:
- if (gpio_core == GPIO0) {
- gpio_reg = in32(GPIO0_TCR) | (0x80000000 >> (j));
- out32(GPIO0_TCR, gpio_reg);
- }
-
- if (gpio_core == GPIO1) {
- gpio_reg = in32(GPIO1_TCR) | (0x80000000 >> (j));
- out32(GPIO1_TCR, gpio_reg);
- }
-
- gpio_reg = in32(GPIO_OS(gpio_core_add+reg_offset))
- & ~(GPIO_MASK >> (j*2));
- out32(GPIO_OS(gpio_core_add+reg_offset), gpio_reg);
- gpio_reg = in32(GPIO_TS(gpio_core_add+reg_offset))
- & ~(GPIO_MASK >> (j*2));
- out32(GPIO_TS(gpio_core_add+reg_offset), gpio_reg);
- break;
-
- case GPIO_ALT1:
- gpio_reg = in32(GPIO_OS(gpio_core_add+reg_offset))
- & ~(GPIO_MASK >> (j*2));
- gpio_reg = gpio_reg | (GPIO_ALT1_SEL >> (j*2));
- out32(GPIO_OS(gpio_core_add+reg_offset), gpio_reg);
- gpio_reg = in32(GPIO_TS(gpio_core_add+reg_offset))
- & ~(GPIO_MASK >> (j*2));
- gpio_reg = gpio_reg | (GPIO_ALT1_SEL >> (j*2));
- out32(GPIO_TS(gpio_core_add+reg_offset), gpio_reg);
- break;
-
- case GPIO_ALT2:
- gpio_reg = in32(GPIO_OS(gpio_core_add+reg_offset))
- & ~(GPIO_MASK >> (j*2));
- gpio_reg = gpio_reg | (GPIO_ALT2_SEL >> (j*2));
- out32(GPIO_OS(gpio_core_add+reg_offset), gpio_reg);
- gpio_reg = in32(GPIO_TS(gpio_core_add+reg_offset))
- & ~(GPIO_MASK >> (j*2));
- gpio_reg = gpio_reg | (GPIO_ALT2_SEL >> (j*2));
- out32(GPIO_TS(gpio_core_add+reg_offset), gpio_reg);
- break;
-
- case GPIO_ALT3:
- gpio_reg = in32(GPIO_OS(gpio_core_add+reg_offset))
- & ~(GPIO_MASK >> (j*2));
- gpio_reg = gpio_reg | (GPIO_ALT3_SEL >> (j*2));
- out32(GPIO_OS(gpio_core_add+reg_offset), gpio_reg);
- gpio_reg = in32(GPIO_TS(gpio_core_add+reg_offset))
- & ~(GPIO_MASK >> (j*2));
- gpio_reg = gpio_reg | (GPIO_ALT3_SEL >> (j*2));
- out32(GPIO_TS(gpio_core_add+reg_offset), gpio_reg);
- break;
- }
- }
- }
- }
-}
-#endif /* CFG_440_GPIO_TABLE */
-
-/*
- * Breath some life into the CPU...
- *
- * Set up the memory map,
- * initialize a bunch of registers
- */
-void
-cpu_init_f (void)
-{
-#if defined(CONFIG_405EP)
- /*
- * GPIO0 setup (select GPIO or alternate function)
- */
-#if defined(CFG_GPIO0_OR)
- out32(GPIO0_OR, CFG_GPIO0_OR); /* set initial state of output pins */
-#endif
-#if defined(CFG_GPIO0_ODR)
- out32(GPIO0_ODR, CFG_GPIO0_ODR); /* open-drain select */
-#endif
- out32(GPIO0_OSRH, CFG_GPIO0_OSRH); /* output select */
- out32(GPIO0_OSRL, CFG_GPIO0_OSRL);
- out32(GPIO0_ISR1H, CFG_GPIO0_ISR1H); /* input select */
- out32(GPIO0_ISR1L, CFG_GPIO0_ISR1L);
- out32(GPIO0_TSRH, CFG_GPIO0_TSRH); /* three-state select */
- out32(GPIO0_TSRL, CFG_GPIO0_TSRL);
- out32(GPIO0_TCR, CFG_GPIO0_TCR); /* enable output driver for outputs */
-
- /*
- * Set EMAC noise filter bits
- */
- mtdcr(cpc0_epctl, CPC0_EPRCSR_E0NFE | CPC0_EPRCSR_E1NFE);
-#endif /* CONFIG_405EP */
-
-#if defined(CFG_440_GPIO_TABLE)
- set_chip_gpio_configuration(&gpio_tab);
-#endif /* CFG_440_GPIO_TABLE */
-
- /*
- * External Bus Controller (EBC) Setup
- */
-#if (defined(CFG_EBC_PB0AP) && defined(CFG_EBC_PB0CR))
-#if (defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
- defined(CONFIG_405EP) || defined(CONFIG_405))
- /*
- * Move the next instructions into icache, since these modify the flash
- * we are running from!
- */
- asm volatile(" bl 0f" ::: "lr");
- asm volatile("0: mflr 3" ::: "r3");
- asm volatile(" addi 4, 0, 14" ::: "r4");
- asm volatile(" mtctr 4" ::: "ctr");
- asm volatile("1: icbt 0, 3");
- asm volatile(" addi 3, 3, 32" ::: "r3");
- asm volatile(" bdnz 1b" ::: "ctr", "cr0");
- asm volatile(" addis 3, 0, 0x0" ::: "r3");
- asm volatile(" ori 3, 3, 0xA000" ::: "r3");
- asm volatile(" mtctr 3" ::: "ctr");
- asm volatile("2: bdnz 2b" ::: "ctr", "cr0");
-#endif
-
- mtebc(pb0ap, CFG_EBC_PB0AP);
- mtebc(pb0cr, CFG_EBC_PB0CR);
-#endif
-
-#if (defined(CFG_EBC_PB1AP) && defined(CFG_EBC_PB1CR) && !(CFG_INIT_DCACHE_CS == 1))
- mtebc(pb1ap, CFG_EBC_PB1AP);
- mtebc(pb1cr, CFG_EBC_PB1CR);
-#endif
-
-#if (defined(CFG_EBC_PB2AP) && defined(CFG_EBC_PB2CR) && !(CFG_INIT_DCACHE_CS == 2))
- mtebc(pb2ap, CFG_EBC_PB2AP);
- mtebc(pb2cr, CFG_EBC_PB2CR);
-#endif
-
-#if (defined(CFG_EBC_PB3AP) && defined(CFG_EBC_PB3CR) && !(CFG_INIT_DCACHE_CS == 3))
- mtebc(pb3ap, CFG_EBC_PB3AP);
- mtebc(pb3cr, CFG_EBC_PB3CR);
-#endif
-
-#if (defined(CFG_EBC_PB4AP) && defined(CFG_EBC_PB4CR) && !(CFG_INIT_DCACHE_CS == 4))
- mtebc(pb4ap, CFG_EBC_PB4AP);
- mtebc(pb4cr, CFG_EBC_PB4CR);
-#endif
-
-#if (defined(CFG_EBC_PB5AP) && defined(CFG_EBC_PB5CR) && !(CFG_INIT_DCACHE_CS == 5))
- mtebc(pb5ap, CFG_EBC_PB5AP);
- mtebc(pb5cr, CFG_EBC_PB5CR);
-#endif
-
-#if (defined(CFG_EBC_PB6AP) && defined(CFG_EBC_PB6CR) && !(CFG_INIT_DCACHE_CS == 6))
- mtebc(pb6ap, CFG_EBC_PB6AP);
- mtebc(pb6cr, CFG_EBC_PB6CR);
-#endif
-
-#if (defined(CFG_EBC_PB7AP) && defined(CFG_EBC_PB7CR) && !(CFG_INIT_DCACHE_CS == 7))
- mtebc(pb7ap, CFG_EBC_PB7AP);
- mtebc(pb7cr, CFG_EBC_PB7CR);
-#endif
-
-#if defined(CONFIG_WATCHDOG)
- unsigned long val;
-
- val = mfspr(tcr);
-#if defined(CONFIG_440EP) || defined(CONFIG_440GR)
- val |= 0xb8000000; /* generate system reset after 1.34 seconds */
-#else
- val |= 0xf0000000; /* generate system reset after 2.684 seconds */
-#endif
-#if defined(CFG_4xx_RESET_TYPE)
- val &= ~0x30000000; /* clear WRC bits */
- val |= CFG_4xx_RESET_TYPE << 28; /* set board specific WRC type */
-#endif
- mtspr(tcr, val);
-
- val = mfspr(tsr);
- val |= 0x80000000; /* enable watchdog timer */
- mtspr(tsr, val);
-
- reset_4xx_watchdog();
-#endif /* CONFIG_WATCHDOG */
-}
-
-/*
- * initialize higher level parts of CPU like time base and timers
- */
-int cpu_init_r (void)
-{
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
- bd_t *bd = gd->bd;
- unsigned long reg;
-#if defined(CONFIG_405GP)
- uint pvr = get_pvr();
-#endif
-
-#ifdef CFG_INIT_DCACHE_CS
- /*
- * Flush and invalidate dcache, then disable CS for temporary stack.
- * Afterwards, this CS can be used for other purposes
- */
- dcache_disable(); /* flush and invalidate dcache */
- mtebc(PBxAP, 0);
- mtebc(PBxCR, 0); /* disable CS for temporary stack */
-
-#if (defined(PBxAP_VAL) && defined(PBxCR_VAL))
- /*
- * Write new value into CS register
- */
- mtebc(PBxAP, PBxAP_VAL);
- mtebc(PBxCR, PBxCR_VAL);
-#endif
-#endif /* CFG_INIT_DCACHE_CS */
-
- /*
- * Write Ethernetaddress into on-chip register
- */
- reg = 0x00000000;
- reg |= bd->bi_enetaddr[0]; /* set high address */
- reg = reg << 8;
- reg |= bd->bi_enetaddr[1];
- out32 (EMAC_IAH, reg);
-
- reg = 0x00000000;
- reg |= bd->bi_enetaddr[2]; /* set low address */
- reg = reg << 8;
- reg |= bd->bi_enetaddr[3];
- reg = reg << 8;
- reg |= bd->bi_enetaddr[4];
- reg = reg << 8;
- reg |= bd->bi_enetaddr[5];
- out32 (EMAC_IAL, reg);
-
-#if defined(CONFIG_405GP)
- /*
- * Set edge conditioning circuitry on PPC405GPr
- * for compatibility to existing PPC405GP designs.
- */
- if ((pvr & 0xfffffff0) == (PVR_405GPR_RB & 0xfffffff0)) {
- mtdcr(ecr, 0x60606000);
- }
-#endif /* defined(CONFIG_405GP) */
-#endif /* defined(CONFIG_405GP) || defined(CONFIG_405EP) */
- return (0);
-}
diff --git a/cpu/ppc4xx/dcr.S b/cpu/ppc4xx/dcr.S
deleted file mode 100644
index 0b38aec8ca..0000000000
--- a/cpu/ppc4xx/dcr.S
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * (C) Copyright 2001
- * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-#include <config.h>
-
-#if defined(CONFIG_4xx) && defined(CFG_CMD_SETGETDCR)
-
-#include <ppc4xx.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#define _ASMLANGUAGE
-
-/*****************************************************************************
- *
- * XXX - DANGER
- * These routines make use of self modifying code. DO NOT CALL THEM
- * UNTIL THEY ARE RELOCATED TO RAM. Additionally, I do not
- * recommend them for use in anything other than an interactive
- * debugging environment. This is mainly due to performance reasons.
- *
- ****************************************************************************/
-
-/*
- * static void _create_MFDCR(unsigned short dcrn)
- *
- * Builds a 'mfdcr' instruction for get_dcr
- * function.
- */
- .section ".text"
- .align 2
- .type _create_MFDCR,@function
-_create_MFDCR:
- /*
- * Build up a 'mfdcr' instruction formatted as follows:
- *
- * OPCD | RT | DCRF | XO | CR |
- * ---------------|--------------|--------------|----|
- * 0 5 | 6 10 | 11 20 | 21 30 | 31 |
- * | | DCRN | | |
- * 31 | %r3 | (5..9|0..4) | 323 | 0 |
- *
- * Where:
- * OPCD = opcode - 31
- * RT = destination register - %r3 return register
- * DCRF = DCRN # with upper and lower halves swapped
- * XO = extended opcode - 323
- * CR = CR[CR0] NOT undefined - 0
- */
- rlwinm r0, r3, 27, 27, 31 /* OPCD = 31 */
- rlwinm r3, r3, 5, 22, 26
- or r3, r3, r0
- slwi r3, r3, 10
- oris r3, r3, 0x3e30 /* RT = %r3 */
- ori r3, r3, 323 /* XO = 323 */
- slwi r3, r3, 1 /* CR = 0 */
-
- mflr r4
- stw r3, 0(r4) /* Store instr in get_dcr() */
- dcbst r0, r4 /* Make sure val is written out */
- sync /* Wait for write to complete */
- icbi r0, r4 /* Make sure old instr is dumped */
- isync /* Wait for icbi to complete */
-
- blr
-.Lfe1: .size _create_MFDCR,.Lfe1-_create_MFDCR
-/* end _create_MFDCR() */
-
-/*
- * static void _create_MTDCR(unsigned short dcrn, unsigned long value)
- *
- * Builds a 'mtdcr' instruction for set_dcr
- * function.
- */
- .section ".text"
- .align 2
- .type _create_MTDCR,@function
-_create_MTDCR:
- /*
- * Build up a 'mtdcr' instruction formatted as follows:
- *
- * OPCD | RS | DCRF | XO | CR |
- * ---------------|--------------|--------------|----|
- * 0 5 | 6 10 | 11 20 | 21 30 | 31 |
- * | | DCRN | | |
- * 31 | %r3 | (5..9|0..4) | 451 | 0 |
- *
- * Where:
- * OPCD = opcode - 31
- * RS = source register - %r4
- * DCRF = dest. DCRN # with upper and lower halves swapped
- * XO = extended opcode - 451
- * CR = CR[CR0] NOT undefined - 0
- */
- rlwinm r0, r3, 27, 27, 31 /* OPCD = 31 */
- rlwinm r3, r3, 5, 22, 26
- or r3, r3, r0
- slwi r3, r3, 10
- oris r3, r3, 0x3e40 /* RS = %r4 */
- ori r3, r3, 451 /* XO = 451 */
- slwi r3, r3, 1 /* CR = 0 */
-
- mflr r5
- stw r3, 0(r5) /* Store instr in set_dcr() */
- dcbst r0, r5 /* Make sure val is written out */
- sync /* Wait for write to complete */
- icbi r0, r5 /* Make sure old instr is dumped */
- isync /* Wait for icbi to complete */
-
- blr
-.Lfe2: .size _create_MTDCR,.Lfe2-_create_MTDCR
-/* end _create_MTDCR() */
-
-
-/*
- * unsigned long get_dcr(unsigned short dcrn)
- *
- * Return a given DCR's value.
- */
- /* */
- /* XXX - This is self modifying code, hence */
- /* it is in the data section. */
- /* */
- .section ".data"
- .align 2
- .globl get_dcr
- .type get_dcr,@function
-get_dcr:
- mflr r0 /* Get link register */
- stwu r1, -32(r1) /* Save back chain and move SP */
- stw r0, +36(r1) /* Save link register */
-
- bl _create_MFDCR /* Build following instruction */
- /* XXX - we build this instuction up on the fly. */
- .long 0 /* Get DCR's value */
-
- lwz r0, +36(r1) /* Get saved link register */
- mtlr r0 /* Restore link register */
- addi r1, r1, +32 /* Remove frame from stack */
- blr /* Return to calling function */
-.Lfe3: .size get_dcr,.Lfe3-get_dcr
-/* end get_dcr() */
-
-
-/*
- * unsigned void set_dcr(unsigned short dcrn, unsigned long value)
- *
- * Return a given DCR's value.
- */
- /*
- * XXX - This is self modifying code, hence
- * it is in the data section.
- */
- .section ".data"
- .align 2
- .globl set_dcr
- .type set_dcr,@function
-set_dcr:
- mflr r0 /* Get link register */
- stwu r1, -32(r1) /* Save back chain and move SP */
- stw r0, +36(r1) /* Save link register */
-
- bl _create_MTDCR /* Build following instruction */
- /* XXX - we build this instuction up on the fly. */
- .long 0 /* Set DCR's value */
-
- lwz r0, +36(r1) /* Get saved link register */
- mtlr r0 /* Restore link register */
- addi r1, r1, +32 /* Remove frame from stack */
- blr /* Return to calling function */
-.Lfe4: .size set_dcr,.Lfe4-set_dcr
-/* end set_dcr() */
-#endif /* CONFIG_4xx & CFG_CMD_SETGETDCR */
diff --git a/cpu/ppc4xx/i2c.c b/cpu/ppc4xx/i2c.c
deleted file mode 100644
index 7db1cd8046..0000000000
--- a/cpu/ppc4xx/i2c.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*****************************************************************************/
-/* I2C Bus interface initialisation and I2C Commands */
-/* for PPC405GP */
-/* Author : AS HARNOIS */
-/* Date : 13.Dec.00 */
-/*****************************************************************************/
-
-#include <common.h>
-#include <ppc4xx.h>
-#if defined(CONFIG_440)
-# include <440_i2c.h>
-#else
-# include <405gp_i2c.h>
-#endif
-#include <i2c.h>
-
-#ifdef CONFIG_HARD_I2C
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define IIC_OK 0
-#define IIC_NOK 1
-#define IIC_NOK_LA 2 /* Lost arbitration */
-#define IIC_NOK_ICT 3 /* Incomplete transfer */
-#define IIC_NOK_XFRA 4 /* Transfer aborted */
-#define IIC_NOK_DATA 5 /* No data in buffer */
-#define IIC_NOK_TOUT 6 /* Transfer timeout */
-
-#define IIC_TIMEOUT 1 /* 1 seconde */
-
-
-static void _i2c_bus_reset (void)
-{
- int i, status;
-
- /* Reset status register */
- /* write 1 in SCMP and IRQA to clear these fields */
- out8 (IIC_STS, 0x0A);
-
- /* write 1 in IRQP IRQD LA ICT XFRA to clear these fields */
- out8 (IIC_EXTSTS, 0x8F);
- __asm__ volatile ("eieio");
-
- /*
- * Get current state, reset bus
- * only if no transfers are pending.
- */
- i = 10;
- do {
- /* Get status */
- status = in8 (IIC_STS);
- udelay (500); /* 500us */
- i--;
- } while ((status & IIC_STS_PT) && (i > 0));
- /* Soft reset controller */
- status = in8 (IIC_XTCNTLSS);
- out8 (IIC_XTCNTLSS, (status | IIC_XTCNTLSS_SRST));
- __asm__ volatile ("eieio");
-
- /* make sure where in initial state, data hi, clock hi */
- out8 (IIC_DIRECTCNTL, 0xC);
- for (i = 0; i < 10; i++) {
- if ((in8 (IIC_DIRECTCNTL) & 0x3) != 0x3) {
- /* clock until we get to known state */
- out8 (IIC_DIRECTCNTL, 0x8); /* clock lo */
- udelay (100); /* 100us */
- out8 (IIC_DIRECTCNTL, 0xC); /* clock hi */
- udelay (100); /* 100us */
- } else {
- break;
- }
- }
- /* send start condition */
- out8 (IIC_DIRECTCNTL, 0x4);
- udelay (1000); /* 1ms */
- /* send stop condition */
- out8 (IIC_DIRECTCNTL, 0xC);
- udelay (1000); /* 1ms */
- /* Unreset controller */
- out8 (IIC_XTCNTLSS, (status & ~IIC_XTCNTLSS_SRST));
- udelay (1000); /* 1ms */
-}
-
-void i2c_init (int speed, int slaveadd)
-{
- sys_info_t sysInfo;
- unsigned long freqOPB;
- int val, divisor;
-
-#ifdef CFG_I2C_INIT_BOARD
- /* call board specific i2c bus reset routine before accessing the */
- /* environment, which might be in a chip on that bus. For details */
- /* about this problem see doc/I2C_Edge_Conditions. */
- i2c_init_board();
-#endif
-
- /* Handle possible failed I2C state */
- /* FIXME: put this into i2c_init_board()? */
- _i2c_bus_reset ();
-
- /* clear lo master address */
- out8 (IIC_LMADR, 0);
-
- /* clear hi master address */
- out8 (IIC_HMADR, 0);
-
- /* clear lo slave address */
- out8 (IIC_LSADR, 0);
-
- /* clear hi slave address */
- out8 (IIC_HSADR, 0);
-
- /* Clock divide Register */
- /* get OPB frequency */
- get_sys_info (&sysInfo);
- freqOPB = sysInfo.freqPLB / sysInfo.pllOpbDiv;
- /* set divisor according to freqOPB */
- divisor = (freqOPB - 1) / 10000000;
- if (divisor == 0)
- divisor = 1;
- out8 (IIC_CLKDIV, divisor);
-
- /* no interrupts */
- out8 (IIC_INTRMSK, 0);
-
- /* clear transfer count */
- out8 (IIC_XFRCNT, 0);
-
- /* clear extended control & stat */
- /* write 1 in SRC SRS SWC SWS to clear these fields */
- out8 (IIC_XTCNTLSS, 0xF0);
-
- /* Mode Control Register
- Flush Slave/Master data buffer */
- out8 (IIC_MDCNTL, IIC_MDCNTL_FSDB | IIC_MDCNTL_FMDB);
- __asm__ volatile ("eieio");
-
-
- val = in8(IIC_MDCNTL);
- __asm__ volatile ("eieio");
-
- /* Ignore General Call, slave transfers are ignored,
- disable interrupts, exit unknown bus state, enable hold
- SCL
- 100kHz normaly or FastMode for 400kHz and above
- */
-
- val |= IIC_MDCNTL_EUBS|IIC_MDCNTL_HSCL;
- if( speed >= 400000 ){
- val |= IIC_MDCNTL_FSM;
- }
- out8 (IIC_MDCNTL, val);
-
- /* clear control reg */
- out8 (IIC_CNTL, 0x00);
- __asm__ volatile ("eieio");
-
-}
-
-/*
- This code tries to use the features of the 405GP i2c
- controller. It will transfer up to 4 bytes in one pass
- on the loop. It only does out8(lbz) to the buffer when it
- is possible to do out16(lhz) transfers.
-
- cmd_type is 0 for write 1 for read.
-
- addr_len can take any value from 0-255, it is only limited
- by the char, we could make it larger if needed. If it is
- 0 we skip the address write cycle.
-
- Typical case is a Write of an addr followd by a Read. The
- IBM FAQ does not cover this. On the last byte of the write
- we don't set the creg CHT bit, and on the first bytes of the
- read we set the RPST bit.
-
- It does not support address only transfers, there must be
- a data part. If you want to write the address yourself, put
- it in the data pointer.
-
- It does not support transfer to/from address 0.
-
- It does not check XFRCNT.
-*/
-static
-int i2c_transfer(unsigned char cmd_type,
- unsigned char chip,
- unsigned char addr[],
- unsigned char addr_len,
- unsigned char data[],
- unsigned short data_len )
-{
- unsigned char* ptr;
- int reading;
- int tran,cnt;
- int result;
- int status;
- int i;
- uchar creg;
-
- if( data == 0 || data_len == 0 ){
- /*Don't support data transfer of no length or to address 0*/
- printf( "i2c_transfer: bad call\n" );
- return IIC_NOK;
- }
- if( addr && addr_len ){
- ptr = addr;
- cnt = addr_len;
- reading = 0;
- }else{
- ptr = data;
- cnt = data_len;
- reading = cmd_type;
- }
-
- /*Clear Stop Complete Bit*/
- out8(IIC_STS,IIC_STS_SCMP);
- /* Check init */
- i=10;
- do {
- /* Get status */
- status = in8(IIC_STS);
- __asm__ volatile("eieio");
- i--;
- } while ((status & IIC_STS_PT) && (i>0));
-
- if (status & IIC_STS_PT) {
- result = IIC_NOK_TOUT;
- return(result);
- }
- /*flush the Master/Slave Databuffers*/
- out8(IIC_MDCNTL, ((in8(IIC_MDCNTL))|IIC_MDCNTL_FMDB|IIC_MDCNTL_FSDB));
- /*need to wait 4 OPB clocks? code below should take that long*/
-
- /* 7-bit adressing */
- out8(IIC_HMADR,0);
- out8(IIC_LMADR, chip);
- __asm__ volatile("eieio");
-
- tran = 0;
- result = IIC_OK;
- creg = 0;
-
- while ( tran != cnt && (result == IIC_OK)) {
- int bc,j;
-
- /* Control register =
- Normal transfer, 7-bits adressing, Transfer up to bc bytes, Normal start,
- Transfer is a sequence of transfers
- */
- creg |= IIC_CNTL_PT;
-
- bc = (cnt - tran) > 4 ? 4 :
- cnt - tran;
- creg |= (bc-1)<<4;
- /* if the real cmd type is write continue trans*/
- if ( (!cmd_type && (ptr == addr)) || ((tran+bc) != cnt) )
- creg |= IIC_CNTL_CHT;
-
- if (reading)
- creg |= IIC_CNTL_READ;
- else {
- for(j=0; j<bc; j++) {
- /* Set buffer */
- out8(IIC_MDBUF,ptr[tran+j]);
- __asm__ volatile("eieio");
- }
- }
- out8(IIC_CNTL, creg );
- __asm__ volatile("eieio");
-
- /* Transfer is in progress
- we have to wait for upto 5 bytes of data
- 1 byte chip address+r/w bit then bc bytes
- of data.
- udelay(10) is 1 bit time at 100khz
- Doubled for slop. 20 is too small.
- */
- i=2*5*8;
- do {
- /* Get status */
- status = in8(IIC_STS);
- __asm__ volatile("eieio");
- udelay (10);
- i--;
- } while ((status & IIC_STS_PT) && !(status & IIC_STS_ERR)
- && (i>0));
-
- if (status & IIC_STS_ERR) {
- result = IIC_NOK;
- status = in8 (IIC_EXTSTS);
- /* Lost arbitration? */
- if (status & IIC_EXTSTS_LA)
- result = IIC_NOK_LA;
- /* Incomplete transfer? */
- if (status & IIC_EXTSTS_ICT)
- result = IIC_NOK_ICT;
- /* Transfer aborted? */
- if (status & IIC_EXTSTS_XFRA)
- result = IIC_NOK_XFRA;
- } else if ( status & IIC_STS_PT) {
- result = IIC_NOK_TOUT;
- }
- /* Command is reading => get buffer */
- if ((reading) && (result == IIC_OK)) {
- /* Are there data in buffer */
- if (status & IIC_STS_MDBS) {
- /*
- even if we have data we have to wait 4OPB clocks
- for it to hit the front of the FIFO, after that
- we can just read. We should check XFCNT here and
- if the FIFO is full there is no need to wait.
- */
- udelay (1);
- for(j=0;j<bc;j++) {
- ptr[tran+j] = in8(IIC_MDBUF);
- __asm__ volatile("eieio");
- }
- } else
- result = IIC_NOK_DATA;
- }
- creg = 0;
- tran+=bc;
- if( ptr == addr && tran == cnt ) {
- ptr = data;
- cnt = data_len;
- tran = 0;
- reading = cmd_type;
- if( reading )
- creg = IIC_CNTL_RPST;
- }
- }
- return (result);
-}
-
-int i2c_probe (uchar chip)
-{
- uchar buf[1];
-
- buf[0] = 0;
-
- /*
- * What is needed is to send the chip address and verify that the
- * address was <ACK>ed (i.e. there was a chip at that address which
- * drove the data line low).
- */
- return(i2c_transfer (1, chip << 1, 0,0, buf, 1) != 0);
-}
-
-
-int i2c_read (uchar chip, uint addr, int alen, uchar * buffer, int len)
-{
- uchar xaddr[4];
- int ret;
-
- if ( alen > 4 ) {
- printf ("I2C read: addr len %d not supported\n", alen);
- return 1;
- }
-
- if ( alen > 0 ) {
- xaddr[0] = (addr >> 24) & 0xFF;
- xaddr[1] = (addr >> 16) & 0xFF;
- xaddr[2] = (addr >> 8) & 0xFF;
- xaddr[3] = addr & 0xFF;
- }
-
-
-#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
- /*
- * EEPROM chips that implement "address overflow" are ones
- * like Catalyst 24WC04/08/16 which has 9/10/11 bits of
- * address and the extra bits end up in the "chip address"
- * bit slots. This makes a 24WC08 (1Kbyte) chip look like
- * four 256 byte chips.
- *
- * Note that we consider the length of the address field to
- * still be one byte because the extra address bits are
- * hidden in the chip address.
- */
- if( alen > 0 )
- chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
-#endif
- if( (ret = i2c_transfer( 1, chip<<1, &xaddr[4-alen], alen, buffer, len )) != 0) {
- if (gd->have_console)
- printf( "I2c read: failed %d\n", ret);
- return 1;
- }
- return 0;
-}
-
-int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len)
-{
- uchar xaddr[4];
-
- if ( alen > 4 ) {
- printf ("I2C write: addr len %d not supported\n", alen);
- return 1;
-
- }
- if ( alen > 0 ) {
- xaddr[0] = (addr >> 24) & 0xFF;
- xaddr[1] = (addr >> 16) & 0xFF;
- xaddr[2] = (addr >> 8) & 0xFF;
- xaddr[3] = addr & 0xFF;
- }
-
-#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
- /*
- * EEPROM chips that implement "address overflow" are ones
- * like Catalyst 24WC04/08/16 which has 9/10/11 bits of
- * address and the extra bits end up in the "chip address"
- * bit slots. This makes a 24WC08 (1Kbyte) chip look like
- * four 256 byte chips.
- *
- * Note that we consider the length of the address field to
- * still be one byte because the extra address bits are
- * hidden in the chip address.
- */
- if( alen > 0 )
- chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
-#endif
-
- return (i2c_transfer( 0, chip<<1, &xaddr[4-alen], alen, buffer, len ) != 0);
-}
-
-/*-----------------------------------------------------------------------
- * Read a register
- */
-uchar i2c_reg_read(uchar i2c_addr, uchar reg)
-{
- uchar buf;
-
- i2c_read(i2c_addr, reg, 1, &buf, 1);
-
- return(buf);
-}
-
-/*-----------------------------------------------------------------------
- * Write a register
- */
-void i2c_reg_write(uchar i2c_addr, uchar reg, uchar val)
-{
- i2c_write(i2c_addr, reg, 1, &val, 1);
-}
-#endif /* CONFIG_HARD_I2C */
diff --git a/cpu/ppc4xx/interrupts.c b/cpu/ppc4xx/interrupts.c
deleted file mode 100644
index d169df2250..0000000000
--- a/cpu/ppc4xx/interrupts.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2002 (440 port)
- * Scott McNutt, Artesyn Communication Producs, smcnutt@artsyncp.com
- *
- * (C) Copyright 2003 (440GX port)
- * Travis B. Sawyer, Sandburst Corporation, tsawyer@sandburst.com
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <watchdog.h>
-#include <command.h>
-#include <asm/processor.h>
-#include <ppc4xx.h>
-#include <ppc_asm.tmpl>
-#include <commproc.h>
-#include "vecnum.h"
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/****************************************************************************/
-
-/*
- * CPM interrupt vector functions.
- */
-struct irq_action {
- interrupt_handler_t *handler;
- void *arg;
- int count;
-};
-
-static struct irq_action irq_vecs[32];
-void uic0_interrupt( void * parms); /* UIC0 handler */
-
-#if defined(CONFIG_440)
-static struct irq_action irq_vecs1[32]; /* For UIC1 */
-
-void uic1_interrupt( void * parms); /* UIC1 handler */
-
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-static struct irq_action irq_vecs2[32]; /* For UIC2 */
-void uic2_interrupt( void * parms); /* UIC2 handler */
-#endif /* CONFIG_440GX CONFIG_440SPE */
-
-#if defined(CONFIG_440SPE) || defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-static struct irq_action irq_vecs3[32]; /* For UIC3 */
-void uic3_interrupt( void * parms); /* UIC3 handler */
-#endif /* CONFIG_440SPE */
-
-#endif /* CONFIG_440 */
-
-/****************************************************************************/
-#if defined(CONFIG_440)
-
-/* SPRN changed in 440 */
-static __inline__ void set_evpr(unsigned long val)
-{
- asm volatile("mtspr 0x03f,%0" : : "r" (val));
-}
-
-#else /* !defined(CONFIG_440) */
-
-static __inline__ void set_pit(unsigned long val)
-{
- asm volatile("mtpit %0" : : "r" (val));
-}
-
-
-static __inline__ void set_tcr(unsigned long val)
-{
- asm volatile("mttcr %0" : : "r" (val));
-}
-
-
-static __inline__ void set_evpr(unsigned long val)
-{
- asm volatile("mtevpr %0" : : "r" (val));
-}
-#endif /* defined(CONFIG_440 */
-
-/****************************************************************************/
-
-int interrupt_init_cpu (unsigned *decrementer_count)
-{
- int vec;
- unsigned long val;
-
- /* decrementer is automatically reloaded */
- *decrementer_count = 0;
-
- /*
- * Mark all irqs as free
- */
- for (vec=0; vec<32; vec++) {
- irq_vecs[vec].handler = NULL;
- irq_vecs[vec].arg = NULL;
- irq_vecs[vec].count = 0;
-#if defined(CONFIG_440)
- irq_vecs1[vec].handler = NULL;
- irq_vecs1[vec].arg = NULL;
- irq_vecs1[vec].count = 0;
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
- irq_vecs2[vec].handler = NULL;
- irq_vecs2[vec].arg = NULL;
- irq_vecs2[vec].count = 0;
-#endif /* CONFIG_440GX */
-#if defined(CONFIG_440SPE) || defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
- irq_vecs3[vec].handler = NULL;
- irq_vecs3[vec].arg = NULL;
- irq_vecs3[vec].count = 0;
-#endif /* CONFIG_440SPE */
-#endif
- }
-
-#ifdef CONFIG_4xx
- /*
- * Init PIT
- */
-#if defined(CONFIG_440)
- val = mfspr( tcr );
- val &= (~0x04400000); /* clear DIS & ARE */
- mtspr( tcr, val );
- mtspr( dec, 0 ); /* Prevent exception after TSR clear*/
- mtspr( decar, 0 ); /* clear reload */
- mtspr( tsr, 0x08000000 ); /* clear DEC status */
- val = gd->bd->bi_intfreq/1000; /* 1 msec */
- mtspr( decar, val ); /* Set auto-reload value */
- mtspr( dec, val ); /* Set inital val */
-#else
- set_pit(gd->bd->bi_intfreq / 1000);
-#endif
-#endif /* CONFIG_4xx */
-
-#ifdef CONFIG_ADCIOP
- /*
- * Init PIT
- */
- set_pit(66000);
-#endif
-
- /*
- * Enable PIT
- */
- val = mfspr(tcr);
- val |= 0x04400000;
- mtspr(tcr, val);
-
- /*
- * Set EVPR to 0
- */
- set_evpr(0x00000000);
-
-#if defined(CONFIG_440)
-#if !defined(CONFIG_440GX)
- /* Install the UIC1 handlers */
- irq_install_handler(VECNUM_UIC1NC, uic1_interrupt, 0);
- irq_install_handler(VECNUM_UIC1C, uic1_interrupt, 0);
-#endif
-#endif
-
-#if defined(CONFIG_440GX)
- /* Take the GX out of compatibility mode
- * Travis Sawyer, 9 Mar 2004
- * NOTE: 440gx user manual inconsistency here
- * Compatibility mode and Ethernet Clock select are not
- * correct in the manual
- */
- mfsdr(sdr_mfr, val);
- val &= ~0x10000000;
- mtsdr(sdr_mfr,val);
-
- /* Enable UIC interrupts via UIC Base Enable Register */
- mtdcr(uicb0sr, UICB0_ALL);
- mtdcr(uicb0er, 0x54000000);
- /* None are critical */
- mtdcr(uicb0cr, 0);
-#endif
-
- return (0);
-}
-
-/****************************************************************************/
-
-/*
- * Handle external interrupts
- */
-#if defined(CONFIG_440GX)
-void external_interrupt(struct pt_regs *regs)
-{
- ulong uic_msr;
-
- /*
- * Read masked interrupt status register to determine interrupt source
- */
- /* 440 GX uses base uic register */
- uic_msr = mfdcr(uicb0msr);
-
- if ( (UICB0_UIC0CI & uic_msr) || (UICB0_UIC0NCI & uic_msr) )
- uic0_interrupt(0);
-
- if ( (UICB0_UIC1CI & uic_msr) || (UICB0_UIC1NCI & uic_msr) )
- uic1_interrupt(0);
-
- if ( (UICB0_UIC2CI & uic_msr) || (UICB0_UIC2NCI & uic_msr) )
- uic2_interrupt(0);
-
- mtdcr(uicb0sr, uic_msr);
-
- return;
-
-} /* external_interrupt CONFIG_440GX */
-
-#elif defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-void external_interrupt(struct pt_regs *regs)
-{
- ulong uic_msr;
-
- /*
- * Read masked interrupt status register to determine interrupt source
- */
- /* 440 SPe uses base uic register */
- uic_msr = mfdcr(uic0msr);
-
- if ( (UICB0_UIC1CI & uic_msr) || (UICB0_UIC1NCI & uic_msr) )
- uic1_interrupt(0);
-
- if ( (UICB0_UIC2CI & uic_msr) || (UICB0_UIC2NCI & uic_msr) )
- uic2_interrupt(0);
-
- if (uic_msr & ~(UICB0_ALL))
- uic0_interrupt(0);
-
- mtdcr(uic0sr, uic_msr);
-
- return;
-
-} /* external_interrupt CONFIG_440EPX & CONFIG_440GRX */
-
-#elif defined(CONFIG_440SPE)
-void external_interrupt(struct pt_regs *regs)
-{
- ulong uic_msr;
-
- /*
- * Read masked interrupt status register to determine interrupt source
- */
- /* 440 SPe uses base uic register */
- uic_msr = mfdcr(uic0msr);
-
- if ( (UICB0_UIC1CI & uic_msr) || (UICB0_UIC1NCI & uic_msr) )
- uic1_interrupt(0);
-
- if ( (UICB0_UIC2CI & uic_msr) || (UICB0_UIC2NCI & uic_msr) )
- uic2_interrupt(0);
-
- if ( (UICB0_UIC3CI & uic_msr) || (UICB0_UIC3NCI & uic_msr) )
- uic3_interrupt(0);
-
- if (uic_msr & ~(UICB0_ALL))
- uic0_interrupt(0);
-
- mtdcr(uic0sr, uic_msr);
-
- return;
-} /* external_interrupt CONFIG_440SPE */
-
-#else
-
-void external_interrupt(struct pt_regs *regs)
-{
- ulong uic_msr;
- ulong msr_shift;
- int vec;
-
- /*
- * Read masked interrupt status register to determine interrupt source
- */
- uic_msr = mfdcr(uicmsr);
- msr_shift = uic_msr;
- vec = 0;
-
- while (msr_shift != 0) {
- if (msr_shift & 0x80000000) {
- /*
- * Increment irq counter (for debug purpose only)
- */
- irq_vecs[vec].count++;
-
- if (irq_vecs[vec].handler != NULL) {
- /* call isr */
- (*irq_vecs[vec].handler)(irq_vecs[vec].arg);
- } else {
- mtdcr(uicer, mfdcr(uicer) & ~(0x80000000 >> vec));
- printf ("Masking bogus interrupt vector 0x%x\n", vec);
- }
-
- /*
- * After servicing the interrupt, we have to remove the status indicator.
- */
- mtdcr(uicsr, (0x80000000 >> vec));
- }
-
- /*
- * Shift msr to next position and increment vector
- */
- msr_shift <<= 1;
- vec++;
- }
-}
-#endif
-
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-/* Handler for UIC0 interrupt */
-void uic0_interrupt( void * parms)
-{
- ulong uic_msr;
- ulong msr_shift;
- int vec;
-
- /*
- * Read masked interrupt status register to determine interrupt source
- */
- uic_msr = mfdcr(uicmsr);
- msr_shift = uic_msr;
- vec = 0;
-
- while (msr_shift != 0) {
- if (msr_shift & 0x80000000) {
- /*
- * Increment irq counter (for debug purpose only)
- */
- irq_vecs[vec].count++;
-
- if (irq_vecs[vec].handler != NULL) {
- /* call isr */
- (*irq_vecs[vec].handler)(irq_vecs[vec].arg);
- } else {
- mtdcr(uicer, mfdcr(uicer) & ~(0x80000000 >> vec));
- printf ("Masking bogus interrupt vector (uic0) 0x%x\n", vec);
- }
-
- /*
- * After servicing the interrupt, we have to remove the status indicator.
- */
- mtdcr(uicsr, (0x80000000 >> vec));
- }
-
- /*
- * Shift msr to next position and increment vector
- */
- msr_shift <<= 1;
- vec++;
- }
-}
-
-#endif /* CONFIG_440GX */
-
-#if defined(CONFIG_440)
-/* Handler for UIC1 interrupt */
-void uic1_interrupt( void * parms)
-{
- ulong uic1_msr;
- ulong msr_shift;
- int vec;
-
- /*
- * Read masked interrupt status register to determine interrupt source
- */
- uic1_msr = mfdcr(uic1msr);
- msr_shift = uic1_msr;
- vec = 0;
-
- while (msr_shift != 0) {
- if (msr_shift & 0x80000000) {
- /*
- * Increment irq counter (for debug purpose only)
- */
- irq_vecs1[vec].count++;
-
- if (irq_vecs1[vec].handler != NULL) {
- /* call isr */
- (*irq_vecs1[vec].handler)(irq_vecs1[vec].arg);
- } else {
- mtdcr(uic1er, mfdcr(uic1er) & ~(0x80000000 >> vec));
- printf ("Masking bogus interrupt vector (uic1) 0x%x\n", vec);
- }
-
- /*
- * After servicing the interrupt, we have to remove the status indicator.
- */
- mtdcr(uic1sr, (0x80000000 >> vec));
- }
-
- /*
- * Shift msr to next position and increment vector
- */
- msr_shift <<= 1;
- vec++;
- }
-}
-#endif /* defined(CONFIG_440) */
-
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-/* Handler for UIC2 interrupt */
-void uic2_interrupt( void * parms)
-{
- ulong uic2_msr;
- ulong msr_shift;
- int vec;
-
- /*
- * Read masked interrupt status register to determine interrupt source
- */
- uic2_msr = mfdcr(uic2msr);
- msr_shift = uic2_msr;
- vec = 0;
-
- while (msr_shift != 0) {
- if (msr_shift & 0x80000000) {
- /*
- * Increment irq counter (for debug purpose only)
- */
- irq_vecs2[vec].count++;
-
- if (irq_vecs2[vec].handler != NULL) {
- /* call isr */
- (*irq_vecs2[vec].handler)(irq_vecs2[vec].arg);
- } else {
- mtdcr(uic2er, mfdcr(uic2er) & ~(0x80000000 >> vec));
- printf ("Masking bogus interrupt vector (uic2) 0x%x\n", vec);
- }
-
- /*
- * After servicing the interrupt, we have to remove the status indicator.
- */
- mtdcr(uic2sr, (0x80000000 >> vec));
- }
-
- /*
- * Shift msr to next position and increment vector
- */
- msr_shift <<= 1;
- vec++;
- }
-}
-#endif /* defined(CONFIG_440GX) */
-
-#if defined(CONFIG_440SPE)
-/* Handler for UIC3 interrupt */
-void uic3_interrupt( void * parms)
-{
- ulong uic3_msr;
- ulong msr_shift;
- int vec;
-
- /*
- * Read masked interrupt status register to determine interrupt source
- */
- uic3_msr = mfdcr(uic3msr);
- msr_shift = uic3_msr;
- vec = 0;
-
- while (msr_shift != 0) {
- if (msr_shift & 0x80000000) {
- /*
- * Increment irq counter (for debug purpose only)
- */
- irq_vecs3[vec].count++;
-
- if (irq_vecs3[vec].handler != NULL) {
- /* call isr */
- (*irq_vecs3[vec].handler)(irq_vecs3[vec].arg);
- } else {
- mtdcr(uic3er, mfdcr(uic3er) & ~(0x80000000 >> vec));
- printf ("Masking bogus interrupt vector (uic3) 0x%x\n", vec);
- }
-
- /*
- * After servicing the interrupt, we have to remove the status indicator.
- */
- mtdcr(uic3sr, (0x80000000 >> vec));
- }
-
- /*
- * Shift msr to next position and increment vector
- */
- msr_shift <<= 1;
- vec++;
- }
-}
-#endif /* defined(CONFIG_440SPE) */
-
-/****************************************************************************/
-
-/*
- * Install and free a interrupt handler.
- */
-
-void irq_install_handler (int vec, interrupt_handler_t * handler, void *arg)
-{
- struct irq_action *irqa = irq_vecs;
- int i = vec;
-
-#if defined(CONFIG_440)
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
- if ((vec > 31) && (vec < 64)) {
- i = vec - 32;
- irqa = irq_vecs1;
- } else if (vec > 63) {
- i = vec - 64;
- irqa = irq_vecs2;
- }
-#else /* CONFIG_440GX */
- if (vec > 31) {
- i = vec - 32;
- irqa = irq_vecs1;
- }
-#endif /* CONFIG_440GX */
-#endif /* CONFIG_440 */
-
- /*
- * print warning when replacing with a different irq vector
- */
- if ((irqa[i].handler != NULL) && (irqa[i].handler != handler)) {
- printf ("Interrupt vector %d: handler 0x%x replacing 0x%x\n",
- vec, (uint) handler, (uint) irqa[i].handler);
- }
- irqa[i].handler = handler;
- irqa[i].arg = arg;
-
-#if defined(CONFIG_440)
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
- if ((vec > 31) && (vec < 64))
- mtdcr (uic1er, mfdcr (uic1er) | (0x80000000 >> i));
- else if (vec > 63)
- mtdcr (uic2er, mfdcr (uic2er) | (0x80000000 >> i));
- else
-#endif /* CONFIG_440GX */
- if (vec > 31)
- mtdcr (uic1er, mfdcr (uic1er) | (0x80000000 >> i));
- else
-#endif
- mtdcr (uicer, mfdcr (uicer) | (0x80000000 >> i));
-}
-
-void irq_free_handler (int vec)
-{
- struct irq_action *irqa = irq_vecs;
- int i = vec;
-
-#if defined(CONFIG_440)
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
- if ((vec > 31) && (vec < 64)) {
- irqa = irq_vecs1;
- i = vec - 32;
- } else if (vec > 63) {
- irqa = irq_vecs2;
- i = vec - 64;
- }
-#endif /* CONFIG_440GX */
- if (vec > 31) {
- irqa = irq_vecs1;
- i = vec - 32;
- }
-#endif
-
-
-#if defined(CONFIG_440)
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
- if ((vec > 31) && (vec < 64))
- mtdcr (uic1er, mfdcr (uic1er) & ~(0x80000000 >> i));
- else if (vec > 63)
- mtdcr (uic2er, mfdcr (uic2er) & ~(0x80000000 >> i));
- else
-#endif /* CONFIG_440GX */
- if (vec > 31)
- mtdcr (uic1er, mfdcr (uic1er) & ~(0x80000000 >> i));
- else
-#endif
- mtdcr (uicer, mfdcr (uicer) & ~(0x80000000 >> i));
-
- irqa[i].handler = NULL;
- irqa[i].arg = NULL;
-}
-
-/****************************************************************************/
-
-void timer_interrupt_cpu (struct pt_regs *regs)
-{
- /* nothing to do here */
- return;
-}
-
-/****************************************************************************/
-
-#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
-
-/*******************************************************************************
- *
- * irqinfo - print information about PCI devices
- *
- */
-int
-do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- int vec;
-
- printf ("\nInterrupt-Information:\n");
-#if defined(CONFIG_440)
- printf ("\nUIC 0\n");
-#endif
- printf ("Nr Routine Arg Count\n");
-
- for (vec=0; vec<32; vec++) {
- if (irq_vecs[vec].handler != NULL) {
- printf ("%02d %08lx %08lx %d\n",
- vec,
- (ulong)irq_vecs[vec].handler,
- (ulong)irq_vecs[vec].arg,
- irq_vecs[vec].count);
- }
- }
-
-#if defined(CONFIG_440)
- printf ("\nUIC 1\n");
- printf ("Nr Routine Arg Count\n");
-
- for (vec=0; vec<32; vec++) {
- if (irq_vecs1[vec].handler != NULL)
- printf ("%02d %08lx %08lx %d\n",
- vec+31, (ulong)irq_vecs1[vec].handler,
- (ulong)irq_vecs1[vec].arg, irq_vecs1[vec].count);
- }
- printf("\n");
-#endif
-
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
- printf ("\nUIC 2\n");
- printf ("Nr Routine Arg Count\n");
-
- for (vec=0; vec<32; vec++) {
- if (irq_vecs2[vec].handler != NULL)
- printf ("%02d %08lx %08lx %d\n",
- vec+63, (ulong)irq_vecs2[vec].handler,
- (ulong)irq_vecs2[vec].arg, irq_vecs2[vec].count);
- }
- printf("\n");
-#endif
-
-#if defined(CONFIG_440SPE)
- printf ("\nUIC 3\n");
- printf ("Nr Routine Arg Count\n");
-
- for (vec=0; vec<32; vec++) {
- if (irq_vecs3[vec].handler != NULL)
- printf ("%02d %08lx %08lx %d\n",
- vec+63, (ulong)irq_vecs3[vec].handler,
- (ulong)irq_vecs3[vec].arg, irq_vecs3[vec].count);
- }
- printf("\n");
-#endif
-
- return 0;
-}
-#endif /* CONFIG_COMMANDS & CFG_CMD_IRQ */
diff --git a/cpu/ppc4xx/kgdb.S b/cpu/ppc4xx/kgdb.S
deleted file mode 100644
index 73c265dbe5..0000000000
--- a/cpu/ppc4xx/kgdb.S
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2000 Murray Jensen <Murray.Jensen@cmst.csiro.au>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <command.h>
-#include <ppc4xx.h>
-#include <version.h>
-
-#define CONFIG_405GP 1 /* needed for Linux kernel header files */
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- /*
- * cache flushing routines for kgdb
- */
-
- .globl kgdb_flush_cache_all
-kgdb_flush_cache_all:
- /* icache */
- iccci r0,r0 /* iccci invalidates the entire I cache */
- /* dcache */
- addi r6,0,0x0000 /* clear GPR 6 */
- addi r7,r0, 128 /* do loop for # of dcache lines */
- /* NOTE: dccci invalidates both */
- mtctr r7 /* ways in the D cache */
-..dcloop:
- dccci 0,r6 /* invalidate line */
- addi r6,r6, 32 /* bump to next line */
- bdnz ..dcloop
- blr
-
- .globl kgdb_flush_cache_range
-kgdb_flush_cache_range:
- li r5,CONFIG_CACHELINE_SIZE-1
- andc r3,r3,r5
- subf r4,r3,r4
- add r4,r4,r5
- srwi. r4,r4,CFG_CACHELINE_SHIFT
- beqlr
- mtctr r4
- mr r6,r3
-1: dcbst 0,r3
- addi r3,r3,CONFIG_CACHELINE_SIZE
- bdnz 1b
- sync /* wait for dcbst's to get to ram */
- mtctr r4
-2: icbi 0,r6
- addi r6,r6,CONFIG_CACHELINE_SIZE
- bdnz 2b
- SYNC
- blr
-
-#endif /* CFG_CMD_KGDB */
diff --git a/cpu/ppc4xx/miiphy.c b/cpu/ppc4xx/miiphy.c
deleted file mode 100644
index 6b98025308..0000000000
--- a/cpu/ppc4xx/miiphy.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*-----------------------------------------------------------------------------+
- |
- | This source code has been made available to you by IBM on an AS-IS
- | basis. Anyone receiving this source is licensed under IBM
- | copyrights to use it in any way he or she deems fit, including
- | copying it, modifying it, compiling it, and redistributing it either
- | with or without modifications. No license under IBM patents or
- | patent applications is to be implied by the copyright license.
- |
- | Any user of this software should understand that IBM cannot provide
- | technical support for this software and will not be responsible for
- | any consequences resulting from the use of this software.
- |
- | Any person who transfers this source code or any derivative work
- | must include the IBM copyright notice, this paragraph, and the
- | preceding two paragraphs in the transferred software.
- |
- | COPYRIGHT I B M CORPORATION 1995
- | LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
- +-----------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------+
- |
- | File Name: miiphy.c
- |
- | Function: This module has utilities for accessing the MII PHY through
- | the EMAC3 macro.
- |
- | Author: Mark Wisner
- |
- | Change Activity-
- |
- | Date Description of Change BY
- | --------- --------------------- ---
- | 05-May-99 Created MKW
- | 01-Jul-99 Changed clock setting of sta_reg from 66Mhz to 50Mhz to
- | better match OPB speed. Also modified delay times. JWB
- | 29-Jul-99 Added Full duplex support MKW
- | 24-Aug-99 Removed printf from dp83843_duplex() JWB
- | 19-Jul-00 Ported to esd cpci405 sr
- | 23-Dec-03 Ported from miiphy.c to 440GX Travis Sawyer TBS
- | <travis.sawyer@sandburst.com>
- |
- +-----------------------------------------------------------------------------*/
-
-#include <common.h>
-#include <asm/processor.h>
-#include <ppc_asm.tmpl>
-#include <commproc.h>
-#include <ppc4xx_enet.h>
-#include <405_mal.h>
-#include <miiphy.h>
-
-#undef ET_DEBUG
-/***********************************************************/
-/* Dump out to the screen PHY regs */
-/***********************************************************/
-
-void miiphy_dump (char *devname, unsigned char addr)
-{
- unsigned long i;
- unsigned short data;
-
-
- for (i = 0; i < 0x1A; i++) {
- if (miiphy_read (devname, addr, i, &data)) {
- printf ("read error for reg %lx\n", i);
- return;
- }
- printf ("Phy reg %lx ==> %4x\n", i, data);
-
- /* jump to the next set of regs */
- if (i == 0x07)
- i = 0x0f;
-
- } /* end for loop */
-} /* end dump */
-
-
-/***********************************************************/
-/* (Re)start autonegotiation */
-/***********************************************************/
-int phy_setup_aneg (char *devname, unsigned char addr)
-{
- unsigned short ctl, adv;
-
- /* Setup standard advertise */
- miiphy_read (devname, addr, PHY_ANAR, &adv);
- adv |= (PHY_ANLPAR_ACK | PHY_ANLPAR_RF | PHY_ANLPAR_T4 |
- PHY_ANLPAR_TXFD | PHY_ANLPAR_TX | PHY_ANLPAR_10FD |
- PHY_ANLPAR_10);
- miiphy_write (devname, addr, PHY_ANAR, adv);
-
- miiphy_read (devname, addr, PHY_1000BTCR, &adv);
- adv |= (0x0300);
- miiphy_write (devname, addr, PHY_1000BTCR, adv);
-
- /* Start/Restart aneg */
- miiphy_read (devname, addr, PHY_BMCR, &ctl);
- ctl |= (PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
- miiphy_write (devname, addr, PHY_BMCR, ctl);
-
- return 0;
-}
-
-
-/***********************************************************/
-/* read a phy reg and return the value with a rc */
-/***********************************************************/
-unsigned int miiphy_getemac_offset (void)
-{
-#if (defined(CONFIG_440) && !defined(CONFIG_440SP) && !defined(CONFIG_440SPE)) && defined(CONFIG_NET_MULTI)
- unsigned long zmii;
- unsigned long eoffset;
-
- /* Need to find out which mdi port we're using */
- zmii = in32 (ZMII_FER);
-
- if (zmii & (ZMII_FER_MDI << ZMII_FER_V (0))) {
- /* using port 0 */
- eoffset = 0;
- } else if (zmii & (ZMII_FER_MDI << ZMII_FER_V (1))) {
- /* using port 1 */
- eoffset = 0x100;
- } else if (zmii & (ZMII_FER_MDI << ZMII_FER_V (2))) {
- /* using port 2 */
- eoffset = 0x400;
- } else if (zmii & (ZMII_FER_MDI << ZMII_FER_V (3))) {
- /* using port 3 */
- eoffset = 0x600;
- } else {
- /* None of the mdi ports are enabled! */
- /* enable port 0 */
- zmii |= ZMII_FER_MDI << ZMII_FER_V (0);
- out32 (ZMII_FER, zmii);
- eoffset = 0;
- /* need to soft reset port 0 */
- zmii = in32 (EMAC_M0);
- zmii |= EMAC_M0_SRST;
- out32 (EMAC_M0, zmii);
- }
-
- return (eoffset);
-#else
- return 0;
-#endif
-}
-
-
-int emac4xx_miiphy_read (char *devname, unsigned char addr,
- unsigned char reg, unsigned short *value)
-{
- unsigned long sta_reg; /* STA scratch area */
- unsigned long i;
- unsigned long emac_reg;
-
-
- emac_reg = miiphy_getemac_offset ();
- /* see if it is ready for 1000 nsec */
- i = 0;
-
- /* see if it is ready for sec */
- while ((in32 (EMAC_STACR + emac_reg) & EMAC_STACR_OC) == EMAC_STACR_OC_MASK) {
- udelay (7);
- if (i > 5) {
-#ifdef ET_DEBUG
- sta_reg = in32 (EMAC_STACR + emac_reg);
- printf ("read : EMAC_STACR=0x%0x\n", sta_reg); /* test-only */
- printf ("read err 1\n");
-#endif
- return -1;
- }
- i++;
- }
- sta_reg = reg; /* reg address */
- /* set clock (50Mhz) and read flags */
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-#if defined(CONFIG_IBM_EMAC4_V4) /* EMAC4 V4 changed bit setting */
- sta_reg = (sta_reg & ~EMAC_STACR_OP_MASK) | EMAC_STACR_READ;
-#else
- sta_reg |= EMAC_STACR_READ;
-#endif
-#else
- sta_reg = (sta_reg | EMAC_STACR_READ) & ~EMAC_STACR_CLK_100MHZ;
-#endif
-
-#if defined(CONFIG_PHY_CLK_FREQ) && !defined(CONFIG_440GX) && \
- !defined(CONFIG_440SP) && !defined(CONFIG_440SPE) && \
- !defined(CONFIG_440EPX) && !defined(CONFIG_440GRX)
- sta_reg = sta_reg | CONFIG_PHY_CLK_FREQ;
-#endif
- sta_reg = sta_reg | (addr << 5); /* Phy address */
- sta_reg = sta_reg | EMAC_STACR_OC_MASK; /* new IBM emac v4 */
- out32 (EMAC_STACR + emac_reg, sta_reg);
-#ifdef ET_DEBUG
- printf ("a2: write: EMAC_STACR=0x%0x\n", sta_reg); /* test-only */
-#endif
-
- sta_reg = in32 (EMAC_STACR + emac_reg);
-#ifdef ET_DEBUG
- printf ("a21: read : EMAC_STACR=0x%0x\n", sta_reg); /* test-only */
-#endif
- i = 0;
- while ((sta_reg & EMAC_STACR_OC) == EMAC_STACR_OC_MASK) {
- udelay (7);
- if (i > 5) {
- return -1;
- }
- i++;
- sta_reg = in32 (EMAC_STACR + emac_reg);
-#ifdef ET_DEBUG
- printf ("a22: read : EMAC_STACR=0x%0x\n", sta_reg); /* test-only */
-#endif
- }
- if ((sta_reg & EMAC_STACR_PHYE) != 0) {
- return -1;
- }
-
- *value = *(short *) (&sta_reg);
- return 0;
-
-
-} /* phy_read */
-
-
-/***********************************************************/
-/* write a phy reg and return the value with a rc */
-/***********************************************************/
-
-int emac4xx_miiphy_write (char *devname, unsigned char addr,
- unsigned char reg, unsigned short value)
-{
- unsigned long sta_reg; /* STA scratch area */
- unsigned long i;
- unsigned long emac_reg;
-
- emac_reg = miiphy_getemac_offset ();
- /* see if it is ready for 1000 nsec */
- i = 0;
-
- while ((in32 (EMAC_STACR + emac_reg) & EMAC_STACR_OC) == EMAC_STACR_OC_MASK) {
- if (i > 5)
- return -1;
- udelay (7);
- i++;
- }
- sta_reg = 0;
- sta_reg = reg; /* reg address */
- /* set clock (50Mhz) and read flags */
-#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-#if defined(CONFIG_IBM_EMAC4_V4) /* EMAC4 V4 changed bit setting */
- sta_reg = (sta_reg & ~EMAC_STACR_OP_MASK) | EMAC_STACR_WRITE;
-#else
- sta_reg |= EMAC_STACR_WRITE;
-#endif
-#else
- sta_reg = (sta_reg | EMAC_STACR_WRITE) & ~EMAC_STACR_CLK_100MHZ;
-#endif
-
-#if defined(CONFIG_PHY_CLK_FREQ) && !defined(CONFIG_440GX) && \
- !defined(CONFIG_440SP) && !defined(CONFIG_440SPE) && \
- !defined(CONFIG_440EPX) && !defined(CONFIG_440GRX)
- sta_reg = sta_reg | CONFIG_PHY_CLK_FREQ; /* Set clock frequency (PLB freq. dependend) */
-#endif
- sta_reg = sta_reg | ((unsigned long) addr << 5);/* Phy address */
- sta_reg = sta_reg | EMAC_STACR_OC_MASK; /* new IBM emac v4 */
- memcpy (&sta_reg, &value, 2); /* put in data */
-
- out32 (EMAC_STACR + emac_reg, sta_reg);
-
- /* wait for completion */
- i = 0;
- sta_reg = in32 (EMAC_STACR + emac_reg);
-#ifdef ET_DEBUG
- printf ("a31: read : EMAC_STACR=0x%0x\n", sta_reg); /* test-only */
-#endif
- while ((sta_reg & EMAC_STACR_OC) == EMAC_STACR_OC_MASK) {
- udelay (7);
- if (i > 5)
- return -1;
- i++;
- sta_reg = in32 (EMAC_STACR + emac_reg);
-#ifdef ET_DEBUG
- printf ("a32: read : EMAC_STACR=0x%0x\n", sta_reg); /* test-only */
-#endif
- }
-
- if ((sta_reg & EMAC_STACR_PHYE) != 0)
- return -1;
- return 0;
-
-} /* phy_write */
diff --git a/cpu/ppc4xx/ndfc.c b/cpu/ppc4xx/ndfc.c
deleted file mode 100644
index b198ff46ce..0000000000
--- a/cpu/ppc4xx/ndfc.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Overview:
- * Platform independend driver for NDFC (NanD Flash Controller)
- * integrated into EP440 cores
- *
- * (C) Copyright 2006
- * Stefan Roese, DENX Software Engineering, sr@denx.de.
- *
- * Based on original work by
- * Thomas Gleixner
- * Copyright 2006 IBM
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY) && \
- (defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX))
-
-#include <nand.h>
-#include <linux/mtd/ndfc.h>
-#include <asm/processor.h>
-#include <ppc440.h>
-
-static u8 hwctl = 0;
-
-static void ndfc_hwcontrol(struct mtd_info *mtdinfo, int cmd)
-{
- switch (cmd) {
- case NAND_CTL_SETCLE:
- hwctl |= 0x1;
- break;
-
- case NAND_CTL_CLRCLE:
- hwctl &= ~0x1;
- break;
-
- case NAND_CTL_SETALE:
- hwctl |= 0x2;
- break;
-
- case NAND_CTL_CLRALE:
- hwctl &= ~0x2;
- break;
- }
-}
-
-static void ndfc_write_byte(struct mtd_info *mtdinfo, u_char byte)
-{
- struct nand_chip *this = mtdinfo->priv;
- ulong base = (ulong) this->IO_ADDR_W & 0xfffffffc;
-
- if (hwctl & 0x1)
- out8(base + NDFC_CMD, byte);
- else if (hwctl & 0x2)
- out8(base + NDFC_ALE, byte);
- else
- out8(base + NDFC_DATA, byte);
-}
-
-static u_char ndfc_read_byte(struct mtd_info *mtdinfo)
-{
- struct nand_chip *this = mtdinfo->priv;
- ulong base = (ulong) this->IO_ADDR_W & 0xfffffffc;
-
- return (in8(base + NDFC_DATA));
-}
-
-static int ndfc_dev_ready(struct mtd_info *mtdinfo)
-{
- struct nand_chip *this = mtdinfo->priv;
- ulong base = (ulong) this->IO_ADDR_W & 0xfffffffc;
-
- while (!(in32(base + NDFC_STAT) & NDFC_STAT_IS_READY))
- ;
-
- return 1;
-}
-
-#ifndef CONFIG_NAND_SPL
-/*
- * Don't use these speedup functions in NAND boot image, since the image
- * has to fit into 4kByte.
- */
-
-/*
- * Speedups for buffer read/write/verify
- *
- * NDFC allows 32bit read/write of data. So we can speed up the buffer
- * functions. No further checking, as nand_base will always read/write
- * page aligned.
- */
-static void ndfc_read_buf(struct mtd_info *mtdinfo, uint8_t *buf, int len)
-{
- struct nand_chip *this = mtdinfo->priv;
- ulong base = (ulong) this->IO_ADDR_W & 0xfffffffc;
- uint32_t *p = (uint32_t *) buf;
-
- for (;len > 0; len -= 4)
- *p++ = in32(base + NDFC_DATA);
-}
-
-static void ndfc_write_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
-{
- struct nand_chip *this = mtdinfo->priv;
- ulong base = (ulong) this->IO_ADDR_W & 0xfffffffc;
- uint32_t *p = (uint32_t *) buf;
-
- for (; len > 0; len -= 4)
- out32(base + NDFC_DATA, *p++);
-}
-
-static int ndfc_verify_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
-{
- struct nand_chip *this = mtdinfo->priv;
- ulong base = (ulong) this->IO_ADDR_W & 0xfffffffc;
- uint32_t *p = (uint32_t *) buf;
-
- for (; len > 0; len -= 4)
- if (*p++ != in32(base + NDFC_DATA))
- return -1;
-
- return 0;
-}
-#endif /* #ifndef CONFIG_NAND_SPL */
-
-void board_nand_select_device(struct nand_chip *nand, int chip)
-{
- /*
- * Don't use "chip" to address the NAND device,
- * generate the cs from the address where it is encoded.
- */
- int cs = (ulong)nand->IO_ADDR_W & 0x00000003;
- ulong base = (ulong)nand->IO_ADDR_W & 0xfffffffc;
-
- /* Set NandFlash Core Configuration Register */
- /* 1col x 2 rows */
- out32(base + NDFC_CCR, 0x00000000 | (cs << 24));
-}
-
-int board_nand_init(struct nand_chip *nand)
-{
- int cs = (ulong)nand->IO_ADDR_W & 0x00000003;
- ulong base = (ulong)nand->IO_ADDR_W & 0xfffffffc;
-
- nand->eccmode = NAND_ECC_SOFT;
-
- nand->hwcontrol = ndfc_hwcontrol;
- nand->read_byte = ndfc_read_byte;
- nand->write_byte = ndfc_write_byte;
- nand->dev_ready = ndfc_dev_ready;
-
-#ifndef CONFIG_NAND_SPL
- nand->write_buf = ndfc_write_buf;
- nand->read_buf = ndfc_read_buf;
- nand->verify_buf = ndfc_verify_buf;
-#else
- /*
- * Setup EBC (CS0 only right now)
- */
- mtdcr(ebccfga, xbcfg);
- mtdcr(ebccfgd, 0xb8400000);
-
- mtebc(pb0cr, CFG_EBC_PB0CR);
- mtebc(pb0ap, CFG_EBC_PB0AP);
-#endif
-
- /*
- * Select required NAND chip in NDFC
- */
- board_nand_select_device(nand, cs);
- out32(base + NDFC_BCFG0 + (cs << 2), 0x80002222);
- return 0;
-}
-
-#endif
diff --git a/cpu/ppc4xx/reginfo_405ep.c b/cpu/ppc4xx/reginfo_405ep.c
deleted file mode 100644
index 19fb649123..0000000000
--- a/cpu/ppc4xx/reginfo_405ep.c
+++ /dev/null
@@ -1,68 +0,0 @@
-#include <common.h>
-
-void reginfo(void)
- printf ("\n405EP registers; MSR=%08x\n",mfmsr());
- printf ("\nUniversal Interrupt Controller Regs\n"
- "uicsr uicer uiccr uicpr uictr uicmsr uicvr uicvcr"
- "\n"
- "%08x %08x %08x %08x %08x %08x %08x %08x\n",
- mfdcr(uicsr),
- mfdcr(uicer),
- mfdcr(uiccr),
- mfdcr(uicpr),
- mfdcr(uictr),
- mfdcr(uicmsr),
- mfdcr(uicvr),
- mfdcr(uicvcr));
-
- puts ("\nMemory (SDRAM) Configuration\n"
- "mcopt1 rtr pmit mb0cf mb1cf sdtr1\n");
-
- mtdcr(memcfga,mem_mcopt1); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_rtr); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_pmit); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_mb0cf); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_mb1cf); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_sdtr1); printf ("%08x ", mfdcr(memcfgd));
-
- printf ("\n\n"
- "DMA Channels\n"
- "dmasr dmasgc dmaadr\n" "%08x %08x %08x\n"
- "dmacr_0 dmact_0 dmada_0 dmasa_0 dmasb_0\n" "%08x %08x %08x %08x %08x\n"
- "dmacr_1 dmact_1 dmada_1 dmasa_1 dmasb_1\n" "%08x %08x %08x %08x %08x\n",
- mfdcr(dmasr), mfdcr(dmasgc),mfdcr(dmaadr),
- mfdcr(dmacr0), mfdcr(dmact0),mfdcr(dmada0), mfdcr(dmasa0), mfdcr(dmasb0),
- mfdcr(dmacr1), mfdcr(dmact1),mfdcr(dmada1), mfdcr(dmasa1), mfdcr(dmasb1));
-
- printf (
- "dmacr_2 dmact_2 dmada_2 dmasa_2 dmasb_2\n" "%08x %08x %08x %08x %08x\n"
- "dmacr_3 dmact_3 dmada_3 dmasa_3 dmasb_3\n" "%08x %08x %08x %08x %08x\n",
- mfdcr(dmacr2), mfdcr(dmact2),mfdcr(dmada2), mfdcr(dmasa2), mfdcr(dmasb2),
- mfdcr(dmacr3), mfdcr(dmact3),mfdcr(dmada3), mfdcr(dmasa3), mfdcr(dmasb3) );
-
- puts ("\n"
- "External Bus\n"
- "pbear pbesr0 pbesr1 epcr\n");
- mtdcr(ebccfga,pbear); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pbesr0); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pbesr1); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,epcr); printf ("%08x ", mfdcr(ebccfgd));
-
- puts ("\n"
- "pb0cr pb0ap pb1cr pb1ap pb2cr pb2ap pb3cr pb3ap\n");
- mtdcr(ebccfga,pb0cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb0ap); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb1cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb1ap); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb2cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb2ap); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb3cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb3ap); printf ("%08x ", mfdcr(ebccfgd));
-
- puts ("\n"
- "pb4cr pb4ap\n");
- mtdcr(ebccfga,pb4cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb4ap); printf ("%08x ", mfdcr(ebccfgd));
-
- puts ("\n\n");
-}
diff --git a/cpu/ppc4xx/reginfo_405gp.c b/cpu/ppc4xx/reginfo_405gp.c
deleted file mode 100644
index c220ad8a6b..0000000000
--- a/cpu/ppc4xx/reginfo_405gp.c
+++ /dev/null
@@ -1,91 +0,0 @@
-#include <common.h>
-
-void reginfo(void)
-{
- printf ("\n405GP registers; MSR=%08x\n",mfmsr());
- printf ("\nUniversal Interrupt Controller Regs\n"
- "uicsr uicsrs uicer uiccr uicpr uictr uicmsr uicvr uicvcr"
- "\n"
- "%08x %08x %08x %08x %08x %08x %08x %08x %08x\n",
- mfdcr(uicsr),
- mfdcr(uicsrs),
- mfdcr(uicer),
- mfdcr(uiccr),
- mfdcr(uicpr),
- mfdcr(uictr),
- mfdcr(uicmsr),
- mfdcr(uicvr),
- mfdcr(uicvcr));
-
- puts ("\nMemory (SDRAM) Configuration\n"
- "besra besrsa besrb besrsb bear mcopt1 rtr pmit\n");
-
- mtdcr(memcfga,mem_besra); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_besrsa); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_besrb); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_besrsb); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_bear); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_mcopt1); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_rtr); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_pmit); printf ("%08x ", mfdcr(memcfgd));
-
- puts ("\n"
- "mb0cf mb1cf mb2cf mb3cf sdtr1 ecccf eccerr\n");
- mtdcr(memcfga,mem_mb0cf); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_mb1cf); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_mb2cf); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_mb3cf); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_sdtr1); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_ecccf); printf ("%08x ", mfdcr(memcfgd));
- mtdcr(memcfga,mem_eccerr); printf ("%08x ", mfdcr(memcfgd));
-
- printf ("\n\n"
- "DMA Channels\n"
- "dmasr dmasgc dmaadr\n"
- "%08x %08x %08x\n"
- "dmacr_0 dmact_0 dmada_0 dmasa_0 dmasb_0\n"
- "%08x %08x %08x %08x %08x\n"
- "dmacr_1 dmact_1 dmada_1 dmasa_1 dmasb_1\n"
- "%08x %08x %08x %08x %08x\n",
- mfdcr(dmasr), mfdcr(dmasgc),mfdcr(dmaadr),
- mfdcr(dmacr0), mfdcr(dmact0),mfdcr(dmada0), mfdcr(dmasa0), mfdcr(dmasb0),
- mfdcr(dmacr1), mfdcr(dmact1),mfdcr(dmada1), mfdcr(dmasa1), mfdcr(dmasb1));
-
- printf (
- "dmacr_2 dmact_2 dmada_2 dmasa_2 dmasb_2\n" "%08x %08x %08x %08x %08x\n"
- "dmacr_3 dmact_3 dmada_3 dmasa_3 dmasb_3\n" "%08x %08x %08x %08x %08x\n",
- mfdcr(dmacr2), mfdcr(dmact2),mfdcr(dmada2), mfdcr(dmasa2), mfdcr(dmasb2),
- mfdcr(dmacr3), mfdcr(dmact3),mfdcr(dmada3), mfdcr(dmasa3), mfdcr(dmasb3) );
-
- puts ("\n"
- "External Bus\n"
- "pbear pbesr0 pbesr1 epcr\n");
- mtdcr(ebccfga,pbear); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pbesr0); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pbesr1); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,epcr); printf ("%08x ", mfdcr(ebccfgd));
-
- puts ("\n"
- "pb0cr pb0ap pb1cr pb1ap pb2cr pb2ap pb3cr pb3ap\n");
- mtdcr(ebccfga,pb0cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb0ap); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb1cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb1ap); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb2cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb2ap); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb3cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb3ap); printf ("%08x ", mfdcr(ebccfgd));
-
- puts ("\n"
- "pb4cr pb4ap pb5cr bp5ap pb6cr pb6ap pb7cr pb7ap\n");
- mtdcr(ebccfga,pb4cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb4ap); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb5cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb5ap); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb6cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb6ap); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb7cr); printf ("%08x ", mfdcr(ebccfgd));
- mtdcr(ebccfga,pb7ap); printf ("%08x ", mfdcr(ebccfgd));
-
- puts ("\n\n");
-} \ No newline at end of file
diff --git a/cpu/ppc4xx/resetvec.S b/cpu/ppc4xx/resetvec.S
deleted file mode 100644
index b3308bd6ae..0000000000
--- a/cpu/ppc4xx/resetvec.S
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Copyright MontaVista Software Incorporated, 2000 */
-#include <config.h>
- .section .resetvec,"ax"
-#if defined(CONFIG_440)
- b _start_440
-#else
-#if defined(CONFIG_BOOT_PCI) && defined(CONFIG_MIP405)
- b _start_pci
-#else
- b _start
-#endif
-#endif
diff --git a/cpu/ppc4xx/sdram.c b/cpu/ppc4xx/sdram.c
deleted file mode 100644
index 294b89cb2a..0000000000
--- a/cpu/ppc4xx/sdram.c
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * (C) Copyright 2005-2006
- * Stefan Roese, DENX Software Engineering, sr@denx.de.
- *
- * (C) Copyright 2006
- * DAVE Srl <www.dave-tech.it>
- *
- * (C) Copyright 2002-2004
- * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <ppc4xx.h>
-#include <asm/processor.h>
-#include "sdram.h"
-
-
-#ifdef CONFIG_SDRAM_BANK0
-
-
-#ifndef CFG_SDRAM_TABLE
-sdram_conf_t mb0cf[] = {
- {(128 << 20), 13, 0x000A4001}, /* (0-128MB) Address Mode 3, 13x10(4) */
- {(64 << 20), 13, 0x00084001}, /* (0-64MB) Address Mode 3, 13x9(4) */
- {(32 << 20), 12, 0x00062001}, /* (0-32MB) Address Mode 2, 12x9(4) */
- {(16 << 20), 12, 0x00046001}, /* (0-16MB) Address Mode 4, 12x8(4) */
- {(4 << 20), 11, 0x00008001}, /* (0-4MB) Address Mode 5, 11x8(2) */
-};
-#else
-sdram_conf_t mb0cf[] = CFG_SDRAM_TABLE;
-#endif
-
-#define N_MB0CF (sizeof(mb0cf) / sizeof(mb0cf[0]))
-
-
-#ifndef CONFIG_440
-
-#ifdef CFG_SDRAM_CASL
-static ulong ns2clks(ulong ns)
-{
- ulong bus_period_x_10 = ONE_BILLION / (get_bus_freq(0) / 10);
-
- return ((ns * 10) + bus_period_x_10) / bus_period_x_10;
-}
-#endif /* CFG_SDRAM_CASL */
-
-static ulong compute_sdtr1(ulong speed)
-{
-#ifdef CFG_SDRAM_CASL
- ulong tmp;
- ulong sdtr1 = 0;
-
- /* CASL */
- if (CFG_SDRAM_CASL < 2)
- sdtr1 |= (1 << SDRAM0_TR_CASL);
- else
- if (CFG_SDRAM_CASL > 4)
- sdtr1 |= (3 << SDRAM0_TR_CASL);
- else
- sdtr1 |= ((CFG_SDRAM_CASL-1) << SDRAM0_TR_CASL);
-
- /* PTA */
- tmp = ns2clks(CFG_SDRAM_PTA);
- if ((tmp >= 2) && (tmp <= 4))
- sdtr1 |= ((tmp-1) << SDRAM0_TR_PTA);
- else
- sdtr1 |= ((4-1) << SDRAM0_TR_PTA);
-
- /* CTP */
- tmp = ns2clks(CFG_SDRAM_CTP);
- if ((tmp >= 2) && (tmp <= 4))
- sdtr1 |= ((tmp-1) << SDRAM0_TR_CTP);
- else
- sdtr1 |= ((4-1) << SDRAM0_TR_CTP);
-
- /* LDF */
- tmp = ns2clks(CFG_SDRAM_LDF);
- if ((tmp >= 2) && (tmp <= 4))
- sdtr1 |= ((tmp-1) << SDRAM0_TR_LDF);
- else
- sdtr1 |= ((2-1) << SDRAM0_TR_LDF);
-
- /* RFTA */
- tmp = ns2clks(CFG_SDRAM_RFTA);
- if ((tmp >= 4) && (tmp <= 10))
- sdtr1 |= ((tmp-4) << SDRAM0_TR_RFTA);
- else
- sdtr1 |= ((10-4) << SDRAM0_TR_RFTA);
-
- /* RCD */
- tmp = ns2clks(CFG_SDRAM_RCD);
- if ((tmp >= 2) && (tmp <= 4))
- sdtr1 |= ((tmp-1) << SDRAM0_TR_RCD);
- else
- sdtr1 |= ((4-1) << SDRAM0_TR_RCD);
-
- return sdtr1;
-#else /* CFG_SDRAM_CASL */
- /*
- * If no values are configured in the board config file
- * use the default values, which seem to be ok for most
- * boards.
- *
- * REMARK:
- * For new board ports we strongly recommend to define the
- * correct values for the used SDRAM chips in your board
- * config file (see PPChameleonEVB.h)
- */
- if (speed > 100000000) {
- /*
- * 133 MHz SDRAM
- */
- return 0x01074015;
- } else {
- /*
- * default: 100 MHz SDRAM
- */
- return 0x0086400d;
- }
-#endif /* CFG_SDRAM_CASL */
-}
-
-/* refresh is expressed in ms */
-static ulong compute_rtr(ulong speed, ulong rows, ulong refresh)
-{
-#ifdef CFG_SDRAM_CASL
- ulong tmp;
-
- tmp = ((refresh*1000*1000) / (1 << rows)) * (speed / 1000);
- tmp /= 1000000;
-
- return ((tmp & 0x00003FF8) << 16);
-#else /* CFG_SDRAM_CASL */
- if (speed > 100000000) {
- /*
- * 133 MHz SDRAM
- */
- return 0x07f00000;
- } else {
- /*
- * default: 100 MHz SDRAM
- */
- return 0x05f00000;
- }
-#endif /* CFG_SDRAM_CASL */
-}
-
-/*
- * Autodetect onboard SDRAM on 405 platforms
- */
-void sdram_init(void)
-{
- ulong speed;
- ulong sdtr1;
- int i;
-
- /*
- * Determine SDRAM speed
- */
- speed = get_bus_freq(0); /* parameter not used on ppc4xx */
-
- /*
- * sdtr1 (register SDRAM0_TR) must take into account timings listed
- * in SDRAM chip datasheet. rtr (register SDRAM0_RTR) must take into
- * account actual SDRAM size. So we can set up sdtr1 according to what
- * is specified in board configuration file while rtr dependds on SDRAM
- * size we are assuming before detection.
- */
- sdtr1 = compute_sdtr1(speed);
-
- for (i=0; i<N_MB0CF; i++) {
- /*
- * Disable memory controller.
- */
- mtsdram0(mem_mcopt1, 0x00000000);
-
- /*
- * Set MB0CF for bank 0.
- */
- mtsdram0(mem_mb0cf, mb0cf[i].reg);
- mtsdram0(mem_sdtr1, sdtr1);
- mtsdram0(mem_rtr, compute_rtr(speed, mb0cf[i].rows, 64));
-
- udelay(200);
-
- /*
- * Set memory controller options reg, MCOPT1.
- * Set DC_EN to '1' and BRD_PRF to '01' for 16 byte PLB Burst
- * read/prefetch.
- */
- mtsdram0(mem_mcopt1, 0x80800000);
-
- udelay(10000);
-
- if (get_ram_size(0, mb0cf[i].size) == mb0cf[i].size) {
- /*
- * OK, size detected -> all done
- */
- return;
- }
- }
-}
-
-#else /* CONFIG_440 */
-
-#define NUM_TRIES 64
-#define NUM_READS 10
-
-static void sdram_tr1_set(int ram_address, int* tr1_value)
-{
- int i;
- int j, k;
- volatile unsigned int* ram_pointer = (unsigned int *)ram_address;
- int first_good = -1, last_bad = 0x1ff;
-
- unsigned long test[NUM_TRIES] = {
- 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
- 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000,
- 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000,
- 0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555,
- 0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555,
- 0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA,
- 0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA,
- 0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A,
- 0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A,
- 0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5,
- 0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5,
- 0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA,
- 0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA,
- 0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55,
- 0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55 };
-
- /* go through all possible SDRAM0_TR1[RDCT] values */
- for (i=0; i<=0x1ff; i++) {
- /* set the current value for TR1 */
- mtsdram(mem_tr1, (0x80800800 | i));
-
- /* write values */
- for (j=0; j<NUM_TRIES; j++) {
- ram_pointer[j] = test[j];
-
- /* clear any cache at ram location */
- __asm__("dcbf 0,%0": :"r" (&ram_pointer[j]));
- }
-
- /* read values back */
- for (j=0; j<NUM_TRIES; j++) {
- for (k=0; k<NUM_READS; k++) {
- /* clear any cache at ram location */
- __asm__("dcbf 0,%0": :"r" (&ram_pointer[j]));
-
- if (ram_pointer[j] != test[j])
- break;
- }
-
- /* read error */
- if (k != NUM_READS)
- break;
- }
-
- /* we have a SDRAM0_TR1[RDCT] that is part of the window */
- if (j == NUM_TRIES) {
- if (first_good == -1)
- first_good = i; /* found beginning of window */
- } else { /* bad read */
- /* if we have not had a good read then don't care */
- if (first_good != -1) {
- /* first failure after a good read */
- last_bad = i-1;
- break;
- }
- }
- }
-
- /* return the current value for TR1 */
- *tr1_value = (first_good + last_bad) / 2;
-}
-
-
-#ifdef CONFIG_SDRAM_ECC
-static void ecc_init(ulong start, ulong size)
-{
- ulong current_addr; /* current byte address */
- ulong end_addr; /* end of memory region */
- ulong addr_inc; /* address skip between writes */
- ulong cfg0_reg; /* for restoring ECC state */
-
- /*
- * TODO: Enable dcache before running this test (speedup)
- */
-
- mfsdram(mem_cfg0, cfg0_reg);
- mtsdram(mem_cfg0, (cfg0_reg & ~SDRAM_CFG0_MEMCHK) | SDRAM_CFG0_MEMCHK_GEN);
-
- /*
- * look at geometry of SDRAM (data width) to determine whether we
- * can skip words when writing
- */
- if ((cfg0_reg & SDRAM_CFG0_DRAMWDTH) == SDRAM_CFG0_DRAMWDTH_32)
- addr_inc = 4;
- else
- addr_inc = 8;
-
- current_addr = start;
- end_addr = start + size;
-
- while (current_addr < end_addr) {
- *((ulong *)current_addr) = 0x00000000;
- current_addr += addr_inc;
- }
-
- /*
- * TODO: Flush dcache and disable it again
- */
-
- /*
- * Enable ecc checking and parity errors
- */
- mtsdram(mem_cfg0, (cfg0_reg & ~SDRAM_CFG0_MEMCHK) | SDRAM_CFG0_MEMCHK_CHK);
-}
-#endif
-
-/*
- * Autodetect onboard DDR SDRAM on 440 platforms
- *
- * NOTE: Some of the hardcoded values are hardware dependant,
- * so this should be extended for other future boards
- * using this routine!
- */
-long int initdram(int board_type)
-{
- int i;
- int tr1_bank1;
-
-#if defined(CONFIG_440GX) || defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_440SP)
- /*
- * Soft-reset SDRAM controller.
- */
- mtsdr(sdr_srst, SDR0_SRST_DMC);
- mtsdr(sdr_srst, 0x00000000);
-#endif
-
- for (i=0; i<N_MB0CF; i++) {
- /*
- * Disable memory controller.
- */
- mtsdram(mem_cfg0, 0x00000000);
-
- /*
- * Setup some default
- */
- mtsdram(mem_uabba, 0x00000000); /* ubba=0 (default) */
- mtsdram(mem_slio, 0x00000000); /* rdre=0 wrre=0 rarw=0 */
- mtsdram(mem_devopt, 0x00000000); /* dll=0 ds=0 (normal) */
- mtsdram(mem_wddctr, 0x00000000); /* wrcp=0 dcd=0 */
- mtsdram(mem_clktr, 0x40000000); /* clkp=1 (90 deg wr) dcdt=0 */
-
- /*
- * Following for CAS Latency = 2.5 @ 133 MHz PLB
- */
- mtsdram(mem_b0cr, mb0cf[i].reg);
- mtsdram(mem_tr0, 0x41094012);
- mtsdram(mem_tr1, 0x80800800); /* SS=T2 SL=STAGE 3 CD=1 CT=0x00*/
- mtsdram(mem_rtr, 0x04100000); /* Interval 7.8µs @ 133MHz PLB */
- mtsdram(mem_cfg1, 0x00000000); /* Self-refresh exit, disable PM*/
- udelay(400); /* Delay 200 usecs (min) */
-
- /*
- * Enable the controller, then wait for DCEN to complete
- */
- mtsdram(mem_cfg0, 0x82000000); /* DCEN=1, PMUD=0, 64-bit */
- udelay(10000);
-
- if (get_ram_size(0, mb0cf[i].size) == mb0cf[i].size) {
- /*
- * Optimize TR1 to current hardware environment
- */
- sdram_tr1_set(0x00000000, &tr1_bank1);
- mtsdram(mem_tr1, (tr1_bank1 | 0x80800800));
-
-#ifdef CONFIG_SDRAM_ECC
- ecc_init(0, mb0cf[i].size);
-#endif
-
- /*
- * OK, size detected -> all done
- */
- return mb0cf[i].size;
- }
- }
-
- return 0; /* nothing found ! */
-}
-
-#endif /* CONFIG_440 */
-
-#endif /* CONFIG_SDRAM_BANK0 */
diff --git a/cpu/ppc4xx/sdram.h b/cpu/ppc4xx/sdram.h
deleted file mode 100644
index 62b5442f3b..0000000000
--- a/cpu/ppc4xx/sdram.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * (C) Copyright 2006
- * Stefan Roese, DENX Software Engineering, sr@denx.de.
- *
- * (C) Copyright 2006
- * DAVE Srl <www.dave-tech.it>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifndef _SDRAM_H_
-#define _SDRAM_H_
-
-#include <config.h>
-
-#define mtsdram0(reg, data) mtdcr(memcfga,reg);mtdcr(memcfgd,data)
-
-#define ONE_BILLION 1000000000
-
-struct sdram_conf_s {
- unsigned long size;
- int rows;
- unsigned long reg;
-};
-
-typedef struct sdram_conf_s sdram_conf_t;
-
-/* Bitfields offsets */
-#define SDRAM0_TR_CASL (31 - 8)
-#define SDRAM0_TR_PTA (31 - 13)
-#define SDRAM0_TR_CTP (31 - 15)
-#define SDRAM0_TR_LDF (31 - 17)
-#define SDRAM0_TR_RFTA (31 - 29)
-#define SDRAM0_TR_RCD (31 - 31)
-
-#ifdef CFG_SDRAM_CL
-/* SDRAM timings [ns] according to AMCC/IBM names (see SDRAM_faq.doc) */
-#define CFG_SDRAM_CASL CFG_SDRAM_CL
-#define CFG_SDRAM_PTA CFG_SDRAM_tRP
-#define CFG_SDRAM_CTP (CFG_SDRAM_tRC - CFG_SDRAM_tRCD - CFG_SDRAM_tRP)
-#define CFG_SDRAM_LDF 0
-#ifdef CFG_SDRAM_tRFC
-#define CFG_SDRAM_RFTA CFG_SDRAM_tRFC
-#else
-#define CFG_SDRAM_RFTA CFG_SDRAM_tRC
-#endif
-#define CFG_SDRAM_RCD CFG_SDRAM_tRCD
-#endif /* #ifdef CFG_SDRAM_CL */
-
-/*
- * Some defines for the 440 DDR controller
- */
-#define SDRAM_CFG0_DC_EN 0x80000000 /* SDRAM Controller Enable */
-#define SDRAM_CFG0_MEMCHK 0x30000000 /* Memory data error checking mask*/
-#define SDRAM_CFG0_MEMCHK_NON 0x00000000 /* No ECC generation */
-#define SDRAM_CFG0_MEMCHK_GEN 0x20000000 /* ECC generation */
-#define SDRAM_CFG0_MEMCHK_CHK 0x30000000 /* ECC generation and checking */
-#define SDRAM_CFG0_DRAMWDTH 0x02000000 /* DRAM width mask */
-#define SDRAM_CFG0_DRAMWDTH_32 0x00000000 /* 32 bits */
-#define SDRAM_CFG0_DRAMWDTH_64 0x02000000 /* 64 bits */
-
-#endif
diff --git a/cpu/ppc4xx/spd_sdram.c b/cpu/ppc4xx/spd_sdram.c
deleted file mode 100644
index eac751d184..0000000000
--- a/cpu/ppc4xx/spd_sdram.c
+++ /dev/null
@@ -1,1813 +0,0 @@
-/*
- * (C) Copyright 2001
- * Bill Hunter, Wave 7 Optics, williamhunter@attbi.com
- *
- * Based on code by:
- *
- * Kenneth Johansson ,Ericsson AB.
- * kenneth.johansson@etx.ericsson.se
- *
- * hacked up by bill hunter. fixed so we could run before
- * serial_init and console_init. previous version avoided this by
- * running out of cache memory during serial/console init, then running
- * this code later.
- *
- * (C) Copyright 2002
- * Jun Gu, Artesyn Technology, jung@artesyncp.com
- * Support for AMCC 440 based on OpenBIOS draminit.c from IBM.
- *
- * (C) Copyright 2005
- * Stefan Roese, DENX Software Engineering, sr@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/processor.h>
-#include <i2c.h>
-#include <ppc4xx.h>
-
-#ifdef CONFIG_SPD_EEPROM
-
-/*
- * Set default values
- */
-#ifndef CFG_I2C_SPEED
-#define CFG_I2C_SPEED 50000
-#endif
-
-#ifndef CFG_I2C_SLAVE
-#define CFG_I2C_SLAVE 0xFE
-#endif
-
-#define ONE_BILLION 1000000000
-
-#ifndef CONFIG_440 /* for 405 WALNUT/SYCAMORE/BUBINGA boards */
-
-#define SDRAM0_CFG_DCE 0x80000000
-#define SDRAM0_CFG_SRE 0x40000000
-#define SDRAM0_CFG_PME 0x20000000
-#define SDRAM0_CFG_MEMCHK 0x10000000
-#define SDRAM0_CFG_REGEN 0x08000000
-#define SDRAM0_CFG_ECCDD 0x00400000
-#define SDRAM0_CFG_EMDULR 0x00200000
-#define SDRAM0_CFG_DRW_SHIFT (31-6)
-#define SDRAM0_CFG_BRPF_SHIFT (31-8)
-
-#define SDRAM0_TR_CASL_SHIFT (31-8)
-#define SDRAM0_TR_PTA_SHIFT (31-13)
-#define SDRAM0_TR_CTP_SHIFT (31-15)
-#define SDRAM0_TR_LDF_SHIFT (31-17)
-#define SDRAM0_TR_RFTA_SHIFT (31-29)
-#define SDRAM0_TR_RCD_SHIFT (31-31)
-
-#define SDRAM0_RTR_SHIFT (31-15)
-#define SDRAM0_ECCCFG_SHIFT (31-11)
-
-/* SDRAM0_CFG enable macro */
-#define SDRAM0_CFG_BRPF(x) ( ( x & 0x3)<< SDRAM0_CFG_BRPF_SHIFT )
-
-#define SDRAM0_BXCR_SZ_MASK 0x000e0000
-#define SDRAM0_BXCR_AM_MASK 0x0000e000
-
-#define SDRAM0_BXCR_SZ_SHIFT (31-14)
-#define SDRAM0_BXCR_AM_SHIFT (31-18)
-
-#define SDRAM0_BXCR_SZ(x) ( (( x << SDRAM0_BXCR_SZ_SHIFT) & SDRAM0_BXCR_SZ_MASK) )
-#define SDRAM0_BXCR_AM(x) ( (( x << SDRAM0_BXCR_AM_SHIFT) & SDRAM0_BXCR_AM_MASK) )
-
-#ifdef CONFIG_SPDDRAM_SILENT
-# define SPD_ERR(x) do { return 0; } while (0)
-#else
-# define SPD_ERR(x) do { printf(x); return(0); } while (0)
-#endif
-
-#define sdram_HZ_to_ns(hertz) (1000000000/(hertz))
-
-/* function prototypes */
-int spd_read(uint addr);
-
-
-/*
- * This function is reading data from the DIMM module EEPROM over the SPD bus
- * and uses that to program the sdram controller.
- *
- * This works on boards that has the same schematics that the AMCC walnut has.
- *
- * Input: null for default I2C spd functions or a pointer to a custom function
- * returning spd_data.
- */
-
-long int spd_sdram(int(read_spd)(uint addr))
-{
- int tmp,row,col;
- int total_size,bank_size,bank_code;
- int ecc_on;
- int mode;
- int bank_cnt;
-
- int sdram0_pmit=0x07c00000;
-#ifndef CONFIG_405EP /* not on PPC405EP */
- int sdram0_besr0=-1;
- int sdram0_besr1=-1;
- int sdram0_eccesr=-1;
-#endif
- int sdram0_ecccfg;
-
- int sdram0_rtr=0;
- int sdram0_tr=0;
-
- int sdram0_b0cr;
- int sdram0_b1cr;
- int sdram0_b2cr;
- int sdram0_b3cr;
-
- int sdram0_cfg=0;
-
- int t_rp;
- int t_rcd;
- int t_ras;
- int t_rc;
- int min_cas;
-
- PPC405_SYS_INFO sys_info;
- unsigned long bus_period_x_10;
-
- /*
- * get the board info
- */
- get_sys_info(&sys_info);
- bus_period_x_10 = ONE_BILLION / (sys_info.freqPLB / 10);
-
- if (read_spd == 0){
- read_spd=spd_read;
- /*
- * Make sure I2C controller is initialized
- * before continuing.
- */
- i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
- }
-
- /* Make shure we are using SDRAM */
- if (read_spd(2) != 0x04) {
- SPD_ERR("SDRAM - non SDRAM memory module found\n");
- }
-
- /* ------------------------------------------------------------------
- * configure memory timing register
- *
- * data from DIMM:
- * 27 IN Row Precharge Time ( t RP)
- * 29 MIN RAS to CAS Delay ( t RCD)
- * 127 Component and Clock Detail ,clk0-clk3, junction temp, CAS
- * -------------------------------------------------------------------*/
-
- /*
- * first figure out which cas latency mode to use
- * use the min supported mode
- */
-
- tmp = read_spd(127) & 0x6;
- if (tmp == 0x02) { /* only cas = 2 supported */
- min_cas = 2;
-/* t_ck = read_spd(9); */
-/* t_ac = read_spd(10); */
- } else if (tmp == 0x04) { /* only cas = 3 supported */
- min_cas = 3;
-/* t_ck = read_spd(9); */
-/* t_ac = read_spd(10); */
- } else if (tmp == 0x06) { /* 2,3 supported, so use 2 */
- min_cas = 2;
-/* t_ck = read_spd(23); */
-/* t_ac = read_spd(24); */
- } else {
- SPD_ERR("SDRAM - unsupported CAS latency \n");
- }
-
- /* get some timing values, t_rp,t_rcd,t_ras,t_rc
- */
- t_rp = read_spd(27);
- t_rcd = read_spd(29);
- t_ras = read_spd(30);
- t_rc = t_ras + t_rp;
-
- /* The following timing calcs subtract 1 before deviding.
- * this has effect of using ceiling instead of floor rounding,
- * and also subtracting 1 to convert number to reg value
- */
- /* set up CASL */
- sdram0_tr = (min_cas - 1) << SDRAM0_TR_CASL_SHIFT;
- /* set up PTA */
- sdram0_tr |= ((((t_rp - 1) * 10)/bus_period_x_10) & 0x3) << SDRAM0_TR_PTA_SHIFT;
- /* set up CTP */
- tmp = (((t_rc - t_rcd - t_rp -1) * 10) / bus_period_x_10) & 0x3;
- if (tmp < 1)
- tmp = 1;
- sdram0_tr |= tmp << SDRAM0_TR_CTP_SHIFT;
- /* set LDF = 2 cycles, reg value = 1 */
- sdram0_tr |= 1 << SDRAM0_TR_LDF_SHIFT;
- /* set RFTA = t_rfc/bus_period, use t_rfc = t_rc */
- tmp = (((t_rc - 1) * 10) / bus_period_x_10) - 3;
- if (tmp < 0)
- tmp = 0;
- if (tmp > 6)
- tmp = 6;
- sdram0_tr |= tmp << SDRAM0_TR_RFTA_SHIFT;
- /* set RCD = t_rcd/bus_period*/
- sdram0_tr |= ((((t_rcd - 1) * 10) / bus_period_x_10) &0x3) << SDRAM0_TR_RCD_SHIFT ;
-
-
- /*------------------------------------------------------------------
- * configure RTR register
- * -------------------------------------------------------------------*/
- row = read_spd(3);
- col = read_spd(4);
- tmp = read_spd(12) & 0x7f ; /* refresh type less self refresh bit */
- switch (tmp) {
- case 0x00:
- tmp = 15625;
- break;
- case 0x01:
- tmp = 15625 / 4;
- break;
- case 0x02:
- tmp = 15625 / 2;
- break;
- case 0x03:
- tmp = 15625 * 2;
- break;
- case 0x04:
- tmp = 15625 * 4;
- break;
- case 0x05:
- tmp = 15625 * 8;
- break;
- default:
- SPD_ERR("SDRAM - Bad refresh period \n");
- }
- /* convert from nsec to bus cycles */
- tmp = (tmp * 10) / bus_period_x_10;
- sdram0_rtr = (tmp & 0x3ff8) << SDRAM0_RTR_SHIFT;
-
- /*------------------------------------------------------------------
- * determine the number of banks used
- * -------------------------------------------------------------------*/
- /* byte 7:6 is module data width */
- if (read_spd(7) != 0)
- SPD_ERR("SDRAM - unsupported module width\n");
- tmp = read_spd(6);
- if (tmp < 32)
- SPD_ERR("SDRAM - unsupported module width\n");
- else if (tmp < 64)
- bank_cnt = 1; /* one bank per sdram side */
- else if (tmp < 73)
- bank_cnt = 2; /* need two banks per side */
- else if (tmp < 161)
- bank_cnt = 4; /* need four banks per side */
- else
- SPD_ERR("SDRAM - unsupported module width\n");
-
- /* byte 5 is the module row count (refered to as dimm "sides") */
- tmp = read_spd(5);
- if (tmp == 1)
- ;
- else if (tmp==2)
- bank_cnt *= 2;
- else if (tmp==4)
- bank_cnt *= 4;
- else
- bank_cnt = 8; /* 8 is an error code */
-
- if (bank_cnt > 4) /* we only have 4 banks to work with */
- SPD_ERR("SDRAM - unsupported module rows for this width\n");
-
- /* now check for ECC ability of module. We only support ECC
- * on 32 bit wide devices with 8 bit ECC.
- */
- if ((read_spd(11)==2) && (read_spd(6)==40) && (read_spd(14)==8)) {
- sdram0_ecccfg = 0xf << SDRAM0_ECCCFG_SHIFT;
- ecc_on = 1;
- } else {
- sdram0_ecccfg = 0;
- ecc_on = 0;
- }
-
- /*------------------------------------------------------------------
- * calculate total size
- * -------------------------------------------------------------------*/
- /* calculate total size and do sanity check */
- tmp = read_spd(31);
- total_size = 1 << 22; /* total_size = 4MB */
- /* now multiply 4M by the smallest device row density */
- /* note that we don't support asymetric rows */
- while (((tmp & 0x0001) == 0) && (tmp != 0)) {
- total_size = total_size << 1;
- tmp = tmp >> 1;
- }
- total_size *= read_spd(5); /* mult by module rows (dimm sides) */
-
- /*------------------------------------------------------------------
- * map rows * cols * banks to a mode
- * -------------------------------------------------------------------*/
-
- switch (row) {
- case 11:
- switch (col) {
- case 8:
- mode=4; /* mode 5 */
- break;
- case 9:
- case 10:
- mode=0; /* mode 1 */
- break;
- default:
- SPD_ERR("SDRAM - unsupported mode\n");
- }
- break;
- case 12:
- switch (col) {
- case 8:
- mode=3; /* mode 4 */
- break;
- case 9:
- case 10:
- mode=1; /* mode 2 */
- break;
- default:
- SPD_ERR("SDRAM - unsupported mode\n");
- }
- break;
- case 13:
- switch (col) {
- case 8:
- mode=5; /* mode 6 */
- break;
- case 9:
- case 10:
- if (read_spd(17) == 2)
- mode = 6; /* mode 7 */
- else
- mode = 2; /* mode 3 */
- break;
- case 11:
- mode = 2; /* mode 3 */
- break;
- default:
- SPD_ERR("SDRAM - unsupported mode\n");
- }
- break;
- default:
- SPD_ERR("SDRAM - unsupported mode\n");
- }
-
- /*------------------------------------------------------------------
- * using the calculated values, compute the bank
- * config register values.
- * -------------------------------------------------------------------*/
- sdram0_b1cr = 0;
- sdram0_b2cr = 0;
- sdram0_b3cr = 0;
-
- /* compute the size of each bank */
- bank_size = total_size / bank_cnt;
- /* convert bank size to bank size code for ppc4xx
- by takeing log2(bank_size) - 22 */
- tmp = bank_size; /* start with tmp = bank_size */
- bank_code = 0; /* and bank_code = 0 */
- while (tmp > 1) { /* this takes log2 of tmp */
- bank_code++; /* and stores result in bank_code */
- tmp = tmp >> 1;
- } /* bank_code is now log2(bank_size) */
- bank_code -= 22; /* subtract 22 to get the code */
-
- tmp = SDRAM0_BXCR_SZ(bank_code) | SDRAM0_BXCR_AM(mode) | 1;
- sdram0_b0cr = (bank_size * 0) | tmp;
-#ifndef CONFIG_405EP /* not on PPC405EP */
- if (bank_cnt > 1)
- sdram0_b2cr = (bank_size * 1) | tmp;
- if (bank_cnt > 2)
- sdram0_b1cr = (bank_size * 2) | tmp;
- if (bank_cnt > 3)
- sdram0_b3cr = (bank_size * 3) | tmp;
-#else
- /* PPC405EP chip only supports two SDRAM banks */
- if (bank_cnt > 1)
- sdram0_b1cr = (bank_size * 1) | tmp;
- if (bank_cnt > 2)
- total_size = 2 * bank_size;
-#endif
-
- /*
- * enable sdram controller DCE=1
- * enable burst read prefetch to 32 bytes BRPF=2
- * leave other functions off
- */
-
- /*------------------------------------------------------------------
- * now that we've done our calculations, we are ready to
- * program all the registers.
- * -------------------------------------------------------------------*/
-
-#define mtsdram0(reg, data) mtdcr(memcfga,reg);mtdcr(memcfgd,data)
- /* disable memcontroller so updates work */
- mtsdram0( mem_mcopt1, 0 );
-
-#ifndef CONFIG_405EP /* not on PPC405EP */
- mtsdram0( mem_besra , sdram0_besr0 );
- mtsdram0( mem_besrb , sdram0_besr1 );
- mtsdram0( mem_ecccf , sdram0_ecccfg );
- mtsdram0( mem_eccerr, sdram0_eccesr );
-#endif
- mtsdram0( mem_rtr , sdram0_rtr );
- mtsdram0( mem_pmit , sdram0_pmit );
- mtsdram0( mem_mb0cf , sdram0_b0cr );
- mtsdram0( mem_mb1cf , sdram0_b1cr );
-#ifndef CONFIG_405EP /* not on PPC405EP */
- mtsdram0( mem_mb2cf , sdram0_b2cr );
- mtsdram0( mem_mb3cf , sdram0_b3cr );
-#endif
- mtsdram0( mem_sdtr1 , sdram0_tr );
-
- /* SDRAM have a power on delay, 500 micro should do */
- udelay(500);
- sdram0_cfg = SDRAM0_CFG_DCE | SDRAM0_CFG_BRPF(1) | SDRAM0_CFG_ECCDD | SDRAM0_CFG_EMDULR;
- if (ecc_on)
- sdram0_cfg |= SDRAM0_CFG_MEMCHK;
- mtsdram0(mem_mcopt1, sdram0_cfg);
-
- return (total_size);
-}
-
-int spd_read(uint addr)
-{
- uchar data[2];
-
- if (i2c_read(SPD_EEPROM_ADDRESS, addr, 1, data, 1) == 0)
- return (int)data[0];
- else
- return 0;
-}
-
-#else /* CONFIG_440 */
-
-/*-----------------------------------------------------------------------------
- | Memory Controller Options 0
- +-----------------------------------------------------------------------------*/
-#define SDRAM_CFG0_DCEN 0x80000000 /* SDRAM Controller Enable */
-#define SDRAM_CFG0_MCHK_MASK 0x30000000 /* Memory data errchecking mask */
-#define SDRAM_CFG0_MCHK_NON 0x00000000 /* No ECC generation */
-#define SDRAM_CFG0_MCHK_GEN 0x20000000 /* ECC generation */
-#define SDRAM_CFG0_MCHK_CHK 0x30000000 /* ECC generation and checking */
-#define SDRAM_CFG0_RDEN 0x08000000 /* Registered DIMM enable */
-#define SDRAM_CFG0_PMUD 0x04000000 /* Page management unit */
-#define SDRAM_CFG0_DMWD_MASK 0x02000000 /* DRAM width mask */
-#define SDRAM_CFG0_DMWD_32 0x00000000 /* 32 bits */
-#define SDRAM_CFG0_DMWD_64 0x02000000 /* 64 bits */
-#define SDRAM_CFG0_UIOS_MASK 0x00C00000 /* Unused IO State */
-#define SDRAM_CFG0_PDP 0x00200000 /* Page deallocation policy */
-
-/*-----------------------------------------------------------------------------
- | Memory Controller Options 1
- +-----------------------------------------------------------------------------*/
-#define SDRAM_CFG1_SRE 0x80000000 /* Self-Refresh Entry */
-#define SDRAM_CFG1_PMEN 0x40000000 /* Power Management Enable */
-
-/*-----------------------------------------------------------------------------+
- | SDRAM DEVPOT Options
- +-----------------------------------------------------------------------------*/
-#define SDRAM_DEVOPT_DLL 0x80000000
-#define SDRAM_DEVOPT_DS 0x40000000
-
-/*-----------------------------------------------------------------------------+
- | SDRAM MCSTS Options
- +-----------------------------------------------------------------------------*/
-#define SDRAM_MCSTS_MRSC 0x80000000
-#define SDRAM_MCSTS_SRMS 0x40000000
-#define SDRAM_MCSTS_CIS 0x20000000
-
-/*-----------------------------------------------------------------------------
- | SDRAM Refresh Timer Register
- +-----------------------------------------------------------------------------*/
-#define SDRAM_RTR_RINT_MASK 0xFFFF0000
-#define SDRAM_RTR_RINT_ENCODE(n) (((n) << 16) & SDRAM_RTR_RINT_MASK)
-#define sdram_HZ_to_ns(hertz) (1000000000/(hertz))
-
-/*-----------------------------------------------------------------------------+
- | SDRAM UABus Base Address Reg
- +-----------------------------------------------------------------------------*/
-#define SDRAM_UABBA_UBBA_MASK 0x0000000F
-
-/*-----------------------------------------------------------------------------+
- | Memory Bank 0-7 configuration
- +-----------------------------------------------------------------------------*/
-#define SDRAM_BXCR_SDBA_MASK 0xff800000 /* Base address */
-#define SDRAM_BXCR_SDSZ_MASK 0x000e0000 /* Size */
-#define SDRAM_BXCR_SDSZ_8 0x00020000 /* 8M */
-#define SDRAM_BXCR_SDSZ_16 0x00040000 /* 16M */
-#define SDRAM_BXCR_SDSZ_32 0x00060000 /* 32M */
-#define SDRAM_BXCR_SDSZ_64 0x00080000 /* 64M */
-#define SDRAM_BXCR_SDSZ_128 0x000a0000 /* 128M */
-#define SDRAM_BXCR_SDSZ_256 0x000c0000 /* 256M */
-#define SDRAM_BXCR_SDSZ_512 0x000e0000 /* 512M */
-#define SDRAM_BXCR_SDAM_MASK 0x0000e000 /* Addressing mode */
-#define SDRAM_BXCR_SDAM_1 0x00000000 /* Mode 1 */
-#define SDRAM_BXCR_SDAM_2 0x00002000 /* Mode 2 */
-#define SDRAM_BXCR_SDAM_3 0x00004000 /* Mode 3 */
-#define SDRAM_BXCR_SDAM_4 0x00006000 /* Mode 4 */
-#define SDRAM_BXCR_SDBE 0x00000001 /* Memory Bank Enable */
-
-/*-----------------------------------------------------------------------------+
- | SDRAM TR0 Options
- +-----------------------------------------------------------------------------*/
-#define SDRAM_TR0_SDWR_MASK 0x80000000
-#define SDRAM_TR0_SDWR_2_CLK 0x00000000
-#define SDRAM_TR0_SDWR_3_CLK 0x80000000
-#define SDRAM_TR0_SDWD_MASK 0x40000000
-#define SDRAM_TR0_SDWD_0_CLK 0x00000000
-#define SDRAM_TR0_SDWD_1_CLK 0x40000000
-#define SDRAM_TR0_SDCL_MASK 0x01800000
-#define SDRAM_TR0_SDCL_2_0_CLK 0x00800000
-#define SDRAM_TR0_SDCL_2_5_CLK 0x01000000
-#define SDRAM_TR0_SDCL_3_0_CLK 0x01800000
-#define SDRAM_TR0_SDPA_MASK 0x000C0000
-#define SDRAM_TR0_SDPA_2_CLK 0x00040000
-#define SDRAM_TR0_SDPA_3_CLK 0x00080000
-#define SDRAM_TR0_SDPA_4_CLK 0x000C0000
-#define SDRAM_TR0_SDCP_MASK 0x00030000
-#define SDRAM_TR0_SDCP_2_CLK 0x00000000
-#define SDRAM_TR0_SDCP_3_CLK 0x00010000
-#define SDRAM_TR0_SDCP_4_CLK 0x00020000
-#define SDRAM_TR0_SDCP_5_CLK 0x00030000
-#define SDRAM_TR0_SDLD_MASK 0x0000C000
-#define SDRAM_TR0_SDLD_1_CLK 0x00000000
-#define SDRAM_TR0_SDLD_2_CLK 0x00004000
-#define SDRAM_TR0_SDRA_MASK 0x0000001C
-#define SDRAM_TR0_SDRA_6_CLK 0x00000000
-#define SDRAM_TR0_SDRA_7_CLK 0x00000004
-#define SDRAM_TR0_SDRA_8_CLK 0x00000008
-#define SDRAM_TR0_SDRA_9_CLK 0x0000000C
-#define SDRAM_TR0_SDRA_10_CLK 0x00000010
-#define SDRAM_TR0_SDRA_11_CLK 0x00000014
-#define SDRAM_TR0_SDRA_12_CLK 0x00000018
-#define SDRAM_TR0_SDRA_13_CLK 0x0000001C
-#define SDRAM_TR0_SDRD_MASK 0x00000003
-#define SDRAM_TR0_SDRD_2_CLK 0x00000001
-#define SDRAM_TR0_SDRD_3_CLK 0x00000002
-#define SDRAM_TR0_SDRD_4_CLK 0x00000003
-
-/*-----------------------------------------------------------------------------+
- | SDRAM TR1 Options
- +-----------------------------------------------------------------------------*/
-#define SDRAM_TR1_RDSS_MASK 0xC0000000
-#define SDRAM_TR1_RDSS_TR0 0x00000000
-#define SDRAM_TR1_RDSS_TR1 0x40000000
-#define SDRAM_TR1_RDSS_TR2 0x80000000
-#define SDRAM_TR1_RDSS_TR3 0xC0000000
-#define SDRAM_TR1_RDSL_MASK 0x00C00000
-#define SDRAM_TR1_RDSL_STAGE1 0x00000000
-#define SDRAM_TR1_RDSL_STAGE2 0x00400000
-#define SDRAM_TR1_RDSL_STAGE3 0x00800000
-#define SDRAM_TR1_RDCD_MASK 0x00000800
-#define SDRAM_TR1_RDCD_RCD_0_0 0x00000000
-#define SDRAM_TR1_RDCD_RCD_1_2 0x00000800
-#define SDRAM_TR1_RDCT_MASK 0x000001FF
-#define SDRAM_TR1_RDCT_ENCODE(x) (((x) << 0) & SDRAM_TR1_RDCT_MASK)
-#define SDRAM_TR1_RDCT_DECODE(x) (((x) & SDRAM_TR1_RDCT_MASK) >> 0)
-#define SDRAM_TR1_RDCT_MIN 0x00000000
-#define SDRAM_TR1_RDCT_MAX 0x000001FF
-
-/*-----------------------------------------------------------------------------+
- | SDRAM WDDCTR Options
- +-----------------------------------------------------------------------------*/
-#define SDRAM_WDDCTR_WRCP_MASK 0xC0000000
-#define SDRAM_WDDCTR_WRCP_0DEG 0x00000000
-#define SDRAM_WDDCTR_WRCP_90DEG 0x40000000
-#define SDRAM_WDDCTR_WRCP_180DEG 0x80000000
-#define SDRAM_WDDCTR_DCD_MASK 0x000001FF
-
-/*-----------------------------------------------------------------------------+
- | SDRAM CLKTR Options
- +-----------------------------------------------------------------------------*/
-#define SDRAM_CLKTR_CLKP_MASK 0xC0000000
-#define SDRAM_CLKTR_CLKP_0DEG 0x00000000
-#define SDRAM_CLKTR_CLKP_90DEG 0x40000000
-#define SDRAM_CLKTR_CLKP_180DEG 0x80000000
-#define SDRAM_CLKTR_DCDT_MASK 0x000001FF
-
-/*-----------------------------------------------------------------------------+
- | SDRAM DLYCAL Options
- +-----------------------------------------------------------------------------*/
-#define SDRAM_DLYCAL_DLCV_MASK 0x000003FC
-#define SDRAM_DLYCAL_DLCV_ENCODE(x) (((x)<<2) & SDRAM_DLYCAL_DLCV_MASK)
-#define SDRAM_DLYCAL_DLCV_DECODE(x) (((x) & SDRAM_DLYCAL_DLCV_MASK)>>2)
-
-/*-----------------------------------------------------------------------------+
- | General Definition
- +-----------------------------------------------------------------------------*/
-#define DEFAULT_SPD_ADDR1 0x53
-#define DEFAULT_SPD_ADDR2 0x52
-#define MAXBANKS 4 /* at most 4 dimm banks */
-#define MAX_SPD_BYTES 256
-#define NUMHALFCYCLES 4
-#define NUMMEMTESTS 8
-#define NUMMEMWORDS 8
-#define MAXBXCR 4
-#define TRUE 1
-#define FALSE 0
-
-const unsigned long test[NUMMEMTESTS][NUMMEMWORDS] = {
- {0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000,
- 0xFFFFFFFF, 0xFFFFFFFF},
- {0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
- 0x00000000, 0x00000000},
- {0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA,
- 0x55555555, 0x55555555},
- {0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555,
- 0xAAAAAAAA, 0xAAAAAAAA},
- {0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5,
- 0x5A5A5A5A, 0x5A5A5A5A},
- {0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A,
- 0xA5A5A5A5, 0xA5A5A5A5},
- {0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55,
- 0x55AA55AA, 0x55AA55AA},
- {0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA,
- 0xAA55AA55, 0xAA55AA55}
-};
-
-/* bank_parms is used to sort the bank sizes by descending order */
-struct bank_param {
- unsigned long cr;
- unsigned long bank_size_bytes;
-};
-
-typedef struct bank_param BANKPARMS;
-
-#ifdef CFG_SIMULATE_SPD_EEPROM
-extern unsigned char cfg_simulate_spd_eeprom[128];
-#endif
-
-unsigned char spd_read(uchar chip, uint addr);
-
-void get_spd_info(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks);
-
-void check_mem_type
-(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks);
-
-void check_volt_type
-(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks);
-
-void program_cfg0(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks);
-
-void program_cfg1(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks);
-
-void program_rtr (unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks);
-
-void program_tr0 (unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks);
-
-void program_tr1 (void);
-
-void program_ecc (unsigned long num_bytes);
-
-unsigned
-long program_bxcr(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks);
-
-/*
- * This function is reading data from the DIMM module EEPROM over the SPD bus
- * and uses that to program the sdram controller.
- *
- * This works on boards that has the same schematics that the AMCC walnut has.
- *
- * BUG: Don't handle ECC memory
- * BUG: A few values in the TR register is currently hardcoded
- */
-
-long int spd_sdram(void) {
- unsigned char iic0_dimm_addr[] = SPD_EEPROM_ADDRESS;
- unsigned long dimm_populated[sizeof(iic0_dimm_addr)];
- unsigned long total_size;
- unsigned long cfg0;
- unsigned long mcsts;
- unsigned long num_dimm_banks; /* on board dimm banks */
-
- num_dimm_banks = sizeof(iic0_dimm_addr);
-
- /*
- * Make sure I2C controller is initialized
- * before continuing.
- */
- i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
-
- /*
- * Read the SPD information using I2C interface. Check to see if the
- * DIMM slots are populated.
- */
- get_spd_info(dimm_populated, iic0_dimm_addr, num_dimm_banks);
-
- /*
- * Check the memory type for the dimms plugged.
- */
- check_mem_type(dimm_populated, iic0_dimm_addr, num_dimm_banks);
-
- /*
- * Check the voltage type for the dimms plugged.
- */
- check_volt_type(dimm_populated, iic0_dimm_addr, num_dimm_banks);
-
-#if defined(CONFIG_440GX) || defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_440SP)
- /*
- * Soft-reset SDRAM controller.
- */
- mtsdr(sdr_srst, SDR0_SRST_DMC);
- mtsdr(sdr_srst, 0x00000000);
-#endif
-
- /*
- * program 440GP SDRAM controller options (SDRAM0_CFG0)
- */
- program_cfg0(dimm_populated, iic0_dimm_addr, num_dimm_banks);
-
- /*
- * program 440GP SDRAM controller options (SDRAM0_CFG1)
- */
- program_cfg1(dimm_populated, iic0_dimm_addr, num_dimm_banks);
-
- /*
- * program SDRAM refresh register (SDRAM0_RTR)
- */
- program_rtr(dimm_populated, iic0_dimm_addr, num_dimm_banks);
-
- /*
- * program SDRAM Timing Register 0 (SDRAM0_TR0)
- */
- program_tr0(dimm_populated, iic0_dimm_addr, num_dimm_banks);
-
- /*
- * program the BxCR registers to find out total sdram installed
- */
- total_size = program_bxcr(dimm_populated, iic0_dimm_addr,
- num_dimm_banks);
-
- /*
- * program SDRAM Clock Timing Register (SDRAM0_CLKTR)
- */
- mtsdram(mem_clktr, 0x40000000);
-
- /*
- * delay to ensure 200 usec has elapsed
- */
- udelay(400);
-
- /*
- * enable the memory controller
- */
- mfsdram(mem_cfg0, cfg0);
- mtsdram(mem_cfg0, cfg0 | SDRAM_CFG0_DCEN);
-
- /*
- * wait for SDRAM_CFG0_DC_EN to complete
- */
- while (1) {
- mfsdram(mem_mcsts, mcsts);
- if ((mcsts & SDRAM_MCSTS_MRSC) != 0) {
- break;
- }
- }
-
- /*
- * program SDRAM Timing Register 1, adding some delays
- */
- program_tr1();
-
- /*
- * if ECC is enabled, initialize parity bits
- */
-
- return total_size;
-}
-
-unsigned char spd_read(uchar chip, uint addr)
-{
- unsigned char data[2];
-
-#ifdef CFG_SIMULATE_SPD_EEPROM
- if (chip == CFG_SIMULATE_SPD_EEPROM) {
- /*
- * Onboard spd eeprom requested -> simulate values
- */
- return cfg_simulate_spd_eeprom[addr];
- }
-#endif /* CFG_SIMULATE_SPD_EEPROM */
-
- if (i2c_probe(chip) == 0) {
- if (i2c_read(chip, addr, 1, data, 1) == 0) {
- return data[0];
- }
- }
-
- return 0;
-}
-
-void get_spd_info(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks)
-{
- unsigned long dimm_num;
- unsigned long dimm_found;
- unsigned char num_of_bytes;
- unsigned char total_size;
-
- dimm_found = FALSE;
- for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
- num_of_bytes = 0;
- total_size = 0;
-
- num_of_bytes = spd_read(iic0_dimm_addr[dimm_num], 0);
- total_size = spd_read(iic0_dimm_addr[dimm_num], 1);
-
- if ((num_of_bytes != 0) && (total_size != 0)) {
- dimm_populated[dimm_num] = TRUE;
- dimm_found = TRUE;
- } else {
- dimm_populated[dimm_num] = FALSE;
- }
- }
-
- if (dimm_found == FALSE) {
- printf("ERROR - No memory installed. Install a DDR-SDRAM DIMM.\n\n");
- hang();
- }
-}
-
-void check_mem_type(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks)
-{
- unsigned long dimm_num;
- unsigned char dimm_type;
-
- for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
- if (dimm_populated[dimm_num] == TRUE) {
- dimm_type = spd_read(iic0_dimm_addr[dimm_num], 2);
- switch (dimm_type) {
- case 7:
- break;
- default:
- printf("ERROR: Unsupported DIMM detected in slot %lu.\n",
- dimm_num);
- printf("Only DDR SDRAM DIMMs are supported.\n");
- printf("Replace the DIMM module with a supported DIMM.\n\n");
- hang();
- break;
- }
- }
- }
-}
-
-
-void check_volt_type(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks)
-{
- unsigned long dimm_num;
- unsigned long voltage_type;
-
- for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
- if (dimm_populated[dimm_num] == TRUE) {
- voltage_type = spd_read(iic0_dimm_addr[dimm_num], 8);
- if (voltage_type != 0x04) {
- printf("ERROR: DIMM %lu with unsupported voltage level.\n",
- dimm_num);
- hang();
- } else {
- }
- break;
- }
- }
-}
-
-void program_cfg0(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks)
-{
- unsigned long dimm_num;
- unsigned long cfg0;
- unsigned long ecc_enabled;
- unsigned char ecc;
- unsigned char attributes;
- unsigned long data_width;
- unsigned long dimm_32bit;
- unsigned long dimm_64bit;
-
- /*
- * get Memory Controller Options 0 data
- */
- mfsdram(mem_cfg0, cfg0);
-
- /*
- * clear bits
- */
- cfg0 &= ~(SDRAM_CFG0_DCEN | SDRAM_CFG0_MCHK_MASK |
- SDRAM_CFG0_RDEN | SDRAM_CFG0_PMUD |
- SDRAM_CFG0_DMWD_MASK |
- SDRAM_CFG0_UIOS_MASK | SDRAM_CFG0_PDP);
-
-
- /*
- * FIXME: assume the DDR SDRAMs in both banks are the same
- */
- ecc_enabled = TRUE;
- for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
- if (dimm_populated[dimm_num] == TRUE) {
- ecc = spd_read(iic0_dimm_addr[dimm_num], 11);
- if (ecc != 0x02) {
- ecc_enabled = FALSE;
- }
-
- /*
- * program Registered DIMM Enable
- */
- attributes = spd_read(iic0_dimm_addr[dimm_num], 21);
- if ((attributes & 0x02) != 0x00) {
- cfg0 |= SDRAM_CFG0_RDEN;
- }
-
- /*
- * program DDR SDRAM Data Width
- */
- data_width =
- (unsigned long)spd_read(iic0_dimm_addr[dimm_num],6) +
- (((unsigned long)spd_read(iic0_dimm_addr[dimm_num],7)) << 8);
- if (data_width == 64 || data_width == 72) {
- dimm_64bit = TRUE;
- cfg0 |= SDRAM_CFG0_DMWD_64;
- } else if (data_width == 32 || data_width == 40) {
- dimm_32bit = TRUE;
- cfg0 |= SDRAM_CFG0_DMWD_32;
- } else {
- printf("WARNING: DIMM with datawidth of %lu bits.\n",
- data_width);
- printf("Only DIMMs with 32 or 64 bit datawidths supported.\n");
- hang();
- }
- break;
- }
- }
-
- /*
- * program Memory Data Error Checking
- */
- if (ecc_enabled == TRUE) {
- cfg0 |= SDRAM_CFG0_MCHK_GEN;
- } else {
- cfg0 |= SDRAM_CFG0_MCHK_NON;
- }
-
- /*
- * program Page Management Unit (0 == enabled)
- */
- cfg0 &= ~SDRAM_CFG0_PMUD;
-
- /*
- * program Memory Controller Options 0
- * Note: DCEN must be enabled after all DDR SDRAM controller
- * configuration registers get initialized.
- */
- mtsdram(mem_cfg0, cfg0);
-}
-
-void program_cfg1(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks)
-{
- unsigned long cfg1;
- mfsdram(mem_cfg1, cfg1);
-
- /*
- * Self-refresh exit, disable PM
- */
- cfg1 &= ~(SDRAM_CFG1_SRE | SDRAM_CFG1_PMEN);
-
- /*
- * program Memory Controller Options 1
- */
- mtsdram(mem_cfg1, cfg1);
-}
-
-void program_rtr (unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks)
-{
- unsigned long dimm_num;
- unsigned long bus_period_x_10;
- unsigned long refresh_rate = 0;
- unsigned char refresh_rate_type;
- unsigned long refresh_interval;
- unsigned long sdram_rtr;
- PPC440_SYS_INFO sys_info;
-
- /*
- * get the board info
- */
- get_sys_info(&sys_info);
- bus_period_x_10 = ONE_BILLION / (sys_info.freqPLB / 10);
-
-
- for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
- if (dimm_populated[dimm_num] == TRUE) {
- refresh_rate_type = 0x7F & spd_read(iic0_dimm_addr[dimm_num], 12);
- switch (refresh_rate_type) {
- case 0x00:
- refresh_rate = 15625;
- break;
- case 0x01:
- refresh_rate = 15625/4;
- break;
- case 0x02:
- refresh_rate = 15625/2;
- break;
- case 0x03:
- refresh_rate = 15626*2;
- break;
- case 0x04:
- refresh_rate = 15625*4;
- break;
- case 0x05:
- refresh_rate = 15625*8;
- break;
- default:
- printf("ERROR: DIMM %lu, unsupported refresh rate/type.\n",
- dimm_num);
- printf("Replace the DIMM module with a supported DIMM.\n");
- break;
- }
-
- break;
- }
- }
-
- refresh_interval = refresh_rate * 10 / bus_period_x_10;
- sdram_rtr = (refresh_interval & 0x3ff8) << 16;
-
- /*
- * program Refresh Timer Register (SDRAM0_RTR)
- */
- mtsdram(mem_rtr, sdram_rtr);
-}
-
-void program_tr0 (unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks)
-{
- unsigned long dimm_num;
- unsigned long tr0;
- unsigned char wcsbc;
- unsigned char t_rp_ns;
- unsigned char t_rcd_ns;
- unsigned char t_ras_ns;
- unsigned long t_rp_clk;
- unsigned long t_ras_rcd_clk;
- unsigned long t_rcd_clk;
- unsigned long t_rfc_clk;
- unsigned long plb_check;
- unsigned char cas_bit;
- unsigned long cas_index;
- unsigned char cas_2_0_available;
- unsigned char cas_2_5_available;
- unsigned char cas_3_0_available;
- unsigned long cycle_time_ns_x_10[3];
- unsigned long tcyc_3_0_ns_x_10;
- unsigned long tcyc_2_5_ns_x_10;
- unsigned long tcyc_2_0_ns_x_10;
- unsigned long tcyc_reg;
- unsigned long bus_period_x_10;
- PPC440_SYS_INFO sys_info;
- unsigned long residue;
-
- /*
- * get the board info
- */
- get_sys_info(&sys_info);
- bus_period_x_10 = ONE_BILLION / (sys_info.freqPLB / 10);
-
- /*
- * get SDRAM Timing Register 0 (SDRAM_TR0) and clear bits
- */
- mfsdram(mem_tr0, tr0);
- tr0 &= ~(SDRAM_TR0_SDWR_MASK | SDRAM_TR0_SDWD_MASK |
- SDRAM_TR0_SDCL_MASK | SDRAM_TR0_SDPA_MASK |
- SDRAM_TR0_SDCP_MASK | SDRAM_TR0_SDLD_MASK |
- SDRAM_TR0_SDRA_MASK | SDRAM_TR0_SDRD_MASK);
-
- /*
- * initialization
- */
- wcsbc = 0;
- t_rp_ns = 0;
- t_rcd_ns = 0;
- t_ras_ns = 0;
- cas_2_0_available = TRUE;
- cas_2_5_available = TRUE;
- cas_3_0_available = TRUE;
- tcyc_2_0_ns_x_10 = 0;
- tcyc_2_5_ns_x_10 = 0;
- tcyc_3_0_ns_x_10 = 0;
-
- for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
- if (dimm_populated[dimm_num] == TRUE) {
- wcsbc = spd_read(iic0_dimm_addr[dimm_num], 15);
- t_rp_ns = spd_read(iic0_dimm_addr[dimm_num], 27) >> 2;
- t_rcd_ns = spd_read(iic0_dimm_addr[dimm_num], 29) >> 2;
- t_ras_ns = spd_read(iic0_dimm_addr[dimm_num], 30);
- cas_bit = spd_read(iic0_dimm_addr[dimm_num], 18);
-
- for (cas_index = 0; cas_index < 3; cas_index++) {
- switch (cas_index) {
- case 0:
- tcyc_reg = spd_read(iic0_dimm_addr[dimm_num], 9);
- break;
- case 1:
- tcyc_reg = spd_read(iic0_dimm_addr[dimm_num], 23);
- break;
- default:
- tcyc_reg = spd_read(iic0_dimm_addr[dimm_num], 25);
- break;
- }
-
- if ((tcyc_reg & 0x0F) >= 10) {
- printf("ERROR: Tcyc incorrect for DIMM in slot %lu\n",
- dimm_num);
- hang();
- }
-
- cycle_time_ns_x_10[cas_index] =
- (((tcyc_reg & 0xF0) >> 4) * 10) + (tcyc_reg & 0x0F);
- }
-
- cas_index = 0;
-
- if ((cas_bit & 0x80) != 0) {
- cas_index += 3;
- } else if ((cas_bit & 0x40) != 0) {
- cas_index += 2;
- } else if ((cas_bit & 0x20) != 0) {
- cas_index += 1;
- }
-
- if (((cas_bit & 0x10) != 0) && (cas_index < 3)) {
- tcyc_3_0_ns_x_10 = cycle_time_ns_x_10[cas_index];
- cas_index++;
- } else {
- if (cas_index != 0) {
- cas_index++;
- }
- cas_3_0_available = FALSE;
- }
-
- if (((cas_bit & 0x08) != 0) || (cas_index < 3)) {
- tcyc_2_5_ns_x_10 = cycle_time_ns_x_10[cas_index];
- cas_index++;
- } else {
- if (cas_index != 0) {
- cas_index++;
- }
- cas_2_5_available = FALSE;
- }
-
- if (((cas_bit & 0x04) != 0) || (cas_index < 3)) {
- tcyc_2_0_ns_x_10 = cycle_time_ns_x_10[cas_index];
- cas_index++;
- } else {
- if (cas_index != 0) {
- cas_index++;
- }
- cas_2_0_available = FALSE;
- }
-
- break;
- }
- }
-
- /*
- * Program SD_WR and SD_WCSBC fields
- */
- tr0 |= SDRAM_TR0_SDWR_2_CLK; /* Write Recovery: 2 CLK */
- switch (wcsbc) {
- case 0:
- tr0 |= SDRAM_TR0_SDWD_0_CLK;
- break;
- default:
- tr0 |= SDRAM_TR0_SDWD_1_CLK;
- break;
- }
-
- /*
- * Program SD_CASL field
- */
- if ((cas_2_0_available == TRUE) &&
- (bus_period_x_10 >= tcyc_2_0_ns_x_10)) {
- tr0 |= SDRAM_TR0_SDCL_2_0_CLK;
- } else if ((cas_2_5_available == TRUE) &&
- (bus_period_x_10 >= tcyc_2_5_ns_x_10)) {
- tr0 |= SDRAM_TR0_SDCL_2_5_CLK;
- } else if ((cas_3_0_available == TRUE) &&
- (bus_period_x_10 >= tcyc_3_0_ns_x_10)) {
- tr0 |= SDRAM_TR0_SDCL_3_0_CLK;
- } else {
- printf("ERROR: No supported CAS latency with the installed DIMMs.\n");
- printf("Only CAS latencies of 2.0, 2.5, and 3.0 are supported.\n");
- printf("Make sure the PLB speed is within the supported range.\n");
- hang();
- }
-
- /*
- * Calculate Trp in clock cycles and round up if necessary
- * Program SD_PTA field
- */
- t_rp_clk = sys_info.freqPLB * t_rp_ns / ONE_BILLION;
- plb_check = ONE_BILLION * t_rp_clk / t_rp_ns;
- if (sys_info.freqPLB != plb_check) {
- t_rp_clk++;
- }
- switch ((unsigned long)t_rp_clk) {
- case 0:
- case 1:
- case 2:
- tr0 |= SDRAM_TR0_SDPA_2_CLK;
- break;
- case 3:
- tr0 |= SDRAM_TR0_SDPA_3_CLK;
- break;
- default:
- tr0 |= SDRAM_TR0_SDPA_4_CLK;
- break;
- }
-
- /*
- * Program SD_CTP field
- */
- t_ras_rcd_clk = sys_info.freqPLB * (t_ras_ns - t_rcd_ns) / ONE_BILLION;
- plb_check = ONE_BILLION * t_ras_rcd_clk / (t_ras_ns - t_rcd_ns);
- if (sys_info.freqPLB != plb_check) {
- t_ras_rcd_clk++;
- }
- switch (t_ras_rcd_clk) {
- case 0:
- case 1:
- case 2:
- tr0 |= SDRAM_TR0_SDCP_2_CLK;
- break;
- case 3:
- tr0 |= SDRAM_TR0_SDCP_3_CLK;
- break;
- case 4:
- tr0 |= SDRAM_TR0_SDCP_4_CLK;
- break;
- default:
- tr0 |= SDRAM_TR0_SDCP_5_CLK;
- break;
- }
-
- /*
- * Program SD_LDF field
- */
- tr0 |= SDRAM_TR0_SDLD_2_CLK;
-
- /*
- * Program SD_RFTA field
- * FIXME tRFC hardcoded as 75 nanoseconds
- */
- t_rfc_clk = sys_info.freqPLB / (ONE_BILLION / 75);
- residue = sys_info.freqPLB % (ONE_BILLION / 75);
- if (residue >= (ONE_BILLION / 150)) {
- t_rfc_clk++;
- }
- switch (t_rfc_clk) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- tr0 |= SDRAM_TR0_SDRA_6_CLK;
- break;
- case 7:
- tr0 |= SDRAM_TR0_SDRA_7_CLK;
- break;
- case 8:
- tr0 |= SDRAM_TR0_SDRA_8_CLK;
- break;
- case 9:
- tr0 |= SDRAM_TR0_SDRA_9_CLK;
- break;
- case 10:
- tr0 |= SDRAM_TR0_SDRA_10_CLK;
- break;
- case 11:
- tr0 |= SDRAM_TR0_SDRA_11_CLK;
- break;
- case 12:
- tr0 |= SDRAM_TR0_SDRA_12_CLK;
- break;
- default:
- tr0 |= SDRAM_TR0_SDRA_13_CLK;
- break;
- }
-
- /*
- * Program SD_RCD field
- */
- t_rcd_clk = sys_info.freqPLB * t_rcd_ns / ONE_BILLION;
- plb_check = ONE_BILLION * t_rcd_clk / t_rcd_ns;
- if (sys_info.freqPLB != plb_check) {
- t_rcd_clk++;
- }
- switch (t_rcd_clk) {
- case 0:
- case 1:
- case 2:
- tr0 |= SDRAM_TR0_SDRD_2_CLK;
- break;
- case 3:
- tr0 |= SDRAM_TR0_SDRD_3_CLK;
- break;
- default:
- tr0 |= SDRAM_TR0_SDRD_4_CLK;
- break;
- }
-
- mtsdram(mem_tr0, tr0);
-}
-
-void program_tr1 (void)
-{
- unsigned long tr0;
- unsigned long tr1;
- unsigned long cfg0;
- unsigned long ecc_temp;
- unsigned long dlycal;
- unsigned long dly_val;
- unsigned long i, j, k;
- unsigned long bxcr_num;
- unsigned long max_pass_length;
- unsigned long current_pass_length;
- unsigned long current_fail_length;
- unsigned long current_start;
- unsigned long rdclt;
- unsigned long rdclt_offset;
- long max_start;
- long max_end;
- long rdclt_average;
- unsigned char window_found;
- unsigned char fail_found;
- unsigned char pass_found;
- unsigned long * membase;
- PPC440_SYS_INFO sys_info;
-
- /*
- * get the board info
- */
- get_sys_info(&sys_info);
-
- /*
- * get SDRAM Timing Register 0 (SDRAM_TR0) and clear bits
- */
- mfsdram(mem_tr1, tr1);
- tr1 &= ~(SDRAM_TR1_RDSS_MASK | SDRAM_TR1_RDSL_MASK |
- SDRAM_TR1_RDCD_MASK | SDRAM_TR1_RDCT_MASK);
-
- mfsdram(mem_tr0, tr0);
- if (((tr0 & SDRAM_TR0_SDCL_MASK) == SDRAM_TR0_SDCL_2_5_CLK) &&
- (sys_info.freqPLB > 100000000)) {
- tr1 |= SDRAM_TR1_RDSS_TR2;
- tr1 |= SDRAM_TR1_RDSL_STAGE3;
- tr1 |= SDRAM_TR1_RDCD_RCD_1_2;
- } else {
- tr1 |= SDRAM_TR1_RDSS_TR1;
- tr1 |= SDRAM_TR1_RDSL_STAGE2;
- tr1 |= SDRAM_TR1_RDCD_RCD_0_0;
- }
-
- /*
- * save CFG0 ECC setting to a temporary variable and turn ECC off
- */
- mfsdram(mem_cfg0, cfg0);
- ecc_temp = cfg0 & SDRAM_CFG0_MCHK_MASK;
- mtsdram(mem_cfg0, (cfg0 & ~SDRAM_CFG0_MCHK_MASK) | SDRAM_CFG0_MCHK_NON);
-
- /*
- * get the delay line calibration register value
- */
- mfsdram(mem_dlycal, dlycal);
- dly_val = SDRAM_DLYCAL_DLCV_DECODE(dlycal) << 2;
-
- max_pass_length = 0;
- max_start = 0;
- max_end = 0;
- current_pass_length = 0;
- current_fail_length = 0;
- current_start = 0;
- rdclt_offset = 0;
- window_found = FALSE;
- fail_found = FALSE;
- pass_found = FALSE;
-#ifdef DEBUG
- printf("Starting memory test ");
-#endif
- for (k = 0; k < NUMHALFCYCLES; k++) {
- for (rdclt = 0; rdclt < dly_val; rdclt++) {
- /*
- * Set the timing reg for the test.
- */
- mtsdram(mem_tr1, (tr1 | SDRAM_TR1_RDCT_ENCODE(rdclt)));
-
- for (bxcr_num = 0; bxcr_num < MAXBXCR; bxcr_num++) {
- mtdcr(memcfga, mem_b0cr + (bxcr_num<<2));
- if ((mfdcr(memcfgd) & SDRAM_BXCR_SDBE) == SDRAM_BXCR_SDBE) {
- /* Bank is enabled */
- membase = (unsigned long*)
- (mfdcr(memcfgd) & SDRAM_BXCR_SDBA_MASK);
-
- /*
- * Run the short memory test
- */
- for (i = 0; i < NUMMEMTESTS; i++) {
- for (j = 0; j < NUMMEMWORDS; j++) {
- membase[j] = test[i][j];
- ppcDcbf((unsigned long)&(membase[j]));
- }
-
- for (j = 0; j < NUMMEMWORDS; j++) {
- if (membase[j] != test[i][j]) {
- ppcDcbf((unsigned long)&(membase[j]));
- break;
- }
- ppcDcbf((unsigned long)&(membase[j]));
- }
-
- if (j < NUMMEMWORDS) {
- break;
- }
- }
-
- /*
- * see if the rdclt value passed
- */
- if (i < NUMMEMTESTS) {
- break;
- }
- }
- }
-
- if (bxcr_num == MAXBXCR) {
- if (fail_found == TRUE) {
- pass_found = TRUE;
- if (current_pass_length == 0) {
- current_start = rdclt_offset + rdclt;
- }
-
- current_fail_length = 0;
- current_pass_length++;
-
- if (current_pass_length > max_pass_length) {
- max_pass_length = current_pass_length;
- max_start = current_start;
- max_end = rdclt_offset + rdclt;
- }
- }
- } else {
- current_pass_length = 0;
- current_fail_length++;
-
- if (current_fail_length >= (dly_val>>2)) {
- if (fail_found == FALSE) {
- fail_found = TRUE;
- } else if (pass_found == TRUE) {
- window_found = TRUE;
- break;
- }
- }
- }
- }
-#ifdef DEBUG
- printf(".");
-#endif
- if (window_found == TRUE) {
- break;
- }
-
- tr1 = tr1 ^ SDRAM_TR1_RDCD_MASK;
- rdclt_offset += dly_val;
- }
-#ifdef DEBUG
- printf("\n");
-#endif
-
- /*
- * make sure we find the window
- */
- if (window_found == FALSE) {
- printf("ERROR: Cannot determine a common read delay.\n");
- hang();
- }
-
- /*
- * restore the orignal ECC setting
- */
- mtsdram(mem_cfg0, (cfg0 & ~SDRAM_CFG0_MCHK_MASK) | ecc_temp);
-
- /*
- * set the SDRAM TR1 RDCD value
- */
- tr1 &= ~SDRAM_TR1_RDCD_MASK;
- if ((tr0 & SDRAM_TR0_SDCL_MASK) == SDRAM_TR0_SDCL_2_5_CLK) {
- tr1 |= SDRAM_TR1_RDCD_RCD_1_2;
- } else {
- tr1 |= SDRAM_TR1_RDCD_RCD_0_0;
- }
-
- /*
- * set the SDRAM TR1 RDCLT value
- */
- tr1 &= ~SDRAM_TR1_RDCT_MASK;
- while (max_end >= (dly_val << 1)) {
- max_end -= (dly_val << 1);
- max_start -= (dly_val << 1);
- }
-
- rdclt_average = ((max_start + max_end) >> 1);
- if (rdclt_average >= 0x60)
- while (1)
- ;
-
- if (rdclt_average < 0) {
- rdclt_average = 0;
- }
-
- if (rdclt_average >= dly_val) {
- rdclt_average -= dly_val;
- tr1 = tr1 ^ SDRAM_TR1_RDCD_MASK;
- }
- tr1 |= SDRAM_TR1_RDCT_ENCODE(rdclt_average);
-
- /*
- * program SDRAM Timing Register 1 TR1
- */
- mtsdram(mem_tr1, tr1);
-}
-
-unsigned long program_bxcr(unsigned long* dimm_populated,
- unsigned char* iic0_dimm_addr,
- unsigned long num_dimm_banks)
-{
- unsigned long dimm_num;
- unsigned long bank_base_addr;
- unsigned long cr;
- unsigned long i;
- unsigned long j;
- unsigned long temp;
- unsigned char num_row_addr;
- unsigned char num_col_addr;
- unsigned char num_banks;
- unsigned char bank_size_id;
- unsigned long ctrl_bank_num[MAXBANKS];
- unsigned long bx_cr_num;
- unsigned long largest_size_index;
- unsigned long largest_size;
- unsigned long current_size_index;
- BANKPARMS bank_parms[MAXBXCR];
- unsigned long sorted_bank_num[MAXBXCR]; /* DDR Controller bank number table (sorted by size) */
- unsigned long sorted_bank_size[MAXBXCR]; /* DDR Controller bank size table (sorted by size)*/
-
- /*
- * Set the BxCR regs. First, wipe out the bank config registers.
- */
- for (bx_cr_num = 0; bx_cr_num < MAXBXCR; bx_cr_num++) {
- mtdcr(memcfga, mem_b0cr + (bx_cr_num << 2));
- mtdcr(memcfgd, 0x00000000);
- bank_parms[bx_cr_num].bank_size_bytes = 0;
- }
-
-#ifdef CONFIG_BAMBOO
- /*
- * This next section is hardware dependent and must be programmed
- * to match the hardware. For bammboo, the following holds...
- * 1. SDRAM0_B0CR: Bank 0 of dimm 0 ctrl_bank_num : 0
- * 2. SDRAM0_B1CR: Bank 0 of dimm 1 ctrl_bank_num : 1
- * 3. SDRAM0_B2CR: Bank 1 of dimm 1 ctrl_bank_num : 1
- * 4. SDRAM0_B3CR: Bank 0 of dimm 2 ctrl_bank_num : 3
- * ctrl_bank_num corresponds to the first usable DDR controller bank number by DIMM
- */
- ctrl_bank_num[0] = 0;
- ctrl_bank_num[1] = 1;
- ctrl_bank_num[2] = 3;
-#else
- ctrl_bank_num[0] = 0;
- ctrl_bank_num[1] = 1;
- ctrl_bank_num[2] = 2;
- ctrl_bank_num[3] = 3;
-#endif
-
- /*
- * reset the bank_base address
- */
- bank_base_addr = CFG_SDRAM_BASE;
-
- for (dimm_num = 0; dimm_num < num_dimm_banks; dimm_num++) {
- if (dimm_populated[dimm_num] == TRUE) {
- num_row_addr = spd_read(iic0_dimm_addr[dimm_num], 3);
- num_col_addr = spd_read(iic0_dimm_addr[dimm_num], 4);
- num_banks = spd_read(iic0_dimm_addr[dimm_num], 5);
- bank_size_id = spd_read(iic0_dimm_addr[dimm_num], 31);
-
- /*
- * Set the SDRAM0_BxCR regs
- */
- cr = 0;
- switch (bank_size_id) {
- case 0x02:
- cr |= SDRAM_BXCR_SDSZ_8;
- break;
- case 0x04:
- cr |= SDRAM_BXCR_SDSZ_16;
- break;
- case 0x08:
- cr |= SDRAM_BXCR_SDSZ_32;
- break;
- case 0x10:
- cr |= SDRAM_BXCR_SDSZ_64;
- break;
- case 0x20:
- cr |= SDRAM_BXCR_SDSZ_128;
- break;
- case 0x40:
- cr |= SDRAM_BXCR_SDSZ_256;
- break;
- case 0x80:
- cr |= SDRAM_BXCR_SDSZ_512;
- break;
- default:
- printf("DDR-SDRAM: DIMM %lu BxCR configuration.\n",
- dimm_num);
- printf("ERROR: Unsupported value for the banksize: %d.\n",
- bank_size_id);
- printf("Replace the DIMM module with a supported DIMM.\n\n");
- hang();
- }
-
- switch (num_col_addr) {
- case 0x08:
- cr |= SDRAM_BXCR_SDAM_1;
- break;
- case 0x09:
- cr |= SDRAM_BXCR_SDAM_2;
- break;
- case 0x0A:
- cr |= SDRAM_BXCR_SDAM_3;
- break;
- case 0x0B:
- cr |= SDRAM_BXCR_SDAM_4;
- break;
- default:
- printf("DDR-SDRAM: DIMM %lu BxCR configuration.\n",
- dimm_num);
- printf("ERROR: Unsupported value for number of "
- "column addresses: %d.\n", num_col_addr);
- printf("Replace the DIMM module with a supported DIMM.\n\n");
- hang();
- }
-
- /*
- * enable the bank
- */
- cr |= SDRAM_BXCR_SDBE;
-
- for (i = 0; i < num_banks; i++) {
- bank_parms[ctrl_bank_num[dimm_num]+i].bank_size_bytes =
- (4 * 1024 * 1024) * bank_size_id;
- bank_parms[ctrl_bank_num[dimm_num]+i].cr = cr;
- }
- }
- }
-
- /* Initialize sort tables */
- for (i = 0; i < MAXBXCR; i++) {
- sorted_bank_num[i] = i;
- sorted_bank_size[i] = bank_parms[i].bank_size_bytes;
- }
-
- for (i = 0; i < MAXBXCR-1; i++) {
- largest_size = sorted_bank_size[i];
- largest_size_index = 255;
-
- /* Find the largest remaining value */
- for (j = i + 1; j < MAXBXCR; j++) {
- if (sorted_bank_size[j] > largest_size) {
- /* Save largest remaining value and its index */
- largest_size = sorted_bank_size[j];
- largest_size_index = j;
- }
- }
-
- if (largest_size_index != 255) {
- /* Swap the current and largest values */
- current_size_index = sorted_bank_num[largest_size_index];
- sorted_bank_size[largest_size_index] = sorted_bank_size[i];
- sorted_bank_size[i] = largest_size;
- sorted_bank_num[largest_size_index] = sorted_bank_num[i];
- sorted_bank_num[i] = current_size_index;
- }
- }
-
- /* Set the SDRAM0_BxCR regs thanks to sort tables */
- for (bx_cr_num = 0, bank_base_addr = 0; bx_cr_num < MAXBXCR; bx_cr_num++) {
- if (bank_parms[sorted_bank_num[bx_cr_num]].bank_size_bytes) {
- mtdcr(memcfga, mem_b0cr + (sorted_bank_num[bx_cr_num] << 2));
- temp = mfdcr(memcfgd) & ~(SDRAM_BXCR_SDBA_MASK | SDRAM_BXCR_SDSZ_MASK |
- SDRAM_BXCR_SDAM_MASK | SDRAM_BXCR_SDBE);
- temp = temp | (bank_base_addr & SDRAM_BXCR_SDBA_MASK) |
- bank_parms[sorted_bank_num[bx_cr_num]].cr;
- mtdcr(memcfgd, temp);
- bank_base_addr += bank_parms[sorted_bank_num[bx_cr_num]].bank_size_bytes;
- }
- }
-
- return(bank_base_addr);
-}
-
-void program_ecc (unsigned long num_bytes)
-{
- unsigned long bank_base_addr;
- unsigned long current_address;
- unsigned long end_address;
- unsigned long address_increment;
- unsigned long cfg0;
-
- /*
- * get Memory Controller Options 0 data
- */
- mfsdram(mem_cfg0, cfg0);
-
- /*
- * reset the bank_base address
- */
- bank_base_addr = CFG_SDRAM_BASE;
-
- if ((cfg0 & SDRAM_CFG0_MCHK_MASK) != SDRAM_CFG0_MCHK_NON) {
- mtsdram(mem_cfg0, (cfg0 & ~SDRAM_CFG0_MCHK_MASK) |
- SDRAM_CFG0_MCHK_GEN);
-
- if ((cfg0 & SDRAM_CFG0_DMWD_MASK) == SDRAM_CFG0_DMWD_32) {
- address_increment = 4;
- } else {
- address_increment = 8;
- }
-
- current_address = (unsigned long)(bank_base_addr);
- end_address = (unsigned long)(bank_base_addr) + num_bytes;
-
- while (current_address < end_address) {
- *((unsigned long*)current_address) = 0x00000000;
- current_address += address_increment;
- }
-
- mtsdram(mem_cfg0, (cfg0 & ~SDRAM_CFG0_MCHK_MASK) |
- SDRAM_CFG0_MCHK_CHK);
- }
-}
-
-#endif /* CONFIG_440 */
-
-#endif /* CONFIG_SPD_EEPROM */
diff --git a/cpu/ppc4xx/speed.c b/cpu/ppc4xx/speed.c
deleted file mode 100644
index 2d16a83420..0000000000
--- a/cpu/ppc4xx/speed.c
+++ /dev/null
@@ -1,815 +0,0 @@
-/*
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <ppc_asm.tmpl>
-#include <ppc4xx.h>
-#include <asm/processor.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define ONE_BILLION 1000000000
-#ifdef DEBUG
-#define DEBUGF(fmt,args...) printf(fmt ,##args)
-#else
-#define DEBUGF(fmt,args...)
-#endif
-
-#if defined(CONFIG_405GP) || defined(CONFIG_405CR)
-
-void get_sys_info (PPC405_SYS_INFO * sysInfo)
-{
- unsigned long pllmr;
- unsigned long sysClkPeriodPs = ONE_BILLION / (CONFIG_SYS_CLK_FREQ / 1000);
- uint pvr = get_pvr();
- unsigned long psr;
- unsigned long m;
-
- /*
- * Read PLL Mode register
- */
- pllmr = mfdcr (pllmd);
-
- /*
- * Read Pin Strapping register
- */
- psr = mfdcr (strap);
-
- /*
- * Determine FWD_DIV.
- */
- sysInfo->pllFwdDiv = 8 - ((pllmr & PLLMR_FWD_DIV_MASK) >> 29);
-
- /*
- * Determine FBK_DIV.
- */
- sysInfo->pllFbkDiv = ((pllmr & PLLMR_FB_DIV_MASK) >> 25);
- if (sysInfo->pllFbkDiv == 0) {
- sysInfo->pllFbkDiv = 16;
- }
-
- /*
- * Determine PLB_DIV.
- */
- sysInfo->pllPlbDiv = ((pllmr & PLLMR_CPU_TO_PLB_MASK) >> 17) + 1;
-
- /*
- * Determine PCI_DIV.
- */
- sysInfo->pllPciDiv = ((pllmr & PLLMR_PCI_TO_PLB_MASK) >> 13) + 1;
-
- /*
- * Determine EXTBUS_DIV.
- */
- sysInfo->pllExtBusDiv = ((pllmr & PLLMR_EXB_TO_PLB_MASK) >> 11) + 2;
-
- /*
- * Determine OPB_DIV.
- */
- sysInfo->pllOpbDiv = ((pllmr & PLLMR_OPB_TO_PLB_MASK) >> 15) + 1;
-
- /*
- * Check if PPC405GPr used (mask minor revision field)
- */
- if ((pvr & 0xfffffff0) == (PVR_405GPR_RB & 0xfffffff0)) {
- /*
- * Determine FWD_DIV B (only PPC405GPr with new mode strapping).
- */
- sysInfo->pllFwdDivB = 8 - (pllmr & PLLMR_FWDB_DIV_MASK);
-
- /*
- * Determine factor m depending on PLL feedback clock source
- */
- if (!(psr & PSR_PCI_ASYNC_EN)) {
- if (psr & PSR_NEW_MODE_EN) {
- /*
- * sync pci clock used as feedback (new mode)
- */
- m = 1 * sysInfo->pllFwdDivB * 2 * sysInfo->pllPciDiv;
- } else {
- /*
- * sync pci clock used as feedback (legacy mode)
- */
- m = 1 * sysInfo->pllFwdDivB * sysInfo->pllPlbDiv * sysInfo->pllPciDiv;
- }
- } else if (psr & PSR_NEW_MODE_EN) {
- if (psr & PSR_PERCLK_SYNC_MODE_EN) {
- /*
- * PerClk used as feedback (new mode)
- */
- m = 1 * sysInfo->pllFwdDivB * 2 * sysInfo->pllExtBusDiv;
- } else {
- /*
- * CPU clock used as feedback (new mode)
- */
- m = sysInfo->pllFbkDiv * sysInfo->pllFwdDiv;
- }
- } else if (sysInfo->pllExtBusDiv == sysInfo->pllFbkDiv) {
- /*
- * PerClk used as feedback (legacy mode)
- */
- m = 1 * sysInfo->pllFwdDivB * sysInfo->pllPlbDiv * sysInfo->pllExtBusDiv;
- } else {
- /*
- * PLB clock used as feedback (legacy mode)
- */
- m = sysInfo->pllFbkDiv * sysInfo->pllFwdDivB * sysInfo->pllPlbDiv;
- }
-
- sysInfo->freqVCOHz = (1000000000000LL * (unsigned long long)m) /
- (unsigned long long)sysClkPeriodPs;
- sysInfo->freqProcessor = sysInfo->freqVCOHz / sysInfo->pllFwdDiv;
- sysInfo->freqPLB = sysInfo->freqVCOHz / (sysInfo->pllFwdDivB * sysInfo->pllPlbDiv);
- } else {
- /*
- * Check pllFwdDiv to see if running in bypass mode where the CPU speed
- * is equal to the 405GP SYS_CLK_FREQ. If not in bypass mode, check VCO
- * to make sure it is within the proper range.
- * spec: VCO = SYS_CLOCK x FBKDIV x PLBDIV x FWDDIV
- * Note freqVCO is calculated in Mhz to avoid errors introduced by rounding.
- */
- if (sysInfo->pllFwdDiv == 1) {
- sysInfo->freqProcessor = CONFIG_SYS_CLK_FREQ;
- sysInfo->freqPLB = CONFIG_SYS_CLK_FREQ / sysInfo->pllPlbDiv;
- } else {
- sysInfo->freqVCOHz = ( 1000000000000LL *
- (unsigned long long)sysInfo->pllFwdDiv *
- (unsigned long long)sysInfo->pllFbkDiv *
- (unsigned long long)sysInfo->pllPlbDiv
- ) / (unsigned long long)sysClkPeriodPs;
- sysInfo->freqPLB = (ONE_BILLION / ((sysClkPeriodPs * 10) /
- sysInfo->pllFbkDiv)) * 10000;
- sysInfo->freqProcessor = sysInfo->freqPLB * sysInfo->pllPlbDiv;
- }
- }
-}
-
-
-/********************************************
- * get_OPB_freq
- * return OPB bus freq in Hz
- *********************************************/
-ulong get_OPB_freq (void)
-{
- ulong val = 0;
-
- PPC405_SYS_INFO sys_info;
-
- get_sys_info (&sys_info);
- val = sys_info.freqPLB / sys_info.pllOpbDiv;
-
- return val;
-}
-
-
-/********************************************
- * get_PCI_freq
- * return PCI bus freq in Hz
- *********************************************/
-ulong get_PCI_freq (void)
-{
- ulong val;
- PPC405_SYS_INFO sys_info;
-
- get_sys_info (&sys_info);
- val = sys_info.freqPLB / sys_info.pllPciDiv;
- return val;
-}
-
-
-#elif defined(CONFIG_440)
-
-#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-void get_sys_info (sys_info_t *sysInfo)
-{
- unsigned long temp;
- unsigned long reg;
- unsigned long lfdiv;
- unsigned long m;
- unsigned long prbdv0;
- /*
- WARNING: ASSUMES the following:
- ENG=1
- PRADV0=1
- PRBDV0=1
- */
-
- /* Decode CPR0_PLLD0 for divisors */
- mfclk(clk_plld, reg);
- temp = (reg & PLLD_FWDVA_MASK) >> 16;
- sysInfo->pllFwdDivA = temp ? temp : 16;
- temp = (reg & PLLD_FWDVB_MASK) >> 8;
- sysInfo->pllFwdDivB = temp ? temp: 8 ;
- temp = (reg & PLLD_FBDV_MASK) >> 24;
- sysInfo->pllFbkDiv = temp ? temp : 32;
- lfdiv = reg & PLLD_LFBDV_MASK;
-
- mfclk(clk_opbd, reg);
- temp = (reg & OPBDDV_MASK) >> 24;
- sysInfo->pllOpbDiv = temp ? temp : 4;
-
- mfclk(clk_perd, reg);
- temp = (reg & PERDV_MASK) >> 24;
- sysInfo->pllExtBusDiv = temp ? temp : 8;
-
- mfclk(clk_primbd, reg);
- temp = (reg & PRBDV_MASK) >> 24;
- prbdv0 = temp ? temp : 8;
-
- mfclk(clk_spcid, reg);
- temp = (reg & SPCID_MASK) >> 24;
- sysInfo->pllPciDiv = temp ? temp : 4;
-
- /* Calculate 'M' based on feedback source */
- mfsdr(sdr_sdstp0, reg);
- temp = (reg & PLLSYS0_SEL_MASK) >> 27;
- if (temp == 0) { /* PLL output */
- /* Figure which pll to use */
- mfclk(clk_pllc, reg);
- temp = (reg & PLLC_SRC_MASK) >> 29;
- if (!temp) /* PLLOUTA */
- m = sysInfo->pllFbkDiv * lfdiv * sysInfo->pllFwdDivA;
- else /* PLLOUTB */
- m = sysInfo->pllFbkDiv * lfdiv * sysInfo->pllFwdDivB;
- }
- else if (temp == 1) /* CPU output */
- m = sysInfo->pllFbkDiv * sysInfo->pllFwdDivA;
- else /* PerClk */
- m = sysInfo->pllExtBusDiv * sysInfo->pllOpbDiv * sysInfo->pllFwdDivB;
-
- /* Now calculate the individual clocks */
- sysInfo->freqVCOMhz = (m * CONFIG_SYS_CLK_FREQ) + (m>>1);
- sysInfo->freqProcessor = sysInfo->freqVCOMhz/sysInfo->pllFwdDivA;
- sysInfo->freqPLB = sysInfo->freqVCOMhz/sysInfo->pllFwdDivB/prbdv0;
- sysInfo->freqOPB = sysInfo->freqPLB/sysInfo->pllOpbDiv;
- sysInfo->freqEPB = sysInfo->freqPLB/sysInfo->pllExtBusDiv;
- sysInfo->freqPCI = sysInfo->freqPLB/sysInfo->pllPciDiv;
-
- /* Figure which timer source to use */
- if (mfspr(ccr1) & 0x0080) { /* External Clock, assume same as SYS_CLK */
- temp = sysInfo->freqProcessor / 2; /* Max extern clock speed */
- if (CONFIG_SYS_CLK_FREQ > temp)
- sysInfo->freqTmrClk = temp;
- else
- sysInfo->freqTmrClk = CONFIG_SYS_CLK_FREQ;
- }
- else /* Internal clock */
- sysInfo->freqTmrClk = sysInfo->freqProcessor;
-}
-/********************************************
- * get_PCI_freq
- * return PCI bus freq in Hz
- *********************************************/
-ulong get_PCI_freq (void)
-{
- sys_info_t sys_info;
- get_sys_info (&sys_info);
- return sys_info.freqPCI;
-}
-
-#elif !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && !defined(CONFIG_440SPE)
-void get_sys_info (sys_info_t * sysInfo)
-{
- unsigned long strp0;
- unsigned long temp;
- unsigned long m;
-
- /* Extract configured divisors */
- strp0 = mfdcr( cpc0_strp0 );
- sysInfo->pllFwdDivA = 8 - ((strp0 & PLLSYS0_FWD_DIV_A_MASK) >> 15);
- sysInfo->pllFwdDivB = 8 - ((strp0 & PLLSYS0_FWD_DIV_B_MASK) >> 12);
- temp = (strp0 & PLLSYS0_FB_DIV_MASK) >> 18;
- sysInfo->pllFbkDiv = temp ? temp : 16;
- sysInfo->pllOpbDiv = 1 + ((strp0 & PLLSYS0_OPB_DIV_MASK) >> 10);
- sysInfo->pllExtBusDiv = 1 + ((strp0 & PLLSYS0_EPB_DIV_MASK) >> 8);
-
- /* Calculate 'M' based on feedback source */
- if( strp0 & PLLSYS0_EXTSL_MASK )
- m = sysInfo->pllExtBusDiv * sysInfo->pllOpbDiv * sysInfo->pllFwdDivB;
- else
- m = sysInfo->pllFbkDiv * sysInfo->pllFwdDivA;
-
- /* Now calculate the individual clocks */
- sysInfo->freqVCOMhz = (m * CONFIG_SYS_CLK_FREQ) + (m>>1);
- sysInfo->freqProcessor = sysInfo->freqVCOMhz/sysInfo->pllFwdDivA;
- sysInfo->freqPLB = sysInfo->freqVCOMhz/sysInfo->pllFwdDivB;
- if( get_pvr() == PVR_440GP_RB ) /* Rev B divs an extra 2 -- geez! */
- sysInfo->freqPLB >>= 1;
- sysInfo->freqOPB = sysInfo->freqPLB/sysInfo->pllOpbDiv;
- sysInfo->freqEPB = sysInfo->freqOPB/sysInfo->pllExtBusDiv;
-
-}
-#else
-void get_sys_info (sys_info_t * sysInfo)
-{
- unsigned long strp0;
- unsigned long strp1;
- unsigned long temp;
- unsigned long temp1;
- unsigned long lfdiv;
- unsigned long m;
- unsigned long prbdv0;
-
-#if defined(CONFIG_440SPE)
- unsigned long sys_freq;
- unsigned long sys_per=0;
- unsigned long msr;
- unsigned long pci_clock_per;
- unsigned long sdr_ddrpll;
-
- /*-------------------------------------------------------------------------+
- | Get the system clock period.
- +-------------------------------------------------------------------------*/
- sys_per = determine_sysper();
-
- msr = (mfmsr () & ~(MSR_EE)); /* disable interrupts */
-
- /*-------------------------------------------------------------------------+
- | Calculate the system clock speed from the period.
- +-------------------------------------------------------------------------*/
- sys_freq=(ONE_BILLION/sys_per)*1000;
-#endif
-
- /* Extract configured divisors */
- mfsdr( sdr_sdstp0,strp0 );
- mfsdr( sdr_sdstp1,strp1 );
-
- temp = ((strp0 & PLLSYS0_FWD_DIV_A_MASK) >> 8);
- sysInfo->pllFwdDivA = temp ? temp : 16 ;
- temp = ((strp0 & PLLSYS0_FWD_DIV_B_MASK) >> 5);
- sysInfo->pllFwdDivB = temp ? temp: 8 ;
- temp = (strp0 & PLLSYS0_FB_DIV_MASK) >> 12;
- sysInfo->pllFbkDiv = temp ? temp : 32;
- temp = (strp0 & PLLSYS0_OPB_DIV_MASK);
- sysInfo->pllOpbDiv = temp ? temp : 4;
- temp = (strp1 & PLLSYS1_PERCLK_DIV_MASK) >> 24;
- sysInfo->pllExtBusDiv = temp ? temp : 4;
- prbdv0 = (strp0 >> 2) & 0x7;
-
- /* Calculate 'M' based on feedback source */
- temp = (strp0 & PLLSYS0_SEL_MASK) >> 27;
- temp1 = (strp1 & PLLSYS1_LF_DIV_MASK) >> 26;
- lfdiv = temp1 ? temp1 : 64;
- if (temp == 0) { /* PLL output */
- /* Figure which pll to use */
- temp = (strp0 & PLLSYS0_SRC_MASK) >> 30;
- if (!temp)
- m = sysInfo->pllFbkDiv * lfdiv * sysInfo->pllFwdDivA;
- else
- m = sysInfo->pllFbkDiv * lfdiv * sysInfo->pllFwdDivB;
- }
- else if (temp == 1) /* CPU output */
- m = sysInfo->pllFbkDiv * sysInfo->pllFwdDivA;
- else /* PerClk */
- m = sysInfo->pllExtBusDiv * sysInfo->pllOpbDiv * sysInfo->pllFwdDivB;
-
- /* Now calculate the individual clocks */
-#if defined(CONFIG_440SPE)
- sysInfo->freqVCOMhz = (m * sys_freq) ;
-#else
- sysInfo->freqVCOMhz = (m * CONFIG_SYS_CLK_FREQ) + (m>>1);
-#endif
- sysInfo->freqProcessor = sysInfo->freqVCOMhz/sysInfo->pllFwdDivA;
- sysInfo->freqPLB = sysInfo->freqVCOMhz/sysInfo->pllFwdDivB/prbdv0;
- sysInfo->freqOPB = sysInfo->freqPLB/sysInfo->pllOpbDiv;
- sysInfo->freqEPB = sysInfo->freqOPB/sysInfo->pllExtBusDiv;
-
-#if defined(CONFIG_440SPE)
- /* Determine PCI Clock Period */
- pci_clock_per = determine_pci_clock_per();
- sysInfo->freqPCI = (ONE_BILLION/pci_clock_per) * 1000;
- mfsdr(sdr_ddr0, sdr_ddrpll);
- sysInfo->freqDDR = ((sysInfo->freqPLB) * SDR0_DDR0_DDRM_DECODE(sdr_ddrpll));
-#endif
-
-
-}
-
-#endif
-
-#if defined(CONFIG_440SPE)
-unsigned long determine_sysper(void)
-{
- unsigned int fpga_clocking_reg;
- unsigned int master_clock_selection;
- unsigned long master_clock_per = 0;
- unsigned long fb_div_selection;
- unsigned int vco_div_reg_value;
- unsigned long vco_div_selection;
- unsigned long sys_per = 0;
- int extClkVal;
-
- /*-------------------------------------------------------------------------+
- | Read FPGA reg 0 and reg 1 to get FPGA reg information
- +-------------------------------------------------------------------------*/
- fpga_clocking_reg = in16(FPGA_REG16);
-
-
- /* Determine Master Clock Source Selection */
- master_clock_selection = fpga_clocking_reg & FPGA_REG16_MASTER_CLK_MASK;
-
- switch(master_clock_selection) {
- case FPGA_REG16_MASTER_CLK_66_66:
- master_clock_per = PERIOD_66_66MHZ;
- break;
- case FPGA_REG16_MASTER_CLK_50:
- master_clock_per = PERIOD_50_00MHZ;
- break;
- case FPGA_REG16_MASTER_CLK_33_33:
- master_clock_per = PERIOD_33_33MHZ;
- break;
- case FPGA_REG16_MASTER_CLK_25:
- master_clock_per = PERIOD_25_00MHZ;
- break;
- case FPGA_REG16_MASTER_CLK_EXT:
- if ((extClkVal==EXTCLK_33_33)
- && (extClkVal==EXTCLK_50)
- && (extClkVal==EXTCLK_66_66)
- && (extClkVal==EXTCLK_83)) {
- /* calculate master clock period from external clock value */
- master_clock_per=(ONE_BILLION/extClkVal) * 1000;
- } else {
- /* Unsupported */
- DEBUGF ("%s[%d] *** master clock selection failed ***\n", __FUNCTION__,__LINE__);
- hang();
- }
- break;
- default:
- /* Unsupported */
- DEBUGF ("%s[%d] *** master clock selection failed ***\n", __FUNCTION__,__LINE__);
- hang();
- break;
- }
-
- /* Determine FB divisors values */
- if ((fpga_clocking_reg & FPGA_REG16_FB1_DIV_MASK) == FPGA_REG16_FB1_DIV_LOW) {
- if ((fpga_clocking_reg & FPGA_REG16_FB2_DIV_MASK) == FPGA_REG16_FB2_DIV_LOW)
- fb_div_selection = FPGA_FB_DIV_6;
- else
- fb_div_selection = FPGA_FB_DIV_12;
- } else {
- if ((fpga_clocking_reg & FPGA_REG16_FB2_DIV_MASK) == FPGA_REG16_FB2_DIV_LOW)
- fb_div_selection = FPGA_FB_DIV_10;
- else
- fb_div_selection = FPGA_FB_DIV_20;
- }
-
- /* Determine VCO divisors values */
- vco_div_reg_value = fpga_clocking_reg & FPGA_REG16_VCO_DIV_MASK;
-
- switch(vco_div_reg_value) {
- case FPGA_REG16_VCO_DIV_4:
- vco_div_selection = FPGA_VCO_DIV_4;
- break;
- case FPGA_REG16_VCO_DIV_6:
- vco_div_selection = FPGA_VCO_DIV_6;
- break;
- case FPGA_REG16_VCO_DIV_8:
- vco_div_selection = FPGA_VCO_DIV_8;
- break;
- case FPGA_REG16_VCO_DIV_10:
- default:
- vco_div_selection = FPGA_VCO_DIV_10;
- break;
- }
-
- if (master_clock_selection == FPGA_REG16_MASTER_CLK_EXT) {
- switch(master_clock_per) {
- case PERIOD_25_00MHZ:
- if (fb_div_selection == FPGA_FB_DIV_12) {
- if (vco_div_selection == FPGA_VCO_DIV_4)
- sys_per = PERIOD_75_00MHZ;
- if (vco_div_selection == FPGA_VCO_DIV_6)
- sys_per = PERIOD_50_00MHZ;
- }
- break;
- case PERIOD_33_33MHZ:
- if (fb_div_selection == FPGA_FB_DIV_6) {
- if (vco_div_selection == FPGA_VCO_DIV_4)
- sys_per = PERIOD_50_00MHZ;
- if (vco_div_selection == FPGA_VCO_DIV_6)
- sys_per = PERIOD_33_33MHZ;
- }
- if (fb_div_selection == FPGA_FB_DIV_10) {
- if (vco_div_selection == FPGA_VCO_DIV_4)
- sys_per = PERIOD_83_33MHZ;
- if (vco_div_selection == FPGA_VCO_DIV_10)
- sys_per = PERIOD_33_33MHZ;
- }
- if (fb_div_selection == FPGA_FB_DIV_12) {
- if (vco_div_selection == FPGA_VCO_DIV_4)
- sys_per = PERIOD_100_00MHZ;
- if (vco_div_selection == FPGA_VCO_DIV_6)
- sys_per = PERIOD_66_66MHZ;
- if (vco_div_selection == FPGA_VCO_DIV_8)
- sys_per = PERIOD_50_00MHZ;
- }
- break;
- case PERIOD_50_00MHZ:
- if (fb_div_selection == FPGA_FB_DIV_6) {
- if (vco_div_selection == FPGA_VCO_DIV_4)
- sys_per = PERIOD_75_00MHZ;
- if (vco_div_selection == FPGA_VCO_DIV_6)
- sys_per = PERIOD_50_00MHZ;
- }
- if (fb_div_selection == FPGA_FB_DIV_10) {
- if (vco_div_selection == FPGA_VCO_DIV_6)
- sys_per = PERIOD_83_33MHZ;
- if (vco_div_selection == FPGA_VCO_DIV_10)
- sys_per = PERIOD_50_00MHZ;
- }
- if (fb_div_selection == FPGA_FB_DIV_12) {
- if (vco_div_selection == FPGA_VCO_DIV_6)
- sys_per = PERIOD_100_00MHZ;
- if (vco_div_selection == FPGA_VCO_DIV_8)
- sys_per = PERIOD_75_00MHZ;
- }
- break;
- case PERIOD_66_66MHZ:
- if (fb_div_selection == FPGA_FB_DIV_6) {
- if (vco_div_selection == FPGA_VCO_DIV_4)
- sys_per = PERIOD_100_00MHZ;
- if (vco_div_selection == FPGA_VCO_DIV_6)
- sys_per = PERIOD_66_66MHZ;
- if (vco_div_selection == FPGA_VCO_DIV_8)
- sys_per = PERIOD_50_00MHZ;
- }
- if (fb_div_selection == FPGA_FB_DIV_10) {
- if (vco_div_selection == FPGA_VCO_DIV_8)
- sys_per = PERIOD_83_33MHZ;
- if (vco_div_selection == FPGA_VCO_DIV_10)
- sys_per = PERIOD_66_66MHZ;
- }
- if (fb_div_selection == FPGA_FB_DIV_12) {
- if (vco_div_selection == FPGA_VCO_DIV_8)
- sys_per = PERIOD_100_00MHZ;
- }
- break;
- default:
- break;
- }
-
- if (sys_per == 0) {
- /* Other combinations are not supported */
- DEBUGF ("%s[%d] *** sys period compute failed ***\n", __FUNCTION__,__LINE__);
- hang();
- }
- } else {
- /* calcul system clock without cheking */
- /* if engineering option clock no check is selected */
- /* sys_per = master_clock_per * vco_div_selection / fb_div_selection */
- sys_per = (master_clock_per/fb_div_selection) * vco_div_selection;
- }
-
- return(sys_per);
-
-}
-
-/*-------------------------------------------------------------------------+
-| determine_pci_clock_per.
-+-------------------------------------------------------------------------*/
-unsigned long determine_pci_clock_per(void)
-{
- unsigned long pci_clock_selection, pci_period;
-
- /*-------------------------------------------------------------------------+
- | Read FPGA reg 6 to get PCI 0 FPGA reg information
- +-------------------------------------------------------------------------*/
- pci_clock_selection = in16(FPGA_REG16); /* was reg6 averifier */
-
-
- pci_clock_selection = pci_clock_selection & FPGA_REG16_PCI0_CLK_MASK;
-
- switch (pci_clock_selection) {
- case FPGA_REG16_PCI0_CLK_133_33:
- pci_period = PERIOD_133_33MHZ;
- break;
- case FPGA_REG16_PCI0_CLK_100:
- pci_period = PERIOD_100_00MHZ;
- break;
- case FPGA_REG16_PCI0_CLK_66_66:
- pci_period = PERIOD_66_66MHZ;
- break;
- default:
- pci_period = PERIOD_33_33MHZ;;
- break;
- }
-
- return(pci_period);
-}
-#endif
-
-ulong get_OPB_freq (void)
-{
-
- sys_info_t sys_info;
- get_sys_info (&sys_info);
- return sys_info.freqOPB;
-}
-
-#elif defined(CONFIG_XILINX_ML300)
-extern void get_sys_info (sys_info_t * sysInfo);
-extern ulong get_PCI_freq (void);
-
-#elif defined(CONFIG_AP1000)
-void get_sys_info (sys_info_t * sysInfo) {
- sysInfo->freqProcessor = 240 * 1000 * 1000;
- sysInfo->freqPLB = 80 * 1000 * 1000;
- sysInfo->freqPCI = 33 * 1000 * 1000;
-}
-
-#elif defined(CONFIG_405)
-
-void get_sys_info (sys_info_t * sysInfo) {
-
- sysInfo->freqVCOMhz=3125000;
- sysInfo->freqProcessor=12*1000*1000;
- sysInfo->freqPLB=50*1000*1000;
- sysInfo->freqPCI=66*1000*1000;
-
-}
-
-#elif defined(CONFIG_405EP)
-void get_sys_info (PPC405_SYS_INFO * sysInfo)
-{
- unsigned long pllmr0;
- unsigned long pllmr1;
- unsigned long sysClkPeriodPs = ONE_BILLION / (CONFIG_SYS_CLK_FREQ / 1000);
- unsigned long m;
- unsigned long pllmr0_ccdv;
-
- /*
- * Read PLL Mode registers
- */
- pllmr0 = mfdcr (cpc0_pllmr0);
- pllmr1 = mfdcr (cpc0_pllmr1);
-
- /*
- * Determine forward divider A
- */
- sysInfo->pllFwdDiv = 8 - ((pllmr1 & PLLMR1_FWDVA_MASK) >> 16);
-
- /*
- * Determine forward divider B (should be equal to A)
- */
- sysInfo->pllFwdDivB = 8 - ((pllmr1 & PLLMR1_FWDVB_MASK) >> 12);
-
- /*
- * Determine FBK_DIV.
- */
- sysInfo->pllFbkDiv = ((pllmr1 & PLLMR1_FBMUL_MASK) >> 20);
- if (sysInfo->pllFbkDiv == 0) {
- sysInfo->pllFbkDiv = 16;
- }
-
- /*
- * Determine PLB_DIV.
- */
- sysInfo->pllPlbDiv = ((pllmr0 & PLLMR0_CPU_TO_PLB_MASK) >> 16) + 1;
-
- /*
- * Determine PCI_DIV.
- */
- sysInfo->pllPciDiv = (pllmr0 & PLLMR0_PCI_TO_PLB_MASK) + 1;
-
- /*
- * Determine EXTBUS_DIV.
- */
- sysInfo->pllExtBusDiv = ((pllmr0 & PLLMR0_EXB_TO_PLB_MASK) >> 8) + 2;
-
- /*
- * Determine OPB_DIV.
- */
- sysInfo->pllOpbDiv = ((pllmr0 & PLLMR0_OPB_TO_PLB_MASK) >> 12) + 1;
-
- /*
- * Determine the M factor
- */
- m = sysInfo->pllFbkDiv * sysInfo->pllFwdDivB;
-
- /*
- * Determine VCO clock frequency
- */
- sysInfo->freqVCOHz = (1000000000000LL * (unsigned long long)m) /
- (unsigned long long)sysClkPeriodPs;
-
- /*
- * Determine CPU clock frequency
- */
- pllmr0_ccdv = ((pllmr0 & PLLMR0_CPU_DIV_MASK) >> 20) + 1;
- if (pllmr1 & PLLMR1_SSCS_MASK) {
- /*
- * This is true if FWDVA == FWDVB:
- * sysInfo->freqProcessor = (CONFIG_SYS_CLK_FREQ * sysInfo->pllFbkDiv)
- * / pllmr0_ccdv;
- */
- sysInfo->freqProcessor = (CONFIG_SYS_CLK_FREQ * sysInfo->pllFbkDiv * sysInfo->pllFwdDivB)
- / sysInfo->pllFwdDiv / pllmr0_ccdv;
- } else {
- sysInfo->freqProcessor = CONFIG_SYS_CLK_FREQ / pllmr0_ccdv;
- }
-
- /*
- * Determine PLB clock frequency
- */
- sysInfo->freqPLB = sysInfo->freqProcessor / sysInfo->pllPlbDiv;
-}
-
-
-/********************************************
- * get_OPB_freq
- * return OPB bus freq in Hz
- *********************************************/
-ulong get_OPB_freq (void)
-{
- ulong val = 0;
-
- PPC405_SYS_INFO sys_info;
-
- get_sys_info (&sys_info);
- val = sys_info.freqPLB / sys_info.pllOpbDiv;
-
- return val;
-}
-
-
-/********************************************
- * get_PCI_freq
- * return PCI bus freq in Hz
- *********************************************/
-ulong get_PCI_freq (void)
-{
- ulong val;
- PPC405_SYS_INFO sys_info;
-
- get_sys_info (&sys_info);
- val = sys_info.freqPLB / sys_info.pllPciDiv;
- return val;
-}
-
-#endif
-
-int get_clocks (void)
-{
-#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) || defined(CONFIG_405) || defined(CONFIG_405EP)
- sys_info_t sys_info;
-
- get_sys_info (&sys_info);
- gd->cpu_clk = sys_info.freqProcessor;
- gd->bus_clk = sys_info.freqPLB;
-
-#endif /* defined(CONFIG_405GP) || defined(CONFIG_405CR) */
-
-#ifdef CONFIG_IOP480
- gd->cpu_clk = 66000000;
- gd->bus_clk = 66000000;
-#endif
- return (0);
-}
-
-
-/********************************************
- * get_bus_freq
- * return PLB bus freq in Hz
- *********************************************/
-ulong get_bus_freq (ulong dummy)
-{
- ulong val;
-
-#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_405) || defined(CONFIG_440) || defined(CONFIG_405EP)
- sys_info_t sys_info;
-
- get_sys_info (&sys_info);
- val = sys_info.freqPLB;
-
-#elif defined(CONFIG_IOP480)
-
- val = 66;
-
-#else
-# error get_bus_freq() not implemented
-#endif
-
- return val;
-}
diff --git a/cpu/ppc4xx/start.S b/cpu/ppc4xx/start.S
deleted file mode 100644
index 2bc36a0b55..0000000000
--- a/cpu/ppc4xx/start.S
+++ /dev/null
@@ -1,1835 +0,0 @@
-/*
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2000,2001,2002 Wolfgang Denk <wd@denx.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-/*------------------------------------------------------------------------------+ */
-/* */
-/* This source code has been made available to you by IBM on an AS-IS */
-/* basis. Anyone receiving this source is licensed under IBM */
-/* copyrights to use it in any way he or she deems fit, including */
-/* copying it, modifying it, compiling it, and redistributing it either */
-/* with or without modifications. No license under IBM patents or */
-/* patent applications is to be implied by the copyright license. */
-/* */
-/* Any user of this software should understand that IBM cannot provide */
-/* technical support for this software and will not be responsible for */
-/* any consequences resulting from the use of this software. */
-/* */
-/* Any person who transfers this source code or any derivative work */
-/* must include the IBM copyright notice, this paragraph, and the */
-/* preceding two paragraphs in the transferred software. */
-/* */
-/* COPYRIGHT I B M CORPORATION 1995 */
-/* LICENSED MATERIAL - PROGRAM PROPERTY OF I B M */
-/*------------------------------------------------------------------------------- */
-
-/* U-Boot - Startup Code for AMCC 4xx PowerPC based Embedded Boards
- *
- *
- * The processor starts at 0xfffffffc and the code is executed
- * from flash/rom.
- * in memory, but as long we don't jump around before relocating.
- * board_init lies at a quite high address and when the cpu has
- * jumped there, everything is ok.
- * This works because the cpu gives the FLASH (CS0) the whole
- * address space at startup, and board_init lies as a echo of
- * the flash somewhere up there in the memorymap.
- *
- * board_init will change CS0 to be positioned at the correct
- * address and (s)dram will be positioned at address 0
- */
-#include <config.h>
-#include <mpc8xx.h>
-#include <ppc4xx.h>
-#include <version.h>
-
-#include <ppc_asm.tmpl>
-#include <ppc_defs.h>
-
-#include <asm/cache.h>
-#include <asm/mmu.h>
-
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-#ifdef CFG_INIT_DCACHE_CS
-# if (CFG_INIT_DCACHE_CS == 0)
-# define PBxAP pb0ap
-# define PBxCR pb0cr
-# endif
-# if (CFG_INIT_DCACHE_CS == 1)
-# define PBxAP pb1ap
-# define PBxCR pb1cr
-# endif
-# if (CFG_INIT_DCACHE_CS == 2)
-# define PBxAP pb2ap
-# define PBxCR pb2cr
-# endif
-# if (CFG_INIT_DCACHE_CS == 3)
-# define PBxAP pb3ap
-# define PBxCR pb3cr
-# endif
-# if (CFG_INIT_DCACHE_CS == 4)
-# define PBxAP pb4ap
-# define PBxCR pb4cr
-# endif
-# if (CFG_INIT_DCACHE_CS == 5)
-# define PBxAP pb5ap
-# define PBxCR pb5cr
-# endif
-# if (CFG_INIT_DCACHE_CS == 6)
-# define PBxAP pb6ap
-# define PBxCR pb6cr
-# endif
-# if (CFG_INIT_DCACHE_CS == 7)
-# define PBxAP pb7ap
-# define PBxCR pb7cr
-# endif
-#endif /* CFG_INIT_DCACHE_CS */
-
-/* We don't want the MMU yet.
-*/
-#undef MSR_KERNEL
-#define MSR_KERNEL ( MSR_ME ) /* Machine Check */
-
-
- .extern ext_bus_cntlr_init
- .extern sdram_init
-#ifdef CONFIG_NAND_U_BOOT
- .extern reconfig_tlb0
-#endif
-
-/*
- * Set up GOT: Global Offset Table
- *
- * Use r14 to access the GOT
- */
-#if !defined(CONFIG_NAND_SPL)
- START_GOT
- GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_FIXUP_TABLE_)
-
- GOT_ENTRY(_start)
- GOT_ENTRY(_start_of_vectors)
- GOT_ENTRY(_end_of_vectors)
- GOT_ENTRY(transfer_to_handler)
-
- GOT_ENTRY(__init_end)
- GOT_ENTRY(_end)
- GOT_ENTRY(__bss_start)
- END_GOT
-#endif /* CONFIG_NAND_SPL */
-
-#if defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
- /*
- * NAND U-Boot image is started from offset 0
- */
- .text
- bl reconfig_tlb0
- GET_GOT
- bl cpu_init_f /* run low-level CPU init code (from Flash) */
- bl board_init_f
-#endif
-
-/*
- * 440 Startup -- on reset only the top 4k of the effective
- * address space is mapped in by an entry in the instruction
- * and data shadow TLB. The .bootpg section is located in the
- * top 4k & does only what's necessary to map in the the rest
- * of the boot rom. Once the boot rom is mapped in we can
- * proceed with normal startup.
- *
- * NOTE: CS0 only covers the top 2MB of the effective address
- * space after reset.
- */
-
-#if defined(CONFIG_440)
-#if !defined(CONFIG_NAND_SPL)
- .section .bootpg,"ax"
-#endif
- .globl _start_440
-
-/**************************************************************************/
-_start_440:
- /*--------------------------------------------------------------------+
- | 440EPX BUP Change - Hardware team request
- +--------------------------------------------------------------------*/
-#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
- sync
- nop
- nop
-#endif
- /*----------------------------------------------------------------+
- | Core bug fix. Clear the esr
- +-----------------------------------------------------------------*/
- li r0,0
- mtspr esr,r0
- /*----------------------------------------------------------------*/
- /* Clear and set up some registers. */
- /*----------------------------------------------------------------*/
- iccci r0,r0 /* NOTE: operands not used for 440 */
- dccci r0,r0 /* NOTE: operands not used for 440 */
- sync
- li r0,0
- mtspr srr0,r0
- mtspr srr1,r0
- mtspr csrr0,r0
- mtspr csrr1,r0
- /* NOTE: 440GX adds machine check status regs */
-#if defined(CONFIG_440) && !defined(CONFIG_440GP)
- mtspr mcsrr0,r0
- mtspr mcsrr1,r0
- mfspr r1,mcsr
- mtspr mcsr,r1
-#endif
-
- /*----------------------------------------------------------------*/
- /* CCR0 init */
- /*----------------------------------------------------------------*/
- /* Disable store gathering & broadcast, guarantee inst/data
- * cache block touch, force load/store alignment
- * (see errata 1.12: 440_33)
- */
- lis r1,0x0030 /* store gathering & broadcast disable */
- ori r1,r1,0x6000 /* cache touch */
- mtspr ccr0,r1
-
- /*----------------------------------------------------------------*/
- /* Initialize debug */
- /*----------------------------------------------------------------*/
- mfspr r1,dbcr0
- andis. r1, r1, 0x8000 /* test DBCR0[EDM] bit */
- bne skip_debug_init /* if set, don't clear debug register */
- mtspr dbcr0,r0
- mtspr dbcr1,r0
- mtspr dbcr2,r0
- mtspr iac1,r0
- mtspr iac2,r0
- mtspr iac3,r0
- mtspr dac1,r0
- mtspr dac2,r0
- mtspr dvc1,r0
- mtspr dvc2,r0
-
- mfspr r1,dbsr
- mtspr dbsr,r1 /* Clear all valid bits */
-skip_debug_init:
-
-#if defined (CONFIG_440SPE)
- /*----------------------------------------------------------------+
- | Initialize Core Configuration Reg1.
- | a. ICDPEI: Record even parity. Normal operation.
- | b. ICTPEI: Record even parity. Normal operation.
- | c. DCTPEI: Record even parity. Normal operation.
- | d. DCDPEI: Record even parity. Normal operation.
- | e. DCUPEI: Record even parity. Normal operation.
- | f. DCMPEI: Record even parity. Normal operation.
- | g. FCOM: Normal operation
- | h. MMUPEI: Record even parity. Normal operation.
- | i. FFF: Flush only as much data as necessary.
- | j. TCS: Timebase increments from CPU clock.
- +-----------------------------------------------------------------*/
- li r0,0
- mtspr ccr1, r0
-
- /*----------------------------------------------------------------+
- | Reset the timebase.
- | The previous write to CCR1 sets the timebase source.
- +-----------------------------------------------------------------*/
- mtspr tbl, r0
- mtspr tbu, r0
-#endif
-
- /*----------------------------------------------------------------*/
- /* Setup interrupt vectors */
- /*----------------------------------------------------------------*/
- mtspr ivpr,r0 /* Vectors start at 0x0000_0000 */
- li r1,0x0100
- mtspr ivor0,r1 /* Critical input */
- li r1,0x0200
- mtspr ivor1,r1 /* Machine check */
- li r1,0x0300
- mtspr ivor2,r1 /* Data storage */
- li r1,0x0400
- mtspr ivor3,r1 /* Instruction storage */
- li r1,0x0500
- mtspr ivor4,r1 /* External interrupt */
- li r1,0x0600
- mtspr ivor5,r1 /* Alignment */
- li r1,0x0700
- mtspr ivor6,r1 /* Program check */
- li r1,0x0800
- mtspr ivor7,r1 /* Floating point unavailable */
- li r1,0x0c00
- mtspr ivor8,r1 /* System call */
- li r1,0x1000
- mtspr ivor10,r1 /* Decrementer (PIT for 440) */
- li r1,0x1400
- mtspr ivor13,r1 /* Data TLB error */
- li r1,0x1300
- mtspr ivor14,r1 /* Instr TLB error */
- li r1,0x2000
- mtspr ivor15,r1 /* Debug */
-
- /*----------------------------------------------------------------*/
- /* Configure cache regions */
- /*----------------------------------------------------------------*/
- mtspr inv0,r0
- mtspr inv1,r0
- mtspr inv2,r0
- mtspr inv3,r0
- mtspr dnv0,r0
- mtspr dnv1,r0
- mtspr dnv2,r0
- mtspr dnv3,r0
- mtspr itv0,r0
- mtspr itv1,r0
- mtspr itv2,r0
- mtspr itv3,r0
- mtspr dtv0,r0
- mtspr dtv1,r0
- mtspr dtv2,r0
- mtspr dtv3,r0
-
- /*----------------------------------------------------------------*/
- /* Cache victim limits */
- /*----------------------------------------------------------------*/
- /* floors 0, ceiling max to use the entire cache -- nothing locked
- */
- lis r1,0x0001
- ori r1,r1,0xf800
- mtspr ivlim,r1
- mtspr dvlim,r1
-
- /*----------------------------------------------------------------+
- |Initialize MMUCR[STID] = 0.
- +-----------------------------------------------------------------*/
- mfspr r0,mmucr
- addis r1,0,0xFFFF
- ori r1,r1,0xFF00
- and r0,r0,r1
- mtspr mmucr,r0
-
- /*----------------------------------------------------------------*/
- /* Clear all TLB entries -- TID = 0, TS = 0 */
- /*----------------------------------------------------------------*/
- addis r0,0,0x0000
- li r1,0x003f /* 64 TLB entries */
- mtctr r1
-rsttlb: tlbwe r0,r1,0x0000 /* Invalidate all entries (V=0)*/
- tlbwe r0,r1,0x0001
- tlbwe r0,r1,0x0002
- subi r1,r1,0x0001
- bdnz rsttlb
-
- /*----------------------------------------------------------------*/
- /* TLB entry setup -- step thru tlbtab */
- /*----------------------------------------------------------------*/
-#if defined(CONFIG_440SPE)
- /*----------------------------------------------------------------*/
- /* We have different TLB tables for revA and rev B of 440SPe */
- /*----------------------------------------------------------------*/
- mfspr r1, PVR
- lis r0,0x5342
- ori r0,r0,0x1891
- cmpw r7,r1,r0
- bne r7,..revA
- bl tlbtabB
- b ..goon
-..revA:
- bl tlbtabA
-..goon:
-#else
- bl tlbtab /* Get tlbtab pointer */
-#endif
- mr r5,r0
- li r1,0x003f /* 64 TLB entries max */
- mtctr r1
- li r4,0 /* TLB # */
-
- addi r5,r5,-4
-1: lwzu r0,4(r5)
- cmpwi r0,0
- beq 2f /* 0 marks end */
- lwzu r1,4(r5)
- lwzu r2,4(r5)
- tlbwe r0,r4,0 /* TLB Word 0 */
- tlbwe r1,r4,1 /* TLB Word 1 */
- tlbwe r2,r4,2 /* TLB Word 2 */
- addi r4,r4,1 /* Next TLB */
- bdnz 1b
-
- /*----------------------------------------------------------------*/
- /* Continue from 'normal' start */
- /*----------------------------------------------------------------*/
-2:
-
-#if defined(CONFIG_NAND_SPL)
- /*
- * Enable internal SRAM
- */
- lis r2,0x7fff
- ori r2,r2,0xffff
- mfdcr r1,isram0_dpc
- and r1,r1,r2 /* Disable parity check */
- mtdcr isram0_dpc,r1
- mfdcr r1,isram0_pmeg
- and r1,r1,r2 /* Disable pwr mgmt */
- mtdcr isram0_pmeg,r1
-
- /*
- * Copy SPL from cache into internal SRAM
- */
- li r4,(CFG_NAND_BOOT_SPL_SIZE >> 2) - 1
- mtctr r4
- lis r2,CFG_NAND_BOOT_SPL_SRC@h
- ori r2,r2,CFG_NAND_BOOT_SPL_SRC@l
- lis r3,CFG_NAND_BOOT_SPL_DST@h
- ori r3,r3,CFG_NAND_BOOT_SPL_DST@l
-spl_loop:
- lwzu r4,4(r2)
- stwu r4,4(r3)
- bdnz spl_loop
-
- /*
- * Jump to code in RAM
- */
- bl 00f
-00: mflr r10
- lis r3,(CFG_NAND_BOOT_SPL_SRC - CFG_NAND_BOOT_SPL_DST)@h
- ori r3,r3,(CFG_NAND_BOOT_SPL_SRC - CFG_NAND_BOOT_SPL_DST)@l
- sub r10,r10,r3
- addi r10,r10,28
- mtlr r10
- blr
-
-start_ram:
- sync
- isync
-#endif
-
- bl 3f
- b _start
-
-3: li r0,0
- mtspr srr1,r0 /* Keep things disabled for now */
- mflr r1
- mtspr srr0,r1
- rfi
-#endif /* CONFIG_440 */
-
-/*
- * r3 - 1st arg to board_init(): IMMP pointer
- * r4 - 2nd arg to board_init(): boot flag
- */
-#ifndef CONFIG_NAND_SPL
- .text
- .long 0x27051956 /* U-Boot Magic Number */
- .globl version_string
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
-
-/*
- * Maybe this should be moved somewhere else because the current
- * location (0x100) is where the CriticalInput Execption should be.
- */
- . = EXC_OFF_SYS_RESET
-#endif
- .globl _start
-_start:
-
-/*****************************************************************************/
-#if defined(CONFIG_440)
-
- /*----------------------------------------------------------------*/
- /* Clear and set up some registers. */
- /*----------------------------------------------------------------*/
- li r0,0x0000
- lis r1,0xffff
- mtspr dec,r0 /* prevent dec exceptions */
- mtspr tbl,r0 /* prevent fit & wdt exceptions */
- mtspr tbu,r0
- mtspr tsr,r1 /* clear all timer exception status */
- mtspr tcr,r0 /* disable all */
- mtspr esr,r0 /* clear exception syndrome register */
- mtxer r0 /* clear integer exception register */
-
- /*----------------------------------------------------------------*/
- /* Debug setup -- some (not very good) ice's need an event*/
- /* to establish control :-( Define CFG_INIT_DBCR to the dbsr */
- /* value you need in this case 0x8cff 0000 should do the trick */
- /*----------------------------------------------------------------*/
-#if defined(CFG_INIT_DBCR)
- lis r1,0xffff
- ori r1,r1,0xffff
- mtspr dbsr,r1 /* Clear all status bits */
- lis r0,CFG_INIT_DBCR@h
- ori r0,r0,CFG_INIT_DBCR@l
- mtspr dbcr0,r0
- isync
-#endif
-
- /*----------------------------------------------------------------*/
- /* Setup the internal SRAM */
- /*----------------------------------------------------------------*/
- li r0,0
-
-#ifdef CFG_INIT_RAM_DCACHE
- /* Clear Dcache to use as RAM */
- addis r3,r0,CFG_INIT_RAM_ADDR@h
- ori r3,r3,CFG_INIT_RAM_ADDR@l
- addis r4,r0,CFG_INIT_RAM_END@h
- ori r4,r4,CFG_INIT_RAM_END@l
- rlwinm. r5,r4,0,27,31
- rlwinm r5,r4,27,5,31
- beq ..d_ran
- addi r5,r5,0x0001
-..d_ran:
- mtctr r5
-..d_ag:
- dcbz r0,r3
- addi r3,r3,32
- bdnz ..d_ag
-#endif /* CFG_INIT_RAM_DCACHE */
-
- /* 440EP & 440GR are only 440er PPC's without internal SRAM */
-#if !defined(CONFIG_440EP) && !defined(CONFIG_440GR)
- /* not all PPC's have internal SRAM usable as L2-cache */
-#if defined(CONFIG_440GX) || defined(CONFIG_440SP) || defined(CONFIG_440SPE)
- mtdcr l2_cache_cfg,r0 /* Ensure L2 Cache is off */
-#endif
-
- lis r2,0x7fff
- ori r2,r2,0xffff
- mfdcr r1,isram0_dpc
- and r1,r1,r2 /* Disable parity check */
- mtdcr isram0_dpc,r1
- mfdcr r1,isram0_pmeg
- and r1,r1,r2 /* Disable pwr mgmt */
- mtdcr isram0_pmeg,r1
-
- lis r1,0x8000 /* BAS = 8000_0000 */
-#if defined(CONFIG_440GX) || defined(CONFIG_440SP)
- ori r1,r1,0x0980 /* first 64k */
- mtdcr isram0_sb0cr,r1
- lis r1,0x8001
- ori r1,r1,0x0980 /* second 64k */
- mtdcr isram0_sb1cr,r1
- lis r1, 0x8002
- ori r1,r1, 0x0980 /* third 64k */
- mtdcr isram0_sb2cr,r1
- lis r1, 0x8003
- ori r1,r1, 0x0980 /* fourth 64k */
- mtdcr isram0_sb3cr,r1
-#elif defined(CONFIG_440SPE)
- lis r1,0x0000 /* BAS = 0000_0000 */
- ori r1,r1,0x0984 /* first 64k */
- mtdcr isram0_sb0cr,r1
- lis r1,0x0001
- ori r1,r1,0x0984 /* second 64k */
- mtdcr isram0_sb1cr,r1
- lis r1, 0x0002
- ori r1,r1, 0x0984 /* third 64k */
- mtdcr isram0_sb2cr,r1
- lis r1, 0x0003
- ori r1,r1, 0x0984 /* fourth 64k */
- mtdcr isram0_sb3cr,r1
-#elif defined(CONFIG_440GP)
- ori r1,r1,0x0380 /* 8k rw */
- mtdcr isram0_sb0cr,r1
- mtdcr isram0_sb1cr,r0 /* Disable bank 1 */
-#endif
-#endif /* #if !defined(CONFIG_440EP) && !defined(CONFIG_440GR) */
-
- /*----------------------------------------------------------------*/
- /* Setup the stack in internal SRAM */
- /*----------------------------------------------------------------*/
- lis r1,CFG_INIT_RAM_ADDR@h
- ori r1,r1,CFG_INIT_SP_OFFSET@l
- li r0,0
- stwu r0,-4(r1)
- stwu r0,-4(r1) /* Terminate call chain */
-
- stwu r1,-8(r1) /* Save back chain and move SP */
- lis r0,RESET_VECTOR@h /* Address of reset vector */
- ori r0,r0, RESET_VECTOR@l
- stwu r1,-8(r1) /* Save back chain and move SP */
- stw r0,+12(r1) /* Save return addr (underflow vect) */
-
-#ifdef CONFIG_NAND_SPL
- bl nand_boot /* will not return */
-#else
- GET_GOT
-
- bl cpu_init_f /* run low-level CPU init code (from Flash) */
- bl board_init_f
-#endif
-
-#endif /* CONFIG_440 */
-
-/*****************************************************************************/
-#ifdef CONFIG_IOP480
- /*----------------------------------------------------------------------- */
- /* Set up some machine state registers. */
- /*----------------------------------------------------------------------- */
- addi r0,r0,0x0000 /* initialize r0 to zero */
- mtspr esr,r0 /* clear Exception Syndrome Reg */
- mttcr r0 /* timer control register */
- mtexier r0 /* disable all interrupts */
- addis r4,r0,0xFFFF /* set r4 to 0xFFFFFFFF (status in the */
- ori r4,r4,0xFFFF /* dbsr is cleared by setting bits to 1) */
- mtdbsr r4 /* clear/reset the dbsr */
- mtexisr r4 /* clear all pending interrupts */
- addis r4,r0,0x8000
- mtexier r4 /* enable critical exceptions */
- addis r4,r0,0x0000 /* assume 403GCX - enable core clk */
- ori r4,r4,0x4020 /* dbling (no harm done on GA and GC */
- mtiocr r4 /* since bit not used) & DRC to latch */
- /* data bus on rising edge of CAS */
- /*----------------------------------------------------------------------- */
- /* Clear XER. */
- /*----------------------------------------------------------------------- */
- mtxer r0
- /*----------------------------------------------------------------------- */
- /* Invalidate i-cache and d-cache TAG arrays. */
- /*----------------------------------------------------------------------- */
- addi r3,0,1024 /* 1/4 of I-cache size, half of D-cache */
- addi r4,0,1024 /* 1/4 of I-cache */
-..cloop:
- iccci 0,r3
- iccci r4,r3
- dccci 0,r3
- addic. r3,r3,-16 /* move back one cache line */
- bne ..cloop /* loop back to do rest until r3 = 0 */
-
- /* */
- /* initialize IOP480 so it can read 1 MB code area for SRAM spaces */
- /* this requires enabling MA[17..0], by default only MA[12..0] are enabled. */
- /* */
-
- /* first copy IOP480 register base address into r3 */
- addis r3,0,0x5000 /* IOP480 register base address hi */
-/* ori r3,r3,0x0000 / IOP480 register base address lo */
-
-#ifdef CONFIG_ADCIOP
- /* use r4 as the working variable */
- /* turn on CS3 (LOCCTL.7) */
- lwz r4,0x84(r3) /* LOCTL is at offset 0x84 */
- andi. r4,r4,0xff7f /* make bit 7 = 0 -- CS3 mode */
- stw r4,0x84(r3) /* LOCTL is at offset 0x84 */
-#endif
-
-#ifdef CONFIG_DASA_SIM
- /* use r4 as the working variable */
- /* turn on MA17 (LOCCTL.7) */
- lwz r4,0x84(r3) /* LOCTL is at offset 0x84 */
- ori r4,r4,0x80 /* make bit 7 = 1 -- MA17 mode */
- stw r4,0x84(r3) /* LOCTL is at offset 0x84 */
-#endif
-
- /* turn on MA16..13 (LCS0BRD.12 = 0) */
- lwz r4,0x100(r3) /* LCS0BRD is at offset 0x100 */
- andi. r4,r4,0xefff /* make bit 12 = 0 */
- stw r4,0x100(r3) /* LCS0BRD is at offset 0x100 */
-
- /* make sure above stores all comlete before going on */
- sync
-
- /* last thing, set local init status done bit (DEVINIT.31) */
- lwz r4,0x80(r3) /* DEVINIT is at offset 0x80 */
- oris r4,r4,0x8000 /* make bit 31 = 1 */
- stw r4,0x80(r3) /* DEVINIT is at offset 0x80 */
-
- /* clear all pending interrupts and disable all interrupts */
- li r4,-1 /* set p1 to 0xffffffff */
- stw r4,0x1b0(r3) /* clear all pending interrupts */
- stw r4,0x1b8(r3) /* clear all pending interrupts */
- li r4,0 /* set r4 to 0 */
- stw r4,0x1b4(r3) /* disable all interrupts */
- stw r4,0x1bc(r3) /* disable all interrupts */
-
- /* make sure above stores all comlete before going on */
- sync
-
- /*----------------------------------------------------------------------- */
- /* Enable two 128MB cachable regions. */
- /*----------------------------------------------------------------------- */
- addis r1,r0,0x8000
- addi r1,r1,0x0001
- mticcr r1 /* instruction cache */
-
- addis r1,r0,0x0000
- addi r1,r1,0x0000
- mtdccr r1 /* data cache */
-
- addis r1,r0,CFG_INIT_RAM_ADDR@h
- ori r1,r1,CFG_INIT_SP_OFFSET /* set up the stack to SDRAM */
- li r0, 0 /* Make room for stack frame header and */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
-
- GET_GOT /* initialize GOT access */
-
- bl board_init_f /* run first part of init code (from Flash) */
-
-#endif /* CONFIG_IOP480 */
-
-/*****************************************************************************/
-#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_405) || defined(CONFIG_405EP)
- /*----------------------------------------------------------------------- */
- /* Clear and set up some registers. */
- /*----------------------------------------------------------------------- */
- addi r4,r0,0x0000
- mtspr sgr,r4
- mtspr dcwr,r4
- mtesr r4 /* clear Exception Syndrome Reg */
- mttcr r4 /* clear Timer Control Reg */
- mtxer r4 /* clear Fixed-Point Exception Reg */
- mtevpr r4 /* clear Exception Vector Prefix Reg */
- addi r4,r0,(0xFFFF-0x10000) /* set r4 to 0xFFFFFFFF (status in the */
- /* dbsr is cleared by setting bits to 1) */
- mtdbsr r4 /* clear/reset the dbsr */
-
- /*----------------------------------------------------------------------- */
- /* Invalidate I and D caches. Enable I cache for defined memory regions */
- /* to speed things up. Leave the D cache disabled for now. It will be */
- /* enabled/left disabled later based on user selected menu options. */
- /* Be aware that the I cache may be disabled later based on the menu */
- /* options as well. See miscLib/main.c. */
- /*----------------------------------------------------------------------- */
- bl invalidate_icache
- bl invalidate_dcache
-
- /*----------------------------------------------------------------------- */
- /* Enable two 128MB cachable regions. */
- /*----------------------------------------------------------------------- */
- addis r4,r0,0x8000
- addi r4,r4,0x0001
- mticcr r4 /* instruction cache */
- isync
-
- addis r4,r0,0x0000
- addi r4,r4,0x0000
- mtdccr r4 /* data cache */
-
-#if !(defined(CFG_EBC_PB0AP) && defined(CFG_EBC_PB0CR))
- /*----------------------------------------------------------------------- */
- /* Tune the speed and size for flash CS0 */
- /*----------------------------------------------------------------------- */
- bl ext_bus_cntlr_init
-#endif
-
-#if defined(CONFIG_405EP)
- /*----------------------------------------------------------------------- */
- /* DMA Status, clear to come up clean */
- /*----------------------------------------------------------------------- */
- addis r3,r0, 0xFFFF /* Clear all existing DMA status */
- ori r3,r3, 0xFFFF
- mtdcr dmasr, r3
-
- bl ppc405ep_init /* do ppc405ep specific init */
-#endif /* CONFIG_405EP */
-
-#if defined(CFG_OCM_DATA_ADDR) && defined(CFG_OCM_DATA_SIZE)
- /********************************************************************
- * Setup OCM - On Chip Memory
- *******************************************************************/
- /* Setup OCM */
- lis r0, 0x7FFF
- ori r0, r0, 0xFFFF
- mfdcr r3, ocmiscntl /* get instr-side IRAM config */
- mfdcr r4, ocmdscntl /* get data-side IRAM config */
- and r3, r3, r0 /* disable data-side IRAM */
- and r4, r4, r0 /* disable data-side IRAM */
- mtdcr ocmiscntl, r3 /* set instr-side IRAM config */
- mtdcr ocmdscntl, r4 /* set data-side IRAM config */
- isync
-
- addis r3, 0, CFG_OCM_DATA_ADDR@h /* OCM location */
- mtdcr ocmdsarc, r3
- addis r4, 0, 0xC000 /* OCM data area enabled */
- mtdcr ocmdscntl, r4
- isync
-#endif
-
- /*----------------------------------------------------------------------- */
- /* Setup temporary stack in DCACHE or OCM if needed for SDRAM SPD. */
- /*----------------------------------------------------------------------- */
-#ifdef CFG_INIT_DCACHE_CS
- /*----------------------------------------------------------------------- */
- /* Memory Bank x (nothingness) initialization 1GB+64MEG */
- /* used as temporary stack pointer for stage0 */
- /*----------------------------------------------------------------------- */
- li r4,PBxAP
- mtdcr ebccfga,r4
- lis r4,0x0380
- ori r4,r4,0x0480
- mtdcr ebccfgd,r4
-
- addi r4,0,PBxCR
- mtdcr ebccfga,r4
- lis r4,0x400D
- ori r4,r4,0xa000
- mtdcr ebccfgd,r4
-
- /* turn on data chache for this region */
- lis r4,0x0080
- mtdccr r4
-
- /* set stack pointer and clear stack to known value */
-
- lis r1,CFG_INIT_RAM_ADDR@h
- ori r1,r1,CFG_INIT_SP_OFFSET@l
-
- li r4,2048 /* we store 2048 words to stack */
- mtctr r4
-
- lis r2,CFG_INIT_RAM_ADDR@h /* we also clear data area */
- ori r2,r2,CFG_INIT_RAM_END@l /* so cant copy value from r1 */
-
- lis r4,0xdead /* we store 0xdeaddead in the stack */
- ori r4,r4,0xdead
-
-..stackloop:
- stwu r4,-4(r2)
- bdnz ..stackloop
-
- li r0, 0 /* Make room for stack frame header and */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
- /*
- * Set up a dummy frame to store reset vector as return address.
- * this causes stack underflow to reset board.
- */
- stwu r1, -8(r1) /* Save back chain and move SP */
- addis r0, 0, RESET_VECTOR@h /* Address of reset vector */
- ori r0, r0, RESET_VECTOR@l
- stwu r1, -8(r1) /* Save back chain and move SP */
- stw r0, +12(r1) /* Save return addr (underflow vect) */
-
-#elif defined(CFG_TEMP_STACK_OCM) && \
- (defined(CFG_OCM_DATA_ADDR) && defined(CFG_OCM_DATA_SIZE))
- /*
- * Stack in OCM.
- */
-
- /* Set up Stack at top of OCM */
- lis r1, (CFG_INIT_RAM_ADDR + CFG_INIT_SP_OFFSET)@h
- ori r1, r1, (CFG_INIT_RAM_ADDR + CFG_INIT_SP_OFFSET)@l
-
- /* Set up a zeroized stack frame so that backtrace works right */
- li r0, 0
- stwu r0, -4(r1)
- stwu r0, -4(r1)
-
- /*
- * Set up a dummy frame to store reset vector as return address.
- * this causes stack underflow to reset board.
- */
- stwu r1, -8(r1) /* Save back chain and move SP */
- lis r0, RESET_VECTOR@h /* Address of reset vector */
- ori r0, r0, RESET_VECTOR@l
- stwu r1, -8(r1) /* Save back chain and move SP */
- stw r0, +12(r1) /* Save return addr (underflow vect) */
-#endif /* CFG_INIT_DCACHE_CS */
-
- /*----------------------------------------------------------------------- */
- /* Initialize SDRAM Controller */
- /*----------------------------------------------------------------------- */
- bl sdram_init
-
- /*
- * Setup temporary stack pointer only for boards
- * that do not use SDRAM SPD I2C stuff since it
- * is already initialized to use DCACHE or OCM
- * stacks.
- */
-#if !(defined(CFG_INIT_DCACHE_CS) || defined(CFG_TEMP_STACK_OCM))
- lis r1, CFG_INIT_RAM_ADDR@h
- ori r1,r1,CFG_INIT_SP_OFFSET /* set up the stack in SDRAM */
-
- li r0, 0 /* Make room for stack frame header and */
- stwu r0, -4(r1) /* clear final stack frame so that */
- stwu r0, -4(r1) /* stack backtraces terminate cleanly */
- /*
- * Set up a dummy frame to store reset vector as return address.
- * this causes stack underflow to reset board.
- */
- stwu r1, -8(r1) /* Save back chain and move SP */
- lis r0, RESET_VECTOR@h /* Address of reset vector */
- ori r0, r0, RESET_VECTOR@l
- stwu r1, -8(r1) /* Save back chain and move SP */
- stw r0, +12(r1) /* Save return addr (underflow vect) */
-#endif /* !(CFG_INIT_DCACHE_CS || !CFG_TEM_STACK_OCM) */
-
- GET_GOT /* initialize GOT access */
-
- bl cpu_init_f /* run low-level CPU init code (from Flash) */
-
- /* NEVER RETURNS! */
- bl board_init_f /* run first part of init code (from Flash) */
-
-#endif /* CONFIG_405GP || CONFIG_405CR || CONFIG_405 || CONFIG_405EP */
- /*----------------------------------------------------------------------- */
-
-
-#ifndef CONFIG_NAND_SPL
-/*****************************************************************************/
- .globl _start_of_vectors
-_start_of_vectors:
-
-
-/* Machine check */
- CRIT_EXCEPTION(0x200, MachineCheck, MachineCheckException)
-
-/* Data Storage exception. */
- STD_EXCEPTION(0x300, DataStorage, UnknownException)
-
-/* Instruction Storage exception. */
- STD_EXCEPTION(0x400, InstStorage, UnknownException)
-
-/* External Interrupt exception. */
- STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
-
-/* Alignment exception. */
- . = 0x600
-Alignment:
- EXCEPTION_PROLOG
- mfspr r4,DAR
- stw r4,_DAR(r21)
- mfspr r5,DSISR
- stw r5,_DSISR(r21)
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_Alignment:
- .long AlignmentException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
-/* Program check exception */
- . = 0x700
-ProgramCheck:
- EXCEPTION_PROLOG
- addi r3,r1,STACK_FRAME_OVERHEAD
- li r20,MSR_KERNEL
- rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
- lwz r6,GOT(transfer_to_handler)
- mtlr r6
- blrl
-.L_ProgramCheck:
- .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
- .long int_return - _start + EXC_OFF_SYS_RESET
-
- /* No FPU on MPC8xx. This exception is not supposed to happen.
- */
- STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
-
- /* I guess we could implement decrementer, and may have
- * to someday for timekeeping.
- */
- STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
- STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
- STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
- STD_EXCEPTION(0xc00, SystemCall, UnknownException)
- STD_EXCEPTION(0xd00, SingleStep, UnknownException)
-
- STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
- STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
-
- /* On the MPC8xx, this is a software emulation interrupt. It occurs
- * for all unimplemented and illegal instructions.
- */
- STD_EXCEPTION(0x1000, PIT, PITException)
-
- STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
- STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
- STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
- STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
-
- STD_EXCEPTION(0x1500, Reserved5, UnknownException)
- STD_EXCEPTION(0x1600, Reserved6, UnknownException)
- STD_EXCEPTION(0x1700, Reserved7, UnknownException)
- STD_EXCEPTION(0x1800, Reserved8, UnknownException)
- STD_EXCEPTION(0x1900, Reserved9, UnknownException)
- STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
- STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
-
- STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
- STD_EXCEPTION(0x1d00, InstructionBreakpoint, UnknownException)
- STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
- STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
-
- CRIT_EXCEPTION(0x2000, DebugBreakpoint, DebugException )
-
- .globl _end_of_vectors
-_end_of_vectors:
-
-
- . = 0x2100
-
-/*
- * This code finishes saving the registers to the exception frame
- * and jumps to the appropriate handler for the exception.
- * Register r21 is pointer into trap frame, r1 has new stack pointer.
- */
- .globl transfer_to_handler
-transfer_to_handler:
- stw r22,_NIP(r21)
- lis r22,MSR_POW@h
- andc r23,r23,r22
- stw r23,_MSR(r21)
- SAVE_GPR(7, r21)
- SAVE_4GPRS(8, r21)
- SAVE_8GPRS(12, r21)
- SAVE_8GPRS(24, r21)
- mflr r23
- andi. r24,r23,0x3f00 /* get vector offset */
- stw r24,TRAP(r21)
- li r22,0
- stw r22,RESULT(r21)
- mtspr SPRG2,r22 /* r1 is now kernel sp */
- lwz r24,0(r23) /* virtual address of handler */
- lwz r23,4(r23) /* where to go when done */
- mtspr SRR0,r24
- mtspr SRR1,r20
- mtlr r23
- SYNC
- rfi /* jump to handler, enable MMU */
-
-int_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr SRR0,r2
- mtspr SRR1,r0
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfi
-
-crit_return:
- mfmsr r28 /* Disable interrupts */
- li r4,0
- ori r4,r4,MSR_EE
- andc r28,r28,r4
- SYNC /* Some chip revs need this... */
- mtmsr r28
- SYNC
- lwz r2,_CTR(r1)
- lwz r0,_LINK(r1)
- mtctr r2
- mtlr r0
- lwz r2,_XER(r1)
- lwz r0,_CCR(r1)
- mtspr XER,r2
- mtcrf 0xFF,r0
- REST_10GPRS(3, r1)
- REST_10GPRS(13, r1)
- REST_8GPRS(23, r1)
- REST_GPR(31, r1)
- lwz r2,_NIP(r1) /* Restore environment */
- lwz r0,_MSR(r1)
- mtspr 990,r2 /* SRR2 */
- mtspr 991,r0 /* SRR3 */
- lwz r0,GPR0(r1)
- lwz r2,GPR2(r1)
- lwz r1,GPR1(r1)
- SYNC
- rfci
-#endif /* CONFIG_NAND_SPL */
-
-/* Cache functions.
-*/
-invalidate_icache:
- iccci r0,r0 /* for 405, iccci invalidates the */
- blr /* entire I cache */
-
-invalidate_dcache:
- addi r6,0,0x0000 /* clear GPR 6 */
- /* Do loop for # of dcache congruence classes. */
- lis r7, (CFG_DCACHE_SIZE / CONFIG_CACHELINE_SIZE / 2)@ha /* TBS for large sized cache */
- ori r7, r7, (CFG_DCACHE_SIZE / CONFIG_CACHELINE_SIZE / 2)@l
- /* NOTE: dccci invalidates both */
- mtctr r7 /* ways in the D cache */
-..dcloop:
- dccci 0,r6 /* invalidate line */
- addi r6,r6, CONFIG_CACHELINE_SIZE /* bump to next line */
- bdnz ..dcloop
- blr
-
-flush_dcache:
- addis r9,r0,0x0002 /* set mask for EE and CE msr bits */
- ori r9,r9,0x8000
- mfmsr r12 /* save msr */
- andc r9,r12,r9
- mtmsr r9 /* disable EE and CE */
- addi r10,r0,0x0001 /* enable data cache for unused memory */
- mfdccr r9 /* region 0xF8000000-0xFFFFFFFF via */
- or r10,r10,r9 /* bit 31 in dccr */
- mtdccr r10
-
- /* do loop for # of congruence classes. */
- lis r10,(CFG_DCACHE_SIZE / CONFIG_CACHELINE_SIZE / 2)@ha /* TBS: for large cache sizes */
- ori r10,r10,(CFG_DCACHE_SIZE / CONFIG_CACHELINE_SIZE / 2)@l
- lis r11,(CFG_DCACHE_SIZE / 2)@ha /* D cache set size - 2 way sets */
- ori r11,r11,(CFG_DCACHE_SIZE / 2)@l /* D cache set size - 2 way sets */
- mtctr r10
- addi r10,r0,(0xE000-0x10000) /* start at 0xFFFFE000 */
- add r11,r10,r11 /* add to get to other side of cache line */
-..flush_dcache_loop:
- lwz r3,0(r10) /* least recently used side */
- lwz r3,0(r11) /* the other side */
- dccci r0,r11 /* invalidate both sides */
- addi r10,r10,CONFIG_CACHELINE_SIZE /* bump to next line */
- addi r11,r11,CONFIG_CACHELINE_SIZE /* bump to next line */
- bdnz ..flush_dcache_loop
- sync /* allow memory access to complete */
- mtdccr r9 /* restore dccr */
- mtmsr r12 /* restore msr */
- blr
-
- .globl icache_enable
-icache_enable:
- mflr r8
- bl invalidate_icache
- mtlr r8
- isync
- addis r3,r0, 0x8000 /* set bit 0 */
- mticcr r3
- blr
-
- .globl icache_disable
-icache_disable:
- addis r3,r0, 0x0000 /* clear bit 0 */
- mticcr r3
- isync
- blr
-
- .globl icache_status
-icache_status:
- mficcr r3
- srwi r3, r3, 31 /* >>31 => select bit 0 */
- blr
-
- .globl dcache_enable
-dcache_enable:
- mflr r8
- bl invalidate_dcache
- mtlr r8
- isync
- addis r3,r0, 0x8000 /* set bit 0 */
- mtdccr r3
- blr
-
- .globl dcache_disable
-dcache_disable:
- mflr r8
- bl flush_dcache
- mtlr r8
- addis r3,r0, 0x0000 /* clear bit 0 */
- mtdccr r3
- blr
-
- .globl dcache_status
-dcache_status:
- mfdccr r3
- srwi r3, r3, 31 /* >>31 => select bit 0 */
- blr
-
- .globl get_pvr
-get_pvr:
- mfspr r3, PVR
- blr
-
-#if !defined(CONFIG_440)
- .globl wr_pit
-wr_pit:
- mtspr pit, r3
- blr
-#endif
-
- .globl wr_tcr
-wr_tcr:
- mtspr tcr, r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: in8 */
-/* Description: Input 8 bits */
-/*------------------------------------------------------------------------------- */
- .globl in8
-in8:
- lbz r3,0x0000(r3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: out8 */
-/* Description: Output 8 bits */
-/*------------------------------------------------------------------------------- */
- .globl out8
-out8:
- stb r4,0x0000(r3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: out16 */
-/* Description: Output 16 bits */
-/*------------------------------------------------------------------------------- */
- .globl out16
-out16:
- sth r4,0x0000(r3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: out16r */
-/* Description: Byte reverse and output 16 bits */
-/*------------------------------------------------------------------------------- */
- .globl out16r
-out16r:
- sthbrx r4,r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: out32 */
-/* Description: Output 32 bits */
-/*------------------------------------------------------------------------------- */
- .globl out32
-out32:
- stw r4,0x0000(r3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: out32r */
-/* Description: Byte reverse and output 32 bits */
-/*------------------------------------------------------------------------------- */
- .globl out32r
-out32r:
- stwbrx r4,r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: in16 */
-/* Description: Input 16 bits */
-/*------------------------------------------------------------------------------- */
- .globl in16
-in16:
- lhz r3,0x0000(r3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: in16r */
-/* Description: Input 16 bits and byte reverse */
-/*------------------------------------------------------------------------------- */
- .globl in16r
-in16r:
- lhbrx r3,r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: in32 */
-/* Description: Input 32 bits */
-/*------------------------------------------------------------------------------- */
- .globl in32
-in32:
- lwz 3,0x0000(3)
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: in32r */
-/* Description: Input 32 bits and byte reverse */
-/*------------------------------------------------------------------------------- */
- .globl in32r
-in32r:
- lwbrx r3,r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: ppcDcbf */
-/* Description: Data Cache block flush */
-/* Input: r3 = effective address */
-/* Output: none. */
-/*------------------------------------------------------------------------------- */
- .globl ppcDcbf
-ppcDcbf:
- dcbf r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: ppcDcbi */
-/* Description: Data Cache block Invalidate */
-/* Input: r3 = effective address */
-/* Output: none. */
-/*------------------------------------------------------------------------------- */
- .globl ppcDcbi
-ppcDcbi:
- dcbi r0,r3
- blr
-
-/*------------------------------------------------------------------------------- */
-/* Function: ppcSync */
-/* Description: Processor Synchronize */
-/* Input: none. */
-/* Output: none. */
-/*------------------------------------------------------------------------------- */
- .globl ppcSync
-ppcSync:
- sync
- blr
-
-/*------------------------------------------------------------------------------*/
-
-#ifndef CONFIG_NAND_SPL
-/*
- * void relocate_code (addr_sp, gd, addr_moni)
- *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
- * r3 = dest
- * r4 = src
- * r5 = length in bytes
- * r6 = cachelinesize
- */
- .globl relocate_code
-relocate_code:
-#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
- defined(CONFIG_440SPE)
- /*
- * On some 440er platforms the cache is enabled in the first TLB (Boot-CS)
- * to speed up the boot process. Now this cache needs to be disabled.
- */
- iccci 0,0 /* Invalidate inst cache */
- dccci 0,0 /* Invalidate data cache, now no longer our stack */
- sync
- isync
- addi r1,r0,0x0000 /* TLB entry #0 */
- tlbre r0,r1,0x0002 /* Read contents */
- ori r0,r0,0x0c00 /* Or in the inhibit, write through bit */
- tlbwe r0,r1,0x0002 /* Save it out */
- sync
- isync
-#endif
- mr r1, r3 /* Set new stack pointer */
- mr r9, r4 /* Save copy of Init Data pointer */
- mr r10, r5 /* Save copy of Destination Address */
-
- mr r3, r5 /* Destination Address */
- lis r4, CFG_MONITOR_BASE@h /* Source Address */
- ori r4, r4, CFG_MONITOR_BASE@l
- lwz r5, GOT(__init_end)
- sub r5, r5, r4
- li r6, CONFIG_CACHELINE_SIZE /* Cache Line Size */
-
- /*
- * Fix GOT pointer:
- *
- * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
- *
- * Offset:
- */
- sub r15, r10, r4
-
- /* First our own GOT */
- add r14, r14, r15
- /* the the one used by the C code */
- add r30, r30, r15
-
- /*
- * Now relocate code
- */
-
- cmplw cr1,r3,r4
- addi r0,r5,3
- srwi. r0,r0,2
- beq cr1,4f /* In place copy is not necessary */
- beq 7f /* Protect against 0 count */
- mtctr r0
- bge cr1,2f
-
- la r8,-4(r4)
- la r7,-4(r3)
-1: lwzu r0,4(r8)
- stwu r0,4(r7)
- bdnz 1b
- b 4f
-
-2: slwi r0,r0,2
- add r8,r4,r0
- add r7,r3,r0
-3: lwzu r0,-4(r8)
- stwu r0,-4(r7)
- bdnz 3b
-
-/*
- * Now flush the cache: note that we must start from a cache aligned
- * address. Otherwise we might miss one cache line.
- */
-4: cmpwi r6,0
- add r5,r3,r5
- beq 7f /* Always flush prefetch queue in any case */
- subi r0,r6,1
- andc r3,r3,r0
- mr r4,r3
-5: dcbst 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 5b
- sync /* Wait for all dcbst to complete on bus */
- mr r4,r3
-6: icbi 0,r4
- add r4,r4,r6
- cmplw r4,r5
- blt 6b
-7: sync /* Wait for all icbi to complete on bus */
- isync
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-
- addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
- mtlr r0
- blr /* NEVER RETURNS! */
-
-in_ram:
-
- /*
- * Relocation Function, r14 point to got2+0x8000
- *
- * Adjust got2 pointers, no need to check for 0, this code
- * already puts a few entries in the table.
- */
- li r0,__got2_entries@sectoff@l
- la r3,GOT(_GOT2_TABLE_)
- lwz r11,GOT(_GOT2_TABLE_)
- mtctr r0
- sub r11,r3,r11
- addi r3,r3,-4
-1: lwzu r0,4(r3)
- add r0,r0,r11
- stw r0,0(r3)
- bdnz 1b
-
- /*
- * Now adjust the fixups and the pointers to the fixups
- * in case we need to move ourselves again.
- */
-2: li r0,__fixup_entries@sectoff@l
- lwz r3,GOT(_FIXUP_TABLE_)
- cmpwi r0,0
- mtctr r0
- addi r3,r3,-4
- beq 4f
-3: lwzu r4,4(r3)
- lwzux r0,r4,r11
- add r0,r0,r11
- stw r10,0(r3)
- stw r0,0(r4)
- bdnz 3b
-4:
-clear_bss:
- /*
- * Now clear BSS segment
- */
- lwz r3,GOT(__bss_start)
- lwz r4,GOT(_end)
-
- cmplw 0, r3, r4
- beq 6f
-
- li r0, 0
-5:
- stw r0, 0(r3)
- addi r3, r3, 4
- cmplw 0, r3, r4
- bne 5b
-6:
-
- mr r3, r9 /* Init Data pointer */
- mr r4, r10 /* Destination Address */
- bl board_init_r
-
- /*
- * Copy exception vector code to low memory
- *
- * r3: dest_addr
- * r7: source address, r8: end address, r9: target address
- */
- .globl trap_init
-trap_init:
- lwz r7, GOT(_start)
- lwz r8, GOT(_end_of_vectors)
-
- li r9, 0x100 /* reset vector always at 0x100 */
-
- cmplw 0, r7, r8
- bgelr /* return if r7>=r8 - just in case */
-
- mflr r4 /* save link register */
-1:
- lwz r0, 0(r7)
- stw r0, 0(r9)
- addi r7, r7, 4
- addi r9, r9, 4
- cmplw 0, r7, r8
- bne 1b
-
- /*
- * relocate `hdlr' and `int_return' entries
- */
- li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
- li r8, Alignment - _start + EXC_OFF_SYS_RESET
-2:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 2b
-
- li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
- bl trap_reloc
-
- li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
- li r8, SystemCall - _start + EXC_OFF_SYS_RESET
-3:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 3b
-
- li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
- li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
-4:
- bl trap_reloc
- addi r7, r7, 0x100 /* next exception vector */
- cmplw 0, r7, r8
- blt 4b
-
-#if !defined(CONFIG_440)
- addi r7,r0,0x1000 /* set ME bit (Machine Exceptions) */
- oris r7,r7,0x0002 /* set CE bit (Critical Exceptions) */
- mtmsr r7 /* change MSR */
-#else
- bl __440_msr_set
- b __440_msr_continue
-
-__440_msr_set:
- addi r7,r0,0x1000 /* set ME bit (Machine Exceptions) */
- oris r7,r7,0x0002 /* set CE bit (Critical Exceptions) */
- mtspr srr1,r7
- mflr r7
- mtspr srr0,r7
- rfi
-__440_msr_continue:
-#endif
-
- mtlr r4 /* restore link register */
- blr
-
- /*
- * Function: relocate entries for one exception vector
- */
-trap_reloc:
- lwz r0, 0(r7) /* hdlr ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 0(r7)
-
- lwz r0, 4(r7) /* int_return ... */
- add r0, r0, r3 /* ... += dest_addr */
- stw r0, 4(r7)
-
- blr
-#endif /* CONFIG_NAND_SPL */
-
-
-/**************************************************************************/
-/* PPC405EP specific stuff */
-/**************************************************************************/
-#ifdef CONFIG_405EP
-ppc405ep_init:
-
-#ifdef CONFIG_BUBINGA
- /*
- * Initialize EBC chip selects 1 & 4 and GPIO pins (for alternate
- * function) to support FPGA and NVRAM accesses below.
- */
-
- lis r3,GPIO0_OSRH@h /* config GPIO output select */
- ori r3,r3,GPIO0_OSRH@l
- lis r4,CFG_GPIO0_OSRH@h
- ori r4,r4,CFG_GPIO0_OSRH@l
- stw r4,0(r3)
- lis r3,GPIO0_OSRL@h
- ori r3,r3,GPIO0_OSRL@l
- lis r4,CFG_GPIO0_OSRL@h
- ori r4,r4,CFG_GPIO0_OSRL@l
- stw r4,0(r3)
-
- lis r3,GPIO0_ISR1H@h /* config GPIO input select */
- ori r3,r3,GPIO0_ISR1H@l
- lis r4,CFG_GPIO0_ISR1H@h
- ori r4,r4,CFG_GPIO0_ISR1H@l
- stw r4,0(r3)
- lis r3,GPIO0_ISR1L@h
- ori r3,r3,GPIO0_ISR1L@l
- lis r4,CFG_GPIO0_ISR1L@h
- ori r4,r4,CFG_GPIO0_ISR1L@l
- stw r4,0(r3)
-
- lis r3,GPIO0_TSRH@h /* config GPIO three-state select */
- ori r3,r3,GPIO0_TSRH@l
- lis r4,CFG_GPIO0_TSRH@h
- ori r4,r4,CFG_GPIO0_TSRH@l
- stw r4,0(r3)
- lis r3,GPIO0_TSRL@h
- ori r3,r3,GPIO0_TSRL@l
- lis r4,CFG_GPIO0_TSRL@h
- ori r4,r4,CFG_GPIO0_TSRL@l
- stw r4,0(r3)
-
- lis r3,GPIO0_TCR@h /* config GPIO driver output enables */
- ori r3,r3,GPIO0_TCR@l
- lis r4,CFG_GPIO0_TCR@h
- ori r4,r4,CFG_GPIO0_TCR@l
- stw r4,0(r3)
-
- li r3,pb1ap /* program EBC bank 1 for RTC access */
- mtdcr ebccfga,r3
- lis r3,CFG_EBC_PB1AP@h
- ori r3,r3,CFG_EBC_PB1AP@l
- mtdcr ebccfgd,r3
- li r3,pb1cr
- mtdcr ebccfga,r3
- lis r3,CFG_EBC_PB1CR@h
- ori r3,r3,CFG_EBC_PB1CR@l
- mtdcr ebccfgd,r3
-
- li r3,pb1ap /* program EBC bank 1 for RTC access */
- mtdcr ebccfga,r3
- lis r3,CFG_EBC_PB1AP@h
- ori r3,r3,CFG_EBC_PB1AP@l
- mtdcr ebccfgd,r3
- li r3,pb1cr
- mtdcr ebccfga,r3
- lis r3,CFG_EBC_PB1CR@h
- ori r3,r3,CFG_EBC_PB1CR@l
- mtdcr ebccfgd,r3
-
- li r3,pb4ap /* program EBC bank 4 for FPGA access */
- mtdcr ebccfga,r3
- lis r3,CFG_EBC_PB4AP@h
- ori r3,r3,CFG_EBC_PB4AP@l
- mtdcr ebccfgd,r3
- li r3,pb4cr
- mtdcr ebccfga,r3
- lis r3,CFG_EBC_PB4CR@h
- ori r3,r3,CFG_EBC_PB4CR@l
- mtdcr ebccfgd,r3
-#endif
-
-#ifndef CFG_CPC0_PCI
- li r3,CPC0_PCI_HOST_CFG_EN
-#ifdef CONFIG_BUBINGA
- /*
- !-----------------------------------------------------------------------
- ! Check FPGA for PCI internal/external arbitration
- ! If board is set to internal arbitration, update cpc0_pci
- !-----------------------------------------------------------------------
- */
- addis r5,r0,FPGA_REG1@h /* set offset for FPGA_REG1 */
- ori r5,r5,FPGA_REG1@l
- lbz r5,0x0(r5) /* read to get PCI arb selection */
- andi. r6,r5,FPGA_REG1_PCI_INT_ARB /* using internal arbiter ?*/
- beq ..pci_cfg_set /* if not set, then bypass reg write*/
-#endif
- ori r3,r3,CPC0_PCI_ARBIT_EN
-#else /* CFG_CPC0_PCI */
- li r3,CFG_CPC0_PCI
-#endif /* CFG_CPC0_PCI */
-..pci_cfg_set:
- mtdcr CPC0_PCI, r3 /* Enable internal arbiter*/
-
- /*
- !-----------------------------------------------------------------------
- ! Check to see if chip is in bypass mode.
- ! If so, write stored CPC0_PLLMR0 and CPC0_PLLMR1 values and perform a
- ! CPU reset Otherwise, skip this step and keep going.
- ! Note: Running BIOS in bypass mode is not supported since PLB speed
- ! will not be fast enough for the SDRAM (min 66MHz)
- !-----------------------------------------------------------------------
- */
- mfdcr r5, CPC0_PLLMR1
- rlwinm r4,r5,1,0x1 /* get system clock source (SSCS) */
- cmpi cr0,0,r4,0x1
-
- beq pll_done /* if SSCS =b'1' then PLL has */
- /* already been set */
- /* and CPU has been reset */
- /* so skip to next section */
-
-#ifdef CONFIG_BUBINGA
- /*
- !-----------------------------------------------------------------------
- ! Read NVRAM to get value to write in PLLMR.
- ! If value has not been correctly saved, write default value
- ! Default config values (assuming on-board 33MHz SYS_CLK) are above.
- ! See CPU_DEFAULT_200 and CPU_DEFAULT_266 above.
- !
- ! WARNING: This code assumes the first three words in the nvram_t
- ! structure in openbios.h. Changing the beginning of
- ! the structure will break this code.
- !
- !-----------------------------------------------------------------------
- */
- addis r3,0,NVRAM_BASE@h
- addi r3,r3,NVRAM_BASE@l
-
- lwz r4, 0(r3)
- addis r5,0,NVRVFY1@h
- addi r5,r5,NVRVFY1@l
- cmp cr0,0,r4,r5 /* Compare 1st NVRAM Magic number*/
- bne ..no_pllset
- addi r3,r3,4
- lwz r4, 0(r3)
- addis r5,0,NVRVFY2@h
- addi r5,r5,NVRVFY2@l
- cmp cr0,0,r4,r5 /* Compare 2 NVRAM Magic number */
- bne ..no_pllset
- addi r3,r3,8 /* Skip over conf_size */
- lwz r4, 4(r3) /* Load PLLMR1 value from NVRAM */
- lwz r3, 0(r3) /* Load PLLMR0 value from NVRAM */
- rlwinm r5,r4,1,0x1 /* get system clock source (SSCS) */
- cmpi cr0,0,r5,1 /* See if PLL is locked */
- beq pll_write
-..no_pllset:
-#endif /* CONFIG_BUBINGA */
-
- addis r3,0,PLLMR0_DEFAULT@h /* PLLMR0 default value */
- ori r3,r3,PLLMR0_DEFAULT@l /* */
- addis r4,0,PLLMR1_DEFAULT@h /* PLLMR1 default value */
- ori r4,r4,PLLMR1_DEFAULT@l /* */
-
- b pll_write /* Write the CPC0_PLLMR with new value */
-
-pll_done:
- /*
- !-----------------------------------------------------------------------
- ! Clear Soft Reset Register
- ! This is needed to enable PCI if not booting from serial EPROM
- !-----------------------------------------------------------------------
- */
- addi r3, 0, 0x0
- mtdcr CPC0_SRR, r3
-
- addis r3,0,0x0010
- mtctr r3
-pci_wait:
- bdnz pci_wait
-
- blr /* return to main code */
-
-/*
-!-----------------------------------------------------------------------------
-! Function: pll_write
-! Description: Updates the value of the CPC0_PLLMR according to CMOS27E documentation
-! That is:
-! 1. Pll is first disabled (de-activated by putting in bypass mode)
-! 2. PLL is reset
-! 3. Clock dividers are set while PLL is held in reset and bypassed
-! 4. PLL Reset is cleared
-! 5. Wait 100us for PLL to lock
-! 6. A core reset is performed
-! Input: r3 = Value to write to CPC0_PLLMR0
-! Input: r4 = Value to write to CPC0_PLLMR1
-! Output r3 = none
-!-----------------------------------------------------------------------------
-*/
-pll_write:
- mfdcr r5, CPC0_UCR
- andis. r5,r5,0xFFFF
- ori r5,r5,0x0101 /* Stop the UART clocks */
- mtdcr CPC0_UCR,r5 /* Before changing PLL */
-
- mfdcr r5, CPC0_PLLMR1
- rlwinm r5,r5,0,0x7FFFFFFF /* Disable PLL */
- mtdcr CPC0_PLLMR1,r5
- oris r5,r5,0x4000 /* Set PLL Reset */
- mtdcr CPC0_PLLMR1,r5
-
- mtdcr CPC0_PLLMR0,r3 /* Set clock dividers */
- rlwinm r5,r4,0,0x3FFFFFFF /* Reset & Bypass new PLL dividers */
- oris r5,r5,0x4000 /* Set PLL Reset */
- mtdcr CPC0_PLLMR1,r5 /* Set clock dividers */
- rlwinm r5,r5,0,0xBFFFFFFF /* Clear PLL Reset */
- mtdcr CPC0_PLLMR1,r5
-
- /*
- ! Wait min of 100us for PLL to lock.
- ! See CMOS 27E databook for more info.
- ! At 200MHz, that means waiting 20,000 instructions
- */
- addi r3,0,20000 /* 2000 = 0x4e20 */
- mtctr r3
-pll_wait:
- bdnz pll_wait
-
- oris r5,r5,0x8000 /* Enable PLL */
- mtdcr CPC0_PLLMR1,r5 /* Engage */
-
- /*
- * Reset CPU to guarantee timings are OK
- * Not sure if this is needed...
- */
- addis r3,0,0x1000
- mtspr dbcr0,r3 /* This will cause a CPU core reset, and */
- /* execution will continue from the poweron */
- /* vector of 0xfffffffc */
-#endif /* CONFIG_405EP */
diff --git a/cpu/ppc4xx/traps.c b/cpu/ppc4xx/traps.c
deleted file mode 100644
index c7eaa52ebf..0000000000
--- a/cpu/ppc4xx/traps.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * linux/arch/ppc/kernel/traps.c
- *
- * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- * Modified by Cort Dougan (cort@cs.nmt.edu)
- * and Paul Mackerras (paulus@cs.anu.edu.au)
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * This file handles the architecture-dependent parts of hardware exceptions
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/processor.h>
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
-/* Returns 0 if exception not found and fixup otherwise. */
-extern unsigned long search_exception_table(unsigned long);
-
-/* THIS NEEDS CHANGING to use the board info structure.
- */
-#define END_OF_MEM 0x00400000
-
-
-static __inline__ void set_tsr(unsigned long val)
-{
-#if defined(CONFIG_440)
- asm volatile("mtspr 0x150, %0" : : "r" (val));
-#else
- asm volatile("mttsr %0" : : "r" (val));
-#endif
-}
-
-static __inline__ unsigned long get_esr(void)
-{
- unsigned long val;
-
-#if defined(CONFIG_440)
- asm volatile("mfspr %0, 0x03e" : "=r" (val) :);
-#else
- asm volatile("mfesr %0" : "=r" (val) :);
-#endif
- return val;
-}
-
-#define ESR_MCI 0x80000000
-#define ESR_PIL 0x08000000
-#define ESR_PPR 0x04000000
-#define ESR_PTR 0x02000000
-#define ESR_DST 0x00800000
-#define ESR_DIZ 0x00400000
-#define ESR_U0F 0x00008000
-
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
-extern void do_bedbug_breakpoint(struct pt_regs *);
-#endif
-
-/*
- * Trap & Exception support
- */
-
-void
-print_backtrace(unsigned long *sp)
-{
- int cnt = 0;
- unsigned long i;
-
- printf("Call backtrace: ");
- while (sp) {
- if ((uint)sp > END_OF_MEM)
- break;
-
- i = sp[1];
- if (cnt++ % 7 == 0)
- printf("\n");
- printf("%08lX ", i);
- if (cnt > 32) break;
- sp = (unsigned long *)*sp;
- }
- printf("\n");
-}
-
-void show_regs(struct pt_regs * regs)
-{
- int i;
-
- printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
- regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
- printf("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
- regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
- regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
- regs->msr&MSR_IR ? 1 : 0,
- regs->msr&MSR_DR ? 1 : 0);
-
- printf("\n");
- for (i = 0; i < 32; i++) {
- if ((i % 8) == 0)
- {
- printf("GPR%02d: ", i);
- }
-
- printf("%08lX ", regs->gpr[i]);
- if ((i % 8) == 7)
- {
- printf("\n");
- }
- }
-}
-
-
-void
-_exception(int signr, struct pt_regs *regs)
-{
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
-}
-
-void
-MachineCheckException(struct pt_regs *regs)
-{
- unsigned long fixup;
-
- /* Probing PCI using config cycles cause this exception
- * when a device is not present. Catch it and return to
- * the PCI exception handler.
- */
- if ((fixup = search_exception_table(regs->nip)) != 0) {
- regs->nip = fixup;
- return;
- }
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- printf("Machine check in kernel mode.\n");
- printf("Caused by (from msr): ");
- printf("regs %p ",regs);
- switch( regs->msr & 0x000F0000) {
- case (0x80000000>>12):
- printf("Machine check signal - probably due to mm fault\n"
- "with mmu off\n");
- break;
- case (0x80000000>>13):
- printf("Transfer error ack signal\n");
- break;
- case (0x80000000>>14):
- printf("Data parity signal\n");
- break;
- case (0x80000000>>15):
- printf("Address parity signal\n");
- break;
- default:
- printf("Unknown values in msr\n");
- }
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("machine check");
-}
-
-void
-AlignmentException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- show_regs(regs);
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Alignment Exception");
-}
-
-void
-ProgramCheckException(struct pt_regs *regs)
-{
- long esr_val;
-
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- show_regs(regs);
-
- esr_val = get_esr();
- if( esr_val & ESR_PIL )
- printf( "** Illegal Instruction **\n" );
- else if( esr_val & ESR_PPR )
- printf( "** Privileged Instruction **\n" );
- else if( esr_val & ESR_PTR )
- printf( "** Trap Instruction **\n" );
-
- print_backtrace((unsigned long *)regs->gpr[1]);
- panic("Program Check Exception");
-}
-
-void
-PITException(struct pt_regs *regs)
-{
- /*
- * Reset PIT interrupt
- */
- set_tsr(0x08000000);
-
- /*
- * Call timer_interrupt routine in interrupts.c
- */
- timer_interrupt(NULL);
-}
-
-
-void
-UnknownException(struct pt_regs *regs)
-{
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
- if (debugger_exception_handler && (*debugger_exception_handler)(regs))
- return;
-#endif
-
- printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
- regs->nip, regs->msr, regs->trap);
- _exception(0, regs);
-}
-
-void
-DebugException(struct pt_regs *regs)
-{
- printf("Debugger trap at @ %lx\n", regs->nip );
- show_regs(regs);
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
- do_bedbug_breakpoint( regs );
-#endif
-}
-
-/* Probe an address by reading. If not present, return -1, otherwise
- * return 0.
- */
-int
-addr_probe(uint *addr)
-{
- return 0;
-}
diff --git a/cpu/ppc4xx/vecnum.h b/cpu/ppc4xx/vecnum.h
deleted file mode 100644
index 685d48bcf6..0000000000
--- a/cpu/ppc4xx/vecnum.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
-* Copyright (C) 2002 Scott McNutt <smcnutt@artesyncp.com>
-*
-* See file CREDITS for list of people who contributed to this
-* project.
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-* MA 02111-1307 USA
-*/
-
-/*
- * Interrupt vector number definitions to ease the
- * 405 -- 440 porting pain ;-)
- *
- * NOTE: They're not all here yet ... update as needed.
- *
- */
-
-#ifndef _VECNUMS_H_
-#define _VECNUMS_H_
-
-#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-
-/* UIC 0 */
-#define VECNUM_U0 0 /* UART 0 */
-#define VECNUM_U1 1 /* UART 1 */
-#define VECNUM_IIC0 2 /* IIC */
-#define VECNUM_KRD 3 /* Kasumi Ready for data */
-#define VECNUM_KDA 4 /* Kasumi Data Available */
-#define VECNUM_PCRW 5 /* PCI command register write */
-#define VECNUM_PPM 6 /* PCI power management */
-#define VECNUM_IIC1 7 /* IIC */
-#define VECNUM_SPI 8 /* SPI */
-#define VECNUM_EPCISER 9 /* External PCI SERR */
-#define VECNUM_MTE 10 /* MAL TXEOB */
-#define VECNUM_MRE 11 /* MAL RXEOB */
-#define VECNUM_D0 12 /* DMA channel 0 */
-#define VECNUM_D1 13 /* DMA channel 1 */
-#define VECNUM_D2 14 /* DMA channel 2 */
-#define VECNUM_D3 15 /* DMA channel 3 */
-#define VECNUM_UD0 16 /* UDMA irq 0 */
-#define VECNUM_UD1 17 /* UDMA irq 1 */
-#define VECNUM_UD2 18 /* UDMA irq 2 */
-#define VECNUM_UD3 19 /* UDMA irq 3 */
-#define VECNUM_HSB2D 20 /* USB2.0 Device */
-#define VECNUM_USBDEV 20 /* USB 1.1/USB 2.0 Device */
-#define VECNUM_OHCI1 21 /* USB2.0 Host OHCI irq 1 */
-#define VECNUM_OHCI2 22 /* USB2.0 Host OHCI irq 2 */
-#define VECNUM_EIP94 23 /* Security EIP94 */
-#define VECNUM_ETH0 24 /* Emac 0 */
-#define VECNUM_ETH1 25 /* Emac 1 */
-#define VECNUM_EHCI 26 /* USB2.0 Host EHCI */
-#define VECNUM_EIR4 27 /* External interrupt 4 */
-#define VECNUM_UIC2NC 28 /* UIC2 non-critical interrupt */
-#define VECNUM_UIC2C 29 /* UIC2 critical interrupt */
-#define VECNUM_UIC1NC 30 /* UIC1 non-critical interrupt */
-#define VECNUM_UIC1C 31 /* UIC1 critical interrupt */
-
-/* UIC 1 */
-#define VECNUM_MS (32 + 0) /* MAL SERR */
-#define VECNUM_MTDE (32 + 1) /* MAL TXDE */
-#define VECNUM_MRDE (32 + 2) /* MAL RXDE */
-#define VECNUM_U2 (32 + 3) /* UART 2 */
-#define VECNUM_U3 (32 + 4) /* UART 3 */
-#define VECNUM_EBCO (32 + 5) /* EBCO interrupt status */
-#define VECNUM_NDFC (32 + 6) /* NDFC */
-#define VECNUM_KSLE (32 + 7) /* KASUMI slave error */
-#define VECNUM_CT5 (32 + 8) /* GPT compare timer 5 */
-#define VECNUM_CT6 (32 + 9) /* GPT compare timer 6 */
-#define VECNUM_PLB34I0 (32 + 10) /* PLB3X4X MIRQ0 */
-#define VECNUM_PLB34I1 (32 + 11) /* PLB3X4X MIRQ1 */
-#define VECNUM_PLB34I2 (32 + 12) /* PLB3X4X MIRQ2 */
-#define VECNUM_PLB34I3 (32 + 13) /* PLB3X4X MIRQ3 */
-#define VECNUM_PLB34I4 (32 + 14) /* PLB3X4X MIRQ4 */
-#define VECNUM_PLB34I5 (32 + 15) /* PLB3X4X MIRQ5 */
-#define VECNUM_CT0 (32 + 16) /* GPT compare timer 0 */
-#define VECNUM_CT1 (32 + 17) /* GPT compare timer 1 */
-#define VECNUM_EIR7 (32 + 18) /* External interrupt 7 */
-#define VECNUM_EIR8 (32 + 19) /* External interrupt 8 */
-#define VECNUM_EIR9 (32 + 20) /* External interrupt 9 */
-#define VECNUM_CT2 (32 + 21) /* GPT compare timer 2 */
-#define VECNUM_CT3 (32 + 22) /* GPT compare timer 3 */
-#define VECNUM_CT4 (32 + 23) /* GPT compare timer 4 */
-#define VECNUM_SRE (32 + 24) /* Serial ROM error */
-#define VECNUM_GPTDC (32 + 25) /* GPT decrementer pulse */
-#define VECNUM_RSVD0 (32 + 26) /* Reserved */
-#define VECNUM_EPCIPER (32 + 27) /* External PCI PERR */
-#define VECNUM_EIR0 (32 + 28) /* External interrupt 0 */
-#define VECNUM_EWU0 (32 + 29) /* Ethernet 0 wakeup */
-#define VECNUM_EIR1 (32 + 30) /* External interrupt 1 */
-#define VECNUM_EWU1 (32 + 31) /* Ethernet 1 wakeup */
-
-#define VECNUM_TXDE VECNUM_MTDE
-#define VECNUM_RXDE VECNUM_MRDE
-
-/* UIC 2 */
-#define VECNUM_EIR5 (62 + 0) /* External interrupt 5 */
-#define VECNUM_EIR6 (62 + 1) /* External interrupt 6 */
-#define VECNUM_OPB (62 + 2) /* OPB to PLB bridge int stat */
-#define VECNUM_EIR2 (62 + 3) /* External interrupt 2 */
-#define VECNUM_EIR3 (62 + 4) /* External interrupt 3 */
-#define VECNUM_DDR2 (62 + 5) /* DDR2 sdram */
-#define VECNUM_MCTX0 (62 + 6) /* MAl intp coalescence TX0 */
-#define VECNUM_MCTX1 (62 + 7) /* MAl intp coalescence TX1 */
-#define VECNUM_MCTR0 (62 + 8) /* MAl intp coalescence TR0 */
-#define VECNUM_MCTR1 (62 + 9) /* MAl intp coalescence TR1 */
-
-#elif defined(CONFIG_440SPE)
-
-/* UIC 0 */
-#define VECNUM_U0 0 /* UART0 */
-#define VECNUM_U1 1 /* UART1 */
-#define VECNUM_IIC0 2 /* IIC0 */
-#define VECNUM_IIC1 3 /* IIC1 */
-#define VECNUM_PIM 4 /* PCI inbound message */
-#define VECNUM_PCRW 5 /* PCI command reg write */
-#define VECNUM_PPM 6 /* PCI power management */
-#define VECNUM_MSI0 7 /* PCI MSI level 0 */
-#define VECNUM_MSI1 8 /* PCI MSI level 0 */
-#define VECNUM_MSI2 9 /* PCI MSI level 0 */
-#define VECNUM_D0 12 /* DMA channel 0 */
-#define VECNUM_D1 13 /* DMA channel 1 */
-#define VECNUM_D2 14 /* DMA channel 2 */
-#define VECNUM_D3 15 /* DMA channel 3 */
-#define VECNUM_UIC1NC 30 /* UIC1 non-critical interrupt */
-#define VECNUM_UIC1C 31 /* UIC1 critical interrupt */
-
-/* UIC 1 */
-#define VECNUM_MS (32 + 1 ) /* MAL SERR */
-#define VECNUM_TXDE (32 + 2 ) /* MAL TXDE */
-#define VECNUM_RXDE (32 + 3 ) /* MAL RXDE */
-#define VECNUM_MTE (32 + 6 ) /* MAL Tx EOB */
-#define VECNUM_MRE (32 + 7 ) /* MAL Rx EOB */
-#define VECNUM_CT0 (32 + 12 ) /* GPT compare timer 0 */
-#define VECNUM_CT1 (32 + 13 ) /* GPT compare timer 1 */
-#define VECNUM_CT2 (32 + 14 ) /* GPT compare timer 2 */
-#define VECNUM_CT3 (32 + 15 ) /* GPT compare timer 3 */
-#define VECNUM_CT4 (32 + 16 ) /* GPT compare timer 4 */
-#define VECNUM_ETH0 (32 + 28) /* Ethernet interrupt status */
-#define VECNUM_EWU0 (32 + 29) /* Emac wakeup */
-
-/* UIC 2 */
-#define VECNUM_EIR5 (62 + 24) /* External interrupt 5 */
-#define VECNUM_EIR4 (62 + 25) /* External interrupt 4 */
-#define VECNUM_EIR3 (62 + 26) /* External interrupt 3 */
-#define VECNUM_EIR2 (62 + 27) /* External interrupt 2 */
-#define VECNUM_EIR1 (62 + 28) /* External interrupt 1 */
-#define VECNUM_EIR0 (62 + 29) /* External interrupt 0 */
-
-#elif defined(CONFIG_440SP)
-
-/* UIC 0 */
-#define VECNUM_U0 0 /* UART0 */
-#define VECNUM_U1 1 /* UART1 */
-#define VECNUM_IIC0 2 /* IIC0 */
-#define VECNUM_IIC1 3 /* IIC1 */
-#define VECNUM_PIM 4 /* PCI inbound message */
-#define VECNUM_PCRW 5 /* PCI command reg write */
-#define VECNUM_PPM 6 /* PCI power management */
-#define VECNUM_UIC1NC 30 /* UIC1 non-critical interrupt */
-#define VECNUM_UIC1C 31 /* UIC1 critical interrupt */
-
-/* UIC 1 */
-#define VECNUM_EIR0 (32 + 0) /* External interrupt 0 */
-#define VECNUM_MS (32 + 1) /* MAL SERR */
-#define VECNUM_TXDE (32 + 2) /* MAL TXDE */
-#define VECNUM_RXDE (32 + 3) /* MAL RXDE */
-#define VECNUM_MTE (32 + 6) /* MAL Tx EOB */
-#define VECNUM_MRE (32 + 7) /* MAL Rx EOB */
-#define VECNUM_CT0 (32 + 12) /* GPT compare timer 0 */
-#define VECNUM_CT1 (32 + 13) /* GPT compare timer 1 */
-#define VECNUM_CT2 (32 + 14) /* GPT compare timer 2 */
-#define VECNUM_CT3 (32 + 15) /* GPT compare timer 3 */
-#define VECNUM_CT4 (32 + 16) /* GPT compare timer 4 */
-#define VECNUM_ETH0 (32 + 28) /* Ethernet interrupt status */
-#define VECNUM_EWU0 (32 + 29) /* Emac wakeup */
-
-#elif defined(CONFIG_440)
-
-/* UIC 0 */
-#define VECNUM_U0 0 /* UART0 */
-#define VECNUM_U1 1 /* UART1 */
-#define VECNUM_IIC0 2 /* IIC0 */
-#define VECNUM_IIC1 3 /* IIC1 */
-#define VECNUM_PIM 4 /* PCI inbound message */
-#define VECNUM_PCRW 5 /* PCI command reg write */
-#define VECNUM_PPM 6 /* PCI power management */
-#define VECNUM_MSI0 7 /* PCI MSI level 0 */
-#define VECNUM_MSI1 8 /* PCI MSI level 0 */
-#define VECNUM_MSI2 9 /* PCI MSI level 0 */
-#define VECNUM_MTE 10 /* MAL TXEOB */
-#define VECNUM_MRE 11 /* MAL RXEOB */
-#define VECNUM_D0 12 /* DMA channel 0 */
-#define VECNUM_D1 13 /* DMA channel 1 */
-#define VECNUM_D2 14 /* DMA channel 2 */
-#define VECNUM_D3 15 /* DMA channel 3 */
-#define VECNUM_CT0 18 /* GPT compare timer 0 */
-#define VECNUM_CT1 19 /* GPT compare timer 1 */
-#define VECNUM_CT2 20 /* GPT compare timer 2 */
-#define VECNUM_CT3 21 /* GPT compare timer 3 */
-#define VECNUM_CT4 22 /* GPT compare timer 4 */
-#define VECNUM_EIR0 23 /* External interrupt 0 */
-#define VECNUM_EIR1 24 /* External interrupt 1 */
-#define VECNUM_EIR2 25 /* External interrupt 2 */
-#define VECNUM_EIR3 26 /* External interrupt 3 */
-#define VECNUM_EIR4 27 /* External interrupt 4 */
-#define VECNUM_EIR5 28 /* External interrupt 5 */
-#define VECNUM_EIR6 29 /* External interrupt 6 */
-#define VECNUM_UIC1NC 30 /* UIC1 non-critical interrupt */
-#define VECNUM_UIC1C 31 /* UIC1 critical interrupt */
-
-/* UIC 1 */
-#define VECNUM_MS (32 + 0 ) /* MAL SERR */
-#define VECNUM_TXDE (32 + 1 ) /* MAL TXDE */
-#define VECNUM_RXDE (32 + 2 ) /* MAL RXDE */
-#define VECNUM_USBDEV (32 + 23) /* USB 1.1/USB 2.0 Device */
-#define VECNUM_ETH0 (32 + 28) /* Ethernet 0 interrupt status */
-#define VECNUM_EWU0 (32 + 29) /* Ethernet 0 wakeup */
-
-#else /* !defined(CONFIG_440) */
-
-#define VECNUM_U0 0 /* UART0 */
-#define VECNUM_U1 1 /* UART1 */
-#define VECNUM_D0 5 /* DMA channel 0 */
-#define VECNUM_D1 6 /* DMA channel 1 */
-#define VECNUM_D2 7 /* DMA channel 2 */
-#define VECNUM_D3 8 /* DMA channel 3 */
-#define VECNUM_EWU0 9 /* Ethernet wakeup */
-#define VECNUM_MS 10 /* MAL SERR */
-#define VECNUM_MTE 11 /* MAL TXEOB */
-#define VECNUM_MRE 12 /* MAL RXEOB */
-#define VECNUM_TXDE 13 /* MAL TXDE */
-#define VECNUM_RXDE 14 /* MAL RXDE */
-#define VECNUM_ETH0 15 /* Ethernet interrupt status */
-#define VECNUM_EIR0 25 /* External interrupt 0 */
-#define VECNUM_EIR1 26 /* External interrupt 1 */
-#define VECNUM_EIR2 27 /* External interrupt 2 */
-#define VECNUM_EIR3 28 /* External interrupt 3 */
-#define VECNUM_EIR4 29 /* External interrupt 4 */
-#define VECNUM_EIR5 30 /* External interrupt 5 */
-#define VECNUM_EIR6 31 /* External interrupt 6 */
-
-#endif /* defined(CONFIG_440) */
-
-#endif /* _VECNUMS_H_ */
diff --git a/cpu/pxa/Makefile b/cpu/pxa/Makefile
deleted file mode 100644
index cded7ffd35..0000000000
--- a/cpu/pxa/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = serial.o interrupts.o cpu.o i2c.o pxafb.o mmc.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/pxa/config.mk b/cpu/pxa/config.mk
deleted file mode 100644
index fb810ca7c2..0000000000
--- a/cpu/pxa/config.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# (C) Copyright 2002
-# Sysgo Real-Time Solutions, GmbH <www.elinos.com>
-# Marius Groeger <mgroeger@sysgo.de>
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \
- -msoft-float
-
-#PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=strongarm1100
-PLATFORM_CPPFLAGS += -march=armv5 -mtune=xscale
-# =========================================================================
-#
-# Supply options according to compiler version
-#
-# ========================================================================
-PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
diff --git a/cpu/pxa/cpu.c b/cpu/pxa/cpu.c
deleted file mode 100644
index 6116b49c13..0000000000
--- a/cpu/pxa/cpu.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * CPU specific code
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/arch/pxa-regs.h>
-
-#ifndef CONFIG_CPU_MONAHANS
-void set_GPIO_mode(int gpio_mode)
-{
- int gpio = gpio_mode & GPIO_MD_MASK_NR;
- int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
- int gafr;
-
- if (gpio_mode & GPIO_MD_MASK_DIR)
- {
- GPDR(gpio) |= GPIO_bit(gpio);
- }
- else
- {
- GPDR(gpio) &= ~GPIO_bit(gpio);
- }
- gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
- GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2));
-}
-#endif /* CONFIG_CPU_MONAHANS */
diff --git a/cpu/pxa/i2c.c b/cpu/pxa/i2c.c
deleted file mode 100644
index 722d949473..0000000000
--- a/cpu/pxa/i2c.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * (C) Copyright 2000
- * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
- *
- * (C) Copyright 2000 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2003 Pengutronix e.K.
- * Robert Schwebel <r.schwebel@pengutronix.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- * Back ported to the 8xx platform (from the 8260 platform) by
- * Murray.Jensen@cmst.csiro.au, 27-Jan-01.
- */
-
-/* FIXME: this file is PXA255 specific! What about other XScales? */
-
-#include <common.h>
-
-#ifdef CONFIG_HARD_I2C
-
-/*
- * - CFG_I2C_SPEED
- * - I2C_PXA_SLAVE_ADDR
- */
-
-#include <asm/arch/hardware.h>
-#include <asm/arch/pxa-regs.h>
-#include <i2c.h>
-
-/*#define DEBUG_I2C 1 /###* activate local debugging output */
-#define I2C_PXA_SLAVE_ADDR 0x1 /* slave pxa unit address */
-
-#if (CFG_I2C_SPEED == 400000)
-#define I2C_ICR_INIT (ICR_FM | ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE)
-#else
-#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE)
-#endif
-
-#define I2C_ISR_INIT 0x7FF
-
-#ifdef DEBUG_I2C
-#define PRINTD(x) printf x
-#else
-#define PRINTD(x)
-#endif
-
-
-/* Shall the current transfer have a start/stop condition? */
-#define I2C_COND_NORMAL 0
-#define I2C_COND_START 1
-#define I2C_COND_STOP 2
-
-/* Shall the current transfer be ack/nacked or being waited for it? */
-#define I2C_ACKNAK_WAITACK 1
-#define I2C_ACKNAK_SENDACK 2
-#define I2C_ACKNAK_SENDNAK 4
-
-/* Specify who shall transfer the data (master or slave) */
-#define I2C_READ 0
-#define I2C_WRITE 1
-
-/* All transfers are described by this data structure */
-struct i2c_msg {
- u8 condition;
- u8 acknack;
- u8 direction;
- u8 data;
-};
-
-
-/**
- * i2c_pxa_reset: - reset the host controller
- *
- */
-
-static void i2c_reset( void )
-{
- ICR &= ~ICR_IUE; /* disable unit */
- ICR |= ICR_UR; /* reset the unit */
- udelay(100);
- ICR &= ~ICR_IUE; /* disable unit */
-#ifdef CONFIG_CPU_MONAHANS
- CKENB |= (CKENB_4_I2C); /* | CKENB_1_PWM1 | CKENB_0_PWM0); */
-#else /* CONFIG_CPU_MONAHANS */
- CKEN |= CKEN14_I2C; /* set the global I2C clock on */
-#endif
- ISAR = I2C_PXA_SLAVE_ADDR; /* set our slave address */
- ICR = I2C_ICR_INIT; /* set control register values */
- ISR = I2C_ISR_INIT; /* set clear interrupt bits */
- ICR |= ICR_IUE; /* enable unit */
- udelay(100);
-}
-
-
-/**
- * i2c_isr_set_cleared: - wait until certain bits of the I2C status register
- * are set and cleared
- *
- * @return: 1 in case of success, 0 means timeout (no match within 10 ms).
- */
-static int i2c_isr_set_cleared( unsigned long set_mask, unsigned long cleared_mask )
-{
- int timeout = 10000;
-
- while( ((ISR & set_mask)!=set_mask) || ((ISR & cleared_mask)!=0) ){
- udelay( 10 );
- if( timeout-- < 0 ) return 0;
- }
-
- return 1;
-}
-
-
-/**
- * i2c_transfer: - Transfer one byte over the i2c bus
- *
- * This function can tranfer a byte over the i2c bus in both directions.
- * It is used by the public API functions.
- *
- * @return: 0: transfer successful
- * -1: message is empty
- * -2: transmit timeout
- * -3: ACK missing
- * -4: receive timeout
- * -5: illegal parameters
- * -6: bus is busy and couldn't be aquired
- */
-int i2c_transfer(struct i2c_msg *msg)
-{
- int ret;
-
- if (!msg)
- goto transfer_error_msg_empty;
-
- switch(msg->direction) {
-
- case I2C_WRITE:
-
- /* check if bus is not busy */
- if (!i2c_isr_set_cleared(0,ISR_IBB))
- goto transfer_error_bus_busy;
-
- /* start transmission */
- ICR &= ~ICR_START;
- ICR &= ~ICR_STOP;
- IDBR = msg->data;
- if (msg->condition == I2C_COND_START) ICR |= ICR_START;
- if (msg->condition == I2C_COND_STOP) ICR |= ICR_STOP;
- if (msg->acknack == I2C_ACKNAK_SENDNAK) ICR |= ICR_ACKNAK;
- if (msg->acknack == I2C_ACKNAK_SENDACK) ICR &= ~ICR_ACKNAK;
- ICR &= ~ICR_ALDIE;
- ICR |= ICR_TB;
-
- /* transmit register empty? */
- if (!i2c_isr_set_cleared(ISR_ITE,0))
- goto transfer_error_transmit_timeout;
-
- /* clear 'transmit empty' state */
- ISR |= ISR_ITE;
-
- /* wait for ACK from slave */
- if (msg->acknack == I2C_ACKNAK_WAITACK)
- if (!i2c_isr_set_cleared(0,ISR_ACKNAK))
- goto transfer_error_ack_missing;
- break;
-
- case I2C_READ:
-
- /* check if bus is not busy */
- if (!i2c_isr_set_cleared(0,ISR_IBB))
- goto transfer_error_bus_busy;
-
- /* start receive */
- ICR &= ~ICR_START;
- ICR &= ~ICR_STOP;
- if (msg->condition == I2C_COND_START) ICR |= ICR_START;
- if (msg->condition == I2C_COND_STOP) ICR |= ICR_STOP;
- if (msg->acknack == I2C_ACKNAK_SENDNAK) ICR |= ICR_ACKNAK;
- if (msg->acknack == I2C_ACKNAK_SENDACK) ICR &= ~ICR_ACKNAK;
- ICR &= ~ICR_ALDIE;
- ICR |= ICR_TB;
-
- /* receive register full? */
- if (!i2c_isr_set_cleared(ISR_IRF,0))
- goto transfer_error_receive_timeout;
-
- msg->data = IDBR;
-
- /* clear 'receive empty' state */
- ISR |= ISR_IRF;
-
- break;
-
- default:
-
- goto transfer_error_illegal_param;
-
- }
-
- return 0;
-
-transfer_error_msg_empty:
- PRINTD(("i2c_transfer: error: 'msg' is empty\n"));
- ret = -1; goto i2c_transfer_finish;
-
-transfer_error_transmit_timeout:
- PRINTD(("i2c_transfer: error: transmit timeout\n"));
- ret = -2; goto i2c_transfer_finish;
-
-transfer_error_ack_missing:
- PRINTD(("i2c_transfer: error: ACK missing\n"));
- ret = -3; goto i2c_transfer_finish;
-
-transfer_error_receive_timeout:
- PRINTD(("i2c_transfer: error: receive timeout\n"));
- ret = -4; goto i2c_transfer_finish;
-
-transfer_error_illegal_param:
- PRINTD(("i2c_transfer: error: illegal parameters\n"));
- ret = -5; goto i2c_transfer_finish;
-
-transfer_error_bus_busy:
- PRINTD(("i2c_transfer: error: bus is busy\n"));
- ret = -6; goto i2c_transfer_finish;
-
-i2c_transfer_finish:
- PRINTD(("i2c_transfer: ISR: 0x%04x\n",ISR));
- i2c_reset();
- return ret;
-
-}
-
-/* ------------------------------------------------------------------------ */
-/* API Functions */
-/* ------------------------------------------------------------------------ */
-
-void i2c_init(int speed, int slaveaddr)
-{
-#ifdef CFG_I2C_INIT_BOARD
- /* call board specific i2c bus reset routine before accessing the */
- /* environment, which might be in a chip on that bus. For details */
- /* about this problem see doc/I2C_Edge_Conditions. */
- i2c_init_board();
-#endif
-}
-
-
-/**
- * i2c_probe: - Test if a chip answers for a given i2c address
- *
- * @chip: address of the chip which is searched for
- * @return: 0 if a chip was found, -1 otherwhise
- */
-
-int i2c_probe(uchar chip)
-{
- struct i2c_msg msg;
-
- i2c_reset();
-
- msg.condition = I2C_COND_START;
- msg.acknack = I2C_ACKNAK_WAITACK;
- msg.direction = I2C_WRITE;
- msg.data = (chip << 1) + 1;
- if (i2c_transfer(&msg)) return -1;
-
- msg.condition = I2C_COND_STOP;
- msg.acknack = I2C_ACKNAK_SENDNAK;
- msg.direction = I2C_READ;
- msg.data = 0x00;
- if (i2c_transfer(&msg)) return -1;
-
- return 0;
-}
-
-
-/**
- * i2c_read: - Read multiple bytes from an i2c device
- *
- * The higher level routines take into account that this function is only
- * called with len < page length of the device (see configuration file)
- *
- * @chip: address of the chip which is to be read
- * @addr: i2c data address within the chip
- * @alen: length of the i2c data address (1..2 bytes)
- * @buffer: where to write the data
- * @len: how much byte do we want to read
- * @return: 0 in case of success
- */
-
-int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
-{
- struct i2c_msg msg;
- u8 addr_bytes[3]; /* lowest...highest byte of data address */
- int ret;
-
- PRINTD(("i2c_read(chip=0x%02x, addr=0x%02x, alen=0x%02x, len=0x%02x)\n",chip,addr,alen,len));
-
- i2c_reset();
-
- /* dummy chip address write */
- PRINTD(("i2c_read: dummy chip address write\n"));
- msg.condition = I2C_COND_START;
- msg.acknack = I2C_ACKNAK_WAITACK;
- msg.direction = I2C_WRITE;
- msg.data = (chip << 1);
- msg.data &= 0xFE;
- if ((ret=i2c_transfer(&msg))) return -1;
-
- /*
- * send memory address bytes;
- * alen defines how much bytes we have to send.
- */
- /*addr &= ((1 << CFG_EEPROM_PAGE_WRITE_BITS)-1); */
- addr_bytes[0] = (u8)((addr >> 0) & 0x000000FF);
- addr_bytes[1] = (u8)((addr >> 8) & 0x000000FF);
- addr_bytes[2] = (u8)((addr >> 16) & 0x000000FF);
-
- while (--alen >= 0) {
-
- PRINTD(("i2c_read: send memory word address byte %1d\n",alen));
- msg.condition = I2C_COND_NORMAL;
- msg.acknack = I2C_ACKNAK_WAITACK;
- msg.direction = I2C_WRITE;
- msg.data = addr_bytes[alen];
- if ((ret=i2c_transfer(&msg))) return -1;
- }
-
-
- /* start read sequence */
- PRINTD(("i2c_read: start read sequence\n"));
- msg.condition = I2C_COND_START;
- msg.acknack = I2C_ACKNAK_WAITACK;
- msg.direction = I2C_WRITE;
- msg.data = (chip << 1);
- msg.data |= 0x01;
- if ((ret=i2c_transfer(&msg))) return -1;
-
- /* read bytes; send NACK at last byte */
- while (len--) {
-
- if (len==0) {
- msg.condition = I2C_COND_STOP;
- msg.acknack = I2C_ACKNAK_SENDNAK;
- } else {
- msg.condition = I2C_COND_NORMAL;
- msg.acknack = I2C_ACKNAK_SENDACK;
- }
-
- msg.direction = I2C_READ;
- msg.data = 0x00;
- if ((ret=i2c_transfer(&msg))) return -1;
-
- *buffer = msg.data;
- PRINTD(("i2c_read: reading byte (0x%08x)=0x%02x\n",(unsigned int)buffer,*buffer));
- buffer++;
-
- }
-
- i2c_reset();
-
- return 0;
-}
-
-
-/**
- * i2c_write: - Write multiple bytes to an i2c device
- *
- * The higher level routines take into account that this function is only
- * called with len < page length of the device (see configuration file)
- *
- * @chip: address of the chip which is to be written
- * @addr: i2c data address within the chip
- * @alen: length of the i2c data address (1..2 bytes)
- * @buffer: where to find the data to be written
- * @len: how much byte do we want to read
- * @return: 0 in case of success
- */
-
-int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
-{
- struct i2c_msg msg;
- u8 addr_bytes[3]; /* lowest...highest byte of data address */
-
- PRINTD(("i2c_write(chip=0x%02x, addr=0x%02x, alen=0x%02x, len=0x%02x)\n",chip,addr,alen,len));
-
- i2c_reset();
-
- /* chip address write */
- PRINTD(("i2c_write: chip address write\n"));
- msg.condition = I2C_COND_START;
- msg.acknack = I2C_ACKNAK_WAITACK;
- msg.direction = I2C_WRITE;
- msg.data = (chip << 1);
- msg.data &= 0xFE;
- if (i2c_transfer(&msg)) return -1;
-
- /*
- * send memory address bytes;
- * alen defines how much bytes we have to send.
- */
- addr_bytes[0] = (u8)((addr >> 0) & 0x000000FF);
- addr_bytes[1] = (u8)((addr >> 8) & 0x000000FF);
- addr_bytes[2] = (u8)((addr >> 16) & 0x000000FF);
-
- while (--alen >= 0) {
-
- PRINTD(("i2c_write: send memory word address\n"));
- msg.condition = I2C_COND_NORMAL;
- msg.acknack = I2C_ACKNAK_WAITACK;
- msg.direction = I2C_WRITE;
- msg.data = addr_bytes[alen];
- if (i2c_transfer(&msg)) return -1;
- }
-
- /* write bytes; send NACK at last byte */
- while (len--) {
-
- PRINTD(("i2c_write: writing byte (0x%08x)=0x%02x\n",(unsigned int)buffer,*buffer));
-
- if (len==0)
- msg.condition = I2C_COND_STOP;
- else
- msg.condition = I2C_COND_NORMAL;
-
- msg.acknack = I2C_ACKNAK_WAITACK;
- msg.direction = I2C_WRITE;
- msg.data = *(buffer++);
-
- if (i2c_transfer(&msg)) return -1;
-
- }
-
- i2c_reset();
-
- return 0;
-
-}
-
-uchar i2c_reg_read (uchar chip, uchar reg)
-{
- char buf;
-
- PRINTD(("i2c_reg_read(chip=0x%02x, reg=0x%02x)\n",chip,reg));
- i2c_read(chip, reg, 1, &buf, 1);
- return (buf);
-}
-
-void i2c_reg_write(uchar chip, uchar reg, uchar val)
-{
- PRINTD(("i2c_reg_write(chip=0x%02x, reg=0x%02x, val=0x%02x)\n",chip,reg,val));
- i2c_write(chip, reg, 1, &val, 1);
-}
-
-#endif /* CONFIG_HARD_I2C */
diff --git a/cpu/pxa/interrupts.c b/cpu/pxa/interrupts.c
deleted file mode 100644
index 6455ad02c6..0000000000
--- a/cpu/pxa/interrupts.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/arch/pxa-regs.h>
-
-#ifdef CONFIG_USE_IRQ
-/* enable IRQ/FIQ interrupts */
-void enable_interrupts (void)
-{
-#error: interrupts not implemented yet
-}
-
-
-/*
- * disable IRQ/FIQ interrupts
- * returns true if interrupts had been enabled before we disabled them
- */
-int disable_interrupts (void)
-{
-#error: interrupts not implemented yet
-}
-#else
-void enable_interrupts (void)
-{
- return;
-}
-int disable_interrupts (void)
-{
- return 0;
-}
-#endif
-
-
-void bad_mode (void)
-{
- panic ("Resetting CPU ...\n");
- reset_cpu (0);
-}
-
-void show_regs (struct pt_regs *regs)
-{
- unsigned long flags;
- const char *processor_modes[] = {
- "USER_26", "FIQ_26", "IRQ_26", "SVC_26",
- "UK4_26", "UK5_26", "UK6_26", "UK7_26",
- "UK8_26", "UK9_26", "UK10_26", "UK11_26",
- "UK12_26", "UK13_26", "UK14_26", "UK15_26",
- "USER_32", "FIQ_32", "IRQ_32", "SVC_32",
- "UK4_32", "UK5_32", "UK6_32", "ABT_32",
- "UK8_32", "UK9_32", "UK10_32", "UND_32",
- "UK12_32", "UK13_32", "UK14_32", "SYS_32"
- };
-
- flags = condition_codes (regs);
-
- printf ("pc : [<%08lx>] lr : [<%08lx>]\n"
- "sp : %08lx ip : %08lx fp : %08lx\n",
- instruction_pointer (regs),
- regs->ARM_lr, regs->ARM_sp, regs->ARM_ip, regs->ARM_fp);
- printf ("r10: %08lx r9 : %08lx r8 : %08lx\n",
- regs->ARM_r10, regs->ARM_r9, regs->ARM_r8);
- printf ("r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n",
- regs->ARM_r7, regs->ARM_r6, regs->ARM_r5, regs->ARM_r4);
- printf ("r3 : %08lx r2 : %08lx r1 : %08lx r0 : %08lx\n",
- regs->ARM_r3, regs->ARM_r2, regs->ARM_r1, regs->ARM_r0);
- printf ("Flags: %c%c%c%c",
- flags & CC_N_BIT ? 'N' : 'n',
- flags & CC_Z_BIT ? 'Z' : 'z',
- flags & CC_C_BIT ? 'C' : 'c', flags & CC_V_BIT ? 'V' : 'v');
- printf (" IRQs %s FIQs %s Mode %s%s\n",
- interrupts_enabled (regs) ? "on" : "off",
- fast_interrupts_enabled (regs) ? "on" : "off",
- processor_modes[processor_mode (regs)],
- thumb_mode (regs) ? " (T)" : "");
-}
-
-void do_undefined_instruction (struct pt_regs *pt_regs)
-{
- printf ("undefined instruction\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_software_interrupt (struct pt_regs *pt_regs)
-{
- printf ("software interrupt\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_prefetch_abort (struct pt_regs *pt_regs)
-{
- printf ("prefetch abort\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_data_abort (struct pt_regs *pt_regs)
-{
- printf ("data abort\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_not_used (struct pt_regs *pt_regs)
-{
- printf ("not used\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_fiq (struct pt_regs *pt_regs)
-{
- printf ("fast interrupt request\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_irq (struct pt_regs *pt_regs)
-{
- printf ("interrupt request\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-
-int interrupt_init (void)
-{
- /* nothing happens here - we don't setup any IRQs */
- return (0);
-}
-
-void reset_timer (void)
-{
- reset_timer_masked ();
-}
-
-ulong get_timer (ulong base)
-{
- return get_timer_masked () - base;
-}
-
-void set_timer (ulong t)
-{
- /* nop */
-}
-
-void reset_timer_masked (void)
-{
- OSCR = 0;
-}
-
-ulong get_timer_masked (void)
-{
- return OSCR;
-}
diff --git a/cpu/pxa/mmc.c b/cpu/pxa/mmc.c
deleted file mode 100644
index f7020eec95..0000000000
--- a/cpu/pxa/mmc.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * (C) Copyright 2003
- * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <common.h>
-#include <mmc.h>
-#include <asm/errno.h>
-#include <asm/arch/hardware.h>
-#include <part.h>
-
-#ifdef CONFIG_MMC
-
-extern int
-fat_register_device(block_dev_desc_t *dev_desc, int part_no);
-
-static block_dev_desc_t mmc_dev;
-
-block_dev_desc_t * mmc_get_dev(int dev)
-{
- return ((block_dev_desc_t *)&mmc_dev);
-}
-
-/*
- * FIXME needs to read cid and csd info to determine block size
- * and other parameters
- */
-static uchar mmc_buf[MMC_BLOCK_SIZE];
-static mmc_csd_t mmc_csd;
-static int mmc_ready = 0;
-
-
-static uchar *
-/****************************************************/
-mmc_cmd(ushort cmd, ushort argh, ushort argl, ushort cmdat)
-/****************************************************/
-{
- static uchar resp[20];
- ulong status;
- int words, i;
-
- debug("mmc_cmd %x %x %x %x\n", cmd, argh, argl, cmdat);
- MMC_STRPCL = MMC_STRPCL_STOP_CLK;
- MMC_I_MASK = ~MMC_I_MASK_CLK_IS_OFF;
- while (!(MMC_I_REG & MMC_I_REG_CLK_IS_OFF));
- MMC_CMD = cmd;
- MMC_ARGH = argh;
- MMC_ARGL = argl;
- MMC_CMDAT = cmdat;
- MMC_I_MASK = ~MMC_I_MASK_END_CMD_RES;
- MMC_STRPCL = MMC_STRPCL_START_CLK;
- while (!(MMC_I_REG & MMC_I_REG_END_CMD_RES));
-
- status = MMC_STAT;
- debug("MMC status %x\n", status);
- if (status & MMC_STAT_TIME_OUT_RESPONSE) {
- return 0;
- }
-
- switch (cmdat & 0x3) {
- case MMC_CMDAT_R1:
- case MMC_CMDAT_R3:
- words = 3;
- break;
-
- case MMC_CMDAT_R2:
- words = 8;
- break;
-
- default:
- return 0;
- }
- for (i = words-1; i >= 0; i--) {
- ulong res_fifo = MMC_RES;
- int offset = i << 1;
-
- resp[offset] = ((uchar *)&res_fifo)[0];
- resp[offset+1] = ((uchar *)&res_fifo)[1];
- }
-#ifdef MMC_DEBUG
- for (i=0; i<words*2; i += 2) {
- printf("MMC resp[%d] = %02x\n", i, resp[i]);
- printf("MMC resp[%d] = %02x\n", i+1, resp[i+1]);
- }
-#endif
- return resp;
-}
-
-int
-/****************************************************/
-mmc_block_read(uchar *dst, ulong src, ulong len)
-/****************************************************/
-{
- uchar *resp;
- ushort argh, argl;
- ulong status;
-
- if (len == 0) {
- return 0;
- }
-
- debug("mmc_block_rd dst %lx src %lx len %d\n", (ulong)dst, src, len);
-
- argh = len >> 16;
- argl = len & 0xffff;
-
- /* set block len */
- resp = mmc_cmd(MMC_CMD_SET_BLOCKLEN, argh, argl, MMC_CMDAT_R1);
-
- /* send read command */
- argh = src >> 16;
- argl = src & 0xffff;
- MMC_STRPCL = MMC_STRPCL_STOP_CLK;
- MMC_RDTO = 0xffff;
- MMC_NOB = 1;
- MMC_BLKLEN = len;
- resp = mmc_cmd(MMC_CMD_READ_BLOCK, argh, argl,
- MMC_CMDAT_R1|MMC_CMDAT_READ|MMC_CMDAT_BLOCK|MMC_CMDAT_DATA_EN);
-
-
- MMC_I_MASK = ~MMC_I_MASK_RXFIFO_RD_REQ;
- while (len) {
- if (MMC_I_REG & MMC_I_REG_RXFIFO_RD_REQ) {
-#ifdef CONFIG_PXA27X
- int i;
- for (i=min(len,32); i; i--) {
- *dst++ = * ((volatile uchar *) &MMC_RXFIFO);
- len--;
- }
-#else
- *dst++ = MMC_RXFIFO;
- len--;
-#endif
- }
- status = MMC_STAT;
- if (status & MMC_STAT_ERRORS) {
- printf("MMC_STAT error %lx\n", status);
- return -1;
- }
- }
- MMC_I_MASK = ~MMC_I_MASK_DATA_TRAN_DONE;
- while (!(MMC_I_REG & MMC_I_REG_DATA_TRAN_DONE));
- status = MMC_STAT;
- if (status & MMC_STAT_ERRORS) {
- printf("MMC_STAT error %lx\n", status);
- return -1;
- }
- return 0;
-}
-
-int
-/****************************************************/
-mmc_block_write(ulong dst, uchar *src, int len)
-/****************************************************/
-{
- uchar *resp;
- ushort argh, argl;
- ulong status;
-
- if (len == 0) {
- return 0;
- }
-
- debug("mmc_block_wr dst %lx src %lx len %d\n", dst, (ulong)src, len);
-
- argh = len >> 16;
- argl = len & 0xffff;
-
- /* set block len */
- resp = mmc_cmd(MMC_CMD_SET_BLOCKLEN, argh, argl, MMC_CMDAT_R1);
-
- /* send write command */
- argh = dst >> 16;
- argl = dst & 0xffff;
- MMC_STRPCL = MMC_STRPCL_STOP_CLK;
- MMC_NOB = 1;
- MMC_BLKLEN = len;
- resp = mmc_cmd(MMC_CMD_WRITE_BLOCK, argh, argl,
- MMC_CMDAT_R1|MMC_CMDAT_WRITE|MMC_CMDAT_BLOCK|MMC_CMDAT_DATA_EN);
-
- MMC_I_MASK = ~MMC_I_MASK_TXFIFO_WR_REQ;
- while (len) {
- if (MMC_I_REG & MMC_I_REG_TXFIFO_WR_REQ) {
- int i, bytes = min(32,len);
-
- for (i=0; i<bytes; i++) {
- MMC_TXFIFO = *src++;
- }
- if (bytes < 32) {
- MMC_PRTBUF = MMC_PRTBUF_BUF_PART_FULL;
- }
- len -= bytes;
- }
- status = MMC_STAT;
- if (status & MMC_STAT_ERRORS) {
- printf("MMC_STAT error %lx\n", status);
- return -1;
- }
- }
- MMC_I_MASK = ~MMC_I_MASK_DATA_TRAN_DONE;
- while (!(MMC_I_REG & MMC_I_REG_DATA_TRAN_DONE));
- MMC_I_MASK = ~MMC_I_MASK_PRG_DONE;
- while (!(MMC_I_REG & MMC_I_REG_PRG_DONE));
- status = MMC_STAT;
- if (status & MMC_STAT_ERRORS) {
- printf("MMC_STAT error %lx\n", status);
- return -1;
- }
- return 0;
-}
-
-
-int
-/****************************************************/
-mmc_read(ulong src, uchar *dst, int size)
-/****************************************************/
-{
- ulong end, part_start, part_end, part_len, aligned_start, aligned_end;
- ulong mmc_block_size, mmc_block_address;
-
- if (size == 0) {
- return 0;
- }
-
- if (!mmc_ready) {
- printf("Please initial the MMC first\n");
- return -1;
- }
-
- mmc_block_size = MMC_BLOCK_SIZE;
- mmc_block_address = ~(mmc_block_size - 1);
-
- src -= CFG_MMC_BASE;
- end = src + size;
- part_start = ~mmc_block_address & src;
- part_end = ~mmc_block_address & end;
- aligned_start = mmc_block_address & src;
- aligned_end = mmc_block_address & end;
-
- /* all block aligned accesses */
- debug("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
- if (part_start) {
- part_len = mmc_block_size - part_start;
- debug("ps src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
- if ((mmc_block_read(mmc_buf, aligned_start, mmc_block_size)) < 0) {
- return -1;
- }
- memcpy(dst, mmc_buf+part_start, part_len);
- dst += part_len;
- src += part_len;
- }
- debug("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
- for (; src < aligned_end; src += mmc_block_size, dst += mmc_block_size) {
- debug("al src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
- if ((mmc_block_read((uchar *)(dst), src, mmc_block_size)) < 0) {
- return -1;
- }
- }
- debug("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
- if (part_end && src < end) {
- debug("pe src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
- if ((mmc_block_read(mmc_buf, aligned_end, mmc_block_size)) < 0) {
- return -1;
- }
- memcpy(dst, mmc_buf, part_end);
- }
- return 0;
-}
-
-int
-/****************************************************/
-mmc_write(uchar *src, ulong dst, int size)
-/****************************************************/
-{
- ulong end, part_start, part_end, part_len, aligned_start, aligned_end;
- ulong mmc_block_size, mmc_block_address;
-
- if (size == 0) {
- return 0;
- }
-
- if (!mmc_ready) {
- printf("Please initial the MMC first\n");
- return -1;
- }
-
- mmc_block_size = MMC_BLOCK_SIZE;
- mmc_block_address = ~(mmc_block_size - 1);
-
- dst -= CFG_MMC_BASE;
- end = dst + size;
- part_start = ~mmc_block_address & dst;
- part_end = ~mmc_block_address & end;
- aligned_start = mmc_block_address & dst;
- aligned_end = mmc_block_address & end;
-
- /* all block aligned accesses */
- debug("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
- if (part_start) {
- part_len = mmc_block_size - part_start;
- debug("ps src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- (ulong)src, dst, end, part_start, part_end, aligned_start, aligned_end);
- if ((mmc_block_read(mmc_buf, aligned_start, mmc_block_size)) < 0) {
- return -1;
- }
- memcpy(mmc_buf+part_start, src, part_len);
- if ((mmc_block_write(aligned_start, mmc_buf, mmc_block_size)) < 0) {
- return -1;
- }
- dst += part_len;
- src += part_len;
- }
- debug("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
- for (; dst < aligned_end; src += mmc_block_size, dst += mmc_block_size) {
- debug("al src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
- if ((mmc_block_write(dst, (uchar *)src, mmc_block_size)) < 0) {
- return -1;
- }
- }
- debug("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
- if (part_end && dst < end) {
- debug("pe src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
- src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
- if ((mmc_block_read(mmc_buf, aligned_end, mmc_block_size)) < 0) {
- return -1;
- }
- memcpy(mmc_buf, src, part_end);
- if ((mmc_block_write(aligned_end, mmc_buf, mmc_block_size)) < 0) {
- return -1;
- }
- }
- return 0;
-}
-
-ulong
-/****************************************************/
-mmc_bread(int dev_num, ulong blknr, ulong blkcnt, ulong *dst)
-/****************************************************/
-{
- int mmc_block_size = MMC_BLOCK_SIZE;
- ulong src = blknr * mmc_block_size + CFG_MMC_BASE;
-
- mmc_read(src, (uchar *)dst, blkcnt*mmc_block_size);
- return blkcnt;
-}
-
-int
-/****************************************************/
-mmc_init(int verbose)
-/****************************************************/
-{
- int retries, rc = -ENODEV;
- uchar *resp;
-
-#ifdef CONFIG_LUBBOCK
- set_GPIO_mode( GPIO6_MMCCLK_MD );
- set_GPIO_mode( GPIO8_MMCCS0_MD );
-#endif
- CKEN |= CKEN12_MMC; /* enable MMC unit clock */
-#if defined(CONFIG_ADSVIX)
- /* turn on the power */
- GPCR(114) = GPIO_bit(114);
- udelay(1000);
-#endif
-
- mmc_csd.c_size = 0;
-
- MMC_CLKRT = MMC_CLKRT_0_3125MHZ;
- MMC_RESTO = MMC_RES_TO_MAX;
- MMC_SPI = MMC_SPI_DISABLE;
-
- /* reset */
- retries = 10;
- resp = mmc_cmd(0, 0, 0, 0);
- resp = mmc_cmd(1, 0x00ff, 0xc000, MMC_CMDAT_INIT|MMC_CMDAT_BUSY|MMC_CMDAT_R3);
- while (retries-- && resp && !(resp[4] & 0x80)) {
- debug("resp %x %x\n", resp[0], resp[1]);
-#ifdef CONFIG_PXA27X
- udelay(10000);
-#else
- udelay(50);
-#endif
- resp = mmc_cmd(1, 0x00ff, 0xff00, MMC_CMDAT_BUSY|MMC_CMDAT_R3);
- }
-
- /* try to get card id */
- resp = mmc_cmd(2, 0, 0, MMC_CMDAT_R2);
- if (resp) {
- /* TODO configure mmc driver depending on card attributes */
- mmc_cid_t *cid = (mmc_cid_t *)resp;
- if (verbose) {
- printf("MMC found. Card desciption is:\n");
- printf("Manufacturer ID = %02x%02x%02x\n",
- cid->id[0], cid->id[1], cid->id[2]);
- printf("HW/FW Revision = %x %x\n",cid->hwrev, cid->fwrev);
- cid->hwrev = cid->fwrev = 0; /* null terminate string */
- printf("Product Name = %s\n",cid->name);
- printf("Serial Number = %02x%02x%02x\n",
- cid->sn[0], cid->sn[1], cid->sn[2]);
- printf("Month = %d\n",cid->month);
- printf("Year = %d\n",1997 + cid->year);
- }
- /* fill in device description */
- mmc_dev.if_type = IF_TYPE_MMC;
- mmc_dev.part_type = PART_TYPE_DOS;
- mmc_dev.dev = 0;
- mmc_dev.lun = 0;
- mmc_dev.type = 0;
- /* FIXME fill in the correct size (is set to 32MByte) */
- mmc_dev.blksz = 512;
- mmc_dev.lba = 0x10000;
- sprintf(mmc_dev.vendor,"Man %02x%02x%02x Snr %02x%02x%02x",
- cid->id[0], cid->id[1], cid->id[2],
- cid->sn[0], cid->sn[1], cid->sn[2]);
- sprintf(mmc_dev.product,"%s",cid->name);
- sprintf(mmc_dev.revision,"%x %x",cid->hwrev, cid->fwrev);
- mmc_dev.removable = 0;
- mmc_dev.block_read = mmc_bread;
-
- /* MMC exists, get CSD too */
- resp = mmc_cmd(MMC_CMD_SET_RCA, MMC_DEFAULT_RCA, 0, MMC_CMDAT_R1);
- resp = mmc_cmd(MMC_CMD_SEND_CSD, MMC_DEFAULT_RCA, 0, MMC_CMDAT_R2);
- if (resp) {
- mmc_csd_t *csd = (mmc_csd_t *)resp;
- memcpy(&mmc_csd, csd, sizeof(csd));
- rc = 0;
- mmc_ready = 1;
- /* FIXME add verbose printout for csd */
- }
- }
-
-#ifdef CONFIG_PXA27X
- MMC_CLKRT = 1; /* 10 MHz - see Intel errata */
-#else
- MMC_CLKRT = 0; /* 20 MHz */
-#endif
- resp = mmc_cmd(7, MMC_DEFAULT_RCA, 0, MMC_CMDAT_R1);
-
- fat_register_device(&mmc_dev,1); /* partitions start counting with 1 */
-
- return rc;
-}
-
-int
-mmc_ident(block_dev_desc_t *dev)
-{
- return 0;
-}
-
-int
-mmc2info(ulong addr)
-{
- /* FIXME hard codes to 32 MB device */
- if (addr >= CFG_MMC_BASE && addr < CFG_MMC_BASE + 0x02000000) {
- return 1;
- }
- return 0;
-}
-
-#endif /* CONFIG_MMC */
diff --git a/cpu/pxa/pxafb.c b/cpu/pxa/pxafb.c
deleted file mode 100644
index b2caa73c6c..0000000000
--- a/cpu/pxa/pxafb.c
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * PXA LCD Controller
- *
- * (C) Copyright 2001-2002
- * Wolfgang Denk, DENX Software Engineering -- wd@denx.de
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/************************************************************************/
-/* ** HEADER FILES */
-/************************************************************************/
-
-#include <config.h>
-#include <common.h>
-#include <version.h>
-#include <stdarg.h>
-#include <linux/types.h>
-#include <devices.h>
-#include <lcd.h>
-#include <asm/arch/pxa-regs.h>
-
-/* #define DEBUG */
-
-#ifdef CONFIG_LCD
-
-/*----------------------------------------------------------------------*/
-/*
- * Define panel bpp, LCCR0, LCCR3 and panel_info video struct for
- * your display.
- */
-
-#ifdef CONFIG_PXA_VGA
-/* LCD outputs connected to a video DAC */
-# define LCD_BPP LCD_COLOR8
-
-/* you have to set lccr0 and lccr3 (including pcd) */
-# define REG_LCCR0 0x003008f8
-# define REG_LCCR3 0x0300FF01
-
-/* 640x480x16 @ 61 Hz */
-vidinfo_t panel_info = {
- vl_col: 640,
- vl_row: 480,
- vl_width: 640,
- vl_height: 480,
- vl_clkp: CFG_HIGH,
- vl_oep: CFG_HIGH,
- vl_hsp: CFG_HIGH,
- vl_vsp: CFG_HIGH,
- vl_dp: CFG_HIGH,
- vl_bpix: LCD_BPP,
- vl_lbw: 0,
- vl_splt: 0,
- vl_clor: 0,
- vl_tft: 1,
- vl_hpw: 40,
- vl_blw: 56,
- vl_elw: 56,
- vl_vpw: 20,
- vl_bfw: 8,
- vl_efw: 8,
-};
-#endif /* CONFIG_PXA_VIDEO */
-
-/*----------------------------------------------------------------------*/
-#ifdef CONFIG_SHARP_LM8V31
-
-# define LCD_BPP LCD_COLOR8
-# define LCD_INVERT_COLORS /* Needed for colors to be correct, but why? */
-
-/* you have to set lccr0 and lccr3 (including pcd) */
-# define REG_LCCR0 0x0030087C
-# define REG_LCCR3 0x0340FF08
-
-vidinfo_t panel_info = {
- vl_col: 640,
- vl_row: 480,
- vl_width: 157,
- vl_height: 118,
- vl_clkp: CFG_HIGH,
- vl_oep: CFG_HIGH,
- vl_hsp: CFG_HIGH,
- vl_vsp: CFG_HIGH,
- vl_dp: CFG_HIGH,
- vl_bpix: LCD_BPP,
- vl_lbw: 0,
- vl_splt: 1,
- vl_clor: 1,
- vl_tft: 0,
- vl_hpw: 1,
- vl_blw: 3,
- vl_elw: 3,
- vl_vpw: 1,
- vl_bfw: 0,
- vl_efw: 0,
-};
-#endif /* CONFIG_SHARP_LM8V31 */
-
-/*----------------------------------------------------------------------*/
-#ifdef CONFIG_HITACHI_SX14
-/* Hitachi SX14Q004-ZZA color STN LCD */
-#define LCD_BPP LCD_COLOR8
-
-/* you have to set lccr0 and lccr3 (including pcd) */
-#define REG_LCCR0 0x00301079
-#define REG_LCCR3 0x0340FF20
-
-vidinfo_t panel_info = {
- vl_col: 320,
- vl_row: 240,
- vl_width: 167,
- vl_height: 109,
- vl_clkp: CFG_HIGH,
- vl_oep: CFG_HIGH,
- vl_hsp: CFG_HIGH,
- vl_vsp: CFG_HIGH,
- vl_dp: CFG_HIGH,
- vl_bpix: LCD_BPP,
- vl_lbw: 1,
- vl_splt: 0,
- vl_clor: 1,
- vl_tft: 0,
- vl_hpw: 1,
- vl_blw: 1,
- vl_elw: 1,
- vl_vpw: 7,
- vl_bfw: 0,
- vl_efw: 0,
-};
-#endif /* CONFIG_HITACHI_SX14 */
-
-/*----------------------------------------------------------------------*/
-
-#if LCD_BPP == LCD_COLOR8
-void lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue);
-#endif
-#if LCD_BPP == LCD_MONOCHROME
-void lcd_initcolregs (void);
-#endif
-
-#ifdef NOT_USED_SO_FAR
-void lcd_disable (void);
-void lcd_getcolreg (ushort regno, ushort *red, ushort *green, ushort *blue);
-#endif /* NOT_USED_SO_FAR */
-
-void lcd_ctrl_init (void *lcdbase);
-void lcd_enable (void);
-
-int lcd_line_length;
-int lcd_color_fg;
-int lcd_color_bg;
-
-void *lcd_base; /* Start of framebuffer memory */
-void *lcd_console_address; /* Start of console buffer */
-
-short console_col;
-short console_row;
-
-static int pxafb_init_mem (void *lcdbase, vidinfo_t *vid);
-static void pxafb_setup_gpio (vidinfo_t *vid);
-static void pxafb_enable_controller (vidinfo_t *vid);
-static int pxafb_init (vidinfo_t *vid);
-/************************************************************************/
-
-/************************************************************************/
-/* --------------- PXA chipset specific functions ------------------- */
-/************************************************************************/
-
-void lcd_ctrl_init (void *lcdbase)
-{
- pxafb_init_mem(lcdbase, &panel_info);
- pxafb_init(&panel_info);
- pxafb_setup_gpio(&panel_info);
- pxafb_enable_controller(&panel_info);
-}
-
-/*----------------------------------------------------------------------*/
-#ifdef NOT_USED_SO_FAR
-void
-lcd_getcolreg (ushort regno, ushort *red, ushort *green, ushort *blue)
-{
-}
-#endif /* NOT_USED_SO_FAR */
-
-/*----------------------------------------------------------------------*/
-#if LCD_BPP == LCD_COLOR8
-void
-lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue)
-{
- struct pxafb_info *fbi = &panel_info.pxa;
- unsigned short *palette = (unsigned short *)fbi->palette;
- u_int val;
-
- if (regno < fbi->palette_size) {
- val = ((red << 8) & 0xf800);
- val |= ((green << 4) & 0x07e0);
- val |= (blue & 0x001f);
-
-#ifdef LCD_INVERT_COLORS
- palette[regno] = ~val;
-#else
- palette[regno] = val;
-#endif
- }
-
- debug ("setcolreg: reg %2d @ %p: R=%02X G=%02X B=%02X => %04X\n",
- regno, &palette[regno],
- red, green, blue,
- palette[regno]);
-}
-#endif /* LCD_COLOR8 */
-
-/*----------------------------------------------------------------------*/
-#if LCD_BPP == LCD_MONOCHROME
-void lcd_initcolregs (void)
-{
- struct pxafb_info *fbi = &panel_info.pxa;
- cmap = (ushort *)fbi->palette;
- ushort regno;
-
- for (regno = 0; regno < 16; regno++) {
- cmap[regno * 2] = 0;
- cmap[(regno * 2) + 1] = regno & 0x0f;
- }
-}
-#endif /* LCD_MONOCHROME */
-
-/*----------------------------------------------------------------------*/
-void lcd_enable (void)
-{
-}
-
-/*----------------------------------------------------------------------*/
-#ifdef NOT_USED_SO_FAR
-static void lcd_disable (void)
-{
-}
-#endif /* NOT_USED_SO_FAR */
-
-/*----------------------------------------------------------------------*/
-
-/************************************************************************/
-/* ** PXA255 specific routines */
-/************************************************************************/
-
-/*
- * Calculate fb size for VIDEOLFB_ATAG. Size returned contains fb,
- * descriptors and palette areas.
- */
-ulong calc_fbsize (void)
-{
- ulong size;
- int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
-
- size = line_length * panel_info.vl_row;
- size += PAGE_SIZE;
-
- return size;
-}
-
-static int pxafb_init_mem (void *lcdbase, vidinfo_t *vid)
-{
- u_long palette_mem_size;
- struct pxafb_info *fbi = &vid->pxa;
- int fb_size = vid->vl_row * (vid->vl_col * NBITS (vid->vl_bpix)) / 8;
-
- fbi->screen = (u_long)lcdbase;
-
- fbi->palette_size = NBITS(vid->vl_bpix) == 8 ? 256 : 16;
- palette_mem_size = fbi->palette_size * sizeof(u16);
-
- debug("palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size);
- /* locate palette and descs at end of page following fb */
- fbi->palette = (u_long)lcdbase + fb_size + PAGE_SIZE - palette_mem_size;
-
- return 0;
-}
-
-static void pxafb_setup_gpio (vidinfo_t *vid)
-{
- u_long lccr0;
-
- /*
- * setup is based on type of panel supported
- */
-
- lccr0 = vid->pxa.reg_lccr0;
-
- /* 4 bit interface */
- if ((lccr0 & LCCR0_CMS) && (lccr0 & LCCR0_SDS) && !(lccr0 & LCCR0_DPD))
- {
- debug("Setting GPIO for 4 bit data\n");
- /* bits 58-61 */
- GPDR1 |= (0xf << 26);
- GAFR1_U = (GAFR1_U & ~(0xff << 20)) | (0xaa << 20);
-
- /* bits 74-77 */
- GPDR2 |= (0xf << 10);
- GAFR2_L = (GAFR2_L & ~(0xff << 20)) | (0xaa << 20);
- }
-
- /* 8 bit interface */
- else if (((lccr0 & LCCR0_CMS) && ((lccr0 & LCCR0_SDS) || (lccr0 & LCCR0_DPD))) ||
- (!(lccr0 & LCCR0_CMS) && !(lccr0 & LCCR0_PAS) && !(lccr0 & LCCR0_SDS)))
- {
- debug("Setting GPIO for 8 bit data\n");
- /* bits 58-65 */
- GPDR1 |= (0x3f << 26);
- GPDR2 |= (0x3);
-
- GAFR1_U = (GAFR1_U & ~(0xfff << 20)) | (0xaaa << 20);
- GAFR2_L = (GAFR2_L & ~0xf) | (0xa);
-
- /* bits 74-77 */
- GPDR2 |= (0xf << 10);
- GAFR2_L = (GAFR2_L & ~(0xff << 20)) | (0xaa << 20);
- }
-
- /* 16 bit interface */
- else if (!(lccr0 & LCCR0_CMS) && ((lccr0 & LCCR0_SDS) || (lccr0 & LCCR0_PAS)))
- {
- debug("Setting GPIO for 16 bit data\n");
- /* bits 58-77 */
- GPDR1 |= (0x3f << 26);
- GPDR2 |= 0x00003fff;
-
- GAFR1_U = (GAFR1_U & ~(0xfff << 20)) | (0xaaa << 20);
- GAFR2_L = (GAFR2_L & 0xf0000000) | 0x0aaaaaaa;
- }
- else
- {
- printf("pxafb_setup_gpio: unable to determine bits per pixel\n");
- }
-}
-
-static void pxafb_enable_controller (vidinfo_t *vid)
-{
- debug("Enabling LCD controller\n");
-
- /* Sequence from 11.7.10 */
- LCCR3 = vid->pxa.reg_lccr3;
- LCCR2 = vid->pxa.reg_lccr2;
- LCCR1 = vid->pxa.reg_lccr1;
- LCCR0 = vid->pxa.reg_lccr0 & ~LCCR0_ENB;
- FDADR0 = vid->pxa.fdadr0;
- FDADR1 = vid->pxa.fdadr1;
- LCCR0 |= LCCR0_ENB;
-
- CKEN |= CKEN16_LCD;
-
- debug("FDADR0 = 0x%08x\n", (unsigned int)FDADR0);
- debug("FDADR1 = 0x%08x\n", (unsigned int)FDADR1);
- debug("LCCR0 = 0x%08x\n", (unsigned int)LCCR0);
- debug("LCCR1 = 0x%08x\n", (unsigned int)LCCR1);
- debug("LCCR2 = 0x%08x\n", (unsigned int)LCCR2);
- debug("LCCR3 = 0x%08x\n", (unsigned int)LCCR3);
-}
-
-static int pxafb_init (vidinfo_t *vid)
-{
- struct pxafb_info *fbi = &vid->pxa;
-
- debug("Configuring PXA LCD\n");
-
- fbi->reg_lccr0 = REG_LCCR0;
- fbi->reg_lccr3 = REG_LCCR3;
-
- debug("vid: vl_col=%d hslen=%d lm=%d rm=%d\n",
- vid->vl_col, vid->vl_hpw,
- vid->vl_blw, vid->vl_elw);
- debug("vid: vl_row=%d vslen=%d um=%d bm=%d\n",
- vid->vl_row, vid->vl_vpw,
- vid->vl_bfw, vid->vl_efw);
-
- fbi->reg_lccr1 =
- LCCR1_DisWdth(vid->vl_col) +
- LCCR1_HorSnchWdth(vid->vl_hpw) +
- LCCR1_BegLnDel(vid->vl_blw) +
- LCCR1_EndLnDel(vid->vl_elw);
-
- fbi->reg_lccr2 =
- LCCR2_DisHght(vid->vl_row) +
- LCCR2_VrtSnchWdth(vid->vl_vpw) +
- LCCR2_BegFrmDel(vid->vl_bfw) +
- LCCR2_EndFrmDel(vid->vl_efw);
-
- fbi->reg_lccr3 = REG_LCCR3 & ~(LCCR3_HSP | LCCR3_VSP);
- fbi->reg_lccr3 |= (vid->vl_hsp ? LCCR3_HorSnchL : LCCR3_HorSnchH)
- | (vid->vl_vsp ? LCCR3_VrtSnchL : LCCR3_VrtSnchH);
-
-
- /* setup dma descriptors */
- fbi->dmadesc_fblow = (struct pxafb_dma_descriptor *)((unsigned int)fbi->palette - 3*16);
- fbi->dmadesc_fbhigh = (struct pxafb_dma_descriptor *)((unsigned int)fbi->palette - 2*16);
- fbi->dmadesc_palette = (struct pxafb_dma_descriptor *)((unsigned int)fbi->palette - 1*16);
-
- #define BYTES_PER_PANEL ((fbi->reg_lccr0 & LCCR0_SDS) ? \
- (vid->vl_col * vid->vl_row * NBITS(vid->vl_bpix) / 8 / 2) : \
- (vid->vl_col * vid->vl_row * NBITS(vid->vl_bpix) / 8))
-
- /* populate descriptors */
- fbi->dmadesc_fblow->fdadr = (u_long)fbi->dmadesc_fblow;
- fbi->dmadesc_fblow->fsadr = fbi->screen + BYTES_PER_PANEL;
- fbi->dmadesc_fblow->fidr = 0;
- fbi->dmadesc_fblow->ldcmd = BYTES_PER_PANEL;
-
- fbi->fdadr1 = (u_long)fbi->dmadesc_fblow; /* only used in dual-panel mode */
-
- fbi->dmadesc_fbhigh->fsadr = fbi->screen;
- fbi->dmadesc_fbhigh->fidr = 0;
- fbi->dmadesc_fbhigh->ldcmd = BYTES_PER_PANEL;
-
- fbi->dmadesc_palette->fsadr = fbi->palette;
- fbi->dmadesc_palette->fidr = 0;
- fbi->dmadesc_palette->ldcmd = (fbi->palette_size * 2) | LDCMD_PAL;
-
- if( NBITS(vid->vl_bpix) < 12)
- {
- /* assume any mode with <12 bpp is palette driven */
- fbi->dmadesc_palette->fdadr = (u_long)fbi->dmadesc_fbhigh;
- fbi->dmadesc_fbhigh->fdadr = (u_long)fbi->dmadesc_palette;
- /* flips back and forth between pal and fbhigh */
- fbi->fdadr0 = (u_long)fbi->dmadesc_palette;
- }
- else
- {
- /* palette shouldn't be loaded in true-color mode */
- fbi->dmadesc_fbhigh->fdadr = (u_long)fbi->dmadesc_fbhigh;
- fbi->fdadr0 = (u_long)fbi->dmadesc_fbhigh; /* no pal just fbhigh */
- }
-
- debug("fbi->dmadesc_fblow = 0x%lx\n", (u_long)fbi->dmadesc_fblow);
- debug("fbi->dmadesc_fbhigh = 0x%lx\n", (u_long)fbi->dmadesc_fbhigh);
- debug("fbi->dmadesc_palette = 0x%lx\n", (u_long)fbi->dmadesc_palette);
-
- debug("fbi->dmadesc_fblow->fdadr = 0x%lx\n", fbi->dmadesc_fblow->fdadr);
- debug("fbi->dmadesc_fbhigh->fdadr = 0x%lx\n", fbi->dmadesc_fbhigh->fdadr);
- debug("fbi->dmadesc_palette->fdadr = 0x%lx\n", fbi->dmadesc_palette->fdadr);
-
- debug("fbi->dmadesc_fblow->fsadr = 0x%lx\n", fbi->dmadesc_fblow->fsadr);
- debug("fbi->dmadesc_fbhigh->fsadr = 0x%lx\n", fbi->dmadesc_fbhigh->fsadr);
- debug("fbi->dmadesc_palette->fsadr = 0x%lx\n", fbi->dmadesc_palette->fsadr);
-
- debug("fbi->dmadesc_fblow->ldcmd = 0x%lx\n", fbi->dmadesc_fblow->ldcmd);
- debug("fbi->dmadesc_fbhigh->ldcmd = 0x%lx\n", fbi->dmadesc_fbhigh->ldcmd);
- debug("fbi->dmadesc_palette->ldcmd = 0x%lx\n", fbi->dmadesc_palette->ldcmd);
-
- return 0;
-}
-
-/************************************************************************/
-/************************************************************************/
-
-#endif /* CONFIG_LCD */
diff --git a/cpu/pxa/start.S b/cpu/pxa/start.S
deleted file mode 100644
index ffaa30fdc5..0000000000
--- a/cpu/pxa/start.S
+++ /dev/null
@@ -1,498 +0,0 @@
-/*
- * armboot - Startup Code for XScale
- *
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2000 Wolfgang Denk <wd@denx.de>
- * Copyright (C) 2001 Alex Zuepke <azu@sysgo.de>
- * Copyright (C) 2002 Kyle Harris <kharris@nexus-tech.net>
- * Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
- * Copyright (C) 2003 Kai-Uwe Bloem <kai-uwe.bloem@auerswald.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <version.h>
-#include <asm/arch/pxa-regs.h>
-
-.globl _start
-_start: b reset
- ldr pc, _undefined_instruction
- ldr pc, _software_interrupt
- ldr pc, _prefetch_abort
- ldr pc, _data_abort
- ldr pc, _not_used
- ldr pc, _irq
- ldr pc, _fiq
-
-_undefined_instruction: .word undefined_instruction
-_software_interrupt: .word software_interrupt
-_prefetch_abort: .word prefetch_abort
-_data_abort: .word data_abort
-_not_used: .word not_used
-_irq: .word irq
-_fiq: .word fiq
-
- .balignl 16,0xdeadbeef
-
-
-/*
- * Startup Code (reset vector)
- *
- * do important init only if we don't start from RAM!
- * - relocate armboot to ram
- * - setup stack
- * - jump to second stage
- */
-
-_TEXT_BASE:
- .word TEXT_BASE
-
-.globl _armboot_start
-_armboot_start:
- .word _start
-
-/*
- * These are defined in the board-specific linker script.
- */
-.globl _bss_start
-_bss_start:
- .word __bss_start
-
-.globl _bss_end
-_bss_end:
- .word _end
-
-#ifdef CONFIG_USE_IRQ
-/* IRQ stack memory (calculated at run-time) */
-.globl IRQ_STACK_START
-IRQ_STACK_START:
- .word 0x0badc0de
-
-/* IRQ stack memory (calculated at run-time) */
-.globl FIQ_STACK_START
-FIQ_STACK_START:
- .word 0x0badc0de
-#endif
-
-
-/****************************************************************************/
-/* */
-/* the actual reset code */
-/* */
-/****************************************************************************/
-
-reset:
- mrs r0,cpsr /* set the cpu to SVC32 mode */
- bic r0,r0,#0x1f /* (superviser mode, M=10011) */
- orr r0,r0,#0x13
- msr cpsr,r0
-
- /*
- * we do sys-critical inits only at reboot,
- * not when booting from ram!
- */
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
- bl cpu_init_crit /* we do sys-critical inits */
-#endif
-
-#ifndef CONFIG_SKIP_RELOCATE_UBOOT
-relocate: /* relocate U-Boot to RAM */
- adr r0, _start /* r0 <- current position of code */
- ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
- cmp r0, r1 /* don't reloc during debug */
- beq stack_setup
-
- ldr r2, _armboot_start
- ldr r3, _bss_start
- sub r2, r3, r2 /* r2 <- size of armboot */
- add r2, r0, r2 /* r2 <- source end address */
-
-copy_loop:
- ldmia r0!, {r3-r10} /* copy from source address [r0] */
- stmia r1!, {r3-r10} /* copy to target address [r1] */
- cmp r0, r2 /* until source end addreee [r2] */
- ble copy_loop
-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
-
- /* Set up the stack */
-stack_setup:
- ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
- sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
- sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
-#ifdef CONFIG_USE_IRQ
- sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
-#endif
- sub sp, r0, #12 /* leave 3 words for abort-stack */
-
-clear_bss:
- ldr r0, _bss_start /* find start of bss segment */
- ldr r1, _bss_end /* stop here */
- mov r2, #0x00000000 /* clear */
-
-clbss_l:str r2, [r0] /* clear loop... */
- add r0, r0, #4
- cmp r0, r1
- ble clbss_l
-
- ldr pc, _start_armboot
-
-_start_armboot: .word start_armboot
-
-
-/****************************************************************************/
-/* */
-/* CPU_init_critical registers */
-/* */
-/* - setup important registers */
-/* - setup memory timing */
-/* */
-/****************************************************************************/
-/* mk@tbd: Fix this! */
-#ifdef CONFIG_CPU_MONAHANS
-#undef ICMR
-#undef OSMR3
-#undef OSCR
-#undef OWER
-#undef OIER
-#endif
-
-/* Interrupt-Controller base address */
-IC_BASE: .word 0x40d00000
-#define ICMR 0x04
-
-/* Reset-Controller */
-RST_BASE: .word 0x40f00030
-#define RCSR 0x00
-
-/* Operating System Timer */
-OSTIMER_BASE: .word 0x40a00000
-#define OSMR3 0x0C
-#define OSCR 0x10
-#define OWER 0x18
-#define OIER 0x1C
-
-/* Clock Manager Registers */
-#ifdef CONFIG_CPU_MONAHANS
-# ifndef CFG_MONAHANS_RUN_MODE_OSC_RATIO
-# error "You have to define CFG_MONAHANS_RUN_MODE_OSC_RATIO!!"
-# endif
-# ifndef CFG_MONAHANS_TURBO_RUN_MODE_RATIO
-# define CFG_MONAHANS_TURBO_RUN_MODE_RATIO 0x1
-# endif
-#else /* ! CONFIG_CPU_MONAHANS */
-#ifdef CFG_CPUSPEED
-CC_BASE: .word 0x41300000
-#define CCCR 0x00
-cpuspeed: .word CFG_CPUSPEED
-#else
-#error "You have to define CFG_CPUSPEED!!"
-#endif
-#endif /* CONFIG_CPU_MONAHANS */
-
- /* takes care the CP15 update has taken place */
- .macro CPWAIT reg
- mrc p15,0,\reg,c2,c0,0
- mov \reg,\reg
- sub pc,pc,#4
- .endm
-
-cpu_init_crit:
-
- /* mask all IRQs */
-#ifndef CONFIG_CPU_MONAHANS
- ldr r0, IC_BASE
- mov r1, #0x00
- str r1, [r0, #ICMR]
-#else
- /* Step 1 - Enable CP6 permission */
- mrc p15, 0, r1, c15, c1, 0 @ read CPAR
- orr r1, r1, #0x40
- mcr p15, 0, r1, c15, c1, 0
- CPWAIT r1
-
- /* Step 2 - Mask ICMR & ICMR2 */
- mov r1, #0
- mcr p6, 0, r1, c1, c0, 0 @ ICMR
- mcr p6, 0, r1, c7, c0, 0 @ ICMR2
-
- /* turn off all clocks but the ones we will definitly require */
- ldr r1, =CKENA
- ldr r2, =(CKENA_22_FFUART | CKENA_10_SRAM | CKENA_9_SMC | CKENA_8_DMC)
- str r2, [r1]
- ldr r1, =CKENB
- ldr r2, =(CKENB_6_IRQ)
- str r2, [r1]
-#endif
-
- /* set clock speed */
-#ifdef CONFIG_CPU_MONAHANS
- ldr r0, =ACCR
- ldr r1, =(((CFG_MONAHANS_TURBO_RUN_MODE_RATIO<<8) & ACCR_XN_MASK) | (CFG_MONAHANS_RUN_MODE_OSC_RATIO & ACCR_XL_MASK))
- str r1, [r0]
-#else /* ! CONFIG_CPU_MONAHANS */
-#ifdef CFG_CPUSPEED
- ldr r0, CC_BASE
- ldr r1, cpuspeed
- str r1, [r0, #CCCR]
- mov r0, #2
- mcr p14, 0, r0, c6, c0, 0
-
-setspeed_done:
-
-#endif /* CFG_CPUSPEED */
-#endif /* CONFIG_CPU_MONAHANS */
-
- /*
- * before relocating, we have to setup RAM timing
- * because memory timing is board-dependend, you will
- * find a lowlevel_init.S in your board directory.
- */
- mov ip, lr
- bl lowlevel_init
- mov lr, ip
-
- /* Memory interfaces are working. Disable MMU and enable I-cache. */
- /* mk: hmm, this is not in the monahans docs, leave it now but
- * check here if it doesn't work :-) */
-
- ldr r0, =0x2001 /* enable access to all coproc. */
- mcr p15, 0, r0, c15, c1, 0
- CPWAIT r0
-
- mcr p15, 0, r0, c7, c10, 4 /* drain the write & fill buffers */
- CPWAIT r0
-
- mcr p15, 0, r0, c7, c7, 0 /* flush Icache, Dcache and BTB */
- CPWAIT r0
-
- mcr p15, 0, r0, c8, c7, 0 /* flush instuction and data TLBs */
- CPWAIT r0
-
- /* Enable the Icache */
-/*
- mrc p15, 0, r0, c1, c0, 0
- orr r0, r0, #0x1800
- mcr p15, 0, r0, c1, c0, 0
- CPWAIT
-*/
- mov pc, lr
-
-
-/****************************************************************************/
-/* */
-/* Interrupt handling */
-/* */
-/****************************************************************************/
-
-/* IRQ stack frame */
-
-#define S_FRAME_SIZE 72
-
-#define S_OLD_R0 68
-#define S_PSR 64
-#define S_PC 60
-#define S_LR 56
-#define S_SP 52
-
-#define S_IP 48
-#define S_FP 44
-#define S_R10 40
-#define S_R9 36
-#define S_R8 32
-#define S_R7 28
-#define S_R6 24
-#define S_R5 20
-#define S_R4 16
-#define S_R3 12
-#define S_R2 8
-#define S_R1 4
-#define S_R0 0
-
-#define MODE_SVC 0x13
-
- /* use bad_save_user_regs for abort/prefetch/undef/swi ... */
-
- .macro bad_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} /* Calling r0-r12 */
- add r8, sp, #S_PC
-
- ldr r2, _armboot_start
- sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
- ldmia r2, {r2 - r4} /* get pc, cpsr, old_r0 */
- add r0, sp, #S_FRAME_SIZE /* restore sp_SVC */
-
- add r5, sp, #S_SP
- mov r1, lr
- stmia r5, {r0 - r4} /* save sp_SVC, lr_SVC, pc, cpsr, old_r */
- mov r0, sp
- .endm
-
-
- /* use irq_save_user_regs / irq_restore_user_regs for */
- /* IRQ/FIQ handling */
-
- .macro irq_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} /* Calling r0-r12 */
- add r8, sp, #S_PC
- stmdb r8, {sp, lr}^ /* Calling SP, LR */
- str lr, [r8, #0] /* Save calling PC */
- mrs r6, spsr
- str r6, [r8, #4] /* Save CPSR */
- str r0, [r8, #8] /* Save OLD_R0 */
- mov r0, sp
- .endm
-
- .macro irq_restore_user_regs
- ldmia sp, {r0 - lr}^ @ Calling r0 - lr
- mov r0, r0
- ldr lr, [sp, #S_PC] @ Get PC
- add sp, sp, #S_FRAME_SIZE
- subs pc, lr, #4 @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_bad_stack
- ldr r13, _armboot_start @ setup our mode stack
- sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
-
- str lr, [r13] @ save caller lr / spsr
- mrs lr, spsr
- str lr, [r13, #4]
-
- mov r13, #MODE_SVC @ prepare SVC-Mode
- msr spsr_c, r13
- mov lr, pc
- movs pc, lr
- .endm
-
- .macro get_irq_stack @ setup IRQ stack
- ldr sp, IRQ_STACK_START
- .endm
-
- .macro get_fiq_stack @ setup FIQ stack
- ldr sp, FIQ_STACK_START
- .endm
-
-
-/****************************************************************************/
-/* */
-/* exception handlers */
-/* */
-/****************************************************************************/
-
- .align 5
-undefined_instruction:
- get_bad_stack
- bad_save_user_regs
- bl do_undefined_instruction
-
- .align 5
-software_interrupt:
- get_bad_stack
- bad_save_user_regs
- bl do_software_interrupt
-
- .align 5
-prefetch_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_prefetch_abort
-
- .align 5
-data_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_data_abort
-
- .align 5
-not_used:
- get_bad_stack
- bad_save_user_regs
- bl do_not_used
-
-#ifdef CONFIG_USE_IRQ
-
- .align 5
-irq:
- get_irq_stack
- irq_save_user_regs
- bl do_irq
- irq_restore_user_regs
-
- .align 5
-fiq:
- get_fiq_stack
- irq_save_user_regs /* someone ought to write a more */
- bl do_fiq /* effiction fiq_save_user_regs */
- irq_restore_user_regs
-
-#else
-
- .align 5
-irq:
- get_bad_stack
- bad_save_user_regs
- bl do_irq
-
- .align 5
-fiq:
- get_bad_stack
- bad_save_user_regs
- bl do_fiq
-
-#endif
-
-/****************************************************************************/
-/* */
-/* Reset function: the PXA250 doesn't have a reset function, so we have to */
-/* perform a watchdog timeout for a soft reset. */
-/* */
-/****************************************************************************/
-
- .align 5
-.globl reset_cpu
-
- /* FIXME: this code is PXA250 specific. How is this handled on */
- /* other XScale processors? */
-
-reset_cpu:
-
- /* We set OWE:WME (watchdog enable) and wait until timeout happens */
-
- ldr r0, OSTIMER_BASE
- ldr r1, [r0, #OWER]
- orr r1, r1, #0x0001 /* bit0: WME */
- str r1, [r0, #OWER]
-
- /* OS timer does only wrap every 1165 seconds, so we have to set */
- /* the match register as well. */
-
- ldr r1, [r0, #OSCR] /* read OS timer */
- add r1, r1, #0x800 /* let OSMR3 match after */
- add r1, r1, #0x800 /* 4096*(1/3.6864MHz)=1ms */
- str r1, [r0, #OSMR3]
-
-reset_endless:
-
- b reset_endless
diff --git a/cpu/s3c44b0/Makefile b/cpu/s3c44b0/Makefile
deleted file mode 100644
index 790faebd39..0000000000
--- a/cpu/s3c44b0/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = serial.o interrupts.o cpu.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/s3c44b0/config.mk b/cpu/s3c44b0/config.mk
deleted file mode 100644
index 6dc9c463a2..0000000000
--- a/cpu/s3c44b0/config.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# (C) Copyright 2002
-# Sysgo Real-Time Solutions, GmbH <www.elinos.com>
-# Marius Groeger <mgroeger@sysgo.de>
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \
- -msoft-float
-
-PLATFORM_CPPFLAGS += -march=armv4 -mtune=arm7tdmi -msoft-float
-# =========================================================================
-#
-# Supply options according to compiler version
-#
-# ========================================================================
-PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
diff --git a/cpu/s3c44b0/cpu.c b/cpu/s3c44b0/cpu.c
deleted file mode 100644
index 5d50b3cea0..0000000000
--- a/cpu/s3c44b0/cpu.c
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * (C) Copyright 2004
- * DAVE Srl
- * http://www.dave-tech.it
- * http://www.wawnet.biz
- * mailto:info@wawnet.biz
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * S3C44B0 CPU specific code
- */
-
-#include <common.h>
-#include <command.h>
-#include <asm/hardware.h>
-
-static void s3c44b0_flush_cache(void)
-{
- volatile int i;
- /* flush cycle */
- for(i=0x10002000;i<0x10004800;i+=16)
- {
- *((int *)i)=0x0;
- }
-}
-
-
-int cpu_init (void)
-{
- icache_enable();
-
- return 0;
-}
-
-int cleanup_before_linux (void)
-{
- /*
- cache memory should be enabled before calling
- Linux to make the kernel uncompression faster
- */
- icache_enable();
-
- disable_interrupts ();
-
- return 0;
-}
-
-void reset_cpu (ulong addr)
-{
- /*
- reset the cpu using watchdog
- */
-
- /* Disable the watchdog.*/
- WTCON&=~(1<<5);
-
- /* set the timeout value to a short time... */
- WTCNT = 0x1;
-
- /* Enable the watchdog. */
- WTCON|=1;
- WTCON|=(1<<5);
-
- while(1) {
- /*NOP*/
- }
-}
-
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- disable_interrupts ();
- reset_cpu (0);
-
- /*NOTREACHED*/
- return (0);
-}
-
-void icache_enable (void)
-{
- ulong reg;
-
- s3c44b0_flush_cache();
-
- /*
- Init cache
- Non-cacheable area (everything outside RAM)
- 0x0000:0000 - 0x0C00:0000
- */
- NCACHBE0 = 0xC0000000;
- NCACHBE1 = 0x00000000;
-
- /*
- Enable chache
- */
- reg = SYSCFG;
- reg |= 0x00000006; /* 8kB */
- SYSCFG = reg;
-}
-
-void icache_disable (void)
-{
- ulong reg;
-
- reg = SYSCFG;
- reg &= ~0x00000006; /* 8kB */
- SYSCFG = reg;
-}
-
-int icache_status (void)
-{
- return 0;
-}
-
-void dcache_enable (void)
-{
- icache_enable();
-}
-
-void dcache_disable (void)
-{
- icache_disable();
-}
-
-int dcache_status (void)
-{
- return dcache_status();
-}
-
-/*
- RTC stuff
-*/
-#include <rtc.h>
-#ifndef BCD2HEX
- #define BCD2HEX(n) ((n>>4)*10+(n&0x0f))
-#endif
-#ifndef HEX2BCD
- #define HEX2BCD(x) ((((x) / 10) << 4) + (x) % 10)
-#endif
-
-void rtc_get (struct rtc_time* tm)
-{
- RTCCON |= 1;
- tm->tm_year = BCD2HEX(BCDYEAR);
- tm->tm_mon = BCD2HEX(BCDMON);
- tm->tm_wday = BCD2HEX(BCDDATE);
- tm->tm_mday = BCD2HEX(BCDDAY);
- tm->tm_hour = BCD2HEX(BCDHOUR);
- tm->tm_min = BCD2HEX(BCDMIN);
- tm->tm_sec = BCD2HEX(BCDSEC);
-
- if (tm->tm_sec==0) {
- /* we have to re-read the rtc data because of the "one second deviation" problem */
- /* see RTC datasheet for more info about it */
- tm->tm_year = BCD2HEX(BCDYEAR);
- tm->tm_mon = BCD2HEX(BCDMON);
- tm->tm_mday = BCD2HEX(BCDDAY);
- tm->tm_wday = BCD2HEX(BCDDATE);
- tm->tm_hour = BCD2HEX(BCDHOUR);
- tm->tm_min = BCD2HEX(BCDMIN);
- tm->tm_sec = BCD2HEX(BCDSEC);
- }
-
- RTCCON &= ~1;
-
- if(tm->tm_year >= 70)
- tm->tm_year += 1900;
- else
- tm->tm_year += 2000;
-}
-
-void rtc_set (struct rtc_time* tm)
-{
- if(tm->tm_year < 2000)
- tm->tm_year -= 1900;
- else
- tm->tm_year -= 2000;
-
- RTCCON |= 1;
- BCDYEAR = HEX2BCD(tm->tm_year);
- BCDMON = HEX2BCD(tm->tm_mon);
- BCDDAY = HEX2BCD(tm->tm_mday);
- BCDDATE = HEX2BCD(tm->tm_wday);
- BCDHOUR = HEX2BCD(tm->tm_hour);
- BCDMIN = HEX2BCD(tm->tm_min);
- BCDSEC = HEX2BCD(tm->tm_sec);
- RTCCON &= 1;
-}
-
-void rtc_reset (void)
-{
- RTCCON |= 1;
- BCDYEAR = 0;
- BCDMON = 0;
- BCDDAY = 0;
- BCDDATE = 0;
- BCDHOUR = 0;
- BCDMIN = 0;
- BCDSEC = 0;
- RTCCON &= 1;
-}
-
-
-/*
- I2C stuff
-*/
-
-/*
- * Initialization, must be called once on start up, may be called
- * repeatedly to change the speed and slave addresses.
- */
-void i2c_init(int speed, int slaveaddr)
-{
- /*
- setting up I2C support
- */
- unsigned int save_F,save_PF,rIICCON,rPCONA,rPDATA,rPCONF,rPUPF;
-
- save_F = PCONF;
- save_PF = PUPF;
-
- rPCONF = ((save_F & ~(0xF))| 0xa);
- rPUPF = (save_PF | 0x3);
- PCONF = rPCONF; /*PF0:IICSCL, PF1:IICSDA*/
- PUPF = rPUPF; /* Disable pull-up */
-
- /* Configuring pin for WC pin of EEprom */
- rPCONA = PCONA;
- rPCONA &= ~(1<<9);
- PCONA = rPCONA;
-
- rPDATA = PDATA;
- rPDATA &= ~(1<<9);
- PDATA = rPDATA;
-
- /*
- Enable ACK, IICCLK=MCLK/16, enable interrupt
- 75Mhz/16/(12+1) = 390625 Hz
- */
- rIICCON=(1<<7)|(0<<6)|(1<<5)|(0xC);
- IICCON = rIICCON;
-
- IICADD = slaveaddr;
-}
-
-/*
- * Probe the given I2C chip address. Returns 0 if a chip responded,
- * not 0 on failure.
- */
-int i2c_probe(uchar chip)
-{
- /*
- not implemented
- */
-
- printf("i2c_probe chip %d\n", (int) chip);
- return -1;
-}
-
-/*
- * Read/Write interface:
- * chip: I2C chip address, range 0..127
- * addr: Memory (register) address within the chip
- * alen: Number of bytes to use for addr (typically 1, 2 for larger
- * memories, 0 for register type devices with only one
- * register)
- * buffer: Where to read/write the data
- * len: How many bytes to read/write
- *
- * Returns: 0 on success, not 0 on failure
- */
-
-#define S3C44B0X_rIIC_INTPEND (1<<4)
-#define S3C44B0X_rIIC_LAST_RECEIV_BIT (1<<0)
-#define S3C44B0X_rIIC_INTERRUPT_ENABLE (1<<5)
-#define S3C44B0_IIC_TIMEOUT 100
-
-int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
-{
-
- int k, j, temp;
- u32 rIICSTAT;
-
- /*
- send the device offset
- */
-
- rIICSTAT = 0xD0;
- IICSTAT = rIICSTAT;
-
- IICDS = chip; /* this is a write operation... */
-
- rIICSTAT |= (1<<5);
- IICSTAT = rIICSTAT;
-
- for(k=0; k<S3C44B0_IIC_TIMEOUT; k++) {
- temp = IICCON;
- if( (temp & S3C44B0X_rIIC_INTPEND) == S3C44B0X_rIIC_INTPEND)
- break;
- udelay(2000);
- }
- if (k==S3C44B0_IIC_TIMEOUT)
- return -1;
-
- /* wait and check ACK */
- temp = IICSTAT;
- if ((temp & S3C44B0X_rIIC_LAST_RECEIV_BIT) == S3C44B0X_rIIC_LAST_RECEIV_BIT )
- return -1;
-
- IICDS = addr;
- IICCON = IICCON & ~(S3C44B0X_rIIC_INTPEND);
-
- /* wait and check ACK */
- for(k=0; k<S3C44B0_IIC_TIMEOUT; k++) {
- temp = IICCON;
- if( (temp & S3C44B0X_rIIC_INTPEND) == S3C44B0X_rIIC_INTPEND)
- break;
- udelay(2000);
- }
- if (k==S3C44B0_IIC_TIMEOUT)
- return -1;
-
- temp = IICSTAT;
- if ((temp & S3C44B0X_rIIC_LAST_RECEIV_BIT) == S3C44B0X_rIIC_LAST_RECEIV_BIT )
- return -1;
-
- /*
- now we can start with the read operation...
- */
-
- IICDS = chip | 0x01; /* this is a read operation... */
-
- rIICSTAT = 0x90; /*master recv*/
- rIICSTAT |= (1<<5);
- IICSTAT = rIICSTAT;
-
- IICCON = IICCON & ~(S3C44B0X_rIIC_INTPEND);
-
- /* wait and check ACK */
- for(k=0; k<S3C44B0_IIC_TIMEOUT; k++) {
- temp = IICCON;
- if( (temp & S3C44B0X_rIIC_INTPEND) == S3C44B0X_rIIC_INTPEND)
- break;
- udelay(2000);
- }
- if (k==S3C44B0_IIC_TIMEOUT)
- return -1;
-
- temp = IICSTAT;
- if ((temp & S3C44B0X_rIIC_LAST_RECEIV_BIT) == S3C44B0X_rIIC_LAST_RECEIV_BIT )
- return -1;
-
- for (j=0; j<len-1; j++) {
-
- /*clear pending bit to resume */
-
- temp = IICCON & ~(S3C44B0X_rIIC_INTPEND);
- IICCON = temp;
-
- /* wait and check ACK */
- for(k=0; k<S3C44B0_IIC_TIMEOUT; k++) {
- temp = IICCON;
- if( (temp & S3C44B0X_rIIC_INTPEND) == S3C44B0X_rIIC_INTPEND)
- break;
- udelay(2000);
- }
- if (k==S3C44B0_IIC_TIMEOUT)
- return -1;
-
-
- buffer[j] = IICDS; /*save readed data*/
-
- } /*end for(j)*/
-
- /*
- reading the last data
- unset ACK generation
- */
- temp = IICCON & ~(S3C44B0X_rIIC_INTPEND | (1<<7));
- IICCON = temp;
-
- /* wait but NOT check ACK */
- for(k=0; k<S3C44B0_IIC_TIMEOUT; k++) {
- temp = IICCON;
- if( (temp & S3C44B0X_rIIC_INTPEND) == S3C44B0X_rIIC_INTPEND)
- break;
- udelay(2000);
- }
- if (k==S3C44B0_IIC_TIMEOUT)
- return -1;
-
- buffer[j] = IICDS; /*save readed data*/
-
- rIICSTAT = 0x90; /*master recv*/
-
- /* Write operation Terminate sending STOP */
- IICSTAT = rIICSTAT;
- /*Clear Int Pending Bit to RESUME*/
- temp = IICCON;
- IICCON = temp & (~S3C44B0X_rIIC_INTPEND);
-
- IICCON = IICCON | (1<<7); /*restore ACK generation*/
-
- return 0;
-}
-
-int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
-{
- int j, k;
- u32 rIICSTAT, temp;
-
-
- /*
- send the device offset
- */
-
- rIICSTAT = 0xD0;
- IICSTAT = rIICSTAT;
-
- IICDS = chip; /* this is a write operation... */
-
- rIICSTAT |= (1<<5);
- IICSTAT = rIICSTAT;
-
- IICCON = IICCON & ~(S3C44B0X_rIIC_INTPEND);
-
- /* wait and check ACK */
- for(k=0; k<S3C44B0_IIC_TIMEOUT; k++) {
- temp = IICCON;
- if( (temp & S3C44B0X_rIIC_INTPEND) == S3C44B0X_rIIC_INTPEND)
- break;
- udelay(2000);
- }
- if (k==S3C44B0_IIC_TIMEOUT)
- return -1;
-
- temp = IICSTAT;
- if ((temp & S3C44B0X_rIIC_LAST_RECEIV_BIT) == S3C44B0X_rIIC_LAST_RECEIV_BIT )
- return -1;
-
- IICDS = addr;
- IICCON = IICCON & ~(S3C44B0X_rIIC_INTPEND);
-
- /* wait and check ACK */
- for(k=0; k<S3C44B0_IIC_TIMEOUT; k++) {
- temp = IICCON;
- if( (temp & S3C44B0X_rIIC_INTPEND) == S3C44B0X_rIIC_INTPEND)
- break;
- udelay(2000);
- }
- if (k==S3C44B0_IIC_TIMEOUT)
- return -1;
-
- temp = IICSTAT;
- if ((temp & S3C44B0X_rIIC_LAST_RECEIV_BIT) == S3C44B0X_rIIC_LAST_RECEIV_BIT )
- return -1;
-
- /*
- now we can start with the read write operation
- */
- for (j=0; j<len; j++) {
-
- IICDS = buffer[j]; /*prerare data to write*/
-
- /*clear pending bit to resume*/
-
- temp = IICCON & ~(S3C44B0X_rIIC_INTPEND);
- IICCON = temp;
-
- /* wait but NOT check ACK */
- for(k=0; k<S3C44B0_IIC_TIMEOUT; k++) {
- temp = IICCON;
- if( (temp & S3C44B0X_rIIC_INTPEND) == S3C44B0X_rIIC_INTPEND)
- break;
-
- udelay(2000);
- }
-
- if (k==S3C44B0_IIC_TIMEOUT)
- return -1;
-
- } /* end for(j) */
-
- /* sending stop to terminate */
- rIICSTAT = 0xD0; /*master send*/
- IICSTAT = rIICSTAT;
- /*Clear Int Pending Bit to RESUME*/
- temp = IICCON;
- IICCON = temp & (~S3C44B0X_rIIC_INTPEND);
-
- return 0;
-}
diff --git a/cpu/s3c44b0/interrupts.c b/cpu/s3c44b0/interrupts.c
deleted file mode 100644
index 19fdf8c349..0000000000
--- a/cpu/s3c44b0/interrupts.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * (C) Copyright 2004
- * DAVE Srl
- * http://www.dave-tech.it
- * http://www.wawnet.biz
- * mailto:info@wawnet.biz
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/hardware.h>
-
-#include <asm/proc-armv/ptrace.h>
-
-/* we always count down the max. */
-#define TIMER_LOAD_VAL 0xffff
-
-/* macro to read the 16 bit timer */
-#define READ_TIMER (TCNTO1 & 0xffff)
-
-#ifdef CONFIG_USE_IRQ
-#error CONFIG_USE_IRQ NOT supported
-#else
-void enable_interrupts (void)
-{
- return;
-}
-int disable_interrupts (void)
-{
- return 0;
-}
-#endif
-
-
-void bad_mode (void)
-{
- panic ("Resetting CPU ...\n");
- reset_cpu (0);
-}
-
-void show_regs (struct pt_regs *regs)
-{
- unsigned long flags;
- const char *processor_modes[] =
- { "USER_26", "FIQ_26", "IRQ_26", "SVC_26", "UK4_26", "UK5_26",
- "UK6_26", "UK7_26",
- "UK8_26", "UK9_26", "UK10_26", "UK11_26", "UK12_26", "UK13_26",
- "UK14_26", "UK15_26",
- "USER_32", "FIQ_32", "IRQ_32", "SVC_32", "UK4_32", "UK5_32",
- "UK6_32", "ABT_32",
- "UK8_32", "UK9_32", "UK10_32", "UND_32", "UK12_32", "UK13_32",
- "UK14_32", "SYS_32"
- };
-
- flags = condition_codes (regs);
-
- printf ("pc : [<%08lx>] lr : [<%08lx>]\n"
- "sp : %08lx ip : %08lx fp : %08lx\n",
- instruction_pointer (regs),
- regs->ARM_lr, regs->ARM_sp, regs->ARM_ip, regs->ARM_fp);
- printf ("r10: %08lx r9 : %08lx r8 : %08lx\n",
- regs->ARM_r10, regs->ARM_r9, regs->ARM_r8);
- printf ("r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n",
- regs->ARM_r7, regs->ARM_r6, regs->ARM_r5, regs->ARM_r4);
- printf ("r3 : %08lx r2 : %08lx r1 : %08lx r0 : %08lx\n",
- regs->ARM_r3, regs->ARM_r2, regs->ARM_r1, regs->ARM_r0);
- printf ("Flags: %c%c%c%c",
- flags & CC_N_BIT ? 'N' : 'n',
- flags & CC_Z_BIT ? 'Z' : 'z',
- flags & CC_C_BIT ? 'C' : 'c', flags & CC_V_BIT ? 'V' : 'v');
- printf (" IRQs %s FIQs %s Mode %s%s\n",
- interrupts_enabled (regs) ? "on" : "off",
- fast_interrupts_enabled (regs) ? "on" : "off",
- processor_modes[processor_mode (regs)],
- thumb_mode (regs) ? " (T)" : "");
-}
-
-void do_undefined_instruction (struct pt_regs *pt_regs)
-{
- printf ("undefined instruction\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_software_interrupt (struct pt_regs *pt_regs)
-{
- printf ("software interrupt\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_prefetch_abort (struct pt_regs *pt_regs)
-{
- printf ("prefetch abort\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_data_abort (struct pt_regs *pt_regs)
-{
- printf ("data abort\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_not_used (struct pt_regs *pt_regs)
-{
- printf ("not used\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_fiq (struct pt_regs *pt_regs)
-{
- printf ("fast interrupt request\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_irq (struct pt_regs *pt_regs)
-{
- printf ("interrupt request\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-static ulong timestamp;
-static ulong lastdec;
-
-int interrupt_init (void)
-{
- TCFG0 = 0x000000E9;
- TCFG1 = 0x00000004;
- TCON = 0x00000900;
- TCNTB1 = TIMER_LOAD_VAL;
- TCMPB1 = 0;
- TCON = 0x00000B00;
- TCON = 0x00000900;
-
-
- lastdec = TCNTB1 = TIMER_LOAD_VAL;
- timestamp = 0;
- return 0;
-}
-
-/*
- * timer without interrupts
- */
-
-void reset_timer (void)
-{
- reset_timer_masked ();
-}
-
-ulong get_timer (ulong base)
-{
- return get_timer_masked () - base;
-}
-
-void set_timer (ulong t)
-{
- timestamp = t;
-}
-
-void reset_timer_masked (void)
-{
- /* reset time */
- lastdec = READ_TIMER;
- timestamp = 0;
-}
-
-ulong get_timer_masked (void)
-{
- ulong now = READ_TIMER;
-
- if (lastdec >= now) {
- /* normal mode */
- timestamp += lastdec - now;
- } else {
- /* we have an overflow ... */
- timestamp += lastdec + TIMER_LOAD_VAL - now;
- }
- lastdec = now;
-
- return timestamp;
-}
diff --git a/cpu/s3c44b0/start.S b/cpu/s3c44b0/start.S
deleted file mode 100644
index 7affe87b3a..0000000000
--- a/cpu/s3c44b0/start.S
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Startup Code for S3C44B0 CPU-core
- *
- * (C) Copyright 2004
- * DAVE Srl
- *
- * http://www.dave-tech.it
- * http://www.wawnet.biz
- * mailto:info@wawnet.biz
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-
-
-/*
- * Jump vector table
- */
-
-
-.globl _start
-_start: b reset
- add pc, pc, #0x0c000000
- add pc, pc, #0x0c000000
- add pc, pc, #0x0c000000
- add pc, pc, #0x0c000000
- add pc, pc, #0x0c000000
- add pc, pc, #0x0c000000
- add pc, pc, #0x0c000000
-
- .balignl 16,0xdeadbeef
-
-
-/*
- *************************************************************************
- *
- * Startup Code (reset vector)
- *
- * do important init only if we don't start from memory!
- * relocate u-boot to ram
- * setup stack
- * jump to second stage
- *
- *************************************************************************
- */
-
-_TEXT_BASE:
- .word TEXT_BASE
-
-.globl _armboot_start
-_armboot_start:
- .word _start
-
-/*
- * These are defined in the board-specific linker script.
- */
-.globl _bss_start
-_bss_start:
- .word __bss_start
-
-.globl _bss_end
-_bss_end:
- .word _end
-
-#ifdef CONFIG_USE_IRQ
-/* IRQ stack memory (calculated at run-time) */
-.globl IRQ_STACK_START
-IRQ_STACK_START:
- .word 0x0badc0de
-
-/* IRQ stack memory (calculated at run-time) */
-.globl FIQ_STACK_START
-FIQ_STACK_START:
- .word 0x0badc0de
-#endif
-
-
-/*
- * the actual reset code
- */
-
-reset:
- /*
- * set the cpu to SVC32 mode
- */
- mrs r0,cpsr
- bic r0,r0,#0x1f
- orr r0,r0,#0x13
- msr cpsr,r0
-
- /*
- * we do sys-critical inits only at reboot,
- * not when booting from ram!
- */
-
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
- bl cpu_init_crit
- /*
- * before relocating, we have to setup RAM timing
- * because memory timing is board-dependend, you will
- * find a lowlevel_init.S in your board directory.
- */
- bl lowlevel_init
-#endif
-
-#ifndef CONFIG_SKIP_RELOCATE_UBOOT
-relocate: /* relocate U-Boot to RAM */
- adr r0, _start /* r0 <- current position of code */
- ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
- cmp r0, r1 /* don't reloc during debug */
- beq stack_setup
-
- ldr r2, _armboot_start
- ldr r3, _bss_start
- sub r2, r3, r2 /* r2 <- size of armboot */
- add r2, r0, r2 /* r2 <- source end address */
-
-copy_loop:
- ldmia r0!, {r3-r10} /* copy from source address [r0] */
- stmia r1!, {r3-r10} /* copy to target address [r1] */
- cmp r0, r2 /* until source end addreee [r2] */
- ble copy_loop
-
-/*
- now copy to sram the interrupt vector
-*/
- adr r0, real_vectors
- add r2, r0, #1024
- ldr r1, =0x0c000000
- add r1, r1, #0x08
-vector_copy_loop:
- ldmia r0!, {r3-r10}
- stmia r1!, {r3-r10}
- cmp r0, r2
- ble vector_copy_loop
-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
-
- /* Set up the stack */
-stack_setup:
- ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
- sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
- sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
-#ifdef CONFIG_USE_IRQ
- sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
-#endif
- sub sp, r0, #12 /* leave 3 words for abort-stack */
-
- ldr pc, _start_armboot
-
-_start_armboot: .word start_armboot
-
-
-/*
- *************************************************************************
- *
- * CPU_init_critical registers
- *
- * setup important registers
- * setup memory timing
- *
- *************************************************************************
- */
-
-#define INTCON (0x01c00000+0x200000)
-#define INTMSK (0x01c00000+0x20000c)
-#define LOCKTIME (0x01c00000+0x18000c)
-#define PLLCON (0x01c00000+0x180000)
-#define CLKCON (0x01c00000+0x180004)
-#define WTCON (0x01c00000+0x130000)
-cpu_init_crit:
- /* disable watch dog */
- ldr r0, =WTCON
- ldr r1, =0x0
- str r1, [r0]
-
- /*
- * mask all IRQs by clearing all bits in the INTMRs
- */
- ldr r1,=INTMSK
- ldr r0, =0x03fffeff
- str r0, [r1]
-
- ldr r1, =INTCON
- ldr r0, =0x05
- str r0, [r1]
-
- /* Set Clock Control Register */
- ldr r1, =LOCKTIME
- ldrb r0, =800
- strb r0, [r1]
-
- ldr r1, =PLLCON
-
-#if CONFIG_S3C44B0_CLOCK_SPEED==66
- ldr r0, =0x34031 /* 66MHz (Quartz=11MHz) */
-#elif CONFIG_S3C44B0_CLOCK_SPEED==75
- ldr r0, =0x610c1 /*B2: Xtal=20mhz Fclk=75MHz */
-#else
-# error CONFIG_S3C44B0_CLOCK_SPEED undefined
-#endif
-
- str r0, [r1]
-
- ldr r1,=CLKCON
- ldr r0, =0x7ff8
- str r0, [r1]
-
- mov pc, lr
-
-
-/*************************************************/
-/* interrupt vectors */
-/*************************************************/
-real_vectors:
- b reset
- b undefined_instruction
- b software_interrupt
- b prefetch_abort
- b data_abort
- b not_used
- b irq
- b fiq
-
-/*************************************************/
-
-undefined_instruction:
- mov r6, #3
- b reset
-
-software_interrupt:
- mov r6, #4
- b reset
-
-prefetch_abort:
- mov r6, #5
- b reset
-
-data_abort:
- mov r6, #6
- b reset
-
-not_used:
- /* we *should* never reach this */
- mov r6, #7
- b reset
-
-irq:
- mov r6, #8
- b reset
-
-fiq:
- mov r6, #9
- b reset
diff --git a/cpu/sa1100/Makefile b/cpu/sa1100/Makefile
deleted file mode 100644
index 790faebd39..0000000000
--- a/cpu/sa1100/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB = $(obj)lib$(CPU).a
-
-START = start.o
-COBJS = serial.o interrupts.o cpu.o
-
-SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
-START := $(addprefix $(obj),$(START))
-
-all: $(obj).depend $(START) $(LIB)
-
-$(LIB): $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/cpu/sa1100/config.mk b/cpu/sa1100/config.mk
deleted file mode 100644
index 5be7dfb2f7..0000000000
--- a/cpu/sa1100/config.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# (C) Copyright 2002
-# Sysgo Real-Time Solutions, GmbH <www.elinos.com>
-# Marius Groeger <mgroeger@sysgo.de>
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \
- -msoft-float
-
-PLATFORM_CPPFLAGS += -march=armv4 -mtune=strongarm1100
-# =========================================================================
-#
-# Supply options according to compiler version
-#
-# ========================================================================
-PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
diff --git a/cpu/sa1100/cpu.c b/cpu/sa1100/cpu.c
deleted file mode 100644
index f1bd644093..0000000000
--- a/cpu/sa1100/cpu.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- * CPU specific code
- */
-
-#include <common.h>
-#include <command.h>
-
-#ifdef CONFIG_USE_IRQ
-DECLARE_GLOBAL_DATA_PTR;
-#endif
-
-int cpu_init (void)
-{
- /*
- * setup up stacks if necessary
- */
-#ifdef CONFIG_USE_IRQ
- IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
- FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
-#endif
- return 0;
-}
-
-int cleanup_before_linux (void)
-{
- /*
- * this function is called just before we call linux
- * it prepares the processor for linux
- *
- * just disable everything that can disturb booting linux
- */
-
- unsigned long i;
-
- disable_interrupts ();
-
- /* turn off I-cache */
- asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
- i &= ~0x1000;
- asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
-
- /* flush I-cache */
- asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
-
- return (0);
-}
-
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-{
- printf ("resetting ...\n");
-
- udelay (50000); /* wait 50 ms */
- disable_interrupts ();
- reset_cpu (0);
-
- /*NOTREACHED*/
- return (0);
-}
-
-/* taken from blob */
-void icache_enable (void)
-{
- register u32 i;
-
- /* read control register */
- asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
-
- /* set i-cache */
- i |= 0x1000;
-
- /* write back to control register */
- asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
-}
-
-void icache_disable (void)
-{
- register u32 i;
-
- /* read control register */
- asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
-
- /* clear i-cache */
- i &= ~0x1000;
-
- /* write back to control register */
- asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
-
- /* flush i-cache */
- asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
-}
-
-int icache_status (void)
-{
- register u32 i;
-
- /* read control register */
- asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
-
- /* return bit */
- return (i & 0x1000);
-}
-
-/* we will never enable dcache, because we have to setup MMU first */
-void dcache_enable (void)
-{
- return;
-}
-
-void dcache_disable (void)
-{
- return;
-}
-
-int dcache_status (void)
-{
- return 0; /* always off */
-}
diff --git a/cpu/sa1100/interrupts.c b/cpu/sa1100/interrupts.c
deleted file mode 100644
index fa5ca11ca4..0000000000
--- a/cpu/sa1100/interrupts.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <SA-1100.h>
-
-#include <asm/proc-armv/ptrace.h>
-
-#ifdef CONFIG_USE_IRQ
-/* enable IRQ/FIQ interrupts */
-void enable_interrupts (void)
-{
- unsigned long temp;
- __asm__ __volatile__ ("mrs %0, cpsr\n"
- "bic %0, %0, #0x80\n"
- "msr cpsr_c, %0"
- : "=r" (temp)
- :
- : "memory");
-}
-
-
-/*
- * disable IRQ/FIQ interrupts
- * returns true if interrupts had been enabled before we disabled them
- */
-int disable_interrupts (void)
-{
- unsigned long old, temp;
- __asm__ __volatile__ ("mrs %0, cpsr\n"
- "orr %1, %0, #0x80\n"
- "msr cpsr_c, %1"
- : "=r" (old), "=r" (temp)
- :
- : "memory");
-
- return (old & 0x80) == 0;
-}
-#else
-void enable_interrupts (void)
-{
- return;
-}
-int disable_interrupts (void)
-{
- return 0;
-}
-#endif
-
-
-void bad_mode (void)
-{
- panic ("Resetting CPU ...\n");
- reset_cpu (0);
-}
-
-void show_regs (struct pt_regs *regs)
-{
- unsigned long flags;
- const char *processor_modes[] = {
- "USER_26", "FIQ_26", "IRQ_26", "SVC_26",
- "UK4_26", "UK5_26", "UK6_26", "UK7_26",
- "UK8_26", "UK9_26", "UK10_26", "UK11_26",
- "UK12_26", "UK13_26", "UK14_26", "UK15_26",
- "USER_32", "FIQ_32", "IRQ_32", "SVC_32",
- "UK4_32", "UK5_32", "UK6_32", "ABT_32",
- "UK8_32", "UK9_32", "UK10_32", "UND_32",
- "UK12_32", "UK13_32", "UK14_32", "SYS_32"
- };
-
- flags = condition_codes (regs);
-
- printf ("pc : [<%08lx>] lr : [<%08lx>]\n"
- "sp : %08lx ip : %08lx fp : %08lx\n",
- instruction_pointer (regs),
- regs->ARM_lr, regs->ARM_sp, regs->ARM_ip, regs->ARM_fp);
- printf ("r10: %08lx r9 : %08lx r8 : %08lx\n",
- regs->ARM_r10, regs->ARM_r9, regs->ARM_r8);
- printf ("r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n",
- regs->ARM_r7, regs->ARM_r6, regs->ARM_r5, regs->ARM_r4);
- printf ("r3 : %08lx r2 : %08lx r1 : %08lx r0 : %08lx\n",
- regs->ARM_r3, regs->ARM_r2, regs->ARM_r1, regs->ARM_r0);
- printf ("Flags: %c%c%c%c",
- flags & CC_N_BIT ? 'N' : 'n',
- flags & CC_Z_BIT ? 'Z' : 'z',
- flags & CC_C_BIT ? 'C' : 'c', flags & CC_V_BIT ? 'V' : 'v');
- printf (" IRQs %s FIQs %s Mode %s%s\n",
- interrupts_enabled (regs) ? "on" : "off",
- fast_interrupts_enabled (regs) ? "on" : "off",
- processor_modes[processor_mode (regs)],
- thumb_mode (regs) ? " (T)" : "");
-}
-
-void do_undefined_instruction (struct pt_regs *pt_regs)
-{
- printf ("undefined instruction\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_software_interrupt (struct pt_regs *pt_regs)
-{
- printf ("software interrupt\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_prefetch_abort (struct pt_regs *pt_regs)
-{
- printf ("prefetch abort\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_data_abort (struct pt_regs *pt_regs)
-{
- printf ("data abort\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_not_used (struct pt_regs *pt_regs)
-{
- printf ("not used\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_fiq (struct pt_regs *pt_regs)
-{
- printf ("fast interrupt request\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-void do_irq (struct pt_regs *pt_regs)
-{
- printf ("interrupt request\n");
- show_regs (pt_regs);
- bad_mode ();
-}
-
-
-int interrupt_init (void)
-{
- /* nothing happens here - we don't setup any IRQs */
- return (0);
-}
-
-void reset_timer (void)
-{
- reset_timer_masked ();
-}
-
-ulong get_timer (ulong base)
-{
- return get_timer_masked ();
-}
-
-void set_timer (ulong t)
-{
- /* nop */
-}
-
-void reset_timer_masked (void)
-{
- OSCR = 0;
-}
-
-ulong get_timer_masked (void)
-{
- return OSCR;
-}
diff --git a/cpu/sa1100/start.S b/cpu/sa1100/start.S
deleted file mode 100644
index 431ee656e8..0000000000
--- a/cpu/sa1100/start.S
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * armboot - Startup Code for SA1100 CPU
- *
- * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
- * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
- * Copyright (C) 2000 Wolfgang Denk <wd@denx.de>
- * Copyright (c) 2001 Alex Züpke <azu@sysgo.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-
-#include <config.h>
-#include <version.h>
-
-
-/*
- *************************************************************************
- *
- * Jump vector table as in table 3.1 in [1]
- *
- *************************************************************************
- */
-
-
-.globl _start
-_start: b reset
- ldr pc, _undefined_instruction
- ldr pc, _software_interrupt
- ldr pc, _prefetch_abort
- ldr pc, _data_abort
- ldr pc, _not_used
- ldr pc, _irq
- ldr pc, _fiq
-
-_undefined_instruction: .word undefined_instruction
-_software_interrupt: .word software_interrupt
-_prefetch_abort: .word prefetch_abort
-_data_abort: .word data_abort
-_not_used: .word not_used
-_irq: .word irq
-_fiq: .word fiq
-
- .balignl 16,0xdeadbeef
-
-
-/*
- *************************************************************************
- *
- * Startup Code (reset vector)
- *
- * do important init only if we don't start from memory!
- * relocate armboot to ram
- * setup stack
- * jump to second stage
- *
- *************************************************************************
- */
-
-_TEXT_BASE:
- .word TEXT_BASE
-
-.globl _armboot_start
-_armboot_start:
- .word _start
-
-/*
- * These are defined in the board-specific linker script.
- */
-.globl _bss_start
-_bss_start:
- .word __bss_start
-
-.globl _bss_end
-_bss_end:
- .word _end
-
-#ifdef CONFIG_USE_IRQ
-/* IRQ stack memory (calculated at run-time) */
-.globl IRQ_STACK_START
-IRQ_STACK_START:
- .word 0x0badc0de
-
-/* IRQ stack memory (calculated at run-time) */
-.globl FIQ_STACK_START
-FIQ_STACK_START:
- .word 0x0badc0de
-#endif
-
-
-/*
- * the actual reset code
- */
-
-reset:
- /*
- * set the cpu to SVC32 mode
- */
- mrs r0,cpsr
- bic r0,r0,#0x1f
- orr r0,r0,#0x13
- msr cpsr,r0
-
- /*
- * we do sys-critical inits only at reboot,
- * not when booting from ram!
- */
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
- bl cpu_init_crit
-#endif
-
-#ifndef CONFIG_SKIP_RELOCATE_UBOOT
-relocate: /* relocate U-Boot to RAM */
- adr r0, _start /* r0 <- current position of code */
- ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
- cmp r0, r1 /* don't reloc during debug */
- beq stack_setup
-
- ldr r2, _armboot_start
- ldr r3, _bss_start
- sub r2, r3, r2 /* r2 <- size of armboot */
- add r2, r0, r2 /* r2 <- source end address */
-
-copy_loop:
- ldmia r0!, {r3-r10} /* copy from source address [r0] */
- stmia r1!, {r3-r10} /* copy to target address [r1] */
- cmp r0, r2 /* until source end addreee [r2] */
- ble copy_loop
-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
-
- /* Set up the stack */
-stack_setup:
- ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
- sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
- sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
-#ifdef CONFIG_USE_IRQ
- sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
-#endif
- sub sp, r0, #12 /* leave 3 words for abort-stack */
-
-clear_bss:
- ldr r0, _bss_start /* find start of bss segment */
- ldr r1, _bss_end /* stop here */
- mov r2, #0x00000000 /* clear */
-
-clbss_l:str r2, [r0] /* clear loop... */
- add r0, r0, #4
- cmp r0, r1
- ble clbss_l
-
- ldr pc, _start_armboot
-
-_start_armboot: .word start_armboot
-
-
-/*
- *************************************************************************
- *
- * CPU_init_critical registers
- *
- * setup important registers
- * setup memory timing
- *
- *************************************************************************
- */
-
-
-/* Interupt-Controller base address */
-IC_BASE: .word 0x90050000
-#define ICMR 0x04
-
-
-/* Reset-Controller */
-RST_BASE: .word 0x90030000
-#define RSRR 0x00
-#define RCSR 0x04
-
-
-/* PWR */
-PWR_BASE: .word 0x90020000
-#define PSPR 0x08
-#define PPCR 0x14
-cpuspeed: .word CFG_CPUSPEED
-
-
-cpu_init_crit:
- /*
- * mask all IRQs
- */
- ldr r0, IC_BASE
- mov r1, #0x00
- str r1, [r0, #ICMR]
-
- /* set clock speed */
- ldr r0, PWR_BASE
- ldr r1, cpuspeed
- str r1, [r0, #PPCR]
-
- /*
- * before relocating, we have to setup RAM timing
- * because memory timing is board-dependend, you will
- * find a lowlevel_init.S in your board directory.
- */
- mov ip, lr
- bl lowlevel_init
- mov lr, ip
-
- /*
- * disable MMU stuff and enable I-cache
- */
- mrc p15,0,r0,c1,c0
- bic r0, r0, #0x00002000 @ clear bit 13 (X)
- bic r0, r0, #0x0000000f @ clear bits 3-0 (WCAM)
- orr r0, r0, #0x00001000 @ set bit 12 (I) Icache
- orr r0, r0, #0x00000002 @ set bit 2 (A) Align
- mcr p15,0,r0,c1,c0
-
- /*
- * flush v4 I/D caches
- */
- mov r0, #0
- mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
- mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */
-
- mov pc, lr
-
-
-/*
- *************************************************************************
- *
- * Interrupt handling
- *
- *************************************************************************
- */
-
-@
-@ IRQ stack frame.
-@
-#define S_FRAME_SIZE 72
-
-#define S_OLD_R0 68
-#define S_PSR 64
-#define S_PC 60
-#define S_LR 56
-#define S_SP 52
-
-#define S_IP 48
-#define S_FP 44
-#define S_R10 40
-#define S_R9 36
-#define S_R8 32
-#define S_R7 28
-#define S_R6 24
-#define S_R5 20
-#define S_R4 16
-#define S_R3 12
-#define S_R2 8
-#define S_R1 4
-#define S_R0 0
-
-#define MODE_SVC 0x13
-#define I_BIT 0x80
-
-/*
- * use bad_save_user_regs for abort/prefetch/undef/swi ...
- * use irq_save_user_regs / irq_restore_user_regs for IRQ/FIQ handling
- */
-
- .macro bad_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Calling r0-r12
- add r8, sp, #S_PC
-
- ldr r2, _armboot_start
- sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
- ldmia r2, {r2 - r4} @ get pc, cpsr, old_r0
- add r0, sp, #S_FRAME_SIZE @ restore sp_SVC
-
- add r5, sp, #S_SP
- mov r1, lr
- stmia r5, {r0 - r4} @ save sp_SVC, lr_SVC, pc, cpsr, old_r
- mov r0, sp
- .endm
-
- .macro irq_save_user_regs
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Calling r0-r12
- add r8, sp, #S_PC
- stmdb r8, {sp, lr}^ @ Calling SP, LR
- str lr, [r8, #0] @ Save calling PC
- mrs r6, spsr
- str r6, [r8, #4] @ Save CPSR
- str r0, [r8, #8] @ Save OLD_R0
- mov r0, sp
- .endm
-
- .macro irq_restore_user_regs
- ldmia sp, {r0 - lr}^ @ Calling r0 - lr
- mov r0, r0
- ldr lr, [sp, #S_PC] @ Get PC
- add sp, sp, #S_FRAME_SIZE
- subs pc, lr, #4 @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_bad_stack
- ldr r13, _armboot_start @ setup our mode stack
- sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
- sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
-
- str lr, [r13] @ save caller lr / spsr
- mrs lr, spsr
- str lr, [r13, #4]
-
- mov r13, #MODE_SVC @ prepare SVC-Mode
- msr spsr_c, r13
- mov lr, pc
- movs pc, lr
- .endm
-
- .macro get_irq_stack @ setup IRQ stack
- ldr sp, IRQ_STACK_START
- .endm
-
- .macro get_fiq_stack @ setup FIQ stack
- ldr sp, FIQ_STACK_START
- .endm
-
-/*
- * exception handlers
- */
- .align 5
-undefined_instruction:
- get_bad_stack
- bad_save_user_regs
- bl do_undefined_instruction
-
- .align 5
-software_interrupt:
- get_bad_stack
- bad_save_user_regs
- bl do_software_interrupt
-
- .align 5
-prefetch_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_prefetch_abort
-
- .align 5
-data_abort:
- get_bad_stack
- bad_save_user_regs
- bl do_data_abort
-
- .align 5
-not_used:
- get_bad_stack
- bad_save_user_regs
- bl do_not_used
-
-#ifdef CONFIG_USE_IRQ
-
- .align 5
-irq:
- get_irq_stack
- irq_save_user_regs
- bl do_irq
- irq_restore_user_regs
-
- .align 5
-fiq:
- get_fiq_stack
- /* someone ought to write a more effiction fiq_save_user_regs */
- irq_save_user_regs
- bl do_fiq
- irq_restore_user_regs
-
-#else
-
- .align 5
-irq:
- get_bad_stack
- bad_save_user_regs
- bl do_irq
-
- .align 5
-fiq:
- get_bad_stack
- bad_save_user_regs
- bl do_fiq
-
-#endif
-
- .align 5
-.globl reset_cpu
-reset_cpu:
- ldr r0, RST_BASE
- mov r1, #0x0 @ set bit 3-0 ...
- str r1, [r0, #RCSR] @ ... to clear in RCSR
- mov r1, #0x1
- str r1, [r0, #RSRR] @ and perform reset
- b reset_cpu @ silly, but repeat endlessly