Commit Graph

13073 Commits

Author SHA1 Message Date
Sam Leffler
fa20c23401 SampleRate rate control algorithm for the ath driver
Submitted by:	John Bicket
2005-03-11 01:39:57 +00:00
Warner Losh
8dce0b0cf8 Kill trailing white space 2005-03-10 22:21:16 +00:00
Warner Losh
530a692468 Fix a couple of problems with the probe code when used with pnpbios
resources.  When allocating 6 ports for a 4 port range isa code
returns an error.  I'm not sure yet why this is the case, but suspect
it is just a non-regularity in how the resource allocation code works
which should be corrected.  Use 1 as the ports size in this case.
However, in the hints case, we have to specify the length, so use 6 in
that case.  I believe that this is also acpi friendly.

Also, complain when we can't allocate FDOUT register space.  Right now we
silently fail when we can't.  This failure is referred to above.

When there's no resource for FDCTL, go ahead and allocate one by hand.
Many PNPBIOS tables don't list this resource, and our hints mechanism also
doesn't cover that range.  If we can't allocate it, whine, but fake up
something.  Before, we were always bogusly faking it and no one noticed
the sham (save the original author who has now fixed his private shame).
2005-03-10 18:09:25 +00:00
Scott Long
ab0d8702bf Bugger, wiped out a needed comma in the previous commit. 2005-03-09 00:54:55 +00:00
Scott Long
c1b677aa80 The DC driver asks for an alignment of PAGE_SIZE for data buffers, but also
asks that each buffer be (2048 * 256) bytes long.  I suspect that alignment
isn't a real requirement since busdma only recently started honoring it.  The
size is also bogus.  Fix both of these and stop busdma from trying to
exhaust the system memory pool with bounce pages.

Submitted by: Kevin Oberman
MFC After: 7 days
2005-03-08 23:25:46 +00:00
John Baldwin
18e6466b0f - If we fail to find an entry in the PRT, output a warning message.
- Fix a bug in the same condition where we forgot to drop the ACPI pcib
  lock.  This fixes hangs after the pcib0 attach on some machines.

Tested by:	sos (2)
2005-03-08 17:22:11 +00:00
Sam Leffler
0c97ab9691 reclaim mbuf chain when ieee80211_crypto_encap fails
Noticed by:	David Young
2005-03-08 17:01:03 +00:00
Ian Dowse
2f9b6e1f34 Fix the silly bug that prevented most EHCI interrupt transfers from
ever working correctly: the code was linking the QHs together but
then immediately overwriting the "next" pointers. Oops. Also
initialise qh_endphub, since the EHCI spec says that we should
always set the pipe multiplier field to something sensible.

This appears to make basic split transactions work, so enable split
transactions for control, bulk and interrupt pipes (split isochronous
transfers are not yet implemented). It should now be possible to
use USB1 devices even when they are connected through a USB2 hub.
2005-03-08 02:47:18 +00:00
Stefan Farfeleder
e68c6390f4 Prefer <sys/cdefs.h>'s __printflike() macro to the recently added
__GNUCLIKE_ATTRIBUTE_PRINTF.

Approved by:	mjacob
2005-03-07 15:29:11 +00:00
Maxime Henrion
40c20505a8 - Encapsulate the code responsible for initializing a new TX descriptor
from an mbuf into the fxp_encap() function, as done in other drivers.
- Don't waste time calling bus_dmamap_load_mbuf() if we know the mbuf
  chain is too long to fit in a TX descriptor, call m_defrag() first.
- Convert fxp(4) to use bus_dmamap_load_mbuf_sg().
2005-03-07 13:20:49 +00:00
Poul-Henning Kamp
3b3f38ed7d Add placeholder mutex argument to new_unrhdr(). 2005-03-07 11:05:47 +00:00
Bill Paul
58a6edd121 When you call MiniportInitialize() for an 802.11 driver, it will
at some point result in a status event being triggered (it should
be a link down event: the Microsoft driver design guide says you
should generate one when the NIC is initialized). Some drivers
generate the event during MiniportInitialize(), such that by the
time MiniportInitialize() completes, the NIC is ready to go. But
some drivers, in particular the ones for Atheros wireless NICs,
don't generate the event until after a device interrupt occurs
at some point after MiniportInitialize() has completed.

The gotcha is that you have to wait until the link status event
occurs one way or the other before you try to fiddle with any
settings (ssid, channel, etc...). For the drivers that set the
event sycnhronously this isn't a problem, but for the others
we have to pause after calling ndis_init_nic() and wait for the event
to arrive before continuing. Failing to wait can cause big trouble:
on my SMP system, calling ndis_setstate_80211() after ndis_init_nic()
completes, but _before_ the link event arrives, will lock up or
reset the system.

What we do now is check to see if a link event arrived while
ndis_init_nic() was running, and if it didn't we msleep() until
it does.

Along the way, I discovered a few other problems:

- Defered procedure calls run at PASSIVE_LEVEL, not DISPATCH_LEVEL.
  ntoskrnl_run_dpc() has been fixed accordingly. (I read the documentation
  wrong.)

- Similarly, the NDIS interrupt handler, which is essentially a
  DPC, also doesn't need to run at DISPATCH_LEVEL. ndis_intrtask()
  has been fixed accordingly.

- MiniportQueryInformation() and MiniportSetInformation() run at
  DISPATCH_LEVEL, and each request must complete before another
  can be submitted. ndis_get_info() and ndis_set_info() have been
  fixed accordingly.

- Turned the sleep lock that guards the NDIS thread job list into
  a spin lock. We never do anything with this lock held except manage
  the job list (no other locks are held), so it's safe to do this,
  and it's possible that ndis_sched() and ndis_unsched() can be
  called from DISPATCH_LEVEL, so using a sleep lock here is
  semantically incorrect. Also updated subr_witness.c to add the
  lock to the order list.
