Commit Graph

67 Commits

Author SHA1 Message Date
dyoung 5a5fb3ac65 #include <sys/bus.h> instead of <machine/bus.h>. 2011-07-01 16:55:42 +00:00
matt 4a40b01453 Modify mapiodev to take a third argument indicating whether the space
should be prefetchable (true) or not (false).
2011-06-30 00:52:55 +00:00
matt dd2488a8b3 Add support pci_intr_setattr.
Export non-inline version of pci api for modules (_MODULE is defined).
Fix definition of pc_conf_hook and pc_conf_interrupt.
Switch to using inlines instead of macros.
Switch ibm4xx to use <powerpc/pci_machdep.h>
2011-06-22 18:06:32 +00:00
matt 05b09539a2 struct device * -> device_t
struct cfdata * -> cfdata_t
use device accessors, use device_private.
some softc/device_t splits (macppc needs a bunch more)
aprint*_dev used considerably more
2011-06-18 08:08:27 +00:00
matt ec1797c173 More device_t, cfdata, CFATTACH_DECL_NEW cleanup. 2011-06-06 16:42:17 +00:00
dyoung d3e53912d2 Neither pci_dma64_available(), pci_probe_device(), pci_mapreg_map(9),
pci_find_rom(), pci_intr_map(9), pci_enumerate_bus(), nor the match
predicate passed to pciide_compat_intr_establish() should ever modify
their pci_attach_args argument, so make their pci_attach_args arguments
const and deal with the fallout throughout the kernel.

For the most part, these changes add a 'const' where there was no
'const' before, however, some drivers and MD code used to modify
pci_attach_args.  Now those drivers either copy their pci_attach_args
and modify the copy, or refrain from modifying pci_attach_args:

Xen: according to Manuel Bouyer, writing to pci_attach_args in
    pci_intr_map() was a leftover from Xen 2.  Probably a bug.  I
    stopped writing it.  I have not tested this change.

siside(4): sis_hostbr_match() needlessly wrote to pci_attach_args.
    Probably a bug.  I use a temporary variable.  I have not tested this
    change.

slide(4): sl82c105_chip_map() overwrote the caller's pci_attach_args.
    Probably a bug.  Use a local pci_attach_args.  I have not tested
    this change.

viaide(4): via_sata_chip_map() and via_sata_chip_map_new() overwrote the
    caller's pci_attach_args.  Probably a bug.  Make a local copy of the
    caller's pci_attach_args and modify the copy.  I have not tested
    this change.

While I'm here, make pci_mapreg_submap() static.

With these changes in place, I have tested the compilation of these
kernels:

alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-eb NSLU2
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE GUMSTIX
	HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321 IXDP425 IXM1200
	KUROBOX_PRO LUBBOCK MARVELL_NAS NAPPI SHEEVAPLUG SMDK2800 TEAMASA_NPWR
	TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
	OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sgimips GENERIC32_IP2x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC

As of Sun Apr 3 15:26:26 CDT 2011, I could not compile these kernels
with or without my patches in place:

### evbmips-el GDIUM

nbmake: nbmake: don't know how to make /home/dyoung/pristine-nbsd/src/sys/arch/mips/mips/softintr.c. Stop

