164 { 112, 0x7},
165 { 128, 0x8},
166 { 144, 0x9},
167 { 160, 0xA},
168 { 176, 0xB},
169 { 192, 0xC},
170 { 208, 0xD},
171 { 224, 0xE},
172 { 240, 0xF},
173 { 256, 0x0},
174 { 0, 0x0}
175 };
176 #endif
177
178 static struct fdcmdinfo {
179 char *cmdname; /* command name */
180 uchar_t ncmdbytes; /* number of bytes of command */
181 uchar_t nrsltbytes; /* number of bytes in result */
182 uchar_t cmdtype; /* characteristics */
183 } fdcmds[] = {
184 "", 0, 0, 0, /* - */
185 "", 0, 0, 0, /* - */
186 "read_track", 9, 7, 1, /* 2 */
187 "specify", 3, 0, 3, /* 3 */
188 "sense_drv_status", 2, 1, 3, /* 4 */
189 "write", 9, 7, 1, /* 5 */
190 "read", 9, 7, 1, /* 6 */
191 "recalibrate", 2, 0, 2, /* 7 */
192 "sense_int_status", 1, 2, 3, /* 8 */
193 "write_del", 9, 7, 1, /* 9 */
194 "read_id", 2, 7, 2, /* A */
195 "", 0, 0, 0, /* - */
196 "read_del", 9, 7, 1, /* C */
197 "format_track", 10, 7, 1, /* D */
198 "dump_reg", 1, 10, 4, /* E */
199 "seek", 3, 0, 2, /* F */
200 "version", 1, 1, 3, /* 10 */
201 "", 0, 0, 0, /* - */
202 "perp_mode", 2, 0, 3, /* 12 */
203 "configure", 4, 0, 4, /* 13 */
204 /* relative seek */
205 };
206
207
208 static int
209 fdc_bus_ctl(dev_info_t *, dev_info_t *, ddi_ctl_enum_t, void *, void *);
210 static int get_ioaddr(dev_info_t *dip, int *ioaddr);
211 static int get_unit(dev_info_t *dip, int *cntrl_num);
212
213 struct bus_ops fdc_bus_ops = {
214 BUSO_REV,
215 nullbusmap,
216 0, /* ddi_intrspec_t (*bus_get_intrspec)(); */
217 0, /* int (*bus_add_intrspec)(); */
218 0, /* void (*bus_remove_intrspec)(); */
219 i_ddi_map_fault,
220 0,
221 ddi_dma_allochdl,
222 ddi_dma_freehdl,
223 ddi_dma_bindhdl,
248 (struct cb_ops *)0, /* driver operations */
249 &fdc_bus_ops, /* bus operations */
250 NULL, /* power */
251 fdc_quiesce, /* quiesce */
252 };
253
254 /*
255 * This is the loadable module wrapper.
256 */
257 #include <sys/modctl.h>
258
259 extern struct mod_ops mod_driverops;
260
261 static struct modldrv modldrv = {
262 &mod_driverops, /* Type of module. This one is a driver */
263 "Floppy Controller", /* Name of the module. */
264 &fdc_ops, /* Driver ops vector */
265 };
266
267 static struct modlinkage modlinkage = {
268 MODREV_1, (void *)&modldrv, NULL
269 };
270
271 int
272 _init(void)
273 {
274 int retval;
275
276 if ((retval = ddi_soft_state_init(&fdc_state_head,
277 sizeof (struct fdcntlr) + NFDUN * sizeof (struct fcu_obj), 0)) != 0)
278 return (retval);
279
280 if ((retval = mod_install(&modlinkage)) != 0)
281 ddi_soft_state_fini(&fdc_state_head);
282 return (retval);
283 }
284
285 int
286 _fini(void)
287 {
288 int retval;
|
164 { 112, 0x7},
165 { 128, 0x8},
166 { 144, 0x9},
167 { 160, 0xA},
168 { 176, 0xB},
169 { 192, 0xC},
170 { 208, 0xD},
171 { 224, 0xE},
172 { 240, 0xF},
173 { 256, 0x0},
174 { 0, 0x0}
175 };
176 #endif
177
178 static struct fdcmdinfo {
179 char *cmdname; /* command name */
180 uchar_t ncmdbytes; /* number of bytes of command */
181 uchar_t nrsltbytes; /* number of bytes in result */
182 uchar_t cmdtype; /* characteristics */
183 } fdcmds[] = {
184 {"", 0, 0, 0}, /* - */
185 {"", 0, 0, 0}, /* - */
186 {"read_track", 9, 7, 1}, /* 2 */
187 {"specify", 3, 0, 3}, /* 3 */
188 {"sense_drv_status", 2, 1, 3}, /* 4 */
189 {"write", 9, 7, 1}, /* 5 */
190 {"read", 9, 7, 1}, /* 6 */
191 {"recalibrate", 2, 0, 2}, /* 7 */
192 {"sense_int_status", 1, 2, 3}, /* 8 */
193 {"write_del", 9, 7, 1}, /* 9 */
194 {"read_id", 2, 7, 2}, /* A */
195 {"", 0, 0, 0}, /* - */
196 {"read_del", 9, 7, 1}, /* C */
197 {"format_track", 10, 7, 1}, /* D */
198 {"dump_reg", 1, 10, 4}, /* E */
199 {"seek", 3, 0, 2}, /* F */
200 {"version", 1, 1, 3}, /* 10 */
201 {"", 0, 0, 0}, /* - */
202 {"perp_mode", 2, 0, 3}, /* 12 */
203 {"configure", 4, 0, 4}, /* 13 */
204 /* relative seek */
205 };
206
207
208 static int
209 fdc_bus_ctl(dev_info_t *, dev_info_t *, ddi_ctl_enum_t, void *, void *);
210 static int get_ioaddr(dev_info_t *dip, int *ioaddr);
211 static int get_unit(dev_info_t *dip, int *cntrl_num);
212
213 struct bus_ops fdc_bus_ops = {
214 BUSO_REV,
215 nullbusmap,
216 0, /* ddi_intrspec_t (*bus_get_intrspec)(); */
217 0, /* int (*bus_add_intrspec)(); */
218 0, /* void (*bus_remove_intrspec)(); */
219 i_ddi_map_fault,
220 0,
221 ddi_dma_allochdl,
222 ddi_dma_freehdl,
223 ddi_dma_bindhdl,
248 (struct cb_ops *)0, /* driver operations */
249 &fdc_bus_ops, /* bus operations */
250 NULL, /* power */
251 fdc_quiesce, /* quiesce */
252 };
253
254 /*
255 * This is the loadable module wrapper.
256 */
257 #include <sys/modctl.h>
258
259 extern struct mod_ops mod_driverops;
260
261 static struct modldrv modldrv = {
262 &mod_driverops, /* Type of module. This one is a driver */
263 "Floppy Controller", /* Name of the module. */
264 &fdc_ops, /* Driver ops vector */
265 };
266
267 static struct modlinkage modlinkage = {
268 MODREV_1, { (void *)&modldrv, NULL }
269 };
270
271 int
272 _init(void)
273 {
274 int retval;
275
276 if ((retval = ddi_soft_state_init(&fdc_state_head,
277 sizeof (struct fdcntlr) + NFDUN * sizeof (struct fcu_obj), 0)) != 0)
278 return (retval);
279
280 if ((retval = mod_install(&modlinkage)) != 0)
281 ddi_soft_state_fini(&fdc_state_head);
282 return (retval);
283 }
284
285 int
286 _fini(void)
287 {
288 int retval;
|