ATH memory error

My system freezes when I try to use my WiFi card. A pciconf scan lists the following:
Code:
fwohci0@pci0:1:0:0:	class=0x0c0010 card=0x42001565 chip=0x30441106 rev=0x80 hdr=0x00
    vendor     = 'VIA Technologies, Inc.'
    device     = 'VT6306 VIA Fire II IEEE-1394 OHCI Link Layer Controller'
    class      = serial bus
    subclass   = FireWire
    bar   [10] = type Memory, range 32, [B]base 0xf9011000, size 2048[/B], enabled
    bar   [14] = type I/O Port, range 32, base 0xa000, size 128, enabled
    cap 01[50] = powerspec 2  supports D0 D2 D3  current D0
ath0@pci0:1:2:0:	class=0x028000 card=0x80011799 chip=0x0023168c rev=0x01 hdr=0x00
    vendor     = 'Atheros Communications Inc.'
    device     = '802.11a/b/g/n Wireless PCI Adapter (AR5416)'
    class      = network
    bar   [10] = type Memory, range 32, [B]base 0xf9000000, size 65536[/B], enabled
    cap 80[40] = unknown
rl0@pci0:1:3:0:	class=0x020000 card=0x23001565 chip=0x813910ec rev=0x10 hdr=0x00
    vendor     = 'Realtek Semiconductor'
    device     = 'Realtek RTL8139 Family PCI Fast Ethernet NIC (RTL-8139/8139C/8139D)'
    class      = network
    subclass   = ethernet
    bar   [10] = type I/O Port, range 32, base 0xa400, size 256, enabled
    bar   [14] = type Memory, range 32, [B]base 0xf9010000, size 256[/B], enabled
    cap 01[50] = powerspec 2  supports D0 D1 D2 D3  current D0

Am I correct that this is a memory conflict?
 
Nope. Just add the size to the base address and you'll see they don't overlap.
 
Code:
The memory range for ath0 is    0xf9000000 - 0xf900ffff.
The memory range for fwohci0 is 0xf9011000 - 0xf90117ff.
The memory range for rl0 is     0xf9010000 - 0xf90100ff.

Doesn't ath0 overlap fwohci0?
 
Of course.
Thanks - it must have been a longer day than I thought. And I have started to clutch at straws in an attempt to find a solution.
 
What version of FreeBSD? Are you running GENERIC or a custom kernel?

If it's a custom kernel try adding:
Code:
options AH_SUPPORT_AR5416
to your kernel config.
 
I tried using a custom kernel. This was the wireless section:
Code:
# Wireless NIC cards
device		wlan		# 802.11 support
options 	IEEE80211_DEBUG	# enable debug msgs
options 	IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's
options 	IEEE80211_SUPPORT_MESH	# enable 802.11s draft support
device		wlan_wep	# 802.11 WEP support
device		wlan_ccmp	# 802.11 CCMP support
device		wlan_tkip	# 802.11 TKIP support
device		wlan_amrr	# AMRR transmit rate control algorithm
#
device		ath		# Atheros pci/cardbus NIC's
device		ath_hal		# pci/cardbus chip support
options 	AH_SUPPORT_AR5416	# enable AR5416 tx/rx descriptors
device		ath_rate_sample	# SampleRate tx rate control for ath

The system would lock up 3 sec to ~1 min after connecting to the AP. It would also lock up even without connecting if I let it sit for a few hours. So I tried removing the ath specs and using ndis instead with very similar results.
 
What version of FreeBSD, on what arch?

Older versions that 8.2 have very buggy NDIS (exp. on amd64).

Also for NDIS to work you must use custom kernel without ath stuff, so that ath0 does not attach before ndis0.
 
Architecture is i386 with a Pentium HT cpu. I have been working on this for at least a couple of weeks. So far I have tried 8.0, 8.1, 8.2 PreRelease and (currently) 8.2 Stable. I am currently using a custom kernel with ath configured out and wlan configured in. The latest attempt using ndis gives the following output as soon as the .ko module is (manually) loaded:
Code:
no match for ZwOpenKey
no match for ZwCreateKey
no match for ZwDeleteKey
ndis0: <Belkin N1 Wireless Desktop Card> mem 0xf9000000 - 0xf900ffff irq18 at device 2.0 on pci1
ndis0: [ITHREAD]
ndis0: NDIS API version: 5.1

