Commit Graph

25640 Commits

Author SHA1 Message Date
tsutsui 42731279ac Use roundup2() macro to calculate cache line aligned offsets of
DMA descriptor members in shared memory.
The previous ones could return wrong values if cache line size is
smaller than structures, and we can assume cache line size is
power of two to avoid division ops.
2009-05-09 03:50:16 +00:00
tsutsui 0eda417b19 Move allocation of DMA shared memory with bus_dma(9) ops
from MD attachments to MI iee_attach().
Tested on HP9000 735/125. Compile test only on ews4800mips.

XXX: more strict bus_dmamap_sync(9) calls are required in various places.
2009-05-09 03:22:20 +00:00
elad b853042065 Introduce actions/requests to handle authorization for ppp(4), sl(4),
strip(4), btuart(4) and bcsp(4) network interfaces and devices.

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html
2009-05-07 18:01:56 +00:00
mjacob 30611ba7e0 update firmware 2009-05-07 15:55:18 +00:00
mjacob c83986a8bd Add firmware set for 8Gb card. 2009-05-07 15:54:20 +00:00
skrll 7ab26758f5 device_t/softc split
struct device * -> device_t
struct cfdata * -> cfdata_t
Use aprint*

There are a couple of MI drivers with MD attachments left.
2009-05-07 15:34:49 +00:00
rjs 4179d32aff Use device_private(). 2009-05-07 13:06:11 +00:00
cegger bc33dc599e struct device * -> device_t, no functional changes intended. 2009-05-07 12:15:33 +00:00
cegger 2641fe2fb7 struct device * -> device_t
comment says, first argument of audiobell is a device, so make it a device.
2009-05-07 09:23:01 +00:00
cegger ed4086f2eb struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-07 09:13:13 +00:00
cegger 5496566c68 struct device * -> device_t, no functional changes intended. 2009-05-07 09:11:42 +00:00
cegger 6ee74bfd56 struct device * -> device_t, no functional changes intended. 2009-05-07 08:03:23 +00:00
cegger 602c27254b use device_private() 2009-05-07 07:56:03 +00:00
cegger 930db79c5b struct device * -> device_t, no functional changes intended. 2009-05-07 07:33:05 +00:00
jdc c10e3b28bd Add extra counter definitions (pointed out by Geoff Wing). 2009-05-07 06:46:54 +00:00
cegger 73144fe522 device_t/softc split
patch presented on tech-kern@, no comments on it
2009-05-07 06:08:02 +00:00
ad b5dc34151d Unneeded LK_CANRECURSE. 2009-05-06 22:38:42 +00:00
jdc 6e8d1a982c Check for internal PHY first, so that it always attaches first, even when
we have an MII transeiver attached.
Count all collision and error counters.
Handle counter overflow and RXTERR.

Tested on U60 HME, PCI HME (501-5019) and SBus Sunswift (501-2739)
2009-05-06 20:40:19 +00:00
elad 105d9a093d Replace curlwp->l_cred with kauth_cred_get().
Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/05/05/msg005038.html
2009-05-06 18:41:54 +00:00
cegger af1172fad0 device_t/softc split
tested by jakllsch@
2009-05-06 18:25:28 +00:00
cegger a591bc88dd struct device * -> device_t, no functional changes intended. 2009-05-06 10:34:32 +00:00
cegger 6b9f9b8644 use device_private() 2009-05-06 09:32:52 +00:00
cegger 59717d7121 struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-06 09:25:14 +00:00
cegger 3261738b4d struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-06 08:20:49 +00:00
cegger 6d542a9a5c add KASSERT to identify when PR kern/40734 happens again.
It happened to me twice and to Emmanuel Dreyfus (reported on port-amd64 ML)
2009-05-06 07:27:42 +00:00
mrg a35a651446 you can now easily select trying external drm with "options DRM_EXTERNAL". 2009-05-06 01:33:24 +00:00
macallan 08f5b97b95 clear screen on attach 2009-05-05 23:55:04 +00:00
cegger 52b1d2aee7 struct cfdata * -> cfdata_t 2009-05-05 21:47:49 +00:00
dyoung e470d88889 Change struct cfdata * to cfdata_t. No functional change intended. 2009-05-05 21:34:13 +00:00
cegger 4474fa75b2 device_t/softc split
tested by and ok dyoung@
2009-05-05 21:33:21 +00:00
elad b50c4b9e09 Add device scope actions for rnd(4) and use them.
Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004953.html
2009-05-05 21:03:28 +00:00
msaitoh b25f90b108 Doesn't print error message only when the register is BGE_SRS_MODE.
It occurs on some environment (and once after boot?). Other *BSDs and
Linux don't print the error message for all registers.
2009-05-05 18:08:28 +00:00
tsutsui 1ad413250a Add support for i82596 Rev A chip which doesn't have the enhanced 32 bit
big endian mode:
- add IEE_REV_A flag to indicate if chip support the 32 bit BE mode or not
- add IEE_SWAPA32() macro and use it on necessary 32 bit DMA pointers
- rename IEE_SWAP() macro for the SCP address pointer and statistics
  counters which require word swap even on Rev B/C chips to IEE_SWAP32()
  for clarification
- add comments about these BE mode quirks

Tested on HP9000 735/125 by me and also tested on 715/50 by skrll@
with netbsd-5 branch, and fixes MI part of PR port-hp700/35531.
2009-05-05 15:47:35 +00:00
nonaka 6cb21f59ee Added NE2000 with 8bit bus width support.
reviewd by tsutsui@ at tech-kern ML.
2009-05-05 12:37:24 +00:00
cegger 06e69f3860 struct device * -> device_t 2009-05-05 12:10:07 +00:00
cegger f2bccc0a8e struct device * -> device_t, use device_private() 2009-05-05 12:07:15 +00:00
cegger 73af259591 Attach on BCM5709 chip.
XXX Firmware fails to complete initialization on this chip.
2009-05-05 10:21:22 +00:00
cegger dc97f7f624 print autoconf error message with aprint_error 2009-05-05 10:02:52 +00:00
cegger 6a970ea21d device_t/softc split 2009-05-05 09:51:23 +00:00
manu c328d568d4 TFTPROOT loads the RAMdisk through TFTP at boot time. It needs the
network to be functionnal, and therefore must be called after
config_finalize(). Unfortunately, config_finalize() attaches md0
through mdattach(), and when tftproot_getfile() attempts to attach it
later by calling mdattach() again, it gets a failure.

This change checks for the RAMdisk size in mdattach(). If it is zero, then
the RAMdisk has not been loaded yet, and nothing is done. It will be
attached later when tftproot_getfile() will call mdattach()
2009-05-04 16:20:41 +00:00
markd a44286a718 Treat G4X like I915 and G33 for MSAC. Fixes aperture setting.
Has been working successfully for me and snj for the last few months.
2009-05-04 11:05:45 +00:00
tsutsui cf78f721dd Make COM_RING_SIZE configurable by kernel config(5). 2009-05-03 13:52:36 +00:00
tsutsui 8fa3bb31fc Remove unused sc_rev settings (all quirks are handled by sc_quirk)
and merge HWREV cases which have the same quirks.
2009-05-03 13:49:07 +00:00
dyoung 85d5fd7b83 In pccbb_pci_callback(), set CBB_SPECMAPPED in sc_flags if we've
acquired bus space from bus_space_alloc(9) or from rbus_space_alloc(),
so that we use the appropriate routine to release the bus space in
pccbbdetach().  This stops panics during cbb(4) detachment (esp. at
shutdown) on some systems.

Thanks to Kurt Schreiner for testing the fix, Kurt, Patrick Welche,
Pouya D. Tafti, and Matt Green for reporting.
2009-05-03 00:31:12 +00:00
martin 1e54487f2a Correct previous: detaching uhubN makes the bus pointer NULL 2009-05-02 22:28:41 +00:00
martin 9b2932709e If we are unlucky, during detach of child devices, after a uhub has detached,
our uhci_poll_hub callout might strike. The detaching of the uhub has left
the device member in the pipe NULL, so make sure we do not dereference it.

