2002-02-13 16:11:36 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Paul Kranenburg.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
2005-01-07 02:29:27 +00:00
|
|
|
/*-
|
2002-02-13 16:11:36 +00:00
|
|
|
* Copyright (c) 1992, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* This software was developed by the Computer Systems Engineering group
|
|
|
|
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
|
|
|
* contributed to Berkeley.
|
|
|
|
*
|
|
|
|
* All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Lawrence Berkeley Laboratory.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
2005-01-07 02:29:27 +00:00
|
|
|
/*-
|
2002-02-13 16:11:36 +00:00
|
|
|
* Copyright (c) 1999 Eduardo Horvath
|
|
|
|
* Copyright (c) 2002 by Thomas Moestl <tmm@FreeBSD.org>.
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
* Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org>
|
2002-02-13 16:11:36 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* from: @(#)sbus.c 8.1 (Berkeley) 6/11/93
|
|
|
|
* from: NetBSD: sbus.c,v 1.46 2001/10/07 20:30:41 eeh Exp
|
|
|
|
*/
|
|
|
|
|
2005-04-17 11:28:41 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2002-02-13 16:11:36 +00:00
|
|
|
/*
|
2005-04-17 11:28:41 +00:00
|
|
|
* SBus support.
|
2002-02-13 16:11:36 +00:00
|
|
|
*/
|
2004-06-30 23:21:07 +00:00
|
|
|
|
2002-02-13 16:11:36 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/malloc.h>
|
2004-06-04 11:52:25 +00:00
|
|
|
#include <sys/module.h>
|
2002-12-01 23:30:26 +00:00
|
|
|
#include <sys/pcpu.h>
|
2002-02-13 16:11:36 +00:00
|
|
|
#include <sys/reboot.h>
|
|
|
|
|
- Introduce an ofw_bus kobj-interface for retrieving the OFW node and a
subset ("compatible", "device_type", "model" and "name") of the standard
properties in drivers for devices on Open Firmware supported busses. The
standard properties "reg", "interrupts" und "address" are not covered by
this interface because they are only of interest in the respective bridge
code. There's a remaining standard property "status" which is unclear how
to support properly but which also isn't used in FreeBSD at present.
This ofw_bus kobj-interface allows to replace the various (ebus_get_node(),
ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type()
vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one.
This in turn allows to simplify and remove code-duplication in drivers for
devices that can hang off of more than one OFW supported bus.
- Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the
drivers for their children to use the ofw_bus kobj-interface. The IVAR-
interfaces of the Central, EBus and FHC are entirely replaced by this. The
PCI bus driver used its own kobj-interface and now also uses the ofw_bus
one. The IVARs special to the SBus, e.g. for retrieving the burst size,
remain.
Beware: this causes an ABI-breakage for modules of drivers which used the
IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be
recompiled.
The style-inconsistencies introduced in some of the bus drivers will be
fixed by tmm@ in a generic clean-up of the respective drivers later (he
requested to add the changes in the "new" style).
- Convert the powerpc MacIO bus driver and the drivers for its children to
use the ofw_bus kobj-interface. This invloves removing the IVARs related
to the "reg" property which were unused and a leftover from the NetBSD
origini of the code. There's no ABI-breakage caused by this because none
of these driver are currently built as modules.
There are other powerpc bus drivers which can be converted to the ofw_bus
kobj-interface, e.g. the PCI bus driver, which should be done together
with converting powerpc to use the OFW PCI code from sparc64.
- Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take
advantage of the ofw_bus kobj-interface and simplify them a bit.
Reviewed by: grehan, tmm
Approved by: re (scottl)
Discussed with: tmm
Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
2004-08-12 17:41:33 +00:00
|
|
|
#include <dev/ofw/ofw_bus.h>
|
2005-11-22 16:39:44 +00:00
|
|
|
#include <dev/ofw/ofw_bus_subr.h>
|
2003-08-23 00:11:16 +00:00
|
|
|
#include <dev/ofw/openfirm.h>
|
2002-02-13 16:11:36 +00:00
|
|
|
|
|
|
|
#include <machine/bus.h>
|
Further cleanup of the sparc64 busdma implementation:
- Move prototypes for sparc64-specific helper functions from bus.h to
bus_private.h
- Move the method pointers from struct bus_dma_tag into a separate
structure; this saves some memory, and allows to use a single method
table for each busdma backend, so that the bus drivers need no longer
be changed if the methods tables need to be modified.
- Remove the hierarchical tag method lookup. It was never really useful,
since the layering is fixed, and the current implementations do not
need to call into parent implementations anyway. Each tag inherits
its method table pointer and cookie from the parent (or the root tag)
now, and the method wrapper macros directly use the method table
of the tag.
- Add a method table to the non-IOMMU backend, remove unnecessary
prototypes, remove the extra parent tag argument.
- Rename sparc64_dmamem_alloc_map() and sparc64_dmamem_free_map() to
sparc64_dma_alloc_map() and sparc64_dma_free_map(), move them to a
better place and use them for all map allocations and deallocations.
- Add a method table to the iommu backend, and staticize functions,
remove the extra parent tag argument.
- Change the psycho and sbus drivers to just set cookie and method table
in the root tag.
- Miscellaneous small fixes.
2003-06-18 16:41:36 +00:00
|
|
|
#include <machine/bus_private.h>
|
2002-02-13 16:11:36 +00:00
|
|
|
#include <machine/iommureg.h>
|
|
|
|
#include <machine/bus_common.h>
|
|
|
|
#include <machine/resource.h>
|
|
|
|
|
|
|
|
#include <sys/rman.h>
|
|
|
|
|
|
|
|
#include <machine/iommuvar.h>
|
|
|
|
|
|
|
|
#include <sparc64/sbus/ofw_sbus.h>
|
|
|
|
#include <sparc64/sbus/sbusreg.h>
|
|
|
|
#include <sparc64/sbus/sbusvar.h>
|
|
|
|
|
|
|
|
struct sbus_devinfo {
|
|
|
|
int sdi_burstsz;
|
2005-04-17 11:32:34 +00:00
|
|
|
int sdi_clockfreq;
|
2002-02-13 16:11:36 +00:00
|
|
|
int sdi_slot;
|
|
|
|
|
2005-11-22 16:39:44 +00:00
|
|
|
struct ofw_bus_devinfo sdi_obdinfo;
|
2002-02-13 16:11:36 +00:00
|
|
|
struct resource_list sdi_rl;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Range descriptor, allocated for each sc_range. */
|
|
|
|
struct sbus_rd {
|
|
|
|
bus_addr_t rd_poffset;
|
|
|
|
bus_addr_t rd_pend;
|
|
|
|
int rd_slot;
|
|
|
|
bus_addr_t rd_coffset;
|
|
|
|
bus_addr_t rd_cend;
|
|
|
|
struct rman rd_rman;
|
|
|
|
bus_space_handle_t rd_bushandle;
|
|
|
|
struct resource *rd_res;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sbus_softc {
|
|
|
|
bus_space_tag_t sc_bustag;
|
|
|
|
bus_space_handle_t sc_bushandle;
|
|
|
|
bus_dma_tag_t sc_cdmatag;
|
|
|
|
bus_space_tag_t sc_cbustag;
|
|
|
|
int sc_clockfreq; /* clock frequency (in Hz) */
|
|
|
|
int sc_nrange;
|
|
|
|
struct sbus_rd *sc_rd;
|
2005-04-17 11:28:41 +00:00
|
|
|
int sc_burst; /* burst transfer sizes supp. */
|
2002-02-13 16:11:36 +00:00
|
|
|
|
|
|
|
struct resource *sc_sysio_res;
|
2005-04-17 11:28:41 +00:00
|
|
|
int sc_ign; /* IGN for this sysio */
|
|
|
|
struct iommu_state sc_is; /* IOMMU state (iommuvar.h) */
|
2002-02-13 16:11:36 +00:00
|
|
|
|
|
|
|
struct resource *sc_ot_ires;
|
|
|
|
void *sc_ot_ihand;
|
|
|
|
struct resource *sc_pf_ires;
|
|
|
|
void *sc_pf_ihand;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sbus_clr {
|
|
|
|
struct sbus_softc *scl_sc;
|
2005-04-17 11:28:41 +00:00
|
|
|
bus_addr_t scl_clr; /* clear register */
|
2007-06-06 22:19:23 +00:00
|
|
|
driver_filter_t *scl_filter;
|
|
|
|
driver_intr_t *scl_handler; /* handler to call */
|
2005-04-17 11:28:41 +00:00
|
|
|
void *scl_arg; /* argument for the handler */
|
|
|
|
void *scl_cookie; /* parent bus int. cookie */
|
2002-02-13 16:11:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define SYSIO_READ8(sc, off) \
|
|
|
|
bus_space_read_8((sc)->sc_bustag, (sc)->sc_bushandle, (off))
|
|
|
|
#define SYSIO_WRITE8(sc, off, v) \
|
|
|
|
bus_space_write_8((sc)->sc_bustag, (sc)->sc_bushandle, (off), (v))
|
|
|
|
|
2005-04-17 11:28:41 +00:00
|
|
|
static device_probe_t sbus_probe;
|
2005-04-17 11:32:34 +00:00
|
|
|
static device_attach_t sbus_attach;
|
2005-04-17 11:28:41 +00:00
|
|
|
static bus_print_child_t sbus_print_child;
|
|
|
|
static bus_probe_nomatch_t sbus_probe_nomatch;
|
|
|
|
static bus_read_ivar_t sbus_read_ivar;
|
|
|
|
static bus_get_resource_list_t sbus_get_resource_list;
|
|
|
|
static bus_setup_intr_t sbus_setup_intr;
|
|
|
|
static bus_teardown_intr_t sbus_teardown_intr;
|
|
|
|
static bus_alloc_resource_t sbus_alloc_resource;
|
|
|
|
static bus_release_resource_t sbus_release_resource;
|
|
|
|
static bus_activate_resource_t sbus_activate_resource;
|
|
|
|
static bus_deactivate_resource_t sbus_deactivate_resource;
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
static bus_get_dma_tag_t sbus_get_dma_tag;
|
2005-11-22 16:39:44 +00:00
|
|
|
static ofw_bus_get_devinfo_t sbus_get_devinfo;
|
2002-02-13 16:11:36 +00:00
|
|
|
|
2005-05-19 14:47:31 +00:00
|
|
|
static int sbus_inlist(const char *, const char **);
|
2005-11-22 16:39:44 +00:00
|
|
|
static struct sbus_devinfo * sbus_setup_dinfo(device_t, struct sbus_softc *,
|
|
|
|
phandle_t);
|
|
|
|
static void sbus_destroy_dinfo(struct sbus_devinfo *);
|
2007-06-06 22:19:23 +00:00
|
|
|
static driver_filter_t sbus_filter_stub;
|
|
|
|
static driver_intr_t sbus_intr_stub;
|
2002-02-13 16:11:36 +00:00
|
|
|
static bus_space_tag_t sbus_alloc_bustag(struct sbus_softc *);
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
static driver_filter_t sbus_overtemp;
|
|
|
|
static driver_filter_t sbus_pwrfail;
|
2005-11-22 16:39:44 +00:00
|
|
|
static int sbus_print_res(struct sbus_devinfo *);
|
2002-02-13 16:11:36 +00:00
|
|
|
|
|
|
|
static device_method_t sbus_methods[] = {
|
|
|
|
/* Device interface */
|
|
|
|
DEVMETHOD(device_probe, sbus_probe),
|
2005-04-17 11:32:34 +00:00
|
|
|
DEVMETHOD(device_attach, sbus_attach),
|
2006-01-26 21:14:32 +00:00
|
|
|
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
|
|
|
DEVMETHOD(device_suspend, bus_generic_suspend),
|
|
|
|
DEVMETHOD(device_resume, bus_generic_resume),
|
2002-02-13 16:11:36 +00:00
|
|
|
|
|
|
|
/* Bus interface */
|
|
|
|
DEVMETHOD(bus_print_child, sbus_print_child),
|
|
|
|
DEVMETHOD(bus_probe_nomatch, sbus_probe_nomatch),
|
|
|
|
DEVMETHOD(bus_read_ivar, sbus_read_ivar),
|
|
|
|
DEVMETHOD(bus_setup_intr, sbus_setup_intr),
|
|
|
|
DEVMETHOD(bus_teardown_intr, sbus_teardown_intr),
|
|
|
|
DEVMETHOD(bus_alloc_resource, sbus_alloc_resource),
|
|
|
|
DEVMETHOD(bus_activate_resource, sbus_activate_resource),
|
|
|
|
DEVMETHOD(bus_deactivate_resource, sbus_deactivate_resource),
|
|
|
|
DEVMETHOD(bus_release_resource, sbus_release_resource),
|
|
|
|
DEVMETHOD(bus_get_resource_list, sbus_get_resource_list),
|
|
|
|
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
DEVMETHOD(bus_get_dma_tag, sbus_get_dma_tag),
|
2002-02-13 16:11:36 +00:00
|
|
|
|
- Introduce an ofw_bus kobj-interface for retrieving the OFW node and a
subset ("compatible", "device_type", "model" and "name") of the standard
properties in drivers for devices on Open Firmware supported busses. The
standard properties "reg", "interrupts" und "address" are not covered by
this interface because they are only of interest in the respective bridge
code. There's a remaining standard property "status" which is unclear how
to support properly but which also isn't used in FreeBSD at present.
This ofw_bus kobj-interface allows to replace the various (ebus_get_node(),
ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type()
vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one.
This in turn allows to simplify and remove code-duplication in drivers for
devices that can hang off of more than one OFW supported bus.
- Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the
drivers for their children to use the ofw_bus kobj-interface. The IVAR-
interfaces of the Central, EBus and FHC are entirely replaced by this. The
PCI bus driver used its own kobj-interface and now also uses the ofw_bus
one. The IVARs special to the SBus, e.g. for retrieving the burst size,
remain.
Beware: this causes an ABI-breakage for modules of drivers which used the
IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be
recompiled.
The style-inconsistencies introduced in some of the bus drivers will be
fixed by tmm@ in a generic clean-up of the respective drivers later (he
requested to add the changes in the "new" style).
- Convert the powerpc MacIO bus driver and the drivers for its children to
use the ofw_bus kobj-interface. This invloves removing the IVARs related
to the "reg" property which were unused and a leftover from the NetBSD
origini of the code. There's no ABI-breakage caused by this because none
of these driver are currently built as modules.
There are other powerpc bus drivers which can be converted to the ofw_bus
kobj-interface, e.g. the PCI bus driver, which should be done together
with converting powerpc to use the OFW PCI code from sparc64.
- Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take
advantage of the ofw_bus kobj-interface and simplify them a bit.
Reviewed by: grehan, tmm
Approved by: re (scottl)
Discussed with: tmm
Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
2004-08-12 17:41:33 +00:00
|
|
|
/* ofw_bus interface */
|
2005-11-22 16:39:44 +00:00
|
|
|
DEVMETHOD(ofw_bus_get_devinfo, sbus_get_devinfo),
|
|
|
|
DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat),
|
|
|
|
DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model),
|
|
|
|
DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name),
|
|
|
|
DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node),
|
|
|
|
DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type),
|
- Introduce an ofw_bus kobj-interface for retrieving the OFW node and a
subset ("compatible", "device_type", "model" and "name") of the standard
properties in drivers for devices on Open Firmware supported busses. The
standard properties "reg", "interrupts" und "address" are not covered by
this interface because they are only of interest in the respective bridge
code. There's a remaining standard property "status" which is unclear how
to support properly but which also isn't used in FreeBSD at present.
This ofw_bus kobj-interface allows to replace the various (ebus_get_node(),
ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type()
vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one.
This in turn allows to simplify and remove code-duplication in drivers for
devices that can hang off of more than one OFW supported bus.
- Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the
drivers for their children to use the ofw_bus kobj-interface. The IVAR-
interfaces of the Central, EBus and FHC are entirely replaced by this. The
PCI bus driver used its own kobj-interface and now also uses the ofw_bus
one. The IVARs special to the SBus, e.g. for retrieving the burst size,
remain.
Beware: this causes an ABI-breakage for modules of drivers which used the
IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be
recompiled.
The style-inconsistencies introduced in some of the bus drivers will be
fixed by tmm@ in a generic clean-up of the respective drivers later (he
requested to add the changes in the "new" style).
- Convert the powerpc MacIO bus driver and the drivers for its children to
use the ofw_bus kobj-interface. This invloves removing the IVARs related
to the "reg" property which were unused and a leftover from the NetBSD
origini of the code. There's no ABI-breakage caused by this because none
of these driver are currently built as modules.
There are other powerpc bus drivers which can be converted to the ofw_bus
kobj-interface, e.g. the PCI bus driver, which should be done together
with converting powerpc to use the OFW PCI code from sparc64.
- Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take
advantage of the ofw_bus kobj-interface and simplify them a bit.
Reviewed by: grehan, tmm
Approved by: re (scottl)
Discussed with: tmm
Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
2004-08-12 17:41:33 +00:00
|
|
|
|
2002-02-13 16:11:36 +00:00
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static driver_t sbus_driver = {
|
|
|
|
"sbus",
|
|
|
|
sbus_methods,
|
|
|
|
sizeof(struct sbus_softc),
|
|
|
|
};
|
|
|
|
|
|
|
|
static devclass_t sbus_devclass;
|
|
|
|
|
|
|
|
DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, 0, 0);
|
|
|
|
|
|
|
|
#define OFW_SBUS_TYPE "sbus"
|
|
|
|
#define OFW_SBUS_NAME "sbus"
|
|
|
|
|
2005-05-19 14:47:31 +00:00
|
|
|
static const char *sbus_order_first[] = {
|
|
|
|
"auxio",
|
|
|
|
"dma",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
|
|
|
sbus_inlist(const char *name, const char **list)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (name == NULL)
|
|
|
|
return (0);
|
|
|
|
for (i = 0; list[i] != NULL; i++) {
|
|
|
|
if (strcmp(name, list[i]) == 0)
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2002-02-13 16:11:36 +00:00
|
|
|
static int
|
|
|
|
sbus_probe(device_t dev)
|
2005-04-17 11:32:34 +00:00
|
|
|
{
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
const char *t;
|
2005-04-17 11:32:34 +00:00
|
|
|
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
t = ofw_bus_get_type(dev);
|
2005-04-17 11:32:34 +00:00
|
|
|
if (((t == NULL || strcmp(t, OFW_SBUS_TYPE) != 0)) &&
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
strcmp(ofw_bus_get_name(dev), OFW_SBUS_NAME) != 0)
|
2005-04-17 11:32:34 +00:00
|
|
|
return (ENXIO);
|
|
|
|
device_set_desc(dev, "U2S UPA-SBus bridge");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sbus_attach(device_t dev)
|
2002-02-13 16:11:36 +00:00
|
|
|
{
|
2005-04-17 11:28:41 +00:00
|
|
|
struct sbus_softc *sc;
|
2002-02-13 16:11:36 +00:00
|
|
|
struct sbus_devinfo *sdi;
|
|
|
|
struct sbus_ranges *range;
|
|
|
|
struct resource *res;
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
struct resource_list *rl;
|
2002-02-13 16:11:36 +00:00
|
|
|
device_t cdev;
|
|
|
|
bus_addr_t phys;
|
|
|
|
bus_size_t size;
|
2005-11-22 16:39:44 +00:00
|
|
|
char *name;
|
2005-04-17 11:28:41 +00:00
|
|
|
phandle_t child, node;
|
2002-02-13 16:11:36 +00:00
|
|
|
u_int64_t mr;
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
int clock, i, intr, rid;
|
2002-02-13 16:11:36 +00:00
|
|
|
|
2005-04-17 11:28:41 +00:00
|
|
|
sc = device_get_softc(dev);
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
node = ofw_bus_get_node(dev);
|
2005-04-17 11:28:41 +00:00
|
|
|
|
2002-02-13 16:11:36 +00:00
|
|
|
rid = 0;
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
sc->sc_sysio_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
|
|
|
|
RF_ACTIVE);
|
|
|
|
if (sc->sc_sysio_res == NULL)
|
2005-04-17 11:28:41 +00:00
|
|
|
panic("%s: cannot allocate device memory", __func__);
|
2002-02-13 16:11:36 +00:00
|
|
|
sc->sc_bustag = rman_get_bustag(sc->sc_sysio_res);
|
|
|
|
sc->sc_bushandle = rman_get_bushandle(sc->sc_sysio_res);
|
|
|
|
|
|
|
|
if (OF_getprop(node, "interrupts", &intr, sizeof(intr)) == -1)
|
2005-04-17 11:28:41 +00:00
|
|
|
panic("%s: cannot get IGN", __func__);
|
2005-05-19 14:47:31 +00:00
|
|
|
sc->sc_ign = (intr & INTMAP_IGN_MASK) >> INTMAP_IGN_SHIFT;
|
2002-02-13 16:11:36 +00:00
|
|
|
sc->sc_cbustag = sbus_alloc_bustag(sc);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Record clock frequency for synchronous SCSI.
|
|
|
|
* IS THIS THE CORRECT DEFAULT??
|
|
|
|
*/
|
|
|
|
if (OF_getprop(node, "clock-frequency", &clock, sizeof(clock)) == -1)
|
|
|
|
clock = 25000000;
|
|
|
|
sc->sc_clockfreq = clock;
|
|
|
|
clock /= 1000;
|
|
|
|
device_printf(dev, "clock %d.%03d MHz\n", clock / 1000, clock % 1000);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Collect address translations from the OBP.
|
|
|
|
*/
|
|
|
|
if ((sc->sc_nrange = OF_getprop_alloc(node, "ranges",
|
|
|
|
sizeof(*range), (void **)&range)) == -1) {
|
2005-04-17 11:28:41 +00:00
|
|
|
panic("%s: error getting ranges property", __func__);
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
|
|
|
sc->sc_rd = (struct sbus_rd *)malloc(sizeof(*sc->sc_rd) * sc->sc_nrange,
|
|
|
|
M_DEVBUF, M_NOWAIT);
|
|
|
|
if (sc->sc_rd == NULL)
|
2005-04-17 11:28:41 +00:00
|
|
|
panic("%s: cannot allocate rmans", __func__);
|
2002-02-13 16:11:36 +00:00
|
|
|
/*
|
|
|
|
* Preallocate all space that the SBus bridge decodes, so that nothing
|
|
|
|
* else gets in the way; set up rmans etc.
|
|
|
|
*/
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
rl = BUS_GET_RESOURCE_LIST(device_get_parent(dev), dev);
|
2002-02-13 16:11:36 +00:00
|
|
|
for (i = 0; i < sc->sc_nrange; i++) {
|
|
|
|
phys = range[i].poffset | ((bus_addr_t)range[i].pspace << 32);
|
|
|
|
size = range[i].size;
|
|
|
|
sc->sc_rd[i].rd_slot = range[i].cspace;
|
|
|
|
sc->sc_rd[i].rd_coffset = range[i].coffset;
|
|
|
|
sc->sc_rd[i].rd_cend = sc->sc_rd[i].rd_coffset + size;
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
rid = resource_list_add_next(rl, SYS_RES_MEMORY, phys,
|
|
|
|
phys + size - 1, size);
|
|
|
|
if ((res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
|
|
|
|
RF_ACTIVE)) == NULL)
|
2005-04-17 11:28:41 +00:00
|
|
|
panic("%s: cannot allocate decoded range", __func__);
|
2002-02-13 16:11:36 +00:00
|
|
|
sc->sc_rd[i].rd_bushandle = rman_get_bushandle(res);
|
|
|
|
sc->sc_rd[i].rd_rman.rm_type = RMAN_ARRAY;
|
|
|
|
sc->sc_rd[i].rd_rman.rm_descr = "SBus Device Memory";
|
|
|
|
if (rman_init(&sc->sc_rd[i].rd_rman) != 0 ||
|
|
|
|
rman_manage_region(&sc->sc_rd[i].rd_rman, 0, size) != 0)
|
2005-04-17 11:28:41 +00:00
|
|
|
panic("%s: failed to set up memory rman", __func__);
|
2002-02-13 16:11:36 +00:00
|
|
|
sc->sc_rd[i].rd_poffset = phys;
|
|
|
|
sc->sc_rd[i].rd_pend = phys + size;
|
|
|
|
sc->sc_rd[i].rd_res = res;
|
|
|
|
}
|
|
|
|
free(range, M_OFWPROP);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the SBus burst transfer size if burst transfers are supported.
|
|
|
|
* XXX: is the default correct?
|
|
|
|
*/
|
|
|
|
if (OF_getprop(node, "burst-sizes", &sc->sc_burst,
|
|
|
|
sizeof(sc->sc_burst)) == -1 || sc->sc_burst == 0)
|
|
|
|
sc->sc_burst = SBUS_BURST_DEF;
|
|
|
|
|
|
|
|
/* initalise the IOMMU */
|
|
|
|
|
|
|
|
/* punch in our copies */
|
|
|
|
sc->sc_is.is_bustag = sc->sc_bustag;
|
|
|
|
sc->sc_is.is_bushandle = sc->sc_bushandle;
|
|
|
|
sc->sc_is.is_iommu = SBR_IOMMU;
|
|
|
|
sc->sc_is.is_dtag = SBR_IOMMU_TLB_TAG_DIAG;
|
|
|
|
sc->sc_is.is_ddram = SBR_IOMMU_TLB_DATA_DIAG;
|
|
|
|
sc->sc_is.is_dqueue = SBR_IOMMU_QUEUE_DIAG;
|
|
|
|
sc->sc_is.is_dva = SBR_IOMMU_SVADIAG;
|
|
|
|
sc->sc_is.is_dtcmp = 0;
|
|
|
|
sc->sc_is.is_sb[0] = SBR_STRBUF;
|
2003-12-26 14:22:26 +00:00
|
|
|
sc->sc_is.is_sb[1] = 0;
|
2002-02-13 16:11:36 +00:00
|
|
|
|
|
|
|
/* give us a nice name.. */
|
|
|
|
name = (char *)malloc(32, M_DEVBUF, M_NOWAIT);
|
2005-04-17 11:28:41 +00:00
|
|
|
if (name == NULL)
|
|
|
|
panic("%s: cannot malloc iommu name", __func__);
|
2002-02-13 16:11:36 +00:00
|
|
|
snprintf(name, 32, "%s dvma", device_get_name(dev));
|
|
|
|
|
2002-07-16 18:17:03 +00:00
|
|
|
/*
|
|
|
|
* Note: the SBus IOMMU ignores the high bits of an address, so a NULL
|
|
|
|
* DMA pointer will be translated by the first page of the IOTSB.
|
|
|
|
* To detect bugs we'll allocate and ignore the first entry.
|
|
|
|
*/
|
2003-05-02 01:21:37 +00:00
|
|
|
iommu_init(name, &sc->sc_is, 3, -1, 1);
|
2002-02-13 16:11:36 +00:00
|
|
|
|
2003-06-11 20:30:52 +00:00
|
|
|
/* Create the DMA tag. */
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0, IOMMU_MAXADDR, ~0,
|
|
|
|
NULL, NULL, IOMMU_MAXADDR, 0xff, 0xffffffff, 0, NULL, NULL,
|
|
|
|
&sc->sc_cdmatag) != 0)
|
2005-04-17 11:28:41 +00:00
|
|
|
panic("%s: bus_dma_tag_create failed", __func__);
|
2003-06-11 20:30:52 +00:00
|
|
|
/* Customize the tag. */
|
|
|
|
sc->sc_cdmatag->dt_cookie = &sc->sc_is;
|
Further cleanup of the sparc64 busdma implementation:
- Move prototypes for sparc64-specific helper functions from bus.h to
bus_private.h
- Move the method pointers from struct bus_dma_tag into a separate
structure; this saves some memory, and allows to use a single method
table for each busdma backend, so that the bus drivers need no longer
be changed if the methods tables need to be modified.
- Remove the hierarchical tag method lookup. It was never really useful,
since the layering is fixed, and the current implementations do not
need to call into parent implementations anyway. Each tag inherits
its method table pointer and cookie from the parent (or the root tag)
now, and the method wrapper macros directly use the method table
of the tag.
- Add a method table to the non-IOMMU backend, remove unnecessary
prototypes, remove the extra parent tag argument.
- Rename sparc64_dmamem_alloc_map() and sparc64_dmamem_free_map() to
sparc64_dma_alloc_map() and sparc64_dma_free_map(), move them to a
better place and use them for all map allocations and deallocations.
- Add a method table to the iommu backend, and staticize functions,
remove the extra parent tag argument.
- Change the psycho and sbus drivers to just set cookie and method table
in the root tag.
- Miscellaneous small fixes.
2003-06-18 16:41:36 +00:00
|
|
|
sc->sc_cdmatag->dt_mt = &iommu_dma_methods;
|
2003-06-11 20:30:52 +00:00
|
|
|
|
2005-04-17 11:28:41 +00:00
|
|
|
/* Enable the over-temperature and power-fail interrupts. */
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
rid = 4;
|
2002-02-13 16:11:36 +00:00
|
|
|
mr = SYSIO_READ8(sc, SBR_THERM_INT_MAP);
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
sc->sc_ot_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
|
|
|
|
RF_ACTIVE);
|
2007-01-15 22:37:59 +00:00
|
|
|
if (sc->sc_ot_ires == NULL ||
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
rman_get_start(sc->sc_ot_ires) != INTVEC(mr) ||
|
2007-02-23 12:19:07 +00:00
|
|
|
bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC,
|
|
|
|
sbus_overtemp, NULL, sc, &sc->sc_ot_ihand) != 0)
|
2007-01-15 22:37:59 +00:00
|
|
|
panic("%s: failed to set up temperature interrupt", __func__);
|
2002-12-01 23:30:26 +00:00
|
|
|
SYSIO_WRITE8(sc, SBR_THERM_INT_MAP, INTMAP_ENABLE(mr, PCPU_GET(mid)));
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
rid = 3;
|
2002-02-13 16:11:36 +00:00
|
|
|
mr = SYSIO_READ8(sc, SBR_POWER_INT_MAP);
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
sc->sc_pf_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
|
|
|
|
RF_ACTIVE);
|
2007-01-15 22:37:59 +00:00
|
|
|
if (sc->sc_pf_ires == NULL ||
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
rman_get_start(sc->sc_pf_ires) != INTVEC(mr) ||
|
2007-02-23 12:19:07 +00:00
|
|
|
bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC,
|
|
|
|
sbus_pwrfail, NULL, sc, &sc->sc_pf_ihand) != 0)
|
2007-01-15 22:37:59 +00:00
|
|
|
panic("%s: failed to set up power fail interrupt", __func__);
|
2002-12-01 23:30:26 +00:00
|
|
|
SYSIO_WRITE8(sc, SBR_POWER_INT_MAP, INTMAP_ENABLE(mr, PCPU_GET(mid)));
|
2002-02-13 16:11:36 +00:00
|
|
|
|
|
|
|
/* Initialize the counter-timer. */
|
|
|
|
sparc64_counter_init(sc->sc_bustag, sc->sc_bushandle, SBR_TC0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Loop through ROM children, fixing any relative addresses
|
|
|
|
* and then configuring each device.
|
|
|
|
*/
|
|
|
|
for (child = OF_child(node); child != 0; child = OF_peer(child)) {
|
2005-11-22 16:39:44 +00:00
|
|
|
if ((sdi = sbus_setup_dinfo(dev, sc, child)) == NULL)
|
2002-02-13 16:11:36 +00:00
|
|
|
continue;
|
2005-05-19 14:47:31 +00:00
|
|
|
/*
|
|
|
|
* For devices where there are variants that are actually
|
|
|
|
* split into two SBus devices (as opposed to the first
|
|
|
|
* half of the device being a SBus device and the second
|
|
|
|
* half hanging off of the first one) like 'auxio' and
|
|
|
|
* 'SUNW,fdtwo' or 'dma' and 'esp' probe the SBus device
|
|
|
|
* which is a prerequisite to the driver attaching to the
|
|
|
|
* second one with a lower order. Saves us from dealing
|
|
|
|
* with different probe orders in the respective device
|
|
|
|
* drivers which generally is more hackish.
|
|
|
|
*/
|
|
|
|
cdev = device_add_child_ordered(dev, (OF_child(child) == 0 &&
|
2005-11-22 16:39:44 +00:00
|
|
|
sbus_inlist(sdi->sdi_obdinfo.obd_name, sbus_order_first)) ?
|
|
|
|
SBUS_ORDER_FIRST : SBUS_ORDER_NORMAL, NULL, -1);
|
|
|
|
if (cdev == NULL) {
|
|
|
|
device_printf(dev,
|
|
|
|
"<%s>: device_add_child_ordered failed\n",
|
|
|
|
sdi->sdi_obdinfo.obd_name);
|
|
|
|
sbus_destroy_dinfo(sdi);
|
|
|
|
continue;
|
|
|
|
}
|
2002-02-13 16:11:36 +00:00
|
|
|
device_set_ivars(cdev, sdi);
|
|
|
|
}
|
2005-04-17 11:32:34 +00:00
|
|
|
return (bus_generic_attach(dev));
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct sbus_devinfo *
|
2005-11-22 16:39:44 +00:00
|
|
|
sbus_setup_dinfo(device_t dev, struct sbus_softc *sc, phandle_t node)
|
2002-02-13 16:11:36 +00:00
|
|
|
{
|
|
|
|
struct sbus_devinfo *sdi;
|
|
|
|
struct sbus_regs *reg;
|
|
|
|
u_int32_t base, iv, *intr;
|
|
|
|
int i, nreg, nintr, slot, rslot;
|
|
|
|
|
2003-02-19 05:47:46 +00:00
|
|
|
sdi = malloc(sizeof(*sdi), M_DEVBUF, M_ZERO | M_WAITOK);
|
2005-11-22 16:39:44 +00:00
|
|
|
if (ofw_bus_gen_setup_devinfo(&sdi->sdi_obdinfo, node) != 0) {
|
|
|
|
free(sdi, M_DEVBUF);
|
2002-02-13 16:11:36 +00:00
|
|
|
return (NULL);
|
2005-11-22 16:39:44 +00:00
|
|
|
}
|
2002-02-13 16:11:36 +00:00
|
|
|
resource_list_init(&sdi->sdi_rl);
|
|
|
|
slot = -1;
|
|
|
|
nreg = OF_getprop_alloc(node, "reg", sizeof(*reg), (void **)®);
|
|
|
|
if (nreg == -1) {
|
2005-11-22 16:39:44 +00:00
|
|
|
if (sdi->sdi_obdinfo.obd_type == NULL ||
|
|
|
|
strcmp(sdi->sdi_obdinfo.obd_type, "hierarchical") != 0) {
|
|
|
|
device_printf(dev, "<%s>: incomplete\n",
|
|
|
|
sdi->sdi_obdinfo.obd_name);
|
|
|
|
goto fail;
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < nreg; i++) {
|
|
|
|
base = reg[i].sbr_offset;
|
|
|
|
if (SBUS_ABS(base)) {
|
|
|
|
rslot = SBUS_ABS_TO_SLOT(base);
|
|
|
|
base = SBUS_ABS_TO_OFFSET(base);
|
|
|
|
} else
|
|
|
|
rslot = reg[i].sbr_slot;
|
2005-11-22 16:39:44 +00:00
|
|
|
if (slot != -1 && slot != rslot) {
|
|
|
|
device_printf(dev, "<%s>: multiple slots\n",
|
|
|
|
sdi->sdi_obdinfo.obd_name);
|
|
|
|
free(reg, M_OFWPROP);
|
|
|
|
goto fail;
|
|
|
|
}
|
2002-02-13 16:11:36 +00:00
|
|
|
slot = rslot;
|
|
|
|
|
|
|
|
resource_list_add(&sdi->sdi_rl, SYS_RES_MEMORY, i,
|
|
|
|
base, base + reg[i].sbr_size, reg[i].sbr_size);
|
|
|
|
}
|
|
|
|
free(reg, M_OFWPROP);
|
|
|
|
}
|
|
|
|
sdi->sdi_slot = slot;
|
|
|
|
|
|
|
|
/*
|
2005-04-17 11:28:41 +00:00
|
|
|
* The `interrupts' property contains the SBus interrupt level.
|
2002-02-13 16:11:36 +00:00
|
|
|
*/
|
2005-04-17 11:28:41 +00:00
|
|
|
nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intr),
|
|
|
|
(void **)&intr);
|
2002-02-13 16:11:36 +00:00
|
|
|
if (nintr != -1) {
|
|
|
|
for (i = 0; i < nintr; i++) {
|
|
|
|
iv = intr[i];
|
|
|
|
/*
|
2005-04-17 11:28:41 +00:00
|
|
|
* SBus card devices need the slot number encoded into
|
2002-02-13 16:11:36 +00:00
|
|
|
* the vector as this is generally not done.
|
|
|
|
*/
|
2002-12-01 23:30:26 +00:00
|
|
|
if ((iv & INTMAP_OBIO_MASK) == 0)
|
2002-02-13 16:11:36 +00:00
|
|
|
iv |= slot << 3;
|
|
|
|
/* Set the ign as appropriate. */
|
2005-05-19 14:47:31 +00:00
|
|
|
iv |= sc->sc_ign << INTMAP_IGN_SHIFT;
|
2002-02-13 16:11:36 +00:00
|
|
|
resource_list_add(&sdi->sdi_rl, SYS_RES_IRQ, i,
|
|
|
|
iv, iv, 1);
|
|
|
|
}
|
|
|
|
free(intr, M_OFWPROP);
|
|
|
|
}
|
|
|
|
if (OF_getprop(node, "burst-sizes", &sdi->sdi_burstsz,
|
|
|
|
sizeof(sdi->sdi_burstsz)) == -1)
|
|
|
|
sdi->sdi_burstsz = sc->sc_burst;
|
|
|
|
else
|
|
|
|
sdi->sdi_burstsz &= sc->sc_burst;
|
2005-04-17 11:32:34 +00:00
|
|
|
if (OF_getprop(node, "clock-frequency", &sdi->sdi_clockfreq,
|
|
|
|
sizeof(sdi->sdi_clockfreq)) == -1)
|
|
|
|
sdi->sdi_clockfreq = sc->sc_clockfreq;
|
2002-02-13 16:11:36 +00:00
|
|
|
|
|
|
|
return (sdi);
|
2005-11-22 16:39:44 +00:00
|
|
|
|
|
|
|
fail:
|
|
|
|
sbus_destroy_dinfo(sdi);
|
|
|
|
return (NULL);
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sbus_destroy_dinfo(struct sbus_devinfo *dinfo)
|
|
|
|
{
|
|
|
|
|
|
|
|
resource_list_free(&dinfo->sdi_rl);
|
2005-11-22 16:39:44 +00:00
|
|
|
ofw_bus_gen_destroy_devinfo(&dinfo->sdi_obdinfo);
|
2002-02-13 16:11:36 +00:00
|
|
|
free(dinfo, M_DEVBUF);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sbus_print_child(device_t dev, device_t child)
|
|
|
|
{
|
|
|
|
int rv;
|
|
|
|
|
|
|
|
rv = bus_print_child_header(dev, child);
|
2005-11-22 16:39:44 +00:00
|
|
|
rv += sbus_print_res(device_get_ivars(child));
|
2002-02-13 16:11:36 +00:00
|
|
|
rv += bus_print_child_footer(dev, child);
|
|
|
|
return (rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sbus_probe_nomatch(device_t dev, device_t child)
|
|
|
|
{
|
2005-11-22 16:39:44 +00:00
|
|
|
const char *type;
|
2002-02-13 16:11:36 +00:00
|
|
|
|
2005-11-22 16:39:44 +00:00
|
|
|
device_printf(dev, "<%s>", ofw_bus_get_name(child));
|
|
|
|
sbus_print_res(device_get_ivars(child));
|
|
|
|
type = ofw_bus_get_type(child);
|
2005-04-17 11:32:34 +00:00
|
|
|
printf(" type %s (no driver attached)\n",
|
2005-11-22 16:39:44 +00:00
|
|
|
type != NULL ? type : "unknown");
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sbus_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
|
|
|
|
{
|
2005-05-19 14:47:31 +00:00
|
|
|
struct sbus_softc *sc;
|
2002-02-13 16:11:36 +00:00
|
|
|
struct sbus_devinfo *dinfo;
|
|
|
|
|
2005-05-19 14:47:31 +00:00
|
|
|
sc = device_get_softc(dev);
|
2002-02-13 16:11:36 +00:00
|
|
|
if ((dinfo = device_get_ivars(child)) == NULL)
|
|
|
|
return (ENOENT);
|
|
|
|
switch (which) {
|
|
|
|
case SBUS_IVAR_BURSTSZ:
|
|
|
|
*result = dinfo->sdi_burstsz;
|
|
|
|
break;
|
|
|
|
case SBUS_IVAR_CLOCKFREQ:
|
2005-04-17 11:32:34 +00:00
|
|
|
*result = dinfo->sdi_clockfreq;
|
2002-02-13 16:11:36 +00:00
|
|
|
break;
|
2005-05-19 14:47:31 +00:00
|
|
|
case SBUS_IVAR_IGN:
|
|
|
|
*result = sc->sc_ign;
|
|
|
|
break;
|
2002-02-13 16:11:36 +00:00
|
|
|
case SBUS_IVAR_SLOT:
|
|
|
|
*result = dinfo->sdi_slot;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return (ENOENT);
|
|
|
|
}
|
2005-05-19 14:47:31 +00:00
|
|
|
return (0);
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct resource_list *
|
|
|
|
sbus_get_resource_list(device_t dev, device_t child)
|
|
|
|
{
|
|
|
|
struct sbus_devinfo *sdi;
|
|
|
|
|
|
|
|
sdi = device_get_ivars(child);
|
|
|
|
return (&sdi->sdi_rl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Write to the correct clr register, and call the actual handler. */
|
2007-02-23 12:19:07 +00:00
|
|
|
static int
|
2007-06-06 22:19:23 +00:00
|
|
|
sbus_filter_stub(void *arg)
|
|
|
|
{
|
|
|
|
struct sbus_clr *scl;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
scl = (struct sbus_clr *)arg;
|
|
|
|
if (scl->scl_filter != NULL) {
|
|
|
|
res = scl->scl_filter(scl->scl_arg);
|
|
|
|
SYSIO_WRITE8(scl->scl_sc, scl->scl_clr, 0);
|
|
|
|
} else
|
|
|
|
res = FILTER_SCHEDULE_THREAD;
|
|
|
|
return (res);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-02-13 16:11:36 +00:00
|
|
|
sbus_intr_stub(void *arg)
|
|
|
|
{
|
|
|
|
struct sbus_clr *scl;
|
|
|
|
|
|
|
|
scl = (struct sbus_clr *)arg;
|
|
|
|
scl->scl_handler(scl->scl_arg);
|
2007-06-06 22:19:23 +00:00
|
|
|
if (scl->scl_filter == NULL)
|
|
|
|
SYSIO_WRITE8(scl->scl_sc, scl->scl_clr, 0);
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2005-04-17 11:28:41 +00:00
|
|
|
sbus_setup_intr(device_t dev, device_t child, struct resource *ires, int flags,
|
2007-02-23 12:19:07 +00:00
|
|
|
driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep)
|
2002-02-13 16:11:36 +00:00
|
|
|
{
|
|
|
|
struct sbus_softc *sc;
|
|
|
|
struct sbus_clr *scl;
|
|
|
|
bus_addr_t intrmapptr, intrclrptr, intrptr;
|
|
|
|
u_int64_t intrmap;
|
|
|
|
u_int32_t inr, slot;
|
|
|
|
int error, i;
|
2006-06-08 21:02:25 +00:00
|
|
|
long vec;
|
2002-02-13 16:11:36 +00:00
|
|
|
|
2007-02-23 12:19:07 +00:00
|
|
|
if (filt != NULL && intr != NULL)
|
|
|
|
return (EINVAL);
|
2005-04-17 11:28:41 +00:00
|
|
|
sc = device_get_softc(dev);
|
2002-02-13 16:11:36 +00:00
|
|
|
scl = (struct sbus_clr *)malloc(sizeof(*scl), M_DEVBUF, M_NOWAIT);
|
|
|
|
if (scl == NULL)
|
2006-06-08 21:02:25 +00:00
|
|
|
return (ENOMEM);
|
2002-02-13 16:11:36 +00:00
|
|
|
intrptr = intrmapptr = intrclrptr = 0;
|
|
|
|
intrmap = 0;
|
2006-06-08 21:02:25 +00:00
|
|
|
vec = rman_get_start(ires);
|
2002-12-01 23:13:59 +00:00
|
|
|
inr = INTVEC(vec);
|
2002-12-01 23:30:26 +00:00
|
|
|
if ((inr & INTMAP_OBIO_MASK) == 0) {
|
2002-12-01 23:13:59 +00:00
|
|
|
/*
|
2005-04-17 11:28:41 +00:00
|
|
|
* We're in an SBus slot, register the map and clear
|
2002-12-01 23:13:59 +00:00
|
|
|
* intr registers.
|
|
|
|
*/
|
|
|
|
slot = INTSLOT(vec);
|
|
|
|
intrmapptr = SBR_SLOT0_INT_MAP + slot * 8;
|
|
|
|
intrclrptr = SBR_SLOT0_INT_CLR +
|
|
|
|
(slot * 8 * 8) + (INTPRI(vec) * 8);
|
|
|
|
/* Enable the interrupt, insert IGN. */
|
2005-05-19 14:47:31 +00:00
|
|
|
intrmap = inr | (sc->sc_ign << INTMAP_IGN_SHIFT);
|
2002-12-01 23:13:59 +00:00
|
|
|
} else {
|
|
|
|
intrptr = SBR_SCSI_INT_MAP;
|
|
|
|
/* Insert IGN */
|
2005-05-19 14:47:31 +00:00
|
|
|
inr |= sc->sc_ign << INTMAP_IGN_SHIFT;
|
2002-12-01 23:13:59 +00:00
|
|
|
for (i = 0; intrptr <= SBR_RESERVED_INT_MAP &&
|
2006-06-08 21:02:25 +00:00
|
|
|
INTVEC(intrmap = SYSIO_READ8(sc, intrptr)) != inr;
|
|
|
|
intrptr += 8, i++)
|
2002-12-01 23:13:59 +00:00
|
|
|
;
|
2006-06-08 21:02:25 +00:00
|
|
|
if (INTVEC(intrmap) == inr) {
|
2002-12-01 23:13:59 +00:00
|
|
|
/* Register the map and clear intr registers */
|
|
|
|
intrmapptr = intrptr;
|
|
|
|
intrclrptr = SBR_SCSI_INT_CLR + i * 8;
|
|
|
|
/* Enable the interrupt */
|
|
|
|
} else
|
2005-04-17 11:28:41 +00:00
|
|
|
panic("%s: IRQ not found!", __func__);
|
2002-12-01 23:13:59 +00:00
|
|
|
}
|
2002-02-13 16:11:36 +00:00
|
|
|
|
|
|
|
scl->scl_sc = sc;
|
|
|
|
scl->scl_arg = arg;
|
2007-06-06 22:19:23 +00:00
|
|
|
scl->scl_filter = filt;
|
|
|
|
scl->scl_handler = intr;
|
2002-02-13 16:11:36 +00:00
|
|
|
scl->scl_clr = intrclrptr;
|
|
|
|
/* Disable the interrupt while we fiddle with it */
|
2006-06-08 21:02:25 +00:00
|
|
|
SYSIO_WRITE8(sc, intrmapptr, intrmap & ~INTMAP_V);
|
2007-06-06 22:19:23 +00:00
|
|
|
error = BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags,
|
|
|
|
sbus_filter_stub, sbus_intr_stub, scl, cookiep);
|
2002-02-13 16:11:36 +00:00
|
|
|
if (error != 0) {
|
|
|
|
free(scl, M_DEVBUF);
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
scl->scl_cookie = *cookiep;
|
|
|
|
*cookiep = scl;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clear the interrupt, it might have been triggered before it was
|
|
|
|
* set up.
|
|
|
|
*/
|
2002-12-01 23:13:59 +00:00
|
|
|
SYSIO_WRITE8(sc, intrclrptr, 0);
|
2002-02-13 16:11:36 +00:00
|
|
|
/*
|
2002-12-01 23:30:26 +00:00
|
|
|
* Enable the interrupt and program the target module now we have the
|
|
|
|
* handler installed.
|
2002-02-13 16:11:36 +00:00
|
|
|
*/
|
2002-12-01 23:30:26 +00:00
|
|
|
SYSIO_WRITE8(sc, intrmapptr, INTMAP_ENABLE(intrmap, PCPU_GET(mid)));
|
2002-02-13 16:11:36 +00:00
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2005-11-22 16:39:44 +00:00
|
|
|
sbus_teardown_intr(device_t dev, device_t child, struct resource *vec,
|
|
|
|
void *cookie)
|
2002-02-13 16:11:36 +00:00
|
|
|
{
|
|
|
|
struct sbus_clr *scl;
|
|
|
|
int error;
|
|
|
|
|
|
|
|
scl = (struct sbus_clr *)cookie;
|
|
|
|
error = BUS_TEARDOWN_INTR(device_get_parent(dev), child, vec,
|
|
|
|
scl->scl_cookie);
|
|
|
|
/*
|
2005-04-17 11:28:41 +00:00
|
|
|
* Don't disable the interrupt for now, so that stray interrupts get
|
2002-02-13 16:11:36 +00:00
|
|
|
* detected...
|
|
|
|
*/
|
|
|
|
if (error != 0)
|
|
|
|
free(scl, M_DEVBUF);
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct resource *
|
|
|
|
sbus_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
|
|
|
u_long start, u_long end, u_long count, u_int flags)
|
|
|
|
{
|
|
|
|
struct sbus_softc *sc;
|
|
|
|
struct rman *rm;
|
|
|
|
struct resource *rv;
|
|
|
|
struct resource_list *rl;
|
|
|
|
struct resource_list_entry *rle;
|
2005-04-17 11:32:34 +00:00
|
|
|
device_t schild;
|
2002-02-13 16:11:36 +00:00
|
|
|
bus_space_handle_t bh;
|
|
|
|
bus_addr_t toffs;
|
|
|
|
bus_size_t tend;
|
2005-04-17 11:32:34 +00:00
|
|
|
int i, slot;
|
|
|
|
int isdefault, needactivate, passthrough;
|
2002-02-13 16:11:36 +00:00
|
|
|
|
2005-04-17 11:28:41 +00:00
|
|
|
isdefault = (start == 0UL && end == ~0UL);
|
|
|
|
needactivate = flags & RF_ACTIVE;
|
2005-04-17 11:32:34 +00:00
|
|
|
passthrough = (device_get_parent(child) != bus);
|
|
|
|
rle = NULL;
|
|
|
|
sc = device_get_softc(bus);
|
|
|
|
rl = BUS_GET_RESOURCE_LIST(bus, child);
|
2002-02-13 16:11:36 +00:00
|
|
|
switch (type) {
|
|
|
|
case SYS_RES_IRQ:
|
2005-04-17 11:32:34 +00:00
|
|
|
return (resource_list_alloc(rl, bus, child, type, rid, start,
|
|
|
|
end, count, flags));
|
2002-02-13 16:11:36 +00:00
|
|
|
case SYS_RES_MEMORY:
|
2005-04-17 11:32:34 +00:00
|
|
|
if (!passthrough) {
|
|
|
|
rle = resource_list_find(rl, type, *rid);
|
|
|
|
if (rle == NULL)
|
|
|
|
return (NULL);
|
|
|
|
if (rle->res != NULL)
|
|
|
|
panic("%s: resource entry is busy", __func__);
|
|
|
|
if (isdefault) {
|
|
|
|
start = rle->start;
|
|
|
|
count = ulmax(count, rle->count);
|
|
|
|
end = ulmax(rle->end, start + count - 1);
|
|
|
|
}
|
|
|
|
}
|
2002-02-13 16:11:36 +00:00
|
|
|
rm = NULL;
|
|
|
|
bh = toffs = tend = 0;
|
2005-04-17 11:32:34 +00:00
|
|
|
schild = child;
|
|
|
|
while (device_get_parent(schild) != bus)
|
|
|
|
schild = device_get_parent(child);
|
|
|
|
slot = sbus_get_slot(schild);
|
2002-02-13 16:11:36 +00:00
|
|
|
for (i = 0; i < sc->sc_nrange; i++) {
|
2005-04-17 11:32:34 +00:00
|
|
|
if (sc->sc_rd[i].rd_slot != slot ||
|
2002-02-13 16:11:36 +00:00
|
|
|
start < sc->sc_rd[i].rd_coffset ||
|
|
|
|
start > sc->sc_rd[i].rd_cend)
|
|
|
|
continue;
|
|
|
|
/* Disallow cross-range allocations. */
|
|
|
|
if (end > sc->sc_rd[i].rd_cend)
|
|
|
|
return (NULL);
|
|
|
|
/* We've found the connection to the parent bus */
|
|
|
|
toffs = start - sc->sc_rd[i].rd_coffset;
|
|
|
|
tend = end - sc->sc_rd[i].rd_coffset;
|
|
|
|
rm = &sc->sc_rd[i].rd_rman;
|
|
|
|
bh = sc->sc_rd[i].rd_bushandle;
|
2006-06-08 21:02:25 +00:00
|
|
|
break;
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
2006-06-08 21:02:25 +00:00
|
|
|
if (rm == NULL)
|
2002-02-13 16:11:36 +00:00
|
|
|
return (NULL);
|
|
|
|
flags &= ~RF_ACTIVE;
|
|
|
|
rv = rman_reserve_resource(rm, toffs, tend, count, flags,
|
|
|
|
child);
|
|
|
|
if (rv == NULL)
|
|
|
|
return (NULL);
|
2006-04-20 04:20:41 +00:00
|
|
|
rman_set_rid(rv, *rid);
|
2002-02-13 16:11:36 +00:00
|
|
|
rman_set_bustag(rv, sc->sc_cbustag);
|
|
|
|
rman_set_bushandle(rv, bh + rman_get_start(rv));
|
|
|
|
if (needactivate) {
|
|
|
|
if (bus_activate_resource(child, type, *rid, rv)) {
|
|
|
|
rman_release_resource(rv);
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
}
|
2005-04-17 11:32:34 +00:00
|
|
|
if (!passthrough)
|
|
|
|
rle->res = rv;
|
|
|
|
return (rv);
|
2002-02-13 16:11:36 +00:00
|
|
|
default:
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sbus_activate_resource(device_t bus, device_t child, int type, int rid,
|
|
|
|
struct resource *r)
|
|
|
|
{
|
2006-06-08 21:02:25 +00:00
|
|
|
void *p;
|
|
|
|
int error;
|
2002-02-13 16:11:36 +00:00
|
|
|
|
2003-01-06 16:36:05 +00:00
|
|
|
if (type == SYS_RES_IRQ) {
|
|
|
|
return (BUS_ACTIVATE_RESOURCE(device_get_parent(bus),
|
|
|
|
child, type, rid, r));
|
|
|
|
}
|
2006-06-08 21:02:25 +00:00
|
|
|
if (type == SYS_RES_MEMORY) {
|
|
|
|
/*
|
|
|
|
* Need to memory-map the device space, as some drivers depend
|
|
|
|
* on the virtual address being set and useable.
|
|
|
|
*/
|
|
|
|
error = sparc64_bus_mem_map(rman_get_bustag(r),
|
|
|
|
rman_get_bushandle(r), rman_get_size(r), 0, 0, &p);
|
|
|
|
if (error != 0)
|
|
|
|
return (error);
|
|
|
|
rman_set_virtual(r, p);
|
|
|
|
}
|
2002-02-13 16:11:36 +00:00
|
|
|
return (rman_activate_resource(r));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sbus_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
|
|
|
struct resource *r)
|
|
|
|
{
|
|
|
|
|
2003-01-06 16:36:05 +00:00
|
|
|
if (type == SYS_RES_IRQ) {
|
|
|
|
return (BUS_DEACTIVATE_RESOURCE(device_get_parent(bus),
|
|
|
|
child, type, rid, r));
|
|
|
|
}
|
2006-06-08 21:02:25 +00:00
|
|
|
if (type == SYS_RES_MEMORY) {
|
|
|
|
sparc64_bus_mem_unmap(rman_get_virtual(r), rman_get_size(r));
|
|
|
|
rman_set_virtual(r, NULL);
|
|
|
|
}
|
2002-02-13 16:11:36 +00:00
|
|
|
return (rman_deactivate_resource(r));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
sbus_release_resource(device_t bus, device_t child, int type, int rid,
|
|
|
|
struct resource *r)
|
|
|
|
{
|
2005-04-17 11:32:34 +00:00
|
|
|
struct resource_list *rl;
|
2003-01-06 16:36:05 +00:00
|
|
|
struct resource_list_entry *rle;
|
2005-04-17 11:32:34 +00:00
|
|
|
int error, passthrough;
|
2002-02-13 16:11:36 +00:00
|
|
|
|
2005-04-17 11:32:34 +00:00
|
|
|
passthrough = (device_get_parent(child) != bus);
|
|
|
|
rl = BUS_GET_RESOURCE_LIST(bus, child);
|
2002-02-13 16:11:36 +00:00
|
|
|
if (type == SYS_RES_IRQ)
|
2005-04-17 11:32:34 +00:00
|
|
|
return (resource_list_release(rl, bus, child, type, rid, r));
|
|
|
|
if ((rman_get_flags(r) & RF_ACTIVE) != 0) {
|
|
|
|
error = bus_deactivate_resource(child, type, rid, r);
|
2003-01-06 16:36:05 +00:00
|
|
|
if (error != 0)
|
|
|
|
return (error);
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
2005-04-17 11:32:34 +00:00
|
|
|
error = rman_release_resource(r);
|
|
|
|
if (error != 0 || passthrough)
|
2003-01-06 16:36:05 +00:00
|
|
|
return (error);
|
2005-04-17 11:32:34 +00:00
|
|
|
rle = resource_list_find(rl, type, rid);
|
2003-01-06 16:36:05 +00:00
|
|
|
if (rle == NULL)
|
2005-04-17 11:28:41 +00:00
|
|
|
panic("%s: cannot find resource", __func__);
|
2003-01-06 16:36:05 +00:00
|
|
|
if (rle->res == NULL)
|
2005-04-17 11:28:41 +00:00
|
|
|
panic("%s: resource entry is not busy", __func__);
|
2003-01-06 16:36:05 +00:00
|
|
|
rle->res = NULL;
|
|
|
|
return (0);
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
|
|
|
|
Rototill the sparc64 nexus(4) (actually this brings in the code the
sun4v nexus(4) in turn is based on):
o Change nexus(4) to manage the resources of its children so the
respective device drivers don't need to figure them out of OFW
themselves.
o Change nexus(4) to provide the ofw_bus KOBJ interface instead of
using IVARs for supplying the OFW node and the subset of standard
properties of its children. Together with the previous change this
also allows to fully take advantage of newbus in that drivers like
fhc(4), which attach on multiple parent busses, no longer require
different bus front-ends as obtaining the OFW node and properties
as well as resource allocation works the same for all supported
busses. As such this change also is part 4/4 of allowing creator(4)
to work in USIII-based machines as it allows this driver to attach
on both nexus(4) and upa(4). On the other hand removing these IVARs
breaks API compatibility with the powerpc nexus(4) but which isn't
that bad as a) sparc64 currently doesn't share any device driver
hanging off of nexus(4) with powerpc and b) they were no longer
compatible regarding OFW-related extensions at the pci(4) level
since quite some time.
o Provide bus_get_dma_tag methods in nexus(4) and its children in
order to handle DMA tags in a hierarchical way and get rid of the
sparc64_root_dma_tag kludge. Together with the previous two items
this changes also allows to completely get rid of the nexus(4)
IVAR interface. It also includes:
- pushing the constraints previously specified by the nexus_dmatag
down into the DMA tags of psycho(4) and sbus(4) as it's their
IOMMUs which induce these restrictions (and nothing at the
nexus(4) or anything that would warrant specifying them there),
- fixing some obviously wrong constraints of the psycho(4) and
sbus(4) DMA tags, which happened to not actually be used with
the sparc64_root_dma_tag kludge in place and therefore didn't
cause problems so far,
- replacing magic constants for constraints with macros as far
as it is obvious as to where they come from.
This doesn't include taking advantage of the newbus way to get
the parent DMA tags implemented by this change in order to divorce
the IOTSBs of the PCI and SBus IOMMUs or for implementing the
workaround for the DMA sync bug in Sabre (and Tomatillo) bridges,
yet, though.
o Get rid of the notion that nexus(4) (mostly) reflects an UPA bus
by replacing ofw_upa.h and with ofw_nexus.h (which was repo-copied
from ofw_upa.h) and renaming its content, which actually applies to
all of Fireplane/Safari, JBus and UPA (in the host bus case), as
appropriate.
o Just use M_DEVBUF instead of a separate M_NEXUS malloc type for
allocating the device info for the children of nexus(4). This is
done in order to not need to export M_NEXUS when deriving drivers
for subordinate busses from the nexus(4) class.
o Use the DEFINE_CLASS_0() macro to declare the nexus(4) driver so
we can derive subclasses from it.
o Const'ify the nexus_excl_name and nexus_excl_type arrays as well
as add 'associations' and 'rsc', which are pseudo-devices without
resources and therefore of no real interest for nexus(4), to the
former.
o Let the nexus(4) device memory rman manage the entire 64-bit address
space instead of just the UPA_MEMSTART to UPA_MEMEND subregion as
Fireplane/Safari- and JBus-based machines use multiple ranges,
which can't be as easily divided as in the case of UPA (limiting
the address space only served for sanity checking anyway).
o Use M_WAITOK instead of M_NOWAIT when allocating the device info
for children of nexus(4) in order to give one less opportunity
for adding devices to nexus(4) to fail.
o While adapting the drivers affected by the above nexus(4) changes,
change them to take advantage of rman_get_rid() instead of caching
the RIDs assigned to allocated resources, now that the RIDs of
resources are correctly set.
o In iommu(4) and nexus(4) replace hard-coded functions names, which
actually became outdated in several places, in panic strings and
status massages with __func__. [1]
o Use driver_filter_t in prototypes where appropriate.
o Add my copyright to creator(4), fhc(4), nexus(4), psycho(4) and
sbus(4) as I changed considerable amounts of these drivers as well
as added a bunch of new features, workarounds for silicon bugs etc.
o Fix some white space nits.
Due to lack of access to Exx00 hardware, these changes, i.e. central(4)
and fhc(4), couldn't be runtime tested on such a machine. Exx00 are
currently reported to panic before trying to attach nexus(4) anyway
though.
PR: 76052 [1]
Approved by: re (kensmith)
2007-03-07 21:13:51 +00:00
|
|
|
static bus_dma_tag_t
|
|
|
|
sbus_get_dma_tag(device_t bus, device_t child)
|
|
|
|
{
|
|
|
|
struct sbus_softc *sc;
|
|
|
|
|
|
|
|
sc = device_get_softc(bus);
|
|
|
|
return (sc->sc_cdmatag);
|
|
|
|
}
|
|
|
|
|
2005-11-22 16:39:44 +00:00
|
|
|
static const struct ofw_bus_devinfo *
|
|
|
|
sbus_get_devinfo(device_t bus, device_t child)
|
|
|
|
{
|
|
|
|
struct sbus_devinfo *sdi;
|
|
|
|
|
|
|
|
sdi = device_get_ivars(child);
|
|
|
|
return (&sdi->sdi_obdinfo);
|
|
|
|
}
|
|
|
|
|
2002-02-13 16:11:36 +00:00
|
|
|
/*
|
|
|
|
* Handle an overtemp situation.
|
|
|
|
*
|
|
|
|
* SPARCs have temperature sensors which generate interrupts
|
|
|
|
* if the machine's temperature exceeds a certain threshold.
|
|
|
|
* This handles the interrupt and powers off the machine.
|
|
|
|
* The same needs to be done to PCI controller drivers.
|
|
|
|
*/
|
2007-02-23 12:19:07 +00:00
|
|
|
static int
|
2002-02-13 16:11:36 +00:00
|
|
|
sbus_overtemp(void *arg)
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("DANGER: OVER TEMPERATURE detected\nShutting down NOW.\n");
|
|
|
|
shutdown_nice(RB_POWEROFF);
|
2007-02-23 12:19:07 +00:00
|
|
|
return (FILTER_HANDLED);
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Try to shut down in time in case of power failure. */
|
2007-02-23 12:19:07 +00:00
|
|
|
static int
|
2002-02-13 16:11:36 +00:00
|
|
|
sbus_pwrfail(void *arg)
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("Power failure detected\nShutting down NOW.\n");
|
|
|
|
shutdown_nice(0);
|
2007-02-23 12:19:07 +00:00
|
|
|
return (FILTER_HANDLED);
|
2002-02-13 16:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bus_space_tag_t
|
|
|
|
sbus_alloc_bustag(struct sbus_softc *sc)
|
|
|
|
{
|
|
|
|
bus_space_tag_t sbt;
|
|
|
|
|
|
|
|
sbt = (bus_space_tag_t)malloc(sizeof(struct bus_space_tag), M_DEVBUF,
|
|
|
|
M_NOWAIT | M_ZERO);
|
|
|
|
if (sbt == NULL)
|
2005-04-17 11:28:41 +00:00
|
|
|
panic("%s: out of memory", __func__);
|
2002-02-13 16:11:36 +00:00
|
|
|
|
2003-01-06 19:43:10 +00:00
|
|
|
sbt->bst_cookie = sc;
|
|
|
|
sbt->bst_parent = sc->sc_bustag;
|
|
|
|
sbt->bst_type = SBUS_BUS_SPACE;
|
2002-02-13 16:11:36 +00:00
|
|
|
return (sbt);
|
|
|
|
}
|
- Introduce an ofw_bus kobj-interface for retrieving the OFW node and a
subset ("compatible", "device_type", "model" and "name") of the standard
properties in drivers for devices on Open Firmware supported busses. The
standard properties "reg", "interrupts" und "address" are not covered by
this interface because they are only of interest in the respective bridge
code. There's a remaining standard property "status" which is unclear how
to support properly but which also isn't used in FreeBSD at present.
This ofw_bus kobj-interface allows to replace the various (ebus_get_node(),
ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type()
vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one.
This in turn allows to simplify and remove code-duplication in drivers for
devices that can hang off of more than one OFW supported bus.
- Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the
drivers for their children to use the ofw_bus kobj-interface. The IVAR-
interfaces of the Central, EBus and FHC are entirely replaced by this. The
PCI bus driver used its own kobj-interface and now also uses the ofw_bus
one. The IVARs special to the SBus, e.g. for retrieving the burst size,
remain.
Beware: this causes an ABI-breakage for modules of drivers which used the
IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be
recompiled.
The style-inconsistencies introduced in some of the bus drivers will be
fixed by tmm@ in a generic clean-up of the respective drivers later (he
requested to add the changes in the "new" style).
- Convert the powerpc MacIO bus driver and the drivers for its children to
use the ofw_bus kobj-interface. This invloves removing the IVARs related
to the "reg" property which were unused and a leftover from the NetBSD
origini of the code. There's no ABI-breakage caused by this because none
of these driver are currently built as modules.
There are other powerpc bus drivers which can be converted to the ofw_bus
kobj-interface, e.g. the PCI bus driver, which should be done together
with converting powerpc to use the OFW PCI code from sparc64.
- Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take
advantage of the ofw_bus kobj-interface and simplify them a bit.
Reviewed by: grehan, tmm
Approved by: re (scottl)
Discussed with: tmm
Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
2004-08-12 17:41:33 +00:00
|
|
|
|
2005-11-22 16:39:44 +00:00
|
|
|
static int
|
|
|
|
sbus_print_res(struct sbus_devinfo *sdi)
|
- Introduce an ofw_bus kobj-interface for retrieving the OFW node and a
subset ("compatible", "device_type", "model" and "name") of the standard
properties in drivers for devices on Open Firmware supported busses. The
standard properties "reg", "interrupts" und "address" are not covered by
this interface because they are only of interest in the respective bridge
code. There's a remaining standard property "status" which is unclear how
to support properly but which also isn't used in FreeBSD at present.
This ofw_bus kobj-interface allows to replace the various (ebus_get_node(),
ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type()
vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one.
This in turn allows to simplify and remove code-duplication in drivers for
devices that can hang off of more than one OFW supported bus.
- Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the
drivers for their children to use the ofw_bus kobj-interface. The IVAR-
interfaces of the Central, EBus and FHC are entirely replaced by this. The
PCI bus driver used its own kobj-interface and now also uses the ofw_bus
one. The IVARs special to the SBus, e.g. for retrieving the burst size,
remain.
Beware: this causes an ABI-breakage for modules of drivers which used the
IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be
recompiled.
The style-inconsistencies introduced in some of the bus drivers will be
fixed by tmm@ in a generic clean-up of the respective drivers later (he
requested to add the changes in the "new" style).
- Convert the powerpc MacIO bus driver and the drivers for its children to
use the ofw_bus kobj-interface. This invloves removing the IVARs related
to the "reg" property which were unused and a leftover from the NetBSD
origini of the code. There's no ABI-breakage caused by this because none
of these driver are currently built as modules.
There are other powerpc bus drivers which can be converted to the ofw_bus
kobj-interface, e.g. the PCI bus driver, which should be done together
with converting powerpc to use the OFW PCI code from sparc64.
- Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take
advantage of the ofw_bus kobj-interface and simplify them a bit.
Reviewed by: grehan, tmm
Approved by: re (scottl)
Discussed with: tmm
Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
2004-08-12 17:41:33 +00:00
|
|
|
{
|
2005-11-22 16:39:44 +00:00
|
|
|
int rv;
|
- Introduce an ofw_bus kobj-interface for retrieving the OFW node and a
subset ("compatible", "device_type", "model" and "name") of the standard
properties in drivers for devices on Open Firmware supported busses. The
standard properties "reg", "interrupts" und "address" are not covered by
this interface because they are only of interest in the respective bridge
code. There's a remaining standard property "status" which is unclear how
to support properly but which also isn't used in FreeBSD at present.
This ofw_bus kobj-interface allows to replace the various (ebus_get_node(),
ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type()
vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one.
This in turn allows to simplify and remove code-duplication in drivers for
devices that can hang off of more than one OFW supported bus.
- Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the
drivers for their children to use the ofw_bus kobj-interface. The IVAR-
interfaces of the Central, EBus and FHC are entirely replaced by this. The
PCI bus driver used its own kobj-interface and now also uses the ofw_bus
one. The IVARs special to the SBus, e.g. for retrieving the burst size,
remain.
Beware: this causes an ABI-breakage for modules of drivers which used the
IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be
recompiled.
The style-inconsistencies introduced in some of the bus drivers will be
fixed by tmm@ in a generic clean-up of the respective drivers later (he
requested to add the changes in the "new" style).
- Convert the powerpc MacIO bus driver and the drivers for its children to
use the ofw_bus kobj-interface. This invloves removing the IVARs related
to the "reg" property which were unused and a leftover from the NetBSD
origini of the code. There's no ABI-breakage caused by this because none
of these driver are currently built as modules.
There are other powerpc bus drivers which can be converted to the ofw_bus
kobj-interface, e.g. the PCI bus driver, which should be done together
with converting powerpc to use the OFW PCI code from sparc64.
- Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take
advantage of the ofw_bus kobj-interface and simplify them a bit.
Reviewed by: grehan, tmm
Approved by: re (scottl)
Discussed with: tmm
Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
2004-08-12 17:41:33 +00:00
|
|
|
|
2005-11-22 16:39:44 +00:00
|
|
|
rv = 0;
|
|
|
|
rv += resource_list_print_type(&sdi->sdi_rl, "mem", SYS_RES_MEMORY,
|
|
|
|
"%#lx");
|
|
|
|
rv += resource_list_print_type(&sdi->sdi_rl, "irq", SYS_RES_IRQ,
|
|
|
|
"%ld");
|
|
|
|
return (rv);
|
- Introduce an ofw_bus kobj-interface for retrieving the OFW node and a
subset ("compatible", "device_type", "model" and "name") of the standard
properties in drivers for devices on Open Firmware supported busses. The
standard properties "reg", "interrupts" und "address" are not covered by
this interface because they are only of interest in the respective bridge
code. There's a remaining standard property "status" which is unclear how
to support properly but which also isn't used in FreeBSD at present.
This ofw_bus kobj-interface allows to replace the various (ebus_get_node(),
ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type()
vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one.
This in turn allows to simplify and remove code-duplication in drivers for
devices that can hang off of more than one OFW supported bus.
- Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the
drivers for their children to use the ofw_bus kobj-interface. The IVAR-
interfaces of the Central, EBus and FHC are entirely replaced by this. The
PCI bus driver used its own kobj-interface and now also uses the ofw_bus
one. The IVARs special to the SBus, e.g. for retrieving the burst size,
remain.
Beware: this causes an ABI-breakage for modules of drivers which used the
IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be
recompiled.
The style-inconsistencies introduced in some of the bus drivers will be
fixed by tmm@ in a generic clean-up of the respective drivers later (he
requested to add the changes in the "new" style).
- Convert the powerpc MacIO bus driver and the drivers for its children to
use the ofw_bus kobj-interface. This invloves removing the IVARs related
to the "reg" property which were unused and a leftover from the NetBSD
origini of the code. There's no ABI-breakage caused by this because none
of these driver are currently built as modules.
There are other powerpc bus drivers which can be converted to the ofw_bus
kobj-interface, e.g. the PCI bus driver, which should be done together
with converting powerpc to use the OFW PCI code from sparc64.
- Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take
advantage of the ofw_bus kobj-interface and simplify them a bit.
Reviewed by: grehan, tmm
Approved by: re (scottl)
Discussed with: tmm
Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
2004-08-12 17:41:33 +00:00
|
|
|
}
|