Commit Graph

438 Commits

Author SHA1 Message Date
jmcneill 9709f2afe2 Add support for PCI_BUS_FIXUP and PCI_ADDR_FIXUP on amd64. 2008-05-18 02:06:14 +00:00
dyoung c288de686c Match printf argument type (uintmax_t) to format string (PRIuMAX). 2008-05-14 19:24:48 +00:00
ad 1498ad220e Make various bits of debug code compile again. 2008-04-30 14:07:13 +00:00
scw 1de1c389bf Pull in some more changes from OpenBSD:
- replace rssadapt(9) with amrr for automatic rate control.
- don't blindly IFQ_DEQUEUE() then drop a Tx packet if there are no
  available Tx resources.
- move default MAC/BBP/RF settings from rt2661.c to rt2661reg.h.
- enable packet bursting when operating as a STA.
- implement new ic_updateslot() callback.
- in hostap mode, we defer update of the slot time until all associated
  STAs are notified with updated beacons.
- 802.11a uses a 16 microseconds short interframe space.
- Fix rt2661_set_macaddr() so that we don't override the "unicast to me"
  flag in RT2661_MAC_CSR3 when setting the MAC address.
- fix index of ERP information element in beacons.

Add a couple of tweaks of my own:

- The RX/TX BUSY flag should be the last thing written to a descriptor.
- Check and service any additional h/w interrupts before returning
  from the isr.

Tested in STA, AP, and Monitor modes. Tested with WEP, WPA, and WPA2 crypto.

Additional testing by xtraeme@
2008-04-29 22:21:45 +00:00
martin 3028e483e4 Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
tsutsui 82cc885228 Split device_t/softc for re(4) and rtk(4). 2008-04-25 11:27:19 +00:00
cegger 1b5ffa90ad - ansify
- use POSIX integers
2008-04-14 21:20:41 +00:00
spz 123ed98aff pretty up if_ex: pmf'ify, device split, and improve printing a bit too.
Reviewed and function-tested on if_ex_cardbus by cube (thanks).
Function-tested on if_ex_pci by myself.
2008-04-14 20:03:13 +00:00
skd d51db07a71 Fix small error in device/sc splitup. 2008-04-09 11:32:26 +00:00
cegger c0d1e7cb9e use aprint_*_dev and device_xname 2008-04-06 07:54:17 +00:00
kiyohara 1368789634 Sorry forgot.
Split device_t/softc, and cosmetic change.
2008-03-29 17:50:36 +00:00
ad bd1204e3c8 Make it compile again. 2008-03-29 16:36:14 +00:00
drochner fd0ded75ed split device/softc for USB host controllers and the usb (control)
device,
this is hairy stuff, and I've only tested with uhci/ehci at pci,
please test the rest and report problems
2008-03-28 17:14:45 +00:00
cube 7aa6248cdf Split device_t and softc for ATA devices, as well as wd(4). Other
cosmetic changes where appropriate.
2008-03-18 20:46:35 +00:00
cube 607ead0ef4 Split device_t and softc for all com(4) devices (well, everything that
uses a com_softc backend).  Use proper types and ansify where appropriate.
2008-03-14 15:09:09 +00:00
dyoung 3df2b2feb5 Use device_t and its accessors throughout. Use aprint_*_dev().
Improve PMF-ability.

        Add a 'flags' argument to suspend/resume handlers and
        callers such as pmf_system_suspend().

        Define a flag, PMF_F_SELF, which indicates to PMF that a
        device is suspending/resuming itself.  Add helper routines,
        pmf_device_suspend_self(dev) and pmf_device_resume_self(dev),
        that call pmf_device_suspend(dev, PMF_F_SELF) and
        pmf_device_resume(dev, PMF_F_SELF), respectively.  Use
        PMF_F_SELF to suspend/resume self in ath(4), audio(4),
        rtw(4), and sip(4).

        In ath(4) and in rtw(4), replace the icky sc_enable/sc_disable
        callbacks, provided by the bus front-end, with
        self-suspension/resumption.  Also, clean up the bus
        front-ends.  Make sure that the interrupt handler is
        disestablished during suspension.  Get rid of driver-private
        flags (e.g., RTW_F_ENABLED, ath_softc->sc_invalid); use
        device_is_active()/device_has_power() calls, instead.

        In the network-class suspend handler, call if_stop(, 0)
        instead of if_stop(, 1), because the latter is superfluous
        (bus- and driver-suspension hooks will 'disable' the NIC),
        and it may cause recursion.

        In the network-class resume handler, prevent infinite
        recursion through if_init() by getting out early if we are
        self-suspending (PMF_F_SELF).