We could halt the callout before detaching child devices, but it this
would likely interfere with proper servicing the child devices while
they are still around.
2009-05-02 22:09:39 +00:00
oster 62f6e89480 Fix assignment of SUsPerPU and add SUsPerRU assignment. Reported by
and fix from Anthony Mallet in PR#41328.  Thanks!
2009-05-02 21:11:26 +00:00
dyoung aaa0eb2937 Use device_t, cfdata_t, device_private(). 2009-05-01 20:43:41 +00:00
martin cb13eee90c Add missing braces - patch from Kurt Lidl in PR port-vax/41314. 2009-05-01 03:18:20 +00:00
nonaka a6a538b335 compile again. 2009-05-01 00:15:57 +00:00
dyoung ee9d8d96c8 Straggler from last vnd(4) commit: #define VNF_CLEARING. 2009-04-30 22:36:10 +00:00
dyoung c968789de1 Flesh out vnd_detach(). Let the system detach vnd(4) at shutdown. Stop
vnd_ioctl(VNDIOCCLR) from racing with vndopen() to call vndclear().
2009-04-30 20:34:08 +00:00
dyoung b44d7cdf40 Fix spelling. if( -> if (. No functional change intended. 2009-04-30 16:38:12 +00:00
dyoung 114a99200c Use NULL instead of (type *)0. Delete extraneous parentheses. No
functional change intended.
2009-04-30 16:07:50 +00:00
skrll 51d0553d6a Regen (again) 2009-04-30 15:14:49 +00:00
skrll 6cc4b39756 Add another NS product found in hppa machines. 2009-04-30 15:13:58 +00:00
skrll 9763c0c6d8 Regen. 2009-04-30 15:07:44 +00:00
skrll c026dcb4aa Add the National Semiconductor PC87560 Legacy IO chip on systems with
PA-8500 and later 64-bit CPUs.
2009-04-30 15:03:30 +00:00
tsutsui f6e36a0172 Pull some changes for newer chips from FreeBSD:
- pull MACSTAT and CMDSTOP quirks for 8168/8111 chips
- always set CPLUSCMD_PCI_MRW on reset
- set VLANSTRIP and RXCSUM_ENB bits on CPLUS register per if_capenable

Tested on 8111C and 8111D by several users, and
no bad side effect on my old 8169S.
2009-04-29 15:10:57 +00:00
dyoung d446e68bf2 Use device_t, cfdata_t, and device_private(). 2009-04-28 22:43:50 +00:00
ginsbach 6be6867d6d Regen for Mellanox additions. 2009-04-28 14:32:43 +00:00
ginsbach ea30fa5024 Add Mellanox Technologies Infiniband devices. 2009-04-28 14:27:16 +00:00
tsutsui da88f224b7 Remove magic reset sequence except wakeup for rev 2 chips which breaks 8111D.
Problem reported and fix confirmed by Thomas Bieg on current-users.

Also tested on 8111C (no bad side effect) by several users privately.
2009-04-28 13:25:17 +00:00
cegger a4aa7dace4 on detach, deregister from pmf 2009-04-28 11:49:15 +00:00
cegger 9bb7df81f0 on detach, deregister from pmf and free resource 2009-04-28 11:47:56 +00:00
tsutsui 9998edcec4 Wrap one more printf() with #ifdef DEBUG, which was missed on rev 1.52. 2009-04-27 14:52:50 +00:00
tsutsui 70dab57692 Always make local functions static. Local symbols are still preserved
on link by ld(1) with -X option on most ports for debug.
2009-04-26 16:17:08 +00:00
nonaka 35df2d384d fix build broken.
Pointed by Takeshi Nakayama.
2009-04-26 13:05:55 +00:00
cegger 2cae64a195 check error code from bwi_attach() 2009-04-26 10:45:19 +00:00
cegger 394d81abd5 fix error handling 2009-04-26 10:26:54 +00:00
cegger 57fb22a89c device_t/softc split 2009-04-26 10:07:48 +00:00
cegger c6c48498e2 prepare device_t/softc split 2009-04-26 09:56:46 +00:00
cegger 32e56df1e0 u_intNN_t -> uintNN_t 2009-04-26 09:47:31 +00:00
cegger 60326e09a5 - Fix error handling in attachment
- use aprint_*_dev
2009-04-26 09:12:33 +00:00
cegger 1ab9e723df detach ohci on shutdown 2009-04-26 08:54:13 +00:00
cegger c398d65d42 Fix error handling. 2009-04-26 08:46:10 +00:00
elad 03d23b4d6b Authorizing actions from the generic scope using a device scope wrapper
is a big no-no.

As painful as it is, use kauth_authorize_generic() for now.
2009-04-26 07:53:43 +00:00
nonaka 9445e9e796 Added some command definitions. 2009-04-26 07:21:13 +00:00
cegger c1bf5ecbc4 age_intr: don't return w/o ack. the interrupt.
Add a comment when this special case can happen.
2009-04-26 07:01:29 +00:00
cegger f8c09ed139 fix error handling in lii_attach()
ok jmcneill@
2009-04-26 06:56:46 +00:00
tsutsui d7ac09b75f - use (uint8_t *) for RX buffer
- remove unnecessary pointer casts
2009-04-26 02:25:57 +00:00
pgoyette 5dd6c0425b When drm is compiled in only for PCI devices, agp_flush_cache() is not
defined.  Wrap the call to it with #ifndef DRM_NO_AGP to avoid link
errors.
2009-04-26 02:23:26 +00:00
tsutsui 378ce951b9 Use roundup2() macro. 2009-04-25 18:27:39 +00:00
tsutsui 76e4602ef6 Add RCS Id. 2009-04-25 17:04:40 +00:00
tsutsui be608a6ecc Regen from pcidevs rev 1.983:
> Tweak some Realtek re(4) device names.
2009-04-25 15:30:17 +00:00
tsutsui 0ea749c026 Tweak some Realtek re(4) device names. 2009-04-25 15:29:18 +00:00
tsutsui 90c44cfe77 Remove suffix "B" from rtk_name of PCI_PRODUCT_REALTEK_RT8168 devices.
All 8168/8111 variants (8168/8168B/8168C/8168CP/8168D/8111B/8111C/8111CP)
have the same PCI device ID.
2009-04-25 06:16:12 +00:00
jakllsch abf7e840eb Add Microchip PICkit 1 to HID blacklist. 2009-04-24 14:16:50 +00:00
jakllsch e75d76046a regen. 2009-04-24 14:07:36 +00:00
jakllsch 1cdfeda3ef Add Microchip Technology vendor ID and two PICkit device IDs thereof. 2009-04-24 14:06:22 +00:00
macallan c7d8ba2450 Add wscons support 2009-04-23 20:46:49 +00:00
kefren 02190332dd Add power hooks. Proposed a couple of days ago on tech-kern@, no
objections received. Tested on Dell Inspiron 2200 with BCM4318
2009-04-23 20:24:23 +00:00
msaitoh e447a613d9 use proplib 2009-04-23 10:47:43 +00:00
msaitoh 278d80cb78 remove obsolete code. 2009-04-23 10:43:31 +00:00
kefren 62e6076ccd Add pmf hooks. Proposed two days ago on tech-kern@, no objections.
Tested on amd64 with Asus P5Q-E mainboard with onboard Yukon Lite
2009-04-23 09:18:25 +00:00
cube 418489f555 Regen. 2009-04-21 16:36:06 +00:00
cube 25c5d062fb Add a number of products that use Realtek's RTL8187 802.11 chip. 2009-04-21 16:34:41 +00:00
taca aa7979227e Add support for USB serial adapter REX-USB60F which I tested. 2009-04-21 16:26:01 +00:00
taca 90b2a1c26b Regen. 2009-04-21 16:24:37 +00:00
taca 663028896a Add product id for RATOC USB serial adapter REX-USB60F. 2009-04-21 16:23:36 +00:00
tsutsui 34ef135b8c Fix wrong arguments of bus_dmamem_free(9).
XXX: not all resouces are freed properly on error path in age_dma_alloc().
2009-04-21 13:16:36 +00:00
nonaka e1c4491975 regen 2009-04-21 03:10:41 +00:00
nonaka e0297d1ead Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.
2009-04-21 03:00:29 +00:00
rafal a566e67fbe Rework scatter / gather page allocation inspired by r186295 of FreeBSD SVN:
rework drm_scatter.c which allocates scatter / gather pages for use by
    ati pci gart to use bus_dma to handle the allocations.  This fixes
    a garbled screen issue on at least some radeons (X1400 tested).  It is
    also likely that this is the correct fix for PR# 119324, though that
    is not confirmed yet.

Fixes similar issues on a Radeon Mobility X300, non-Mobility X800 (including
a hard-lock of the machine).

With feedback from ad@, ok mrg@
2009-04-21 01:15:37 +00:00
cegger 85620a64b2 Add ale(4), a driver for Attansic/Atheros L1E gigabit ethernet device.
Ported by me from OpenBSD, improvements from Kevin Lahey,
successfully tested by Kevin Lahey and Stephen Borrill.
2009-04-20 20:10:23 +00:00
mschuett 0d53a16d76 Add queue macros SLIST_FOREACH_SAFE, STAILQ_FOREACH_SAFE, STAILQ_LAST,
SIMPLEQ_CONCAT, and SIMPLEQ_LAST.

Remove seperate definitions outside of queue.h.
2009-04-20 09:56:07 +00:00
ad e2c5e0a204 In this case "XXX free other data structures XXX" includes stopping and
destroying the callout.
2009-04-19 12:32:52 +00:00
msaitoh 3322726436 regen. 2009-04-19 11:18:07 +00:00
msaitoh 2449d3efc1 Oooops. Back out some of previous my commit. 2009-04-19 11:17:46 +00:00
msaitoh 4d9e9f6912 Some fixes and enhancements:
Both if_bge* and brgphy.[ch]:
    Check the parent's MAC and use the quirk code for the bug like OpenBSD and
    FreeBSD. Some bugs can't identify the PHY ID. For example, 5704 Ax has the
    ADC bug, but 5704 A3 and 5704 B0 have the same PHY ID and revision. Add
    BGE_PHY_CRC_BUG, BGE_PHY_ADC_BUG, BGE_PHY_5704_A0_BUG, BGE_PHY_JITTER_BUG,
    BGE_PHY_ADJUST_TRIM and BGE_PHY_BER_BUG for this flag. Some of the DSP
    patches are newly taken from OpenBSD and FreeBSD.

  if_bge*:
    Remove duplicated BGE_CHIPID_BCM5714_A0 entry in the known CHIPID table.
    Fix obsolete comments.

  brgphy.[ch]:
    Add some PHY IDs.

TODO:
  Add more three quirk code into bge and brgphy (the brgphy side's are
  currently #if0'ed).
  Add support for bnx into brgphy (currently #if0'ed)
2009-04-19 11:10:36 +00:00
msaitoh 559b0165b6 Add mii_mpd_rev to keep MII PHY revision. 2009-04-19 10:47:48 +00:00
msaitoh ed6e698500 regen 2009-04-19 10:25:48 +00:00
msaitoh a57ebfe2e5 Add some boradcom's PHYs.
Sort.
2009-04-19 10:25:25 +00:00
tsutsui d24f7d6156 Revert bcopy -> memcpy change inside #ifdef BCOPY_FASTER block. 2009-04-18 15:04:26 +00:00
tsutsui d779b85d3e Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
2009-04-18 14:58:02 +00:00
cegger 217d969936 Initialize callout and lists before we check for errors.
This fixes crashes in ohci_detach() when ohci_init() failed.
2009-04-18 06:27:17 +00:00
dyoung 2e016b467d Bug fix: don't release the Rx DMA maps twice. 2009-04-17 23:23:23 +00:00
dyoung 64670508f7 Detach pcppi0 at isa0 during shutdown. 2009-04-17 20:46:37 +00:00
christos dbbba1ac10 appease gcc 2009-04-17 20:32:27 +00:00
dyoung 9c07c1c9a8 Detach audio(4) during shutdown. 2009-04-17 20:04:35 +00:00
dyoung a3a7e82760 Use device_t instead of 'struct device *' or device_ptr_t. Use cfdata_t
instead of 'struct cfdata *'. Delete some gratuitous parentheses.
2009-04-17 19:44:13 +00:00
cegger 7844441cd2 backout rev. 1.112. I was misleaded by the wrong pci(9) manpage. 2009-04-17 19:04:20 +00:00
joerg 95021059eb Move initialisation of the irq spinlock into the device handling code,
at least the Intel driver depends on it whether the IRQ is currently
enabled or not.
2009-04-17 19:02:33 +00:00
cegger 7bd8016175 pci_activate() wants a softc and not a device 2009-04-17 18:43:53 +00:00
dyoung 40bf52a73b Disable interrupts on the h/w before disestablishing the PCI interrupt
handler.
2009-04-17 17:31:01 +00:00
dyoung d792f4788e Disable interrupts on the h/w before detaching the interrupt
handler.  Protects against the problem described in
<http://mail-index.netbsd.org/port-i386/2009/04/10/msg001317.html>,
Xintr_ioapic_levelN jumps to 0 during shutdown.
2009-04-17 17:21:31 +00:00
cegger adee6ed051 check return code of tlp_attach() 2009-04-17 16:57:37 +00:00
tsutsui 25e0185c3d Check revisions and print names of i82551/i82551ER, per Intel manual. 2009-04-17 15:37:43 +00:00
cegger 5f4ec2a0a9 change tlp_attach() to return an error code on failure. 2009-04-17 15:22:35 +00:00
cegger 0cdcfeb162 set dmamap to NULL when bus_dmamap_create() fails to prevent bus_dmamap_destroy to be called with an invalid dmamap in error path. 2009-04-17 15:16:52 +00:00
cegger bb95b8c8db Free resources in error path.
While here, fix copy&paste error I introduced in rev. 1.108.
2009-04-17 14:07:32 +00:00
cegger 65e67e65cc use aprint_* 2009-04-17 13:15:53 +00:00
cegger f52d4b8ffb Detach tlp(4) during shutdown.
Free unused resources on attachment.
2009-04-17 12:59:19 +00:00
cegger c455042514 device_t/softc split. Tested with tlp at pci 2009-04-17 10:20:32 +00:00
cegger dc79b83a9a struct device * -> device_t
u_intNN_t -> uintNN_t
2009-04-17 08:30:55 +00:00
cegger bb47f93acf use device_private 2009-04-17 08:19:09 +00:00
cegger 4815538f3f struct device * -> device_t
u_intNN_t -> uintNN_t
2009-04-17 08:04:49 +00:00
macallan 9757abaa0c use sparc_bus_map_large() to map the I128 framebuffer 2009-04-16 17:00:39 +00:00
tsutsui 89de08c2ca - remove a redundant decl of boothowto; it's in <sys/systm.h>
- replace a magic number passed to format_bytes(9) with explicit strings
- some KNF
2009-04-16 14:46:33 +00:00
tsutsui a8ca89b280 Some cosmetics in rxcsum code. Tested on i386. 2009-04-16 14:39:11 +00:00
tsutsui 04a4566ade u_intNN_t -> uintNN_t 2009-04-16 14:08:18 +00:00
tsutsui 390140016b - remove an extra decl of cn_tab, which is in <dev/cons.h>
- some KNF
2009-04-16 12:57:22 +00:00
tsutsui 859579fb10 There is a report that 82559ER doesn't have RX hardware checksum support
(even though it has a newer revision number than 82559_A0),
so handle it separately per its own PCI device ID.
2009-04-16 12:41:51 +00:00
msaitoh 8dc86612ab Take some code from FreeBSD and OpenBSD:
Fix some bugs that the driver unable to detect link loss (OpenBSD 1.135,
  FreeBSD 1.102)

  bge_tick(): fix some extra input error (OpenBSD 1.221 FreeBSD 1.212)

  Acknowledge link change interrupts by setting the 'link changed' bit
  in the status register (used to have no effect). FreeBSD 1.44 (OpenBSD 1.21)

  Add some fiber support (OpenBSD 1.220)

  Set BGE_MISCCFG_KEEP_GPHY_POWER as {Open,Free}BSD and linux.

  Add special case code to fix a problem with the BCM5704 in TBI mode
  (FreeBSD rev. 1.71, OpenBSD rev. 1.35)

  Force an interrupt in bge_ifmedia_upd (FreeBSD rev. 1.205, OpenBSD rev.
  1.242)

  Add missing workaround for 5705 (FreeBSD rev. 1.44, OpenBSD rev. 1.21)

  Add some known CHIPID entries.
2009-04-16 01:38:34 +00:00
msaitoh e8e69d0b8b Fix the case of setting a flag in BGE_PCI_DMA_RW_CTL (on conventional PCI)
again.
2009-04-16 01:35:24 +00:00
elad 2d1c968399 Remove a few KAUTH_GENERIC_ISSUSER in favor of more descriptive
alternatives.

Discussed on tech-kern:

	http://mail-index.netbsd.org/tech-kern/2009/04/11/msg004798.html

Input from ad@, christos@, dyoung@, tsutsui@.

Okay ad@.
2009-04-15 20:44:24 +00:00
dyoung 773ba4e409 Delete two unused data members, the powerhook and the shutdownhook
handles.
2009-04-14 20:17:15 +00:00
haad 33e2a4a918 Destroy locks in dm_dev_free, do not allocate struct disk twice. 2009-04-13 18:51:54 +00:00
haad a650e4b356 Update to reality. 2009-04-13 16:12:27 +00:00
tsutsui bd151a8481 Assume an unknown HWREV chip has the same features with the latest one. 2009-04-13 12:38:06 +00:00
tsutsui b684e4d8b1 Add HWREV of RTL8102EL variant. From FUKAUMI Naoki. 2009-04-13 12:33:05 +00:00
tsutsui f231bee40e Add HWREV values of RTL8168CP and RTL8168D. From FreeBSD.
XXX: needs more quirk handling after wakeup for newer chips.
2009-04-13 12:28:46 +00:00
tsutsui bd78a7580b Don't immediately switch UTP/AUI ports on lost carrior.
It may take a while for modern switches to set 10baseT media.
2009-04-12 11:10:28 +00:00
christos 86ba58fd64 Fix locking as Andy explained. Also fill in uid and gid like sys_pipe did. 2009-04-11 23:05:26 +00:00
christos b859fbe7cb Fix PR/37878 and PR/37550: Provide stat(2) for all devices and don't use
fbadop_stat.
2009-04-11 15:47:33 +00:00
dyoung 1e6430c160 Use a PMF shutdown hook instead of shutdownhook_establish(). This ought
to stop the crash during shutdown that yamt@ reports in kern/41182.
2009-04-10 17:36:42 +00:00
mlelstv 485e52e2b3 attach and detach do not mix.
Create a new detach function that calls the parent function after
dealing with the private instance counter.
2009-04-10 10:18:50 +00:00
joerg 892f4bbba1 sprintf -> snprintf 2009-04-08 12:39:27 +00:00
dyoung 222f7adf37 Refactor slightly to create acpi_rescan(), a hook for rescanning the
devices that attach at acpi(4).

Begin deriving an acpi(4) device-detachment hook, acpi_detach(), from
acpi_attach().  The code between #if 0 and #endif still needs to be
turned to the opposite calls (enables to disables, maps to unmaps,
attaches to detaches), which should be run in the opposite order.
Somebody with deep ACPI knowledge can probably finish this off without
too much trouble.
2009-04-08 00:23:30 +00:00
dyoung 5b0576e7eb Add acpitimer_detach() to eventually support acpi(4) detachment. 2009-04-08 00:15:45 +00:00
dyoung 99084a32b0 Decrease midi_pcppi_attached when midi at pcppi detaches. 2009-04-08 00:12:27 +00:00
dyoung 1de2a73134 Make pcppi(4) detach the "speaker" from attimer(4), so that the
corresponding attimer(4) resource is not perpetually busy: now it
is possible to detach and to reattach pcppi(4).  Make attimer(4)'s
device-detachment hook return EBUSY if pcppi(4) is still attached, so
that pcppi(4) cannot end up with a dangling pointer to attimer(4).
2009-04-07 22:30:09 +00:00
dyoung 3afac3e189 Fix spelling: mak -> make. 2009-04-07 21:49:36 +00:00
dyoung 00644496f7 Fix spelling: indrect -> indirect. 2009-04-07 21:48:46 +00:00
msaitoh eb993d20f8 Reload sc_ctrl in wm_reset().
Add an ICH10 entry.

Remove some obsolete comments.
2009-04-07 18:42:30 +00:00
msaitoh e1c695ebf8 regen 2009-04-07 18:41:06 +00:00
msaitoh 0712fe9fe0 add 82801J_D_BM_LF (ICH10) 2009-04-07 18:40:39 +00:00
dyoung 3098a4fbed Detach atapibus(4), scsibus(4), cd(4), and sd(4) during shutdown.
Destroy sd->sc_callout in sddetach().  Delete some dead code in
cddetach().
2009-04-07 18:35:17 +00:00
dyoung 18789e2def Detach midi at pcppi during shutdown. Sprinkle static. 2009-04-07 18:31:12 +00:00
dyoung b429c26fd3 Detach ehci(4) and uhci(4) at shutdown. 2009-04-07 18:25:26 +00:00
msaitoh c52bc69c89 Fix about TBI mode. This fix doesn't influence MII mode.
- Fix SWDPIN(1)'s polarity on some chips.
 - Fix flow control stuff (includes PR#32009).
 - Stop RXCFG storm. It ocours easily.
 - And more fix about autonego.

Tested on PRO/1000F, PRO/1000XF and PRO/1000 MF.
2009-04-07 18:23:37 +00:00
msaitoh 0855c70d27 Fix about TBI mode. This fix doesn't influence MII mode.
- Fix panic in mediachange.
 - Fix SWDPIN(1)'s polarity on some chips.
 - Fix flow control stuff (includes PR#32009).
 - Stop RXCFG storm. It ocours easily.
 - And more fix about autonego.

Tested on PRO/1000F, PRO/1000XF and PRO/1000 MF.
2009-04-07 18:23:36 +00:00
dyoung 227c03169a Detach uhub(4) and usb(4) at shutdown. 2009-04-07 18:15:45 +00:00
dyoung 2e264f4086 Destroy a scsipi_xfer's callout before putting it back into the pool. 2009-04-07 18:10:45 +00:00
dyoung f26cbc49c7 Destroy sc->bnx_timeout in bnx_detach(). 2009-04-07 18:07:10 +00:00
dyoung 63a5e91969 Detach brgphy(4) at shutdown. 2009-04-07 18:05:54 +00:00
dyoung 03c2f978e8 In mii_phy_detach(), destroy the NWay callout. 2009-04-07 18:05:02 +00:00
dyoung 336480339e Cosmetic: remove some dead code. 2009-04-07 18:02:04 +00:00
dyoung 29e95e3d5f Cosmetic: flag a potential problem in ata_channel_attach():
it initializes a callout that does not appear to be destroyed
anywhere. Every callout_init() should ordinarily be matched by a
callout_destroy().
2009-04-07 18:01:20 +00:00
dyoung 1fb1e79dd5 During shutdown, detach attimer at acpi. 2009-04-07 17:59:18 +00:00
dyoung 2df4d68fc5 Declare mididetach() for use by midi0 at pcppi0. 2009-04-07 17:55:55 +00:00
dyoung 6a72962b6c Cosmetic: in a debug statement, use "%s", __func__ instead of a
misspelling of the detach routine's name.
2009-04-07 17:54:58 +00:00
stacktic ea41759011 Add Realtek ALC663 and treat like ALC662 (ok pooka@) 2009-04-07 14:47:53 +00:00
haad ba7fcfeeb5 Use functions from disk(9) framework. Initialize disk/disklabel during
dm_device_create_ioctl, before calling dmgetdisklabel.
Use disk_busy/disk_unbusy in dmstrategy to display LVM LV's in iostat
output.
2009-04-06 22:58:10 +00:00
haad 57fb98e3bf Fix build on amd64. Patch sent by dieter roelants. 2009-04-06 22:48:26 +00:00
mkirby ff12b9febc Add a Czech (QWERTY) keyboard layout, and teach wscons about latin 2 characters.
Original code from Lubomir Kundrak, adapted to current and cleaned up by me.

Fixes PR kern/16216

ok agc@ jdc@
2009-04-06 17:32:09 +00:00
cegger 56ce1b94f8 buildfix: include <sys/device.h> for device_t 2009-04-05 09:56:16 +00:00
cegger b61989a8ff buildfix: include <sys/selinfo.h> for struct selinfo. 2009-04-05 08:33:04 +00:00
uwe 6a2ffc8f1b Provide pmf(9) hooks that do what dopowerhooks(9) hook does.
XXX: Do NOT call pmf_class_network_register() yet, b/c db8320.c
doesn't provide if_stop method!
2009-04-05 03:37:07 +00:00
uwe 4e37bb5a9c Register with pmf(9), tell it we don't need anything. 2009-04-05 02:29:40 +00:00
uwe b22b1f73c6 Register with pmf(9), tell it we don't need anything. 2009-04-05 02:17:18 +00:00
uwe fd239c627a Register with pmf(9). Thus we register with both dopowerhooks(9) and
pmf(9), but they are mutually exclusive (apm(4) vs apmdev(4)).

Express pmf(9) hooks in terms of dopowerhooks(9) hook - the reverse
would be more natural, but pmf hook signature is hidden behind
PMF_FN_ARGS/PMF_FN_CALL, so just go the least intrusive way for now.
2009-04-05 02:14:41 +00:00
uwe 2ec6410a85 Register with pmf(9), tell it we don't need anything. 2009-04-05 02:04:40 +00:00
uwe 12a9718711 Split device_t and softc. 2009-04-05 01:48:47 +00:00
uwe fe0f5148ae Register with pmf(9), tell it we don't need anything.
btnmgr(4) is just a hub for other devices to plug into with
config_hook(9), there is no real hardware to manage.
2009-04-05 00:34:42 +00:00
ad c6367674d6 Add fileops::fo_drain(), to be called from fd_close() when there is more
than one active reference to a file descriptor. It should dislodge threads
sleeping while holding a reference to the descriptor. Implemented only for
sockets but should be extended to pipes, fifos, etc.

Fixes the case of a multithreaded process doing something like the
following, which would have hung until the process got a signal.

thr0	accept(fd, ...)
thr1	close(fd)
2009-04-04 10:12:51 +00:00
ad 481ff5ace4 Fix problems with ccd:
- Pending async I/O was tossed on unconfigure (should not happen, but..)
- It could exhaust memory under heavy I/O load.
- If memory allocation failed, disk transfers could stall.
- v_numoutput was updated without v_interlock held.

Additionally:

- Make it MPSAFE.
- Use kmem_alloc().
2009-04-04 08:29:39 +00:00
dyoung 211e21b653 Stop dereferencing a dangling device_t pointer and crashing: skip the
drives flagged DRIVE_ATAPI in atabus_activate(,DVACT_DEACTIVATE) just as
we skip them in atabus_detach() and in atabus_childdetched().

Make atabus_detach() parallel attachment more closely by calling
config_detach() on the child chp->ata_drives[i] instead of on
chp->ch_drive[i].drv_softc.  Assert that ata_drives[i] and
ch_drive[i].drv_softc are equal, and set them both to NULL in
atabus_childdetached().
2009-04-03 21:31:08 +00:00
sborrill 5547ed1734 Switch various printfs from %ld and %d to PRIu64, etc. to be more consistent
about types (for instance uint32_t was being printed with %d).
2009-04-03 16:23:41 +00:00
uwe 30f9f983a3 Use dev/apm/files.apm for APM options in opt_apm.h.
Now both apm and apmdev files.apm can be included so you can switch
from apmdev0 to apm0 at hpcapm0 in your kernel config easily.
2009-04-03 05:01:09 +00:00
uwe 82442fe367 Treat OAPM_IOC_GETPOWER as APM_IOC_GETPOWER - from apmdev(4). 2009-04-03 04:25:40 +00:00
uwe c03d662b39 Config glue for attaching apm at apmdevif.
Unfortunately dev/apm/files.apm and dev/hpc/apm/files.apm cannot be
included both at the same time (they define same options and config(1)
complains), so you need to comment out old code and uncomment new code
to be able to replace "apmdev0 at hpcapm0" with "apm0 at hpcapm0" in
your kernel config.
2009-04-03 04:21:51 +00:00
uwe ea06597b80 Attachment glue to attach apm0 at hpcapm0.
Tested on Jornada 690.
2009-04-03 04:17:03 +00:00
uwe 9a25b0cb7f Switch apmdev to use apm(4) structures from dev/apm/apmvar.h.
Add batteryid argument to aa_get_powstat method implementations.
2009-04-03 04:13:17 +00:00
uwe 7cbde2c0d5 Further reduce diffs to dev/apm/apm.c.
Bring over remaining bits of logic not picked up in the first round.
Main semantic difference between the two that ramins is now basically
powerhooks vs. pmf.

Cosmetics to reduce diff noise: split apmattach into apmdevattach and
apm_attach, where the latter matches its counterpart in the real
apm.c.  Change local macros names from APMDEV* to APM*

Now that apmdev.c is demonstrably congruent to apm.c it should be
easier to switch hpc* and zaurus ports to apm.c from apmdev.c.
apmdev.c is one of the only two remaining drivers that call
dopowerhooks(9), the other one being arch/arm/xscale/pxa2x0_apm.c.

Ideally I would prefer for them to be interchangeable to smooth the
transition (in pmf world order *all* devices must have pmf hooks
registered), but they are attached differently - apmdev is separate
from its backend device (like hpcapm), while apm.c backends are
attachment glue, not separate devices.
2009-04-03 02:08:38 +00:00
dyoung 8f20e30696 Fix SIOCSIFFLAGS. Mark as safe to detach at shutdown. 2009-04-03 00:14:42 +00:00
dyoung 30156f20e6 Cosmetic changes, only, to clarify and to save a couple of lines: return
a constant, 0, instead of returning ret when it is always 0.  Wait to
initialize ret until we really need to.
2009-04-02 01:06:49 +00:00
dyoung b783d8bd8c Add the WEP capability to our net80211 capability flags, since we do
sort of support hardware WEP.  Only change the WEP key index in a Tx
descriptor from 0 if the type of our transmit key is _WEP, not _TKIP:
i.e., only if we're really doing WEP crypto in the hardware.

Ignore a watchdog timeout on any Tx ring if we can collect some packets
from that ring.  Restart both the receiver and the transmitter when a
watchdog timeout occurs instead of restarting only the transmitter.
2009-04-02 00:57:20 +00:00
dyoung 726f95dae4 I find myself making a lot of changes in this code to keep it compiling
and (let us hope) working in the 21st century, so I have put it through
unifdef -D__NetBSD__ -U__FreeBSD__ so that it is less of a chore to read
and to maintain.
2009-04-02 00:39:37 +00:00
dyoung 0d1ba3e899 During shutdown, detach devices in an orderly fashion.
Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks.  For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown.  Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags.  Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag.  The default for kern.detachall is 0.  SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress.  In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs.  Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.
2009-04-02 00:09:32 +00:00
reinoud 42726265fe Implement MMC_TRACKINFO_DATA and MMC_TRACKINFO_AUDIO detection for cdrom and
dvdrom devices. These two compatibility codes were forgotten when those were
introduced.
2009-04-01 12:19:04 +00:00
drochner 0785c6f16e avoid tsleep also during shutdown (and in particular ACPI poweroff),
should fix PR kern/39141 by Takahiro Kambe and PR port-i386/41110
by Reinoud Zandijk
2009-03-31 17:17:47 +00:00
darran d4dd9a671a Missed a small but important change to enable hardware VLAN support. 2009-03-31 06:58:55 +00:00
darran 0b4bf6c76b Enable the vlan code that thorpej@NetBSD.org added, and fix a bug where
the vlan tag was read from the rx descriptor after it was reinitialized
(and hence was always 0).  Hardware vlan support looks good tested
between two vmware clients.
With support from tls@NetBSD.org.
2009-03-31 04:16:57 +00:00
uwe 1cfa6cdc4e Split device_t and softc, use aprint_*, rename/reformat stuff to
minimize diffs to dev/apm/apm.c (even at the cost of uglification).

Tested on Jornada 690 (hpcsh).
2009-03-30 06:22:25 +00:00
uwe e4d63225a1 Fix battery_state vs. battery_flags confusion.
Fill all fields of struct apm_power_info in hpcapm_get_powstat.
2009-03-30 06:17:39 +00:00
mrg ac009d4632 drm_addmap():
- for _DRM_CONSISTENT mappings, keep the handle.
- use DRM_HANDLE_NEEDS_MASK()

drm_mapbufs():
- use DRM_HANDLE_NEEDS_MASK()

drm_mmap():
- use DRM_HANDLE_NEEDS_MASK()
- for _DRM_SCATTER_GATHER and _DRM_SHM, use vtophys() on the
  adjusted offset. XXX


this is gets radeon working on amd64 with an older PCI 9250 card.

XXX: need to excise vtophys() usage.
XXX: need to finish porting these fixes to external.
2009-03-29 19:50:17 +00:00
mrg 7216702ebd add a radeon-x1550 (works as well as other rv5xx i guess.) 2009-03-29 19:39:50 +00:00
mrg 44475ef083 include the size in a falled allocation message. 2009-03-29 19:39:10 +00:00
mrg 4d1ad63f2e XXX: for now, add the DRM_NETBSD_HANDLE2ADDR() hack in a few places.
update a debug message.
2009-03-29 19:37:25 +00:00
mrg b9bbc2157f add a comment explaining DRM_NETBSD_ADDR2HANDLE/DRM_NETBSD_HANDLE2ADDR:
* This hack strips the top bit from amd64 addresses, which avoid
 * udv_attach() returning NULL for "negative" offset.
 * A better hack would be to encode the offset of some kernel data
 * structure..

add a new DRM_HANDLE_NEEDS_MASK macro to check whether the above need to
be applied for various mapping types (_DRM_SHM and _DRM_SCATTER_GATHER.)
2009-03-29 17:00:50 +00:00
msaitoh 60500a38d2 Add workaround for 82543GC.
We need to force speed and duplex on the MAC equal to what the PHY
speed and duplex configuration is. Fixes PR#36430.
2009-03-29 16:22:17 +00:00
tsutsui 2273829d51 Don't assume all RX packets have VLAN headers even if vlanif is configured.
Instead, always check ether_type and use appropriate offsets to adjust
the hardware RX sum value.

XXX: vlan(4) doesn't seem to use csum_data and csum_flags in mbufs anyway.
2009-03-29 07:33:52 +00:00
tsutsui 768601d6e6 Get width, height, and linebytes values from prom_getpropint(). 2009-03-29 07:24:56 +00:00
dholland 3781289e95 Merge patch from PR 12605, which tidies up allocation of transmit DMA maps.
Generalize it to also tidy up allocation of receive DMA maps. And change a
few of the symbol names involved to (1) make sure all uses have been fixed
and (2) make it clearer what's actually going on.

Previously the driver was using DMA maps off the free list without fully
allocating them, apparently in order to save two or three lines releasing
them on error paths. According to the submitter of the PR (H.Saito) this
was causing it to reuse a map already in use when under load, resulting
in panics.

I'm not sure if that ought to have been possible or if it reflected an
interrupt handling bug somewhere else, but the change is an improvement
regardless, so we'll go with it.

Compile-tested only, but I've crosschecked the diffs and all that and it's
a pretty noninvasive change.

(Is anyone actually using this driver rather than tlp?)
2009-03-29 05:26:43 +00:00
tsutsui 0ab04c94e6 Fix another botch in hwcsum changes for PR kern/40955:
8168/8111/8168B/8111B doesn't have DESCV2.

Problem reported by Arto Huusko on current-users@.
2009-03-28 22:16:08 +00:00
dyoung 858d3b857c If a sip(4) is powered down, then so is its PHY, so don't try to read
media status from the PHY.
2009-03-27 16:45:53 +00:00
dyoung 590c39d0f3 For legibility, unifdef -U__FreeBSD__ -D__NetBSD__. This compiles, but
it is not run-tested.
2009-03-27 16:15:24 +00:00
dyoung 7377de8f1d Make this build on -current. 2009-03-27 16:10:50 +00:00
tsutsui f8fb75a405 Use bus_space(9) to access registers. SETREG() macro using bogus casts
against packed structures doesn't work on gcc4. (no character on screen)
See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html

Should be pulled up to netbsd-4 and netbsd-5.
2009-03-27 12:25:41 +00:00
tsutsui 030266c11f Check a correct bit for ip4csum-rx. Reported privately on PR kern/40955. 2009-03-27 12:19:17 +00:00
dholland c963cec011 Add the other three PCI ids for the nvidia MCP65 SATA controller to
the quirk table. This way they attach as ahcisata and work, instead of
attaching as viaide and failing miserably.

Fixes PR kern/37826.

XXX: There are a bunch of additional MCP67 and MCP73 PCI ids that
XXX: should probably be added also, but I don't want to do that without
XXX: further investigation and testing.
2009-03-27 06:36:49 +00:00
cegger 8c5327a270 use auto-negotiation for manual media type selection.
This should fix establishment of 10/100Mbps link on L1E.
Helpful to reduce watchdog timeout problems on L1 (age(4)) reported by Jochen Kunz.
From FreeBSD via OpenBSD.
2009-03-27 04:42:50 +00:00
dyoung b63bf39017 It is only by chance that this gets the prop_array_t definition that it
needs, so explicitly #include <prop/proplib.h>.
2009-03-25 23:35:54 +00:00
cegger 798c21064c regen. 2009-03-25 06:51:12 +00:00
cegger 753abffbcf add some CICADA PHYs. from FreeBSD. 2009-03-25 06:49:56 +00:00
scw ebf9670f10 Fix fallout from device_t changes - initialise sc->sc_osiop.sc_dev before
calling osiop_attach().
2009-03-23 18:59:57 +00:00
oster e021b3e6a7 Rework/simplify the disk queuing code. A bunch of this was still
holdovers from the simulator and would never be seen/used in-kernel.
2009-03-23 18:38:54 +00:00
msaitoh 9384d3cea3 Take some code from FreeBSD and OpenBSD
-Add some known CHIPID entries.
 -Add a code for BCM5906 into bge_chipinit(). We have to do more work for
  BCM5906.
 -Fix the case of setting a flag in BGE_PCI_DMA_RW_CTL (on conventional PCI).
2009-03-22 18:54:59 +00:00
msaitoh 2abe3d4169 Make bge(4) close to FreBSD and OpenBSD.
NO FUNCTIONAL CHANGE BY THIS COMMIT.
2009-03-22 18:14:59 +00:00
msaitoh a23f160d73 Make bge(4) close to FreBSD and OpenBSD.
NO FUNCTIONAL CHANGE BY THIS COMMIT.
2009-03-22 16:20:06 +00:00
msaitoh a95fdaad68 eliminate PHY_1 quirk (like OpenBSD (rev. 1.110) and FreeBSD (rev. 1.44)) 2009-03-22 16:12:53 +00:00
ad 416888aeaa Fix the *third* break to this driver from sloppy device_t conversion. 2009-03-21 19:44:26 +00:00
drochner cabe8641e7 Work around a problem with PCMCIA adapter drivers (eg for hpc*) which
attach pcmcia devices before interrupts are enabled. This is unclean
because pcmcia drivers use tsleep(9) in the attach code path but it
worked all the time and it is too late to change this on the 5.0 branch.
So just tolerate it.
Fixes a regression on hpcsh reported by Valeriy E. Ushakov.
2009-03-21 12:35:17 +00:00
tsutsui 6c00def18c Add another quirk flag which shows availability of EEPROM command register.
Now we can remove sc_rev which was intended to represent "MAC revision"
used in the Realtek driver.
2009-03-21 10:05:28 +00:00
tsutsui 78a1fca2f2 Add and use a new quirk flag to disable JUMBO MTU,
rather than checking sc_rev values.
2009-03-21 09:18:06 +00:00
tsutsui 200d1adc6c Add hardware checksum support for newer PCIe 8168/8111/8102 chips,
per device info taken from FreeBSD driver.  Tested by snj@ on 8111C.

Should closes PR kern/40955.

Note on old 8169 chips IP hw csum must be enabled to use TCP/UDP hw csums,
but I'm not sure if these newer chips still have the same restriction.
2009-03-21 07:58:30 +00:00
drochner 44eb10764a Putting a device into the unconfigured state by an ioctl seems legitimate,
so check for a non-NULL configuration descriptor before dereferencing.
Should fix a crash reported by Nicolas Joly per PR kern/41048.
(It still doesn't look good that the ioctl which unconfigures the device
returns EIO -- either it is legitimate or it isn't -- but since this
is a pullup candidate I don't dare to change user visible behaviour.)
2009-03-20 20:47:43 +00:00
tsutsui 3c5f553e65 Try to avoid zstty hangs on higher speed:
z8530sc.c:
 Check pending interrupts in a loop until all requests are handled.
 The old comments said it would cause horrible latency to sun3x floppy etc,
 but serial ports should have higher priority than disks anyway.

z8530tty.c:
 Don't enable and disable TX interrupts on each transmit start and completion
 because it could cause possible race conditions.
 Instead, set ZSWR0_RESET_TXINT on each TIE interrupt to clear the request
 as other kbd drivers attached at zs(4).

Tested on cobalt, macppc, news68k, sparc, and sun3.
2009-03-20 16:28:57 +00:00
msaitoh 4a8c9df3c3 Examine the management mode and mark DRV_LOAD (for ICH{8,9,10},80003,
8257{1,2,3,4}).

Add some error's printf().

Make the bank detect routine into the function.
2009-03-20 07:29:15 +00:00
tsutsui 4b2a9ec9d1 Access LDPS register in re_reset() only on 8169S single chip variants.
From OpenBSD and FreeBSD drivers via PR kern/41009, and
Realtek-supplied FreeBSD driver.
2009-03-20 06:31:31 +00:00
msaitoh 8a7c1f65b7 On i82563, the em driver says that the ready bit in the MDIC register may be
incorrectly set. Insert delay(200) like the em driver. Fixes PR#41014.
2009-03-20 06:27:53 +00:00
cegger 4f9cf8aa30 Correct bungled bcopy() -> memcpy() conversion 2009-03-20 05:26:37 +00:00
tsutsui b1063595a6 Add braces missed on RX hardware cksum support.
Fixes RX failure on 82557/82558.
2009-03-19 15:28:04 +00:00
cegger e2cb85904d bcopy -> memcpy 2009-03-18 17:06:41 +00:00
cegger c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
cegger 35fb64746b bcmp -> memcmp 2009-03-18 15:14:29 +00:00
cegger a1f5aecf36 buildfix: undo previous 2009-03-18 10:41:46 +00:00
cegger df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
reinoud 83969672ba Fix long standing problem with CD/DVD writing with `dd'. If done this way the
device will remain in a wait-for-more-stuff-to-be-written state delaying other
SCSI calls, esp. some read-size or read-layout calls, until its told there is
no more comming.

To fix this, on last close explicitly flush the caches releasing the device
from this mode and allowing other SCSI commands to reach it.

This fixes PR 40528
2009-03-17 21:25:47 +00:00
dyoung 018696dd66 Handle child-detachment by NULL'ing the child pointer so that
auich_detach() does not subsequently dereference a dangling pointer.
2009-03-17 19:38:34 +00:00
dyoung 4a8da47938 Expand a lot of macros from sys/dev/usb/usb_port.h.
Handle child-detachment by NULL'ing the child pointer, so that
umass_detach() will not subsequently dereference the dangling
pointer.
2009-03-17 19:12:17 +00:00
dsl 98ae204731 Add some 'int' into function definitions where the K&R one didn't
specify a type.
2009-03-17 18:19:15 +00:00
dsl 7cc9af7d64 ANSIfy functions with function-pointer arguments 2009-03-16 23:11:09 +00:00
tsutsui 7a44ef30a5 Pull a fix from hme.c rev 1.73 (to #if 0'ed out part):
> Fix a bug in calculation of checksum deduction:
> - To get 16 bit one's complement value from uint32_t variable,
>   higher 16 bits should be ignored.
> - RFC 1624 describes methods to recalculate checksum field in headers,
>   i.e. one's complement of one's complement sum that could be 0x0000,
>   but we don't have to use the strategy to deduct one's complement sum
>   itself which won't be zero but should be 0xffff.
2009-03-16 12:13:04 +00:00
tsutsui 24a0836984 Fix a bug in calculation of checksum deduction:
- To get 16 bit one's complement value from uint32_t variable,
  higher 16 bits should be ignored.
- RFC 1624 describes methods to recalculate checksum field in headers,
  i.e. one's complement of one's complement sum that could be 0x0000,
  but we don't have to use the strategy to deduct one's complement sum
  itself which won't be zero but should be 0xffff.

Found on debugging mec(4) on sgimips O2.
2009-03-16 12:02:00 +00:00
cegger 05d33dc7bf ansify function definitions 2009-03-16 09:32:38 +00:00
cegger dc56dbbd97 ansify function definitions 2009-03-15 21:23:31 +00:00
cegger d3189d3544 ansify function definitions 2009-03-15 20:30:05 +00:00
cegger 317b4e018f ansify function definitions 2009-03-15 17:24:43 +00:00
cegger b8817e4aed ansify function definitions 2009-03-15 17:14:40 +00:00
cegger 4b83748ce5 ansify function definitions 2009-03-15 15:52:12 +00:00
cegger f7d20361b0 ansify function definitions 2009-03-15 15:40:33 +00:00
tsutsui 8d2f130b12 Tweak comments and conditionals about EXT_RFA and IPCB. 2009-03-15 14:48:11 +00:00
tsutsui 3acfa89d3b Adjust comments about sc_flags. 2009-03-15 14:18:38 +00:00
dsl 82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00
apb 2a86bfea6b Add FSYNC_CACHE flag to the VOP_FSYNC() call for the DIOCCACHESYNC ioctl.
PR 41015.
2009-03-14 18:00:37 +00:00
apb caccc8126b Pass DIOCCACHESYNC ioctl down to the underlying disk.
Addresses PR 41016.
2009-03-14 17:56:47 +00:00
christos 19b058b35e PR/41015: Alan Barrett: vnd driver does not implement DIOCCACHESYNC 2009-03-14 16:33:25 +00:00
dsl 454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
dsl 02cdf4d2c8 Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
2009-03-14 14:45:51 +00:00
jmcneill 8cf7d77c2c Don't assume ACPI == x86, from kiyohara@kk.iij4u.or.jp 2009-03-14 13:56:41 +00:00
ad 0fa70e9b6f 'boot -z' bogons 2009-03-14 11:08:28 +00:00
jmcneill b33d444d81 PR# kern/41008: possible simple mistake of field check in video(9)
video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp
2009-03-14 00:33:25 +00:00
jym 96f9080096 Fixes in the iwi(4) driver to better handle errors:
- bus_dmamap fixes, with checks against NULL
- move the rings' allocation code later in iwi_attach() to avoid NULL pointer
dereference if allocation fails
- avoid double free() in case of failure during attach. If an allocation fails,
do not free the ring directly, as it is handled by iwi_detach()
- only set ring->count for RX/TX rings when ring allocation is successful, or
else the for loop during detach will fail with a NULL dereference.
- call pci_intr_disestablish() if iwi_reset() fails during attach; driver is
in an incoherent state, interrupt handler should not be used.

Proposed by me on tech-net@, approved by christos@. Compiled and tested
with GENERIC and XEN3_DOM0 kernels.
2009-03-13 21:57:07 +00:00
yamt 34ccaa3db1 tprof_stop1: add an assertion. 2009-03-13 11:06:26 +00:00
bsh 01bbe49d65 Turn off interrupt disable bit in command status reg.
This is necessary to make S-ATA drives work on some motherboards with
SiS964 including my ASUS P4S800D.
2009-03-12 15:02:42 +00:00
jmcneill 143d119885 Add 'alternative memory' disk device driver. 2009-03-12 00:15:07 +00:00
yamt 0bbefb72ab fix breakage where db_regs_t != trapframe.
the problem pointed out by Martin Husemann on tech-kern@.
2009-03-11 13:48:47 +00:00
tsutsui b057550bcf u_intNN_t -> uintNN_t 2009-03-11 13:12:41 +00:00
yamt e1b625b4bc - adapt to MODULAR.
- some preparations to have more backends.
- add some comments.
2009-03-10 14:45:02 +00:00
msaitoh 9d35632b3f add an entry for 82567LF-3.
fix the register access for ICH10DO.
2009-03-10 03:41:50 +00:00
msaitoh 76b6d5d63e regen 2009-03-10 03:31:36 +00:00
msaitoh 9036c274a6 add i82567LF-3 LAN Controller 2009-03-10 03:30:55 +00:00
uebayasi 143d2214bf These don't need <sys/tty.h>. 2009-03-09 15:59:33 +00:00
christos 049ae3d056 Match Inter 82965PM, from Anon Ymous 2009-03-09 13:13:25 +00:00
tsutsui 567ce9e6ef Computed checksum value by the FXPF_82559_RXCSUM feature includes data
in IP headers, so we have to deduct not only IP option headers but all
IP headers.  But in TCP/UDP layer we can assume the IP header is valid
and a sum of the IP header part should be 0xffff, so we don't have to
bother to deduct it from the computed checksum.
2009-03-09 10:33:33 +00:00
ad 0458d57a95 use aprint_error 2009-03-08 15:06:56 +00:00
agc 15de39d387 Fix tyop in previous. 2009-03-08 02:07:38 +00:00
reinoud 664af01cd8 Actually lmplement striping as LVM target. OK'd by Adam. 2009-03-07 22:17:18 +00:00
tsutsui a8ba219be8 Replace incorrect local ether_cmp() function with memcmp(9)
on checking multicast addresses, which is not so critical.
Noticed by FUKAUMI Naoki.
2009-03-07 16:46:25 +00:00
tsutsui cf97a4b35d Add TCPv4/UDPv4 RX hardware checksum support for i82559 and later chips
which don't have EXT_RFA and IPCB support. From hme(4) driver and
FreeBSD's fxp(4). Tested on i82559.

XXX: Probably we should have a common function to parse RX packet headers
XXX: to handle a raw checksum value and share it among hme(4) and gem(4) etc.
2009-03-07 15:03:25 +00:00
mrg 9526e87d38 move a DRM_SPINUNLOCK() to where it will actually be executed. 2009-03-07 05:46:09 +00:00
dyoung 0226a0496e Don't try to write the registers of the NIC to stop it if it is
already powered down.  This change prevents PCI bus exceptions
(indicated by NMI) when, for example, I detach the whole device
tree on a Soekris net4521:

com1: detached
NMI ... going to debugger
Stopped in pid 0.1 (system) at  netbsd:sipcom_stop+0x4d:        pushl   $0
db{0}> continue
NMI ... going to debugger
Stopped in pid 0.1 (system) at  netbsd:sipcom_stop+0x149:       addl    $0x10,%e
sp
db{0}> continue
sip0: detached

(On the AMD Elan SC520, the NMI occurs at the instruction after
the write or, if the write was posted, at either that instruction
or some later one.)
2009-03-07 00:56:04 +00:00
tsutsui ee11921a7a Add an `else' missed in rev 1.49 otherwise RX hardware checksum on hme(4)
is not activated at all. Ok'ed by christos@, tested on macppc.
2009-03-07 00:12:36 +00:00
bouyer dbac012ecf Make it safe to call uhci_init() from a kernel thread with interrupts
enabled:
- don't enable interrupts before calling uhci_run()
- check if the controller's interrupt is enabled in uhci_intr()
The issue is that uhci_run() may tsleep(), uhci_intr1() may be called before
uhci_run() is complete and disable it because it found it halted.

Now a uhci controller can be successfully exported to a NetBSD Xen domU :)
2009-03-06 23:40:50 +00:00
hauke f971ff9cd3 Workaround from jmcneill for a panic at shutdown.
Fixes PR kern/40947 and should be pulled up to netbsd-5.
2009-03-06 17:10:41 +00:00
haad 50b5b59cc7 Fix lvm lvrename command. There was bug in dm_dev_lookup where
dm_dev_lookup_name was called with device uuid. Remove dm_dev_t:dk_label is
it not used anymore.
2009-03-06 16:17:29 +00:00
tsutsui 19b9bc7f5d The Intel manual says that ICH and 82562 chips are compatible with 82559,
not 82550, so don't set FXPF_EXT_RFA (available only on 82550/82551)
for those variants.

Tested on Intel PRO/100 VM with 82562EM/EX PHY by ISHII Kimio
on current-users, and should also fix PR kern/40431.
2009-03-06 09:54:02 +00:00
msaitoh f9ccf64b65 Fix typo(s/interupt/interrupt/) 2009-03-05 01:38:12 +00:00
tsutsui 26c579d9c4 Use FXPF_EXT_RFA flag instead of FXPF_EXT_TXCB to see IPCB capability
because EXT_RFA for RX cksum is always available with IPCB for TX cksum
but i82558 and i82559 have only EXT_TXCB without IPCB.

Tested on the following fxp cards:
fxp0 at pci0 dev 14 function 0: Intel i82557 Ethernet, rev 2
fxp0 at pci0 dev 14 function 0: i82559 Ethernet, rev 8
fxp0 at pci0 dev 14 function 0: i82550 Ethernet, rev 12
2009-03-04 10:15:08 +00:00
cegger 05d55db82b mimic fix from nfe(4):
when bus_dmamap_create fails, then the map pointer is undefined.
age_dma_free() assumes, the map pointer is NULL. Make the assumption
always true by setting the map pointer to NULL in bus_dmamap_create()
error path in order to prevent age_dma_free() to call bus_dmamap_destroy()
on an invalid map.
2009-03-03 23:28:44 +00:00
cegger 4822727b65 make multicast working.
Diff from OpenBSD's if_age.c rev. 1.2.
2009-03-03 22:26:41 +00:00
mrg dcd94c7684 enable FXPF_EXT_RFA the same way the cardbus frontend does. 2009-03-03 06:06:40 +00:00
haad 5b244085d8 Linear target has only 2 arguments in a params string not 9. 2009-03-01 23:17:39 +00:00
haad f8faf523ec Change comment and add description of line used to configure mirror device. 2009-03-01 23:16:51 +00:00
haad f048f56f71 Add initial support for striping target, hardcode maximal number of stripes
to 2 for now. strategy routine must be written, for now only parsing and
support routines are available. This is work in progress code and should be
taken very carefully.
2009-03-01 23:15:56 +00:00
cegger 2352b93556 bzero -> memset per request from martin@
bcopy -> memcpy

XXX Would changing bcmp to memcpy be a functional change regarding its return value?
2009-03-01 13:44:54 +00:00
cegger 945fa6c58f when nfe_attach() fails, free all resources including
interrupt map, interrupt handler and dma maps.
Also prevent call to bus_dmamap_destroy() when bus_dmamap_create() failed.
The nfe_free_* routines assume, the map pointers are NULL but they
are actually undefined. Make the assumption true by making them NULL
in the error path of bus_dmamap_create().

All together, this fixes crashes when nfe_attach() fails.
ok martin@
2009-03-01 13:34:10 +00:00
cegger 927cfb73c8 MCP79 supports JUMBO frames.
Information from Linux driver.
Patch presented on current-users@ http://mail-index.netbsd.org/current-users/2009/02/11/msg008037.html
2009-03-01 08:29:25 +00:00
oster b39a5d4daa Nuke a DIAGNOSTIC check that is no longer useful, even for DIAGNOSTIC. 2009-02-28 23:11:11 +00:00
oster d7dbe2c6b8 It seems that some SCSI drivers can block while the spinlock on a given
disk queue is being held.  Work around this by dropping the lock before
bdev_strategy(), and re-grabbing the lock afterwards.  This is a
temporary measure until I get to gutting this queue locking code.

There has been some success with this in addressing PR#39993.
This patch is from Antti Kantee.  Thanks!
2009-02-28 22:02:17 +00:00
jmcneill 74dd0aeee0 Change a confusing attach message; if the embedded controller was attached
via ECDT, we would print:
  acpiec0 at acpi0 (EC, PHP0C09-0): ACPI Embedded Controller (disabled)
The embedded controller isn't actually disabled, but instead this driver
instance, so change the message to read:
  acpiec0 at acpi0 (EC, PHP0C09-0): using acpiecdt0
2009-02-28 19:40:23 +00:00
schwarz 8167178188 correct entry for Lucent 0x5802 into 2-port USB Host Controller 2009-02-28 17:55:46 +00:00
jmcneill 4ca035a32b Add proper Realtek ALC268 support. While we're here, fix a comment in
the ALC262 quirk section. Tested by Sean Davis on an Acer Aspire One.
2009-02-28 17:12:13 +00:00
msaitoh 95deb7702d Fix the multicast hash bug on ICH9's wm.
Now we can catch ff02::9 on ICH9's wm.
2009-02-28 15:06:43 +00:00
tsutsui 13a1c5a155 Return EIO rather than getting an infinite loop in the nullcons read function
so that getty(8) against nullcons console fails properly.

Problem on Cobalt Qube2700 reported by Wolfgang Solfrank on port-cobalt.
2009-02-28 00:40:47 +00:00
dyoung 6e3de811e0 Use the right format specifiers to print the new struct timeval. 2009-02-27 23:13:32 +00:00
sborrill 7d02030263 Add support for 82574L (as found on Desktop CT adaptor) based on 82573 support. 2009-02-27 13:17:01 +00:00
mjf c49f4c3690 Regen. 2009-02-26 19:17:01 +00:00
mjf c1c5918fbb Add Initio INIC-1622 SATA Controller. 2009-02-26 19:13:38 +00:00
jmcneill 079289a3e6 PR# port-i386/40143: Viewing an mpeg transport stream with mplayer causes crash
Not directly related to the PR but this bug was discovered while testing.

In azalia_stream_halt, invalidate the intr ptr to prevent a race condition
where azalia_stream_intr can jump off into lala land during stream shutdown.
2009-02-25 15:46:34 +00:00
jmcneill 72141a1696 Turn "bogus parameters" aprint_error into aprint_debug, and change the
message to say that the framebuffer was not configured by the firmware.
2009-02-23 23:45:56 +00:00
jdc 7262e977ee Mimic cgsix memory corruption fix (bwtwo and cgthree wscons code is
based on cgsix).  Original commit message:

  Include wsdisplay.h directly in the header to avoid different sizes
  of cgsix_softc depending on proper previous includes by the includer
  due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
2009-02-23 22:44:27 +00:00
cegger 6ec3b632d5 when attach routine fails, also free DMA memory and interrupt mapping.
Diff from OpenBSD's if_age.c rev. 1.2.
ok cube@
2009-02-23 13:39:41 +00:00
cegger b6d8a5c8fc remove unused age_if_flags softc member 2009-02-23 07:33:58 +00:00
jmcneill 34c593f760 * Realtek ALC885: Use generic_mixer_autoinit/init_widget
* generic_mixer_create_virtual: if the front l/r DAC doesn't have a volume
  capability, enumerate all peer widgets and search for a volume mixer
  there.
2009-02-23 02:34:57 +00:00
cube 102a4f0ad3 I smell rotting code. (Give a chance to the user to at least set the flags
of the interface, if not use it because it otherwise doesn't work.)
2009-02-23 00:05:44 +00:00
pgoyette 7bcb9558e0 1. Reorganize code into memory-type-specific routines instead of multiple
monstrous if-then-else-if constructs.
2. Display module capacity in GB if it is at least 1GB.
3. Indicate if a memory module is "registered".
4. For DDR3, indicate if a temp-sensor is present.

Inspired by similar changes in OpenBSD's spdmem(4).
2009-02-22 17:28:50 +00:00
nakayama c99ea852e4 - fix copyout size in CLOCKCTL_O?ADJTIME.
- add missing break in CLOCKCTL_NTP_ADJTIME.
2009-02-22 13:06:58 +00:00
christos d43c4580f1 s/long/intptr_t/ 2009-02-21 17:24:47 +00:00
martin ff1d9de353 Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
2009-02-20 22:55:26 +00:00
haad e654dd3da2 Call dm_target_busy only on properly autoloaded module. 2009-02-20 11:14:11 +00:00
haad 9629be83bf Release tables before we drop reference on device, now creating device with
nonexistent target fails and not ends with deadlock.
2009-02-20 11:12:30 +00:00
dogcow f2437436f6 sparc complains "cast to pointer from integer of different size"; cast the
int to (void *)(long).
2009-02-20 08:04:15 +00:00
mrg ce8a6e2599 - remove FXPF_IPCB flag. it should always/only be used with the code
conditional on FXPF_EXT_TXCB, so, replace all uses with that
- for the pci frontend, reestablish some flags lost the the prior
  changes and simplify one of the cases

this fixes PR 40677 and may fix PR 40431.
2009-02-20 05:49:34 +00:00
jmcneill 90c7459808 If the bus glue provides an ioctl handler, don't return before we have a
chance to perform generic handling in the WSDISPLAYIO_SMODE case.

ok macallan
2009-02-20 00:08:00 +00:00
haad d624725a46 In NetBSD our target modules are called with prefix dm_target_. Add this
prefix to target module name when loading module, lvm2tools uses linux
target names e.g. zero not dm_target_zero.
2009-02-19 23:20:27 +00:00
haad 17599f37f3 Add support for autoloading of device-mapper targets modules. Add
dm_target_autoload function which tries to load target module. Fix two
deadlocks in dm_table_load_ioctl error path(I forgot to call dm_dev_unbusy).
2009-02-19 23:07:32 +00:00
sborrill d297edd948 Regen 2009-02-19 17:26:21 +00:00