Commit Graph

17509 Commits

Author SHA1 Message Date
Warner Losh
83bda63e3e Actually revert last... Upon closer inspection the code works in the
face of errors already...  A bit unorthodox, but none-the-less valid.
2008-08-23 07:43:03 +00:00
Warner Losh
b52943f026 Handle errors in device_get_children gracefully. 2008-08-23 07:41:21 +00:00
Warner Losh
da02572e7f Handle errors from device_get_chidlren.
Free child list when there's more children than we expected.
2008-08-23 07:38:00 +00:00
Warner Losh
696771ee0a Cope with errors from device_get_children(). These errors can happen
only in low memory situations, so the error fork of these fixes is
lightly tested, but they should do the least-wrong thing...

Submitted by:	Hans Petter Selasky
2008-08-23 07:23:52 +00:00
Warner Losh
de5d443f0f Cosmetic nit. 2008-08-23 07:18:30 +00:00
John Baldwin
8fd40d8a9e Use bus_foo() rather than bus_space_foo() and remove bus handle and tag
from softc.
2008-08-22 18:43:19 +00:00
John Baldwin
19ab530d2a Use ppc_detach() for device_detach instead of ppc_attach().
MFC after:	1 week
2008-08-22 18:42:45 +00:00
John Baldwin
8aef71dd4f Whitespace fix. 2008-08-22 18:42:18 +00:00
John Baldwin
b43e2a6b83 Remove unused UNITOSOFTC() macro. 2008-08-22 18:42:05 +00:00
Pyun YongHyeon
861cf54c59 Add a new sysctl node 'dev.bfe.N.stats' that shows various MAC
counters for Rx/Tx statistics. Various counters in ifnet is also
updated with these hardware counters.

Tested by:	kib, Gleb Kurtsou gleb.kurtsou at gmail dot com
		Ulrich Spoerlein uspoerlein at gmail dot com
2008-08-22 06:46:55 +00:00
Pyun YongHyeon
2be30c0d91 Because bfe(4) knows interrupt mask value there is no need to read
interrupt mask register again. This saves one register access per
each interrupt.
Also don't try to process frames when driver is not running.

Tested by:	kib, Gleb Kurtsou gleb.kurtsou at gmail dot com
		Ulrich Spoerlein uspoerlein at gmail dot com
2008-08-22 04:52:21 +00:00
John Baldwin
d320e05ca5 Extend the support for PCI-e memory mapped configuration space access:
- Rename pciereg_cfgopen() to pcie_cfgregopen() and expose it to the
  rest of the kernel.  It now also accepts parameters via function
  arguments rather than global variables.
- Add a notion of minimum and maximum bus numbers and reject requests for
  an out of range bus.
- Add more range checks on slot/func/reg/bytes parameters to the cfg reg
  read/write routines.  Don't panic on any invalid parameters, just fail
  the request (writes do nothing, reads return -1).  This matches the
  behavior of the other cfg mechanisms.
- Port the memory mapped configuration space access to amd64.  On amd64
  we simply use the direct map (via pmap_mapdev()) for the memory mapped
  window.
- During acpi_attach() just after loading the ACPI tables, check for a
  MCFG table.  If it exists, call pciereg_cfgopen() on each subtable
  (memory mapped window).  For now we only support windows for domain 0
  that start with bus 0.  This removes the need for more chipset-specific
  quirks in the MD code.
- Remove the chipset-specific quirks for the Intel 5000P/V/Z chipsets
  since these machines should all have MCFG tables via ACPI.
- Updated pci_cfgregopen() to DTRT if ACPI had invoked pcie_cfgregopen()
  earlier.

MFC after:	2 weeks
2008-08-22 02:14:23 +00:00
Pyun YongHyeon
49bbfbc525 Remove bfe_link in softc and introduce two new flags to mark
link state and detach request.
While I'm here make sure established link is IFM_10_T or
IFM_100_TX as bfe(4) just supports 10/100Mbps media.

Tested by:	kib, Gleb Kurtsou gleb.kurtsou at gmail dot com
		Ulrich Spoerlein uspoerlein at gmail dot com
2008-08-22 01:06:25 +00:00
Andrew Thompson
858030c4a9 Add the Decision Computer Inc, PCCOM 8-port serial card.
PR:		kern/69730
Submitted by:	Darrin Smith
2008-08-22 00:13:17 +00:00
Andrew Thompson
46ce58c7f6 Add the VScom PCI-100L card.
PR:		kern/72352
Submitted by:	Thomas Nystrom
2008-08-22 00:12:08 +00:00
Andrew Thompson
0dc908e79c Add the Avlab Technology PCI IO 4S-850 4 port serial card.
PR:		kern/110797
Submitted by:	Trevor Roydhouse
2008-08-21 23:22:32 +00:00
Remko Lodder
ecf815ecf0 Add support for the Alcor Card Reader (9361)
PR:		124656
Submitted by:	Vincent Francois <vincentfrancois dot pro at gmail dot com>
Approved by:	imp (mentor, implicit)
MFC after:	1 week
2008-08-21 20:37:38 +00:00
Andrew Gallatin
7b9f20ea8d Adapt mxge shims to detect phys contig jumbo frames
in RELENG_7