rtw(4) improvements:

        Destroy rtw(4) callouts when we detach it.  Make rtw at
        pci detachable.  Print some more information with the "rx
        frame too long" warning.

Remove activate() methods:

        Get rid of rtw_activate() and ath_activate().  The device
        activate() methods are not good for much these days.

Make ath at cardbus resume with crypto functions intact:

        Introduce a boolean device property, "pmf-powerdown".  If
        pmf-powerdown is present and false, it indicates that a
        bus back-end should not remove power from a device.

        Honor this property in cardbus_child_suspend().

        Set this property to 'false' in ath_attach(), since removing
        power from an ath at cardbus seems to lobotomize the WPA
        crypto engine.  XXX Should the pmf-powerdown property
        propagate toward the root of the device tree?

Miscellaneous ath(4) changes:

        Warn if ath(4) tries to write crypto keys to suspended
        hardware.

        Reduce differences between FreeBSD and NetBSD in ath(4)
        multicast filter setup.

        Make ath_printrxbuf() print an rx descriptor's status &
        key index, to help debug crypto errors.

        Shorten a staircase in ath_ioctl().  Don't check for
        ieee80211_ioctl() return code ERESTART, it never happens.
2008-03-12 18:02:21 +00:00
dyoung 9a0e417e90 Use device_t and accessors. Setup power management in the PCI
front-end (XXX needs to look more alike the Cardbus front-end).
Establish the shutdown hook using PMF.
2008-03-07 22:32:52 +00:00
dyoung 5d30fe1a78 Use device_t and accessors. Use PMF instead of legacy power
management.  Establish the shutdown hook using PMF.
2008-03-07 22:04:00 +00:00
dyoung 81f7f6b3f2 Use device_t and its accessors. In uhci_{pci,cardbus}_attach, use
`self' instead of casting the softc to void *.
2008-03-07 21:57:56 +00:00
dyoung 347c1a2644 Use device_t and accessors.
In ohci_{pci,cardbus}_attach, do not get the device_t by casting
the softc to void *, but use `self' instead.
2008-03-07 21:48:46 +00:00
dyoung 2e3b67d337 Register the shutdown hook using pmf_device_register1(). 2008-03-07 21:36:51 +00:00
drochner 0e748e633e Extend the pmf suspend/resume hooks by a shutdown method, so drivers
can register a shutdown handler explicitely.
Install a pci bus shutdown handler which disables bus master accesses
for all childs, so the drivers don't need to care.
This will hopefully be sufficient to replace the shutdownhooks
(together with the powerhooks). (It has been suggested to use some
general event notification framework for shutdown handlers, but there
might be cases where shutdown handlers must be run in an order following
the device hierarchy, which wouldn't be easy with event handlers
not tied to drivers.)
approved by David Young
2008-02-28 14:25:12 +00:00
dyoung 2511aa0b7f Reduce diffs between cardbus_set_powerstate_int() and
pci_set_powerstate_int().
2008-02-23 00:30:56 +00:00
dyoung 520b45a1f0 Make the CardBus D2/D3 power-handling more alike to PCI's, but
without the typos. :-)

Use device_t and accessors.  Use aprint_*_dev().  Use PMF_FN_*.
2008-02-22 23:30:42 +00:00
dyoung 08a54ea3b3 Use device_xname(). 2008-02-18 06:17:27 +00:00
dyoung efad92c959 On a tlp@cardbus, don't set the Tx FIFO threshold to "store &
forward" mode, but let the driver automatically adjust.

Cardbus is not actually so slow that it cannot keep up with the
NIC.  It may sometimes have appeared so because we had not enabled
PCI read bursts.   These days, though, we enable read bursts on at
least one TI PCI-Cardbus bridge.
2008-02-06 22:11:54 +00:00
dyoung 5c1733cd95 Assert that 'offset' is divisible by four, since we're using it to
index a PCI configuration register.
2008-02-06 22:06:28 +00:00
dyoung 50b7998db1 After rtw_attach() is called, the hardware has been powered down,
so don't fiddle with the Function Event Registers.
2008-01-08 18:26:09 +00:00
dyoung 17b65ff15d Disable pci_disable_retry() and cardbus_disable_retry(), with a
long comment on pci_disable_retry() (cross-referenced at
cardbus_disable_retry()) that explains why.
2008-01-03 23:15:43 +00:00
dyoung e9596bf19e Introduce a struct cardbus_chipset_tag, and make cardbus_chipset_tag_t
a pointer to that struct, so that we cannot assign pointers of
arbitrary type to cardbus_chipset_tag_t.  Tweak cbb(4) to accomodate
this change.

