|
|
1.1 ! root 1: /*********************************************************************** ! 2: * haicfg.c -- A device driver to allow auto configuration of ! 3: * SCSI bus. ! 4: * ! 5: * Copyright (c) 1993, Christopher Sean Hilton, All rights reserved. ! 6: * ! 7: * Last Modified: Thu Jun 24 22:40:26 1993 by [chris] ! 8: * ! 9: * $Id: haiinst.c,v 1.1 93/07/20 11:21:29 bin Exp Locker: bin $ ! 10: */ ! 11: ! 12: #include <stddef.h> ! 13: #include <sys/coherent.h> ! 14: #include <sys/con.h> ! 15: #include <sys/buf.h> ! 16: #include <sys/io.h> ! 17: #include <sys/sched.h> ! 18: #include <sys/stat.h> ! 19: ! 20: #include <sys/uproc.h> ! 21: #include <errno.h> ! 22: ! 23: #include <sys/haiscsi.h> ! 24: #include <sys/haiinst.h> ! 25: ! 26: #define CFGMAJOR 14 ! 27: #define INQUIRY 0x12 ! 28: ! 29: static void cfg_open(); ! 30: static void cfg_ioctl(); ! 31: static int cfg_load(); ! 32: ! 33: extern int nonedev(); /* Set error and exit. */ ! 34: extern int nulldev(); /* Do nothing and exit. */ ! 35: ! 36: CON cfgcon = { ! 37: DFCHR, ! 38: CFGMAJOR, ! 39: cfg_open, /* Open entry point */ ! 40: nulldev, /* Close entry point */ ! 41: nonedev, /* Block entry point. */ ! 42: nonedev, /* Read Entry point */ ! 43: nonedev, /* write entry point */ ! 44: cfg_ioctl, /* IO control entry point */ ! 45: nonedev, /* No powerfail entry (yet?) */ ! 46: hatimer, /* timeout entry point */ ! 47: cfg_load, /* Load entry point */ ! 48: nulldev, /* Unload entry point */ ! 49: nonedev /* No poll entry yet either. */ ! 50: }; ! 51: ! 52: srb_t cfgsrb = { 0 }; ! 53: int haipresent; ! 54: ! 55: /*********************************************************************** ! 56: * int cfg_open(dev_t dev, int mode) ! 57: * ! 58: * Just make sure that the Host Adapter was initialized properly. ! 59: */ ! 60: ! 61: static void cfg_open(dev /*, mode */) ! 62: register dev_t dev; ! 63: /* int mode; */ ! 64: { ! 65: if (tid(dev) != HAI_HAID || !haipresent) ! 66: u. u_error = EINVAL; ! 67: } /* cfg_open() */ ! 68: ! 69: /*********************************************************************** ! 70: * cfg_load() ! 71: * ! 72: * Load Entry point. ! 73: */ ! 74: ! 75: static int cfg_load() ! 76: ! 77: { ! 78: printf("\nHAISCSI Configuration Driver v1.1\n"); ! 79: haipresent = hainit(); ! 80: if (!haipresent) ! 81: printf("Host Adapter Initialization failed\n"); ! 82: ! 83: return haipresent; ! 84: } /* cfg_load() */ ! 85: ! 86: static void ioctlfin() ! 87: ! 88: { ! 89: } /* ioctlfin() */ ! 90: ! 91: static void cfg_ioctl(dev, cmd, vec) ! 92: dev_t dev; ! 93: int cmd; ! 94: char *vec; ! 95: { ! 96: cfg_io_t c; ! 97: ! 98: if (!haipresent || tid(dev) != HAI_HAID) { ! 99: u. u_error = EINVAL; ! 100: return; ! 101: } ! 102: ! 103: memset(&cfgsrb, 0, sizeof(srb_t)); ! 104: ukcopy(vec, &c, sizeof(c)); ! 105: cfgsrb. dev = dev; ! 106: cfgsrb. target = c. target; ! 107: cfgsrb. lun = c. lun; ! 108: switch (cmd) { ! 109: case HAICFG_INQ: /* Inquiry command */ ! 110: cfgsrb. buf. space = USER_ADDR; ! 111: cfgsrb. buf. addr. vaddr = (vaddr_t) (((cfg_io_p) vec)->buf); ! 112: cfgsrb. buf. size = c. buflen; ! 113: cfgsrb. xferdir = DMAREAD; ! 114: memset(&(cfgsrb. cdb), 0, sizeof(cdb_t)); ! 115: cfgsrb. cdb. g0. opcode = INQUIRY; ! 116: cfgsrb. cdb. g0. xfr_len = cfgsrb. buf. size; ! 117: break; ! 118: case HAICFG_MDSNS0: /* Group 0 Mode Sense */ ! 119: case HAICFG_MDSLT0: /* Group 0 Mode Select */ ! 120: case HAICFG_MDSNS2: /* Group 2 Mode Sense */ ! 121: case HAICFG_MDSLT2: /* Group 2 Mode Select */ ! 122: case HAICFG_USERCDB: /* User's Command/Data Block */ ! 123: default: ! 124: u. u_error = EINVAL; ! 125: break; ! 126: } ! 127: doscsi(&cfgsrb, c. tries, "cfg-ctl"); ! 128: } /* cfg_ioctl() */ ! 129: ! 130: /* End of file */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.