From nobody Tue May 30 17:30:20 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 4QVzvJ4RRcz4XsBf for ; Tue, 30 May 2023 17:30:52 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from webmail5.jnielsen.net (webmail5.jnielsen.net [IPv6:2607:f170:34:11::b0]) (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 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.freebsdsolutions.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QVzvH3cHWz3lB2 for ; Tue, 30 May 2023 17:30:51 +0000 (UTC) (envelope-from lists@jnielsen.net) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of lists@jnielsen.net designates 2607:f170:34:11::b0 as permitted sender) smtp.mailfrom=lists@jnielsen.net; dmarc=none Received: from smtpclient.apple (166-70-14-17.xmission.com [166.70.14.17] (may be forged)) (authenticated bits=0) by webmail5.jnielsen.net (8.17.1/8.17.1) with ESMTPSA id 34UHUVbU003079 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 30 May 2023 11:30:33 -0600 (MDT) (envelope-from lists@jnielsen.net) X-Authentication-Warning: webmail5.jnielsen.net: Host 166-70-14-17.xmission.com [166.70.14.17] (may be forged) claimed to be smtpclient.apple From: John Nielsen Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Help me grok the ath(4) device attach code Message-Id: <49AEA1CB-FA85-432F-89D7-8C49B5F3A344@jnielsen.net> Date: Tue, 30 May 2023 11:30:20 -0600 To: "wireless@freebsd.org" X-Mailer: Apple Mail (2.3731.600.7) X-Spamd-Result: default: False [-2.76 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.96)[-0.958]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:6364, ipnet:2607:f170:30::/44, country:US]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_EQ_ADDR_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; MLMMJ_DEST(0.00)[wireless@FreeBSD.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; DMARC_NA(0.00)[jnielsen.net]; RCPT_COUNT_ONE(0.00)[1]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[wireless@freebsd.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; HAS_XAW(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Rspamd-Queue-Id: 4QVzvH3cHWz3lB2 X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N 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 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 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. 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): 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. 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/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 (I don=E2=80=99t 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