### evbarm-el MPCSA_GENERIC
src/sys/arch/evbarm/conf/MPCSA_GENERIC:318: ds1672rtc*: unknown device `ds1672rtc'

### ia64 GENERIC

/tmp/genassym.28085/assym.c: In function 'f111':
/tmp/genassym.28085/assym.c:67: error: invalid application of 'sizeof' to incomplete type 'struct pcb'
/tmp/genassym.28085/assym.c:76: error: dereferencing pointer to incomplete type

### sgimips GENERIC32_IP3x

crmfb.o: In function `crmfb_attach':
crmfb.c:(.text+0x2304): undefined reference to `ddc_read_edid'
crmfb.c:(.text+0x2304): relocation truncated to fit: R_MIPS_26 against `ddc_read_edid'
crmfb.c:(.text+0x234c): undefined reference to `edid_parse'
crmfb.c:(.text+0x234c): relocation truncated to fit: R_MIPS_26 against `edid_parse'
crmfb.c:(.text+0x2354): undefined reference to `edid_print'
crmfb.c:(.text+0x2354): relocation truncated to fit: R_MIPS_26 against `edid_print'
2011-04-04 20:37:49 +00:00
matt 4f2934afef Change definition of pc_bus_maxdevs to get a void * instead a pci_chipset_tag_t
to match its use in pci_bus_maxdevs.  This makes it the same as pci_conf_read
and pci_conf_write.
Change all struct device * to device_t.
[Obviously nothing ever used the first argument to pc_bus_maxdevs since it
could have never worked because it wasn't being passed a pci_chipset_tag_t.]
2010-12-13 16:19:02 +00:00
cegger 9b87d582bd kill MALLOC and FREE macros. 2008-12-17 20:51:31 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
garbled d974db0ada Merge the ppcoea-renovation branch to HEAD.
This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree.  Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches.  The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
2007-10-17 19:52:51 +00:00
garbled 1d37c1ae36 Rather than use the residual data to guess that we have a raven pchb,
note the raven pchb in device_register, and then look that up when
attaching the pcib.
2007-04-26 19:27:04 +00:00
garbled 5ab2832938 Add special code to properly detect a W83C553 pcib sitting on a RAVEN
based machine.  When we do, we have to frob a few special bits on the
pcib to finish the setup that the prom didn't bother completing for us.
With this change, NetBSD finally runs on the MTX604 board.. Many thanks
to John Baker for providing remote access to the machine, and rebooting
it repeatedly for me.
2007-04-26 17:39:54 +00:00
garbled ae2d0d18ae When we have a non-PReP pci bridge, we need to perform a single swizzle
on the pin, to get us the right pin on the underlying PReP bridge to wire
the interrupt to.  Tested with a 4-port fxp card on a 7043-140.  Thanks
to simon for helping me get the math right.
2007-03-22 08:23:10 +00:00
garbled bbcca898c4 Add a second check to the prep-pci-intrmap test, to make sure the dictionary
actually contains entries.  It is apparently possible to get a non-null,
but empty dictionary back.  This seems to happen if you inject a ppb-card
on pci0 when you also have a prep pci1 at a later device function.  With
this, my fxp card works in any slot on my 7043-140.
2007-03-21 01:34:32 +00:00
garbled 8e09750d58 The motorola RAVEN is both a pchb and an MPIC. Block out the pci
configuration of it's mem area to keep the PIC available.
2007-03-20 17:16:33 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
garbled 3053244401 Add preliminary support for the 7025-F40. The MPIC must not be wired up
by the initial PCI_NETBSD_CONFIGURE, nor should it be manually wired by
the indirect stuff.  This is all taken care of by the prep_init() function.
7025-F40 support supports the primary pci bus only.  The second PCI bus
on the machine is still unsupported, but the machine runs and can access
everything except for the two slots the other bus covers.
2006-09-06 22:32:56 +00:00
garbled fcfc216b3b Fix a horrible bug in how we initialize the 8259 interrupt controller.
The bug displayed itself by locking up console output on a 7043-140
following a powercycle.  This may also have been the cause of bogus
interrupts on motorola class machines.
2006-09-01 07:02:28 +00:00
garbled 4c0cfa49ad Attach the pnpbus prior to attaching the pci bus on the prep. This
should allow us to probe for both pnp-attached devices and isa-attached
devices while preferring the pnpbus attachment point.
2006-06-21 20:08:11 +00:00
garbled 76847dcb92 Completely rework how we look up PCI interrupts on prep:
1) Rather than build an array of the pci->intr mappings, build a proplib
tree.
2) add a SIMPLEQ of device properties to the pci_chipset_tag to hold the
proplib trees of each bus.
3) Move the interrupt routing code from pci_conf_interrupt to pci_map_intr()
4) Deal properly with non-native PCI bridge chips that are not recognized
by the prep firmware, and therefore are not noted in the residual data.

The major win of this restructure is #4. Hopefully I haven't broken
anything. Tested on a 7248-100, 7043-140 and 7024-E20.
2006-06-09 01:19:10 +00:00
garbled c9e13db63a Implement partial support for the RS6K PCI Bridge found on 7025-F40
models.  This code was made possible by assistance from Cory Bajus.

Add code that asks the PCI bridge what it's config base address is, and
use that when wiring up an indirect bridge type.
Move prep's user segment register to 10, because the 7025's PCI config
address is at 11, where the user segment used to be.
Add a battable entry for 0xbf800000 for machines with RS6K bridges.

There is still probably work left to be done before a 7025-F40 is fully
supported.
2006-05-25 02:11:13 +00:00
garbled cfbb4ec285 More KNF. That should be the rest of the .c files. 2006-05-09 02:48:36 +00:00
snj d97db3840b s/allready/already/ 2006-04-25 02:19:31 +00:00
jmmv 7a51d4dddc Add an extra cookie to the ioctl and mmap wsdisplay accessops that points
to the screen on which they are being called.  The driver cannot guess
this by itself but it is needed to implement, at least, the getwschar and
putwschar functions in the correct place.  There are no functional changes
yet.

Tested on i386 (vga, vga_raster, machfb, vesafb), macppc and sparc64.
Suggested and reviewed by macallan@.
2006-04-12 19:38:22 +00:00
garbled e50f041957 ANSIfy more code in prep. 2006-03-17 06:11:58 +00:00
garbled 1dd8b98704 Prep super-commit:
1) create new pnpbus psuedo bus.  This is a bus layer that reads the PNP
tree from the residual data and allows attachment of devices with the
information given therein.  Based loosely on i386/pnpbios.

