Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 May 2023 18:23:34 -0600
From:      John Nielsen <lists@jnielsen.net>
To:        "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
Cc:        "wireless@freebsd.org" <wireless@FreeBSD.org>
Subject:   Re: Help me grok the ath(4) device attach code
Message-ID:  <E6DF8709-2767-48D3-AED1-D0608F5AABCF@jnielsen.net>
In-Reply-To: <q921p430-oq56-qo4n-rq49-0o7008pr40n3@yvfgf.mnoonqbm.arg>
References:  <49AEA1CB-FA85-432F-89D7-8C49B5F3A344@jnielsen.net> <q921p430-oq56-qo4n-rq49-0o7008pr40n3@yvfgf.mnoonqbm.arg>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_F3F041DD-38E8-4056-8EC4-14FDB0CE9F0B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

> On May 30, 2023, at 5:40 PM, Bjoern A. Zeeb =
<bzeeb-lists@lists.zabbadoz.net> wrote:
>=20
> On Tue, 30 May 2023, John Nielsen wrote:
>=20
>> I=E2=80=99m trying to wrap my head around the code in =
sys/dev/ath/ath_hal , partly for my own edification but mostly due to =
wanting to fix this bug:
>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D255337
>>=20
>> The card in question is an AR9462, branded (I think) as a Dell =
Wireless 1901 with this ID:
>> vendor=3D0x168c device=3D0x0034 subvendor=3D0x1028 subdevice=3D0x020d
>>=20
>> The card is identified and appears to initialize correctly but it has =
a default/bogus MAC address of 00:02:03:04:05:06 and is never able to =
scan any networks. It does work fine under Linux, so I=E2=80=99m =
attempting to compare the two codebases. But since I=E2=80=99m not a =
device developer and haven=E2=80=99t done much C since my undergraduate =
work, I=E2=80=99m having a bit of trouble.
>>=20
>> I=E2=80=99m open to any pointers but I=E2=80=99d specifically like to =
work out the following (unless I=E2=80=99m way off base, in which case =
I=E2=80=99d like to know that too):
>>=20
>> 1) Where does the default MAC address come from? In the Linux driver =
it looks like it=E2=80=99s here:
>> =
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/tree/drivers=
/net/wireless/ath/ath9k/ar9003_eeprom.c#n49
>> I don=E2=80=99t see any such definition in the FreeBSD code.
>=20
> No idea, but you should end up in a call to ar9300_get_mac_address()
> from sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c if my guess is =
right.
>=20
> The call comes from sys/dev/ath/if_ath.c ath_hal_getmac().
>=20
> Hope that helps you to trace this.

Thanks! I had no idea that directory was even there. More source to dive =
through...

>> 2) When ath_hal_attach() calls chip->attach(), which code is actually =
called (and how/where is that determined)?
>>=20
>> 3) Is there any equivalent in the FreeBSD code for this Linux process =
of trying to read the EEPROM from multiple different addresses? (Is it =
necessary?)
>> =
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/tree/drivers=
/net/wireless/ath/ath9k/ar9003_eeprom.c#n3299
>> See also:
>> =
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/drive=
rs/net/wireless/ath/ath9k?id=3D528782ecf59f7bab2f1368628a479f49be59b512
>> and the definitions here:
>> =
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/tree/drivers=
/net/wireless/ath/ath9k/ar9003_eeprom.h#n78
>>=20
>> (I don=E2=80=99t see any of those BASE_ADDR values referenced or =
defined anywhere in FreeBSD)
>>=20
>> 4) In general, what code should I be looking at to see how the EEPROM =
is read and interpreted for a specific card?
>>=20
>> Any help appreciated!


--Apple-Mail=_F3F041DD-38E8-4056-8EC4-14FDB0CE9F0B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><div><blockquote type=3D"cite"><div>On May 30, 2023, =
at 5:40 PM, Bjoern A. Zeeb &lt;bzeeb-lists@lists.zabbadoz.net&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div><meta =
charset=3D"UTF-8"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">On Tue, 30 May 2023, =
John Nielsen wrote:</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><blockquote type=3D"cite" style=3D"font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: auto; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;">I=E2=80=99m trying to wrap my head around the =
code in sys/dev/ath/ath_hal , partly for my own edification but mostly =
due to wanting to fix this =
bug:<br>https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D255337<br><br>=
The card in question is an AR9462, branded (I think) as a Dell Wireless =
1901 with this ID:<br>vendor=3D0x168c device=3D0x0034 subvendor=3D0x1028 =
subdevice=3D0x020d<br><br>The card is identified and appears to =
initialize correctly but it has a default/bogus MAC address of =
00:02:03:04:05:06 and is never able to scan any networks. It does work =
fine under Linux, so I=E2=80=99m attempting to compare the two =
codebases. But since I=E2=80=99m not a device developer and haven=E2=80=99=
t done much C since my undergraduate work, I=E2=80=99m having a bit of =
trouble.<br><br>I=E2=80=99m open to any pointers but I=E2=80=99d =
specifically like to work out the following (unless I=E2=80=99m way off =
base, in which case I=E2=80=99d like to know that too):<br><br>1) Where =
does the default MAC address come from? In the Linux driver it looks =
like it=E2=80=99s =
here:<br>https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/tre=
e/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c#n49<br>I don=E2=80=99t =
see any such definition in the FreeBSD code.<br></blockquote><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
display: inline !important;">No idea, but you should end up in a call to =
ar9300_get_mac_address()</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">from =
sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c if my guess is =
right.</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;"><br style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">The call comes from =
sys/dev/ath/if_ath.c ath_hal_getmac().</span><br style=3D"caret-color: =
rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">Hope =
that helps you to trace this.</span><br style=3D"caret-color: rgb(0, 0, =
0); font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"></div></blockquote><div><br></div><div>Thanks! I =
had no idea that directory was even there. More source to dive =
through...</div><br><blockquote type=3D"cite"><div><blockquote =
type=3D"cite" style=3D"font-family: Helvetica; font-size: 12px; =
font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; orphans: auto; text-align: start; text-indent: =
0px; text-transform: none; white-space: normal; widows: auto; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;">2) When ath_hal_attach() calls chip-&gt;attach(), which code is =
actually called (and how/where is that determined)?<br><br>3) Is there =
any equivalent in the FreeBSD code for this Linux process of trying to =
read the EEPROM from multiple different addresses? (Is it =
necessary?)<br>https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.g=
it/tree/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c#n3299<br>See =
also:<br>https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/com=
mit/drivers/net/wireless/ath/ath9k?id=3D528782ecf59f7bab2f1368628a479f49be=
59b512<br>and the definitions =
here:<br>https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/tre=
e/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h#n78<br><br>(I don=E2=80=99=
t see any of those BASE_ADDR values referenced or defined anywhere in =
FreeBSD)<br><br>4) In general, what code should I be looking at to see =
how the EEPROM is read and interpreted for a specific card?<br><br>Any =
help =
appreciated!<br></blockquote></div></blockquote></div><br></body></html>=

--Apple-Mail=_F3F041DD-38E8-4056-8EC4-14FDB0CE9F0B--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E6DF8709-2767-48D3-AED1-D0608F5AABCF>