Commit Graph

192 Commits

Author SHA1 Message Date
Doug Rabson
f7b7769172 * Factor out the object system from new-bus so that it can be used by
non-device code.
* Re-implement the method dispatch to improve efficiency. The new system
  takes about 40ns for a method dispatch on a 300Mhz PII which is only
  10ns slower than a direct function call on the same hardware.

This changes the new-bus ABI slightly so make sure you re-compile any
driver modules which you use.
2000-04-08 14:17:18 +00:00
Peter Wemm
d213a95368 Unused definitions. 2000-03-20 08:21:52 +00:00
Peter Wemm
56dac036b6 Bandaid for src/sys/modules which broke world 2000-03-20 01:22:27 +00:00
Peter Wemm
80060e8897 Connect the ISA and PCI compatability shims to an option. In this case
it's options COMPAT_OLDISA and COMPAT_OLDPCI.  This is meant to be a
fairly strong incentive to update the older drivers to newbus, but doesn't
(quite) leave anybody hanging with no hardware support.  I was talking with
a few folks and I was encouraged to simply break or disable the shims but
that was a bit too drastic for my liking.
2000-03-19 13:07:12 +00:00
Nick Hibma
e5399702e8 Print the PCI resources even if they are disabled. This shows more clearly
when the BIOS is forgetful about initialising the USB controllers.
2000-03-18 19:18:36 +00:00
Matt Jacob
17d75f8ecb Alpha 8200 port: Until we fix things better, determine which alpha CPU
platform we're running on so we know how many bits to reserve at the top
end for the 'hose' value. It turns out that there's *just* enough room
to support all possible hoses on TurboLaser.
Reviewed by:	gallatin@freebsd.org, dfr@free3bsd.org
2000-03-15 23:50:31 +00:00
Bill Fumerola
bebfe1cadb o No need to print the vendor/device ID for things that matched succesfully.
o ``<device name>'' versus ``device name'' for things that fall under nomatch.

Reviewed by:	dfr (in principle)
Approved by:	Baron von Hubbard
2000-02-22 21:44:39 +00:00
Doug Rabson
6874d62958 Remove the vga-pci driver. It serves no purpose and it hides the hardware
from useful drivers such as the 3D DRI drivers I will be porting for
hardware accelerated OpenGL. The hardware will still be reported during
boot using the nomatch system.

Approved by: jkh
2000-02-19 09:44:06 +00:00
Peter Wemm
483df2dd3b Spell "pci_delete_resource" correctly.
Approved by:	jkh (who must be very sick of requests now :-)
2000-02-01 18:02:12 +00:00
Peter Wemm
cebf86fa3f Put a FYI in the compatability shims so that people are aware that they
are using an old unconverted driver.  Most (if not all) of the drivers
for common hardware are newbus these days.  However, we don't want
to encourage people to take the easy way out and write new drivers
using the shims.  This is just passive "encouragement".

Reviewed by:	phk
2000-01-29 15:37:36 +00:00
Kazutaka YOKOTA
689e7081eb Added PCIR_BIOS (0x30). 2000-01-10 12:53:19 +00:00
Peter Wemm
f671bf82e4 Show the port/mem/irq of pci devices too. 2000-01-08 10:12:21 +00:00
Peter Wemm
4a1e4cb727 Clean up the cfgmech/pci_mechanism debris. The reason for the existance
of this is no longer an issue as we have a replacement driver for the
one that needed it.

Reviewed by:	dfr
2000-01-08 08:31:24 +00:00
Peter Wemm
bcae942098 Zap pci_map_dense() and pci_map_bwx() - they were for compatability but
are not used.  All the drivers that use memory mapped IO on the Alpha have
been ported already.
2000-01-05 16:40:10 +00:00
Peter Wemm
dfea8af9f4 Make the usb and ide/ata device identification a little saner. Rather than
attaching to the device via chip*, use the newbus nomatch method to report
the device.  This leaves them unattached so that a driver can be easily
loaded to grab them later.
1999-12-10 17:44:22 +00:00
Kenneth D. Merry
64ae346b52 [ repository copy of sys/pci/pci_ioctl.h to sys/sys/pciio.h happened in the
background ]

Rename sys/pci/pci_ioctl.h to sys/sys/pciio.h to make it easier for
userland programs to use this interface.  Reformat the file, and add a
BSD-style copyright to it.

Add a new man page for pci(4).  The PCIOCGETCONF, PCIOCREAD, and PCIOCWRITE
ioctls are documented, but the PCIOCATTACHED ioctl is not documented
because it is not implemented.

Change includes of <pci/pci_ioctl.h> to <sys/pciio.h> or remove them
altogether.  In many cases, pci_ioctl.h was unused.