2005-03-07 03:05:31 +00:00
Scott Long
9ab2d898e7 Use correct flags for bus_dma_tag_create(). 2005-03-06 20:57:54 +00:00
Scott Long
70e83c0d6e Use the correct flags for bus_dma_tag_create(). 2005-03-06 20:56:16 +00:00
Poul-Henning Kamp
22a9eb5334 Always go to standby efter each call. 2005-03-06 19:43:12 +00:00
Poul-Henning Kamp
4e51c02840 Don't disable interrupts on a stray interrupt. 2005-03-06 19:42:32 +00:00
Nate Lawson
9956392d2c Whitespace nit. Clarifies which body this line belongs to. 2005-03-06 10:17:30 +00:00
Warner Losh
2966a60c0f Back out previous commit. The description didn't match the commit,
and marking this interrupt as fast isn't quite right.  It also needs
to be MP Safe, and I've not done that work (yet).
2005-03-06 06:59:15 +00:00
Warner Losh
12d4efa1b0 Use BUS_PROBE_DEFAULT 2005-03-06 06:55:11 +00:00
Maxime Henrion
74d1ed239b Cleanup: u_intXX_t -> uintX_t conversion. 2005-03-06 05:07:26 +00:00
Warner Losh
494f3ca182 Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 19:24:22 +00:00
Warner Losh
53ee71735f Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 19:06:12 +00:00
Warner Losh
538565c4a5 Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 18:30:12 +00:00
Warner Losh
b77e575e1d Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 18:17:35 +00:00
Warner Losh
6b9907e7f8 Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 18:10:49 +00:00
Maxime Henrion
29a8929dfa Add support for fxp(4) cards found in Sony FS570 laptops.
Submitted by:	Gavin Atkinson <gavin.atkinson@ury.york.ac.uk>
2005-03-05 13:52:28 +00:00
Marius Strobl
c90ff9ce5a - sparc64/fhc/fhc.c:
Change fhc(4) to use IRQ numbers instead of RIDs for allocating the
  IRQs of children. This works similar to e.g. sbus(4), i.e. add the
  IRQ resources as fully specified to the resource lists of the children,
  allocate them like normal. When establishing the interrupt search the
  interrupt maps of the children for a matching INO to determine which
  map we need to write the fully specified interrupt number to and to
  enable the mapping (before the RID was used to indicate which interrupt
  map to use).

- dev/puc/puc.c:
  Revert rev. 1.38, with the above change fhc(4) no longer needs special
  treatment for allocating IRQs.

Thanks to:	joerg for providing access to an E3500
2005-03-04 22:23:21 +00:00
Nate Lawson
5e517fee01 On i386 platforms at least, ACPI throttling is accomplished by the chipset
modulating the STPCLK# pin based on the duty cycle.  Since p4tcc uses the
same mechanism (but internal to the CPU), we triggered a hang on some
systems at low frequencies when both were in use.  Now, disable
acpi_throttle when p4tcc is also present.

Tested by:	Kevin Oberman
2005-03-04 18:59:54 +00:00
Scott Long
55a0283961 Fix the ioctl path by ensuring that amr_start1() gets called for commands
with no associated data.  Also revert previous changes that allocate off
of the stack instead of using malloc, as it's not needed.  Many thanks to
LSI for investigating and fixing these problems.

Submitted by: rajeshpr @ lsil . com
2005-03-04 06:11:00 +00:00
Nate Lawson
0716d65cef Check for some impossible frequencies that some systems use to indicate
they don't actually support Px states.
2005-03-04 05:29:56 +00:00
Maxime Henrion
6720ebcc9f Fix the panic recently reported on -current@ occuring when configuring
a vlan interface attached to a fxp(4) card when it has not been
initialized yet.  We now set the links from our internel TX descriptor
structure to the TX command blocks at attach time rather than at init
time.  While I'm here, slightly improve the style in fxp_attach().

PR:		kern/78112
Reported by:	Gavin Atkinson <gavin.atkinson@ury.york.ac.uk> and others
Tested by:	flz, Gavin Atkinson <gavin.atkinson@ury.york.ac.uk>
MFC after:	1 week
2005-03-03 00:22:59 +00:00
Joerg Wunsch
a5f50ef9e4 netchild's mega-patch to isolate compiler dependencies into a central
place.

This moves the dependency on GCC's and other compiler's features into
the central sys/cdefs.h file, while the individual source files can
then refer to #ifdef __COMPILER_FEATURE_FOO where they by now used to
refer to #if __GNUC__ > 3.1415 && __BARC__ <= 42.

By now, GCC and ICC (the Intel compiler) have been actively tested on
IA32 platforms by netchild.  Extension to other compilers is supposed
to be possible, of course.

Submitted by:	netchild
Reviewed by:	various developers on arch@, some time ago
2005-03-02 21:33:29 +00:00
Scott Long
a6b86949fc The existing locking in the esp driver appears to be fairly adequate, so
set the interrupt handler to be INTR_MPSAFE now that xpt_done() can be
called without Giant.  Giant is still on the top half of the driver and
the timeout handlers.
2005-03-02 15:56:42 +00:00
Scott Long
f7f3900b9f Clean up the botching of the previous repo-copy. Reference the included
headers from the correct location.

Submitted by: Tai-hwa Liang
2005-03-02 15:13:37 +00:00
Marius Strobl
2682e7b661 - Allocate the interrupt resource as RF_SHAREABLE allowing uart(4) to work
with shared IRQs in case the bus code, MD interrupt code, etc. permits.
  Together with sys/sparc64/sparc64/intr_machdep.c rev. 1.21 this fixes
  an endless loop in uart_intr() when using the second NS16550 on the ISA
  bus of sparc64 machines.
