|
|
1.1 root 1: /*
2: * This file contains definitions related to the kernel structures
3: * for dealing with the massbus adapters.
4: *
5: * Each mba has a mba_hd structure.
6: * Each massbus device has a mba_device structure.
7: * Each massbus slave has a mba_slave structure.
8: *
9: * At boot time we prowl the structures and fill in the pointers
10: * for devices which we find.
11: */
12:
13: /*
14: * Per-mba structure.
15: *
16: * The initialization routine uses the information in the mbdinit table
17: * to initialize the what is attached to each massbus slot information.
18: * It counts the number of devices on each mba (to see if bothering to
19: * search/seek is appropriate).
20: *
21: * During normal operation, the devices attached to the mba which wish
22: * to transfer are queued on the mh_act? links.
23: */
24: struct mba_hd {
25: short mh_active; /* set if mba is active */
26: short mh_ndrive; /* number of devices, to avoid seeks */
27: struct mba_regs *mh_mba; /* virt addr of mba */
28: struct mba_regs *mh_physmba; /* phys addr of mba */
29: struct mba_device *mh_mbip[8]; /* what is attached to each dev */
30: struct mba_device *mh_actf; /* head of queue to transfer */
31: struct mba_device *mh_actl; /* tail of queue to transfer */
32: };
33:
34: /*
35: * Per-device structure
36: * (one for each RM/RP disk, and one for each tape formatter).
37: *
38: * This structure is used by the device driver as its argument
39: * to the massbus driver, and by the massbus driver to locate
40: * the device driver for a particular massbus slot.
41: *
42: * The device drivers hang ready buffers on this structure,
43: * and the massbus driver will start i/o on the first such buffer
44: * when appropriate.
45: */
46: struct mba_device {
47: struct mba_driver *mi_driver;
48: short mi_unit; /* unit number to the system */
49: short mi_mbanum; /* the mba it is on */
50: short mi_drive; /* controller on mba */
51: short mi_dk; /* driver number for iostat */
52: short mi_alive; /* device exists */
53: short mi_type; /* driver specific unit type */
54: struct buf mi_tab; /* head of queue for this device */
55: struct mba_device *mi_forw;
56: /* we could compute these every time, but hereby save time */
57: struct mba_regs *mi_mba;
58: struct mba_drv *mi_drv;
59: struct mba_hd *mi_hd;
60: };
61:
62: /*
63: * Tape formatter slaves are specified by
64: * the following information which is used
65: * at boot time to initialize the tape driver
66: * internal tables.
67: */
68: struct mba_slave {
69: struct mba_driver *ms_driver;
70: short ms_ctlr; /* which of several formatters */
71: short ms_unit; /* which unit to system */
72: short ms_slave; /* which slave to formatter */
73: short ms_alive;
74: };
75:
76: /*
77: * Per device-type structure.
78: *
79: * Each massbus driver defines entries for a set of routines used
80: * by the massbus driver, as well as an array of types which are
81: * acceptable to it.
82: */
83: struct mba_driver {
84: int (*md_attach)(); /* attach a device */
85: int (*md_slave)(); /* attach a slave */
86: int (*md_ustart)(); /* unit start routine */
87: int (*md_start)(); /* setup a data transfer */
88: int (*md_dtint)(); /* data transfer complete */
89: int (*md_ndint)(); /* non-data transfer interrupt */
90: short *md_type; /* array of drive type codes */
91: char *md_dname, *md_sname; /* device, slave names */
92: struct mba_device **md_info; /* backpointers to mbinit structs */
93: };
94:
95: /*
96: * Possible return values from unit start routines.
97: */
98: #define MBU_NEXT 0 /* skip to next operation */
99: #define MBU_BUSY 1 /* dual port busy; wait for intr */
100: #define MBU_STARTED 2 /* non-data transfer started */
101: #define MBU_DODATA 3 /* data transfer ready; start mba */
102:
103: /*
104: * Possible return values from data transfer interrupt handling routines
105: */
106: #define MBD_DONE 0 /* data transfer complete */
107: #define MBD_RETRY 1 /* error occurred, please retry */
108: #define MBD_RESTARTED 2 /* driver restarted i/o itself */
109:
110: /*
111: * Possible return values from non-data-transfer interrupt handling routines
112: */
113: #define MBN_DONE 0 /* non-data transfer complete */
114: #define MBN_RETRY 1 /* failed; retry the operation */
115: #define MBN_SKIP 2 /* don't do anything */
116:
117: /*
118: * Clear attention status for specified device.
119: */
120: #define mbclrattn(mi) ((mi)->mi_mba->mba_drv[0].mbd_as = 1 << (mi)->mi_drive)
121:
122: /*
123: * Kernel definitions related to mba.
124: */
125: #ifdef KERNEL
126: int nummba;
127: #if NMBA > 0
128: struct mba_hd mba_hd[NMBA];
129: extern Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int();
130:
131: extern struct mba_device mbdinit[];
132: extern struct mba_slave mbsinit[];
133: #endif
134: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.