#include <machine/cpu.h>
#define NUBUS_CATEGORY_BOARD 0x0001
#define NUBUS_TYPE_BOARD 0x0000
#define NUBUS_DRSW_BOARD 0x0000
#define NUBUS_DRHW_BOARD 0x0000
#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
#define NUBUS_DRHW_BAER 0x0002
#define NUBUS_DRHW_WVC 0x0006
#define NUBUS_DRHW_COLORMAX 0x0007
#define NUBUS_DRHW_SE30 0x0009
#define NUBUS_DRHW_M2HRVC 0x0013
#define NUBUS_DRHW_MVC 0x0014
#define NUBUS_DRHW_PVC 0x0017
#define NUBUS_DRHW_MDC 0x0019
#define NUBUS_DRHW_VSC 0x0020
#define NUBUS_DRHW_JET 0x0029
#define NUBUS_DRHW_BOOGIE 0x002b
#define NUBUS_DRHW_VILTRO340 0x0102
#define NUBUS_DRHW_SUPRGFX 0x0105
#define NUBUS_DRHW_RELAX200 0x0131
#define NUBUS_DRHW_FORMAC 0x013A
#define NUBUS_DRHW_CB264 0x013B
#define NUBUS_DRHW_MICRON 0x0146
#define NUBUS_DRHW_RADGSC 0x0153
#define NUBUS_DRHW_SPECTRM8 0x017b
#define NUBUS_DRHW_SPECTRUM 0x017c
#define NUBUS_DRHW_VIMAGE 0x026E
#define NUBUS_DRHW_CB364 0x026F
#define NUBUS_DRHW_LVIEW 0x0278
#define NUBUS_DRHW_RDCGX 0x027C
#define NUBUS_DRHW_RPC8 0x0291
#define NUBUS_DRHW_LAPIS 0x0292
#define NUBUS_DRHW_ROPS24LXI 0x02A0
#define NUBUS_DRHW_ROPSPPGT 0x02A5
#define NUBUS_DRHW_FUTURASX 0x02AE
#define NUBUS_DRHW_ROPS24XLTV 0x02B7
#define NUBUS_DRHW_THUNDER24 0x02CB
#define NUBUS_DRHW_ROPS24MXTV 0x03DF
#define NUBUS_DRHW_GVIMAGE 0x03FB
#define NUBUS_DRHW_RPC24XP 0x0406
#define NUBUS_DRHW_RPC24X 0x040A
#define NUBUS_DRHW_RPC8XJ 0x040B
#define NUBUS_DRHW_FIILX 0x0417
#define NUBUS_DRHW_FIISXDSP 0x042F
#define NUBUS_DRHW_MC2124NB 0x0462
#define NUBUS_DRHW_SAM768 0x10000
#define NUBUS_CATEGORY_NETWORK 0x0004
#define NUBUS_TYPE_ETHERNET 0x0001
#define NUBUS_DRSW_3COM 0x0000
#define NUBUS_DRSW_CABLETRON 0x0001
#define NUBUS_DRSW_GATOR 0x0103
#define NUBUS_DRSW_ASANTE 0x0104
#define NUBUS_DRSW_TECHWORKS 0x0109
#define NUBUS_DRSW_DAYNA 0x010B
#define NUBUS_DRSW_FARALLON 0x010C
#define NUBUS_DRSW_DAYNA2 0x0115
#define NUBUS_DRSW_FOCUS 0x011A
#define NUBUS_DRSW_ASANTEF 0x011D
#define NUBUS_DRSW_TFLLAN 0x011E
#define NUBUS_DRHW_INTERLAN 0x0100
#define NUBUS_DRHW_ASANTEF 0x0101
#define NUBUS_DRHW_KINETICS 0x0106
#define NUBUS_DRHW_CABLETRON 0x0109
#define NUBUS_DRHW_NUVOLINK 0x010B
#define NUBUS_DRHW_ASANTE_LC 0x010F
#define NUBUS_DRHW_SONIC 0x0110
#define NUBUS_DRHW_TECHWORKS 0x0112
#define NUBUS_DRHW_APPLE_SNT 0x0118
#define NUBUS_DRHW_APPLE_SN 0x0119
#define NUBUS_CATEGORY_COMMUNICATIONS 0x0006
#define NUBUS_TYPE_RS232 0x0002
#define NUBUS_TYPE_IEEE488 0x0004
#define NUBUS_TYPE_CENTRONICS 0x000B
#define NUBUS_TYPE_BECTDIC 0x002E
#define NUBUS_DRSW_BECTDIC 0x0100
#define NUBUS_DRSW_CPI 0x0100
#define NUBUS_DRSW_HDS 0x0102
#define NUBUS_DRSW_NI488 0x0104
#define NUBUS_DRHW_BECTDIC 0x0100
#define NUBUS_DRHW_CPI 0x0100
#define NUBUS_DRHW_HDS 0x0102
#define NUBUS_DRHW_NBGPIBTNT 0x0102
#define NUBUS_CATEGORY_MEMORY 0x0009
#define NUBUS_TYPE_RAMCACHE 0x010C
#define NUBUS_DRSW_AWGSPDS 0x0100
#define NUBUS_DRHW_AWGSPDS 0x0100
#define NUBUS_CATEGORY_CPU 0x000A
#define NUBUS_TYPE_68000 0x0002
#define NUBUS_TYPE_68020 0x0003
#define NUBUS_TYPE_68030 0x0004
#define NUBUS_TYPE_68040 0x0005
#define NUBUS_TYPE_MX 0x0009
#define NUBUS_CATEGORY_INTBUS 0x000C
#define NUBUS_TYPE_SCSI 0x0008
#define NUBUS_DRSW_AWGSPDS_SCSI 0x0006
#define NUBUS_DRHW_AWGSPDS_SCSI 0x0100
#define NUBUS_DRSW_PLI 0x0108
#define NUBUS_DRHW_PLI 0x0100
#define NUBUS_TYPE_SCSIW 0x000B
#define NUBUS_DRSW_FWB 0x0001
#define NUBUS_DRHW_FWB 0x0100
#define NUBUS_TYPE_SCSIAW 0x0106
#define NUBUS_DRSW_ATTOSE 0x0101
#define NUBUS_DRHW_ATTOSE 0x0100
#define NUBUS_CATEGORY_DOCK 0x0020
#define NUBUS_TYPE_STATION 0x0001
#define NUBUS_TYPE_DESK 0x0002
#define NUBUS_TYPE_TRAVEL 0x0003
#define NUBUS_DRSW_NEWERTECH 0x0101
#define NUBUS_DRHW_DUODOCK 0x0001
#define NUBUS_DRHW_DUODOCKII 0x0002
#define NUBUS_DRHW_DUOMINIDOCK 0x0001
#define NUBUS_DRHW_MICROSCSI 0x0100
typedef struct _nubus_slot {
u_long top;
u_int8_t slot;
u_int8_t bytelanes;
u_int8_t step;
u_int32_t test_pattern;
u_int8_t format;
u_int8_t revision_level;
u_int32_t crc;
u_int32_t length;
u_int32_t directory_offset;
} nubus_slot;
typedef struct _nubus_type {
u_int16_t category;
u_int16_t type;
u_int16_t drsw;
u_int16_t drhw;
} nubus_type;
typedef struct _nubus_dir {
u_int32_t dirbase;
u_int32_t curr_ent;
} nubus_dir;
typedef struct _nubus_dirent {
u_int32_t myloc;
u_int8_t rsrc_id;
u_int32_t offset;
} nubus_dirent;
typedef struct _nubus_rsrc {
u_int32_t myloc;
u_int8_t id;
u_int32_t data;
} nubus_rsrc;
typedef struct _nubus_smem_range {
u_int32_t length;
u_int32_t offset;
} nubus_smem_range;
typedef struct _nubus_smem_rangelist {
u_int32_t length;
nubus_smem_range range[1];
} nubus_smem_rangelist;
#define NUBUS_RSRC_TYPE 0x01
#define NUBUS_RSRC_NAME 0x02
#define NUBUS_RSRC_ICON 0x03
#define NUBUS_RSRC_DRVRDIR 0x04
#define NUBUS_RSRC_LOADREC 0x05
#define NUBUS_RSRC_BOOTREC 0x06
#define NUBUS_RSRC_FLAGS 0x07
#define NUBUS_RSRC_HWDEVID 0x08
#define NUBUS_RSRC_MINOR_BASEOS 0x0A
#define NUBUS_RSRC_MINOR_LENGTH 0x0B
#define NUBUS_RSRC_MAJOR_BASEOS 0x0C
#define NUBUS_RSRC_MAJOR_LENGTH 0x0D
#define NUBUS_RSRC_CICN 0x0F
#define NUBUS_RSRC_ICL8 0x10
#define NUBUS_RSRC_ICL4 0x11
#define NUBUS_RSRC_SMEMORY 0x6C
#define NUBUS_RSRC_GAMMADIR 0x40
#define NUBUS_RSRC_VIDNAMES 0x41
#define NUBUS_RSRC_FIRSTMODE 0x80
#define NUBUS_RSRC_SECONDMODE 0x81
#define NUBUS_RSRC_THIRDMODE 0x82
#define NUBUS_RSRC_FOURTHMODE 0x83
#define NUBUS_RSRC_FIFTHMODE 0x84
#define NUBUS_RSRC_SIXTHMODE 0x85
#define NUBUS_RSRC_BOARDID 0x20
#define NUBUS_RSRC_PRAMINITDATA 0x21
#define NUBUS_RSRC_PRIMARYINIT 0x22
#define NUBUS_RSRC_TIMEOUTCONST 0x23
#define NUBUS_RSRC_VENDORINFO 0x24
#define NUBUS_RSRC_BOARDFLAGS 0x25
#define NUBUS_RSRC_SECONDINIT 0x26
#define NUBUS_RSRC_VEND_ID 0x01
#define NUBUS_RSRC_VEND_SERIAL 0x02
#define NUBUS_RSRC_VEND_REV 0x03
#define NUBUS_RSRC_VEND_PART 0x04
#define NUBUS_RSRC_VEND_DATE 0x05
#define NUBUS_RSRC_SMEM_MINOR_RAMADDR 0x80
#define NUBUS_RSRC_SMEM_MAJOR_RAMADDR 0x81
#define NUBUS_RSRC_SMEM_MINOR_ROMADDR 0x82
#define NUBUS_RSRC_SMEM_MAJOR_ROMADDR 0x83
#define NUBUS_RSRC_SMEM_MINOR_DEVADDR 0x84
#define NUBUS_RSRC_SMEM_MAJOR_DEVADDR 0x85
typedef struct _NUBUS_DRIVER {
u_int8_t drvr_id;
u_int32_t offset;
} NUBUS_DRIVER;
typedef struct _NUBUS_BLOCK {
u_int32_t size;
void * data;
} NUBUS_BLOCK;
typedef struct _NUBUS_EXEC_BLOCK {
u_int32_t size;
u_int8_t revision;
u_int8_t cpu;
u_int32_t code_offset;
void * code;
} NUBUS_EXEC_BLOCK;
#define NUBUS_EXEC_CPU_68000 1
#define NUBUS_EXEC_CPU_68020 2
#define NUBUS_EXEC_CPU_68030 3
#define NUBUS_EXEC_CPU_68040 4
#define NUBUS_MIN_SLOT 0x9
#define NUBUS_MAX_SLOT 0xE
#define NUBUS_ROM_TEST_PATTERN 0x5A932BC7
#define NUBUS_SLOT2PA(x) (0xf9000000 + \
((((x) - NUBUS_MIN_SLOT) & 0xf) << 24))
struct nubus_attach_args {
bus_space_tag_t na_tag;
bus_dma_tag_t na_dmat;
int slot;
int rsrcid;
u_int16_t category;
u_int16_t type;
u_int16_t drsw;
u_int16_t drhw;
nubus_slot *fmt;
};
struct nubus_softc {
device_t sc_dev;
};
void nubus_get_main_dir(nubus_slot *, nubus_dir *);
void nubus_get_dir_from_rsrc(nubus_slot *, nubus_dirent *, nubus_dir *);
int nubus_find_rsrc(bus_space_tag_t, bus_space_handle_t, nubus_slot *,
nubus_dir *, u_int8_t, nubus_dirent *);
int nubus_get_ind_data(bus_space_tag_t, bus_space_handle_t, nubus_slot *,
nubus_dirent *, char *, int);
int nubus_get_c_string(bus_space_tag_t, bus_space_handle_t, nubus_slot *,
nubus_dirent *, char *, int);
int nubus_get_smem_addr_rangelist(bus_space_tag_t, bus_space_handle_t,
nubus_slot *, nubus_dirent *, void *);
const char *nubus_get_vendor(bus_space_tag_t, bus_space_handle_t, nubus_slot *,
int);
const char *nubus_get_card_name(bus_space_tag_t, bus_space_handle_t, nubus_slot *);
#ifdef DEBUG
void nubus_scan_slot(bus_space_tag_t, int);
#endif