From nobody Wed Jun 08 17:07:06 2022 X-Original-To: dev-commits-src-all@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 7A2B08318E9; Wed, 8 Jun 2022 17:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LJDDB33B7z4lDR; Wed, 8 Jun 2022 17:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654708026; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ep+icAzFiEdZ+SOV1eFOtMPXpLz2CHtsFDKFzeDVmUw=; b=V7u8fVPjd/Hz/dKfKvfANWTv0tGFBIKtPA1pRlYLeMlWor3DjJeRpFIdMF2GCwHNAeY7XI /mQRaUYCpz0UB0mbzBs3zODf+0KqTGVTzsVBLfyIXTb91cFKB21jOv69MJ/KY9CkFZ+Q2U slsmKRZP6xMzP2z6hm4KM/qWU7CUkGWryy0Gt7pOuPHE9IHi8HL02UygA0ELYf09NjB1KU kQs+uV8NR/Gn0gyDu+3bmJqyp6+AU2+JFBF7ghiLyWWOCIMkkOaDKUs8bAF2x7U1cIb2Ds Bzq3Qgp8izilNs2VzysfT2SfpTPCDRu5jPyLmNRByklpspFk+cLapV0H6U17GQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4869313C10; Wed, 8 Jun 2022 17:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 258H76JR088949; Wed, 8 Jun 2022 17:07:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 258H76op088948; Wed, 8 Jun 2022 17:07:06 GMT (envelope-from git) Date: Wed, 8 Jun 2022 17:07:06 GMT Message-Id: <202206081707.258H76op088948@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3c0ad30d782b - stable/13 - iwlwifi: add sysctl to dump PCI IDs/ names / firmware-prefixes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3c0ad30d782b69b2d7e64785bc6db4c6be1f3d52 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654708026; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ep+icAzFiEdZ+SOV1eFOtMPXpLz2CHtsFDKFzeDVmUw=; b=Tfb1AcXg8dgF91Mm7Ro1wmMCyltLZ5Hmus6ZY5ugGa7Y/SUT84l2MAhsVdCnA2cSQewdet T8e5+UL1ltkCQ9z4HbMZVvEWAH8NTdaRlwueRAf2EgZ4WGJqJikg5wIOMMI4ztrr4Ij/SF x5okpCI91hZjmZQak6Bnyhc/k/iPEeCc+WKS1HjYNoUP8h5EcAjEcp+rfbTG+ycyUoe242 iWAkL+sJS+V7jjKzyerrfIwbvPBbjr+V/5qHyqzJ6Rtu4MxAM7UarfhwovXFhUfjf0m3dN mnwj6e20UgTdJaK3VrK9/0GNbFhVsl9rzxTB0Qb3yAV25Cv+FtxK+ZkQ7KA/5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654708026; a=rsa-sha256; cv=none; b=Y5SoKQ0j6mNtGDtYhhN83JpmMtuGG8+XDaLfC3qlMdjsACJdD+dfdiFfJim5kJyLVU4RDg uJzLovacsm3CJZt2ZMm5LjY+5tLnYT8m/4MlKEh/rxoW6VXGU0RRB/+kl6KQdUazJjlB8o KLdnwzR96SCZZrYTydIiS9TAcPduahqg9sET8b2Nbqr5PIwjCdSiznVS2wkRldwDbj9EoG 0fwhFz8AMcf/ahBDQs6ZemJIgCTNoFP0wA1XrdKPbMlR1wKLTPaayNvtbajC7lMk9un7NW S+VjKg1EOohfGkVu5xrgobBP6SdAMeSAvGaX1U521/s4RYhE/ta6qu5Z6LANUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3c0ad30d782b69b2d7e64785bc6db4c6be1f3d52 commit 3c0ad30d782b69b2d7e64785bc6db4c6be1f3d52 Author: Bjoern A. Zeeb AuthorDate: 2022-05-18 16:05:49 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-06-08 16:11:18 +0000 iwlwifi: add sysctl to dump PCI IDs/ names / firmware-prefixes Add a FreeBSD-specifc SYSCTL_PROC to dump the list of PCI IDs / name / firmware-prefix which can be post-processed for man pages (iwlwifi.4 and iwlwififw.4) or the wiki. The output still yields duplicates depending on by what information you need so one may wants to filter them out (try not to use sort/uniq). Sponsored by: The FreeBSD Foundation (cherry picked from commit 645886d028c85b3cb9fb36e96b1edc661cf4c0d8) --- sys/contrib/dev/iwlwifi/pcie/drv.c | 62 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/sys/contrib/dev/iwlwifi/pcie/drv.c b/sys/contrib/dev/iwlwifi/pcie/drv.c index 536a40f1e5cc..6b9ce03850ec 100644 --- a/sys/contrib/dev/iwlwifi/pcie/drv.c +++ b/sys/contrib/dev/iwlwifi/pcie/drv.c @@ -1767,3 +1767,65 @@ void iwl_pci_unregister_driver(void) { pci_unregister_driver(&iwl_pci_driver); } + +#if defined(__FreeBSD__) +static int +sysctl_iwlwifi_pci_ids_name(SYSCTL_HANDLER_ARGS) +{ + const struct pci_device_id *id; + struct sbuf *sb; + int error, i; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + sb = sbuf_new_for_sysctl(NULL, NULL, 512, req); + if (sb == NULL) + return (ENOMEM); + + id = iwl_hw_card_ids; + while (id != NULL && id->vendor != 0) { + + if ((id->driver_data & TRANS_CFG_MARKER) != 0) { + /* Skip and print them below. */ + + } else if (id->driver_data != 0) { + const struct iwl_cfg *cfg; + + cfg = (void *)(id->driver_data & ~TRANS_CFG_MARKER); + sbuf_printf(sb, "%#06x/%#06x/%#06x/%#06x\t%s\t%s\n", + id->vendor, id->device, id->subvendor, id->subdevice, + cfg->name, cfg->fw_name_pre); + } else { + sbuf_printf(sb, "%#06x/%#06x/%#06x/%#06x\t%s\t%s\n", + id->vendor, id->device, id->subvendor, id->subdevice, + "",""); + } + id++; + } + + for (i = 0; i < ARRAY_SIZE(iwl_dev_info_table); i++) { + const struct iwl_dev_info *dev_info = &iwl_dev_info_table[i]; + const char *name; + + if (dev_info->name) + name = dev_info->name; + else if (dev_info->cfg && dev_info->cfg->name) + name = dev_info->cfg->name; + else + name = ""; + + sbuf_printf(sb, "%#06x/%#06x/%#06x/%#06x\t%s\t%s\n", + PCI_VENDOR_ID_INTEL, dev_info->device, PCI_ANY_ID, dev_info->subdevice, + name, dev_info->cfg->fw_name_pre); + } + + error = sbuf_finish(sb); + sbuf_delete(sb); + + return (error); +} +SYSCTL_PROC(LINUXKPI_PARAM_PARENT, OID_AUTO, LINUXKPI_PARAM_NAME(pci_ids_name), + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, 0, + sysctl_iwlwifi_pci_ids_name, "", "iwlwifi PCI IDs and names"); +#endif