Reviewed by:	steve
1999-12-08 17:44:04 +00:00
Peter Wemm
150e211545 Raise the pci compat driver match priority a bit so that it's not
quite so close to the chip* drivers.
1999-12-05 18:50:22 +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
Peter Wemm
5700c63bc7 Make the pci driver compat shim return a preference for probe
rather than an "it's mine!" so that other newbus-aware drivers can
bid for the device too.  This should allow the sym driver to out-bid
the ncr driver for devices it supports without having to modify ncr.c
at all.  ncr would then function as a catch-all.
1999-11-30 01:34:46 +00:00
Nick Hibma
c577d56d33 Feh, kind of went wrong the previous commit. dev should child (in some
cases) plus a typo.
1999-11-22 14:39:21 +00:00
Nick Hibma
aa7e2ba7b6 Move the pretty printing of the description for USB controllers to
pci_probe_nomatch, so it won't be in the way when loading USB as a module.

The reason for them being there in the first place is that every
motherboard comes with USB kit and this way it looks more pretty (peter).
The real solution will be to define some method of detaching a driver
after it has attached.
1999-11-22 03:34:43 +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
Andrew Gallatin
870c4cf8eb now that a map's base addr is 64-bits, the alpha multi-hose hack needs
to be cast to 64-bits in pci_add_map.  This should allow XP1000s and
DS20s to boot -current again.
1999-11-03 22:43:03 +00:00
Poul-Henning Kamp
02c58685a4 Change useracc() and kernacc() to use VM_PROT_{READ|WRITE|EXECUTE} for the
"rw" argument, rather than hijacking B_{READ|WRITE}.

Fix two bugs (physio & cam) resulting by the confusion caused by this.

Submitted by:   Tor.Egge@fast.no
Reviewed by:    alc, ken (partly)
1999-10-30 06:32:05 +00:00
Poul-Henning Kamp
7254edcfaf Don't test boolean return against != 1.
Don't needlessly assign the error variable in an if statement.
1999-10-29 19:03:18 +00:00
Doug Rabson
f8ef46e907 Fix some resource allocation peculiarities of the intpm device. 1999-10-28 08:06:59 +00:00
Doug Rabson
4ed33d1537 Make sure we add an interrupt resource if intline!=255. 1999-10-26 07:40:41 +00:00
Doug Rabson
9091387f87 Correct a stupid type which prevented us from working with any device
which needed port resources.
1999-10-17 06:48:47 +00:00
Doug Rabson
45f0aa1f0e * Implement bus_set/get/delete_resource for pci.
* Change the hack used on the alpha for mapping devices into DENSE or
  BWX memory spaces to a simpler one. Its still a hack and should be
  a seperate api to explicitly map the resource.
* Add $FreeBSD$ as necessary.
1999-10-14 21:38:33 +00:00
Andrew Gallatin
da7ca2d9bd allow pci_ioctl to work with multi-hose alphas.
Rather than teaching pci_ioctl about hoses, we just pass down a magic number
& let the platform code figure out what the hose is based on what the bus
number is.

concept approved by dfr
1999-10-12 22:10:53 +00:00
Peter Wemm
649f6f6393 Add the 16550 programming interface code for PCIS_SIMPLECOMM_UART. 1999-10-09 16:00:56 +00:00
Andrew Gallatin
9b2591a0a4 A band-aid to prevent multi-hose alpha chipsets (aka tsunami) from
panic'ing because the hose is not filled in.  We should probably extend the
pciioctl interface to take hoses into account..
1999-10-03 21:09:30 +00:00
Roger Hardiman
70d32847e5 Backout part of the changes made in 1.111
For unknown devices the output will now be
  pci0: unknown card (vendor=0x109e, dev=0x0878) at 14.1 irq 19
instead of
  pci0: unknown card DD^0878 (vendor=0x109e, dev=0x0878) at 14.1 irq 19

Before this change, the code used to take the PCI vendor id and translate it
into a three letter ASCII name.
For PnP devices, the vendor id _does_ map to a nice ASCII name
(eg Creative Labs PnP ID maps to "CTL", ESS PnP ID maps to "ESS")

But there is no such mapping for PCI devices, as can be seen by the
example above where the Brooktree PCI vendor ID maps to "DD^"

The PCI Special Interest Group confirmed they do not have any mappings
from vendor ID to ASCII.
1999-10-01 16:58:40 +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
Luoqi Chen
cb899cd41d Handle for passthru resource release correctly. 1999-09-03 04:30:01 +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
Matthew N. Dodd
15317dd875 Alter the behavior of sys/kern/subr_bus.c:device_print_child()
- device_print_child() either lets the BUS_PRINT_CHILD
	  method produce the entire device announcement message or
	  it prints "foo0: not found\n"

Alter sys/kern/subr_bus.c:bus_generic_print_child() to take on
the previous behavior of device_print_child() (printing the
"foo0: <FooDevice 1.1>" bit of the announce message.)

Provide bus_print_child_header() and bus_print_child_footer()
to actually print the output for bus_generic_print_child().
These functions should be used whenever possible (unless you can
just use bus_generic_print_child())

