Home | History | Annotate | Download | only in cardbus
History log of /src/sys/dev/cardbus/if_rtk_cardbus.c
RevisionDateAuthorComments
 1.49  25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.48  13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.47  02-Feb-2012  tls branches: 1.47.6; 1.47.24;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.46  01-Aug-2011  drochner branches: 1.46.2; 1.46.6;
remove some bloat:
-cardbus doesn't use multiple interrupt lines like PCI, and it doesn't
use machanisms like interrupt line register and swizzling -- no need
to carry around dummy information, this is all dealt with by the
bridge
(I'm asking myself how "rbus_ppb" can work -- a bridge attached to
cardbus just can't work like a normal PCI bridge as far as interrupts
are concerned. I thing that should be a hardware specific driver
because behavior is not covered by a standard.)
-cardbus always uses 3.3V -- no need for a variable to keep track
of the voltage
 1.45  27-Jul-2010  jakllsch No need to store map size locally now.
 1.44  11-Mar-2010  dyoung branches: 1.44.2;
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

- cardbus_intr_disestablish(cc, cf, ih);
+ Cardbus_intr_disestablish(ct, ih);

- ih = cardbus_intr_establish(cc, cf, ...);
+ ih = Cardbus_intr_establish(ct, ...);

Tested by Juraj Hercek.
 1.43  26-Feb-2010  dyoung Use PCI_ constants and macros instead of CARDBUS_. Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.
 1.42  26-Feb-2010  dyoung sc_csr is read & written from the PCI Command & Status Register,
so make its type pcireg_t.
 1.41  25-Feb-2010  dyoung Make fxp at cardbus detach during shutdown.

Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.

Replace more CARDBUS_ constants with PCI_ constants.

Compile-tested, only.
 1.40  24-Feb-2010  dyoung Start to tuck Cardbus under the PCI abstraction. Step #1, textual
substitution: for all practical purposes, pcitag_t and cardbustag_t
are interchangeable, so just use pcitag_t. Ditto pcireg_t and
cardbusreg_t.

While I'm here, don't make a copy (sc_intrline) of
cardbus_attach_args.ca_intrline unless we use it, later.
 1.39  18-Jan-2010  pooka branches: 1.39.2;
Remove conditional inclusion of unused bpf.h
 1.38  05-Sep-2009  tsutsui Invert logic around nested pmf(9) registrations for readability.
 1.37  24-Jun-2008  drochner clean up the cardbus interrupt stuff:
There were cardbus_intr_line_t and cardbus_intr_handle_t used intermixed
for the same variable, and that variable is pretty much useless because
cardbus doesn't follow the PCI interrupt swizzling etc scheme.
Useless interrupt numbers were printed on cardbus device attach.
So as a first step to sanity, kill cardbus_intr_handle_t and poison
cardbus_intr_line_t to discourage printing it as a %d.
Use cardbus_intr_line_t consistently throughout the code.
Remove the "interrupting at foo" messages because the information
is misleading. We could come up with a better interrupt vector
information, but because cardbus interrupts are mediated by pccbb
it would still be misleading.
 1.36  25-Apr-2008  tsutsui branches: 1.36.2; 1.36.4; 1.36.6;
Split device_t/softc for re(4) and rtk(4).
 1.35  06-Apr-2008  cegger branches: 1.35.2;
use aprint_*_dev and device_xname
 1.34  09-Dec-2007  jmcneill branches: 1.34.10;
Merge jmcneill-pm branch.
 1.33  19-Oct-2007  ad branches: 1.33.4; 1.33.6;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.32  21-Mar-2007  tsutsui branches: 1.32.8; 1.32.10; 1.32.14;
