2 * Copyright (c) 1997 by Simon Shapiro
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions, and the following disclaimer,
10 * without modification, immediately at the beginning of the file.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * dpt_control.c: Control Functions and /dev entry points for /dev/dpt*
34 * Caveat Emptor! This is work in progress. The interfaces and
35 * functionality of this code will change (possibly radically) in the
39 #ident "$FreeBSD: src/sys/dev/dpt/dpt_control.c,v 1.16 1999/09/25 18:23:48 phk Exp $"
40 #ident "$DragonFly: src/sys/dev/raid/dpt/dpt_control.c,v 1.7 2004/05/19 22:52:47 dillon Exp $"
44 #include <i386/include/cputypes.h>
45 #include <sys/param.h>
46 #include <sys/systm.h>
47 #include <sys/malloc.h>
48 #include <sys/kernel.h>
53 #include <vm/vm_kern.h>
54 #include <vm/vm_extern.h>
56 #include <scsi/scsiconf.h>
60 #define INLINE __inline
62 extern char osrelease[];
64 enum dpt_message dpt_message;
65 enum dpt_immediate_cmd dpt_immediate_cmd;
67 static dpt_sysinfo_t dpt_sysinfo;
69 /* Entry points and other prototypes */
70 static vm_offset_t dpt_physmap(u_int32_t paddr, vm_size_t size);
71 static void dpt_unphysmap(u_int8_t * vaddr, vm_size_t size);
73 static void dpt_get_sysinfo(void);
75 static int dpt_open(dev_t dev, int flags, int fmt, struct proc * p);
76 static int dpt_close(dev_t dev, int flags, int fmt, struct proc * p);
77 static int dpt_write(dev_t dev, struct uio * uio, int ioflag);
78 static int dpt_read(dev_t dev, struct uio * uio, int ioflag);
79 static int dpt_ioctl(dev_t dev, u_long cmd, caddr_t cmdarg, int flags, struct proc * p);
82 /* This has to be modified as the processor and CPU are not known yet */
83 static dpt_sig_t dpt_sig = {
84 'd', 'P', 't', 'S', 'i', 'G',
85 SIG_VERSION, PROC_INTEL, PROC_386,
86 FT_HBADRVR, FTF_PROTECTED,
88 CAP_PASS | CAP_OVERLAP | CAP_RAID0 | CAP_RAID1 | CAP_RAID5 | CAP_ASPI,
89 DEV_ALL, ADF_SC4_PCI | ADF_SC3_PCI, 0, 0,
90 DPT_RELEASE, DPT_VERSION, DPT_PATCH,
91 DPT_MONTH, DPT_DAY, DPT_YEAR,
92 "DPT FreeBSD Driver (c) 1997 Simon Shapiro"
95 #define CDEV_MAJOR DPT_CDEV_MAJOR
97 /* Normally, this is a static structure. But we need it in pci/dpt_pci.c */
98 static struct cdevsw dpt_cdevsw = {
100 /* maj */ CDEV_MAJOR,
106 /* close */ dpt_close,
108 /* write */ dpt_write,
109 /* ioctl */ dpt_ioctl,
112 /* strategy */ nostrategy,
117 static struct buf *dpt_inbuf[DPT_MAX_ADAPTERS];
118 static char dpt_rw_command[DPT_MAX_ADAPTERS][DPT_RW_CMD_LEN + 1];
122 * Given a minor device number,
123 * return the pointer to its softc structure
127 dpt_minor2softc(int minor_no)
131 if (dpt_minor2unit(minor_no & ~SCSI_CONTROL_MASK) == -1)
134 for (dpt = TAILQ_FIRST(&dpt_softc_list);
135 (dpt != NULL) && (dpt->unit != (minor_no & ~SCSI_CONTROL_MASK));
136 dpt = TAILQ_NEXT(dpt, links));
142 * Map a physical address to virtual one.
143 * This is a first cut, experimental thing
145 * Paddr is the physical address to map
146 * size is the size of the region, in bytes.
147 * Because of alignment problems, we actually round up the size requested to
148 * the next page count.
152 dpt_physmap(u_int32_t req_paddr, vm_size_t req_size)
162 size = (req_size / PAGE_SIZE + 1) * PAGE_SIZE;
163 paddr = req_paddr & 0xfffff000;
164 offset = req_paddr - paddr;
166 va = kmem_alloc_pageable(kernel_map, size);
167 if (va == (vm_offset_t) 0)
170 for (ndx = 0; ndx < size; ndx += PAGE_SIZE) {
171 pmap_kenter(va + ndx, paddr + ndx);
175 return (va + offset);
180 * Release virtual space allocated by physmap We ASSUME that the correct
181 * start address and the correct LENGTH are given.
183 * Disaster will follow if these assumptions are false!
187 dpt_unphysmap(u_int8_t * vaddr, vm_size_t size)
191 for (ndx = 0; ndx < size; ndx += PAGE_SIZE) {
192 pmap_kremove((vm_offset_t) vaddr + ndx);
195 kmem_free(kernel_map, (vm_offset_t) vaddr, size);
199 * Collect interesting system information
200 * The following is one of the worst hacks I have ever allowed my
201 * name to be associated with.
202 * There MUST be a system structure that provides this data.
206 dpt_get_sysinfo(void)
213 bzero(&dpt_sysinfo, sizeof(dpt_sysinfo_t));
216 * This is really silly, but we better run this in splhigh as we
217 * have no clue what we bump into.
218 * Let's hope anyone else who does this sort of things protects them
225 dpt_sig.Processor = dpt_sysinfo.processorType = PROC_386;
228 dpt_sig.Processor = dpt_sysinfo.processorType = PROC_486;
231 dpt_sig.Processor = dpt_sysinfo.processorType = PROC_PENTIUM;
234 dpt_sig.Processor = dpt_sysinfo.processorType = PROC_P6;
237 dpt_sig.Processor = dpt_sysinfo.flags &= ~SI_ProcessorValid;
241 /* Get The First Drive Type From CMOS */
250 dpt_sysinfo.drive0CMOS = j;
252 /* Get The Second Drive Type From CMOS */
258 dpt_sysinfo.drive1CMOS = j;
260 /* Get The Number Of Drives From The Bios Data Area */
261 if ((addr = (char *) dpt_physmap(0x0475, 1024)) == NULL) {
262 printf("DPT: Cannot map BIOS address 0x0475. No sysinfo... :-(\n");
265 dpt_sysinfo.numDrives = *addr;
266 dpt_unphysmap(addr, 1024);
268 /* Get the processor fields from the SIG structure, and set the flags */
269 dpt_sysinfo.processorFamily = dpt_sig.ProcessorFamily;
270 dpt_sysinfo.flags = SI_CMOS_Valid | SI_NumDrivesValid;
272 /* Go out and look for SmartROM */
273 for (i = 0; i < 3; ++i) {
276 addr = (char *) dpt_physmap(0xC8000, 1024);
278 addr = (char *) dpt_physmap(0xD8000, 1024);
280 addr = (char *) dpt_physmap(0xDC000, 1024);
286 if (*((u_int16_t *) addr) == 0xaa55) {
287 if ((*((u_int32_t *) (addr + 6)) == 0x00202053)
288 && (*((u_int32_t *) (addr + 10)) == 0x00545044)) {
292 dpt_unphysmap(addr, 1024);
297 * If i < 3, we founday it so set up a pointer to the starting
298 * version digit by searching for it.
302 for (i = 0; i < 64; ++i)
303 if ((addr[i] == ' ') && (addr[i + 1] == 'v'))
308 dpt_unphysmap(addr, 1024);
312 /* If all is well, set up the SmartROM version fields */
314 dpt_sysinfo.smartROMMajorVersion = *addr - '0'; /* Assumes ASCII */
315 dpt_sysinfo.smartROMMinorVersion = *(addr + 2);
316 dpt_sysinfo.smartROMRevision = *(addr + 3);
317 dpt_sysinfo.flags |= SI_SmartROMverValid;
319 dpt_sysinfo.flags |= SI_NO_SmartROM;
322 /* Get the conventional memory size from CMOS */
328 dpt_sysinfo.conventionalMemSize = j;
331 * Get the extended memory found at power on from CMOS
338 dpt_sysinfo.extendedMemSize = j;
339 dpt_sysinfo.flags |= SI_MemorySizeValid;
341 /* If there is 1 or 2 drives found, set up the drive parameters */
342 if (dpt_sysinfo.numDrives > 0) {
343 /* Get the pointer from int 41 for the first drive parameters */
344 addr = (char *) dpt_physmap(0x0104, 1024);
347 j = *((ushort *) (addr + 2));
349 j += *((ushort *) (addr));
350 dpt_unphysmap(addr, 1024);
351 addr = (char *) dpt_physmap(j, 1024);
354 dpt_sysinfo.drives[0].cylinders = *((ushort *) addr);
355 dpt_sysinfo.drives[0].heads = *(addr + 2);
356 dpt_sysinfo.drives[0].sectors = *(addr + 14);
357 dpt_unphysmap(addr, 1024);
360 if (dpt_sysinfo.numDrives > 1) {
362 * Get the pointer from Int 46 for the second drive
365 addr = (char *) dpt_physmap(0x01118, 1024);
366 j = *((ushort *) (addr + 2));
368 j += *((ushort *) (addr));
369 dpt_unphysmap(addr, 1024);
370 addr = (char *) dpt_physmap(j, 1024);
373 dpt_sysinfo.drives[1].cylinders = *((ushort *) addr);
374 dpt_sysinfo.drives[1].heads = *(addr + 2);
375 dpt_sysinfo.drives[1].sectors = *(addr + 14);
376 dpt_unphysmap(addr, 1024);
379 dpt_sysinfo.flags |= SI_DriveParamsValid;
383 /* Get the processor information */
384 dpt_sysinfo.flags |= SI_ProcessorValid;
386 /* Get the bus I/O bus information */
387 dpt_sysinfo.flags |= SI_BusTypeValid;
388 dpt_sysinfo.busType = HBA_BUS_PCI;
390 /* XXX Use _FreeBSD_Version_ */
391 dpt_sysinfo.osType = OS_FREEBSD;
392 dpt_sysinfo.osMajorVersion = osrelease[0] - '0';
393 if (osrelease[1] == '.')
394 dpt_sysinfo.osMinorVersion = osrelease[2] - '0';
396 dpt_sysinfo.osMinorVersion = 0;
397 if (osrelease[3] == '.')
398 dpt_sysinfo.osRevision = osrelease[4] - '0';
400 dpt_sysinfo.osMinorVersion = 0;
401 if (osrelease[5] == '.')
402 dpt_sysinfo.osSubRevision = osrelease[6] - '0';
404 dpt_sysinfo.osMinorVersion = 0;
407 dpt_sysinfo.flags |= SI_OSversionValid;
411 dpt_open(dev_t dev, int flags, int fmt, struct proc * p)
417 minor_no = minor(dev);
419 if (dpt_minor2unit(minor_no) == -1)
422 dpt = dpt_minor2softc(minor_no);
429 if (dpt->state & DPT_HA_CONTROL_ACTIVE) {
433 if ((dpt_inbuf[minor_no & ~SCSI_CONTROL_MASK] = geteblk(PAGE_SIZE))
435 #ifdef DPT_DEBUG_CONTROL
436 printf("dpt%d: Failed to obtain an I/O buffer\n",
437 minor_no & ~SCSI_CONTROL_MASK);
444 dpt->state |= DPT_HA_CONTROL_ACTIVE;
450 dpt_close(dev_t dev, int flags, int fmt, struct proc * p)
455 minor_no = minor(dev);
456 dpt = dpt_minor2softc(minor_no);
458 if ((dpt_minor2unit(minor_no) == -1) || (dpt == NULL))
461 brelse(dpt_inbuf[minor_no & ~SCSI_CONTROL_MASK]);
462 dpt->state &= ~DPT_HA_CONTROL_ACTIVE;
468 dpt_write(dev_t dev, struct uio * uio, int ioflag)
474 minor_no = minor(dev);
476 if (minor_no & SCSI_CONTROL_MASK) {
477 #ifdef DPT_DEBUG_CONTROL
478 printf("dpt%d: I/O attempted to control channel (%x)\n",
479 dpt_minor2unit(minor_no), minor_no);
483 unit = dpt_minor2unit(minor_no);
487 } else if (uio->uio_resid > DPT_RW_CMD_LEN) {
493 cp = dpt_inbuf[minor_no]->b_data;
494 length = uio->uio_resid; /* uiomove will change it! */
496 if ((error = uiomove(cp, length, uio) != 0)) {
497 #ifdef DPT_DEBUG_CONTROL
498 printf("dpt%d: uiomove(%x, %d, %x) failed (%d)\n",
499 minor_no, cp, length, uio, error);
505 /* A real kludge, to allow plain echo(1) to work */
506 if (cp[length - 1] == '\n')
507 cp[length - 1] = '\0';
509 strncpy(dpt_rw_command[unit], cp, DPT_RW_CMD_LEN);
510 #ifdef DPT_DEBUG_CONTROL
512 * For lack of anything better to do;
513 * For now, dump the data so we can look at it and rejoice
515 printf("dpt%d: Command \"%s\" arrived\n",
516 unit, dpt_rw_command[unit]);
525 dpt_read(dev_t dev, struct uio * uio, int ioflag)
532 minor_no = minor(dev);
535 #ifdef DPT_DEBUG_CONTROL
536 printf("dpt%d: read, count = %d, dev = %08x\n",
537 minor_no, uio->uio_resid, dev);
540 if (minor_no & SCSI_CONTROL_MASK) {
541 #ifdef DPT_DEBUG_CONTROL
542 printf("dpt%d: I/O attempted to control channel (%x)\n",
543 dpt_minor2unit(minor_no), minor_no);
547 if (dpt_minor2unit(minor_no) == -1) {
551 * else if ( uio->uio_resid > PAGE_SIZE ) { return(E2BIG); }
561 if ((dpt = dpt_minor2softc(minor_no)) == NULL)
564 work_buffer = (u_int8_t *) malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
570 command = dpt_rw_command[dpt->unit];
571 if (strcmp(command, DPT_RW_CMD_DUMP_SOFTC) == 0) {
572 x = sprintf(wbp, "dpt%d:%s:%s:%s:%s:%x\n",
574 dpt->board_data.vendor,
575 dpt->board_data.modelNum,
576 dpt->board_data.firmware,
577 dpt->board_data.protocol,
582 } else if (strcmp(command, DPT_RW_CMD_DUMP_SYSINFO) == 0) {
583 x = sprintf(wbp, "dpt%d:%d:%d:%d:%d:%d:%d:%d:%d:%s:"
584 "%d:%d:%d:%d:%d:%d:%d:%d\n",
586 dpt_sysinfo.drive0CMOS,
587 dpt_sysinfo.drive1CMOS,
588 dpt_sysinfo.numDrives,
589 dpt_sysinfo.processorFamily,
590 dpt_sysinfo.processorType,
591 dpt_sysinfo.smartROMMajorVersion,
592 dpt_sysinfo.smartROMMinorVersion,
593 dpt_sysinfo.smartROMRevision,
594 i2bin(dpt_sysinfo.flags,
595 sizeof(dpt->queue_status) * 8),
596 dpt_sysinfo.conventionalMemSize,
597 dpt_sysinfo.extendedMemSize,
598 dpt_sysinfo.osType, dpt_sysinfo.osMajorVersion,
599 dpt_sysinfo.osMinorVersion, dpt_sysinfo.osRevision,
600 dpt_sysinfo.osSubRevision, dpt_sysinfo.busType);
604 for (ndx = 0; ndx < 16; ndx++) {
605 if (dpt_sysinfo.drives[ndx].cylinders != 0) {
606 x = sprintf(wbp, "dpt%d:d%dc%dh%ds%d\n",
609 dpt_sysinfo.drives[ndx].cylinders,
610 dpt_sysinfo.drives[ndx].heads,
611 dpt_sysinfo.drives[ndx].sectors);
616 } else if (strcmp(command, DPT_RW_CMD_DUMP_METRICS) == 0) {
618 "dpt%d: No metrics available.\n"
619 "Run the dpt_dm command, or use the\n"
620 "DPT_IOCTL_INTERNAL_METRICS ioctl system call\n",
624 } else if (strcmp(command, DPT_RW_CMD_CLEAR_METRICS) == 0) {
625 #ifdef DPT_MEASURE_PERFORMANCE
626 dpt_reset_performance(dpt);
627 #endif /* DPT_MEASURE_PERFORMANCE */
629 x = sprintf(wbp, "dpt%d: Metrics have been cleared\n",
633 } else if (strcmp(command, DPT_RW_CMD_SHOW_LED) == 0) {
635 x = sprintf(wbp, "dpt%d:%s\n",
636 dpt->unit, i2bin(dpt_blinking_led(dpt), 8));
640 #ifdef DPT_DEBUG_CONTROL
641 printf("dpt%d: Bad READ state (%s)\n", minor_no, command);
648 work_buffer[work_size++] = '\0';
649 error = uiomove(work_buffer, work_size, uio);
651 #ifdef DPT_DEBUG_CONTROL
653 printf("dpt%d: READ uimove failed (%d)\n", dpt->unit, error);
663 * This is the control syscall interface.
664 * It should be binary compatible with UnixWare,
665 * if not totally syntatically so.
669 dpt_ioctl(dev_t dev, u_long cmd, caddr_t cmdarg, int flags, struct proc * p)
673 dpt_user_softc_t udpt;
676 eata_pt_t *eata_pass_thru;
678 minor_no = minor(dev);
681 if (!(minor_no & SCSI_CONTROL_MASK)) {
682 #ifdef DPT_DEBUG_CONTROL
683 printf("dpt%d: Control attempted to I/O channel (%x)\n",
684 dpt_minor2unit(minor_no), minor_no);
688 minor_no &= ~SCSI_CONTROL_MASK;
690 #ifdef DPT_DEBUG_CONTROL
691 printf("dpt%d: IOCTL(%x, %x, %p, %x, %p)\n",
692 minor_no, dev, cmd, cmdarg, flags, p);
695 if ((dpt = dpt_minor2softc(minor_no)) == NULL)
699 #ifdef DPT_MEASURE_PERFORMANCE
700 case DPT_IOCTL_INTERNAL_METRICS:
701 memcpy(cmdarg, &dpt->performance, sizeof(dpt->performance));
703 #endif /* DPT_MEASURE_PERFORMANCE */
704 case DPT_IOCTL_SOFTC:
705 udpt.unit = dpt->unit;
706 udpt.handle_interrupts = dpt->handle_interrupts;
707 udpt.target_mode_enabled = dpt->target_mode_enabled;
708 udpt.spare = dpt->spare;
710 udpt.total_ccbs_count = dpt->total_ccbs_count;
711 udpt.free_ccbs_count = dpt->free_ccbs_count;
712 udpt.waiting_ccbs_count = dpt->waiting_ccbs_count;
713 udpt.submitted_ccbs_count = dpt->submitted_ccbs_count;
714 udpt.completed_ccbs_count = dpt->completed_ccbs_count;
716 udpt.queue_status = dpt->queue_status;
717 udpt.free_lock = dpt->free_lock;
718 udpt.waiting_lock = dpt->waiting_lock;
719 udpt.submitted_lock = dpt->submitted_lock;
720 udpt.completed_lock = dpt->completed_lock;
722 udpt.commands_processed = dpt->commands_processed;
723 udpt.lost_interrupts = dpt->lost_interrupts;
725 udpt.channels = dpt->channels;
726 udpt.max_id = dpt->max_id;
727 udpt.max_lun = dpt->max_lun;
729 udpt.io_base = dpt->io_base;
730 udpt.v_membase = (u_int8_t *) dpt->v_membase;
731 udpt.p_membase = (u_int8_t *) dpt->p_membase;
734 udpt.dma_channel = dpt->dma_channel;
736 udpt.board_data = dpt->board_data;
737 udpt.EATA_revision = dpt->EATA_revision;
738 udpt.bustype = dpt->bustype;
739 udpt.state = dpt->state;
741 udpt.primary = dpt->primary;
742 udpt.more_support = dpt->more_support;
743 udpt.immediate_support = dpt->immediate_support;
744 udpt.broken_INQUIRY = dpt->broken_INQUIRY;
745 udpt.spare2 = dpt->spare2;
747 for (ndx = 0; ndx < MAX_CHANNELS; ndx++) {
748 udpt.resetlevel[ndx] = dpt->resetlevel[ndx];
749 udpt.hostid[ndx] = dpt->hostid[ndx];
752 udpt.last_ccb = dpt->last_ccb;
753 udpt.cplen = dpt->cplen;
754 udpt.cppadlen = dpt->cppadlen;
755 udpt.queuesize = dpt->queuesize;
756 udpt.sgsize = dpt->sgsize;
757 udpt.cache_type = dpt->cache_type;
758 udpt.cache_size = dpt->cache_size;
760 memcpy(cmdarg, &udpt, sizeof(dpt_user_softc_t));
764 eata_pass_thru = (eata_pt_t *) cmdarg;
766 if ((eata_pass_thru->eataID[0] != 'E')
767 || (eata_pass_thru->eataID[1] != 'A')
768 || (eata_pass_thru->eataID[2] != 'T')
769 || (eata_pass_thru->eataID[3] != 'A')) {
772 switch (eata_pass_thru->command) {
774 return (copyout((char *) &dpt_sig,
775 (caddr_t *) eata_pass_thru->command_buffer,
778 return (copyout((char *) &dpt_controllers_present,
779 (caddr_t *) eata_pass_thru->command_buffer,
780 sizeof(dpt_controllers_present)));
783 dpt_compat_ha_t compat_softc;
786 compat_softc.ha_state = dpt->state; /* Different Meaning! */
787 for (ndx = 0; ndx < MAX_CHANNELS; ndx++)
788 compat_softc.ha_id[ndx] = dpt->hostid[ndx];
790 compat_softc.ha_vect = dpt->irq;
791 compat_softc.ha_base = BaseRegister(dpt);
792 compat_softc.ha_max_jobs = dpt->total_ccbs_count;
793 compat_softc.ha_cache = dpt->cache_type;
794 compat_softc.ha_cachesize = dpt->cache_size;
795 compat_softc.ha_nbus = dpt->dma_channel + 1;
796 compat_softc.ha_ntargets = dpt->max_id + 1;
797 compat_softc.ha_nluns = dpt->max_lun + 1;
798 compat_softc.ha_tshift = (dpt->max_id == 7) ? 3 : 4;
799 compat_softc.ha_bshift = 2;
800 compat_softc.ha_npend = dpt->submitted_ccbs_count;
801 compat_softc.ha_active_jobs = dpt->waiting_ccbs_count;
802 strncpy(compat_softc.ha_fw_version,
803 dpt->board_data.firmware,
804 sizeof(compat_softc.ha_fw_version));
805 compat_softc.ha_ccb = NULL;
806 compat_softc.ha_cblist = NULL;
807 compat_softc.ha_dev = NULL;
808 compat_softc.ha_StPkt_lock = NULL;
809 compat_softc.ha_ccb_lock = NULL;
810 compat_softc.ha_LuQWaiting = NULL;
811 compat_softc.ha_QWait_lock = NULL;
812 compat_softc.ha_QWait_opri = NULL;
814 return (copyout((char *) &compat_softc,
815 (caddr_t *) eata_pass_thru->command_buffer,
816 sizeof(dpt_compat_ha_t)));
821 return (copyout((char *) &dpt_sysinfo,
822 (caddr_t *) eata_pass_thru->command_buffer,
823 sizeof(dpt_sysinfo)));
825 result = dpt_user_cmd(dpt, eata_pass_thru, cmdarg, minor_no);
828 result = dpt_blinking_led(dpt);
829 return (copyout((caddr_t) & result,
830 (caddr_t *) eata_pass_thru->command_buffer,
833 printf("dpt%d: Invalid (%x) pass-throu command\n",
834 dpt->unit, eata_pass_thru->command);
839 printf("dpt%d: Invalid (%lx) IOCTL\n", dpt->unit, cmd);
847 static dpt_devsw_installed = 0;
850 dpt_drvinit(void *unused)
852 if (!dpt_devsw_installed) {
854 printf("DPT: RAID Manager driver, Version %d.%d.%d\n",
855 DPT_CTL_RELEASE, DPT_CTL_VERSION, DPT_CTL_PATCH);
857 /* Add the I/O (data) channel */
858 cdevsw_add(&dpt_cdevsw, 0, 0);
860 dpt_devsw_installed = 1;
865 SYSINIT(dpt_dev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE + CDEV_MAJOR, dpt_drvinit, NULL)
866 /* End of the dpt_control driver */