MFC after: 3 days
2008-08-21 16:35:34 +00:00
Pyun YongHyeon
96ee09c546 o Sort includes and add <endian.h> to support endianness.
o Removed unneeded header files.
 o bus_dma(9) fix:
   - created parent tag with 1GB dma address limit with no
     alignment restrictions.
   - set 4096 alignment limit for Tx/Rx descriptor rings.
   - separate Rx buffer tag from Tx buffer tag such that Tx tag
     allows up-to 16 segments while Rx buffer tag only allows
     single segment.
   - it seems the controller has no alignment restrictions on Tx/Rx
     buffers. Remove ETHER_ALIGN alignment restriction in Tx/Rx
     buffers.
   - created a spare Rx dma map which would be used to cope with
     failure of loading a dma map.
   - make sure to load full Tx/Rx descriptor size for Tx/Rx
     descriptor dma maps, previously bfe(4) used to load single
     descriptor size for each descriptor rings. I have no idea how
     it could be run without problems.
   - don't blindly cast bus_addr_t type to 32bits in bfe_dma_map().
   - created bfe_dma_free() to free allocated dma memory/tags.
   - make sure to invoke bus_dmamap_sync(9) before/after processing
     descriptor rings/buffers. Because the hardware has severe dma
     address space limitation, bounce-buffers would be always used
     on systems with more than 1GB memory during
     descriptors/buffers access.
   - added Tx descriptor ring initialization function,
     bfe_list_tx_init().
   - moved producer/consumer index initialization to
     bfe_list_tx_init() and bfe_list_rx_init() from
     bfe_chip_reset().
   - added bfe_discard_buf() which will update loaded descriptors
     without unloading/reloading the dma map to speed up error
     recovery.
   - implemented Tx side bus_dmamap_load_mbuf_sg(9). The number of
     segments allowed was chosen to be 16 which should be enough for
     non-TSO capable hardwares. Setting SOF bit of Tx descriptor is
     done in the last to avoid potential race.
   - don't give up sending frames in bfe_start() until the hardware
     lacks free descriptors.
   - added XXX comment to second kick command and possible workaround.
   - implemented Rx side bus_dmamap_load_mbuf_sg(9).
   - removed bfe_dma_map_desc() as it's not needed anymore after
     the conversion to bus_dmamap_load_mbuf_sg(9).
   - added endianness support. With this change bfe(4) should work
     on any architectures that can create bounce buffers within 1GB
     address range.
   - add missing bus_dmamap_sync() in bfe_tx_eof()/bfe_rx_eof().
 o Use PCI_BAR instead of hardcoded value to set BARs.
   Simplified register access with bus_write_4(9)/bus_read_4(9) and
   removed bfe_btag, bfe_bhandle, bfe_vhandle in softc as it's not
   used anymore.
 o Reorder device detach logic such that bfe_detach() is also used
   for handling driver attach failure case.
 o Remove unnecessary KASSERT in bfe_detach().
 o Remove bfe_rx_cnt, bfe_up, bfe_vpd_prodname, bfe_vpd_readonly in
   softc.  It's not used at all.
 o Remove BFE_RX_RING_SIZE/BFE_RX_RING_SIZE/BFE_LINK_DOWN.

Tested by:	kib, Gleb Kurtsou gleb.kurtsou at gmail dot com
		Ulrich Spoerlein uspoerlein at gmail dot com
2008-08-21 04:21:53 +00:00
Kip Macy
83b92f6e47 For reasons that I have not delved in to Xen 3.2 netback now does header splitting
so packets > 128 bytes are now split in to multiple buffer. This fixes netfront
to handle multiple buffers per rx packet.

MFC after:	1 month
2008-08-21 02:40:26 +00:00
John Baldwin
9c0e9e988e The config space registers holding the upper 32-bits of the prefetchable
memory area's base and limit are optional.  The low 4-bits of the "low"
prefetchable registers indicates whether or not a 32-bit or 64-bit
region is supported.  The PCI-PCI driver had been assuming that all bridges
supported a 64-bit region (and thus the two upper 32-bit registers).  Fix
the driver to only use those registers if the low 4-bits of the "low"
registers indicate that a 64-bit region is supported.  The PCI-PCI bridge
in the XBox happens to be a bridge that only supports a 32-bit region.