Cleanup handling of quikrs on each RealTek chip:
- replace rtk_type member in rtk_softc which has chip types
with new rtk_quirk that represents quirks on each chip:
- RTKQ_8129 doesn't have internal MII (used in rtk(4))
- RTKQ_8139CPLUS has different register layout (for re(4))
- RTKQ_8169NONS (original 8169) requires some settings on init
- RTKQ_PCIE requires different settings in setmulti
so that we don't have to check each hwrev values or types everywhere
and newer variants will also work without changes if they don't
have other quirks
(sc_rev is unchenged for now for reference to the Realtek's driver)
- don't check hwrev register in re_pci_match() but check
only PCI_VENDER(), PCI_PRODUCT() and PCI_REVISION()
so that we no longer have to map pci space there
- add a new HWREV value for another 8168 variant
- try to map PCI mem space more properly
- remove (probably unneeded) ifp->if_baudrate initialization

Tested on a newer 8168 variant by Dennis den Brok on tech-kern,
and also tested on 8139 and 8169C on macppc, and 8139C+ on landisk
by me.
 1.31  16-Nov-2006  christos branches: 1.31.2; 1.31.4; 1.31.8; 1.31.10; 1.31.12; 1.31.14;
__unused removal on arguments; approved by core.
 1.30  27-Oct-2006  dogcow Sync up with rtk 'common macro' changes.
 1.29  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.28  07-Sep-2006  dogcow branches: 1.28.2; 1.28.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.27  29-Mar-2006  thorpej Use device_private().
 1.26  11-Dec-2005  christos branches: 1.26.4; 1.26.6; 1.26.8; 1.26.10; 1.26.12;
merge ktrace-lwp.
 1.25  27-Feb-2005  perry branches: 1.25.2; 1.25.4;
nuke trailing whitespace
 1.24  04-Feb-2005  perry de-__P
 1.23  02-Aug-2004  mycroft branches: 1.23.4; 1.23.6;
Minor name change to match other stuff in pcidevs.
 1.22  02-Aug-2004  mycroft cardbusdevs -> pcidevs
 1.21  22-Jul-2004  mycroft Program BARs before enabling memory or I/O access.
 1.20  06-Jun-2004  dyoung Name some constants. Perhaps this deserves the cardbus_setpowerstate
treatment?
 1.19  11-Mar-2004  kanaoka Add (missed)"csc->sc_ih = NULL;" in rtk_cardbus_disable().

This fixed panic when card removed
after "ifconfig rtk0 up; ifconfig rtk0 down".
 1.18  13-Feb-2004  wiz RealTek -> Realtek.
 1.17  02-Nov-2003  wiz Fix some typos. From Tom Cosgrove via jmc@openbsd.
 1.16  25-Oct-2003  fvdl Add definitions for 8139C+ and 8169 chips. Not used yet. From FreeBSD.
 1.15  26-Jun-2003  ichiro branches: 1.15.2;
add products
Planex 10/100BaseTX FNW-3800-TX
kern/20175
Corega FEther II CB-TXD 10/100BaseTX
kern/21497
 1.14  01-Feb-2003  ichiro add product IO-DATA CBET100-CL 10/100 Ethernet
(OEM AboCom FE2000VX )
 1.13  23-Dec-2002  tsutsui Sync with if_rtk_pci.c:
- Fix typo in printf message.
- Don't use PCI_PRODUCT_DELTA_8139 (0x1360) for args of cardbus_conf_read()
and cardbus_conf_write(); use CARDBUS_INTERRUPT_REG (0x3c) instead.
 1.12  11-Nov-2002  kanaoka Add support for "Planex FNW-3603 cardbus ethernet".
by kern/18961: From: prlw1@cam.ac.uk.
 1.11  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.10  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.9  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.8  27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.7  04-Jan-2002  kanaoka branches: 1.7.10;
Add support for "D-Link DFE-690TXD 10/100".
by kern/15100: From: John Nemeth <jnemeth@access.victoria.bc.ca>
 1.6  13-Nov-2001  lukem add RCSID
 1.5  20-Jun-2001  ichiro branches: 1.5.2;
support Raltek 8139-based Cardbus card
reported by Takayoshi Kochi(t-kouchi@mvf.biglobe.ne.jp)
kern/13252: RealTek 8139-based Cardbus support
 1.4  15-May-2001  kanaoka Add support for "Corega FEther CB-TXD".
kern/12709: from Yamashiro Jun <j99060@ie.u-ryukyu.ac.jp>.
 1.3  19-May-2000  tsutsui branches: 1.3.4; 1.3.6; 1.3.8;
- Change RL_* -> RTK_*
- Free bus_dma resources if attach fails
- Add detach and power management code

Patch from Masanori Kanaoka <kanaoka@ann.hi-ho.ne.jp> in kern/10156.
 1.2  15-May-2000  thorpej Symbol namespace cleanup: rl_ -> rtk_
 1.1  10-May-2000  haya Move if_rl_cardbus.c:1.8 to if_rtk_cardbus.c.
 1.3.8.8  29-Dec-2002  thorpej Sync with HEAD.
 1.3.8.7  11-Nov-2002  nathanw Catch up to -current
 1.3.8.6  18-Oct-2002  nathanw Catch up to -current.
 1.3.8.5  28-Feb-2002  nathanw Catch up to -current.
 1.3.8.4  11-Jan-2002  nathanw More catchup.
 1.3.8.3  14-Nov-2001  nathanw Catch up to -current.
 1.3.8.2  24-Aug-2001  nathanw Catch up with -current.
 1.3.8.1  21-Jun-2001  nathanw Catch up to -current.
 1.3.6.2  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.6.1  19-May-2000  bouyer file if_rtk_cardbus.c was added on branch thorpej_scsipi on 2000-11-20 11:39:54 +0000
 1.3.4.2  15-Dec-2002  he Pull up revision 1.12 (requested by kanaoka):
Add support for Planex FNW-3603 cardbus ethernet. Fixes
PR#18961.
 1.3.4.1  05-Jan-2002  he Pull up revisions 1.4-1.5,1.7 (requested by kanaoka):
Add support for the following cards:
o D-Link DFE-690TXD 10/100
o Realtek 8139 based cards
o Corega FEther CB-TXD
Fixes PR#15100, PR#13252 and PR#12709.
 1.5.2.2  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.10.1  11-Dec-2002  he Pull up revision 1.12 (requested by kanaoka in ticket #979):
Add support for ``Planex FNW-3603 cardbus ethernet''.
Fixes PR#18961.
 1.15.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.4  04-Feb-2005  skrll Sync with HEAD.
 1.15.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1  03-Aug-2004  skrll Sync with HEAD
 1.23.6.2  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.23.6.1  12-Feb-2005  yamt sync with head.
 1.23.4.1  29-Apr-2005  kent sync with -current
 1.25.4.5  21-Jan-2008  yamt sync with head
 1.25.4.4  27-Oct-2007  yamt sync with head.
 1.25.4.3  03-Sep-2007  yamt sync with head.
 1.25.4.2  30-Dec-2006  yamt sync with head.
 1.25.4.1  21-Jun-2006  yamt sync with head.
 1.25.2.2  04-Oct-2007  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1852):
sys/dev/ic/rtl81x9var.h: revision 1.39
sys/dev/cardbus/if_re_cardbus.c: revision 1.13
sys/dev/pci/if_re_pci.c: revision 1.27 via patch
sys/dev/pci/if_rtk_pci.c: revision 1.32
sys/dev/cardbus/if_rtk_cardbus.c: revision 1.32
sys/dev/ic/rtl8169.c: revision 1.84, 1.85
sys/dev/ic/rtl81x9reg.h: revision 1.27
sys/dev/ic/rtl81x9.c: revision 1.72
Cleanup handling of quikrs on each RealTek chip:
Pull a fix for PCIe variants from FreeBSD
 1.25.2.1  03-Mar-2007  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1673):