The BUS_PRINT_CHILD method now returns int instead of void.

Modify everything else that defines or uses a BUS_PRINT_CHILD
method to comply with the above changes.

	- Devices are 'on' a bus, not 'at' it.
	- If a custom BUS_PRINT_CHILD method does the same thing
	  as bus_generic_print_child(), use bus_generic_print_child()
	- Use device_get_nameunit() instead of both
	  device_get_name() and device_get_unit()
	- All BUS_PRINT_CHILD methods return the number of
	  characters output.

Reviewed by: dfr, peter
1999-07-29 01:03:04 +00:00
Doug Rabson
aa595accc9 Add support for SYS_RES_DENSE and SYS_RES_BWX resource types. These are
equivalent to SYS_RES_MEMORY for x86 but for alpha, the rman_get_virtual()
address of the resource is initialised to point into either dense-mapped
or bwx-mapped space respectively, allowing direct memory pointers to be
used to device memory.

Reviewed by: Andrew Gallatin <gallatin@cs.duke.edu>
1999-07-28 07:57:48 +00:00
Matthew N. Dodd
0158b2dcc3 Case matters.
DEv_METHOD to DEV_METHOD.
1999-07-27 05:08:36 +00:00
Matthew N. Dodd
5a8cee9a60 Implement the BUS_PROBE_NOMATCH method for the PCI bus.
This function is called for each device for which no driver
was found.

Output is similar to the eisa_probe_nomatch() function but with the
added benefit of displaying the assigned IRQ (since PCI gives us
this information up front.)

Output is like so:

pci0: unknown card CPQ0508 (vendor=0x0e11, dev=0x0508) at 11.0 irq 9
pci0: unknown card DFZ0508 (vendor=0x10da, dev=0x0508) at 11.0 irq 9
pci0: unknown card DBL0508 (vendor=0x104c, dev=0x0508) at 11.0 irq 9
pci0: unknown card DDM0011 (vendor=0x108d, dev=0x0011) at 11.0 irq 9

I'm not happy with the 3 lines of macro cruft that got added but
I consider it a temporary annoyance as those bits will be moved to
some place where PCI, EISA and ISAPNP code will be able to use them.

(Not surprisingly, this message is longer than the code in question.)

Reviewed by: peter, dfr
1999-07-27 04:28:14 +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
Peter Wemm
f078b1e075 #include <machine/md_var.h> to bring the prototype for
alpha_platform_assign_pciintr() into scope (!).
1999-07-01 22:58:03 +00:00
Roger Hardiman
153eb46fb6 On the new Meteor cards, the Philips SAA 7116 is connected to the PCI bus
via an IBM PCI-PCI bridge (82351 or 82352 or 82353)

The driver must identify if it is on a secondary PCI bus, which is
created via the IBM PCI-PCI bridge. If it is, then it must initialise
the IBM PCI-PCI bridge correctly.

To do this, the following new functions are added.
Because they use the pcici_t tag, they are considered 2.2 compatibility APIs
  pcici_t * pci_get_parent_from_tag(pcici_t tag);
  int       pci_get_bus_from_tag(pcici_t tag);

(The _from_tag suffix is used to prevent clashes with similarly named
 newbus PCI API functions)

Submitted by: Anton Berezin <tobez@plab.ku.dk>
Reviewed by:  Doug Rabson <dfr@nlsystems.com>
Reworked by:  Me (roger)
1999-05-31 22:13:37 +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
Doug Rabson
bcbb365b6b In pci_alloc_resource() only check start and end to see if its a default. 1999-05-30 10:54:31 +00:00
Andrew Gallatin
aa6de8e012 Add support for multiple PCI "hoses" used on various alpha platforms.
The specific intent of this commit is to pave the way for importing
Compaq XP1000 support.  These changes should not affect the i386 port.

Reviewed by: Doug Rabson <dfr@nlsystems.com>
(actually, he walked me through most of it & deserves more than reviewd-by
credit )
1999-05-20 15:33:33 +00:00
Peter Wemm
8dc26439da Move pcibus (host -> pci bus) probe/attach routines from nexus
to pcibus.c.  pci_cfgopen() becomes static and there are no more
bus #ifdef's in nexus.c.
1999-05-18 20:48:43 +00:00
Peter Wemm
49e5f1b929 Use the probe priority mechanism to make sure the chip* probes do not
displace a real driver.
Revert rev 1.109.
Pick up a few things from elsewhere (a couple of SiS id's).

As an *experiment*, have the chip* driver claim (for reporting purposes)
IDE controllers if there isn't another PCI-aware ide or ata driver to
grab them.  I've exported the match function since it could be used from
the ata-all.c code replacing ata_pcimatch() - but I have not touched the
ata code.  I'd like to catch a few more devices this way, including USB
and other bridges etc.
1999-05-11 07:55:32 +00:00