Commit Graph

448 Commits

Author SHA1 Message Date
Warner Losh
804e80065b o Get rid of static array of slots in pccard layer. Move this to the
softc.
o Store pointers to softc in dev_t in si_drv1.
o Change 'kludge version' to 'classic version' since things are getting less
  kludgy.
o Minor code shuffling so that we probe and attach the pccard slots.
o Minor style(9) changes.
2001-05-13 01:44:27 +00:00
Warner Losh
f6056f14ec Th -> The in a comment 2001-05-12 06:04:02 +00:00
Duncan Barclay
7b8ec2c952 Use enumeration values for CARD_SET_RES_FLAGS.
Remove panic on out of range io window and return ENXIO. Add a similar
check for memory windows.

Approved by:	imp
2001-05-08 23:59:13 +00:00
Duncan Barclay
a31957707a Add a sysctl pair for the pcic memory allocation range
machdep.pccard.pcic_mem_start
	machdep.pccard.pcic_mem_end
and default the range to IOM_BEGIN/IOM_END.

This may prove useful to if_ray users (and others) on more modern
hardware that maps BIOS stuff into 0xd000-0xdffff.

MFC: after 1 week

Approved by:	imp
2001-05-08 22:51:05 +00:00
Warner Losh
84b00588d8 Ricoh RL5C46x cardbus bridges have the bits for 3E0 and 3E2. The
RL5C47x cards do not.  Only set them for that set of bridges.

Submitted by: shiba (Takeshi Shibagaki-san)
2001-05-08 02:28:41 +00:00
Warner Losh
bccfae2270 Add some additional register definitions for some work I have in progress. 2001-05-08 02:06:03 +00:00
Warner Losh
bc5797c7de Set the slot pointer in the pc98 case. Correct the name of the bridge
chip to the one that the Japanese use.  Now we get insert/remove
events on my PC-9821Ne.  More work in bus space is needed to make
drivers work.

MFC after: 3 days
2001-05-07 22:28:05 +00:00
Warner Losh
a66173abd2 Disable the card after sending the removed event up to the pccard
layer.  This fixes an ordering problem that would cause the ISR for
the device to run with now power applied to the device.  Most cards
failed to deal with this gracefully, and thus would hang on card
eject.

The power down event, for those keeping score, is what causes the
interrupt for the card.

Many folks in the Japanese nomads list have reported this, so I'll be
MFCing quickly for their benefit.

Submitted by: Masayuki FUKUI
MFC after: 2 days
2001-05-07 16:50:34 +00:00
Warner Losh
4d98b7a61b My fix to NEWCARD for getting the function type broke oldcard due to
a name conflict.

Pointed out by: markm

# I had to login to freefall to make this commit, so something maybe up
2001-04-21 14:10:32 +00:00
Warner Losh
04a3a05381 Set the device name for NEC PC98 PCMCIA Controller on boot.
# We really need to allocate i/o ports for it, but I need to learn
# the pc98 bus space better before attempting that.
2001-04-21 07:08:03 +00:00
Warner Losh
3fb5ffd286 Indirect off cinfo rather than calling pcic_ functions directly. This
means that the pcic98 functionality might now work (I've tested it on
my pcic machine, but not the pcic98).  Since these functions are
rarely called, it is unlikely that this will have a measurable impact
on performance.
2001-04-19 05:45:51 +00:00
Warner Losh
7402675de4 First cut at bringing NEC PC98 original pccard bridge code back into
FreeBSD.  This code doesn't work just yet, but does compile.  We need
to start indirecting via the cinfo pointers, rather than directly
calling pcic_*.  There may be other issues as well, but you gotta
start somewhere.

Obtained from: PAO3
2001-04-19 00:04:08 +00:00
Warner Losh
c18e19a64d Move setting of TI113X_PCI_CARD_CONTROL register sooner 2001-04-17 23:56:12 +00:00
Warner Losh
1f3da134c7 Minor comment that missed the last change 2001-04-17 23:50:24 +00:00
Warner Losh
82d3fe450d When booting, turn on the 3E0 compatibility address for ricoh cardbus
parts.  This is based on the newcard code that turns it off :-).  We
can now reboot after NEWCARD or Windows and have OLDCARD work.  Add
support for the RL5C466 while I'm at it.

Treat TI1031 the same as the CLPD6832.  It doesn't work yet, but sucks
less than it did before.

Also add a few #defines for other changes in the pipe.
2001-04-17 23:15:00 +00:00
Warner Losh
a9304a4eb5 Fix minor typo in comment. 112x -> 12xx 2001-04-11 22:49:00 +00:00
Warner Losh
e5eac10b13 Add #define for IBM3765.
Fix SWAMPBOX.  It had actiontec's ID.
Reorder pnpids so they are in alphabetical order.
2001-04-11 20:18:29 +00:00
Poul-Henning Kamp
f83880518b Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.
2001-03-26 12:41:29 +00:00
Warner Losh
bf968b1638 First step towards plugging the "pccard is trying to map into a BIOS
region for CIS reading" problem:

Use bus_alloc_resource to get the memory that we'll be using.  Also
has the benefit of doing usage checking as well.  This gets rid of the
ugly kludge that we had before for mapping pmem to vmem.

Second, move PIOCSRESOURCE to its own routine and make it conform more
to style(9) in the process.
2001-03-26 08:05:20 +00:00
Warner Losh
c33c1284cb First step towards making loadable modules independent of having
pccard in the kernel for those drivers with pccard attachments.  This
makes the compat layer a little larger by introducing some inlines,
but should almost make it possible to have independent attachments.
The pccard_match function are the only one left, which I will take
care of shortly.
2001-03-22 06:00:07 +00:00
Warner Losh
cc2310a949 Axe a few __P() while I'm in the neighborhood. 2001-03-22 05:49:18 +00:00
Ian Dowse
6817e978cf Place the call to pccard_insert_beep() in the inserted() timeout
routine instead of pccard_event(). This avoids spurious extra calls
to pccard_insert_beep() at insert or remove time which could occur
due to noise on the card-present lines.

Clean up some code in pccard_beep.c; we were depending on the order
of evaluation of function arguments, which is undefined in C. Also,
use `0' rather than `NULL' for integer values.

Reviewed by:	sanpei, imp
2001-03-20 18:10:19 +00:00
Warner Losh
36260de0cf Lots of minor cleanup, plus a couple of interesting things.
o Attempt to disable the slot when we detect that there are problems with
  it in our ISR.  This should make polling mode work better for more cards,
  but more work may be needed.  This "disabling" sets the card interrupt
  register to 0.  This worked for me for lots of tests in polling mode.
o Now that I've found datasheets, fix a boatload of magic numbers in the
  source to make it easier to understand.
o Use a table of names rather than a big case statement.
o Cull a few of the "unused" controller types that we map to other times
  that were a vestiage of PAO code that we never merged in the same way.