On the prior attempt I also got these messages:
Code:
ndis0: open file /compat/ndis/preparse.ini failed: 2
ndis0: open file /compat/ndis/refAdd.txt failed: 2
Since /compat/ndis did not exist, I created the directory and empty files. I found one thread that suggested disabling smp so I added
Code:
kern.smp.disabled=1
to /boot/loader.conf. I don't know yet if it has had any effect but I loaded ar5416_sys.ko about an hour ago and it hasn't locked up yet.
 
I created wlan0 and started wpa_supplicant with -c/root/test.config. It gave the messages
Code:
ieee80211_load_module: load the wlan_xauth module by hand for now.
/etc/rc.d/wpa_supplicant: WARNING: /etc/wpa_supplicant.conf is not readable.
/etc/rc.d/wpa_supplicant: WARNING: failed precmd routine for wpa_supplicant.
ndis0: set infra failed: 45
ndis0: setting BSSID failed: 45

The last two messages repeated until I killed the supplicant. And I don't understand the warning about /etc/wpa_supplicant.conf not readable. It doesn't exist but I am manually supplying the conf file spec.

I did a kldload for wlan_xauth, brought ndis0 and wlan0 up, and reran wpa_supplicant. I still get the ndis fail messages but an ifconfig wlan0 list scan produces the expected results and the system has not locked up.

The only problem is that it doesn't connect. Any suggestions?
 
Thank you to both for the help. Especially the information about ndis requiring the custom kernel. That seems to have cured the lock-up.

Can you explain what
Code:
ndis0: set infra failed: 45
ndis0: setting BSSID failed: 45
means and how to eliminate it? It appears that I get these two messages every AP scan by the wlan0 I/F.

I don't know if that is the reason I cannot connect. The I/F associates with the AP and then times out while authenticating. I set the AP open with no authentication but wpa_supplicant debug still reports the same thing.
 
Richard -

Your git repo says:
Code:
To build and install new NDISulator you will need to login as root and run:
# make attach

Are there preliminary steps prior to this? When I boot and then follow this instruction, my system responds
Code:
make: don't know how to make attach. Stop

If it matters - I am using a custom kernel with the ath code removed. /boot/loader.conf contains
Code:
ar5416_sys_load="YES"
Since the module is now loaded at boot, dmesg gives these no match and file missing messages relating to ndis:
Code:
no match for ZwOpenKey
no match for ZwCreateKey
no match for ZwDeleteKey
<snip>
ndis0: <Belkin N1 Wireless Desktop Card> mem 0xf9000000-0xf900ffff irq 18 at device 2.0 on pci1
ndis0: [ITHREAD]
ndis0: NDIS API version: 5.1
NDIS: could not find file preparse.ini in linker list
NDIS: and no filesystems mounted yet, aborting NdisOpenFile()
NDIS: could not find file regAdd.txt in linker list
NDIS: and no filesystems mounted yet, aborting NdisOpenFile()

As soon as the boot is complete, the following messages are added:
Code:
wlan0: Ethernet address: 00:11:50:f7:e8:31
rl0: link state changed to UP
ndis0: set infra failed: 45
ndis0: setting BSSID failed: 45
ndis0: set infra failed: 45
ndis0: setting BSSID failed: 45
ndis0: link state changed to UP
ndis0: link state changed to DOWN
 
You must have kernel source in /sys and must be able to use mount_nullfs. Only if you use some custom stuff nullfs may not be available.
 
I may have custom things that don't belong. So,

  1. I downloaded and unpacked your git repo in /root as richardpl-NDISulator-03d9f3d
  2. I removed all loader.conf, and rc.conf customization
  3. I ran cvsup for src-all of RELENG_8
  4. I updated world and built a new generic kernel (buildworld, buildkernel, install, etc.)
  5. I built and installed a custom kernel with no ath devices
  6. I rebooted with the custom kernel, logged in as root and cd'd to the repo expansion
  7. I ran make attach - the output looked proper.
  8. I logged into a second virtual console, cd'd to /root/richardpl-NDISulator-03d9f3d and executed make build. The process terminates with Error code 1.

