mcd.c (36735) | mcd.c (37389) |
---|---|
1/* 2 * Copyright 1993 by Holger Veit (data part) 3 * Copyright 1993 by Brian Moore (audio part) 4 * Changes Copyright 1993 by Gary Clark II 5 * Changes Copyright (C) 1994-1995 by Andrey A. Chernov, Moscow, Russia 6 * 7 * Rewrote probe routine to work on newer Mitsumi drives. 8 * Additional changes (C) 1994 by Jordan K. Hubbard --- 26 unchanged lines hidden (view full) --- 35 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 36 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 37 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 38 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 39 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 * | 1/* 2 * Copyright 1993 by Holger Veit (data part) 3 * Copyright 1993 by Brian Moore (audio part) 4 * Changes Copyright 1993 by Gary Clark II 5 * Changes Copyright (C) 1994-1995 by Andrey A. Chernov, Moscow, Russia 6 * 7 * Rewrote probe routine to work on newer Mitsumi drives. 8 * Additional changes (C) 1994 by Jordan K. Hubbard --- 26 unchanged lines hidden (view full) --- 35 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 36 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 37 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 38 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 39 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 * |
43 * $Id: mcd.c,v 1.97 1998/01/24 02:54:22 eivind Exp $ | 43 * $Id: mcd.c,v 1.98 1998/06/07 17:10:46 dfr Exp $ |
44 */ 45static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; 46 47#include "mcd.h" 48#if NMCD > 0 49#include "opt_devfs.h" 50 51#include <sys/param.h> --- 152 unchanged lines hidden (view full) --- 204static int mcd_lock_door(int unit, int lock); 205static int mcd_close_tray(int unit); 206 207static int mcd_probe(struct isa_device *dev); 208static int mcd_attach(struct isa_device *dev); 209struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" }; 210 211static d_open_t mcdopen; | 44 */ 45static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; 46 47#include "mcd.h" 48#if NMCD > 0 49#include "opt_devfs.h" 50 51#include <sys/param.h> --- 152 unchanged lines hidden (view full) --- 204static int mcd_lock_door(int unit, int lock); 205static int mcd_close_tray(int unit); 206 207static int mcd_probe(struct isa_device *dev); 208static int mcd_attach(struct isa_device *dev); 209struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" }; 210 211static d_open_t mcdopen; |
212static d_read_t mcdread; |
|
212static d_close_t mcdclose; 213static d_ioctl_t mcdioctl; 214static d_psize_t mcdsize; 215static d_strategy_t mcdstrategy; 216 217#define CDEV_MAJOR 29 218#define BDEV_MAJOR 7 | 213static d_close_t mcdclose; 214static d_ioctl_t mcdioctl; 215static d_psize_t mcdsize; 216static d_strategy_t mcdstrategy; 217 218#define CDEV_MAJOR 29 219#define BDEV_MAJOR 7 |
219static struct cdevsw mcd_cdevsw; 220static struct bdevsw mcd_bdevsw = 221 { mcdopen, mcdclose, mcdstrategy, mcdioctl, /*7*/ 222 nodump, mcdsize, D_DISK, "mcd", &mcd_cdevsw, -1 }; | |
223 | 220 |
221 222 223static struct cdevsw mcd_cdevsw = { 224 mcdopen, mcdclose, mcdread, nowrite, 225 mcdioctl, nostop, nullreset, nodevtotty, 226 seltrue, nommap, mcdstrategy, "mcd", 227 NULL, -1, nodump, nopsize, 228 D_DISK, 0, NODEV }; 229 |
|
224#define mcd_put(port,byte) outb(port,byte) 225 226#define MCD_RETRYS 5 227#define MCD_RDRETRYS 8 228 229#define CLOSE_TRAY_SECS 8 230#define DISK_SENSE_SECS 3 231#define WAIT_FRAC 4 --- 26 unchanged lines hidden (view full) --- 258 devfs_add_devswf(&mcd_cdevsw, dkmakeminor(unit, 0, 0), 259 DV_CHR, UID_ROOT, GID_OPERATOR, 0640, 260 "rmcd%da", unit); 261 cd->rc_devfs_token = 262 devfs_add_devswf(&mcd_cdevsw, dkmakeminor(unit, 0, RAW_PART), 263 DV_CHR, UID_ROOT, GID_OPERATOR, 0640, 264 "rmcd%dc", unit); 265 cd->a_devfs_token = | 230#define mcd_put(port,byte) outb(port,byte) 231 232#define MCD_RETRYS 5 233#define MCD_RDRETRYS 8 234 235#define CLOSE_TRAY_SECS 8 236#define DISK_SENSE_SECS 3 237#define WAIT_FRAC 4 --- 26 unchanged lines hidden (view full) --- 264 devfs_add_devswf(&mcd_cdevsw, dkmakeminor(unit, 0, 0), 265 DV_CHR, UID_ROOT, GID_OPERATOR, 0640, 266 "rmcd%da", unit); 267 cd->rc_devfs_token = 268 devfs_add_devswf(&mcd_cdevsw, dkmakeminor(unit, 0, RAW_PART), 269 DV_CHR, UID_ROOT, GID_OPERATOR, 0640, 270 "rmcd%dc", unit); 271 cd->a_devfs_token = |
266 devfs_add_devswf(&mcd_bdevsw, dkmakeminor(unit, 0, 0), | 272 devfs_add_devswf(&mcd_cdevsw, dkmakeminor(unit, 0, 0), |
267 DV_BLK, UID_ROOT, GID_OPERATOR, 0640, 268 "mcd%da", unit); 269 cd->c_devfs_token = | 273 DV_BLK, UID_ROOT, GID_OPERATOR, 0640, 274 "mcd%da", unit); 275 cd->c_devfs_token = |
270 devfs_add_devswf(&mcd_bdevsw, dkmakeminor(unit, 0, RAW_PART), | 276 devfs_add_devswf(&mcd_cdevsw, dkmakeminor(unit, 0, RAW_PART), |
271 DV_BLK, UID_ROOT, GID_OPERATOR, 0640, 272 "mcd%dc", unit); 273#endif 274 return 1; 275} 276 277int mcdopen(dev_t dev, int flags, int fmt, struct proc *p) 278{ --- 104 unchanged lines hidden (view full) --- 383 384 (void) mcd_lock_door(unit, MCD_LK_UNLOCK); 385 cd->openflags &= ~(1<<part); 386 cd->partflags[part] &= ~MCDREADRAW; 387 388 return 0; 389} 390 | 277 DV_BLK, UID_ROOT, GID_OPERATOR, 0640, 278 "mcd%dc", unit); 279#endif 280 return 1; 281} 282 283int mcdopen(dev_t dev, int flags, int fmt, struct proc *p) 284{ --- 104 unchanged lines hidden (view full) --- 389 390 (void) mcd_lock_door(unit, MCD_LK_UNLOCK); 391 cd->openflags &= ~(1<<part); 392 cd->partflags[part] &= ~MCDREADRAW; 393 394 return 0; 395} 396 |
397static int 398mcdread(dev_t dev, struct uio *uio, int ioflag) 399{ 400 return (physio(mcdstrategy, NULL, dev, 1, minphys, uio)); 401} 402 |
|
391void 392mcdstrategy(struct buf *bp) 393{ 394 struct mcd_data *cd; 395 int s; 396 397 int unit = mcd_unit(bp->b_dev); 398 --- 1437 unchanged lines hidden (view full) --- 1836 1837 1838static mcd_devsw_installed = 0; 1839 1840static void mcd_drvinit(void *unused) 1841{ 1842 1843 if( ! mcd_devsw_installed ) { | 403void 404mcdstrategy(struct buf *bp) 405{ 406 struct mcd_data *cd; 407 int s; 408 409 int unit = mcd_unit(bp->b_dev); 410 --- 1437 unchanged lines hidden (view full) --- 1848 1849 1850static mcd_devsw_installed = 0; 1851 1852static void mcd_drvinit(void *unused) 1853{ 1854 1855 if( ! mcd_devsw_installed ) { |
1844 bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &mcd_bdevsw); | 1856 cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &mcd_cdevsw); |
1845 mcd_devsw_installed = 1; 1846 } 1847} 1848 1849SYSINIT(mcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mcd_drvinit,NULL) 1850 1851 1852#endif /* NMCD > 0 */ | 1857 mcd_devsw_installed = 1; 1858 } 1859} 1860 1861SYSINIT(mcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mcd_drvinit,NULL) 1862 1863 1864#endif /* NMCD > 0 */ |