2) Delete obio bus, as with the pnp bus we no longer need it.

3) Create a number of functions that gather the information needed to set
up the machine from the residual data, rather than hardcoding it in.

4) Create a quirk table for machines that are bizzare enough that the
residual information is not sufficient.  (such as the 6015)

5) Using the data gathering routines and the quirk table, delete struct
platform completely from the architecture.  Prep is now almost completely
dynamic in figuring out the machine it is running on and setting things
up properly.

6) Add a wdc_pnpbus driver which attaches the wdc controller found on
some 7248's and the 6015.  This replaces the now-defunct wdc_obio.

7) delete all the mot_* and ibm_* files, and replace them with a single
ibm_machdep.c which only contains the quirk functions for the 6015 and
the 6050.

8) Modify GENERIC to work with all this stuff.
2006-03-09 20:17:27 +00:00
garbled b19f0d3164 Commit support for the IBM Model 7024 E20 and E30. (E30 not tested).
Changes:
Added a pci-EISA bridge device and associated glue to the prep port.
  Adapted from i386.
Change pci_intr_fixup_*() to pass the pin argument on all platforms.
Make PCI_NETBSD_CONFIGURE leave the MPIC alone.  We map it separately.

7024 kernel was also succ. tested on an IBM 7043, so no regression there.
2006-02-23 19:44:02 +00:00
gdamore 8430838831 PCI_NETBSD_CONFIGURE should allocate (but not map) address space expansion
ROMS by default.   Full discussion at
http://mail-index.netbsd.org/tech-kern/2005/12/16/0023.html
Closes PR kern/32467
Reviewed by briggs@
2006-02-10 20:52:56 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
skrll 4c384334d0 RCSId police. 2005-06-28 08:32:16 +00:00
kleink db5b1f2fa2 Pass the interrupt swizzle down to the platforms' fixup functions.
N.B. Only using it on the ulmb60xa for now.
2005-01-13 23:57:04 +00:00
drochner 46289e1fef Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
2004-08-30 15:05:15 +00:00
itojun 6123043789 pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region
2004-04-23 21:13:05 +00:00
chs e07f0b9362 eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed.  however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors.  most of
the callers of uvm_useracc() make the above incorrect assumption.  the
rest are all misguided optimizations, which optimize for the case
where an operation will fail.  we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors.  since there appear to be no good uses of uvm_useracc(), we'll
just remove it.
2003-11-13 03:09:28 +00:00
lukem ed51729135 __KERNEL_RCSID() 2003-07-15 02:54:31 +00:00
tsutsui 3d23dbfe88 Include <machine/pio.h> for in32rb() and out32rb(). 2003-04-05 08:47:29 +00:00
matt 8a5a3a480a Switch/adapt to new bus space infrastructure. 2003-03-18 16:40:18 +00:00
matt 72020abb85 Add platform support for the IBM PPS Model 6040 (E) (aka ThinkPad 820). 2003-01-16 02:18:20 +00:00
thorpej 95fa2e148a Use aprint_normal() for cfprint routines. 2003-01-01 01:57:51 +00:00
thorpej 89bf5a8f8e Add trailing ; to CFATTACH_DECL. 2002-10-02 15:52:22 +00:00
thorpej a942508291 Use CFATTACH_DECL(). 2002-10-01 21:36:00 +00:00
thorpej f818766afe Declare all cfattach structures const. 2002-09-27 20:31:45 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
junyoung 3d826105dc alloc_attr -> allocattr
Approved by Matthias Drochner.
2002-07-04 14:37:10 +00:00
nonaka 79e01c5f6f Support IBM RS/6000 43P 7043-140. 2002-05-30 16:10:03 +00:00
atatat 31144d9976 Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command".  ERESTART is -1, which can lead to
confusion.  ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4.  No ioctl code should now return -1 anywhere.  The
ioctl() system call is now properly restartable.
2002-03-17 19:40:26 +00:00
kleink d5fe2ac32f Declare the id argument to pci_conf_hook(9) as pcireg_t, which is more
appropriate.
2002-02-25 00:34:13 +00:00
kleink 5410bbdb16 In order to support both indirect PCI configuration space access as well
as direct-mapped PCI configuration space access (such as implemented on
the IBM 27-82650 PCI Host Bridge), switch to a function vector based
PCI configuration space access implementation.  The appropriate PCI
chipset tag is provided by platform-specific code.
2002-02-24 13:19:06 +00:00
kleink e1f611fa76 The MPC105 does not implement the IBM reference implementation's
Equipment Present Register (I/O port 0x080c), so perform L2 cache
detection here.
2001-12-12 10:18:48 +00:00
thorpej 6fd8d278ed pci_conf_interrupt() takes bus/dev/pin, not bus/dev/func. 2001-10-29 23:33:42 +00:00