I'm not sure how to proceed from here. Can you suggest what to do next?

Attach output:
Code:
mounting NDISulator code on top of FreeBSD code
mount_nullfs src/sys/compat/ndis /usr/src/sys/compat/ndis
mount_nullfs src/sys/dev/if_ndis /usr/src/sys/dev/if_ndis
mount_nullfs src/sys/modules/ndis /usr/src/sys/modules/ndis
mount_nullfs src/sys/modules/if_ndis /usr/src/sys/modules/if_ndis
mount_nullfs src/usr.sbin/ndiscvt /usr/src/usr.sbin/ndiscvt

Build output:
Code:
cd /usr/src/sys/modules/ndis && make
Warning: Object directory not changed from original /usr/src/sys/modules/ndis
cc -O2 -pipe -fno-strict-aliasing -D_KERNEL -DKLD_MODULE -nostdinc   -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-
growth=100 --param large-function-growth=1000 -fno-common  -mno-align-long-strings -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -
mno-sse2 -mno-sse3 -ffreestanding -fstack-protector -std=iso9899:1999 -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-
prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions -c 
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'WRITE_PORT_ULONG':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:101: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:101: error: (Each undeclared identifier is reported only once
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:101: error: for each function it appears in.)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'WRITE_PORT_USHORT':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:108: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'WRITE_PORT_UCHAR':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:115: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'WRITE_PORT_BUFFER_ULONG':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:122: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'WRITE_PORT_BUFFER_USHORT':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:130: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'WRITE_PORT_BUFFER_UCHAR':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:138: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'READ_PORT_USHORT':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:146: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'READ_PORT_ULONG':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:153: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'READ_PORT_UCHAR':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:160: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'READ_PORT_BUFFER_ULONG':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:167: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'READ_PORT_BUFFER_USHORT':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:175: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c: In function 'READ_PORT_BUFFER_UCHAR':
/usr/src/sys/modules/ndis/../../compat/ndis/subr_hal.c:183: error: 'X86_BUS_SPACE_IO' undeclared (first use in this function)
*** Error code 1

Stop in /usr/src/sys/modules/ndis.
*** Error code 1

Stop in /root/richardpl-NDISulator-03d9f3d.
 
richardpl said:
You picked wrong branch. README of master branch state you must use CURRENT. Use stable branch.

Sorry - I misunderstood "current". So,

  1. I ran cvsup for src-all of CURRENT (no date specified, tag=.)
  2. I updated world and built a new generic kernel (buildworld, buildkernel, install, etc.)
  3. I rebooted and logged in as root. dmesg now confirms FreeBSD 9.0-CURRENT.
  4. I cd'd to the repo expansion, ran make attach, make build, make install. Everything looked correct so I ran make detach.
  5. I built and installed a custom kernel with no ath devices
  6. I rebooted with the custom kernel, logged in as root, and ran ndisgen (output follows) which terminates with an error.
Code:
	==================================================================
	------------------ Windows(r) driver converter -------------------
	==================================================================

			INF file validation

	This .INF file appears to be ASCII.

	Press return to continue...
<return>
	==================================================================
	------------------ Windows(r) driver converter -------------------
	==================================================================

			Driver file validation

	This .SYS file appears to be in Windows(r) PE format.

	Press return to continue...
<return>
	==================================================================
	------------------ Windows(r) driver converter -------------------
	==================================================================

			Driver file conversion

	The script will now try to convert the .INF and .SYS files
	using the ndiscvt(1) utility. This utility can handle most
	.INF files; however, occasionally it can fail to parse some files
	due to subtle syntax issues: the .INF syntax is very complex,
	and the Windows(r) parser will sometimes allow files with small
	syntax errors to be processed correctly which ndiscvt(1) will
	not. If the conversion fails, you may have to edit the .INF
	file by hand to remove the offending lines.

	Press enter to try converting the files now: 
<return>
	Conversion was successful.

	Press enter to continue...
