AR9380 mini pcie card - unable to read eeprom (32 bit PowerPC - bigendian)
tim-seoss opened this issue · 9 comments
Hi,
Thanks for writing this tool!
I have an AR9380 mini pcie card on a PowerPC 32bit system (openwrt - netgear wndap660).
I've tried to use the tool both directly via PCI (with the ath9k kernel modules unloaded):
root@wifi_660_1:~# /tmp/atheepmgr -v -t PCI:0030 -P 43:0
Found Device: 168c:0030 (AR9380/AR9381/QCA9381/AR9382/AR9388/AR9390/AR9392)
Try to map 00000000-0001ffff I/O region to the process memory
Mapped IO region at: 0xb7be5000
Atheros AR???? MAC/BB (SREV: 0xff031c00)
Unable to configure chip GPIO support
Unable to determine EEPROM unlocking GPIO, the feature will be disabled
Unable to select EEPROM access ops due to unknown chip
No suitable data source in available via configured connector
Freeing Mapped IO region at: 0xb7be5000
... and also through the wireless device - both without luck:
root@wifi_660_1:~# /tmp/atheepmgr -v -D wlan0 -t 9300
Atheros AR9300 MAC/BB Rev:3 (SREV: 0x001c03ff)
EEPROM access ops: use AR9xxx ops
OTP access ops: use AR93xx ops
Use byteswapped EEPROM I/O
EEPROM magic found
Trying EEPROM access at Address 0x03ff
Found block at 3ff: comp=1 ref=21 length=1569 major=3 minor=34
Skipping bad header
Found block at 3fb: comp=0 ref=27 length=26 major=8 minor=5
Skipping block with bad checksum (got 0x0783, expect 0x030d)
Found block at 3f7: comp=5 ref=18 length=1353 major=12 minor=66
Skipping bad header
Found block at 3f3: comp=2 ref=14 length=517 major=4 minor=84
Skipping block with bad checksum (got 0x7c33, expect 0x1e16)
Found block at 3ef: comp=1 ref=14 length=1109 major=4 minor=78
Skipping bad header
Found block at 3eb: comp=2 ref=23 length=1349 major=3 minor=32
Skipping bad header
Found block at 3e7: comp=1 ref=13 length=1075 major=0 minor=52
Skipping bad header
Found block at 3e3: comp=2 ref=5 length=1255 major=2 minor=0
Skipping bad header
Found block at 3df: comp=0 ref=14 length=1776 major=13 minor=3
Skipping bad header
Found block at 3db: comp=0 ref=6 length=320 major=7 minor=8
Skipping block with bad checksum (got 0x4fbf, expect 0x0303)
Found block at 3d7: comp=0 ref=5 length=1280 major=0 minor=0
Skipping bad header
Found block at 3d3: comp=3 ref=6 length=1632 major=13 minor=6
Skipping bad header
Found block at 3cf: comp=1 ref=5 length=58 major=4 minor=0
Skipping block with bad checksum (got 0x127a, expect 0xac09)
Found block at 3cb: comp=0 ref=1 length=288 major=7 minor=205
Skipping block with bad checksum (got 0x47c3, expect 0x9103)
Found block at 3c7: comp=0 ref=1 length=16 major=8 minor=33
Skipping block with bad checksum (got 0x077a, expect 0x0091)
Found block at 3c3: comp=6 ref=62 length=1512 major=9 minor=112
Skipping bad header
Found block at 3bf: comp=7 ref=57 length=553 major=3 minor=0
Skipping block with bad checksum (got 0x77ec, expect 0x1c1a)
Found block at 3bb: comp=0 ref=3 length=48 major=0 minor=251
Skipping block with bad checksum (got 0x0d72, expect 0x2222)
Found block at 3b7: comp=0 ref=35 length=319 major=13 minor=3
Skipping block with bad checksum (got 0x4f13, expect 0xe08f)
Found block at 3b3: comp=4 ref=17 length=0 major=3 minor=3
Skipping block with bad checksum (got 0x0000, expect 0xf700)
Found block at 3af: comp=0 ref=32 length=1904 major=3 minor=145
Skipping bad header
Found block at 3ab: comp=7 ref=24 length=57 major=0 minor=0
Skipping block with bad checksum (got 0x0b17, expect 0x221c)
Found block at 3a7: comp=0 ref=3 length=48 major=0 minor=249
Skipping block with bad checksum (got 0x0992, expect 0x1c1a)
Found block at 3a3: comp=0 ref=35 length=255 major=6 minor=3
Skipping block with bad checksum (got 0x3c01, expect 0x0003)
Found block at 39f: comp=4 ref=19 length=0 major=3 minor=3
Skipping block with bad checksum (got 0x0000, expect 0xf700)
Found block at 39b: comp=0 ref=32 length=1904 major=3 minor=146
Skipping bad header
Found block at 397: comp=7 ref=24 length=57 major=2 minor=0
Skipping block with bad checksum (got 0x070f, expect 0x1e1c)
Found block at 393: comp=0 ref=1 length=64 major=9 minor=172
Skipping block with bad checksum (got 0x0781, expect 0x201e)
Found block at 38f: comp=1 ref=2 length=1202 major=2 minor=34
Skipping bad header
Found block at 38b: comp=1 ref=2 length=546 major=2 minor=34
Skipping block with bad checksum (got 0x6dd7, expect 0x1a18)
Found block at 387: comp=1 ref=2 length=545 major=14 minor=34
Skipping block with bad checksum (got 0x6d9f, expect 0x1616)
Found block at 383: comp=1 ref=2 length=417 major=14 minor=34
Skipping block with bad checksum (got 0x6149, expect 0x201a)
Found block at 37f: comp=1 ref=2 length=417 major=14 minor=34
Skipping block with bad checksum (got 0x613b, expect 0x1a1e)
Found block at 37b: comp=1 ref=2 length=417 major=14 minor=32
Skipping block with bad checksum (got 0x6133, expect 0x1a18)
Found block at 377: comp=0 ref=26 length=449 major=14 minor=24
Skipping block with bad checksum (got 0x643d, expect 0x1612)
Found block at 373: comp=0 ref=26 length=449 major=14 minor=24
Skipping block with bad checksum (got 0x6423, expect 0x1614)
Found block at 36f: comp=0 ref=26 length=450 major=2 minor=24
Skipping block with bad checksum (got 0x6413, expect 0x1016)
Found block at 36b: comp=0 ref=30 length=513 major=10 minor=28
Skipping block with bad checksum (got 0x6a0f, expect 0x1816)
Found block at 367: comp=0 ref=30 length=385 major=10 minor=28
Skipping block with bad checksum (got 0x5dc3, expect 0x1c1c)
Found block at 363: comp=0 ref=30 length=385 major=10 minor=28
Skipping block with bad checksum (got 0x5dbf, expect 0x201a)
Found block at 35f: comp=1 ref=2 length=385 major=14 minor=32
Skipping block with bad checksum (got 0x5db5, expect 0x1a1e)
Found block at 35b: comp=0 ref=26 length=449 major=14 minor=24
Skipping block with bad checksum (got 0x63a7, expect 0x1c14)
Found block at 357: comp=0 ref=26 length=449 major=14 minor=24
Skipping block with bad checksum (got 0x639f, expect 0x1c1a)
Found block at 353: comp=0 ref=26 length=450 major=0 minor=24
Skipping block with bad checksum (got 0x63af, expect 0x161a)
Found block at 34f: comp=0 ref=30 length=513 major=8 minor=28
Skipping block with bad checksum (got 0x698f, expect 0x1412)
Found block at 34b: comp=0 ref=30 length=321 major=8 minor=28
Skipping block with bad checksum (got 0x56f5, expect 0x1e16)
Found block at 347: comp=0 ref=30 length=321 major=8 minor=28
Skipping block with bad checksum (got 0x56fb, expect 0x1e1c)
Found block at 343: comp=0 ref=11 length=49 major=12 minor=30
Skipping block with bad checksum (got 0x0cc5, expect 0x7f8e)
Found block at 33f: comp=0 ref=20 length=385 major=12 minor=30
Skipping block with bad checksum (got 0x5db9, expect 0x1614)
Found block at 33b: comp=0 ref=20 length=385 major=12 minor=30
Skipping block with bad checksum (got 0x5dad, expect 0x1414)
Found block at 337: comp=0 ref=3 length=385 major=14 minor=11
Skipping block with bad checksum (got 0x5dc1, expect 0x1612)
Found block at 333: comp=0 ref=24 length=449 major=14 minor=20
Skipping block with bad checksum (got 0x63b5, expect 0x1c18)
Found block at 32f: comp=0 ref=24 length=449 major=14 minor=20
Skipping block with bad checksum (got 0x63b1, expect 0x181a)
Found block at 32b: comp=0 ref=24 length=448 major=1 minor=15
Skipping block with bad checksum (got 0x63b9, expect 0x161a)
Found block at 327: comp=0 ref=3 length=1959 major=10 minor=9
Skipping bad header
Found block at 323: comp=3 ref=48 length=551 major=10 minor=117
Skipping block with bad checksum (got 0x81b1, expect 0x6690)
Found block at 31f: comp=3 ref=58 length=552 major=4 minor=127
Skipping block with bad checksum (got 0x81f9, expect 0x9eae)
Found block at 31b: comp=0 ref=1 length=128 major=3 minor=184
Skipping block with bad checksum (got 0x2985, expect 0x0303)
Found block at 317: comp=5 ref=24 length=599 major=5 minor=112
Skipping block with bad checksum (got 0x9180, expect 0x1454)
Found block at 313: comp=5 ref=56 length=711 major=15 minor=112
Skipping block with bad checksum (got 0xf3d0, expect 0x00ff)
Found block at 30f: comp=5 ref=44 length=231 major=15 minor=112
Skipping block with bad checksum (got 0x44ef, expect 0x1a1a)
Found block at 30b: comp=5 ref=44 length=71 major=15 minor=112
Skipping block with bad checksum (got 0x1299, expect 0x6c44)
Found block at 307: comp=5 ref=44 length=71 major=15 minor=122
Skipping block with bad checksum (got 0x11b5, expect 0xbd7c)
Found block at 303: comp=5 ref=34 length=69 major=12 minor=27
Skipping block with bad checksum (got 0x1151, expect 0xeda4)
Found block at 2ff: comp=1 ref=0 length=1478 major=8 minor=27
Skipping bad header
Found block at 2fb: comp=0 ref=26 length=1670 major=8 minor=27
Skipping bad header
Found block at 2f7: comp=0 ref=26 length=1669 major=11 minor=25
Skipping bad header
Found block at 2f3: comp=0 ref=21 length=1456 major=1 minor=3
Skipping bad header
Found block at 2ef: comp=0 ref=3 length=1991 major=12 minor=5
Skipping bad header
Found block at 2eb: comp=3 ref=28 length=967 major=12 minor=60
Skipping bad header
Found block at 2e7: comp=0 ref=24 length=53 major=5 minor=124
Skipping block with bad checksum (got 0x0ff6, expect 0x9003)
Found block at 2e3: comp=2 ref=21 length=1365 major=11 minor=21
Skipping bad header
Found block at 2df: comp=2 ref=27 length=421 major=11 minor=27
Skipping block with bad checksum (got 0x4ce1, expect 0x100e)
Found block at 2db: comp=2 ref=27 length=405 major=9 minor=27
Skipping block with bad checksum (got 0x4b3f, expect 0x1410)
Found block at 2d7: comp=2 ref=25 length=1433 major=0 minor=25
Skipping bad header
Found block at 2d3: comp=0 ref=0 length=154 major=10 minor=0
Skipping block with bad checksum (got 0x3092, expect 0xc522)
Found block at 2cf: comp=0 ref=42 length=672 major=4 minor=13
Skipping block with bad checksum (got 0xe4cc, expect 0x4040)
Found block at 2cb: comp=0 ref=15 length=997 major=8 minor=80
Skipping bad header
Found block at 2c7: comp=0 ref=1 length=273 major=13 minor=222
Skipping block with bad checksum (got 0x3c1e, expect 0x1612)
Found block at 2c3: comp=1 ref=23 length=32 major=14 minor=68
Skipping block with bad checksum (got 0x0b53, expect 0xed00)
Found block at 2bf: comp=3 ref=12 length=152 major=12 minor=124
Skipping block with bad checksum (got 0x2e90, expect 0x1c1a)
Found block at 2bb: comp=5 ref=61 length=590 major=13 minor=205
Skipping block with bad checksum (got 0xb734, expect 0xffff)
Found block at 2b7: comp=4 ref=17 length=0 major=3 minor=3
Skipping block with bad checksum (got 0x0000, expect 0xf000)
Found block at 2b3: comp=0 ref=32 length=1792 major=3 minor=145
Skipping bad header
Found block at 2af: comp=7 ref=22 length=57 major=0 minor=0
Skipping block with bad checksum (got 0x115e, expect 0x9003)
Found block at 2ab: comp=0 ref=3 length=48 major=0 minor=244
Skipping block with bad checksum (got 0x0e09, expect 0xe900)
Found block at 2a7: comp=0 ref=35 length=287 major=1 minor=3
Skipping block with bad checksum (got 0x350d, expect 0x1c1a)
Found block at 2a3: comp=4 ref=15 length=0 major=3 minor=3
Skipping block with bad checksum (got 0x0000, expect 0xed00)
Found block at 29f: comp=0 ref=32 length=1744 major=3 minor=143
Skipping bad header
Found block at 29b: comp=7 ref=7 length=56 major=15 minor=0
Skipping block with bad checksum (got 0x1056, expect 0x03ea)
Found block at 297: comp=0 ref=3 length=48 major=0 minor=228
Skipping block with bad checksum (got 0x0dec, expect 0xeb00)
Found block at 293: comp=0 ref=35 length=254 major=4 minor=3
Skipping block with bad checksum (got 0x2dd9, expect 0x161c)
Found block at 28f: comp=4 ref=17 length=0 major=3 minor=3
Skipping block with bad checksum (got 0x0000, expect 0xe500)
Found block at 28b: comp=0 ref=32 length=1616 major=3 minor=145
Skipping bad header
Found block at 287: comp=7 ref=9 length=57 major=0 minor=0
Skipping block with bad checksum (got 0x1137, expect 0x9103)
Found block at 283: comp=0 ref=3 length=48 major=0 minor=234
Skipping block with bad checksum (got 0x0df4, expect 0xe200)
Found block at 27f: comp=0 ref=35 length=270 major=9 minor=3
Skipping block with bad checksum (got 0x2b5c, expect 0x141c)
Found block at 27b: comp=4 ref=16 length=0 major=3 minor=3
Skipping block with bad checksum (got 0x0000, expect 0xe900)
Found block at 277: comp=0 ref=32 length=1680 major=3 minor=143
Skipping bad header
Found block at 273: comp=7 ref=0 length=57 major=0 minor=0
Skipping block with bad checksum (got 0x1273, expect 0x22a0)
Trying EEPROM access at Address 0x01ff
Found block at 1ff: comp=0 ref=26 length=449 major=12 minor=24
Skipping block with bad checksum (got 0xac8d, expect 0x0117)
Found block at 1fb: comp=0 ref=24 length=418 major=0 minor=22
Skipping block with bad checksum (got 0x9b1f, expect 0xffff)
Found block at 1f7: comp=0 ref=30 length=481 major=10 minor=28
Skipping block with bad checksum (got 0xb097, expect 0x1250)
Found block at 1f3: comp=0 ref=30 length=385 major=10 minor=28
Skipping block with bad checksum (got 0x815a, expect 0xffff)
Found block at 1ef: comp=0 ref=28 length=385 major=8 minor=26
Skipping block with bad checksum (got 0x84f0, expect 0xffff)
Found block at 1eb: comp=1 ref=0 length=353 major=14 minor=30
Skipping block with bad checksum (got 0x689a, expect 0xffff)
Found block at 1e7: comp=0 ref=26 length=449 major=14 minor=24
Skipping block with bad checksum (got 0xad3b, expect 0x1b01)
Found block at 1e3: comp=0 ref=26 length=449 major=12 minor=24
Skipping block with bad checksum (got 0xacf3, expect 0x0040)
Found block at 1df: comp=0 ref=24 length=418 major=0 minor=22
Skipping block with bad checksum (got 0xa948, expect 0x3f01)
Found block at 1db: comp=0 ref=30 length=481 major=10 minor=28
Skipping bad header
Found block at 1d7: comp=0 ref=30 length=385 major=10 minor=28
Skipping block with bad checksum (got 0x9a4a, expect 0xffff)
Found block at 1d3: comp=0 ref=28 length=385 major=8 minor=26
Skipping block with bad checksum (got 0x9de0, expect 0xffff)
Found block at 1cf: comp=1 ref=0 length=353 major=12 minor=30
Skipping block with bad checksum (got 0x818c, expect 0xffff)
Found block at 1cb: comp=0 ref=24 length=417 major=12 minor=22
Skipping block with bad checksum (got 0xa9a1, expect 0x402e)
Found block at 1c7: comp=0 ref=24 length=417 major=10 minor=22
Skipping block with bad checksum (got 0xa9ef, expect 0x1b01)
Found block at 1c3: comp=0 ref=22 length=385 major=12 minor=20
Skipping block with bad checksum (got 0xa525, expect 0x9025)
Found block at 1bf: comp=0 ref=26 length=417 major=6 minor=24
Skipping block with bad checksum (got 0xa994, expect 0x7c00)
Found block at 1bb: comp=0 ref=26 length=321 major=6 minor=24
Skipping block with bad checksum (got 0x73b6, expect 0xffff)
Found block at 1b7: comp=0 ref=24 length=321 major=4 minor=22
Skipping block with bad checksum (got 0x775c, expect 0xffff)
Found block at 1b3: comp=0 ref=26 length=289 major=6 minor=24
Skipping block with bad checksum (got 0x5b1e, expect 0xffff)
Found block at 1af: comp=0 ref=18 length=321 major=6 minor=16
Skipping block with bad checksum (got 0x7eae, expect 0xffff)
Found block at 1ab: comp=0 ref=18 length=321 major=6 minor=16
Skipping block with bad checksum (got 0x825e, expect 0xffff)
Found block at 1a7: comp=0 ref=18 length=321 major=14 minor=16
Skipping block with bad checksum (got 0x8606, expect 0xffff)
Found block at 1a3: comp=0 ref=28 length=449 major=8 minor=26
Skipping bad header
Found block at 19f: comp=0 ref=28 length=353 major=8 minor=26
Skipping block with bad checksum (got 0xa331, expect 0x0117)
Found block at 19b: comp=0 ref=26 length=353 major=6 minor=24
Skipping block with bad checksum (got 0xa336, expect 0x0057)
Found block at 197: comp=0 ref=30 length=321 major=12 minor=28
Skipping block with bad checksum (got 0x9460, expect 0xffff)
Found block at 193: comp=0 ref=24 length=417 major=12 minor=22
Skipping bad header
Found block at 18f: comp=0 ref=24 length=417 major=10 minor=22
Skipping bad header
Found block at 18b: comp=0 ref=22 length=385 major=14 minor=20
Skipping block with bad checksum (got 0xa8aa, expect 0x0350)
Found block at 187: comp=0 ref=28 length=449 major=8 minor=26
Skipping bad header
Found block at 183: comp=0 ref=28 length=353 major=8 minor=26
Skipping block with bad checksum (got 0xa3cf, expect 0x0040)
Found block at 17f: comp=0 ref=26 length=353 major=6 minor=24
Skipping block with bad checksum (got 0xa3b4, expect 0x7c00)
Found block at 17b: comp=0 ref=30 length=321 major=12 minor=28
Skipping block with bad checksum (got 0xa010, expect 0x0057)
Found block at 177: comp=0 ref=24 length=417 major=12 minor=22
Skipping bad header
Found block at 173: comp=0 ref=24 length=417 major=10 minor=22
Skipping bad header
Found block at 16f: comp=0 ref=22 length=385 major=12 minor=20
Skipping bad header
Found block at 16b: comp=0 ref=26 length=417 major=8 minor=26
Skipping bad header
Found block at 167: comp=0 ref=26 length=353 major=8 minor=26
Skipping block with bad checksum (got 0xa57b, expect 0x5a00)
Found block at 163: comp=0 ref=26 length=353 major=6 minor=24
Skipping bad header
Found block at 15f: comp=0 ref=28 length=321 major=10 minor=26
Skipping block with bad checksum (got 0xa09c, expect 0x7c00)
Found block at 15b: comp=0 ref=22 length=385 major=10 minor=20
Skipping bad header
Found block at 157: comp=0 ref=22 length=385 major=8 minor=20
Skipping bad header
Found block at 153: comp=0 ref=20 length=353 major=10 minor=18
Skipping bad header
Found block at 14f: comp=0 ref=24 length=385 major=4 minor=22
Skipping bad header
Found block at 14b: comp=0 ref=24 length=289 major=4 minor=22
Skipping block with bad checksum (got 0x9dcd, expect 0x402e)
Found block at 147: comp=0 ref=22 length=289 major=2 minor=20
Skipping block with bad checksum (got 0x9e2f, expect 0x1b01)
Found block at 143: comp=0 ref=24 length=257 major=4 minor=22
Skipping block with bad checksum (got 0x9971, expect 0x9025)
Found block at 13f: comp=0 ref=16 length=289 major=4 minor=14
Skipping block with bad checksum (got 0x9dfe, expect 0x7c00)
Found block at 13b: comp=0 ref=0 length=289 major=0 minor=6
Skipping block with bad checksum (got 0x9f12, expect 0x0102)
Found block at 137: comp=0 ref=20 length=225 major=0 minor=18
Skipping block with bad checksum (got 0x8bec, expect 0xffff)
Found block at 133: comp=0 ref=10 length=229 major=0 minor=14
Skipping block with bad checksum (got 0x936e, expect 0xffff)
Found block at 12f: comp=2 ref=28 length=1419 major=13 minor=180
Skipping bad header
Found block at 12b: comp=6 ref=45 length=1045 major=8 minor=76
Skipping bad header
Found block at 127: comp=4 ref=12 length=1483 major=13 minor=180
Skipping bad header
Found block at 123: comp=0 ref=38 length=1050 major=14 minor=40
Skipping bad header
Found block at 11f: comp=6 ref=39 length=1013 major=4 minor=76
Skipping bad header
Found block at 11b: comp=3 ref=24 length=1674 major=0 minor=140
Skipping bad header
Found block at 117: comp=6 ref=45 length=917 major=4 minor=76
Skipping bad header
Found block at 113: comp=3 ref=24 length=1674 major=0 minor=140
Skipping bad header
Found block at 10f: comp=6 ref=45 length=917 major=4 minor=76
Skipping bad header
Found block at 10b: comp=3 ref=24 length=1674 major=0 minor=140
Skipping bad header
Found block at 107: comp=6 ref=45 length=917 major=8 minor=76
Skipping bad header
Found block at 103: comp=4 ref=12 length=1483 major=4 minor=144
Skipping bad header
Found block at ff: comp=6 ref=45 length=981 major=8 minor=76
Skipping bad header
Found block at fb: comp=4 ref=12 length=1472 major=6 minor=144
Skipping bad header
Found block at f7: comp=3 ref=6 length=1241 major=6 minor=142
Skipping bad header
Found block at f3: comp=5 ref=46 length=485 major=2 minor=81
Skipping bad header
Found block at ef: comp=2 ref=20 length=1302 major=7 minor=84
Skipping bad header
Found block at eb: comp=1 ref=0 length=1601 major=10 minor=90
Skipping bad header
Found block at e7: comp=2 ref=20 length=1350 major=7 minor=84
Skipping bad header
Found block at e3: comp=1 ref=0 length=1585 major=12 minor=22
Skipping bad header
Found block at df: comp=2 ref=20 length=1349 major=4 minor=84
Skipping bad header
Found block at db: comp=1 ref=0 length=631 major=12 minor=60
Skipping bad header
Found block at d7: comp=3 ref=28 length=967 major=12 minor=60
Skipping bad header
Found block at d3: comp=3 ref=28 length=967 major=12 minor=60
Skipping bad header
Found block at cf: comp=3 ref=28 length=967 major=12 minor=60
Skipping bad header
Found block at cb: comp=3 ref=28 length=967 major=12 minor=60
Skipping bad header
Found block at c7: comp=3 ref=28 length=967 major=12 minor=60
Skipping bad header
Found block at c3: comp=3 ref=28 length=961 major=15 minor=92
Skipping bad header
Found block at bf: comp=2 ref=20 length=1349 major=4 minor=84
Skipping bad header
Found block at bb: comp=0 ref=20 length=1345 major=13 minor=93
Skipping bad header
Found block at b7: comp=2 ref=20 length=1349 major=4 minor=84
Skipping bad header
Found block at b3: comp=0 ref=20 length=1345 major=12 minor=91
Skipping bad header
Found block at af: comp=2 ref=20 length=1349 major=4 minor=84
Skipping bad header
Found block at ab: comp=0 ref=20 length=1356 major=7 minor=30
Skipping bad header
Trying OTP access at Address 0x03ff
Trying OTP access at Address 0x01ff
Unable to load data from any sources
... am I doing something wrong? I can try and remove the card and access it through an x86_64 PC if that would be worth trying?
Hello Tim,
thank you for reporting this issue and sorry for delayed answer. Looking at the provided logs, I am tending to assume that this is some weird register byteswapping on PowerPC arch. Especially this looks suspicious:
root@wifi_660_1:~# /tmp/atheepmgr -v -t PCI:0030 -P 43:0
Found Device: 168c:0030 (AR9380/AR9381/QCA9381/AR9382/AR9388/AR9390/AR9392)
Try to map 00000000-0001ffff I/O region to the process memory
Mapped IO region at: 0xb7be5000
Atheros AR???? MAC/BB (SREV: 0xff031c00)
^^^^^^^^^^ - byteswapped 0x001c03ff chip id
Probably debugfs register access suffer from the same issue. Need to reproduce the issue, but at the moment I have no setup with big-endian CPU and a wireless interface with a real EEPROM chip.
If you need to quickly check the EEPROM contents and the EEPROM is not corrupted, then the easiest way to do this is dump the EEPROM via the ath9k debugfs interface, and then parse it with atheepmgr:
root@OpenWrt:~# cat /sys/kernel/debug/ieee80211/phy0/ath9k/eeprom > /tmp/eep.bin
root@OpenWrt:~# atheepmgr -vv -t 9300 -F /tmp/eep.bin
I you need the full utility functionality, then we need to figure out what happened with the EEPROM contents during the loading stage.
Please, apply the attached patch. It introduce a new command that saves the EEPROM contents without any checks. And do the raw data fetching:
root@OpenWrt:~# /tmp/atheepmgr -vv -D wlan0 -t 9300 save-raw-eep /tmp/eep-raw.bin
Thanks for the patch. I carried out a few experiments.
Firstly I used the following:
root@OpenWrt:~# cat /sys/kernel/debug/ieee80211/phy0/ath9k/eeprom > /tmp/eep.bin
root@OpenWrt:~# atheepmgr -vv -t 9300 -F /tmp/eep.bin
This produced similar errors like:
root@wifi_660_1:~# uname -a
Linux wifi_660_1 5.10.120 #0 Fri Jun 10 07:20:21 2022 ppc GNU/Linux
root@wifi_660_1:~# atheepmgr -vv -t 9300 -F /tmp/eep.bin
confile: file data length is 0x4000 (16384) bytes, emulate 0x4000 bytes (16 KB, 128 kbit) EEPROM IC
EEPROM access ops: use connector's ops
OTP access ops: use connector's ops
Try to load data from blob
Try to load data from EEPROM
Use byteswapped EEPROM I/O
EEPROM magic found
Trying EEPROM access at Address 0x03ff
Found block at 3ff: comp=1 ref=21 length=1569 major=3 minor=34
Skipping bad header
Found block at 3fb: comp=0 ref=27 length=26 major=8 minor=5
However copying the file off to my x86_64 laptop would dump the file contents as expected...
The following patch seems to let the PCI 'save' command also produce a file which can be parsed by the laptop (only tested with read, and only compile-tested on Linux):
--- /home/tim/prog/atheepmgr/con_pci.c 2022-07-04 12:38:06.758600176 +0100
+++ con_pci.c 2022-07-11 15:26:26.443861455 +0100
@@ -17,6 +17,7 @@
#include <fcntl.h>
#include <pciaccess.h>
+#include <endian.h>
#include "atheepmgr.h"
@@ -124,14 +125,14 @@
{
struct pci_priv *ppd = aem->con_priv;
- return *((volatile uint32_t *)(ppd->io_map + reg));
+ return le32toh(*((volatile uint32_t *)(ppd->io_map + reg)));
}
static void pci_reg_write(struct atheepmgr *aem, uint32_t reg, uint32_t val)
{
struct pci_priv *ppd = aem->con_priv;
- *((volatile uint32_t *)(ppd->io_map + reg)) = val;
+ *((volatile uint32_t *)(ppd->io_map + reg)) = htobe32(val);
}
static void pci_reg_rmw(struct atheepmgr *aem, uint32_t reg, uint32_t set,
@@ -140,10 +141,10 @@
struct pci_priv *ppd = aem->con_priv;
uint32_t tmp;
- tmp = *((volatile uint32_t *)(ppd->io_map + reg));
+ tmp = le32toh(*((volatile uint32_t *)(ppd->io_map + reg)));
tmp &= ~clr;
tmp |= set;
- *((volatile uint32_t *)(ppd->io_map + reg)) = tmp;
+ *((volatile uint32_t *)(ppd->io_map + reg)) = htobe32(tmp);
}
static int pci_parse_devarg(const char *str, struct pci_slot_match *slot)
I didn't have a clear idea where the code was working with CPU-endian data, and where it was working with device-endian data, but since both ppc32 and x86_64 were saying "Use byteswapped EEPROM I/O", and that seemed weird, I speculatively tried applying the following hack-patch, and that seemed fix parsing (but I've no idea whether or not it's bogus and will cause problems elsewhere):
diff --git a/eep_common.h b/eep_common.h
index dffd8c2..cd58fc8 100644
--- a/eep_common.h
+++ b/eep_common.h
@@ -34,11 +34,11 @@
#define LE32CONST(__val) ((uint32_t)(__val))
#endif
-#if __BYTE_ORDER == __BIG_ENDIAN
+/* #if __BYTE_ORDER == __BIG_ENDIAN
#define AR5416_EEPROM_MAGIC 0x5aa5
-#else
+#else */
#define AR5416_EEPROM_MAGIC 0xa55a
-#endif
+/* #endif */
#define AR5416_EEPROM_MAGIC_OFFSET 0x0
#define AR5416_EEP_NO_BACK_VER 0x1
With both patches applied, on the ppc32 all of these seem to do the right thing:
/tmp/atheepmgr -vv -t PCI:0030 -P 43:0 save /tmp/eep-pci.bin
modprobe ath9k
wifi up
cat /sys/kernel/debug/ieee80211/phy0/ath9k/eeprom > /tmp/eep.bin
/tmp/atheepmgr -v -D wlan0 -t 9300
/tmp/atheepmgr -v -D wlan0 -t 9300 save /tmp/via-driver.bin
/tmp/atheepmgr -vv -t PCI:0030 -F /tmp/via-driver.bin
/tmp/atheepmgr -vv -t PCI:0030 -F /tmp/eep-pci.bin
/tmp/atheepmgr -vv -t PCI:0030 -F /tmp/eep.bin
The same files can also be parsed on the x86_64 laptop.
Happy to carry out further tests...
Tim.
Looks like this would make things work on BSD, but I don't have a BSD system here that I can test on
#ifdef HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#else
#include <endian.h>
#endif
Hello Tim,
thank you for this research! It is now clear that atheepmgr has a number of endians handling issues. At the moment I do not have access to any BE platform with an AR93xx card. I will leave this issue open until I have a chance to run tests on a real hardware and finally fix it.
No problem, thanks for following up. The device I'm testing on is a Netgear WNDAP660, which has two identical 3x3 ath9k mini-pcie cards inside.
A while ago a lot of these were being decommissioned by corporate users, and so they were quite cheap on the second hand market, but there seem to be less now, and the prices are a bit higher. Looking eBay, there are some on sale near to me for £25 (around €30 or $30) at the moment.
I'm currently using two of them in my house, but I could free one up, and arrange remote ssh access to it (running a fresh install of OpenWRT 22.03) at some point if that would help you out?
Tim, thank you for your assistance. I just need, besides the board, to find some spare time to carefully study the possible endianness cases to properly fix the issue. This summer is kind of crazy, but I hope it ends someday :)
Hello Tim,
I had a chance to test the utility with a BE CPU. I have used R11e-5HnD (AR9582 based) and R11e-5HacT (QCA9880 based) wireless cards with MikroTik RB912 board, which is equipped with AR9342 MIPS SoC (see full logs below). I found that the utility works as expected with the MIPS BE CPU via each interface: PCI, memory, driver. It correctly detects the card chip, performs the required unpacking, and properly detects the CPU-Data byte order difference.
So we can narrow down the issue scope down to the PowerPC byte order mess, as you already pointed out in the updated issue title. I have checked the Linux I/O memory accessor implementations for the PPC arch. Looks like on a such platform the utility should manually byteswap the register value if it is obtained directly from the hardware (e.g. using PCI or IOMEM connectors). We need this to turn the PCI bus little-endian byteorder to the big-endian CPU byteorder. Fetching data via the driver interface works fine, as the kernel performs all the required byteswaps. But it is still unclear to me why the utility fail to process the extracted data.
Now the issue is break down into two:
- How to determine that the utility should perform the register value byteswapping on a particular platform? As you can see, it is not enough to know only the CPU endians.
- What is going on during data processing on a PPC CPU?
I will check the libc headers, which are related to endians handling to see how to solve the first issue. But the second issue requires more input.
BTW, I just merged raw data saving support to the tree. Troubleshooting should be a bit easier now.
RB912 + R11e-5HnD (AR9582 based, eep9300 format), PCI connector
root@OpenWrt:~# atheepmgr -P 0:0 -vv dump none
Found Device: 168c:0033 (AR9580/QCA9580/AR9582/QCA9582/AR9590/QCA9590/AR9592/QCA9592)
Try to map 10000000-1001ffff I/O region to the process memory
Mapped IO region at: 0x77d18000
Autodetected EEPROM map type is 9300
Atheros AR9300 MAC/BB Rev:4 (SREV: 0x001c04ff)
EEPROM access ops: use AR9xxx ops
OTP access ops: use AR93xx ops
Try to load data from EEPROM
Try to load data from OTP memory
Trying OTP access at Address 0x03ff
Found block at 3ff: comp=3 ref=2 length=806 major=2 minor=27
Restore eeprom 0: block, reference 2, length 806
Restore at 0: spot=1 offset=1 length=27
Restore at 29: spot=32 offset=4 length=2
Restore at 33: spot=40 offset=6 length=5
...
Restore at 757: spot=1036 offset=4 length=3
Restore at 762: spot=1042 offset=3 length=31
Restore at 795: spot=1076 offset=3 length=9
EEPROM Endianness is not native.. Changing.
Freeing Mapped IO region at: 0x77d18000
RB912 + R11e-5HnD (AR9582 based, eep9300 format), IOMEM connector
root@OpenWrt:~# atheepmgr -M 0x10000000 -t 9300 -vv dump none
Atheros AR9300 MAC/BB Rev:4 (SREV: 0x001c04ff)
EEPROM access ops: use AR9xxx ops
OTP access ops: use AR93xx ops
Try to load data from EEPROM
Try to load data from OTP memory
Trying OTP access at Address 0x03ff
Found block at 3ff: comp=3 ref=2 length=806 major=2 minor=27
Restore eeprom 0: block, reference 2, length 806
Restore at 0: spot=1 offset=1 length=27
Restore at 29: spot=32 offset=4 length=2
Restore at 33: spot=40 offset=6 length=5
...
Restore at 757: spot=1036 offset=4 length=3
Restore at 762: spot=1042 offset=3 length=31
Restore at 795: spot=1076 offset=3 length=9
EEPROM Endianness is not native.. Changing.
RB912 + R11e-5HnD (AR9582 based, eep9300 format), driver debugfs connector
root@OpenWrt:~# atheepmgr -D wlan1 -t 9300 -vv dump none
Atheros AR9300 MAC/BB Rev:4 (SREV: 0x001c04ff)
EEPROM access ops: use AR9xxx ops
OTP access ops: use AR93xx ops
Try to load data from EEPROM
Try to load data from OTP memory
Trying OTP access at Address 0x03ff
Found block at 3ff: comp=3 ref=2 length=806 major=2 minor=27
Restore eeprom 0: block, reference 2, length 806
Restore at 0: spot=1 offset=1 length=27
Restore at 29: spot=32 offset=4 length=2
Restore at 33: spot=40 offset=6 length=5
...
Restore at 757: spot=1036 offset=4 length=3
Restore at 762: spot=1042 offset=3 length=31
Restore at 795: spot=1076 offset=3 length=9
EEPROM Endianness is not native.. Changing.
RB912 + R11e-5HacT (QCA9880 based, eep9880 format), PCI connector
root@OpenWrt:~# atheepmgr -P 0:0 -v dump none
Found Device: 168c:003c (QCA9860/QCA9862/QCA9880/QCA9882/QCA9890/QCA9892)
Try to map 10000000-101fffff I/O region to the process memory
Mapped IO region at: 0x77b3c000
Autodetected EEPROM map type is 9880
Atheros QCA9880 MAC/BB Rev:2 (SREV: 0x043202ff)
Unable to select GPIO access ops due to unsupported chip
Chip does not support EEPROM
OTP access ops: use QCA988x ops
Found block at 0: comp=3 ref=3 length=627 major=4 minor=4
Restore eeprom 0: block, reference 3, length 627
Restore at 0: spot=6 offset=6 length=6
Restore at 8: spot=16 offset=4 length=2
Restore at 12: spot=41 offset=23 length=1
...
Restore at 281: spot=1306 offset=4 length=2
Restore at 285: spot=1312 offset=4 length=240
Restore at 529: spot=1924 offset=117 length=96
EEPROM Endianness is not native.. Changing.
Freeing Mapped IO region at: 0x77b3c000
RB912 + R11e-5HacT (QCA9880 based, eep9880 format), IOMEM connector
root@OpenWrt:~# atheepmgr -M 0x10000000 -t 9880 -v dump none
Atheros QCA9880 MAC/BB Rev:2 (SREV: 0x043202ff)
Unable to select GPIO access ops due to unsupported chip
Chip does not support EEPROM
OTP access ops: use QCA988x ops
Found block at 0: comp=3 ref=3 length=627 major=4 minor=4
Restore eeprom 0: block, reference 3, length 627
Restore at 0: spot=6 offset=6 length=6
Restore at 8: spot=16 offset=4 length=2
Restore at 12: spot=41 offset=23 length=1
...
Restore at 281: spot=1306 offset=4 length=2
Restore at 285: spot=1312 offset=4 length=240
Restore at 529: spot=1924 offset=117 length=96
EEPROM Endianness is not native.. Changing.
Thanks for looking at this - if it would be helpful to arrange secure remote access for you to a 32 bit BE OpenWRT PowerPC access point with an ath9k, please let me know. Similarly if I can help with any debug.