o Enforce legal IRQs.  You are no longer allowed to try to use IRQs that
  will fail on all known ISA/PCI <-> PCMCIA bridges.  The bridges do not
  have pins for these illegal interrupts, and all of them are listed as
  reserved and/or illegeal in the datasheets depending on which one you
  look at.
o Add comments about how IBM-AT based computers and NEC PC-98 based computers
  map these interrupts and which ones are valid.
o Always clear the bit that steers the management interrupt either to the
  value listed in the PCIC_STAT_INT register.  I've seen this bit get set
  on suspend/resume and after windows boot, and it does't hurt to clear it.
  NOTE: this might mean we can share this interrupt in the future.
2001-03-19 07:10:38 +00:00
Warner Losh
b9f90e4ffc Move ti1031 to the 16-bit bridge section 2001-02-07 01:16:40 +00:00
Duncan Barclay
25522b4ef4 Fix a minor bug that prevents NEWBUS users from setting more than
one memory map. The memory window for the PCIC is identifed by the resource id
for NEWSBUS drivers. pccardd always uses window 0 and rid 0 when setting maps
up. This fix does not affect pccardd's handling of common memory for ed cards.

Reviewed by:	imp
2001-01-09 23:39:32 +00:00
Garrett Wollman
0a2c3d48c6 select() DKI is now in <sys/selinfo.h>. 2001-01-09 04:33:49 +00:00
Warner Losh
486d464d74 o Now that I've had time to test the new interface, reintegrate it back in.
o Fix OLDCARD to use the new interface.
o Rename the offsetp argument to deltap to more closely reflect what it
  is returning (it returns the delta from the requested value to the actual
  value).
o Remove duplicate $FreeBSD$ in pccbb.c
o Allow deltap to be NULL.
o Convert new isa pcic driver and add XXX comments that this function isn't
  actually implemented there (which means that NEWCARD pccard stuff won't
  work there until it is).
o Revert attempts to make old inferface work in NEWCARD.

Subitted by: peter (Parts of the new version code)
2001-01-07 16:31:09 +00:00
Warner Losh
a5eccf28a8 Add device id for the OZ Micro 6832. I didn't try to init it like the
Cirrus Logic parts that end in 6832, but maybe some machines will need
that in the future.
2001-01-02 21:42:48 +00:00
MIHIRA Sanpei Yoshiro
23f344f985 add PNPID for PnP PCMCIA, SCM SwapBox Classic X2P.
PR:		kern/23344 (Kaho Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>)
2000-12-11 15:02:50 +00:00
MIHIRA Sanpei Yoshiro
d4479fc128 fix type check in pccard_beep_select 2000-11-01 00:37:34 +00:00
MIHIRA Sanpei Yoshiro
3637a0ce8b Oops, in previous commit(rev.1.4), I replaced
pitch and duration only in ``struct'', I forgot
to replace these in sysbeep and timeout, sorry.
2000-10-31 03:28:02 +00:00
David Malone
66efa50621 Make a few more mallocs use M_ZERO.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
Approved by:	imp
2000-10-29 16:29:05 +00:00
Poul-Henning Kamp
cf9fa8e725 Move suser() and suser_xxx() prototypes and a related #define from
<sys/proc.h> to <sys/systm.h>.

Correctly document the #includes needed in the manpage.

Add one now needed #include of <sys/systm.h>.
Remove the consequent 48 unused #includes of <sys/proc.h>.
2000-10-29 16:06:56 +00:00
MIHIRA Sanpei Yoshiro
33eb563d67 add PC-Card melody beep(PC Card bus, kludge version)
Original idea from:	PAO3
2000-10-28 13:35:34 +00:00
Warner Losh
dc84c5ac4c Change comment from sprintf to snprintf 2000-10-26 19:46:20 +00:00
Warner Losh
85cc5e3588 Change snprintf to strncpy.
Also add a comment about a bogus assumption in the current code found at
bsdcon by jhb.
2000-10-26 19:45:42 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Warner Losh
5984fd1d1f Another PnP pcic card: SMC Swapbox Plug and Play
Submitted by: gallatin
2000-10-12 03:51:16 +00:00
MIHIRA Sanpei Yoshiro
975ce2575a fix some minor problem in PIOCSRESOURCE ioctl.
- If resource which was allocated for pcic was
  requested via this ioctl, bus_alloc_resource
  would be succeeded and that resource was
  returned as free resource.  So check whether
  requested resource was used for pcic or not
  before bus_alloc_resource test.

- merge SYS_RES_IRQ routine into other SYS_RES_*
  routine and clean up.

problem reported by:	Yohei Terada <terada@jiro.c.u-tokyo.ac.jp>
2000-10-01 12:36:14 +00:00
John Baldwin
7fa6b7c01e Spelling police in a comment: Defalut -> Default. 2000-09-29 21:14:05 +00:00
Warner Losh
fa024f017e Add pccard_product_lookup comatibility shim 2000-09-28 07:22:30 +00:00
Warner Losh
d186a392ba o Remove 9 unnecessary includes.
o Add Vpp power at 5.0V rather than 0. Setting it to zero violates
  the pccard spec.  Most pcic devices in use today don't let us
  violate the spec, but some older ones do.  Bill Paul sent this to
  me a long time ago and I thought I'd commit it before now.
o Add some debug stuff hidden behind bootverbose.
2000-09-20 20:02:49 +00:00
Warner Losh
2276cee521 Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.

Compatibility methods for OLDCARD drivers.  We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects.  For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines.  For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.

compat devices should use the following:

	/* Device interface */
	DEVMETHOD(device_probe),	pccard_compat_probe),
	DEVMETHOD(device_attach),	pccard_compat_attach),
	/* Card interface */
	DEVMETHOD(card_compat_match,	foo_match),	/* newly written */
	DEVMETHOD(card_compat_probe,	foo_probe),	/* old probe */
	DEVMETHOD(card_compat_attach,	foo_attach),	/* old attach */

This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.

Drivers wishing to not retain OLDCARD compatibility needn't do this.

ep driver minorly updated.

sn driver updated more than minorly.  Add module dependencies to allow
module to load.  Also change name to if_sn.  Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
2000-09-19 04:39:20 +00:00
MIHIRA Sanpei Yoshiro
5935ef4c44 add PIOCSRESOURCE(IOC_GET_RESOURCE_RANGE)
Now /usr/sbin/pccardd read free resource(io,irq) range with
this ioctl.

Original Idea from:	PAO3
2000-09-17 15:37:53 +00:00
John Baldwin
9a94c9c5c3 - Remove the inthand2_t type and use the equivalent driver_intr_t type from
newbus for referencing device interrupt handlers.
- Move the 'struct intrec' type which describes interrupt sources into
  sys/interrupt.h instead of making it just be a x86 structure.
- Don't create 'ithd' and 'intrec' typedefs, instead, just use 'struct ithd'
  and 'struct intrec'
