From nobody Tue May 30 23:40:43 2023 X-Original-To: wireless@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QW86H1vPnz4YMQY for ; Tue, 30 May 2023 23:40:55 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE Root Certificate Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QW86G5dMBz3kcj for ; Tue, 30 May 2023 23:40:54 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Authentication-Results: mx1.freebsd.org; none Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 63CA88D4A17C; Tue, 30 May 2023 23:40:47 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 18D805C3A831; Tue, 30 May 2023 23:40:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id AzVBx9JI5GNE; Tue, 30 May 2023 23:40:45 +0000 (UTC) Received: from strong-iwl0.sbone.de (strong-iwl0.sbone.de [IPv6:fde9:577b:c1a9:4902:b66b:fcff:fef3:e3d2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 16C625C3A82F; Tue, 30 May 2023 23:40:44 +0000 (UTC) Date: Tue, 30 May 2023 23:40:43 +0000 (UTC) From: "Bjoern A. Zeeb" To: John Nielsen cc: "wireless@freebsd.org" Subject: Re: Help me grok the ath(4) device attach code In-Reply-To: <49AEA1CB-FA85-432F-89D7-8C49B5F3A344@jnielsen.net> Message-ID: References: <49AEA1CB-FA85-432F-89D7-8C49B5F3A344@jnielsen.net> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Discussions List-Archive: https://lists.freebsd.org/archives/freebsd-wireless List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-wireless@freebsd.org X-BeenThere: freebsd-wireless@freebsd.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="1098556516-1091208796-1685490045=:48381" X-Rspamd-Queue-Id: 4QW86G5dMBz3kcj X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/32, country:DE] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1098556516-1091208796-1685490045=:48381 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Tue, 30 May 2023, John Nielsen wrote: > I’m 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=255337 > > The card in question is an AR9462, branded (I think) as a Dell Wireless 1901 with this ID: > vendor=0x168c device=0x0034 subvendor=0x1028 subdevice=0x020d > > 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’m attempting to compare the two codebases. But since I’m not a device developer and haven’t done much C since my undergraduate work, I’m having a bit of trouble. > > I’m open to any pointers but I’d specifically like to work out the following (unless I’m way off base, in which case I’d like to know that too): > > 1) Where does the default MAC address come from? In the Linux driver it looks like it’s 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’t see any such definition in the FreeBSD code. 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. The call comes from sys/dev/ath/if_ath.c ath_hal_getmac(). Hope that helps you to trace this. > 2) When ath_hal_attach() calls chip->attach(), which code is actually called (and how/where is that determined)? > > 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/drivers/net/wireless/ath/ath9k?id=528782ecf59f7bab2f1368628a479f49be59b512 > 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 > > (I don’t see any of those BASE_ADDR values referenced or defined anywhere in FreeBSD) > > 4) In general, what code should I be looking at to see how the EEPROM is read and interpreted for a specific card? > > Any help appreciated! > > Thanks, > > JN > > > -- Bjoern A. Zeeb r15:7 --1098556516-1091208796-1685490045=:48381--