Index: stable/12/share/man/man4/an.4 =================================================================== --- stable/12/share/man/man4/an.4 (revision 365538) +++ stable/12/share/man/man4/an.4 (revision 365539) @@ -1,144 +1,147 @@ .\" Copyright (c) 1997, 1998, 1999 .\" Bill Paul . All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by Bill Paul. .\" 4. Neither the name of the author nor the names of any co-contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd July 16, 2005 .Dt AN 4 .Os .Sh NAME .Nm an .Nd "Aironet Communications 4500/4800 wireless network adapter driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device an" .Cd "device wlan" .Ed .Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent if_an_load="YES" .Ed +.Sh DEPRECATION NOTICE +This driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh DESCRIPTION The .Nm driver provides support for Aironet Communications 4500 and 4800 wireless network adapters and variants, including the following: .Pp .Bl -bullet -compact -offset indent .It Aironet Communications 4500 and 4800 series .It Cisco Aironet 340 and 350 series .It Xircom Wireless Ethernet Adapter .El .Pp Support for these devices include the ISA, PCI and PCMCIA varieties. The Aironet 4500 series adapters operate at 1 and 2Mbps while the Aironet 4800 series and Cisco adapters can operate at 1, 2, 5.5 and 11Mbps. The ISA, PCI and PCMCIA devices are all based on the same core PCMCIA modules and all have the same programming interface, however unlike the Lucent WaveLAN/IEEE cards, the ISA and PCI cards appear to the host as normal ISA and PCI devices and do not require any PCCARD support. .Pp The PCMCIA Aironet cards require PC Card support, including the kernel .Xr pccard 4 driver. ISA cards can either be configured to use ISA Plug and Play or to use a particular I/O address and IRQ by properly setting the DIP switches on the board. (The default switch setting is for Plug and Play.) The .Nm driver has Plug and Play support and will work in either configuration, however when using a hard-wired I/O address and IRQ, the driver configuration and the NIC's switch settings must agree. PCI cards require no switch settings of any kind and will be automatically probed and attached. .Pp All host/device interaction with the Aironet cards is via programmed I/O. The Aironet devices support 802.11 and 802.3 frames, power management, BSS (infrastructure) and IBSS (ad-hoc) operation modes. The .Nm driver encapsulates all IP and ARP traffic as 802.11 frames, however it can receive either 802.11 or 802.3 frames. Transmit speed is selectable between 1Mbps, 2Mbps, 5.5Mbps, 11Mbps or "auto" (the NIC automatically chooses the best speed). .Pp By default, the .Nm driver configures the Aironet card for infrastructure operation. .Pp For more information on configuring this device, see .Xr ifconfig 8 . .Sh DIAGNOSTICS .Bl -diag .It "an%d: init failed" The Aironet card failed to become ready after an initialization command was issued. .It "an%d: failed to allocate %d bytes on NIC" The driver was unable to allocate memory for transmit frames in the NIC's on-board RAM. .It "an%d: device timeout" The Aironet card failed to generate an interrupt to acknowledge a transmit command. .El .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , .Xr miibus 4 , .Xr netintro 4 , .Xr wlan 4 , .Xr ancontrol 8 , .Xr ifconfig 8 .Sh HISTORY The .Nm device driver first appeared in .Fx 4.0 . .Sh AUTHORS The .Nm driver was written by .An Bill Paul Aq Mt wpaul@ee.columbia.edu . Index: stable/12/share/man/man4/ata.4 =================================================================== --- stable/12/share/man/man4/ata.4 (revision 365538) +++ stable/12/share/man/man4/ata.4 (revision 365539) @@ -1,254 +1,257 @@ .\" Copyright (c) 2011 Alexander Motin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd March 23, 2015 .Dt ATA 4 .Os .Sh NAME .Nm ata .Nd generic ATA/SATA controller driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device scbus" .Cd "device ata" .Ed .Pp Alternatively, to load the driver as set of modules at boot time, place some of the following lines in .Xr loader.conf 5 : .Bd -literal -offset indent ata_load="YES" atacard_load="YES" ataisa_load="YES" atapci_load="YES" ataacard_load="YES" ataacerlabs_load="YES" ataamd_load="YES" ataati_load="YES" atacenatek_load="YES" atacypress_load="YES" atacyrix_load="YES" atahighpoint_load="YES" ataintel_load="YES" ataite_load="YES" atajmicron_load="YES" atamarvell_load="YES" atamicron_load="YES" atanational_load="YES" atanetcell_load="YES" atanvidia_load="YES" atapromise_load="YES" ataserverworks_load="YES" atasiliconimage_load="YES" atasis_load="YES" atavia_load="YES" .Ed .Pp The first line is for the common hardware independent code, and is a prerequisite for the other modules. The next three lines are generic bus-specific drivers. The rest are vendor-specific PCI drivers. .Pp The following tunables are settable from the .Xr loader 8 : .Bl -ohang .It Va hw.ata.ata_dma_check_80pin set to 0 to disable the 80pin cable check (the default is 1, check the cable). .It Va hint.atapci.X.msi set to 1 to allow Message Signalled Interrupts (MSI) to be used by the specified PCI ATA controller, if supported. .It Va hint.ata.X.devX.mode limits the initial ATA mode for the specified device on the specified channel. .It Va hint.ata.X.mode limits the initial ATA mode for every device on the specified channel. .It Va hint.ata.X.pm_level controls SATA interface Power Management for the specified channel, allowing some power savings at the cost of additional command latency. Possible values: .Pp .Bl -tag -width 4n -offset indent -compact .It 0 Interface Power Management is disabled. This is the default value. .It 1 The device is allowed to initiate a PM state change; the host is passive. .El .It Va hint.ata. Ns Ar X Ns Va .dev Ns Ar X Ns Va .sata_rev limits the initial SATA revision (speed) for the specified device on the specified channel. Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. .It Va hint.ata. Ns Ar X Ns Va .sata_rev Same, but for every device on the specified channel. .El .Sh DESCRIPTION The .Nm driver gives the .Xr CAM 4 subsystem access to the ATA (IDE) and SATA ports of many generic controllers. Depending on the controller, each PATA (IDE) port or each one or two SATA ports are represented to CAM as a separate bus with one or two targets. Most of the bus-management details are handled by the ATA/SATA-specific transport of CAM. Connected ATA disks are handled by the ATA protocol disk peripheral driver .Xr ada 4 . ATAPI devices are handled by the SCSI protocol peripheral drivers .Xr cd 4 , .Xr da 4 , .Xr sa 4 , etc. .Pp This driver supports ATA, and for the most of controllers, ATAPI devices. Command queuing and SATA port multipliers are not supported. Device hot-plug and SATA interface power management is supported only on some controllers. .Pp The .Nm driver can change the transfer mode when the system is up and running. See the .Cm negotiate subcommand of .Xr camcontrol 8 . .Pp The .Nm driver sets the maximum transfer mode supported by the hardware as default. However, the .Nm driver sometimes warns: .Dq Sy "DMA limited to UDMA33, non-ATA66 cable or device". This means that the .Nm driver has detected that the required 80 conductor cable is not present or could not be detected properly, or that one of the devices on the channel only accepts up to UDMA2/ATA33. The .Va hw.ata.ata_dma_check_80pin tunable can be set to 0 to disable this check. .Sh HARDWARE The currently supported ATA/SATA controller chips are: .Pp .Bl -tag -width "Silicon Image:" -compact .It Acard: ATP850P, ATP860A, ATP860R, ATP865A, ATP865R. .It ALI: M5228, M5229, M5281, M5283, M5287, M5288, M5289. .It AMD: AMD756, AMD766, AMD768, AMD8111, CS5536. .It ATI: IXP200, IXP300, IXP400, IXP600, IXP700, IXP800. .It CMD: CMD646, CMD646U2, CMD648, CMD649. .It Cypress: Cypress 82C693. .It Cyrix: Cyrix 5530. .It HighPoint: HPT302, HPT366, HPT368, HPT370, HPT371, HPT372, HPT372N, HPT374. .It Intel: 6300ESB, 31244, PIIX, PIIX3, PIIX4, ESB2, ICH, ICH0, ICH2, ICH3, ICH4, ICH5, ICH6, ICH7, ICH8, ICH9, ICH10, SCH, PCH. .It ITE: IT8211F, IT8212F, IT8213F. .It JMicron: JMB360, JMB361, JMB363, JMB365, JMB366, JMB368. .It Marvell 88SE6101, 88SE6102, 88SE6111, 88SE6121, 88SE6141, 88SE6145. .It National: SC1100. .It NetCell: NC3000, NC5000. .It nVidia: nForce, nForce2, nForce2 MCP, nForce3, nForce3 MCP, nForce3 Pro, nForce4, MCP51, MCP55, MCP61, MCP65, MCP67, MCP73, MCP77, MCP79, MCP89. .It Promise: PDC20246, PDC20262, PDC20263, PDC20265, PDC20267, PDC20268, PDC20269, PDC20270, PDC20271, PDC20275, PDC20276, PDC20277, PDC20318, PDC20319, PDC20371, PDC20375, PDC20376, PDC20377, PDC20378, PDC20379, PDC20571, PDC20575, PDC20579, PDC20580, PDC20617, PDC20618, PDC20619, PDC20620, PDC20621, PDC20622, PDC40518, PDC40519, PDC40718, PDC40719. .It ServerWorks: HT1000, ROSB4, CSB5, CSB6, K2, Frodo4, Frodo8. .It Silicon Image: SiI0680, SiI3112, SiI3114, SiI3512. .It SiS: SIS180, SIS181, SIS182, SIS5513, SIS530, SIS540, SIS550, SIS620, SIS630, SIS630S, SIS633, SIS635, SIS730, SIS733, SIS735, SIS745, SIS961, SIS962, SIS963, SIS964, SIS965. .It VIA: VT6410, VT6420, VT6421, VT82C586, VT82C586B, VT82C596, VT82C596B, VT82C686, VT82C686A, VT82C686B, VT8231, VT8233, VT8233A, VT8233C, VT8235, VT8237, VT8237A, VT8237S, VT8251, CX700, VX800, VX855, VX900. .El .Pp Some of above chips can be configured for AHCI mode. In such case they are supported by .Xr ahci 4 driver instead. .Pp Unknown ATA chipsets are supported in PIO modes, and if the standard busmaster DMA registers are present and contain valid setup, DMA is also enabled, although the max mode is limited to UDMA33, as it is not known what the chipset can do and how to program it. +.Sh DEPRECATION NOTICE +The PC Card attachment of this driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh NOTES Please remember that in order to use UDMA4/ATA66 and above modes you .Em must use 80 conductor cables. Please assure that ribbon cables are no longer than 45cm. In case of rounded ATA cables, the length depends on the quality of the cables. SATA cables can be up to 1m long according to the specification. External SATA cables can be 2m long and more, but not all controllers work well on long cables, especially at high speeds. .Sh SEE ALSO .Xr ada 4 , .Xr ahci 4 , .Xr cam 4 , .Xr cd 4 , .Xr mvs 4 , .Xr siis 4 , .Xr camcontrol 8 .Sh HISTORY The .Nm driver first appeared in .Fx 4.0 . It was turned into a .Xr CAM 4 interface module in .Fx 9.0 . .Sh AUTHORS .An Alexander Motin Aq Mt mav@FreeBSD.org .An S\(/oren Schmidt Aq Mt sos@FreeBSD.org Index: stable/12/share/man/man4/cmx.4 =================================================================== --- stable/12/share/man/man4/cmx.4 (revision 365538) +++ stable/12/share/man/man4/cmx.4 (revision 365539) @@ -1,123 +1,126 @@ .\" .\" Copyright (c) 2006-2007 Daniel Roethlisberger .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice unmodified, this list of conditions, and the following .\" disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd July 7, 2007 .Dt CMX 4 .Os .Sh NAME .Nm cmx .Nd Omnikey CardMan 4040 smartcard reader device driver .Sh SYNOPSIS .Cd device cmx +.Sh DEPRECATION NOTICE +This driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh DESCRIPTION The .Nm driver provides support for the PCCARD based .Em Omnikey CardMan 4040 smartcard reader. The driver provides a character device special file based .Em Chip/Smart Card Interface Devices (CCID) interface. The driver implements what the vendor calls the .Em Synchronous API onto the smartcard reader device. .Pp Reading and writing is synchronous, meaning that a call to .Xr write 2 directly corresponds to a complete CCID command sent to the device, while the following .Xr read 2 will return the complete answer from the reader. There is no support for partial reads or writes. There is no upper limit on CCID request or response sizes, but the complete CCID request must be sent to the driver in .Xr write 2 and the complete CCID response must fit into the buffer supplied to .Xr read 2 . .Pp Non-blocking I/O, .Xr select 2 and .Xr poll 2 are supported and work as expected. An open file descriptor will always be ready for writing, but only ready for reading if the device indicates that it has data available. .Sh FILES .Bl -tag -width /usr/ports/security/openct -compact .It Pa /dev/cmx\fBn\fP Character device special file. .It Pa /usr/ports/security/openct OpenCT, a userspace smartcard daemon containing a .Em CCID driver which directly supports .Nm devices. .\".It Pa /usr/ports/devel/pcsc-lite .\"PC/SC-Lite, a userspace smartcard daemon. .\".It Pa /usr/ports/devel/libccid .\"libccid, a generic .\".Em CCID .\"driver for use by PC/SC-Lite to interface to .\".Nm .\"devices. .El .Sh COMPATIBILITY Userland smartcard code written for the vendor's Linux drivers should work with the .Nm driver without modification. .Sh SEE ALSO .Xr pccard 4 .Sh HISTORY The .Nm cmx driver first appeared in .Fx 7.1 . .Sh AUTHORS .An -nosplit The .Nm driver was written by .An Daniel Roethlisberger Aq Mt daniel@roe.ch , originally based on the Linux driver v1.1.0 by .An Omnikey GmbH Lk www.omnikey.com . Early testing and bug fixes by .An Marcin Cieslak Aq Mt saper@system.pl . .Sh BUGS .An -nosplit The way the .Nm driver talks to the CardMan 4040 is a bit rough. Due to the complete lack of hardware documentation other than vendor drivers for other operating systems, the gory details of the device's I/O registers are not understood very well. There may be error conditions which can only be solved by physically reinserting the reader. Index: stable/12/share/man/man4/fdc.4 =================================================================== --- stable/12/share/man/man4/fdc.4 (revision 365538) +++ stable/12/share/man/man4/fdc.4 (revision 365539) @@ -1,335 +1,338 @@ .\" .\" Copyright (c) 1994 Wilko Bulte .\" Copyright (c) 2001 Joerg Wunsch .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd April 7, 2017 .Dt FDC 4 .Os .Sh NAME .Nm fdc .Nd "PC architecture floppy disk controller driver" .Sh SYNOPSIS .Cd device fdc .Pp In .Pa /boot/device.hints : .Cd hint.fdc.0.at="isa" .Cd hint.fdc.0.port="0x3F0" .Cd hint.fdc.0.irq="6" .Cd hint.fdc.0.drq="2" .Cd hint.fdc.0.flags="0x0" .Cd hint.fd.0.at="fdc0" .Cd hint.fd.0.drive="0" .Cd hint.fd.0.flags="0x0" .Cd hint.fd.1.at="fdc0" .Cd hint.fd.1.drive="1" .Cd hint.fd.1.flags="0x0" .Sh DESCRIPTION .Ss Device Usage This driver provides access to floppy disk drives. Floppy disks using either FM (single-density) or MFM (double or high-density) recording can be handled. .Pp Floppy disk controllers can connect up to four drives each. The .Nm driver can currently handle up to two drives per controller (or four drives on ACPI). Upon driver initialization, an attempt is made to find out the type of the floppy controller in use. The known controller types are either the original NE765 or i8272 chips, or alternatively .Em enhanced controllers that are compatible with the NE72065 or i82077 chips. These enhanced controllers (among other enhancements) implement a FIFO for floppy data transfers that will automatically be enabled once an enhanced chip has been detected. This FIFO activation can be disabled using the per-controller flags value of .Ar 0x1 . .Pp By default, this driver creates a single device node .Pa /dev/fd Ns Ar N for each attached drive with number .Ar N . For historical reasons, device nodes that use a trailing UFS-style partition letter (ranging from .Sq a through .Sq h ) can also be accessed, which will be implemented as symbolic links to the main device node. .Pp Accessing the main device node will attempt to autodetect the density of the available medium for multi-density devices. Thus it is possible to use either a 720 KB medium or a 1440 KB medium in a high-density 3.5 inch standard floppy drive. Normally, this autodetection will only happen once at the first call to .Xr open 2 for the device after inserting the medium. This assumes the drive offers proper changeline support so media changes can be detected by the driver. To indicate a drive that does not have the changeline support, this can be overridden using the per-drive device flags value of .Ar 0x10 (causing each call to .Xr open 2 to perform the autodetection). .Pp When trying to use a floppy device with special-density media, other device nodes can be created, of the form .Pa /dev/fd Ns Ar N . Ns Ar MMMM , where .Ar N is the drive number, and .Ar MMMM is a number between one and four digits describing the device density. Up to 15 additional subdevices per drive can be created that way. The administrator is free to decide on a policy how to assign these numbers. The two common policies are to either implement subdevices numbered 1 through 15, or to use a number that describes the medium density in kilobytes. Initially, each of those devices will be configured to the maximal density that is possible for the drive type (like 1200 KB for 5.25 inch HD drives or 1440 KB for 3.5 inch HD drives). The desired density to be used on that subdevice needs to be configured using .Xr fdcontrol 8 . .Pp Drive types are configured using the lower four bits of the per-drive device flags. The following values can be specified: .Bl -tag -width 2n -offset indent .It Ar 1 5.25 inch double-density device with 40 cylinders (360 KB native capacity) .It Ar 2 5.25 inch high-density device with 80 cylinders (1200 KB native capacity) .It Ar 3 3.5 inch double-density device with 80 cylinders (720 KB native capacity) .It Ar 4 3.5 inch high-density device with 80 cylinders (1440 KB native capacity) .It Ar 5 3.5 inch extra-density device with 80 cylinders (2880 KB native capacity, usage currently restricted to at most 1440 KB media) .It Ar 6 Same as type 5, available for compatibility with some BIOSes .El .Pp On IA32 architectures, the drive type can be specified as 0 for the drives. In that case, the CMOS configuration memory will be consulted to obtain the value for that drive. The ACPI probe automatically determines these values via the _FDE and _FDI methods, but this can be overridden by specifying a drive type hint. .Pp Normally, each configured drive will be probed at initialization time, using a short seek sequence. This is intended to find out about drives that have been configured but are actually missing or otherwise not responding. (The ACPI probe method does not perform this seek.) In some environments (like laptops with detachable drives), it might be desirable to bypass this drive probe, and pretend a drive to be there so the driver autoconfiguration will work even if the drive is currently not present. For that purpose, a per-drive device flags value of .Ar 0x20 needs to be specified. .Ss Programming Interface In addition to the normal read and write functionality, the .Nm driver offers a number of configurable options using .Xr ioctl 2 . In order to access any of this functionality, programmers need to include the header file .In sys/fdcio.h into their programs. The call to .Xr open 2 can be performed in two possible ways. When opening the device without the .Dv O_NONBLOCK flag set, the device is opened in a normal way, which would cause the main device nodes to perform automatic media density selection, and which will yield a file descriptor that is fully available for any I/O operation or any of the following .Xr ioctl 2 commands. .Pp When opening the device with .Dv O_NONBLOCK set, automatic media density selection will be bypassed, and the device remains in a half-opened state. No actual I/O operations are possible, but many of the .Xr ioctl 2 commands described below can be performed. This mode is intended for access to the device without the requirement to have an accessible media present, like for status inquiries to the drive, or in order to format a medium. .Dv O_NONBLOCK needs to be cleared before I/O operations are possible on the descriptor, which requires a prior specification of the density using the .Dv FD_STYPE command (see below). Operations that are not allowed on the half-opened descriptor will cause an error value of .Er EAGAIN . .Pp The following .Xr ioctl 2 commands are currently available: .Bl -tag -width ".Dv FD_READID" .It Dv FD_FORM Used to format a floppy disk medium. Third argument is a pointer to a .Vt "struct fd_formb" specifying which track to format, and which parameters to fill into the ID fields of the floppy disk medium. .It Dv FD_GTYPE Returns the current density definition record for the selected device. Third argument is a pointer to .Vt "struct fd_type" . .It Dv FD_STYPE Adjusts the density definition of the selected device. Third argument is a pointer to .Vt "struct fd_type" . For the fixed-density subdevices (1 through 15 per drive), this operation is restricted to a process with superuser privileges. For the auto-selecting subdevice 0, the operation is temporarily allowed to any process, but this setting will be lost again upon the next autoselection. This can be used when formatting a new medium (which will require to open the device using .Dv O_NONBLOCK , and thus to later adjust the density using .Dv FD_STYPE ) . .It Dv FD_GOPTS Obtain the current drive options. Third argument is a pointer to .Vt int , containing a bitwise union of the following possible flag values: .Bl -tag -width ".Dv FDOPT_NOERRLOG" .It Dv FDOPT_NORETRY Do not automatically retry operations upon failure. .It Dv FDOPT_NOERRLOG Do not cause .Dq "hard error" kernel logs for failed I/O operations. .It Dv FDOPT_NOERROR Do not indicate I/O errors when returning from .Xr read 2 or .Xr write 2 system calls. The caller is assumed to use .Dv FD_GSTAT calls in order to inquire about the success of each operation. This is intended to allow even erroneous data from bad blocks to be retrieved using normal I/O operations. .It Dv FDOPT_AUTOSEL Device performs automatic density selection. Unlike the above flags, this one is read-only. .El .It Dv FD_SOPTS Set device options, see above for their meaning. Third argument is a pointer to .Vt int . Drive options will always be cleared when closing the descriptor. .It Dv FD_CLRERR Clear the internal low-level error counter. Normally, controller-level I/O errors are only logged up to .Dv FDC_ERRMAX errors (currently defined to 100). This command resets the counter. Requires superuser privileges. .It Dv FD_READID Read one sector ID field from the floppy disk medium. Third argument is a pointer to .Vt "struct fdc_readid" , where the read data will be returned. Can be used to analyze a floppy disk medium. .It Dv FD_GSTAT Return the recent floppy disk controller status, if available. Third argument is a pointer to .Vt "struct fdc_status" , where the status registers (ST0, ST1, ST2, C, H, R, and N) are being returned. .Er EINVAL will be caused if no recent status is available. .It Dv FD_GDTYPE Returns the floppy disk drive type. Third argument is a pointer to .Vt "enum fd_drivetype" . This type is the same as being used in the per-drive configuration flags, or in the CMOS configuration data or ACPI namespace on IA32 systems. .El +.Sh DEPRECATION NOTICE +The PC Card attachment of this driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh FILES .Bl -tag -width ".Pa /dev/fd*" -compact .It Pa /dev/fd* floppy disk device nodes .El .Sh SEE ALSO .Xr fdformat 1 , .Xr fdread 1 , .Xr fdwrite 1 , .Xr ioctl 2 , .Xr open 2 , .Xr read 2 , .Xr write 2 , .Xr fdcontrol 8 .Sh AUTHORS .An -nosplit This man page was initially written by .An Wilko Bulte , and later vastly rewritten by .An J\(:org Wunsch . Index: stable/12/share/man/man4/ndis.4 =================================================================== --- stable/12/share/man/man4/ndis.4 (revision 365538) +++ stable/12/share/man/man4/ndis.4 (revision 365539) @@ -1,153 +1,156 @@ .\" Copyright (c) 2003 .\" Bill Paul . All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by Bill Paul. .\" 4. Neither the name of the author nor the names of any co-contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd March 14, 2010 .Dt NDIS 4 .Os .Sh NAME .Nm ndis .Nd NDIS miniport driver wrapper .Sh SYNOPSIS .Cd "options NDISAPI" .Cd "device ndis" .Cd "device wlan" .Sh DESCRIPTION The .Nm driver is a wrapper designed to allow binary .Tn Windows\[rg] NDIS miniport network drivers to be used with .Fx . The .Nm driver is provided in source code form and must be combined with the .Tn Windows\[rg] driver supplied with your network adapter. The .Nm driver uses the .Nm ndisapi kernel subsystem to relocate and link the .Tn Windows\[rg] binary so that it can be used in conjunction with native code. The .Nm ndisapi subsystem provides an interface between the NDIS API and the .Fx networking infrastructure. The .Tn Windows\[rg] driver is essentially fooled into thinking it is running on .Tn Windows\[rg] . Note that this means the .Nm driver is only useful on x86 machines. .Pp To build a functional driver, the user must have a copy of the driver distribution media for his or her card. From this distribution, the user must extract two files: the .Pa .SYS file containing the driver binary code, and its companion .Pa .INF file, which contains the definitions for driver-specific registry keys and other installation data such as device identifiers. These two files can be converted into a kernel module file using the .Xr ndisgen 8 utility. This file contains a binary image of the driver plus registry key data. When the .Nm driver loads, it will create .Xr sysctl 3 nodes for each registry key extracted from the .Pa .INF file. .Pp The .Nm driver is designed to support mainly Ethernet and wireless network devices with PCI, PCMCIA and USB bus attachments. (Cardbus devices are also supported as a subset of PCI.) It can support many different media types and speeds. One limitation however, is that there is no consistent way to learn if an Ethernet device is operating in full or half duplex mode. The NDIS API allows for a generic means for determining link state and speed, but not the duplex setting. There may be driver-specific registry keys to control the media setting which can be configured via the .Xr sysctl 8 command. +.Sh DEPRECATION NOTICE +The PC Card attachment of this driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh DIAGNOSTICS .Bl -diag .It "ndis%d: watchdog timeout" A packet was queued for transmission and a transmit command was issued, however the device failed to acknowledge the transmission before a timeout expired. .El .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , .Xr netintro 4 , .Xr ng_ether 4 , .Xr ifconfig 8 , .Xr ndis_events 8 , .Xr ndiscvt 8 , .Xr ndisgen 8 , .Xr wpa_supplicant 8 .Rs .%T "NDIS 5.1 specification" .%U http://www.microsoft.com .Re .Sh HISTORY The .Nm device driver first appeared in .Fx 5.3 . .Sh AUTHORS The .Nm driver was written by .An Bill Paul Aq Mt wpaul@windriver.com . Index: stable/12/share/man/man4/ng_bt3c.4 =================================================================== --- stable/12/share/man/man4/ng_bt3c.4 (revision 365538) +++ stable/12/share/man/man4/ng_bt3c.4 (revision 365539) @@ -1,129 +1,132 @@ .\" Copyright (c) 2001-2002 Maksim Yevmenkin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $Id: ng_bt3c.4,v 1.3 2003/09/14 23:28:51 max Exp $ .\" $FreeBSD$ .\" .Dd December 17, 2004 .Dt NG_BT3C 4 .Os .Sh NAME .Nm ng_bt3c .Nd Netgraph node type that is also a 3Com Bluetooth PC card driver .Sh SYNOPSIS .In sys/types.h .In netgraph/bluetooth/include/ng_bt3c.h +.Sh DEPRECATION NOTICE +This driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh DESCRIPTION The .Nm btccc node type is both a persistent Netgraph node type and a driver for the 3Com Bluetooth PC card (3CRWB6096-HP). It implements a Bluetooth HCI UART transport layer as per chapter H4 of the Bluetooth Specification Book v1.1. A new node is created when the card is plugged. .Pp In order to use the card one .Em MUST download the firmware first. Due to copyright issues the firmware cannot be provided with this driver. The firmware can be obtained from the Windows driver package that can be downloaded from the 3Com web site at no charge. The firmware name is .Pa BT3CPCC.BIN . To load the firmware into the card, use .Xr bt3cfw 8 . I am using the original firmware that came with the card on CD-ROM. .Pp .Dl "MD5 (BT3CPCC.BIN) = 36170fda56ea9fdbf1702c966f8a97f1" .Pp The node has a single hook called .Dv hook . Incoming bytes received on the device are re-assembled into HCI frames (according to the length). Full HCI frames are sent out on the hook. HCI frames received on .Dv hook are transmitted out. No modification to the data is performed in either direction. .Sh HARDWARE The .Nm driver provides support for the 3Com/HP 3CRWB6096-A PCCARD bluetooth adapter. .Sh HOOKS This node type supports the following hooks: .Bl -tag -width ".Va hook" .It Va hook single HCI frame contained in single .Vt mbuf structure. .El .Sh CONTROL MESSAGES This node type supports the generic control messages, plus the following: .Bl -tag -width foo .It Dv NGM_BT3C_NODE_GET_STATE Pq Ic get_state Returns the current receiving state for the node. .It Dv NGM_BT3C_NODE_SET_DEBUG Pq Ic set_debug This command takes an integer argument and sets the current debug level for the node. .It Dv NGM_BT3C_NODE_GET_DEBUG Pq Ic get_debug Returns an integer containing the current debug level for the node. .It Dv NGM_BT3C_NODE_GET_QLEN Pq Ic get_qlen This command takes a parameter that specifies queue number and returns the current length of the queue for the node. .It Dv NGM_BT3C_NODE_SET_QLEN Pq Ic set_qlen This command takes two parameters that specify the queue number and the maximum length of the queue and sets the maximum length of the queue for the node. .It Dv NGM_BT3C_NODE_GET_STAT Pq Ic get_stat Returns various statistic information for the node, such as: number of bytes (frames) sent, number of bytes (frames) received and number of input (output) errors. .It Dv NGM_BT3C_NODE_RESET_STAT Pq Ic reset_stat Reset all statistic counters to zero. .It Dv NGM_BT3C_NODE_DOWNLOAD_FIRMWARE Download card firmware. .El .Sh SHUTDOWN This node shuts down when the corresponding card is un-plugged. .Sh SEE ALSO .Xr cardbus 4 , .Xr netgraph 4 , .Xr pccbb 4 , .Xr pcic 4 , .Xr pccard.conf 5 , .Xr bt3cfw 8 , .Xr ngctl 8 .Sh HISTORY The .Nm btccc node type was implemented in .Fx 5.0 . .Sh AUTHORS .An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS The driver is based on information obtained from .An Jose Orlando Pereira Aq Mt jop@di.uminho.pt and disassembled the W2K driver. Index: stable/12/share/man/man4/pccard.4 =================================================================== --- stable/12/share/man/man4/pccard.4 (revision 365538) +++ stable/12/share/man/man4/pccard.4 (revision 365539) @@ -1,81 +1,81 @@ .\" .\" Copyright (c) 2002 M. Warner Losh .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd August 18, 2020 .Dt PCCARD 4 .Os .Sh NAME .Nm pccard .Nd PC Card bus driver .Sh SYNOPSIS .Cd device pccard .Sh DEPRECATION NOTICE This driver is scheduled for removal prior to the release of -.Fx 13.0 +.Fx 13.0 . .Sh DESCRIPTION The .Nm driver implements the PC Card bus. The .Nm driver supports all PC Card bridges in the system. .Sh TUNABLES The driver supports the following tunable parameters, which may be added to .Pa /boot/loader.conf or set via the .Xr sysctl 8 command: .Bl -tag -width ".Cm hw.pccard.cis_debug" -compact .It Cm hw.pccard.debug Non-zero values cause more verbose information to be printed when a 16-bit PC Card is inserted or removed. .It Cm hw.pccard.cis_debug Non-zero value causes the CIS parsing of the 16-bit PC Card to be much more verbose and include a complete CIS dump. .El .Sh FILES .Bl -tag -width ".Pa /dev/pccard0.cis" -compact .It Pa /dev/pccard0.cis This exclusive-use device will report all the CIS chains present in a PC Card, if a 16-bit PC Card is inserted in the slot. Only one user at a time may access the CIS. The CIS is presented as the relevant byte stream from the PC Card. For CIS tuples in Attribute Memory (the default), only the even locations are presented (the ODD locations are undefined per the standard). For CIS tuples in Common Memory, every byte is presented to the user. Decoding of the CIS tuples is done via a userland program. All tuples are presented to the user. .El .Sh SEE ALSO .Xr cardbus 4 , .\" .Xr mecia 4 , .Xr pccbb 4 .\" .Xr tcic 4 .Rs .%T "PC Card Standard, Release 8" .Re Index: stable/12/share/man/man4/puc.4 =================================================================== --- stable/12/share/man/man4/puc.4 (revision 365538) +++ stable/12/share/man/man4/puc.4 (revision 365539) @@ -1,57 +1,60 @@ .\" Copyright (c) 2002 John Hay. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd January 24, 2008 .Dt PUC 4 .Os .Sh NAME .Nm puc .Nd PCI .Dq Universal Communications driver .Sh SYNOPSIS .Cd "device pci" .Cd "device puc" .Cd "device uart" .Cd "device ppc" .Sh DESCRIPTION This driver acts as a shim to connect PCI serial and parallel ports to the .Xr uart 4 and .Xr ppc 4 driver. .Pp The list of supported devices is in .Pa sys/dev/puc/pucdata.c . Support for new cards should be added there. +.Sh DEPRECATION NOTICE +The PC Card attachment of this driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh SEE ALSO .Xr ppc 4 , .Xr uart 4 .Sh HISTORY This driver took the idea from the .Nx .Nm driver. Index: stable/12/share/man/man4/uart.4 =================================================================== --- stable/12/share/man/man4/uart.4 (revision 365538) +++ stable/12/share/man/man4/uart.4 (revision 365539) @@ -1,301 +1,304 @@ .\" .\" Copyright (c) 2003 Marcel Moolenaar .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd April 26, 2017 .Dt UART 4 .Os .Sh NAME .Nm uart .Nd driver for Universal Asynchronous Receiver/Transmitter (UART) devices .Sh SYNOPSIS .Cd "device uart" .Pp .Cd "device puc" .Cd "device uart" .Pp .Cd "device scc" .Cd "device uart" .Pp In .Pa /boot/device.hints : .Cd hint.uart.0.disabled="1" .Cd hint.uart.0.baud="38400" .Cd hint.uart.0.port="0x3f8" .Cd hint.uart.0.flags="0x10" .Pp With .Ar flags encoded as: .Bl -tag -compact -width 0x000000 .It 0x00010 device is potential system console .It 0x00080 use this port for remote kernel debugging .It 0x00100 set RX FIFO trigger level to ``low'' (NS8250 only) .It 0x00200 set RX FIFO trigger level to ``medium low'' (NS8250 only) .It 0x00400 set RX FIFO trigger level to ``medium high'' (default, NS8250 only) .It 0x00800 set RX FIFO trigger level to ``high'' (NS8250 only) .El .\" .Sh DESCRIPTION The .Nm device driver provides support for various classes of UARTs implementing the EIA RS-232C (CCITT V.24) serial communications interface. Each such interface is controlled by a separate and independent instance of the .Nm driver. The primary support for devices that contain multiple serial interfaces or that contain other functionality besides one or more serial interfaces is provided by the .Xr puc 4 , or .Xr scc 4 device drivers. However, the serial interfaces of those devices that are managed by the .Xr puc 4 , or .Xr scc 4 driver are each independently controlled by the .Nm driver. As such, the .Xr puc 4 , or .Xr scc 4 driver provides umbrella functionality for the .Nm driver and hides the complexities that are inherent when elementary components are packaged together. .Pp The .Nm driver has a modular design to allow it to be used on differing hardware and for various purposes. In the following sections the components are discussed in detail. Options are described in the section that covers the component to which each option applies. .\" .Ss CORE COMPONENT At the heart of the .Nm driver is the core component. It contains the bus attachments and the low-level interrupt handler. .\" .Ss HARDWARE DRIVERS The core component and the kernel interfaces talk to the hardware through the hardware interface. This interface serves as an abstraction of the hardware and allows varying UARTs to be used for serial communications. .\" .Ss SYSTEM DEVICES System devices are UARTs that have a special purpose by way of hardware design or software setup. For example, Sun UltraSparc machines use UARTs as their keyboard interface. Such an UART cannot be used for general purpose communications. Likewise, when the kernel is configured for a serial console, the corresponding UART will in turn be a system device so that the kernel can output boot messages early on in the boot process. .\" .Ss KERNEL INTERFACES The last but not least of the components is the kernel interface. This component ultimately determines how the UART is made visible to the kernel in particular and to users in general. The default kernel interface is the TTY interface. This allows the UART to be used for terminals, modems and serial line IP applications. System devices, with the notable exception of serial consoles, generally have specialized kernel interfaces. .\" .Sh HARDWARE The .Nm driver supports the following classes of UARTs: .Pp .Bl -bullet -compact .It NS8250: standard hardware based on the 8250, 16450, 16550, 16650, 16750 or the 16950 UARTs. .It SCC: serial communications controllers supported by the .Xr scc 4 device driver. .El .\" .Sh Pulse Per Second (PPS) Timing Interface The .Nm driver can capture PPS timing information as defined in RFC 2783. The API, accessed via .Xr ioctl 2 , is available on the tty device. To use the PPS capture feature with .Xr ntpd 8 , symlink the tty callout device .Va /dev/cuau? to .Va /dev/pps0. .Pp The .Va hw.uart.pps_mode tunable configures the PPS capture mode for all uart devices; it can be set in .Xr loader.conf 5 . The .Va dev.uart.0.pps_mode sysctl configures the PPS capture mode for a specific uart device; it can be set in .Xr loader.conf 5 or .Xr sysctl.conf 5 . .Pp The following capture modes are available: .Bl -tag -compact -offset "mmmm" -width "mmmm" .It 0x00 Capture disabled. .It 0x01 Capture pulses on the CTS line. .It 0x02 Capture pulses on the DCD line. .El .Pp The following values may be ORed with the capture mode to configure capture processing options: .Bl -tag -compact -offset "mmmm" -width "mmmm" .It 0x10 Invert the pulse (RS-232 logic low = ASSERT, high = CLEAR). .It 0x20 Attempt to capture narrow pulses. .El .Pp Add the narrow pulse option when the incoming PPS pulse width is small enough to prevent reliable capture in normal mode. In narrow mode the driver uses the hardware's ability to latch a line state change; not all hardware has this capability. The hardware latch provides a reliable indication that a pulse occurred, but prevents distinguishing between the CLEAR and ASSERT edges of the pulse. For each detected pulse, the driver synthesizes both an ASSERT and a CLEAR event, using the same timestamp for each. To prevent spurious events when the hardware is intermittently able to see both edges of a pulse, the driver will not generate a new pair of events within a half second of the prior pair. Both normal and narrow pulse modes work with .Xr ntpd 8 . .Pp Add the invert option when the connection to the uart device uses TTL level signals, or when the PPS source emits inverted pulses. RFC 2783 defines an ASSERT event as a higher-voltage line level, and a CLEAR event as a lower-voltage line level, in the context of the RS-232 protocol. The modem control signals on a TTL-level connection are typically inverted from the RS-232 levels. For example, carrier presence is indicated by a high signal on an RS-232 DCD line, and by a low signal on a TTL DCD line. This is due to the use of inverting line driver buffers to convert between TTL and RS-232 line levels in most hardware designs. Generally speaking, a connection to a DB-9 style connector is an RS-232 level signal at up to 12 volts. A connection to header pins or an edge-connector on an embedded board is typically a TTL signal at 3.3 or 5 volts. .Sh Special Devices The .Nm driver also supports an initial-state and a lock-state control device for each of the callin and the callout "data" devices. The termios settings of a data device are copied from those of the corresponding initial-state device on first opens and are not inherited from previous opens. Use .Xr stty 1 in the normal way on the initial-state devices to program initial termios states suitable for your setup. .Pp The lock termios state acts as flags to disable changing the termios state. E.g., to lock a flag variable such as CRTSCTS, use .Em stty crtscts on the lock-state device. Speeds and special characters may be locked by setting the corresponding value in the lock-state device to any nonzero value. E.g., to lock a speed to 115200, use .Dq Li stty 115200 on the initial-state device and .Dq Li stty 1 on the lock-state device. .Pp Correct programs talking to correctly wired external devices work with almost arbitrary initial states and almost no locking, but other setups may benefit from changing some of the default initial state and locking the state. In particular, the initial states for non (POSIX) standard flags should be set to suit the devices attached and may need to be locked to prevent buggy programs from changing them. E.g., CRTSCTS should be locked on for devices that support RTS/CTS handshaking at all times and off for devices that do not support it at all. CLOCAL should be locked on for devices that do not support carrier. HUPCL may be locked off if you do not want to hang up for some reason. In general, very bad things happen if something is locked to the wrong state, and things should not be locked for devices that support more than one setting. The CLOCAL flag on callin ports should be locked off for logins to avoid certain security holes, but this needs to be done by getty if the callin port is used for anything else. +.Sh DEPRECATION NOTICE +The PC Card attachment of this driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh FILES .Bl -tag -width "/dev/ttyu?.init" -compact .It Pa /dev/ttyu? for callin ports .It Pa /dev/ttyu?.init .It Pa /dev/ttyu?.lock corresponding callin initial-state and lock-state devices .Pp .It Pa /dev/cuau? for callout ports .It Pa /dev/cuau?.init .It Pa /dev/cuau?.lock corresponding callout initial-state and lock-state devices .El .Sh SEE ALSO .Xr puc 4 , .Xr scc 4 .\" .Sh HISTORY The .Nm device driver first appeared in .Fx 5.2 . .Sh AUTHORS The .Nm device driver and this manual page were written by .An Marcel Moolenaar Aq Mt marcel@xcllnt.net . Index: stable/12/share/man/man4/wi.4 =================================================================== --- stable/12/share/man/man4/wi.4 (revision 365538) +++ stable/12/share/man/man4/wi.4 (revision 365539) @@ -1,377 +1,380 @@ .\" Copyright (c) 1997, 1998, 1999 .\" Bill Paul . All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by Bill Paul. .\" 4. Neither the name of the author nor the names of any co-contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" $OpenBSD: wi.4tbl,v 1.14 2002/04/29 19:53:50 jsyn Exp $ .\" .Dd July 23, 2011 .Dt WI 4 .Os .Sh NAME .Nm wi .Nd "Lucent Hermes, and Intersil PRISM IEEE 802.11 driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device wi" .Cd "device wlan" .Ed .Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent if_wi_load="YES" .Ed +.Sh DEPRECATION NOTICE +This driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh DESCRIPTION The .Nm driver provides support for 802.11b wireless network adapters based around the Lucent Hermes, Intersil PRISM-II, Intersil PRISM-2.5, and Intersil Prism-3 chipsets. All chipsets provide a similar interface to the driver. Only the Intersil chipsets support access point operation or WPA. Very old versions of firmware are not supported at all. Older versions of the firmware that are supported may severely limit the ability to use these cards in newer networks. Only relatively recent versions of Intersil firmware supports WPA. See CAVEATS for details. All host/device interaction is via programmed I/O, even on those cards that support a DMA interface. .Pp For more information on configuring this device, see .Xr ifconfig 8 . .Pp .Nm supports .Cm station , .Cm adhoc , .Cm adhoc-demo , .Cm hostap , and .Cm monitor mode operation. Only one virtual interface may be configured at a time. For more information on configuring this device, see .Xr ifconfig 8 . .Pp Cards supported by the .Nm driver come in a variety of packages, though the most common are of the PCMCIA type. In many cases, the PCI version of a wireless card is simply a PCMCIA card bundled with a PCI adapter. The PCI adapters come in two flavors: true PCMCIA bridges and dumb PCMCIA bridges. A true PCMCIA bridge (such as those sold by Lucent) will attach as a real PCMCIA controller. The wireless card will then attach to the PCMCIA bus. Wireless cards in PCMCIA slots may be inserted and ejected on the fly. .Pp A dumb bridge, on the other hand, does not show up as a true PCMCIA bus. The wireless card will simply appear to the host as a normal PCI device and will not require any PCMCIA support. Cards in this type of adapter should only be removed when the machine is powered down. .Pp The following cards are among those supported by the .Nm driver: .Pp .Bl -column -compact "Linksys Instant Wireless WPC11 2.5" "Spectrum24" "PCI or PCMCIA" .Em "Card Chip Bus" 3Com AirConnect 3CRWE777A Prism-II PCI Accton airDirect WN3301 PCMCIA ACTIONTEC HWC01170 Prism-2.5 PCMCIA Adaptech ANW-8030 Prism-3 PCMCIA Addtron AWP-100 Prism-II PCMCIA Adtec Adlink/340C Prism-II PCMCIA Airvast WN 100 Prism-3 PCMCIA Airway 802.11 Adapter PCMCIA Agere Orinoco Hermes PCMCIA Allied Telesis WR211PCM Prism-II PCMCIA ArTem OnAir Prism? PCMCIA Asus WL100 Prism-2.5 PCMCIA Avaya Wireless Prism-II PCMCIA Bay eMobility 11B Prism-2.5? PCMCIA Blue Concentric Circle WL-379F Prism-II CF BreezeNet Wireless Prism-II PCMCIA Buffalo WLI-PCM-S11 Prism-II PCMCIA Buffalo WLI-PCM-L11G Hermes PCMCIA Buffalo WLI-CF-S11G Prism-II CF Buffalo WLI2-CF-S11G Prism 2.5 CF Cabletron RoamAbout Hermes PCMCIA Compaq Agency NC5004 Prism-II PCMCIA Compaq WL100 Prism-II PCMCIA Compaq WL110 Hermes PCMCIA Compaq WL200 Prism-II PCMCIA Contec FLEXLAN/FX-DS110-PCC Prism-II PCMCIA Corega PCC-11 Prism-II PCMCIA Corega PCCA-11 Prism-II PCMCIA Corega PCCB-11 Prism-II PCMCIA Corega CGWLPCIA11 Prism-II PCI Dell TrueMobile 1150 Hermes PCMCIA Dlink Air 660 Prism-II PCMCIA Dlink DWL520 Prism-2.5 PCI Dlink DWL650 Prism-2.5 PCMCIA ELECOM Air@Hawk/LD-WL11/PCC PCMCIA ELSA MC-11 PCMCIA ELSA XI300 Prism-II PCMCIA ELSA XI325 Prism-2.5 PCMCIA ELSA APDL325 Prism-2.5 PCMCIA ELSA XI330 Prism-3 PCMCIA ELSA XI800 Prism-II CF EMTAC A2424i Prism-II PCMCIA Farallon Skyline Prism-II PCMCIA Gemtek WL-311 Prism-2.5 PCMCIA Hawking Technology WE110P Prism-2.5 PCMCIA Home Wireless Networks Prism-II PCMCIA IBM High Rate Wireless Hermes PCMCIA ICOM SL-1100 Prism-II PCMCIA I-O DATA WN-B11/PCM Prism-II PCMCIA Intersil Prism II Prism-II PCMCIA Intersil Mini-PCI Prism-2.5 PCI Intersil ISL37100P Prism-3 PCMCIA Intersil ISL37110P Prism-3 PCMCIA Intersil ISL37300P Prism-3 PCMCIA Laneed Wireless PCMCIA Linksys Instant Wireless WPC11 Prism-II PCMCIA Linksys Instant Wireless WPC11 2.5 Prism-2.5 PCMCIA Linksys Instant Wireless WPC11 3.0 Prism-3 PCMCIA Linksys WCF11 Prism-3 PCMCIA Linksys WCF12 Prism-3 CF Lucent WaveLAN Hermes PCMCIA Melco Airconnect Prism-II PCMCIA Microsoft MN-520 WLAN Prism-II PCMCIA NANOSPEED ROOT-RZ2000 Prism-II PCMCIA NCR WaveLAN/IEEE 802.11 PCMCIA NDC/Sohoware NCP130 Prism-II PCI NEC CMZ-RT-WP Prism-II PCMCIA NEC PK-WL001 Lucent PCMCIA NEC PC-WL/11C Prism-II PCMCIA Netgear MA311 Prism-2.5 PCI Netgear MA401 Prism-II/2.5 PCMCIA Netgear MA401RA Prism-II PCMCIA Netgear MA701 Prism-II CF NOKIA C020 WLAN Prism-II PCMCIA NOKIA C110 WLAN Prism-2.5 PCMCIA NTT-ME 11Mbps Wireless LAN Prism-II PCMCIA Planex GeoWave/GW-NS110 Prism-II PCMCIA Planex GW-NS11H Prism-II PCMCIA Proxim Harmony Prism-II PCMCIA Proxim RangeLAN-DS Prism-II PCMCIA Samsung MagicLAN SWL-2000N Prism-II PCMCIA SENAO SL-2511CD Prism-3 PCMCIA Siemens SpeedStream SS1021 Prism-II PCMCIA Siemens SpeedStream SS1021 Prism-3 PCMCIA SMC 2532W-B Prism-II PCMCIA SMC 2602 EZ Connect (3.3V) Prism-II PCI or PCMCIA SMC 2632 EZ Connect Prism-II PCMCIA Socket Low Power WLAN-CF Prism-II CF Sony PCWA-C100 Lucent PCMCIA Sony PEGA-WL110 Prism-2.5 PCMCIA TDK LAK-CD011WL Prism-II PCMCIA Toshiba Wireless LAN Card Prism-II PCMCIA U.S.\& Robotics Wireless Card 2410 Prism-II PCMCIA YIS YWL-11B Prism-II PCMCIA .El .Pp Several vendors sell PCI adapters built around the PLX Technology 9050 or 9052 chip. The following such adapters are supported or expected to work: .Pp .Bl -item -compact .It 3Com AirConnect 3CRWE777A (3.3V) .It Belkin F5D6000 (a rebadged WL11000P) .It Eumitcom WL11000P .It Global Sun Technology GL24110P (untested) .It Global Sun Technology GL24110P02 .It LinkSys WDT11 (a rebadged GL24110P02) .It Netgear MA301 .It US Robotics 2415 (rebadged WL11000P) .It Wisecom Wireless LAN PCI Adapter .El .Pp The following adapters have the same model numbers as those listed above, but might not work if the actual card is after the change away from the Prism family: .Pp .Bl -item -compact .It DLink DWL520 .El .Sh EXAMPLES Join an existing BSS network (ie: connect to an access point): .Bd -literal -offset indent ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e netmask 0xffffff00 .Ed .Pp Join a specific BSS network with network name .Dq Li my_net : .Bd -literal -offset indent ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e netmask 0xffffff00 ssid my_net .Ed .Pp Join a specific BSS network with WEP encryption: .Bd -literal -offset indent ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e netmask 0xffffff00 ssid my_net \e wepmode on wepkey 0x8736639624 weptxkey 1 .Ed .Pp Join a Lucent legacy demo ad-hoc network with network name .Dq Li my_net : .Bd -literal -offset indent ifconfig wlan create wlandev wi0 wlanmode ahdemo \e inet 192.168.0.20 netmask 0xffffff00 ssid my_net .Ed .Pp Join/create an IBSS network with network name .Dq Li my_net : .Bd -literal -offset indent ifconfig wlan create wlandev wi0 wlanmode adhoc wi0 \e inet 192.168.0.22 netmask 0xffffff00 ssid my_net .Ed .Pp Create a host-based access point (Prism only): .Bd -literal -offset indent ifconfig wlan create wlandev wi0 wlanmode hostap \e inet 192.168.0.10 netmask 0xffffff00 ssid my_ap .Ed .Pp Create a host-based access point with WEP enabled (Prism only) and plumb it into bridge to fxp0: .Bd -literal -offset indent ifconfig wlan0 create wlandev wi0 wlanmode hostap \e inet 192.168.0.10 netmask 0xffffff00 ssid my_ap \e wepmode on wepkey 0x1234567890 weptxkey 1 ifconfig bridge0 create ifconfig bridge0 addm wlan0 addm fxp0 up .Ed .Pp This will give you the same functionality as an access point. .Sh DIAGNOSTICS .Bl -diag .It "wi%d: init failed" The WaveLAN card failed to become ready after an initialization command was issued. .It "wi%d: failed to allocate %d bytes on NIC" The driver was unable to allocate memory for transmit frames in the NIC's on-board RAM. This can also be an indication of an incorrectly configured interrupt. .It "wi%d: device timeout" The WaveLAN card failed to generate an interrupt to acknowledge a transmit command. .El .Sh SEE ALSO .Xr intro 4 , .Xr pccard 4 , .Xr pccbb 4 , .Xr pcic 4 , .Xr wlan 4 , .Xr wlan_ccmp 4 , .Xr wlan_tkip 4 , .Xr wlan_wep 4 , .Xr wlan_xauth 4 , .Xr hostapd 8 , .Xr ifconfig 8 , .Xr wpa_supplicant 8 . .Rs .%T HCF Light programming specification .%U http://web.archive.org/web/20040130141721/http://wavelan.com/ .Re .Sh HISTORY The .Nm device driver first appeared in .Fx 3.0 . .Sh AUTHORS The original .Nm driver was written by .An Bill Paul Aq Mt wpaul@ctr.columbia.edu . This man page comes from .Ox . .Sh CAVEATS The driver will reject devices with old firmware to avoid dealing with numerous defects. Unfortunately the driver does not support downloading new firmware to the card so if new firmware is needed users will have to boot a different system to accomplish this. .Pp Intersil Prism cards must have firmware versions 0.8.0 or later and version 1.7.0 or later are required to support functionality such as WPA. Some users of Prism-II and 2.5 based cards report that station firmware version 1.3.4 works better for them in hostap than 1.4.9. Older versions of the Prism station firmware have a number of issues with hostap mode. The IBSS/adhoc mode appears to work well on station firmware 1.3.1 and later. The IBSS/adhoc mode appears to have problems for some people with older versions of station firmware. .Pp Lucent cards prior to firmware version 6.0.6 do not implement IBSS mode and are not supported. .Pp Prior versions of .Nm supported Symbol firmware. That support has been removed due to persistent problems with this firmware as well as getting proper documentation on this firmware. .Pp Hermes 2 and Hermes 3 chips are not supported by this driver. .Pp Here's the above requirements in the form of a table .Pp .Bl -column -compact "Prims II/2.5" "xxxxxxxx" "xxxxxxxx" "xxxxxxxx" "xxxxxxxx" .Em "Firmware Minimum WPA Host AP Adhoc/IBSS" Prism II/2.5 0.8.0 1.7.0 1.3.4 1.3.1 Prism 3 0.8.0 1.7.0 1.4.9 1.3.1 Hermes 6.0.6 none none 6.0.6 Symbol none none none none .El .Sh BUGS Not all the new messages are documented here, and many of them are indications of transient errors that are not indications of serious problems. Index: stable/12/sys/dev/an/if_an_pccard.c =================================================================== --- stable/12/sys/dev/an/if_an_pccard.c (revision 365538) +++ stable/12/sys/dev/an/if_an_pccard.c (revision 365539) @@ -1,160 +1,162 @@ /*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Bill Paul. * 4. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* * Aironet 4500/4800 802.11 PCMCIA/ISA/PCI driver for FreeBSD. * * Written by Bill Paul * Electrical Engineering Department * Columbia University, New York City */ #include __FBSDID("$FreeBSD$"); #include "opt_inet.h" #ifdef INET #define ANCACHE #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "pccarddevs.h" #include "card_if.h" /* * Support for PCMCIA cards. */ static int an_pccard_probe(device_t); static int an_pccard_attach(device_t); static device_method_t an_pccard_methods[] = { /* Device interface */ DEVMETHOD(device_probe, an_pccard_probe), DEVMETHOD(device_attach, an_pccard_attach), DEVMETHOD(device_detach, an_detach), DEVMETHOD(device_shutdown, an_shutdown), { 0, 0 } }; static driver_t an_pccard_driver = { "an", an_pccard_methods, sizeof(struct an_softc) }; static devclass_t an_pccard_devclass; DRIVER_MODULE(an, pccard, an_pccard_driver, an_pccard_devclass, 0, 0); MODULE_DEPEND(an, wlan, 1, 1, 1); static const struct pccard_product an_pccard_products[] = { PCMCIA_CARD(AIRONET, PC4800), PCMCIA_CARD(AIRONET, PC4500), PCMCIA_CARD(AIRONET, 350), PCMCIA_CARD(XIRCOM, CWE1130), { NULL } }; PCCARD_PNP_INFO(an_pccard_products); static int an_pccard_probe(device_t dev) { const struct pccard_product *pp; if ((pp = pccard_product_lookup(dev, an_pccard_products, sizeof(an_pccard_products[0]), NULL)) != NULL) { if (pp->pp_name != NULL) device_set_desc(dev, pp->pp_name); return (0); } return (ENXIO); } static int an_pccard_attach(device_t dev) { struct an_softc *sc = device_get_softc(dev); int flags = device_get_flags(dev); int error; error = an_probe(dev); /* 0 is failure for now */ if (error == 0) { error = ENXIO; goto fail; } error = an_alloc_irq(dev, 0, 0); if (error != 0) goto fail; an_alloc_irq(dev, sc->irq_rid, 0); error = an_attach(sc, flags); if (error) goto fail; /* * Must setup the interrupt after the an_attach to prevent racing. */ error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET, NULL, an_intr, sc, &sc->irq_handle); fail: if (error) an_release_resources(dev); + else + gone_in_dev(dev, 13, "pccard removed"); return (error); } Index: stable/12/sys/dev/ata/ata-card.c =================================================================== --- stable/12/sys/dev/ata/ata-card.c (revision 365538) +++ stable/12/sys/dev/ata/ata-card.c (revision 365539) @@ -1,188 +1,189 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1998 - 2008 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer, * without modification, immediately at the beginning of the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "pccarddevs.h" static const struct pccard_product ata_pccard_products[] = { PCMCIA_CARD(FREECOM, PCCARDIDE), PCMCIA_CARD(EXP, EXPMULTIMEDIA), PCMCIA_CARD(IODATA3, CBIDE2), PCMCIA_CARD(OEM2, CDROM1), PCMCIA_CARD(OEM2, IDE), PCMCIA_CARD(PANASONIC, KXLC005), PCMCIA_CARD(TEAC, IDECARDII), {NULL} }; static int ata_pccard_probe(device_t dev) { const struct pccard_product *pp; u_int32_t fcn = PCCARD_FUNCTION_UNSPEC; int error = 0; if ((error = pccard_get_function(dev, &fcn))) return error; /* if it says its a disk we should register it */ if (fcn == PCCARD_FUNCTION_DISK) return 0; /* match other devices here, primarily cdrom/dvd rom */ if ((pp = pccard_product_lookup(dev, ata_pccard_products, sizeof(ata_pccard_products[0]), NULL))) { if (pp->pp_name) device_set_desc(dev, pp->pp_name); return 0; } return ENXIO; } static int ata_pccard_attach(device_t dev) { struct ata_channel *ch = device_get_softc(dev); struct resource *io, *ctlio; int i, rid, err; uint16_t funce; if (ch->attached) return (0); ch->attached = 1; /* allocate the io range to get start and length */ rid = ATA_IOADDR_RID; if (!(io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, ATA_IOSIZE, RF_ACTIVE))) return (ENXIO); /* setup the resource vectors */ for (i = ATA_DATA; i <= ATA_COMMAND; i++) { ch->r_io[i].res = io; ch->r_io[i].offset = i; } ch->r_io[ATA_IDX_ADDR].res = io; /* * if we got more than the default ATA_IOSIZE ports, this is a device * where ctlio is located at offset 14 into "normal" io space. */ if (rman_get_size(io) > ATA_IOSIZE) { ch->r_io[ATA_CONTROL].res = io; ch->r_io[ATA_CONTROL].offset = 14; } else { rid = ATA_CTLADDR_RID; if (!(ctlio = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, ATA_CTLIOSIZE, RF_ACTIVE))) { bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); for (i = ATA_DATA; i < ATA_MAX_RES; i++) ch->r_io[i].res = NULL; return (ENXIO); } ch->r_io[ATA_CONTROL].res = ctlio; ch->r_io[ATA_CONTROL].offset = 0; } ata_default_registers(dev); /* initialize softc for this channel */ ch->unit = 0; ch->flags |= ATA_USE_16BIT; funce = 0; /* Default to sane setting of FUNCE */ pccard_get_funce_disk(dev, &funce); if (!(funce & PFD_I_D)) ch-> flags |= ATA_NO_SLAVE; ata_generic_hw(dev); err = ata_probe(dev); if (err > 0) return (err); + gone_in_dev(dev, 13, "pccard removed"); return (ata_attach(dev)); } static int ata_pccard_detach(device_t dev) { struct ata_channel *ch = device_get_softc(dev); int i; if (!ch->attached) return (0); ch->attached = 0; ata_detach(dev); if (ch->r_io[ATA_CONTROL].res != ch->r_io[ATA_DATA].res) bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ch->r_io[ATA_CONTROL].res); bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ch->r_io[ATA_DATA].res); for (i = ATA_DATA; i < ATA_MAX_RES; i++) ch->r_io[i].res = NULL; return 0; } static device_method_t ata_pccard_methods[] = { /* device interface */ DEVMETHOD(device_probe, ata_pccard_probe), DEVMETHOD(device_attach, ata_pccard_attach), DEVMETHOD(device_detach, ata_pccard_detach), DEVMETHOD_END }; static driver_t ata_pccard_driver = { "ata", ata_pccard_methods, sizeof(struct ata_channel), }; DRIVER_MODULE(ata, pccard, ata_pccard_driver, ata_devclass, NULL, NULL); MODULE_DEPEND(ata, ata, 1, 1, 1); PCCARD_PNP_INFO(ata_pccard_products); Index: stable/12/sys/dev/cmx/cmx_pccard.c =================================================================== --- stable/12/sys/dev/cmx/cmx_pccard.c (revision 365538) +++ stable/12/sys/dev/cmx/cmx_pccard.c (revision 365539) @@ -1,117 +1,117 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2006-2007 Daniel Roethlisberger * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "pccarddevs.h" static const struct pccard_product cmx_pccard_products[] = { PCMCIA_CARD(OMNIKEY, CM4040), { NULL } }; /* * Probe for the card. */ static int cmx_pccard_probe(device_t dev) { const struct pccard_product *pp; if ((pp = pccard_product_lookup(dev, cmx_pccard_products, sizeof(cmx_pccard_products[0]), NULL)) != NULL) { if (pp->pp_name != NULL) device_set_desc(dev, pp->pp_name); return 0; } return EIO; } /* * Attach to the pccard, and call bus independent attach and * resource allocation routines. */ static int cmx_pccard_attach(device_t dev) { int rv = 0; cmx_init_softc(dev); if ((rv = cmx_alloc_resources(dev)) != 0) { device_printf(dev, "cmx_alloc_resources() failed!\n"); cmx_release_resources(dev); return rv; } if ((rv = cmx_attach(dev)) != 0) { device_printf(dev, "cmx_attach() failed!\n"); cmx_release_resources(dev); return rv; } - device_printf(dev, "attached\n"); + gone_in_dev(dev, 13, "pccard removed"); return 0; } static device_method_t cmx_pccard_methods[] = { DEVMETHOD(device_probe, cmx_pccard_probe), DEVMETHOD(device_attach, cmx_pccard_attach), DEVMETHOD(device_detach, cmx_detach), { 0, 0 } }; static driver_t cmx_pccard_driver = { "cmx", cmx_pccard_methods, sizeof(struct cmx_softc), }; DRIVER_MODULE(cmx, pccard, cmx_pccard_driver, cmx_devclass, 0, 0); PCCARD_PNP_INFO(cmx_pccard_products); Index: stable/12/sys/dev/fdc/fdc_pccard.c =================================================================== --- stable/12/sys/dev/fdc/fdc_pccard.c (revision 365538) +++ stable/12/sys/dev/fdc/fdc_pccard.c (revision 365539) @@ -1,146 +1,147 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2004-2005 M. Warner Losh. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include "pccarddevs.h" static int fdc_pccard_probe(device_t); static int fdc_pccard_attach(device_t); static const struct pccard_product fdc_pccard_products[] = { PCMCIA_CARD(YEDATA, EXTERNAL_FDD), { NULL } }; static int fdc_pccard_alloc_resources(device_t dev, struct fdc_data *fdc) { struct resource *res; int rid, i; rid = 0; res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); if (res == NULL) { device_printf(dev, "cannot alloc I/O port range\n"); return (ENXIO); } for (i = 0; i < FDC_MAXREG; i++) { fdc->resio[i] = res; fdc->ridio[i] = rid; fdc->ioff[i] = i; fdc->ioh[i] = rman_get_bushandle(res); } fdc->iot = rman_get_bustag(res); fdc->rid_irq = 0; fdc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &fdc->rid_irq, RF_ACTIVE | RF_SHAREABLE); if (fdc->res_irq == NULL) { device_printf(dev, "cannot reserve interrupt line\n"); return (ENXIO); } return (0); } static int fdc_pccard_probe(device_t dev) { if (pccard_product_lookup(dev, fdc_pccard_products, sizeof(fdc_pccard_products[0]), NULL) != NULL) { device_set_desc(dev, "PC Card Floppy"); return (0); } return (ENXIO); } static int fdc_pccard_attach(device_t dev) { int error; struct fdc_data *fdc; device_t child; fdc = device_get_softc(dev); fdc->flags = FDC_NODMA | FDC_NOFAST; fdc->fdct = FDC_NE765; error = fdc_pccard_alloc_resources(dev, fdc); if (error == 0) error = fdc_attach(dev); if (error == 0) { child = fdc_add_child(dev, "fd", -1); device_set_flags(child, 0x24); error = bus_generic_attach(dev); } - if (error == 0) + if (error == 0) { + gone_in_dev(dev, 13, "pccard removed"); fdc_start_worker(dev); - else + } else fdc_release_resources(fdc); return (error); } static device_method_t fdc_pccard_methods[] = { /* Device interface */ DEVMETHOD(device_probe, fdc_pccard_probe), DEVMETHOD(device_attach, fdc_pccard_attach), DEVMETHOD(device_detach, fdc_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ DEVMETHOD(bus_print_child, fdc_print_child), DEVMETHOD(bus_read_ivar, fdc_read_ivar), DEVMETHOD(bus_write_ivar, fdc_write_ivar), /* Our children never use any other bus interface methods. */ { 0, 0 } }; static driver_t fdc_pccard_driver = { "fdc", fdc_pccard_methods, sizeof(struct fdc_data) }; DRIVER_MODULE(fdc, pccard, fdc_pccard_driver, fdc_devclass, 0, 0); PCCARD_PNP_INFO(fdc_pccard_products); Index: stable/12/sys/dev/if_ndis/if_ndis_pccard.c =================================================================== --- stable/12/sys/dev/if_ndis/if_ndis_pccard.c (revision 365538) +++ stable/12/sys/dev/if_ndis/if_ndis_pccard.c (revision 365539) @@ -1,335 +1,337 @@ /*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 2003 * Bill Paul . All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Bill Paul. * 4. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "card_if.h" MODULE_DEPEND(ndis, pccard, 1, 1, 1); static int ndis_probe_pccard (device_t); static int ndis_attach_pccard (device_t); static int ndis_detach_pccard (device_t); static struct resource_list *ndis_get_resource_list (device_t, device_t); static int ndis_devcompare (interface_type, struct ndis_pccard_type *, device_t); extern int ndisdrv_modevent (module_t, int, void *); extern int ndis_attach (device_t); extern int ndis_shutdown (device_t); extern int ndis_detach (device_t); extern int ndis_suspend (device_t); extern int ndis_resume (device_t); extern unsigned char drv_data[]; static device_method_t ndis_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ndis_probe_pccard), DEVMETHOD(device_attach, ndis_attach_pccard), DEVMETHOD(device_detach, ndis_detach_pccard), DEVMETHOD(device_shutdown, ndis_shutdown), DEVMETHOD(device_suspend, ndis_suspend), DEVMETHOD(device_resume, ndis_resume), /* Bus interface. */ /* * This is an awful kludge, but we need it becase pccard * does not implement a bus_get_resource_list() method. */ DEVMETHOD(bus_get_resource_list, ndis_get_resource_list), { 0, 0 } }; static driver_t ndis_driver = { "ndis", ndis_methods, sizeof(struct ndis_softc) }; static devclass_t ndis_devclass; DRIVER_MODULE(ndis, pccard, ndis_driver, ndis_devclass, ndisdrv_modevent, 0); static int ndis_devcompare(bustype, t, dev) interface_type bustype; struct ndis_pccard_type *t; device_t dev; { const char *prodstr, *vendstr; int error; if (bustype != PCMCIABus) return(FALSE); error = pccard_get_product_str(dev, &prodstr); if (error) return(FALSE); error = pccard_get_vendor_str(dev, &vendstr); if (error) return(FALSE); while(t->ndis_name != NULL) { if (strcasecmp(vendstr, t->ndis_vid) == 0 && strcasecmp(prodstr, t->ndis_did) == 0) { device_set_desc(dev, t->ndis_name); return(TRUE); } t++; } return(FALSE); } /* * Probe for an NDIS device. Check the PCI vendor and device * IDs against our list and return a device name if we find a match. */ static int ndis_probe_pccard(dev) device_t dev; { driver_object *drv; struct drvdb_ent *db; drv = windrv_lookup(0, "PCCARD Bus"); if (drv == NULL) return(ENXIO); db = windrv_match((matchfuncptr)ndis_devcompare, dev); if (db != NULL) { /* Create PDO for this device instance */ windrv_create_pdo(drv, dev); return(0); } return(ENXIO); } #define NDIS_AM_RID 3 static int ndis_alloc_amem(struct ndis_softc *sc) { int error, rid; rid = NDIS_AM_RID; sc->ndis_res_am = bus_alloc_resource_anywhere(sc->ndis_dev, SYS_RES_MEMORY, &rid, 0x1000, RF_ACTIVE); if (sc->ndis_res_am == NULL) { device_printf(sc->ndis_dev, "failed to allocate attribute memory\n"); return(ENXIO); } sc->ndis_rescnt++; resource_list_add(&sc->ndis_rl, SYS_RES_MEMORY, rid, rman_get_start(sc->ndis_res_am), rman_get_end(sc->ndis_res_am), rman_get_size(sc->ndis_res_am)); error = CARD_SET_MEMORY_OFFSET(device_get_parent(sc->ndis_dev), sc->ndis_dev, rid, 0, NULL); if (error) { device_printf(sc->ndis_dev, "CARD_SET_MEMORY_OFFSET() returned 0x%x\n", error); return(error); } error = CARD_SET_RES_FLAGS(device_get_parent(sc->ndis_dev), sc->ndis_dev, SYS_RES_MEMORY, rid, PCCARD_A_MEM_ATTR); if (error) { device_printf(sc->ndis_dev, "CARD_SET_RES_FLAGS() returned 0x%x\n", error); return(error); } sc->ndis_am_rid = rid; return(0); } /* * Attach the interface. Allocate softc structures, do ifmedia * setup and ethernet/BPF attach. */ static int ndis_attach_pccard(dev) device_t dev; { struct ndis_softc *sc; int unit, error = 0, rid; struct ndis_pccard_type *t; int devidx = 0; const char *prodstr, *vendstr; struct drvdb_ent *db; sc = device_get_softc(dev); unit = device_get_unit(dev); sc->ndis_dev = dev; db = windrv_match((matchfuncptr)ndis_devcompare, dev); if (db == NULL) return (ENXIO); sc->ndis_dobj = db->windrv_object; sc->ndis_regvals = db->windrv_regvals; resource_list_init(&sc->ndis_rl); sc->ndis_io_rid = 0; sc->ndis_res_io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &sc->ndis_io_rid, RF_ACTIVE); if (sc->ndis_res_io == NULL) { device_printf(dev, "couldn't map iospace\n"); error = ENXIO; goto fail; } sc->ndis_rescnt++; resource_list_add(&sc->ndis_rl, SYS_RES_IOPORT, sc->ndis_io_rid, rman_get_start(sc->ndis_res_io), rman_get_end(sc->ndis_res_io), rman_get_size(sc->ndis_res_io)); rid = 0; sc->ndis_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); if (sc->ndis_irq == NULL) { device_printf(dev, "couldn't map interrupt\n"); error = ENXIO; goto fail; } sc->ndis_rescnt++; resource_list_add(&sc->ndis_rl, SYS_RES_IRQ, rid, rman_get_start(sc->ndis_irq), rman_get_start(sc->ndis_irq), 1); sc->ndis_iftype = PCMCIABus; /* Figure out exactly which device we matched. */ t = db->windrv_devlist; error = pccard_get_product_str(dev, &prodstr); if (error) return(error); error = pccard_get_vendor_str(dev, &vendstr); if (error) return(error); while(t->ndis_name != NULL) { if (strcasecmp(vendstr, t->ndis_vid) == 0 && strcasecmp(prodstr, t->ndis_did) == 0) break; t++; devidx++; } sc->ndis_devidx = devidx; error = ndis_alloc_amem(sc); if (error) { device_printf(dev, "failed to allocate attribute memory\n"); goto fail; } error = ndis_attach(dev); + if (error == 0) + gone_in_dev(dev, 13, "pccard removed"); fail: return(error); } static int ndis_detach_pccard(device_t dev) { struct ndis_softc *sc = device_get_softc(dev); (void) ndis_detach(dev); if (sc->ndis_res_am != NULL) bus_release_resource(sc->ndis_dev, SYS_RES_MEMORY, sc->ndis_am_rid, sc->ndis_res_am); resource_list_free(&sc->ndis_rl); return (0); } static struct resource_list * ndis_get_resource_list(dev, child) device_t dev; device_t child; { struct ndis_softc *sc; sc = device_get_softc(dev); return (&sc->ndis_rl); } Index: stable/12/sys/dev/puc/puc_pccard.c =================================================================== --- stable/12/sys/dev/puc/puc_pccard.c (revision 365538) +++ stable/12/sys/dev/puc/puc_pccard.c (revision 365539) @@ -1,101 +1,112 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2002 Poul-Henning Kamp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* http://www.argosy.com.tw/product/sp320.htm */ const struct puc_cfg puc_pccard_rscom = { 0, 0, 0, 0, "ARGOSY SP320 Dual port serial PCMCIA", DEFAULT_RCLK, PUC_PORT_2S, 0, 1, 0, }; static int puc_pccard_probe(device_t dev) { const char *vendor, *product; int error; error = pccard_get_vendor_str(dev, &vendor); if (error) return(error); error = pccard_get_product_str(dev, &product); if (error) return(error); if (!strcmp(vendor, "PCMCIA") && !strcmp(product, "RS-COM 2P")) return (puc_bfe_probe(dev, &puc_pccard_rscom)); return (ENXIO); } +static int +puc_pccard_attach(device_t dev) +{ + int error; + + error = puc_bfe_attach(dev); + if (error == 0) + gone_in_dev(dev, 13, "pccard removed"); + return (error); +} + static device_method_t puc_pccard_methods[] = { /* Device interface */ DEVMETHOD(device_probe, puc_pccard_probe), - DEVMETHOD(device_attach, puc_bfe_attach), + DEVMETHOD(device_attach, puc_pccard_attach), DEVMETHOD(device_detach, puc_bfe_detach), DEVMETHOD(bus_alloc_resource, puc_bus_alloc_resource), DEVMETHOD(bus_release_resource, puc_bus_release_resource), DEVMETHOD(bus_get_resource, puc_bus_get_resource), DEVMETHOD(bus_read_ivar, puc_bus_read_ivar), DEVMETHOD(bus_setup_intr, puc_bus_setup_intr), DEVMETHOD(bus_teardown_intr, puc_bus_teardown_intr), DEVMETHOD(bus_print_child, puc_bus_print_child), DEVMETHOD(bus_child_pnpinfo_str, puc_bus_child_pnpinfo_str), DEVMETHOD(bus_child_location_str, puc_bus_child_location_str), DEVMETHOD_END }; static driver_t puc_pccard_driver = { puc_driver_name, puc_pccard_methods, sizeof(struct puc_softc), }; DRIVER_MODULE(puc, pccard, puc_pccard_driver, puc_devclass, 0, 0); Index: stable/12/sys/dev/uart/uart_bus_pccard.c =================================================================== --- stable/12/sys/dev/uart/uart_bus_pccard.c (revision 365538) +++ stable/12/sys/dev/uart/uart_bus_pccard.c (revision 365539) @@ -1,106 +1,107 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2001 M. Warner Losh. All rights reserved. * Copyright (c) 2003 Norikatsu Shigemura, Takenori Watanabe All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include "pccarddevs.h" static int uart_pccard_probe(device_t dev); static int uart_pccard_attach(device_t dev); static device_method_t uart_pccard_methods[] = { /* Device interface */ DEVMETHOD(device_probe, uart_pccard_probe), DEVMETHOD(device_attach, uart_pccard_attach), DEVMETHOD(device_detach, uart_bus_detach), { 0, 0 } }; static uint32_t uart_pccard_function = PCCARD_FUNCTION_SERIAL; static driver_t uart_pccard_driver = { uart_driver_name, uart_pccard_methods, sizeof(struct uart_softc), }; static int uart_pccard_probe(device_t dev) { int error; uint32_t fcn; fcn = PCCARD_FUNCTION_UNSPEC; error = pccard_get_function(dev, &fcn); if (error != 0) return (error); /* * If a serial card, we are likely the right driver. However, * some serial cards are better serviced by other drivers, so * allow other drivers to claim it, if they want. */ if (fcn == uart_pccard_function) return (BUS_PROBE_GENERIC); return (ENXIO); } static int uart_pccard_attach(device_t dev) { struct uart_softc *sc; int error; sc = device_get_softc(dev); sc->sc_class = &uart_ns8250_class; error = uart_bus_probe(dev, 0, 0, 0, 0, 0, 0); if (error > 0) return (error); + gone_in_dev(dev, 13, "pccard removed"); return (uart_bus_attach(dev)); } DRIVER_MODULE(uart, pccard, uart_pccard_driver, uart_devclass, 0, 0); MODULE_PNP_INFO("U32:function_type;", pccard, uart, &uart_pccard_function, 1); Index: stable/12/sys/dev/wi/if_wi_pccard.c =================================================================== --- stable/12/sys/dev/wi/if_wi_pccard.c (revision 365538) +++ stable/12/sys/dev/wi/if_wi_pccard.c (revision 365539) @@ -1,205 +1,206 @@ /*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Bill Paul. * 4. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* * Lucent WaveLAN/IEEE 802.11 PCMCIA driver for FreeBSD. * * Written by Bill Paul * Electrical Engineering Department * Columbia University, New York City */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "card_if.h" #include "pccarddevs.h" static int wi_pccard_probe(device_t); static int wi_pccard_attach(device_t); static device_method_t wi_pccard_methods[] = { /* Device interface */ DEVMETHOD(device_probe, wi_pccard_probe), DEVMETHOD(device_attach, wi_pccard_attach), DEVMETHOD(device_detach, wi_detach), DEVMETHOD(device_shutdown, wi_shutdown), { 0, 0 } }; static driver_t wi_pccard_driver = { "wi", wi_pccard_methods, sizeof(struct wi_softc) }; DRIVER_MODULE(wi, pccard, wi_pccard_driver, wi_devclass, 0, 0); MODULE_DEPEND(wi, wlan, 1, 1, 1); static const struct pccard_product wi_pccard_products[] = { PCMCIA_CARD(3COM, 3CRWE737A), PCMCIA_CARD(3COM, 3CRWE777A), PCMCIA_CARD(ACTIONTEC, PRISM), PCMCIA_CARD(ADAPTEC2, ANW8030), PCMCIA_CARD(ADDTRON, AWP100), PCMCIA_CARD(AIRVAST, WN_100B), PCMCIA_CARD(AIRVAST, WN_100), PCMCIA_CARD(ALLIEDTELESIS, WR211PCM), PCMCIA_CARD(ARTEM, ONAIR), PCMCIA_CARD(ASUS, WL100), PCMCIA_CARD(BAY, EMOBILITY_11B), PCMCIA_CARD(BROMAX, IWN), PCMCIA_CARD(BROMAX, IWN3), PCMCIA_CARD(BROMAX, WCF11), PCMCIA_CARD(BUFFALO, WLI_CF_S11G), PCMCIA_CARD(BUFFALO, WLI_PCM_S11), PCMCIA_CARD(COMPAQ, NC5004), PCMCIA_CARD(CONTEC, FX_DS110_PCC), PCMCIA_CARD(COREGA, WIRELESS_LAN_PCC_11), PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCA_11), PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCB_11), PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCL_11), PCMCIA_CARD(DLINK, DWL650H), PCMCIA_CARD(ELSA, XI300_IEEE), PCMCIA_CARD(ELSA, XI325_IEEE), PCMCIA_CARD(ELSA, APDL325_IEEE), PCMCIA_CARD(ELSA, XI330_IEEE), PCMCIA_CARD(ELSA, XI800_IEEE), PCMCIA_CARD(ELSA, WIFI_FLASH), PCMCIA_CARD(EMTAC, WLAN), PCMCIA_CARD(ERICSSON, WIRELESSLAN), PCMCIA_CARD(GEMTEK, WLAN), PCMCIA_CARD(HWN, AIRWAY80211), PCMCIA_CARD(INTEL, PRO_WLAN_2011), PCMCIA_CARD(INTERSIL, ISL37100P), PCMCIA_CARD(INTERSIL, ISL37110P), PCMCIA_CARD(INTERSIL, ISL37300P), PCMCIA_CARD(INTERSIL2, PRISM2), PCMCIA_CARD(IODATA2, WCF12), PCMCIA_CARD(IODATA2, WNB11PCM), PCMCIA_CARD(FUJITSU, WL110), PCMCIA_CARD(LUCENT, WAVELAN_IEEE), PCMCIA_CARD(MICROSOFT, MN_520), PCMCIA_CARD(NOKIA, C020_WLAN), PCMCIA_CARD(NOKIA, C110_WLAN), PCMCIA_CARD(PLANEX, GWNS11H), PCMCIA_CARD(PROXIM, HARMONY), PCMCIA_CARD(PROXIM, RANGELANDS_8430), PCMCIA_CARD(SAMSUNG, SWL_2000N), PCMCIA_CARD(SIEMENS, SS1021), PCMCIA_CARD(SIEMENS, SS1021A), PCMCIA_CARD(SIMPLETECH, SPECTRUM24_ALT), PCMCIA_CARD(SOCKET, LP_WLAN_CF), PCMCIA_CARD(TDK, LAK_CD011WL), { NULL } }; PCCARD_PNP_INFO(wi_pccard_products); static int wi_pccard_probe(device_t dev) { const struct pccard_product *pp; u_int32_t fcn = PCCARD_FUNCTION_UNSPEC; int error; /* Make sure we're a network driver */ error = pccard_get_function(dev, &fcn); if (error != 0) return error; if (fcn != PCCARD_FUNCTION_NETWORK) return ENXIO; pp = pccard_product_lookup(dev, wi_pccard_products, sizeof(wi_pccard_products[0]), NULL); if (pp != NULL) { if (pp->pp_name != NULL) device_set_desc(dev, pp->pp_name); return 0; } return ENXIO; } static int wi_pccard_attach(device_t dev) { struct wi_softc *sc; int error; sc = device_get_softc(dev); sc->wi_gone = 0; sc->wi_bus_type = WI_BUS_PCCARD; error = wi_alloc(dev, 0); if (error == 0) { /* Make sure interrupts are disabled. */ CSR_WRITE_2(sc, WI_INT_EN, 0); CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF); error = wi_attach(dev); if (error != 0) wi_free(dev); + gone_in_dev(dev, 13, "pccard removed"); } return error; } Index: stable/12/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c =================================================================== --- stable/12/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c (revision 365538) +++ stable/12/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c (revision 365539) @@ -1,1227 +1,1229 @@ /* * ng_bt3c_pccard.c */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2001-2002 Maksim Yevmenkin * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id: ng_bt3c_pccard.c,v 1.5 2003/04/01 18:15:21 max Exp $ * $FreeBSD$ * * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX * * Based on information obrained from: Jose Orlando Pereira * and disassembled w2k driver. * * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "pccarddevs.h" #include #include #include #include #include #include #include /* Netgraph methods */ static ng_constructor_t ng_bt3c_constructor; static ng_shutdown_t ng_bt3c_shutdown; static ng_newhook_t ng_bt3c_newhook; static ng_connect_t ng_bt3c_connect; static ng_disconnect_t ng_bt3c_disconnect; static ng_rcvmsg_t ng_bt3c_rcvmsg; static ng_rcvdata_t ng_bt3c_rcvdata; /* PCMCIA driver methods */ static int bt3c_pccard_probe (device_t); static int bt3c_pccard_attach (device_t); static int bt3c_pccard_detach (device_t); static void bt3c_intr (void *); static void bt3c_receive (bt3c_softc_p); static void bt3c_swi_intr (void *); static void bt3c_forward (node_p, hook_p, void *, int); static void bt3c_send (node_p, hook_p, void *, int); static void bt3c_download_firmware (bt3c_softc_p, char const *, int); #define bt3c_set_address(sc, address) \ do { \ bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_ADDR_L, ((address) & 0xff)); \ bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_ADDR_H, (((address) >> 8) & 0xff)); \ } while (0) #define bt3c_read_data(sc, data) \ do { \ (data) = bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_DATA_L); \ (data) |= ((bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_DATA_H) & 0xff) << 8); \ } while (0) #define bt3c_write_data(sc, data) \ do { \ bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_DATA_L, ((data) & 0xff)); \ bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_DATA_H, (((data) >> 8) & 0xff)); \ } while (0) #define bt3c_read_control(sc, data) \ do { \ (data) = bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_CONTROL); \ } while (0) #define bt3c_write_control(sc, data) \ do { \ bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_CONTROL, (data)); \ } while (0) #define bt3c_read(sc, address, data) \ do { \ bt3c_set_address((sc), (address)); \ bt3c_read_data((sc), (data)); \ } while(0) #define bt3c_write(sc, address, data) \ do { \ bt3c_set_address((sc), (address)); \ bt3c_write_data((sc), (data)); \ } while(0) static MALLOC_DEFINE(M_BT3C, "bt3c", "bt3c data structures"); /**************************************************************************** **************************************************************************** ** Netgraph specific **************************************************************************** ****************************************************************************/ /* * Netgraph node type */ /* Queue length */ static const struct ng_parse_struct_field ng_bt3c_node_qlen_type_fields[] = { { "queue", &ng_parse_int32_type, }, { "qlen", &ng_parse_int32_type, }, { NULL, } }; static const struct ng_parse_type ng_bt3c_node_qlen_type = { &ng_parse_struct_type, &ng_bt3c_node_qlen_type_fields }; /* Stat info */ static const struct ng_parse_struct_field ng_bt3c_node_stat_type_fields[] = { { "pckts_recv", &ng_parse_uint32_type, }, { "bytes_recv", &ng_parse_uint32_type, }, { "pckts_sent", &ng_parse_uint32_type, }, { "bytes_sent", &ng_parse_uint32_type, }, { "oerrors", &ng_parse_uint32_type, }, { "ierrors", &ng_parse_uint32_type, }, { NULL, } }; static const struct ng_parse_type ng_bt3c_node_stat_type = { &ng_parse_struct_type, &ng_bt3c_node_stat_type_fields }; static const struct ng_cmdlist ng_bt3c_cmdlist[] = { { NGM_BT3C_COOKIE, NGM_BT3C_NODE_GET_STATE, "get_state", NULL, &ng_parse_uint16_type }, { NGM_BT3C_COOKIE, NGM_BT3C_NODE_SET_DEBUG, "set_debug", &ng_parse_uint16_type, NULL }, { NGM_BT3C_COOKIE, NGM_BT3C_NODE_GET_DEBUG, "get_debug", NULL, &ng_parse_uint16_type }, { NGM_BT3C_COOKIE, NGM_BT3C_NODE_GET_QLEN, "get_qlen", NULL, &ng_bt3c_node_qlen_type }, { NGM_BT3C_COOKIE, NGM_BT3C_NODE_SET_QLEN, "set_qlen", &ng_bt3c_node_qlen_type, NULL }, { NGM_BT3C_COOKIE, NGM_BT3C_NODE_GET_STAT, "get_stat", NULL, &ng_bt3c_node_stat_type }, { NGM_BT3C_COOKIE, NGM_BT3C_NODE_RESET_STAT, "reset_stat", NULL, NULL }, { 0, } }; static struct ng_type typestruct = { .version = NG_ABI_VERSION, .name = NG_BT3C_NODE_TYPE, .constructor = ng_bt3c_constructor, .rcvmsg = ng_bt3c_rcvmsg, .shutdown = ng_bt3c_shutdown, .newhook = ng_bt3c_newhook, .connect = ng_bt3c_connect, .rcvdata = ng_bt3c_rcvdata, .disconnect = ng_bt3c_disconnect, .cmdlist = ng_bt3c_cmdlist }; /* * Netgraph node constructor. Do not allow to create node of this type. */ static int ng_bt3c_constructor(node_p node) { return (EINVAL); } /* ng_bt3c_constructor */ /* * Netgraph node destructor. Destroy node only when device has been detached */ static int ng_bt3c_shutdown(node_p node) { bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); /* Let old node go */ NG_NODE_SET_PRIVATE(node, NULL); NG_NODE_UNREF(node); /* Create new fresh one if we are not going down */ if (sc == NULL) goto out; /* Create new Netgraph node */ if (ng_make_node_common(&typestruct, &sc->node) != 0) { device_printf(sc->dev, "Could not create Netgraph node\n"); sc->node = NULL; goto out; } /* Name new Netgraph node */ if (ng_name_node(sc->node, device_get_nameunit(sc->dev)) != 0) { device_printf(sc->dev, "Could not name Netgraph node\n"); NG_NODE_UNREF(sc->node); sc->node = NULL; goto out; } NG_NODE_SET_PRIVATE(sc->node, sc); out: return (0); } /* ng_bt3c_shutdown */ /* * Create new hook. There can only be one. */ static int ng_bt3c_newhook(node_p node, hook_p hook, char const *name) { bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); if (strcmp(name, NG_BT3C_HOOK) != 0) return (EINVAL); if (sc->hook != NULL) return (EISCONN); sc->hook = hook; return (0); } /* ng_bt3c_newhook */ /* * Connect hook. Say YEP, that's OK with me. */ static int ng_bt3c_connect(hook_p hook) { bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); if (hook != sc->hook) { sc->hook = NULL; return (EINVAL); } /* set the hook into queueing mode (for incoming (from wire) packets) */ NG_HOOK_FORCE_QUEUE(NG_HOOK_PEER(hook)); return (0); } /* ng_bt3c_connect */ /* * Disconnect hook */ static int ng_bt3c_disconnect(hook_p hook) { bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); /* * We need to check for sc != NULL because we can be called from * bt3c_pccard_detach() via ng_rmnode_self() */ if (sc != NULL) { if (hook != sc->hook) return (EINVAL); IF_DRAIN(&sc->inq); IF_DRAIN(&sc->outq); sc->hook = NULL; } return (0); } /* ng_bt3c_disconnect */ /* * Process control message */ static int ng_bt3c_rcvmsg(node_p node, item_p item, hook_p lasthook) { bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); struct ng_mesg *msg = NULL, *rsp = NULL; int error = 0; if (sc == NULL) { NG_FREE_ITEM(item); return (EHOSTDOWN); } NGI_GET_MSG(item, msg); switch (msg->header.typecookie) { case NGM_GENERIC_COOKIE: switch (msg->header.cmd) { case NGM_TEXT_STATUS: NG_MKRESPONSE(rsp, msg, NG_TEXTRESPONSE, M_NOWAIT); if (rsp == NULL) error = ENOMEM; else snprintf(rsp->data, NG_TEXTRESPONSE, "Hook: %s\n" \ "Flags: %#x\n" \ "Debug: %d\n" \ "State: %d\n" \ "IncmQ: [len:%d,max:%d]\n" \ "OutgQ: [len:%d,max:%d]\n", (sc->hook != NULL)? NG_BT3C_HOOK : "", sc->flags, sc->debug, sc->state, _IF_QLEN(&sc->inq), /* XXX */ sc->inq.ifq_maxlen, /* XXX */ _IF_QLEN(&sc->outq), /* XXX */ sc->outq.ifq_maxlen /* XXX */ ); break; default: error = EINVAL; break; } break; case NGM_BT3C_COOKIE: switch (msg->header.cmd) { case NGM_BT3C_NODE_GET_STATE: NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_state_ep), M_NOWAIT); if (rsp == NULL) error = ENOMEM; else *((ng_bt3c_node_state_ep *)(rsp->data)) = sc->state; break; case NGM_BT3C_NODE_SET_DEBUG: if (msg->header.arglen != sizeof(ng_bt3c_node_debug_ep)) error = EMSGSIZE; else sc->debug = *((ng_bt3c_node_debug_ep *)(msg->data)); break; case NGM_BT3C_NODE_GET_DEBUG: NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_debug_ep), M_NOWAIT); if (rsp == NULL) error = ENOMEM; else *((ng_bt3c_node_debug_ep *)(rsp->data)) = sc->debug; break; case NGM_BT3C_NODE_GET_QLEN: NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_qlen_ep), M_NOWAIT); if (rsp == NULL) { error = ENOMEM; break; } switch (((ng_bt3c_node_qlen_ep *)(msg->data))->queue) { case NGM_BT3C_NODE_IN_QUEUE: ((ng_bt3c_node_qlen_ep *)(rsp->data))->queue = NGM_BT3C_NODE_IN_QUEUE; ((ng_bt3c_node_qlen_ep *)(rsp->data))->qlen = sc->inq.ifq_maxlen; break; case NGM_BT3C_NODE_OUT_QUEUE: ((ng_bt3c_node_qlen_ep *)(rsp->data))->queue = NGM_BT3C_NODE_OUT_QUEUE; ((ng_bt3c_node_qlen_ep *)(rsp->data))->qlen = sc->outq.ifq_maxlen; break; default: NG_FREE_MSG(rsp); error = EINVAL; break; } break; case NGM_BT3C_NODE_SET_QLEN: if (msg->header.arglen != sizeof(ng_bt3c_node_qlen_ep)){ error = EMSGSIZE; break; } if (((ng_bt3c_node_qlen_ep *)(msg->data))->qlen <= 0) { error = EINVAL; break; } switch (((ng_bt3c_node_qlen_ep *)(msg->data))->queue) { case NGM_BT3C_NODE_IN_QUEUE: sc->inq.ifq_maxlen = ((ng_bt3c_node_qlen_ep *) (msg->data))->qlen; /* XXX */ break; case NGM_BT3C_NODE_OUT_QUEUE: sc->outq.ifq_maxlen = ((ng_bt3c_node_qlen_ep *) (msg->data))->qlen; /* XXX */ break; default: error = EINVAL; break; } break; case NGM_BT3C_NODE_GET_STAT: NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_stat_ep), M_NOWAIT); if (rsp == NULL) error = ENOMEM; else bcopy(&sc->stat, rsp->data, sizeof(ng_bt3c_node_stat_ep)); break; case NGM_BT3C_NODE_RESET_STAT: NG_BT3C_STAT_RESET(sc->stat); break; case NGM_BT3C_NODE_DOWNLOAD_FIRMWARE: if (msg->header.arglen < sizeof(ng_bt3c_firmware_block_ep)) error = EMSGSIZE; else bt3c_download_firmware(sc, msg->data, msg->header.arglen); break; default: error = EINVAL; break; } break; default: error = EINVAL; break; } NG_RESPOND_MSG(error, node, item, rsp); NG_FREE_MSG(msg); return (error); } /* ng_bt3c_rcvmsg */ /* * Process data */ static int ng_bt3c_rcvdata(hook_p hook, item_p item) { bt3c_softc_p sc = (bt3c_softc_p)NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); struct mbuf *m = NULL; int error = 0; if (sc == NULL) { error = EHOSTDOWN; goto out; } if (hook != sc->hook) { error = EINVAL; goto out; } NGI_GET_M(item, m); IF_LOCK(&sc->outq); if (_IF_QFULL(&sc->outq)) { NG_BT3C_ERR(sc->dev, "Outgoing queue is full. Dropping mbuf, len=%d\n", m->m_pkthdr.len); NG_BT3C_STAT_OERROR(sc->stat); NG_FREE_M(m); } else _IF_ENQUEUE(&sc->outq, m); IF_UNLOCK(&sc->outq); error = ng_send_fn(sc->node, NULL, bt3c_send, NULL, 0 /* new send */); out: NG_FREE_ITEM(item); return (error); } /* ng_bt3c_rcvdata */ /**************************************************************************** **************************************************************************** ** PCMCIA driver specific **************************************************************************** ****************************************************************************/ /* * PC Card (PCMCIA) probe routine */ static struct pccard_product const bt3c_pccard_products[] = { PCMCIA_CARD(3COM, 3CRWB609), { NULL, } }; static int bt3c_pccard_probe(device_t dev) { struct pccard_product const *pp = NULL; pp = pccard_product_lookup(dev, bt3c_pccard_products, sizeof(bt3c_pccard_products[0]), NULL); if (pp == NULL) return (ENXIO); device_set_desc(dev, pp->pp_name); return (0); } /* bt3c_pccard_probe */ /* * PC Card (PCMCIA) attach routine */ static int bt3c_pccard_attach(device_t dev) { bt3c_softc_p sc = (bt3c_softc_p) device_get_softc(dev); /* Allocate I/O ports */ sc->iobase_rid = 0; sc->iobase = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &sc->iobase_rid, 8, RF_ACTIVE); if (sc->iobase == NULL) { device_printf(dev, "Could not allocate I/O ports\n"); goto bad; } sc->iot = rman_get_bustag(sc->iobase); sc->ioh = rman_get_bushandle(sc->iobase); /* Allocate IRQ */ sc->irq_rid = 0; sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, RF_ACTIVE); if (sc->irq == NULL) { device_printf(dev, "Could not allocate IRQ\n"); goto bad; } sc->irq_cookie = NULL; if (bus_setup_intr(dev, sc->irq, INTR_TYPE_TTY, NULL, bt3c_intr, sc, &sc->irq_cookie) != 0) { device_printf(dev, "Could not setup ISR\n"); goto bad; } /* Attach handler to TTY SWI thread */ sc->ith = NULL; if (swi_add(&tty_intr_event, device_get_nameunit(dev), bt3c_swi_intr, sc, SWI_TTY, 0, &sc->ith) < 0) { device_printf(dev, "Could not setup SWI ISR\n"); goto bad; } /* Create Netgraph node */ if (ng_make_node_common(&typestruct, &sc->node) != 0) { device_printf(dev, "Could not create Netgraph node\n"); sc->node = NULL; goto bad; } /* Name Netgraph node */ if (ng_name_node(sc->node, device_get_nameunit(dev)) != 0) { device_printf(dev, "Could not name Netgraph node\n"); NG_NODE_UNREF(sc->node); sc->node = NULL; goto bad; } sc->dev = dev; sc->debug = NG_BT3C_WARN_LEVEL; sc->inq.ifq_maxlen = sc->outq.ifq_maxlen = BT3C_DEFAULTQLEN; mtx_init(&sc->inq.ifq_mtx, "BT3C inq", NULL, MTX_DEF); mtx_init(&sc->outq.ifq_mtx, "BT3C outq", NULL, MTX_DEF); sc->state = NG_BT3C_W4_PKT_IND; sc->want = 1; NG_NODE_SET_PRIVATE(sc->node, sc); + gone_in_dev(dev, 13, "pccard removed"); + return (0); bad: if (sc->ith != NULL) { swi_remove(sc->ith); sc->ith = NULL; } if (sc->irq != NULL) { if (sc->irq_cookie != NULL) bus_teardown_intr(dev, sc->irq, sc->irq_cookie); bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq); sc->irq = NULL; sc->irq_rid = 0; } if (sc->iobase != NULL) { bus_release_resource(dev, SYS_RES_IOPORT, sc->iobase_rid, sc->iobase); sc->iobase = NULL; sc->iobase_rid = 0; } return (ENXIO); } /* bt3c_pccacd_attach */ /* * PC Card (PCMCIA) detach routine */ static int bt3c_pccard_detach(device_t dev) { bt3c_softc_p sc = (bt3c_softc_p) device_get_softc(dev); if (sc == NULL) return (0); swi_remove(sc->ith); sc->ith = NULL; bus_teardown_intr(dev, sc->irq, sc->irq_cookie); bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq); sc->irq_cookie = NULL; sc->irq = NULL; sc->irq_rid = 0; bus_release_resource(dev, SYS_RES_IOPORT, sc->iobase_rid, sc->iobase); sc->iobase = NULL; sc->iobase_rid = 0; if (sc->node != NULL) { NG_NODE_SET_PRIVATE(sc->node, NULL); ng_rmnode_self(sc->node); sc->node = NULL; } NG_FREE_M(sc->m); IF_DRAIN(&sc->inq); IF_DRAIN(&sc->outq); mtx_destroy(&sc->inq.ifq_mtx); mtx_destroy(&sc->outq.ifq_mtx); return (0); } /* bt3c_pccacd_detach */ /* * Interrupt service routine's */ static void bt3c_intr(void *context) { bt3c_softc_p sc = (bt3c_softc_p) context; u_int16_t control, status; if (sc == NULL || sc->ith == NULL) { printf("%s: bogus interrupt\n", NG_BT3C_NODE_TYPE); return; } bt3c_read_control(sc, control); if ((control & 0x80) == 0) return; bt3c_read(sc, 0x7001, status); NG_BT3C_INFO(sc->dev, "control=%#x, status=%#x\n", control, status); if ((status & 0xff) == 0x7f || (status & 0xff) == 0xff) { NG_BT3C_WARN(sc->dev, "Strange status=%#x\n", status); return; } /* Receive complete */ if (status & 0x0001) bt3c_receive(sc); /* Record status and schedule SWI */ sc->status |= status; swi_sched(sc->ith, 0); /* Complete interrupt */ bt3c_write(sc, 0x7001, 0x0000); bt3c_write_control(sc, control); } /* bt3c_intr */ /* * Receive data */ static void bt3c_receive(bt3c_softc_p sc) { u_int16_t i, count, c; /* Receive data from the card */ bt3c_read(sc, 0x7006, count); NG_BT3C_INFO(sc->dev, "The card has %d characters\n", count); bt3c_set_address(sc, 0x7480); for (i = 0; i < count; i++) { /* Allocate new mbuf if needed */ if (sc->m == NULL) { sc->state = NG_BT3C_W4_PKT_IND; sc->want = 1; MGETHDR(sc->m, M_NOWAIT, MT_DATA); if (sc->m == NULL) { NG_BT3C_ERR(sc->dev, "Could not get mbuf\n"); NG_BT3C_STAT_IERROR(sc->stat); break; /* XXX lost of sync */ } if (!(MCLGET(sc->m, M_NOWAIT))) { NG_FREE_M(sc->m); NG_BT3C_ERR(sc->dev, "Could not get cluster\n"); NG_BT3C_STAT_IERROR(sc->stat); break; /* XXX lost of sync */ } sc->m->m_len = sc->m->m_pkthdr.len = 0; } /* Read and append character to mbuf */ bt3c_read_data(sc, c); if (sc->m->m_pkthdr.len >= MCLBYTES) { NG_BT3C_ERR(sc->dev, "Oversized frame\n"); NG_FREE_M(sc->m); sc->state = NG_BT3C_W4_PKT_IND; sc->want = 1; break; /* XXX lost of sync */ } mtod(sc->m, u_int8_t *)[sc->m->m_len ++] = (u_int8_t) c; sc->m->m_pkthdr.len ++; NG_BT3C_INFO(sc->dev, "Got char %#x, want=%d, got=%d\n", c, sc->want, sc->m->m_pkthdr.len); if (sc->m->m_pkthdr.len < sc->want) continue; /* wait for more */ switch (sc->state) { /* Got packet indicator */ case NG_BT3C_W4_PKT_IND: NG_BT3C_INFO(sc->dev, "Got packet indicator %#x\n", *mtod(sc->m, u_int8_t *)); sc->state = NG_BT3C_W4_PKT_HDR; /* * Since packet indicator included in the packet * header just set sc->want to sizeof(packet header). */ switch (*mtod(sc->m, u_int8_t *)) { case NG_HCI_ACL_DATA_PKT: sc->want = sizeof(ng_hci_acldata_pkt_t); break; case NG_HCI_SCO_DATA_PKT: sc->want = sizeof(ng_hci_scodata_pkt_t); break; case NG_HCI_EVENT_PKT: sc->want = sizeof(ng_hci_event_pkt_t); break; default: NG_BT3C_ERR(sc->dev, "Ignoring unknown packet type=%#x\n", *mtod(sc->m, u_int8_t *)); NG_BT3C_STAT_IERROR(sc->stat); NG_FREE_M(sc->m); sc->state = NG_BT3C_W4_PKT_IND; sc->want = 1; break; } break; /* Got packet header */ case NG_BT3C_W4_PKT_HDR: sc->state = NG_BT3C_W4_PKT_DATA; switch (*mtod(sc->m, u_int8_t *)) { case NG_HCI_ACL_DATA_PKT: c = le16toh(mtod(sc->m, ng_hci_acldata_pkt_t *)->length); break; case NG_HCI_SCO_DATA_PKT: c = mtod(sc->m, ng_hci_scodata_pkt_t*)->length; break; case NG_HCI_EVENT_PKT: c = mtod(sc->m, ng_hci_event_pkt_t *)->length; break; default: KASSERT(0, ("Invalid packet type=%#x\n", *mtod(sc->m, u_int8_t *))); break; } NG_BT3C_INFO(sc->dev, "Got packet header, packet type=%#x, got so far %d, payload size=%d\n", *mtod(sc->m, u_int8_t *), sc->m->m_pkthdr.len, c); if (c > 0) { sc->want += c; break; } /* else FALLTHROUGH and deliver frame */ /* XXX is this true? should we deliver empty frame? */ /* Got packet data */ case NG_BT3C_W4_PKT_DATA: NG_BT3C_INFO(sc->dev, "Got full packet, packet type=%#x, packet size=%d\n", *mtod(sc->m, u_int8_t *), sc->m->m_pkthdr.len); NG_BT3C_STAT_BYTES_RECV(sc->stat, sc->m->m_pkthdr.len); NG_BT3C_STAT_PCKTS_RECV(sc->stat); IF_LOCK(&sc->inq); if (_IF_QFULL(&sc->inq)) { NG_BT3C_ERR(sc->dev, "Incoming queue is full. Dropping mbuf, len=%d\n", sc->m->m_pkthdr.len); NG_BT3C_STAT_IERROR(sc->stat); NG_FREE_M(sc->m); } else { _IF_ENQUEUE(&sc->inq, sc->m); sc->m = NULL; } IF_UNLOCK(&sc->inq); sc->state = NG_BT3C_W4_PKT_IND; sc->want = 1; break; default: KASSERT(0, ("Invalid node state=%d", sc->state)); break; } } bt3c_write(sc, 0x7006, 0x0000); } /* bt3c_receive */ /* * SWI interrupt handler * Netgraph part is handled via ng_send_fn() to avoid race with hook * connection/disconnection */ static void bt3c_swi_intr(void *context) { bt3c_softc_p sc = (bt3c_softc_p) context; u_int16_t data; /* Receive complete */ if (sc->status & 0x0001) { sc->status &= ~0x0001; /* XXX is it safe? */ if (ng_send_fn(sc->node, NULL, &bt3c_forward, NULL, 0) != 0) NG_BT3C_ALERT(sc->dev, "Could not forward frames!\n"); } /* Send complete */ if (sc->status & 0x0002) { sc->status &= ~0x0002; /* XXX is it safe */ if (ng_send_fn(sc->node, NULL, &bt3c_send, NULL, 1) != 0) NG_BT3C_ALERT(sc->dev, "Could not send frames!\n"); } /* Antenna position */ if (sc->status & 0x0020) { sc->status &= ~0x0020; /* XXX is it safe */ bt3c_read(sc, 0x7002, data); data &= 0x10; if (data) sc->flags |= BT3C_ANTENNA_OUT; else sc->flags &= ~BT3C_ANTENNA_OUT; NG_BT3C_INFO(sc->dev, "Antenna %s\n", data? "OUT" : "IN"); } } /* bt3c_swi_intr */ /* * Send all incoming frames to the upper layer */ static void bt3c_forward(node_p node, hook_p hook, void *arg1, int arg2) { bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); struct mbuf *m = NULL; int error; if (sc == NULL) return; if (sc->hook != NULL && NG_HOOK_IS_VALID(sc->hook)) { for (;;) { IF_DEQUEUE(&sc->inq, m); if (m == NULL) break; NG_SEND_DATA_ONLY(error, sc->hook, m); if (error != 0) NG_BT3C_STAT_IERROR(sc->stat); } } else { IF_LOCK(&sc->inq); for (;;) { _IF_DEQUEUE(&sc->inq, m); if (m == NULL) break; NG_BT3C_STAT_IERROR(sc->stat); NG_FREE_M(m); } IF_UNLOCK(&sc->inq); } } /* bt3c_forward */ /* * Send more data to the device. Must be called when node is locked */ static void bt3c_send(node_p node, hook_p hook, void *arg, int completed) { bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); struct mbuf *m = NULL; int i, wrote, len; if (sc == NULL) return; if (completed) sc->flags &= ~BT3C_XMIT; if (sc->flags & BT3C_XMIT) return; bt3c_set_address(sc, 0x7080); for (wrote = 0; wrote < BT3C_FIFO_SIZE; ) { IF_DEQUEUE(&sc->outq, m); if (m == NULL) break; while (m != NULL) { len = min((BT3C_FIFO_SIZE - wrote), m->m_len); for (i = 0; i < len; i++) bt3c_write_data(sc, m->m_data[i]); wrote += len; m->m_data += len; m->m_len -= len; if (m->m_len > 0) break; m = m_free(m); } if (m != NULL) { IF_PREPEND(&sc->outq, m); break; } NG_BT3C_STAT_PCKTS_SENT(sc->stat); } if (wrote > 0) { NG_BT3C_INFO(sc->dev, "Wrote %d bytes\n", wrote); NG_BT3C_STAT_BYTES_SENT(sc->stat, wrote); bt3c_write(sc, 0x7005, wrote); sc->flags |= BT3C_XMIT; } } /* bt3c_send */ /* * Download chip firmware */ static void bt3c_download_firmware(bt3c_softc_p sc, char const *firmware, int firmware_size) { ng_bt3c_firmware_block_ep const *block = NULL; u_int16_t const *data = NULL; int i, size; u_int8_t c; /* Reset */ device_printf(sc->dev, "Reseting the card...\n"); bt3c_write(sc, 0x8040, 0x0404); bt3c_write(sc, 0x8040, 0x0400); DELAY(1); bt3c_write(sc, 0x8040, 0x0404); DELAY(17); /* Download firmware */ device_printf(sc->dev, "Starting firmware download process...\n"); for (size = 0; size < firmware_size; ) { block = (ng_bt3c_firmware_block_ep const *)(firmware + size); data = (u_int16_t const *)(block + 1); if (bootverbose) device_printf(sc->dev, "Download firmware block, " \ "address=%#08x, size=%d words, aligment=%d\n", block->block_address, block->block_size, block->block_alignment); bt3c_set_address(sc, block->block_address); for (i = 0; i < block->block_size; i++) bt3c_write_data(sc, data[i]); size += (sizeof(*block) + (block->block_size * 2) + block->block_alignment); } DELAY(17); device_printf(sc->dev, "Firmware download process complete\n"); /* Boot */ device_printf(sc->dev, "Starting the card...\n"); bt3c_set_address(sc, 0x3000); bt3c_read_control(sc, c); bt3c_write_control(sc, (c | 0x40)); DELAY(17); /* Clear registers */ device_printf(sc->dev, "Clearing card registers...\n"); bt3c_write(sc, 0x7006, 0x0000); bt3c_write(sc, 0x7005, 0x0000); bt3c_write(sc, 0x7001, 0x0000); DELAY(1000); } /* bt3c_download_firmware */ /**************************************************************************** **************************************************************************** ** Driver module **************************************************************************** ****************************************************************************/ /* * PC Card (PCMCIA) driver */ static device_method_t bt3c_pccard_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bt3c_pccard_probe), DEVMETHOD(device_attach, bt3c_pccard_attach), DEVMETHOD(device_detach, bt3c_pccard_detach), { 0, 0 } }; static driver_t bt3c_pccard_driver = { NG_BT3C_NODE_TYPE, bt3c_pccard_methods, sizeof(bt3c_softc_t) }; static devclass_t bt3c_devclass; /* * Load/Unload the driver module */ static int bt3c_modevent(module_t mod, int event, void *data) { int error; switch (event) { case MOD_LOAD: error = ng_newtype(&typestruct); if (error != 0) printf("%s: Could not register Netgraph node type, " \ "error=%d\n", NG_BT3C_NODE_TYPE, error); break; case MOD_UNLOAD: error = ng_rmtype(&typestruct); break; default: error = EOPNOTSUPP; break; } return (error); } /* bt3c_modevent */ DRIVER_MODULE(bt3c, pccard, bt3c_pccard_driver, bt3c_devclass, bt3c_modevent,0); MODULE_VERSION(ng_bt3c, NG_BLUETOOTH_VERSION); MODULE_DEPEND(ng_bt3c, netgraph, NG_ABI_VERSION, NG_ABI_VERSION,NG_ABI_VERSION); PCCARD_PNP_INFO(bt3c_pccard_products); Index: stable/12 =================================================================== --- stable/12 (revision 365538) +++ stable/12 (revision 365539) Property changes on: stable/12 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r364430