distrib/sets/lists/man/mi 1.844, 1.871
share/man/man4/Makefile 1.372, 1.379 via patch
share/man/man4/re.4 1.8, 1.9, 1.11, 1.12
share/man/man4/rgephy.4 1.1
share/man/man4/rlphy.4 1.1, 1.2
sys/arch/amd64/conf/GENERIC 1.79, 1.89
sys/arch/amd64/conf/INSTALL 1.45, 1.49
sys/arch/i386/conf/GENERIC 1.717, 1.747
sys/arch/i386/conf/GENERIC_LAPTOP 1.164
sys/arch/i386/conf/INSTALL 1.277, 1.283
sys/arch/i386/conf/INSTALL_LAPTOP 1.96, 1.98
sys/arch/i386/conf/XEN2_DOM0 1.22 via patch
sys/arch/macppc/conf/GENERIC 1.220, 1.246
sys/arch/macppc/conf/INSTALL 1.96, 1.100
sys/dev/cardbus/if_re_cardbus.c 1.10
sys/dev/cardbus/if_rtk_cardbus.c 1.29-1.31
sys/dev/ic/rtl8169.c 1.14, 1.20, 1.24, 1.25, 1.28-1.61, 1.63, 1.64-1.81 via patch
sys/dev/ic/rtl81x9.c 1.52, 1.54-1.63, 1.65, 1.67-1.70
sys/dev/ic/rtl81x9reg.h 1.15-1.26
sys/dev/ic/rtl81x9var.h 1.19, 1.21-1.37
sys/dev/mii/files.mii 1.38
sys/dev/mii/miidevs 1.62, 1.64
sys/dev/mii/rgephy.c 1.10, 1.13-1.16
sys/dev/mii/rlphy.c 1.1, 1.6, 1.7, 1.11 via patch
sys/dev/pci/if_re_pci.c 1.13, 1.15-1.17, 1.19-1.23
sys/dev/pci/if_rtk_pci.c 1.25, 1.28, 1.29, 1.31
sys/dev/pci/pcidevs 1.851, 1.852

