# Atheros HAL problem



## free_daemon (Jan 28, 2010)

Hi,

I am new in FreeBSD. Currently I use Linux, but I wish to switch to FreeBSD. My Atheros PCMCIA-Card works under Linux with ath5k, but FreeBSD could not load the HAL for this adapter.

Linux output of "tail -f /var/log/messages" when i plug in the adapter

```
kernel: [13076.760077] pcmcia_socket pcmcia_socket0: pccard: CardBus card insert
ed into slot 0
kernel: [13076.847217] ath5k_pci 0000:06:00.0: enabling device (0000 -> 0002)
kernel: [13076.760077] pcmcia_socket pcmcia_socket0: pccard: CardBus card inserted into slot 0
kernel: [13076.847217] ath5k_pci 0000:06:00.0: enabling device (0000 -> 0002)
kernel: [13076.847238] ath5k_pci 0000:06:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
kernel: [13076.847361] ath5k_pci 0000:06:00.0: registered as 'phy1'
kernel: [13076.891423] ath5k phy1: Atheros AR5212 chip found (MAC: 0x56, PHY: 0x41)
kernel: [13076.891429] ath5k phy1: RF5111 5GHz radio found (0x17)
kernel: [13076.891434] ath5k phy1: RF2111 2GHz radio found (0x23)
```

Linux output of: lspci -v

```
06:00.0 Ethernet controller: Atheros Communications Inc. Atheros AR5001X+ Wireless Network Adapter (rev 01)
        Subsystem: PROXIM Inc Device 0a40
        Flags: bus master, medium devsel, latency 168, IRQ 16
        Memory at c4000000 (32-bit, non-prefetchable) [size=64K]
        Capabilities: [44] Power Management version 2
        Kernel driver in use: ath5k_pci
        Kernel modules: ath_pci, ath5k
```

FreeBSD 8 output of "tail -f /var/log/messages" when i plug in the adapter

```
kernel: cardbus0: Expecting link target, got 0x0
kernel: cardbus0: Expecting link target, got 0x0
kernel: ath0: <Atheros 5212> mem 0xbf6b0000-0xbf6bffff irq 16 at device 0.0 on cardbus0
kernel: ath0: [ITHREAD]
kernel: ath0: unable to attach hardware; HAL status 13
kernel: device_attach: ath0 attach returned 6
```

FreeBSD 8 output of: lspci -v

```
06:00.0 Ethernet controller: Atheros Communications Inc. Atheros AR5001X+ Wireless Network Adapter (rev 01)
        Subsystem: PROXIM Inc Device 0a40
        Flags: bus master, medium devsel, latency 168, IRQ 16
        Memory at bf6b0000 (32-bit, non-prefetchable)
        Capabilities: [44] Power Management version 2
```

I know that the chip is not listed in ath(4) but i hope there is a possibility to get the card working, because it works under Linux.

Thanks for any help!


----------



## LateNiteTV (Jan 28, 2010)

after you plug it in, whats the output of `$ pciconf -lv`


----------



## free_daemon (Jan 28, 2010)

The output of: pciconf -lv

```
ath0@pci0:6:0:0:        class=0x020000 card=0x0a4014b7 chip=0x0013168c rev=0x01 hdr=0x00
    vendor     = 'Atheros Communications Inc.'
    device     = '802.11a/b/g Wireless Adapter (AR5212)'
    class      = network
    subclass   = ethernet
```


----------



## bschmidt (Jan 28, 2010)

HAL status 13 means that the MAC/PHY revision isn't supported.

There's definitely a debug sysctl for ath_hal available with which you get MAC/PHY version, using that information someone might be able to hack something together.


----------



## free_daemon (Jan 28, 2010)

bschmidt said:
			
		

> There's definitely a debug sysctl for ath_hal available with which you get MAC/PHY version, using that information someone might be able to hack something together.



I don't know exactly what you mean.

sysctl -a -o | grep debug, doesn't give me some debug output for ath...


----------



## LateNiteTV (Jan 28, 2010)

see if you have these.

```
hw.ath.hal.dma_brt: 2
hw.ath.hal.sw_brt: 10
hw.ath.hal.swba_backoff: 0
hw.ath.dwell: 200
hw.ath.calibrate: 30
hw.ath.outdoor: 1
hw.ath.countrycode: 0
hw.ath.regdomain: 0
hw.ath.debug: 0
hw.ath.dump:
```


----------



## free_daemon (Jan 29, 2010)

sysctl -a -o | grep hw.ath

```
hw.ath.bstuck: 4
hw.ath.txbuf: 200
hw.ath.rxbuf: 40
hw.ath.resetcal: 1200
hw.ath.shortcal: 100
hw.ath.longcal: 30
hw.ath.hal.swba_backoff: 0
hw.ath.hal.sw_brt: 10
hw.ath.hal.dma_brt: 2
```

It doesn't looks like that there is a debugging potability with sysctl.


----------



## bschmidt (Jan 29, 2010)

There is, I could imagine that is not available because the driver could not attach to any hardware.

Btw, is there any way to set `# sysctl hw.ath.debug=0xffffffff` as an initial value for that sysctl? Through /boot/kernel/device.hints or something?


----------



## free_daemon (Jan 29, 2010)

bschmidt said:
			
		

> Btw, is there any way to set `# sysctl hw.ath.debug=0xffffffff` as an initial value for that sysctl?


# sysctl hw.ath.debug=0xffffffff

```
sysctl: unknown oid 'hw.ath.debug'
```



			
				bschmidt said:
			
		

> Through /boot/kernel/device.hints or something?


Sorry, I cannot find any parameters in device.hints(5)  for enabling debugging via /boot/device.hints.


----------



## LateNiteTV (Jan 29, 2010)

bschmidt said:
			
		

> There is, I could imagine that is not available because the driver could not attach to any hardware.
> 
> Btw, is there any way to set `# sysctl hw.ath.debug=0xffffffff` as an initial value for that sysctl? Through /boot/kernel/device.hints or something?



/etc/sysctl.conf?


----------



## bschmidt (Jan 29, 2010)

I'm not sure as in I didn't test this, but it might be as easy as adding

```
hw.ath.debug=0xffffffff
```
 to /boot/loader.conf.


----------



## free_daemon (Jan 30, 2010)

Okay, I the problem of setting up the debugging mod was that ath isn't build with debugging support. I changed to /usr/src/sys/dev/ath/ and add the following line to ah_osdep.h.

```
#define  AH_DEBUG
```
Now its possible activate ath_hal debugging by:
	
	



```
sysctl hw.ath.hal.debug=0xffffffff
```
If I plug in the PCMCIA card I get the following output:

```
kernel: cardbus0: Expecting link target, got 0x0
kernel: cardbus0: Expecting link target, got 0x0
kernel: ath0: <Atheros 5212> mem 0xbf6b0000-0xbf6bffff irq 16 at device 0.0 on cardbus0
kernel: ath0: [ITHREAD]
kernel: ar5212Attach: sc 0xffffff00845c9000 st 0x1 sh 0xffffff00bf6b0000
kernel: ar5212SetPowerMode: AWAKE -> AWAKE (set chip )
kernel: ar5212Attach: Mac Chip Rev 0x00.0 not supported
kernel: ar5212Detach:
kernel: Detaching Ani
kernel: ar5212SetPowerMode: AWAKE -> AWAKE (set chip )
kernel: ar5212SetPowerMode: AWAKE -> FULL-SLEEP (set chip )
kernel: ath0: unable to attach hardware; HAL status 13
kernel: device_attach: ath0 attach returned 6
```
It looks like, that the driver could not get the correct MAC Chip Revision.


----------