Reported by:	rink
MFC after:	1 week
2008-08-20 18:29:59 +00:00
Remko Lodder
f0f6980322 Bring in support for the MC8755 Sierra UMTS card.
Submitted by:	Robert Blacquiere <robert at blacquiere dot nl>
Approved by:	imp (mentor, implicit)
MFC after:	1 week
2008-08-20 13:14:58 +00:00
Kip Macy
6ae0e31bcc change netfront to match xen31_6
fix console locking
2008-08-20 09:47:49 +00:00
Kip Macy
4615bad142 mark blkfront_info as ready
MFC after:	1 month
2008-08-20 09:22:37 +00:00
Kip Macy
980c717846 include vmparam.h for KERNBASE and fix typo 2008-08-20 09:11:58 +00:00
Kip Macy
7a5048f10c register netfront before xenbus does its probing
MFC after: 	1 month
2008-08-20 09:03:23 +00:00
Ed Schouten
1781f8bd6d Integrate the Xen console driver.
I initially didn't want to integrate the Xen console driver, because it
did not receive any testing. Kip Macy suggested that I'd better check it
in right now, because this is the easiest way for him to test it while
he is working on the Xen import.

Requested by:	kmacy
2008-08-20 09:03:03 +00:00
Ed Schouten
bc093719ca Integrate the new MPSAFE TTY layer to the FreeBSD operating system.
The last half year I've been working on a replacement TTY layer for the
FreeBSD kernel. The new TTY layer was designed to improve the following:

- Improved driver model:

  The old TTY layer has a driver model that is not abstract enough to
  make it friendly to use. A good example is the output path, where the
  device drivers directly access the output buffers. This means that an
  in-kernel PPP implementation must always convert network buffers into
  TTY buffers.

  If a PPP implementation would be built on top of the new TTY layer
  (still needs a hooks layer, though), it would allow the PPP
  implementation to directly hand the data to the TTY driver.

- Improved hotplugging:

  With the old TTY layer, it isn't entirely safe to destroy TTY's from
  the system. This implementation has a two-step destructing design,
  where the driver first abandons the TTY. After all threads have left
  the TTY, the TTY layer calls a routine in the driver, which can be
  used to free resources (unit numbers, etc).

  The pts(4) driver also implements this feature, which means
  posix_openpt() will now return PTY's that are created on the fly.

- Improved performance:

  One of the major improvements is the per-TTY mutex, which is expected
  to improve scalability when compared to the old Giant locking.
  Another change is the unbuffered copying to userspace, which is both
  used on TTY device nodes and PTY masters.

Upgrading should be quite straightforward. Unlike previous versions,
existing kernel configuration files do not need to be changed, except
when they reference device drivers that are listed in UPDATING.

Obtained from:		//depot/projects/mpsafetty/...
Approved by:		philip (ex-mentor)
Discussed:		on the lists, at BSDCan, at the DevSummit
Sponsored by:		Snow B.V., the Netherlands
dcons(4) fixed by:	kan
2008-08-20 08:31:58 +00:00
Rui Paulo
de32615879 Fix typo in comment. 2008-08-19 22:28:24 +00:00
Ed Schouten
e5bfdc768a Don't include <sys/tty.h> in our sound layer. It is not needed.
The PCM's sound.h file only seems to include <sys/tty.h>, because
channel_if seems to require selinfo. Just replace it with
<sys/selinfo.h>.

There's no real problem with including <sys/tty.h> here, even with
MPSAFE TTY, but <sys/tty.h> is something that should be used by the TTY
layer, its driver and code that integrated it with the process tree.
2008-08-19 19:45:08 +00:00
Kevin Lo
ff52952636 Add the D-Link DWA-110
Tested by: Jonathan Lee <spamtrap at tczyhatczsche dot eu>
2008-08-19 01:44:56 +00:00
Kai Wang
5a288360c8 sc->sc_ibuf should be malloc'ed after quirks applied, as
sc->sc_isize might have changed.

MFC after:   3 days
2008-08-18 17:13:23 +00:00
Kai Wang
ed5b720b20 Fix a typo: According to the hid spec, Global item #3
is Physical Minimum.

MFC after:	3 days
2008-08-18 17:05:59 +00:00
Kai Wang
fef8fd9505 In the hid parser, if a INPUT/OUTPUT/FEATURE item is skipped, its
corresponding USAGE should be skipped as well.

For example, below is a report desc fragment of some mouse:

COLLECTION
...
USAGE TWHEEL
FEATURE ...
...
USAGE WHEEL
INPUT ...
...
END COLLECTION

