Commit Graph

5383 Commits

Author SHA1 Message Date
dyoung 8e38167faa Remove definition of spc_activate(), it has gone away. 2009-11-12 20:15:02 +00:00
dyoung 2957bfb586 Remove superfluous activation hook.
Add a child-detachment hook.
2009-11-12 20:14:04 +00:00
dyoung 04b4cf9e54 Remove superfluous activation hook. 2009-11-12 19:37:17 +00:00
dyoung d061cb2faa Simplify activation hook. 2009-11-12 19:35:59 +00:00
dyoung 3e567daf68 Simplify activation hook. Replace each use of sc_invalid by either
calling config_deactivate(9) or device_is_active(9).
2009-11-12 19:32:14 +00:00
dyoung a6c5930eb6 Simplify activation hook. 2009-11-12 19:30:49 +00:00
dyoung 91901a7869 Simplify activation hook. Replace each use of sc_invalid by either
calling config_deactivate(9) or device_is_active(9).
2009-11-12 19:28:59 +00:00
dyoung e33ae76976 Remove superfluous activation hook. 2009-11-12 19:25:08 +00:00
macallan d0b2c36849 add modeseting support. Now if there's a mode string in igsfb_devconfig the
driver will try to use it if at all possible, otherwise fall back to the old
hardcoded 1024x768x60 mode.
2009-11-11 17:01:17 +00:00
macallan 293ac096d1 add support for an optional machine-dependent mmap() method, so the bus
backend can do whatever voodoo necessary to the aperture, IO space etc.
Mainly for shark, to get around the weird ARM bus_space.
2009-11-10 22:23:22 +00:00
jakllsch 9ae52821d4 Use hme_init() to provide a non-NULL ifp->if_init. 2009-11-03 22:06:30 +00:00
rmind 40cf6f3659 Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code.  Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
2009-10-21 21:11:57 +00:00
rmind 993cb03302 Drop 3rd and 4th clauses from David Young's license.
Reviewed and approved by dyoung@ (copyright holder).
2009-10-19 23:19:37 +00:00
bouyer 6d07b400dc Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
2009-10-19 18:41:07 +00:00
sborrill 88bbf990c2 Commit patch from PR#41926. Confirmed to work by PR submitter on two
controllers as well myself and another on viaide.

Stops errors such as the following when probing SATA drives through
controllers that offer the legacy pciide interface:
viaide1 channel 0: reset failed for drive 0

OK bouyer@
2009-10-06 13:45:01 +00:00
jmcneill 6c62f91733 Initial import of an SD/MMC driver for the Winbond W83L518D (and probably
W83L519D) Integrated Media Reader with PNP bus attachment glue.
2009-09-30 20:44:49 +00:00
njoly 33042a7b04 Be robust against an invalid timer period value. 2009-09-30 15:22:11 +00:00
jakllsch bd5cb77445 gpio(4) support for Intel ICH southbridges.
Tested on Intel SS4200-E (ICH7), and Acorp 6A815EPD (ICH2) motherboards,
on amd64 and i386 ports respectively.

It should be noted that the majority of boards with ICH chips do not
expose the GPIO pins for off-board use.  For instance, aside from the
three exposed-on-a-header pins on the 6A815EPD, another pin is also
used to control write protect on the FWH.  The SS4200 exposes the GPIO
on a header that connects to the 10 LEDs on the front panel, as well
as a tact switch on the back panel.
2009-09-27 17:55:31 +00:00
tsutsui 0719ca07be Replace shutdownhook_establish(9) with pmf_device_register1(9).
Compile test only.
2009-09-27 10:00:11 +00:00
tsutsui a6b618f221 Split device_t/softc. Tested on aic7901A. 2009-09-26 14:44:10 +00:00
tsutsui df90eec26b Make local functions static. 2009-09-22 16:44:08 +00:00
tsutsui 6b3b6e9a98 Fix possible endian issue. Untested. 2009-09-22 15:25:12 +00:00
tsutsui 3b0a685f2b Split device_t/softc. Tested only on cs at ofisa on shark. 2009-09-22 14:55:19 +00:00
tsutsui 36b4b2e6c0 - replace shutdownhook_establish(9) with pmf_device_register1(9)
- remove powerhook_establish(9) because all stuff in cs_power()
  will be handled in pmf_class_network

