diff -urN ixp400_xscale_sw_clean/Makefile ixp400_xscale_sw_kernel26/Makefile --- ixp400_xscale_sw_clean/Makefile 2003-12-12 20:58:27.000000000 +0100 +++ ixp400_xscale_sw_kernel26/Makefile 2004-08-11 11:28:53.000000000 +0200 @@ -35,7 +35,13 @@ # # + ################################################################ + +# include external settings file +include settings.mk + + # Determine the build host OS # In a Tornado environment, WIND_HOST_TYPE should be set @@ -83,8 +89,6 @@ # Components listed in BI_ENDIAN_COMPONENTS must work for both # big and little endian OSs. # -BI_ENDIAN_COMPONENTS := adsl atmdAcc atmm atmsch qmgr npeMh npeDl ethAcc ethDB ethMii hssAcc timerCtrl usb uartAcc ossl osServices featureCtrl perfProfAcc - COMPONENTS := $(BI_ENDIAN_COMPONENTS) @@ -184,7 +188,6 @@ else # IX_TARGET_OS == vxworks -LINUX_CROSS_COMPILE := $(HARDHAT_BASE)/devkit/arm/xscale_be/bin/xscale_be- LD := $(LINUX_CROSS_COMPILE)ld CC := $(LINUX_CROSS_COMPILE)gcc AR := $(LINUX_CROSS_COMPILE)ar @@ -205,18 +208,21 @@ else # linux compiler flags +# autodetection of LINUX_MACH_CFLAGS is noet reliable -> use manual settings +# in settings.mk + # For compatibility with MVL3.0, we need to check what compiler version we # have, and use different flags for each. -CC_VERSION:=$(shell $(CC) --version) -ifneq (,$(findstring (GCC) 3.3.1, $(CC_VERSION))) +#CC_VERSION:=$(shell $(CC) --version) +#ifneq (,$(findstring (GCC) 3.3.1, $(CC_VERSION))) # We have the newer gcc version included in MVL3.1 -LINUX_MACH_CFLAGS := -D__LINUX_ARM_ARCH__=5 -mcpu=xscale -mtune=xscale -else +#LINUX_MACH_CFLAGS := -D__LINUX_ARM_ARCH__=5 -mcpu=xscale -mtune=xscale +#else # We have a MVL3.0 compiler -LINUX_MACH_CFLAGS := -march=armv4 -Wa,-mxscale -mtune=strongarm -endif # gcc version +#LINUX_MACH_CFLAGS := -march=armv4 -Wa,-mxscale -mtune=strongarm +#endif # gcc version -CFLAGS := -mbig-endian -D__KERNEL__ -I$(LINUX_SRC)/include -Wall -Wno-trigraphs -fno-common -pipe -mapcs-32 -mshort-load-bytes -msoft-float -DMODULE -Isrc/linux -Isrc/include -D__linux -DCPU=33 -DXSCALE=33 $(LINUX_MACH_CFLAGS) +#CFLAGS := $(EXT_CFLAGS) # Linux linker flags LDFLAGS := -r @@ -1002,9 +1008,14 @@ ixp400.o : $(OBJ_DIR)/ixp400.o +ixp400.ko : $(OBJ_DIR)/ixp400.o + $(OBJ_DIR)/ixp400.o: $(COMPONENTS:%=$(OBJ_DIR)/ixp400_%.o) + touch $(OBJ_DIR)/ixp400.c + cp Makefile.kmod26 $(OBJ_DIR)/Makefile + make -C $(OBJ_DIR) $(LD) $(LDFLAGS) $^ -o $@ - + make -C $(OBJ_DIR) ################################################################ diff -urN ixp400_xscale_sw_clean/Makefile.kmod26 ixp400_xscale_sw_kernel26/Makefile.kmod26 --- ixp400_xscale_sw_clean/Makefile.kmod26 1970-01-01 01:00:00.000000000 +0100 +++ ixp400_xscale_sw_kernel26/Makefile.kmod26 2004-08-11 11:28:53.000000000 +0200 @@ -0,0 +1,9 @@ +obj-m := ixp400.o + +PWD := $(shell pwd) + +default: + $(MAKE) V=1 -C $(LINUX_SRC) SUBDIRS=$(PWD) modules + +clean: + rm -f ixp400.ko diff -urN ixp400_xscale_sw_clean/buildUtils/environment.linux.sh ixp400_xscale_sw_kernel26/buildUtils/environment.linux.sh --- ixp400_xscale_sw_clean/buildUtils/environment.linux.sh 2003-12-12 20:58:27.000000000 +0100 +++ ixp400_xscale_sw_kernel26/buildUtils/environment.linux.sh 2004-08-11 11:28:53.000000000 +0200 @@ -30,7 +30,7 @@ # # -- End Intel Copyright Notice -- # Change the following line to point to your linux kernel source tree -LINUX_SRC=/path/to/the/os/linux-2.4 +LINUX_SRC=/path/to/your/kernel-2.6.x # Change the following line to point to the root of your Monta Vista install HARDHAT_BASE=/opt/montavista/pro diff -urN ixp400_xscale_sw_clean/license_patch_kernel26.txt ixp400_xscale_sw_kernel26/license_patch_kernel26.txt --- ixp400_xscale_sw_clean/license_patch_kernel26.txt 1970-01-01 01:00:00.000000000 +0100 +++ ixp400_xscale_sw_kernel26/license_patch_kernel26.txt 2004-08-11 11:28:43.000000000 +0200 @@ -0,0 +1,20 @@ + Patch for IXP400 Access Library for Linux 2.6.x +--------------------------------------------------------------------- + License Information + + + +- The patch is licensed under the same conditions as the original + Access Library 1.4 (INTEL SOFTWARE LICENSE AGREEMENT). + The full text of the license can be downloaded from: + http://www.intel.com/design/network/swsup/np_sla/ixp400.htm + +- The patch is free, unsupported and the authors make no warrantees. + Use it at your own risk, do with it as you see fit so long as you + do not violate the original license agreement. + +- The authors permit derivative works based upon the patch. + + +--------------------------------------------------------------------- + Robin Farine and Tom Winkler, August 2004 diff -urN ixp400_xscale_sw_clean/settings.mk ixp400_xscale_sw_kernel26/settings.mk --- ixp400_xscale_sw_clean/settings.mk 1970-01-01 01:00:00.000000000 +0100 +++ ixp400_xscale_sw_kernel26/settings.mk 2004-08-11 11:28:53.000000000 +0200 @@ -0,0 +1,44 @@ + +# ----------------------------------------------------------------------------- +# cross compiler path + +LINUX_CROSS_COMPILE := /path/to/your/cross/compiler +#LINUX_CROSS_COMPILE := $(HARDHAT_BASE)/devkit/arm/xscale_be/bin/xscale_be- # default setting from intel Makefile + + + +# ----------------------------------------------------------------------------- +# LINUX_MACH_CFLAGS (autodetection in Makefile removed) + + +# default settings from intel Makefile (MVL 3.1) +# use this one for newer gcc versions (3.3.x and 3.4.x series) +LINUX_MACH_CFLAGS := -D__LINUX_ARM_ARCH__=5 -mcpu=xscale -mtune=xscale + +# default settings from intel Makefile (MVL 3.0) +# use this one for older gcc versions (3.2.x and below) +#LINUX_MACH_CFLAGS := -march=armv4 -Wa,-mxscale -mtune=strongarm + + + +# ----------------------------------------------------------------------------- +# CFLAGS + +# version that works with gcc 3.4.0 +CFLAGS := -mbig-endian -D__KERNEL__ -I$(LINUX_SRC)/include -Wall -Wno-trigraphs -fno-common -pipe -mapcs-32 -msoft-float -DMODULE -Isrc/linux -Isrc/include -D__linux -DCPU=33 -DXSCALE=33 $(LINUX_MACH_CFLAGS) + +# default settings from intel Makefile +#EXT_CFLAGS := -mbig-endian -D__KERNEL__ -I$(LINUX_SRC)/include -Wall -Wno-trigraphs -fno-common -pipe -mapcs-32 -mshort-load-bytes -msoft-float -DMODULE -Isrc/linux -Isrc/include -D__linux -DCPU=33 -DXSCALE=33 $(LINUX_MACH_CFLAGS) + +# ----------------------------------------------------------------------------- +# BI_ENDIAN_COMPONENTS +# select wich componentes of the AccessLib you want to build + +# the following set of components is sufficient to build the AccessLib to get the +# ethernet devices (NPEs) working +BI_ENDIAN_COMPONENTS := qmgr npeMh npeDl ethAcc ethDB ethMii ossl osServices featureCtrl + +# default settings from the intel Makefile +# notice: maybe not all componentes might work with 2.6 kernels (untested!) +#BI_ENDIAN_COMPONENTS := adsl atmdAcc atmm atmsch qmgr npeMh npeDl ethAcc ethDB ethMii hssAcc timerCtrl usb uartAcc ossl osServices featureCtrl perfProfAcc + diff -urN ixp400_xscale_sw_clean/src/codelets/usb/IxUSBRNDISEnumerator.c ixp400_xscale_sw_kernel26/src/codelets/usb/IxUSBRNDISEnumerator.c --- ixp400_xscale_sw_clean/src/codelets/usb/IxUSBRNDISEnumerator.c 2003-12-12 20:58:30.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/codelets/usb/IxUSBRNDISEnumerator.c 2004-08-11 11:28:53.000000000 +0200 @@ -68,12 +68,15 @@ USBDevice usbDevice; /* log control */ -#ifndef NDEBUG +#if defined(DEBUG) int rndisEnumTrace = 1; int rndisEnumVerboseTrace = 1; -#else +#elif defined(NDEBUG) int rndisEnumTrace = 0; int rndisEnumVerboseTrace = 0; +#else +int rndisEnumTrace = 1; +int rndisEnumVerboseTrace = 0; #endif /* prototypes */ @@ -392,7 +395,12 @@ va_list vap; va_start(vap, _fmt_); - retStatus = vsprintf(_buf_,_fmt_,vap); +#ifdef __linux + retStatus = vsnprintf(_buf_, sizeof _buf_ - 1, _fmt_, vap); + _buf_[sizeof _buf_ - 1] = 0; +#else + retStatus = vsprintf(_buf_,_fmt_,vap); +#endif if (retStatus > 0) { #ifdef __vxworks logMsg(_buf_,0,0,0,0,0,0); diff -urN ixp400_xscale_sw_clean/src/codelets/usb/IxUSBRNDISLinuxEnd.c ixp400_xscale_sw_kernel26/src/codelets/usb/IxUSBRNDISLinuxEnd.c --- ixp400_xscale_sw_clean/src/codelets/usb/IxUSBRNDISLinuxEnd.c 2003-12-12 20:58:30.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/codelets/usb/IxUSBRNDISLinuxEnd.c 2004-08-11 11:28:53.000000000 +0200 @@ -42,14 +42,20 @@ #include #include #include +#include #include #include #include "IxUSBRNDISEnd.h" /* Hardcoded parameters */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) +typedef unsigned long irq_flags_t; +#else #define MODULE_NAME "ixp_usb" #define MODULE_VERSION "0.0.1" +typedef int irq_flags_t; +#endif MODULE_DESCRIPTION("IXP425 USB Rndis driver"); @@ -66,7 +72,7 @@ static void rx_cb(struct net_device *dev, struct sk_buff *buffer) { priv_data_t *priv = dev->priv; - int irq_state; + irq_flags_t irq_state; spin_lock_irqsave(&priv->lock, irq_state); priv->stats.rx_packets++; @@ -129,7 +135,7 @@ static int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { priv_data_t *priv = dev->priv; - int irq_state; + irq_flags_t irq_state; spin_lock_irqsave(&priv->lock, irq_state); priv->stats.tx_packets++; @@ -222,4 +228,3 @@ module_init(do_module_init); module_exit(do_module_exit); - diff -urN ixp400_xscale_sw_clean/src/codelets/usb/include/IxUSBRNDIS.h ixp400_xscale_sw_kernel26/src/codelets/usb/include/IxUSBRNDIS.h --- ixp400_xscale_sw_clean/src/codelets/usb/include/IxUSBRNDIS.h 2003-12-12 20:58:31.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/codelets/usb/include/IxUSBRNDIS.h 2004-08-11 11:28:53.000000000 +0200 @@ -463,14 +463,14 @@ extern int enum_verbose_log_trace(char *_fmt_,...); -#define ENUM_VERBOSE_TRACE\ - if(rndisEnumVerboseTrace) enum_verbose_log_trace +#define ENUM_VERBOSE_TRACE \ + rndisEnumVerboseTrace && enum_verbose_log_trace #define RNDIS_VERBOSE_TRACE \ - if(rndisEnumVerboseTrace) ENUM_VERBOSE_TRACE + rndisEnumVerboseTrace && enum_verbose_log_trace #define ENUM_TRACE \ - if (rndisEnumTrace) ENUM_VERBOSE_TRACE + rndisEnumTrace && enum_verbose_log_trace #define RNDIS_TRACE \ - if (rndisEnumTrace) ENUM_VERBOSE_TRACE + rndisEnumTrace && enum_verbose_log_trace /* debug logging */ #ifndef __vxworks diff -urN ixp400_xscale_sw_clean/src/ethAcc/IxEthAccMii.c ixp400_xscale_sw_kernel26/src/ethAcc/IxEthAccMii.c --- ixp400_xscale_sw_clean/src/ethAcc/IxEthAccMii.c 2003-12-12 20:58:31.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/ethAcc/IxEthAccMii.c 2004-08-11 11:28:53.000000000 +0200 @@ -227,19 +227,20 @@ ixEthAccMdioCmdWrite(mdioCommand); - miiTimeout = IX_ETH_ACC_MII_TIMEOUT_10TH_SECS; + miiTimeout = IX_ETH_ACC_MII_TIMEOUT_10TH_SECS * + IX_ETH_ACC_MII_10TH_SEC_IN_MILLIS; while(miiTimeout) { - + /* Sleep for one millisecond */ + ixOsServTaskSleep(1); + ixEthAccMdioCmdRead(®val); if((regval & IX_ETH_ACC_MII_GO) == 0x0) { break; } - /*Sleep for 10th of a second*/ - ixOsServTaskSleep(IX_ETH_ACC_MII_10TH_SEC_IN_MILLIS); miiTimeout--; } @@ -307,10 +308,13 @@ ixEthAccMdioCmdWrite(mdioCommand); - miiTimeout = IX_ETH_ACC_MII_TIMEOUT_10TH_SECS; + miiTimeout = IX_ETH_ACC_MII_TIMEOUT_10TH_SECS * + IX_ETH_ACC_MII_10TH_SEC_IN_MILLIS; while(miiTimeout) { + /* Sleep for 1 millisecond */ + ixOsServTaskSleep(1); ixEthAccMdioCmdRead(®val); @@ -319,8 +323,6 @@ { break; } - /*Sleep for 100 milliseconds*/ - ixOsServTaskSleep(IX_ETH_ACC_MII_10TH_SEC_IN_MILLIS); miiTimeout--; } diff -urN ixp400_xscale_sw_clean/src/ethAcc/IxEthAccSymbols.c ixp400_xscale_sw_kernel26/src/ethAcc/IxEthAccSymbols.c --- ixp400_xscale_sw_clean/src/ethAcc/IxEthAccSymbols.c 2003-12-12 20:58:31.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/ethAcc/IxEthAccSymbols.c 2004-08-11 11:28:53.000000000 +0200 @@ -97,12 +97,6 @@ EXPORT_SYMBOL(ixEthAccMiiWriteRtn); EXPORT_SYMBOL(ixEthAccStatsShow); -extern const char* mac2string(const unsigned char *mac); -extern UINT32 ixEthDBAddressCompare(UINT8 *mac1, UINT8 *mac2); - -EXPORT_SYMBOL(mac2string); -EXPORT_SYMBOL(ixEthDBAddressCompare); - EXPORT_SYMBOL(ixEthRxFrameQMCallback); EXPORT_SYMBOL(ixEthTxFrameDoneQMCallback); diff -urN ixp400_xscale_sw_clean/src/ethDB/IxEthDBSymbols.c ixp400_xscale_sw_kernel26/src/ethDB/IxEthDBSymbols.c --- ixp400_xscale_sw_clean/src/ethDB/IxEthDBSymbols.c 2003-12-12 20:58:31.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/ethDB/IxEthDBSymbols.c 2004-08-11 11:28:53.000000000 +0200 @@ -73,4 +73,10 @@ EXPORT_SYMBOL(ixEthDBFilteringDatabaseShowAll); +extern const char* mac2string(const unsigned char *mac); +extern UINT32 ixEthDBAddressCompare(UINT8 *mac1, UINT8 *mac2); + +EXPORT_SYMBOL(mac2string); +EXPORT_SYMBOL(ixEthDBAddressCompare); + #endif /* __linux */ diff -urN ixp400_xscale_sw_clean/src/ethDB/IxEthNoDBStubs.c ixp400_xscale_sw_kernel26/src/ethDB/IxEthNoDBStubs.c --- ixp400_xscale_sw_clean/src/ethDB/IxEthNoDBStubs.c 1970-01-01 01:00:00.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/ethDB/IxEthNoDBStubs.c 2004-08-11 11:28:53.000000000 +0200 @@ -0,0 +1,90 @@ +/* + * Stubs used when building without the EthDB component. + */ + +#include +#include + +IX_ETH_DB_PUBLIC +IxEthDBStatus +ixEthDBInit() +{ + return IX_ETH_DB_SUCCESS; +} +EXPORT_SYMBOL(ixEthDBInit); + +IX_ETH_DB_PUBLIC +void +ixEthDBPortInit(IxEthDBPortId portID) +{ + portID = portID; +} +EXPORT_SYMBOL(ixEthDBPortInit); + +IX_ETH_DB_PUBLIC +IxEthDBStatus +ixEthDBPortAddressSet(IxEthDBPortId portID, IxEthDBMacAddr *macAddr) +{ + portID = portID; + macAddr = macAddr; + return IX_ETH_DB_SUCCESS; +} +EXPORT_SYMBOL(ixEthDBPortAddressSet); + +IX_ETH_DB_PUBLIC +IxEthDBStatus +ixEthDBPortEnable(IxEthDBPortId portID) +{ + portID = portID; + return IX_ETH_DB_SUCCESS; +} +EXPORT_SYMBOL(ixEthDBPortEnable); + +IX_ETH_DB_PUBLIC +IxEthDBStatus +ixEthDBPortDisable(IxEthDBPortId portID) +{ + portID = portID; + return IX_ETH_DB_SUCCESS; +} +EXPORT_SYMBOL(ixEthDBPortDisable); + +IX_ETH_DB_PUBLIC +IxEthDBStatus +ixEthDBPortAgingEnable(IxEthDBPortId portID) +{ + portID = portID; + return IX_ETH_DB_SUCCESS; +} +EXPORT_SYMBOL(ixEthDBPortAgingEnable); + +IX_ETH_DB_PUBLIC +IxEthDBStatus +ixEthDBPortAgingDisable(IxEthDBPortId portID) +{ + portID = portID; + return IX_ETH_DB_SUCCESS; +} +EXPORT_SYMBOL(ixEthDBPortAgingDisable); + +IX_ETH_DB_PUBLIC +IxEthDBStatus +ixEthDBFilteringPortMaximumFrameSizeSet(IxEthDBPortId portID, + UINT32 maximumFrameSize) +{ + portID = portID; + maximumFrameSize = maximumFrameSize; + return IX_ETH_DB_SUCCESS; +} +EXPORT_SYMBOL(ixEthDBFilteringPortMaximumFrameSizeSet); + +IX_ETH_DB_PUBLIC +void +ixEthDBDatabaseMaintenance() +{} +EXPORT_SYMBOL(ixEthDBDatabaseMaintenance); + +/* + * This file's unique identifier, don't change it. + * arch-tag: e1a32b54-9412-44f5-9541-78938ceab64b + */ diff -urN ixp400_xscale_sw_clean/src/include/IxOsCacheMMU.h ixp400_xscale_sw_kernel26/src/include/IxOsCacheMMU.h --- ixp400_xscale_sw_clean/src/include/IxOsCacheMMU.h 2003-12-12 20:58:33.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/include/IxOsCacheMMU.h 2004-08-11 11:28:53.000000000 +0200 @@ -341,19 +341,41 @@ #error "Uncached memory not supported in linux environment" #endif +#include +#include #include #include -#include #include /** * Linux implementations of above macros. */ -#define IX_MMU_VIRTUAL_TO_PHYSICAL_TRANSLATION(addr) ((addr) ? virt_to_phys((void*)(addr)) : 0) -#define IX_MMU_PHYSICAL_TO_VIRTUAL_TRANSLATION(addr) ((addr) ? phys_to_virt((unsigned int)(addr)) : 0) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) + +/* + * 2.6 kernels do not export the required cache functions. + */ + +extern void ix_dcache_invalidate_range(unsigned long start, unsigned long size); +extern void ix_dcache_flush_range(unsigned long start, unsigned long size); + +#define IX_ACC_DATA_CACHE_INVALIDATE(addr,size) \ +ix_dcache_invalidate_range((unsigned long)addr, (unsigned long)addr + size) + +#define IX_ACC_DATA_CACHE_FLUSH(addr,size) \ +ix_dcache_flush_range((unsigned long)addr, (unsigned long)addr + size ) + +#else + #define IX_ACC_DATA_CACHE_INVALIDATE(addr,size) invalidate_dcache_range((__u32)addr, (__u32)addr + size ) #define IX_ACC_DATA_CACHE_FLUSH(addr,size) clean_dcache_range((__u32)addr, (__u32)addr + size ) + +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) */ + +#define IX_MMU_VIRTUAL_TO_PHYSICAL_TRANSLATION(addr) ((addr) ? virt_to_phys((void*)(addr)) : 0) +#define IX_MMU_PHYSICAL_TO_VIRTUAL_TRANSLATION(addr) ((addr) ? phys_to_virt((unsigned int)(addr)) : 0) + #define IX_ACC_DRAM_PHYS_OFFSET (PHYS_OFFSET) #define IX_XSCALE_CACHE_LINE_SIZE 32 diff -urN ixp400_xscale_sw_clean/src/include/IxOsServicesMemMap.h ixp400_xscale_sw_kernel26/src/include/IxOsServicesMemMap.h --- ixp400_xscale_sw_clean/src/include/IxOsServicesMemMap.h 2003-12-12 20:58:33.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/include/IxOsServicesMemMap.h 2004-08-11 11:28:53.000000000 +0200 @@ -321,13 +321,22 @@ IxOsServMemoryMap ixOsServGlobalMemoryMap[] = { /* Queue Manager */ - { - IX_STATIC_MAP, /* type */ + { +#ifdef IXP425_QMGR_BASE_VIRT + IX_STATIC_MAP, /* type */ + IXP425_QMGR_BASE_PHYS, /* physicalAddress */ + IXP425_QMGR_REGION_SIZE, /* size */ + IXP425_QMGR_BASE_VIRT, /* virtualAddress */ + NULL, /* mapFunction */ + NULL, /* unmapFunction */ +#else + IX_DYNAMIC_MAP, /* type */ IXP425_QMGR_BASE_PHYS, /* physicalAddress */ IXP425_QMGR_REGION_SIZE, /* size */ - IXP425_QMGR_BASE_VIRT, /* virtualAddress */ - NULL, /* mapFunction */ - NULL, /* unmapFunction */ + 0, /* virtualAddress */ + ixOsServLinuxMemMap, /* mapFunction */ + ixOsServLinuxMemUnmap, /* unmapFunction */ +#endif 0, /* refCount */ IX_BE_MAP, /* coherency */ "qMgr" /* name */ diff -urN ixp400_xscale_sw_clean/src/linux/IxLinuxSymbols.c ixp400_xscale_sw_kernel26/src/linux/IxLinuxSymbols.c --- ixp400_xscale_sw_clean/src/linux/IxLinuxSymbols.c 2003-12-12 20:58:34.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/linux/IxLinuxSymbols.c 2004-08-11 11:28:53.000000000 +0200 @@ -61,7 +61,7 @@ return 0; } -static void __init csr_cleanup_module(void) +static void __exit csr_cleanup_module(void) { /* Add cleanup code here */ printk("Module uninit.\n."); diff -urN ixp400_xscale_sw_clean/src/linux/ixp425.h ixp400_xscale_sw_kernel26/src/linux/ixp425.h --- ixp400_xscale_sw_clean/src/linux/ixp425.h 2003-12-12 20:58:34.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/linux/ixp425.h 2004-08-11 11:28:53.000000000 +0200 @@ -57,7 +57,69 @@ #define IRQ_IXP425_XSCALE_PMU IRQ_IXP425_INTC_XSCALE_PMU /* The following is used by perfProfAcc */ #define IRQ_IXP425_AHB_PMU IRQ_IXP425_INTC_AHB_PMU -#endif /* kernel < 2.4.20 */ + +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) + +/* + * I/O base address definitions missing from Linux 2.6 trees. + */ + +/* + * Expansion BUS (ioremapped) + */ +#define IXP425_EXP_BUS_BASE_PHYS 0x50000000 +#define IXP425_EXP_BUS_REGION_SIZE 0x08000000 + +/* + * Q Manager space (ioremapped) + */ +#define IXP425_QMGR_BASE_PHYS 0x60000000 +#define IXP425_QMGR_REGION_SIZE 0x00004000 + +/* + * Peripheral space + */ +#define IXP425_PERIPHERAL_BASE_PHYS IXP4XX_PERIPHERAL_BASE_PHYS +#define IXP425_PERIPHERAL_BASE_VIRT IXP4XX_PERIPHERAL_BASE_VIRT +#define IXP425_PERIPHERAL_REGION_SIZE IXP4XX_PERIPHERAL_REGION_SIZE + +/* + * PCI Configuration space + */ +#define IXP425_PCI_CFG_BASE_PHYS IXP4XX_PCI_CFG_BASE_PHYS +#define IXP425_PCI_CFG_BASE_VIRT IXP4XX_PCI_CFG_BASE_VIRT +#define IXP425_PCI_CFG_REGION_SIZE IXP4XX_PCI_CFG_REGION_SIZE + +/* + * Expansion BUS Configuration registers + */ +#define IXP425_EXP_CFG_BASE_PHYS IXP4XX_EXP_CFG_BASE_PHYS +#define IXP425_EXP_CFG_BASE_VIRT IXP4XX_EXP_CFG_BASE_VIRT +#define IXP425_EXP_CFG_REGION_SIZE IXP4XX_EXP_CFG_REGION_SIZE + +/* + * Peripheral Space Registers + */ +#define IXP425_TIMER_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x5000) +#define IXP425_EthA_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x9000) +#define IXP425_EthB_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0xA000) +#define IXP425_USB_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0xB000) + +/* + * Map IRQ names defined in 'linux/include/asm-arm/arch-ixp4xx/irqs.h' + */ +#define IRQ_IXP425_NPEA IRQ_IXP4XX_NPEA +#define IRQ_IXP425_NPEB IRQ_IXP4XX_NPEB +#define IRQ_IXP425_NPEC IRQ_IXP4XX_NPEC +#define IRQ_IXP425_QM1 IRQ_IXP4XX_QM1 +#define IRQ_IXP425_QM2 IRQ_IXP4XX_QM2 +#define IRQ_IXP425_USB IRQ_IXP4XX_USB +#define IRQ_IXP425_TIMER1 IRQ_IXP4XX_TIMER1 +#define IRQ_IXP425_WDOG IRQ_IXP4XX_WDOG +#define IRQ_IXP425_TIMESTAMP IRQ_IXP4XX_TIMESTAMP +#define IRQ_IXP425_XSCALE_PMU IRQ_IXP4XX_XSCALE_PMU + +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) */ #define IXP425_INT_LVL_NPEA IRQ_IXP425_NPEA diff -urN ixp400_xscale_sw_clean/src/linux/std.h ixp400_xscale_sw_kernel26/src/linux/std.h --- ixp400_xscale_sw_clean/src/linux/std.h 2003-12-12 20:58:34.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/linux/std.h 2004-08-11 11:28:53.000000000 +0200 @@ -74,6 +74,6 @@ #undef PARODD /* assert macro. TODO - all uses of this should be changed to IxAssert */ -#define assert(E) if (!(E)) { printk("Assertion '%s' failed.\n",#E); } +#define assert(E) if (!(E)) { printk("Assertion '%s' failed.\n",#E); BUG(); } #endif diff -urN ixp400_xscale_sw_clean/src/osServices/IxOsCacheMMU.c ixp400_xscale_sw_kernel26/src/osServices/IxOsCacheMMU.c --- ixp400_xscale_sw_clean/src/osServices/IxOsCacheMMU.c 2003-12-12 20:58:35.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/osServices/IxOsCacheMMU.c 2004-08-11 11:28:53.000000000 +0200 @@ -156,6 +156,63 @@ free_pages((unsigned int)ptr, order); } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) + +/* + * 2.6 kernels do not export the required cache management routines so + * reimplement them here. + */ + +#define _IX_STR(x) #x +#define IX_STR(x) _IX_STR(x) +#define IX_CLM IX_STR(IX_XSCALE_CACHE_LINE_SIZE-1) + +/* + * IX_ACC_DATA_CACHE_INVALIDATE(addr, size) + */ +void +ix_dcache_invalidate_range(unsigned long start, unsigned long size) +{ + __asm__ + (" tst %0, #" IX_CLM "\n" + " mcrne p15, 0, %0, c7, c10, 1 @ clean D cache line\n" + " bic %0, %0, #" IX_CLM "\n" + " tst %1, #" IX_CLM "\n" + " mcrne p15, 0, %1, c7, c10, 1 @ clean D cache line\n" + "1: mcr p15, 0, %0, c7, c6, 1 @ invalidate D cache line\n" + " add %0, %0, #" IX_STR(IX_XSCALE_CACHE_LINE_SIZE) "\n" + " cmp %0, %1\n" + " blo 1b\n" + " mcr p15, 0, %0, c7, c10, 4 @ drain write & fill buffer\n" + : /* no output */ + : "r"(start), "r"(size) + : "cc"); +} + +/* + * IX_ACC_DATA_CACHE_FLUSH(addr, size) + */ +void +ix_dcache_flush_range(unsigned long start, unsigned long size) +{ + __asm__ + (" bic %0, %0, #" IX_CLM "\n" + "1: mcr p15, 0, %0, c7, c10, 1 @ clean D cache line\n" + " add %0, %0, #" IX_STR(IX_XSCALE_CACHE_LINE_SIZE) "\n" + " cmp %0, %1\n" + " blo 1b\n" + " mcr p15, 0, %0, c7, c10, 4 @ drain write & fill buffer\n" + : /* no output */ + : "r"(start), "r"(size) + : "cc"); +} + +#undef _IX_STR +#undef IX_STR +#undef IX_CLM + +#endif + #else /* POSIX */ /* * Allocate on a cache line boundary (null pointers are diff -urN ixp400_xscale_sw_clean/src/osServices/IxOsServices.c ixp400_xscale_sw_kernel26/src/osServices/IxOsServices.c --- ixp400_xscale_sw_clean/src/osServices/IxOsServices.c 2003-12-12 20:58:35.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/osServices/IxOsServices.c 2004-08-11 11:28:53.000000000 +0200 @@ -118,13 +118,23 @@ static isr_info_t isr_info[NR_IRQS]; -static void isr_proxy(int irg, void *dev_id, struct pt_regs *regs) +#ifndef IRQ_NONE +typedef void irqreturn_t; +#define IRQ_NONE +#define IRQ_HANDLED +#endif + +static irqreturn_t isr_proxy(int irg, void *dev_id, struct pt_regs *regs) { isr_info_t *isr_proxy_info = NULL; ixOsServLinuxInterruptedPc = regs->ARM_pc; isr_proxy_info = (isr_info_t *)dev_id; if (isr_proxy_info && isr_proxy_info->routine) - isr_proxy_info->routine(isr_proxy_info->parameter); + { + isr_proxy_info->routine(isr_proxy_info->parameter); + return IRQ_HANDLED; + } + return IRQ_NONE; } #endif @@ -211,11 +221,17 @@ return intLock(); #endif -#elif defined(__linux) +#elif defined(__linux) +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) + unsigned long flags; + local_irq_save(flags); + return (int)flags; +# else int flags; save_flags(flags); cli(); return flags; +# endif #else return IX_FAIL; @@ -233,7 +249,11 @@ #endif #elif defined (__linux) +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) + local_irq_restore((unsigned long)lockKey); +# else restore_flags(lockKey); +# endif #endif /* __vxworks */ } @@ -541,10 +561,11 @@ taskDelay(delay); #elif defined(__linux) - if ( milliseconds != 0 ) + signed long delay = milliseconds*HZ; + if ( delay >= 1000 ) { current->state = TASK_INTERRUPTIBLE; - schedule_timeout((milliseconds*HZ)/1000); + schedule_timeout(delay/1000); } else { diff -urN ixp400_xscale_sw_clean/src/osServices/IxOsServicesSymbols.c ixp400_xscale_sw_kernel26/src/osServices/IxOsServicesSymbols.c --- ixp400_xscale_sw_clean/src/osServices/IxOsServicesSymbols.c 2003-12-12 20:58:35.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/osServices/IxOsServicesSymbols.c 2004-08-11 11:28:53.000000000 +0200 @@ -91,5 +91,10 @@ EXPORT_SYMBOL(ixOsServMemMap); EXPORT_SYMBOL(ixOsServMemUnmap); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) +EXPORT_SYMBOL(ix_dcache_invalidate_range); +EXPORT_SYMBOL(ix_dcache_flush_range); +#endif + #endif /* __linux */ diff -urN ixp400_xscale_sw_clean/src/ossl/osslSema.c ixp400_xscale_sw_kernel26/src/ossl/osslSema.c --- ixp400_xscale_sw_clean/src/ossl/osslSema.c 2003-12-12 20:58:35.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/ossl/osslSema.c 2004-08-11 11:28:53.000000000 +0200 @@ -67,6 +67,12 @@ #ifdef __linux #include +#include +#include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) +#else +#include +#endif #else #include #include "internal-osslThreadUtils.h" @@ -164,7 +170,7 @@ default: { - unsigned int time = jiffies + timeout; + unsigned long time = jiffies + (timeout*HZ)/1000; while (1) { if (!down_trylock(sid)) @@ -173,7 +179,7 @@ } else { - if (time < jiffies) + if (time_after(jiffies, time)) { ret = IX_OSSL_ERROR_OS_CALL_FAILURE; break; diff -urN ixp400_xscale_sw_clean/src/ossl/osslThread.c ixp400_xscale_sw_kernel26/src/ossl/osslThread.c --- ixp400_xscale_sw_clean/src/ossl/osslThread.c 2003-12-12 20:58:35.000000000 +0100 +++ ixp400_xscale_sw_kernel26/src/ossl/osslThread.c 2004-08-11 11:28:53.000000000 +0200 @@ -83,6 +83,7 @@ #ifdef __linux #include +#include #else #include #include "internal-osslThreadUtils.h" @@ -104,10 +105,14 @@ ix_ossl_thread_entry_point_t entryPoint = threadData.entryPoint; void *arg = threadData.arg; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) + daemonize("ixp425_csr"); +#else daemonize(); exit_files(current); snprintf(current->comm, sizeof(current->comm), "ixp425_csr"); +#endif up(&tdMutex); return entryPoint(arg, NULL);