"USAGE TWHEEL" should be consumed after the FEATURE item is skipped,
otherwise, the INPUT item will be assigned to "USAGE TWHEEL" later,
other than "USAGE WHEEL".

Tested by: 	  Grzegorz Blach
PR:    		  usb/125941
2008-08-18 16:48:53 +00:00
Kai Wang
f8b6bf0448 Re-add Microsoft Intellimouse 2.0 TWHEEL quirk.
Tested by:	Merritt Draney, Brian Cox
PR:		kern/123224
PR:		kern/123510
MFC after:	3 days
2008-08-18 16:29:13 +00:00
Takanori Watanabe
b76ca0451e Make it easy to comment out the part that use current tty layer directly.
(Handsfree interface)
I'll port the part to new tty layer after it has committed and
if I have spare time.
2008-08-18 11:56:13 +00:00
Kris Kennaway
891af7cfac Fix compile 2008-08-18 10:39:59 +00:00
Kevin Lo
8671b38b6c Add isochronous transfer support for USB 2.0
Obtained from:	NetBSD
2008-08-18 04:49:58 +00:00
Kip Macy
5d254c0494 Make sure that machine addresses are vm_paddr_t
MFC after:	1 month
2008-08-17 23:33:33 +00:00
Bjoern A. Zeeb
603724d3ab Commit step 1 of the vimage project, (network stack)
virtualization work done by Marko Zec (zec@).

This is the first in a series of commits over the course
of the next few weeks.

Mark all uses of global variables to be virtualized
with a V_ prefix.
Use macros to map them back to their global names for
now, so this is a NOP change only.

We hope to have caught at least 85-90% of what is needed
so we do not invalidate a lot of outstanding patches again.

Obtained from:	//depot/projects/vimage-commit2/...
Reviewed by:	brooks, des, ed, mav, julian,
		jamie, kris, rwatson, zec, ...
		(various people I forgot, different versions)
		md5 (with a bit of help)
Sponsored by:	NLnet Foundation, The FreeBSD Foundation
X-MFC after:	never
V_Commit_Message_Reviewed_By:	more people than the patch
2008-08-17 23:27:27 +00:00
Warner Losh
7e178674ff Update a comment about not numbering pci busses. This may soon be
OBE, but was sitting around in one of my trees for a while...
2008-08-17 17:34:07 +00:00
Warner Losh
e4e130244d Remove useless #if 1. 2008-08-16 21:51:54 +00:00
Warner Losh
abf07f13fd Add some sysctl reporting for most pci_pci bridges. We now report
domain, pribus (the primary bus, eg the bus that this chip is on),
secbus (the secondary bus, eg the bus immediately behind this chip)
and subbus (the number of the highest bus behind this chip).
Normally, this information is reported via bootverbose parameters, but
that's hard to use for debugging in some cases.

This adds reading of pribus to make this happen.  In addition, change
the narrow types to u_int to allow for easier reporting via sysctl for
domain, secbus and subbus.  This should have no effect, but if it
does, please let me know.
2008-08-16 20:18:40 +00:00
Ed Schouten
2e37c8eacb Convert the snp(4) driver to use cdevpriv.
Now we have a single /dev/snp device node, which can be opened by
watch(8) multiple times. Even though snp(4) will be dead as of next
week, it's nice having this in SVN, because:

- We may want to MFC it to RELENG_7.
- By the time we fix snp(4) again, it's already there, existing watch(8)
  binaries should already work.

Just like bpf(4), I'm adding a symlink from snp0 to snp to remain binary
compatible.
2008-08-15 13:07:07 +00:00
Philip Paeps
854d77bdd6 Introduce a new loader tunable "hw.ata.ata_dma_check_80pin", defaulting to 1.
This can be used to disable the 80pin cable check on systems which forget to
set the bit -- such as certain laptops and Soekris boards.

PR:		kern/114605 (somewhat reworked)
Submitted by:	marck
MFC after:	1 week
2008-08-15 10:55:11 +00:00
Kip Macy
f0c468df71 Compile fixes for xen build.
MFC after:	1 month.
2008-08-15 04:00:44 +00:00
Warner Losh
7e5dc2f88f Move wb driver from sys/pci to sys/dev/wb. 2008-08-14 21:26:29 +00:00
Warner Losh
5d5325f82c Move pcn driver from sys/pci to sys/dev/pcn. 2008-08-14 20:34:46 +00:00
Warner Losh
c8befdd5b6 Move the ste driver from sys/pci to sys/dev/ste. 2008-08-14 20:09:58 +00:00
Warner Losh
2bd7d759a6 Move the tl driver form sys/pci to sys/dev/tl. 2008-08-14 20:02:34 +00:00