Briefly tested on CS8900 at ofisa on DNARD compatible.
2009-09-22 13:31:26 +00:00
tsutsui 606e573f63 - wrap long lines
- remove unnecessary casts against void pointers
2009-09-22 13:26:54 +00:00
tsutsui d7f21e6129 Don't declare ISA specific aic_isa_attach() in MI header, and
also make local functions in aic_isa.c static.
2009-09-22 13:18:28 +00:00
tsutsui 00eb8aa546 Split device_t/softc. Tested on AHA-1520B at ISA and ISAPnP.
XXX: ISA attachment shouldn't match cards in ISAPnP mode.
2009-09-22 12:56:06 +00:00
jakllsch 81f8a1dcf0 Add more-complete definitions of ICH GPIO-related registers.
While here, fix a typo in a register number.
2009-09-21 16:18:31 +00:00
tsutsui c8a52f80ba Split device_t/softc. Tested on AHA-1542CF. 2009-09-21 08:12:47 +00:00
tsutsui 13855cad09 Use common ether_crc32_le() for multicast hash. 2009-09-19 04:55:45 +00:00
tsutsui eb06ddcd95 hme_reset() is no longer called from bus attachments so make it static. 2009-09-18 12:40:15 +00:00
tsutsui 5dcfc285a0 Misc KNF and cosmetics, and remove unnecessary casts etc. 2009-09-17 18:14:41 +00:00
dyoung 36fffd8d02 In pmf(9), improve the implementation of device self-suspension
and make suspension by self, by drvctl(8), and by ACPI system sleep
play nice together.  Start solidifying some temporary API changes.

1. Extract a new header file, <sys/device_if.h>, from <sys/device.h> and
   #include it from <sys/pmf.h> instead of <sys/device.h> to break the
   circular dependency between <sys/device.h> and <sys/pmf.h>.

2. Introduce pmf_qual_t, an aggregate of qualifications on a PMF
   suspend/resume call.  Start to replace instances of PMF_FN_PROTO,
   PMF_FN_ARGS, et cetera, with a pmf_qual_t.

3. Introduce the notion of a "suspensor," an entity that holds a
   device in suspension.  More than one suspensor may hold a device
   at once.  A device stays suspended as long as at least one
   suspensor holds it.  A device resumes when the last suspensor
   releases it.

   Currently, the kernel defines three suspensors,

   3a the system-suspensor: for system suspension, initiated
      by 'sysctl -w machdep.sleep_state=3', by lid closure, by
      power-button press, et cetera,

   3b the drvctl-suspensor: for device suspension by /dev/drvctl
      ioctl, e.g., drvctl -S sip0.

   3c the system self-suspensor: for device drivers that suspend
      themselves and their children.  Several drivers for network
      interfaces put the network device to sleep while it is not
      administratively up, that is, after the kernel calls if_stop(,
      1).  The self-suspensor should not be used directly.  See
      the description of suspensor delegates, below.

   A suspensor can have one or more "delegates".  A suspensor can
   release devices that its delegates hold suspended.  Right now,
   only the system self-suspensor has delegates.  For each device
   that a self-suspending driver attaches, it creates the device's
   self-suspensor, a delegate of the system self-suspensor.

   Suspensors stop a system-wide suspend/resume cycle from waking
   devices that the operator put to sleep with drvctl before the cycle.
   They also help self-suspension to work more simply, safely, and in
   accord with expectations.

4. Add the notion of device activation level, devact_level_t,
   and a routine for checking the current activation level,
   device_activation().  Current activation levels are DEVACT_LEVEL_BUS,
   DEVACT_LEVEL_DRIVER, and DEVACT_LEVEL_CLASS, which respectively
   indicate that the device's bus is active, that the bus and device are
   active, and that the bus, device, and the functions of the device's
   class (network, audio) are active.

   Suspend/resume calls can be qualified with a devact_level_t.
   The power-management framework treats a devact_level_t that
   qualifies a device suspension as the device's current activation
   level; it only runs hooks to reduce the activation level from
   the presumed current level to the fully suspended state.  The
   framework treats a devact_level_t qualifying device resumption
   as the target activation level; it only runs hooks to raise the
   activation level to the target.

