diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-01-14 19:01:01 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-01-14 19:01:01 +0000 |
commit | 499e2d8254ecd105a785fca82a7d3b54fd9a0d3e (patch) | |
tree | 50b25d34d1a56c8db951710bfe02b8b315c38cda /sys | |
parent | e99b7f1a2ce82cced0bdcfc749cfb3d831b5cd4e (diff) |
Remove pass-through ioctl for SMD disks (DIOSXDCMD). Nothing uses this, because
noone wrote an equivalent of SunOS format(8) and noone ever will.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/sparc/dev/xd.c | 142 | ||||
-rw-r--r-- | sys/arch/sparc/dev/xio.h | 60 | ||||
-rw-r--r-- | sys/arch/sparc/dev/xy.c | 92 |
3 files changed, 2 insertions, 292 deletions
diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c index 0d4153f81f0..b7026d86b48 100644 --- a/sys/arch/sparc/dev/xd.c +++ b/sys/arch/sparc/dev/xd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xd.c,v 1.64 2015/01/13 20:40:11 miod Exp $ */ +/* $OpenBSD: xd.c,v 1.65 2015/01/14 19:01:00 miod Exp $ */ /* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */ /* @@ -81,7 +81,6 @@ #include <sparc/dev/xdreg.h> #include <sparc/dev/xdvar.h> -#include <sparc/dev/xio.h> #include <sparc/sparc/vaddrs.h> #include <sparc/sparc/cpuvar.h> @@ -208,7 +207,6 @@ int xdc_cmd(struct xdc_softc *, int, int, int, int, int, char *, int); char *xdc_e2str(int); int xdc_error(struct xdc_softc *, struct xd_iorq *, struct xd_iopb *, int, int); -int xdc_ioctlcmd(struct xd_softc *, dev_t dev, struct xd_iocmd *); void xdc_perror(struct xd_iorq *, struct xd_iopb *, int); int xdc_piodriver(struct xdc_softc *, int, int); int xdc_remove_iorq(struct xdc_softc *); @@ -815,7 +813,6 @@ xdioctl(dev, command, addr, flag, p) { struct xd_softc *xd; - struct xd_iocmd *xio; int error, s, unit; unit = DISKUNIT(dev); @@ -869,12 +866,6 @@ xdioctl(dev, command, addr, flag, p) } return error; - case DIOSXDCMD: - xio = (struct xd_iocmd *) addr; - if ((error = suser(p, 0)) != 0) - return (error); - return (xdc_ioctlcmd(xd, dev, xio)); - default: return ENOTTY; } @@ -2124,137 +2115,6 @@ xdc_tick(arg) } /* - * xdc_ioctlcmd: this function provides a user level interface to the - * controller via ioctl. this allows "format" programs to be written - * in user code, and is also useful for some debugging. we return - * an error code. called at user priority. - */ -int -xdc_ioctlcmd(xd, dev, xio) - struct xd_softc *xd; - dev_t dev; - struct xd_iocmd *xio; - -{ - int s, err, rqno, dummy; - caddr_t dvmabuf = NULL, buf = NULL; - struct xdc_softc *xdcsc; - - /* check sanity of requested command */ - - switch (xio->cmd) { - - case XDCMD_NOP: /* no op: everything should be zero */ - if (xio->subfn || xio->dptr || xio->dlen || - xio->block || xio->sectcnt) - return (EINVAL); - break; - - case XDCMD_RD: /* read / write sectors (up to XD_IOCMD_MAXS) */ - case XDCMD_WR: - if (xio->subfn || xio->sectcnt > XD_IOCMD_MAXS || - xio->sectcnt * XDFM_BPS != xio->dlen || xio->dptr == NULL) - return (EINVAL); - break; - - case XDCMD_SK: /* seek: doesn't seem useful to export this */ - return (EINVAL); - - case XDCMD_WRP: /* write parameters */ - return (EINVAL);/* not useful, except maybe drive - * parameters... but drive parameters should - * go via disklabel changes */ - - case XDCMD_RDP: /* read parameters */ - if (xio->subfn != XDFUN_DRV || - xio->dlen || xio->block || xio->dptr) - return (EINVAL); /* allow read drive params to - * get hw_spt */ - xio->sectcnt = xd->hw_spt; /* we already know the answer */ - return (0); - break; - - case XDCMD_XRD: /* extended read/write */ - case XDCMD_XWR: - - switch (xio->subfn) { - - case XDFUN_THD:/* track headers */ - if (xio->sectcnt != xd->hw_spt || - (xio->block % xd->nsect) != 0 || - xio->dlen != XD_IOCMD_HSZ * xd->hw_spt || - xio->dptr == NULL) - return (EINVAL); - xio->sectcnt = 0; - break; - - case XDFUN_FMT:/* NOTE: also XDFUN_VFY */ - if (xio->cmd == XDCMD_XRD) - return (EINVAL); /* no XDFUN_VFY */ - if (xio->sectcnt || xio->dlen || - (xio->block % xd->nsect) != 0 || xio->dptr) - return (EINVAL); - break; - - case XDFUN_HDR:/* header, header verify, data, data ECC */ - return (EINVAL); /* not yet */ - - case XDFUN_DM: /* defect map */ - case XDFUN_DMX:/* defect map (alternate location) */ - if (xio->sectcnt || xio->dlen != XD_IOCMD_DMSZ || - (xio->block % xd->nsect) != 0 || xio->dptr == NULL) - return (EINVAL); - break; - - default: - return (EINVAL); - } - break; - - case XDCMD_TST: /* diagnostics */ - return (EINVAL); - - default: - return (EINVAL);/* ??? */ - } - - /* create DVMA buffer for request if needed */ - - if (xio->dlen) { - dvmabuf = dvma_malloc(xio->dlen, &buf, M_WAITOK); - if (xio->cmd == XDCMD_WR || xio->cmd == XDCMD_XWR) { - if ((err = copyin(xio->dptr, buf, xio->dlen)) != 0) { - dvma_free(dvmabuf, xio->dlen, &buf); - return (err); - } - } - } - /* do it! */ - - err = 0; - xdcsc = xd->parent; - s = splbio(); - rqno = xdc_cmd(xdcsc, xio->cmd, xio->subfn, xd->xd_drive, xio->block, - xio->sectcnt, dvmabuf, XD_SUB_WAIT); - if (rqno == XD_ERR_FAIL) { - err = EIO; - goto done; - } - xio->errno = xdcsc->reqs[rqno].errno; - xio->tries = xdcsc->reqs[rqno].tries; - XDC_DONE(xdcsc, rqno, dummy); - - if (xio->cmd == XDCMD_RD || xio->cmd == XDCMD_XRD) - err = copyout(buf, xio->dptr, xio->dlen); - -done: - splx(s); - if (dvmabuf) - dvma_free(dvmabuf, xio->dlen, &buf); - return (err); -} - -/* * xdc_e2str: convert error code number into an error string */ char * diff --git a/sys/arch/sparc/dev/xio.h b/sys/arch/sparc/dev/xio.h deleted file mode 100644 index d0a5a0ada08..00000000000 --- a/sys/arch/sparc/dev/xio.h +++ /dev/null @@ -1,60 +0,0 @@ -/* $OpenBSD: xio.h,v 1.4 2014/07/11 16:35:40 jsg Exp $ */ -/* $NetBSD: xio.h,v 1.2 1996/03/31 22:38:58 pk Exp $ */ - -/* - * Copyright (c) 1995 Charles D. Cranor - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * x i o . h - * - * this file defines the software structure we use to ioctl the - * 753/7053. this interface isn't set in stone and may (or may not) - * need adjustment. - * - * author: Chuck Cranor <chuck@ccrc.wustl.edu> - */ - -/* - * xylogic ioctl interface - */ - -struct xd_iocmd { - u_char cmd; /* in: command number */ - u_char subfn; /* in: subfunction number */ - u_char errno; /* out: error number */ - u_char tries; /* out: number of tries */ - u_short sectcnt; /* in,out: sector count (hw_spt on read drive param) */ - u_short dlen; /* in: length of data buffer (good sanity check) */ - u_long block; /* in: block number */ - caddr_t dptr; /* in: data buffer to do I/O from */ -}; - -#ifndef DIOSXDCMD -#define DIOSXDCMD _IOWR('x', 101, struct xd_iocmd) /* do xd command */ -#endif - -#define XD_IOCMD_MAXS 16 /* max number of sectors you can do */ -#define XD_IOCMD_HSZ 4 /* size of one header */ -#define XD_IOCMD_DMSZ 24 /* defect map size */ diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c index 541efc53b1f..8a16c28f900 100644 --- a/sys/arch/sparc/dev/xy.c +++ b/sys/arch/sparc/dev/xy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xy.c,v 1.61 2015/01/13 20:40:11 miod Exp $ */ +/* $OpenBSD: xy.c,v 1.62 2015/01/14 19:01:00 miod Exp $ */ /* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */ /* @@ -79,7 +79,6 @@ #include <sparc/dev/xyreg.h> #include <sparc/dev/xyvar.h> -#include <sparc/dev/xio.h> #include <sparc/sparc/vaddrs.h> /* @@ -145,7 +144,6 @@ char *xyc_e2str(int); int xyc_entoact(int); int xyc_error(struct xyc_softc *, struct xy_iorq *, struct xy_iopb *, int); -int xyc_ioctlcmd(struct xy_softc *, dev_t dev, struct xd_iocmd *); void xyc_perror(struct xy_iorq *, struct xy_iopb *, int); int xyc_piodriver(struct xyc_softc *, struct xy_iorq *); int xyc_remove_iorq(struct xyc_softc *); @@ -772,7 +770,6 @@ xyioctl(dev, command, addr, flag, p) { struct xy_softc *xy; - struct xd_iocmd *xio; int error, s, unit; unit = DISKUNIT(dev); @@ -826,12 +823,6 @@ xyioctl(dev, command, addr, flag, p) } return error; - case DIOSXDCMD: - xio = (struct xd_iocmd *) addr; - if ((error = suser(p, 0)) != 0) - return (error); - return (xyc_ioctlcmd(xy, dev, xio)); - default: return ENOTTY; } @@ -1933,87 +1924,6 @@ xyc_tick(arg) } /* - * xyc_ioctlcmd: this function provides a user level interface to the - * controller via ioctl. this allows "format" programs to be written - * in user code, and is also useful for some debugging. we return - * an error code. called at user priority. - * - * XXX missing a few commands (see the 7053 driver for ideas) - */ -int -xyc_ioctlcmd(xy, dev, xio) - struct xy_softc *xy; - dev_t dev; - struct xd_iocmd *xio; - -{ - int s, err, rqno, dummy = 0; - caddr_t dvmabuf = NULL, buf = NULL; - struct xyc_softc *xycsc; - - /* check sanity of requested command */ - - switch (xio->cmd) { - - case XYCMD_NOP: /* no op: everything should be zero */ - if (xio->subfn || xio->dptr || xio->dlen || - xio->block || xio->sectcnt) - return (EINVAL); - break; - - case XYCMD_RD: /* read / write sectors (up to XD_IOCMD_MAXS) */ - case XYCMD_WR: - if (xio->subfn || xio->sectcnt > XD_IOCMD_MAXS || - xio->sectcnt * XYFM_BPS != xio->dlen || xio->dptr == NULL) - return (EINVAL); - break; - - case XYCMD_SK: /* seek: doesn't seem useful to export this */ - return (EINVAL); - - break; - - default: - return (EINVAL);/* ??? */ - } - - /* create DVMA buffer for request if needed */ - - if (xio->dlen) { - dvmabuf = dvma_malloc(xio->dlen, &buf, M_WAITOK); - if (xio->cmd == XYCMD_WR) { - if ((err = copyin(xio->dptr, buf, xio->dlen)) != 0) { - dvma_free(dvmabuf, xio->dlen, &buf); - return (err); - } - } - } - /* do it! */ - - err = 0; - xycsc = xy->parent; - s = splbio(); - rqno = xyc_cmd(xycsc, xio->cmd, xio->subfn, xy->xy_drive, xio->block, - xio->sectcnt, dvmabuf, XY_SUB_WAIT); - if (rqno == XY_ERR_FAIL) { - err = EIO; - goto done; - } - xio->errno = xycsc->ciorq->errno; - xio->tries = xycsc->ciorq->tries; - XYC_DONE(xycsc, dummy); - - if (xio->cmd == XYCMD_RD) - err = copyout(buf, xio->dptr, xio->dlen); - -done: - splx(s); - if (dvmabuf) - dvma_free(dvmabuf, xio->dlen, &buf); - return (err); -} - -/* * xyc_e2str: convert error code number into an error string */ char * |