- Destroy the hardware mutex on detach and in case attaching fails.

Approved by:	marcel
2005-03-02 11:30:14 +00:00
David E. O'Brien
dad97fee58 Fix SCM ID's. 2005-03-02 09:22:34 +00:00
Scott Long
d38d9c9e5e Move all of the hptmv files to /sys/dev/hptmv so that they won't be mistaken
for being on a CVS vendor branch.  The files were moved via a repo-copy.
2005-03-02 05:14:28 +00:00
Nate Lawson
2d81061879 Protect acpivar.h with _KERNEL. No user parts inside currently. 2005-03-02 04:36:24 +00:00
Matthew N. Dodd
ae9d8a2668 When resubmitting a timed out request, reset donecount.
Submitted by:	  Nate Lawson <nate AT root.org>
2005-03-02 04:01:37 +00:00
Matthew N. Dodd
a50519ed08 Handle PIO timeouts in ata_end_transaction() by immediately returning.
Failure to do this will result in following ata_pio_read() calls walking
off the end of the read buffer.

This resolves the "memory modified after free" panics common with Thinkpads
and CD/DVD drives.

Submitted by:	 Nate Lawson <nate AT root.org>
2005-03-02 03:59:28 +00:00
Matthew N. Dodd
6bacdeb7e0 In ata_generic_reset() while waiting for both master & slave to become
idle the 'mask' variable could be set to 0, resulting in the timeout loop
running for the full 31 seconds.

Handling this case eliminates long hangs on resume on some systems.

Submitted by:		Nate Lawson <nate AT root.org>
2005-03-02 03:34:51 +00:00
Marius Strobl
e12405280b - Fix braino introduced in rev. 1.17, unlike the X1032A (HME-ISP1040-combo)
and the X1034A (quad HME; QFE) cards the X1033A (single HME) don't have a
  PCI-PCI-bridge so we can't rely on the PCI slot number being useable as
  index for the network address to read from the VPD on the latter. Use
  the end tag to determine whether it is a QFE VPD with 4 NAs and only use
  the slot number as index in this case.
- Remove a useless check.

Prodded by:		joerg
Additional testing by:	joerg
MFC after:		1 day
2005-03-02 00:49:37 +00:00
Warner Losh
d2b677bb1a Use BUS_PROBE_DEFAULT in preference to 0 and BUS_PROBE_LOW_PRIORITY in
preference to some random negative number to allow other drivers a
bite at the apple.
2005-03-01 08:58:06 +00:00
Maxim Sobolev
21a69c81c0 Merge from NetBSD.
o usb_subr.c, add delta 1.119:

  Move usb_get_string() and make it public.

o usbdi.c, bring on par with 1.106, this includes:

  - Make an iterator abstraction for looping through all descriptors.

  - Whine about not being able to figure out default language if we are debugging.

  - Move usb_get_string() and make it public.

o usbdi.h, bring on par with 1.64, this includes:

  - Make an iterator abstraction for looping through all descriptors.

  - Move usb_get_string() and make it public.

o usbdi_util.c, bring on par with 1.42, this includes:

  - Add usbd_get_protocol().

  - Use NULL instead of 0.

  - Fix (mostly harmless) typo.

  - Move utility routine from uirda.c to usbdi_util.c.

o usbdi_util.h, bring on par with 1.31, this includes:

  - Add usbd_get_protocol().

  - Move utility routine from uirda.c to usbdi_util.c.

MFC after:	3 days
2005-03-01 08:01:22 +00:00
Warner Losh
2ece8174c1 Use BUS_PROBE_DEFAULT in preference to 0. Also for vx, return
BUS_PROBE_LOW_PRIORITY in stead of ifdef for devices that xl and vx
both support so that xl will snarf them on up.
2005-03-01 07:50:12 +00:00
Maxim Sobolev
d524bc1aa1 Sync with 1.9 from NetBSD, this includes:
o Add Ethernet descriptor.

o Use attribute packed for on-the-wire data structures.