Make Cardbus_conf_read() and Carbus_conf_write() pass the right
arguments to cardbus_functions->cardbus_conf_{read,write}() for a
change.

Let's hope this stops the crash in cardbus_function_enable() that
macallan@ reported to me.
2008-01-02 23:11:34 +00:00
dyoung 4f422f7b22 Don't assign a cardbus function tag to a cardbus chipset tag.
Michael Lorenz, macallan@, actually found this bug.

(I will change cardbus_chipset_tag_t to a struct * from void *, so
that the compiler will detect similar typos in the future.)
2008-01-02 23:04:25 +00:00
dyoung 91345ba277 Do not read past the CIS region. Stops an MCHK exception on macppc
(reported by macallan@).

I originally detected this bug by activating 'PCI master target
abort' interrupts on the AMD Elan SC520 processor.  Lo and behold,
several interrupts occurred before the system had finished booting!
NetBSD should probably activate PCI exception reporting whenever
it is available.
2008-01-02 22:29:00 +00:00
dyoung a142fc9c6b Add a debug message with aprint_debug_dev(). Use the right bus
tag.
2008-01-02 02:05:19 +00:00
dyoung 356cc80ff6 It makes practically no functional difference, but add curly braces
where they were intended.
2007-12-22 00:39:47 +00:00
dyoung eafb0f479a Initialize and destroy the ATH_LOCK. 2007-12-21 18:26:13 +00:00
dyoung 1d18d8049c Do not embed a struct device in rtw_softc any longer. Register
both pci and cardbus attachments with CFATTACH_DECL_NEW().  Access
the softc through the device_t using device_private().

While I'm here, change a couple of KASSERT()s about the Rx buffer
length to a warning.
2007-12-21 18:22:43 +00:00
dyoung cf784f4497 Improve pci, cbb, cardslot, cardbus, and pcmcia to support detachment
of this entire device tree:

pci0 at mainbus0
        elansc0 at pci0
                gpio0 at elansc0
        cbb0 at pci0
                cardslot0 at cbb0
                        cardbus0 at cardslot0
                        pcmcia0 at cardslot0
        cbb1 at pci0
                cardslot1 at cbb1
                        cardbus1 at cardslot1
                                rtw0 at cardbus1
                        pcmcia1 at cardslot1
        sip0 at pci0
                nsphyter0 at sip0
        sip1 at pci0
                nsphyter1 at sip1

Whew!
2007-12-16 21:28:30 +00:00
dyoung 058d9b982e Synchronize device detachment with network interrupts. Use the
pmf network class instead of powerhooks.
2007-12-16 00:04:07 +00:00
dyoung c4245b0ab7 Oops, make last change compile. 2007-12-14 03:22:19 +00:00
dyoung 9a075a9c73 Comment-out calls to pci_disable_retry() and cardbus_disable_retry().
They do not seem well-justified according to anyone's understanding
of what they really do, and it seems especially inappropriate to
call them at attach- and resume-time.
2007-12-14 03:18:46 +00:00
jmcneill 94d68e1562 pmf_driver_register -> pmf_device_register 2007-12-09 23:58:40 +00:00
jmcneill 5430a31312 Register with power management framework. 2007-12-09 23:47:53 +00:00
jmcneill 4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
jmcneill 0791e7eb6c One of these aprint_normals should have been aprint_naive 2007-12-01 17:56:59 +00:00
jmcneill 4fbe23fdd0 aprintify 2007-12-01 04:50:50 +00:00
dyoung 3b205d80f9 Detect cardbus_setpowerstate() errors and aprint_debug() a warning.
Leave alone the Latency Timer set by the Cardbus bridge.

With version 1.152 of dev/pci/pccbb.c, we can power down the card
when it is not in-use, so do that.
2007-11-21 02:10:45 +00:00
dyoung c666294335 Take out some debug messages that accidentally slipped in. Thanks,
Bernd Ernesti, for letting me know! :-)
2007-11-16 20:25:47 +00:00
dyoung 12f2113cc2 Cosmetic changes: Join some lines. Remove superfluous parentheses
and braces.  Change a variable name.  Add #if 0'd cardbus_conf_capture()
and cardbus_conf_restore() calls for future reference.
2007-11-16 18:47:41 +00:00
dyoung b23d50169b Use cardbus_setpowerstate() instead of rolling our own.
Let the Cardbus bridge driver set our Latency Timer, but round down
to the nearest multiple of 0x10, since the RTL8180 datasheet may
be trying to tell us that is necessary.

Activate Parity & System Error reporting.

Use a more meaningful variable name, reg -> csr.
2007-11-16 18:46:23 +00:00