5. Use pmf_qual_t, devact_level_t, and self-suspensors in several
   drivers.

6. Temporarily add an unused power-management workqueue that I will
   remove or replace, soon.
2009-09-16 16:34:49 +00:00
dyoung ba1e593dc7 Simplify activation routines. Don't block interrupts, if_deactivate()
does it.  Compile-tested, only.
2009-09-15 20:51:12 +00:00
dyoung fe01097755 Simplify activation routines: do not call mii_activate(), it is a
no-op.  Do not block interrupts, if_deactivate() will take care of
that for us.
2009-09-15 19:29:17 +00:00
dyoung b8695aecbf Simplify activation routines: don't call mii_activate(), it's a
no-op.  Don't block interrupts, if_deactivate() does it.
Compile-tested, only.
2009-09-15 19:20:29 +00:00
dyoung 662dfba47d To ease a future device_t/softc split, se device_private() instead
of casting device_t to softc.
2009-09-15 18:37:02 +00:00
dyoung 7cd3e7cb51 unifdef -D__NetBSD__ -U__FreeBSD__.
No functional change intended.
2009-09-15 18:32:00 +00:00
tsutsui 16c0f8385d Use device_private(), proper types or variables for device_t and softc.
(not yet split though)

No crash on gxemul emulating hpcmips mobilepro.
2009-09-14 13:41:15 +00:00
tsutsui 5770fb4ee0 u_intNN_t -> uintNN_t 2009-09-14 12:49:33 +00:00
dyoung 9e037d8311 Experimental support for fragmentation and RTS/CTS.
Delete unused atw_voodoo and constants.

Export Tx/Rx statistics with evcnt(9).

Correct the Short Inter-Frame Space (SIFS) that we write to ADM8211's
registers; I do not recall if that corrected the SIFS that I observed
"on the air."  Use the constant IEEE80211_DUR_DS_EIFS to configure
the ADM8211's EIFS, instead of writing the same "magic" number,
0x64, that my reference driver wrote.

Do not clear OACTIVE in atw_init(), because atw_stop() cleared it
previously by calling atw_txdrain().

Use the net80211 short-preamble flag and instead of ATW_SHPREAMBLE.

Add an ADM8211 workaround from the reference driver, atw_workaround1(),
but don't compile it right now.

In at_intr(), don't stop processing the interrupt status after
restarting the receive ring, but process Tx interrupt status.  If
a packet's Tx lifetime is exceeded, reinitialize the device to get
packets moving again.  If the Tx FIFO underflows, restart the
transmitter, not the receiver!

Avoid losing synchronization with the Rx ring by replicating one
of Charles Hannum's fixes to rtw(4) here: receiving a management
packet may, as a side-effect, reset the Rx ring, so refer to the
softc's Rx ring pointer, sc_rxptr, every time through the loop in
atw_rxintr(), instead of refering to a pointer on the stack, i.

Re-synchronize DMA after reading the OWN bit on an Rx/Tx descriptor.
XXX This needs more work.

Reset sc_tx_timer as Tx descriptors are reclaimed from the device.

Shorten staircases in atw_watchdog().