MFC after:	3 days
2005-03-01 06:35:04 +00:00
Ian Dowse
528433ba71 Save and restore the VGA state across a suspend-resume cycle. This
is particularly useful when VESA is available (either `options VESA'
or load the vesa module), as BIOSes in some notebooks may correctly
save and restore LCD panel settings using VESA in cases where calling
the video BIOS POST is not effective. On some systems it may also
be necessary to set the hw.acpi.reset_video sysctl to 0.
2005-02-28 21:06:14 +00:00
Bill Paul
55fc1315ca Use 0 instead if NULL for vm_offset_t argument to windrv_lookup() to
silence compiler warnings.
2005-02-28 16:47:54 +00:00
Poul-Henning Kamp
62da7a2d68 Add missing () 2005-02-28 13:49:06 +00:00
Nate Lawson
a885159fea Protect against multiple includes and use _KERNEL to protect the PCI fns. 2005-02-28 05:39:34 +00:00
Pyun YongHyeon
a7e943a456 Add missing va_end() in fdc_cmd.
0 -> NULL in arguments of fdc_sense_int().

Reminded by:	joerg
2005-02-28 05:14:45 +00:00
Warner Losh
af5e97c122 There were two calls to cardbus_do_cis when cardbus_do_cis changed,
yet I only changed one of them.  So when we loaded drivers, we'd fail
to allocate resources correct.

This pointed out that we were doing the wrong thing when we failed to
attach a child.  We released all the resources and almost deleted the
child.  Instead, we should keep the resources allocated so when/if a
driver is loaded, we can go w/o having to allocate them.  We use
pci_cfg_save/restore to restore the BARs with these resources.

This seems to fix the problems that we were seeing that I thought
might have magically gone away in the last revision of cardbus.c (but
really didn't).

Noticed by: avatar (nicely done!)
2005-02-28 01:27:24 +00:00
Warner Losh
c3c08f307c Expose pci_cfg_safe/restore for subclasses of pci to use. 2005-02-28 01:14:15 +00:00
David E. O'Brien
bb4e63066a Add FreeBSD ID. 2005-02-28 00:53:29 +00:00
Matthew N. Dodd
c58d5e62ad Use mss_{format,speed}() rather than chn_set{format,speed}() and hold
mss lock across call.

This allows my Thinkpad 600E to resume with the sound driver loaded and
vchans enabled.
2005-02-27 23:32:21 +00:00
Poul-Henning Kamp
4db0fda84e Use dynamic major number allocation. 2005-02-27 22:19:35 +00:00
Poul-Henning Kamp
80602ed932 Use dynamic major number allocation. 2005-02-27 22:17:51 +00:00
Poul-Henning Kamp
92d4c5d082 Use dynamic major number allocation. 2005-02-27 22:16:58 +00:00
Poul-Henning Kamp
e70377df79 Use dynamic major number allocation. 2005-02-27 22:16:30 +00:00
Poul-Henning Kamp
78b7c8d68d Use dynamic major number allocation. 2005-02-27 22:11:02 +00:00
Poul-Henning Kamp
3f8bb25bd0 Use dynamic major number allocation. 2005-02-27 22:01:09 +00:00
Poul-Henning Kamp
7ce296cf04 Remove debug printout of major/minor numbers, print name instead. 2005-02-27 21:16:26 +00:00
Marius Strobl
d74b306146 The zs(4) driver is superseded by uart(4) and broken in -CURRENT. Remove
it from the sparc64 kernel config files and delete its fhc(4) and sbus(4)
front-end.

Agreed with:	marcel
2005-02-27 15:23:58 +00:00
Maxime Henrion
93b6e2e6ff Fix a stupid bogon from myself, sc->revision wasn't initialized when
testing it to know whether we should enable the 82503 serial mode...
Move code to the right location and disallow the use of the 82503
serial mode if the sc->revision field is 0 again.  This makes fxp(4)
work correctly with ATMEL 350 93C46 cards (3 port 82559 based with a
82555 PHY), as well as with the older ATMEL 220 93C46 (same flavour)
and with the even older 10Mbps-only 82557 cards with the 82503 serial
interface.

Tested by:	Andre Albsmeier <andrer@albsmeier.net>, krion
MFC after:	2 weeks
2005-02-27 15:12:50 +00:00
Olivier Houchard
4ac78327de Add device id for the Ali M1671 host to AGP bridge. 2005-02-27 13:05:34 +00:00
Nate Lawson
97d31723e7 Make a pass through all drivers checking specs for desired behavior on
SMP systems.  It appears all drivers except ichss should attach to each
CPU and that settings should be performed on each CPU.  Add comments about
this.  Also, add a guard for p4tcc's identify method being called more than
once.
2005-02-27 02:43:02 +00:00
Nate Lawson
f81de92f96 Don't bother with cpufreq_register if we're info-only.
Suggested by:	Jung-uk Kim
2005-02-26 22:09:05 +00:00
Sam Leffler
ff69096233 plug memory leak
Noticed by:	Coverity Prevent analysis tool
2005-02-26 18:55:53 +00:00
Sam Leffler
729a4dd7f9 move ptr deref's to after null checks
Noticed by:	Coverity Prevent analysis tool
2005-02-26 18:52:54 +00:00
Marius Strobl
099894cc96 Declare the sbus(4) front-end of puc(4) also for fhc(4), allowing
uart(4) to support the Zilog 8530 SCCs which hang off of a FireHose
bus on Sun E4000/E5000 class machines.
Beside the fact that a puc_fhc.c would just be a copy of puc_sbus.c
with s,sbus,fhc,g the reason why the declaration for fhc(4) was
sticked into puc_sbus.c is that both of these front-ends for puc(4)
will go away once there is a scc(4).

Discussed with:	marcel
Tested by:	hrs, kris
MFC after:	3 days
2005-02-26 00:25:43 +00:00
Marius Strobl
ad11db7c28 Add a stopgap allowing puc(4) to allocate IRQs on fhc(4). Given that
both a scc(4) is under way and fhc(4) will be change to use INOs this
shouldn't stay in HEAD for too long but we need a MFC-able solution
for FreeBSD 5.4.

Discussed with:	marcel
Tested by:	hrs, kris
MFC after:	3 days
2005-02-26 00:22:52 +00:00
Marius Strobl
e1e33cb261 Remove duplicate FBSDID. 2005-02-26 00:21:25 +00:00
Sam Leffler
aedaf6e272 kill unused variable
Noticed by:	Coverity Prevent analysis tool
2005-02-25 23:15:48 +00:00
Nate Lawson
ac8671f18f Remove unused variable.
Noticed by:	Coverity tool
2005-02-25 22:01:58 +00:00
Sam Leffler
72046dcea3 avoid null ptr deref
Noticed by:	Coverity Prevent analysis tool
Reviewed by:	scottl
2005-02-25 21:57:46 +00:00
Sam Leffler
d40b07dfe4 o avoid potential null ptr deref if symbol lookup fails
o unload module if symbol lookup fails

Noticed by:	Coverity Prevent analysis tool (null ptr deref)
Reviewed by:	bms, imp, dwhite
2005-02-25 20:50:20 +00:00
Sam Leffler
f111c2680b fail gracefully rather than using an invalid array index if unable
to allocate a bar; it's unclear whether this can happen in practice

Noticed by:	Coverity Prevent analysis tool
Discussed with:	marcel
2005-02-25 19:47:18 +00:00
Nate Lawson
f45fc848c5 Instead of assuming units of bytes, it seems more likely that this is
a bitfield.
2005-02-25 16:57:34 +00:00
Sam Leffler
a768e28bd5 plug memory leak
Noticed by:	Coverity Prevent analysis tool
Reviewed by:	emax
2005-02-25 03:41:11 +00:00
Bill Paul
5d7b952561 Correct e-mail address in copyright. 2005-02-25 02:36:23 +00:00
Sam Leffler
c01f36ef0c avoid sneaky double free
Noticed by:	Coverity Prevent analysis tool
Reviewed by:	scottl
2005-02-25 00:16:53 +00:00
Bill Paul
d80e940c3c Apparently, the probe routine in if_ndis_usb.c can be called twice
for a given device in some circumstances, so move the PDO creation
to the attach routine so we don't end up creating two PDOs.

Also, when we skip the call to ndis_convert_res() in if_ndis.c:ndis_attach(),
initialize sc->ndis_block->nmb_rlist to NULL. We don't explicitly zero
the miniport block, so this will make sure ndis_unload_driver() does
the right thing.
2005-02-24 22:54:15 +00:00
Warner Losh
d24ae19d0e Fix style(9) issues with __P removal.
Noticed by: bde
2005-02-24 22:33:05 +00:00
Bill Paul
63ba67b69c - Correct one aspect of the driver_object/device_object/IRP framework:
when we create a PDO, the driver_object associated with it is that
  of the parent driver, not the driver we're trying to attach. For
  example, if we attach a PCI device, the PDO we pass to the NdisAddDevice()
  function should contain a pointer to fake_pci_driver, not to the NDIS
  driver itself. For PCI or PCMCIA devices this doesn't matter because
  the child never needs to talk to the parent bus driver, but for USB,
  the child needs to be able to send IRPs to the parent USB bus driver, and
  for that to work the parent USB bus driver has to be hung off the PDO.

  This involves modifying windrv_lookup() so that we can search for
  bus drivers by name, if necessary. Our fake bus drivers attach themselves
  as "PCI Bus," "PCCARD Bus" and "USB Bus," so we can search for them
  using those names.

  The individual attachment stubs now create and attach PDOs to the
  parent bus drivers instead of hanging them off the NDIS driver's
  object, and in if_ndis.c, we now search for the correct driver
  object depending on the bus type, and use that to find the correct PDO.

  With this fix, I can get my sample USB ethernet driver to deliver
  an IRP to my fake parent USB bus driver's dispatch routines.

- Add stub modules for USB support: subr_usbd.c, usbd_var.h and
  if_ndis_usb.c. The subr_usbd.c module is hooked up the build
  but currently doesn't do very much. It provides the stub USB
  parent driver object and a dispatch routine for
  IRM_MJ_INTERNAL_DEVICE_CONTROL. The only exported function at
  the moment is USBD_GetUSBDIVersion(). The if_ndis_usb.c stub
  compiles, but is not hooked up to the build yet. I'm putting
  these here so I can keep them under source code control as I
  flesh them out.
2005-02-24 21:49:14 +00:00
Warner Losh
d701c91325 Return BUS_PROBE_DEFAULT instead of 0. 2005-02-24 21:32:56 +00:00
Hartmut Brandt
99f0c33243 Split the chip-specific code from the generic Utopia code. This simplifies
adding of new physical chips. Now one just needs to add a .h and a .c
file for the new chip and add one line to utopia.c for that chip.
2005-02-24 16:56:36 +00:00
Sam Leffler
183551b925 plug resource leak
Noticed by:	Coverity Prevent analysis tool
Reviewed by:	scottl
2005-02-24 02:24:24 +00:00
Sam Leffler
7e53be277f remove gratuitous null ptr check
Noticed by:	Coverity Prevent analysis tool
2005-02-24 02:06:22 +00:00
Sam Leffler
c2235096d7 o nuke duplicate call of dpt_free when dpt_init fails
o nuke gratuitous null ptr check; softc can never be null in this routine

Noticed by:	Coverity Prevent analysis tool
Reviewed by:	mdodd
2005-02-24 02:03:55 +00:00
Nate Lawson
2fe912df6b If a register width is less than 8, assume the BIOS author thought it was
in units of bytes and adjust accordingly.  This is found at least on the
Sony PCG-505BX.
2005-02-23 03:20:00 +00:00
Warner Losh
d118c9a5fb Belkin F5D5020 is an OEM'd card from RACORE based on the AX88190
chipset.  Add support for this card.  Office Max has them on sale and
I was surprised that we didn't have it in our supported list when I
plugged it in...
2005-02-22 22:07:18 +00:00
Warner Losh
f5e40295aa Add a stratigic newline 2005-02-22 22:03:52 +00:00
John Baldwin
af2b9fec22 Add a entry for the Compaq R3000Z to indicate that it has the weird MADT
IRQ 0 quirk.
2005-02-22 21:54:20 +00:00
John Baldwin
373dd87688 - Add a new quirk to indicate that pin 0 of the first I/O APIC is really
IRQ 0 and not an ExtINT pin.  The MADT enumerators ignore the PC-AT flag
  and ignore overrides that map IRQ 0 to pin 2 when this quirk is present.
- Add a block comment above the quirks to document each quirk so that we
  can use more verbose descriptions quirks.

MFC after:	2 weeks
2005-02-22 21:52:52 +00:00
Warner Losh
eb01f10be1 Minor style nits missed in earlier passes 2005-02-22 18:58:34 +00:00
Sam Leffler
6d4548de49 remove dead code (inside a DEBUG ifdef)
Submitted by:	Coverity Prevent analysis tool
2005-02-22 18:57:18 +00:00
Poul-Henning Kamp
d5469a8ba5 Neuter DRM(mapbufs) until somebody finds time to try to fix it.
It is _never_ OK to find a vnode from a struct cdev because you have
no way of telling if you get the right one.  You might be in jail or
chroot for instance.
2005-02-22 13:56:15 +00:00
Nate Lawson
0db8fa8984 Increase the maximum to wait for a transition from 1 to 10 ms. In some
modes, systems may take longer.  If the status values don't match, try
matching just the lowest 8 bits if no bits above 8 are set in the desired
value.  The IBM R32 has other bits set in the status register that are
irrelevant to the expected value.
2005-02-22 06:34:53 +00:00
Nate Lawson
0dc1b976eb Support disabling individual cpufreq drivers with hints, e.g.,
hint.ichss.0.disabled="1"
2005-02-22 06:31:45 +00:00
Warner Losh
b2948b72e9 MFp4: Optimize in/out macros. Cache the handle and tag in softc and
use them in the macros.  Since the rman_get_bus{tag,handle} transitioned
from macros to function calls, this unpessimizes that conversion.
2005-02-22 05:12:25 +00:00
Warner Losh
b093da40fb Minor optimization of calling enable_16bit. We always have to call it
and error is going to be right for both forks of the if, so just
return that.
2005-02-22 03:37:04 +00:00
Nate Lawson
a1adf35e65 Set the start of the cooling time later on, when we're actually performing
the switch.  Other interim tests (i.e., for minimum runtime) could
invalidate the start time.  This fixes transitions to cooler states in that
now they go to the next active state (_AC0 -> _AC1) instead of going
straight to off (_AC0 -> off).

Submitted by:	Alexandre "Sunny" Kovalenko (Alex.Kovalenko / verizon.net)
2005-02-22 00:40:13 +00:00
Nate Lawson
1395b555de Since the GPE handler is directly called by ACPI-CA and it may have unknown
locks held, specify the ACPI_ISR flag to keep it from acquiring any more
mutexes (which could potentially sleep.)  This should fix "could sleep"
warning messages on the following path:

    msleep()
    AcpiOsWaitSemaphore()
    AcpiUtAcquireMutex()
    AcpiDisableGpe()
    EcGpeHandler()
    AcpiEvGpeDispatch()
    AcpiEvGpeDetect()
    AcpiEvGpeDetect()
    AcpiEvSciXruptHandler()
2005-02-21 23:38:41 +00:00
Max Laier
473156220d Only send packet to bpf if we are committed to send it. Previously it was
possible that the same packet would show up multiple times.  This poses some
constraints on the TBD locking for snc(4) (see comment).

Obtained from:	DragonFlyBSD
Submitted by:	Joerg Sonnenberger
Reviewed by:	rwatson
2005-02-21 17:30:10 +00:00
Warner Losh
040cba413a Minor style(9)isms. 2005-02-21 07:22:50 +00:00
Scott Long
5f2657119e - Remove dead code.
- Protect against negative values as array indexes.

Submitted by: Coverity Prevent analysis tool
2005-02-21 05:17:29 +00:00
Scott Long
b21e62e35a Check for BIOS version 3.0 as well as 3.1.
Submitted by: Coverity Prevent analysis tool
2005-02-21 00:32:03 +00:00
Nate Lawson
a47331bb73 Don't attach ichss if est is present. On systems that seem to support both,
the multi-setting EST is preferable.
2005-02-20 23:41:20 +00:00
Warner Losh
509cfe6fb0 Be more verbose on errors with CIS reading. This should be a noop, but
appears to fix the ath problem that had been reported.  I don't see how
it can, so there's likely some other hidden bug.
2005-02-20 20:36:16 +00:00
Warner Losh
164b196506 style(9) nit 2005-02-20 20:32:44 +00:00
Warner Losh
57be6dcf4c Fix merging botch I made in last version. 2005-02-20 19:59:29 +00:00
Warner Losh
df889dba95 Perliminary support for Fujitsu SCSI LAN combo card. At least for the
LAN side of things.  It appears that all that's necessary is to relax
the check on the DLCR2 register in the probe.
2005-02-20 19:40:29 +00:00
Warner Losh
8600638b4c Back out part of 1.23. This was a work in progress to support the
Fujitsu LAN SCSI card's ethernet side.
2005-02-20 19:38:38 +00:00
Warner Losh
2f3ed70a98 Forced commit after moving mb86960.h from i386/isa/ic to dev/fe. It
is only used by the fe driver, and isn't MD.
2005-02-20 19:33:13 +00:00
Warner Losh
b38c5039bd Minor optimizations to compile out bits that aren't necessary when
certain options aren't enabled.

Submitted by: Chiharu Shibata-san (chi at bd mbn or jp)
2005-02-20 18:44:45 +00:00
Warner Losh
0bc7d522b1 Minor style(9) tweaks. 2005-02-20 18:39:54 +00:00
Warner Losh
89c8738b67 Correct typo in comment.
Submitted by: Chiharu Shibata-san (chi at bd mbn or jp)
2005-02-20 18:24:09 +00:00
Marius Strobl
6ff81db1a7 Add a note that all four HME chips on a SUNW,qfe card share the same PROM,
making it a bit more clear why we can read four NAs from the VPD.

MFC after:	1 day
2005-02-20 01:52:43 +00:00
Nate Lawson
28d7170f1c Add a new field to struct cf_setting for special values. These are driver-
specific values that other components may want to use.  Add support to
acpi_perf(4) to export the control and status values via this field.
2005-02-19 06:13:26 +00:00
Warner Losh
2daa7a07ae For the I/O port case, we need to set ok to 1 if we have what looks
like a valid range.  We already do this in the memory case (although
the code there is somewhat different than the I/o case because we have
to deal with different kinds of memory).  Since most laptops don't
have non-subtractive bridges, this wasn't seen in practice.

Evidentally the Compaq R3000 hits this problem with PC Cards.

Some minor style fixes while I'm here.

Submitted by: Jung-uk Kim
2005-02-18 17:35:03 +00:00
Nate Lawson
e94a0c1a18 Introduce a new method, cpufreq_drv_type(), that returns the type of the
driver.  This used to be handled by cpufreq_drv_settings() but it's
useful to get the type/flags separately from getting the settings.
(For example, you don't have to pass an array of cf_setting just to find
the driver type.)

Use this new method in our in-tree drivers to detect reliably if acpi_perf
is present and owns the hardware.  This simplifies logic in drivers as well
as fixing a bug introduced in my last commit where too many drivers attached.
2005-02-18 00:23:36 +00:00
Warner Losh
e8c3bb6966 memspace is set to some value by masking off bits. When these bits
are equal to PCCARD_TPCE_FS_MEMSPACE_NONE, memspace will be zero, so
testing for this case inside of the if statement results in dead code.
We'd fail to set a value to zero that's already zero (since it is
initialized to 0 indirectly) with this code being there.  Well, except
in the very rare case that we have a card that has a defualt entry
that includes a memory space followed by one that has no memory space
(these are extremely rare, I don't recall ever having seen one :-).

Fix this by setting num_memspace to 0 in a more appropriate place.

Submitted by: Coverity Prevent analysis tool
2005-02-17 21:05:04 +00:00
Vinod Kashyap
7a824c3756 Undoing recent changes to make 3ware's i386 tools work on amd64, since there are
now amd64 versions of CLI and 3DM2 available.
2005-02-17 19:05:42 +00:00
Nate Lawson
8f118e25ec Check for the address space type first before validating it. In particular,
we want to return EOPNOTSUPP for FFixedHW no matter what the address.

Submitted by:	Bruno Ducrot
2005-02-17 19:00:14 +00:00
Warner Losh
711c07db68 Fix the support for the ax88[17]90 to print the right type, rather
than the generic ne-2000 string.  This should have no effect on the
actual support of the parts, just reporting what the part was.

Also, rename a few functins and symbols to reflect a more generic
part support that grew out of the early specific support.
2005-02-17 18:15:13 +00:00
Nate Lawson
ededc31dd1 The correct error value for not having enough storage is E2BIG, not
ENOMEM.  The manpage and ichss(4) are correct.
2005-02-17 01:02:58 +00:00
Nate Lawson
6655857ec7 Fix the check for acpi_perf(4) so that we verify if it is fully attached
or just offering info.  In the former case, we don't probe/attach to allow
the ACPI driver precedence.  A refinement of this would be to actually
use the info provided by acpi_perf(4) to get the real CPU clock rates
instead of estimating them but since all systems that support both
acpi_perf(4) and ichss(4) export the control registers to acpi_perf(4),
it can just handle the registers on its own.
2005-02-17 01:01:40 +00:00
Justin T. Gibbs
cb29ab3392 aic79xx.c:
aic7xxx.c:
	Allow print_reg() to be called with a NULL column.

aic79xx.c:
	Correct new usage of SCB_GET_TAG().

aic7xxx.c:
	Fix stray ahd that snuck in here.
2005-02-16 23:13:38 +00:00
Justin T. Gibbs
05899a48a7 On Rev. B silicon, we disabled the enhanced busfree detection logic to
close holes in detecting busfrees that occur after a packetized target
transitions to a non-packetized phase.  The most common case where this
occurs is when a target is externally reset so the controller believes
a packetzied negotiation agreement is still in effect.  Unfortunately,
disabling this feature seems to cause problems for the 7901B.  Re-enable
ehanced busfree detection for this part until I can get my hands on a
samble to figure out if the old workaround is necessary and, if so, how
to make it work correctly.
2005-02-16 18:16:35 +00:00
Justin T. Gibbs
3db6c642f5 MF5S: Explicitly initialize timedout_scb lists, use SCB_TAG for all access
to the hardware_scb->tag field, limit max lun reported to CAM to 63,
      return after a panic to silence a warning.
2005-02-16 18:09:41 +00:00
Warner Losh
8e325e2991 On second though, print the OUI, model and revision. This is the same
information that's in the id1 and id2 fields we were using, but is in
a form that the drivers will be using in their matching routines.
2005-02-16 05:56:39 +00:00
Bill Paul
d8f2dda739 Add support for Windows/x86-64 binaries to Project Evil.
Ville-Pertti Keinonen (will at exomi dot comohmygodnospampleasekthx)
deserves a big thanks for submitting initial patches to make it
work. I have mangled his contributions appropriately.

The main gotcha with Windows/x86-64 is that Microsoft uses a different
calling convention than everyone else. The standard ABI requires using
6 registers for argument passing, with other arguments on the stack.
Microsoft uses only 4 registers, and requires the caller to leave room
on the stack for the register arguments incase the callee needs to
spill them. Unlike x86, where Microsoft uses a mix of _cdecl, _stdcall
and _fastcall, all routines on Windows/x86-64 uses the same convention.
This unfortunately means that all the functions we export to the
driver require an intermediate translation wrapper. Similarly, we have
to wrap all calls back into the driver binary itself.

The original patches provided macros to wrap every single routine at
compile time, providing a secondary jump table with a customized
wrapper for each exported routine. I decided to use a different approach:
the call wrapper for each function is created from a template at
runtime, and the routine to jump to is patched into the wrapper as
it is created. The subr_pe module has been modified to patch in the
wrapped function instead of the original. (On x86, the wrapping
routine is a no-op.)

There are some minor API differences that had to be accounted for:

- KeAcquireSpinLock() is a real function on amd64, not a macro wrapper
  around KfAcquireSpinLock()
- NdisFreeBuffer() is actually IoFreeMdl(). I had to change the whole
  NDIS_BUFFER API a bit to accomodate this.

Bugs fixed along the way:
- IoAllocateMdl() always returned NULL
- kern_windrv.c:windrv_unload() wasn't releasing private driver object
  extensions correctly (found thanks to memguard)

This has only been tested with the driver for the Broadcom 802.11g
chipset, which was the only Windows/x86-64 driver I could find.
2005-02-16 05:41:18 +00:00
Warner Losh
aa4c3a8cd3 Add location and PNP info to the mii bus 2005-02-16 01:08:43 +00:00
Warner Losh
1a0c32073e Add an XXX comment about string quoting. 2005-02-16 01:03:30 +00:00
Ruslan Ermilov
20710e9f5f Initialize Netgraph type at a correct time, before device probing. 2005-02-15 18:41:21 +00:00
Ruslan Ermilov
7b6fe3a4c2 Remove an outdated comment about ifnet not being locked.
OK'ed by:	njl, rwatson, sam
2005-02-15 17:47:57 +00:00
Warner Losh
33d2d65419 Use ANSI function definitions, in preference to the K&R definitions. 2005-02-15 06:02:34 +00:00
Warner Losh
77ab642f58 Remove more deadwood that never got implemented in NEWCARD, since NEWCARD
went a different direction than was anticipated when these compatibility
shims were added.
2005-02-15 02:54:53 +00:00
Warner Losh
206189067d Move the harvesting of the MAC address out of the generic novell probe
and into the bus front ends.  For ISA and C-BUS cards, we always need
to grab it.  For PC Card, already committed, we need to do some sanity
checking on the data that's in the ROMs before we decide that they are
OK to use.  The PC Card code has already been committed and is
independent of this code (which also has to work on NE-1000 cards,
assuming that those cards still work :-).
2005-02-14 23:00:41 +00:00
Warner Losh
16c52c1000 Move the #defines from edreg to edvar which don't have anything to do
with talking to the hardware.
2005-02-14 22:28:51 +00:00
Warner Losh
b658387fbd o It turns out that most of the ne-2000 cards that I have got real unhappy
with the latest changes.  They actually have valid ROM data at location
  0 of memory, just like a real NE-2000 ISA card.  Use this data, if
  the ROM passes a few basic tests, as an additional source for the MAC
  address.  Prefer the CIS over this source, but have it take precidence
  over falling back to reading the attribtue memory.
o Minor cleanup of a few devices that we match on based on CIS string.
2005-02-14 22:27:03 +00:00
Eric Anholt
9271f7b6d5 Correct the SiS 755 PCI ID. Confirmed against Linux code.
PR:		kern/76411
Submitted by:	Jonathan Fosburgh, jonathan at fosburgh dot org
Obtained from:	Jung-uk Kim, jkim at niksun.com
2005-02-14 07:30:04 +00:00
Eric Anholt
ba16275b9f No use for this AMD64 special-case "return NULL;" in probe now that we don't
do fake "generic" support.
2005-02-14 07:16:25 +00:00
Warner Losh
78ac8a9391 Remove card_get_function. It looks like it was intended to be a
bridge between OLDCARD and NEWCARD for drivers to inquire after the
function number (eg, 0, 1, 2).  Nobody ever used it, so retire it
with honors.  NEWCARD never implemented it, and the same information
can be obtained by the pccard_get_function_number().

MFC After: 3 days
2005-02-14 07:00:39 +00:00
Warner Losh
3302cab184 Rework DL10019/DL10022 support. This tries to reset things in a more
proper way, or at least the same way that NetBSD and Linux do things
(I've been unable to obtain datasheets for these parts to know for
sure).  This has some marginal improvement in the DL10022 and DL10019
cards that I have.  Also, report which type, exactly.

# There's one or two ed cards that I have which still don't work, but I think
# that's due to MII losage on the card that's not presently compensated
# for in the MII drivers.
2005-02-14 06:54:06 +00:00
Warner Losh
f3fe05f878 MFp4: Merge in AX88790 support from my p4 tree. I've had this in my
tree since 2003/02/20, and I recently cleaned it up.  I'd even closed
the PR that I obtained this from Fri Jul 18 23:25:08 MDT 2003 since
I looked at my p4 tree.

PR: 46889
Submitted by: HASEGAWA Tomoki
2005-02-14 06:47:22 +00:00
Warner Losh
f8d201b879 Add some comments in preparation for converting bcopy/bzero to busspace.
Minor style nits.
2005-02-14 06:27:23 +00:00
Warner Losh
1ab733644b MFP4: Optimize the layout of softc somewhat. This groups the u_chars
into larger sections.  I'd like to move to having a flags word, but I
need to make sure that there's no adverse locking problems.
2005-02-14 06:25:06 +00:00
Ian Dowse
e0a4f554be Abort any active transfers when the device detaches. This fixes a
few situations where we used to crash, but by no means all of them.
2005-02-14 02:17:53 +00:00
Ian Dowse
d83604e89a Add a new function usbd_abort_default_pipe() that aborts any transfers
on the default pipe. This is helpful in device detach routines to
stop any active control transfers.
2005-02-14 01:51:51 +00:00