fdc.c (36738) | fdc.c (37389) |
---|---|
1 |
|
1/* 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Don Ahn. 7 * 8 * Copyright (c) 1993, 1994 by --- 29 unchanged lines hidden (view full) --- 38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 41 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 42 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 43 * SUCH DAMAGE. 44 * 45 * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 | 2/* 3 * Copyright (c) 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Don Ahn. 8 * 9 * Copyright (c) 1993, 1994 by --- 29 unchanged lines hidden (view full) --- 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 40 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 41 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 42 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 43 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 44 * SUCH DAMAGE. 45 * 46 * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 |
46 * $Id: fd.c,v 1.113 1998/06/07 17:10:20 dfr Exp $ | 47 * $Id: fd.c,v 1.114 1998/06/07 19:40:39 dfr Exp $ |
47 * 48 */ 49 50#include "ft.h" 51#if NFT < 1 52#undef NFDC 53#endif 54#include "fd.h" --- 239 unchanged lines hidden (view full) --- 294 295/* autoconfig structure */ 296 297struct isa_driver fdcdriver = { 298 fdprobe, fdattach, "fdc", 299}; 300 301static d_open_t Fdopen; /* NOTE, not fdopen */ | 48 * 49 */ 50 51#include "ft.h" 52#if NFT < 1 53#undef NFDC 54#endif 55#include "fd.h" --- 239 unchanged lines hidden (view full) --- 295 296/* autoconfig structure */ 297 298struct isa_driver fdcdriver = { 299 fdprobe, fdattach, "fdc", 300}; 301 302static d_open_t Fdopen; /* NOTE, not fdopen */ |
303static d_read_t fdread; 304static d_write_t fdwrite; |
|
302static d_close_t fdclose; 303static d_ioctl_t fdioctl; 304static d_strategy_t fdstrategy; 305 306/* even if SLICE defined, these are needed for the ft support. */ 307#define CDEV_MAJOR 9 308#define BDEV_MAJOR 2 | 305static d_close_t fdclose; 306static d_ioctl_t fdioctl; 307static d_strategy_t fdstrategy; 308 309/* even if SLICE defined, these are needed for the ft support. */ 310#define CDEV_MAJOR 9 311#define BDEV_MAJOR 2 |
309static struct cdevsw fd_cdevsw; 310static struct bdevsw fd_bdevsw = 311 { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/ 312 nodump, nopsize, D_DISK, "fd", &fd_cdevsw, -1 }; | |
313 314 | 312 313 |
314static struct cdevsw fd_cdevsw = { 315 Fdopen, fdclose, fdread, fdwrite, 316 fdioctl, nostop, nullreset, nodevtotty, 317 seltrue, nommap, fdstrategy, "fd", 318 NULL, -1, nodump, nopsize, 319 D_DISK, 0, -1 }; 320 321 |
|
315static struct isa_device *fdcdevs[NFDC]; 316 317#ifdef SLICE 318static sl_h_IO_req_t fdsIOreq; /* IO req downward (to device) */ 319static sl_h_ioctl_t fdsioctl; /* ioctl req downward (to device) */ 320static sl_h_open_t fdsopen; /* downwards travelling open */ 321/*static sl_h_close_t fdsclose; */ /* downwards travelling close */ 322static void fdsinit(void *); --- 470 unchanged lines hidden (view full) --- 793 fd->subdevs[0].slice->probeinfo.typespecific = NULL; 794 fd->subdevs[0].slice->probeinfo.type = NULL; 795 796 fd->ich.ich_func = fdsinit; 797 fd->ich.ich_arg = &fd->subdevs[0]; 798 config_intrhook_establish(&fd->ich); 799#else /* SLICE */ 800 mynor = fdu << 6; | 322static struct isa_device *fdcdevs[NFDC]; 323 324#ifdef SLICE 325static sl_h_IO_req_t fdsIOreq; /* IO req downward (to device) */ 326static sl_h_ioctl_t fdsioctl; /* ioctl req downward (to device) */ 327static sl_h_open_t fdsopen; /* downwards travelling open */ 328/*static sl_h_close_t fdsclose; */ /* downwards travelling close */ 329static void fdsinit(void *); --- 470 unchanged lines hidden (view full) --- 800 fd->subdevs[0].slice->probeinfo.typespecific = NULL; 801 fd->subdevs[0].slice->probeinfo.type = NULL; 802 803 fd->ich.ich_func = fdsinit; 804 fd->ich.ich_arg = &fd->subdevs[0]; 805 config_intrhook_establish(&fd->ich); 806#else /* SLICE */ 807 mynor = fdu << 6; |
801 fd->bdevs[0] = devfs_add_devswf(&fd_bdevsw, mynor, DV_BLK, | 808 fd->bdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_BLK, |
802 UID_ROOT, GID_OPERATOR, 0640, 803 "fd%d", fdu); 804 fd->cdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_CHR, 805 UID_ROOT, GID_OPERATOR, 0640, 806 "rfd%d", fdu); 807#endif /* SLICE */ 808 for (i = 1; i < 1 + NUMDENS; i++) { 809 /* --- 48 unchanged lines hidden (view full) --- 858 namebuf); 859 /* Allow full probing */ 860 fd->subdevs[i].slice->probeinfo.typespecific = NULL; 861 fd->subdevs[i].slice->probeinfo.type = NO_SUBPART; 862 } 863#else /* SLICE */ 864 typemynor = mynor | i; 865 fd->bdevs[i] = | 809 UID_ROOT, GID_OPERATOR, 0640, 810 "fd%d", fdu); 811 fd->cdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_CHR, 812 UID_ROOT, GID_OPERATOR, 0640, 813 "rfd%d", fdu); 814#endif /* SLICE */ 815 for (i = 1; i < 1 + NUMDENS; i++) { 816 /* --- 48 unchanged lines hidden (view full) --- 865 namebuf); 866 /* Allow full probing */ 867 fd->subdevs[i].slice->probeinfo.typespecific = NULL; 868 fd->subdevs[i].slice->probeinfo.type = NO_SUBPART; 869 } 870#else /* SLICE */ 871 typemynor = mynor | i; 872 fd->bdevs[i] = |
866 devfs_add_devswf(&fd_bdevsw, typemynor, DV_BLK, | 873 devfs_add_devswf(&fd_cdevsw, typemynor, DV_BLK, |
867 UID_ROOT, GID_OPERATOR, 0640, 868 "fd%d.%d", fdu, typesize); 869 fd->cdevs[i] = 870 devfs_add_devswf(&fd_cdevsw, typemynor, DV_CHR, 871 UID_ROOT, GID_OPERATOR, 0640, 872 "rfd%d.%d", fdu, typesize); 873 } 874 --- 330 unchanged lines hidden (view full) --- 1205 return ftclose(dev, flags); 1206#endif 1207 fd_data[fdu].flags &= ~FD_OPEN; 1208 fd_data[fdu].options &= ~FDOPT_NORETRY; 1209 1210 return(0); 1211} 1212 | 874 UID_ROOT, GID_OPERATOR, 0640, 875 "fd%d.%d", fdu, typesize); 876 fd->cdevs[i] = 877 devfs_add_devswf(&fd_cdevsw, typemynor, DV_CHR, 878 UID_ROOT, GID_OPERATOR, 0640, 879 "rfd%d.%d", fdu, typesize); 880 } 881 --- 330 unchanged lines hidden (view full) --- 1212 return ftclose(dev, flags); 1213#endif 1214 fd_data[fdu].flags &= ~FD_OPEN; 1215 fd_data[fdu].options &= ~FDOPT_NORETRY; 1216 1217 return(0); 1218} 1219 |
1220static int 1221fdread(dev_t dev, struct uio *uio, int ioflag) 1222{ 1223 return (physio(fdstrategy, NULL, dev, 1, minphys, uio)); 1224} |
|
1213 | 1225 |
1226static int 1227fdwrite(dev_t dev, struct uio *uio, int ioflag) 1228{ 1229 return (physio(fdstrategy, NULL, dev, 0, minphys, uio)); 1230} 1231 1232 |
|
1214/****************************************************************************/ 1215/* fdstrategy */ 1216/****************************************************************************/ 1217void 1218fdstrategy(struct buf *bp) 1219{ 1220 unsigned nblocks, blknum, cando; 1221 int s; --- 953 unchanged lines hidden (view full) --- 2175 2176 2177static fd_devsw_installed = 0; 2178 2179static void fd_drvinit(void *notused ) 2180{ 2181 2182 if( ! fd_devsw_installed ) { | 1233/****************************************************************************/ 1234/* fdstrategy */ 1235/****************************************************************************/ 1236void 1237fdstrategy(struct buf *bp) 1238{ 1239 unsigned nblocks, blknum, cando; 1240 int s; --- 953 unchanged lines hidden (view full) --- 2194 2195 2196static fd_devsw_installed = 0; 2197 2198static void fd_drvinit(void *notused ) 2199{ 2200 2201 if( ! fd_devsw_installed ) { |
2183 bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &fd_bdevsw); | 2202 cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &fd_cdevsw); |
2184 fd_devsw_installed = 1; 2185 } 2186} 2187 2188SYSINIT(fddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,fd_drvinit,NULL) 2189 2190 2191#ifdef SLICE --- 46 unchanged lines hidden --- | 2203 fd_devsw_installed = 1; 2204 } 2205} 2206 2207SYSINIT(fddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,fd_drvinit,NULL) 2208 2209 2210#ifdef SLICE --- 46 unchanged lines hidden --- |