Remove from softc an unused member, sc_intr_ack.
2009-09-13 22:07:34 +00:00
dyoung da6660904b Delete whitespace at ends of lines. No functional change intended. 2009-09-13 21:24:58 +00:00
tsutsui ad62cf6bd2 Fix an incomplete device_xname change in rev 1.69. PR kern/41861 2009-09-12 19:55:29 +00:00
tsutsui df9cde870d Fix warnings by -Wpointer-sign, which is disabled by default. PR kern/33965 2009-09-12 19:16:35 +00:00
tsutsui 0b4006b755 Make local functions static and remove a declaration that is also in hmevar.h.
Also comment out or remove declarations for #if 0'ed or nonexistent functions.
2009-09-08 18:35:42 +00:00
tsutsui 2b11b477b3 - split out chip reset ops from hme_stop() into a new function
hme_chipreset() to make hme_stop() match struct ifnet API
- set ifp->if_timer in hme_start() if any TX packets are queued
- also clear ifp->if_timer and ifp->if_flags in hme_stop()
- replace shutdownhook_establish(9) with pmf_device_reigster1(9)
Briefly checked hme at pci.
2009-09-08 17:16:33 +00:00
tsutsui 91bbbb9ed1 Split device_t/softc.
Tested QLogic 1020 Fast Wide SCSI HBA at PCI.
Sbus attachment is untested, but not so much quirks in it.
2009-09-07 13:39:19 +00:00
tsutsui c67601b868 Whitespace nits. 2009-09-07 13:31:44 +00:00
tsutsui 41f548bed9 Invert logic around nested pmf(9) registrations for readability. 2009-09-05 14:19:30 +00:00
tsutsui 15ecebfdb2 Make ahd_detach() take struct ahd_softc * rather than device_t
as well as ahd_attach().  (currently no backend calls it though)
2009-09-05 12:50:53 +00:00
tsutsui 7edc9e3e17 Use device_private() to get softc. 2009-09-05 12:46:55 +00:00
tsutsui d283274ba9 - use local ahd_name() to print device name
- pass proper device_t types to config(9) functions
2009-09-05 12:43:56 +00:00
tsutsui 1f74bbf3de Remove unnecessary casts against void pointers. 2009-09-05 12:39:25 +00:00
tsutsui aa60aebf13 Replace shutdownhook_establish(9) with pmf_device_register1(9) in
MI epconfig() and ep_detach(), and remove pmf(9) calls in pcmcia attachment.
Tested on ep0 at pci, but pcmcia attachment is untested.
2009-09-05 12:30:59 +00:00
tsutsui 1cc46c1f6d Remove one more extra whitespace. 2009-09-05 08:23:24 +00:00
tsutsui 97dbe6076b Remove unnecessary whitespace. 2009-09-05 03:50:49 +00:00
tsutsui f95171bf7a u_intNN_t -> uintNN_t 2009-09-04 18:40:19 +00:00
tsutsui 4466014699 Remove unnecessary whitespace. 2009-09-04 18:29:52 +00:00
tsutsui 4aff350284 Replace shutdownhook_establish(9) with pmf_device_register1(9).
Tested on sun3x.
2009-09-04 16:21:24 +00:00
tsutsui d0cad2b04e Remove now unused *shutdown_hook from softc. 2009-09-03 14:55:29 +00:00
tsutsui ffdf6c036a - wrap long lines
- remove unnecessary casts against void pointers
2009-09-03 14:52:22 +00:00
tsutsui 631843b598 Remove whitespaces between tabs. 2009-09-03 14:40:43 +00:00
tsutsui ae6e5bebd3 Misc cosmetics:
- remove c++ style comment
- wrap long lines
- remove unnecessary casts against void pointers
2009-09-03 14:37:58 +00:00
tsutsui 2ab0f07b1a Replace shutdownhook_establish(9) with pmf_device_register1().
Tested EtherPower II 10/100 (SMC9432TX) on macppc.
2009-09-03 14:13:16 +00:00
tsutsui 767b154f7a Use a proper local variable. 2009-09-02 17:22:53 +00:00
tsutsui 67a2fe67a4 Fix harmless pasto. (ahc -> ahd) 2009-09-02 17:11:26 +00:00
tsutsui 521f39b295 TAB vs space cleanup. 2009-09-02 17:08:12 +00:00
tsutsui e54ffcf9ee Replace shutdownhook_establish(9) with pmf_device_register1(9).
Untested, but mostly copied from ahc(4).

This may fix reboot failure problem on ahd(4) after pmf(9) merge:
http://mail-index.NetBSD.org/current-users/2007/12/10/0008.html
which was also seen on old ahc(4):
http://mail-index.NetBSD.org/port-sgimips/2008/01/05/msg000003.html
2009-09-02 16:38:17 +00:00
tsutsui 1de7f11179 Move pmf(9) calls to MI re_attach() and re_detach() from each backend. 2009-09-02 15:11:13 +00:00
tsutsui 0968013cc2 Make local functions static. 2009-09-02 14:58:38 +00:00
tsutsui d90bf6dc81 Call ahc_shutdown() during system shutdown via pmf_device_register1(9),
as well as pre-pmf(9)'fied kernel did via shutdownhook_establish(9).
Tested on O2.

