summaryrefslogtreecommitdiff
path: root/sys/dev/puc
AgeCommit message (Collapse)Author
2025-12-09bus_alloc_resource: Pass rid by value to BUS_ALLOC_RESOURCE DEVMETHODJohn Baldwin
The wrapper functions such as bus_alloc_resource_any() still support passing the rid by value or pointer, but the underlying implementation now passes by value. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53402
2025-08-26puc: Add support for Systembase SB16C1054, SB16C1058.Jashank Jeremy
The Systembase SB16C1054 and SB16C1058 are PCI quad- and octal-UART complexes, based on multiple Systembase SB16C1050 cores, which appear to be compatible with the NS8250 family (except for the "enable interrupts" bit in the other BAR). The SB16C105x family are one of two families of PCIe UART complexes on cards by StarTech.com, such as the PEX4S1050 and PEX8S1050. (Other StarTech.com serial offerings use the ASIX AX99100 or ASIX MCS990x.) This is derived from the NetBSD driver. Reviewed by: imp Tested by: Jashank Jeremy <jashank@rulingia.com.au> Obtained from: Jashank Jeremy <jashank@rulingia.com.au> MFC after: 1 week Differential Revision: <https://reviews.freebsd.org/D52150
2025-01-02puc: Use device_delete_children if attach failsJohn Baldwin
This is slightly simpler than deleting individual devices. Differential Revision: https://reviews.freebsd.org/D47974
2025-01-02Use bus_generic_detach to detach and delete child devices during detachJohn Baldwin
This is simpler and more robust than individual calls to device_delete_child. Differential Revision: https://reviews.freebsd.org/D47972
2024-12-31uart: Add support for Brainboxes / Intashield serial cards.Yoshihiro Takahashi
PR: 283226 Reported by: Cameron Williams
2024-07-24newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh
Sponsored by: Netflix
2024-03-13new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCEJohn Baldwin
The public bus_release_resource() API still accepts both forms, but the internal kobj method no longer passes the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44131
2024-01-08puc: Add support for Exar XR17V354 Quad PCI Express UART.Teerayut Hiruntaraporn
PR: 257207 MFC after: 1 week
2023-11-26sys: Automated cleanup of cdefs and other formattingWarner Losh
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-07-24puc: fix man page referenceMitchell Horne
The reference to puc(9) is wrong; the page does not exist, and drivers belong to section 4. Change the reference to puc(4), which does exist. MFC after: 3 days Sponsored by: The FreeBSD Foundation
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2023-04-25Use bool for one-bit wide bit-fieldsDimitry Andric
A signed one-bit wide bit-field can take only the values 0 and -1. Clang 16 introduced a warning that "implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1". Fix the warnings by using C99 bool. Reported by: Clang 16 Reviewed by: emaste, jhb MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D39705
2022-05-06puc: Remove unused devclass argument to DRIVER_MODULE.John Baldwin
2021-06-22newbus: Move from bus_child_{pnpinfo,location}_src to ↵Warner Losh
bus_child_{pnpinfo,location} with sbuf Now that the upper layers all go through a layer to tie into these information functions that translates an sbuf into char * and len. The current interface suffers issues of what to do in cases of truncation, etc. Instead, migrate all these functions to using struct sbuf and these issues go away. The caller is also in charge of any memory allocation and/or expansion that's needed during this process. Create a bus_generic_child_{pnpinfo,location} and make it default. It just returns success. This is for those busses that have no information for these items. Migrate the now-empty routines to using this as appropriate. Document these new interfaces with man pages, and oversight from before. Reviewed by: jhb, bcr Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29937
2021-01-07pccard: Remove puc(4) PC Card attachmentWarner Losh
Remove PUC's pccard attachment. This removes support for 16-bit PC Cards. Relnotes: Yes
2020-09-01puc: clean up empty lines in .c and .h filesMateusz Guzik
Notes: svn path=/head/; revision=365171
2020-08-20Tag pccard drivers with gone in 13.Warner Losh
MFC After: 3 days Reviewed by: emaste, brooks, adrian (on twitter) Differential Revision: https://reviews.freebsd.org/D26095 Notes: svn path=/head/; revision=364430
2020-02-26Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
2020-02-07Miscellaneous typo fixesEd Maste
Submitted by: Gordon Bergling <gbergling_gmail.com> Differential Revision: https://reviews.freebsd.org/D23453 Notes: svn path=/head/; revision=357664
2019-12-04Regularize my copyright noticeWarner Losh
o Remove All Rights Reserved from my notices o imp@FreeBSD.org everywhere o regularize punctiation, eliminate date ranges o Make sure that it's clear that I don't claim All Rights reserved by listing All Rights Reserved on same line as other copyright holders (but not me). Other such holders are also listed last where it's clear. Notes: svn path=/head/; revision=355394
2019-02-05Remove All Rights ReservedWarner Losh
Remove the all rights reserved clause from my copyright, and make other minor tweaks needed where that might have created ambiguity. Notes: svn path=/head/; revision=343811
2018-09-26Reapply, with minor tweaks, r338025, from the original commit:Warner Losh
Remove unused and easy to misuse PNP macro parameter Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Approved by: re (glen) Notes: svn path=/head/; revision=338948
2018-08-19Back out r338035 until Warner is finished churning GSoC PNP patchesConrad Meyer
I was not aware Warner was making or planning to make forward progress in this area and have since been informed of that. It's easy to apply/reapply when churn dies down. Notes: svn path=/head/; revision=338037
2018-08-19Remove unused and easy to misuse PNP macro parameterConrad Meyer
Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Notes: svn path=/head/; revision=338035
2018-06-06puc(4): Add provisional support for Exar XR17V352Conrad Meyer
Reportedly, this is sufficient for 4800bps use, but maybe not any better. PR: 228781 Submitted by: peo AT nethead.se Notes: svn path=/head/; revision=334722
2018-04-17Add PNP info to the PCI attahement of the puc driver.Warner Losh
Adjust sys/conf/files and sys/modules/puc/Makefile to omit pucdata.c now tht it's included by puc_pci.c. Submitted by: Lakhan Shiva Kamireddy (with build fixes by me) Pull Request: https://github.com/freebsd/freebsd/pull/136 Notes: svn path=/head/; revision=332652
2017-11-27sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
2016-10-17Fix device delete child function.Hans Petter Selasky
When detaching device trees parent devices must be detached prior to detaching its children. This is because parent devices can have pointers to the child devices in their softcs which are not invalidated by device_delete_child(). This can cause use after free issues and panic(). Device drivers implementing trees, must ensure its detach function detaches or deletes all its children before returning. While at it remove now redundant device_detach() calls before device_delete_child() and device_delete_children(), mostly in the USB controller drivers. Tested by: Jan Henrik Sylvester <me@janh.de> Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D8070 MFC after: 2 weeks Notes: svn path=/head/; revision=307518
2016-03-02Replace some more default range checks with RMAN_IS_DEFAULT_RANGE().Justin Hibbits
This is a follow-on to r295832. Notes: svn path=/head/; revision=296298
2016-01-27Convert rman to use rman_res_t instead of u_longJustin Hibbits
Summary: Migrate to using the semi-opaque type rman_res_t to specify rman resources. For now, this is still compatible with u_long. This is step one in migrating rman to use uintmax_t for resources instead of u_long. Going forward, this could feasibly be used to specify architecture-specific definitions of resource ranges, rather than baking a specific integer type into the API. This change has been broken out to facilitate MFC'ing drivers back to 10 without breaking ABI. Reviewed By: jhb Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5075 Notes: svn path=/head/; revision=294883
2016-01-10- Add support for Advantech PCI-1602 Rev. B1 and PCI-1603 cards. [1]Marius Strobl
- Add a description of Advantech PCI-1602 Rev. A boards. [1] - Properly set up REG_ACR also for PCI-1602 Rev. A based on what the Advantech-supplied Linux driver does. - Additionally use the macros of <dev/ic/ns16550.h> to replace existing magic values and get rid of trivial comments. - Fix the style of some comments. PR: 205359 [1] Submitted by: Jan Mikkelsen (original patch) [1] Notes: svn path=/head/; revision=293642
2015-12-29- Add entries for the more prominent members of the Digi InternationalMarius Strobl
Neo series, which are based on Exar PCI chips. - Mark some unused parameters as such. - Fix style MFC after: 3 days Notes: svn path=/head/; revision=292878
2015-12-28- Add an entry for the SIIG Cyber 2SP1 PCIe adapter, which is basedMarius Strobl
on an Oxford Semiconductor OX16PCI954 but uses only two ports and a non-default clock rate. - Fix style/whitespace PR: 176407 MFC after: 3 days Notes: svn path=/head/; revision=292840
2015-01-02puc(4): Add an entry for the Feasso PCI FPP-02 2S1P card.Luiz Otavio O Souza
MFC after: 1 week Notes: svn path=/head/; revision=276589
2014-10-23puc(4): add an entry for the Oxford Semiconductor OXPCIe952 1S1P card.Rui Paulo
Submitted by: Alex Burlyga <alex.burlyga.ietf at gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=273551
2014-06-28Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky
Notes: svn path=/head/; revision=267992
2014-06-27Revert r267961, r267973:Glen Barber
These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
2014-06-27Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky
there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
2014-04-15Correct a typo in a device description added in r264257.Marius Strobl
Notes: svn path=/head/; revision=264514
2014-04-10Refine r264257; given that I later on decided to nuke the wildcard forMarius Strobl
the Sunix 0x1999 line of chips there actually is no need to explicitly keep puc(4) from attaching to the single port version anymore. Notes: svn path=/head/; revision=264327
2014-04-08Distinguish between the different variants and configurations of SunixMarius Strobl
{MIO,SER}5xxxx chips instead of treating all of them as PUC_PORT_2S. Among others, this fixes the hang seen when trying to probe the none- existent second UART on an actually 1-port chip. Obtained from: NetBSD (BAR layouts) MFC after: 3 days Sponsored by: Bally Wulff Games & Entertainment GmbH Notes: svn path=/head/; revision=264257
2014-03-13Add MSI support to puc(9)Ryan Stone
Add support for MSI interrupts in the puc(9) driver. By default the driver will prefer MSI interrupts to legacy interrupts. A tunable, hw.puc.msi_disable, has been added to force the allocation of legacy interrupts. Reviewed by: jhb@ MFC after: 2 weeks Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=263109
2013-06-17Clean up -Wheader-guard warnings.Sergey Kandaurov
Submitted by: <dt71@gmx.com> MFC after: 3 days X-MFC with: r251848 Notes: svn path=/head/; revision=251862
2013-06-13All of Oxford/PLX OX16PCI954, OXm16PCI954 and OXu16PCI954 share theMarius Strobl
exact same (subsystem) device and vendor IDs. However, the reference design for the OXu16PCI954 uses a 14.7456 MHz clock (as does the EXSYS EX-41098-2 equipped with these), while at least the OX16PCI954 defaults to a 1.8432 MHz one. According to the datasheets of these chips, the only difference in PCI configuration space is that OXu16PCI954 have a revision ID of 1 while the other two are at 0. So employ the latter for determining the default clock rates of this family. Note that one might think that the actual clock could be derived from the Clock Prescaler Register (CPR) of these chips. Unfortunately, this is not that case and its use and content are orthogonal to the frequency of the crystal employed. Tested with an EXSYS EX-41098-2, which identifies and attaches as: pcib4@pci0:19:0:0: class=0x060400 card=0x02dd1014 chip=0x10801b21 rev=0x03 hdr=0x01 vendor = 'ASMedia Technology Inc.' device = 'ASM1083/1085 PCIe to PCI Bridge' class = bridge subclass = PCI-PCI puc0@pci0:20:4:0: class=0x070006 card=0x00001415 chip=0x95011415 rev=0x01 hdr=0x00 vendor = 'Oxford Semiconductor Ltd' device = 'OX16PCI954 (Quad 16950 UART) function 0 (Uart)' class = simple comms subclass = UART puc1@pci0:20:4:1: class=0x068000 card=0x00001415 chip=0x95111415 rev=0x01 hdr=0x00 vendor = 'Oxford Semiconductor Ltd' device = 'OX16PCI954 (Quad 16950 UART) function 1 (8bit bus)' class = bridge puc2@pci0:20:8:0: class=0x070006 card=0x00001415 chip=0x95011415 rev=0x01 hdr=0x00 vendor = 'Oxford Semiconductor Ltd' device = 'OX16PCI954 (Quad 16950 UART) function 0 (Uart)' class = simple comms subclass = UART puc3@pci0:20:8:1: class=0x068000 card=0x00001415 chip=0x95111415 rev=0x01 hdr=0x00 vendor = 'Oxford Semiconductor Ltd' device = 'OX16PCI954 (Quad 16950 UART) function 1 (8bit bus)' class = bridge pci20: <ACPI PCI bus> on pcib4 puc0: <Oxford Semiconductor OX16PCI954 UARTs> port 0x5000-0x501f, 0x5020-0x503f mem 0xc6000000-0xc6000fff,0xc6001000-0xc6001fff irq 16 at device 4.0 on pci20 uart1: <16950 or compatible> at port 1 on puc0 uart2: <16950 or compatible> at port 2 on puc0 uart3: <16950 or compatible> at port 3 on puc0 uart4: <16950 or compatible> at port 4 on puc0 puc1: <Oxford Semiconductor OX9160/OX16PCI954 UARTs (function 1)> port 0x5040-0x505f,0x5060-0x507f mem 0xc6002000-0xc6002fff,0xc6003000-0xc6003fff irq 16 at device 4.1 on pci20 puc2: <Oxford Semiconductor OX16PCI954 UARTs> port 0x5080-0x509f, 0x50a0-0x50bf mem 0xc6004000-0xc6004fff,0xc6005000-0xc6005fff irq 16 at device 8.0 on pci20 uart5: <16950 or compatible> at port 1 on puc2 uart6: <16950 or compatible> at port 2 on puc2 uart7: <16950 or compatible> at port 3 on puc2 uart8: <16950 or compatible> at port 4 on puc2 puc3: <Oxford Semiconductor OX9160/OX16PCI954 UARTs (function 1)> port 0x50c0-0x50df,0x50e0-0x50ff mem 0xc6006000-0xc6006fff,0xc6007000-0xc6007fff irq 16 at device 8.1 on pci20 MFC after: 2 weeks Notes: svn path=/head/; revision=251715
2013-06-13Fix whitespace and normalize some entries.Marius Strobl
Notes: svn path=/head/; revision=251713
2013-03-18Correct the definition for Exar XR17V258IV: we must use a config_functionRyan Stone
to specify the offset into the PCI memory spare at which each serial port will find its registers. This was already done for other Exar PCI serial devices; it was accidentally omitted for this specific device. Sponsored by: Sandvine Incorporated MFC after: 1 week Notes: svn path=/head/; revision=248472
2013-03-15Add support for Exar XR17V358 8-port serial device to puc(4)Ryan Stone
Reviewed by: marius Sponsored by: Sandvine Inc. MFC after: 1 week Notes: svn path=/head/; revision=248340
2013-03-01- Apparently, r186520 was just wrong and the clock of Oxford OX16PCI958 isMarius Strobl
neither DEFAULT_RCLK * 2 nor DEFAULT_RCLK * 10 but plain DEFAULT_RCLK and there's no (open) source indicating otherwise. This was tested with an EXSYS EX-41098-2, whose clock is not configurable and identifies as: puc0@pci0:5:1:0: class=0x070200 card=0x06711415 chip=0x95381415 rev=0x01 hdr=0x00 vendor = 'Oxford Semiconductor Ltd' class = simple comms subclass = multiport serial Note that this exactly matches the card mentioned in PR 129665 so no sub-device/sub-vendor based quirking of the latter is possible. So maybe we should grow some sort of tunable, in case non-default cards such as the latter aren't configurable either (this also wouldn't be the first time an allegedly tested commit turns out to be wrong though). - Make the TiMedia tables const. MFC after: 1 week Notes: svn path=/head/; revision=247571