- Move the code to translate new-bus interrupt flags into an interrupt thread
  priority out of the x86 nexus code and into a MI ithread_priority()
  function in sys/kern/kern_intr.c.
- Remove now-uneeded x86-specific headers from sys/dev/ata/ata-all.c and
  sys/pci/pci_compat.c.
2000-09-13 18:33:25 +00:00
Warner Losh
23b7b12ddc Add a detach method to allow this device to be unloaded. 2000-08-30 06:57:38 +00:00
Warner Losh
a7d5d6a892 Add TI-1031 id. It doesn't work yet, but it is nice to have it.
These were on cards that were pci pccard (not cardbus) bridges that
lived in SparcUltras that picked up on ebay.
2000-08-29 04:40:17 +00:00
Hajimu UMEMOTO
e0faad6850 Add UNIX domain socket feature to pccardd. This makes pccard
related PAO3/ports such as gxcardmon work.

Reviewed by:	imp
Obtained from:	PAO3
2000-08-20 16:16:57 +00:00
Warner Losh
2563e6f5b8 Add some infrastructure support for dealing with large attribute
memory space needed by the raylink driver (in progress, nearing
completion).

This is a minorly cleaned up diff from Duncan to help him reduce the
diffs from stock FreeBSD.

Submitted by: Duncan Barclay <dmlb@ragnet.demon.co.uk>
2000-08-10 17:35:11 +00:00
Mitsuru IWASAKI
df56ce3e40 Fix a bug so that we have correct number of pccard instances in pcic_attach().
pcic_attach() got a wrong pointer to pcic_slots since device haven't
set correct unit number yet, so always accessed elements of pcic_slots
which belong to pcic0 (unit number 0).

Now we set unit number to pcic device first, then access to pcic_slots
based on the unit number we've just set.
2000-07-24 21:44:00 +00:00
Matt Jacob
f3a31172db There is no atdevbase on the alpha. Hide this case statement on alpha until
the design/implementation is complete.
2000-06-23 22:47:17 +00:00
Warner Losh
6cd40f893b o Implement some compatibility functions for NEWCARD compat. This is
incomplete, but will eventually allow the same drivers to function
  with both oldcard and newcard.
o Remove include of opt_bus.h.  It isn't needed and gets in the way of
  module building.
2000-06-18 04:59:39 +00:00
Warner Losh
6a2b5130e3 Add ACTIONTECH #define for plug and play. Also add PnP support to NEWCARD
for this card.

Submitted by: Kazuya Kodama <kodama@rd.nacsis.ac.jp>
2000-05-29 02:44:33 +00:00
Peter Wemm
0a8e3ce8a5 Make this compile without depending on the FreeBSD 2.2 compatability
defines.
2000-05-28 16:31:35 +00:00
Warner Losh
2b91ff7819 Add PnP ID for vadem based plug and play card.
Submitted by: Dave Belfer-Shevett <shevett@stonekeep.com>
Fix by: Bill Paul
2000-05-02 06:50:17 +00:00
Peter Wemm
365c5db0a7 Add $FreeBSD$ 2000-05-01 20:32:07 +00:00
Mitsuru IWASAKI
1f4b0b5767 MFPAO3. Improvement of of pccard cis tuple parsing capability.
- Fixed bogus CIS tuple dumping (Network node ID, IRQ modes and etc.)
 - Include telling drivers ethernet address if Network node ID
   tuple is available.  This is usefull for some bogus ehter cards which
   can't get correct ethernet address from CIS tupple.

Obtained from:	PAO3
2000-04-26 15:36:43 +00:00
Warner Losh
da05ca010e Checkin my first batch of New Mexico changes:
o minor whitespace things (bad because this is also a functional commit)
o Backport reading in of CIS entries from the driver level.
2000-04-25 06:07:27 +00:00
Warner Losh
db5ca7b1d2 o Preliminary support for mapping the CIS by the driver.
o Modify xe driver to use this.

There's still some issues with this code, so xe can't map the cis just
yet.  I'm thinking about how to resolve the issue.  pccard_nbk's
pccard_alloc_resource is getting in the way.
2000-04-20 08:37:46 +00:00
Warner Losh
748fdadaad Add TI-1211 chipset from datasheet info 2000-04-20 03:16:49 +00:00
Poul-Henning Kamp
3389ae9350 Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>
2000-04-19 14:58:28 +00:00
Mitsuru IWASAKI
2058e7f3e0 Fix typo in description of Cirrus Logic PD6832 PCI-CardBus Bridge.
This don't hurt anything.
	PCI/CardBus Bridge -> PCI-CardBus Bridge

Submitted by:	Takeshi Shibagaki <sibagaki@lsi.melco.co.jp>
Obtained from:	bsd-nomads ML in Japan
2000-03-30 18:47:00 +00:00
Warner Losh
6ea2fbe9be More fully initialize cardbus bridges. We now call the new generic
cardbus bridge init routine for all cardbuses.  This routine attempts
to compensate for BIOSes that do not setup the cardbus bridge into
legacy mode.  Since this is becoming more common, and cardbus pci
cards have appeared on the market, this makes sense.

Do some TI113x specific initialization.  This came in as part of the
patch.  Report TI1[1234]XX specific config registers protected by
bootverbose.

Minor code cleanup while I'm here.  I've also removed the unused code
present in the original patches, and cleaned it up slightly in places
as well.

The original patches supported more than one card, but these patches
support just one.  We should likely revisit this in the future.

This makes the Compaq card that Walnut Creek CD purchased for me work
in my bouncer box.

This is a MFC candidate.  However, I'd like to get some airtime on
these patches on as many laptops as possible before doing the MFC.  It
does change things somewhat.  In theory, apart from the minor TI
tweaks, this shouldn't change anything if the bridge is in legacy mode
already.

Submitted by: sanpei@sanpei.org (MIHIRA Yoshiro)
2000-03-25 20:29:55 +00:00
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
John Polstra
b1f2f2d538 Fix the code that prints the "Initializing PC-card drivers" message
so that the list of drivers is correct.  This is a slightly
simplified version of the patch from the PR.

PR:		misc/10544
Submitted by:	Christophe Colle <colle@krtkg1.rug.ac.be>
1999-04-27 18:34:13 +00:00
Poul-Henning Kamp
f711d546d2 Suser() simplification:
1:
  s/suser/suser_xxx/

2:
  Add new function: suser(struct proc *), prototyped in <sys/proc.h>.

3:
  s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/

The remaining suser_xxx() calls will be scrutinized and dealt with
later.

There may be some unneeded #include <sys/cred.h>, but they are left
as an exercise for Bruce.