ahc_suspend() and ahc_resume() are still disabled due to lack of hardware.
Anyone who can test Cardbus APA-1480?
2009-09-02 11:44:11 +00:00
tsutsui 1056cb0520 Call pmf_device_register(9) in ahc_attahc() rather than ahc_pci_attach()
since pmf_device_deregister(9) is called from ahc_detach() so that
cardbus backend also gets proper pmf(9) calls.
PCI backend is tested on on O2, but cardbus is untested.
2009-09-02 11:10:37 +00:00
tsutsui 0f7a15058c Invert logic around nested pmf(9) registrations for readability. 2009-09-02 10:43:24 +00:00
tsutsui 531b631d68 Some backends may use ncr53c9x_abort(), so remove static declaration from
the function and explicitly declare it in ncr53c9xvar.h.  Noticed by he@.
2009-09-02 10:34:04 +00:00
jmcneill f6062bf27a aprint-ify 2009-09-01 21:46:52 +00:00
tsutsui e1e11a8c8e Also call pmf_class_network_register(9). 2009-09-01 17:12:42 +00:00
tsutsui a2ff563552 Replace shutdownhook_establish(9) with pmf_device_register1(9). 2009-09-01 15:19:20 +00:00
tsutsui 9ddabccc10 Treat 8168DP as well as 8168C/CP/D. From FreeBSD. 2009-08-31 13:05:30 +00:00
tsutsui 4ca1400e03 Misc KNF. 2009-08-30 02:07:05 +00:00
tsutsui f54cebb2d7 - no need to include "vlan.h" since no NVLAN reference
- whitespace in comment
2009-08-29 14:06:22 +00:00
tsutsui 6c957c4802 Uncomment /*static*/ function declarations,
and #ifdef'ed out an unused function.
2009-08-29 06:05:39 +00:00
dyoung e0567cec13 Use C99 types, s/u_int32_t/uint32_t/. No functional change intended. 2009-08-28 15:29:16 +00:00
dyoung ad4ed4b3dd Use *_FOREACH() routines instead of open-coding them. 2009-08-27 20:24:16 +00:00
dyoung b22313926a Make descriptors packed w/ 4-byte alignment. 2009-08-27 20:23:32 +00:00
tsutsui 6564af38e7 Remove an unnecessary assignment. No binary change. 2009-08-27 16:02:26 +00:00
bouyer 88384a5472 Oups, remove extra } 2009-08-27 09:40:39 +00:00
bouyer 952c92b561 mfi.c still uses the spl() synchronisation scheme and so needs the kernel lock.
The sysmon subsystem is marked MPSAFE and so runs without the kernel lock.
So get the kernel lock in mfi_sensor_refresh()  before calling
mfi_ioctl_vol().
This fixes command list corruption seen on heavy I/O load on the mfi
driver(4).
2009-08-26 21:41:05 +00:00
dyoung 5a395386a7 Let us detach ichlpcib(4) and its children.
XXX More testing is needed.  I've tested this on a Dell Dimension 3000,
XXX but that system does not attach every possible device that I try to
XXX detach with this code:

ichlpcib0 at pci0 dev 31 function 0
ichlpcib0: vendor 0x8086 product 0x24d0 (rev. 0x02)
timecounter: Timecounter "ichlpcib0" frequency 3579545 Hz quality 1000
ichlpcib0: 24-bit timer
ichlpcib0: TCO (watchdog) timer configured.
isa0 at ichlpcib0
2009-08-18 17:47:46 +00:00
dyoung 62dca01035 Add a bus-independent detachment routine. In the attachment routine,
save some device state to restore during detachment.
2009-08-18 17:06:35 +00:00
macallan 5f495e4be4 add voyagerfb, a driver for the Gdium Liberty 1000's onboard graphics chip 2009-08-12 19:28:00 +00:00
kiyohara 5bb9b7a6ef Support SMSC LAN9118 Family Ethernet interfaces device driver.
It tested on GUMSTIX only.
2009-08-09 06:40:09 +00:00
jun 3a6e583f13 fix pcic kthread creation timing.
see http://mail-index.netbsd.org/current-users/2008/07/15/msg003526.html

