PERFORCE change 54470 for review
Juli Mallett
jmallett at FreeBSD.org
Wed Jun 9 09:48:13 GMT 2004
http://perforce.freebsd.org/chv.cgi?CH=54470
Change 54470 by jmallett at jmallett_oingo on 2004/06/09 09:47:23
Swing at using hints to figure out which port hpc is at.
Affected files ...
.. //depot/projects/mips/sys/mips/conf/INDY#9 edit
.. //depot/projects/mips/sys/mips/conf/INDY.hints#1 add
.. //depot/projects/mips/sys/mips/sgimips/hpc/hpc.c#2 edit
Differences ...
==== //depot/projects/mips/sys/mips/conf/INDY#9 (text+ko) ====
@@ -8,6 +8,8 @@
ident INDY
maxusers 0
+hints "INDY.hints"
+
makeoptions MIPSOPTS=-mips3 #Build for a MIPS III
makeoptions TEXTADDR=0xA8069000 #Indy
==== //depot/projects/mips/sys/mips/sgimips/hpc/hpc.c#2 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $P4: //depot/projects/mips/sys/mips/sgimips/hpc/hpc.c#1 $
+ * $P4: //depot/projects/mips/sys/mips/sgimips/hpc/hpc.c#2 $
*/
#include <sys/cdefs.h>
@@ -60,40 +60,40 @@
{ 0, 0 }
};
+struct hpc_softc {
+ bus_space_tag_t sc_tag;
+ bus_space_handle_t sc_handle;
+};
+
static driver_t hpc_driver = {
- "hpc", hpc_methods, 1
+ "hpc", hpc_methods, sizeof (struct hpc_softc)
};
-#define HPC_READ_4(port, r) \
- bus_space_read_4(device_space_tag, (port), (r))
+#define HPC_READ_4(sc, r) \
+ bus_space_read_4((sc)->sc_tag, (sc)->sc_handle, (r))
-#define HPC_WRITE_4(port, r, v) \
- bus_space_write_4(device_space_tag, (port), (r), (v))
+#define HPC_WRITE_4(sc, r, v) \
+ bus_space_write_4((sc)->sc_tag, (sc)->sc_handle, (r), (v))
static int
hpc_probe(device_t dev)
{
- uint32_t port;
+ struct hpc_softc *sc;
+ long port;
+ int error;
+
+ sc = device_get_softc(dev);
switch (mach_type) {
case MACH_SGI_IP22:
device_set_desc(dev, "HPC3 Bus");
- /* XXX Need to go through hints here! */
- switch (device_get_unit(dev)) {
- case 0:
- port = 0x1fb80000;
- break;
- case 1:
- port = 0x1fb00000;
- break;
- case 2:
- port = 0x1f980000;
- break;
- default:
- return (ENXIO);
- }
- HPC_READ_4(port, 0);
- device_printf(dev, "port %#x\n", port);
+ error = resource_long_value(device_get_name(dev),
+ device_get_unit(dev),
+ "port", &port);
+ if (error != 0)
+ return (ENODEV);
+ sc->sc_tag = device_space_tag;
+ sc->sc_handle = port;
return (0);
default:
return (ENOENT);
@@ -103,6 +103,12 @@
static int
hpc_attach(device_t dev)
{
+ struct hpc_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ device_printf(dev, "port %#lx\n", (long)sc->sc_handle);
+
bus_generic_attach(dev);
return (0);
More information about the p4-projects
mailing list