More changes to the suser() API will come along with the "jail" code.
1999-04-27 11:18:52 +00:00
Peter Wemm
96b3554e5c Use COMPAT_PCI_DRIVER() for registration if it exists. This shouldn't
hurt the driver portability to 3.x too much for where drivers are shared.
1999-04-24 20:17:05 +00:00
Peter Wemm
e91896117b Well folks, this is it - The second stage of the removal for build support
for LKM's..
1999-04-17 08:36:07 +00:00
Nick Sayer
db49f041ae Import PCI pccard bridge chip probing from PAO. Hopeful prelude for
broadening chipset support in -current.

Reviewed by:	joerg
Obtained from:	PAO
1999-04-01 15:28:10 +00:00
Nate Williams
efc7b6fd9d - Made the setting of the machdep.pccard.pcic_irq from the boot config file
actually work.

Reviewed by:	"Sean O'Connell" <sean@stat.Duke.EDU>, msmith
1999-03-26 00:20:25 +00:00
Warner Losh
841c7bb674 Remove static delcarations from {,un}register_pcic_intr declarations
in the not APIC_IO case.  This should silence the warnings when
building pcic.c as well as the undefined functions when the kernel
links.

Noticed by: several people in -current and me building the kernel
1999-03-12 18:45:47 +00:00
Roger Hardiman
6fe7bbc584 Updated to use new APIC (SMP) safe interrupt register/unregister
functions.
Posted for review to -smp and -mobile and -hackers with no objections.