fix kern/41791 & port-hpcmips/41164.
ok by uwe & tsutsui
2009-08-05 13:29:16 +00:00
snj 7f43b2a600 Fix a typo inside a comment. 2009-08-03 20:06:36 +00:00
jmcneill 783afeb19c - fix TKIP, changes adapted from FreeBSD
- reduce diffs between FreeBSD and NetBSD athvar.h
2009-08-02 13:26:33 +00:00
dyoung 1b6947b941 Do a complete device_t/softc split for the PCI attachment. I have
not finished the device_t/softc split for the SBus attachment
because I don't have an SBus gem(4) to test with.

Convert from legacy shutdownhooks to a PMF shutdown hook.  Add PMF
suspend/resume handlers.

Factor a detachment hook out of gem_attach().  During device
attachment, track which resources are reserved in sc_attach_state,
and release only those resources during detachment.

Tested on gem0 and gem1 at pci1 on a Sun Fire V120.
2009-07-27 18:10:53 +00:00
kiyohara ce1343fcd9 Support Marvell Hercules-I/II SATA Controllers. 2009-07-27 12:34:12 +00:00
cegger ae3b7e2af6 use __arraycount, kill N() macro. 2009-07-25 23:43:06 +00:00
kiyohara 1f46950ef0 Support siisata@cardbus.
It tested on amd64 and i386 only.
2009-07-19 06:28:08 +00:00
dyoung bbc238f2cd Let us detach & re-attach children of mfi0. Detach mfi0 at shutdown.
Detachment may fail after freeing some but not all resources, so
take care not to re-release any resource during detachment.

Tested on a Dell PowerEdge 1950.
2009-07-16 18:58:38 +00:00
dyoung ebab3c38ca device_t/softc split. Tested and shown to work on a Dell PowerEdge
1950.
2009-07-16 18:10:00 +00:00
dyoung c85f1bbee5 Try to detach ancestors (sd0 at scsibus0, scsibus0 at mfi0), first,
to avoid dangling references to envsys(4) sensors and such if
detaching the ancestors should fail.
2009-07-16 01:30:10 +00:00
dyoung 78500bdfd5 Add a rudimentary detachment hook for mfi(4). 2009-07-16 01:01:46 +00:00
kiyohara e2c231dbe4 Support UCB1400.
It tested on GUMSTIX with audiostix.  However GUMSTIX needs more ad-hoc patch.
2009-07-13 12:54:11 +00:00
jakllsch 5b75384146 Further corrections for siisata.
Reset ch_status and ch_error at the beginning of any operation.

The chip only writes the RDH FIS to the SRAM when the error bit is
set in a RDH FIS (per the datasheet).  Thus, satafis_sdb_parse() is
replaced with satafis_rhd_parse().  A valid FIS type field seems to
not be written to the SRAM, so don't bother checking it for the
correct magic.

Additionally, append 2009 to copyright year set, and remove
obsolete CVS Id lines from when this was in my repository.
2009-07-04 20:57:15 +00:00
jakllsch 464a6f95bf Remove unused elements from siisata_softc.
Clean up siisata pci attachment.
 noteable changes:
 - Use aprint_*_dev where appropriate.
 - Condense board match table and use C99 initializers.
 - Use aprint_verbose for extra info.

Also, add 2009 to my copyright, as well as remove my local CVS tags.
2009-07-04 20:36:57 +00:00
jakllsch 185aeef2dc Correct various siisata bugs, some old, some new.
- Move clearing of interrupts to before atastart() is called in the
   xfer interrupt handler.  Should fix kern/41579.
 - Using cv_timedwait(9) is not possible in code that can be called from
   interrupt context, fall back to DELAY(9).
 - Correctly poll Port Slot Status register for soft reset PRBs.
 - Only use the Recive Transfer Count register on reads, when it is valid.
 - Activate PRBs in a way that takes the whole physical address into account,
   even when the PRB is beyond 4GiB.
 - consistently use DELAY(9)
 - Use DELAY() constants in completion polling loops that are consistent with
   the loop count limit. (i.e. timeout in 10 rather than 100 seconds)