on re(4):
- improve stability (I believe ;-)
- add a workaround for hardware ip4csum-tx bug
- support newer chips (8169SB/SC, PCIe based 8168 etc.)
- fix 8139C+ support
- enable hardware VLAN
- misc bus_dma(9) fix (which makes re(4) work on mips ports)

on rtk(4):
- fix kern/31348
- fix possible panic on dreamcast
 1.26.12.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.26.10.1  19-Apr-2006  elad sync with head.
 1.26.8.2  14-Sep-2006  yamt sync with head.
 1.26.8.1  01-Apr-2006  yamt sync with head.
 1.26.6.1  22-Apr-2006  simonb Sync with head.
 1.26.4.1  09-Sep-2006  rpaulo sync with head
 1.28.4.2  10-Dec-2006  yamt sync with head.
 1.28.4.1  22-Oct-2006  yamt sync with head
 1.28.2.1  18-Nov-2006  ad Sync with head.
 1.31.14.1  03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.31.12.1  29-Mar-2007  reinoud Pullup to -current
 1.31.10.1  11-Jul-2007  mjf Sync with head.
 1.31.8.2  23-Oct-2007  ad Sync with head.
 1.31.8.1  10-Apr-2007  ad Sync with head.
 1.31.4.1  24-Mar-2007  yamt sync with head.
 1.31.2.1  16-May-2007  jdc Pull up revision 1.32 (requested by tsutsui in ticket #640).

Cleanup handling of quikrs on each RealTek chip:
- replace rtk_type member in rtk_softc which has chip types
with new rtk_quirk that represents quirks on each chip:
- RTKQ_8129 doesn't have internal MII (used in rtk(4))
- RTKQ_8139CPLUS has different register layout (for re(4))
- RTKQ_8169NONS (original 8169) requires some settings on init
- RTKQ_PCIE requires different settings in setmulti
so that we don't have to check each hwrev values or types everywhere
and newer variants will also work without changes if they don't
have other quirks
(sc_rev is unchenged for now for reference to the Realtek's driver)
- don't check hwrev register in re_pci_match() but check
only PCI_VENDER(), PCI_PRODUCT() and PCI_REVISION()
so that we no longer have to map pci space there
- add a new HWREV value for another 8168 variant
- try to map PCI mem space more properly
- remove (probably unneeded) ifp->if_baudrate initialization

Tested on a newer 8168 variant by Dennis den Brok on tech-kern,
and also tested on 8139 and 8169C on macppc, and 8139C+ on landisk
by me.
 1.32.14.1  25-Oct-2007  bouyer Sync with HEAD.
 1.32.10.2  09-Jan-2008  matt sync with HEAD
 1.32.10.1  06-Nov-2007  matt sync with HEAD
 1.32.8.4  08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.32.8.3  06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.32.8.2  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.32.8.1  05-Oct-2007  joerg Remove the power management nonsense in the PCI versions of
rtk(4) and re(4). It is not really likely to work anyway.
Use PNP power management for the cardbus attachment as well and
remove the power management handlers from the chipset code.
 1.33.6.1  11-Dec-2007  yamt sync with head.
 1.33.4.1  26-Dec-2007  ad Sync with head.
 1.34.10.2  29-Jun-2008  mjf Sync with HEAD.
 1.34.10.1  02-Jun-2008  mjf Sync with HEAD.
 1.35.2.1  18-May-2008  yamt sync with head.
 1.36.6.1  27-Jun-2008  simonb Sync with head.
 1.36.4.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.36.2.4  11-Aug-2010  yamt sync with head.
 1.36.2.3  11-Mar-2010  yamt sync with head
 1.36.2.2  16-Sep-2009  yamt sync with head
 1.36.2.1  04-May-2009  yamt sync with head.
 1.39.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.39.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.44.2.1  05-Mar-2011  rmind sync with head
 1.46.6.1  18-Feb-2012  mrg merge to -current.
 1.46.2.1  17-Apr-2012  yamt sync with head
 1.47.24.1  06-Jun-2015  skrll Sync with HEAD
 1.47.6.1  03-Dec-2017  jdolecek update from HEAD

RSS XML Feed