Commit Graph

185 Commits

Author SHA1 Message Date
Warner Losh
595166f0f7 Add support for PnP ISA cards, and some laptop PnP support:
o break out some of the probe routine the allocation of resources
  into an attach routine
o Recognize PnP ids
o Allocate IRQ per card rather than per system
o Better polling reporting
o Remove unneeded include files in slot.h
o store a pseudo unit number on each device we find.
o Pass a unit number to interrupt/timeout routine and use it for polling
  the hardware.

Tested on: My VAIO and with the Linksys pccard reader.
Approved by: jkh
2000-03-10 05:43:29 +00:00
Warner Losh
da144b9373 /tmp/msg 2000-02-21 06:52:20 +00:00
Peter Wemm
872309ccd4 Update the pci->pcic compatability module to newbus. This is a simple
conversion to eliminate the compatability shims without making any
significant changes.  This eliminates the shim warnings.

Obtained from:	n_himba (tweaked by me, don't blame him for this)
Approved by:	jkh
2000-02-02 16:49:21 +00:00
Tatsumi Hosokawa
87ef0a0afb Propagate MAC address in CIS tupple to dev/ed/ driver.
Many ed-based Ethernet PC-cards can't get correct MAC address without
this patch.

Submitted by: Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp>
Reviewed by: Warner Losh <imp@village.org>
2000-01-21 03:08:46 +00:00
Tatsumi Hosokawa
a7da6b679e This fixes a bug that /etc/pccard_ether did not work without DHCP.
For example, when /etc/pccard.conf had ed0 in config line, but kernel
refused this name and said

devclass_alloc_unit: ed0 already exists, using next availale unit
number

Kernel used ed1 as device name and it did not match with config and
insert/remove lines.  Fortunately, dhclient was called without args,
and it works, but if we wanted to use static IP address for PC-card,
it did not work.

This modification makes pccardd to execute insert/remove lines with
the true device name that returns from kernel.  (Last change to
etc/pccard.conf.sample eliminated all hardwired device name from
insert/remove lines in /etc/pccard.conf)
2000-01-16 06:44:48 +00:00
Tatsumi Hosokawa
d789ee6ac8 Fixed a bug in PCIC polling mode.
(it does not work without this fix)
2000-01-15 12:02:03 +00:00
Warner Losh
ff95378bb1 Stop the recurring feeling of deja vu
Stop the recurring feeling of deja vu
Stop the recurring feeling of deja vu
Stop the recurring feeling of deja vu

and debounce the eject messages.  We now mark the socket empty in the
interrupt handler, rather than after we've disabled the socket which
happens "much later".
2000-01-13 06:32:33 +00:00
Bill Fumerola
4eb47ecfab Fill in the blanks for some of the Texas Instruments cardbus controllers.
Obtained from:	NetBSD (syssrc/sys/dev/pci/pcidevs)
1999-12-31 07:22:24 +00:00
Bill Fumerola
f88e599fcb Copy Texas Instruments cardbus controllers from pcisupport.c, the pcisupport.c
probes are at the 'chip' level and will get overridden by pcic_p if it is
compiled in. It's still nice to get the better probe message if it's not...

Requested by:	imp
1999-12-29 13:33:37 +00:00
Peter Wemm
c447342094 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 05:07:58 +00:00
Warner Losh
88f1ea0a8c Move the turning on of the interrupts for the card at the bridge from
the activate method to the setup_intr, and turn it off to
teardown_intr.

This makes the ed driver not enter its interrupt routine during the
probe.  Apparently, an interrupt happens when you disable the
interrupts.  There are other problems with ed still.
1999-12-10 07:02:41 +00:00
Warner Losh
d95b5da991 Switch to using suspend/resume methods rather than the APM hooks.
Should have no effect, but does make things a little cleaner.  I
thought this was the race that was causing problems, but it turned out
to be in pccardd waking up after the empty/insert events had happened
and being confused.

Minor cleanup:
o Remove isahd from pccard_devinfo
o remove extra from controller
o formatting nits
o use PCCARD_DEVINFO(d) rather than a bare device_get_ivars(d)
1999-12-08 07:55:20 +00:00
Bill Paul
8d29af8945 Fix alloc_driver() so that calls devclass_get_device() with slt->slotnum
as the unit argument instead of 0. disable_slot() calls
devclass_get_device() correctly, however because alloc_driver() does
it wrong, disable_slot() is unable to locate the child devices
attached to the pccard bus and thus fails to call device_delete_child()
on them. The end result is that when a card is removed, its detach
routine is never called, and re-insertion always fails.

With this fix (and the previous one to if_wi.c), I can now insert,
remove and re-insert my WaveLAN/IEEE card and things behave correctly.
kldunloading the if_wi.ko module also seems to work properly now.

Ok'ed by: imp
1999-12-08 05:34:17 +00:00
Warner Losh
4e3e1583d1 Remove unused junk: next fields and list head. Likely not completely
needed on software reaching EOL, but I'd have caught the hang bug sooner
had I done this earlier.
1999-12-06 01:35:37 +00:00
Matthew N. Dodd
fe0d408987 Remove the 'ivars' arguement to device_add_child() and
device_add_child_ordered().  'ivars' may now be set using the
device_set_ivars() function.

This makes it easier for us to change how arbitrary data structures are
associated with a device_t.  Eventually we won't be modifying device_t
to add additional pointers for ivars, softc data etc.

Despite my best efforts I've probably forgotten something so let me know
if this breaks anything.  I've been running with this change for months
and its been quite involved actually isolating all the changes from
the rest of the local changes in my tree.

Reviewed by:	peter, dfr
1999-12-03 08:41:24 +00:00
Warner Losh
b152132e64 Print device names for children that fail to detach.
Free child array when we're done with it.

Forgotten by: imp
Submitted by: Nick Hibma <hibma@skylink.it>
1999-12-02 19:51:34 +00:00
Warner Losh
03599baeb2 Make pccardc beep actually work. The kernel was doing the wrong thing
with the beep information it had (like ignoring it).

Submitted by: sanpei@sanpei.org (MIHIRA-san Yoshiro)

Add $FreeBSD$ to pccard_beep.c while I'm here.
1999-12-02 19:46:41 +00:00
Warner Losh
4ecd5f6e8c /tmp/msg 1999-12-02 05:46:22 +00:00
Warner Losh
861f505f42 Forgot to commit this in last commit. 1999-12-01 15:45:39 +00:00
Warner Losh
e09f49b6fa Fix the hang on card eject problem and maybe the hang on suspend
problem.

o Create new timeout routine so we don't detach the card inside a ISR
  but instead drop back to spl0 via a timeout of 0.
o Actually delete the child of the pccard device rather than just faking
  it badly.
o Fix sio, ed and ep to have pccard detach routines that are int rather
  than void.
o Fix ep and ed pccard detach routines to use if_detach rather than just
  if_down.  if_detach destroys the device, while if_down just marks it
  down.  In this incarnation of the pccard things, we map the disable
  the slot action to detach the driver, which removes the driver from the
  device tree.  When that is done, a panic would soon follow as the
  ifconfig tried to down the device.

Didn't fix:
o Should cache the pccard dev child's pointer in struct slot
o remove now unused parts of struct slot
o Any driver using softc after detach has been called.  sio's softc used
  to be statically allocated, so you could check sc->gone, but that is
  now gone.
o Didn't remove gone from softc of drivers that use the old pccard method.

Didn't test:
o ed driver changes
o sio driver changes on pccards
o suspend (no laptop or apm support on my desktop)
1999-12-01 07:38:54 +00:00
Eivind Eklund
e9f0f7d4ad Add the PCI id for the TI PCI-1251B PCI-CardBus bridge.
Submitted by:   Martin Blapp <mb@imp.ch>
1999-11-28 13:37:35 +00:00
Jun Kuriyama
31de378d47 s/Brige/Bridge/. 1999-11-21 00:53:23 +00:00
Peter Wemm
5ab0514321 Allow NULL for startp and/or countp in bus_get_resource() so that you can
get one of the two without having to use a dummy variable.
1999-11-20 14:56:55 +00:00
Warner Losh
27e8060d4a Kill unneeded includes
Found by phk's script a while ago.
1999-11-20 05:02:00 +00:00
Warner Losh
077e8ab387 I'm told this makes more laptops work with the new attachment code.
Submitted by: archie cobbs
1999-10-29 04:41:07 +00:00
Warner Losh
78d7954c0f Do not add children for new bus kludge version of pccard.
Fix some compile warnings.
1999-10-28 04:51:39 +00:00
Warner Losh
923a651ddf Remove debug printfs and Debugger() calls.
Add support for memory mapping

This should allow pccard that need memory mapping to work, but I don't
have one to test against.
1999-10-25 23:17:24 +00:00
Warner Losh
4f76d87b21 Massive rewrite of pccard to convert it to newbus.
o Gut the compatibility interface, you now must attach with newbus.
o Unit numbers from pccardd are now ignored.  This may change the units
  assigned to a card.  It now uses the first available unit.
o kill old skeleton code that is now obsolete.
o Use newbus attachment code.
o cleanup interfile dependencies some.
o kill list of devices per slot.  we use the device tree for what we need.
o Remove now obsolete code.
o The ep driver (and maybe ed) may need some config file tweaks to
  allow it to attach.  See config files that were committed for examples
  on how to do this.

Drivers to be commited shortly.

This is an interrum fix until the new pccard.  ed, ep and sio will be
supported by me with this release, although others are welcome to try
to support other devices before new pccard is working.

I plan on doing minimal further work on this code base.  Be careful
when upgrading, since this code is known to work on my laptop and
those of a couple others as well, but your milage may vary.

BUGS TO BE FIXED:

o system memory isn't allocated yet, it will be soon.
o No devices actually have a pccard newbus attach in the tree.

BUGS THAT MIGHT BE FIXED:

o card removal, including suspend, usually hangs the system.

Many thanks to Peter Wemm and Doug Rabson for helping me to fill in
the missing bits of New Bus understanding at FreeBSD Con '99.
1999-10-25 02:41:58 +00:00
Warner Losh
35c0baa6b7 Remove name field from controller information. Fix name setting in
pc98 case that I missed before.  Attempt to get the irq for the PCIC
first from the loader env var and second from the config system.  I've
been able to boot my laptop with a kernel that hardwired the irq to
10.  This should allow boot -c to finally start working for pcic irq,
but I've not tested that.  Add $FreeBSD$ to slot.h.
1999-10-16 05:11:46 +00:00
Warner Losh
ed33958521 Add new file for pccard compatibilty code. Add it to files so it gets
pulled in as well.
1999-10-15 17:32:32 +00:00
Warner Losh
b5137699ae Reorganize the attachement point for pcic (it was unattached and
floating before).  Attach pccard devices to pcic, one per slot
(although this may change to one per pcic).  pcic is now attached to
isa (to act as a bridge) and pccard is attached to pcic, cbb and
pc98ic (the last two are card bus bridge and the pc98ic version of
pcic, neither of which are in the tree yet).  Move pccard compat code
into pccard/pccard_compat.c.

THIS REQUIRES A CONFIG FILE CHANGE.  You must change your pcic/card
entries to be:
# PCCARD (PCMCIA) support
controller	pcic0	at isa?
controller	pcic1	at isa?
controller	card0

The old system was upside down and this corrects that problem.  It
will make it easier to add support for YENTA pccard/card bus bridges.

Much more cleanup needs to happen before newbus devices can have
pccard attachments.  My previous commit's comments were premature.
1999-10-15 17:29:21 +00:00
Warner Losh
53cdc67254 Make it easier to have completely new bus attachment points for pccard
devices.  There may still be problems with said drivers, if so please
let me know.

o Move attach-like functionality to the nbk attach compatibility code.
o Smarter probe code: for the compatibility code probe succeeds if
  strcmp succeeds, for noncompatibility you can do anything you like.
o Get rid of some compiler warnings introduced in last commit.
1999-10-15 03:10:13 +00:00
Warner Losh
58a49816c7 *** empty log message *** 1999-09-26 21:52:43 +00:00
Warner Losh
8fc2f800b0 Kill printf warnings. 1999-09-26 21:24:36 +00:00
Poul-Henning Kamp
d6a0e38a1b Remove five now unused fields from struct cdevsw. They should never
have been there in the first place.  A GENERIC kernel shrinks almost 1k.

Add a slightly different safetybelt under nostop for tty drivers.

Add some missing FreeBSD tags
1999-09-25 18:24:47 +00:00
Peter Wemm
c5cf380782 $Id$ -> $FreeBSD$ 1999-09-06 11:23:05 +00:00
Warner Losh
b99d6b5edc Kludge together support for the old pccard system with newbus. This
will allow newbus based drivers to have pccard attachments.  Also
start printing out probe messages for pccards stating the resources
used and regularize many of the pccard printfs.

Reviewed by: Peter Wemm.
1999-09-06 06:34:44 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Poul-Henning Kamp
9dcbe2404a Convert DEVFS hooks in (most) drivers to make_dev().
Diskslice/label code not yet handled.

Vinum, i4b, alpha, pc98 not dealt with (left to respective Maintainers)

Add the correct hook for devfs to kern_conf.c

The net result of this excercise is that a lot less files depends on DEVFS,
and devtoname() gets more sensible output in many cases.

A few drivers had minor additional cleanups performed relating to cdevsw
registration.

A few drivers don't register a cdevsw{} anymore, but only use make_dev().
1999-08-23 20:59:21 +00:00
Bill Fumerola
a444756625 (1) Fix a spelling mistake in a comment.
(2) Add braces to avoid ambigious if/if/else

Reviewed by:	bde
1999-08-17 22:13:06 +00:00
Warner Losh
0226bd1a3e o Add additional printfs for error cases when we can't attach the device.
o Add field to dev_desc for the size of the io port range.  This isn't
  used yet in the committed sources, but will make the transition easier
  in the future.

If you build this into your kernel, you will need to rebuild pccardd.
1999-08-01 18:12:51 +00:00
Peter Wemm
9929d2a045 Eliminate a bunch of #include "pci.h" and #if NPCI > 0 around entire
files.  config will leave the whole file out if configured to do so.
1999-07-03 20:17:08 +00:00
Poul-Henning Kamp
2447bec829 Simplify cdevsw registration.
The cdevsw_add() function now finds the major number(s) in the
struct cdevsw passed to it.  cdevsw_add_generic() is no longer
needed, cdevsw_add() does the same thing.

cdevsw_add() will print an message if the d_maj field looks bogus.

Remove nblkdev and nchrdev variables.  Most places they were used
bogusly.  Instead check a dev_t for validity by seeing if devsw()
or bdevsw() returns NULL.

Move bdevsw() and devsw() functions to kern/kern_conf.c

Bump __FreeBSD_version to 400006

This commit removes:
        72 bogus makedev() calls
        26 bogus SYSINIT functions

if_xe.c bogusly accessed cdevsw[], author/maintainer please fix.

I4b and vinum not changed.  Patches emailed to authors.  LINT
probably broken until they catch up.
1999-05-31 11:29:30 +00:00
Poul-Henning Kamp
4e2f199e0c This commit should be a extensive NO-OP:
Reformat and initialize correctly all "struct cdevsw".

        Initialize the d_maj and d_bmaj fields.

        The d_reset field was not removed, although it is never used.

I used a program to do most of this, so all the files now use the
same consistent format.  Please keep it that way.

Vinum and i4b not modified, patches emailed to respective authors.
1999-05-30 16:53:49 +00:00
Peter Wemm
579f45fa60 Simplify the COMPAT_PCI_DRIVER/DATA_SET hack. We can add:
#define COMPAT_PCI_DRIVER(name,data) DATA_SET(pcidevice_set,data)
.. to 2.2.x and 3.x if people think it's worth it.  Driver writers can do
this if it's not defined.  (The reason for this is that I'm trying to
progressively eliminate use of linker_sets where it hurts modularity and
runtime load capability, and these DATA_SET's keep getting in the way.)
1999-05-09 17:07:30 +00:00
Bill Paul
134a826b50 Unbreak slot_irq_handler(). The problem here is that slot_irq_handler()
abuses its argument, which is supposed to be an integer unit number, as
a pointer to the head of the 'struct slot' list. When this code was
hacked^Wupdated for newbus, a new mechanism for registering slot_irq_handler()
was put in place and the significance of the unit number was overlooked.
When registering an interrupt, we have both device_id and unit. The unit
number is passed as 'unit' but /sys/i386/usa/intr_machdep.c:register_intr()
drops unit on the floor and uses device_id instead. Since pccard_alloc_intr()
always sets device_id to 0, this means the unit number is always zero, and
slot_irq_handler() is always called with 0, which becomes a NULL pointer
which slot_irq_handler() tries to dereference and the kernel explodes.

Result: if you assign a PCMCIA driver in the kernel config file like this:

device wi0 at isa? port? irq?

Then the system will panic the moment a PCMCIA device is attached and
an interrupt is triggered.

The quick fix: make pccard_alloc_intr() pass the unit number as both
the device_id and unit arguments to register_pcic_intr(). The correct fix
would be to rewrite /sys/pccard to be less disgusting.
1999-05-04 15:43:02 +00:00
Peter Wemm
6a2648e613 Operator precedence (nit: in #if 0 code) bug.
PR:		11413
Submitted by:	Christopher Peterson <cpeterso@cs.washington.edu>
1999-05-02 21:45:31 +00:00
Nate Williams
4be290acd4 - Added PCI identification support for the TI1251 PCI/CardBus bridge.
With this addition my ThinkPad 600E works with the stock FreeBSD
  PCMCIA code.
1999-05-02 05:53:50 +00:00
Nate Williams
b79fadf33d - When the card is inserted, call pccard_insert_beep instead of
pccard_remove_beep.

Submitted by:	PAO
1999-05-02 04:19:27 +00:00
John Polstra
7c44ad261e Eliminate compiler warning about missing type in declaration.
Remove useless initialization of static variable to 0.

Move static variable declaration into the only function that uses
it.
1999-04-27 18:47:39 +00:00