Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mac68k Fixes and changes from Hauke Fath <hauke@Esp...
details: https://anonhg.NetBSD.org/src/rev/70844701a793
branches: trunk
changeset: 525605:70844701a793
user: briggs <briggs%NetBSD.org@localhost>
date: Sat Apr 13 17:49:41 2002 +0000
description:
Fixes and changes from Hauke Fath <hauke%Espresso.Rhein-Neckar.DE@localhost>.
* Clean up after briggs@ changes to support bus_dma.
* Add support for reading sMemory resources from nubus cards.
* Add support for old cards with only the board rsrc (NatSemi NB-GPIB, e.g.)
* Add a few more card identifiers.
diffstat:
sys/arch/mac68k/mac68k/mainbus.c | 6 +-
sys/arch/mac68k/nubus/nubus.c | 91 ++++++++++++++++++++++++++++++++++++---
sys/arch/mac68k/nubus/nubus.h | 70 +++++++++++++++++++++++++++++-
3 files changed, 152 insertions(+), 15 deletions(-)
diffs (truncated from 335 to 300 lines):
diff -r aa1df9e2d4fa -r 70844701a793 sys/arch/mac68k/mac68k/mainbus.c
--- a/sys/arch/mac68k/mac68k/mainbus.c Sat Apr 13 17:48:10 2002 +0000
+++ b/sys/arch/mac68k/mac68k/mainbus.c Sat Apr 13 17:49:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.10 2002/04/10 04:38:49 briggs Exp $ */
+/* $NetBSD: mainbus.c,v 1.11 2002/04/13 17:49:41 briggs Exp $ */
/*
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -110,7 +110,7 @@
struct cfdata *cf;
void *aux;
{
- if ((*cf->cf_attach->ca_match)(parent, cf, NULL) > 0)
- config_attach(parent, cf, NULL, NULL);
+ if ((*cf->cf_attach->ca_match)(parent, cf, aux) > 0)
+ config_attach(parent, cf, aux, NULL);
return 0;
}
diff -r aa1df9e2d4fa -r 70844701a793 sys/arch/mac68k/nubus/nubus.c
--- a/sys/arch/mac68k/nubus/nubus.c Sat Apr 13 17:48:10 2002 +0000
+++ b/sys/arch/mac68k/nubus/nubus.c Sat Apr 13 17:49:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nubus.c,v 1.52 2002/04/10 04:38:50 briggs Exp $ */
+/* $NetBSD: nubus.c,v 1.53 2002/04/13 17:49:41 briggs Exp $ */
/*
* Copyright (c) 1995, 1996 Allen Briggs. All rights reserved.
@@ -31,6 +31,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/malloc.h>
#include <sys/device.h>
#include <sys/buf.h>
#include <sys/conf.h>
@@ -50,7 +51,7 @@
#define NDB_PROBE 0x1
#define NDB_FOLLOW 0x2
#define NDB_ARITH 0x4
-static int nubus_debug = 0 /* | NDB_PROBE */;
+static int nubus_debug = 0 /* | NDB_PROBE | NDB_FOLLOW | NDB_ARITH */ ;
#endif
static int nubus_print __P((void *, const char *));
@@ -99,7 +100,7 @@
void *aux;
{
struct nubus_attach_args na_args;
- struct mainbus_attach_args *mba = (struct mainbus_attach_args *) mba;
+ struct mainbus_attach_args *mba;
bus_space_tag_t bst;
bus_space_handle_t bsh;
nubus_slot fmtblock;
@@ -110,6 +111,9 @@
int i, rsrcid;
u_int8_t lanes;
+ mba = aux;
+ KASSERT(NULL != mba->mba_dmat);
+
printf("\n");
for (i = NUBUS_MIN_SLOT; i <= NUBUS_MAX_SLOT; i++) {
@@ -148,10 +152,16 @@
* of video resources given to us by the booter. If that
* doesn't work either, take the first resource following
* the board resource.
+ * If we only find a board resource, report that.
+ * There are cards that do not have anything else; their
+ * driver then has to match on the board resource and
+ * the card name.
*/
if (nubus_find_rsrc(bst, bsh,
&fmtblock, &dir, rsrcid, &dirent) <= 0) {
if ((rsrcid = nubus_video_resource(i)) == -1) {
+ int has_board_rsrc = 0;
+
/*
* Since nubus_find_rsrc failed, the directory
* is back at its base.
@@ -161,21 +171,27 @@
/*
* All nubus cards should have a board
* resource, but be sure that's what it
- * is before we skip it.
+ * is before we skip it, and note the fact.
*/
rsrcid = nubus_read_1(bst, bsh,
lanes, entry);
- if (rsrcid == 0x1)
+ if (rsrcid == 0x1) {
+ has_board_rsrc = 1;
entry = nubus_adjust_ptr(lanes,
dir.curr_ent, 4);
-
+ }
rsrcid = nubus_read_1(bst, bsh, lanes, entry);
+ /* end of chain? */
+ if (rsrcid == 0xff) {
+ if (!has_board_rsrc)
+ goto notfound;
+ else
+ rsrcid = 0x01;
+ }
#ifdef DEBUG
if (nubus_debug & NDB_FOLLOW)
printf("\tUsing rsrc 0x%x.\n", rsrcid);
#endif
- if (rsrcid == 0xff) /* end of chain */
- goto notfound;
}
/*
* Try to find the resource passed by the booter
@@ -719,6 +735,63 @@
return 0;
}
+/*
+ * Get list of address ranges for an sMemory resource
+ * -> DC&D, p.171
+ */
+int
+nubus_get_smem_addr_rangelist(bst, bsh, fmt, dirent, data_return)
+ bus_space_tag_t bst;
+ bus_space_handle_t bsh;
+ nubus_slot *fmt;
+ nubus_dirent *dirent;
+ caddr_t data_return;
+{
+ u_long loc;
+ u_int8_t lanes = fmt->bytelanes;
+ long blocklen;
+ caddr_t blocklist;
+
+#ifdef DEBUG
+ if (nubus_debug & NDB_FOLLOW)
+ printf("nubus_get_smem_addr_rangelist(%p, %p, %p).\n",
+ fmt, dirent, data_return);
+#endif
+ if ((loc = dirent->offset) & 0x800000) {
+ loc |= 0xff000000;
+ }
+ loc = nubus_adjust_ptr(lanes, dirent->myloc, loc);
+
+ /* Obtain the block length from the head of the list */
+ blocklen = nubus_read_4(bst, bsh, lanes, loc);
+
+ /*
+ * malloc a block of (blocklen) bytes
+ * caller must recycle block after use
+ */
+ MALLOC(blocklist,caddr_t,blocklen,M_TEMP,M_WAITOK);
+
+ /* read ((blocklen - 4) / 8) (length,offset) pairs into block */
+ nubus_get_ind_data(bst, bsh, fmt, dirent, blocklist, blocklen);
+#ifdef DEBUG
+ if (nubus_debug & NDB_FOLLOW) {
+ int ii;
+ nubus_smem_rangelist *rlist;
+
+ rlist = (nubus_smem_rangelist *)blocklist;
+ printf("\tblock@%p, len 0x0%X\n", rlist, rlist->length);
+
+ for (ii=0; ii < ((blocklen - 4) / 8); ii++) {
+ printf("\tRange %d: base addr 0x%X [0x%X]\n", ii,
+ rlist->range[ii].offset, rlist->range[ii].length);
+ }
+ }
+#endif
+ *(caddr_t *)data_return = blocklist;
+
+ return 1;
+}
+
static char *huh = "???";
char *
@@ -794,7 +867,7 @@
bus_space_handle_t sc_bsh;
if (bus_space_map(bst, NUBUS_SLOT2PA(slotno), NBMEMSIZE, 0, &sc_bsh)) {
- printf("nubus_scan_slot: failed to map slot %d\n", slotno);
+ printf("nubus_scan_slot: failed to map slot %x\n", slotno);
return;
}
diff -r aa1df9e2d4fa -r 70844701a793 sys/arch/mac68k/nubus/nubus.h
--- a/sys/arch/mac68k/nubus/nubus.h Sat Apr 13 17:48:10 2002 +0000
+++ b/sys/arch/mac68k/nubus/nubus.h Sat Apr 13 17:49:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nubus.h,v 1.56 2002/04/10 04:38:50 briggs Exp $ */
+/* $NetBSD: nubus.h,v 1.57 2002/04/13 17:49:41 briggs Exp $ */
/*
* Copyright (c) 1995 Allen Briggs. All rights reserved.
@@ -46,18 +46,24 @@
#include <machine/cpu.h>
#define NUBUS_CATEGORY_BOARD 0x0001
+#define NUBUS_TYPE_BOARD 0x0000 /* We want these for minimal board */
+#define NUBUS_DRSW_BOARD 0x0000 /* ROMs that come with nothing but */
+#define NUBUS_DRHW_BOARD 0x0000 /* a board resource (old NI_GPIB) */
#define NUBUS_CATEGORY_DISPLAY 0x0003
#define NUBUS_TYPE_VIDEO 0x0001
#define NUBUS_TYPE_LCD 0x0002
#define NUBUS_DRSW_APPLE 0x0001
#define NUBUS_DRHW_TFB 0x0001 /* Apple Toby Frame Buffer */
+#define NUBUS_DRHW_BAER 0x0002 /* Formac Baers color card */
#define NUBUS_DRHW_WVC 0x0006 /* Apple Workstation Video Card */
#define NUBUS_DRHW_COLORMAX 0x0007 /* Sigma Designs ColorMax */
#define NUBUS_DRHW_SE30 0x0009 /* Apple SE/30 pseudo-slot video */
#define NUBUS_DRHW_M2HRVC 0x0013 /* Apple Mac II High-Res Video Card */
#define NUBUS_DRHW_PVC 0x0017 /* Apple Mac II Portrait Video Card */
#define NUBUS_DRHW_MDC 0x0019 /* Apple Macintosh Display Card */
+#define NUBUS_DRHW_VSC 0x0020 /* Apple Macintosh Duo MiniDock */
+#define NUBUS_DRHW_JET 0x0029 /* Apple Macintosh DuoDock II */
#define NUBUS_DRHW_BOOGIE 0x002b /* Apple Macintosh 24AC Video Card */
#define NUBUS_DRHW_SUPRGFX 0x0105 /* SuperMac GFX */
#define NUBUS_DRHW_FORMAC 0x013A /* Formac color card II */
@@ -115,8 +121,11 @@
#define NUBUS_CATEGORY_COMMUNICATIONS 0x0006
#define NUBUS_TYPE_RS232 0x0002
+#define NUBUS_TYPE_IEEE488 0x0004
#define NUBUS_DRSW_HDS 0x0102
-#define NUBUS_DRHW_HDS 0x0102
+#define NUBUS_DRSW_NI488 0x0104
+#define NUBUS_DRHW_HDS 0x0102 /* Creative Solutions Hustler serial */
+#define NUBUS_DRHW_NB_GPIB_TNT 0x0102 /* NatInst NB-GPIB/TNT */
#define NUBUS_CATEGORY_MEMORY 0x0009 /* Also KanjiTalk Font Card? */
#define NUBUS_TYPE_RAMCACHE 0x010C /* From Apple PDS card */
@@ -135,9 +144,28 @@
#define NUBUS_DRHW_AWGSPDS_SCSI 0x0100
#define NUBUS_DRSW_PLI 0x0108
#define NUBUS_DRHW_PLI 0x0100
-#define NUBUS_DRSW_FWB 0x010C
+#define NUBUS_TYPE_SCSIW 0x000B /* FWB JackHammer Fast/Wide */
+#define NUBUS_DRSW_FWB 0x0001 /* XXX Allen says 0x010C */
#define NUBUS_DRHW_FWB 0x0100
+#define NUBUS_CATEGORY_DOCK 0x0020
+#define NUBUS_TYPE_STATION 0x0001
+#define NUBUS_TYPE_DESK 0x0002
+#define NUBUS_TYPE_TRAVEL 0x0003
+/* #define NUBUS_DRSW_APPLE 0x0001 */
+#define NUBUS_DRSW_NEWERTECH 0x0101
+
+/* Station */
+#define NUBUS_DRHW_DUODOCK 0x0001 /* Apple DuoDock */
+#define NUBUS_DRHW_DUODOCKII 0x0002 /* Apple DuoDock II */
+
+/* Desk */
+#define NUBUS_DRHW_DUOMINIDOCK 0x0001 /* Apple Duo MiniDock */
+
+/* Travel */
+#define NUBUS_DRHW_MICROSCSI 0x0100 /* Newer Technology SCSI MicroDock */
+
+
/*
* This is the same as Apple's Format Block for a card, with the
* addition of a pointer to the base of the NuBUS slot.
@@ -210,6 +238,29 @@
u_int32_t data;
} nubus_rsrc;
+/*
+ * On a NuBus master, an sMemory resource (this is a second-level
+ * resource list) holds a list of address ranges for onboard
+ * RAM, ROM and IO resources.
+ */
+typedef struct _nubus_smem_range {
+ u_int32_t length;
+ u_int32_t offset;
+} nubus_smem_range;
+
+/*
+ * XXX This is mapped on the range list we get back out of the sMemory
+ * resources. I would have liked the range[] array to be of undefined
+ * size but the compiler does not let me.
+ * Maybe it's just too much grief, and we should work with an array
+ * of u_int32_t.
+ */
+typedef struct _nubus_smem_rangelist {
+ u_int32_t length;
+ nubus_smem_range range[1];
+} nubus_smem_rangelist;
+
+
/* Resource IDs for NUBUS_CATEGORY_* (All) */
#define NUBUS_RSRC_TYPE 0x01 /* Type (required) */
#define NUBUS_RSRC_NAME 0x02 /* Name (required) */
@@ -226,6 +277,7 @@
#define NUBUS_RSRC_CICN 0x0F /* Color icon */
#define NUBUS_RSRC_ICL8 0x10 /* 8-bit icon data */
#define NUBUS_RSRC_ICL4 0x11 /* 4-bit icon data */
+#define NUBUS_RSRC_SMEMORY 0x6C /* Resource list for master */
Home |
Main Index |
Thread Index |
Old Index