2009-06-27 21:04:47 +00:00
mjacob ad7d727f78 Update ISP driver to latest and greatest. Includes support for the 8Gb part. 2009-06-25 23:44:01 +00:00
jakllsch 5a08fb2589 Use PRO_PS and PRO_PCS correctly.
From Wolfgang Stukenbrock as part of kern/41579.

While here, remove a line of whitespace, and add an else case to
the ATAPI command length toggle.
2009-06-21 14:15:38 +00:00
cegger 77578bbc3a make this build w/o SIISATA_DEBUG 2009-06-17 19:12:48 +00:00
jakllsch f38e8286ac A few changes for siisata(4):
- Support detachment.  From KIYOHARA Takashi.
 - Add PCI detachment functionality (albeit not very interesting when
   the bus can not yet be rescanned).
 - Rework interrupt handlers to reduce near-duplicate code.
   Borrowed from ahcisata(4).
 - Attempt to make polled I/O work. Untested.
 - Fix formatting of some messages.
 - For always-polled commands, disable interrupt
   at slot level rather than port level.
 - Instead of busy-waiting indefinitely for completion of some commands
   move on after 31 seconds. Use cv_timedwait(9) instead of DELAY(9).
 - Use abstracted SATA FIS code.
 - Enable use of disks that don't respond with the standard signature.
2009-06-17 04:37:57 +00:00
jakllsch 5ea7c61bc2 Use abstracted FIS code for ahcisata(4). Have the FIS code pre-zero the FIS. 2009-06-17 03:55:04 +00:00
he 6425d6dcfd Don't include <machine/mtpr.h> anymore since it has been removed
(at least from the amiga port) and appears to no longer be required.
2009-05-31 14:11:17 +00:00
tsutsui a6363f7d5a Two fixes for RX hwcsum on DESCV2 chips:
* On checking TCPv4/UDPv4 RX checksum on DESCV2 chips, also check
   RE_RDESC_VLANCTL_IPV4 bit because those DESCV2 chips may also recognize
   IPv6 packets and set RE_PROTOID_TCPIP or RE_PROTOID_UDPIP bits for
   TCPv6/UDPv6 packets.  This may fix PR kern/40605.
 * According to Realtek's Linux driver, DESCV2 chips don't set RE_PROTOID_IP
   for non-TCP/UDP IP packets (set only RE_RDESC_VLANCTL_IPV[46]) so
   remove PROTOID check for IPv4 RX cheksum on DESCV2 chips.
2009-05-31 05:10:47 +00:00
rjs f4443cd34c Put back CVS header. 2009-05-27 23:01:07 +00:00
dyoung 588bd8a952 Wrap some long lines. No functional change intended. 2009-05-26 23:57:34 +00:00
mrg a149917d19 add two new functions for z8530tty: zs_chan_lock() and zs_chan_unlock(),
and use them instead of various spl's in the zs.c's.

reviewed by ad and martin.
2009-05-22 03:51:30 +00:00
tsutsui e298c1144d Split device_t/softc.
Tested PCI HME on i386.  Sbus HME is compile test only.
2009-05-17 00:40:43 +00:00
tsutsui d2452bef38 Make ahc_detach() take struct ahc_softc * as well as ahc_attach()
and remove bogus casts around ahc_detach().

XXX: There is a pmf_device_deregister(9) call in ahc_detach()
XXX: while there is no pmf_device_register(9) in ahc_attach().
XXX: It looks more pmf(9) stuff is required for cardbus detach.
2009-05-16 06:44:05 +00:00
tsutsui 7882b9d224 - fix one more device_t/softc split botch in debug code
- use sc->sc_dev to get device_t
- fix inconsistent aprint_error_dev(9) usage
- some KNF and wrap long lines
2009-05-16 05:51:58 +00:00
tsutsui db656c02e4 Fix botch on device_t/softc split.
XXX: still doesn't work (command timeout on data xfer).
2009-05-16 05:26:31 +00:00
tsutsui 49d9fc80f4 Misc cleanup:
- some KNF
- u_intNN_t -> uintNN_t
- wrap long lines and fix indent
- remove return statements at the end of void functions
- use __arraycount()