<return>
	==================================================================
	------------------ Windows(r) driver converter -------------------
	==================================================================

			Firmware file conversion

	If your driver uses additional firmware files, please list them
	below. When you're finished, just press enter to continue. (If your
	driver doesn't need any extra firmware files, just press enter
	to move to the next step.)

	>
 <return>
	==================================================================
	------------------ Windows(r) driver converter -------------------
	==================================================================

			Kernel module generation


	The script will now try to generate the kernel driver module.
	This is the last step. Once this module is generated, you should
	be able to load it just like any other FreeBSD driver module.

	Press enter to compile the stub module and generate the driver
	module now:
<return>
	Generating Makefile... done.
	Building kernel module... cc1: warnings being treated as errors
/usr/src/usr.sbin/ndiscvt/windrv_stub.c:136: warning: redundant redeclaration of 'device_probe_desc'
./device_if.h:27: warning: previous declaration of 'device_probe_desc' was here
/usr/src/usr.sbin/ndiscvt/windrv_stub.c:137: error: redefinition of typedef 'device_probe_t'
./device_if.h:29: error: previous declaration of 'device_probe_t' was here
build failed. Exiting.

I don't know where the flag is (-Werror ?) that treats warnings as fatal. If it should not be changed, can you suggest what to do next?
 
I said to use stable branch of git code.
Use stable branch when using FreeBSD 8.X

You do not need to use FreeBSD CURRENT.

You did not read README carefully, you can not mix NDISulator code and FreeBSD code (of older NDISulator) when generating module with ndisgen.
 
Okay - I think I have now tried all the combinations.

Previously - FreeBSD 9.0 current with the git master branch. So now I reloaded FreeBSD, ran cvsup to update to 8.2 stable, generated a new custom kernel without ath support, downloaded the stable branch of the git code and installed it, and then ran ndisgen. Still no joy!

uname output is:
Code:
FreeBSD syst2.test.int 8.2-STABLE FreeBSD 8.2-STABLE #0: Tue Mar 29 22:35:22 MDT 2011
     root@syst2.test.int:/usr/obj/usr/src/sys/TEST4  i386


After install, with the attach still in place, the results are:
Code:
        ==================================================================
	------------------ Windows(r) driver converter -------------------
	==================================================================

			Kernel module generation


	The script will now try to generate the kernel driver module.
	This is the last step. Once this module is generated, you should
	be able to load it just like any other FreeBSD driver module.

	Press enter to compile the stub module and generate the driver
	module now: 
	Generating Makefile... done.
	Building kernel module... /usr/src/usr.sbin/ndiscvt/windrv_stub.c: In function 'windrv_modevent':
/usr/src/usr.sbin/ndiscvt/windrv_stub.c:150: error: 'ndis_regvals' undeclared (first use in this function)
/usr/src/usr.sbin/ndiscvt/windrv_stub.c:150: error: (Each undeclared identifier is reported only once
/usr/src/usr.sbin/ndiscvt/windrv_stub.c:150: error: for each function it appears in.)
build failed. Exiting.

If I "make detach" and then run ndisgen, the results are:
Code:
        ==================================================================
	------------------ Windows(r) driver converter -------------------
	==================================================================

			Kernel module generation


	The script will now try to generate the kernel driver module.
	This is the last step. Once this module is generated, you should
	be able to load it just like any other FreeBSD driver module.

	Press enter to compile the stub module and generate the driver
	module now: 
	Generating Makefile... done.
	Building kernel module... cc1: warnings being treated as errors
/usr/src/usr.sbin/ndiscvt/windrv_stub.c:136: warning: redundant redeclaration of 'device_probe_desc'
./device_if.h:27: warning: previous declaration of 'device_probe_desc' was here
/usr/src/usr.sbin/ndiscvt/windrv_stub.c:137: error: redefinition of typedef 'device_probe_t'
./device_if.h:29: error: previous declaration of 'device_probe_t' was here
build failed. Exiting.

Any suggestions what to try next?
 
Do not detach before using ndisgen - It will never work.

Are you using inf file? Upload your inf and sys file somewhere and let me reproduce your issue.
 
Back
Top