Reviewed by:	Nate
1999-03-10 15:00:54 +00:00
Roger Hardiman
ac483aaf25 Header file for pcic interrupt register/unregister functions.
No objections from -smp or -mobile or -hackers.
1999-03-10 14:56:28 +00:00
Guido van Rooij
05440e6882 On second thought: do previous fux in pcic.c better.
Now we just untimeout the call to inserted() if it exists.
1999-02-14 20:41:01 +00:00
Guido van Rooij
a1f7e1b4c5 Somehow, it is possible to get a pcicintr() when in the resume process.
This will trigger inserted()) to be called twice which confuses pccardd.
Add code to not process pcicitr())'s when in the middle of a resume
process. The real insertion of cards and the emulated one in the suspend/resume
code really do not mix up.
1999-02-14 20:16:15 +00:00
Jun Kuriyama
a766716a9a Add "beep" ioctl. (#10 is reserved for PIOCSVIR)
Obtained from:	PAO3
Reviewed by:	-current list
1999-02-13 11:32:00 +00:00
Mike Smith
7546e83ec1 Allow the interrupt allocated to the PCIC to be tuned from the kernel
environment by setting the variable machdep.pccard.pcic_irq.  If
the IRQ is invalid, the PCIC will run in polled mode.
1999-01-29 01:18:15 +00:00
Matthew Dillon
fe08c21a53 Fix warnings in preparation for adding -Wall -Wcast-qual to the
kernel compile.

    This commit includes significant work to proper handle const arguments
    for the DDB symbol routines.
1999-01-27 23:45:44 +00:00
Bruce Evans
dc34e67676 Include <sys/select.h> -- don't depend on pollution in <sys/proc.h>. 1999-01-27 10:10:03 +00:00
Torsten Blum
de6f543955 Identify the TI1250 PCMCIA/CardBus bridge. It seems that it's compatible
to the TI1131. At least it works in my Compaq Armada 7800.
1999-01-25 12:59:31 +00:00
Peter Wemm
9b3df7693a Initial update pccard code for KLD module support. Module support
however is only marginally useful until the new-style bus (pci and isa)
stuff comes onboard to give us a better shot at actually pci and isa
drivers loadable (or preloadable anyway).
1999-01-19 00:18:28 +00:00
Matthew Dillon
2cbe36f725 probe function changed from returning char * to const char *. 1998-12-14 06:37:37 +00:00
Archie Cobbs
f1d19042b0 The "easy" fixes for compiling the kernel -Wunused: remove unreferenced static
and local variables, goto labels, and functions declared but not defined.
1998-12-07 21:58:50 +00:00
Peter Wemm
08274d68df Add #include to get a prototype for update_intr_masks(). 1998-11-09 09:30:55 +00:00
Nate Williams
cf0ee54fec - Fix a bug where a "power_off_slot' timeout was not cancelled when the
computer 'suspended', although the slot was powered off.  There was a
  race where the slow could be powered off *after* it was assigned a
  new driver when the computer was 'resumed'.

Noticed by:	Brian Somers <brian@Awfulhak.org>
1998-09-24 17:56:31 +00:00
Brian Somers
8aa2558802 Make PCIC_RESUME_RESET an proper option.
My laptop (a CTX Cybernote) needs this.  It claims to have a

  PC-Card VLSI 82C146 (5 mem & 2 I/O windows)
1998-09-08 18:09:51 +00:00
Warner Losh
344131cb71 o renable pccard_remove_driver (it was used in the skel.c driver)
o update skel.c to lots of stuff that has happened since the last time
  it was updated.
1998-08-26 07:09:58 +00:00
Warner Losh
6e73d499d8 Add probing support for the vadem VG365 and the Vadem VG465 pcic chips.
We do the same thing we do with all the other Vadem chips and print the
right identification for these chips.  Tested with the 365, and inferred
for the 465.

This allows the cheapo PCMCIA card that I got from necx to print the right
chip number on boot.
1998-08-25 22:46:44 +00:00
Bruce Evans
18df27bda2 Fixed printf format errors. 1998-08-18 00:32:50 +00:00
Bruce Evans
86a14a7a0a Use [u]intptr_t instead of [u_]long for casts between pointers and
integers.  Don't forget to cast to (void *) as well.
1998-08-16 01:21:52 +00:00
Bruce Evans
9a2daf9190 Changed the type of an isa/general interrupt handler to take a
`void *' arg.  Fixed or hid most of the resulting type mismatches.
Handlers can now be updated locally (except for reworking their
global declarations in isa_device.h).
1998-06-18 15:32:09 +00:00
Doug Rabson
ecbb00a262 This commit fixes various 64bit portability problems required for
FreeBSD/alpha.  The most significant item is to change the command
argument to ioctl functions from int to u_long.  This change brings us
inline with various other BSD versions.  Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.
1998-06-07 17:13:14 +00:00
KATO Takenori
a6ed0310a9 Include pc98.h instead of isa.h when PC98 is defined. 1998-05-05 13:21:08 +00:00
Nate Williams
480895cbea - Give up trying for a simple solution for correctly recognizing if a card
was really removed, or simply 'faked' by a suspend/resume.  Keep track
  of both current and previous state, and send that information to the
  userland programs.

[
XXX - This breaks binary compatability with older pccardd programs, but
they don't work reliably. :(
]
1998-04-20 15:21:02 +00:00
Nate Williams
e4c50d858a - Only poll the PCIC controller for insertion/removal events if the
controller hasn't been assigned an IRQ.
1998-04-20 15:15:20 +00:00
Bruce Evans
c1087c1324 Support compiling with `gcc -ansi'. 1998-04-15 17:47:40 +00:00
Nate Williams
c839c3ace3 - Whoops, better have the structure created before trying to use it in
the patch I just submitted.

Noticed by:     phk
1998-04-09 14:01:13 +00:00
Nate Williams
9d24fe0e45 - Fix bug I introduced a few months ago. If a driver fails the probe,
correctly unregister the interrupt from the system.

[ My fix is much simpler than the one provided in the PR ]

PR:		6249
1998-04-08 15:00:02 +00:00
Tatsumi Hosokawa
bf595ed7c2 Uninitialized pointer reference may happen on particular environment.
(for example, it kills my new laptop, Toshiba Libretto 100....)
1998-03-19 16:19:16 +00:00
Bruce Evans
6b16931c00 Removed unused #includes. 1998-02-25 05:58:50 +00:00
Nate Williams
9dda04f1e2 - Removed typo in Copyright and added Id. 1998-02-07 20:41:20 +00:00
Eivind Eklund
7b778b5e61 Make all file-system (MFS, FFS, NFS, LFS, DEVFS) related option new-style.
This introduce an xxxFS_BOOT for each of the rootable filesystems.
(Presently not required, but encouraged to allow a smooth move of option *FS
to opt_dontuse.h later.)

LFS is temporarily disabled, and will be re-enabled tomorrow.
1998-01-24 02:54:56 +00:00
Nate Williams
a9b9e46550 - Support for multiple PD6832 controllers. Each found 6832 is assigned
and initializes the next two ports in order starting at 03e0.  This
  also patches pcic_p.h to reduce the I/O ports mapped from 4 to 2.

Submitted by:	Ted Faber <faber@ISI.EDU>
1998-01-20 21:11:03 +00:00
Mike Smith
53922aaf18 Specify the minor number correctly when creating devfs entries. 1998-01-02 13:35:06 +00:00
Nate Williams
abacde6281 - Remove the code that cleared out the registers (previously enabled by the
option PCIC_NOCLRREGS).  This is now the default behavior since it's
  apparently required for the CLPD6832, and doesn't negatively affect
  any of my test machines.

Requested by:	Ted Faber <faber@ISI.EDU>
1997-12-02 23:23:14 +00:00
Nate Williams
80ae4948b8 - Add necessary include files and fix bugs in last. 1997-12-02 22:27:58 +00:00
Nate Williams
12defa4078 - Bring in code removed from /sys/pccard/pcic.c, including DEVICE IDs, and
more bootverbose code.
- Style nits.

No significant functional changes.
1997-12-02 22:13:59 +00:00
Nate Williams
b4a6741e01 - Remove PCI code from here, now that the PCI framework lives in /sys/pci. 1997-12-02 21:31:35 +00:00
Nate Williams
030713d715 - Framework for PCI/CardBus controllers running in PCMCIA emulation
mode.  Currently, the only supported controller is the Cirrus Logic
  PD6832, but others can be supported with docs on them.

Submitted by:	Ted Faber <faber@ISI.EDU>
1997-12-02 21:26:41 +00:00
Nate Williams
052492ab36 - Renamed 'card.h' to 'cardinfo.h', to avoid namespace collisions with
the card.h that config builds.

[ Repository renaming done in the background to save the card.h history ]
1997-11-18 21:04:01 +00:00
Nate Williams
40b8c3d008 MF22:
(update_intr_masks might not need to be done in 3.X, but the new generic
 interrupt code is incomplete w/regard to support for the PCCARD code, so
 to avoid any potential problems use it.  It can't hurt).

- Correctly register pcic_imask with the system interrupt code.

- Call update_intr_masks() so that pcic_imask modifications that occur
  when card interrupts are registered get updated in the system
  interrupt code.
1997-11-15 14:20:31 +00:00
Nate Williams
e7f1b188ac - Reset the pcic controller interrupt 'poll' timeout *after* we call the
interrupt routine.
1997-11-04 17:50:23 +00:00
Nate Williams
57bb328afe - More style nits (sorry, I should have done this last time). 1997-10-28 20:58:53 +00:00
Nate Williams
6a6dd364ab - Style nit. 1997-10-28 20:50:58 +00:00
Nate Williams
ec510cabb0 - Disable cards when doing a suspend by emulating that they have been
removed.  Add a new state 'suspend' so we 'fake' insertion events at
  resume time for the cards that have been suspended.

[
The code still works if you remove the card during suspend, switch the
card during suspend, or combinations of both.
]

Reviewed by:	frf@xocolatl.com
1997-10-28 17:51:25 +00:00
Nate Williams
075a76a29e - Instead of relying on a functional call to register PCARD-capable drivers,
use a Linker Set.  Note, if a driver is loaded as an LKM  if will have
  to use the function call, but since none of the existing drivers
  are loadable, this made things cleaner and boot messages nicer.

Obtained from:	PAO-970616
1997-10-26 21:08:42 +00:00
Nate Williams
6794cb8989 - Patch the 'skeleton' example driver to be more consistant with the new
state of the world.
1997-10-26 21:01:44 +00:00
Nate Williams
c669d2df7e - 'Beep' support now happens in it's own separate file, so you can mess
around with different noises for the different events and not have it
  affect other files.

Inspired by:	PAO
1997-10-26 06:06:54 +00:00
Nate Williams
8bb7a8fc95 - Functional changes to PCCARD support.
* Kill individual drivers 'suspend' routines, since there's no simple/safe
   way to suspend/resume a card w/out going through the complete probe
   at initialization time.
 * Default to using the apm_pccard_resume sysctl code, which basically
   pretends the card was removed, and then re-inserted.  Suspend/resume
   is now 'emulated' with a fake insert/removal.  (Hence we no longer
   need the driver-specific suspend routines.)
1997-10-26 04:54:16 +00:00
Nate Williams
e7e437dbfa - Do a bunch of gratuitous changes intended to make the code easier to
follow.
 * Rename/reorder all of the pccard structures, change many of the member
   names to be descriptive, and follow more closely other 'bus' drivers
   naming schemes.
 * Rename a bunch of parameter and local variable names to be more
   consistant in the code.
 * Renamed the PCCARD 'crd' device to be the 'card' device
 * KNF and make the code consistant where it was obvious.
 * ifdef'd out some unused code
1997-10-26 04:36:24 +00:00
Nate Williams
6d9fc55f8d - Call 'callout_handle_init' on the two timeout channels after they are
created in the new slot controller structure.
1997-10-26 02:55:31 +00:00
Nate Williams
3673dc01e7 - KNF the PCI stuff, no functional changes. 1997-10-25 21:02:44 +00:00
Nate Williams
028cec1015 - Recognize the Cirrus Logic PD6729/6730 PC-Card Controller behind the
PCI bus.

[ Re-organized the code to be easier to extend, based on Michael's patch ]

Submitted by:	Michael Reifenberger <root@totum.plaut.de>
1997-10-24 15:39:00 +00:00
Nate Williams
d50a3fb743 - Use the definitions found in <i386/isa/isa.h> instead of rolling our
own definition of ISA_HOLE_START.  We shouldn't need to include
  bus/processor specific code in here, but it is required.  At least by
  doing it this way it becomes more obvious where the bogusness is.

Obtained from:	email with bde
1997-10-24 15:27:16 +00:00
Nate Williams
f47a5dccbf - defined constant ISA_HOLE_START (would be nice to include machine/pmap.h,
but it has too much baggage).
- create a new routine 'unregister_device_interrupt', which is now used
  instead of having two routines with the same code snippet.
- Minor cleanups and commenting.

[ No functional changes, just moving things around ]
1997-10-23 22:54:47 +00:00
Nate Williams
1030f4ea71 - Move the untimeout code call out of the check for pwr_off_pending. It
shouldn't make any difference, but did on a couple of test systems.
1997-10-23 19:00:16 +00:00
Nate Williams
759e7b0aef - Fix braino in last commit. (Slow networks should be outlawed!) 1997-10-23 04:53:32 +00:00
Nate Williams
2e6bafc0a2 - When doing suspend/resume, only try to suspend those drivers on active
slots.  Otherwise, we try to suspend drivers who have been disabled
  already.

[
The only reason the drivers are still on the list is because of race
conditions where the card is removed while the driver is in use.  We
leave the drivers on the slot list (leaving all of their structures in
place in case a process is using it) but set it's state to empty so that
further uses by the pccard code know not to expect active cards.
]
1997-10-23 02:30:39 +00:00
Nate Williams
63ea538413 Back our V1.36, due to reports of badness. (IRQ's are again allocated
from the 'lower' interrupts to the 'higher' interrupts.)  We need to
find a way to set the interrupt for the controller in the config file.

Determined by:	handy@sag.space.lockheed.com
1997-10-23 02:25:14 +00:00
Nate Williams
48f814b934 - Simplify code by removing a variable which was initialized once, never
modified, and was expected to have the initialized value.
1997-10-23 00:51:29 +00:00
Garrett Wollman
49acc834db LEarn about the TI 1131. 1997-10-17 16:34:08 +00:00
Nate Williams
19baa5fc7c - Bring in APM_PCCARD_RESUME support from PAO, FreeBSD style. This new
sysctl option 'fakes' like a card was removed and inserted when the
  machine is brought up again from a suspend.  It is disabled by default,
  and the old code is used.
Obtained from:	PAO
1997-10-06 05:46:03 +00:00
Nate Williams
9d886dc90c - Include <sys/interrupt.h> to avoid compiler errors. 1997-10-06 04:32:42 +00:00
Nate Williams
9ebc881f81 - Fix braino in last commit. 1997-10-06 04:02:42 +00:00
Nate Williams
01f370b672 Modem cards send the speaker audio (dialing noises) to the host's
speaker.  Cirrus Logic PCIC chips must enable this.  There is also a Low
Power Dynamic Mode bit that claims to reduce power consumption by 30%,
so enable it and hope for the best.

PR:		4650
Submitted by:	Nick Sayer <nsayer@quack.kfu.com>
1997-10-06 03:17:36 +00:00
Nate Williams
6270089212 - Allocate the 'PCIC' interrupt from the last available (higher #) IRQ
instead of the first available, like Win95 does.  This appears to help
  on some machines, and avoids potential problems with built-in serial
  ports which tend to live at IRQ 3, which is usually picked with the
  old method.
1997-10-06 02:56:15 +00:00
Nate Williams
90c752d519 - Don't start at IRQ 0 in build-freelist, but instead start at IRQ 1.
(Not sure if this makes muich difference, but you never know.)
1997-10-06 02:54:19 +00:00
Nate Williams
34d9a7896e - Style police
- Updated some comments using data from the most recent PAO release.

Obtained (partially) from:	PAO-970616
1997-10-06 02:46:38 +00:00
Justin T. Gibbs
6c951b4441 Update for new callout interface. 1997-09-21 22:02:25 +00:00
Peter Wemm
35b8b2ddab Update select -> poll in drivers. 1997-09-14 03:19:42 +00:00
Bruce Evans
f6af917bec Oops, unremoved used #include. 1997-07-21 16:55:28 +00:00
Bruce Evans
4b9ea34eec Use soft_imask instead of SWI_MASK in the LKM version. SWI_MASK shouldn't
have been visible in LKMs, since it had the wrong value for the APIC_IO
case.

Removed unused #includes.
1997-07-21 16:50:46 +00:00
Jordan K. Hubbard
e5c3a660f5 Make this puppy compile again - add two includes. 1997-06-01 05:04:39 +00:00
Poul-Henning Kamp
0084fb021b Don't apply 5V when we want 3.3V.
Kludge around the case where the PCIC refuses to use 5V because it knows
better than us.
1997-05-22 07:29:24 +00:00
Poul-Henning Kamp
29eb228ebb Recognize, but don't actually do much with a TI PCI1130 PcCard/CardBus bridge. 1997-05-03 13:57:26 +00:00
Poul-Henning Kamp
b805b39e43 1. i82365.h: Chip identifiers should not be #ifdef PC98. Add identifier
(pt. unused) for TI PCI1130.

2. pccard.c: PCIC_RESUME_RESET is now (also) a sysctl.  (Never make it
    a #ifdef if it can be made a sysctl!)

3. pcic.c: make getb() and putb() proper member functions of struct
    pcic_slot.  Add a couple of missing casts.
1997-04-20 07:21:12 +00:00
Peter Dufault
0ddf9be1f0 Make MOD_* macros almost consistent:
Use the name argument almost the same in all LKM types.  Maintain
the current behavior for the external (e.g., modstat) name for DEV,
EXEC, and MISC types being #name ## "_mod" and SYCALL and VFS only
#name.  This is a candidate for change and I vote just the name without
the "_mod".

Change the DISPATCH macro to MOD_DISPATCH for consistency with the
other macros.

Add an LKM_ANON #define to eliminate the magic -1 and associated
signed/unsigned warnings.

Add MOD_PRIVATE to support wcd.c's poking around in the lkm structure.

Change source in tree to use the new interface.

Reviewed by:	Bruce Evans
1997-04-06 11:14:13 +00:00
Nate Williams
5d156f4397 Argh, this time get the parentheses right. This hasn't been a good day for me. 1997-02-21 05:46:57 +00:00
Nate Williams
9de5530881 Whoops, make sure we have enough parenthesis.
Pointed out by:	bde
1997-02-21 01:29:32 +00:00
Nate Williams
9b4e82f125 Try to make the BROKEN_VLSI chipset detection better, and not break
non-broken chipssets whose ID is 0x84, such as the one found in the NEC
6030H.

> The code relies on the assumption that on a genuine_broken vlsi, you
> don't get 0x84 when probing slot 1 in the normal location.  On the versa I
> do get 0x84 when probing slot 1 in the normal location.  What you get on
> genuine_broken at the normal slot 1 location is unknown to me;

Submitted by:	Chris Timmons <skynyrd@opus.cts.cwu.edu>
1997-02-18 19:20:52 +00:00
Nate Williams
8c1801dce9 In the disable_slot() routine, the variable "i" was
being used without ever being initialized.  From examining
the rest of the routine, it looks like this is a typo,
and it really should have been "1" instead of "i".

Submitted by:	mpp
1997-02-11 17:22:46 +00:00
KATO Takenori
b61f10e8bc Deleted obsolete structure, pc98_device. 1997-02-04 22:29:50 +00:00
Nate Williams
bf083f9e6b One other minor include file change.
Submitted by:	bde
1997-01-14 16:29:05 +00:00
Nate Williams
d7394bb574 Include file cleanups.
Submitted by:	bde
1997-01-13 21:51:13 +00:00
Nate Williams
9f2f000c7f Initialize pcic_imask with SWI_MASK to interference from timeout routines.
Suggested by:	bde
1997-01-11 23:40:08 +00:00
Nate Williams
b1e21161bf Whoops, typo. 1997-01-11 18:32:27 +00:00
Nate Williams
cc6da87199 Update the PCIC controller's imask with individual slot IRQ's.
Assuming that the intr_mask[] was updated by changing the maskptrs (the
existing update_intr_masks() function will not work) this code was
written so the PCIC controller insertion/removal events will not
interrupt the card IRQ handler events.

Some possible scenarios:
+ Card is removed during IRQ handler:

  - PCIC card handler is allowed to interrupt
  - card removal event is called, removing the driver and data structures
  * card interrupt handler continues w/out driver, data structures, and hardware

OR (the code just committed)

  * card IRQ handler has no hardware to read/write to, but has code and
    data to run on (XXX- Assume it completes and doesn't spin forever)
  - PCIC card handler unloads the card driver

The current situation at least leaves the card interrupt handlers the
drivers and data structures to work with although the hardware can't be
guaranteed.

Reviewed by:	bde
1997-01-11 18:23:20 +00:00
Nate Williams
e4410844b0 Removed magic # 16 and replaced with ICU_LEN. 1997-01-11 17:59:38 +00:00
Nate Williams
8b8f892696 Now that all of the IRQ's should be allocated by the time this
pccard_configure() is called (except for LKm's :( ), build a list of
unassigned interrupts for the PCCARD code to use.

Reviewed by:	bde
1997-01-11 17:54:57 +00:00
Nate Williams
22d0d81b71 - Added PCIC resume function
- Cleaned up VLSI-PCIC work-around code

Submitted by:	nate & the Nomads
1997-01-08 00:22:58 +00:00
Bruce Evans
ebedb5ad97 Cleaned up all headers that include <sys/ioctl.h> or <sys/ioccom.h>:
- don't include <sys/ioctl.h> in any header.  Include <sys/ioccom.h>
  instead.  This was already done in 4.4Lite for the most important
  ioctl headers.  Header spam currently increases kernel build
  times by 10-20%.  There are more than 30000 #includes (not counting
  duplicates) for compiling LINT.
- include <sys/types.h> if and only it is necessary to make the header
  almost self-sufficient (some ioctl headers still need structs from
  elsewhere).
- uniformized idempotency ifdefs.  Copied the style in the 4.4Lite
  ioctl headers.
1996-09-21 14:59:43 +00:00
Nate Williams
573fcfdc8b - Don't include <machine/laptops.h>. It was a kludge I should never
have imported.
1996-09-07 17:50:47 +00:00
Satoshi Asami
c9da8434ea Yet another merge. Remove support.s by deleting memcopy. Remove
autoconf.c by merging icu.h.  Fix a couple of typos.

Submitted by:	The FreeBSD(98) Development Team.
1996-09-07 02:14:47 +00:00
Poul-Henning Kamp
bfbb029d87 Remove devconf, it never grew up to be of any use. 1996-09-06 23:09:20 +00:00
Satoshi Asami
91eb961985 Re-sync with the state of PC98 world. This will be the last commit before
we start merging things in earnest...

Submitted by:	The FreeBSD(98) Development Team
1996-08-30 10:43:14 +00:00
Bruce Evans
c673fe98d7 Added #include of <machine/md_var.h>. This will be needed when
some declarations are moved from <machine/cpufunc.h> to better
places.
1996-06-25 20:31:01 +00:00
Satoshi Asami
33fef343f9 Oops, forgot to delete some garbage from working code. 1996-06-14 11:10:19 +00:00
Satoshi Asami
ad63a118b2 The Great PC98 Merge.
All new code is "#ifdef PC98"ed so this should make no difference to
PC/AT (and its clones) users.

Ok'd by:	core
Submitted by:	FreeBSD(98) development team
1996-06-14 11:02:28 +00:00
Nate Williams
439a59dd6e Minor formatting changes. No functional differences, but makes the
style more consistant with KNF and the Nomad release.
1996-06-05 05:30:09 +00:00
Nate Williams
ceff12b4c4 Adds the APM hooks into the generic pccard kernel files. With this code
in place device drivers can now register power-down/power-up routines so
that we can use common routines to power-up/power-down cards for
insert/removals, suspend/resume, etc..

Reviewed by:	phk
Submitted by:	the 'Nomads'
1996-04-23 16:03:08 +00:00
Bruce Evans
4165cacd4f Changed #includes of <i386/include/foo.h> to #includes of <machine/foo.h>. 1996-04-07 17:56:53 +00:00
Gary Palmer
8577a36957 pccard.c:
#include <i386/include/clock.h> to get sysbeep() prototype

pcic.c:
	add appropriate #ifdef around a prototype to quiet GCC because
	fn decl. is also #ifdef'd.
1996-04-06 01:16:19 +00:00
Nate Williams
2b1f32c2f9 Removed un-used code. 1996-02-21 23:31:03 +00:00
Nate Williams
4765b33331 Updated PC-CARD support to contain most of the code from the latest
Japanese BSD-Nomad release.

Reviewed by:	phk
Submitted by:	hosokawa@mt.cs.keio.ac.jp and the rest of the Nomads
1996-02-21 23:20:21 +00:00
Mike Pritchard
6c5e9bbdf5 Fix a bunch of spelling errors in the comment fields of
a bunch of system include files.
1996-01-30 23:02:38 +00:00
Poul-Henning Kamp
0c68712e02 Fix DEVFS, remove unused vars. 1996-01-28 10:02:38 +00:00
Nate Williams
ea5ff881da Don't rely on the card 'automatically' powering up when we probe it.
On some laptops, this doesn't work (ie; IBM 75x series), so force it
to power on.

With this modification, I am able to read the tuples off 4 different
PCMCIA cards on my ThinkPad.

Reviewed by:	phk@FreeBSD.org
Obtained from:  if_zp.c
1996-01-06 07:49:43 +00:00
Bruce Evans
193f212a54 Completed function declarations and/or added prototypes and/or added
#includes to get prototypes.
1995-12-16 00:11:11 +00:00
Poul-Henning Kamp
d2f265fab8 Julian forgot to make the *devsw structures static. 1995-12-08 23:23:00 +00:00
Julian Elischer
87f6c6625d Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are
in the same file as their devsw structure. I've also added DEVFS
support for nearly every device in the system, however
many of the devices have 'incorrect' names under DEVFS
because I couldn't quickly work out the correct naming conventions.
(but devfs won't be coming on line for a month or so anyhow so that doesn't
matter)

If you "OWN" a device which would normally have an entry in /dev
then search for the devfs_add_devsw() entries and munge to make them right..
check out similar devices to see what I might have done in them in you
can't see what's going on..
for a laugh compare conf.c conf.h defore and after... :)
I have not doen DEVFS entries for any DISKSLICE devices yet as that will be
a much more complicated job.. (pass 5 :)

pass 4 will be to make the devsw tables of type (cdevsw * )
rather than (cdevsw)
seems to work here..
complaints to the usual places.. :)
1995-12-08 11:19:42 +00:00
Julian Elischer
7198bf4725 If you're going to mechanically replicate something in 50 files
it's best to not have a (compiles cleanly) typo in it! (sigh)
1995-11-29 14:41:20 +00:00
Julian Elischer
53ac6efbd8 OK, that's it..
That's EVERY SINGLE driver that has an entry in conf.c..
my next trick will be to define cdevsw[] and bdevsw[]
as empty arrays and remove all those DAMNED defines as well..

Each of these drivers has a SYSINIT linker set entry
that comes in very early.. and asks teh driver to add it's own
entry to the two devsw[] tables.

some slight reworking of the commits from yesterday (added the SYSINIT
stuff and some usually wrong but token DEVFS entries to all these
devices.

BTW does anyone know where the 'ata' entries in conf.c actually reside?
seems we don't actually have a 'ataopen() etc...

If you want to add a new device in conf.c
please  make sure I know
so I can keep it up to date too..

as before, this is all dependent on #if defined(JREMOD)
(and #ifdef DEVFS in parts)
1995-11-29 10:49:16 +00:00
Bruce Evans
512fef80a9 Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
Bruce Evans
63136e04c6 New file for pccard driver interface declarations. 1995-11-21 08:49:21 +00:00
Poul-Henning Kamp
c9c0fe135d Make the LKM version compile again.
Pointed out by: Michael Smith <msmith@atrad.adelaide.edu.au>
1995-11-21 08:27:00 +00:00
Poul-Henning Kamp
920e8dc220 Fiddle with <machine/isa_device.h> 1995-11-14 20:49:24 +00:00
Bruce Evans
b3e24f9ce9 Changed the first (name) arg of MOD_DEV(), MOD_EXEC() and MOD_MISC()
from a string to an identifier so that it can be used to generate
declarations and strings.  It's much easier to stringize an identifier
than to identifize a string.  A uniform naming scheme must be used
for the automatically generated things to apply.  This is a feature.

Used the module identifer to generate prototypes for the module load,
unload and stat functions.  Removed the few prototypes for these that
already existed.

Used the module identifier to generate a unique struct tag in MOD_DEV().
This should probably be done for all the MOD_*() macros.

Moved the trailing semicolon from the MOD_*() macro definitions to the
macro invocations that didn't already (bogusly) have it.

Staticized the module load and unload functions.

Added function return types for the module load, unload and stat functions.

lkm/ibcs2/ibcs2.c:
Included <sys/sysproto.h> to get everything prototyped.
Cleaned up #includes.

lkm/ibcs2/ipfw.c:
Cleaned up #includes.

lkm/linux/linux.c:
The module name had to change from "linux_emulator" to "linux_mod" to
be automatically generated.
Cleaned up #includes.

lkm/syscons/*/*_saver.c:
Completed delcarations of function pointers.

sys/i386/isa/atapi.c:
The module name had to change from "atapi" to "atapi_mod" to be
automatically generated.

sys/i386/isa/wcd.c:
Used the fixed MOD_DEV().  This module has two devices and expanded the
macro in the source instead of fixing it.
The module names had to change from "wcd" and "rwcd" to "wcd_mod" and
"rwcd_mod" to be automatically generated.

sys/pccard/pcic.c:
The module name had to change from "pcic" to "pcic_mod" to be
automatically generated.
1995-11-14 07:35:57 +00:00
Bruce Evans
cc286f2399 Fixed the type of yet another timeout function.
Fixed the type of pcic_unload().

Replaced nosys() by lkm_nullcmd() in pcic_mod() and in a misplaced
comment about the lkm interface.
1995-11-13 08:39:44 +00:00
Poul-Henning Kamp
fd24fbdf21 Clean up the ident style.
Remove the APM stuff
Add support for VA469

Submitted by: Janic.Thaillandier@ratp.fr
1995-11-09 20:44:36 +00:00
Bruce Evans
de3a4845ee Fixed the type of a timeout function and an interrupt mask variable. 1995-11-09 08:58:20 +00:00
Bruce Evans
0f445dae48 Fixed the types of the apm suspend/resume functions. 1995-11-09 08:57:10 +00:00
Bruce Evans
4fda91c705 Moved prototypes for devswitch functions from conf.c and driver sources
to <machine/conf.h>.  conf.h was mechanically generated by
`grep ^d_ conf.c >conf.h'.  This accounts for part of its ugliness.  The
prototypes should be moved back to the driver sources when the functions
are staticalized.
1995-11-04 13:25:33 +00:00
Poul-Henning Kamp
688444459d Fix a missing arg to untimeout. 1995-10-23 12:05:24 +00:00
Poul-Henning Kamp
b59d7f4673 A mixed bag of changes, relating to getting the state in "lsdev" right,
and pccard support to work sensibly.  Better by far, but still not good.
1995-10-21 00:55:36 +00:00
Poul-Henning Kamp
d19e0556a0 Make LKM entry consisten with tradition: pcic_mod(). 1995-10-15 16:59:36 +00:00
Poul-Henning Kamp
14a288e58b PCCARD support. 1995-10-10 09:52:55 +00:00
Poul-Henning Kamp
872fd9222e Missed these changes to the pccard stuff. Sorry Martin! 1995-09-20 07:23:51 +00:00
Poul-Henning Kamp
f673a8d884 Shut warnings.
Add selwake calls.
remove some trash.
1995-08-25 09:47:06 +00:00
Poul-Henning Kamp
0d2966d3f2 Andrew McRae's pcmcia/pccard code, the kernel part.
This is still very green, but I have managed to get my modem working.
Lots of work still to do, but now at least we can commit it. /phk

Reviewed by:	phk
Submitted by:	Andrew McRae <andrew@mega.com.au>
1995-08-24 08:56:20 +00:00