XXX: many inconsistent aprint_error_dev(9) vs printf(9)
2009-05-16 03:57:57 +00:00
tsutsui 31ec75e9f1 Split device_t/softc.
No crash on:
esiop0 at pci0 dev 11 function 0: Symbios Logic 53c875 (ultra-wide scsi)
siop0 at pci0 dev 9 function 0: Symbios Logic 53c810a (fast scsi)
siop0 at gsc0 hpa 0xf0830000 path 2/0/7 irq 3 ipl 6: NCR53C720 rev 2
2009-05-15 17:55:44 +00:00
tsutsui 4890eaf0d8 Pass correct size (after padding) to bus_dmamap_sync(9) for RX mbufs
in iee_intr().  Fixes panic on DIAGNOSTIC kernel reported by skrll@.
2009-05-13 13:12:06 +00:00
cegger 529e91fca1 struct device * -> device_t, no functional changes intended. 2009-05-12 14:16:35 +00:00
cegger 32c4940900 struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-12 12:10:29 +00:00
cegger 2dc0e43978 use device_xname() 2009-05-11 20:53:47 +00:00
tsutsui aac17e82ae - rename RTK_HWREV_8102EL_SPIN2 -> RTK_HWREV_8103E
- add a HWREV value for 8168DP
Per Realtek's Linux drivers.
2009-05-11 15:42:33 +00:00
tsutsui 84e868b269 - adjust comments for the previous change
- wrap a long comment
- remove a trailing whitespace
2009-05-10 04:36:58 +00:00
tsutsui f76d0651b7 Misc bus_dma(9) related cleanup:
- calculate each descriptor sizes and offsets in iee_attach() and store them
  into softc, rather than re-calculating them everywhere via macros
- prepare macros to sync DMA shmem per each descriptor
- sync only necessary descriptors in iee_intr() and iee_start()
- make sure SCB_FOO macros take softc as an arg properly
- use bus_dmamap_load_mbuf(9) for RX mbufs
- put 2 byte alignments to RX mbufs

XXX: still slower than ie(4) in i82586 compat mode on HP9000 735/125.
2009-05-10 04:26:19 +00:00
tsutsui 3ec7e0d881 Fix more pasto botch. 2009-05-09 20:44:56 +00:00
tsutsui f8a52a52cb Remove (wrong) function names by pasto from attach failure messages. 2009-05-09 20:42:09 +00:00
tsutsui 8de92473d5 Also check if cache line alignment is power of two in KASSERT(). 2009-05-09 03:54:10 +00:00
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
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
jdc c10e3b28bd Add extra counter definitions (pointed out by Geoff Wing). 2009-05-07 06:46:54 +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
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
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 6a970ea21d device_t/softc split 2009-05-05 09:51:23 +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
martin cb13eee90c Add missing braces - patch from Kurt Lidl in PR port-vax/41314. 2009-05-01 03:18:20 +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
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
cegger 57fb22a89c device_t/softc split 2009-04-26 10:07:48 +00:00
tsutsui d7ac09b75f - use (uint8_t *) for RX buffer
- remove unnecessary pointer casts
2009-04-26 02:25:57 +00:00
tsutsui 378ce951b9 Use roundup2() macro. 2009-04-25 18:27:39 +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
tsutsui d779b85d3e Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
2009-04-18 14:58:02 +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 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
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
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
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
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 336480339e Cosmetic: remove some dead code. 2009-04-07 18:02: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
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
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 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 7377de8f1d Make this build on -current. 2009-03-27 16:10:50 +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
ad 416888aeaa Fix the *third* break to this driver from sloppy device_t conversion. 2009-03-21 19:44:26 +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
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
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
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 df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +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 317b4e018f ansify function definitions 2009-03-15 17:24:43 +00:00
cegger 4b83748ce5 ansify function definitions 2009-03-15 15:52:12 +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
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
tsutsui b057550bcf u_intNN_t -> uintNN_t 2009-03-11 13:12:41 +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
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
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
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