Home | History | Annotate | Download | only in cardbus
History log of /src/sys/dev/cardbus/if_re_cardbus.c
RevisionDateAuthorComments
 1.27  01-Aug-2011  drochner 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.26  27-Jul-2010  jakllsch Make the Realtek PCI network interfaces detachable.
Use __arraycount to avoid null table entries.
Miscellaneous other touch-ups in bus front-ends.
 1.25  18-Mar-2010  dyoung 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, ...);

The identical change to a few other CardBus NICs has not caused any
problems, as expected, so I'm going to commit this rather safe change
and get on with the work.

Testers have been enlisted. I will revisit this change if I get any
negative responses.
 1.24  26-Feb-2010  dyoung branches: 1.24.2;
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.23  26-Feb-2010  dyoung sc_csr is read & written from the PCI Command & Status Register,
so make its type pcireg_t.
 1.22  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.21  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.20  02-Sep-2009  tsutsui branches: 1.20.2;
Move pmf(9) calls to MI re_attach() and re_detach() from each backend.
 1.19  29-Aug-2009  tsutsui Remove unnecessary #includes.
 1.18  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.17  25-Apr-2008  tsutsui branches: 1.17.2; 1.17.4; 1.17.6;
Split device_t/softc for re(4) and rtk(4).
 1.16  06-Apr-2008  cegger branches: 1.16.2;
use aprint_*_dev and device_xname
 1.15  09-Dec-2007  jmcneill branches: 1.15.10;
Merge jmcneill-pm branch.
 1.14  19-Oct-2007  ad branches: 1.14.4; 1.14.6;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.13  21-Mar-2007  tsutsui branches: 1.13.8; 1.13.10; 1.13.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.12  18-Nov-2006  tsutsui branches: 1.12.2; 1.12.4; 1.12.8; 1.12.10; 1.12.12; 1.12.14;
Unwrap some lines (after __unused removal).
 1.11  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.10  27-Oct-2006  dogcow Sync up with rtk 'common macro' changes.
 1.9  12-Oct-2006  xtraeme More -Wunused warnings.
 1.8  07-Sep-2006  dogcow branches: 1.8.2; 1.8.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.7  29-Mar-2006  thorpej Use device_private().
 1.6  11-Dec-2005  christos branches: 1.6.4; 1.6.6; 1.6.8; 1.6.10; 1.6.12;
merge ktrace-lwp.
 1.5  27-Feb-2005  perry branches: 1.5.2; 1.5.4;
nuke trailing whitespace
 1.4  15-Jan-2005  kanaoka branches: 1.4.2; 1.4.4; 1.4.6;
- Use aprint_*.
- Use ANSI decls.
- Change some cosmetic.
 1.3  13-Jan-2005  kanaoka - Add my tested device in a comment.
- Change minimum value of latency timer from 0x20 to 0x40.
 1.2  26-Dec-2004  kanaoka - Use ether_ioctl().
- Remove unnecessary re_init() in re_attach().
- Remove notyet compile option.
 1.1  23-Dec-2004  jonathan Snapshot of incomplete-but-working split of re(4) driver into a
bus-independent backend, with PCI and CardBus attachment code.
The committed code has two serious bugs:

1. The driver makes no attempt to recover resources when a (Cardbus)
instance is removed; bus resources are leaked.

2. In testing with a NetGear GA-511, the Cardbus card never responded
to a reset/wakeup if the card is powered down after attachment.
So for now, leave cardbus instances powered up at attachment
(insertion, or at boot if a card is already present).

That aside, it acutally works on my GA-511. Committed as-is despite
the bugs, after repeated requests to make the code available for
further testing. Also requires sys/dev/mii/miidevs rev 1.54 -> 1.55,
and consequent regen of miidevs{,_data}.h.
 1.4.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.4.3  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.4.2  17-Jan-2005  skrll Sync with HEAD.
 1.4.4.1  15-Jan-2005  skrll file if_re_cardbus.c was added on branch ktrace-lwp on 2005-01-17 19:30:39 +0000
 1.4.2.1  29-Apr-2005  kent sync with -current
 1.5.4.5  21-Jan-2008  yamt sync with head
 1.5.4.4  27-Oct-2007  yamt sync with head.
 1.5.4.3  03-Sep-2007  yamt sync with head.
 1.5.4.2  30-Dec-2006  yamt sync with head.
 1.5.4.1  21-Jun-2006  yamt sync with head.
 1.5.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.5.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.6.12.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.6.10.1  19-Apr-2006  elad sync with head.
 1.6.8.2  14-Sep-2006  yamt sync with head.
 1.6.8.1  01-Apr-2006  yamt sync with head.
 1.6.6.1  22-Apr-2006  simonb Sync with head.
 1.6.4.1  09-Sep-2006  rpaulo sync with head
 1.8.4.2  10-Dec-2006  yamt sync with head.
 1.8.4.1  22-Oct-2006  yamt sync with head
 1.8.2.2  12-Jan-2007  ad Sync with head.
 1.8.2.1  18-Nov-2006  ad Sync with head.
 1.12.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.12.12.1  29-Mar-2007  reinoud Pullup to -current
 1.12.10.1  11-Jul-2007  mjf Sync with head.
 1.12.8.2  23-Oct-2007  ad Sync with head.
 1.12.8.1  10-Apr-2007  ad Sync with head.
 1.12.4.1  24-Mar-2007  yamt sync with head.
 1.12.2.1  16-May-2007  jdc Pull up revision 1.13 (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.13.14.1  25-Oct-2007  bouyer Sync with HEAD.
 1.13.10.2  09-Jan-2008  matt sync with HEAD
 1.13.10.1  06-Nov-2007  matt sync with HEAD
 1.13.8.5  08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.13.8.4  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.13.8.3  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.13.8.2  05-Oct-2007  joerg Fix compilation errors that slipped through because i386/ALL doesn't
have re* at cardbus.
 1.13.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.14.6.1  11-Dec-2007  yamt sync with head.
 1.14.4.1  26-Dec-2007  ad Sync with head.
 1.15.10.2  29-Jun-2008  mjf Sync with HEAD.
 1.15.10.1  02-Jun-2008  mjf Sync with HEAD.
 1.16.2.1  18-May-2008  yamt sync with head.
 1.17.6.1  27-Jun-2008  simonb Sync with head.
 1.17.4.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.17.2.4  11-Aug-2010  yamt sync with head.
 1.17.2.3  11-Mar-2010  yamt sync with head
 1.17.2.2  16-Sep-2009  yamt sync with head
 1.17.2.1  04-May-2009  yamt sync with head.
 1.20.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.20.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.24.2.2  05-Mar-2011  rmind sync with head
 1.24.2.1  30-May-2010  rmind sync with head

RSS XML Feed