Please note: This project is no longer active. The website is kept online for historic purposes only.
If you´re looking for a Linux driver for your Atheros WLAN device, you should continue here .

Ticket #336 (closed defect: fixed)

Opened 14 years ago

Last modified 12 years ago

compilation error from ah_osdep.h, compiled for linux 2.4.24, xscale-ixp425, big endian.

Reported by: anonymous Assigned to:
Priority: major Milestone: version 0.9.5
Component: madwifi: HAL Version: trunk
Keywords: Cc:
Patch is attached: 1 Pending:

Description (Last modified by mrenzmann)

I pull the lastest ng code from svn and did cross-compile:

/usr/local/bin/arm-linux-gcc -D__KERNEL__ -I/home/bcheng/snapgear/linux-2.4.x/include  -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe -mapcs-32 -D__LINUX _ARM_ARCH__=5 -mcpu=xscale -mtune=xscale -mshort-load-bytes -msoft-float -Uarm -DMODULE -include ./../include/compat.h -I./../include -I./../hal -I./../hal/linux -I./../ath_hal -I./.. -Werror -DAH_BYTE_ORDER=AH_BIG_ENDIAN -DAH_REGOPS_FUNC -mbig-endian -fno-strict-aliasing -fno-common -mapcs-32 -mtune=xscale  -mshort-load-bytes -msoft-float -mfp=2 -DATH_SUPERG_FF=1 -DATH_SUPERG_DYNTURBO=1 -DATH_TURBO_SCAN=1 -DATH_SUPERG_XR=1 -nostdinc -iwithprefix include -DKBUILD_BASENAME=ah_osdep  -DEXPORT_SYMTAB -c ah_osdep.ccc1: warnings being treated as errors
ah_osdep.c: In function `ath_hal_reg_write':
ah_osdep.c:330: warning: passing arg 2 of `__writel' makes integer from pointer without a cast
ah_osdep.c:330: warning: passing arg 2 of `__writel' makes integer from pointer without a cast
ah_osdep.c: In function `ath_hal_reg_read':
ah_osdep.c:339: warning: passing arg 1 of `__readl' makes integer from pointer without a cast
ah_osdep.c:339: warning: passing arg 1 of `__readl' makes integer from pointer without a cast
make[3]: *** [ah_osdep.o] Error 1
make[3]: Leaving directory `/home/bcheng/snapgear/madwifi-ng/ath_hal'

The errors are from ../hal/linux/ah_osdep.h

#define _OS_REG_WRITE(_ah, _reg, _val) do {                                 \
        if ( (_reg) >= 0x4000 && (_reg) < 0x5000)                           \
            writel((_val), (volatile u_int32_t *)((_ah)->ah_sh + (_reg)));\
        else                                                                \
            writel(__bswap32(_val), (volatile u_int32_t *)((_ah)->ah_sh + (_reg))); \
} while (0)

I fixed Error by adding a typecast (u32) to writel((_val), (volatile u_int32_t *)((_ah)->ah_sh + (_reg)));\

But later I received "unable to attach hardware - HAL status 13" error

# insmod wlan.o
Using wlan.o
wlan: 0.8.4.2 (Atheros/multi-bss)
# insmod ath_hal.o
Using ath_hal.o
Warning: loading ath_hal will taint the kernel: non-GPL license - Proprietary
  See http://www.tux.org/lkml/#export-tainted for information about tainted modules
ath_hal: 0.9.16.13 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413, REGOPS_FUNC, DFS)
# insmod ath_rate_sample.o
Using ath_rate_sample.o
ath_rate_sample: 1.2
# insmod ath_pci.o
Using ath_pci.o
ath_pci: 0.9.4.5 (Atheros/multi-bss)
wifi%d: unable to attach hardware: 'Hardware revision not supported' (HAL status 13)

Then I looked at the ../hal/linux/ah_osdep.h from /!svn/ver/1394/trunk It has a different definition. there is no ( *) pointer typecast in writel() and readl()

#define _OS_REG_WRITE(_ah, _reg, _val) do {                                 \
        if ( (_reg) >= 0x4000 && (_reg) < 0x5000)                           \
            writel((_val), (volatile unsigned long)((_ah)->ah_sh + (_reg)));\
        else                                                                \
            writel(__bswap32(_val), (volatile unsigned long)((_ah)->ah_sh + (_reg))); \
} while (0)

I used this definition and didn't see any compilation error but I received the same error from insmod ath_pci.o

# insmod ath_pci.o
Using ath_pci.o
ath_pci: 0.9.4.5 (Atheros/multi-bss)
wifi%d: unable to attach hardware: 'Hardware revision not supported' (HAL status 13)

However, the madwifi-ng from /!svn/ver/1349/trunk works fine on my ixp425-based board. No compilation error, no (HAL status 13) error

I'm running linux 2.4.24, using XSCALE processor with big-endian configuration.

I looked at the ../hal/linux/ah_osdep.h file, there is no writel() in _OS_REG_WRITE()

I'm confused, ah_osdep.h constantly been changing.


#if AH_BYTE_ORDER == AH_BIG_ENDIAN
#define _OS_REG_WRITE(_ah, _reg, _val) do {                                 \
        if ( (_reg) >= 0x4000 && (_reg) < 0x5000)                           \
                *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) =          \
                        __bswap32((_val));                                  \
        else                                                                \
                *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = (_val);  \
} while (0)
#define _OS_REG_READ(_ah, _reg) \
        (((_reg) >= 0x4000 && (_reg) < 0x5000) ? \
                __bswap32(*((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))) : \
                *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))))
#else /* AH_LITTLE_ENDIAN */
#define _OS_REG_WRITE(_ah, _reg, _val) do { \
        *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = (_val); \
} while (0)
#define _OS_REG_READ(_ah, _reg) \
        *((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))
#endif /* AH_BYTE_ORDER */

# insmod wlan.o
Using wlan.o
wlan: 0.8.4.2 (Atheros/multi-bss)
# insmod ath_hal.o
Using ath_hal.o
Warning: loading ath_hal will taint the kernel: non-GPL license - Proprietary
  See http://www.tux.org/lkml/#export-tainted for information about tainted modules
ath_hal: 0.9.16.3 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413, REGOPS_FUNC, DFS)
# insmod ath_rate_sample.o
Using ath_rate_sample.o
ath_rate_sample: 1.2
# insmod wlan_scan_sta.o
Using wlan_scan_sta.o
# insmod ath_pci.o
Using ath_pci.o
ath_pci: 0.9.4.5 (Atheros/multi-bss)
wifi0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
wifi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
wifi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbpswifi0: H/W encryption support: WEP AES AES_CCM TKIP
wifi0: mac 5.9 phy 4.3 radio 3.6
wifi0: Use hw queue 1 for WME_AC_BE traffic
wifi0: Use hw queue 0 for WME_AC_BK traffic
wifi0: Use hw queue 2 for WME_AC_VI traffic
wifi0: Use hw queue 3 for WME_AC_VO traffic
wifi0: Use hw queue 8 for CAB traffic
wifi0: Use hw queue 9 for beacons
wifi0: Atheros 5212: mem=0x4bff0000, irq=28

Change History

01/24/06 21:24:41 changed by mrenzmann

  • description changed.

01/27/06 08:11:27 changed by mrenzmann

Compilation problem solved with r1416. Reporter will give feedback soon whether the problem related to "HAL status 3" is also fixed (which most probably is distinct problem).

01/27/06 20:57:02 changed by anonymous

r1416 fixed compilation error but still received "unable to attach hardware" when inserting ath_pci.o. What this error is about?

Then I just copied _OS_REG_WRITE() and _OS_REG_READ() definitions from r1349. e.g. *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = \

bswap32((_val));

instead of using writel()/readl()

Now inserting ath_pci.o works fine now like in r1349.

02/01/06 05:34:44 changed by mrenzmann

Can you please attach a patch that implements the suggested change, or use WikiFormatting at least to make it readable?

02/08/06 00:39:58 changed by anonymous

  • patch_attached changed.

Sorry for the delay:

diff ah_osdep.h_good ah_osdep.h_bad > mypatch
>cat mypatch

156c156,157
< #if ( defined(CONFIG_PPC_PMAC) || defined(CONFIG_ARCH_IXP425) || defined(CONFIG_ARCH_IXP4XX))
---
> #if ( defined(CONFIG_PPC_PMAC) ||
>       defined(CONFIG_ARCH_IXP425) || defined(CONFIG_ARCH_IXP4XX))
172,173c173
<           *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) =          \
<                         __bswap32((_val)); \
---
>             writel((_val), (io_addr_t)((_ah)->ah_sh + (_reg)));\
175c175
<           *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = (_val); \
---
>             writel(__bswap32(_val), (io_addr_t)((_ah)->ah_sh + (_reg))); \
178,180c178,181
<         (((_reg) >= 0x4000 && (_reg) < 0x5000) ? \
<             __bswap32(*((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))) : \
<                 *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))))
---
>         (((_reg) >= 0x4000 && (_reg) < 0x5000) ?                            \
>             readl((io_addr_t)((_ah)->ah_sh + (_reg))) :        \
>             __bswap32(readl((io_addr_t)((_ah)->ah_sh + (_reg)))))
>



02/08/06 07:38:45 changed by mrenzmann

  • patch_attached set to 1.

The patch failed for me on r1444. Please rediff your patch against that version (please, please use unified diff format), attach the new patch to this ticket and sign it off. Thanks.

02/10/06 23:01:24 changed by anonymous

I did checkout from r1447, modified as in diff and tested for my board.

diff -Nurb madwifi-ng/hal/linux/ah_osdep.h madwifi-ng-work/hal/linux/ah_osdep.h >ah_osdep_h.diff

cat ah_osdep_h.diff for r1447

--- madwifi-ng/hal/linux/ah_osdep.h     2006-02-10 13:17:20.000000000 -0800
+++ madwifi-ng-work/hal/linux/ah_osdep.h        2006-02-10 11:58:18.000000000 -0800
@@ -167,14 +167,15 @@

 #define _OS_REG_WRITE(_ah, _reg, _val) do {                                 \
         if ( (_reg) >= 0x4000 && (_reg) < 0x5000)                           \
-            writel((_val), (io_addr_t)((_ah)->ah_sh + (_reg)));\
+            *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) =          \
+                        __bswap32((_val)); \
         else                                                                \
-            writel(__bswap32(_val), (io_addr_t)((_ah)->ah_sh + (_reg))); \
+            *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = (_val); \
 } while (0)
 #define _OS_REG_READ(_ah, _reg) \
         (((_reg) >= 0x4000 && (_reg) < 0x5000) ?                            \
-            readl((io_addr_t)((_ah)->ah_sh + (_reg))) :        \
-            __bswap32(readl((io_addr_t)((_ah)->ah_sh + (_reg)))))
+            __bswap32(*((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))) : \
+                *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))))

 #else  /* normal case */





05/14/06 09:24:52 changed by dyqith

How are we doing with this ? Do we still need this patched ? or is this issue fixed ?

06/21/07 22:59:25 changed by mtaylor

  • status changed from new to closed.
  • resolution set to fixed.

This issue is fixed in trunk.

06/27/07 12:17:00 changed by mrenzmann

  • milestone set to version 0.9.4.

02/11/08 06:10:08 changed by mrenzmann

  • milestone changed from version 0.9.4 to version 0.9.5.